Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

app-theme.js 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _theme = require('../../../util/theme');
  6. var Theme = _interopRequireWildcard(_theme);
  7. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
  8. exports.default = {
  9. data: function data() {
  10. return {
  11. style: null
  12. };
  13. },
  14. computed: {
  15. parsedTheme: function parsedTheme() {
  16. return Theme.parse(this.$vuetify.theme);
  17. },
  18. /** @return string */
  19. generatedStyles: function generatedStyles() {
  20. var theme = this.parsedTheme;
  21. var css = void 0;
  22. if (this.$vuetify.options.themeCache != null) {
  23. css = this.$vuetify.options.themeCache.get(theme);
  24. if (css != null) return css;
  25. }
  26. css = Theme.genStyles(theme, this.$vuetify.options.customProperties);
  27. if (this.$vuetify.options.minifyTheme != null) {
  28. css = this.$vuetify.options.minifyTheme(css);
  29. }
  30. if (this.$vuetify.options.themeCache != null) {
  31. this.$vuetify.options.themeCache.set(theme, css);
  32. }
  33. return css;
  34. },
  35. vueMeta: function vueMeta() {
  36. if (this.$vuetify.theme === false) return {};
  37. var options = {
  38. cssText: this.generatedStyles,
  39. id: 'vuetify-theme-stylesheet',
  40. type: 'text/css'
  41. };
  42. if (this.$vuetify.options.cspNonce) {
  43. options.nonce = this.$vuetify.options.cspNonce;
  44. }
  45. return {
  46. style: [options]
  47. };
  48. }
  49. },
  50. // Regular vue-meta
  51. metaInfo: function metaInfo() {
  52. return this.vueMeta;
  53. },
  54. // Nuxt
  55. head: function head() {
  56. return this.vueMeta;
  57. },
  58. watch: {
  59. generatedStyles: function generatedStyles() {
  60. !this.meta && this.applyTheme();
  61. }
  62. },
  63. created: function created() {
  64. if (this.$vuetify.theme === false) return;
  65. if (this.$meta) {
  66. // Vue-meta
  67. // Handled by metaInfo()/nuxt()
  68. } else if (typeof document === 'undefined' && this.$ssrContext) {
  69. // SSR
  70. var nonce = this.$vuetify.options.cspNonce ? ' nonce="' + this.$vuetify.options.cspNonce + '"' : '';
  71. this.$ssrContext.head = this.$ssrContext.head || '';
  72. this.$ssrContext.head += '<style type="text/css" id="vuetify-theme-stylesheet"' + nonce + '>' + this.generatedStyles + '</style>';
  73. } else if (typeof document !== 'undefined') {
  74. // Client-side
  75. this.genStyle();
  76. this.applyTheme();
  77. }
  78. },
  79. methods: {
  80. applyTheme: function applyTheme() {
  81. if (this.style) this.style.innerHTML = this.generatedStyles;
  82. },
  83. genStyle: function genStyle() {
  84. var style = document.getElementById('vuetify-theme-stylesheet');
  85. if (!style) {
  86. style = document.createElement('style');
  87. style.type = 'text/css';
  88. style.id = 'vuetify-theme-stylesheet';
  89. if (this.$vuetify.options.cspNonce) {
  90. style.setAttribute('nonce', this.$vuetify.options.cspNonce);
  91. }
  92. document.head.appendChild(style);
  93. }
  94. this.style = style;
  95. }
  96. }
  97. };
  98. //# sourceMappingURL=app-theme.js.map