@nuxtjs/color-mode
Advanced tools
Comparing version 3.1.2 to 3.1.3
{ | ||
"name": "@nuxtjs/color-mode", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"configKey": "colorMode", | ||
@@ -5,0 +5,0 @@ "compatibility": { |
@@ -1,1 +0,1 @@ | ||
const w=window,de=document.documentElement,knownColorSchemes=["dark","light"],preference=window.localStorage.getItem("<%= options.storageKey %>")||"<%= options.preference %>";let value=preference==="system"?getColorScheme():preference;const forcedColorMode=de.getAttribute("data-color-mode-forced");forcedColorMode&&(value=forcedColorMode),addClass(value),w["<%= options.globalName %>"]={preference,value,getColorScheme,addClass,removeClass};function addClass(e){const o="<%= options.classPrefix %>"+e+"<%= options.classSuffix %>";de.classList?de.classList.add(o):de.className+=" "+o}function removeClass(e){const o="<%= options.classPrefix %>"+e+"<%= options.classSuffix %>";de.classList?de.classList.remove(o):de.className=de.className.replace(new RegExp(o,"g"),"")}function prefersColorScheme(e){return w.matchMedia("(prefers-color-scheme"+e+")")}function getColorScheme(){if(w.matchMedia&&prefersColorScheme("").media!=="not all"){for(const e of knownColorSchemes)if(prefersColorScheme(":"+e).matches)return e}return"<%= options.fallback %>"} | ||
const w=window,de=document.documentElement,knownColorSchemes=["dark","light"],preference=window.localStorage.getItem("<%= options.storageKey %>")||"<%= options.preference %>";let value=preference==="system"?getColorScheme():preference;const forcedColorMode=de.getAttribute("data-color-mode-forced");forcedColorMode&&(value=forcedColorMode),addColorScheme(value),w["<%= options.globalName %>"]={preference,value,getColorScheme,addColorScheme,removeColorScheme};function addColorScheme(e){const o="<%= options.classPrefix %>"+e+"<%= options.classSuffix %>",t="<%= options.dataValue %>";de.classList?de.classList.add(o):de.className+=" "+o,de.setAttribute("data-"+t,e)}function removeColorScheme(e){const o="<%= options.classPrefix %>"+e+"<%= options.classSuffix %>",t="<%= options.dataValue %>";de.classList?de.classList.remove(o):de.className=de.className.replace(new RegExp(o,"g"),""),de.removeAttribute("data-"+t)}function prefersColorScheme(e){return w.matchMedia("(prefers-color-scheme"+e+")")}function getColorScheme(){if(w.matchMedia&&prefersColorScheme("").media!=="not all"){for(const e of knownColorSchemes)if(prefersColorScheme(":"+e).matches)return e}return"<%= options.fallback %>"} |
{ | ||
"name": "@nuxtjs/color-mode", | ||
"version": "3.1.2", | ||
"version": "3.1.3", | ||
"description": "Dark and Light mode for Nuxt with auto detection", | ||
@@ -5,0 +5,0 @@ "repository": "nuxt-community/color-mode-module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
20860
434