@kubb/react-fabric 0.1.8 → 0.2.1

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.
Files changed (76) hide show
  1. package/README.md +273 -26
  2. package/dist/{App-D7ehObix.d.ts → Fabric-nxgJyzWH.d.cts} +27 -27
  3. package/dist/{App-CbT7rbmH.d.cts → Fabric-tVWTpMR5.d.ts} +27 -27
  4. package/dist/{KubbFile-D4gyyfL-.d.ts → KubbFile-DFnA3mmn.d.ts} +1 -1
  5. package/dist/{KubbFile-FGXV713i.d.cts → KubbFile-DHCtBOpy.d.cts} +1 -1
  6. package/dist/chunk-CVmoYqME.js +27 -0
  7. package/dist/chunk-DWy1uDak.cjs +39 -0
  8. package/dist/devtools-DPye8o33.js +11448 -0
  9. package/dist/devtools-DPye8o33.js.map +1 -0
  10. package/dist/devtools-DnQsy6Us.cjs +11456 -0
  11. package/dist/devtools-DnQsy6Us.cjs.map +1 -0
  12. package/dist/devtools.cjs +2 -10885
  13. package/dist/devtools.d.cts +11 -1
  14. package/dist/devtools.d.ts +11 -1
  15. package/dist/devtools.js +2 -10885
  16. package/dist/{globals-BRG2DOJd.d.cts → globals-C7dPa-nz.d.cts} +3 -3
  17. package/dist/{globals-D_1Lfe9-.d.ts → globals-CxZEi_Pn.d.ts} +3 -3
  18. package/dist/globals.d.cts +3 -3
  19. package/dist/globals.d.ts +3 -3
  20. package/dist/index.cjs +34 -23
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +16 -9
  23. package/dist/index.d.ts +16 -9
  24. package/dist/index.js +15 -5
  25. package/dist/index.js.map +1 -1
  26. package/dist/jsx-dev-runtime.cjs +8 -0
  27. package/dist/jsx-dev-runtime.js +5 -0
  28. package/dist/jsx-runtime-9ohe6OS2.cjs +36 -0
  29. package/dist/jsx-runtime-9ohe6OS2.cjs.map +1 -0
  30. package/dist/{react-BBkwFtZV.js → jsx-runtime-BOrVcbIT.cjs} +253 -42
  31. package/dist/jsx-runtime-BOrVcbIT.cjs.map +1 -0
  32. package/dist/{react-Bq0UOw6S.cjs → jsx-runtime-CFd_ktZn.js} +239 -57
  33. package/dist/jsx-runtime-CFd_ktZn.js.map +1 -0
  34. package/dist/jsx-runtime-CvGZkcTo.js +13 -0
  35. package/dist/jsx-runtime-CvGZkcTo.js.map +1 -0
  36. package/dist/jsx-runtime.cjs +6 -15
  37. package/dist/jsx-runtime.d.cts +3 -3
  38. package/dist/jsx-runtime.d.ts +3 -3
  39. package/dist/jsx-runtime.js +3 -12
  40. package/dist/parsers.d.cts +2 -2
  41. package/dist/parsers.d.ts +2 -2
  42. package/dist/{Runtime-JI640uK4.cjs → plugins-CEGJdkpj.cjs} +115 -81
  43. package/dist/plugins-CEGJdkpj.cjs.map +1 -0
  44. package/dist/{Runtime-DWlDUeLZ.js → plugins-aZCNhIC8.js} +90 -63
  45. package/dist/plugins-aZCNhIC8.js.map +1 -0
  46. package/dist/plugins.cjs +4 -35
  47. package/dist/plugins.d.cts +16 -49
  48. package/dist/plugins.d.ts +16 -49
  49. package/dist/plugins.js +3 -33
  50. package/dist/reactPlugin-B47Guoya.d.ts +38 -0
  51. package/dist/reactPlugin-CLgWWifj.d.cts +38 -0
  52. package/dist/{types-C3p0Ljxf.d.cts → types-DoYRYV1C.d.cts} +1 -1
  53. package/dist/{types-Brnyan9B.d.ts → types-u_NEi07i.d.ts} +1 -1
  54. package/dist/types.d.cts +1 -1
  55. package/dist/types.d.ts +1 -1
  56. package/package.json +11 -7
  57. package/src/Renderer.ts +26 -22
  58. package/src/Runtime.tsx +8 -7
  59. package/src/createReactFabric.ts +17 -0
  60. package/src/devtools.ts +106 -111
  61. package/src/index.ts +2 -1
  62. package/src/plugins/reactPlugin.ts +4 -3
  63. package/dist/Runtime-DWlDUeLZ.js.map +0 -1
  64. package/dist/Runtime-JI640uK4.cjs.map +0 -1
  65. package/dist/devtools.cjs.map +0 -1
  66. package/dist/devtools.js.map +0 -1
  67. package/dist/jsx-runtime-Dg-pJBHd.js +0 -228
  68. package/dist/jsx-runtime-Dg-pJBHd.js.map +0 -1
  69. package/dist/jsx-runtime-d2dmYscH.cjs +0 -233
  70. package/dist/jsx-runtime-d2dmYscH.cjs.map +0 -1
  71. package/dist/jsx-runtime.cjs.map +0 -1
  72. package/dist/jsx-runtime.js.map +0 -1
  73. package/dist/plugins.cjs.map +0 -1
  74. package/dist/plugins.js.map +0 -1
  75. package/dist/react-BBkwFtZV.js.map +0 -1
  76. package/dist/react-Bq0UOw6S.cjs.map +0 -1
package/dist/plugins.cjs CHANGED
@@ -1,42 +1,11 @@
1
- const require_react$1 = require('./react-Bq0UOw6S.cjs');
2
- const require_Runtime = require('./Runtime-JI640uK4.cjs');
3
- require('./jsx-runtime-d2dmYscH.cjs');
4
- let __kubb_fabric_core_plugins = require("@kubb/fabric-core/plugins");
5
- __kubb_fabric_core_plugins = require_react$1.__toESM(__kubb_fabric_core_plugins);
1
+ require('./jsx-runtime-BOrVcbIT.cjs');
2
+ const require_plugins = require('./plugins-CEGJdkpj.cjs');
6
3
 
7
- //#region src/plugins/reactPlugin.ts
8
- var import_react = /* @__PURE__ */ require_react$1.__toESM(require_react$1.require_react(), 1);
9
- const reactPlugin = (0, __kubb_fabric_core_plugins.createPlugin)({
10
- name: "react",
11
- install() {},
12
- inject(app, options = {}) {
13
- const runtime = new require_Runtime.Runtime({
14
- fileManager: app.context.fileManager,
15
- ...options
16
- });
17
- return {
18
- async render(App) {
19
- runtime.render((0, import_react.createElement)(App));
20
- await app.context.events.emit("start");
21
- },
22
- async renderToString(App) {
23
- return runtime.renderToString((0, import_react.createElement)(App));
24
- },
25
- async waitUntilExit() {
26
- await runtime.waitUntilExit();
27
- await app.context.events.emit("end");
28
- }
29
- };
30
- }
31
- });
32
-
33
- //#endregion
34
- exports.reactPlugin = reactPlugin;
4
+ exports.reactPlugin = require_plugins.reactPlugin;
5
+ var __kubb_fabric_core_plugins = require("@kubb/fabric-core/plugins");
35
6
  Object.keys(__kubb_fabric_core_plugins).forEach(function (k) {
36
7
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
37
8
  enumerable: true,
38
9
  get: function () { return __kubb_fabric_core_plugins[k]; }
39
10
  });
40
11
  });
41
-
42
- //# sourceMappingURL=plugins.cjs.map
@@ -1,15 +1,15 @@
1
- import { r as Extname } from "./KubbFile-FGXV713i.cjs";
2
- import { o as Plugin, s as UserPlugin } from "./App-CbT7rbmH.cjs";
3
- import { ElementType } from "react";
1
+ import { r as Extname } from "./KubbFile-DHCtBOpy.cjs";
2
+ import { c as UserPlugin, s as Plugin } from "./Fabric-nxgJyzWH.cjs";
3
+ import { n as reactPlugin } from "./reactPlugin-CLgWWifj.cjs";
4
4
 
5
5
  //#region ../fabric-core/src/plugins/createPlugin.d.ts
6
- declare function createPlugin<Options$4 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$4, TAppExtension>): Plugin<Options$4, TAppExtension>;
6
+ declare function createPlugin<Options$3 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$3, TAppExtension>): Plugin<Options$3, TAppExtension>;
7
7
  //#endregion
8
8
  //#region ../fabric-core/src/plugins/fsPlugin.d.ts
9
9
  type WriteOptions = {
10
10
  extension?: Record<Extname, Extname | ''>;
11
11
  };
12
- type Options$3 = {
12
+ type Options$2 = {
13
13
  dryRun?: boolean;
14
14
  /**
15
15
  * Optional callback that is invoked whenever a file is written by the plugin.
@@ -20,26 +20,26 @@ type Options$3 = {
20
20
  path: string;
21
21
  };
22
22
  };
23
- type ExtendOptions$2 = {
23
+ type ExtendOptions$1 = {
24
24
  write(options?: WriteOptions): Promise<void>;
25
25
  };
26
26
  declare module '@kubb/fabric-core' {
27
- interface App {
27
+ interface Fabric {
28
28
  write(options?: WriteOptions): Promise<void>;
29
29
  }
30
30
  }
31
31
  declare global {
32
32
  namespace Kubb {
33
- interface App {
33
+ interface Fabric {
34
34
  write(options?: WriteOptions): Promise<void>;
35
35
  }
36
36
  }
37
37
  }
38
- declare const fsPlugin: Plugin<Options$3, ExtendOptions$2>;
38
+ declare const fsPlugin: Plugin<Options$2, ExtendOptions$1>;
39
39
  //#endregion
40
40
  //#region ../fabric-core/src/plugins/barrelPlugin.d.ts
41
41
  type Mode = 'all' | 'named' | 'propagate' | false;
42
- type Options$2 = {
42
+ type Options$1 = {
43
43
  root: string;
44
44
  mode: Mode;
45
45
  dryRun?: boolean;
@@ -48,68 +48,35 @@ type WriteEntryOptions = {
48
48
  root: string;
49
49
  mode: Mode;
50
50
  };
51
- type ExtendOptions$1 = {
51
+ type ExtendOptions = {
52
52
  writeEntry(options: WriteEntryOptions): Promise<void>;
53
53
  };
54
54
  declare module '@kubb/fabric-core' {
55
- interface App {
55
+ interface Fabric {
56
56
  writeEntry(options: WriteEntryOptions): Promise<void>;
57
57
  }
58
58
  }
59
59
  declare global {
60
60
  namespace Kubb {
61
- interface App {
61
+ interface Fabric {
62
62
  writeEntry(options: WriteEntryOptions): Promise<void>;
63
63
  }
64
64
  }
65
65
  }
66
- declare const barrelPlugin: Plugin<Options$2, ExtendOptions$1>;
66
+ declare const barrelPlugin: Plugin<Options$1, ExtendOptions>;
67
67
  //#endregion
68
68
  //#region ../fabric-core/src/plugins/progressPlugin.d.ts
69
69
  declare const progressPlugin: Plugin<[], {}>;
70
70
  //#endregion
71
71
  //#region ../fabric-core/src/plugins/graphPlugin.d.ts
72
- type Options$1 = {
72
+ type Options = {
73
73
  root: string;
74
74
  /**
75
75
  * @default false
76
76
  */
77
77
  open?: boolean;
78
78
  };
79
- declare const graphPlugin: Plugin<Options$1, {}>;
80
- //#endregion
81
- //#region src/plugins/reactPlugin.d.ts
82
- type Options = {
83
- stdout?: NodeJS.WriteStream;
84
- stdin?: NodeJS.ReadStream;
85
- stderr?: NodeJS.WriteStream;
86
- /**
87
- * Set this to true to always see the result of the render in the console(line per render)
88
- */
89
- debug?: boolean;
90
- };
91
- type ExtendOptions = {
92
- render(App: ElementType): Promise<void> | void;
93
- renderToString(App: ElementType): Promise<string> | string;
94
- waitUntilExit(): Promise<void>;
95
- };
96
- declare module '@kubb/fabric-core' {
97
- interface App {
98
- render(App: ElementType): Promise<void> | void;
99
- renderToString(App: ElementType): Promise<string> | string;
100
- waitUntilExit(): Promise<void>;
101
- }
102
- }
103
- declare global {
104
- namespace Kubb {
105
- interface App {
106
- render(App: ElementType): Promise<void> | void;
107
- renderToString(App: ElementType): Promise<string> | string;
108
- waitUntilExit(): Promise<void>;
109
- }
110
- }
111
- }
112
- declare const reactPlugin: Plugin<Options, ExtendOptions>;
79
+ declare const graphPlugin: Plugin<Options, {}>;
113
80
  //#endregion
114
81
  export { barrelPlugin, createPlugin, fsPlugin, graphPlugin, progressPlugin, reactPlugin };
115
82
  //# sourceMappingURL=plugins.d.cts.map
package/dist/plugins.d.ts CHANGED
@@ -1,15 +1,15 @@
1
- import { r as Extname } from "./KubbFile-D4gyyfL-.js";
2
- import { o as Plugin, s as UserPlugin } from "./App-D7ehObix.js";
3
- import { ElementType } from "react";
1
+ import { r as Extname } from "./KubbFile-DFnA3mmn.js";
2
+ import { c as UserPlugin, s as Plugin } from "./Fabric-tVWTpMR5.js";
3
+ import { n as reactPlugin } from "./reactPlugin-B47Guoya.js";
4
4
 
5
5
  //#region ../fabric-core/src/plugins/createPlugin.d.ts
6
- declare function createPlugin<Options$4 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$4, TAppExtension>): Plugin<Options$4, TAppExtension>;
6
+ declare function createPlugin<Options$3 = unknown, TAppExtension extends Record<string, any> = {}>(plugin: UserPlugin<Options$3, TAppExtension>): Plugin<Options$3, TAppExtension>;
7
7
  //#endregion
8
8
  //#region ../fabric-core/src/plugins/fsPlugin.d.ts
9
9
  type WriteOptions = {
10
10
  extension?: Record<Extname, Extname | ''>;
11
11
  };
12
- type Options$3 = {
12
+ type Options$2 = {
13
13
  dryRun?: boolean;
14
14
  /**
15
15
  * Optional callback that is invoked whenever a file is written by the plugin.
@@ -20,26 +20,26 @@ type Options$3 = {
20
20
  path: string;
21
21
  };
22
22
  };
23
- type ExtendOptions$2 = {
23
+ type ExtendOptions$1 = {
24
24
  write(options?: WriteOptions): Promise<void>;
25
25
  };
26
26
  declare module '@kubb/fabric-core' {
27
- interface App {
27
+ interface Fabric {
28
28
  write(options?: WriteOptions): Promise<void>;
29
29
  }
30
30
  }
31
31
  declare global {
32
32
  namespace Kubb {
33
- interface App {
33
+ interface Fabric {
34
34
  write(options?: WriteOptions): Promise<void>;
35
35
  }
36
36
  }
37
37
  }
38
- declare const fsPlugin: Plugin<Options$3, ExtendOptions$2>;
38
+ declare const fsPlugin: Plugin<Options$2, ExtendOptions$1>;
39
39
  //#endregion
40
40
  //#region ../fabric-core/src/plugins/barrelPlugin.d.ts
41
41
  type Mode = 'all' | 'named' | 'propagate' | false;
42
- type Options$2 = {
42
+ type Options$1 = {
43
43
  root: string;
44
44
  mode: Mode;
45
45
  dryRun?: boolean;
@@ -48,68 +48,35 @@ type WriteEntryOptions = {
48
48
  root: string;
49
49
  mode: Mode;
50
50
  };
51
- type ExtendOptions$1 = {
51
+ type ExtendOptions = {
52
52
  writeEntry(options: WriteEntryOptions): Promise<void>;
53
53
  };
54
54
  declare module '@kubb/fabric-core' {
55
- interface App {
55
+ interface Fabric {
56
56
  writeEntry(options: WriteEntryOptions): Promise<void>;
57
57
  }
58
58
  }
59
59
  declare global {
60
60
  namespace Kubb {
61
- interface App {
61
+ interface Fabric {
62
62
  writeEntry(options: WriteEntryOptions): Promise<void>;
63
63
  }
64
64
  }
65
65
  }
66
- declare const barrelPlugin: Plugin<Options$2, ExtendOptions$1>;
66
+ declare const barrelPlugin: Plugin<Options$1, ExtendOptions>;
67
67
  //#endregion
68
68
  //#region ../fabric-core/src/plugins/progressPlugin.d.ts
69
69
  declare const progressPlugin: Plugin<[], {}>;
70
70
  //#endregion
71
71
  //#region ../fabric-core/src/plugins/graphPlugin.d.ts
72
- type Options$1 = {
72
+ type Options = {
73
73
  root: string;
74
74
  /**
75
75
  * @default false
76
76
  */
77
77
  open?: boolean;
78
78
  };
79
- declare const graphPlugin: Plugin<Options$1, {}>;
80
- //#endregion
81
- //#region src/plugins/reactPlugin.d.ts
82
- type Options = {
83
- stdout?: NodeJS.WriteStream;
84
- stdin?: NodeJS.ReadStream;
85
- stderr?: NodeJS.WriteStream;
86
- /**
87
- * Set this to true to always see the result of the render in the console(line per render)
88
- */
89
- debug?: boolean;
90
- };
91
- type ExtendOptions = {
92
- render(App: ElementType): Promise<void> | void;
93
- renderToString(App: ElementType): Promise<string> | string;
94
- waitUntilExit(): Promise<void>;
95
- };
96
- declare module '@kubb/fabric-core' {
97
- interface App {
98
- render(App: ElementType): Promise<void> | void;
99
- renderToString(App: ElementType): Promise<string> | string;
100
- waitUntilExit(): Promise<void>;
101
- }
102
- }
103
- declare global {
104
- namespace Kubb {
105
- interface App {
106
- render(App: ElementType): Promise<void> | void;
107
- renderToString(App: ElementType): Promise<string> | string;
108
- waitUntilExit(): Promise<void>;
109
- }
110
- }
111
- }
112
- declare const reactPlugin: Plugin<Options, ExtendOptions>;
79
+ declare const graphPlugin: Plugin<Options, {}>;
113
80
  //#endregion
114
81
  export { barrelPlugin, createPlugin, fsPlugin, graphPlugin, progressPlugin, reactPlugin };
115
82
  //# sourceMappingURL=plugins.d.ts.map
package/dist/plugins.js CHANGED
@@ -1,36 +1,6 @@
1
- import { r as __toESM, t as require_react } from "./react-BBkwFtZV.js";
2
- import { t as Runtime } from "./Runtime-DWlDUeLZ.js";
3
- import "./jsx-runtime-Dg-pJBHd.js";
4
- import { createPlugin } from "@kubb/fabric-core/plugins";
1
+ import "./jsx-runtime-CFd_ktZn.js";
2
+ import { t as reactPlugin } from "./plugins-aZCNhIC8.js";
5
3
 
6
4
  export * from "@kubb/fabric-core/plugins"
7
5
 
8
- //#region src/plugins/reactPlugin.ts
9
- var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
10
- const reactPlugin = createPlugin({
11
- name: "react",
12
- install() {},
13
- inject(app, options = {}) {
14
- const runtime = new Runtime({
15
- fileManager: app.context.fileManager,
16
- ...options
17
- });
18
- return {
19
- async render(App) {
20
- runtime.render((0, import_react.createElement)(App));
21
- await app.context.events.emit("start");
22
- },
23
- async renderToString(App) {
24
- return runtime.renderToString((0, import_react.createElement)(App));
25
- },
26
- async waitUntilExit() {
27
- await runtime.waitUntilExit();
28
- await app.context.events.emit("end");
29
- }
30
- };
31
- }
32
- });
33
-
34
- //#endregion
35
- export { reactPlugin };
36
- //# sourceMappingURL=plugins.js.map
6
+ export { reactPlugin };
@@ -0,0 +1,38 @@
1
+ import { s as Plugin } from "./Fabric-tVWTpMR5.js";
2
+ import { ElementType } from "react";
3
+
4
+ //#region src/plugins/reactPlugin.d.ts
5
+ type Options = {
6
+ stdout?: NodeJS.WriteStream;
7
+ stdin?: NodeJS.ReadStream;
8
+ stderr?: NodeJS.WriteStream;
9
+ /**
10
+ * Set this to true to always see the result of the render in the console(line per render)
11
+ */
12
+ debug?: boolean;
13
+ };
14
+ type ExtendOptions = {
15
+ render(App: ElementType): Promise<void> | void;
16
+ renderToString(App: ElementType): Promise<string> | string;
17
+ waitUntilExit(): Promise<void>;
18
+ };
19
+ declare module '@kubb/fabric-core' {
20
+ interface Fabric {
21
+ render(App: ElementType): Promise<void> | void;
22
+ renderToString(App: ElementType): Promise<string> | string;
23
+ waitUntilExit(): Promise<void>;
24
+ }
25
+ }
26
+ declare global {
27
+ namespace Kubb {
28
+ interface Fabric {
29
+ render(App: ElementType): Promise<void> | void;
30
+ renderToString(App: ElementType): Promise<string> | string;
31
+ waitUntilExit(): Promise<void>;
32
+ }
33
+ }
34
+ }
35
+ declare const reactPlugin: Plugin<Options, ExtendOptions>;
36
+ //#endregion
37
+ export { reactPlugin as n, Options as t };
38
+ //# sourceMappingURL=reactPlugin-B47Guoya.d.ts.map
@@ -0,0 +1,38 @@
1
+ import { s as Plugin } from "./Fabric-nxgJyzWH.cjs";
2
+ import { ElementType } from "react";
3
+
4
+ //#region src/plugins/reactPlugin.d.ts
5
+ type Options = {
6
+ stdout?: NodeJS.WriteStream;
7
+ stdin?: NodeJS.ReadStream;
8
+ stderr?: NodeJS.WriteStream;
9
+ /**
10
+ * Set this to true to always see the result of the render in the console(line per render)
11
+ */
12
+ debug?: boolean;
13
+ };
14
+ type ExtendOptions = {
15
+ render(App: ElementType): Promise<void> | void;
16
+ renderToString(App: ElementType): Promise<string> | string;
17
+ waitUntilExit(): Promise<void>;
18
+ };
19
+ declare module '@kubb/fabric-core' {
20
+ interface Fabric {
21
+ render(App: ElementType): Promise<void> | void;
22
+ renderToString(App: ElementType): Promise<string> | string;
23
+ waitUntilExit(): Promise<void>;
24
+ }
25
+ }
26
+ declare global {
27
+ namespace Kubb {
28
+ interface Fabric {
29
+ render(App: ElementType): Promise<void> | void;
30
+ renderToString(App: ElementType): Promise<string> | string;
31
+ waitUntilExit(): Promise<void>;
32
+ }
33
+ }
34
+ }
35
+ declare const reactPlugin: Plugin<Options, ExtendOptions>;
36
+ //#endregion
37
+ export { reactPlugin as n, Options as t };
38
+ //# sourceMappingURL=reactPlugin-CLgWWifj.d.cts.map
@@ -82,4 +82,4 @@ type JSDoc = {
82
82
  };
83
83
  //#endregion
84
84
  export { JSDoc as a, TextNode as c, Params as d, createFunctionParams as f, ElementNames as i, FunctionParams as l, DOMNode as n, Key as o, DOMNodeAttribute as r, KubbNode as s, DOMElement as t, Param as u };
85
- //# sourceMappingURL=types-C3p0Ljxf.d.cts.map
85
+ //# sourceMappingURL=types-DoYRYV1C.d.cts.map
@@ -82,4 +82,4 @@ type JSDoc = {
82
82
  };
83
83
  //#endregion
84
84
  export { JSDoc as a, TextNode as c, Params as d, createFunctionParams as f, ElementNames as i, FunctionParams as l, DOMNode as n, Key as o, DOMNodeAttribute as r, KubbNode as s, DOMElement as t, Param as u };
85
- //# sourceMappingURL=types-Brnyan9B.d.ts.map
85
+ //# sourceMappingURL=types-u_NEi07i.d.ts.map
package/dist/types.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as JSDoc, c as TextNode, d as Params, i as ElementNames, n as DOMNode, o as Key, r as DOMNodeAttribute, s as KubbNode, t as DOMElement, u as Param } from "./types-C3p0Ljxf.cjs";
1
+ import { a as JSDoc, c as TextNode, d as Params, i as ElementNames, n as DOMNode, o as Key, r as DOMNodeAttribute, s as KubbNode, t as DOMElement, u as Param } from "./types-DoYRYV1C.cjs";
2
2
  export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, JSDoc, Key, KubbNode, Param, Params, TextNode };
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as JSDoc, c as TextNode, d as Params, i as ElementNames, n as DOMNode, o as Key, r as DOMNodeAttribute, s as KubbNode, t as DOMElement, u as Param } from "./types-Brnyan9B.js";
1
+ import { a as JSDoc, c as TextNode, d as Params, i as ElementNames, n as DOMNode, o as Key, r as DOMNodeAttribute, s as KubbNode, t as DOMElement, u as Param } from "./types-u_NEi07i.js";
2
2
  export { DOMElement, DOMNode, DOMNodeAttribute, ElementNames, JSDoc, Key, KubbNode, Param, Params, TextNode };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/react-fabric",
3
- "version": "0.1.8",
3
+ "version": "0.2.1",
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",
@@ -37,6 +37,10 @@
37
37
  "import": "./dist/globals.js",
38
38
  "require": "./dist/globals.cjs"
39
39
  },
40
+ "./jsx-dev-runtime": {
41
+ "import": "./dist/jsx-dev-runtime.js",
42
+ "require": "./dist/jsx-dev-runtime.cjs"
43
+ },
40
44
  "./jsx-runtime": {
41
45
  "import": "./dist/jsx-runtime.js",
42
46
  "require": "./dist/jsx-runtime.cjs"
@@ -94,18 +98,18 @@
94
98
  "execa": "^9.6.0",
95
99
  "indent-string": "^5.0.0",
96
100
  "natural-orderby": "^5.0.0",
97
- "react": "^19.2.0",
98
- "react-devtools-inline": "^7.0.1",
101
+ "react-devtools-core": "6.1.2",
99
102
  "react-reconciler": "0.32.0",
100
103
  "signal-exit": "^4.1.0",
101
- "ws": "^8.18.3",
102
- "@kubb/fabric-core": "0.1.8"
104
+ "ws": "8.18.0",
105
+ "@kubb/fabric-core": "0.2.1"
103
106
  },
104
107
  "devDependencies": {
108
+ "react": "^19.2.0",
105
109
  "@types/react": "^19.2.2",
106
110
  "@types/react-reconciler": "0.32.0",
107
111
  "@types/ws": "^8.18.1",
108
- "tsdown": "^0.15.9",
112
+ "tsdown": "^0.15.10",
109
113
  "typescript": "^5.9.3"
110
114
  },
111
115
  "engines": {
@@ -117,12 +121,12 @@
117
121
  },
118
122
  "scripts": {
119
123
  "build": "tsdown",
124
+ "start": "tsdown --watch ./src",
120
125
  "clean": "npx rimraf ./dist",
121
126
  "lint": "bun biome lint .",
122
127
  "lint:fix": "bun biome lint --fix --unsafe .",
123
128
  "release": "pnpm publish --no-git-check",
124
129
  "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check -tag canary",
125
- "start": "tsdown --watch",
126
130
  "start:devtools": "npx react-devtools",
127
131
  "test": "vitest --passWithNoTests",
128
132
  "test:devtools": "node ./dist/runner.cjs",
package/src/Renderer.ts CHANGED
@@ -1,9 +1,10 @@
1
- import Reconciler from 'react-reconciler'
1
+ import Reconciler, { type ReactContext } from 'react-reconciler'
2
2
  import { DefaultEventPriority, NoEventPriority } from 'react-reconciler/constants'
3
3
 
4
4
  import { appendChildNode, createNode, createTextNode, insertBeforeNode, removeChildNode, setAttribute, setTextNodeValue } from './dom.ts'
5
5
  import type { KubbNode } from './types'
6
6
  import type { DOMElement, DOMNodeAttribute, ElementNames, TextNode } from './types.ts'
7
+ import { createContext } from 'react'
7
8
 
8
9
  declare module 'react-reconciler' {
9
10
  // @ts-expect-error custom override
@@ -119,7 +120,6 @@ export const Renderer = Reconciler({
119
120
  removeChildFromContainer(node: DOMElement, removeNode: TextNode) {
120
121
  removeChildNode(node, removeNode)
121
122
  },
122
- resetFormInstance() {},
123
123
  commitMount() {},
124
124
  commitUpdate(node: DOMElement, _payload, _type, _oldProps: Props, newProps: Props) {
125
125
  const { props } = newProps
@@ -140,36 +140,40 @@ export const Renderer = Reconciler({
140
140
  currentUpdatePriority = newPriority
141
141
  },
142
142
  getCurrentUpdatePriority: () => currentUpdatePriority,
143
- resolveUpdatePriority: () => currentUpdatePriority || DefaultEventPriority,
143
+ resolveUpdatePriority() {
144
+ if (currentUpdatePriority !== NoEventPriority) {
145
+ return currentUpdatePriority
146
+ }
147
+
148
+ return DefaultEventPriority
149
+ },
144
150
  maySuspendCommit() {
145
151
  return false
146
152
  },
147
- startSuspendingCommit() {},
148
- waitForCommitToBeReady() {
149
- return null
150
- },
151
- preloadInstance() {
152
- // Return true to indicate it's already loaded
153
- return true
154
- },
155
- suspendInstance() {},
153
+ // eslint-disable-next-line @typescript-eslint/naming-convention
154
+ NotPendingTransition: undefined,
155
+ // eslint-disable-next-line @typescript-eslint/naming-convention
156
+ HostTransitionContext: createContext(null) as unknown as ReactContext<unknown>,
157
+ resetFormInstance() {},
158
+ requestPostPaintCallback() {},
156
159
  shouldAttemptEagerTransition() {
157
160
  return false
158
161
  },
159
- NotPendingTransition: undefined,
160
- requestPostPaintCallback: function (_callback: (time: number) => void): void {
161
- throw new Error('Function not implemented.')
162
+ trackSchedulerEvent() {},
163
+ resolveEventType() {
164
+ return null
162
165
  },
163
- trackSchedulerEvent: function (): void {
164
- throw new Error('Function not implemented.')
166
+ resolveEventTimeStamp() {
167
+ return -1.1
165
168
  },
166
- resolveEventType: function (): null | string {
167
- throw new Error('Function not implemented.')
169
+ preloadInstance() {
170
+ return true
168
171
  },
169
- resolveEventTimeStamp: function (): number {
170
- throw new Error('Function not implemented.')
172
+ startSuspendingCommit() {},
173
+ suspendInstance() {},
174
+ waitForCommitToBeReady() {
175
+ return null
171
176
  },
172
- HostTransitionContext: undefined as any,
173
177
  })
174
178
 
175
179
  export type { FiberRoot } from 'react-reconciler'
package/src/Runtime.tsx CHANGED
@@ -46,20 +46,20 @@ export class Runtime {
46
46
  console.error = (data: string | Error) => {
47
47
  const message = typeof data === 'string' ? data : data?.message
48
48
 
49
- if (message.match(/Encountered two children with the same key/gi)) {
49
+ if (message?.match(/Encountered two children with the same key/gi)) {
50
50
  return
51
51
  }
52
- if (message.match(/React will try to recreat/gi)) {
52
+ if (message?.match(/React will try to recreat/gi)) {
53
53
  return
54
54
  }
55
- if (message.match(/Each child in a list should have a unique/gi)) {
55
+ if (message?.match(/Each child in a list should have a unique/gi)) {
56
56
  return
57
57
  }
58
- if (message.match(/The above error occurred in the <KubbErrorBoundary/gi)) {
58
+ if (message?.match(/The above error occurred in the <KubbErrorBoundary/gi)) {
59
59
  return
60
60
  }
61
61
 
62
- if (message.match(/A React Element from an older version of React was render/gi)) {
62
+ if (message?.match(/A React Element from an older version of React was render/gi)) {
63
63
  return
64
64
  }
65
65
 
@@ -108,8 +108,8 @@ export class Runtime {
108
108
  ).bind(this)
109
109
 
110
110
  Renderer.injectIntoDevTools({
111
- bundleType: 0, // 0 for PROD, 1 for DEV
112
- version: '19.1.1', // should be React version and not Kubb's custom version
111
+ bundleType: 1, // 0 for PROD, 1 for DEV
112
+ version: '19.1.0', // should be React version and not Kubb's custom version
113
113
  rendererPackageName: 'kubb', // package name
114
114
  })
115
115
  }
@@ -126,6 +126,7 @@ export class Runtime {
126
126
  return
127
127
  }
128
128
 
129
+ // TODO remove to allow multiple renders
129
130
  this.fileManager.clear()
130
131
 
131
132
  processFiles(this.#rootNode, this.fileManager)
@@ -0,0 +1,17 @@
1
+ import { createFabric } from '@kubb/fabric-core'
2
+ import { reactPlugin } from '@kubb/react-fabric/plugins'
3
+ import type { Options } from './plugins/reactPlugin.ts'
4
+ import type { FabricMode } from '@kubb/fabric-core/types'
5
+ import { open } from './devtools.ts'
6
+
7
+ export function createReactFabric(options?: Options & { mode?: FabricMode; devtools?: boolean }) {
8
+ const fabric = createFabric({ mode: options?.mode })
9
+
10
+ if (options?.devtools) {
11
+ open()
12
+ }
13
+
14
+ fabric.use(reactPlugin, options)
15
+
16
+ return fabric
17
+ }