UNPKG

@morfeo/hooks

Version:

![Morfeo logo](https://morfeo.dev/img/morfeo.png)

37 lines 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useThemeValue = exports.useThemeSlice = exports.useTheme = void 0; const core_1 = require("@morfeo/core"); const useSyncMorfeo_1 = require("./useSyncMorfeo"); /** * Same as `morfeo.theme.get()` but it will cause a re-render * each the theme is updated anywhere in your application. * * @returns the theme object */ function useTheme() { (0, useSyncMorfeo_1.useSyncMorfeo)(); return core_1.morfeo.theme.get(); } exports.useTheme = useTheme; /** * Same as `morfeo.theme.get()[slice]` but it will cause a re-render * each the theme is updated anywhere in your application. * * @returns the theme slice */ function useThemeSlice(slice) { return useTheme()[slice]; } exports.useThemeSlice = useThemeSlice; /** * Same as `morfeo.theme.get()[slice][value]` but it will cause a re-render * each the theme is updated anywhere in your application. * * @returns the theme slice value */ function useThemeValue(slice, value) { return useThemeSlice(slice)[value]; } exports.useThemeValue = useThemeValue; //# sourceMappingURL=useTheme.js.map