Added logging, changed some directory structure

This commit is contained in:
2018-01-13 21:33:40 -05:00
parent f079a5f067
commit 8e72ffb917
73656 changed files with 35284 additions and 53718 deletions

View File

@@ -0,0 +1,39 @@
## HEAD
## 2.0.0
###### _May 30, 2017_
Major version bump to facilitate new dependency requirements:
- Make react a peerDependency to avoid running module duplication (#3) @shawnmcknight
- Make lodash a peerDependency due to its common use and avoid inflating build size unnecessarily @shawnmcknight
## 1.0.2
###### _May 28, 2017_
- Remove separate lodash modules in favor of direct import of functions @shawnmcknight
- Add support for prettier and update libraries to conform to rules @shawnmcknight
- Update all dependencies to latest version and make updates to conform to API changes @shawnmcknight
- Update all devDependencies to latest version and make updates to conform to API changes @shawnmcknight
- Eliminate usage of lodash isEqual in favor of separate instance variables @shawnmcknight
- Updated test suite to check for returned values rather than simply calling @shawnmcknight
## 1.0.1
###### _Apr 26, 2017_
- Cancel throttled events when unmounting component @shawnmcknight
## 1.0.0
###### _Apr 17, 2017_
- Add unit tests through mocha/chai/enzyme to reach 100% code coverage @shawnmcknight
- Add code coverage tooling through istanbul/nyc @shawnmcknight
- Update to React separate prop-types package @shawnmcknight
- Update all dependencies to latest versions @shawnmcknight
- Correct instruction link in README @shawnmcknight
## 0.1.0
###### _Mar 25, 2017_
- Initial creation of this repository! Thanks for using it!

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2017 STORIS
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,58 @@
# React-Scrollbar-Size
React-Scrollbar-Size is a React component designed to calculate the size of the user agent's horizontal and vertical scrollbars.
It will also detect when the size of the scrollbars changes, such as when the user agent's zoom factor changes.
## Installation
React-Scrollbar-Size is available as an [npm package](https://www.npmjs.com/package/react-scrollbar-size):
```sh
$ npm install --save react-scrollbar-size
```
## Usage
### Props
| Name | Description |
| ---- | ---- |
| `onLoad` | Callback which will fire when the component mounts. |
| `onChange` | Callback which will fire when the scrollbar sizes change. |
Each of the callbacks accepts an object which will be updated with the following properties:
| Name | Description |
| ---- | ---- |
| `scrollbarWidth` | The current width of the vertical scrollbar. |
| `scrollbarHeight` | The current height of the horizontal scrollbar. |
### Example
```js
import React, { Component } from 'react';
import ScrollbarSize from 'react-scrollbar-size';
class MyComponent extends Component {
scrollbarSizeLoad = (measurements) => {
console.log('Scrollbars loaded', measurements);
}
scrollbarSizeChange = (measurements) => {
console.log('Scrollbars changed', measurements);
}
render() {
return (
<div>
<ScrollbarSize
onLoad={this.scrollbarSizeLoad}
onChange={this.scrollbarSizeChange}
/>
</div>
);
}
}
```
To see a live example, follow these [instructions](https://github.com/STORIS/react-scrollbar-size/blob/master/examples/README.md).
## License
This project is licensed under the terms of the
[MIT license](https://github.com/STORIS/react-scrollbar-size/blob/master/LICENSE).

View File

@@ -0,0 +1,130 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of');
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactEventListener = require('react-event-listener');
var _reactEventListener2 = _interopRequireDefault(_reactEventListener);
var _throttle = require('lodash/throttle');
var _throttle2 = _interopRequireDefault(_throttle);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var styles = {
width: '100px',
height: '100px',
position: 'absolute',
top: '-100000px',
overflow: 'scroll',
msOverflowStyle: 'scrollbar'
};
var ScrollbarSize = function (_Component) {
(0, _inherits3.default)(ScrollbarSize, _Component);
function ScrollbarSize() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, ScrollbarSize);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = ScrollbarSize.__proto__ || (0, _getPrototypeOf2.default)(ScrollbarSize)).call.apply(_ref, [this].concat(args))), _this), _this.setMeasurements = function () {
_this.scrollbarHeight = _this.node.offsetHeight - _this.node.clientHeight;
_this.scrollbarWidth = _this.node.offsetWidth - _this.node.clientWidth;
}, _this.handleResize = (0, _throttle2.default)(function () {
var onChange = _this.props.onChange;
var prevHeight = _this.scrollbarHeight;
var prevWidth = _this.scrollbarWidth;
_this.setMeasurements();
if (prevHeight !== _this.scrollbarHeight || prevWidth !== _this.scrollbarWidth) {
onChange({ scrollbarHeight: _this.scrollbarHeight, scrollbarWidth: _this.scrollbarWidth });
}
}, 166), _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(ScrollbarSize, [{
key: 'componentDidMount',
value: function componentDidMount() {
var onLoad = this.props.onLoad;
if (onLoad) {
this.setMeasurements();
onLoad({ scrollbarHeight: this.scrollbarHeight, scrollbarWidth: this.scrollbarWidth });
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.handleResize.cancel();
}
}, {
key: 'render',
// Corresponds to 10 frames at 60 Hz.
value: function render() {
var _this2 = this;
var onChange = this.props.onChange;
return _react2.default.createElement(
'div',
null,
onChange ? _react2.default.createElement(_reactEventListener2.default, { target: 'window', onResize: this.handleResize }) : null,
_react2.default.createElement('div', {
style: styles,
ref: function ref(node) {
_this2.node = node;
}
})
);
}
}]);
return ScrollbarSize;
}(_react.Component);
ScrollbarSize.defaultProps = {
onLoad: null,
onChange: null
};
exports.default = ScrollbarSize;

View File

@@ -0,0 +1,13 @@
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _ScrollbarSize = require('./ScrollbarSize');
var _ScrollbarSize2 = _interopRequireDefault(_ScrollbarSize);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _ScrollbarSize2.default;

View File

@@ -0,0 +1,59 @@
{
"_args": [
[
"react-scrollbar-size@2.0.2",
"C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project"
]
],
"_from": "react-scrollbar-size@2.0.2",
"_id": "react-scrollbar-size@2.0.2",
"_inBundle": false,
"_integrity": "sha512-scpDs2PZFf9CJteBeDu7jkk7s+YX06Si4rQGVHsH6vjR/p7417q1Jv5SpOblLLesOgNrfWekwoHQG1g0/p3tvw==",
"_location": "/material-ui/react-scrollbar-size",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "react-scrollbar-size@2.0.2",
"name": "react-scrollbar-size",
"escapedName": "react-scrollbar-size",
"rawSpec": "2.0.2",
"saveSpec": null,
"fetchSpec": "2.0.2"
},
"_requiredBy": [
"/material-ui"
],
"_resolved": "https://registry.npmjs.org/react-scrollbar-size/-/react-scrollbar-size-2.0.2.tgz",
"_spec": "2.0.2",
"_where": "C:\\Users\\deranjer\\go\\src\\github.com\\deranjer\\goTorrent\\torrent-project",
"author": {
"name": "STORIS"
},
"bugs": {
"url": "https://github.com/STORIS/react-scrollbar-size/issues"
},
"dependencies": {
"babel-runtime": "^6.23.0",
"prop-types": "^15.5.10",
"react-event-listener": "^0.5.0"
},
"description": "React component to calculate the size of browser scrollbars",
"homepage": "https://github.com/STORIS/react-scrollbar-size#readme",
"keywords": [
"react",
"scrollbar"
],
"license": "MIT",
"main": "./index.js",
"name": "react-scrollbar-size",
"peerDependencies": {
"lodash": "^4.17.0",
"react": "^15.3.0 || ^16.0.0"
},
"repository": {
"type": "git",
"url": "git+https://github.com/STORIS/react-scrollbar-size.git"
},
"version": "2.0.2"
}