@kubb/react-fabric 0.11.7 → 0.11.8

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 (47) hide show
  1. package/dist/{Fabric-4Ac6xwwR.d.ts → Fabric-7NilNj9Y.d.ts} +15 -6
  2. package/dist/{Fabric-xd8epqSF.d.cts → Fabric-aSfkC_Bb.d.cts} +15 -6
  3. package/dist/globals.d.cts +2 -2
  4. package/dist/globals.d.ts +2 -2
  5. package/dist/index.cjs +4 -3
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +28 -69
  8. package/dist/index.d.ts +28 -69
  9. package/dist/index.js +4 -3
  10. package/dist/index.js.map +1 -1
  11. package/dist/jsx-dev-runtime.d.cts +3 -3
  12. package/dist/jsx-dev-runtime.d.ts +5 -5
  13. package/dist/{jsx-namespace-rawlYj_g.d.ts → jsx-namespace-B2MQxQlg.d.ts} +1 -1
  14. package/dist/{jsx-namespace-CDB8OdrC.d.cts → jsx-namespace-CNNMqfai.d.cts} +2 -2
  15. package/dist/jsx-runtime.d.cts +3 -3
  16. package/dist/jsx-runtime.d.ts +5 -5
  17. package/dist/parsers.d.cts +1 -1
  18. package/dist/parsers.d.ts +1 -1
  19. package/dist/plugins.cjs +1 -1
  20. package/dist/plugins.d.cts +33 -10
  21. package/dist/plugins.d.ts +33 -10
  22. package/dist/plugins.js +1 -1
  23. package/dist/reactPlugin-Bm7-ZloC.d.ts +74 -0
  24. package/dist/{reactPlugin-lOa0xpGM.js → reactPlugin-Cj595SPI.js} +4 -5
  25. package/dist/{reactPlugin-lOa0xpGM.js.map → reactPlugin-Cj595SPI.js.map} +1 -1
  26. package/dist/reactPlugin-Dc0Hm6qb.d.cts +73 -0
  27. package/dist/{reactPlugin-BzGD_nR7.cjs → reactPlugin-Dhi6zkpn.cjs} +4 -5
  28. package/dist/{reactPlugin-BzGD_nR7.cjs.map → reactPlugin-Dhi6zkpn.cjs.map} +1 -1
  29. package/dist/{types-125Qu-Uh.d.ts → types-DNU0IVoW.d.ts} +33 -3
  30. package/dist/{types-BrE57KWH.d.cts → types-DmtVGJ2r.d.cts} +33 -3
  31. package/dist/types.d.cts +2 -2
  32. package/dist/types.d.ts +2 -2
  33. package/package.json +2 -2
  34. package/src/Runtime.tsx +6 -10
  35. package/src/components/App.tsx +3 -3
  36. package/src/components/Const.tsx +2 -2
  37. package/src/components/File.tsx +5 -5
  38. package/src/components/Function.tsx +2 -2
  39. package/src/components/Indent.tsx +5 -2
  40. package/src/components/Root.tsx +2 -2
  41. package/src/components/Type.tsx +2 -2
  42. package/src/devtools.ts +3 -0
  43. package/src/plugins/reactPlugin.ts +9 -7
  44. package/dist/TreeNode-CoigrXFC.d.ts +0 -35
  45. package/dist/TreeNode-Pwm74f2F.d.cts +0 -34
  46. package/dist/reactPlugin-6pWd-WfZ.d.cts +0 -30
  47. package/dist/reactPlugin-CpMrftCn.d.ts +0 -31
@@ -0,0 +1,73 @@
1
+ import { S as __name, b as ResolvedFile, g as File, n as FabricConfig, o as FabricOptions, s as Plugin, t as Fabric } from "./Fabric-aSfkC_Bb.cjs";
2
+ import { S as TreeNode, o as KubbElement, x as ComponentNode } from "./types-DmtVGJ2r.cjs";
3
+
4
+ //#region ../fabric-core/src/contexts/AppContext.d.ts
5
+ type AppContextProps<TMeta extends object = object> = {
6
+ /**
7
+ * Exit (unmount)
8
+ */
9
+ exit: (error?: Error) => void;
10
+ meta: TMeta;
11
+ };
12
+ //#endregion
13
+ //#region ../fabric-core/src/composables/useApp.d.ts
14
+ /**
15
+ * `useApp` will return the current App with meta and exit function.
16
+ *
17
+ * Throws an error when there is no AppContext available.
18
+ */
19
+ declare function useApp<TMeta extends object = object>(): AppContextProps<TMeta>;
20
+ //#endregion
21
+ //#region ../fabric-core/src/composables/useFile.d.ts
22
+ /**
23
+ * `useFile` will return the current FileCollector for registering files.
24
+ *
25
+ * Throws when no FileCollector is present in context — ensure a Fabric that
26
+ * provides a FileCollector is mounted before calling this hook.
27
+ */
28
+ declare function useFile(): ResolvedFile | null;
29
+ //#endregion
30
+ //#region ../fabric-core/src/createFabric.d.ts
31
+ /**
32
+ * Creates a new Fabric instance
33
+ *
34
+ * @example
35
+ * const fabric = createFabric()
36
+ * fabric.use(myPlugin())
37
+ */
38
+ declare function createFabric<T extends FabricOptions>(config?: FabricConfig<T>): Fabric<T>;
39
+ //#endregion
40
+ //#region ../fabric-core/src/createFile.d.ts
41
+ /**
42
+ * Helper to create a file with name and id set
43
+ */
44
+ declare function createFile<TMeta extends object = object>(file: File<TMeta>): ResolvedFile<TMeta>;
45
+ //#endregion
46
+ //#region src/plugins/reactPlugin.d.ts
47
+ type Options = {
48
+ stdout?: NodeJS.WriteStream;
49
+ stdin?: NodeJS.ReadStream;
50
+ stderr?: NodeJS.WriteStream;
51
+ treeNode?: TreeNode<ComponentNode>;
52
+ /**
53
+ * Set this to true to always see the result of the render in the console(line per render)
54
+ */
55
+ debug?: boolean;
56
+ };
57
+ type ExtendOptions = {
58
+ render(App: KubbElement): Promise<void>;
59
+ renderToString(App: KubbElement): Promise<string>;
60
+ waitUntilExit(): Promise<void>;
61
+ };
62
+ declare global {
63
+ namespace Kubb {
64
+ interface Fabric {
65
+ render(App: KubbElement): Promise<void>;
66
+ renderToString(App: KubbElement): Promise<string>;
67
+ waitUntilExit(): Promise<void>;
68
+ }
69
+ }
70
+ }
71
+ declare const reactPlugin: Plugin<Options, ExtendOptions>;
72
+ //#endregion
73
+ export { useFile as a, createFabric as i, reactPlugin as n, useApp as o, createFile as r, Options as t };
@@ -17791,14 +17791,13 @@ var Runtime = class {
17791
17791
  return _classPrivateFieldGet2(_options, this).fileManager;
17792
17792
  }
17793
17793
  onError(error) {
17794
- if (node_process.default.env.NODE_ENV === "test") console.warn(error);
17795
17794
  _classPrivateFieldSet2(_renderError, this, error);
17796
17795
  }
17797
17796
  onExit(error) {
17798
17797
  this.unmount(error);
17799
17798
  }
17800
17799
  async render(node) {
17801
- const treeNode = new _kubb_fabric_core.TreeNode({
17800
+ const treeNode = _classPrivateFieldGet2(_options, this).treeNode || new _kubb_fabric_core.TreeNode({
17802
17801
  type: "Root",
17803
17802
  props: {}
17804
17803
  });
@@ -17823,7 +17822,7 @@ var Runtime = class {
17823
17822
  }
17824
17823
  }
17825
17824
  async renderToString(node) {
17826
- const treeNode = new _kubb_fabric_core.TreeNode({
17825
+ const treeNode = _classPrivateFieldGet2(_options, this).treeNode || new _kubb_fabric_core.TreeNode({
17827
17826
  type: "Root",
17828
17827
  props: {}
17829
17828
  });
@@ -17893,11 +17892,11 @@ const reactPlugin = (0, _kubb_fabric_core_plugins.definePlugin)({
17893
17892
  return {
17894
17893
  async render(App) {
17895
17894
  await ctx.emit("lifecycle:start");
17896
- await runtime.render((0, import_react.createElement)(App));
17895
+ await runtime.render(App);
17897
17896
  },
17898
17897
  async renderToString(App) {
17899
17898
  await ctx.emit("lifecycle:start");
17900
- return runtime.renderToString((0, import_react.createElement)(App));
17899
+ return runtime.renderToString(App);
17901
17900
  },
17902
17901
  async waitUntilExit() {
17903
17902
  await runtime.waitUntilExit();