@kubb/react-fabric 0.2.2 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/{Fabric-nxgJyzWH.d.cts → Fabric-BF1akKIl.d.cts} +3 -3
  2. package/dist/{Fabric-DwVGMumV.d.ts → Fabric-E6DCwBtT.d.ts} +3 -3
  3. package/dist/{KubbFile-bFdmEsQz.d.ts → KubbFile-D4gyyfL-.d.ts} +1 -1
  4. package/dist/{KubbFile-DHCtBOpy.d.cts → KubbFile-FGXV713i.d.cts} +1 -1
  5. package/dist/{chunk-9mlisOrp.js → chunk-BEV-X5tz.js} +4 -5
  6. package/dist/{chunk-BaqVhFee.cjs → chunk-CUT6urMc.cjs} +0 -16
  7. package/dist/{devtools-D7cmED8s.js → devtools-Cb1pMQYm.js} +2 -3
  8. package/dist/{devtools-D7cmED8s.js.map → devtools-Cb1pMQYm.js.map} +1 -1
  9. package/dist/{devtools-CYVZyenT.cjs → devtools-D4p2T_2t.cjs} +3 -3
  10. package/dist/{devtools-CYVZyenT.cjs.map → devtools-D4p2T_2t.cjs.map} +1 -1
  11. package/dist/devtools.cjs +1 -1
  12. package/dist/devtools.js +1 -1
  13. package/dist/globals-C_mBzXoD.d.ts +26 -0
  14. package/dist/globals-DHvLS0j3.d.cts +26 -0
  15. package/dist/globals.d.cts +3 -3
  16. package/dist/globals.d.ts +3 -3
  17. package/dist/index.cjs +110 -79
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +18 -20
  20. package/dist/index.d.ts +18 -20
  21. package/dist/index.js +61 -72
  22. package/dist/index.js.map +1 -1
  23. package/dist/jsx-dev-runtime.cjs +15 -7
  24. package/dist/jsx-dev-runtime.d.cts +5 -0
  25. package/dist/jsx-dev-runtime.d.ts +5 -0
  26. package/dist/jsx-dev-runtime.js +2 -4
  27. package/dist/jsx-namespace-Cu6WTmTt.d.cts +27 -0
  28. package/dist/jsx-namespace-ghArQSma.d.ts +27 -0
  29. package/dist/jsx-runtime.cjs +21 -7
  30. package/dist/jsx-runtime.d.cts +5 -14
  31. package/dist/jsx-runtime.d.ts +5 -14
  32. package/dist/jsx-runtime.js +2 -4
  33. package/dist/parsers.d.cts +2 -2
  34. package/dist/parsers.d.ts +2 -2
  35. package/dist/plugins-9oisj5ko.cjs +640 -0
  36. package/dist/plugins-9oisj5ko.cjs.map +1 -0
  37. package/dist/plugins-DYBs1Uhp.js +590 -0
  38. package/dist/plugins-DYBs1Uhp.js.map +1 -0
  39. package/dist/plugins.cjs +1 -2
  40. package/dist/plugins.d.cts +3 -3
  41. package/dist/plugins.d.ts +3 -3
  42. package/dist/plugins.js +1 -2
  43. package/dist/{reactPlugin-DyvfLVFa.d.ts → reactPlugin-B3xiMbv8.d.ts} +2 -2
  44. package/dist/{reactPlugin-CLgWWifj.d.cts → reactPlugin-DpMLHD7t.d.cts} +2 -2
  45. package/dist/{types-DoYRYV1C.d.cts → types-C9HPr_ft.d.cts} +21 -3
  46. package/dist/{types-BnXxcIyv.d.ts → types-P2Lm1k_W.d.ts} +21 -3
  47. package/dist/types.d.cts +3 -2
  48. package/dist/types.d.ts +3 -2
  49. package/package.json +7 -4
  50. package/src/globals.ts +17 -43
  51. package/src/index.ts +2 -11
  52. package/src/jsx-dev-runtime.ts +3 -0
  53. package/src/jsx-namespace.d.ts +27 -0
  54. package/src/jsx-runtime.ts +2 -7
  55. package/src/types.ts +24 -0
  56. package/dist/backend-BwCrJwGY.cjs +0 -11364
  57. package/dist/backend-BwCrJwGY.cjs.map +0 -1
  58. package/dist/backend-U2f8IEJ7.js +0 -11361
  59. package/dist/backend-U2f8IEJ7.js.map +0 -1
  60. package/dist/globals-1MFa0Fvg.d.ts +0 -52
  61. package/dist/globals-C7dPa-nz.d.cts +0 -52
  62. package/dist/jsx-runtime-8_h1Kd4b.cjs +0 -36
  63. package/dist/jsx-runtime-8_h1Kd4b.cjs.map +0 -1
  64. package/dist/jsx-runtime-BJX2mL7C.js +0 -13
  65. package/dist/jsx-runtime-BJX2mL7C.js.map +0 -1
  66. package/dist/jsx-runtime-C9xQ4GQD.js +0 -1338
  67. package/dist/jsx-runtime-C9xQ4GQD.js.map +0 -1
  68. package/dist/jsx-runtime-CSnwG7o6.cjs +0 -1349
  69. package/dist/jsx-runtime-CSnwG7o6.cjs.map +0 -1
  70. package/dist/plugins-BQE1GnQ7.cjs +0 -15554
  71. package/dist/plugins-BQE1GnQ7.cjs.map +0 -1
  72. package/dist/plugins-BVFjgEC2.js +0 -15509
  73. package/dist/plugins-BVFjgEC2.js.map +0 -1
@@ -1 +1 @@
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 filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return ''\n }\n\n return `/**\\n * ${filteredComments.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 { createContext } from 'react'\n\nimport type { KubbFile } from '@kubb/fabric-core/types'\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 filtered = React.Children.toArray(children).filter(Boolean)\n const result: React.ReactNode[] = []\n\n let prevWasBr = false\n let brCount = 0\n\n filtered.forEach((child) => {\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 { Indent } from './Indent.tsx'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\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'\n\nimport { File } from '../components/File.tsx'\n\nimport type { FileContextProps } 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 setTimeout(() => {\n exit()\n }, 0)\n },\n }\n}\n","import { createFabric } from '@kubb/fabric-core'\nimport { reactPlugin } from '@kubb/react-fabric/plugins'\nimport type { Options } from './plugins/reactPlugin.ts'\nimport type { FabricMode } from '@kubb/fabric-core/types'\nimport { open } from './devtools.ts'\n\nexport function createReactFabric(options?: Options & { mode?: FabricMode; devtools?: boolean }) {\n const fabric = createFabric({ mode: options?.mode })\n\n if (options?.devtools) {\n open()\n }\n\n fabric.use(reactPlugin, options)\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'\n\nimport * as React from 'react'\n\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'\n\nexport { useApp } from './composables/useApp.ts'\nexport { useFile } from './composables/useFile.ts'\nexport { useLifecycle } from './composables/useLifecycle.tsx'\n\n// expose fabric core helpers\nexport { createFabric } from '@kubb/fabric-core'\nexport { createReactFabric } from './createReactFabric.ts'\n\n// utils\nexport { createFunctionParams, FunctionParams } from './utils/getFunctionParams.ts'\nexport { Runtime } from './Runtime.tsx'\n\n// react helpers\nexport const createContext = React.createContext\nexport const createElement = React.createElement\nexport const useContext = React.useContext\nexport const useEffect = React.useEffect\nexport const useState = React.useState\nexport const useRef = React.useRef\nexport const use = React.use\nexport const useReducer = React.useReducer\n"],"x_google_ignoreList":[4],"mappings":";;;;;;;;;;;;;;;AAYA,MAAM,6CAAwD,OAAU;AAOxE,SAAgB,IAAqB,EAAE,MAAM,YAA0B;CACrE,MAAM,EAAE,sCAAoBA,4BAAY;AAExC,QAAO,4CAAC,WAAW;EAAS,OAAO;GAAE;GAAM;GAAM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gB;;AAC1B,wDAAe,OAAM;;CAGvB,IAAI,SAAiB;AACnB,yDAAO,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,wDAAQ,KAAY,CAAC,CAAC,OAAO,SAAS,EAAE,CAAW;;CAGnE,OAAO,EAAE,eAAe,kBAAoE,EAAE,EAAU;AACtG,SAAO,kEAAkB,KAAY,EAAE;GAAE,MAAM;GAAQ;GAAe;GAAe,CAAC;;CAGxF,WAAmB;AACjB,SAAO,kEAAkB,KAAY,EAAE,EAAE,MAAM,UAAU,CAAC;;CAE5D,gBAAwB;AACtB,SAAO,kEAAkB,KAAY,EAAE,EAAE,MAAM,eAAe,CAAC;;CAGjE,gBAAwB;AACtB,SAAO,kEAAkB,KAAY,EAAE,EAAE,MAAM,eAAe,CAAC;;;;;;AChNnE,MAAa,6BAAsB;AACnC,MAAa,6BAAsB;AACnC,MAAa,0BAAmB;AAChC,MAAa,yBAAkB;AAC/B,MAAa,wBAAiB;AAC9B,MAAa,sBAAe;AAC5B,MAAa,mBAAY;AACzB,MAAa,0BAAmB"}
1
+ {"version":3,"file":"index.cjs","names":["RootContext","React","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"],"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 filteredComments = comments.filter(Boolean)\n\n if (!filteredComments.length) {\n return ''\n }\n\n return `/**\\n * ${filteredComments.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 { createContext } from 'react'\n\nimport type { KubbFile } from '@kubb/fabric-core/types'\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 filtered = React.Children.toArray(children).filter(Boolean)\n const result: React.ReactNode[] = []\n\n let prevWasBr = false\n let brCount = 0\n\n filtered.forEach((child) => {\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 { Indent } from './Indent.tsx'\nimport { createJSDoc } from '../utils/createJSDoc.ts'\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'\n\nimport { File } from '../components/File.tsx'\n\nimport type { FileContextProps } 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 setTimeout(() => {\n exit()\n }, 0)\n },\n }\n}\n","import { createFabric } from '@kubb/fabric-core'\nimport { reactPlugin } from '@kubb/react-fabric/plugins'\nimport type { Options } from './plugins/reactPlugin.ts'\nimport type { FabricMode } from '@kubb/fabric-core/types'\nimport { open } from './devtools.ts'\n\nexport function createReactFabric(options?: Options & { mode?: FabricMode; devtools?: boolean }) {\n const fabric = createFabric({ mode: options?.mode })\n\n if (options?.devtools) {\n open()\n }\n\n fabric.use(reactPlugin, options)\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"],"x_google_ignoreList":[4],"mappings":";;;;;;;;;;;;;;;;AAYA,MAAM,sCAAwD,OAAU;AAOxE,SAAgB,IAAqB,EAAE,MAAM,YAA0B;CACrE,MAAM,EAAE,+BAAoBA,4BAAY;AAExC,QAAO,2CAAC,WAAW;EAAS,OAAO;GAAE;GAAM;GAAM;EAAG;GAA+B;;AAGrF,IAAI,UAAU;AACd,IAAI,cAAc;;;;AC1BlB,SAAgB,YAAY,EAAE,YAAiD;CAC7E,MAAM,mBAAmB,SAA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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,wDAAQ,KAAY,CAAC,CAAC,OAAO,SAAS,EAAE,CAAW;;CAGnE,OAAO,EAAE,eAAe,kBAAoE,EAAE,EAAU;AACtG,SAAO,kEAAkB,KAAY,EAAE;GAAE,MAAM;GAAQ;GAAe;GAAe,CAAC;;CAGxF,WAAmB;AACjB,SAAO,kEAAkB,KAAY,EAAE,EAAE,MAAM,UAAU,CAAC;;CAE5D,gBAAwB;AACtB,SAAO,kEAAkB,KAAY,EAAE,EAAE,MAAM,eAAe,CAAC;;CAGjE,gBAAwB;AACtB,SAAO,kEAAkB,KAAY,EAAE,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.d.cts CHANGED
@@ -1,17 +1,25 @@
1
- import { a as Import, c as Source, n as Export, o as Path, t as BaseName } from "./KubbFile-DHCtBOpy.cjs";
2
- import { i as FileManager, n as FabricMode, r as FabricOptions, t as Fabric } from "./Fabric-nxgJyzWH.cjs";
3
- import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-DoYRYV1C.cjs";
4
- import "./globals-C7dPa-nz.cjs";
5
- import { t as Options$1 } from "./reactPlugin-CLgWWifj.cjs";
6
- import * as react1 from "react";
7
- import React, { ReactNode } from "react";
1
+ import { a as Import, c as Source, i as File$1, n as Export, o as Path, s as ResolvedFile, t as BaseName } from "./KubbFile-FGXV713i.cjs";
2
+ import { a as FileProcessor, i as FileManager, n as FabricMode, r as FabricOptions, t as Fabric } from "./Fabric-BF1akKIl.cjs";
3
+ import { a as JSDoc, h as FunctionParams, o as Key, u as KubbNode, v as createFunctionParams } from "./types-C9HPr_ft.cjs";
4
+ import "./globals-DHvLS0j3.cjs";
5
+ import { t as Options$1 } from "./reactPlugin-DpMLHD7t.cjs";
6
+ import * as react0 from "react";
7
+ import React, { ReactNode, createContext, createElement, use, useContext, useEffect, useReducer, useRef, useState } from "react";
8
8
  import * as react_jsx_runtime0 from "react/jsx-runtime";
9
9
 
10
10
  //#region ../fabric-core/src/createFabric.d.ts
11
11
  declare const createFabric: DefineFabric<FabricOptions>;
12
12
  //#endregion
13
+ //#region ../fabric-core/src/createFile.d.ts
14
+ /**
15
+ * Helper to create a file with name and id set
16
+ */
17
+ declare function createFile<TMeta extends object = object>(file: File$1<TMeta>): ResolvedFile<TMeta>;
18
+ //#endregion
13
19
  //#region ../fabric-core/src/defineFabric.d.ts
20
+ type RootRenderFunction<TOptions extends FabricOptions> = (fabric: Fabric<TOptions>) => void | Promise<void>;
14
21
  type DefineFabric<TOptions> = (options?: TOptions) => Fabric;
22
+ declare function defineFabric<TOptions extends FabricOptions>(instance?: RootRenderFunction<TOptions>): DefineFabric<TOptions>;
15
23
  //#endregion
16
24
  //#region src/components/App.d.ts
17
25
  type AppContextProps<TMeta = unknown> = {
@@ -30,7 +38,7 @@ declare function App<TMeta = unknown>({
30
38
  children
31
39
  }: Props$4<TMeta>): react_jsx_runtime0.JSX.Element;
32
40
  declare namespace App {
33
- var Context: react1.Context<AppContextProps<unknown> | undefined>;
41
+ var Context: react0.Context<AppContextProps<unknown> | undefined>;
34
42
  var displayName: string;
35
43
  }
36
44
  //#endregion
@@ -121,7 +129,7 @@ declare namespace File {
121
129
  var Export: typeof FileExport;
122
130
  var Import: typeof FileImport;
123
131
  var Source: typeof FileSource;
124
- var Context: react1.Context<FileContextProps<object>>;
132
+ var Context: react0.Context<FileContextProps<object>>;
125
133
  }
126
134
  type FileSourceProps = Omit<Source, 'value'> & {
127
135
  key?: Key;
@@ -333,15 +341,5 @@ declare class Runtime {
333
341
  waitUntilExit(): Promise<void>;
334
342
  }
335
343
  //#endregion
336
- //#region src/index.d.ts
337
- declare const createContext: typeof react1.createContext;
338
- declare const createElement: typeof react1.createElement;
339
- declare const useContext: typeof react1.useContext;
340
- declare const useEffect: typeof react1.useEffect;
341
- declare const useState: typeof react1.useState;
342
- declare const useRef: typeof react1.useRef;
343
- declare const use: typeof react1.use;
344
- declare const useReducer: typeof react1.useReducer;
345
- //#endregion
346
- export { App, Const, File, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
344
+ export { App, Const, Fabric, File, FileManager, FileProcessor, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, defineFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
347
345
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,17 +1,25 @@
1
- import { a as Import, c as Source, n as Export, o as Path, t as BaseName } from "./KubbFile-bFdmEsQz.js";
2
- import { i as FileManager, n as FabricMode, r as FabricOptions, t as Fabric } from "./Fabric-DwVGMumV.js";
3
- import { a as JSDoc, f as createFunctionParams, l as FunctionParams, o as Key, s as KubbNode } from "./types-BnXxcIyv.js";
4
- import "./globals-1MFa0Fvg.js";
5
- import { t as Options$1 } from "./reactPlugin-DyvfLVFa.js";
6
- import * as react1 from "react";
7
- import React, { ReactNode } from "react";
1
+ import { a as Import, c as Source, i as File$1, n as Export, o as Path, s as ResolvedFile, t as BaseName } from "./KubbFile-D4gyyfL-.js";
2
+ import { a as FileProcessor, i as FileManager, n as FabricMode, r as FabricOptions, t as Fabric } from "./Fabric-E6DCwBtT.js";
3
+ import { a as JSDoc, h as FunctionParams, o as Key, u as KubbNode, v as createFunctionParams } from "./types-P2Lm1k_W.js";
4
+ import "./globals-C_mBzXoD.js";
5
+ import { t as Options$1 } from "./reactPlugin-B3xiMbv8.js";
6
+ import * as react0 from "react";
7
+ import React, { ReactNode, createContext, createElement, use, useContext, useEffect, useReducer, useRef, useState } from "react";
8
8
  import * as react_jsx_runtime0 from "react/jsx-runtime";
9
9
 
10
10
  //#region ../fabric-core/src/createFabric.d.ts
11
11
  declare const createFabric: DefineFabric<FabricOptions>;
12
12
  //#endregion
13
+ //#region ../fabric-core/src/createFile.d.ts
14
+ /**
15
+ * Helper to create a file with name and id set
16
+ */
17
+ declare function createFile<TMeta extends object = object>(file: File$1<TMeta>): ResolvedFile<TMeta>;
18
+ //#endregion
13
19
  //#region ../fabric-core/src/defineFabric.d.ts
20
+ type RootRenderFunction<TOptions extends FabricOptions> = (fabric: Fabric<TOptions>) => void | Promise<void>;
14
21
  type DefineFabric<TOptions> = (options?: TOptions) => Fabric;
22
+ declare function defineFabric<TOptions extends FabricOptions>(instance?: RootRenderFunction<TOptions>): DefineFabric<TOptions>;
15
23
  //#endregion
16
24
  //#region src/components/App.d.ts
17
25
  type AppContextProps<TMeta = unknown> = {
@@ -30,7 +38,7 @@ declare function App<TMeta = unknown>({
30
38
  children
31
39
  }: Props$4<TMeta>): react_jsx_runtime0.JSX.Element;
32
40
  declare namespace App {
33
- var Context: react1.Context<AppContextProps<unknown> | undefined>;
41
+ var Context: react0.Context<AppContextProps<unknown> | undefined>;
34
42
  var displayName: string;
35
43
  }
36
44
  //#endregion
@@ -121,7 +129,7 @@ declare namespace File {
121
129
  var Export: typeof FileExport;
122
130
  var Import: typeof FileImport;
123
131
  var Source: typeof FileSource;
124
- var Context: react1.Context<FileContextProps<object>>;
132
+ var Context: react0.Context<FileContextProps<object>>;
125
133
  }
126
134
  type FileSourceProps = Omit<Source, 'value'> & {
127
135
  key?: Key;
@@ -333,15 +341,5 @@ declare class Runtime {
333
341
  waitUntilExit(): Promise<void>;
334
342
  }
335
343
  //#endregion
336
- //#region src/index.d.ts
337
- declare const createContext: typeof react1.createContext;
338
- declare const createElement: typeof react1.createElement;
339
- declare const useContext: typeof react1.useContext;
340
- declare const useEffect: typeof react1.useEffect;
341
- declare const useState: typeof react1.useState;
342
- declare const useRef: typeof react1.useRef;
343
- declare const use: typeof react1.use;
344
- declare const useReducer: typeof react1.useReducer;
345
- //#endregion
346
- export { App, Const, File, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
344
+ export { App, Const, Fabric, File, FileManager, FileProcessor, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFile, createFunctionParams, createReactFabric, defineFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
347
345
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,19 +1,19 @@
1
- import { r as __toESM } from "./chunk-9mlisOrp.js";
2
1
  import "./globals-Df5klKjG.js";
3
- import { n as require_react, t as require_jsx_runtime } from "./jsx-runtime-C9xQ4GQD.js";
4
- import { a as _classPrivateFieldInitSpec, i as _classPrivateFieldGet2, n as Runtime, o as Root, r as _classPrivateFieldSet2, s as RootContext, t as reactPlugin } from "./plugins-BVFjgEC2.js";
5
- import { t as open } from "./devtools-D7cmED8s.js";
2
+ import { a as _classPrivateFieldInitSpec, i as _classPrivateFieldGet2, n as Runtime, o as Root, r as _classPrivateFieldSet2, s as RootContext, t as reactPlugin } from "./plugins-DYBs1Uhp.js";
3
+ import { t as open } from "./devtools-Cb1pMQYm.js";
4
+ import React, { createContext, createContext as createContext$1, createElement, use, useContext, useContext as useContext$1, useEffect, useReducer, useRef, useState } from "react";
5
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
6
6
  import dedent from "dedent";
7
- import { createFabric, createFabric as createFabric$1 } from "@kubb/fabric-core";
7
+ import { createFabric } from "@kubb/fabric-core";
8
8
  import { orderBy } from "natural-orderby";
9
9
 
10
+ export * from "@kubb/fabric-core"
11
+
10
12
  //#region src/components/App.tsx
11
- var import_react = /* @__PURE__ */ __toESM(require_react());
12
- var import_jsx_runtime = /* @__PURE__ */ __toESM(require_jsx_runtime());
13
- const AppContext = (0, import_react.createContext)(void 0);
13
+ const AppContext = createContext$1(void 0);
14
14
  function App({ meta, children }) {
15
- const { exit } = (0, import_react.useContext)(RootContext);
16
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AppContext.Provider, {
15
+ const { exit } = useContext$1(RootContext);
16
+ return /* @__PURE__ */ jsx(AppContext.Provider, {
17
17
  value: {
18
18
  exit,
19
19
  meta
@@ -35,32 +35,32 @@ function createJSDoc({ comments }) {
35
35
  //#endregion
36
36
  //#region src/components/Const.tsx
37
37
  function Const({ name, export: canExport, type, JSDoc, asConst, children }) {
38
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
39
- (JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})] }),
40
- canExport && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "export " }),
38
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
39
+ (JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ jsxs(Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ jsx("br", {})] }),
40
+ canExport && /* @__PURE__ */ jsx(Fragment, { children: "export " }),
41
41
  "const ",
42
42
  name,
43
43
  " ",
44
- type && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
44
+ type && /* @__PURE__ */ jsxs(Fragment, { children: [
45
45
  ":",
46
46
  type,
47
47
  " "
48
48
  ] }),
49
49
  "= ",
50
50
  children,
51
- asConst && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: " as const" })
51
+ asConst && /* @__PURE__ */ jsx(Fragment, { children: " as const" })
52
52
  ] });
53
53
  }
54
54
  Const.displayName = "KubbConst";
55
55
 
56
56
  //#endregion
57
57
  //#region src/components/File.tsx
58
- const FileContext = (0, import_react.createContext)({});
58
+ const FileContext = createContext$1({});
59
59
  function File({ children,...rest }) {
60
- if (!rest.baseName || !rest.path) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children });
61
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kubb-file", {
60
+ if (!rest.baseName || !rest.path) return /* @__PURE__ */ jsx(Fragment, { children });
61
+ return /* @__PURE__ */ jsx("kubb-file", {
62
62
  ...rest,
63
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FileContext.Provider, {
63
+ children: /* @__PURE__ */ jsx(FileContext.Provider, {
64
64
  value: {
65
65
  baseName: rest.baseName,
66
66
  path: rest.path,
@@ -72,7 +72,7 @@ function File({ children,...rest }) {
72
72
  }
73
73
  File.displayName = "KubbFile";
74
74
  function FileSource({ isTypeOnly, name, isExportable, isIndexable, children }) {
75
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kubb-source", {
75
+ return /* @__PURE__ */ jsx("kubb-source", {
76
76
  name,
77
77
  isTypeOnly,
78
78
  isExportable,
@@ -82,7 +82,7 @@ function FileSource({ isTypeOnly, name, isExportable, isIndexable, children }) {
82
82
  }
83
83
  FileSource.displayName = "KubbFileSource";
84
84
  function FileExport({ name, path, isTypeOnly, asAlias }) {
85
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kubb-export", {
85
+ return /* @__PURE__ */ jsx("kubb-export", {
86
86
  name,
87
87
  path,
88
88
  isTypeOnly: isTypeOnly || false,
@@ -91,7 +91,7 @@ function FileExport({ name, path, isTypeOnly, asAlias }) {
91
91
  }
92
92
  FileExport.displayName = "KubbFileExport";
93
93
  function FileImport({ name, root, path, isTypeOnly, isNameSpace }) {
94
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("kubb-import", {
94
+ return /* @__PURE__ */ jsx("kubb-import", {
95
95
  name,
96
96
  root,
97
97
  path,
@@ -126,12 +126,12 @@ function indentString(string, count = 1, options = {}) {
126
126
  */
127
127
  function Indent({ size = 2, children }) {
128
128
  if (!children) return null;
129
- const filtered = import_react.Children.toArray(children).filter(Boolean);
129
+ const filtered = React.Children.toArray(children).filter(Boolean);
130
130
  const result = [];
131
131
  let prevWasBr = false;
132
132
  let brCount = 0;
133
133
  filtered.forEach((child) => {
134
- if (import_react.isValidElement(child) && child.type === "br") {
134
+ if (React.isValidElement(child) && child.type === "br") {
135
135
  if (!prevWasBr || brCount < 2) {
136
136
  result.push(child);
137
137
  brCount++;
@@ -143,23 +143,23 @@ function Indent({ size = 2, children }) {
143
143
  result.push(child);
144
144
  }
145
145
  });
146
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: result.map((child) => {
147
- if (typeof child === "string") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: indentString(dedent(child), size) });
148
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" ".repeat(size), child] });
146
+ return /* @__PURE__ */ jsx(Fragment, { children: result.map((child) => {
147
+ if (typeof child === "string") return /* @__PURE__ */ jsx(Fragment, { children: indentString(dedent(child), size) });
148
+ return /* @__PURE__ */ jsxs(Fragment, { children: [" ".repeat(size), child] });
149
149
  }) });
150
150
  }
151
151
 
152
152
  //#endregion
153
153
  //#region src/components/Function.tsx
154
154
  function Function({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, children }) {
155
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
156
- (JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})] }),
157
- canExport && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "export " }),
158
- isDefault && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "default " }),
159
- async && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "async " }),
155
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
156
+ (JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ jsxs(Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ jsx("br", {})] }),
157
+ canExport && /* @__PURE__ */ jsx(Fragment, { children: "export " }),
158
+ isDefault && /* @__PURE__ */ jsx(Fragment, { children: "default " }),
159
+ async && /* @__PURE__ */ jsx(Fragment, { children: "async " }),
160
160
  "function ",
161
161
  name,
162
- generics && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
162
+ generics && /* @__PURE__ */ jsxs(Fragment, { children: [
163
163
  "<",
164
164
  Array.isArray(generics) ? generics.join(", ").trim() : generics,
165
165
  ">"
@@ -167,34 +167,34 @@ function Function({ name, default: isDefault, export: canExport, async, generics
167
167
  "(",
168
168
  params,
169
169
  ")",
170
- returnType && !async && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [": ", returnType] }),
171
- returnType && async && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
170
+ returnType && !async && /* @__PURE__ */ jsxs(Fragment, { children: [": ", returnType] }),
171
+ returnType && async && /* @__PURE__ */ jsxs(Fragment, { children: [
172
172
  ": Promise",
173
173
  "<",
174
174
  returnType,
175
175
  ">"
176
176
  ] }),
177
177
  " {",
178
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
179
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indent, {
178
+ /* @__PURE__ */ jsx("br", {}),
179
+ /* @__PURE__ */ jsx(Indent, {
180
180
  size: 2,
181
181
  children
182
182
  }),
183
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
183
+ /* @__PURE__ */ jsx("br", {}),
184
184
  "}"
185
185
  ] });
186
186
  }
187
187
  Function.displayName = "KubbFunction";
188
188
  function ArrowFunction({ name, default: isDefault, export: canExport, async, generics, params, returnType, JSDoc, singleLine, children }) {
189
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
190
- (JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})] }),
191
- canExport && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "export " }),
192
- isDefault && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "default " }),
189
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
190
+ (JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ jsxs(Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ jsx("br", {})] }),
191
+ canExport && /* @__PURE__ */ jsx(Fragment, { children: "export " }),
192
+ isDefault && /* @__PURE__ */ jsx(Fragment, { children: "default " }),
193
193
  "const ",
194
194
  name,
195
195
  " = ",
196
- async && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "async " }),
197
- generics && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
196
+ async && /* @__PURE__ */ jsx(Fragment, { children: "async " }),
197
+ generics && /* @__PURE__ */ jsxs(Fragment, { children: [
198
198
  "<",
199
199
  Array.isArray(generics) ? generics.join(", ").trim() : generics,
200
200
  ">"
@@ -202,28 +202,28 @@ function ArrowFunction({ name, default: isDefault, export: canExport, async, gen
202
202
  "(",
203
203
  params,
204
204
  ")",
205
- returnType && !async && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [": ", returnType] }),
206
- returnType && async && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
205
+ returnType && !async && /* @__PURE__ */ jsxs(Fragment, { children: [": ", returnType] }),
206
+ returnType && async && /* @__PURE__ */ jsxs(Fragment, { children: [
207
207
  ": Promise",
208
208
  "<",
209
209
  returnType,
210
210
  ">"
211
211
  ] }),
212
- singleLine && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
212
+ singleLine && /* @__PURE__ */ jsxs(Fragment, { children: [
213
213
  " => ",
214
214
  children,
215
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})
215
+ /* @__PURE__ */ jsx("br", {})
216
216
  ] }),
217
- !singleLine && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
217
+ !singleLine && /* @__PURE__ */ jsxs(Fragment, { children: [
218
218
  " => {",
219
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
220
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Indent, {
219
+ /* @__PURE__ */ jsx("br", {}),
220
+ /* @__PURE__ */ jsx(Indent, {
221
221
  size: 2,
222
222
  children
223
223
  }),
224
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {}),
224
+ /* @__PURE__ */ jsx("br", {}),
225
225
  "}",
226
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})
226
+ /* @__PURE__ */ jsx("br", {})
227
227
  ] })
228
228
  ] });
229
229
  }
@@ -234,9 +234,9 @@ Function.Arrow = ArrowFunction;
234
234
  //#region src/components/Type.tsx
235
235
  function Type({ name, export: canExport, JSDoc, children }) {
236
236
  if (name.charAt(0).toUpperCase() !== name.charAt(0)) throw new Error("Name should start with a capital letter(see TypeScript types)");
237
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
238
- (JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("br", {})] }),
239
- canExport && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: "export " }),
237
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
238
+ (JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments) && /* @__PURE__ */ jsxs(Fragment, { children: [createJSDoc({ comments: JSDoc === null || JSDoc === void 0 ? void 0 : JSDoc.comments }), /* @__PURE__ */ jsx("br", {})] }),
239
+ canExport && /* @__PURE__ */ jsx(Fragment, { children: "export " }),
240
240
  "type ",
241
241
  name,
242
242
  " = ",
@@ -251,7 +251,7 @@ Type.displayName = "KubbType";
251
251
  * `useApp` will return the current App with plugin, pluginManager, fileManager and mode.
252
252
  */
253
253
  function useApp() {
254
- const app = (0, import_react.useContext)(App.Context);
254
+ const app = useContext$1(App.Context);
255
255
  if (!app) throw new Error("<App /> should be set");
256
256
  return app;
257
257
  }
@@ -262,7 +262,7 @@ function useApp() {
262
262
  * `useFile` will return the current file when <File/> is used.
263
263
  */
264
264
  function useFile() {
265
- return (0, import_react.useContext)(File.Context);
265
+ return useContext$1(File.Context);
266
266
  }
267
267
 
268
268
  //#endregion
@@ -271,7 +271,7 @@ function useFile() {
271
271
  * `useLifecycle` will return some helpers to exit/restart the generation.
272
272
  */
273
273
  function useLifecycle() {
274
- const { exit } = (0, import_react.useContext)(Root.Context);
274
+ const { exit } = useContext$1(Root.Context);
275
275
  return { exit: () => {
276
276
  setTimeout(() => {
277
277
  exit();
@@ -282,7 +282,7 @@ function useLifecycle() {
282
282
  //#endregion
283
283
  //#region src/createReactFabric.ts
284
284
  function createReactFabric(options) {
285
- const fabric = createFabric$1({ mode: options === null || options === void 0 ? void 0 : options.mode });
285
+ const fabric = createFabric({ mode: options === null || options === void 0 ? void 0 : options.mode });
286
286
  if (options === null || options === void 0 ? void 0 : options.devtools) open();
287
287
  fabric.use(reactPlugin, options);
288
288
  return fabric;
@@ -403,16 +403,5 @@ var FunctionParams = class FunctionParams {
403
403
  };
404
404
 
405
405
  //#endregion
406
- //#region src/index.ts
407
- const createContext = import_react.createContext;
408
- const createElement = import_react.createElement;
409
- const useContext = import_react.useContext;
410
- const useEffect = import_react.useEffect;
411
- const useState = import_react.useState;
412
- const useRef = import_react.useRef;
413
- const use = import_react.use;
414
- const useReducer = import_react.useReducer;
415
-
416
- //#endregion
417
- export { App, Const, File, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFabric, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
406
+ export { App, Const, File, Function, FunctionParams, Indent, Runtime, Type, createContext, createElement, createFunctionParams, createReactFabric, use, useApp, useContext, useEffect, useFile, useLifecycle, useReducer, useRef, useState };
418
407
  //# sourceMappingURL=index.js.map