import { StorybookConfig as StorybookConfig$1, CompatibleString } from 'storybook/internal/types'; import { BuilderOptions, StorybookConfigVite } from '@storybook/builder-vite'; import { ComponentMeta } from 'vue-component-meta'; import { ComponentDoc } from 'vue-docgen-api'; type FrameworkName = CompatibleString<'@storybook/vue3-vite'>; type BuilderName = CompatibleString<'@storybook/builder-vite'>; /** Available docgen plugins for vue. */ type VueDocgenPlugin = 'vue-docgen-api' | 'vue-component-meta'; type FrameworkOptions = { builder?: BuilderOptions; /** * Plugin to use for generation docs for component props, events, slots and exposes. Since * Storybook 8, the official vue plugin "vue-component-meta" (Volar) can be used which supports * more complex types, better type docs, support for js(x)/ts(x) components and more. * * "vue-component-meta" will become the new default in the future and "vue-docgen-api" will be * removed. * * @default 'vue-docgen-api' */ docgen?: VueDocgenPlugin | { plugin: 'vue-component-meta'; /** * Tsconfig filename to use. Should be set if your main `tsconfig.json` includes references * to other tsconfig files like `tsconfig.app.json`. Otherwise docgen might not be generated * correctly (e.g. import aliases are not resolved). * * For further information, see our * [docs](https://storybook.js.org/docs/get-started/vue3-vite#override-the-default-configuration). * * @default 'tsconfig.json' */ tsconfig: `tsconfig${string}.json`; }; }; type StorybookConfigFramework = { framework: FrameworkName | { name: FrameworkName; options: FrameworkOptions; }; core?: StorybookConfig$1['core'] & { builder?: BuilderName | { name: BuilderName; options: BuilderOptions; }; }; }; /** The interface for Storybook configuration in `main.ts` files. */ type StorybookConfig = Omit & StorybookConfigVite & StorybookConfigFramework; /** Gets the type of a single array element. */ type ArrayElement = T extends readonly (infer A)[] ? A : never; /** Type of "__docgenInfo" depending on the used docgenPlugin. */ type VueDocgenInfo = T extends 'vue-component-meta' ? ComponentMeta : ComponentDoc; /** * Single prop/event/slot/exposed entry of "__docgenInfo" depending on the used docgenPlugin. * * @example * * ```ts * type PropInfo = VueDocgenInfoEntry<'vue-component-meta', 'props'>; * ``` */ type VueDocgenInfoEntry = ArrayElement[Exclude] : VueDocgenInfo<'vue-docgen-api'>[Exclude]>; export { FrameworkOptions, StorybookConfig, VueDocgenInfo, VueDocgenInfoEntry, VueDocgenPlugin };