@blackwork/docs 0.4.2 → 0.6.0

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 (120) hide show
  1. package/README.md +55 -25
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  3. package/dist/config/defaults.cjs +1 -1
  4. package/dist/config/defaults.mjs +1 -1
  5. package/dist/config/define-config.cjs +2 -2
  6. package/dist/config/define-config.mjs +2 -2
  7. package/dist/config/define-docs-config.cjs +1 -1
  8. package/dist/config/define-docs-config.mjs +1 -1
  9. package/dist/config/load-content-config.cjs +2 -2
  10. package/dist/config/load-content-config.mjs +2 -2
  11. package/dist/config/types.d.mts +34 -3
  12. package/dist/config/types.d.ts +34 -3
  13. package/dist/export/process-exported-docs.cjs +1 -1
  14. package/dist/export/process-exported-docs.mjs +1 -1
  15. package/dist/index.cjs +2 -2
  16. package/dist/index.d.mts +3 -2
  17. package/dist/index.d.ts +3 -2
  18. package/dist/index.mjs +2 -2
  19. package/dist/mdx/default-docs-components.cjs +3 -2
  20. package/dist/mdx/default-docs-components.mjs +3 -2
  21. package/dist/mdx/merge-docs-components.cjs +1 -1
  22. package/dist/mdx/merge-docs-components.mjs +1 -1
  23. package/dist/metadata/create-doc-metadata.cjs +1 -1
  24. package/dist/metadata/create-doc-metadata.mjs +1 -1
  25. package/dist/navigation/build-header-nav.cjs +9 -0
  26. package/dist/navigation/build-header-nav.d.mts +20 -0
  27. package/dist/navigation/build-header-nav.d.ts +20 -0
  28. package/dist/navigation/build-header-nav.mjs +9 -0
  29. package/dist/navigation/build-locale-links.cjs +1 -1
  30. package/dist/navigation/build-locale-links.mjs +1 -1
  31. package/dist/navigation/build-pager.cjs +1 -1
  32. package/dist/navigation/build-pager.mjs +1 -1
  33. package/dist/navigation/build-sidebar.cjs +1 -1
  34. package/dist/navigation/build-sidebar.mjs +1 -1
  35. package/dist/navigation/resolve-sidebar.cjs +1 -1
  36. package/dist/navigation/resolve-sidebar.mjs +1 -1
  37. package/dist/next/context.cjs +1 -1
  38. package/dist/next/context.mjs +1 -1
  39. package/dist/next/document-lang-sync.cjs +1 -1
  40. package/dist/next/document-lang-sync.mjs +1 -1
  41. package/dist/next/load-doc-content.cjs +2 -2
  42. package/dist/next/load-doc-content.mjs +2 -2
  43. package/dist/next/load-generated-manifest.cjs +1 -1
  44. package/dist/next/load-generated-manifest.mjs +1 -1
  45. package/dist/next/metadata.cjs +1 -1
  46. package/dist/next/metadata.mjs +1 -1
  47. package/dist/next/page.cjs +1 -1
  48. package/dist/next/page.mjs +1 -1
  49. package/dist/next/render-route.cjs +2 -2
  50. package/dist/next/render-route.mjs +2 -2
  51. package/dist/next/resolve-document-lang.cjs +1 -1
  52. package/dist/next/resolve-document-lang.mjs +1 -1
  53. package/dist/next/root-layout.cjs +2 -2
  54. package/dist/next/root-layout.d.mts +2 -2
  55. package/dist/next/root-layout.d.ts +2 -2
  56. package/dist/next/root-layout.mjs +2 -2
  57. package/dist/next-plugin/generate.cjs +1 -1
  58. package/dist/next-plugin/generate.mjs +1 -1
  59. package/dist/next.cjs +1 -1
  60. package/dist/next.mjs +1 -1
  61. package/dist/routing/build-static-params.cjs +1 -1
  62. package/dist/routing/build-static-params.mjs +1 -1
  63. package/dist/routing/resolve-docs-route.cjs +1 -1
  64. package/dist/routing/resolve-docs-route.mjs +1 -1
  65. package/dist/runtime.cjs +1 -1
  66. package/dist/runtime.mjs +1 -1
  67. package/dist/source/build-docs-source.cjs +1 -1
  68. package/dist/source/build-docs-source.mjs +1 -1
  69. package/dist/source/collect-docs-manifest.cjs +1 -1
  70. package/dist/source/collect-docs-manifest.mjs +1 -1
  71. package/dist/source/create-docs-source-from-manifest.cjs +1 -1
  72. package/dist/source/create-docs-source-from-manifest.mjs +1 -1
  73. package/dist/source/create-docs-source.cjs +1 -1
  74. package/dist/source/create-docs-source.mjs +1 -1
  75. package/dist/tailwind.css +2 -0
  76. package/dist/theme/components/content-layout.cjs +1 -1
  77. package/dist/theme/components/content-layout.mjs +1 -1
  78. package/dist/theme/components/content-shell.cjs +2 -2
  79. package/dist/theme/components/content-shell.mjs +2 -2
  80. package/dist/theme/components/docs-rail-scroll-state.cjs +1 -1
  81. package/dist/theme/components/docs-rail-scroll-state.mjs +1 -1
  82. package/dist/theme/components/docs-rail-scroll.cjs +1 -1
  83. package/dist/theme/components/docs-rail-scroll.mjs +1 -1
  84. package/dist/theme/components/docs-scroll-reset.cjs +1 -1
  85. package/dist/theme/components/docs-scroll-reset.mjs +1 -1
  86. package/dist/theme/components/docs-scroll-to-top.cjs +2 -2
  87. package/dist/theme/components/docs-scroll-to-top.mjs +2 -2
  88. package/dist/theme/components/docs-shell.cjs +2 -2
  89. package/dist/theme/components/docs-shell.mjs +2 -2
  90. package/dist/theme/components/docs-toc-geometry.cjs +1 -1
  91. package/dist/theme/components/docs-toc-geometry.mjs +1 -1
  92. package/dist/theme/components/docs-toc.cjs +2 -2
  93. package/dist/theme/components/docs-toc.mjs +2 -2
  94. package/dist/theme/components/floating-actions.cjs +1 -1
  95. package/dist/theme/components/floating-actions.mjs +1 -1
  96. package/dist/theme/components/footer.cjs +2 -2
  97. package/dist/theme/components/footer.mjs +2 -2
  98. package/dist/theme/components/header.cjs +2 -2
  99. package/dist/theme/components/header.d.mts +5 -0
  100. package/dist/theme/components/header.d.ts +5 -0
  101. package/dist/theme/components/header.mjs +2 -2
  102. package/dist/theme/components/home-shell.cjs +2 -2
  103. package/dist/theme/components/home-shell.mjs +2 -2
  104. package/dist/theme/components/link.cjs +1 -1
  105. package/dist/theme/components/link.mjs +1 -1
  106. package/dist/theme/components/shell-shared.cjs +2 -2
  107. package/dist/theme/components/shell-shared.d.mts +22 -0
  108. package/dist/theme/components/shell-shared.d.ts +22 -0
  109. package/dist/theme/components/shell-shared.mjs +2 -2
  110. package/dist/theme/create-home-data.cjs +2 -2
  111. package/dist/theme/create-home-data.mjs +2 -2
  112. package/dist/theme/slots.cjs +2 -2
  113. package/dist/theme/slots.mjs +2 -2
  114. package/dist/theme/types.d.mts +33 -9
  115. package/dist/theme/types.d.ts +33 -9
  116. package/dist/theme.cjs +2 -2
  117. package/dist/theme.d.mts +3 -3
  118. package/dist/theme.d.ts +3 -3
  119. package/dist/theme.mjs +2 -2
  120. package/package.json +15 -9
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./floating-actions.cjs`);let n=require(`blackwork`),r=require(`react`);r=e.__toESM(r);let i=require(`react/jsx-runtime`),a=require(`blackwork/icons`);const o=()=>(0,i.jsx)(n.Button,{asChild:!0,type:`button`,variant:`outline`,size:`icon`,title:`Scroll to top`,"aria-label":`Scroll to top`,className:`fixed border border-input bg-background shadow-sm md:bg-transparent md:shadow-none`,style:t.getDocsFloatingActionStyle(0),children:(0,i.jsxs)(`a`,{href:`#`,children:[(0,i.jsx)(a.ArrowUpFromLine,{className:`size-5`,"aria-hidden":`true`}),(0,i.jsx)(`span`,{className:`sr-only`,children:`Scroll to top`})]})});exports.DocsScrollToTop=o;
9
+ const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./floating-actions.cjs`);let n=require(`blackwork/rsc`),r=require(`react`);r=e.__toESM(r);let i=require(`react/jsx-runtime`),a=require(`lucide-react`);const o=({label:e=`Scroll to top`,appearance:r=`default`})=>r===`glass`?(0,i.jsx)(n.Button,{asChild:!0,variant:`glass`,size:`icon`,className:`fixed`,style:t.getDocsFloatingActionStyle(0),children:(0,i.jsx)(`a`,{href:`#`,title:e,"aria-label":e,children:(0,i.jsx)(a.ArrowUpFromLine,{className:`size-5`,"aria-hidden":`true`})})}):(0,i.jsxs)(`a`,{href:`#`,title:e,"aria-label":e,className:(0,n.buttonVariants)({variant:`outline`,size:`icon`,className:`fixed border border-input bg-background shadow-sm md:bg-transparent md:shadow-none`}),style:t.getDocsFloatingActionStyle(0),children:[(0,i.jsx)(a.ArrowUpFromLine,{className:`size-5`,"aria-hidden":`true`}),(0,i.jsx)(`span`,{className:`sr-only`,children:e})]});exports.DocsScrollToTop=o;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- import{getDocsFloatingActionStyle as e}from"./floating-actions.mjs";import{Button as t}from"blackwork";import"react";import{jsx as n,jsxs as r}from"react/jsx-runtime";import{ArrowUpFromLine as i}from"blackwork/icons";const a=()=>n(t,{asChild:!0,type:`button`,variant:`outline`,size:`icon`,title:`Scroll to top`,"aria-label":`Scroll to top`,className:`fixed border border-input bg-background shadow-sm md:bg-transparent md:shadow-none`,style:e(0),children:r(`a`,{href:`#`,children:[n(i,{className:`size-5`,"aria-hidden":`true`}),n(`span`,{className:`sr-only`,children:`Scroll to top`})]})});export{a as DocsScrollToTop};
9
+ import{getDocsFloatingActionStyle as e}from"./floating-actions.mjs";import{Button as t,buttonVariants as n}from"blackwork/rsc";import"react";import{jsx as r,jsxs as i}from"react/jsx-runtime";import{ArrowUpFromLine as a}from"lucide-react";const o=({label:o=`Scroll to top`,appearance:s=`default`})=>s===`glass`?r(t,{asChild:!0,variant:`glass`,size:`icon`,className:`fixed`,style:e(0),children:r(`a`,{href:`#`,title:o,"aria-label":o,children:r(a,{className:`size-5`,"aria-hidden":`true`})})}):i(`a`,{href:`#`,title:o,"aria-label":o,className:n({variant:`outline`,size:`icon`,className:`fixed border border-input bg-background shadow-sm md:bg-transparent md:shadow-none`}),style:e(0),children:[r(a,{className:`size-5`,"aria-hidden":`true`}),r(`span`,{className:`sr-only`,children:o})]});export{o as DocsScrollToTop};
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../config/define-config.cjs`),n=require(`../../navigation/build-locale-links.cjs`),r=require(`../../navigation/resolve-sidebar.cjs`),i=require(`../../navigation/build-pager.cjs`),a=require(`../../navigation/build-sidebar.cjs`),o=require(`./link.cjs`),s=require(`./footer.cjs`),c=require(`./header.cjs`),l=require(`./docs-toc.cjs`),u=require(`../slots.cjs`),d=require(`./docs-scroll-to-top.cjs`),f=require(`./shell-shared.cjs`),p=require(`./docs-rail-scroll.cjs`);let m=require(`blackwork`),h=require(`react`);h=e.__toESM(h);let g=require(`react/jsx-runtime`),_=require(`blackwork/icons`);const v=e=>[`block rounded-md py-1.5 pr-3 text-sm transition-colors`,e?`bg-accent font-medium text-accent-foreground`:`text-muted-foreground hover:text-foreground`].join(` `),y=e=>e.isExternal||e.slugSegments.length>0,b=e=>e.flatMap(e=>{if(e.type===`group`){let t=e.items.filter(y);return t.length===0?[]:[{...e,items:t}]}return y(e)?[e]:[]}),x=({LinkComponent:e,nodes:t})=>(0,g.jsx)(`nav`,{"aria-label":`Documentation pages`,className:`flex flex-col gap-1`,children:t.map(t=>t.type===`group`?(0,g.jsxs)(`div`,{className:`flex flex-col gap-1 pt-4 first:pt-0`,children:[(0,g.jsx)(`p`,{className:`px-3 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground/80`,children:t.title}),t.items.map(t=>(0,g.jsx)(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:v(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))]},t.title):(0,g.jsx)(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:v(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))}),S=({currentTitle:e,LinkComponent:t,nodes:n})=>n.length===0?null:(0,g.jsx)(`div`,{className:`lg:hidden`,children:(0,g.jsxs)(m.Sheet,{children:[(0,g.jsx)(m.SheetTrigger,{asChild:!0,children:(0,g.jsxs)(m.Button,{type:`button`,variant:`outline`,"aria-label":`Open section navigation`,className:`h-auto w-full justify-start gap-3 rounded-lg px-4 py-3`,children:[(0,g.jsx)(_.Menu,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,g.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col items-start text-left`,children:[(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Sections`}),(0,g.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e})]})]})}),(0,g.jsxs)(m.SheetContent,{side:`left`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[(0,g.jsx)(m.SheetHeader,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:(0,g.jsx)(m.SheetTitle,{children:`Sections`})}),(0,g.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:(0,g.jsx)(x,{LinkComponent:t,nodes:n})})]})]})}),C=({children:e,config:m,entry:h,headings:_=[],source:v})=>{let y=t.defineConfig(m),C=v.getEntries(h.locale),w=f.getEntrySectionKey(h),T=f.getEntrySectionConfig(y,h),E=Array.isArray(T.sidebar),D=f.getSectionEntries(C,h),O=r.resolveSidebar({config:y,entries:C,currentHref:h.href,sectionKey:w}),k=b(O),A=i.buildPager({entries:D,currentHref:h.href,...E?{sidebar:O}:{}}),j=f.toNavigation(h,E?r.flattenResolvedSidebarItems(O):a.buildSidebar({entries:C,currentHref:h.href})),M=n.buildLocaleLinks({config:y,entry:h,source:v}),N=f.getTocHeadings(_),P=f.getTocLabels(y,h.locale),F=v.getCanonicalHref(h.locale,[]),I=u.resolveThemeSlots(y.slots),L=I.headerActions,R=I.link??o.DefaultDocsLink,z=I.footer??s.DefaultDocsFooter,B=f.getPagefindFilterEntries(f.getPagefindFilters({layout:T.layout,locale:h.locale,section:w}));return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(c.DefaultDocsHeader,{headerActions:L?(0,g.jsx)(L,{homeHref:F,localeLinks:M,navigation:j,siteDescription:y.site.description,siteTitle:f.getSiteTitle(y)}):void 0,homeHref:F,LinkComponent:R,localeLinks:M,navigation:j,siteDescription:y.site.description,siteTitle:f.getSiteTitle(y)}),(0,g.jsx)(d.DocsScrollToTop,{}),(0,g.jsx)(l.MobileDocsToc,{headings:N,...P}),(0,g.jsxs)(`main`,{"data-docs-region":`docs-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-6 px-6 py-8 sm:gap-8 sm:px-8 lg:flex-row lg:gap-14 xl:gap-20 xl:px-10 2xl:gap-24 2xl:px-12`,children:[(0,g.jsx)(S,{currentTitle:h.title,LinkComponent:R,nodes:k}),(0,g.jsx)(`aside`,{"data-docs-region":`sidebar`,className:`hidden w-full shrink-0 lg:block lg:w-72 lg:self-start lg:sticky lg:top-24`,children:(0,g.jsx)(p.DocsRailScroll,{children:(0,g.jsx)(x,{LinkComponent:R,nodes:k})})}),(0,g.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-10`,children:[(0,g.jsxs)(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-10`,children:[(0,g.jsx)(`div`,{hidden:!0,children:B.map(e=>(0,g.jsx)(`span`,{"data-pagefind-filter":e},e))}),(0,g.jsxs)(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[(0,g.jsx)(`h1`,{className:`text-balance text-3xl font-semibold tracking-tight text-foreground`,children:h.title}),h.description?(0,g.jsx)(`p`,{className:`max-w-3xl text-pretty text-muted-foreground`,children:h.description}):null]}),(0,g.jsx)(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:e})]}),(0,g.jsxs)(`nav`,{"data-docs-region":`pager`,"aria-label":`Document pager`,className:`flex flex-wrap items-center justify-between gap-3 border-t border-border/60 pt-6 text-sm`,children:[A.previous?(0,g.jsxs)(R,{href:A.previous.href,className:`text-muted-foreground`,children:[`Previous: `,A.previous.title]}):(0,g.jsx)(`span`,{}),A.next?(0,g.jsxs)(R,{href:A.next.href,className:`text-muted-foreground`,children:[`Next: `,A.next.title]}):null]})]}),(0,g.jsx)(l.DefaultDocsToc,{headings:N,...P})]}),(0,g.jsx)(z,{description:f.getFooterDescription(y,h),homeHref:F,LinkComponent:R,navigation:j,siteTitle:f.getSiteTitle(y)})]})};exports.DefaultDocsShell=C;
9
+ const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../config/define-config.cjs`),n=require(`../../navigation/build-locale-links.cjs`),r=require(`../../navigation/build-header-nav.cjs`),i=require(`../../navigation/resolve-sidebar.cjs`),a=require(`../../navigation/build-pager.cjs`),o=require(`./footer.cjs`),s=require(`./link.cjs`),c=require(`./header.cjs`),l=require(`./docs-toc.cjs`),u=require(`../slots.cjs`),d=require(`./docs-scroll-to-top.cjs`),f=require(`./shell-shared.cjs`),p=require(`./docs-rail-scroll.cjs`);let m=require(`blackwork`),h=require(`blackwork/rsc`),g=require(`react`);g=e.__toESM(g);let _=require(`react/jsx-runtime`),v=require(`lucide-react`);const y=e=>[`block rounded-md py-1.5 pr-3 text-sm transition-colors`,e?`bg-accent font-medium text-accent-foreground`:`text-muted-foreground hover:text-foreground`].join(` `),b=e=>e.isExternal||e.slugSegments.length>0,x=e=>e.flatMap(e=>{if(e.type===`group`){let t=e.items.filter(b);return t.length===0?[]:[{...e,items:t}]}return b(e)?[e]:[]}),S=({LinkComponent:e,navigationLabel:t,nodes:n})=>(0,_.jsx)(`nav`,{"aria-label":t,className:`flex flex-col gap-1`,children:n.map(t=>t.type===`group`?(0,_.jsxs)(`div`,{className:`flex flex-col gap-1 pt-4 first:pt-0`,children:[(0,_.jsx)(`p`,{className:`px-3 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground/80`,children:t.title}),t.items.map(t=>(0,_.jsx)(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:y(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))]},t.title):(0,_.jsx)(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:y(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))}),C=({currentTitle:e,LinkComponent:t,navigationLabel:n,nodes:r,openLabel:i,sectionsLabel:a})=>r.length===0?null:(0,_.jsx)(`div`,{className:`lg:hidden`,children:(0,_.jsxs)(m.Sheet,{children:[(0,_.jsxs)(m.SheetTrigger,{"aria-label":i,className:(0,h.buttonVariants)({variant:`outline`,className:`h-auto w-full justify-start gap-3 rounded-lg px-4 py-3`}),children:[(0,_.jsx)(v.Menu,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,_.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col items-start text-left`,children:[(0,_.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:a}),(0,_.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e})]})]}),(0,_.jsxs)(m.SheetContent,{side:`left`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[(0,_.jsx)(m.SheetHeader,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:(0,_.jsx)(m.SheetTitle,{children:a})}),(0,_.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:(0,_.jsx)(S,{LinkComponent:t,navigationLabel:n,nodes:r})})]})]})}),w=({children:e,config:m,entry:h,headings:g=[],source:v})=>{let y=t.defineConfig(m),b=v.getEntries(h.locale),w=f.getEntrySectionKey(h),T=f.getEntrySectionConfig(y,h),E=Array.isArray(T.sidebar),D=f.getSectionEntries(b,h),O=i.resolveSidebar({config:y,entries:b,currentHref:h.href,sectionKey:w}),k=x(O),A=a.buildPager({entries:D,currentHref:h.href,...E?{sidebar:O}:{}}),j=r.buildHeaderNavigation({config:y,currentHref:h.href,locale:h.locale,source:v}),M=n.buildLocaleLinks({config:y,entry:h,source:v}),N=f.getTocHeadings(g),P=f.getTocLabels(y,h.locale),F=f.getThemeLabels(y,h.locale),I=f.getThemeSocialLinks(y,h.locale),L=v.getCanonicalHref(h.locale,[]),R=u.resolveThemeSlots(y.slots),z=R.headerActions,B=R.link??s.DefaultDocsLink,V=R.footer??o.DefaultDocsFooter,H=f.getPagefindFilterEntries(f.getPagefindFilters({layout:T.layout,locale:h.locale,section:w}));return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(c.DefaultDocsHeader,{appearance:y.theme.appearance,headerActions:z?(0,_.jsx)(z,{homeHref:L,localeLinks:M,navigation:j,siteDescription:y.site.description,siteTitle:f.getSiteTitle(y)}):void 0,homeHref:L,LinkComponent:B,localeLinks:M,labels:F,navigation:j,socialLinks:I,siteDescription:y.site.description,siteTitle:f.getSiteTitle(y)}),(0,_.jsx)(d.DocsScrollToTop,{label:F.scrollToTop,appearance:y.theme.appearance}),(0,_.jsx)(l.MobileDocsToc,{headings:N,...P}),(0,_.jsxs)(`main`,{"data-docs-region":`docs-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-6 px-6 py-8 sm:gap-8 sm:px-8 lg:flex-row lg:gap-14 xl:gap-20 xl:px-10 2xl:gap-24 2xl:px-12`,children:[(0,_.jsx)(C,{currentTitle:h.title,LinkComponent:B,navigationLabel:F.documentationPages,nodes:k,openLabel:F.openSectionNavigation,sectionsLabel:F.sections}),(0,_.jsx)(`aside`,{"data-docs-region":`sidebar`,className:`hidden w-full shrink-0 lg:block lg:w-72 lg:self-start lg:sticky lg:top-24`,children:(0,_.jsx)(p.DocsRailScroll,{children:(0,_.jsx)(S,{LinkComponent:B,navigationLabel:F.documentationPages,nodes:k})})}),(0,_.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-10`,children:[(0,_.jsxs)(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-10`,children:[(0,_.jsx)(`div`,{hidden:!0,children:H.map(e=>(0,_.jsx)(`span`,{"data-pagefind-filter":e},e))}),(0,_.jsxs)(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[(0,_.jsx)(`h1`,{className:`text-balance text-3xl font-semibold tracking-tight text-foreground`,children:h.title}),h.description?(0,_.jsx)(`p`,{className:`max-w-3xl text-pretty text-muted-foreground`,children:h.description}):null]}),(0,_.jsx)(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:e})]}),(0,_.jsxs)(`nav`,{"data-docs-region":`pager`,"aria-label":F.documentPager,className:`flex flex-wrap items-center justify-between gap-3 border-t border-border/60 pt-6 text-sm`,children:[A.previous?(0,_.jsxs)(B,{href:A.previous.href,className:`text-muted-foreground`,children:[F.previous,`: `,A.previous.title]}):(0,_.jsx)(`span`,{}),A.next?(0,_.jsxs)(B,{href:A.next.href,className:`text-muted-foreground`,children:[F.next,`: `,A.next.title]}):null]})]}),(0,_.jsx)(l.DefaultDocsToc,{headings:N,...P})]}),(0,_.jsx)(V,{description:f.getFooterDescription(y,h),homeHref:L,LinkComponent:B,navigation:j,siteTitle:f.getSiteTitle(y)})]})};exports.DefaultDocsShell=w;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- import{defineConfig as e}from"../../config/define-config.mjs";import{buildLocaleLinks as t}from"../../navigation/build-locale-links.mjs";import{flattenResolvedSidebarItems as n,resolveSidebar as r}from"../../navigation/resolve-sidebar.mjs";import{buildPager as i}from"../../navigation/build-pager.mjs";import{buildSidebar as a}from"../../navigation/build-sidebar.mjs";import{DefaultDocsLink as o}from"./link.mjs";import{DefaultDocsFooter as s}from"./footer.mjs";import{DefaultDocsHeader as c}from"./header.mjs";import{DefaultDocsToc as l,MobileDocsToc as u}from"./docs-toc.mjs";import{resolveThemeSlots as d}from"../slots.mjs";import{DocsScrollToTop as f}from"./docs-scroll-to-top.mjs";import{getEntrySectionConfig as p,getEntrySectionKey as m,getFooterDescription as h,getPagefindFilterEntries as g,getPagefindFilters as _,getSectionEntries as v,getSiteTitle as y,getTocHeadings as b,getTocLabels as x,toNavigation as S}from"./shell-shared.mjs";import{DocsRailScroll as C}from"./docs-rail-scroll.mjs";import{Button as w,Sheet as T,SheetContent as E,SheetHeader as D,SheetTitle as O,SheetTrigger as k}from"blackwork";import"react";import{Fragment as A,jsx as j,jsxs as M}from"react/jsx-runtime";import{Menu as N}from"blackwork/icons";const P=e=>[`block rounded-md py-1.5 pr-3 text-sm transition-colors`,e?`bg-accent font-medium text-accent-foreground`:`text-muted-foreground hover:text-foreground`].join(` `),F=e=>e.isExternal||e.slugSegments.length>0,I=e=>e.flatMap(e=>{if(e.type===`group`){let t=e.items.filter(F);return t.length===0?[]:[{...e,items:t}]}return F(e)?[e]:[]}),L=({LinkComponent:e,nodes:t})=>j(`nav`,{"aria-label":`Documentation pages`,className:`flex flex-col gap-1`,children:t.map(t=>t.type===`group`?M(`div`,{className:`flex flex-col gap-1 pt-4 first:pt-0`,children:[j(`p`,{className:`px-3 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground/80`,children:t.title}),t.items.map(t=>j(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:P(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))]},t.title):j(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:P(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))}),R=({currentTitle:e,LinkComponent:t,nodes:n})=>n.length===0?null:j(`div`,{className:`lg:hidden`,children:M(T,{children:[j(k,{asChild:!0,children:M(w,{type:`button`,variant:`outline`,"aria-label":`Open section navigation`,className:`h-auto w-full justify-start gap-3 rounded-lg px-4 py-3`,children:[j(N,{className:`size-4 shrink-0`,"aria-hidden":`true`}),M(`span`,{className:`flex min-w-0 flex-1 flex-col items-start text-left`,children:[j(`span`,{className:`text-xs text-muted-foreground`,children:`Sections`}),j(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e})]})]})}),M(E,{side:`left`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[j(D,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:j(O,{children:`Sections`})}),j(`div`,{className:`min-h-0 flex-1 overflow-auto px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:j(L,{LinkComponent:t,nodes:n})})]})]})}),z=({children:w,config:T,entry:E,headings:D=[],source:O})=>{let k=e(T),N=O.getEntries(E.locale),P=m(E),F=p(k,E),z=Array.isArray(F.sidebar),B=v(N,E),V=r({config:k,entries:N,currentHref:E.href,sectionKey:P}),H=I(V),U=i({entries:B,currentHref:E.href,...z?{sidebar:V}:{}}),W=S(E,z?n(V):a({entries:N,currentHref:E.href})),G=t({config:k,entry:E,source:O}),K=b(D),q=x(k,E.locale),J=O.getCanonicalHref(E.locale,[]),Y=d(k.slots),X=Y.headerActions,Z=Y.link??o,Q=Y.footer??s,$=g(_({layout:F.layout,locale:E.locale,section:P}));return M(A,{children:[j(c,{headerActions:X?j(X,{homeHref:J,localeLinks:G,navigation:W,siteDescription:k.site.description,siteTitle:y(k)}):void 0,homeHref:J,LinkComponent:Z,localeLinks:G,navigation:W,siteDescription:k.site.description,siteTitle:y(k)}),j(f,{}),j(u,{headings:K,...q}),M(`main`,{"data-docs-region":`docs-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-6 px-6 py-8 sm:gap-8 sm:px-8 lg:flex-row lg:gap-14 xl:gap-20 xl:px-10 2xl:gap-24 2xl:px-12`,children:[j(R,{currentTitle:E.title,LinkComponent:Z,nodes:H}),j(`aside`,{"data-docs-region":`sidebar`,className:`hidden w-full shrink-0 lg:block lg:w-72 lg:self-start lg:sticky lg:top-24`,children:j(C,{children:j(L,{LinkComponent:Z,nodes:H})})}),M(`div`,{className:`flex min-w-0 flex-1 flex-col gap-10`,children:[M(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-10`,children:[j(`div`,{hidden:!0,children:$.map(e=>j(`span`,{"data-pagefind-filter":e},e))}),M(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[j(`h1`,{className:`text-balance text-3xl font-semibold tracking-tight text-foreground`,children:E.title}),E.description?j(`p`,{className:`max-w-3xl text-pretty text-muted-foreground`,children:E.description}):null]}),j(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:w})]}),M(`nav`,{"data-docs-region":`pager`,"aria-label":`Document pager`,className:`flex flex-wrap items-center justify-between gap-3 border-t border-border/60 pt-6 text-sm`,children:[U.previous?M(Z,{href:U.previous.href,className:`text-muted-foreground`,children:[`Previous: `,U.previous.title]}):j(`span`,{}),U.next?M(Z,{href:U.next.href,className:`text-muted-foreground`,children:[`Next: `,U.next.title]}):null]})]}),j(l,{headings:K,...q})]}),j(Q,{description:h(k,E),homeHref:J,LinkComponent:Z,navigation:W,siteTitle:y(k)})]})};export{z as DefaultDocsShell};
9
+ import{defineConfig as e}from"../../config/define-config.mjs";import{buildLocaleLinks as t}from"../../navigation/build-locale-links.mjs";import{buildHeaderNavigation as n}from"../../navigation/build-header-nav.mjs";import{resolveSidebar as r}from"../../navigation/resolve-sidebar.mjs";import{buildPager as i}from"../../navigation/build-pager.mjs";import{DefaultDocsFooter as a}from"./footer.mjs";import{DefaultDocsLink as o}from"./link.mjs";import{DefaultDocsHeader as s}from"./header.mjs";import{DefaultDocsToc as c,MobileDocsToc as l}from"./docs-toc.mjs";import{resolveThemeSlots as u}from"../slots.mjs";import{DocsScrollToTop as d}from"./docs-scroll-to-top.mjs";import{getEntrySectionConfig as f,getEntrySectionKey as p,getFooterDescription as m,getPagefindFilterEntries as h,getPagefindFilters as g,getSectionEntries as _,getSiteTitle as v,getThemeLabels as y,getThemeSocialLinks as b,getTocHeadings as x,getTocLabels as S}from"./shell-shared.mjs";import{DocsRailScroll as C}from"./docs-rail-scroll.mjs";import{Sheet as w,SheetContent as T,SheetHeader as E,SheetTitle as D,SheetTrigger as O}from"blackwork";import{buttonVariants as k}from"blackwork/rsc";import"react";import{Fragment as A,jsx as j,jsxs as M}from"react/jsx-runtime";import{Menu as N}from"lucide-react";const P=e=>[`block rounded-md py-1.5 pr-3 text-sm transition-colors`,e?`bg-accent font-medium text-accent-foreground`:`text-muted-foreground hover:text-foreground`].join(` `),F=e=>e.isExternal||e.slugSegments.length>0,I=e=>e.flatMap(e=>{if(e.type===`group`){let t=e.items.filter(F);return t.length===0?[]:[{...e,items:t}]}return F(e)?[e]:[]}),L=({LinkComponent:e,navigationLabel:t,nodes:n})=>j(`nav`,{"aria-label":t,className:`flex flex-col gap-1`,children:n.map(t=>t.type===`group`?M(`div`,{className:`flex flex-col gap-1 pt-4 first:pt-0`,children:[j(`p`,{className:`px-3 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground/80`,children:t.title}),t.items.map(t=>j(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:P(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))]},t.title):j(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:P(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))}),R=({currentTitle:e,LinkComponent:t,navigationLabel:n,nodes:r,openLabel:i,sectionsLabel:a})=>r.length===0?null:j(`div`,{className:`lg:hidden`,children:M(w,{children:[M(O,{"aria-label":i,className:k({variant:`outline`,className:`h-auto w-full justify-start gap-3 rounded-lg px-4 py-3`}),children:[j(N,{className:`size-4 shrink-0`,"aria-hidden":`true`}),M(`span`,{className:`flex min-w-0 flex-1 flex-col items-start text-left`,children:[j(`span`,{className:`text-xs text-muted-foreground`,children:a}),j(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e})]})]}),M(T,{side:`left`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[j(E,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:j(D,{children:a})}),j(`div`,{className:`min-h-0 flex-1 overflow-auto px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:j(L,{LinkComponent:t,navigationLabel:n,nodes:r})})]})]})}),z=({children:w,config:T,entry:E,headings:D=[],source:O})=>{let k=e(T),N=O.getEntries(E.locale),P=p(E),F=f(k,E),z=Array.isArray(F.sidebar),B=_(N,E),V=r({config:k,entries:N,currentHref:E.href,sectionKey:P}),H=I(V),U=i({entries:B,currentHref:E.href,...z?{sidebar:V}:{}}),W=n({config:k,currentHref:E.href,locale:E.locale,source:O}),G=t({config:k,entry:E,source:O}),K=x(D),q=S(k,E.locale),J=y(k,E.locale),Y=b(k,E.locale),X=O.getCanonicalHref(E.locale,[]),Z=u(k.slots),Q=Z.headerActions,$=Z.link??o,ee=Z.footer??a,te=h(g({layout:F.layout,locale:E.locale,section:P}));return M(A,{children:[j(s,{appearance:k.theme.appearance,headerActions:Q?j(Q,{homeHref:X,localeLinks:G,navigation:W,siteDescription:k.site.description,siteTitle:v(k)}):void 0,homeHref:X,LinkComponent:$,localeLinks:G,labels:J,navigation:W,socialLinks:Y,siteDescription:k.site.description,siteTitle:v(k)}),j(d,{label:J.scrollToTop,appearance:k.theme.appearance}),j(l,{headings:K,...q}),M(`main`,{"data-docs-region":`docs-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-6 px-6 py-8 sm:gap-8 sm:px-8 lg:flex-row lg:gap-14 xl:gap-20 xl:px-10 2xl:gap-24 2xl:px-12`,children:[j(R,{currentTitle:E.title,LinkComponent:$,navigationLabel:J.documentationPages,nodes:H,openLabel:J.openSectionNavigation,sectionsLabel:J.sections}),j(`aside`,{"data-docs-region":`sidebar`,className:`hidden w-full shrink-0 lg:block lg:w-72 lg:self-start lg:sticky lg:top-24`,children:j(C,{children:j(L,{LinkComponent:$,navigationLabel:J.documentationPages,nodes:H})})}),M(`div`,{className:`flex min-w-0 flex-1 flex-col gap-10`,children:[M(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-10`,children:[j(`div`,{hidden:!0,children:te.map(e=>j(`span`,{"data-pagefind-filter":e},e))}),M(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[j(`h1`,{className:`text-balance text-3xl font-semibold tracking-tight text-foreground`,children:E.title}),E.description?j(`p`,{className:`max-w-3xl text-pretty text-muted-foreground`,children:E.description}):null]}),j(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:w})]}),M(`nav`,{"data-docs-region":`pager`,"aria-label":J.documentPager,className:`flex flex-wrap items-center justify-between gap-3 border-t border-border/60 pt-6 text-sm`,children:[U.previous?M($,{href:U.previous.href,className:`text-muted-foreground`,children:[J.previous,`: `,U.previous.title]}):j(`span`,{}),U.next?M($,{href:U.next.href,className:`text-muted-foreground`,children:[J.next,`: `,U.next.title]}):null]})]}),j(c,{headings:K,...q})]}),j(ee,{description:m(k,E),homeHref:X,LinkComponent:$,navigation:W,siteTitle:v(k)})]})};export{z as DefaultDocsShell};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- "use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./docs-toc-geometry.cjs`),n=require(`./floating-actions.cjs`);let r=require(`blackwork`),i=require(`react`);i=e.__toESM(i);let a=require(`react/jsx-runtime`),o=require(`blackwork/icons`);const s=`On This Page`,c=()=>[`relative block py-1.5 pr-3 text-sm text-muted-foreground transition-colors`,`hover:text-foreground data-[active=true]:text-primary`].join(` `),l=(e,t)=>({height:`${e?.height??1}px`,transform:`translateY(${-t}px)`,width:`${e?.width??1}px`}),u=e=>{let t=e?.top??0,n=e?.bottom??0;return{clipPath:`polygon(0 ${t}px, 100% ${t}px, 100% ${n}px, 0 ${n}px)`,opacity:+!!e}},d=(e,t)=>({offsetDistance:`${t?.offsetDistance??0}px`,offsetPath:`path("${e?.path||`M0 0 L0 0`}")`,opacity:+!!t}),f=e=>e.filter(e=>e.active).sort((e,t)=>e.t-t.t).map(e=>e.id),p=(e,t)=>{let n=null,r=1/0;for(let i of e){let e=document.getElementById(i.id);if(!e)continue;let a=Math.abs(e.getBoundingClientRect().top-t);a<r&&(r=a,n=i.id)}return n},m=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},h=({itemBottom:e,itemTop:t,margin:n,scrollHeight:r,scrollTop:i,viewportHeight:a})=>{let o=i+n,s=i+a-n,c=Math.max(0,r-a);return t<o?Math.max(0,t-n):e>s?Math.min(c,e-a+n):i},g=(e,t)=>{let n=new Map(Array.from(e.querySelectorAll(`a[data-heading-id]`)).map(e=>[e.dataset.headingId??``,e]));return t.flatMap(e=>{let t=n.get(e.id);if(!t)return[];let r=getComputedStyle(t);return[{bottom:t.offsetTop+t.clientHeight-m(r.paddingBottom),depth:e.depth,id:e.id,top:t.offsetTop+m(r.paddingTop)}]})},_=(e,t)=>{if(t.length===0||e.length===0)return[];try{let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);n.setAttribute(`d`,t);let r=[],i=n.getTotalLength();return e.forEach((t,a)=>{let o=a>0?r[a-1][1]+(t.top-e[a-1].bottom):t.top;for(;o<i&&n.getPointAtLength(o).y<t.top;)o+=1;r.push([o,o+(t.bottom-t.top)])}),r}catch{return e.map(e=>[e.top,e.bottom])}},v=(e,t)=>{if(!e||!t)return e===t;if(e.height!==t.height||e.path!==t.path||e.width!==t.width||e.positions.length!==t.positions.length||e.itemLineLengths.length!==t.itemLineLengths.length)return!1;for(let n=0;n<e.positions.length;n+=1){let r=e.positions[n],i=t.positions[n];if(r.bottom!==i.bottom||r.depth!==i.depth||r.id!==i.id||r.top!==i.top||r.x!==i.x)return!1}for(let n=0;n<e.itemLineLengths.length;n+=1){let r=e.itemLineLengths[n],i=t.itemLineLengths[n];if(r[0]!==i[0]||r[1]!==i[1])return!1}return!0},y=(e,t)=>!e||!t?e===t:e.bottom===t.bottom&&e.offsetDistance===t.offsetDistance&&e.top===t.top,b=e=>{let t=C(e),[n,r,a]=w(t,e),o=(0,i.useMemo)(()=>new Set(t),[t]),s=(0,i.useId)(),[c,l]=(0,i.useState)(0);return{activeIds:t,activeIdSet:o,listId:s,listRef:n,measurement:r,scrollTop:c,setScrollTop:l,track:a}},x=({activeIds:e,activeIdSet:n,headings:o,listClassName:s,listId:f,listRef:p,measurement:m,onSelect:g,scrollTop:_,setScrollTop:v,track:y,wrapperClassName:b})=>((0,i.useEffect)(()=>{let t=p.current,n=e[0];if(!t||!n)return;let r=Array.from(t.querySelectorAll(`a[data-heading-id]`)).find(e=>e.dataset.headingId===n);if(!r)return;let i=h({itemBottom:r.offsetTop+r.offsetHeight,itemTop:r.offsetTop,margin:16,scrollHeight:t.scrollHeight,scrollTop:t.scrollTop,viewportHeight:t.clientHeight});i!==t.scrollTop&&t.scrollTo({top:i})},[e,p]),(0,a.jsxs)(`div`,{className:(0,r.cn)(`relative flex min-h-0 flex-col`,b),children:[(0,a.jsxs)(`div`,{"aria-hidden":`true`,"data-docs-toc-track":`true`,className:`pointer-events-none absolute left-0 top-0 transition-transform duration-150 ease-out`,style:l(m,_),children:[(0,a.jsx)(`svg`,{"data-docs-toc-track-path":`true`,height:m?.height??1,viewBox:`0 0 ${m?.width??1} ${m?.height??1}`,width:m?.width??1,className:`absolute left-0 top-0 transition-[clip-path,opacity] duration-150 ease-out`,style:u(y),children:(0,a.jsx)(`path`,{d:m?.path||`M0 0 L0 0`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-primary`})}),(0,a.jsx)(`span`,{"data-docs-toc-thumb":`true`,className:`absolute left-0 top-0 size-1 rounded-full bg-primary transition-[opacity,offset-distance] duration-150 ease-out`,style:d(m,y)})]}),(0,a.jsx)(`ol`,{id:f,ref:p,className:(0,r.cn)(`flex flex-col overflow-auto py-1 [scrollbar-width:none]`,s),onScroll:e=>{v(e.currentTarget.scrollTop)},children:o.map((e,r)=>{let i=n.has(e.id),s=t.getTocGuideOffset(e.depth),l=r>0?t.getTocGuideOffset(o[r-1].depth):s,u=r+1<o.length?t.getTocGuideOffset(o[r+1].depth):s;return(0,a.jsx)(`li`,{children:(0,a.jsxs)(`a`,{href:`#${e.id}`,"data-active":i?`true`:`false`,"data-depth":e.depth,"data-heading-id":e.id,className:c(),style:{paddingInlineStart:`${t.getTocItemPadding(e.depth)}px`},onClick:g,children:[s===l?null:(0,a.jsx)(`svg`,{"aria-hidden":`true`,"data-docs-toc-item-curve":`true`,viewBox:`${Math.min(s,l)} 0 ${Math.abs(l-s)} 12`,className:`pointer-events-none absolute`,style:{height:`12px`,insetInlineStart:`${Math.min(s,l)}px`,top:`-6px`,width:`${Math.abs(l-s)+1}px`,zIndex:-1},children:(0,a.jsx)(`path`,{d:`M ${l} 0 C ${l} 8 ${s} 4 ${s} 12`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-border`})}),(0,a.jsx)(`span`,{"aria-hidden":`true`,"data-docs-toc-item-line":`true`,className:`pointer-events-none absolute w-px bg-border`,style:{bottom:s===u?`0px`:`6px`,insetInlineStart:`${s}px`,top:s===l?`0px`:`6px`,zIndex:-1}}),e.title]})},e.id)})})]})),S=(e,t,n)=>{let r=new Set(e),i=t.positions.findIndex(e=>r.has(e.id));if(i===-1)return[null,null];let a=i;t.positions.forEach((e,t)=>{r.has(e.id)&&(a=t)});let o=n?n.startIdx>i||n.endIdx>a||n.startIdx===i&&n.endIdx===a&&n.isUp:!1,s=t.itemLineLengths[i]?.[0]??t.positions[i].top,c=t.itemLineLengths[a]?.[1]??t.positions[a].bottom;return[{bottom:t.positions[a].bottom,offsetDistance:o?s:c,top:t.positions[i].top},{endIdx:a,isUp:o,startIdx:i}]};function C(e){let[t,n]=(0,i.useState)([]);return(0,i.useEffect)(()=>{if(e.length===0||typeof document>`u`||typeof IntersectionObserver>`u`)return;let t=new Map(e.map(e=>[e.id,{active:!1,fallback:!1,id:e.id,t:0}])),r=(e=0)=>{for(let e of t.values())e.fallback&&(e.active=!1,e.fallback=!1);let r=f([...t.values()]);if(r.length===0){let n=p([...t.values()],e),i=n?t.get(n):void 0;i&&(i.active=!0,i.fallback=!0,i.t=Date.now(),r=[i.id])}n(r)},i=new IntersectionObserver(e=>{let n=Date.now();for(let r of e){let e=t.get(r.target.id);e&&(e.active!==r.isIntersecting||e.fallback)&&(e.active=r.isIntersecting,e.fallback=!1,e.t=n)}r(e[0]?.rootBounds?.top??0)},{threshold:.9});return e.forEach(e=>{let t=document.getElementById(e.id);t&&i.observe(t)}),r(),()=>{i.disconnect()}},[e]),t}function w(e,n){let r=(0,i.useRef)(null),[a,o]=(0,i.useState)(null),[s,c]=(0,i.useState)(null),l=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=r.current;if(!e)return;let i=0,a=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(()=>{let r=t.buildTocTrackGeometry(g(e,n)),i={...r,itemLineLengths:_(r.positions,r.path)};o(e=>v(e,i)?e:i)})},s=typeof ResizeObserver>`u`?null:new ResizeObserver(a);return s?.observe(e),window.addEventListener(`resize`,a),a(),()=>{cancelAnimationFrame(i),s?.disconnect(),window.removeEventListener(`resize`,a)}},[n]),(0,i.useEffect)(()=>{let t=0;return t=requestAnimationFrame(()=>{if(!a||e.length===0){l.current=null,c(e=>e===null?e:null);return}let[t,n]=S(e,a,l.current);l.current=n,c(e=>y(e,t)?e:t)}),()=>{cancelAnimationFrame(t)}},[e,a]),[r,a,s]}const T=({className:e,collapseDirection:t=`left`,collapseLabel:n=`Collapse outline`,collapseEnabled:c=!1,defaultCollapsed:l=!1,dock:u=`sticky`,expandLabel:d=`Expand outline`,headings:f,minHeadings:p=1,title:m=s})=>{let h=b(f),[g,_]=(0,i.useState)(l),v=g?d:n,y=t===`right`?`right-0`:`left-0`,S=c?t===`right`?`pr-10`:`pl-10`:void 0;return f.length<p?null:(0,a.jsx)(`aside`,{"data-docs-region":`toc`,"data-docs-toc-collapsible":c?`true`:void 0,"data-docs-toc-collapsed":c?String(g):void 0,className:(0,r.cn)(`hidden w-64 xl:block`,u===`sticky`?`shrink-0 xl:self-start xl:sticky xl:top-24`:`xl:fixed xl:top-24`,e),children:(0,a.jsxs)(`nav`,{"aria-label":m,className:(0,r.cn)(`relative flex w-64 flex-col text-sm`,t===`right`?`ml-auto`:void 0),children:[(0,a.jsxs)(`div`,{inert:c&&g?!0:void 0,"aria-hidden":c&&g?!0:void 0,className:(0,r.cn)(`flex w-64 flex-col gap-3 overflow-hidden transition-opacity duration-200 ease-out motion-reduce:transition-none`,c&&g?`pointer-events-none opacity-0`:`opacity-100`),children:[(0,a.jsx)(`p`,{className:(0,r.cn)(`font-medium text-foreground`,S),children:m}),(0,a.jsx)(x,{...h,headings:f,listClassName:`max-h-[calc(100dvh-8rem)]`})]}),c?(0,a.jsxs)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,"data-docs-toc-toggle":`true`,"aria-controls":h.listId,"aria-label":v,"aria-expanded":!g,title:v,className:(0,r.cn)(y,`absolute top-0 z-10 shrink-0 text-muted-foreground transition-opacity duration-200 ease-out hover:text-foreground hover:opacity-100 motion-reduce:transition-none`,g?`opacity-100`:`opacity-60`),onClick:()=>{_(e=>!e)},children:[(0,a.jsx)(o.Toc,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`sr-only`,children:v})]}):null]})})},E=({className:e,headings:t,minHeadings:c=1,openLabel:l=`Open outline`,title:u=s})=>{let d=b(t),[f,p]=(0,i.useState)(!1);return t.length<c?null:(0,a.jsx)(`div`,{className:(0,r.cn)(`xl:hidden`,e),children:(0,a.jsxs)(r.Sheet,{open:f,onOpenChange:p,children:[(0,a.jsx)(r.SheetTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{type:`button`,variant:`outline`,size:`icon`,title:l,"aria-label":l,"data-docs-toc-mobile-trigger":`true`,className:`fixed border border-input bg-background shadow-sm`,style:n.getDocsFloatingActionStyle(1),children:[(0,a.jsx)(o.Toc,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`sr-only`,children:l})]})}),(0,a.jsxs)(r.SheetContent,{side:`right`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[(0,a.jsx)(r.SheetHeader,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:(0,a.jsx)(r.SheetTitle,{children:u})}),(0,a.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:(0,a.jsx)(x,{...d,headings:t,listClassName:`min-h-0 flex-1`,wrapperClassName:`min-h-0 flex-1`,onSelect:()=>{p(!1)}})})]})]})})};exports.DefaultDocsToc=T,exports.MobileDocsToc=E;
9
+ "use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./docs-toc-geometry.cjs`),n=require(`./floating-actions.cjs`);let r=require(`blackwork`),i=require(`react`);i=e.__toESM(i);let a=require(`react/jsx-runtime`),o=require(`lucide-react`);const s=`On This Page`,c=()=>[`relative block py-1.5 pr-3 text-sm text-muted-foreground transition-colors`,`hover:text-foreground data-[active=true]:text-primary`].join(` `),l=(e,t)=>({height:`${e?.height??1}px`,transform:`translateY(${-t}px)`,width:`${e?.width??1}px`}),u=e=>{let t=e?.top??0,n=e?.bottom??0;return{clipPath:`polygon(0 ${t}px, 100% ${t}px, 100% ${n}px, 0 ${n}px)`,opacity:+!!e}},d=(e,t)=>({offsetDistance:`${t?.offsetDistance??0}px`,offsetPath:`path("${e?.path||`M0 0 L0 0`}")`,opacity:+!!t}),f=e=>e.filter(e=>e.active).sort((e,t)=>e.t-t.t).map(e=>e.id),p=(e,t)=>{let n=null,r=1/0;for(let i of e){let e=document.getElementById(i.id);if(!e)continue;let a=Math.abs(e.getBoundingClientRect().top-t);a<r&&(r=a,n=i.id)}return n},m=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},h=({itemBottom:e,itemTop:t,margin:n,scrollHeight:r,scrollTop:i,viewportHeight:a})=>{let o=i+n,s=i+a-n,c=Math.max(0,r-a);return t<o?Math.max(0,t-n):e>s?Math.min(c,e-a+n):i},g=(e,t)=>{let n=new Map(Array.from(e.querySelectorAll(`a[data-heading-id]`)).map(e=>[e.dataset.headingId??``,e]));return t.flatMap(e=>{let t=n.get(e.id);if(!t)return[];let r=getComputedStyle(t);return[{bottom:t.offsetTop+t.clientHeight-m(r.paddingBottom),depth:e.depth,id:e.id,top:t.offsetTop+m(r.paddingTop)}]})},_=(e,t)=>{if(t.length===0||e.length===0)return[];try{let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);n.setAttribute(`d`,t);let r=[],i=n.getTotalLength();return e.forEach((t,a)=>{let o=a>0?r[a-1][1]+(t.top-e[a-1].bottom):t.top;for(;o<i&&n.getPointAtLength(o).y<t.top;)o+=1;r.push([o,o+(t.bottom-t.top)])}),r}catch{return e.map(e=>[e.top,e.bottom])}},v=(e,t)=>{if(!e||!t)return e===t;if(e.height!==t.height||e.path!==t.path||e.width!==t.width||e.positions.length!==t.positions.length||e.itemLineLengths.length!==t.itemLineLengths.length)return!1;for(let n=0;n<e.positions.length;n+=1){let r=e.positions[n],i=t.positions[n];if(r.bottom!==i.bottom||r.depth!==i.depth||r.id!==i.id||r.top!==i.top||r.x!==i.x)return!1}for(let n=0;n<e.itemLineLengths.length;n+=1){let r=e.itemLineLengths[n],i=t.itemLineLengths[n];if(r[0]!==i[0]||r[1]!==i[1])return!1}return!0},y=(e,t)=>!e||!t?e===t:e.bottom===t.bottom&&e.offsetDistance===t.offsetDistance&&e.top===t.top,b=e=>{let t=C(e),[n,r,a]=w(t,e),o=(0,i.useMemo)(()=>new Set(t),[t]),s=(0,i.useId)(),[c,l]=(0,i.useState)(0);return{activeIds:t,activeIdSet:o,listId:s,listRef:n,measurement:r,scrollTop:c,setScrollTop:l,track:a}},x=({activeIds:e,activeIdSet:n,headings:o,listClassName:s,listId:f,listRef:p,measurement:m,onSelect:g,scrollTop:_,setScrollTop:v,track:y,wrapperClassName:b})=>((0,i.useEffect)(()=>{let t=p.current,n=e[0];if(!t||!n)return;let r=Array.from(t.querySelectorAll(`a[data-heading-id]`)).find(e=>e.dataset.headingId===n);if(!r)return;let i=h({itemBottom:r.offsetTop+r.offsetHeight,itemTop:r.offsetTop,margin:16,scrollHeight:t.scrollHeight,scrollTop:t.scrollTop,viewportHeight:t.clientHeight});i!==t.scrollTop&&t.scrollTo({top:i})},[e,p]),(0,a.jsxs)(`div`,{className:(0,r.cn)(`relative flex min-h-0 flex-col`,b),children:[(0,a.jsxs)(`div`,{"aria-hidden":`true`,"data-docs-toc-track":`true`,className:`pointer-events-none absolute left-0 top-0 transition-transform duration-150 ease-out`,style:l(m,_),children:[(0,a.jsx)(`svg`,{"data-docs-toc-track-path":`true`,height:m?.height??1,viewBox:`0 0 ${m?.width??1} ${m?.height??1}`,width:m?.width??1,className:`absolute left-0 top-0 transition-[clip-path,opacity] duration-150 ease-out`,style:u(y),children:(0,a.jsx)(`path`,{d:m?.path||`M0 0 L0 0`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-primary`})}),(0,a.jsx)(`span`,{"data-docs-toc-thumb":`true`,className:`absolute left-0 top-0 size-1 rounded-full bg-primary transition-[opacity,offset-distance] duration-150 ease-out`,style:d(m,y)})]}),(0,a.jsx)(`ol`,{id:f,ref:p,className:(0,r.cn)(`flex flex-col overflow-auto py-1 [scrollbar-width:none]`,s),onScroll:e=>{v(e.currentTarget.scrollTop)},children:o.map((e,r)=>{let i=n.has(e.id),s=t.getTocGuideOffset(e.depth),l=r>0?t.getTocGuideOffset(o[r-1].depth):s,u=r+1<o.length?t.getTocGuideOffset(o[r+1].depth):s;return(0,a.jsx)(`li`,{children:(0,a.jsxs)(`a`,{href:`#${e.id}`,"data-active":i?`true`:`false`,"data-depth":e.depth,"data-heading-id":e.id,className:c(),style:{paddingInlineStart:`${t.getTocItemPadding(e.depth)}px`},onClick:g,children:[s===l?null:(0,a.jsx)(`svg`,{"aria-hidden":`true`,"data-docs-toc-item-curve":`true`,viewBox:`${Math.min(s,l)} 0 ${Math.abs(l-s)} 12`,className:`pointer-events-none absolute`,style:{height:`12px`,insetInlineStart:`${Math.min(s,l)}px`,top:`-6px`,width:`${Math.abs(l-s)+1}px`,zIndex:-1},children:(0,a.jsx)(`path`,{d:`M ${l} 0 C ${l} 8 ${s} 4 ${s} 12`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-border`})}),(0,a.jsx)(`span`,{"aria-hidden":`true`,"data-docs-toc-item-line":`true`,className:`pointer-events-none absolute w-px bg-border`,style:{bottom:s===u?`0px`:`6px`,insetInlineStart:`${s}px`,top:s===l?`0px`:`6px`,zIndex:-1}}),e.title]})},e.id)})})]})),S=(e,t,n)=>{let r=new Set(e),i=t.positions.findIndex(e=>r.has(e.id));if(i===-1)return[null,null];let a=i;t.positions.forEach((e,t)=>{r.has(e.id)&&(a=t)});let o=n?n.startIdx>i||n.endIdx>a||n.startIdx===i&&n.endIdx===a&&n.isUp:!1,s=t.itemLineLengths[i]?.[0]??t.positions[i].top,c=t.itemLineLengths[a]?.[1]??t.positions[a].bottom;return[{bottom:t.positions[a].bottom,offsetDistance:o?s:c,top:t.positions[i].top},{endIdx:a,isUp:o,startIdx:i}]};function C(e){let[t,n]=(0,i.useState)([]);return(0,i.useEffect)(()=>{if(e.length===0||typeof document>`u`||typeof IntersectionObserver>`u`)return;let t=new Map(e.map(e=>[e.id,{active:!1,fallback:!1,id:e.id,t:0}])),r=(e=0)=>{for(let e of t.values())e.fallback&&(e.active=!1,e.fallback=!1);let r=f([...t.values()]);if(r.length===0){let n=p([...t.values()],e),i=n?t.get(n):void 0;i&&(i.active=!0,i.fallback=!0,i.t=Date.now(),r=[i.id])}n(r)},i=new IntersectionObserver(e=>{let n=Date.now();for(let r of e){let e=t.get(r.target.id);e&&(e.active!==r.isIntersecting||e.fallback)&&(e.active=r.isIntersecting,e.fallback=!1,e.t=n)}r(e[0]?.rootBounds?.top??0)},{threshold:.9});return e.forEach(e=>{let t=document.getElementById(e.id);t&&i.observe(t)}),r(),()=>{i.disconnect()}},[e]),t}function w(e,n){let r=(0,i.useRef)(null),[a,o]=(0,i.useState)(null),[s,c]=(0,i.useState)(null),l=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=r.current;if(!e)return;let i=0,a=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(()=>{let r=t.buildTocTrackGeometry(g(e,n)),i={...r,itemLineLengths:_(r.positions,r.path)};o(e=>v(e,i)?e:i)})},s=typeof ResizeObserver>`u`?null:new ResizeObserver(a);return s?.observe(e),window.addEventListener(`resize`,a),a(),()=>{cancelAnimationFrame(i),s?.disconnect(),window.removeEventListener(`resize`,a)}},[n]),(0,i.useEffect)(()=>{let t=0;return t=requestAnimationFrame(()=>{if(!a||e.length===0){l.current=null,c(e=>e===null?e:null);return}let[t,n]=S(e,a,l.current);l.current=n,c(e=>y(e,t)?e:t)}),()=>{cancelAnimationFrame(t)}},[e,a]),[r,a,s]}const T=({className:e,collapseDirection:t=`left`,collapseLabel:n=`Collapse outline`,collapseEnabled:c=!1,defaultCollapsed:l=!1,dock:u=`sticky`,expandLabel:d=`Expand outline`,headings:f,minHeadings:p=1,title:m=s})=>{let h=b(f),[g,_]=(0,i.useState)(l),v=g?d:n,y=t===`right`?`right-0`:`left-0`,S=c?t===`right`?`pr-10`:`pl-10`:void 0;return f.length<p?null:(0,a.jsx)(`aside`,{"data-docs-region":`toc`,"data-docs-toc-collapsible":c?`true`:void 0,"data-docs-toc-collapsed":c?String(g):void 0,className:(0,r.cn)(`hidden w-64 xl:block`,u===`sticky`?`shrink-0 xl:self-start xl:sticky xl:top-24`:`xl:fixed xl:top-24`,e),children:(0,a.jsxs)(`nav`,{"aria-label":m,className:(0,r.cn)(`relative flex w-64 flex-col text-sm`,t===`right`?`ml-auto`:void 0),children:[(0,a.jsxs)(`div`,{inert:c&&g?!0:void 0,"aria-hidden":c&&g?!0:void 0,className:(0,r.cn)(`flex w-64 flex-col gap-3 overflow-hidden transition-opacity duration-200 ease-out motion-reduce:transition-none`,c&&g?`pointer-events-none opacity-0`:`opacity-100`),children:[(0,a.jsx)(`p`,{className:(0,r.cn)(`font-medium text-foreground`,S),children:m}),(0,a.jsx)(x,{...h,headings:f,listClassName:`max-h-[calc(100dvh-8rem)]`})]}),c?(0,a.jsxs)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,"data-docs-toc-toggle":`true`,"aria-controls":h.listId,"aria-label":v,"aria-expanded":!g,title:v,className:(0,r.cn)(y,`absolute top-0 z-10 shrink-0 text-muted-foreground transition-opacity duration-200 ease-out hover:text-foreground hover:opacity-100 motion-reduce:transition-none`,g?`opacity-100`:`opacity-60`),onClick:()=>{_(e=>!e)},children:[(0,a.jsx)(o.TableOfContents,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`sr-only`,children:v})]}):null]})})},E=({className:e,headings:t,minHeadings:c=1,openLabel:l=`Open outline`,title:u=s})=>{let d=b(t),[f,p]=(0,i.useState)(!1);return t.length<c?null:(0,a.jsx)(`div`,{className:(0,r.cn)(`xl:hidden`,e),children:(0,a.jsxs)(r.Sheet,{open:f,onOpenChange:p,children:[(0,a.jsxs)(r.SheetTrigger,{title:l,"aria-label":l,"data-docs-toc-mobile-trigger":`true`,className:(0,r.buttonVariants)({variant:`outline`,size:`icon`,className:`fixed border border-input bg-background shadow-sm`}),style:n.getDocsFloatingActionStyle(1),children:[(0,a.jsx)(o.TableOfContents,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`sr-only`,children:l})]}),(0,a.jsxs)(r.SheetContent,{side:`right`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[(0,a.jsx)(r.SheetHeader,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:(0,a.jsx)(r.SheetTitle,{children:u})}),(0,a.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:(0,a.jsx)(x,{...d,headings:t,listClassName:`min-h-0 flex-1`,wrapperClassName:`min-h-0 flex-1`,onSelect:()=>{p(!1)}})})]})]})})};exports.DefaultDocsToc=T,exports.MobileDocsToc=E;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- "use client";import{buildTocTrackGeometry as e,getTocGuideOffset as t,getTocItemPadding as n}from"./docs-toc-geometry.mjs";import{getDocsFloatingActionStyle as r}from"./floating-actions.mjs";import{Button as i,Sheet as a,SheetContent as o,SheetHeader as s,SheetTitle as c,SheetTrigger as l,cn as u}from"blackwork";import{useEffect as d,useId as f,useMemo as p,useRef as m,useState as h}from"react";import{jsx as g,jsxs as _}from"react/jsx-runtime";import{Toc as v}from"blackwork/icons";const y=`On This Page`,b=()=>[`relative block py-1.5 pr-3 text-sm text-muted-foreground transition-colors`,`hover:text-foreground data-[active=true]:text-primary`].join(` `),x=(e,t)=>({height:`${e?.height??1}px`,transform:`translateY(${-t}px)`,width:`${e?.width??1}px`}),S=e=>{let t=e?.top??0,n=e?.bottom??0;return{clipPath:`polygon(0 ${t}px, 100% ${t}px, 100% ${n}px, 0 ${n}px)`,opacity:+!!e}},C=(e,t)=>({offsetDistance:`${t?.offsetDistance??0}px`,offsetPath:`path("${e?.path||`M0 0 L0 0`}")`,opacity:+!!t}),w=e=>e.filter(e=>e.active).sort((e,t)=>e.t-t.t).map(e=>e.id),T=(e,t)=>{let n=null,r=1/0;for(let i of e){let e=document.getElementById(i.id);if(!e)continue;let a=Math.abs(e.getBoundingClientRect().top-t);a<r&&(r=a,n=i.id)}return n},E=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},D=({itemBottom:e,itemTop:t,margin:n,scrollHeight:r,scrollTop:i,viewportHeight:a})=>{let o=i+n,s=i+a-n,c=Math.max(0,r-a);return t<o?Math.max(0,t-n):e>s?Math.min(c,e-a+n):i},O=(e,t)=>{let n=new Map(Array.from(e.querySelectorAll(`a[data-heading-id]`)).map(e=>[e.dataset.headingId??``,e]));return t.flatMap(e=>{let t=n.get(e.id);if(!t)return[];let r=getComputedStyle(t);return[{bottom:t.offsetTop+t.clientHeight-E(r.paddingBottom),depth:e.depth,id:e.id,top:t.offsetTop+E(r.paddingTop)}]})},k=(e,t)=>{if(t.length===0||e.length===0)return[];try{let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);n.setAttribute(`d`,t);let r=[],i=n.getTotalLength();return e.forEach((t,a)=>{let o=a>0?r[a-1][1]+(t.top-e[a-1].bottom):t.top;for(;o<i&&n.getPointAtLength(o).y<t.top;)o+=1;r.push([o,o+(t.bottom-t.top)])}),r}catch{return e.map(e=>[e.top,e.bottom])}},A=(e,t)=>{if(!e||!t)return e===t;if(e.height!==t.height||e.path!==t.path||e.width!==t.width||e.positions.length!==t.positions.length||e.itemLineLengths.length!==t.itemLineLengths.length)return!1;for(let n=0;n<e.positions.length;n+=1){let r=e.positions[n],i=t.positions[n];if(r.bottom!==i.bottom||r.depth!==i.depth||r.id!==i.id||r.top!==i.top||r.x!==i.x)return!1}for(let n=0;n<e.itemLineLengths.length;n+=1){let r=e.itemLineLengths[n],i=t.itemLineLengths[n];if(r[0]!==i[0]||r[1]!==i[1])return!1}return!0},j=(e,t)=>!e||!t?e===t:e.bottom===t.bottom&&e.offsetDistance===t.offsetDistance&&e.top===t.top,M=e=>{let t=F(e),[n,r,i]=I(t,e),a=p(()=>new Set(t),[t]),o=f(),[s,c]=h(0);return{activeIds:t,activeIdSet:a,listId:o,listRef:n,measurement:r,scrollTop:s,setScrollTop:c,track:i}},N=({activeIds:e,activeIdSet:r,headings:i,listClassName:a,listId:o,listRef:s,measurement:c,onSelect:l,scrollTop:f,setScrollTop:p,track:m,wrapperClassName:h})=>(d(()=>{let t=s.current,n=e[0];if(!t||!n)return;let r=Array.from(t.querySelectorAll(`a[data-heading-id]`)).find(e=>e.dataset.headingId===n);if(!r)return;let i=D({itemBottom:r.offsetTop+r.offsetHeight,itemTop:r.offsetTop,margin:16,scrollHeight:t.scrollHeight,scrollTop:t.scrollTop,viewportHeight:t.clientHeight});i!==t.scrollTop&&t.scrollTo({top:i})},[e,s]),_(`div`,{className:u(`relative flex min-h-0 flex-col`,h),children:[_(`div`,{"aria-hidden":`true`,"data-docs-toc-track":`true`,className:`pointer-events-none absolute left-0 top-0 transition-transform duration-150 ease-out`,style:x(c,f),children:[g(`svg`,{"data-docs-toc-track-path":`true`,height:c?.height??1,viewBox:`0 0 ${c?.width??1} ${c?.height??1}`,width:c?.width??1,className:`absolute left-0 top-0 transition-[clip-path,opacity] duration-150 ease-out`,style:S(m),children:g(`path`,{d:c?.path||`M0 0 L0 0`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-primary`})}),g(`span`,{"data-docs-toc-thumb":`true`,className:`absolute left-0 top-0 size-1 rounded-full bg-primary transition-[opacity,offset-distance] duration-150 ease-out`,style:C(c,m)})]}),g(`ol`,{id:o,ref:s,className:u(`flex flex-col overflow-auto py-1 [scrollbar-width:none]`,a),onScroll:e=>{p(e.currentTarget.scrollTop)},children:i.map((e,a)=>{let o=r.has(e.id),s=t(e.depth),c=a>0?t(i[a-1].depth):s,u=a+1<i.length?t(i[a+1].depth):s;return g(`li`,{children:_(`a`,{href:`#${e.id}`,"data-active":o?`true`:`false`,"data-depth":e.depth,"data-heading-id":e.id,className:b(),style:{paddingInlineStart:`${n(e.depth)}px`},onClick:l,children:[s===c?null:g(`svg`,{"aria-hidden":`true`,"data-docs-toc-item-curve":`true`,viewBox:`${Math.min(s,c)} 0 ${Math.abs(c-s)} 12`,className:`pointer-events-none absolute`,style:{height:`12px`,insetInlineStart:`${Math.min(s,c)}px`,top:`-6px`,width:`${Math.abs(c-s)+1}px`,zIndex:-1},children:g(`path`,{d:`M ${c} 0 C ${c} 8 ${s} 4 ${s} 12`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-border`})}),g(`span`,{"aria-hidden":`true`,"data-docs-toc-item-line":`true`,className:`pointer-events-none absolute w-px bg-border`,style:{bottom:s===u?`0px`:`6px`,insetInlineStart:`${s}px`,top:s===c?`0px`:`6px`,zIndex:-1}}),e.title]})},e.id)})})]})),P=(e,t,n)=>{let r=new Set(e),i=t.positions.findIndex(e=>r.has(e.id));if(i===-1)return[null,null];let a=i;t.positions.forEach((e,t)=>{r.has(e.id)&&(a=t)});let o=n?n.startIdx>i||n.endIdx>a||n.startIdx===i&&n.endIdx===a&&n.isUp:!1,s=t.itemLineLengths[i]?.[0]??t.positions[i].top,c=t.itemLineLengths[a]?.[1]??t.positions[a].bottom;return[{bottom:t.positions[a].bottom,offsetDistance:o?s:c,top:t.positions[i].top},{endIdx:a,isUp:o,startIdx:i}]};function F(e){let[t,n]=h([]);return d(()=>{if(e.length===0||typeof document>`u`||typeof IntersectionObserver>`u`)return;let t=new Map(e.map(e=>[e.id,{active:!1,fallback:!1,id:e.id,t:0}])),r=(e=0)=>{for(let e of t.values())e.fallback&&(e.active=!1,e.fallback=!1);let r=w([...t.values()]);if(r.length===0){let n=T([...t.values()],e),i=n?t.get(n):void 0;i&&(i.active=!0,i.fallback=!0,i.t=Date.now(),r=[i.id])}n(r)},i=new IntersectionObserver(e=>{let n=Date.now();for(let r of e){let e=t.get(r.target.id);e&&(e.active!==r.isIntersecting||e.fallback)&&(e.active=r.isIntersecting,e.fallback=!1,e.t=n)}r(e[0]?.rootBounds?.top??0)},{threshold:.9});return e.forEach(e=>{let t=document.getElementById(e.id);t&&i.observe(t)}),r(),()=>{i.disconnect()}},[e]),t}function I(t,n){let r=m(null),[i,a]=h(null),[o,s]=h(null),c=m(null);return d(()=>{let t=r.current;if(!t)return;let i=0,o=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(()=>{let r=e(O(t,n)),i={...r,itemLineLengths:k(r.positions,r.path)};a(e=>A(e,i)?e:i)})},s=typeof ResizeObserver>`u`?null:new ResizeObserver(o);return s?.observe(t),window.addEventListener(`resize`,o),o(),()=>{cancelAnimationFrame(i),s?.disconnect(),window.removeEventListener(`resize`,o)}},[n]),d(()=>{let e=0;return e=requestAnimationFrame(()=>{if(!i||t.length===0){c.current=null,s(e=>e===null?e:null);return}let[e,n]=P(t,i,c.current);c.current=n,s(t=>j(t,e)?t:e)}),()=>{cancelAnimationFrame(e)}},[t,i]),[r,i,o]}const L=({className:e,collapseDirection:t=`left`,collapseLabel:n=`Collapse outline`,collapseEnabled:r=!1,defaultCollapsed:a=!1,dock:o=`sticky`,expandLabel:s=`Expand outline`,headings:c,minHeadings:l=1,title:d=y})=>{let f=M(c),[p,m]=h(a),b=p?s:n,x=t===`right`?`right-0`:`left-0`,S=r?t===`right`?`pr-10`:`pl-10`:void 0;return c.length<l?null:g(`aside`,{"data-docs-region":`toc`,"data-docs-toc-collapsible":r?`true`:void 0,"data-docs-toc-collapsed":r?String(p):void 0,className:u(`hidden w-64 xl:block`,o===`sticky`?`shrink-0 xl:self-start xl:sticky xl:top-24`:`xl:fixed xl:top-24`,e),children:_(`nav`,{"aria-label":d,className:u(`relative flex w-64 flex-col text-sm`,t===`right`?`ml-auto`:void 0),children:[_(`div`,{inert:r&&p?!0:void 0,"aria-hidden":r&&p?!0:void 0,className:u(`flex w-64 flex-col gap-3 overflow-hidden transition-opacity duration-200 ease-out motion-reduce:transition-none`,r&&p?`pointer-events-none opacity-0`:`opacity-100`),children:[g(`p`,{className:u(`font-medium text-foreground`,S),children:d}),g(N,{...f,headings:c,listClassName:`max-h-[calc(100dvh-8rem)]`})]}),r?_(i,{type:`button`,variant:`ghost`,size:`icon`,"data-docs-toc-toggle":`true`,"aria-controls":f.listId,"aria-label":b,"aria-expanded":!p,title:b,className:u(x,`absolute top-0 z-10 shrink-0 text-muted-foreground transition-opacity duration-200 ease-out hover:text-foreground hover:opacity-100 motion-reduce:transition-none`,p?`opacity-100`:`opacity-60`),onClick:()=>{m(e=>!e)},children:[g(v,{className:`size-4`,"aria-hidden":`true`}),g(`span`,{className:`sr-only`,children:b})]}):null]})})},R=({className:e,headings:t,minHeadings:n=1,openLabel:d=`Open outline`,title:f=y})=>{let p=M(t),[m,b]=h(!1);return t.length<n?null:g(`div`,{className:u(`xl:hidden`,e),children:_(a,{open:m,onOpenChange:b,children:[g(l,{asChild:!0,children:_(i,{type:`button`,variant:`outline`,size:`icon`,title:d,"aria-label":d,"data-docs-toc-mobile-trigger":`true`,className:`fixed border border-input bg-background shadow-sm`,style:r(1),children:[g(v,{className:`size-4`,"aria-hidden":`true`}),g(`span`,{className:`sr-only`,children:d})]})}),_(o,{side:`right`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[g(s,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:g(c,{children:f})}),g(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:g(N,{...p,headings:t,listClassName:`min-h-0 flex-1`,wrapperClassName:`min-h-0 flex-1`,onSelect:()=>{b(!1)}})})]})]})})};export{L as DefaultDocsToc,R as MobileDocsToc};
9
+ "use client";import{buildTocTrackGeometry as e,getTocGuideOffset as t,getTocItemPadding as n}from"./docs-toc-geometry.mjs";import{getDocsFloatingActionStyle as r}from"./floating-actions.mjs";import{Button as i,Sheet as a,SheetContent as o,SheetHeader as s,SheetTitle as c,SheetTrigger as l,buttonVariants as u,cn as d}from"blackwork";import{useEffect as f,useId as p,useMemo as m,useRef as h,useState as g}from"react";import{jsx as _,jsxs as v}from"react/jsx-runtime";import{TableOfContents as y}from"lucide-react";const b=`On This Page`,x=()=>[`relative block py-1.5 pr-3 text-sm text-muted-foreground transition-colors`,`hover:text-foreground data-[active=true]:text-primary`].join(` `),S=(e,t)=>({height:`${e?.height??1}px`,transform:`translateY(${-t}px)`,width:`${e?.width??1}px`}),C=e=>{let t=e?.top??0,n=e?.bottom??0;return{clipPath:`polygon(0 ${t}px, 100% ${t}px, 100% ${n}px, 0 ${n}px)`,opacity:+!!e}},w=(e,t)=>({offsetDistance:`${t?.offsetDistance??0}px`,offsetPath:`path("${e?.path||`M0 0 L0 0`}")`,opacity:+!!t}),T=e=>e.filter(e=>e.active).sort((e,t)=>e.t-t.t).map(e=>e.id),E=(e,t)=>{let n=null,r=1/0;for(let i of e){let e=document.getElementById(i.id);if(!e)continue;let a=Math.abs(e.getBoundingClientRect().top-t);a<r&&(r=a,n=i.id)}return n},D=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},O=({itemBottom:e,itemTop:t,margin:n,scrollHeight:r,scrollTop:i,viewportHeight:a})=>{let o=i+n,s=i+a-n,c=Math.max(0,r-a);return t<o?Math.max(0,t-n):e>s?Math.min(c,e-a+n):i},k=(e,t)=>{let n=new Map(Array.from(e.querySelectorAll(`a[data-heading-id]`)).map(e=>[e.dataset.headingId??``,e]));return t.flatMap(e=>{let t=n.get(e.id);if(!t)return[];let r=getComputedStyle(t);return[{bottom:t.offsetTop+t.clientHeight-D(r.paddingBottom),depth:e.depth,id:e.id,top:t.offsetTop+D(r.paddingTop)}]})},A=(e,t)=>{if(t.length===0||e.length===0)return[];try{let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);n.setAttribute(`d`,t);let r=[],i=n.getTotalLength();return e.forEach((t,a)=>{let o=a>0?r[a-1][1]+(t.top-e[a-1].bottom):t.top;for(;o<i&&n.getPointAtLength(o).y<t.top;)o+=1;r.push([o,o+(t.bottom-t.top)])}),r}catch{return e.map(e=>[e.top,e.bottom])}},j=(e,t)=>{if(!e||!t)return e===t;if(e.height!==t.height||e.path!==t.path||e.width!==t.width||e.positions.length!==t.positions.length||e.itemLineLengths.length!==t.itemLineLengths.length)return!1;for(let n=0;n<e.positions.length;n+=1){let r=e.positions[n],i=t.positions[n];if(r.bottom!==i.bottom||r.depth!==i.depth||r.id!==i.id||r.top!==i.top||r.x!==i.x)return!1}for(let n=0;n<e.itemLineLengths.length;n+=1){let r=e.itemLineLengths[n],i=t.itemLineLengths[n];if(r[0]!==i[0]||r[1]!==i[1])return!1}return!0},M=(e,t)=>!e||!t?e===t:e.bottom===t.bottom&&e.offsetDistance===t.offsetDistance&&e.top===t.top,N=e=>{let t=I(e),[n,r,i]=L(t,e),a=m(()=>new Set(t),[t]),o=p(),[s,c]=g(0);return{activeIds:t,activeIdSet:a,listId:o,listRef:n,measurement:r,scrollTop:s,setScrollTop:c,track:i}},P=({activeIds:e,activeIdSet:r,headings:i,listClassName:a,listId:o,listRef:s,measurement:c,onSelect:l,scrollTop:u,setScrollTop:p,track:m,wrapperClassName:h})=>(f(()=>{let t=s.current,n=e[0];if(!t||!n)return;let r=Array.from(t.querySelectorAll(`a[data-heading-id]`)).find(e=>e.dataset.headingId===n);if(!r)return;let i=O({itemBottom:r.offsetTop+r.offsetHeight,itemTop:r.offsetTop,margin:16,scrollHeight:t.scrollHeight,scrollTop:t.scrollTop,viewportHeight:t.clientHeight});i!==t.scrollTop&&t.scrollTo({top:i})},[e,s]),v(`div`,{className:d(`relative flex min-h-0 flex-col`,h),children:[v(`div`,{"aria-hidden":`true`,"data-docs-toc-track":`true`,className:`pointer-events-none absolute left-0 top-0 transition-transform duration-150 ease-out`,style:S(c,u),children:[_(`svg`,{"data-docs-toc-track-path":`true`,height:c?.height??1,viewBox:`0 0 ${c?.width??1} ${c?.height??1}`,width:c?.width??1,className:`absolute left-0 top-0 transition-[clip-path,opacity] duration-150 ease-out`,style:C(m),children:_(`path`,{d:c?.path||`M0 0 L0 0`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-primary`})}),_(`span`,{"data-docs-toc-thumb":`true`,className:`absolute left-0 top-0 size-1 rounded-full bg-primary transition-[opacity,offset-distance] duration-150 ease-out`,style:w(c,m)})]}),_(`ol`,{id:o,ref:s,className:d(`flex flex-col overflow-auto py-1 [scrollbar-width:none]`,a),onScroll:e=>{p(e.currentTarget.scrollTop)},children:i.map((e,a)=>{let o=r.has(e.id),s=t(e.depth),c=a>0?t(i[a-1].depth):s,u=a+1<i.length?t(i[a+1].depth):s;return _(`li`,{children:v(`a`,{href:`#${e.id}`,"data-active":o?`true`:`false`,"data-depth":e.depth,"data-heading-id":e.id,className:x(),style:{paddingInlineStart:`${n(e.depth)}px`},onClick:l,children:[s===c?null:_(`svg`,{"aria-hidden":`true`,"data-docs-toc-item-curve":`true`,viewBox:`${Math.min(s,c)} 0 ${Math.abs(c-s)} 12`,className:`pointer-events-none absolute`,style:{height:`12px`,insetInlineStart:`${Math.min(s,c)}px`,top:`-6px`,width:`${Math.abs(c-s)+1}px`,zIndex:-1},children:_(`path`,{d:`M ${c} 0 C ${c} 8 ${s} 4 ${s} 12`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-border`})}),_(`span`,{"aria-hidden":`true`,"data-docs-toc-item-line":`true`,className:`pointer-events-none absolute w-px bg-border`,style:{bottom:s===u?`0px`:`6px`,insetInlineStart:`${s}px`,top:s===c?`0px`:`6px`,zIndex:-1}}),e.title]})},e.id)})})]})),F=(e,t,n)=>{let r=new Set(e),i=t.positions.findIndex(e=>r.has(e.id));if(i===-1)return[null,null];let a=i;t.positions.forEach((e,t)=>{r.has(e.id)&&(a=t)});let o=n?n.startIdx>i||n.endIdx>a||n.startIdx===i&&n.endIdx===a&&n.isUp:!1,s=t.itemLineLengths[i]?.[0]??t.positions[i].top,c=t.itemLineLengths[a]?.[1]??t.positions[a].bottom;return[{bottom:t.positions[a].bottom,offsetDistance:o?s:c,top:t.positions[i].top},{endIdx:a,isUp:o,startIdx:i}]};function I(e){let[t,n]=g([]);return f(()=>{if(e.length===0||typeof document>`u`||typeof IntersectionObserver>`u`)return;let t=new Map(e.map(e=>[e.id,{active:!1,fallback:!1,id:e.id,t:0}])),r=(e=0)=>{for(let e of t.values())e.fallback&&(e.active=!1,e.fallback=!1);let r=T([...t.values()]);if(r.length===0){let n=E([...t.values()],e),i=n?t.get(n):void 0;i&&(i.active=!0,i.fallback=!0,i.t=Date.now(),r=[i.id])}n(r)},i=new IntersectionObserver(e=>{let n=Date.now();for(let r of e){let e=t.get(r.target.id);e&&(e.active!==r.isIntersecting||e.fallback)&&(e.active=r.isIntersecting,e.fallback=!1,e.t=n)}r(e[0]?.rootBounds?.top??0)},{threshold:.9});return e.forEach(e=>{let t=document.getElementById(e.id);t&&i.observe(t)}),r(),()=>{i.disconnect()}},[e]),t}function L(t,n){let r=h(null),[i,a]=g(null),[o,s]=g(null),c=h(null);return f(()=>{let t=r.current;if(!t)return;let i=0,o=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(()=>{let r=e(k(t,n)),i={...r,itemLineLengths:A(r.positions,r.path)};a(e=>j(e,i)?e:i)})},s=typeof ResizeObserver>`u`?null:new ResizeObserver(o);return s?.observe(t),window.addEventListener(`resize`,o),o(),()=>{cancelAnimationFrame(i),s?.disconnect(),window.removeEventListener(`resize`,o)}},[n]),f(()=>{let e=0;return e=requestAnimationFrame(()=>{if(!i||t.length===0){c.current=null,s(e=>e===null?e:null);return}let[e,n]=F(t,i,c.current);c.current=n,s(t=>M(t,e)?t:e)}),()=>{cancelAnimationFrame(e)}},[t,i]),[r,i,o]}const R=({className:e,collapseDirection:t=`left`,collapseLabel:n=`Collapse outline`,collapseEnabled:r=!1,defaultCollapsed:a=!1,dock:o=`sticky`,expandLabel:s=`Expand outline`,headings:c,minHeadings:l=1,title:u=b})=>{let f=N(c),[p,m]=g(a),h=p?s:n,x=t===`right`?`right-0`:`left-0`,S=r?t===`right`?`pr-10`:`pl-10`:void 0;return c.length<l?null:_(`aside`,{"data-docs-region":`toc`,"data-docs-toc-collapsible":r?`true`:void 0,"data-docs-toc-collapsed":r?String(p):void 0,className:d(`hidden w-64 xl:block`,o===`sticky`?`shrink-0 xl:self-start xl:sticky xl:top-24`:`xl:fixed xl:top-24`,e),children:v(`nav`,{"aria-label":u,className:d(`relative flex w-64 flex-col text-sm`,t===`right`?`ml-auto`:void 0),children:[v(`div`,{inert:r&&p?!0:void 0,"aria-hidden":r&&p?!0:void 0,className:d(`flex w-64 flex-col gap-3 overflow-hidden transition-opacity duration-200 ease-out motion-reduce:transition-none`,r&&p?`pointer-events-none opacity-0`:`opacity-100`),children:[_(`p`,{className:d(`font-medium text-foreground`,S),children:u}),_(P,{...f,headings:c,listClassName:`max-h-[calc(100dvh-8rem)]`})]}),r?v(i,{type:`button`,variant:`ghost`,size:`icon`,"data-docs-toc-toggle":`true`,"aria-controls":f.listId,"aria-label":h,"aria-expanded":!p,title:h,className:d(x,`absolute top-0 z-10 shrink-0 text-muted-foreground transition-opacity duration-200 ease-out hover:text-foreground hover:opacity-100 motion-reduce:transition-none`,p?`opacity-100`:`opacity-60`),onClick:()=>{m(e=>!e)},children:[_(y,{className:`size-4`,"aria-hidden":`true`}),_(`span`,{className:`sr-only`,children:h})]}):null]})})},z=({className:e,headings:t,minHeadings:n=1,openLabel:i=`Open outline`,title:f=b})=>{let p=N(t),[m,h]=g(!1);return t.length<n?null:_(`div`,{className:d(`xl:hidden`,e),children:v(a,{open:m,onOpenChange:h,children:[v(l,{title:i,"aria-label":i,"data-docs-toc-mobile-trigger":`true`,className:u({variant:`outline`,size:`icon`,className:`fixed border border-input bg-background shadow-sm`}),style:r(1),children:[_(y,{className:`size-4`,"aria-hidden":`true`}),_(`span`,{className:`sr-only`,children:i})]}),v(o,{side:`right`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[_(s,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:_(c,{children:f})}),_(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:_(P,{...p,headings:t,listClassName:`min-h-0 flex-1`,wrapperClassName:`min-h-0 flex-1`,onSelect:()=>{h(!1)}})})]})]})})};export{R as DefaultDocsToc,z as MobileDocsToc};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./link.cjs`);let n=require(`react`);n=e.__toESM(n);let r=require(`react/jsx-runtime`),i=require(`blackwork/rsc`);const a=({description:e,homeHref:n,LinkComponent:a=t.DefaultDocsLink,navigation:o,siteTitle:s})=>(0,r.jsx)(i.LayoutFooter,{"data-docs-region":`footer`,className:`h-auto min-h-32 border-t border-border/60 bg-background py-8`,children:(0,r.jsxs)(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-4`,children:[(0,r.jsxs)(`div`,{className:`space-y-2`,children:[(0,r.jsx)(a,{href:n,className:`text-sm font-semibold tracking-tight text-foreground`,children:s}),(0,r.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:e})]}),o.length>0?(0,r.jsx)(`nav`,{className:`flex flex-wrap items-center gap-3 text-sm`,children:o.map(e=>(0,r.jsx)(a,{href:e.href,"aria-current":e.current?`page`:void 0,className:`text-muted-foreground`,children:e.label},e.href))}):null]})});exports.DefaultDocsFooter=a;
9
+ const e=require(`../../_virtual/_rolldown/runtime.cjs`);let t=require(`blackwork/rsc`),n=require(`react`);n=e.__toESM(n);let r=require(`react/jsx-runtime`);const i=({siteTitle:e})=>(0,r.jsx)(t.LayoutFooter,{"data-docs-region":`footer`,className:`h-auto min-h-16 border-t border-border/60 bg-background py-6`,children:(0,r.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`© `,new Date().getFullYear(),` `,e]})});exports.DefaultDocsFooter=i;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- import{DefaultDocsLink as e}from"./link.mjs";import"react";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{LayoutFooter as r}from"blackwork/rsc";const i=({description:i,homeHref:a,LinkComponent:o=e,navigation:s,siteTitle:c})=>t(r,{"data-docs-region":`footer`,className:`h-auto min-h-32 border-t border-border/60 bg-background py-8`,children:n(`div`,{className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-4`,children:[n(`div`,{className:`space-y-2`,children:[t(o,{href:a,className:`text-sm font-semibold tracking-tight text-foreground`,children:c}),t(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:i})]}),s.length>0?t(`nav`,{className:`flex flex-wrap items-center gap-3 text-sm`,children:s.map(e=>t(o,{href:e.href,"aria-current":e.current?`page`:void 0,className:`text-muted-foreground`,children:e.label},e.href))}):null]})});export{i as DefaultDocsFooter};
9
+ import{LayoutFooter as e}from"blackwork/rsc";import"react";import{jsx as t,jsxs as n}from"react/jsx-runtime";const r=({siteTitle:r})=>t(e,{"data-docs-region":`footer`,className:`h-auto min-h-16 border-t border-border/60 bg-background py-6`,children:n(`p`,{className:`text-sm text-muted-foreground`,children:[`© `,new Date().getFullYear(),` `,r]})});export{r as DefaultDocsFooter};
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./link.cjs`);let n=require(`blackwork`),r=require(`react`);r=e.__toESM(r);let i=require(`react/jsx-runtime`),a=require(`blackwork/icons`);const o=e=>e.label||e.locale,s=({LinkComponent:e,localeLinks:t})=>{if(t.length<=1)return null;let r=t.find(e=>e.current),s=r?`Change language: ${o(r)}`:`Change language`;return(0,i.jsxs)(n.DropdownMenu,{children:[(0,i.jsx)(n.DropdownMenuTrigger,{asChild:!0,children:(0,i.jsxs)(n.Button,{variant:`ghost`,size:`icon`,title:s,"aria-label":`Change language`,"data-current-locale":r?`true`:void 0,className:`focus-visible:ring-0 focus-visible:ring-offset-0`,children:[(0,i.jsx)(a.Language,{className:`size-5`,"aria-hidden":`true`}),(0,i.jsx)(`span`,{className:`sr-only`,children:s})]})}),(0,i.jsx)(n.DropdownMenuContent,{align:`end`,className:`border-border`,children:t.map(t=>(0,i.jsx)(n.DropdownMenuItem,{asChild:!0,className:t.current?`gap-3 font-medium text-foreground`:`gap-3 text-muted-foreground`,children:(0,i.jsxs)(e,{href:t.href,hrefLang:t.lang,"aria-current":t.current?`page`:void 0,"data-current-locale":t.current?`true`:void 0,children:[(0,i.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-4 items-center justify-center`,"data-current-locale-indicator":t.current?``:void 0,children:t.current?(0,i.jsx)(a.Check,{className:`size-4`}):null}),o(t)]})},t.href))})]})},c=({headerActions:e,homeHref:r,LinkComponent:a=t.DefaultDocsLink,localeLinks:o=[],siteTitle:c})=>(0,i.jsxs)(n.LayoutHeader,{"data-docs-region":`header`,socialLinksVisible:!1,wrapperClassName:`mx-auto w-full max-w-screen-2xl px-6 sm:px-8 md:px-10 lg:px-12 xl:px-14`,contentClassName:`min-w-0`,className:`border-b border-border/60`,languageToggle:(0,i.jsx)(s,{LinkComponent:a,localeLinks:o}),themeToggle:(0,i.jsx)(n.ThemeToggle,{title:`Toggle theme`,ariaLabel:`Toggle theme`}),children:[(0,i.jsx)(a,{href:r,"data-docs-region":`header-brand`,className:`truncate text-lg font-semibold text-foreground`,children:c}),e?(0,i.jsx)(`div`,{"data-docs-region":`header-actions`,className:`ml-auto hidden items-center pl-4 md:flex`,children:e}):null]});exports.DefaultDocsHeader=c;
9
+ const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./link.cjs`);let n=require(`blackwork`),r=require(`react`);r=e.__toESM(r);let i=require(`react/jsx-runtime`),a=require(`lucide-react`);const o=e=>e.label||e.locale,s=({appearance:e,changeLanguageLabel:t,LinkComponent:r,localeLinks:s})=>{if(s.length<=1)return null;let c=s.find(e=>e.current),l=c?`${t}: ${o(c)}`:t;return(0,i.jsxs)(n.DropdownMenu,{children:[(0,i.jsx)(n.DropdownMenuTrigger,{title:l,"aria-label":t,"data-current-locale":c?`true`:void 0,asChild:!0,children:(0,i.jsxs)(n.Button,{variant:e===`glass`?`glass`:`ghost`,size:`icon`,children:[(0,i.jsx)(a.Languages,{className:`size-5`,"aria-hidden":`true`}),(0,i.jsx)(`span`,{className:`sr-only`,children:l})]})}),(0,i.jsx)(n.DropdownMenuContent,{align:`end`,className:`border-border`,children:s.map(e=>(0,i.jsx)(n.DropdownMenuItem,{asChild:!0,className:e.current?`gap-3 font-medium text-foreground`:`gap-3 text-muted-foreground`,children:(0,i.jsxs)(r,{href:e.href,hrefLang:e.lang,"aria-current":e.current?`page`:void 0,"data-current-locale":e.current?`true`:void 0,children:[(0,i.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-4 items-center justify-center`,"data-current-locale-indicator":e.current?``:void 0,children:e.current?(0,i.jsx)(a.Check,{className:`size-4`}):null}),o(e)]})},e.href))})]})},c=e=>e?`font-medium text-foreground`:`text-muted-foreground hover:text-foreground`,l=({appearance:e=`default`,headerActions:r,homeHref:o,LinkComponent:l=t.DefaultDocsLink,localeLinks:u=[],labels:d,navigation:f=[],socialLinks:p=[],siteTitle:m})=>{let h=f.map(t=>(0,i.jsx)(l,{href:t.href,"data-fluid-glass-item":e===`glass`?``:void 0,"aria-current":t.current?`page`:void 0,className:`rounded-md px-2.5 py-1.5 text-sm transition-colors ${c(t.current)}`,children:t.label},t.href));return(0,i.jsxs)(n.LayoutHeader,{appearance:e,"data-docs-region":`header`,socialLinks:p,wrapperClassName:`mx-auto w-full max-w-screen-2xl px-6 sm:px-8 md:px-10 lg:px-12 xl:px-14`,contentClassName:`min-w-0 gap-3 md:gap-6`,className:`border-b border-border/60`,languageToggle:(0,i.jsx)(s,{appearance:e,changeLanguageLabel:d?.changeLanguage??`Change language`,LinkComponent:l,localeLinks:u}),themeToggle:(0,i.jsx)(n.ThemeToggle,{variant:e===`glass`?`glass`:`ghost`,title:d?.toggleTheme??`Toggle theme`,ariaLabel:d?.toggleTheme??`Toggle theme`}),children:[(0,i.jsx)(l,{href:o,"data-docs-region":`header-brand`,className:`shrink-0 truncate text-lg font-semibold text-foreground`,children:m}),f.length>0?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.DropdownMenu,{children:[(0,i.jsx)(n.DropdownMenuTrigger,{asChild:!0,"aria-label":d?.openSiteNavigation??`Open site navigation`,children:(0,i.jsx)(n.Button,{variant:e===`glass`?`glass`:`ghost`,size:`icon`,className:`md:hidden`,title:d?.openSiteNavigation??`Open site navigation`,children:(0,i.jsx)(a.Menu,{className:`size-5`,"aria-hidden":`true`})})}),(0,i.jsx)(n.DropdownMenuContent,{align:`start`,className:`border-border`,children:f.map(e=>(0,i.jsx)(n.DropdownMenuItem,{asChild:!0,children:(0,i.jsx)(l,{href:e.href,"aria-current":e.current?`page`:void 0,className:c(e.current),children:e.label})},e.href))})]}),(0,i.jsx)(`nav`,{"aria-label":d?.primaryNavigation??`Primary navigation`,"data-docs-region":`header-nav`,className:`hidden min-w-0 items-center gap-1 md:flex`,children:e===`glass`?(0,i.jsx)(n.FluidGlass,{surface:!1,variant:`subtle`,className:`flex items-center gap-1`,children:h}):h})]}):null,r?(0,i.jsx)(`div`,{"data-docs-region":`header-actions`,className:`ml-auto flex items-center pl-2 md:pl-4`,children:r}):null]})};exports.DefaultDocsHeader=l;
@@ -1,14 +1,19 @@
1
1
 
2
2
  import { DocsThemeLinkComponent, DocsThemeLocaleLink, DocsThemeNavItem } from "../types.mjs";
3
+ import { DocsThemeLabels } from "./shell-shared.mjs";
4
+ import { SocialLinkProps } from "blackwork";
3
5
  import React from "react";
4
6
 
5
7
  //#region src/theme/components/header.d.ts
6
8
  interface DefaultDocsHeaderProps {
9
+ appearance?: 'default' | 'glass';
7
10
  headerActions?: React.ReactNode;
8
11
  homeHref: string;
9
12
  LinkComponent?: DocsThemeLinkComponent;
10
13
  localeLinks?: DocsThemeLocaleLink[];
11
14
  navigation: DocsThemeNavItem[];
15
+ socialLinks?: SocialLinkProps[];
16
+ labels?: Pick<DocsThemeLabels, 'changeLanguage' | 'openSiteNavigation' | 'primaryNavigation' | 'toggleTheme'>;
12
17
  siteDescription?: string;
13
18
  siteTitle: string;
14
19
  }
@@ -1,14 +1,19 @@
1
1
 
2
2
  import { DocsThemeLinkComponent, DocsThemeLocaleLink, DocsThemeNavItem } from "../types.js";
3
+ import { DocsThemeLabels } from "./shell-shared.js";
3
4
  import React from "react";
5
+ import { SocialLinkProps } from "blackwork";
4
6
 
5
7
  //#region src/theme/components/header.d.ts
6
8
  interface DefaultDocsHeaderProps {
9
+ appearance?: 'default' | 'glass';
7
10
  headerActions?: React.ReactNode;
8
11
  homeHref: string;
9
12
  LinkComponent?: DocsThemeLinkComponent;
10
13
  localeLinks?: DocsThemeLocaleLink[];
11
14
  navigation: DocsThemeNavItem[];
15
+ socialLinks?: SocialLinkProps[];
16
+ labels?: Pick<DocsThemeLabels, 'changeLanguage' | 'openSiteNavigation' | 'primaryNavigation' | 'toggleTheme'>;
12
17
  siteDescription?: string;
13
18
  siteTitle: string;
14
19
  }
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- import{DefaultDocsLink as e}from"./link.mjs";import{Button as t,DropdownMenu as n,DropdownMenuContent as r,DropdownMenuItem as i,DropdownMenuTrigger as a,LayoutHeader as o,ThemeToggle as s}from"blackwork";import"react";import{jsx as c,jsxs as l}from"react/jsx-runtime";import{Check as u,Language as d}from"blackwork/icons";const f=e=>e.label||e.locale,p=({LinkComponent:e,localeLinks:o})=>{if(o.length<=1)return null;let s=o.find(e=>e.current),p=s?`Change language: ${f(s)}`:`Change language`;return l(n,{children:[c(a,{asChild:!0,children:l(t,{variant:`ghost`,size:`icon`,title:p,"aria-label":`Change language`,"data-current-locale":s?`true`:void 0,className:`focus-visible:ring-0 focus-visible:ring-offset-0`,children:[c(d,{className:`size-5`,"aria-hidden":`true`}),c(`span`,{className:`sr-only`,children:p})]})}),c(r,{align:`end`,className:`border-border`,children:o.map(t=>c(i,{asChild:!0,className:t.current?`gap-3 font-medium text-foreground`:`gap-3 text-muted-foreground`,children:l(e,{href:t.href,hrefLang:t.lang,"aria-current":t.current?`page`:void 0,"data-current-locale":t.current?`true`:void 0,children:[c(`span`,{"aria-hidden":`true`,className:`flex size-4 items-center justify-center`,"data-current-locale-indicator":t.current?``:void 0,children:t.current?c(u,{className:`size-4`}):null}),f(t)]})},t.href))})]})},m=({headerActions:t,homeHref:n,LinkComponent:r=e,localeLinks:i=[],siteTitle:a})=>l(o,{"data-docs-region":`header`,socialLinksVisible:!1,wrapperClassName:`mx-auto w-full max-w-screen-2xl px-6 sm:px-8 md:px-10 lg:px-12 xl:px-14`,contentClassName:`min-w-0`,className:`border-b border-border/60`,languageToggle:c(p,{LinkComponent:r,localeLinks:i}),themeToggle:c(s,{title:`Toggle theme`,ariaLabel:`Toggle theme`}),children:[c(r,{href:n,"data-docs-region":`header-brand`,className:`truncate text-lg font-semibold text-foreground`,children:a}),t?c(`div`,{"data-docs-region":`header-actions`,className:`ml-auto hidden items-center pl-4 md:flex`,children:t}):null]});export{m as DefaultDocsHeader};
9
+ import{DefaultDocsLink as e}from"./link.mjs";import{Button as t,DropdownMenu as n,DropdownMenuContent as r,DropdownMenuItem as i,DropdownMenuTrigger as a,FluidGlass as o,LayoutHeader as s,ThemeToggle as c}from"blackwork";import"react";import{Fragment as l,jsx as u,jsxs as d}from"react/jsx-runtime";import{Check as f,Languages as p,Menu as m}from"lucide-react";const h=e=>e.label||e.locale,g=({appearance:e,changeLanguageLabel:o,LinkComponent:s,localeLinks:c})=>{if(c.length<=1)return null;let l=c.find(e=>e.current),m=l?`${o}: ${h(l)}`:o;return d(n,{children:[u(a,{title:m,"aria-label":o,"data-current-locale":l?`true`:void 0,asChild:!0,children:d(t,{variant:e===`glass`?`glass`:`ghost`,size:`icon`,children:[u(p,{className:`size-5`,"aria-hidden":`true`}),u(`span`,{className:`sr-only`,children:m})]})}),u(r,{align:`end`,className:`border-border`,children:c.map(e=>u(i,{asChild:!0,className:e.current?`gap-3 font-medium text-foreground`:`gap-3 text-muted-foreground`,children:d(s,{href:e.href,hrefLang:e.lang,"aria-current":e.current?`page`:void 0,"data-current-locale":e.current?`true`:void 0,children:[u(`span`,{"aria-hidden":`true`,className:`flex size-4 items-center justify-center`,"data-current-locale-indicator":e.current?``:void 0,children:e.current?u(f,{className:`size-4`}):null}),h(e)]})},e.href))})]})},_=e=>e?`font-medium text-foreground`:`text-muted-foreground hover:text-foreground`,v=({appearance:f=`default`,headerActions:p,homeHref:h,LinkComponent:v=e,localeLinks:y=[],labels:b,navigation:x=[],socialLinks:S=[],siteTitle:C})=>{let w=x.map(e=>u(v,{href:e.href,"data-fluid-glass-item":f===`glass`?``:void 0,"aria-current":e.current?`page`:void 0,className:`rounded-md px-2.5 py-1.5 text-sm transition-colors ${_(e.current)}`,children:e.label},e.href));return d(s,{appearance:f,"data-docs-region":`header`,socialLinks:S,wrapperClassName:`mx-auto w-full max-w-screen-2xl px-6 sm:px-8 md:px-10 lg:px-12 xl:px-14`,contentClassName:`min-w-0 gap-3 md:gap-6`,className:`border-b border-border/60`,languageToggle:u(g,{appearance:f,changeLanguageLabel:b?.changeLanguage??`Change language`,LinkComponent:v,localeLinks:y}),themeToggle:u(c,{variant:f===`glass`?`glass`:`ghost`,title:b?.toggleTheme??`Toggle theme`,ariaLabel:b?.toggleTheme??`Toggle theme`}),children:[u(v,{href:h,"data-docs-region":`header-brand`,className:`shrink-0 truncate text-lg font-semibold text-foreground`,children:C}),x.length>0?d(l,{children:[d(n,{children:[u(a,{asChild:!0,"aria-label":b?.openSiteNavigation??`Open site navigation`,children:u(t,{variant:f===`glass`?`glass`:`ghost`,size:`icon`,className:`md:hidden`,title:b?.openSiteNavigation??`Open site navigation`,children:u(m,{className:`size-5`,"aria-hidden":`true`})})}),u(r,{align:`start`,className:`border-border`,children:x.map(e=>u(i,{asChild:!0,children:u(v,{href:e.href,"aria-current":e.current?`page`:void 0,className:_(e.current),children:e.label})},e.href))})]}),u(`nav`,{"aria-label":b?.primaryNavigation??`Primary navigation`,"data-docs-region":`header-nav`,className:`hidden min-w-0 items-center gap-1 md:flex`,children:f===`glass`?u(o,{surface:!1,variant:`subtle`,className:`flex items-center gap-1`,children:w}):w})]}):null,p?u(`div`,{"data-docs-region":`header-actions`,className:`ml-auto flex items-center pl-2 md:pl-4`,children:p}):null]})};export{v as DefaultDocsHeader};
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../config/define-config.cjs`),n=require(`../../navigation/build-locale-links.cjs`),r=require(`../../navigation/build-sidebar.cjs`),i=require(`./link.cjs`),a=require(`./header.cjs`),o=require(`../slots.cjs`),s=require(`./docs-scroll-to-top.cjs`),c=require(`./shell-shared.cjs`),l=require(`../create-home-data.cjs`);let u=require(`blackwork`),d=require(`react`);d=e.__toESM(d);let f=require(`react/jsx-runtime`);const p=e=>e.site.title||`Documentation`,m=(e,t,r)=>{let i=r.getEntry(t,[]);return i?n.buildLocaleLinks({config:e,entry:i,source:r}):r.getLocaleCodes().map(n=>{let i=Object.values(e.content.locales??{}).find(e=>e.code===n);return{locale:n,href:r.getCanonicalHref(n,[]),label:i?.label,lang:i?.lang,current:n===t}})},h=(e,t)=>t.filter(e=>e.depth===0).map(t=>({href:t.href,label:t.title,current:e?.href===t.href})),g=({config:e,locale:n,source:d})=>{let g=t.defineConfig(e),_=d.getEntries(n),v=d.getEntry(n,[]),y=l.createHomeData({config:g,locale:n,source:d}),b=h(v,r.buildSidebar({entries:_,currentHref:y.homeHref})),x=m(g,n,d),S=o.resolveThemeSlots(g.slots),C=S.headerActions,w=S.link??i.DefaultDocsLink,T=c.getPagefindFilterEntries(c.getPagefindFilters({locale:n}));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.DefaultDocsHeader,{headerActions:C?(0,f.jsx)(C,{homeHref:y.homeHref,localeLinks:x,navigation:b,siteDescription:g.site.description,siteTitle:p(g)}):void 0,homeHref:y.homeHref,LinkComponent:w,localeLinks:x,navigation:b,siteDescription:g.site.description,siteTitle:p(g)}),(0,f.jsx)(s.DocsScrollToTop,{}),(0,f.jsxs)(`main`,{"data-docs-region":`home-shell`,className:`flex min-h-[calc(100dvh-4rem)] w-full flex-col bg-background px-6 py-10`,children:[(0,f.jsxs)(`section`,{"data-docs-region":`home-hero`,"data-home-mode":y.mode,"data-pagefind-body":``,className:`mx-auto flex w-full max-w-6xl flex-1 flex-col items-center justify-center gap-8 text-center`,children:[(0,f.jsx)(`div`,{hidden:!0,children:T.map(e=>(0,f.jsx)(`span`,{"data-pagefind-filter":e},e))}),y.badge||y.eyebrow?(0,f.jsxs)(u.Badge,{variant:`secondary`,className:`max-w-full gap-2 px-4 py-2 text-sm font-medium`,children:[y.badge?(0,f.jsx)(`span`,{className:`truncate`,children:y.badge}):null,y.badge&&y.eyebrow?(0,f.jsx)(u.Separator,{orientation:`vertical`,"aria-hidden":`true`,className:`h-4 bg-border`}):null,y.eyebrow?(0,f.jsx)(`span`,{className:`truncate text-muted-foreground`,children:y.eyebrow}):null]}):null,(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-6`,children:[(0,f.jsx)(`h1`,{className:`max-w-5xl text-balance text-5xl font-semibold leading-none text-foreground sm:text-6xl lg:text-7xl`,children:y.title}),(0,f.jsx)(`p`,{className:`max-w-3xl text-pretty text-lg leading-8 text-muted-foreground sm:text-xl`,children:y.description})]}),(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-base font-medium sm:flex-row`,children:[(0,f.jsx)(u.Button,{asChild:!0,size:`lg`,className:`rounded-full px-6 shadow-sm`,children:(0,f.jsx)(w,{href:y.primaryAction.href,children:y.primaryAction.label})}),y.secondaryAction?(0,f.jsx)(u.Button,{asChild:!0,variant:`ghost`,size:`lg`,className:`rounded-full px-6`,children:(0,f.jsx)(w,{href:y.secondaryAction.href,children:y.secondaryAction.label})}):null]})]}),y.highlights.length>0?(0,f.jsx)(`section`,{"data-docs-region":`home-highlights`,className:`mx-auto grid w-full max-w-6xl gap-4 pb-16 md:grid-cols-3`,children:y.highlights.map(e=>(0,f.jsx)(w,{href:e.href,className:`block transition-colors`,children:(0,f.jsx)(u.Card,{className:`h-full border-border/60 transition-colors hover:bg-accent hover:text-accent-foreground`,children:(0,f.jsxs)(u.CardContent,{className:`flex flex-col gap-2 p-4`,children:[(0,f.jsx)(`h2`,{className:`text-lg font-medium text-foreground`,children:e.title}),(0,f.jsx)(`p`,{className:`text-pretty text-sm text-muted-foreground`,children:e.description})]})})},e.href))}):null]})]})};exports.DefaultHomeShell=g;
9
+ const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../config/define-config.cjs`),n=require(`../../navigation/build-locale-links.cjs`),r=require(`../../navigation/build-header-nav.cjs`),i=require(`./link.cjs`),a=require(`./header.cjs`),o=require(`../slots.cjs`),s=require(`./docs-scroll-to-top.cjs`),c=require(`./shell-shared.cjs`),l=require(`../create-home-data.cjs`);let u=require(`blackwork`),d=require(`react`);d=e.__toESM(d);let f=require(`react/jsx-runtime`);const p=e=>e.site.title||`Documentation`,m=({badge:e})=>{let t=(0,f.jsx)(`img`,{src:e.src,alt:e.alt,className:`block h-5 max-w-full`});if(!e.href)return t;let n=/^https?:\/\//u.test(e.href);return(0,f.jsx)(`a`,{href:e.href,className:`inline-flex rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,...n?{target:`_blank`,rel:`noreferrer`}:{},children:t})},h=(e,t,r)=>{let i=r.getEntry(t,[]);return i?n.buildLocaleLinks({config:e,entry:i,source:r}):r.getLocaleCodes().map(n=>{let i=Object.values(e.content.locales??{}).find(e=>e.code===n);return{locale:n,href:r.getCanonicalHref(n,[]),label:i?.label,lang:i?.lang,current:n===t}})},g=({config:e,locale:n,source:d})=>{let g=t.defineConfig(e),_=l.createHomeData({config:g,locale:n,source:d}),v=r.buildHeaderNavigation({config:g,currentHref:_.homeHref,locale:n,source:d}),y=h(g,n,d),b=c.getThemeLabels(g,n),x=c.getThemeSocialLinks(g,n),S=o.resolveThemeSlots(g.slots),C=S.headerActions,w=S.homePreview,T=S.link??i.DefaultDocsLink,E=c.getPagefindFilterEntries(c.getPagefindFilters({locale:n}));return(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(a.DefaultDocsHeader,{appearance:g.theme.appearance,headerActions:C?(0,f.jsx)(C,{homeHref:_.homeHref,localeLinks:y,navigation:v,siteDescription:g.site.description,siteTitle:p(g)}):void 0,homeHref:_.homeHref,LinkComponent:T,localeLinks:y,labels:b,navigation:v,socialLinks:x,siteDescription:g.site.description,siteTitle:p(g)}),(0,f.jsx)(s.DocsScrollToTop,{label:b.scrollToTop,appearance:g.theme.appearance}),(0,f.jsxs)(`main`,{"data-docs-region":`home-shell`,className:`flex min-h-[calc(100dvh-4rem)] w-full flex-col bg-background px-6 py-10`,children:[(0,f.jsxs)(`section`,{"data-docs-region":`home-hero`,"data-home-mode":_.mode,"data-pagefind-body":``,className:`mx-auto flex w-full max-w-6xl flex-1 flex-col items-center justify-center gap-8 py-8 text-center`,children:[(0,f.jsx)(`div`,{hidden:!0,children:E.map(e=>(0,f.jsx)(`span`,{"data-pagefind-filter":e},e))}),typeof _.badge==`object`?(0,f.jsxs)(`div`,{className:`flex max-w-full items-center gap-2`,children:[(0,f.jsx)(m,{badge:_.badge}),_.eyebrow?(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(u.Separator,{orientation:`vertical`,"aria-hidden":`true`,className:`h-4 bg-border`}),(0,f.jsx)(`span`,{className:`truncate text-sm font-medium text-muted-foreground`,children:_.eyebrow})]}):null]}):_.badge||_.eyebrow?(0,f.jsxs)(u.Badge,{variant:`secondary`,className:`max-w-full gap-2 px-4 py-2 text-sm font-medium`,children:[_.badge?(0,f.jsx)(`span`,{className:`truncate`,children:_.badge}):null,_.badge&&_.eyebrow?(0,f.jsx)(u.Separator,{orientation:`vertical`,"aria-hidden":`true`,className:`h-4 bg-border`}):null,_.eyebrow?(0,f.jsx)(`span`,{className:`truncate text-muted-foreground`,children:_.eyebrow}):null]}):null,(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-6`,children:[(0,f.jsx)(`h1`,{className:`max-w-5xl text-balance text-5xl font-semibold leading-none text-foreground sm:text-6xl lg:text-7xl`,children:_.title}),(0,f.jsx)(`p`,{className:`max-w-3xl text-pretty text-lg leading-8 text-muted-foreground sm:text-xl`,children:_.description})]}),(0,f.jsxs)(`div`,{className:`flex flex-col items-center gap-3 text-base font-medium sm:flex-row`,children:[(0,f.jsx)(u.Button,{asChild:!0,variant:g.theme.appearance===`glass`?`glass-primary`:`default`,size:`lg`,className:`rounded-full px-6 shadow-sm`,children:(0,f.jsx)(T,{href:_.primaryAction.href,children:_.primaryAction.label})}),_.secondaryAction?(0,f.jsx)(u.Button,{asChild:!0,variant:g.theme.appearance===`glass`?`glass`:`ghost`,size:`lg`,className:`rounded-full px-6`,children:(0,f.jsx)(T,{href:_.secondaryAction.href,children:_.secondaryAction.label})}):null]}),w?(0,f.jsx)(w,{locale:n}):null]}),_.highlights.length>0?(0,f.jsx)(`section`,{"data-docs-region":`home-highlights`,className:`mx-auto grid w-full max-w-6xl gap-4 pb-16 ${_.highlights.length===4?`sm:grid-cols-2 lg:grid-cols-4`:`md:grid-cols-3`}`,children:_.highlights.map(e=>(0,f.jsx)(T,{href:e.href,className:`block transition-colors`,children:(0,f.jsx)(u.Card,{className:`h-full border-border/60 transition-colors hover:bg-accent hover:text-accent-foreground`,children:(0,f.jsxs)(u.CardContent,{className:`flex flex-col gap-2 p-4`,children:[(0,f.jsx)(`h2`,{className:`text-lg font-medium text-foreground`,children:e.title}),(0,f.jsx)(`p`,{className:`text-pretty text-sm text-muted-foreground`,children:e.description})]})})},e.href))}):null]})]})};exports.DefaultHomeShell=g;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- import{defineConfig as e}from"../../config/define-config.mjs";import{buildLocaleLinks as t}from"../../navigation/build-locale-links.mjs";import{buildSidebar as n}from"../../navigation/build-sidebar.mjs";import{DefaultDocsLink as r}from"./link.mjs";import{DefaultDocsHeader as i}from"./header.mjs";import{resolveThemeSlots as a}from"../slots.mjs";import{DocsScrollToTop as o}from"./docs-scroll-to-top.mjs";import{getPagefindFilterEntries as s,getPagefindFilters as c}from"./shell-shared.mjs";import{createHomeData as l}from"../create-home-data.mjs";import{Badge as u,Button as d,Card as f,CardContent as p,Separator as m}from"blackwork";import"react";import{Fragment as h,jsx as g,jsxs as _}from"react/jsx-runtime";const v=e=>e.site.title||`Documentation`,y=(e,n,r)=>{let i=r.getEntry(n,[]);return i?t({config:e,entry:i,source:r}):r.getLocaleCodes().map(t=>{let i=Object.values(e.content.locales??{}).find(e=>e.code===t);return{locale:t,href:r.getCanonicalHref(t,[]),label:i?.label,lang:i?.lang,current:t===n}})},b=(e,t)=>t.filter(e=>e.depth===0).map(t=>({href:t.href,label:t.title,current:e?.href===t.href})),x=({config:t,locale:x,source:S})=>{let C=e(t),w=S.getEntries(x),T=S.getEntry(x,[]),E=l({config:C,locale:x,source:S}),D=b(T,n({entries:w,currentHref:E.homeHref})),O=y(C,x,S),k=a(C.slots),A=k.headerActions,j=k.link??r,M=s(c({locale:x}));return _(h,{children:[g(i,{headerActions:A?g(A,{homeHref:E.homeHref,localeLinks:O,navigation:D,siteDescription:C.site.description,siteTitle:v(C)}):void 0,homeHref:E.homeHref,LinkComponent:j,localeLinks:O,navigation:D,siteDescription:C.site.description,siteTitle:v(C)}),g(o,{}),_(`main`,{"data-docs-region":`home-shell`,className:`flex min-h-[calc(100dvh-4rem)] w-full flex-col bg-background px-6 py-10`,children:[_(`section`,{"data-docs-region":`home-hero`,"data-home-mode":E.mode,"data-pagefind-body":``,className:`mx-auto flex w-full max-w-6xl flex-1 flex-col items-center justify-center gap-8 text-center`,children:[g(`div`,{hidden:!0,children:M.map(e=>g(`span`,{"data-pagefind-filter":e},e))}),E.badge||E.eyebrow?_(u,{variant:`secondary`,className:`max-w-full gap-2 px-4 py-2 text-sm font-medium`,children:[E.badge?g(`span`,{className:`truncate`,children:E.badge}):null,E.badge&&E.eyebrow?g(m,{orientation:`vertical`,"aria-hidden":`true`,className:`h-4 bg-border`}):null,E.eyebrow?g(`span`,{className:`truncate text-muted-foreground`,children:E.eyebrow}):null]}):null,_(`div`,{className:`flex flex-col items-center gap-6`,children:[g(`h1`,{className:`max-w-5xl text-balance text-5xl font-semibold leading-none text-foreground sm:text-6xl lg:text-7xl`,children:E.title}),g(`p`,{className:`max-w-3xl text-pretty text-lg leading-8 text-muted-foreground sm:text-xl`,children:E.description})]}),_(`div`,{className:`flex flex-col items-center gap-3 text-base font-medium sm:flex-row`,children:[g(d,{asChild:!0,size:`lg`,className:`rounded-full px-6 shadow-sm`,children:g(j,{href:E.primaryAction.href,children:E.primaryAction.label})}),E.secondaryAction?g(d,{asChild:!0,variant:`ghost`,size:`lg`,className:`rounded-full px-6`,children:g(j,{href:E.secondaryAction.href,children:E.secondaryAction.label})}):null]})]}),E.highlights.length>0?g(`section`,{"data-docs-region":`home-highlights`,className:`mx-auto grid w-full max-w-6xl gap-4 pb-16 md:grid-cols-3`,children:E.highlights.map(e=>g(j,{href:e.href,className:`block transition-colors`,children:g(f,{className:`h-full border-border/60 transition-colors hover:bg-accent hover:text-accent-foreground`,children:_(p,{className:`flex flex-col gap-2 p-4`,children:[g(`h2`,{className:`text-lg font-medium text-foreground`,children:e.title}),g(`p`,{className:`text-pretty text-sm text-muted-foreground`,children:e.description})]})})},e.href))}):null]})]})};export{x as DefaultHomeShell};
9
+ import{defineConfig as e}from"../../config/define-config.mjs";import{buildLocaleLinks as t}from"../../navigation/build-locale-links.mjs";import{buildHeaderNavigation as n}from"../../navigation/build-header-nav.mjs";import{DefaultDocsLink as r}from"./link.mjs";import{DefaultDocsHeader as i}from"./header.mjs";import{resolveThemeSlots as a}from"../slots.mjs";import{DocsScrollToTop as o}from"./docs-scroll-to-top.mjs";import{getPagefindFilterEntries as s,getPagefindFilters as c,getThemeLabels as l,getThemeSocialLinks as u}from"./shell-shared.mjs";import{createHomeData as d}from"../create-home-data.mjs";import{Badge as f,Button as p,Card as m,CardContent as h,Separator as g}from"blackwork";import"react";import{Fragment as _,jsx as v,jsxs as y}from"react/jsx-runtime";const b=e=>e.site.title||`Documentation`,x=({badge:e})=>{let t=v(`img`,{src:e.src,alt:e.alt,className:`block h-5 max-w-full`});if(!e.href)return t;let n=/^https?:\/\//u.test(e.href);return v(`a`,{href:e.href,className:`inline-flex rounded-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,...n?{target:`_blank`,rel:`noreferrer`}:{},children:t})},S=(e,n,r)=>{let i=r.getEntry(n,[]);return i?t({config:e,entry:i,source:r}):r.getLocaleCodes().map(t=>{let i=Object.values(e.content.locales??{}).find(e=>e.code===t);return{locale:t,href:r.getCanonicalHref(t,[]),label:i?.label,lang:i?.lang,current:t===n}})},C=({config:t,locale:C,source:w})=>{let T=e(t),E=d({config:T,locale:C,source:w}),D=n({config:T,currentHref:E.homeHref,locale:C,source:w}),O=S(T,C,w),k=l(T,C),A=u(T,C),j=a(T.slots),M=j.headerActions,N=j.homePreview,P=j.link??r,F=s(c({locale:C}));return y(_,{children:[v(i,{appearance:T.theme.appearance,headerActions:M?v(M,{homeHref:E.homeHref,localeLinks:O,navigation:D,siteDescription:T.site.description,siteTitle:b(T)}):void 0,homeHref:E.homeHref,LinkComponent:P,localeLinks:O,labels:k,navigation:D,socialLinks:A,siteDescription:T.site.description,siteTitle:b(T)}),v(o,{label:k.scrollToTop,appearance:T.theme.appearance}),y(`main`,{"data-docs-region":`home-shell`,className:`flex min-h-[calc(100dvh-4rem)] w-full flex-col bg-background px-6 py-10`,children:[y(`section`,{"data-docs-region":`home-hero`,"data-home-mode":E.mode,"data-pagefind-body":``,className:`mx-auto flex w-full max-w-6xl flex-1 flex-col items-center justify-center gap-8 py-8 text-center`,children:[v(`div`,{hidden:!0,children:F.map(e=>v(`span`,{"data-pagefind-filter":e},e))}),typeof E.badge==`object`?y(`div`,{className:`flex max-w-full items-center gap-2`,children:[v(x,{badge:E.badge}),E.eyebrow?y(_,{children:[v(g,{orientation:`vertical`,"aria-hidden":`true`,className:`h-4 bg-border`}),v(`span`,{className:`truncate text-sm font-medium text-muted-foreground`,children:E.eyebrow})]}):null]}):E.badge||E.eyebrow?y(f,{variant:`secondary`,className:`max-w-full gap-2 px-4 py-2 text-sm font-medium`,children:[E.badge?v(`span`,{className:`truncate`,children:E.badge}):null,E.badge&&E.eyebrow?v(g,{orientation:`vertical`,"aria-hidden":`true`,className:`h-4 bg-border`}):null,E.eyebrow?v(`span`,{className:`truncate text-muted-foreground`,children:E.eyebrow}):null]}):null,y(`div`,{className:`flex flex-col items-center gap-6`,children:[v(`h1`,{className:`max-w-5xl text-balance text-5xl font-semibold leading-none text-foreground sm:text-6xl lg:text-7xl`,children:E.title}),v(`p`,{className:`max-w-3xl text-pretty text-lg leading-8 text-muted-foreground sm:text-xl`,children:E.description})]}),y(`div`,{className:`flex flex-col items-center gap-3 text-base font-medium sm:flex-row`,children:[v(p,{asChild:!0,variant:T.theme.appearance===`glass`?`glass-primary`:`default`,size:`lg`,className:`rounded-full px-6 shadow-sm`,children:v(P,{href:E.primaryAction.href,children:E.primaryAction.label})}),E.secondaryAction?v(p,{asChild:!0,variant:T.theme.appearance===`glass`?`glass`:`ghost`,size:`lg`,className:`rounded-full px-6`,children:v(P,{href:E.secondaryAction.href,children:E.secondaryAction.label})}):null]}),N?v(N,{locale:C}):null]}),E.highlights.length>0?v(`section`,{"data-docs-region":`home-highlights`,className:`mx-auto grid w-full max-w-6xl gap-4 pb-16 ${E.highlights.length===4?`sm:grid-cols-2 lg:grid-cols-4`:`md:grid-cols-3`}`,children:E.highlights.map(e=>v(P,{href:e.href,className:`block transition-colors`,children:v(m,{className:`h-full border-border/60 transition-colors hover:bg-accent hover:text-accent-foreground`,children:y(h,{className:`flex flex-col gap-2 p-4`,children:[v(`h2`,{className:`text-lg font-medium text-foreground`,children:e.title}),v(`p`,{className:`text-pretty text-sm text-muted-foreground`,children:e.description})]})})},e.href))}):null]})]})};export{C as DefaultHomeShell};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- const e={layout:`docs`,sidebar:`auto`},t=e=>e.site.title||`Documentation`,n=(e,t)=>e.site.description||t.description||`Browse the available documentation.`,r=(e,t,n)=>typeof e==`string`?e:e?.[t]??n,i=(e,t)=>({collapseLabel:r(e.theme.toc?.collapseLabel,t,`Collapse outline`),expandLabel:r(e.theme.toc?.expandLabel,t,`Expand outline`),openLabel:r(e.theme.toc?.openLabel,t,`Open outline`),title:r(e.theme.toc?.title,t,`On This Page`)}),a=(e,t,n)=>t===e.href?!0:n.length===0?!1:n.every((t,n)=>e.slugSegments[n]===t),o=(e,t)=>t.filter(e=>e.depth===0).map(t=>({href:t.href,label:t.title,current:a(e,t.href,t.slugSegments)})),s=e=>e.flatMap(e=>{let t=e.children?s(e.children):[];return(e.depth??0)<=1?t:[{depth:e.depth??2,id:e.id,title:e.value??e.id},...t]}),c=e=>e.slugSegments[0],l=(e,t)=>{let n=c(t);return n?e.filter(e=>e.slugSegments[0]===n):e},u=(t,n)=>{let r=c(n);if(!r)return e;let i=t.content?.sections?.[r],a=i?.layout??e.layout;return{layout:a,sidebar:i?.sidebar??(a===`content`?!1:e.sidebar)}},d=e=>e?.trim(),f=e=>{let t=e.split(/[-_]/u).map(e=>d(e)).filter(e=>!!e);return{language:t[0]?.toLowerCase(),region:t.slice(1).find(e=>/^(?:[A-Za-z]{2}|\d{3})$/u.test(e))?.toUpperCase()}},p=({kind:e=`docs`,layout:t,locale:n,section:r})=>{let{language:i,region:a}=f(n);return{kind:e,locale:n,...i?{language:i}:{},...a?{region:a}:{},...r?{section:r}:{},...t?{layout:t}:{}}},m=e=>Object.entries(e).map(([e,t])=>`${e}:${t}`);exports.getEntrySectionConfig=u,exports.getEntrySectionKey=c,exports.getFooterDescription=n,exports.getPagefindFilterEntries=m,exports.getPagefindFilters=p,exports.getSectionEntries=l,exports.getSiteTitle=t,exports.getTocHeadings=s,exports.getTocLabels=i,exports.toNavigation=o;
9
+ const e={layout:`docs`,sidebar:`auto`},t=e=>e.site.title||`Documentation`,n=(e,t)=>e.site.description||t.description||`Browse the available documentation.`,r=(e,t,n)=>typeof e==`string`?e:e?.[t]??n,i=(e,t)=>({collapseLabel:r(e.theme.toc?.collapseLabel,t,`Collapse outline`),expandLabel:r(e.theme.toc?.expandLabel,t,`Expand outline`),openLabel:r(e.theme.toc?.openLabel,t,`Open outline`),title:r(e.theme.toc?.title,t,`On This Page`)}),a=(e,t)=>({changeLanguage:r(e.theme.labels?.changeLanguage,t,`Change language`),documentationPages:r(e.theme.labels?.documentationPages,t,`Documentation pages`),documentPager:r(e.theme.labels?.documentPager,t,`Document pager`),next:r(e.theme.labels?.next,t,`Next`),openSectionNavigation:r(e.theme.labels?.openSectionNavigation,t,`Open section navigation`),openSiteNavigation:r(e.theme.labels?.openSiteNavigation,t,`Open site navigation`),previous:r(e.theme.labels?.previous,t,`Previous`),primaryNavigation:r(e.theme.labels?.primaryNavigation,t,`Primary navigation`),scrollToTop:r(e.theme.labels?.scrollToTop,t,`Scroll to top`),sections:r(e.theme.labels?.sections,t,`Sections`),toggleTheme:r(e.theme.labels?.toggleTheme,t,`Toggle theme`)}),o=new Set([`github`,`x`,`twitter`,`instagram`,`zhihu`,`rss`]),s=(e,t)=>Array.isArray(e.theme.socialLinks)?e.theme.socialLinks.flatMap(e=>!e||typeof e.link!=`string`||e.link.length===0||!o.has(e.type)?[]:[{type:e.type,link:e.link,...e.label?{label:r(e.label,t,``)}:{},...e.ariaLabel?{ariaLabel:r(e.ariaLabel,t,``)}:{}}]):[],c=e=>e.flatMap(e=>{let t=e.children?c(e.children):[];return(e.depth??0)<=1?t:[{depth:e.depth??2,id:e.id,title:e.value??e.id},...t]}),l=e=>e.slugSegments[0],u=(e,t)=>{let n=l(t);return n?e.filter(e=>e.slugSegments[0]===n):e},d=(t,n)=>{let r=l(n);if(!r)return e;let i=t.content?.sections?.[r],a=i?.layout??e.layout;return{layout:a,sidebar:i?.sidebar??(a===`content`?!1:e.sidebar)}},f=e=>e?.trim(),p=e=>{let t=e.split(/[-_]/u).map(e=>f(e)).filter(e=>!!e);return{language:t[0]?.toLowerCase(),region:t.slice(1).find(e=>/^(?:[A-Za-z]{2}|\d{3})$/u.test(e))?.toUpperCase()}},m=({kind:e=`docs`,layout:t,locale:n,section:r})=>{let{language:i,region:a}=p(n);return{kind:e,locale:n,...i?{language:i}:{},...a?{region:a}:{},...r?{section:r}:{},...t?{layout:t}:{}}},h=e=>Object.entries(e).map(([e,t])=>`${e}:${t}`);exports.getEntrySectionConfig=d,exports.getEntrySectionKey=l,exports.getFooterDescription=n,exports.getPagefindFilterEntries=h,exports.getPagefindFilters=m,exports.getSectionEntries=u,exports.getSiteTitle=t,exports.getThemeLabels=a,exports.getThemeSocialLinks=s,exports.getTocHeadings=c,exports.getTocLabels=i;
@@ -0,0 +1,22 @@
1
+
2
+ import { NormalizedDocsConfig } from "../../config/types.mjs";
3
+ import { SocialLinkProps } from "blackwork";
4
+ import { HeadingItem } from "@blackwork/machine";
5
+
6
+ //#region src/theme/components/shell-shared.d.ts
7
+ declare const getThemeLabels: (config: NormalizedDocsConfig, locale: string) => {
8
+ changeLanguage: string;
9
+ documentationPages: string;
10
+ documentPager: string;
11
+ next: string;
12
+ openSectionNavigation: string;
13
+ openSiteNavigation: string;
14
+ previous: string;
15
+ primaryNavigation: string;
16
+ scrollToTop: string;
17
+ sections: string;
18
+ toggleTheme: string;
19
+ };
20
+ type DocsThemeLabels = ReturnType<typeof getThemeLabels>;
21
+ //#endregion
22
+ export { DocsThemeLabels };
@@ -0,0 +1,22 @@
1
+
2
+ import { NormalizedDocsConfig } from "../../config/types.js";
3
+ import { HeadingItem } from "@blackwork/machine";
4
+ import { SocialLinkProps } from "blackwork";
5
+
6
+ //#region src/theme/components/shell-shared.d.ts
7
+ declare const getThemeLabels: (config: NormalizedDocsConfig, locale: string) => {
8
+ changeLanguage: string;
9
+ documentationPages: string;
10
+ documentPager: string;
11
+ next: string;
12
+ openSectionNavigation: string;
13
+ openSiteNavigation: string;
14
+ previous: string;
15
+ primaryNavigation: string;
16
+ scrollToTop: string;
17
+ sections: string;
18
+ toggleTheme: string;
19
+ };
20
+ type DocsThemeLabels = ReturnType<typeof getThemeLabels>;
21
+ //#endregion
22
+ export { DocsThemeLabels };