@kubb/fabric-core 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 (110) hide show
  1. package/dist/{Fabric-BoTE1-WX.d.cts → Fabric-BbVC650D.d.cts} +86 -15
  2. package/dist/{Fabric-CWquRFa2.d.ts → Fabric-eh92yS1R.d.ts} +86 -15
  3. package/dist/Root-BT59jU0W.js +931 -0
  4. package/dist/Root-BT59jU0W.js.map +1 -0
  5. package/dist/Root-SC_lWG_q.cjs +1057 -0
  6. package/dist/Root-SC_lWG_q.cjs.map +1 -0
  7. package/dist/{defaultParser-CFIT3sEE.cjs → defaultParser-2ym3KiZd.cjs} +3 -4
  8. package/dist/{defaultParser-CFIT3sEE.cjs.map → defaultParser-2ym3KiZd.cjs.map} +1 -1
  9. package/dist/{defaultParser-DZ2kzujH.js → defaultParser-DDFR9BTS.js} +2 -2
  10. package/dist/{defaultParser-DZ2kzujH.js.map → defaultParser-DDFR9BTS.js.map} +1 -1
  11. package/dist/{getRelativePath-y7WcYR5C.js → getRelativePath-COUEoqbz.js} +11 -2
  12. package/dist/getRelativePath-COUEoqbz.js.map +1 -0
  13. package/dist/{getRelativePath-BllDunh0.cjs → getRelativePath-jYLCpluV.cjs} +16 -1
  14. package/dist/getRelativePath-jYLCpluV.cjs.map +1 -0
  15. package/dist/index.cjs +129 -448
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +54 -90
  18. package/dist/index.d.ts +54 -90
  19. package/dist/index.js +92 -416
  20. package/dist/index.js.map +1 -1
  21. package/dist/parsers/typescript.cjs +7 -107
  22. package/dist/parsers/typescript.d.cts +1 -1
  23. package/dist/parsers/typescript.d.ts +1 -1
  24. package/dist/parsers/typescript.js +2 -101
  25. package/dist/parsers.cjs +7 -8
  26. package/dist/parsers.cjs.map +1 -1
  27. package/dist/parsers.d.cts +1 -1
  28. package/dist/parsers.d.ts +1 -1
  29. package/dist/parsers.js +3 -3
  30. package/dist/plugins.cjs +103 -9
  31. package/dist/plugins.cjs.map +1 -1
  32. package/dist/plugins.d.cts +32 -9
  33. package/dist/plugins.d.ts +32 -9
  34. package/dist/plugins.js +96 -3
  35. package/dist/plugins.js.map +1 -1
  36. package/dist/types-BI7rICUP.d.cts +31 -0
  37. package/dist/types-DpITKjSb.d.ts +32 -0
  38. package/dist/types.cjs +6 -0
  39. package/dist/types.cjs.map +1 -1
  40. package/dist/types.d.cts +4 -3
  41. package/dist/types.d.ts +4 -3
  42. package/dist/types.js +1 -1
  43. package/dist/types.js.map +1 -1
  44. package/dist/typescriptParser-DyosyI_A.js +101 -0
  45. package/dist/typescriptParser-DyosyI_A.js.map +1 -0
  46. package/dist/typescriptParser-qjzb2pIh.cjs +137 -0
  47. package/dist/typescriptParser-qjzb2pIh.cjs.map +1 -0
  48. package/dist/{TreeNode-DomNP5og.d.cts → useNodeTree-CmXKaRqq.d.cts} +10 -3
  49. package/dist/{TreeNode-C1VnIF0o.d.ts → useNodeTree-DUdlgys5.d.ts} +10 -3
  50. package/package.json +3 -2
  51. package/src/Fabric.ts +13 -5
  52. package/src/KubbFile.ts +3 -11
  53. package/src/components/App.ts +6 -5
  54. package/src/components/Br.ts +11 -0
  55. package/src/components/Const.ts +6 -5
  56. package/src/components/Dedent.ts +10 -0
  57. package/src/components/File.ts +21 -16
  58. package/src/components/Function.ts +17 -13
  59. package/src/components/Indent.ts +7 -0
  60. package/src/components/Root.ts +6 -5
  61. package/src/components/Type.ts +6 -5
  62. package/src/components/__snapshots__/arrow_function_with_generics.ts +3 -3
  63. package/src/components/__snapshots__/async_arrow_function.ts +3 -3
  64. package/src/components/__snapshots__/async_function.ts +2 -2
  65. package/src/components/__snapshots__/async_function_with_Promise_return_type.ts +2 -2
  66. package/src/components/__snapshots__/basic_arrow_function.ts +3 -3
  67. package/src/components/__snapshots__/basic_export.ts +1 -0
  68. package/src/components/__snapshots__/basic_function.ts +2 -2
  69. package/src/components/__snapshots__/basic_import.ts +1 -0
  70. package/src/components/__snapshots__/default_exported_arrow_function.ts +3 -3
  71. package/src/components/__snapshots__/default_exported_function.ts +2 -2
  72. package/src/components/__snapshots__/exported_arrow_function.ts +3 -3
  73. package/src/components/__snapshots__/exported_function.ts +2 -2
  74. package/src/components/__snapshots__/function_with_JSDoc.ts +2 -2
  75. package/src/components/__snapshots__/function_with_generics.ts +2 -2
  76. package/src/components/__snapshots__/function_with_parameters.ts +2 -2
  77. package/src/components/__snapshots__/function_with_return_type.ts +2 -2
  78. package/src/components/__snapshots__/matches_with_root_import.ts +1 -0
  79. package/src/components/__snapshots__/named_export.ts +1 -0
  80. package/src/components/__snapshots__/named_export_(object_advanced).ts +1 -0
  81. package/src/components/__snapshots__/named_import.ts +1 -0
  82. package/src/components/__snapshots__/named_import_(object).ts +1 -0
  83. package/src/components/__snapshots__/named_import_(object_advanced).ts +1 -0
  84. package/src/components/__snapshots__/named_typed_export.ts +1 -0
  85. package/src/components/__snapshots__/named_typed_import.ts +1 -0
  86. package/src/components/__snapshots__/typed_export.ts +1 -0
  87. package/src/components/__snapshots__/typed_import.ts +1 -0
  88. package/src/contexts/RenderContext.ts +13 -0
  89. package/src/createComponent.ts +34 -0
  90. package/src/index.ts +9 -9
  91. package/src/intrinsic.ts +143 -0
  92. package/src/plugins/fsxPlugin/Runtime.ts +96 -0
  93. package/src/plugins/fsxPlugin/fsxPlugin.ts +45 -0
  94. package/src/plugins/index.ts +1 -0
  95. package/src/types.ts +4 -1
  96. package/dist/TreeNode-CC3a0Bae.js +0 -447
  97. package/dist/TreeNode-CC3a0Bae.js.map +0 -1
  98. package/dist/TreeNode-CFchatCw.cjs +0 -494
  99. package/dist/TreeNode-CFchatCw.cjs.map +0 -1
  100. package/dist/defineParser-CVCxqqzB.cjs +0 -18
  101. package/dist/defineParser-CVCxqqzB.cjs.map +0 -1
  102. package/dist/defineParser-Lco7nlj0.js +0 -13
  103. package/dist/defineParser-Lco7nlj0.js.map +0 -1
  104. package/dist/getRelativePath-BllDunh0.cjs.map +0 -1
  105. package/dist/getRelativePath-y7WcYR5C.js.map +0 -1
  106. package/dist/parsers/typescript.cjs.map +0 -1
  107. package/dist/parsers/typescript.js.map +0 -1
  108. package/dist/types-DYepTJ6F.d.cts +0 -82
  109. package/dist/types-yNaQHNUB.d.ts +0 -83
  110. package/src/components/Text.ts +0 -27
@@ -1,7 +1,6 @@
1
1
  declare namespace KubbFile_d_exports {
2
- export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
2
+ export { BaseName, Export, Extname, File, Import, Mode, Path, ResolvedFile, Source };
3
3
  }
4
- type BasePath<T extends string = string> = `${T}/`;
5
4
  type Import = {
6
5
  /**
7
6
  * Import name to be used
@@ -75,7 +74,6 @@ type BaseName = `${string}.${string}`;
75
74
  * Path will be full qualified path to a specified file
76
75
  */
77
76
  type Path = string;
78
- type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
79
77
  type File<TMeta extends object = object> = {
80
78
  /**
81
79
  * Name to be used to create the path
@@ -86,7 +84,7 @@ type File<TMeta extends object = object> = {
86
84
  /**
87
85
  * Path will be full qualified path to a specified file
88
86
  */
89
- path: AdvancedPath<BaseName> | Path;
87
+ path: Path;
90
88
  sources: Array<Source>;
91
89
  imports: Array<Import>;
92
90
  exports: Array<Export>;
@@ -97,8 +95,6 @@ type File<TMeta extends object = object> = {
97
95
  banner?: string;
98
96
  footer?: string;
99
97
  };
100
- type ResolvedImport = Import;
101
- type ResolvedExport = Export;
102
98
  type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
103
99
  /**
104
100
  * @default hash
@@ -110,8 +106,8 @@ type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
110
106
  */
111
107
  name: string;
112
108
  extname: Extname;
113
- imports: Array<ResolvedImport>;
114
- exports: Array<ResolvedExport>;
109
+ imports: Array<Import>;
110
+ exports: Array<Export>;
115
111
  };
116
112
  //#endregion
117
113
  //#region src/parsers/types.d.ts
@@ -207,6 +203,76 @@ declare class FileManager {
207
203
  write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
208
204
  }
209
205
  //#endregion
206
+ //#region src/context.d.ts
207
+ /**
208
+ * Context type that carries type information about its value
209
+ * This is a branded symbol type that enables type-safe context usage
210
+ */
211
+ type Context<T> = symbol & {
212
+ readonly __type: T;
213
+ };
214
+ /**
215
+ * Provides a value to descendant components (Vue 3 style)
216
+ *
217
+ * @example
218
+ * ```ts
219
+ * const ThemeKey = Symbol('theme')
220
+ * provide(ThemeKey, { color: 'blue' })
221
+ * ```
222
+ */
223
+ declare function provide<T>(key: symbol | Context<T>, value: T): void;
224
+ /**
225
+ * Injects a value provided by an ancestor component (Vue 3 style)
226
+ *
227
+ * @example
228
+ * ```ts
229
+ * const theme = inject(ThemeKey, { color: 'default' })
230
+ * ```
231
+ */
232
+ declare function inject<T>(key: symbol | Context<T>, defaultValue?: T): T;
233
+ /**
234
+ * Unprovides a value (for cleanup)
235
+ * @internal
236
+ */
237
+ declare function unprovide<T>(key: symbol | Context<T>): void;
238
+ /**
239
+ * Creates a context key with a default value (React-style compatibility)
240
+ *
241
+ * @example
242
+ * ```ts
243
+ * const ThemeContext = createContext({ color: 'blue' })
244
+ * // ThemeContext is now typed as Context<{ color: string }>
245
+ * const theme = useContext(ThemeContext) // theme is { color: string }
246
+ * ```
247
+ */
248
+ declare function createContext<T>(defaultValue: T): Context<T>;
249
+ //#endregion
250
+ //#region src/contexts/RenderContext.d.ts
251
+ type RenderContextProps = {
252
+ indentLevel: number;
253
+ indentSize: number;
254
+ currentLineLength: number;
255
+ shouldBreak: boolean;
256
+ };
257
+ /**
258
+ * Provides a context for tracking rendering state such as indentation and line length.
259
+ */
260
+ declare const RenderContext: Context<RenderContextProps>;
261
+ //#endregion
262
+ //#region src/intrinsic.d.ts
263
+ type IntrinsicType = 'br' | 'indent' | 'dedent';
264
+ type Intrinsic = {
265
+ type: IntrinsicType;
266
+ __intrinsic: true;
267
+ };
268
+ /**
269
+ * Helper: render a plain string while applying current indentation at the
270
+ * start of each logical line. This ensures `${indent}` intrinsics affect
271
+ * subsequent string content.
272
+ */
273
+ declare function renderIndent(content: string, renderContext: RenderContextProps): string;
274
+ declare function renderIntrinsic(children: FabricNode, context?: RenderContextProps): string;
275
+ //#endregion
210
276
  //#region src/plugins/types.d.ts
211
277
  type Plugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = {
212
278
  name: string;
@@ -227,11 +293,16 @@ declare global {
227
293
  interface Fabric {}
228
294
  }
229
295
  }
230
- /**
231
- * Component placeholder type.
232
- * May later be extended to support specific runtime renderers.
233
- */
234
-
296
+ type FabricElement<TProps extends object = object> = {
297
+ (): FabricNode;
298
+ type: string;
299
+ component: (props: TProps) => FabricNode;
300
+ props: TProps;
301
+ };
302
+ type FabricNode = FabricElement<any> | string | number | boolean | null | undefined | Intrinsic | Array<FabricNode>;
303
+ type FabricComponent<TProps extends object = object> = FabricElement<TProps> & {
304
+ children(...children: Array<FabricNode>): FabricElement<TProps>;
305
+ };
235
306
  /**
236
307
  * Defines core runtime options for Fabric.
237
308
  */
@@ -414,5 +485,5 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
414
485
  upsertFile(...files: File[]): Promise<void>;
415
486
  }
416
487
  //#endregion
417
- export { KubbFile_d_exports as _, FabricOptions as a, Source as b, FileManager as c, UserParser as d, BaseName as f, Import as g, File as h, FabricMode as i, FileProcessor as l, Extname as m, FabricConfig as n, Plugin as o, Export as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u, Path as v, __name as x, ResolvedFile as y };
418
- //# sourceMappingURL=Fabric-BoTE1-WX.d.cts.map
488
+ export { Path as A, UserParser as C, File as D, Extname as E, Source as M, __name as N, Import as O, Parser as S, Export as T, inject as _, FabricElement as a, FileManager as b, FabricOptions as c, renderIndent as d, renderIntrinsic as f, createContext as g, Context as h, FabricContext as i, ResolvedFile as j, KubbFile_d_exports as k, Plugin as l, RenderContextProps as m, FabricComponent as n, FabricMode as o, RenderContext as p, FabricConfig as r, FabricNode as s, Fabric as t, UserPlugin as u, provide as v, BaseName as w, FileProcessor as x, unprovide as y };
489
+ //# sourceMappingURL=Fabric-BbVC650D.d.cts.map
@@ -2,9 +2,8 @@ import { n as __name, t as __exportAll } from "./chunk-8X4u0d05.js";
2
2
 
3
3
  //#region src/KubbFile.d.ts
4
4
  declare namespace KubbFile_d_exports {
5
- export { AdvancedPath, BaseName, Export, Extname, File, Import, Mode, Path, ResolvedExport, ResolvedFile, ResolvedImport, Source };
5
+ export { BaseName, Export, Extname, File, Import, Mode, Path, ResolvedFile, Source };
6
6
  }
7
- type BasePath<T extends string = string> = `${T}/`;
8
7
  type Import = {
9
8
  /**
10
9
  * Import name to be used
@@ -78,7 +77,6 @@ type BaseName = `${string}.${string}`;
78
77
  * Path will be full qualified path to a specified file
79
78
  */
80
79
  type Path = string;
81
- type AdvancedPath<T extends BaseName = BaseName> = `${BasePath}${T}`;
82
80
  type File<TMeta extends object = object> = {
83
81
  /**
84
82
  * Name to be used to create the path
@@ -89,7 +87,7 @@ type File<TMeta extends object = object> = {
89
87
  /**
90
88
  * Path will be full qualified path to a specified file
91
89
  */
92
- path: AdvancedPath<BaseName> | Path;
90
+ path: Path;
93
91
  sources: Array<Source>;
94
92
  imports: Array<Import>;
95
93
  exports: Array<Export>;
@@ -100,8 +98,6 @@ type File<TMeta extends object = object> = {
100
98
  banner?: string;
101
99
  footer?: string;
102
100
  };
103
- type ResolvedImport = Import;
104
- type ResolvedExport = Export;
105
101
  type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
106
102
  /**
107
103
  * @default hash
@@ -113,8 +109,8 @@ type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
113
109
  */
114
110
  name: string;
115
111
  extname: Extname;
116
- imports: Array<ResolvedImport>;
117
- exports: Array<ResolvedExport>;
112
+ imports: Array<Import>;
113
+ exports: Array<Export>;
118
114
  };
119
115
  //#endregion
120
116
  //#region src/parsers/types.d.ts
@@ -210,6 +206,76 @@ declare class FileManager {
210
206
  write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
211
207
  }
212
208
  //#endregion
209
+ //#region src/context.d.ts
210
+ /**
211
+ * Context type that carries type information about its value
212
+ * This is a branded symbol type that enables type-safe context usage
213
+ */
214
+ type Context<T> = symbol & {
215
+ readonly __type: T;
216
+ };
217
+ /**
218
+ * Provides a value to descendant components (Vue 3 style)
219
+ *
220
+ * @example
221
+ * ```ts
222
+ * const ThemeKey = Symbol('theme')
223
+ * provide(ThemeKey, { color: 'blue' })
224
+ * ```
225
+ */
226
+ declare function provide<T>(key: symbol | Context<T>, value: T): void;
227
+ /**
228
+ * Injects a value provided by an ancestor component (Vue 3 style)
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * const theme = inject(ThemeKey, { color: 'default' })
233
+ * ```
234
+ */
235
+ declare function inject<T>(key: symbol | Context<T>, defaultValue?: T): T;
236
+ /**
237
+ * Unprovides a value (for cleanup)
238
+ * @internal
239
+ */
240
+ declare function unprovide<T>(key: symbol | Context<T>): void;
241
+ /**
242
+ * Creates a context key with a default value (React-style compatibility)
243
+ *
244
+ * @example
245
+ * ```ts
246
+ * const ThemeContext = createContext({ color: 'blue' })
247
+ * // ThemeContext is now typed as Context<{ color: string }>
248
+ * const theme = useContext(ThemeContext) // theme is { color: string }
249
+ * ```
250
+ */
251
+ declare function createContext<T>(defaultValue: T): Context<T>;
252
+ //#endregion
253
+ //#region src/contexts/RenderContext.d.ts
254
+ type RenderContextProps = {
255
+ indentLevel: number;
256
+ indentSize: number;
257
+ currentLineLength: number;
258
+ shouldBreak: boolean;
259
+ };
260
+ /**
261
+ * Provides a context for tracking rendering state such as indentation and line length.
262
+ */
263
+ declare const RenderContext: Context<RenderContextProps>;
264
+ //#endregion
265
+ //#region src/intrinsic.d.ts
266
+ type IntrinsicType = 'br' | 'indent' | 'dedent';
267
+ type Intrinsic = {
268
+ type: IntrinsicType;
269
+ __intrinsic: true;
270
+ };
271
+ /**
272
+ * Helper: render a plain string while applying current indentation at the
273
+ * start of each logical line. This ensures `${indent}` intrinsics affect
274
+ * subsequent string content.
275
+ */
276
+ declare function renderIndent(content: string, renderContext: RenderContextProps): string;
277
+ declare function renderIntrinsic(children: FabricNode, context?: RenderContextProps): string;
278
+ //#endregion
213
279
  //#region src/plugins/types.d.ts
214
280
  type Plugin<TOptions = unknown, TAppExtension extends Record<string, any> = {}> = {
215
281
  name: string;
@@ -230,11 +296,16 @@ declare global {
230
296
  interface Fabric {}
231
297
  }
232
298
  }
233
- /**
234
- * Component placeholder type.
235
- * May later be extended to support specific runtime renderers.
236
- */
237
-
299
+ type FabricElement<TProps extends object = object> = {
300
+ (): FabricNode;
301
+ type: string;
302
+ component: (props: TProps) => FabricNode;
303
+ props: TProps;
304
+ };
305
+ type FabricNode = FabricElement<any> | string | number | boolean | null | undefined | Intrinsic | Array<FabricNode>;
306
+ type FabricComponent<TProps extends object = object> = FabricElement<TProps> & {
307
+ children(...children: Array<FabricNode>): FabricElement<TProps>;
308
+ };
238
309
  /**
239
310
  * Defines core runtime options for Fabric.
240
311
  */
@@ -417,5 +488,5 @@ interface Fabric<T extends FabricOptions = FabricOptions> extends Kubb.Fabric {
417
488
  upsertFile(...files: File[]): Promise<void>;
418
489
  }
419
490
  //#endregion
420
- export { KubbFile_d_exports as _, FabricOptions as a, Source as b, FileManager as c, UserParser as d, BaseName as f, Import as g, File as h, FabricMode as i, FileProcessor as l, Extname as m, FabricConfig as n, Plugin as o, Export as p, FabricContext as r, UserPlugin as s, Fabric as t, Parser as u, Path as v, ResolvedFile as y };
421
- //# sourceMappingURL=Fabric-CWquRFa2.d.ts.map
491
+ export { Path as A, UserParser as C, File as D, Extname as E, Source as M, Import as O, Parser as S, Export as T, inject as _, FabricElement as a, FileManager as b, FabricOptions as c, renderIndent as d, renderIntrinsic as f, createContext as g, Context as h, FabricContext as i, ResolvedFile as j, KubbFile_d_exports as k, Plugin as l, RenderContextProps as m, FabricComponent as n, FabricMode as o, RenderContext as p, FabricConfig as r, FabricNode as s, Fabric as t, UserPlugin as u, provide as v, BaseName as w, FileProcessor as x, unprovide as y };
492
+ //# sourceMappingURL=Fabric-eh92yS1R.d.ts.map