@kubb/react-fabric 0.12.4 → 0.12.6
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/globals.d.cts +8 -8
- package/dist/globals.d.ts +8 -8
- package/dist/index.cjs +37 -39
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +59 -37
- package/dist/index.d.ts +59 -37
- package/dist/index.js +43 -64
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +4 -4
- package/dist/jsx-dev-runtime.d.ts +4 -4
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/{jsx-namespace-fB1bxOIg.d.ts → jsx-namespace-BMpcDF6T.d.ts} +8 -8
- package/dist/{jsx-namespace-r-JXq_rp.d.cts → jsx-namespace-BdDNwAgO.d.cts} +8 -8
- package/dist/jsx-runtime-6sQc68DD.cjs.map +1 -1
- package/dist/jsx-runtime-CpElaHq6.js.map +1 -1
- package/dist/jsx-runtime.d.cts +4 -4
- package/dist/jsx-runtime.d.ts +4 -4
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.cts +1 -1
- package/dist/plugins.d.ts +2 -2
- package/dist/plugins.js +1 -1
- package/dist/{reactPlugin-CwuxUcyY.js → reactPlugin-C7_IY8_K.js} +85 -83
- package/dist/reactPlugin-C7_IY8_K.js.map +1 -0
- package/dist/{reactPlugin-BzHuVlbO.cjs → reactPlugin-DbTz9RKJ.cjs} +90 -82
- package/dist/reactPlugin-DbTz9RKJ.cjs.map +1 -0
- package/dist/{reactPlugin-CVS9VJ5P.d.ts → reactPlugin-Dl5F1rQk.d.ts} +37 -11
- package/dist/{reactPlugin-EQOIOEA2.d.cts → reactPlugin-fdJaWnpd.d.cts} +37 -11
- package/dist/{types-XiObCuPy.d.ts → types-BKnc-nPE.d.ts} +15 -15
- package/dist/{types-J_S-h-Ae.d.cts → types-K0AHi-aU.d.cts} +15 -15
- package/dist/types.d.cts +2 -2
- package/dist/types.d.ts +2 -2
- package/package.json +3 -3
- package/src/Renderer.ts +2 -2
- package/src/Runtime.tsx +6 -4
- package/src/components/App.tsx +4 -4
- package/src/components/Const.tsx +4 -4
- package/src/components/File.tsx +11 -11
- package/src/components/Function.tsx +6 -6
- package/src/components/Root.tsx +7 -7
- package/src/components/Type.tsx +4 -4
- package/src/composables/useLifecycle.tsx +1 -19
- package/src/devtools.ts +3 -3
- package/src/globals.ts +17 -8
- package/src/index.ts +4 -7
- package/src/jsx-dev-runtime.ts +3 -3
- package/src/jsx-namespace.d.ts +8 -8
- package/src/jsx-runtime.ts +3 -3
- package/src/plugins/reactPlugin.ts +5 -5
- package/src/types.ts +24 -15
- package/dist/reactPlugin-BzHuVlbO.cjs.map +0 -1
- package/dist/reactPlugin-CwuxUcyY.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as __name } from "./chunk-CrnDzoTS.js";
|
|
2
|
-
import {
|
|
2
|
+
import { c as FabricReactElement, h as types_d_exports } from "./types-BKnc-nPE.js";
|
|
3
3
|
import { TreeNode } from "@kubb/fabric-core";
|
|
4
4
|
|
|
5
5
|
//#region ../fabric-core/src/KubbFile.d.ts
|
|
@@ -20,9 +20,18 @@ type Import = {
|
|
|
20
20
|
*/
|
|
21
21
|
path: string;
|
|
22
22
|
/**
|
|
23
|
-
* Add
|
|
23
|
+
* Add type-only import prefix.
|
|
24
|
+
* - `true` generates `import type { Type } from './path'`
|
|
25
|
+
* - `false` generates `import { Type } from './path'`
|
|
26
|
+
* @default false
|
|
24
27
|
*/
|
|
25
28
|
isTypeOnly?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Import entire module as namespace.
|
|
31
|
+
* - `true` generates `import * as Name from './path'`
|
|
32
|
+
* - `false` generates standard import
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
26
35
|
isNameSpace?: boolean;
|
|
27
36
|
/**
|
|
28
37
|
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
@@ -32,14 +41,24 @@ type Import = {
|
|
|
32
41
|
type Source = {
|
|
33
42
|
name?: string;
|
|
34
43
|
value?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Make this source a type-only export.
|
|
46
|
+
* - `true` marks source as type export
|
|
47
|
+
* - `false` marks source as value export
|
|
48
|
+
* @default false
|
|
49
|
+
*/
|
|
35
50
|
isTypeOnly?: boolean;
|
|
36
51
|
/**
|
|
37
|
-
*
|
|
52
|
+
* Include export keyword in source.
|
|
53
|
+
* - `true` generates exportable const or type
|
|
54
|
+
* - `false` generates internal declaration
|
|
38
55
|
* @default false
|
|
39
56
|
*/
|
|
40
57
|
isExportable?: boolean;
|
|
41
58
|
/**
|
|
42
|
-
*
|
|
59
|
+
* Include in barrel file generation.
|
|
60
|
+
* - `true` adds to barrel exports
|
|
61
|
+
* - `false` excludes from barrel exports
|
|
43
62
|
* @default false
|
|
44
63
|
*/
|
|
45
64
|
isIndexable?: boolean;
|
|
@@ -57,17 +76,23 @@ type Export = {
|
|
|
57
76
|
*/
|
|
58
77
|
path: string;
|
|
59
78
|
/**
|
|
60
|
-
* Add
|
|
79
|
+
* Add type-only export prefix.
|
|
80
|
+
* - `true` generates `export type { Type } from './path'`
|
|
81
|
+
* - `false` generates `export { Type } from './path'`
|
|
82
|
+
* @default false
|
|
61
83
|
*/
|
|
62
84
|
isTypeOnly?: boolean;
|
|
63
85
|
/**
|
|
64
|
-
*
|
|
86
|
+
* Export as aliased namespace.
|
|
87
|
+
* - `true` generates `export * as aliasName from './path'`
|
|
88
|
+
* - `false` generates standard export
|
|
89
|
+
* @default false
|
|
65
90
|
*/
|
|
66
91
|
asAlias?: boolean;
|
|
67
92
|
};
|
|
68
93
|
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
69
94
|
/**
|
|
70
|
-
* Name to be used to
|
|
95
|
+
* Name to be used to dynamically create the baseName(based on input.path)
|
|
71
96
|
* Based on UNIX basename
|
|
72
97
|
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
73
98
|
*/
|
|
@@ -225,6 +250,7 @@ interface FabricOptions {
|
|
|
225
250
|
}
|
|
226
251
|
/**
|
|
227
252
|
* Available modes for file processing.
|
|
253
|
+
* @default 'sequential'
|
|
228
254
|
*/
|
|
229
255
|
type FabricMode = 'sequential' | 'parallel';
|
|
230
256
|
/**
|
|
@@ -417,15 +443,15 @@ type Options = {
|
|
|
417
443
|
debug?: boolean;
|
|
418
444
|
};
|
|
419
445
|
type ExtendOptions = {
|
|
420
|
-
render(App:
|
|
421
|
-
renderToString(App:
|
|
446
|
+
render(App: FabricReactElement): Promise<void>;
|
|
447
|
+
renderToString(App: FabricReactElement): Promise<string>;
|
|
422
448
|
waitUntilExit(): Promise<void>;
|
|
423
449
|
};
|
|
424
450
|
declare global {
|
|
425
451
|
namespace Kubb {
|
|
426
452
|
interface Fabric {
|
|
427
|
-
render(App:
|
|
428
|
-
renderToString(App:
|
|
453
|
+
render(App: FabricReactElement): Promise<void>;
|
|
454
|
+
renderToString(App: FabricReactElement): Promise<string>;
|
|
429
455
|
waitUntilExit(): Promise<void>;
|
|
430
456
|
}
|
|
431
457
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as __name,
|
|
1
|
+
import { b as __name, c as FabricReactElement, h as types_d_exports } from "./types-K0AHi-aU.cjs";
|
|
2
2
|
import { TreeNode } from "@kubb/fabric-core";
|
|
3
3
|
|
|
4
4
|
//#region ../fabric-core/src/KubbFile.d.ts
|
|
@@ -19,9 +19,18 @@ type Import = {
|
|
|
19
19
|
*/
|
|
20
20
|
path: string;
|
|
21
21
|
/**
|
|
22
|
-
* Add
|
|
22
|
+
* Add type-only import prefix.
|
|
23
|
+
* - `true` generates `import type { Type } from './path'`
|
|
24
|
+
* - `false` generates `import { Type } from './path'`
|
|
25
|
+
* @default false
|
|
23
26
|
*/
|
|
24
27
|
isTypeOnly?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Import entire module as namespace.
|
|
30
|
+
* - `true` generates `import * as Name from './path'`
|
|
31
|
+
* - `false` generates standard import
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
25
34
|
isNameSpace?: boolean;
|
|
26
35
|
/**
|
|
27
36
|
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
@@ -31,14 +40,24 @@ type Import = {
|
|
|
31
40
|
type Source = {
|
|
32
41
|
name?: string;
|
|
33
42
|
value?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Make this source a type-only export.
|
|
45
|
+
* - `true` marks source as type export
|
|
46
|
+
* - `false` marks source as value export
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
34
49
|
isTypeOnly?: boolean;
|
|
35
50
|
/**
|
|
36
|
-
*
|
|
51
|
+
* Include export keyword in source.
|
|
52
|
+
* - `true` generates exportable const or type
|
|
53
|
+
* - `false` generates internal declaration
|
|
37
54
|
* @default false
|
|
38
55
|
*/
|
|
39
56
|
isExportable?: boolean;
|
|
40
57
|
/**
|
|
41
|
-
*
|
|
58
|
+
* Include in barrel file generation.
|
|
59
|
+
* - `true` adds to barrel exports
|
|
60
|
+
* - `false` excludes from barrel exports
|
|
42
61
|
* @default false
|
|
43
62
|
*/
|
|
44
63
|
isIndexable?: boolean;
|
|
@@ -56,17 +75,23 @@ type Export = {
|
|
|
56
75
|
*/
|
|
57
76
|
path: string;
|
|
58
77
|
/**
|
|
59
|
-
* Add
|
|
78
|
+
* Add type-only export prefix.
|
|
79
|
+
* - `true` generates `export type { Type } from './path'`
|
|
80
|
+
* - `false` generates `export { Type } from './path'`
|
|
81
|
+
* @default false
|
|
60
82
|
*/
|
|
61
83
|
isTypeOnly?: boolean;
|
|
62
84
|
/**
|
|
63
|
-
*
|
|
85
|
+
* Export as aliased namespace.
|
|
86
|
+
* - `true` generates `export * as aliasName from './path'`
|
|
87
|
+
* - `false` generates standard export
|
|
88
|
+
* @default false
|
|
64
89
|
*/
|
|
65
90
|
asAlias?: boolean;
|
|
66
91
|
};
|
|
67
92
|
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
68
93
|
/**
|
|
69
|
-
* Name to be used to
|
|
94
|
+
* Name to be used to dynamically create the baseName(based on input.path)
|
|
70
95
|
* Based on UNIX basename
|
|
71
96
|
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
72
97
|
*/
|
|
@@ -224,6 +249,7 @@ interface FabricOptions {
|
|
|
224
249
|
}
|
|
225
250
|
/**
|
|
226
251
|
* Available modes for file processing.
|
|
252
|
+
* @default 'sequential'
|
|
227
253
|
*/
|
|
228
254
|
type FabricMode = 'sequential' | 'parallel';
|
|
229
255
|
/**
|
|
@@ -416,15 +442,15 @@ type Options = {
|
|
|
416
442
|
debug?: boolean;
|
|
417
443
|
};
|
|
418
444
|
type ExtendOptions = {
|
|
419
|
-
render(App:
|
|
420
|
-
renderToString(App:
|
|
445
|
+
render(App: FabricReactElement): Promise<void>;
|
|
446
|
+
renderToString(App: FabricReactElement): Promise<string>;
|
|
421
447
|
waitUntilExit(): Promise<void>;
|
|
422
448
|
};
|
|
423
449
|
declare global {
|
|
424
450
|
namespace Kubb {
|
|
425
451
|
interface Fabric {
|
|
426
|
-
render(App:
|
|
427
|
-
renderToString(App:
|
|
452
|
+
render(App: FabricReactElement): Promise<void>;
|
|
453
|
+
renderToString(App: FabricReactElement): Promise<string>;
|
|
428
454
|
waitUntilExit(): Promise<void>;
|
|
429
455
|
}
|
|
430
456
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as __reExport, n as __exportAll, r as __name } from "./chunk-CrnDzoTS.js";
|
|
2
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
|
-
import React, { JSX,
|
|
3
|
+
import React, { JSX, ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/utils/getFunctionParams.d.ts
|
|
6
6
|
type Param = {
|
|
@@ -47,11 +47,11 @@ declare class FunctionParams {
|
|
|
47
47
|
toConstructor(): string;
|
|
48
48
|
}
|
|
49
49
|
declare namespace types_d_exports {
|
|
50
|
-
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames,
|
|
50
|
+
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, FabricExportProps, FabricFileProps, FabricImportProps, FabricReactElement, FabricReactNode, FabricSourceProps, FabricTextProps, Key, LineBreakProps, Param, Params, TextNode };
|
|
51
51
|
}
|
|
52
52
|
import * as import__kubb_fabric_core_types from "@kubb/fabric-core/types";
|
|
53
|
-
type
|
|
54
|
-
type ElementNames =
|
|
53
|
+
type Key = string | number | bigint;
|
|
54
|
+
type ElementNames = 'br' | 'div' | 'indent' | 'dedent' | 'kubb-text' | 'kubb-file' | 'kubb-source' | 'kubb-import' | 'kubb-export' | 'kubb-root' | 'kubb-app';
|
|
55
55
|
type Node = {
|
|
56
56
|
parentNode: DOMElement | undefined;
|
|
57
57
|
internal_static?: boolean;
|
|
@@ -80,24 +80,24 @@ type DOMElement = {
|
|
|
80
80
|
onImmediateRender?: () => void;
|
|
81
81
|
} & Node;
|
|
82
82
|
type NodeNames = ElementNames | TextName;
|
|
83
|
-
type
|
|
84
|
-
type
|
|
85
|
-
type
|
|
86
|
-
children?:
|
|
83
|
+
type FabricReactNode = ReactNode;
|
|
84
|
+
type FabricReactElement = JSX.Element;
|
|
85
|
+
type FabricTextProps = {
|
|
86
|
+
children?: FabricReactNode;
|
|
87
87
|
};
|
|
88
|
-
type
|
|
88
|
+
type FabricFileProps = {
|
|
89
89
|
id?: string;
|
|
90
|
-
children?:
|
|
90
|
+
children?: FabricReactNode;
|
|
91
91
|
baseName: string;
|
|
92
92
|
path: string;
|
|
93
93
|
override?: boolean;
|
|
94
94
|
meta?: KubbFile.File['meta'];
|
|
95
95
|
};
|
|
96
|
-
type
|
|
97
|
-
children?:
|
|
96
|
+
type FabricSourceProps = KubbFile.Source & {
|
|
97
|
+
children?: FabricReactNode;
|
|
98
98
|
};
|
|
99
|
-
type
|
|
100
|
-
type
|
|
99
|
+
type FabricImportProps = KubbFile.Import;
|
|
100
|
+
type FabricExportProps = KubbFile.Export;
|
|
101
101
|
type LineBreakProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
|
|
102
102
|
//#endregion
|
|
103
|
-
export { Param as _,
|
|
103
|
+
export { Param as _, FabricExportProps as a, FabricReactElement as c, FabricTextProps as d, Key as f, FunctionParams as g, types_d_exports as h, ElementNames as i, FabricReactNode as l, TextNode as m, DOMNode as n, FabricFileProps as o, LineBreakProps as p, DOMNodeAttribute as r, FabricImportProps as s, DOMElement as t, FabricSourceProps as u, Params as v, createFunctionParams as y };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { JSX,
|
|
1
|
+
import React, { JSX, ReactNode } from "react";
|
|
2
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
3
|
|
|
4
4
|
//#region rolldown:runtime
|
|
@@ -48,11 +48,11 @@ declare class FunctionParams {
|
|
|
48
48
|
toConstructor(): string;
|
|
49
49
|
}
|
|
50
50
|
declare namespace types_d_exports {
|
|
51
|
-
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames,
|
|
51
|
+
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, FabricExportProps, FabricFileProps, FabricImportProps, FabricReactElement, FabricReactNode, FabricSourceProps, FabricTextProps, Key, LineBreakProps, Param, Params, TextNode };
|
|
52
52
|
}
|
|
53
53
|
import * as import__kubb_fabric_core_types from "@kubb/fabric-core/types";
|
|
54
|
-
type
|
|
55
|
-
type ElementNames =
|
|
54
|
+
type Key = string | number | bigint;
|
|
55
|
+
type ElementNames = 'br' | 'div' | 'indent' | 'dedent' | 'kubb-text' | 'kubb-file' | 'kubb-source' | 'kubb-import' | 'kubb-export' | 'kubb-root' | 'kubb-app';
|
|
56
56
|
type Node = {
|
|
57
57
|
parentNode: DOMElement | undefined;
|
|
58
58
|
internal_static?: boolean;
|
|
@@ -81,24 +81,24 @@ type DOMElement = {
|
|
|
81
81
|
onImmediateRender?: () => void;
|
|
82
82
|
} & Node;
|
|
83
83
|
type NodeNames = ElementNames | TextName;
|
|
84
|
-
type
|
|
85
|
-
type
|
|
86
|
-
type
|
|
87
|
-
children?:
|
|
84
|
+
type FabricReactNode = ReactNode;
|
|
85
|
+
type FabricReactElement = JSX.Element;
|
|
86
|
+
type FabricTextProps = {
|
|
87
|
+
children?: FabricReactNode;
|
|
88
88
|
};
|
|
89
|
-
type
|
|
89
|
+
type FabricFileProps = {
|
|
90
90
|
id?: string;
|
|
91
|
-
children?:
|
|
91
|
+
children?: FabricReactNode;
|
|
92
92
|
baseName: string;
|
|
93
93
|
path: string;
|
|
94
94
|
override?: boolean;
|
|
95
95
|
meta?: KubbFile.File['meta'];
|
|
96
96
|
};
|
|
97
|
-
type
|
|
98
|
-
children?:
|
|
97
|
+
type FabricSourceProps = KubbFile.Source & {
|
|
98
|
+
children?: FabricReactNode;
|
|
99
99
|
};
|
|
100
|
-
type
|
|
101
|
-
type
|
|
100
|
+
type FabricImportProps = KubbFile.Import;
|
|
101
|
+
type FabricExportProps = KubbFile.Export;
|
|
102
102
|
type LineBreakProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
|
|
103
103
|
//#endregion
|
|
104
|
-
export { Param as _,
|
|
104
|
+
export { Param as _, FabricExportProps as a, __name as b, FabricReactElement as c, FabricTextProps as d, Key as f, FunctionParams as g, types_d_exports as h, ElementNames as i, FabricReactNode as l, TextNode as m, DOMNode as n, FabricFileProps as o, LineBreakProps as p, DOMNodeAttribute as r, FabricImportProps as s, DOMElement as t, FabricSourceProps as u, Params as v, createFunctionParams as y };
|
package/dist/types.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as Param, a as
|
|
1
|
+
import { _ as Param, a as FabricExportProps, c as FabricReactElement, d as FabricTextProps, f as Key, i as ElementNames, l as FabricReactNode, m as TextNode, n as DOMNode, o as FabricFileProps, p as LineBreakProps, r as DOMNodeAttribute, s as FabricImportProps, t as DOMElement, u as FabricSourceProps, v as Params } from "./types-K0AHi-aU.cjs";
|
|
2
2
|
export * from "@kubb/fabric-core/types";
|
|
3
|
-
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames,
|
|
3
|
+
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, FabricExportProps, FabricFileProps, FabricImportProps, FabricReactElement, FabricReactNode, FabricSourceProps, FabricTextProps, Key, LineBreakProps, Param, Params, TextNode };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as Param, a as
|
|
1
|
+
import { _ as Param, a as FabricExportProps, c as FabricReactElement, d as FabricTextProps, f as Key, i as ElementNames, l as FabricReactNode, m as TextNode, n as DOMNode, o as FabricFileProps, p as LineBreakProps, r as DOMNodeAttribute, s as FabricImportProps, t as DOMElement, u as FabricSourceProps, v as Params } from "./types-BKnc-nPE.js";
|
|
2
2
|
export * from "@kubb/fabric-core/types";
|
|
3
|
-
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames,
|
|
3
|
+
export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, FabricExportProps, FabricFileProps, FabricImportProps, FabricReactElement, FabricReactNode, FabricSourceProps, FabricTextProps, Key, LineBreakProps, Param, Params, TextNode };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/react-fabric",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.6",
|
|
4
4
|
"description": "React integration for Kubb, providing JSX runtime support and React component generation capabilities for code generation plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -103,10 +103,10 @@
|
|
|
103
103
|
"remeda": "^2.33.4",
|
|
104
104
|
"signal-exit": "^4.1.0",
|
|
105
105
|
"ws": "8.18.0",
|
|
106
|
-
"@kubb/fabric-core": "0.12.
|
|
106
|
+
"@kubb/fabric-core": "0.12.6"
|
|
107
107
|
},
|
|
108
108
|
"devDependencies": {
|
|
109
|
-
"@types/react": "^19.2.
|
|
109
|
+
"@types/react": "^19.2.10",
|
|
110
110
|
"@types/react-reconciler": "0.32.0",
|
|
111
111
|
"@types/ws": "^8.18.1",
|
|
112
112
|
"react": "19.2.3",
|
package/src/Renderer.ts
CHANGED
|
@@ -2,13 +2,13 @@ import { createContext } from 'react'
|
|
|
2
2
|
import Reconciler, { type ReactContext } from 'react-reconciler'
|
|
3
3
|
import { DefaultEventPriority, NoEventPriority } from 'react-reconciler/constants.js'
|
|
4
4
|
import { appendChildNode, createNode, createTextNode, insertBeforeNode, removeChildNode, setAttribute, setTextNodeValue } from './dom.ts'
|
|
5
|
-
import type {
|
|
5
|
+
import type { FabricReactNode } from './types'
|
|
6
6
|
import type { DOMElement, DOMNodeAttribute, ElementNames, TextNode } from './types.ts'
|
|
7
7
|
|
|
8
8
|
declare module 'react-reconciler' {
|
|
9
9
|
// @ts-expect-error custom override
|
|
10
10
|
interface Reconciler {
|
|
11
|
-
updateContainerSync(element:
|
|
11
|
+
updateContainerSync(element: FabricReactNode, container: unknown, parentComponent: any, callback?: null | (() => void)): void
|
|
12
12
|
flushSyncWork(): void
|
|
13
13
|
createContainer(
|
|
14
14
|
containerInfo: unknown,
|
package/src/Runtime.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { Root } from './components/Root.tsx'
|
|
|
6
6
|
import { createNode } from './dom.ts'
|
|
7
7
|
import type { FiberRoot } from './Renderer.ts'
|
|
8
8
|
import { Renderer } from './Renderer.ts'
|
|
9
|
-
import type { ComponentNode, DOMElement,
|
|
9
|
+
import type { ComponentNode, DOMElement, FabricReactElement } from './types.ts'
|
|
10
10
|
import { processFiles } from './utils/processFiles.ts'
|
|
11
11
|
import { squashTextNodes } from './utils/squashTextNodes.ts'
|
|
12
12
|
|
|
@@ -133,7 +133,9 @@ export class Runtime {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
onExit(error?: Error): void {
|
|
136
|
-
|
|
136
|
+
setTimeout(() => {
|
|
137
|
+
this.unmount(error)
|
|
138
|
+
}, 0)
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
async #getOutput(node: DOMElement): Promise<string> {
|
|
@@ -156,7 +158,7 @@ export class Runtime {
|
|
|
156
158
|
return [...values].join('\n\n')
|
|
157
159
|
}
|
|
158
160
|
|
|
159
|
-
async render(node:
|
|
161
|
+
async render(node: FabricReactElement): Promise<void> {
|
|
160
162
|
const treeNode = this.#options.treeNode || new TreeNode<ComponentNode>({ type: 'Root', props: {} })
|
|
161
163
|
const props = {
|
|
162
164
|
fileManager: this.fileManager,
|
|
@@ -180,7 +182,7 @@ export class Runtime {
|
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
184
|
|
|
183
|
-
async renderToString(node:
|
|
185
|
+
async renderToString(node: FabricReactElement): Promise<string> {
|
|
184
186
|
const treeNode = this.#options.treeNode || new TreeNode<ComponentNode>({ type: 'Root', props: {} })
|
|
185
187
|
const props = {
|
|
186
188
|
fileManager: this.fileManager,
|
package/src/components/App.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AppContext, NodeTreeContext, provide, RootContext, useContext, useNodeTree } from '@kubb/fabric-core'
|
|
2
|
-
import type {
|
|
2
|
+
import type { FabricReactElement, FabricReactNode } from '../types.ts'
|
|
3
3
|
|
|
4
4
|
export type AppProps<TMeta extends object = object> = {
|
|
5
5
|
/**
|
|
@@ -9,13 +9,13 @@ export type AppProps<TMeta extends object = object> = {
|
|
|
9
9
|
/**
|
|
10
10
|
* Children nodes.
|
|
11
11
|
*/
|
|
12
|
-
children?:
|
|
12
|
+
children?: FabricReactNode
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* App container containing the AppContext carrying `meta` and an `exit` hook.
|
|
17
17
|
*/
|
|
18
|
-
export function App<TMeta extends object = object>({ children, ...props }: AppProps<TMeta>):
|
|
18
|
+
export function App<TMeta extends object = object>({ children, ...props }: AppProps<TMeta>): FabricReactElement {
|
|
19
19
|
const { meta = {} } = props
|
|
20
20
|
|
|
21
21
|
const { exit } = useContext(RootContext)
|
|
@@ -33,4 +33,4 @@ export function App<TMeta extends object = object>({ children, ...props }: AppPr
|
|
|
33
33
|
return <>{children}</>
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
App.displayName = '
|
|
36
|
+
App.displayName = 'App'
|
package/src/components/Const.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'
|
|
2
|
-
import type {
|
|
2
|
+
import type { FabricReactElement, FabricReactNode, JSDoc, Key } from '../types.ts'
|
|
3
3
|
import { createJSDoc } from '../utils/createJSDoc.ts'
|
|
4
4
|
|
|
5
5
|
export type ConstProps = {
|
|
@@ -27,13 +27,13 @@ export type ConstProps = {
|
|
|
27
27
|
/**
|
|
28
28
|
* Children nodes.
|
|
29
29
|
*/
|
|
30
|
-
children?:
|
|
30
|
+
children?: FabricReactNode
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/**
|
|
34
34
|
* Generates a TypeScript constant declaration.
|
|
35
35
|
*/
|
|
36
|
-
export function Const({ children, ...props }: ConstProps):
|
|
36
|
+
export function Const({ children, ...props }: ConstProps): FabricReactElement {
|
|
37
37
|
const { name, export: canExport, type, JSDoc, asConst } = props
|
|
38
38
|
|
|
39
39
|
const nodeTree = useNodeTree()
|
|
@@ -66,4 +66,4 @@ export function Const({ children, ...props }: ConstProps): KubbElement {
|
|
|
66
66
|
)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
Const.displayName = '
|
|
69
|
+
Const.displayName = 'Const'
|
package/src/components/File.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FileContext, NodeTreeContext, provide, useFile, useFileManager, useNodeTree } from '@kubb/fabric-core'
|
|
2
2
|
import type { KubbFile } from '@kubb/fabric-core/types'
|
|
3
|
-
import type {
|
|
3
|
+
import type { FabricReactElement, FabricReactNode, Key } from '../types.ts'
|
|
4
4
|
|
|
5
5
|
type BasePropsWithBaseName = {
|
|
6
6
|
/**
|
|
@@ -30,13 +30,13 @@ type Props<TMeta> = BaseProps & {
|
|
|
30
30
|
meta?: TMeta
|
|
31
31
|
banner?: string
|
|
32
32
|
footer?: string
|
|
33
|
-
children?:
|
|
33
|
+
children?: FabricReactNode
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* Adds files to the FileManager
|
|
38
38
|
*/
|
|
39
|
-
export function File<TMeta extends object = object>({ children, ...props }: Props<TMeta>):
|
|
39
|
+
export function File<TMeta extends object = object>({ children, ...props }: Props<TMeta>): FabricReactElement {
|
|
40
40
|
const { baseName, path, meta = {}, footer, banner } = props
|
|
41
41
|
|
|
42
42
|
const fileManager = useFileManager()
|
|
@@ -69,11 +69,11 @@ export function File<TMeta extends object = object>({ children, ...props }: Prop
|
|
|
69
69
|
return <kubb-file {...props}>{children}</kubb-file>
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
File.displayName = '
|
|
72
|
+
File.displayName = 'File'
|
|
73
73
|
|
|
74
74
|
type FileSourceProps = Omit<KubbFile.Source, 'value'> & {
|
|
75
75
|
key?: Key
|
|
76
|
-
children?:
|
|
76
|
+
children?: FabricReactNode
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
/**
|
|
@@ -82,7 +82,7 @@ type FileSourceProps = Omit<KubbFile.Source, 'value'> & {
|
|
|
82
82
|
* Marks a block of source text to be associated with the current file when
|
|
83
83
|
* rendering with the FileCollector. Children are treated as the source string.
|
|
84
84
|
*/
|
|
85
|
-
function FileSource({ children, ...props }: FileSourceProps):
|
|
85
|
+
function FileSource({ children, ...props }: FileSourceProps): FabricReactElement {
|
|
86
86
|
const { name, isExportable, isIndexable, isTypeOnly } = props
|
|
87
87
|
|
|
88
88
|
const nodeTree = useNodeTree()
|
|
@@ -100,7 +100,7 @@ function FileSource({ children, ...props }: FileSourceProps): KubbElement {
|
|
|
100
100
|
)
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
FileSource.displayName = '
|
|
103
|
+
FileSource.displayName = 'FileSource'
|
|
104
104
|
|
|
105
105
|
export type FileExportProps = KubbFile.Export & { key?: Key }
|
|
106
106
|
|
|
@@ -110,7 +110,7 @@ export type FileExportProps = KubbFile.Export & { key?: Key }
|
|
|
110
110
|
* Declares an export entry for the current file. This will be collected by
|
|
111
111
|
* the FileCollector for later emission.
|
|
112
112
|
*/
|
|
113
|
-
function FileExport(props: FileExportProps):
|
|
113
|
+
function FileExport(props: FileExportProps): FabricReactElement {
|
|
114
114
|
const { name, path, isTypeOnly, asAlias } = props
|
|
115
115
|
|
|
116
116
|
const nodeTree = useNodeTree()
|
|
@@ -134,7 +134,7 @@ function FileExport(props: FileExportProps): KubbElement {
|
|
|
134
134
|
return <kubb-export name={name} path={path} isTypeOnly={isTypeOnly} asAlias={asAlias} />
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
FileExport.displayName = '
|
|
137
|
+
FileExport.displayName = 'FileExport'
|
|
138
138
|
|
|
139
139
|
export type FileImportProps = KubbFile.Import & { key?: Key }
|
|
140
140
|
|
|
@@ -143,7 +143,7 @@ export type FileImportProps = KubbFile.Import & { key?: Key }
|
|
|
143
143
|
*
|
|
144
144
|
* Declares an import entry for the current file.
|
|
145
145
|
*/
|
|
146
|
-
function FileImport(props: FileImportProps):
|
|
146
|
+
function FileImport(props: FileImportProps): FabricReactElement {
|
|
147
147
|
const { name, root, path, isTypeOnly, isNameSpace } = props
|
|
148
148
|
|
|
149
149
|
const nodeTree = useNodeTree()
|
|
@@ -168,7 +168,7 @@ function FileImport(props: FileImportProps): KubbElement {
|
|
|
168
168
|
return <kubb-import name={name} root={root} path={path} isNameSpace={isNameSpace} isTypeOnly={isTypeOnly} />
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
FileImport.displayName = '
|
|
171
|
+
FileImport.displayName = 'FileImport'
|
|
172
172
|
|
|
173
173
|
File.Export = FileExport
|
|
174
174
|
File.Import = FileImport
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'
|
|
2
|
-
import type {
|
|
2
|
+
import type { FabricReactElement, FabricReactNode, JSDoc, Key } from '../types.ts'
|
|
3
3
|
import { createJSDoc } from '../utils/createJSDoc.ts'
|
|
4
4
|
|
|
5
5
|
type Props = {
|
|
@@ -21,7 +21,7 @@ type Props = {
|
|
|
21
21
|
*/
|
|
22
22
|
export?: boolean
|
|
23
23
|
/**
|
|
24
|
-
* Does the function has async/promise
|
|
24
|
+
* Does the function has async/promise behavior.
|
|
25
25
|
* This will also add `Promise<returnType>` as the returnType.
|
|
26
26
|
*/
|
|
27
27
|
async?: boolean
|
|
@@ -40,13 +40,13 @@ type Props = {
|
|
|
40
40
|
/**
|
|
41
41
|
* Children nodes.
|
|
42
42
|
*/
|
|
43
|
-
children?:
|
|
43
|
+
children?: FabricReactNode
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
/**
|
|
47
47
|
* Generates a TypeScript function declaration.
|
|
48
48
|
*/
|
|
49
|
-
export function Function({ children, ...props }: Props):
|
|
49
|
+
export function Function({ children, ...props }: Props): FabricReactElement {
|
|
50
50
|
const { name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc } = props
|
|
51
51
|
|
|
52
52
|
const nodeTree = useNodeTree()
|
|
@@ -97,7 +97,7 @@ export function Function({ children, ...props }: Props): KubbElement {
|
|
|
97
97
|
)
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
Function.displayName = '
|
|
100
|
+
Function.displayName = 'Function'
|
|
101
101
|
|
|
102
102
|
type ArrowFunctionProps = Props & {
|
|
103
103
|
/**
|
|
@@ -173,5 +173,5 @@ function ArrowFunction({ children, ...props }: ArrowFunctionProps) {
|
|
|
173
173
|
)
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
-
ArrowFunction.displayName = '
|
|
176
|
+
ArrowFunction.displayName = 'ArrowFunction'
|
|
177
177
|
Function.Arrow = ArrowFunction
|