@kubb/react-fabric 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/globals.d.cts +1 -1
- package/dist/globals.d.ts +1 -1
- package/dist/index.cjs +44 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -22
- package/dist/index.d.ts +22 -22
- package/dist/index.js +44 -82
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.cts +4 -4
- package/dist/jsx-dev-runtime.d.ts +2 -2
- package/dist/{jsx-namespace-BCUpJNav.d.ts → jsx-namespace-BAkGpU6g.d.ts} +2 -2
- package/dist/{jsx-namespace-BQxIePeA.d.cts → jsx-namespace-CCPa1Nut.d.cts} +2 -2
- package/dist/jsx-runtime.d.cts +4 -4
- package/dist/jsx-runtime.d.ts +2 -2
- package/dist/{types-CW3VRxQ8.d.ts → types-CSUzVTpn.d.ts} +2 -3
- package/dist/{types-DEdDk69v.d.cts → types-DP2mgqeb.d.cts} +2 -3
- package/dist/types.d.cts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +2 -2
- package/src/utils/getFunctionParams.ts +76 -97
package/dist/globals.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./Fabric-C61uYmUy.cjs";
|
|
2
|
-
import { c as KubbExportProps, d as KubbNode, f as KubbSourceProps, l as KubbFileProps, m as LineBreakProps, p as KubbTextProps, s as KubbElement, u as KubbImportProps } from "./types-
|
|
2
|
+
import { c as KubbExportProps, d as KubbNode, f as KubbSourceProps, l as KubbFileProps, m as LineBreakProps, p as KubbTextProps, s as KubbElement, u as KubbImportProps } from "./types-DP2mgqeb.cjs";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/globals.d.ts
|
package/dist/globals.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./Fabric-DitK3IEP.js";
|
|
2
|
-
import { c as KubbExportProps, d as KubbNode, f as KubbSourceProps, l as KubbFileProps, m as LineBreakProps, p as KubbTextProps, s as KubbElement, u as KubbImportProps } from "./types-
|
|
2
|
+
import { c as KubbExportProps, d as KubbNode, f as KubbSourceProps, l as KubbFileProps, m as LineBreakProps, p as KubbTextProps, s as KubbElement, u as KubbImportProps } from "./types-CSUzVTpn.js";
|
|
3
3
|
import React from "react";
|
|
4
4
|
|
|
5
5
|
//#region src/globals.d.ts
|
package/dist/index.cjs
CHANGED
|
@@ -294,15 +294,6 @@ function createReactFabric(config = {}) {
|
|
|
294
294
|
|
|
295
295
|
//#endregion
|
|
296
296
|
//#region src/utils/getFunctionParams.ts
|
|
297
|
-
const TSBasicTypes = [
|
|
298
|
-
"number",
|
|
299
|
-
"string",
|
|
300
|
-
"null",
|
|
301
|
-
"undefined",
|
|
302
|
-
"bigint",
|
|
303
|
-
"boolean",
|
|
304
|
-
"symbol"
|
|
305
|
-
];
|
|
306
297
|
function order(items) {
|
|
307
298
|
return (0, natural_orderby.orderBy)(items.filter(Boolean), [([_key, item]) => {
|
|
308
299
|
if (item === null || item === void 0 ? void 0 : item.children) return;
|
|
@@ -312,45 +303,31 @@ function order(items) {
|
|
|
312
303
|
return !(item === null || item === void 0 ? void 0 : item.optional);
|
|
313
304
|
}], ["desc", "desc"]);
|
|
314
305
|
}
|
|
315
|
-
function processEntry(options) {
|
|
316
|
-
return function([key, item]) {
|
|
317
|
-
if (!item) return null;
|
|
318
|
-
if (!item.children) return parseItem(key, item, options);
|
|
319
|
-
if (Object.keys(item.children).length === 0) return null;
|
|
320
|
-
if (item.mode === "inlineSpread") return getFunctionParams(item.children, options);
|
|
321
|
-
return parseChild(key, item, options);
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
function processChildEntry(options, entries) {
|
|
325
|
-
return function([key, item]) {
|
|
326
|
-
if (!item) return null;
|
|
327
|
-
const result = {
|
|
328
|
-
name: null,
|
|
329
|
-
type: null
|
|
330
|
-
};
|
|
331
|
-
const name = parseItem(key, {
|
|
332
|
-
...item,
|
|
333
|
-
type: void 0
|
|
334
|
-
}, options, item.type);
|
|
335
|
-
if (!item.children) result.name = options.type === "call" && options.transformName ? `${key}: ${name}` : name;
|
|
336
|
-
else {
|
|
337
|
-
const subTypes = Object.keys(item.children).join(", ");
|
|
338
|
-
result.name = subTypes ? `${name}: { ${subTypes} }` : name;
|
|
339
|
-
}
|
|
340
|
-
if (entries.some(([_k, entries$1]) => !!(entries$1 === null || entries$1 === void 0 ? void 0 : entries$1.type))) result.type = parseItem(key, {
|
|
341
|
-
...item,
|
|
342
|
-
default: void 0
|
|
343
|
-
}, options, item.type);
|
|
344
|
-
return result;
|
|
345
|
-
};
|
|
346
|
-
}
|
|
347
306
|
function parseChild(key, item, options) {
|
|
348
307
|
const entries = order(Object.entries(item.children));
|
|
308
|
+
const types = [];
|
|
309
|
+
const names = [];
|
|
349
310
|
const optional = entries.every(([_key, item$1]) => item$1 === null || item$1 === void 0 ? void 0 : item$1.optional);
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
311
|
+
entries.forEach(([key$1, entryItem]) => {
|
|
312
|
+
if (entryItem) {
|
|
313
|
+
const name$1 = parseItem(key$1, {
|
|
314
|
+
...entryItem,
|
|
315
|
+
type: void 0
|
|
316
|
+
}, options);
|
|
317
|
+
if (entryItem.children) {
|
|
318
|
+
const subTypes = Object.entries(entryItem.children).map(([key$2]) => {
|
|
319
|
+
return key$2;
|
|
320
|
+
}).join(", ");
|
|
321
|
+
if (subTypes) names.push(`${name$1}: { ${subTypes} }`);
|
|
322
|
+
else names.push(name$1);
|
|
323
|
+
} else if (options.type === "call" && options.transformName) names.push(`${key$1}: ${name$1}`);
|
|
324
|
+
else names.push(name$1);
|
|
325
|
+
if (entries.some(([_key, item$1]) => item$1 === null || item$1 === void 0 ? void 0 : item$1.type)) types.push(parseItem(key$1, {
|
|
326
|
+
...entryItem,
|
|
327
|
+
default: void 0
|
|
328
|
+
}, options));
|
|
329
|
+
}
|
|
330
|
+
});
|
|
354
331
|
const name = item.mode === "inline" ? key : names.length ? `{ ${names.join(", ")} }` : void 0;
|
|
355
332
|
const type = item.type ? item.type : types.length ? `{ ${types.join("; ")} }` : void 0;
|
|
356
333
|
if (!name) return null;
|
|
@@ -358,47 +335,35 @@ function parseChild(key, item, options) {
|
|
|
358
335
|
type,
|
|
359
336
|
default: item.default,
|
|
360
337
|
optional: !item.default ? optional : void 0
|
|
361
|
-
}, options
|
|
338
|
+
}, options);
|
|
362
339
|
}
|
|
363
|
-
function parseItem(name, item, options
|
|
340
|
+
function parseItem(name, item, options) {
|
|
341
|
+
const acc = [];
|
|
364
342
|
const transformedName = options.transformName ? options.transformName(name) : name;
|
|
365
343
|
const transformedType = options.transformType && item.type ? options.transformType(item.type) : item.type;
|
|
366
344
|
if (options.type === "object") return transformedName;
|
|
367
345
|
if (options.type === "objectValue") return item.value ? `${transformedName}: ${item.value}` : transformedName;
|
|
368
|
-
if (options.type === "
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
if (isObject) return transformedType ? `${transformedName}: ${transformedType} = ${item.default}` : `${transformedName} = ${item.default}`;
|
|
376
|
-
return transformedType ? `${transformedName}: () => ${transformedType} = () => ${item.default}` : `${transformedName} = () => ${item.default}`;
|
|
377
|
-
}
|
|
378
|
-
if (item.optional) {
|
|
379
|
-
if (isObject) return transformedType ? `${transformedName}?: ${transformedType}` : transformedName;
|
|
380
|
-
return transformedType ? `${transformedName}?: () => ${transformedType}` : transformedName;
|
|
381
|
-
}
|
|
382
|
-
if (transformedType) {
|
|
383
|
-
if (isObject) return `${transformedName}: ${transformedType}`;
|
|
384
|
-
return `${transformedName}: () => ${transformedType}`;
|
|
385
|
-
}
|
|
386
|
-
return transformedName;
|
|
387
|
-
}
|
|
388
|
-
if (options.type === "constructor") {
|
|
389
|
-
if (item.mode === "inlineSpread") return `... ${transformedName}`;
|
|
390
|
-
if (item.value) return `${transformedName} : ${item.value}`;
|
|
391
|
-
if (item.default) return transformedType ? `${transformedName}: ${transformedType} = ${item.default}` : `${transformedName} = ${item.default}`;
|
|
392
|
-
if (item.optional) return transformedType ? `${transformedName}?: ${transformedType}` : `${transformedName}`;
|
|
393
|
-
if (transformedType) return `${transformedName}: ${transformedType}`;
|
|
394
|
-
return transformedName;
|
|
395
|
-
}
|
|
396
|
-
return transformedName;
|
|
346
|
+
if (item.type && options.type === "constructor") if (item.optional) acc.push(`${transformedName}?: ${transformedType}`);
|
|
347
|
+
else acc.push(`${transformedName}: ${transformedType}${item.default ? ` = ${item.default}` : ""}`);
|
|
348
|
+
else if (item.default && options.type === "constructor") acc.push(`${transformedName} = ${item.default}`);
|
|
349
|
+
else if (item.value) acc.push(`${transformedName} : ${item.value}`);
|
|
350
|
+
else if (item.mode === "inlineSpread") acc.push(`... ${transformedName}`);
|
|
351
|
+
else acc.push(transformedName);
|
|
352
|
+
return acc[0];
|
|
397
353
|
}
|
|
398
354
|
function getFunctionParams(params, options) {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
355
|
+
return order(Object.entries(params)).reduce((acc, [key, item]) => {
|
|
356
|
+
if (!item) return acc;
|
|
357
|
+
if (item.children) {
|
|
358
|
+
if (Object.keys(item.children).length === 0) return acc;
|
|
359
|
+
if (item.mode === "inlineSpread") return [...acc, getFunctionParams(item.children, options)];
|
|
360
|
+
const parsedItem$1 = parseChild(key, item, options);
|
|
361
|
+
if (!parsedItem$1) return acc;
|
|
362
|
+
return [...acc, parsedItem$1];
|
|
363
|
+
}
|
|
364
|
+
const parsedItem = parseItem(key, item, options);
|
|
365
|
+
return [...acc, parsedItem];
|
|
366
|
+
}, []).join(", ");
|
|
402
367
|
}
|
|
403
368
|
function createFunctionParams(params) {
|
|
404
369
|
return params;
|
|
@@ -439,9 +404,6 @@ var FunctionParams = class FunctionParams {
|
|
|
439
404
|
toConstructor() {
|
|
440
405
|
return getFunctionParams(require_reactPlugin._classPrivateFieldGet2(_params, this), { type: "constructor" });
|
|
441
406
|
}
|
|
442
|
-
toCallback() {
|
|
443
|
-
return getFunctionParams(require_reactPlugin._classPrivateFieldGet2(_params, this), { type: "callback" });
|
|
444
|
-
}
|
|
445
407
|
};
|
|
446
408
|
|
|
447
409
|
//#endregion
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["RootContext","result: React.ReactNode[]","Root","reactPlugin","entries","item","name","type","entries: ParamEntry[]"],"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\nconst TSBasicTypes = ['number', 'string', 'null', 'undefined', 'bigint', 'boolean', 'symbol'] as const\n\ntype ParamEntry = [key: string, item?: ParamItem | undefined]\n\nexport type Params = Record<string, Param | undefined>\n\ntype Options = {\n type: 'constructor' | 'call' | 'object' | 'objectValue' | 'callback'\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 processEntry(options: Options): ([key, item]: ParamEntry) => string | null {\n return function ([key, item]: ParamEntry): string | null {\n if (!item) return null\n\n if (!item.children) return parseItem(key, item, options)\n if (Object.keys(item.children).length === 0) return null\n\n if (item.mode === 'inlineSpread') {\n return getFunctionParams(item.children, options)\n }\n\n return parseChild(key, item, options)\n }\n}\n\nfunction processChildEntry(options: Options, entries: ParamEntry[]): ([key, item]: ParamEntry) => { name: string | null; type: string | null } | null {\n return function ([key, item]: ParamEntry): { name: string | null; type: string | null } | null {\n if (!item) return null\n\n const result = { name: null, type: null } as { name: string | null; type: string | null }\n\n const name = parseItem(key, { ...item, type: undefined }, options, item.type)\n\n if (!item.children) {\n result.name = options.type === 'call' && options.transformName ? `${key}: ${name}` : name\n } else {\n const subTypes = Object.keys(item.children).join(', ')\n result.name = subTypes ? `${name}: { ${subTypes} }` : name\n }\n\n const anySiblingHasType = entries.some(([_k, entries]) => !!entries?.type)\n if (anySiblingHasType) {\n result.type = parseItem(key, { ...item, default: undefined }, options, item.type)\n }\n\n return result\n }\n}\n\nfunction parseChild(key: string, item: ParamItem, options: Options): string | null {\n const entries = order(Object.entries(item.children as Record<string, ParamItem | undefined>))\n\n const optional = entries.every(([_key, item]) => item?.optional)\n\n const childEntryProcessor = processChildEntry(options, entries)\n const result = entries.map(childEntryProcessor).filter((item): item is { name: string | null; type: string | null } => item !== null)\n\n const names = result.map(({ name }) => name).filter(Boolean)\n const types = result.map(({ type }) => type).filter(Boolean)\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 item.type,\n )\n}\n\nfunction parseItem(name: string, item: ParamItem, options: Options, parentType?: string): 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 if (options.type === 'callback') {\n const isObject = (transformedType?.includes('{') && transformedType?.includes('}')) ?? false\n\n if (transformedType === parentType) {\n if (transformedType && !TSBasicTypes.includes(transformedType as (typeof TSBasicTypes)[number])) {\n return `${transformedName}: { [K in keyof ${transformedType}]: () => ${transformedType}[K] }`\n }\n }\n if (item.default) {\n if (isObject) return transformedType ? `${transformedName}: ${transformedType} = ${item.default}` : `${transformedName} = ${item.default}`\n return transformedType ? `${transformedName}: () => ${transformedType} = () => ${item.default}` : `${transformedName} = () => ${item.default}`\n }\n if (item.optional) {\n if (isObject) return transformedType ? `${transformedName}?: ${transformedType}` : transformedName\n return transformedType ? `${transformedName}?: () => ${transformedType}` : transformedName\n }\n if (transformedType) {\n if (isObject) return `${transformedName}: ${transformedType}`\n return `${transformedName}: () => ${transformedType}`\n }\n return transformedName\n }\n\n if (options.type === 'constructor') {\n if (item.mode === 'inlineSpread') {\n return `... ${transformedName}`\n }\n if (item.value) {\n return `${transformedName} : ${item.value}`\n }\n if (item.default) {\n return transformedType ? `${transformedName}: ${transformedType} = ${item.default}` : `${transformedName} = ${item.default}`\n }\n if (item.optional) {\n return transformedType ? `${transformedName}?: ${transformedType}` : `${transformedName}`\n }\n if (transformedType) {\n return `${transformedName}: ${transformedType}`\n }\n\n return transformedName\n }\n\n return transformedName\n}\n\nexport function getFunctionParams(params: Params, options: Options): string {\n const entries: ParamEntry[] = order(Object.entries(params as Record<string, ParamItem | undefined>))\n const entryProcessor = processEntry(options)\n\n return entries\n .map(entryProcessor)\n .filter((item): item is string => item !== null)\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 toCallback(): string {\n return getFunctionParams(this.#params, { type: 'callback' })\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,sCAAoBA,gCAAY;AAExC,QAAO,wCAAC,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,QACE;iDACG,MAAO,aACN,oFACG,YAAY,EAAE,wDAAU,MAAO,UAAU,CAAC,E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,MAAM,eAAe,CAAC;;CAGjE,gBAAwB;AACtB,SAAO,sEAAkB,KAAY,EAAE,EAAE,MAAM,eAAe,CAAC;;CAGjE,aAAqB;AACnB,SAAO,sEAAkB,KAAY,EAAE,EAAE,MAAM,YAAY,CAAC;;;;;;ACvPhE,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"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["RootContext","result: React.ReactNode[]","Root","reactPlugin","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 * 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;A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hD,SAAO,CAAC,GAAG,KAAK,WAAW;IAC1B,EAAE,CAAa,CACjB,KAAK,KAAK;;AAGf,SAAgB,qBAAqB,QAAwB;AAC3D,QAAO;;;AAIT,IAAa,iBAAb,MAAa,eAAe;CAG1B,OAAO,QAAQ,QAAgB;AAC7B,SAAO,IAAI,eAAe,OAAO;;CAEnC,YAAY,QAAgB;;AAC1B,4DAAe,OAAM;;CAGvB,IAAI,SAAiB;AACnB,6DAAO,KAAY;;CAGrB,IAAI,aAAqB;EACvB,MAAM,WAAW,KAAa,CAAC,KAAK,UAA+C;AACjF,mDAAI,KAAM,SACR,QAAO,OAAO,QAAQ,KAAK,SAAS,CAAC,OAAO,SAAS,IAAI;AAE3D,OAAI,KACF,KAAI,OAAO;AAGb,UAAO;;AAET,SAAO,OAAO,4DAAQ,KAAY,CAAC,CAAC,OAAO,SAAS,EAAE,CAAW;;CAGnE,OAAO,EAAE,eAAe,kBAAoE,EAAE,EAAU;AACtG,SAAO,sEAAkB,KAAY,EAAE;GAAE,MAAM;GAAQ;GAAe;GAAe,CAAC;;CAGxF,WAAmB;AACjB,SAAO,sEAAkB,KAAY,EAAE,EAAE,MAAM,UAAU,CAAC;;CAE5D,gBAAwB;AACtB,SAAO,sEAAkB,KAAY,EAAE,EAAE,MAAM,eAAe,CAAC;;CAGjE,gBAAwB;AACtB,SAAO,sEAAkB,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/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as FabricOptions, b as Source, c as FileManager, f as BaseName, g as Import, h as File$1, i as FabricMode, l as FileProcessor, n as FabricConfig, p as Export, t as Fabric, v as Path, y as ResolvedFile } from "./Fabric-C61uYmUy.cjs";
|
|
2
|
-
import { a as JSDoc, d as KubbNode, g as FunctionParams, o as Key, y as createFunctionParams } from "./types-
|
|
2
|
+
import { a as JSDoc, d as KubbNode, g as FunctionParams, o as Key, y as createFunctionParams } from "./types-DP2mgqeb.cjs";
|
|
3
3
|
import { t as Options$1 } from "./reactPlugin-B4xarQJX.cjs";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react3 from "react";
|
|
5
5
|
import React, { ReactNode } from "react";
|
|
6
6
|
|
|
7
7
|
//#region ../fabric-core/src/createFabric.d.ts
|
|
@@ -36,9 +36,9 @@ type Props$4<TMeta = unknown> = {
|
|
|
36
36
|
declare function App<TMeta = unknown>({
|
|
37
37
|
meta,
|
|
38
38
|
children
|
|
39
|
-
}: Props$4<TMeta>):
|
|
39
|
+
}: Props$4<TMeta>): react3.JSX.Element;
|
|
40
40
|
declare namespace App {
|
|
41
|
-
var Context:
|
|
41
|
+
var Context: react3.Context<AppContextProps<unknown> | undefined>;
|
|
42
42
|
var displayName: string;
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
@@ -74,7 +74,7 @@ declare function Const({
|
|
|
74
74
|
JSDoc,
|
|
75
75
|
asConst,
|
|
76
76
|
children
|
|
77
|
-
}: Props$3):
|
|
77
|
+
}: Props$3): react3.JSX.Element;
|
|
78
78
|
declare namespace Const {
|
|
79
79
|
var displayName: string;
|
|
80
80
|
}
|
|
@@ -123,13 +123,13 @@ type Props$2<TMeta> = BaseProps & {
|
|
|
123
123
|
declare function File<TMeta extends object = object>({
|
|
124
124
|
children,
|
|
125
125
|
...rest
|
|
126
|
-
}: Props$2<TMeta>):
|
|
126
|
+
}: Props$2<TMeta>): react3.JSX.Element;
|
|
127
127
|
declare namespace File {
|
|
128
128
|
var displayName: string;
|
|
129
129
|
var Export: typeof FileExport;
|
|
130
130
|
var Import: typeof FileImport;
|
|
131
131
|
var Source: typeof FileSource;
|
|
132
|
-
var Context:
|
|
132
|
+
var Context: react3.Context<FileContextProps<object>>;
|
|
133
133
|
}
|
|
134
134
|
type FileSourceProps = Omit<Source, 'value'> & {
|
|
135
135
|
key?: Key;
|
|
@@ -141,7 +141,7 @@ declare function FileSource({
|
|
|
141
141
|
isExportable,
|
|
142
142
|
isIndexable,
|
|
143
143
|
children
|
|
144
|
-
}: FileSourceProps):
|
|
144
|
+
}: FileSourceProps): react3.JSX.Element;
|
|
145
145
|
declare namespace FileSource {
|
|
146
146
|
var displayName: string;
|
|
147
147
|
}
|
|
@@ -153,7 +153,7 @@ declare function FileExport({
|
|
|
153
153
|
path,
|
|
154
154
|
isTypeOnly,
|
|
155
155
|
asAlias
|
|
156
|
-
}: FileExportProps):
|
|
156
|
+
}: FileExportProps): react3.JSX.Element;
|
|
157
157
|
declare namespace FileExport {
|
|
158
158
|
var displayName: string;
|
|
159
159
|
}
|
|
@@ -166,7 +166,7 @@ declare function FileImport({
|
|
|
166
166
|
path,
|
|
167
167
|
isTypeOnly,
|
|
168
168
|
isNameSpace
|
|
169
|
-
}: FileImportProps):
|
|
169
|
+
}: FileImportProps): react3.JSX.Element;
|
|
170
170
|
declare namespace FileImport {
|
|
171
171
|
var displayName: string;
|
|
172
172
|
}
|
|
@@ -219,7 +219,7 @@ declare function Function({
|
|
|
219
219
|
returnType,
|
|
220
220
|
JSDoc,
|
|
221
221
|
children
|
|
222
|
-
}: Props$1):
|
|
222
|
+
}: Props$1): react3.JSX.Element;
|
|
223
223
|
declare namespace Function {
|
|
224
224
|
var displayName: string;
|
|
225
225
|
var Arrow: typeof ArrowFunction;
|
|
@@ -241,7 +241,7 @@ declare function ArrowFunction({
|
|
|
241
241
|
JSDoc,
|
|
242
242
|
singleLine,
|
|
243
243
|
children
|
|
244
|
-
}: ArrowFunctionProps):
|
|
244
|
+
}: ArrowFunctionProps): react3.JSX.Element;
|
|
245
245
|
declare namespace ArrowFunction {
|
|
246
246
|
var displayName: string;
|
|
247
247
|
}
|
|
@@ -282,7 +282,7 @@ declare function Type({
|
|
|
282
282
|
export: canExport,
|
|
283
283
|
JSDoc,
|
|
284
284
|
children
|
|
285
|
-
}: Props):
|
|
285
|
+
}: Props): react3.JSX.Element;
|
|
286
286
|
declare namespace Type {
|
|
287
287
|
var displayName: string;
|
|
288
288
|
}
|
|
@@ -345,15 +345,15 @@ declare class Runtime {
|
|
|
345
345
|
}
|
|
346
346
|
//#endregion
|
|
347
347
|
//#region src/index.d.ts
|
|
348
|
-
declare const useState: typeof
|
|
349
|
-
declare const createContext: typeof
|
|
350
|
-
declare const createElement: typeof
|
|
351
|
-
declare const Fragment:
|
|
352
|
-
declare const use: typeof
|
|
353
|
-
declare const useContext: typeof
|
|
354
|
-
declare const useEffect: typeof
|
|
355
|
-
declare const useReducer: typeof
|
|
356
|
-
declare const useRef: typeof
|
|
348
|
+
declare const useState: typeof react3.useState;
|
|
349
|
+
declare const createContext: typeof react3.createContext;
|
|
350
|
+
declare const createElement: typeof react3.createElement;
|
|
351
|
+
declare const Fragment: react3.ExoticComponent<react3.FragmentProps>;
|
|
352
|
+
declare const use: typeof react3.use;
|
|
353
|
+
declare const useContext: typeof react3.useContext;
|
|
354
|
+
declare const useEffect: typeof react3.useEffect;
|
|
355
|
+
declare const useReducer: typeof react3.useReducer;
|
|
356
|
+
declare const useRef: typeof react3.useRef;
|
|
357
357
|
//#endregion
|
|
358
358
|
export { App, Const, type Fabric, File, FileManager, FileProcessor, Fragment, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
|
|
359
359
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as FabricOptions, b as Source, c as FileManager, f as BaseName, g as Import, h as File$1, i as FabricMode, l as FileProcessor, n as FabricConfig, p as Export, t as Fabric, v as Path, y as ResolvedFile } from "./Fabric-DitK3IEP.js";
|
|
2
|
-
import { a as JSDoc, d as KubbNode, g as FunctionParams, o as Key, y as createFunctionParams } from "./types-
|
|
2
|
+
import { a as JSDoc, d as KubbNode, g as FunctionParams, o as Key, y as createFunctionParams } from "./types-CSUzVTpn.js";
|
|
3
3
|
import { t as Options$1 } from "./reactPlugin-4-kcMKwZ.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as react5 from "react";
|
|
5
5
|
import React, { ReactNode } from "react";
|
|
6
6
|
|
|
7
7
|
//#region ../fabric-core/src/createFabric.d.ts
|
|
@@ -36,9 +36,9 @@ type Props$4<TMeta = unknown> = {
|
|
|
36
36
|
declare function App<TMeta = unknown>({
|
|
37
37
|
meta,
|
|
38
38
|
children
|
|
39
|
-
}: Props$4<TMeta>):
|
|
39
|
+
}: Props$4<TMeta>): react5.JSX.Element;
|
|
40
40
|
declare namespace App {
|
|
41
|
-
var Context:
|
|
41
|
+
var Context: react5.Context<AppContextProps<unknown> | undefined>;
|
|
42
42
|
var displayName: string;
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
@@ -74,7 +74,7 @@ declare function Const({
|
|
|
74
74
|
JSDoc,
|
|
75
75
|
asConst,
|
|
76
76
|
children
|
|
77
|
-
}: Props$3):
|
|
77
|
+
}: Props$3): react5.JSX.Element;
|
|
78
78
|
declare namespace Const {
|
|
79
79
|
var displayName: string;
|
|
80
80
|
}
|
|
@@ -123,13 +123,13 @@ type Props$2<TMeta> = BaseProps & {
|
|
|
123
123
|
declare function File<TMeta extends object = object>({
|
|
124
124
|
children,
|
|
125
125
|
...rest
|
|
126
|
-
}: Props$2<TMeta>):
|
|
126
|
+
}: Props$2<TMeta>): react5.JSX.Element;
|
|
127
127
|
declare namespace File {
|
|
128
128
|
var displayName: string;
|
|
129
129
|
var Export: typeof FileExport;
|
|
130
130
|
var Import: typeof FileImport;
|
|
131
131
|
var Source: typeof FileSource;
|
|
132
|
-
var Context:
|
|
132
|
+
var Context: react5.Context<FileContextProps<object>>;
|
|
133
133
|
}
|
|
134
134
|
type FileSourceProps = Omit<Source, 'value'> & {
|
|
135
135
|
key?: Key;
|
|
@@ -141,7 +141,7 @@ declare function FileSource({
|
|
|
141
141
|
isExportable,
|
|
142
142
|
isIndexable,
|
|
143
143
|
children
|
|
144
|
-
}: FileSourceProps):
|
|
144
|
+
}: FileSourceProps): react5.JSX.Element;
|
|
145
145
|
declare namespace FileSource {
|
|
146
146
|
var displayName: string;
|
|
147
147
|
}
|
|
@@ -153,7 +153,7 @@ declare function FileExport({
|
|
|
153
153
|
path,
|
|
154
154
|
isTypeOnly,
|
|
155
155
|
asAlias
|
|
156
|
-
}: FileExportProps):
|
|
156
|
+
}: FileExportProps): react5.JSX.Element;
|
|
157
157
|
declare namespace FileExport {
|
|
158
158
|
var displayName: string;
|
|
159
159
|
}
|
|
@@ -166,7 +166,7 @@ declare function FileImport({
|
|
|
166
166
|
path,
|
|
167
167
|
isTypeOnly,
|
|
168
168
|
isNameSpace
|
|
169
|
-
}: FileImportProps):
|
|
169
|
+
}: FileImportProps): react5.JSX.Element;
|
|
170
170
|
declare namespace FileImport {
|
|
171
171
|
var displayName: string;
|
|
172
172
|
}
|
|
@@ -219,7 +219,7 @@ declare function Function({
|
|
|
219
219
|
returnType,
|
|
220
220
|
JSDoc,
|
|
221
221
|
children
|
|
222
|
-
}: Props$1):
|
|
222
|
+
}: Props$1): react5.JSX.Element;
|
|
223
223
|
declare namespace Function {
|
|
224
224
|
var displayName: string;
|
|
225
225
|
var Arrow: typeof ArrowFunction;
|
|
@@ -241,7 +241,7 @@ declare function ArrowFunction({
|
|
|
241
241
|
JSDoc,
|
|
242
242
|
singleLine,
|
|
243
243
|
children
|
|
244
|
-
}: ArrowFunctionProps):
|
|
244
|
+
}: ArrowFunctionProps): react5.JSX.Element;
|
|
245
245
|
declare namespace ArrowFunction {
|
|
246
246
|
var displayName: string;
|
|
247
247
|
}
|
|
@@ -282,7 +282,7 @@ declare function Type({
|
|
|
282
282
|
export: canExport,
|
|
283
283
|
JSDoc,
|
|
284
284
|
children
|
|
285
|
-
}: Props):
|
|
285
|
+
}: Props): react5.JSX.Element;
|
|
286
286
|
declare namespace Type {
|
|
287
287
|
var displayName: string;
|
|
288
288
|
}
|
|
@@ -345,15 +345,15 @@ declare class Runtime {
|
|
|
345
345
|
}
|
|
346
346
|
//#endregion
|
|
347
347
|
//#region src/index.d.ts
|
|
348
|
-
declare const useState: typeof
|
|
349
|
-
declare const createContext: typeof
|
|
350
|
-
declare const createElement: typeof
|
|
351
|
-
declare const Fragment:
|
|
352
|
-
declare const use: typeof
|
|
353
|
-
declare const useContext: typeof
|
|
354
|
-
declare const useEffect: typeof
|
|
355
|
-
declare const useReducer: typeof
|
|
356
|
-
declare const useRef: typeof
|
|
348
|
+
declare const useState: typeof react5.useState;
|
|
349
|
+
declare const createContext: typeof react5.createContext;
|
|
350
|
+
declare const createElement: typeof react5.createElement;
|
|
351
|
+
declare const Fragment: react5.ExoticComponent<react5.FragmentProps>;
|
|
352
|
+
declare const use: typeof react5.use;
|
|
353
|
+
declare const useContext: typeof react5.useContext;
|
|
354
|
+
declare const useEffect: typeof react5.useEffect;
|
|
355
|
+
declare const useReducer: typeof react5.useReducer;
|
|
356
|
+
declare const useRef: typeof react5.useRef;
|
|
357
357
|
//#endregion
|
|
358
358
|
export { App, Const, type Fabric, File, FileManager, FileProcessor, Fragment, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
|
|
359
359
|
//# sourceMappingURL=index.d.ts.map
|