(props: { theme?: string })
| 645 | } |
| 646 | |
| 647 | export function provideTheme (props: { theme?: string }) { |
| 648 | getCurrentInstance('provideTheme') |
| 649 | |
| 650 | const theme = inject(ThemeSymbol, null) |
| 651 | |
| 652 | if (!theme) throw new Error('Could not find Vuetify theme injection') |
| 653 | |
| 654 | const name = toRef(() => props.theme ?? theme.name.value) |
| 655 | const current = toRef(() => theme.themes.value[name.value]) |
| 656 | |
| 657 | const themeClasses = toRef(() => theme.isDisabled ? undefined : `${theme.prefix}theme--${name.value}`) |
| 658 | |
| 659 | const newTheme: ThemeInstance = { |
| 660 | ...theme, |
| 661 | name, |
| 662 | current, |
| 663 | themeClasses, |
| 664 | } |
| 665 | |
| 666 | provide(ThemeSymbol, newTheme) |
| 667 | |
| 668 | return newTheme |
| 669 | } |
| 670 | |
| 671 | export function useTheme () { |
| 672 | getCurrentInstance('useTheme') |
no test coverage detected
searching dependent graphs…