@kubb/react-fabric 0.11.8 → 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 (52) hide show
  1. package/dist/globals.d.cts +3 -2
  2. package/dist/globals.d.ts +3 -2
  3. package/dist/index.cjs +8 -58
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.cts +3 -22
  6. package/dist/index.d.ts +3 -22
  7. package/dist/index.js +9 -57
  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 +4 -5
  11. package/dist/{jsx-namespace-CNNMqfai.d.cts → jsx-namespace-BUHfo3FK.d.cts} +3 -2
  12. package/dist/{jsx-namespace-B2MQxQlg.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 +4 -5
  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 +2 -3
  19. package/dist/plugins.d.ts +2 -3
  20. package/dist/plugins.js +1 -1
  21. package/dist/{reactPlugin-Cj595SPI.js → reactPlugin-BHxx8AjV.js} +28 -10
  22. package/dist/{reactPlugin-Cj595SPI.js.map → reactPlugin-BHxx8AjV.js.map} +1 -1
  23. package/dist/{reactPlugin-Dc0Hm6qb.d.cts → reactPlugin-CWHmkuUz.d.cts} +1 -2
  24. package/dist/{reactPlugin-Dhi6zkpn.cjs → reactPlugin-CicgALtR.cjs} +27 -9
  25. package/dist/{reactPlugin-Dhi6zkpn.cjs.map → reactPlugin-CicgALtR.cjs.map} +1 -1
  26. package/dist/{reactPlugin-Bm7-ZloC.d.ts → reactPlugin-DseDoGSU.d.ts} +1 -2
  27. package/dist/{Fabric-7NilNj9Y.d.ts → types-C-nm6Bqx.d.ts} +194 -26
  28. package/dist/{Fabric-aSfkC_Bb.d.cts → types-yKh-a1UP.d.cts} +196 -26
  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/components/Function.tsx +10 -3
  33. package/src/components/__snapshots__/{arrow_function_generics.ts → exported_async_arrow_function_with_generics.ts} +1 -1
  34. package/src/components/__snapshots__/{multiple_functions.ts → exported_async_function_with_generics.ts} +1 -1
  35. package/src/createReactFabric.ts +1 -2
  36. package/src/dom.ts +12 -1
  37. package/src/globals.ts +2 -0
  38. package/src/index.ts +1 -2
  39. package/src/jsx-namespace.d.ts +2 -0
  40. package/src/types.ts +1 -1
  41. package/src/utils/squashExportNodes.ts +2 -2
  42. package/src/utils/squashTextNodes.ts +23 -8
  43. package/dist/types-DNU0IVoW.d.ts +0 -159
  44. package/dist/types-DmtVGJ2r.d.cts +0 -158
  45. package/src/components/Indent.tsx +0 -59
  46. package/src/components/__snapshots__/arrow_function.ts +0 -3
  47. package/src/components/__snapshots__/arrow_function_default.ts +0 -3
  48. package/src/components/__snapshots__/arrow_function_single_line.ts +0 -1
  49. package/src/components/__snapshots__/function_generics.ts +0 -3
  50. package/src/components/__snapshots__/function_with_comments.ts +0 -6
  51. package/src/components/__snapshots__/function_with_params.ts +0 -3
  52. package/src/components/__snapshots__/function_with_returnType.ts +0 -3
@@ -1,7 +1,6 @@
1
1
  import { NodeTreeContext, provide, useNodeTree } from '@kubb/fabric-core'
2
2
  import type { JSDoc, Key, KubbElement, KubbNode } from '../types.ts'
3
3
  import { createJSDoc } from '../utils/createJSDoc.ts'
4
- import { Indent } from './Indent.tsx'
5
4
 
6
5
  type Props = {
7
6
  key?: Key
@@ -87,8 +86,12 @@ export function Function({ children, ...props }: Props): KubbElement {
87
86
  )}
88
87
  {' {'}
89
88
  <br />
90
- <Indent size={2}>{children}</Indent>
89
+ <indent />
90
+ {/* Indent component to handle indentation*/}
91
+ {children}
91
92
  <br />
93
+ <dedent />
94
+ {/* Indent component to handle indentation*/}
92
95
  {'}'}
93
96
  </>
94
97
  )
@@ -156,8 +159,12 @@ function ArrowFunction({ children, ...props }: ArrowFunctionProps) {
156
159
  <>
157
160
  {' => {'}
158
161
  <br />
159
- <Indent size={2}>{children}</Indent>
162
+ <indent />
163
+ {/* Indent component to handle indentation*/}
164
+ {children}
160
165
  <br />
166
+ <dedent />
167
+ {/* Indent component to handle indentation*/}
161
168
  {'}'}
162
169
  <br />
163
170
  </>
@@ -1,3 +1,3 @@
1
1
  export const getData = async <TData>(): Promise<number> => {
2
- return 2;
2
+ return 2
3
3
  }
@@ -1,3 +1,3 @@
1
1
  export async function getData<TData>(): Promise<number> {
2
- 2;
2
+ return 2
3
3
  }
@@ -1,6 +1,5 @@
1
- import type { Fabric } from '@kubb/fabric-core'
2
1
  import { createFabric } from '@kubb/fabric-core'
3
- import type { FabricConfig, FabricMode } from '@kubb/fabric-core/types'
2
+ import type { Fabric, FabricConfig, FabricMode } from '@kubb/fabric-core/types'
4
3
  import { openDevtools } from './devtools.ts'
5
4
  import type { Options } from './plugins/reactPlugin.ts'
6
5
  import { reactPlugin } from './plugins/reactPlugin.ts'
package/src/dom.ts CHANGED
@@ -72,4 +72,15 @@ export const setTextNodeValue = (node: TextNode, text: string): void => {
72
72
  node.nodeValue = text
73
73
  }
74
74
 
75
- export const nodeNames = new Set<ElementNames>(['kubb-export', 'kubb-file', 'kubb-source', 'kubb-import', 'kubb-text', 'kubb-root', 'kubb-app', 'br'])
75
+ export const nodeNames = new Set<ElementNames>([
76
+ 'kubb-export',
77
+ 'kubb-file',
78
+ 'kubb-source',
79
+ 'kubb-import',
80
+ 'kubb-text',
81
+ 'kubb-root',
82
+ 'kubb-app',
83
+ 'br',
84
+ 'indent',
85
+ 'dedent',
86
+ ])
package/src/globals.ts CHANGED
@@ -16,6 +16,8 @@ declare global {
16
16
  'kubb-import': KubbImportProps
17
17
  'kubb-export': KubbExportProps
18
18
  br: LineBreakProps
19
+ indent: {}
20
+ dedent: {}
19
21
  }
20
22
  }
21
23
  }
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import * as React from 'react'
3
3
 
4
4
  // expose fabric core helpers
5
- export { createFabric, createFile, type Fabric, FileManager, FileProcessor } from '@kubb/fabric-core'
5
+ export { createFabric, createFile, FileManager, FileProcessor } from '@kubb/fabric-core'
6
6
 
7
7
  // react helpers
8
8
  export const useState = React.useState
@@ -19,7 +19,6 @@ export { App } from './components/App.tsx'
19
19
  export { Const } from './components/Const.tsx'
20
20
  export { File } from './components/File.tsx'
21
21
  export { Function } from './components/Function.tsx'
22
- export { Indent } from './components/Indent.tsx'
23
22
  export { Type } from './components/Type.tsx'
24
23
 
25
24
  // composables
@@ -24,6 +24,8 @@ export namespace JSX {
24
24
  'kubb-import': KubbImportProps
25
25
  'kubb-export': KubbExportProps
26
26
  br: LineBreakProps
27
+ indent: {}
28
+ dedent: {}
27
29
  }
28
30
  type LibraryManagedAttributes<C, P> = React.JSX.LibraryManagedAttributes<C, P>
29
31
  interface IntrinsicClassAttributes<T> extends React.JSX.IntrinsicClassAttributes<T> {}
package/src/types.ts CHANGED
@@ -2,7 +2,7 @@ import type { KubbFile } from '@kubb/fabric-core/types'
2
2
  import type React from 'react'
3
3
  import type { JSX, ReactNode } from 'react'
4
4
 
5
- type ReactElementNames = 'br' | 'div'
5
+ type ReactElementNames = 'br' | 'div' | 'indent' | 'dedent'
6
6
 
7
7
  export type ElementNames = ReactElementNames | 'kubb-text' | 'kubb-file' | 'kubb-source' | 'kubb-import' | 'kubb-export' | 'kubb-root' | 'kubb-app'
8
8
 
@@ -3,8 +3,8 @@ import type { KubbFile } from '@kubb/fabric-core/types'
3
3
  import { nodeNames } from '../dom.ts'
4
4
  import type { DOMElement } from '../types.ts'
5
5
 
6
- export function squashExportNodes(node: DOMElement): Set<KubbFile.ResolvedExport> {
7
- const exports = new Set<KubbFile.ResolvedExport>()
6
+ export function squashExportNodes(node: DOMElement): Set<KubbFile.Export> {
7
+ const exports = new Set<KubbFile.Export>()
8
8
 
9
9
  const walk = (current: DOMElement): void => {
10
10
  for (const child of current.childNodes) {
@@ -1,12 +1,16 @@
1
+ import { renderIndent } from '@kubb/fabric-core'
1
2
  import { createExport, createImport, print } from '@kubb/fabric-core/parsers/typescript'
2
-
3
+ import type { RenderContextProps } from '@kubb/fabric-core/types'
3
4
  import { nodeNames } from '../dom.ts'
4
5
  import type { DOMElement, KubbFile } from '../types.ts'
5
6
 
6
- export function squashTextNodes(node: DOMElement): string {
7
+ export function squashTextNodes(
8
+ node: DOMElement,
9
+ renderContext: RenderContextProps = { indentLevel: 0, indentSize: 2, currentLineLength: 0, shouldBreak: false },
10
+ ): string {
7
11
  let text = ''
8
12
 
9
- const walk = (current: DOMElement): string => {
13
+ const walk = (current: DOMElement, context: RenderContextProps): string => {
10
14
  let content = ''
11
15
 
12
16
  for (const child of current.childNodes) {
@@ -50,16 +54,27 @@ export function squashTextNodes(node: DOMElement): string {
50
54
  }
51
55
 
52
56
  if (child.nodeName === '#text') {
53
- nodeText = child.nodeValue
57
+ nodeText = renderIndent(child.nodeValue, context)
54
58
  } else {
55
59
  if (child.nodeName === 'kubb-text' || child.nodeName === 'kubb-file' || child.nodeName === 'kubb-source') {
56
- nodeText = walk(child)
60
+ nodeText = walk(child, context)
57
61
  }
58
62
 
59
63
  nodeText = getPrintText(nodeText)
60
64
 
61
65
  if (child.nodeName === 'br') {
62
66
  nodeText = '\n'
67
+ context.currentLineLength = 0
68
+ }
69
+
70
+ if (child.nodeName === 'indent') {
71
+ context.indentLevel++
72
+ nodeText = ''
73
+ }
74
+
75
+ if (child.nodeName === 'dedent') {
76
+ context.indentLevel = Math.max(0, context.indentLevel - 1)
77
+ nodeText = ''
63
78
  }
64
79
 
65
80
  if (!nodeNames.has(child.nodeName)) {
@@ -72,9 +87,9 @@ export function squashTextNodes(node: DOMElement): string {
72
87
  }
73
88
 
74
89
  if (hasAttributes) {
75
- nodeText = `<${child.nodeName}${attrString}>${walk(child)}</${child.nodeName}>`
90
+ nodeText = `<${child.nodeName}${attrString}>${walk(child, context)}</${child.nodeName}>`
76
91
  } else {
77
- nodeText = `<${child.nodeName}>${walk(child)}</${child.nodeName}>`
92
+ nodeText = `<${child.nodeName}>${walk(child, context)}</${child.nodeName}>`
78
93
  }
79
94
  }
80
95
  }
@@ -85,7 +100,7 @@ export function squashTextNodes(node: DOMElement): string {
85
100
  return content
86
101
  }
87
102
 
88
- text = walk(node)
103
+ text = walk(node, renderContext)
89
104
 
90
105
  return text
91
106
  }
@@ -1,159 +0,0 @@
1
- import { r as __name } from "./chunk-DkQCb-7t.js";
2
- import { _ as Import, g as File, l as FileManager, m as Export, x as Source } from "./Fabric-7NilNj9Y.js";
3
- import React, { JSX, Key, ReactNode } from "react";
4
-
5
- //#region ../fabric-core/src/utils/TreeNode.d.ts
6
- type BarrelData = {
7
- file?: File;
8
- path: string;
9
- name: string;
10
- };
11
- type Graph = {
12
- nodes: Array<{
13
- id: string;
14
- label: string;
15
- }>;
16
- edges: Array<{
17
- from: string;
18
- to: string;
19
- }>;
20
- };
21
- declare class TreeNode<TData = unknown> {
22
- #private;
23
- data: TData;
24
- parent?: TreeNode<TData>;
25
- children: Array<TreeNode<TData>>;
26
- constructor(data: TData, parent?: TreeNode<TData>);
27
- addChild(data: TData): TreeNode<TData>;
28
- getChildByName(name: string): TreeNode<TData> | undefined;
29
- get leaves(): Array<TreeNode<TData>>;
30
- forEach(callback: (node: TreeNode<TData>) => void): this;
31
- findDeep(predicate: (node: TreeNode<TData>) => boolean): TreeNode<TData> | undefined;
32
- static toGraph(root: TreeNode<BarrelData>): Graph;
33
- static fromFiles(files: Array<File>, rootFolder?: string): TreeNode<BarrelData> | null;
34
- }
35
- //#endregion
36
- //#region ../fabric-core/src/composables/useNodeTree.d.ts
37
- type ComponentNode = {
38
- type: string;
39
- props: Record<string, unknown>;
40
- };
41
- //#endregion
42
- //#region ../fabric-core/src/contexts/RootContext.d.ts
43
- type RootContextProps = {
44
- /**
45
- * Exit (unmount) the whole app.
46
- */
47
- exit: (error?: Error) => void;
48
- /**
49
- * TreeNode representing the tree structure of the app.
50
- */
51
- treeNode: TreeNode<ComponentNode>;
52
- /**
53
- * FileManager instance for managing files within the app.
54
- */
55
- fileManager: FileManager;
56
- };
57
- //#endregion
58
- //#region ../fabric-core/src/types.d.ts
59
- type JSDoc = {
60
- comments: string[];
61
- };
62
- //#endregion
63
- //#region src/utils/getFunctionParams.d.ts
64
- type Param = {
65
- /**
66
- * `object` will return the pathParams as an object.
67
- *
68
- * `inline` will return the pathParams as comma separated params.
69
- * @default `'inline'`
70
- * @private
71
- */
72
- mode?: 'object' | 'inline' | 'inlineSpread';
73
- type?: 'string' | 'number' | (string & {});
74
- optional?: boolean;
75
- /**
76
- * @example test = "default"
77
- */
78
- default?: string;
79
- /**
80
- * Used for no TypeScript(with mode object)
81
- * @example test: "default"
82
- */
83
- value?: string;
84
- children?: Params;
85
- };
86
- type Params = Record<string, Param | undefined>;
87
- type Options = {
88
- type: 'constructor' | 'call' | 'object' | 'objectValue';
89
- transformName?: (name: string) => string;
90
- transformType?: (type: string) => string;
91
- };
92
- declare function createFunctionParams(params: Params): Params;
93
- declare class FunctionParams {
94
- #private;
95
- static factory(params: Params): FunctionParams;
96
- constructor(params: Params);
97
- get params(): Params;
98
- get flatParams(): Params;
99
- toCall({
100
- transformName,
101
- transformType
102
- }?: Pick<Options, 'transformName' | 'transformType'>): string;
103
- toObject(): string;
104
- toObjectValue(): string;
105
- toConstructor(): string;
106
- }
107
- //#endregion
108
- //#region src/types.d.ts
109
- type ReactElementNames = 'br' | 'div';
110
- type ElementNames = ReactElementNames | 'kubb-text' | 'kubb-file' | 'kubb-source' | 'kubb-import' | 'kubb-export' | 'kubb-root' | 'kubb-app';
111
- type Node = {
112
- parentNode: DOMElement | undefined;
113
- internal_static?: boolean;
114
- };
115
- type DOMNodeAttribute = boolean | string | number;
116
- type TextName = '#text';
117
- type TextNode = {
118
- nodeName: TextName;
119
- nodeValue: string;
120
- } & Node;
121
- type DOMNode<T = {
122
- nodeName: NodeNames;
123
- }> = T extends {
124
- nodeName: infer U;
125
- } ? U extends '#text' ? TextNode : DOMElement : never;
126
- type OutputTransformer = (s: string, index: number) => string;
127
- type DOMElement = {
128
- nodeName: ElementNames;
129
- attributes: Map<string, DOMNodeAttribute>;
130
- childNodes: DOMNode[];
131
- internal_transform?: OutputTransformer;
132
- isStaticDirty?: boolean;
133
- staticNode?: DOMElement;
134
- onComputeLayout?: () => void;
135
- onRender?: () => void;
136
- onImmediateRender?: () => void;
137
- } & Node;
138
- type NodeNames = ElementNames | TextName;
139
- type KubbNode = ReactNode;
140
- type KubbElement = JSX.Element;
141
- type KubbTextProps = {
142
- children?: KubbNode;
143
- };
144
- type KubbFileProps = {
145
- id?: string;
146
- children?: KubbNode;
147
- baseName: string;
148
- path: string;
149
- override?: boolean;
150
- meta?: File['meta'];
151
- };
152
- type KubbSourceProps = Source & {
153
- children?: KubbNode;
154
- };
155
- type KubbImportProps = Import;
156
- type KubbExportProps = Export;
157
- type LineBreakProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
158
- //#endregion
159
- export { TreeNode as S, 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,158 +0,0 @@
1
- import { S as __name, _ as Import, g as File, l as FileManager, m as Export, x as Source } from "./Fabric-aSfkC_Bb.cjs";
2
- import React, { JSX, Key, ReactNode } from "react";
3
-
4
- //#region ../fabric-core/src/utils/TreeNode.d.ts
5
- type BarrelData = {
6
- file?: File;
7
- path: string;
8
- name: string;
9
- };
10
- type Graph = {
11
- nodes: Array<{
12
- id: string;
13
- label: string;
14
- }>;
15
- edges: Array<{
16
- from: string;
17
- to: string;
18
- }>;
19
- };
20
- declare class TreeNode<TData = unknown> {
21
- #private;
22
- data: TData;
23
- parent?: TreeNode<TData>;
24
- children: Array<TreeNode<TData>>;
25
- constructor(data: TData, parent?: TreeNode<TData>);
26
- addChild(data: TData): TreeNode<TData>;
27
- getChildByName(name: string): TreeNode<TData> | undefined;
28
- get leaves(): Array<TreeNode<TData>>;
29
- forEach(callback: (node: TreeNode<TData>) => void): this;
30
- findDeep(predicate: (node: TreeNode<TData>) => boolean): TreeNode<TData> | undefined;
31
- static toGraph(root: TreeNode<BarrelData>): Graph;
32
- static fromFiles(files: Array<File>, rootFolder?: string): TreeNode<BarrelData> | null;
33
- }
34
- //#endregion
35
- //#region ../fabric-core/src/composables/useNodeTree.d.ts
36
- type ComponentNode = {
37
- type: string;
38
- props: Record<string, unknown>;
39
- };
40
- //#endregion
41
- //#region ../fabric-core/src/contexts/RootContext.d.ts
42
- type RootContextProps = {
43
- /**
44
- * Exit (unmount) the whole app.
45
- */
46
- exit: (error?: Error) => void;
47
- /**
48
- * TreeNode representing the tree structure of the app.
49
- */
50
- treeNode: TreeNode<ComponentNode>;
51
- /**
52
- * FileManager instance for managing files within the app.
53
- */
54
- fileManager: FileManager;
55
- };
56
- //#endregion
57
- //#region ../fabric-core/src/types.d.ts
58
- type JSDoc = {
59
- comments: string[];
60
- };
61
- //#endregion
62
- //#region src/utils/getFunctionParams.d.ts
63
- type Param = {
64
- /**
65
- * `object` will return the pathParams as an object.
66
- *
67
- * `inline` will return the pathParams as comma separated params.
68
- * @default `'inline'`
69
- * @private
70
- */
71
- mode?: 'object' | 'inline' | 'inlineSpread';
72
- type?: 'string' | 'number' | (string & {});
73
- optional?: boolean;
74
- /**
75
- * @example test = "default"
76
- */
77
- default?: string;
78
- /**
79
- * Used for no TypeScript(with mode object)
80
- * @example test: "default"
81
- */
82
- value?: string;
83
- children?: Params;
84
- };
85
- type Params = Record<string, Param | undefined>;
86
- type Options = {
87
- type: 'constructor' | 'call' | 'object' | 'objectValue';
88
- transformName?: (name: string) => string;
89
- transformType?: (type: string) => string;
90
- };
91
- declare function createFunctionParams(params: Params): Params;
92
- declare class FunctionParams {
93
- #private;
94
- static factory(params: Params): FunctionParams;
95
- constructor(params: Params);
96
- get params(): Params;
97
- get flatParams(): Params;
98
- toCall({
99
- transformName,
100
- transformType
101
- }?: Pick<Options, 'transformName' | 'transformType'>): string;
102
- toObject(): string;
103
- toObjectValue(): string;
104
- toConstructor(): string;
105
- }
106
- //#endregion
107
- //#region src/types.d.ts
108
- type ReactElementNames = 'br' | 'div';
109
- type ElementNames = ReactElementNames | 'kubb-text' | 'kubb-file' | 'kubb-source' | 'kubb-import' | 'kubb-export' | 'kubb-root' | 'kubb-app';
110
- type Node = {
111
- parentNode: DOMElement | undefined;
112
- internal_static?: boolean;
113
- };
114
- type DOMNodeAttribute = boolean | string | number;
115
- type TextName = '#text';
116
- type TextNode = {
117
- nodeName: TextName;
118
- nodeValue: string;
119
- } & Node;
120
- type DOMNode<T = {
121
- nodeName: NodeNames;
122
- }> = T extends {
123
- nodeName: infer U;
124
- } ? U extends '#text' ? TextNode : DOMElement : never;
125
- type OutputTransformer = (s: string, index: number) => string;
126
- type DOMElement = {
127
- nodeName: ElementNames;
128
- attributes: Map<string, DOMNodeAttribute>;
129
- childNodes: DOMNode[];
130
- internal_transform?: OutputTransformer;
131
- isStaticDirty?: boolean;
132
- staticNode?: DOMElement;
133
- onComputeLayout?: () => void;
134
- onRender?: () => void;
135
- onImmediateRender?: () => void;
136
- } & Node;
137
- type NodeNames = ElementNames | TextName;
138
- type KubbNode = ReactNode;
139
- type KubbElement = JSX.Element;
140
- type KubbTextProps = {
141
- children?: KubbNode;
142
- };
143
- type KubbFileProps = {
144
- id?: string;
145
- children?: KubbNode;
146
- baseName: string;
147
- path: string;
148
- override?: boolean;
149
- meta?: File['meta'];
150
- };
151
- type KubbSourceProps = Source & {
152
- children?: KubbNode;
153
- };
154
- type KubbImportProps = Import;
155
- type KubbExportProps = Export;
156
- type LineBreakProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
157
- //#endregion
158
- export { TreeNode as S, 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,59 +0,0 @@
1
- import type { KubbElement } from '@kubb/react-fabric/types'
2
- import dedent from 'dedent'
3
- import indentString from 'indent-string'
4
- import React from 'react'
5
-
6
- type IndentProps = {
7
- size?: number
8
- children?: React.ReactNode
9
- }
10
-
11
- /**
12
- * Indents all children by `size` spaces.
13
- * Collapses consecutive <br /> tags to at most 2.
14
- *
15
- * Indent will dedent and re-indent string children and will prefix
16
- * non-string children with the requested number of spaces.
17
- */
18
- export function Indent({ size = 2, children }: IndentProps): KubbElement {
19
- if (!children) {
20
- return <></>
21
- }
22
-
23
- const childrenArray = React.Children.toArray(children)
24
- const result: React.ReactNode[] = []
25
-
26
- let prevWasBr = false
27
- let brCount = 0
28
-
29
- for (const child of childrenArray) {
30
- if (React.isValidElement(child) && child.type === 'br') {
31
- if (!prevWasBr || brCount < 2) {
32
- result.push(child)
33
- brCount++
34
- }
35
- prevWasBr = true
36
- } else {
37
- prevWasBr = false
38
- brCount = 0
39
- result.push(child)
40
- }
41
- }
42
-
43
- return (
44
- <>
45
- {result.map((child) => {
46
- if (typeof child === 'string') {
47
- const cleaned = dedent(child)
48
- return <>{indentString(cleaned, size)}</>
49
- }
50
- return (
51
- <>
52
- {' '.repeat(size)}
53
- {child}
54
- </>
55
- )
56
- })}
57
- </>
58
- )
59
- }
@@ -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
- }