boltdocs 2.5.6 → 2.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. package/bin/boltdocs.js +2 -2
  2. package/dist/client/index.cjs +6 -0
  3. package/dist/client/{index.d.mts → index.d.cts} +135 -265
  4. package/dist/client/index.d.ts +136 -266
  5. package/dist/client/index.js +1 -1
  6. package/dist/client/theme/neutral.css +90 -50
  7. package/dist/node/cli-entry.cjs +2 -2
  8. package/dist/node/cli-entry.mjs +2 -2
  9. package/dist/node/index.cjs +1 -1
  10. package/dist/node/index.d.cts +168 -205
  11. package/dist/node/index.d.mts +168 -205
  12. package/dist/node/index.mjs +1 -1
  13. package/dist/node-CWN8U_p8.mjs +88 -0
  14. package/dist/node-D5iosYXv.cjs +88 -0
  15. package/dist/{package-OFZf0s2j.mjs → package-DukYeKmD.mjs} +1 -1
  16. package/dist/{package-BY8Jd2j4.cjs → package-c99Cs7mD.cjs} +1 -1
  17. package/dist/search-dialog-3lvKsbVG.js +6 -0
  18. package/dist/search-dialog-DMK5OpgH.cjs +6 -0
  19. package/dist/use-search-C9bxCqfF.js +6 -0
  20. package/dist/use-search-DcfZSunO.cjs +6 -0
  21. package/package.json +21 -23
  22. package/src/client/app/config-context.tsx +38 -5
  23. package/src/client/app/doc-page.tsx +34 -0
  24. package/src/client/app/mdx-component.tsx +2 -3
  25. package/src/client/app/mdx-components-context.tsx +27 -2
  26. package/src/client/app/routes-context.tsx +34 -0
  27. package/src/client/app/scroll-handler.tsx +7 -4
  28. package/src/client/app/theme-context.tsx +71 -67
  29. package/src/client/components/docs-layout.tsx +1 -2
  30. package/src/client/components/icons-dev.tsx +36 -5
  31. package/src/client/components/mdx/admonition.tsx +11 -27
  32. package/src/client/components/mdx/badge.tsx +1 -1
  33. package/src/client/components/mdx/button.tsx +3 -3
  34. package/src/client/components/mdx/card.tsx +1 -1
  35. package/src/client/components/mdx/code-block.tsx +90 -80
  36. package/src/client/components/mdx/component-preview.tsx +1 -5
  37. package/src/client/components/mdx/component-props.tsx +1 -1
  38. package/src/client/components/mdx/field.tsx +4 -5
  39. package/src/client/components/mdx/file-tree.tsx +6 -3
  40. package/src/client/components/mdx/hooks/use-code-block.ts +2 -2
  41. package/src/client/components/mdx/image.tsx +1 -1
  42. package/src/client/components/mdx/link.tsx +2 -2
  43. package/src/client/components/mdx/list.tsx +1 -1
  44. package/src/client/components/mdx/table.tsx +1 -1
  45. package/src/client/components/mdx/tabs.tsx +1 -1
  46. package/src/client/components/primitives/breadcrumbs.tsx +1 -7
  47. package/src/client/components/primitives/button-group.tsx +1 -1
  48. package/src/client/components/primitives/button.tsx +1 -1
  49. package/src/client/components/primitives/code-block.tsx +113 -0
  50. package/src/client/components/primitives/link.tsx +23 -41
  51. package/src/client/components/primitives/menu.tsx +5 -6
  52. package/src/client/components/primitives/navbar.tsx +6 -18
  53. package/src/client/components/primitives/navigation-menu.tsx +4 -4
  54. package/src/client/components/primitives/on-this-page.tsx +6 -10
  55. package/src/client/components/primitives/page-nav.tsx +4 -9
  56. package/src/client/components/primitives/popover.tsx +1 -1
  57. package/src/client/components/primitives/search-dialog.tsx +3 -6
  58. package/src/client/components/primitives/sidebar.tsx +80 -22
  59. package/src/client/components/primitives/skeleton.tsx +1 -1
  60. package/src/client/components/primitives/tabs.tsx +4 -11
  61. package/src/client/components/primitives/tooltip.tsx +3 -3
  62. package/src/client/components/ui-base/breadcrumbs.tsx +4 -6
  63. package/src/client/components/ui-base/copy-markdown.tsx +2 -7
  64. package/src/client/components/ui-base/github-stars.tsx +2 -2
  65. package/src/client/components/ui-base/head.tsx +58 -51
  66. package/src/client/components/ui-base/loading.tsx +2 -2
  67. package/src/client/components/ui-base/navbar.tsx +12 -14
  68. package/src/client/components/ui-base/not-found.tsx +1 -1
  69. package/src/client/components/ui-base/on-this-page.tsx +6 -6
  70. package/src/client/components/ui-base/page-nav.tsx +4 -8
  71. package/src/client/components/ui-base/search-dialog.tsx +10 -8
  72. package/src/client/components/ui-base/sidebar.tsx +76 -23
  73. package/src/client/components/ui-base/tabs.tsx +9 -8
  74. package/src/client/components/ui-base/theme-toggle.tsx +2 -2
  75. package/src/client/hooks/use-i18n.ts +3 -3
  76. package/src/client/hooks/use-localized-to.ts +1 -1
  77. package/src/client/hooks/use-navbar.ts +8 -6
  78. package/src/client/hooks/use-routes.ts +19 -11
  79. package/src/client/hooks/use-search.ts +1 -1
  80. package/src/client/hooks/use-sidebar.ts +48 -2
  81. package/src/client/hooks/use-tabs.ts +6 -2
  82. package/src/client/hooks/use-version.ts +3 -3
  83. package/src/client/index.ts +20 -22
  84. package/src/client/ssg/boltdocs-shell.tsx +127 -0
  85. package/src/client/ssg/create-routes.tsx +179 -0
  86. package/src/client/ssg/index.ts +3 -0
  87. package/src/client/ssg/mdx-page.tsx +37 -0
  88. package/src/client/store/boltdocs-context.tsx +46 -99
  89. package/src/client/theme/neutral.css +90 -50
  90. package/src/client/types.ts +5 -33
  91. package/src/client/utils/react-to-text.ts +34 -0
  92. package/src/shared/config-utils.ts +12 -0
  93. package/src/shared/types.ts +171 -0
  94. package/dist/cache-Cr8W2zgZ.cjs +0 -6
  95. package/dist/cache-DFdakSmR.mjs +0 -6
  96. package/dist/client/index.mjs +0 -6
  97. package/dist/client/ssr.cjs +0 -6
  98. package/dist/client/ssr.d.cts +0 -80
  99. package/dist/client/ssr.d.mts +0 -80
  100. package/dist/client/ssr.mjs +0 -6
  101. package/dist/node-CWXme96p.mjs +0 -73
  102. package/dist/node-VYfhzGrh.cjs +0 -73
  103. package/dist/search-dialog-BeNyI_KQ.mjs +0 -6
  104. package/dist/search-dialog-dYsCAk5S.js +0 -6
  105. package/dist/use-search-D25n0PrV.mjs +0 -6
  106. package/dist/use-search-WuzdH1cJ.js +0 -6
  107. package/src/client/app/index.tsx +0 -348
  108. package/src/client/app/mdx-page.tsx +0 -15
  109. package/src/client/app/preload.tsx +0 -66
  110. package/src/client/app/router.tsx +0 -30
  111. package/src/client/components/default-layout.tsx +0 -90
  112. package/src/client/integrations/codesandbox.ts +0 -179
  113. package/src/client/integrations/index.ts +0 -1
  114. package/src/client/ssr.tsx +0 -65
@@ -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 e,{createContext as t,use as n,useCallback as r,useContext as i,useEffect as a,useImperativeHandle as o,useMemo as s,useRef as c,useState as l}from"react";import{useLocation as u}from"react-router-dom";import{Check as d,ChevronDown as f,ChevronLeft as p,ChevronRight as m,CornerDownLeft as ee,Dot as te,ExternalLink as ne,FileText as re,Hash as ie,Moon as ae,Search as h,Sun as oe}from"lucide-react";import*as g from"react-aria-components";import{Breadcrumb as se,Breadcrumbs as ce,Button as le,Link as _,Separator as ue,ToggleButton as de}from"react-aria-components";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";import{clsx as fe}from"clsx";import{twMerge as pe}from"tailwind-merge";import{cva as me}from"class-variance-authority";import he from"scroll-into-view-if-needed";import{Index as ge}from"flexsearch";import x from"virtual:boltdocs-search";const S=t(null);function C(){let e=n(S);if(!e)throw Error(`useConfig must be used within a ConfigProvider`);return e}const w=t({preload:()=>{},routes:[]});function T(){return n(w)}function _e({routes:e,modules:t,children:n}){let i=c(null),a=r(n=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{let r=n.split(`#`)[0].split(`?`)[0],i=e.find(e=>e.path===r||r===`/`&&e.path===``);if(i?.filePath){let e=Object.keys(t).find(e=>e.endsWith(`/`+i.filePath));e&&t[e]().catch(e=>{console.error(`[boltdocs] Failed to preload route ${n}:`,e)})}},100)},[e,t]);return y(w.Provider,{value:{preload:a,routes:e},children:n})}const E=t(void 0),D=`boltdocs-storage`;function ve(){try{let e=localStorage.getItem(D);if(e){let t=JSON.parse(e);return t?.state||t}}catch{}return{}}function ye({children:e}){let t=ve(),[n,i]=l(t.currentLocale),[o,s]=l(t.currentVersion),[c,u]=l(!1);a(()=>{u(!0)},[]),a(()=>{if(c){let e={currentLocale:n,currentVersion:o};try{localStorage.setItem(D,JSON.stringify({state:e}))}catch{}}},[n,o,c]);let d={currentLocale:n,currentVersion:o,hasHydrated:c,setLocale:r(e=>{i(e)},[]),setVersion:r(e=>{s(e)},[]),setHasHydrated:r(e=>{u(e)},[])};return y(E.Provider,{value:d,children:e})}function be(){let e=i(E);if(!e)throw Error(`useBoltdocsContext must be used within a BoltdocsProvider`);return e}function O(e){return e(be())}function k(){let{routes:e}=T(),t=C(),n=u(),r=O(e=>e.currentLocale),i=O(e=>e.currentVersion),a=O(e=>e.hasHydrated),o=e.find(e=>e.path===n.pathname),s=t.i18n?o?.locale||(a?r:void 0)||t.i18n.defaultLocale:void 0,c=t.versions?o?.version||(a?i:void 0)||t.versions.defaultVersion:void 0,l=e.filter(n=>{let r=t.i18n?(n.locale||t.i18n.defaultLocale)===s:!0,i=t.versions?(n.version||t.versions.defaultVersion)===c:!0;if(!(r&&i))return!1;let a=t.i18n;if(a){let t=!!o?.locale,r=!!n.locale;if(e.some(e=>e!==n&&e.filePath===n.filePath&&e.version===n.version&&(e.locale||a.defaultLocale)===(n.locale||a.defaultLocale))&&t!==r)return!1}return!0}),d=t.i18n?.localeConfigs?.[s]?.label||t.i18n?.locales[s]||s,f=t.versions?.versions.find(e=>e.path===c)?.label||c;return{routes:l,allRoutes:e,currentRoute:o,currentLocale:s,currentLocaleLabel:d,availableLocales:t.i18n?Object.entries(t.i18n.locales).map(([e,n])=>({key:e,label:t.i18n?.localeConfigs?.[e]?.label||n,isCurrent:e===s})):[],currentVersion:c,currentVersionLabel:f,availableVersions:t.versions?t.versions.versions.map(e=>({key:e.path,label:e.label,isCurrent:e.path===c})):[],config:t}}function A(e){let t=C(),{currentLocale:n,currentVersion:r}=k();if(!t||typeof e!=`string`||e.startsWith(`http`)||e.startsWith(`//`))return e;let i=t.i18n,a=t.versions;if(!i&&!a)return e;let o=e.startsWith(`/docs`),s=e.split(`/`).filter(Boolean),c=0;s[c]===`docs`&&c++,a&&s.length>c&&a.versions.find(e=>e.path===s[c])&&c++,i&&s.length>c&&i.locales[s[c]]&&c++;let l=s.slice(c),u=[];o&&(u.push(`docs`),a&&r&&u.push(r)),i&&n&&n!==i.defaultLocale&&u.push(n),u.push(...l);let d=`/${u.join(`/`)}`;return d.length>1&&d.endsWith(`/`)?d.slice(0,-1):d||`/`}function j(...e){return pe(fe(e))}const M=e.forwardRef((e,t)=>{let{href:n,prefetch:r=`hover`,onMouseEnter:i,onFocus:a,...o}=e,s=A(n??``),{preload:c}=T(),l=e=>{i?.(e),r===`hover`&&typeof s==`string`&&s.startsWith(`/`)&&c(s)},u=e=>{a?.(e),r===`hover`&&typeof s==`string`&&s.startsWith(`/`)&&c(s)};return y(_,{...o,ref:t,href:s,onMouseEnter:l,onFocus:u})});M.displayName=`Link`;const N=e.forwardRef((e,t)=>{let{href:n,end:r=!1,className:i,children:a,...o}=e,s=u(),c=A(n??``),l=r?s.pathname===c:s.pathname.startsWith(c),d=typeof i==`function`?i({isActive:l}):j(i,l&&`active`),f=typeof a==`function`?a({isActive:l}):a;return y(M,{...o,ref:t,href:n,className:d,children:f})});N.displayName=`NavLink`;const P=me(`flex flex-row items-center justify-center w-auto font-semibold tracking-tight no-underline whitespace-nowrap select-none outline-none transition-all duration-200 cursor-pointer pressed:scale-[0.97] hover:-translate-y-px leading-none`,{variants:{variant:{primary:`bg-primary-500 text-white shadow-md hover:brightness-110 hover:shadow-lg`,secondary:`bg-bg-surface text-text-main border border-border-subtle hover:bg-bg-muted hover:border-border-strong`,outline:`bg-transparent text-text-main border border-border-strong hover:bg-bg-surface hover:border-primary-500`,ghost:`bg-transparent text-text-muted hover:bg-bg-surface hover:text-text-main`,danger:`bg-[var(--color-danger-500)]/10 text-[var(--color-danger-500)] border border-[var(--color-danger-500)]/20 hover:bg-[var(--color-danger-500)]/15`,success:`bg-[var(--color-success-500)]/10 text-[var(--color-success-500)] border border-[var(--color-success-500)]/20 hover:bg-[var(--color-success-500)]/15`,warning:`bg-[var(--color-warning-500)]/10 text-[var(--color-warning-500)] border border-[var(--color-warning-500)]/20 hover:bg-[var(--color-warning-500)]/15`,info:`bg-[var(--color-info-500)]/10 text-[var(--color-info-500)] border border-[var(--color-info-500)]/20 hover:bg-[var(--color-info-500)]/15`,subtle:`bg-primary-500/10 text-primary-500 hover:bg-primary-500/20`,link:`bg-transparent text-primary-500 !p-0 !min-h-0 hover:underline`},size:{sm:`min-h-8 px-3.5 text-[0.8125rem] gap-1.5`,md:`min-h-10 px-5 text-[0.9375rem] gap-2`,lg:`min-h-12 px-7 text-[1.05rem] gap-2.5`},rounded:{none:`rounded-none`,sm:`rounded-sm`,md:`rounded-md`,lg:`rounded-lg`,full:`rounded-full`},iconSize:{sm:`w-8 h-8 p-0`,md:`w-10 h-10 p-0`,lg:`w-12 h-12 p-0`},disabled:{true:`opacity-50 cursor-not-allowed pointer-events-none`,false:null}},defaultVariants:{variant:`primary`,size:`md`,rounded:`md`}}),xe=({href:e,icon:t,iconPosition:n=`left`,isIconOnly:r,children:i,className:a,variant:o,size:s,rounded:c,iconSize:l,disabled:u,...d})=>{let f=r||!i&&!!t,p=f?y(`span`,{className:`inline-flex items-center justify-center [&>svg]:w-[1.2rem] [&>svg]:h-[1.2rem]`,children:t}):b(v,{children:[t&&n===`left`&&y(`span`,{className:`inline-flex items-center shrink-0 [&>svg]:w-[1.1rem] [&>svg]:h-[1.1rem]`,children:t}),y(`span`,{className:`flex items-center`,children:i}),t&&n===`right`&&y(`span`,{className:`inline-flex items-center shrink-0 [&>svg]:w-[1.1rem] [&>svg]:h-[1.1rem]`,children:t})]});return e?y(g.Link,{href:e,className:j(P({variant:o,size:s,rounded:c,iconSize:f?l:void 0,disabled:u}),a),...d,children:p}):y(g.Button,{className:j(P({variant:o,size:s,rounded:c,iconSize:f?l:void 0,disabled:u}),a),...d,children:p})};function F(e){let{size:t=20,...n}=e;return{...n,width:t,height:t}}const I=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,...F(e),children:[y(`title`,{children:`GitHub`}),y(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})]}),Se=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,...F(e),children:[y(`title`,{children:`Discord`}),y(`path`,{d:`M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418Z`})]}),Ce=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,...F(e),children:[y(`title`,{children:`X`}),y(`path`,{d:`M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z`})]}),we=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,...F(e),children:[y(`title`,{children:`Bluesky`}),y(`path`,{d:`M5.202 2.857C7.954 4.922 10.913 9.11 12 11.358c1.087-2.247 4.046-6.436 6.798-8.501C20.783 1.366 24 .213 24 3.883c0 .732-.42 6.156-.667 7.037-.856 3.061-3.978 3.842-6.755 3.37 4.854.826 6.089 3.562 3.422 6.299-5.065 5.196-7.28-1.304-7.847-2.97-.104-.305-.152-.448-.153-.327 0-.121-.05.022-.153.327-.568 1.666-2.782 8.166-7.847 2.97-2.667-2.737-1.432-5.473 3.422-6.3-2.777.473-5.899-.308-6.755-3.369C.42 10.04 0 4.615 0 3.883c0-3.67 3.217-2.517 5.202-1.026`})]}),Te=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...F(e),children:[y(`title`,{children:`TypeScript`}),y(`path`,{fill:`#2563EB`,d:`M3.234 9.093V7.318h8.363v1.775H8.479V17.5H6.352V9.093H3.234zm15.263 1.153c-.04-.4-.21-.712-.512-.934-.301-.222-.71-.333-1.228-.333-.351 0-.648.05-.89.149-.242.096-.427.23-.557.403a.969.969 0 0 0-.189.586.838.838 0 0 0 .115.477c.086.136.204.254.353.353.149.097.321.181.517.254.195.07.404.13.626.179l.915.219c.444.1.852.232 1.223.397.371.166.693.37.965.612.271.242.482.527.631.855.152.328.23.704.234 1.129-.004.623-.163 1.163-.478 1.62-.311.454-.762.807-1.352 1.06-.587.248-1.294.372-2.123.372-.822 0-1.538-.126-2.147-.378-.607-.252-1.081-.624-1.422-1.118-.338-.497-.516-1.112-.532-1.845h2.083c.023.342.12.627.293.855.176.226.41.397.701.513a2.8 2.8 0 0 0 1 .168c.364 0 .68-.053.949-.159a1.45 1.45 0 0 0 .631-.442c.15-.189.224-.406.224-.651a.846.846 0 0 0-.204-.577c-.132-.156-.328-.288-.586-.398a5.964 5.964 0 0 0-.94-.298l-1.109-.278c-.858-.21-1.536-.536-2.033-.98-.497-.444-.744-1.042-.74-1.795-.004-.616.16-1.155.491-1.615.335-.461.794-.82 1.377-1.08.584-.258 1.247-.387 1.99-.387.755 0 1.414.13 1.978.388.567.258 1.007.618 1.322 1.079.315.46.477.994.488 1.6h-2.064z`})]}),Ee=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...F(e),children:[y(`title`,{children:`JavaScript`}),y(`path`,{fill:`#F59E0B`,d:`M8.383 7.318h2.127v7.1c0 .656-.147 1.226-.442 1.71a2.924 2.924 0 01-1.218 1.118c-.52.262-1.125.393-1.815.393-.613 0-1.17-.107-1.67-.323a2.67 2.67 0 01-1.183-.994c-.292-.448-.436-1.01-.433-1.686h2.143c.006.269.061.5.164.691.106.19.25.335.432.438.186.1.405.15.657.15.265 0 .488-.057.67-.17.186-.116.327-.285.423-.507.096-.222.145-.496.145-.82v-7.1zm9.43 2.928c-.04-.4-.21-.712-.511-.934-.302-.222-.711-.333-1.228-.333-.352 0-.648.05-.89.149-.242.096-.428.23-.557.403a.969.969 0 00-.19.586.838.838 0 00.115.477c.087.136.204.254.353.353.15.097.322.181.517.254.196.07.405.13.627.179l.915.219c.444.1.851.232 1.223.397.37.166.692.37.964.612s.482.527.631.855a2.7 2.7 0 01.234 1.129c-.003.623-.162 1.163-.477 1.62-.312.454-.763.807-1.353 1.06-.586.248-1.294.372-2.122.372-.822 0-1.538-.126-2.148-.378-.607-.252-1.08-.624-1.422-1.118-.338-.497-.515-1.112-.532-1.845h2.083c.023.342.121.627.293.855.176.226.41.397.702.513.295.112.628.168.999.168.364 0 .68-.053.95-.159.271-.106.482-.253.63-.442.15-.189.224-.406.224-.651a.846.846 0 00-.203-.577c-.133-.156-.329-.288-.587-.398a5.964 5.964 0 00-.94-.298l-1.108-.278c-.859-.21-1.537-.536-2.034-.98-.497-.444-.744-1.042-.74-1.795-.004-.616.16-1.155.492-1.615.334-.461.793-.82 1.377-1.08.583-.258 1.246-.387 1.989-.387.755 0 1.415.13 1.978.388.567.258 1.008.618 1.323 1.079.314.46.477.994.487 1.6h-2.063z`})]}),De=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...F(e),children:[y(`title`,{children:`JSON`}),y(`path`,{fill:`#F59E0B`,d:`M4.778 6.667A2.667 2.667 0 017.444 4a.889.889 0 010 1.778.889.889 0 00-.888.889v3.5c0 .701-.273 1.35-.73 1.833.457.483.73 1.132.73 1.832v3.501c0 .491.398.89.888.89a.889.889 0 010 1.777 2.667 2.667 0 01-2.666-2.667v-3.5a.889.889 0 00-.674-.863l-.43-.108a.889.889 0 010-1.724l.43-.108a.889.889 0 00.674-.862V6.667zm14.222 0A2.667 2.667 0 0016.333 4a.889.889 0 000 1.778c.491 0 .89.398.89.889v3.5c0 .701.272 1.35.729 1.833a2.664 2.664 0 00-.73 1.832v3.501a.889.889 0 01-.889.89.889.889 0 000 1.777A2.667 2.667 0 0019 17.333v-3.5c0-.408.278-.764.673-.863l.431-.108a.889.889 0 000-1.724l-.43-.108a.889.889 0 01-.674-.862V6.667z`})]}),Oe=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...F(e),children:[y(`title`,{children:`CSS`}),y(`path`,{fill:`#0EA5E9`,d:`M4.778 6.667A2.667 2.667 0 017.444 4a.889.889 0 010 1.778.889.889 0 00-.888.889v3.5c0 .701-.273 1.35-.73 1.833.457.483.73 1.132.73 1.832v3.501c0 .491.398.89.888.89a.889.889 0 010 1.777 2.667 2.667 0 01-2.666-2.667v-3.5a.889.889 0 00-.674-.863l-.43-.108a.889.889 0 010-1.724l.43-.108a.889.889 0 00.674-.862V6.667zm14.222 0A2.667 2.667 0 0016.333 4a.889.889 0 000 1.778c.491 0 .89.398.89.889v3.5c0 .701.272 1.35.729 1.833a2.664 2.664 0 00-.73 1.832v3.501a.889.889 0 01-.889.89.889.889 0 000 1.777A2.667 2.667 0 0019 17.333v-3.5c0-.408.278-.764.673-.863l.431-.108a.889.889 0 000-1.724l-.43-.108a.889.889 0 01-.674-.862V6.667z`})]}),ke=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...F(e),children:[y(`title`,{children:`HTML`}),y(`path`,{fill:`#EA580C`,d:`M4.778 6.667A2.667 2.667 0 017.444 4a.889.889 0 010 1.778.889.889 0 00-.888.889v3.5c0 .701-.273 1.35-.73 1.833.457.483.73 1.132.73 1.832v3.501c0 .491.398.89.888.89a.889.889 0 010 1.777 2.667 2.667 0 01-2.666-2.667v-3.5a.889.889 0 00-.674-.863l-.43-.108a.889.889 0 010-1.724l.43-.108a.889.889 0 00.674-.862V6.667zm14.222 0A2.667 2.667 0 0016.333 4a.889.889 0 000 1.778c.491 0 .89.398.89.889v3.5c0 .701.272 1.35.729 1.833a2.664 2.664 0 00-.73 1.832v3.501a.889.889 0 01-.889.89.889.889 0 000 1.777A2.667 2.667 0 0019 17.333v-3.5c0-.408.278-.764.673-.863l.431-.108a.889.889 0 000-1.724l-.43-.108a.889.889 0 01-.674-.862V6.667z`})]}),Ae=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...F(e),children:[y(`title`,{children:`React`}),y(`path`,{fill:`#0E8ADC`,d:`M12 13.677a1.677 1.677 0 100-3.354 1.677 1.677 0 000 3.354z`}),y(`path`,{stroke:`#0E8ADC`,d:`M12 15.436c4.97 0 9-1.538 9-3.436s-4.03-3.436-9-3.436S3 10.102 3 12s4.03 3.436 9 3.436z`}),y(`path`,{stroke:`#0E8ADC`,d:`M9.024 13.718c2.485 4.305 5.832 7.025 7.476 6.076 1.644-.949.961-5.208-1.524-9.512C12.491 5.977 9.144 3.257 7.5 4.206c-1.644.949-.961 5.208 1.524 9.512z`}),y(`path`,{stroke:`#0E8ADC`,d:`M9.024 10.282c-2.485 4.304-3.168 8.563-1.524 9.512 1.644.95 4.99-1.771 7.476-6.076 2.485-4.304 3.168-8.563 1.524-9.512-1.644-.95-4.99 1.771-7.476 6.076z`})]}),je=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...F(e),children:[y(`title`,{children:`Markdown`}),y(`path`,{fill:`#60A5FA`,d:`M3 15.714V8h2.323l2.322 2.836L9.968 8h2.322v7.714H9.968V11.29l-2.323 2.836-2.322-2.836v4.424H3zm14.516 0l-3.484-3.743h2.323V8h2.322v3.97H21l-3.484 3.744z`})]}),Me=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 25 24`,...F(e),children:[y(`title`,{children:`Shell`}),y(`path`,{stroke:`#14B8A6`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M4.336 17l6-6-6-6M12.336 19h8`})]}),Ne=e=>b(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...F(e),children:[y(`title`,{children:`YAML`}),y(`path`,{fill:`#A78BFA`,d:`M6.533 5.864h2.755l2.654 5.011h.113l2.654-5.011h2.756l-4.245 7.522V17.5h-2.443v-4.114L6.533 5.864z`})]}),L=({className:e,children:t,...n})=>y(g.Tooltip,{...n,offset:8,className:t=>j(`group z-50 overflow-visible rounded-md bg-bg-surface/90 px-2.5 py-1.5 text-xs font-medium text-text-main shadow-lg backdrop-blur-md ring-1 ring-border-subtle outline-hidden select-none`,`data-entering:animate-in data-entering:fade-in data-entering:zoom-in-95 data-entering:duration-100`,`data-exiting:animate-out data-exiting:fade-out data-exiting:zoom-out-95 data-exiting:duration-75`,`data-[placement=top]:slide-in-from-bottom-1`,`data-[placement=bottom]:slide-in-from-top-1`,`data-[placement=left]:slide-in-from-right-1`,`data-[placement=right]:slide-in-from-left-1`,typeof e==`function`?e(t):e),children:e=>b(v,{children:[y(g.OverlayArrow,{children:b(`svg`,{width:8,height:8,viewBox:`0 0 8 8`,className:`fill-bg-surface/90 stroke-border-subtle group-data-[placement=bottom]:rotate-180 group-data-[placement=left]:-rotate-90 group-data-[placement=right]:rotate-90`,children:[y(`title`,{children:`Arrow`}),y(`path`,{d:`M0 0 L4 4 L8 0`})]})}),typeof t==`function`?t(e):t]})}),R=({content:e,children:t,delay:n=500,closeDelay:r=0,...i})=>b(g.TooltipTrigger,{delay:n,closeDelay:r,children:[t,y(L,{...i,children:e})]});R.Root=R,R.Content=L;const z=({children:e,className:t,...n})=>y(`header`,{className:j(`boltdocs-navbar sticky top-0 z-50 w-full border-b border-border-subtle bg-bg-main/80 backdrop-blur-md`,t),...n,children:e}),Pe=({children:e,className:t})=>y(`div`,{className:j(`mx-auto flex lg:h-navbar max-w-(--breakpoint-3xl) items-center justify-between px-4 md:px-6`,t),children:e}),Fe=({children:e,className:t})=>y(`div`,{className:j(`flex flex-1 items-center justify-start gap-4 min-w-0`,t),children:e}),Ie=({children:e,className:t})=>y(`div`,{className:j(`flex flex-1 items-center justify-end gap-2 md:gap-4 min-w-0`,t),children:e}),Le=({children:e,className:t})=>y(`div`,{className:j(`hidden lg:flex flex-1 justify-center items-center gap-4 px-4 min-w-0 w-full`,t),children:e}),Re=({src:e,alt:t,width:n=24,height:r=24,className:i})=>y(M,{href:`/`,className:j(`flex items-center gap-2 shrink-0 outline-none`,i),children:e?y(`img`,{src:e,alt:t,width:n,height:r,className:`h-6 w-6 object-contain`}):null}),ze=({children:e,className:t})=>y(M,{href:`/`,children:y(`span`,{className:j(`text-lg font-bold tracking-tight hidden sm:inline-block`,t),children:e})}),Be=({children:e,className:t})=>y(`nav`,{className:j(`hidden md:flex items-center gap-6 text-sm font-medium`,t),children:e}),Ve=({label:e,href:t,active:n,to:r,className:i})=>b(M,{href:t,target:r===`external`?`_blank`:void 0,className:j(`transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm`,{"text-primary-500":n,"text-text-muted hover:text-text-main":!n},i),children:[e,r===`external`&&y(`span`,{className:`ml-1 inline-block`,children:y(ne,{size:12})})]}),He=({className:e,onPress:t})=>{let[n,r]=l(!1),i=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);return a(()=>{r(!0)},[]),b(le,{onPress:t,className:j(`flex items-center gap-2 rounded-full border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-muted outline-none cursor-pointer`,`transition-all duration-200 hover:border-border-strong hover:text-text-main hover:bg-bg-muted hover:shadow-sm active:scale-[0.98]`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,`w-full max-w-[720px] justify-between`,e),children:[b(`div`,{className:`flex items-center gap-2`,children:[y(h,{size:16}),y(`span`,{className:`hidden sm:inline-block`,children:`Search docs...`})]}),b(`div`,{className:`hidden sm:flex items-center gap-1 pointer-events-none select-none`,children:[y(`kbd`,{className:`flex h-5 items-center justify-center rounded border border-border-subtle bg-bg-main px-1.5 font-mono text-[10px] font-medium`,children:i?`⌘`:`Ctrl`}),y(`kbd`,{className:`flex h-5 w-5 items-center justify-center rounded border border-border-subtle bg-bg-main font-mono text-[10px] font-medium`,children:`K`})]})]})},Ue=({className:e,theme:t,onThemeChange:n})=>y(de,{isSelected:t===`dark`,onChange:n,className:j(`rounded-md p-2 text-text-muted outline-none cursor-pointer`,`transition-all duration-300 hover:bg-bg-surface hover:text-text-main hover:rotate-12 active:scale-90`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,e),"aria-label":`Toggle theme`,children:y(t===`dark`?oe:ae,{size:20})}),We=({name:e})=>{if(e===`github`)return y(I,{});if(e===`discord`)return y(Se,{});if(e===`x`)return y(Ce,{});if(e===`bluesky`)return y(we,{})};z.Root=z,z.Left=Fe,z.Right=Ie,z.Center=Le,z.Logo=Re,z.Title=ze,z.Links=Be,z.Link=Ve,z.SearchTrigger=He,z.Theme=Ue,z.Socials=({icon:e,link:t,className:n})=>y(M,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:j(`rounded-md p-2 text-text-muted outline-none transition-colors`,`hover:bg-bg-surface hover:text-text-main`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,n),children:y(We,{name:e})}),z.Split=({className:e})=>y(ue,{orientation:`vertical`,className:j(`h-6 w-px bg-border-subtle mx-1`,e)}),z.Content=Pe;const B=({children:e,className:t,...n})=>y(`nav`,{className:j(`relative flex items-center`,t),...n,children:e});B.Root=B,B.List=({children:e,className:t})=>y(`div`,{className:j(`flex list-none items-center gap-1`,t),children:e}),B.Item=({children:e,label:t,className:n})=>b(g.MenuTrigger,{children:[b(g.Button,{className:j(`flex items-center gap-1 rounded-md px-3 py-1.5 text-sm font-medium outline-none transition-colors cursor-pointer`,`text-text-muted hover:bg-bg-surface hover:text-text-main`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,n),children:[t,y(f,{size:14,className:`transition-transform`})]}),y(g.Popover,{placement:`bottom start`,className:`entering:animate-in entering:fade-in entering:zoom-in-95 exiting:animate-out exiting:fade-out exiting:zoom-out-95 fill-mode-forwards`,children:y(g.Menu,{className:`w-56 outline-none rounded-xl border border-border-subtle bg-bg-surface p-2 shadow-xl ring-1 ring-border-strong/5`,children:e})})]}),B.Link=({label:e,href:t,description:n,className:r,children:i,...a})=>y(g.MenuItem,{href:t,className:j(`block rounded-lg px-3 py-2 text-sm outline-none cursor-pointer transition-colors`,`hover:bg-bg-muted focus:bg-bg-muted`,r),...a,children:i||b(v,{children:[y(`div`,{className:`font-semibold text-text-main`,children:e}),n&&y(`div`,{className:`text-xs text-text-muted line-clamp-1 mt-0.5`,children:n})]})});const V=({children:e,isOpen:t,onOpenChange:n,className:r})=>y(g.ModalOverlay,{isOpen:t,onOpenChange:n,isDismissable:!0,className:j(`fixed inset-0 z-100 bg-black/40 backdrop-blur-sm px-4 py-4 sm:py-20`,`entering:animate-in entering:fade-in exiting:animate-out exiting:fade-out`),children:y(g.Modal,{className:j(`mx-auto w-full max-w-2xl overflow-hidden rounded-xl border border-border-subtle bg-bg-surface shadow-2xl ring-1 ring-black/5 outline-none`,`entering:animate-in entering:fade-in entering:zoom-in-95 exiting:animate-out exiting:fade-out exiting:zoom-out-95`,r),children:y(g.Dialog,{className:`flex flex-col max-h-[70vh] focus:outline-none`,children:e})})});V.Root=V,V.Autocomplete=({children:e,className:t,onSelectionChange:n,...r})=>{let i=g.Autocomplete;return y(`div`,{className:t,children:y(i,{...r,onSelectionChange:n,className:`flex flex-col min-h-0`,children:e})})},V.Input=({className:e,...t})=>b(g.SearchField,{className:`flex items-center gap-3 border-b border-border-subtle px-4 py-4`,autoFocus:!0,children:[y(h,{className:`h-5 w-5 text-text-muted`}),y(g.Input,{...t,className:j(`w-full bg-transparent text-lg text-text-main placeholder-text-muted outline-none`,e),placeholder:`Search documentation...`}),y(`div`,{className:`flex items-center gap-1.5 rounded-md border border-border-subtle bg-bg-main px-1.5 py-1 text-[10px] font-medium text-text-muted`,children:y(`kbd`,{className:`font-sans`,children:`ESC`})})]}),V.List=({children:e,className:t,...n})=>y(g.ListBox,{...n,className:j(`flex-1 overflow-y-auto p-2 outline-none`,t),children:e}),V.Item=Object.assign(({children:e,className:t,...n})=>y(g.ListBoxItem,{...n,className:j(`group flex items-center gap-3 rounded-lg p-3 text-left outline-none cursor-pointer transition-colors`,`text-text-muted hover:bg-bg-main hover:text-text-main focus:bg-primary-500 focus:text-white selected:bg-primary-500 selected:text-white`,t),children:t=>b(v,{children:[e,(t.isFocused||t.isSelected)&&b(`div`,{className:`ml-auto opacity-50 flex items-center gap-1`,children:[y(`span`,{className:`text-[10px]`,children:`Select`}),y(ee,{size:10})]})]})}),{Icon:({isHeading:e,className:t})=>y(`div`,{className:j(`shrink-0`,t),children:y(e?ie:re,{size:18})}),Title:({children:e,className:t})=>y(`span`,{className:j(`block font-medium truncate flex-1 text-sm`,t),children:e}),Bio:({children:e,className:t})=>y(`span`,{className:j(`ml-2 text-xs opacity-70 truncate hidden sm:inline group-focus:opacity-100`,t),children:e})});function Ge(e,t){let n=c(e);a(()=>{n.current!==e&&(t(e),n.current=e)},[e,t])}function H(e){return e.startsWith(`#`)?e.slice(1):null}var Ke=class{items=[];single=!1;observer=null;onChange;callback(e){if(e.length===0)return;for(let t of e){let e=this.items.find(e=>e.id===t.target.id);e&&(e.active=t.isIntersecting,e.fallback=!t.isIntersecting&&t.boundingClientRect.top<100)}let t=-1;for(let e=this.items.length-1;e>=0;e--)if(this.items[e].fallback){t=e;break}t===-1&&this.items.length>0&&(t=0),this.items=this.items.map((e,n)=>({...e,active:n===t,t:n===t?Date.now():e.t})),this.onChange?.()}setItems(e){let t=this.observer;if(t)for(let e of this.items){let n=document.getElementById(e.id);n&&t.unobserve(n)}this.items=[];for(let t of e){let e=H(t.url);e&&this.items.push({id:e,active:!1,fallback:!1,t:0,original:t})}this.watchItems(),typeof window<`u`&&(setTimeout(()=>this.watchItems(),100),setTimeout(()=>this.watchItems(),500),setTimeout(()=>this.watchItems(),1e3)),this.onChange?.()}watch(e){this.observer||(this.observer=new IntersectionObserver(this.callback.bind(this),e),this.watchItems())}watchItems(){if(this.observer)for(let e of this.items){let t=document.getElementById(e.id);t&&this.observer.observe(t)}}unwatch(){this.observer?.disconnect(),this.observer=null}};const U=t(null),W=t(null);function G(){let e=n(U);if(!e)throw Error(`Component must be used under the <AnchorProvider /> component.`);return e}function qe(){let e=G();return s(()=>{let t;for(let n of e)n.active&&(!t||n.t>t.t)&&(t=n);return t?.id},[e])}function Je(){let e=G();return s(()=>{let t=[];for(let n of e)n.active&&t.push(n.id);return t},[e])}function Ye({containerRef:e,children:t}){return y(W.Provider,{value:e,children:t})}function Xe({toc:e,single:t=!1,children:n}){let r=s(()=>new Ke,[]),[i,o]=l(r.items);return r.single=t,a(()=>{r.setItems(e)},[r,e]),a(()=>(r.watch({rootMargin:`-100px 0% 0% 0%`,threshold:0}),r.onChange=()=>o([...r.items]),()=>{r.unwatch()}),[r]),y(U.Provider,{value:i,children:n})}const K=({children:e,className:t})=>y(`nav`,{className:j(`sticky top-navbar hidden xl:flex flex-col shrink-0`,`w-toc`,`py-8 pl-6 pr-4`,t),children:e}),Ze=({children:e,className:t,...n})=>y(`div`,{className:j(`mb-4 text-xs font-bold uppercase tracking-wider text-text-main`,t),...n,children:e}),q=({children:e,className:t,ref:n,...r})=>{let i=c(null);return o(n,()=>i.current),y(`div`,{ref:i,className:j(`relative overflow-y-auto boltdocs-otp-content`,t),...r,children:e})};q.displayName=`OnThisPageContent`,K.Root=K,K.Header=Ze,K.Content=q,K.List=({children:e,className:t})=>y(`ul`,{className:j(`relative space-y-1 text-sm border-l border-border-subtle`,t),children:e}),K.Item=({level:e,children:t,className:n})=>y(`li`,{className:j(e===3&&`pl-3`,n),children:t}),K.Link=({children:e,href:t,active:r,onClick:i,className:o})=>{let s=n(U),u=n(W),d=t?H(t):null,f=c(null),[p,m]=l(r);return Ge(d&&s?s.find(e=>e.id===d)?.active:null,e=>{e!==null&&e!==p&&(m(!!e),e&&f.current&&u?.current&&he(f.current,{behavior:`smooth`,block:`center`,inline:`center`,scrollMode:`if-needed`,boundary:u.current}))}),a(()=>{r!==void 0&&m(r)},[r]),y(`a`,{ref:f,href:t,onClick:i,"data-active":p,className:j(`block py-1 pl-4 text-[13px] outline-none transition-colors hover:text-text-main`,p?`text-primary-500 font-medium`:`text-text-muted`,o),children:e})},K.Indicator=({style:e,className:t})=>y(`div`,{className:j(`absolute -left-px w-0.5 rounded-full bg-primary-500 transition-all duration-300`,t),style:e});const J=({children:e,className:t})=>y(`nav`,{className:j(`grid grid-cols-1 sm:grid-cols-2 gap-4 mt-12 pt-8 border-t border-border-subtle`,t),children:e});J.Root=J,J.Link=({children:e,to:t,direction:n,className:r})=>{let i=n===`next`;return b(g.Link,{href:t,className:j(`flex group items-center p-4 rounded-xl border border-border-subtle bg-bg-surface outline-none`,`transition-all hover:bg-bg-main hover:border-primary-500 hover:shadow-lg`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,i?`text-right justify-end`:`text-left justify-start`,r),children:[!i&&y(p,{className:`mr-3 h-5 w-5 text-text-muted group-hover:text-primary-500 transition-transform group-hover:-translate-x-1`}),y(`div`,{className:`flex flex-col gap-1 flex-1`,children:e}),i&&y(m,{className:`ml-3 h-5 w-5 text-text-muted group-hover:text-primary-500 transition-transform group-hover:translate-x-1`})]})},J.Title=({children:e,className:t})=>y(`span`,{className:j(`text-xs font-medium uppercase tracking-wider text-text-muted`,t),children:e}),J.Description=({children:e,className:t})=>y(`span`,{className:j(`text-base font-bold text-text-main truncate`,t),children:e}),J.Icon=({children:e})=>y(v,{children:e});const Y=({children:e,className:t=``,...n})=>y(`div`,{className:j(`w-full`,t),...n,children:e});Y.Root=Y,Y.List=({children:e,className:t=``})=>y(`div`,{role:`tablist`,className:j(`relative flex flex-row items-center border-b border-border-subtle`,t),children:e}),Y.Item=({children:e,id:t,selected:n,className:r=``,...i})=>y(`button`,{role:`tab`,"aria-selected":n,className:j(`flex items-center gap-2 px-4 py-2 text-sm font-medium transition-colors outline-none cursor-pointer bg-transparent border-none`,n?`text-primary-500`:`text-text-muted hover:text-text-main`,r),...i,children:e}),Y.Content=({children:e,className:t=``})=>y(`div`,{className:j(`p-4 outline-none`,t),children:e}),Y.Indicator=({className:e=``,style:t})=>y(`div`,{className:j(`absolute bottom-0 h-0.5 bg-primary-500 transition-all duration-300`,e),style:t});const Qe=({badge:e})=>{let t={new:`bg-primary-500/20 text-primary-500`,updated:`bg-gray-500/20 text-gray-500`,deprecated:`bg-red-500/20 text-red-500`};if(typeof e==`object`&&e?.expires){let t=new Date(e.expires),n=new Date,r=t.getTime()-n.getTime();if(Math.ceil(r/(1e3*60*60*24))===0)return null}let n=typeof e==`string`?e:e?.text;return y(`span`,{className:j(`ml-auto flex h-4.5 items-center rounded-full text-[9px] font-medium px-1.5 py-0.5 text-center whitespace-nowrap`,t[n]||t.new),children:n})},X=({children:e,className:t})=>y(`aside`,{className:j(`boltdocs-sidebar sticky top-navbar hidden lg:flex flex-col shrink-0`,`w-sidebar h-full`,`overflow-y-auto border-r border-border-subtle bg-bg-main`,`py-6 px-4`,t),children:y(`nav`,{className:`flex-1 space-y-6`,children:e})});X.Root=X,X.Group=({children:e,title:t,icon:n,isOpen:r=!0,onToggle:i,className:a})=>b(`div`,{className:j(`space-y-1`,a),children:[t&&b(g.Button,{onPress:i,className:j(`flex w-full items-center justify-between px-2 py-1.5 text-xs font-bold uppercase tracking-wider outline-none cursor-pointer`,`text-text-muted hover:text-text-main transition-colors`,`focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-md`),children:[b(`div`,{className:`flex items-center gap-2`,children:[n&&y(n,{size:14}),t]}),y(m,{size:14,className:j(`transition-transform duration-200`,r&&`rotate-90`)})]}),r&&y(`div`,{className:`space-y-0.5`,children:e})]}),X.GroupItem=({children:e,className:t})=>y(`div`,{className:j(t),children:e}),X.Link=({label:e,href:t,active:n,icon:r,badge:i,className:a})=>b(M,{href:t,className:j(`group flex items-center gap-2.5 rounded-lg px-2.5 py-2 text-sm outline-none`,`transition-all duration-200 ease-in-out`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,n?`bg-primary-500/10 text-primary-500 font-medium`:`text-text-muted hover:bg-bg-surface hover:text-text-main hover:translate-x-1`,a),children:[r&&y(r,{size:16,className:j(n?`text-primary-500`:`text-text-muted group-hover:text-text-main`)}),y(`span`,{className:`truncate`,children:e}),i&&y(Qe,{badge:i})]});const Z=({children:e,className:t,...n})=>y(ce,{className:j(`flex items-center gap-1.5 pl-0! mb-0 text-sm text-text-muted`,t),...n,children:e});Z.Root=Z,Z.Item=({children:e,className:t,...n})=>y(se,{className:j(`flex items-center mb-0 gap-1.5`,t),...n,children:e}),Z.Link=({children:e,href:t,className:n,...r})=>y(_,{href:t,className:j(`transition-colors outline-none hover:text-text-main focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm`,`current:font-medium current:text-text-main current:pointer-events-none cursor-pointer`,n),...r,children:e}),Z.Separator=({className:e})=>y(m,{size:14,className:j(`shrink-0 text-text-dim`,e)});const $e=({children:e,className:t,vertical:n=!1})=>y(`div`,{className:j(`inline-flex`,n?`flex-col`:`flex-row`,!n&&[`[&>*:not(:first-child)]:-ml-px`,`[&>*:first-child]:rounded-r-none`,`[&>*:last-child]:rounded-l-none`,`[&>*:not(:first-child):not(:last-child)]:rounded-none`,t?.includes(`rounded-full`)&&[`[&>*:first-child]:rounded-l-full`,`[&>*:last-child]:rounded-r-full`],t?.includes(`rounded-xl`)&&[`[&>*:first-child]:rounded-l-xl`,`[&>*:last-child]:rounded-r-xl`],t?.includes(`rounded-lg`)&&[`[&>*:first-child]:rounded-l-lg`,`[&>*:last-child]:rounded-r-lg`]],n&&[`[&>*:not(:first-child)]:-mt-px`,`[&>*:first-child]:rounded-b-none`,`[&>*:last-child]:rounded-t-none`,`[&>*:not(:first-child):not(:last-child)]:rounded-none`,t?.includes(`rounded-full`)&&[`[&>*:first-child]:rounded-t-full`,`[&>*:last-child]:rounded-b-full`]],t),children:e}),Q=({children:e,className:t,showArrow:n,...r})=>b(g.Popover,{offset:8,...r,className:g.composeRenderProps(t,e=>j(`z-50 overflow-auto rounded-xl border border-border-subtle bg-bg-surface/80 shadow-xl backdrop-blur-md outline-none transition-none`,e)),children:[n&&y(g.OverlayArrow,{className:`group`,children:y(`svg`,{viewBox:`0 0 12 12`,className:`block h-3 w-3 fill-bg-surface/80 stroke-border-subtle group-placement-bottom:rotate-180 group-placement-left:-rotate-90 group-placement-right:rotate-90`,"aria-hidden":`true`,children:y(`path`,{d:`M0 0 L6 6 L12 0`})})}),e]});function et(t){let[n,r]=e.Children.toArray(t.children).slice(0,2);return b(g.MenuTrigger,{...t,children:[n,y(Q,{placement:t.placement,className:`min-w-35`,children:r})]})}function tt(t){let[n,r]=e.Children.toArray(t.children).slice(0,2);return b(g.SubmenuTrigger,{...t,children:[n,y(Q,{offset:-4,crossOffset:-4,children:r})]})}function $(e){return y(g.Menu,{...e,className:g.composeRenderProps(e.className,e=>j(`p-1.5 outline-none max-h-[inherit] overflow-auto max-w-75`,e))})}function nt(e){let t=e.textValue||(typeof e.children==`string`?e.children:void 0);return y(g.MenuItem,{...e,textValue:t,className:g.composeRenderProps(e.className,(e,{isFocused:t,isPressed:n,isDisabled:r})=>j(`group relative flex flex-row items-center gap-2 px-2 py-1 rounded-lg outline-none cursor-default hover:cursor-pointer transition-none`,`text-text-main text-[12px]`,{"bg-bg-surface-elevated text-primary-600 ring-1 ring-border-strong/5":t,"bg-bg-surface-elevanted":n,"opacity-40 grayscale pointer-events-none":r},e)),children:g.composeRenderProps(e.children,(e,{selectionMode:t,isSelected:n,hasSubmenu:r})=>b(v,{children:[t!==`none`&&b(`span`,{className:`flex items-center size-4 shrink-0 justify-center`,children:[n&&t===`multiple`&&y(d,{className:`size-3.5 stroke-[2.5px] text-primary-500 animate-in zoom-in-50 duration-200`}),n&&t===`single`&&y(te,{className:`size-5 text-primary-500 animate-in zoom-in-50 duration-200`})]}),y(`div`,{className:`flex flex-row w-full transition-colors items-center gap-2 py-1 px-1`,children:e}),r&&y(m,{className:`size-4 ml-auto text-text-muted group-focused:text-primary-500/70 transition-colors`})]}))})}function rt({title:e,...t}){return b(g.MenuSection,{...t,className:j(`flex flex-col gap-0.5`,t.className),children:[e&&y(g.Header,{className:`px-3 py-2 text-[10px] font-bold uppercase tracking-[0.075em] text-text-muted/50 select-none`,children:e}),y(g.Collection,{items:t.items,children:t.children})]})}function it(e){return y(g.Separator,{...e,className:`mx-2 my-1.5 border-t border-border-subtle/50`})}$.Root=$,$.Item=nt,$.Trigger=et,$.SubTrigger=tt,$.Section=rt,$.Separator=it;function at({className:e,variant:t=`rect`,...n}){return y(`div`,{className:j(`animate-pulse bg-bg-muted`,t===`circle`?`rounded-full`:`rounded-md`,e),...n})}function ot(e){let{currentLocale:t,currentVersion:n}=k(),[r,i]=l(!1),[o,c]=l(``),[u,d]=l(null);return a(()=>{if(!r||u)return;let e=new ge({preset:`match`,tokenize:`full`,resolution:9,cache:!0});for(let t of x)e.add(t.id,`${t.title} ${t.content}`);d(e)},[r,u]),{isOpen:r,setIsOpen:i,query:o,setQuery:c,list:s(()=>{if(!o)return e.filter(e=>{let r=!t||e.locale===t,i=!n||e.version===n;return r&&i}).slice(0,10).map(e=>({id:e.path,title:e.title,path:e.path,bio:e.description||``,groupTitle:e.groupTitle}));if(!u)return[];let r=u.search(o,{limit:20,suggest:!0}),i=[],a=new Set;for(let e of r){let r=x.find(t=>t.id===e);if(!r)continue;let o=!t||r.locale===t,s=!n||r.version===n;!o||!s||a.has(r.url)||(a.add(r.url),i.push({id:r.url,title:r.title,path:r.url,bio:r.display,groupTitle:r.display.split(` > `)[0],isHeading:r.url.includes(`#`)}))}return i.slice(0,10)},[o,u,t,n,e]),input:{value:o,onChange:e=>c(e.target.value)}}}export{xe as A,S as B,Ee as C,Me as D,Ae as E,A as F,k as I,ye as L,M,N,Te as O,j as P,O as R,I as S,je as T,C as V,B as _,$e as a,ke as b,Y as c,K as d,Ye as f,V as g,G as h,Q as i,P as j,Ne as k,J as l,Je as m,at as n,Z as o,qe as p,$ as r,X as s,ot as t,Xe as u,z as v,De as w,Oe as x,R as y,_e as z};
@@ -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
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`react`);l=c(l);let u=require(`react-router-dom`),d=require(`lucide-react`),f=require(`react-aria-components`);f=c(f);let p=require(`react/jsx-runtime`),m=require(`clsx`),ee=require(`tailwind-merge`),h=require(`flexsearch`),g=require(`virtual:boltdocs-search`);g=c(g);const _=(0,l.createContext)(null);function v(){let e=(0,l.use)(_);if(!e)throw Error(`useConfig must be used within a ConfigProvider`);return e}const y=(0,l.createContext)({preload:()=>{},routes:[]});function b(){return(0,l.use)(y)}function x({routes:e,modules:t,children:n}){let r=(0,l.useRef)(null),i=(0,l.useCallback)(n=>{r.current&&clearTimeout(r.current),r.current=setTimeout(()=>{let r=n.split(`#`)[0].split(`?`)[0],i=e.find(e=>e.path===r||r===`/`&&e.path===``);if(i?.filePath){let e=Object.keys(t).find(e=>e.endsWith(`/`+i.filePath));e&&t[e]().catch(e=>{console.error(`[boltdocs] Failed to preload route ${n}:`,e)})}},100)},[e,t]);return(0,p.jsx)(y.Provider,{value:{preload:i,routes:e},children:n})}const S=(0,l.createContext)(void 0),C=`boltdocs-storage`;function te(){try{let e=localStorage.getItem(C);if(e){let t=JSON.parse(e);return t?.state||t}}catch{}return{}}function w({children:e}){let t=te(),[n,r]=(0,l.useState)(t.currentLocale),[i,a]=(0,l.useState)(t.currentVersion),[o,s]=(0,l.useState)(!1);(0,l.useEffect)(()=>{s(!0)},[]),(0,l.useEffect)(()=>{if(o){let e={currentLocale:n,currentVersion:i};try{localStorage.setItem(C,JSON.stringify({state:e}))}catch{}}},[n,i,o]);let c={currentLocale:n,currentVersion:i,hasHydrated:o,setLocale:(0,l.useCallback)(e=>{r(e)},[]),setVersion:(0,l.useCallback)(e=>{a(e)},[]),setHasHydrated:(0,l.useCallback)(e=>{s(e)},[])};return(0,p.jsx)(S.Provider,{value:c,children:e})}function T(){let e=(0,l.useContext)(S);if(!e)throw Error(`useBoltdocsContext must be used within a BoltdocsProvider`);return e}function E(e){return e(T())}function D(){let{routes:e}=b(),t=v(),n=(0,u.useLocation)(),r=E(e=>e.currentLocale),i=E(e=>e.currentVersion),a=E(e=>e.hasHydrated),o=e.find(e=>e.path===n.pathname),s=t.i18n?o?.locale||(a?r:void 0)||t.i18n.defaultLocale:void 0,c=t.versions?o?.version||(a?i:void 0)||t.versions.defaultVersion:void 0,l=e.filter(n=>{let r=t.i18n?(n.locale||t.i18n.defaultLocale)===s:!0,i=t.versions?(n.version||t.versions.defaultVersion)===c:!0;if(!(r&&i))return!1;let a=t.i18n;if(a){let t=!!o?.locale,r=!!n.locale;if(e.some(e=>e!==n&&e.filePath===n.filePath&&e.version===n.version&&(e.locale||a.defaultLocale)===(n.locale||a.defaultLocale))&&t!==r)return!1}return!0}),d=t.i18n?.localeConfigs?.[s]?.label||t.i18n?.locales[s]||s,f=t.versions?.versions.find(e=>e.path===c)?.label||c;return{routes:l,allRoutes:e,currentRoute:o,currentLocale:s,currentLocaleLabel:d,availableLocales:t.i18n?Object.entries(t.i18n.locales).map(([e,n])=>({key:e,label:t.i18n?.localeConfigs?.[e]?.label||n,isCurrent:e===s})):[],currentVersion:c,currentVersionLabel:f,availableVersions:t.versions?t.versions.versions.map(e=>({key:e.path,label:e.label,isCurrent:e.path===c})):[],config:t}}function O(e){let t=v(),{currentLocale:n,currentVersion:r}=D();if(!t||typeof e!=`string`||e.startsWith(`http`)||e.startsWith(`//`))return e;let i=t.i18n,a=t.versions;if(!i&&!a)return e;let o=e.startsWith(`/docs`),s=e.split(`/`).filter(Boolean),c=0;s[c]===`docs`&&c++,a&&s.length>c&&a.versions.find(e=>e.path===s[c])&&c++,i&&s.length>c&&i.locales[s[c]]&&c++;let l=s.slice(c),u=[];o&&(u.push(`docs`),a&&r&&u.push(r)),i&&n&&n!==i.defaultLocale&&u.push(n),u.push(...l);let d=`/${u.join(`/`)}`;return d.length>1&&d.endsWith(`/`)?d.slice(0,-1):d||`/`}function k(...e){return(0,ee.twMerge)((0,m.clsx)(e))}const A=l.default.forwardRef((e,t)=>{let{href:n,prefetch:r=`hover`,onMouseEnter:i,onFocus:a,...o}=e,s=O(n??``),{preload:c}=b(),l=e=>{i?.(e),r===`hover`&&typeof s==`string`&&s.startsWith(`/`)&&c(s)},u=e=>{a?.(e),r===`hover`&&typeof s==`string`&&s.startsWith(`/`)&&c(s)};return(0,p.jsx)(f.Link,{...o,ref:t,href:s,onMouseEnter:l,onFocus:u})});A.displayName=`Link`;const j=l.default.forwardRef((e,t)=>{let{href:n,end:r=!1,className:i,children:a,...o}=e,s=(0,u.useLocation)(),c=O(n??``),l=r?s.pathname===c:s.pathname.startsWith(c),d=typeof i==`function`?i({isActive:l}):k(i,l&&`active`),f=typeof a==`function`?a({isActive:l}):a;return(0,p.jsx)(A,{...o,ref:t,href:n,className:d,children:f})});j.displayName=`NavLink`;function M(e){let{size:t=20,...n}=e;return{...n,width:t,height:t}}const N=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,...M(e),children:[(0,p.jsx)(`title`,{children:`GitHub`}),(0,p.jsx)(`path`,{d:`M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12`})]}),P=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,...M(e),children:[(0,p.jsx)(`title`,{children:`Discord`}),(0,p.jsx)(`path`,{d:`M20.317 4.37a19.791 19.791 0 0 0-4.885-1.515.074.074 0 0 0-.079.037c-.21.375-.444.864-.608 1.25a18.27 18.27 0 0 0-5.487 0 12.64 12.64 0 0 0-.617-1.25.077.077 0 0 0-.079-.037A19.736 19.736 0 0 0 3.677 4.37a.07.07 0 0 0-.032.027C.533 9.046-.32 13.58.099 18.057a.082.082 0 0 0 .031.057 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.028c.462-.63.874-1.295 1.226-1.994a.076.076 0 0 0-.041-.106 13.107 13.107 0 0 1-1.872-.892.077.077 0 0 1-.008-.128 10.2 10.2 0 0 0 .372-.292.074.074 0 0 1 .077-.01c3.928 1.793 8.18 1.793 12.062 0a.074.074 0 0 1 .078.01c.12.098.246.198.373.292a.077.077 0 0 1-.006.127 12.299 12.299 0 0 1-1.873.892.077.077 0 0 0-.041.107c.36.698.772 1.362 1.225 1.993a.076.076 0 0 0 .084.028 19.839 19.839 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-5.177-.838-9.674-3.549-13.66a.061.061 0 0 0-.031-.03zM8.02 15.33c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.956-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.956 2.418-2.157 2.418zm7.975 0c-1.183 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.176 1.096 2.157 2.42 0 1.333-.946 2.418-2.157 2.418Z`})]}),F=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,...M(e),children:[(0,p.jsx)(`title`,{children:`X`}),(0,p.jsx)(`path`,{d:`M14.234 10.162 22.977 0h-2.072l-7.591 8.824L7.251 0H.258l9.168 13.343L.258 24H2.33l8.016-9.318L16.749 24h6.993zm-2.837 3.299-.929-1.329L3.076 1.56h3.182l5.965 8.532.929 1.329 7.754 11.09h-3.182z`})]}),I=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,...M(e),children:[(0,p.jsx)(`title`,{children:`Bluesky`}),(0,p.jsx)(`path`,{d:`M5.202 2.857C7.954 4.922 10.913 9.11 12 11.358c1.087-2.247 4.046-6.436 6.798-8.501C20.783 1.366 24 .213 24 3.883c0 .732-.42 6.156-.667 7.037-.856 3.061-3.978 3.842-6.755 3.37 4.854.826 6.089 3.562 3.422 6.299-5.065 5.196-7.28-1.304-7.847-2.97-.104-.305-.152-.448-.153-.327 0-.121-.05.022-.153.327-.568 1.666-2.782 8.166-7.847 2.97-2.667-2.737-1.432-5.473 3.422-6.3-2.777.473-5.899-.308-6.755-3.369C.42 10.04 0 4.615 0 3.883c0-3.67 3.217-2.517 5.202-1.026`})]}),L=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...M(e),children:[(0,p.jsx)(`title`,{children:`TypeScript`}),(0,p.jsx)(`path`,{fill:`#2563EB`,d:`M3.234 9.093V7.318h8.363v1.775H8.479V17.5H6.352V9.093H3.234zm15.263 1.153c-.04-.4-.21-.712-.512-.934-.301-.222-.71-.333-1.228-.333-.351 0-.648.05-.89.149-.242.096-.427.23-.557.403a.969.969 0 0 0-.189.586.838.838 0 0 0 .115.477c.086.136.204.254.353.353.149.097.321.181.517.254.195.07.404.13.626.179l.915.219c.444.1.852.232 1.223.397.371.166.693.37.965.612.271.242.482.527.631.855.152.328.23.704.234 1.129-.004.623-.163 1.163-.478 1.62-.311.454-.762.807-1.352 1.06-.587.248-1.294.372-2.123.372-.822 0-1.538-.126-2.147-.378-.607-.252-1.081-.624-1.422-1.118-.338-.497-.516-1.112-.532-1.845h2.083c.023.342.12.627.293.855.176.226.41.397.701.513a2.8 2.8 0 0 0 1 .168c.364 0 .68-.053.949-.159a1.45 1.45 0 0 0 .631-.442c.15-.189.224-.406.224-.651a.846.846 0 0 0-.204-.577c-.132-.156-.328-.288-.586-.398a5.964 5.964 0 0 0-.94-.298l-1.109-.278c-.858-.21-1.536-.536-2.033-.98-.497-.444-.744-1.042-.74-1.795-.004-.616.16-1.155.491-1.615.335-.461.794-.82 1.377-1.08.584-.258 1.247-.387 1.99-.387.755 0 1.414.13 1.978.388.567.258 1.007.618 1.322 1.079.315.46.477.994.488 1.6h-2.064z`})]}),R=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...M(e),children:[(0,p.jsx)(`title`,{children:`JavaScript`}),(0,p.jsx)(`path`,{fill:`#F59E0B`,d:`M8.383 7.318h2.127v7.1c0 .656-.147 1.226-.442 1.71a2.924 2.924 0 01-1.218 1.118c-.52.262-1.125.393-1.815.393-.613 0-1.17-.107-1.67-.323a2.67 2.67 0 01-1.183-.994c-.292-.448-.436-1.01-.433-1.686h2.143c.006.269.061.5.164.691.106.19.25.335.432.438.186.1.405.15.657.15.265 0 .488-.057.67-.17.186-.116.327-.285.423-.507.096-.222.145-.496.145-.82v-7.1zm9.43 2.928c-.04-.4-.21-.712-.511-.934-.302-.222-.711-.333-1.228-.333-.352 0-.648.05-.89.149-.242.096-.428.23-.557.403a.969.969 0 00-.19.586.838.838 0 00.115.477c.087.136.204.254.353.353.15.097.322.181.517.254.196.07.405.13.627.179l.915.219c.444.1.851.232 1.223.397.37.166.692.37.964.612s.482.527.631.855a2.7 2.7 0 01.234 1.129c-.003.623-.162 1.163-.477 1.62-.312.454-.763.807-1.353 1.06-.586.248-1.294.372-2.122.372-.822 0-1.538-.126-2.148-.378-.607-.252-1.08-.624-1.422-1.118-.338-.497-.515-1.112-.532-1.845h2.083c.023.342.121.627.293.855.176.226.41.397.702.513.295.112.628.168.999.168.364 0 .68-.053.95-.159.271-.106.482-.253.63-.442.15-.189.224-.406.224-.651a.846.846 0 00-.203-.577c-.133-.156-.329-.288-.587-.398a5.964 5.964 0 00-.94-.298l-1.108-.278c-.859-.21-1.537-.536-2.034-.98-.497-.444-.744-1.042-.74-1.795-.004-.616.16-1.155.492-1.615.334-.461.793-.82 1.377-1.08.583-.258 1.246-.387 1.989-.387.755 0 1.415.13 1.978.388.567.258 1.008.618 1.323 1.079.314.46.477.994.487 1.6h-2.063z`})]}),z=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...M(e),children:[(0,p.jsx)(`title`,{children:`JSON`}),(0,p.jsx)(`path`,{fill:`#F59E0B`,d:`M4.778 6.667A2.667 2.667 0 017.444 4a.889.889 0 010 1.778.889.889 0 00-.888.889v3.5c0 .701-.273 1.35-.73 1.833.457.483.73 1.132.73 1.832v3.501c0 .491.398.89.888.89a.889.889 0 010 1.777 2.667 2.667 0 01-2.666-2.667v-3.5a.889.889 0 00-.674-.863l-.43-.108a.889.889 0 010-1.724l.43-.108a.889.889 0 00.674-.862V6.667zm14.222 0A2.667 2.667 0 0016.333 4a.889.889 0 000 1.778c.491 0 .89.398.89.889v3.5c0 .701.272 1.35.729 1.833a2.664 2.664 0 00-.73 1.832v3.501a.889.889 0 01-.889.89.889.889 0 000 1.777A2.667 2.667 0 0019 17.333v-3.5c0-.408.278-.764.673-.863l.431-.108a.889.889 0 000-1.724l-.43-.108a.889.889 0 01-.674-.862V6.667z`})]}),B=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...M(e),children:[(0,p.jsx)(`title`,{children:`CSS`}),(0,p.jsx)(`path`,{fill:`#0EA5E9`,d:`M4.778 6.667A2.667 2.667 0 017.444 4a.889.889 0 010 1.778.889.889 0 00-.888.889v3.5c0 .701-.273 1.35-.73 1.833.457.483.73 1.132.73 1.832v3.501c0 .491.398.89.888.89a.889.889 0 010 1.777 2.667 2.667 0 01-2.666-2.667v-3.5a.889.889 0 00-.674-.863l-.43-.108a.889.889 0 010-1.724l.43-.108a.889.889 0 00.674-.862V6.667zm14.222 0A2.667 2.667 0 0016.333 4a.889.889 0 000 1.778c.491 0 .89.398.89.889v3.5c0 .701.272 1.35.729 1.833a2.664 2.664 0 00-.73 1.832v3.501a.889.889 0 01-.889.89.889.889 0 000 1.777A2.667 2.667 0 0019 17.333v-3.5c0-.408.278-.764.673-.863l.431-.108a.889.889 0 000-1.724l-.43-.108a.889.889 0 01-.674-.862V6.667z`})]}),V=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...M(e),children:[(0,p.jsx)(`title`,{children:`HTML`}),(0,p.jsx)(`path`,{fill:`#EA580C`,d:`M4.778 6.667A2.667 2.667 0 017.444 4a.889.889 0 010 1.778.889.889 0 00-.888.889v3.5c0 .701-.273 1.35-.73 1.833.457.483.73 1.132.73 1.832v3.501c0 .491.398.89.888.89a.889.889 0 010 1.777 2.667 2.667 0 01-2.666-2.667v-3.5a.889.889 0 00-.674-.863l-.43-.108a.889.889 0 010-1.724l.43-.108a.889.889 0 00.674-.862V6.667zm14.222 0A2.667 2.667 0 0016.333 4a.889.889 0 000 1.778c.491 0 .89.398.89.889v3.5c0 .701.272 1.35.729 1.833a2.664 2.664 0 00-.73 1.832v3.501a.889.889 0 01-.889.89.889.889 0 000 1.777A2.667 2.667 0 0019 17.333v-3.5c0-.408.278-.764.673-.863l.431-.108a.889.889 0 000-1.724l-.43-.108a.889.889 0 01-.674-.862V6.667z`})]}),H=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...M(e),children:[(0,p.jsx)(`title`,{children:`React`}),(0,p.jsx)(`path`,{fill:`#0E8ADC`,d:`M12 13.677a1.677 1.677 0 100-3.354 1.677 1.677 0 000 3.354z`}),(0,p.jsx)(`path`,{stroke:`#0E8ADC`,d:`M12 15.436c4.97 0 9-1.538 9-3.436s-4.03-3.436-9-3.436S3 10.102 3 12s4.03 3.436 9 3.436z`}),(0,p.jsx)(`path`,{stroke:`#0E8ADC`,d:`M9.024 13.718c2.485 4.305 5.832 7.025 7.476 6.076 1.644-.949.961-5.208-1.524-9.512C12.491 5.977 9.144 3.257 7.5 4.206c-1.644.949-.961 5.208 1.524 9.512z`}),(0,p.jsx)(`path`,{stroke:`#0E8ADC`,d:`M9.024 10.282c-2.485 4.304-3.168 8.563-1.524 9.512 1.644.95 4.99-1.771 7.476-6.076 2.485-4.304 3.168-8.563 1.524-9.512-1.644-.95-4.99 1.771-7.476 6.076z`})]}),U=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...M(e),children:[(0,p.jsx)(`title`,{children:`Markdown`}),(0,p.jsx)(`path`,{fill:`#60A5FA`,d:`M3 15.714V8h2.323l2.322 2.836L9.968 8h2.322v7.714H9.968V11.29l-2.323 2.836-2.322-2.836v4.424H3zm14.516 0l-3.484-3.743h2.323V8h2.322v3.97H21l-3.484 3.744z`})]}),W=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 25 24`,...M(e),children:[(0,p.jsx)(`title`,{children:`Shell`}),(0,p.jsx)(`path`,{stroke:`#14B8A6`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`2`,d:`M4.336 17l6-6-6-6M12.336 19h8`})]}),G=e=>(0,p.jsxs)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,fill:`none`,viewBox:`0 0 24 24`,...M(e),children:[(0,p.jsx)(`title`,{children:`YAML`}),(0,p.jsx)(`path`,{fill:`#A78BFA`,d:`M6.533 5.864h2.755l2.654 5.011h.113l2.654-5.011h2.756l-4.245 7.522V17.5h-2.443v-4.114L6.533 5.864z`})]}),K=({children:e,className:t,...n})=>(0,p.jsx)(`header`,{className:k(`boltdocs-navbar sticky top-0 z-50 w-full border-b border-border-subtle bg-bg-main/80 backdrop-blur-md`,t),...n,children:e}),q=({children:e,className:t})=>(0,p.jsx)(`div`,{className:k(`mx-auto flex lg:h-navbar max-w-(--breakpoint-3xl) items-center justify-between px-4 md:px-6`,t),children:e}),J=({children:e,className:t})=>(0,p.jsx)(`div`,{className:k(`flex flex-1 items-center justify-start gap-4 min-w-0`,t),children:e}),Y=({children:e,className:t})=>(0,p.jsx)(`div`,{className:k(`flex flex-1 items-center justify-end gap-2 md:gap-4 min-w-0`,t),children:e}),X=({children:e,className:t})=>(0,p.jsx)(`div`,{className:k(`hidden lg:flex flex-1 justify-center items-center gap-4 px-4 min-w-0 w-full`,t),children:e}),Z=({src:e,alt:t,width:n=24,height:r=24,className:i})=>(0,p.jsx)(A,{href:`/`,className:k(`flex items-center gap-2 shrink-0 outline-none`,i),children:e?(0,p.jsx)(`img`,{src:e,alt:t,width:n,height:r,className:`h-6 w-6 object-contain`}):null}),ne=({children:e,className:t})=>(0,p.jsx)(A,{href:`/`,children:(0,p.jsx)(`span`,{className:k(`text-lg font-bold tracking-tight hidden sm:inline-block`,t),children:e})}),Q=({children:e,className:t})=>(0,p.jsx)(`nav`,{className:k(`hidden md:flex items-center gap-6 text-sm font-medium`,t),children:e}),re=({label:e,href:t,active:n,to:r,className:i})=>(0,p.jsxs)(A,{href:t,target:r===`external`?`_blank`:void 0,className:k(`transition-colors outline-none font-medium focus-visible:ring-2 focus-visible:ring-primary-500/30 rounded-sm`,{"text-primary-500":n,"text-text-muted hover:text-text-main":!n},i),children:[e,r===`external`&&(0,p.jsx)(`span`,{className:`ml-1 inline-block`,children:(0,p.jsx)(d.ExternalLink,{size:12})})]}),ie=({className:e,onPress:t})=>{let[n,r]=(0,l.useState)(!1),i=n&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);return(0,l.useEffect)(()=>{r(!0)},[]),(0,p.jsxs)(f.Button,{onPress:t,className:k(`flex items-center gap-2 rounded-full border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-muted outline-none cursor-pointer`,`transition-all duration-200 hover:border-border-strong hover:text-text-main hover:bg-bg-muted hover:shadow-sm active:scale-[0.98]`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,`w-full max-w-[720px] justify-between`,e),children:[(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(d.Search,{size:16}),(0,p.jsx)(`span`,{className:`hidden sm:inline-block`,children:`Search docs...`})]}),(0,p.jsxs)(`div`,{className:`hidden sm:flex items-center gap-1 pointer-events-none select-none`,children:[(0,p.jsx)(`kbd`,{className:`flex h-5 items-center justify-center rounded border border-border-subtle bg-bg-main px-1.5 font-mono text-[10px] font-medium`,children:i?`⌘`:`Ctrl`}),(0,p.jsx)(`kbd`,{className:`flex h-5 w-5 items-center justify-center rounded border border-border-subtle bg-bg-main font-mono text-[10px] font-medium`,children:`K`})]})]})},ae=({className:e,theme:t,onThemeChange:n})=>(0,p.jsx)(f.ToggleButton,{isSelected:t===`dark`,onChange:n,className:k(`rounded-md p-2 text-text-muted outline-none cursor-pointer`,`transition-all duration-300 hover:bg-bg-surface hover:text-text-main hover:rotate-12 active:scale-90`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,e),"aria-label":`Toggle theme`,children:t===`dark`?(0,p.jsx)(d.Sun,{size:20}):(0,p.jsx)(d.Moon,{size:20})}),oe=({name:e})=>{if(e===`github`)return(0,p.jsx)(N,{});if(e===`discord`)return(0,p.jsx)(P,{});if(e===`x`)return(0,p.jsx)(F,{});if(e===`bluesky`)return(0,p.jsx)(I,{})};K.Root=K,K.Left=J,K.Right=Y,K.Center=X,K.Logo=Z,K.Title=ne,K.Links=Q,K.Link=re,K.SearchTrigger=ie,K.Theme=ae,K.Socials=({icon:e,link:t,className:n})=>(0,p.jsx)(A,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:k(`rounded-md p-2 text-text-muted outline-none transition-colors`,`hover:bg-bg-surface hover:text-text-main`,`focus-visible:ring-2 focus-visible:ring-primary-500/30`,n),children:(0,p.jsx)(oe,{name:e})}),K.Split=({className:e})=>(0,p.jsx)(f.Separator,{orientation:`vertical`,className:k(`h-6 w-px bg-border-subtle mx-1`,e)}),K.Content=q;const $=({children:e,isOpen:t,onOpenChange:n,className:r})=>(0,p.jsx)(f.ModalOverlay,{isOpen:t,onOpenChange:n,isDismissable:!0,className:k(`fixed inset-0 z-100 bg-black/40 backdrop-blur-sm px-4 py-4 sm:py-20`,`entering:animate-in entering:fade-in exiting:animate-out exiting:fade-out`),children:(0,p.jsx)(f.Modal,{className:k(`mx-auto w-full max-w-2xl overflow-hidden rounded-xl border border-border-subtle bg-bg-surface shadow-2xl ring-1 ring-black/5 outline-none`,`entering:animate-in entering:fade-in entering:zoom-in-95 exiting:animate-out exiting:fade-out exiting:zoom-out-95`,r),children:(0,p.jsx)(f.Dialog,{className:`flex flex-col max-h-[70vh] focus:outline-none`,children:e})})});$.Root=$,$.Autocomplete=({children:e,className:t,onSelectionChange:n,...r})=>{let i=f.Autocomplete;return(0,p.jsx)(`div`,{className:t,children:(0,p.jsx)(i,{...r,onSelectionChange:n,className:`flex flex-col min-h-0`,children:e})})},$.Input=({className:e,...t})=>(0,p.jsxs)(f.SearchField,{className:`flex items-center gap-3 border-b border-border-subtle px-4 py-4`,autoFocus:!0,children:[(0,p.jsx)(d.Search,{className:`h-5 w-5 text-text-muted`}),(0,p.jsx)(f.Input,{...t,className:k(`w-full bg-transparent text-lg text-text-main placeholder-text-muted outline-none`,e),placeholder:`Search documentation...`}),(0,p.jsx)(`div`,{className:`flex items-center gap-1.5 rounded-md border border-border-subtle bg-bg-main px-1.5 py-1 text-[10px] font-medium text-text-muted`,children:(0,p.jsx)(`kbd`,{className:`font-sans`,children:`ESC`})})]}),$.List=({children:e,className:t,...n})=>(0,p.jsx)(f.ListBox,{...n,className:k(`flex-1 overflow-y-auto p-2 outline-none`,t),children:e}),$.Item=Object.assign(({children:e,className:t,...n})=>(0,p.jsx)(f.ListBoxItem,{...n,className:k(`group flex items-center gap-3 rounded-lg p-3 text-left outline-none cursor-pointer transition-colors`,`text-text-muted hover:bg-bg-main hover:text-text-main focus:bg-primary-500 focus:text-white selected:bg-primary-500 selected:text-white`,t),children:t=>(0,p.jsxs)(p.Fragment,{children:[e,(t.isFocused||t.isSelected)&&(0,p.jsxs)(`div`,{className:`ml-auto opacity-50 flex items-center gap-1`,children:[(0,p.jsx)(`span`,{className:`text-[10px]`,children:`Select`}),(0,p.jsx)(d.CornerDownLeft,{size:10})]})]})}),{Icon:({isHeading:e,className:t})=>(0,p.jsx)(`div`,{className:k(`shrink-0`,t),children:e?(0,p.jsx)(d.Hash,{size:18}):(0,p.jsx)(d.FileText,{size:18})}),Title:({children:e,className:t})=>(0,p.jsx)(`span`,{className:k(`block font-medium truncate flex-1 text-sm`,t),children:e}),Bio:({children:e,className:t})=>(0,p.jsx)(`span`,{className:k(`ml-2 text-xs opacity-70 truncate hidden sm:inline group-focus:opacity-100`,t),children:e})});function se(e){let{currentLocale:t,currentVersion:n}=D(),[r,i]=(0,l.useState)(!1),[a,o]=(0,l.useState)(``),[s,c]=(0,l.useState)(null);return(0,l.useEffect)(()=>{if(!r||s)return;let e=new h.Index({preset:`match`,tokenize:`full`,resolution:9,cache:!0});for(let t of g.default)e.add(t.id,`${t.title} ${t.content}`);c(e)},[r,s]),{isOpen:r,setIsOpen:i,query:a,setQuery:o,list:(0,l.useMemo)(()=>{if(!a)return e.filter(e=>{let r=!t||e.locale===t,i=!n||e.version===n;return r&&i}).slice(0,10).map(e=>({id:e.path,title:e.title,path:e.path,bio:e.description||``,groupTitle:e.groupTitle}));if(!s)return[];let r=s.search(a,{limit:20,suggest:!0}),i=[],o=new Set;for(let e of r){let r=g.default.find(t=>t.id===e);if(!r)continue;let a=!t||r.locale===t,s=!n||r.version===n;!a||!s||o.has(r.url)||(o.add(r.url),i.push({id:r.url,title:r.title,path:r.url,bio:r.display,groupTitle:r.display.split(` > `)[0],isHeading:r.url.includes(`#`)}))}return i.slice(0,10)},[a,s,t,n,e]),input:{value:a,onChange:e=>o(e.target.value)}}}Object.defineProperty(exports,`C`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`S`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`T`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`_`,{enumerable:!0,get:function(){return O}}),Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return B}}),Object.defineProperty(exports,`b`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return z}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,`f`,{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,`g`,{enumerable:!0,get:function(){return k}}),Object.defineProperty(exports,`h`,{enumerable:!0,get:function(){return j}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return V}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,`m`,{enumerable:!0,get:function(){return A}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return $}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,`p`,{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return R}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return H}}),Object.defineProperty(exports,`v`,{enumerable:!0,get:function(){return D}}),Object.defineProperty(exports,`w`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`x`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`y`,{enumerable:!0,get:function(){return w}});
@@ -1,348 +0,0 @@
1
- import React, { useEffect, useState, useMemo } from 'react'
2
- import { createRoot } from 'react-dom/client'
3
- import { BrowserRouter, Routes, Route } from 'react-router-dom'
4
- import { NotFound } from '@components/ui-base/not-found'
5
- import { ThemeProvider } from './theme-context'
6
- import type { ComponentRoute, CreateBoltdocsAppOptions } from '../types'
7
- import type { BoltdocsConfig } from '@node/config'
8
-
9
- import UserLayout from 'virtual:boltdocs-layout'
10
-
11
- import { PreloadProvider } from './preload'
12
- import { BoltdocsRouterProvider } from './router'
13
- import { ConfigContext } from './config-context'
14
- import { ScrollHandler } from './scroll-handler'
15
- import { DocsLayout } from './docs-layout'
16
- import { MdxPage } from './mdx-page'
17
- import { MdxComponentsProvider } from './mdx-components-context'
18
- import { mdxComponentsDefault } from './mdx-component'
19
- // @ts-ignore
20
- import virtualCustomComponents from 'virtual:boltdocs-mdx-components'
21
- import { useRoutes } from '../hooks/use-routes'
22
- import { useLocation } from 'react-router-dom'
23
- import { useBoltdocsStore } from '../store/boltdocs-context'
24
- import { BoltdocsProvider } from '../store/boltdocs-context'
25
-
26
- /**
27
- * Updates the HTML lang and dir attributes based on the current locale configuration.
28
- */
29
- function I18nUpdater() {
30
- const { currentLocale, config } = useRoutes()
31
-
32
- useEffect(() => {
33
- if (!config.i18n) return
34
- const localeConfig = config.i18n.localeConfigs?.[currentLocale as string]
35
- document.documentElement.lang =
36
- localeConfig?.htmlLang || currentLocale || 'en'
37
- document.documentElement.dir = localeConfig?.direction || 'ltr'
38
- }, [currentLocale, config.i18n])
39
-
40
- return null
41
- }
42
-
43
- /**
44
- * Synchronizes the Zustand store with the current URL pathname.
45
- */
46
- function StoreSync() {
47
- const location = useLocation()
48
- const { config } = useRoutes()
49
- const setLocale = useBoltdocsStore((s) => s.setLocale)
50
- const setVersion = useBoltdocsStore((s) => s.setVersion)
51
- const currentLocaleStore = useBoltdocsStore((s) => s.currentLocale)
52
- const currentVersionStore = useBoltdocsStore((s) => s.currentVersion)
53
-
54
- useEffect(() => {
55
- const parts = location.pathname.split('/').filter(Boolean)
56
- let cIdx = 0
57
- let detectedVersion = config.versions?.defaultVersion
58
- let detectedLocale = config.i18n?.defaultLocale
59
-
60
- // 0. Skip docs prefix if present
61
- if (parts[cIdx] === 'docs') cIdx++
62
-
63
- // 1. Version detection
64
- if (config.versions && parts.length > cIdx) {
65
- const versionMatch = config.versions.versions.find(
66
- (v) => v.path === parts[cIdx],
67
- )
68
- if (versionMatch) {
69
- detectedVersion = versionMatch.path
70
- cIdx++
71
- }
72
- }
73
-
74
- // 2. Locale detection
75
- if (
76
- config.i18n &&
77
- parts.length > cIdx &&
78
- config.i18n.locales[parts[cIdx]]
79
- ) {
80
- detectedLocale = parts[cIdx]
81
- } else if (config.i18n && parts.length === 0) {
82
- // On root, use the stored preference if it exists, otherwise default
83
- detectedLocale = currentLocaleStore || config.i18n.defaultLocale
84
- }
85
-
86
- // Only update if changed to avoid loops
87
- if (detectedLocale !== currentLocaleStore) setLocale(detectedLocale)
88
- if (detectedVersion !== currentVersionStore) setVersion(detectedVersion)
89
- }, [
90
- location.pathname,
91
- config,
92
- setLocale,
93
- setVersion,
94
- currentLocaleStore,
95
- currentVersionStore,
96
- ])
97
-
98
- return null
99
- }
100
-
101
- export function AppShell({
102
- initialRoutes,
103
- initialConfig,
104
- docsDirName,
105
- modules,
106
- hot,
107
- homePage: HomePage,
108
- externalPages,
109
- externalLayout: ExternalLayout,
110
- components: customComponents = {},
111
- }: {
112
- initialRoutes: ComponentRoute[]
113
- initialConfig: BoltdocsConfig
114
- docsDirName: string
115
- modules: Record<
116
- string,
117
- () => Promise<{ default: React.ComponentType<unknown> }>
118
- >
119
- hot?: CreateBoltdocsAppOptions['hot']
120
- homePage?: React.ComponentType
121
- externalPages?: Record<string, React.ComponentType>
122
- externalLayout?: React.ComponentType<{ children: React.ReactNode }>
123
- components?: Record<string, React.ComponentType>
124
- }) {
125
- const [routesInfo, setRoutesInfo] = useState<ComponentRoute[]>(initialRoutes)
126
- const [config, setConfig] = useState(initialConfig)
127
- const computedExternalPages = externalPages || {}
128
- const EffectiveExternalLayout = ExternalLayout || UserLayout
129
-
130
- const resolvedRoutes = useMemo(() => {
131
- return routesInfo
132
- .filter(
133
- (route) =>
134
- !(HomePage && (route.path === '/' || route.path === '')) &&
135
- !computedExternalPages[route.path === '' ? '/' : route.path],
136
- )
137
- .map((route) => {
138
- const loaderKey = Object.keys(modules).find(
139
- (k) =>
140
- k === `/${docsDirName}/${route.filePath}` || // Vite dev/build relative path
141
- k.endsWith(`/${docsDirName}/${route.filePath}`) || // SSG absolute path fallback
142
- k.endsWith(
143
- `/${docsDirName}\\${route.filePath.replace(/\\/g, '/')}`,
144
- ), // Windows fallback
145
- )
146
- const loader = loaderKey ? modules[loaderKey] : null
147
-
148
- return {
149
- ...route,
150
- Component: React.lazy<React.ComponentType<unknown>>(async () => {
151
- if (!loader)
152
- return { default: NotFound as React.ComponentType<unknown> }
153
- const mod = await loader()
154
- return mod as { default: React.ComponentType<unknown> }
155
- }),
156
- }
157
- })
158
- }, [routesInfo, modules, docsDirName, HomePage, computedExternalPages])
159
-
160
- // Subscribe to HMR events
161
- useEffect(() => {
162
- if (hot) {
163
- hot.on('boltdocs:routes-update', (newRoutes: ComponentRoute[]) => {
164
- setRoutesInfo(newRoutes)
165
- })
166
- hot.on('boltdocs:config-update', (newConfig: BoltdocsConfig) => {
167
- setConfig(newConfig)
168
- })
169
- }
170
- }, [hot])
171
-
172
- const allComponents = useMemo(
173
- () => ({
174
- ...mdxComponentsDefault,
175
- ...virtualCustomComponents,
176
- ...customComponents,
177
- }),
178
- [customComponents],
179
- )
180
-
181
- const LoadingFallback = allComponents.Loading as React.ComponentType
182
-
183
- return (
184
- <BoltdocsProvider>
185
- <ThemeProvider>
186
- <MdxComponentsProvider components={allComponents}>
187
- <ConfigContext.Provider value={config}>
188
- <BoltdocsRouterProvider>
189
- <PreloadProvider routes={routesInfo} modules={modules}>
190
- <ScrollHandler />
191
- <StoreSync />
192
- <I18nUpdater />
193
- <Routes>
194
- <Route key="docs-layout" element={<DocsLayout />}>
195
- {resolvedRoutes.map((route) => (
196
- <Route
197
- key={route.path}
198
- path={route.path === '' ? '/' : route.path}
199
- element={
200
- <React.Suspense fallback={<LoadingFallback />}>
201
- <MdxPage Component={route.Component} />
202
- </React.Suspense>
203
- }
204
- />
205
- ))}
206
- </Route>
207
-
208
- {/* Custom home page with user layout */}
209
- {HomePage && (
210
- <>
211
- <Route
212
- path="/"
213
- element={
214
- <EffectiveExternalLayout>
215
- <HomePage />
216
- </EffectiveExternalLayout>
217
- }
218
- />
219
- {config.i18n &&
220
- Object.keys(config.i18n.locales).map((locale) => (
221
- <Route
222
- key={`home-${locale}`}
223
- path={`/${locale}`}
224
- element={
225
- <EffectiveExternalLayout>
226
- <HomePage />
227
- </EffectiveExternalLayout>
228
- }
229
- />
230
- ))}
231
- </>
232
- )}
233
-
234
- {/* Custom External Pages with user layout */}
235
- {Object.entries(computedExternalPages).map(
236
- ([extPath, ExtComponent]) => {
237
- const cleanPath = extPath === '/' ? '' : extPath
238
- return (
239
- <React.Fragment key={extPath}>
240
- <Route
241
- path={extPath}
242
- element={
243
- <EffectiveExternalLayout>
244
- <ExtComponent />
245
- </EffectiveExternalLayout>
246
- }
247
- />
248
- {config.i18n &&
249
- Object.keys(config.i18n.locales).map((locale) => (
250
- <Route
251
- key={`${extPath}-${locale}`}
252
- path={`/${locale}${cleanPath}`}
253
- element={
254
- <EffectiveExternalLayout>
255
- <ExtComponent />
256
- </EffectiveExternalLayout>
257
- }
258
- />
259
- ))}
260
- </React.Fragment>
261
- )
262
- },
263
- )}
264
-
265
- <Route
266
- path="*"
267
- element={
268
- <UserLayout>
269
- <NotFound />
270
- </UserLayout>
271
- }
272
- />
273
- </Routes>
274
- </PreloadProvider>
275
- </BoltdocsRouterProvider>
276
- </ConfigContext.Provider>
277
- </MdxComponentsProvider>
278
- </ThemeProvider>
279
- </BoltdocsProvider>
280
- )
281
- }
282
-
283
- /**
284
- * Creates and mounts the Boltdocs documentation app.
285
- *
286
- * Usage:
287
- * ```tsx
288
- * import { createBoltdocsApp } from 'boltdocs/client'
289
- * import routes from 'virtual:boltdocs-routes'
290
- * import config from 'virtual:boltdocs-config'
291
- * import 'boltdocs/style.css'
292
- * import HomePage from './HomePage'
293
- *
294
- * createBoltdocsApp({
295
- * target: '#root',
296
- * routes,
297
- * config,
298
- * modules: import.meta.glob('/docs/**\/*.{md,mdx}'),
299
- * hot: import.meta.hot,
300
- * homePage: HomePage,
301
- * })
302
- * ```
303
- */
304
- export function createBoltdocsApp(options: CreateBoltdocsAppOptions) {
305
- const {
306
- target,
307
- routes,
308
- docsDirName,
309
- config,
310
- modules,
311
- hot,
312
- homePage,
313
- externalPages,
314
- externalLayout,
315
- components,
316
- } = options
317
- const container = document.querySelector(target)
318
- if (!container) {
319
- throw new Error(
320
- `[boltdocs] Mount target "${target}" not found in document.`,
321
- )
322
- }
323
-
324
- const app = (
325
- <React.StrictMode>
326
- <BrowserRouter>
327
- <AppShell
328
- initialRoutes={routes}
329
- initialConfig={config}
330
- docsDirName={docsDirName}
331
- modules={modules}
332
- hot={hot}
333
- homePage={homePage}
334
- externalPages={externalPages}
335
- externalLayout={externalLayout}
336
- components={components}
337
- />
338
- </BrowserRouter>
339
- </React.StrictMode>
340
- )
341
-
342
- // SSG pre-renders a shell with mock components for SEO crawlers.
343
- // We always use createRoot because the SSG output doesn't match the
344
- // real client-side component tree (components are lazy/dynamic).
345
- // Clear any SSG placeholder content before mounting.
346
- container.innerHTML = ''
347
- createRoot(container as HTMLElement).render(app)
348
- }
@@ -1,15 +0,0 @@
1
- import { useMdxComponents } from './mdx-components-context'
2
-
3
- /**
4
- * Renders an MDX page securely, injecting required custom components.
5
- * This overrides the default HTML tags emitted by MDX with stylized components.
6
- */
7
- export function MdxPage({
8
- Component,
9
- }: {
10
- Component: React.ComponentType<any>
11
- }) {
12
- const allComponents = useMdxComponents()
13
-
14
- return <Component components={allComponents as any} />
15
- }
@@ -1,66 +0,0 @@
1
- import { createContext, use, useCallback, useRef } from 'react'
2
- import type { ComponentRoute } from '../types'
3
-
4
- interface PreloadContextType {
5
- preload: (path: string) => void
6
- routes: ComponentRoute[]
7
- }
8
-
9
- const PreloadContext = createContext<PreloadContextType>({
10
- preload: () => {},
11
- routes: [],
12
- })
13
-
14
- export function usePreload() {
15
- return use(PreloadContext)
16
- }
17
-
18
- export function PreloadProvider({
19
- routes,
20
- modules,
21
- children,
22
- }: {
23
- routes: ComponentRoute[]
24
- modules: Record<string, () => Promise<unknown>>
25
- children: React.ReactNode
26
- }) {
27
- const preloadTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null)
28
-
29
- const preload = useCallback(
30
- (path: string) => {
31
- if (preloadTimerRef.current) {
32
- clearTimeout(preloadTimerRef.current)
33
- }
34
-
35
- preloadTimerRef.current = setTimeout(() => {
36
- // Normalize path (remove hash and search)
37
- const cleanPath = path.split('#')[0].split('?')[0]
38
-
39
- // Support index routes matching "/"
40
- const route = routes.find(
41
- (r) => r.path === cleanPath || (cleanPath === '/' && r.path === ''),
42
- )
43
-
44
- if (route?.filePath) {
45
- const loaderKey = Object.keys(modules).find((k) =>
46
- k.endsWith('/' + route.filePath),
47
- )
48
-
49
- if (loaderKey) {
50
- // Trigger the dynamic import
51
- modules[loaderKey]().catch((err: unknown) => {
52
- console.error(`[boltdocs] Failed to preload route ${path}:`, err)
53
- })
54
- }
55
- }
56
- }, 100) // 100ms debounce
57
- },
58
- [routes, modules],
59
- )
60
-
61
- return (
62
- <PreloadContext.Provider value={{ preload, routes }}>
63
- {children}
64
- </PreloadContext.Provider>
65
- )
66
- }
@@ -1,30 +0,0 @@
1
- import type React from 'react'
2
- import { startTransition } from 'react'
3
- import { RouterProvider } from 'react-aria-components'
4
- import { useNavigate, useHref } from 'react-router-dom'
5
-
6
- /**
7
- * Connects React Aria Components (RAC) to React Router.
8
- * This ensures all RAC links and buttons use client-side navigation
9
- * instead of full page reloads.
10
- */
11
- export function BoltdocsRouterProvider({
12
- children,
13
- }: {
14
- children: React.ReactNode
15
- }) {
16
- const navigate = useNavigate()
17
-
18
- return (
19
- <RouterProvider
20
- navigate={(to, options) => {
21
- startTransition(() => {
22
- navigate(to, options)
23
- })
24
- }}
25
- useHref={useHref}
26
- >
27
- {children as any}
28
- </RouterProvider>
29
- )
30
- }