use-prefers-color-scheme
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -1,2 +0,2 @@ | ||
"use strict";(()=>{var d=Object.create;var c=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var u=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(r,t)=>(typeof require<"u"?require:r)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var l=(e,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of f(r))!L.call(e,n)&&n!==t&&c(e,n,{get:()=>r[n],enumerable:!(i=h(r,n))||i.enumerable});return e};var p=(e,r,t)=>(t=e!=null?d(m(e)):{},l(r||!e||!e.__esModule?c(t,"default",{value:e,enumerable:!0}):t,e));var o=p(u("react")),g=()=>{let[e,r]=o.useState("no-preference");return o.useEffect(()=>{if(typeof window.matchMedia!="function")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),i=window.matchMedia("(prefers-color-scheme: light)");if(r(t.matches?"dark":i.matches?"light":"no-preference"),typeof i.addEventListener=="function"){let n=({matches:s})=>{s&&r("dark")},a=({matches:s})=>{s&&r("light")};return t.addEventListener("change",n),i.addEventListener("change",a),()=>{t.removeEventListener("change",n),i.removeEventListener("change",a)}}if(typeof i.addListener=="function"){let n=()=>r(t.matches?"dark":i.matches?"light":"no-preference");return t.addListener(n),i.addListener(n),()=>{t.removeListener(n),i.removeListener(n)}}},[]),e},E=g;})(); | ||
"use strict";(()=>{var d=Object.create;var a=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var l=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var p=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of f(t))!u.call(e,n)&&n!==r&&a(e,n,{get:()=>t[n],enumerable:!(i=h(t,n))||i.enumerable});return e};var L=(e,t,r)=>(r=e!=null?d(m(e)):{},p(t||!e||!e.__esModule?a(r,"default",{value:e,enumerable:!0}):r,e));var o=L(l("react")),g=()=>{let[e,t]=o.useState(()=>{if(typeof window.matchMedia!="function")return"no-preference";let r=window.matchMedia("(prefers-color-scheme: dark)"),i=window.matchMedia("(prefers-color-scheme: light)");return r.matches?"dark":i.matches?"light":"no-preference"});return o.useEffect(()=>{if(typeof window.matchMedia!="function")return;let r=window.matchMedia("(prefers-color-scheme: dark)"),i=window.matchMedia("(prefers-color-scheme: light)");if(typeof i.addEventListener=="function"){let n=({matches:c})=>{c&&t("dark")},s=({matches:c})=>{c&&t("light")};return r.addEventListener("change",n),i.addEventListener("change",s),()=>{r.removeEventListener("change",n),i.removeEventListener("change",s)}}if(typeof i.addListener=="function"){let n=()=>t(r.matches?"dark":i.matches?"light":"no-preference");return r.addListener(n),i.addListener(n),()=>{r.removeListener(n),i.removeListener(n)}}},[]),e},v=g;})(); | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import*as i from"react";var c=()=>{let[a,n]=i.useState("no-preference");return i.useEffect(()=>{if(typeof window.matchMedia!="function")return;let t=window.matchMedia("(prefers-color-scheme: dark)"),e=window.matchMedia("(prefers-color-scheme: light)");if(n(t.matches?"dark":e.matches?"light":"no-preference"),typeof e.addEventListener=="function"){let r=({matches:o})=>{o&&n("dark")},s=({matches:o})=>{o&&n("light")};return t.addEventListener("change",r),e.addEventListener("change",s),()=>{t.removeEventListener("change",r),e.removeEventListener("change",s)}}if(typeof e.addListener=="function"){let r=()=>n(t.matches?"dark":e.matches?"light":"no-preference");return t.addListener(r),e.addListener(r),()=>{t.removeListener(r),e.removeListener(r)}}},[]),a},d=c;export{d as default,c as usePrefersColorScheme}; | ||
import*as n from"react";var a=()=>{let[s,i]=n.useState(()=>{if(typeof window.matchMedia!="function")return"no-preference";let r=window.matchMedia("(prefers-color-scheme: dark)"),e=window.matchMedia("(prefers-color-scheme: light)");return r.matches?"dark":e.matches?"light":"no-preference"});return n.useEffect(()=>{if(typeof window.matchMedia!="function")return;let r=window.matchMedia("(prefers-color-scheme: dark)"),e=window.matchMedia("(prefers-color-scheme: light)");if(typeof e.addEventListener=="function"){let t=({matches:o})=>{o&&i("dark")},c=({matches:o})=>{o&&i("light")};return r.addEventListener("change",t),e.addEventListener("change",c),()=>{r.removeEventListener("change",t),e.removeEventListener("change",c)}}if(typeof e.addListener=="function"){let t=()=>i(r.matches?"dark":e.matches?"light":"no-preference");return r.addListener(t),e.addListener(t),()=>{r.removeListener(t),e.removeListener(t)}}},[]),s},d=a;export{d as default,a as usePrefersColorScheme}; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "use-prefers-color-scheme", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "React hook for determining the preferred color scheme", | ||
@@ -5,0 +5,0 @@ "author": "rfoel", |
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
14806
15