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.
- package/dist/client/index.cjs +1929 -1
- package/dist/client/index.js +1880 -1
- package/dist/client/mdx.cjs +7 -1
- package/dist/client/mdx.js +7 -1
- package/dist/client/primitives.cjs +60 -1
- package/dist/client/primitives.js +20 -1
- package/dist/docs-layout-BXHV0xw_.cjs +1431 -0
- package/dist/docs-layout-DwFndmj5.js +1231 -0
- package/dist/icons-dev-3cZMyt8r.cjs +1204 -0
- package/dist/icons-dev-Df8OQ481.js +839 -0
- package/dist/image-DtrI2cw3.cjs +268 -0
- package/dist/image-jxPb-2iV.js +214 -0
- package/dist/mdx-BdWkJTeB.cjs +523 -0
- package/dist/mdx-UTTLFWJq.js +494 -0
- package/dist/node/cli-entry.cjs +1 -1
- package/dist/node/cli-entry.mjs +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.mjs +1 -1
- package/dist/{node-DtEDyN1u.cjs → node-BSM4qcDK.cjs} +1 -1
- package/dist/{node-_1jhMGYx.mjs → node-BspZN3R2.mjs} +1 -1
- package/dist/{package-DrwtlXfk.cjs → package-DIIrjuWI.cjs} +1 -1
- package/dist/{package--0Yf0t1N.mjs → package-K0zsjGIz.mjs} +1 -1
- package/dist/{search-dialog-ByvGScjt.js → search-dialog-BHuIiUC6.js} +3 -1
- package/dist/search-dialog-BNF10tDl.js +375 -0
- package/dist/search-dialog-BwkDuI9R.cjs +220 -0
- package/dist/search-dialog-C7xuvyNk.cjs +386 -0
- package/dist/search-dialog-CIQg6k8c.cjs +8 -0
- package/dist/search-dialog-D-DDN7zJ.js +208 -0
- package/package.json +3 -4
- package/dist/docs-layout-KoWNZc8_.js +0 -6
- package/dist/docs-layout-x2yKt2cL.cjs +0 -6
- package/dist/icons-dev-B_RZIyxu.js +0 -6
- package/dist/icons-dev-BlV3wWFT.cjs +0 -6
- package/dist/image-BHhTvQzr.cjs +0 -6
- package/dist/image-CqKzYD8f.js +0 -6
- package/dist/mdx-DudBEac0.js +0 -7
- package/dist/mdx-r4cDQxWu.cjs +0 -7
- package/dist/search-dialog-B584t9ZF.js +0 -6
- package/dist/search-dialog-BvBopRsZ.cjs +0 -6
- package/dist/search-dialog-Cyko6TJm.cjs +0 -6
- package/dist/search-dialog-D6BNohIJ.js +0 -6
- package/dist/search-dialog-DuYTIefy.cjs +0 -6
- package/src/client/app/config-context.tsx +0 -51
- package/src/client/app/doc-page.tsx +0 -38
- package/src/client/app/docs-layout.tsx +0 -28
- package/src/client/app/head.tsx +0 -122
- package/src/client/app/helmet-compat.tsx +0 -36
- package/src/client/app/mdx-component.tsx +0 -8
- package/src/client/app/mdx-components-context.tsx +0 -72
- package/src/client/app/routes-context.tsx +0 -34
- package/src/client/app/scroll-handler.tsx +0 -74
- package/src/client/app/theme-context.tsx +0 -103
- package/src/client/app/ui-context.tsx +0 -42
- package/src/client/components/docs-layout-default.tsx +0 -85
- package/src/client/components/icons-dev.tsx +0 -282
- package/src/client/components/mdx/callout.tsx +0 -97
- package/src/client/components/mdx/card.tsx +0 -99
- package/src/client/components/mdx/cards.tsx +0 -27
- package/src/client/components/mdx/code-block.tsx +0 -184
- package/src/client/components/mdx/field.tsx +0 -33
- package/src/client/components/mdx/image.tsx +0 -44
- package/src/client/components/mdx/index.ts +0 -19
- package/src/client/components/mdx/table.tsx +0 -54
- package/src/client/components/mdx/typographics.tsx +0 -120
- package/src/client/components/mdx/use-code-block.ts +0 -34
- package/src/client/components/primitives/breadcrumbs.tsx +0 -54
- package/src/client/components/primitives/button-group.tsx +0 -54
- package/src/client/components/primitives/button.tsx +0 -6
- package/src/client/components/primitives/code-block.tsx +0 -120
- package/src/client/components/primitives/docs-layout.tsx +0 -125
- package/src/client/components/primitives/error-boundary.tsx +0 -107
- package/src/client/components/primitives/heading.tsx +0 -128
- package/src/client/components/primitives/helpers/observer.ts +0 -141
- package/src/client/components/primitives/image.tsx +0 -26
- package/src/client/components/primitives/link.tsx +0 -102
- package/src/client/components/primitives/menu.tsx +0 -137
- package/src/client/components/primitives/navbar.tsx +0 -466
- package/src/client/components/primitives/on-this-page.tsx +0 -430
- package/src/client/components/primitives/page-nav.tsx +0 -51
- package/src/client/components/primitives/popover.tsx +0 -28
- package/src/client/components/primitives/search-dialog.tsx +0 -193
- package/src/client/components/primitives/sidebar.tsx +0 -423
- package/src/client/components/primitives/skeleton.tsx +0 -26
- package/src/client/components/primitives/tabs.tsx +0 -70
- package/src/client/components/primitives/tooltip.tsx +0 -81
- package/src/client/components/primitives/types.ts +0 -11
- package/src/client/components/ui-base/banner.tsx +0 -66
- package/src/client/components/ui-base/breadcrumbs.tsx +0 -44
- package/src/client/components/ui-base/copy-markdown.tsx +0 -107
- package/src/client/components/ui-base/error-boundary.tsx +0 -15
- package/src/client/components/ui-base/github-stars.tsx +0 -29
- package/src/client/components/ui-base/icons.tsx +0 -240
- package/src/client/components/ui-base/index.ts +0 -16
- package/src/client/components/ui-base/last-updated.tsx +0 -27
- package/src/client/components/ui-base/navbar.tsx +0 -266
- package/src/client/components/ui-base/not-found.tsx +0 -26
- package/src/client/components/ui-base/on-this-page.tsx +0 -57
- package/src/client/components/ui-base/page-nav.tsx +0 -50
- package/src/client/components/ui-base/search-dialog.tsx +0 -163
- package/src/client/components/ui-base/search-highlight.tsx +0 -10
- package/src/client/components/ui-base/sidebar.tsx +0 -92
- package/src/client/components/ui-base/tabs.tsx +0 -83
- package/src/client/components/ui-base/theme-toggle.tsx +0 -130
- package/src/client/components/ui-base/version-i18n.tsx +0 -80
- package/src/client/hooks/index.ts +0 -13
- package/src/client/hooks/use-analytics.ts +0 -272
- package/src/client/hooks/use-breadcrumbs.ts +0 -22
- package/src/client/hooks/use-i18n.ts +0 -182
- package/src/client/hooks/use-localized-to.ts +0 -113
- package/src/client/hooks/use-location.ts +0 -5
- package/src/client/hooks/use-navbar.ts +0 -130
- package/src/client/hooks/use-page-nav.ts +0 -46
- package/src/client/hooks/use-routes.ts +0 -108
- package/src/client/hooks/use-search-highlight.ts +0 -185
- package/src/client/hooks/use-search.ts +0 -118
- package/src/client/hooks/use-sidebar.ts +0 -205
- package/src/client/hooks/use-tabs.ts +0 -46
- package/src/client/hooks/use-version.ts +0 -111
- package/src/client/index.ts +0 -31
- package/src/client/mdx.ts +0 -2
- package/src/client/primitives.ts +0 -19
- package/src/client/ssg/boltdocs-shell.tsx +0 -148
- package/src/client/ssg/create-routes.tsx +0 -473
- package/src/client/ssg/index.ts +0 -4
- package/src/client/ssg/mdx-page.tsx +0 -38
- package/src/client/store/boltdocs-context.tsx +0 -137
- package/src/client/theme/neutral.css +0 -141
- package/src/client/theme/reset.css +0 -189
- package/src/client/types.ts +0 -116
- package/src/client/utils/cn.ts +0 -6
- package/src/client/utils/copy-clipboard.ts +0 -22
- package/src/client/utils/get-base-file-path.ts +0 -21
- package/src/client/utils/github.ts +0 -121
- package/src/client/utils/i18n.ts +0 -23
- package/src/client/utils/path.ts +0 -9
- package/src/client/utils/react-to-text.ts +0 -34
- package/src/client/virtual.d.ts +0 -24
|
@@ -104,7 +104,7 @@ export const createRoot = ViteReactSSG(
|
|
|
104
104
|
const mdxComponents = components.default || components;
|
|
105
105
|
export default mdxComponents;
|
|
106
106
|
export * from '${t}';`}return`export default {};`}if(l===`layout`){let t=[`tsx`,`jsx`],n=null;for(let e of t){let t=_.resolve(i,`layout.${e}`);if(S.existsSync(t)){n=t;break}}if(n)return`import UserLayout from '${e(n)}';
|
|
107
|
-
export default UserLayout;`;throw Error(`[Boltdocs] Layout file not found. A 'layout.tsx' or 'layout.jsx' file is mandatory in your docs directory. Please create one to define your site structure.`)}if(l===`icons`){let t=[`tsx`,`jsx`,`ts`,`js`],n=null;for(let e of t){let t=_.resolve(i,`icons.${e}`);if(S.existsSync(t)){n=t;break}}return n?`import * as icons from '${e(n)}';\nexport default icons;`:`export default {};`}if(l===`search`){if(!V){let e=ze(await s(i,c));V=`export default ${JSON.stringify(e,null,2)};`}return V}if(l===`client`){let t=L,n=``;for(;t&&t!==_.parse(t).root;){let r=_.join(t,`src/client/index.ts`),i=_.join(t,`dist/client/index.mjs`),a=_.join(t,`client/index.ts`);if(S.existsSync(r)){n=e(r);break}if(S.existsSync(i)){n=e(i);break}if(S.existsSync(a)){n=e(a);break}t=_.dirname(t)}if(!n)throw Error(`[boltdocs] Could not resolve boltdocs/client entry point starting from ${L}`);return`export * from '${n}';`}}}}const He={"X-Content-Type-Options":`nosniff`,"X-Frame-Options":`DENY`,"X-XSS-Protection":`1; mode=block`,"Referrer-Policy":`strict-origin-when-cross-origin`,"Permissions-Policy":`camera=(), microphone=(), geolocation=()`,"Strict-Transport-Security":`max-age=31536000; includeSubDomains`};function Ue(e){let t=process.env.NODE_ENV===`development`,n={"default-src":[`'self'`],"script-src":[`'self'`,`'unsafe-inline'`],"style-src":[`'self'`,`'unsafe-inline'`],"img-src":[`'self'`,`data:`,`https:`],"font-src":[`'self'`],"connect-src":[`'self'`]};return t&&(n[`script-src`]=[`'self'`,`'unsafe-eval'`,`'unsafe-inline'`],n[`style-src`]=[`'self'`,`'unsafe-inline'`]),Object.entries(n).map(([e,t])=>`${e} ${t.join(` `)}`).join(`; `)}const H=new Map;async function We(e){try{let{data:t}=await r(e),n=JSON.stringify(t);return re.createHash(`md5`).update(n).digest(`hex`)}catch{return``}}function Ge(e){return H.get(e)}function Ke(e,t){H.set(e,t)}function qe(e){H.delete(e)}function U(e,t){let n=e.moduleGraph.getModuleById(`\0virtual:boltdocs-${t}.ts`);n&&e.moduleGraph.invalidateModule(n)}function Je(t,r,i,s,u){let f=new Map;return{name:`vite-plugin-boltdocs-dev-server`,apply:`serve`,async configureServer(s){let p=u();await p?.runHook(`beforeDev`),d(t,process.cwd(),i()).catch(e=>{x(`Failed to generate initial link tree:`,e)}),setTimeout(async()=>{try{let{generateRoutes:e}=await import(`./routes-CpxZIsMM.mjs`).then(e=>e.r),n=await e(t,i());for(let e of n)if(e.filePath){let t=_.relative(process.cwd(),e.filePath).replace(/\\/g,`/`),n=t.startsWith(`/`)?t:`/${t}`;await s.transformRequest(n).catch(()=>{}),await new Promise(e=>setTimeout(e,50))}}catch{}},1e3),s.middlewares.use((e,t,n)=>{process.env.NODE_ENV===`production`&&Object.entries(He).forEach(([e,n])=>{t.setHeader(e,n)});let r=i();r.security?.enableCSP&&t.setHeader(`Content-Security-Policy`,Ue(r)),n()}),s.middlewares.use((e,t,n)=>{if(e.url===`/robots.txt`){n();return}n()}),s.middlewares.use(async(e,t,n)=>{let r=e.url?.split(`?`)[0]||`/`,a=e.headers.accept||``,o=i(),c=/\.(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(r);if(a.includes(`text/html`)&&!c){let n=Me(o);n=Ne(n,o),n=await s.transformIndexHtml(e.url||`/`,n),t.statusCode=200,t.setHeader(`Content-Type`,`text/html`),t.end(n);return}n()});let m=l.map(e=>_.resolve(process.cwd(),e)),ee=[`tsx`,`jsx`].map(e=>_.resolve(t,`layout.${e}`)),h=[`tsx`,`ts`,`jsx`,`js`],te=h.map(e=>_.resolve(t,`mdx-components.${e}`)),g=h.map(e=>_.resolve(t,`pages-external/index.${e}`)),v=h.map(e=>_.resolve(t,`icons.${e}`));s.watcher.add([...m,...te,...ee,...g,...v]);let y=async(u,p)=>{try{let m=e(u);if(l.some(e=>m.endsWith(e))){s.restart();return}if(h.some(e=>m.endsWith(`mdx-components.${e}`))){c(i(),t),U(s,`mdx-components.tsx`),s.ws.send({type:`full-reload`});return}if(h.some(e=>m.endsWith(`icons.${e}`))){U(s,`icons.tsx`),s.ws.send({type:`full-reload`});return}if(m.endsWith(`layout.tsx`)||m.endsWith(`layout.jsx`)){U(s,`layout.tsx`),s.ws.send({type:`full-reload`});return}if(m.includes(`/pages-external/`)||m.includes(`\\pages-external\\`)){U(s,`entry`),s.ws.send({type:`full-reload`});return}if(!m.toLowerCase().startsWith(r.toLowerCase())||!n(m))return;if(p===`add`||p===`unlink`){p===`unlink`&&qe(u),o(),Be();let e=i();c(e,t),U(s,`config`),U(s,`routes`),U(s,`search`),d(t,process.cwd(),e).catch(e=>{x(`Failed to update link tree:`,e)}),s.ws.send({type:`custom`,event:`boltdocs:config-update`,data:{theme:e?.theme,i18n:e?.i18n,versions:e?.versions,siteUrl:e?.siteUrl}}),s.ws.send({type:`full-reload`});return}f.has(m)&&clearTimeout(f.get(m)),f.set(m,setTimeout(async()=>{f.delete(m);try{let n=Ge(u),r=await We(u);Ke(u,r),a(u),n!==void 0&&n!==r&&(U(s,`routes`),U(s,`search`));let i=e(_.relative(t,u)),o=s.moduleGraph.getModulesByFile(m);if(o)for(let e of o)s.moduleGraph.invalidateModule(e);s.ws.send({type:`custom`,event:`boltdocs:mdx-update`,data:{file:m,relPath:i}})}catch(e){x(`HMR error processing content change:`,e)}},150))}catch(e){x(`HMR error during ${p} event:`,e)}};s.watcher.on(`add`,e=>y(e,`add`)),s.watcher.on(`unlink`,e=>y(e,`unlink`)),s.watcher.on(`change`,e=>y(e,`change`)),await p?.runHook(`afterDev`)},handleHotUpdate({file:t,server:i}){let a=e(t);if(a.toLowerCase().startsWith(r.toLowerCase())&&n(a))return[]}}}const W=p.createRequire(import.meta.url);function Ye(e){let t=_.dirname(e);for(;t&&t!==_.dirname(t);){let e=_.join(t,`package.json`);if(S.existsSync(e))return e;t=_.dirname(t)}return null}function Xe(e){let t=e.split(`/`);return e.startsWith(`@`)?{packageName:t.slice(0,2).join(`/`),subpath:t.slice(2).join(`/`)}:{packageName:t[0],subpath:t.slice(1).join(`/`)}}function G(e,t=W){try{let{packageName:n,subpath:r}=Xe(e),i;try{i=t.resolve(n+`/package.json`)}catch{i=Ye(t.resolve(n))||``}if(!i)throw Error(`Could not find package.json for ${n}`);let a=_.dirname(i),o=JSON.parse(S.readFileSync(i,`utf-8`)),s=``,c=r?`./`+r:`.`;if(o.exports){let e=o.exports[c]||o.exports[r];e&&(s=typeof e==`string`?e:e.import||e.default||e.require||e)}if(!s&&!r&&(s=o.module||o.main||`index.js`),typeof s==`object`&&(s=s.import||s.default||s.require||``),s){let e=_.resolve(a,s);if(S.existsSync(e))return e}}catch{}return t.resolve(e)}function Ze(){let t=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`],n=[],r=W;try{let e=_.join(process.cwd(),`node_modules/boltdocs/package.json`);if(S.existsSync(e)){let t=S.realpathSync(e);r=p.createRequire(t)}else r=p.createRequire(_.join(process.cwd(),`package.json`))}catch{}for(let e of t)try{let t=``;t=e===`@bdocs/ssg`||e===`react-router-dom`||e===`react-helmet-async`?G(e,r):r.resolve(e),t&&n.push(S.realpathSync(t))}catch{}if(r!==W)for(let e of t)try{let t=``;t=e===`@bdocs/ssg`||e===`react-router-dom`||e===`react-helmet-async`?G(e,W):W.resolve(e),t&&n.push(S.realpathSync(t))}catch{}for(let e of[`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`]){try{n.push(S.realpathSync(r.resolve(e)))}catch{}if(r!==W)try{n.push(S.realpathSync(W.resolve(e)))}catch{}}return Array.from(new Set(n)).map(t=>e(t))}function Qe(t={},n){let r=_.resolve(process.cwd(),t.docsDir||`docs`),i=e(r),a=n,o,c=!1,l,u=[],d=()=>a;return[{name:`vite-plugin-boltdocs`,enforce:`pre`,async config(e,t){c=t.command===`build`;let n=!!(t.ssrBuild||t.ssr||e.build?.ssr),i=e.envDir||process.cwd(),o=te(t.mode,i,``);Object.assign(process.env,o),a||=await f(r);let d=(await import(`./package--0Yf0t1N.mjs`)).version,p=N(a.plugins||[],d);return a.plugins=p,l=new I(p,a),u=p.flatMap(e=>F.getSanitizedCapabilities(e).vitePlugins||[]),c&&await l.runHook(`beforeBuild`),{ssgOptions:{entry:`boltdocs/entry`,htmlEntry:`index.html`,dirStyle:`flat`,includeAllRoutes:!0,mock:!0,script:`async`,beastiesOptions:{preload:`media`},onFinished:async e=>{let t=Ae(ke(await s(r,a)),a);t&&S.writeFileSync(_.join(e,`sitemap.xml`),t);let n=je(a);S.writeFileSync(_.join(e,`robots.txt`),n)}},build:{ssrManifest:c},optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`,`react-router-dom`,`react-helmet-async`,`react-fast-compare`,`invariant`],exclude:[`boltdocs`,`boltdocs/client`]},resolve:{alias:[{find:`react-router-dom`,replacement:G(`react-router-dom`)},{find:`react-helmet-async`,replacement:G(`react-helmet-async`)},{find:`@bdocs/ssg`,replacement:G(`@bdocs/ssg`)}],dedupe:[`react`,`react-dom`,...n?[]:[`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`]]},ssr:{external:[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`,...Ze()],optimizeDeps:{include:[`react-fast-compare`,`invariant`]},noExternal:[]}}},configResolved(e){o=e,l?.runHook(`configResolved`,a)},resolveId(e,t,n){let r=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`].find(t=>e===t||e.startsWith(t+`/`)||e.includes(`/node_modules/${t}/`)||t.startsWith(`@`)&&e.includes(`/node_modules/${t.replace(`/`,_.sep)}/`));if(r&&n?.ssr){let t=e;if(!_.isAbsolute(e)){let n=W;try{let e=_.join(process.cwd(),`node_modules/boltdocs/package.json`);if(S.existsSync(e)){let t=S.realpathSync(e);n=p.createRequire(t)}else n=p.createRequire(_.join(process.cwd(),`package.json`))}catch{}try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?G(e,n):n.resolve(e)}catch{try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?G(e,W):W.resolve(e)}catch{}}}try{t=S.realpathSync(t)}catch{}return{id:t,external:!0}}return null},transformIndexHtml:{order:`pre`,handler(e){return Ne(e,a)}},async buildEnd(){let{pool:e}=await import(`./worker-pool-CGn7DrLb.mjs`);await e.terminate()},async closeBundle(){!c||o?.build?.ssr||(await l?.runHook(`afterBuild`),await l?.runHook(`buildEnd`))},configurePreviewServer(e){let t=o?.build?.outDir?_.resolve(o.root||process.cwd(),o.build.outDir):_.resolve(process.cwd(),`dist`);e.middlewares.use((e,n,r)=>{let i=e.url||`/`,a=i.split(`?`)[0].split(`#`)[0];if(_.extname(a))return r();let o=a.replace(/\/$/,``)||`/`,s=_.join(t,o,`index.html`);o!==`/`&&S.existsSync(s)&&(e.url=`${o}/index.html${i.includes(`?`)?`?${i.split(`?`)[1]}`:``}`),r()})}},Ve(t,d,()=>o,r),Je(r,i,d,e=>{a=e},()=>l),{...ie({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:`preset-default`}]}}),apply:`build`},...u]}const K=new i(`mdx`),$e=[pe.default||pe,me.default||me,T.default||T,E.default||E,D.default||D,O.default||O,he.default||he],et=[ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe];let q=null,J=null;const tt=()=>(q??=de(),q),nt=async e=>J||(J=fe({themes:$e,langs:et,engine:tt()}),J),Y={JSX_FLOW_ELEMENT:`mdxJsxFlowElement`,JSX_TEXT_ELEMENT:`mdxJsxTextElement`,JSX_ATTRIBUTE:`mdxJsxAttribute`,ELEMENT:`element`,TEXT:`text`,CODE:`code`},rt={PRE:`pre`,CODE:`code`},X={TITLE:`data-title`,LANG:`data-lang`,HIGHLIGHTED:`data-highlighted`,HIGHLIGHTED_HTML:`data-highlighted-html`},Z={LINE_NUMBERS:`shiki-line-numbers`,WORD_WRAP:`shiki-word-wrap`,FALLBACK:`shiki-fallback`},it={LIGHT:`github-light`,DARK:`github-dark`},Q={LANG:`plaintext`,MDX_DEFAULT_LANG:`text`},at=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:line-numbers`,pre(e){let n=this.options.meta?.lineNumbers===!0;(t||n)&&this.addClassToHast(e,Z.LINE_NUMBERS)}}},ot=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:word-wrap`,pre(e){let n=this.options.meta?.wordWrap===!0;(t||n)&&this.addClassToHast(e,Z.WORD_WRAP)}}},st=()=>({name:`AddTitleProperty`,pre(e){let t=this.options.meta?.title;t&&(e.properties[X.TITLE]=t)}}),ct=()=>({name:`AddLanguageProperty`,pre(e){e.properties[X.LANG]=this.options.lang||Q.LANG}});function lt(e){let t={};if(!e)return t;/lineNumbers|showLineNumbers/.test(e)&&(t.lineNumbers=!0),/wordWrap|word-wrap/.test(e)&&(t.wordWrap=!0);let n=e.match(/title=(["'])(.*?)\1/);return n&&(t.title=n[2]),t}var ut=class{config;constructor(e){this.config=e}getTheme(){return this.config?.theme?.codeTheme||{light:it.LIGHT,dark:it.DARK}}async getHighlighter(){return await nt(this.getTheme())}getOptions(e,t){let n=this.getTheme(),r={},i=``;typeof t==`string`?(i=t,r=lt(t)):t&&(r=t,i=t.__raw||``);let a={lang:e||Q.LANG,meta:{__raw:i,...r},transformers:[at(),ot(),st(),ct()]};return typeof n==`object`?a.themes={light:n.light,dark:n.dark}:a.theme=n,a}async render(e,t,n){try{let r=await this.getHighlighter(),i=this.getOptions(t,n);return r.codeToHtml(e,i)}catch(t){return console.error(`[ShikiAdapter] Failed to render code:`,t),`<pre class="${Z.FALLBACK}"><code>${dt(e)}</code></pre>`}}};function dt(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}let $=null,ft;function pt(e){let t=JSON.stringify(e?.theme?.codeTheme||null);return($===null||ft!==t)&&($=new ut(e),ft=t),$}function mt(e){let t=pt(e);return async e=>{let n=await t.getHighlighter();w(e,Y.ELEMENT,e=>{if(e.tagName===rt.PRE&&e.children?.[0]?.type===Y.ELEMENT&&e.children[0].tagName===rt.CODE){let r=e.children[0],i=(r.properties?.className||[]).find(e=>e.startsWith(`language-`)),a=i?i.slice(9):Q.MDX_DEFAULT_LANG;if(a===`mermaid`)return;let o=r.children?.[0]?.value||``,s=lt(r.properties?.metastring||r.data?.meta||``),c=t.getOptions(a,s),l=``;try{l=n.codeToHtml(o,c)}catch(e){console.error(`[rehypeShiki] Failed to highlight code block:`,e),l=`<pre class="${Z.FALLBACK}"><code>${dt(o)}</code></pre>`}e.properties=e.properties||{},s.title&&(e.properties[X.TITLE]=s.title),e.properties[X.HIGHLIGHTED]=`true`,e.properties[X.HIGHLIGHTED_HTML]=l,e.properties[X.LANG]=a,e.children=[]}})}}function ht(){return e=>{w(e,Y.CODE,e=>{e.meta&&(e.data=e.data||{},e.data.hProperties=e.data.hProperties||{},e.data.hProperties.metastring=e.meta)})}}let gt=!1;function _t(e,t=se){let n=e?.plugins?.flatMap(e=>F.getSanitizedCapabilities(e).remarkPlugins||[])||[],r=e?.plugins?.flatMap(e=>F.getSanitizedCapabilities(e).rehypePlugins||[])||[],i=t({remarkPlugins:[ce,le,ht,...n],rehypePlugins:[ue,[mt,e],...r],jsxRuntime:`automatic`});return{...i,name:`vite-plugin-boltdocs-mdx`,async buildStart(){gt||=(await K.load(),!0),i.buildStart&&await i.buildStart.call(this)},async transform(e,t,n){let[r]=t.split(`?`);if(!r.endsWith(`.md`)&&!r.endsWith(`.mdx`))return i.transform?.call(this,e,t,n);let a=`${r}:${re.createHash(`md5`).update(e).digest(`hex`)}:${process.env.NODE_ENV===`production`?`prod`:`dev`}:v3`,o=await K.getAsync(a);if(o)return{code:o,map:null};let s=await i.transform.call(this,e,r,n);return s&&typeof s==`object`&&s.code&&(process.env.NODE_ENV!==`production`&&(s.code+=`
|
|
107
|
+
export default UserLayout;`;throw Error(`[Boltdocs] Layout file not found. A 'layout.tsx' or 'layout.jsx' file is mandatory in your docs directory. Please create one to define your site structure.`)}if(l===`icons`){let t=[`tsx`,`jsx`,`ts`,`js`],n=null;for(let e of t){let t=_.resolve(i,`icons.${e}`);if(S.existsSync(t)){n=t;break}}return n?`import * as icons from '${e(n)}';\nexport default icons;`:`export default {};`}if(l===`search`){if(!V){let e=ze(await s(i,c));V=`export default ${JSON.stringify(e,null,2)};`}return V}if(l===`client`){let t=L,n=``;for(;t&&t!==_.parse(t).root;){let r=_.join(t,`src/client/index.ts`),i=_.join(t,`dist/client/index.mjs`),a=_.join(t,`client/index.ts`);if(S.existsSync(r)){n=e(r);break}if(S.existsSync(i)){n=e(i);break}if(S.existsSync(a)){n=e(a);break}t=_.dirname(t)}if(!n)throw Error(`[boltdocs] Could not resolve boltdocs/client entry point starting from ${L}`);return`export * from '${n}';`}}}}const He={"X-Content-Type-Options":`nosniff`,"X-Frame-Options":`DENY`,"X-XSS-Protection":`1; mode=block`,"Referrer-Policy":`strict-origin-when-cross-origin`,"Permissions-Policy":`camera=(), microphone=(), geolocation=()`,"Strict-Transport-Security":`max-age=31536000; includeSubDomains`};function Ue(e){let t=process.env.NODE_ENV===`development`,n={"default-src":[`'self'`],"script-src":[`'self'`,`'unsafe-inline'`],"style-src":[`'self'`,`'unsafe-inline'`],"img-src":[`'self'`,`data:`,`https:`],"font-src":[`'self'`],"connect-src":[`'self'`]};return t&&(n[`script-src`]=[`'self'`,`'unsafe-eval'`,`'unsafe-inline'`],n[`style-src`]=[`'self'`,`'unsafe-inline'`]),Object.entries(n).map(([e,t])=>`${e} ${t.join(` `)}`).join(`; `)}const H=new Map;async function We(e){try{let{data:t}=await r(e),n=JSON.stringify(t);return re.createHash(`md5`).update(n).digest(`hex`)}catch{return``}}function Ge(e){return H.get(e)}function Ke(e,t){H.set(e,t)}function qe(e){H.delete(e)}function U(e,t){let n=e.moduleGraph.getModuleById(`\0virtual:boltdocs-${t}.ts`);n&&e.moduleGraph.invalidateModule(n)}function Je(t,r,i,s,u){let f=new Map;return{name:`vite-plugin-boltdocs-dev-server`,apply:`serve`,async configureServer(s){let p=u();await p?.runHook(`beforeDev`),d(t,process.cwd(),i()).catch(e=>{x(`Failed to generate initial link tree:`,e)}),setTimeout(async()=>{try{let{generateRoutes:e}=await import(`./routes-CpxZIsMM.mjs`).then(e=>e.r),n=await e(t,i());for(let e of n)if(e.filePath){let t=_.relative(process.cwd(),e.filePath).replace(/\\/g,`/`),n=t.startsWith(`/`)?t:`/${t}`;await s.transformRequest(n).catch(()=>{}),await new Promise(e=>setTimeout(e,50))}}catch{}},1e3),s.middlewares.use((e,t,n)=>{process.env.NODE_ENV===`production`&&Object.entries(He).forEach(([e,n])=>{t.setHeader(e,n)});let r=i();r.security?.enableCSP&&t.setHeader(`Content-Security-Policy`,Ue(r)),n()}),s.middlewares.use((e,t,n)=>{if(e.url===`/robots.txt`){n();return}n()}),s.middlewares.use(async(e,t,n)=>{let r=e.url?.split(`?`)[0]||`/`,a=e.headers.accept||``,o=i(),c=/\.(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(r);if(a.includes(`text/html`)&&!c){let n=Me(o);n=Ne(n,o),n=await s.transformIndexHtml(e.url||`/`,n),t.statusCode=200,t.setHeader(`Content-Type`,`text/html`),t.end(n);return}n()});let m=l.map(e=>_.resolve(process.cwd(),e)),ee=[`tsx`,`jsx`].map(e=>_.resolve(t,`layout.${e}`)),h=[`tsx`,`ts`,`jsx`,`js`],te=h.map(e=>_.resolve(t,`mdx-components.${e}`)),g=h.map(e=>_.resolve(t,`pages-external/index.${e}`)),v=h.map(e=>_.resolve(t,`icons.${e}`));s.watcher.add([...m,...te,...ee,...g,...v]);let y=async(u,p)=>{try{let m=e(u);if(l.some(e=>m.endsWith(e))){s.restart();return}if(h.some(e=>m.endsWith(`mdx-components.${e}`))){c(i(),t),U(s,`mdx-components.tsx`),s.ws.send({type:`full-reload`});return}if(h.some(e=>m.endsWith(`icons.${e}`))){U(s,`icons.tsx`),s.ws.send({type:`full-reload`});return}if(m.endsWith(`layout.tsx`)||m.endsWith(`layout.jsx`)){U(s,`layout.tsx`),s.ws.send({type:`full-reload`});return}if(m.includes(`/pages-external/`)||m.includes(`\\pages-external\\`)){U(s,`entry`),s.ws.send({type:`full-reload`});return}if(!m.toLowerCase().startsWith(r.toLowerCase())||!n(m))return;if(p===`add`||p===`unlink`){p===`unlink`&&qe(u),o(),Be();let e=i();c(e,t),U(s,`config`),U(s,`routes`),U(s,`search`),d(t,process.cwd(),e).catch(e=>{x(`Failed to update link tree:`,e)}),s.ws.send({type:`custom`,event:`boltdocs:config-update`,data:{theme:e?.theme,i18n:e?.i18n,versions:e?.versions,siteUrl:e?.siteUrl}}),s.ws.send({type:`full-reload`});return}f.has(m)&&clearTimeout(f.get(m)),f.set(m,setTimeout(async()=>{f.delete(m);try{let n=Ge(u),r=await We(u);Ke(u,r),a(u),n!==void 0&&n!==r&&(U(s,`routes`),U(s,`search`));let i=e(_.relative(t,u)),o=s.moduleGraph.getModulesByFile(m);if(o)for(let e of o)s.moduleGraph.invalidateModule(e);s.ws.send({type:`custom`,event:`boltdocs:mdx-update`,data:{file:m,relPath:i}})}catch(e){x(`HMR error processing content change:`,e)}},150))}catch(e){x(`HMR error during ${p} event:`,e)}};s.watcher.on(`add`,e=>y(e,`add`)),s.watcher.on(`unlink`,e=>y(e,`unlink`)),s.watcher.on(`change`,e=>y(e,`change`)),await p?.runHook(`afterDev`)},handleHotUpdate({file:t,server:i}){let a=e(t);if(a.toLowerCase().startsWith(r.toLowerCase())&&n(a))return[]}}}const W=p.createRequire(import.meta.url);function Ye(e){let t=_.dirname(e);for(;t&&t!==_.dirname(t);){let e=_.join(t,`package.json`);if(S.existsSync(e))return e;t=_.dirname(t)}return null}function Xe(e){let t=e.split(`/`);return e.startsWith(`@`)?{packageName:t.slice(0,2).join(`/`),subpath:t.slice(2).join(`/`)}:{packageName:t[0],subpath:t.slice(1).join(`/`)}}function G(e,t=W){try{let{packageName:n,subpath:r}=Xe(e),i;try{i=t.resolve(n+`/package.json`)}catch{i=Ye(t.resolve(n))||``}if(!i)throw Error(`Could not find package.json for ${n}`);let a=_.dirname(i),o=JSON.parse(S.readFileSync(i,`utf-8`)),s=``,c=r?`./`+r:`.`;if(o.exports){let e=o.exports[c]||o.exports[r];e&&(s=typeof e==`string`?e:e.import||e.default||e.require||e)}if(!s&&!r&&(s=o.module||o.main||`index.js`),typeof s==`object`&&(s=s.import||s.default||s.require||``),s){let e=_.resolve(a,s);if(S.existsSync(e))return e}}catch{}return t.resolve(e)}function Ze(){let t=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`],n=[],r=W;try{let e=_.join(process.cwd(),`node_modules/boltdocs/package.json`);if(S.existsSync(e)){let t=S.realpathSync(e);r=p.createRequire(t)}else r=p.createRequire(_.join(process.cwd(),`package.json`))}catch{}for(let e of t)try{let t=``;t=e===`@bdocs/ssg`||e===`react-router-dom`||e===`react-helmet-async`?G(e,r):r.resolve(e),t&&n.push(S.realpathSync(t))}catch{}if(r!==W)for(let e of t)try{let t=``;t=e===`@bdocs/ssg`||e===`react-router-dom`||e===`react-helmet-async`?G(e,W):W.resolve(e),t&&n.push(S.realpathSync(t))}catch{}for(let e of[`react/jsx-runtime`,`react/jsx-dev-runtime`,`react-dom/client`]){try{n.push(S.realpathSync(r.resolve(e)))}catch{}if(r!==W)try{n.push(S.realpathSync(W.resolve(e)))}catch{}}return Array.from(new Set(n)).map(t=>e(t))}function Qe(t={},n){let r=_.resolve(process.cwd(),t.docsDir||`docs`),i=e(r),a=n,o,c=!1,l,u=[],d=()=>a;return[{name:`vite-plugin-boltdocs`,enforce:`pre`,async config(e,t){c=t.command===`build`;let n=!!(t.ssrBuild||t.ssr||e.build?.ssr),i=e.envDir||process.cwd(),o=te(t.mode,i,``);Object.assign(process.env,o),a||=await f(r);let d=(await import(`./package-K0zsjGIz.mjs`)).version,p=N(a.plugins||[],d);return a.plugins=p,l=new I(p,a),u=p.flatMap(e=>F.getSanitizedCapabilities(e).vitePlugins||[]),c&&await l.runHook(`beforeBuild`),{ssgOptions:{entry:`boltdocs/entry`,htmlEntry:`index.html`,dirStyle:`flat`,includeAllRoutes:!0,mock:!0,script:`async`,beastiesOptions:{preload:`media`},onFinished:async e=>{let t=Ae(ke(await s(r,a)),a);t&&S.writeFileSync(_.join(e,`sitemap.xml`),t);let n=je(a);S.writeFileSync(_.join(e,`robots.txt`),n)}},build:{ssrManifest:c},optimizeDeps:{include:[`react`,`react-dom`,`react-dom/client`,`react-router-dom`,`react-helmet-async`,`react-fast-compare`,`invariant`],exclude:[`boltdocs`,`boltdocs/client`]},resolve:{alias:[{find:`react-router-dom`,replacement:G(`react-router-dom`)},{find:`react-helmet-async`,replacement:G(`react-helmet-async`)},{find:`@bdocs/ssg`,replacement:G(`@bdocs/ssg`)}],dedupe:[`react`,`react-dom`,...n?[]:[`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`]]},ssr:{external:[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`,`react-fast-compare`,`invariant`,...Ze()],optimizeDeps:{include:[`react-fast-compare`,`invariant`]},noExternal:[]}}},configResolved(e){o=e,l?.runHook(`configResolved`,a)},resolveId(e,t,n){let r=[`react`,`react-dom`,`react-router-dom`,`react-helmet-async`,`@bdocs/ssg`].find(t=>e===t||e.startsWith(t+`/`)||e.includes(`/node_modules/${t}/`)||t.startsWith(`@`)&&e.includes(`/node_modules/${t.replace(`/`,_.sep)}/`));if(r&&n?.ssr){let t=e;if(!_.isAbsolute(e)){let n=W;try{let e=_.join(process.cwd(),`node_modules/boltdocs/package.json`);if(S.existsSync(e)){let t=S.realpathSync(e);n=p.createRequire(t)}else n=p.createRequire(_.join(process.cwd(),`package.json`))}catch{}try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?G(e,n):n.resolve(e)}catch{try{t=r===`@bdocs/ssg`||r===`react-router-dom`||r===`react-helmet-async`?G(e,W):W.resolve(e)}catch{}}}try{t=S.realpathSync(t)}catch{}return{id:t,external:!0}}return null},transformIndexHtml:{order:`pre`,handler(e){return Ne(e,a)}},async buildEnd(){let{pool:e}=await import(`./worker-pool-CGn7DrLb.mjs`);await e.terminate()},async closeBundle(){!c||o?.build?.ssr||(await l?.runHook(`afterBuild`),await l?.runHook(`buildEnd`))},configurePreviewServer(e){let t=o?.build?.outDir?_.resolve(o.root||process.cwd(),o.build.outDir):_.resolve(process.cwd(),`dist`);e.middlewares.use((e,n,r)=>{let i=e.url||`/`,a=i.split(`?`)[0].split(`#`)[0];if(_.extname(a))return r();let o=a.replace(/\/$/,``)||`/`,s=_.join(t,o,`index.html`);o!==`/`&&S.existsSync(s)&&(e.url=`${o}/index.html${i.includes(`?`)?`?${i.split(`?`)[1]}`:``}`),r()})}},Ve(t,d,()=>o,r),Je(r,i,d,e=>{a=e},()=>l),{...ie({includePublic:!0,png:{quality:80},jpeg:{quality:80},jpg:{quality:80},webp:{quality:80},avif:{quality:80},svg:{multipass:!0,plugins:[{name:`preset-default`}]}}),apply:`build`},...u]}const K=new i(`mdx`),$e=[pe.default||pe,me.default||me,T.default||T,E.default||E,D.default||D,O.default||O,he.default||he],et=[ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe];let q=null,J=null;const tt=()=>(q??=de(),q),nt=async e=>J||(J=fe({themes:$e,langs:et,engine:tt()}),J),Y={JSX_FLOW_ELEMENT:`mdxJsxFlowElement`,JSX_TEXT_ELEMENT:`mdxJsxTextElement`,JSX_ATTRIBUTE:`mdxJsxAttribute`,ELEMENT:`element`,TEXT:`text`,CODE:`code`},rt={PRE:`pre`,CODE:`code`},X={TITLE:`data-title`,LANG:`data-lang`,HIGHLIGHTED:`data-highlighted`,HIGHLIGHTED_HTML:`data-highlighted-html`},Z={LINE_NUMBERS:`shiki-line-numbers`,WORD_WRAP:`shiki-word-wrap`,FALLBACK:`shiki-fallback`},it={LIGHT:`github-light`,DARK:`github-dark`},Q={LANG:`plaintext`,MDX_DEFAULT_LANG:`text`},at=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:line-numbers`,pre(e){let n=this.options.meta?.lineNumbers===!0;(t||n)&&this.addClassToHast(e,Z.LINE_NUMBERS)}}},ot=(e={})=>{let{activateByDefault:t=!1}=e;return{name:`boltdocs:word-wrap`,pre(e){let n=this.options.meta?.wordWrap===!0;(t||n)&&this.addClassToHast(e,Z.WORD_WRAP)}}},st=()=>({name:`AddTitleProperty`,pre(e){let t=this.options.meta?.title;t&&(e.properties[X.TITLE]=t)}}),ct=()=>({name:`AddLanguageProperty`,pre(e){e.properties[X.LANG]=this.options.lang||Q.LANG}});function lt(e){let t={};if(!e)return t;/lineNumbers|showLineNumbers/.test(e)&&(t.lineNumbers=!0),/wordWrap|word-wrap/.test(e)&&(t.wordWrap=!0);let n=e.match(/title=(["'])(.*?)\1/);return n&&(t.title=n[2]),t}var ut=class{config;constructor(e){this.config=e}getTheme(){return this.config?.theme?.codeTheme||{light:it.LIGHT,dark:it.DARK}}async getHighlighter(){return await nt(this.getTheme())}getOptions(e,t){let n=this.getTheme(),r={},i=``;typeof t==`string`?(i=t,r=lt(t)):t&&(r=t,i=t.__raw||``);let a={lang:e||Q.LANG,meta:{__raw:i,...r},transformers:[at(),ot(),st(),ct()]};return typeof n==`object`?a.themes={light:n.light,dark:n.dark}:a.theme=n,a}async render(e,t,n){try{let r=await this.getHighlighter(),i=this.getOptions(t,n);return r.codeToHtml(e,i)}catch(t){return console.error(`[ShikiAdapter] Failed to render code:`,t),`<pre class="${Z.FALLBACK}"><code>${dt(e)}</code></pre>`}}};function dt(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}let $=null,ft;function pt(e){let t=JSON.stringify(e?.theme?.codeTheme||null);return($===null||ft!==t)&&($=new ut(e),ft=t),$}function mt(e){let t=pt(e);return async e=>{let n=await t.getHighlighter();w(e,Y.ELEMENT,e=>{if(e.tagName===rt.PRE&&e.children?.[0]?.type===Y.ELEMENT&&e.children[0].tagName===rt.CODE){let r=e.children[0],i=(r.properties?.className||[]).find(e=>e.startsWith(`language-`)),a=i?i.slice(9):Q.MDX_DEFAULT_LANG;if(a===`mermaid`)return;let o=r.children?.[0]?.value||``,s=lt(r.properties?.metastring||r.data?.meta||``),c=t.getOptions(a,s),l=``;try{l=n.codeToHtml(o,c)}catch(e){console.error(`[rehypeShiki] Failed to highlight code block:`,e),l=`<pre class="${Z.FALLBACK}"><code>${dt(o)}</code></pre>`}e.properties=e.properties||{},s.title&&(e.properties[X.TITLE]=s.title),e.properties[X.HIGHLIGHTED]=`true`,e.properties[X.HIGHLIGHTED_HTML]=l,e.properties[X.LANG]=a,e.children=[]}})}}function ht(){return e=>{w(e,Y.CODE,e=>{e.meta&&(e.data=e.data||{},e.data.hProperties=e.data.hProperties||{},e.data.hProperties.metastring=e.meta)})}}let gt=!1;function _t(e,t=se){let n=e?.plugins?.flatMap(e=>F.getSanitizedCapabilities(e).remarkPlugins||[])||[],r=e?.plugins?.flatMap(e=>F.getSanitizedCapabilities(e).rehypePlugins||[])||[],i=t({remarkPlugins:[ce,le,ht,...n],rehypePlugins:[ue,[mt,e],...r],jsxRuntime:`automatic`});return{...i,name:`vite-plugin-boltdocs-mdx`,async buildStart(){gt||=(await K.load(),!0),i.buildStart&&await i.buildStart.call(this)},async transform(e,t,n){let[r]=t.split(`?`);if(!r.endsWith(`.md`)&&!r.endsWith(`.mdx`))return i.transform?.call(this,e,t,n);let a=`${r}:${re.createHash(`md5`).update(e).digest(`hex`)}:${process.env.NODE_ENV===`production`?`prod`:`dev`}:v3`,o=await K.getAsync(a);if(o)return{code:o,map:null};let s=await i.transform.call(this,e,r,n);return s&&typeof s==`object`&&s.code&&(process.env.NODE_ENV!==`production`&&(s.code+=`
|
|
108
108
|
if (import.meta.hot) {
|
|
109
109
|
import.meta.hot.accept();
|
|
110
110
|
}
|
|
@@ -3,4 +3,4 @@
|
|
|
3
3
|
* Copyright (c) 2026 Jesus Alcala
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
var e=`2.7.
|
|
6
|
+
var e=`2.7.11`;Object.defineProperty(exports,`version`,{enumerable:!0,get:function(){return e}});
|
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
+
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
import { A as CornerDownLeft, H as Moon, J as X, K as Sun, N as FileText, P as Hash, U as MoreVertical, _ as Link, h as XSocial, j as ExternalLink, o as Discord, s as Github, t as Bluesky, y as cn } from "./icons-dev-Df8OQ481.js";
|
|
7
|
+
import { useEffect, useState } from "react";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import * as RAC from "react-aria-components";
|
|
10
|
+
import { Button, Dialog, Modal, ModalOverlay, Separator, ToggleButton } from "react-aria-components";
|
|
11
|
+
|
|
12
|
+
//#region src/client/components/primitives/navbar.tsx
|
|
13
|
+
const Navbar = ({ children, className, ...props }) => {
|
|
14
|
+
return /* @__PURE__ */ jsx("header", {
|
|
15
|
+
className: cn("boltdocs-navbar sticky top-0 z-50 w-full", className),
|
|
16
|
+
...props,
|
|
17
|
+
children
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const NavbarContent = ({ children, className }) => {
|
|
21
|
+
return /* @__PURE__ */ jsx("div", {
|
|
22
|
+
className: cn("mx-auto flex lg:h-navbar max-w-(--breakpoint-3xl) items-center justify-between px-4 md:px-6", className),
|
|
23
|
+
children
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
const NavbarLeft = ({ children, className }) => {
|
|
27
|
+
return /* @__PURE__ */ jsx("div", {
|
|
28
|
+
className: cn("flex flex-1 items-center justify-start gap-4 min-w-0", className),
|
|
29
|
+
children
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const NavbarRight = ({ children, className }) => {
|
|
33
|
+
return /* @__PURE__ */ jsx("div", {
|
|
34
|
+
className: cn("flex flex-1 items-center justify-end gap-2 md:gap-4 min-w-0", className),
|
|
35
|
+
children
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const NavbarCenter = ({ children, className }) => {
|
|
39
|
+
return /* @__PURE__ */ jsx("div", {
|
|
40
|
+
className: cn("hidden lg:flex flex-1 justify-center items-center gap-4 px-4 min-w-0 w-full", className),
|
|
41
|
+
children
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
const NavbarLogo = ({ src, alt, width = 24, height = 24, className, href = "/" }) => {
|
|
45
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
46
|
+
href,
|
|
47
|
+
className: cn("flex items-center gap-2 shrink-0 outline-none", className),
|
|
48
|
+
children: src ? /* @__PURE__ */ jsx("img", {
|
|
49
|
+
src,
|
|
50
|
+
alt,
|
|
51
|
+
width,
|
|
52
|
+
height,
|
|
53
|
+
className: "h-6 w-6 object-contain"
|
|
54
|
+
}) : null
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const NavbarTitle = ({ children, className, href = "/" }) => {
|
|
58
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
59
|
+
href,
|
|
60
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
61
|
+
className: cn("text-lg font-bold tracking-tight hidden sm:inline-block", className),
|
|
62
|
+
children
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
const NavbarLinks = ({ children, className }) => {
|
|
67
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
68
|
+
className: cn("hidden md:flex items-center gap-6 text-sm font-medium", className),
|
|
69
|
+
children
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const NavbarLink = ({ label, href, to, className }) => {
|
|
73
|
+
return /* @__PURE__ */ jsxs(Link, {
|
|
74
|
+
href,
|
|
75
|
+
target: to === "external" ? "_blank" : void 0,
|
|
76
|
+
className: cn("transition-all outline-none", className),
|
|
77
|
+
children: [label, to === "external" && /* @__PURE__ */ jsx("span", {
|
|
78
|
+
className: "ml-1 inline-block",
|
|
79
|
+
children: /* @__PURE__ */ jsx(ExternalLink, { size: 12 })
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
const NavbarDropdown = ({ label, className, children }) => {
|
|
84
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
85
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
86
|
+
className: cn("relative", className),
|
|
87
|
+
onMouseEnter: () => {
|
|
88
|
+
setIsOpen(true);
|
|
89
|
+
},
|
|
90
|
+
onMouseLeave: () => {
|
|
91
|
+
setIsOpen(false);
|
|
92
|
+
},
|
|
93
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
94
|
+
className: cn("flex items-center gap-1 outline-none cursor-pointer select-none font-medium text-muted hover:text-body transition-colors"),
|
|
95
|
+
children: [label, /* @__PURE__ */ jsx("svg", {
|
|
96
|
+
className: cn("w-4 h-4 transition-transform", isOpen && "rotate-180"),
|
|
97
|
+
fill: "none",
|
|
98
|
+
viewBox: "0 0 24 24",
|
|
99
|
+
stroke: "currentColor",
|
|
100
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
101
|
+
strokeLinecap: "round",
|
|
102
|
+
strokeLinejoin: "round",
|
|
103
|
+
strokeWidth: 2,
|
|
104
|
+
d: "M19 9l-7 7-7-7"
|
|
105
|
+
})
|
|
106
|
+
})]
|
|
107
|
+
}), isOpen && /* @__PURE__ */ jsx("div", {
|
|
108
|
+
className: "absolute top-full left-0 pt-1 z-[9999]",
|
|
109
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
110
|
+
className: "min-w-[180px] p-1 bg-surface border border-subtle rounded-md shadow-lg",
|
|
111
|
+
children
|
|
112
|
+
})
|
|
113
|
+
})]
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
const NavbarDropdownItem = ({ href, label, className }) => {
|
|
117
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
118
|
+
href,
|
|
119
|
+
className: cn("block px-2 py-1.5 rounded hover:bg-surface", className),
|
|
120
|
+
children: label
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
const NavbarSearchTriggerDesktop = ({ className, onPress, children }) => {
|
|
124
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
125
|
+
onPress,
|
|
126
|
+
className: cn("hidden lg:flex items-center justify-between gap-2 px-3 py-2 text-sm outline-none cursor-pointer w-full max-w-[720px]", className),
|
|
127
|
+
children
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
const NavbarSearchTriggerMobile = ({ className, onPress, children }) => {
|
|
131
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
132
|
+
onPress,
|
|
133
|
+
className: cn("lg:hidden flex h-10 w-10 items-center justify-center outline-none cursor-pointer", className),
|
|
134
|
+
"aria-label": "Search",
|
|
135
|
+
children
|
|
136
|
+
});
|
|
137
|
+
};
|
|
138
|
+
const NavbarSearchTriggerKbd = ({ className }) => {
|
|
139
|
+
const [mounted, setMounted] = useState(false);
|
|
140
|
+
const isMac = mounted && /Mac|iPod|iPhone|iPad/.test(navigator.platform);
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
setMounted(true);
|
|
143
|
+
}, []);
|
|
144
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
145
|
+
className: cn("hidden sm:flex items-center gap-1 pointer-events-none select-none", className),
|
|
146
|
+
children: [/* @__PURE__ */ jsx("kbd", {
|
|
147
|
+
className: "flex items-center justify-center font-mono text-[10px]",
|
|
148
|
+
children: isMac ? "⌘" : "Ctrl"
|
|
149
|
+
}), /* @__PURE__ */ jsx("kbd", {
|
|
150
|
+
className: "flex items-center justify-center font-mono text-[10px]",
|
|
151
|
+
children: "K"
|
|
152
|
+
})]
|
|
153
|
+
});
|
|
154
|
+
};
|
|
155
|
+
const NavbarSearchTrigger = {
|
|
156
|
+
Desktop: NavbarSearchTriggerDesktop,
|
|
157
|
+
Mobile: NavbarSearchTriggerMobile,
|
|
158
|
+
Kbd: NavbarSearchTriggerKbd
|
|
159
|
+
};
|
|
160
|
+
const NavbarTheme = ({ className, theme, onThemeChange }) => {
|
|
161
|
+
return /* @__PURE__ */ jsx(ToggleButton, {
|
|
162
|
+
isSelected: theme === "dark",
|
|
163
|
+
onChange: onThemeChange,
|
|
164
|
+
className: cn("outline-none cursor-pointer", className),
|
|
165
|
+
"aria-label": "Toggle theme",
|
|
166
|
+
children: theme === "dark" ? /* @__PURE__ */ jsx(Sun, { size: 20 }) : /* @__PURE__ */ jsx(Moon, { size: 20 })
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
const Icon = ({ name }) => {
|
|
170
|
+
if (name === "github") return /* @__PURE__ */ jsx(Github, {});
|
|
171
|
+
if (name === "discord") return /* @__PURE__ */ jsx(Discord, {});
|
|
172
|
+
if (name === "x") return /* @__PURE__ */ jsx(XSocial, {});
|
|
173
|
+
if (name === "bluesky") return /* @__PURE__ */ jsx(Bluesky, {});
|
|
174
|
+
};
|
|
175
|
+
const NavbarSocials = ({ icon, link, className }) => {
|
|
176
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
177
|
+
href: link,
|
|
178
|
+
target: "_blank",
|
|
179
|
+
rel: "noopener noreferrer",
|
|
180
|
+
className: cn("outline-none", className),
|
|
181
|
+
children: /* @__PURE__ */ jsx(Icon, { name: icon })
|
|
182
|
+
});
|
|
183
|
+
};
|
|
184
|
+
const NavbarSplit = ({ className }) => {
|
|
185
|
+
return /* @__PURE__ */ jsx(Separator, {
|
|
186
|
+
orientation: "vertical",
|
|
187
|
+
className: cn("h-full w-px", className)
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
const NavbarMore = ({ onPress, className }) => {
|
|
191
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
192
|
+
onPress,
|
|
193
|
+
className: cn("md:hidden flex items-center justify-center outline-none cursor-pointer", className),
|
|
194
|
+
"aria-label": "More navigation",
|
|
195
|
+
children: /* @__PURE__ */ jsx(MoreVertical, { size: 20 })
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
const NavbarMobileMenu = ({ isOpen, onClose, children, className }) => {
|
|
199
|
+
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
200
|
+
isOpen,
|
|
201
|
+
onOpenChange: (open) => !open && onClose(),
|
|
202
|
+
isDismissable: true,
|
|
203
|
+
className: cn("fixed inset-0 z-60 md:hidden transition-all duration-100", className),
|
|
204
|
+
children: /* @__PURE__ */ jsx(Modal, {
|
|
205
|
+
className: "fixed inset-0 outline-none",
|
|
206
|
+
children: /* @__PURE__ */ jsxs(Dialog, {
|
|
207
|
+
className: "relative h-full outline-none flex flex-col p-6 pt-[calc(1.5rem+env(safe-area-inset-top,0px))] pb-[calc(1.5rem+env(safe-area-inset-bottom,0px))] px-[calc(1.5rem+env(safe-area-inset-left,0px))]",
|
|
208
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
209
|
+
className: "flex items-center justify-between mb-6",
|
|
210
|
+
children: [/* @__PURE__ */ jsx("span", {}), /* @__PURE__ */ jsx(Button, {
|
|
211
|
+
onPress: onClose,
|
|
212
|
+
className: "flex items-center justify-center outline-none cursor-pointer text-muted hover:text-body transition-colors",
|
|
213
|
+
"aria-label": "Close menu",
|
|
214
|
+
children: /* @__PURE__ */ jsx(X, { size: 24 })
|
|
215
|
+
})]
|
|
216
|
+
}), /* @__PURE__ */ jsx("nav", {
|
|
217
|
+
className: "flex-1 overflow-y-auto flex flex-col gap-4",
|
|
218
|
+
children
|
|
219
|
+
})]
|
|
220
|
+
})
|
|
221
|
+
})
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
const NavbarMobileLink = ({ label, href, to, onPress, className }) => {
|
|
225
|
+
return /* @__PURE__ */ jsx(Link, {
|
|
226
|
+
href,
|
|
227
|
+
target: to === "external" ? "_blank" : void 0,
|
|
228
|
+
onClick: onPress,
|
|
229
|
+
className: cn("group flex items-center outline-none", className),
|
|
230
|
+
children: label
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
Navbar.Root = Navbar;
|
|
234
|
+
Navbar.Left = NavbarLeft;
|
|
235
|
+
Navbar.Right = NavbarRight;
|
|
236
|
+
Navbar.Center = NavbarCenter;
|
|
237
|
+
Navbar.Logo = NavbarLogo;
|
|
238
|
+
Navbar.Title = NavbarTitle;
|
|
239
|
+
Navbar.Links = NavbarLinks;
|
|
240
|
+
Navbar.Link = NavbarLink;
|
|
241
|
+
Navbar.Dropdown = NavbarDropdown;
|
|
242
|
+
Navbar.DropdownItem = NavbarDropdownItem;
|
|
243
|
+
Navbar.SearchTrigger = NavbarSearchTrigger;
|
|
244
|
+
Navbar.Theme = NavbarTheme;
|
|
245
|
+
Navbar.Socials = NavbarSocials;
|
|
246
|
+
Navbar.Split = NavbarSplit;
|
|
247
|
+
Navbar.Content = NavbarContent;
|
|
248
|
+
Navbar.More = NavbarMore;
|
|
249
|
+
Navbar.MobileMenu = NavbarMobileMenu;
|
|
250
|
+
Navbar.MobileLink = NavbarMobileLink;
|
|
251
|
+
|
|
252
|
+
//#endregion
|
|
253
|
+
//#region src/client/components/primitives/search-dialog.tsx
|
|
254
|
+
/**
|
|
255
|
+
* Pure, unstyled SearchDialog Overlay (maps to RAC.ModalOverlay)
|
|
256
|
+
*/
|
|
257
|
+
const SearchDialog = ({ className, ...props }) => {
|
|
258
|
+
return /* @__PURE__ */ jsx(RAC.ModalOverlay, {
|
|
259
|
+
className: cn("fixed inset-0 z-100", className),
|
|
260
|
+
...props
|
|
261
|
+
});
|
|
262
|
+
};
|
|
263
|
+
/**
|
|
264
|
+
* Pure, unstyled SearchDialog Content (maps to RAC.Modal)
|
|
265
|
+
*/
|
|
266
|
+
const SearchDialogContent = ({ className, ...props }) => /* @__PURE__ */ jsx(RAC.Modal, {
|
|
267
|
+
className: cn(className),
|
|
268
|
+
...props
|
|
269
|
+
});
|
|
270
|
+
/**
|
|
271
|
+
* Pure, unstyled SearchDialog Dialog (maps to RAC.Dialog)
|
|
272
|
+
*/
|
|
273
|
+
const SearchDialogDialog = ({ className, ...props }) => /* @__PURE__ */ jsx(RAC.Dialog, {
|
|
274
|
+
className: cn("flex flex-col focus:outline-none", className),
|
|
275
|
+
...props
|
|
276
|
+
});
|
|
277
|
+
/**
|
|
278
|
+
* Pure, unstyled SearchDialog Input Field (maps to RAC.SearchField)
|
|
279
|
+
*/
|
|
280
|
+
const SearchDialogField = ({ className, ...props }) => /* @__PURE__ */ jsx(RAC.SearchField, {
|
|
281
|
+
className: cn("flex items-center", className),
|
|
282
|
+
...props
|
|
283
|
+
});
|
|
284
|
+
/**
|
|
285
|
+
* Pure, unstyled SearchInput (maps to RAC.Input)
|
|
286
|
+
*/
|
|
287
|
+
const SearchDialogSearchInput = ({ className, ...props }) => /* @__PURE__ */ jsx(RAC.Input, {
|
|
288
|
+
className: cn("w-full bg-transparent outline-none border-none", className),
|
|
289
|
+
...props
|
|
290
|
+
});
|
|
291
|
+
/**
|
|
292
|
+
* Pure, unstyled Clear Button (maps to RAC.Button with slot="clear")
|
|
293
|
+
*/
|
|
294
|
+
const SearchDialogClearButton = ({ className, ...props }) => /* @__PURE__ */ jsx(RAC.Button, {
|
|
295
|
+
slot: "clear",
|
|
296
|
+
className: cn(className),
|
|
297
|
+
...props
|
|
298
|
+
});
|
|
299
|
+
/**
|
|
300
|
+
* Pure, unstyled Autocomplete container (maps to RAC.Autocomplete)
|
|
301
|
+
*/
|
|
302
|
+
const SearchDialogAutocomplete = ({ children, className, onSelectionChange, ...props }) => {
|
|
303
|
+
const Autocomplete = RAC.Autocomplete;
|
|
304
|
+
return /* @__PURE__ */ jsx("div", {
|
|
305
|
+
className: cn("flex-1 min-h-0", className),
|
|
306
|
+
children: /* @__PURE__ */ jsx(Autocomplete, {
|
|
307
|
+
...props,
|
|
308
|
+
onSelectionChange,
|
|
309
|
+
className: "flex flex-col min-h-0",
|
|
310
|
+
children
|
|
311
|
+
})
|
|
312
|
+
});
|
|
313
|
+
};
|
|
314
|
+
/**
|
|
315
|
+
* Pure, unstyled List Box (maps to RAC.ListBox)
|
|
316
|
+
*/
|
|
317
|
+
const SearchDialogList = ({ children, className, ...props }) => {
|
|
318
|
+
return /* @__PURE__ */ jsx(RAC.ListBox, {
|
|
319
|
+
...props,
|
|
320
|
+
className: cn("flex-1 overflow-y-auto outline-none min-h-0", className),
|
|
321
|
+
children
|
|
322
|
+
});
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* Pure, unstyled List Box Item (maps to RAC.ListBoxItem)
|
|
326
|
+
*/
|
|
327
|
+
const SearchDialogItemRoot = ({ children, className, ...props }) => {
|
|
328
|
+
return /* @__PURE__ */ jsx(RAC.ListBoxItem, {
|
|
329
|
+
...props,
|
|
330
|
+
className: cn("group flex items-center outline-none cursor-pointer", className),
|
|
331
|
+
children: (itemProps) => /* @__PURE__ */ jsxs(Fragment, { children: [children, (itemProps.isFocused || itemProps.isSelected) && /* @__PURE__ */ jsxs("div", {
|
|
332
|
+
className: "ml-auto opacity-50 flex items-center gap-1",
|
|
333
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
334
|
+
className: "text-[10px]",
|
|
335
|
+
children: "Select"
|
|
336
|
+
}), /* @__PURE__ */ jsx(CornerDownLeft, { size: 10 })]
|
|
337
|
+
})] })
|
|
338
|
+
});
|
|
339
|
+
};
|
|
340
|
+
const SearchDialogItemIcon = ({ isHeading, className }) => {
|
|
341
|
+
return /* @__PURE__ */ jsx("div", {
|
|
342
|
+
className: cn("shrink-0", className),
|
|
343
|
+
children: isHeading ? /* @__PURE__ */ jsx(Hash, { size: 18 }) : /* @__PURE__ */ jsx(FileText, { size: 18 })
|
|
344
|
+
});
|
|
345
|
+
};
|
|
346
|
+
const SearchDialogItemTitle = ({ children, className }) => {
|
|
347
|
+
return /* @__PURE__ */ jsx("span", {
|
|
348
|
+
className: cn("block truncate flex-1", className),
|
|
349
|
+
children
|
|
350
|
+
});
|
|
351
|
+
};
|
|
352
|
+
const SearchDialogItemBio = ({ children, className }) => {
|
|
353
|
+
return /* @__PURE__ */ jsx("span", {
|
|
354
|
+
className: cn("ml-2 truncate hidden sm:inline", className),
|
|
355
|
+
children
|
|
356
|
+
});
|
|
357
|
+
};
|
|
358
|
+
SearchDialog.Root = SearchDialog;
|
|
359
|
+
SearchDialog.Overlay = SearchDialog;
|
|
360
|
+
SearchDialog.Content = SearchDialogContent;
|
|
361
|
+
SearchDialog.Dialog = SearchDialogDialog;
|
|
362
|
+
SearchDialog.Autocomplete = SearchDialogAutocomplete;
|
|
363
|
+
SearchDialog.List = SearchDialogList;
|
|
364
|
+
SearchDialog.Input = Object.assign(SearchDialogField, {
|
|
365
|
+
SearchInput: SearchDialogSearchInput,
|
|
366
|
+
Button: SearchDialogClearButton
|
|
367
|
+
});
|
|
368
|
+
SearchDialog.Item = Object.assign(SearchDialogItemRoot, {
|
|
369
|
+
Icon: SearchDialogItemIcon,
|
|
370
|
+
Title: SearchDialogItemTitle,
|
|
371
|
+
Bio: SearchDialogItemBio
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
//#endregion
|
|
375
|
+
export { Navbar as n, SearchDialog as t };
|