Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

use-prefers-color-scheme

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-prefers-color-scheme - npm Package Compare versions

Comparing version 1.1.3-6b0b94a.1 to 1.1.3-6b0b94a.2

2

dist/index.cjs.js

@@ -1,2 +0,2 @@

"use strict";var h=Object.create;var o=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,l=Object.prototype.hasOwnProperty;var p=(e,t)=>{for(var r in t)o(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))!l.call(e,n)&&n!==r&&o(e,n,{get:()=>t[n],enumerable:!(i=m(t,n))||i.enumerable});return e};var v=(e,t,r)=>(r=e!=null?h(u(e)):{},d(t||!e||!e.__esModule?o(r,"default",{value:e,enumerable:!0}):r,e)),g=e=>d(o({},"__esModule",{value:!0}),e);var k={};p(k,{default:()=>E,usePrefersColorScheme:()=>f});module.exports=g(k);var s=v(require("react")),f=()=>{let[e,t]=s.useState();return s.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},E=f;
"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;
//# sourceMappingURL=index.cjs.js.map

@@ -1,3 +0,3 @@

export declare const usePrefersColorScheme: () => "dark" | "light" | "no-preference" | undefined;
export declare const usePrefersColorScheme: () => "dark" | "light" | "no-preference";
export default usePrefersColorScheme;
//# sourceMappingURL=index.d.ts.map

@@ -1,2 +0,2 @@

import*as n from"react";var c=()=>{let[a,i]=n.useState();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")},s=({matches:o})=>{o&&i("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=()=>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 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};
//# sourceMappingURL=index.esm.js.map
{
"name": "use-prefers-color-scheme",
"version": "1.1.3-6b0b94a.1",
"version": "1.1.3-6b0b94a.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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc