@blackwork/docs 0.1.0 → 0.2.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 (108) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  2. package/dist/config/defaults.cjs +1 -1
  3. package/dist/config/defaults.mjs +1 -1
  4. package/dist/config/define-config.cjs +1 -1
  5. package/dist/config/define-config.mjs +1 -1
  6. package/dist/config/define-docs-config.cjs +1 -1
  7. package/dist/config/define-docs-config.mjs +1 -1
  8. package/dist/config/load-content-config.cjs +1 -1
  9. package/dist/config/load-content-config.mjs +1 -1
  10. package/dist/export/process-exported-docs.cjs +9 -0
  11. package/dist/export/process-exported-docs.d.mts +16 -0
  12. package/dist/export/process-exported-docs.d.ts +16 -0
  13. package/dist/export/process-exported-docs.mjs +9 -0
  14. package/dist/index.cjs +2 -2
  15. package/dist/index.d.mts +2 -1
  16. package/dist/index.d.ts +2 -1
  17. package/dist/index.mjs +2 -2
  18. package/dist/mdx/default-docs-components.cjs +1 -1
  19. package/dist/mdx/default-docs-components.mjs +1 -1
  20. package/dist/mdx/merge-docs-components.cjs +1 -1
  21. package/dist/mdx/merge-docs-components.mjs +1 -1
  22. package/dist/metadata/create-doc-metadata.cjs +1 -1
  23. package/dist/metadata/create-doc-metadata.mjs +1 -1
  24. package/dist/navigation/build-locale-links.cjs +1 -1
  25. package/dist/navigation/build-locale-links.mjs +1 -1
  26. package/dist/navigation/build-pager.cjs +1 -1
  27. package/dist/navigation/build-pager.mjs +1 -1
  28. package/dist/navigation/build-sidebar.cjs +1 -1
  29. package/dist/navigation/build-sidebar.mjs +1 -1
  30. package/dist/navigation/resolve-sidebar.cjs +1 -1
  31. package/dist/navigation/resolve-sidebar.mjs +1 -1
  32. package/dist/next/context.cjs +1 -1
  33. package/dist/next/context.mjs +1 -1
  34. package/dist/next/document-lang-sync.cjs +9 -0
  35. package/dist/next/document-lang-sync.mjs +9 -0
  36. package/dist/next/load-doc-content.cjs +1 -1
  37. package/dist/next/load-doc-content.mjs +1 -1
  38. package/dist/next/load-generated-manifest.cjs +1 -1
  39. package/dist/next/load-generated-manifest.mjs +1 -1
  40. package/dist/next/metadata.cjs +1 -1
  41. package/dist/next/metadata.mjs +1 -1
  42. package/dist/next/page.cjs +1 -1
  43. package/dist/next/page.mjs +1 -1
  44. package/dist/next/render-route.cjs +1 -1
  45. package/dist/next/render-route.mjs +1 -1
  46. package/dist/next/resolve-document-lang.cjs +1 -1
  47. package/dist/next/resolve-document-lang.mjs +1 -1
  48. package/dist/next/root-layout.cjs +2 -2
  49. package/dist/next/root-layout.mjs +2 -2
  50. package/dist/next-plugin/generate.cjs +1 -1
  51. package/dist/next-plugin/generate.mjs +1 -1
  52. package/dist/next.cjs +1 -1
  53. package/dist/next.mjs +1 -1
  54. package/dist/routing/build-static-params.cjs +1 -1
  55. package/dist/routing/build-static-params.mjs +1 -1
  56. package/dist/routing/resolve-docs-route.cjs +1 -1
  57. package/dist/routing/resolve-docs-route.mjs +1 -1
  58. package/dist/runtime.cjs +1 -1
  59. package/dist/runtime.mjs +1 -1
  60. package/dist/source/build-docs-source.cjs +1 -1
  61. package/dist/source/build-docs-source.mjs +1 -1
  62. package/dist/source/collect-docs-manifest.cjs +1 -1
  63. package/dist/source/collect-docs-manifest.mjs +1 -1
  64. package/dist/source/create-docs-source-from-manifest.cjs +1 -1
  65. package/dist/source/create-docs-source-from-manifest.mjs +1 -1
  66. package/dist/source/create-docs-source.cjs +1 -1
  67. package/dist/source/create-docs-source.mjs +1 -1
  68. package/dist/theme/components/content-shell.cjs +2 -2
  69. package/dist/theme/components/content-shell.mjs +2 -2
  70. package/dist/theme/components/docs-rail-scroll-state.cjs +1 -1
  71. package/dist/theme/components/docs-rail-scroll-state.mjs +1 -1
  72. package/dist/theme/components/docs-rail-scroll.cjs +1 -1
  73. package/dist/theme/components/docs-rail-scroll.mjs +1 -1
  74. package/dist/theme/components/docs-scroll-reset.cjs +1 -1
  75. package/dist/theme/components/docs-scroll-reset.mjs +1 -1
  76. package/dist/theme/components/docs-scroll-to-top.cjs +9 -0
  77. package/dist/theme/components/docs-scroll-to-top.mjs +9 -0
  78. package/dist/theme/components/docs-shell.cjs +2 -2
  79. package/dist/theme/components/docs-shell.mjs +2 -2
  80. package/dist/theme/components/docs-toc-geometry.cjs +1 -1
  81. package/dist/theme/components/docs-toc-geometry.mjs +1 -1
  82. package/dist/theme/components/docs-toc.cjs +2 -2
  83. package/dist/theme/components/docs-toc.mjs +2 -2
  84. package/dist/theme/components/floating-actions.cjs +9 -0
  85. package/dist/theme/components/floating-actions.mjs +9 -0
  86. package/dist/theme/components/footer.cjs +1 -1
  87. package/dist/theme/components/footer.mjs +1 -1
  88. package/dist/theme/components/header.cjs +2 -2
  89. package/dist/theme/components/header.d.mts +1 -0
  90. package/dist/theme/components/header.d.ts +1 -0
  91. package/dist/theme/components/header.mjs +2 -2
  92. package/dist/theme/components/home-shell.cjs +2 -2
  93. package/dist/theme/components/home-shell.mjs +2 -2
  94. package/dist/theme/components/link.cjs +1 -1
  95. package/dist/theme/components/link.mjs +1 -1
  96. package/dist/theme/components/shell-shared.cjs +2 -2
  97. package/dist/theme/components/shell-shared.mjs +2 -2
  98. package/dist/theme/create-home-data.cjs +1 -1
  99. package/dist/theme/create-home-data.mjs +1 -1
  100. package/dist/theme/slots.cjs +2 -2
  101. package/dist/theme/slots.mjs +2 -2
  102. package/dist/theme/types.d.mts +9 -1
  103. package/dist/theme/types.d.ts +9 -1
  104. package/dist/theme.cjs +1 -1
  105. package/dist/theme.d.mts +2 -2
  106. package/dist/theme.d.ts +2 -2
  107. package/dist/theme.mjs +1 -1
  108. package/package.json +4 -4
package/dist/runtime.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.1.0
3
+ * version: v0.2.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
package/dist/runtime.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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(`../slots.cjs`),u=require(`./docs-toc.cjs`),d=require(`./shell-shared.cjs`);let f=require(`react`);f=e.__toESM(f);let p=require(`react/jsx-runtime`);const m=({children:e,config:f,entry:m,headings:h=[],source:g})=>{let _=t.defineConfig(f),v=g.getEntries(m.locale),y=d.getEntrySectionKey(m),b=d.getEntrySectionConfig(_,m),x=Array.isArray(b.sidebar),S=d.getSectionEntries(v,m),C=x?r.resolveSidebar({config:_,entries:v,currentHref:m.href,sectionKey:y}):[],w=d.toNavigation(m,x?r.flattenResolvedSidebarItems(C):a.buildSidebar({entries:v,currentHref:m.href})),T=i.buildPager({entries:S,currentHref:m.href,...x?{sidebar:C}:{}}),E=n.buildLocaleLinks({config:_,entry:m,source:g}),D=d.getTocHeadings(h),O=D.length>=2,k=g.getCanonicalHref(m.locale,[]),A=l.resolveThemeSlots(_.slots),j=A.link??o.DefaultDocsLink,M=A.footer??s.DefaultDocsFooter,N=O?(0,p.jsx)(u.DefaultDocsToc,{headings:D,collapseEnabled:!0,dock:`fixed`,className:`xl:left-8`}):null;return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c.DefaultDocsHeader,{homeHref:k,LinkComponent:j,localeLinks:E,navigation:w,siteDescription:_.site.description,siteTitle:d.getSiteTitle(_)}),N,(0,p.jsxs)(`main`,{"data-docs-region":`content-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-10 px-6 py-8 sm:px-8 xl:flex-row xl:items-start xl:gap-12 xl:px-10 2xl:gap-16 2xl:px-12`,children:[O?(0,p.jsx)(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null,(0,p.jsx)(`div`,{className:`flex min-w-0 flex-1 justify-center`,children:(0,p.jsxs)(`div`,{className:`flex w-full max-w-4xl flex-col gap-10`,children:[(0,p.jsxs)(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[(0,p.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:m.title}),m.description?(0,p.jsx)(`p`,{className:`max-w-3xl text-muted-foreground`,children:m.description}):null]}),(0,p.jsx)(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:e}),(0,p.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:[T.previous?(0,p.jsxs)(j,{href:T.previous.href,className:`text-muted-foreground`,children:[`Previous: `,T.previous.title]}):(0,p.jsx)(`span`,{}),T.next?(0,p.jsxs)(j,{href:T.next.href,className:`text-muted-foreground`,children:[`Next: `,T.next.title]}):null]})]})}),O?(0,p.jsx)(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null]}),(0,p.jsx)(M,{description:d.getFooterDescription(_,m),homeHref:k,LinkComponent:j,navigation:w,siteTitle:d.getSiteTitle(_)})]})};exports.DefaultContentShell=m;
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(`../slots.cjs`),u=require(`./docs-scroll-to-top.cjs`),d=require(`./docs-toc.cjs`),f=require(`./shell-shared.cjs`);let p=require(`react`);p=e.__toESM(p);let m=require(`react/jsx-runtime`);const h=({children:e,config:p,entry:h,headings:g=[],source:_})=>{let v=t.defineConfig(p),y=_.getEntries(h.locale),b=f.getEntrySectionKey(h),x=f.getEntrySectionConfig(v,h),S=Array.isArray(x.sidebar),C=f.getSectionEntries(y,h),w=S?r.resolveSidebar({config:v,entries:y,currentHref:h.href,sectionKey:b}):[],T=f.toNavigation(h,S?r.flattenResolvedSidebarItems(w):a.buildSidebar({entries:y,currentHref:h.href})),E=i.buildPager({entries:C,currentHref:h.href,...S?{sidebar:w}:{}}),D=n.buildLocaleLinks({config:v,entry:h,source:_}),O=f.getTocHeadings(g),k=O.length>=2,A=_.getCanonicalHref(h.locale,[]),j=l.resolveThemeSlots(v.slots),M=j.headerActions,N=j.link??o.DefaultDocsLink,P=j.footer??s.DefaultDocsFooter,F=f.getPagefindFilterEntries(f.getPagefindFilters({layout:x.layout,locale:h.locale,section:b})),I=k?(0,m.jsx)(d.DefaultDocsToc,{headings:O,collapseEnabled:!0,dock:`fixed`,className:`xl:left-8`}):null,L=k?(0,m.jsx)(d.MobileDocsToc,{headings:O,minHeadings:2}):null;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(c.DefaultDocsHeader,{headerActions:M?(0,m.jsx)(M,{homeHref:A,localeLinks:D,navigation:T,siteDescription:v.site.description,siteTitle:f.getSiteTitle(v)}):void 0,homeHref:A,LinkComponent:N,localeLinks:D,navigation:T,siteDescription:v.site.description,siteTitle:f.getSiteTitle(v)}),(0,m.jsx)(u.DocsScrollToTop,{}),L,I,(0,m.jsxs)(`main`,{"data-docs-region":`content-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-10 px-6 py-8 sm:px-8 xl:flex-row xl:items-start xl:gap-12 xl:px-10 2xl:gap-16 2xl:px-12`,children:[k?(0,m.jsx)(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null,(0,m.jsx)(`div`,{className:`flex min-w-0 flex-1 justify-center`,children:(0,m.jsxs)(`div`,{className:`flex w-full max-w-4xl flex-col gap-10`,children:[(0,m.jsxs)(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-10`,children:[(0,m.jsx)(`div`,{hidden:!0,children:F.map(e=>(0,m.jsx)(`span`,{"data-pagefind-filter":e},e))}),(0,m.jsxs)(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[(0,m.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:h.title}),h.description?(0,m.jsx)(`p`,{className:`max-w-3xl text-muted-foreground`,children:h.description}):null]}),(0,m.jsx)(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:e})]}),(0,m.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:[E.previous?(0,m.jsxs)(N,{href:E.previous.href,className:`text-muted-foreground`,children:[`Previous: `,E.previous.title]}):(0,m.jsx)(`span`,{}),E.next?(0,m.jsxs)(N,{href:E.next.href,className:`text-muted-foreground`,children:[`Next: `,E.next.title]}):null]})]})}),k?(0,m.jsx)(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null]}),(0,m.jsx)(P,{description:f.getFooterDescription(v,h),homeHref:A,LinkComponent:N,navigation:T,siteTitle:f.getSiteTitle(v)})]})};exports.DefaultContentShell=h;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.1.0
3
+ * version: v0.2.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{resolveThemeSlots as l}from"../slots.mjs";import{DefaultDocsToc as u}from"./docs-toc.mjs";import{getEntrySectionConfig as d,getEntrySectionKey as f,getFooterDescription as p,getSectionEntries as m,getSiteTitle as h,getTocHeadings as g,toNavigation as _}from"./shell-shared.mjs";import"react";import{Fragment as v,jsx as y,jsxs as b}from"react/jsx-runtime";const x=({children:x,config:S,entry:C,headings:w=[],source:T})=>{let E=e(S),D=T.getEntries(C.locale),O=f(C),k=d(E,C),A=Array.isArray(k.sidebar),j=m(D,C),M=A?r({config:E,entries:D,currentHref:C.href,sectionKey:O}):[],N=_(C,A?n(M):a({entries:D,currentHref:C.href})),P=i({entries:j,currentHref:C.href,...A?{sidebar:M}:{}}),F=t({config:E,entry:C,source:T}),I=g(w),L=I.length>=2,R=T.getCanonicalHref(C.locale,[]),z=l(E.slots),B=z.link??o,V=z.footer??s,H=L?y(u,{headings:I,collapseEnabled:!0,dock:`fixed`,className:`xl:left-8`}):null;return b(v,{children:[y(c,{homeHref:R,LinkComponent:B,localeLinks:F,navigation:N,siteDescription:E.site.description,siteTitle:h(E)}),H,b(`main`,{"data-docs-region":`content-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-10 px-6 py-8 sm:px-8 xl:flex-row xl:items-start xl:gap-12 xl:px-10 2xl:gap-16 2xl:px-12`,children:[L?y(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null,y(`div`,{className:`flex min-w-0 flex-1 justify-center`,children:b(`div`,{className:`flex w-full max-w-4xl flex-col gap-10`,children:[b(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[y(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:C.title}),C.description?y(`p`,{className:`max-w-3xl text-muted-foreground`,children:C.description}):null]}),y(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:x}),b(`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:[P.previous?b(B,{href:P.previous.href,className:`text-muted-foreground`,children:[`Previous: `,P.previous.title]}):y(`span`,{}),P.next?b(B,{href:P.next.href,className:`text-muted-foreground`,children:[`Next: `,P.next.title]}):null]})]})}),L?y(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null]}),y(V,{description:p(E,C),homeHref:R,LinkComponent:B,navigation:N,siteTitle:h(E)})]})};export{x as DefaultContentShell};
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{resolveThemeSlots as l}from"../slots.mjs";import{DocsScrollToTop as u}from"./docs-scroll-to-top.mjs";import{DefaultDocsToc as d,MobileDocsToc as f}from"./docs-toc.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,toNavigation as x}from"./shell-shared.mjs";import"react";import{Fragment as S,jsx as C,jsxs as w}from"react/jsx-runtime";const T=({children:T,config:E,entry:D,headings:O=[],source:k})=>{let A=e(E),j=k.getEntries(D.locale),M=m(D),N=p(A,D),P=Array.isArray(N.sidebar),F=v(j,D),I=P?r({config:A,entries:j,currentHref:D.href,sectionKey:M}):[],L=x(D,P?n(I):a({entries:j,currentHref:D.href})),R=i({entries:F,currentHref:D.href,...P?{sidebar:I}:{}}),z=t({config:A,entry:D,source:k}),B=b(O),V=B.length>=2,H=k.getCanonicalHref(D.locale,[]),U=l(A.slots),W=U.headerActions,G=U.link??o,K=U.footer??s,q=g(_({layout:N.layout,locale:D.locale,section:M})),J=V?C(d,{headings:B,collapseEnabled:!0,dock:`fixed`,className:`xl:left-8`}):null,Y=V?C(f,{headings:B,minHeadings:2}):null;return w(S,{children:[C(c,{headerActions:W?C(W,{homeHref:H,localeLinks:z,navigation:L,siteDescription:A.site.description,siteTitle:y(A)}):void 0,homeHref:H,LinkComponent:G,localeLinks:z,navigation:L,siteDescription:A.site.description,siteTitle:y(A)}),C(u,{}),Y,J,w(`main`,{"data-docs-region":`content-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-10 px-6 py-8 sm:px-8 xl:flex-row xl:items-start xl:gap-12 xl:px-10 2xl:gap-16 2xl:px-12`,children:[V?C(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null,C(`div`,{className:`flex min-w-0 flex-1 justify-center`,children:w(`div`,{className:`flex w-full max-w-4xl flex-col gap-10`,children:[w(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-10`,children:[C(`div`,{hidden:!0,children:q.map(e=>C(`span`,{"data-pagefind-filter":e},e))}),w(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[C(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:D.title}),D.description?C(`p`,{className:`max-w-3xl text-muted-foreground`,children:D.description}):null]}),C(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:T})]}),w(`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:[R.previous?w(G,{href:R.previous.href,className:`text-muted-foreground`,children:[`Previous: `,R.previous.title]}):C(`span`,{}),R.next?w(G,{href:R.next.href,className:`text-muted-foreground`,children:[`Next: `,R.next.title]}):null]})]})}),V?C(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null]}),C(K,{description:h(A,D),homeHref:H,LinkComponent:G,navigation:L,siteTitle:y(A)})]})};export{T as DefaultContentShell};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -0,0 +1,9 @@
1
+ /**
2
+ * name: @blackwork/docs
3
+ * version: v0.2.0
4
+ * description: Next-first documentation framework for Blackwork projects.
5
+ * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
+ * homepage: https://chengpeiquan.com
7
+ * license: MIT
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;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * name: @blackwork/docs
3
+ * version: v0.2.0
4
+ * description: Next-first documentation framework for Blackwork projects.
5
+ * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
+ * homepage: https://chengpeiquan.com
7
+ * license: MIT
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};
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.1.0
3
+ * version: v0.2.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(`../slots.cjs`),u=require(`./docs-toc.cjs`),d=require(`./shell-shared.cjs`),f=require(`./docs-rail-scroll.cjs`);let p=require(`react`);p=e.__toESM(p);let m=require(`react/jsx-runtime`);const h=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(` `),g=e=>e.isExternal||e.slugSegments.length>0,_=e=>e.flatMap(e=>{if(e.type===`group`){let t=e.items.filter(g);return t.length===0?[]:[{...e,items:t}]}return g(e)?[e]:[]}),v=({children:e,config:p,entry:g,headings:v=[],source:y})=>{let b=t.defineConfig(p),x=y.getEntries(g.locale),S=d.getEntrySectionKey(g),C=d.getEntrySectionConfig(b,g),w=Array.isArray(C.sidebar),T=d.getSectionEntries(x,g),E=r.resolveSidebar({config:b,entries:x,currentHref:g.href,sectionKey:S}),D=_(E),O=i.buildPager({entries:T,currentHref:g.href,...w?{sidebar:E}:{}}),k=d.toNavigation(g,w?r.flattenResolvedSidebarItems(E):a.buildSidebar({entries:x,currentHref:g.href})),A=n.buildLocaleLinks({config:b,entry:g,source:y}),j=y.getCanonicalHref(g.locale,[]),M=l.resolveThemeSlots(b.slots),N=M.link??o.DefaultDocsLink,P=M.footer??s.DefaultDocsFooter;return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(c.DefaultDocsHeader,{homeHref:j,LinkComponent:N,localeLinks:A,navigation:k,siteDescription:b.site.description,siteTitle:d.getSiteTitle(b)}),(0,m.jsxs)(`main`,{"data-docs-region":`docs-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-10 px-6 py-8 sm:px-8 lg:flex-row lg:gap-14 xl:gap-20 xl:px-10 2xl:gap-24 2xl:px-12`,children:[(0,m.jsx)(`aside`,{"data-docs-region":`sidebar`,className:`w-full shrink-0 lg:w-72 lg:self-start lg:sticky lg:top-24`,children:(0,m.jsx)(f.DocsRailScroll,{children:(0,m.jsx)(`nav`,{"aria-label":`Documentation pages`,className:`flex flex-col gap-1`,children:D.map(e=>e.type===`group`?(0,m.jsxs)(`div`,{className:`flex flex-col gap-1 pt-4 first:pt-0`,children:[(0,m.jsx)(`p`,{className:`px-3 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground/80`,children:e.title}),e.items.map(e=>(0,m.jsx)(N,{href:e.href,"aria-current":e.isActive?`page`:void 0,"data-current-page":e.isActive?`true`:void 0,className:h(e.isActive),style:{paddingLeft:`${.75+e.depth*.75}rem`},children:e.title},e.href))]},e.title):(0,m.jsx)(N,{href:e.href,"aria-current":e.isActive?`page`:void 0,"data-current-page":e.isActive?`true`:void 0,className:h(e.isActive),style:{paddingLeft:`${.75+e.depth*.75}rem`},children:e.title},e.href))})})}),(0,m.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-10`,children:[(0,m.jsxs)(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[(0,m.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:g.title}),g.description?(0,m.jsx)(`p`,{className:`max-w-3xl text-muted-foreground`,children:g.description}):null]}),(0,m.jsx)(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:e}),(0,m.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:[O.previous?(0,m.jsxs)(N,{href:O.previous.href,className:`text-muted-foreground`,children:[`Previous: `,O.previous.title]}):(0,m.jsx)(`span`,{}),O.next?(0,m.jsxs)(N,{href:O.next.href,className:`text-muted-foreground`,children:[`Next: `,O.next.title]}):null]})]}),(0,m.jsx)(u.DefaultDocsToc,{headings:d.getTocHeadings(v)})]}),(0,m.jsx)(P,{description:d.getFooterDescription(b,g),homeHref:j,LinkComponent:N,navigation:k,siteTitle:d.getSiteTitle(b)})]})};exports.DefaultDocsShell=v;
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(`../slots.cjs`),u=require(`./docs-scroll-to-top.cjs`),d=require(`./docs-toc.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=v.getCanonicalHref(h.locale,[]),F=l.resolveThemeSlots(y.slots),I=F.headerActions,L=F.link??o.DefaultDocsLink,R=F.footer??s.DefaultDocsFooter,z=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:I?(0,g.jsx)(I,{homeHref:P,localeLinks:M,navigation:j,siteDescription:y.site.description,siteTitle:f.getSiteTitle(y)}):void 0,homeHref:P,LinkComponent:L,localeLinks:M,navigation:j,siteDescription:y.site.description,siteTitle:f.getSiteTitle(y)}),(0,g.jsx)(u.DocsScrollToTop,{}),(0,g.jsx)(d.MobileDocsToc,{headings:N}),(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:L,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:L,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:z.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)(L,{href:A.previous.href,className:`text-muted-foreground`,children:[`Previous: `,A.previous.title]}):(0,g.jsx)(`span`,{}),A.next?(0,g.jsxs)(L,{href:A.next.href,className:`text-muted-foreground`,children:[`Next: `,A.next.title]}):null]})]}),(0,g.jsx)(d.DefaultDocsToc,{headings:N})]}),(0,g.jsx)(R,{description:f.getFooterDescription(y,h),homeHref:P,LinkComponent:L,navigation:j,siteTitle:f.getSiteTitle(y)})]})};exports.DefaultDocsShell=C;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.1.0
3
+ * version: v0.2.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{resolveThemeSlots as l}from"../slots.mjs";import{DefaultDocsToc as u}from"./docs-toc.mjs";import{getEntrySectionConfig as d,getEntrySectionKey as f,getFooterDescription as p,getSectionEntries as m,getSiteTitle as h,getTocHeadings as g,toNavigation as _}from"./shell-shared.mjs";import{DocsRailScroll as v}from"./docs-rail-scroll.mjs";import"react";import{Fragment as y,jsx as b,jsxs as x}from"react/jsx-runtime";const S=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(` `),C=e=>e.isExternal||e.slugSegments.length>0,w=e=>e.flatMap(e=>{if(e.type===`group`){let t=e.items.filter(C);return t.length===0?[]:[{...e,items:t}]}return C(e)?[e]:[]}),T=({children:C,config:T,entry:E,headings:D=[],source:O})=>{let k=e(T),A=O.getEntries(E.locale),j=f(E),M=d(k,E),N=Array.isArray(M.sidebar),P=m(A,E),F=r({config:k,entries:A,currentHref:E.href,sectionKey:j}),I=w(F),L=i({entries:P,currentHref:E.href,...N?{sidebar:F}:{}}),R=_(E,N?n(F):a({entries:A,currentHref:E.href})),z=t({config:k,entry:E,source:O}),B=O.getCanonicalHref(E.locale,[]),V=l(k.slots),H=V.link??o,U=V.footer??s;return x(y,{children:[b(c,{homeHref:B,LinkComponent:H,localeLinks:z,navigation:R,siteDescription:k.site.description,siteTitle:h(k)}),x(`main`,{"data-docs-region":`docs-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-10 px-6 py-8 sm:px-8 lg:flex-row lg:gap-14 xl:gap-20 xl:px-10 2xl:gap-24 2xl:px-12`,children:[b(`aside`,{"data-docs-region":`sidebar`,className:`w-full shrink-0 lg:w-72 lg:self-start lg:sticky lg:top-24`,children:b(v,{children:b(`nav`,{"aria-label":`Documentation pages`,className:`flex flex-col gap-1`,children:I.map(e=>e.type===`group`?x(`div`,{className:`flex flex-col gap-1 pt-4 first:pt-0`,children:[b(`p`,{className:`px-3 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground/80`,children:e.title}),e.items.map(e=>b(H,{href:e.href,"aria-current":e.isActive?`page`:void 0,"data-current-page":e.isActive?`true`:void 0,className:S(e.isActive),style:{paddingLeft:`${.75+e.depth*.75}rem`},children:e.title},e.href))]},e.title):b(H,{href:e.href,"aria-current":e.isActive?`page`:void 0,"data-current-page":e.isActive?`true`:void 0,className:S(e.isActive),style:{paddingLeft:`${.75+e.depth*.75}rem`},children:e.title},e.href))})})}),x(`div`,{className:`flex min-w-0 flex-1 flex-col gap-10`,children:[x(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[b(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:E.title}),E.description?b(`p`,{className:`max-w-3xl text-muted-foreground`,children:E.description}):null]}),b(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:C}),x(`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:[L.previous?x(H,{href:L.previous.href,className:`text-muted-foreground`,children:[`Previous: `,L.previous.title]}):b(`span`,{}),L.next?x(H,{href:L.next.href,className:`text-muted-foreground`,children:[`Next: `,L.next.title]}):null]})]}),b(u,{headings:g(D)})]}),b(U,{description:p(k,E),homeHref:B,LinkComponent:H,navigation:R,siteTitle:h(k)})]})};export{T as DefaultDocsShell};
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{resolveThemeSlots as l}from"../slots.mjs";import{DocsScrollToTop as u}from"./docs-scroll-to-top.mjs";import{DefaultDocsToc as d,MobileDocsToc as f}from"./docs-toc.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,toNavigation as x}from"./shell-shared.mjs";import{DocsRailScroll as S}from"./docs-rail-scroll.mjs";import{Button as C,Sheet as w,SheetContent as T,SheetHeader as E,SheetTitle as D,SheetTrigger as O}from"blackwork";import"react";import{Fragment as k,jsx as A,jsxs as j}from"react/jsx-runtime";import{Menu as M}from"blackwork/icons";const N=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(` `),P=e=>e.isExternal||e.slugSegments.length>0,F=e=>e.flatMap(e=>{if(e.type===`group`){let t=e.items.filter(P);return t.length===0?[]:[{...e,items:t}]}return P(e)?[e]:[]}),I=({LinkComponent:e,nodes:t})=>A(`nav`,{"aria-label":`Documentation pages`,className:`flex flex-col gap-1`,children:t.map(t=>t.type===`group`?j(`div`,{className:`flex flex-col gap-1 pt-4 first:pt-0`,children:[A(`p`,{className:`px-3 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground/80`,children:t.title}),t.items.map(t=>A(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:N(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))]},t.title):A(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:N(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))}),L=({currentTitle:e,LinkComponent:t,nodes:n})=>n.length===0?null:A(`div`,{className:`lg:hidden`,children:j(w,{children:[A(O,{asChild:!0,children:j(C,{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:[A(M,{className:`size-4 shrink-0`,"aria-hidden":`true`}),j(`span`,{className:`flex min-w-0 flex-1 flex-col items-start text-left`,children:[A(`span`,{className:`text-xs text-muted-foreground`,children:`Sections`}),A(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e})]})]})}),j(T,{side:`left`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[A(E,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:A(D,{children:`Sections`})}),A(`div`,{className:`min-h-0 flex-1 overflow-auto px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:A(I,{LinkComponent:t,nodes:n})})]})]})}),R=({children:C,config:w,entry:T,headings:E=[],source:D})=>{let O=e(w),M=D.getEntries(T.locale),N=m(T),P=p(O,T),R=Array.isArray(P.sidebar),z=v(M,T),B=r({config:O,entries:M,currentHref:T.href,sectionKey:N}),V=F(B),H=i({entries:z,currentHref:T.href,...R?{sidebar:B}:{}}),U=x(T,R?n(B):a({entries:M,currentHref:T.href})),W=t({config:O,entry:T,source:D}),G=b(E),K=D.getCanonicalHref(T.locale,[]),q=l(O.slots),J=q.headerActions,Y=q.link??o,X=q.footer??s,Z=g(_({layout:P.layout,locale:T.locale,section:N}));return j(k,{children:[A(c,{headerActions:J?A(J,{homeHref:K,localeLinks:W,navigation:U,siteDescription:O.site.description,siteTitle:y(O)}):void 0,homeHref:K,LinkComponent:Y,localeLinks:W,navigation:U,siteDescription:O.site.description,siteTitle:y(O)}),A(u,{}),A(f,{headings:G}),j(`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:[A(L,{currentTitle:T.title,LinkComponent:Y,nodes:V}),A(`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:A(S,{children:A(I,{LinkComponent:Y,nodes:V})})}),j(`div`,{className:`flex min-w-0 flex-1 flex-col gap-10`,children:[j(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-10`,children:[A(`div`,{hidden:!0,children:Z.map(e=>A(`span`,{"data-pagefind-filter":e},e))}),j(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[A(`h1`,{className:`text-balance text-3xl font-semibold tracking-tight text-foreground`,children:T.title}),T.description?A(`p`,{className:`max-w-3xl text-pretty text-muted-foreground`,children:T.description}):null]}),A(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:C})]}),j(`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:[H.previous?j(Y,{href:H.previous.href,className:`text-muted-foreground`,children:[`Previous: `,H.previous.title]}):A(`span`,{}),H.next?j(Y,{href:H.next.href,className:`text-muted-foreground`,children:[`Next: `,H.next.title]}):null]})]}),A(d,{headings:G})]}),A(X,{description:h(O,T),homeHref:K,LinkComponent:Y,navigation:U,siteTitle:y(O)})]})};export{R as DefaultDocsShell};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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`);let n=require(`blackwork`),r=require(`react`);r=e.__toESM(r);let i=require(`react/jsx-runtime`),a=require(`blackwork/icons`);const o=()=>[`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}},l=(e,t)=>({offsetDistance:`${t?.offsetDistance??0}px`,offsetPath:`path("${e?.path||`M0 0 L0 0`}")`,opacity:+!!t}),u=e=>e.filter(e=>e.active).sort((e,t)=>e.t-t.t).map(e=>e.id),d=(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},f=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},p=(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-f(r.paddingBottom),depth:e.depth,id:e.id,top:t.offsetTop+f(r.paddingTop)}]})},m=(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])}},h=(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},g=(e,t)=>!e||!t?e===t:e.bottom===t.bottom&&e.offsetDistance===t.offsetDistance&&e.top===t.top,_=(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 v(e){let[t,n]=(0,r.useState)([]);return(0,r.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=u([...t.values()]);if(r.length===0){let n=d([...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 y(e,n){let i=(0,r.useRef)(null),[a,o]=(0,r.useState)(null),[s,c]=(0,r.useState)(null),l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{let e=i.current;if(!e)return;let r=0,a=()=>{cancelAnimationFrame(r),r=requestAnimationFrame(()=>{let r=t.buildTocTrackGeometry(p(e,n)),i={...r,itemLineLengths:m(r.positions,r.path)};o(e=>h(e,i)?e:i)})},s=typeof ResizeObserver>`u`?null:new ResizeObserver(a);return s?.observe(e),window.addEventListener(`resize`,a),a(),()=>{cancelAnimationFrame(r),s?.disconnect(),window.removeEventListener(`resize`,a)}},[n]),(0,r.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]=_(e,a,l.current);l.current=n,c(e=>g(e,t)?e:t)}),()=>{cancelAnimationFrame(t)}},[e,a]),[i,a,s]}const b=({className:e,collapseEnabled:u=!1,defaultCollapsed:d=!1,dock:f=`sticky`,headings:p,minHeadings:m=1})=>{let h=v(p),[g,_,b]=y(h,p),x=(0,r.useMemo)(()=>new Set(h),[h]),S=(0,r.useId)(),[C,w]=(0,r.useState)(d),[T,E]=(0,r.useState)(0);return p.length<m?null:(0,i.jsx)(`aside`,{"data-docs-region":`toc`,"data-docs-toc-collapsible":u?`true`:void 0,"data-docs-toc-collapsed":u?String(C):void 0,className:(0,n.cn)(`hidden w-64 xl:block`,f===`sticky`?`shrink-0 xl:self-start xl:sticky xl:top-24`:`xl:fixed xl:top-24`,e),children:(0,i.jsxs)(`nav`,{"aria-label":`On This Page`,className:`flex flex-col gap-3 text-sm`,children:[C?null:(0,i.jsxs)(`div`,{className:(0,n.cn)(`flex items-center gap-2`,u?`justify-between`:void 0),children:[(0,i.jsx)(`p`,{className:`font-medium text-foreground`,children:`On This Page`}),u?(0,i.jsxs)(n.Button,{type:`button`,variant:`ghost`,size:`icon`,"data-docs-toc-toggle":`true`,"aria-controls":S,"aria-expanded":`true`,title:`Collapse outline`,"aria-label":`Collapse outline`,className:`size-8 shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>{w(e=>!e)},children:[(0,i.jsx)(a.ChevronsLeft,{className:`size-4`,"aria-hidden":`true`}),(0,i.jsx)(`span`,{className:`sr-only`,children:`Collapse outline`})]}):null]}),C?(0,i.jsxs)(n.Button,{type:`button`,"data-docs-toc-panel":`collapsed`,variant:`ghost`,size:`icon`,"aria-label":`Expand outline`,"aria-expanded":`false`,title:`Expand outline`,className:`self-start shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>{w(!1)},children:[(0,i.jsx)(a.Toc,{className:`size-4`,"aria-hidden":`true`}),(0,i.jsx)(`span`,{className:`sr-only`,children:`Expand outline`})]}):(0,i.jsxs)(`div`,{className:`relative`,children:[(0,i.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:s(_,T),children:[(0,i.jsx)(`svg`,{"data-docs-toc-track-path":`true`,height:_?.height??1,viewBox:`0 0 ${_?.width??1} ${_?.height??1}`,width:_?.width??1,className:`absolute left-0 top-0 transition-[clip-path,opacity] duration-150 ease-out`,style:c(b),children:(0,i.jsx)(`path`,{d:_?.path||`M0 0 L0 0`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-primary`})}),(0,i.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:l(_,b)})]}),(0,i.jsx)(`ol`,{id:S,ref:g,className:`flex max-h-[calc(100dvh-8rem)] flex-col overflow-auto py-1 [scrollbar-width:none]`,onScroll:e=>{E(e.currentTarget.scrollTop)},children:p.map((e,n)=>{let r=x.has(e.id),a=t.getTocGuideOffset(e.depth),s=n>0?t.getTocGuideOffset(p[n-1].depth):a,c=n+1<p.length?t.getTocGuideOffset(p[n+1].depth):a;return(0,i.jsx)(`li`,{children:(0,i.jsxs)(`a`,{href:`#${e.id}`,"data-active":r?`true`:`false`,"data-depth":e.depth,"data-heading-id":e.id,className:o(),style:{paddingInlineStart:`${t.getTocItemPadding(e.depth)}px`},children:[a===s?null:(0,i.jsx)(`svg`,{"aria-hidden":`true`,"data-docs-toc-item-curve":`true`,viewBox:`${Math.min(a,s)} 0 ${Math.abs(s-a)} 12`,className:`pointer-events-none absolute`,style:{height:`12px`,insetInlineStart:`${Math.min(a,s)}px`,top:`-6px`,width:`${Math.abs(s-a)+1}px`,zIndex:-1},children:(0,i.jsx)(`path`,{d:`M ${s} 0 C ${s} 8 ${a} 4 ${a} 12`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-border`})}),(0,i.jsx)(`span`,{"aria-hidden":`true`,"data-docs-toc-item-line":`true`,className:`pointer-events-none absolute w-px bg-border`,style:{bottom:a===c?`0px`:`6px`,insetInlineStart:`${a}px`,top:a===s?`0px`:`6px`,zIndex:-1}}),e.title]})},e.id)})})]})]})})};exports.DefaultDocsToc=b;
9
+ "use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./floating-actions.cjs`),n=require(`./docs-toc-geometry.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=(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)}]})},g=(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])}},_=(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},v=(e,t)=>!e||!t?e===t:e.bottom===t.bottom&&e.offsetDistance===t.offsetDistance&&e.top===t.top,y=e=>{let t=S(e),[n,r,a]=C(t,e),o=(0,i.useMemo)(()=>new Set(t),[t]),s=(0,i.useId)(),[c,l]=(0,i.useState)(0);return{activeIdSet:o,listId:s,listRef:n,measurement:r,scrollTop:c,setScrollTop:l,track:a}},b=({activeIdSet:e,headings:t,listClassName:i,listId:o,listRef:s,measurement:f,onSelect:p,scrollTop:m,setScrollTop:h,track:g,wrapperClassName:_})=>(0,a.jsxs)(`div`,{className:(0,r.cn)(`relative`,_),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(f,m),children:[(0,a.jsx)(`svg`,{"data-docs-toc-track-path":`true`,height:f?.height??1,viewBox:`0 0 ${f?.width??1} ${f?.height??1}`,width:f?.width??1,className:`absolute left-0 top-0 transition-[clip-path,opacity] duration-150 ease-out`,style:u(g),children:(0,a.jsx)(`path`,{d:f?.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(f,g)})]}),(0,a.jsx)(`ol`,{id:o,ref:s,className:(0,r.cn)(`flex flex-col overflow-auto py-1 [scrollbar-width:none]`,i),onScroll:e=>{h(e.currentTarget.scrollTop)},children:t.map((r,i)=>{let o=e.has(r.id),s=n.getTocGuideOffset(r.depth),l=i>0?n.getTocGuideOffset(t[i-1].depth):s,u=i+1<t.length?n.getTocGuideOffset(t[i+1].depth):s;return(0,a.jsx)(`li`,{children:(0,a.jsxs)(`a`,{href:`#${r.id}`,"data-active":o?`true`:`false`,"data-depth":r.depth,"data-heading-id":r.id,className:c(),style:{paddingInlineStart:`${n.getTocItemPadding(r.depth)}px`},onClick:p,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}}),r.title]})},r.id)})})]}),x=(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 S(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 C(e,t){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=n.buildTocTrackGeometry(h(e,t)),i={...r,itemLineLengths:g(r.positions,r.path)};o(e=>_(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)}},[t]),(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]=x(e,a,l.current);l.current=n,c(e=>v(e,t)?e:t)}),()=>{cancelAnimationFrame(t)}},[e,a]),[r,a,s]}const w=({className:e,collapseEnabled:t=!1,defaultCollapsed:n=!1,dock:c=`sticky`,headings:l,minHeadings:u=1})=>{let d=y(l),[f,p]=(0,i.useState)(n);return l.length<u?null:(0,a.jsx)(`aside`,{"data-docs-region":`toc`,"data-docs-toc-collapsible":t?`true`:void 0,"data-docs-toc-collapsed":t?String(f):void 0,className:(0,r.cn)(`hidden w-64 xl:block`,c===`sticky`?`shrink-0 xl:self-start xl:sticky xl:top-24`:`xl:fixed xl:top-24`,e),children:(0,a.jsxs)(`nav`,{"aria-label":`On This Page`,className:`flex flex-col gap-3 text-sm`,children:[f?null:(0,a.jsxs)(`div`,{className:(0,r.cn)(`flex items-center gap-2`,t?`justify-between`:void 0),children:[(0,a.jsx)(`p`,{className:`font-medium text-foreground`,children:s}),t?(0,a.jsxs)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,"data-docs-toc-toggle":`true`,"aria-controls":d.listId,"aria-expanded":`true`,title:`Collapse outline`,"aria-label":`Collapse outline`,className:`size-8 shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>{p(e=>!e)},children:[(0,a.jsx)(o.ChevronsLeft,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`sr-only`,children:`Collapse outline`})]}):null]}),f?(0,a.jsxs)(r.Button,{type:`button`,"data-docs-toc-panel":`collapsed`,variant:`ghost`,size:`icon`,"aria-label":`Expand outline`,"aria-expanded":`false`,title:`Expand outline`,className:`self-start shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>{p(!1)},children:[(0,a.jsx)(o.Toc,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`sr-only`,children:`Expand outline`})]}):(0,a.jsx)(b,{...d,headings:l,listClassName:`max-h-[calc(100dvh-8rem)]`})]})})},T=({className:e,headings:n,minHeadings:c=1})=>{let l=y(n),[u,d]=(0,i.useState)(!1);return n.length<c?null:(0,a.jsx)(`div`,{className:(0,r.cn)(`xl:hidden`,e),children:(0,a.jsxs)(r.Sheet,{open:u,onOpenChange:d,children:[(0,a.jsx)(r.SheetTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{type:`button`,variant:`outline`,size:`icon`,title:`Open outline`,"aria-label":`Open outline`,"data-docs-toc-mobile-trigger":`true`,className:`fixed border border-input bg-background shadow-sm`,style:t.getDocsFloatingActionStyle(1),children:[(0,a.jsx)(o.Toc,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`sr-only`,children:`Open outline`})]})}),(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:s})}),(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)(b,{...l,headings:n,listClassName:`min-h-0 flex-1`,wrapperClassName:`min-h-0 flex-1`,onSelect:()=>{d(!1)}})})]})]})})};exports.DefaultDocsToc=w,exports.MobileDocsToc=T;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.1.0
3
+ * version: v0.2.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{Button as r,cn as i}from"blackwork";import{useEffect as a,useId as o,useMemo as s,useRef as c,useState as l}from"react";import{jsx as u,jsxs as d}from"react/jsx-runtime";import{ChevronsLeft as f,Toc as p}from"blackwork/icons";const m=()=>[`relative block py-1.5 pr-3 text-sm text-muted-foreground transition-colors`,`hover:text-foreground data-[active=true]:text-primary`].join(` `),h=(e,t)=>({height:`${e?.height??1}px`,transform:`translateY(${-t}px)`,width:`${e?.width??1}px`}),g=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}},_=(e,t)=>({offsetDistance:`${t?.offsetDistance??0}px`,offsetPath:`path("${e?.path||`M0 0 L0 0`}")`,opacity:+!!t}),v=e=>e.filter(e=>e.active).sort((e,t)=>e.t-t.t).map(e=>e.id),y=(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},b=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},x=(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-b(r.paddingBottom),depth:e.depth,id:e.id,top:t.offsetTop+b(r.paddingTop)}]})},S=(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])}},C=(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},w=(e,t)=>!e||!t?e===t:e.bottom===t.bottom&&e.offsetDistance===t.offsetDistance&&e.top===t.top,T=(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 E(e){let[t,n]=l([]);return a(()=>{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=v([...t.values()]);if(r.length===0){let n=y([...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 D(t,n){let r=c(null),[i,o]=l(null),[s,u]=l(null),d=c(null);return a(()=>{let t=r.current;if(!t)return;let i=0,a=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(()=>{let r=e(x(t,n)),i={...r,itemLineLengths:S(r.positions,r.path)};o(e=>C(e,i)?e:i)})},s=typeof ResizeObserver>`u`?null:new ResizeObserver(a);return s?.observe(t),window.addEventListener(`resize`,a),a(),()=>{cancelAnimationFrame(i),s?.disconnect(),window.removeEventListener(`resize`,a)}},[n]),a(()=>{let e=0;return e=requestAnimationFrame(()=>{if(!i||t.length===0){d.current=null,u(e=>e===null?e:null);return}let[e,n]=T(t,i,d.current);d.current=n,u(t=>w(t,e)?t:e)}),()=>{cancelAnimationFrame(e)}},[t,i]),[r,i,s]}const O=({className:e,collapseEnabled:a=!1,defaultCollapsed:c=!1,dock:v=`sticky`,headings:y,minHeadings:b=1})=>{let x=E(y),[S,C,w]=D(x,y),T=s(()=>new Set(x),[x]),O=o(),[k,A]=l(c),[j,M]=l(0);return y.length<b?null:u(`aside`,{"data-docs-region":`toc`,"data-docs-toc-collapsible":a?`true`:void 0,"data-docs-toc-collapsed":a?String(k):void 0,className:i(`hidden w-64 xl:block`,v===`sticky`?`shrink-0 xl:self-start xl:sticky xl:top-24`:`xl:fixed xl:top-24`,e),children:d(`nav`,{"aria-label":`On This Page`,className:`flex flex-col gap-3 text-sm`,children:[k?null:d(`div`,{className:i(`flex items-center gap-2`,a?`justify-between`:void 0),children:[u(`p`,{className:`font-medium text-foreground`,children:`On This Page`}),a?d(r,{type:`button`,variant:`ghost`,size:`icon`,"data-docs-toc-toggle":`true`,"aria-controls":O,"aria-expanded":`true`,title:`Collapse outline`,"aria-label":`Collapse outline`,className:`size-8 shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>{A(e=>!e)},children:[u(f,{className:`size-4`,"aria-hidden":`true`}),u(`span`,{className:`sr-only`,children:`Collapse outline`})]}):null]}),k?d(r,{type:`button`,"data-docs-toc-panel":`collapsed`,variant:`ghost`,size:`icon`,"aria-label":`Expand outline`,"aria-expanded":`false`,title:`Expand outline`,className:`self-start shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>{A(!1)},children:[u(p,{className:`size-4`,"aria-hidden":`true`}),u(`span`,{className:`sr-only`,children:`Expand outline`})]}):d(`div`,{className:`relative`,children:[d(`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:h(C,j),children:[u(`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:g(w),children:u(`path`,{d:C?.path||`M0 0 L0 0`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-primary`})}),u(`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,w)})]}),u(`ol`,{id:O,ref:S,className:`flex max-h-[calc(100dvh-8rem)] flex-col overflow-auto py-1 [scrollbar-width:none]`,onScroll:e=>{M(e.currentTarget.scrollTop)},children:y.map((e,r)=>{let i=T.has(e.id),a=t(e.depth),o=r>0?t(y[r-1].depth):a,s=r+1<y.length?t(y[r+1].depth):a;return u(`li`,{children:d(`a`,{href:`#${e.id}`,"data-active":i?`true`:`false`,"data-depth":e.depth,"data-heading-id":e.id,className:m(),style:{paddingInlineStart:`${n(e.depth)}px`},children:[a===o?null:u(`svg`,{"aria-hidden":`true`,"data-docs-toc-item-curve":`true`,viewBox:`${Math.min(a,o)} 0 ${Math.abs(o-a)} 12`,className:`pointer-events-none absolute`,style:{height:`12px`,insetInlineStart:`${Math.min(a,o)}px`,top:`-6px`,width:`${Math.abs(o-a)+1}px`,zIndex:-1},children:u(`path`,{d:`M ${o} 0 C ${o} 8 ${a} 4 ${a} 12`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-border`})}),u(`span`,{"aria-hidden":`true`,"data-docs-toc-item-line":`true`,className:`pointer-events-none absolute w-px bg-border`,style:{bottom:a===s?`0px`:`6px`,insetInlineStart:`${a}px`,top:a===o?`0px`:`6px`,zIndex:-1}}),e.title]})},e.id)})})]})]})})};export{O as DefaultDocsToc};
9
+ "use client";import{getDocsFloatingActionStyle as e}from"./floating-actions.mjs";import{buildTocTrackGeometry as t,getTocGuideOffset as n,getTocItemPadding as r}from"./docs-toc-geometry.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{ChevronsLeft as v,Toc as y}from"blackwork/icons";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=(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)}]})},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{activeIdSet:a,listId:o,listRef:n,measurement:r,scrollTop:s,setScrollTop:c,track:i}},N=({activeIdSet:e,headings:t,listClassName:i,listId:a,listRef:o,measurement:s,onSelect:c,scrollTop:l,setScrollTop:d,track:f,wrapperClassName:p})=>_(`div`,{className:u(`relative`,p),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:S(s,l),children:[g(`svg`,{"data-docs-toc-track-path":`true`,height:s?.height??1,viewBox:`0 0 ${s?.width??1} ${s?.height??1}`,width:s?.width??1,className:`absolute left-0 top-0 transition-[clip-path,opacity] duration-150 ease-out`,style:C(f),children:g(`path`,{d:s?.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:w(s,f)})]}),g(`ol`,{id:a,ref:o,className:u(`flex flex-col overflow-auto py-1 [scrollbar-width:none]`,i),onScroll:e=>{d(e.currentTarget.scrollTop)},children:t.map((i,a)=>{let o=e.has(i.id),s=n(i.depth),l=a>0?n(t[a-1].depth):s,u=a+1<t.length?n(t[a+1].depth):s;return g(`li`,{children:_(`a`,{href:`#${i.id}`,"data-active":o?`true`:`false`,"data-depth":i.depth,"data-heading-id":i.id,className:x(),style:{paddingInlineStart:`${r(i.depth)}px`},onClick:c,children:[s===l?null:g(`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:g(`path`,{d:`M ${l} 0 C ${l} 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===l?`0px`:`6px`,zIndex:-1}}),i.title]})},i.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=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 I(e,n){let r=m(null),[i,a]=h(null),[o,s]=h(null),c=m(null);return d(()=>{let e=r.current;if(!e)return;let i=0,o=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(()=>{let r=t(O(e,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(e),window.addEventListener(`resize`,o),o(),()=>{cancelAnimationFrame(i),s?.disconnect(),window.removeEventListener(`resize`,o)}},[n]),d(()=>{let t=0;return t=requestAnimationFrame(()=>{if(!i||e.length===0){c.current=null,s(e=>e===null?e:null);return}let[t,n]=P(e,i,c.current);c.current=n,s(e=>j(e,t)?e:t)}),()=>{cancelAnimationFrame(t)}},[e,i]),[r,i,o]}const L=({className:e,collapseEnabled:t=!1,defaultCollapsed:n=!1,dock:r=`sticky`,headings:a,minHeadings:o=1})=>{let s=M(a),[c,l]=h(n);return a.length<o?null:g(`aside`,{"data-docs-region":`toc`,"data-docs-toc-collapsible":t?`true`:void 0,"data-docs-toc-collapsed":t?String(c):void 0,className:u(`hidden w-64 xl:block`,r===`sticky`?`shrink-0 xl:self-start xl:sticky xl:top-24`:`xl:fixed xl:top-24`,e),children:_(`nav`,{"aria-label":`On This Page`,className:`flex flex-col gap-3 text-sm`,children:[c?null:_(`div`,{className:u(`flex items-center gap-2`,t?`justify-between`:void 0),children:[g(`p`,{className:`font-medium text-foreground`,children:b}),t?_(i,{type:`button`,variant:`ghost`,size:`icon`,"data-docs-toc-toggle":`true`,"aria-controls":s.listId,"aria-expanded":`true`,title:`Collapse outline`,"aria-label":`Collapse outline`,className:`size-8 shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>{l(e=>!e)},children:[g(v,{className:`size-4`,"aria-hidden":`true`}),g(`span`,{className:`sr-only`,children:`Collapse outline`})]}):null]}),c?_(i,{type:`button`,"data-docs-toc-panel":`collapsed`,variant:`ghost`,size:`icon`,"aria-label":`Expand outline`,"aria-expanded":`false`,title:`Expand outline`,className:`self-start shrink-0 text-muted-foreground hover:text-foreground`,onClick:()=>{l(!1)},children:[g(y,{className:`size-4`,"aria-hidden":`true`}),g(`span`,{className:`sr-only`,children:`Expand outline`})]}):g(N,{...s,headings:a,listClassName:`max-h-[calc(100dvh-8rem)]`})]})})},R=({className:t,headings:n,minHeadings:r=1})=>{let d=M(n),[f,p]=h(!1);return n.length<r?null:g(`div`,{className:u(`xl:hidden`,t),children:_(a,{open:f,onOpenChange:p,children:[g(l,{asChild:!0,children:_(i,{type:`button`,variant:`outline`,size:`icon`,title:`Open outline`,"aria-label":`Open outline`,"data-docs-toc-mobile-trigger":`true`,className:`fixed border border-input bg-background shadow-sm`,style:e(1),children:[g(y,{className:`size-4`,"aria-hidden":`true`}),g(`span`,{className:`sr-only`,children:`Open outline`})]})}),_(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:b})}),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,{...d,headings:n,listClassName:`min-h-0 flex-1`,wrapperClassName:`min-h-0 flex-1`,onSelect:()=>{p(!1)}})})]})]})})};export{L as DefaultDocsToc,R as MobileDocsToc};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * name: @blackwork/docs
3
+ * version: v0.2.0
4
+ * description: Next-first documentation framework for Blackwork projects.
5
+ * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
+ * homepage: https://chengpeiquan.com
7
+ * license: MIT
8
+ */
9
+ const e=(e=0)=>({bottom:`${20+e*52}px`,height:`40px`,position:`fixed`,right:`20px`,width:`40px`,zIndex:10});exports.getDocsFloatingActionStyle=e;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * name: @blackwork/docs
3
+ * version: v0.2.0
4
+ * description: Next-first documentation framework for Blackwork projects.
5
+ * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
+ * homepage: https://chengpeiquan.com
7
+ * license: MIT
8
+ */
9
+ const e=(e=0)=>({bottom:`${20+e*52}px`,height:`40px`,position:`fixed`,right:`20px`,width:`40px`,zIndex:10});export{e as getDocsFloatingActionStyle};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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.1.0
3
+ * version: v0.2.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=({homeHref:e,LinkComponent:r=t.DefaultDocsLink,localeLinks:a=[],siteTitle:o})=>(0,i.jsx)(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:r,localeLinks:a}),themeToggle:(0,i.jsx)(n.ThemeToggle,{title:`Toggle theme`,ariaLabel:`Toggle theme`}),children:(0,i.jsx)(r,{href:e,"data-docs-region":`header-brand`,className:`truncate text-lg font-semibold text-foreground`,children:o})});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(`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;
@@ -4,6 +4,7 @@ import React from "react";
4
4
 
5
5
  //#region src/theme/components/header.d.ts
6
6
  interface DefaultDocsHeaderProps {
7
+ headerActions?: React.ReactNode;
7
8
  homeHref: string;
8
9
  LinkComponent?: DocsThemeLinkComponent;
9
10
  localeLinks?: DocsThemeLocaleLink[];
@@ -4,6 +4,7 @@ import React from "react";
4
4
 
5
5
  //#region src/theme/components/header.d.ts
6
6
  interface DefaultDocsHeaderProps {
7
+ headerActions?: React.ReactNode;
7
8
  homeHref: string;
8
9
  LinkComponent?: DocsThemeLinkComponent;
9
10
  localeLinks?: DocsThemeLocaleLink[];
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.1.0
3
+ * version: v0.2.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=({homeHref:t,LinkComponent:n=e,localeLinks:r=[],siteTitle:i})=>c(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:n,localeLinks:r}),themeToggle:c(s,{title:`Toggle theme`,ariaLabel:`Toggle theme`}),children:c(n,{href:t,"data-docs-region":`header-brand`,className:`truncate text-lg font-semibold text-foreground`,children:i})});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,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};