@kubb/renderer-jsx 5.0.0-beta.35 → 5.0.0-beta.37
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/dist/index.cjs +9 -10
- package/dist/index.d.ts +7 -8
- package/dist/index.js +9 -10
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/{jsx-namespace-DjXQlyYY.d.ts → jsx-namespace-dmStM1a2.d.ts} +2 -2
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/{types-eofn5-0O.d.ts → types-B5VGpHs0.d.ts} +3 -3
- package/dist/types.d.ts +1 -1
- package/package.json +3 -3
- package/src/SyncRuntime.tsx +3 -3
- package/src/components/Callout.tsx +1 -1
- package/src/components/File.tsx +1 -1
- package/src/components/Jsx.tsx +1 -1
- package/src/components/Type.tsx +1 -1
- package/src/createRenderer.tsx +3 -3
- package/src/types.ts +2 -2
- package/src/utils.ts +1 -1
package/dist/index.cjs
CHANGED
|
@@ -119,7 +119,7 @@ const CALLOUT_LABEL = {
|
|
|
119
119
|
caution: "CAUTION"
|
|
120
120
|
};
|
|
121
121
|
/**
|
|
122
|
-
* Renders a GitHub-style alert callout
|
|
122
|
+
* Renders a GitHub-style alert callout, portable across GitHub, GitLab,
|
|
123
123
|
* VitePress, Obsidian, and MDX.
|
|
124
124
|
*
|
|
125
125
|
* Emits a `<File.Source>` block containing `> [!TYPE] Title` followed by the
|
|
@@ -437,7 +437,7 @@ Heading.displayName = "Heading";
|
|
|
437
437
|
*
|
|
438
438
|
* Use this component when you need to include JSX markup (including fragments
|
|
439
439
|
* `<>…</>`) in the body of a generated function or component. The `children`
|
|
440
|
-
* prop must be a plain string
|
|
440
|
+
* prop must be a plain string, expression attributes that reference runtime
|
|
441
441
|
* values should be written as template literals.
|
|
442
442
|
*
|
|
443
443
|
* @example
|
|
@@ -535,7 +535,7 @@ Root.displayName = "Root";
|
|
|
535
535
|
/**
|
|
536
536
|
* Generates a TypeScript type alias declaration.
|
|
537
537
|
*
|
|
538
|
-
* Throws if `name` does not start with an uppercase letter
|
|
538
|
+
* Throws if `name` does not start with an uppercase letter. TypeScript type aliases
|
|
539
539
|
* should follow PascalCase naming conventions.
|
|
540
540
|
*
|
|
541
541
|
* @example Simple exported type alias
|
|
@@ -18046,7 +18046,7 @@ require_jsx_runtime.__name(toBool$1, "toBool");
|
|
|
18046
18046
|
/**
|
|
18047
18047
|
* Collect the text and nested AST-node children of a single kubb-* element.
|
|
18048
18048
|
*
|
|
18049
|
-
* `#text` children become raw text nodes
|
|
18049
|
+
* `#text` children become raw text nodes. Nested `kubb-function`, `kubb-const`,
|
|
18050
18050
|
* `kubb-type`, and similar elements are converted into their respective {@link CodeNode}s.
|
|
18051
18051
|
* Any unrecognized element names are silently skipped.
|
|
18052
18052
|
*/
|
|
@@ -18311,7 +18311,7 @@ var Runtime = class {
|
|
|
18311
18311
|
* Walks `element`, resolving arrays, Fragments, and function components
|
|
18312
18312
|
* transparently, then calls `onText` for primitive values and `onHost` for
|
|
18313
18313
|
* every host element encountered. Pure function components are called
|
|
18314
|
-
* synchronously
|
|
18314
|
+
* synchronously. Hooks and class components are not supported.
|
|
18315
18315
|
*/
|
|
18316
18316
|
function walkElement(element, onText, onHost) {
|
|
18317
18317
|
if (element == null || typeof element === "boolean") return;
|
|
@@ -18500,9 +18500,9 @@ function* walkFiles(element) {
|
|
|
18500
18500
|
* producing {@link FileNode} objects directly without an intermediate virtual
|
|
18501
18501
|
* DOM. No React fiber, scheduler, or work loop is involved.
|
|
18502
18502
|
*
|
|
18503
|
-
* All components must be pure functions
|
|
18503
|
+
* All components must be pure functions. Hooks and class components are not
|
|
18504
18504
|
* supported. Produces identical output to the React-backed {@link Runtime} at
|
|
18505
|
-
* approximately 2
|
|
18505
|
+
* approximately 2, 4× the speed and a fraction of the allocations.
|
|
18506
18506
|
*/
|
|
18507
18507
|
var SyncRuntime = class {
|
|
18508
18508
|
/**
|
|
@@ -18584,9 +18584,8 @@ const jsxRenderer = () => {
|
|
|
18584
18584
|
};
|
|
18585
18585
|
};
|
|
18586
18586
|
/**
|
|
18587
|
-
* Lightweight renderer that walks the JSX tree in a single recursive pass
|
|
18588
|
-
*
|
|
18589
|
-
* {@link jsxRenderer} at roughly 2–4× the throughput.
|
|
18587
|
+
* Lightweight renderer that walks the JSX tree in a single recursive pass, * no React reconciler, no scheduler. Drop-in replacement for
|
|
18588
|
+
* {@link jsxRenderer} at roughly 2, 4× the throughput.
|
|
18590
18589
|
*
|
|
18591
18590
|
* Constraints: every component must be a pure function. Hooks, suspense, and
|
|
18592
18591
|
* class components are not supported.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-DoukXa0m.js";
|
|
2
|
-
import { a as JSDoc, h as KubbReactNode, m as KubbReactElement, o as Key } from "./types-
|
|
2
|
+
import { a as JSDoc, h as KubbReactNode, m as KubbReactElement, o as Key } from "./types-B5VGpHs0.js";
|
|
3
3
|
import { ExportNode, FileNode, ImportNode, SourceNode } from "@kubb/ast";
|
|
4
4
|
|
|
5
5
|
//#region ../../internals/utils/src/context.d.ts
|
|
@@ -72,7 +72,7 @@ type Props$8 = {
|
|
|
72
72
|
children: string;
|
|
73
73
|
};
|
|
74
74
|
/**
|
|
75
|
-
* Renders a GitHub-style alert callout
|
|
75
|
+
* Renders a GitHub-style alert callout, portable across GitHub, GitLab,
|
|
76
76
|
* VitePress, Obsidian, and MDX.
|
|
77
77
|
*
|
|
78
78
|
* Emits a `<File.Source>` block containing `> [!TYPE] Title` followed by the
|
|
@@ -226,7 +226,7 @@ type BasePropsWithoutBaseName = {
|
|
|
226
226
|
baseName?: never;
|
|
227
227
|
/**
|
|
228
228
|
* Fully qualified path to the generated file.
|
|
229
|
-
* Optional when `baseName` is omitted
|
|
229
|
+
* Optional when `baseName` is omitted, the component renders its children inline.
|
|
230
230
|
*/
|
|
231
231
|
path?: string | null;
|
|
232
232
|
};
|
|
@@ -572,7 +572,7 @@ type Props$2 = {
|
|
|
572
572
|
*
|
|
573
573
|
* Use this component when you need to include JSX markup (including fragments
|
|
574
574
|
* `<>…</>`) in the body of a generated function or component. The `children`
|
|
575
|
-
* prop must be a plain string
|
|
575
|
+
* prop must be a plain string, expression attributes that reference runtime
|
|
576
576
|
* values should be written as template literals.
|
|
577
577
|
*
|
|
578
578
|
* @example
|
|
@@ -720,7 +720,7 @@ type TypeProps = {
|
|
|
720
720
|
/**
|
|
721
721
|
* Generates a TypeScript type alias declaration.
|
|
722
722
|
*
|
|
723
|
-
* Throws if `name` does not start with an uppercase letter
|
|
723
|
+
* Throws if `name` does not start with an uppercase letter. TypeScript type aliases
|
|
724
724
|
* should follow PascalCase naming conventions.
|
|
725
725
|
*
|
|
726
726
|
* @example Simple exported type alias
|
|
@@ -783,9 +783,8 @@ declare const jsxRenderer: () => {
|
|
|
783
783
|
[Symbol.dispose](): void;
|
|
784
784
|
};
|
|
785
785
|
/**
|
|
786
|
-
* Lightweight renderer that walks the JSX tree in a single recursive pass
|
|
787
|
-
*
|
|
788
|
-
* {@link jsxRenderer} at roughly 2–4× the throughput.
|
|
786
|
+
* Lightweight renderer that walks the JSX tree in a single recursive pass, * no React reconciler, no scheduler. Drop-in replacement for
|
|
787
|
+
* {@link jsxRenderer} at roughly 2, 4× the throughput.
|
|
789
788
|
*
|
|
790
789
|
* Constraints: every component must be a pure function. Hooks, suspense, and
|
|
791
790
|
* class components are not supported.
|
package/dist/index.js
CHANGED
|
@@ -119,7 +119,7 @@ const CALLOUT_LABEL = {
|
|
|
119
119
|
caution: "CAUTION"
|
|
120
120
|
};
|
|
121
121
|
/**
|
|
122
|
-
* Renders a GitHub-style alert callout
|
|
122
|
+
* Renders a GitHub-style alert callout, portable across GitHub, GitLab,
|
|
123
123
|
* VitePress, Obsidian, and MDX.
|
|
124
124
|
*
|
|
125
125
|
* Emits a `<File.Source>` block containing `> [!TYPE] Title` followed by the
|
|
@@ -437,7 +437,7 @@ Heading.displayName = "Heading";
|
|
|
437
437
|
*
|
|
438
438
|
* Use this component when you need to include JSX markup (including fragments
|
|
439
439
|
* `<>…</>`) in the body of a generated function or component. The `children`
|
|
440
|
-
* prop must be a plain string
|
|
440
|
+
* prop must be a plain string, expression attributes that reference runtime
|
|
441
441
|
* values should be written as template literals.
|
|
442
442
|
*
|
|
443
443
|
* @example
|
|
@@ -535,7 +535,7 @@ Root.displayName = "Root";
|
|
|
535
535
|
/**
|
|
536
536
|
* Generates a TypeScript type alias declaration.
|
|
537
537
|
*
|
|
538
|
-
* Throws if `name` does not start with an uppercase letter
|
|
538
|
+
* Throws if `name` does not start with an uppercase letter. TypeScript type aliases
|
|
539
539
|
* should follow PascalCase naming conventions.
|
|
540
540
|
*
|
|
541
541
|
* @example Simple exported type alias
|
|
@@ -18043,7 +18043,7 @@ __name(toBool$1, "toBool");
|
|
|
18043
18043
|
/**
|
|
18044
18044
|
* Collect the text and nested AST-node children of a single kubb-* element.
|
|
18045
18045
|
*
|
|
18046
|
-
* `#text` children become raw text nodes
|
|
18046
|
+
* `#text` children become raw text nodes. Nested `kubb-function`, `kubb-const`,
|
|
18047
18047
|
* `kubb-type`, and similar elements are converted into their respective {@link CodeNode}s.
|
|
18048
18048
|
* Any unrecognized element names are silently skipped.
|
|
18049
18049
|
*/
|
|
@@ -18308,7 +18308,7 @@ var Runtime = class {
|
|
|
18308
18308
|
* Walks `element`, resolving arrays, Fragments, and function components
|
|
18309
18309
|
* transparently, then calls `onText` for primitive values and `onHost` for
|
|
18310
18310
|
* every host element encountered. Pure function components are called
|
|
18311
|
-
* synchronously
|
|
18311
|
+
* synchronously. Hooks and class components are not supported.
|
|
18312
18312
|
*/
|
|
18313
18313
|
function walkElement(element, onText, onHost) {
|
|
18314
18314
|
if (element == null || typeof element === "boolean") return;
|
|
@@ -18497,9 +18497,9 @@ function* walkFiles(element) {
|
|
|
18497
18497
|
* producing {@link FileNode} objects directly without an intermediate virtual
|
|
18498
18498
|
* DOM. No React fiber, scheduler, or work loop is involved.
|
|
18499
18499
|
*
|
|
18500
|
-
* All components must be pure functions
|
|
18500
|
+
* All components must be pure functions. Hooks and class components are not
|
|
18501
18501
|
* supported. Produces identical output to the React-backed {@link Runtime} at
|
|
18502
|
-
* approximately 2
|
|
18502
|
+
* approximately 2, 4× the speed and a fraction of the allocations.
|
|
18503
18503
|
*/
|
|
18504
18504
|
var SyncRuntime = class {
|
|
18505
18505
|
/**
|
|
@@ -18581,9 +18581,8 @@ const jsxRenderer = () => {
|
|
|
18581
18581
|
};
|
|
18582
18582
|
};
|
|
18583
18583
|
/**
|
|
18584
|
-
* Lightweight renderer that walks the JSX tree in a single recursive pass
|
|
18585
|
-
*
|
|
18586
|
-
* {@link jsxRenderer} at roughly 2–4× the throughput.
|
|
18584
|
+
* Lightweight renderer that walks the JSX tree in a single recursive pass, * no React reconciler, no scheduler. Drop-in replacement for
|
|
18585
|
+
* {@link jsxRenderer} at roughly 2, 4× the throughput.
|
|
18587
18586
|
*
|
|
18588
18587
|
* Constraints: every component must be a pure function. Hooks, suspense, and
|
|
18589
18588
|
* class components are not supported.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-DoukXa0m.js";
|
|
2
|
-
import { h as KubbReactNode, m as KubbReactElement } from "./types-
|
|
3
|
-
import { t as JSX } from "./jsx-namespace-
|
|
2
|
+
import { h as KubbReactNode, m as KubbReactElement } from "./types-B5VGpHs0.js";
|
|
3
|
+
import { t as JSX } from "./jsx-namespace-dmStM1a2.js";
|
|
4
4
|
import * as React from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/jsx-dev-runtime.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-DoukXa0m.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-
|
|
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-B5VGpHs0.js";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/jsx-namespace.d.ts
|
|
@@ -36,4 +36,4 @@ declare namespace JSX$1 {
|
|
|
36
36
|
}
|
|
37
37
|
//#endregion
|
|
38
38
|
export { JSX$1 as t };
|
|
39
|
-
//# sourceMappingURL=jsx-namespace-
|
|
39
|
+
//# sourceMappingURL=jsx-namespace-dmStM1a2.d.ts.map
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-DoukXa0m.js";
|
|
2
|
-
import { h as KubbReactNode, m as KubbReactElement } from "./types-
|
|
3
|
-
import { t as JSX } from "./jsx-namespace-
|
|
2
|
+
import { h as KubbReactNode, m as KubbReactElement } from "./types-B5VGpHs0.js";
|
|
3
|
+
import { t as JSX } from "./jsx-namespace-dmStM1a2.js";
|
|
4
4
|
import * as React from "react/jsx-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/jsx-runtime.d.ts
|
|
@@ -18,7 +18,7 @@ type Node = {
|
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
20
|
* Allowed attribute value types for DOM elements.
|
|
21
|
-
* `null` signals intentionally empty
|
|
21
|
+
* `null` signals intentionally empty, the prop was explicitly cleared.
|
|
22
22
|
*/
|
|
23
23
|
type DOMNodeAttribute = boolean | string | number | null | Record<string, unknown> | Array<unknown>;
|
|
24
24
|
type TextName = '#text';
|
|
@@ -30,7 +30,7 @@ type TextNode = {
|
|
|
30
30
|
nodeValue: string;
|
|
31
31
|
} & Node;
|
|
32
32
|
/**
|
|
33
|
-
* Virtual DOM node
|
|
33
|
+
* Virtual DOM node, either a text node or a named element.
|
|
34
34
|
*/
|
|
35
35
|
type DOMNode<T = {
|
|
36
36
|
nodeName: NodeNames;
|
|
@@ -166,4 +166,4 @@ type JSDoc = {
|
|
|
166
166
|
};
|
|
167
167
|
//#endregion
|
|
168
168
|
export { KubbTextProps as _, JSDoc as a, TextNode as b, KubbConstProps as c, KubbFunctionProps as d, KubbImportProps as f, KubbSourceProps as g, KubbReactNode as h, ElementNames as i, KubbExportProps as l, KubbReactElement as m, DOMNode as n, Key as o, KubbJsxProps as p, DOMNodeAttribute as r, KubbArrowFunctionProps as s, DOMElement as t, KubbFileProps as u, KubbTypeProps as v, LineBreakProps as y };
|
|
169
|
-
//# sourceMappingURL=types-
|
|
169
|
+
//# sourceMappingURL=types-B5VGpHs0.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as KubbTextProps, a as JSDoc, b as TextNode, c as KubbConstProps, d as KubbFunctionProps, f as KubbImportProps, g as KubbSourceProps, h as KubbReactNode, i as ElementNames, l as KubbExportProps, m as KubbReactElement, n as DOMNode, o as Key, p as KubbJsxProps, r as DOMNodeAttribute, s as KubbArrowFunctionProps, t as DOMElement, u as KubbFileProps, v as KubbTypeProps, y as LineBreakProps } from "./types-
|
|
1
|
+
import { _ as KubbTextProps, a as JSDoc, b as TextNode, c as KubbConstProps, d as KubbFunctionProps, f as KubbImportProps, g as KubbSourceProps, h as KubbReactNode, i as ElementNames, l as KubbExportProps, m as KubbReactElement, n as DOMNode, o as Key, p as KubbJsxProps, r as DOMNodeAttribute, s as KubbArrowFunctionProps, t as DOMElement, u as KubbFileProps, v as KubbTypeProps, y as LineBreakProps } from "./types-B5VGpHs0.js";
|
|
2
2
|
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, JSDoc, Key, KubbArrowFunctionProps, KubbConstProps, KubbExportProps, KubbFileProps, KubbFunctionProps, KubbImportProps, KubbJsxProps, KubbReactElement, KubbReactNode, KubbSourceProps, KubbTextProps, KubbTypeProps, LineBreakProps, TextNode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/renderer-jsx",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.37",
|
|
4
4
|
"description": "JSX-based renderer for Kubb. Provides a custom React runtime, reconciler, and built-in components (File, Function, Type, Const) for component-based, type-safe code generation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codegen",
|
|
@@ -76,10 +76,10 @@
|
|
|
76
76
|
},
|
|
77
77
|
"dependencies": {
|
|
78
78
|
"yaml": "^2.9.0",
|
|
79
|
-
"@kubb/ast": "5.0.0-beta.
|
|
79
|
+
"@kubb/ast": "5.0.0-beta.37"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
|
-
"@types/react": "^19.2.
|
|
82
|
+
"@types/react": "^19.2.16",
|
|
83
83
|
"@types/react-reconciler": "0.33.0",
|
|
84
84
|
"react": "19.2.6",
|
|
85
85
|
"react-reconciler": "0.33.0",
|
package/src/SyncRuntime.tsx
CHANGED
|
@@ -22,7 +22,7 @@ type OnHost = (type: string, props: Record<string, unknown>) => void
|
|
|
22
22
|
* Walks `element`, resolving arrays, Fragments, and function components
|
|
23
23
|
* transparently, then calls `onText` for primitive values and `onHost` for
|
|
24
24
|
* every host element encountered. Pure function components are called
|
|
25
|
-
* synchronously
|
|
25
|
+
* synchronously. Hooks and class components are not supported.
|
|
26
26
|
*/
|
|
27
27
|
function walkElement(element: unknown, onText: OnText, onHost: OnHost): void {
|
|
28
28
|
if (element == null || typeof element === 'boolean') return
|
|
@@ -270,9 +270,9 @@ function* walkFiles(element: unknown): Generator<FileNode> {
|
|
|
270
270
|
* producing {@link FileNode} objects directly without an intermediate virtual
|
|
271
271
|
* DOM. No React fiber, scheduler, or work loop is involved.
|
|
272
272
|
*
|
|
273
|
-
* All components must be pure functions
|
|
273
|
+
* All components must be pure functions. Hooks and class components are not
|
|
274
274
|
* supported. Produces identical output to the React-backed {@link Runtime} at
|
|
275
|
-
* approximately 2
|
|
275
|
+
* approximately 2, 4× the speed and a fraction of the allocations.
|
|
276
276
|
*/
|
|
277
277
|
export class SyncRuntime {
|
|
278
278
|
/**
|
|
@@ -28,7 +28,7 @@ type Props = {
|
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
|
-
* Renders a GitHub-style alert callout
|
|
31
|
+
* Renders a GitHub-style alert callout, portable across GitHub, GitLab,
|
|
32
32
|
* VitePress, Obsidian, and MDX.
|
|
33
33
|
*
|
|
34
34
|
* Emits a `<File.Source>` block containing `> [!TYPE] Title` followed by the
|
package/src/components/File.tsx
CHANGED
|
@@ -25,7 +25,7 @@ type BasePropsWithoutBaseName = {
|
|
|
25
25
|
baseName?: never
|
|
26
26
|
/**
|
|
27
27
|
* Fully qualified path to the generated file.
|
|
28
|
-
* Optional when `baseName` is omitted
|
|
28
|
+
* Optional when `baseName` is omitted, the component renders its children inline.
|
|
29
29
|
*/
|
|
30
30
|
path?: string | null
|
|
31
31
|
}
|
package/src/components/Jsx.tsx
CHANGED
|
@@ -17,7 +17,7 @@ type Props = {
|
|
|
17
17
|
*
|
|
18
18
|
* Use this component when you need to include JSX markup (including fragments
|
|
19
19
|
* `<>…</>`) in the body of a generated function or component. The `children`
|
|
20
|
-
* prop must be a plain string
|
|
20
|
+
* prop must be a plain string, expression attributes that reference runtime
|
|
21
21
|
* values should be written as template literals.
|
|
22
22
|
*
|
|
23
23
|
* @example
|
package/src/components/Type.tsx
CHANGED
|
@@ -31,7 +31,7 @@ type TypeProps = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Generates a TypeScript type alias declaration.
|
|
33
33
|
*
|
|
34
|
-
* Throws if `name` does not start with an uppercase letter
|
|
34
|
+
* Throws if `name` does not start with an uppercase letter. TypeScript type aliases
|
|
35
35
|
* should follow PascalCase naming conventions.
|
|
36
36
|
*
|
|
37
37
|
* @example Simple exported type alias
|
package/src/createRenderer.tsx
CHANGED
|
@@ -33,6 +33,7 @@ import type { KubbReactElement } from './types.ts'
|
|
|
33
33
|
*/
|
|
34
34
|
export const jsxRenderer = () => {
|
|
35
35
|
const runtime = new Runtime()
|
|
36
|
+
|
|
36
37
|
return {
|
|
37
38
|
async render(element: KubbReactElement) {
|
|
38
39
|
await runtime.render(element)
|
|
@@ -53,9 +54,8 @@ export const jsxRenderer = () => {
|
|
|
53
54
|
}
|
|
54
55
|
|
|
55
56
|
/**
|
|
56
|
-
* Lightweight renderer that walks the JSX tree in a single recursive pass
|
|
57
|
-
*
|
|
58
|
-
* {@link jsxRenderer} at roughly 2–4× the throughput.
|
|
57
|
+
* Lightweight renderer that walks the JSX tree in a single recursive pass, * no React reconciler, no scheduler. Drop-in replacement for
|
|
58
|
+
* {@link jsxRenderer} at roughly 2, 4× the throughput.
|
|
59
59
|
*
|
|
60
60
|
* Constraints: every component must be a pure function. Hooks, suspense, and
|
|
61
61
|
* class components are not supported.
|
package/src/types.ts
CHANGED
|
@@ -36,7 +36,7 @@ type Node = {
|
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Allowed attribute value types for DOM elements.
|
|
39
|
-
* `null` signals intentionally empty
|
|
39
|
+
* `null` signals intentionally empty, the prop was explicitly cleared.
|
|
40
40
|
*/
|
|
41
41
|
export type DOMNodeAttribute = boolean | string | number | null | Record<string, unknown> | Array<unknown>
|
|
42
42
|
|
|
@@ -51,7 +51,7 @@ export type TextNode = {
|
|
|
51
51
|
} & Node
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
|
-
* Virtual DOM node
|
|
54
|
+
* Virtual DOM node, either a text node or a named element.
|
|
55
55
|
*/
|
|
56
56
|
export type DOMNode<T = { nodeName: NodeNames }> = T extends {
|
|
57
57
|
nodeName: infer U
|
package/src/utils.ts
CHANGED
|
@@ -33,7 +33,7 @@ function toBool(val: unknown): boolean {
|
|
|
33
33
|
/**
|
|
34
34
|
* Collect the text and nested AST-node children of a single kubb-* element.
|
|
35
35
|
*
|
|
36
|
-
* `#text` children become raw text nodes
|
|
36
|
+
* `#text` children become raw text nodes. Nested `kubb-function`, `kubb-const`,
|
|
37
37
|
* `kubb-type`, and similar elements are converted into their respective {@link CodeNode}s.
|
|
38
38
|
* Any unrecognized element names are silently skipped.
|
|
39
39
|
*/
|