boltdocs 2.2.0 → 2.4.1

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 (124) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/bin/boltdocs.js +2 -2
  3. package/dist/base-ui/index.d.mts +4 -4
  4. package/dist/base-ui/index.d.ts +4 -4
  5. package/dist/base-ui/index.js +1 -1
  6. package/dist/base-ui/index.mjs +1 -1
  7. package/dist/{cache-CRAZ55X7.mjs → cache-P6WK424C.mjs} +1 -1
  8. package/dist/chunk-2DI3OGHV.mjs +1 -0
  9. package/dist/chunk-2Z5T6EAU.mjs +1 -0
  10. package/dist/chunk-64AJ5QLT.mjs +1 -0
  11. package/dist/chunk-DDX52BX4.mjs +1 -0
  12. package/dist/chunk-HRZDSFR5.mjs +1 -0
  13. package/dist/chunk-PPVDMDEL.mjs +1 -0
  14. package/dist/chunk-UBE4CKOA.mjs +1 -0
  15. package/dist/chunk-UWT4AJTH.mjs +73 -0
  16. package/dist/chunk-WWJ7WKDI.mjs +1 -0
  17. package/dist/chunk-Y4RRHPXC.mjs +1 -0
  18. package/dist/client/index.d.mts +15 -21
  19. package/dist/client/index.d.ts +15 -21
  20. package/dist/client/index.js +1 -1
  21. package/dist/client/index.mjs +1 -1
  22. package/dist/client/ssr.js +1 -1
  23. package/dist/client/ssr.mjs +1 -1
  24. package/dist/client/types.d.mts +1 -1
  25. package/dist/client/types.d.ts +1 -1
  26. package/dist/client/types.js +1 -1
  27. package/dist/{copy-markdown-CbS8X-qe.d.mts → copy-markdown--9yjpbyy.d.mts} +1 -1
  28. package/dist/{copy-markdown-C-90ixSe.d.ts → copy-markdown-l2MYkcG7.d.ts} +1 -1
  29. package/dist/hooks/index.d.mts +8 -16
  30. package/dist/hooks/index.d.ts +8 -16
  31. package/dist/hooks/index.js +1 -1
  32. package/dist/hooks/index.mjs +1 -1
  33. package/dist/integrations/index.d.mts +1 -1
  34. package/dist/integrations/index.d.ts +1 -1
  35. package/dist/{loading-chS3pm9W.d.ts → loading-BwUos0wZ.d.mts} +5 -16
  36. package/dist/{loading-BqGrFWO5.d.mts → loading-nlnUD01v.d.ts} +5 -16
  37. package/dist/mdx/index.d.mts +4 -2
  38. package/dist/mdx/index.d.ts +4 -2
  39. package/dist/mdx/index.js +1 -1
  40. package/dist/mdx/index.mjs +1 -1
  41. package/dist/node/cli-entry.js +25 -22
  42. package/dist/node/cli-entry.mjs +5 -1
  43. package/dist/node/index.d.mts +0 -9
  44. package/dist/node/index.d.ts +0 -9
  45. package/dist/node/index.js +14 -15
  46. package/dist/node/index.mjs +1 -1
  47. package/dist/primitives/index.d.mts +13 -22
  48. package/dist/primitives/index.d.ts +13 -22
  49. package/dist/primitives/index.js +1 -1
  50. package/dist/primitives/index.mjs +1 -1
  51. package/dist/search-dialog-OONKKC5H.mjs +1 -0
  52. package/dist/{types-j7jvWsJj.d.ts → types-opDA2E9-.d.mts} +4 -11
  53. package/dist/{types-j7jvWsJj.d.mts → types-opDA2E9-.d.ts} +4 -11
  54. package/dist/{use-routes-Cd806kGw.d.ts → use-routes-DNwgTRpU.d.ts} +1 -1
  55. package/dist/{use-routes-DDL0_jkQ.d.mts → use-routes-DrT80Eom.d.mts} +1 -1
  56. package/package.json +2 -1
  57. package/src/client/app/index.tsx +20 -9
  58. package/src/client/app/mdx-components-context.tsx +2 -2
  59. package/src/client/app/mdx-page.tsx +0 -1
  60. package/src/client/app/scroll-handler.tsx +21 -10
  61. package/src/client/app/theme-context.tsx +14 -7
  62. package/src/client/components/default-layout.tsx +6 -4
  63. package/src/client/components/docs-layout.tsx +34 -4
  64. package/src/client/components/icons-dev.tsx +154 -0
  65. package/src/client/components/mdx/code-block.tsx +57 -5
  66. package/src/client/components/mdx/component-preview.tsx +1 -0
  67. package/src/client/components/mdx/file-tree.tsx +35 -0
  68. package/src/client/components/primitives/helpers/observer.ts +30 -39
  69. package/src/client/components/primitives/index.ts +1 -0
  70. package/src/client/components/primitives/menu.tsx +18 -12
  71. package/src/client/components/primitives/navbar.tsx +34 -93
  72. package/src/client/components/primitives/on-this-page.tsx +7 -161
  73. package/src/client/components/primitives/popover.tsx +1 -2
  74. package/src/client/components/primitives/search-dialog.tsx +4 -4
  75. package/src/client/components/primitives/sidebar.tsx +3 -2
  76. package/src/client/components/primitives/skeleton.tsx +26 -0
  77. package/src/client/components/ui-base/copy-markdown.tsx +4 -10
  78. package/src/client/components/ui-base/index.ts +0 -1
  79. package/src/client/components/ui-base/loading.tsx +43 -73
  80. package/src/client/components/ui-base/navbar.tsx +18 -15
  81. package/src/client/components/ui-base/page-nav.tsx +2 -1
  82. package/src/client/components/ui-base/powered-by.tsx +4 -1
  83. package/src/client/components/ui-base/search-dialog.tsx +16 -5
  84. package/src/client/components/ui-base/sidebar.tsx +4 -2
  85. package/src/client/hooks/use-i18n.ts +3 -2
  86. package/src/client/hooks/use-localized-to.ts +6 -5
  87. package/src/client/hooks/use-navbar.ts +37 -6
  88. package/src/client/hooks/use-page-nav.ts +27 -6
  89. package/src/client/hooks/use-routes.ts +2 -1
  90. package/src/client/hooks/use-search.ts +81 -59
  91. package/src/client/hooks/use-sidebar.ts +2 -1
  92. package/src/client/index.ts +0 -1
  93. package/src/client/store/use-boltdocs-store.ts +6 -5
  94. package/src/client/theme/neutral.css +31 -3
  95. package/src/client/types.ts +2 -2
  96. package/src/node/{cli.ts → cli/build.ts} +17 -23
  97. package/src/node/cli/dev.ts +22 -0
  98. package/src/node/cli/doctor.ts +243 -0
  99. package/src/node/cli/index.ts +9 -0
  100. package/src/node/cli/ui.ts +54 -0
  101. package/src/node/cli-entry.ts +16 -16
  102. package/src/node/config.ts +1 -15
  103. package/src/node/mdx/cache.ts +1 -1
  104. package/src/node/mdx/index.ts +2 -0
  105. package/src/node/mdx/rehype-shiki.ts +9 -0
  106. package/src/node/mdx/remark-code-meta.ts +35 -0
  107. package/src/node/mdx/remark-shiki.ts +1 -1
  108. package/src/node/plugin/entry.ts +22 -15
  109. package/src/node/plugin/index.ts +46 -14
  110. package/src/node/routes/parser.ts +12 -9
  111. package/src/node/search/index.ts +55 -0
  112. package/src/node/ssg/index.ts +83 -15
  113. package/src/node/ssg/robots.ts +7 -4
  114. package/dist/chunk-5D6XPYQ3.mjs +0 -74
  115. package/dist/chunk-6QXCKZAT.mjs +0 -1
  116. package/dist/chunk-H4M6P3DM.mjs +0 -1
  117. package/dist/chunk-JXHNX2WN.mjs +0 -1
  118. package/dist/chunk-MZBG4N4W.mjs +0 -1
  119. package/dist/chunk-Q3MLYTIQ.mjs +0 -1
  120. package/dist/chunk-RSII2UPE.mjs +0 -1
  121. package/dist/chunk-ZK2266IZ.mjs +0 -1
  122. package/dist/chunk-ZRJ55GGF.mjs +0 -1
  123. package/dist/search-dialog-MA5AISC7.mjs +0 -1
  124. package/src/client/components/ui-base/progress-bar.tsx +0 -67
@@ -19,12 +19,12 @@ export function generateEntryCode(
19
19
  const homeImport = options.homePage
20
20
  ? `import HomePage from '${normalizePath(options.homePage)}';`
21
21
  : ''
22
-
22
+
23
23
  // Auto-import index.css if it exists
24
24
  const cssPath = path.resolve(process.cwd(), 'index.css')
25
25
  const cssImport = fs.existsSync(cssPath) ? "import './index.css';" : ''
26
26
 
27
- const homeOption = options.homePage ? 'homePage: HomePage,' : ''
27
+ let homeOption = options.homePage ? 'homePage: HomePage,' : ''
28
28
  const pluginComponents =
29
29
  config?.plugins?.flatMap((p) => Object.entries(p.components || {})) || []
30
30
 
@@ -40,21 +40,28 @@ const ${name} = _comp_${name}.default || _comp_${name}['${name}'] || _comp_${nam
40
40
  const componentMap = pluginComponents.map(([name]) => name).join(', ')
41
41
 
42
42
  const docsDirName = path.basename(options.docsDir || 'docs')
43
+ const docsDir = path.resolve(process.cwd(), options.docsDir || 'docs')
43
44
 
44
- const externalEntries = Object.entries(config?.external || {})
45
- const externalImports = externalEntries
46
- .map(
47
- ([_routePath, compPath], i) =>
48
- `import _ext_${i} from '${normalizePath(compPath)}';`,
49
- )
50
- .join('\n')
51
- const externalOption =
52
- externalEntries.length > 0
53
- ? `externalPages: { ${externalEntries
54
- .map(([path], i) => `"${path}": _ext_${i}`)
55
- .join(', ')} },`
45
+ // Detect external pages module
46
+ const externalModulePath = ['tsx', 'ts', 'jsx', 'js']
47
+ .map((ext) => path.resolve(docsDir, `pages-external/index.${ext}`))
48
+ .find((p) => fs.existsSync(p))
49
+
50
+ const externalModuleImport = externalModulePath
51
+ ? `import * as _external_module from '${normalizePath(externalModulePath)}';`
52
+ : ''
53
+
54
+ // Prioritize homePage from external module if it exists
55
+ homeOption = externalModulePath
56
+ ? 'homePage: _external_module.homePage || HomePage,'
57
+ : options.homePage
58
+ ? 'homePage: HomePage,'
56
59
  : ''
57
60
 
61
+ const externalOption = externalModulePath
62
+ ? 'externalPages: _external_module.pages, externalLayout: _external_module.layout,'
63
+ : ''
64
+
58
65
  return `
59
66
  import { createBoltdocsApp as _createApp } from 'boltdocs/client';
60
67
  import _routes from 'virtual:boltdocs-routes';
@@ -63,7 +70,7 @@ import _user_mdx_components from 'virtual:boltdocs-mdx-components';
63
70
  ${cssImport}
64
71
  ${homeImport}
65
72
  ${componentImports}
66
- ${externalImports}
73
+ ${externalModuleImport}
67
74
 
68
75
  _createApp({
69
76
  target: '#root',
@@ -9,6 +9,7 @@ import type { BoltdocsPluginOptions } from './types'
9
9
  import { generateEntryCode } from './entry'
10
10
  import { injectHtmlMeta, getHtmlTemplate } from './html'
11
11
  import { generateRobotsTxt } from '../ssg/robots'
12
+ import { generateSearchData } from '../search'
12
13
  import fs from 'fs'
13
14
 
14
15
  export * from './types'
@@ -101,20 +102,19 @@ export function boltdocsPlugin(
101
102
  (locale) =>
102
103
  url.startsWith(`/${locale}/docs`) || url === `/${locale}`,
103
104
  )) ||
104
- (config.external &&
105
- Object.keys(config.external).some((extPath) =>
106
- url.startsWith(extPath),
107
- ))
105
+ // Handle any HTML request that isn't a known static file or docs,
106
+ // as it potentially could be an external page.
107
+ // (The client-side router will handle 404s if it doesn't match anything)
108
+ true
108
109
 
109
110
  // Improved check: If it's a doc route, serve HTML even if it has a dot (e.g. version 1.1)
110
111
  // We only skip if it has a known asset extension to prevent serving HTML for images/js/etc.
111
- const isAsset = /\.(js|css|png|jpe?g|gif|svg|ico|webp|woff2?|ttf|otf|mp4|webm|ogg|mp3|wav|flac|aac|pdf|zip|gz|map|json)$/i.test(url)
112
+ const isAsset =
113
+ /\.(js|css|png|jpe?g|gif|svg|ico|webp|woff2?|ttf|otf|mp4|webm|ogg|mp3|wav|flac|aac|pdf|zip|gz|map|json)$/i.test(
114
+ url,
115
+ )
112
116
 
113
- if (
114
- accept.includes('text/html') &&
115
- !isAsset &&
116
- isDocRoute
117
- ) {
117
+ if (accept.includes('text/html') && !isAsset && isDocRoute) {
118
118
  let html = getHtmlTemplate(config)
119
119
  html = injectHtmlMeta(html, config)
120
120
  html = await server.transformIndexHtml(req.url || '/', html)
@@ -140,11 +140,15 @@ export function boltdocsPlugin(
140
140
  const mdxCompPaths = mdxCompExtensions.map((ext) =>
141
141
  path.resolve(docsDir, `mdx-components.${ext}`),
142
142
  )
143
+ const extPagesPaths = mdxCompExtensions.map((ext) =>
144
+ path.resolve(docsDir, `pages-external/index.${ext}`),
145
+ )
143
146
 
144
147
  server.watcher.add([
145
148
  ...configPaths,
146
149
  ...mdxCompPaths,
147
150
  ...layoutCompPaths,
151
+ ...extPagesPaths,
148
152
  ])
149
153
 
150
154
  const handleFileEvent = async (
@@ -186,6 +190,19 @@ export function boltdocsPlugin(
186
190
  return
187
191
  }
188
192
 
193
+ // If any pages-external file changes, invalidate the entry module
194
+ if (
195
+ normalized.includes('/pages-external/') ||
196
+ normalized.includes('\\pages-external\\')
197
+ ) {
198
+ const mod = server.moduleGraph.getModuleById(
199
+ '\0virtual:boltdocs-entry',
200
+ )
201
+ if (mod) server.moduleGraph.invalidateModule(mod)
202
+ server.ws.send({ type: 'full-reload' })
203
+ return
204
+ }
205
+
189
206
  if (
190
207
  !normalized.startsWith(normalizedDocsDir) ||
191
208
  !isDocFile(normalized)
@@ -197,8 +214,10 @@ export function boltdocsPlugin(
197
214
  invalidateRouteCache()
198
215
  // Re-resolve config as it might affect versions/routes
199
216
  config = await resolveConfig(docsDir)
200
-
201
- const configMod = server.moduleGraph.getModuleById('\0virtual:boltdocs-config')
217
+
218
+ const configMod = server.moduleGraph.getModuleById(
219
+ '\0virtual:boltdocs-config',
220
+ )
202
221
  if (configMod) server.moduleGraph.invalidateModule(configMod)
203
222
 
204
223
  server.ws.send({
@@ -219,7 +238,12 @@ export function boltdocsPlugin(
219
238
  // Regenerate and push to client
220
239
  // Optimization: generateRoutes is mostly incremental thanks to docCache
221
240
  // We only force a full disk scan on add/unlink events
222
- const newRoutes = await generateRoutes(docsDir, config, '/docs', type !== 'change')
241
+ const newRoutes = await generateRoutes(
242
+ docsDir,
243
+ config,
244
+ '/docs',
245
+ type !== 'change',
246
+ )
223
247
 
224
248
  const routesMod = server.moduleGraph.getModuleById(
225
249
  '\0virtual:boltdocs-routes',
@@ -247,7 +271,8 @@ export function boltdocsPlugin(
247
271
  id === 'virtual:boltdocs-config' ||
248
272
  id === 'virtual:boltdocs-entry' ||
249
273
  id === 'virtual:boltdocs-mdx-components' ||
250
- id === 'virtual:boltdocs-layout'
274
+ id === 'virtual:boltdocs-layout' ||
275
+ id === 'virtual:boltdocs-search'
251
276
  ) {
252
277
  return '\0' + id
253
278
  }
@@ -265,6 +290,7 @@ export function boltdocsPlugin(
265
290
  i18n: config?.i18n,
266
291
  versions: config?.versions,
267
292
  siteUrl: config?.siteUrl,
293
+ plugins: config?.plugins?.map((p) => ({ name: p.name })),
268
294
  }
269
295
  return `export default ${JSON.stringify(clientConfig, null, 2)};`
270
296
  }
@@ -316,6 +342,12 @@ export default UserLayout;`
316
342
  return `import { DefaultLayout } from 'boltdocs/client';
317
343
  export default DefaultLayout;`
318
344
  }
345
+
346
+ if (id === '\0virtual:boltdocs-search') {
347
+ const routes = await generateRoutes(docsDir, config)
348
+ const searchData = generateSearchData(routes)
349
+ return `export default ${JSON.stringify(searchData, null, 2)};`
350
+ }
319
351
  },
320
352
 
321
353
  transformIndexHtml: {
@@ -60,14 +60,12 @@ export function parseDocFile(
60
60
  if (config?.versions && parts.length > 0) {
61
61
  const potentialVersion = parts[0]
62
62
  const prefix = config.versions.prefix || ''
63
-
64
- const versionMatch = config.versions.versions.find(
65
- (v) => {
66
- const fullPath = prefix + v.path
67
- return potentialVersion === fullPath || potentialVersion === v.path
68
- }
69
- )
70
-
63
+
64
+ const versionMatch = config.versions.versions.find((v) => {
65
+ const fullPath = prefix + v.path
66
+ return potentialVersion === fullPath || potentialVersion === v.path
67
+ })
68
+
71
69
  if (versionMatch) {
72
70
  version = versionMatch.path
73
71
  parts = parts.slice(1)
@@ -112,6 +110,9 @@ export function parseDocFile(
112
110
  if (locale) {
113
111
  finalPath += '/' + locale
114
112
  }
113
+ if (inferredTab) {
114
+ finalPath += '/' + inferredTab
115
+ }
115
116
  finalPath += cleanRoutePath === '/' ? '' : cleanRoutePath
116
117
 
117
118
  if (!finalPath || finalPath === '') finalPath = '/'
@@ -168,7 +169,9 @@ export function parseDocFile(
168
169
  sanitizedDescription = plainExcerpt
169
170
  }
170
171
 
171
- const sanitizedBadge = data.badge ? sanitizeHtml(String(data.badge)) : undefined
172
+ const sanitizedBadge = data.badge
173
+ ? sanitizeHtml(String(data.badge))
174
+ : undefined
172
175
  const icon = data.icon ? String(data.icon) : undefined
173
176
 
174
177
  // Extract full content as plain text for search indexing
@@ -0,0 +1,55 @@
1
+ import type { RouteMeta } from '../routes/types'
2
+
3
+ export interface SearchDocument {
4
+ id: string
5
+ title: string
6
+ content: string
7
+ url: string
8
+ display: string
9
+ locale?: string
10
+ version?: string
11
+ }
12
+
13
+ /**
14
+ * Generates a flat list of searchable documents from the route metadata.
15
+ * Each page is indexed as a primary document, and its sections (headings)
16
+ * are indexed as secondary documents to provide granular search results.
17
+ */
18
+ export function generateSearchData(routes: RouteMeta[]): SearchDocument[] {
19
+ const documents: SearchDocument[] = []
20
+
21
+ for (const route of routes) {
22
+ // 1. Index the main page
23
+ documents.push({
24
+ id: route.path,
25
+ title: route.title,
26
+ content: route._content || '',
27
+ url: route.path,
28
+ display: route.groupTitle
29
+ ? `${route.groupTitle} > ${route.title}`
30
+ : route.title,
31
+ locale: route.locale,
32
+ version: route.version,
33
+ })
34
+
35
+ // 2. Index headings as sub-documents for deep linking
36
+ if (route.headings) {
37
+ for (const heading of route.headings) {
38
+ // We find the content belonging to this heading?
39
+ // For now, indexing just the heading text and a bit of context is standard.
40
+ // Deep full-text mapping to specific headings is more complex.
41
+ documents.push({
42
+ id: `${route.path}#${heading.id}`,
43
+ title: heading.text,
44
+ content: `${heading.text} in ${route.title}`,
45
+ url: `${route.path}#${heading.id}`,
46
+ display: `${route.title} > ${heading.text}`,
47
+ locale: route.locale,
48
+ version: route.version,
49
+ })
50
+ }
51
+ }
52
+ }
53
+
54
+ return documents
55
+ }
@@ -28,6 +28,53 @@ export async function generateStaticPages(options: SSGOptions): Promise<void> {
28
28
  const { docsDir, docsDirName, outDir, config } = options
29
29
  const routes = await generateRoutes(docsDir, config)
30
30
 
31
+ // Detect external routes to include in SSG
32
+ const externalModulePath = ['tsx', 'ts', 'jsx', 'js']
33
+ .map((ext) => path.resolve(docsDir, `pages-external/index.${ext}`))
34
+ .find((p) => fs.existsSync(p))
35
+
36
+ if (externalModulePath) {
37
+ try {
38
+ // We use a simple way to get the keys of the 'pages' export
39
+ // Since we can't easily execute TSX in this context without a bundler,
40
+ // we'll at least try to generate placeholder pages for them
41
+ // OR we can try to use 'esbuild' to get the exports
42
+ const content = fs.readFileSync(externalModulePath, 'utf-8')
43
+ const pagesMatch = content.match(/pages\s*:\s*{([^}]+)}/s)
44
+ if (pagesMatch) {
45
+ const paths = pagesMatch[1]
46
+ .split(',')
47
+ .map((line) => line.split(':')[0].trim().replace(/['"]/g, ''))
48
+ .filter((p) => p && p.startsWith('/'))
49
+
50
+ for (const p of paths) {
51
+ if (!routes.some((r) => r.path === p)) {
52
+ routes.push({
53
+ path: p,
54
+ title: p.slice(1).charAt(0).toUpperCase() + p.slice(2),
55
+ filePath: '',
56
+ componentPath: '',
57
+ _content: '',
58
+ } as any)
59
+ }
60
+ }
61
+ }
62
+
63
+ // Always include home page if it might be custom
64
+ if (content.includes('homePage') && !routes.some((r) => r.path === '/')) {
65
+ routes.push({
66
+ path: '/',
67
+ title: 'Home',
68
+ filePath: '',
69
+ componentPath: '',
70
+ _content: '',
71
+ } as any)
72
+ }
73
+ } catch (e) {
74
+ console.warn('[boltdocs] Failed to parse external routes for SSG:', e)
75
+ }
76
+ }
77
+
31
78
  // Resolve the SSR module (compiled by tsup)
32
79
  const ssrModulePath = path.resolve(_dirname, '../client/ssr.js')
33
80
  if (!fs.existsSync(ssrModulePath)) {
@@ -43,20 +90,36 @@ export async function generateStaticPages(options: SSGOptions): Promise<void> {
43
90
  const Module = _require('module')
44
91
  const originalRequire = Module.prototype.require
45
92
  ;(Module.prototype as any).require = function (id: string, ...args: any[]) {
46
- if (id === 'virtual:boltdocs-layout') {
47
- return {
48
- __esModule: true,
49
- default: function SSG_Virtual_Layout(props: any) {
50
- try {
51
- const client = originalRequire.apply(this, [path.resolve(_dirname, '../client/index.js')])
52
- const Comp = client.DefaultLayout || (({ children }: any) => children)
53
- const React = originalRequire.apply(this, ['react'])
54
- return React.createElement(Comp, props)
55
- } catch (e) {
56
- return props.children
57
- }
93
+ if (id.startsWith('virtual:boltdocs-')) {
94
+ if (id === 'virtual:boltdocs-layout') {
95
+ return {
96
+ __esModule: true,
97
+ default: function SSG_Virtual_Layout(props: any) {
98
+ try {
99
+ const client = originalRequire.apply(this, [
100
+ path.resolve(_dirname, '../client/index.js'),
101
+ ])
102
+ const Comp =
103
+ client.DefaultLayout || (({ children }: any) => children)
104
+ const React = originalRequire.apply(this, ['react'])
105
+ return React.createElement(Comp, props)
106
+ } catch (e) {
107
+ return props.children
108
+ }
109
+ },
58
110
  }
59
111
  }
112
+
113
+ if (id === 'virtual:boltdocs-mdx-components') {
114
+ return { __esModule: true, default: {} }
115
+ }
116
+
117
+ if (id === 'virtual:boltdocs-config') {
118
+ return { __esModule: true, default: config }
119
+ }
120
+
121
+ // Safe fallback for other virtual modules
122
+ return { __esModule: true, default: id.includes('routes') ? [] : {} }
60
123
  }
61
124
  return originalRequire.apply(this, [id, ...args])
62
125
  }
@@ -77,8 +140,10 @@ export async function generateStaticPages(options: SSGOptions): Promise<void> {
77
140
  // Generate an HTML file for each route concurrently
78
141
  await Promise.all(
79
142
  routes.map(async (route) => {
80
- const siteTitle = getTranslated(config?.theme?.title, route.locale) || 'Boltdocs'
81
- const siteDescription = getTranslated(config?.theme?.description, route.locale) || ''
143
+ const siteTitle =
144
+ getTranslated(config?.theme?.title, route.locale) || 'Boltdocs'
145
+ const siteDescription =
146
+ getTranslated(config?.theme?.description, route.locale) || ''
82
147
  const pageTitle = `${route.title} | ${siteTitle}`
83
148
  const pageDescription = route.description || siteDescription
84
149
 
@@ -111,7 +176,10 @@ export async function generateStaticPages(options: SSGOptions): Promise<void> {
111
176
  'utf-8',
112
177
  )
113
178
  } catch (e: any) {
114
- console.error(`[boltdocs] Error SSR rendering route ${route.path}:`, e ? e.stack || e : e)
179
+ console.error(
180
+ `[boltdocs] Error SSR rendering route ${route.path}:`,
181
+ e ? e.stack || e : e,
182
+ )
115
183
  }
116
184
  }),
117
185
  )
@@ -19,20 +19,23 @@ export function generateRobotsTxt(config: BoltdocsConfig): string {
19
19
  allow: '/',
20
20
  },
21
21
  ]
22
- const sitemaps = (robots as any).sitemaps || (siteUrl ? [`${siteUrl}/sitemap.xml`] : [])
22
+ const sitemaps =
23
+ (robots as any).sitemaps || (siteUrl ? [`${siteUrl}/sitemap.xml`] : [])
23
24
 
24
25
  let content = ''
25
26
 
26
27
  for (const rule of rules) {
27
28
  content += `User-agent: ${rule.userAgent}\n`
28
-
29
+
29
30
  if (rule.disallow) {
30
- const disallows = Array.isArray(rule.disallow) ? rule.disallow : [rule.disallow]
31
+ const disallows = Array.isArray(rule.disallow)
32
+ ? rule.disallow
33
+ : [rule.disallow]
31
34
  for (const d of disallows) {
32
35
  content += `Disallow: ${d}\n`
33
36
  }
34
37
  }
35
-
38
+
36
39
  if (rule.allow) {
37
40
  const allows = Array.isArray(rule.allow) ? rule.allow : [rule.allow]
38
41
  for (const a of allows) {
@@ -1,74 +0,0 @@
1
- import{a as v,c as u,d as S,e as W,f as q,g as xt,h as bt,i as F,j as it,k as vt,l as E,m as nt,n as G,o as rt,p as _,q as Pt,r as wt,u as Ct}from"./chunk-Q3MLYTIQ.mjs";function st(){M.invalidateAll()}function at(o){M.invalidate(o)}var M,$t=v(()=>{"use strict";u();Ct();M=new Pt({name:"routes"})});import A from"path";import se from"github-slugger";function kt(o,r,i,d){let e=decodeURIComponent(o),l=A.resolve(e),c=A.resolve(r),m=S(A.relative(c,l));if(m.startsWith("../")||m===".."||l.includes("\0"))throw new Error(`Security breach: File is outside of docs directory or contains null bytes: ${o}`);let{data:t,content:s}=bt(o),a=m.split("/"),p,h;if(d?.versions&&a.length>0){let R=a[0],et=d.versions.prefix||"",V=d.versions.versions.find(O=>{let ot=et+O.path;return R===ot||R===O.path});V&&(h=V.path,a=a.slice(1))}if(d?.i18n&&a.length>0){let R=a[0];d.i18n.locales[R]&&(p=R,a=a.slice(1))}let y;if(a.length>0){let R=a[0].match(/^\((.+)\)$/);R&&(y=R[1].toLowerCase(),a=a.slice(1))}let k=a.join("/"),n;t.permalink?n=t.permalink.startsWith("/")?t.permalink:`/${t.permalink}`:n=vt(k||"index.md");let g=i;h&&(g+="/"+h),p&&(g+="/"+p),g+=n==="/"?"":n,(!g||g==="")&&(g="/");let b=a[a.length-1],f=W(b),B=W(A.basename(o,A.extname(o))),x=t.sidebarPosition??q(b),$=a.length>=2?a[0]:void 0,P=$?W($):void 0,L=a.length>=2&&/^index\.mdx?$/.test(f),ee=new se,ht=[],oe=/^(#{2,4})\s+(.+)$/gm;for(let R of s.matchAll(oe)){let et=R[1].length,V=R[2].replace(/\[([^\]]+)\]\([^\)]+\)/g,"$1").replace(/[_*`]/g,"").trim(),O=E(V).trim(),ot=ee.slug(O);ht.push({level:et,text:O,id:ot})}let ie=t.title?E(String(t.title)):B,tt=t.description?E(String(t.description)):"";!tt&&s&&(tt=nt(s.replace(/^#+.*$/gm,"").replace(/\[([^\]]+)\]\([^\)]+\)/g,"$1").replace(/[_*`]/g,"").replace(/\s+/g," ")).trim().slice(0,160));let ne=t.badge?E(String(t.badge)):void 0,yt=t.icon?String(t.icon):void 0,re=ae(s);return{route:{path:g,componentPath:o,filePath:m,title:ie,description:tt,sidebarPosition:x,headings:ht,locale:p,version:h,badge:ne,icon:yt,tab:y,_content:re,_rawContent:s},relativeDir:P,isGroupIndex:L,inferredTab:y,groupMeta:L?{title:t.groupTitle||t.title||(P?G(P):""),position:t.groupPosition??t.sidebarPosition??($?q($):void 0),icon:yt}:void 0,inferredGroupPosition:$?q($):void 0}}function ae(o){let r=o.replace(/^#+.*$/gm,"").replace(/\[([^\]]+)\]\([^\)]+\)/g,"$1").replace(/\{[^\}]+\}/g,"").replace(/[_*`]/g,"").replace(/\s+/g," ");return nt(r).trim()}var Bt=v(()=>{"use strict";u();_()});function St(o){return o.sort((r,i)=>!r.group&&!i.group?Rt(r,i):r.group?i.group?r.group!==i.group?le(r,i):Rt(r,i):1:-1)}function Rt(o,r){return o.sidebarPosition!==void 0&&r.sidebarPosition!==void 0?o.sidebarPosition-r.sidebarPosition:o.sidebarPosition!==void 0?-1:r.sidebarPosition!==void 0?1:o.title.localeCompare(r.title)}function le(o,r){return o.groupPosition!==void 0&&r.groupPosition!==void 0?o.groupPosition-r.groupPosition:o.groupPosition!==void 0?-1:r.groupPosition!==void 0?1:(o.groupTitle||o.group).localeCompare(r.groupTitle||r.group)}var Mt=v(()=>{"use strict";u()});import ce from"fast-glob";async function U(o,r,i="/docs",d=!0){let e=performance.now();M.load(),N.clear(),(process.env.BOLTDOCS_FORCE_REPARSE==="true"||r?.i18n)&&M.invalidateAll();let l;!d&&lt?l=lt:(l=await ce(["**/*.md","**/*.mdx"],{cwd:o,absolute:!0,suppressErrors:!0,followSymbolicLinks:!1}),lt=l),M.pruneStale(new Set(l));let c=50,m=[],t=0;for(let n=0;n<l.length;n+=c){let g=l.slice(n,n+c),b=await Promise.all(g.map(async f=>{let B=M.get(f);if(B)return t++,B;let x=kt(f,o,i,r);return M.set(f,x),x}));m.push(...b),n+c<l.length&&await new Promise(f=>setImmediate(f))}M.save();let s=new Map,a=[];for(let n of m)if(n.isGroupIndex&&n.relativeDir&&a.push(n),n.relativeDir){let g=s.get(n.relativeDir);g?(g.position===void 0&&n.inferredGroupPosition!==void 0&&(g.position=n.inferredGroupPosition),!g.icon&&n.route.icon&&(g.icon=n.route.icon)):(g={title:G(n.relativeDir),position:n.inferredGroupPosition,icon:n.route.icon},s.set(n.relativeDir,g))}for(let n of a){let g=s.get(n.relativeDir);n.groupMeta&&(g.title=n.groupMeta.title,n.groupMeta.position!==void 0&&(g.position=n.groupMeta.position),n.groupMeta.icon&&(g.icon=n.groupMeta.icon))}let p=new Array(m.length);for(let n=0;n<m.length;n++){let g=m[n],b=g.relativeDir,f=b?s.get(b):void 0;p[n]={...g.route,group:b,groupTitle:f?.title||(b?G(b):void 0),groupPosition:f?.position,groupIcon:f?.icon}}let h=p;if(r?.i18n){let n=de(p,r,i);h=[...p,...n]}let y=St(h),k=performance.now()-e;return console.log(`[boltdocs] Route generation: ${k.toFixed(2)}ms (${l.length} files, ${t} cache hits)`),y}function de(o,r,i){let d=r.i18n.defaultLocale,e=Object.keys(r.i18n.locales),l=[],c=new Map,m=[];for(let t of o){let s=t.locale||d;c.has(s)||c.set(s,new Set),c.get(s).add(t.path),s===d&&m.push(t)}for(let t of e){let s=c.get(t)||new Set;for(let a of m){let p=me(a.path,d,t,i,r);p!==a.path&&(s.has(p)||l.push({...a,path:p,locale:t}))}}return l}function me(o,r,i,d,e){let l=`${o}:${i}`,c=N.get(l);if(c)return c;let m=d;if(e?.versions){let p=e.versions.prefix||"";for(let h of e.versions.versions){let y=p+h.path;if(o.startsWith(`${d}/${y}`)){m+="/"+y;break}if(o.startsWith(`${d}/${h.path}`)){m+="/"+h.path;break}}}let t=o.substring(m.length),s=`/${r}`;if(t.startsWith(s+"/"))t="/"+i+"/"+t.substring(s.length+1);else if(t===s)t="/"+i;else if(t==="/"||t==="")t="/"+i;else{let p=t.startsWith("/")?"":"/";t="/"+i+p+t}let a=m+t;return N.size>2e3&&N.clear(),N.set(l,a),a}var lt,N,ct=v(()=>{"use strict";u();_();$t();Bt();Mt();lt=null,N=new Map});import dt from"path";import pe from"fs";import{loadConfigFromFile as ge}from"vite";function ue(o){return o}async function j(o,r=process.cwd()){let i=r,d={docsDir:dt.resolve(o),theme:{title:"Boltdocs",description:"A Vite documentation framework",navbar:[{label:"Home",href:"/"},{label:"Documentation",href:"/docs"}],codeTheme:{light:"github-light",dark:"github-dark"},poweredBy:!0,breadcrumbs:!0}},e={};for(let t of J){let s=dt.resolve(i,t);if(pe.existsSync(s))try{let a=await ge({command:"serve",mode:"development"},s,i);if(a){e=a.config;break}}catch(a){console.warn(`[boltdocs] Failed to load config from ${t}:`,a)}}let c={...{title:e.title,description:e.description,logo:e.logo,favicon:e.favicon,ogImage:e.ogImage,navbar:e.navbar,sidebar:e.sidebar,socialLinks:e.socialLinks,footer:e.footer,githubRepo:e.githubRepo,tabs:e.tabs,codeTheme:e.codeTheme,copyMarkdown:e.copyMarkdown,breadcrumbs:e.breadcrumbs,poweredBy:e.poweredBy,communityHelp:e.communityHelp,version:e.version,editLink:e.editLink},...e.theme||{}},m=Object.fromEntries(Object.entries(c).filter(([t,s])=>s!==void 0));return m.navbar&&(m.navbar=m.navbar.map(t=>({label:t.label||t.text||"",href:t.href||t.link||t.to||"",items:t.items?.map(s=>({label:s.label||s.text||"",href:s.href||s.link||s.to||""}))}))),{docsDir:dt.resolve(o),homePage:e.homePage,theme:{...d.theme,...m},i18n:e.i18n,versions:e.versions,siteUrl:e.siteUrl,plugins:e.plugins||[],external:e.external,integrations:e.integrations,robots:e.robots,vite:e.vite}}var J,X=v(()=>{"use strict";u();J=["boltdocs.config.js","boltdocs.config.mjs","boltdocs.config.ts"]});function Dt(o,r){let i=F(r.title),d=F(r.description);return o.replace(/<title>.*?<\/title>/,`<title>${i}</title>`).replace(/(<meta name="description" content=")[^"]*(")/,`$1${d}$2`).replace(/(<meta property="og:title" content=")[^"]*(")/,`$1${i}$2`).replace(/(<meta property="og:description" content=")[^"]*(")/,`$1${d}$2`).replace(/(<meta name="twitter:title" content=")[^"]*(")/,`$1${i}$2`).replace(/(<meta name="twitter:description" content=")[^"]*(")/,`$1${d}$2`)}var Tt=v(()=>{"use strict";u();_()});function _t(o,r){let i=r?.siteUrl?.replace(/\/$/,"")||"https://example.com",d=new Date().toISOString().split("T")[0],e=[{url:"/",priority:"1.0",changefreq:"daily"}];if(r?.i18n){let c=r.i18n.defaultLocale;for(let m of Object.keys(r.i18n.locales))m!==c&&e.push({url:`/${m}/`,priority:"1.0",changefreq:"daily"})}return`<?xml version="1.0" encoding="UTF-8"?>
2
- <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
3
- ${[...e,...o.map(c=>({url:c,priority:"0.8",changefreq:"weekly"}))].map(c=>` <url>
4
- <loc>${it(i)}${it(c.url)}</loc>
5
- <lastmod>${d}</lastmod>
6
- <changefreq>${c.changefreq}</changefreq>
7
- <priority>${c.priority}</priority>
8
- </url>`).join(`
9
- `)}
10
- </urlset>`}var jt=v(()=>{"use strict";u();_()});function K(o){if(typeof o.robots=="string")return o.robots;let r=o.siteUrl?.replace(/\/$/,"")||"",i=o.robots||{},d=i.rules||[{userAgent:"*",allow:"/"}],e=i.sitemaps||(r?[`${r}/sitemap.xml`]:[]),l="";for(let c of d){if(l+=`User-agent: ${c.userAgent}
11
- `,c.disallow){let m=Array.isArray(c.disallow)?c.disallow:[c.disallow];for(let t of m)l+=`Disallow: ${t}
12
- `}if(c.allow){let m=Array.isArray(c.allow)?c.allow:[c.allow];for(let t of m)l+=`Allow: ${t}
13
- `}l+=`
14
- `}for(let c of e)l+=`Sitemap: ${c}
15
- `;return l.trim()}var mt=v(()=>{"use strict";u()});import I from"fs";import T from"path";import{fileURLToPath as fe}from"url";import{createRequire as he}from"module";async function pt(o){let{docsDir:r,docsDirName:i,outDir:d,config:e}=o,l=await U(r,e),c=T.resolve(It,"../client/ssr.js");if(!I.existsSync(c)){console.error("[boltdocs] SSR module not found at",c,"- Did you build the core package?");return}let m=Ft("module"),t=m.prototype.require;m.prototype.require=function(n,...g){return n==="virtual:boltdocs-layout"?{__esModule:!0,default:function(f){try{let x=t.apply(this,[T.resolve(It,"../client/index.js")]).DefaultLayout||(({children:P})=>P);return t.apply(this,["react"]).createElement(x,f)}catch{return f.children}}}:t.apply(this,[n,...g])};let{render:s}=Ft(c);m.prototype.require=t;let a=T.join(d,"index.html");if(!I.existsSync(a)){console.warn("[boltdocs] No index.html found in outDir, skipping SSG.");return}let p=I.readFileSync(a,"utf-8");await Promise.all(l.map(async n=>{let g=rt(e?.theme?.title,n.locale)||"Boltdocs",b=rt(e?.theme?.description,n.locale)||"",f=`${n.title} | ${g}`,B=n.description||b,x={};x[`/${i}/${n.filePath}`]={default:()=>null};try{let $=await s({path:n.path,routes:l,config:e||{},docsDirName:i,modules:x,homePage:void 0}),P=Dt(p,{title:F(f),description:F(B)}).replace("<!--app-html-->",$).replace('<div id="root"></div>',`<div id="root">${$}</div>`),L=T.join(d,n.path);await I.promises.mkdir(L,{recursive:!0}),await I.promises.writeFile(T.join(L,"index.html"),P,"utf-8")}catch($){console.error(`[boltdocs] Error SSR rendering route ${n.path}:`,$&&($.stack||$))}}));let h=_t(l.map(n=>n.path),e);I.writeFileSync(T.join(d,"sitemap.xml"),h,"utf-8");let y=K(e);I.writeFileSync(T.join(d,"robots.txt"),y,"utf-8"),console.log(`[boltdocs] Generated ${l.length} static pages + sitemap.xml + robots.txt`);let{flushCache:k}=await import("./cache-CRAZ55X7.mjs");await k()}var ye,It,Ft,gt=v(()=>{"use strict";u();ct();_();Tt();jt();mt();ye=fe(import.meta.url),It=T.dirname(ye),Ft=he(import.meta.url)});import Ht from"path";import xe from"fs";function Lt(o,r){let i=o.homePage?`import HomePage from '${S(o.homePage)}';`:"",d=Ht.resolve(process.cwd(),"index.css"),e=xe.existsSync(d)?"import './index.css';":"",l=o.homePage?"homePage: HomePage,":"",c=r?.plugins?.flatMap(y=>Object.entries(y.components||{}))||[],m=c.map(([y,k])=>`import * as _comp_${y} from '${S(k)}';
16
- const ${y} = _comp_${y}.default || _comp_${y}['${y}'] || _comp_${y};`).join(`
17
- `),t=c.map(([y])=>y).join(", "),s=Ht.basename(o.docsDir||"docs"),a=Object.entries(r?.external||{}),p=a.map(([y,k],n)=>`import _ext_${n} from '${S(k)}';`).join(`
18
- `),h=a.length>0?`externalPages: { ${a.map(([y],k)=>`"${y}": _ext_${k}`).join(", ")} },`:"";return`
19
- import { createBoltdocsApp as _createApp } from 'boltdocs/client';
20
- import _routes from 'virtual:boltdocs-routes';
21
- import _config from 'virtual:boltdocs-config';
22
- import _user_mdx_components from 'virtual:boltdocs-mdx-components';
23
- ${e}
24
- ${i}
25
- ${m}
26
- ${p}
27
-
28
- _createApp({
29
- target: '#root',
30
- routes: _routes,
31
- docsDirName: '${s}',
32
- config: _config,
33
- modules: import.meta.glob('/${s}/**/*.{md,mdx}'),
34
- hot: import.meta.hot,
35
- ${l}
36
- ${h}
37
- components: { ${t}${t?", ":""} ...(_user_mdx_components || {}) },
38
- });
39
- `}var Ot=v(()=>{"use strict";u();_()});function Et(o){return`<!doctype html>
40
- <html lang="en">
41
- <head>
42
- <meta charset="UTF-8" />
43
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
44
- <title>${o.theme?.title||"Boltdocs"}</title>
45
- </head>
46
- <body>
47
- <div id="root"></div>
48
- </body>
49
- </html>`}function ut(o,r){let i=r.theme,d=i?.title||"Boltdocs",e=i?.description||"",l=i?.favicon;!l&&i?.logo&&(typeof i.logo=="string"?l=i.logo:l=i.logo.light||i.logo.dark);let c=[l?`<link rel="icon" href="${l}">`:"",`<meta name="description" content="${e}">`,`<meta property="og:title" content="${d}">`,`<meta property="og:description" content="${e}">`,i?.ogImage?`<meta property="og:image" content="${i.ogImage}">`:"",'<meta property="og:type" content="website">','<meta name="twitter:card" content="summary_large_image">',`<meta name="twitter:title" content="${d}">`,`<meta name="twitter:description" content="${e}">`,i?.ogImage?`<meta name="twitter:image" content="${i.ogImage}">`:"",'<meta name="generator" content="Boltdocs">'].filter(Boolean).join(`
50
- `),m=`
51
- <script>
52
- (function() {
53
- try {
54
- var stored = localStorage.getItem("boltdocs-theme");
55
- var theme = stored || (window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light");
56
- if (theme === "light") {
57
- document.documentElement.classList.add("theme-light");
58
- document.documentElement.dataset.theme = "light";
59
- } else {
60
- document.documentElement.classList.remove("theme-light");
61
- document.documentElement.dataset.theme = "dark";
62
- }
63
- } catch (e) {}
64
- })();
65
- </script>
66
- `;return o.includes("<title>")?o=o.replace(/<title>.*?<\/title>/,`<title>${d}</title>`):o=o.replace("</head>",` <title>${d}</title>
67
- </head>`),o=o.replace("</head>",` ${c}
68
- ${m} </head>`),!o.includes("src/main")&&!o.includes("virtual:boltdocs-entry")&&(o=o.replace("</body>",` <script type="module">import "virtual:boltdocs-entry";</script>
69
- </body>`)),o}var Gt=v(()=>{"use strict";u()});var At=v(()=>{"use strict";u()});import{loadEnv as be}from"vite";import{ViteImageOptimizer as ve}from"vite-plugin-image-optimizer";import D from"path";import Nt from"fs";function Ut(o={},r){let i=D.resolve(process.cwd(),o.docsDir||"docs"),d=S(i),e=r,l,c=!1,m=e?.plugins?.flatMap(t=>t.vitePlugins||[])||[];return[{name:"vite-plugin-boltdocs",enforce:"pre",async config(t,s){c=s.command==="build";let a=t.envDir||process.cwd(),p=be(s.mode,a,"");return Object.assign(process.env,p),e||(e=await j(i)),{optimizeDeps:{include:["react","react-dom"],exclude:["boltdocs","boltdocs/client","boltdocs/hooks","boltdocs/primitives","boltdocs/base-ui","boltdocs/mdx","boltdocs/integrations","boltdocs/client/hooks","boltdocs/client/primitives"]}}},configResolved(t){l=t},configureServer(t){t.middlewares.use((n,g,b)=>{if(n.url==="/robots.txt"){let f=K(e);g.statusCode=200,g.setHeader("Content-Type","text/plain"),g.end(f);return}b()}),t.middlewares.use(async(n,g,b)=>{let f=n.url?.split("?")[0]||"/",B=n.headers.accept||"",x=f==="/"||f.startsWith("/docs")||e.i18n&&Object.keys(e.i18n.locales).some(P=>f.startsWith(`/${P}/docs`)||f===`/${P}`)||e.external&&Object.keys(e.external).some(P=>f.startsWith(P)),$=/\.(js|css|png|jpe?g|gif|svg|ico|webp|woff2?|ttf|otf|mp4|webm|ogg|mp3|wav|flac|aac|pdf|zip|gz|map|json)$/i.test(f);if(B.includes("text/html")&&!$&&x){let P=Et(e);P=ut(P,e),P=await t.transformIndexHtml(n.url||"/",P),g.statusCode=200,g.setHeader("Content-Type","text/html"),g.end(P);return}b()});let s=J.map(n=>D.resolve(process.cwd(),n)),a=["tsx","jsx"],p=a.map(n=>D.resolve(i,`layout.${n}`)),h=["tsx","ts","jsx","js"],y=h.map(n=>D.resolve(i,`mdx-components.${n}`));t.watcher.add([...s,...y,...p]);let k=async(n,g)=>{try{let b=S(n);if(J.some(x=>b.endsWith(x))){t.restart();return}if(h.some(x=>b.endsWith(`mdx-components.${x}`))){let x=t.moduleGraph.getModuleById("\0virtual:boltdocs-mdx-components");x&&t.moduleGraph.invalidateModule(x),t.ws.send({type:"full-reload"});return}if(a.some(x=>b.endsWith(`layout.${x}`))){let x=t.moduleGraph.getModuleById("\0virtual:boltdocs-layout");x&&t.moduleGraph.invalidateModule(x),t.ws.send({type:"full-reload"});return}if(!b.startsWith(d)||!xt(b))return;if(g==="add"||g==="unlink"){st(),e=await j(i);let x=t.moduleGraph.getModuleById("\0virtual:boltdocs-config");x&&t.moduleGraph.invalidateModule(x),t.ws.send({type:"custom",event:"boltdocs:config-update",data:{theme:e?.theme,integrations:e?.integrations,i18n:e?.i18n,versions:e?.versions,siteUrl:e?.siteUrl}})}else at(n);let f=await U(i,e,"/docs",g!=="change"),B=t.moduleGraph.getModuleById("\0virtual:boltdocs-routes");B&&t.moduleGraph.invalidateModule(B),t.ws.send({type:"custom",event:"boltdocs:routes-update",data:f})}catch(b){console.error(`[boltdocs] HMR error during ${g} event:`,b)}};t.watcher.on("add",n=>k(n,"add")),t.watcher.on("unlink",n=>k(n,"unlink")),t.watcher.on("change",n=>k(n,"change"))},resolveId(t){if(t==="virtual:boltdocs-routes"||t==="virtual:boltdocs-config"||t==="virtual:boltdocs-entry"||t==="virtual:boltdocs-mdx-components"||t==="virtual:boltdocs-layout")return"\0"+t},async load(t){if(t==="\0virtual:boltdocs-routes"){let s=await U(i,e);return`export default ${JSON.stringify(s,null,2)};`}if(t==="\0virtual:boltdocs-config"){let s={theme:e?.theme,integrations:e?.integrations,i18n:e?.i18n,versions:e?.versions,siteUrl:e?.siteUrl};return`export default ${JSON.stringify(s,null,2)};`}if(t==="\0virtual:boltdocs-entry")return Lt(o,e);if(t==="\0virtual:boltdocs-mdx-components"){let s=["tsx","ts","jsx","js"],a=null;for(let p of s){let h=D.resolve(i,`mdx-components.${p}`);if(Nt.existsSync(h)){a=h;break}}if(a){let p=S(a);return`import * as components from '${p}';
70
- const mdxComponents = components.default || components;
71
- export default mdxComponents;
72
- export * from '${p}';`}return"export default {};"}if(t==="\0virtual:boltdocs-layout"){let s=["tsx","jsx"],a=null;for(let p of s){let h=D.resolve(i,`layout.${p}`);if(Nt.existsSync(h)){a=h;break}}return a?`import UserLayout from '${S(a)}';
73
- export default UserLayout;`:`import { DefaultLayout } from 'boltdocs/client';
74
- export default DefaultLayout;`}},transformIndexHtml:{order:"pre",handler(t){return ut(t,e)}},async closeBundle(){if(!c)return;let t=l?.build?.outDir?D.resolve(l.root,l.build.outDir):D.resolve(process.cwd(),"dist"),s=D.basename(i||"docs");await pt({docsDir:i,docsDirName:s,outDir:t,config:e});let{flushCache:a}=await import("./cache-CRAZ55X7.mjs");await a()}},ve({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:"preset-default"}]}}),...m.filter(t=>!!t)]}var zt=v(()=>{"use strict";u();ct();X();gt();_();Ot();Gt();mt();At()});var Vt,H,Wt=v(()=>{"use strict";u();Ct();Vt="v3",H=new wt("mdx")});import{createHighlighter as Pe}from"shiki";async function Q(o){if(Z)return Z;let r=typeof o=="object"?[o.light,o.dark]:[o??"github-dark"];return["github-light","github-dark"].forEach(i=>{r.includes(i)||r.push(i)}),Z=await Pe({themes:r,langs:["tsx","jsx","ts","js","json","md","mdx","css","html","bash","sh","yaml","yml"]}),Z}var Z,ft=v(()=>{"use strict";u();Z=null});import{visit as we}from"unist-util-visit";function qt(o){return async r=>{let i=o?.theme?.codeTheme??{light:"github-light",dark:"github-dark"},d=await Q(i);we(r,["mdxJsxFlowElement","mdxJsxTextElement"],e=>{if(e.name!=="ComponentPreview")return;let l=e.attributes?.find(s=>s.name==="code"),c="";if(l){if(typeof l.value=="string")c=l.value;else if(l.value?.type==="mdxJsxAttributeValueExpression"){let s=l.value.value??"";c=s.match(/^[`'"](.+)[`'"]$/)?.[1]??s}}if(!c)return;let m=typeof i=="object"?{themes:{light:i.light,dark:i.dark},lang:"tsx"}:{theme:i,lang:"tsx"},t=d.codeToHtml(c,m);e.attributes=(e.attributes??[]).filter(s=>s.name!=="highlightedHtml"),e.attributes.push({type:"mdxJsxAttribute",name:"highlightedHtml",value:t})})}}var Jt=v(()=>{"use strict";u();ft()});import{visit as Ce}from"unist-util-visit";function Xt(o){return async r=>{let i=o?.theme?.codeTheme||{light:"github-light",dark:"github-dark"},d=await Q(i);Ce(r,"element",e=>{if(e.tagName==="pre"&&e.children?.[0]?.tagName==="code"){let l=e.children[0],m=(l.properties?.className||[]).find(h=>h.startsWith("language-")),t=m?m.slice(9):"text",s=l.children[0]?.value||"",a={lang:t};typeof i=="object"?a.themes={light:i.light,dark:i.dark}:a.theme=i;let p=d.codeToHtml(s,a);e.properties.dataHighlighted="true",e.properties.highlightedHtml=p,e.children=[]}})}}var Kt=v(()=>{"use strict";u();ft()});import $e from"@mdx-js/rollup";import ke from"remark-gfm";import Be from"remark-frontmatter";import Re from"rehype-slug";import Se from"crypto";function Qt(o,r=$e){let i=o?.plugins?.flatMap(l=>l.remarkPlugins||[])||[],d=o?.plugins?.flatMap(l=>l.rehypePlugins||[])||[],e=r({remarkPlugins:[ke,Be,[qt,o],...i],rehypePlugins:[Re,[Xt,o],...d],jsxRuntime:"automatic",providerImportSource:"@mdx-js/react"});return{...e,name:"vite-plugin-boltdocs-mdx",async buildStart(){Y=0,z=0,Zt||(H.load(),Zt=!0),e.buildStart&&await e.buildStart.call(this)},async transform(l,c,m){if(!c.endsWith(".md")&&!c.endsWith(".mdx"))return e.transform?.call(this,l,c,m);console.log(`[boltdocs] Transforming MDX: ${c}`),z++;let t=Se.createHash("md5").update(l).digest("hex"),s=`${c}:${t}:${Vt}`,a=H.get(s);if(a)return Y++,{code:a,map:null};let p=await e.transform.call(this,l,c,m);return p&&typeof p=="object"&&p.code&&H.set(s,p.code),p},async buildEnd(){z>0&&console.log(`[boltdocs] MDX Cache Performance: ${Y}/${z} hits (${Math.round(Y/z*100)||0}%)`),H.save(),await H.flush(),e.buildEnd&&await e.buildEnd.call(this)}}}var Zt,Y,z,Yt=v(()=>{"use strict";u();Wt();Jt();Kt();Zt=!1,Y=0,z=0});import Me from"@vitejs/plugin-react";import De from"@tailwindcss/vite";async function te(o){let r=o?.docsDir||"docs",i=await j(r),d={...o,homePage:o?.homePage||i.homePage};return[...Ut(d,i),Qt(i)]}async function yi(o,r="development"){let i=await j("docs",o);return{root:o,mode:r,plugins:[Me(),De(),await te({docsDir:i.docsDir,homePage:i.homePage})],...i.vite}}var Te=v(()=>{u();zt();Yt();X();gt();X()});export{ue as a,j as b,pt as c,Et as d,Gt as e,te as f,yi as g,Te as h};
@@ -1 +0,0 @@
1
- import{a as oe,b as ne,c as ae,d as ie,e as se,f as le,g as me,h as ce,i as pe}from"./chunk-RSII2UPE.mjs";import{b as J}from"./chunk-JD3RSDE4.mjs";import{J as Y,L as Q,M as X,U as y,_ as v,a as W,b as O,e as k,ea as $,f as K,ja as w,ka as j,la as z,ma as A,na as ee,qa as te,sa as re,ta as H,wa as f,y as u}from"./chunk-ZRJ55GGF.mjs";import{b as F,f as B,g as Z}from"./chunk-NBCYHLAA.mjs";import{ArrowLeft as Ie}from"lucide-react";import{jsx as S,jsxs as ue}from"react/jsx-runtime";function yt(){return S("div",{className:"flex items-center justify-center min-h-[60vh] text-center",children:ue("div",{className:"space-y-4",children:[S("span",{className:"text-8xl font-black tracking-tighter text-primary-500/20",children:"404"}),S("h1",{className:"text-2xl font-bold text-text-main",children:"Page Not Found"}),S("p",{className:"text-sm text-text-muted max-w-sm mx-auto",children:"The page you're looking for doesn't exist or has been moved."}),ue(O,{href:"/",className:"inline-flex items-center gap-2 rounded-lg bg-primary-500 px-5 py-2.5 text-sm font-semibold text-white outline-none transition-all hover:brightness-110 hover:shadow-lg focus-visible:ring-2 focus-visible:ring-primary-500/30",children:[S(Ie,{size:16})," Go to Home"]})]})})}import{useEffect as Me,useState as Ee}from"react";import{jsx as x,jsxs as D}from"react/jsx-runtime";function wt(){let[e,r]=Ee(0);Me(()=>{let t=0,a=!0,l=setInterval(()=>{a?(t+=1,t>=100&&(t=100,a=!1)):(t-=1,t<=0&&(t=0,a=!0)),r(t)},20);return()=>clearInterval(l)},[]);let o=`inset(${100-e}% 0 0 0)`;return x("div",{className:"flex flex-col items-center justify-center min-h-[60vh] p-4 text-center",children:x("div",{className:"relative group",children:D("div",{className:"relative inline-block",children:[D("svg",{className:"w-24 h-auto opacity-10 filter grayscale brightness-50",viewBox:"0 0 60 51",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true",children:[x("title",{children:"Loading indicator background"}),x("path",{d:"M29.4449 0H19.4449V16.5L29.4449 6.5V0Z",fill:"currentColor"}),x("path",{d:"M26.9449 22.7265C26.9449 22.5077 21.2201 27.0658 16.9449 28.5C13.7491 29.5721 12.3156 29.5038 8.94486 29.5C5.59532 29.4963 0 28.5 0 28.5C0 28.5 5.57953 28.5146 8.94486 27.5C12.5409 26.4158 14.8203 25.5843 17.9449 23.5C23.3445 19.898 29.4449 11.5 29.4449 11.5L29.9449 18C29.9449 18 33.5825 15.8308 36.4449 15C39.4452 14.1291 44.4449 14 44.4449 14C44.4449 14 36.9449 19 34.4449 21.5C31.5322 24.4126 29.8582 26.9017 29.4449 31C29.1217 34.2041 29.4771 36.4508 31.4449 39C33.5792 41.765 35.952 43.0183 39.4449 43C42.677 42.9831 45.3003 42.4182 47.4449 40C49.7406 37.4113 50.2495 34.4466 49.9449 31C49.6603 27.7804 48.4876 25.4953 45.9449 23.5C43.2931 21.4191 36.4449 24 36.4449 24L47.9449 15C47.9449 15 51.5761 16.771 53.4449 18.5C55.711 20.5967 56.7467 22.1546 57.9449 25C59.1784 27.9295 59.4832 29.8216 59.4449 33C59.4089 35.9867 59.179 37.78 57.9449 40.5C56.8475 42.9185 55.8511 44.6507 53.9449 46.5C51.9236 48.4609 50.5803 49.0076 47.9449 50C45.5414 50.9051 44.0131 51 41.4449 51C38.8766 51 37.3235 50.9685 34.9449 50C32.4851 48.9985 29.4449 46 29.4449 46V51H19.4449V37.9904L22.9449 31.4226L26.9449 22.7265Z",fill:"currentColor"})]}),D("svg",{className:"absolute top-0 left-0 w-24 h-auto text-primary-500 drop-shadow-[0_0_20px_rgba(var(--primary-rgb),0.5)] transition-[clip-path] duration-100 ease-linear",style:{clipPath:o},viewBox:"0 0 60 51",fill:"none",xmlns:"http://www.w3.org/2000/svg",role:"img","aria-hidden":"true",children:[x("title",{children:"Loading indicator animated fill"}),x("path",{d:"M29.4449 0H19.4449V16.5L29.4449 6.5V0Z",fill:"currentColor"}),x("path",{d:"M26.9449 22.7265C26.9449 22.5077 21.2201 27.0658 16.9449 28.5C13.7491 29.5721 12.3156 29.5038 8.94486 29.5C5.59532 29.4963 0 28.5 0 28.5C0 28.5 5.57953 28.5146 8.94486 27.5C12.5409 26.4158 14.8203 25.5843 17.9449 23.5C23.3445 19.898 29.4449 11.5 29.4449 11.5L29.9449 18C29.9449 18 33.5825 15.8308 36.4449 15C39.4452 14.1291 44.4449 14 44.4449 14C44.4449 14 36.9449 19 34.4449 21.5C31.5322 24.4126 29.8582 26.9017 29.4449 31C29.1217 34.2041 29.4771 36.4508 31.4449 39C33.5792 41.765 35.952 43.0183 39.4449 43C42.677 42.9831 45.3003 42.4182 47.4449 40C49.7406 37.4113 50.2495 34.4466 49.9449 31C49.6603 27.7804 48.4876 25.4953 45.9449 23.5C43.2931 21.4191 36.4449 24 36.4449 24L47.9449 15C47.9449 15 51.5761 16.771 53.4449 18.5C55.711 20.5967 56.7467 22.1546 57.9449 25C59.1784 27.9295 59.4832 29.8216 59.4449 33C59.4089 35.9867 59.179 37.78 57.9449 40.5C56.8475 42.9185 55.8511 44.6507 53.9449 46.5C51.9236 48.4609 50.5803 49.0076 47.9449 50C45.5414 50.9051 44.0131 51 41.4449 51C38.8766 51 37.3235 50.9685 34.9449 50C32.4851 48.9985 29.4449 46 29.4449 46V51H19.4449V37.9904L22.9449 31.4226L26.9449 22.7265Z",fill:"currentColor"})]})]})})})}import{useEffect as Be,useState as Oe}from"react";import{Sun as de,Moon as ge,Monitor as fe}from"lucide-react";import{Button as He}from"react-aria-components";import{jsx as h,jsxs as R}from"react/jsx-runtime";function he(){let{theme:e,setTheme:r}=J(),[o,t]=Oe(!1);return Be(()=>{t(!0)},[]),o?R(te,{placement:"bottom right",children:[h(He,{className:"flex h-9 w-9 items-center justify-center rounded-md text-text-muted transition-colors hover:bg-bg-surface hover:text-text-main outline-none focus-visible:ring-2 focus-visible:ring-primary-500","aria-label":"Selection theme",children:h(e==="system"?fe:e==="dark"?ge:de,{size:20,className:"animate-in fade-in zoom-in duration-300"})}),R(re,{selectionMode:"single",selectedKeys:[e],onSelectionChange:l=>{let n=Array.from(l)[0];r(n)},children:[R(H,{id:"light",children:[h(de,{size:16}),h("span",{children:"Light"})]}),R(H,{id:"dark",children:[h(ge,{size:16}),h("span",{children:"Dark"})]}),R(H,{id:"system",children:[h(fe,{size:16}),h("span",{children:"System"})]})]})]}):h("div",{className:"h-9 w-9"})}import{useEffect as Ae,useState as De}from"react";var $e="https://api.github.com";async function be(e,r,o=$e){let t=new Headers;r&&t.append("authorization",r);let l=await(await fetch(`${o}/repos/${e}`,{headers:t})).json();return l.stargazers_count!==void 0?ze(l.stargazers_count):"0"}var ze=e=>Intl.NumberFormat("en",{notation:"compact",compactDisplay:"short"}).format(e);import{jsx as ve,jsxs as Ve}from"react/jsx-runtime";function xe({repo:e}){let[r,o]=De(null);return Ae(()=>{e&&be(e).then(t=>o(t)).catch(()=>o("0"))},[e]),Ve("a",{href:`https://github.com/${e}`,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 rounded-md border border-border-subtle bg-bg-surface px-2.5 py-1.5 text-xs font-medium text-text-muted transition-all hover:bg-bg-main hover:border-border-strong hover:text-text-main",children:[ve(K,{className:"h-4 w-4"}),r&&ve("span",{className:"tabular-nums",children:r})]})}import*as _e from"lucide-react";import{jsx as T,jsxs as Ne}from"react/jsx-runtime";function ye({tabs:e,routes:r}){let{currentLocale:o}=B(),{indicatorStyle:t,tabRefs:a,activeIndex:l}=se(e,r),n=s=>{if(!s)return null;if(s.trim().startsWith("<svg"))return T("span",{className:"h-4 w-4",dangerouslySetInnerHTML:{__html:s}});let m=_e[s];return m?T(m,{size:16}):T("img",{src:s,alt:"",className:"h-4 w-4 object-contain"})};return T("div",{className:"mx-auto max-w-(--breakpoint-3xl) px-4 md:px-6",children:Ne($.TabsList,{className:"border-none py-0",children:[e.map((s,m)=>{let g=m===l,c=r.find(p=>p.tab&&p.tab.toLowerCase()===s.id.toLowerCase()),b=c?c.path:"#";return Ne(O,{href:b,ref:p=>{a.current[m]=p},className:`relative flex items-center gap-2 px-4 py-3 text-sm font-medium transition-colors outline-none ${g?"text-primary-500":"text-text-muted hover:text-text-main"}`,children:[n(s.icon),T("span",{children:oe(s.text,o)})]},s.id)}),T($.TabsIndicator,{style:t})]})})}import{Suspense as Ge,lazy as qe}from"react";import{useLocation as Ue}from"react-router-dom";import{ChevronDown as Pe,Languages as Fe}from"lucide-react";import{jsx as i,jsxs as N}from"react/jsx-runtime";var Ze=qe(()=>import("./search-dialog-MA5AISC7.mjs").then(e=>({default:e.SearchDialog})));function lr(){let{links:e,title:r,logo:o,logoProps:t,github:a,social:l,config:n}=ne(),{routes:s,allRoutes:m,currentVersion:g,currentLocale:c}=B(),{pathname:b}=Ue(),p=n.theme||{},q=p?.tabs&&p.tabs.length>0;return N(u.NavbarRoot,{className:q?"border-b-0":"",children:[N(u.Content,{children:[N(u.NavbarLeft,{children:[i(u.NavbarLogo,{src:o??"",alt:t?.alt||r,width:t?.width??24,height:t?.height??24}),i(u.Title,{children:r}),n.versions&&g&&i(Je,{}),i(u.Links,{children:e.map(E=>i(We,{link:E},E.href))})]}),i(u.NavbarCenter,{children:i(Ge,{fallback:i("div",{className:"h-9 w-32 animate-pulse rounded-md bg-bg-surface"}),children:i(Ze,{routes:s||[]})})}),N(u.NavbarRight,{children:[n.i18n&&c&&i(Ke,{}),i(u.Split,{}),i(he,{}),a&&i(xe,{repo:p?.githubRepo??""}),l.length>0&&i(u.Split,{}),i("div",{className:"flex items-center gap-1",children:l.map(({icon:E,link:U})=>i(u.Socials,{icon:E,link:U,className:"p-1.5"},U))})]})]}),b!=="/"&&q&&p?.tabs&&i("div",{className:"w-full border-b border-border-subtle bg-bg-main",children:i(ye,{tabs:p.tabs,routes:m||s||[]})})]})}function We({link:e}){let r=Z(e.href);return i(u.Link,{...e,href:r})}function Je(){let{currentVersionLabel:e,availableVersions:r,handleVersionChange:o}=ae();return r.length===0?null:N(f.Trigger,{children:[i(k,{variant:"outline",size:"sm",rounded:"lg",iconPosition:"right",icon:i(Pe,{className:"w-3.5 h-3.5 text-text-muted/60"}),className:"h-8 border-border-subtle/60 bg-bg-surface/30 backdrop-blur-sm transition-all duration-200 hover:border-primary-500/50 hover:bg-primary-500/5",children:i("span",{className:"font-semibold text-[0.8125rem]",children:e})}),i(f.Root,{children:i(f.Section,{items:r,children:t=>i(f.Item,{onPress:()=>o(t.value),children:t.label},`${t.value??""}`)})})]})}function Ke(){let{currentLocale:e,availableLocales:r,handleLocaleChange:o}=ie();return r.length===0?null:N(f.Trigger,{children:[i(k,{variant:"outline",size:"sm",rounded:"lg",iconPosition:"right",icon:i(Pe,{className:"w-3.5 h-3.5 text-text-muted/60"}),className:"h-8 border-border-subtle/60 bg-bg-surface/30 backdrop-blur-sm transition-all duration-200 hover:border-primary-500/50 hover:bg-primary-500/5 px-2.5",children:N("div",{className:"flex items-center gap-1.5",children:[i(Fe,{className:"w-3.5 h-3.5 text-primary-500"}),i("span",{className:"font-bold text-[0.75rem] tracking-wider uppercase opacity-90",children:e||"en"})]})}),i(f.Root,{children:i(f.Section,{items:r,children:t=>i(f.Item,{onPress:()=>o(t.value),children:N("div",{className:"flex items-center justify-between w-full gap-4",children:[i("span",{children:t.label}),i("span",{className:"text-[10px] font-bold opacity-40 uppercase tracking-tighter",children:t.value})]})},`${t.value??""}`)})})]})}import{Zap as Ye}from"lucide-react";import{jsx as V,jsxs as Ce}from"react/jsx-runtime";function Le(){return V("div",{className:"flex items-center justify-center mt-10 mb-4 px-4 w-full",children:Ce("a",{href:"https://github.com/jesusalcaladev/boltdocs",target:"_blank",rel:"noopener noreferrer",className:"group relative flex items-center gap-2 px-4 py-2 rounded-full border border-border-subtle bg-bg-surface/50 backdrop-blur-md transition-all duration-300 hover:border-primary-500/50 hover:bg-bg-surface hover:shadow-xl hover:shadow-primary-500/5 select-none",children:[V(Ye,{className:"w-3.5 h-3.5 text-text-muted group-hover:text-primary-500 transition-colors duration-300",fill:"currentColor"}),Ce("span",{className:"text-[11px] font-medium text-text-muted group-hover:text-text-main transition-colors duration-300 tracking-wide",children:["Powered by ",V("strong",{className:"font-bold text-text-main/80 group-hover:text-text-main",children:"Boltdocs"})]})]})})}import{useState as Qe,useEffect as Xe,useMemo as je}from"react";import*as et from"lucide-react";import{jsx as P,jsxs as rt}from"react/jsx-runtime";function we(e){return e&&et[e]||void 0}function tt({group:e,activePath:r,getIcon:o}){let t=je(()=>e.routes.some(n=>n.path===r),[e.routes,r]),[a,l]=Qe(!0);return Xe(()=>{t&&l(!0)},[t]),P(w.SidebarGroup,{title:e.title,isOpen:a,onToggle:()=>l(!a),children:e.routes.map(n=>{let s=r===(n.path.endsWith("/")?n.path.slice(0,-1):n.path);return P(w.SidebarLink,{label:n.title,href:n.path,active:s,icon:o(n.icon),badge:n.badge},n.path)})})}function vr({routes:e,config:r}){let{groups:o,ungrouped:t,activePath:a}=le(e),l=r.theme||{};return rt(w.SidebarRoot,{children:[t.length>0&&P(w.SidebarGroup,{className:"mb-6",children:t.map(n=>{let s=a===(n.path.endsWith("/")?n.path.slice(0,-1):n.path);return P(w.SidebarLink,{label:n.title,href:n.path,active:s,icon:we(n.icon),badge:n.badge},n.path)})}),o.map(n=>P(tt,{group:n,activePath:a,getIcon:we},n.slug)),l?.poweredBy&&P("div",{className:"mt-auto pt-8",children:P(Le,{})})]})}import ot,{useRef as Te,useEffect as nt,useState as at,useCallback as it}from"react";import{Pencil as st,CircleHelp as lt,TextAlignStart as mt}from"lucide-react";import{jsx as d,jsxs as C}from"react/jsx-runtime";function wr({headings:e=[],editLink:r,communityHelp:o,filePath:t}){let{headings:a}=me(e),l=ot.useMemo(()=>a.map(n=>({title:n.text,url:`#${n.id}`,depth:n.level})),[a]);return a.length===0?null:d(X,{toc:l,children:d(ct,{headings:a,editLink:r,communityHelp:o,filePath:t})})}function ct({headings:e,editLink:r,communityHelp:o,filePath:t}){let a=Y(),[l,n]=at({opacity:0}),s=Te(null),m=Te(null);nt(()=>{if(!a||!s.current)return;let c=s.current.querySelector(`a[href="#${a}"]`);c&&n({transform:`translateY(${c.offsetTop}px)`,height:`${c.offsetHeight}px`,opacity:1})},[a]);let g=it((c,b)=>{c.preventDefault();let p=document.getElementById(b);p&&(p.scrollIntoView({behavior:"smooth"}),window.history.pushState(null,"",`#${b}`))},[]);return C(y.OnThisPageRoot,{children:[C(y.OnThisPageHeader,{className:"flex flex-row gap-x-2",children:[d(mt,{size:16}),"On this page"]}),d(Q,{containerRef:m,children:C(y.OnThisPageContent,{className:"max-h-[450px] boltdocs-otp-scroll-area",ref:m,children:[d(y.OnThisPageIndicator,{style:l}),d("ul",{className:"relative space-y-2 border-l border-border-subtle",ref:s,children:e.map(c=>d(y.OnThisPageItem,{level:c.level,children:d(y.OnThisPageLink,{href:`#${c.id}`,active:a===c.id,onClick:b=>g(b,c.id),className:"pl-4",children:c.text})},c.id))})]})}),(r||o)&&C("div",{className:"mt-8 pt-8 border-t border-border-subtle space-y-4",children:[d("p",{className:"text-xs font-bold uppercase tracking-wider text-text-main",children:"Need help?"}),C("ul",{className:"space-y-3",children:[r&&t&&d("li",{children:C("a",{href:r.replace(":path",t),target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-text-muted hover:text-text-main transition-colors",children:[d(st,{size:16}),"Edit this page"]})}),o&&d("li",{children:C("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-sm text-text-muted hover:text-text-main transition-colors",children:[d(lt,{size:16}),"Community help"]})})]})]})]})}import{useEffect as pt}from"react";import{useLocation as ut}from"react-router-dom";function Ir({siteTitle:e,siteDescription:r,routes:o}){let t=ut();return pt(()=>{let a=o.find(g=>g.path===t.pathname),l=a?.title,n=a?.description||r||"";document.title=l?`${l} | ${e}`:e;let s=document.querySelector('meta[name="description"]');s||(s=document.createElement("meta"),s.name="description",document.head.appendChild(s)),s.content=n,L("property","og:title",document.title),L("property","og:description",n),L("property","og:type","article"),L("property","og:url",window.location.href),L("name","twitter:card","summary"),L("name","twitter:title",document.title),L("name","twitter:description",n);let m=document.querySelector('link[rel="canonical"]');m||(m=document.createElement("link"),m.rel="canonical",document.head.appendChild(m)),m.href=window.location.origin+t.pathname},[t.pathname,e,r,o]),null}function L(e,r,o){let t=document.querySelector(`meta[${e}="${r}"]`);t||(t=document.createElement("meta"),t.setAttribute(e,r),document.head.appendChild(t)),t.content=o}import{Home as dt}from"lucide-react";import{jsx as I,jsxs as ke}from"react/jsx-runtime";function zr(){let{crumbs:e,activeRoute:r}=ce(),t=F().theme||{};return e.length===0||!t?.breadcrumbs?null:ke(j,{children:[I(z,{children:I(A,{href:"/",children:I(dt,{size:14})})}),e.map((a,l)=>ke(z,{children:[I(ee,{}),I(A,{href:a.href,className:W({"font-medium text-text-main":a.href===r?.path}),children:a.label})]},`crumb-${a.href}-${a.label}-${l}`))]})}import{jsx as M,jsxs as _}from"react/jsx-runtime";function Gr(){let{prevPage:e,nextPage:r}=pe();return!e&&!r?null:_(v.PageNavRoot,{children:[e?_(v.PageNavLink,{to:e.path,direction:"prev",children:[M(v.PageNavLink.Title,{children:"Previous"}),M(v.PageNavLink.Description,{children:e.title})]}):M("div",{}),r&&_(v.PageNavLink,{to:r.path,direction:"next",children:[M(v.PageNavLink.Title,{children:"Next"}),M(v.PageNavLink.Description,{children:r.title})]})]})}import{useEffect as gt,useState as ft}from"react";import{ProgressBar as ht}from"react-aria-components";import{jsx as Se}from"react/jsx-runtime";function Wr(){let[e,r]=ft(0);return gt(()=>{let o=null,t,a=()=>{if(!o)return;let{scrollTop:n,scrollHeight:s,clientHeight:m}=o;if(s<=m){r(0);return}let g=n/(s-m)*100;r(Math.min(100,Math.max(0,g)))},l=()=>(o=document.querySelector(".boltdocs-content"),o?(o.addEventListener("scroll",a),a(),t&&clearInterval(t),!0):!1);return l()||(t=setInterval(l,100)),()=>{o&&o.removeEventListener("scroll",a),t&&clearInterval(t)}},[]),Se(ht,{value:e,"aria-label":"Reading progress",className:"fixed top-0 left-0 right-0 z-999 h-0.5 bg-transparent w-full pointer-events-none",children:({percentage:o})=>Se("div",{className:"h-full bg-primary-500 transition-[width] duration-300 ease-out shadow-[0_0_8px_rgba(var(--primary-rgb),0.4)]",style:{width:`${o}%`}})})}import{Component as bt}from"react";import{jsx as G,jsxs as vt}from"react/jsx-runtime";var Re=class extends bt{state={hasError:!1};static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,o){console.error("Uncaught error in Boltdocs Layout:",r,o)}render(){return this.state.hasError?this.props.fallback||vt("div",{className:"flex flex-col items-center justify-center min-h-[40vh] text-center gap-4 px-4",children:[G("div",{className:"text-lg font-bold text-red-400",children:"Something went wrong"}),G("p",{className:"text-sm text-text-muted max-w-md",children:this.state.error?.message||"An unexpected error occurred while rendering this page."}),G(k,{className:"rounded-lg border border-border-subtle bg-bg-surface px-5 py-2 text-sm font-medium text-text-main transition-colors hover:bg-bg-muted cursor-pointer",onPress:()=>this.setState({hasError:!1}),children:"Try again"})]}):this.props.children}};export{yt as a,wt as b,he as c,xe as d,ye as e,lr as f,Le as g,vr as h,wr as i,Ir as j,zr as k,Gr as l,Wr as m,Re as n};
@@ -1 +0,0 @@
1
- import{a as f}from"./chunk-JXHNX2WN.mjs";import{A as u,B as m,C as S,D as d,E as p,F as y,G as D,y as g,z as h}from"./chunk-ZRJ55GGF.mjs";import{useEffect as K,useCallback as M}from"react";import{useNavigate as R}from"react-router-dom";import{Fragment as T,jsx as o,jsxs as n}from"react/jsx-runtime";function A({routes:v}){let{isOpen:I,setIsOpen:a,query:w,setQuery:k,list:E}=f(v),r=R();K(()=>{let e=t=>{(/Mac/.test(navigator.userAgent)?t.metaKey:t.ctrlKey)&&(t.key==="k"||t.key==="j")&&(t.preventDefault(),a(i=>!i))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]);let l=M(e=>{let t=String(e);if(a(!1),t.includes("#")){let[s,c]=t.split("#");r(s),setTimeout(()=>{let i=document.getElementById(c);i&&i.scrollIntoView({behavior:"smooth"})},100)}else r(t)},[r,a]);return n(T,{children:[o(g.SearchTrigger,{onPress:()=>a(!0)}),o(h,{isOpen:I,onOpenChange:a,children:n(u,{onSelectionChange:l,children:[o(m,{value:w,onChange:e=>k(e.target.value)}),o(S,{items:E,children:e=>n(d,{onPress:()=>l(e.id),textValue:e.title,children:[o(p,{isHeading:e.isHeading}),n("div",{className:"flex flex-col justify-center gap-0.5",children:[o(y,{children:e.title}),o(D,{children:e.groupTitle})]})]},e.id)})]})})]})}export{A as a};
@@ -1 +0,0 @@
1
- import{f as c}from"./chunk-NBCYHLAA.mjs";import{useState as h,useMemo as C}from"react";function b(a){let{currentLocale:o,currentVersion:s}=c(),[d,g]=h(!1),[i,u]=h(""),f=C(()=>{let n=a.filter(t=>{let e=!o||t.locale===o,m=!s||t.version===s;return e&&m});if(!i)return n.slice(0,10).map(t=>({id:t.path,title:t.title,path:t.path,bio:t.description||"",groupTitle:t.groupTitle}));let r=[],l=i.toLowerCase();for(let t of n)if(t.title?.toLowerCase().includes(l)&&r.push({id:t.path,title:t.title,path:t.path,bio:t.description||"",groupTitle:t.groupTitle}),t.headings)for(let e of t.headings)e.text.toLowerCase().includes(l)&&r.push({id:`${t.path}#${e.id}`,title:e.text,path:`${t.path}#${e.id}`,bio:`Heading in ${t.title}`,groupTitle:t.title,isHeading:!0});let p=new Set;return r.filter(t=>p.has(t.path)?!1:(p.add(t.path),!0)).slice(0,10)},[a,i,o,s]);return{isOpen:d,setIsOpen:g,query:i,setQuery:u,list:f,input:{value:i,onChange:n=>u(n.target.value)}}}export{b as a};