@openpkg-ts/doc-generator 0.1.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 +324 -0
- package/dist/cli.js +389 -0
- package/dist/index.d.ts +827 -0
- package/dist/index.js +79 -0
- package/dist/react-styled.d.ts +588 -0
- package/dist/react-styled.js +766 -0
- package/dist/react.d.ts +221 -0
- package/dist/react.js +35 -0
- package/dist/shared/chunk-7hg53zpt.js +1160 -0
- package/dist/shared/chunk-e5fkh3kh.js +679 -0
- package/dist/shared/chunk-taeg9090.js +171 -0
- package/package.json +84 -0
- package/templates/embedded/README.md +81 -0
- package/templates/embedded/docusaurus/sidebars.js +38 -0
- package/templates/embedded/fumadocs/meta.json +26 -0
- package/templates/standalone/index.html +34 -0
- package/templates/standalone/package.json +17 -0
- package/templates/standalone/src/main.ts +223 -0
- package/templates/standalone/src/styles.css +43 -0
- package/templates/standalone/vite.config.ts +9 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createDocs,
|
|
3
|
+
exportToMarkdown,
|
|
4
|
+
loadSpec,
|
|
5
|
+
toAlgoliaRecords,
|
|
6
|
+
toDocusaurusSidebarJS,
|
|
7
|
+
toFumadocsMetaJSON,
|
|
8
|
+
toHTML,
|
|
9
|
+
toJSON,
|
|
10
|
+
toJSONString,
|
|
11
|
+
toMarkdown,
|
|
12
|
+
toNavigation,
|
|
13
|
+
toPagefindRecords,
|
|
14
|
+
toSearchIndex,
|
|
15
|
+
toSearchIndexJSON
|
|
16
|
+
} from "./shared/chunk-7hg53zpt.js";
|
|
17
|
+
import {
|
|
18
|
+
buildSignatureString,
|
|
19
|
+
formatParameters,
|
|
20
|
+
formatReturnType,
|
|
21
|
+
formatSchema,
|
|
22
|
+
formatTypeParameters,
|
|
23
|
+
getMethods,
|
|
24
|
+
getProperties,
|
|
25
|
+
groupByVisibility,
|
|
26
|
+
isMethod,
|
|
27
|
+
isProperty,
|
|
28
|
+
resolveTypeRef,
|
|
29
|
+
sortByKindThenName,
|
|
30
|
+
sortByName
|
|
31
|
+
} from "./shared/chunk-taeg9090.js";
|
|
32
|
+
|
|
33
|
+
// src/adapters/types.ts
|
|
34
|
+
function createAdapterRegistry() {
|
|
35
|
+
const adapters = new Map;
|
|
36
|
+
return {
|
|
37
|
+
register(adapter) {
|
|
38
|
+
adapters.set(adapter.name, adapter);
|
|
39
|
+
},
|
|
40
|
+
get(name) {
|
|
41
|
+
return adapters.get(name);
|
|
42
|
+
},
|
|
43
|
+
list() {
|
|
44
|
+
return Array.from(adapters.values());
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
var adapterRegistry = createAdapterRegistry();
|
|
49
|
+
export {
|
|
50
|
+
toSearchIndexJSON,
|
|
51
|
+
toSearchIndex,
|
|
52
|
+
toPagefindRecords,
|
|
53
|
+
toNavigation,
|
|
54
|
+
toMarkdown,
|
|
55
|
+
toJSONString,
|
|
56
|
+
toJSON,
|
|
57
|
+
toHTML,
|
|
58
|
+
toFumadocsMetaJSON,
|
|
59
|
+
toDocusaurusSidebarJS,
|
|
60
|
+
toAlgoliaRecords,
|
|
61
|
+
sortByName,
|
|
62
|
+
sortByKindThenName,
|
|
63
|
+
resolveTypeRef,
|
|
64
|
+
loadSpec,
|
|
65
|
+
isProperty,
|
|
66
|
+
isMethod,
|
|
67
|
+
groupByVisibility,
|
|
68
|
+
getProperties,
|
|
69
|
+
getMethods,
|
|
70
|
+
formatTypeParameters,
|
|
71
|
+
formatSchema,
|
|
72
|
+
formatReturnType,
|
|
73
|
+
formatParameters,
|
|
74
|
+
exportToMarkdown,
|
|
75
|
+
createDocs,
|
|
76
|
+
createAdapterRegistry,
|
|
77
|
+
buildSignatureString,
|
|
78
|
+
adapterRegistry
|
|
79
|
+
};
|
|
@@ -0,0 +1,588 @@
|
|
|
1
|
+
import { SpecMember } from "@openpkg-ts/spec";
|
|
2
|
+
interface CollapsibleMethodProps {
|
|
3
|
+
/** Method member to display */
|
|
4
|
+
member: SpecMember;
|
|
5
|
+
/** Default expanded state */
|
|
6
|
+
defaultExpanded?: boolean;
|
|
7
|
+
/** Custom className */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Custom header renderer */
|
|
10
|
+
renderHeader?: (member: SpecMember, expanded: boolean, toggle: () => void) => React.ReactNode;
|
|
11
|
+
/** Custom content renderer */
|
|
12
|
+
renderContent?: (member: SpecMember) => React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Headless collapsible method component.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* <CollapsibleMethod member={method} defaultExpanded />
|
|
20
|
+
*
|
|
21
|
+
* // Custom rendering
|
|
22
|
+
* <CollapsibleMethod
|
|
23
|
+
* member={method}
|
|
24
|
+
* renderHeader={(m, expanded, toggle) => (
|
|
25
|
+
* <button onClick={toggle}>{m.name}</button>
|
|
26
|
+
* )}
|
|
27
|
+
* />
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare function CollapsibleMethod({ member, defaultExpanded, className, renderHeader, renderContent }: CollapsibleMethodProps): React.ReactNode;
|
|
31
|
+
import { SpecExample } from "@openpkg-ts/spec";
|
|
32
|
+
interface ExampleBlockProps {
|
|
33
|
+
/** Examples to display (string or SpecExample) */
|
|
34
|
+
examples: (string | SpecExample)[];
|
|
35
|
+
/** Custom className */
|
|
36
|
+
className?: string;
|
|
37
|
+
/** Custom example renderer */
|
|
38
|
+
renderExample?: (example: string | SpecExample, index: number) => React.ReactNode;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Normalize example to string content.
|
|
42
|
+
*/
|
|
43
|
+
declare function getExampleCode(example: string | SpecExample): string;
|
|
44
|
+
/**
|
|
45
|
+
* Get example title if available.
|
|
46
|
+
*/
|
|
47
|
+
declare function getExampleTitle(example: string | SpecExample): string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Get example language.
|
|
50
|
+
*/
|
|
51
|
+
declare function getExampleLanguage(example: string | SpecExample): string;
|
|
52
|
+
/**
|
|
53
|
+
* Clean code by removing markdown fences.
|
|
54
|
+
*/
|
|
55
|
+
declare function cleanCode(code: string): string;
|
|
56
|
+
/**
|
|
57
|
+
* Headless example block component.
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```tsx
|
|
61
|
+
* <ExampleBlock examples={exp.examples} />
|
|
62
|
+
*
|
|
63
|
+
* // Custom rendering
|
|
64
|
+
* <ExampleBlock
|
|
65
|
+
* examples={exp.examples}
|
|
66
|
+
* renderExample={(ex) => <CustomCode code={getExampleCode(ex)} />}
|
|
67
|
+
* />
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
declare function ExampleBlock({ examples, className, renderExample }: ExampleBlockProps): React.ReactNode;
|
|
71
|
+
import { SpecSchema, SpecSignatureParameter } from "@openpkg-ts/spec";
|
|
72
|
+
interface ExpandablePropertyProps {
|
|
73
|
+
/** Parameter to display */
|
|
74
|
+
param: SpecSignatureParameter;
|
|
75
|
+
/** Nesting depth */
|
|
76
|
+
depth?: number;
|
|
77
|
+
/** Custom className */
|
|
78
|
+
className?: string;
|
|
79
|
+
}
|
|
80
|
+
interface NestedPropertyProps {
|
|
81
|
+
/** Property name */
|
|
82
|
+
name: string;
|
|
83
|
+
/** Property schema */
|
|
84
|
+
schema: SpecSchema;
|
|
85
|
+
/** Is required */
|
|
86
|
+
required?: boolean;
|
|
87
|
+
/** Nesting depth */
|
|
88
|
+
depth?: number;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Nested property display.
|
|
92
|
+
*/
|
|
93
|
+
declare function NestedProperty({ name, schema, required, depth }: NestedPropertyProps): React.ReactNode;
|
|
94
|
+
/**
|
|
95
|
+
* Headless expandable property for parameters with nested objects.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```tsx
|
|
99
|
+
* <ExpandableProperty param={param} />
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
declare function ExpandableProperty({ param, depth, className }: ExpandablePropertyProps): React.ReactNode;
|
|
103
|
+
import { SpecMember as SpecMember2 } from "@openpkg-ts/spec";
|
|
104
|
+
interface MembersTableProps {
|
|
105
|
+
/** Members to display */
|
|
106
|
+
members: SpecMember2[];
|
|
107
|
+
/** Custom className */
|
|
108
|
+
className?: string;
|
|
109
|
+
/** Group by kind (constructor, property, method) */
|
|
110
|
+
groupByKind?: boolean;
|
|
111
|
+
/** Custom member renderer */
|
|
112
|
+
renderMember?: (member: SpecMember2, index: number) => React.ReactNode;
|
|
113
|
+
}
|
|
114
|
+
interface MemberGroups {
|
|
115
|
+
constructors: SpecMember2[];
|
|
116
|
+
properties: SpecMember2[];
|
|
117
|
+
methods: SpecMember2[];
|
|
118
|
+
accessors: SpecMember2[];
|
|
119
|
+
other: SpecMember2[];
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Group members by their kind.
|
|
123
|
+
*/
|
|
124
|
+
declare function groupMembersByKind(members: SpecMember2[]): MemberGroups;
|
|
125
|
+
interface MemberRowProps {
|
|
126
|
+
member: SpecMember2;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Individual member row.
|
|
130
|
+
*/
|
|
131
|
+
declare function MemberRow({ member }: MemberRowProps): React.ReactNode;
|
|
132
|
+
/**
|
|
133
|
+
* Headless members table for classes/interfaces.
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```tsx
|
|
137
|
+
* <MembersTable members={exp.members} groupByKind />
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
declare function MembersTable({ members, className, groupByKind, renderMember }: MembersTableProps): React.ReactNode;
|
|
141
|
+
import { SpecMember as SpecMember3, SpecSignatureParameter as SpecSignatureParameter2 } from "@openpkg-ts/spec";
|
|
142
|
+
interface ParamTableProps {
|
|
143
|
+
/** Parameters or members to display */
|
|
144
|
+
items: (SpecSignatureParameter2 | SpecMember3)[];
|
|
145
|
+
/** Show required indicator */
|
|
146
|
+
showRequired?: boolean;
|
|
147
|
+
/** Custom className */
|
|
148
|
+
className?: string;
|
|
149
|
+
/** Render custom row */
|
|
150
|
+
renderRow?: (item: SpecSignatureParameter2 | SpecMember3, index: number) => React.ReactNode;
|
|
151
|
+
}
|
|
152
|
+
interface ParamRowProps {
|
|
153
|
+
item: SpecSignatureParameter2 | SpecMember3;
|
|
154
|
+
showRequired?: boolean;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Individual parameter row component.
|
|
158
|
+
*/
|
|
159
|
+
declare function ParamRow({ item, showRequired }: ParamRowProps): React.ReactNode;
|
|
160
|
+
/**
|
|
161
|
+
* Headless parameter table component.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```tsx
|
|
165
|
+
* <ParamTable items={sig.parameters} />
|
|
166
|
+
*
|
|
167
|
+
* // Custom row rendering
|
|
168
|
+
* <ParamTable
|
|
169
|
+
* items={sig.parameters}
|
|
170
|
+
* renderRow={(item) => <CustomRow key={item.name} param={item} />}
|
|
171
|
+
* />
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
declare function ParamTable({ items, showRequired, className, renderRow }: ParamTableProps): React.ReactNode;
|
|
175
|
+
import { SpecExport } from "@openpkg-ts/spec";
|
|
176
|
+
interface SignatureProps {
|
|
177
|
+
/** The to render signature for */
|
|
178
|
+
export: SpecExport;
|
|
179
|
+
/** Index of signature to render (for overloaded functions) */
|
|
180
|
+
signatureIndex?: number;
|
|
181
|
+
/** Custom className */
|
|
182
|
+
className?: string;
|
|
183
|
+
/** Render prop for custom rendering */
|
|
184
|
+
children?: (signature: string) => React.ReactNode;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Headless signature component. Renders a type signature string.
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```tsx
|
|
191
|
+
* // Default rendering
|
|
192
|
+
* <Signature export={fn} />
|
|
193
|
+
*
|
|
194
|
+
* // Custom rendering
|
|
195
|
+
* <Signature export={fn}>
|
|
196
|
+
* {(sig) => <pre>{sig}</pre>}
|
|
197
|
+
* </Signature>
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
declare function Signature({ export: exp, signatureIndex, className, children }: SignatureProps): React.ReactNode;
|
|
201
|
+
import { SpecMember as SpecMember4, SpecSignatureParameter as SpecSignatureParameter3 } from "@openpkg-ts/spec";
|
|
202
|
+
interface TypeTableProps {
|
|
203
|
+
/** Members or parameters to display */
|
|
204
|
+
items: (SpecSignatureParameter3 | SpecMember4)[];
|
|
205
|
+
/** Show required indicator */
|
|
206
|
+
showRequired?: boolean;
|
|
207
|
+
/** Custom className */
|
|
208
|
+
className?: string;
|
|
209
|
+
/** Render custom row */
|
|
210
|
+
renderRow?: (item: SpecSignatureParameter3 | SpecMember4, index: number) => React.ReactNode;
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Headless type table for displaying interface/type members.
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```tsx
|
|
217
|
+
* <TypeTable items={exp.members} />
|
|
218
|
+
* ```
|
|
219
|
+
*/
|
|
220
|
+
declare function TypeTable({ items, showRequired, className, renderRow }: TypeTableProps): React.ReactNode;
|
|
221
|
+
import { OpenPkg as OpenPkg7 } from "@openpkg-ts/spec";
|
|
222
|
+
import { OpenPkg as OpenPkg6, SpecExport as SpecExport3, SpecExportKind as SpecExportKind4, SpecType } from "@openpkg-ts/spec";
|
|
223
|
+
interface HTMLOptions {
|
|
224
|
+
/** Page title override */
|
|
225
|
+
title?: string;
|
|
226
|
+
/** Include inline styles */
|
|
227
|
+
includeStyles?: boolean;
|
|
228
|
+
/** Custom CSS to inject */
|
|
229
|
+
customCSS?: string;
|
|
230
|
+
/** Custom head content */
|
|
231
|
+
headContent?: string;
|
|
232
|
+
/** Wrap in full HTML document */
|
|
233
|
+
fullDocument?: boolean;
|
|
234
|
+
/** Export to render (single mode) */
|
|
235
|
+
export?: string;
|
|
236
|
+
}
|
|
237
|
+
import { SpecExportKind } from "@openpkg-ts/spec";
|
|
238
|
+
interface JSONOptions {
|
|
239
|
+
/** Include raw spec data alongside simplified data */
|
|
240
|
+
includeRaw?: boolean;
|
|
241
|
+
/** Export to render (single mode) */
|
|
242
|
+
export?: string;
|
|
243
|
+
/** Include computed fields (signatures, formatted types) */
|
|
244
|
+
computed?: boolean;
|
|
245
|
+
/** Flatten nested structures */
|
|
246
|
+
flatten?: boolean;
|
|
247
|
+
}
|
|
248
|
+
interface SimplifiedParameter {
|
|
249
|
+
name: string;
|
|
250
|
+
type: string;
|
|
251
|
+
required: boolean;
|
|
252
|
+
description?: string;
|
|
253
|
+
default?: unknown;
|
|
254
|
+
rest?: boolean;
|
|
255
|
+
}
|
|
256
|
+
interface SimplifiedReturn {
|
|
257
|
+
type: string;
|
|
258
|
+
description?: string;
|
|
259
|
+
}
|
|
260
|
+
interface SimplifiedSignature {
|
|
261
|
+
parameters: SimplifiedParameter[];
|
|
262
|
+
returns?: SimplifiedReturn;
|
|
263
|
+
description?: string;
|
|
264
|
+
typeParameters?: string[];
|
|
265
|
+
}
|
|
266
|
+
interface SimplifiedMember {
|
|
267
|
+
name: string;
|
|
268
|
+
kind: "property" | "method";
|
|
269
|
+
type?: string;
|
|
270
|
+
description?: string;
|
|
271
|
+
visibility?: "public" | "protected" | "private";
|
|
272
|
+
signature?: SimplifiedSignature;
|
|
273
|
+
}
|
|
274
|
+
interface SimplifiedExample {
|
|
275
|
+
code: string;
|
|
276
|
+
title?: string;
|
|
277
|
+
description?: string;
|
|
278
|
+
language?: string;
|
|
279
|
+
}
|
|
280
|
+
interface SimplifiedExport {
|
|
281
|
+
id: string;
|
|
282
|
+
name: string;
|
|
283
|
+
kind: SpecExportKind;
|
|
284
|
+
signature: string;
|
|
285
|
+
description?: string;
|
|
286
|
+
deprecated: boolean;
|
|
287
|
+
tags: Array<{
|
|
288
|
+
name: string;
|
|
289
|
+
text: string;
|
|
290
|
+
}>;
|
|
291
|
+
parameters?: SimplifiedParameter[];
|
|
292
|
+
returns?: SimplifiedReturn;
|
|
293
|
+
members?: SimplifiedMember[];
|
|
294
|
+
examples?: SimplifiedExample[];
|
|
295
|
+
extends?: string;
|
|
296
|
+
implements?: string[];
|
|
297
|
+
sourceFile?: string;
|
|
298
|
+
sourceLine?: number;
|
|
299
|
+
}
|
|
300
|
+
interface SimplifiedSpec {
|
|
301
|
+
name: string;
|
|
302
|
+
version?: string;
|
|
303
|
+
description?: string;
|
|
304
|
+
exports: SimplifiedExport[];
|
|
305
|
+
byKind: Record<SpecExportKind, SimplifiedExport[]>;
|
|
306
|
+
totalExports: number;
|
|
307
|
+
}
|
|
308
|
+
interface MarkdownOptions {
|
|
309
|
+
/** Include frontmatter in output */
|
|
310
|
+
frontmatter?: boolean;
|
|
311
|
+
/** Sections to include */
|
|
312
|
+
sections?: {
|
|
313
|
+
signature?: boolean;
|
|
314
|
+
description?: boolean;
|
|
315
|
+
parameters?: boolean;
|
|
316
|
+
returns?: boolean;
|
|
317
|
+
examples?: boolean;
|
|
318
|
+
members?: boolean;
|
|
319
|
+
properties?: boolean;
|
|
320
|
+
methods?: boolean;
|
|
321
|
+
};
|
|
322
|
+
/** Custom frontmatter fields */
|
|
323
|
+
customFrontmatter?: Record<string, unknown>;
|
|
324
|
+
/** Use code fences for signatures */
|
|
325
|
+
codeSignatures?: boolean;
|
|
326
|
+
/** Heading level offset (0 = starts at h1, 1 = starts at h2) */
|
|
327
|
+
headingOffset?: number;
|
|
328
|
+
}
|
|
329
|
+
interface ExportMarkdownOptions extends MarkdownOptions {
|
|
330
|
+
/** Export to render */
|
|
331
|
+
export?: string;
|
|
332
|
+
}
|
|
333
|
+
import { SpecExportKind as SpecExportKind2 } from "@openpkg-ts/spec";
|
|
334
|
+
type NavFormat = "fumadocs" | "docusaurus" | "generic";
|
|
335
|
+
type GroupBy = "kind" | "module" | "tag" | "none";
|
|
336
|
+
interface NavOptions {
|
|
337
|
+
/** Output format */
|
|
338
|
+
format?: NavFormat;
|
|
339
|
+
/** How to group exports */
|
|
340
|
+
groupBy?: GroupBy;
|
|
341
|
+
/** Base path for links */
|
|
342
|
+
basePath?: string;
|
|
343
|
+
/** Custom slug generator */
|
|
344
|
+
slugify?: (name: string) => string;
|
|
345
|
+
/** Include index pages for groups */
|
|
346
|
+
includeGroupIndex?: boolean;
|
|
347
|
+
/** Custom kind labels */
|
|
348
|
+
kindLabels?: Partial<Record<SpecExportKind2, string>>;
|
|
349
|
+
/** Sort exports alphabetically */
|
|
350
|
+
sortAlphabetically?: boolean;
|
|
351
|
+
}
|
|
352
|
+
interface NavItem {
|
|
353
|
+
title: string;
|
|
354
|
+
href?: string;
|
|
355
|
+
items?: NavItem[];
|
|
356
|
+
}
|
|
357
|
+
interface NavGroup {
|
|
358
|
+
title: string;
|
|
359
|
+
items: NavItem[];
|
|
360
|
+
index?: string;
|
|
361
|
+
}
|
|
362
|
+
interface GenericNav {
|
|
363
|
+
title: string;
|
|
364
|
+
groups: NavGroup[];
|
|
365
|
+
items: NavItem[];
|
|
366
|
+
}
|
|
367
|
+
interface FumadocsMetaItem {
|
|
368
|
+
title: string;
|
|
369
|
+
pages?: string[];
|
|
370
|
+
defaultOpen?: boolean;
|
|
371
|
+
}
|
|
372
|
+
interface FumadocsMeta {
|
|
373
|
+
root?: boolean;
|
|
374
|
+
title?: string;
|
|
375
|
+
pages?: (string | FumadocsMetaItem)[];
|
|
376
|
+
}
|
|
377
|
+
interface DocusaurusSidebarItem {
|
|
378
|
+
type: "category" | "doc" | "link";
|
|
379
|
+
label: string;
|
|
380
|
+
items?: DocusaurusSidebarItem[];
|
|
381
|
+
id?: string;
|
|
382
|
+
href?: string;
|
|
383
|
+
}
|
|
384
|
+
type DocusaurusSidebar = DocusaurusSidebarItem[];
|
|
385
|
+
import { SpecExportKind as SpecExportKind3 } from "@openpkg-ts/spec";
|
|
386
|
+
interface SearchOptions {
|
|
387
|
+
/** Base URL for search result links */
|
|
388
|
+
baseUrl?: string;
|
|
389
|
+
/** Custom slug generator */
|
|
390
|
+
slugify?: (name: string) => string;
|
|
391
|
+
/** Include type signatures in search content */
|
|
392
|
+
includeSignatures?: boolean;
|
|
393
|
+
/** Include member names in search content */
|
|
394
|
+
includeMembers?: boolean;
|
|
395
|
+
/** Include parameter names in search content */
|
|
396
|
+
includeParameters?: boolean;
|
|
397
|
+
/** Weight multipliers for ranking */
|
|
398
|
+
weights?: {
|
|
399
|
+
name?: number;
|
|
400
|
+
description?: number;
|
|
401
|
+
signature?: number;
|
|
402
|
+
tags?: number;
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
interface PagefindRecord {
|
|
406
|
+
url: string;
|
|
407
|
+
content: string;
|
|
408
|
+
word_count: number;
|
|
409
|
+
filters: Record<string, string[]>;
|
|
410
|
+
meta: {
|
|
411
|
+
title: string;
|
|
412
|
+
kind?: string;
|
|
413
|
+
description?: string;
|
|
414
|
+
signature?: string;
|
|
415
|
+
};
|
|
416
|
+
anchors?: Array<{
|
|
417
|
+
element: string;
|
|
418
|
+
id: string;
|
|
419
|
+
text: string;
|
|
420
|
+
}>;
|
|
421
|
+
weighted_sections?: Array<{
|
|
422
|
+
weight: number;
|
|
423
|
+
text: string;
|
|
424
|
+
}>;
|
|
425
|
+
}
|
|
426
|
+
interface AlgoliaRecord {
|
|
427
|
+
objectID: string;
|
|
428
|
+
name: string;
|
|
429
|
+
kind: SpecExportKind3;
|
|
430
|
+
description?: string;
|
|
431
|
+
signature: string;
|
|
432
|
+
content: string;
|
|
433
|
+
tags: string[];
|
|
434
|
+
deprecated: boolean;
|
|
435
|
+
url: string;
|
|
436
|
+
hierarchy: {
|
|
437
|
+
lvl0: string;
|
|
438
|
+
lvl1: string;
|
|
439
|
+
lvl2?: string;
|
|
440
|
+
};
|
|
441
|
+
_rankingInfo?: {
|
|
442
|
+
nbTypos: number;
|
|
443
|
+
words: number;
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
interface SearchRecord {
|
|
447
|
+
id: string;
|
|
448
|
+
name: string;
|
|
449
|
+
kind: SpecExportKind3;
|
|
450
|
+
signature: string;
|
|
451
|
+
description?: string;
|
|
452
|
+
content: string;
|
|
453
|
+
keywords: string[];
|
|
454
|
+
url: string;
|
|
455
|
+
deprecated: boolean;
|
|
456
|
+
}
|
|
457
|
+
interface SearchIndex {
|
|
458
|
+
records: SearchRecord[];
|
|
459
|
+
version: string;
|
|
460
|
+
generatedAt: string;
|
|
461
|
+
packageName: string;
|
|
462
|
+
}
|
|
463
|
+
interface DocsInstance {
|
|
464
|
+
/** The parsed OpenPkg spec */
|
|
465
|
+
spec: OpenPkg6;
|
|
466
|
+
/** Get an by its ID */
|
|
467
|
+
getExport(id: string): SpecExport3 | undefined;
|
|
468
|
+
/** Get a type definition by its ID */
|
|
469
|
+
getType(id: string): SpecType | undefined;
|
|
470
|
+
/** Get all exports of a specific kind */
|
|
471
|
+
getExportsByKind(kind: SpecExportKind4): SpecExport3[];
|
|
472
|
+
/** Get all exports */
|
|
473
|
+
getAllExports(): SpecExport3[];
|
|
474
|
+
/** Get all type definitions */
|
|
475
|
+
getAllTypes(): SpecType[];
|
|
476
|
+
/** Get exports by JSDoc tag (e.g., '@beta', '@internal') */
|
|
477
|
+
getExportsByTag(tagName: string): SpecExport3[];
|
|
478
|
+
/** Search exports by name or description */
|
|
479
|
+
search(query: string): SpecExport3[];
|
|
480
|
+
/** Get exports belonging to a specific module/namespace */
|
|
481
|
+
getModule(moduleName: string): SpecExport3[];
|
|
482
|
+
/** Get deprecated exports */
|
|
483
|
+
getDeprecated(): SpecExport3[];
|
|
484
|
+
/** Get exports grouped by kind */
|
|
485
|
+
groupByKind(): Record<SpecExportKind4, SpecExport3[]>;
|
|
486
|
+
/** Render spec or single to MDX */
|
|
487
|
+
toMarkdown(options?: ExportMarkdownOptions): string;
|
|
488
|
+
/** Render spec or single to HTML */
|
|
489
|
+
toHTML(options?: HTMLOptions): string;
|
|
490
|
+
/** Render spec or single to JSON structure */
|
|
491
|
+
toJSON(options?: JSONOptions): SimplifiedSpec | SimplifiedExport;
|
|
492
|
+
/** Generate navigation structure */
|
|
493
|
+
toNavigation(options?: NavOptions): GenericNav | FumadocsMeta | DocusaurusSidebar;
|
|
494
|
+
/** Generate search index */
|
|
495
|
+
toSearchIndex(options?: SearchOptions): SearchIndex;
|
|
496
|
+
/** Generate Pagefind-compatible records */
|
|
497
|
+
toPagefindRecords(options?: SearchOptions): PagefindRecord[];
|
|
498
|
+
/** Generate Algolia-compatible records */
|
|
499
|
+
toAlgoliaRecords(options?: SearchOptions): AlgoliaRecord[];
|
|
500
|
+
}
|
|
501
|
+
interface APIPageProps {
|
|
502
|
+
/** Direct spec object */
|
|
503
|
+
spec?: OpenPkg7;
|
|
504
|
+
/** Or docs instance from createDocs() */
|
|
505
|
+
instance?: DocsInstance;
|
|
506
|
+
/** Export ID to render */
|
|
507
|
+
id: string;
|
|
508
|
+
/** Custom code example renderer */
|
|
509
|
+
renderExample?: (code: string, filename: string) => React.ReactNode;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Main styled API page component that renders documentation for a single export.
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```tsx
|
|
516
|
+
* import { APIPage } from '@openpkg-ts/doc-generator/react/styled'
|
|
517
|
+
* import spec from './openpkg.json'
|
|
518
|
+
*
|
|
519
|
+
* <APIPage spec={spec} id="createClient" />
|
|
520
|
+
* ```
|
|
521
|
+
*
|
|
522
|
+
* @example
|
|
523
|
+
* ```tsx
|
|
524
|
+
* // With docs instance
|
|
525
|
+
* import { APIPage } from '@openpkg-ts/doc-generator/react/styled'
|
|
526
|
+
* import { createDocs } from '@openpkg-ts/doc-generator'
|
|
527
|
+
*
|
|
528
|
+
* const docs = createDocs('./openpkg.json')
|
|
529
|
+
* <APIPage instance={docs} id="createClient" />
|
|
530
|
+
* ```
|
|
531
|
+
*/
|
|
532
|
+
declare function APIPage({ spec, instance, id, renderExample }: APIPageProps): React.ReactNode;
|
|
533
|
+
import { OpenPkg as OpenPkg8, SpecExport as SpecExport4 } from "@openpkg-ts/spec";
|
|
534
|
+
interface ClassPageProps {
|
|
535
|
+
export: SpecExport4;
|
|
536
|
+
spec: OpenPkg8;
|
|
537
|
+
/** Custom code example renderer */
|
|
538
|
+
renderExample?: (code: string, filename: string) => React.ReactNode;
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Styled class page component with Tailwind.
|
|
542
|
+
*/
|
|
543
|
+
declare function ClassPage({ export: exp, spec, renderExample }: ClassPageProps): React.ReactNode;
|
|
544
|
+
import { OpenPkg as OpenPkg9, SpecExport as SpecExport5 } from "@openpkg-ts/spec";
|
|
545
|
+
interface EnumPageProps {
|
|
546
|
+
export: SpecExport5;
|
|
547
|
+
spec: OpenPkg9;
|
|
548
|
+
/** Custom code example renderer */
|
|
549
|
+
renderExample?: (code: string, filename: string) => React.ReactNode;
|
|
550
|
+
}
|
|
551
|
+
/**
|
|
552
|
+
* Styled enum page component with Tailwind.
|
|
553
|
+
*/
|
|
554
|
+
declare function EnumPage({ export: exp, spec, renderExample }: EnumPageProps): React.ReactNode;
|
|
555
|
+
import { OpenPkg as OpenPkg10, SpecExport as SpecExport6 } from "@openpkg-ts/spec";
|
|
556
|
+
interface FunctionPageProps {
|
|
557
|
+
export: SpecExport6;
|
|
558
|
+
spec: OpenPkg10;
|
|
559
|
+
/** Custom code example renderer */
|
|
560
|
+
renderExample?: (code: string, filename: string) => React.ReactNode;
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Styled function page component with Tailwind.
|
|
564
|
+
*/
|
|
565
|
+
declare function FunctionPage({ export: exp, spec, renderExample }: FunctionPageProps): React.ReactNode;
|
|
566
|
+
import { OpenPkg as OpenPkg11, SpecExport as SpecExport7 } from "@openpkg-ts/spec";
|
|
567
|
+
interface InterfacePageProps {
|
|
568
|
+
export: SpecExport7;
|
|
569
|
+
spec: OpenPkg11;
|
|
570
|
+
/** Custom code example renderer */
|
|
571
|
+
renderExample?: (code: string, filename: string) => React.ReactNode;
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Styled interface/type page component with Tailwind.
|
|
575
|
+
*/
|
|
576
|
+
declare function InterfacePage({ export: exp, spec, renderExample }: InterfacePageProps): React.ReactNode;
|
|
577
|
+
import { OpenPkg as OpenPkg12, SpecExport as SpecExport8 } from "@openpkg-ts/spec";
|
|
578
|
+
interface VariablePageProps {
|
|
579
|
+
export: SpecExport8;
|
|
580
|
+
spec: OpenPkg12;
|
|
581
|
+
/** Custom code example renderer */
|
|
582
|
+
renderExample?: (code: string, filename: string) => React.ReactNode;
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Styled variable/constant page component with Tailwind.
|
|
586
|
+
*/
|
|
587
|
+
declare function VariablePage({ export: exp, spec, renderExample }: VariablePageProps): React.ReactNode;
|
|
588
|
+
export { groupMembersByKind, getExampleTitle, getExampleLanguage, getExampleCode, cleanCode, VariablePageProps, VariablePage, TypeTableProps, TypeTable, SignatureProps, Signature, ParamTableProps, ParamTable, ParamRowProps, ParamRow, NestedPropertyProps, NestedProperty, MembersTableProps, MembersTable, MemberRowProps, MemberRow, MemberGroups, InterfacePageProps, InterfacePage, FunctionPageProps, FunctionPage, ExpandablePropertyProps, ExpandableProperty, ExampleBlockProps, ExampleBlock, EnumPageProps, EnumPage, CollapsibleMethodProps, CollapsibleMethod, ClassPageProps, ClassPage, APIPageProps, APIPage };
|