@bearei/react-util
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -28,4 +28,3 @@ /******/ var __webpack_modules__ = ({ | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "I": function() { return /* binding */ getPlatformEvent; }, | ||
/* harmony export */ "Z": function() { return /* binding */ handleEvent; } | ||
/* harmony export */ "p": function() { return /* binding */ getPlatformClickEvent; } | ||
/* harmony export */ }); | ||
@@ -35,11 +34,3 @@ /* harmony import */ var _getPlatform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(405); | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
var getPlatformEvent = function getPlatformEvent(eventFun) { | ||
var getPlatformClickEvent = function getPlatformClickEvent(eventFun) { | ||
var event = { | ||
@@ -50,2 +41,9 @@ reactNative: 'onPress', | ||
}; | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
e === null || e === void 0 ? void 0 : e.preventDefault(); | ||
e === null || e === void 0 ? void 0 : e.stopPropagation(); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
return _defineProperty({}, event[(0,_getPlatform__WEBPACK_IMPORTED_MODULE_0__/* .getPlatform */ .X)()], handleEvent(eventFun)); | ||
@@ -105,5 +103,4 @@ }; | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "II": function() { return /* reexport safe */ _userEvent__WEBPACK_IMPORTED_MODULE_1__.I; }, | ||
/* harmony export */ "Xf": function() { return /* reexport safe */ _getPlatform__WEBPACK_IMPORTED_MODULE_0__.X; }, | ||
/* harmony export */ "Zm": function() { return /* reexport safe */ _userEvent__WEBPACK_IMPORTED_MODULE_1__.Z; }, | ||
/* harmony export */ "pL": function() { return /* reexport safe */ _userEvent__WEBPACK_IMPORTED_MODULE_1__.p; }, | ||
/* harmony export */ "tq": function() { return /* reexport safe */ _getPlatform__WEBPACK_IMPORTED_MODULE_0__.t; } | ||
@@ -117,5 +114,4 @@ /* harmony export */ }); | ||
var __webpack_exports__getPlatform = __webpack_exports__.Xf; | ||
var __webpack_exports__getPlatformEvent = __webpack_exports__.II; | ||
var __webpack_exports__handleEvent = __webpack_exports__.Zm; | ||
var __webpack_exports__getPlatformClickEvent = __webpack_exports__.pL; | ||
var __webpack_exports__isMobile = __webpack_exports__.tq; | ||
export { __webpack_exports__getPlatform as getPlatform, __webpack_exports__getPlatformEvent as getPlatformEvent, __webpack_exports__handleEvent as handleEvent, __webpack_exports__isMobile as isMobile }; | ||
export { __webpack_exports__getPlatform as getPlatform, __webpack_exports__getPlatformClickEvent as getPlatformClickEvent, __webpack_exports__isMobile as isMobile }; |
/// <reference types="react" /> | ||
import { GestureResponderEvent } from 'react-native'; | ||
export declare type EventType = 'onClick' | 'onPress' | 'onTouchEnd'; | ||
export declare type HandleEvent = React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement> | GestureResponderEvent; | ||
export declare type EventFun = (e?: HandleEvent) => unknown; | ||
export declare const handleEvent: (callback?: EventFun) => (e?: HandleEvent) => unknown; | ||
export declare const getPlatformEvent: (eventFun?: EventFun) => Record<EventType, EventFun | undefined>; | ||
export declare type OnClickEvent = 'onClick' | 'onPress' | 'onTouchEnd'; | ||
export declare type HandleClickEvent = React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement> | GestureResponderEvent; | ||
export declare type ClickEventFun = (e?: HandleClickEvent) => unknown; | ||
export declare const getPlatformClickEvent: (eventFun?: ClickEventFun) => Record<OnClickEvent, ClickEventFun | undefined>; |
@@ -73,4 +73,3 @@ /******/ var __webpack_modules__ = ({ | ||
/* harmony export */ __webpack_require__.d(__webpack_exports__, { | ||
/* harmony export */ "I": function() { return /* binding */ getPlatformEvent; }, | ||
/* harmony export */ "Z": function() { return /* binding */ handleEvent; } | ||
/* harmony export */ "p": function() { return /* binding */ getPlatformClickEvent; } | ||
/* harmony export */ }); | ||
@@ -80,11 +79,3 @@ /* harmony import */ var _getPlatform__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(405); | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
var getPlatformEvent = function getPlatformEvent(eventFun) { | ||
var getPlatformClickEvent = function getPlatformClickEvent(eventFun) { | ||
var event = { | ||
@@ -95,7 +86,13 @@ reactNative: 'onPress', | ||
}; | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
e === null || e === void 0 ? void 0 : e.preventDefault(); | ||
e === null || e === void 0 ? void 0 : e.stopPropagation(); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
return _defineProperty({}, event[(0,_getPlatform__WEBPACK_IMPORTED_MODULE_0__/* .getPlatform */ .X)()], handleEvent(eventFun)); | ||
}; | ||
}(); | ||
var __webpack_exports__getPlatformEvent = __webpack_exports__.I; | ||
var __webpack_exports__handleEvent = __webpack_exports__.Z; | ||
export { __webpack_exports__getPlatformEvent as getPlatformEvent, __webpack_exports__handleEvent as handleEvent }; | ||
var __webpack_exports__getPlatformClickEvent = __webpack_exports__.p; | ||
export { __webpack_exports__getPlatformClickEvent as getPlatformClickEvent }; |
@@ -73,14 +73,5 @@ /******/ (function() { // webpackBootstrap | ||
})); | ||
exports.getPlatformEvent = exports.handleEvent = void 0; | ||
exports.getPlatformClickEvent = void 0; | ||
var getPlatform_1 = __webpack_require__(405); | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
exports.handleEvent = handleEvent; | ||
var getPlatformEvent = function getPlatformEvent(eventFun) { | ||
var getPlatformClickEvent = function getPlatformClickEvent(eventFun) { | ||
var event = { | ||
@@ -91,5 +82,12 @@ reactNative: 'onPress', | ||
}; | ||
return _defineProperty({}, event[(0, getPlatform_1.getPlatform)()], (0, exports.handleEvent)(eventFun)); | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
e === null || e === void 0 ? void 0 : e.preventDefault(); | ||
e === null || e === void 0 ? void 0 : e.stopPropagation(); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
return _defineProperty({}, event[(0, getPlatform_1.getPlatform)()], handleEvent(eventFun)); | ||
}; | ||
exports.getPlatformEvent = getPlatformEvent; | ||
exports.getPlatformClickEvent = getPlatformClickEvent; | ||
@@ -96,0 +94,0 @@ /***/ }) |
/// <reference types="react" /> | ||
import { GestureResponderEvent } from 'react-native'; | ||
export declare type EventType = 'onClick' | 'onPress' | 'onTouchEnd'; | ||
export declare type HandleEvent = React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement> | GestureResponderEvent; | ||
export declare type EventFun = (e?: HandleEvent) => unknown; | ||
export declare const handleEvent: (callback?: EventFun) => (e?: HandleEvent) => unknown; | ||
export declare const getPlatformEvent: (eventFun?: EventFun) => Record<EventType, EventFun | undefined>; | ||
export declare type OnClickEvent = 'onClick' | 'onPress' | 'onTouchEnd'; | ||
export declare type HandleClickEvent = React.MouseEvent<HTMLElement, MouseEvent> | React.TouchEvent<HTMLElement> | GestureResponderEvent; | ||
export declare type ClickEventFun = (e?: HandleClickEvent) => unknown; | ||
export declare const getPlatformClickEvent: (eventFun?: ClickEventFun) => Record<OnClickEvent, ClickEventFun | undefined>; |
@@ -28,34 +28,2 @@ /******/ (function() { // webpackBootstrap | ||
/***/ }), | ||
/***/ 668: | ||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) { | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.getPlatformEvent = exports.handleEvent = void 0; | ||
var getPlatform_1 = __webpack_require__(405); | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
var _a, _b; | ||
(_a = e === null || e === void 0 ? void 0 : e.preventDefault) === null || _a === void 0 ? void 0 : _a.call(e); | ||
(_b = e === null || e === void 0 ? void 0 : e.stopPropagation) === null || _b === void 0 ? void 0 : _b.call(e); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
exports.handleEvent = handleEvent; | ||
var getPlatformEvent = function getPlatformEvent(eventFun) { | ||
var event = { | ||
reactNative: 'onPress', | ||
pcBrowser: 'onClick', | ||
mobileBrowser: 'onTouchEnd' | ||
}; | ||
return _defineProperty({}, event[(0, getPlatform_1.getPlatform)()], (0, exports.handleEvent)(eventFun)); | ||
}; | ||
exports.getPlatformEvent = getPlatformEvent; | ||
/***/ }) | ||
@@ -90,12 +58,35 @@ | ||
/************************************************************************/ | ||
/******/ | ||
/******/ // startup | ||
/******/ // Load entry module and return exports | ||
/******/ // This entry module is referenced by other modules so it can't be inlined | ||
/******/ var __webpack_exports__ = __webpack_require__(668); | ||
/******/ var __webpack_export_target__ = exports; | ||
/******/ for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i]; | ||
/******/ if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); | ||
/******/ | ||
var __webpack_exports__ = {}; | ||
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. | ||
!function() { | ||
var exports = __webpack_exports__; | ||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } | ||
Object.defineProperty(exports, "__esModule", ({ | ||
value: true | ||
})); | ||
exports.getPlatformClickEvent = void 0; | ||
var getPlatform_1 = __webpack_require__(405); | ||
var getPlatformClickEvent = function getPlatformClickEvent(eventFun) { | ||
var event = { | ||
reactNative: 'onPress', | ||
pcBrowser: 'onClick', | ||
mobileBrowser: 'onTouchEnd' | ||
}; | ||
var handleEvent = function handleEvent(callback) { | ||
return function (e) { | ||
e === null || e === void 0 ? void 0 : e.preventDefault(); | ||
e === null || e === void 0 ? void 0 : e.stopPropagation(); | ||
return callback === null || callback === void 0 ? void 0 : callback(e); | ||
}; | ||
}; | ||
return _defineProperty({}, event[(0, getPlatform_1.getPlatform)()], handleEvent(eventFun)); | ||
}; | ||
exports.getPlatformClickEvent = getPlatformClickEvent; | ||
}(); | ||
var __webpack_export_target__ = exports; | ||
for(var i in __webpack_exports__) __webpack_export_target__[i] = __webpack_exports__[i]; | ||
if(__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, "__esModule", { value: true }); | ||
/******/ })() | ||
; |
{ | ||
"name": "@bearei/react-util", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "types": "./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
37227
526