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

@visx/bounds

Package Overview
Dependencies
Maintainers
4
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@visx/bounds - npm Package Compare versions

Comparing version 3.0.0-alpha.0 to 3.0.0

37

esm/enhancers/withBoundingRects.js

@@ -1,9 +0,5 @@

function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
/* eslint react/no-did-mount-set-state: 0, react/no-find-dom-node: 0 */

@@ -21,14 +17,8 @@ import React from 'react';

export default function withBoundingRects(BaseComponent) {
var _class, _temp;
return _temp = _class = /*#__PURE__*/function (_React$PureComponent) {
var _class;
return _class = /*#__PURE__*/function (_React$PureComponent) {
_inheritsLoose(WrappedComponent, _React$PureComponent);
function WrappedComponent(props) {
var _this;
_this = _React$PureComponent.call(this, props) || this;
_defineProperty(_assertThisInitialized(_this), "node", void 0);
_this.state = {

@@ -38,12 +28,11 @@ rect: undefined,

};
_this.nodeRef = /*#__PURE__*/React.createRef();
_this.getRects = _this.getRects.bind(_assertThisInitialized(_this));
return _this;
}
var _proto = WrappedComponent.prototype;
_proto.componentDidMount = function componentDidMount() {
var _this2 = this;
this.node = ReactDOM.findDOMNode(this);
var _this$nodeRef,
_this2 = this;
this.node = (_this$nodeRef = this.nodeRef) != null && _this$nodeRef.current ? this.nodeRef.current : ReactDOM.findDOMNode(this);
this.setState(function () {

@@ -53,3 +42,2 @@ return _this2.getRects();

};
_proto.getRects = function getRects() {

@@ -60,3 +48,3 @@ if (!this.node) return this.state;

var rect = node.getBoundingClientRect ? node.getBoundingClientRect() : emptyRect;
var parentRect = parentNode && parentNode.getBoundingClientRect ? parentNode.getBoundingClientRect() : emptyRect;
var parentRect = parentNode != null && parentNode.getBoundingClientRect ? parentNode.getBoundingClientRect() : emptyRect;
return {

@@ -67,11 +55,10 @@ rect: rect,

};
_proto.render = function render() {
return /*#__PURE__*/React.createElement(BaseComponent, _extends({
nodeRef: this.nodeRef,
getRects: this.getRects
}, this.state, this.props));
};
return WrappedComponent;
}(React.PureComponent), _defineProperty(_class, "displayName", "withBoundingRects(" + (BaseComponent.displayName || '') + ")"), _temp;
}(React.PureComponent), _class.displayName = "withBoundingRects(" + (BaseComponent.displayName || '') + ")", _class;
}

@@ -17,2 +17,3 @@ import React from 'react';

parentRect?: rectShape;
nodeRef?: React.RefObject<HTMLElement>;
};

@@ -22,2 +23,3 @@ export default function withBoundingRects<Props extends object = {}>(BaseComponent: React.ComponentType<Props>): {

node: HTMLElement | undefined | null;
nodeRef: React.RefObject<HTMLElement>;
componentDidMount(): void;

@@ -24,0 +26,0 @@ getRects(): Readonly<{}>;

@@ -5,17 +5,9 @@ "use strict";

exports.default = withBoundingRects;
var _react = _interopRequireDefault(require("react"));
var _reactDom = _interopRequireDefault(require("react-dom"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var emptyRect = {

@@ -29,16 +21,9 @@ top: 0,

};
function withBoundingRects(BaseComponent) {
var _class, _temp;
return _temp = _class = /*#__PURE__*/function (_React$PureComponent) {
var _class;
return _class = /*#__PURE__*/function (_React$PureComponent) {
_inheritsLoose(WrappedComponent, _React$PureComponent);
function WrappedComponent(props) {
var _this;
_this = _React$PureComponent.call(this, props) || this;
_defineProperty(_assertThisInitialized(_this), "node", void 0);
_this.state = {

@@ -48,12 +33,11 @@ rect: undefined,

};
_this.nodeRef = /*#__PURE__*/_react.default.createRef();
_this.getRects = _this.getRects.bind(_assertThisInitialized(_this));
return _this;
}
var _proto = WrappedComponent.prototype;
_proto.componentDidMount = function componentDidMount() {
var _this2 = this;
this.node = _reactDom.default.findDOMNode(this);
var _this$nodeRef,
_this2 = this;
this.node = (_this$nodeRef = this.nodeRef) != null && _this$nodeRef.current ? this.nodeRef.current : _reactDom.default.findDOMNode(this);
this.setState(function () {

@@ -63,3 +47,2 @@ return _this2.getRects();

};
_proto.getRects = function getRects() {

@@ -70,3 +53,3 @@ if (!this.node) return this.state;

var rect = node.getBoundingClientRect ? node.getBoundingClientRect() : emptyRect;
var parentRect = parentNode && parentNode.getBoundingClientRect ? parentNode.getBoundingClientRect() : emptyRect;
var parentRect = parentNode != null && parentNode.getBoundingClientRect ? parentNode.getBoundingClientRect() : emptyRect;
return {

@@ -77,11 +60,10 @@ rect: rect,

};
_proto.render = function render() {
return /*#__PURE__*/_react.default.createElement(BaseComponent, _extends({
nodeRef: this.nodeRef,
getRects: this.getRects
}, this.state, this.props));
};
return WrappedComponent;
}(_react.default.PureComponent), _defineProperty(_class, "displayName", "withBoundingRects(" + (BaseComponent.displayName || '') + ")"), _temp;
}(_react.default.PureComponent), _class.displayName = "withBoundingRects(" + (BaseComponent.displayName || '') + ")", _class;
}

@@ -5,7 +5,4 @@ "use strict";

exports.withBoundingRects = void 0;
var _withBoundingRects = _interopRequireDefault(require("./enhancers/withBoundingRects"));
exports.withBoundingRects = _withBoundingRects.default;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
{
"name": "@visx/bounds",
"version": "3.0.0-alpha.0",
"version": "3.0.0",
"description": "Utilities to make your life with bounding boxes better",

@@ -38,6 +38,6 @@ "sideEffects": false,

"peerDependencies": {
"react": "^16.0.0-0 || ^17.0.0-0",
"react-dom": "^16.0.0-0 || ^17.0.0-0"
"react": "^16.0.0-0 || ^17.0.0-0 || ^18.0.0-0",
"react-dom": "^16.0.0-0 || ^17.0.0-0 || ^18.0.0-0"
},
"gitHead": "2f2fb26030b5f1328803b2bd7de171d66e088aff"
"gitHead": "2fbffbaee80b88302274266112f8ad9a241def33"
}

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