Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

make-event-props

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

make-event-props - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

dist/cjs/index.d.ts

165

dist/cjs/index.js
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.compositionEvents = exports.clipboardEvents = exports.animationEvents = exports.allEvents = void 0;
exports["default"] = makeEventProps;
exports.wheelEvents = exports.uiEvents = exports.transitionEvents = exports.touchEvents = exports.selectionEvents = exports.pointerEvents = exports.otherEvents = exports.mouseEvents = exports.mediaEvents = exports.keyboardEvents = exports.imageEvents = exports.genericEvents = exports.formEvents = exports.focusEvents = void 0;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.allEvents = exports.otherEvents = exports.transitionEvents = exports.animationEvents = exports.imageEvents = exports.mediaEvents = exports.wheelEvents = exports.uiEvents = exports.touchEvents = exports.selectionEvents = exports.pointerEvents = exports.mouseEvents = exports.genericEvents = exports.formEvents = exports.focusEvents = exports.keyboardEvents = exports.compositionEvents = exports.clipboardEvents = void 0;
// As defined on the list of supported events: https://reactjs.org/docs/events.html
var clipboardEvents = ['onCopy', 'onCut', 'onPaste'];
exports.clipboardEvents = clipboardEvents;
var compositionEvents = ['onCompositionEnd', 'onCompositionStart', 'onCompositionUpdate'];
exports.compositionEvents = compositionEvents;
var keyboardEvents = ['onKeyDown', 'onKeyPress', 'onKeyUp'];
exports.keyboardEvents = keyboardEvents;
var focusEvents = ['onFocus', 'onBlur'];
exports.focusEvents = focusEvents;
var formEvents = ['onChange', 'onInput', 'onInvalid', 'onReset', 'onSubmit'];
exports.formEvents = formEvents;
var genericEvents = ['onError', 'onLoad'];
exports.genericEvents = genericEvents;
var mouseEvents = ['onClick', 'onContextMenu', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp'];
exports.mouseEvents = mouseEvents;
var pointerEvents = ['onPointerDown', 'onPointerMove', 'onPointerUp', 'onPointerCancel', 'onGotPointerCapture', 'onLostPointerCapture', 'onPointerEnter', 'onPointerLeave', 'onPointerOver', 'onPointerOut'];
exports.pointerEvents = pointerEvents;
var selectionEvents = ['onSelect'];
exports.selectionEvents = selectionEvents;
var touchEvents = ['onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart'];
exports.touchEvents = touchEvents;
var uiEvents = ['onScroll'];
exports.uiEvents = uiEvents;
var wheelEvents = ['onWheel'];
exports.wheelEvents = wheelEvents;
var mediaEvents = ['onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded', 'onError', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting'];
exports.mediaEvents = mediaEvents;
var imageEvents = ['onLoad', 'onError'];
exports.imageEvents = imageEvents;
var animationEvents = ['onAnimationStart', 'onAnimationEnd', 'onAnimationIteration'];
exports.animationEvents = animationEvents;
var transitionEvents = ['onTransitionEnd'];
exports.transitionEvents = transitionEvents;
var otherEvents = ['onToggle'];
exports.otherEvents = otherEvents;
var allEvents = [].concat(clipboardEvents, compositionEvents, keyboardEvents, focusEvents, formEvents, genericEvents, mouseEvents, pointerEvents, selectionEvents, touchEvents, uiEvents, wheelEvents, mediaEvents, imageEvents, animationEvents, transitionEvents, otherEvents);
exports.clipboardEvents = ['onCopy', 'onCut', 'onPaste'];
exports.compositionEvents = [
'onCompositionEnd',
'onCompositionStart',
'onCompositionUpdate',
];
exports.keyboardEvents = ['onKeyDown', 'onKeyPress', 'onKeyUp'];
exports.focusEvents = ['onFocus', 'onBlur'];
exports.formEvents = ['onChange', 'onInput', 'onInvalid', 'onReset', 'onSubmit'];
exports.genericEvents = ['onError', 'onLoad'];
exports.mouseEvents = [
'onClick',
'onContextMenu',
'onDoubleClick',
'onDrag',
'onDragEnd',
'onDragEnter',
'onDragExit',
'onDragLeave',
'onDragOver',
'onDragStart',
'onDrop',
'onMouseDown',
'onMouseEnter',
'onMouseLeave',
'onMouseMove',
'onMouseOut',
'onMouseOver',
'onMouseUp',
];
exports.pointerEvents = [
'onPointerDown',
'onPointerMove',
'onPointerUp',
'onPointerCancel',
'onGotPointerCapture',
'onLostPointerCapture',
'onPointerEnter',
'onPointerLeave',
'onPointerOver',
'onPointerOut',
];
exports.selectionEvents = ['onSelect'];
exports.touchEvents = ['onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart'];
exports.uiEvents = ['onScroll'];
exports.wheelEvents = ['onWheel'];
exports.mediaEvents = [
'onAbort',
'onCanPlay',
'onCanPlayThrough',
'onDurationChange',
'onEmptied',
'onEncrypted',
'onEnded',
'onError',
'onLoadedData',
'onLoadedMetadata',
'onLoadStart',
'onPause',
'onPlay',
'onPlaying',
'onProgress',
'onRateChange',
'onSeeked',
'onSeeking',
'onStalled',
'onSuspend',
'onTimeUpdate',
'onVolumeChange',
'onWaiting',
];
exports.imageEvents = ['onLoad', 'onError'];
exports.animationEvents = [
'onAnimationStart',
'onAnimationEnd',
'onAnimationIteration',
];
exports.transitionEvents = ['onTransitionEnd'];
exports.otherEvents = ['onToggle'];
exports.allEvents = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], exports.clipboardEvents, true), exports.compositionEvents, true), exports.keyboardEvents, true), exports.focusEvents, true), exports.formEvents, true), exports.genericEvents, true), exports.mouseEvents, true), exports.pointerEvents, true), exports.selectionEvents, true), exports.touchEvents, true), exports.uiEvents, true), exports.wheelEvents, true), exports.mediaEvents, true), exports.imageEvents, true), exports.animationEvents, true), exports.transitionEvents, true), exports.otherEvents, true);
/**

@@ -52,18 +100,17 @@ * Returns an object with on-event callback props curried with provided args.

*/
exports.allEvents = allEvents;
function makeEventProps(props, getArgs) {
var eventProps = {};
allEvents.forEach(function (eventName) {
if (!(eventName in props)) {
return;
}
if (!getArgs) {
eventProps[eventName] = props[eventName];
return;
}
eventProps[eventName] = function (event) {
return props[eventName](event, getArgs(eventName));
};
});
return eventProps;
}
var eventProps = {};
exports.allEvents.forEach(function (eventName) {
var eventHandler = props[eventName];
if (!eventHandler) {
return;
}
if (!getArgs) {
eventProps[eventName] = eventHandler;
return;
}
eventProps[eventName] = function (event) { return eventHandler(event, getArgs(eventName)); };
});
return eventProps;
}
exports.default = makeEventProps;

@@ -0,4 +1,17 @@

var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
// As defined on the list of supported events: https://reactjs.org/docs/events.html
export var clipboardEvents = ['onCopy', 'onCut', 'onPaste'];
export var compositionEvents = ['onCompositionEnd', 'onCompositionStart', 'onCompositionUpdate'];
export var compositionEvents = [
'onCompositionEnd',
'onCompositionStart',
'onCompositionUpdate',
];
export var keyboardEvents = ['onKeyDown', 'onKeyPress', 'onKeyUp'];

@@ -8,4 +21,34 @@ export var focusEvents = ['onFocus', 'onBlur'];

export var genericEvents = ['onError', 'onLoad'];
export var mouseEvents = ['onClick', 'onContextMenu', 'onDoubleClick', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp'];
export var pointerEvents = ['onPointerDown', 'onPointerMove', 'onPointerUp', 'onPointerCancel', 'onGotPointerCapture', 'onLostPointerCapture', 'onPointerEnter', 'onPointerLeave', 'onPointerOver', 'onPointerOut'];
export var mouseEvents = [
'onClick',
'onContextMenu',
'onDoubleClick',
'onDrag',
'onDragEnd',
'onDragEnter',
'onDragExit',
'onDragLeave',
'onDragOver',
'onDragStart',
'onDrop',
'onMouseDown',
'onMouseEnter',
'onMouseLeave',
'onMouseMove',
'onMouseOut',
'onMouseOver',
'onMouseUp',
];
export var pointerEvents = [
'onPointerDown',
'onPointerMove',
'onPointerUp',
'onPointerCancel',
'onGotPointerCapture',
'onLostPointerCapture',
'onPointerEnter',
'onPointerLeave',
'onPointerOver',
'onPointerOut',
];
export var selectionEvents = ['onSelect'];

@@ -15,9 +58,36 @@ export var touchEvents = ['onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart'];

export var wheelEvents = ['onWheel'];
export var mediaEvents = ['onAbort', 'onCanPlay', 'onCanPlayThrough', 'onDurationChange', 'onEmptied', 'onEncrypted', 'onEnded', 'onError', 'onLoadedData', 'onLoadedMetadata', 'onLoadStart', 'onPause', 'onPlay', 'onPlaying', 'onProgress', 'onRateChange', 'onSeeked', 'onSeeking', 'onStalled', 'onSuspend', 'onTimeUpdate', 'onVolumeChange', 'onWaiting'];
export var mediaEvents = [
'onAbort',
'onCanPlay',
'onCanPlayThrough',
'onDurationChange',
'onEmptied',
'onEncrypted',
'onEnded',
'onError',
'onLoadedData',
'onLoadedMetadata',
'onLoadStart',
'onPause',
'onPlay',
'onPlaying',
'onProgress',
'onRateChange',
'onSeeked',
'onSeeking',
'onStalled',
'onSuspend',
'onTimeUpdate',
'onVolumeChange',
'onWaiting',
];
export var imageEvents = ['onLoad', 'onError'];
export var animationEvents = ['onAnimationStart', 'onAnimationEnd', 'onAnimationIteration'];
export var animationEvents = [
'onAnimationStart',
'onAnimationEnd',
'onAnimationIteration',
];
export var transitionEvents = ['onTransitionEnd'];
export var otherEvents = ['onToggle'];
export var allEvents = [].concat(clipboardEvents, compositionEvents, keyboardEvents, focusEvents, formEvents, genericEvents, mouseEvents, pointerEvents, selectionEvents, touchEvents, uiEvents, wheelEvents, mediaEvents, imageEvents, animationEvents, transitionEvents, otherEvents);
export var allEvents = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], clipboardEvents, true), compositionEvents, true), keyboardEvents, true), focusEvents, true), formEvents, true), genericEvents, true), mouseEvents, true), pointerEvents, true), selectionEvents, true), touchEvents, true), uiEvents, true), wheelEvents, true), mediaEvents, true), imageEvents, true), animationEvents, true), transitionEvents, true), otherEvents, true);
/**

@@ -30,16 +100,15 @@ * Returns an object with on-event callback props curried with provided args.

export default function makeEventProps(props, getArgs) {
var eventProps = {};
allEvents.forEach(function (eventName) {
if (!(eventName in props)) {
return;
}
if (!getArgs) {
eventProps[eventName] = props[eventName];
return;
}
eventProps[eventName] = function (event) {
return props[eventName](event, getArgs(eventName));
};
});
return eventProps;
}
var eventProps = {};
allEvents.forEach(function (eventName) {
var eventHandler = props[eventName];
if (!eventHandler) {
return;
}
if (!getArgs) {
eventProps[eventName] = eventHandler;
return;
}
eventProps[eventName] = function (event) { return eventHandler(event, getArgs(eventName)); };
});
return eventProps;
}
{
"name": "make-event-props",
"version": "1.4.0",
"version": "1.4.1",
"description": "Returns an object with on-event callback props curried with provided args.",

@@ -11,4 +11,4 @@ "main": "dist/cjs/index.js",

"build": "yarn build-esm && yarn build-cjs",
"build-esm": "BABEL_ENV=production-esm babel src -d dist/esm --ignore \"**/*.spec.js\"",
"build-cjs": "BABEL_ENV=production-cjs babel src -d dist/cjs --ignore \"**/*.spec.js\"",
"build-esm": "tsc --project tsconfig.build.json --outDir dist/esm --module esnext",
"build-cjs": "tsc --project tsconfig.build.json --outDir dist/cjs --module commonjs",
"clean": "rimraf dist",

@@ -19,3 +19,4 @@ "jest": "jest",

"prettier": "prettier --check . --cache",
"test": "yarn lint && yarn prettier && yarn jest"
"test": "yarn lint && yarn tsc && yarn prettier && yarn jest",
"tsc": "tsc --noEmit"
},

@@ -36,2 +37,6 @@ "keywords": [

"@babel/preset-env": "^7.15.0",
"@babel/preset-typescript": "^7.18.6",
"@types/jest": "^29.0.0",
"@typescript-eslint/eslint-plugin": "^5.41.0",
"@typescript-eslint/parser": "^5.44.0",
"eslint": "^8.26.0",

@@ -43,3 +48,4 @@ "eslint-config-wojtekmaj": "^0.7.1",

"pretty-quick": "^3.1.0",
"rimraf": "^3.0.0"
"rimraf": "^3.0.0",
"typescript": "^4.9.4"
},

@@ -46,0 +52,0 @@ "resolutions": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc