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.3.4 to 0.3.5

2

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

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

## CHANGELOG
### 0.3.5
Fixed bug in IE with accurate height calculation when checking for children nodes.
Fixed [deprecation notice](https://www.chromestatus.com/features/5724912467574784) when calculating SVG dimensions.
Removed `react-addons-shallow-compare` dependency.
Moved `react` and `react-dom` packages into peer dependencies.
### 0.3.4

@@ -7,2 +17,3 @@

### 0.3.3
Added public method `getDimensions`

@@ -15,2 +26,3 @@

### 0.3.2
Patch to fix `shallowCompare` so bower works.

@@ -21,2 +33,3 @@

### 0.3.1
Renamed `onChange` prop to `onMeasure`

@@ -31,2 +44,3 @@

### 0.3.0
Rebuilt from the ground up

@@ -45,8 +59,11 @@

### 0.2.0
Upgraded to React 0.14.0
### 0.1.3
Added `forceAutoHeight` prop to help with proper height calculation when children heights are animating
### 0.1.2
Clone prop now exposed to allow optional cloning of component

@@ -57,2 +74,3 @@

### 0.1.1
Set width/height to auto on clone no matter what to get a true dimension

@@ -65,4 +83,5 @@

### 0.1.0
Rewritten to be more React friendly
Measure component no longer accepts a child function, instead get dimensions by setting state in onChange callback
Measure component no longer accepts a child function, instead get dimensions by setting state in onChange callback

@@ -100,15 +100,11 @@ (function webpackUniversalModuleDefinition(root, factory) {

var _reactAddonsShallowCompare = __webpack_require__(4);
var _ResizeHandler = __webpack_require__(4);
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
var _ResizeHandler = __webpack_require__(7);
var _ResizeHandler2 = _interopRequireDefault(_ResizeHandler);
var _diffConfig = __webpack_require__(10);
var _diffConfig = __webpack_require__(7);
var _diffConfig2 = _interopRequireDefault(_diffConfig);
var _getNodeDimensions = __webpack_require__(11);
var _getNodeDimensions = __webpack_require__(8);

@@ -194,7 +190,2 @@ var _getNodeDimensions2 = _interopRequireDefault(_getNodeDimensions);

}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
}
}, {
key: 'componentWillUnmount',

@@ -294,94 +285,2 @@ value: function componentWillUnmount() {

module.exports = __webpack_require__(5);
/***/ },
/* 5 */
/***/ function(module, exports, __webpack_require__) {
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shallowCompare
*/
'use strict';
var shallowEqual = __webpack_require__(6);
/**
* Does a shallow comparison for props and state.
* See ReactComponentWithPureRenderMixin
*/
function shallowCompare(instance, nextProps, nextState) {
return !shallowEqual(instance.props, nextProps) || !shallowEqual(instance.state, nextState);
}
module.exports = shallowCompare;
/***/ },
/* 6 */
/***/ function(module, exports) {
/**
* Copyright 2013-2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule shallowEqual
* @typechecks
*
*/
'use strict';
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (objA === objB) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
var bHasOwnProperty = hasOwnProperty.bind(objB);
for (var i = 0; i < keysA.length; i++) {
if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) {
return false;
}
}
return true;
}
module.exports = shallowEqual;
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, '__esModule', {

@@ -397,3 +296,3 @@ value: true

var _lodashDebounce = __webpack_require__(8);
var _lodashDebounce = __webpack_require__(5);

@@ -449,3 +348,3 @@ var _lodashDebounce2 = _interopRequireDefault(_lodashDebounce);

/***/ },
/* 8 */
/* 5 */
/***/ function(module, exports, __webpack_require__) {

@@ -463,3 +362,3 @@

var getNative = __webpack_require__(9);
var getNative = __webpack_require__(6);

@@ -690,3 +589,3 @@ /** Used as the `TypeError` message for "Functions" methods. */

/***/ },
/* 9 */
/* 6 */
/***/ function(module, exports) {

@@ -832,3 +731,3 @@

/***/ },
/* 10 */
/* 7 */
/***/ function(module, exports) {

@@ -870,3 +769,3 @@

/***/ },
/* 11 */
/* 8 */
/***/ function(module, exports, __webpack_require__) {

@@ -883,3 +782,3 @@

var _accurateHeight = __webpack_require__(12);
var _accurateHeight = __webpack_require__(9);

@@ -906,3 +805,3 @@ var _accurateHeight2 = _interopRequireDefault(_accurateHeight);

/***/ },
/* 12 */
/* 9 */
/***/ function(module, exports, __webpack_require__) {

@@ -919,7 +818,7 @@

var _dataStore = __webpack_require__(13);
var _dataStore = __webpack_require__(10);
var _dataStore2 = _interopRequireDefault(_dataStore);
var _getCloneHeight = __webpack_require__(14);
var _getCloneHeight = __webpack_require__(11);

@@ -937,6 +836,5 @@ var _getCloneHeight2 = _interopRequireDefault(_getCloneHeight);

var amount = children.length;
// if no children present on the node we need to clone to get a true height
if (amount === 0) {
// if no children present on the node or an SVG element
// we need to clone it to get a true height
if (!children || children && children.length === 0 || node instanceof SVGElement) {
return (0, _getCloneHeight2['default'])(node);

@@ -946,3 +844,3 @@ }

var firstChild = children[0];
var lastChild = children[amount - 1];
var lastChild = children[children.length - 1];

@@ -965,3 +863,3 @@ var _getStyle = getStyle(firstChild);

/***/ },
/* 13 */
/* 10 */
/***/ function(module, exports) {

@@ -1005,3 +903,3 @@

/***/ },
/* 14 */
/* 11 */
/***/ function(module, exports) {

@@ -1008,0 +906,0 @@

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

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("React"),require("ReactDOM")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.Measure=t(require("React"),require("ReactDOM")):e.Measure=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="dist/",t(0)}([function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(1),i=n(o);t["default"]=i["default"],e.exports=t["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=function(e,t,r){for(var n=!0;n;){var o=e,i=t,u=r;s=l=a=void 0,n=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,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(o);if(null===l)return void 0;e=l,t=i,r=u,n=!0}},a=r(2),l=(n(a),r(3)),c=n(l),f=r(4),p=n(f),d=r(7),v=n(d),h=r(10),y=n(h),b=r(11),m=n(b),g=new v["default"],Measure=function(e){function Measure(){var e=this;o(this,Measure),s(Object.getPrototypeOf(Measure.prototype),"constructor",this).apply(this,arguments),this._observer=null,this._node=null,this._properties=this._getProperties(this.props),this._lastDimensions={},this._measure=function(t){var r=e.props.shouldMeasure(t);if(r){var n=e.getDimensions(e._node,e.props.accurate);e._properties.some(function(o){return n[o]!==e._lastDimensions[o]?(e.props.onMeasure(n,t,r),e._lastDimensions=n,!0):void 0})}}}return i(Measure,e),u(Measure,[{key:"componentDidMount",value:function(){this._node=c["default"].findDOMNode(this),this._connectObserver(this.props.config),this._measure(null),g.add(this)}},{key:"componentWillReceiveProps",value:function(e){var t=e.config,r=e.whitelist,n=e.blacklist;y["default"](this.props.config,t)&&(this._disconnectObserver(),this._connectObserver(t)),(this.props.whitelist!==r||this.props.blacklist!==n)&&(this._properties=this._getProperties({whitelist:r,blacklist:n}))}},{key:"shouldComponentUpdate",value:function(e,t){return p["default"](this,e,t)}},{key:"componentWillUnmount",value:function(){this._disconnectObserver(),g.remove(this)}},{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 m["default"](e,t)}},{key:"_connectObserver",value:function(e){this._observer=new MutationObserver(this._measure),this._observer.observe(this._node,e)}},{key:"_disconnectObserver",value:function(){this._observer.disconnect()}},{key:"_getProperties",value:function(e){var t=e.whitelist,r=e.blacklist;return t.filter(function(e){return r.indexOf(e)<0})}},{key:"render",value:function(){return a.Children.only(this.props.children)}}],[{key:"propTypes",value:{config:a.PropTypes.object,accurate:a.PropTypes.bool,whitelist:a.PropTypes.array,blacklist:a.PropTypes.array,shouldMeasure:a.PropTypes.func,onMeasure:a.PropTypes.func},enumerable:!0},{key:"defaultProps",value:{config:{childList:!0,attributes:!0},accurate:!1,whitelist:["width","height","top","right","bottom","left"],blacklist:[],shouldMeasure:function(){return!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";e.exports=r(5)},function(e,t,r){"use strict";function n(e,t,r){return!o(e.props,t)||!o(e.state,r)}var o=r(6);e.exports=n},function(e,t){"use strict";function r(e,t){if(e===t)return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t)return!1;var r=Object.keys(e),o=Object.keys(t);if(r.length!==o.length)return!1;for(var i=n.bind(t),u=0;u<r.length;u++)if(!i(r[u])||e[r[u]]!==t[r[u]])return!1;return!0}var n=Object.prototype.hasOwnProperty;e.exports=r},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),u=r(8),s=n(u),a=function(){function e(){o(this,e),this._queue=[],this.update=s["default"](this.update.bind(this),150),"undefined"!=typeof window&&window.addEventListener("resize",this.update)}return i(e,[{key:"destroy",value:function(){"undefined"!=typeof window&&window.removeEventListener("resize",this.update)}},{key:"add",value:function(e){this._queue.push(e)}},{key:"remove",value:function(e){var t=this._queue.indexOf(e);t>-1&&this._queue.splice(t,1)}},{key:"update",value:function(){for(var e=this._queue.length;e--;)this._queue[e]._measure()}}]),e}();t["default"]=a,e.exports=t["default"]},function(e,t,r){"use strict";function n(e,t,r){function n(){b&&clearTimeout(b),d&&clearTimeout(d),g=0,d=b=m=void 0}function i(t,r){r&&clearTimeout(r),d=b=m=void 0,t&&(g=l(),v=e.apply(y,p),b||d||(p=y=void 0))}function a(){var e=t-(l()-h);0>=e||e>t?i(m,d):b=setTimeout(a,e)}function c(){i(O,b)}function f(){if(p=arguments,h=l(),y=this,m=O&&(b||!w),_===!1)var r=w&&!b;else{d||w||(g=h);var n=_-(h-g),o=0>=n||n>_;o?(d&&(d=clearTimeout(d)),g=h,v=e.apply(y,p)):d||(d=setTimeout(c,n))}return o&&b?b=clearTimeout(b):b||t===_||(b=setTimeout(a,t)),r&&(o=!0,v=e.apply(y,p)),!o||b||d||(p=y=void 0),v}var p,d,v,h,y,b,m,g=0,_=!1,O=!0;if("function"!=typeof e)throw new TypeError(u);if(t=0>t?0:+t||0,r===!0){var w=!0;O=!1}else o(r)&&(w=!!r.leading,_="maxWait"in r&&s(+r.maxWait||0,t),O="trailing"in r?!!r.trailing:O);return f.cancel=n,f}function o(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var i=r(9),u="Expected a function",s=Math.max,a=i(Date,"now"),l=a||function(){return(new Date).getTime()};e.exports=n},function(e,t){"use strict";function r(e){return!!e&&"object"==typeof e}function n(e,t){var r=null==e?void 0:e[t];return u(r)?r:void 0}function o(e){return i(e)&&p.call(e)==s}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function u(e){return null==e?!1:o(e)?d.test(c.call(e)):r(e)&&a.test(e)}var s="[object Function]",a=/^\[object .+?Constructor\]$/,l=Object.prototype,c=Function.prototype.toString,f=l.hasOwnProperty,p=l.toString,d=RegExp("^"+c.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=n},function(e,t){"use strict";function r(e,t){for(var r=7;r--;){var o=n[r],i=e[o],u=t[o];if(i!==u){var s="undefined"==typeof i,a="undefined"==typeof u;if(s&&!a||!s&&a||"attributeFilter"===o&&i.length!==u.length)return!0}}return!1}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;var n=["childList","attributes","characterData","subtree","attributeOldValue","characterDataOldValue","attributeFilter"];e.exports=t["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],r=e.getBoundingClientRect();return{width:r.width,height:t?u["default"](e):r.height,top:r.top,right:r.right,bottom:r.bottom,left:r.left}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=r(12),u=n(i);e.exports=t["default"]},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(e){return s["default"](e,"style")||s["default"](e,"style",getComputedStyle(e))}function i(e){var t=e.children,r=t.length;if(0===r)return l["default"](e);var n=t[0],i=t[r-1],u=o(n),s=u.marginTop,a=o(i),c=a.marginBottom,f=i.offsetTop-n.offsetTop;return parseInt(s)+(f+i.offsetHeight)+parseInt(c)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var u=r(13),s=n(u),a=r(14),l=n(a);e.exports=t["default"]},function(e,t){"use strict";function r(e,t,r){if(void 0===r){var u=e[n],s=u&&o[u];if(void 0===t)return s;if(s&&t in s)return s[t]}else if(void 0!==t){var u=e[n]||(e[n]=++i);return o[u]=o[u]||{},o[u][t]=r,r}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r;var n="react-measure"+(new Date).getTime(),o={},i=0;e.exports=t["default"]},function(e,t){"use strict";function r(e){var t=e.parentNode,r=document.createElement("div"),n=e.cloneNode(!0),o=0;return r.style.height=0,r.style.position="relative",r.style.overflow="hidden",n.setAttribute("id",""),n.setAttribute("name",""),n.setAttribute("data-reactid",""),n.style.boxSizing="border-box",n.style.height="auto",n.style.position="absolute",n.style.visibility="hidden",r.appendChild(n),t.appendChild(r),o=n.scrollHeight,t.removeChild(r),o}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")):"function"==typeof define&&define.amd?define(["React","ReactDOM"],t):"object"==typeof exports?exports.Measure=t(require("React"),require("ReactDOM")):e.Measure=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="dist/",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(1),i=r(o);t["default"]=i["default"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(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 n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(e,t,n){for(var r=!0;r;){var o=e,i=t,u=n;a=l=s=void 0,r=!1,null===o&&(o=Function.prototype);var a=Object.getOwnPropertyDescriptor(o,i);if(void 0!==a){if("value"in a)return a.value;var s=a.get;return void 0===s?void 0:s.call(u)}var l=Object.getPrototypeOf(o);if(null===l)return void 0;e=l,t=i,n=u,r=!0}},s=n(2),l=(r(s),n(3)),c=r(l),f=n(4),p=r(f),d=n(7),v=r(d),h=n(8),y=r(h),b=new p["default"],Measure=function(e){function Measure(){var e=this;o(this,Measure),a(Object.getPrototypeOf(Measure.prototype),"constructor",this).apply(this,arguments),this._observer=null,this._node=null,this._properties=this._getProperties(this.props),this._lastDimensions={},this._measure=function(t){var n=e.props.shouldMeasure(t);if(n){var r=e.getDimensions(e._node,e.props.accurate);e._properties.some(function(o){return r[o]!==e._lastDimensions[o]?(e.props.onMeasure(r,t,n),e._lastDimensions=r,!0):void 0})}}}return i(Measure,e),u(Measure,[{key:"componentDidMount",value:function(){this._node=c["default"].findDOMNode(this),this._connectObserver(this.props.config),this._measure(null),b.add(this)}},{key:"componentWillReceiveProps",value:function(e){var t=e.config,n=e.whitelist,r=e.blacklist;v["default"](this.props.config,t)&&(this._disconnectObserver(),this._connectObserver(t)),(this.props.whitelist!==n||this.props.blacklist!==r)&&(this._properties=this._getProperties({whitelist:n,blacklist:r}))}},{key:"componentWillUnmount",value:function(){this._disconnectObserver(),b.remove(this)}},{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 y["default"](e,t)}},{key:"_connectObserver",value:function(e){this._observer=new MutationObserver(this._measure),this._observer.observe(this._node,e)}},{key:"_disconnectObserver",value:function(){this._observer.disconnect()}},{key:"_getProperties",value:function(e){var t=e.whitelist,n=e.blacklist;return t.filter(function(e){return n.indexOf(e)<0})}},{key:"render",value:function(){return s.Children.only(this.props.children)}}],[{key:"propTypes",value:{config:s.PropTypes.object,accurate:s.PropTypes.bool,whitelist:s.PropTypes.array,blacklist:s.PropTypes.array,shouldMeasure:s.PropTypes.func,onMeasure:s.PropTypes.func},enumerable:!0},{key:"defaultProps",value:{config:{childList:!0,attributes:!0},accurate:!1,whitelist:["width","height","top","right","bottom","left"],blacklist:[],shouldMeasure:function(){return!0},onMeasure:function(){return null}},enumerable:!0}]),Measure}(s.Component);t["default"]=Measure,e.exports=t["default"]},function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(5),a=r(u),s=function(){function e(){o(this,e),this._queue=[],this.update=a["default"](this.update.bind(this),150),"undefined"!=typeof window&&window.addEventListener("resize",this.update)}return i(e,[{key:"destroy",value:function(){"undefined"!=typeof window&&window.removeEventListener("resize",this.update)}},{key:"add",value:function(e){this._queue.push(e)}},{key:"remove",value:function(e){var t=this._queue.indexOf(e);t>-1&&this._queue.splice(t,1)}},{key:"update",value:function(){for(var e=this._queue.length;e--;)this._queue[e]._measure()}}]),e}();t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e,t,n){function r(){b&&clearTimeout(b),d&&clearTimeout(d),g=0,d=b=m=void 0}function i(t,n){n&&clearTimeout(n),d=b=m=void 0,t&&(g=l(),v=e.apply(y,p),b||d||(p=y=void 0))}function s(){var e=t-(l()-h);0>=e||e>t?i(m,d):b=setTimeout(s,e)}function c(){i(O,b)}function f(){if(p=arguments,h=l(),y=this,m=O&&(b||!w),_===!1)var n=w&&!b;else{d||w||(g=h);var r=_-(h-g),o=0>=r||r>_;o?(d&&(d=clearTimeout(d)),g=h,v=e.apply(y,p)):d||(d=setTimeout(c,r))}return o&&b?b=clearTimeout(b):b||t===_||(b=setTimeout(s,t)),n&&(o=!0,v=e.apply(y,p)),!o||b||d||(p=y=void 0),v}var p,d,v,h,y,b,m,g=0,_=!1,O=!0;if("function"!=typeof e)throw new TypeError(u);if(t=0>t?0:+t||0,n===!0){var w=!0;O=!1}else o(n)&&(w=!!n.leading,_="maxWait"in n&&a(+n.maxWait||0,t),O="trailing"in n?!!n.trailing:O);return f.cancel=r,f}function o(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}var i=n(6),u="Expected a function",a=Math.max,s=i(Date,"now"),l=s||function(){return(new Date).getTime()};e.exports=r},function(e,t){"use strict";function n(e){return!!e&&"object"==typeof e}function r(e,t){var n=null==e?void 0:e[t];return u(n)?n:void 0}function o(e){return i(e)&&p.call(e)==a}function i(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function u(e){return null==e?!1:o(e)?d.test(c.call(e)):n(e)&&s.test(e)}var a="[object Function]",s=/^\[object .+?Constructor\]$/,l=Object.prototype,c=Function.prototype.toString,f=l.hasOwnProperty,p=l.toString,d=RegExp("^"+c.call(f).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");e.exports=r},function(e,t){"use strict";function n(e,t){for(var n=7;n--;){var o=r[n],i=e[o],u=t[o];if(i!==u){var a="undefined"==typeof i,s="undefined"==typeof u;if(a&&!s||!a&&s||"attributeFilter"===o&&i.length!==u.length)return!0}}return!1}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var r=["childList","attributes","characterData","subtree","attributeOldValue","characterDataOldValue","attributeFilter"];e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=arguments.length<=1||void 0===arguments[1]?!1:arguments[1],n=e.getBoundingClientRect();return{width:n.width,height:t?u["default"](e):n.height,top:n.top,right:n.right,bottom:n.bottom,left:n.left}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var i=n(9),u=r(i);e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return a["default"](e,"style")||a["default"](e,"style",getComputedStyle(e))}function i(e){var t=e.children;if(!t||t&&0===t.length||e instanceof SVGElement)return l["default"](e);var n=t[0],r=t[t.length-1],i=o(n),u=i.marginTop,a=o(r),s=a.marginBottom,c=r.offsetTop-n.offsetTop;return parseInt(u)+(c+r.offsetHeight)+parseInt(s)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i;var u=n(10),a=r(u),s=n(11),l=r(s);e.exports=t["default"]},function(e,t){"use strict";function n(e,t,n){if(void 0===n){var u=e[r],a=u&&o[u];if(void 0===t)return a;if(a&&t in a)return a[t]}else if(void 0!==t){var u=e[r]||(e[r]=++i);return o[u]=o[u]||{},o[u][t]=n,n}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var r="react-measure"+(new Date).getTime(),o={},i=0;e.exports=t["default"]},function(e,t){"use strict";function n(e){var t=e.parentNode,n=document.createElement("div"),r=e.cloneNode(!0),o=0;return n.style.height=0,n.style.position="relative",n.style.overflow="hidden",r.setAttribute("id",""),r.setAttribute("name",""),r.setAttribute("data-reactid",""),r.style.boxSizing="border-box",r.style.height="auto",r.style.position="absolute",r.style.visibility="hidden",n.appendChild(r),t.appendChild(n),o=r.scrollHeight,t.removeChild(n),o}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n,e.exports=t["default"]}])});

@@ -54,3 +54,3 @@ import React, { Component, Children, PropTypes } from 'react'

}
render() {

@@ -99,17 +99,17 @@ const { items, active } = this.props

}
_renderParagraphs() {
const { count } = this.state
let paragraphs = []
for(let i = 0; i < count; i++) {
paragraphs.push(<Paragraph key={i} />)
}
return paragraphs
}
_renderDimensions() {
const { dimensions } = this.state
return(

@@ -188,5 +188,6 @@ Object.keys(dimensions).map((dimension, i) =>

],
active: 1
active: 1,
showSVG: false
}
_handleAccordionClick = ({id}) => {

@@ -196,5 +197,5 @@ const active = (id === this.state.active) ? null : id;

}
render() {
const { items, active } = this.state;
const { items, active, showSVG } = this.state;
const currentSelected = active === null ? 'Nothing selected' : items[active].title;

@@ -204,2 +205,11 @@

<div className="app">
<div>
<div onClick={() => this.setState({showSVG: !showSVG})}>Toggle SVG</div>
<Slideable show={showSVG}>
<svg width="36px" height="36px" viewBox="0 0 36 36">
<circle fill="#373D3F" cx="18" cy="18" r="18"/>
<polygon fill="#CDD7DB" points="14,11 26,18 14,25"/>
</svg>
</Slideable>
</div>
<strong>Current Selected:</strong> {currentSelected}

@@ -217,2 +227,2 @@ <Accordion

ReactDOM.render(<App />, document.getElementById('app'));
ReactDOM.render(<App />, document.getElementById('app'));

@@ -27,6 +27,5 @@ 'use strict';

var amount = children.length;
// if no children present on the node we need to clone to get a true height
if (amount === 0) {
// if no children present on the node or an SVG element
// we need to clone it to get a true height
if (!children || children && children.length === 0 || node instanceof SVGElement) {
return (0, _getCloneHeight2['default'])(node);

@@ -36,3 +35,3 @@ }

var firstChild = children[0];
var lastChild = children[amount - 1];
var lastChild = children[children.length - 1];

@@ -39,0 +38,0 @@ var _getStyle = getStyle(firstChild);

@@ -25,6 +25,2 @@ 'use strict';

var _reactAddonsShallowCompare = require('react-addons-shallow-compare');
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
var _ResizeHandler = require('./Resize-Handler');

@@ -119,7 +115,2 @@

}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
}
}, {
key: 'componentWillUnmount',

@@ -126,0 +117,0 @@ value: function componentWillUnmount() {

{
"name": "react-measure",
"version": "0.3.4",
"version": "0.3.5",
"description": "Compute measurements of React components.",

@@ -33,5 +33,2 @@ "main": "lib/react-measure.js",

"dependencies": {
"react": "^0.14.0",
"react-dom": "^0.14.0",
"react-addons-shallow-compare": "^0.14.0",
"lodash.debounce": "^3.1.1"

@@ -48,2 +45,3 @@ },

"node-sass": "^3.2.0",
"react-addons-shallow-compare": "^0.14.0",
"react-motion": "^0.3.1",

@@ -54,3 +52,7 @@ "sass-loader": "^1.0.2",

"webpack-dev-server": "^1.9.0"
},
"peerDependencies": {
"react": ">0.13.0",
"react-dom": ">0.13.0"
}
}

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

## React Measure 0.3.4
## React Measure

@@ -3,0 +3,0 @@ Compute measurements of React components. Uses a [MutationObserver](https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver#MutationObserverInit) to detect changes of an element and return the new measurements after that mutation.

@@ -14,6 +14,6 @@ import dataStore from './data-store'

const { children } = node
const amount = children.length
// if no children present on the node we need to clone to get a true height
if (amount === 0) {
// if no children present on the node or an SVG element
// we need to clone it to get a true height
if (!children || (children && children.length === 0) || node instanceof SVGElement) {
return getCloneHeight(node)

@@ -23,3 +23,3 @@ }

const firstChild = children[0]
const lastChild = children[amount-1]
const lastChild = children[children.length-1]

@@ -36,2 +36,2 @@ const { marginTop } = getStyle(firstChild)

)
}
}

@@ -37,2 +37,2 @@ export default function getCloneHeight(node) {

return height
}
}

@@ -14,2 +14,2 @@ import accurateHeight from './accurate-height'

}
}
}
import React, { Component, Children, PropTypes, createElement, cloneElement } from 'react'
import ReactDOM from 'react-dom'
import shallowCompare from 'react-addons-shallow-compare'
import ResizeHandler from './Resize-Handler'

@@ -65,6 +64,2 @@ import diffConfig from './diff-config'

shouldComponentUpdate(nextProps, nextState) {
return shallowCompare(this, nextProps, nextState)
}
componentWillUnmount() {

@@ -122,2 +117,2 @@ this._disconnectObserver()

export default Measure
export default Measure
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