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
package/dist/mdx-r4cDQxWu.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
-
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
const e=require(`./icons-dev-BlV3wWFT.cjs`),t=require(`./image-BHhTvQzr.cjs`);let n=require(`react`),r=require(`react/jsx-runtime`),i=require(`react-aria-components`);const a={note:{container:`bg-slate-500/5 dark:bg-slate-500/10 border-slate-500/40 text-slate-800 dark:text-slate-200`,titleText:`text-slate-900 dark:text-slate-100`,iconColor:`text-slate-500`,icon:e.I,defaultTitle:`Note`},info:{container:`bg-indigo-500/5 dark:bg-indigo-500/10 border-indigo-500/40 text-indigo-800 dark:text-indigo-200`,titleText:`text-indigo-900 dark:text-indigo-100`,iconColor:`text-indigo-500`,icon:e.I,defaultTitle:`Info`},tip:{container:`bg-green-500/5 dark:bg-green-500/10 border-green-500/40 text-green-800 dark:text-green-200`,titleText:`text-green-900 dark:text-green-100`,iconColor:`text-green-500`,icon:e.R,defaultTitle:`Tip`},warning:{container:`bg-amber-500/5 dark:bg-amber-500/10 border-amber-500/40 text-amber-800 dark:text-amber-200`,titleText:`text-amber-900 dark:text-amber-100`,iconColor:`text-amber-500`,icon:e.S,defaultTitle:`Warning`},danger:{container:`bg-rose-500/5 dark:bg-rose-500/10 border-rose-500/40 text-rose-800 dark:text-rose-200`,titleText:`text-rose-900 dark:text-rose-100`,iconColor:`text-rose-500`,icon:e.x,defaultTitle:`Danger`}};function o({children:t,className:n=``,variant:i=`note`,title:o,...s}){let c=a[i]||a.note,l=c.icon;return(0,r.jsxs)(`div`,{className:e.y(`my-6 flex gap-4 p-4 rounded-xl border-2`,c.container,n),...s,children:[(0,r.jsx)(`div`,{className:e.y(`shrink-0 pt-0.5`,c.iconColor),children:(0,r.jsx)(l,{className:`w-5 h-5 stroke-[2]`})}),(0,r.jsxs)(`div`,{className:`flex-1 text-[0.875rem] leading-[1.6]`,children:[(0,r.jsx)(`div`,{className:e.y(`font-bold text-sm mb-1`,c.titleText),children:o||c.defaultTitle}),(0,r.jsx)(`div`,{className:`prose prose-neutral dark:prose-invert max-w-none [&>p]:m-0 [&>p+p]:mt-2`,children:t})]})]})}const s=({children:e,name:t,type:n,description:i,required:a})=>(0,r.jsxs)(`div`,{className:`my-4 border border-subtle bg-surface/50 p-4 rounded-xl flex flex-col gap-1 text-sm select-none`,children:[(0,r.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,r.jsx)(`span`,{className:`font-mono font-bold text-primary-500`,children:t}),n&&(0,r.jsx)(`span`,{className:`text-xs text-muted font-mono bg-soft px-1.5 py-0.5 rounded-md`,children:n}),a&&(0,r.jsx)(`span`,{className:`text-xs text-rose-500 font-semibold`,children:`required`})]}),i&&(0,r.jsx)(`div`,{className:`text-muted text-xs mt-1`,children:i}),e&&(0,r.jsx)(`div`,{className:`mt-2`,children:e})]}),c=({href:t,children:n,className:i,...a})=>(0,r.jsx)(e._,{href:t||``,className:e.y(`text-primary-500 hover:text-primary-400 dark:text-primary-500 hover:underline font-medium transition-colors duration-200`,i),...a,children:n}),l={1:`text-3xl sm:text-[2.5rem] font-extrabold tracking-tight text-body mb-4 leading-tight`,2:`text-2xl sm:text-[1.75rem] font-bold tracking-tight text-body mt-14 mb-5 pb-2 border-b border-subtle scroll-mt-24`,3:`text-lg sm:text-[1.4rem] font-semibold tracking-tight text-body mt-10 mb-4 scroll-mt-24`,4:`text-base sm:text-[1.1rem] font-semibold tracking-tight text-body mt-8 mb-3 scroll-mt-24`,5:`text-sm sm:text-[0.9rem] font-semibold tracking-tight text-body mt-6 mb-2 scroll-mt-24`,6:`text-xs sm:text-[0.75rem] font-semibold tracking-tight text-body mt-6 mb-2 scroll-mt-24`},u=({level:n,className:i,...a})=>(0,r.jsx)(t.s,{level:n,className:e.y(l[n]||``,i),...a}),d={a:c,h1:e=>(0,r.jsx)(u,{level:1,...e}),h2:e=>(0,r.jsx)(u,{level:2,...e}),h3:e=>(0,r.jsx)(u,{level:3,...e}),h4:e=>(0,r.jsx)(u,{level:4,...e}),h5:e=>(0,r.jsx)(u,{level:5,...e}),h6:e=>(0,r.jsx)(u,{level:6,...e}),p:({className:t,...n})=>(0,r.jsx)(`p`,{className:e.y(`text-paragraph leading-relaxed my-5`,t),...n}),strong:({className:t,...n})=>(0,r.jsx)(`strong`,{className:e.y(`font-semibold text-body`,t),...n}),mark:({className:t,...n})=>(0,r.jsx)(`mark`,{className:e.y(`bg-primary-500/10 text-primary-500 font-semibold px-1.5 py-0.5 rounded-md`,t),...n}),blockquote:({className:t,...n})=>(0,r.jsx)(`blockquote`,{className:e.y(`border-l-4 border-primary-500 bg-soft/30 pl-4 py-2 my-6 italic text-muted rounded-r-lg`,t),...n}),hr:({className:t,...n})=>(0,r.jsx)(`hr`,{className:e.y(`my-8 border-t border-subtle`,t),...n}),ul:({className:t,...n})=>(0,r.jsx)(`ul`,{className:e.y(`list-disc pl-6 my-5 space-y-2 text-paragraph`,t),...n}),ol:({className:t,...n})=>(0,r.jsx)(`ol`,{className:e.y(`list-decimal pl-6 my-5 space-y-2 text-paragraph`,t),...n}),li:({className:t,...n})=>(0,r.jsx)(`li`,{className:e.y(`pl-1`,t),...n})},f={table:e=>(0,r.jsx)(`div`,{className:`my-6 w-full overflow-x-auto rounded-xl border border-subtle bg-surface/30`,children:(0,r.jsx)(`table`,{className:`w-full border-collapse text-left text-sm`,...e})}),thead:t=>(0,r.jsx)(`thead`,{className:e.y(`border-b border-subtle bg-soft/50`,t.className),...t}),tbody:e=>(0,r.jsx)(`tbody`,{...e}),tr:t=>(0,r.jsx)(`tr`,{className:e.y(`border-b border-subtle last:border-0 even:bg-soft/10 hover:bg-soft/20 transition-colors`,t.className),...t}),th:t=>(0,r.jsx)(`th`,{className:e.y(`px-4 py-3 font-semibold text-body text-xs font-mono`,t.className),...t}),td:t=>(0,r.jsx)(`td`,{className:e.y(`px-4 py-3 text-paragraph leading-relaxed`,t.className),...t})},p=(e,t)=>{if(e==null||typeof e==`boolean`)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(e=>p(e,t)).join(``);if((0,n.isValidElement)(e)){let n=t?.get(e.type);return n?n(e.props):p(e.props.children,t)}return``},m=async e=>{try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);return t.value=e,t.style.position=`fixed`,t.style.opacity=`0`,document.body.appendChild(t),t.select(),document.execCommand(`copy`),document.body.removeChild(t),!0}};function h(e){let[t,r]=(0,n.useState)(!1),[i,a]=(0,n.useState)(!1),[o,s]=(0,n.useState)(!1),c=(0,n.useRef)(null),l=(0,n.useCallback)(async()=>{m(c.current?.textContent??``),r(!0),setTimeout(()=>r(!1),2e3)},[]);return(0,n.useEffect)(()=>{let e=(c.current?.textContent??``).trim().split(`
|
|
7
|
-
`).length;s(e>6)},[e.children,e.highlightedHtml]),{copied:t,isExpanded:i,setIsExpanded:a,isExpandable:o,preRef:c,handleCopy:l,shouldTruncate:o&&!i}}const g={ts:e.m,tsx:e.d,js:e.c,jsx:e.d,json:e.l,css:e.i,html:e.n,md:e.u,mdx:e.u,bash:e.p,sh:e.p,yaml:e.g,yml:e.g,rs:e.f,rust:e.f,toml:e.r,csv:e.a},_=({copied:n,handleCopy:a})=>(0,r.jsx)(t.n,{content:n?`Copied!`:`Copy code`,children:(0,r.jsx)(i.Button,{onPress:a,className:e.y(`grid place-items-center size-8 bg-transparent outline-none cursor-pointer transition-all duration-200 hover:scale-110 active:scale-95 [&>svg]:size-4 [&>svg]:stroke-2 z-10`,n?`text-emerald-400`:`text-muted hover:text-body`),"aria-label":`Copy code`,children:n?(0,r.jsx)(e.w,{size:20}):(0,r.jsx)(e.k,{size:20})})});function v(n){let{children:a,hideCopy:o=!1,highlightedHtml:s,"data-highlighted-html":c,title:l,"data-title":u,"data-lang":d,plain:f=!1,...m}=n,v=s||c,y=typeof v==`string`?v.replace(/<span class="line">\s*(?:<span[^>]*>\s*<\/span>)?\s*<\/span>\s*(<\/code>\s*<\/pre>)/g,`$1`):v,b=l||u,x=n.lang||d||``,{copied:S,isExpanded:C,setIsExpanded:w,isExpandable:T,preRef:E,handleCopy:D,shouldTruncate:O}=h(n),k=g[x];return(0,r.jsxs)(t.r,{plain:f,className:n.className,children:[(b||!o)&&(0,r.jsxs)(t.o,{className:e.y({"absolute top-2 left-0 w-full":!b}),children:[(0,r.jsx)(t.a,{children:b&&(0,r.jsxs)(r.Fragment,{children:[k?(0,r.jsx)(k,{size:14}):(0,r.jsx)(e.M,{size:14,className:`opacity-60`}),(0,r.jsx)(`span`,{children:b})]})}),(0,r.jsx)(`div`,{className:`flex items-center gap-1`,children:!o&&(0,r.jsx)(_,{copied:S,handleCopy:D})})]}),(0,r.jsxs)(t.i,{shouldTruncate:O,children:[y?(0,r.jsx)(`div`,{ref:E,className:`shiki-wrapper overflow-x-auto [&>pre]:m-0! [&>pre]:rounded-none! [&>pre]:border-none! [&>pre]:bg-inherit! [&>pre>code]:grid! [&>pre>code]:p-5! [&>pre>code]:text-[0.875rem]! [&>pre>code]:leading-[1.6]! [&>.shiki.shiki-themes]:bg-transparent!`,dangerouslySetInnerHTML:{__html:y}}):(0,r.jsx)(`pre`,{ref:E,className:`m-0! p-5! rounded-none! border-none! bg-inherit! font-mono text-[0.875rem] leading-[1.6] overflow-x-auto`,...m,children:p(a).trimEnd()}),T&&(0,r.jsx)(`div`,{className:e.y(O?`absolute bottom-0 inset-x-0 h-24 bg-linear-to-t from-(--color-code-bg) to-transparent flex items-end justify-center pb-4 z-10`:`relative flex justify-center pb-4 pt-1 -mt-4`),children:(0,r.jsx)(i.Button,{onPress:()=>w(!C),className:`rounded-full bg-surface border border-subtle px-5 py-2 text-[0.8125rem] font-medium text-body outline-none cursor-pointer transition-all hover:bg-soft hover:-translate-y-px backdrop-blur-md`,children:C?`Show less`:`Expand code`})})]})]})}const y=({src:n,alt:i,title:a,theme:o,className:s,...c})=>{let{theme:l}=t.l();if(!n||o!==l)return null;let u=a||i;return(0,r.jsxs)(`figure`,{className:`my-6 sm:my-8 flex flex-col items-center justify-center group not-prose`,children:[(0,r.jsx)(`div`,{className:`relative w-full overflow-hidden rounded-lg sm:rounded-2xl border border-subtle bg-soft/30 transition-all duration-300 sm:max-w-[85%] lg:max-w-full`,children:(0,r.jsx)(t.t,{src:n,alt:i||``,theme:o,loading:`lazy`,decoding:`async`,className:e.y(`w-full h-auto object-contain transition-transform duration-500 group-hover:scale-[1.01] my-0 rounded-md sm:rounded-xl block`,s),...c})}),u&&(0,r.jsx)(`figcaption`,{className:`mt-2 sm:mt-3 text-center text-xs sm:text-sm text-muted font-medium select-none tracking-wide opacity-90 sm:opacity-80 group-hover:opacity-100 transition-opacity duration-300 px-2`,children:u})]})},b={img:y,Image:y};function x({className:t,title:i,icon:a,href:o,children:s,...c}){let[l,u]=(0,n.useState)({x:0,y:0}),[d,f]=(0,n.useState)(0),p=(0,n.useRef)(null),m=e=>{if(!p.current)return;let t=p.current.getBoundingClientRect();u({x:e.clientX-t.left,y:e.clientY-t.top})},h=()=>f(1),g=()=>f(0),_=o?`a`:`div`,v=`var(--color-primary-500, #eb5828)`;return(0,r.jsxs)(_,{ref:p,href:o,onMouseMove:m,onMouseEnter:h,onMouseLeave:g,className:e.y(`group relative flex flex-col gap-3 rounded-2xl border p-6 overflow-hidden transition-all duration-300`,`hover:shadow-lg dark:hover:shadow-none hover:-translate-y-0.5`,`bg-surface border-subtle text-paragraph`,o&&`cursor-pointer`,t),...c,children:[(0,r.jsx)(`div`,{className:`pointer-events-none absolute inset-0 transition-opacity duration-300`,style:{opacity:d,background:`radial-gradient(600px circle at ${l.x}px ${l.y}px, color-mix(in srgb, ${v} 8%, transparent), transparent 40%)`}}),(0,r.jsx)(`div`,{className:`pointer-events-none absolute inset-0 rounded-2xl transition-opacity duration-300`,style:{opacity:d,padding:`1px`,background:`radial-gradient(400px circle at ${l.x}px ${l.y}px, color-mix(in srgb, ${v} 50%, transparent), transparent 40%)`,WebkitMask:`linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0)`,WebkitMaskComposite:`xor`,maskComposite:`exclude`}}),(0,r.jsxs)(`div`,{className:`relative z-10 flex items-center gap-3`,children:[a&&(0,r.jsx)(`div`,{className:e.y(`shrink-0 transition-transform duration-500 group-hover:rotate-[15deg] group-hover:scale-110 flex items-center justify-center text-muted group-hover:text-primary-500`,`[&>svg]:w-6 [&>svg]:h-6 [&>svg]:stroke-[1.5]`),children:a}),i&&(0,r.jsx)(`h3`,{className:`font-semibold text-base m-0 leading-none text-body`,children:i})]}),(0,r.jsx)(`div`,{className:`relative z-10 text-[0.875rem] leading-[1.6] opacity-90 prose prose-neutral dark:prose-invert max-w-none [&>p]:m-0 [&>p+p]:mt-2`,children:s})]})}function S({children:t,className:n,cols:i=2,...a}){return(0,r.jsx)(`div`,{className:e.y(`grid gap-4 my-6`,{"grid-cols-1":i===1,"grid-cols-1 sm:grid-cols-2":i===2,"grid-cols-1 sm:grid-cols-2 md:grid-cols-3":i===3,"grid-cols-1 sm:grid-cols-2 lg:grid-cols-4":i===4},n),...a,children:t})}const C={...d,...f,...b,pre:v,Field:s,Callout:o,Card:x,Cards:S};Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return C}});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
-
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
import{G as e,X as t}from"./icons-dev-B_RZIyxu.js";import{n,t as r}from"./search-dialog-D6BNohIJ.js";import{useNavigate as i}from"react-router-dom";import{useCallback as a,useEffect as o,useMemo as s,useState as c}from"react";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import{Index as f}from"flexsearch";import p from"virtual:boltdocs-search";function m(e){let{currentLocale:n,currentVersion:r}=t(),[i,a]=c(!1),[l,u]=c(``),[d,m]=c(null);o(()=>{if(!i||d)return;let e=new f({preset:`match`,tokenize:`full`,resolution:9,cache:!0});for(let t of p)e.add(t.id,`${t.title} ${t.content}`);m(e)},[i,d]);let h=s(()=>{let e=new Map;for(let t of p)e.set(t.id,t);return e},[]);return{isOpen:i,setIsOpen:a,query:l,setQuery:u,list:s(()=>{if(!l)return e.filter(e=>{let t=!n||e.locale===n,i=!r||e.version===r;return t&&i}).slice(0,10).map(e=>({id:e.path,title:e.title,path:e.path,bio:e.description||``,groupTitle:e.groupTitle}));if(!d)return[];let t=d.search(l,{limit:20,suggest:!0}),i=[],a=new Set;for(let e of t){let t=h.get(e);if(!t)continue;let o=!n||t.locale===n,s=!r||t.version===r;!o||!s||a.has(t.url)||(a.add(t.url),i.push({id:t.url,title:t.title,path:t.url,bio:t.display,groupTitle:t.display.split(` > `)[0],isHeading:t.url.includes(`#`)}))}return i.slice(0,10)},[l,d,n,r,e,h]),input:{value:l,onChange:e=>u(e.target.value)}}}function h({text:e,query:t}){if(!t||!e)return u(l,{children:e});let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=RegExp(`(${n})`,`gi`);return u(l,{children:e.split(r).map((e,t)=>r.test(e)?u(`mark`,{className:`bg-primary-500/20 text-primary-600 dark:text-primary-400 font-bold px-0.5 rounded-sm`,children:e},t):e)})}function g({routes:t}){let{isOpen:s,setIsOpen:c,query:f,setQuery:p,list:g}=m(t),_=i();o(()=>{let e=e=>{(/Mac/.test(navigator.userAgent)?e.metaKey:e.ctrlKey)&&(e.key===`k`||e.key===`j`)&&(e.preventDefault(),c(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[c]);let v=a(e=>{let t=String(e);c(!1);let[n,r]=t.split(`#`);_(`${n}${f?`?hl=${encodeURIComponent(f)}`:``}${r?`#${r}`:``}`),r&&setTimeout(()=>{let e=document.getElementById(r);e&&e.scrollIntoView({behavior:`smooth`})},100)},[_,c,f]);return d(l,{children:[d(n.SearchTrigger.Desktop,{onPress:()=>c(!0),className:`rounded-xl border border-subtle bg-surface text-muted transition-all duration-200 hover:border-primary-500/50 hover:text-body hover:bg-soft/50 hover:shadow-sm active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:[d(`div`,{className:`flex items-center gap-2`,children:[u(e,{size:16}),u(`span`,{className:`hidden sm:inline-block`,children:`Search docs...`})]}),u(n.SearchTrigger.Kbd,{className:`[&_kbd]:bg-main [&_kbd]:border [&_kbd]:border-subtle [&_kbd]:rounded [&_kbd]:px-1.5 [&_kbd]:h-5 [&_kbd]:w-5`})]}),u(n.SearchTrigger.Mobile,{onPress:()=>c(!0),className:`rounded-xl text-muted transition-all duration-200 hover:text-body active:scale-95 focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:u(e,{size:20})}),u(r.Overlay,{isOpen:s,isDismissable:!0,onOpenChange:()=>c(!1),className:`fixed inset-0 z-100 flex items-center justify-center p-4 bg-black/40 backdrop-blur-xs animate-fade-in`,children:u(r.Content,{className:`w-full max-w-lg bg-main border border-subtle shadow-md rounded-2xl overflow-hidden p-6`,children:u(r.Dialog,{"aria-label":`Search documentation`,className:`flex flex-col min-h-0 h-[450px]`,children:d(r.Autocomplete,{onSelectionChange:v,className:`flex flex-col min-h-0`,children:[d(r.Input,{value:f,onChange:p,className:`flex items-center gap-2 border border-subtle bg-surface px-4 py-2.5 rounded-xl focus-within:border-primary-500 mb-4`,children:[u(r.Input.SearchInput,{placeholder:`Search documentation...`,className:`w-full bg-transparent outline-none text-body text-sm`}),f&&u(r.Input.Button,{onPress:()=>p(``),className:`text-muted hover:text-body text-xs cursor-pointer select-none`,children:`✕`})]}),u(r.List,{items:g,children:e=>d(r.Item,{onPress:()=>v(e.id),textValue:e.title,className:`flex items-center gap-3 px-4 py-2 rounded-xl group dark:hover:bg-primary-300/40 hover:bg-primary-200/50 transition-colors duration-100`,children:[u(r.Item.Icon,{isHeading:e.isHeading,className:`text-muted group-hover:text-primary-500 group-focus:text-primary-500`}),d(`div`,{className:`flex flex-col justify-center min-w-0`,children:[u(r.Item.Title,{className:`text-sm font-medium text-body truncate dark:group-hover:text-primary-100`,children:u(h,{text:e.title,query:f})}),u(r.Item.Bio,{className:`text-xs text-muted truncate`,children:u(h,{text:e.bio,query:f})})]})]},e.id)})]})})})})]})}export{m as n,g as t};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
-
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
const e=require(`./icons-dev-BlV3wWFT.cjs`);let t=require(`react`),n=require(`react/jsx-runtime`),r=require(`react-aria-components`);r=e.rt(r);const i=({children:t,className:r,...i})=>(0,n.jsx)(`header`,{className:e.y(`boltdocs-navbar sticky top-0 z-50 w-full`,r),...i,children:t}),a=({children:t,className:r})=>(0,n.jsx)(`div`,{className:e.y(`mx-auto flex lg:h-navbar max-w-(--breakpoint-3xl) items-center justify-between px-4 md:px-6`,r),children:t}),o=({children:t,className:r})=>(0,n.jsx)(`div`,{className:e.y(`flex flex-1 items-center justify-start gap-4 min-w-0`,r),children:t}),s=({children:t,className:r})=>(0,n.jsx)(`div`,{className:e.y(`flex flex-1 items-center justify-end gap-2 md:gap-4 min-w-0`,r),children:t}),c=({children:t,className:r})=>(0,n.jsx)(`div`,{className:e.y(`hidden lg:flex flex-1 justify-center items-center gap-4 px-4 min-w-0 w-full`,r),children:t}),l=({src:t,alt:r,width:i=24,height:a=24,className:o,href:s=`/`})=>(0,n.jsx)(e._,{href:s,className:e.y(`flex items-center gap-2 shrink-0 outline-none`,o),children:t?(0,n.jsx)(`img`,{src:t,alt:r,width:i,height:a,className:`h-6 w-6 object-contain`}):null}),u=({children:t,className:r,href:i=`/`})=>(0,n.jsx)(e._,{href:i,children:(0,n.jsx)(`span`,{className:e.y(`text-lg font-bold tracking-tight hidden sm:inline-block`,r),children:t})}),d=({children:t,className:r})=>(0,n.jsx)(`nav`,{className:e.y(`hidden md:flex items-center gap-6 text-sm font-medium`,r),children:t}),f=({label:t,href:r,to:i,className:a})=>(0,n.jsxs)(e._,{href:r,target:i===`external`?`_blank`:void 0,className:e.y(`transition-all outline-none`,a),children:[t,i===`external`&&(0,n.jsx)(`span`,{className:`ml-1 inline-block`,children:(0,n.jsx)(e.j,{size:12})})]}),p=({label:r,className:i,children:a})=>{let[o,s]=(0,t.useState)(!1);return(0,n.jsxs)(`div`,{className:e.y(`relative`,i),onMouseEnter:()=>{s(!0)},onMouseLeave:()=>{s(!1)},children:[(0,n.jsxs)(`div`,{className:e.y(`flex items-center gap-1 outline-none cursor-pointer select-none font-medium text-muted hover:text-body transition-colors`),children:[r,(0,n.jsx)(`svg`,{className:e.y(`w-4 h-4 transition-transform`,o&&`rotate-180`),fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:(0,n.jsx)(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 9l-7 7-7-7`})})]}),o&&(0,n.jsx)(`div`,{className:`absolute top-full left-0 pt-1 z-[9999]`,children:(0,n.jsx)(`div`,{className:`min-w-[180px] p-1 bg-surface border border-subtle rounded-md shadow-lg`,children:a})})]})},m=({href:t,label:r,className:i})=>(0,n.jsx)(e._,{href:t,className:e.y(`block px-2 py-1.5 rounded hover:bg-surface`,i),children:r}),h={Desktop:({className:t,onPress:i,children:a})=>(0,n.jsx)(r.Button,{onPress:i,className:e.y(`hidden lg:flex items-center justify-between gap-2 px-3 py-2 text-sm outline-none cursor-pointer w-full max-w-[720px]`,t),children:a}),Mobile:({className:t,onPress:i,children:a})=>(0,n.jsx)(r.Button,{onPress:i,className:e.y(`lg:hidden flex h-10 w-10 items-center justify-center outline-none cursor-pointer`,t),"aria-label":`Search`,children:a}),Kbd:({className:r})=>{let[i,a]=(0,t.useState)(!1),o=i&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);return(0,t.useEffect)(()=>{a(!0)},[]),(0,n.jsxs)(`div`,{className:e.y(`hidden sm:flex items-center gap-1 pointer-events-none select-none`,r),children:[(0,n.jsx)(`kbd`,{className:`flex items-center justify-center font-mono text-[10px]`,children:o?`⌘`:`Ctrl`}),(0,n.jsx)(`kbd`,{className:`flex items-center justify-center font-mono text-[10px]`,children:`K`})]})}},g=({className:t,theme:i,onThemeChange:a})=>(0,n.jsx)(r.ToggleButton,{isSelected:i===`dark`,onChange:a,className:e.y(`outline-none cursor-pointer`,t),"aria-label":`Toggle theme`,children:i===`dark`?(0,n.jsx)(e.K,{size:20}):(0,n.jsx)(e.H,{size:20})}),_=({name:t})=>{if(t===`github`)return(0,n.jsx)(e.s,{});if(t===`discord`)return(0,n.jsx)(e.o,{});if(t===`x`)return(0,n.jsx)(e.h,{});if(t===`bluesky`)return(0,n.jsx)(e.t,{})};i.Root=i,i.Left=o,i.Right=s,i.Center=c,i.Logo=l,i.Title=u,i.Links=d,i.Link=f,i.Dropdown=p,i.DropdownItem=m,i.SearchTrigger=h,i.Theme=g,i.Socials=({icon:t,link:r,className:i})=>(0,n.jsx)(e._,{href:r,target:`_blank`,rel:`noopener noreferrer`,className:e.y(`outline-none`,i),children:(0,n.jsx)(_,{name:t})}),i.Split=({className:t})=>(0,n.jsx)(r.Separator,{orientation:`vertical`,className:e.y(`h-full w-px`,t)}),i.Content=a,i.More=({onPress:t,className:i})=>(0,n.jsx)(r.Button,{onPress:t,className:e.y(`md:hidden flex items-center justify-center outline-none cursor-pointer`,i),"aria-label":`More navigation`,children:(0,n.jsx)(e.U,{size:20})}),i.MobileMenu=({isOpen:t,onClose:i,children:a,className:o})=>(0,n.jsx)(r.ModalOverlay,{isOpen:t,onOpenChange:e=>!e&&i(),isDismissable:!0,className:e.y(`fixed inset-0 z-60 md:hidden transition-all duration-100`,o),children:(0,n.jsx)(r.Modal,{className:`fixed inset-0 outline-none`,children:(0,n.jsxs)(r.Dialog,{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))]`,children:[(0,n.jsxs)(`div`,{className:`flex items-center justify-between mb-6`,children:[(0,n.jsx)(`span`,{}),(0,n.jsx)(r.Button,{onPress:i,className:`flex items-center justify-center outline-none cursor-pointer text-muted hover:text-body transition-colors`,"aria-label":`Close menu`,children:(0,n.jsx)(e.J,{size:24})})]}),(0,n.jsx)(`nav`,{className:`flex-1 overflow-y-auto flex flex-col gap-4`,children:a})]})})}),i.MobileLink=({label:t,href:r,to:i,onPress:a,className:o})=>(0,n.jsx)(e._,{href:r,target:i===`external`?`_blank`:void 0,onClick:a,className:e.y(`group flex items-center outline-none`,o),children:t});const v=({className:t,...i})=>(0,n.jsx)(r.ModalOverlay,{className:e.y(`fixed inset-0 z-100`,t),...i});v.Root=v,v.Overlay=v,v.Content=({className:t,...i})=>(0,n.jsx)(r.Modal,{className:e.y(t),...i}),v.Dialog=({className:t,...i})=>(0,n.jsx)(r.Dialog,{className:e.y(`flex flex-col focus:outline-none`,t),...i}),v.Autocomplete=({children:t,className:i,onSelectionChange:a,...o})=>{let s=r.Autocomplete;return(0,n.jsx)(`div`,{className:e.y(`flex-1 min-h-0`,i),children:(0,n.jsx)(s,{...o,onSelectionChange:a,className:`flex flex-col min-h-0`,children:t})})},v.List=({children:t,className:i,...a})=>(0,n.jsx)(r.ListBox,{...a,className:e.y(`flex-1 overflow-y-auto outline-none min-h-0`,i),children:t}),v.Input=Object.assign(({className:t,...i})=>(0,n.jsx)(r.SearchField,{className:e.y(`flex items-center`,t),...i}),{SearchInput:({className:t,...i})=>(0,n.jsx)(r.Input,{className:e.y(`w-full bg-transparent outline-none border-none`,t),...i}),Button:({className:t,...i})=>(0,n.jsx)(r.Button,{slot:`clear`,className:e.y(t),...i})}),v.Item=Object.assign(({children:t,className:i,...a})=>(0,n.jsx)(r.ListBoxItem,{...a,className:e.y(`group flex items-center outline-none cursor-pointer`,i),children:r=>(0,n.jsxs)(n.Fragment,{children:[t,(r.isFocused||r.isSelected)&&(0,n.jsxs)(`div`,{className:`ml-auto opacity-50 flex items-center gap-1`,children:[(0,n.jsx)(`span`,{className:`text-[10px]`,children:`Select`}),(0,n.jsx)(e.A,{size:10})]})]})}),{Icon:({isHeading:t,className:r})=>(0,n.jsx)(`div`,{className:e.y(`shrink-0`,r),children:t?(0,n.jsx)(e.P,{size:18}):(0,n.jsx)(e.N,{size:18})}),Title:({children:t,className:r})=>(0,n.jsx)(`span`,{className:e.y(`block truncate flex-1`,r),children:t}),Bio:({children:t,className:r})=>(0,n.jsx)(`span`,{className:e.y(`ml-2 truncate hidden sm:inline`,r),children:t})}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return v}});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
-
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
import{A as e,H as t,J as n,K as r,N as i,P as a,U as o,_ as s,h as c,j as l,o as u,s as d,t as f,y as p}from"./icons-dev-B_RZIyxu.js";import{useEffect as m,useState as h}from"react";import{Fragment as g,jsx as _,jsxs as v}from"react/jsx-runtime";import*as y from"react-aria-components";import{Button as b,Dialog as x,Modal as S,ModalOverlay as C,Separator as w,ToggleButton as T}from"react-aria-components";const E=({children:e,className:t,...n})=>_(`header`,{className:p(`boltdocs-navbar sticky top-0 z-50 w-full`,t),...n,children:e}),D=({children:e,className:t})=>_(`div`,{className:p(`mx-auto flex lg:h-navbar max-w-(--breakpoint-3xl) items-center justify-between px-4 md:px-6`,t),children:e}),O=({children:e,className:t})=>_(`div`,{className:p(`flex flex-1 items-center justify-start gap-4 min-w-0`,t),children:e}),k=({children:e,className:t})=>_(`div`,{className:p(`flex flex-1 items-center justify-end gap-2 md:gap-4 min-w-0`,t),children:e}),A=({children:e,className:t})=>_(`div`,{className:p(`hidden lg:flex flex-1 justify-center items-center gap-4 px-4 min-w-0 w-full`,t),children:e}),j=({src:e,alt:t,width:n=24,height:r=24,className:i,href:a=`/`})=>_(s,{href:a,className:p(`flex items-center gap-2 shrink-0 outline-none`,i),children:e?_(`img`,{src:e,alt:t,width:n,height:r,className:`h-6 w-6 object-contain`}):null}),M=({children:e,className:t,href:n=`/`})=>_(s,{href:n,children:_(`span`,{className:p(`text-lg font-bold tracking-tight hidden sm:inline-block`,t),children:e})}),N=({children:e,className:t})=>_(`nav`,{className:p(`hidden md:flex items-center gap-6 text-sm font-medium`,t),children:e}),P=({label:e,href:t,to:n,className:r})=>v(s,{href:t,target:n===`external`?`_blank`:void 0,className:p(`transition-all outline-none`,r),children:[e,n===`external`&&_(`span`,{className:`ml-1 inline-block`,children:_(l,{size:12})})]}),F=({label:e,className:t,children:n})=>{let[r,i]=h(!1);return v(`div`,{className:p(`relative`,t),onMouseEnter:()=>{i(!0)},onMouseLeave:()=>{i(!1)},children:[v(`div`,{className:p(`flex items-center gap-1 outline-none cursor-pointer select-none font-medium text-muted hover:text-body transition-colors`),children:[e,_(`svg`,{className:p(`w-4 h-4 transition-transform`,r&&`rotate-180`),fill:`none`,viewBox:`0 0 24 24`,stroke:`currentColor`,children:_(`path`,{strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:2,d:`M19 9l-7 7-7-7`})})]}),r&&_(`div`,{className:`absolute top-full left-0 pt-1 z-[9999]`,children:_(`div`,{className:`min-w-[180px] p-1 bg-surface border border-subtle rounded-md shadow-lg`,children:n})})]})},I=({href:e,label:t,className:n})=>_(s,{href:e,className:p(`block px-2 py-1.5 rounded hover:bg-surface`,n),children:t}),L={Desktop:({className:e,onPress:t,children:n})=>_(b,{onPress:t,className:p(`hidden lg:flex items-center justify-between gap-2 px-3 py-2 text-sm outline-none cursor-pointer w-full max-w-[720px]`,e),children:n}),Mobile:({className:e,onPress:t,children:n})=>_(b,{onPress:t,className:p(`lg:hidden flex h-10 w-10 items-center justify-center outline-none cursor-pointer`,e),"aria-label":`Search`,children:n}),Kbd:({className:e})=>{let[t,n]=h(!1),r=t&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);return m(()=>{n(!0)},[]),v(`div`,{className:p(`hidden sm:flex items-center gap-1 pointer-events-none select-none`,e),children:[_(`kbd`,{className:`flex items-center justify-center font-mono text-[10px]`,children:r?`⌘`:`Ctrl`}),_(`kbd`,{className:`flex items-center justify-center font-mono text-[10px]`,children:`K`})]})}},R=({className:e,theme:n,onThemeChange:i})=>_(T,{isSelected:n===`dark`,onChange:i,className:p(`outline-none cursor-pointer`,e),"aria-label":`Toggle theme`,children:_(n===`dark`?r:t,{size:20})}),z=({name:e})=>{if(e===`github`)return _(d,{});if(e===`discord`)return _(u,{});if(e===`x`)return _(c,{});if(e===`bluesky`)return _(f,{})};E.Root=E,E.Left=O,E.Right=k,E.Center=A,E.Logo=j,E.Title=M,E.Links=N,E.Link=P,E.Dropdown=F,E.DropdownItem=I,E.SearchTrigger=L,E.Theme=R,E.Socials=({icon:e,link:t,className:n})=>_(s,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:p(`outline-none`,n),children:_(z,{name:e})}),E.Split=({className:e})=>_(w,{orientation:`vertical`,className:p(`h-full w-px`,e)}),E.Content=D,E.More=({onPress:e,className:t})=>_(b,{onPress:e,className:p(`md:hidden flex items-center justify-center outline-none cursor-pointer`,t),"aria-label":`More navigation`,children:_(o,{size:20})}),E.MobileMenu=({isOpen:e,onClose:t,children:r,className:i})=>_(C,{isOpen:e,onOpenChange:e=>!e&&t(),isDismissable:!0,className:p(`fixed inset-0 z-60 md:hidden transition-all duration-100`,i),children:_(S,{className:`fixed inset-0 outline-none`,children:v(x,{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))]`,children:[v(`div`,{className:`flex items-center justify-between mb-6`,children:[_(`span`,{}),_(b,{onPress:t,className:`flex items-center justify-center outline-none cursor-pointer text-muted hover:text-body transition-colors`,"aria-label":`Close menu`,children:_(n,{size:24})})]}),_(`nav`,{className:`flex-1 overflow-y-auto flex flex-col gap-4`,children:r})]})})}),E.MobileLink=({label:e,href:t,to:n,onPress:r,className:i})=>_(s,{href:t,target:n===`external`?`_blank`:void 0,onClick:r,className:p(`group flex items-center outline-none`,i),children:e});const B=({className:e,...t})=>_(y.ModalOverlay,{className:p(`fixed inset-0 z-100`,e),...t});B.Root=B,B.Overlay=B,B.Content=({className:e,...t})=>_(y.Modal,{className:p(e),...t}),B.Dialog=({className:e,...t})=>_(y.Dialog,{className:p(`flex flex-col focus:outline-none`,e),...t}),B.Autocomplete=({children:e,className:t,onSelectionChange:n,...r})=>{let i=y.Autocomplete;return _(`div`,{className:p(`flex-1 min-h-0`,t),children:_(i,{...r,onSelectionChange:n,className:`flex flex-col min-h-0`,children:e})})},B.List=({children:e,className:t,...n})=>_(y.ListBox,{...n,className:p(`flex-1 overflow-y-auto outline-none min-h-0`,t),children:e}),B.Input=Object.assign(({className:e,...t})=>_(y.SearchField,{className:p(`flex items-center`,e),...t}),{SearchInput:({className:e,...t})=>_(y.Input,{className:p(`w-full bg-transparent outline-none border-none`,e),...t}),Button:({className:e,...t})=>_(y.Button,{slot:`clear`,className:p(e),...t})}),B.Item=Object.assign(({children:t,className:n,...r})=>_(y.ListBoxItem,{...r,className:p(`group flex items-center outline-none cursor-pointer`,n),children:n=>v(g,{children:[t,(n.isFocused||n.isSelected)&&v(`div`,{className:`ml-auto opacity-50 flex items-center gap-1`,children:[_(`span`,{className:`text-[10px]`,children:`Select`}),_(e,{size:10})]})]})}),{Icon:({isHeading:e,className:t})=>_(`div`,{className:p(`shrink-0`,t),children:_(e?a:i,{size:18})}),Title:({children:e,className:t})=>_(`span`,{className:p(`block truncate flex-1`,t),children:e}),Bio:({children:e,className:t})=>_(`span`,{className:p(`ml-2 truncate hidden sm:inline`,t),children:e})});export{E as n,B as t};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Boltdocs - https://boltdocs.vercel.app
|
|
3
|
-
* Copyright (c) 2026 Jesus Alcala
|
|
4
|
-
* Licensed under the MIT License.
|
|
5
|
-
*/
|
|
6
|
-
const e=require(`./icons-dev-BlV3wWFT.cjs`),t=require(`./search-dialog-BvBopRsZ.cjs`);let n=require(`react-router-dom`),r=require(`react`),i=require(`react/jsx-runtime`),a=require(`flexsearch`),o=require(`virtual:boltdocs-search`);o=e.rt(o);function s(t){let{currentLocale:n,currentVersion:i}=e.X(),[s,c]=(0,r.useState)(!1),[l,u]=(0,r.useState)(``),[d,f]=(0,r.useState)(null);(0,r.useEffect)(()=>{if(!s||d)return;let e=new a.Index({preset:`match`,tokenize:`full`,resolution:9,cache:!0});for(let t of o.default)e.add(t.id,`${t.title} ${t.content}`);f(e)},[s,d]);let p=(0,r.useMemo)(()=>{let e=new Map;for(let t of o.default)e.set(t.id,t);return e},[]);return{isOpen:s,setIsOpen:c,query:l,setQuery:u,list:(0,r.useMemo)(()=>{if(!l)return t.filter(e=>{let t=!n||e.locale===n,r=!i||e.version===i;return t&&r}).slice(0,10).map(e=>({id:e.path,title:e.title,path:e.path,bio:e.description||``,groupTitle:e.groupTitle}));if(!d)return[];let e=d.search(l,{limit:20,suggest:!0}),r=[],a=new Set;for(let t of e){let e=p.get(t);if(!e)continue;let o=!n||e.locale===n,s=!i||e.version===i;!o||!s||a.has(e.url)||(a.add(e.url),r.push({id:e.url,title:e.title,path:e.url,bio:e.display,groupTitle:e.display.split(` > `)[0],isHeading:e.url.includes(`#`)}))}return r.slice(0,10)},[l,d,n,i,t,p]),input:{value:l,onChange:e=>u(e.target.value)}}}function c({text:e,query:t}){if(!t||!e)return(0,i.jsx)(i.Fragment,{children:e});let n=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),r=RegExp(`(${n})`,`gi`);return(0,i.jsx)(i.Fragment,{children:e.split(r).map((e,t)=>r.test(e)?(0,i.jsx)(`mark`,{className:`bg-primary-500/20 text-primary-600 dark:text-primary-400 font-bold px-0.5 rounded-sm`,children:e},t):e)})}function l({routes:a}){let{isOpen:o,setIsOpen:l,query:u,setQuery:d,list:f}=s(a),p=(0,n.useNavigate)();(0,r.useEffect)(()=>{let e=e=>{(/Mac/.test(navigator.userAgent)?e.metaKey:e.ctrlKey)&&(e.key===`k`||e.key===`j`)&&(e.preventDefault(),l(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[l]);let m=(0,r.useCallback)(e=>{let t=String(e);l(!1);let[n,r]=t.split(`#`);p(`${n}${u?`?hl=${encodeURIComponent(u)}`:``}${r?`#${r}`:``}`),r&&setTimeout(()=>{let e=document.getElementById(r);e&&e.scrollIntoView({behavior:`smooth`})},100)},[p,l,u]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(t.n.SearchTrigger.Desktop,{onPress:()=>l(!0),className:`rounded-xl border border-subtle bg-surface text-muted transition-all duration-200 hover:border-primary-500/50 hover:text-body hover:bg-soft/50 hover:shadow-sm active:scale-[0.98] focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:[(0,i.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,i.jsx)(e.G,{size:16}),(0,i.jsx)(`span`,{className:`hidden sm:inline-block`,children:`Search docs...`})]}),(0,i.jsx)(t.n.SearchTrigger.Kbd,{className:`[&_kbd]:bg-main [&_kbd]:border [&_kbd]:border-subtle [&_kbd]:rounded [&_kbd]:px-1.5 [&_kbd]:h-5 [&_kbd]:w-5`})]}),(0,i.jsx)(t.n.SearchTrigger.Mobile,{onPress:()=>l(!0),className:`rounded-xl text-muted transition-all duration-200 hover:text-body active:scale-95 focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:(0,i.jsx)(e.G,{size:20})}),(0,i.jsx)(t.t.Overlay,{isOpen:o,isDismissable:!0,onOpenChange:()=>l(!1),className:`fixed inset-0 z-100 flex items-center justify-center p-4 bg-black/40 backdrop-blur-xs animate-fade-in`,children:(0,i.jsx)(t.t.Content,{className:`w-full max-w-lg bg-main border border-subtle shadow-md rounded-2xl overflow-hidden p-6`,children:(0,i.jsx)(t.t.Dialog,{"aria-label":`Search documentation`,className:`flex flex-col min-h-0 h-[450px]`,children:(0,i.jsxs)(t.t.Autocomplete,{onSelectionChange:m,className:`flex flex-col min-h-0`,children:[(0,i.jsxs)(t.t.Input,{value:u,onChange:d,className:`flex items-center gap-2 border border-subtle bg-surface px-4 py-2.5 rounded-xl focus-within:border-primary-500 mb-4`,children:[(0,i.jsx)(t.t.Input.SearchInput,{placeholder:`Search documentation...`,className:`w-full bg-transparent outline-none text-body text-sm`}),u&&(0,i.jsx)(t.t.Input.Button,{onPress:()=>d(``),className:`text-muted hover:text-body text-xs cursor-pointer select-none`,children:`✕`})]}),(0,i.jsx)(t.t.List,{items:f,children:e=>(0,i.jsxs)(t.t.Item,{onPress:()=>m(e.id),textValue:e.title,className:`flex items-center gap-3 px-4 py-2 rounded-xl group dark:hover:bg-primary-300/40 hover:bg-primary-200/50 transition-colors duration-100`,children:[(0,i.jsx)(t.t.Item.Icon,{isHeading:e.isHeading,className:`text-muted group-hover:text-primary-500 group-focus:text-primary-500`}),(0,i.jsxs)(`div`,{className:`flex flex-col justify-center min-w-0`,children:[(0,i.jsx)(t.t.Item.Title,{className:`text-sm font-medium text-body truncate dark:group-hover:text-primary-100`,children:(0,i.jsx)(c,{text:e.title,query:u})}),(0,i.jsx)(t.t.Item.Bio,{className:`text-xs text-muted truncate`,children:(0,i.jsx)(c,{text:e.bio,query:u})})]})]},e.id)})]})})})})]})}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return l}});
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { createContext, use } from 'react'
|
|
2
|
-
import type { BoltdocsConfig } from '../../shared/types'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Context for the global documentation configuration.
|
|
6
|
-
* Using a global singleton pattern to survive dual-package or duplicated-code hazards.
|
|
7
|
-
*/
|
|
8
|
-
const CONFIG_CONTEXT_SYMBOL = Symbol.for('__BDOCS_CONFIG_CONTEXT__')
|
|
9
|
-
const CONFIG_INSTANCE_SYMBOL = Symbol.for('__BDOCS_CONFIG_INSTANCE__')
|
|
10
|
-
|
|
11
|
-
export const ConfigContext =
|
|
12
|
-
(globalThis as any)[CONFIG_CONTEXT_SYMBOL] ||
|
|
13
|
-
((globalThis as any)[CONFIG_CONTEXT_SYMBOL] =
|
|
14
|
-
createContext<BoltdocsConfig | null>(null))
|
|
15
|
-
|
|
16
|
-
export function ConfigProvider({
|
|
17
|
-
config,
|
|
18
|
-
children,
|
|
19
|
-
}: {
|
|
20
|
-
config: BoltdocsConfig
|
|
21
|
-
children: React.ReactNode
|
|
22
|
-
}) {
|
|
23
|
-
// Sync with global registry for dual-package fallback
|
|
24
|
-
if (typeof globalThis !== 'undefined') {
|
|
25
|
-
;(globalThis as any)[CONFIG_INSTANCE_SYMBOL] = config
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<ConfigContext.Provider value={config}>{children}</ConfigContext.Provider>
|
|
30
|
-
)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Hook to access the Boltdocs configuration.
|
|
35
|
-
*/
|
|
36
|
-
export function useConfig() {
|
|
37
|
-
const context = use(ConfigContext)
|
|
38
|
-
|
|
39
|
-
// Fallback to global registry if context is missing (dual-package hazard safety net)
|
|
40
|
-
if (
|
|
41
|
-
!context &&
|
|
42
|
-
typeof globalThis !== 'undefined' &&
|
|
43
|
-
(globalThis as any)[CONFIG_INSTANCE_SYMBOL]
|
|
44
|
-
) {
|
|
45
|
-
return (globalThis as any)[CONFIG_INSTANCE_SYMBOL] as BoltdocsConfig
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (!context)
|
|
49
|
-
throw new Error('useConfig must be used within a ConfigProvider')
|
|
50
|
-
return context as BoltdocsConfig
|
|
51
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { useMdxComponents } from './mdx-components-context'
|
|
2
|
-
import { useMemo } from 'react'
|
|
3
|
-
import { LastUpdated as DefaultLastUpdated } from '../components/ui-base'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* DocPage renders the MDX content and page-specific metadata.
|
|
7
|
-
* It is rendered inside the Outlet of DocsLayout.
|
|
8
|
-
*/
|
|
9
|
-
export function DocPage({
|
|
10
|
-
route,
|
|
11
|
-
content: Content,
|
|
12
|
-
mdxComponents: propComponents,
|
|
13
|
-
}: any) {
|
|
14
|
-
// Access global MDX components (defaults + plugins + virtuals) from context
|
|
15
|
-
const contextComponents = useMdxComponents()
|
|
16
|
-
|
|
17
|
-
// Merge components: Prop components (from loader) take priority,
|
|
18
|
-
// then context components (globals).
|
|
19
|
-
const allComponents = useMemo(
|
|
20
|
-
() => ({
|
|
21
|
-
LastUpdated: DefaultLastUpdated,
|
|
22
|
-
...contextComponents,
|
|
23
|
-
...propComponents,
|
|
24
|
-
}),
|
|
25
|
-
[contextComponents, propComponents],
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
const LastUpdated = allComponents.LastUpdated || DefaultLastUpdated
|
|
29
|
-
|
|
30
|
-
if (!Content) return null
|
|
31
|
-
|
|
32
|
-
return (
|
|
33
|
-
<>
|
|
34
|
-
<Content components={allComponents} />
|
|
35
|
-
{route?.lastUpdated && <LastUpdated date={route.lastUpdated} />}
|
|
36
|
-
</>
|
|
37
|
-
)
|
|
38
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Outlet } from 'react-router-dom'
|
|
2
|
-
import UserLayout from 'virtual:boltdocs-layout'
|
|
3
|
-
import { useRoutes } from '../hooks/use-routes'
|
|
4
|
-
import { useConfig } from './config-context'
|
|
5
|
-
import { Head } from './head'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Wraps the docs Outlet with the user's (or default) layout component.
|
|
9
|
-
* The Layout receives the routed page as `children`.
|
|
10
|
-
* We use useRoutes to pass the current route context to the persistent layout.
|
|
11
|
-
*/
|
|
12
|
-
export function DocsLayout() {
|
|
13
|
-
const config = useConfig()
|
|
14
|
-
const { currentRoute, allRoutes } = useRoutes()
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<>
|
|
18
|
-
<Head
|
|
19
|
-
siteTitle={config.theme?.title}
|
|
20
|
-
siteDescription={config.theme?.description}
|
|
21
|
-
routes={allRoutes || []}
|
|
22
|
-
/>
|
|
23
|
-
<UserLayout route={currentRoute}>
|
|
24
|
-
<Outlet />
|
|
25
|
-
</UserLayout>
|
|
26
|
-
</>
|
|
27
|
-
)
|
|
28
|
-
}
|
package/src/client/app/head.tsx
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
2
|
-
import { useLocation } from 'react-router-dom'
|
|
3
|
-
import { Helmet } from './helmet-compat'
|
|
4
|
-
import { useConfig } from './config-context'
|
|
5
|
-
import { getTranslated } from '../utils/i18n'
|
|
6
|
-
import { useRoutes } from '../hooks/use-routes'
|
|
7
|
-
|
|
8
|
-
interface HeadProps {
|
|
9
|
-
siteTitle?: string | Record<string, string>
|
|
10
|
-
siteDescription?: string | Record<string, string>
|
|
11
|
-
routes: Array<{
|
|
12
|
-
path: string
|
|
13
|
-
title: string
|
|
14
|
-
description?: string
|
|
15
|
-
seo?: Record<string, unknown>
|
|
16
|
-
}>
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export function Head({ siteTitle, siteDescription, routes }: HeadProps) {
|
|
20
|
-
const location = useLocation()
|
|
21
|
-
const config = useConfig()
|
|
22
|
-
const { currentLocale } = useRoutes()
|
|
23
|
-
|
|
24
|
-
// Find the current route's metadata — memoized so the O(n) search only
|
|
25
|
-
// re-runs when the routes array or the current URL changes, not on every render.
|
|
26
|
-
const currentRoute = useMemo(
|
|
27
|
-
() => routes?.find?.((r) => r.path === location.pathname),
|
|
28
|
-
[routes, location.pathname],
|
|
29
|
-
)
|
|
30
|
-
const pageTitle = currentRoute?.title
|
|
31
|
-
const translatedSiteDescription = getTranslated(
|
|
32
|
-
siteDescription,
|
|
33
|
-
currentLocale,
|
|
34
|
-
)
|
|
35
|
-
const pageDescription =
|
|
36
|
-
currentRoute?.description || translatedSiteDescription || ''
|
|
37
|
-
|
|
38
|
-
const translatedSiteTitle = getTranslated(siteTitle, currentLocale)
|
|
39
|
-
const finalTitle = pageTitle
|
|
40
|
-
? `${pageTitle} | ${translatedSiteTitle}`
|
|
41
|
-
: translatedSiteTitle
|
|
42
|
-
|
|
43
|
-
const seo = currentRoute?.seo || {}
|
|
44
|
-
|
|
45
|
-
// Merge custom global metatags
|
|
46
|
-
const globalMetatags = config?.seo?.metatags || {}
|
|
47
|
-
|
|
48
|
-
// Calculate specific ones
|
|
49
|
-
const defaultOgImage = config?.seo?.thumbnails?.background
|
|
50
|
-
const ogImage = (seo['og:image'] || defaultOgImage) as string | undefined
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<Helmet>
|
|
54
|
-
<title>{finalTitle}</title>
|
|
55
|
-
<meta name="description" content={pageDescription} />
|
|
56
|
-
|
|
57
|
-
{/* Default OG Tags */}
|
|
58
|
-
<meta property="og:title" content={finalTitle} />
|
|
59
|
-
<meta property="og:description" content={pageDescription} />
|
|
60
|
-
<meta property="og:type" content="article" />
|
|
61
|
-
{/* Canonical URL for both <link> and og:url */}
|
|
62
|
-
{typeof window !== 'undefined' && (
|
|
63
|
-
<meta property="og:url" content={window.location.href} />
|
|
64
|
-
)}
|
|
65
|
-
{typeof window !== 'undefined' && (
|
|
66
|
-
<link
|
|
67
|
-
rel="canonical"
|
|
68
|
-
href={window.location.origin + location.pathname}
|
|
69
|
-
/>
|
|
70
|
-
)}
|
|
71
|
-
|
|
72
|
-
{/* Default Twitter Card */}
|
|
73
|
-
<meta name="twitter:card" content="summary" />
|
|
74
|
-
<meta name="twitter:title" content={finalTitle} />
|
|
75
|
-
<meta name="twitter:description" content={pageDescription} />
|
|
76
|
-
{ogImage && <meta name="twitter:image" content={ogImage} />}
|
|
77
|
-
{ogImage && <meta property="og:image" content={ogImage} />}
|
|
78
|
-
|
|
79
|
-
{/* Generator */}
|
|
80
|
-
<meta name="generator" content="Boltdocs" />
|
|
81
|
-
|
|
82
|
-
{/* User-defined global metatags */}
|
|
83
|
-
{Object.entries(globalMetatags).map(([key, value]) => {
|
|
84
|
-
const isProperty =
|
|
85
|
-
key.startsWith('og:') ||
|
|
86
|
-
key.startsWith('music:') ||
|
|
87
|
-
key.startsWith('video:') ||
|
|
88
|
-
key.startsWith('article:') ||
|
|
89
|
-
key.startsWith('book:') ||
|
|
90
|
-
key.startsWith('profile:')
|
|
91
|
-
return isProperty ? (
|
|
92
|
-
<meta key={key} property={key} content={value as string} />
|
|
93
|
-
) : (
|
|
94
|
-
<meta key={key} name={key} content={value as string} />
|
|
95
|
-
)
|
|
96
|
-
})}
|
|
97
|
-
|
|
98
|
-
{/* Page granular SEO tags (override global) */}
|
|
99
|
-
{Object.entries(seo).map(([key, value]) => {
|
|
100
|
-
if (key === 'noindex' && value === true)
|
|
101
|
-
return <meta key="noindex" name="robots" content="noindex" />
|
|
102
|
-
if (key === 'robots')
|
|
103
|
-
return <meta key="robots" name="robots" content={value as string} />
|
|
104
|
-
if (key === 'canonical')
|
|
105
|
-
return <link key="canonical" rel="canonical" href={value as string} />
|
|
106
|
-
|
|
107
|
-
const isProperty =
|
|
108
|
-
key.startsWith('og:') ||
|
|
109
|
-
key.startsWith('music:') ||
|
|
110
|
-
key.startsWith('video:') ||
|
|
111
|
-
key.startsWith('article:') ||
|
|
112
|
-
key.startsWith('book:') ||
|
|
113
|
-
key.startsWith('profile:')
|
|
114
|
-
return isProperty ? (
|
|
115
|
-
<meta key={key} property={key} content={value as string} />
|
|
116
|
-
) : (
|
|
117
|
-
<meta key={key} name={key} content={value as string} />
|
|
118
|
-
)
|
|
119
|
-
})}
|
|
120
|
-
</Helmet>
|
|
121
|
-
)
|
|
122
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared Helmet module compatibility helpers.
|
|
3
|
-
*
|
|
4
|
-
* react-helmet-async ships different module shapes depending on whether it is
|
|
5
|
-
* loaded via CJS or ESM. Instead of duplicating the same detection logic in
|
|
6
|
-
* every component that needs Helmet/HelmetProvider, we centralise it here.
|
|
7
|
-
*/
|
|
8
|
-
import type { ComponentType, ReactNode } from 'react'
|
|
9
|
-
import * as ReactHelmetAsync from 'react-helmet-async'
|
|
10
|
-
|
|
11
|
-
type HelmetModule = {
|
|
12
|
-
Helmet?: ComponentType<{ children?: ReactNode }>
|
|
13
|
-
HelmetProvider?: ComponentType<{ children?: ReactNode }>
|
|
14
|
-
default?: {
|
|
15
|
-
Helmet?: ComponentType<{ children?: ReactNode }>
|
|
16
|
-
HelmetProvider?: ComponentType<{ children?: ReactNode }>
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const mod = ReactHelmetAsync as unknown as HelmetModule
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* The `<Helmet>` component, resolved across CJS/ESM module shapes.
|
|
24
|
-
* Falls back to a transparent fragment wrapper if the module cannot be resolved.
|
|
25
|
-
*/
|
|
26
|
-
export const Helmet: ComponentType<{ children?: ReactNode }> =
|
|
27
|
-
mod.Helmet || mod.default?.Helmet || (({ children }) => <>{children}</>)
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* The `<HelmetProvider>` component, resolved across CJS/ESM module shapes.
|
|
31
|
-
* Falls back to a transparent fragment wrapper if the module cannot be resolved.
|
|
32
|
-
*/
|
|
33
|
-
export const HelmetProvider: ComponentType<{ children?: ReactNode }> =
|
|
34
|
-
mod.HelmetProvider ||
|
|
35
|
-
mod.default?.HelmetProvider ||
|
|
36
|
-
(({ children }) => <>{children}</>)
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { createContext, use, useMemo } from 'react'
|
|
2
|
-
import type { BoltdocsMdxComponents } from '../../shared/types'
|
|
3
|
-
|
|
4
|
-
export type MdxComponentsType = {
|
|
5
|
-
[key: string]: React.ComponentType<any>
|
|
6
|
-
} & {
|
|
7
|
-
Frontmatter?: Record<string, React.ComponentType<any>>
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const MDX_COMPONENTS_CONTEXT_SYMBOL = Symbol.for(
|
|
11
|
-
'__BDOCS_MDX_COMPONENTS_CONTEXT__',
|
|
12
|
-
)
|
|
13
|
-
const MDX_COMPONENTS_INSTANCE_SYMBOL = Symbol.for(
|
|
14
|
-
'__BDOCS_MDX_COMPONENTS_INSTANCE__',
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
const MdxComponentsContext =
|
|
18
|
-
(globalThis as any)[MDX_COMPONENTS_CONTEXT_SYMBOL] ||
|
|
19
|
-
((globalThis as any)[MDX_COMPONENTS_CONTEXT_SYMBOL] =
|
|
20
|
-
createContext<MdxComponentsType>({}))
|
|
21
|
-
|
|
22
|
-
export function useMdxComponents(): BoltdocsMdxComponents {
|
|
23
|
-
const context = use(MdxComponentsContext)
|
|
24
|
-
|
|
25
|
-
// Fallback to global registry for dual-package hazards
|
|
26
|
-
if (
|
|
27
|
-
(!context || Object.keys(context).length === 0) &&
|
|
28
|
-
(globalThis as any)[MDX_COMPONENTS_INSTANCE_SYMBOL]
|
|
29
|
-
) {
|
|
30
|
-
return (globalThis as any)[
|
|
31
|
-
MDX_COMPONENTS_INSTANCE_SYMBOL
|
|
32
|
-
] as BoltdocsMdxComponents
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return context as any as BoltdocsMdxComponents
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function MdxComponentsProvider({
|
|
39
|
-
components,
|
|
40
|
-
children,
|
|
41
|
-
}: {
|
|
42
|
-
components: Record<string, React.ComponentType<any>>
|
|
43
|
-
children: React.ReactNode
|
|
44
|
-
}) {
|
|
45
|
-
const processedComponents = useMemo(() => {
|
|
46
|
-
const processed: Record<string, any> = {}
|
|
47
|
-
const frontmatter: Record<string, React.ComponentType<any>> = {}
|
|
48
|
-
|
|
49
|
-
Object.entries(components).forEach(([key, value]) => {
|
|
50
|
-
if (key.startsWith('Frontmatter_')) {
|
|
51
|
-
const cleanKey = key.slice('Frontmatter_'.length)
|
|
52
|
-
frontmatter[cleanKey] = value
|
|
53
|
-
} else {
|
|
54
|
-
processed[key] = value
|
|
55
|
-
}
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
processed.Frontmatter = frontmatter
|
|
59
|
-
return processed as MdxComponentsType
|
|
60
|
-
}, [components])
|
|
61
|
-
|
|
62
|
-
// Sync with global registry
|
|
63
|
-
if (typeof globalThis !== 'undefined') {
|
|
64
|
-
;(globalThis as any)[MDX_COMPONENTS_INSTANCE_SYMBOL] = processedComponents
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<MdxComponentsContext.Provider value={processedComponents}>
|
|
69
|
-
{children}
|
|
70
|
-
</MdxComponentsContext.Provider>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createContext, use } from 'react'
|
|
2
|
-
import type { ComponentRoute } from '../types'
|
|
3
|
-
|
|
4
|
-
interface RoutesContextType {
|
|
5
|
-
routes: ComponentRoute[]
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const RoutesContext = createContext<RoutesContextType>({
|
|
9
|
-
routes: [],
|
|
10
|
-
})
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Hook to access the processed routes list from the closest provider.
|
|
14
|
-
*/
|
|
15
|
-
export function useRoutesContext() {
|
|
16
|
-
return use(RoutesContext)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Provider component for the documentation routes.
|
|
21
|
-
*/
|
|
22
|
-
export function RoutesProvider({
|
|
23
|
-
routes,
|
|
24
|
-
children,
|
|
25
|
-
}: {
|
|
26
|
-
routes: ComponentRoute[]
|
|
27
|
-
children: React.ReactNode
|
|
28
|
-
}) {
|
|
29
|
-
return (
|
|
30
|
-
<RoutesContext.Provider value={{ routes }}>
|
|
31
|
-
{children}
|
|
32
|
-
</RoutesContext.Provider>
|
|
33
|
-
)
|
|
34
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { useEffect, useLayoutEffect } from 'react'
|
|
2
|
-
import { useLocation } from 'react-router-dom'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Handles scroll restoration and hash scrolling on navigation.
|
|
6
|
-
* It ensures the page scrolls to top on pathname changes,
|
|
7
|
-
* or specifically to an anchor element if a hash is present.
|
|
8
|
-
*/
|
|
9
|
-
export function ScrollHandler() {
|
|
10
|
-
const { pathname, hash } = useLocation()
|
|
11
|
-
|
|
12
|
-
// Helper to handle scroll logic
|
|
13
|
-
const handleScroll = (behavior: ScrollBehavior = 'auto') => {
|
|
14
|
-
const container = document.querySelector('.boltdocs-content') || window
|
|
15
|
-
|
|
16
|
-
const getScrollTop = () => {
|
|
17
|
-
if (container === window) return window.scrollY
|
|
18
|
-
return (container as HTMLElement).scrollTop
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const scrollTo = (top: number, scrollBehavior: ScrollBehavior) => {
|
|
22
|
-
if (container === window) {
|
|
23
|
-
window.scrollTo({ top, behavior: scrollBehavior })
|
|
24
|
-
} else {
|
|
25
|
-
;(container as HTMLElement).scrollTo({ top, behavior: scrollBehavior })
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (hash) {
|
|
30
|
-
const id = hash.replace('#', '')
|
|
31
|
-
const element = document.getElementById(id)
|
|
32
|
-
if (element) {
|
|
33
|
-
const offset = 80
|
|
34
|
-
const containerTop =
|
|
35
|
-
container === window
|
|
36
|
-
? 0
|
|
37
|
-
: (container as HTMLElement).getBoundingClientRect().top
|
|
38
|
-
const elementRect = element.getBoundingClientRect().top
|
|
39
|
-
const elementPosition = elementRect - containerTop
|
|
40
|
-
const offsetPosition = elementPosition - offset + getScrollTop()
|
|
41
|
-
|
|
42
|
-
scrollTo(offsetPosition, behavior)
|
|
43
|
-
return true
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
scrollTo(0, behavior)
|
|
48
|
-
return false
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// 1. Immediate sync scroll before paint
|
|
52
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: pathname is used as a trigger for scroll-to-top on navigation
|
|
53
|
-
useLayoutEffect(() => {
|
|
54
|
-
handleScroll('auto')
|
|
55
|
-
}, [pathname, hash])
|
|
56
|
-
|
|
57
|
-
// 2. Delayed async scroll as fallback/stabilizer after paint & passive effects
|
|
58
|
-
useEffect(() => {
|
|
59
|
-
// Immediate run after paint (helps override old component unmount/revert side effects)
|
|
60
|
-
handleScroll('auto')
|
|
61
|
-
|
|
62
|
-
// Double-check inside requestAnimationFrame to catch concurrent renders or dynamic layout recalculations
|
|
63
|
-
const rafId = requestAnimationFrame(() => {
|
|
64
|
-
handleScroll('auto')
|
|
65
|
-
// Dispatch resize event so external components/scroll libraries (like GSAP ScrollTrigger) recalculate trigger offsets
|
|
66
|
-
window.dispatchEvent(new Event('resize'))
|
|
67
|
-
})
|
|
68
|
-
|
|
69
|
-
return () => cancelAnimationFrame(rafId)
|
|
70
|
-
}, [pathname, hash])
|
|
71
|
-
|
|
72
|
-
return null
|
|
73
|
-
}
|
|
74
|
-
|