use-prefers-color-scheme
Advanced tools
Comparing version 1.1.3-6b0b94a.2 to 1.1.3-6b0b94a.3
@@ -1,2 +0,2 @@ | ||
"use strict";var f=Object.create;var s=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var r in t)s(e,r,{get:t[r],enumerable:!0})},d=(e,t,r,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of l(t))!u.call(e,n)&&n!==r&&s(e,n,{get:()=>t[n],enumerable:!(i=m(t,n))||i.enumerable});return e};var g=(e,t,r)=>(r=e!=null?f(L(e)):{},d(t||!e||!e.__esModule?s(r,"default",{value:e,enumerable:!0}):r,e)),v=e=>d(s({},"__esModule",{value:!0}),e);var k={};p(k,{default:()=>w,usePrefersColorScheme:()=>h});module.exports=v(k);var o=g(require("react")),h=()=>{let[e,t]=o.useState(()=>{let r=window==null?void 0:window.matchMedia("(prefers-color-scheme: dark)"),i=window==null?void 0: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:a})=>{a&&t("dark")},c=({matches:a})=>{a&&t("light")};return r.addEventListener("change",n),i.addEventListener("change",c),()=>{r.removeEventListener("change",n),i.removeEventListener("change",c)}}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},w=h; | ||
"use strict";var h=Object.create;var i=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var L=(e,t)=>{for(var r in t)i(e,r,{get:t[r],enumerable:!0})},d=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of l(t))!u.call(e,n)&&n!==r&&i(e,n,{get:()=>t[n],enumerable:!(o=m(t,n))||o.enumerable});return e};var g=(e,t,r)=>(r=e!=null?h(p(e)):{},d(t||!e||!e.__esModule?i(r,"default",{value:e,enumerable:!0}):r,e)),w=e=>d(i({},"__esModule",{value:!0}),e);var k={};L(k,{default:()=>v,usePrefersColorScheme:()=>f});module.exports=w(k);var s=g(require("react")),f=()=>{let[e,t]=s.useState(()=>{if(console.log({typeof:typeof window}),typeof window>"u")return"no-preference";let r=window.matchMedia("(prefers-color-scheme: dark)"),o=window.matchMedia("(prefers-color-scheme: light)");return r.matches?"dark":o.matches?"light":"no-preference"});return s.useEffect(()=>{if(typeof window.matchMedia!="function")return;let r=window.matchMedia("(prefers-color-scheme: dark)"),o=window.matchMedia("(prefers-color-scheme: light)");if(typeof o.addEventListener=="function"){let n=({matches:c})=>{c&&t("dark")},a=({matches:c})=>{c&&t("light")};return r.addEventListener("change",n),o.addEventListener("change",a),()=>{r.removeEventListener("change",n),o.removeEventListener("change",a)}}if(typeof o.addListener=="function"){let n=()=>t(r.matches?"dark":o.matches?"light":"no-preference");return r.addListener(n),o.addListener(n),()=>{r.removeListener(n),o.removeListener(n)}}},[]),e},v=f; | ||
//# sourceMappingURL=index.cjs.js.map |
@@ -1,2 +0,2 @@ | ||
import*as n from"react";var c=()=>{let[a,i]=n.useState(()=>{let r=window==null?void 0:window.matchMedia("(prefers-color-scheme: dark)"),e=window==null?void 0: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:s})=>{s&&i("dark")},o=({matches:s})=>{s&&i("light")};return r.addEventListener("change",t),e.addEventListener("change",o),()=>{r.removeEventListener("change",t),e.removeEventListener("change",o)}}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)}}},[]),a},d=c;export{d as default,c as usePrefersColorScheme}; | ||
import*as n from"react";var a=()=>{let[c,o]=n.useState(()=>{if(console.log({typeof:typeof window}),typeof window>"u")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:i})=>{i&&o("dark")},s=({matches:i})=>{i&&o("light")};return r.addEventListener("change",t),e.addEventListener("change",s),()=>{r.removeEventListener("change",t),e.removeEventListener("change",s)}}if(typeof e.addListener=="function"){let t=()=>o(r.matches?"dark":e.matches?"light":"no-preference");return r.addListener(t),e.addListener(t),()=>{r.removeListener(t),e.removeListener(t)}}},[]),c},d=a;export{d as default,a as usePrefersColorScheme}; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "use-prefers-color-scheme", | ||
"version": "1.1.3-6b0b94a.2", | ||
"version": "1.1.3-6b0b94a.3", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15196
15