@blackwork/docs 0.2.0 → 0.4.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 (128) hide show
  1. package/README.md +24 -1
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  3. package/dist/config/defaults.cjs +1 -1
  4. package/dist/config/defaults.mjs +1 -1
  5. package/dist/config/define-config.cjs +1 -1
  6. package/dist/config/define-config.mjs +1 -1
  7. package/dist/config/define-docs-config.cjs +1 -1
  8. package/dist/config/define-docs-config.mjs +1 -1
  9. package/dist/config/load-content-config.cjs +1 -1
  10. package/dist/config/load-content-config.mjs +1 -1
  11. package/dist/config/types.d.mts +11 -1
  12. package/dist/config/types.d.ts +11 -1
  13. package/dist/export/process-exported-docs.cjs +1 -1
  14. package/dist/export/process-exported-docs.mjs +1 -1
  15. package/dist/index.cjs +1 -1
  16. package/dist/index.d.mts +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.mjs +1 -1
  19. package/dist/mdx/default-docs-components.cjs +1 -1
  20. package/dist/mdx/default-docs-components.mjs +1 -1
  21. package/dist/mdx/merge-docs-components.cjs +1 -1
  22. package/dist/mdx/merge-docs-components.mjs +1 -1
  23. package/dist/metadata/create-doc-metadata.cjs +1 -1
  24. package/dist/metadata/create-doc-metadata.d.mts +1 -1
  25. package/dist/metadata/create-doc-metadata.d.ts +1 -1
  26. package/dist/metadata/create-doc-metadata.mjs +1 -1
  27. package/dist/navigation/build-locale-links.cjs +1 -1
  28. package/dist/navigation/build-locale-links.d.mts +1 -1
  29. package/dist/navigation/build-locale-links.d.ts +1 -1
  30. package/dist/navigation/build-locale-links.mjs +1 -1
  31. package/dist/navigation/build-pager.cjs +1 -1
  32. package/dist/navigation/build-pager.mjs +1 -1
  33. package/dist/navigation/build-sidebar.cjs +1 -1
  34. package/dist/navigation/build-sidebar.d.mts +1 -1
  35. package/dist/navigation/build-sidebar.d.ts +1 -1
  36. package/dist/navigation/build-sidebar.mjs +1 -1
  37. package/dist/navigation/resolve-sidebar.cjs +1 -1
  38. package/dist/navigation/resolve-sidebar.mjs +1 -1
  39. package/dist/next/context.cjs +1 -1
  40. package/dist/next/context.mjs +1 -1
  41. package/dist/next/document-lang-sync.cjs +1 -1
  42. package/dist/next/document-lang-sync.mjs +1 -1
  43. package/dist/next/load-doc-content.cjs +1 -1
  44. package/dist/next/load-doc-content.mjs +1 -1
  45. package/dist/next/load-generated-manifest.cjs +1 -1
  46. package/dist/next/load-generated-manifest.mjs +1 -1
  47. package/dist/next/metadata.cjs +1 -1
  48. package/dist/next/metadata.mjs +1 -1
  49. package/dist/next/page.cjs +1 -1
  50. package/dist/next/page.mjs +1 -1
  51. package/dist/next/render-route.cjs +1 -1
  52. package/dist/next/render-route.mjs +1 -1
  53. package/dist/next/resolve-document-lang.cjs +1 -1
  54. package/dist/next/resolve-document-lang.mjs +1 -1
  55. package/dist/next/root-layout.cjs +1 -1
  56. package/dist/next/root-layout.mjs +1 -1
  57. package/dist/next-plugin/generate.cjs +1 -1
  58. package/dist/next-plugin/generate.mjs +1 -1
  59. package/dist/next.cjs +1 -1
  60. package/dist/next.mjs +1 -1
  61. package/dist/routing/build-static-params.cjs +1 -1
  62. package/dist/routing/build-static-params.mjs +1 -1
  63. package/dist/routing/resolve-docs-route.cjs +1 -1
  64. package/dist/routing/resolve-docs-route.mjs +1 -1
  65. package/dist/runtime.cjs +1 -1
  66. package/dist/runtime.mjs +1 -1
  67. package/dist/source/build-docs-source.cjs +1 -1
  68. package/dist/source/build-docs-source.mjs +1 -1
  69. package/dist/source/collect-docs-manifest.cjs +1 -1
  70. package/dist/source/collect-docs-manifest.mjs +1 -1
  71. package/dist/source/create-docs-source-from-manifest.cjs +1 -1
  72. package/dist/source/create-docs-source-from-manifest.mjs +1 -1
  73. package/dist/source/create-docs-source.cjs +1 -1
  74. package/dist/source/create-docs-source.mjs +1 -1
  75. package/dist/tailwind.css +1 -0
  76. package/dist/theme/components/content-layout.cjs +9 -0
  77. package/dist/theme/components/content-layout.d.mts +15 -0
  78. package/dist/theme/components/content-layout.d.ts +15 -0
  79. package/dist/theme/components/content-layout.mjs +9 -0
  80. package/dist/theme/components/content-shell.cjs +2 -2
  81. package/dist/theme/components/content-shell.d.mts +1 -1
  82. package/dist/theme/components/content-shell.d.ts +1 -1
  83. package/dist/theme/components/content-shell.mjs +2 -2
  84. package/dist/theme/components/docs-rail-scroll-state.cjs +2 -2
  85. package/dist/theme/components/docs-rail-scroll-state.mjs +2 -2
  86. package/dist/theme/components/docs-rail-scroll.cjs +2 -2
  87. package/dist/theme/components/docs-rail-scroll.mjs +2 -2
  88. package/dist/theme/components/docs-scroll-reset.cjs +1 -1
  89. package/dist/theme/components/docs-scroll-reset.mjs +1 -1
  90. package/dist/theme/components/docs-scroll-to-top.cjs +1 -1
  91. package/dist/theme/components/docs-scroll-to-top.mjs +1 -1
  92. package/dist/theme/components/docs-shell.cjs +2 -2
  93. package/dist/theme/components/docs-shell.d.mts +1 -1
  94. package/dist/theme/components/docs-shell.d.ts +1 -1
  95. package/dist/theme/components/docs-shell.mjs +2 -2
  96. package/dist/theme/components/docs-toc-geometry.cjs +1 -1
  97. package/dist/theme/components/docs-toc-geometry.mjs +1 -1
  98. package/dist/theme/components/docs-toc.cjs +2 -2
  99. package/dist/theme/components/docs-toc.d.mts +32 -0
  100. package/dist/theme/components/docs-toc.d.ts +32 -0
  101. package/dist/theme/components/docs-toc.mjs +2 -2
  102. package/dist/theme/components/floating-actions.cjs +1 -1
  103. package/dist/theme/components/floating-actions.mjs +1 -1
  104. package/dist/theme/components/footer.cjs +1 -1
  105. package/dist/theme/components/footer.mjs +1 -1
  106. package/dist/theme/components/header.cjs +1 -1
  107. package/dist/theme/components/header.mjs +1 -1
  108. package/dist/theme/components/home-shell.cjs +1 -1
  109. package/dist/theme/components/home-shell.d.mts +1 -1
  110. package/dist/theme/components/home-shell.d.ts +1 -1
  111. package/dist/theme/components/home-shell.mjs +1 -1
  112. package/dist/theme/components/link.cjs +1 -1
  113. package/dist/theme/components/link.mjs +1 -1
  114. package/dist/theme/components/shell-shared.cjs +2 -2
  115. package/dist/theme/components/shell-shared.mjs +2 -2
  116. package/dist/theme/create-home-data.cjs +1 -1
  117. package/dist/theme/create-home-data.d.mts +1 -1
  118. package/dist/theme/create-home-data.d.ts +1 -1
  119. package/dist/theme/create-home-data.mjs +1 -1
  120. package/dist/theme/slots.cjs +2 -2
  121. package/dist/theme/slots.mjs +2 -2
  122. package/dist/theme/types.d.mts +6 -1
  123. package/dist/theme/types.d.ts +6 -1
  124. package/dist/theme.cjs +2 -2
  125. package/dist/theme.d.mts +4 -2
  126. package/dist/theme.d.ts +4 -2
  127. package/dist/theme.mjs +2 -2
  128. package/package.json +8 -7
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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 @@
1
+ @source './';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * name: @blackwork/docs
3
+ * version: v0.4.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`);let t=require(`react`);t=e.__toESM(t);let n=require(`react/jsx-runtime`);const r=({children:e,contentTocVisible:t=!1,footer:r,headerMeta:i,pagefindFilterEntries:a=[],title:o})=>(0,n.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:[t?(0,n.jsx)(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null,(0,n.jsx)(`div`,{className:`flex min-w-0 flex-1 justify-center`,children:(0,n.jsxs)(`div`,{className:`flex w-full max-w-4xl flex-col gap-8`,children:[(0,n.jsxs)(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-8`,children:[(0,n.jsx)(`div`,{hidden:!0,children:a.map(e=>(0,n.jsx)(`span`,{"data-pagefind-filter":e},e))}),(0,n.jsxs)(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-5`,children:[(0,n.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:o}),i?(0,n.jsx)(`div`,{"data-docs-region":`article-header-meta`,children:i}):null]}),(0,n.jsx)(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:e})]}),r]})}),t?(0,n.jsx)(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null]});exports.DefaultContentLayout=r;
@@ -0,0 +1,15 @@
1
+
2
+ import React from "react";
3
+
4
+ //#region src/theme/components/content-layout.d.ts
5
+ interface DefaultContentLayoutProps {
6
+ children: React.ReactNode;
7
+ contentTocVisible?: boolean;
8
+ footer?: React.ReactNode;
9
+ headerMeta?: React.ReactNode;
10
+ pagefindFilterEntries?: string[];
11
+ title: React.ReactNode;
12
+ }
13
+ declare const DefaultContentLayout: React.FC<DefaultContentLayoutProps>;
14
+ //#endregion
15
+ export { DefaultContentLayout, DefaultContentLayoutProps };
@@ -0,0 +1,15 @@
1
+
2
+ import React from "react";
3
+
4
+ //#region src/theme/components/content-layout.d.ts
5
+ interface DefaultContentLayoutProps {
6
+ children: React.ReactNode;
7
+ contentTocVisible?: boolean;
8
+ footer?: React.ReactNode;
9
+ headerMeta?: React.ReactNode;
10
+ pagefindFilterEntries?: string[];
11
+ title: React.ReactNode;
12
+ }
13
+ declare const DefaultContentLayout: React.FC<DefaultContentLayoutProps>;
14
+ //#endregion
15
+ export { DefaultContentLayout, DefaultContentLayoutProps };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * name: @blackwork/docs
3
+ * version: v0.4.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"react";import{jsx as e,jsxs as t}from"react/jsx-runtime";const n=({children:n,contentTocVisible:r=!1,footer:i,headerMeta:a,pagefindFilterEntries:o=[],title:s})=>t(`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:[r?e(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null,e(`div`,{className:`flex min-w-0 flex-1 justify-center`,children:t(`div`,{className:`flex w-full max-w-4xl flex-col gap-8`,children:[t(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-8`,children:[e(`div`,{hidden:!0,children:o.map(t=>e(`span`,{"data-pagefind-filter":t},t))}),t(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-5`,children:[e(`h1`,{className:`text-3xl font-semibold tracking-tight text-foreground`,children:s}),a?e(`div`,{"data-docs-region":`article-header-meta`,children:a}):null]}),e(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:n})]}),i]})}),r?e(`div`,{"aria-hidden":`true`,className:`hidden w-64 shrink-0 xl:block`}):null]});export{n as DefaultContentLayout};
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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-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;
9
+ const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../config/define-config.cjs`),n=require(`../../navigation/build-locale-links.cjs`),r=require(`../../navigation/resolve-sidebar.cjs`),i=require(`../../navigation/build-pager.cjs`),a=require(`../../navigation/build-sidebar.cjs`),o=require(`./link.cjs`),s=require(`./footer.cjs`),c=require(`./header.cjs`),l=require(`./docs-toc.cjs`),u=require(`./content-layout.cjs`),d=require(`../slots.cjs`),f=require(`./docs-scroll-to-top.cjs`),p=require(`./shell-shared.cjs`);let m=require(`react`);m=e.__toESM(m);let h=require(`react/jsx-runtime`);const g=({children:e,config:m,entry:g,headings:_=[],source:v})=>{let y=t.defineConfig(m),b=v.getEntries(g.locale),x=p.getEntrySectionKey(g),S=p.getEntrySectionConfig(y,g),C=Array.isArray(S.sidebar),w=p.getSectionEntries(b,g),T=C?r.resolveSidebar({config:y,entries:b,currentHref:g.href,sectionKey:x}):[],E=p.toNavigation(g,C?r.flattenResolvedSidebarItems(T):a.buildSidebar({entries:b,currentHref:g.href})),D=i.buildPager({entries:w,currentHref:g.href,...C?{sidebar:T}:{}}),O=n.buildLocaleLinks({config:y,entry:g,source:v}),k=p.getTocHeadings(_),A=k.length>=2,j=p.getTocLabels(y,g.locale),M=v.getCanonicalHref(g.locale,[]),N=d.resolveThemeSlots(y.slots),P=N.contentHeaderMeta,F=N.headerActions,I=N.link??o.DefaultDocsLink,L=N.footer??s.DefaultDocsFooter,R=p.getPagefindFilterEntries(p.getPagefindFilters({layout:S.layout,locale:g.locale,section:x})),z=A?(0,h.jsx)(l.DefaultDocsToc,{headings:k,...j,collapseDirection:`right`,collapseEnabled:!0,dock:`fixed`,className:`xl:right-8`}):null,B=A?(0,h.jsx)(l.MobileDocsToc,{headings:k,minHeadings:2,...j}):null;return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.DefaultDocsHeader,{headerActions:F?(0,h.jsx)(F,{homeHref:M,localeLinks:O,navigation:E,siteDescription:y.site.description,siteTitle:p.getSiteTitle(y)}):void 0,homeHref:M,LinkComponent:I,localeLinks:O,navigation:E,siteDescription:y.site.description,siteTitle:p.getSiteTitle(y)}),(0,h.jsx)(f.DocsScrollToTop,{}),B,z,(0,h.jsx)(u.DefaultContentLayout,{footer:(0,h.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:[D.previous?(0,h.jsxs)(I,{href:D.previous.href,className:`text-muted-foreground`,children:[`Previous: `,D.previous.title]}):(0,h.jsx)(`span`,{}),D.next?(0,h.jsxs)(I,{href:D.next.href,className:`text-muted-foreground`,children:[`Next: `,D.next.title]}):null]}),headerMeta:P?(0,h.jsx)(P,{entry:g}):void 0,pagefindFilterEntries:R,contentTocVisible:A,title:g.title,children:e}),(0,h.jsx)(L,{description:p.getFooterDescription(y,g),homeHref:M,LinkComponent:I,navigation:E,siteTitle:p.getSiteTitle(y)})]})};exports.DefaultContentShell=g;
@@ -1,6 +1,6 @@
1
1
 
2
- import { DocsConfig, NormalizedDocsConfig } from "../../config/types.mjs";
3
2
  import { DocEntry, DocsSource } from "../../source/types.mjs";
3
+ import { DocsConfig, NormalizedDocsConfig } from "../../config/types.mjs";
4
4
  import React from "react";
5
5
  import { HeadingItem } from "@blackwork/machine";
6
6
 
@@ -1,6 +1,6 @@
1
1
 
2
- import { DocsConfig, NormalizedDocsConfig } from "../../config/types.js";
3
2
  import { DocEntry, DocsSource } from "../../source/types.js";
3
+ import { DocsConfig, NormalizedDocsConfig } from "../../config/types.js";
4
4
  import React from "react";
5
5
  import { HeadingItem } from "@blackwork/machine";
6
6
 
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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{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};
9
+ import{defineConfig as e}from"../../config/define-config.mjs";import{buildLocaleLinks as t}from"../../navigation/build-locale-links.mjs";import{flattenResolvedSidebarItems as n,resolveSidebar as r}from"../../navigation/resolve-sidebar.mjs";import{buildPager as i}from"../../navigation/build-pager.mjs";import{buildSidebar as a}from"../../navigation/build-sidebar.mjs";import{DefaultDocsLink as o}from"./link.mjs";import{DefaultDocsFooter as s}from"./footer.mjs";import{DefaultDocsHeader as c}from"./header.mjs";import{DefaultDocsToc as l,MobileDocsToc as u}from"./docs-toc.mjs";import{DefaultContentLayout as d}from"./content-layout.mjs";import{resolveThemeSlots as f}from"../slots.mjs";import{DocsScrollToTop as p}from"./docs-scroll-to-top.mjs";import{getEntrySectionConfig as m,getEntrySectionKey as h,getFooterDescription as g,getPagefindFilterEntries as _,getPagefindFilters as v,getSectionEntries as y,getSiteTitle as b,getTocHeadings as x,getTocLabels as S,toNavigation as C}from"./shell-shared.mjs";import"react";import{Fragment as w,jsx as T,jsxs as E}from"react/jsx-runtime";const D=({children:D,config:O,entry:k,headings:A=[],source:j})=>{let M=e(O),N=j.getEntries(k.locale),P=h(k),F=m(M,k),I=Array.isArray(F.sidebar),L=y(N,k),R=I?r({config:M,entries:N,currentHref:k.href,sectionKey:P}):[],z=C(k,I?n(R):a({entries:N,currentHref:k.href})),B=i({entries:L,currentHref:k.href,...I?{sidebar:R}:{}}),V=t({config:M,entry:k,source:j}),H=x(A),U=H.length>=2,W=S(M,k.locale),G=j.getCanonicalHref(k.locale,[]),K=f(M.slots),q=K.contentHeaderMeta,J=K.headerActions,Y=K.link??o,X=K.footer??s,Z=_(v({layout:F.layout,locale:k.locale,section:P})),Q=U?T(l,{headings:H,...W,collapseDirection:`right`,collapseEnabled:!0,dock:`fixed`,className:`xl:right-8`}):null,$=U?T(u,{headings:H,minHeadings:2,...W}):null;return E(w,{children:[T(c,{headerActions:J?T(J,{homeHref:G,localeLinks:V,navigation:z,siteDescription:M.site.description,siteTitle:b(M)}):void 0,homeHref:G,LinkComponent:Y,localeLinks:V,navigation:z,siteDescription:M.site.description,siteTitle:b(M)}),T(p,{}),$,Q,T(d,{footer:E(`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:[B.previous?E(Y,{href:B.previous.href,className:`text-muted-foreground`,children:[`Previous: `,B.previous.title]}):T(`span`,{}),B.next?E(Y,{href:B.next.href,className:`text-muted-foreground`,children:[`Next: `,B.next.title]}):null]}),headerMeta:q?T(q,{entry:k}):void 0,pagefindFilterEntries:Z,contentTocVisible:U,title:k.title,children:D}),T(X,{description:g(M,k),homeHref:G,LinkComponent:Y,navigation:z,siteTitle:b(M)})]})};export{D as DefaultContentShell};
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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=({scrollTop:e,clientHeight:t,scrollHeight:n})=>{let r=Math.max(n-t,0);return r<=1?{showTop:!1,showBottom:!1}:{showTop:e>1,showBottom:r-e>1}};exports.getDocsRailFadeState=e;
9
+ const e=({scrollTop:e,clientHeight:t,scrollHeight:n})=>{let r=Math.max(n-t,0);return r<=1?{bottomVisible:!1,topVisible:!1}:{bottomVisible:r-e>1,topVisible:e>1}};exports.getDocsRailFadeState=e;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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=({scrollTop:e,clientHeight:t,scrollHeight:n})=>{let r=Math.max(n-t,0);return r<=1?{showTop:!1,showBottom:!1}:{showTop:e>1,showBottom:r-e>1}};export{e as getDocsRailFadeState};
9
+ const e=({scrollTop:e,clientHeight:t,scrollHeight:n})=>{let r=Math.max(n-t,0);return r<=1?{bottomVisible:!1,topVisible:!1}:{bottomVisible:r-e>1,topVisible:e>1}};export{e as getDocsRailFadeState};
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`./docs-rail-scroll-state.cjs`);let t=require(`react`),n=require(`react/jsx-runtime`);const r={showTop:!1,showBottom:!1},i=e=>e?`opacity-100`:`opacity-0`,a=({children:a})=>{let o=(0,t.useRef)(null),[s,c]=(0,t.useState)(r);return(0,t.useEffect)(()=>{let t=o.current;if(!t)return;let n=()=>{let n=e.getDocsRailFadeState({scrollTop:t.scrollTop,clientHeight:t.clientHeight,scrollHeight:t.scrollHeight});c(e=>e.showTop===n.showTop&&e.showBottom===n.showBottom?e:n)};n(),t.addEventListener(`scroll`,n,{passive:!0});let r=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{n()});r?.observe(t);let i=t.firstElementChild;return i instanceof HTMLElement&&r?.observe(i),()=>{t.removeEventListener(`scroll`,n),r?.disconnect()}},[]),(0,n.jsxs)(`div`,{"data-docs-sidebar-scroll":`true`,className:`relative lg:max-h-[calc(100dvh-6rem)] lg:overflow-hidden`,children:[(0,n.jsx)(`div`,{"aria-hidden":`true`,"data-docs-sidebar-fade":`top`,className:[`pointer-events-none absolute inset-x-0 top-0 z-10 hidden h-8 bg-gradient-to-b from-background via-background/80 to-transparent transition-opacity lg:block`,i(s.showTop)].join(` `)}),(0,n.jsx)(`div`,{ref:o,"data-docs-rail-viewport":`true`,className:`lg:max-h-[calc(100dvh-6rem)] lg:overflow-auto lg:pb-8 lg:pr-4 [scrollbar-width:none]`,children:a}),(0,n.jsx)(`div`,{"aria-hidden":`true`,"data-docs-sidebar-fade":`bottom`,className:[`pointer-events-none absolute inset-x-0 bottom-0 z-10 hidden h-12 bg-gradient-to-t from-background via-background/80 to-transparent transition-opacity lg:block`,i(s.showBottom)].join(` `)})]})};exports.DocsRailScroll=a;
9
+ "use client";require(`../../_virtual/_rolldown/runtime.cjs`);const e=require(`./docs-rail-scroll-state.cjs`);let t=require(`react`),n=require(`react/jsx-runtime`);const r={bottomVisible:!1,topVisible:!1},i=e=>e?`opacity-100`:`opacity-0`,a=({children:a})=>{let o=(0,t.useRef)(null),[s,c]=(0,t.useState)(r);return(0,t.useEffect)(()=>{let t=o.current;if(!t)return;let n=()=>{let n=e.getDocsRailFadeState({scrollTop:t.scrollTop,clientHeight:t.clientHeight,scrollHeight:t.scrollHeight});c(e=>e.bottomVisible===n.bottomVisible&&e.topVisible===n.topVisible?e:n)};n(),t.addEventListener(`scroll`,n,{passive:!0});let r=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{n()});r?.observe(t);let i=t.firstElementChild;return i instanceof HTMLElement&&r?.observe(i),()=>{t.removeEventListener(`scroll`,n),r?.disconnect()}},[]),(0,n.jsxs)(`div`,{"data-docs-sidebar-scroll":`true`,className:`relative lg:max-h-[calc(100dvh-6rem)] lg:overflow-hidden`,children:[(0,n.jsx)(`div`,{"aria-hidden":`true`,"data-docs-sidebar-fade":`top`,className:[`pointer-events-none absolute inset-x-0 top-0 z-10 hidden h-8 bg-gradient-to-b from-background via-background/80 to-transparent transition-opacity lg:block`,i(s.topVisible)].join(` `)}),(0,n.jsx)(`div`,{ref:o,"data-docs-rail-viewport":`true`,className:`lg:max-h-[calc(100dvh-6rem)] lg:overflow-auto lg:pb-8 lg:pr-4 [scrollbar-width:none]`,children:a}),(0,n.jsx)(`div`,{"aria-hidden":`true`,"data-docs-sidebar-fade":`bottom`,className:[`pointer-events-none absolute inset-x-0 bottom-0 z-10 hidden h-12 bg-gradient-to-t from-background via-background/80 to-transparent transition-opacity lg:block`,i(s.bottomVisible)].join(` `)})]})};exports.DocsRailScroll=a;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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{getDocsRailFadeState as e}from"./docs-rail-scroll-state.mjs";import{useEffect as t,useRef as n,useState as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";const o={showTop:!1,showBottom:!1},s=e=>e?`opacity-100`:`opacity-0`,c=({children:c})=>{let l=n(null),[u,d]=r(o);return t(()=>{let t=l.current;if(!t)return;let n=()=>{let n=e({scrollTop:t.scrollTop,clientHeight:t.clientHeight,scrollHeight:t.scrollHeight});d(e=>e.showTop===n.showTop&&e.showBottom===n.showBottom?e:n)};n(),t.addEventListener(`scroll`,n,{passive:!0});let r=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{n()});r?.observe(t);let i=t.firstElementChild;return i instanceof HTMLElement&&r?.observe(i),()=>{t.removeEventListener(`scroll`,n),r?.disconnect()}},[]),a(`div`,{"data-docs-sidebar-scroll":`true`,className:`relative lg:max-h-[calc(100dvh-6rem)] lg:overflow-hidden`,children:[i(`div`,{"aria-hidden":`true`,"data-docs-sidebar-fade":`top`,className:[`pointer-events-none absolute inset-x-0 top-0 z-10 hidden h-8 bg-gradient-to-b from-background via-background/80 to-transparent transition-opacity lg:block`,s(u.showTop)].join(` `)}),i(`div`,{ref:l,"data-docs-rail-viewport":`true`,className:`lg:max-h-[calc(100dvh-6rem)] lg:overflow-auto lg:pb-8 lg:pr-4 [scrollbar-width:none]`,children:c}),i(`div`,{"aria-hidden":`true`,"data-docs-sidebar-fade":`bottom`,className:[`pointer-events-none absolute inset-x-0 bottom-0 z-10 hidden h-12 bg-gradient-to-t from-background via-background/80 to-transparent transition-opacity lg:block`,s(u.showBottom)].join(` `)})]})};export{c as DocsRailScroll};
9
+ "use client";import{getDocsRailFadeState as e}from"./docs-rail-scroll-state.mjs";import{useEffect as t,useRef as n,useState as r}from"react";import{jsx as i,jsxs as a}from"react/jsx-runtime";const o={bottomVisible:!1,topVisible:!1},s=e=>e?`opacity-100`:`opacity-0`,c=({children:c})=>{let l=n(null),[u,d]=r(o);return t(()=>{let t=l.current;if(!t)return;let n=()=>{let n=e({scrollTop:t.scrollTop,clientHeight:t.clientHeight,scrollHeight:t.scrollHeight});d(e=>e.bottomVisible===n.bottomVisible&&e.topVisible===n.topVisible?e:n)};n(),t.addEventListener(`scroll`,n,{passive:!0});let r=typeof ResizeObserver>`u`?null:new ResizeObserver(()=>{n()});r?.observe(t);let i=t.firstElementChild;return i instanceof HTMLElement&&r?.observe(i),()=>{t.removeEventListener(`scroll`,n),r?.disconnect()}},[]),a(`div`,{"data-docs-sidebar-scroll":`true`,className:`relative lg:max-h-[calc(100dvh-6rem)] lg:overflow-hidden`,children:[i(`div`,{"aria-hidden":`true`,"data-docs-sidebar-fade":`top`,className:[`pointer-events-none absolute inset-x-0 top-0 z-10 hidden h-8 bg-gradient-to-b from-background via-background/80 to-transparent transition-opacity lg:block`,s(u.topVisible)].join(` `)}),i(`div`,{ref:l,"data-docs-rail-viewport":`true`,className:`lg:max-h-[calc(100dvh-6rem)] lg:overflow-auto lg:pb-8 lg:pr-4 [scrollbar-width:none]`,children:c}),i(`div`,{"aria-hidden":`true`,"data-docs-sidebar-fade":`bottom`,className:[`pointer-events-none absolute inset-x-0 bottom-0 z-10 hidden h-12 bg-gradient-to-t from-background via-background/80 to-transparent transition-opacity lg:block`,s(u.bottomVisible)].join(` `)})]})};export{c as DocsRailScroll};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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-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;
9
+ const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`../../config/define-config.cjs`),n=require(`../../navigation/build-locale-links.cjs`),r=require(`../../navigation/resolve-sidebar.cjs`),i=require(`../../navigation/build-pager.cjs`),a=require(`../../navigation/build-sidebar.cjs`),o=require(`./link.cjs`),s=require(`./footer.cjs`),c=require(`./header.cjs`),l=require(`./docs-toc.cjs`),u=require(`../slots.cjs`),d=require(`./docs-scroll-to-top.cjs`),f=require(`./shell-shared.cjs`),p=require(`./docs-rail-scroll.cjs`);let m=require(`blackwork`),h=require(`react`);h=e.__toESM(h);let g=require(`react/jsx-runtime`),_=require(`blackwork/icons`);const v=e=>[`block rounded-md py-1.5 pr-3 text-sm transition-colors`,e?`bg-accent font-medium text-accent-foreground`:`text-muted-foreground hover:text-foreground`].join(` `),y=e=>e.isExternal||e.slugSegments.length>0,b=e=>e.flatMap(e=>{if(e.type===`group`){let t=e.items.filter(y);return t.length===0?[]:[{...e,items:t}]}return y(e)?[e]:[]}),x=({LinkComponent:e,nodes:t})=>(0,g.jsx)(`nav`,{"aria-label":`Documentation pages`,className:`flex flex-col gap-1`,children:t.map(t=>t.type===`group`?(0,g.jsxs)(`div`,{className:`flex flex-col gap-1 pt-4 first:pt-0`,children:[(0,g.jsx)(`p`,{className:`px-3 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground/80`,children:t.title}),t.items.map(t=>(0,g.jsx)(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:v(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))]},t.title):(0,g.jsx)(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:v(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))}),S=({currentTitle:e,LinkComponent:t,nodes:n})=>n.length===0?null:(0,g.jsx)(`div`,{className:`lg:hidden`,children:(0,g.jsxs)(m.Sheet,{children:[(0,g.jsx)(m.SheetTrigger,{asChild:!0,children:(0,g.jsxs)(m.Button,{type:`button`,variant:`outline`,"aria-label":`Open section navigation`,className:`h-auto w-full justify-start gap-3 rounded-lg px-4 py-3`,children:[(0,g.jsx)(_.Menu,{className:`size-4 shrink-0`,"aria-hidden":`true`}),(0,g.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col items-start text-left`,children:[(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Sections`}),(0,g.jsx)(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e})]})]})}),(0,g.jsxs)(m.SheetContent,{side:`left`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[(0,g.jsx)(m.SheetHeader,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:(0,g.jsx)(m.SheetTitle,{children:`Sections`})}),(0,g.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:(0,g.jsx)(x,{LinkComponent:t,nodes:n})})]})]})}),C=({children:e,config:m,entry:h,headings:_=[],source:v})=>{let y=t.defineConfig(m),C=v.getEntries(h.locale),w=f.getEntrySectionKey(h),T=f.getEntrySectionConfig(y,h),E=Array.isArray(T.sidebar),D=f.getSectionEntries(C,h),O=r.resolveSidebar({config:y,entries:C,currentHref:h.href,sectionKey:w}),k=b(O),A=i.buildPager({entries:D,currentHref:h.href,...E?{sidebar:O}:{}}),j=f.toNavigation(h,E?r.flattenResolvedSidebarItems(O):a.buildSidebar({entries:C,currentHref:h.href})),M=n.buildLocaleLinks({config:y,entry:h,source:v}),N=f.getTocHeadings(_),P=f.getTocLabels(y,h.locale),F=v.getCanonicalHref(h.locale,[]),I=u.resolveThemeSlots(y.slots),L=I.headerActions,R=I.link??o.DefaultDocsLink,z=I.footer??s.DefaultDocsFooter,B=f.getPagefindFilterEntries(f.getPagefindFilters({layout:T.layout,locale:h.locale,section:w}));return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(c.DefaultDocsHeader,{headerActions:L?(0,g.jsx)(L,{homeHref:F,localeLinks:M,navigation:j,siteDescription:y.site.description,siteTitle:f.getSiteTitle(y)}):void 0,homeHref:F,LinkComponent:R,localeLinks:M,navigation:j,siteDescription:y.site.description,siteTitle:f.getSiteTitle(y)}),(0,g.jsx)(d.DocsScrollToTop,{}),(0,g.jsx)(l.MobileDocsToc,{headings:N,...P}),(0,g.jsxs)(`main`,{"data-docs-region":`docs-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-6 px-6 py-8 sm:gap-8 sm:px-8 lg:flex-row lg:gap-14 xl:gap-20 xl:px-10 2xl:gap-24 2xl:px-12`,children:[(0,g.jsx)(S,{currentTitle:h.title,LinkComponent:R,nodes:k}),(0,g.jsx)(`aside`,{"data-docs-region":`sidebar`,className:`hidden w-full shrink-0 lg:block lg:w-72 lg:self-start lg:sticky lg:top-24`,children:(0,g.jsx)(p.DocsRailScroll,{children:(0,g.jsx)(x,{LinkComponent:R,nodes:k})})}),(0,g.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-10`,children:[(0,g.jsxs)(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-10`,children:[(0,g.jsx)(`div`,{hidden:!0,children:B.map(e=>(0,g.jsx)(`span`,{"data-pagefind-filter":e},e))}),(0,g.jsxs)(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[(0,g.jsx)(`h1`,{className:`text-balance text-3xl font-semibold tracking-tight text-foreground`,children:h.title}),h.description?(0,g.jsx)(`p`,{className:`max-w-3xl text-pretty text-muted-foreground`,children:h.description}):null]}),(0,g.jsx)(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:e})]}),(0,g.jsxs)(`nav`,{"data-docs-region":`pager`,"aria-label":`Document pager`,className:`flex flex-wrap items-center justify-between gap-3 border-t border-border/60 pt-6 text-sm`,children:[A.previous?(0,g.jsxs)(R,{href:A.previous.href,className:`text-muted-foreground`,children:[`Previous: `,A.previous.title]}):(0,g.jsx)(`span`,{}),A.next?(0,g.jsxs)(R,{href:A.next.href,className:`text-muted-foreground`,children:[`Next: `,A.next.title]}):null]})]}),(0,g.jsx)(l.DefaultDocsToc,{headings:N,...P})]}),(0,g.jsx)(z,{description:f.getFooterDescription(y,h),homeHref:F,LinkComponent:R,navigation:j,siteTitle:f.getSiteTitle(y)})]})};exports.DefaultDocsShell=C;
@@ -1,6 +1,6 @@
1
1
 
2
- import { DocsConfig, NormalizedDocsConfig } from "../../config/types.mjs";
3
2
  import { DocEntry, DocsSource } from "../../source/types.mjs";
3
+ import { DocsConfig, NormalizedDocsConfig } from "../../config/types.mjs";
4
4
  import React from "react";
5
5
  import { HeadingItem } from "@blackwork/machine";
6
6
 
@@ -1,6 +1,6 @@
1
1
 
2
- import { DocsConfig, NormalizedDocsConfig } from "../../config/types.js";
3
2
  import { DocEntry, DocsSource } from "../../source/types.js";
3
+ import { DocsConfig, NormalizedDocsConfig } from "../../config/types.js";
4
4
  import React from "react";
5
5
  import { HeadingItem } from "@blackwork/machine";
6
6
 
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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{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};
9
+ import{defineConfig as e}from"../../config/define-config.mjs";import{buildLocaleLinks as t}from"../../navigation/build-locale-links.mjs";import{flattenResolvedSidebarItems as n,resolveSidebar as r}from"../../navigation/resolve-sidebar.mjs";import{buildPager as i}from"../../navigation/build-pager.mjs";import{buildSidebar as a}from"../../navigation/build-sidebar.mjs";import{DefaultDocsLink as o}from"./link.mjs";import{DefaultDocsFooter as s}from"./footer.mjs";import{DefaultDocsHeader as c}from"./header.mjs";import{DefaultDocsToc as l,MobileDocsToc as u}from"./docs-toc.mjs";import{resolveThemeSlots as d}from"../slots.mjs";import{DocsScrollToTop as f}from"./docs-scroll-to-top.mjs";import{getEntrySectionConfig as p,getEntrySectionKey as m,getFooterDescription as h,getPagefindFilterEntries as g,getPagefindFilters as _,getSectionEntries as v,getSiteTitle as y,getTocHeadings as b,getTocLabels as x,toNavigation as S}from"./shell-shared.mjs";import{DocsRailScroll as C}from"./docs-rail-scroll.mjs";import{Button as w,Sheet as T,SheetContent as E,SheetHeader as D,SheetTitle as O,SheetTrigger as k}from"blackwork";import"react";import{Fragment as A,jsx as j,jsxs as M}from"react/jsx-runtime";import{Menu as N}from"blackwork/icons";const P=e=>[`block rounded-md py-1.5 pr-3 text-sm transition-colors`,e?`bg-accent font-medium text-accent-foreground`:`text-muted-foreground hover:text-foreground`].join(` `),F=e=>e.isExternal||e.slugSegments.length>0,I=e=>e.flatMap(e=>{if(e.type===`group`){let t=e.items.filter(F);return t.length===0?[]:[{...e,items:t}]}return F(e)?[e]:[]}),L=({LinkComponent:e,nodes:t})=>j(`nav`,{"aria-label":`Documentation pages`,className:`flex flex-col gap-1`,children:t.map(t=>t.type===`group`?M(`div`,{className:`flex flex-col gap-1 pt-4 first:pt-0`,children:[j(`p`,{className:`px-3 text-xs font-medium uppercase tracking-[0.08em] text-muted-foreground/80`,children:t.title}),t.items.map(t=>j(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:P(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))]},t.title):j(e,{href:t.href,"aria-current":t.isActive?`page`:void 0,"data-current-page":t.isActive?`true`:void 0,className:P(t.isActive),style:{paddingLeft:`${.75+t.depth*.75}rem`},children:t.title},t.href))}),R=({currentTitle:e,LinkComponent:t,nodes:n})=>n.length===0?null:j(`div`,{className:`lg:hidden`,children:M(T,{children:[j(k,{asChild:!0,children:M(w,{type:`button`,variant:`outline`,"aria-label":`Open section navigation`,className:`h-auto w-full justify-start gap-3 rounded-lg px-4 py-3`,children:[j(N,{className:`size-4 shrink-0`,"aria-hidden":`true`}),M(`span`,{className:`flex min-w-0 flex-1 flex-col items-start text-left`,children:[j(`span`,{className:`text-xs text-muted-foreground`,children:`Sections`}),j(`span`,{className:`truncate text-sm font-medium text-foreground`,children:e})]})]})}),M(E,{side:`left`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[j(D,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:j(O,{children:`Sections`})}),j(`div`,{className:`min-h-0 flex-1 overflow-auto px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:j(L,{LinkComponent:t,nodes:n})})]})]})}),z=({children:w,config:T,entry:E,headings:D=[],source:O})=>{let k=e(T),N=O.getEntries(E.locale),P=m(E),F=p(k,E),z=Array.isArray(F.sidebar),B=v(N,E),V=r({config:k,entries:N,currentHref:E.href,sectionKey:P}),H=I(V),U=i({entries:B,currentHref:E.href,...z?{sidebar:V}:{}}),W=S(E,z?n(V):a({entries:N,currentHref:E.href})),G=t({config:k,entry:E,source:O}),K=b(D),q=x(k,E.locale),J=O.getCanonicalHref(E.locale,[]),Y=d(k.slots),X=Y.headerActions,Z=Y.link??o,Q=Y.footer??s,$=g(_({layout:F.layout,locale:E.locale,section:P}));return M(A,{children:[j(c,{headerActions:X?j(X,{homeHref:J,localeLinks:G,navigation:W,siteDescription:k.site.description,siteTitle:y(k)}):void 0,homeHref:J,LinkComponent:Z,localeLinks:G,navigation:W,siteDescription:k.site.description,siteTitle:y(k)}),j(f,{}),j(u,{headings:K,...q}),M(`main`,{"data-docs-region":`docs-shell`,className:`mx-auto flex w-full max-w-screen-2xl flex-col gap-6 px-6 py-8 sm:gap-8 sm:px-8 lg:flex-row lg:gap-14 xl:gap-20 xl:px-10 2xl:gap-24 2xl:px-12`,children:[j(R,{currentTitle:E.title,LinkComponent:Z,nodes:H}),j(`aside`,{"data-docs-region":`sidebar`,className:`hidden w-full shrink-0 lg:block lg:w-72 lg:self-start lg:sticky lg:top-24`,children:j(C,{children:j(L,{LinkComponent:Z,nodes:H})})}),M(`div`,{className:`flex min-w-0 flex-1 flex-col gap-10`,children:[M(`div`,{"data-docs-region":`article-content`,"data-pagefind-body":``,className:`flex flex-col gap-10`,children:[j(`div`,{hidden:!0,children:$.map(e=>j(`span`,{"data-pagefind-filter":e},e))}),M(`header`,{"data-docs-region":`article-header`,className:`flex flex-col gap-3 border-b border-border/60 pb-6`,children:[j(`h1`,{className:`text-balance text-3xl font-semibold tracking-tight text-foreground`,children:E.title}),E.description?j(`p`,{className:`max-w-3xl text-pretty text-muted-foreground`,children:E.description}):null]}),j(`article`,{"data-docs-region":`article-body`,className:`prose prose-neutral max-w-none dark:prose-invert`,children:w})]}),M(`nav`,{"data-docs-region":`pager`,"aria-label":`Document pager`,className:`flex flex-wrap items-center justify-between gap-3 border-t border-border/60 pt-6 text-sm`,children:[U.previous?M(Z,{href:U.previous.href,className:`text-muted-foreground`,children:[`Previous: `,U.previous.title]}):j(`span`,{}),U.next?M(Z,{href:U.next.href,className:`text-muted-foreground`,children:[`Next: `,U.next.title]}):null]})]}),j(l,{headings:K,...q})]}),j(Q,{description:h(k,E),homeHref:J,LinkComponent:Z,navigation:W,siteTitle:y(k)})]})};export{z as DefaultDocsShell};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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.2.0
3
+ * version: v0.4.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(`./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;
9
+ "use client";const e=require(`../../_virtual/_rolldown/runtime.cjs`),t=require(`./docs-toc-geometry.cjs`),n=require(`./floating-actions.cjs`);let r=require(`blackwork`),i=require(`react`);i=e.__toESM(i);let a=require(`react/jsx-runtime`),o=require(`blackwork/icons`);const s=`On This Page`,c=()=>[`relative block py-1.5 pr-3 text-sm text-muted-foreground transition-colors`,`hover:text-foreground data-[active=true]:text-primary`].join(` `),l=(e,t)=>({height:`${e?.height??1}px`,transform:`translateY(${-t}px)`,width:`${e?.width??1}px`}),u=e=>{let t=e?.top??0,n=e?.bottom??0;return{clipPath:`polygon(0 ${t}px, 100% ${t}px, 100% ${n}px, 0 ${n}px)`,opacity:+!!e}},d=(e,t)=>({offsetDistance:`${t?.offsetDistance??0}px`,offsetPath:`path("${e?.path||`M0 0 L0 0`}")`,opacity:+!!t}),f=e=>e.filter(e=>e.active).sort((e,t)=>e.t-t.t).map(e=>e.id),p=(e,t)=>{let n=null,r=1/0;for(let i of e){let e=document.getElementById(i.id);if(!e)continue;let a=Math.abs(e.getBoundingClientRect().top-t);a<r&&(r=a,n=i.id)}return n},m=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},h=({itemBottom:e,itemTop:t,margin:n,scrollHeight:r,scrollTop:i,viewportHeight:a})=>{let o=i+n,s=i+a-n,c=Math.max(0,r-a);return t<o?Math.max(0,t-n):e>s?Math.min(c,e-a+n):i},g=(e,t)=>{let n=new Map(Array.from(e.querySelectorAll(`a[data-heading-id]`)).map(e=>[e.dataset.headingId??``,e]));return t.flatMap(e=>{let t=n.get(e.id);if(!t)return[];let r=getComputedStyle(t);return[{bottom:t.offsetTop+t.clientHeight-m(r.paddingBottom),depth:e.depth,id:e.id,top:t.offsetTop+m(r.paddingTop)}]})},_=(e,t)=>{if(t.length===0||e.length===0)return[];try{let n=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);n.setAttribute(`d`,t);let r=[],i=n.getTotalLength();return e.forEach((t,a)=>{let o=a>0?r[a-1][1]+(t.top-e[a-1].bottom):t.top;for(;o<i&&n.getPointAtLength(o).y<t.top;)o+=1;r.push([o,o+(t.bottom-t.top)])}),r}catch{return e.map(e=>[e.top,e.bottom])}},v=(e,t)=>{if(!e||!t)return e===t;if(e.height!==t.height||e.path!==t.path||e.width!==t.width||e.positions.length!==t.positions.length||e.itemLineLengths.length!==t.itemLineLengths.length)return!1;for(let n=0;n<e.positions.length;n+=1){let r=e.positions[n],i=t.positions[n];if(r.bottom!==i.bottom||r.depth!==i.depth||r.id!==i.id||r.top!==i.top||r.x!==i.x)return!1}for(let n=0;n<e.itemLineLengths.length;n+=1){let r=e.itemLineLengths[n],i=t.itemLineLengths[n];if(r[0]!==i[0]||r[1]!==i[1])return!1}return!0},y=(e,t)=>!e||!t?e===t:e.bottom===t.bottom&&e.offsetDistance===t.offsetDistance&&e.top===t.top,b=e=>{let t=C(e),[n,r,a]=w(t,e),o=(0,i.useMemo)(()=>new Set(t),[t]),s=(0,i.useId)(),[c,l]=(0,i.useState)(0);return{activeIds:t,activeIdSet:o,listId:s,listRef:n,measurement:r,scrollTop:c,setScrollTop:l,track:a}},x=({activeIds:e,activeIdSet:n,headings:o,listClassName:s,listId:f,listRef:p,measurement:m,onSelect:g,scrollTop:_,setScrollTop:v,track:y,wrapperClassName:b})=>((0,i.useEffect)(()=>{let t=p.current,n=e[0];if(!t||!n)return;let r=Array.from(t.querySelectorAll(`a[data-heading-id]`)).find(e=>e.dataset.headingId===n);if(!r)return;let i=h({itemBottom:r.offsetTop+r.offsetHeight,itemTop:r.offsetTop,margin:16,scrollHeight:t.scrollHeight,scrollTop:t.scrollTop,viewportHeight:t.clientHeight});i!==t.scrollTop&&t.scrollTo({top:i})},[e,p]),(0,a.jsxs)(`div`,{className:(0,r.cn)(`relative`,b),children:[(0,a.jsxs)(`div`,{"aria-hidden":`true`,"data-docs-toc-track":`true`,className:`pointer-events-none absolute left-0 top-0 transition-transform duration-150 ease-out`,style:l(m,_),children:[(0,a.jsx)(`svg`,{"data-docs-toc-track-path":`true`,height:m?.height??1,viewBox:`0 0 ${m?.width??1} ${m?.height??1}`,width:m?.width??1,className:`absolute left-0 top-0 transition-[clip-path,opacity] duration-150 ease-out`,style:u(y),children:(0,a.jsx)(`path`,{d:m?.path||`M0 0 L0 0`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-primary`})}),(0,a.jsx)(`span`,{"data-docs-toc-thumb":`true`,className:`absolute left-0 top-0 size-1 rounded-full bg-primary transition-[opacity,offset-distance] duration-150 ease-out`,style:d(m,y)})]}),(0,a.jsx)(`ol`,{id:f,ref:p,className:(0,r.cn)(`flex flex-col overflow-auto py-1 [scrollbar-width:none]`,s),onScroll:e=>{v(e.currentTarget.scrollTop)},children:o.map((e,r)=>{let i=n.has(e.id),s=t.getTocGuideOffset(e.depth),l=r>0?t.getTocGuideOffset(o[r-1].depth):s,u=r+1<o.length?t.getTocGuideOffset(o[r+1].depth):s;return(0,a.jsx)(`li`,{children:(0,a.jsxs)(`a`,{href:`#${e.id}`,"data-active":i?`true`:`false`,"data-depth":e.depth,"data-heading-id":e.id,className:c(),style:{paddingInlineStart:`${t.getTocItemPadding(e.depth)}px`},onClick:g,children:[s===l?null:(0,a.jsx)(`svg`,{"aria-hidden":`true`,"data-docs-toc-item-curve":`true`,viewBox:`${Math.min(s,l)} 0 ${Math.abs(l-s)} 12`,className:`pointer-events-none absolute`,style:{height:`12px`,insetInlineStart:`${Math.min(s,l)}px`,top:`-6px`,width:`${Math.abs(l-s)+1}px`,zIndex:-1},children:(0,a.jsx)(`path`,{d:`M ${l} 0 C ${l} 8 ${s} 4 ${s} 12`,stroke:`currentColor`,strokeWidth:`1`,fill:`none`,className:`text-border`})}),(0,a.jsx)(`span`,{"aria-hidden":`true`,"data-docs-toc-item-line":`true`,className:`pointer-events-none absolute w-px bg-border`,style:{bottom:s===u?`0px`:`6px`,insetInlineStart:`${s}px`,top:s===l?`0px`:`6px`,zIndex:-1}}),e.title]})},e.id)})})]})),S=(e,t,n)=>{let r=new Set(e),i=t.positions.findIndex(e=>r.has(e.id));if(i===-1)return[null,null];let a=i;t.positions.forEach((e,t)=>{r.has(e.id)&&(a=t)});let o=n?n.startIdx>i||n.endIdx>a||n.startIdx===i&&n.endIdx===a&&n.isUp:!1,s=t.itemLineLengths[i]?.[0]??t.positions[i].top,c=t.itemLineLengths[a]?.[1]??t.positions[a].bottom;return[{bottom:t.positions[a].bottom,offsetDistance:o?s:c,top:t.positions[i].top},{endIdx:a,isUp:o,startIdx:i}]};function C(e){let[t,n]=(0,i.useState)([]);return(0,i.useEffect)(()=>{if(e.length===0||typeof document>`u`||typeof IntersectionObserver>`u`)return;let t=new Map(e.map(e=>[e.id,{active:!1,fallback:!1,id:e.id,t:0}])),r=(e=0)=>{for(let e of t.values())e.fallback&&(e.active=!1,e.fallback=!1);let r=f([...t.values()]);if(r.length===0){let n=p([...t.values()],e),i=n?t.get(n):void 0;i&&(i.active=!0,i.fallback=!0,i.t=Date.now(),r=[i.id])}n(r)},i=new IntersectionObserver(e=>{let n=Date.now();for(let r of e){let e=t.get(r.target.id);e&&(e.active!==r.isIntersecting||e.fallback)&&(e.active=r.isIntersecting,e.fallback=!1,e.t=n)}r(e[0]?.rootBounds?.top??0)},{threshold:.9});return e.forEach(e=>{let t=document.getElementById(e.id);t&&i.observe(t)}),r(),()=>{i.disconnect()}},[e]),t}function w(e,n){let r=(0,i.useRef)(null),[a,o]=(0,i.useState)(null),[s,c]=(0,i.useState)(null),l=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=r.current;if(!e)return;let i=0,a=()=>{cancelAnimationFrame(i),i=requestAnimationFrame(()=>{let r=t.buildTocTrackGeometry(g(e,n)),i={...r,itemLineLengths:_(r.positions,r.path)};o(e=>v(e,i)?e:i)})},s=typeof ResizeObserver>`u`?null:new ResizeObserver(a);return s?.observe(e),window.addEventListener(`resize`,a),a(),()=>{cancelAnimationFrame(i),s?.disconnect(),window.removeEventListener(`resize`,a)}},[n]),(0,i.useEffect)(()=>{let t=0;return t=requestAnimationFrame(()=>{if(!a||e.length===0){l.current=null,c(e=>e===null?e:null);return}let[t,n]=S(e,a,l.current);l.current=n,c(e=>y(e,t)?e:t)}),()=>{cancelAnimationFrame(t)}},[e,a]),[r,a,s]}const T=({className:e,collapseDirection:t=`left`,collapseLabel:n=`Collapse outline`,collapseEnabled:c=!1,defaultCollapsed:l=!1,dock:u=`sticky`,expandLabel:d=`Expand outline`,headings:f,minHeadings:p=1,title:m=s})=>{let h=b(f),[g,_]=(0,i.useState)(l),v=g?d:n,y=t===`right`?`right-0`:`left-0`,S=c?t===`right`?`pr-10`:`pl-10`:void 0;return f.length<p?null:(0,a.jsx)(`aside`,{"data-docs-region":`toc`,"data-docs-toc-collapsible":c?`true`:void 0,"data-docs-toc-collapsed":c?String(g):void 0,className:(0,r.cn)(`hidden w-64 xl:block`,u===`sticky`?`shrink-0 xl:self-start xl:sticky xl:top-24`:`xl:fixed xl:top-24`,e),children:(0,a.jsxs)(`nav`,{"aria-label":m,className:(0,r.cn)(`relative flex w-64 flex-col text-sm`,t===`right`?`ml-auto`:void 0),children:[(0,a.jsxs)(`div`,{inert:c&&g?!0:void 0,"aria-hidden":c&&g?!0:void 0,className:(0,r.cn)(`flex w-64 flex-col gap-3 overflow-hidden transition-opacity duration-200 ease-out motion-reduce:transition-none`,c&&g?`pointer-events-none opacity-0`:`opacity-100`),children:[(0,a.jsx)(`p`,{className:(0,r.cn)(`font-medium text-foreground`,S),children:m}),(0,a.jsx)(x,{...h,headings:f,listClassName:`max-h-[calc(100dvh-8rem)]`})]}),c?(0,a.jsxs)(r.Button,{type:`button`,variant:`ghost`,size:`icon`,"data-docs-toc-toggle":`true`,"aria-controls":h.listId,"aria-label":v,"aria-expanded":!g,title:v,className:(0,r.cn)(y,`absolute top-0 z-10 shrink-0 text-muted-foreground transition-opacity duration-200 ease-out hover:text-foreground hover:opacity-100 motion-reduce:transition-none`,g?`opacity-100`:`opacity-60`),onClick:()=>{_(e=>!e)},children:[(0,a.jsx)(o.Toc,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`sr-only`,children:v})]}):null]})})},E=({className:e,headings:t,minHeadings:c=1,openLabel:l=`Open outline`,title:u=s})=>{let d=b(t),[f,p]=(0,i.useState)(!1);return t.length<c?null:(0,a.jsx)(`div`,{className:(0,r.cn)(`xl:hidden`,e),children:(0,a.jsxs)(r.Sheet,{open:f,onOpenChange:p,children:[(0,a.jsx)(r.SheetTrigger,{asChild:!0,children:(0,a.jsxs)(r.Button,{type:`button`,variant:`outline`,size:`icon`,title:l,"aria-label":l,"data-docs-toc-mobile-trigger":`true`,className:`fixed border border-input bg-background shadow-sm`,style:n.getDocsFloatingActionStyle(1),children:[(0,a.jsx)(o.Toc,{className:`size-4`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`sr-only`,children:l})]})}),(0,a.jsxs)(r.SheetContent,{side:`right`,className:`flex h-dvh flex-col gap-0 p-0 sm:max-w-sm`,children:[(0,a.jsx)(r.SheetHeader,{className:`border-b border-border/60 px-6 pb-4 pt-[calc(env(safe-area-inset-top)+1.5rem)] text-left`,children:(0,a.jsx)(r.SheetTitle,{children:u})}),(0,a.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden px-6 pb-[calc(env(safe-area-inset-bottom)+1.5rem)] pt-4`,children:(0,a.jsx)(x,{...d,headings:t,listClassName:`min-h-0 flex-1`,wrapperClassName:`min-h-0 flex-1`,onSelect:()=>{p(!1)}})})]})]})})};exports.DefaultDocsToc=T,exports.MobileDocsToc=E;
@@ -0,0 +1,32 @@
1
+
2
+ import React from "react";
3
+
4
+ //#region src/theme/components/docs-toc.d.ts
5
+ interface DocsTocHeading {
6
+ depth: number;
7
+ id: string;
8
+ title: string;
9
+ }
10
+ interface DefaultDocsTocProps {
11
+ className?: string;
12
+ collapseDirection?: 'left' | 'right';
13
+ collapseLabel?: string;
14
+ collapseEnabled?: boolean;
15
+ defaultCollapsed?: boolean;
16
+ dock?: 'fixed' | 'sticky';
17
+ expandLabel?: string;
18
+ headings: DocsTocHeading[];
19
+ minHeadings?: number;
20
+ title?: string;
21
+ }
22
+ interface MobileDocsTocProps {
23
+ className?: string;
24
+ headings: DocsTocHeading[];
25
+ minHeadings?: number;
26
+ openLabel?: string;
27
+ title?: string;
28
+ }
29
+ declare const DefaultDocsToc: React.FC<DefaultDocsTocProps>;
30
+ declare const MobileDocsToc: React.FC<MobileDocsTocProps>;
31
+ //#endregion
32
+ export { DefaultDocsToc, DefaultDocsTocProps, DocsTocHeading, MobileDocsToc, MobileDocsTocProps };