@kubb/react-fabric 0.12.0 → 0.12.2

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 (42) hide show
  1. package/dist/{chunk-DkQCb-7t.js → chunk-CrnDzoTS.js} +2 -1
  2. package/dist/globals.d.cts +1 -1
  3. package/dist/globals.d.ts +2 -2
  4. package/dist/index.cjs +14 -14
  5. package/dist/index.cjs.map +1 -1
  6. package/dist/index.d.cts +16 -14
  7. package/dist/index.d.ts +17 -15
  8. package/dist/index.js +17 -17
  9. package/dist/index.js.map +1 -1
  10. package/dist/jsx-dev-runtime.d.cts +4 -4
  11. package/dist/jsx-dev-runtime.d.ts +3 -3
  12. package/dist/jsx-dev-runtime.js +2 -2
  13. package/dist/{jsx-namespace-Lr0pS1AG.d.ts → jsx-namespace-fB1bxOIg.d.ts} +2 -2
  14. package/dist/{jsx-namespace-BUHfo3FK.d.cts → jsx-namespace-r-JXq_rp.d.cts} +1 -1
  15. package/dist/{jsx-runtime-CT8FKS42.js → jsx-runtime-CpElaHq6.js} +2 -2
  16. package/dist/{jsx-runtime-CT8FKS42.js.map → jsx-runtime-CpElaHq6.js.map} +1 -1
  17. package/dist/jsx-runtime.d.cts +4 -4
  18. package/dist/jsx-runtime.d.ts +3 -3
  19. package/dist/jsx-runtime.js +2 -2
  20. package/dist/parsers.d.cts +1 -16
  21. package/dist/parsers.d.ts +1 -17
  22. package/dist/plugins.cjs +1 -1
  23. package/dist/plugins.d.cts +3 -125
  24. package/dist/plugins.d.ts +4 -126
  25. package/dist/plugins.js +3 -3
  26. package/dist/{react-CDrFaZVO.js → react-Cfp4vMID.js} +1 -1
  27. package/dist/{react-CDrFaZVO.js.map → react-Cfp4vMID.js.map} +1 -1
  28. package/dist/{reactPlugin-CicgALtR.cjs → reactPlugin-BzHuVlbO.cjs} +1757 -1757
  29. package/dist/reactPlugin-BzHuVlbO.cjs.map +1 -0
  30. package/dist/{types-yKh-a1UP.d.cts → reactPlugin-CVS9VJ5P.d.ts} +41 -202
  31. package/dist/{reactPlugin-BHxx8AjV.js → reactPlugin-CwuxUcyY.js} +1760 -1760
  32. package/dist/reactPlugin-CwuxUcyY.js.map +1 -0
  33. package/dist/{types-C-nm6Bqx.d.ts → reactPlugin-EQOIOEA2.d.cts} +39 -202
  34. package/dist/types-J_S-h-Ae.d.cts +104 -0
  35. package/dist/types-XiObCuPy.d.ts +103 -0
  36. package/dist/types.d.cts +3 -2
  37. package/dist/types.d.ts +3 -2
  38. package/package.json +3 -2
  39. package/dist/reactPlugin-BHxx8AjV.js.map +0 -1
  40. package/dist/reactPlugin-CWHmkuUz.d.cts +0 -72
  41. package/dist/reactPlugin-CicgALtR.cjs.map +0 -1
  42. package/dist/reactPlugin-DseDoGSU.d.ts +0 -73
@@ -1,19 +1,19 @@
1
- import React, { JSX, Key, ReactNode } from "react";
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";
2
4
 
3
- //#region rolldown:runtime
4
- declare namespace KubbFile_d_exports {
5
- export { BaseName, Export, Extname, File, Import, Mode, Path, ResolvedFile, Source };
6
- }
5
+ //#region ../fabric-core/src/KubbFile.d.ts
6
+ type ImportName = string | Array<string | {
7
+ propertyName: string;
8
+ name?: string;
9
+ }>;
7
10
  type Import = {
8
11
  /**
9
12
  * Import name to be used
10
13
  * @example ["useState"]
11
14
  * @example "React"
12
15
  */
13
- name: string | Array<string | {
14
- propertyName: string;
15
- name?: string;
16
- }>;
16
+ name: ImportName;
17
17
  /**
18
18
  * Path for the import
19
19
  * @example '@kubb/core'
@@ -66,7 +66,6 @@ type Export = {
66
66
  asAlias?: boolean;
67
67
  };
68
68
  type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
69
- type Mode = 'single' | 'split';
70
69
  /**
71
70
  * Name to be used to dynamicly create the baseName(based on input.path)
72
71
  * Based on UNIX basename
@@ -130,7 +129,6 @@ type Parser<TOptions = unknown, TMeta extends object = any> = {
130
129
  */
131
130
  parse(file: ResolvedFile<TMeta>, options: PrintOptions): Promise<string>;
132
131
  };
133
- type UserParser<TOptions = unknown, TMeta extends object = any> = Omit<Parser<TOptions, TMeta>, 'type'>;
134
132
  //#endregion
135
133
  //#region ../fabric-core/src/utils/AsyncEventEmitter.d.ts
136
134
  type Options$3 = {
@@ -189,7 +187,7 @@ declare class FileProcessor {
189
187
  type Options$1 = {
190
188
  events?: AsyncEventEmitter<FabricEvents>;
191
189
  };
192
- declare class FileManager {
190
+ declare class FileManager$1 {
193
191
  #private;
194
192
  events: AsyncEventEmitter<FabricEvents>;
195
193
  processor: FileProcessor;
@@ -206,48 +204,12 @@ declare class FileManager {
206
204
  write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
207
205
  }
208
206
  //#endregion
209
- //#region ../fabric-core/src/contexts/RenderContext.d.ts
210
- type RenderContextProps = {
211
- indentLevel: number;
212
- indentSize: number;
213
- currentLineLength: number;
214
- shouldBreak: boolean;
215
- };
216
- //#endregion
217
- //#region ../fabric-core/src/intrinsic.d.ts
218
- type IntrinsicType = 'br' | 'indent' | 'dedent';
219
- type Intrinsic = {
220
- type: IntrinsicType;
221
- __intrinsic: true;
222
- };
223
- //#endregion
224
- //#region ../fabric-core/src/plugins/types.d.ts
225
- type Plugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = {
226
- name: string;
227
- type: 'plugin';
228
- install: Install<TOptions>;
229
- /**
230
- * Runtime app overrides or extensions.
231
- * Merged into the app instance after install.
232
- * This cannot be async
233
- */
234
- inject?: Inject<TOptions, TAppExtension>;
235
- };
236
- type UserPlugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension>, 'type'>;
237
- //#endregion
238
207
  //#region ../fabric-core/src/Fabric.d.ts
239
208
  declare global {
240
209
  namespace Kubb {
241
210
  interface Fabric {}
242
211
  }
243
212
  }
244
- type FabricElement<TProps extends object = object> = {
245
- (): FabricNode;
246
- type: string;
247
- component: (props: TProps) => FabricNode;
248
- props: TProps;
249
- };
250
- type FabricNode = FabricElement<any> | string | number | boolean | null | undefined | Intrinsic | Array<FabricNode>;
251
213
  /**
252
214
  * Defines core runtime options for Fabric.
253
215
  */
@@ -377,7 +339,7 @@ interface FabricContext<T extends FabricOptions = FabricOptions> extends AsyncEv
377
339
  /** The active Fabric configuration. */
378
340
  config: FabricConfig<T>;
379
341
  /** The internal file manager handling file creation, merging, and writing. */
380
- fileManager: FileManager;
342
+ fileManager: FileManager$1;
381
343
  /** List of files currently in memory. */
382
344
  files: ResolvedFile[];
383
345
  /** Add new files to the file manager. */
@@ -430,167 +392,44 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
430
392
  upsertFile(...files: File[]): Promise<void>;
431
393
  }
432
394
  //#endregion
433
- //#region ../fabric-core/src/utils/TreeNode.d.ts
434
- type BarrelData = {
435
- file?: File;
436
- path: string;
395
+ //#region ../fabric-core/src/plugins/types.d.ts
396
+ type Plugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = {
437
397
  name: string;
438
- };
439
- type Graph = {
440
- nodes: Array<{
441
- id: string;
442
- label: string;
443
- }>;
444
- edges: Array<{
445
- from: string;
446
- to: string;
447
- }>;
448
- };
449
- declare class TreeNode<TData = unknown> {
450
- #private;
451
- data: TData;
452
- parent?: TreeNode<TData>;
453
- children: Array<TreeNode<TData>>;
454
- constructor(data: TData, parent?: TreeNode<TData>);
455
- addChild(data: TData): TreeNode<TData>;
456
- getChildByName(name: string): TreeNode<TData> | undefined;
457
- get leaves(): Array<TreeNode<TData>>;
458
- forEach(callback: (node: TreeNode<TData>) => void): this;
459
- findDeep(predicate: (node: TreeNode<TData>) => boolean): TreeNode<TData> | undefined;
460
- static toGraph(root: TreeNode<BarrelData>): Graph;
461
- static fromFiles(files: Array<File>, rootFolder?: string): TreeNode<BarrelData> | null;
462
- }
463
- //#endregion
464
- //#region ../fabric-core/src/composables/useNodeTree.d.ts
465
- type ComponentNode = {
466
- type: string;
467
- props: Record<string, unknown>;
468
- };
469
- //#endregion
470
- //#region ../fabric-core/src/context.d.ts
471
- /**
472
- * Context type that carries type information about its value
473
- * This is a branded symbol type that enables type-safe context usage
474
- */
475
- type Context<T> = symbol & {
476
- readonly __type: T;
477
- };
478
- //#endregion
479
- //#region ../fabric-core/src/contexts/RootContext.d.ts
480
- type RootContextProps = {
481
- /**
482
- * Exit (unmount) the whole app.
483
- */
484
- exit: (error?: Error) => void;
485
- /**
486
- * TreeNode representing the tree structure of the app.
487
- */
488
- treeNode: TreeNode<ComponentNode>;
398
+ type: 'plugin';
399
+ install: Install<TOptions>;
489
400
  /**
490
- * FileManager instance for managing files within the app.
401
+ * Runtime app overrides or extensions.
402
+ * Merged into the app instance after install.
403
+ * This cannot be async
491
404
  */
492
- fileManager: FileManager;
493
- };
494
- //#endregion
495
- //#region ../fabric-core/src/types.d.ts
496
- type JSDoc = {
497
- comments: string[];
405
+ inject?: Inject<TOptions, TAppExtension>;
498
406
  };
499
407
  //#endregion
500
- //#region src/utils/getFunctionParams.d.ts
501
- type Param = {
502
- /**
503
- * `object` will return the pathParams as an object.
504
- *
505
- * `inline` will return the pathParams as comma separated params.
506
- * @default `'inline'`
507
- * @private
508
- */
509
- mode?: 'object' | 'inline' | 'inlineSpread';
510
- type?: 'string' | 'number' | (string & {});
511
- optional?: boolean;
512
- /**
513
- * @example test = "default"
514
- */
515
- default?: string;
408
+ //#region src/plugins/reactPlugin.d.ts
409
+ type Options = {
410
+ stdout?: NodeJS.WriteStream;
411
+ stdin?: NodeJS.ReadStream;
412
+ stderr?: NodeJS.WriteStream;
413
+ treeNode?: TreeNode<types_d_exports.ComponentNode>;
516
414
  /**
517
- * Used for no TypeScript(with mode object)
518
- * @example test: "default"
415
+ * Set this to true to always see the result of the render in the console(line per render)
519
416
  */
520
- value?: string;
521
- children?: Params;
417
+ debug?: boolean;
522
418
  };
523
- type Params = Record<string, Param | undefined>;
524
- type Options = {
525
- type: 'constructor' | 'call' | 'object' | 'objectValue';
526
- transformName?: (name: string) => string;
527
- transformType?: (type: string) => string;
419
+ type ExtendOptions = {
420
+ render(App: KubbElement): Promise<void>;
421
+ renderToString(App: KubbElement): Promise<string>;
422
+ waitUntilExit(): Promise<void>;
528
423
  };
529
- declare function createFunctionParams(params: Params): Params;
530
- declare class FunctionParams {
531
- #private;
532
- static factory(params: Params): FunctionParams;
533
- constructor(params: Params);
534
- get params(): Params;
535
- get flatParams(): Params;
536
- toCall({
537
- transformName,
538
- transformType
539
- }?: Pick<Options, 'transformName' | 'transformType'>): string;
540
- toObject(): string;
541
- toObjectValue(): string;
542
- toConstructor(): string;
424
+ declare global {
425
+ namespace Kubb {
426
+ interface Fabric {
427
+ render(App: KubbElement): Promise<void>;
428
+ renderToString(App: KubbElement): Promise<string>;
429
+ waitUntilExit(): Promise<void>;
430
+ }
431
+ }
543
432
  }
433
+ declare const reactPlugin: Plugin<Options, ExtendOptions>;
544
434
  //#endregion
545
- //#region src/types.d.ts
546
- type ReactElementNames = 'br' | 'div' | 'indent' | 'dedent';
547
- type ElementNames = ReactElementNames | 'kubb-text' | 'kubb-file' | 'kubb-source' | 'kubb-import' | 'kubb-export' | 'kubb-root' | 'kubb-app';
548
- type Node = {
549
- parentNode: DOMElement | undefined;
550
- internal_static?: boolean;
551
- };
552
- type DOMNodeAttribute = boolean | string | number;
553
- type TextName = '#text';
554
- type TextNode = {
555
- nodeName: TextName;
556
- nodeValue: string;
557
- } & Node;
558
- type DOMNode<T = {
559
- nodeName: NodeNames;
560
- }> = T extends {
561
- nodeName: infer U;
562
- } ? U extends '#text' ? TextNode : DOMElement : never;
563
- type OutputTransformer = (s: string, index: number) => string;
564
- type DOMElement = {
565
- nodeName: ElementNames;
566
- attributes: Map<string, DOMNodeAttribute>;
567
- childNodes: DOMNode[];
568
- internal_transform?: OutputTransformer;
569
- isStaticDirty?: boolean;
570
- staticNode?: DOMElement;
571
- onComputeLayout?: () => void;
572
- onRender?: () => void;
573
- onImmediateRender?: () => void;
574
- } & Node;
575
- type NodeNames = ElementNames | TextName;
576
- type KubbNode = ReactNode;
577
- type KubbElement = JSX.Element;
578
- type KubbTextProps = {
579
- children?: KubbNode;
580
- };
581
- type KubbFileProps = {
582
- id?: string;
583
- children?: KubbNode;
584
- baseName: string;
585
- path: string;
586
- override?: boolean;
587
- meta?: File['meta'];
588
- };
589
- type KubbSourceProps = Source & {
590
- children?: KubbNode;
591
- };
592
- type KubbImportProps = Import;
593
- type KubbExportProps = Export;
594
- type LineBreakProps = React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
595
- //#endregion
596
- export { Plugin as A, File as B, TreeNode as C, FabricElement as D, FabricContext as E, Parser as F, Source as G, KubbFile_d_exports as H, UserParser as I, __name as K, BaseName as L, RenderContextProps as M, FileManager as N, FabricMode as O, FileProcessor as P, Export as R, ComponentNode as S, FabricConfig as T, Path as U, Import as V, ResolvedFile as W, 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, UserPlugin as j, FabricOptions as k, 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, Fabric as w, Context as x, JSDoc as y, Extname as z };
435
+ export { reactPlugin as n, Options as t };