react-point
Advanced tools
Comparing version 2.1.1 to 3.0.0
{ | ||
"name": "react-point", | ||
"version": "2.1.1", | ||
"description": "A minimal click/tap component for React", | ||
"version": "3.0.0", | ||
"description": "Fast touch events for React", | ||
"repository": "ReactTraining/react-point", | ||
"author": "Michael Jackson", | ||
"license": "MIT", | ||
"main": "lib", | ||
"files": [ | ||
"lib", | ||
"cjs", | ||
"esm", | ||
"umd" | ||
], | ||
"main": "cjs/react-broadcast.js", | ||
"module": "esm/react-broadcast.js", | ||
"unpkg": "umd/react-broadcast.js", | ||
"scripts": { | ||
"build-lib": "rimraf lib && babel ./modules -d lib --ignore '__tests__'", | ||
"build-umd": "webpack modules/index.js umd/react-point.js", | ||
"build-min": "webpack -p modules/index.js umd/react-point.min.js", | ||
"build": "node ./scripts/build.js", | ||
"prepublish": "node ./scripts/build.js", | ||
"clean": "git clean -fdX .", | ||
"prepublishOnly": "node ./scripts/build.js", | ||
"release": "node ./scripts/release.js", | ||
"lint": "eslint modules", | ||
"test": "npm run lint && karma start" | ||
"test": "jest" | ||
}, | ||
"peerDependencies": { | ||
"react": "15.x" | ||
"react": ">=15 || ^16.0.0-rc" | ||
}, | ||
"dependencies": { | ||
"invariant": "^2.2.1", | ||
"prop-types": "^15.5.6" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.11.4", | ||
"babel-core": "^6.17.0", | ||
"babel-eslint": "^7.0.0", | ||
"babel-loader": "^6.2.4", | ||
"babel-plugin-dev-expression": "^0.2.1", | ||
"babel-plugin-external-helpers": "^6.22.0", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.2.11", | ||
"babel-preset-es2015": "^6.9.0", | ||
"babel-preset-es2015-loose": "^8.0.0", | ||
"babel-preset-react": "^6.11.1", | ||
"babel-preset-minify": "^0.2.0", | ||
"babel-preset-react": "^6.5.0", | ||
"babel-preset-stage-1": "^6.5.0", | ||
"eslint": "^3.2.2", | ||
"eslint-plugin-import": "^1.12.0", | ||
"eslint-plugin-react": "^6.0.0", | ||
"expect": "^1.20.2", | ||
"eslint": "^3.3.1", | ||
"eslint-plugin-import": "^2.0.0", | ||
"eslint-plugin-jest": "^21.0.2", | ||
"eslint-plugin-react": "^6.1.2", | ||
"gzip-size": "^3.0.0", | ||
"in-publish": "^2.0.0", | ||
"karma": "^1.1.2", | ||
"karma-browserstack-launcher": "^1.0.1", | ||
"karma-chrome-launcher": "^1.0.1", | ||
"karma-mocha": "^1.1.1", | ||
"karma-mocha-reporter": "^2.0.5", | ||
"karma-sourcemap-loader": "^0.3.7", | ||
"karma-webpack": "^1.7.0", | ||
"mocha": "^3.0.0", | ||
"pretty-bytes": "^4.0.2", | ||
"jest": "^21.0.2", | ||
"pretty-bytes": "^4.0.0", | ||
"react": "^15.3.0", | ||
"react-addons-test-utils": "^15.3.0", | ||
"react-dom": "^15.3.0", | ||
"readline-sync": "^1.4.4", | ||
"rimraf": "^2.5.4", | ||
"webpack": "^1.13.1" | ||
"rollup": "^0.49.3", | ||
"rollup-plugin-babel": "^3.0.2", | ||
"rollup-plugin-commonjs": "^8.2.1", | ||
"rollup-plugin-node-resolve": "^3.0.0", | ||
"rollup-plugin-replace": "^2.0.0", | ||
"rollup-plugin-uglify": "^2.0.1" | ||
}, | ||
@@ -57,0 +58,0 @@ "keywords": [ |
@@ -9,26 +9,26 @@ # react-point [![Travis][build-badge]][build] [![npm package][npm-badge]][npm] | ||
[`react-point`](https://www.npmjs.com/package/react-point) is a small, focused click/tap component for React. | ||
[`react-point`](https://www.npmjs.com/package/react-point) gives you fast touch events for your React applications. | ||
A `<PointTarget>` normalizes click and click-like touch events (not swipes or drags) into a "point event". This helps you avoid the 300ms delay for click events on touch interfaces like iOS. | ||
A `<PointTarget>` normalizes click and click-like touch events (not swipes or drags) into a "point" event. This helps you avoid the 300ms delay for click events on touch interfaces like iOS. | ||
## Installation | ||
Using [npm](https://www.npmjs.com/): | ||
Using [yarn](https://yarnpkg.com/): | ||
$ npm install --save react-point | ||
$ yarn add react-point | ||
Then with a module bundler like [webpack](https://webpack.github.io/), use as you would anything else: | ||
Then, use as you would anything else: | ||
```js | ||
// using an ES6 transpiler, like babel | ||
// using ES6 modules | ||
import PointTarget from 'react-point' | ||
// not using an ES6 transpiler | ||
// using CommonJS modules | ||
var PointTarget = require('react-point') | ||
``` | ||
The UMD build is also available on [npmcdn](https://npmcdn.com): | ||
The UMD build is also available on [unpkg](https://unpkg.com): | ||
```html | ||
<script src="https://npmcdn.com/react-point/umd/react-point.min.js"></script> | ||
<script src="https://unpkg.com/react-point/umd/react-point.min.js"></script> | ||
``` | ||
@@ -47,3 +47,3 @@ | ||
class App extends React.Component { | ||
handlePoint() { | ||
handlePoint = () => { | ||
alert('I was clicked or tapped!') | ||
@@ -60,3 +60,3 @@ } | ||
By default, a `<PointTarget>` renders a `<button>` for accessibility. However, you can use the [`children` prop](https://facebook.github.io/react/tips/children-props-type.html) to make it render something else. For example, to render a `<div>`: | ||
By default, a `<PointTarget>` renders a `<button>` for accessibility. However, you can use the [`children` prop](https://facebook.github.io/react/docs/jsx-in-depth.html#children-in-jsx) to make it render something else. For example, to render a `<div>`: | ||
@@ -68,3 +68,3 @@ ```js | ||
class App extends React.Component { | ||
handlePoint() { | ||
handlePoint = () => { | ||
alert('I was clicked or tapped!') | ||
@@ -85,2 +85,7 @@ } | ||
That's it :) Enjoy! | ||
Enjoy! | ||
## About | ||
react-point is developed and maintained by [React Training](https://reacttraining.com). If you're interested in learning more about what React can do for your company, please [get in touch](mailto:hello@reacttraining.com)! | ||
"hat's it :) Enjoy! |
@@ -1,186 +0,1041 @@ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(require("react")); | ||
else if(typeof define === 'function' && define.amd) | ||
define(["react"], factory); | ||
else if(typeof exports === 'object') | ||
exports["ReactPoint"] = factory(require("react")); | ||
else | ||
root["ReactPoint"] = factory(root["React"]); | ||
})(this, function(__WEBPACK_EXTERNAL_MODULE_2__) { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react')) : | ||
typeof define === 'function' && define.amd ? define(['react'], factory) : | ||
(global.ReactPoint = factory(global.React)); | ||
}(this, (function (React) { 'use strict'; | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
React = React && React.hasOwnProperty('default') ? React['default'] : React; | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) | ||
/******/ return installedModules[moduleId].exports; | ||
function createCommonjsModule(fn, module) { | ||
return module = { exports: {} }, fn(module, module.exports), module.exports; | ||
} | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ exports: {}, | ||
/******/ id: moduleId, | ||
/******/ loaded: false | ||
/******/ }; | ||
"use strict"; | ||
/******/ // Execute the module function | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/** | ||
* Copyright (c) 2013-present, 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. | ||
* | ||
* | ||
*/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.loaded = true; | ||
function makeEmptyFunction(arg) { | ||
return function () { | ||
return arg; | ||
}; | ||
} | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/** | ||
* This function accepts and discards inputs; it has no side effects. This is | ||
* primarily useful idiomatically for overridable function endpoints which | ||
* always need to be callable, since JS lacks a null-call idiom ala Cocoa. | ||
*/ | ||
var emptyFunction = function emptyFunction() {}; | ||
emptyFunction.thatReturns = makeEmptyFunction; | ||
emptyFunction.thatReturnsFalse = makeEmptyFunction(false); | ||
emptyFunction.thatReturnsTrue = makeEmptyFunction(true); | ||
emptyFunction.thatReturnsNull = makeEmptyFunction(null); | ||
emptyFunction.thatReturnsThis = function () { | ||
return this; | ||
}; | ||
emptyFunction.thatReturnsArgument = function (arg) { | ||
return arg; | ||
}; | ||
/******/ // expose the modules object (__webpack_modules__) | ||
/******/ __webpack_require__.m = modules; | ||
var emptyFunction_1 = emptyFunction; | ||
/******/ // expose the module cache | ||
/******/ __webpack_require__.c = installedModules; | ||
/** | ||
* Copyright (c) 2013-present, 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. | ||
* | ||
*/ | ||
/******/ // __webpack_public_path__ | ||
/******/ __webpack_require__.p = ""; | ||
'use strict'; | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(0); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ([ | ||
/* 0 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
/** | ||
* Use invariant() to assert state which your program assumes to be true. | ||
* | ||
* Provide sprintf-style format (only %s is supported) and arguments | ||
* to provide information about what broke and what you were | ||
* expecting. | ||
* | ||
* The invariant message will be stripped in production, but the invariant | ||
* will remain to ensure logic does not differ in production. | ||
*/ | ||
'use strict'; | ||
var validateFormat = function validateFormat(format) {}; | ||
var _PointTarget = __webpack_require__(1); | ||
{ | ||
validateFormat = function validateFormat(format) { | ||
if (format === undefined) { | ||
throw new Error('invariant requires an error message argument'); | ||
} | ||
}; | ||
} | ||
var _PointTarget2 = _interopRequireDefault(_PointTarget); | ||
function invariant(condition, format, a, b, c, d, e, f) { | ||
validateFormat(format); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
if (!condition) { | ||
var error; | ||
if (format === undefined) { | ||
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.'); | ||
} else { | ||
var args = [a, b, c, d, e, f]; | ||
var argIndex = 0; | ||
error = new Error(format.replace(/%s/g, function () { | ||
return args[argIndex++]; | ||
})); | ||
error.name = 'Invariant Violation'; | ||
} | ||
// TODO: Remove in next major release. | ||
_PointTarget2.default.PointTarget = _PointTarget2.default; /* eslint-env node */ | ||
error.framesToPop = 1; // we don't care about invariant's own frame | ||
throw error; | ||
} | ||
} | ||
var invariant_1 = invariant; | ||
module.exports = _PointTarget2.default; | ||
/** | ||
* Copyright 2014-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. | ||
* | ||
*/ | ||
/***/ }, | ||
/* 1 */ | ||
/***/ function(module, exports, __webpack_require__) { | ||
'use strict'; | ||
'use strict'; | ||
exports.__esModule = true; | ||
var _react = __webpack_require__(2); | ||
/** | ||
* Similar to invariant but only logs a warning if the condition is not met. | ||
* This can be used to log issues in development environments in critical | ||
* paths. Removing the logging code for production environments will keep the | ||
* same logic and follow the same code paths. | ||
*/ | ||
var _react2 = _interopRequireDefault(_react); | ||
var warning = emptyFunction_1; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
{ | ||
var printWarning = function printWarning(format) { | ||
for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
args[_key - 1] = arguments[_key]; | ||
} | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
var argIndex = 0; | ||
var message = 'Warning: ' + format.replace(/%s/g, function () { | ||
return args[argIndex++]; | ||
}); | ||
if (typeof console !== 'undefined') { | ||
console.error(message); | ||
} | ||
try { | ||
// --- Welcome to debugging React --- | ||
// This error was thrown as a convenience so that you can use this stack | ||
// to find the callsite that caused this warning to fire. | ||
throw new Error(message); | ||
} catch (x) {} | ||
}; | ||
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | ||
warning = function warning(condition, format) { | ||
if (format === undefined) { | ||
throw new Error('`warning(condition, format, ...args)` requires a warning ' + 'message argument'); | ||
} | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | ||
if (format.indexOf('Failed Composite propType: ') === 0) { | ||
return; // Ignore CompositeComponent proptype check. | ||
} | ||
var touchX = function touchX(event) { | ||
return event.touches[0].clientX; | ||
}; | ||
if (!condition) { | ||
for (var _len2 = arguments.length, args = Array(_len2 > 2 ? _len2 - 2 : 0), _key2 = 2; _key2 < _len2; _key2++) { | ||
args[_key2 - 2] = arguments[_key2]; | ||
} | ||
var touchY = function touchY(event) { | ||
return event.touches[0].clientY; | ||
}; | ||
printWarning.apply(undefined, [format].concat(args)); | ||
} | ||
}; | ||
} | ||
var PointTarget = function (_React$Component) { | ||
_inherits(PointTarget, _React$Component); | ||
var warning_1 = warning; | ||
function PointTarget() { | ||
var _temp, _this, _ret; | ||
/** | ||
* Copyright 2013-present, 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. | ||
*/ | ||
_classCallCheck(this, PointTarget); | ||
'use strict'; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; | ||
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function () { | ||
if (!_this.usingTouch && _this.props.onPoint) _this.props.onPoint(); | ||
}, _this.handleTouchStart = function (event) { | ||
_this.usingTouch = true; | ||
var ReactPropTypesSecret_1 = ReactPropTypesSecret; | ||
if (_this.touchStarted) return; | ||
/** | ||
* Copyright 2013-present, 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. | ||
*/ | ||
_this.touchStarted = true; | ||
'use strict'; | ||
_this.touchMoved = false; | ||
_this.startX = touchX(event); | ||
_this.startY = touchY(event); | ||
}, _this.handleTouchMove = function (event) { | ||
if (!_this.touchMoved) { | ||
var tolerance = _this.props.tolerance; | ||
{ | ||
var invariant$1 = invariant_1; | ||
var warning$1 = warning_1; | ||
var ReactPropTypesSecret$1 = ReactPropTypesSecret_1; | ||
var loggedTypeFailures = {}; | ||
} | ||
/** | ||
* Assert that the values match with the type specs. | ||
* Error messages are memorized and will only be shown once. | ||
* | ||
* @param {object} typeSpecs Map of name to a ReactPropType | ||
* @param {object} values Runtime values that need to be type-checked | ||
* @param {string} location e.g. "prop", "context", "child context" | ||
* @param {string} componentName Name of the component for error messages. | ||
* @param {?Function} getStack Returns the component stack. | ||
* @private | ||
*/ | ||
function checkPropTypes(typeSpecs, values, location, componentName, getStack) { | ||
{ | ||
for (var typeSpecName in typeSpecs) { | ||
if (typeSpecs.hasOwnProperty(typeSpecName)) { | ||
var error; | ||
// Prop type validation may throw. In case they do, we don't want to | ||
// fail the render phase where it didn't fail before. So we log it. | ||
// After these have been cleaned up, we'll let them throw. | ||
try { | ||
// This is intentionally an invariant that gets caught. It's the same | ||
// behavior as without this statement except with a better message. | ||
invariant$1(typeof typeSpecs[typeSpecName] === 'function', '%s: %s type `%s` is invalid; it must be a function, usually from ' + 'React.PropTypes.', componentName || 'React class', location, typeSpecName); | ||
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret$1); | ||
} catch (ex) { | ||
error = ex; | ||
} | ||
warning$1(!error || error instanceof Error, '%s: type specification of %s `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error); | ||
if (error instanceof Error && !(error.message in loggedTypeFailures)) { | ||
// Only monitor this failure once because there tends to be a lot of the | ||
// same error. | ||
loggedTypeFailures[error.message] = true; | ||
_this.touchMoved = Math.abs(_this.startX - touchX(event)) > tolerance || Math.abs(_this.startY - touchY(event)) > tolerance; | ||
} | ||
}, _this.handleTouchCancel = function () { | ||
_this.touchStarted = _this.touchMoved = false; | ||
_this.startX = _this.startY = 0; | ||
}, _this.handleTouchEnd = function () { | ||
_this.touchStarted = false; | ||
var stack = getStack ? getStack() : ''; | ||
if (!_this.touchMoved && _this.props.onPoint) _this.props.onPoint(); | ||
}, _temp), _possibleConstructorReturn(_this, _ret); | ||
} | ||
warning$1(false, 'Failed %s type: %s%s', location, error.message, stack != null ? stack : ''); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
PointTarget.prototype.componentWillMount = function componentWillMount() { | ||
this.usingTouch = false; | ||
}; | ||
var checkPropTypes_1 = checkPropTypes; | ||
PointTarget.prototype.render = function render() { | ||
var children = this.props.children; | ||
/** | ||
* Copyright 2013-present, 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. | ||
*/ | ||
'use strict'; | ||
var element = children ? _react2.default.Children.only(children) : _react2.default.createElement('button', null); | ||
return _react2.default.cloneElement(element, { | ||
onClick: this.handleClick, | ||
onTouchStart: this.handleTouchStart, | ||
onTouchMove: this.handleTouchMove, | ||
onTouchCancel: this.handleTouchCancel, | ||
onTouchEnd: this.handleTouchEnd | ||
}); | ||
}; | ||
return PointTarget; | ||
}(_react2.default.Component); | ||
PointTarget.defaultProps = { | ||
tolerance: 10 | ||
}; | ||
if (false) { | ||
PointTarget.propTypes = { | ||
children: _react.PropTypes.node, | ||
tolerance: _react.PropTypes.number, | ||
onPoint: _react.PropTypes.func | ||
}; | ||
} | ||
exports.default = PointTarget; | ||
/***/ }, | ||
/* 2 */ | ||
/***/ function(module, exports) { | ||
var factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) { | ||
/* global Symbol */ | ||
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; | ||
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. | ||
module.exports = __WEBPACK_EXTERNAL_MODULE_2__; | ||
/** | ||
* Returns the iterator method function contained on the iterable object. | ||
* | ||
* Be sure to invoke the function with the iterable as context: | ||
* | ||
* var iteratorFn = getIteratorFn(myIterable); | ||
* if (iteratorFn) { | ||
* var iterator = iteratorFn.call(myIterable); | ||
* ... | ||
* } | ||
* | ||
* @param {?object} maybeIterable | ||
* @return {?function} | ||
*/ | ||
function getIteratorFn(maybeIterable) { | ||
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); | ||
if (typeof iteratorFn === 'function') { | ||
return iteratorFn; | ||
} | ||
} | ||
/***/ } | ||
/******/ ]) | ||
/** | ||
* Collection of methods that allow declaration and validation of props that are | ||
* supplied to React components. Example usage: | ||
* | ||
* var Props = require('ReactPropTypes'); | ||
* var MyArticle = React.createClass({ | ||
* propTypes: { | ||
* // An optional string prop named "description". | ||
* description: Props.string, | ||
* | ||
* // A required enum prop named "category". | ||
* category: Props.oneOf(['News','Photos']).isRequired, | ||
* | ||
* // A prop named "dialog" that requires an instance of Dialog. | ||
* dialog: Props.instanceOf(Dialog).isRequired | ||
* }, | ||
* render: function() { ... } | ||
* }); | ||
* | ||
* A more formal specification of how these methods are used: | ||
* | ||
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) | ||
* decl := ReactPropTypes.{type}(.isRequired)? | ||
* | ||
* Each and every declaration produces a function with the same signature. This | ||
* allows the creation of custom validation functions. For example: | ||
* | ||
* var MyLink = React.createClass({ | ||
* propTypes: { | ||
* // An optional string or URI prop named "href". | ||
* href: function(props, propName, componentName) { | ||
* var propValue = props[propName]; | ||
* if (propValue != null && typeof propValue !== 'string' && | ||
* !(propValue instanceof URI)) { | ||
* return new Error( | ||
* 'Expected a string or an URI for ' + propName + ' in ' + | ||
* componentName | ||
* ); | ||
* } | ||
* } | ||
* }, | ||
* render: function() {...} | ||
* }); | ||
* | ||
* @internal | ||
*/ | ||
var ANONYMOUS = '<<anonymous>>'; | ||
// Important! | ||
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`. | ||
var ReactPropTypes = { | ||
array: createPrimitiveTypeChecker('array'), | ||
bool: createPrimitiveTypeChecker('boolean'), | ||
func: createPrimitiveTypeChecker('function'), | ||
number: createPrimitiveTypeChecker('number'), | ||
object: createPrimitiveTypeChecker('object'), | ||
string: createPrimitiveTypeChecker('string'), | ||
symbol: createPrimitiveTypeChecker('symbol'), | ||
any: createAnyTypeChecker(), | ||
arrayOf: createArrayOfTypeChecker, | ||
element: createElementTypeChecker(), | ||
instanceOf: createInstanceTypeChecker, | ||
node: createNodeChecker(), | ||
objectOf: createObjectOfTypeChecker, | ||
oneOf: createEnumTypeChecker, | ||
oneOfType: createUnionTypeChecker, | ||
shape: createShapeTypeChecker | ||
}; | ||
/** | ||
* inlined Object.is polyfill to avoid requiring consumers ship their own | ||
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is | ||
*/ | ||
/*eslint-disable no-self-compare*/ | ||
function is(x, y) { | ||
// SameValue algorithm | ||
if (x === y) { | ||
// Steps 1-5, 7-10 | ||
// Steps 6.b-6.e: +0 != -0 | ||
return x !== 0 || 1 / x === 1 / y; | ||
} else { | ||
// Step 6.a: NaN == NaN | ||
return x !== x && y !== y; | ||
} | ||
} | ||
/*eslint-enable no-self-compare*/ | ||
/** | ||
* We use an Error-like object for backward compatibility as people may call | ||
* PropTypes directly and inspect their output. However, we don't use real | ||
* Errors anymore. We don't inspect their stack anyway, and creating them | ||
* is prohibitively expensive if they are created too often, such as what | ||
* happens in oneOfType() for any type before the one that matched. | ||
*/ | ||
function PropTypeError(message) { | ||
this.message = message; | ||
this.stack = ''; | ||
} | ||
// Make `instanceof Error` still work for returned errors. | ||
PropTypeError.prototype = Error.prototype; | ||
function createChainableTypeChecker(validate) { | ||
{ | ||
var manualPropTypeCallCache = {}; | ||
var manualPropTypeWarningCount = 0; | ||
} | ||
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { | ||
componentName = componentName || ANONYMOUS; | ||
propFullName = propFullName || propName; | ||
if (secret !== ReactPropTypesSecret_1) { | ||
if (throwOnDirectAccess) { | ||
// New behavior only for users of `prop-types` package | ||
invariant_1( | ||
false, | ||
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + | ||
'Use `PropTypes.checkPropTypes()` to call them. ' + | ||
'Read more at http://fb.me/use-check-prop-types' | ||
); | ||
} else if ("development" !== 'production' && typeof console !== 'undefined') { | ||
// Old behavior for people using React.PropTypes | ||
var cacheKey = componentName + ':' + propName; | ||
if ( | ||
!manualPropTypeCallCache[cacheKey] && | ||
// Avoid spamming the console because they are often not actionable except for lib authors | ||
manualPropTypeWarningCount < 3 | ||
) { | ||
warning_1( | ||
false, | ||
'You are manually calling a React.PropTypes validation ' + | ||
'function for the `%s` prop on `%s`. This is deprecated ' + | ||
'and will throw in the standalone `prop-types` package. ' + | ||
'You may be seeing this warning due to a third-party PropTypes ' + | ||
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.', | ||
propFullName, | ||
componentName | ||
); | ||
manualPropTypeCallCache[cacheKey] = true; | ||
manualPropTypeWarningCount++; | ||
} | ||
} | ||
} | ||
if (props[propName] == null) { | ||
if (isRequired) { | ||
if (props[propName] === null) { | ||
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); | ||
} | ||
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); | ||
} | ||
return null; | ||
} else { | ||
return validate(props, propName, componentName, location, propFullName); | ||
} | ||
} | ||
var chainedCheckType = checkType.bind(null, false); | ||
chainedCheckType.isRequired = checkType.bind(null, true); | ||
return chainedCheckType; | ||
} | ||
function createPrimitiveTypeChecker(expectedType) { | ||
function validate(props, propName, componentName, location, propFullName, secret) { | ||
var propValue = props[propName]; | ||
var propType = getPropType(propValue); | ||
if (propType !== expectedType) { | ||
// `propValue` being instance of, say, date/regexp, pass the 'object' | ||
// check, but we can offer a more precise error message here rather than | ||
// 'of type `object`'. | ||
var preciseType = getPreciseType(propValue); | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.')); | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createAnyTypeChecker() { | ||
return createChainableTypeChecker(emptyFunction_1.thatReturnsNull); | ||
} | ||
function createArrayOfTypeChecker(typeChecker) { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
if (typeof typeChecker !== 'function') { | ||
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); | ||
} | ||
var propValue = props[propName]; | ||
if (!Array.isArray(propValue)) { | ||
var propType = getPropType(propValue); | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); | ||
} | ||
for (var i = 0; i < propValue.length; i++) { | ||
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret_1); | ||
if (error instanceof Error) { | ||
return error; | ||
} | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createElementTypeChecker() { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
var propValue = props[propName]; | ||
if (!isValidElement(propValue)) { | ||
var propType = getPropType(propValue); | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createInstanceTypeChecker(expectedClass) { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
if (!(props[propName] instanceof expectedClass)) { | ||
var expectedClassName = expectedClass.name || ANONYMOUS; | ||
var actualClassName = getClassName(props[propName]); | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createEnumTypeChecker(expectedValues) { | ||
if (!Array.isArray(expectedValues)) { | ||
warning_1(false, 'Invalid argument supplied to oneOf, expected an instance of array.'); | ||
return emptyFunction_1.thatReturnsNull; | ||
} | ||
function validate(props, propName, componentName, location, propFullName) { | ||
var propValue = props[propName]; | ||
for (var i = 0; i < expectedValues.length; i++) { | ||
if (is(propValue, expectedValues[i])) { | ||
return null; | ||
} | ||
} | ||
var valuesString = JSON.stringify(expectedValues); | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + propValue + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createObjectOfTypeChecker(typeChecker) { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
if (typeof typeChecker !== 'function') { | ||
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); | ||
} | ||
var propValue = props[propName]; | ||
var propType = getPropType(propValue); | ||
if (propType !== 'object') { | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); | ||
} | ||
for (var key in propValue) { | ||
if (propValue.hasOwnProperty(key)) { | ||
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); | ||
if (error instanceof Error) { | ||
return error; | ||
} | ||
} | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createUnionTypeChecker(arrayOfTypeCheckers) { | ||
if (!Array.isArray(arrayOfTypeCheckers)) { | ||
warning_1(false, 'Invalid argument supplied to oneOfType, expected an instance of array.'); | ||
return emptyFunction_1.thatReturnsNull; | ||
} | ||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
var checker = arrayOfTypeCheckers[i]; | ||
if (typeof checker !== 'function') { | ||
warning_1( | ||
false, | ||
'Invalid argument supplid to oneOfType. Expected an array of check functions, but ' + | ||
'received %s at index %s.', | ||
getPostfixForTypeWarning(checker), | ||
i | ||
); | ||
return emptyFunction_1.thatReturnsNull; | ||
} | ||
} | ||
function validate(props, propName, componentName, location, propFullName) { | ||
for (var i = 0; i < arrayOfTypeCheckers.length; i++) { | ||
var checker = arrayOfTypeCheckers[i]; | ||
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret_1) == null) { | ||
return null; | ||
} | ||
} | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.')); | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createNodeChecker() { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
if (!isNode(props[propName])) { | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function createShapeTypeChecker(shapeTypes) { | ||
function validate(props, propName, componentName, location, propFullName) { | ||
var propValue = props[propName]; | ||
var propType = getPropType(propValue); | ||
if (propType !== 'object') { | ||
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); | ||
} | ||
for (var key in shapeTypes) { | ||
var checker = shapeTypes[key]; | ||
if (!checker) { | ||
continue; | ||
} | ||
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret_1); | ||
if (error) { | ||
return error; | ||
} | ||
} | ||
return null; | ||
} | ||
return createChainableTypeChecker(validate); | ||
} | ||
function isNode(propValue) { | ||
switch (typeof propValue) { | ||
case 'number': | ||
case 'string': | ||
case 'undefined': | ||
return true; | ||
case 'boolean': | ||
return !propValue; | ||
case 'object': | ||
if (Array.isArray(propValue)) { | ||
return propValue.every(isNode); | ||
} | ||
if (propValue === null || isValidElement(propValue)) { | ||
return true; | ||
} | ||
var iteratorFn = getIteratorFn(propValue); | ||
if (iteratorFn) { | ||
var iterator = iteratorFn.call(propValue); | ||
var step; | ||
if (iteratorFn !== propValue.entries) { | ||
while (!(step = iterator.next()).done) { | ||
if (!isNode(step.value)) { | ||
return false; | ||
} | ||
} | ||
} else { | ||
// Iterator will provide entry [k,v] tuples rather than values. | ||
while (!(step = iterator.next()).done) { | ||
var entry = step.value; | ||
if (entry) { | ||
if (!isNode(entry[1])) { | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
} else { | ||
return false; | ||
} | ||
return true; | ||
default: | ||
return false; | ||
} | ||
} | ||
function isSymbol(propType, propValue) { | ||
// Native Symbol. | ||
if (propType === 'symbol') { | ||
return true; | ||
} | ||
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' | ||
if (propValue['@@toStringTag'] === 'Symbol') { | ||
return true; | ||
} | ||
// Fallback for non-spec compliant Symbols which are polyfilled. | ||
if (typeof Symbol === 'function' && propValue instanceof Symbol) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
// Equivalent of `typeof` but with special handling for array and regexp. | ||
function getPropType(propValue) { | ||
var propType = typeof propValue; | ||
if (Array.isArray(propValue)) { | ||
return 'array'; | ||
} | ||
if (propValue instanceof RegExp) { | ||
// Old webkits (at least until Android 4.0) return 'function' rather than | ||
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/ | ||
// passes PropTypes.object. | ||
return 'object'; | ||
} | ||
if (isSymbol(propType, propValue)) { | ||
return 'symbol'; | ||
} | ||
return propType; | ||
} | ||
// This handles more types than `getPropType`. Only used for error messages. | ||
// See `createPrimitiveTypeChecker`. | ||
function getPreciseType(propValue) { | ||
if (typeof propValue === 'undefined' || propValue === null) { | ||
return '' + propValue; | ||
} | ||
var propType = getPropType(propValue); | ||
if (propType === 'object') { | ||
if (propValue instanceof Date) { | ||
return 'date'; | ||
} else if (propValue instanceof RegExp) { | ||
return 'regexp'; | ||
} | ||
} | ||
return propType; | ||
} | ||
// Returns a string that is postfixed to a warning about an invalid type. | ||
// For example, "undefined" or "of type array" | ||
function getPostfixForTypeWarning(value) { | ||
var type = getPreciseType(value); | ||
switch (type) { | ||
case 'array': | ||
case 'object': | ||
return 'an ' + type; | ||
case 'boolean': | ||
case 'date': | ||
case 'regexp': | ||
return 'a ' + type; | ||
default: | ||
return type; | ||
} | ||
} | ||
// Returns class name of the object, if any. | ||
function getClassName(propValue) { | ||
if (!propValue.constructor || !propValue.constructor.name) { | ||
return ANONYMOUS; | ||
} | ||
return propValue.constructor.name; | ||
} | ||
ReactPropTypes.checkPropTypes = checkPropTypes_1; | ||
ReactPropTypes.PropTypes = ReactPropTypes; | ||
return ReactPropTypes; | ||
}; | ||
var propTypes = createCommonjsModule(function (module) { | ||
/** | ||
* Copyright 2013-present, 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. | ||
*/ | ||
{ | ||
var REACT_ELEMENT_TYPE = (typeof Symbol === 'function' && | ||
Symbol.for && | ||
Symbol.for('react.element')) || | ||
0xeac7; | ||
var isValidElement = function(object) { | ||
return typeof object === 'object' && | ||
object !== null && | ||
object.$$typeof === REACT_ELEMENT_TYPE; | ||
}; | ||
// By explicitly using `prop-types` you are opting into new development behavior. | ||
// http://fb.me/prop-types-in-prod | ||
var throwOnDirectAccess = true; | ||
module.exports = factoryWithTypeCheckers(isValidElement, throwOnDirectAccess); | ||
} | ||
}); | ||
; | ||
var asyncGenerator = function () { | ||
function AwaitValue(value) { | ||
this.value = value; | ||
} | ||
function AsyncGenerator(gen) { | ||
var front, back; | ||
function send(key, arg) { | ||
return new Promise(function (resolve, reject) { | ||
var request = { | ||
key: key, | ||
arg: arg, | ||
resolve: resolve, | ||
reject: reject, | ||
next: null | ||
}; | ||
if (back) { | ||
back = back.next = request; | ||
} else { | ||
front = back = request; | ||
resume(key, arg); | ||
} | ||
}); | ||
} | ||
function resume(key, arg) { | ||
try { | ||
var result = gen[key](arg); | ||
var value = result.value; | ||
if (value instanceof AwaitValue) { | ||
Promise.resolve(value.value).then(function (arg) { | ||
resume("next", arg); | ||
}, function (arg) { | ||
resume("throw", arg); | ||
}); | ||
} else { | ||
settle(result.done ? "return" : "normal", result.value); | ||
} | ||
} catch (err) { | ||
settle("throw", err); | ||
} | ||
} | ||
function settle(type, value) { | ||
switch (type) { | ||
case "return": | ||
front.resolve({ | ||
value: value, | ||
done: true | ||
}); | ||
break; | ||
case "throw": | ||
front.reject(value); | ||
break; | ||
default: | ||
front.resolve({ | ||
value: value, | ||
done: false | ||
}); | ||
break; | ||
} | ||
front = front.next; | ||
if (front) { | ||
resume(front.key, front.arg); | ||
} else { | ||
back = null; | ||
} | ||
} | ||
this._invoke = send; | ||
if (typeof gen.return !== "function") { | ||
this.return = undefined; | ||
} | ||
} | ||
if (typeof Symbol === "function" && Symbol.asyncIterator) { | ||
AsyncGenerator.prototype[Symbol.asyncIterator] = function () { | ||
return this; | ||
}; | ||
} | ||
AsyncGenerator.prototype.next = function (arg) { | ||
return this._invoke("next", arg); | ||
}; | ||
AsyncGenerator.prototype.throw = function (arg) { | ||
return this._invoke("throw", arg); | ||
}; | ||
AsyncGenerator.prototype.return = function (arg) { | ||
return this._invoke("return", arg); | ||
}; | ||
return { | ||
wrap: function (fn) { | ||
return function () { | ||
return new AsyncGenerator(fn.apply(this, arguments)); | ||
}; | ||
}, | ||
await: function (value) { | ||
return new AwaitValue(value); | ||
} | ||
}; | ||
}(); | ||
var classCallCheck = function (instance, Constructor) { | ||
if (!(instance instanceof Constructor)) { | ||
throw new TypeError("Cannot call a class as a function"); | ||
} | ||
}; | ||
var inherits = function (subClass, superClass) { | ||
if (typeof superClass !== "function" && superClass !== null) { | ||
throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); | ||
} | ||
subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
constructor: { | ||
value: subClass, | ||
enumerable: false, | ||
writable: true, | ||
configurable: true | ||
} | ||
}); | ||
if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; | ||
}; | ||
var possibleConstructorReturn = function (self, call) { | ||
if (!self) { | ||
throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); | ||
} | ||
return call && (typeof call === "object" || typeof call === "function") ? call : self; | ||
}; | ||
var touchX = function touchX(event) { | ||
return event.touches[0].clientX; | ||
}; | ||
var touchY = function touchY(event) { | ||
return event.touches[0].clientY; | ||
}; | ||
var PointTarget = function (_React$Component) { | ||
inherits(PointTarget, _React$Component); | ||
function PointTarget() { | ||
var _temp, _this, _ret; | ||
classCallCheck(this, PointTarget); | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
return _ret = (_temp = (_this = possibleConstructorReturn(this, _React$Component.call.apply(_React$Component, [this].concat(args))), _this), _this.handleClick = function () { | ||
if (!_this.usingTouch && _this.props.onPoint) _this.props.onPoint(); | ||
}, _this.handleTouchStart = function (event) { | ||
_this.usingTouch = true; | ||
if (_this.touchStarted) return; | ||
_this.touchStarted = true; | ||
_this.touchMoved = false; | ||
_this.startX = touchX(event); | ||
_this.startY = touchY(event); | ||
}, _this.handleTouchMove = function (event) { | ||
if (!_this.touchMoved) { | ||
var tolerance = _this.props.tolerance; | ||
_this.touchMoved = Math.abs(_this.startX - touchX(event)) > tolerance || Math.abs(_this.startY - touchY(event)) > tolerance; | ||
} | ||
}, _this.handleTouchCancel = function () { | ||
_this.touchStarted = _this.touchMoved = false; | ||
_this.startX = _this.startY = 0; | ||
}, _this.handleTouchEnd = function () { | ||
_this.touchStarted = false; | ||
if (!_this.touchMoved && _this.props.onPoint) _this.props.onPoint(); | ||
}, _temp), possibleConstructorReturn(_this, _ret); | ||
} | ||
PointTarget.prototype.componentWillMount = function componentWillMount() { | ||
this.usingTouch = false; | ||
}; | ||
PointTarget.prototype.render = function render() { | ||
var children = this.props.children; | ||
var element = children ? React.Children.only(children) : React.createElement('button', null); | ||
return React.cloneElement(element, { | ||
onClick: this.handleClick, | ||
onTouchStart: this.handleTouchStart, | ||
onTouchMove: this.handleTouchMove, | ||
onTouchCancel: this.handleTouchCancel, | ||
onTouchEnd: this.handleTouchEnd | ||
}); | ||
}; | ||
return PointTarget; | ||
}(React.Component); | ||
PointTarget.propTypes = { | ||
children: propTypes.node, | ||
tolerance: propTypes.number, | ||
onPoint: propTypes.func | ||
}; | ||
PointTarget.defaultProps = { | ||
tolerance: 10 | ||
}; | ||
return PointTarget; | ||
}))); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.ReactPoint=e(require("react")):t.ReactPoint=e(t.React)}(this,function(t){return function(t){function e(n){if(o[n])return o[n].exports;var r=o[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var o={};return e.m=t,e.c=o,e.p="",e(0)}([function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}var r=o(1),u=n(r);u["default"].PointTarget=u["default"],t.exports=u["default"]},function(t,e,o){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function u(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}e.__esModule=!0;var a=o(2),i=n(a),l=function(t){return t.touches[0].clientX},s=function(t){return t.touches[0].clientY},f=function(t){function e(){var o,n,c;r(this,e);for(var a=arguments.length,i=Array(a),f=0;f<a;f++)i[f]=arguments[f];return o=n=u(this,t.call.apply(t,[this].concat(i))),n.handleClick=function(){!n.usingTouch&&n.props.onPoint&&n.props.onPoint()},n.handleTouchStart=function(t){n.usingTouch=!0,n.touchStarted||(n.touchStarted=!0,n.touchMoved=!1,n.startX=l(t),n.startY=s(t))},n.handleTouchMove=function(t){if(!n.touchMoved){var e=n.props.tolerance;n.touchMoved=Math.abs(n.startX-l(t))>e||Math.abs(n.startY-s(t))>e}},n.handleTouchCancel=function(){n.touchStarted=n.touchMoved=!1,n.startX=n.startY=0},n.handleTouchEnd=function(){n.touchStarted=!1,!n.touchMoved&&n.props.onPoint&&n.props.onPoint()},c=o,u(n,c)}return c(e,t),e.prototype.componentWillMount=function(){this.usingTouch=!1},e.prototype.render=function(){var t=this.props.children,e=t?i["default"].Children.only(t):i["default"].createElement("button",null);return i["default"].cloneElement(e,{onClick:this.handleClick,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchCancel:this.handleTouchCancel,onTouchEnd:this.handleTouchEnd})},e}(i["default"].Component);f.defaultProps={tolerance:10},e["default"]=f},function(e,o){e.exports=t}])}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):t.ReactPoint=e(t.React)}(this,function(t){"use strict";function e(t){return function(){return t}}t=t&&t.hasOwnProperty("default")?t.default:t;var n=function(){};n.thatReturns=e,n.thatReturnsFalse=e(!1),n.thatReturnsTrue=e(!0),n.thatReturnsNull=e(null),n.thatReturnsThis=function(){return this},n.thatReturnsArgument=function(t){return t};var o=n,r=function(t,e,n,o,r,u,i,c){if(!t){var a;if(void 0===e)a=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var s=[n,o,r,u,i,c],h=0;(a=new Error(e.replace(/%s/g,function(){return s[h++]}))).name="Invariant Violation"}throw a.framesToPop=1,a}},u="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",i=function(){function t(t,e,n,o,i,c){c!==u&&r(!1,"Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types")}function e(){return t}t.isRequired=t;var n={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e};return n.checkPropTypes=o,n.PropTypes=n,n},c=(function(t,e){e={exports:{}},t(e,e.exports),e.exports}(function(t){t.exports=i()}),function(){function t(t){this.value=t}function e(e){function n(r,u){try{var i=e[r](u),c=i.value;c instanceof t?Promise.resolve(c.value).then(function(t){n("next",t)},function(t){n("throw",t)}):o(i.done?"return":"normal",i.value)}catch(t){o("throw",t)}}function o(t,e){switch(t){case"return":r.resolve({value:e,done:!0});break;case"throw":r.reject(e);break;default:r.resolve({value:e,done:!1})}(r=r.next)?n(r.key,r.arg):u=null}var r,u;this._invoke=function(t,e){return new Promise(function(o,i){var c={key:t,arg:e,resolve:o,reject:i,next:null};u?u=u.next=c:(r=u=c,n(t,e))})},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)}}(),function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}),a=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},s=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},h=function(t){return t.touches[0].clientX},l=function(t){return t.touches[0].clientY},f=function(e){function n(){var t,o,r;c(this,n);for(var u=arguments.length,i=Array(u),a=0;a<u;a++)i[a]=arguments[a];return t=o=s(this,e.call.apply(e,[this].concat(i))),o.handleClick=function(){!o.usingTouch&&o.props.onPoint&&o.props.onPoint()},o.handleTouchStart=function(t){o.usingTouch=!0,o.touchStarted||(o.touchStarted=!0,o.touchMoved=!1,o.startX=h(t),o.startY=l(t))},o.handleTouchMove=function(t){if(!o.touchMoved){var e=o.props.tolerance;o.touchMoved=Math.abs(o.startX-h(t))>e||Math.abs(o.startY-l(t))>e}},o.handleTouchCancel=function(){o.touchStarted=o.touchMoved=!1,o.startX=o.startY=0},o.handleTouchEnd=function(){o.touchStarted=!1,!o.touchMoved&&o.props.onPoint&&o.props.onPoint()},r=t,s(o,r)}return a(n,e),n.prototype.componentWillMount=function(){this.usingTouch=!1},n.prototype.render=function(){var e=this.props.children,n=e?t.Children.only(e):t.createElement("button",null);return t.cloneElement(n,{onClick:this.handleClick,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchCancel:this.handleTouchCancel,onTouchEnd:this.handleTouchEnd})},n}(t.Component);return f.defaultProps={tolerance:10},f}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
111717
25
2748
87
3
19
1
+ Addedinvariant@^2.2.1
+ Addedprop-types@^15.5.6
+ Addedinvariant@2.2.4(transitive)
+ Addedreact@18.3.1(transitive)
- Removedasap@2.0.6(transitive)
- Removedcore-js@1.2.7(transitive)
- Removedcreate-react-class@15.7.0(transitive)
- Removedencoding@0.1.13(transitive)
- Removedfbjs@0.8.18(transitive)
- Removediconv-lite@0.6.3(transitive)
- Removedis-stream@1.1.0(transitive)
- Removedisomorphic-fetch@2.2.1(transitive)
- Removednode-fetch@1.7.3(transitive)
- Removedpromise@7.3.1(transitive)
- Removedreact@15.7.0(transitive)
- Removedsafer-buffer@2.1.2(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedua-parser-js@0.7.39(transitive)
- Removedwhatwg-fetch@3.6.20(transitive)