@razorwind/docgen 0.0.12 → 0.0.13
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/dist/extract.d.cts +2 -1
- package/dist/extract.d.cts.map +1 -1
- package/dist/extract.d.mts +2 -1
- package/dist/generate.d.cts +115 -2
- package/dist/generate.d.cts.map +1 -0
- package/dist/generate.d.mts +115 -2
- package/dist/generate.d.mts.map +1 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/types-BIi5hVjx.d.cts +63 -0
- package/dist/types-BIi5hVjx.d.cts.map +1 -0
- package/dist/types-L9_4rtz5.d.mts +62 -0
- package/dist/types-L9_4rtz5.d.mts.map +1 -0
- package/package.json +3 -3
- package/dist/generate-hhZ24R_4.d.cts +0 -169
- package/dist/generate-hhZ24R_4.d.cts.map +0 -1
- package/dist/generate-hhZ24R_4.d.mts +0 -169
- package/dist/generate-hhZ24R_4.d.mts.map +0 -1
package/dist/extract.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { i as __exportAll, t as DocgenExtractPluginOptions } from "./types-BIi5hVjx.cjs";
|
|
1
2
|
declare namespace extract_d_exports {
|
|
2
3
|
export { _default as default };
|
|
3
4
|
}
|
|
@@ -15,7 +16,7 @@ declare namespace extract_d_exports {
|
|
|
15
16
|
* });
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
declare const _default: (options?:
|
|
19
|
+
declare const _default: (options?: DocgenExtractPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
19
20
|
//#endregion
|
|
20
21
|
export { _default as default, extract_d_exports as t };
|
|
21
22
|
//# sourceMappingURL=extract.d.cts.map
|
package/dist/extract.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract.d.cts","names":[],"sources":["../src/extract.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"extract.d.cts","names":[],"sources":["../src/extract.ts"],"mappings":""}
|
package/dist/extract.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as DocgenExtractPluginOptions } from "./types-L9_4rtz5.mjs";
|
|
1
2
|
declare namespace extract_d_exports {
|
|
2
3
|
export { _default as default };
|
|
3
4
|
}
|
|
@@ -15,7 +16,7 @@ declare namespace extract_d_exports {
|
|
|
15
16
|
* });
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
declare const _default: (options?:
|
|
19
|
+
declare const _default: (options?: DocgenExtractPluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
19
20
|
//#endregion
|
|
20
21
|
export { _default as default, extract_d_exports as t };
|
|
21
22
|
//# sourceMappingURL=extract.d.mts.map
|
package/dist/generate.d.cts
CHANGED
|
@@ -1,2 +1,115 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { i as __exportAll, n as DocgenGeneratePluginOptions, r as FlatToken } from "./types-BIi5hVjx.cjs";
|
|
2
|
+
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
3
|
+
import { Schema } from "@razorwind/core/schema";
|
|
4
|
+
declare namespace generate_d_exports {
|
|
5
|
+
export { COMPONENT_TYPES, ComponentDocType, REGISTRY_ITEM_TYPES, RegistryItemPage, RegistryItemType, _default as default, extractRegistryItems, generateDocs, groupTokens, renderGroupMdx, renderIndexMdx, renderRegistryItemsMdx, renderTokenTable, tokenGroup };
|
|
6
|
+
}
|
|
7
|
+
/** Top-level path segment used to group tokens into pages. */
|
|
8
|
+
declare function tokenGroup(token: FlatToken): string;
|
|
9
|
+
/**
|
|
10
|
+
* Group flattened tokens by their top-level path segment.
|
|
11
|
+
*/
|
|
12
|
+
declare function groupTokens(tokens: FlatToken[]): Map<string, FlatToken[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Render a markdown token table for a set of flattened tokens.
|
|
15
|
+
*/
|
|
16
|
+
declare function renderTokenTable(tokens: FlatToken[]): string;
|
|
17
|
+
/**
|
|
18
|
+
* Render an MDX documentation page for a single token group.
|
|
19
|
+
*/
|
|
20
|
+
declare function renderGroupMdx(group: string, tokens: FlatToken[]): string;
|
|
21
|
+
/**
|
|
22
|
+
* Render the documentation index page linking to every generated page.
|
|
23
|
+
*/
|
|
24
|
+
declare function renderIndexMdx(input: {
|
|
25
|
+
title: string;
|
|
26
|
+
groups: Map<string, FlatToken[]>;
|
|
27
|
+
hasComponents: boolean;
|
|
28
|
+
componentPages?: {
|
|
29
|
+
slug: string;
|
|
30
|
+
title: string;
|
|
31
|
+
count: number;
|
|
32
|
+
}[];
|
|
33
|
+
}): string;
|
|
34
|
+
/** Component types that receive a dedicated documentation page. */
|
|
35
|
+
declare const COMPONENT_TYPES: {
|
|
36
|
+
readonly ui: {
|
|
37
|
+
readonly slug: "ui";
|
|
38
|
+
readonly title: "UI Primitives";
|
|
39
|
+
};
|
|
40
|
+
readonly component: {
|
|
41
|
+
readonly slug: "components";
|
|
42
|
+
readonly title: "Components";
|
|
43
|
+
};
|
|
44
|
+
readonly page: {
|
|
45
|
+
readonly slug: "pages";
|
|
46
|
+
readonly title: "Pages";
|
|
47
|
+
};
|
|
48
|
+
readonly block: {
|
|
49
|
+
readonly slug: "blocks";
|
|
50
|
+
readonly title: "Blocks";
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/** @deprecated Use {@link COMPONENT_TYPES}. */
|
|
54
|
+
declare const REGISTRY_ITEM_TYPES: {
|
|
55
|
+
readonly "registry:ui": {
|
|
56
|
+
readonly slug: "ui";
|
|
57
|
+
readonly title: "UI Primitives";
|
|
58
|
+
};
|
|
59
|
+
readonly "registry:component": {
|
|
60
|
+
readonly slug: "components";
|
|
61
|
+
readonly title: "Components";
|
|
62
|
+
};
|
|
63
|
+
readonly "registry:page": {
|
|
64
|
+
readonly slug: "pages";
|
|
65
|
+
readonly title: "Pages";
|
|
66
|
+
};
|
|
67
|
+
readonly "registry:block": {
|
|
68
|
+
readonly slug: "blocks";
|
|
69
|
+
readonly title: "Blocks";
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
type ComponentDocType = keyof typeof COMPONENT_TYPES;
|
|
73
|
+
type RegistryItemType = keyof typeof REGISTRY_ITEM_TYPES;
|
|
74
|
+
/** A documented component type together with its matching items. */
|
|
75
|
+
interface RegistryItemPage {
|
|
76
|
+
type: ComponentDocType;
|
|
77
|
+
slug: string;
|
|
78
|
+
title: string;
|
|
79
|
+
items: Record<string, unknown>[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Extract documented components from `schema.components`, grouped by type.
|
|
83
|
+
*
|
|
84
|
+
* Only `ui`, `component`, `page` and `block` items are documented — one page
|
|
85
|
+
* per type.
|
|
86
|
+
*/
|
|
87
|
+
declare function extractRegistryItems(components: unknown): RegistryItemPage[];
|
|
88
|
+
/**
|
|
89
|
+
* Render an MDX documentation page for all components of a single type.
|
|
90
|
+
*/
|
|
91
|
+
declare function renderRegistryItemsMdx(page: RegistryItemPage): string;
|
|
92
|
+
/**
|
|
93
|
+
* Generate MDX documentation pages from a Razorwind schema.
|
|
94
|
+
*
|
|
95
|
+
* Produces an index page, one page per top-level token group, component
|
|
96
|
+
* pages grouped by type, and a flattened `tokens.json` manifest.
|
|
97
|
+
*/
|
|
98
|
+
declare function generateDocs(spec: Schema, options?: DocgenGeneratePluginOptions): GeneratorFunctionResult<Schema, DocgenGeneratePluginOptions>;
|
|
99
|
+
/**
|
|
100
|
+
* Generate MDX documentation pages from a Razorwind schema.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* import { defineConfig } from "@razorwind/core";
|
|
105
|
+
* import docgen from "@razorwind/docgen/generate";
|
|
106
|
+
*
|
|
107
|
+
* export default defineConfig({
|
|
108
|
+
* plugins: [docgen()]
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare const _default: (options?: DocgenGeneratePluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
113
|
+
//#endregion
|
|
114
|
+
export { COMPONENT_TYPES, ComponentDocType, REGISTRY_ITEM_TYPES, RegistryItemPage, RegistryItemType, _default as default, extractRegistryItems, generateDocs, groupTokens, renderGroupMdx, renderIndexMdx, renderRegistryItemsMdx, renderTokenTable, generate_d_exports as t, tokenGroup };
|
|
115
|
+
//# sourceMappingURL=generate.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.cts","names":[],"sources":["../src/generate.ts"],"mappings":";;;;;;;iBA4CgB,WAAW,OAAO;;;;iBAOlB,YAAY,QAAQ,cAAc,YAAY;;;;iBAoB9C,iBAAiB,QAAQ;;;;iBAiDzB,eAAe,eAAe,QAAQ;;;;iBA8BtC,eAAe;EAC7B;EACA,QAAQ,YAAY;EACpB;EACA;IAAmB;IAAc;IAAe;;;;cA8CrC;;;;;;;;;;;;;;;;;;;cAQA;;;;;;;;;;;;;;;;;;KAOD,gCAAgC;KAChC,gCAAgC;;UAG3B;EACf,MAAM;EACN;EACA;EACA,OAAO;;;;;;;;iBA4DO,qBAAqB,sBAAsB;;;;iBAmH3C,uBAAuB,MAAM;;;;;;;iBAwC7B,aACd,MAAM,QACN,UAAS,8BACR,wBAAwB,QAAQ"}
|
package/dist/generate.d.mts
CHANGED
|
@@ -1,2 +1,115 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { n as DocgenGeneratePluginOptions, r as FlatToken } from "./types-L9_4rtz5.mjs";
|
|
2
|
+
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
3
|
+
import { Schema } from "@razorwind/core/schema";
|
|
4
|
+
declare namespace generate_d_exports {
|
|
5
|
+
export { COMPONENT_TYPES, ComponentDocType, REGISTRY_ITEM_TYPES, RegistryItemPage, RegistryItemType, _default as default, extractRegistryItems, generateDocs, groupTokens, renderGroupMdx, renderIndexMdx, renderRegistryItemsMdx, renderTokenTable, tokenGroup };
|
|
6
|
+
}
|
|
7
|
+
/** Top-level path segment used to group tokens into pages. */
|
|
8
|
+
declare function tokenGroup(token: FlatToken): string;
|
|
9
|
+
/**
|
|
10
|
+
* Group flattened tokens by their top-level path segment.
|
|
11
|
+
*/
|
|
12
|
+
declare function groupTokens(tokens: FlatToken[]): Map<string, FlatToken[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Render a markdown token table for a set of flattened tokens.
|
|
15
|
+
*/
|
|
16
|
+
declare function renderTokenTable(tokens: FlatToken[]): string;
|
|
17
|
+
/**
|
|
18
|
+
* Render an MDX documentation page for a single token group.
|
|
19
|
+
*/
|
|
20
|
+
declare function renderGroupMdx(group: string, tokens: FlatToken[]): string;
|
|
21
|
+
/**
|
|
22
|
+
* Render the documentation index page linking to every generated page.
|
|
23
|
+
*/
|
|
24
|
+
declare function renderIndexMdx(input: {
|
|
25
|
+
title: string;
|
|
26
|
+
groups: Map<string, FlatToken[]>;
|
|
27
|
+
hasComponents: boolean;
|
|
28
|
+
componentPages?: {
|
|
29
|
+
slug: string;
|
|
30
|
+
title: string;
|
|
31
|
+
count: number;
|
|
32
|
+
}[];
|
|
33
|
+
}): string;
|
|
34
|
+
/** Component types that receive a dedicated documentation page. */
|
|
35
|
+
declare const COMPONENT_TYPES: {
|
|
36
|
+
readonly ui: {
|
|
37
|
+
readonly slug: "ui";
|
|
38
|
+
readonly title: "UI Primitives";
|
|
39
|
+
};
|
|
40
|
+
readonly component: {
|
|
41
|
+
readonly slug: "components";
|
|
42
|
+
readonly title: "Components";
|
|
43
|
+
};
|
|
44
|
+
readonly page: {
|
|
45
|
+
readonly slug: "pages";
|
|
46
|
+
readonly title: "Pages";
|
|
47
|
+
};
|
|
48
|
+
readonly block: {
|
|
49
|
+
readonly slug: "blocks";
|
|
50
|
+
readonly title: "Blocks";
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
/** @deprecated Use {@link COMPONENT_TYPES}. */
|
|
54
|
+
declare const REGISTRY_ITEM_TYPES: {
|
|
55
|
+
readonly "registry:ui": {
|
|
56
|
+
readonly slug: "ui";
|
|
57
|
+
readonly title: "UI Primitives";
|
|
58
|
+
};
|
|
59
|
+
readonly "registry:component": {
|
|
60
|
+
readonly slug: "components";
|
|
61
|
+
readonly title: "Components";
|
|
62
|
+
};
|
|
63
|
+
readonly "registry:page": {
|
|
64
|
+
readonly slug: "pages";
|
|
65
|
+
readonly title: "Pages";
|
|
66
|
+
};
|
|
67
|
+
readonly "registry:block": {
|
|
68
|
+
readonly slug: "blocks";
|
|
69
|
+
readonly title: "Blocks";
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
type ComponentDocType = keyof typeof COMPONENT_TYPES;
|
|
73
|
+
type RegistryItemType = keyof typeof REGISTRY_ITEM_TYPES;
|
|
74
|
+
/** A documented component type together with its matching items. */
|
|
75
|
+
interface RegistryItemPage {
|
|
76
|
+
type: ComponentDocType;
|
|
77
|
+
slug: string;
|
|
78
|
+
title: string;
|
|
79
|
+
items: Record<string, unknown>[];
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Extract documented components from `schema.components`, grouped by type.
|
|
83
|
+
*
|
|
84
|
+
* Only `ui`, `component`, `page` and `block` items are documented — one page
|
|
85
|
+
* per type.
|
|
86
|
+
*/
|
|
87
|
+
declare function extractRegistryItems(components: unknown): RegistryItemPage[];
|
|
88
|
+
/**
|
|
89
|
+
* Render an MDX documentation page for all components of a single type.
|
|
90
|
+
*/
|
|
91
|
+
declare function renderRegistryItemsMdx(page: RegistryItemPage): string;
|
|
92
|
+
/**
|
|
93
|
+
* Generate MDX documentation pages from a Razorwind schema.
|
|
94
|
+
*
|
|
95
|
+
* Produces an index page, one page per top-level token group, component
|
|
96
|
+
* pages grouped by type, and a flattened `tokens.json` manifest.
|
|
97
|
+
*/
|
|
98
|
+
declare function generateDocs(spec: Schema, options?: DocgenGeneratePluginOptions): GeneratorFunctionResult<Schema, DocgenGeneratePluginOptions>;
|
|
99
|
+
/**
|
|
100
|
+
* Generate MDX documentation pages from a Razorwind schema.
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```ts
|
|
104
|
+
* import { defineConfig } from "@razorwind/core";
|
|
105
|
+
* import docgen from "@razorwind/docgen/generate";
|
|
106
|
+
*
|
|
107
|
+
* export default defineConfig({
|
|
108
|
+
* plugins: [docgen()]
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
declare const _default: (options?: DocgenGeneratePluginOptions | undefined) => import("@razorwind/core/plugin").Plugin;
|
|
113
|
+
//#endregion
|
|
114
|
+
export { COMPONENT_TYPES, ComponentDocType, REGISTRY_ITEM_TYPES, RegistryItemPage, RegistryItemType, _default as default, extractRegistryItems, generateDocs, groupTokens, renderGroupMdx, renderIndexMdx, renderRegistryItemsMdx, renderTokenTable, generate_d_exports as t, tokenGroup };
|
|
115
|
+
//# sourceMappingURL=generate.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.mts","names":[],"sources":["../src/generate.ts"],"mappings":""}
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { TokenType } from "@power-plant/dtcg-schema";
|
|
2
|
+
//#endregion
|
|
3
|
+
//#region src/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Options for the Razorwind MDX documentation extract plugin.
|
|
6
|
+
*/
|
|
7
|
+
interface DocgenExtractPluginOptions {}
|
|
8
|
+
/**
|
|
9
|
+
* Options for the Razorwind MDX documentation generator.
|
|
10
|
+
*/
|
|
11
|
+
interface DocgenGeneratePluginOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Directory (relative to the execution cwd) where generated docs are written.
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue `"docs/design-system"`
|
|
16
|
+
*/
|
|
17
|
+
outDir?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Title used on the generated documentation index page.
|
|
20
|
+
*
|
|
21
|
+
* @defaultValue `"Design System"`
|
|
22
|
+
*/
|
|
23
|
+
title?: string;
|
|
24
|
+
/**
|
|
25
|
+
* CSS custom-property prefix used when emitting `var(--…)` references.
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue `"rw"`
|
|
28
|
+
*/
|
|
29
|
+
cssVarPrefix?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Restrict generated docs to these DTCG `$type` values.
|
|
32
|
+
* When omitted, all supported types are included.
|
|
33
|
+
*/
|
|
34
|
+
includeTypes?: TokenType[];
|
|
35
|
+
/**
|
|
36
|
+
* Skip generating component documentation pages.
|
|
37
|
+
*
|
|
38
|
+
* @defaultValue `false`
|
|
39
|
+
*/
|
|
40
|
+
skipRegistry?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A flattened design token ready for documentation rendering.
|
|
44
|
+
*/
|
|
45
|
+
interface FlatToken {
|
|
46
|
+
/** Dot-separated token path (e.g. `color.primary`). */
|
|
47
|
+
path: string;
|
|
48
|
+
/** DTCG `$type`, when known. */
|
|
49
|
+
type?: TokenType | string;
|
|
50
|
+
/** Raw `$value` from the token document. */
|
|
51
|
+
value: unknown;
|
|
52
|
+
/** CSS-friendly string form of {@link value}. */
|
|
53
|
+
cssValue: string;
|
|
54
|
+
/** Stable CSS custom property name for this path. */
|
|
55
|
+
cssVar: string;
|
|
56
|
+
/** Optional DTCG `$description`. */
|
|
57
|
+
description?: string;
|
|
58
|
+
/** Theme / set id when tokens are a `Record<string, Tokens>`. */
|
|
59
|
+
theme?: string;
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { __exportAll as i, DocgenGeneratePluginOptions as n, FlatToken as r, DocgenExtractPluginOptions as t };
|
|
63
|
+
//# sourceMappingURL=types-BIi5hVjx.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-BIi5hVjx.d.cts","names":[],"sources":["../src/types.ts"],"mappings":";;;;;;UAuBiB;;;;UAKA;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,eAAe;;;;;;EAOf;;;;;UAMe;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;EAEA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { TokenType } from "@power-plant/dtcg-schema";
|
|
2
|
+
//#region src/types.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Options for the Razorwind MDX documentation extract plugin.
|
|
5
|
+
*/
|
|
6
|
+
interface DocgenExtractPluginOptions {}
|
|
7
|
+
/**
|
|
8
|
+
* Options for the Razorwind MDX documentation generator.
|
|
9
|
+
*/
|
|
10
|
+
interface DocgenGeneratePluginOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Directory (relative to the execution cwd) where generated docs are written.
|
|
13
|
+
*
|
|
14
|
+
* @defaultValue `"docs/design-system"`
|
|
15
|
+
*/
|
|
16
|
+
outDir?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Title used on the generated documentation index page.
|
|
19
|
+
*
|
|
20
|
+
* @defaultValue `"Design System"`
|
|
21
|
+
*/
|
|
22
|
+
title?: string;
|
|
23
|
+
/**
|
|
24
|
+
* CSS custom-property prefix used when emitting `var(--…)` references.
|
|
25
|
+
*
|
|
26
|
+
* @defaultValue `"rw"`
|
|
27
|
+
*/
|
|
28
|
+
cssVarPrefix?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Restrict generated docs to these DTCG `$type` values.
|
|
31
|
+
* When omitted, all supported types are included.
|
|
32
|
+
*/
|
|
33
|
+
includeTypes?: TokenType[];
|
|
34
|
+
/**
|
|
35
|
+
* Skip generating component documentation pages.
|
|
36
|
+
*
|
|
37
|
+
* @defaultValue `false`
|
|
38
|
+
*/
|
|
39
|
+
skipRegistry?: boolean;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* A flattened design token ready for documentation rendering.
|
|
43
|
+
*/
|
|
44
|
+
interface FlatToken {
|
|
45
|
+
/** Dot-separated token path (e.g. `color.primary`). */
|
|
46
|
+
path: string;
|
|
47
|
+
/** DTCG `$type`, when known. */
|
|
48
|
+
type?: TokenType | string;
|
|
49
|
+
/** Raw `$value` from the token document. */
|
|
50
|
+
value: unknown;
|
|
51
|
+
/** CSS-friendly string form of {@link value}. */
|
|
52
|
+
cssValue: string;
|
|
53
|
+
/** Stable CSS custom property name for this path. */
|
|
54
|
+
cssVar: string;
|
|
55
|
+
/** Optional DTCG `$description`. */
|
|
56
|
+
description?: string;
|
|
57
|
+
/** Theme / set id when tokens are a `Record<string, Tokens>`. */
|
|
58
|
+
theme?: string;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { DocgenGeneratePluginOptions as n, FlatToken as r, DocgenExtractPluginOptions as t };
|
|
62
|
+
//# sourceMappingURL=types-L9_4rtz5.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types-L9_4rtz5.d.mts","names":[],"sources":["../src/types.ts"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@razorwind/docgen",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Razorwind plugin that creates MDX documentation for the tokens/components defined in the design system.",
|
|
6
6
|
"repository": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"dependencies": {
|
|
100
100
|
"@power-plant/core": "^0.0.61",
|
|
101
101
|
"@power-plant/dtcg-schema": "^0.0.1",
|
|
102
|
-
"@razorwind/core": "^0.0.
|
|
102
|
+
"@razorwind/core": "^0.0.17",
|
|
103
103
|
"@stryke/type-checks": "^0.6.32"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"typescript": "^6.0.3"
|
|
109
109
|
},
|
|
110
110
|
"publishConfig": { "access": "public" },
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "3cc5b85aebb2434cd4395b99e9cab9b9223ff6db"
|
|
112
112
|
}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
2
|
-
import { Schema } from "@razorwind/core/schema";
|
|
3
|
-
import { TokenType } from "@power-plant/dtcg-schema";
|
|
4
|
-
//#region src/types.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Options for the Razorwind MDX documentation generator.
|
|
7
|
-
*/
|
|
8
|
-
interface DocgenGeneratePluginOptions {
|
|
9
|
-
/**
|
|
10
|
-
* Directory (relative to the execution cwd) where generated docs are written.
|
|
11
|
-
*
|
|
12
|
-
* @defaultValue `"docs/design-system"`
|
|
13
|
-
*/
|
|
14
|
-
outDir?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Title used on the generated documentation index page.
|
|
17
|
-
*
|
|
18
|
-
* @defaultValue `"Design System"`
|
|
19
|
-
*/
|
|
20
|
-
title?: string;
|
|
21
|
-
/**
|
|
22
|
-
* CSS custom-property prefix used when emitting `var(--…)` references.
|
|
23
|
-
*
|
|
24
|
-
* @defaultValue `"rw"`
|
|
25
|
-
*/
|
|
26
|
-
cssVarPrefix?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Restrict generated docs to these DTCG `$type` values.
|
|
29
|
-
* When omitted, all supported types are included.
|
|
30
|
-
*/
|
|
31
|
-
includeTypes?: TokenType[];
|
|
32
|
-
/**
|
|
33
|
-
* Skip generating component documentation pages.
|
|
34
|
-
*
|
|
35
|
-
* @defaultValue `false`
|
|
36
|
-
*/
|
|
37
|
-
skipRegistry?: boolean;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* A flattened design token ready for documentation rendering.
|
|
41
|
-
*/
|
|
42
|
-
interface FlatToken {
|
|
43
|
-
/** Dot-separated token path (e.g. `color.primary`). */
|
|
44
|
-
path: string;
|
|
45
|
-
/** DTCG `$type`, when known. */
|
|
46
|
-
type?: TokenType | string;
|
|
47
|
-
/** Raw `$value` from the token document. */
|
|
48
|
-
value: unknown;
|
|
49
|
-
/** CSS-friendly string form of {@link value}. */
|
|
50
|
-
cssValue: string;
|
|
51
|
-
/** Stable CSS custom property name for this path. */
|
|
52
|
-
cssVar: string;
|
|
53
|
-
/** Optional DTCG `$description`. */
|
|
54
|
-
description?: string;
|
|
55
|
-
/** Theme / set id when tokens are a `Record<string, Tokens>`. */
|
|
56
|
-
theme?: string;
|
|
57
|
-
}
|
|
58
|
-
declare namespace generate_d_exports {
|
|
59
|
-
export { COMPONENT_TYPES, ComponentDocType, REGISTRY_ITEM_TYPES, RegistryItemPage, RegistryItemType, _default as default, extractRegistryItems, generateDocs, groupTokens, renderGroupMdx, renderIndexMdx, renderRegistryItemsMdx, renderTokenTable, tokenGroup };
|
|
60
|
-
}
|
|
61
|
-
/** Top-level path segment used to group tokens into pages. */
|
|
62
|
-
declare function tokenGroup(token: FlatToken): string;
|
|
63
|
-
/**
|
|
64
|
-
* Group flattened tokens by their top-level path segment.
|
|
65
|
-
*/
|
|
66
|
-
declare function groupTokens(tokens: FlatToken[]): Map<string, FlatToken[]>;
|
|
67
|
-
/**
|
|
68
|
-
* Render a markdown token table for a set of flattened tokens.
|
|
69
|
-
*/
|
|
70
|
-
declare function renderTokenTable(tokens: FlatToken[]): string;
|
|
71
|
-
/**
|
|
72
|
-
* Render an MDX documentation page for a single token group.
|
|
73
|
-
*/
|
|
74
|
-
declare function renderGroupMdx(group: string, tokens: FlatToken[]): string;
|
|
75
|
-
/**
|
|
76
|
-
* Render the documentation index page linking to every generated page.
|
|
77
|
-
*/
|
|
78
|
-
declare function renderIndexMdx(input: {
|
|
79
|
-
title: string;
|
|
80
|
-
groups: Map<string, FlatToken[]>;
|
|
81
|
-
hasComponents: boolean;
|
|
82
|
-
componentPages?: {
|
|
83
|
-
slug: string;
|
|
84
|
-
title: string;
|
|
85
|
-
count: number;
|
|
86
|
-
}[];
|
|
87
|
-
}): string;
|
|
88
|
-
/** Component types that receive a dedicated documentation page. */
|
|
89
|
-
declare const COMPONENT_TYPES: {
|
|
90
|
-
readonly ui: {
|
|
91
|
-
readonly slug: "ui";
|
|
92
|
-
readonly title: "UI Primitives";
|
|
93
|
-
};
|
|
94
|
-
readonly component: {
|
|
95
|
-
readonly slug: "components";
|
|
96
|
-
readonly title: "Components";
|
|
97
|
-
};
|
|
98
|
-
readonly page: {
|
|
99
|
-
readonly slug: "pages";
|
|
100
|
-
readonly title: "Pages";
|
|
101
|
-
};
|
|
102
|
-
readonly block: {
|
|
103
|
-
readonly slug: "blocks";
|
|
104
|
-
readonly title: "Blocks";
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
/** @deprecated Use {@link COMPONENT_TYPES}. */
|
|
108
|
-
declare const REGISTRY_ITEM_TYPES: {
|
|
109
|
-
readonly "registry:ui": {
|
|
110
|
-
readonly slug: "ui";
|
|
111
|
-
readonly title: "UI Primitives";
|
|
112
|
-
};
|
|
113
|
-
readonly "registry:component": {
|
|
114
|
-
readonly slug: "components";
|
|
115
|
-
readonly title: "Components";
|
|
116
|
-
};
|
|
117
|
-
readonly "registry:page": {
|
|
118
|
-
readonly slug: "pages";
|
|
119
|
-
readonly title: "Pages";
|
|
120
|
-
};
|
|
121
|
-
readonly "registry:block": {
|
|
122
|
-
readonly slug: "blocks";
|
|
123
|
-
readonly title: "Blocks";
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
type ComponentDocType = keyof typeof COMPONENT_TYPES;
|
|
127
|
-
type RegistryItemType = keyof typeof REGISTRY_ITEM_TYPES;
|
|
128
|
-
/** A documented component type together with its matching items. */
|
|
129
|
-
interface RegistryItemPage {
|
|
130
|
-
type: ComponentDocType;
|
|
131
|
-
slug: string;
|
|
132
|
-
title: string;
|
|
133
|
-
items: Record<string, unknown>[];
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Extract documented components from `schema.components`, grouped by type.
|
|
137
|
-
*
|
|
138
|
-
* Only `ui`, `component`, `page` and `block` items are documented — one page
|
|
139
|
-
* per type.
|
|
140
|
-
*/
|
|
141
|
-
declare function extractRegistryItems(components: unknown): RegistryItemPage[];
|
|
142
|
-
/**
|
|
143
|
-
* Render an MDX documentation page for all components of a single type.
|
|
144
|
-
*/
|
|
145
|
-
declare function renderRegistryItemsMdx(page: RegistryItemPage): string;
|
|
146
|
-
/**
|
|
147
|
-
* Generate MDX documentation pages from a Razorwind schema.
|
|
148
|
-
*
|
|
149
|
-
* Produces an index page, one page per top-level token group, component
|
|
150
|
-
* pages grouped by type, and a flattened `tokens.json` manifest.
|
|
151
|
-
*/
|
|
152
|
-
declare function generateDocs(spec: Schema, options?: DocgenGeneratePluginOptions): GeneratorFunctionResult<Schema, DocgenGeneratePluginOptions>;
|
|
153
|
-
/**
|
|
154
|
-
* Generate MDX documentation pages from a Razorwind schema.
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* ```ts
|
|
158
|
-
* import { defineConfig } from "@razorwind/core";
|
|
159
|
-
* import docgen from "@razorwind/docgen/generate";
|
|
160
|
-
*
|
|
161
|
-
* export default defineConfig({
|
|
162
|
-
* plugins: [docgen()]
|
|
163
|
-
* });
|
|
164
|
-
* ```
|
|
165
|
-
*/
|
|
166
|
-
declare const _default: (options?: any) => import("@razorwind/core/plugin").Plugin;
|
|
167
|
-
//#endregion
|
|
168
|
-
export { RegistryItemType as a, generateDocs as c, renderGroupMdx as d, renderIndexMdx as f, tokenGroup as h, RegistryItemPage as i, generate_d_exports as l, renderTokenTable as m, ComponentDocType as n, _default as o, renderRegistryItemsMdx as p, REGISTRY_ITEM_TYPES as r, extractRegistryItems as s, COMPONENT_TYPES as t, groupTokens as u };
|
|
169
|
-
//# sourceMappingURL=generate-hhZ24R_4.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-hhZ24R_4.d.cts","names":[],"sources":["../src/types.ts","../src/generate.ts"],"mappings":";;;;;;;UA4BiB;;;;;;EAMf;;;;;;EAOA;;;;;;EAOA;;;;;EAMA,eAAe;;;;;;EAOf;;;;;UAMe;;EAEf;;EAEA,OAAO;;EAEP;;EAEA;;EAEA;;EAEA;;EAEA;;;;;;iBCrCc,WAAW,OAAO;;;;iBAOlB,YAAY,QAAQ,cAAc,YAAY;;;;iBAoB9C,iBAAiB,QAAQ;;;;iBAiDzB,eAAe,eAAe,QAAQ;;;;iBA8BtC,eAAe;EAC7B;EACA,QAAQ,YAAY;EACpB;EACA;IAAmB;IAAc;IAAe;;;;cA8CrC;;;;;;;;;;;;;;;;;;;cAQA;;;;;;;;;;;;;;;;;;KAOD,gCAAgC;KAChC,gCAAgC;;UAG3B;EACf,MAAM;EACN;EACA;EACA,OAAO;;;;;;;;iBA4DO,qBAAqB,sBAAsB;;;;iBAmH3C,uBAAuB,MAAM;;;;;;;iBAwC7B,aACd,MAAM,QACN,UAAS,8BACR,wBAAwB,QAAQ"}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { GeneratorFunctionResult } from "@power-plant/core";
|
|
2
|
-
import { Schema } from "@razorwind/core/schema";
|
|
3
|
-
import { TokenType } from "@power-plant/dtcg-schema";
|
|
4
|
-
//#region src/types.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Options for the Razorwind MDX documentation generator.
|
|
7
|
-
*/
|
|
8
|
-
interface DocgenGeneratePluginOptions {
|
|
9
|
-
/**
|
|
10
|
-
* Directory (relative to the execution cwd) where generated docs are written.
|
|
11
|
-
*
|
|
12
|
-
* @defaultValue `"docs/design-system"`
|
|
13
|
-
*/
|
|
14
|
-
outDir?: string;
|
|
15
|
-
/**
|
|
16
|
-
* Title used on the generated documentation index page.
|
|
17
|
-
*
|
|
18
|
-
* @defaultValue `"Design System"`
|
|
19
|
-
*/
|
|
20
|
-
title?: string;
|
|
21
|
-
/**
|
|
22
|
-
* CSS custom-property prefix used when emitting `var(--…)` references.
|
|
23
|
-
*
|
|
24
|
-
* @defaultValue `"rw"`
|
|
25
|
-
*/
|
|
26
|
-
cssVarPrefix?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Restrict generated docs to these DTCG `$type` values.
|
|
29
|
-
* When omitted, all supported types are included.
|
|
30
|
-
*/
|
|
31
|
-
includeTypes?: TokenType[];
|
|
32
|
-
/**
|
|
33
|
-
* Skip generating component documentation pages.
|
|
34
|
-
*
|
|
35
|
-
* @defaultValue `false`
|
|
36
|
-
*/
|
|
37
|
-
skipRegistry?: boolean;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* A flattened design token ready for documentation rendering.
|
|
41
|
-
*/
|
|
42
|
-
interface FlatToken {
|
|
43
|
-
/** Dot-separated token path (e.g. `color.primary`). */
|
|
44
|
-
path: string;
|
|
45
|
-
/** DTCG `$type`, when known. */
|
|
46
|
-
type?: TokenType | string;
|
|
47
|
-
/** Raw `$value` from the token document. */
|
|
48
|
-
value: unknown;
|
|
49
|
-
/** CSS-friendly string form of {@link value}. */
|
|
50
|
-
cssValue: string;
|
|
51
|
-
/** Stable CSS custom property name for this path. */
|
|
52
|
-
cssVar: string;
|
|
53
|
-
/** Optional DTCG `$description`. */
|
|
54
|
-
description?: string;
|
|
55
|
-
/** Theme / set id when tokens are a `Record<string, Tokens>`. */
|
|
56
|
-
theme?: string;
|
|
57
|
-
}
|
|
58
|
-
declare namespace generate_d_exports {
|
|
59
|
-
export { COMPONENT_TYPES, ComponentDocType, REGISTRY_ITEM_TYPES, RegistryItemPage, RegistryItemType, _default as default, extractRegistryItems, generateDocs, groupTokens, renderGroupMdx, renderIndexMdx, renderRegistryItemsMdx, renderTokenTable, tokenGroup };
|
|
60
|
-
}
|
|
61
|
-
/** Top-level path segment used to group tokens into pages. */
|
|
62
|
-
declare function tokenGroup(token: FlatToken): string;
|
|
63
|
-
/**
|
|
64
|
-
* Group flattened tokens by their top-level path segment.
|
|
65
|
-
*/
|
|
66
|
-
declare function groupTokens(tokens: FlatToken[]): Map<string, FlatToken[]>;
|
|
67
|
-
/**
|
|
68
|
-
* Render a markdown token table for a set of flattened tokens.
|
|
69
|
-
*/
|
|
70
|
-
declare function renderTokenTable(tokens: FlatToken[]): string;
|
|
71
|
-
/**
|
|
72
|
-
* Render an MDX documentation page for a single token group.
|
|
73
|
-
*/
|
|
74
|
-
declare function renderGroupMdx(group: string, tokens: FlatToken[]): string;
|
|
75
|
-
/**
|
|
76
|
-
* Render the documentation index page linking to every generated page.
|
|
77
|
-
*/
|
|
78
|
-
declare function renderIndexMdx(input: {
|
|
79
|
-
title: string;
|
|
80
|
-
groups: Map<string, FlatToken[]>;
|
|
81
|
-
hasComponents: boolean;
|
|
82
|
-
componentPages?: {
|
|
83
|
-
slug: string;
|
|
84
|
-
title: string;
|
|
85
|
-
count: number;
|
|
86
|
-
}[];
|
|
87
|
-
}): string;
|
|
88
|
-
/** Component types that receive a dedicated documentation page. */
|
|
89
|
-
declare const COMPONENT_TYPES: {
|
|
90
|
-
readonly ui: {
|
|
91
|
-
readonly slug: "ui";
|
|
92
|
-
readonly title: "UI Primitives";
|
|
93
|
-
};
|
|
94
|
-
readonly component: {
|
|
95
|
-
readonly slug: "components";
|
|
96
|
-
readonly title: "Components";
|
|
97
|
-
};
|
|
98
|
-
readonly page: {
|
|
99
|
-
readonly slug: "pages";
|
|
100
|
-
readonly title: "Pages";
|
|
101
|
-
};
|
|
102
|
-
readonly block: {
|
|
103
|
-
readonly slug: "blocks";
|
|
104
|
-
readonly title: "Blocks";
|
|
105
|
-
};
|
|
106
|
-
};
|
|
107
|
-
/** @deprecated Use {@link COMPONENT_TYPES}. */
|
|
108
|
-
declare const REGISTRY_ITEM_TYPES: {
|
|
109
|
-
readonly "registry:ui": {
|
|
110
|
-
readonly slug: "ui";
|
|
111
|
-
readonly title: "UI Primitives";
|
|
112
|
-
};
|
|
113
|
-
readonly "registry:component": {
|
|
114
|
-
readonly slug: "components";
|
|
115
|
-
readonly title: "Components";
|
|
116
|
-
};
|
|
117
|
-
readonly "registry:page": {
|
|
118
|
-
readonly slug: "pages";
|
|
119
|
-
readonly title: "Pages";
|
|
120
|
-
};
|
|
121
|
-
readonly "registry:block": {
|
|
122
|
-
readonly slug: "blocks";
|
|
123
|
-
readonly title: "Blocks";
|
|
124
|
-
};
|
|
125
|
-
};
|
|
126
|
-
type ComponentDocType = keyof typeof COMPONENT_TYPES;
|
|
127
|
-
type RegistryItemType = keyof typeof REGISTRY_ITEM_TYPES;
|
|
128
|
-
/** A documented component type together with its matching items. */
|
|
129
|
-
interface RegistryItemPage {
|
|
130
|
-
type: ComponentDocType;
|
|
131
|
-
slug: string;
|
|
132
|
-
title: string;
|
|
133
|
-
items: Record<string, unknown>[];
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Extract documented components from `schema.components`, grouped by type.
|
|
137
|
-
*
|
|
138
|
-
* Only `ui`, `component`, `page` and `block` items are documented — one page
|
|
139
|
-
* per type.
|
|
140
|
-
*/
|
|
141
|
-
declare function extractRegistryItems(components: unknown): RegistryItemPage[];
|
|
142
|
-
/**
|
|
143
|
-
* Render an MDX documentation page for all components of a single type.
|
|
144
|
-
*/
|
|
145
|
-
declare function renderRegistryItemsMdx(page: RegistryItemPage): string;
|
|
146
|
-
/**
|
|
147
|
-
* Generate MDX documentation pages from a Razorwind schema.
|
|
148
|
-
*
|
|
149
|
-
* Produces an index page, one page per top-level token group, component
|
|
150
|
-
* pages grouped by type, and a flattened `tokens.json` manifest.
|
|
151
|
-
*/
|
|
152
|
-
declare function generateDocs(spec: Schema, options?: DocgenGeneratePluginOptions): GeneratorFunctionResult<Schema, DocgenGeneratePluginOptions>;
|
|
153
|
-
/**
|
|
154
|
-
* Generate MDX documentation pages from a Razorwind schema.
|
|
155
|
-
*
|
|
156
|
-
* @example
|
|
157
|
-
* ```ts
|
|
158
|
-
* import { defineConfig } from "@razorwind/core";
|
|
159
|
-
* import docgen from "@razorwind/docgen/generate";
|
|
160
|
-
*
|
|
161
|
-
* export default defineConfig({
|
|
162
|
-
* plugins: [docgen()]
|
|
163
|
-
* });
|
|
164
|
-
* ```
|
|
165
|
-
*/
|
|
166
|
-
declare const _default: (options?: any) => import("@razorwind/core/plugin").Plugin;
|
|
167
|
-
//#endregion
|
|
168
|
-
export { RegistryItemType as a, generateDocs as c, renderGroupMdx as d, renderIndexMdx as f, tokenGroup as h, RegistryItemPage as i, generate_d_exports as l, renderTokenTable as m, ComponentDocType as n, _default as o, renderRegistryItemsMdx as p, REGISTRY_ITEM_TYPES as r, extractRegistryItems as s, COMPONENT_TYPES as t, groupTokens as u };
|
|
169
|
-
//# sourceMappingURL=generate-hhZ24R_4.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-hhZ24R_4.d.mts","names":[],"sources":["../src/types.ts","../src/generate.ts"],"mappings":""}
|