@kubb/react-fabric 0.1.3 → 0.1.4

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 (49) hide show
  1. package/dist/App-2SatilGX.d.ts +174 -0
  2. package/dist/App-DwUtyfk9.d.cts +174 -0
  3. package/dist/{globals-BQ_tJj2b.d.ts → KubbFile-D4gyyfL-.d.ts} +1 -52
  4. package/dist/{globals-C-9ezLk9.d.cts → KubbFile-FGXV713i.d.cts} +1 -52
  5. package/dist/Runtime-DWlDUeLZ.js +15482 -0
  6. package/dist/Runtime-DWlDUeLZ.js.map +1 -0
  7. package/dist/Runtime-JI640uK4.cjs +15520 -0
  8. package/dist/Runtime-JI640uK4.cjs.map +1 -0
  9. package/dist/globals-BRG2DOJd.d.cts +52 -0
  10. package/dist/globals-D_1Lfe9-.d.ts +52 -0
  11. package/dist/globals.d.cts +3 -2
  12. package/dist/globals.d.ts +3 -2
  13. package/dist/index.cjs +150 -15635
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +50 -202
  16. package/dist/index.d.ts +50 -202
  17. package/dist/index.js +6 -15494
  18. package/dist/index.js.map +1 -1
  19. package/dist/{jsx-runtime-BPQkRAg2.js → jsx-runtime-Dg-pJBHd.js} +1 -1
  20. package/dist/{jsx-runtime-BPQkRAg2.js.map → jsx-runtime-Dg-pJBHd.js.map} +1 -1
  21. package/dist/{jsx-runtime-B3MMb3PL.cjs → jsx-runtime-d2dmYscH.cjs} +1 -1
  22. package/dist/{jsx-runtime-B3MMb3PL.cjs.map → jsx-runtime-d2dmYscH.cjs.map} +1 -1
  23. package/dist/jsx-runtime.cjs +1 -1
  24. package/dist/jsx-runtime.d.cts +3 -2
  25. package/dist/jsx-runtime.d.ts +3 -2
  26. package/dist/jsx-runtime.js +1 -1
  27. package/dist/parsers.cjs +9 -0
  28. package/dist/parsers.d.cts +18 -0
  29. package/dist/parsers.d.ts +18 -0
  30. package/dist/parsers.js +3 -0
  31. package/dist/plugins.cjs +40 -0
  32. package/dist/plugins.cjs.map +1 -0
  33. package/dist/plugins.d.cts +55 -0
  34. package/dist/plugins.d.ts +55 -0
  35. package/dist/plugins.js +34 -0
  36. package/dist/plugins.js.map +1 -0
  37. package/dist/{types-D9OfSq91.d.ts → types-Brnyan9B.d.ts} +1 -1
  38. package/dist/{types-CUKR3KZn.d.cts → types-C3p0Ljxf.d.cts} +1 -1
  39. package/dist/types.d.cts +1 -1
  40. package/dist/types.d.ts +1 -1
  41. package/package.json +16 -2
  42. package/src/{kubbRenderer.ts → Renderer.ts} +1 -1
  43. package/src/{ReactTemplate.tsx → Runtime.tsx} +36 -30
  44. package/src/index.ts +9 -1
  45. package/src/parsers/index.ts +1 -0
  46. package/src/plugins/index.ts +3 -0
  47. package/src/plugins/reactPlugin.ts +47 -0
  48. package/src/utils/processFiles.ts +5 -4
  49. package/src/createApp.ts +0 -19
@@ -0,0 +1,174 @@
1
+ import { i as File, o as Path, r as Extname, s as ResolvedFile } from "./KubbFile-D4gyyfL-.js";
2
+
3
+ //#region ../fabric-core/src/plugins/types.d.ts
4
+ type Plugin<TOptions = any[], TAppExtension$1 extends Record<string, any> = {}> = {
5
+ name: string;
6
+ type: 'plugin';
7
+ scope?: 'write' | 'read' | (string & {});
8
+ install: Install<TOptions> | Promise<Install<TOptions>>;
9
+ /**
10
+ * Runtime app overrides or extensions.
11
+ * Merged into the app instance after install.
12
+ */
13
+ inject?: Inject<TOptions, TAppExtension$1>;
14
+ };
15
+ type UserPlugin<TOptions = any[], TAppExtension$1 extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension$1>, 'type'>;
16
+ //#endregion
17
+ //#region ../fabric-core/src/parsers/types.d.ts
18
+ type PrintOptions = {
19
+ extname?: Extname;
20
+ };
21
+ type Parser<TOptions = any[], TMeta$1 extends object = any> = {
22
+ name: string;
23
+ type: 'parser';
24
+ /**
25
+ * Undefined is being used for the defaultParser
26
+ */
27
+ extNames: Array<Extname> | undefined;
28
+ install: Install<TOptions>;
29
+ /**
30
+ * Convert a file to string
31
+ */
32
+ parse(file: ResolvedFile<TMeta$1>, options: PrintOptions): Promise<string>;
33
+ };
34
+ type UserParser<TOptions = any[], TMeta$1 extends object = any> = Omit<Parser<TOptions, TMeta$1>, 'type'>;
35
+ //#endregion
36
+ //#region ../fabric-core/src/utils/AsyncEventEmitter.d.ts
37
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
38
+ #private;
39
+ constructor(maxListener?: number);
40
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
41
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
42
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
43
+ removeAll(): void;
44
+ }
45
+ //#endregion
46
+ //#region ../fabric-core/src/FileProcessor.d.ts
47
+ type ProcessFilesProps = {
48
+ parsers?: Set<Parser>;
49
+ extension?: Record<Extname, Extname | ''>;
50
+ dryRun?: boolean;
51
+ };
52
+ type GetParseOptions = {
53
+ parsers?: Set<Parser>;
54
+ extension?: Record<Extname, Extname | ''>;
55
+ };
56
+ type Options$1 = {
57
+ events?: AsyncEventEmitter<AppEvents>;
58
+ };
59
+ declare class FileProcessor {
60
+ #private;
61
+ events: AsyncEventEmitter<AppEvents>;
62
+ constructor({
63
+ events
64
+ }?: Options$1);
65
+ parse(file: ResolvedFile, {
66
+ parsers,
67
+ extension
68
+ }?: GetParseOptions): Promise<string>;
69
+ run(files: Array<ResolvedFile>, {
70
+ parsers,
71
+ dryRun,
72
+ extension
73
+ }?: ProcessFilesProps): Promise<ResolvedFile[]>;
74
+ }
75
+ //#endregion
76
+ //#region ../fabric-core/src/FileManager.d.ts
77
+ type Options = {
78
+ events?: AsyncEventEmitter<AppEvents>;
79
+ };
80
+ declare class FileManager {
81
+ #private;
82
+ processor: FileProcessor;
83
+ constructor({
84
+ events
85
+ }?: Options);
86
+ add(...files: Array<File>): Promise<ResolvedFile<object>[]>;
87
+ flush(): void;
88
+ getByPath(path: Path): ResolvedFile | null;
89
+ deleteByPath(path: Path): void;
90
+ clear(): void;
91
+ get files(): Array<ResolvedFile>;
92
+ write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
93
+ }
94
+ //#endregion
95
+ //#region ../fabric-core/src/App.d.ts
96
+ type Component = any;
97
+ type AppEvents = {
98
+ /**
99
+ * Called in the beginning of the app lifecycle.
100
+ */
101
+ start: [{
102
+ app: App;
103
+ }];
104
+ /**
105
+ * Called in the end of the app lifecycle.
106
+ */
107
+ end: [{
108
+ app: App;
109
+ }];
110
+ /**
111
+ * Called when being rendered
112
+ */
113
+ render: [{
114
+ app: App;
115
+ }];
116
+ /**
117
+ * Called once before processing any files.
118
+ */
119
+ 'process:start': [{
120
+ files: ResolvedFile[];
121
+ }];
122
+ /**
123
+ * Called for each file when processing begins.
124
+ */
125
+ 'file:start': [{
126
+ file: ResolvedFile;
127
+ index: number;
128
+ total: number;
129
+ }];
130
+ /**
131
+ * Called for each file when processing finishes.
132
+ */
133
+ 'file:end': [{
134
+ file: ResolvedFile;
135
+ index: number;
136
+ total: number;
137
+ }];
138
+ /**
139
+ * Called periodically (or after each file) to indicate progress.
140
+ * Useful for progress bars or logging.
141
+ */
142
+ 'process:progress': [{
143
+ processed: number;
144
+ total: number;
145
+ percentage: number;
146
+ source: string;
147
+ file: ResolvedFile;
148
+ }];
149
+ /**
150
+ * Called once all files have been processed successfully.
151
+ */
152
+ 'process:end': [{
153
+ files: ResolvedFile[];
154
+ }];
155
+ };
156
+ type AppContext<TOptions = unknown> = {
157
+ options?: TOptions;
158
+ events: AsyncEventEmitter<AppEvents>;
159
+ fileManager: FileManager;
160
+ installedPlugins: Set<Plugin>;
161
+ installedParsers: Set<Parser>;
162
+ };
163
+ type Install<TOptions = any[] | object | undefined> = TOptions extends any[] ? (app: App, ...options: TOptions) => void : TOptions extends object ? (app: App, options?: TOptions) => void : (app: App) => void;
164
+ type Inject<TOptions = any[] | object | undefined, TAppExtension$1 extends Record<string, any> = {}> = TOptions extends any[] ? (app: App, ...options: TOptions) => Partial<TAppExtension$1> : TOptions extends object ? (app: App, options?: TOptions) => Partial<TAppExtension$1> : (app: App) => Partial<TAppExtension$1>;
165
+ interface App<TOptions = unknown> {
166
+ context: AppContext<TOptions>;
167
+ files: Array<ResolvedFile>;
168
+ use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>, ...options: TOptions extends any[] ? NoInfer<TOptions> : [NoInfer<TOptions>]): this & TAppExtension;
169
+ use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>): this & TAppExtension;
170
+ addFile(...files: Array<File>): Promise<void>;
171
+ }
172
+ //#endregion
173
+ export { UserParser as a, Parser as i, Component as n, Plugin as o, FileManager as r, UserPlugin as s, App as t };
174
+ //# sourceMappingURL=App-2SatilGX.d.ts.map
@@ -0,0 +1,174 @@
1
+ import { i as File, o as Path, r as Extname, s as ResolvedFile } from "./KubbFile-FGXV713i.cjs";
2
+
3
+ //#region ../fabric-core/src/plugins/types.d.ts
4
+ type Plugin<TOptions = any[], TAppExtension$1 extends Record<string, any> = {}> = {
5
+ name: string;
6
+ type: 'plugin';
7
+ scope?: 'write' | 'read' | (string & {});
8
+ install: Install<TOptions> | Promise<Install<TOptions>>;
9
+ /**
10
+ * Runtime app overrides or extensions.
11
+ * Merged into the app instance after install.
12
+ */
13
+ inject?: Inject<TOptions, TAppExtension$1>;
14
+ };
15
+ type UserPlugin<TOptions = any[], TAppExtension$1 extends Record<string, any> = {}> = Omit<Plugin<TOptions, TAppExtension$1>, 'type'>;
16
+ //#endregion
17
+ //#region ../fabric-core/src/parsers/types.d.ts
18
+ type PrintOptions = {
19
+ extname?: Extname;
20
+ };
21
+ type Parser<TOptions = any[], TMeta$1 extends object = any> = {
22
+ name: string;
23
+ type: 'parser';
24
+ /**
25
+ * Undefined is being used for the defaultParser
26
+ */
27
+ extNames: Array<Extname> | undefined;
28
+ install: Install<TOptions>;
29
+ /**
30
+ * Convert a file to string
31
+ */
32
+ parse(file: ResolvedFile<TMeta$1>, options: PrintOptions): Promise<string>;
33
+ };
34
+ type UserParser<TOptions = any[], TMeta$1 extends object = any> = Omit<Parser<TOptions, TMeta$1>, 'type'>;
35
+ //#endregion
36
+ //#region ../fabric-core/src/utils/AsyncEventEmitter.d.ts
37
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
38
+ #private;
39
+ constructor(maxListener?: number);
40
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
41
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
42
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
43
+ removeAll(): void;
44
+ }
45
+ //#endregion
46
+ //#region ../fabric-core/src/FileProcessor.d.ts
47
+ type ProcessFilesProps = {
48
+ parsers?: Set<Parser>;
49
+ extension?: Record<Extname, Extname | ''>;
50
+ dryRun?: boolean;
51
+ };
52
+ type GetParseOptions = {
53
+ parsers?: Set<Parser>;
54
+ extension?: Record<Extname, Extname | ''>;
55
+ };
56
+ type Options$1 = {
57
+ events?: AsyncEventEmitter<AppEvents>;
58
+ };
59
+ declare class FileProcessor {
60
+ #private;
61
+ events: AsyncEventEmitter<AppEvents>;
62
+ constructor({
63
+ events
64
+ }?: Options$1);
65
+ parse(file: ResolvedFile, {
66
+ parsers,
67
+ extension
68
+ }?: GetParseOptions): Promise<string>;
69
+ run(files: Array<ResolvedFile>, {
70
+ parsers,
71
+ dryRun,
72
+ extension
73
+ }?: ProcessFilesProps): Promise<ResolvedFile[]>;
74
+ }
75
+ //#endregion
76
+ //#region ../fabric-core/src/FileManager.d.ts
77
+ type Options = {
78
+ events?: AsyncEventEmitter<AppEvents>;
79
+ };
80
+ declare class FileManager {
81
+ #private;
82
+ processor: FileProcessor;
83
+ constructor({
84
+ events
85
+ }?: Options);
86
+ add(...files: Array<File>): Promise<ResolvedFile<object>[]>;
87
+ flush(): void;
88
+ getByPath(path: Path): ResolvedFile | null;
89
+ deleteByPath(path: Path): void;
90
+ clear(): void;
91
+ get files(): Array<ResolvedFile>;
92
+ write(options: ProcessFilesProps): Promise<ResolvedFile[]>;
93
+ }
94
+ //#endregion
95
+ //#region ../fabric-core/src/App.d.ts
96
+ type Component = any;
97
+ type AppEvents = {
98
+ /**
99
+ * Called in the beginning of the app lifecycle.
100
+ */
101
+ start: [{
102
+ app: App;
103
+ }];
104
+ /**
105
+ * Called in the end of the app lifecycle.
106
+ */
107
+ end: [{
108
+ app: App;
109
+ }];
110
+ /**
111
+ * Called when being rendered
112
+ */
113
+ render: [{
114
+ app: App;
115
+ }];
116
+ /**
117
+ * Called once before processing any files.
118
+ */
119
+ 'process:start': [{
120
+ files: ResolvedFile[];
121
+ }];
122
+ /**
123
+ * Called for each file when processing begins.
124
+ */
125
+ 'file:start': [{
126
+ file: ResolvedFile;
127
+ index: number;
128
+ total: number;
129
+ }];
130
+ /**
131
+ * Called for each file when processing finishes.
132
+ */
133
+ 'file:end': [{
134
+ file: ResolvedFile;
135
+ index: number;
136
+ total: number;
137
+ }];
138
+ /**
139
+ * Called periodically (or after each file) to indicate progress.
140
+ * Useful for progress bars or logging.
141
+ */
142
+ 'process:progress': [{
143
+ processed: number;
144
+ total: number;
145
+ percentage: number;
146
+ source: string;
147
+ file: ResolvedFile;
148
+ }];
149
+ /**
150
+ * Called once all files have been processed successfully.
151
+ */
152
+ 'process:end': [{
153
+ files: ResolvedFile[];
154
+ }];
155
+ };
156
+ type AppContext<TOptions = unknown> = {
157
+ options?: TOptions;
158
+ events: AsyncEventEmitter<AppEvents>;
159
+ fileManager: FileManager;
160
+ installedPlugins: Set<Plugin>;
161
+ installedParsers: Set<Parser>;
162
+ };
163
+ type Install<TOptions = any[] | object | undefined> = TOptions extends any[] ? (app: App, ...options: TOptions) => void : TOptions extends object ? (app: App, options?: TOptions) => void : (app: App) => void;
164
+ type Inject<TOptions = any[] | object | undefined, TAppExtension$1 extends Record<string, any> = {}> = TOptions extends any[] ? (app: App, ...options: TOptions) => Partial<TAppExtension$1> : TOptions extends object ? (app: App, options?: TOptions) => Partial<TAppExtension$1> : (app: App) => Partial<TAppExtension$1>;
165
+ interface App<TOptions = unknown> {
166
+ context: AppContext<TOptions>;
167
+ files: Array<ResolvedFile>;
168
+ use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>, ...options: TOptions extends any[] ? NoInfer<TOptions> : [NoInfer<TOptions>]): this & TAppExtension;
169
+ use<TOptions extends any[] | object = any, TMeta extends object = object, TAppExtension extends Record<string, any> = {}>(pluginOrParser: Plugin<TOptions, TAppExtension> | Parser<TOptions, TMeta>): this & TAppExtension;
170
+ addFile(...files: Array<File>): Promise<void>;
171
+ }
172
+ //#endregion
173
+ export { UserParser as a, Parser as i, Component as n, Plugin as o, FileManager as r, UserPlugin as s, App as t };
174
+ //# sourceMappingURL=App-DwUtyfk9.d.cts.map
@@ -1,6 +1,3 @@
1
- import { s as KubbNode } from "./types-D9OfSq91.js";
2
- import React from "react";
3
-
4
1
  //#region ../fabric-core/src/KubbFile.d.ts
5
2
  type BasePath<T extends string = string> = `${T}/`;
6
3
  type Import = {
@@ -114,53 +111,5 @@ type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
114
111
  exports: Array<ResolvedExport>;
115
112
  };
116
113
  //#endregion
117
- //#region src/globals.d.ts
118
- declare module 'react' {
119
- namespace JSX {
120
- interface IntrinsicElements {
121
- 'kubb-text': {
122
- children?: KubbNode;
123
- };
124
- 'kubb-file': {
125
- id?: string;
126
- children?: KubbNode;
127
- baseName: string;
128
- path: string;
129
- override?: boolean;
130
- meta?: File['meta'];
131
- };
132
- 'kubb-source': Source & {
133
- children?: KubbNode;
134
- };
135
- 'kubb-import': Import;
136
- 'kubb-export': Export;
137
- br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
138
- }
139
- }
140
- }
141
- declare module '@kubb/react-fabric/jsx-runtime' {
142
- namespace JSX {
143
- interface IntrinsicElements {
144
- 'kubb-text': {
145
- children?: KubbNode;
146
- };
147
- 'kubb-file': {
148
- id?: string;
149
- children?: KubbNode;
150
- baseName: string;
151
- path: string;
152
- override?: boolean;
153
- meta?: File['meta'];
154
- };
155
- 'kubb-source': Source & {
156
- children?: KubbNode;
157
- };
158
- 'kubb-import': Import;
159
- 'kubb-export': Export;
160
- br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
161
- }
162
- }
163
- }
164
- //#endregion
165
114
  export { Import as a, Source as c, File as i, Export as n, Path as o, Extname as r, ResolvedFile as s, BaseName as t };
166
- //# sourceMappingURL=globals-BQ_tJj2b.d.ts.map
115
+ //# sourceMappingURL=KubbFile-D4gyyfL-.d.ts.map
@@ -1,6 +1,3 @@
1
- import { s as KubbNode } from "./types-CUKR3KZn.cjs";
2
- import React from "react";
3
-
4
1
  //#region ../fabric-core/src/KubbFile.d.ts
5
2
  type BasePath<T extends string = string> = `${T}/`;
6
3
  type Import = {
@@ -114,53 +111,5 @@ type ResolvedFile<TMeta extends object = object> = File<TMeta> & {
114
111
  exports: Array<ResolvedExport>;
115
112
  };
116
113
  //#endregion
117
- //#region src/globals.d.ts
118
- declare module 'react' {
119
- namespace JSX {
120
- interface IntrinsicElements {
121
- 'kubb-text': {
122
- children?: KubbNode;
123
- };
124
- 'kubb-file': {
125
- id?: string;
126
- children?: KubbNode;
127
- baseName: string;
128
- path: string;
129
- override?: boolean;
130
- meta?: File['meta'];
131
- };
132
- 'kubb-source': Source & {
133
- children?: KubbNode;
134
- };
135
- 'kubb-import': Import;
136
- 'kubb-export': Export;
137
- br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
138
- }
139
- }
140
- }
141
- declare module '@kubb/react-fabric/jsx-runtime' {
142
- namespace JSX {
143
- interface IntrinsicElements {
144
- 'kubb-text': {
145
- children?: KubbNode;
146
- };
147
- 'kubb-file': {
148
- id?: string;
149
- children?: KubbNode;
150
- baseName: string;
151
- path: string;
152
- override?: boolean;
153
- meta?: File['meta'];
154
- };
155
- 'kubb-source': Source & {
156
- children?: KubbNode;
157
- };
158
- 'kubb-import': Import;
159
- 'kubb-export': Export;
160
- br: React.DetailedHTMLProps<React.HTMLAttributes<HTMLBRElement>, HTMLBRElement>;
161
- }
162
- }
163
- }
164
- //#endregion
165
114
  export { Import as a, Source as c, File as i, Export as n, Path as o, Extname as r, ResolvedFile as s, BaseName as t };
166
- //# sourceMappingURL=globals-C-9ezLk9.d.cts.map
115
+ //# sourceMappingURL=KubbFile-FGXV713i.d.cts.map