UNPKG

vuestic-ui

Version:
1 lines 2.06 kB
{"version":3,"file":"types.mjs","sources":["../../../../../src/services/global-config/types.ts"],"sourcesContent":["import type { ComponentConfig } from '../component-config'\nimport type { ColorConfig, CustomColorVariables } from '../color'\nimport type { IconConfig } from '../icon'\nimport type { BreakpointConfig } from '../breakpoint'\nimport type { I18nConfig, CustomI18NKeys } from '../i18n'\nimport type { Ref, Component } from 'vue'\nimport type { ColorsClassesConfig } from '../colors-classes'\n\nexport type GlobalConfig = {\n colors: ColorConfig,\n icons: IconConfig,\n components: ComponentConfig,\n breakpoint: BreakpointConfig,\n i18n: I18nConfig,\n colorsClasses: ColorsClassesConfig,\n routerComponent: Component | undefined,\n}\n\ntype DeepPartial<T> = T extends Record<string, any> ? {\n // Prevent deep nesting so we ignore 'components' here. 'components' is anyway partial\n [P in keyof T]?: P extends 'components' ? T[P] : DeepPartial<T[P]>;\n} : T;\n\nexport type PartialGlobalConfig = DeepPartial<GlobalConfig> & {\n // Need to maintain ability to extend through module augmentation\n colors?: {\n variables?: Partial<CustomColorVariables>\n }\n i18n?: Partial<CustomI18NKeys>\n}\n\nexport type SizeConfig = {\n defaultSize?: number,\n sizes?: { [sizeName: string]: number | string },\n}\n\nexport type GlobalConfigUpdater<T> = (config: T) => T;\nexport type {\n ColorConfig,\n ComponentConfig,\n IconConfig,\n BreakpointConfig,\n}\n\nexport type ProvidedGlobalConfig = {\n globalConfig: Ref<GlobalConfig>,\n getGlobalConfig: () => GlobalConfig,\n /**\n * Set new global config\n * @see mergeGlobalConfig if you want to update existing config\n */\n setGlobalConfig: (updater: GlobalConfig | GlobalConfigUpdater<GlobalConfig>) => void,\n mergeGlobalConfig: (updater: PartialGlobalConfig | GlobalConfigUpdater<PartialGlobalConfig>) => void\n}\n\nexport const defineVuesticConfig = <Config extends DeepPartial<GlobalConfig>>(config: Config) => config\n"],"names":[],"mappings":"AAuDa,MAAA,sBAAsB,CAA2C,WAAmB;"}