@kubb/renderer-jsx 5.0.0-beta.8 → 5.0.0-beta.80
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/LICENSE +17 -10
- package/README.md +38 -27
- package/dist/index.cjs +382 -17892
- package/dist/index.d.ts +246 -118
- package/dist/index.js +367 -17875
- package/dist/jsx-dev-runtime.cjs +3 -10
- package/dist/jsx-dev-runtime.d.ts +4 -8
- package/dist/jsx-dev-runtime.js +1 -9
- package/dist/jsx-runtime.cjs +24 -6
- package/dist/jsx-runtime.d.ts +59 -10
- package/dist/jsx-runtime.js +24 -7
- package/dist/rolldown-runtime-C0LytTxp.js +8 -0
- package/dist/rolldown-runtime-ClG-MNz_.cjs +13 -0
- package/dist/types-OZ23urxc.d.ts +119 -0
- package/dist/types.d.ts +2 -2
- package/package.json +8 -31
- package/dist/chunk-Bb7HlUDG.js +0 -28
- package/dist/jsx-namespace-CNp0arTN.d.ts +0 -39
- package/dist/jsx-runtime-Cvu_ZYgL.js +0 -1448
- package/dist/jsx-runtime-DdmO3p0U.cjs +0 -1503
- package/dist/types-nAFMiWFw.d.ts +0 -168
- package/src/Renderer.ts +0 -180
- package/src/Runtime.tsx +0 -159
- package/src/components/Const.tsx +0 -72
- package/src/components/File.tsx +0 -186
- package/src/components/Function.tsx +0 -152
- package/src/components/Jsx.tsx +0 -34
- package/src/components/Root.tsx +0 -70
- package/src/components/Type.tsx +0 -66
- package/src/constants.ts +0 -28
- package/src/createRenderer.tsx +0 -38
- package/src/dom.ts +0 -103
- package/src/globals.ts +0 -34
- package/src/index.ts +0 -8
- package/src/jsx-dev-runtime.ts +0 -10
- package/src/jsx-namespace.d.ts +0 -52
- package/src/jsx-runtime.ts +0 -12
- package/src/types.ts +0 -207
- package/src/utils.ts +0 -267
package/dist/index.d.ts
CHANGED
|
@@ -1,52 +1,57 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { ExportNode, ImportNode, SourceNode } from "@kubb/ast";
|
|
5
|
-
import * as _$react from "react";
|
|
1
|
+
import { t as __name } from "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
+
import { d as KubbReactNode, n as Key, t as JSDoc, u as KubbReactElement } from "./types-OZ23urxc.js";
|
|
3
|
+
import { ExportNode, FileNode, ImportNode, SourceNode } from "@kubb/ast";
|
|
6
4
|
|
|
7
|
-
//#region
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly
|
|
5
|
+
//#region src/components/Callout.d.ts
|
|
6
|
+
declare const CALLOUT_LABEL: {
|
|
7
|
+
readonly tip: "TIP";
|
|
8
|
+
readonly note: "NOTE";
|
|
9
|
+
readonly important: "IMPORTANT";
|
|
10
|
+
readonly warning: "WARNING";
|
|
11
|
+
readonly caution: "CAUTION";
|
|
12
|
+
};
|
|
13
|
+
type CalloutType = keyof typeof CALLOUT_LABEL;
|
|
14
|
+
type Props$7 = {
|
|
15
|
+
key?: Key;
|
|
16
|
+
/**
|
|
17
|
+
* Callout kind. Maps to the uppercase label inside the `> [!TYPE]` marker.
|
|
18
|
+
*/
|
|
19
|
+
type: CalloutType;
|
|
20
|
+
/**
|
|
21
|
+
* Optional title rendered on the same line as the marker.
|
|
22
|
+
*/
|
|
23
|
+
title?: string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Body text. Each line is quoted with `> ` so multi-line content stays
|
|
26
|
+
* inside the callout block.
|
|
27
|
+
*/
|
|
28
|
+
children: string;
|
|
14
29
|
};
|
|
15
30
|
/**
|
|
16
|
-
*
|
|
31
|
+
* Renders a GitHub-style alert callout using the `> [!TYPE]` blockquote syntax.
|
|
17
32
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* const ThemeKey = Symbol('theme')
|
|
21
|
-
* provide(ThemeKey, { color: 'blue' })
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
declare function provide<T>(key: symbol | Context<T>, value: T): void;
|
|
25
|
-
/**
|
|
26
|
-
* Injects a value provided by an ancestor component (Vue 3 style)
|
|
33
|
+
* Emits a `<File.Source>` block containing `> [!TYPE] Title` followed by the
|
|
34
|
+
* body with every line prefixed by `> `.
|
|
27
35
|
*
|
|
28
36
|
* @example
|
|
29
|
-
* ```
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
|
|
33
|
-
declare function inject<T>(key: symbol | Context<T>, defaultValue?: T): T;
|
|
34
|
-
/**
|
|
35
|
-
* Removes a provided value from the context stack (for cleanup)
|
|
36
|
-
* @internal
|
|
37
|
-
*/
|
|
38
|
-
declare function unprovide<T>(key: symbol | Context<T>): void;
|
|
39
|
-
/**
|
|
40
|
-
* Creates a context key with a default value (React-style compatibility)
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <Callout type="tip">Run `kubb start --watch` to keep the generator hot.</Callout>
|
|
39
|
+
* // > [!TIP]
|
|
40
|
+
* // > Run `kubb start --watch` to keep the generator hot.
|
|
41
41
|
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* // ThemeContext is now typed as Context<{ color: string }>
|
|
46
|
-
* const theme = useContext(ThemeContext) // theme is { color: string }
|
|
42
|
+
* <Callout type="warning" title="Heads up">Breaking change in v6.</Callout>
|
|
43
|
+
* // > [!WARNING] Heads up
|
|
44
|
+
* // > Breaking change in v6.
|
|
47
45
|
* ```
|
|
48
46
|
*/
|
|
49
|
-
declare function
|
|
47
|
+
declare function Callout({
|
|
48
|
+
type,
|
|
49
|
+
title,
|
|
50
|
+
children
|
|
51
|
+
}: Props$7): KubbReactElement;
|
|
52
|
+
declare namespace Callout {
|
|
53
|
+
var displayName: string;
|
|
54
|
+
}
|
|
50
55
|
//#endregion
|
|
51
56
|
//#region src/components/Const.d.ts
|
|
52
57
|
type ConstProps = {
|
|
@@ -62,30 +67,28 @@ type ConstProps = {
|
|
|
62
67
|
* Emit the `export` keyword before the `const` declaration.
|
|
63
68
|
* - `true` generates `export const name = …`
|
|
64
69
|
* - `false` generates `const name = …`
|
|
65
|
-
* @default false
|
|
66
70
|
*/
|
|
67
|
-
export?: boolean;
|
|
71
|
+
export?: boolean | null;
|
|
68
72
|
/**
|
|
69
73
|
* TypeScript type annotation for the constant, written verbatim after `const name:`.
|
|
70
74
|
*
|
|
71
75
|
* @example
|
|
72
76
|
* `type: 'Pet'` → `const pet: Pet = …`
|
|
73
77
|
*/
|
|
74
|
-
type?: string;
|
|
78
|
+
type?: string | null;
|
|
75
79
|
/**
|
|
76
80
|
* JSDoc block to prepend to the constant declaration.
|
|
77
81
|
* Each entry in `comments` becomes one line inside the emitted `/** … *\/` block.
|
|
78
82
|
*/
|
|
79
|
-
JSDoc?: JSDoc;
|
|
83
|
+
JSDoc?: JSDoc | null;
|
|
80
84
|
/**
|
|
81
|
-
* Append `as const` after the
|
|
85
|
+
* Append `as const` after the initializer, enabling TypeScript const assertions.
|
|
82
86
|
* - `true` generates `const name = … as const`
|
|
83
87
|
* - `false` generates `const name = …`
|
|
84
|
-
* @default false
|
|
85
88
|
*/
|
|
86
|
-
asConst?: boolean;
|
|
89
|
+
asConst?: boolean | null;
|
|
87
90
|
/**
|
|
88
|
-
* Child nodes rendered as the
|
|
91
|
+
* Child nodes rendered as the initializer expression of the constant.
|
|
89
92
|
*/
|
|
90
93
|
children?: KubbReactNode;
|
|
91
94
|
};
|
|
@@ -139,26 +142,34 @@ type BasePropsWithoutBaseName = {
|
|
|
139
142
|
baseName?: never;
|
|
140
143
|
/**
|
|
141
144
|
* Fully qualified path to the generated file.
|
|
142
|
-
* Optional when `baseName` is omitted
|
|
145
|
+
* Optional when `baseName` is omitted, the component renders its children inline.
|
|
143
146
|
*/
|
|
144
|
-
path?: string;
|
|
147
|
+
path?: string | null;
|
|
145
148
|
};
|
|
146
149
|
type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
|
|
147
|
-
type Props$
|
|
150
|
+
type Props$6<TMeta> = BaseProps & {
|
|
148
151
|
key?: Key;
|
|
149
152
|
/**
|
|
150
|
-
* Arbitrary metadata attached to the file node.
|
|
151
|
-
* Used by plugins for barrel generation and custom post-processing.
|
|
153
|
+
* Arbitrary metadata attached to the file node for plugins to read.
|
|
152
154
|
*/
|
|
153
|
-
meta?: TMeta;
|
|
155
|
+
meta?: TMeta | null;
|
|
154
156
|
/**
|
|
155
157
|
* Text prepended to the generated file content before any source blocks.
|
|
158
|
+
* Accepts `null` so `resolver.resolveBanner()` results can be passed directly.
|
|
156
159
|
*/
|
|
157
|
-
banner?: string;
|
|
160
|
+
banner?: string | null;
|
|
158
161
|
/**
|
|
159
162
|
* Text appended to the generated file content after all source blocks.
|
|
163
|
+
* Accepts `null` so `resolver.resolveFooter()` results can be passed directly.
|
|
160
164
|
*/
|
|
161
|
-
footer?: string;
|
|
165
|
+
footer?: string | null;
|
|
166
|
+
/**
|
|
167
|
+
* Absolute on-disk path to copy verbatim into the output, bypassing the parser. Use to emit a
|
|
168
|
+
* real source file shipped inside a package (a template) into the generated folder. Only
|
|
169
|
+
* `banner`/`footer` are applied around the copied content; child source blocks are ignored for
|
|
170
|
+
* output but still drive barrel generation.
|
|
171
|
+
*/
|
|
172
|
+
copy?: string | null;
|
|
162
173
|
/**
|
|
163
174
|
* Child nodes rendered as the content of this file (source blocks, imports, exports).
|
|
164
175
|
*/
|
|
@@ -183,7 +194,7 @@ type Props$2<TMeta> = BaseProps & {
|
|
|
183
194
|
declare function File<TMeta extends object = object>({
|
|
184
195
|
children,
|
|
185
196
|
...props
|
|
186
|
-
}: Props$
|
|
197
|
+
}: Props$6<TMeta>): KubbReactElement;
|
|
187
198
|
declare namespace File {
|
|
188
199
|
var displayName: string;
|
|
189
200
|
var Export: typeof FileExport;
|
|
@@ -200,8 +211,8 @@ type FileSourceProps = Omit<SourceNode, 'kind' | 'value'> & {
|
|
|
200
211
|
/**
|
|
201
212
|
* Marks a block of source text to be associated with the enclosing {@link File}.
|
|
202
213
|
*
|
|
203
|
-
* Children are treated as the source string.
|
|
204
|
-
* `
|
|
214
|
+
* Children are treated as the source string. `isExportable` prepends the `export` keyword,
|
|
215
|
+
* `isIndexable` includes the source in barrel/index generation, and `name` keys deduplication.
|
|
205
216
|
*
|
|
206
217
|
* @example Exportable, indexable source block
|
|
207
218
|
* ```tsx
|
|
@@ -279,8 +290,43 @@ declare namespace FileImport {
|
|
|
279
290
|
var displayName: string;
|
|
280
291
|
}
|
|
281
292
|
//#endregion
|
|
293
|
+
//#region src/components/Frontmatter.d.ts
|
|
294
|
+
type Props$5 = {
|
|
295
|
+
key?: Key;
|
|
296
|
+
/**
|
|
297
|
+
* Plain object serialized as YAML between `---` fences.
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* `{ title: 'Pets', layout: 'doc' }`
|
|
301
|
+
*/
|
|
302
|
+
data: Record<string, unknown>;
|
|
303
|
+
};
|
|
304
|
+
/**
|
|
305
|
+
* Emits a YAML frontmatter envelope at the top of a generated markdown file.
|
|
306
|
+
*
|
|
307
|
+
* Renders a `<File.Source>` block containing `---\n<yaml>\n---`. Place it as
|
|
308
|
+
* the first child of `<File>` so it appears at the top of the output. Pair with
|
|
309
|
+
* `parserMd` to write `.md` files whose frontmatter downstream tooling can read.
|
|
310
|
+
*
|
|
311
|
+
* @example Page frontmatter at the top of a generated markdown file
|
|
312
|
+
* ```tsx
|
|
313
|
+
* <File baseName="pets.md" path="src/pets.md">
|
|
314
|
+
* <Frontmatter data={{ title: 'Pets', layout: 'doc' }} />
|
|
315
|
+
* <File.Source>
|
|
316
|
+
* {'# Pets\n\nList of pets.'}
|
|
317
|
+
* </File.Source>
|
|
318
|
+
* </File>
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
declare function Frontmatter({
|
|
322
|
+
data
|
|
323
|
+
}: Props$5): KubbReactElement;
|
|
324
|
+
declare namespace Frontmatter {
|
|
325
|
+
var displayName: string;
|
|
326
|
+
}
|
|
327
|
+
//#endregion
|
|
282
328
|
//#region src/components/Function.d.ts
|
|
283
|
-
type Props$
|
|
329
|
+
type Props$4 = {
|
|
284
330
|
key?: Key;
|
|
285
331
|
/**
|
|
286
332
|
* Identifier of the generated function declaration.
|
|
@@ -292,30 +338,27 @@ type Props$1 = {
|
|
|
292
338
|
/**
|
|
293
339
|
* Emit `default` after the `export` keyword, making this the module's default export.
|
|
294
340
|
* Requires `export` to also be `true`.
|
|
295
|
-
* @default false
|
|
296
341
|
*/
|
|
297
|
-
default?: boolean;
|
|
342
|
+
default?: boolean | null;
|
|
298
343
|
/**
|
|
299
344
|
* Parameter list written verbatim between the function's parentheses.
|
|
300
345
|
*
|
|
301
346
|
* @example
|
|
302
347
|
* `params: 'petId: string, options?: RequestOptions'`
|
|
303
348
|
*/
|
|
304
|
-
params?: string;
|
|
349
|
+
params?: string | null;
|
|
305
350
|
/**
|
|
306
351
|
* Emit the `export` keyword before the function declaration.
|
|
307
352
|
* - `true` generates `export function name(…) { … }`
|
|
308
353
|
* - `false` generates `function name(…) { … }`
|
|
309
|
-
* @default false
|
|
310
354
|
*/
|
|
311
|
-
export?: boolean;
|
|
355
|
+
export?: boolean | null;
|
|
312
356
|
/**
|
|
313
357
|
* Emit the `async` keyword, making this an async function.
|
|
314
358
|
* The return type is automatically wrapped in `Promise<returnType>` when both
|
|
315
359
|
* `async` and `returnType` are set.
|
|
316
|
-
* @default false
|
|
317
360
|
*/
|
|
318
|
-
async?: boolean;
|
|
361
|
+
async?: boolean | null;
|
|
319
362
|
/**
|
|
320
363
|
* TypeScript generic type parameters written verbatim between `<` and `>`.
|
|
321
364
|
* Pass an array to emit multiple parameters separated by commas.
|
|
@@ -326,7 +369,7 @@ type Props$1 = {
|
|
|
326
369
|
* @example Multiple generics
|
|
327
370
|
* `generics: ['TData', 'TError = unknown']`
|
|
328
371
|
*/
|
|
329
|
-
generics?: string | string
|
|
372
|
+
generics?: string | Array<string> | null;
|
|
330
373
|
/**
|
|
331
374
|
* TypeScript return type annotation written verbatim after `:`.
|
|
332
375
|
* When `async` is `true`, the value is automatically wrapped in `Promise<…>`.
|
|
@@ -334,12 +377,12 @@ type Props$1 = {
|
|
|
334
377
|
* @example
|
|
335
378
|
* `returnType: 'Pet'`
|
|
336
379
|
*/
|
|
337
|
-
returnType?: string;
|
|
380
|
+
returnType?: string | null;
|
|
338
381
|
/**
|
|
339
382
|
* JSDoc block to prepend to the function declaration.
|
|
340
383
|
* Each entry in `comments` becomes one line inside the emitted `/** … *\/` block.
|
|
341
384
|
*/
|
|
342
|
-
JSDoc?: JSDoc;
|
|
385
|
+
JSDoc?: JSDoc | null;
|
|
343
386
|
/**
|
|
344
387
|
* Child nodes rendered as the body of the function.
|
|
345
388
|
*/
|
|
@@ -361,19 +404,18 @@ type Props$1 = {
|
|
|
361
404
|
declare function Function({
|
|
362
405
|
children,
|
|
363
406
|
...props
|
|
364
|
-
}: Props$
|
|
407
|
+
}: Props$4): KubbReactElement;
|
|
365
408
|
declare namespace Function {
|
|
366
409
|
var displayName: string;
|
|
367
410
|
var Arrow: typeof ArrowFunction;
|
|
368
411
|
}
|
|
369
|
-
type ArrowFunctionProps = Props$
|
|
412
|
+
type ArrowFunctionProps = Props$4 & {
|
|
370
413
|
/**
|
|
371
414
|
* Render the arrow function as a single-line expression (no braces around the body).
|
|
372
415
|
* - `true` generates `const name = (…) => expression`
|
|
373
416
|
* - `false` generates `const name = (…) => { … }`
|
|
374
|
-
* @default false
|
|
375
417
|
*/
|
|
376
|
-
singleLine?: boolean;
|
|
418
|
+
singleLine?: boolean | null;
|
|
377
419
|
};
|
|
378
420
|
/**
|
|
379
421
|
* Generates an arrow function expression assigned to a `const`.
|
|
@@ -391,16 +433,51 @@ type ArrowFunctionProps = Props$1 & {
|
|
|
391
433
|
declare function ArrowFunction({
|
|
392
434
|
children,
|
|
393
435
|
...props
|
|
394
|
-
}: ArrowFunctionProps):
|
|
436
|
+
}: ArrowFunctionProps): any;
|
|
395
437
|
declare namespace ArrowFunction {
|
|
396
438
|
var displayName: string;
|
|
397
439
|
}
|
|
398
440
|
//#endregion
|
|
441
|
+
//#region src/components/Heading.d.ts
|
|
442
|
+
type Level = 1 | 2 | 3 | 4 | 5 | 6;
|
|
443
|
+
type Props$3 = {
|
|
444
|
+
key?: Key;
|
|
445
|
+
/**
|
|
446
|
+
* Heading depth, `1` through `6`. Matches the number of `#` characters
|
|
447
|
+
* prefixed to the heading text.
|
|
448
|
+
*/
|
|
449
|
+
level: Level;
|
|
450
|
+
/**
|
|
451
|
+
* Heading text. Inline markdown (links, emphasis) is passed through verbatim.
|
|
452
|
+
*/
|
|
453
|
+
children: string;
|
|
454
|
+
};
|
|
455
|
+
/**
|
|
456
|
+
* Renders an ATX-style markdown heading.
|
|
457
|
+
*
|
|
458
|
+
* Emits a `<File.Source>` block containing `${'#'.repeat(level)} ${children}`.
|
|
459
|
+
* Use inside a `<File>` rendered by `parserMd`.
|
|
460
|
+
*
|
|
461
|
+
* @example
|
|
462
|
+
* ```tsx
|
|
463
|
+
* <Heading level={2}>Installation</Heading>
|
|
464
|
+
* // ## Installation
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
declare function Heading({
|
|
468
|
+
level,
|
|
469
|
+
children
|
|
470
|
+
}: Props$3): KubbReactElement;
|
|
471
|
+
declare namespace Heading {
|
|
472
|
+
var displayName: string;
|
|
473
|
+
}
|
|
474
|
+
//#endregion
|
|
399
475
|
//#region src/components/Jsx.d.ts
|
|
400
|
-
type Props = {
|
|
476
|
+
type Props$2 = {
|
|
401
477
|
/**
|
|
402
|
-
* Raw JSX string
|
|
403
|
-
*
|
|
478
|
+
* Raw JSX string embedded verbatim in the generated code, including
|
|
479
|
+
* fragments (`<>…</>`).
|
|
480
|
+
*
|
|
404
481
|
* @example
|
|
405
482
|
* ```tsx
|
|
406
483
|
* <Jsx>{'<>\n <a href={href}>Open</a>\n</>'}</Jsx>
|
|
@@ -411,10 +488,10 @@ type Props = {
|
|
|
411
488
|
/**
|
|
412
489
|
* Embeds a raw JSX string verbatim in the generated source code.
|
|
413
490
|
*
|
|
414
|
-
* Use this component
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
*
|
|
491
|
+
* Use this component to include JSX markup (including fragments `<>…</>`) in the
|
|
492
|
+
* body of a generated function or component. The `children` prop must be a plain
|
|
493
|
+
* string. Write expression attributes that reference runtime values as template
|
|
494
|
+
* literals.
|
|
418
495
|
*
|
|
419
496
|
* @example
|
|
420
497
|
* ```tsx
|
|
@@ -425,40 +502,76 @@ type Props = {
|
|
|
425
502
|
*/
|
|
426
503
|
declare function Jsx({
|
|
427
504
|
children
|
|
428
|
-
}: Props): KubbReactElement;
|
|
505
|
+
}: Props$2): KubbReactElement;
|
|
429
506
|
declare namespace Jsx {
|
|
430
507
|
var displayName: string;
|
|
431
508
|
}
|
|
432
509
|
//#endregion
|
|
433
|
-
//#region src/components/
|
|
434
|
-
type
|
|
510
|
+
//#region src/components/List.d.ts
|
|
511
|
+
type Props$1 = {
|
|
512
|
+
key?: Key;
|
|
435
513
|
/**
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
*
|
|
514
|
+
* When `true`, emits a numbered list (`1. …`). When `false` or omitted,
|
|
515
|
+
* emits a bullet list (`- …`).
|
|
516
|
+
*
|
|
517
|
+
* @default false
|
|
439
518
|
*/
|
|
440
|
-
|
|
519
|
+
ordered?: boolean | null;
|
|
441
520
|
/**
|
|
442
|
-
*
|
|
443
|
-
* Use this to propagate errors up to the caller of {@link createRenderer}.
|
|
521
|
+
* One entry per line. Inline markdown is passed through verbatim.
|
|
444
522
|
*/
|
|
445
|
-
|
|
523
|
+
items: ReadonlyArray<string>;
|
|
524
|
+
};
|
|
525
|
+
/**
|
|
526
|
+
* Renders a markdown list.
|
|
527
|
+
*
|
|
528
|
+
* Emits a `<File.Source>` block containing one entry per line, prefixed with
|
|
529
|
+
* `1.` / `2.` … when `ordered`, or `-` otherwise.
|
|
530
|
+
*
|
|
531
|
+
* @example
|
|
532
|
+
* ```tsx
|
|
533
|
+
* <List items={['Add the parser', 'Render the page']} />
|
|
534
|
+
* // - Add the parser
|
|
535
|
+
* // - Render the page
|
|
536
|
+
*
|
|
537
|
+
* <List ordered items={['First', 'Second']} />
|
|
538
|
+
* // 1. First
|
|
539
|
+
* // 2. Second
|
|
540
|
+
* ```
|
|
541
|
+
*/
|
|
542
|
+
declare function List({
|
|
543
|
+
ordered,
|
|
544
|
+
items
|
|
545
|
+
}: Props$1): KubbReactElement;
|
|
546
|
+
declare namespace List {
|
|
547
|
+
var displayName: string;
|
|
548
|
+
}
|
|
549
|
+
//#endregion
|
|
550
|
+
//#region src/components/Paragraph.d.ts
|
|
551
|
+
type Props = {
|
|
552
|
+
key?: Key;
|
|
446
553
|
/**
|
|
447
|
-
*
|
|
554
|
+
* Paragraph text. Inline markdown (links, emphasis, code spans) is passed
|
|
555
|
+
* through verbatim.
|
|
448
556
|
*/
|
|
449
|
-
children
|
|
557
|
+
children: string;
|
|
450
558
|
};
|
|
451
559
|
/**
|
|
452
|
-
*
|
|
560
|
+
* Renders a markdown paragraph.
|
|
453
561
|
*
|
|
454
|
-
*
|
|
455
|
-
*
|
|
562
|
+
* Emits a `<File.Source>` block containing the text as-is. Paragraphs are
|
|
563
|
+
* separated from surrounding blocks by blank lines via the parser's source
|
|
564
|
+
* joining.
|
|
565
|
+
*
|
|
566
|
+
* @example
|
|
567
|
+
* ```tsx
|
|
568
|
+
* <Paragraph>{'A pet object with `id` and `name` fields.'}</Paragraph>
|
|
569
|
+
* ```
|
|
456
570
|
*/
|
|
457
|
-
declare function
|
|
458
|
-
onError,
|
|
571
|
+
declare function Paragraph({
|
|
459
572
|
children
|
|
460
|
-
}:
|
|
461
|
-
declare namespace
|
|
573
|
+
}: Props): KubbReactElement;
|
|
574
|
+
declare namespace Paragraph {
|
|
462
575
|
var displayName: string;
|
|
463
576
|
}
|
|
464
577
|
//#endregion
|
|
@@ -477,14 +590,13 @@ type TypeProps = {
|
|
|
477
590
|
* Emit the `export` keyword before the type alias declaration.
|
|
478
591
|
* - `true` generates `export type Name = …`
|
|
479
592
|
* - `false` generates `type Name = …`
|
|
480
|
-
* @default false
|
|
481
593
|
*/
|
|
482
|
-
export?: boolean;
|
|
594
|
+
export?: boolean | null;
|
|
483
595
|
/**
|
|
484
596
|
* JSDoc block to prepend to the type alias declaration.
|
|
485
597
|
* Each entry in `comments` becomes one line inside the emitted `/** … *\/` block.
|
|
486
598
|
*/
|
|
487
|
-
JSDoc?: JSDoc;
|
|
599
|
+
JSDoc?: JSDoc | null;
|
|
488
600
|
/**
|
|
489
601
|
* Child nodes rendered as the type expression on the right-hand side of the alias.
|
|
490
602
|
*/
|
|
@@ -493,7 +605,7 @@ type TypeProps = {
|
|
|
493
605
|
/**
|
|
494
606
|
* Generates a TypeScript type alias declaration.
|
|
495
607
|
*
|
|
496
|
-
* Throws if `name` does not start with an uppercase letter
|
|
608
|
+
* Throws if `name` does not start with an uppercase letter. TypeScript type aliases
|
|
497
609
|
* should follow PascalCase naming conventions.
|
|
498
610
|
*
|
|
499
611
|
* @example Simple exported type alias
|
|
@@ -521,31 +633,47 @@ declare namespace Type {
|
|
|
521
633
|
//#endregion
|
|
522
634
|
//#region src/createRenderer.d.ts
|
|
523
635
|
/**
|
|
524
|
-
*
|
|
636
|
+
* Factory for a renderer that walks the JSX tree in a single recursive pass,
|
|
637
|
+
* with no React reconciler or scheduler. Pass it as the `renderer` property on
|
|
638
|
+
* `defineGenerator`. Kubb core calls the factory once per render cycle and stays
|
|
639
|
+
* generic, with no hard dependency on `@kubb/renderer-jsx`.
|
|
525
640
|
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
*
|
|
641
|
+
* Every component must be a pure function. Hooks, suspense, and class
|
|
642
|
+
* components are not supported. The returned renderer also exposes `stream()`
|
|
643
|
+
* for incremental file emission.
|
|
529
644
|
*
|
|
530
|
-
* @example
|
|
531
|
-
* ```
|
|
532
|
-
* import { jsxRenderer } from '@kubb/renderer-jsx'
|
|
645
|
+
* @example Wire up a JSX generator
|
|
646
|
+
* ```tsx
|
|
533
647
|
* import { defineGenerator } from '@kubb/core'
|
|
648
|
+
* import { jsxRenderer } from '@kubb/renderer-jsx'
|
|
534
649
|
*
|
|
535
650
|
* export const myGenerator = defineGenerator<PluginTs>({
|
|
536
|
-
* name: '
|
|
651
|
+
* name: 'types',
|
|
537
652
|
* renderer: jsxRenderer,
|
|
538
|
-
* schema(node,
|
|
539
|
-
* return
|
|
653
|
+
* schema(node, ctx) {
|
|
654
|
+
* return (
|
|
655
|
+
* <File baseName="output.ts" path={`${ctx.root}/output.ts`}>
|
|
656
|
+
* <Type node={node} resolver={ctx.resolver} />
|
|
657
|
+
* </File>
|
|
658
|
+
* )
|
|
540
659
|
* },
|
|
541
660
|
* })
|
|
542
661
|
* ```
|
|
662
|
+
*
|
|
663
|
+
* @example Stream files as they are produced
|
|
664
|
+
* ```tsx
|
|
665
|
+
* const renderer = jsxRenderer()
|
|
666
|
+
* for (const file of renderer.stream(element)) {
|
|
667
|
+
* await writeFile(file.path, file.sources[0])
|
|
668
|
+
* }
|
|
669
|
+
* ```
|
|
543
670
|
*/
|
|
544
671
|
declare const jsxRenderer: () => {
|
|
545
672
|
render(element: KubbReactElement): Promise<void>;
|
|
546
|
-
readonly files:
|
|
547
|
-
|
|
673
|
+
readonly files: FileNode[];
|
|
674
|
+
stream(element: KubbReactElement): Generator<FileNode>;
|
|
675
|
+
[Symbol.dispose](): void;
|
|
548
676
|
};
|
|
549
677
|
//#endregion
|
|
550
|
-
export { Const, File, Function,
|
|
678
|
+
export { Callout, Const, File, Frontmatter, Function, Heading, Jsx, List, Paragraph, Type, jsxRenderer };
|
|
551
679
|
//# sourceMappingURL=index.d.ts.map
|