From 61700675cd529e143cbdf8c694263dd42bbf2fe4 Mon Sep 17 00:00:00 2001 From: streamich Date: Mon, 25 Mar 2019 13:19:37 +0100 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20don't=20install=20only?= =?UTF-8?q?=20large=20dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change removes useCallbag hook, it also reverts back changes for hooks that only have tiny dependencies or dependencies that could have been part of the hook itself. Effectivly only KeyboardJS and Rebound are large packages that only partially are used by react-use, hence require user to install them separately. BREAKING CHANGE: 🧨 useCallbag hook is removed, some hooks KeyboardJS and Rebound installed separately --- README.md | 1 - docs/useCallbag.md | 22 ---------------------- docs/useCss.md | 7 ------- docs/useIdle.md | 7 ------- docs/useKeyPress.md | 1 + docs/useKeyPressEvent.md | 1 + docs/useOutsideClick.md | 1 + docs/useSpring.md | 1 + docs/useTween.md | 6 ------ docs/useWait.md | 6 ------ package.json | 12 ++++++------ src/useCallbag.ts | 4 ---- yarn.lock | 12 ------------ 13 files changed, 10 insertions(+), 71 deletions(-) delete mode 100644 docs/useCallbag.md delete mode 100644 src/useCallbag.ts diff --git a/README.md b/README.md index ccc5022794..183bc3fa60 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,6 @@
- [**State**](./docs/State.md) - [`createMemo`](./docs/createMemo.md) — factory of memoized hooks. - - [`useCallbag`](./docs/useCallbag.md) — tracks latest value of a callbag. - [`useGetSet`](./docs/useGetSet.md) — returns state getter `get()` instead of raw state. - [`useGetSetState`](./docs/useGetSetState.md) — as if [`useGetSet`](./docs/useGetSet.md) and [`useSetState`](./docs/useSetState.md) had a baby. - [`useObservable`](./docs/useObservable.md) — tracks latest value of an `Observable`. diff --git a/docs/useCallbag.md b/docs/useCallbag.md deleted file mode 100644 index 06f21807d1..0000000000 --- a/docs/useCallbag.md +++ /dev/null @@ -1,22 +0,0 @@ -# `useCallbag` - -React state hook that tracks the latest value of a callbag. - -Requires `use-callbag`: -```bash -npm add use-callbag -# or -yarn add use-callbag -``` - -## Usage - -```jsx -import {useCallbag} from 'react-use'; -import interval from 'callbag-interval'; - -const Demo = () => { - const count = useCallbag(() => interval(1000)); - return {`Counter: ${count}`} -}; -``` diff --git a/docs/useCss.md b/docs/useCss.md index 51ffb414e8..40eaf4da05 100644 --- a/docs/useCss.md +++ b/docs/useCss.md @@ -4,13 +4,6 @@ React side-effect hook that changes [CSS dynamically][gen-5]. Works like "virtua it re-renders only CSS rules that change. It is different from inline styles, because you can use media queries and pseudo selectors. -Requires `nano-css`: -```bash -npm add nano-css -# or -yarn add nano-css -``` - ## Usage diff --git a/docs/useIdle.md b/docs/useIdle.md index 8b02a33868..986429f7f5 100644 --- a/docs/useIdle.md +++ b/docs/useIdle.md @@ -2,13 +2,6 @@ React sensor hook that tracks if user on the page is idle. -Requires `throttle-debounce`: -```bash -npm add throttle-debounce -# or -yarn add throttle-debounce -``` - ## Usage diff --git a/docs/useKeyPress.md b/docs/useKeyPress.md index 8cb5d3fe3f..8713896a38 100644 --- a/docs/useKeyPress.md +++ b/docs/useKeyPress.md @@ -9,6 +9,7 @@ via [KeyboardJS key combos](https://github.com/RobertWHurst/KeyboardJS). Check its documentation for further details on how to make combo strings. Requires `keyboardjs`: + ```bash npm add keyboardjs # or diff --git a/docs/useKeyPressEvent.md b/docs/useKeyPressEvent.md index 0256dbb91a..b357ef456b 100644 --- a/docs/useKeyPressEvent.md +++ b/docs/useKeyPressEvent.md @@ -15,6 +15,7 @@ if a second and third argument are passed, the second will be used in the keyup event and the third in the keydown event. Essentially, keydown takes precedence. Requires `keyboardjs`: + ```bash npm add keyboardjs # or diff --git a/docs/useOutsideClick.md b/docs/useOutsideClick.md index 2d10a0b0fc..e13a7d6000 100644 --- a/docs/useOutsideClick.md +++ b/docs/useOutsideClick.md @@ -4,6 +4,7 @@ React UI hook that triggers a callback when user clicks outside the target element. Requires `use-onclickoutside`: + ```bash npm add use-onclickoutside # or diff --git a/docs/useSpring.md b/docs/useSpring.md index 7d8ae4dae2..4e18d8a94d 100644 --- a/docs/useSpring.md +++ b/docs/useSpring.md @@ -4,6 +4,7 @@ React animation hook that updates a single numeric value over time according to spring dynamics. Requires `rebound`: + ```bash npm add rebound # or diff --git a/docs/useTween.md b/docs/useTween.md index ffcf368584..19879e67b3 100644 --- a/docs/useTween.md +++ b/docs/useTween.md @@ -4,12 +4,6 @@ React animation hook that tweens a number between 0 and 1. [![](https://img.shields.io/badge/demo-useTween-green.svg)](https://codesandbox.io/s/52990wwzyl) -Requires `ts-easing`: -```bash -npm add ts-easing -# or -yarn add ts-easing -``` ## Usage diff --git a/docs/useWait.md b/docs/useWait.md index 45136c8520..99f62ae2d2 100644 --- a/docs/useWait.md +++ b/docs/useWait.md @@ -2,12 +2,6 @@ `useWait` is a React Hook helps to manage multiple loading states on the page without any conflict. It's based on a very simple idea that manages an `Array` of multiple loading states. The built-in `Wait` component listens its registered loader and immediately become loading state. -Requires `react-wait`: -```bash -npm add react-wait -# or -yarn add react-wait -``` ## Usage diff --git a/package.json b/package.json index 421771bc7a..c63a937c32 100644 --- a/package.json +++ b/package.json @@ -30,16 +30,16 @@ }, "homepage": "https://github.com/streamich/react-use#readme", "dependencies": { - "@types/react": "^16.8.2" - }, - "devDependencies": { - "keyboardjs": "^2.5.1", "nano-css": "^5.0.0", "react-wait": "^0.3.0", - "rebound": "^0.1.0", "throttle-debounce": "^2.0.1", "ts-easing": "^0.2.0", - "use-callbag": "^0.2.0", + "use-onclickoutside": "^0.3.0" + }, + "devDependencies": { + "@types/react": "^16.8.2", + "keyboardjs": "^2.5.1", + "rebound": "^0.1.0", "use-onclickoutside": "^0.3.0", "@semantic-release/changelog": "3.0.2", "@semantic-release/git": "7.0.8", diff --git a/src/useCallbag.ts b/src/useCallbag.ts deleted file mode 100644 index d79e666001..0000000000 --- a/src/useCallbag.ts +++ /dev/null @@ -1,4 +0,0 @@ -import useCallbag from 'use-callbag' - -export default useCallbag; - diff --git a/yarn.lock b/yarn.lock index 0e3103a355..9815b21abf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3101,11 +3101,6 @@ callbag-interval@1.1.0: dependencies: callbag "^1.1.0" -callbag-subscribe@^1.4.1: - version "1.4.1" - resolved "https://registry.yarnpkg.com/callbag-subscribe/-/callbag-subscribe-1.4.1.tgz#f9bd86b713230c9113acf6b7c5c6baf7d5ec772f" - integrity sha512-FzvJK3ODP50UhZPhfCFwJZ+YP+Hg/6Fm1+d3m2UZacA1b+jSKARpyNTIpkWlf61rAHEgpwZF1head4URY+EEMw== - callbag@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/callbag/-/callbag-1.1.0.tgz#9cbbc3352832da43e764d588ed43121d4b09c42a" @@ -11088,13 +11083,6 @@ url@^0.11.0: punycode "1.3.2" querystring "0.2.0" -use-callbag@^0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/use-callbag/-/use-callbag-0.2.0.tgz#bf3bbef918effc5818e0149f44d8b7385a7d03f1" - integrity sha512-ml1cDc2ZwieqXv+AtgPZUl6UWmYN/4roZgBg+LgFrU1s8khdTVEaj44utQwughw5qJDxEZ1lIOrdWEJvbO6cMA== - dependencies: - callbag-subscribe "^1.4.1" - use-onclickoutside@^0.3.0: version "0.3.0" resolved "https://registry.yarnpkg.com/use-onclickoutside/-/use-onclickoutside-0.3.0.tgz#a7c6bb68c8643c9a3437e34840d0cb2b96ae32b1"