rspress-plugin-api-extractor 0.1.2 → 0.2.1
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 +2 -2
- package/api-extracted-package.js +426 -0
- package/build-program.js +120 -0
- package/build-stages.js +664 -0
- package/category-resolver.js +50 -0
- package/code-post-processor.js +38 -0
- package/config-helpers.js +106 -0
- package/config-utils.js +258 -0
- package/content-hash.js +79 -0
- package/errors.js +29 -0
- package/formatter.js +69 -0
- package/hide-cut-transformer.js +96 -0
- package/index.d.ts +901 -831
- package/index.js +4 -6128
- package/layers/ConfigServiceLive.js +377 -0
- package/layers/ObservabilityLive.js +136 -0
- package/layers/PathDerivationServiceLive.js +16 -0
- package/layers/SnapshotServiceLive.js +94 -0
- package/layers/TypeRegistryServiceLive.js +46 -0
- package/llms-processing.js +270 -0
- package/llms-program.js +262 -0
- package/loader.js +186 -0
- package/markdown/cross-linker.js +156 -0
- package/markdown/helpers.js +364 -0
- package/markdown/index.js +11 -0
- package/markdown/page-generators/class-page.js +357 -0
- package/markdown/page-generators/enum-page.js +152 -0
- package/markdown/page-generators/function-page.js +127 -0
- package/markdown/page-generators/index-pages.js +27 -0
- package/markdown/page-generators/interface-page.js +307 -0
- package/markdown/page-generators/namespace-page.js +280 -0
- package/markdown/page-generators/type-alias-page.js +110 -0
- package/markdown/page-generators/variable-page.js +110 -0
- package/markdown/shiki-utils.js +48 -0
- package/migrations/001_create_snapshots.js +25 -0
- package/model-loader.js +95 -0
- package/multi-entry-resolver.js +70 -0
- package/og-resolver.js +271 -0
- package/package.json +64 -73
- package/path-derivation.js +48 -0
- package/plugin.js +218 -0
- package/prettier-formatter.js +73 -0
- package/public/tsconfig/rspress.json +44 -0
- package/remark-api-codeblocks.js +130 -0
- package/remark-with-api.js +172 -0
- package/route-collisions.js +52 -0
- package/runtime/components/ApiExample/index.js +29 -25
- package/runtime/components/ApiLlmsPackageActions/index.js +252 -323
- package/runtime/components/ApiLlmsViewOptions/index.js +269 -340
- package/runtime/components/ApiMember/index.js +49 -47
- package/runtime/components/ApiSignature/index.js +32 -28
- package/runtime/components/EnumMembersTable/{index_module.css → index.css} +18 -19
- package/runtime/components/EnumMembersTable/index.js +36 -67
- package/runtime/components/EnumMembersTable/index.module.js +9 -6
- package/runtime/components/ExampleBlock/{index_module.css → index.css} +2 -3
- package/runtime/components/ExampleBlock/index.js +23 -28
- package/runtime/components/ExampleBlock/index.module.js +8 -5
- package/runtime/components/MarkdownContent/index.js +26 -18
- package/runtime/components/MarkdownText/index.js +28 -22
- package/runtime/components/MemberSignature/{index_module.css → index.css} +5 -6
- package/runtime/components/MemberSignature/index.js +46 -46
- package/runtime/components/MemberSignature/index.module.js +9 -6
- package/runtime/components/ParametersTable/{index_module.css → index.css} +19 -20
- package/runtime/components/ParametersTable/index.js +36 -67
- package/runtime/components/ParametersTable/index.module.js +9 -6
- package/runtime/components/SignatureBlock/{index_module.css → index.css} +5 -6
- package/runtime/components/SignatureBlock/index.js +30 -29
- package/runtime/components/SignatureBlock/index.module.js +9 -6
- package/runtime/components/SignatureCode/{index_module.css → index.css} +9 -10
- package/runtime/components/SignatureCode/index.js +40 -32
- package/runtime/components/SignatureCode/index.module.js +9 -6
- package/runtime/components/SignatureToolbar/{index_module.css → index.css} +18 -20
- package/runtime/components/SignatureToolbar/index.js +48 -51
- package/runtime/components/SignatureToolbar/index.module.js +13 -10
- package/runtime/components/buttons/ButtonGroup.js +13 -6
- package/runtime/components/buttons/CopyCodeButton.js +40 -38
- package/runtime/components/buttons/WrapSignatureButton.js +20 -16
- package/runtime/components/buttons/{index_module.css → index.css} +5 -6
- package/runtime/components/buttons/index.module.js +8 -5
- package/runtime/components/icons/CheckIcon/index.js +20 -17
- package/runtime/components/icons/CopyIcon/index.js +20 -17
- package/runtime/components/icons/UnwrapIcon/index.js +22 -18
- package/runtime/components/icons/WrapIcon/index.js +20 -17
- package/runtime/components/shared/_twoslash.css +3 -10
- package/runtime/components/shared/variables.css +0 -3
- package/runtime/hooks/useWrapToggle.js +32 -9
- package/runtime/index.d.ts +513 -173
- package/runtime/index.js +11 -9
- package/runtime/utils/decode-hast.js +31 -16
- package/runtime/utils/hast-renderer.js +21 -7
- package/schemas/config.js +199 -0
- package/schemas/index.js +5 -0
- package/schemas/opengraph.js +26 -0
- package/schemas/performance.js +19 -0
- package/serve.js +133 -0
- package/services/ConfigService.js +7 -0
- package/services/PathDerivationService.js +7 -0
- package/services/SnapshotService.js +7 -0
- package/services/TypeRegistryService.js +7 -0
- package/shiki-transformer.js +758 -0
- package/tsconfig-parser.js +127 -0
- package/tsdoc-metadata.json +11 -11
- package/twoslash-patterns.js +87 -0
- package/twoslash-transformer.js +316 -0
- package/type-reference-extractor.js +201 -0
- package/typescript-config.js +168 -0
- package/vfs-registry.js +121 -0
- package/0~llms-program.js +0 -344
- package/runtime/components/ApiLlmsPackageActions/index.module.js +0 -2
package/runtime/index.d.ts
CHANGED
|
@@ -1,173 +1,513 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*/
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime/components/ApiExample/index.d.ts
|
|
4
|
+
interface ApiExampleProps {
|
|
5
|
+
/** Example code (no Twoslash directives) */
|
|
6
|
+
code: string;
|
|
7
|
+
/**
|
|
8
|
+
* Pre-generated HAST tree from Shiki (base64-encoded JSON string).
|
|
9
|
+
* Injected by the remark-api-codeblocks plugin during MDX compilation.
|
|
10
|
+
*/
|
|
11
|
+
hast?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Renders an example code block.
|
|
15
|
+
*
|
|
16
|
+
* Replaces ExampleBlockWrapper with a simpler component that takes a plain
|
|
17
|
+
* code string (no base64, no HAST for code). The code should already have
|
|
18
|
+
* Twoslash directives stripped.
|
|
19
|
+
*
|
|
20
|
+
* In SSG-MD mode, renders a plain code block with the example code.
|
|
21
|
+
*/
|
|
22
|
+
declare function ApiExample({
|
|
23
|
+
code,
|
|
24
|
+
hast
|
|
25
|
+
}: ApiExampleProps): ReactElement;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/runtime/components/ApiMember/index.d.ts
|
|
28
|
+
interface ApiMemberProps {
|
|
29
|
+
/** Member signature code (not wrapped in class/interface) */
|
|
30
|
+
code: string;
|
|
31
|
+
/** Display name for the heading */
|
|
32
|
+
memberName: string;
|
|
33
|
+
/** Plain text or markdown summary (not HTML, not base64) */
|
|
34
|
+
summary?: string;
|
|
35
|
+
/** Anchor ID */
|
|
36
|
+
id?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Pre-generated HAST tree from Shiki (base64-encoded JSON string).
|
|
39
|
+
* Injected by the remark-api-codeblocks plugin during MDX compilation.
|
|
40
|
+
*/
|
|
41
|
+
hast?: string;
|
|
42
|
+
/** Whether this signature has parameters (affects border radius in browser mode) */
|
|
43
|
+
hasParameters?: boolean | string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Renders an individual class/interface member signature block.
|
|
47
|
+
*
|
|
48
|
+
* Replaces MemberSignatureWrapper with a simpler component that takes plain
|
|
49
|
+
* string props. The `code` prop contains only the member signature (not
|
|
50
|
+
* wrapped in a class skeleton), and `summary` is plain markdown-compatible
|
|
51
|
+
* text (not HTML with anchor tags, not base64-encoded).
|
|
52
|
+
*
|
|
53
|
+
* In SSG-MD mode, renders a heading with member name, summary text,
|
|
54
|
+
* and a plain code block with the member signature.
|
|
55
|
+
*/
|
|
56
|
+
declare function ApiMember({
|
|
57
|
+
code,
|
|
58
|
+
memberName,
|
|
59
|
+
summary,
|
|
60
|
+
id,
|
|
61
|
+
hast,
|
|
62
|
+
hasParameters
|
|
63
|
+
}: ApiMemberProps): ReactElement;
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/runtime/components/ApiSignature/index.d.ts
|
|
66
|
+
interface ApiSignatureProps {
|
|
67
|
+
/** Display code (clean, no Twoslash directives) */
|
|
68
|
+
code: string;
|
|
69
|
+
/** Section heading (default: "Signature") */
|
|
70
|
+
heading?: string;
|
|
71
|
+
/** Anchor ID (default: "signature") */
|
|
72
|
+
id?: string;
|
|
73
|
+
/**
|
|
74
|
+
* Pre-generated HAST tree from Shiki (base64-encoded JSON string).
|
|
75
|
+
* Injected by the remark-api-codeblocks plugin during MDX compilation.
|
|
76
|
+
*/
|
|
77
|
+
hast?: string;
|
|
78
|
+
/** Whether this signature has parameters (affects border radius in browser mode) */
|
|
79
|
+
hasParameters?: boolean | string;
|
|
80
|
+
/** Whether this signature has members table below (affects border radius in browser mode) */
|
|
81
|
+
hasMembers?: boolean | string;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Renders a full API type signature block.
|
|
85
|
+
*
|
|
86
|
+
* Replaces SignatureBlockWrapper with a simpler component that takes plain
|
|
87
|
+
* string props (no base64 encoding for code). Produces clean semantic HTML
|
|
88
|
+
* that RSPress converts to LLM-readable markdown in SSG-MD mode, and renders
|
|
89
|
+
* interactive Shiki-highlighted code in browser mode.
|
|
90
|
+
*
|
|
91
|
+
* In SSG-MD mode, renders a "Signature" heading followed by a plain
|
|
92
|
+
* code block with the type signature.
|
|
93
|
+
*/
|
|
94
|
+
declare function ApiSignature({
|
|
95
|
+
code,
|
|
96
|
+
heading: _heading,
|
|
97
|
+
id: _id,
|
|
98
|
+
hast,
|
|
99
|
+
hasParameters,
|
|
100
|
+
hasMembers
|
|
101
|
+
}: ApiSignatureProps): ReactElement;
|
|
102
|
+
//#endregion
|
|
103
|
+
//#region src/runtime/components/EnumMembersTable/index.d.ts
|
|
104
|
+
interface EnumMember {
|
|
105
|
+
name: string;
|
|
106
|
+
value?: string;
|
|
107
|
+
description: string;
|
|
108
|
+
}
|
|
109
|
+
interface EnumMembersTableProps {
|
|
110
|
+
members: EnumMember[];
|
|
111
|
+
}
|
|
112
|
+
declare const EnumMembersTable: ({
|
|
113
|
+
members
|
|
114
|
+
}: EnumMembersTableProps) => ReactElement | null;
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region ../node_modules/.pnpm/@types+unist@3.0.3/node_modules/@types/unist/index.d.ts
|
|
117
|
+
// ## Interfaces
|
|
118
|
+
/**
|
|
119
|
+
* Info associated with nodes by the ecosystem.
|
|
120
|
+
*
|
|
121
|
+
* This space is guaranteed to never be specified by unist or specifications
|
|
122
|
+
* implementing unist.
|
|
123
|
+
* But you can use it in utilities and plugins to store data.
|
|
124
|
+
*
|
|
125
|
+
* This type can be augmented to register custom data.
|
|
126
|
+
* For example:
|
|
127
|
+
*
|
|
128
|
+
* ```ts
|
|
129
|
+
* declare module 'unist' {
|
|
130
|
+
* interface Data {
|
|
131
|
+
* // `someNode.data.myId` is typed as `number | undefined`
|
|
132
|
+
* myId?: number | undefined
|
|
133
|
+
* }
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
interface Data$1 {}
|
|
138
|
+
/**
|
|
139
|
+
* One place in a source file.
|
|
140
|
+
*/
|
|
141
|
+
interface Point {
|
|
142
|
+
/**
|
|
143
|
+
* Line in a source file (1-indexed integer).
|
|
144
|
+
*/
|
|
145
|
+
line: number;
|
|
146
|
+
/**
|
|
147
|
+
* Column in a source file (1-indexed integer).
|
|
148
|
+
*/
|
|
149
|
+
column: number;
|
|
150
|
+
/**
|
|
151
|
+
* Character in a source file (0-indexed integer).
|
|
152
|
+
*/
|
|
153
|
+
offset?: number | undefined;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Position of a node in a source document.
|
|
157
|
+
*
|
|
158
|
+
* A position is a range between two points.
|
|
159
|
+
*/
|
|
160
|
+
interface Position {
|
|
161
|
+
/**
|
|
162
|
+
* Place of the first character of the parsed source region.
|
|
163
|
+
*/
|
|
164
|
+
start: Point;
|
|
165
|
+
/**
|
|
166
|
+
* Place of the first character after the parsed source region.
|
|
167
|
+
*/
|
|
168
|
+
end: Point;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Abstract unist node.
|
|
172
|
+
*
|
|
173
|
+
* The syntactic unit in unist syntax trees are called nodes.
|
|
174
|
+
*
|
|
175
|
+
* This interface is supposed to be extended.
|
|
176
|
+
* If you can use {@link Literal} or {@link Parent}, you should.
|
|
177
|
+
* But for example in markdown, a `thematicBreak` (`***`), is neither literal
|
|
178
|
+
* nor parent, but still a node.
|
|
179
|
+
*/
|
|
180
|
+
interface Node$1 {
|
|
181
|
+
/**
|
|
182
|
+
* Node type.
|
|
183
|
+
*/
|
|
184
|
+
type: string;
|
|
185
|
+
/**
|
|
186
|
+
* Info from the ecosystem.
|
|
187
|
+
*/
|
|
188
|
+
data?: Data$1 | undefined;
|
|
189
|
+
/**
|
|
190
|
+
* Position of a node in a source document.
|
|
191
|
+
*
|
|
192
|
+
* Nodes that are generated (not in the original source document) must not
|
|
193
|
+
* have a position.
|
|
194
|
+
*/
|
|
195
|
+
position?: Position | undefined;
|
|
196
|
+
}
|
|
197
|
+
//#endregion
|
|
198
|
+
//#region ../node_modules/.pnpm/@types+hast@3.0.4/node_modules/@types/hast/index.d.ts
|
|
199
|
+
// ## Interfaces
|
|
200
|
+
/**
|
|
201
|
+
* Info associated with hast nodes by the ecosystem.
|
|
202
|
+
*
|
|
203
|
+
* This space is guaranteed to never be specified by unist or hast.
|
|
204
|
+
* But you can use it in utilities and plugins to store data.
|
|
205
|
+
*
|
|
206
|
+
* This type can be augmented to register custom data.
|
|
207
|
+
* For example:
|
|
208
|
+
*
|
|
209
|
+
* ```ts
|
|
210
|
+
* declare module 'hast' {
|
|
211
|
+
* interface Data {
|
|
212
|
+
* // `someNode.data.myId` is typed as `number | undefined`
|
|
213
|
+
* myId?: number | undefined
|
|
214
|
+
* }
|
|
215
|
+
* }
|
|
216
|
+
* ```
|
|
217
|
+
*/
|
|
218
|
+
interface Data extends Data$1 {}
|
|
219
|
+
/**
|
|
220
|
+
* Info associated with an element.
|
|
221
|
+
*/
|
|
222
|
+
interface Properties {
|
|
223
|
+
[PropertyName: string]: boolean | number | string | null | undefined | Array<string | number>;
|
|
224
|
+
}
|
|
225
|
+
// ## Content maps
|
|
226
|
+
/**
|
|
227
|
+
* Union of registered hast nodes that can occur in {@link Element}.
|
|
228
|
+
*
|
|
229
|
+
* To register mote custom hast nodes, add them to {@link ElementContentMap}.
|
|
230
|
+
* They will be automatically added here.
|
|
231
|
+
*/
|
|
232
|
+
type ElementContent = ElementContentMap[keyof ElementContentMap];
|
|
233
|
+
/**
|
|
234
|
+
* Registry of all hast nodes that can occur as children of {@link Element}.
|
|
235
|
+
*
|
|
236
|
+
* For a union of all {@link Element} children, see {@link ElementContent}.
|
|
237
|
+
*/
|
|
238
|
+
interface ElementContentMap {
|
|
239
|
+
comment: Comment;
|
|
240
|
+
element: Element;
|
|
241
|
+
text: Text;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Union of registered hast nodes that can occur in {@link Root}.
|
|
245
|
+
*
|
|
246
|
+
* To register custom hast nodes, add them to {@link RootContentMap}.
|
|
247
|
+
* They will be automatically added here.
|
|
248
|
+
*/
|
|
249
|
+
type RootContent = RootContentMap[keyof RootContentMap];
|
|
250
|
+
/**
|
|
251
|
+
* Registry of all hast nodes that can occur as children of {@link Root}.
|
|
252
|
+
*
|
|
253
|
+
* > 👉 **Note**: {@link Root} does not need to be an entire document.
|
|
254
|
+
* > it can also be a fragment.
|
|
255
|
+
*
|
|
256
|
+
* For a union of all {@link Root} children, see {@link RootContent}.
|
|
257
|
+
*/
|
|
258
|
+
interface RootContentMap {
|
|
259
|
+
comment: Comment;
|
|
260
|
+
doctype: Doctype;
|
|
261
|
+
element: Element;
|
|
262
|
+
text: Text;
|
|
263
|
+
}
|
|
264
|
+
// ## Abstract nodes
|
|
265
|
+
/**
|
|
266
|
+
* Abstract hast node.
|
|
267
|
+
*
|
|
268
|
+
* This interface is supposed to be extended.
|
|
269
|
+
* If you can use {@link Literal} or {@link Parent}, you should.
|
|
270
|
+
* But for example in HTML, a `Doctype` is neither literal nor parent, but
|
|
271
|
+
* still a node.
|
|
272
|
+
*
|
|
273
|
+
* To register custom hast nodes, add them to {@link RootContentMap} and other
|
|
274
|
+
* places where relevant (such as {@link ElementContentMap}).
|
|
275
|
+
*
|
|
276
|
+
* For a union of all registered hast nodes, see {@link Nodes}.
|
|
277
|
+
*/
|
|
278
|
+
interface Node extends Node$1 {
|
|
279
|
+
/**
|
|
280
|
+
* Info from the ecosystem.
|
|
281
|
+
*/
|
|
282
|
+
data?: Data | undefined;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Abstract hast node that contains the smallest possible value.
|
|
286
|
+
*
|
|
287
|
+
* This interface is supposed to be extended if you make custom hast nodes.
|
|
288
|
+
*
|
|
289
|
+
* For a union of all registered hast literals, see {@link Literals}.
|
|
290
|
+
*/
|
|
291
|
+
interface Literal extends Node {
|
|
292
|
+
/**
|
|
293
|
+
* Plain-text value.
|
|
294
|
+
*/
|
|
295
|
+
value: string;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Abstract hast node that contains other hast nodes (*children*).
|
|
299
|
+
*
|
|
300
|
+
* This interface is supposed to be extended if you make custom hast nodes.
|
|
301
|
+
*
|
|
302
|
+
* For a union of all registered hast parents, see {@link Parents}.
|
|
303
|
+
*/
|
|
304
|
+
interface Parent extends Node {
|
|
305
|
+
/**
|
|
306
|
+
* List of children.
|
|
307
|
+
*/
|
|
308
|
+
children: RootContent[];
|
|
309
|
+
}
|
|
310
|
+
// ## Concrete nodes
|
|
311
|
+
/**
|
|
312
|
+
* HTML comment.
|
|
313
|
+
*/
|
|
314
|
+
interface Comment extends Literal {
|
|
315
|
+
/**
|
|
316
|
+
* Node type of HTML comments in hast.
|
|
317
|
+
*/
|
|
318
|
+
type: "comment";
|
|
319
|
+
/**
|
|
320
|
+
* Data associated with the comment.
|
|
321
|
+
*/
|
|
322
|
+
data?: CommentData | undefined;
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Info associated with hast comments by the ecosystem.
|
|
326
|
+
*/
|
|
327
|
+
interface CommentData extends Data {}
|
|
328
|
+
/**
|
|
329
|
+
* HTML document type.
|
|
330
|
+
*/
|
|
331
|
+
interface Doctype extends Node$1 {
|
|
332
|
+
/**
|
|
333
|
+
* Node type of HTML document types in hast.
|
|
334
|
+
*/
|
|
335
|
+
type: "doctype";
|
|
336
|
+
/**
|
|
337
|
+
* Data associated with the doctype.
|
|
338
|
+
*/
|
|
339
|
+
data?: DoctypeData | undefined;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Info associated with hast doctypes by the ecosystem.
|
|
343
|
+
*/
|
|
344
|
+
interface DoctypeData extends Data {}
|
|
345
|
+
/**
|
|
346
|
+
* HTML element.
|
|
347
|
+
*/
|
|
348
|
+
interface Element extends Parent {
|
|
349
|
+
/**
|
|
350
|
+
* Node type of elements.
|
|
351
|
+
*/
|
|
352
|
+
type: "element";
|
|
353
|
+
/**
|
|
354
|
+
* Tag name (such as `'body'`) of the element.
|
|
355
|
+
*/
|
|
356
|
+
tagName: string;
|
|
357
|
+
/**
|
|
358
|
+
* Info associated with the element.
|
|
359
|
+
*/
|
|
360
|
+
properties: Properties;
|
|
361
|
+
/**
|
|
362
|
+
* Children of element.
|
|
363
|
+
*/
|
|
364
|
+
children: ElementContent[];
|
|
365
|
+
/**
|
|
366
|
+
* When the `tagName` field is `'template'`, a `content` field can be
|
|
367
|
+
* present.
|
|
368
|
+
*/
|
|
369
|
+
content?: Root | undefined;
|
|
370
|
+
/**
|
|
371
|
+
* Data associated with the element.
|
|
372
|
+
*/
|
|
373
|
+
data?: ElementData | undefined;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Info associated with hast elements by the ecosystem.
|
|
377
|
+
*/
|
|
378
|
+
interface ElementData extends Data {}
|
|
379
|
+
/**
|
|
380
|
+
* Document fragment or a whole document.
|
|
381
|
+
*
|
|
382
|
+
* Should be used as the root of a tree and must not be used as a child.
|
|
383
|
+
*
|
|
384
|
+
* Can also be used as the value for the content field on a `'template'` element.
|
|
385
|
+
*/
|
|
386
|
+
interface Root extends Parent {
|
|
387
|
+
/**
|
|
388
|
+
* Node type of hast root.
|
|
389
|
+
*/
|
|
390
|
+
type: "root";
|
|
391
|
+
/**
|
|
392
|
+
* Children of root.
|
|
393
|
+
*/
|
|
394
|
+
children: RootContent[];
|
|
395
|
+
/**
|
|
396
|
+
* Data associated with the hast root.
|
|
397
|
+
*/
|
|
398
|
+
data?: RootData | undefined;
|
|
399
|
+
}
|
|
400
|
+
/**
|
|
401
|
+
* Info associated with hast root nodes by the ecosystem.
|
|
402
|
+
*/
|
|
403
|
+
interface RootData extends Data {}
|
|
404
|
+
/**
|
|
405
|
+
* HTML character data (plain text).
|
|
406
|
+
*/
|
|
407
|
+
interface Text extends Literal {
|
|
408
|
+
/**
|
|
409
|
+
* Node type of HTML character data (plain text) in hast.
|
|
410
|
+
*/
|
|
411
|
+
type: "text";
|
|
412
|
+
/**
|
|
413
|
+
* Data associated with the text.
|
|
414
|
+
*/
|
|
415
|
+
data?: TextData | undefined;
|
|
416
|
+
}
|
|
417
|
+
/**
|
|
418
|
+
* Info associated with hast texts by the ecosystem.
|
|
419
|
+
*/
|
|
420
|
+
interface TextData extends Data {}
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/runtime/components/ExampleBlock/index.d.ts
|
|
423
|
+
interface ExampleBlockProps {
|
|
424
|
+
/** Pre-generated HAST (Hypertext Abstract Syntax Tree) from Shiki */
|
|
425
|
+
hast: Root | null;
|
|
426
|
+
/** The code for copy functionality (optional for backwards compatibility) */
|
|
427
|
+
code?: string;
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Code block for examples - displays syntax-highlighted code without a heading
|
|
431
|
+
* Similar to SignatureBlock but without the "Signature" header
|
|
432
|
+
* Includes both copy and wrap buttons in the toolbar
|
|
433
|
+
*/
|
|
434
|
+
declare function ExampleBlock({
|
|
435
|
+
hast,
|
|
436
|
+
code
|
|
437
|
+
}: ExampleBlockProps): ReactElement;
|
|
438
|
+
//#endregion
|
|
439
|
+
//#region src/runtime/components/MemberSignature/index.d.ts
|
|
440
|
+
interface MemberSignatureProps {
|
|
441
|
+
/** Pre-generated HAST (Hypertext Abstract Syntax Tree) from Shiki */
|
|
442
|
+
hast: Root | null;
|
|
443
|
+
/** Member name to display in the header */
|
|
444
|
+
memberName: string;
|
|
445
|
+
/** Optional ID for the anchor link */
|
|
446
|
+
id?: string;
|
|
447
|
+
/** Optional plain text summary to display in the toolbar */
|
|
448
|
+
summary?: string;
|
|
449
|
+
/** Whether this signature has parameters (affects border radius) */
|
|
450
|
+
hasParameters?: boolean;
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Interactive member signature block with h3 header and wrap button
|
|
454
|
+
* Displays syntax-highlighted TypeScript member signatures with hover tooltips
|
|
455
|
+
*/
|
|
456
|
+
declare function MemberSignature({
|
|
457
|
+
hast,
|
|
458
|
+
memberName,
|
|
459
|
+
id,
|
|
460
|
+
summary,
|
|
461
|
+
hasParameters
|
|
462
|
+
}: MemberSignatureProps): ReactElement;
|
|
463
|
+
//#endregion
|
|
464
|
+
//#region src/runtime/components/ParametersTable/index.d.ts
|
|
465
|
+
interface Parameter {
|
|
466
|
+
name: string;
|
|
467
|
+
type?: string;
|
|
468
|
+
description: string;
|
|
469
|
+
}
|
|
470
|
+
interface ParametersTableProps {
|
|
471
|
+
parameters: Parameter[];
|
|
472
|
+
}
|
|
473
|
+
declare const ParametersTable: ({
|
|
474
|
+
parameters
|
|
475
|
+
}: ParametersTableProps) => ReactElement | null;
|
|
476
|
+
//#endregion
|
|
477
|
+
//#region src/runtime/components/SignatureBlock/index.d.ts
|
|
478
|
+
interface SignatureBlockProps {
|
|
479
|
+
/** Pre-generated HAST (Hypertext Abstract Syntax Tree) from Shiki */
|
|
480
|
+
hast: Root | null;
|
|
481
|
+
/** Optional heading text to display in the toolbar */
|
|
482
|
+
heading?: string;
|
|
483
|
+
/** Optional ID for the heading anchor link */
|
|
484
|
+
id?: string;
|
|
485
|
+
/** Whether this signature has parameters (affects border radius) */
|
|
486
|
+
hasParameters?: boolean;
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* Interactive signature block with wrap button
|
|
490
|
+
* Displays syntax-highlighted TypeScript signatures with hover tooltips
|
|
491
|
+
*/
|
|
492
|
+
declare function SignatureBlock({
|
|
493
|
+
hast,
|
|
494
|
+
heading,
|
|
495
|
+
id,
|
|
496
|
+
hasParameters
|
|
497
|
+
}: SignatureBlockProps): ReactElement;
|
|
498
|
+
//#endregion
|
|
499
|
+
//#region src/runtime/utils/hast-renderer.d.ts
|
|
500
|
+
/**
|
|
501
|
+
* Convert a HAST (Hypertext Abstract Syntax Tree) root to a React element.
|
|
502
|
+
*
|
|
503
|
+
* This function is used to render pre-generated Shiki HAST trees at runtime,
|
|
504
|
+
* avoiding the need for `dangerouslySetInnerHTML` and eliminating MDX parsing
|
|
505
|
+
* issues caused by long HTML strings with special characters.
|
|
506
|
+
*
|
|
507
|
+
* @param hast - The HAST root node from Shiki's `codeToHast()`
|
|
508
|
+
* @returns A React element representing the HAST tree
|
|
509
|
+
*/
|
|
510
|
+
declare function hastToReact(hast: Root): ReactElement;
|
|
511
|
+
//#endregion
|
|
512
|
+
export { ApiExample, type ApiExampleProps, ApiMember, type ApiMemberProps, ApiSignature, type ApiSignatureProps, type EnumMember, EnumMembersTable, type EnumMembersTableProps, ExampleBlock, type ExampleBlockProps, MemberSignature, type MemberSignatureProps, type Parameter, ParametersTable, type ParametersTableProps, SignatureBlock, type SignatureBlockProps, hastToReact };
|
|
513
|
+
//# sourceMappingURL=index.d.ts.map
|