@kubb/react-fabric 0.11.8 → 0.12.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.
- package/dist/{chunk-DkQCb-7t.js → chunk-CrnDzoTS.js} +2 -1
- package/dist/globals.d.cts +3 -2
- package/dist/globals.d.ts +4 -3
- package/dist/index.cjs +21 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -34
- package/dist/index.d.ts +18 -35
- package/dist/index.js +25 -73
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +2 -3
- package/dist/jsx-dev-runtime.d.ts +3 -4
- package/dist/jsx-dev-runtime.js +2 -2
- package/dist/{jsx-namespace-B2MQxQlg.d.ts → jsx-namespace-fB1bxOIg.d.ts} +4 -2
- package/dist/{jsx-namespace-CNNMqfai.d.cts → jsx-namespace-r-JXq_rp.d.cts} +3 -2
- package/dist/{jsx-runtime-CT8FKS42.js → jsx-runtime-CpElaHq6.js} +2 -2
- package/dist/{jsx-runtime-CT8FKS42.js.map → jsx-runtime-CpElaHq6.js.map} +1 -1
- package/dist/jsx-runtime.d.cts +2 -3
- package/dist/jsx-runtime.d.ts +3 -4
- package/dist/jsx-runtime.js +2 -2
- package/dist/parsers.d.cts +1 -16
- package/dist/parsers.d.ts +1 -17
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.d.cts +3 -126
- package/dist/plugins.d.ts +4 -127
- package/dist/plugins.js +3 -3
- package/dist/{react-CDrFaZVO.js → react-Cfp4vMID.js} +1 -1
- package/dist/{react-CDrFaZVO.js.map → react-Cfp4vMID.js.map} +1 -1
- package/dist/{reactPlugin-Dhi6zkpn.cjs → reactPlugin-BzHuVlbO.cjs} +1784 -1766
- package/dist/reactPlugin-BzHuVlbO.cjs.map +1 -0
- package/dist/{Fabric-aSfkC_Bb.d.cts → reactPlugin-CGrRYrTb.d.ts} +57 -49
- package/dist/{reactPlugin-Cj595SPI.js → reactPlugin-CwuxUcyY.js} +1788 -1770
- package/dist/reactPlugin-CwuxUcyY.js.map +1 -0
- package/dist/{Fabric-7NilNj9Y.d.ts → reactPlugin-UKgy54VD.d.cts} +54 -50
- package/dist/{types-DmtVGJ2r.d.cts → types-J_S-h-Ae.d.cts} +12 -66
- package/dist/{types-DNU0IVoW.d.ts → types-XiObCuPy.d.ts} +12 -68
- package/dist/types.d.cts +3 -3
- package/dist/types.d.ts +3 -3
- package/package.json +3 -4
- package/src/components/Function.tsx +10 -3
- package/src/components/__snapshots__/{arrow_function_generics.ts → exported_async_arrow_function_with_generics.ts} +1 -1
- package/src/components/__snapshots__/{multiple_functions.ts → exported_async_function_with_generics.ts} +1 -1
- package/src/createReactFabric.ts +1 -2
- package/src/dom.ts +12 -1
- package/src/globals.ts +2 -0
- package/src/index.ts +1 -2
- package/src/jsx-namespace.d.ts +2 -0
- package/src/types.ts +1 -1
- package/src/utils/squashExportNodes.ts +2 -2
- package/src/utils/squashTextNodes.ts +23 -8
- package/dist/reactPlugin-Bm7-ZloC.d.ts +0 -74
- package/dist/reactPlugin-Cj595SPI.js.map +0 -1
- package/dist/reactPlugin-Dc0Hm6qb.d.cts +0 -73
- package/dist/reactPlugin-Dhi6zkpn.cjs.map +0 -1
- package/src/components/Indent.tsx +0 -59
- package/src/components/__snapshots__/arrow_function.ts +0 -3
- package/src/components/__snapshots__/arrow_function_default.ts +0 -3
- package/src/components/__snapshots__/arrow_function_single_line.ts +0 -1
- package/src/components/__snapshots__/function_generics.ts +0 -3
- package/src/components/__snapshots__/function_with_comments.ts +0 -6
- package/src/components/__snapshots__/function_with_params.ts +0 -3
- package/src/components/__snapshots__/function_with_returnType.ts +0 -3
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
1
|
+
import { r as __name } from "./chunk-CrnDzoTS.js";
|
|
2
|
+
import { h as types_d_exports, o as KubbElement } from "./types-XiObCuPy.js";
|
|
3
|
+
import { TreeNode } from "@kubb/fabric-core";
|
|
4
|
+
|
|
5
|
+
//#region ../fabric-core/src/KubbFile.d.ts
|
|
5
6
|
type Import = {
|
|
6
7
|
/**
|
|
7
8
|
* Import name to be used
|
|
@@ -64,7 +65,6 @@ type Export = {
|
|
|
64
65
|
asAlias?: boolean;
|
|
65
66
|
};
|
|
66
67
|
type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
|
|
67
|
-
type Mode = 'single' | 'split';
|
|
68
68
|
/**
|
|
69
69
|
* Name to be used to dynamicly create the baseName(based on input.path)
|
|
70
70
|
* Based on UNIX basename
|
|
@@ -75,7 +75,6 @@ type BaseName = `${string}.${string}`;
|
|
|
75
75
|
* Path will be full qualified path to a specified file
|
|
76
76
|
*/
|
|
77
77
|
type Path = string;
|
|
78
|
-
type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
|
|
79
78
|
type File<TMeta extends object = object> = {
|
|
80
79
|
/**
|
|
81
80
|
* Name to be used to create the path
|
|
@@ -86,7 +85,7 @@ type File<TMeta extends object = object> = {
|
|
|
86
85
|
/**
|
|
87
86
|
* Path will be full qualified path to a specified file
|
|
88
87
|
*/
|
|
89
|
-
path:
|
|
88
|
+
path: Path;
|
|
90
89
|
sources: Array<Source>;
|
|
91
90
|
imports: Array<Import>;
|
|
92
91
|
exports: Array<Export>;
|
|
@@ -97,8 +96,6 @@ type File<TMeta extends object = object> = {
|
|
|
97
96
|
banner?: string;
|
|
98
97
|
footer?: string;
|
|
99
98
|
};
|
|
100
|
-
type ResolvedImport = Import;
|
|
101
|
-
type ResolvedExport = Export;
|
|
102
99
|
type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
103
100
|
/**
|
|
104
101
|
* @default hash
|
|
@@ -110,8 +107,8 @@ type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
|
|
|
110
107
|
*/
|
|
111
108
|
name: string;
|
|
112
109
|
extname: Extname;
|
|
113
|
-
imports: Array<
|
|
114
|
-
exports: Array<
|
|
110
|
+
imports: Array<Import>;
|
|
111
|
+
exports: Array<Export>;
|
|
115
112
|
};
|
|
116
113
|
//#endregion
|
|
117
114
|
//#region ../fabric-core/src/parsers/types.d.ts
|
|
@@ -131,10 +128,9 @@ type Parser<TOptions = unknown, TMeta extends object = any> = {
|
|
|
131
128
|
*/
|
|
132
129
|
parse(file: ResolvedFile<TMeta>, options: PrintOptions): Promise<string>;
|
|
133
130
|
};
|
|
134
|
-
type UserParser<TOptions = unknown, TMeta extends object = any> = Omit<Parser<TOptions, TMeta>, 'type'>;
|
|
135
131
|
//#endregion
|
|
136
132
|
//#region ../fabric-core/src/utils/AsyncEventEmitter.d.ts
|
|
137
|
-
type Options$
|
|
133
|
+
type Options$3 = {
|
|
138
134
|
mode?: FabricMode;
|
|
139
135
|
maxListener?: number;
|
|
140
136
|
};
|
|
@@ -143,7 +139,7 @@ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
|
|
|
143
139
|
constructor({
|
|
144
140
|
maxListener,
|
|
145
141
|
mode
|
|
146
|
-
}?: Options$
|
|
142
|
+
}?: Options$3);
|
|
147
143
|
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
|
|
148
144
|
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
149
145
|
onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
|
|
@@ -165,7 +161,7 @@ type GetParseOptions = {
|
|
|
165
161
|
parsers?: Map<Extname, Parser>;
|
|
166
162
|
extension?: Record<Extname, Extname | ''>;
|
|
167
163
|
};
|
|
168
|
-
type Options$
|
|
164
|
+
type Options$2 = {
|
|
169
165
|
events?: AsyncEventEmitter<FabricEvents>;
|
|
170
166
|
};
|
|
171
167
|
declare class FileProcessor {
|
|
@@ -173,7 +169,7 @@ declare class FileProcessor {
|
|
|
173
169
|
events: AsyncEventEmitter<FabricEvents>;
|
|
174
170
|
constructor({
|
|
175
171
|
events
|
|
176
|
-
}?: Options$
|
|
172
|
+
}?: Options$2);
|
|
177
173
|
parse(file: ResolvedFile, {
|
|
178
174
|
parsers,
|
|
179
175
|
extension
|
|
@@ -187,16 +183,16 @@ declare class FileProcessor {
|
|
|
187
183
|
}
|
|
188
184
|
//#endregion
|
|
189
185
|
//#region ../fabric-core/src/FileManager.d.ts
|
|
190
|
-
type Options = {
|
|
186
|
+
type Options$1 = {
|
|
191
187
|
events?: AsyncEventEmitter<FabricEvents>;
|
|
192
188
|
};
|
|
193
|
-
declare class FileManager {
|
|
189
|
+
declare class FileManager$1 {
|
|
194
190
|
#private;
|
|
195
191
|
events: AsyncEventEmitter<FabricEvents>;
|
|
196
192
|
processor: FileProcessor;
|
|
197
193
|
constructor({
|
|
198
194
|
events
|
|
199
|
-
}?: Options);
|
|
195
|
+
}?: Options$1);
|
|
200
196
|
add(...files: Array<File>): Array<ResolvedFile>;
|
|
201
197
|
upsert(...files: Array<File>): Array<ResolvedFile>;
|
|
202
198
|
flush(): void;
|
|
@@ -207,40 +203,12 @@ declare class FileManager {
|
|
|
207
203
|
write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
|
|
208
204
|
}
|
|
209
205
|
//#endregion
|
|
210
|
-
//#region ../fabric-core/src/plugins/types.d.ts
|
|
211
|
-
type Plugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = {
|
|
212
|
-
name: string;
|
|
213
|
-
type: 'plugin';
|
|
214
|
-
install: Install<TOptions>;
|
|
215
|
-
/**
|
|
216
|
-
* Runtime app overrides or extensions.
|
|
217
|
-
* Merged into the app instance after install.
|
|
218
|
-
* This cannot be async
|
|
219
|
-
*/
|
|
220
|
-
inject?: Inject<TOptions, TAppExtension>;
|
|
221
|
-
};
|
|
222
|
-
type UserPlugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension>, 'type'>;
|
|
223
|
-
//#endregion
|
|
224
206
|
//#region ../fabric-core/src/Fabric.d.ts
|
|
225
207
|
declare global {
|
|
226
208
|
namespace Kubb {
|
|
227
209
|
interface Fabric {}
|
|
228
210
|
}
|
|
229
211
|
}
|
|
230
|
-
type ComponentCreator<TProps extends object = object> = {
|
|
231
|
-
(): FabricNode;
|
|
232
|
-
component: FabricComponent<TProps>;
|
|
233
|
-
props: TProps;
|
|
234
|
-
};
|
|
235
|
-
type FabricElement<TProps extends object = object> = ComponentCreator<TProps> & {
|
|
236
|
-
children(...children: Array<FabricNode>): FabricElement<TProps>;
|
|
237
|
-
};
|
|
238
|
-
type FabricNode = ComponentCreator<any> | Array<FabricNode> | string | number | boolean | null | undefined;
|
|
239
|
-
interface FabricComponent<TProps extends object = object> {
|
|
240
|
-
(props: TProps): FabricNode;
|
|
241
|
-
propTypes?: any;
|
|
242
|
-
displayName?: string | undefined;
|
|
243
|
-
}
|
|
244
212
|
/**
|
|
245
213
|
* Defines core runtime options for Fabric.
|
|
246
214
|
*/
|
|
@@ -370,7 +338,7 @@ interface FabricContext<T extends FabricOptions = FabricOptions> extends AsyncEv
|
|
|
370
338
|
/** The active Fabric configuration. */
|
|
371
339
|
config: FabricConfig<T>;
|
|
372
340
|
/** The internal file manager handling file creation, merging, and writing. */
|
|
373
|
-
fileManager: FileManager;
|
|
341
|
+
fileManager: FileManager$1;
|
|
374
342
|
/** List of files currently in memory. */
|
|
375
343
|
files: ResolvedFile[];
|
|
376
344
|
/** Add new files to the file manager. */
|
|
@@ -423,4 +391,44 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
|
|
|
423
391
|
upsertFile(...files: File[]): Promise<void>;
|
|
424
392
|
}
|
|
425
393
|
//#endregion
|
|
426
|
-
|
|
394
|
+
//#region ../fabric-core/src/plugins/types.d.ts
|
|
395
|
+
type Plugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = {
|
|
396
|
+
name: string;
|
|
397
|
+
type: 'plugin';
|
|
398
|
+
install: Install<TOptions>;
|
|
399
|
+
/**
|
|
400
|
+
* Runtime app overrides or extensions.
|
|
401
|
+
* Merged into the app instance after install.
|
|
402
|
+
* This cannot be async
|
|
403
|
+
*/
|
|
404
|
+
inject?: Inject<TOptions, TAppExtension>;
|
|
405
|
+
};
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/plugins/reactPlugin.d.ts
|
|
408
|
+
type Options = {
|
|
409
|
+
stdout?: NodeJS.WriteStream;
|
|
410
|
+
stdin?: NodeJS.ReadStream;
|
|
411
|
+
stderr?: NodeJS.WriteStream;
|
|
412
|
+
treeNode?: TreeNode<types_d_exports.ComponentNode>;
|
|
413
|
+
/**
|
|
414
|
+
* Set this to true to always see the result of the render in the console(line per render)
|
|
415
|
+
*/
|
|
416
|
+
debug?: boolean;
|
|
417
|
+
};
|
|
418
|
+
type ExtendOptions = {
|
|
419
|
+
render(App: KubbElement): Promise<void>;
|
|
420
|
+
renderToString(App: KubbElement): Promise<string>;
|
|
421
|
+
waitUntilExit(): Promise<void>;
|
|
422
|
+
};
|
|
423
|
+
declare global {
|
|
424
|
+
namespace Kubb {
|
|
425
|
+
interface Fabric {
|
|
426
|
+
render(App: KubbElement): Promise<void>;
|
|
427
|
+
renderToString(App: KubbElement): Promise<string>;
|
|
428
|
+
waitUntilExit(): Promise<void>;
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
declare const reactPlugin: Plugin<Options, ExtendOptions>;
|
|
433
|
+
//#endregion
|
|
434
|
+
export { reactPlugin as n, Options as t };
|