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.2KB

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