@kubb/react-fabric 0.10.0 → 0.11.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.
Files changed (89) hide show
  1. package/dist/{Fabric-DitK3IEP.d.ts → Fabric-BELBf-bX.d.cts} +5 -5
  2. package/dist/{Fabric-C61uYmUy.d.cts → Fabric-DbJhvsCq.d.ts} +5 -5
  3. package/dist/globals.d.cts +2 -2
  4. package/dist/globals.d.ts +2 -2
  5. package/dist/index.cjs +123 -41
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +71 -209
  8. package/dist/index.d.ts +59 -197
  9. package/dist/index.js +102 -39
  10. package/dist/index.js.map +1 -1
  11. package/dist/jsx-dev-runtime.d.cts +5 -5
  12. package/dist/jsx-dev-runtime.d.ts +3 -3
  13. package/dist/{jsx-namespace-BnoysbjP.d.cts → jsx-namespace-B6xgRlZE.d.cts} +2 -2
  14. package/dist/{jsx-namespace-D0a66_uR.d.ts → jsx-namespace-BNUcRr9S.d.ts} +2 -2
  15. package/dist/jsx-runtime.d.cts +5 -5
  16. package/dist/jsx-runtime.d.ts +3 -3
  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 +3 -2
  21. package/dist/plugins.d.ts +3 -2
  22. package/dist/plugins.js +1 -1
  23. package/dist/{reactPlugin-4-kcMKwZ.d.ts → reactPlugin-9l7--xRt.d.ts} +7 -6
  24. package/dist/{reactPlugin-D4SmGYbm.cjs → reactPlugin-B8F6jVb5.cjs} +33 -13
  25. package/dist/reactPlugin-B8F6jVb5.cjs.map +1 -0
  26. package/dist/{reactPlugin-DT9toQPK.js → reactPlugin-CAtVV84d.js} +34 -14
  27. package/dist/reactPlugin-CAtVV84d.js.map +1 -0
  28. package/dist/{reactPlugin-B4xarQJX.d.cts → reactPlugin-DdQ8nZeK.d.cts} +7 -6
  29. package/dist/{types-BL7PkfqA.d.ts → types-QgmDVUxV.d.ts} +56 -3
  30. package/dist/{types-BdOHT5YF.d.cts → types-f5qVBVRo.d.cts} +56 -3
  31. package/dist/types.d.cts +3 -3
  32. package/dist/types.d.ts +3 -3
  33. package/package.json +2 -2
  34. package/src/Runtime.tsx +22 -12
  35. package/src/components/App.tsx +23 -7
  36. package/src/components/Const.tsx +17 -4
  37. package/src/components/File.tsx +83 -24
  38. package/src/components/Function.tsx +28 -7
  39. package/src/components/Root.tsx +23 -16
  40. package/src/components/Type.tsx +17 -4
  41. package/src/components/__snapshots__/arrow_function.ts +3 -0
  42. package/src/components/__snapshots__/arrow_function_default.ts +3 -0
  43. package/src/components/__snapshots__/arrow_function_generics.ts +3 -0
  44. package/src/components/__snapshots__/arrow_function_single_line.ts +1 -0
  45. package/src/components/__snapshots__/arrow_function_with_generics.ts +3 -0
  46. package/src/components/__snapshots__/async_arrow_function.ts +3 -0
  47. package/src/components/__snapshots__/async_function.ts +3 -0
  48. package/src/components/__snapshots__/async_function_with_Promise_return_type.ts +3 -0
  49. package/src/components/__snapshots__/basic_arrow_function.ts +3 -0
  50. package/src/components/__snapshots__/basic_const.ts +1 -0
  51. package/src/components/__snapshots__/basic_export.ts +1 -0
  52. package/src/components/__snapshots__/basic_function.ts +3 -0
  53. package/src/components/__snapshots__/basic_import.ts +1 -0
  54. package/src/components/__snapshots__/basic_type.ts +1 -0
  55. package/src/components/__snapshots__/const_with_JSDoc.ts +4 -0
  56. package/src/components/__snapshots__/const_with_as_const.ts +1 -0
  57. package/src/components/__snapshots__/const_with_type.ts +1 -0
  58. package/src/components/__snapshots__/default_exported_arrow_function.ts +3 -0
  59. package/src/components/__snapshots__/default_exported_function.ts +3 -0
  60. package/src/components/__snapshots__/exported_arrow_function.ts +3 -0
  61. package/src/components/__snapshots__/exported_const.ts +1 -0
  62. package/src/components/__snapshots__/exported_function.ts +3 -0
  63. package/src/components/__snapshots__/exported_type.ts +1 -0
  64. package/src/components/__snapshots__/function_generics.ts +3 -0
  65. package/src/components/__snapshots__/function_with_JSDoc.ts +6 -0
  66. package/src/components/__snapshots__/function_with_comments.ts +6 -0
  67. package/src/components/__snapshots__/function_with_generics.ts +3 -0
  68. package/src/components/__snapshots__/function_with_parameters.ts +3 -0
  69. package/src/components/__snapshots__/function_with_params.ts +3 -0
  70. package/src/components/__snapshots__/function_with_returnType.ts +3 -0
  71. package/src/components/__snapshots__/function_with_return_type.ts +3 -0
  72. package/src/components/__snapshots__/matches_with_root_import.ts +1 -0
  73. package/src/components/__snapshots__/multiple_functions.ts +3 -0
  74. package/src/components/__snapshots__/named_export.ts +1 -0
  75. package/src/components/__snapshots__/named_export_(object_advanced).ts +1 -0
  76. package/src/components/__snapshots__/named_import.ts +1 -0
  77. package/src/components/__snapshots__/named_import_(object).ts +1 -0
  78. package/src/components/__snapshots__/named_import_(object_advanced).ts +1 -0
  79. package/src/components/__snapshots__/named_typed_export.ts +1 -0
  80. package/src/components/__snapshots__/named_typed_import.ts +1 -0
  81. package/src/components/__snapshots__/single_line_arrow_function.ts +1 -0
  82. package/src/components/__snapshots__/type_with_JSDoc.ts +4 -0
  83. package/src/components/__snapshots__/typed_export.ts +1 -0
  84. package/src/components/__snapshots__/typed_import.ts +1 -0
  85. package/src/composables/useLifecycle.tsx +1 -1
  86. package/src/index.ts +1 -1
  87. package/src/plugins/reactPlugin.ts +7 -6
  88. package/dist/reactPlugin-D4SmGYbm.cjs.map +0 -1
  89. package/dist/reactPlugin-DT9toQPK.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,47 +1,17 @@
1
- import { a as FabricOptions, b as Source, c as FileManager, f as BaseName, g as Import, h as File$1, i as FabricMode, l as FileProcessor, n as FabricConfig, p as Export, t as Fabric, v as Path, y as ResolvedFile } from "./Fabric-C61uYmUy.cjs";
2
- import { a as Key, h as FunctionParams, u as KubbNode, v as createFunctionParams, y as JSDoc } from "./types-BdOHT5YF.cjs";
3
- import { t as Options$1 } from "./reactPlugin-B4xarQJX.cjs";
4
- import * as react7 from "react";
1
+ import { a as FabricOptions, b as Source, c as FileManager, f as BaseName, g as Import, h as File$1, i as FabricMode, l as FileProcessor, n as FabricConfig, p as Export, t as Fabric, v as Path, y as ResolvedFile } from "./Fabric-BELBf-bX.cjs";
2
+ import { a as Key, h as FunctionParams, u as KubbNode, v as createFunctionParams, y as JSDoc } from "./types-f5qVBVRo.cjs";
3
+ import { t as Options$1 } from "./reactPlugin-DdQ8nZeK.cjs";
4
+ import * as react3 from "react";
5
5
  import React, { ReactNode } from "react";
6
6
 
7
- //#region ../fabric-core/src/components/Root.d.ts
8
- type RootProps = {
9
- /**
10
- * Exit (unmount) hook
11
- */
12
- readonly onExit: (error?: Error) => void;
13
- /**
14
- * Error hook
15
- */
16
- readonly onError: (error: Error) => void;
17
- readonly children?: string;
18
- };
19
- /**
20
- * Top-level root for fsx renderers. Returns children content and ensures
21
- * `onError` is called for runtime exceptions. Provides a RootContext with
22
- * an `exit` hook for downstream consumers.
23
- */
24
- declare function Root({
25
- onError,
26
- children
27
- }: Omit<RootProps, 'onExit'>): string;
28
- declare namespace Root {
29
- var displayName: string;
30
- }
31
- //#endregion
32
7
  //#region ../fabric-core/src/contexts/AppContext.d.ts
33
- type AppContextProps<TMeta = unknown> = {
8
+ type AppContextProps<TMeta extends object = object> = {
34
9
  /**
35
10
  * Exit (unmount)
36
11
  */
37
- readonly exit: (error?: Error) => void;
38
- readonly meta: TMeta;
12
+ exit: (error?: Error) => void;
13
+ meta: TMeta;
39
14
  };
40
- /**
41
- * Provides app-level metadata and lifecycle hooks (like `exit`) to
42
- * components and composables within a Fabric runtime.
43
- */
44
- declare const AppContext: Context<AppContextProps<unknown> | undefined>;
45
15
  //#endregion
46
16
  //#region ../fabric-core/src/composables/useApp.d.ts
47
17
  /**
@@ -49,61 +19,7 @@ declare const AppContext: Context<AppContextProps<unknown> | undefined>;
49
19
  *
50
20
  * Throws an error when there is no AppContext available.
51
21
  */
52
- declare function useApp<TMeta = unknown>(): AppContextProps<TMeta>;
53
- //#endregion
54
- //#region ../fabric-core/src/context.d.ts
55
- /**
56
- * Context type that carries type information about its value
57
- * This is a branded symbol type that enables type-safe context usage
58
- */
59
- type Context<T> = symbol & {
60
- readonly __type: T;
61
- };
62
- /**
63
- * Provides a value to descendant components (Vue 3 style)
64
- *
65
- * @example
66
- * ```ts
67
- * const ThemeKey = Symbol('theme')
68
- * provide(ThemeKey, { color: 'blue' })
69
- * ```
70
- */
71
- declare function provide<T>(key: symbol | Context<T>, value: T): void;
72
- /**
73
- * Injects a value provided by an ancestor component (Vue 3 style)
74
- *
75
- * @example
76
- * ```ts
77
- * const theme = inject(ThemeKey, { color: 'default' })
78
- * ```
79
- */
80
- declare function inject<T>(key: symbol | Context<T>, defaultValue?: T): T;
81
- /**
82
- * Unprovides a value (for cleanup)
83
- * @internal
84
- */
85
- declare function unprovide<T>(key: symbol | Context<T>): void;
86
- //#endregion
87
- //#region ../fabric-core/src/utils/FileCollector.d.ts
88
- /**
89
- * FileCollector is used to collect files from components via context
90
- * instead of walking the DOM tree.
91
- */
92
- declare class FileCollector {
93
- #private;
94
- /**
95
- * Add a file to the collector
96
- */
97
- add(file: File$1): void;
98
- /**
99
- * Get all collected files
100
- */
101
- get files(): Array<File$1>;
102
- /**
103
- * Clear all collected files
104
- */
105
- clear(): void;
106
- }
22
+ declare function useApp<TMeta extends object = object>(): AppContextProps<TMeta>;
107
23
  //#endregion
108
24
  //#region ../fabric-core/src/composables/useFile.d.ts
109
25
  /**
@@ -112,26 +28,7 @@ declare class FileCollector {
112
28
  * Throws when no FileCollector is present in context — ensure a Fabric that
113
29
  * provides a FileCollector is mounted before calling this hook.
114
30
  */
115
- declare function useFile(): FileCollector;
116
- //#endregion
117
- //#region ../fabric-core/src/contexts/FileCollectorContext.d.ts
118
- /**
119
- * Context for collecting files - provided by createFsxFabric
120
- */
121
- declare const FileCollectorContext: Context<FileCollector | null>;
122
- //#endregion
123
- //#region ../fabric-core/src/contexts/RootContext.d.ts
124
- type RootContextProps = {
125
- /**
126
- * Exit (unmount) the whole app.
127
- */
128
- readonly exit: (error?: Error) => void;
129
- };
130
- /**
131
- * Provides a top-level lifecycle hook (`exit`) for terminating the Fabric
132
- * runtime. This context is available at the root of a Fabric app.
133
- */
134
- declare const RootContext: Context<RootContextProps>;
31
+ declare function useFile(): ResolvedFile | null;
135
32
  //#endregion
136
33
  //#region ../fabric-core/src/createFabric.d.ts
137
34
  /**
@@ -149,35 +46,30 @@ declare function createFabric<T extends FabricOptions>(config?: FabricConfig<T>)
149
46
  */
150
47
  declare function createFile<TMeta extends object = object>(file: File$1<TMeta>): ResolvedFile<TMeta>;
151
48
  //#endregion
152
- //#region ../fabric-core/src/utils/createJSDoc.d.ts
153
- /**
154
- * Create JSDoc comment block from comments array
155
- */
156
- declare function createJSDoc({
157
- comments
158
- }: {
159
- comments: string[];
160
- }): string;
161
- //#endregion
162
49
  //#region src/components/App.d.ts
163
- type Props$4<TMeta = unknown> = {
164
- readonly children?: KubbNode;
165
- readonly meta: TMeta;
50
+ type AppProps<TMeta extends object = object> = {
51
+ /**
52
+ * Metadata associated with the App.
53
+ */
54
+ meta?: TMeta;
55
+ /**
56
+ * Children nodes.
57
+ */
58
+ children?: KubbNode;
166
59
  };
167
60
  /**
168
- * Provides the current app context (meta and exit) to descendants.
169
- * This component mirrors the Fabric app container in React.
61
+ * App container containing the AppContext carrying `meta` and an `exit` hook.
170
62
  */
171
- declare function App<TMeta = unknown>({
172
- meta,
173
- children
174
- }: Props$4<TMeta>): react7.ReactNode;
63
+ declare function App<TMeta extends object = object>({
64
+ children,
65
+ ...props
66
+ }: AppProps<TMeta>): react3.ReactNode;
175
67
  declare namespace App {
176
68
  var displayName: string;
177
69
  }
178
70
  //#endregion
179
71
  //#region src/components/Const.d.ts
180
- type Props$3 = {
72
+ type ConstProps = {
181
73
  key?: Key;
182
74
  /**
183
75
  * Name of the const
@@ -199,19 +91,18 @@ type Props$3 = {
199
91
  * Use of `const` assertions
200
92
  */
201
93
  asConst?: boolean;
94
+ /**
95
+ * Children nodes.
96
+ */
202
97
  children?: KubbNode;
203
98
  };
204
99
  /**
205
- * Renders a constant declaration. Supports optional export, type and JSDoc.
100
+ * Generates a TypeScript constant declaration.
206
101
  */
207
102
  declare function Const({
208
- name,
209
- export: canExport,
210
- type,
211
- JSDoc,
212
- asConst,
213
- children
214
- }: Props$3): react7.JSX.Element;
103
+ children,
104
+ ...props
105
+ }: ConstProps): react3.JSX.Element;
215
106
  declare namespace Const {
216
107
  var displayName: string;
217
108
  }
@@ -237,7 +128,7 @@ type BasePropsWithoutBaseName = {
237
128
  path?: Path;
238
129
  };
239
130
  type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
240
- type Props$2<TMeta> = BaseProps & {
131
+ type Props$1<TMeta> = BaseProps & {
241
132
  key?: Key;
242
133
  meta?: TMeta;
243
134
  banner?: string;
@@ -245,14 +136,12 @@ type Props$2<TMeta> = BaseProps & {
245
136
  children?: KubbNode;
246
137
  };
247
138
  /**
248
- * Registers a file in the FileCollector context and provides a scoped collector
249
- * for children. When `baseName` and `path` are provided the file will be
250
- * registered so it can be emitted by the collector later.
139
+ * Adds files to the FileManager
251
140
  */
252
141
  declare function File<TMeta extends object = object>({
253
142
  children,
254
- ...rest
255
- }: Props$2<TMeta>): react7.JSX.Element;
143
+ ...props
144
+ }: Props$1<TMeta>): react3.JSX.Element;
256
145
  declare namespace File {
257
146
  var displayName: string;
258
147
  var Export: typeof FileExport;
@@ -270,12 +159,9 @@ type FileSourceProps = Omit<Source, 'value'> & {
270
159
  * rendering with the FileCollector. Children are treated as the source string.
271
160
  */
272
161
  declare function FileSource({
273
- isTypeOnly,
274
- name,
275
- isExportable,
276
- isIndexable,
277
- children
278
- }: FileSourceProps): react7.JSX.Element;
162
+ children,
163
+ ...props
164
+ }: FileSourceProps): react3.JSX.Element;
279
165
  declare namespace FileSource {
280
166
  var displayName: string;
281
167
  }
@@ -288,12 +174,7 @@ type FileExportProps = Export & {
288
174
  * Declares an export entry for the current file. This will be collected by
289
175
  * the FileCollector for later emission.
290
176
  */
291
- declare function FileExport({
292
- name,
293
- path,
294
- isTypeOnly,
295
- asAlias
296
- }: FileExportProps): react7.JSX.Element;
177
+ declare function FileExport(props: FileExportProps): react3.JSX.Element;
297
178
  declare namespace FileExport {
298
179
  var displayName: string;
299
180
  }
@@ -305,19 +186,13 @@ type FileImportProps = Import & {
305
186
  *
306
187
  * Declares an import entry for the current file.
307
188
  */
308
- declare function FileImport({
309
- name,
310
- root,
311
- path,
312
- isTypeOnly,
313
- isNameSpace
314
- }: FileImportProps): react7.JSX.Element;
189
+ declare function FileImport(props: FileImportProps): react3.JSX.Element;
315
190
  declare namespace FileImport {
316
191
  var displayName: string;
317
192
  }
318
193
  //#endregion
319
194
  //#region src/components/Function.d.ts
320
- type Props$1 = {
195
+ type Props = {
321
196
  key?: Key;
322
197
  /**
323
198
  * Name of the function.
@@ -352,28 +227,23 @@ type Props$1 = {
352
227
  * Options for JSdocs.
353
228
  */
354
229
  JSDoc?: JSDoc;
355
- children?: KubbNode;
230
+ /**
231
+ * Children nodes.
232
+ */
233
+ children?: string;
356
234
  };
357
235
  /**
358
- * Renders a function definition using the Fabric templating primitives.
359
- * Supports optional export/default/async flags, generics, params and JSDoc.
236
+ * Generates a TypeScript function declaration.
360
237
  */
361
238
  declare function Function({
362
- name,
363
- default: isDefault,
364
- export: canExport,
365
- async,
366
- generics,
367
- params,
368
- returnType,
369
- JSDoc,
370
- children
371
- }: Props$1): react7.JSX.Element;
239
+ children,
240
+ ...props
241
+ }: Props): react3.JSX.Element;
372
242
  declare namespace Function {
373
243
  var displayName: string;
374
244
  var Arrow: typeof ArrowFunction;
375
245
  }
376
- type ArrowFunctionProps = Props$1 & {
246
+ type ArrowFunctionProps = Props & {
377
247
  /**
378
248
  * Create Arrow function in one line
379
249
  */
@@ -386,17 +256,9 @@ type ArrowFunctionProps = Props$1 & {
386
256
  * Use `singleLine` to render the body as a single-line expression.
387
257
  */
388
258
  declare function ArrowFunction({
389
- name,
390
- default: isDefault,
391
- export: canExport,
392
- async,
393
- generics,
394
- params,
395
- returnType,
396
- JSDoc,
397
- singleLine,
398
- children
399
- }: ArrowFunctionProps): react7.JSX.Element;
259
+ children,
260
+ ...props
261
+ }: ArrowFunctionProps): react3.JSX.Element;
400
262
  declare namespace ArrowFunction {
401
263
  var displayName: string;
402
264
  }
@@ -419,7 +281,7 @@ declare function Indent({
419
281
  }: IndentProps): React.JSX.Element | null;
420
282
  //#endregion
421
283
  //#region src/components/Type.d.ts
422
- type Props = {
284
+ type TypeProps = {
423
285
  key?: Key;
424
286
  /**
425
287
  * Name of the type, this needs to start with a capital letter.
@@ -433,18 +295,18 @@ type Props = {
433
295
  * Options for JSdocs.
434
296
  */
435
297
  JSDoc?: JSDoc;
298
+ /**
299
+ * Children nodes.
300
+ */
436
301
  children?: KubbNode;
437
302
  };
438
303
  /**
439
- * Renders a TypeScript type alias. Validates that the provided name starts
440
- * with a capital letter and optionally emits JSDoc comments.
304
+ * Generates a TypeScript type declaration.
441
305
  */
442
306
  declare function Type({
443
- name,
444
- export: canExport,
445
- JSDoc,
446
- children
447
- }: Props): react7.JSX.Element;
307
+ children,
308
+ ...props
309
+ }: TypeProps): react3.JSX.Element;
448
310
  declare namespace Type {
449
311
  var displayName: string;
450
312
  }
@@ -497,15 +359,15 @@ declare class Runtime {
497
359
  }
498
360
  //#endregion
499
361
  //#region src/index.d.ts
500
- declare const useState: typeof react7.useState;
501
- declare const createContext: typeof react7.createContext;
502
- declare const createElement: typeof react7.createElement;
503
- declare const Fragment: react7.ExoticComponent<react7.FragmentProps>;
504
- declare const use: typeof react7.use;
505
- declare const useContext: typeof react7.useContext;
506
- declare const useEffect: typeof react7.useEffect;
507
- declare const useReducer: typeof react7.useReducer;
508
- declare const useRef: typeof react7.useRef;
362
+ declare const useState: typeof react3.useState;
363
+ declare const createContext: typeof react3.createContext;
364
+ declare const createElement: typeof react3.createElement;
365
+ declare const Fragment: react3.ExoticComponent<react3.FragmentProps>;
366
+ declare const use: typeof react3.use;
367
+ declare const useContext: typeof react3.useContext;
368
+ declare const useEffect: typeof react3.useEffect;
369
+ declare const useReducer: typeof react3.useReducer;
370
+ declare const useRef: typeof react3.useRef;
509
371
  //#endregion
510
- export { App, AppContext, Const, type Context, type Fabric, File, FileCollector, FileCollectorContext, FileManager, FileProcessor, Fragment, Function, FunctionParams, Indent, Root, RootContext, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createJSDoc, createReactFabric, inject, provide, unprovide, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
372
+ export { App, Const, type Fabric, File, FileManager, FileProcessor, Fragment, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
511
373
  //# sourceMappingURL=index.d.cts.map