@kubb/react-fabric 0.11.7 → 0.12.0

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 (64) hide show
  1. package/dist/globals.d.cts +3 -2
  2. package/dist/globals.d.ts +3 -2
  3. package/dist/index.cjs +10 -59
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +26 -86
  6. package/dist/index.d.ts +26 -86
  7. package/dist/index.js +11 -58
  8. package/dist/index.js.map +1 -1
  9. package/dist/jsx-dev-runtime.d.cts +4 -5
  10. package/dist/jsx-dev-runtime.d.ts +2 -3
  11. package/dist/{jsx-namespace-CDB8OdrC.d.cts → jsx-namespace-BUHfo3FK.d.cts} +3 -2
  12. package/dist/{jsx-namespace-rawlYj_g.d.ts → jsx-namespace-Lr0pS1AG.d.ts} +3 -1
  13. package/dist/jsx-runtime.d.cts +4 -5
  14. package/dist/jsx-runtime.d.ts +2 -3
  15. package/dist/parsers.d.cts +1 -1
  16. package/dist/parsers.d.ts +1 -1
  17. package/dist/plugins.cjs +1 -1
  18. package/dist/plugins.d.cts +32 -10
  19. package/dist/plugins.d.ts +32 -10
  20. package/dist/plugins.js +1 -1
  21. package/dist/{reactPlugin-lOa0xpGM.js → reactPlugin-BHxx8AjV.js} +32 -15
  22. package/dist/{reactPlugin-lOa0xpGM.js.map → reactPlugin-BHxx8AjV.js.map} +1 -1
  23. package/dist/reactPlugin-CWHmkuUz.d.cts +72 -0
  24. package/dist/{reactPlugin-BzGD_nR7.cjs → reactPlugin-CicgALtR.cjs} +31 -14
  25. package/dist/{reactPlugin-BzGD_nR7.cjs.map → reactPlugin-CicgALtR.cjs.map} +1 -1
  26. package/dist/reactPlugin-DseDoGSU.d.ts +73 -0
  27. package/dist/{Fabric-4Ac6xwwR.d.ts → types-C-nm6Bqx.d.ts} +197 -20
  28. package/dist/{Fabric-xd8epqSF.d.cts → types-yKh-a1UP.d.cts} +199 -20
  29. package/dist/types.d.cts +2 -3
  30. package/dist/types.d.ts +2 -3
  31. package/package.json +2 -4
  32. package/src/Runtime.tsx +6 -10
  33. package/src/components/App.tsx +3 -3
  34. package/src/components/Const.tsx +2 -2
  35. package/src/components/File.tsx +5 -5
  36. package/src/components/Function.tsx +12 -5
  37. package/src/components/Root.tsx +2 -2
  38. package/src/components/Type.tsx +2 -2
  39. package/src/components/__snapshots__/{arrow_function_generics.ts → exported_async_arrow_function_with_generics.ts} +1 -1
  40. package/src/components/__snapshots__/{multiple_functions.ts → exported_async_function_with_generics.ts} +1 -1
  41. package/src/createReactFabric.ts +1 -2
  42. package/src/devtools.ts +3 -0
  43. package/src/dom.ts +12 -1
  44. package/src/globals.ts +2 -0
  45. package/src/index.ts +1 -2
  46. package/src/jsx-namespace.d.ts +2 -0
  47. package/src/plugins/reactPlugin.ts +9 -7
  48. package/src/types.ts +1 -1
  49. package/src/utils/squashExportNodes.ts +2 -2
  50. package/src/utils/squashTextNodes.ts +23 -8
  51. package/dist/TreeNode-CoigrXFC.d.ts +0 -35
  52. package/dist/TreeNode-Pwm74f2F.d.cts +0 -34
  53. package/dist/reactPlugin-6pWd-WfZ.d.cts +0 -30
  54. package/dist/reactPlugin-CpMrftCn.d.ts +0 -31
  55. package/dist/types-125Qu-Uh.d.ts +0 -129
  56. package/dist/types-BrE57KWH.d.cts +0 -128
  57. package/src/components/Indent.tsx +0 -56
  58. package/src/components/__snapshots__/arrow_function.ts +0 -3
  59. package/src/components/__snapshots__/arrow_function_default.ts +0 -3
  60. package/src/components/__snapshots__/arrow_function_single_line.ts +0 -1
  61. package/src/components/__snapshots__/function_generics.ts +0 -3
  62. package/src/components/__snapshots__/function_with_comments.ts +0 -6
  63. package/src/components/__snapshots__/function_with_params.ts +0 -3
  64. package/src/components/__snapshots__/function_with_returnType.ts +0 -3
@@ -1,129 +0,0 @@
1
- import { r as __name } from "./chunk-DkQCb-7t.js";
2
- import { b as Source, c as FileManager, g as Import, h as File, p as Export } from "./Fabric-4Ac6xwwR.js";
3
- import { t as TreeNode } from "./TreeNode-CoigrXFC.js";
4
- import React, { JSX, Key, ReactNode } from "react";
5
-
6
- //#region ../fabric-core/src/composables/useNodeTree.d.ts
7
- type ComponentNode = {
8
- type: string;
9
- props: Record<string, unknown>;
10
- };
11
- //#endregion
12
- //#region ../fabric-core/src/contexts/RootContext.d.ts
13
- type RootContextProps = {
14
- /**
15
- * Exit (unmount) the whole app.
16
- */
17
- exit: (error?: Error) => void;
18
- /**
19
- * TreeNode representing the tree structure of the app.
20
- */
21
- treeNode: TreeNode<ComponentNode>;
22
- /**
23
- * FileManager instance for managing files within the app.
24
- */
25
- fileManager: FileManager;
26
- };
27
- //#endregion
28
- //#region ../fabric-core/src/types.d.ts
29
- type JSDoc = {
30
- comments: string[];
31
- };
32
- //#endregion
33
- //#region src/utils/getFunctionParams.d.ts
34
- type Param = {
35
- /**
36
- * `object` will return the pathParams as an object.
37
- *
38
- * `inline` will return the pathParams as comma separated params.
39
- * @default `'inline'`
40
- * @private
41
- */
42
- mode?: 'object' | 'inline' | 'inlineSpread';
43
- type?: 'string' | 'number' | (string & {});
44
- optional?: boolean;
45
- /**
46
- * @example test = "default"
47
- */
48
- default?: string;
49
- /**
50
- * Used for no TypeScript(with mode object)
51
- * @example test: "default"
52
- */
53
- value?: string;
54
- children?: Params;
55
- };
56
- type Params = Record<string, Param | undefined>;
57
- type Options = {
58
- type: 'constructor' | 'call' | 'object' | 'objectValue';
59
- transformName?: (name: string) => string;
60
- transformType?: (type: string) => string;
61
- };
62
- declare function createFunctionParams(params: Params): Params;
63
- declare class FunctionParams {
64
- #private;
65
- static factory(params: Params): FunctionParams;
66
- constructor(params: Params);
67
- get params(): Params;
68
- get flatParams(): Params;
69
- toCall({
70
- transformName,
71
- transformType
72
- }?: Pick<Options, 'transformName' | 'transformType'>): string;
73
- toObject(): string;
74
- toObjectValue(): string;
75
- toConstructor(): string;
76
- }
77
- //#endregion
78
- //#region src/types.d.ts
79
- type ReactElementNames = 'br' | 'div';
80
- type ElementNames = ReactElementNames | 'kubb-text' | 'kubb-file' | 'kubb-source' | 'kubb-import' | 'kubb-export' | 'kubb-root' | 'kubb-app';
81
- type Node = {
82
- parentNode: DOMElement | undefined;
83
- internal_static?: boolean;
84
- };
85
- type DOMNodeAttribute = boolean | string | number;
86
- type TextName = '#text';
87
- type TextNode = {
88
- nodeName: TextName;
89
- nodeValue: string;
90
- } & Node;
91
- type DOMNode<T = {
92
- nodeName: NodeNames;
93
- }> = T extends {
94
- nodeName: infer U;
95
- } ? U extends '#text' ? TextNode : DOMElement : never;
96
- type OutputTransformer = (s: string, index: number) => string;
97
- type DOMElement = {
98
- nodeName: ElementNames;
99
- attributes: Map<string, DOMNodeAttribute>;
100
- childNodes: DOMNode[];
101
- internal_transform?: OutputTransformer;
102
- isStaticDirty?: boolean;
103
- staticNode?: DOMElement;
104
- onComputeLayout?: () => void;
105
- onRender?: () => void;
106
- onImmediateRender?: () => void;
107
- } & Node;
108
- type NodeNames = ElementNames | TextName;
109
- type KubbNode = ReactNode;
110
- type KubbElement = JSX.Element;
111
- type KubbTextProps = {
112
- children?: KubbNode;
113
- };
114
- type KubbFileProps = {
115
- id?: string;
116
- children?: KubbNode;
117
- baseName: string;
118
- path: string;
119
- override?: boolean;
120
- meta?: File['meta'];
121
- };
122
- type KubbSourceProps = Source & {
123
- children?: KubbNode;
124
- };
125
- type KubbImportProps = Import;
126
- type KubbExportProps = Export;
127
- type LineBreakProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
128
- //#endregion
129
- export { Params as _, Key as a, RootContextProps as b, KubbFileProps as c, KubbSourceProps as d, KubbTextProps as f, Param as g, FunctionParams as h, ElementNames as i, KubbImportProps as l, TextNode as m, DOMNode as n, KubbElement as o, LineBreakProps as p, DOMNodeAttribute as r, KubbExportProps as s, DOMElement as t, KubbNode as u, createFunctionParams as v, ComponentNode as x, JSDoc as y };
@@ -1,128 +0,0 @@
1
- import { b as Source, c as FileManager, g as Import, h as File, p as Export, x as __name } from "./Fabric-xd8epqSF.cjs";
2
- import { t as TreeNode } from "./TreeNode-Pwm74f2F.cjs";
3
- import React, { JSX, Key, ReactNode } from "react";
4
-
5
- //#region ../fabric-core/src/composables/useNodeTree.d.ts
6
- type ComponentNode = {
7
- type: string;
8
- props: Record<string, unknown>;
9
- };
10
- //#endregion
11
- //#region ../fabric-core/src/contexts/RootContext.d.ts
12
- type RootContextProps = {
13
- /**
14
- * Exit (unmount) the whole app.
15
- */
16
- exit: (error?: Error) => void;
17
- /**
18
- * TreeNode representing the tree structure of the app.
19
- */
20
- treeNode: TreeNode<ComponentNode>;
21
- /**
22
- * FileManager instance for managing files within the app.
23
- */
24
- fileManager: FileManager;
25
- };
26
- //#endregion
27
- //#region ../fabric-core/src/types.d.ts
28
- type JSDoc = {
29
- comments: string[];
30
- };
31
- //#endregion
32
- //#region src/utils/getFunctionParams.d.ts
33
- type Param = {
34
- /**
35
- * `object` will return the pathParams as an object.
36
- *
37
- * `inline` will return the pathParams as comma separated params.
38
- * @default `'inline'`
39
- * @private
40
- */
41
- mode?: 'object' | 'inline' | 'inlineSpread';
42
- type?: 'string' | 'number' | (string & {});
43
- optional?: boolean;
44
- /**
45
- * @example test = "default"
46
- */
47
- default?: string;
48
- /**
49
- * Used for no TypeScript(with mode object)
50
- * @example test: "default"
51
- */
52
- value?: string;
53
- children?: Params;
54
- };
55
- type Params = Record<string, Param | undefined>;
56
- type Options = {
57
- type: 'constructor' | 'call' | 'object' | 'objectValue';
58
- transformName?: (name: string) => string;
59
- transformType?: (type: string) => string;
60
- };
61
- declare function createFunctionParams(params: Params): Params;
62
- declare class FunctionParams {
63
- #private;
64
- static factory(params: Params): FunctionParams;
65
- constructor(params: Params);
66
- get params(): Params;
67
- get flatParams(): Params;
68
- toCall({
69
- transformName,
70
- transformType
71
- }?: Pick<Options, 'transformName' | 'transformType'>): string;
72
- toObject(): string;
73
- toObjectValue(): string;
74
- toConstructor(): string;
75
- }
76
- //#endregion
77
- //#region src/types.d.ts
78
- type ReactElementNames = 'br' | 'div';
79
- type ElementNames = ReactElementNames | 'kubb-text' | 'kubb-file' | 'kubb-source' | 'kubb-import' | 'kubb-export' | 'kubb-root' | 'kubb-app';
80
- type Node = {
81
- parentNode: DOMElement | undefined;
82
- internal_static?: boolean;
83
- };
84
- type DOMNodeAttribute = boolean | string | number;
85
- type TextName = '#text';
86
- type TextNode = {
87
- nodeName: TextName;
88
- nodeValue: string;
89
- } & Node;
90
- type DOMNode<T = {
91
- nodeName: NodeNames;
92
- }> = T extends {
93
- nodeName: infer U;
94
- } ? U extends '#text' ? TextNode : DOMElement : never;
95
- type OutputTransformer = (s: string, index: number) => string;
96
- type DOMElement = {
97
- nodeName: ElementNames;
98
- attributes: Map<string, DOMNodeAttribute>;
99
- childNodes: DOMNode[];
100
- internal_transform?: OutputTransformer;
101
- isStaticDirty?: boolean;
102
- staticNode?: DOMElement;
103
- onComputeLayout?: () => void;
104
- onRender?: () => void;
105
- onImmediateRender?: () => void;
106
- } & Node;
107
- type NodeNames = ElementNames | TextName;
108
- type KubbNode = ReactNode;
109
- type KubbElement = JSX.Element;
110
- type KubbTextProps = {
111
- children?: KubbNode;
112
- };
113
- type KubbFileProps = {
114
- id?: string;
115
- children?: KubbNode;
116
- baseName: string;
117
- path: string;
118
- override?: boolean;
119
- meta?: File['meta'];
120
- };
121
- type KubbSourceProps = Source & {
122
- children?: KubbNode;
123
- };
124
- type KubbImportProps = Import;
125
- type KubbExportProps = Export;
126
- type LineBreakProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
127
- //#endregion
128
- export { Params as _, Key as a, RootContextProps as b, KubbFileProps as c, KubbSourceProps as d, KubbTextProps as f, Param as g, FunctionParams as h, ElementNames as i, KubbImportProps as l, TextNode as m, DOMNode as n, KubbElement as o, LineBreakProps as p, DOMNodeAttribute as r, KubbExportProps as s, DOMElement as t, KubbNode as u, createFunctionParams as v, ComponentNode as x, JSDoc as y };
@@ -1,56 +0,0 @@
1
- import dedent from 'dedent'
2
- import indentString from 'indent-string'
3
- import React from 'react'
4
-
5
- type IndentProps = {
6
- size?: number
7
- children?: React.ReactNode
8
- }
9
-
10
- /**
11
- * Indents all children by `size` spaces.
12
- * Collapses consecutive <br /> tags to at most 2.
13
- *
14
- * Indent will dedent and re-indent string children and will prefix
15
- * non-string children with the requested number of spaces.
16
- */
17
- export function Indent({ size = 2, children }: IndentProps) {
18
- if (!children) return null
19
-
20
- const childrenArray = React.Children.toArray(children)
21
- const result: React.ReactNode[] = []
22
-
23
- let prevWasBr = false
24
- let brCount = 0
25
-
26
- for (const child of childrenArray) {
27
- if (React.isValidElement(child) && child.type === 'br') {
28
- if (!prevWasBr || brCount < 2) {
29
- result.push(child)
30
- brCount++
31
- }
32
- prevWasBr = true
33
- } else {
34
- prevWasBr = false
35
- brCount = 0
36
- result.push(child)
37
- }
38
- }
39
-
40
- return (
41
- <>
42
- {result.map((child) => {
43
- if (typeof child === 'string') {
44
- const cleaned = dedent(child)
45
- return <>{indentString(cleaned, size)}</>
46
- }
47
- return (
48
- <>
49
- {' '.repeat(size)}
50
- {child}
51
- </>
52
- )
53
- })}
54
- </>
55
- )
56
- }
@@ -1,3 +0,0 @@
1
- export const getData = async () => {
2
- return 2;
3
- }
@@ -1,3 +0,0 @@
1
- export default const getData = async () => {
2
- return 2;
3
- }
@@ -1 +0,0 @@
1
- export const getData = async <TData>(): Promise<number> => 2;
@@ -1,3 +0,0 @@
1
- export async function getData<TData>(): Promise<number> {
2
- return 2;
3
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * @deprecated
3
- */
4
- export async function getData() {
5
- return 2;
6
- }
@@ -1,3 +0,0 @@
1
- function myFunc(a: string, b: number) {
2
- return true;
3
- }
@@ -1,3 +0,0 @@
1
- function myFunc(): boolean {
2
- return true;
3
- }