@kubb/react-fabric 0.5.0 → 0.5.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.
- package/dist/index.cjs +48 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -21
- package/dist/index.d.ts +21 -21
- package/dist/index.js +47 -47
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.cjs +227 -14
- package/dist/jsx-dev-runtime.cjs.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +4 -1
- package/dist/jsx-dev-runtime.d.ts +4 -1
- package/dist/jsx-dev-runtime.js +225 -4
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/{jsx-runtime-B95ZQ2MZ.js → jsx-runtime-DT7hOgNn.js} +7 -4
- package/dist/{jsx-runtime-B95ZQ2MZ.js.map → jsx-runtime-DT7hOgNn.js.map} +1 -1
- package/dist/{jsx-runtime-BnIQNoyE.cjs → jsx-runtime-cR2hscK9.cjs} +23 -8
- package/dist/{jsx-runtime-BnIQNoyE.cjs.map → jsx-runtime-cR2hscK9.cjs.map} +1 -1
- package/dist/jsx-runtime.cjs +6 -26
- package/dist/jsx-runtime.d.cts +6 -2
- package/dist/jsx-runtime.d.ts +6 -2
- package/dist/jsx-runtime.js +2 -6
- package/dist/plugins.cjs +3 -3
- package/dist/plugins.js +3 -3
- package/dist/{jsx-dev-runtime-aYzeEJ2N.js → react-Czh2e85z.js} +8 -228
- package/dist/react-Czh2e85z.js.map +1 -0
- package/dist/{jsx-dev-runtime-BiO7A4L5.cjs → react-DNGR2CL5.cjs} +7 -233
- package/dist/react-DNGR2CL5.cjs.map +1 -0
- package/dist/{reactPlugin-BtX7BIDy.js → reactPlugin-CjsXM659.js} +7 -7
- package/dist/{reactPlugin-BtX7BIDy.js.map → reactPlugin-CjsXM659.js.map} +1 -1
- package/dist/{reactPlugin-B-vyv4g0.cjs → reactPlugin-Ct0yCk0a.cjs} +10 -10
- package/dist/{reactPlugin-B-vyv4g0.cjs.map → reactPlugin-Ct0yCk0a.cjs.map} +1 -1
- package/package.json +2 -2
- package/src/index.ts +1 -1
- package/src/jsx-dev-runtime.ts +4 -1
- package/src/jsx-runtime.ts +5 -2
- package/dist/jsx-dev-runtime-BiO7A4L5.cjs.map +0 -1
- package/dist/jsx-dev-runtime-aYzeEJ2N.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as __toESM } from "./chunk-BHcwYQRN.js";
|
|
2
|
-
import {
|
|
3
|
-
import { a as _classPrivateFieldInitSpec, i as _classPrivateFieldGet2, n as Runtime, o as Root, r as _classPrivateFieldSet2, s as RootContext, t as reactPlugin } from "./reactPlugin-
|
|
4
|
-
import { n as
|
|
2
|
+
import { t as require_react } from "./react-Czh2e85z.js";
|
|
3
|
+
import { a as _classPrivateFieldInitSpec, i as _classPrivateFieldGet2, n as Runtime, o as Root, r as _classPrivateFieldSet2, s as RootContext, t as reactPlugin } from "./reactPlugin-CjsXM659.js";
|
|
4
|
+
import { i as jsxs, n as jsx, t as Fragment$1 } from "./jsx-runtime-DT7hOgNn.js";
|
|
5
5
|
import { t as open } from "./devtools-D6dZodXp.js";
|
|
6
6
|
import { createFabric } from "@kubb/fabric-core";
|
|
7
7
|
import dedent from "dedent";
|
|
@@ -14,7 +14,7 @@ var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
|
14
14
|
const AppContext = (0, import_react.createContext)(void 0);
|
|
15
15
|
function App({ meta, children }) {
|
|
16
16
|
const { exit } = (0, import_react.useContext)(RootContext);
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ jsx(AppContext.Provider, {
|
|
18
18
|
value: {
|
|
19
19
|
exit,
|
|
20
20
|
meta
|
|
@@ -36,20 +36,20 @@ function createJSDoc({ comments }) {
|
|
|
36
36
|
//#endregion
|
|
37
37
|
//#region src/components/Const.tsx
|
|
38
38
|
function Const({ name, export: canExport, type, JSDoc, asConst, children }) {
|
|
39
|
-
return /* @__PURE__ */
|
|
40
|
-
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */
|
|
41
|
-
canExport && /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
40
|
+
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ jsxs(Fragment$1, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ jsx("br", {})] }),
|
|
41
|
+
canExport && /* @__PURE__ */ jsx(Fragment$1, { children: "export " }),
|
|
42
42
|
"const ",
|
|
43
43
|
name,
|
|
44
44
|
" ",
|
|
45
|
-
type && /* @__PURE__ */
|
|
45
|
+
type && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
46
46
|
":",
|
|
47
47
|
type,
|
|
48
48
|
" "
|
|
49
49
|
] }),
|
|
50
50
|
"= ",
|
|
51
51
|
children,
|
|
52
|
-
asConst && /* @__PURE__ */
|
|
52
|
+
asConst && /* @__PURE__ */ jsx(Fragment$1, { children: " as const" })
|
|
53
53
|
] });
|
|
54
54
|
}
|
|
55
55
|
Const.displayName = "KubbConst";
|
|
@@ -58,10 +58,10 @@ Const.displayName = "KubbConst";
|
|
|
58
58
|
//#region src/components/File.tsx
|
|
59
59
|
const FileContext = (0, import_react.createContext)({});
|
|
60
60
|
function File({ children, ...rest }) {
|
|
61
|
-
if (!rest.baseName || !rest.path) return /* @__PURE__ */
|
|
62
|
-
return /* @__PURE__ */
|
|
61
|
+
if (!rest.baseName || !rest.path) return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
62
|
+
return /* @__PURE__ */ jsx("kubb-file", {
|
|
63
63
|
...rest,
|
|
64
|
-
children: /* @__PURE__ */
|
|
64
|
+
children: /* @__PURE__ */ jsx(FileContext.Provider, {
|
|
65
65
|
value: {
|
|
66
66
|
baseName: rest.baseName,
|
|
67
67
|
path: rest.path,
|
|
@@ -73,7 +73,7 @@ function File({ children, ...rest }) {
|
|
|
73
73
|
}
|
|
74
74
|
File.displayName = "KubbFile";
|
|
75
75
|
function FileSource({ isTypeOnly, name, isExportable, isIndexable, children }) {
|
|
76
|
-
return /* @__PURE__ */
|
|
76
|
+
return /* @__PURE__ */ jsx("kubb-source", {
|
|
77
77
|
name,
|
|
78
78
|
isTypeOnly,
|
|
79
79
|
isExportable,
|
|
@@ -83,7 +83,7 @@ function FileSource({ isTypeOnly, name, isExportable, isIndexable, children }) {
|
|
|
83
83
|
}
|
|
84
84
|
FileSource.displayName = "KubbFileSource";
|
|
85
85
|
function FileExport({ name, path, isTypeOnly, asAlias }) {
|
|
86
|
-
return /* @__PURE__ */
|
|
86
|
+
return /* @__PURE__ */ jsx("kubb-export", {
|
|
87
87
|
name,
|
|
88
88
|
path,
|
|
89
89
|
isTypeOnly: isTypeOnly || false,
|
|
@@ -92,7 +92,7 @@ function FileExport({ name, path, isTypeOnly, asAlias }) {
|
|
|
92
92
|
}
|
|
93
93
|
FileExport.displayName = "KubbFileExport";
|
|
94
94
|
function FileImport({ name, root, path, isTypeOnly, isNameSpace }) {
|
|
95
|
-
return /* @__PURE__ */
|
|
95
|
+
return /* @__PURE__ */ jsx("kubb-import", {
|
|
96
96
|
name,
|
|
97
97
|
root,
|
|
98
98
|
path,
|
|
@@ -142,23 +142,23 @@ function Indent({ size = 2, children }) {
|
|
|
142
142
|
brCount = 0;
|
|
143
143
|
result.push(child);
|
|
144
144
|
}
|
|
145
|
-
return /* @__PURE__ */
|
|
146
|
-
if (typeof child === "string") return /* @__PURE__ */
|
|
147
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children: result.map((child) => {
|
|
146
|
+
if (typeof child === "string") return /* @__PURE__ */ jsx(Fragment$1, { children: indentString(dedent(child), size) });
|
|
147
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [" ".repeat(size), child] });
|
|
148
148
|
}) });
|
|
149
149
|
}
|
|
150
150
|
|
|
151
151
|
//#endregion
|
|
152
152
|
//#region src/components/Function.tsx
|
|
153
153
|
function Function({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, children }) {
|
|
154
|
-
return /* @__PURE__ */
|
|
155
|
-
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */
|
|
156
|
-
canExport && /* @__PURE__ */
|
|
157
|
-
isDefault && /* @__PURE__ */
|
|
158
|
-
async && /* @__PURE__ */
|
|
154
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
155
|
+
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ jsxs(Fragment$1, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ jsx("br", {})] }),
|
|
156
|
+
canExport && /* @__PURE__ */ jsx(Fragment$1, { children: "export " }),
|
|
157
|
+
isDefault && /* @__PURE__ */ jsx(Fragment$1, { children: "default " }),
|
|
158
|
+
async && /* @__PURE__ */ jsx(Fragment$1, { children: "async " }),
|
|
159
159
|
"function ",
|
|
160
160
|
name,
|
|
161
|
-
generics && /* @__PURE__ */
|
|
161
|
+
generics && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
162
162
|
"<",
|
|
163
163
|
Array.isArray(generics) ? generics.join(", ").trim() : generics,
|
|
164
164
|
">"
|
|
@@ -166,34 +166,34 @@ function Function({ name, default: isDefault, export: canExport, async, generics
|
|
|
166
166
|
"(",
|
|
167
167
|
params,
|
|
168
168
|
")",
|
|
169
|
-
returnType && !async && /* @__PURE__ */
|
|
170
|
-
returnType && async && /* @__PURE__ */
|
|
169
|
+
returnType && !async && /* @__PURE__ */ jsxs(Fragment$1, { children: [": ", returnType] }),
|
|
170
|
+
returnType && async && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
171
171
|
": Promise",
|
|
172
172
|
"<",
|
|
173
173
|
returnType,
|
|
174
174
|
">"
|
|
175
175
|
] }),
|
|
176
176
|
" {",
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
-
/* @__PURE__ */
|
|
177
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
178
|
+
/* @__PURE__ */ jsx(Indent, {
|
|
179
179
|
size: 2,
|
|
180
180
|
children
|
|
181
181
|
}),
|
|
182
|
-
/* @__PURE__ */
|
|
182
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
183
183
|
"}"
|
|
184
184
|
] });
|
|
185
185
|
}
|
|
186
186
|
Function.displayName = "KubbFunction";
|
|
187
187
|
function ArrowFunction({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine, children }) {
|
|
188
|
-
return /* @__PURE__ */
|
|
189
|
-
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */
|
|
190
|
-
canExport && /* @__PURE__ */
|
|
191
|
-
isDefault && /* @__PURE__ */
|
|
188
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
189
|
+
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ jsxs(Fragment$1, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ jsx("br", {})] }),
|
|
190
|
+
canExport && /* @__PURE__ */ jsx(Fragment$1, { children: "export " }),
|
|
191
|
+
isDefault && /* @__PURE__ */ jsx(Fragment$1, { children: "default " }),
|
|
192
192
|
"const ",
|
|
193
193
|
name,
|
|
194
194
|
" = ",
|
|
195
|
-
async && /* @__PURE__ */
|
|
196
|
-
generics && /* @__PURE__ */
|
|
195
|
+
async && /* @__PURE__ */ jsx(Fragment$1, { children: "async " }),
|
|
196
|
+
generics && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
197
197
|
"<",
|
|
198
198
|
Array.isArray(generics) ? generics.join(", ").trim() : generics,
|
|
199
199
|
">"
|
|
@@ -201,28 +201,28 @@ function ArrowFunction({ name, default: isDefault, export: canExport, async, gen
|
|
|
201
201
|
"(",
|
|
202
202
|
params,
|
|
203
203
|
")",
|
|
204
|
-
returnType && !async && /* @__PURE__ */
|
|
205
|
-
returnType && async && /* @__PURE__ */
|
|
204
|
+
returnType && !async && /* @__PURE__ */ jsxs(Fragment$1, { children: [": ", returnType] }),
|
|
205
|
+
returnType && async && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
206
206
|
": Promise",
|
|
207
207
|
"<",
|
|
208
208
|
returnType,
|
|
209
209
|
">"
|
|
210
210
|
] }),
|
|
211
|
-
singleLine && /* @__PURE__ */
|
|
211
|
+
singleLine && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
212
212
|
" => ",
|
|
213
213
|
children,
|
|
214
|
-
/* @__PURE__ */
|
|
214
|
+
/* @__PURE__ */ jsx("br", {})
|
|
215
215
|
] }),
|
|
216
|
-
!singleLine && /* @__PURE__ */
|
|
216
|
+
!singleLine && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
217
217
|
" => {",
|
|
218
|
-
/* @__PURE__ */
|
|
219
|
-
/* @__PURE__ */
|
|
218
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
219
|
+
/* @__PURE__ */ jsx(Indent, {
|
|
220
220
|
size: 2,
|
|
221
221
|
children
|
|
222
222
|
}),
|
|
223
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
224
224
|
"}",
|
|
225
|
-
/* @__PURE__ */
|
|
225
|
+
/* @__PURE__ */ jsx("br", {})
|
|
226
226
|
] })
|
|
227
227
|
] });
|
|
228
228
|
}
|
|
@@ -233,9 +233,9 @@ Function.Arrow = ArrowFunction;
|
|
|
233
233
|
//#region src/components/Type.tsx
|
|
234
234
|
function Type({ name, export: canExport, JSDoc, children }) {
|
|
235
235
|
if (name.charAt(0).toUpperCase() !== name.charAt(0)) throw new Error("Name should start with a capital letter(see TypeScript types)");
|
|
236
|
-
return /* @__PURE__ */
|
|
237
|
-
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */
|
|
238
|
-
canExport && /* @__PURE__ */
|
|
236
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
237
|
+
(JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ jsxs(Fragment$1, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ jsx("br", {})] }),
|
|
238
|
+
canExport && /* @__PURE__ */ jsx(Fragment$1, { children: "export " }),
|
|
239
239
|
"type ",
|
|
240
240
|
name,
|
|
241
241
|
" = ",
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["result: React.ReactNode[]","types: string[]","names: string[]","item","key","name","acc: string[]","parsedItem"],"sources":["../src/components/App.tsx","../src/utils/createJSDoc.ts","../src/components/Const.tsx","../src/components/File.tsx","../../../node_modules/.pnpm/indent-string@5.0.0/node_modules/indent-string/index.js","../src/components/Indent.tsx","../src/components/Function.tsx","../src/components/Type.tsx","../src/composables/useApp.ts","../src/composables/useFile.ts","../src/composables/useLifecycle.tsx","../src/createReactFabric.ts","../src/utils/getFunctionParams.ts","../src/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { KubbNode } from '../types.ts'\nimport { RootContext } from './Root.tsx'\n\nexport type AppContextProps<TMeta = unknown> = {\n /**\n * Exit (unmount)\n */\n readonly exit: (error?: Error) => void\n readonly meta: TMeta\n}\n\nconst AppContext = createContext<AppContextProps | undefined>(undefined)\n\ntype Props<TMeta = unknown> = {\n readonly children?: KubbNode\n readonly meta: TMeta\n}\n\nexport function App<TMeta = unknown>({ meta, children }: Props<TMeta>) {\n const { exit } = useContext(RootContext)\n\n return <AppContext.Provider value={{ exit, meta }}>{children}</AppContext.Provider>\n}\n\nApp.Context = AppContext\nApp.displayName = 'KubbApp'\n","export function createJSDoc({ comments }: { comments: Array<string> }): string {\n const filtered = comments.filter((c) => c.trim())\n if (!filtered.length) {\n return ''\n }\n\n return `/**\\n * ${filtered.join('\\n * ')}\\n */`\n}\n","import type { JSDoc, Key, KubbNode } from '../types.ts'\n\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\ntype Props = {\n key?: Key\n /**\n * Name of the const\n */\n name: string\n /**\n * Does this type need to be exported.\n */\n export?: boolean\n /**\n * Type to make the const being typed\n */\n type?: string\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n /**\n * Use of `const` assertions\n */\n asConst?: boolean\n children?: KubbNode\n}\n\nexport function Const({ name, export: canExport, type, JSDoc, asConst, children }: Props) {\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n const {name}{' '}\n {type && (\n <>\n {':'}\n {type}{' '}\n </>\n )}\n = {children}\n {asConst && <> as const</>}\n </>\n )\n}\n\nConst.displayName = 'KubbConst'\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport { createContext } from 'react'\nimport type { Key, KubbNode } from '../types.ts'\n\nexport type FileContextProps<TMeta extends object = object> = {\n /**\n * Name to be used to dynamicly create the baseName(based on input.path).\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: KubbFile.BaseName\n /**\n * Path will be full qualified path to a specified file.\n */\n path: KubbFile.Path\n meta?: TMeta\n}\nconst FileContext = createContext<FileContextProps>({} as FileContextProps)\n\ntype BasePropsWithBaseName = {\n /**\n * Name to be used to dynamicly create the baseName(based on input.path).\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: KubbFile.BaseName\n /**\n * Path will be full qualified path to a specified file.\n */\n path: KubbFile.Path\n}\n\ntype BasePropsWithoutBaseName = {\n baseName?: never\n /**\n * Path will be full qualified path to a specified file.\n */\n path?: KubbFile.Path\n}\n\ntype BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName\n\ntype Props<TMeta> = BaseProps & {\n key?: Key\n meta?: TMeta\n banner?: string\n footer?: string\n children?: KubbNode\n}\n\nexport function File<TMeta extends object = object>({ children, ...rest }: Props<TMeta>) {\n if (!rest.baseName || !rest.path) {\n return <>{children}</>\n }\n\n return (\n <kubb-file {...rest}>\n <FileContext.Provider value={{ baseName: rest.baseName, path: rest.path, meta: rest.meta }}>{children}</FileContext.Provider>\n </kubb-file>\n )\n}\n\nFile.displayName = 'KubbFile'\n\ntype FileSourceProps = Omit<KubbFile.Source, 'value'> & {\n key?: Key\n children?: KubbNode\n}\n\nfunction FileSource({ isTypeOnly, name, isExportable, isIndexable, children }: FileSourceProps) {\n return (\n <kubb-source name={name} isTypeOnly={isTypeOnly} isExportable={isExportable} isIndexable={isIndexable}>\n {children}\n </kubb-source>\n )\n}\n\nFileSource.displayName = 'KubbFileSource'\n\ntype FileExportProps = KubbFile.Export & { key?: Key }\n\nfunction FileExport({ name, path, isTypeOnly, asAlias }: FileExportProps) {\n return <kubb-export name={name} path={path} isTypeOnly={isTypeOnly || false} asAlias={asAlias} />\n}\n\nFileExport.displayName = 'KubbFileExport'\n\ntype FileImportProps = KubbFile.Import & { key?: Key }\n\nfunction FileImport({ name, root, path, isTypeOnly, isNameSpace }: FileImportProps) {\n return <kubb-import name={name} root={root} path={path} isNameSpace={isNameSpace} isTypeOnly={isTypeOnly || false} />\n}\n\nFileImport.displayName = 'KubbFileImport'\n\nFile.Export = FileExport\nFile.Import = FileImport\nFile.Source = FileSource\nFile.Context = FileContext\n","export default function indentString(string, count = 1, options = {}) {\n\tconst {\n\t\tindent = ' ',\n\t\tincludeEmptyLines = false\n\t} = options;\n\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`input\\` to be a \\`string\\`, got \\`${typeof string}\\``\n\t\t);\n\t}\n\n\tif (typeof count !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`count\\` to be a \\`number\\`, got \\`${typeof count}\\``\n\t\t);\n\t}\n\n\tif (count < 0) {\n\t\tthrow new RangeError(\n\t\t\t`Expected \\`count\\` to be at least 0, got \\`${count}\\``\n\t\t);\n\t}\n\n\tif (typeof indent !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`options.indent\\` to be a \\`string\\`, got \\`${typeof indent}\\``\n\t\t);\n\t}\n\n\tif (count === 0) {\n\t\treturn string;\n\t}\n\n\tconst regex = includeEmptyLines ? /^/gm : /^(?!\\s*$)/gm;\n\n\treturn string.replace(regex, indent.repeat(count));\n}\n","import dedent from 'dedent'\nimport indentString from 'indent-string'\nimport React from 'react'\n\ntype IndentProps = {\n size?: number\n children?: React.ReactNode\n}\n\n/**\n * Indents all children by `size` spaces.\n * Collapses consecutive <br /> tags to at most 2.\n */\nexport function Indent({ size = 2, children }: IndentProps) {\n if (!children) return null\n\n const childrenArray = React.Children.toArray(children)\n const result: React.ReactNode[] = []\n\n let prevWasBr = false\n let brCount = 0\n\n for (const child of childrenArray) {\n if (React.isValidElement(child) && child.type === 'br') {\n if (!prevWasBr || brCount < 2) {\n result.push(child)\n brCount++\n }\n prevWasBr = true\n } else {\n prevWasBr = false\n brCount = 0\n result.push(child)\n }\n }\n\n return (\n <>\n {result.map((child) => {\n if (typeof child === 'string') {\n const cleaned = dedent(child)\n return <>{indentString(cleaned, size)}</>\n }\n return (\n <>\n {' '.repeat(size)}\n {child}\n </>\n )\n })}\n </>\n )\n}\n","import type { JSDoc, Key, KubbNode } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\nimport { Indent } from './Indent.tsx'\n\ntype Props = {\n key?: Key\n /**\n * Name of the function.\n */\n name: string\n /**\n * Add default when export is being used\n */\n default?: boolean\n /**\n * Parameters/options/props that need to be used.\n */\n params?: string\n /**\n * Does this function need to be exported.\n */\n export?: boolean\n /**\n * Does the function has async/promise behaviour.\n * This will also add `Promise<returnType>` as the returnType.\n */\n async?: boolean\n /**\n * Generics that needs to be added for TypeScript.\n */\n generics?: string | string[]\n\n /**\n * ReturnType(see async for adding Promise type).\n */\n returnType?: string\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n children?: KubbNode\n}\n\nexport function Function({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, children }: Props) {\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n {isDefault && <>default </>}\n {async && <>async </>}\n function {name}\n {generics && (\n <>\n {'<'}\n {Array.isArray(generics) ? generics.join(', ').trim() : generics}\n {'>'}\n </>\n )}\n ({params}){returnType && !async && <>: {returnType}</>}\n {returnType && async && (\n <>\n : Promise{'<'}\n {returnType}\n {'>'}\n </>\n )}\n {' {'}\n <br />\n <Indent size={2}>{children}</Indent>\n <br />\n {'}'}\n </>\n )\n}\n\nFunction.displayName = 'KubbFunction'\n\ntype ArrowFunctionProps = Props & {\n /**\n * Create Arrow function in one line\n */\n singleLine?: boolean\n}\n\nfunction ArrowFunction({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine, children }: ArrowFunctionProps) {\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n {isDefault && <>default </>}\n const {name} = {async && <>async </>}\n {generics && (\n <>\n {'<'}\n {Array.isArray(generics) ? generics.join(', ').trim() : generics}\n {'>'}\n </>\n )}\n ({params}){returnType && !async && <>: {returnType}</>}\n {returnType && async && (\n <>\n : Promise{'<'}\n {returnType}\n {'>'}\n </>\n )}\n {singleLine && (\n <>\n {' => '}\n {children}\n <br />\n </>\n )}\n {!singleLine && (\n <>\n {' => {'}\n <br />\n <Indent size={2}>{children}</Indent>\n <br />\n {'}'}\n <br />\n </>\n )}\n </>\n )\n}\n\nArrowFunction.displayName = 'KubbArrowFunction'\nFunction.Arrow = ArrowFunction\n","import type { JSDoc, Key, KubbNode } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\ntype Props = {\n key?: Key\n /**\n * Name of the type, this needs to start with a capital letter.\n */\n name: string\n /**\n * Does this type need to be exported.\n */\n export?: boolean\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n children?: KubbNode\n}\n\nexport function Type({ name, export: canExport, JSDoc, children }: Props) {\n if (name.charAt(0).toUpperCase() !== name.charAt(0)) {\n throw new Error('Name should start with a capital letter(see TypeScript types)')\n }\n\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n type {name} = {children}\n </>\n )\n}\n\nType.displayName = 'KubbType'\n","import { useContext } from 'react'\nimport { App, type AppContextProps } from '../components/App.tsx'\n\n/**\n * `useApp` will return the current App with plugin, pluginManager, fileManager and mode.\n */\nexport function useApp<TMeta = unknown>(): AppContextProps<TMeta> {\n const app = useContext(App.Context)\n\n if (!app) {\n throw new Error('<App /> should be set')\n }\n\n return app as AppContextProps<TMeta>\n}\n","import { useContext } from 'react'\nimport type { FileContextProps } from '../components/File.tsx'\nimport { File } from '../components/File.tsx'\n\n/**\n * `useFile` will return the current file when <File/> is used.\n */\nexport function useFile(): FileContextProps {\n const file = useContext(File.Context)\n\n return file as FileContextProps\n}\n","import { useContext } from 'react'\n\nimport { Root } from '../components/Root.tsx'\n\n/**\n * `useLifecycle` will return some helpers to exit/restart the generation.\n */\nexport function useLifecycle() {\n const { exit } = useContext(Root.Context)\n\n return {\n exit: () => {\n const timeout = setTimeout(() => {\n clearTimeout(timeout)\n\n exit()\n }, 0)\n },\n }\n}\n","import type { Fabric } from '@kubb/fabric-core'\nimport { createFabric } from '@kubb/fabric-core'\nimport type { FabricConfig, FabricMode } from '@kubb/fabric-core/types'\nimport { open } from './devtools.ts'\nimport type { Options } from './plugins/reactPlugin.ts'\nimport { reactPlugin } from './plugins/reactPlugin.ts'\n\nexport function createReactFabric(\n config: FabricConfig<Options & { mode?: FabricMode; devtools?: boolean }> = {},\n): Fabric<Options & { mode?: FabricMode; devtools?: boolean }> {\n const fabric = createFabric({ mode: config.mode })\n\n if (config.devtools) {\n open()\n }\n\n fabric.use(reactPlugin, {\n stdout: config.stdout,\n stderr: config.stderr,\n debug: config.debug,\n stdin: config.stdin,\n })\n\n return fabric\n}\n","import { orderBy } from 'natural-orderby'\n\nexport type Param = {\n /**\n * `object` will return the pathParams as an object.\n *\n * `inline` will return the pathParams as comma separated params.\n * @default `'inline'`\n * @private\n */\n mode?: 'object' | 'inline' | 'inlineSpread'\n type?: 'string' | 'number' | (string & {})\n optional?: boolean\n /**\n * @example test = \"default\"\n */\n default?: string\n /**\n * Used for no TypeScript(with mode object)\n * @example test: \"default\"\n */\n value?: string\n children?: Params\n}\n\ntype ParamItem =\n | (Pick<Param, 'mode' | 'type' | 'value'> & {\n optional?: true\n default?: never\n children?: Params\n })\n | (Pick<Param, 'mode' | 'type' | 'value'> & {\n optional?: false\n default?: string\n children?: Params\n })\n\nexport type Params = Record<string, Param | undefined>\n\ntype Options = {\n type: 'constructor' | 'call' | 'object' | 'objectValue'\n transformName?: (name: string) => string\n transformType?: (type: string) => string\n}\n\nfunction order(items: Array<[key: string, item?: ParamItem]>) {\n return orderBy(\n items.filter(Boolean),\n [\n ([_key, item]) => {\n if (item?.children) {\n return undefined\n }\n return !item?.default\n },\n ([_key, item]) => {\n if (item?.children) {\n return undefined\n }\n return !item?.optional\n },\n ],\n ['desc', 'desc'],\n )\n}\n\nfunction parseChild(key: string, item: ParamItem, options: Options): string | null {\n // @ts-expect-error\n const entries = order(Object.entries(item.children))\n\n const types: string[] = []\n const names: string[] = []\n\n const optional = entries.every(([_key, item]) => item?.optional)\n\n entries.forEach(([key, entryItem]) => {\n if (entryItem) {\n const name = parseItem(key, { ...entryItem, type: undefined }, options)\n if (entryItem.children) {\n const subTypes = Object.entries(entryItem.children)\n .map(([key]) => {\n return key\n })\n .join(', ')\n\n if (subTypes) {\n names.push(`${name}: { ${subTypes} }`)\n } else {\n names.push(name)\n }\n } else {\n if (options.type === 'call' && options.transformName) {\n names.push(`${key}: ${name}`)\n } else {\n names.push(name)\n }\n }\n\n if (entries.some(([_key, item]) => item?.type)) {\n types.push(parseItem(key, { ...entryItem, default: undefined }, options))\n }\n }\n })\n\n const name = item.mode === 'inline' ? key : names.length ? `{ ${names.join(', ')} }` : undefined\n const type = item.type ? item.type : types.length ? `{ ${types.join('; ')} }` : undefined\n\n if (!name) {\n return null\n }\n\n return parseItem(\n name,\n {\n type,\n default: item.default,\n optional: !item.default ? optional : undefined,\n } as ParamItem,\n options,\n )\n}\n\nfunction parseItem(name: string, item: ParamItem, options: Options): string {\n const acc: string[] = []\n const transformedName = options.transformName ? options.transformName(name) : name\n const transformedType = options.transformType && item.type ? options.transformType(item.type) : item.type\n\n if (options.type === 'object') {\n return transformedName\n }\n\n if (options.type === 'objectValue') {\n return item.value ? `${transformedName}: ${item.value}` : transformedName\n }\n\n //LEGACY\n if (item.type && options.type === 'constructor') {\n if (item.optional) {\n acc.push(`${transformedName}?: ${transformedType}`)\n } else {\n acc.push(`${transformedName}: ${transformedType}${item.default ? ` = ${item.default}` : ''}`)\n }\n } else if (item.default && options.type === 'constructor') {\n acc.push(`${transformedName} = ${item.default}`)\n } else if (item.value) {\n acc.push(`${transformedName} : ${item.value}`)\n } else if (item.mode === 'inlineSpread') {\n acc.push(`... ${transformedName}`)\n } else {\n acc.push(transformedName)\n }\n\n return acc[0] as string\n}\n\nexport function getFunctionParams(params: Params, options: Options): string {\n const entries = order(Object.entries(params as Record<string, ParamItem | undefined>))\n\n return entries\n .reduce((acc, [key, item]) => {\n if (!item) {\n return acc\n }\n\n if (item.children) {\n if (Object.keys(item.children).length === 0) {\n return acc\n }\n\n if (item.mode === 'inlineSpread') {\n return [...acc, getFunctionParams(item.children, options)]\n }\n\n const parsedItem = parseChild(key, item, options)\n if (!parsedItem) {\n return acc\n }\n\n return [...acc, parsedItem]\n }\n\n const parsedItem = parseItem(key, item, options)\n\n return [...acc, parsedItem]\n }, [] as string[])\n .join(', ')\n}\n\nexport function createFunctionParams(params: Params): Params {\n return params\n}\n// TODO use of zod\n//TODO use of string as `$name: $type` to create templates for functions instead of call/constructor\nexport class FunctionParams {\n #params: Params\n\n static factory(params: Params) {\n return new FunctionParams(params)\n }\n constructor(params: Params) {\n this.#params = params\n }\n\n get params(): Params {\n return this.#params\n }\n\n get flatParams(): Params {\n const flatter = (acc: Params, [key, item]: [key: string, item?: Param]): Params => {\n if (item?.children) {\n return Object.entries(item.children).reduce(flatter, acc)\n }\n if (item) {\n acc[key] = item\n }\n\n return acc\n }\n return Object.entries(this.#params).reduce(flatter, {} as Params)\n }\n\n toCall({ transformName, transformType }: Pick<Options, 'transformName' | 'transformType'> = {}): string {\n return getFunctionParams(this.#params, { type: 'call', transformName, transformType })\n }\n\n toObject(): string {\n return getFunctionParams(this.#params, { type: 'object' })\n }\n toObjectValue(): string {\n return getFunctionParams(this.#params, { type: 'objectValue' })\n }\n\n toConstructor(): string {\n return getFunctionParams(this.#params, { type: 'constructor' })\n }\n}\n","// import './globals.ts'\nimport React from 'react'\n\n// expose fabric core helpers\nexport * from '@kubb/fabric-core'\n\n// react helpers\nexport const useState = React.useState\nexport const createContext = React.createContext\nexport const createElement = React.createElement\nexport const Fragment = React.Fragment\nexport const use = React.use\nexport const useContext = React.useContext\nexport const useEffect = React.useEffect\nexport const useReducer = React.useReducer\nexport const useRef = React.useRef\n// // components\nexport { App } from './components/App.tsx'\nexport { Const } from './components/Const.tsx'\nexport { File } from './components/File.tsx'\nexport { Function } from './components/Function.tsx'\nexport { Indent } from './components/Indent.tsx'\nexport { Type } from './components/Type.tsx'\nexport { useApp } from './composables/useApp.ts'\nexport { useFile } from './composables/useFile.ts'\nexport { useLifecycle } from './composables/useLifecycle.tsx'\nexport { createReactFabric } from './createReactFabric.ts'\nexport { Runtime } from './Runtime.tsx'\n// utils\nexport { createFunctionParams, Funct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: string[]","item","key","name","acc: string[]","parsedItem"],"sources":["../src/components/App.tsx","../src/utils/createJSDoc.ts","../src/components/Const.tsx","../src/components/File.tsx","../../../node_modules/.pnpm/indent-string@5.0.0/node_modules/indent-string/index.js","../src/components/Indent.tsx","../src/components/Function.tsx","../src/components/Type.tsx","../src/composables/useApp.ts","../src/composables/useFile.ts","../src/composables/useLifecycle.tsx","../src/createReactFabric.ts","../src/utils/getFunctionParams.ts","../src/index.ts"],"sourcesContent":["import { createContext, useContext } from 'react'\nimport type { KubbNode } from '../types.ts'\nimport { RootContext } from './Root.tsx'\n\nexport type AppContextProps<TMeta = unknown> = {\n /**\n * Exit (unmount)\n */\n readonly exit: (error?: Error) => void\n readonly meta: TMeta\n}\n\nconst AppContext = createContext<AppContextProps | undefined>(undefined)\n\ntype Props<TMeta = unknown> = {\n readonly children?: KubbNode\n readonly meta: TMeta\n}\n\nexport function App<TMeta = unknown>({ meta, children }: Props<TMeta>) {\n const { exit } = useContext(RootContext)\n\n return <AppContext.Provider value={{ exit, meta }}>{children}</AppContext.Provider>\n}\n\nApp.Context = AppContext\nApp.displayName = 'KubbApp'\n","export function createJSDoc({ comments }: { comments: Array<string> }): string {\n const filtered = comments.filter((c) => c.trim())\n if (!filtered.length) {\n return ''\n }\n\n return `/**\\n * ${filtered.join('\\n * ')}\\n */`\n}\n","import type { JSDoc, Key, KubbNode } from '../types.ts'\n\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\ntype Props = {\n key?: Key\n /**\n * Name of the const\n */\n name: string\n /**\n * Does this type need to be exported.\n */\n export?: boolean\n /**\n * Type to make the const being typed\n */\n type?: string\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n /**\n * Use of `const` assertions\n */\n asConst?: boolean\n children?: KubbNode\n}\n\nexport function Const({ name, export: canExport, type, JSDoc, asConst, children }: Props) {\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n const {name}{' '}\n {type && (\n <>\n {':'}\n {type}{' '}\n </>\n )}\n = {children}\n {asConst && <> as const</>}\n </>\n )\n}\n\nConst.displayName = 'KubbConst'\n","import type { KubbFile } from '@kubb/fabric-core/types'\nimport { createContext } from 'react'\nimport type { Key, KubbNode } from '../types.ts'\n\nexport type FileContextProps<TMeta extends object = object> = {\n /**\n * Name to be used to dynamicly create the baseName(based on input.path).\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: KubbFile.BaseName\n /**\n * Path will be full qualified path to a specified file.\n */\n path: KubbFile.Path\n meta?: TMeta\n}\nconst FileContext = createContext<FileContextProps>({} as FileContextProps)\n\ntype BasePropsWithBaseName = {\n /**\n * Name to be used to dynamicly create the baseName(based on input.path).\n * Based on UNIX basename\n * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix\n */\n baseName: KubbFile.BaseName\n /**\n * Path will be full qualified path to a specified file.\n */\n path: KubbFile.Path\n}\n\ntype BasePropsWithoutBaseName = {\n baseName?: never\n /**\n * Path will be full qualified path to a specified file.\n */\n path?: KubbFile.Path\n}\n\ntype BaseProps = BasePropsWithBaseName | BasePropsWithoutBaseName\n\ntype Props<TMeta> = BaseProps & {\n key?: Key\n meta?: TMeta\n banner?: string\n footer?: string\n children?: KubbNode\n}\n\nexport function File<TMeta extends object = object>({ children, ...rest }: Props<TMeta>) {\n if (!rest.baseName || !rest.path) {\n return <>{children}</>\n }\n\n return (\n <kubb-file {...rest}>\n <FileContext.Provider value={{ baseName: rest.baseName, path: rest.path, meta: rest.meta }}>{children}</FileContext.Provider>\n </kubb-file>\n )\n}\n\nFile.displayName = 'KubbFile'\n\ntype FileSourceProps = Omit<KubbFile.Source, 'value'> & {\n key?: Key\n children?: KubbNode\n}\n\nfunction FileSource({ isTypeOnly, name, isExportable, isIndexable, children }: FileSourceProps) {\n return (\n <kubb-source name={name} isTypeOnly={isTypeOnly} isExportable={isExportable} isIndexable={isIndexable}>\n {children}\n </kubb-source>\n )\n}\n\nFileSource.displayName = 'KubbFileSource'\n\ntype FileExportProps = KubbFile.Export & { key?: Key }\n\nfunction FileExport({ name, path, isTypeOnly, asAlias }: FileExportProps) {\n return <kubb-export name={name} path={path} isTypeOnly={isTypeOnly || false} asAlias={asAlias} />\n}\n\nFileExport.displayName = 'KubbFileExport'\n\ntype FileImportProps = KubbFile.Import & { key?: Key }\n\nfunction FileImport({ name, root, path, isTypeOnly, isNameSpace }: FileImportProps) {\n return <kubb-import name={name} root={root} path={path} isNameSpace={isNameSpace} isTypeOnly={isTypeOnly || false} />\n}\n\nFileImport.displayName = 'KubbFileImport'\n\nFile.Export = FileExport\nFile.Import = FileImport\nFile.Source = FileSource\nFile.Context = FileContext\n","export default function indentString(string, count = 1, options = {}) {\n\tconst {\n\t\tindent = ' ',\n\t\tincludeEmptyLines = false\n\t} = options;\n\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`input\\` to be a \\`string\\`, got \\`${typeof string}\\``\n\t\t);\n\t}\n\n\tif (typeof count !== 'number') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`count\\` to be a \\`number\\`, got \\`${typeof count}\\``\n\t\t);\n\t}\n\n\tif (count < 0) {\n\t\tthrow new RangeError(\n\t\t\t`Expected \\`count\\` to be at least 0, got \\`${count}\\``\n\t\t);\n\t}\n\n\tif (typeof indent !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`Expected \\`options.indent\\` to be a \\`string\\`, got \\`${typeof indent}\\``\n\t\t);\n\t}\n\n\tif (count === 0) {\n\t\treturn string;\n\t}\n\n\tconst regex = includeEmptyLines ? /^/gm : /^(?!\\s*$)/gm;\n\n\treturn string.replace(regex, indent.repeat(count));\n}\n","import dedent from 'dedent'\nimport indentString from 'indent-string'\nimport React from 'react'\n\ntype IndentProps = {\n size?: number\n children?: React.ReactNode\n}\n\n/**\n * Indents all children by `size` spaces.\n * Collapses consecutive <br /> tags to at most 2.\n */\nexport function Indent({ size = 2, children }: IndentProps) {\n if (!children) return null\n\n const childrenArray = React.Children.toArray(children)\n const result: React.ReactNode[] = []\n\n let prevWasBr = false\n let brCount = 0\n\n for (const child of childrenArray) {\n if (React.isValidElement(child) && child.type === 'br') {\n if (!prevWasBr || brCount < 2) {\n result.push(child)\n brCount++\n }\n prevWasBr = true\n } else {\n prevWasBr = false\n brCount = 0\n result.push(child)\n }\n }\n\n return (\n <>\n {result.map((child) => {\n if (typeof child === 'string') {\n const cleaned = dedent(child)\n return <>{indentString(cleaned, size)}</>\n }\n return (\n <>\n {' '.repeat(size)}\n {child}\n </>\n )\n })}\n </>\n )\n}\n","import type { JSDoc, Key, KubbNode } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\nimport { Indent } from './Indent.tsx'\n\ntype Props = {\n key?: Key\n /**\n * Name of the function.\n */\n name: string\n /**\n * Add default when export is being used\n */\n default?: boolean\n /**\n * Parameters/options/props that need to be used.\n */\n params?: string\n /**\n * Does this function need to be exported.\n */\n export?: boolean\n /**\n * Does the function has async/promise behaviour.\n * This will also add `Promise<returnType>` as the returnType.\n */\n async?: boolean\n /**\n * Generics that needs to be added for TypeScript.\n */\n generics?: string | string[]\n\n /**\n * ReturnType(see async for adding Promise type).\n */\n returnType?: string\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n children?: KubbNode\n}\n\nexport function Function({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, children }: Props) {\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n {isDefault && <>default </>}\n {async && <>async </>}\n function {name}\n {generics && (\n <>\n {'<'}\n {Array.isArray(generics) ? generics.join(', ').trim() : generics}\n {'>'}\n </>\n )}\n ({params}){returnType && !async && <>: {returnType}</>}\n {returnType && async && (\n <>\n : Promise{'<'}\n {returnType}\n {'>'}\n </>\n )}\n {' {'}\n <br />\n <Indent size={2}>{children}</Indent>\n <br />\n {'}'}\n </>\n )\n}\n\nFunction.displayName = 'KubbFunction'\n\ntype ArrowFunctionProps = Props & {\n /**\n * Create Arrow function in one line\n */\n singleLine?: boolean\n}\n\nfunction ArrowFunction({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine, children }: ArrowFunctionProps) {\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n {isDefault && <>default </>}\n const {name} = {async && <>async </>}\n {generics && (\n <>\n {'<'}\n {Array.isArray(generics) ? generics.join(', ').trim() : generics}\n {'>'}\n </>\n )}\n ({params}){returnType && !async && <>: {returnType}</>}\n {returnType && async && (\n <>\n : Promise{'<'}\n {returnType}\n {'>'}\n </>\n )}\n {singleLine && (\n <>\n {' => '}\n {children}\n <br />\n </>\n )}\n {!singleLine && (\n <>\n {' => {'}\n <br />\n <Indent size={2}>{children}</Indent>\n <br />\n {'}'}\n <br />\n </>\n )}\n </>\n )\n}\n\nArrowFunction.displayName = 'KubbArrowFunction'\nFunction.Arrow = ArrowFunction\n","import type { JSDoc, Key, KubbNode } from '../types.ts'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\n\ntype Props = {\n key?: Key\n /**\n * Name of the type, this needs to start with a capital letter.\n */\n name: string\n /**\n * Does this type need to be exported.\n */\n export?: boolean\n /**\n * Options for JSdocs.\n */\n JSDoc?: JSDoc\n children?: KubbNode\n}\n\nexport function Type({ name, export: canExport, JSDoc, children }: Props) {\n if (name.charAt(0).toUpperCase() !== name.charAt(0)) {\n throw new Error('Name should start with a capital letter(see TypeScript types)')\n }\n\n return (\n <>\n {JSDoc?.comments && (\n <>\n {createJSDoc({ comments: JSDoc?.comments })}\n <br />\n </>\n )}\n {canExport && <>export </>}\n type {name} = {children}\n </>\n )\n}\n\nType.displayName = 'KubbType'\n","import { useContext } from 'react'\nimport { App, type AppContextProps } from '../components/App.tsx'\n\n/**\n * `useApp` will return the current App with plugin, pluginManager, fileManager and mode.\n */\nexport function useApp<TMeta = unknown>(): AppContextProps<TMeta> {\n const app = useContext(App.Context)\n\n if (!app) {\n throw new Error('<App /> should be set')\n }\n\n return app as AppContextProps<TMeta>\n}\n","import { useContext } from 'react'\nimport type { FileContextProps } from '../components/File.tsx'\nimport { File } from '../components/File.tsx'\n\n/**\n * `useFile` will return the current file when <File/> is used.\n */\nexport function useFile(): FileContextProps {\n const file = useContext(File.Context)\n\n return file as FileContextProps\n}\n","import { useContext } from 'react'\n\nimport { Root } from '../components/Root.tsx'\n\n/**\n * `useLifecycle` will return some helpers to exit/restart the generation.\n */\nexport function useLifecycle() {\n const { exit } = useContext(Root.Context)\n\n return {\n exit: () => {\n const timeout = setTimeout(() => {\n clearTimeout(timeout)\n\n exit()\n }, 0)\n },\n }\n}\n","import type { Fabric } from '@kubb/fabric-core'\nimport { createFabric } from '@kubb/fabric-core'\nimport type { FabricConfig, FabricMode } from '@kubb/fabric-core/types'\nimport { open } from './devtools.ts'\nimport type { Options } from './plugins/reactPlugin.ts'\nimport { reactPlugin } from './plugins/reactPlugin.ts'\n\nexport function createReactFabric(\n config: FabricConfig<Options & { mode?: FabricMode; devtools?: boolean }> = {},\n): Fabric<Options & { mode?: FabricMode; devtools?: boolean }> {\n const fabric = createFabric({ mode: config.mode })\n\n if (config.devtools) {\n open()\n }\n\n fabric.use(reactPlugin, {\n stdout: config.stdout,\n stderr: config.stderr,\n debug: config.debug,\n stdin: config.stdin,\n })\n\n return fabric\n}\n","import { orderBy } from 'natural-orderby'\n\nexport type Param = {\n /**\n * `object` will return the pathParams as an object.\n *\n * `inline` will return the pathParams as comma separated params.\n * @default `'inline'`\n * @private\n */\n mode?: 'object' | 'inline' | 'inlineSpread'\n type?: 'string' | 'number' | (string & {})\n optional?: boolean\n /**\n * @example test = \"default\"\n */\n default?: string\n /**\n * Used for no TypeScript(with mode object)\n * @example test: \"default\"\n */\n value?: string\n children?: Params\n}\n\ntype ParamItem =\n | (Pick<Param, 'mode' | 'type' | 'value'> & {\n optional?: true\n default?: never\n children?: Params\n })\n | (Pick<Param, 'mode' | 'type' | 'value'> & {\n optional?: false\n default?: string\n children?: Params\n })\n\nexport type Params = Record<string, Param | undefined>\n\ntype Options = {\n type: 'constructor' | 'call' | 'object' | 'objectValue'\n transformName?: (name: string) => string\n transformType?: (type: string) => string\n}\n\nfunction order(items: Array<[key: string, item?: ParamItem]>) {\n return orderBy(\n items.filter(Boolean),\n [\n ([_key, item]) => {\n if (item?.children) {\n return undefined\n }\n return !item?.default\n },\n ([_key, item]) => {\n if (item?.children) {\n return undefined\n }\n return !item?.optional\n },\n ],\n ['desc', 'desc'],\n )\n}\n\nfunction parseChild(key: string, item: ParamItem, options: Options): string | null {\n // @ts-expect-error\n const entries = order(Object.entries(item.children))\n\n const types: string[] = []\n const names: string[] = []\n\n const optional = entries.every(([_key, item]) => item?.optional)\n\n entries.forEach(([key, entryItem]) => {\n if (entryItem) {\n const name = parseItem(key, { ...entryItem, type: undefined }, options)\n if (entryItem.children) {\n const subTypes = Object.entries(entryItem.children)\n .map(([key]) => {\n return key\n })\n .join(', ')\n\n if (subTypes) {\n names.push(`${name}: { ${subTypes} }`)\n } else {\n names.push(name)\n }\n } else {\n if (options.type === 'call' && options.transformName) {\n names.push(`${key}: ${name}`)\n } else {\n names.push(name)\n }\n }\n\n if (entries.some(([_key, item]) => item?.type)) {\n types.push(parseItem(key, { ...entryItem, default: undefined }, options))\n }\n }\n })\n\n const name = item.mode === 'inline' ? key : names.length ? `{ ${names.join(', ')} }` : undefined\n const type = item.type ? item.type : types.length ? `{ ${types.join('; ')} }` : undefined\n\n if (!name) {\n return null\n }\n\n return parseItem(\n name,\n {\n type,\n default: item.default,\n optional: !item.default ? optional : undefined,\n } as ParamItem,\n options,\n )\n}\n\nfunction parseItem(name: string, item: ParamItem, options: Options): string {\n const acc: string[] = []\n const transformedName = options.transformName ? options.transformName(name) : name\n const transformedType = options.transformType && item.type ? options.transformType(item.type) : item.type\n\n if (options.type === 'object') {\n return transformedName\n }\n\n if (options.type === 'objectValue') {\n return item.value ? `${transformedName}: ${item.value}` : transformedName\n }\n\n //LEGACY\n if (item.type && options.type === 'constructor') {\n if (item.optional) {\n acc.push(`${transformedName}?: ${transformedType}`)\n } else {\n acc.push(`${transformedName}: ${transformedType}${item.default ? ` = ${item.default}` : ''}`)\n }\n } else if (item.default && options.type === 'constructor') {\n acc.push(`${transformedName} = ${item.default}`)\n } else if (item.value) {\n acc.push(`${transformedName} : ${item.value}`)\n } else if (item.mode === 'inlineSpread') {\n acc.push(`... ${transformedName}`)\n } else {\n acc.push(transformedName)\n }\n\n return acc[0] as string\n}\n\nexport function getFunctionParams(params: Params, options: Options): string {\n const entries = order(Object.entries(params as Record<string, ParamItem | undefined>))\n\n return entries\n .reduce((acc, [key, item]) => {\n if (!item) {\n return acc\n }\n\n if (item.children) {\n if (Object.keys(item.children).length === 0) {\n return acc\n }\n\n if (item.mode === 'inlineSpread') {\n return [...acc, getFunctionParams(item.children, options)]\n }\n\n const parsedItem = parseChild(key, item, options)\n if (!parsedItem) {\n return acc\n }\n\n return [...acc, parsedItem]\n }\n\n const parsedItem = parseItem(key, item, options)\n\n return [...acc, parsedItem]\n }, [] as string[])\n .join(', ')\n}\n\nexport function createFunctionParams(params: Params): Params {\n return params\n}\n// TODO use of zod\n//TODO use of string as `$name: $type` to create templates for functions instead of call/constructor\nexport class FunctionParams {\n #params: Params\n\n static factory(params: Params) {\n return new FunctionParams(params)\n }\n constructor(params: Params) {\n this.#params = params\n }\n\n get params(): Params {\n return this.#params\n }\n\n get flatParams(): Params {\n const flatter = (acc: Params, [key, item]: [key: string, item?: Param]): Params => {\n if (item?.children) {\n return Object.entries(item.children).reduce(flatter, acc)\n }\n if (item) {\n acc[key] = item\n }\n\n return acc\n }\n return Object.entries(this.#params).reduce(flatter, {} as Params)\n }\n\n toCall({ transformName, transformType }: Pick<Options, 'transformName' | 'transformType'> = {}): string {\n return getFunctionParams(this.#params, { type: 'call', transformName, transformType })\n }\n\n toObject(): string {\n return getFunctionParams(this.#params, { type: 'object' })\n }\n toObjectValue(): string {\n return getFunctionParams(this.#params, { type: 'objectValue' })\n }\n\n toConstructor(): string {\n return getFunctionParams(this.#params, { type: 'constructor' })\n }\n}\n","// import './globals.ts'\nimport * as React from 'react'\n\n// expose fabric core helpers\nexport * from '@kubb/fabric-core'\n\n// react helpers\nexport const useState = React.useState\nexport const createContext = React.createContext\nexport const createElement = React.createElement\nexport const Fragment = React.Fragment\nexport const use = React.use\nexport const useContext = React.useContext\nexport const useEffect = React.useEffect\nexport const useReducer = React.useReducer\nexport const useRef = React.useRef\n// // components\nexport { App } from './components/App.tsx'\nexport { Const } from './components/Const.tsx'\nexport { File } from './components/File.tsx'\nexport { Function } from './components/Function.tsx'\nexport { Indent } from './components/Indent.tsx'\nexport { Type } from './components/Type.tsx'\nexport { useApp } from './composables/useApp.ts'\nexport { useFile } from './composables/useFile.ts'\nexport { useLifecycle } from './composables/useLifecycle.tsx'\nexport { createReactFabric } from './createReactFabric.ts'\nexport { Runtime } from './Runtime.tsx'\n// utils\nexport { createFunctionParams, FunctionParams } from './utils/getFunctionParams.ts'\n"],"x_google_ignoreList":[4],"mappings":";;;;;;;;;;;;;AAYA,MAAM,6CAAwD,OAAU;AAOxE,SAAgB,IAAqB,EAAE,MAAM,YAA0B;CACrE,MAAM,EAAE,sCAAoB,YAAY;AAExC,QAAO,oBAAC,WAAW;EAAS,OAAO;GAAE;GAAM;GAAM;EAAG;GAA+B;;AAGrF,IAAI,UAAU;AACd,IAAI,cAAc;;;;AC1BlB,SAAgB,YAAY,EAAE,YAAiD;CAC7E,MAAM,WAAW,SAAS,QAAQ,MAAM,EAAE,MAAM,CAAC;AACjD,KAAI,CAAC,SAAS,OACZ,QAAO;AAGT,QAAO,WAAW,SAAS,KAAK,QAAQ,CAAC;;;;;ACuB3C,SAAgB,MAAM,EAAE,MAAM,QAAQ,WAAW,MAAM,OAAO,SAAS,YAAmB;AACxF,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AAI;AAE3D,OAAI,KACF,KAAI,OAAO;AAGb,UAAO;;AAET,SAAO,OAAO,wCAAQ,KAAY,CAAC,CAAC,OAAO,SAAS,EAAE,CAAW;;CAGnE,OAAO,EAAE,eAAe,kBAAoE,EAAE,EAAU;AACtG,SAAO,kDAAkB,KAAY,EAAE;GAAE,MAAM;GAAQ;GAAe;GAAe,CAAC;;CAGxF,WAAmB;AACjB,SAAO,kDAAkB,KAAY,EAAE,EAAE,MAAM,UAAU,CAAC;;CAE5D,gBAAwB;AACtB,SAAO,kDAAkB,KAAY,EAAE,EAAE,MAAM,eAAe,CAAC;;CAGjE,gBAAwB;AACtB,SAAO,kDAAkB,KAAY,EAAE,EAAE,MAAM,eAAe,CAAC;;;;;;AClOnE,MAAa,wBAAiB;AAC9B,MAAa,6BAAsB;AACnC,MAAa,6BAAsB;AACnC,MAAa,wBAAiB;AAC9B,MAAa,mBAAY;AACzB,MAAa,0BAAmB;AAChC,MAAa,yBAAkB;AAC/B,MAAa,0BAAmB;AAChC,MAAa,sBAAe"}
|
package/dist/jsx-dev-runtime.cjs
CHANGED
|
@@ -1,19 +1,232 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_chunk = require('./chunk-DSlc6foC.cjs');
|
|
2
|
+
const require_react$1 = require('./react-DNGR2CL5.cjs');
|
|
2
3
|
|
|
4
|
+
//#region ../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-jsx-dev-runtime.production.js
|
|
5
|
+
/**
|
|
6
|
+
* @license React
|
|
7
|
+
* react-jsx-dev-runtime.production.js
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the MIT license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*/
|
|
14
|
+
var require_react_jsx_dev_runtime_production = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-jsx-dev-runtime.production.js": ((exports) => {
|
|
15
|
+
var REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
|
|
16
|
+
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
17
|
+
exports.jsxDEV = void 0;
|
|
18
|
+
}) });
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region ../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-jsx-dev-runtime.development.js
|
|
22
|
+
/**
|
|
23
|
+
* @license React
|
|
24
|
+
* react-jsx-dev-runtime.development.js
|
|
25
|
+
*
|
|
26
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
27
|
+
*
|
|
28
|
+
* This source code is licensed under the MIT license found in the
|
|
29
|
+
* LICENSE file in the root directory of this source tree.
|
|
30
|
+
*/
|
|
31
|
+
var require_react_jsx_dev_runtime_development = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modules/.pnpm/react@19.2.0/node_modules/react/cjs/react-jsx-dev-runtime.development.js": ((exports) => {
|
|
32
|
+
"production" !== process.env.NODE_ENV && (function() {
|
|
33
|
+
function getComponentNameFromType(type) {
|
|
34
|
+
if (null == type) return null;
|
|
35
|
+
if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
36
|
+
if ("string" === typeof type) return type;
|
|
37
|
+
switch (type) {
|
|
38
|
+
case REACT_FRAGMENT_TYPE$1: return "Fragment";
|
|
39
|
+
case REACT_PROFILER_TYPE: return "Profiler";
|
|
40
|
+
case REACT_STRICT_MODE_TYPE: return "StrictMode";
|
|
41
|
+
case REACT_SUSPENSE_TYPE: return "Suspense";
|
|
42
|
+
case REACT_SUSPENSE_LIST_TYPE: return "SuspenseList";
|
|
43
|
+
case REACT_ACTIVITY_TYPE: return "Activity";
|
|
44
|
+
}
|
|
45
|
+
if ("object" === typeof type) switch ("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof) {
|
|
46
|
+
case REACT_PORTAL_TYPE: return "Portal";
|
|
47
|
+
case REACT_CONTEXT_TYPE: return type.displayName || "Context";
|
|
48
|
+
case REACT_CONSUMER_TYPE: return (type._context.displayName || "Context") + ".Consumer";
|
|
49
|
+
case REACT_FORWARD_REF_TYPE:
|
|
50
|
+
var innerType = type.render;
|
|
51
|
+
type = type.displayName;
|
|
52
|
+
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
53
|
+
return type;
|
|
54
|
+
case REACT_MEMO_TYPE: return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
55
|
+
case REACT_LAZY_TYPE:
|
|
56
|
+
innerType = type._payload;
|
|
57
|
+
type = type._init;
|
|
58
|
+
try {
|
|
59
|
+
return getComponentNameFromType(type(innerType));
|
|
60
|
+
} catch (x) {}
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
function testStringCoercion(value) {
|
|
65
|
+
return "" + value;
|
|
66
|
+
}
|
|
67
|
+
function checkKeyStringCoercion(value) {
|
|
68
|
+
try {
|
|
69
|
+
testStringCoercion(value);
|
|
70
|
+
var JSCompiler_inline_result = !1;
|
|
71
|
+
} catch (e) {
|
|
72
|
+
JSCompiler_inline_result = !0;
|
|
73
|
+
}
|
|
74
|
+
if (JSCompiler_inline_result) {
|
|
75
|
+
JSCompiler_inline_result = console;
|
|
76
|
+
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
77
|
+
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
78
|
+
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
79
|
+
return testStringCoercion(value);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
function getTaskName(type) {
|
|
83
|
+
if (type === REACT_FRAGMENT_TYPE$1) return "<>";
|
|
84
|
+
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>";
|
|
85
|
+
try {
|
|
86
|
+
var name = getComponentNameFromType(type);
|
|
87
|
+
return name ? "<" + name + ">" : "<...>";
|
|
88
|
+
} catch (x) {
|
|
89
|
+
return "<...>";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function getOwner() {
|
|
93
|
+
var dispatcher = ReactSharedInternals.A;
|
|
94
|
+
return null === dispatcher ? null : dispatcher.getOwner();
|
|
95
|
+
}
|
|
96
|
+
function UnknownOwner() {
|
|
97
|
+
return Error("react-stack-top-frame");
|
|
98
|
+
}
|
|
99
|
+
function hasValidKey(config) {
|
|
100
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
101
|
+
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
102
|
+
if (getter && getter.isReactWarning) return !1;
|
|
103
|
+
}
|
|
104
|
+
return void 0 !== config.key;
|
|
105
|
+
}
|
|
106
|
+
function defineKeyPropWarningGetter(props, displayName) {
|
|
107
|
+
function warnAboutAccessingKey() {
|
|
108
|
+
specialPropKeyWarningShown || (specialPropKeyWarningShown = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
|
|
109
|
+
}
|
|
110
|
+
warnAboutAccessingKey.isReactWarning = !0;
|
|
111
|
+
Object.defineProperty(props, "key", {
|
|
112
|
+
get: warnAboutAccessingKey,
|
|
113
|
+
configurable: !0
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function elementRefGetterWithDeprecationWarning() {
|
|
117
|
+
var componentName = getComponentNameFromType(this.type);
|
|
118
|
+
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
119
|
+
componentName = this.props.ref;
|
|
120
|
+
return void 0 !== componentName ? componentName : null;
|
|
121
|
+
}
|
|
122
|
+
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
123
|
+
var refProp = props.ref;
|
|
124
|
+
type = {
|
|
125
|
+
$$typeof: REACT_ELEMENT_TYPE,
|
|
126
|
+
type,
|
|
127
|
+
key,
|
|
128
|
+
props,
|
|
129
|
+
_owner: owner
|
|
130
|
+
};
|
|
131
|
+
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
132
|
+
enumerable: !1,
|
|
133
|
+
get: elementRefGetterWithDeprecationWarning
|
|
134
|
+
}) : Object.defineProperty(type, "ref", {
|
|
135
|
+
enumerable: !1,
|
|
136
|
+
value: null
|
|
137
|
+
});
|
|
138
|
+
type._store = {};
|
|
139
|
+
Object.defineProperty(type._store, "validated", {
|
|
140
|
+
configurable: !1,
|
|
141
|
+
enumerable: !1,
|
|
142
|
+
writable: !0,
|
|
143
|
+
value: 0
|
|
144
|
+
});
|
|
145
|
+
Object.defineProperty(type, "_debugInfo", {
|
|
146
|
+
configurable: !1,
|
|
147
|
+
enumerable: !1,
|
|
148
|
+
writable: !0,
|
|
149
|
+
value: null
|
|
150
|
+
});
|
|
151
|
+
Object.defineProperty(type, "_debugStack", {
|
|
152
|
+
configurable: !1,
|
|
153
|
+
enumerable: !1,
|
|
154
|
+
writable: !0,
|
|
155
|
+
value: debugStack
|
|
156
|
+
});
|
|
157
|
+
Object.defineProperty(type, "_debugTask", {
|
|
158
|
+
configurable: !1,
|
|
159
|
+
enumerable: !1,
|
|
160
|
+
writable: !0,
|
|
161
|
+
value: debugTask
|
|
162
|
+
});
|
|
163
|
+
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
164
|
+
return type;
|
|
165
|
+
}
|
|
166
|
+
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
167
|
+
var children = config.children;
|
|
168
|
+
if (void 0 !== children) if (isStaticChildren) if (isArrayImpl(children)) {
|
|
169
|
+
for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++) validateChildKeys(children[isStaticChildren]);
|
|
170
|
+
Object.freeze && Object.freeze(children);
|
|
171
|
+
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
172
|
+
else validateChildKeys(children);
|
|
173
|
+
if (hasOwnProperty.call(config, "key")) {
|
|
174
|
+
children = getComponentNameFromType(type);
|
|
175
|
+
var keys = Object.keys(config).filter(function(k) {
|
|
176
|
+
return "key" !== k;
|
|
177
|
+
});
|
|
178
|
+
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
179
|
+
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error("A props object containing a \"key\" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />", isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = !0);
|
|
180
|
+
}
|
|
181
|
+
children = null;
|
|
182
|
+
void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
183
|
+
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
184
|
+
if ("key" in config) {
|
|
185
|
+
maybeKey = {};
|
|
186
|
+
for (var propName in config) "key" !== propName && (maybeKey[propName] = config[propName]);
|
|
187
|
+
} else maybeKey = config;
|
|
188
|
+
children && defineKeyPropWarningGetter(maybeKey, "function" === typeof type ? type.displayName || type.name || "Unknown" : type);
|
|
189
|
+
return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
|
|
190
|
+
}
|
|
191
|
+
function validateChildKeys(node) {
|
|
192
|
+
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
193
|
+
}
|
|
194
|
+
function isValidElement(object) {
|
|
195
|
+
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
196
|
+
}
|
|
197
|
+
var React = require_react$1.require_react(), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE$1 = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
198
|
+
return null;
|
|
199
|
+
};
|
|
200
|
+
React = { react_stack_bottom_frame: function(callStackForError) {
|
|
201
|
+
return callStackForError();
|
|
202
|
+
} };
|
|
203
|
+
var specialPropKeyWarningShown;
|
|
204
|
+
var didWarnAboutElementRef = {};
|
|
205
|
+
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
|
|
206
|
+
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
207
|
+
var didWarnAboutKeySpread = {};
|
|
208
|
+
exports.Fragment = REACT_FRAGMENT_TYPE$1;
|
|
209
|
+
exports.jsxDEV = function(type, config, maybeKey, isStaticChildren) {
|
|
210
|
+
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
211
|
+
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
212
|
+
};
|
|
213
|
+
})();
|
|
214
|
+
}) });
|
|
215
|
+
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region ../../node_modules/.pnpm/react@19.2.0/node_modules/react/jsx-dev-runtime.js
|
|
218
|
+
var require_jsx_dev_runtime = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modules/.pnpm/react@19.2.0/node_modules/react/jsx-dev-runtime.js": ((exports, module) => {
|
|
219
|
+
if (process.env.NODE_ENV === "production") module.exports = require_react_jsx_dev_runtime_production();
|
|
220
|
+
else module.exports = require_react_jsx_dev_runtime_development();
|
|
221
|
+
}) });
|
|
222
|
+
|
|
223
|
+
//#endregion
|
|
3
224
|
//#region src/jsx-dev-runtime.ts
|
|
4
|
-
var import_jsx_dev_runtime =
|
|
225
|
+
var import_jsx_dev_runtime = /* @__PURE__ */ require_chunk.__toESM(require_jsx_dev_runtime(), 1);
|
|
226
|
+
const Fragment = import_jsx_dev_runtime.Fragment;
|
|
227
|
+
const jsxDEV = import_jsx_dev_runtime.jsxDEV;
|
|
5
228
|
|
|
6
229
|
//#endregion
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
get: function () {
|
|
10
|
-
return import_jsx_dev_runtime.Fragment;
|
|
11
|
-
}
|
|
12
|
-
});
|
|
13
|
-
Object.defineProperty(exports, 'jsxDEV', {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: function () {
|
|
16
|
-
return import_jsx_dev_runtime.jsxDEV;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
230
|
+
exports.Fragment = Fragment;
|
|
231
|
+
exports.jsxDEV = jsxDEV;
|
|
19
232
|
//# sourceMappingURL=jsx-dev-runtime.cjs.map
|