@kubb/renderer-jsx 5.0.0-beta.6 → 5.0.0-beta.61
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 +134 -0
- package/dist/chunk-C0LytTxp.js +8 -0
- package/dist/index.cjs +386 -17922
- package/dist/index.d.ts +232 -147
- package/dist/index.js +370 -17903
- 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-3ncySO6L.cjs +89 -0
- package/dist/jsx-runtime.cjs +5 -14
- package/dist/jsx-runtime.d.ts +60 -10
- package/dist/jsx-runtime.js +24 -7
- package/dist/types-UI1cZVah.d.ts +115 -0
- package/dist/types.d.ts +2 -2
- package/package.json +6 -29
- package/src/SyncRuntime.tsx +298 -0
- package/src/components/Callout.tsx +59 -0
- package/src/components/Const.tsx +4 -4
- package/src/components/File.tsx +7 -5
- package/src/components/Frontmatter.tsx +38 -0
- package/src/components/Function.tsx +8 -8
- package/src/components/Heading.tsx +34 -0
- package/src/components/Jsx.tsx +1 -1
- package/src/components/List.tsx +40 -0
- package/src/components/Paragraph.tsx +28 -0
- package/src/components/Type.tsx +3 -3
- package/src/constants.ts +9 -28
- package/src/createRenderer.tsx +38 -75
- package/src/globals.ts +14 -6
- package/src/index.ts +6 -3
- package/src/jsx-dev-runtime.ts +1 -3
- package/src/jsx-namespace.d.ts +21 -13
- package/src/jsx-runtime.ts +22 -6
- package/src/types.ts +16 -100
- 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 -184
- package/src/Runtime.tsx +0 -170
- package/src/components/Root.tsx +0 -70
- package/src/dom.ts +0 -105
- package/src/utils.ts +0 -267
package/src/constants.ts
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* Used to distinguish Kubb-owned elements from unrecognized or text nodes during tree traversal.
|
|
11
|
-
*/
|
|
12
|
-
export const nodeNames = new Set<ElementNames>([
|
|
13
|
-
'kubb-export',
|
|
14
|
-
'kubb-file',
|
|
15
|
-
'kubb-source',
|
|
16
|
-
'kubb-import',
|
|
17
|
-
'kubb-function',
|
|
18
|
-
'kubb-arrow-function',
|
|
19
|
-
'kubb-const',
|
|
20
|
-
'kubb-type',
|
|
21
|
-
'kubb-jsx',
|
|
22
|
-
'kubb-text',
|
|
23
|
-
'kubb-root',
|
|
24
|
-
'kubb-app',
|
|
25
|
-
'br',
|
|
26
|
-
'indent',
|
|
27
|
-
'dedent',
|
|
28
|
-
] as const)
|
|
1
|
+
export const KUBB_FILE = 'kubb-file' as const
|
|
2
|
+
export const KUBB_SOURCE = 'kubb-source' as const
|
|
3
|
+
export const KUBB_EXPORT = 'kubb-export' as const
|
|
4
|
+
export const KUBB_IMPORT = 'kubb-import' as const
|
|
5
|
+
export const KUBB_FUNCTION = 'kubb-function' as const
|
|
6
|
+
export const KUBB_ARROW_FUNCTION = 'kubb-arrow-function' as const
|
|
7
|
+
export const KUBB_CONST = 'kubb-const' as const
|
|
8
|
+
export const KUBB_TYPE = 'kubb-type' as const
|
|
9
|
+
export const KUBB_JSX = 'kubb-jsx' as const
|
package/src/createRenderer.tsx
CHANGED
|
@@ -1,93 +1,56 @@
|
|
|
1
1
|
import type { FileNode } from '@kubb/ast'
|
|
2
|
-
import {
|
|
2
|
+
import { SyncRuntime } from './SyncRuntime.tsx'
|
|
3
3
|
import type { KubbReactElement } from './types.ts'
|
|
4
4
|
|
|
5
|
-
type Options = {
|
|
6
|
-
/**
|
|
7
|
-
* Print each render result to the console for debugging.
|
|
8
|
-
* Useful when diagnosing output differences between renders.
|
|
9
|
-
* @default false
|
|
10
|
-
*/
|
|
11
|
-
debug?: boolean
|
|
12
|
-
}
|
|
13
|
-
|
|
14
5
|
/**
|
|
15
|
-
*
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Tear down the renderer and release all React resources.
|
|
25
|
-
* Pass an `Error` to signal an abnormal shutdown.
|
|
26
|
-
*/
|
|
27
|
-
unmount(error?: Error | number | null): void
|
|
28
|
-
/**
|
|
29
|
-
* The {@link FileNode} entries collected from the most recent `render` call.
|
|
30
|
-
*/
|
|
31
|
-
files: Array<FileNode>
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Create a Kubb JSX renderer.
|
|
6
|
+
* Renderer that walks the JSX tree in a single recursive pass, with no React
|
|
7
|
+
* reconciler or scheduler. Pass as the `renderer` property on
|
|
8
|
+
* `defineGenerator`. Kubb core stays generic, with no hard dependency on
|
|
9
|
+
* `@kubb/renderer-jsx`.
|
|
10
|
+
*
|
|
11
|
+
* Every component must be a pure function. Hooks, suspense, and class
|
|
12
|
+
* components are not supported. It also exposes `stream()` for incremental
|
|
13
|
+
* file emission.
|
|
36
14
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
15
|
+
* @example Wire up a JSX generator
|
|
16
|
+
* ```tsx
|
|
17
|
+
* import { defineGenerator } from '@kubb/core'
|
|
18
|
+
* import { jsxRenderer } from '@kubb/renderer-jsx'
|
|
39
19
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
20
|
+
* export const myGenerator = defineGenerator<PluginTs>({
|
|
21
|
+
* name: 'types',
|
|
22
|
+
* renderer: jsxRenderer,
|
|
23
|
+
* schema(node, ctx) {
|
|
24
|
+
* return (
|
|
25
|
+
* <File baseName="output.ts" path={`${ctx.root}/output.ts`}>
|
|
26
|
+
* <Type node={node} resolver={ctx.resolver} />
|
|
27
|
+
* </File>
|
|
28
|
+
* )
|
|
29
|
+
* },
|
|
30
|
+
* })
|
|
31
|
+
* ```
|
|
43
32
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* </File>
|
|
51
|
-
* )
|
|
52
|
-
* console.log(renderer.files) // [FileNode]
|
|
53
|
-
* renderer.unmount()
|
|
33
|
+
* @example Stream files as they are produced
|
|
34
|
+
* ```tsx
|
|
35
|
+
* const renderer = jsxRenderer()
|
|
36
|
+
* for (const file of renderer.stream(element)) {
|
|
37
|
+
* await writeFile(file.path, file.sources[0])
|
|
38
|
+
* }
|
|
54
39
|
* ```
|
|
55
40
|
*/
|
|
56
|
-
export
|
|
57
|
-
const runtime = new
|
|
41
|
+
export const jsxRenderer = () => {
|
|
42
|
+
const runtime = new SyncRuntime()
|
|
58
43
|
|
|
59
44
|
return {
|
|
60
|
-
async render(
|
|
61
|
-
|
|
45
|
+
async render(element: KubbReactElement): Promise<void> {
|
|
46
|
+
runtime.render(element)
|
|
62
47
|
},
|
|
63
48
|
get files() {
|
|
64
49
|
return runtime.nodes
|
|
65
50
|
},
|
|
66
|
-
|
|
67
|
-
runtime.
|
|
51
|
+
stream(element: KubbReactElement): Generator<FileNode> {
|
|
52
|
+
return runtime.stream(element)
|
|
68
53
|
},
|
|
54
|
+
[Symbol.dispose]() {},
|
|
69
55
|
}
|
|
70
56
|
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* A renderer factory for generators that produce JSX output.
|
|
74
|
-
*
|
|
75
|
-
* Pass this as the `renderer` property of a `defineGenerator` call so that
|
|
76
|
-
* core can render the JSX element tree returned by your generator methods
|
|
77
|
-
* without a hard dependency on `@kubb/renderer-jsx`.
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```ts
|
|
81
|
-
* import { jsxRenderer } from '@kubb/renderer-jsx'
|
|
82
|
-
* import { defineGenerator } from '@kubb/core'
|
|
83
|
-
*
|
|
84
|
-
* export const myGenerator = defineGenerator<PluginTs>({
|
|
85
|
-
* name: 'my-generator',
|
|
86
|
-
* renderer: jsxRenderer,
|
|
87
|
-
* schema(node, options) {
|
|
88
|
-
* return <File baseName="output.ts" path="src/output.ts">...</File>
|
|
89
|
-
* },
|
|
90
|
-
* })
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
export const jsxRenderer: () => Renderer = () => createRenderer()
|
package/src/globals.ts
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
import type React from 'react'
|
|
2
1
|
import type {
|
|
2
|
+
KubbArrowFunctionProps,
|
|
3
|
+
KubbConstProps,
|
|
3
4
|
KubbExportProps,
|
|
4
5
|
KubbFileProps,
|
|
6
|
+
KubbFunctionProps,
|
|
5
7
|
KubbImportProps,
|
|
6
8
|
KubbJsxProps,
|
|
7
9
|
KubbReactElement,
|
|
8
10
|
KubbReactNode,
|
|
9
11
|
KubbSourceProps,
|
|
10
|
-
|
|
12
|
+
KubbTypeProps,
|
|
13
|
+
Key,
|
|
11
14
|
LineBreakProps,
|
|
12
15
|
} from './types.ts'
|
|
13
16
|
|
|
@@ -15,20 +18,25 @@ declare global {
|
|
|
15
18
|
namespace JSX {
|
|
16
19
|
type Element = KubbReactElement
|
|
17
20
|
|
|
18
|
-
interface ElementClass
|
|
21
|
+
interface ElementClass {
|
|
19
22
|
render(): KubbReactNode
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
interface IntrinsicAttributes {
|
|
26
|
+
key?: Key | null
|
|
27
|
+
}
|
|
28
|
+
|
|
22
29
|
interface IntrinsicElements {
|
|
23
30
|
'kubb-jsx': KubbJsxProps
|
|
24
|
-
'kubb-text': KubbTextProps
|
|
25
31
|
'kubb-file': KubbFileProps
|
|
26
32
|
'kubb-source': KubbSourceProps
|
|
27
33
|
'kubb-import': KubbImportProps
|
|
28
34
|
'kubb-export': KubbExportProps
|
|
35
|
+
'kubb-function': KubbFunctionProps
|
|
36
|
+
'kubb-arrow-function': KubbArrowFunctionProps
|
|
37
|
+
'kubb-const': KubbConstProps
|
|
38
|
+
'kubb-type': KubbTypeProps
|
|
29
39
|
br: LineBreakProps
|
|
30
|
-
indent: {}
|
|
31
|
-
dedent: {}
|
|
32
40
|
}
|
|
33
41
|
}
|
|
34
42
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Callout } from './components/Callout.tsx'
|
|
2
2
|
export { Const } from './components/Const.tsx'
|
|
3
3
|
export { File } from './components/File.tsx'
|
|
4
|
+
export { Frontmatter } from './components/Frontmatter.tsx'
|
|
4
5
|
export { Function } from './components/Function.tsx'
|
|
6
|
+
export { Heading } from './components/Heading.tsx'
|
|
5
7
|
export { Jsx } from './components/Jsx.tsx'
|
|
6
|
-
export {
|
|
8
|
+
export { List } from './components/List.tsx'
|
|
9
|
+
export { Paragraph } from './components/Paragraph.tsx'
|
|
7
10
|
export { Type } from './components/Type.tsx'
|
|
8
|
-
export {
|
|
11
|
+
export { jsxRenderer } from './createRenderer.tsx'
|
package/src/jsx-dev-runtime.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import * as React from 'react/jsx-runtime'
|
|
2
1
|
import type { KubbReactElement, KubbReactNode } from './types.ts'
|
|
3
2
|
|
|
4
|
-
export
|
|
5
|
-
export const jsxDEV = React.jsx
|
|
3
|
+
export { Fragment, jsxDEV } from './jsx-runtime.ts'
|
|
6
4
|
|
|
7
5
|
export type * from './jsx-namespace.d.ts'
|
|
8
6
|
|
package/src/jsx-namespace.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type React from 'react'
|
|
2
|
-
|
|
3
1
|
import type {
|
|
4
2
|
KubbArrowFunctionProps,
|
|
5
3
|
KubbConstProps,
|
|
@@ -11,29 +9,42 @@ import type {
|
|
|
11
9
|
KubbReactElement,
|
|
12
10
|
KubbReactNode,
|
|
13
11
|
KubbSourceProps,
|
|
14
|
-
KubbTextProps,
|
|
15
12
|
KubbTypeProps,
|
|
13
|
+
Key,
|
|
16
14
|
LineBreakProps,
|
|
17
15
|
} from './types'
|
|
18
16
|
|
|
17
|
+
/**
|
|
18
|
+
* JSX contract for `@kubb/renderer-jsx`, resolved through `jsxImportSource`.
|
|
19
|
+
*
|
|
20
|
+
* It is self-contained and does not extend `React.JSX`. The renderer only emits
|
|
21
|
+
* the custom `kubb-*` hosts plus `br`, `indent`, and `dedent`, and supports
|
|
22
|
+
* pure function components, so the HTML element and class-component machinery
|
|
23
|
+
* from `@types/react` is not needed.
|
|
24
|
+
*/
|
|
19
25
|
export namespace JSX {
|
|
20
|
-
type ElementType =
|
|
26
|
+
type ElementType = string | ((props: any) => KubbReactNode)
|
|
21
27
|
type Element = KubbReactElement
|
|
22
28
|
|
|
23
|
-
interface ElementClass
|
|
29
|
+
interface ElementClass {
|
|
24
30
|
render(): KubbReactNode
|
|
25
31
|
}
|
|
26
32
|
interface ElementAttributesProperty {
|
|
27
33
|
props: {}
|
|
28
34
|
}
|
|
29
|
-
|
|
30
35
|
interface ElementChildrenAttribute {
|
|
31
36
|
children: {}
|
|
32
37
|
}
|
|
33
38
|
|
|
34
|
-
interface
|
|
39
|
+
interface IntrinsicAttributes {
|
|
40
|
+
key?: Key | null
|
|
41
|
+
}
|
|
42
|
+
interface IntrinsicClassAttributes<T> {
|
|
43
|
+
key?: Key | null
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
interface IntrinsicElements {
|
|
35
47
|
'kubb-jsx': KubbJsxProps
|
|
36
|
-
'kubb-text': KubbTextProps
|
|
37
48
|
'kubb-file': KubbFileProps
|
|
38
49
|
'kubb-source': KubbSourceProps
|
|
39
50
|
'kubb-import': KubbImportProps
|
|
@@ -43,10 +54,7 @@ export namespace JSX {
|
|
|
43
54
|
'kubb-const': KubbConstProps
|
|
44
55
|
'kubb-type': KubbTypeProps
|
|
45
56
|
br: LineBreakProps
|
|
46
|
-
indent: {}
|
|
47
|
-
dedent: {}
|
|
48
57
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
|
|
58
|
+
|
|
59
|
+
type LibraryManagedAttributes<C, P> = P
|
|
52
60
|
}
|
package/src/jsx-runtime.ts
CHANGED
|
@@ -1,10 +1,26 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { KubbReactElement, KubbReactNode } from './types.ts'
|
|
1
|
+
import type { Key, KubbReactElement, KubbReactNode } from './types.ts'
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const KUBB_ELEMENT = Symbol.for('kubb.element')
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Fragment marker. A `<>…</>` compiles to `jsx(Fragment, …)`, and the renderer
|
|
7
|
+
* unwraps it while walking the tree.
|
|
8
|
+
*/
|
|
9
|
+
export const Fragment = Symbol.for('kubb.fragment')
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Create a Kubb JSX element. The automatic JSX runtime calls this for every tag,
|
|
13
|
+
* so the renderer never depends on React at runtime. The `type` is a host
|
|
14
|
+
* string, a function component, or `Fragment`, and children are folded into
|
|
15
|
+
* `props`.
|
|
16
|
+
*/
|
|
17
|
+
function createElement(type: unknown, props: Record<string, unknown> | null, key?: Key | null): KubbReactElement {
|
|
18
|
+
return { $$typeof: KUBB_ELEMENT, type, key: key ?? null, props: props ?? {} } as unknown as KubbReactElement
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const jsx = createElement
|
|
22
|
+
export const jsxs = createElement
|
|
23
|
+
export const jsxDEV = createElement
|
|
8
24
|
|
|
9
25
|
export type * from './jsx-namespace.d.ts'
|
|
10
26
|
|
package/src/types.ts
CHANGED
|
@@ -1,102 +1,25 @@
|
|
|
1
1
|
import type { ArrowFunctionNode, ConstNode, ExportNode, FileNode, FunctionNode, ImportNode, SourceNode, TypeNode } from '@kubb/ast'
|
|
2
|
-
import type React from 'react'
|
|
3
|
-
import type { JSX, ReactNode } from 'react'
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
|
-
* Unique
|
|
4
|
+
* Unique key for a Kubb JSX element in lists or conditional renders.
|
|
7
5
|
*/
|
|
8
6
|
export type Key = string | number | bigint
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* Element produced by a Kubb JSX component. The renderer walks these at runtime,
|
|
10
|
+
* so the fields stay opaque to type-checking.
|
|
13
11
|
*/
|
|
14
|
-
export type
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
|
18
|
-
| 'dedent'
|
|
19
|
-
| 'kubb-jsx'
|
|
20
|
-
| 'kubb-text'
|
|
21
|
-
| 'kubb-file'
|
|
22
|
-
| 'kubb-source'
|
|
23
|
-
| 'kubb-import'
|
|
24
|
-
| 'kubb-export'
|
|
25
|
-
| 'kubb-function'
|
|
26
|
-
| 'kubb-arrow-function'
|
|
27
|
-
| 'kubb-const'
|
|
28
|
-
| 'kubb-type'
|
|
29
|
-
| 'kubb-root'
|
|
30
|
-
| 'kubb-app'
|
|
31
|
-
|
|
32
|
-
type Node = {
|
|
33
|
-
parentNode: DOMElement | undefined
|
|
34
|
-
internal_static?: boolean
|
|
12
|
+
export type KubbReactElement = {
|
|
13
|
+
type: unknown
|
|
14
|
+
props: unknown
|
|
15
|
+
key: Key | null
|
|
35
16
|
}
|
|
36
17
|
|
|
37
18
|
/**
|
|
38
|
-
*
|
|
39
|
-
|
|
40
|
-
export type DOMNodeAttribute = boolean | string | number | Record<string, unknown> | Array<unknown>
|
|
41
|
-
|
|
42
|
-
type TextName = '#text'
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Leaf DOM node containing raw text.
|
|
46
|
-
*/
|
|
47
|
-
export type TextNode = {
|
|
48
|
-
nodeName: TextName
|
|
49
|
-
nodeValue: string
|
|
50
|
-
} & Node
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Virtual DOM node — either a text node or a named element.
|
|
54
|
-
*/
|
|
55
|
-
export type DOMNode<T = { nodeName: NodeNames }> = T extends {
|
|
56
|
-
nodeName: infer U
|
|
57
|
-
}
|
|
58
|
-
? U extends '#text'
|
|
59
|
-
? TextNode
|
|
60
|
-
: DOMElement
|
|
61
|
-
: never
|
|
62
|
-
|
|
63
|
-
type OutputTransformer = (s: string, index: number) => string
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Named element in the Kubb virtual DOM tree.
|
|
67
|
-
* Stores attributes, child nodes, and lifecycle callbacks for rendering.
|
|
68
|
-
*/
|
|
69
|
-
export type DOMElement = {
|
|
70
|
-
nodeName: ElementNames
|
|
71
|
-
/**
|
|
72
|
-
* Key/value attributes passed as JSX props to this element.
|
|
73
|
-
*/
|
|
74
|
-
attributes: Map<string, DOMNodeAttribute>
|
|
75
|
-
/**
|
|
76
|
-
* Ordered list of child nodes attached to this element.
|
|
77
|
-
*/
|
|
78
|
-
childNodes: DOMNode[]
|
|
79
|
-
internal_transform?: OutputTransformer
|
|
80
|
-
|
|
81
|
-
// Internal properties
|
|
82
|
-
isStaticDirty?: boolean
|
|
83
|
-
staticNode?: DOMElement
|
|
84
|
-
onComputeLayout?: () => void
|
|
85
|
-
onRender?: () => void
|
|
86
|
-
onImmediateRender?: () => void
|
|
87
|
-
} & Node
|
|
88
|
-
|
|
89
|
-
type NodeNames = ElementNames | TextName
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* React node type for Kubb JSX components.
|
|
19
|
+
* Anything a Kubb JSX component accepts as children: an element, a primitive
|
|
20
|
+
* rendered as text, a nullish value that is skipped, or an iterable of nodes.
|
|
93
21
|
*/
|
|
94
|
-
export type KubbReactNode =
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* React element type returned by Kubb JSX components.
|
|
98
|
-
*/
|
|
99
|
-
export type KubbReactElement = JSX.Element
|
|
22
|
+
export type KubbReactNode = KubbReactElement | string | number | bigint | boolean | null | undefined | Iterable<KubbReactNode>
|
|
100
23
|
|
|
101
24
|
/**
|
|
102
25
|
* Props for the `<kubb-jsx>` element.
|
|
@@ -106,25 +29,17 @@ export type KubbJsxProps = {
|
|
|
106
29
|
children?: string
|
|
107
30
|
}
|
|
108
31
|
|
|
109
|
-
/**
|
|
110
|
-
* Props for the `<kubb-text>` element.
|
|
111
|
-
* Wraps React children as plain text in the output.
|
|
112
|
-
*/
|
|
113
|
-
export type KubbTextProps = {
|
|
114
|
-
children?: KubbReactNode
|
|
115
|
-
}
|
|
116
|
-
|
|
117
32
|
/**
|
|
118
33
|
* Props for the `<kubb-file>` element.
|
|
119
34
|
* Represents a generated file.
|
|
120
35
|
*/
|
|
121
36
|
export type KubbFileProps = {
|
|
122
|
-
id?: string
|
|
37
|
+
id?: string | null
|
|
123
38
|
children?: KubbReactNode
|
|
124
39
|
baseName: string
|
|
125
40
|
path: string
|
|
126
|
-
override?: boolean
|
|
127
|
-
meta?: FileNode['meta']
|
|
41
|
+
override?: boolean | null
|
|
42
|
+
meta?: FileNode['meta'] | null
|
|
128
43
|
}
|
|
129
44
|
|
|
130
45
|
/**
|
|
@@ -180,9 +95,10 @@ export type KubbTypeProps = Omit<TypeNode, 'kind'> & {
|
|
|
180
95
|
}
|
|
181
96
|
|
|
182
97
|
/**
|
|
183
|
-
* Props for the
|
|
98
|
+
* Props for the `<br>` element. It emits a single line break and takes no
|
|
99
|
+
* attributes of its own.
|
|
184
100
|
*/
|
|
185
|
-
export type LineBreakProps =
|
|
101
|
+
export type LineBreakProps = {}
|
|
186
102
|
|
|
187
103
|
/**
|
|
188
104
|
* JSDoc comment block to attach to a generated declaration.
|
package/dist/chunk-Bb7HlUDG.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
-
value,
|
|
6
|
-
configurable: true
|
|
7
|
-
});
|
|
8
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
-
key = keys[i];
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
17
|
-
get: ((k) => from[k]).bind(null, key),
|
|
18
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
-
value: mod,
|
|
25
|
-
enumerable: true
|
|
26
|
-
}) : target, mod));
|
|
27
|
-
//#endregion
|
|
28
|
-
export { __name as n, __toESM as r, __commonJSMin as t };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { n as __name } from "./chunk-Bb7HlUDG.js";
|
|
2
|
-
import { _ as KubbTextProps, c as KubbConstProps, d as KubbFunctionProps, f as KubbImportProps, g as KubbSourceProps, h as KubbReactNode, l as KubbExportProps, m as KubbReactElement, p as KubbJsxProps, s as KubbArrowFunctionProps, u as KubbFileProps, v as KubbTypeProps, y as LineBreakProps } from "./types-nAFMiWFw.js";
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
//#region src/jsx-namespace.d.ts
|
|
6
|
-
declare namespace JSX$1 {
|
|
7
|
-
type ElementType = React.JSX.ElementType;
|
|
8
|
-
type Element = KubbReactElement;
|
|
9
|
-
interface ElementClass extends React.JSX.ElementClass {
|
|
10
|
-
render(): KubbReactNode;
|
|
11
|
-
}
|
|
12
|
-
interface ElementAttributesProperty {
|
|
13
|
-
props: {};
|
|
14
|
-
}
|
|
15
|
-
interface ElementChildrenAttribute {
|
|
16
|
-
children: {};
|
|
17
|
-
}
|
|
18
|
-
interface IntrinsicElements extends React.JSX.IntrinsicElements {
|
|
19
|
-
'kubb-jsx': KubbJsxProps;
|
|
20
|
-
'kubb-text': KubbTextProps;
|
|
21
|
-
'kubb-file': KubbFileProps;
|
|
22
|
-
'kubb-source': KubbSourceProps;
|
|
23
|
-
'kubb-import': KubbImportProps;
|
|
24
|
-
'kubb-export': KubbExportProps;
|
|
25
|
-
'kubb-function': KubbFunctionProps;
|
|
26
|
-
'kubb-arrow-function': KubbArrowFunctionProps;
|
|
27
|
-
'kubb-const': KubbConstProps;
|
|
28
|
-
'kubb-type': KubbTypeProps;
|
|
29
|
-
br: LineBreakProps;
|
|
30
|
-
indent: {};
|
|
31
|
-
dedent: {};
|
|
32
|
-
}
|
|
33
|
-
type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>;
|
|
34
|
-
interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
|
|
35
|
-
interface IntrinsicElements extends React.JSX.IntrinsicElements {}
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
|
-
export { JSX$1 as t };
|
|
39
|
-
//# sourceMappingURL=jsx-namespace-CNp0arTN.d.ts.map
|