@blackwork/docs 0.4.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/README.md +55 -25
  2. package/dist/_virtual/_rolldown/runtime.cjs +1 -1
  3. package/dist/config/defaults.cjs +1 -1
  4. package/dist/config/defaults.mjs +1 -1
  5. package/dist/config/define-config.cjs +2 -2
  6. package/dist/config/define-config.mjs +2 -2
  7. package/dist/config/define-docs-config.cjs +1 -1
  8. package/dist/config/define-docs-config.mjs +1 -1
  9. package/dist/config/load-content-config.cjs +2 -2
  10. package/dist/config/load-content-config.mjs +2 -2
  11. package/dist/config/types.d.mts +34 -3
  12. package/dist/config/types.d.ts +34 -3
  13. package/dist/export/process-exported-docs.cjs +1 -1
  14. package/dist/export/process-exported-docs.mjs +1 -1
  15. package/dist/index.cjs +2 -2
  16. package/dist/index.d.mts +3 -2
  17. package/dist/index.d.ts +3 -2
  18. package/dist/index.mjs +2 -2
  19. package/dist/mdx/default-docs-components.cjs +3 -2
  20. package/dist/mdx/default-docs-components.mjs +3 -2
  21. package/dist/mdx/merge-docs-components.cjs +1 -1
  22. package/dist/mdx/merge-docs-components.mjs +1 -1
  23. package/dist/metadata/create-doc-metadata.cjs +1 -1
  24. package/dist/metadata/create-doc-metadata.mjs +1 -1
  25. package/dist/navigation/build-header-nav.cjs +9 -0
  26. package/dist/navigation/build-header-nav.d.mts +20 -0
  27. package/dist/navigation/build-header-nav.d.ts +20 -0
  28. package/dist/navigation/build-header-nav.mjs +9 -0
  29. package/dist/navigation/build-locale-links.cjs +1 -1
  30. package/dist/navigation/build-locale-links.mjs +1 -1
  31. package/dist/navigation/build-pager.cjs +1 -1
  32. package/dist/navigation/build-pager.mjs +1 -1
  33. package/dist/navigation/build-sidebar.cjs +1 -1
  34. package/dist/navigation/build-sidebar.mjs +1 -1
  35. package/dist/navigation/resolve-sidebar.cjs +1 -1
  36. package/dist/navigation/resolve-sidebar.mjs +1 -1
  37. package/dist/next/context.cjs +1 -1
  38. package/dist/next/context.mjs +1 -1
  39. package/dist/next/document-lang-sync.cjs +1 -1
  40. package/dist/next/document-lang-sync.mjs +1 -1
  41. package/dist/next/load-doc-content.cjs +2 -2
  42. package/dist/next/load-doc-content.mjs +2 -2
  43. package/dist/next/load-generated-manifest.cjs +1 -1
  44. package/dist/next/load-generated-manifest.mjs +1 -1
  45. package/dist/next/metadata.cjs +1 -1
  46. package/dist/next/metadata.mjs +1 -1
  47. package/dist/next/page.cjs +1 -1
  48. package/dist/next/page.mjs +1 -1
  49. package/dist/next/render-route.cjs +2 -2
  50. package/dist/next/render-route.mjs +2 -2
  51. package/dist/next/resolve-document-lang.cjs +1 -1
  52. package/dist/next/resolve-document-lang.mjs +1 -1
  53. package/dist/next/root-layout.cjs +2 -2
  54. package/dist/next/root-layout.d.mts +2 -2
  55. package/dist/next/root-layout.d.ts +2 -2
  56. package/dist/next/root-layout.mjs +2 -2
  57. package/dist/next-plugin/generate.cjs +1 -1
  58. package/dist/next-plugin/generate.mjs +1 -1
  59. package/dist/next.cjs +1 -1
  60. package/dist/next.mjs +1 -1
  61. package/dist/routing/build-static-params.cjs +1 -1
  62. package/dist/routing/build-static-params.mjs +1 -1
  63. package/dist/routing/resolve-docs-route.cjs +1 -1
  64. package/dist/routing/resolve-docs-route.mjs +1 -1
  65. package/dist/runtime.cjs +1 -1
  66. package/dist/runtime.mjs +1 -1
  67. package/dist/source/build-docs-source.cjs +1 -1
  68. package/dist/source/build-docs-source.mjs +1 -1
  69. package/dist/source/collect-docs-manifest.cjs +1 -1
  70. package/dist/source/collect-docs-manifest.mjs +1 -1
  71. package/dist/source/create-docs-source-from-manifest.cjs +1 -1
  72. package/dist/source/create-docs-source-from-manifest.mjs +1 -1
  73. package/dist/source/create-docs-source.cjs +1 -1
  74. package/dist/source/create-docs-source.mjs +1 -1
  75. package/dist/tailwind.css +2 -0
  76. package/dist/theme/components/content-layout.cjs +1 -1
  77. package/dist/theme/components/content-layout.mjs +1 -1
  78. package/dist/theme/components/content-shell.cjs +2 -2
  79. package/dist/theme/components/content-shell.mjs +2 -2
  80. package/dist/theme/components/docs-rail-scroll-state.cjs +1 -1
  81. package/dist/theme/components/docs-rail-scroll-state.mjs +1 -1
  82. package/dist/theme/components/docs-rail-scroll.cjs +1 -1
  83. package/dist/theme/components/docs-rail-scroll.mjs +1 -1
  84. package/dist/theme/components/docs-scroll-reset.cjs +1 -1
  85. package/dist/theme/components/docs-scroll-reset.mjs +1 -1
  86. package/dist/theme/components/docs-scroll-to-top.cjs +2 -2
  87. package/dist/theme/components/docs-scroll-to-top.mjs +2 -2
  88. package/dist/theme/components/docs-shell.cjs +2 -2
  89. package/dist/theme/components/docs-shell.mjs +2 -2
  90. package/dist/theme/components/docs-toc-geometry.cjs +1 -1
  91. package/dist/theme/components/docs-toc-geometry.mjs +1 -1
  92. package/dist/theme/components/docs-toc.cjs +2 -2
  93. package/dist/theme/components/docs-toc.mjs +2 -2
  94. package/dist/theme/components/floating-actions.cjs +1 -1
  95. package/dist/theme/components/floating-actions.mjs +1 -1
  96. package/dist/theme/components/footer.cjs +2 -2
  97. package/dist/theme/components/footer.mjs +2 -2
  98. package/dist/theme/components/header.cjs +2 -2
  99. package/dist/theme/components/header.d.mts +5 -0
  100. package/dist/theme/components/header.d.ts +5 -0
  101. package/dist/theme/components/header.mjs +2 -2
  102. package/dist/theme/components/home-shell.cjs +2 -2
  103. package/dist/theme/components/home-shell.mjs +2 -2
  104. package/dist/theme/components/link.cjs +1 -1
  105. package/dist/theme/components/link.mjs +1 -1
  106. package/dist/theme/components/shell-shared.cjs +2 -2
  107. package/dist/theme/components/shell-shared.d.mts +22 -0
  108. package/dist/theme/components/shell-shared.d.ts +22 -0
  109. package/dist/theme/components/shell-shared.mjs +2 -2
  110. package/dist/theme/create-home-data.cjs +2 -2
  111. package/dist/theme/create-home-data.mjs +2 -2
  112. package/dist/theme/slots.cjs +2 -2
  113. package/dist/theme/slots.mjs +2 -2
  114. package/dist/theme/types.d.mts +33 -9
  115. package/dist/theme/types.d.ts +33 -9
  116. package/dist/theme.cjs +2 -2
  117. package/dist/theme.d.mts +3 -3
  118. package/dist/theme.d.ts +3 -3
  119. package/dist/theme.mjs +2 -2
  120. package/package.json +15 -9
package/README.md CHANGED
@@ -204,6 +204,61 @@ export const docsConfig = defineDocsConfig({
204
204
  })
205
205
  ```
206
206
 
207
+ Home content and shared shell labels accept either one string or a locale map:
208
+
209
+ ```ts
210
+ export const docsConfig = defineDocsConfig({
211
+ home: {
212
+ badge: {
213
+ alt: {
214
+ en: 'Latest package version',
215
+ zh: '最新包版本',
216
+ },
217
+ href: 'https://www.npmjs.com/package/example',
218
+ src: 'https://img.shields.io/npm/v/example?label=npm',
219
+ },
220
+ description: {
221
+ en: 'Documentation for the project.',
222
+ zh: '项目文档。',
223
+ },
224
+ primaryAction: {
225
+ href: '/guide/getting-started',
226
+ label: { en: 'Getting Started', zh: '快速开始' },
227
+ },
228
+ },
229
+ theme: {
230
+ socialLinks: [
231
+ {
232
+ type: 'github',
233
+ link: 'https://github.com/example/project',
234
+ label: 'GitHub',
235
+ ariaLabel: {
236
+ en: 'Source code on GitHub',
237
+ zh: '在 GitHub 查看源码',
238
+ },
239
+ },
240
+ ],
241
+ labels: {
242
+ next: { en: 'Next', zh: '下一页' },
243
+ previous: { en: 'Previous', zh: '上一页' },
244
+ scrollToTop: { en: 'Scroll to top', zh: '回到顶部' },
245
+ },
246
+ toc: {
247
+ title: { en: 'On This Page', zh: '本页内容' },
248
+ },
249
+ },
250
+ })
251
+ ```
252
+
253
+ The home badge can be localized text or a badge image with localized alt text
254
+ and an optional link. Internal home action and highlight links are localized to
255
+ the matching document route automatically. Add every configured locale to each
256
+ text map so the shell does not need to fall back to English.
257
+
258
+ `theme.socialLinks` controls the shared header social icons. The default theme
259
+ renders these links before the language and theme controls, with the same
260
+ separator and spacing used by the shared `LayoutHeader` component.
261
+
207
262
  ## Next.js Entry Files
208
263
 
209
264
  `next.config.ts`
@@ -303,31 +358,6 @@ export default function DocsRoutePage({
303
358
 
304
359
  ## Tailwind Setup
305
360
 
306
- ### Tailwind CSS v3
307
-
308
- If your app uses Tailwind CSS, include both `blackwork` and `@blackwork/docs` build output in the content scan:
309
-
310
- ```ts
311
- import typography from '@tailwindcss/typography'
312
- import { theme } from 'blackwork/tailwind-config'
313
- import animate from 'tailwindcss-animate'
314
- import type { Config } from 'tailwindcss'
315
-
316
- export default {
317
- darkMode: 'selector',
318
- content: [
319
- './src/**/*.{js,mjs,cjs,ts,jsx,tsx,mdx}',
320
- './contents/**/*.{md,mdx}',
321
- './node_modules/blackwork/dist/**/*.{js,mjs,cjs}',
322
- './node_modules/@blackwork/docs/dist/**/*.{js,mjs,cjs}',
323
- ],
324
- theme,
325
- plugins: [typography, animate],
326
- } satisfies Config
327
- ```
328
-
329
- ### Tailwind CSS v4
330
-
331
361
  Import the Blackwork and docs package Tailwind entries explicitly:
332
362
 
333
363
  ```css
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- const e=require(`./defaults.cjs`),t=(e={})=>{let t=e.layout??`docs`;return{layout:t,sidebar:e.sidebar??(t===`content`?!1:`auto`)}},n=e=>{if(e)return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]))};function r(t={}){return{root:t.root??e.defaultDocsConfig.content.root,enableDefaultLocaleRedirect:t.enableDefaultLocaleRedirect??e.defaultDocsConfig.content.enableDefaultLocaleRedirect,...t.defaultLocale===void 0?{}:{defaultLocale:t.defaultLocale},...t.locales===void 0?{}:{locales:t.locales},...t.sections===void 0?{}:{sections:n(t.sections)}}}function i(t={}){return{site:{...e.defaultDocsConfig.site,...t.site},content:r(t.content),theme:{...e.defaultDocsConfig.theme,...t.theme},docs:{...e.defaultDocsConfig.docs,...t.docs},home:{...e.defaultDocsConfig.home,...t.home},mdx:{...e.defaultDocsConfig.mdx,...t.mdx},slots:{...e.defaultDocsConfig.slots,...t.slots}}}exports.defineConfig=i;
9
+ const e=require(`./defaults.cjs`),t=(e={})=>{let t=e.layout??`docs`;return{layout:t,sidebar:e.sidebar??(t===`content`?!1:`auto`),...e.label===void 0?{}:{label:e.label}}},n=e=>{if(e)return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]))};function r(t={}){return{root:t.root??e.defaultDocsConfig.content.root,enableDefaultLocaleRedirect:t.enableDefaultLocaleRedirect??e.defaultDocsConfig.content.enableDefaultLocaleRedirect,...t.defaultLocale===void 0?{}:{defaultLocale:t.defaultLocale},...t.locales===void 0?{}:{locales:t.locales},...t.sections===void 0?{}:{sections:n(t.sections)}}}function i(t={}){return{site:{...e.defaultDocsConfig.site,...t.site},content:r(t.content),theme:{...e.defaultDocsConfig.theme,...t.theme},docs:{...e.defaultDocsConfig.docs,...t.docs},home:{...e.defaultDocsConfig.home,...t.home},mdx:{...e.defaultDocsConfig.mdx,...t.mdx},slots:{...e.defaultDocsConfig.slots,...t.slots}}}exports.defineConfig=i;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- import{defaultDocsConfig as e}from"./defaults.mjs";const t=(e={})=>{let t=e.layout??`docs`;return{layout:t,sidebar:e.sidebar??(t===`content`?!1:`auto`)}},n=e=>{if(e)return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]))};function r(t={}){return{root:t.root??e.content.root,enableDefaultLocaleRedirect:t.enableDefaultLocaleRedirect??e.content.enableDefaultLocaleRedirect,...t.defaultLocale===void 0?{}:{defaultLocale:t.defaultLocale},...t.locales===void 0?{}:{locales:t.locales},...t.sections===void 0?{}:{sections:n(t.sections)}}}function i(t={}){return{site:{...e.site,...t.site},content:r(t.content),theme:{...e.theme,...t.theme},docs:{...e.docs,...t.docs},home:{...e.home,...t.home},mdx:{...e.mdx,...t.mdx},slots:{...e.slots,...t.slots}}}export{i as defineConfig};
9
+ import{defaultDocsConfig as e}from"./defaults.mjs";const t=(e={})=>{let t=e.layout??`docs`;return{layout:t,sidebar:e.sidebar??(t===`content`?!1:`auto`),...e.label===void 0?{}:{label:e.label}}},n=e=>{if(e)return Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t(n)]))};function r(t={}){return{root:t.root??e.content.root,enableDefaultLocaleRedirect:t.enableDefaultLocaleRedirect??e.content.enableDefaultLocaleRedirect,...t.defaultLocale===void 0?{}:{defaultLocale:t.defaultLocale},...t.locales===void 0?{}:{locales:t.locales},...t.sections===void 0?{}:{sections:n(t.sections)}}}function i(t={}){return{site:{...e.site,...t.site},content:r(t.content),theme:{...e.theme,...t.theme},docs:{...e.docs,...t.docs},home:{...e.home,...t.home},mdx:{...e.mdx,...t.mdx},slots:{...e.slots,...t.slots}}}export{i as defineConfig};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`node:fs`),n=require(`node:path`),r=require(`jiti`);r=e.__toESM(r,1);const i=`content.config.ts`,a=e=>typeof e==`object`&&!!e&&!Array.isArray(e),o=({rootDir:e=process.cwd(),contentConfigPath:r=i}={})=>{let a=(0,n.resolve)(e,r);return(0,t.existsSync)(a)?a:void 0},s=({rootDir:e=process.cwd(),contentConfigPath:t=i}={})=>{let n=o({rootDir:e,contentConfigPath:t});if(!n)return;let s=(0,r.default)(require(`url`).pathToFileURL(__filename).href)(n),c=s?.docsContentConfig??s?.default;if(!a(c))throw TypeError(`[blackwork-docs] ${n} must export a docs content config object via "docsContentConfig" or default export.`);return c};exports.loadDocsContentConfig=s,exports.resolveDocsContentConfigPath=o;
9
+ const e=require(`../_virtual/_rolldown/runtime.cjs`);let t=require(`node:fs`),n=require(`node:path`),r=require(`jiti`);r=e.__toESM(r,1);const i=`content.config.ts`,a=e=>typeof e==`object`&&!!e&&!Array.isArray(e),o=({rootDir:e=process.cwd(),contentConfigPath:r=i}={})=>{let a=(0,n.resolve)(e,r);return(0,t.existsSync)(a)?a:void 0},s=({rootDir:e=process.cwd(),contentConfigPath:t=i}={})=>{let n=o({rootDir:e,contentConfigPath:t});if(!n)return;let s=(0,r.default)(require(`url`).pathToFileURL(__filename).href,{requireCache:!1})(n),c=s?.docsContentConfig??s?.default;if(!a(c))throw TypeError(`[blackwork-docs] ${n} must export a docs content config object via "docsContentConfig" or default export.`);return c};exports.loadDocsContentConfig=s,exports.resolveDocsContentConfigPath=o;
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- import{existsSync as e}from"node:fs";import{resolve as t}from"node:path";import n from"jiti";const r=`content.config.ts`,i=e=>typeof e==`object`&&!!e&&!Array.isArray(e),a=({rootDir:n=process.cwd(),contentConfigPath:i=r}={})=>{let a=t(n,i);return e(a)?a:void 0},o=({rootDir:e=process.cwd(),contentConfigPath:t=r}={})=>{let o=a({rootDir:e,contentConfigPath:t});if(!o)return;let s=n(import.meta.url)(o),c=s?.docsContentConfig??s?.default;if(!i(c))throw TypeError(`[blackwork-docs] ${o} must export a docs content config object via "docsContentConfig" or default export.`);return c};export{o as loadDocsContentConfig,a as resolveDocsContentConfigPath};
9
+ import{existsSync as e}from"node:fs";import{resolve as t}from"node:path";import n from"jiti";const r=`content.config.ts`,i=e=>typeof e==`object`&&!!e&&!Array.isArray(e),a=({rootDir:n=process.cwd(),contentConfigPath:i=r}={})=>{let a=t(n,i);return e(a)?a:void 0},o=({rootDir:e=process.cwd(),contentConfigPath:t=r}={})=>{let o=a({rootDir:e,contentConfigPath:t});if(!o)return;let s=n(import.meta.url,{requireCache:!1})(o),c=s?.docsContentConfig??s?.default;if(!i(c))throw TypeError(`[blackwork-docs] ${o} must export a docs content config object via "docsContentConfig" or default export.`);return c};export{o as loadDocsContentConfig,a as resolveDocsContentConfigPath};
@@ -1,5 +1,6 @@
1
1
 
2
- import { DocsHomeConfig as DocsHomeConfig$1, DocsSlotsConfig as DocsSlotsConfig$1 } from "../theme/types.mjs";
2
+ import { DocsHomeConfig as DocsHomeConfig$1, DocsSlotsConfig as DocsSlotsConfig$1, DocsThemeLocalizedText } from "../theme/types.mjs";
3
+ import { SocialLinkIconType } from "blackwork";
3
4
  import { ComponentMap } from "@blackwork/machine";
4
5
 
5
6
  //#region src/config/types.d.ts
@@ -27,9 +28,15 @@ interface DocsSidebarGroupConfig {
27
28
  }
28
29
  type DocsSidebarConfigNode = DocsSidebarGroupConfig | DocsSidebarItemConfig;
29
30
  type DocsSidebarMode = 'auto' | false | DocsSidebarConfigNode[];
31
+ interface DocsThemeNavItemConfig {
32
+ href: string;
33
+ label?: DocsSidebarLabel;
34
+ }
35
+ type DocsThemeNavConfig = DocsThemeNavItemConfig[] | false;
30
36
  interface DocsContentSectionConfig {
31
37
  layout?: DocsSectionLayout;
32
38
  sidebar?: DocsSidebarMode;
39
+ label?: DocsSidebarLabel;
33
40
  }
34
41
  interface DocsContentConfig {
35
42
  root?: string;
@@ -38,15 +45,38 @@ interface DocsContentConfig {
38
45
  locales?: Record<string, DocsLocaleDefinition>;
39
46
  sections?: Record<string, DocsContentSectionConfig>;
40
47
  }
41
- type DocsThemeLocalizedLabel = string | Record<string, string>;
48
+ type DocsThemeLocalizedLabel = DocsThemeLocalizedText;
49
+ interface DocsThemeLabelsConfig {
50
+ changeLanguage?: DocsThemeLocalizedLabel;
51
+ documentationPages?: DocsThemeLocalizedLabel;
52
+ documentPager?: DocsThemeLocalizedLabel;
53
+ next?: DocsThemeLocalizedLabel;
54
+ openSectionNavigation?: DocsThemeLocalizedLabel;
55
+ openSiteNavigation?: DocsThemeLocalizedLabel;
56
+ previous?: DocsThemeLocalizedLabel;
57
+ primaryNavigation?: DocsThemeLocalizedLabel;
58
+ scrollToTop?: DocsThemeLocalizedLabel;
59
+ sections?: DocsThemeLocalizedLabel;
60
+ toggleTheme?: DocsThemeLocalizedLabel;
61
+ }
42
62
  interface DocsThemeTocConfig {
43
63
  collapseLabel?: DocsThemeLocalizedLabel;
44
64
  expandLabel?: DocsThemeLocalizedLabel;
45
65
  openLabel?: DocsThemeLocalizedLabel;
46
66
  title?: DocsThemeLocalizedLabel;
47
67
  }
68
+ interface DocsThemeSocialLinkConfig {
69
+ type: SocialLinkIconType;
70
+ link: string;
71
+ label?: DocsThemeLocalizedLabel;
72
+ ariaLabel?: DocsThemeLocalizedLabel;
73
+ }
48
74
  interface DocsThemeConfig {
75
+ appearance?: 'default' | 'glass';
49
76
  [key: string]: unknown;
77
+ labels?: DocsThemeLabelsConfig;
78
+ nav?: DocsThemeNavConfig;
79
+ socialLinks?: DocsThemeSocialLinkConfig[] | false;
50
80
  toc?: DocsThemeTocConfig;
51
81
  }
52
82
  type DocsSectionConfig = Record<string, unknown>;
@@ -74,6 +104,7 @@ interface NormalizedDocsContentConfig {
74
104
  interface NormalizedDocsContentSectionConfig {
75
105
  layout: DocsSectionLayout;
76
106
  sidebar: DocsSidebarMode;
107
+ label?: DocsSidebarLabel;
77
108
  }
78
109
  interface NormalizedDocsConfig {
79
110
  site: DocsSiteConfig;
@@ -85,4 +116,4 @@ interface NormalizedDocsConfig {
85
116
  slots: DocsSlotsConfig;
86
117
  }
87
118
  //#endregion
88
- export { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig };
119
+ export { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, DocsThemeNavConfig, DocsThemeNavItemConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig };
@@ -1,6 +1,7 @@
1
1
 
2
- import { DocsHomeConfig as DocsHomeConfig$1, DocsSlotsConfig as DocsSlotsConfig$1 } from "../theme/types.js";
2
+ import { DocsHomeConfig as DocsHomeConfig$1, DocsSlotsConfig as DocsSlotsConfig$1, DocsThemeLocalizedText } from "../theme/types.js";
3
3
  import { ComponentMap } from "@blackwork/machine";
4
+ import { SocialLinkIconType } from "blackwork";
4
5
 
5
6
  //#region src/config/types.d.ts
6
7
  interface DocsLocaleDefinition {
@@ -27,9 +28,15 @@ interface DocsSidebarGroupConfig {
27
28
  }
28
29
  type DocsSidebarConfigNode = DocsSidebarGroupConfig | DocsSidebarItemConfig;
29
30
  type DocsSidebarMode = 'auto' | false | DocsSidebarConfigNode[];
31
+ interface DocsThemeNavItemConfig {
32
+ href: string;
33
+ label?: DocsSidebarLabel;
34
+ }
35
+ type DocsThemeNavConfig = DocsThemeNavItemConfig[] | false;
30
36
  interface DocsContentSectionConfig {
31
37
  layout?: DocsSectionLayout;
32
38
  sidebar?: DocsSidebarMode;
39
+ label?: DocsSidebarLabel;
33
40
  }
34
41
  interface DocsContentConfig {
35
42
  root?: string;
@@ -38,15 +45,38 @@ interface DocsContentConfig {
38
45
  locales?: Record<string, DocsLocaleDefinition>;
39
46
  sections?: Record<string, DocsContentSectionConfig>;
40
47
  }
41
- type DocsThemeLocalizedLabel = string | Record<string, string>;
48
+ type DocsThemeLocalizedLabel = DocsThemeLocalizedText;
49
+ interface DocsThemeLabelsConfig {
50
+ changeLanguage?: DocsThemeLocalizedLabel;
51
+ documentationPages?: DocsThemeLocalizedLabel;
52
+ documentPager?: DocsThemeLocalizedLabel;
53
+ next?: DocsThemeLocalizedLabel;
54
+ openSectionNavigation?: DocsThemeLocalizedLabel;
55
+ openSiteNavigation?: DocsThemeLocalizedLabel;
56
+ previous?: DocsThemeLocalizedLabel;
57
+ primaryNavigation?: DocsThemeLocalizedLabel;
58
+ scrollToTop?: DocsThemeLocalizedLabel;
59
+ sections?: DocsThemeLocalizedLabel;
60
+ toggleTheme?: DocsThemeLocalizedLabel;
61
+ }
42
62
  interface DocsThemeTocConfig {
43
63
  collapseLabel?: DocsThemeLocalizedLabel;
44
64
  expandLabel?: DocsThemeLocalizedLabel;
45
65
  openLabel?: DocsThemeLocalizedLabel;
46
66
  title?: DocsThemeLocalizedLabel;
47
67
  }
68
+ interface DocsThemeSocialLinkConfig {
69
+ type: SocialLinkIconType;
70
+ link: string;
71
+ label?: DocsThemeLocalizedLabel;
72
+ ariaLabel?: DocsThemeLocalizedLabel;
73
+ }
48
74
  interface DocsThemeConfig {
75
+ appearance?: 'default' | 'glass';
49
76
  [key: string]: unknown;
77
+ labels?: DocsThemeLabelsConfig;
78
+ nav?: DocsThemeNavConfig;
79
+ socialLinks?: DocsThemeSocialLinkConfig[] | false;
50
80
  toc?: DocsThemeTocConfig;
51
81
  }
52
82
  type DocsSectionConfig = Record<string, unknown>;
@@ -74,6 +104,7 @@ interface NormalizedDocsContentConfig {
74
104
  interface NormalizedDocsContentSectionConfig {
75
105
  layout: DocsSectionLayout;
76
106
  sidebar: DocsSidebarMode;
107
+ label?: DocsSidebarLabel;
77
108
  }
78
109
  interface NormalizedDocsConfig {
79
110
  site: DocsSiteConfig;
@@ -85,4 +116,4 @@ interface NormalizedDocsConfig {
85
116
  slots: DocsSlotsConfig;
86
117
  }
87
118
  //#endregion
88
- export { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig };
119
+ export { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, DocsThemeNavConfig, DocsThemeNavItemConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
package/dist/index.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./config/define-config.cjs`),t=require(`./config/define-docs-config.cjs`),n=require(`./export/process-exported-docs.cjs`),r=require(`./navigation/build-locale-links.cjs`),i=require(`./metadata/create-doc-metadata.cjs`),a=require(`./navigation/build-pager.cjs`),o=require(`./navigation/build-sidebar.cjs`),s=require(`./next/root-layout.cjs`),c=require(`./routing/build-static-params.cjs`),l=require(`./routing/resolve-docs-route.cjs`),u=require(`./source/create-docs-source.cjs`),d=async(e={})=>(await Promise.resolve().then(()=>require(`./next/metadata.cjs`))).generateMetadata(e),f=async(e={})=>(await Promise.resolve().then(()=>require(`./next/page.cjs`))).generateStaticParams(e),p=async e=>(await Promise.resolve().then(()=>require(`./next/page.cjs`))).DocsPage(e);exports.DocsPage=p,exports.DocsRootLayout=s.DocsRootLayout,exports.buildDocsStaticParams=c.buildDocsStaticParams,exports.buildLocaleLinks=r.buildLocaleLinks,exports.buildPager=a.buildPager,exports.buildSidebar=o.buildSidebar,exports.createDocMetadata=i.createDocMetadata,exports.createDocsSource=u.createDocsSource,exports.defineConfig=e.defineConfig,exports.defineDocsConfig=t.defineDocsConfig,exports.dynamicParams=!1,exports.generateMetadata=d,exports.generateStaticParams=f,exports.processExportedDocs=n.processExportedDocs,exports.resolveDocsRoute=l.resolveDocsRoute;
9
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./config/define-config.cjs`),t=require(`./config/define-docs-config.cjs`),n=require(`./export/process-exported-docs.cjs`),r=require(`./navigation/build-locale-links.cjs`),i=require(`./metadata/create-doc-metadata.cjs`),a=require(`./navigation/build-header-nav.cjs`),o=require(`./navigation/build-pager.cjs`),s=require(`./navigation/build-sidebar.cjs`),c=require(`./next/root-layout.cjs`),l=require(`./routing/build-static-params.cjs`),u=require(`./routing/resolve-docs-route.cjs`),d=require(`./source/create-docs-source.cjs`),f=async(e={})=>(await Promise.resolve().then(()=>require(`./next/metadata.cjs`))).generateMetadata(e),p=async(e={})=>(await Promise.resolve().then(()=>require(`./next/page.cjs`))).generateStaticParams(e),m=async e=>(await Promise.resolve().then(()=>require(`./next/page.cjs`))).DocsPage(e);exports.DocsPage=m,exports.DocsRootLayout=c.DocsRootLayout,exports.buildDocsStaticParams=l.buildDocsStaticParams,exports.buildHeaderNavigation=a.buildHeaderNavigation,exports.buildLocaleLinks=r.buildLocaleLinks,exports.buildPager=o.buildPager,exports.buildSidebar=s.buildSidebar,exports.createDocMetadata=i.createDocMetadata,exports.createDocsSource=d.createDocsSource,exports.defineConfig=e.defineConfig,exports.defineDocsConfig=t.defineDocsConfig,exports.dynamicParams=!1,exports.generateMetadata=f,exports.generateStaticParams=p,exports.processExportedDocs=n.processExportedDocs,exports.resolveDocsRoute=u.resolveDocsRoute;
package/dist/index.d.mts CHANGED
@@ -1,10 +1,11 @@
1
1
 
2
2
  import { CreateDocsSourceOptions, DocEntry, DocFormat, DocsSource } from "./source/types.mjs";
3
- import { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig } from "./config/types.mjs";
3
+ import { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, DocsThemeNavConfig, DocsThemeNavItemConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig } from "./config/types.mjs";
4
4
  import { defineConfig } from "./config/define-config.mjs";
5
5
  import { DefineDocsConfigOptions, defineDocsConfig } from "./config/define-docs-config.mjs";
6
6
  import { ProcessExportedDocsOptions, processExportedDocs } from "./export/process-exported-docs.mjs";
7
7
  import { CreateDocMetadataOptions, DocsMetadata, DocsMetadataAlternates, DocsMetadataRobots, createDocMetadata } from "./metadata/create-doc-metadata.mjs";
8
+ import { BuildHeaderNavOptions, buildHeaderNavigation } from "./navigation/build-header-nav.mjs";
8
9
  import { BuildLocaleLinksOptions, DocsLocaleLink, buildLocaleLinks } from "./navigation/build-locale-links.mjs";
9
10
  import { BuildPagerOptions, DocsPager, DocsPagerLink, buildPager } from "./navigation/build-pager.mjs";
10
11
  import { BuildSidebarOptions, DocsSidebarItem, buildSidebar } from "./navigation/build-sidebar.mjs";
@@ -22,4 +23,4 @@ declare const generateMetadata: (options?: GenerateMetadataOptions) => Promise<D
22
23
  declare const generateStaticParams: (options?: GenerateStaticParamsOptions) => Promise<DocsRouteParams[]>;
23
24
  declare const DocsPage: (options: DocsPageProps) => Promise<_$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | (string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined)>;
24
25
  //#endregion
25
- export { type BuildDocsStaticParamsOptions, type BuildLocaleLinksOptions, type BuildPagerOptions, type BuildSidebarOptions, type CreateDocMetadataOptions, type CreateDocsSourceOptions, type DefineDocsConfigOptions, type DocEntry, type DocFormat, type DocsConfig, type DocsContentConfig, type DocsContentSectionConfig, type DocsHomeConfig, type DocsLocaleDefinition, type DocsLocaleLink, type DocsMdxConfig, type DocsMetadata, type DocsMetadataAlternates, type DocsMetadataRobots, DocsPage, type DocsPageProps, type DocsPager, type DocsPagerLink, DocsRootLayout, type DocsRootLayoutProps, type DocsRouteParams, type DocsRouteResolution, type DocsSectionConfig, type DocsSectionLayout, type DocsSidebarConfigNode, type DocsSidebarGroupConfig, type DocsSidebarItem, type DocsSidebarItemConfig, type DocsSidebarLabel, type DocsSidebarMode, type DocsSiteConfig, type DocsSlotsConfig, type DocsSource, type DocsThemeConfig, type GenerateMetadataOptions, type GenerateStaticParamsOptions, type NormalizedDocsConfig, type NormalizedDocsContentConfig, type NormalizedDocsContentSectionConfig, type ProcessExportedDocsOptions, type ResolveDocsRouteOptions, type ResolvedDocsNotFoundRoute, type ResolvedDocsPageRoute, type ResolvedDocsRedirectRoute, buildDocsStaticParams, buildLocaleLinks, buildPager, buildSidebar, createDocMetadata, createDocsSource, defineConfig, defineDocsConfig, dynamicParams, generateMetadata, generateStaticParams, processExportedDocs, resolveDocsRoute };
26
+ export { type BuildDocsStaticParamsOptions, type BuildHeaderNavOptions, type BuildLocaleLinksOptions, type BuildPagerOptions, type BuildSidebarOptions, type CreateDocMetadataOptions, type CreateDocsSourceOptions, type DefineDocsConfigOptions, type DocEntry, type DocFormat, type DocsConfig, type DocsContentConfig, type DocsContentSectionConfig, type DocsHomeConfig, type DocsLocaleDefinition, type DocsLocaleLink, type DocsMdxConfig, type DocsMetadata, type DocsMetadataAlternates, type DocsMetadataRobots, DocsPage, type DocsPageProps, type DocsPager, type DocsPagerLink, DocsRootLayout, type DocsRootLayoutProps, type DocsRouteParams, type DocsRouteResolution, type DocsSectionConfig, type DocsSectionLayout, type DocsSidebarConfigNode, type DocsSidebarGroupConfig, type DocsSidebarItem, type DocsSidebarItemConfig, type DocsSidebarLabel, type DocsSidebarMode, type DocsSiteConfig, type DocsSlotsConfig, type DocsSource, type DocsThemeConfig, type DocsThemeNavConfig, type DocsThemeNavItemConfig, type GenerateMetadataOptions, type GenerateStaticParamsOptions, type NormalizedDocsConfig, type NormalizedDocsContentConfig, type NormalizedDocsContentSectionConfig, type ProcessExportedDocsOptions, type ResolveDocsRouteOptions, type ResolvedDocsNotFoundRoute, type ResolvedDocsPageRoute, type ResolvedDocsRedirectRoute, buildDocsStaticParams, buildHeaderNavigation, buildLocaleLinks, buildPager, buildSidebar, createDocMetadata, createDocsSource, defineConfig, defineDocsConfig, dynamicParams, generateMetadata, generateStaticParams, processExportedDocs, resolveDocsRoute };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
 
2
2
  import { CreateDocsSourceOptions, DocEntry, DocFormat, DocsSource } from "./source/types.js";
3
- import { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig } from "./config/types.js";
3
+ import { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, DocsThemeNavConfig, DocsThemeNavItemConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig } from "./config/types.js";
4
4
  import { defineConfig } from "./config/define-config.js";
5
5
  import { DefineDocsConfigOptions, defineDocsConfig } from "./config/define-docs-config.js";
6
6
  import { ProcessExportedDocsOptions, processExportedDocs } from "./export/process-exported-docs.js";
7
7
  import { CreateDocMetadataOptions, DocsMetadata, DocsMetadataAlternates, DocsMetadataRobots, createDocMetadata } from "./metadata/create-doc-metadata.js";
8
+ import { BuildHeaderNavOptions, buildHeaderNavigation } from "./navigation/build-header-nav.js";
8
9
  import { BuildLocaleLinksOptions, DocsLocaleLink, buildLocaleLinks } from "./navigation/build-locale-links.js";
9
10
  import { BuildPagerOptions, DocsPager, DocsPagerLink, buildPager } from "./navigation/build-pager.js";
10
11
  import { BuildSidebarOptions, DocsSidebarItem, buildSidebar } from "./navigation/build-sidebar.js";
@@ -22,4 +23,4 @@ declare const generateMetadata: (options?: GenerateMetadataOptions) => Promise<D
22
23
  declare const generateStaticParams: (options?: GenerateStaticParamsOptions) => Promise<DocsRouteParams[]>;
23
24
  declare const DocsPage: (options: DocsPageProps) => Promise<_$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | (string | number | bigint | boolean | _$react.ReactPortal | _$react.ReactElement<unknown, string | _$react.JSXElementConstructor<any>> | Iterable<_$react.ReactNode> | null | undefined)>;
24
25
  //#endregion
25
- export { type BuildDocsStaticParamsOptions, type BuildLocaleLinksOptions, type BuildPagerOptions, type BuildSidebarOptions, type CreateDocMetadataOptions, type CreateDocsSourceOptions, type DefineDocsConfigOptions, type DocEntry, type DocFormat, type DocsConfig, type DocsContentConfig, type DocsContentSectionConfig, type DocsHomeConfig, type DocsLocaleDefinition, type DocsLocaleLink, type DocsMdxConfig, type DocsMetadata, type DocsMetadataAlternates, type DocsMetadataRobots, DocsPage, type DocsPageProps, type DocsPager, type DocsPagerLink, DocsRootLayout, type DocsRootLayoutProps, type DocsRouteParams, type DocsRouteResolution, type DocsSectionConfig, type DocsSectionLayout, type DocsSidebarConfigNode, type DocsSidebarGroupConfig, type DocsSidebarItem, type DocsSidebarItemConfig, type DocsSidebarLabel, type DocsSidebarMode, type DocsSiteConfig, type DocsSlotsConfig, type DocsSource, type DocsThemeConfig, type GenerateMetadataOptions, type GenerateStaticParamsOptions, type NormalizedDocsConfig, type NormalizedDocsContentConfig, type NormalizedDocsContentSectionConfig, type ProcessExportedDocsOptions, type ResolveDocsRouteOptions, type ResolvedDocsNotFoundRoute, type ResolvedDocsPageRoute, type ResolvedDocsRedirectRoute, buildDocsStaticParams, buildLocaleLinks, buildPager, buildSidebar, createDocMetadata, createDocsSource, defineConfig, defineDocsConfig, dynamicParams, generateMetadata, generateStaticParams, processExportedDocs, resolveDocsRoute };
26
+ export { type BuildDocsStaticParamsOptions, type BuildHeaderNavOptions, type BuildLocaleLinksOptions, type BuildPagerOptions, type BuildSidebarOptions, type CreateDocMetadataOptions, type CreateDocsSourceOptions, type DefineDocsConfigOptions, type DocEntry, type DocFormat, type DocsConfig, type DocsContentConfig, type DocsContentSectionConfig, type DocsHomeConfig, type DocsLocaleDefinition, type DocsLocaleLink, type DocsMdxConfig, type DocsMetadata, type DocsMetadataAlternates, type DocsMetadataRobots, DocsPage, type DocsPageProps, type DocsPager, type DocsPagerLink, DocsRootLayout, type DocsRootLayoutProps, type DocsRouteParams, type DocsRouteResolution, type DocsSectionConfig, type DocsSectionLayout, type DocsSidebarConfigNode, type DocsSidebarGroupConfig, type DocsSidebarItem, type DocsSidebarItemConfig, type DocsSidebarLabel, type DocsSidebarMode, type DocsSiteConfig, type DocsSlotsConfig, type DocsSource, type DocsThemeConfig, type DocsThemeNavConfig, type DocsThemeNavItemConfig, type GenerateMetadataOptions, type GenerateStaticParamsOptions, type NormalizedDocsConfig, type NormalizedDocsContentConfig, type NormalizedDocsContentSectionConfig, type ProcessExportedDocsOptions, type ResolveDocsRouteOptions, type ResolvedDocsNotFoundRoute, type ResolvedDocsPageRoute, type ResolvedDocsRedirectRoute, buildDocsStaticParams, buildHeaderNavigation, buildLocaleLinks, buildPager, buildSidebar, createDocMetadata, createDocsSource, defineConfig, defineDocsConfig, dynamicParams, generateMetadata, generateStaticParams, processExportedDocs, resolveDocsRoute };
package/dist/index.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- import{defineConfig as e}from"./config/define-config.mjs";import{defineDocsConfig as t}from"./config/define-docs-config.mjs";import{processExportedDocs as n}from"./export/process-exported-docs.mjs";import{buildLocaleLinks as r}from"./navigation/build-locale-links.mjs";import{createDocMetadata as i}from"./metadata/create-doc-metadata.mjs";import{buildPager as a}from"./navigation/build-pager.mjs";import{buildSidebar as o}from"./navigation/build-sidebar.mjs";import{DocsRootLayout as s}from"./next/root-layout.mjs";import{buildDocsStaticParams as c}from"./routing/build-static-params.mjs";import{resolveDocsRoute as l}from"./routing/resolve-docs-route.mjs";import{createDocsSource as u}from"./source/create-docs-source.mjs";const d=!1,f=async(e={})=>(await import(`./next/metadata.mjs`)).generateMetadata(e),p=async(e={})=>(await import(`./next/page.mjs`)).generateStaticParams(e),m=async e=>(await import(`./next/page.mjs`)).DocsPage(e);export{m as DocsPage,s as DocsRootLayout,c as buildDocsStaticParams,r as buildLocaleLinks,a as buildPager,o as buildSidebar,i as createDocMetadata,u as createDocsSource,e as defineConfig,t as defineDocsConfig,d as dynamicParams,f as generateMetadata,p as generateStaticParams,n as processExportedDocs,l as resolveDocsRoute};
9
+ import{defineConfig as e}from"./config/define-config.mjs";import{defineDocsConfig as t}from"./config/define-docs-config.mjs";import{processExportedDocs as n}from"./export/process-exported-docs.mjs";import{buildLocaleLinks as r}from"./navigation/build-locale-links.mjs";import{createDocMetadata as i}from"./metadata/create-doc-metadata.mjs";import{buildHeaderNavigation as a}from"./navigation/build-header-nav.mjs";import{buildPager as o}from"./navigation/build-pager.mjs";import{buildSidebar as s}from"./navigation/build-sidebar.mjs";import{DocsRootLayout as c}from"./next/root-layout.mjs";import{buildDocsStaticParams as l}from"./routing/build-static-params.mjs";import{resolveDocsRoute as u}from"./routing/resolve-docs-route.mjs";import{createDocsSource as d}from"./source/create-docs-source.mjs";const f=!1,p=async(e={})=>(await import(`./next/metadata.mjs`)).generateMetadata(e),m=async(e={})=>(await import(`./next/page.mjs`)).generateStaticParams(e),h=async e=>(await import(`./next/page.mjs`)).DocsPage(e);export{h as DocsPage,c as DocsRootLayout,l as buildDocsStaticParams,a as buildHeaderNavigation,r as buildLocaleLinks,o as buildPager,s as buildSidebar,i as createDocMetadata,d as createDocsSource,e as defineConfig,t as defineDocsConfig,f as dynamicParams,p as generateMetadata,m as generateStaticParams,n as processExportedDocs,u as resolveDocsRoute};
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`react`),t=require(`@blackwork/machine`);const n=(0,t.mergeComponents)(t.defaultComponents,{table:({children:t,node:n,...r})=>(0,e.createElement)(`div`,{className:`my-6 w-full overflow-x-auto`},(0,e.createElement)(`table`,r,t))});exports.defaultDocsComponents=n;
9
+ require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`react`),t=require(`react/jsx-runtime`),n=require(`@blackwork/machine`),r=require(`@blackwork/machine/runtime`);const i=e=>typeof e==`object`&&!!e,a=e=>i(e)&&typeof e.type==`string`,o=e=>a(e)&&e.type===`element`,s=e=>e?e.type===`text`?e.value??``:o(e)?(e.children??[]).map(e=>s(e)).join(``):``:``,c=e=>{let t=e?.properties?.class??e?.properties?.className;return Array.isArray(t)?t.filter(e=>typeof e==`string`):typeof t==`string`?t.split(` `):[]},l=e=>(e?.children??[]).find(e=>o(e)&&e.tagName===`code`),u=e=>c(e).find(e=>e.startsWith(`language-`))?.slice(9)??``,d=e=>{if(!e)return``;let t=(e.children??[]).filter(e=>o(e)&&e.tagName===`span`&&c(e).includes(`line`));return t.length>0?t.map(e=>s(e)).join(`
10
+ `):(e.children??[]).map(e=>s(e)).join(``)},f=(e,t)=>{let n=e?.properties?.[`data-title`]??e?.properties?.dataTitle;return typeof n==`string`&&n.length>0?n:t??``},p=t=>t==null||typeof t==`boolean`?``:typeof t==`string`||typeof t==`number`?String(t):Array.isArray(t)?t.map(e=>p(e)).join(``):(0,e.isValidElement)(t)?p(t.props.children):``,m=t=>{if(Array.isArray(t))return t.map(e=>m(e)).find(Boolean)??``;if(!(0,e.isValidElement)(t))return``;let n=t.props.className,r=(Array.isArray(n)?n.filter(e=>typeof e==`string`):typeof n==`string`?n.split(` `):[]).find(e=>e.startsWith(`language-`));return r?r.slice(9):m(t.props.children)},h=(0,n.mergeComponents)(n.defaultComponents,{pre:({children:e,node:n,"data-title":i,...a})=>{let s=o(n)?n:void 0,c=l(s),h=f(s,i),g=u(c)||m(e),_=d(c)||p(e);return(0,t.jsx)(r.CodeBlock,{...a,fileName:h,language:g,rawCode:_,children:e})},table:({children:t,node:n,...r})=>(0,e.createElement)(`div`,{className:`my-6 w-full overflow-x-auto`},(0,e.createElement)(`table`,r,t))});exports.defaultDocsComponents=h;
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
7
7
  * license: MIT
8
8
  */
9
- import{createElement as e}from"react";import{defaultComponents as t,mergeComponents as n}from"@blackwork/machine";const r=n(t,{table:({children:t,node:n,...r})=>e(`div`,{className:`my-6 w-full overflow-x-auto`},e(`table`,r,t))});export{r as defaultDocsComponents};
9
+ import{createElement as e,isValidElement as t}from"react";import{jsx as n}from"react/jsx-runtime";import{defaultComponents as r,mergeComponents as i}from"@blackwork/machine";import{CodeBlock as a}from"@blackwork/machine/runtime";const o=e=>typeof e==`object`&&!!e,s=e=>o(e)&&typeof e.type==`string`,c=e=>s(e)&&e.type===`element`,l=e=>e?e.type===`text`?e.value??``:c(e)?(e.children??[]).map(e=>l(e)).join(``):``:``,u=e=>{let t=e?.properties?.class??e?.properties?.className;return Array.isArray(t)?t.filter(e=>typeof e==`string`):typeof t==`string`?t.split(` `):[]},d=e=>(e?.children??[]).find(e=>c(e)&&e.tagName===`code`),f=e=>u(e).find(e=>e.startsWith(`language-`))?.slice(9)??``,p=e=>{if(!e)return``;let t=(e.children??[]).filter(e=>c(e)&&e.tagName===`span`&&u(e).includes(`line`));return t.length>0?t.map(e=>l(e)).join(`
10
+ `):(e.children??[]).map(e=>l(e)).join(``)},m=(e,t)=>{let n=e?.properties?.[`data-title`]??e?.properties?.dataTitle;return typeof n==`string`&&n.length>0?n:t??``},h=e=>e==null||typeof e==`boolean`?``:typeof e==`string`||typeof e==`number`?String(e):Array.isArray(e)?e.map(e=>h(e)).join(``):t(e)?h(e.props.children):``,g=e=>{if(Array.isArray(e))return e.map(e=>g(e)).find(Boolean)??``;if(!t(e))return``;let n=e.props.className,r=(Array.isArray(n)?n.filter(e=>typeof e==`string`):typeof n==`string`?n.split(` `):[]).find(e=>e.startsWith(`language-`));return r?r.slice(9):g(e.props.children)},_=i(r,{pre:({children:e,node:t,"data-title":r,...i})=>{let o=c(t)?t:void 0,s=d(o),l=m(o,r),u=f(s)||g(e),_=p(s)||h(e);return n(a,{...i,fileName:l,language:u,rawCode:_,children:e})},table:({children:t,node:n,...r})=>e(`div`,{className:`my-6 w-full overflow-x-auto`},e(`table`,r,t))});export{_ as defaultDocsComponents};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -0,0 +1,9 @@
1
+ /**
2
+ * name: @blackwork/docs
3
+ * version: v0.6.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=>/^(https?:|mailto:|tel:)/u.test(e),t=e=>e&&`${e.charAt(0).toUpperCase()}${e.slice(1)}`,n=(e,t,n)=>typeof e==`string`?e:e?.[t]??n,r=(e,t)=>{let n=e.split(`/`).filter(Boolean);return n[0]&&t.includes(n[0])?n.slice(1):n},i=(t,n,i)=>e(t)?t:i.getCanonicalHref(n,r(t,i.getLocaleCodes())),a=(t,n,i)=>{if(!n||e(t))return!1;if(t===n)return!0;if(t===`/`)return!1;if(n.startsWith(`${t}/`))return!0;let a=r(t,i)[0],o=r(n,i)[0];return!!(a&&a===o)},o=({currentHref:e,href:t,label:n,locale:r,source:o})=>{let s=i(t,r,o);return{href:s,label:n,current:a(s,e,o.getLocaleCodes())}},s=e=>Object.entries(e.content?.sections??{}).map(([e,n])=>({href:`/${e}`,label:n.label??t(e)})),c=({config:e={},currentHref:t,locale:r,source:i})=>e.theme?.nav===!1?[]:(Array.isArray(e.theme?.nav)?e.theme.nav:s(e)).map(e=>o({currentHref:t,href:e.href,label:n(e.label,r,e.href),locale:r,source:i}));exports.buildHeaderNavigation=c;
@@ -0,0 +1,20 @@
1
+
2
+ import { DocsSource } from "../source/types.mjs";
3
+ import { DocsThemeNavItem } from "../theme/types.mjs";
4
+ import { DocsConfig, NormalizedDocsConfig } from "../config/types.mjs";
5
+
6
+ //#region src/navigation/build-header-nav.d.ts
7
+ interface BuildHeaderNavOptions {
8
+ config?: DocsConfig | NormalizedDocsConfig;
9
+ currentHref?: string;
10
+ locale: string;
11
+ source: DocsSource;
12
+ }
13
+ declare const buildHeaderNavigation: ({
14
+ config,
15
+ currentHref,
16
+ locale,
17
+ source
18
+ }: BuildHeaderNavOptions) => DocsThemeNavItem[];
19
+ //#endregion
20
+ export { BuildHeaderNavOptions, buildHeaderNavigation };
@@ -0,0 +1,20 @@
1
+
2
+ import { DocsSource } from "../source/types.js";
3
+ import { DocsThemeNavItem } from "../theme/types.js";
4
+ import { DocsConfig, NormalizedDocsConfig } from "../config/types.js";
5
+
6
+ //#region src/navigation/build-header-nav.d.ts
7
+ interface BuildHeaderNavOptions {
8
+ config?: DocsConfig | NormalizedDocsConfig;
9
+ currentHref?: string;
10
+ locale: string;
11
+ source: DocsSource;
12
+ }
13
+ declare const buildHeaderNavigation: ({
14
+ config,
15
+ currentHref,
16
+ locale,
17
+ source
18
+ }: BuildHeaderNavOptions) => DocsThemeNavItem[];
19
+ //#endregion
20
+ export { BuildHeaderNavOptions, buildHeaderNavigation };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * name: @blackwork/docs
3
+ * version: v0.6.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=>/^(https?:|mailto:|tel:)/u.test(e),t=e=>e&&`${e.charAt(0).toUpperCase()}${e.slice(1)}`,n=(e,t,n)=>typeof e==`string`?e:e?.[t]??n,r=(e,t)=>{let n=e.split(`/`).filter(Boolean);return n[0]&&t.includes(n[0])?n.slice(1):n},i=(t,n,i)=>e(t)?t:i.getCanonicalHref(n,r(t,i.getLocaleCodes())),a=(t,n,i)=>{if(!n||e(t))return!1;if(t===n)return!0;if(t===`/`)return!1;if(n.startsWith(`${t}/`))return!0;let a=r(t,i)[0],o=r(n,i)[0];return!!(a&&a===o)},o=({currentHref:e,href:t,label:n,locale:r,source:o})=>{let s=i(t,r,o);return{href:s,label:n,current:a(s,e,o.getLocaleCodes())}},s=e=>Object.entries(e.content?.sections??{}).map(([e,n])=>({href:`/${e}`,label:n.label??t(e)})),c=({config:e={},currentHref:t,locale:r,source:i})=>e.theme?.nav===!1?[]:(Array.isArray(e.theme?.nav)?e.theme.nav:s(e)).map(e=>o({currentHref:t,href:e.href,label:n(e.label,r,e.href),locale:r,source:i}));export{c as buildHeaderNavigation};
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * name: @blackwork/docs
3
- * version: v0.4.2
3
+ * version: v0.6.0
4
4
  * description: Next-first documentation framework for Blackwork projects.
5
5
  * author: chengpeiquan <chengpeiquan@chengpeiquan.com>
6
6
  * homepage: https://chengpeiquan.com