re-resizable
Advanced tools
Comparing version 6.5.4 to 6.5.5
@@ -11,14 +11,14 @@ 'use strict'; | ||
/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
this file except in compliance with the License. You may obtain a copy of the | ||
License at http://www.apache.org/licenses/LICENSE-2.0 | ||
Copyright (c) Microsoft Corporation. | ||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
MERCHANTABLITY OR NON-INFRINGEMENT. | ||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted. | ||
See the Apache Version 2.0 License for specific language governing permissions | ||
and limitations under the License. | ||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | ||
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
***************************************************************************** */ | ||
@@ -30,3 +30,3 @@ /* global Reflect, Promise */ | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
@@ -141,2 +141,10 @@ }; | ||
}); | ||
// INFO: In case of window is a Proxy and does not porxy Events correctly, use isTouchEvent & isMouseEvent to distinguish event type instead of `instanceof`. | ||
var isTouchEvent = function (event) { | ||
return Boolean(event.touches && event.touches.length); | ||
}; | ||
var isMouseEvent = function (event) { | ||
return Boolean((event.clientX || event.clientX === 0) && | ||
(event.clientY || event.clientY === 0)); | ||
}; | ||
var findClosestSnap = memoize(function (n, snapArray, snapGap) { | ||
@@ -299,3 +307,3 @@ if (snapGap === void 0) { snapGap = 0; } | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -313,3 +321,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -321,3 +329,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -340,3 +348,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -365,3 +373,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -396,3 +404,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -619,3 +627,3 @@ }); | ||
var clientY = 0; | ||
if (event.nativeEvent instanceof this.window.MouseEvent) { | ||
if (event.nativeEvent && isMouseEvent(event.nativeEvent)) { | ||
clientX = event.nativeEvent.clientX; | ||
@@ -630,3 +638,3 @@ clientY = event.nativeEvent.clientY; | ||
} | ||
else if (event.nativeEvent instanceof this.window.TouchEvent) { | ||
else if (event.nativeEvent && isTouchEvent(event.nativeEvent)) { | ||
clientX = event.nativeEvent.touches[0].clientX; | ||
@@ -686,3 +694,3 @@ clientY = event.nativeEvent.touches[0].clientY; | ||
} | ||
if (this.window.TouchEvent && event instanceof this.window.TouchEvent) { | ||
if (this.window.TouchEvent && isTouchEvent(event)) { | ||
try { | ||
@@ -697,4 +705,4 @@ event.preventDefault(); | ||
var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight; | ||
var clientX = event instanceof this.window.MouseEvent ? event.clientX : event.touches[0].clientX; | ||
var clientY = event instanceof this.window.MouseEvent ? event.clientY : event.touches[0].clientY; | ||
var clientX = isTouchEvent(event) ? event.touches[0].clientX : event.clientX; | ||
var clientY = isTouchEvent(event) ? event.touches[0].clientY : event.clientY; | ||
var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height; | ||
@@ -816,3 +824,2 @@ var parentSize = this.getParentSize(); | ||
var _this = this; | ||
var _a; | ||
var extendsProps = Object.keys(this.props).reduce(function (acc, key) { | ||
@@ -829,3 +836,3 @@ if (definedProps.indexOf(key) !== -1) { | ||
} | ||
var Wrapper = (_a = this.props.as) !== null && _a !== void 0 ? _a : 'div'; | ||
var Wrapper = this.props.as || 'div'; | ||
return (React.createElement(Wrapper, __assign({ ref: this.ref, style: style, className: this.props.className }, extendsProps), | ||
@@ -832,0 +839,0 @@ this.state.isResizing && React.createElement("div", { style: this.state.backgroundStyle }), |
@@ -37,2 +37,10 @@ var __extends = (this && this.__extends) || (function () { | ||
}); | ||
// INFO: In case of window is a Proxy and does not porxy Events correctly, use isTouchEvent & isMouseEvent to distinguish event type instead of `instanceof`. | ||
var isTouchEvent = function (event) { | ||
return Boolean(event.touches && event.touches.length); | ||
}; | ||
var isMouseEvent = function (event) { | ||
return Boolean((event.clientX || event.clientX === 0) && | ||
(event.clientY || event.clientY === 0)); | ||
}; | ||
var findClosestSnap = memoize(function (n, snapArray, snapGap) { | ||
@@ -195,3 +203,3 @@ if (snapGap === void 0) { snapGap = 0; } | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -209,3 +217,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -217,3 +225,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -236,3 +244,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -261,3 +269,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -292,3 +300,3 @@ }); | ||
}, | ||
enumerable: true, | ||
enumerable: false, | ||
configurable: true | ||
@@ -515,3 +523,3 @@ }); | ||
var clientY = 0; | ||
if (event.nativeEvent instanceof this.window.MouseEvent) { | ||
if (event.nativeEvent && isMouseEvent(event.nativeEvent)) { | ||
clientX = event.nativeEvent.clientX; | ||
@@ -526,3 +534,3 @@ clientY = event.nativeEvent.clientY; | ||
} | ||
else if (event.nativeEvent instanceof this.window.TouchEvent) { | ||
else if (event.nativeEvent && isTouchEvent(event.nativeEvent)) { | ||
clientX = event.nativeEvent.touches[0].clientX; | ||
@@ -582,3 +590,3 @@ clientY = event.nativeEvent.touches[0].clientY; | ||
} | ||
if (this.window.TouchEvent && event instanceof this.window.TouchEvent) { | ||
if (this.window.TouchEvent && isTouchEvent(event)) { | ||
try { | ||
@@ -593,4 +601,4 @@ event.preventDefault(); | ||
var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight; | ||
var clientX = event instanceof this.window.MouseEvent ? event.clientX : event.touches[0].clientX; | ||
var clientY = event instanceof this.window.MouseEvent ? event.clientY : event.touches[0].clientY; | ||
var clientX = isTouchEvent(event) ? event.touches[0].clientX : event.clientX; | ||
var clientY = isTouchEvent(event) ? event.touches[0].clientY : event.clientY; | ||
var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height; | ||
@@ -712,3 +720,2 @@ var parentSize = this.getParentSize(); | ||
var _this = this; | ||
var _a; | ||
var extendsProps = Object.keys(this.props).reduce(function (acc, key) { | ||
@@ -725,3 +732,3 @@ if (definedProps.indexOf(key) !== -1) { | ||
} | ||
var Wrapper = (_a = this.props.as) !== null && _a !== void 0 ? _a : 'div'; | ||
var Wrapper = this.props.as || 'div'; | ||
return (React.createElement(Wrapper, __assign({ ref: this.ref, style: style, className: this.props.className }, extendsProps), | ||
@@ -728,0 +735,0 @@ this.state.isResizing && React.createElement("div", { style: this.state.backgroundStyle }), |
@@ -12,5 +12,5 @@ import * as React from 'react'; | ||
export declare class Resizer extends React.PureComponent<Props> { | ||
onMouseDown: (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => void; | ||
onMouseDown: (e: React.MouseEvent<HTMLDivElement>) => void; | ||
onTouchStart: (e: React.TouchEvent<HTMLDivElement>) => void; | ||
render(): JSX.Element; | ||
} |
{ | ||
"name": "re-resizable", | ||
"version": "6.5.4", | ||
"version": "6.5.5", | ||
"description": "Resizable component for React.", | ||
@@ -50,10 +50,10 @@ "title": "re-resizable", | ||
"@babel/types": "7.9.6", | ||
"@emotion/core": "10.0.22", | ||
"@emotion/core": "10.0.35", | ||
"@storybook/addon-info": "5.3.19", | ||
"@storybook/addon-options": "5.3.19", | ||
"@storybook/react": "5.3.19", | ||
"@types/node": "12.12.50", | ||
"@types/node": "12.12.54", | ||
"@types/react": "16.8.7", | ||
"@types/react-dom": "16.9.8", | ||
"@types/sinon": "9.0.4", | ||
"@types/sinon": "9.0.5", | ||
"avaron": "0.2.0", | ||
@@ -85,10 +85,10 @@ "babel-core": "7.0.0-bridge.0", | ||
"rollup-plugin-replace": "2.2.0", | ||
"rollup-plugin-typescript2": "0.27.1", | ||
"rollup-plugin-typescript2": "0.27.2", | ||
"rollup-watch": "4.3.1", | ||
"sinon": "9.0.2", | ||
"tslint": "6.1.2", | ||
"sinon": "9.0.3", | ||
"tslint": "6.1.3", | ||
"tslint-config-google": "1.0.1", | ||
"tslint-config-prettier": "1.18.0", | ||
"tslint-plugin-prettier": "2.3.0", | ||
"typescript": "3.9.6" | ||
"typescript": "4.0.2" | ||
}, | ||
@@ -95,0 +95,0 @@ "typings": "./lib/index.d.ts", |
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
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
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
180044
0
2926