use-prefers-color-scheme
Advanced tools
Comparing version 0.1.2-rc.3 to 0.1.2-rc.4
@@ -1,15 +0,2 @@ | ||
var K=Object.create;var x=Object.defineProperty;var X=Object.getOwnPropertyDescriptor;var Z=Object.getOwnPropertyNames;var Q=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var w=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var re=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Z(r))!ee.call(e,n)&&n!==t&&x(e,n,{get:()=>r[n],enumerable:!(o=X(r,n))||o.enumerable});return e};var te=(e,r,t)=>(t=e!=null?K(Q(e)):{},re(r||!e||!e.__esModule?x(t,"default",{value:e,enumerable:!0}):t,e));var q=w((_e,L)=>{"use strict";var R=Object.getOwnPropertySymbols,ne=Object.prototype.hasOwnProperty,oe=Object.prototype.propertyIsEnumerable;function ue(e){if(e==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}function ce(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de",Object.getOwnPropertyNames(e)[0]==="5")return!1;for(var r={},t=0;t<10;t++)r["_"+String.fromCharCode(t)]=t;var o=Object.getOwnPropertyNames(r).map(function(u){return r[u]});if(o.join("")!=="0123456789")return!1;var n={};return"abcdefghijklmnopqrst".split("").forEach(function(u){n[u]=u}),Object.keys(Object.assign({},n)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}L.exports=ce()?Object.assign:function(e,r){for(var t,o=ue(e),n,u=1;u<arguments.length;u++){t=Object(arguments[u]);for(var l in t)ne.call(t,l)&&(o[l]=t[l]);if(R){n=R(t);for(var c=0;c<n.length;c++)oe.call(t,n[c])&&(o[n[c]]=t[n[c]])}}return o}});var H=w(i=>{"use strict";var k=q(),s=typeof Symbol=="function"&&Symbol.for,m=s?Symbol.for("react.element"):60103,ie=s?Symbol.for("react.portal"):60106,le=s?Symbol.for("react.fragment"):60107,fe=s?Symbol.for("react.strict_mode"):60108,se=s?Symbol.for("react.profiler"):60114,ae=s?Symbol.for("react.provider"):60109,pe=s?Symbol.for("react.context"):60110,ye=s?Symbol.for("react.forward_ref"):60112,de=s?Symbol.for("react.suspense"):60113,he=s?Symbol.for("react.memo"):60115,me=s?Symbol.for("react.lazy"):60116,A=typeof Symbol=="function"&&Symbol.iterator;function v(e){for(var r="https://reactjs.org/docs/error-decoder.html?invariant="+e,t=1;t<arguments.length;t++)r+="&args[]="+encodeURIComponent(arguments[t]);return"Minified React error #"+e+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var I={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},M={};function h(e,r,t){this.props=e,this.context=r,this.refs=M,this.updater=t||I}h.prototype.isReactComponent={};h.prototype.setState=function(e,r){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error(v(85));this.updater.enqueueSetState(this,e,r,"setState")};h.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function N(){}N.prototype=h.prototype;function C(e,r,t){this.props=e,this.context=r,this.refs=M,this.updater=t||I}var b=C.prototype=new N;b.constructor=C;k(b,h.prototype);b.isPureReactComponent=!0;var P={current:null},U=Object.prototype.hasOwnProperty,D={key:!0,ref:!0,__self:!0,__source:!0};function F(e,r,t){var o,n={},u=null,l=null;if(r!=null)for(o in r.ref!==void 0&&(l=r.ref),r.key!==void 0&&(u=""+r.key),r)U.call(r,o)&&!D.hasOwnProperty(o)&&(n[o]=r[o]);var c=arguments.length-2;if(c===1)n.children=t;else if(1<c){for(var f=Array(c),a=0;a<c;a++)f[a]=arguments[a+2];n.children=f}if(e&&e.defaultProps)for(o in c=e.defaultProps,c)n[o]===void 0&&(n[o]=c[o]);return{$$typeof:m,type:e,key:u,ref:l,props:n,_owner:P.current}}function ve(e,r){return{$$typeof:m,type:e.type,key:r,ref:e.ref,props:e.props,_owner:e._owner}}function $(e){return typeof e=="object"&&e!==null&&e.$$typeof===m}function ge(e){var r={"=":"=0",":":"=2"};return"$"+(""+e).replace(/[=:]/g,function(t){return r[t]})}var V=/\/+/g,S=[];function T(e,r,t,o){if(S.length){var n=S.pop();return n.result=e,n.keyPrefix=r,n.func=t,n.context=o,n.count=0,n}return{result:e,keyPrefix:r,func:t,context:o,count:0}}function B(e){e.result=null,e.keyPrefix=null,e.func=null,e.context=null,e.count=0,10>S.length&&S.push(e)}function j(e,r,t,o){var n=typeof e;(n==="undefined"||n==="boolean")&&(e=null);var u=!1;if(e===null)u=!0;else switch(n){case"string":case"number":u=!0;break;case"object":switch(e.$$typeof){case m:case ie:u=!0}}if(u)return t(o,e,r===""?"."+E(e,0):r),1;if(u=0,r=r===""?".":r+":",Array.isArray(e))for(var l=0;l<e.length;l++){n=e[l];var c=r+E(n,l);u+=j(n,c,t,o)}else if(e===null||typeof e!="object"?c=null:(c=A&&e[A]||e["@@iterator"],c=typeof c=="function"?c:null),typeof c=="function")for(e=c.call(e),l=0;!(n=e.next()).done;)n=n.value,c=r+E(n,l++),u+=j(n,c,t,o);else if(n==="object")throw t=""+e,Error(v(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t,""));return u}function O(e,r,t){return e==null?0:j(e,"",r,t)}function E(e,r){return typeof e=="object"&&e!==null&&e.key!=null?ge(e.key):r.toString(36)}function Se(e,r){e.func.call(e.context,r,e.count++)}function we(e,r,t){var o=e.result,n=e.keyPrefix;e=e.func.call(e.context,r,e.count++),Array.isArray(e)?_(e,o,t,function(u){return u}):e!=null&&($(e)&&(e=ve(e,n+(!e.key||r&&r.key===e.key?"":(""+e.key).replace(V,"$&/")+"/")+t)),o.push(e))}function _(e,r,t,o,n){var u="";t!=null&&(u=(""+t).replace(V,"$&/")+"/"),r=T(r,u,o,n),O(e,we,r),B(r)}var z={current:null};function p(){var e=z.current;if(e===null)throw Error(v(321));return e}var Ee={ReactCurrentDispatcher:z,ReactCurrentBatchConfig:{suspense:null},ReactCurrentOwner:P,IsSomeRendererActing:{current:!1},assign:k};i.Children={map:function(e,r,t){if(e==null)return e;var o=[];return _(e,o,null,r,t),o},forEach:function(e,r,t){if(e==null)return e;r=T(null,null,r,t),O(e,Se,r),B(r)},count:function(e){return O(e,function(){return null},null)},toArray:function(e){var r=[];return _(e,r,null,function(t){return t}),r},only:function(e){if(!$(e))throw Error(v(143));return e}};i.Component=h;i.Fragment=le;i.Profiler=se;i.PureComponent=C;i.StrictMode=fe;i.Suspense=de;i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ee;i.cloneElement=function(e,r,t){if(e==null)throw Error(v(267,e));var o=k({},e.props),n=e.key,u=e.ref,l=e._owner;if(r!=null){if(r.ref!==void 0&&(u=r.ref,l=P.current),r.key!==void 0&&(n=""+r.key),e.type&&e.type.defaultProps)var c=e.type.defaultProps;for(f in r)U.call(r,f)&&!D.hasOwnProperty(f)&&(o[f]=r[f]===void 0&&c!==void 0?c[f]:r[f])}var f=arguments.length-2;if(f===1)o.children=t;else if(1<f){c=Array(f);for(var a=0;a<f;a++)c[a]=arguments[a+2];o.children=c}return{$$typeof:m,type:e.type,key:n,ref:u,props:o,_owner:l}};i.createContext=function(e,r){return r===void 0&&(r=null),e={$$typeof:pe,_calculateChangedBits:r,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider={$$typeof:ae,_context:e},e.Consumer=e};i.createElement=F;i.createFactory=function(e){var r=F.bind(null,e);return r.type=e,r};i.createRef=function(){return{current:null}};i.forwardRef=function(e){return{$$typeof:ye,render:e}};i.isValidElement=$;i.lazy=function(e){return{$$typeof:me,_ctor:e,_status:-1,_result:null}};i.memo=function(e,r){return{$$typeof:he,type:e,compare:r===void 0?null:r}};i.useCallback=function(e,r){return p().useCallback(e,r)};i.useContext=function(e,r){return p().useContext(e,r)};i.useDebugValue=function(){};i.useEffect=function(e,r){return p().useEffect(e,r)};i.useImperativeHandle=function(e,r,t){return p().useImperativeHandle(e,r,t)};i.useLayoutEffect=function(e,r){return p().useLayoutEffect(e,r)};i.useMemo=function(e,r){return p().useMemo(e,r)};i.useReducer=function(e,r,t){return p().useReducer(e,r,t)};i.useRef=function(e){return p().useRef(e)};i.useState=function(e){return p().useState(e)};i.version="16.14.0"});var Y=w((Ce,W)=>{"use strict";W.exports=H()});var g=te(Y()),G,y=(G=window.matchMedia)==null?void 0:G.call(window,"(prefers-color-scheme: dark)"),J,d=(J=window.matchMedia)==null?void 0:J.call(window,"(prefers-color-scheme: light)"),je=()=>{let e=y==null?void 0:y.matches,r=d==null?void 0:d.matches,[t,o]=(0,g.useState)(e?"dark":r?"light":"no-preference");return typeof window.matchMedia!="function"||((0,g.useEffect)(()=>{o(e?"dark":r?"light":"no-preference")},[e,r]),(0,g.useEffect)(()=>{if(typeof y.addEventListener=="function"){let n=({matches:l})=>l&&o("dark"),u=({matches:l})=>l&&o("light");return y.addEventListener("change",n),d.addEventListener("change",u),()=>{y.removeEventListener("change",n),d.removeEventListener("change",u)}}else{let n=()=>o(y.matches?"dark":d.matches?"light":"no-preference");return y.addEventListener("change",n),d.addEventListener("change",n),()=>{y.removeEventListener("change",n),d.removeEventListener("change",n)}}},[])),t},be=je;export{be as default}; | ||
/* | ||
object-assign | ||
(c) Sindre Sorhus | ||
@license MIT | ||
*/ | ||
/** @license React v16.14.0 | ||
* react.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
import{useEffect as h,useState as m}from"react";var d,e=(d=window.matchMedia)==null?void 0:d.call(window,"(prefers-color-scheme: dark)"),f,t=(f=window.matchMedia)==null?void 0:f.call(window,"(prefers-color-scheme: light)"),l=()=>{let s=e==null?void 0:e.matches,c=t==null?void 0:t.matches,[a,r]=m(s?"dark":c?"light":"no-preference");return typeof window.matchMedia!="function"||(h(()=>{r(s?"dark":c?"light":"no-preference")},[s,c]),h(()=>{if(typeof e.addEventListener=="function"){let n=({matches:o})=>o&&r("dark"),i=({matches:o})=>o&&r("light");return e.addEventListener("change",n),t.addEventListener("change",i),()=>{e.removeEventListener("change",n),t.removeEventListener("change",i)}}else{let n=()=>r(e.matches?"dark":t.matches?"light":"no-preference");return e.addEventListener("change",n),t.addEventListener("change",n),()=>{e.removeEventListener("change",n),t.removeEventListener("change",n)}}},[])),a},v=l;export{v as default}; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "use-prefers-color-scheme", | ||
"version": "0.1.2-rc.3", | ||
"version": "0.1.2-rc.4", | ||
"description": "React hook for determining the preferred color scheme", | ||
@@ -16,3 +16,3 @@ "author": "rfoel", | ||
"build:cjs": "esbuild src/index.ts --bundle --sourcemap --minify --outfile=dist/index.cjs.js --external:react", | ||
"build:esm": "esbuild src/index.ts --bundle --sourcemap --minify --format=esm --outfile=dist/index.esm.js", | ||
"build:esm": "esbuild src/index.ts --bundle --sourcemap --minify --format=esm --outfile=dist/index.esm.js --external:react", | ||
"build": "npm run build:cjs && npm run build:esm", | ||
@@ -19,0 +19,0 @@ "deploy": "gh-pages -d example/build", |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
12311
13