@blackwork/docs 0.4.2 → 0.5.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.
- package/README.md +55 -25
- package/dist/_virtual/_rolldown/runtime.cjs +1 -1
- package/dist/config/defaults.cjs +1 -1
- package/dist/config/defaults.mjs +1 -1
- package/dist/config/define-config.cjs +2 -2
- package/dist/config/define-config.mjs +2 -2
- package/dist/config/define-docs-config.cjs +1 -1
- package/dist/config/define-docs-config.mjs +1 -1
- package/dist/config/load-content-config.cjs +2 -2
- package/dist/config/load-content-config.mjs +2 -2
- package/dist/config/types.d.mts +33 -3
- package/dist/config/types.d.ts +33 -3
- package/dist/export/process-exported-docs.cjs +1 -1
- package/dist/export/process-exported-docs.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +2 -2
- package/dist/mdx/default-docs-components.cjs +3 -2
- package/dist/mdx/default-docs-components.mjs +3 -2
- package/dist/mdx/merge-docs-components.cjs +1 -1
- package/dist/mdx/merge-docs-components.mjs +1 -1
- package/dist/metadata/create-doc-metadata.cjs +1 -1
- package/dist/metadata/create-doc-metadata.mjs +1 -1
- package/dist/navigation/build-header-nav.cjs +9 -0
- package/dist/navigation/build-header-nav.d.mts +20 -0
- package/dist/navigation/build-header-nav.d.ts +20 -0
- package/dist/navigation/build-header-nav.mjs +9 -0
- package/dist/navigation/build-locale-links.cjs +1 -1
- package/dist/navigation/build-locale-links.mjs +1 -1
- package/dist/navigation/build-pager.cjs +1 -1
- package/dist/navigation/build-pager.mjs +1 -1
- package/dist/navigation/build-sidebar.cjs +1 -1
- package/dist/navigation/build-sidebar.mjs +1 -1
- package/dist/navigation/resolve-sidebar.cjs +1 -1
- package/dist/navigation/resolve-sidebar.mjs +1 -1
- package/dist/next/context.cjs +1 -1
- package/dist/next/context.mjs +1 -1
- package/dist/next/document-lang-sync.cjs +1 -1
- package/dist/next/document-lang-sync.mjs +1 -1
- package/dist/next/load-doc-content.cjs +2 -2
- package/dist/next/load-doc-content.mjs +2 -2
- package/dist/next/load-generated-manifest.cjs +1 -1
- package/dist/next/load-generated-manifest.mjs +1 -1
- package/dist/next/metadata.cjs +1 -1
- package/dist/next/metadata.mjs +1 -1
- package/dist/next/page.cjs +1 -1
- package/dist/next/page.mjs +1 -1
- package/dist/next/render-route.cjs +2 -2
- package/dist/next/render-route.mjs +2 -2
- package/dist/next/resolve-document-lang.cjs +1 -1
- package/dist/next/resolve-document-lang.mjs +1 -1
- package/dist/next/root-layout.cjs +2 -2
- package/dist/next/root-layout.d.mts +2 -2
- package/dist/next/root-layout.d.ts +2 -2
- package/dist/next/root-layout.mjs +2 -2
- package/dist/next-plugin/generate.cjs +1 -1
- package/dist/next-plugin/generate.mjs +1 -1
- package/dist/next.cjs +1 -1
- package/dist/next.mjs +1 -1
- package/dist/routing/build-static-params.cjs +1 -1
- package/dist/routing/build-static-params.mjs +1 -1
- package/dist/routing/resolve-docs-route.cjs +1 -1
- package/dist/routing/resolve-docs-route.mjs +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/source/build-docs-source.cjs +1 -1
- package/dist/source/build-docs-source.mjs +1 -1
- package/dist/source/collect-docs-manifest.cjs +1 -1
- package/dist/source/collect-docs-manifest.mjs +1 -1
- package/dist/source/create-docs-source-from-manifest.cjs +1 -1
- package/dist/source/create-docs-source-from-manifest.mjs +1 -1
- package/dist/source/create-docs-source.cjs +1 -1
- package/dist/source/create-docs-source.mjs +1 -1
- package/dist/tailwind.css +2 -0
- package/dist/theme/components/content-layout.cjs +1 -1
- package/dist/theme/components/content-layout.mjs +1 -1
- package/dist/theme/components/content-shell.cjs +2 -2
- package/dist/theme/components/content-shell.mjs +2 -2
- package/dist/theme/components/docs-rail-scroll-state.cjs +1 -1
- package/dist/theme/components/docs-rail-scroll-state.mjs +1 -1
- package/dist/theme/components/docs-rail-scroll.cjs +1 -1
- package/dist/theme/components/docs-rail-scroll.mjs +1 -1
- package/dist/theme/components/docs-scroll-reset.cjs +1 -1
- package/dist/theme/components/docs-scroll-reset.mjs +1 -1
- package/dist/theme/components/docs-scroll-to-top.cjs +2 -2
- package/dist/theme/components/docs-scroll-to-top.mjs +2 -2
- package/dist/theme/components/docs-shell.cjs +2 -2
- package/dist/theme/components/docs-shell.mjs +2 -2
- package/dist/theme/components/docs-toc-geometry.cjs +1 -1
- package/dist/theme/components/docs-toc-geometry.mjs +1 -1
- package/dist/theme/components/docs-toc.cjs +2 -2
- package/dist/theme/components/docs-toc.mjs +2 -2
- package/dist/theme/components/floating-actions.cjs +1 -1
- package/dist/theme/components/floating-actions.mjs +1 -1
- package/dist/theme/components/footer.cjs +2 -2
- package/dist/theme/components/footer.mjs +2 -2
- package/dist/theme/components/header.cjs +2 -2
- package/dist/theme/components/header.d.mts +4 -0
- package/dist/theme/components/header.d.ts +4 -0
- package/dist/theme/components/header.mjs +2 -2
- package/dist/theme/components/home-shell.cjs +2 -2
- package/dist/theme/components/home-shell.mjs +2 -2
- package/dist/theme/components/link.cjs +1 -1
- package/dist/theme/components/link.mjs +1 -1
- package/dist/theme/components/shell-shared.cjs +2 -2
- package/dist/theme/components/shell-shared.d.mts +22 -0
- package/dist/theme/components/shell-shared.d.ts +22 -0
- package/dist/theme/components/shell-shared.mjs +2 -2
- package/dist/theme/create-home-data.cjs +2 -2
- package/dist/theme/create-home-data.mjs +2 -2
- package/dist/theme/slots.cjs +1 -1
- package/dist/theme/slots.mjs +1 -1
- package/dist/theme/types.d.mts +29 -9
- package/dist/theme/types.d.ts +29 -9
- package/dist/theme.cjs +2 -2
- package/dist/theme.d.mts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.mjs +2 -2
- 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
|
package/dist/config/defaults.cjs
CHANGED
package/dist/config/defaults.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @blackwork/docs
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.5.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.
|
|
3
|
+
* version: v0.5.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,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @blackwork/docs
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.5.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.
|
|
3
|
+
* version: v0.5.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};
|
package/dist/config/types.d.mts
CHANGED
|
@@ -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,37 @@ interface DocsContentConfig {
|
|
|
38
45
|
locales?: Record<string, DocsLocaleDefinition>;
|
|
39
46
|
sections?: Record<string, DocsContentSectionConfig>;
|
|
40
47
|
}
|
|
41
|
-
type DocsThemeLocalizedLabel =
|
|
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 {
|
|
49
75
|
[key: string]: unknown;
|
|
76
|
+
labels?: DocsThemeLabelsConfig;
|
|
77
|
+
nav?: DocsThemeNavConfig;
|
|
78
|
+
socialLinks?: DocsThemeSocialLinkConfig[] | false;
|
|
50
79
|
toc?: DocsThemeTocConfig;
|
|
51
80
|
}
|
|
52
81
|
type DocsSectionConfig = Record<string, unknown>;
|
|
@@ -74,6 +103,7 @@ interface NormalizedDocsContentConfig {
|
|
|
74
103
|
interface NormalizedDocsContentSectionConfig {
|
|
75
104
|
layout: DocsSectionLayout;
|
|
76
105
|
sidebar: DocsSidebarMode;
|
|
106
|
+
label?: DocsSidebarLabel;
|
|
77
107
|
}
|
|
78
108
|
interface NormalizedDocsConfig {
|
|
79
109
|
site: DocsSiteConfig;
|
|
@@ -85,4 +115,4 @@ interface NormalizedDocsConfig {
|
|
|
85
115
|
slots: DocsSlotsConfig;
|
|
86
116
|
}
|
|
87
117
|
//#endregion
|
|
88
|
-
export { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig };
|
|
118
|
+
export { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, DocsThemeNavConfig, DocsThemeNavItemConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig };
|
package/dist/config/types.d.ts
CHANGED
|
@@ -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,37 @@ interface DocsContentConfig {
|
|
|
38
45
|
locales?: Record<string, DocsLocaleDefinition>;
|
|
39
46
|
sections?: Record<string, DocsContentSectionConfig>;
|
|
40
47
|
}
|
|
41
|
-
type DocsThemeLocalizedLabel =
|
|
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 {
|
|
49
75
|
[key: string]: unknown;
|
|
76
|
+
labels?: DocsThemeLabelsConfig;
|
|
77
|
+
nav?: DocsThemeNavConfig;
|
|
78
|
+
socialLinks?: DocsThemeSocialLinkConfig[] | false;
|
|
50
79
|
toc?: DocsThemeTocConfig;
|
|
51
80
|
}
|
|
52
81
|
type DocsSectionConfig = Record<string, unknown>;
|
|
@@ -74,6 +103,7 @@ interface NormalizedDocsContentConfig {
|
|
|
74
103
|
interface NormalizedDocsContentSectionConfig {
|
|
75
104
|
layout: DocsSectionLayout;
|
|
76
105
|
sidebar: DocsSidebarMode;
|
|
106
|
+
label?: DocsSidebarLabel;
|
|
77
107
|
}
|
|
78
108
|
interface NormalizedDocsConfig {
|
|
79
109
|
site: DocsSiteConfig;
|
|
@@ -85,4 +115,4 @@ interface NormalizedDocsConfig {
|
|
|
85
115
|
slots: DocsSlotsConfig;
|
|
86
116
|
}
|
|
87
117
|
//#endregion
|
|
88
|
-
export { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig };
|
|
118
|
+
export { DocsConfig, DocsContentConfig, DocsContentSectionConfig, DocsHomeConfig, DocsLocaleDefinition, DocsMdxConfig, DocsSectionConfig, DocsSectionLayout, DocsSidebarConfigNode, DocsSidebarGroupConfig, DocsSidebarItemConfig, DocsSidebarLabel, DocsSidebarMode, DocsSiteConfig, DocsSlotsConfig, DocsThemeConfig, DocsThemeNavConfig, DocsThemeNavItemConfig, NormalizedDocsConfig, NormalizedDocsContentConfig, NormalizedDocsContentSectionConfig };
|
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* name: @blackwork/docs
|
|
3
|
-
* version: v0.
|
|
3
|
+
* version: v0.5.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-
|
|
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.
|
|
3
|
+
* version: v0.5.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{
|
|
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.
|
|
3
|
+
* version: v0.5.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
|
|
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.
|
|
3
|
+
* version: v0.5.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
|
|
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};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* name: @blackwork/docs
|
|
3
|
+
* version: v0.5.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.5.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};
|