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

react-measure

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-measure - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

2

bower.json
{
"name": "react-measure",
"version": "0.4.0",
"version": "0.4.1",
"homepage": "https://github.com/souporserious/react-measure",

@@ -5,0 +5,0 @@ "authors": [

## CHANGELOG
### 0.4.1
Fixed dist build
Updated to latest element-resize-detector
### 0.4.0

@@ -3,0 +8,0 @@

(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("React"), require("ReactDOM"), require("createResizeDetector"));
module.exports = factory(require("React"), require("ReactDOM"), require("elementResizeDetectorMaker"));
else if(typeof define === 'function' && define.amd)
define(["React", "ReactDOM", "createResizeDetector"], factory);
define(["React", "ReactDOM", "elementResizeDetectorMaker"], factory);
else if(typeof exports === 'object')
exports["Measure"] = factory(require("React"), require("ReactDOM"), require("createResizeDetector"));
exports["Measure"] = factory(require("React"), require("ReactDOM"), require("elementResizeDetectorMaker"));
else
root["Measure"] = factory(root["React"], root["ReactDOM"], root["createResizeDetector"]);
root["Measure"] = factory(root["React"], root["ReactDOM"], root["elementResizeDetectorMaker"]);
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__, __WEBPACK_EXTERNAL_MODULE_3__, __WEBPACK_EXTERNAL_MODULE_5__) {

@@ -11,0 +11,0 @@ return /******/ (function(modules) { // webpackBootstrap

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM"),require("createResizeDetector")):"function"==typeof define&&define.amd?define(["React","ReactDOM","createResizeDetector"],t):"object"==typeof exports?exports.Measure=t(require("React"),require("ReactDOM"),require("createResizeDetector")):e.Measure=t(e.React,e.ReactDOM,e.createResizeDetector)}(this,function(e,t,r){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="dist/",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),i=o(n);t["default"]=i["default"],e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,i=t,u=r;s=l=a=void 0,o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,i);if(void 0!==s){if("value"in s)return s.value;var a=s.get;return void 0===a?void 0:a.call(u)}var l=Object.getPrototypeOf(n);if(null===l)return void 0;e=l,t=i,r=u,o=!0}},a=r(2),l=(o(a),r(3)),c=o(l),f=r(4),p=o(f),d=r(6),h=o(d),Measure=function(e){function Measure(){var e=this;n(this,Measure),s(Object.getPrototypeOf(Measure.prototype),"constructor",this).apply(this,arguments),this.state={dimensions:{}},this._node=null,this._propsToMeasure=this._getPropsToMeasure(this.props),this._lastDimensions={},this.measure=function(){var t=arguments.length<=0||void 0===arguments[0]?e.props.accurate:arguments[0];if(e.props.shouldMeasure){var r=e.getDimensions(e._node,t),o="function"==typeof e.props.children;e._propsToMeasure.some(function(t){return r[t]!==e._lastDimensions[t]?(e.props.onMeasure(r),o&&e.setState({dimensions:r}),e._lastDimensions=r,!0):void 0})}}}return i(Measure,e),u(Measure,[{key:"componentDidMount",value:function(){var e=this;this._node=c["default"].findDOMNode(this),this.measure(),p["default"]().listenTo(this._node,function(){return e.measure()})}},{key:"componentWillReceiveProps",value:function(e){var t=(e.config,e.whitelist),r=e.blacklist;(this.props.whitelist!==t||this.props.blacklist!==r)&&(this._propsToMeasure=this._getPropsToMeasure({whitelist:t,blacklist:r}))}},{key:"componentWillUnmount",value:function(){p["default"]().removeAllListeners(this._node)}},{key:"getDimensions",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this._node:arguments[0],t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];return h["default"](e,t)}},{key:"_getPropsToMeasure",value:function(e){var t=e.whitelist,r=e.blacklist;return t.filter(function(e){return r.indexOf(e)<0})}},{key:"render",value:function(){var e=this.props.children;return a.Children.only("function"==typeof e?e(this.state.dimensions):e)}}],[{key:"propTypes",value:{accurate:a.PropTypes.bool,whitelist:a.PropTypes.array,blacklist:a.PropTypes.array,shouldMeasure:a.PropTypes.bool,onMeasure:a.PropTypes.func},enumerable:!0},{key:"defaultProps",value:{accurate:!1,whitelist:["width","height","top","right","bottom","left"],blacklist:[],shouldMeasure:!0,onMeasure:function(){return null}},enumerable:!0}]),Measure}(a.Component);t["default"]=Measure,e.exports=t["default"]},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(){return s||(s=u["default"]({strategy:"scroll"})),s}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var i=r(5),u=o(i),s=null;e.exports=t["default"]},function(e,t){e.exports=r},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e){var t=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],r=e.getBoundingClientRect(),o=r.width,n=r.height;if(t){var i=u["default"](e);o=i.width,n=i.height}return{width:o,height:n,top:r.top,right:r.right,bottom:r.bottom,left:r.left}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var i=r(7),u=o(i);e.exports=t["default"]},function(e,t){"use strict";function r(e){var t=e.parentNode,r=document.createElement("div"),o=e.cloneNode(!0),n=0,i=0;return r.style.height=0,r.style.position="relative",r.style.overflow="hidden",o.setAttribute("id",""),o.setAttribute("name",""),o.style.height="auto",o.style.position="absolute",o.style.visibility="hidden",r.appendChild(o),t.appendChild(r),n=o.scrollWidth,i=o.scrollHeight,t.removeChild(r),{width:n,height:i}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r,e.exports=t["default"]}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM"),require("elementResizeDetectorMaker")):"function"==typeof define&&define.amd?define(["React","ReactDOM","elementResizeDetectorMaker"],t):"object"==typeof exports?exports.Measure=t(require("React"),require("ReactDOM"),require("elementResizeDetectorMaker")):e.Measure=t(e.React,e.ReactDOM,e.elementResizeDetectorMaker)}(this,function(e,t,r){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="dist/",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(1),i=o(n);t["default"]=i["default"],e.exports=t["default"]},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(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)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}(),s=function(e,t,r){for(var o=!0;o;){var n=e,i=t,u=r;s=l=a=void 0,o=!1,null===n&&(n=Function.prototype);var s=Object.getOwnPropertyDescriptor(n,i);if(void 0!==s){if("value"in s)return s.value;var a=s.get;return void 0===a?void 0:a.call(u)}var l=Object.getPrototypeOf(n);if(null===l)return void 0;e=l,t=i,r=u,o=!0}},a=r(2),l=(o(a),r(3)),c=o(l),f=r(4),p=o(f),d=r(6),h=o(d),Measure=function(e){function Measure(){var e=this;n(this,Measure),s(Object.getPrototypeOf(Measure.prototype),"constructor",this).apply(this,arguments),this.state={dimensions:{}},this._node=null,this._propsToMeasure=this._getPropsToMeasure(this.props),this._lastDimensions={},this.measure=function(){var t=arguments.length<=0||void 0===arguments[0]?e.props.accurate:arguments[0];if(e.props.shouldMeasure){var r=e.getDimensions(e._node,t),o="function"==typeof e.props.children;e._propsToMeasure.some(function(t){return r[t]!==e._lastDimensions[t]?(e.props.onMeasure(r),o&&e.setState({dimensions:r}),e._lastDimensions=r,!0):void 0})}}}return i(Measure,e),u(Measure,[{key:"componentDidMount",value:function(){var e=this;this._node=c["default"].findDOMNode(this),this.measure(),p["default"]().listenTo(this._node,function(){return e.measure()})}},{key:"componentWillReceiveProps",value:function(e){var t=(e.config,e.whitelist),r=e.blacklist;(this.props.whitelist!==t||this.props.blacklist!==r)&&(this._propsToMeasure=this._getPropsToMeasure({whitelist:t,blacklist:r}))}},{key:"componentWillUnmount",value:function(){p["default"]().removeAllListeners(this._node)}},{key:"getDimensions",value:function(){var e=arguments.length<=0||void 0===arguments[0]?this._node:arguments[0],t=arguments.length<=1||void 0===arguments[1]?!0:arguments[1];return h["default"](e,t)}},{key:"_getPropsToMeasure",value:function(e){var t=e.whitelist,r=e.blacklist;return t.filter(function(e){return r.indexOf(e)<0})}},{key:"render",value:function(){var e=this.props.children;return a.Children.only("function"==typeof e?e(this.state.dimensions):e)}}],[{key:"propTypes",value:{accurate:a.PropTypes.bool,whitelist:a.PropTypes.array,blacklist:a.PropTypes.array,shouldMeasure:a.PropTypes.bool,onMeasure:a.PropTypes.func},enumerable:!0},{key:"defaultProps",value:{accurate:!1,whitelist:["width","height","top","right","bottom","left"],blacklist:[],shouldMeasure:!0,onMeasure:function(){return null}},enumerable:!0}]),Measure}(a.Component);t["default"]=Measure,e.exports=t["default"]},function(t,r){t.exports=e},function(e,r){e.exports=t},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(){return s||(s=u["default"]({strategy:"scroll"})),s}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var i=r(5),u=o(i),s=null;e.exports=t["default"]},function(e,t){e.exports=r},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e){var t=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],r=e.getBoundingClientRect(),o=r.width,n=r.height;if(t){var i=u["default"](e);o=i.width,n=i.height}return{width:o,height:n,top:r.top,right:r.right,bottom:r.bottom,left:r.left}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var i=r(7),u=o(i);e.exports=t["default"]},function(e,t){"use strict";function r(e){var t=e.parentNode,r=document.createElement("div"),o=e.cloneNode(!0),n=0,i=0;return r.style.height=0,r.style.position="relative",r.style.overflow="hidden",o.setAttribute("id",""),o.setAttribute("name",""),o.style.height="auto",o.style.position="absolute",o.style.visibility="hidden",r.appendChild(o),t.appendChild(r),n=o.scrollWidth,i=o.scrollHeight,t.removeChild(r),{width:n,height:i}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r,e.exports=t["default"]}])});
{
"name": "react-measure",
"version": "0.4.0",
"version": "0.4.1",
"description": "Compute measurements of React components.",

@@ -35,4 +35,8 @@ "main": "lib/react-measure.js",

"homepage": "https://github.com/souporserious/react-measure",
"peerDependencies": {
"react": ">0.13.0",
"react-dom": ">0.13.0"
},
"dependencies": {
"element-resize-detector": "^1.1.4"
"element-resize-detector": "^1.1.5"
},

@@ -48,3 +52,4 @@ "devDependencies": {

"node-sass": "^3.2.0",
"react-addons-shallow-compare": "^0.14.0",
"react": "15.2.1",
"react-dom": "15.2.1",
"react-motion": "^0.4.2",

@@ -55,7 +60,3 @@ "sass-loader": "^1.0.2",

"webpack-dev-server": "^1.9.0"
},
"peerDependencies": {
"react": ">0.13.0",
"react-dom": ">0.13.0"
}
}
## React Measure
[![npm version](https://badge.fury.io/js/react-measure.svg)](https://badge.fury.io/js/react-aria)
[![Dependency Status](https://david-dm.org/souporserious/react-measure.svg)](https://david-dm.org/souporserious/react-measure)
Compute measurements of React components. Uses [element-resize-detector](https://github.com/wnr/element-resize-detector) to detect changes of an element and return the new dimensions.

@@ -25,3 +28,2 @@

<Measure
whitelist={['height']}
onMeasure={(dimensions) => {

@@ -28,0 +30,0 @@ this.setState({dimensions})

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

import createResizeDetector from 'element-resize-detector'
import elementResizeDetectorMaker from 'element-resize-detector'

@@ -7,3 +7,3 @@ let instance = null

if (!instance) {
instance = createResizeDetector({
instance = elementResizeDetectorMaker({
strategy: `scroll`

@@ -10,0 +10,0 @@ })

@@ -29,3 +29,3 @@ var path = require('path');

'react-dom': 'ReactDOM',
'element-resize-detector': 'createResizeDetector'
'element-resize-detector': 'elementResizeDetectorMaker'
},

@@ -32,0 +32,0 @@ };

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