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

hook-book

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hook-book - npm Package Compare versions

Comparing version 0.0.1-beta.13 to 0.0.1-beta.14

43

index.js

@@ -1,3 +0,40 @@

export { default as useDrag } from './use-drag';
export { default as useKeyPress } from './use-keypress';
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3JlY2lwZXMvaW5kZXguanMiXSwibmFtZXMiOlsiZGVmYXVsdCIsInVzZURyYWciLCJ1c2VLZXlQcmVzcyJdLCJtYXBwaW5ncyI6IkFBQUEsU0FBUUEsT0FBTyxJQUFJQyxPQUFuQixRQUFpQyxZQUFqQztBQUNBLFNBQVFELE9BQU8sSUFBSUUsV0FBbkIsUUFBcUMsZ0JBQXJDIiwic291cmNlc0NvbnRlbnQiOlsiZXhwb3J0IHtkZWZhdWx0IGFzIHVzZURyYWd9IGZyb20gJy4vdXNlLWRyYWcnXG5leHBvcnQge2RlZmF1bHQgYXMgdXNlS2V5UHJlc3N9IGZyb20gJy4vdXNlLWtleXByZXNzJ1xuIl19
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "useDebounce", {
enumerable: true,
get: function get() {
return _useDebounce.default;
}
});
Object.defineProperty(exports, "useDrag", {
enumerable: true,
get: function get() {
return _useDrag.default;
}
});
Object.defineProperty(exports, "useKeyPress", {
enumerable: true,
get: function get() {
return _useKeypress.default;
}
});
Object.defineProperty(exports, "useThrottle", {
enumerable: true,
get: function get() {
return _useThrottle.default;
}
});
var _useDebounce = _interopRequireDefault(require("./use-debounce"));
var _useDrag = _interopRequireDefault(require("./use-drag"));
var _useKeypress = _interopRequireDefault(require("./use-keypress"));
var _useThrottle = _interopRequireDefault(require("./use-throttle"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3JlY2lwZXMvaW5kZXguanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUE7O0FBQ0E7O0FBQ0E7O0FBQ0EiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQge2RlZmF1bHQgYXMgdXNlRGVib3VuY2V9IGZyb20gJy4vdXNlLWRlYm91bmNlJ1xuZXhwb3J0IHtkZWZhdWx0IGFzIHVzZURyYWd9IGZyb20gJy4vdXNlLWRyYWcnXG5leHBvcnQge2RlZmF1bHQgYXMgdXNlS2V5UHJlc3N9IGZyb20gJy4vdXNlLWtleXByZXNzJ1xuZXhwb3J0IHtkZWZhdWx0IGFzIHVzZVRocm90dGxlfSBmcm9tICcuL3VzZS10aHJvdHRsZSdcbiJdfQ==

2

package.json
{
"name": "hook-book",
"version": "0.0.1-beta.13",
"version": "0.0.1-beta.14",
"description": "A collection of custom React Hooks",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,1 +1,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useDebounce;
var _react = require("react");
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }

@@ -9,5 +18,4 @@

import { useRef, useEffect, useState } from 'react';
export default function useDebounce(value, delay) {
var _useState = useState(value),
function useDebounce(value, delay) {
var _useState = (0, _react.useState)(value),
_useState2 = _slicedToArray(_useState, 2),

@@ -18,6 +26,6 @@ debouncedValue = _useState2[0],

var queue = useRef(null);
var timeout = useRef(null); // Clear the timeout on component unmount.
var queue = (0, _react.useRef)(null);
var timeout = (0, _react.useRef)(null); // Clear the timeout on component unmount.
useEffect(function () {
(0, _react.useEffect)(function () {
return function () {

@@ -27,3 +35,3 @@ return clearTimeout(timeout.current);

}, []);
useEffect(function () {
(0, _react.useEffect)(function () {
// Avoid triggering the update loop on the component mount lifecycle.

@@ -58,2 +66,2 @@ // Use the absence of the queue reference to indentify this case.

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3JlY2lwZXMvdXNlLWRlYm91bmNlL2luZGV4LmpzIl0sIm5hbWVzIjpbInVzZVJlZiIsInVzZUVmZmVjdCIsInVzZVN0YXRlIiwidXNlRGVib3VuY2UiLCJ2YWx1ZSIsImRlbGF5IiwiZGVib3VuY2VkVmFsdWUiLCJzZXREZWJvdW5jZWRWYWx1ZSIsInF1ZXVlIiwidGltZW91dCIsImNsZWFyVGltZW91dCIsImN1cnJlbnQiLCJ1cGRhdGVWYWx1ZSIsImxlbmd0aCIsInBvcCIsInNldFRpbWVvdXQiLCJwdXNoIl0sIm1hcHBpbmdzIjoiOzs7Ozs7OztBQUFBLFNBQVFBLE1BQVIsRUFBZ0JDLFNBQWhCLEVBQTJCQyxRQUEzQixRQUEwQyxPQUExQztBQUVBLGVBQWUsU0FBU0MsV0FBVCxDQUFxQkMsS0FBckIsRUFBNEJDLEtBQTVCLEVBQW1DO0FBQUEsa0JBQ0ZILFFBQVEsQ0FBQ0UsS0FBRCxDQUROO0FBQUE7QUFBQSxNQUN2Q0UsY0FEdUM7QUFBQSxNQUN2QkMsaUJBRHVCLGtCQUU5Qzs7O0FBQ0EsTUFBTUMsS0FBSyxHQUFHUixNQUFNLENBQUMsSUFBRCxDQUFwQjtBQUNBLE1BQU1TLE9BQU8sR0FBR1QsTUFBTSxDQUFDLElBQUQsQ0FBdEIsQ0FKOEMsQ0FNOUM7O0FBQ0FDLEVBQUFBLFNBQVMsQ0FBQztBQUFBLFdBQU07QUFBQSxhQUFNUyxZQUFZLENBQUNELE9BQU8sQ0FBQ0UsT0FBVCxDQUFsQjtBQUFBLEtBQU47QUFBQSxHQUFELEV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lbnQpXG4gICAgICAgICAgICAgICAgcmV0dXJuXG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIFNldCB0aGUgdmFsdWUgYXMgdGhlIGxhdGVzdCB1cGRhdGUgaW4gdGhlIHF1ZXVlIGFuZCBjbGVhclxuICAgICAgICAgICAgLy8gdGhlIHByaW9yIHF1ZXVlZCB1cGRhdGVzLlxuICAgICAgICAgICAgY29uc3QgZGVib3VuY2VkVmFsdWUgPSBxdWV1ZS5jdXJyZW50LnBvcCgpXG4gICAgICAgICAgICBxdWV1ZS5jdXJyZW50ID0gW11cbiAgICAgICAgICAgIHRpbWVvdXQuY3VycmVudCA9IHNldFRpbWVvdXQodXBkYXRlVmFsdWUsIGRlbGF5KVxuICAgICAgICAgICAgc2V0RGVib3VuY2VkVmFsdWUoZGVib3VuY2VkVmFsdWUpXG4gICAgICAgIH1cblxuICAgICAgICAvLyBBZGQgZXZlcnkgdmFsdWUgY2hhbmdlIHRvIHRoZSB1cGRhdGVcbiAgICAgICAgcXVldWUuY3VycmVudC5wdXNoKHZhbHVlKVxuXG4gICAgICAgIC8vIElmIHRoZXJlIGlzIGN1cnJlbnRseSBhIGNoYW5nZSBxdWV1ZWQgdG8gb2NjdXIsIHdlIGRvIG5vdGhpbmcuXG4gICAgICAgIC8vIE90aGVyd2lzZSwgdHJpZ2dlciB0aGUgdXBkYXRlIGxvb3AgYnkgc2V0dGluZyB0aGUgdGltZW91dC5cbiAgICAgICAgdGltZW91dC5jdXJyZW50ID0gdGltZW91dC5jdXJyZW50IHx8IHNldFRpbWVvdXQodXBkYXRlVmFsdWUsIDApXG4gICAgfSwgW3ZhbHVlXSlcblxuICAgIHJldHVybiBkZWJvdW5jZWRWYWx1ZVxufVxuIl19
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3JlY2lwZXMvdXNlLWRlYm91bmNlL2luZGV4LmpzIl0sIm5hbWVzIjpbInVzZ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sdWUoZGVib3VuY2VkVmFsdWUpXG4gICAgICAgIH1cblxuICAgICAgICAvLyBBZGQgZXZlcnkgdmFsdWUgY2hhbmdlIHRvIHRoZSB1cGRhdGVcbiAgICAgICAgcXVldWUuY3VycmVudC5wdXNoKHZhbHVlKVxuXG4gICAgICAgIC8vIElmIHRoZXJlIGlzIGN1cnJlbnRseSBhIGNoYW5nZSBxdWV1ZWQgdG8gb2NjdXIsIHdlIGRvIG5vdGhpbmcuXG4gICAgICAgIC8vIE90aGVyd2lzZSwgdHJpZ2dlciB0aGUgdXBkYXRlIGxvb3AgYnkgc2V0dGluZyB0aGUgdGltZW91dC5cbiAgICAgICAgdGltZW91dC5jdXJyZW50ID0gdGltZW91dC5jdXJyZW50IHx8IHNldFRpbWVvdXQodXBkYXRlVmFsdWUsIDApXG4gICAgfSwgW3ZhbHVlXSlcblxuICAgIHJldHVybiBkZWJvdW5jZWRWYWx1ZVxufVxuIl19

@@ -0,1 +1,16 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = useDrag;
var _react = require("react");
var _reducer = _interopRequireWildcard(require("./reducer"));
var _utils = require("../utils");
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }

@@ -9,10 +24,8 @@

import { useEffect, useReducer } from 'react';
import reducer, { initialState } from './reducer';
import { bulkAddEventListener, bulkRemoveEventListener } from '../utils';
var DRAG_START_EVENTS = ['mousedown', 'touchstart'];
var DRAG_EVENTS = ['mousemove', 'touchmove'];
var DRAG_END_EVENTS = ['mouseup', 'touchcancel', 'touchend'];
export default function useDrag(ref) {
var _useReducer = useReducer(reducer, initialState),
function useDrag(ref) {
var _useReducer = (0, _react.useReducer)(_reducer.default, _reducer.initialState),
_useReducer2 = _slicedToArray(_useReducer, 2),

@@ -51,18 +64,18 @@ state = _useReducer2[0],

useEffect(function () {
(0, _react.useEffect)(function () {
// Listen for events indicating that dragging has begun
bulkAddEventListener(ref.current, DRAG_START_EVENTS, onDragStart);
(0, _utils.bulkAddEventListener)(ref.current, DRAG_START_EVENTS, onDragStart);
return function () {
return bulkRemoveEventListener(ref.current, DRAG_START_EVENTS, onDragStart);
return (0, _utils.bulkRemoveEventListener)(ref.current, DRAG_START_EVENTS, onDragStart);
};
}, [ref.current]);
useEffect(function () {
(0, _react.useEffect)(function () {
// Only need to listen for drag and drag end events when dragging has started
if (isDragging) {
bulkAddEventListener(window, DRAG_EVENTS, onDrag);
bulkAddEventListener(window, DRAG_END_EVENTS, onDragEnd);
(0, _utils.bulkAddEventListener)(window, DRAG_EVENTS, onDrag);
(0, _utils.bulkAddEventListener)(window, DRAG_END_EVENTS, onDragEnd);
window.addEventListener('blur', onDragEnd);
} else {
bulkRemoveEventListener(window, DRAG_EVENTS, onDrag);
bulkRemoveEventListener(window, DRAG_END_EVENTS, onDragEnd);
(0, _utils.bulkRemoveEventListener)(window, DRAG_EVENTS, onDrag);
(0, _utils.bulkRemoveEventListener)(window, DRAG_END_EVENTS, onDragEnd);
window.removeEventListener('blur', onDragEnd);

@@ -72,4 +85,4 @@ }

return function () {
bulkRemoveEventListener(window, DRAG_EVENTS, onDrag);
bulkRemoveEventListener(window, DRAG_END_EVENTS, onDragEnd);
(0, _utils.bulkRemoveEventListener)(window, DRAG_EVENTS, onDrag);
(0, _utils.bulkRemoveEventListener)(window, DRAG_END_EVENTS, onDragEnd);
window.removeEventListener('blur', onDragEnd);

@@ -80,2 +93,2 @@ };

}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3V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JdfQ==

@@ -0,1 +1,10 @@

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = exports.initialState = void 0;
var _utils = require("../utils");
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

@@ -5,11 +14,12 @@

import { getPointerPosition } from '../utils';
export var initialState = {
var initialState = {
isDragging: false
};
export default (function (state, action) {
exports.initialState = initialState;
var _default = function _default(state, action) {
switch (action.type) {
case 'DRAG_START':
{
var _getPointerPosition = getPointerPosition(action.payload.event),
var _getPointerPosition = (0, _utils.getPointerPosition)(action.payload.event),
x = _getPointerPosition.x,

@@ -29,3 +39,3 @@ y = _getPointerPosition.y;

{
var _getPointerPosition2 = getPointerPosition(action.payload.event),
var _getPointerPosition2 = (0, _utils.getPointerPosition)(action.payload.event),
_x = _getPointerPosition2.x,

@@ -47,3 +57,5 @@ _y = _getPointerPosition2.y;

}
});
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3JlY2lwZXMvdXNlLWRyYWcvcmVkdWNlci5qcyJdLCJuYW1lcyI6WyJnZXRQb2ludGVyUG9zaXRpb24iLCJpbml0aWFsU3RhdGUiLCJpc0RyYWdnaW5nIiwic3RhdGUiLCJhY3Rpb24iLCJ0eXBlIiwicGF5bG9hZCIsImV2ZW50IiwieCIsInkiLCJzdGFydFgiLCJzdGFydFkiLCJwb3NpdGlvbkNoYW5nZWQiXSwibWFwcGluZ3MiOiI7Ozs7QUFBQSxTQUFRQSxrQkFBUixRQUFpQyxVQUFqQztBQUVBLE9BQU8sSUFBTUMsWUFBWSxHQUFHO0FBQ3hCQyx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sIHl9ID0gZ2V0UG9pbnRlclBvc2l0aW9uKGFjdGlvbi5wYXlsb2FkLmV2ZW50KVxuICAgICAgICAgICAgY29uc3QgcG9zaXRpb25DaGFuZ2VkID0geCAhPT0gc3RhdGUueCB8fCB5ICE9PSBzdGF0ZS55XG4gICAgICAgICAgICByZXR1cm4gc3RhdGUuaXNEcmFnZ2luZyAmJiBwb3NpdGlvbkNoYW5nZWQgPyB7Li4uc3RhdGUsIHgsIHl9IDogc3RhdGVcbiAgICAgICAgfVxuXG4gICAgICAgIGNhc2UgJ0RSQUdfRU5EJzpcbiAgICAgICAgICAgIHJldHVybiBpbml0aWFsU3RhdGVcblxuICAgICAgICBkZWZhdWx0OlxuICAgICAgICAgICAgcmV0dXJuIHN0YXRlXG4gICAgfVxufVxuIl19
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