react-range-progress
Advanced tools
| {"/Users/vgrafe/Perso/react-range-progress/src/index.js":{"path":"/Users/vgrafe/Perso/react-range-progress/src/index.js","statementMap":{"0":{"start":{"line":3,"column":28},"end":{"line":4,"column":76}},"1":{"start":{"line":4,"column":2},"end":{"line":4,"column":76}},"2":{"start":{"line":6,"column":29},"end":{"line":9,"column":2}},"3":{"start":{"line":6,"column":57},"end":{"line":9,"column":1}},"4":{"start":{"line":11,"column":19},"end":{"line":138,"column":1}},"5":{"start":{"line":144,"column":4},"end":{"line":146,"column":7}},"6":{"start":{"line":150,"column":4},"end":{"line":157,"column":5}},"7":{"start":{"line":151,"column":21},"end":{"line":154,"column":7}},"8":{"start":{"line":155,"column":6},"end":{"line":155,"column":39}},"9":{"start":{"line":156,"column":6},"end":{"line":156,"column":57}},"10":{"start":{"line":172,"column":8},"end":{"line":172,"column":18}},"11":{"start":{"line":174,"column":16},"end":{"line":174,"column":56}},"12":{"start":{"line":176,"column":28},"end":{"line":176,"column":45}},"13":{"start":{"line":178,"column":28},"end":{"line":178,"column":55}},"14":{"start":{"line":180,"column":4},"end":{"line":243,"column":6}},"15":{"start":{"line":247,"column":0},"end":{"line":258,"column":2}},"16":{"start":{"line":260,"column":23},"end":{"line":265,"column":1}},"17":{"start":{"line":267,"column":0},"end":{"line":283,"column":2}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":3,"column":28},"end":{"line":3,"column":29}},"loc":{"start":{"line":4,"column":2},"end":{"line":4,"column":76}},"line":4},"1":{"name":"(anonymous_1)","decl":{"start":{"line":6,"column":29},"end":{"line":6,"column":30}},"loc":{"start":{"line":6,"column":57},"end":{"line":9,"column":1}},"line":6},"2":{"name":"(anonymous_2)","decl":{"start":{"line":143,"column":2},"end":{"line":143,"column":3}},"loc":{"start":{"line":143,"column":39},"end":{"line":147,"column":3}},"line":143},"3":{"name":"(anonymous_3)","decl":{"start":{"line":149,"column":13},"end":{"line":149,"column":14}},"loc":{"start":{"line":149,"column":18},"end":{"line":158,"column":3}},"line":149},"4":{"name":"(anonymous_4)","decl":{"start":{"line":160,"column":2},"end":{"line":160,"column":3}},"loc":{"start":{"line":160,"column":11},"end":{"line":244,"column":3}},"line":160},"5":{"name":"(anonymous_5)","decl":{"start":{"line":257,"column":12},"end":{"line":257,"column":13}},"loc":{"start":{"line":257,"column":18},"end":{"line":257,"column":20}},"line":257}},"branchMap":{"0":{"loc":{"start":{"line":150,"column":4},"end":{"line":157,"column":5}},"type":"if","locations":[{"start":{"line":150,"column":4},"end":{"line":157,"column":5}},{"start":{"line":150,"column":4},"end":{"line":157,"column":5}}],"line":150},"1":{"loc":{"start":{"line":152,"column":8},"end":{"line":152,"column":54}},"type":"cond-expr","locations":[{"start":{"line":152,"column":24},"end":{"line":152,"column":50}},{"start":{"line":152,"column":53},"end":{"line":152,"column":54}}],"line":152},"2":{"loc":{"start":{"line":156,"column":6},"end":{"line":156,"column":56}},"type":"binary-expr","locations":[{"start":{"line":156,"column":6},"end":{"line":156,"column":25}},{"start":{"line":156,"column":29},"end":{"line":156,"column":56}}],"line":156},"3":{"loc":{"start":{"line":174,"column":30},"end":{"line":174,"column":55}},"type":"binary-expr","locations":[{"start":{"line":174,"column":30},"end":{"line":174,"column":46}},{"start":{"line":174,"column":50},"end":{"line":174,"column":55}}],"line":174},"4":{"loc":{"start":{"line":214,"column":11},"end":{"line":226,"column":11}},"type":"cond-expr","locations":[{"start":{"line":214,"column":23},"end":{"line":214,"column":27}},{"start":{"line":215,"column":12},"end":{"line":225,"column":14}}],"line":214}},"s":{"0":1,"1":27,"2":1,"3":25,"4":1,"5":0,"6":2,"7":1,"8":1,"9":1,"10":7,"11":7,"12":7,"13":7,"14":7,"15":1,"16":1,"17":1},"f":{"0":27,"1":25,"2":0,"3":2,"4":7,"5":0},"b":{"0":[1,1],"1":[0,1],"2":[1,1],"3":[7,6],"4":[1,6]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"d56e507e5469dcd056045b5220da2b23ef8fef0b"}} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
+3
-2
| { | ||
| "presets": [ "es2015", "react"], | ||
| "presets": ["es2015", "react", "stage-0"], | ||
| "plugins": ["transform-object-rest-spread"], | ||
| "env": { | ||
| "test": { | ||
| "plugins": ["istanbul"] | ||
| "plugins": ["istanbul"], | ||
| "presets": ["es2015", "react", "stage-0"] | ||
| } | ||
| } | ||
| } |
+110
-69
@@ -29,10 +29,50 @@ 'use strict'; | ||
| var trackPosition = exports.trackPosition = function trackPosition(_ref) { | ||
| var thumbSize = _ref.thumbSize; | ||
| var height = _ref.height; | ||
| var thumbSize = _ref.thumbSize, | ||
| height = _ref.height; | ||
| return { | ||
| top: (thumbSize - Math.min(height, thumbSize)) / 2, | ||
| height: height + 'px' | ||
| height: height | ||
| }; | ||
| }; | ||
| var baseStyles = { | ||
| rootStyle: '\n input[type=\'range\']::-moz-focus-outer {\n border: 0;\n }\n input[type=range]::-ms-track {\n width:100%;\n height:100%;\n\n -webkit-appearance:none;\n margin:0px;\n padding:0px;\n border:0 none;\n\n background:transparent;\n color:transparent;\n overflow:visible;\n }\n\n input[type=range]::-moz-range-track {\n width:100%;\n height:100%;\n\n -moz-appearance:none;\n margin:0px;\n padding:0px;\n border:0 none;\n\n background:transparent;\n color:transparent;\n overflow:visible;\n }\n\n input[type=range] {\n cursor: pointer;\n\n -webkit-appearance:none;\n padding:0px;\n border:0 none;\n\n background:transparent;\n color:transparent;\n overflow:visible;\n }\n\n input[type=range]:focus::-webkit-slider-runnable-track {\n background:transparent;\n border:transparent;\n }\n\n input[type=range]:focus {\n outline: none;\n }\n\n input[type=range]::-ms-thumb {\n width:12px;\n height:12px;\n\n border-radius:0px;\n border:0 none;\n background:transparent;\n }\n input[type=range]::-moz-range-thumb {\n width:12px;\n height:12px;\n\n border-radius:0px;\n border:0 none;\n background:transparent;\n }\n input[type=range]::-webkit-slider-thumb {\n width:12px;\n height:12px;\n\n border-radius:0px;\n border:0 none;\n background:transparent;\n -webkit-appearance:none;\n }\n\n input[type=range]::-ms-fill-lower {\n background:transparent;\n border:0 none;\n }\n input[type=range]::-ms-fill-upper {\n background:transparent;\n border:0 none;\n }\n input[type=range]::-ms-tooltip {\n display: none;\n }', | ||
| baseDiv: { | ||
| border: '0 none', | ||
| position: 'relative', | ||
| left: 0, | ||
| top: 0, | ||
| overflow: 'visible' | ||
| }, | ||
| track: { | ||
| border: 0, | ||
| position: 'absolute', | ||
| width: '100%' | ||
| }, | ||
| fill: { | ||
| border: 0, | ||
| position: 'absolute', | ||
| pointerEvents: 'none' | ||
| }, | ||
| thumb: { | ||
| position: 'absolute', | ||
| top: 0, | ||
| border: '0 none', | ||
| padding: 0, | ||
| margin: 0, | ||
| textAlign: 'center', | ||
| pointerEvents: 'none', | ||
| boxShadow: '0 0 3px black' | ||
| }, | ||
| input: { | ||
| top: 0, | ||
| WebkitAppearance: 'none', | ||
| background: 'transparent', | ||
| position: 'absolute', | ||
| left: 0, | ||
| overflow: 'visible', | ||
| zIndex: 100 | ||
| } | ||
| }; | ||
| var Range = function (_React$Component) { | ||
@@ -42,18 +82,27 @@ _inherits(Range, _React$Component); | ||
| function Range() { | ||
| var _ref2; | ||
| var _temp, _this, _ret; | ||
| _classCallCheck(this, Range); | ||
| var _this = _possibleConstructorReturn(this, (Range.__proto__ || Object.getPrototypeOf(Range)).call(this)); | ||
| for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
| args[_key] = arguments[_key]; | ||
| } | ||
| _this.state = { value: 0 }; | ||
| return _this; | ||
| return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref2 = Range.__proto__ || Object.getPrototypeOf(Range)).call.apply(_ref2, [this].concat(args))), _this), _this.state = { value: 0 }, _this.onChange = function (e) { | ||
| if (!_this.props.readOnly) { | ||
| var newVal = parseInt(e.nativeEvent ? e.nativeEvent.target.value : e, 10); | ||
| _this.setState({ value: newVal }); | ||
| _this.props.onChange && _this.props.onChange(newVal); | ||
| } | ||
| }, _temp), _possibleConstructorReturn(_this, _ret); | ||
| } | ||
| _createClass(Range, [{ | ||
| key: 'onChange', | ||
| value: function onChange(e) { | ||
| if (!this.props.readOnly) { | ||
| var newVal = parseInt(e.nativeEvent ? e.nativeEvent.target.value : e, 10); | ||
| this.setState({ value: newVal }); | ||
| this.props.onChange && this.props.onChange(newVal); | ||
| } | ||
| key: 'componentWillReceiveProps', | ||
| value: function componentWillReceiveProps(nextProps) { | ||
| this.setState({ | ||
| value: nextProps.value | ||
| }); | ||
| } | ||
@@ -63,14 +112,24 @@ }, { | ||
| value: function render() { | ||
| var val = Math.min(this.props.max, this.state.value || this.props.value); | ||
| var min = this.props.min; | ||
| var max = this.props.max; | ||
| var _props = this.props, | ||
| value = _props.value, | ||
| min = _props.min, | ||
| max = _props.max, | ||
| thumbSize = _props.thumbSize, | ||
| width = _props.width, | ||
| trackColor = _props.trackColor, | ||
| height = _props.height, | ||
| fillColor = _props.fillColor, | ||
| hideThumb = _props.hideThumb, | ||
| thumbColor = _props.thumbColor; | ||
| var val = Math.min(max, this.state.value || value); | ||
| var percentProgress = val / (max - min); | ||
| var componentHeight = Math.max(this.props.height, this.props.thumbSize); | ||
| var componentHeight = Math.max(height, thumbSize); | ||
| return _react2.default.createElement( | ||
| 'div', | ||
| { | ||
| style: { width: this.props.width } }, | ||
| { style: { width: width } }, | ||
| _react2.default.createElement( | ||
@@ -80,48 +139,36 @@ 'div', | ||
| id: 'rrp-baseDiv', | ||
| style: { | ||
| height: componentHeight + 'px', | ||
| border: '0 none', | ||
| position: 'relative', | ||
| left: 0, | ||
| top: 0, | ||
| overflow: 'visible' | ||
| } }, | ||
| _react2.default.createElement('style', { dangerouslySetInnerHTML: { | ||
| __html: '\n input[type=\'range\']::-moz-focus-outer {\n border: 0;\n }\n input[type=range]::-ms-track {\n width:100%;\n height:100%;\n\n -webkit-appearance:none;\n margin:0px;\n padding:0px;\n border:0 none;\n\n background:transparent;\n color:transparent;\n overflow:visible;\n }\n\n input[type=range]::-moz-range-track {\n width:100%;\n height:100%;\n\n -moz-appearance:none;\n margin:0px;\n padding:0px;\n border:0 none;\n\n background:transparent;\n color:transparent;\n overflow:visible;\n }\n\n input[type=range] {\n cursor: pointer;\n\n -webkit-appearance:none;\n padding:0px;\n border:0 none;\n\n background:transparent;\n color:transparent;\n overflow:visible;\n }\n\n input[type=range]:focus::-webkit-slider-runnable-track {\n background:transparent;\n border:transparent;\n }\n\n input[type=range]:focus {\n outline: none;\n }\n\n input[type=range]::-ms-thumb {\n width:12px;\n height:12px;\n\n border-radius:0px;\n border:0 none;\n background:transparent;\n }\n input[type=range]::-moz-range-thumb {\n width:12px;\n height:12px;\n\n border-radius:0px;\n border:0 none;\n background:transparent;\n }\n input[type=range]::-webkit-slider-thumb {\n width:12px;\n height:12px;\n\n border-radius:0px;\n border:0 none;\n background:transparent;\n -webkit-appearance:none;\n }\n\n input[type=range]::-ms-fill-lower {\n background:transparent;\n border:0 none;\n }\n input[type=range]::-ms-fill-upper {\n background:transparent;\n border:0 none;\n }\n input[type=range]::-ms-tooltip {\n display: none;\n }' | ||
| } }), | ||
| style: _extends({}, baseStyles.baseDiv, { | ||
| height: componentHeight | ||
| }) | ||
| }, | ||
| _react2.default.createElement('style', { | ||
| dangerouslySetInnerHTML: { | ||
| __html: baseStyles.rootStyle | ||
| } | ||
| }), | ||
| _react2.default.createElement('div', { | ||
| id: 'rrp-track', | ||
| style: _extends({ | ||
| border: 0, | ||
| position: 'absolute', | ||
| background: toRgbaString(this.props.trackColor), | ||
| borderRadius: this.props.height + 'px', | ||
| width: '100%' | ||
| }, trackPosition(this.props)) }), | ||
| style: _extends({}, baseStyles.track, { | ||
| borderRadius: height, | ||
| background: toRgbaString(trackColor) | ||
| }, trackPosition(this.props)) | ||
| }), | ||
| _react2.default.createElement('div', { | ||
| id: 'rrp-fill', | ||
| style: _extends({ | ||
| border: 0, | ||
| position: 'absolute', | ||
| pointerEvents: 'none', | ||
| borderRadius: this.props.height + 'px', | ||
| background: toRgbaString(this.props.fillColor), | ||
| style: _extends({}, baseStyles.fill, { | ||
| borderRadius: height, | ||
| background: toRgbaString(fillColor), | ||
| width: 'calc(100% * ' + percentProgress + ' + ' + (1 - percentProgress) * componentHeight + 'px)' | ||
| }, trackPosition(this.props)) }), | ||
| this.props.hideThumb ? null : _react2.default.createElement('div', { | ||
| }, trackPosition(this.props)) | ||
| }), | ||
| hideThumb ? null : _react2.default.createElement('div', { | ||
| id: 'rrp-thumb', | ||
| style: { | ||
| position: 'absolute', | ||
| top: 0, | ||
| border: '0 none', | ||
| padding: 0, | ||
| margin: 0, | ||
| textAlign: 'center', | ||
| pointerEvents: 'none', | ||
| style: _extends({}, baseStyles.thumb, { | ||
| width: componentHeight, | ||
| height: componentHeight + 'px', | ||
| borderRadius: componentHeight + 'px', | ||
| background: toRgbaString(this.props.thumbColor), | ||
| boxShadow: '0 0 3px black', | ||
| left: 'calc((100% - ' + componentHeight + 'px) * ' + percentProgress + ')' } }), | ||
| height: componentHeight, | ||
| borderRadius: componentHeight, | ||
| background: toRgbaString(thumbColor), | ||
| left: 'calc((100% - ' + componentHeight + 'px) * ' + percentProgress + ')' | ||
| }) | ||
| }), | ||
| _react2.default.createElement('input', { | ||
@@ -132,15 +179,9 @@ style: _extends({}, trackPosition(this.props), { | ||
| marginRight: componentHeight / 2, | ||
| top: 0, | ||
| height: componentHeight, | ||
| WebkitAppearance: 'none', | ||
| background: 'transparent', | ||
| position: 'absolute', | ||
| left: 0, | ||
| overflow: 'visible', | ||
| zIndex: 100 | ||
| }), | ||
| height: componentHeight | ||
| }, baseStyles.input), | ||
| type: 'range', | ||
| onChange: this.onChange.bind(this), | ||
| onChange: this.onChange, | ||
| min: min, | ||
| max: max }) | ||
| max: max | ||
| }) | ||
| ) | ||
@@ -147,0 +188,0 @@ ); |
+4
-3
| { | ||
| "name": "react-range-progress", | ||
| "version": "4.0.2", | ||
| "version": "4.0.3", | ||
| "description": "Eases styling of sliders (range inputs).", | ||
@@ -13,3 +13,3 @@ "main": "dist/index.js", | ||
| "report-coverage": "cat ./coverage/lcov.info | codecov", | ||
| "check-coverage": "nyc check-coverage --functions 75", | ||
| "check-coverage": "nyc check-coverage --functions 50", | ||
| "build": "./node_modules/.bin/babel ./src/index.js -o ./dist/index.js", | ||
@@ -41,2 +41,3 @@ "prepublish": "npm run build", | ||
| "devDependencies": { | ||
| "cz-conventional-changelog": "^2.0.0", | ||
| "autoprefixer": "6.4.0", | ||
@@ -61,3 +62,3 @@ "babel-cli": "6.14.0", | ||
| "react-unit": "2.0.0", | ||
| "semantic-release": "^4.3.5", | ||
| "semantic-release": "^6.3.6", | ||
| "tape": "4.6.0", | ||
@@ -64,0 +65,0 @@ "tape-jsx-equals": "1.0.0" |
+11
-2
| react-range-progress | ||
| ======================= | ||
| [](https://travis-ci.org/vgrafe/react-range-progress) [](https://codecov.io/gh/vgrafe/react-range-progress) [](https://www.npmjs.com/package/react-range-progress) | ||
@@ -14,5 +15,7 @@ | ||
| You can also import from [npmcdn](https://npmcdn.com/react-range-progress) or [unpkg](https://unpkg.com/react-range-progress). | ||
| ## Playground | ||
| You can play around with a few properties on [webpackbin](http://www.webpackbin.com/VkXZkAUsW) | ||
| You can play around with a few properties on [codesandbox](https://codesandbox.io/s/JqRpW8Mw2) | ||
@@ -85,2 +88,8 @@ ## Props | ||
| MIT. Copyright (c) 2016 Vincent Grafé. | ||
| MIT. Copyright (c) 2017 Vincent Grafé. | ||
| ## Disclaimer | ||
| This package main purpose was to teach myself about publishing a package on npm. | ||
| Now I see there are a few monthly downloads, I advise any user to look at the source before using this package. If you can just style a couple of divs into a range, do it instead. Styling a range input may be overkill to reach the desired goal. |
+224
-179
@@ -1,199 +0,244 @@ | ||
| import React, { PropTypes } from 'react' | ||
| import React, { PropTypes } from 'react'; | ||
| export const toRgbaString = rgbaObject => `rgba(${rgbaObject.r}, ${rgbaObject.g}, ${rgbaObject.b}, ${rgbaObject.a})` | ||
| export const toRgbaString = rgbaObject => | ||
| `rgba(${rgbaObject.r}, ${rgbaObject.g}, ${rgbaObject.b}, ${rgbaObject.a})`; | ||
| export const trackPosition = ({thumbSize, height}) => ({ | ||
| export const trackPosition = ({ thumbSize, height }) => ({ | ||
| top: (thumbSize - Math.min(height, thumbSize)) / 2, | ||
| height: height + 'px' | ||
| }) | ||
| height | ||
| }); | ||
| class Range extends React.Component { | ||
| constructor () { | ||
| super() | ||
| this.state = {value: 0} | ||
| } | ||
| const baseStyles = { | ||
| rootStyle: ` | ||
| input[type='range']::-moz-focus-outer { | ||
| border: 0; | ||
| } | ||
| input[type=range]::-ms-track { | ||
| width:100%; | ||
| height:100%; | ||
| onChange (e) { | ||
| if (!this.props.readOnly) { | ||
| const newVal = parseInt(e.nativeEvent ? e.nativeEvent.target.value : e, 10) | ||
| this.setState({value: newVal}) | ||
| this.props.onChange && this.props.onChange(newVal) | ||
| -webkit-appearance:none; | ||
| margin:0px; | ||
| padding:0px; | ||
| border:0 none; | ||
| background:transparent; | ||
| color:transparent; | ||
| overflow:visible; | ||
| } | ||
| } | ||
| render () { | ||
| const val = Math.min(this.props.max, this.state.value || this.props.value) | ||
| const min = this.props.min | ||
| const max = this.props.max | ||
| input[type=range]::-moz-range-track { | ||
| width:100%; | ||
| height:100%; | ||
| const percentProgress = val / (max - min) | ||
| -moz-appearance:none; | ||
| margin:0px; | ||
| padding:0px; | ||
| border:0 none; | ||
| const componentHeight = Math.max(this.props.height, this.props.thumbSize) | ||
| background:transparent; | ||
| color:transparent; | ||
| overflow:visible; | ||
| } | ||
| return <div | ||
| style={{width: this.props.width}}> | ||
| <div | ||
| id='rrp-baseDiv' | ||
| style={{ | ||
| height: componentHeight + 'px', | ||
| border: '0 none', | ||
| position: 'relative', | ||
| left: 0, | ||
| top: 0, | ||
| overflow: 'visible' | ||
| }}> | ||
| <style dangerouslySetInnerHTML={{ | ||
| __html: | ||
| ` | ||
| input[type='range']::-moz-focus-outer { | ||
| border: 0; | ||
| } | ||
| input[type=range]::-ms-track { | ||
| width:100%; | ||
| height:100%; | ||
| input[type=range] { | ||
| cursor: pointer; | ||
| -webkit-appearance:none; | ||
| margin:0px; | ||
| padding:0px; | ||
| border:0 none; | ||
| -webkit-appearance:none; | ||
| padding:0px; | ||
| border:0 none; | ||
| background:transparent; | ||
| color:transparent; | ||
| overflow:visible; | ||
| } | ||
| background:transparent; | ||
| color:transparent; | ||
| overflow:visible; | ||
| } | ||
| input[type=range]::-moz-range-track { | ||
| width:100%; | ||
| height:100%; | ||
| input[type=range]:focus::-webkit-slider-runnable-track { | ||
| background:transparent; | ||
| border:transparent; | ||
| } | ||
| -moz-appearance:none; | ||
| margin:0px; | ||
| padding:0px; | ||
| border:0 none; | ||
| input[type=range]:focus { | ||
| outline: none; | ||
| } | ||
| background:transparent; | ||
| color:transparent; | ||
| overflow:visible; | ||
| } | ||
| input[type=range]::-ms-thumb { | ||
| width:12px; | ||
| height:12px; | ||
| input[type=range] { | ||
| cursor: pointer; | ||
| border-radius:0px; | ||
| border:0 none; | ||
| background:transparent; | ||
| } | ||
| input[type=range]::-moz-range-thumb { | ||
| width:12px; | ||
| height:12px; | ||
| -webkit-appearance:none; | ||
| padding:0px; | ||
| border:0 none; | ||
| border-radius:0px; | ||
| border:0 none; | ||
| background:transparent; | ||
| } | ||
| input[type=range]::-webkit-slider-thumb { | ||
| width:12px; | ||
| height:12px; | ||
| background:transparent; | ||
| color:transparent; | ||
| overflow:visible; | ||
| } | ||
| border-radius:0px; | ||
| border:0 none; | ||
| background:transparent; | ||
| -webkit-appearance:none; | ||
| } | ||
| input[type=range]:focus::-webkit-slider-runnable-track { | ||
| background:transparent; | ||
| border:transparent; | ||
| } | ||
| input[type=range]::-ms-fill-lower { | ||
| background:transparent; | ||
| border:0 none; | ||
| } | ||
| input[type=range]::-ms-fill-upper { | ||
| background:transparent; | ||
| border:0 none; | ||
| } | ||
| input[type=range]::-ms-tooltip { | ||
| display: none; | ||
| }`, | ||
| baseDiv: { | ||
| border: '0 none', | ||
| position: 'relative', | ||
| left: 0, | ||
| top: 0, | ||
| overflow: 'visible' | ||
| }, | ||
| track: { | ||
| border: 0, | ||
| position: 'absolute', | ||
| width: `100%` | ||
| }, | ||
| fill: { | ||
| border: 0, | ||
| position: 'absolute', | ||
| pointerEvents: 'none' | ||
| }, | ||
| thumb: { | ||
| position: 'absolute', | ||
| top: 0, | ||
| border: '0 none', | ||
| padding: 0, | ||
| margin: 0, | ||
| textAlign: 'center', | ||
| pointerEvents: 'none', | ||
| boxShadow: '0 0 3px black' | ||
| }, | ||
| input: { | ||
| top: 0, | ||
| WebkitAppearance: 'none', | ||
| background: 'transparent', | ||
| position: 'absolute', | ||
| left: 0, | ||
| overflow: 'visible', | ||
| zIndex: 100 | ||
| } | ||
| }; | ||
| input[type=range]:focus { | ||
| outline: none; | ||
| } | ||
| class Range extends React.Component { | ||
| state = { value: 0 }; | ||
| input[type=range]::-ms-thumb { | ||
| width:12px; | ||
| height:12px; | ||
| componentWillReceiveProps(nextProps) { | ||
| this.setState({ | ||
| value: nextProps.value | ||
| }); | ||
| } | ||
| border-radius:0px; | ||
| border:0 none; | ||
| background:transparent; | ||
| } | ||
| input[type=range]::-moz-range-thumb { | ||
| width:12px; | ||
| height:12px; | ||
| onChange = e => { | ||
| if (!this.props.readOnly) { | ||
| const newVal = parseInt( | ||
| e.nativeEvent ? e.nativeEvent.target.value : e, | ||
| 10 | ||
| ); | ||
| this.setState({ value: newVal }); | ||
| this.props.onChange && this.props.onChange(newVal); | ||
| } | ||
| }; | ||
| border-radius:0px; | ||
| border:0 none; | ||
| background:transparent; | ||
| } | ||
| input[type=range]::-webkit-slider-thumb { | ||
| width:12px; | ||
| height:12px; | ||
| render() { | ||
| const { | ||
| value, | ||
| min, | ||
| max, | ||
| thumbSize, | ||
| width, | ||
| trackColor, | ||
| height, | ||
| fillColor, | ||
| hideThumb, | ||
| thumbColor | ||
| } = this.props; | ||
| border-radius:0px; | ||
| border:0 none; | ||
| background:transparent; | ||
| -webkit-appearance:none; | ||
| } | ||
| const val = Math.min(max, this.state.value || value); | ||
| input[type=range]::-ms-fill-lower { | ||
| background:transparent; | ||
| border:0 none; | ||
| } | ||
| input[type=range]::-ms-fill-upper { | ||
| background:transparent; | ||
| border:0 none; | ||
| } | ||
| input[type=range]::-ms-tooltip { | ||
| display: none; | ||
| }` | ||
| }}> | ||
| </style> | ||
| <div | ||
| id='rrp-track' | ||
| style={{ | ||
| border: 0, | ||
| position: 'absolute', | ||
| background: toRgbaString(this.props.trackColor), | ||
| borderRadius: this.props.height + 'px', | ||
| width: `100%`, | ||
| ...trackPosition(this.props) | ||
| }}></div> | ||
| <div | ||
| id='rrp-fill' | ||
| style={{ | ||
| border: 0, | ||
| position: 'absolute', | ||
| pointerEvents: 'none', | ||
| borderRadius: this.props.height + 'px', | ||
| background: toRgbaString(this.props.fillColor), | ||
| width: `calc(100% * ${percentProgress} + ${(1 - percentProgress) * componentHeight}px)`, | ||
| ...trackPosition(this.props) | ||
| }}></div> | ||
| {this.props.hideThumb ? null | ||
| : <div | ||
| id='rrp-thumb' | ||
| style={{ | ||
| position: 'absolute', | ||
| top: 0, | ||
| border: '0 none', | ||
| padding: 0, | ||
| margin: 0, | ||
| textAlign: 'center', | ||
| pointerEvents: 'none', | ||
| width: componentHeight, | ||
| height: componentHeight + 'px', | ||
| borderRadius: componentHeight + 'px', | ||
| background: toRgbaString(this.props.thumbColor), | ||
| boxShadow: '0 0 3px black', | ||
| left: `calc((100% - ${componentHeight}px) * ${percentProgress})` }}> | ||
| </div>} | ||
| <input | ||
| style={{ | ||
| ...trackPosition(this.props), | ||
| width: 'calc(100% - ' + componentHeight + 'px)', | ||
| marginLeft: componentHeight / 2, | ||
| marginRight: componentHeight / 2, | ||
| top: 0, | ||
| height: componentHeight, | ||
| WebkitAppearance: 'none', | ||
| background: 'transparent', | ||
| position: 'absolute', | ||
| left: 0, | ||
| overflow: 'visible', | ||
| zIndex: 100 | ||
| }} | ||
| type='range' | ||
| onChange={this.onChange.bind(this)} | ||
| min={min} | ||
| max={max} /> | ||
| </div> | ||
| const percentProgress = val / (max - min); | ||
| const componentHeight = Math.max(height, thumbSize); | ||
| return ( | ||
| <div style={{ width: width }}> | ||
| <div | ||
| id="rrp-baseDiv" | ||
| style={{ | ||
| ...baseStyles.baseDiv, | ||
| height: componentHeight | ||
| }} | ||
| > | ||
| <style | ||
| dangerouslySetInnerHTML={{ | ||
| __html: baseStyles.rootStyle | ||
| }} | ||
| /> | ||
| <div | ||
| id="rrp-track" | ||
| style={{ | ||
| ...baseStyles.track, | ||
| borderRadius: height, | ||
| background: toRgbaString(trackColor), | ||
| ...trackPosition(this.props) | ||
| }} | ||
| /> | ||
| <div | ||
| id="rrp-fill" | ||
| style={{ | ||
| ...baseStyles.fill, | ||
| borderRadius: height, | ||
| background: toRgbaString(fillColor), | ||
| width: `calc(100% * ${percentProgress} + ${(1 - percentProgress) * | ||
| componentHeight}px)`, | ||
| ...trackPosition(this.props) | ||
| }} | ||
| /> | ||
| {hideThumb ? null : ( | ||
| <div | ||
| id="rrp-thumb" | ||
| style={{ | ||
| ...baseStyles.thumb, | ||
| width: componentHeight, | ||
| height: componentHeight, | ||
| borderRadius: componentHeight, | ||
| background: toRgbaString(thumbColor), | ||
| left: `calc((100% - ${componentHeight}px) * ${percentProgress})` | ||
| }} | ||
| /> | ||
| )} | ||
| <input | ||
| style={{ | ||
| ...trackPosition(this.props), | ||
| width: 'calc(100% - ' + componentHeight + 'px)', | ||
| marginLeft: componentHeight / 2, | ||
| marginRight: componentHeight / 2, | ||
| height: componentHeight, | ||
| ...baseStyles.input | ||
| }} | ||
| type="range" | ||
| onChange={this.onChange} | ||
| min={min} | ||
| max={max} | ||
| /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
@@ -203,5 +248,5 @@ } | ||
| Range.defaultProps = { | ||
| fillColor: {r: 255, g: 255, b: 255, a: 1}, | ||
| trackColor: {r: 255, g: 255, b: 255, a: 0.5}, | ||
| thumbColor: {r: 255, g: 255, b: 255, a: 1}, | ||
| fillColor: { r: 255, g: 255, b: 255, a: 1 }, | ||
| trackColor: { r: 255, g: 255, b: 255, a: 0.5 }, | ||
| thumbColor: { r: 255, g: 255, b: 255, a: 1 }, | ||
| thumbSize: 12, | ||
@@ -214,3 +259,3 @@ height: 6, | ||
| onChange: () => {} | ||
| } | ||
| }; | ||
@@ -222,3 +267,3 @@ const colorWithAlpha = { | ||
| a: PropTypes.number.isRequired | ||
| } | ||
| }; | ||
@@ -241,4 +286,4 @@ Range.propTypes = { | ||
| readOnly: PropTypes.bool | ||
| } | ||
| }; | ||
| export default Range | ||
| export default Range; |
+199
-117
@@ -1,12 +0,12 @@ | ||
| import React from 'react' | ||
| import createComponent from 'react-unit' | ||
| import tape from 'tape' | ||
| import addAssertions from 'extend-tape' | ||
| import jsxEquals from 'tape-jsx-equals' | ||
| const test = addAssertions(tape, {jsxEquals}) | ||
| import React from 'react'; | ||
| import createComponent from 'react-unit'; | ||
| import tape from 'tape'; | ||
| import addAssertions from 'extend-tape'; | ||
| import jsxEquals from 'tape-jsx-equals'; | ||
| const test = addAssertions(tape, { jsxEquals }); | ||
| // Component to test | ||
| import Range, { toRgbaString, trackPosition } from './index' | ||
| import Range, { toRgbaString, trackPosition } from './index'; | ||
| test('Testing toRgbaString', (t) => { | ||
| test('Testing toRgbaString', t => { | ||
| const mock = { | ||
@@ -17,44 +17,54 @@ r: 1, | ||
| a: 0.5 | ||
| } | ||
| const actual = toRgbaString(mock) | ||
| const expected = `rgba(1, 2, 3, 0.5)` | ||
| t.equal(actual, expected, 'formats object to string compliant with css rgba syntax') | ||
| t.end() | ||
| }) | ||
| }; | ||
| const actual = toRgbaString(mock); | ||
| const expected = `rgba(1, 2, 3, 0.5)`; | ||
| t.equal( | ||
| actual, | ||
| expected, | ||
| 'formats object to string compliant with css rgba syntax' | ||
| ); | ||
| t.end(); | ||
| }); | ||
| test('Testing trackPosition with thumb bigger than track', (t) => { | ||
| test('Testing trackPosition with thumb bigger than track', t => { | ||
| const mock = { | ||
| height: 37, thumbSize: 87 | ||
| } | ||
| const actual = trackPosition(mock) | ||
| height: 37, | ||
| thumbSize: 87 | ||
| }; | ||
| const actual = trackPosition(mock); | ||
| const expected = { | ||
| top: 25, | ||
| height: '37px' | ||
| } | ||
| t.equal(actual.top, expected.top, 'sets top gap to correct value') | ||
| t.equal(actual.height, expected.height, 'sets height to max param') | ||
| t.end() | ||
| }) | ||
| height: 37 | ||
| }; | ||
| t.equal(actual.top, expected.top, 'sets top gap to correct value'); | ||
| t.equal(actual.height, expected.height, 'sets height to max param'); | ||
| t.end(); | ||
| }); | ||
| test('Testing trackPosition with thumb lower than track', (t) => { | ||
| test('Testing trackPosition with thumb lower than track', t => { | ||
| const mock = { | ||
| height: 100, thumbSize: 12 | ||
| } | ||
| const actual = trackPosition(mock) | ||
| height: 100, | ||
| thumbSize: 12 | ||
| }; | ||
| const actual = trackPosition(mock); | ||
| const expected = { | ||
| top: 0, | ||
| height: '100px' | ||
| } | ||
| t.equal(actual.top, expected.top, 'sets top gap = 0 if thumb lower than track') | ||
| t.equal(actual.height, expected.height, 'sets height to max param') | ||
| t.end() | ||
| }) | ||
| height: 100 | ||
| }; | ||
| t.equal( | ||
| actual.top, | ||
| expected.top, | ||
| 'sets top gap = 0 if thumb lower than track' | ||
| ); | ||
| t.equal(actual.height, expected.height, 'sets height to max param'); | ||
| t.end(); | ||
| }); | ||
| test('Testing component default values when no props set', (t) => { | ||
| const component = createComponent.shallow(<Range />) | ||
| test('Testing component default values when no props set', t => { | ||
| const component = createComponent.shallow(<Range />); | ||
| const defaultProps = { | ||
| fillColor: {r: 255, g: 255, b: 255, a: 1}, | ||
| trackColor: {r: 255, g: 255, b: 255, a: 0.5}, | ||
| thumbColor: {r: 255, g: 255, b: 255, a: 1}, | ||
| fillColor: { r: 255, g: 255, b: 255, a: 1 }, | ||
| trackColor: { r: 255, g: 255, b: 255, a: 0.5 }, | ||
| thumbColor: { r: 255, g: 255, b: 255, a: 1 }, | ||
| thumbSize: 12, | ||
@@ -65,61 +75,119 @@ height: 6, | ||
| value: 0 | ||
| } | ||
| }; | ||
| const percentProgress = defaultProps.value / (defaultProps.max - defaultProps.min) | ||
| const percentProgress = | ||
| defaultProps.value / (defaultProps.max - defaultProps.min); | ||
| const rangeInput = component.findByQuery('input')[0] | ||
| const trackDiv = component.findByQuery('#rrp-track')[0] | ||
| const fillDiv = component.findByQuery('#rrp-fill')[0] | ||
| const thumb = component.findByQuery('#rrp-thumb')[0] | ||
| const baseDiv = component.findByQuery('#rrp-baseDiv')[0] | ||
| const rangeInput = component.findByQuery('input')[0]; | ||
| const trackDiv = component.findByQuery('#rrp-track')[0]; | ||
| const fillDiv = component.findByQuery('#rrp-fill')[0]; | ||
| const thumb = component.findByQuery('#rrp-thumb')[0]; | ||
| const baseDiv = component.findByQuery('#rrp-baseDiv')[0]; | ||
| t.equal(baseDiv.props.style.height, `${defaultProps.thumbSize}px`, 'base div is thumb default size') | ||
| t.equal( | ||
| baseDiv.props.style.height, | ||
| defaultProps.thumbSize, | ||
| 'base div is thumb default size' | ||
| ); | ||
| t.equal(rangeInput.props.min, defaultProps.min, 'default min value is set on range input') | ||
| t.equal(rangeInput.props.max, defaultProps.max, 'default max value is set on range input') | ||
| t.equal( | ||
| rangeInput.props.min, | ||
| defaultProps.min, | ||
| 'default min value is set on range input' | ||
| ); | ||
| t.equal( | ||
| rangeInput.props.max, | ||
| defaultProps.max, | ||
| 'default max value is set on range input' | ||
| ); | ||
| t.equal(trackDiv.props.style.background, toRgbaString(defaultProps.trackColor), 'default track color is set on track div') | ||
| t.equal(trackDiv.props.style.borderRadius, `${defaultProps.height}px`, 'track div corner radius equals height prop') | ||
| t.equal(trackDiv.props.style.top, trackPosition(defaultProps).top, 'track div has correct top margin') | ||
| t.equal(trackDiv.props.style.height, trackPosition(defaultProps).height, 'track div has correct height') | ||
| t.equal( | ||
| trackDiv.props.style.background, | ||
| toRgbaString(defaultProps.trackColor), | ||
| 'default track color is set on track div' | ||
| ); | ||
| t.equal( | ||
| trackDiv.props.style.borderRadius, | ||
| defaultProps.height, | ||
| 'track div corner radius equals height prop' | ||
| ); | ||
| t.equal( | ||
| trackDiv.props.style.top, | ||
| trackPosition(defaultProps).top, | ||
| 'track div has correct top margin' | ||
| ); | ||
| t.equal( | ||
| trackDiv.props.style.height, | ||
| trackPosition(defaultProps).height, | ||
| 'track div has correct height' | ||
| ); | ||
| t.equal(fillDiv.props.style.background, toRgbaString(defaultProps.fillColor), 'default fill color is set on fill div') | ||
| t.equal(fillDiv.props.style.borderRadius, `${defaultProps.height}px`, 'fill div corner radius equals height prop') | ||
| t.equal(fillDiv.props.style.width, `calc(100% * ${percentProgress} + ${(1 - percentProgress) * defaultProps.thumbSize}px)`, 'width is 0') | ||
| t.equal( | ||
| fillDiv.props.style.background, | ||
| toRgbaString(defaultProps.fillColor), | ||
| 'default fill color is set on fill div' | ||
| ); | ||
| t.equal( | ||
| fillDiv.props.style.borderRadius, | ||
| defaultProps.height, | ||
| 'fill div corner radius equals height prop' | ||
| ); | ||
| t.equal( | ||
| fillDiv.props.style.width, | ||
| `calc(100% * ${percentProgress} + ${(1 - percentProgress) * | ||
| defaultProps.thumbSize}px)`, | ||
| 'width is 0' | ||
| ); | ||
| t.equal(thumb.props.style.background, toRgbaString(defaultProps.thumbColor), 'default thumb color is set on thumb div') | ||
| t.equal( | ||
| thumb.props.style.background, | ||
| toRgbaString(defaultProps.thumbColor), | ||
| 'default thumb color is set on thumb div' | ||
| ); | ||
| t.end() | ||
| }) | ||
| t.end(); | ||
| }); | ||
| test('Testing when height > thumbsize', (t) => { | ||
| const bigVal = 43 | ||
| const smallVal = 13 | ||
| const component = createComponent.shallow(<Range height={bigVal} thumbSize={smallVal} />) | ||
| const baseDiv = component.findByQuery('#rrp-baseDiv')[0] | ||
| t.equal(baseDiv.props.style.height, `${bigVal}px`, 'when height > thumbsize, base div is set to height prop') | ||
| t.end() | ||
| }) | ||
| test('Testing when height > thumbsize', t => { | ||
| const bigVal = 43; | ||
| const smallVal = 13; | ||
| const component = createComponent.shallow( | ||
| <Range height={bigVal} thumbSize={smallVal} /> | ||
| ); | ||
| const baseDiv = component.findByQuery('#rrp-baseDiv')[0]; | ||
| t.equal( | ||
| baseDiv.props.style.height, | ||
| bigVal, | ||
| 'when height > thumbsize, base div is set to height prop' | ||
| ); | ||
| t.end(); | ||
| }); | ||
| test('Testing when height < thumbsize', (t) => { | ||
| const bigVal = 43 | ||
| const smallVal = 13 | ||
| const component = createComponent.shallow(<Range height={smallVal} thumbSize={bigVal} />) | ||
| const baseDiv = component.findByQuery('#rrp-baseDiv')[0] | ||
| t.equal(baseDiv.props.style.height, `${bigVal}px`, 'when height < thumbsize, base div is set to thumbSize prop') | ||
| t.end() | ||
| }) | ||
| test('Testing when height < thumbsize', t => { | ||
| const bigVal = 43; | ||
| const smallVal = 13; | ||
| const component = createComponent.shallow( | ||
| <Range height={smallVal} thumbSize={bigVal} /> | ||
| ); | ||
| const baseDiv = component.findByQuery('#rrp-baseDiv')[0]; | ||
| t.equal( | ||
| baseDiv.props.style.height, | ||
| bigVal, | ||
| 'when height < thumbsize, base div is set to thumbSize prop' | ||
| ); | ||
| t.end(); | ||
| }); | ||
| test('Testing when hideThumb = true', (t) => { | ||
| const component = createComponent.shallow(<Range hideThumb />) | ||
| const thumb = component.findByQuery('#rrp-thumb')[0] | ||
| t.equal(thumb, undefined, 'thumb is not displayed') | ||
| t.end() | ||
| }) | ||
| test('Testing when hideThumb = true', t => { | ||
| const component = createComponent.shallow(<Range hideThumb />); | ||
| const thumb = component.findByQuery('#rrp-thumb')[0]; | ||
| t.equal(thumb, undefined, 'thumb is not displayed'); | ||
| t.end(); | ||
| }); | ||
| test('Testing when setting props', (t) => { | ||
| let handlerWasFired = false | ||
| test('Testing when setting props', t => { | ||
| let handlerWasFired = false; | ||
| const handler = e => { | ||
| handlerWasFired = e | ||
| } | ||
| handlerWasFired = e; | ||
| }; | ||
@@ -131,3 +199,3 @@ const color0 = { | ||
| a: 0.8 | ||
| } | ||
| }; | ||
@@ -139,3 +207,3 @@ const color1 = { | ||
| a: 1 | ||
| } | ||
| }; | ||
@@ -147,3 +215,3 @@ const color2 = { | ||
| a: 0.87 | ||
| } | ||
| }; | ||
@@ -156,43 +224,57 @@ const component = createComponent.shallow( | ||
| trackColor={color1} | ||
| onChange={handler} /> | ||
| ) | ||
| onChange={handler} | ||
| /> | ||
| ); | ||
| const fillDiv = component.findByQuery('#rrp-fill')[0] | ||
| t.equal(fillDiv.props.style.background, toRgbaString(color0), 'fill div is colored as fillColor') | ||
| const fillDiv = component.findByQuery('#rrp-fill')[0]; | ||
| t.equal( | ||
| fillDiv.props.style.background, | ||
| toRgbaString(color0), | ||
| 'fill div is colored as fillColor' | ||
| ); | ||
| const trackDiv = component.findByQuery('#rrp-track')[0] | ||
| t.equal(trackDiv.props.style.background, toRgbaString(color1), 'track div is colored as trackColor') | ||
| const trackDiv = component.findByQuery('#rrp-track')[0]; | ||
| t.equal( | ||
| trackDiv.props.style.background, | ||
| toRgbaString(color1), | ||
| 'track div is colored as trackColor' | ||
| ); | ||
| const thumb = component.findByQuery('#rrp-thumb')[0] | ||
| t.equal(thumb.props.style.background, toRgbaString(color2), 'thumb is colored as thumbColor') | ||
| t.equal(thumb.props.style.height, '98px', 'thumb height = thumbSize') | ||
| t.equal(thumb.props.style.width, 98, 'thumb width = thumbSize') | ||
| const thumb = component.findByQuery('#rrp-thumb')[0]; | ||
| t.equal( | ||
| thumb.props.style.background, | ||
| toRgbaString(color2), | ||
| 'thumb is colored as thumbColor' | ||
| ); | ||
| t.equal(thumb.props.style.height, 98, 'thumb height = thumbSize'); | ||
| t.equal(thumb.props.style.width, 98, 'thumb width = thumbSize'); | ||
| // nativEvent throws - needs fix | ||
| const rangeInput = component.findByQuery('input')[0] | ||
| rangeInput.onChange(99) | ||
| t.equal(handlerWasFired, 99, 'handler is fired when range value is changed') | ||
| const rangeInput = component.findByQuery('input')[0]; | ||
| rangeInput.onChange(99); | ||
| t.equal(handlerWasFired, 99, 'handler is fired when range value is changed'); | ||
| t.end() | ||
| }) | ||
| t.end(); | ||
| }); | ||
| test('Testing with readOnly = true', (t) => { | ||
| let handlerWasFired = false | ||
| test('Testing with readOnly = true', t => { | ||
| let handlerWasFired = false; | ||
| const handler = e => { | ||
| handlerWasFired = e | ||
| } | ||
| handlerWasFired = e; | ||
| }; | ||
| const component = createComponent.shallow( | ||
| <Range | ||
| value={12} | ||
| onChange={handler} | ||
| readOnly /> | ||
| ) | ||
| <Range value={12} onChange={handler} readOnly /> | ||
| ); | ||
| // nativEvent throws - needs fix | ||
| const rangeInput = component.findByQuery('input')[0] | ||
| rangeInput.onChange(99) | ||
| t.equal(handlerWasFired, false, 'handler is NOT fired when range value is changed') | ||
| const rangeInput = component.findByQuery('input')[0]; | ||
| rangeInput.onChange(99); | ||
| t.equal( | ||
| handlerWasFired, | ||
| false, | ||
| 'handler is NOT fired when range value is changed' | ||
| ); | ||
| t.end() | ||
| }) | ||
| t.end(); | ||
| }); |
| {"/Users/vgrafe/Documents/perso/react-range-progress/src/index.js":{"path":"/Users/vgrafe/Documents/perso/react-range-progress/src/index.js","statementMap":{"1":{"start":{"line":3,"column":28},"end":{"line":3,"column":116}},"2":{"start":{"line":3,"column":42},"end":{"line":3,"column":116}},"3":{"start":{"line":5,"column":29},"end":{"line":8,"column":2}},"4":{"start":{"line":5,"column":55},"end":{"line":8,"column":1}},"5":{"start":{"line":12,"column":4},"end":{"line":12,"column":11}},"6":{"start":{"line":13,"column":4},"end":{"line":13,"column":27}},"7":{"start":{"line":17,"column":4},"end":{"line":21,"column":5}},"8":{"start":{"line":18,"column":21},"end":{"line":18,"column":81}},"9":{"start":{"line":19,"column":6},"end":{"line":19,"column":36}},"10":{"start":{"line":20,"column":6},"end":{"line":20,"column":56}},"11":{"start":{"line":25,"column":16},"end":{"line":25,"column":78}},"12":{"start":{"line":26,"column":16},"end":{"line":26,"column":30}},"13":{"start":{"line":27,"column":16},"end":{"line":27,"column":30}},"14":{"start":{"line":29,"column":28},"end":{"line":29,"column":45}},"15":{"start":{"line":31,"column":28},"end":{"line":31,"column":77}},"16":{"start":{"line":33,"column":4},"end":{"line":195,"column":12}},"17":{"start":{"line":199,"column":0},"end":{"line":210,"column":1}},"18":{"start":{"line":212,"column":23},"end":{"line":217,"column":1}},"19":{"start":{"line":219,"column":0},"end":{"line":235,"column":1}}},"fnMap":{"1":{"name":"(anonymous_1)","decl":{"start":{"line":3,"column":28},"end":{"line":3,"column":29}},"loc":{"start":{"line":3,"column":42},"end":{"line":3,"column":116}}},"2":{"name":"(anonymous_2)","decl":{"start":{"line":5,"column":29},"end":{"line":5,"column":30}},"loc":{"start":{"line":5,"column":55},"end":{"line":8,"column":1}}},"3":{"name":"(anonymous_3)","decl":{"start":{"line":11,"column":2},"end":{"line":11,"column":3}},"loc":{"start":{"line":11,"column":17},"end":{"line":14,"column":3}}},"4":{"name":"(anonymous_4)","decl":{"start":{"line":16,"column":2},"end":{"line":16,"column":3}},"loc":{"start":{"line":16,"column":15},"end":{"line":22,"column":3}}},"5":{"name":"(anonymous_5)","decl":{"start":{"line":24,"column":2},"end":{"line":24,"column":3}},"loc":{"start":{"line":24,"column":12},"end":{"line":196,"column":3}}},"6":{"name":"(anonymous_6)","decl":{"start":{"line":209,"column":12},"end":{"line":209,"column":13}},"loc":{"start":{"line":209,"column":18},"end":{"line":209,"column":20}}}},"branchMap":{"1":{"loc":{"start":{"line":17,"column":4},"end":{"line":21,"column":5}},"type":"if","locations":[{"start":{"line":17,"column":4},"end":{"line":21,"column":5}},{"start":{"line":17,"column":4},"end":{"line":21,"column":5}}]},"2":{"loc":{"start":{"line":18,"column":30},"end":{"line":18,"column":76}},"type":"cond-expr","locations":[{"start":{"line":18,"column":46},"end":{"line":18,"column":72}},{"start":{"line":18,"column":75},"end":{"line":18,"column":76}}]},"3":{"loc":{"start":{"line":20,"column":6},"end":{"line":20,"column":56}},"type":"binary-expr","locations":[{"start":{"line":20,"column":6},"end":{"line":20,"column":25}},{"start":{"line":20,"column":29},"end":{"line":20,"column":56}}]},"4":{"loc":{"start":{"line":25,"column":41},"end":{"line":25,"column":77}},"type":"binary-expr","locations":[{"start":{"line":25,"column":41},"end":{"line":25,"column":57}},{"start":{"line":25,"column":61},"end":{"line":25,"column":77}}]},"5":{"loc":{"start":{"line":157,"column":16},"end":{"line":174,"column":24}},"type":"cond-expr","locations":[{"start":{"line":157,"column":39},"end":{"line":157,"column":43}},{"start":{"line":158,"column":17},"end":{"line":174,"column":24}}]}},"s":{"1":1,"2":27,"3":1,"4":25,"5":6,"6":6,"7":2,"8":1,"9":1,"10":1,"11":7,"12":7,"13":7,"14":7,"15":7,"16":7,"17":1,"18":1,"19":1},"f":{"1":27,"2":25,"3":6,"4":2,"5":7,"6":0},"b":{"1":[1,1],"2":[0,1],"3":[1,1],"4":[7,6],"5":[1,6]},"hash":"fbcd2370cd11bce432a6a41dee0fcdc6836029d2"}} |
Sorry, the diff of this file is not supported yet
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
376506
336.36%21
10.53%1116
16.74%93
9.41%23
4.55%