@kubb/react-fabric 0.0.0-canary-20251020201500 → 0.0.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.
- package/dist/index.cjs +46 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -20
- package/dist/index.d.ts +47 -20
- package/dist/index.js +46 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/ReactTemplate.tsx +5 -4
- package/src/components/Const.tsx +17 -4
- package/src/components/Function.tsx +38 -6
- package/src/components/Root.tsx +9 -5
- package/src/components/Text.tsx +31 -0
- package/src/components/Type.tsx +7 -1
- package/src/createApp.ts +2 -1
- package/src/dom.ts +3 -5
- package/src/hooks/useApp.ts +2 -2
- package/src/index.ts +1 -0
- package/src/utils/throttle.ts +30 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Import, c as Source, i as File$1, n as Export, o as Path, r as Extname, s as ResolvedFile, t as BaseName } from "./globals-CnATk-Sl.cjs";
|
|
2
2
|
import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-C3p0Ljxf.cjs";
|
|
3
3
|
import * as react1 from "react";
|
|
4
|
-
import React from "react";
|
|
4
|
+
import React, { ElementType } from "react";
|
|
5
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region ../fabric-core/src/defineApp.d.ts
|
|
@@ -12,21 +12,21 @@ type ObjectPlugin<Options$1 = any[]> = {
|
|
|
12
12
|
};
|
|
13
13
|
type FunctionPlugin<Options$1 = any[]> = PluginInstallFunction<Options$1> & Partial<ObjectPlugin<Options$1>>;
|
|
14
14
|
type Plugin<Options$1 = any[], P extends unknown[] = (Options$1 extends unknown[] ? Options$1 : [Options$1])> = FunctionPlugin<P> | ObjectPlugin<P>;
|
|
15
|
-
|
|
16
|
-
extension?: Record<Extname, Extname | ''>;
|
|
17
|
-
dryRun?: boolean;
|
|
18
|
-
};
|
|
19
|
-
interface App$1 {
|
|
15
|
+
interface App$1<_THostElement = unknown> {
|
|
20
16
|
_component: Component;
|
|
21
17
|
render(): Promise<void>;
|
|
22
18
|
renderToString(): Promise<string>;
|
|
23
19
|
getFiles(): Promise<Array<ResolvedFile>>;
|
|
24
20
|
use<Options>(plugin: Plugin<Options>, options: NoInfer<Options>): this;
|
|
25
|
-
write(
|
|
21
|
+
write(): Promise<void>;
|
|
26
22
|
addFile(...files: Array<File$1>): Promise<void>;
|
|
27
23
|
waitUntilExit(): Promise<void>;
|
|
28
24
|
}
|
|
29
|
-
type
|
|
25
|
+
type DefineOptions = {
|
|
26
|
+
extension?: Record<Extname, Extname | ''>;
|
|
27
|
+
dryRun?: boolean;
|
|
28
|
+
};
|
|
29
|
+
type DefineApp<THostElement> = (rootComponent?: Component, options?: DefineOptions) => App$1<THostElement>;
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/components/App.d.ts
|
|
32
32
|
type AppContextProps<TMeta = unknown> = {
|
|
@@ -36,21 +36,21 @@ type AppContextProps<TMeta = unknown> = {
|
|
|
36
36
|
readonly exit: (error?: Error) => void;
|
|
37
37
|
readonly meta: TMeta;
|
|
38
38
|
};
|
|
39
|
-
type Props$
|
|
39
|
+
type Props$5<TMeta = unknown> = {
|
|
40
40
|
readonly children?: KubbNode;
|
|
41
41
|
readonly meta: TMeta;
|
|
42
42
|
};
|
|
43
43
|
declare function App<TMeta = unknown>({
|
|
44
44
|
meta,
|
|
45
45
|
children
|
|
46
|
-
}: Props$
|
|
46
|
+
}: Props$5<TMeta>): react_jsx_runtime0.JSX.Element;
|
|
47
47
|
declare namespace App {
|
|
48
48
|
var Context: react1.Context<AppContextProps<unknown> | undefined>;
|
|
49
49
|
var displayName: string;
|
|
50
50
|
}
|
|
51
51
|
//#endregion
|
|
52
52
|
//#region src/components/Const.d.ts
|
|
53
|
-
type Props$
|
|
53
|
+
type Props$4 = {
|
|
54
54
|
key?: Key;
|
|
55
55
|
/**
|
|
56
56
|
* Name of the const
|
|
@@ -81,7 +81,7 @@ declare function Const({
|
|
|
81
81
|
JSDoc,
|
|
82
82
|
asConst,
|
|
83
83
|
children
|
|
84
|
-
}: Props$
|
|
84
|
+
}: Props$4): react_jsx_runtime0.JSX.Element;
|
|
85
85
|
declare namespace Const {
|
|
86
86
|
var displayName: string;
|
|
87
87
|
}
|
|
@@ -120,7 +120,7 @@ type BasePropsWithoutBaseName = {
|
|
|
120
120
|
path?: Path;
|
|
121
121
|
};
|
|
122
122
|
type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
|
|
123
|
-
type Props$
|
|
123
|
+
type Props$3<TMeta> = BaseProps & {
|
|
124
124
|
key?: Key;
|
|
125
125
|
meta?: TMeta;
|
|
126
126
|
banner?: string;
|
|
@@ -130,7 +130,7 @@ type Props$2<TMeta> = BaseProps & {
|
|
|
130
130
|
declare function File<TMeta extends object = object>({
|
|
131
131
|
children,
|
|
132
132
|
...rest
|
|
133
|
-
}: Props$
|
|
133
|
+
}: Props$3<TMeta>): react_jsx_runtime0.JSX.Element;
|
|
134
134
|
declare namespace File {
|
|
135
135
|
var displayName: string;
|
|
136
136
|
var Export: typeof FileExport;
|
|
@@ -179,7 +179,7 @@ declare namespace FileImport {
|
|
|
179
179
|
}
|
|
180
180
|
//#endregion
|
|
181
181
|
//#region src/components/Function.d.ts
|
|
182
|
-
type Props$
|
|
182
|
+
type Props$2 = {
|
|
183
183
|
key?: Key;
|
|
184
184
|
/**
|
|
185
185
|
* Name of the function.
|
|
@@ -226,12 +226,12 @@ declare function Function({
|
|
|
226
226
|
returnType,
|
|
227
227
|
JSDoc,
|
|
228
228
|
children
|
|
229
|
-
}: Props$
|
|
229
|
+
}: Props$2): react_jsx_runtime0.JSX.Element;
|
|
230
230
|
declare namespace Function {
|
|
231
231
|
var displayName: string;
|
|
232
232
|
var Arrow: typeof ArrowFunction;
|
|
233
233
|
}
|
|
234
|
-
type ArrowFunctionProps = Props$
|
|
234
|
+
type ArrowFunctionProps = Props$2 & {
|
|
235
235
|
/**
|
|
236
236
|
* Create Arrow function in one line
|
|
237
237
|
*/
|
|
@@ -267,6 +267,33 @@ declare function Indent({
|
|
|
267
267
|
children
|
|
268
268
|
}: IndentProps): react_jsx_runtime0.JSX.Element | null;
|
|
269
269
|
//#endregion
|
|
270
|
+
//#region src/components/Text.d.ts
|
|
271
|
+
type Props$1 = {
|
|
272
|
+
key?: Key;
|
|
273
|
+
/**
|
|
274
|
+
* Change the indent.
|
|
275
|
+
* @default 0
|
|
276
|
+
* @deprecated
|
|
277
|
+
*/
|
|
278
|
+
indentSize?: number;
|
|
279
|
+
children?: KubbNode;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* @deprecated
|
|
283
|
+
*/
|
|
284
|
+
declare function Text({
|
|
285
|
+
children
|
|
286
|
+
}: Props$1): react_jsx_runtime0.JSX.Element;
|
|
287
|
+
declare namespace Text {
|
|
288
|
+
var displayName: string;
|
|
289
|
+
var Space: typeof Space;
|
|
290
|
+
}
|
|
291
|
+
type SpaceProps = {};
|
|
292
|
+
declare function Space({}: SpaceProps): react_jsx_runtime0.JSX.Element;
|
|
293
|
+
declare namespace Space {
|
|
294
|
+
var displayName: string;
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
270
297
|
//#region src/components/Type.d.ts
|
|
271
298
|
type Props = {
|
|
272
299
|
key?: Key;
|
|
@@ -295,13 +322,13 @@ declare namespace Type {
|
|
|
295
322
|
}
|
|
296
323
|
//#endregion
|
|
297
324
|
//#region src/createApp.d.ts
|
|
298
|
-
declare const createApp: DefineApp
|
|
325
|
+
declare const createApp: DefineApp<ElementType>;
|
|
299
326
|
//#endregion
|
|
300
327
|
//#region src/hooks/useApp.d.ts
|
|
301
328
|
/**
|
|
302
329
|
* `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
|
|
303
330
|
*/
|
|
304
|
-
declare function useApp
|
|
331
|
+
declare function useApp(): AppContextProps;
|
|
305
332
|
//#endregion
|
|
306
333
|
//#region src/hooks/useFile.d.ts
|
|
307
334
|
/**
|
|
@@ -327,5 +354,5 @@ declare const useRef: typeof react1.useRef;
|
|
|
327
354
|
declare const use: typeof react1.use;
|
|
328
355
|
declare const useReducer: typeof react1.useReducer;
|
|
329
356
|
//#endregion
|
|
330
|
-
export { App, Const, File, Function, FunctionParams, Indent, Type, createApp, createContext, createElement, createFunctionParams, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
|
|
357
|
+
export { App, Const, File, Function, FunctionParams, Indent, Text, Type, createApp, createContext, createElement, createFunctionParams, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
|
|
331
358
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as Import, c as Source, i as File$1, n as Export, o as Path, r as Extname, s as ResolvedFile, t as BaseName } from "./globals-C6rGETh5.js";
|
|
2
2
|
import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-DEroxUW0.js";
|
|
3
3
|
import * as react1 from "react";
|
|
4
|
-
import React from "react";
|
|
4
|
+
import React, { ElementType } from "react";
|
|
5
5
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region ../fabric-core/src/defineApp.d.ts
|
|
@@ -12,21 +12,21 @@ type ObjectPlugin<Options$1 = any[]> = {
|
|
|
12
12
|
};
|
|
13
13
|
type FunctionPlugin<Options$1 = any[]> = PluginInstallFunction<Options$1> & Partial<ObjectPlugin<Options$1>>;
|
|
14
14
|
type Plugin<Options$1 = any[], P extends unknown[] = (Options$1 extends unknown[] ? Options$1 : [Options$1])> = FunctionPlugin<P> | ObjectPlugin<P>;
|
|
15
|
-
|
|
16
|
-
extension?: Record<Extname, Extname | ''>;
|
|
17
|
-
dryRun?: boolean;
|
|
18
|
-
};
|
|
19
|
-
interface App$1 {
|
|
15
|
+
interface App$1<_THostElement = unknown> {
|
|
20
16
|
_component: Component;
|
|
21
17
|
render(): Promise<void>;
|
|
22
18
|
renderToString(): Promise<string>;
|
|
23
19
|
getFiles(): Promise<Array<ResolvedFile>>;
|
|
24
20
|
use<Options>(plugin: Plugin<Options>, options: NoInfer<Options>): this;
|
|
25
|
-
write(
|
|
21
|
+
write(): Promise<void>;
|
|
26
22
|
addFile(...files: Array<File$1>): Promise<void>;
|
|
27
23
|
waitUntilExit(): Promise<void>;
|
|
28
24
|
}
|
|
29
|
-
type
|
|
25
|
+
type DefineOptions = {
|
|
26
|
+
extension?: Record<Extname, Extname | ''>;
|
|
27
|
+
dryRun?: boolean;
|
|
28
|
+
};
|
|
29
|
+
type DefineApp<THostElement> = (rootComponent?: Component, options?: DefineOptions) => App$1<THostElement>;
|
|
30
30
|
//#endregion
|
|
31
31
|
//#region src/components/App.d.ts
|
|
32
32
|
type AppContextProps<TMeta = unknown> = {
|
|
@@ -36,21 +36,21 @@ type AppContextProps<TMeta = unknown> = {
|
|
|
36
36
|
readonly exit: (error?: Error) => void;
|
|
37
37
|
readonly meta: TMeta;
|
|
38
38
|
};
|
|
39
|
-
type Props$
|
|
39
|
+
type Props$5<TMeta = unknown> = {
|
|
40
40
|
readonly children?: KubbNode;
|
|
41
41
|
readonly meta: TMeta;
|
|
42
42
|
};
|
|
43
43
|
declare function App<TMeta = unknown>({
|
|
44
44
|
meta,
|
|
45
45
|
children
|
|
46
|
-
}: Props$
|
|
46
|
+
}: Props$5<TMeta>): react_jsx_runtime0.JSX.Element;
|
|
47
47
|
declare namespace App {
|
|
48
48
|
var Context: react1.Context<AppContextProps<unknown> | undefined>;
|
|
49
49
|
var displayName: string;
|
|
50
50
|
}
|
|
51
51
|
//#endregion
|
|
52
52
|
//#region src/components/Const.d.ts
|
|
53
|
-
type Props$
|
|
53
|
+
type Props$4 = {
|
|
54
54
|
key?: Key;
|
|
55
55
|
/**
|
|
56
56
|
* Name of the const
|
|
@@ -81,7 +81,7 @@ declare function Const({
|
|
|
81
81
|
JSDoc,
|
|
82
82
|
asConst,
|
|
83
83
|
children
|
|
84
|
-
}: Props$
|
|
84
|
+
}: Props$4): react_jsx_runtime0.JSX.Element;
|
|
85
85
|
declare namespace Const {
|
|
86
86
|
var displayName: string;
|
|
87
87
|
}
|
|
@@ -120,7 +120,7 @@ type BasePropsWithoutBaseName = {
|
|
|
120
120
|
path?: Path;
|
|
121
121
|
};
|
|
122
122
|
type BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName;
|
|
123
|
-
type Props$
|
|
123
|
+
type Props$3<TMeta> = BaseProps & {
|
|
124
124
|
key?: Key;
|
|
125
125
|
meta?: TMeta;
|
|
126
126
|
banner?: string;
|
|
@@ -130,7 +130,7 @@ type Props$2<TMeta> = BaseProps & {
|
|
|
130
130
|
declare function File<TMeta extends object = object>({
|
|
131
131
|
children,
|
|
132
132
|
...rest
|
|
133
|
-
}: Props$
|
|
133
|
+
}: Props$3<TMeta>): react_jsx_runtime0.JSX.Element;
|
|
134
134
|
declare namespace File {
|
|
135
135
|
var displayName: string;
|
|
136
136
|
var Export: typeof FileExport;
|
|
@@ -179,7 +179,7 @@ declare namespace FileImport {
|
|
|
179
179
|
}
|
|
180
180
|
//#endregion
|
|
181
181
|
//#region src/components/Function.d.ts
|
|
182
|
-
type Props$
|
|
182
|
+
type Props$2 = {
|
|
183
183
|
key?: Key;
|
|
184
184
|
/**
|
|
185
185
|
* Name of the function.
|
|
@@ -226,12 +226,12 @@ declare function Function({
|
|
|
226
226
|
returnType,
|
|
227
227
|
JSDoc,
|
|
228
228
|
children
|
|
229
|
-
}: Props$
|
|
229
|
+
}: Props$2): react_jsx_runtime0.JSX.Element;
|
|
230
230
|
declare namespace Function {
|
|
231
231
|
var displayName: string;
|
|
232
232
|
var Arrow: typeof ArrowFunction;
|
|
233
233
|
}
|
|
234
|
-
type ArrowFunctionProps = Props$
|
|
234
|
+
type ArrowFunctionProps = Props$2 & {
|
|
235
235
|
/**
|
|
236
236
|
* Create Arrow function in one line
|
|
237
237
|
*/
|
|
@@ -267,6 +267,33 @@ declare function Indent({
|
|
|
267
267
|
children
|
|
268
268
|
}: IndentProps): react_jsx_runtime0.JSX.Element | null;
|
|
269
269
|
//#endregion
|
|
270
|
+
//#region src/components/Text.d.ts
|
|
271
|
+
type Props$1 = {
|
|
272
|
+
key?: Key;
|
|
273
|
+
/**
|
|
274
|
+
* Change the indent.
|
|
275
|
+
* @default 0
|
|
276
|
+
* @deprecated
|
|
277
|
+
*/
|
|
278
|
+
indentSize?: number;
|
|
279
|
+
children?: KubbNode;
|
|
280
|
+
};
|
|
281
|
+
/**
|
|
282
|
+
* @deprecated
|
|
283
|
+
*/
|
|
284
|
+
declare function Text({
|
|
285
|
+
children
|
|
286
|
+
}: Props$1): react_jsx_runtime0.JSX.Element;
|
|
287
|
+
declare namespace Text {
|
|
288
|
+
var displayName: string;
|
|
289
|
+
var Space: typeof Space;
|
|
290
|
+
}
|
|
291
|
+
type SpaceProps = {};
|
|
292
|
+
declare function Space({}: SpaceProps): react_jsx_runtime0.JSX.Element;
|
|
293
|
+
declare namespace Space {
|
|
294
|
+
var displayName: string;
|
|
295
|
+
}
|
|
296
|
+
//#endregion
|
|
270
297
|
//#region src/components/Type.d.ts
|
|
271
298
|
type Props = {
|
|
272
299
|
key?: Key;
|
|
@@ -295,13 +322,13 @@ declare namespace Type {
|
|
|
295
322
|
}
|
|
296
323
|
//#endregion
|
|
297
324
|
//#region src/createApp.d.ts
|
|
298
|
-
declare const createApp: DefineApp
|
|
325
|
+
declare const createApp: DefineApp<ElementType>;
|
|
299
326
|
//#endregion
|
|
300
327
|
//#region src/hooks/useApp.d.ts
|
|
301
328
|
/**
|
|
302
329
|
* `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
|
|
303
330
|
*/
|
|
304
|
-
declare function useApp
|
|
331
|
+
declare function useApp(): AppContextProps;
|
|
305
332
|
//#endregion
|
|
306
333
|
//#region src/hooks/useFile.d.ts
|
|
307
334
|
/**
|
|
@@ -327,5 +354,5 @@ declare const useRef: typeof react1.useRef;
|
|
|
327
354
|
declare const use: typeof react1.use;
|
|
328
355
|
declare const useReducer: typeof react1.useReducer;
|
|
329
356
|
//#endregion
|
|
330
|
-
export { App, Const, File, Function, FunctionParams, Indent, Type, createApp, createContext, createElement, createFunctionParams, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
|
|
357
|
+
export { App, Const, File, Function, FunctionParams, Indent, Text, Type, createApp, createContext, createElement, createFunctionParams, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
|
|
331
358
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -70,15 +70,21 @@ var ErrorBoundary = class extends import_react.Component {
|
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
72
|
_defineProperty(ErrorBoundary, "displayName", "KubbErrorBoundary");
|
|
73
|
-
const RootContext = (0, import_react.createContext)({
|
|
74
|
-
|
|
73
|
+
const RootContext = (0, import_react.createContext)({
|
|
74
|
+
exit: () => {},
|
|
75
|
+
meta: {}
|
|
76
|
+
});
|
|
77
|
+
function Root({ onError, onExit: onExit$1, meta, children }) {
|
|
75
78
|
try {
|
|
76
79
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
77
80
|
onError: (error) => {
|
|
78
81
|
onError(error);
|
|
79
82
|
},
|
|
80
83
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RootContext.Provider, {
|
|
81
|
-
value: {
|
|
84
|
+
value: {
|
|
85
|
+
meta,
|
|
86
|
+
exit: onExit$1
|
|
87
|
+
},
|
|
82
88
|
children
|
|
83
89
|
})
|
|
84
90
|
});
|
|
@@ -105,6 +111,21 @@ function App({ meta, children }) {
|
|
|
105
111
|
App.Context = AppContext;
|
|
106
112
|
App.displayName = "KubbApp";
|
|
107
113
|
|
|
114
|
+
//#endregion
|
|
115
|
+
//#region src/components/Text.tsx
|
|
116
|
+
/**
|
|
117
|
+
* @deprecated
|
|
118
|
+
*/
|
|
119
|
+
function Text({ children }) {
|
|
120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kubb-text", { children });
|
|
121
|
+
}
|
|
122
|
+
Text.displayName = "KubbText";
|
|
123
|
+
function Space({}) {
|
|
124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kubb-text", { children: " " });
|
|
125
|
+
}
|
|
126
|
+
Space.displayName = "KubbSpace";
|
|
127
|
+
Text.Space = Space;
|
|
128
|
+
|
|
108
129
|
//#endregion
|
|
109
130
|
//#region src/utils/createJSDoc.ts
|
|
110
131
|
function createJSDoc({ comments }) {
|
|
@@ -118,18 +139,18 @@ function createJSDoc({ comments }) {
|
|
|
118
139
|
function Const({ name, export: canExport, type, JSDoc, asConst, children }) {
|
|
119
140
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
120
141
|
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})] }),
|
|
121
|
-
canExport && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
142
|
+
canExport && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: ["export", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {})] }),
|
|
122
143
|
"const ",
|
|
123
144
|
name,
|
|
124
|
-
|
|
145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {}),
|
|
125
146
|
type && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
126
147
|
":",
|
|
127
148
|
type,
|
|
128
|
-
|
|
149
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {})
|
|
129
150
|
] }),
|
|
130
151
|
"= ",
|
|
131
152
|
children,
|
|
132
|
-
asConst && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
153
|
+
asConst && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {}), "as const"] })
|
|
133
154
|
] });
|
|
134
155
|
}
|
|
135
156
|
Const.displayName = "KubbConst";
|
|
@@ -235,9 +256,9 @@ function Indent({ size = 2, children }) {
|
|
|
235
256
|
function Function({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, children }) {
|
|
236
257
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
237
258
|
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})] }),
|
|
238
|
-
canExport && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
239
|
-
isDefault && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
240
|
-
async && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
259
|
+
canExport && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: ["export", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {})] }),
|
|
260
|
+
isDefault && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: ["default", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {})] }),
|
|
261
|
+
async && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: ["async", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {})] }),
|
|
241
262
|
"function ",
|
|
242
263
|
name,
|
|
243
264
|
generics && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
@@ -269,12 +290,13 @@ Function.displayName = "KubbFunction";
|
|
|
269
290
|
function ArrowFunction({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine, children }) {
|
|
270
291
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
271
292
|
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})] }),
|
|
272
|
-
canExport && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
273
|
-
isDefault && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
293
|
+
canExport && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: ["export", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {})] }),
|
|
294
|
+
isDefault && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: ["default", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {})] }),
|
|
274
295
|
"const ",
|
|
275
296
|
name,
|
|
276
|
-
" =
|
|
277
|
-
|
|
297
|
+
" =",
|
|
298
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {}),
|
|
299
|
+
async && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: ["async", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {})] }),
|
|
278
300
|
generics && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
279
301
|
"<",
|
|
280
302
|
Array.isArray(generics) ? generics.join(", ").trim() : generics,
|
|
@@ -317,7 +339,7 @@ function Type({ name, export: canExport, JSDoc, children }) {
|
|
|
317
339
|
if (name.charAt(0).toUpperCase() !== name.charAt(0)) throw new Error("Name should start with a capital letter(see TypeScript types)");
|
|
318
340
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
319
341
|
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})] }),
|
|
320
|
-
canExport && /* @__PURE__ */ (0, import_jsx_runtime.
|
|
342
|
+
canExport && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: ["export", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Space, {})] }),
|
|
321
343
|
"type ",
|
|
322
344
|
name,
|
|
323
345
|
" = ",
|
|
@@ -360,10 +382,8 @@ const createNode = (nodeName) => {
|
|
|
360
382
|
};
|
|
361
383
|
const appendChildNode = (node, childNode) => {
|
|
362
384
|
if (childNode.parentNode) removeChildNode(childNode.parentNode, childNode);
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
node.childNodes.push(childNode);
|
|
366
|
-
}
|
|
385
|
+
childNode.parentNode = node;
|
|
386
|
+
node.childNodes.push(childNode);
|
|
367
387
|
};
|
|
368
388
|
const insertBeforeNode = (node, newChildNode, beforeChildNode) => {
|
|
369
389
|
if (newChildNode.parentNode) removeChildNode(newChildNode.parentNode, newChildNode);
|
|
@@ -15666,8 +15686,9 @@ var ReactTemplate = class {
|
|
|
15666
15686
|
onExit(error) {
|
|
15667
15687
|
this.unmount(error);
|
|
15668
15688
|
}
|
|
15669
|
-
render(node) {
|
|
15689
|
+
render(node, { meta = {} } = { meta: {} }) {
|
|
15670
15690
|
const element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root, {
|
|
15691
|
+
meta,
|
|
15671
15692
|
onExit: this.onExit.bind(this),
|
|
15672
15693
|
onError: this.onError.bind(this),
|
|
15673
15694
|
children: node
|
|
@@ -15675,8 +15696,9 @@ var ReactTemplate = class {
|
|
|
15675
15696
|
KubbRenderer.updateContainerSync(element, _classPrivateFieldGet2(_container, this), null, null);
|
|
15676
15697
|
KubbRenderer.flushSyncWork();
|
|
15677
15698
|
}
|
|
15678
|
-
async renderToString(node) {
|
|
15699
|
+
async renderToString(node, { meta = {} } = { meta: {} }) {
|
|
15679
15700
|
const element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Root, {
|
|
15701
|
+
meta,
|
|
15680
15702
|
onExit: this.onExit.bind(this),
|
|
15681
15703
|
onError: this.onError.bind(this),
|
|
15682
15704
|
children: node
|
|
@@ -15724,10 +15746,10 @@ const createApp = defineApp((app, context) => {
|
|
|
15724
15746
|
});
|
|
15725
15747
|
return {
|
|
15726
15748
|
render() {
|
|
15727
|
-
template.render(
|
|
15749
|
+
template.render(createElement(app));
|
|
15728
15750
|
},
|
|
15729
15751
|
async renderToString() {
|
|
15730
|
-
return template.renderToString(
|
|
15752
|
+
return template.renderToString(createElement(app));
|
|
15731
15753
|
},
|
|
15732
15754
|
waitUntilExit() {
|
|
15733
15755
|
return template.waitUntilExit();
|
|
@@ -15895,5 +15917,5 @@ const use = import_react.use;
|
|
|
15895
15917
|
const useReducer = import_react.useReducer;
|
|
15896
15918
|
|
|
15897
15919
|
//#endregion
|
|
15898
|
-
export { App, Const, File, Function, FunctionParams, Indent, Type, createApp, createContext, createElement, createFunctionParams, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
|
|
15920
|
+
export { App, Const, File, Function, FunctionParams, Indent, Text, Type, createApp, createContext, createElement, createFunctionParams, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
|
|
15899
15921
|
//# sourceMappingURL=index.js.map
|