@kubb/renderer-jsx 5.0.0-alpha.33
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 +14 -0
- package/dist/chunk-CErwXX-a.js +28 -0
- package/dist/index.cjs +18090 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +330 -0
- package/dist/index.js +18075 -0
- package/dist/index.js.map +1 -0
- package/dist/jsx-dev-runtime.cjs +11 -0
- package/dist/jsx-dev-runtime.cjs.map +1 -0
- package/dist/jsx-dev-runtime.d.ts +14 -0
- package/dist/jsx-dev-runtime.js +10 -0
- package/dist/jsx-dev-runtime.js.map +1 -0
- package/dist/jsx-namespace-Cx1KMEbe.d.ts +39 -0
- package/dist/jsx-runtime-CeMde2cR.cjs +1503 -0
- package/dist/jsx-runtime-CeMde2cR.cjs.map +1 -0
- package/dist/jsx-runtime-Dmf9wTKR.js +1448 -0
- package/dist/jsx-runtime-Dmf9wTKR.js.map +1 -0
- package/dist/jsx-runtime.cjs +15 -0
- package/dist/jsx-runtime.cjs.map +1 -0
- package/dist/jsx-runtime.d.ts +16 -0
- package/dist/jsx-runtime.js +12 -0
- package/dist/jsx-runtime.js.map +1 -0
- package/dist/types-C7FD9BLg.d.ts +119 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -0
- package/package.json +121 -0
- package/src/Renderer.ts +184 -0
- package/src/Runtime.tsx +171 -0
- package/src/components/Const.tsx +44 -0
- package/src/components/File.tsx +106 -0
- package/src/components/Function.tsx +107 -0
- package/src/components/Jsx.tsx +34 -0
- package/src/components/Root.tsx +64 -0
- package/src/components/Type.tsx +40 -0
- package/src/context/KubbContext.ts +15 -0
- package/src/context/OasContext.ts +9 -0
- package/src/createRenderer.tsx +32 -0
- package/src/dom.ts +91 -0
- package/src/globals.ts +34 -0
- package/src/index.ts +10 -0
- package/src/jsx-dev-runtime.ts +10 -0
- package/src/jsx-namespace.d.ts +53 -0
- package/src/jsx-runtime.ts +12 -0
- package/src/types.ts +113 -0
- package/src/utils.ts +301 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { n as __name } from "./chunk-CErwXX-a.js";
|
|
2
|
+
import { C as inject, S as createContext, T as unprovide, a as JSDoc, h as KubbReactNode, m as KubbReactElement, o as Key, w as provide, x as Context } from "./types-C7FD9BLg.js";
|
|
3
|
+
import { ExportNode, FileNode, ImportNode, SourceNode } from "@kubb/ast/types";
|
|
4
|
+
import * as _$react from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/components/Const.d.ts
|
|
7
|
+
type ConstProps = {
|
|
8
|
+
key?: Key;
|
|
9
|
+
/**
|
|
10
|
+
* Name of the const
|
|
11
|
+
*/
|
|
12
|
+
name: string;
|
|
13
|
+
/**
|
|
14
|
+
* Does this type need to be exported.
|
|
15
|
+
*/
|
|
16
|
+
export?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Type to make the const being typed
|
|
19
|
+
*/
|
|
20
|
+
type?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Options for JSdocs.
|
|
23
|
+
*/
|
|
24
|
+
JSDoc?: JSDoc;
|
|
25
|
+
/**
|
|
26
|
+
* Use of `const` assertions
|
|
27
|
+
*/
|
|
28
|
+
asConst?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Children nodes.
|
|
31
|
+
*/
|
|
32
|
+
children?: KubbReactNode;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Generates a TypeScript constant declaration.
|
|
36
|
+
*/
|
|
37
|
+
declare function Const({
|
|
38
|
+
children,
|
|
39
|
+
...props
|
|
40
|
+
}: ConstProps): KubbReactElement;
|
|
41
|
+
declare namespace Const {
|
|
42
|
+
var displayName: string;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
//#region src/components/File.d.ts
|
|
46
|
+
type BasePropsWithBaseName = {
|
|
47
|
+
/**
|
|
48
|
+
* Name to be used to dynamically create the baseName(based on input.path).
|
|
49
|
+
* Based on UNIX basename
|
|
50
|
+
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
51
|
+
*/
|
|
52
|
+
baseName: `${string}.${string}`;
|
|
53
|
+
/**
|
|
54
|
+
* Path will be full qualified path to a specified file.
|
|
55
|
+
*/
|
|
56
|
+
path: string;
|
|
57
|
+
};
|
|
58
|
+
type BasePropsWithoutBaseName = {
|
|
59
|
+
baseName?: never;
|
|
60
|
+
/**
|
|
61
|
+
* Path will be full qualified path to a specified file.
|
|
62
|
+
*/
|
|
63
|
+
path?: string;
|
|
64
|
+
};
|
|
65
|
+
type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
|
|
66
|
+
type Props$2<TMeta> = BaseProps & {
|
|
67
|
+
key?: Key;
|
|
68
|
+
meta?: TMeta;
|
|
69
|
+
banner?: string;
|
|
70
|
+
footer?: string;
|
|
71
|
+
children?: KubbReactNode;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Adds files to the FileManager
|
|
75
|
+
*/
|
|
76
|
+
declare function File<TMeta extends object = object>({
|
|
77
|
+
children,
|
|
78
|
+
...props
|
|
79
|
+
}: Props$2<TMeta>): KubbReactElement;
|
|
80
|
+
declare namespace File {
|
|
81
|
+
var displayName: string;
|
|
82
|
+
var Export: typeof FileExport;
|
|
83
|
+
var Import: typeof FileImport;
|
|
84
|
+
var Source: typeof FileSource;
|
|
85
|
+
}
|
|
86
|
+
type FileSourceProps = Omit<SourceNode, 'kind' | 'value'> & {
|
|
87
|
+
key?: Key;
|
|
88
|
+
children?: KubbReactNode;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* File.Source
|
|
92
|
+
*
|
|
93
|
+
* Marks a block of source text to be associated with the current file when
|
|
94
|
+
* rendering with the FileCollector. Children are treated as the source string.
|
|
95
|
+
*/
|
|
96
|
+
declare function FileSource({
|
|
97
|
+
children,
|
|
98
|
+
...props
|
|
99
|
+
}: FileSourceProps): KubbReactElement;
|
|
100
|
+
declare namespace FileSource {
|
|
101
|
+
var displayName: string;
|
|
102
|
+
}
|
|
103
|
+
type FileExportProps = Omit<ExportNode, 'kind'> & {
|
|
104
|
+
key?: Key;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* File.Export
|
|
108
|
+
*
|
|
109
|
+
* Declares an export entry for the current file. This will be collected by
|
|
110
|
+
* the FileCollector for later emission.
|
|
111
|
+
*/
|
|
112
|
+
declare function FileExport(props: FileExportProps): KubbReactElement;
|
|
113
|
+
declare namespace FileExport {
|
|
114
|
+
var displayName: string;
|
|
115
|
+
}
|
|
116
|
+
type FileImportProps = Omit<ImportNode, 'kind'> & {
|
|
117
|
+
key?: Key;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* File.Import
|
|
121
|
+
*
|
|
122
|
+
* Declares an import entry for the current file.
|
|
123
|
+
*/
|
|
124
|
+
declare function FileImport(props: FileImportProps): KubbReactElement;
|
|
125
|
+
declare namespace FileImport {
|
|
126
|
+
var displayName: string;
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
//#region src/components/Function.d.ts
|
|
130
|
+
type Props$1 = {
|
|
131
|
+
key?: Key;
|
|
132
|
+
/**
|
|
133
|
+
* Name of the function.
|
|
134
|
+
*/
|
|
135
|
+
name: string;
|
|
136
|
+
/**
|
|
137
|
+
* Add default when export is being used
|
|
138
|
+
*/
|
|
139
|
+
default?: boolean;
|
|
140
|
+
/**
|
|
141
|
+
* Parameters/options/props that need to be used.
|
|
142
|
+
*/
|
|
143
|
+
params?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Does this function need to be exported.
|
|
146
|
+
*/
|
|
147
|
+
export?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Does the function has async/promise behavior.
|
|
150
|
+
* This will also add `Promise<returnType>` as the returnType.
|
|
151
|
+
*/
|
|
152
|
+
async?: boolean;
|
|
153
|
+
/**
|
|
154
|
+
* Generics that needs to be added for TypeScript.
|
|
155
|
+
*/
|
|
156
|
+
generics?: string | string[];
|
|
157
|
+
/**
|
|
158
|
+
* ReturnType(see async for adding Promise type).
|
|
159
|
+
*/
|
|
160
|
+
returnType?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Options for JSdocs.
|
|
163
|
+
*/
|
|
164
|
+
JSDoc?: JSDoc;
|
|
165
|
+
/**
|
|
166
|
+
* Children nodes.
|
|
167
|
+
*/
|
|
168
|
+
children?: KubbReactNode;
|
|
169
|
+
};
|
|
170
|
+
/**
|
|
171
|
+
* Generates a TypeScript function declaration.
|
|
172
|
+
*/
|
|
173
|
+
declare function Function({
|
|
174
|
+
children,
|
|
175
|
+
...props
|
|
176
|
+
}: Props$1): KubbReactElement;
|
|
177
|
+
declare namespace Function {
|
|
178
|
+
var displayName: string;
|
|
179
|
+
var Arrow: typeof ArrowFunction;
|
|
180
|
+
}
|
|
181
|
+
type ArrowFunctionProps = Props$1 & {
|
|
182
|
+
/**
|
|
183
|
+
* Create Arrow function in one line
|
|
184
|
+
*/
|
|
185
|
+
singleLine?: boolean;
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* ArrowFunction
|
|
189
|
+
*
|
|
190
|
+
* Renders an arrow function definition. Supports the same flags as `Function`.
|
|
191
|
+
* Use `singleLine` to render the body as a single-line expression.
|
|
192
|
+
*/
|
|
193
|
+
declare function ArrowFunction({
|
|
194
|
+
children,
|
|
195
|
+
...props
|
|
196
|
+
}: ArrowFunctionProps): _$react.JSX.Element;
|
|
197
|
+
declare namespace ArrowFunction {
|
|
198
|
+
var displayName: string;
|
|
199
|
+
}
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/components/Jsx.d.ts
|
|
202
|
+
type Props = {
|
|
203
|
+
/**
|
|
204
|
+
* Raw JSX string to embed verbatim in the generated code.
|
|
205
|
+
* Supports JSX fragments (`<>…</>`), elements, and any valid JSX syntax.
|
|
206
|
+
* @example
|
|
207
|
+
* ```tsx
|
|
208
|
+
* <Jsx>{'<>\n <a href={href}>Open</a>\n</>'}</Jsx>
|
|
209
|
+
* ```
|
|
210
|
+
*/
|
|
211
|
+
children?: string;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Embeds a raw JSX string verbatim in the generated source code.
|
|
215
|
+
*
|
|
216
|
+
* Use this component when you need to include JSX markup (including fragments
|
|
217
|
+
* `<>…</>`) in the body of a generated function or component. The `children`
|
|
218
|
+
* prop must be a plain string — expression attributes that reference runtime
|
|
219
|
+
* values should be written as template literals.
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```tsx
|
|
223
|
+
* <Function name="MyComponent" export>
|
|
224
|
+
* <Jsx>{'return (\n <>\n <div>Hello</div>\n </>\n)'}</Jsx>
|
|
225
|
+
* </Function>
|
|
226
|
+
* ```
|
|
227
|
+
*/
|
|
228
|
+
declare function Jsx({
|
|
229
|
+
children
|
|
230
|
+
}: Props): KubbReactElement;
|
|
231
|
+
declare namespace Jsx {
|
|
232
|
+
var displayName: string;
|
|
233
|
+
}
|
|
234
|
+
//#endregion
|
|
235
|
+
//#region src/components/Root.d.ts
|
|
236
|
+
type RootProps = {
|
|
237
|
+
/**
|
|
238
|
+
* Exit (unmount) the whole app.
|
|
239
|
+
*/
|
|
240
|
+
onExit: (error?: Error) => void;
|
|
241
|
+
/**
|
|
242
|
+
* Error hook receiving runtime exceptions.
|
|
243
|
+
*/
|
|
244
|
+
onError: (error: Error) => void;
|
|
245
|
+
/**
|
|
246
|
+
* Children nodes.
|
|
247
|
+
*/
|
|
248
|
+
children?: KubbReactNode;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* This component provides the root behavior for the Kubb runtime.
|
|
252
|
+
*/
|
|
253
|
+
declare function Root({
|
|
254
|
+
onError,
|
|
255
|
+
children
|
|
256
|
+
}: RootProps): KubbReactElement;
|
|
257
|
+
declare namespace Root {
|
|
258
|
+
var displayName: string;
|
|
259
|
+
}
|
|
260
|
+
//#endregion
|
|
261
|
+
//#region src/components/Type.d.ts
|
|
262
|
+
type TypeProps = {
|
|
263
|
+
key?: Key;
|
|
264
|
+
/**
|
|
265
|
+
* Name of the type, this needs to start with a capital letter.
|
|
266
|
+
*/
|
|
267
|
+
name: string;
|
|
268
|
+
/**
|
|
269
|
+
* Does this type need to be exported.
|
|
270
|
+
*/
|
|
271
|
+
export?: boolean;
|
|
272
|
+
/**
|
|
273
|
+
* Options for JSdocs.
|
|
274
|
+
*/
|
|
275
|
+
JSDoc?: JSDoc;
|
|
276
|
+
/**
|
|
277
|
+
* Children nodes.
|
|
278
|
+
*/
|
|
279
|
+
children?: KubbReactNode;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* Generates a TypeScript type declaration.
|
|
283
|
+
*/
|
|
284
|
+
declare function Type({
|
|
285
|
+
children,
|
|
286
|
+
...props
|
|
287
|
+
}: TypeProps): KubbReactElement;
|
|
288
|
+
declare namespace Type {
|
|
289
|
+
var displayName: string;
|
|
290
|
+
}
|
|
291
|
+
//#endregion
|
|
292
|
+
//#region src/context/KubbContext.d.ts
|
|
293
|
+
type KubbContextValue = {
|
|
294
|
+
driver: unknown;
|
|
295
|
+
plugin: unknown;
|
|
296
|
+
mode: 'single' | 'split';
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Context key for kubb render-time data (driver, plugin, mode).
|
|
300
|
+
* Use `provide`/`unprovide` from `@internals/utils` around render calls,
|
|
301
|
+
* and `inject` inside generator components.
|
|
302
|
+
* @deprecated
|
|
303
|
+
*/
|
|
304
|
+
declare const KubbContext: Context<KubbContextValue | null>;
|
|
305
|
+
//#endregion
|
|
306
|
+
//#region src/context/OasContext.d.ts
|
|
307
|
+
/**
|
|
308
|
+
* Context key for the OAS (OpenAPI Specification) instance.
|
|
309
|
+
* Use `provide`/`unprovide` from `@internals/utils` around render calls,
|
|
310
|
+
* and `inject` inside generator components.
|
|
311
|
+
* @deprecated
|
|
312
|
+
*/
|
|
313
|
+
declare const OasContext: Context<unknown>;
|
|
314
|
+
//#endregion
|
|
315
|
+
//#region src/createRenderer.d.ts
|
|
316
|
+
type Options = {
|
|
317
|
+
/**
|
|
318
|
+
* Set this to true to always see the result of the render in the console(line per render)
|
|
319
|
+
*/
|
|
320
|
+
debug?: boolean;
|
|
321
|
+
};
|
|
322
|
+
type Renderer = {
|
|
323
|
+
render(Element: KubbReactElement): Promise<void>;
|
|
324
|
+
unmount(error?: Error | number | null): void;
|
|
325
|
+
files: Array<FileNode>;
|
|
326
|
+
};
|
|
327
|
+
declare function createRenderer(options?: Options): Renderer;
|
|
328
|
+
//#endregion
|
|
329
|
+
export { Const, File, Function, Jsx, KubbContext, OasContext, Root, Type, createContext, createRenderer, inject, provide, unprovide };
|
|
330
|
+
//# sourceMappingURL=index.d.ts.map
|