123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-
- import Vue from 'vue';
- export function functionalThemeClasses(context) {
- var vm = _extends({}, context.props, context.injections);
- var isDark = Themeable.options.computed.isDark.call(vm);
- return Themeable.options.computed.themeClasses.call({ isDark: isDark });
- }
- /* @vue/component */
- var Themeable = Vue.extend().extend({
- name: 'themeable',
- provide: function provide() {
- return {
- theme: this.themeableProvide
- };
- },
-
- inject: {
- theme: {
- default: {
- isDark: false
- }
- }
- },
- props: {
- dark: {
- type: Boolean,
- default: null
- },
- light: {
- type: Boolean,
- default: null
- }
- },
- data: function data() {
- return {
- themeableProvide: {
- isDark: false
- }
- };
- },
-
- computed: {
- isDark: function isDark() {
- if (this.dark === true) {
- // explicitly dark
- return true;
- } else if (this.light === true) {
- // explicitly light
- return false;
- } else {
- // inherit from parent, or default false if there is none
- return this.theme.isDark;
- }
- },
- themeClasses: function themeClasses() {
- return {
- 'theme--dark': this.isDark,
- 'theme--light': !this.isDark
- };
- },
-
- /** Used by menus and dialogs, inherits from v-app instead of the parent */
- rootIsDark: function rootIsDark() {
- if (this.dark === true) {
- // explicitly dark
- return true;
- } else if (this.light === true) {
- // explicitly light
- return false;
- } else {
- // inherit from v-app
- return this.$vuetify.dark;
- }
- },
- rootThemeClasses: function rootThemeClasses() {
- return {
- 'theme--dark': this.rootIsDark,
- 'theme--light': !this.rootIsDark
- };
- }
- },
- watch: {
- isDark: {
- handler: function handler(newVal, oldVal) {
- if (newVal !== oldVal) {
- this.themeableProvide.isDark = this.isDark;
- }
- },
-
- immediate: true
- }
- }
- });
- export default Themeable;
- //# sourceMappingURL=themeable.js.map
|