@dh-react-hooks/use-scroll
Advanced tools
Comparing version 0.2.1 to 0.2.4
@@ -7,6 +7,3 @@ module.exports = { | ||
}, | ||
extends: [ | ||
'plugin:@typescript-eslint/recommended', | ||
'prettier/@typescript-eslint' | ||
], | ||
extends: ['plugin:@typescript-eslint/recommended', 'prettier'], | ||
plugins: ['@typescript-eslint', 'react', 'react-hooks'], | ||
@@ -13,0 +10,0 @@ parserOptions: { |
@@ -6,2 +6,30 @@ # Change Log | ||
## 0.2.4 (2023-06-18) | ||
**Note:** Version bump only for package @dh-react-hooks/use-scroll | ||
## 0.2.3 (2023-06-18) | ||
**Note:** Version bump only for package @dh-react-hooks/use-scroll | ||
## [0.2.2](https://github.com/danhuang1202/DrHooks/compare/@dh-react-hooks/use-scroll@0.2.1...@dh-react-hooks/use-scroll@0.2.2) (2023-06-18) | ||
### Bug Fixes | ||
* add react@18 to peerDependencies ([9ce2140](https://github.com/danhuang1202/DrHooks/commit/9ce2140e2e7f8d3f63c8d51dc018ce472fe8f20e)) | ||
* update package.json and package-lock.json ([2d14baa](https://github.com/danhuang1202/DrHooks/commit/2d14baa41b5aad1f55a2e47b5f5850a5cc35d599)) | ||
## [0.2.1](https://github.com/danhuang1202/DrHooks/compare/@dh-react-hooks/use-scroll@0.2.0...@dh-react-hooks/use-scroll@0.2.1) (2021-02-21) | ||
@@ -8,0 +36,0 @@ |
import { useRef, useState, useEffect } from 'react'; | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { | ||
return; | ||
} | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (null != _i) { | ||
var _s, | ||
_e, | ||
_x, | ||
_r, | ||
_arr = [], | ||
_n = !0, | ||
_d = !1; | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
if (_x = (_i = _i.call(arr)).next, 0 === i) { | ||
if (Object(_i) !== _i) return; | ||
_n = !1; | ||
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
if (_d) throw _e; | ||
try { | ||
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
return _arr; | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -47,13 +55,10 @@ | ||
var requestId = useRef(0); | ||
var _useState = useState(0), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
x = _useState2[0], | ||
setX = _useState2[1]; | ||
_useState2 = _slicedToArray(_useState, 2), | ||
x = _useState2[0], | ||
setX = _useState2[1]; | ||
var _useState3 = useState(0), | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
y = _useState4[0], | ||
setY = _useState4[1]; | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
y = _useState4[0], | ||
setY = _useState4[1]; | ||
useEffect(function () { | ||
@@ -67,3 +72,2 @@ var scrollHandler = function scrollHandler() { | ||
}; | ||
window.addEventListener('scroll', scrollHandler); | ||
@@ -70,0 +74,0 @@ return function () { |
@@ -5,42 +5,50 @@ 'use strict'; | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _iterableToArrayLimit(arr, i) { | ||
if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) { | ||
return; | ||
} | ||
var _arr = []; | ||
var _n = true; | ||
var _d = false; | ||
var _e = undefined; | ||
try { | ||
for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { | ||
_arr.push(_s.value); | ||
if (i && _arr.length === i) break; | ||
} | ||
} catch (err) { | ||
_d = true; | ||
_e = err; | ||
} finally { | ||
var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; | ||
if (null != _i) { | ||
var _s, | ||
_e, | ||
_x, | ||
_r, | ||
_arr = [], | ||
_n = !0, | ||
_d = !1; | ||
try { | ||
if (!_n && _i["return"] != null) _i["return"](); | ||
if (_x = (_i = _i.call(arr)).next, 0 === i) { | ||
if (Object(_i) !== _i) return; | ||
_n = !1; | ||
} else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); | ||
} catch (err) { | ||
_d = !0, _e = err; | ||
} finally { | ||
if (_d) throw _e; | ||
try { | ||
if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; | ||
} finally { | ||
if (_d) throw _e; | ||
} | ||
} | ||
return _arr; | ||
} | ||
return _arr; | ||
} | ||
function _slicedToArray(arr, i) { | ||
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); | ||
} | ||
function _arrayWithHoles(arr) { | ||
if (Array.isArray(arr)) return arr; | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableRest() { | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance"); | ||
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -50,13 +58,10 @@ | ||
var requestId = react.useRef(0); | ||
var _useState = react.useState(0), | ||
_useState2 = _slicedToArray(_useState, 2), | ||
x = _useState2[0], | ||
setX = _useState2[1]; | ||
_useState2 = _slicedToArray(_useState, 2), | ||
x = _useState2[0], | ||
setX = _useState2[1]; | ||
var _useState3 = react.useState(0), | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
y = _useState4[0], | ||
setY = _useState4[1]; | ||
_useState4 = _slicedToArray(_useState3, 2), | ||
y = _useState4[0], | ||
setY = _useState4[1]; | ||
react.useEffect(function () { | ||
@@ -70,3 +75,2 @@ var scrollHandler = function scrollHandler() { | ||
}; | ||
window.addEventListener('scroll', scrollHandler); | ||
@@ -73,0 +77,0 @@ return function () { |
{ | ||
"name": "@dh-react-hooks/use-scroll", | ||
"version": "0.2.1", | ||
"version": "0.2.4", | ||
"description": "react hooks for getting scroll position", | ||
@@ -27,3 +27,3 @@ "main": "lib/index.js", | ||
"type": "git", | ||
"url": "https://github.com/danhuang1202/DrHooks" | ||
"url": "git+https://github.com/danhuang1202/DrHooks.git" | ||
}, | ||
@@ -39,3 +39,3 @@ "keywords": [ | ||
"peerDependencies": { | ||
"react": "^16.8.6 || ^17.0.0" | ||
"react": "^16.8.6 || ^17 || ^18" | ||
}, | ||
@@ -48,17 +48,18 @@ "devDependencies": { | ||
"@testing-library/react": "^9.1.4", | ||
"@types/jest": "^24.0.18", | ||
"@types/react": "^16.8.6", | ||
"@types/react-dom": "^16.8.6", | ||
"@typescript-eslint/eslint-plugin": "^2.1.0", | ||
"@typescript-eslint/parser": "^2.1.0", | ||
"babel-jest": "^24.9.0", | ||
"eslint": "^6.3.0", | ||
"eslint-config-prettier": "^6.2.0", | ||
"eslint-plugin-react": "^7.14.3", | ||
"eslint-plugin-react-hooks": "^2.0.1", | ||
"jest": "^24.9.0", | ||
"@types/jest": "^29.5.2", | ||
"@types/react": "^17.0.62", | ||
"@types/react-dom": "^17.0.20", | ||
"@typescript-eslint/eslint-plugin": "^5.59.11", | ||
"@typescript-eslint/parser": "^5.59.11", | ||
"babel-jest": "^29.5.0", | ||
"eslint": "^8.43.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-react": "^7.32.2", | ||
"eslint-plugin-react-hooks": "^4.6.0", | ||
"jest": "^29.5.0", | ||
"jest-environment-jsdom": "^29.5.0", | ||
"lint-staged": "^9.2.5", | ||
"prettier": "^1.18.2", | ||
"react": "^16.14.0", | ||
"react-dom": "^17.0.1", | ||
"react": "^17.0.0", | ||
"react-dom": "^17.0.0", | ||
"rollup": "^1.21.0", | ||
@@ -69,3 +70,3 @@ "rollup-plugin-babel": "^4.3.3", | ||
"rollup-plugin-peer-deps-external": "^2.2.0", | ||
"typescript": "^3.5.3" | ||
"typescript": "^5.0.4" | ||
}, | ||
@@ -75,3 +76,10 @@ "publishConfig": { | ||
}, | ||
"gitHead": "df5f03c99be69aa983cbfa804392839c73b8a71e" | ||
"engines": { | ||
"node": ">=18.0.0" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/danhuang1202/DrHooks/issues" | ||
}, | ||
"homepage": "https://github.com/danhuang1202/DrHooks#readme", | ||
"gitHead": "4381622be4f6614168a77dfea14d30089dc4d7b2" | ||
} |
@@ -1,2 +0,2 @@ | ||
declare type Coord = { | ||
type Coord = { | ||
x: number; | ||
@@ -3,0 +3,0 @@ y: number; |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
13612
261
0
1
27