Skip to content

use/themeRegistry

Overview

Mutable holder for the registered default theme, plus the registration API (setTheme / patchTheme / getTheme) and the theme-merge helper.

Split out of useTheme.js so per-component *.theme.js modules can register their entries through a module that test specs do not mock. Specs mock the useTheme composable (@vueda/use/useTheme.js); they do not mock this registry, so a themed SFC's eager patchTheme(...) side effect resolves to the real function even when useTheme is mocked. useTheme.js re-exports setTheme / patchTheme / getTheme / mergeTheme so the public @vueda/use/useTheme.js import path is unchanged for existing callers.

Properties

defaultTheme

Reactive holder for the registered theme. setTheme / patchTheme reassign .value so any useTheme async computeds re-resolve when new entries arrive (e.g. a component-level loader resolved its chunk and called patchTheme with real data).

Type: ShallowRef

Source: client/lib/use/themeRegistry.js:27

Methods

  • getTheme - Get the default theme.
  • mergeTheme - Custom merge function for merging theme objects, ensuring classes are combined.
  • patchTheme - Patch the default theme with a partial theme.
  • setTheme - Set the default theme.

Source

client/lib/use/themeRegistry.js:1

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2