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

react-visibility-sensor

Package Overview
Dependencies
Maintainers
4
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-visibility-sensor - npm Package Compare versions

Comparing version 4.1.3 to 5.0.0

.babelrc

5

CHANGELOG.md
Changelog
====
## 5.0.0
- Update to ES6 style React and replaced Browserify with Webpack ([#123](https://github.com/joshwnj/react-visibility-sensor/pull/123))
- Update code to the latest version of react, remove useless params/function ([#115](https://github.com/joshwnj/react-visibility-sensor/pull/115))
## 4.1.0

@@ -5,0 +10,0 @@

2

dist/visibility-sensor.min.js

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

(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.VisibilitySensor=f()}})(function(){var define,module,exports;return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(require,module,exports){module.exports=function(offset,rect,containmentRect){var offsetDir=offset.direction;var offsetVal=offset.value;switch(offsetDir){case"top":return containmentRect.top+offsetVal<rect.top&&containmentRect.bottom>rect.bottom&&containmentRect.left<rect.left&&containmentRect.right>rect.right;case"left":return containmentRect.left+offsetVal<rect.left&&containmentRect.bottom>rect.bottom&&containmentRect.top<rect.top&&containmentRect.right>rect.right;case"bottom":return containmentRect.bottom-offsetVal>rect.bottom&&containmentRect.left<rect.left&&containmentRect.right>rect.right&&containmentRect.top<rect.top;case"right":return containmentRect.right-offsetVal>rect.right&&containmentRect.left<rect.left&&containmentRect.top<rect.top&&containmentRect.bottom>rect.bottom}}},{}],2:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error("setTimeout has not been defined")}function defaultClearTimeout(){throw new Error("clearTimeout has not been defined")}(function(){try{if(typeof setTimeout==="function"){cachedSetTimeout=setTimeout}else{cachedSetTimeout=defaultSetTimout}}catch(e){cachedSetTimeout=defaultSetTimout}try{if(typeof clearTimeout==="function"){cachedClearTimeout=clearTimeout}else{cachedClearTimeout=defaultClearTimeout}}catch(e){cachedClearTimeout=defaultClearTimeout}})();function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0)}if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0)}try{return cachedSetTimeout(fun,0)}catch(e){try{return cachedSetTimeout.call(null,fun,0)}catch(e){return cachedSetTimeout.call(this,fun,0)}}}function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker)}if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker)}try{return cachedClearTimeout(marker)}catch(e){try{return cachedClearTimeout.call(null,marker)}catch(e){return cachedClearTimeout.call(this,marker)}}}var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return}draining=false;if(currentQueue.length){queue=currentQueue.concat(queue)}else{queueIndex=-1}if(queue.length){drainQueue()}}function drainQueue(){if(draining){return}var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run()}}queueIndex=-1;len=queue.length}currentQueue=null;draining=false;runClearTimeout(timeout)}process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i]}}queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue)}};function Item(fun,array){this.fun=fun;this.array=array}Item.prototype.run=function(){this.fun.apply(null,this.array)};process.title="browser";process.browser=true;process.env={};process.argv=[];process.version="";process.versions={};function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]};process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")};process.umask=function(){return 0}},{}],3:[function(require,module,exports){(function(process){"use strict";var _assign=require("object-assign");var emptyObject=require("fbjs/lib/emptyObject");var _invariant=require("fbjs/lib/invariant");if(process.env.NODE_ENV!=="production"){var warning=require("fbjs/lib/warning")}var MIXINS_KEY="mixins";function identity(fn){return fn}var ReactPropTypeLocationNames;if(process.env.NODE_ENV!=="production"){ReactPropTypeLocationNames={prop:"prop",context:"context",childContext:"child context"}}else{ReactPropTypeLocationNames={}}function factory(ReactComponent,isValidElement,ReactNoopUpdateQueue){var injectedMixins=[];var ReactClassInterface={mixins:"DEFINE_MANY",statics:"DEFINE_MANY",propTypes:"DEFINE_MANY",contextTypes:"DEFINE_MANY",childContextTypes:"DEFINE_MANY",getDefaultProps:"DEFINE_MANY_MERGED",getInitialState:"DEFINE_MANY_MERGED",getChildContext:"DEFINE_MANY_MERGED",render:"DEFINE_ONCE",componentWillMount:"DEFINE_MANY",componentDidMount:"DEFINE_MANY",componentWillReceiveProps:"DEFINE_MANY",shouldComponentUpdate:"DEFINE_ONCE",componentWillUpdate:"DEFINE_MANY",componentDidUpdate:"DEFINE_MANY",componentWillUnmount:"DEFINE_MANY",UNSAFE_componentWillMount:"DEFINE_MANY",UNSAFE_componentWillReceiveProps:"DEFINE_MANY",UNSAFE_componentWillUpdate:"DEFINE_MANY",updateComponent:"OVERRIDE_BASE"};var ReactClassStaticInterface={getDerivedStateFromProps:"DEFINE_MANY_MERGED"};var RESERVED_SPEC_KEYS={displayName:function(Constructor,displayName){Constructor.displayName=displayName},mixins:function(Constructor,mixins){if(mixins){for(var i=0;i<mixins.length;i++){mixSpecIntoComponent(Constructor,mixins[i])}}},childContextTypes:function(Constructor,childContextTypes){if(process.env.NODE_ENV!=="production"){validateTypeDef(Constructor,childContextTypes,"childContext")}Constructor.childContextTypes=_assign({},Constructor.childContextTypes,childContextTypes)},contextTypes:function(Constructor,contextTypes){if(process.env.NODE_ENV!=="production"){validateTypeDef(Constructor,contextTypes,"context")}Constructor.contextTypes=_assign({},Constructor.contextTypes,contextTypes)},getDefaultProps:function(Constructor,getDefaultProps){if(Constructor.getDefaultProps){Constructor.getDefaultProps=createMergedResultFunction(Constructor.getDefaultProps,getDefaultProps)}else{Constructor.getDefaultProps=getDefaultProps}},propTypes:function(Constructor,propTypes){if(process.env.NODE_ENV!=="production"){validateTypeDef(Constructor,propTypes,"prop")}Constructor.propTypes=_assign({},Constructor.propTypes,propTypes)},statics:function(Constructor,statics){mixStaticSpecIntoComponent(Constructor,statics)},autobind:function(){}};function validateTypeDef(Constructor,typeDef,location){for(var propName in typeDef){if(typeDef.hasOwnProperty(propName)){if(process.env.NODE_ENV!=="production"){warning(typeof typeDef[propName]==="function","%s: %s type `%s` is invalid; it must be a function, usually from "+"React.PropTypes.",Constructor.displayName||"ReactClass",ReactPropTypeLocationNames[location],propName)}}}}function validateMethodOverride(isAlreadyDefined,name){var specPolicy=ReactClassInterface.hasOwnProperty(name)?ReactClassInterface[name]:null;if(ReactClassMixin.hasOwnProperty(name)){_invariant(specPolicy==="OVERRIDE_BASE","ReactClassInterface: You are attempting to override "+"`%s` from your class specification. Ensure that your method names "+"do not overlap with React methods.",name)}if(isAlreadyDefined){_invariant(specPolicy==="DEFINE_MANY"||specPolicy==="DEFINE_MANY_MERGED","ReactClassInterface: You are attempting to define "+"`%s` on your component more than once. This conflict may be due "+"to a mixin.",name)}}function mixSpecIntoComponent(Constructor,spec){if(!spec){if(process.env.NODE_ENV!=="production"){var typeofSpec=typeof spec;var isMixinValid=typeofSpec==="object"&&spec!==null;if(process.env.NODE_ENV!=="production"){warning(isMixinValid,"%s: You're attempting to include a mixin that is either null "+"or not an object. Check the mixins included by the component, "+"as well as any mixins they include themselves. "+"Expected object but got %s.",Constructor.displayName||"ReactClass",spec===null?null:typeofSpec)}}return}_invariant(typeof spec!=="function","ReactClass: You're attempting to "+"use a component class or function as a mixin. Instead, just use a "+"regular object.");_invariant(!isValidElement(spec),"ReactClass: You're attempting to "+"use a component as a mixin. Instead, just use a regular object.");var proto=Constructor.prototype;var autoBindPairs=proto.__reactAutoBindPairs;if(spec.hasOwnProperty(MIXINS_KEY)){RESERVED_SPEC_KEYS.mixins(Constructor,spec.mixins)}for(var name in spec){if(!spec.hasOwnProperty(name)){continue}if(name===MIXINS_KEY){continue}var property=spec[name];var isAlreadyDefined=proto.hasOwnProperty(name);validateMethodOverride(isAlreadyDefined,name);if(RESERVED_SPEC_KEYS.hasOwnProperty(name)){RESERVED_SPEC_KEYS[name](Constructor,property)}else{var isReactClassMethod=ReactClassInterface.hasOwnProperty(name);var isFunction=typeof property==="function";var shouldAutoBind=isFunction&&!isReactClassMethod&&!isAlreadyDefined&&spec.autobind!==false;if(shouldAutoBind){autoBindPairs.push(name,property);proto[name]=property}else{if(isAlreadyDefined){var specPolicy=ReactClassInterface[name];_invariant(isReactClassMethod&&(specPolicy==="DEFINE_MANY_MERGED"||specPolicy==="DEFINE_MANY"),"ReactClass: Unexpected spec policy %s for key %s "+"when mixing in component specs.",specPolicy,name);if(specPolicy==="DEFINE_MANY_MERGED"){proto[name]=createMergedResultFunction(proto[name],property)}else if(specPolicy==="DEFINE_MANY"){proto[name]=createChainedFunction(proto[name],property)}}else{proto[name]=property;if(process.env.NODE_ENV!=="production"){if(typeof property==="function"&&spec.displayName){proto[name].displayName=spec.displayName+"_"+name}}}}}}}function mixStaticSpecIntoComponent(Constructor,statics){if(!statics){return}for(var name in statics){var property=statics[name];if(!statics.hasOwnProperty(name)){continue}var isReserved=name in RESERVED_SPEC_KEYS;_invariant(!isReserved,"ReactClass: You are attempting to define a reserved "+'property, `%s`, that shouldn\'t be on the "statics" key. Define it '+"as an instance property instead; it will still be accessible on the "+"constructor.",name);var isAlreadyDefined=name in Constructor;if(isAlreadyDefined){var specPolicy=ReactClassStaticInterface.hasOwnProperty(name)?ReactClassStaticInterface[name]:null;_invariant(specPolicy==="DEFINE_MANY_MERGED","ReactClass: You are attempting to define "+"`%s` on your component more than once. This conflict may be "+"due to a mixin.",name);Constructor[name]=createMergedResultFunction(Constructor[name],property);return}Constructor[name]=property}}function mergeIntoWithNoDuplicateKeys(one,two){_invariant(one&&two&&typeof one==="object"&&typeof two==="object","mergeIntoWithNoDuplicateKeys(): Cannot merge non-objects.");for(var key in two){if(two.hasOwnProperty(key)){_invariant(one[key]===undefined,"mergeIntoWithNoDuplicateKeys(): "+"Tried to merge two objects with the same key: `%s`. This conflict "+"may be due to a mixin; in particular, this may be caused by two "+"getInitialState() or getDefaultProps() methods returning objects "+"with clashing keys.",key);one[key]=two[key]}}return one}function createMergedResultFunction(one,two){return function mergedResult(){var a=one.apply(this,arguments);var b=two.apply(this,arguments);if(a==null){return b}else if(b==null){return a}var c={};mergeIntoWithNoDuplicateKeys(c,a);mergeIntoWithNoDuplicateKeys(c,b);return c}}function createChainedFunction(one,two){return function chainedFunction(){one.apply(this,arguments);two.apply(this,arguments)}}function bindAutoBindMethod(component,method){var boundMethod=method.bind(component);if(process.env.NODE_ENV!=="production"){boundMethod.__reactBoundContext=component;boundMethod.__reactBoundMethod=method;boundMethod.__reactBoundArguments=null;var componentName=component.constructor.displayName;var _bind=boundMethod.bind;boundMethod.bind=function(newThis){for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}if(newThis!==component&&newThis!==null){if(process.env.NODE_ENV!=="production"){warning(false,"bind(): React component methods may only be bound to the "+"component instance. See %s",componentName)}}else if(!args.length){if(process.env.NODE_ENV!=="production"){warning(false,"bind(): You are binding a component method to the component. "+"React does this for you automatically in a high-performance "+"way, so you can safely remove this call. See %s",componentName)}return boundMethod}var reboundMethod=_bind.apply(boundMethod,arguments);reboundMethod.__reactBoundContext=component;reboundMethod.__reactBoundMethod=method;reboundMethod.__reactBoundArguments=args;return reboundMethod}}return boundMethod}function bindAutoBindMethods(component){var pairs=component.__reactAutoBindPairs;for(var i=0;i<pairs.length;i+=2){var autoBindKey=pairs[i];var method=pairs[i+1];component[autoBindKey]=bindAutoBindMethod(component,method)}}var IsMountedPreMixin={componentDidMount:function(){this.__isMounted=true}};var IsMountedPostMixin={componentWillUnmount:function(){this.__isMounted=false}};var ReactClassMixin={replaceState:function(newState,callback){this.updater.enqueueReplaceState(this,newState,callback)},isMounted:function(){if(process.env.NODE_ENV!=="production"){warning(this.__didWarnIsMounted,"%s: isMounted is deprecated. Instead, make sure to clean up "+"subscriptions and pending requests in componentWillUnmount to "+"prevent memory leaks.",this.constructor&&this.constructor.displayName||this.name||"Component");this.__didWarnIsMounted=true}return!!this.__isMounted}};var ReactClassComponent=function(){};_assign(ReactClassComponent.prototype,ReactComponent.prototype,ReactClassMixin);function createClass(spec){var Constructor=identity(function(props,context,updater){if(process.env.NODE_ENV!=="production"){warning(this instanceof Constructor,"Something is calling a React component directly. Use a factory or "+"JSX instead. See: https://fb.me/react-legacyfactory")}if(this.__reactAutoBindPairs.length){bindAutoBindMethods(this)}this.props=props;this.context=context;this.refs=emptyObject;this.updater=updater||ReactNoopUpdateQueue;this.state=null;var initialState=this.getInitialState?this.getInitialState():null;if(process.env.NODE_ENV!=="production"){if(initialState===undefined&&this.getInitialState._isMockFunction){initialState=null}}_invariant(typeof initialState==="object"&&!Array.isArray(initialState),"%s.getInitialState(): must return an object or null",Constructor.displayName||"ReactCompositeComponent");this.state=initialState});Constructor.prototype=new ReactClassComponent;Constructor.prototype.constructor=Constructor;Constructor.prototype.__reactAutoBindPairs=[];injectedMixins.forEach(mixSpecIntoComponent.bind(null,Constructor));mixSpecIntoComponent(Constructor,IsMountedPreMixin);mixSpecIntoComponent(Constructor,spec);mixSpecIntoComponent(Constructor,IsMountedPostMixin);if(Constructor.getDefaultProps){Constructor.defaultProps=Constructor.getDefaultProps()}if(process.env.NODE_ENV!=="production"){if(Constructor.getDefaultProps){Constructor.getDefaultProps.isReactClassApproved={}}if(Constructor.prototype.getInitialState){Constructor.prototype.getInitialState.isReactClassApproved={}}}_invariant(Constructor.prototype.render,"createClass(...): Class specification must implement a `render` method.");if(process.env.NODE_ENV!=="production"){warning(!Constructor.prototype.componentShouldUpdate,"%s has a method called "+"componentShouldUpdate(). Did you mean shouldComponentUpdate()? "+"The name is phrased as a question because the function is "+"expected to return a value.",spec.displayName||"A component");warning(!Constructor.prototype.componentWillRecieveProps,"%s has a method called "+"componentWillRecieveProps(). Did you mean componentWillReceiveProps()?",spec.displayName||"A component");warning(!Constructor.prototype.UNSAFE_componentWillRecieveProps,"%s has a method called UNSAFE_componentWillRecieveProps(). "+"Did you mean UNSAFE_componentWillReceiveProps()?",spec.displayName||"A component")}for(var methodName in ReactClassInterface){if(!Constructor.prototype[methodName]){Constructor.prototype[methodName]=null}}return Constructor}return createClass}module.exports=factory}).call(this,require("_process"))},{_process:2,"fbjs/lib/emptyObject":6,"fbjs/lib/invariant":7,"fbjs/lib/warning":8,"object-assign":9}],4:[function(require,module,exports){"use strict";var React=require("react");var factory=require("./factory");if(typeof React==="undefined"){throw Error("create-react-class could not find the React object. If you are using script tags, "+"make sure that React is being loaded before create-react-class.")}var ReactNoopUpdateQueue=(new React.Component).updater;module.exports=factory(React.Component,React.isValidElement,ReactNoopUpdateQueue)},{"./factory":3,react:undefined}],5:[function(require,module,exports){"use strict";function makeEmptyFunction(arg){return function(){return arg}}var emptyFunction=function emptyFunction(){};emptyFunction.thatReturns=makeEmptyFunction;emptyFunction.thatReturnsFalse=makeEmptyFunction(false);emptyFunction.thatReturnsTrue=makeEmptyFunction(true);emptyFunction.thatReturnsNull=makeEmptyFunction(null);emptyFunction.thatReturnsThis=function(){return this};emptyFunction.thatReturnsArgument=function(arg){return arg};module.exports=emptyFunction},{}],6:[function(require,module,exports){(function(process){"use strict";var emptyObject={};if(process.env.NODE_ENV!=="production"){Object.freeze(emptyObject)}module.exports=emptyObject}).call(this,require("_process"))},{_process:2}],7:[function(require,module,exports){(function(process){"use strict";var validateFormat=function validateFormat(format){};if(process.env.NODE_ENV!=="production"){validateFormat=function validateFormat(format){if(format===undefined){throw new Error("invariant requires an error message argument")}}}function invariant(condition,format,a,b,c,d,e,f){validateFormat(format);if(!condition){var error;if(format===undefined){error=new Error("Minified exception occurred; use the non-minified dev environment "+"for the full error message and additional helpful warnings.")}else{var args=[a,b,c,d,e,f];var argIndex=0;error=new Error(format.replace(/%s/g,function(){return args[argIndex++]}));error.name="Invariant Violation"}error.framesToPop=1;throw error}}module.exports=invariant}).call(this,require("_process"))},{_process:2}],8:[function(require,module,exports){(function(process){"use strict";var emptyFunction=require("./emptyFunction");var warning=emptyFunction;if(process.env.NODE_ENV!=="production"){var printWarning=function printWarning(format){for(var _len=arguments.length,args=Array(_len>1?_len-1:0),_key=1;_key<_len;_key++){args[_key-1]=arguments[_key]}var argIndex=0;var message="Warning: "+format.replace(/%s/g,function(){return args[argIndex++]});if(typeof console!=="undefined"){console.error(message)}try{throw new Error(message)}catch(x){}};warning=function warning(condition,format){if(format===undefined){throw new Error("`warning(condition, format, ...args)` requires a warning "+"message argument")}if(format.indexOf("Failed Composite propType: ")===0){return}if(!condition){for(var _len2=arguments.length,args=Array(_len2>2?_len2-2:0),_key2=2;_key2<_len2;_key2++){args[_key2-2]=arguments[_key2]}printWarning.apply(undefined,[format].concat(args))}}}module.exports=warning}).call(this,require("_process"))},{"./emptyFunction":5,_process:2}],9:[function(require,module,exports){"use strict";var getOwnPropertySymbols=Object.getOwnPropertySymbols;var hasOwnProperty=Object.prototype.hasOwnProperty;var propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(val){if(val===null||val===undefined){throw new TypeError("Object.assign cannot be called with null or undefined")}return Object(val)}function shouldUseNative(){try{if(!Object.assign){return false}var test1=new String("abc");test1[5]="de";if(Object.getOwnPropertyNames(test1)[0]==="5"){return false}var test2={};for(var i=0;i<10;i++){test2["_"+String.fromCharCode(i)]=i}var order2=Object.getOwnPropertyNames(test2).map(function(n){return test2[n]});if(order2.join("")!=="0123456789"){return false}var test3={};"abcdefghijklmnopqrst".split("").forEach(function(letter){test3[letter]=letter});if(Object.keys(Object.assign({},test3)).join("")!=="abcdefghijklmnopqrst"){return false}return true}catch(err){return false}}module.exports=shouldUseNative()?Object.assign:function(target,source){var from;var to=toObject(target);var symbols;for(var s=1;s<arguments.length;s++){from=Object(arguments[s]);for(var key in from){if(hasOwnProperty.call(from,key)){to[key]=from[key]}}if(getOwnPropertySymbols){symbols=getOwnPropertySymbols(from);for(var i=0;i<symbols.length;i++){if(propIsEnumerable.call(from,symbols[i])){to[symbols[i]]=from[symbols[i]]}}}}return to}},{}],10:[function(require,module,exports){(function(process){"use strict";var printWarning=function(){};if(process.env.NODE_ENV!=="production"){var ReactPropTypesSecret=require("./lib/ReactPropTypesSecret");var loggedTypeFailures={};printWarning=function(text){var message="Warning: "+text;if(typeof console!=="undefined"){console.error(message)}try{throw new Error(message)}catch(x){}}}function checkPropTypes(typeSpecs,values,location,componentName,getStack){if(process.env.NODE_ENV!=="production"){for(var typeSpecName in typeSpecs){if(typeSpecs.hasOwnProperty(typeSpecName)){var error;try{if(typeof typeSpecs[typeSpecName]!=="function"){var err=Error((componentName||"React class")+": "+location+" type `"+typeSpecName+"` is invalid; "+"it must be a function, usually from the `prop-types` package, but received `"+typeof typeSpecs[typeSpecName]+"`.");err.name="Invariant Violation";throw err}error=typeSpecs[typeSpecName](values,typeSpecName,componentName,location,null,ReactPropTypesSecret)}catch(ex){error=ex}if(error&&!(error instanceof Error)){printWarning((componentName||"React class")+": type specification of "+location+" `"+typeSpecName+"` is invalid; the type checker "+"function must return `null` or an `Error` but returned a "+typeof error+". "+"You may have forgotten to pass an argument to the type checker "+"creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and "+"shape all require an argument).")}if(error instanceof Error&&!(error.message in loggedTypeFailures)){loggedTypeFailures[error.message]=true;var stack=getStack?getStack():"";printWarning("Failed "+location+" type: "+error.message+(stack!=null?stack:""))}}}}}module.exports=checkPropTypes}).call(this,require("_process"))},{"./lib/ReactPropTypesSecret":14,_process:2}],11:[function(require,module,exports){"use strict";var ReactPropTypesSecret=require("./lib/ReactPropTypesSecret");function emptyFunction(){}module.exports=function(){function shim(props,propName,componentName,location,propFullName,secret){if(secret===ReactPropTypesSecret){return}var err=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. "+"Use PropTypes.checkPropTypes() to call them. "+"Read more at http://fb.me/use-check-prop-types");err.name="Invariant Violation";throw err}shim.isRequired=shim;function getShim(){return shim}var ReactPropTypes={array:shim,bool:shim,func:shim,number:shim,object:shim,string:shim,symbol:shim,any:shim,arrayOf:getShim,element:shim,instanceOf:getShim,node:shim,objectOf:getShim,oneOf:getShim,oneOfType:getShim,shape:getShim,exact:getShim};ReactPropTypes.checkPropTypes=emptyFunction;ReactPropTypes.PropTypes=ReactPropTypes;return ReactPropTypes}},{"./lib/ReactPropTypesSecret":14}],12:[function(require,module,exports){(function(process){"use strict";var assign=require("object-assign");var ReactPropTypesSecret=require("./lib/ReactPropTypesSecret");var checkPropTypes=require("./checkPropTypes");var printWarning=function(){};if(process.env.NODE_ENV!=="production"){printWarning=function(text){var message="Warning: "+text;if(typeof console!=="undefined"){console.error(message)}try{throw new Error(message)}catch(x){}}}function emptyFunctionThatReturnsNull(){return null}module.exports=function(isValidElement,throwOnDirectAccess){var ITERATOR_SYMBOL=typeof Symbol==="function"&&Symbol.iterator;var FAUX_ITERATOR_SYMBOL="@@iterator";function getIteratorFn(maybeIterable){var iteratorFn=maybeIterable&&(ITERATOR_SYMBOL&&maybeIterable[ITERATOR_SYMBOL]||maybeIterable[FAUX_ITERATOR_SYMBOL]);if(typeof iteratorFn==="function"){return iteratorFn}}var ANONYMOUS="<<anonymous>>";var ReactPropTypes={array:createPrimitiveTypeChecker("array"),bool:createPrimitiveTypeChecker("boolean"),func:createPrimitiveTypeChecker("function"),number:createPrimitiveTypeChecker("number"),object:createPrimitiveTypeChecker("object"),string:createPrimitiveTypeChecker("string"),symbol:createPrimitiveTypeChecker("symbol"),any:createAnyTypeChecker(),arrayOf:createArrayOfTypeChecker,element:createElementTypeChecker(),instanceOf:createInstanceTypeChecker,node:createNodeChecker(),objectOf:createObjectOfTypeChecker,oneOf:createEnumTypeChecker,oneOfType:createUnionTypeChecker,shape:createShapeTypeChecker,exact:createStrictShapeTypeChecker};function is(x,y){if(x===y){return x!==0||1/x===1/y}else{return x!==x&&y!==y}}function PropTypeError(message){this.message=message;this.stack=""}PropTypeError.prototype=Error.prototype;function createChainableTypeChecker(validate){if(process.env.NODE_ENV!=="production"){var manualPropTypeCallCache={};var manualPropTypeWarningCount=0}function checkType(isRequired,props,propName,componentName,location,propFullName,secret){componentName=componentName||ANONYMOUS;propFullName=propFullName||propName;if(secret!==ReactPropTypesSecret){if(throwOnDirectAccess){var err=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. "+"Use `PropTypes.checkPropTypes()` to call them. "+"Read more at http://fb.me/use-check-prop-types");err.name="Invariant Violation";throw err}else if(process.env.NODE_ENV!=="production"&&typeof console!=="undefined"){var cacheKey=componentName+":"+propName;if(!manualPropTypeCallCache[cacheKey]&&manualPropTypeWarningCount<3){printWarning("You are manually calling a React.PropTypes validation "+"function for the `"+propFullName+"` prop on `"+componentName+"`. This is deprecated "+"and will throw in the standalone `prop-types` package. "+"You may be seeing this warning due to a third-party PropTypes "+"library. See https://fb.me/react-warning-dont-call-proptypes "+"for details.");manualPropTypeCallCache[cacheKey]=true;manualPropTypeWarningCount++}}}if(props[propName]==null){if(isRequired){if(props[propName]===null){return new PropTypeError("The "+location+" `"+propFullName+"` is marked as required "+("in `"+componentName+"`, but its value is `null`."))}return new PropTypeError("The "+location+" `"+propFullName+"` is marked as required in "+("`"+componentName+"`, but its value is `undefined`."))}return null}else{return validate(props,propName,componentName,location,propFullName)}}var chainedCheckType=checkType.bind(null,false);chainedCheckType.isRequired=checkType.bind(null,true);return chainedCheckType}function createPrimitiveTypeChecker(expectedType){function validate(props,propName,componentName,location,propFullName,secret){var propValue=props[propName];var propType=getPropType(propValue);if(propType!==expectedType){var preciseType=getPreciseType(propValue);return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type "+("`"+preciseType+"` supplied to `"+componentName+"`, expected ")+("`"+expectedType+"`."))}return null}return createChainableTypeChecker(validate)}function createAnyTypeChecker(){return createChainableTypeChecker(emptyFunctionThatReturnsNull)}function createArrayOfTypeChecker(typeChecker){function validate(props,propName,componentName,location,propFullName){if(typeof typeChecker!=="function"){return new PropTypeError("Property `"+propFullName+"` of component `"+componentName+"` has invalid PropType notation inside arrayOf.")}var propValue=props[propName];if(!Array.isArray(propValue)){var propType=getPropType(propValue);return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type "+("`"+propType+"` supplied to `"+componentName+"`, expected an array."))}for(var i=0;i<propValue.length;i++){var error=typeChecker(propValue,i,componentName,location,propFullName+"["+i+"]",ReactPropTypesSecret);if(error instanceof Error){return error}}return null}return createChainableTypeChecker(validate)}function createElementTypeChecker(){function validate(props,propName,componentName,location,propFullName){var propValue=props[propName];if(!isValidElement(propValue)){var propType=getPropType(propValue);return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type "+("`"+propType+"` supplied to `"+componentName+"`, expected a single ReactElement."))}return null}return createChainableTypeChecker(validate)}function createInstanceTypeChecker(expectedClass){function validate(props,propName,componentName,location,propFullName){if(!(props[propName]instanceof expectedClass)){var expectedClassName=expectedClass.name||ANONYMOUS;var actualClassName=getClassName(props[propName]);return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type "+("`"+actualClassName+"` supplied to `"+componentName+"`, expected ")+("instance of `"+expectedClassName+"`."))}return null}return createChainableTypeChecker(validate)}function createEnumTypeChecker(expectedValues){if(!Array.isArray(expectedValues)){process.env.NODE_ENV!=="production"?printWarning("Invalid argument supplied to oneOf, expected an instance of array."):void 0;return emptyFunctionThatReturnsNull}function validate(props,propName,componentName,location,propFullName){var propValue=props[propName];for(var i=0;i<expectedValues.length;i++){if(is(propValue,expectedValues[i])){return null}}var valuesString=JSON.stringify(expectedValues);return new PropTypeError("Invalid "+location+" `"+propFullName+"` of value `"+propValue+"` "+("supplied to `"+componentName+"`, expected one of "+valuesString+"."))}return createChainableTypeChecker(validate)}function createObjectOfTypeChecker(typeChecker){function validate(props,propName,componentName,location,propFullName){if(typeof typeChecker!=="function"){return new PropTypeError("Property `"+propFullName+"` of component `"+componentName+"` has invalid PropType notation inside objectOf.")}var propValue=props[propName];var propType=getPropType(propValue);if(propType!=="object"){return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type "+("`"+propType+"` supplied to `"+componentName+"`, expected an object."))}for(var key in propValue){if(propValue.hasOwnProperty(key)){var error=typeChecker(propValue,key,componentName,location,propFullName+"."+key,ReactPropTypesSecret);if(error instanceof Error){return error}}}return null}return createChainableTypeChecker(validate)}function createUnionTypeChecker(arrayOfTypeCheckers){if(!Array.isArray(arrayOfTypeCheckers)){process.env.NODE_ENV!=="production"?printWarning("Invalid argument supplied to oneOfType, expected an instance of array."):void 0;return emptyFunctionThatReturnsNull}for(var i=0;i<arrayOfTypeCheckers.length;i++){var checker=arrayOfTypeCheckers[i];if(typeof checker!=="function"){printWarning("Invalid argument supplied to oneOfType. Expected an array of check functions, but "+"received "+getPostfixForTypeWarning(checker)+" at index "+i+".");return emptyFunctionThatReturnsNull}}function validate(props,propName,componentName,location,propFullName){for(var i=0;i<arrayOfTypeCheckers.length;i++){var checker=arrayOfTypeCheckers[i];if(checker(props,propName,componentName,location,propFullName,ReactPropTypesSecret)==null){return null}}return new PropTypeError("Invalid "+location+" `"+propFullName+"` supplied to "+("`"+componentName+"`."))}return createChainableTypeChecker(validate)}function createNodeChecker(){function validate(props,propName,componentName,location,propFullName){if(!isNode(props[propName])){return new PropTypeError("Invalid "+location+" `"+propFullName+"` supplied to "+("`"+componentName+"`, expected a ReactNode."))}return null}return createChainableTypeChecker(validate)}function createShapeTypeChecker(shapeTypes){function validate(props,propName,componentName,location,propFullName){var propValue=props[propName];var propType=getPropType(propValue);if(propType!=="object"){return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+propType+"` "+("supplied to `"+componentName+"`, expected `object`."))}for(var key in shapeTypes){var checker=shapeTypes[key];if(!checker){continue}var error=checker(propValue,key,componentName,location,propFullName+"."+key,ReactPropTypesSecret);if(error){return error}}return null}return createChainableTypeChecker(validate)}function createStrictShapeTypeChecker(shapeTypes){function validate(props,propName,componentName,location,propFullName){var propValue=props[propName];var propType=getPropType(propValue);if(propType!=="object"){return new PropTypeError("Invalid "+location+" `"+propFullName+"` of type `"+propType+"` "+("supplied to `"+componentName+"`, expected `object`."))}var allKeys=assign({},props[propName],shapeTypes);for(var key in allKeys){var checker=shapeTypes[key];if(!checker){return new PropTypeError("Invalid "+location+" `"+propFullName+"` key `"+key+"` supplied to `"+componentName+"`."+"\nBad object: "+JSON.stringify(props[propName],null," ")+"\nValid keys: "+JSON.stringify(Object.keys(shapeTypes),null," "))}var error=checker(propValue,key,componentName,location,propFullName+"."+key,ReactPropTypesSecret);if(error){return error}}return null}return createChainableTypeChecker(validate)}function isNode(propValue){switch(typeof propValue){case"number":case"string":case"undefined":return true;case"boolean":return!propValue;case"object":if(Array.isArray(propValue)){return propValue.every(isNode)}if(propValue===null||isValidElement(propValue)){return true}var iteratorFn=getIteratorFn(propValue);if(iteratorFn){var iterator=iteratorFn.call(propValue);var step;if(iteratorFn!==propValue.entries){while(!(step=iterator.next()).done){if(!isNode(step.value)){return false}}}else{while(!(step=iterator.next()).done){var entry=step.value;if(entry){if(!isNode(entry[1])){return false}}}}}else{return false}return true;default:return false}}function isSymbol(propType,propValue){if(propType==="symbol"){return true}if(propValue["@@toStringTag"]==="Symbol"){return true}if(typeof Symbol==="function"&&propValue instanceof Symbol){return true}return false}function getPropType(propValue){var propType=typeof propValue;if(Array.isArray(propValue)){return"array"}if(propValue instanceof RegExp){return"object"}if(isSymbol(propType,propValue)){return"symbol"}return propType}function getPreciseType(propValue){if(typeof propValue==="undefined"||propValue===null){return""+propValue}var propType=getPropType(propValue);if(propType==="object"){if(propValue instanceof Date){return"date"}else if(propValue instanceof RegExp){return"regexp"}}return propType}function getPostfixForTypeWarning(value){var type=getPreciseType(value);switch(type){case"array":case"object":return"an "+type;case"boolean":case"date":case"regexp":return"a "+type;default:return type}}function getClassName(propValue){if(!propValue.constructor||!propValue.constructor.name){return ANONYMOUS}return propValue.constructor.name}ReactPropTypes.checkPropTypes=checkPropTypes;ReactPropTypes.PropTypes=ReactPropTypes;return ReactPropTypes}}).call(this,require("_process"))},{"./checkPropTypes":10,"./lib/ReactPropTypesSecret":14,_process:2,"object-assign":15}],13:[function(require,module,exports){(function(process){if(process.env.NODE_ENV!=="production"){var REACT_ELEMENT_TYPE=typeof Symbol==="function"&&Symbol.for&&Symbol.for("react.element")||60103;var isValidElement=function(object){return typeof object==="object"&&object!==null&&object.$$typeof===REACT_ELEMENT_TYPE};var throwOnDirectAccess=true;module.exports=require("./factoryWithTypeCheckers")(isValidElement,throwOnDirectAccess)}else{module.exports=require("./factoryWithThrowingShims")()}}).call(this,require("_process"))},{"./factoryWithThrowingShims":11,"./factoryWithTypeCheckers":12,_process:2}],14:[function(require,module,exports){"use strict";var ReactPropTypesSecret="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";module.exports=ReactPropTypesSecret},{}],15:[function(require,module,exports){arguments[4][9][0].apply(exports,arguments)},{dup:9}],16:[function(require,module,exports){(function(global){"use strict";var React=typeof window!=="undefined"?window["React"]:typeof global!=="undefined"?global["React"]:null;var ReactDOM=typeof window!=="undefined"?window["ReactDOM"]:typeof global!=="undefined"?global["ReactDOM"]:null;var PropTypes=require("prop-types");var createReactClass=require("create-react-class");var isVisibleWithOffset=require("./lib/is-visible-with-offset");function normalizeRect(rect){if(rect.width===undefined){rect.width=rect.right-rect.left}if(rect.height===undefined){rect.height=rect.bottom-rect.top}return rect}module.exports=createReactClass({displayName:"VisibilitySensor",propTypes:{onChange:PropTypes.func,active:PropTypes.bool,partialVisibility:PropTypes.oneOfType([PropTypes.bool,PropTypes.oneOf(["top","right","bottom","left"])]),delayedCall:PropTypes.bool,offset:PropTypes.oneOfType([PropTypes.shape({top:PropTypes.number,left:PropTypes.number,bottom:PropTypes.number,right:PropTypes.number}),PropTypes.shape({direction:PropTypes.oneOf(["top","right","bottom","left"]),value:PropTypes.number})]),scrollCheck:PropTypes.bool,scrollDelay:PropTypes.number,scrollThrottle:PropTypes.number,resizeCheck:PropTypes.bool,resizeDelay:PropTypes.number,resizeThrottle:PropTypes.number,intervalCheck:PropTypes.bool,intervalDelay:PropTypes.number,containment:typeof window!=="undefined"?PropTypes.instanceOf(window.Element):PropTypes.any,children:PropTypes.oneOfType([PropTypes.element,PropTypes.func]),minTopValue:PropTypes.number},getDefaultProps:function(){return{active:true,partialVisibility:false,minTopValue:0,scrollCheck:false,scrollDelay:250,scrollThrottle:-1,resizeCheck:false,resizeDelay:250,resizeThrottle:-1,intervalCheck:true,intervalDelay:100,delayedCall:false,offset:{},containment:null,children:React.createElement("span")}},getInitialState:function(){return{isVisible:null,visibilityRect:{}}},componentDidMount:function(){this.node=ReactDOM.findDOMNode(this);if(this.props.active){this.startWatching()}},componentWillUnmount:function(){this.stopWatching()},componentDidUpdate:function(prevProps){this.node=ReactDOM.findDOMNode(this);if(this.props.active&&!prevProps.active){this.setState(this.getInitialState());this.startWatching()}else if(!this.props.active){this.stopWatching()}},getContainer:function(){return this.props.containment||window},addEventListener:function(target,event,delay,throttle){if(!this.debounceCheck){this.debounceCheck={}}var timeout;var func;var later=function(){timeout=null;this.check()}.bind(this);if(throttle>-1){func=function(){if(!timeout){timeout=setTimeout(later,throttle||0)}}}else{func=function(){clearTimeout(timeout);timeout=setTimeout(later,delay||0)}}var info={target:target,fn:func,getLastTimeout:function(){return timeout}};target.addEventListener(event,info.fn);this.debounceCheck[event]=info},startWatching:function(){if(this.debounceCheck||this.interval){return}if(this.props.intervalCheck){this.interval=setInterval(this.check,this.props.intervalDelay)}if(this.props.scrollCheck){this.addEventListener(this.getContainer(),"scroll",this.props.scrollDelay,this.props.scrollThrottle)}if(this.props.resizeCheck){this.addEventListener(window,"resize",this.props.resizeDelay,this.props.resizeThrottle)}!this.props.delayedCall&&this.check()},stopWatching:function(){if(this.debounceCheck){for(var debounceEvent in this.debounceCheck){if(this.debounceCheck.hasOwnProperty(debounceEvent)){var debounceInfo=this.debounceCheck[debounceEvent];clearTimeout(debounceInfo.getLastTimeout());debounceInfo.target.removeEventListener(debounceEvent,debounceInfo.fn);this.debounceCheck[debounceEvent]=null}}}this.debounceCheck=null;if(this.interval){this.interval=clearInterval(this.interval)}},roundRectDown:function(rect){return{top:Math.floor(rect.top),left:Math.floor(rect.left),bottom:Math.floor(rect.bottom),right:Math.floor(rect.right)}},check:function(){var el=this.node;var rect;var containmentRect;if(!el){return this.state}rect=normalizeRect(this.roundRectDown(el.getBoundingClientRect()));if(this.props.containment){var containmentDOMRect=this.props.containment.getBoundingClientRect();containmentRect={top:containmentDOMRect.top,left:containmentDOMRect.left,bottom:containmentDOMRect.bottom,right:containmentDOMRect.right}}else{containmentRect={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth}}var offset=this.props.offset||{};var hasValidOffset=typeof offset==="object";if(hasValidOffset){containmentRect.top+=offset.top||0;containmentRect.left+=offset.left||0;containmentRect.bottom-=offset.bottom||0;containmentRect.right-=offset.right||0}var visibilityRect={top:rect.top>=containmentRect.top,left:rect.left>=containmentRect.left,bottom:rect.bottom<=containmentRect.bottom,right:rect.right<=containmentRect.right};var hasSize=rect.height>0&&rect.width>0;var isVisible=hasSize&&visibilityRect.top&&visibilityRect.left&&visibilityRect.bottom&&visibilityRect.right;if(hasSize&&this.props.partialVisibility){var partialVisible=rect.top<=containmentRect.bottom&&rect.bottom>=containmentRect.top&&rect.left<=containmentRect.right&&rect.right>=containmentRect.left;if(typeof this.props.partialVisibility==="string"){partialVisible=visibilityRect[this.props.partialVisibility]}isVisible=this.props.minTopValue?partialVisible&&rect.top<=containmentRect.bottom-this.props.minTopValue:partialVisible}if(typeof offset.direction==="string"&&typeof offset.value==="number"){console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",offset.direction,offset.value);isVisible=isVisibleWithOffset(offset,rect,containmentRect)}var state=this.state;if(this.state.isVisible!==isVisible){state={isVisible:isVisible,visibilityRect:visibilityRect};this.setState(state);if(this.props.onChange)this.props.onChange(isVisible,visibilityRect)}return state},render:function(){if(this.props.children instanceof Function){return this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect})}return React.Children.only(this.props.children)}})}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./lib/is-visible-with-offset":1,"create-react-class":4,"prop-types":13}]},{},[16])(16)});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports["react-visibility-sensor"]=t(require("react"),require("react-dom")):e["react-visibility-sensor"]=t(e.React,e.ReactDOM)}(window,function(e,t){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)o.d(n,r,function(t){return e[t]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=0)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),i=c(o(1)),l=c(o(2)),a=c(o(3)),u=c(o(6));function c(e){return e&&e.__esModule?e:{default:e}}var f=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o.displayName="VisibilitySensor",o.getContainer=function(){return o.props.containment||window},o.addEventListener=function(e,t,n,r){o.debounceCheck||(o.debounceCheck={});var i=void 0,l=function(){i=null,o.check()},a={target:e,fn:r>-1?function(){i||(i=setTimeout(l,r||0))}:function(){clearTimeout(i),i=setTimeout(l,n||0)},getLastTimeout:function(){return i}};e.addEventListener(t,a.fn),o.debounceCheck[t]=a},o.startWatching=function(){o.debounceCheck||o.interval||(o.props.intervalCheck&&(o.interval=setInterval(o.check,o.props.intervalDelay)),o.props.scrollCheck&&o.addEventListener(o.getContainer(),"scroll",o.props.scrollDelay,o.props.scrollThrottle),o.props.resizeCheck&&o.addEventListener(window,"resize",o.props.resizeDelay,o.props.resizeThrottle),!o.props.delayedCall&&o.check())},o.stopWatching=function(){if(o.debounceCheck)for(var e in o.debounceCheck)if(o.debounceCheck.hasOwnProperty(e)){var t=o.debounceCheck[e];clearTimeout(t.getLastTimeout()),t.target.removeEventListener(e,t.fn),o.debounceCheck[e]=null}o.debounceCheck=null,o.interval&&(o.interval=clearInterval(o.interval))},o.check=function(){var e,t=o.node,r=void 0;if(!t)return o.state;if(e=function(e){return void 0===e.width&&(e.width=e.right-e.left),void 0===e.height&&(e.height=e.bottom-e.top),e}(o.roundRectDown(t.getBoundingClientRect())),o.props.containment){var i=o.props.containment.getBoundingClientRect();r={top:i.top,left:i.left,bottom:i.bottom,right:i.right}}else r={top:0,left:0,bottom:window.innerHeight||document.documentElement.clientHeight,right:window.innerWidth||document.documentElement.clientWidth};var l=o.props.offset||{};"object"===(void 0===l?"undefined":n(l))&&(r.top+=l.top||0,r.left+=l.left||0,r.bottom-=l.bottom||0,r.right-=l.right||0);var a={top:e.top>=r.top,left:e.left>=r.left,bottom:e.bottom<=r.bottom,right:e.right<=r.right},c=e.height>0&&e.width>0,f=c&&a.top&&a.left&&a.bottom&&a.right;if(c&&o.props.partialVisibility){var s=e.top<=r.bottom&&e.bottom>=r.top&&e.left<=r.right&&e.right>=r.left;"string"==typeof o.props.partialVisibility&&(s=a[o.props.partialVisibility]),f=o.props.minTopValue?s&&e.top<=r.bottom-o.props.minTopValue:s}"string"==typeof l.direction&&"number"==typeof l.value&&(console.warn("[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }",l.direction,l.value),f=(0,u.default)(l,e,r));var p=o.state;return o.state.isVisible!==f&&(p={isVisible:f,visibilityRect:a},o.setState(p),o.props.onChange&&o.props.onChange(f)),p},o.state={isVisible:null,visibilityRect:{}},o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,i.default.Component),r(t,[{key:"componentDidMount",value:function(){this.node=l.default.findDOMNode(this),this.props.active&&this.startWatching()}},{key:"componentWillUnmount",value:function(){this.stopWatching()}},{key:"componentDidUpdate",value:function(e){this.node=l.default.findDOMNode(this),this.props.active&&!e.active?(this.setState({isVisible:null,visibilityRect:{}}),this.startWatching()):this.props.active||this.stopWatching()}},{key:"roundRectDown",value:function(e){return{top:Math.floor(e.top),left:Math.floor(e.left),bottom:Math.floor(e.bottom),right:Math.floor(e.right)}}},{key:"render",value:function(){return this.props.children instanceof Function?this.props.children({isVisible:this.state.isVisible,visibilityRect:this.state.visibilityRect}):i.default.Children.only(this.props.children)}}]),t}();f.defaultProps={active:!0,partialVisibility:!1,minTopValue:0,scrollCheck:!1,scrollDelay:250,scrollThrottle:-1,resizeCheck:!1,resizeDelay:250,resizeThrottle:-1,intervalCheck:!0,intervalDelay:100,delayedCall:!1,offset:{},containment:null,children:i.default.createElement("span",null)},f.propTypes={onChange:a.default.func,active:a.default.bool,partialVisibility:a.default.oneOfType([a.default.bool,a.default.oneOf(["top","right","bottom","left"])]),delayedCall:a.default.bool,offset:a.default.oneOfType([a.default.shape({top:a.default.number,left:a.default.number,bottom:a.default.number,right:a.default.number}),a.default.shape({direction:a.default.oneOf(["top","right","bottom","left"]),value:a.default.number})]),scrollCheck:a.default.bool,scrollDelay:a.default.number,scrollThrottle:a.default.number,resizeCheck:a.default.bool,resizeDelay:a.default.number,resizeThrottle:a.default.number,intervalCheck:a.default.bool,intervalDelay:a.default.number,containment:"undefined"!=typeof window?a.default.instanceOf(window.Element):a.default.any,children:a.default.oneOfType([a.default.element,a.default.func]),minTopValue:a.default.number},t.default=f},function(t,o){t.exports=e},function(e,o){e.exports=t},function(e,t,o){e.exports=o(4)()},function(e,t,o){"use strict";var n=o(5);function r(){}e.exports=function(){function e(e,t,o,r,i,l){if(l!==n){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var o={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t};return o.checkPropTypes=r,o.PropTypes=o,o}},function(e,t,o){"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(e,t,o){"use strict";e.exports=function(e,t,o){var n=e.direction,r=e.value;switch(n){case"top":return o.top+r<t.top&&o.bottom>t.bottom&&o.left<t.left&&o.right>t.right;case"left":return o.left+r<t.left&&o.bottom>t.bottom&&o.top<t.top&&o.right>t.right;case"bottom":return o.bottom-r>t.bottom&&o.left<t.left&&o.right>t.right&&o.top<t.top;case"right":return o.right-r>t.right&&o.left<t.left&&o.top<t.top&&o.bottom>t.bottom}}}])});
'use strict';
var Example = React.createClass({
getInitialState: function () {
return { msg: '' };
},
class Example extends React.Component {
constructor(props) {
super(props);
this.state = {
msg: ''
};
onChange: function (isVisible) {
this.onChange = this.onChange.bind(this);
}
onChange(isVisible) {
this.setState({
msg: 'Element is now ' + (isVisible ? 'visible' : 'hidden')
});
},
}
render: function () {
render() {
return (

@@ -20,7 +25,7 @@ React.createElement("div", null,

React.createElement(VisibilitySensor, {
containment: this.props.containment,
onChange: this.onChange,
minTopValue: this.props.minTopValue,
partialVisibility: this.props.partialVisibility
},
containment: this.props.containment,
onChange: this.onChange,
minTopValue: this.props.minTopValue,
partialVisibility: this.props.partialVisibility
},
React.createElement("div", {className: "sensor"})

@@ -30,5 +35,5 @@ ),

)
);
)
}
});
}

@@ -35,0 +40,0 @@ ReactDOM.render(React.createElement(Example), document.getElementById('example'));

'use strict';
var React = require('react');
var ReactDOM = require('react-dom')
var createReactClass = require('create-react-class')
var VisibilitySensor = require('../');
import React from 'react';
import ReactDOM from 'react-dom';
import VisibilitySensor from '../visibility-sensor';
var Example = createReactClass({
getInitialState: function () {
return { msg: '' };
},
class Example extends React.Component {
onChange: function (isVisible) {
constructor(props) {
super(props);
this.state = {
msg: ''
};
}
onChange = (isVisible) => {
this.setState({
msg: 'Element is now ' + (isVisible ? 'visible' : 'hidden')
});
},
}
render: function () {
render() {
return (

@@ -37,5 +41,5 @@ <div>

</div>
);
)
}
});
}

@@ -46,4 +50,6 @@ ReactDOM.render(React.createElement(Example), document.getElementById('example'));

var elem = container.querySelector('.inner');
container.scrollTop = 320;
container.scrollLeft = 320;
ReactDOM.render(React.createElement(Example, {

@@ -50,0 +56,0 @@ containment: container,

{
"name": "react-visibility-sensor",
"version": "4.1.3",
"version": "5.0.0",
"description": "Sensor component for React that notifies you when it goes in or out of the window viewport.",

@@ -9,9 +9,7 @@ "main": "visibility-sensor.js",

"prebuild": "npm run clean",
"build-umd": "browserify -u react -u react-dom -t browserify-shim --standalone VisibilitySensor -o dist/visibility-sensor.js visibility-sensor.js",
"build-minify": "uglifyjs -o dist/visibility-sensor.min.js dist/visibility-sensor.js",
"build": "npm run build-umd && npm run build-minify",
"build-example": "mkdir -p example/dist && browserify -t reactify -o example/dist/bundle.js example/main.js",
"build-test": "browserify -t reactify -o tests/bundle.js tests/visibility-sensor-spec.jsx",
"build": "webpack --env=production",
"build-example": "rm -rf example/dist && webpack --env=example",
"build-test": "webpack --env=test",
"publish-gh-pages": "npm run build-example && ./bin/publish-gh-pages",
"test": "npm run build-test && ./node_modules/karma/bin/karma start --single-run",
"test": "npm run build-test && karma start --single-run",
"prepublishOnly": "npm run build"

@@ -31,7 +29,9 @@ },

"devDependencies": {
"browserify": "^16.2.2",
"browserify-shim": "^3.8.14",
"es5-shim": "^4.5.10",
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-preset-env": "^1.7.0",
"babel-preset-react": "^6.24.1",
"gh-pages": "^1.2.0",
"karma": "^3.0.0",
"karma": "^2.0.5",
"karma-chrome-launcher": "^2.2.0",

@@ -43,4 +43,6 @@ "karma-mocha": "^1.3.0",

"react-dom": "^16.4.2",
"reactify": "^1.1.1",
"uglify-js": "^3.4.6"
"uglify-js": "^3.4.6",
"uglifyjs-webpack-plugin": "^1.2.7",
"webpack": "^4.16.4",
"webpack-cli": "^3.1.0"
},

@@ -51,6 +53,2 @@ "repository": {

},
"browserify-shim": {
"react": "global:React",
"react-dom": "global:ReactDOM"
},
"dependencies": {

@@ -57,0 +55,0 @@ "create-react-class": "^15.6.3",

@@ -21,4 +21,4 @@ React Visibility Sensor

- Plain: <https://unpkg.com/react-visibility-sensor@3.4.0/dist/visibility-sensor.js>
- Minified <https://unpkg.com/react-visibility-sensor@3.4.0/dist/visibility-sensor.min.js>
- Plain: <https://unpkg.com/react-visibility-sensor@5.0.0/dist/visibility-sensor.js>
- Minified <https://unpkg.com/react-visibility-sensor@5.0.0/dist/visibility-sensor.min.js>

@@ -98,25 +98,4 @@ Take a look at the [umd example](./example-umd/) to see this in action

Special thanks to contributors:
Special thanks to [contributors](https://github.com/joshwnj/react-visibility-sensor/graphs/contributors)
- Andrew Hong
- Oleg Slobodskoi
- EugeneHlushko
- Stefan B
- Radu-Sebastian Amarie
- Roope Merikukka
- Christian Davis
- Anton Fedchenko
- Mateusz Burzyński
- Zak Linder
- Andarist
- Andy Edwards
- Bram Schulting
- Dan Abramov
- Daniel Stefanovic
- Eric Bower
- Julien Bachmann
- Neehar Venugopal
- Rubens Mariuzzo
- Tim Tyrrell
License

@@ -123,0 +102,0 @@ ----

@@ -1,9 +0,6 @@

/** @jsx React.DOM */
import React from 'react';
import ReactDOM from 'react-dom';
import assert from 'assert';
import VisibilitySensor from '../visibility-sensor';
require('es5-shim');
var React = require('react');
var ReactDOM = require('react-dom');
var assert = require('assert');
describe('VisibilitySensor', function () {

@@ -22,4 +19,2 @@ var node;

var VisibilitySensor = require('../visibility-sensor.js');
it('should notify of changes to visibility when parent moves', function (done) {

@@ -89,3 +84,3 @@ var firstTime = true;

assert.equal(isVisible, true, 'Component starts out visible');
style = {
const style = {
position: 'absolute',

@@ -92,0 +87,0 @@ width: 100,

'use strict';
var React = require('react');
var ReactDOM = require('react-dom');
var PropTypes = require('prop-types');
var createReactClass = require('create-react-class');
var isVisibleWithOffset = require('./lib/is-visible-with-offset')
import React from 'react';
import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import isVisibleWithOffset from './lib/is-visible-with-offset';

@@ -21,6 +20,26 @@ function normalizeRect (rect) {

module.exports = createReactClass({
displayName: 'VisibilitySensor',
//let containmentPropType = typeof window !== 'undefined' ? PropTypes.instanceOf(window.Element) : PropTypes.any;
propTypes: {
export default class VisibilitySensor extends React.Component {
displayName = 'VisibilitySensor';
static defaultProps = {
active: true,
partialVisibility: false,
minTopValue: 0,
scrollCheck: false,
scrollDelay: 250,
scrollThrottle: -1,
resizeCheck: false,
resizeDelay: 250,
resizeThrottle: -1,
intervalCheck: true,
intervalDelay: 100,
delayedCall: false,
offset: {},
containment: null,
children: <span />
};
static propTypes = {
onChange: PropTypes.func,

@@ -60,32 +79,14 @@ active: PropTypes.bool,

minTopValue: PropTypes.number,
},
}
getDefaultProps: function () {
return {
active: true,
partialVisibility: false,
minTopValue: 0,
scrollCheck: false,
scrollDelay: 250,
scrollThrottle: -1,
resizeCheck: false,
resizeDelay: 250,
resizeThrottle: -1,
intervalCheck: true,
intervalDelay: 100,
delayedCall: false,
offset: {},
containment: null,
children: React.createElement('span')
};
},
constructor(props) {
super(props);
getInitialState: function () {
return {
this.state = {
isVisible: null,
visibilityRect: {}
};
},
}
componentDidMount: function () {
componentDidMount() {
this.node = ReactDOM.findDOMNode(this);

@@ -95,9 +96,9 @@ if (this.props.active) {

}
},
}
componentWillUnmount: function () {
componentWillUnmount() {
this.stopWatching();
},
}
componentDidUpdate: function(prevProps) {
componentDidUpdate(prevProps) {
// re-register node in componentDidUpdate if children diffs [#103]

@@ -107,3 +108,7 @@ this.node = ReactDOM.findDOMNode(this);

if (this.props.active && !prevProps.active) {
this.setState(this.getInitialState());
this.setState({
isVisible: null,
visibilityRect: {}
});
this.startWatching();

@@ -113,9 +118,9 @@ } else if (!this.props.active) {

}
},
}
getContainer: function () {
getContainer = () => {
return this.props.containment || window;
},
}
addEventListener: function (target, event, delay, throttle) {
addEventListener = (target, event, delay, throttle) => {
if (!this.debounceCheck) {

@@ -125,12 +130,12 @@ this.debounceCheck = {};

var timeout;
var func;
let timeout;
let func;
var later = function () {
const later = () => {
timeout = null;
this.check();
}.bind(this);
};
if (throttle > -1) {
func = function () {
func = () => {
if (!timeout) {

@@ -141,3 +146,3 @@ timeout = setTimeout(later, throttle || 0);

} else {
func = function () {
func = () => {
clearTimeout(timeout);

@@ -148,6 +153,6 @@ timeout = setTimeout(later, delay || 0);

var info = {
const info = {
target: target,
fn: func,
getLastTimeout: function () {
getLastTimeout: () => {
return timeout;

@@ -159,5 +164,5 @@ },

this.debounceCheck[event] = info;
},
}
startWatching: function () {
startWatching = () => {
if (this.debounceCheck || this.interval) { return; }

@@ -189,10 +194,10 @@

!this.props.delayedCall && this.check();
},
}
stopWatching: function () {
stopWatching = () => {
if (this.debounceCheck) {
// clean up event listeners and their debounce callers
for (var debounceEvent in this.debounceCheck) {
for (let debounceEvent in this.debounceCheck) {
if (this.debounceCheck.hasOwnProperty(debounceEvent)) {
var debounceInfo = this.debounceCheck[debounceEvent];
const debounceInfo = this.debounceCheck[debounceEvent];

@@ -211,5 +216,5 @@ clearTimeout(debounceInfo.getLastTimeout());

if (this.interval) { this.interval = clearInterval(this.interval); }
},
}
roundRectDown: function (rect) {
roundRectDown (rect) {
return {

@@ -221,3 +226,3 @@ top: Math.floor(rect.top),

};
},
}

@@ -227,6 +232,7 @@ /**

*/
check: function () {
var el = this.node;
var rect;
var containmentRect;
check = () => {
const el = this.node;
let rect;
let containmentRect;
// if the component has rendered to null, dont update visibility

@@ -240,3 +246,3 @@ if (!el) {

if (this.props.containment) {
var containmentDOMRect = this.props.containment.getBoundingClientRect();
const containmentDOMRect = this.props.containment.getBoundingClientRect();
containmentRect = {

@@ -258,4 +264,5 @@ top: containmentDOMRect.top,

// Check if visibility is wanted via offset?
var offset = this.props.offset || {};
var hasValidOffset = typeof offset === 'object';
const offset = this.props.offset || {};
const hasValidOffset = typeof offset === 'object';
if (hasValidOffset) {

@@ -268,3 +275,3 @@ containmentRect.top += offset.top || 0;

var visibilityRect = {
const visibilityRect = {
top: rect.top >= containmentRect.top,

@@ -276,5 +283,6 @@ left: rect.left >= containmentRect.left,

var hasSize = rect.height > 0 && rect.width > 0;
// https://github.com/joshwnj/react-visibility-sensor/pull/114
const hasSize = rect.height > 0 && rect.width > 0;
var isVisible = (
let isVisible = (
hasSize &&

@@ -289,3 +297,3 @@ visibilityRect.top &&

if (hasSize && this.props.partialVisibility) {
var partialVisible =
let partialVisible =
rect.top <= containmentRect.bottom && rect.bottom >= containmentRect.top &&

@@ -308,3 +316,3 @@ rect.left <= containmentRect.right && rect.right >= containmentRect.left;

if (typeof offset.direction === 'string' &&
typeof offset.value === 'number') {
typeof offset.value === 'number') {
console.warn('[notice] offset.direction and offset.value have been deprecated. They still work for now, but will be removed in next major version. Please upgrade to the new syntax: { %s: %d }', offset.direction, offset.value)

@@ -315,3 +323,3 @@

var state = this.state;
let state = this.state;
// notify the parent when the value changes

@@ -324,9 +332,9 @@ if (this.state.isVisible !== isVisible) {

this.setState(state);
if (this.props.onChange) this.props.onChange(isVisible, visibilityRect);
if (this.props.onChange) this.props.onChange(isVisible);
}
return state;
},
}
render: function () {
render() {
if (this.props.children instanceof Function) {

@@ -340,2 +348,2 @@ return this.props.children({

}
});
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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