From 9543e23ca3c9293959f3ab94c1b78ddea1f279e2 Mon Sep 17 00:00:00 2001 From: xobotyi Date: Wed, 4 Sep 2019 04:10:11 +0300 Subject: [PATCH 001/162] useValidatableState implementation; --- README.md | 1 + docs/useValidatableState.md | 48 ++++++++ src/__stories__/useValidityState.story.tsx | 30 +++++ src/__tests__/useValidatableState.test.ts | 126 +++++++++++++++++++++ src/index.ts | 1 + src/useValidatableState.ts | 46 ++++++++ 6 files changed, 252 insertions(+) create mode 100644 docs/useValidatableState.md create mode 100644 src/__stories__/useValidityState.story.tsx create mode 100644 src/__tests__/useValidatableState.test.ts create mode 100644 src/useValidatableState.ts diff --git a/README.md b/README.md index f54afa21d6..c08670cc64 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ - [`useCounter` and `useNumber`](./docs/useCounter.md) — tracks state of a number. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usecounter--demo) - [`useList`](./docs/useList.md) — tracks state of an array. - [`useMap`](./docs/useMap.md) — tracks state of an object. + - [`useValidatableState`](./docs/useValidatableState.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usevalidatablestate--demo)
diff --git a/docs/useValidatableState.md b/docs/useValidatableState.md new file mode 100644 index 0000000000..1c84449eea --- /dev/null +++ b/docs/useValidatableState.md @@ -0,0 +1,48 @@ +# `useValidatableState` + +Very similar to React's `useState` hook, but extended with validation functionality. +Each time state changes validator invoked and it's result stored to separate state. + +## Usage +```ts +import * as React from 'react'; +import { useCallback } from 'react'; +import { useValidatableState } from 'react-use'; + +const Demo = () => { + const validator = useCallback(s => [s === '' ? null : (s * 1) % 2 === 0], []); + const [state, setState, [isValid]] = useValidatableState(validator, ''); + + return ( +
+
Below field is valid only if number is even
+ { + setState(ev.target.value); + }} + /> + {isValid !== null && {isValid ? 'Valid!' : 'Invalid'}} +
+ ); +}; +``` + +## Reference +```ts +const [state, setState, validity, revalidate] = useValidatableState( + validator: (state, prev, setValidity?)=>[boolean|null, ...any[]], + initialState: any +); +``` +- `state` and `setState` are the same with React's `useState` hook; +- **`validity`**_`: [boolean|null, ...any[]]`_ result of validity check. First element is strictly nullable boolean, but others can contain arbitrary data; +- **`revalidate`**_`: ()=>void`_ runs validator once again +- **`validator`** should return an array suitable for validity state described above; + - `state` - current state; + - `prev` - previous state; + - `setValidity` - if defined hook will not trigger validity change automatically. Useful for async validators; +- `initialState` same with `useState` hook; diff --git a/src/__stories__/useValidityState.story.tsx b/src/__stories__/useValidityState.story.tsx new file mode 100644 index 0000000000..66e9651e17 --- /dev/null +++ b/src/__stories__/useValidityState.story.tsx @@ -0,0 +1,30 @@ +import { storiesOf } from '@storybook/react'; +import * as React from 'react'; +import { useCallback } from 'react'; +import { useValidatableState } from '../index'; +import ShowDocs from './util/ShowDocs'; + +const Demo = () => { + const validator = useCallback(s => [s === '' ? null : (s * 1) % 2 === 0], []); + const [state, setState, [isValid]] = useValidatableState(validator, ''); + + return ( +
+
Below field is valid only if number is even
+ { + setState(ev.target.value); + }} + /> + {isValid !== null && {isValid ? 'Valid!' : 'Invalid'}} +
+ ); +}; + +storiesOf('State|useValidatableState', module) + .add('Docs', () => ) + .add('Demo', () => ); diff --git a/src/__tests__/useValidatableState.test.ts b/src/__tests__/useValidatableState.test.ts new file mode 100644 index 0000000000..0e0bc515c3 --- /dev/null +++ b/src/__tests__/useValidatableState.test.ts @@ -0,0 +1,126 @@ +import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { useValidatableState } from '../index'; +import { UseValidatableStateReturn, Validator } from '../useValidatableState'; + +interface Mock extends jest.Mock {} + +describe('useValidatableState', () => { + it('should be defined', () => { + expect(useValidatableState).toBeDefined(); + }); + + function getHook( + fn: Validator = jest.fn(() => {}), + initialState: any = null + ): [Mock | Function, RenderHookResult<{ validator: Validator; init: any }, UseValidatableStateReturn>] { + return [ + fn, + renderHook(({ validator, init }) => useValidatableState(validator as Function, init), { + initialProps: { + validator: fn, + init: initialState, + }, + }), + ]; + } + + it('should return an array of four elements', () => { + const [, hook] = getHook(); + + expect(Array.isArray(hook.result.current)).toBe(true); + expect(hook.result.current.length).toBe(4); + }); + + it('first two elements should act like regular setState', () => { + const [, hook] = getHook(jest.fn(), 3); + const [, setState] = hook.result.current; + + expect(hook.result.current[0]).toBe(3); + act(() => setState(4)); + expect(hook.result.current[0]).toBe(4); + act(() => setState(prevState => prevState + 1)); + expect(hook.result.current[0]).toBe(5); + }); + + it('validator have to be called on init plus on each state update', () => { + const [spy, hook] = getHook(jest.fn(), 3); + const [, setState] = hook.result.current; + + expect(spy).toHaveBeenCalledTimes(1); + act(() => setState(4)); + expect(spy).toHaveBeenCalledTimes(2); + act(() => setState(prevState => prevState + 1)); + expect(spy).toHaveBeenCalledTimes(3); + }); + + it('third element of returned array should represent validity state', () => { + const [, hook] = getHook(jest.fn(state => [state % 2 === 0]), 3); + let [, setState, [isValid]] = hook.result.current; + + expect(isValid).toBe(false); + act(() => setState(prevState => prevState + 1)); + + [, setState, [isValid]] = hook.result.current; + expect(isValid).toBe(true); + act(() => setState(5)); + + [, setState, [isValid]] = hook.result.current; + expect(isValid).toBe(false); + }); + + it('should recalculate validity on validator change', () => { + const [, hook] = getHook(jest.fn(state => [state % 2 === 0]), 3); + let [, setState, [isValid]] = hook.result.current; + + expect(isValid).toBe(false); + + hook.rerender({ validator: jest.fn(state => [state % 2 === 1]), init: 3 }); + + [, setState, [isValid]] = hook.result.current; + expect(isValid).toBe(true); + act(() => setState(prevState => prevState + 1)); + + [, setState, [isValid]] = hook.result.current; + expect(isValid).toBe(false); + }); + + it('forth element of returned array should re-call validation', () => { + const [spy, hook] = getHook(jest.fn(), 3); + const [, , , validate] = hook.result.current; + + expect(spy).toHaveBeenCalledTimes(1); + act(() => validate()); + expect(spy).toHaveBeenCalledTimes(2); + }); + + it('should pass to validator two parameters: first - current state, second - previous state', () => { + const [spy, hook] = getHook(jest.fn(), 3); + const [, setState] = hook.result.current; + + act(() => setState(4)); + act(() => setState(prevState => prevState + 1)); + expect((spy as Mock).mock.calls[0][0]).toBe(3); + expect((spy as Mock).mock.calls[0][1]).toBe(null); + expect((spy as Mock).mock.calls[1][0]).toBe(4); + expect((spy as Mock).mock.calls[1][1]).toBe(3); + expect((spy as Mock).mock.calls[2][0]).toBe(5); + expect((spy as Mock).mock.calls[2][1]).toBe(4); + }); + + it('if validator expects 3 parameters it should pass a validity setter there', () => { + const [spy, hook] = getHook(jest.fn((state, _prevState, setValidity) => setValidity!([state % 2 === 0])), 3); + let [, setState, [isValid]] = hook.result.current; + + expect(typeof (spy as Mock).mock.calls[0][2]).toBe('function'); + + expect(isValid).toBe(false); + act(() => setState(prevState => prevState + 1)); + + [, setState, [isValid]] = hook.result.current; + expect(isValid).toBe(true); + act(() => setState(5)); + + [, setState, [isValid]] = hook.result.current; + expect(isValid).toBe(false); + }); +}); diff --git a/src/index.ts b/src/index.ts index b3514a7179..412e1bd707 100644 --- a/src/index.ts +++ b/src/index.ts @@ -86,6 +86,7 @@ export { default as useUpdate } from './useUpdate'; export { default as useUpdateEffect } from './useUpdateEffect'; export { default as useUpsert } from './useUpsert'; export { default as useVideo } from './useVideo'; +export { default as useValidatableState } from './useValidatableState'; export { useWait, Waiter } from './useWait'; export { default as useWindowScroll } from './useWindowScroll'; export { default as useWindowSize } from './useWindowSize'; diff --git a/src/useValidatableState.ts b/src/useValidatableState.ts new file mode 100644 index 0000000000..2d0b9b4647 --- /dev/null +++ b/src/useValidatableState.ts @@ -0,0 +1,46 @@ +import { Dispatch, SetStateAction, useCallback, useEffect, useRef, useState } from 'react'; + +export type ValidityState = [boolean | null, ...any[]]; +export type DispatchValidityState = Dispatch>; + +export type Validator = + | { + (state?: State, prev?: State): StateValidity; + (state?: State, prev?: State, setValidity?: DispatchValidityState): void; + } + | Function; + +export type ValidateFn = () => void; + +export type UseValidatableStateReturn = [ + State, + Dispatch>, + StateValidity, + ValidateFn +]; + +export default function useValidatableState( + validator: Validator, + initialState?: State +): UseValidatableStateReturn { + const prevState = useRef(null); + const [state, setState] = useState(initialState!); + const [validity, setValidity] = useState([null] as StateValidity); + + const validate = useCallback(() => { + if (validator.length === 3) { + validator(state, prevState.current, setValidity as DispatchValidityState); + } else { + setValidity(validator(state, prevState.current)); + } + }, [state, validator]); + + useEffect(() => { + validate(); + }, [validate, state]); + useEffect(() => { + prevState.current = state; + }, [state]); + + return [state, setState, validity, validate]; +} From fd8905a25ec036c35a6fe766e703713ba778182e Mon Sep 17 00:00:00 2001 From: macinjoke Date: Wed, 4 Sep 2019 02:48:21 +0900 Subject: [PATCH 002/162] add useEvent test --- src/__tests__/useEvent.test.ts | 118 +++++++++++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 src/__tests__/useEvent.test.ts diff --git a/src/__tests__/useEvent.test.ts b/src/__tests__/useEvent.test.ts new file mode 100644 index 0000000000..ec124600ba --- /dev/null +++ b/src/__tests__/useEvent.test.ts @@ -0,0 +1,118 @@ +import { renderHook } from '@testing-library/react-hooks'; +import useEvent, { ListenerType1, ListenerType2 } from '../useEvent'; + +interface Props { + name: string; + handler: (...args: any[]) => void; + target: ListenerType1 | ListenerType2; + options: any; +} + +const propsList1 = [ + { + name: 'name1', + handler: () => {}, + target: { + addEventListener: jest.fn(), + removeEventListener: jest.fn(), + }, + options: { a: 'opt1' }, + }, + { + name: 'name2', + handler: () => {}, + target: { + addEventListener: jest.fn(), + removeEventListener: jest.fn(), + }, + options: { a: 'opt2' }, + }, +]; + +const propsList2 = [ + { + ...propsList1[0], + target: { + on: jest.fn(), + off: jest.fn(), + }, + }, + { + ...propsList1[1], + target: { + on: jest.fn(), + off: jest.fn(), + }, + }, +]; + +it('should call addEventListener/removeEventListener on mount/unmount', () => { + checkOnMountAndUnmount(propsList1[0], 'addEventListener', 'removeEventListener'); +}); + +it('should call on/off on mount/unmount', () => { + checkOnMountAndUnmount(propsList2[0], 'on', 'off'); +}); + +it('should call addEventListener/removeEventListener on deps changes', () => { + checkOnDepsChanges(propsList1[0], propsList1[1], 'addEventListener', 'removeEventListener'); +}); + +it('should call on/off on deps changes', () => { + checkOnDepsChanges(propsList2[0], propsList2[1], 'on', 'off'); +}); + +const checkOnMountAndUnmount = (props: Props, addEventListenerName: string, removeEventListenerName: string) => { + const { unmount } = renderHook((p: Props) => useEvent(p.name, p.handler, p.target, p.options), { + initialProps: props, + }); + expect(props.target[addEventListenerName]).toHaveBeenCalledTimes(1); + expect(props.target[addEventListenerName]).toHaveBeenLastCalledWith(props.name, props.handler, props.options); + unmount(); + expect(props.target[removeEventListenerName]).toHaveBeenCalledTimes(1); + expect(props.target[removeEventListenerName]).toHaveBeenLastCalledWith(props.name, props.handler, props.options); +}; + +const checkOnDepsChanges = ( + props1: Props, + props2: Props, + addEventListenerName: string, + removeEventListenerName: string +) => { + const { rerender } = renderHook((p: Props) => useEvent(p.name, p.handler, p.target, p.options), { + initialProps: props1, + }); + expect(props1.target[addEventListenerName]).toHaveBeenCalledTimes(1); + expect(props1.target[addEventListenerName]).toHaveBeenLastCalledWith(props1.name, props1.handler, props1.options); + + // deps are same as previous + rerender({ name: props1.name, handler: props1.handler, target: props1.target, options: props1.options }); + expect(props1.target[removeEventListenerName]).not.toHaveBeenCalled(); + + // name is different from previous + rerender({ name: props2.name, handler: props1.handler, target: props1.target, options: props1.options }); + expect(props1.target[removeEventListenerName]).toHaveBeenCalledTimes(1); + expect(props1.target[removeEventListenerName]).toHaveBeenLastCalledWith(props1.name, props1.handler, props1.options); + + // handler is different from previous + rerender({ name: props2.name, handler: props2.handler, target: props1.target, options: props1.options }); + expect(props1.target[removeEventListenerName]).toHaveBeenCalledTimes(2); + expect(props1.target[removeEventListenerName]).toHaveBeenLastCalledWith(props2.name, props1.handler, props1.options); + + // options contents is same as previous + rerender({ name: props2.name, handler: props2.handler, target: props1.target, options: { a: 'opt1' } }); + expect(props1.target[removeEventListenerName]).toHaveBeenCalledTimes(2); + + // options is different from previous + rerender({ name: props2.name, handler: props2.handler, target: props1.target, options: props2.options }); + expect(props1.target[removeEventListenerName]).toHaveBeenCalledTimes(3); + expect(props1.target[removeEventListenerName]).toHaveBeenLastCalledWith(props2.name, props2.handler, props1.options); + + // target is different from previous + rerender({ name: props2.name, handler: props2.handler, target: props2.target, options: props2.options }); + expect(props1.target[removeEventListenerName]).toHaveBeenCalledTimes(4); + expect(props1.target[removeEventListenerName]).toHaveBeenLastCalledWith(props2.name, props2.handler, props2.options); + + expect(props2.target[addEventListenerName]).toHaveBeenCalledTimes(1); + expect(props2.target[addEventListenerName]).toHaveBeenLastCalledWith(props2.name, props2.handler, props2.options); +}; From 0fb314863eacaf80772631626a5db416e5f4c698 Mon Sep 17 00:00:00 2001 From: macinjoke Date: Fri, 6 Sep 2019 23:14:34 +0900 Subject: [PATCH 003/162] improve useEvent type inference --- src/useEvent.ts | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/src/useEvent.ts b/src/useEvent.ts index 3074df6ddc..b9c1ec4c36 100644 --- a/src/useEvent.ts +++ b/src/useEvent.ts @@ -3,25 +3,32 @@ import { isClient } from './util'; export interface ListenerType1 { addEventListener(name: string, handler: (event?: any) => void, ...args: any[]); - - removeEventListener(name: string, handler: (event?: any) => void); + removeEventListener(name: string, handler: (event?: any) => void, ...args: any[]); } export interface ListenerType2 { on(name: string, handler: (event?: any) => void, ...args: any[]); - - off(name: string, handler: (event?: any) => void); + off(name: string, handler: (event?: any) => void, ...args: any[]); } export type UseEventTarget = ListenerType1 | ListenerType2; const defaultTarget = isClient ? window : null; -const useEvent = ( - name: string, - handler?: null | undefined | ((event?: any) => void), - target: null | UseEventTarget = defaultTarget, - options?: any +const isListenerType1 = (target: any): target is ListenerType1 => { + return !!target.addEventListener; +}; +const isListenerType2 = (target: any): target is ListenerType2 => { + return !!target.on; +}; + +type AddEventListener = T extends ListenerType1 ? T['addEventListener'] : T extends ListenerType2 ? T['on'] : never; + +const useEvent = ( + name: Parameters>[0], + handler?: null | undefined | Parameters>[1], + target: null | T | Window = defaultTarget, + options?: Parameters>[2] ) => { useEffect(() => { if (!handler) { @@ -30,11 +37,17 @@ const useEvent = ( if (!target) { return; } - const fn: any = (target as ListenerType1).addEventListener || (target as ListenerType2).on; - fn.call(target, name, handler, options); + if (isListenerType1(target)) { + target.addEventListener(name, handler, options); + } else if (isListenerType2(target)) { + target.on(name, handler, options); + } return () => { - const cleanFn: any = (target as ListenerType1).removeEventListener || (target as ListenerType2).off; - cleanFn.call(target, name, handler, options); + if (isListenerType1(target)) { + target.removeEventListener(name, handler, options); + } else if (isListenerType2(target)) { + target.off(name, handler, options); + } }; }, [name, handler, target, JSON.stringify(options)]); }; From 66f206ec4dd3b01a79c2b6a67ccf4c93e18262ba Mon Sep 17 00:00:00 2001 From: Tane Morgan <464864+tanem@users.noreply.github.com> Date: Mon, 16 Sep 2019 10:37:26 +1200 Subject: [PATCH 004/162] Use tslib to dedupe TypeScript helper functions --- package.json | 3 ++- tsconfig.json | 3 ++- yarn.lock | 5 +++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index efc6f667bc..7e5f9d3418 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,8 @@ "screenfull": "^4.1.0", "set-harmonic-interval": "^1.0.0", "throttle-debounce": "^2.0.1", - "ts-easing": "^0.2.0" + "ts-easing": "^0.2.0", + "tslib": "^1.10.0" }, "peerDependencies": { "react": "^16.8.0", diff --git a/tsconfig.json b/tsconfig.json index b24d6137c6..135d602b72 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,7 +16,8 @@ "noImplicitAny": false, "noFallthroughCasesInSwitch": true, "outDir": "lib", - "lib": ["es2018", "dom"] + "lib": ["es2018", "dom"], + "importHelpers": true }, "exclude": [ "node_modules", diff --git a/yarn.lock b/yarn.lock index c8bab952d1..6ca09a66e8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12342,6 +12342,11 @@ tslib@1.9.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" integrity sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ== +tslib@^1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + tslint-config-prettier@1.18.0: version "1.18.0" resolved "https://registry.yarnpkg.com/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" From 86c1f87e8ec22f4023b147568a679089b84b5148 Mon Sep 17 00:00:00 2001 From: Ward Oosterlijnck Date: Wed, 18 Sep 2019 15:52:54 +0200 Subject: [PATCH 005/162] docs: added useSize initial size parameter, related #584 --- docs/useSize.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/docs/useSize.md b/docs/useSize.md index ec0d90b812..3e8868f5cb 100644 --- a/docs/useSize.md +++ b/docs/useSize.md @@ -9,7 +9,8 @@ import {useSize} from 'react-use'; const Demo = () => { const [sized, {width, height}] = useSize( - ({width}) =>
Size me up! ({width}px)
+ ({width}) =>
Size me up! ({width}px)
, + { width: 100, height: 100 } ); return ( @@ -21,3 +22,12 @@ const Demo = () => { ); }; ``` + +## Reference + +```js +useSize(element, initialSize); +``` + +- `element` — sized element. +- `initialSize` — initial size containing a `width` and `height` key. From b425eb52f904c0d71fa998662fb1e80f2ed85dd5 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 20 Sep 2019 07:25:19 +0000 Subject: [PATCH 006/162] chore(deps): update dependency ts-loader to v6.1.1 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index bea0b92ddd..15c9d88a64 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "rimraf": "3.0.0", "rxjs": "6.5.3", "semantic-release": "15.13.24", - "ts-loader": "6.1.0", + "ts-loader": "6.1.1", "ts-node": "8.4.1", "tslint": "5.20.0", "tslint-config-prettier": "1.18.0", diff --git a/yarn.lock b/yarn.lock index 3af427f4f6..110ffd47a7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12310,10 +12310,10 @@ ts-easing@^0.2.0: resolved "https://registry.yarnpkg.com/ts-easing/-/ts-easing-0.2.0.tgz#c8a8a35025105566588d87dbda05dd7fbfa5a4ec" integrity sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ== -ts-loader@6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.1.0.tgz#999cb0a7644f9c7c6c0901802dce50ceb0a76e5b" - integrity sha512-7JedeOu2rsYHQDEr2fwmMozABwbQTZXEaEMZPSIWG7gpzRefOLJCqwdazcegHtyaxp04PeEgs/b0m08WMpnIzQ== +ts-loader@6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.1.1.tgz#f30c68aa1ce59fa266f0bb70a36959ca68f40ddc" + integrity sha512-AoOek8ZWJlWwTRH5ttNmZPBRcASUJZc8wc8E/2PGOXef96H97J8KaLXaW/zUnvyFjvCoRBhTGh9ZIMKL1arcCA== dependencies: chalk "^2.3.0" enhanced-resolve "^4.0.0" From 18e7c547609b6f3cf11b1080c95ed7cfbe83e302 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 21 Sep 2019 06:45:04 +0000 Subject: [PATCH 007/162] chore(deps): update dependency ts-loader to v6.1.2 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 15c9d88a64..47251ab7fb 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "rimraf": "3.0.0", "rxjs": "6.5.3", "semantic-release": "15.13.24", - "ts-loader": "6.1.1", + "ts-loader": "6.1.2", "ts-node": "8.4.1", "tslint": "5.20.0", "tslint-config-prettier": "1.18.0", diff --git a/yarn.lock b/yarn.lock index 110ffd47a7..3c84da6c66 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12310,10 +12310,10 @@ ts-easing@^0.2.0: resolved "https://registry.yarnpkg.com/ts-easing/-/ts-easing-0.2.0.tgz#c8a8a35025105566588d87dbda05dd7fbfa5a4ec" integrity sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ== -ts-loader@6.1.1: - version "6.1.1" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.1.1.tgz#f30c68aa1ce59fa266f0bb70a36959ca68f40ddc" - integrity sha512-AoOek8ZWJlWwTRH5ttNmZPBRcASUJZc8wc8E/2PGOXef96H97J8KaLXaW/zUnvyFjvCoRBhTGh9ZIMKL1arcCA== +ts-loader@6.1.2: + version "6.1.2" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.1.2.tgz#ff6bc767334970226438949fbde2e211147a1325" + integrity sha512-dudxFKm0Ellrg/gLNlu+97/UgwvoMK0SdUVImPUSzq3IcRUVtShylZvcMX+CgvCQL1BEKb913NL0gAP1GA/OFw== dependencies: chalk "^2.3.0" enhanced-resolve "^4.0.0" From 24b614c3244283b311b0b56d6374c8689bfa824c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 22 Sep 2019 10:42:52 +0000 Subject: [PATCH 008/162] chore(deps): update dependency lint-staged to v9.3.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 47251ab7fb..b81ccb6eae 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "husky": "3.0.5", "jest": "24.9.0", "keyboardjs": "2.5.1", - "lint-staged": "9.2.5", + "lint-staged": "9.3.0", "markdown-loader": "5.1.0", "prettier": "1.18.2", "raf-stub": "3.0.0", diff --git a/yarn.lock b/yarn.lock index 3c84da6c66..e1f52848cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7925,10 +7925,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -lint-staged@9.2.5: - version "9.2.5" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.2.5.tgz#5a3e1e0a539a403bd7f88542bc3d34ce52efdbb3" - integrity sha512-d99gTBFMJ29159+9iRvaMEQstmNcPAbQbhHSYw6D/1FncvFdIj8lWHztaq3Uq+tbZPABHXQ/fyN7Rp1QwF8HIw== +lint-staged@9.3.0: + version "9.3.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.3.0.tgz#522a79f166050ab5777887348f2cbdb03f71acac" + integrity sha512-OuL3xo6XpBErl16+3W9PdnFmgeGp12lM8I1Ii/B56S8Edy1kyrf4W8VD4IBn9v17QlutRQEWUJ54YF/VVQ7J2A== dependencies: chalk "^2.4.2" commander "^2.20.0" From adce59ec327557837603e51c68694c01ff754f1a Mon Sep 17 00:00:00 2001 From: Yingya Zhang Date: Tue, 24 Sep 2019 01:07:51 +0800 Subject: [PATCH 009/162] fix: remove attempt from deps of retry in useAsyncRetry (#614) --- src/useAsyncRetry.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/useAsyncRetry.ts b/src/useAsyncRetry.ts index 1c11578f1f..519c2b5df7 100644 --- a/src/useAsyncRetry.ts +++ b/src/useAsyncRetry.ts @@ -20,7 +20,7 @@ const useAsyncRetry = (fn: () => Promise, deps: DependencyList = []) => { } setAttempt(currentAttempt => currentAttempt + 1); - }, [...deps, stateLoading, attempt]); + }, [...deps, stateLoading]); return { ...state, retry }; }; From 64048a0039f6c4c4537151f624e5a03d051f79c0 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 23 Sep 2019 17:09:56 +0000 Subject: [PATCH 010/162] chore(release): 12.2.1 [skip ci] ## [12.2.1](https://github.com/streamich/react-use/compare/v12.2.0...v12.2.1) (2019-09-23) ### Bug Fixes * remove attempt from deps of retry in useAsyncRetry ([#614](https://github.com/streamich/react-use/issues/614)) ([adce59e](https://github.com/streamich/react-use/commit/adce59e)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3396f4c6a0..0d0dd3ebd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [12.2.1](https://github.com/streamich/react-use/compare/v12.2.0...v12.2.1) (2019-09-23) + + +### Bug Fixes + +* remove attempt from deps of retry in useAsyncRetry ([#614](https://github.com/streamich/react-use/issues/614)) ([adce59e](https://github.com/streamich/react-use/commit/adce59e)) + # [12.2.0](https://github.com/streamich/react-use/compare/v12.1.0...v12.2.0) (2019-09-02) diff --git a/package.json b/package.json index b81ccb6eae..d9a72dce57 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.2.0", + "version": "12.2.1", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From e6077c1e27f5c8a0536fc4caa4072dc9aab145b2 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 23 Sep 2019 21:30:22 +0000 Subject: [PATCH 011/162] chore(deps): update babel monorepo to v7.6.2 --- package.json | 4 +- yarn.lock | 158 +++++++++++++++++++++++++++++++++++---------------- 2 files changed, 111 insertions(+), 51 deletions(-) diff --git a/package.json b/package.json index d9a72dce57..97850eb9fa 100644 --- a/package.json +++ b/package.json @@ -61,9 +61,9 @@ "react-dom": "^16.8.0" }, "devDependencies": { - "@babel/core": "7.6.0", + "@babel/core": "7.6.2", "@babel/plugin-syntax-dynamic-import": "7.2.0", - "@babel/preset-env": "7.6.0", + "@babel/preset-env": "7.6.2", "@babel/preset-react": "7.0.0", "@babel/preset-typescript": "7.6.0", "@semantic-release/changelog": "3.0.4", diff --git a/yarn.lock b/yarn.lock index e1f52848cb..cccb45ef99 100644 --- a/yarn.lock +++ b/yarn.lock @@ -36,17 +36,17 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.0.tgz#9b00f73554edd67bebc86df8303ef678be3d7b48" - integrity sha512-FuRhDRtsd6IptKpHXAa+4WPZYY2ZzgowkbLBecEDDSje1X/apG7jQM33or3NdOmjXBKWGOg4JmSiRfUfuTtHXw== +"@babel/core@7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.2.tgz#069a776e8d5e9eefff76236bc8845566bd31dd91" + integrity sha512-l8zto/fuoZIbncm+01p8zPSDZu/VuuJhAfA7d/AbzM09WR7iVhavvfNDYCNpo1VvLk6E6xgAoP9P+/EMJHuRkQ== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.6.0" - "@babel/helpers" "^7.6.0" - "@babel/parser" "^7.6.0" + "@babel/generator" "^7.6.2" + "@babel/helpers" "^7.6.2" + "@babel/parser" "^7.6.2" "@babel/template" "^7.6.0" - "@babel/traverse" "^7.6.0" + "@babel/traverse" "^7.6.2" "@babel/types" "^7.6.0" convert-source-map "^1.1.0" debug "^4.1.0" @@ -87,16 +87,15 @@ source-map "^0.5.0" trim-right "^1.0.1" -"@babel/generator@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.0.tgz#e2c21efbfd3293ad819a2359b448f002bfdfda56" - integrity sha512-Ms8Mo7YBdMMn1BYuNtKuP/z0TgEIhbcyB8HVR6PPNYp4P61lMsABiS4A3VG1qznjXVCf3r+fVHhm4efTYVsySA== +"@babel/generator@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.2.tgz#dac8a3c2df118334c2a29ff3446da1636a8f8c03" + integrity sha512-j8iHaIW4gGPnViaIHI7e9t/Hl8qLjERI6DcV9kEpAIDJsAOrcnXqRS7t+QbhL76pwbtqP+QCQLL0z1CyVmtjjQ== dependencies: "@babel/types" "^7.6.0" jsesc "^2.5.1" lodash "^4.17.13" source-map "^0.5.0" - trim-right "^1.0.1" "@babel/helper-annotate-as-pure@^7.0.0": version "7.0.0" @@ -294,13 +293,13 @@ "@babel/traverse" "^7.5.5" "@babel/types" "^7.5.5" -"@babel/helpers@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.6.0.tgz#21961d16c6a3c3ab597325c34c465c0887d31c6e" - integrity sha512-W9kao7OBleOjfXtFGgArGRX6eCP0UEcA2ZWEWNkJdRZnHhW4eEbeswbG3EwaRsnQUAEGWYgMq1HsIXuNNNy2eQ== +"@babel/helpers@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.6.2.tgz#681ffe489ea4dcc55f23ce469e58e59c1c045153" + integrity sha512-3/bAUL8zZxYs1cdX2ilEE0WobqbCmKWr/889lf2SS0PpDcpEIY8pb1CCyz0pEcX3pEb+MCbks1jIokz2xLtGTA== dependencies: "@babel/template" "^7.6.0" - "@babel/traverse" "^7.6.0" + "@babel/traverse" "^7.6.2" "@babel/types" "^7.6.0" "@babel/highlight@^7.0.0": @@ -322,6 +321,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.0.tgz#3e05d0647432a8326cb28d0de03895ae5a57f39b" integrity sha512-+o2q111WEx4srBs7L9eJmcwi655eD8sXniLqMB93TBK9GrNzGrxDWSjiqz2hLU0Ha8MTXFIP0yd9fNdP+m43ZQ== +"@babel/parser@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.2.tgz#205e9c95e16ba3b8b96090677a67c9d6075b70a1" + integrity sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg== + "@babel/plugin-proposal-async-generator-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" @@ -380,6 +384,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" +"@babel/plugin-proposal-object-rest-spread@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.6.2.tgz#8ffccc8f3a6545e9f78988b6bf4fe881b88e8096" + integrity sha512-LDBXlmADCsMZV1Y9OQwMc0MyGZ8Ta/zlD9N67BfQT8uYwkRswiu2hU6nJKrjrt/58aH/vqfQlR/9yId/7A2gWw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-proposal-optional-catch-binding@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" @@ -397,6 +409,15 @@ "@babel/helper-regex" "^7.4.4" regexpu-core "^4.5.4" +"@babel/plugin-proposal-unicode-property-regex@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.6.2.tgz#05413762894f41bfe42b9a5e80919bd575dcc802" + integrity sha512-NxHETdmpeSCtiatMRYWVJo7266rrvAC3DTeG5exQBIH/fMIUK7ejDNznBbn3HQl/o9peymRRg7Yqkx6PdUXmMw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + "@babel/plugin-syntax-async-generators@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" @@ -491,10 +512,10 @@ "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.13" -"@babel/plugin-transform-block-scoping@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.0.tgz#c49e21228c4bbd4068a35667e6d951c75439b1dc" - integrity sha512-tIt4E23+kw6TgL/edACZwP1OUKrjOTyMrFMLoT5IOFrfMRabCgekjqFd5o6PaAMildBu46oFkekIdMuGkkPEpA== +"@babel/plugin-transform-block-scoping@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.2.tgz#96c33ab97a9ae500cc6f5b19e04a7e6553360a79" + integrity sha512-zZT8ivau9LOQQaOGC7bQLQOT4XPkPXgN2ERfUgk1X8ql+mVkLc4E8eKk+FO3o0154kxzqenWCorfmEXpEZcrSQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.13" @@ -564,6 +585,15 @@ "@babel/helper-regex" "^7.4.4" regexpu-core "^4.5.4" +"@babel/plugin-transform-dotall-regex@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.6.2.tgz#44abb948b88f0199a627024e1508acaf8dc9b2f9" + integrity sha512-KGKT9aqKV+9YMZSkowzYoYEiHqgaDhGmPNZlZxX6UeHC4z30nC1J9IrZuGqbYFB1jaIGdv91ujpze0exiVK8bA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + "@babel/plugin-transform-duplicate-keys@^7.2.0", "@babel/plugin-transform-duplicate-keys@^7.5.0": version "7.5.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.5.0.tgz#c5dbf5106bf84cdf691222c0974c12b1df931853" @@ -669,12 +699,12 @@ dependencies: regexp-tree "^0.1.6" -"@babel/plugin-transform-named-capturing-groups-regex@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.0.tgz#1e6e663097813bb4f53d42df0750cf28ad3bb3f1" - integrity sha512-jem7uytlmrRl3iCAuQyw8BpB4c4LWvSpvIeXKpMb+7j84lkx4m4mYr5ErAcmN5KM7B6BqrAvRGjBIbbzqCczew== +"@babel/plugin-transform-named-capturing-groups-regex@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.2.tgz#c1ca0bb84b94f385ca302c3932e870b0fb0e522b" + integrity sha512-xBdB+XOs+lgbZc2/4F5BVDVcDNS4tcSKQc96KmlqLEAwz6tpYPEvPdmDfvVG0Ssn8lAhronaRs6Z6KSexIpK5g== dependencies: - regexp-tree "^0.1.13" + regexpu-core "^4.6.0" "@babel/plugin-transform-new-target@^7.4.0", "@babel/plugin-transform-new-target@^7.4.4": version "7.4.4" @@ -785,6 +815,13 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" +"@babel/plugin-transform-spread@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.6.2.tgz#fc77cf798b24b10c46e1b51b1b88c2bf661bb8dd" + integrity sha512-DpSvPFryKdK1x+EDJYCy28nmAaIMdxmhot62jAXF/o99iA33Zj2Lmcp3vDmz+MUh0LNYVPvfj5iC3feb3/+PFg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-sticky-regex@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" @@ -834,6 +871,15 @@ "@babel/helper-regex" "^7.4.4" regexpu-core "^4.5.4" +"@babel/plugin-transform-unicode-regex@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.6.2.tgz#b692aad888a7e8d8b1b214be6b9dc03d5031f698" + integrity sha512-orZI6cWlR3nk2YmYdb0gImrgCUwb5cBUwjf6Ks6dvNVvXERkwtJWOQaEOjPiu0Gu1Tq6Yq/hruCZZOOi9F34Dw== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-regex" "^7.4.4" + regexpu-core "^4.6.0" + "@babel/preset-env@7.4.3": version "7.4.3" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.4.3.tgz#e71e16e123dc0fbf65a52cbcbcefd072fbd02880" @@ -888,19 +934,19 @@ js-levenshtein "^1.1.3" semver "^5.5.0" -"@babel/preset-env@7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.0.tgz#aae4141c506100bb2bfaa4ac2a5c12b395619e50" - integrity sha512-1efzxFv/TcPsNXlRhMzRnkBFMeIqBBgzwmZwlFDw5Ubj0AGLeufxugirwZmkkX/ayi3owsSqoQ4fw8LkfK9SYg== +"@babel/preset-env@7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.2.tgz#abbb3ed785c7fe4220d4c82a53621d71fc0c75d3" + integrity sha512-Ru7+mfzy9M1/YTEtlDS8CD45jd22ngb9tXnn64DvQK3ooyqSw9K4K9DUWmYknTTVk4TqygL9dqCrZgm1HMea/Q== dependencies: "@babel/helper-module-imports" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-proposal-async-generator-functions" "^7.2.0" "@babel/plugin-proposal-dynamic-import" "^7.5.0" "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.5.5" + "@babel/plugin-proposal-object-rest-spread" "^7.6.2" "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" + "@babel/plugin-proposal-unicode-property-regex" "^7.6.2" "@babel/plugin-syntax-async-generators" "^7.2.0" "@babel/plugin-syntax-dynamic-import" "^7.2.0" "@babel/plugin-syntax-json-strings" "^7.2.0" @@ -909,11 +955,11 @@ "@babel/plugin-transform-arrow-functions" "^7.2.0" "@babel/plugin-transform-async-to-generator" "^7.5.0" "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.6.0" + "@babel/plugin-transform-block-scoping" "^7.6.2" "@babel/plugin-transform-classes" "^7.5.5" "@babel/plugin-transform-computed-properties" "^7.2.0" "@babel/plugin-transform-destructuring" "^7.6.0" - "@babel/plugin-transform-dotall-regex" "^7.4.4" + "@babel/plugin-transform-dotall-regex" "^7.6.2" "@babel/plugin-transform-duplicate-keys" "^7.5.0" "@babel/plugin-transform-exponentiation-operator" "^7.2.0" "@babel/plugin-transform-for-of" "^7.4.4" @@ -924,7 +970,7 @@ "@babel/plugin-transform-modules-commonjs" "^7.6.0" "@babel/plugin-transform-modules-systemjs" "^7.5.0" "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.6.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.6.2" "@babel/plugin-transform-new-target" "^7.4.4" "@babel/plugin-transform-object-super" "^7.5.5" "@babel/plugin-transform-parameters" "^7.4.4" @@ -932,11 +978,11 @@ "@babel/plugin-transform-regenerator" "^7.4.5" "@babel/plugin-transform-reserved-words" "^7.2.0" "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.2.0" + "@babel/plugin-transform-spread" "^7.6.2" "@babel/plugin-transform-sticky-regex" "^7.2.0" "@babel/plugin-transform-template-literals" "^7.4.4" "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.4.4" + "@babel/plugin-transform-unicode-regex" "^7.6.2" "@babel/types" "^7.6.0" browserslist "^4.6.0" core-js-compat "^3.1.1" @@ -1089,16 +1135,16 @@ globals "^11.1.0" lodash "^4.17.13" -"@babel/traverse@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.0.tgz#389391d510f79be7ce2ddd6717be66d3fed4b516" - integrity sha512-93t52SaOBgml/xY74lsmt7xOR4ufYvhb5c5qiM6lu4J/dWGMAfAh6eKw4PjLes6DI6nQgearoxnFJk60YchpvQ== +"@babel/traverse@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.2.tgz#b0e2bfd401d339ce0e6c05690206d1e11502ce2c" + integrity sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.6.0" + "@babel/generator" "^7.6.2" "@babel/helper-function-name" "^7.1.0" "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.6.0" + "@babel/parser" "^7.6.2" "@babel/types" "^7.6.0" debug "^4.1.0" globals "^11.1.0" @@ -10738,6 +10784,13 @@ regenerate-unicode-properties@^8.0.2: dependencies: regenerate "^1.4.0" +regenerate-unicode-properties@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" + integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA== + dependencies: + regenerate "^1.4.0" + regenerate@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" @@ -10773,11 +10826,6 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp-tree@^0.1.13: - version "0.1.13" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.13.tgz#5b19ab9377edc68bc3679256840bb29afc158d7f" - integrity sha512-hwdV/GQY5F8ReLZWO+W1SRoN5YfpOKY6852+tBFcma72DKBIcHjPRIlIvQN35bCOljuAfP2G2iB0FC/w236mUw== - regexp-tree@^0.1.6: version "0.1.10" resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.10.tgz#d837816a039c7af8a8d64d7a7c3cf6a1d93450bc" @@ -10802,6 +10850,18 @@ regexpu-core@^4.5.4: unicode-match-property-ecmascript "^1.0.4" unicode-match-property-value-ecmascript "^1.1.0" +regexpu-core@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" + integrity sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg== + dependencies: + regenerate "^1.4.0" + regenerate-unicode-properties "^8.1.0" + regjsgen "^0.5.0" + regjsparser "^0.6.0" + unicode-match-property-ecmascript "^1.0.4" + unicode-match-property-value-ecmascript "^1.1.0" + registry-auth-token@^3.0.1: version "3.3.2" resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.2.tgz#851fd49038eecb586911115af845260eec983f20" From e89ec97f46b924299388ffedd967cc3381bb2738 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 25 Sep 2019 09:59:01 +0000 Subject: [PATCH 012/162] chore(deps): update node.js to v10.16.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 97850eb9fa..9d56b66755 100644 --- a/package.json +++ b/package.json @@ -140,7 +140,7 @@ ] }, "volta": { - "node": "10.16.0", + "node": "10.16.3", "yarn": "1.16.0" }, "collective": { From 8c0d178739117fe490f017221f1be75da4103f68 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 25 Sep 2019 11:26:17 +0000 Subject: [PATCH 013/162] chore(deps): update yarn to v1.17.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9d56b66755..d8230f46df 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ }, "volta": { "node": "10.16.3", - "yarn": "1.16.0" + "yarn": "1.17.3" }, "collective": { "type": "opencollective", From 23d6a5af785ddc5796a402fb41e24f680341e06e Mon Sep 17 00:00:00 2001 From: Ward Date: Thu, 26 Sep 2019 10:14:31 +0200 Subject: [PATCH 014/162] fix: useDebounce remove deps from function arguments (#623) --- src/useDebounce.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/useDebounce.ts b/src/useDebounce.ts index 3c7d4664ca..bb7bffb7af 100644 --- a/src/useDebounce.ts +++ b/src/useDebounce.ts @@ -1,14 +1,14 @@ +import { DependencyList } from 'react'; import useUpdateEffect from './useUpdateEffect'; -const useDebounce = (fn: () => any, ms: number = 0, args: any[] = []) => { +const useDebounce = (fn: () => any, ms: number = 0, deps: DependencyList = []) => { useUpdateEffect(() => { - const handle = setTimeout(fn.bind(null, args), ms); + const timeout = setTimeout(fn, ms); return () => { - // if args change then clear timeout - clearTimeout(handle); + clearTimeout(timeout); }; - }, args); + }, deps); }; export default useDebounce; From b5700f2664b922b58dae193c1cf9427059570a9c Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 26 Sep 2019 08:16:24 +0000 Subject: [PATCH 015/162] chore(release): 12.2.2 [skip ci] ## [12.2.2](https://github.com/streamich/react-use/compare/v12.2.1...v12.2.2) (2019-09-26) ### Bug Fixes * useDebounce remove deps from function arguments ([#623](https://github.com/streamich/react-use/issues/623)) ([23d6a5a](https://github.com/streamich/react-use/commit/23d6a5a)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d0dd3ebd8..f71bdd3dc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [12.2.2](https://github.com/streamich/react-use/compare/v12.2.1...v12.2.2) (2019-09-26) + + +### Bug Fixes + +* useDebounce remove deps from function arguments ([#623](https://github.com/streamich/react-use/issues/623)) ([23d6a5a](https://github.com/streamich/react-use/commit/23d6a5a)) + ## [12.2.1](https://github.com/streamich/react-use/compare/v12.2.0...v12.2.1) (2019-09-23) diff --git a/package.json b/package.json index d8230f46df..c74199d3ea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.2.1", + "version": "12.2.2", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From 6768efe887100e25acea598eb18a05e812b8ef55 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 26 Sep 2019 10:38:45 +0000 Subject: [PATCH 016/162] chore(deps): update dependency lint-staged to v9.4.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c74199d3ea..301498c7dc 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "husky": "3.0.5", "jest": "24.9.0", "keyboardjs": "2.5.1", - "lint-staged": "9.3.0", + "lint-staged": "9.4.0", "markdown-loader": "5.1.0", "prettier": "1.18.2", "raf-stub": "3.0.0", diff --git a/yarn.lock b/yarn.lock index cccb45ef99..e904ee3998 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7971,10 +7971,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -lint-staged@9.3.0: - version "9.3.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.3.0.tgz#522a79f166050ab5777887348f2cbdb03f71acac" - integrity sha512-OuL3xo6XpBErl16+3W9PdnFmgeGp12lM8I1Ii/B56S8Edy1kyrf4W8VD4IBn9v17QlutRQEWUJ54YF/VVQ7J2A== +lint-staged@9.4.0: + version "9.4.0" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.4.0.tgz#dd4abcc9a82539fd290aed1584e3241b8f8af687" + integrity sha512-jTu1KoGiGTSffM539wK+3igVqDGVsby3KwDBaXL471YndahkjnavLX+R5Nsk49JwklyMo0ZAXay1BaoyA6d2Jw== dependencies: chalk "^2.4.2" commander "^2.20.0" From d3136b9dbab3e7023197449a9e8383cb0d5c6452 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 27 Sep 2019 20:39:31 +0000 Subject: [PATCH 017/162] chore(deps): update react monorepo to v16.10.0 --- package.json | 6 +++--- yarn.lock | 50 +++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 301498c7dc..887b060f8c 100644 --- a/package.json +++ b/package.json @@ -89,11 +89,11 @@ "markdown-loader": "5.1.0", "prettier": "1.18.2", "raf-stub": "3.0.0", - "react": "16.9.0", - "react-dom": "16.9.0", + "react": "16.10.0", + "react-dom": "16.10.0", "react-frame-component": "4.1.1", "react-spring": "8.0.27", - "react-test-renderer": "16.9.0", + "react-test-renderer": "16.10.0", "rebound": "0.1.0", "redux-logger": "3.0.6", "redux-thunk": "2.3.0", diff --git a/yarn.lock b/yarn.lock index e904ee3998..ad3110ae06 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10338,7 +10338,17 @@ react-docgen@^4.1.0: node-dir "^0.1.10" recast "^0.17.3" -react-dom@16.9.0, react-dom@^16.8.3: +react-dom@16.10.0: + version "16.10.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.10.0.tgz#319356767b5c044f3c016eef28518ef7726dce84" + integrity sha512-0QJQUFrKG04hB/1lWyUs/FOd1qNseKGRQI+JBRsADIqVAFxYObhZ2zsVQKjt+nVSCmi8KA0sL52RLwwWuXQtOw== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.2" + scheduler "^0.16.0" + +react-dom@^16.8.3: version "16.9.0" resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.9.0.tgz#5e65527a5e26f22ae3701131bcccaee9fb0d3962" integrity sha512-YFT2rxO9hM70ewk9jq0y6sQk8cL02xm4+IzYBz75CQGlClQQ1Bxq0nhHF6OtSbit+AIahujJgb/CPRibFkMNJQ== @@ -10415,11 +10425,16 @@ react-inspector@^3.0.2: is-dom "^1.0.9" prop-types "^15.6.1" -react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0: +react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4: version "16.9.0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb" integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw== +react-is@^16.8.6: + version "16.10.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.0.tgz#3d6a031e57fff73c3cfa0347feb3e8f40c5141e5" + integrity sha512-WRki2sBb7MTpYp7FtDEmSeGKX2vamYyq3rc9o7fKUG+/DHVyJu69NnvJsiSwwhh2Tt8XN40MQHkDBEXwyfxncQ== + react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" @@ -10488,15 +10503,15 @@ react-syntax-highlighter@^8.0.1: prismjs "^1.8.4" refractor "^2.4.1" -react-test-renderer@16.9.0: - version "16.9.0" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.9.0.tgz#7ed657a374af47af88f66f33a3ef99c9610c8ae9" - integrity sha512-R62stB73qZyhrJo7wmCW9jgl/07ai+YzvouvCXIJLBkRlRqLx4j9RqcLEAfNfU3OxTGucqR2Whmn3/Aad6L3hQ== +react-test-renderer@16.10.0: + version "16.10.0" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.10.0.tgz#33dddd71e4f43d58a4e1dfa332d4b8e683084baf" + integrity sha512-lO8zoAWiEpNKfQvup7b36gsVwcPJxswL9a6IrVloOHwvsB6bhrlQVYH4Wqfhhp/oXOyDNvPnQU1g6xLglPqAJA== dependencies: object-assign "^4.1.1" prop-types "^15.6.2" - react-is "^16.9.0" - scheduler "^0.15.0" + react-is "^16.8.6" + scheduler "^0.16.0" react-textarea-autosize@^7.1.0: version "7.1.0" @@ -10521,7 +10536,16 @@ react-wait@^0.3.0: resolved "https://registry.yarnpkg.com/react-wait/-/react-wait-0.3.0.tgz#0cdd4d919012451a5bc3ab0a16d00c6fd9a8c10b" integrity sha512-kB5x/kMKWcn0uVr9gBdNz21/oGbQwEQnF3P9p6E9yLfJ9DRcKS0fagbgYMFI0YFOoyKDj+2q6Rwax0kTYJF37g== -react@16.9.0, react@^16.8.3: +react@16.10.0: + version "16.10.0" + resolved "https://registry.yarnpkg.com/react/-/react-16.10.0.tgz#95c41e8fc1c706e174deef54b663b5ab94c8ee32" + integrity sha512-lc37bD3j6ZWJRso/a1rrFu6CO1qOf30ZadUDBi1c5RHA1lBSWA8x2MGABB6Oikk+RfmgC+kAT+XegL0eD1ecKg== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + prop-types "^15.6.2" + +react@^16.8.3: version "16.9.0" resolved "https://registry.yarnpkg.com/react/-/react-16.9.0.tgz#40ba2f9af13bc1a38d75dbf2f4359a5185c4f7aa" integrity sha512-+7LQnFBwkiw+BobzOF6N//BdoNw0ouwmSJTEm9cglOOmsg/TMiFHZLe2sEoN5M7LgJTj9oHH0gxklfnQe66S1w== @@ -11191,6 +11215,14 @@ scheduler@^0.15.0: loose-envify "^1.1.0" object-assign "^4.1.1" +scheduler@^0.16.0: + version "0.16.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.16.0.tgz#cc8914b79c5c1cfa16714cb1ddc4cbd2c7513efa" + integrity sha512-Jq59uCXQzi71B562VEjuDgvsgfTfkLDvdjNhA7hamN/fKBxecXIEFF24Zu4OVrnAz9NJJ8twa9X16Zp4b0P/xQ== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + schema-utils@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770" From 18402ce5143e4d2ebed62976af28a2d92324c6a1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 28 Sep 2019 01:03:47 +0000 Subject: [PATCH 018/162] chore(deps): update dependency husky to v3.0.6 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 887b060f8c..a07435d33c 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "babel-plugin-dynamic-import-node": "2.3.0", "fork-ts-checker-webpack-plugin": "1.5.0", "gh-pages": "2.1.1", - "husky": "3.0.5", + "husky": "3.0.6", "jest": "24.9.0", "keyboardjs": "2.5.1", "lint-staged": "9.4.0", diff --git a/yarn.lock b/yarn.lock index ad3110ae06..6d743b5bcc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6511,10 +6511,10 @@ humanize-url@^1.0.0: normalize-url "^1.0.0" strip-url-auth "^1.0.0" -husky@3.0.5: - version "3.0.5" - resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.5.tgz#d7db27c346645a8dc52df02aa534a377ad7925e0" - integrity sha512-cKd09Jy9cDyNIvAdN2QQAP/oA21sle4FWXjIMDttailpLAYZuBE7WaPmhrkj+afS8Sj9isghAtFvWSQ0JiwOHg== +husky@3.0.6: + version "3.0.6" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.6.tgz#035aa2c0ae992a131fc72fcb410f1758daad1147" + integrity sha512-bNTgujuC5VS0m8gK70zRpzXq9rccFUFcjuU6L/SFLZxV7eke+6x10Tpk+st3rmgCEsQ4vn+yJk1jx3gvSD8knQ== dependencies: chalk "^2.4.2" cosmiconfig "^5.2.1" From 0330664e9f81dd47fa9379e8bb748fa593a427c1 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 28 Sep 2019 01:53:24 +0000 Subject: [PATCH 019/162] chore(deps): update dependency husky to v3.0.7 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index a07435d33c..bd952ea7ec 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "babel-plugin-dynamic-import-node": "2.3.0", "fork-ts-checker-webpack-plugin": "1.5.0", "gh-pages": "2.1.1", - "husky": "3.0.6", + "husky": "3.0.7", "jest": "24.9.0", "keyboardjs": "2.5.1", "lint-staged": "9.4.0", diff --git a/yarn.lock b/yarn.lock index 6d743b5bcc..584fee5955 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6511,10 +6511,10 @@ humanize-url@^1.0.0: normalize-url "^1.0.0" strip-url-auth "^1.0.0" -husky@3.0.6: - version "3.0.6" - resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.6.tgz#035aa2c0ae992a131fc72fcb410f1758daad1147" - integrity sha512-bNTgujuC5VS0m8gK70zRpzXq9rccFUFcjuU6L/SFLZxV7eke+6x10Tpk+st3rmgCEsQ4vn+yJk1jx3gvSD8knQ== +husky@3.0.7: + version "3.0.7" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.7.tgz#05e869006c7d9a31b27893aeda520e730bd125b9" + integrity sha512-fIrkaREoQk6DO8KnSX16Aq7Kg9SxqYYQZH/9b+4AxXyXNNgpJLsc8lWlQCShLus1nbujIyZ/WQZBHGwClohK/w== dependencies: chalk "^2.4.2" cosmiconfig "^5.2.1" From a0b3a420f7256118ecf9477d23b5edacb901f43e Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 28 Sep 2019 16:42:51 +0000 Subject: [PATCH 020/162] chore(deps): update yarn to v1.19.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bd952ea7ec..35e9ee3870 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ }, "volta": { "node": "10.16.3", - "yarn": "1.17.3" + "yarn": "1.19.0" }, "collective": { "type": "opencollective", From 1d433aec89636b497703caed825e14c8b2af2d7a Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 28 Sep 2019 18:36:10 +0000 Subject: [PATCH 021/162] chore(deps): update react monorepo to v16.10.1 --- package.json | 6 +++--- yarn.lock | 36 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 35e9ee3870..ca94cd36dd 100644 --- a/package.json +++ b/package.json @@ -89,11 +89,11 @@ "markdown-loader": "5.1.0", "prettier": "1.18.2", "raf-stub": "3.0.0", - "react": "16.10.0", - "react-dom": "16.10.0", + "react": "16.10.1", + "react-dom": "16.10.1", "react-frame-component": "4.1.1", "react-spring": "8.0.27", - "react-test-renderer": "16.10.0", + "react-test-renderer": "16.10.1", "rebound": "0.1.0", "redux-logger": "3.0.6", "redux-thunk": "2.3.0", diff --git a/yarn.lock b/yarn.lock index 584fee5955..9a45628f8c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10338,15 +10338,15 @@ react-docgen@^4.1.0: node-dir "^0.1.10" recast "^0.17.3" -react-dom@16.10.0: - version "16.10.0" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.10.0.tgz#319356767b5c044f3c016eef28518ef7726dce84" - integrity sha512-0QJQUFrKG04hB/1lWyUs/FOd1qNseKGRQI+JBRsADIqVAFxYObhZ2zsVQKjt+nVSCmi8KA0sL52RLwwWuXQtOw== +react-dom@16.10.1: + version "16.10.1" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.10.1.tgz#479a6511ba34a429273c213cbc2a9ac4d296dac1" + integrity sha512-SmM4ZW0uug0rn95U8uqr52I7UdNf6wdGLeXDmNLfg3y5q5H9eAbdjF5ubQc3bjDyRrvdAB2IKG7X0GzSpnn5Mg== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" prop-types "^15.6.2" - scheduler "^0.16.0" + scheduler "^0.16.1" react-dom@^16.8.3: version "16.9.0" @@ -10503,15 +10503,15 @@ react-syntax-highlighter@^8.0.1: prismjs "^1.8.4" refractor "^2.4.1" -react-test-renderer@16.10.0: - version "16.10.0" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.10.0.tgz#33dddd71e4f43d58a4e1dfa332d4b8e683084baf" - integrity sha512-lO8zoAWiEpNKfQvup7b36gsVwcPJxswL9a6IrVloOHwvsB6bhrlQVYH4Wqfhhp/oXOyDNvPnQU1g6xLglPqAJA== +react-test-renderer@16.10.1: + version "16.10.1" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.10.1.tgz#75b8e8ce152e00eadd303e9fa514a2ca917ee049" + integrity sha512-VT8nd7XrrUV7MQPxeIuH7WstfrK2A8kgcMwGUtVXa0ja+CiYkxdmLYNjwX1L7irRF7ydzJJWiSLsQf2xBj4Xaw== dependencies: object-assign "^4.1.1" prop-types "^15.6.2" react-is "^16.8.6" - scheduler "^0.16.0" + scheduler "^0.16.1" react-textarea-autosize@^7.1.0: version "7.1.0" @@ -10536,10 +10536,10 @@ react-wait@^0.3.0: resolved "https://registry.yarnpkg.com/react-wait/-/react-wait-0.3.0.tgz#0cdd4d919012451a5bc3ab0a16d00c6fd9a8c10b" integrity sha512-kB5x/kMKWcn0uVr9gBdNz21/oGbQwEQnF3P9p6E9yLfJ9DRcKS0fagbgYMFI0YFOoyKDj+2q6Rwax0kTYJF37g== -react@16.10.0: - version "16.10.0" - resolved "https://registry.yarnpkg.com/react/-/react-16.10.0.tgz#95c41e8fc1c706e174deef54b663b5ab94c8ee32" - integrity sha512-lc37bD3j6ZWJRso/a1rrFu6CO1qOf30ZadUDBi1c5RHA1lBSWA8x2MGABB6Oikk+RfmgC+kAT+XegL0eD1ecKg== +react@16.10.1: + version "16.10.1" + resolved "https://registry.yarnpkg.com/react/-/react-16.10.1.tgz#967c1e71a2767dfa699e6ba702a00483e3b0573f" + integrity sha512-2bisHwMhxQ3XQz4LiJJwG3360pY965pTl/MRrZYxIBKVj4fOHoDs5aZAkYXGxDRO1Li+SyjTAilQEbOmtQJHzA== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" @@ -11215,10 +11215,10 @@ scheduler@^0.15.0: loose-envify "^1.1.0" object-assign "^4.1.1" -scheduler@^0.16.0: - version "0.16.0" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.16.0.tgz#cc8914b79c5c1cfa16714cb1ddc4cbd2c7513efa" - integrity sha512-Jq59uCXQzi71B562VEjuDgvsgfTfkLDvdjNhA7hamN/fKBxecXIEFF24Zu4OVrnAz9NJJ8twa9X16Zp4b0P/xQ== +scheduler@^0.16.1: + version "0.16.1" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.16.1.tgz#a6fb6ddec12dc2119176e6eb54ecfe69a9eba8df" + integrity sha512-MIuie7SgsqMYOdCXVFZa8SKoNorJZUWHW8dPgto7uEHn1lX3fg2Gu0TzgK8USj76uxV7vB5eRMnZs/cdEHg+cg== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" From b061465b1051cc3690fa2b13380d1a7bc4af15a4 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 29 Sep 2019 06:35:56 +0000 Subject: [PATCH 022/162] chore(deps): update dependency ts-loader to v6.2.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index ca94cd36dd..87fe9bc4e9 100644 --- a/package.json +++ b/package.json @@ -100,7 +100,7 @@ "rimraf": "3.0.0", "rxjs": "6.5.3", "semantic-release": "15.13.24", - "ts-loader": "6.1.2", + "ts-loader": "6.2.0", "ts-node": "8.4.1", "tslint": "5.20.0", "tslint-config-prettier": "1.18.0", diff --git a/yarn.lock b/yarn.lock index 9a45628f8c..a294fd831c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12402,10 +12402,10 @@ ts-easing@^0.2.0: resolved "https://registry.yarnpkg.com/ts-easing/-/ts-easing-0.2.0.tgz#c8a8a35025105566588d87dbda05dd7fbfa5a4ec" integrity sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ== -ts-loader@6.1.2: - version "6.1.2" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.1.2.tgz#ff6bc767334970226438949fbde2e211147a1325" - integrity sha512-dudxFKm0Ellrg/gLNlu+97/UgwvoMK0SdUVImPUSzq3IcRUVtShylZvcMX+CgvCQL1BEKb913NL0gAP1GA/OFw== +ts-loader@6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.2.0.tgz#52d3993ecbc5474c1513242388e1049da0fce880" + integrity sha512-Da8h3fD+HiZ9GvZJydqzk3mTC9nuOKYlJcpuk+Zv6Y1DPaMvBL+56GRzZFypx2cWrZFMsQr869+Ua2slGoLxvQ== dependencies: chalk "^2.3.0" enhanced-resolve "^4.0.0" From 7f3f7bec81fa6e8b44acb60c61a81f0eca284ad7 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 1 Oct 2019 05:24:18 +0000 Subject: [PATCH 023/162] chore(deps): update dependency lint-staged to v9.4.1 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 87fe9bc4e9..d67082a71f 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "husky": "3.0.7", "jest": "24.9.0", "keyboardjs": "2.5.1", - "lint-staged": "9.4.0", + "lint-staged": "9.4.1", "markdown-loader": "5.1.0", "prettier": "1.18.2", "raf-stub": "3.0.0", diff --git a/yarn.lock b/yarn.lock index a294fd831c..163790c164 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7971,10 +7971,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -lint-staged@9.4.0: - version "9.4.0" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.4.0.tgz#dd4abcc9a82539fd290aed1584e3241b8f8af687" - integrity sha512-jTu1KoGiGTSffM539wK+3igVqDGVsby3KwDBaXL471YndahkjnavLX+R5Nsk49JwklyMo0ZAXay1BaoyA6d2Jw== +lint-staged@9.4.1: + version "9.4.1" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.4.1.tgz#60c0f85745bd398e6460aa7f5adb3cad3a2b862c" + integrity sha512-zFRbo1bAJEVf1m33paTTjDVfy2v3lICCqHfmQSgNoI+lWpi7HPG5y/R2Y7Whdce+FKxlZYs/U1sDSx8+nmQdDA== dependencies: chalk "^2.4.2" commander "^2.20.0" From 42b31b9e36f39c9cbe7fd8b042a525ca565b8555 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 2 Oct 2019 01:46:15 +0000 Subject: [PATCH 024/162] chore(deps): update dependency husky to v3.0.8 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index d67082a71f..f43f343b4f 100644 --- a/package.json +++ b/package.json @@ -82,7 +82,7 @@ "babel-plugin-dynamic-import-node": "2.3.0", "fork-ts-checker-webpack-plugin": "1.5.0", "gh-pages": "2.1.1", - "husky": "3.0.7", + "husky": "3.0.8", "jest": "24.9.0", "keyboardjs": "2.5.1", "lint-staged": "9.4.1", diff --git a/yarn.lock b/yarn.lock index 163790c164..9fd0edde8e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6511,10 +6511,10 @@ humanize-url@^1.0.0: normalize-url "^1.0.0" strip-url-auth "^1.0.0" -husky@3.0.7: - version "3.0.7" - resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.7.tgz#05e869006c7d9a31b27893aeda520e730bd125b9" - integrity sha512-fIrkaREoQk6DO8KnSX16Aq7Kg9SxqYYQZH/9b+4AxXyXNNgpJLsc8lWlQCShLus1nbujIyZ/WQZBHGwClohK/w== +husky@3.0.8: + version "3.0.8" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.8.tgz#8de3fed26ce9b43034ef51013c4ad368b6b74ea8" + integrity sha512-HFOsgcyrX3qe/rBuqyTt+P4Gxn5P0seJmr215LAZ/vnwK3jWB3r0ck7swbzGRUbufCf9w/lgHPVbF/YXQALgfQ== dependencies: chalk "^2.4.2" cosmiconfig "^5.2.1" From a0eebfe70ad4910b2e2f4c49ffe45f06b9c9d9cc Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 3 Oct 2019 19:37:45 +0000 Subject: [PATCH 025/162] chore(deps): update dependency @testing-library/react-hooks to v2.0.3 --- package.json | 2 +- yarn.lock | 23 +++++++++++++++-------- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index f43f343b4f..94b92d0cff 100644 --- a/package.json +++ b/package.json @@ -74,7 +74,7 @@ "@storybook/addon-notes": "5.1.11", "@storybook/addon-options": "5.1.11", "@storybook/react": "5.1.11", - "@testing-library/react-hooks": "2.0.1", + "@testing-library/react-hooks": "2.0.3", "@types/jest": "24.0.18", "@types/react": "16.9.2", "babel-core": "6.26.3", diff --git a/yarn.lock b/yarn.lock index 9fd0edde8e..8e605bb076 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2108,14 +2108,13 @@ "@svgr/plugin-svgo" "^4.3.1" loader-utils "^1.2.3" -"@testing-library/react-hooks@2.0.1": - version "2.0.1" - resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-2.0.1.tgz#1c3ec40882d0830df3078ddae0056fdf7366c81d" - integrity sha512-MLTvWX7/csq/uQzP4WJntGz0QJDq6H4EzjV0VTL5YJE7KBZbaQ9DGT0IbtjuB33L4R4YKZ55rGZQ5eL+WiZtQA== +"@testing-library/react-hooks@2.0.3": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@testing-library/react-hooks/-/react-hooks-2.0.3.tgz#305a6c76facb5fa1d185792b9eb11b1ca1b63fb7" + integrity sha512-adm+7b1gcysGka8VuYq/ObBrIBJTT9QmCEIqPpuxozWFfVDgxSbzBGc44ia/WYLGVt2dqFIOc6/DmAmu/pa0gQ== dependencies: "@babel/runtime" "^7.5.4" - "@types/react" ">=16.9.0" - "@types/react-test-renderer" ">=16.9.0" + "@types/testing-library__react-hooks" "^2.0.0" "@types/babel__core@^7.1.0": version "7.1.0" @@ -2221,7 +2220,7 @@ resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8" integrity sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw== -"@types/react-test-renderer@>=16.9.0": +"@types/react-test-renderer@*": version "16.9.0" resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-16.9.0.tgz#d60f530ecf4c906721511603cca711b4fa830d41" integrity sha512-bN5EyjtuTY35xX7N5j0KP1vg5MpUXHpFTX6tGsqkNOthjNvet4VQOYRxFh+NT5cDSJrATmAFK9NLeYZ4mp/o0Q== @@ -2235,7 +2234,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@16.9.2", "@types/react@>=16.9.0": +"@types/react@*", "@types/react@16.9.2": version "16.9.2" resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.2.tgz#6d1765431a1ad1877979013906731aae373de268" integrity sha512-jYP2LWwlh+FTqGd9v7ynUKZzjj98T8x7Yclz479QdRhHfuW9yQ+0jjnD31eXSXutmBpppj5PYNLYLRfnZJvcfg== @@ -2248,6 +2247,14 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" integrity sha512-l42BggppR6zLmpfU6fq9HEa2oGPEI8yrSPL3GITjfRInppYFahObbIQOQK3UGxEnyQpltZLaPe75046NOZQikw== +"@types/testing-library__react-hooks@^2.0.0": + version "2.0.0" + resolved "https://registry.yarnpkg.com/@types/testing-library__react-hooks/-/testing-library__react-hooks-2.0.0.tgz#7b289d64945517ae8ba9cbcb0c5b282432aaeffa" + integrity sha512-YUVqXGCChJKEJ4aAnMXqPCq0NfPAFVsJeGIb2y/iiMjxwyu+45+vR+AHOwjJHHKEHeC0ZhOGrZ5gSEmaJe4tyQ== + dependencies: + "@types/react" "*" + "@types/react-test-renderer" "*" + "@types/yargs-parser@*": version "13.0.0" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.0.0.tgz#453743c5bbf9f1bed61d959baab5b06be029b2d0" From 29f07be8d5de5d2030bf868f78343b99160eebbd Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 3 Oct 2019 21:24:34 +0000 Subject: [PATCH 026/162] chore(deps): update react monorepo to v16.10.2 --- package.json | 6 +++--- yarn.lock | 36 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 94b92d0cff..325195b19a 100644 --- a/package.json +++ b/package.json @@ -89,11 +89,11 @@ "markdown-loader": "5.1.0", "prettier": "1.18.2", "raf-stub": "3.0.0", - "react": "16.10.1", - "react-dom": "16.10.1", + "react": "16.10.2", + "react-dom": "16.10.2", "react-frame-component": "4.1.1", "react-spring": "8.0.27", - "react-test-renderer": "16.10.1", + "react-test-renderer": "16.10.2", "rebound": "0.1.0", "redux-logger": "3.0.6", "redux-thunk": "2.3.0", diff --git a/yarn.lock b/yarn.lock index 8e605bb076..4117ee5620 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10345,15 +10345,15 @@ react-docgen@^4.1.0: node-dir "^0.1.10" recast "^0.17.3" -react-dom@16.10.1: - version "16.10.1" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.10.1.tgz#479a6511ba34a429273c213cbc2a9ac4d296dac1" - integrity sha512-SmM4ZW0uug0rn95U8uqr52I7UdNf6wdGLeXDmNLfg3y5q5H9eAbdjF5ubQc3bjDyRrvdAB2IKG7X0GzSpnn5Mg== +react-dom@16.10.2: + version "16.10.2" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.10.2.tgz#4840bce5409176bc3a1f2bd8cb10b92db452fda6" + integrity sha512-kWGDcH3ItJK4+6Pl9DZB16BXYAZyrYQItU4OMy0jAkv5aNqc+mAKb4TpFtAteI6TJZu+9ZlNhaeNQSVQDHJzkw== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" prop-types "^15.6.2" - scheduler "^0.16.1" + scheduler "^0.16.2" react-dom@^16.8.3: version "16.9.0" @@ -10510,15 +10510,15 @@ react-syntax-highlighter@^8.0.1: prismjs "^1.8.4" refractor "^2.4.1" -react-test-renderer@16.10.1: - version "16.10.1" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.10.1.tgz#75b8e8ce152e00eadd303e9fa514a2ca917ee049" - integrity sha512-VT8nd7XrrUV7MQPxeIuH7WstfrK2A8kgcMwGUtVXa0ja+CiYkxdmLYNjwX1L7irRF7ydzJJWiSLsQf2xBj4Xaw== +react-test-renderer@16.10.2: + version "16.10.2" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.10.2.tgz#4d8492f8678c9b43b721a7d79ed0840fdae7c518" + integrity sha512-k9Qzyev6cTIcIfrhgrFlYQAFxh5EEDO6ALNqYqmKsWVA7Q/rUMTay5nD3nthi6COmYsd4ghVYyi8U86aoeMqYQ== dependencies: object-assign "^4.1.1" prop-types "^15.6.2" react-is "^16.8.6" - scheduler "^0.16.1" + scheduler "^0.16.2" react-textarea-autosize@^7.1.0: version "7.1.0" @@ -10543,10 +10543,10 @@ react-wait@^0.3.0: resolved "https://registry.yarnpkg.com/react-wait/-/react-wait-0.3.0.tgz#0cdd4d919012451a5bc3ab0a16d00c6fd9a8c10b" integrity sha512-kB5x/kMKWcn0uVr9gBdNz21/oGbQwEQnF3P9p6E9yLfJ9DRcKS0fagbgYMFI0YFOoyKDj+2q6Rwax0kTYJF37g== -react@16.10.1: - version "16.10.1" - resolved "https://registry.yarnpkg.com/react/-/react-16.10.1.tgz#967c1e71a2767dfa699e6ba702a00483e3b0573f" - integrity sha512-2bisHwMhxQ3XQz4LiJJwG3360pY965pTl/MRrZYxIBKVj4fOHoDs5aZAkYXGxDRO1Li+SyjTAilQEbOmtQJHzA== +react@16.10.2: + version "16.10.2" + resolved "https://registry.yarnpkg.com/react/-/react-16.10.2.tgz#a5ede5cdd5c536f745173c8da47bda64797a4cf0" + integrity sha512-MFVIq0DpIhrHFyqLU0S3+4dIcBhhOvBE8bJ/5kHPVOVaGdo0KuiQzpcjCPsf585WvhypqtrMILyoE2th6dT+Lw== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" @@ -11222,10 +11222,10 @@ scheduler@^0.15.0: loose-envify "^1.1.0" object-assign "^4.1.1" -scheduler@^0.16.1: - version "0.16.1" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.16.1.tgz#a6fb6ddec12dc2119176e6eb54ecfe69a9eba8df" - integrity sha512-MIuie7SgsqMYOdCXVFZa8SKoNorJZUWHW8dPgto7uEHn1lX3fg2Gu0TzgK8USj76uxV7vB5eRMnZs/cdEHg+cg== +scheduler@^0.16.2: + version "0.16.2" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.16.2.tgz#f74cd9d33eff6fc554edfb79864868e4819132c1" + integrity sha512-BqYVWqwz6s1wZMhjFvLfVR5WXP7ZY32M/wYPo04CcuPM7XZEbV2TBNW7Z0UkguPTl0dWMA59VbNXxK6q+pHItg== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" From 49372acaed8cefc4919afc3ff882f558ba617a26 Mon Sep 17 00:00:00 2001 From: Ward Oosterlijnck Date: Sat, 5 Oct 2019 16:02:42 +1000 Subject: [PATCH 027/162] fix: move react-wait types to dev dependencies, closes #644 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 325195b19a..e6d9106dc4 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ }, "homepage": "https://github.com/streamich/react-use#readme", "dependencies": { - "@types/react-wait": "^0.3.0", "copy-to-clipboard": "^3.1.0", "nano-css": "^5.1.0", "react-fast-compare": "^2.0.4", @@ -77,6 +76,7 @@ "@testing-library/react-hooks": "2.0.3", "@types/jest": "24.0.18", "@types/react": "16.9.2", + "@types/react-wait": "^0.3.0", "babel-core": "6.26.3", "babel-loader": "8.0.6", "babel-plugin-dynamic-import-node": "2.3.0", From 8a16c1de1cca20ea1663975f8f0498399ec08170 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 5 Oct 2019 06:06:17 +0000 Subject: [PATCH 028/162] chore(release): 12.2.3 [skip ci] ## [12.2.3](https://github.com/streamich/react-use/compare/v12.2.2...v12.2.3) (2019-10-05) ### Bug Fixes * move react-wait types to dev dependencies, closes [#644](https://github.com/streamich/react-use/issues/644) ([49372ac](https://github.com/streamich/react-use/commit/49372ac)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f71bdd3dc7..8357ac04cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [12.2.3](https://github.com/streamich/react-use/compare/v12.2.2...v12.2.3) (2019-10-05) + + +### Bug Fixes + +* move react-wait types to dev dependencies, closes [#644](https://github.com/streamich/react-use/issues/644) ([49372ac](https://github.com/streamich/react-use/commit/49372ac)) + ## [12.2.2](https://github.com/streamich/react-use/compare/v12.2.1...v12.2.2) (2019-09-26) diff --git a/package.json b/package.json index e6d9106dc4..b02d35fe74 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.2.2", + "version": "12.2.3", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From a6afe924a0d1b0c13ffc5cbb2dc416bcad19fe42 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 5 Oct 2019 06:04:51 +0000 Subject: [PATCH 029/162] chore(deps): pin dependency @types/react-wait to 0.3.0 --- package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b02d35fe74..59674b5d42 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "@testing-library/react-hooks": "2.0.3", "@types/jest": "24.0.18", "@types/react": "16.9.2", - "@types/react-wait": "^0.3.0", + "@types/react-wait": "0.3.0", "babel-core": "6.26.3", "babel-loader": "8.0.6", "babel-plugin-dynamic-import-node": "2.3.0", diff --git a/yarn.lock b/yarn.lock index 4117ee5620..68fad2ee5f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2227,7 +2227,7 @@ dependencies: "@types/react" "*" -"@types/react-wait@^0.3.0": +"@types/react-wait@0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@types/react-wait/-/react-wait-0.3.0.tgz#6f7ef17571a17e72c7864ede8cf7d3aa525a005e" integrity sha512-5jIfDcHRjqeE7QfZG7kCqOpfrPSvOM1E3/nlKuJ/NZrG/WrhLo/AFr0i72jhTWzyNRo4ex0pshBaiCHksZXH3A== From ae6510550e177fcb6cda297cf6c6a2be9cb7a360 Mon Sep 17 00:00:00 2001 From: Jake Boone Date: Sat, 5 Oct 2019 19:05:50 -0700 Subject: [PATCH 030/162] chore(deps): update screenfull to v5.0.0 (#645) --- package.json | 2 +- src/useFullscreen.ts | 6 +++--- yarn.lock | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 59674b5d42..be4bb824e4 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "react-fast-compare": "^2.0.4", "react-wait": "^0.3.0", "resize-observer-polyfill": "^1.5.1", - "screenfull": "^4.1.0", + "screenfull": "^5.0.0", "set-harmonic-interval": "^1.0.0", "throttle-debounce": "^2.0.1", "ts-easing": "^0.2.0" diff --git a/src/useFullscreen.ts b/src/useFullscreen.ts index 52f63705ff..afb754fdd9 100644 --- a/src/useFullscreen.ts +++ b/src/useFullscreen.ts @@ -26,7 +26,7 @@ const useFullscreen = (ref: RefObject, on: boolean, options: FullScreen }; const onChange = () => { - if (screenfull) { + if (screenfull.isEnabled) { const isScreenfullFullscreen = screenfull.isFullscreen; setIsFullscreen(isScreenfullFullscreen); if (!isScreenfullFullscreen) { @@ -35,7 +35,7 @@ const useFullscreen = (ref: RefObject, on: boolean, options: FullScreen } }; - if (screenfull && screenfull.enabled) { + if (screenfull.isEnabled) { try { screenfull.request(ref.current); setIsFullscreen(true); @@ -55,7 +55,7 @@ const useFullscreen = (ref: RefObject, on: boolean, options: FullScreen return () => { setIsFullscreen(false); - if (screenfull && screenfull.enabled) { + if (screenfull.isEnabled) { try { screenfull.off('change', onChange); screenfull.exit(); diff --git a/yarn.lock b/yarn.lock index 68fad2ee5f..64fb7c0a0a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11239,10 +11239,10 @@ schema-utils@^1.0.0: ajv-errors "^1.0.0" ajv-keywords "^3.1.0" -screenfull@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-4.1.0.tgz#30eb338f615941f5a2cdd96c14e36063d2d9d764" - integrity sha512-/qH0HAmc+ilbZ9Vf8J7RHjjecSdqmjIh98iMkA6uCSKcHdJK1TiXhTbR+cin8rG70xi4Peyz7wW1KJVP6sp30g== +screenfull@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-5.0.0.tgz#5c2010c0e84fd4157bf852877698f90b8cbe96f6" + integrity sha512-yShzhaIoE9OtOhWVyBBffA6V98CDCoyHTsp8228blmqYy1Z5bddzE/4FPiJKlr8DVR4VBiiUyfPzIQPIYDkeMA== scrollbarwidth@^0.1.3: version "0.1.3" From 529362e60f722742df0a24f6a75344fe52e07212 Mon Sep 17 00:00:00 2001 From: Arty Date: Sat, 5 Oct 2019 19:09:19 -0700 Subject: [PATCH 031/162] docs: useStateList demo link (#647) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f54afa21d6..81fe7ee9b7 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ - [`usePrevious`](./docs/usePrevious.md) — returns the previous state or props. - [`useObservable`](./docs/useObservable.md) — tracks latest value of an `Observable`. - [`useSetState`](./docs/useSetState.md) — creates `setState` method which works like `this.setState`. [![][img-demo]](https://codesandbox.io/s/n75zqn1xp0) - - [`useStateList`](./docs/useStateList.md) — circularly iterates over an array. + - [`useStateList`](./docs/useStateList.md) — circularly iterates over an array. [![][img-demo]](https://codesandbox.io/s/bold-dewdney-pjzkd) - [`useToggle` and `useBoolean`](./docs/useToggle.md) — tracks state of a boolean. - [`useCounter` and `useNumber`](./docs/useCounter.md) — tracks state of a number. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usecounter--demo) - [`useList`](./docs/useList.md) — tracks state of an array. From 9f003fda1c44efe72834cf098878655ac862f36b Mon Sep 17 00:00:00 2001 From: Arty Date: Sat, 5 Oct 2019 19:12:57 -0700 Subject: [PATCH 032/162] docs: usePrevious demo link (#651) --- README.md | 2 +- docs/usePrevious.md | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 81fe7ee9b7..7f14898662 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ - [`useDefault`](./docs/useDefault.md) — returns the default value when state is `null` or `undefined`. - [`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. - - [`usePrevious`](./docs/usePrevious.md) — returns the previous state or props. + - [`usePrevious`](./docs/usePrevious.md) — returns the previous state or props. [![][img-demo]](https://codesandbox.io/s/fervent-galileo-krgx6) - [`useObservable`](./docs/useObservable.md) — tracks latest value of an `Observable`. - [`useSetState`](./docs/useSetState.md) — creates `setState` method which works like `this.setState`. [![][img-demo]](https://codesandbox.io/s/n75zqn1xp0) - [`useStateList`](./docs/useStateList.md) — circularly iterates over an array. [![][img-demo]](https://codesandbox.io/s/bold-dewdney-pjzkd) diff --git a/docs/usePrevious.md b/docs/usePrevious.md index 953dee14e1..76c49d4abd 100644 --- a/docs/usePrevious.md +++ b/docs/usePrevious.md @@ -13,7 +13,11 @@ const Demo = () => { return (

- Now: {count}, before: {prevCount} + + +

+ Now: {count}, before: {prevCount} +

); }; From b1fc6a75a6e18a2a089cf7e55704414681ad85ad Mon Sep 17 00:00:00 2001 From: Arty Date: Sun, 6 Oct 2019 20:14:02 -0700 Subject: [PATCH 033/162] docs: useToggle demo link (#648) --- README.md | 2 +- docs/useToggle.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7f14898662..166a851580 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ - [`useObservable`](./docs/useObservable.md) — tracks latest value of an `Observable`. - [`useSetState`](./docs/useSetState.md) — creates `setState` method which works like `this.setState`. [![][img-demo]](https://codesandbox.io/s/n75zqn1xp0) - [`useStateList`](./docs/useStateList.md) — circularly iterates over an array. [![][img-demo]](https://codesandbox.io/s/bold-dewdney-pjzkd) - - [`useToggle` and `useBoolean`](./docs/useToggle.md) — tracks state of a boolean. + - [`useToggle` and `useBoolean`](./docs/useToggle.md) — tracks state of a boolean. [![][img-demo]](https://codesandbox.io/s/focused-sammet-brw2d) - [`useCounter` and `useNumber`](./docs/useCounter.md) — tracks state of a number. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usecounter--demo) - [`useList`](./docs/useList.md) — tracks state of an array. - [`useMap`](./docs/useMap.md) — tracks state of an object. diff --git a/docs/useToggle.md b/docs/useToggle.md index e1a342e76a..0405c6ce18 100644 --- a/docs/useToggle.md +++ b/docs/useToggle.md @@ -7,7 +7,7 @@ React state hook that tracks value of a boolean. ## Usage ```jsx -import {useToggle, useBoolean} from 'react-use'; +import {useToggle} from 'react-use'; const Demo = () => { const [on, toggle] = useToggle(true); From c520797fd5756cb94892dfe87974ffb6f6b93d65 Mon Sep 17 00:00:00 2001 From: Arty Date: Sun, 6 Oct 2019 22:02:45 -0700 Subject: [PATCH 034/162] docs: useMap demo link + improved docs (#650) * improve docs: useMap demo link * improve docs: useMap demo link (remove callback usage added) * Add remove action to useMap story --- README.md | 2 +- docs/useMap.md | 14 ++++++++++---- src/__stories__/useMap.story.tsx | 7 +++++-- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 166a851580..b8ffca34e4 100644 --- a/README.md +++ b/README.md @@ -132,7 +132,7 @@ - [`useToggle` and `useBoolean`](./docs/useToggle.md) — tracks state of a boolean. [![][img-demo]](https://codesandbox.io/s/focused-sammet-brw2d) - [`useCounter` and `useNumber`](./docs/useCounter.md) — tracks state of a number. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usecounter--demo) - [`useList`](./docs/useList.md) — tracks state of an array. - - [`useMap`](./docs/useMap.md) — tracks state of an object. + - [`useMap`](./docs/useMap.md) — tracks state of an object. [![][img-demo]](https://codesandbox.io/s/quirky-dewdney-gi161)
diff --git a/docs/useMap.md b/docs/useMap.md index 99e5e131f4..cf3273afe3 100644 --- a/docs/useMap.md +++ b/docs/useMap.md @@ -2,22 +2,28 @@ React state hook that tracks a value of an object. - ## Usage ```jsx import {useMap} from 'react-use'; const Demo = () => { - const [map, {set, reset}] = useMap({ + const [map, {set, remove, reset}] = useMap({ hello: 'there', }); return (
+ + +
{JSON.stringify(map, null, 2)}
- -
); }; diff --git a/src/__stories__/useMap.story.tsx b/src/__stories__/useMap.story.tsx index 83c2b95e80..1e5d085f13 100644 --- a/src/__stories__/useMap.story.tsx +++ b/src/__stories__/useMap.story.tsx @@ -4,15 +4,18 @@ import { useMap } from '..'; import ShowDocs from './util/ShowDocs'; const Demo = () => { - const [map, { set, reset }] = useMap({ + const [map, { set, remove, reset }] = useMap({ hello: 'there', }); return (
-
{JSON.stringify(map, null, 2)}
+ +
{JSON.stringify(map, null, 2)}
); }; From 4f4849412628ad063285d32b7bcd54d118ebfcec Mon Sep 17 00:00:00 2001 From: Arty Date: Sun, 6 Oct 2019 22:04:09 -0700 Subject: [PATCH 035/162] docs: useList demo link + improve docs (#649) * improve docs: useList demo link * improve docs: useList demo link (examples of callbacks usage) * Add all callback methods to useList story --- README.md | 2 +- docs/useList.md | 15 ++++++++++----- src/__stories__/useList.story.tsx | 14 ++++++++++---- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index b8ffca34e4..5e1b99f77a 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ - [`useStateList`](./docs/useStateList.md) — circularly iterates over an array. [![][img-demo]](https://codesandbox.io/s/bold-dewdney-pjzkd) - [`useToggle` and `useBoolean`](./docs/useToggle.md) — tracks state of a boolean. [![][img-demo]](https://codesandbox.io/s/focused-sammet-brw2d) - [`useCounter` and `useNumber`](./docs/useCounter.md) — tracks state of a number. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usecounter--demo) - - [`useList`](./docs/useList.md) — tracks state of an array. + - [`useList`](./docs/useList.md) — tracks state of an array. [![][img-demo]](https://codesandbox.io/s/wonderful-mahavira-1sm0w) - [`useMap`](./docs/useMap.md) — tracks state of an object. [![][img-demo]](https://codesandbox.io/s/quirky-dewdney-gi161) diff --git a/docs/useList.md b/docs/useList.md index 48b2c9a020..b2dad670e6 100644 --- a/docs/useList.md +++ b/docs/useList.md @@ -2,20 +2,25 @@ React state hook that tracks a value of an array. - ## Usage ```jsx import {useList} from 'react-use'; const Demo = () => { - const [list, {set, push}] = useList(); + const [list, { clear, filter, push, remove, set, sort, updateAt }] = useList(); return (
-
{list.join(',')}
- - + + + + + + + + +
{JSON.stringify(list, null, 2)}
); }; diff --git a/src/__stories__/useList.story.tsx b/src/__stories__/useList.story.tsx index 912552a237..f720447b27 100644 --- a/src/__stories__/useList.story.tsx +++ b/src/__stories__/useList.story.tsx @@ -4,13 +4,19 @@ import { useList } from '..'; import ShowDocs from './util/ShowDocs'; const Demo = () => { - const [list, { set, push }] = useList(); + const [list, { clear, filter, push, remove, set, sort, updateAt }] = useList(); return (
-
{list.join(',')}
- - + + + + + + + + +
{JSON.stringify(list, null, 2)}
); }; From 03ccfa98459698b3d84dc65ec9bd6ad3ade1785a Mon Sep 17 00:00:00 2001 From: Ward Oosterlijnck Date: Mon, 7 Oct 2019 20:50:19 +1100 Subject: [PATCH 036/162] docs: add useUpsert to readme --- README.md | 2 +- docs/useList.md | 4 ++++ docs/useUpsert.md | 7 ++++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5e1b99f77a..3ba51e52bb 100644 --- a/README.md +++ b/README.md @@ -131,7 +131,7 @@ - [`useStateList`](./docs/useStateList.md) — circularly iterates over an array. [![][img-demo]](https://codesandbox.io/s/bold-dewdney-pjzkd) - [`useToggle` and `useBoolean`](./docs/useToggle.md) — tracks state of a boolean. [![][img-demo]](https://codesandbox.io/s/focused-sammet-brw2d) - [`useCounter` and `useNumber`](./docs/useCounter.md) — tracks state of a number. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usecounter--demo) - - [`useList`](./docs/useList.md) — tracks state of an array. [![][img-demo]](https://codesandbox.io/s/wonderful-mahavira-1sm0w) + - [`useList`](./docs/useList.md) and [`useUpsert`](./docs/useUpsert.md) — tracks state of an array. [![][img-demo]](https://codesandbox.io/s/wonderful-mahavira-1sm0w) - [`useMap`](./docs/useMap.md) — tracks state of an object. [![][img-demo]](https://codesandbox.io/s/quirky-dewdney-gi161) diff --git a/docs/useList.md b/docs/useList.md index b2dad670e6..e09709c95a 100644 --- a/docs/useList.md +++ b/docs/useList.md @@ -25,3 +25,7 @@ const Demo = () => { ); }; ``` + +## Related hooks + +- [useUpsert](./useUpsert.md) diff --git a/docs/useUpsert.md b/docs/useUpsert.md index 2384660db7..48c3de554c 100644 --- a/docs/useUpsert.md +++ b/docs/useUpsert.md @@ -1,6 +1,7 @@ # `useUpsert` -Superset of `useList`. Provides an additional method to upsert (update or insert) an element into the list. +Superset of [`useList`](./useList.md). Provides an additional method to upsert (update or insert) an element into the list. + ## Usage ```jsx @@ -26,3 +27,7 @@ const Demo = () => { ); }; ``` + +## Related hooks + +- [useList](./useList.md) From 471da2aea3a413a9f6769db513e2aa4b7c759944 Mon Sep 17 00:00:00 2001 From: Ward Oosterlijnck Date: Mon, 7 Oct 2019 21:07:39 +1100 Subject: [PATCH 037/162] docs: useSearchParam warning about hash routers, closes #637 --- docs/useSearchParam.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/useSearchParam.md b/docs/useSearchParam.md index f118467656..6d9fe29c56 100644 --- a/docs/useSearchParam.md +++ b/docs/useSearchParam.md @@ -2,7 +2,6 @@ React sensor hook that tracks browser's location search param. - ## Usage ```jsx @@ -27,3 +26,7 @@ const Demo = () => { ); }; ``` + +## Caveats/Gotchas + +When using a hash router, like `react-router`'s [``](https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/api/HashRouter.md), this hook won't be able to read the search parameters as they are considered part of the hash of the URL by browsers. From 9ea3548e4ca34cce659a4b266febfd8571fd53c6 Mon Sep 17 00:00:00 2001 From: Ward Date: Tue, 8 Oct 2019 08:30:21 +1100 Subject: [PATCH 038/162] feat: reset util callback for useList (#654) --- docs/useList.md | 5 ++-- src/__stories__/useList.story.tsx | 5 ++-- src/__tests__/useList.test.ts | 41 +++++++++++++++++++++++++++++++ src/useList.ts | 16 +++++++----- 4 files changed, 57 insertions(+), 10 deletions(-) diff --git a/docs/useList.md b/docs/useList.md index e09709c95a..2e33e188a5 100644 --- a/docs/useList.md +++ b/docs/useList.md @@ -8,7 +8,7 @@ React state hook that tracks a value of an array. import {useList} from 'react-use'; const Demo = () => { - const [list, { clear, filter, push, remove, set, sort, updateAt }] = useList(); + const [list, { clear, filter, push, remove, set, sort, updateAt, reset }] = useList(); return (
@@ -19,7 +19,8 @@ const Demo = () => { - + +
{JSON.stringify(list, null, 2)}
); diff --git a/src/__stories__/useList.story.tsx b/src/__stories__/useList.story.tsx index f720447b27..2ccfb611de 100644 --- a/src/__stories__/useList.story.tsx +++ b/src/__stories__/useList.story.tsx @@ -4,7 +4,7 @@ import { useList } from '..'; import ShowDocs from './util/ShowDocs'; const Demo = () => { - const [list, { clear, filter, push, remove, set, sort, updateAt }] = useList(); + const [list, { clear, filter, push, remove, set, sort, updateAt, reset }] = useList([1, 2, 3, 4, 5]); return (
@@ -15,7 +15,8 @@ const Demo = () => { - + +
{JSON.stringify(list, null, 2)}
); diff --git a/src/__tests__/useList.test.ts b/src/__tests__/useList.test.ts index 047e6e6840..f8dc9584e9 100644 --- a/src/__tests__/useList.test.ts +++ b/src/__tests__/useList.test.ts @@ -16,6 +16,7 @@ it('should init list and utils', () => { push: expect.any(Function), filter: expect.any(Function), sort: expect.any(Function), + reset: expect.any(Function), }); }); @@ -150,3 +151,43 @@ it('should sort current list by provided function', () => { expect(result.current[0]).toEqual(['March', 'Jan', 'Feb', 'Dec']); expect(result.current[0]).not.toBe(initList); // checking immutability }); + +it('should reset the list to initial list provided', () => { + const initList = [1, 2, 3]; + const { result } = setUp(initList); + const [, utils] = result.current; + + act(() => { + utils.push(4); + }); + + expect(result.current[0]).toEqual([1, 2, 3, 4]); + + act(() => { + utils.reset(); + }); + + expect(result.current[0]).toEqual([1, 2, 3]); + expect(result.current[0]).not.toBe(initList); // checking immutability +}); + +it('should memoized its utils methods', () => { + const initList = [1, 2, 3]; + const { result } = setUp(initList); + const [, utils] = result.current; + const { set, clear, updateAt, remove, push, filter, sort, reset } = utils; + + act(() => { + push(4); + }); + + expect(result.current[1]).toBe(utils); + expect(result.current[1].set).toBe(set); + expect(result.current[1].clear).toBe(clear); + expect(result.current[1].updateAt).toBe(updateAt); + expect(result.current[1].remove).toBe(remove); + expect(result.current[1].push).toBe(push); + expect(result.current[1].filter).toBe(filter); + expect(result.current[1].sort).toBe(sort); + expect(result.current[1].reset).toBe(reset); +}); diff --git a/src/useList.ts b/src/useList.ts index 5e292987aa..500008180e 100644 --- a/src/useList.ts +++ b/src/useList.ts @@ -1,4 +1,4 @@ -import { useState } from 'react'; +import { useState, useMemo } from 'react'; export interface Actions { set: (list: T[]) => void; @@ -8,14 +8,14 @@ export interface Actions { push: (item: T) => void; filter: (fn: (value: T) => boolean) => void; sort: (fn?: (a: T, b: T) => number) => void; + reset: () => void; } const useList = (initialList: T[] = []): [T[], Actions] => { const [list, set] = useState(initialList); - return [ - list, - { + const utils = useMemo>( + () => ({ set, clear: () => set([]), updateAt: (index, entry) => @@ -24,8 +24,12 @@ const useList = (initialList: T[] = []): [T[], Actions] => { push: entry => set(currentList => [...currentList, entry]), filter: fn => set(currentList => currentList.filter(fn)), sort: (fn?) => set(currentList => [...currentList].sort(fn)), - }, - ]; + reset: () => set([...initialList]), + }), + [set] + ); + + return [list, utils]; }; export default useList; From 2ab1460c43d00c7b59ad1c6161dd325991ae85ac Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 7 Oct 2019 21:33:53 +0000 Subject: [PATCH 039/162] chore(release): 12.3.0 [skip ci] # [12.3.0](https://github.com/streamich/react-use/compare/v12.2.3...v12.3.0) (2019-10-07) ### Features * reset util callback for useList ([#654](https://github.com/streamich/react-use/issues/654)) ([9ea3548](https://github.com/streamich/react-use/commit/9ea3548)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8357ac04cb..6e84f524bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [12.3.0](https://github.com/streamich/react-use/compare/v12.2.3...v12.3.0) (2019-10-07) + + +### Features + +* reset util callback for useList ([#654](https://github.com/streamich/react-use/issues/654)) ([9ea3548](https://github.com/streamich/react-use/commit/9ea3548)) + ## [12.2.3](https://github.com/streamich/react-use/compare/v12.2.2...v12.2.3) (2019-10-05) diff --git a/package.json b/package.json index be4bb824e4..6b5b24c1a0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.2.3", + "version": "12.3.0", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From c1484cbdfde1a7eea76adf7dd5fdc98b42ed38b6 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 8 Oct 2019 05:54:24 +0000 Subject: [PATCH 040/162] chore(deps): update dependency lint-staged to v9.4.2 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 6b5b24c1a0..3a46236017 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "husky": "3.0.8", "jest": "24.9.0", "keyboardjs": "2.5.1", - "lint-staged": "9.4.1", + "lint-staged": "9.4.2", "markdown-loader": "5.1.0", "prettier": "1.18.2", "raf-stub": "3.0.0", diff --git a/yarn.lock b/yarn.lock index 64fb7c0a0a..e1c3d4eb5a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7978,10 +7978,10 @@ lines-and-columns@^1.1.6: resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= -lint-staged@9.4.1: - version "9.4.1" - resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.4.1.tgz#60c0f85745bd398e6460aa7f5adb3cad3a2b862c" - integrity sha512-zFRbo1bAJEVf1m33paTTjDVfy2v3lICCqHfmQSgNoI+lWpi7HPG5y/R2Y7Whdce+FKxlZYs/U1sDSx8+nmQdDA== +lint-staged@9.4.2: + version "9.4.2" + resolved "https://registry.yarnpkg.com/lint-staged/-/lint-staged-9.4.2.tgz#14cb577a9512f520691f8b5aefce6a8f7ead6c04" + integrity sha512-OFyGokJSWTn2M6vngnlLXjaHhi8n83VIZZ5/1Z26SULRUWgR3ITWpAEQC9Pnm3MC/EpCxlwts/mQWDHNji2+zA== dependencies: chalk "^2.4.2" commander "^2.20.0" From b1944a1bdc84494737fd36b2e3229378da5d0d70 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 8 Oct 2019 12:23:39 +0000 Subject: [PATCH 041/162] chore(deps): update yarn to v1.19.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3a46236017..46d408e60b 100644 --- a/package.json +++ b/package.json @@ -141,7 +141,7 @@ }, "volta": { "node": "10.16.3", - "yarn": "1.19.0" + "yarn": "1.19.1" }, "collective": { "type": "opencollective", From 706f6607817c336a9324ea3fbee87661379bc909 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 8 Oct 2019 19:52:14 +0000 Subject: [PATCH 042/162] chore(deps): update babel monorepo to v7.6.3 --- package.json | 6 ++-- yarn.lock | 98 +++++++++++++++++++++++++++++++++++++++------------- 2 files changed, 77 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index 46d408e60b..ef1fa6aad0 100644 --- a/package.json +++ b/package.json @@ -60,10 +60,10 @@ "react-dom": "^16.8.0" }, "devDependencies": { - "@babel/core": "7.6.2", + "@babel/core": "7.6.3", "@babel/plugin-syntax-dynamic-import": "7.2.0", - "@babel/preset-env": "7.6.2", - "@babel/preset-react": "7.0.0", + "@babel/preset-env": "7.6.3", + "@babel/preset-react": "7.6.3", "@babel/preset-typescript": "7.6.0", "@semantic-release/changelog": "3.0.4", "@semantic-release/git": "7.0.16", diff --git a/yarn.lock b/yarn.lock index e1c3d4eb5a..5751c12d80 100644 --- a/yarn.lock +++ b/yarn.lock @@ -36,25 +36,25 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.2.tgz#069a776e8d5e9eefff76236bc8845566bd31dd91" - integrity sha512-l8zto/fuoZIbncm+01p8zPSDZu/VuuJhAfA7d/AbzM09WR7iVhavvfNDYCNpo1VvLk6E6xgAoP9P+/EMJHuRkQ== +"@babel/core@7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.3.tgz#44de824e89eaa089bb12da7337bc9bdff2ab68f9" + integrity sha512-QfQ5jTBgXLzJuo7Mo8bZK/ePywmgNRgk/UQykiKwEtZPiFIn8ZqE6jB+AnD1hbB1S2xQyL4//it5vuAUOVAMTw== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.6.2" + "@babel/generator" "^7.6.3" "@babel/helpers" "^7.6.2" - "@babel/parser" "^7.6.2" + "@babel/parser" "^7.6.3" "@babel/template" "^7.6.0" - "@babel/traverse" "^7.6.2" - "@babel/types" "^7.6.0" + "@babel/traverse" "^7.6.3" + "@babel/types" "^7.6.3" convert-source-map "^1.1.0" debug "^4.1.0" json5 "^2.1.0" lodash "^4.17.13" resolve "^1.3.2" semver "^5.4.1" - source-map "^0.5.0" + source-map "^0.6.1" "@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.4.5": version "7.5.5" @@ -97,6 +97,16 @@ lodash "^4.17.13" source-map "^0.5.0" +"@babel/generator@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.3.tgz#71d5375264f93ec7bac7d9f35a67067733f5578e" + integrity sha512-hLhYbAb3pHwxjlijC4AQ7mqZdcoujiNaW7izCT04CIowHK8psN0IN8QjDv0iyFtycF5FowUOTwDloIheI25aMw== + dependencies: + "@babel/types" "^7.6.3" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.6.1" + "@babel/helper-annotate-as-pure@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" @@ -326,6 +336,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.2.tgz#205e9c95e16ba3b8b96090677a67c9d6075b70a1" integrity sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg== +"@babel/parser@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.3.tgz#9eff8b9c3eeae16a74d8d4ff30da2bd0d6f0487e" + integrity sha512-sUZdXlva1dt2Vw2RqbMkmfoImubO0D0gaCrNngV6Hi0DA4x3o4mlrq0tbfY0dZEUIccH8I6wQ4qgEtwcpOR6Qg== + "@babel/plugin-proposal-async-generator-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" @@ -512,10 +527,10 @@ "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.13" -"@babel/plugin-transform-block-scoping@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.2.tgz#96c33ab97a9ae500cc6f5b19e04a7e6553360a79" - integrity sha512-zZT8ivau9LOQQaOGC7bQLQOT4XPkPXgN2ERfUgk1X8ql+mVkLc4E8eKk+FO3o0154kxzqenWCorfmEXpEZcrSQ== +"@babel/plugin-transform-block-scoping@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.3.tgz#6e854e51fbbaa84351b15d4ddafe342f3a5d542a" + integrity sha512-7hvrg75dubcO3ZI2rjYTzUrEuh1E9IyDEhhB6qfcooxhDA33xx2MasuLVgdxzcP6R/lipAC6n9ub9maNW6RKdw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.13" @@ -699,10 +714,10 @@ dependencies: regexp-tree "^0.1.6" -"@babel/plugin-transform-named-capturing-groups-regex@^7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.2.tgz#c1ca0bb84b94f385ca302c3932e870b0fb0e522b" - integrity sha512-xBdB+XOs+lgbZc2/4F5BVDVcDNS4tcSKQc96KmlqLEAwz6tpYPEvPdmDfvVG0Ssn8lAhronaRs6Z6KSexIpK5g== +"@babel/plugin-transform-named-capturing-groups-regex@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.3.tgz#aaa6e409dd4fb2e50b6e2a91f7e3a3149dbce0cf" + integrity sha512-jTkk7/uE6H2s5w6VlMHeWuH+Pcy2lmdwFoeWCVnvIrDUnB5gQqTVI8WfmEAhF2CDEarGrknZcmSFg1+bkfCoSw== dependencies: regexpu-core "^4.6.0" @@ -934,10 +949,10 @@ js-levenshtein "^1.1.3" semver "^5.5.0" -"@babel/preset-env@7.6.2": - version "7.6.2" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.2.tgz#abbb3ed785c7fe4220d4c82a53621d71fc0c75d3" - integrity sha512-Ru7+mfzy9M1/YTEtlDS8CD45jd22ngb9tXnn64DvQK3ooyqSw9K4K9DUWmYknTTVk4TqygL9dqCrZgm1HMea/Q== +"@babel/preset-env@7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.3.tgz#9e1bf05a2e2d687036d24c40e4639dc46cef2271" + integrity sha512-CWQkn7EVnwzlOdR5NOm2+pfgSNEZmvGjOhlCHBDq0J8/EStr+G+FvPEiz9B56dR6MoiUFjXhfE4hjLoAKKJtIQ== dependencies: "@babel/helper-module-imports" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" @@ -955,7 +970,7 @@ "@babel/plugin-transform-arrow-functions" "^7.2.0" "@babel/plugin-transform-async-to-generator" "^7.5.0" "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.6.2" + "@babel/plugin-transform-block-scoping" "^7.6.3" "@babel/plugin-transform-classes" "^7.5.5" "@babel/plugin-transform-computed-properties" "^7.2.0" "@babel/plugin-transform-destructuring" "^7.6.0" @@ -970,7 +985,7 @@ "@babel/plugin-transform-modules-commonjs" "^7.6.0" "@babel/plugin-transform-modules-systemjs" "^7.5.0" "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.6.2" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.6.3" "@babel/plugin-transform-new-target" "^7.4.4" "@babel/plugin-transform-object-super" "^7.5.5" "@babel/plugin-transform-parameters" "^7.4.4" @@ -983,7 +998,7 @@ "@babel/plugin-transform-template-literals" "^7.4.4" "@babel/plugin-transform-typeof-symbol" "^7.2.0" "@babel/plugin-transform-unicode-regex" "^7.6.2" - "@babel/types" "^7.6.0" + "@babel/types" "^7.6.3" browserslist "^4.6.0" core-js-compat "^3.1.1" invariant "^2.2.2" @@ -1065,6 +1080,17 @@ "@babel/plugin-transform-react-jsx-self" "^7.0.0" "@babel/plugin-transform-react-jsx-source" "^7.0.0" +"@babel/preset-react@7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.6.3.tgz#d5242c828322520205ae4eda5d4f4f618964e2f6" + integrity sha512-07yQhmkZmRAfwREYIQgW0HEwMY9GBJVuPY4Q12UC72AbfaawuupVWa8zQs2tlL+yun45Nv/1KreII/0PLfEsgA== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-react-display-name" "^7.0.0" + "@babel/plugin-transform-react-jsx" "^7.0.0" + "@babel/plugin-transform-react-jsx-self" "^7.0.0" + "@babel/plugin-transform-react-jsx-source" "^7.0.0" + "@babel/preset-typescript@7.3.3": version "7.3.3" resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.3.3.tgz#88669911053fa16b2b276ea2ede2ca603b3f307a" @@ -1150,6 +1176,21 @@ globals "^11.1.0" lodash "^4.17.13" +"@babel/traverse@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.3.tgz#66d7dba146b086703c0fb10dd588b7364cec47f9" + integrity sha512-unn7P4LGsijIxaAJo/wpoU11zN+2IaClkQAxcJWBNCMS6cmVh802IyLHNkAjQ0iYnRS3nnxk5O3fuXW28IMxTw== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.6.3" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.6.3" + "@babel/types" "^7.6.3" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + "@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" @@ -1168,6 +1209,15 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@babel/types@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.3.tgz#3f07d96f854f98e2fbd45c64b0cb942d11e8ba09" + integrity sha512-CqbcpTxMcpuQTMhjI37ZHVgjBkysg5icREQIEZ0eG1yCNwg3oy+5AaLiOKmjsCj6nqOsa6Hf0ObjRVwokb7srA== + dependencies: + esutils "^2.0.2" + lodash "^4.17.13" + to-fast-properties "^2.0.0" + "@cnakazawa/watch@^1.0.3": version "1.0.3" resolved "https://registry.yarnpkg.com/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" From da0e66bb89af309f0da4f21c837f438a8b447331 Mon Sep 17 00:00:00 2001 From: qianL93 Date: Thu, 10 Oct 2019 14:14:54 +0800 Subject: [PATCH 043/162] fix: useSize avoid crash in Safari 11 --- src/useSize.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/useSize.tsx b/src/useSize.tsx index c0f8776fa0..214ceaf16c 100644 --- a/src/useSize.tsx +++ b/src/useSize.tsx @@ -67,7 +67,7 @@ const useSize = ( } return () => { - if (window) { + if (window && window.removeEventListener) { window.removeEventListener('resize', setSize); } }; From d1aaa855fc990d8bd47d66abe9b688e55d09557d Mon Sep 17 00:00:00 2001 From: Kevin Norris Date: Thu, 10 Oct 2019 23:29:01 +1300 Subject: [PATCH 044/162] tests: useFavicon (#666) --- src/__tests__/useFavicon.test.tsx | 55 +++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/__tests__/useFavicon.test.tsx diff --git a/src/__tests__/useFavicon.test.tsx b/src/__tests__/useFavicon.test.tsx new file mode 100644 index 0000000000..fcbbda43f0 --- /dev/null +++ b/src/__tests__/useFavicon.test.tsx @@ -0,0 +1,55 @@ +import { renderHook } from '@testing-library/react-hooks'; +import useFavicon from '../useFavicon'; + +afterEach(() => { + const favicon = document.querySelector("link[rel*='icon']"); + if (favicon) { + favicon.remove(); + } +}); + +describe('useFavicon', () => { + it('should be defined', () => { + expect(useFavicon).toBeDefined(); + }); + + it('should create a HTMLLinkElement', () => { + const faviconBeforeHook = document.querySelector("link[rel*='icon']"); + + expect(faviconBeforeHook).toBe(null); + renderHook(() => useFavicon('My-favicon')); + + const faviconAfterHook = document.querySelector("link[rel*='icon']"); + expect(faviconAfterHook).toBeInstanceOf(HTMLLinkElement); + }); + + it('should set the elements type to "image/x-icon"', () => { + renderHook(() => useFavicon('My-favicon')); + const favicon = document.querySelector("link[rel*='icon']") as HTMLLinkElement; + + expect(favicon.type).toBe('image/x-icon'); + }); + + it('should set the elements rel to "shortcut icon"', () => { + renderHook(() => useFavicon('My-favicon')); + const favicon = document.querySelector("link[rel*='icon']") as HTMLLinkElement; + + expect(favicon.rel).toBe('shortcut icon'); + }); + + it('should set the elements href to the provided string', () => { + renderHook(() => useFavicon('https://github.com/streamich/react-use')); + const favicon = document.querySelector("link[rel*='icon']") as HTMLLinkElement; + + expect(favicon.href).toBe('https://github.com/streamich/react-use'); + }); + + it('should update an existing favicon', () => { + const hook = renderHook(props => useFavicon(props), { initialProps: 'https://github.com/streamich/react-use' }); + const favicon = document.querySelector("link[rel*='icon']") as HTMLLinkElement; + + expect(favicon.href).toBe('https://github.com/streamich/react-use'); + hook.rerender('https://en.wikipedia.org/wiki/Favicon'); + expect(favicon.href).toBe('https://en.wikipedia.org/wiki/Favicon'); + }); +}); From 6bdd74e79cf9ff83ed1afd5cda3b62a90267e441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Kostrzewski?= Date: Thu, 10 Oct 2019 13:39:24 +0200 Subject: [PATCH 045/162] fix: move @types/react-wait to dependencies, closes #661 (#662) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef1fa6aad0..3049f9854e 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ }, "homepage": "https://github.com/streamich/react-use#readme", "dependencies": { + "@types/react-wait": "^0.3.0", "copy-to-clipboard": "^3.1.0", "nano-css": "^5.1.0", "react-fast-compare": "^2.0.4", @@ -76,7 +77,6 @@ "@testing-library/react-hooks": "2.0.3", "@types/jest": "24.0.18", "@types/react": "16.9.2", - "@types/react-wait": "0.3.0", "babel-core": "6.26.3", "babel-loader": "8.0.6", "babel-plugin-dynamic-import-node": "2.3.0", From 823f94f32190fe6728a829cfd895744f02878e66 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 10 Oct 2019 11:41:29 +0000 Subject: [PATCH 046/162] chore(release): 12.3.1 [skip ci] ## [12.3.1](https://github.com/streamich/react-use/compare/v12.3.0...v12.3.1) (2019-10-10) ### Bug Fixes * move [@types](https://github.com/types)/react-wait to dependencies, closes [#661](https://github.com/streamich/react-use/issues/661) ([#662](https://github.com/streamich/react-use/issues/662)) ([6bdd74e](https://github.com/streamich/react-use/commit/6bdd74e)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e84f524bb..17f4c954b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [12.3.1](https://github.com/streamich/react-use/compare/v12.3.0...v12.3.1) (2019-10-10) + + +### Bug Fixes + +* move [@types](https://github.com/types)/react-wait to dependencies, closes [#661](https://github.com/streamich/react-use/issues/661) ([#662](https://github.com/streamich/react-use/issues/662)) ([6bdd74e](https://github.com/streamich/react-use/commit/6bdd74e)) + # [12.3.0](https://github.com/streamich/react-use/compare/v12.2.3...v12.3.0) (2019-10-07) diff --git a/package.json b/package.json index 3049f9854e..89a4e6bea6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.3.0", + "version": "12.3.1", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From 655c49df85cad77c1b0a0149c76c360910fbff35 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 10 Oct 2019 14:29:59 +0000 Subject: [PATCH 047/162] chore(deps): update dependency @babel/core to v7.6.4 --- package.json | 2 +- yarn.lock | 31 +++++++++++++++++++++++-------- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 89a4e6bea6..5479716430 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "react-dom": "^16.8.0" }, "devDependencies": { - "@babel/core": "7.6.3", + "@babel/core": "7.6.4", "@babel/plugin-syntax-dynamic-import": "7.2.0", "@babel/preset-env": "7.6.3", "@babel/preset-react": "7.6.3", diff --git a/yarn.lock b/yarn.lock index 5751c12d80..60fc2e3b3f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -36,15 +36,15 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@7.6.3": - version "7.6.3" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.3.tgz#44de824e89eaa089bb12da7337bc9bdff2ab68f9" - integrity sha512-QfQ5jTBgXLzJuo7Mo8bZK/ePywmgNRgk/UQykiKwEtZPiFIn8ZqE6jB+AnD1hbB1S2xQyL4//it5vuAUOVAMTw== +"@babel/core@7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.4.tgz#6ebd9fe00925f6c3e177bb726a188b5f578088ff" + integrity sha512-Rm0HGw101GY8FTzpWSyRbki/jzq+/PkNQJ+nSulrdY6gFGOsNseCqD6KHRYe2E+EdzuBdr2pxCp6s4Uk6eJ+XQ== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.6.3" + "@babel/generator" "^7.6.4" "@babel/helpers" "^7.6.2" - "@babel/parser" "^7.6.3" + "@babel/parser" "^7.6.4" "@babel/template" "^7.6.0" "@babel/traverse" "^7.6.3" "@babel/types" "^7.6.3" @@ -54,7 +54,7 @@ lodash "^4.17.13" resolve "^1.3.2" semver "^5.4.1" - source-map "^0.6.1" + source-map "^0.5.0" "@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.4.5": version "7.5.5" @@ -107,6 +107,16 @@ lodash "^4.17.13" source-map "^0.6.1" +"@babel/generator@^7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.4.tgz#a4f8437287bf9671b07f483b76e3bb731bc97671" + integrity sha512-jsBuXkFoZxk0yWLyGI9llT9oiQ2FeTASmRFE32U+aaDTfoE92t78eroO7PTpU/OrYq38hlcDM6vbfLDaOLy+7w== + dependencies: + "@babel/types" "^7.6.3" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + "@babel/helper-annotate-as-pure@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.0.0.tgz#323d39dd0b50e10c7c06ca7d7638e6864d8c5c32" @@ -341,6 +351,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.3.tgz#9eff8b9c3eeae16a74d8d4ff30da2bd0d6f0487e" integrity sha512-sUZdXlva1dt2Vw2RqbMkmfoImubO0D0gaCrNngV6Hi0DA4x3o4mlrq0tbfY0dZEUIccH8I6wQ4qgEtwcpOR6Qg== +"@babel/parser@^7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.4.tgz#cb9b36a7482110282d5cb6dd424ec9262b473d81" + integrity sha512-D8RHPW5qd0Vbyo3qb+YjO5nvUVRTXFLQ/FsDxJU2Nqz4uB5EnUN0ZQSEYpvTIbRuttig1XbHWU5oMeQwQSAA+A== + "@babel/plugin-proposal-async-generator-functions@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" @@ -2277,7 +2292,7 @@ dependencies: "@types/react" "*" -"@types/react-wait@0.3.0": +"@types/react-wait@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@types/react-wait/-/react-wait-0.3.0.tgz#6f7ef17571a17e72c7864ede8cf7d3aa525a005e" integrity sha512-5jIfDcHRjqeE7QfZG7kCqOpfrPSvOM1E3/nlKuJ/NZrG/WrhLo/AFr0i72jhTWzyNRo4ex0pshBaiCHksZXH3A== From b998f3d3974b7ea0d114f7bdd1c26a75a40ac09e Mon Sep 17 00:00:00 2001 From: xobotyi Date: Fri, 11 Oct 2019 03:59:06 +0300 Subject: [PATCH 048/162] useValidatableState -> useStateValidator; It is more suitable due to more flexible usage; --- ...lidatableState.md => useStateValidator.md} | 27 ++-- ...yState.story.tsx => useStateValidator.tsx} | 14 +- src/__tests__/useStateValidator.test.ts | 100 ++++++++++++++ src/__tests__/useValidatableState.test.ts | 126 ------------------ src/index.ts | 2 +- src/useStateValidator.ts | 36 +++++ src/useValidatableState.ts | 46 ------- 7 files changed, 157 insertions(+), 194 deletions(-) rename docs/{useValidatableState.md => useStateValidator.md} (50%) rename src/__stories__/{useValidityState.story.tsx => useStateValidator.tsx} (52%) create mode 100644 src/__tests__/useStateValidator.test.ts delete mode 100644 src/__tests__/useValidatableState.test.ts create mode 100644 src/useStateValidator.ts delete mode 100644 src/useValidatableState.ts diff --git a/docs/useValidatableState.md b/docs/useStateValidator.md similarity index 50% rename from docs/useValidatableState.md rename to docs/useStateValidator.md index 1c84449eea..0b434fcaf9 100644 --- a/docs/useValidatableState.md +++ b/docs/useStateValidator.md @@ -1,17 +1,17 @@ -# `useValidatableState` +# `useStateValidator` -Very similar to React's `useState` hook, but extended with validation functionality. -Each time state changes validator invoked and it's result stored to separate state. +Each time given state changes - validator function is invoked. ## Usage ```ts import * as React from 'react'; import { useCallback } from 'react'; -import { useValidatableState } from 'react-use'; +import { useStateValidator } from 'react-use'; +const DemoStateValidator = s => [s === '' ? null : (s * 1) % 2 === 0]; const Demo = () => { - const validator = useCallback(s => [s === '' ? null : (s * 1) % 2 === 0], []); - const [state, setState, [isValid]] = useValidatableState(validator, ''); + const [state, setState] = React.useState(0); + const [[isValid]] = useStateValidator(state, DemoStateValidator); return (
@@ -21,7 +21,7 @@ const Demo = () => { min="0" max="10" value={state} - onChange={ev => { + onChange={(ev: React.ChangeEvent) => { setState(ev.target.value); }} /> @@ -33,16 +33,15 @@ const Demo = () => { ## Reference ```ts -const [state, setState, validity, revalidate] = useValidatableState( - validator: (state, prev, setValidity?)=>[boolean|null, ...any[]], - initialState: any +const [validity, revalidate] = useStateValidator( + state: any, + validator: (state, setValidity?)=>[boolean|null, ...any[]], + initialValidity: any ); ``` -- `state` and `setState` are the same with React's `useState` hook; - **`validity`**_`: [boolean|null, ...any[]]`_ result of validity check. First element is strictly nullable boolean, but others can contain arbitrary data; - **`revalidate`**_`: ()=>void`_ runs validator once again -- **`validator`** should return an array suitable for validity state described above; +- **`validator`**_`: (state, setValidity?)=>[boolean|null, ...any[]]`_ should return an array suitable for validity state described above; - `state` - current state; - - `prev` - previous state; - `setValidity` - if defined hook will not trigger validity change automatically. Useful for async validators; -- `initialState` same with `useState` hook; +- `initialValidity` - validity value which set when validity is nt calculated yet; diff --git a/src/__stories__/useValidityState.story.tsx b/src/__stories__/useStateValidator.tsx similarity index 52% rename from src/__stories__/useValidityState.story.tsx rename to src/__stories__/useStateValidator.tsx index 66e9651e17..906de0cbf6 100644 --- a/src/__stories__/useValidityState.story.tsx +++ b/src/__stories__/useStateValidator.tsx @@ -1,12 +1,12 @@ import { storiesOf } from '@storybook/react'; import * as React from 'react'; -import { useCallback } from 'react'; -import { useValidatableState } from '../index'; +import useStateValidator from '../useStateValidator'; import ShowDocs from './util/ShowDocs'; +const DemoStateValidator = s => [s === '' ? null : (s * 1) % 2 === 0]; const Demo = () => { - const validator = useCallback(s => [s === '' ? null : (s * 1) % 2 === 0], []); - const [state, setState, [isValid]] = useValidatableState(validator, ''); + const [state, setState] = React.useState(0); + const [[isValid]] = useStateValidator(state, DemoStateValidator); return (
@@ -16,7 +16,7 @@ const Demo = () => { min="0" max="10" value={state} - onChange={ev => { + onChange={(ev: React.ChangeEvent) => { setState(ev.target.value); }} /> @@ -25,6 +25,6 @@ const Demo = () => { ); }; -storiesOf('State|useValidatableState', module) - .add('Docs', () => ) +storiesOf('State|useStateValidator', module) + .add('Docs', () => ) .add('Demo', () => ); diff --git a/src/__tests__/useStateValidator.test.ts b/src/__tests__/useStateValidator.test.ts new file mode 100644 index 0000000000..7b71754137 --- /dev/null +++ b/src/__tests__/useStateValidator.test.ts @@ -0,0 +1,100 @@ +import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { useState } from 'react'; +import useStateValidator, { UseValidatorReturn, Validator } from '../useStateValidator'; + +interface Mock extends jest.Mock {} + +describe('useStateValidator', () => { + it('should be defined', () => { + expect(useStateValidator).toBeDefined(); + }); + + function getHook( + fn: Validator = jest.fn(state => [!!(state % 2)]) + ): [jest.Mock | Function, RenderHookResult]>] { + return [ + fn, + renderHook(() => { + const [state, setState] = useState(1); + + return [setState, useStateValidator(state, fn)]; + }), + ]; + } + + it('should return an array of two elements', () => { + const [, hook] = getHook(); + const res = hook.result.current[1]; + + expect(Array.isArray(res)).toBe(true); + expect(res[0]).toEqual([true]); + expect(typeof res[1]).toBe('function'); + }); + + it('first element should represent current validity state', () => { + const [, hook] = getHook(); + let [setState, [validity]] = hook.result.current; + expect(validity).toEqual([true]); + + act(() => setState(3)); + [setState, [validity]] = hook.result.current; + expect(validity).toEqual([true]); + + act(() => setState(4)); + [setState, [validity]] = hook.result.current; + expect(validity).toEqual([false]); + }); + + it('second element should re-call validation', () => { + const [spy, hook] = getHook(); + const [, [, revalidate]] = hook.result.current; + + expect(spy).toHaveBeenCalledTimes(1); + act(() => revalidate()); + expect(spy).toHaveBeenCalledTimes(2); + }); + + it('validator have to be called on init plus on each state update', () => { + const [spy, hook] = getHook(jest.fn()); + const [setState] = hook.result.current; + + expect(spy).toHaveBeenCalledTimes(1); + act(() => setState(4)); + expect(spy).toHaveBeenCalledTimes(2); + act(() => setState(prevState => prevState + 1)); + expect(spy).toHaveBeenCalledTimes(3); + }); + + it('should pass to validator one parameter - current state', () => { + const [spy, hook] = getHook(jest.fn()); + const [setState] = hook.result.current; + + act(() => setState(4)); + act(() => setState(5)); + expect((spy as Mock).mock.calls[0].length).toBe(1); + expect((spy as Mock).mock.calls[0].length).toBe(1); + expect((spy as Mock).mock.calls[0][0]).toBe(1); + expect((spy as Mock).mock.calls[1].length).toBe(1); + expect((spy as Mock).mock.calls[1][0]).toBe(4); + expect((spy as Mock).mock.calls[2].length).toBe(1); + expect((spy as Mock).mock.calls[2][0]).toBe(5); + }); + + it('if validator expects 2nd parameters it should pass a validity setter there', () => { + const [spy, hook] = getHook(jest.fn((state, setValidity) => setValidity!([state % 2 === 0]))); + let [setState, [[isValid]]] = hook.result.current; + + expect((spy as Mock).mock.calls[0].length).toBe(2); + expect(typeof (spy as Mock).mock.calls[0][1]).toBe('function'); + + expect(isValid).toBe(false); + act(() => setState(prevState => prevState + 1)); + + [setState, [[isValid]]] = hook.result.current; + expect(isValid).toBe(true); + act(() => setState(5)); + + [setState, [[isValid]]] = hook.result.current; + expect(isValid).toBe(false); + }); +}); diff --git a/src/__tests__/useValidatableState.test.ts b/src/__tests__/useValidatableState.test.ts deleted file mode 100644 index 0e0bc515c3..0000000000 --- a/src/__tests__/useValidatableState.test.ts +++ /dev/null @@ -1,126 +0,0 @@ -import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; -import { useValidatableState } from '../index'; -import { UseValidatableStateReturn, Validator } from '../useValidatableState'; - -interface Mock extends jest.Mock {} - -describe('useValidatableState', () => { - it('should be defined', () => { - expect(useValidatableState).toBeDefined(); - }); - - function getHook( - fn: Validator = jest.fn(() => {}), - initialState: any = null - ): [Mock | Function, RenderHookResult<{ validator: Validator; init: any }, UseValidatableStateReturn>] { - return [ - fn, - renderHook(({ validator, init }) => useValidatableState(validator as Function, init), { - initialProps: { - validator: fn, - init: initialState, - }, - }), - ]; - } - - it('should return an array of four elements', () => { - const [, hook] = getHook(); - - expect(Array.isArray(hook.result.current)).toBe(true); - expect(hook.result.current.length).toBe(4); - }); - - it('first two elements should act like regular setState', () => { - const [, hook] = getHook(jest.fn(), 3); - const [, setState] = hook.result.current; - - expect(hook.result.current[0]).toBe(3); - act(() => setState(4)); - expect(hook.result.current[0]).toBe(4); - act(() => setState(prevState => prevState + 1)); - expect(hook.result.current[0]).toBe(5); - }); - - it('validator have to be called on init plus on each state update', () => { - const [spy, hook] = getHook(jest.fn(), 3); - const [, setState] = hook.result.current; - - expect(spy).toHaveBeenCalledTimes(1); - act(() => setState(4)); - expect(spy).toHaveBeenCalledTimes(2); - act(() => setState(prevState => prevState + 1)); - expect(spy).toHaveBeenCalledTimes(3); - }); - - it('third element of returned array should represent validity state', () => { - const [, hook] = getHook(jest.fn(state => [state % 2 === 0]), 3); - let [, setState, [isValid]] = hook.result.current; - - expect(isValid).toBe(false); - act(() => setState(prevState => prevState + 1)); - - [, setState, [isValid]] = hook.result.current; - expect(isValid).toBe(true); - act(() => setState(5)); - - [, setState, [isValid]] = hook.result.current; - expect(isValid).toBe(false); - }); - - it('should recalculate validity on validator change', () => { - const [, hook] = getHook(jest.fn(state => [state % 2 === 0]), 3); - let [, setState, [isValid]] = hook.result.current; - - expect(isValid).toBe(false); - - hook.rerender({ validator: jest.fn(state => [state % 2 === 1]), init: 3 }); - - [, setState, [isValid]] = hook.result.current; - expect(isValid).toBe(true); - act(() => setState(prevState => prevState + 1)); - - [, setState, [isValid]] = hook.result.current; - expect(isValid).toBe(false); - }); - - it('forth element of returned array should re-call validation', () => { - const [spy, hook] = getHook(jest.fn(), 3); - const [, , , validate] = hook.result.current; - - expect(spy).toHaveBeenCalledTimes(1); - act(() => validate()); - expect(spy).toHaveBeenCalledTimes(2); - }); - - it('should pass to validator two parameters: first - current state, second - previous state', () => { - const [spy, hook] = getHook(jest.fn(), 3); - const [, setState] = hook.result.current; - - act(() => setState(4)); - act(() => setState(prevState => prevState + 1)); - expect((spy as Mock).mock.calls[0][0]).toBe(3); - expect((spy as Mock).mock.calls[0][1]).toBe(null); - expect((spy as Mock).mock.calls[1][0]).toBe(4); - expect((spy as Mock).mock.calls[1][1]).toBe(3); - expect((spy as Mock).mock.calls[2][0]).toBe(5); - expect((spy as Mock).mock.calls[2][1]).toBe(4); - }); - - it('if validator expects 3 parameters it should pass a validity setter there', () => { - const [spy, hook] = getHook(jest.fn((state, _prevState, setValidity) => setValidity!([state % 2 === 0])), 3); - let [, setState, [isValid]] = hook.result.current; - - expect(typeof (spy as Mock).mock.calls[0][2]).toBe('function'); - - expect(isValid).toBe(false); - act(() => setState(prevState => prevState + 1)); - - [, setState, [isValid]] = hook.result.current; - expect(isValid).toBe(true); - act(() => setState(5)); - - [, setState, [isValid]] = hook.result.current; - expect(isValid).toBe(false); - }); -}); diff --git a/src/index.ts b/src/index.ts index 412e1bd707..a3a933feb9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -86,7 +86,7 @@ export { default as useUpdate } from './useUpdate'; export { default as useUpdateEffect } from './useUpdateEffect'; export { default as useUpsert } from './useUpsert'; export { default as useVideo } from './useVideo'; -export { default as useValidatableState } from './useValidatableState'; +export { default as useStateValidator } from './useStateValidator'; export { useWait, Waiter } from './useWait'; export { default as useWindowScroll } from './useWindowScroll'; export { default as useWindowSize } from './useWindowSize'; diff --git a/src/useStateValidator.ts b/src/useStateValidator.ts new file mode 100644 index 0000000000..cf9070f0a3 --- /dev/null +++ b/src/useStateValidator.ts @@ -0,0 +1,36 @@ +import { Dispatch, SetStateAction, useCallback, useEffect, useRef, useState } from 'react'; + +export type ValidityState = [boolean | undefined, ...any[]]; +export type DispatchValidity = Dispatch>; + +export type Validator = + | { + (state?: S): V; + (state?: S, dispatch?: DispatchValidity): void; + } + | Function; + +export type UseValidatorReturn = [V, () => void]; + +export default function useStateValidator( + state: S, + validator: Validator, + initialValidity: V = [undefined] as V +): UseValidatorReturn { + const validatorFn = useRef(validator); + + const [validity, setValidity] = useState(initialValidity); + const validate = useCallback(() => { + if (validatorFn.current.length === 2) { + validatorFn.current(state, setValidity); + } else { + setValidity(validatorFn.current(state)); + } + }, [state]); + + useEffect(() => { + validate(); + }, [state]); + + return [validity, validate]; +} diff --git a/src/useValidatableState.ts b/src/useValidatableState.ts deleted file mode 100644 index 2d0b9b4647..0000000000 --- a/src/useValidatableState.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { Dispatch, SetStateAction, useCallback, useEffect, useRef, useState } from 'react'; - -export type ValidityState = [boolean | null, ...any[]]; -export type DispatchValidityState = Dispatch>; - -export type Validator = - | { - (state?: State, prev?: State): StateValidity; - (state?: State, prev?: State, setValidity?: DispatchValidityState): void; - } - | Function; - -export type ValidateFn = () => void; - -export type UseValidatableStateReturn = [ - State, - Dispatch>, - StateValidity, - ValidateFn -]; - -export default function useValidatableState( - validator: Validator, - initialState?: State -): UseValidatableStateReturn { - const prevState = useRef(null); - const [state, setState] = useState(initialState!); - const [validity, setValidity] = useState([null] as StateValidity); - - const validate = useCallback(() => { - if (validator.length === 3) { - validator(state, prevState.current, setValidity as DispatchValidityState); - } else { - setValidity(validator(state, prevState.current)); - } - }, [state, validator]); - - useEffect(() => { - validate(); - }, [validate, state]); - useEffect(() => { - prevState.current = state; - }, [state]); - - return [state, setState, validity, validate]; -} From 1920f8b135cd64ce2fb9a534cdb4d85e779a060b Mon Sep 17 00:00:00 2001 From: xobotyi Date: Fri, 11 Oct 2019 04:26:45 +0300 Subject: [PATCH 049/162] Readme update --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c08670cc64..4c554d308d 100644 --- a/README.md +++ b/README.md @@ -131,9 +131,9 @@ - [`useStateList`](./docs/useStateList.md) — circularly iterates over an array. - [`useToggle` and `useBoolean`](./docs/useToggle.md) — tracks state of a boolean. - [`useCounter` and `useNumber`](./docs/useCounter.md) — tracks state of a number. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usecounter--demo) - - [`useList`](./docs/useList.md) — tracks state of an array. - - [`useMap`](./docs/useMap.md) — tracks state of an object. - - [`useValidatableState`](./docs/useValidatableState.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usevalidatablestate--demo) + - [`useList`](./docs/useList.md) and [`useUpsert`](./docs/useUpsert.md) — tracks state of an array. [![][img-demo]](https://codesandbox.io/s/wonderful-mahavira-1sm0w) + - [`useMap`](./docs/useMap.md) — tracks state of an object. [![][img-demo]](https://codesandbox.io/s/quirky-dewdney-gi161) + - [`useStateValidator`](./docs/useStateValidator.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usestatevalidator--demo)
From ed8e26d7c2ba2d044410e46a2421c86a7e51e928 Mon Sep 17 00:00:00 2001 From: Ward Date: Sat, 12 Oct 2019 18:27:31 +1100 Subject: [PATCH 050/162] fix: improve use of refs in dependency lists (#655) --- src/useFullscreen.ts | 2 +- src/useMouse.ts | 2 +- src/useScroll.ts | 2 +- src/useScrolling.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/useFullscreen.ts b/src/useFullscreen.ts index afb754fdd9..c55b0d3d1d 100644 --- a/src/useFullscreen.ts +++ b/src/useFullscreen.ts @@ -65,7 +65,7 @@ const useFullscreen = (ref: RefObject, on: boolean, options: FullScreen video.current.webkitExitFullscreen(); } }; - }, [ref.current, video, on]); + }, [on, video, ref]); return isFullscreen; }; diff --git a/src/useMouse.ts b/src/useMouse.ts index 7e692a8dfb..665a126ba0 100644 --- a/src/useMouse.ts +++ b/src/useMouse.ts @@ -62,7 +62,7 @@ const useMouse = (ref: RefObject): State => { cancelAnimationFrame(frame.current); document.removeEventListener('mousemove', moveHandler); }; - }, [ref.current]); + }, [ref]); return state; }; diff --git a/src/useScroll.ts b/src/useScroll.ts index a98a7c3f5a..caf78f4990 100644 --- a/src/useScroll.ts +++ b/src/useScroll.ts @@ -48,7 +48,7 @@ const useScroll = (ref: RefObject): State => { ref.current.removeEventListener('scroll', handler); } }; - }, [ref.current]); + }, [ref]); return state; }; diff --git a/src/useScrolling.ts b/src/useScrolling.ts index 01dd117497..c95ae6c2ac 100644 --- a/src/useScrolling.ts +++ b/src/useScrolling.ts @@ -25,7 +25,7 @@ const useScrolling = (ref: RefObject): boolean => { }; } return () => {}; - }, [ref.current]); + }, [ref]); return scrolling; }; From c0b3c3021e0d60a7c3304f19096568793d14ed43 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 12 Oct 2019 07:29:20 +0000 Subject: [PATCH 051/162] chore(release): 12.3.2 [skip ci] ## [12.3.2](https://github.com/streamich/react-use/compare/v12.3.1...v12.3.2) (2019-10-12) ### Bug Fixes * improve use of refs in dependency lists ([#655](https://github.com/streamich/react-use/issues/655)) ([ed8e26d](https://github.com/streamich/react-use/commit/ed8e26d)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 17f4c954b8..4a3473914a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [12.3.2](https://github.com/streamich/react-use/compare/v12.3.1...v12.3.2) (2019-10-12) + + +### Bug Fixes + +* improve use of refs in dependency lists ([#655](https://github.com/streamich/react-use/issues/655)) ([ed8e26d](https://github.com/streamich/react-use/commit/ed8e26d)) + ## [12.3.1](https://github.com/streamich/react-use/compare/v12.3.0...v12.3.1) (2019-10-10) diff --git a/package.json b/package.json index 5479716430..043fdb10f4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.3.1", + "version": "12.3.2", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From 8fcf8d4dd713eefbe4c5240384cc6f765120b407 Mon Sep 17 00:00:00 2001 From: Ward Oosterlijnck Date: Sat, 12 Oct 2019 18:41:54 +1100 Subject: [PATCH 052/162] docs: fix useStateValidator story --- .../{useStateValidator.tsx => useStateValidator.story.tsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/__stories__/{useStateValidator.tsx => useStateValidator.story.tsx} (100%) diff --git a/src/__stories__/useStateValidator.tsx b/src/__stories__/useStateValidator.story.tsx similarity index 100% rename from src/__stories__/useStateValidator.tsx rename to src/__stories__/useStateValidator.story.tsx From 87d461319a55fa5e9c629fa1a9d77a9a90ec13ea Mon Sep 17 00:00:00 2001 From: Kevin Norris Date: Sat, 12 Oct 2019 21:12:51 +1300 Subject: [PATCH 053/162] tests: useLogger (#670) --- src/__tests__/useLogger.test.ts | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/__tests__/useLogger.test.ts diff --git a/src/__tests__/useLogger.test.ts b/src/__tests__/useLogger.test.ts new file mode 100644 index 0000000000..85989b9f4c --- /dev/null +++ b/src/__tests__/useLogger.test.ts @@ -0,0 +1,41 @@ +import { renderHook } from '@testing-library/react-hooks'; +import useLogger from '../useLogger'; + +const logSpy = jest.spyOn(global.console, 'log').mockImplementation(() => {}); + +describe('useLogger', () => { + it('should be defined', () => { + expect(useLogger).toBeDefined(); + }); + + it('should log the provided props on mount', () => { + const props = { question: 'What is the meaning?', answer: 42 }; + renderHook(() => useLogger('Test', props)); + + expect(logSpy).toBeCalledTimes(1); + expect(logSpy).toHaveBeenLastCalledWith('Test mounted', props); + }); + + it('should log when the component has unmounted', () => { + const props = { question: 'What is the meaning?', answer: 42 }; + const { unmount } = renderHook(() => useLogger('Test', props)); + + unmount(); + + expect(logSpy).toHaveBeenLastCalledWith('Test unmounted'); + }); + + it('should log updates as props change', () => { + const { rerender } = renderHook( + ({ componentName, props }: { componentName: string; props: any }) => useLogger(componentName, props), + { + initialProps: { componentName: 'Test', props: { one: 1 } }, + } + ); + + const newProps = { one: 1, two: 2 }; + rerender({ componentName: 'Test', props: newProps }); + + expect(logSpy).toHaveBeenLastCalledWith('Test updated', newProps); + }); +}); From d5f359f7e3f7b913d5437518fb94b98c963d2193 Mon Sep 17 00:00:00 2001 From: Kevin Norris Date: Sat, 12 Oct 2019 21:22:23 +1300 Subject: [PATCH 054/162] feat: useIntersection (#652) React sensor hook that tracks the changes in the intersection of a target element with an ancestor element or with a top-level document's viewport, using the Intersection Observer API --- README.md | 5 +- docs/useIntersection.md | 36 +++++++ package.json | 1 + src/__stories__/useIntersection.story.tsx | 53 ++++++++++ src/__tests__/useIntersection.test.tsx | 119 ++++++++++++++++++++++ src/index.ts | 1 + src/useIntersection.ts | 30 ++++++ yarn.lock | 93 ++++++++++++++++- 8 files changed, 334 insertions(+), 4 deletions(-) create mode 100644 docs/useIntersection.md create mode 100644 src/__stories__/useIntersection.story.tsx create mode 100644 src/__tests__/useIntersection.test.tsx create mode 100644 src/useIntersection.ts diff --git a/README.md b/README.md index fcc219a62f..e1af98a4c0 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ - [`useGeolocation`](./docs/useGeolocation.md) — tracks geo location state of user's device. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usegeolocation--demo) - [`useHover` and `useHoverDirty`](./docs/useHover.md) — tracks mouse hover state of some element. [![][img-demo]](https://codesandbox.io/s/zpn583rvx) - [`useIdle`](./docs/useIdle.md) — tracks whether user is being inactive. + - [`useIntersection`](./docs/useIntersection.md) — tracks an HTML element's intersection. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-useintersection--demo) - [`useKey`](./docs/useKey.md), [`useKeyPress`](./docs/useKeyPress.md), [`useKeyboardJs`](./docs/useKeyboardJs.md), and [`useKeyPressEvent`](./docs/useKeyPressEvent.md) — track keys. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usekeypressevent--demo) - [`useLocation`](./docs/useLocation.md) and [`useSearchParam`](./docs/useSearchParam.md) — tracks page navigation bar location state. - [`useMedia`](./docs/useMedia.md) — tracks state of a CSS media query. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usemedia--demo) @@ -104,7 +105,7 @@ - [`useTitle`](./docs/useTitle.md) — sets title of the page. - [`usePermission`](./docs/usePermission.md) — query permission status for browser APIs.
-
+
- [**Lifecycles**](./docs/Lifecycles.md) - [`useEffectOnce`](./docs/useEffectOnce.md) — a modified [`useEffect`](https://reactjs.org/docs/hooks-reference.html#useeffect) hook that only runs once. - [`useEvent`](./docs/useEvent.md) — subscribe to events. @@ -135,7 +136,6 @@ - [`useMap`](./docs/useMap.md) — tracks state of an object. [![][img-demo]](https://codesandbox.io/s/quirky-dewdney-gi161) - [`useStateValidator`](./docs/useStateValidator.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usestatevalidator--demo) -


@@ -160,7 +160,6 @@ [img-demo]: https://img.shields.io/badge/demo-%20%20%20%F0%9F%9A%80-green.svg -

Contributors

diff --git a/docs/useIntersection.md b/docs/useIntersection.md new file mode 100644 index 0000000000..802ee1da6a --- /dev/null +++ b/docs/useIntersection.md @@ -0,0 +1,36 @@ +# `useIntersection` + +React sensor hook that tracks the changes in the intersection of a target element with an ancestor element or with a top-level document's viewport. Uses the [Intersection Observer API](https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API) and returns a [IntersectionObserverEntry](https://developer.mozilla.org/en-US/docs/Web/API/IntersectionObserverEntry). + +## Usage + +```jsx +import * as React from 'react'; +import { useIntersection } from 'react-use'; + +const Demo = () => { + const intersectionRef = React.useRef(null); + const intersection = useIntersection(intersectionRef, { + root: null, + rootMargin: '0px', + threshold: 1 + }); + + return ( +
+ {intersection && intersection.intersectionRatio < 1 + ? 'Obscured' + : 'Fully in view'} +
+ ); +}; +``` + +## Reference + +```ts +useIntersection( + ref: RefObject, + options: IntersectionObserverInit, +): IntersectionObserverEntry | null; +``` diff --git a/package.json b/package.json index 043fdb10f4..e898b3788f 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,7 @@ "@semantic-release/changelog": "3.0.4", "@semantic-release/git": "7.0.16", "@semantic-release/npm": "5.1.13", + "@shopify/jest-dom-mocks": "^2.8.2", "@storybook/addon-actions": "5.1.11", "@storybook/addon-knobs": "5.1.11", "@storybook/addon-notes": "5.1.11", diff --git a/src/__stories__/useIntersection.story.tsx b/src/__stories__/useIntersection.story.tsx new file mode 100644 index 0000000000..fb8c1226dc --- /dev/null +++ b/src/__stories__/useIntersection.story.tsx @@ -0,0 +1,53 @@ +import { storiesOf } from '@storybook/react'; +import * as React from 'react'; +import { useIntersection } from '..'; +import ShowDocs from './util/ShowDocs'; + +const Spacer = () => ( +
+); + +const Demo = () => { + const intersectionRef = React.useRef(null); + const intersection = useIntersection(intersectionRef, { + root: null, + rootMargin: '0px', + threshold: 1, + }); + + return ( +
+ Scroll me + +
+ {intersection && intersection.intersectionRatio < 1 ? 'Obscured' : 'Fully in view'} +
+ +
+ ); +}; + +storiesOf('Sensors/useIntersection', module) + .add('Docs', () => ) + .add('Demo', () => ); diff --git a/src/__tests__/useIntersection.test.tsx b/src/__tests__/useIntersection.test.tsx new file mode 100644 index 0000000000..ee7342b2a7 --- /dev/null +++ b/src/__tests__/useIntersection.test.tsx @@ -0,0 +1,119 @@ +import React, { createRef } from 'react'; +import ReactDOM from 'react-dom'; +import TestUtils from 'react-dom/test-utils'; +import TestRenderer from 'react-test-renderer'; +import { intersectionObserver } from '@shopify/jest-dom-mocks'; +import { renderHook } from '@testing-library/react-hooks'; +import { useIntersection } from '..'; + +beforeEach(() => { + intersectionObserver.mock(); +}); + +afterEach(() => { + intersectionObserver.restore(); +}); + +describe('useIntersection', () => { + const container = document.createElement('div'); + let targetRef; + + it('should be defined', () => { + expect(useIntersection).toBeDefined(); + }); + + it('should setup an IntersectionObserver targeting the ref element and using the options provided', () => { + TestUtils.act(() => { + targetRef = createRef(); + ReactDOM.render(
, container); + }); + + expect(intersectionObserver.observers).toHaveLength(0); + const observerOptions = { root: null, threshold: 0.8 }; + + renderHook(() => useIntersection(targetRef, observerOptions)); + + expect(intersectionObserver.observers).toHaveLength(1); + expect(intersectionObserver.observers[0].target).toEqual(targetRef.current); + expect(intersectionObserver.observers[0].options).toEqual(observerOptions); + }); + + it('should return null if a ref without a current value is provided', () => { + targetRef = createRef(); + + const { result } = renderHook(() => useIntersection(targetRef, { root: null, threshold: 1 })); + expect(result.current).toBe(null); + }); + + it('should return the first IntersectionObserverEntry when the IntersectionObserver registers an intersection', () => { + TestUtils.act(() => { + targetRef = createRef(); + ReactDOM.render(
, container); + }); + + const { result } = renderHook(() => useIntersection(targetRef, { root: container, threshold: 0.8 })); + + const mockIntersectionObserverEntry = { + boundingClientRect: targetRef.current.getBoundingClientRect(), + intersectionRatio: 0.81, + intersectionRect: container.getBoundingClientRect(), + isIntersecting: true, + rootBounds: container.getBoundingClientRect(), + target: targetRef.current, + time: 300, + }; + TestRenderer.act(() => { + intersectionObserver.simulate(mockIntersectionObserverEntry); + }); + + expect(result.current).toEqual(mockIntersectionObserverEntry); + }); + + it('should setup a new IntersectionObserver when the ref changes', () => { + let newRef; + TestUtils.act(() => { + targetRef = createRef(); + newRef = createRef(); + ReactDOM.render( +
+ +
, + container + ); + }); + + const observerOptions = { root: null, threshold: 0.8 }; + const { rerender } = renderHook(({ ref, options }) => useIntersection(ref, options), { + initialProps: { ref: targetRef, options: observerOptions }, + }); + + expect(intersectionObserver.observers[0].target).toEqual(targetRef.current); + + TestRenderer.act(() => { + rerender({ ref: newRef, options: observerOptions }); + }); + + expect(intersectionObserver.observers[0].target).toEqual(newRef.current); + }); + + it('should setup a new IntersectionObserver when the options change', () => { + TestUtils.act(() => { + targetRef = createRef(); + ReactDOM.render(
, container); + }); + + const initialObserverOptions = { root: null, threshold: 0.8 }; + const { rerender } = renderHook(({ ref, options }) => useIntersection(ref, options), { + initialProps: { ref: targetRef, options: initialObserverOptions }, + }); + + expect(intersectionObserver.observers[0].options).toEqual(initialObserverOptions); + + const newObserverOptions = { root: container, threshold: 1 }; + TestRenderer.act(() => { + rerender({ ref: targetRef, options: newObserverOptions }); + }); + + expect(intersectionObserver.observers[0].options).toEqual(newObserverOptions); + }); +}); diff --git a/src/index.ts b/src/index.ts index a3a933feb9..65872134d6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -27,6 +27,7 @@ export { default as useHarmonicIntervalFn } from './useHarmonicIntervalFn'; export { default as useHover } from './useHover'; export { default as useHoverDirty } from './useHoverDirty'; export { default as useIdle } from './useIdle'; +export { default as useIntersection } from './useIntersection'; export { default as useInterval } from './useInterval'; export { default as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'; export { default as useKey } from './useKey'; diff --git a/src/useIntersection.ts b/src/useIntersection.ts new file mode 100644 index 0000000000..4a7b78eaca --- /dev/null +++ b/src/useIntersection.ts @@ -0,0 +1,30 @@ +import { RefObject, useEffect, useState } from 'react'; + +const useIntersection = ( + ref: RefObject, + options: IntersectionObserverInit +): IntersectionObserverEntry | null => { + const [intersectionObserverEntry, setIntersectionObserverEntry] = useState(null); + + useEffect(() => { + if (ref.current) { + const handler = (entries: IntersectionObserverEntry[]) => { + setIntersectionObserverEntry(entries[0]); + }; + + const observer = new IntersectionObserver(handler, options); + observer.observe(ref.current); + + return () => { + if (ref.current) { + observer.disconnect(); + } + }; + } + return () => {}; + }, [ref, options.threshold, options.root, options.rootMargin]); + + return intersectionObserverEntry; +}; + +export default useIntersection; diff --git a/yarn.lock b/yarn.lock index 60fc2e3b3f..051f3791fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1712,6 +1712,37 @@ into-stream "^4.0.0" lodash "^4.17.4" +"@shopify/async@^2.0.7": + version "2.0.7" + resolved "https://registry.yarnpkg.com/@shopify/async/-/async-2.0.7.tgz#944992bc1721df6c363b3f0f31be1dad0e75e929" + integrity sha512-wYGjqPhpna4ShYbUmlD2fPv5ZkjNlCZtU7huUU8/snnyPmdgL/Rn5M5FPP6Apr7/hU5RgqMj2tJFs37ORz/VaQ== + +"@shopify/decorators@^1.1.5": + version "1.1.5" + resolved "https://registry.yarnpkg.com/@shopify/decorators/-/decorators-1.1.5.tgz#b8da0bd5fffb04cde9730898fc04428f964cab1c" + integrity sha512-cFAwd7T5IjkPs1ef11dbA6cbJA+CtgCDanbalPlQdl5ItwDzqJXGpvbhbQXw7zPyNMLijrgrpQqltalqAy9wnQ== + dependencies: + "@shopify/function-enhancers" "^1.0.5" + +"@shopify/function-enhancers@^1.0.5": + version "1.0.5" + resolved "https://registry.yarnpkg.com/@shopify/function-enhancers/-/function-enhancers-1.0.5.tgz#7c3e516e26ce7a9b63c263679bdcf5121d994a10" + integrity sha512-34ML8DX4RmmA9hXDlf2BAz4SA37unShZxoBRPz585a+FaEzNcMvw5NzLD+Ih9XrP/wrxTUcN+p6pazvoS+jB7w== + +"@shopify/jest-dom-mocks@^2.8.2": + version "2.8.2" + resolved "https://registry.yarnpkg.com/@shopify/jest-dom-mocks/-/jest-dom-mocks-2.8.2.tgz#477c3159897807cc8d7797c33e8a79e787051779" + integrity sha512-4drt+S1cQ1ZSP1DaEHAj5XPPCiI2R8IIt+ZnH9h08Ngy8PjtjFFNHNcSJ6bKBmk7eO2c6+5UaJQzNcg56nt7gg== + dependencies: + "@shopify/async" "^2.0.7" + "@shopify/decorators" "^1.1.5" + "@types/fetch-mock" "^6.0.1" + "@types/lolex" "^2.1.3" + fetch-mock "^6.3.0" + lolex "^2.7.5" + promise "^8.0.3" + tslib "^1.9.3" + "@storybook/addon-actions@5.1.11": version "5.1.11" resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-5.1.11.tgz#ebc299b9dfe476b5c65eb5d148c4b064f682ca08" @@ -2219,6 +2250,11 @@ resolved "https://registry.yarnpkg.com/@types/events/-/events-3.0.0.tgz#2862f3f58a9a7f7c3e78d79f130dd4d71c25c2a7" integrity sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g== +"@types/fetch-mock@^6.0.1": + version "6.0.5" + resolved "https://registry.yarnpkg.com/@types/fetch-mock/-/fetch-mock-6.0.5.tgz#acbc6771d43d7ebc1f0a8b7e3d57147618f8eacb" + integrity sha512-rV8O2j/TIi0PtFCOlK55JnfKpE8Hm6PKFgrUZY/3FNHw4uBEMHnM+5ZickDO1duOyKxbpY3VES5T4NIwZXvodA== + "@types/glob@^7.1.1": version "7.1.1" resolved "https://registry.yarnpkg.com/@types/glob/-/glob-7.1.1.tgz#aa59a1c6e3fbc421e07ccd31a944c30eba521575" @@ -2260,6 +2296,11 @@ dependencies: "@types/jest-diff" "*" +"@types/lolex@^2.1.3": + version "2.1.3" + resolved "https://registry.yarnpkg.com/@types/lolex/-/lolex-2.1.3.tgz#793557c9b8ad319b4c8e4c6548b90893f4aa5f69" + integrity sha512-nEipOLYyZJ4RKHCg7tlR37ewFy91oggmip2MBzPdVQ8QhTFqjcRhE8R0t4tfpDnSlxGWHoEGJl0UCC4kYhqoiw== + "@types/minimatch@*": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/minimatch/-/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d" @@ -2857,7 +2898,7 @@ arrify@^1.0.1: resolved "https://registry.yarnpkg.com/arrify/-/arrify-1.0.1.tgz#898508da2226f380df904728456849c1501a4b0d" integrity sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0= -asap@^2.0.0, asap@~2.0.3: +asap@^2.0.0, asap@~2.0.3, asap@~2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.6.tgz#e50347611d7e690943208bbdafebcbc2fb866d46" integrity sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY= @@ -3317,6 +3358,15 @@ babel-plugin-transform-undefined-to-void@^6.9.4: resolved "https://registry.yarnpkg.com/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.9.4.tgz#be241ca81404030678b748717322b89d0c8fe280" integrity sha1-viQcqBQEAwZ4t0hxcyK4nQyP4oA= +babel-polyfill@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153" + integrity sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM= + dependencies: + babel-runtime "^6.26.0" + core-js "^2.5.0" + regenerator-runtime "^0.10.5" + babel-preset-jest@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/babel-preset-jest/-/babel-preset-jest-24.9.0.tgz#192b521e2217fb1d1f67cf73f70c336650ad3cdc" @@ -5644,6 +5694,15 @@ fbjs@^0.8.0, fbjs@^0.8.1: setimmediate "^1.0.5" ua-parser-js "^0.7.18" +fetch-mock@^6.3.0: + version "6.5.2" + resolved "https://registry.yarnpkg.com/fetch-mock/-/fetch-mock-6.5.2.tgz#b3842b305c13ea0f81c85919cfaa7de387adfa3e" + integrity sha512-EIvbpCLBTYyDLu4HJiqD7wC8psDwTUaPaWXNKZbhNO/peUYKiNp5PkZGKRJtnTxaPQu71ivqafvjpM7aL+MofQ== + dependencies: + babel-polyfill "^6.26.0" + glob-to-regexp "^0.4.0" + path-to-regexp "^2.2.1" + figgy-pudding@^3.4.1, figgy-pudding@^3.5.1: version "3.5.1" resolved "https://registry.yarnpkg.com/figgy-pudding/-/figgy-pudding-3.5.1.tgz#862470112901c727a0e495a80744bd5baa1d6790" @@ -6145,6 +6204,11 @@ glob-to-regexp@^0.3.0: resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.3.0.tgz#8c5a1494d2066c570cc3bfe4496175acc4d502ab" integrity sha1-jFoUlNIGbFcMw7/kSWF1rMTVAqs= +glob-to-regexp@^0.4.0: + version "0.4.1" + resolved "https://registry.yarnpkg.com/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz#c75297087c851b9a578bd217dd59a92f59fe546e" + integrity sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw== + glob@^7.0.0, glob@^7.0.3, glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4: version "7.1.4" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.4.tgz#aa608a2f6c577ad357e1ae5a5c26d9a8d1969255" @@ -8300,6 +8364,11 @@ log-update@^2.3.0: cli-cursor "^2.0.0" wrap-ansi "^3.0.1" +lolex@^2.7.5: + version "2.7.5" + resolved "https://registry.yarnpkg.com/lolex/-/lolex-2.7.5.tgz#113001d56bfc7e02d56e36291cc5c413d1aa0733" + integrity sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q== + loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf" @@ -9776,6 +9845,11 @@ path-to-regexp@0.1.7: resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" integrity sha1-32BBeABfUi8V60SQ5yR6G/qmf4w= +path-to-regexp@^2.2.1: + version "2.4.0" + resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-2.4.0.tgz#35ce7f333d5616f1c1e1bfe266c3aba2e5b2e704" + integrity sha512-G6zHoVqC6GGTQkZwF4lkuEyMbVOjoBKAEybQUypI1WTkqinCOrq2x6U2+phkJ1XsEMTy4LjtwPI7HW+NVrRR2w== + path-type@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/path-type/-/path-type-3.0.0.tgz#cef31dc8e0a1a3bb0d105c0cd97cf3bf47f4e36f" @@ -10096,6 +10170,13 @@ promise@^7.1.1: dependencies: asap "~2.0.3" +promise@^8.0.3: + version "8.0.3" + resolved "https://registry.yarnpkg.com/promise/-/promise-8.0.3.tgz#f592e099c6cddc000d538ee7283bb190452b0bf6" + integrity sha512-HeRDUL1RJiLhyA0/grn+PTShlBAcLuh/1BJGtrvjwbvRDCTLLMEz9rOGCV+R3vHY4MixIuoMEd9Yq/XvsTPcjw== + dependencies: + asap "~2.0.6" + prompts@^2.0.1: version "2.0.4" resolved "https://registry.yarnpkg.com/prompts/-/prompts-2.0.4.tgz#179f9d4db3128b9933aa35f93a800d8fce76a682" @@ -10892,6 +10973,11 @@ regenerate@^1.4.0: resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.0.tgz#4a856ec4b56e4077c557589cae85e7a4c8869a11" integrity sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg== +regenerator-runtime@^0.10.5: + version "0.10.5" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" + integrity sha1-M2w+/BIgrc7dosn6tntaeVWjNlg= + regenerator-runtime@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" @@ -12506,6 +12592,11 @@ tslib@1.9.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" integrity sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ== +tslib@^1.9.3: + version "1.10.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" + integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== + tslint-config-prettier@1.18.0: version "1.18.0" resolved "https://registry.yarnpkg.com/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz#75f140bde947d35d8f0d238e0ebf809d64592c37" From 38dffea37cd515b96ede208e5ae5a9d658179605 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sat, 12 Oct 2019 08:24:03 +0000 Subject: [PATCH 055/162] chore(release): 12.4.0 [skip ci] # [12.4.0](https://github.com/streamich/react-use/compare/v12.3.2...v12.4.0) (2019-10-12) ### Features * useIntersection ([#652](https://github.com/streamich/react-use/issues/652)) ([d5f359f](https://github.com/streamich/react-use/commit/d5f359f)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a3473914a..793f4b92de 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [12.4.0](https://github.com/streamich/react-use/compare/v12.3.2...v12.4.0) (2019-10-12) + + +### Features + +* useIntersection ([#652](https://github.com/streamich/react-use/issues/652)) ([d5f359f](https://github.com/streamich/react-use/commit/d5f359f)) + ## [12.3.2](https://github.com/streamich/react-use/compare/v12.3.1...v12.3.2) (2019-10-12) diff --git a/package.json b/package.json index e898b3788f..036ee2178f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.3.2", + "version": "12.4.0", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From fb5a925feaf77272fa09915cac2000c7110b1429 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 12 Oct 2019 20:03:46 +1100 Subject: [PATCH 056/162] chore(deps): pin dependency @shopify/jest-dom-mocks to 2.8.2 (#671) --- package.json | 2 +- yarn.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 036ee2178f..45263456aa 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "@semantic-release/changelog": "3.0.4", "@semantic-release/git": "7.0.16", "@semantic-release/npm": "5.1.13", - "@shopify/jest-dom-mocks": "^2.8.2", + "@shopify/jest-dom-mocks": "2.8.2", "@storybook/addon-actions": "5.1.11", "@storybook/addon-knobs": "5.1.11", "@storybook/addon-notes": "5.1.11", diff --git a/yarn.lock b/yarn.lock index 051f3791fc..16dfbda628 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1729,7 +1729,7 @@ resolved "https://registry.yarnpkg.com/@shopify/function-enhancers/-/function-enhancers-1.0.5.tgz#7c3e516e26ce7a9b63c263679bdcf5121d994a10" integrity sha512-34ML8DX4RmmA9hXDlf2BAz4SA37unShZxoBRPz585a+FaEzNcMvw5NzLD+Ih9XrP/wrxTUcN+p6pazvoS+jB7w== -"@shopify/jest-dom-mocks@^2.8.2": +"@shopify/jest-dom-mocks@2.8.2": version "2.8.2" resolved "https://registry.yarnpkg.com/@shopify/jest-dom-mocks/-/jest-dom-mocks-2.8.2.tgz#477c3159897807cc8d7797c33e8a79e787051779" integrity sha512-4drt+S1cQ1ZSP1DaEHAj5XPPCiI2R8IIt+ZnH9h08Ngy8PjtjFFNHNcSJ6bKBmk7eO2c6+5UaJQzNcg56nt7gg== From 282f04b6f6c6752dcdbb689df4cf27587dfd9f29 Mon Sep 17 00:00:00 2001 From: Ward Oosterlijnck Date: Sat, 12 Oct 2019 21:03:35 +1100 Subject: [PATCH 057/162] docs: useMeasure and useSize docs tidy --- README.md | 4 ++-- docs/useMeasure.md | 12 +++++++++--- docs/useSize.md | 6 +++++- src/__stories__/useMeasure.story.tsx | 12 +++--------- src/__stories__/useSize.story.tsx | 7 +++---- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index e1af98a4c0..ebe6c734db 100644 --- a/README.md +++ b/README.md @@ -61,11 +61,11 @@ - [`usePageLeave`](./docs/usePageLeave.md) — triggers when mouse leaves page boundaries. - [`useScroll`](./docs/useScroll.md) — tracks an HTML element's scroll position. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usescroll--docs) - [`useScrolling`](./docs/useScrolling.md) — tracks whether HTML element is scrolling. - - [`useSize`](./docs/useSize.md) — tracks an HTML element's dimensions. + - [`useSize`](./docs/useSize.md) — tracks an HTML element's size. - [`useStartTyping`](./docs/useStartTyping.md) — detects when user starts typing. - [`useWindowScroll`](./docs/useWindowScroll.md) — tracks `Window` scroll position. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usewindowscroll--docs) - [`useWindowSize`](./docs/useWindowSize.md) — tracks `Window` dimensions. [![][img-demo]](https://codesandbox.io/s/m7ln22668) - - [`useMeasure`](./docs/useMeasure.md) — tracks an HTML element's dimensions by [Resize Observer](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver/ResizeObserver).[![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usemeasure--demo) + - [`useMeasure`](./docs/useMeasure.md) — tracks an HTML element's dimensions using the Resize Observer API.[![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usemeasure--demo)

- [**UI**](./docs/UI.md) diff --git a/docs/useMeasure.md b/docs/useMeasure.md index 92b5db7b11..0f574fbcbe 100644 --- a/docs/useMeasure.md +++ b/docs/useMeasure.md @@ -1,6 +1,6 @@ # `useMeasure` -React sensor hook that reacts to changes in size of any of the observed elements. +React sensor hook that tracks dimensions of an HTML element using the [Resize Observer API](https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver). ## Usage @@ -8,12 +8,18 @@ React sensor hook that reacts to changes in size of any of the observed elements import { useMeasure } from "react-use"; const Demo = () => { - const [ref, { width, height }] = useMeasure(); + const [ref, { x, y, width, height, top, right, bottom, left }] = useMeasure(); return (
+
x: {x}
+
y: {y}
width: {width}
height: {height}
+
top: {top}
+
right: {right}
+
bottom: {bottom}
+
left: {left}
); }; @@ -21,4 +27,4 @@ const Demo = () => { ## Related hooks -- [useSize](./useSize.md) \ No newline at end of file +- [useSize](./useSize.md) diff --git a/docs/useSize.md b/docs/useSize.md index 3e8868f5cb..3784d01796 100644 --- a/docs/useSize.md +++ b/docs/useSize.md @@ -9,7 +9,7 @@ import {useSize} from 'react-use'; const Demo = () => { const [sized, {width, height}] = useSize( - ({width}) =>
Size me up! ({width}px)
, + ({width}) =>
Size me up! ({width}px)
, { width: 100, height: 100 } ); @@ -31,3 +31,7 @@ useSize(element, initialSize); - `element` — sized element. - `initialSize` — initial size containing a `width` and `height` key. + +## Related hooks + +- [useMeasure](./useMeasure.md) diff --git a/src/__stories__/useMeasure.story.tsx b/src/__stories__/useMeasure.story.tsx index c91fa18bd4..2431f993c8 100644 --- a/src/__stories__/useMeasure.story.tsx +++ b/src/__stories__/useMeasure.story.tsx @@ -4,18 +4,12 @@ import { useMeasure } from '..'; import ShowDocs from './util/ShowDocs'; const Demo = () => { - const [ref, { width, height }] = useMeasure(); + const [ref, state] = useMeasure(); return ( <> -
width: {width}
-
height: {height}
-
+
{JSON.stringify(state, null, 2)}
+
resize me
diff --git a/src/__stories__/useSize.story.tsx b/src/__stories__/useSize.story.tsx index c029359a21..9310b3775e 100644 --- a/src/__stories__/useSize.story.tsx +++ b/src/__stories__/useSize.story.tsx @@ -4,15 +4,14 @@ import { useSize } from '..'; import ShowDocs from './util/ShowDocs'; const Demo = () => { - const [sized, { width, height }] = useSize(({ width: currentWidth }) => ( -
Size me up! ({currentWidth}px)
+ const [sized, state] = useSize(({ width: currentWidth }) => ( +
Size me up! ({currentWidth}px)
)); return (
+
{JSON.stringify(state, null, 2)}
{sized} -
width: {width}
-
height: {height}
); }; From 6afa6b4793e4011aa7809897d9fea9aedbae8562 Mon Sep 17 00:00:00 2001 From: Jose Felix Date: Sat, 12 Oct 2019 20:13:43 -0400 Subject: [PATCH 058/162] tests: useDeepCompareEffect and useUpdateEffect tests (#663) --- src/__tests__/useDeepCompareEffect.test.ts | 39 ++++++++++++++++++++++ src/__tests__/useUpdateEffect.test.ts | 13 ++++++++ 2 files changed, 52 insertions(+) create mode 100644 src/__tests__/useDeepCompareEffect.test.ts create mode 100644 src/__tests__/useUpdateEffect.test.ts diff --git a/src/__tests__/useDeepCompareEffect.test.ts b/src/__tests__/useDeepCompareEffect.test.ts new file mode 100644 index 0000000000..965495de21 --- /dev/null +++ b/src/__tests__/useDeepCompareEffect.test.ts @@ -0,0 +1,39 @@ +import { renderHook } from '@testing-library/react-hooks'; +import { useDeepCompareEffect } from '..'; +import { useEffect } from 'react'; + +let options = { max: 10 }; +const mockEffectNormal = jest.fn(); +const mockEffectDeep = jest.fn(); +const mockEffectCleanup = jest.fn(); +const mockEffectCallback = jest.fn().mockReturnValue(mockEffectCleanup); + +it('should run provided object once', () => { + const { rerender: rerenderNormal } = renderHook(() => useEffect(mockEffectNormal, [options])); + const { rerender: rerenderDeep } = renderHook(() => useDeepCompareEffect(mockEffectDeep, [options])); + + expect(mockEffectNormal).toHaveBeenCalledTimes(1); + expect(mockEffectDeep).toHaveBeenCalledTimes(1); + + options = { max: 10 }; + rerenderDeep(); + rerenderNormal(); + + expect(mockEffectNormal).toHaveBeenCalledTimes(2); + expect(mockEffectDeep).toHaveBeenCalledTimes(1); + + options = { max: 10 }; + rerenderNormal(); + rerenderDeep(); + + expect(mockEffectNormal).toHaveBeenCalledTimes(3); + expect(mockEffectDeep).toHaveBeenCalledTimes(1); +}); + +it('should run clean-up provided on unmount', () => { + const { unmount } = renderHook(() => useDeepCompareEffect(mockEffectCallback, [options])); + expect(mockEffectCleanup).not.toHaveBeenCalled(); + + unmount(); + expect(mockEffectCleanup).toHaveBeenCalledTimes(1); +}); diff --git a/src/__tests__/useUpdateEffect.test.ts b/src/__tests__/useUpdateEffect.test.ts new file mode 100644 index 0000000000..933395d402 --- /dev/null +++ b/src/__tests__/useUpdateEffect.test.ts @@ -0,0 +1,13 @@ +import { renderHook } from '@testing-library/react-hooks'; +import { useUpdateEffect } from '..'; + +const mockEffectCleanup = jest.fn(); +const mockEffectCallback = jest.fn().mockReturnValue(mockEffectCleanup); + +it('should run effect on update', () => { + const { rerender } = renderHook(() => useUpdateEffect(mockEffectCallback)); + expect(mockEffectCallback).not.toHaveBeenCalled(); + + rerender(); + expect(mockEffectCallback).toHaveBeenCalledTimes(1); +}); From 2310f54091397e4a31fc707e0220a75395db59b9 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sat, 12 Oct 2019 23:56:01 +0000 Subject: [PATCH 059/162] chore(deps): update dependency husky to v3.0.9 --- package.json | 2 +- yarn.lock | 37 +++++++++++++++++++++++++++++++------ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 45263456aa..f6397918c1 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "babel-plugin-dynamic-import-node": "2.3.0", "fork-ts-checker-webpack-plugin": "1.5.0", "gh-pages": "2.1.1", - "husky": "3.0.8", + "husky": "3.0.9", "jest": "24.9.0", "keyboardjs": "2.5.1", "lint-staged": "9.4.2", diff --git a/yarn.lock b/yarn.lock index 16dfbda628..f7a974f270 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6647,20 +6647,20 @@ humanize-url@^1.0.0: normalize-url "^1.0.0" strip-url-auth "^1.0.0" -husky@3.0.8: - version "3.0.8" - resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.8.tgz#8de3fed26ce9b43034ef51013c4ad368b6b74ea8" - integrity sha512-HFOsgcyrX3qe/rBuqyTt+P4Gxn5P0seJmr215LAZ/vnwK3jWB3r0ck7swbzGRUbufCf9w/lgHPVbF/YXQALgfQ== +husky@3.0.9: + version "3.0.9" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.9.tgz#a2c3e9829bfd6b4957509a9500d2eef5dbfc8044" + integrity sha512-Yolhupm7le2/MqC1VYLk/cNmYxsSsqKkTyBhzQHhPK1jFnC89mmmNVuGtLNabjDI6Aj8UNIr0KpRNuBkiC4+sg== dependencies: chalk "^2.4.2" + ci-info "^2.0.0" cosmiconfig "^5.2.1" execa "^1.0.0" get-stdin "^7.0.0" - is-ci "^2.0.0" opencollective-postinstall "^2.0.2" pkg-dir "^4.2.0" please-upgrade-node "^3.2.0" - read-pkg "^5.1.1" + read-pkg "^5.2.0" run-node "^1.0.0" slash "^3.0.0" @@ -9785,6 +9785,16 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" +parse-json@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" + integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + lines-and-columns "^1.1.6" + parse5@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" @@ -10802,6 +10812,16 @@ read-pkg@^5.0.0, read-pkg@^5.1.1: parse-json "^4.0.0" type-fest "^0.4.1" +read-pkg@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== + dependencies: + "@types/normalize-package-data" "^2.4.0" + normalize-package-data "^2.5.0" + parse-json "^5.0.0" + type-fest "^0.6.0" + read@1, read@~1.0.1, read@~1.0.7: version "1.0.7" resolved "https://registry.yarnpkg.com/read/-/read-1.0.7.tgz#b3da19bd052431a97671d44a42634adf710b40c4" @@ -12699,6 +12719,11 @@ type-fest@^0.5.0: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw== +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== + type-is@~1.6.17, type-is@~1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" From a38f026beb193ac31a728bd06095337eaa6afe95 Mon Sep 17 00:00:00 2001 From: Ward Date: Sun, 13 Oct 2019 17:54:30 +1100 Subject: [PATCH 060/162] refactor: useInterval refactor + docs (#626) --- docs/useInterval.md | 23 +++++++++++------------ src/__stories__/useInterval.story.tsx | 20 ++++++++++---------- src/useInterval.ts | 7 ++++--- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/useInterval.md b/docs/useInterval.md index 03679acfa8..5c3ae9a7ab 100644 --- a/docs/useInterval.md +++ b/docs/useInterval.md @@ -1,6 +1,6 @@ # `useInterval` -React hook that allow you using declarative `setInterval`. +A declarative interval hook based on [Dan Abramov's article on overreacted.io](https://overreacted.io/making-setinterval-declarative-with-react-hooks). The interval can be paused by setting the delay to `null`. ## Usage @@ -11,32 +11,31 @@ import {useInterval} from 'react-use'; const Demo = () => { const [count, setCount] = React.useState(0); const [delay, setDelay] = React.useState(1000); + const [isRunning, toggleIsRunning] = useBoolean(true); - useInterval(() => { - setCount(count + 1); - }, delay); - - function handleDelayChange(e) { - setDelay(Number(e.target.value)); - } + useInterval( + () => { + setCount(count + 1); + }, + isRunning ? delay : null + ); return (
- delay: + delay: setDelay(Number(event.target.value))} />

count: {count}

- +
); }; ``` - ## Reference ```js -useInterval(fn, delay?: number) +useInterval(callback, delay?: number) ``` diff --git a/src/__stories__/useInterval.story.tsx b/src/__stories__/useInterval.story.tsx index 7ac3d37c61..2e460308a8 100644 --- a/src/__stories__/useInterval.story.tsx +++ b/src/__stories__/useInterval.story.tsx @@ -1,28 +1,28 @@ import { storiesOf } from '@storybook/react'; import * as React from 'react'; -import { useInterval } from '..'; +import { useInterval, useBoolean } from '..'; import ShowDocs from './util/ShowDocs'; const Demo = () => { const [count, setCount] = React.useState(0); const [delay, setDelay] = React.useState(1000); + const [isRunning, toggleIsRunning] = useBoolean(true); - useInterval(() => { - setCount(count + 1); - }, delay); - - function handleDelayChange(e) { - setDelay(Number(e.target.value)); - } + useInterval( + () => { + setCount(count + 1); + }, + isRunning ? delay : null + ); return (
- delay: + delay: setDelay(Number(event.target.value))} />

count: {count}

- +
); diff --git a/src/useInterval.ts b/src/useInterval.ts index f411cc7483..4613d5e9ef 100644 --- a/src/useInterval.ts +++ b/src/useInterval.ts @@ -1,17 +1,18 @@ import { useEffect, useRef } from 'react'; const useInterval = (callback: Function, delay?: number | null) => { - const latestCallback = useRef(() => {}); + const savedCallback = useRef(() => {}); useEffect(() => { - latestCallback.current = callback; + savedCallback.current = callback; }); useEffect(() => { if (delay !== null) { - const interval = setInterval(() => latestCallback.current(), delay || 0); + const interval = setInterval(() => savedCallback.current(), delay || 0); return () => clearInterval(interval); } + return undefined; }, [delay]); }; From a624364d8bee2a65ef9094dfa2413811b5602bf4 Mon Sep 17 00:00:00 2001 From: Ward Date: Mon, 14 Oct 2019 07:38:04 +1100 Subject: [PATCH 061/162] feat: useList allow pushing multiple items (#621) --- src/__tests__/useList.test.ts | 13 +++++++++++++ src/useList.ts | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/__tests__/useList.test.ts b/src/__tests__/useList.test.ts index f8dc9584e9..47b5beb73b 100644 --- a/src/__tests__/useList.test.ts +++ b/src/__tests__/useList.test.ts @@ -104,6 +104,19 @@ it('should push duplicated element at the end of the list', () => { expect(result.current[0]).not.toBe(initList); // checking immutability }); +it('should push multiple elements at the end of the list', () => { + const initList = [1, 2, 3]; + const { result } = setUp(initList); + const [, utils] = result.current; + + act(() => { + utils.push(4, 5, 6); + }); + + expect(result.current[0]).toEqual([1, 2, 3, 4, 5, 6]); + expect(result.current[0]).not.toBe(initList); // checking immutability +}); + it('should filter current list by provided function', () => { const initList = [1, -1, 2, -2, 3, -3]; const { result } = setUp(initList); diff --git a/src/useList.ts b/src/useList.ts index 500008180e..eecdc5073c 100644 --- a/src/useList.ts +++ b/src/useList.ts @@ -5,7 +5,7 @@ export interface Actions { clear: () => void; updateAt: (index: number, item: T) => void; remove: (index: number) => void; - push: (item: T) => void; + push: (...items: T[]) => void; filter: (fn: (value: T) => boolean) => void; sort: (fn?: (a: T, b: T) => number) => void; reset: () => void; @@ -21,7 +21,7 @@ const useList = (initialList: T[] = []): [T[], Actions] => { updateAt: (index, entry) => set(currentList => [...currentList.slice(0, index), entry, ...currentList.slice(index + 1)]), remove: index => set(currentList => [...currentList.slice(0, index), ...currentList.slice(index + 1)]), - push: entry => set(currentList => [...currentList, entry]), + push: (...entry) => set(currentList => [...currentList, ...entry]), filter: fn => set(currentList => currentList.filter(fn)), sort: (fn?) => set(currentList => [...currentList].sort(fn)), reset: () => set([...initialList]), From 7955c3e1e058562317c3e79c4fbc8a5187648f52 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Sun, 13 Oct 2019 20:40:24 +0000 Subject: [PATCH 062/162] chore(release): 12.5.0 [skip ci] # [12.5.0](https://github.com/streamich/react-use/compare/v12.4.0...v12.5.0) (2019-10-13) ### Features * useList allow pushing multiple items ([#621](https://github.com/streamich/react-use/issues/621)) ([a624364](https://github.com/streamich/react-use/commit/a624364)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 793f4b92de..611807673f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [12.5.0](https://github.com/streamich/react-use/compare/v12.4.0...v12.5.0) (2019-10-13) + + +### Features + +* useList allow pushing multiple items ([#621](https://github.com/streamich/react-use/issues/621)) ([a624364](https://github.com/streamich/react-use/commit/a624364)) + # [12.4.0](https://github.com/streamich/react-use/compare/v12.3.2...v12.4.0) (2019-10-12) diff --git a/package.json b/package.json index f6397918c1..9b3401cee4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.4.0", + "version": "12.5.0", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From 5bf8f8e9ee00a9ca0273d3f6c570424e6bc42a88 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Sun, 13 Oct 2019 22:08:37 +0000 Subject: [PATCH 063/162] chore(deps): update node.js to v12.11.1 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4f2c037c6b..b56cb85850 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2 refs: container: &container docker: - - image: node:12.9.1 + - image: node:12.11.1 working_directory: ~/repo steps: - &Versions From 7dd7ba87add498a63dbf1cb8ad1373b7f94f256a Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 14 Oct 2019 09:26:44 +0000 Subject: [PATCH 064/162] chore(deps): update dependency fork-ts-checker-webpack-plugin to v1.5.1 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 9b3401cee4..cd2cf5e943 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "babel-core": "6.26.3", "babel-loader": "8.0.6", "babel-plugin-dynamic-import-node": "2.3.0", - "fork-ts-checker-webpack-plugin": "1.5.0", + "fork-ts-checker-webpack-plugin": "1.5.1", "gh-pages": "2.1.1", "husky": "3.0.9", "jest": "24.9.0", diff --git a/yarn.lock b/yarn.lock index f7a974f270..e132f5843c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5910,10 +5910,10 @@ fork-ts-checker-webpack-plugin@1.1.1: tapable "^1.0.0" worker-rpc "^0.1.0" -fork-ts-checker-webpack-plugin@1.5.0: - version "1.5.0" - resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-1.5.0.tgz#ce1d77190b44d81a761b10b6284a373795e41f0c" - integrity sha512-zEhg7Hz+KhZlBhILYpXy+Beu96gwvkROWJiTXOCyOOMMrdBIRPvsBpBqgTI4jfJGrJXcqGwJR8zsBGDmzY0jsA== +fork-ts-checker-webpack-plugin@1.5.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-1.5.1.tgz#f82d078ba8911c7b2c70703ffb3cbe588b33fbaa" + integrity sha512-IbVh1Z46dmCXJMg6We8s9jYwCAzzSv2Tgj+G2Sg/8pFantHDBrAg/rQyPnmAWLS/djW7n4VEltoEglbtTvt0wQ== dependencies: babel-code-frame "^6.22.0" chalk "^2.4.1" From cb4a735b84efeaee711de97b0cf00a0db8ee7193 Mon Sep 17 00:00:00 2001 From: xobotyi Date: Mon, 14 Oct 2019 20:30:07 +0300 Subject: [PATCH 065/162] useMediatedState implementation, tests and docs; --- README.md | 1 + docs/useMediatedState.md | 42 +++++++++++++ src/__stories__/useMediatedState.story.tsx | 28 +++++++++ src/__tests__/useMediatedState.test.ts | 68 ++++++++++++++++++++++ src/index.ts | 1 + src/useMediatedState.ts | 32 ++++++++++ 6 files changed, 172 insertions(+) create mode 100644 docs/useMediatedState.md create mode 100644 src/__stories__/useMediatedState.story.tsx create mode 100644 src/__tests__/useMediatedState.test.ts create mode 100644 src/useMediatedState.ts diff --git a/README.md b/README.md index ebe6c734db..502864511c 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ - [`useList`](./docs/useList.md) and [`useUpsert`](./docs/useUpsert.md) — tracks state of an array. [![][img-demo]](https://codesandbox.io/s/wonderful-mahavira-1sm0w) - [`useMap`](./docs/useMap.md) — tracks state of an object. [![][img-demo]](https://codesandbox.io/s/quirky-dewdney-gi161) - [`useStateValidator`](./docs/useStateValidator.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usestatevalidator--demo) + - [`useMedisatedState`](./docs/useMediatedState.md) — like the regular `useState` but with mediation by custom function. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usemediatedstate--demo)

diff --git a/docs/useMediatedState.md b/docs/useMediatedState.md new file mode 100644 index 0000000000..34a5cdb590 --- /dev/null +++ b/docs/useMediatedState.md @@ -0,0 +1,42 @@ +# `useMediatedState` + +A lot like the standard `useState`, but with mediation process. + +## Usage +```ts +import * as React from 'react'; +import { useMediatedState } from '../useMediatedState'; + +const InputMediator = s => s.replace(/[\s]+/, ' '); +const Demo = () => { + const [state, setState] = useMediatedState('', InputMediator); + + return ( +
+
You will not be able to enter more than one space
+ ) => { + setState(ev.target.value); + }} + /> +
+ ); +}; +``` + +## Reference +```ts +const [state, setState] = useMediatedState( + mediator: StateMediator, + initialState?: S +); +``` + +> Initial state will be set as-is. + +In case mediator expects 2 arguments it will receive the `setState` function as second argument, it is useful for async mediators. +>This hook will not cancel previous mediation when new one been invoked, you have to handle it yourself._ diff --git a/src/__stories__/useMediatedState.story.tsx b/src/__stories__/useMediatedState.story.tsx new file mode 100644 index 0000000000..d3c946f6dd --- /dev/null +++ b/src/__stories__/useMediatedState.story.tsx @@ -0,0 +1,28 @@ +import { storiesOf } from '@storybook/react'; +import * as React from 'react'; +import { useMediatedState } from '../useMediatedState'; +import ShowDocs from './util/ShowDocs'; + +const InputMediator = s => s.replace(/[\s]+/, ' '); +const Demo = () => { + const [state, setState] = useMediatedState(InputMediator, ''); + + return ( +
+
You will not be able to enter more than one space
+ ) => { + setState(ev.target.value); + }} + /> +
+ ); +}; + +storiesOf('State|useMediatedState', module) + .add('Docs', () => ) + .add('Demo', () => ); diff --git a/src/__tests__/useMediatedState.test.ts b/src/__tests__/useMediatedState.test.ts new file mode 100644 index 0000000000..ef9838a9de --- /dev/null +++ b/src/__tests__/useMediatedState.test.ts @@ -0,0 +1,68 @@ +import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { Dispatch, SetStateAction } from 'react'; +import { useMediatedState } from '../'; +import { StateMediator, UseMediatedStateReturn } from '../useMediatedState'; + +describe('useMediatedState', () => { + it('should be defined', () => { + expect(useMediatedState).toBeDefined(); + }); + + function getHook( + initialState: number = 2, + fn: StateMediator = jest.fn(newState => newState / 2) + ): [jest.Mock | StateMediator, RenderHookResult>] { + return [fn, renderHook(() => useMediatedState(fn, initialState))]; + } + + it('should return array of two elements', () => { + const [, hook] = getHook(); + + expect(Array.isArray(hook.result.current)).toBe(true); + expect(hook.result.current[0]).toBe(2); + expect(typeof hook.result.current[1]).toBe('function'); + }); + + it('should act like regular useState but with mediator call on each setState', () => { + const [spy, hook] = getHook(); + + expect(hook.result.current[0]).toBe(2); + + act(() => hook.result.current[1](3)); + expect(hook.result.current[0]).toBe(1.5); + expect(spy).toHaveBeenCalledTimes(1); + + act(() => hook.result.current[1](4)); + expect(hook.result.current[0]).toBe(2); + expect(spy).toHaveBeenCalledTimes(2); + }); + + it('should not call mediator on init', () => { + const [spy] = getHook(); + + expect(spy).toHaveBeenCalledTimes(0); + }); + + it('mediator should receive setState argument as first argument', () => { + let val; + const spy = jest.fn(newState => { + val = newState; + return newState * 2; + }); + const [, hook] = getHook(1, spy); + + act(() => hook.result.current[1](3)); + expect(val).toBe(3); + expect(hook.result.current[0]).toBe(6); + }); + + it('if mediator expects 2 args, second should be a function setting the state', () => { + const spy = (jest.fn((newState: number, setState: Dispatch>): void => { + setState(newState * 2); + }) as unknown) as StateMediator; + const [, hook] = getHook(1, spy); + + act(() => hook.result.current[1](3)); + expect(hook.result.current[0]).toBe(6); + }); +}); diff --git a/src/index.ts b/src/index.ts index 65872134d6..e1e9b33781 100644 --- a/src/index.ts +++ b/src/index.ts @@ -44,6 +44,7 @@ export { default as useLogger } from './useLogger'; export { default as useMap } from './useMap'; export { default as useMedia } from './useMedia'; export { default as useMediaDevices } from './useMediaDevices'; +export { useMediatedState } from './useMediatedState'; export { default as useMotion } from './useMotion'; export { default as useMount } from './useMount'; export { default as useMountedState } from './useMountedState'; diff --git a/src/useMediatedState.ts b/src/useMediatedState.ts new file mode 100644 index 0000000000..708b2ecf92 --- /dev/null +++ b/src/useMediatedState.ts @@ -0,0 +1,32 @@ +import { Dispatch, SetStateAction, useCallback, useRef, useState } from 'react'; + +export interface StateMediator { + (newState: any): S; + + (newState: any, dispatch: Dispatch>): void; +} + +export type UseMediatedStateReturn = [S, Dispatch>]; + +export function useMediatedState( + mediator: StateMediator +): UseMediatedStateReturn; +export function useMediatedState(mediator: StateMediator, initialState: S): UseMediatedStateReturn; + +export function useMediatedState(mediator: StateMediator, initialState?: S): UseMediatedStateReturn { + const mediatorFn = useRef(mediator); + + const [state, setMediatedState] = useState(initialState!); + const setState = useCallback( + (newState: any) => { + if (mediatorFn.current.length === 2) { + mediatorFn.current(newState, setMediatedState); + } else { + setMediatedState(mediatorFn.current(newState)); + } + }, + [state] + ); + + return [state, setState]; +} From d315b6c85e3443361240b2dd6186c566dd7b1023 Mon Sep 17 00:00:00 2001 From: xobotyi Date: Mon, 14 Oct 2019 21:54:42 +0300 Subject: [PATCH 066/162] Merge origin's yarn.lock + deduplicate it; --- yarn.lock | 327 ++++++++++++------------------------------------------ 1 file changed, 68 insertions(+), 259 deletions(-) diff --git a/yarn.lock b/yarn.lock index 6ca09a66e8..eb5ede3ef3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -36,7 +36,7 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@7.6.0": +"@babel/core@7.6.0", "@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.4.5": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.0.tgz#9b00f73554edd67bebc86df8303ef678be3d7b48" integrity sha512-FuRhDRtsd6IptKpHXAa+4WPZYY2ZzgowkbLBecEDDSje1X/apG7jQM33or3NdOmjXBKWGOg4JmSiRfUfuTtHXw== @@ -56,47 +56,15 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.4.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" - integrity sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg== +"@babel/generator@^7.0.0", "@babel/generator@^7.4.0", "@babel/generator@^7.5.5", "@babel/generator@^7.6.0", "@babel/generator@^7.6.2", "@babel/generator@^7.6.3": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.4.tgz#a4f8437287bf9671b07f483b76e3bb731bc97671" + integrity sha512-jsBuXkFoZxk0yWLyGI9llT9oiQ2FeTASmRFE32U+aaDTfoE92t78eroO7PTpU/OrYq38hlcDM6vbfLDaOLy+7w== dependencies: - "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.5.5" - "@babel/helpers" "^7.5.5" - "@babel/parser" "^7.5.5" - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" - convert-source-map "^1.1.0" - debug "^4.1.0" - json5 "^2.1.0" - lodash "^4.17.13" - resolve "^1.3.2" - semver "^5.4.1" - source-map "^0.5.0" - -"@babel/generator@^7.0.0", "@babel/generator@^7.4.0", "@babel/generator@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.5.tgz#873a7f936a3c89491b43536d12245b626664e3cf" - integrity sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ== - dependencies: - "@babel/types" "^7.5.5" + "@babel/types" "^7.6.3" jsesc "^2.5.1" lodash "^4.17.13" source-map "^0.5.0" - trim-right "^1.0.1" - -"@babel/generator@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.0.tgz#e2c21efbfd3293ad819a2359b448f002bfdfda56" - integrity sha512-Ms8Mo7YBdMMn1BYuNtKuP/z0TgEIhbcyB8HVR6PPNYp4P61lMsABiS4A3VG1qznjXVCf3r+fVHhm4efTYVsySA== - dependencies: - "@babel/types" "^7.6.0" - jsesc "^2.5.1" - lodash "^4.17.13" - source-map "^0.5.0" - trim-right "^1.0.1" "@babel/helper-annotate-as-pure@^7.0.0": version "7.0.0" @@ -130,19 +98,7 @@ "@babel/traverse" "^7.4.4" "@babel/types" "^7.4.4" -"@babel/helper-create-class-features-plugin@^7.4.0": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.5.5.tgz#401f302c8ddbc0edd36f7c6b2887d8fa1122e5a4" - integrity sha512-ZsxkyYiRA7Bg+ZTRpPvB6AbOFKTFFK4LrvTet8lInm0V468MWCaSYJE+I7v2z2r8KNLtYiV+K5kTCnR7dvyZjg== - dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-member-expression-to-functions" "^7.5.5" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.5.5" - "@babel/helper-split-export-declaration" "^7.4.4" - -"@babel/helper-create-class-features-plugin@^7.6.0": +"@babel/helper-create-class-features-plugin@^7.4.0", "@babel/helper-create-class-features-plugin@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.6.0.tgz#769711acca889be371e9bc2eb68641d55218021f" integrity sha512-O1QWBko4fzGju6VoVvrZg0RROCVifcLxiApnGP3OWfWzvxRZFCoBD81K5ur5e3bVY2Vf/5rIJm8cqPKn8HUJng== @@ -285,22 +241,13 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.2.0" -"@babel/helpers@^7.4.3", "@babel/helpers@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.5.tgz#63908d2a73942229d1e6685bc2a0e730dde3b75e" - integrity sha512-nRq2BUhxZFnfEn/ciJuhklHvFOqjJUD5wpx+1bxUF2axL9C+v4DE/dmp5sT2dKnpOs4orZWzpAZqlCy8QqE/7g== - dependencies: - "@babel/template" "^7.4.4" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" - -"@babel/helpers@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.6.0.tgz#21961d16c6a3c3ab597325c34c465c0887d31c6e" - integrity sha512-W9kao7OBleOjfXtFGgArGRX6eCP0UEcA2ZWEWNkJdRZnHhW4eEbeswbG3EwaRsnQUAEGWYgMq1HsIXuNNNy2eQ== +"@babel/helpers@^7.4.3", "@babel/helpers@^7.5.5", "@babel/helpers@^7.6.0": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.6.2.tgz#681ffe489ea4dcc55f23ce469e58e59c1c045153" + integrity sha512-3/bAUL8zZxYs1cdX2ilEE0WobqbCmKWr/889lf2SS0PpDcpEIY8pb1CCyz0pEcX3pEb+MCbks1jIokz2xLtGTA== dependencies: "@babel/template" "^7.6.0" - "@babel/traverse" "^7.6.0" + "@babel/traverse" "^7.6.2" "@babel/types" "^7.6.0" "@babel/highlight@^7.0.0": @@ -312,15 +259,10 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" - integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== - -"@babel/parser@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.0.tgz#3e05d0647432a8326cb28d0de03895ae5a57f39b" - integrity sha512-+o2q111WEx4srBs7L9eJmcwi655eD8sXniLqMB93TBK9GrNzGrxDWSjiqz2hLU0Ha8MTXFIP0yd9fNdP+m43ZQ== +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5", "@babel/parser@^7.6.0", "@babel/parser@^7.6.2", "@babel/parser@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.3.tgz#9eff8b9c3eeae16a74d8d4ff30da2bd0d6f0487e" + integrity sha512-sUZdXlva1dt2Vw2RqbMkmfoImubO0D0gaCrNngV6Hi0DA4x3o4mlrq0tbfY0dZEUIccH8I6wQ4qgEtwcpOR6Qg== "@babel/plugin-proposal-async-generator-functions@^7.2.0": version "7.2.0" @@ -483,18 +425,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-block-scoping@^7.4.0", "@babel/plugin-transform-block-scoping@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.5.5.tgz#a35f395e5402822f10d2119f6f8e045e3639a2ce" - integrity sha512-82A3CLRRdYubkG85lKwhZB0WZoHxLGsJdux/cOVaJCJpvYFl1LVzAIFyRsa7CvXqW8rBM4Zf3Bfn8PHt5DP0Sg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - lodash "^4.17.13" - -"@babel/plugin-transform-block-scoping@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.0.tgz#c49e21228c4bbd4068a35667e6d951c75439b1dc" - integrity sha512-tIt4E23+kw6TgL/edACZwP1OUKrjOTyMrFMLoT5IOFrfMRabCgekjqFd5o6PaAMildBu46oFkekIdMuGkkPEpA== +"@babel/plugin-transform-block-scoping@^7.4.0", "@babel/plugin-transform-block-scoping@^7.5.5", "@babel/plugin-transform-block-scoping@^7.6.0": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.3.tgz#6e854e51fbbaa84351b15d4ddafe342f3a5d542a" + integrity sha512-7hvrg75dubcO3ZI2rjYTzUrEuh1E9IyDEhhB6qfcooxhDA33xx2MasuLVgdxzcP6R/lipAC6n9ub9maNW6RKdw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.13" @@ -541,14 +475,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-destructuring@^7.4.3", "@babel/plugin-transform-destructuring@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.5.0.tgz#f6c09fdfe3f94516ff074fe877db7bc9ef05855a" - integrity sha512-YbYgbd3TryYYLGyC7ZR+Tq8H/+bCmwoaxHfJHupom5ECstzbRLTch6gOQbhEY9Z4hiCNHEURgq06ykFv9JZ/QQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-destructuring@^7.6.0": +"@babel/plugin-transform-destructuring@^7.4.3", "@babel/plugin-transform-destructuring@^7.5.0", "@babel/plugin-transform-destructuring@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.6.0.tgz#44bbe08b57f4480094d57d9ffbcd96d309075ba6" integrity sha512-2bGIS5P1v4+sWTCnKNDZDxbGvEqi0ijeqM/YqHtVGrvG2y0ySgnEEhXErvE9dA0bnIzY9bIzdFK0jFA46ASIIQ== @@ -625,17 +552,7 @@ "@babel/helper-plugin-utils" "^7.0.0" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-commonjs@^7.4.3", "@babel/plugin-transform-modules-commonjs@^7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.5.0.tgz#425127e6045231360858eeaa47a71d75eded7a74" - integrity sha512-xmHq0B+ytyrWJvQTc5OWAC4ii6Dhr0s22STOoydokG51JjWhyYo5mRPXoi+ZmtHQhZZwuXNN+GG5jy5UZZJxIQ== - dependencies: - "@babel/helper-module-transforms" "^7.4.4" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" - babel-plugin-dynamic-import-node "^2.3.0" - -"@babel/plugin-transform-modules-commonjs@^7.6.0": +"@babel/plugin-transform-modules-commonjs@^7.4.3", "@babel/plugin-transform-modules-commonjs@^7.5.0", "@babel/plugin-transform-modules-commonjs@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.6.0.tgz#39dfe957de4420445f1fcf88b68a2e4aa4515486" integrity sha512-Ma93Ix95PNSEngqomy5LSBMAQvYKVe3dy+JlVJSHEXZR5ASL9lQBedMiCyVtmTLraIDVRE3ZjTZvmXXD2Ozw3g== @@ -662,19 +579,12 @@ "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-named-capturing-groups-regex@^7.4.2", "@babel/plugin-transform-named-capturing-groups-regex@^7.4.5": - version "7.4.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.5.tgz#9d269fd28a370258199b4294736813a60bbdd106" - integrity sha512-z7+2IsWafTBbjNsOxU/Iv5CvTJlr5w4+HGu1HovKYTtgJ362f7kBcQglkfmlspKKZ3bgrbSGvLfNx++ZJgCWsg== - dependencies: - regexp-tree "^0.1.6" - -"@babel/plugin-transform-named-capturing-groups-regex@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.0.tgz#1e6e663097813bb4f53d42df0750cf28ad3bb3f1" - integrity sha512-jem7uytlmrRl3iCAuQyw8BpB4c4LWvSpvIeXKpMb+7j84lkx4m4mYr5ErAcmN5KM7B6BqrAvRGjBIbbzqCczew== +"@babel/plugin-transform-named-capturing-groups-regex@^7.4.2", "@babel/plugin-transform-named-capturing-groups-regex@^7.4.5", "@babel/plugin-transform-named-capturing-groups-regex@^7.6.0": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.3.tgz#aaa6e409dd4fb2e50b6e2a91f7e3a3149dbce0cf" + integrity sha512-jTkk7/uE6H2s5w6VlMHeWuH+Pcy2lmdwFoeWCVnvIrDUnB5gQqTVI8WfmEAhF2CDEarGrknZcmSFg1+bkfCoSw== dependencies: - regexp-tree "^0.1.13" + regexpu-core "^4.6.0" "@babel/plugin-transform-new-target@^7.4.0", "@babel/plugin-transform-new-target@^7.4.4": version "7.4.4" @@ -808,15 +718,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-typescript@^7.3.2": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.4.0.tgz#0389ec53a34e80f99f708c4ca311181449a68eb1" - integrity sha512-U7/+zKnRZg04ggM/Bm+xmu2B/PrwyDQTT/V89FXWYWNMxBDwSx56u6jtk9SEbfLFbZaEI72L+5LPvQjeZgFCrQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-typescript" "^7.2.0" - -"@babel/plugin-transform-typescript@^7.6.0": +"@babel/plugin-transform-typescript@^7.3.2", "@babel/plugin-transform-typescript@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.6.0.tgz#48d78405f1aa856ebeea7288a48a19ed8da377a6" integrity sha512-yzw7EopOOr6saONZ3KA3lpizKnWRTe+rfBqg4AmQbSow7ik7fqmzrfIqt053osLwLE2AaTqGinLM2tl6+M/uog== @@ -888,7 +790,7 @@ js-levenshtein "^1.1.3" semver "^5.5.0" -"@babel/preset-env@7.6.0": +"@babel/preset-env@7.6.0", "@babel/preset-env@^7.4.5": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.0.tgz#aae4141c506100bb2bfaa4ac2a5c12b395619e50" integrity sha512-1efzxFv/TcPsNXlRhMzRnkBFMeIqBBgzwmZwlFDw5Ubj0AGLeufxugirwZmkkX/ayi3owsSqoQ4fw8LkfK9SYg== @@ -944,62 +846,6 @@ js-levenshtein "^1.1.3" semver "^5.5.0" -"@babel/preset-env@^7.4.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.5.5.tgz#bc470b53acaa48df4b8db24a570d6da1fef53c9a" - integrity sha512-GMZQka/+INwsMz1A5UEql8tG015h5j/qjptpKY2gJ7giy8ohzU710YciJB5rcKsWGWHiW3RUnHib0E5/m3Tp3A== - dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.2.0" - "@babel/plugin-proposal-dynamic-import" "^7.5.0" - "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.5.5" - "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" - "@babel/plugin-syntax-async-generators" "^7.2.0" - "@babel/plugin-syntax-dynamic-import" "^7.2.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.5.0" - "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.5.5" - "@babel/plugin-transform-classes" "^7.5.5" - "@babel/plugin-transform-computed-properties" "^7.2.0" - "@babel/plugin-transform-destructuring" "^7.5.0" - "@babel/plugin-transform-dotall-regex" "^7.4.4" - "@babel/plugin-transform-duplicate-keys" "^7.5.0" - "@babel/plugin-transform-exponentiation-operator" "^7.2.0" - "@babel/plugin-transform-for-of" "^7.4.4" - "@babel/plugin-transform-function-name" "^7.4.4" - "@babel/plugin-transform-literals" "^7.2.0" - "@babel/plugin-transform-member-expression-literals" "^7.2.0" - "@babel/plugin-transform-modules-amd" "^7.5.0" - "@babel/plugin-transform-modules-commonjs" "^7.5.0" - "@babel/plugin-transform-modules-systemjs" "^7.5.0" - "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5" - "@babel/plugin-transform-new-target" "^7.4.4" - "@babel/plugin-transform-object-super" "^7.5.5" - "@babel/plugin-transform-parameters" "^7.4.4" - "@babel/plugin-transform-property-literals" "^7.2.0" - "@babel/plugin-transform-regenerator" "^7.4.5" - "@babel/plugin-transform-reserved-words" "^7.2.0" - "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.2.0" - "@babel/plugin-transform-sticky-regex" "^7.2.0" - "@babel/plugin-transform-template-literals" "^7.4.4" - "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.4.4" - "@babel/types" "^7.5.5" - browserslist "^4.6.0" - core-js-compat "^3.1.1" - invariant "^2.2.2" - js-levenshtein "^1.1.3" - semver "^5.5.0" - "@babel/preset-flow@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" @@ -1056,16 +902,7 @@ dependencies: regenerator-runtime "^0.13.2" -"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" - integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.4.4" - "@babel/types" "^7.4.4" - -"@babel/template@^7.6.0": +"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" integrity sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ== @@ -1074,49 +911,25 @@ "@babel/parser" "^7.6.0" "@babel/types" "^7.6.0" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.5.tgz#f664f8f368ed32988cd648da9f72d5ca70f165bb" - integrity sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ== - dependencies: - "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.5.5" - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.5.5" - "@babel/types" "^7.5.5" - debug "^4.1.0" - globals "^11.1.0" - lodash "^4.17.13" - -"@babel/traverse@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.0.tgz#389391d510f79be7ce2ddd6717be66d3fed4b516" - integrity sha512-93t52SaOBgml/xY74lsmt7xOR4ufYvhb5c5qiM6lu4J/dWGMAfAh6eKw4PjLes6DI6nQgearoxnFJk60YchpvQ== +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5", "@babel/traverse@^7.6.0", "@babel/traverse@^7.6.2": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.3.tgz#66d7dba146b086703c0fb10dd588b7364cec47f9" + integrity sha512-unn7P4LGsijIxaAJo/wpoU11zN+2IaClkQAxcJWBNCMS6cmVh802IyLHNkAjQ0iYnRS3nnxk5O3fuXW28IMxTw== dependencies: "@babel/code-frame" "^7.5.5" - "@babel/generator" "^7.6.0" + "@babel/generator" "^7.6.3" "@babel/helper-function-name" "^7.1.0" "@babel/helper-split-export-declaration" "^7.4.4" - "@babel/parser" "^7.6.0" - "@babel/types" "^7.6.0" + "@babel/parser" "^7.6.3" + "@babel/types" "^7.6.3" debug "^4.1.0" globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" - integrity sha512-s63F9nJioLqOlW3UkyMd+BYhXt44YuaFm/VV0VwuteqjYwRrObkU7ra9pY4wAJR3oXi8hJrMcrcJdO/HH33vtw== - dependencies: - esutils "^2.0.2" - lodash "^4.17.13" - to-fast-properties "^2.0.0" - -"@babel/types@^7.6.0": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.0.tgz#1b5eaad0736e963bd2c6cf7911a53c84a7b35c08" - integrity sha512-+wLIp3XW60cvkZP/pvKMM85qoJbx7Hn3tNUpkGBLsGaSEYRz8Ut389/UsSa+wSBwSchtsLJm5IsqlA5sXawqew== +"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5", "@babel/types@^7.6.0", "@babel/types@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.3.tgz#3f07d96f854f98e2fbd45c64b0cb942d11e8ba09" + integrity sha512-CqbcpTxMcpuQTMhjI37ZHVgjBkysg5icREQIEZ0eG1yCNwg3oy+5AaLiOKmjsCj6nqOsa6Hf0ObjRVwokb7srA== dependencies: esutils "^2.0.2" lodash "^4.17.13" @@ -2189,7 +2002,15 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@16.9.2", "@types/react@>=16.9.0": +"@types/react@*", "@types/react@>=16.9.0": + version "16.9.5" + resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.5.tgz#079dabd918b19b32118c25fd00a786bb6d0d5e51" + integrity sha512-jQ12VMiFOWYlp+j66dghOWcmDDwhca0bnlcTxS4Qz/fh5gi6wpaZDthPEu/Gc/YlAuO87vbiUXL8qKstFvuOaA== + dependencies: + "@types/prop-types" "*" + csstype "^2.2.0" + +"@types/react@16.9.2": version "16.9.2" resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.2.tgz#6d1765431a1ad1877979013906731aae373de268" integrity sha512-jYP2LWwlh+FTqGd9v7ynUKZzjj98T8x7Yclz479QdRhHfuW9yQ+0jjnD31eXSXutmBpppj5PYNLYLRfnZJvcfg== @@ -10370,9 +10191,9 @@ react-inspector@^3.0.2: prop-types "^15.6.1" react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0: - version "16.9.0" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb" - integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw== + version "16.10.2" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.2.tgz#984120fd4d16800e9a738208ab1fba422d23b5ab" + integrity sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA== react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4: version "3.0.4" @@ -10731,10 +10552,10 @@ refractor@^2.4.1: parse-entities "^1.1.2" prismjs "~1.15.0" -regenerate-unicode-properties@^8.0.2: - version "8.0.2" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.0.2.tgz#7b38faa296252376d363558cfbda90c9ce709662" - integrity sha512-SbA/iNrBUf6Pv2zU8Ekv1Qbhv92yxL4hiDa2siuxs4KKn4oOoMDHXjAf7+Nz9qinUQ46B1LcWEi/PhJfPWpZWQ== +regenerate-unicode-properties@^8.0.2, regenerate-unicode-properties@^8.1.0: + version "8.1.0" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" + integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA== dependencies: regenerate "^1.4.0" @@ -10773,11 +10594,6 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp-tree@^0.1.13: - version "0.1.13" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.13.tgz#5b19ab9377edc68bc3679256840bb29afc158d7f" - integrity sha512-hwdV/GQY5F8ReLZWO+W1SRoN5YfpOKY6852+tBFcma72DKBIcHjPRIlIvQN35bCOljuAfP2G2iB0FC/w236mUw== - regexp-tree@^0.1.6: version "0.1.10" resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.10.tgz#d837816a039c7af8a8d64d7a7c3cf6a1d93450bc" @@ -10790,13 +10606,13 @@ regexp.prototype.flags@^1.2.0: dependencies: define-properties "^1.1.2" -regexpu-core@^4.5.4: - version "4.5.4" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.5.4.tgz#080d9d02289aa87fe1667a4f5136bc98a6aebaae" - integrity sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ== +regexpu-core@^4.5.4, regexpu-core@^4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" + integrity sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg== dependencies: regenerate "^1.4.0" - regenerate-unicode-properties "^8.0.2" + regenerate-unicode-properties "^8.1.0" regjsgen "^0.5.0" regjsparser "^0.6.0" unicode-match-property-ecmascript "^1.0.4" @@ -11067,20 +10883,13 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rxjs@6.5.3: +rxjs@6.5.3, rxjs@^6.3.3, rxjs@^6.4.0: version "6.5.3" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== dependencies: tslib "^1.9.0" -rxjs@^6.3.3, rxjs@^6.4.0: - version "6.5.2" - resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" - integrity sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg== - dependencies: - tslib "^1.9.0" - safe-buffer@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -11141,9 +10950,9 @@ schema-utils@^1.0.0: ajv-keywords "^3.1.0" screenfull@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-4.1.0.tgz#30eb338f615941f5a2cdd96c14e36063d2d9d764" - integrity sha512-/qH0HAmc+ilbZ9Vf8J7RHjjecSdqmjIh98iMkA6uCSKcHdJK1TiXhTbR+cin8rG70xi4Peyz7wW1KJVP6sp30g== + version "4.2.1" + resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-4.2.1.tgz#3245b7bc73d2b7c9a15bd8caaf6965db7cbc7f04" + integrity sha512-PLSp6f5XdhvjCCCO8OjavRfzkSGL3Qmdm7P82bxyU8HDDDBhDV3UckRaYcRa/NDNTYt8YBpzjoLWHUAejmOjLg== scrollbarwidth@^0.1.3: version "0.1.3" @@ -12337,12 +12146,12 @@ ts-pnp@^1.1.2: resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.1.2.tgz#be8e4bfce5d00f0f58e0666a82260c34a57af552" integrity sha512-f5Knjh7XCyRIzoC/z1Su1yLLRrPrFCgtUAh/9fCSP6NKbATwpOL1+idQVXQokK9GRFURn/jYPGPfegIctwunoA== -tslib@1.9.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" integrity sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ== -tslib@^1.10.0: +tslib@^1.10.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== From 828e116fc33f1133548ce5aa92c5e68a95aa59d7 Mon Sep 17 00:00:00 2001 From: xobotyi Date: Mon, 14 Oct 2019 22:14:55 +0300 Subject: [PATCH 067/162] Fix the yarn.lock file due to is been broken by deduping. --- yarn.lock | 331 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 275 insertions(+), 56 deletions(-) diff --git a/yarn.lock b/yarn.lock index 47e22d643a..58f934c09c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -36,10 +36,10 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@7.6.0", "@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.4.5": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.0.tgz#9b00f73554edd67bebc86df8303ef678be3d7b48" - integrity sha512-FuRhDRtsd6IptKpHXAa+4WPZYY2ZzgowkbLBecEDDSje1X/apG7jQM33or3NdOmjXBKWGOg4JmSiRfUfuTtHXw== +"@babel/core@7.6.4": + version "7.6.4" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.4.tgz#6ebd9fe00925f6c3e177bb726a188b5f578088ff" + integrity sha512-Rm0HGw101GY8FTzpWSyRbki/jzq+/PkNQJ+nSulrdY6gFGOsNseCqD6KHRYe2E+EdzuBdr2pxCp6s4Uk6eJ+XQ== dependencies: "@babel/code-frame" "^7.5.5" "@babel/generator" "^7.6.4" @@ -56,7 +56,58 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/generator@^7.0.0", "@babel/generator@^7.4.0", "@babel/generator@^7.5.5", "@babel/generator@^7.6.0", "@babel/generator@^7.6.2", "@babel/generator@^7.6.3": +"@babel/core@^7.0.0", "@babel/core@^7.1.0", "@babel/core@^7.4.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.5.5.tgz#17b2686ef0d6bc58f963dddd68ab669755582c30" + integrity sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.5.5" + "@babel/helpers" "^7.5.5" + "@babel/parser" "^7.5.5" + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" + convert-source-map "^1.1.0" + debug "^4.1.0" + json5 "^2.1.0" + lodash "^4.17.13" + resolve "^1.3.2" + semver "^5.4.1" + source-map "^0.5.0" + +"@babel/generator@^7.0.0", "@babel/generator@^7.4.0", "@babel/generator@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.5.5.tgz#873a7f936a3c89491b43536d12245b626664e3cf" + integrity sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ== + dependencies: + "@babel/types" "^7.5.5" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + trim-right "^1.0.1" + +"@babel/generator@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.2.tgz#dac8a3c2df118334c2a29ff3446da1636a8f8c03" + integrity sha512-j8iHaIW4gGPnViaIHI7e9t/Hl8qLjERI6DcV9kEpAIDJsAOrcnXqRS7t+QbhL76pwbtqP+QCQLL0z1CyVmtjjQ== + dependencies: + "@babel/types" "^7.6.0" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.5.0" + +"@babel/generator@^7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.3.tgz#71d5375264f93ec7bac7d9f35a67067733f5578e" + integrity sha512-hLhYbAb3pHwxjlijC4AQ7mqZdcoujiNaW7izCT04CIowHK8psN0IN8QjDv0iyFtycF5FowUOTwDloIheI25aMw== + dependencies: + "@babel/types" "^7.6.3" + jsesc "^2.5.1" + lodash "^4.17.13" + source-map "^0.6.1" + +"@babel/generator@^7.6.4": version "7.6.4" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.6.4.tgz#a4f8437287bf9671b07f483b76e3bb731bc97671" integrity sha512-jsBuXkFoZxk0yWLyGI9llT9oiQ2FeTASmRFE32U+aaDTfoE92t78eroO7PTpU/OrYq38hlcDM6vbfLDaOLy+7w== @@ -98,7 +149,19 @@ "@babel/traverse" "^7.4.4" "@babel/types" "^7.4.4" -"@babel/helper-create-class-features-plugin@^7.4.0", "@babel/helper-create-class-features-plugin@^7.6.0": +"@babel/helper-create-class-features-plugin@^7.4.0": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.5.5.tgz#401f302c8ddbc0edd36f7c6b2887d8fa1122e5a4" + integrity sha512-ZsxkyYiRA7Bg+ZTRpPvB6AbOFKTFFK4LrvTet8lInm0V468MWCaSYJE+I7v2z2r8KNLtYiV+K5kTCnR7dvyZjg== + dependencies: + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-member-expression-to-functions" "^7.5.5" + "@babel/helper-optimise-call-expression" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-replace-supers" "^7.5.5" + "@babel/helper-split-export-declaration" "^7.4.4" + +"@babel/helper-create-class-features-plugin@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.6.0.tgz#769711acca889be371e9bc2eb68641d55218021f" integrity sha512-O1QWBko4fzGju6VoVvrZg0RROCVifcLxiApnGP3OWfWzvxRZFCoBD81K5ur5e3bVY2Vf/5rIJm8cqPKn8HUJng== @@ -241,7 +304,16 @@ "@babel/traverse" "^7.1.0" "@babel/types" "^7.2.0" -"@babel/helpers@^7.4.3", "@babel/helpers@^7.5.5", "@babel/helpers@^7.6.0": +"@babel/helpers@^7.4.3", "@babel/helpers@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.5.5.tgz#63908d2a73942229d1e6685bc2a0e730dde3b75e" + integrity sha512-nRq2BUhxZFnfEn/ciJuhklHvFOqjJUD5wpx+1bxUF2axL9C+v4DE/dmp5sT2dKnpOs4orZWzpAZqlCy8QqE/7g== + dependencies: + "@babel/template" "^7.4.4" + "@babel/traverse" "^7.5.5" + "@babel/types" "^7.5.5" + +"@babel/helpers@^7.6.2": version "7.6.2" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.6.2.tgz#681ffe489ea4dcc55f23ce469e58e59c1c045153" integrity sha512-3/bAUL8zZxYs1cdX2ilEE0WobqbCmKWr/889lf2SS0PpDcpEIY8pb1CCyz0pEcX3pEb+MCbks1jIokz2xLtGTA== @@ -259,10 +331,15 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5", "@babel/parser@^7.6.0", "@babel/parser@^7.6.2", "@babel/parser@^7.6.3": - version "7.6.3" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.3.tgz#9eff8b9c3eeae16a74d8d4ff30da2bd0d6f0487e" - integrity sha512-sUZdXlva1dt2Vw2RqbMkmfoImubO0D0gaCrNngV6Hi0DA4x3o4mlrq0tbfY0dZEUIccH8I6wQ4qgEtwcpOR6Qg== +"@babel/parser@^7.0.0", "@babel/parser@^7.1.0", "@babel/parser@^7.4.3", "@babel/parser@^7.4.4", "@babel/parser@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" + integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== + +"@babel/parser@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.0.tgz#3e05d0647432a8326cb28d0de03895ae5a57f39b" + integrity sha512-+o2q111WEx4srBs7L9eJmcwi655eD8sXniLqMB93TBK9GrNzGrxDWSjiqz2hLU0Ha8MTXFIP0yd9fNdP+m43ZQ== "@babel/parser@^7.6.2": version "7.6.2" @@ -457,7 +534,15 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-block-scoping@^7.4.0", "@babel/plugin-transform-block-scoping@^7.5.5", "@babel/plugin-transform-block-scoping@^7.6.0": +"@babel/plugin-transform-block-scoping@^7.4.0", "@babel/plugin-transform-block-scoping@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.5.5.tgz#a35f395e5402822f10d2119f6f8e045e3639a2ce" + integrity sha512-82A3CLRRdYubkG85lKwhZB0WZoHxLGsJdux/cOVaJCJpvYFl1LVzAIFyRsa7CvXqW8rBM4Zf3Bfn8PHt5DP0Sg== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + lodash "^4.17.13" + +"@babel/plugin-transform-block-scoping@^7.6.3": version "7.6.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.3.tgz#6e854e51fbbaa84351b15d4ddafe342f3a5d542a" integrity sha512-7hvrg75dubcO3ZI2rjYTzUrEuh1E9IyDEhhB6qfcooxhDA33xx2MasuLVgdxzcP6R/lipAC6n9ub9maNW6RKdw== @@ -507,7 +592,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-destructuring@^7.4.3", "@babel/plugin-transform-destructuring@^7.5.0", "@babel/plugin-transform-destructuring@^7.6.0": +"@babel/plugin-transform-destructuring@^7.4.3", "@babel/plugin-transform-destructuring@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.5.0.tgz#f6c09fdfe3f94516ff074fe877db7bc9ef05855a" + integrity sha512-YbYgbd3TryYYLGyC7ZR+Tq8H/+bCmwoaxHfJHupom5ECstzbRLTch6gOQbhEY9Z4hiCNHEURgq06ykFv9JZ/QQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + +"@babel/plugin-transform-destructuring@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.6.0.tgz#44bbe08b57f4480094d57d9ffbcd96d309075ba6" integrity sha512-2bGIS5P1v4+sWTCnKNDZDxbGvEqi0ijeqM/YqHtVGrvG2y0ySgnEEhXErvE9dA0bnIzY9bIzdFK0jFA46ASIIQ== @@ -593,7 +685,17 @@ "@babel/helper-plugin-utils" "^7.0.0" babel-plugin-dynamic-import-node "^2.3.0" -"@babel/plugin-transform-modules-commonjs@^7.4.3", "@babel/plugin-transform-modules-commonjs@^7.5.0", "@babel/plugin-transform-modules-commonjs@^7.6.0": +"@babel/plugin-transform-modules-commonjs@^7.4.3", "@babel/plugin-transform-modules-commonjs@^7.5.0": + version "7.5.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.5.0.tgz#425127e6045231360858eeaa47a71d75eded7a74" + integrity sha512-xmHq0B+ytyrWJvQTc5OWAC4ii6Dhr0s22STOoydokG51JjWhyYo5mRPXoi+ZmtHQhZZwuXNN+GG5jy5UZZJxIQ== + dependencies: + "@babel/helper-module-transforms" "^7.4.4" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/helper-simple-access" "^7.1.0" + babel-plugin-dynamic-import-node "^2.3.0" + +"@babel/plugin-transform-modules-commonjs@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.6.0.tgz#39dfe957de4420445f1fcf88b68a2e4aa4515486" integrity sha512-Ma93Ix95PNSEngqomy5LSBMAQvYKVe3dy+JlVJSHEXZR5ASL9lQBedMiCyVtmTLraIDVRE3ZjTZvmXXD2Ozw3g== @@ -620,7 +722,14 @@ "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-named-capturing-groups-regex@^7.4.2", "@babel/plugin-transform-named-capturing-groups-regex@^7.4.5", "@babel/plugin-transform-named-capturing-groups-regex@^7.6.0": +"@babel/plugin-transform-named-capturing-groups-regex@^7.4.2", "@babel/plugin-transform-named-capturing-groups-regex@^7.4.5": + version "7.4.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.5.tgz#9d269fd28a370258199b4294736813a60bbdd106" + integrity sha512-z7+2IsWafTBbjNsOxU/Iv5CvTJlr5w4+HGu1HovKYTtgJ362f7kBcQglkfmlspKKZ3bgrbSGvLfNx++ZJgCWsg== + dependencies: + regexp-tree "^0.1.6" + +"@babel/plugin-transform-named-capturing-groups-regex@^7.6.3": version "7.6.3" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.3.tgz#aaa6e409dd4fb2e50b6e2a91f7e3a3149dbce0cf" integrity sha512-jTkk7/uE6H2s5w6VlMHeWuH+Pcy2lmdwFoeWCVnvIrDUnB5gQqTVI8WfmEAhF2CDEarGrknZcmSFg1+bkfCoSw== @@ -766,7 +875,15 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-typescript@^7.3.2", "@babel/plugin-transform-typescript@^7.6.0": +"@babel/plugin-transform-typescript@^7.3.2": + version "7.4.0" + resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.4.0.tgz#0389ec53a34e80f99f708c4ca311181449a68eb1" + integrity sha512-U7/+zKnRZg04ggM/Bm+xmu2B/PrwyDQTT/V89FXWYWNMxBDwSx56u6jtk9SEbfLFbZaEI72L+5LPvQjeZgFCrQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-syntax-typescript" "^7.2.0" + +"@babel/plugin-transform-typescript@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.6.0.tgz#48d78405f1aa856ebeea7288a48a19ed8da377a6" integrity sha512-yzw7EopOOr6saONZ3KA3lpizKnWRTe+rfBqg4AmQbSow7ik7fqmzrfIqt053osLwLE2AaTqGinLM2tl6+M/uog== @@ -847,10 +964,10 @@ js-levenshtein "^1.1.3" semver "^5.5.0" -"@babel/preset-env@7.6.0", "@babel/preset-env@^7.4.5": - version "7.6.0" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.0.tgz#aae4141c506100bb2bfaa4ac2a5c12b395619e50" - integrity sha512-1efzxFv/TcPsNXlRhMzRnkBFMeIqBBgzwmZwlFDw5Ubj0AGLeufxugirwZmkkX/ayi3owsSqoQ4fw8LkfK9SYg== +"@babel/preset-env@7.6.3": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.3.tgz#9e1bf05a2e2d687036d24c40e4639dc46cef2271" + integrity sha512-CWQkn7EVnwzlOdR5NOm2+pfgSNEZmvGjOhlCHBDq0J8/EStr+G+FvPEiz9B56dR6MoiUFjXhfE4hjLoAKKJtIQ== dependencies: "@babel/helper-module-imports" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" @@ -903,6 +1020,62 @@ js-levenshtein "^1.1.3" semver "^5.5.0" +"@babel/preset-env@^7.4.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.5.5.tgz#bc470b53acaa48df4b8db24a570d6da1fef53c9a" + integrity sha512-GMZQka/+INwsMz1A5UEql8tG015h5j/qjptpKY2gJ7giy8ohzU710YciJB5rcKsWGWHiW3RUnHib0E5/m3Tp3A== + dependencies: + "@babel/helper-module-imports" "^7.0.0" + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-proposal-async-generator-functions" "^7.2.0" + "@babel/plugin-proposal-dynamic-import" "^7.5.0" + "@babel/plugin-proposal-json-strings" "^7.2.0" + "@babel/plugin-proposal-object-rest-spread" "^7.5.5" + "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" + "@babel/plugin-proposal-unicode-property-regex" "^7.4.4" + "@babel/plugin-syntax-async-generators" "^7.2.0" + "@babel/plugin-syntax-dynamic-import" "^7.2.0" + "@babel/plugin-syntax-json-strings" "^7.2.0" + "@babel/plugin-syntax-object-rest-spread" "^7.2.0" + "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" + "@babel/plugin-transform-arrow-functions" "^7.2.0" + "@babel/plugin-transform-async-to-generator" "^7.5.0" + "@babel/plugin-transform-block-scoped-functions" "^7.2.0" + "@babel/plugin-transform-block-scoping" "^7.5.5" + "@babel/plugin-transform-classes" "^7.5.5" + "@babel/plugin-transform-computed-properties" "^7.2.0" + "@babel/plugin-transform-destructuring" "^7.5.0" + "@babel/plugin-transform-dotall-regex" "^7.4.4" + "@babel/plugin-transform-duplicate-keys" "^7.5.0" + "@babel/plugin-transform-exponentiation-operator" "^7.2.0" + "@babel/plugin-transform-for-of" "^7.4.4" + "@babel/plugin-transform-function-name" "^7.4.4" + "@babel/plugin-transform-literals" "^7.2.0" + "@babel/plugin-transform-member-expression-literals" "^7.2.0" + "@babel/plugin-transform-modules-amd" "^7.5.0" + "@babel/plugin-transform-modules-commonjs" "^7.5.0" + "@babel/plugin-transform-modules-systemjs" "^7.5.0" + "@babel/plugin-transform-modules-umd" "^7.2.0" + "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.5" + "@babel/plugin-transform-new-target" "^7.4.4" + "@babel/plugin-transform-object-super" "^7.5.5" + "@babel/plugin-transform-parameters" "^7.4.4" + "@babel/plugin-transform-property-literals" "^7.2.0" + "@babel/plugin-transform-regenerator" "^7.4.5" + "@babel/plugin-transform-reserved-words" "^7.2.0" + "@babel/plugin-transform-shorthand-properties" "^7.2.0" + "@babel/plugin-transform-spread" "^7.2.0" + "@babel/plugin-transform-sticky-regex" "^7.2.0" + "@babel/plugin-transform-template-literals" "^7.4.4" + "@babel/plugin-transform-typeof-symbol" "^7.2.0" + "@babel/plugin-transform-unicode-regex" "^7.4.4" + "@babel/types" "^7.5.5" + browserslist "^4.6.0" + core-js-compat "^3.1.1" + invariant "^2.2.2" + js-levenshtein "^1.1.3" + semver "^5.5.0" + "@babel/preset-flow@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" @@ -970,7 +1143,16 @@ dependencies: regenerator-runtime "^0.13.2" -"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4", "@babel/template@^7.6.0": +"@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4": + version "7.4.4" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" + integrity sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.4.4" + "@babel/types" "^7.4.4" + +"@babel/template@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.6.0.tgz#7f0159c7f5012230dad64cca42ec9bdb5c9536e6" integrity sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ== @@ -979,7 +1161,37 @@ "@babel/parser" "^7.6.0" "@babel/types" "^7.6.0" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5", "@babel/traverse@^7.6.0", "@babel/traverse@^7.6.2": +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.5.5.tgz#f664f8f368ed32988cd648da9f72d5ca70f165bb" + integrity sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.5.5" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.5.5" + "@babel/types" "^7.5.5" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + +"@babel/traverse@^7.6.2": + version "7.6.2" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.2.tgz#b0e2bfd401d339ce0e6c05690206d1e11502ce2c" + integrity sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ== + dependencies: + "@babel/code-frame" "^7.5.5" + "@babel/generator" "^7.6.2" + "@babel/helper-function-name" "^7.1.0" + "@babel/helper-split-export-declaration" "^7.4.4" + "@babel/parser" "^7.6.2" + "@babel/types" "^7.6.0" + debug "^4.1.0" + globals "^11.1.0" + lodash "^4.17.13" + +"@babel/traverse@^7.6.3": version "7.6.3" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.3.tgz#66d7dba146b086703c0fb10dd588b7364cec47f9" integrity sha512-unn7P4LGsijIxaAJo/wpoU11zN+2IaClkQAxcJWBNCMS6cmVh802IyLHNkAjQ0iYnRS3nnxk5O3fuXW28IMxTw== @@ -994,10 +1206,19 @@ globals "^11.1.0" lodash "^4.17.13" -"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5", "@babel/types@^7.6.0", "@babel/types@^7.6.3": - version "7.6.3" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.3.tgz#3f07d96f854f98e2fbd45c64b0cb942d11e8ba09" - integrity sha512-CqbcpTxMcpuQTMhjI37ZHVgjBkysg5icREQIEZ0eG1yCNwg3oy+5AaLiOKmjsCj6nqOsa6Hf0ObjRVwokb7srA== +"@babel/types@^7.0.0", "@babel/types@^7.2.0", "@babel/types@^7.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4", "@babel/types@^7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.5.5.tgz#97b9f728e182785909aa4ab56264f090a028d18a" + integrity sha512-s63F9nJioLqOlW3UkyMd+BYhXt44YuaFm/VV0VwuteqjYwRrObkU7ra9pY4wAJR3oXi8hJrMcrcJdO/HH33vtw== + dependencies: + esutils "^2.0.2" + lodash "^4.17.13" + to-fast-properties "^2.0.0" + +"@babel/types@^7.6.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.6.0.tgz#1b5eaad0736e963bd2c6cf7911a53c84a7b35c08" + integrity sha512-+wLIp3XW60cvkZP/pvKMM85qoJbx7Hn3tNUpkGBLsGaSEYRz8Ut389/UsSa+wSBwSchtsLJm5IsqlA5sXawqew== dependencies: esutils "^2.0.2" lodash "^4.17.13" @@ -2119,15 +2340,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@>=16.9.0": - version "16.9.5" - resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.5.tgz#079dabd918b19b32118c25fd00a786bb6d0d5e51" - integrity sha512-jQ12VMiFOWYlp+j66dghOWcmDDwhca0bnlcTxS4Qz/fh5gi6wpaZDthPEu/Gc/YlAuO87vbiUXL8qKstFvuOaA== - dependencies: - "@types/prop-types" "*" - csstype "^2.2.0" - -"@types/react@16.9.2": +"@types/react@*", "@types/react@16.9.2": version "16.9.2" resolved "https://registry.yarnpkg.com/@types/react/-/react-16.9.2.tgz#6d1765431a1ad1877979013906731aae373de268" integrity sha512-jYP2LWwlh+FTqGd9v7ynUKZzjj98T8x7Yclz479QdRhHfuW9yQ+0jjnD31eXSXutmBpppj5PYNLYLRfnZJvcfg== @@ -10375,10 +10588,10 @@ react-inspector@^3.0.2: is-dom "^1.0.9" prop-types "^15.6.1" -react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.9.0: - version "16.10.2" - resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.2.tgz#984120fd4d16800e9a738208ab1fba422d23b5ab" - integrity sha512-INBT1QEgtcCCgvccr5/86CfD71fw9EPmDxgiJX4I2Ddr6ZsV6iFXsuby+qWJPtmNuMY0zByTsG4468P7nHuNWA== +react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4: + version "16.9.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb" + integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw== react-is@^16.8.6: version "16.10.0" @@ -10761,10 +10974,10 @@ refractor@^2.4.1: parse-entities "^1.1.2" prismjs "~1.15.0" -regenerate-unicode-properties@^8.0.2, regenerate-unicode-properties@^8.1.0: - version "8.1.0" - resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" - integrity sha512-LGZzkgtLY79GeXLm8Dp0BVLdQlWICzBnJz/ipWUgo59qBaZ+BHtq51P2q1uVZlppMuUAT37SDk39qUbjTWB7bA== +regenerate-unicode-properties@^8.0.2: + version "8.0.2" + resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.0.2.tgz#7b38faa296252376d363558cfbda90c9ce709662" + integrity sha512-SbA/iNrBUf6Pv2zU8Ekv1Qbhv92yxL4hiDa2siuxs4KKn4oOoMDHXjAf7+Nz9qinUQ46B1LcWEi/PhJfPWpZWQ== dependencies: regenerate "^1.4.0" @@ -10827,13 +11040,13 @@ regexp.prototype.flags@^1.2.0: dependencies: define-properties "^1.1.2" -regexpu-core@^4.5.4, regexpu-core@^4.6.0: - version "4.6.0" - resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.6.0.tgz#2037c18b327cfce8a6fea2a4ec441f2432afb8b6" - integrity sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg== +regexpu-core@^4.5.4: + version "4.5.4" + resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.5.4.tgz#080d9d02289aa87fe1667a4f5136bc98a6aebaae" + integrity sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ== dependencies: regenerate "^1.4.0" - regenerate-unicode-properties "^8.1.0" + regenerate-unicode-properties "^8.0.2" regjsgen "^0.5.0" regjsparser "^0.6.0" unicode-match-property-ecmascript "^1.0.4" @@ -11116,13 +11329,20 @@ run-queue@^1.0.0, run-queue@^1.0.3: dependencies: aproba "^1.1.1" -rxjs@6.5.3, rxjs@^6.3.3, rxjs@^6.4.0: +rxjs@6.5.3: version "6.5.3" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.3.tgz#510e26317f4db91a7eb1de77d9dd9ba0a4899a3a" integrity sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA== dependencies: tslib "^1.9.0" +rxjs@^6.3.3, rxjs@^6.4.0: + version "6.5.2" + resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-6.5.2.tgz#2e35ce815cd46d84d02a209fb4e5921e051dbec7" + integrity sha512-HUb7j3kvb7p7eCUHE3FqjoDsC1xfZQ4AHFWfTKSpZ+sAhhz5X1WX0ZuUqWbzB2QhSLp3DoLUG+hMdEDKqWo2Zg== + dependencies: + tslib "^1.9.0" + safe-buffer@5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" @@ -11190,10 +11410,10 @@ schema-utils@^1.0.0: ajv-errors "^1.0.0" ajv-keywords "^3.1.0" -screenfull@^4.1.0: - version "4.2.1" - resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-4.2.1.tgz#3245b7bc73d2b7c9a15bd8caaf6965db7cbc7f04" - integrity sha512-PLSp6f5XdhvjCCCO8OjavRfzkSGL3Qmdm7P82bxyU8HDDDBhDV3UckRaYcRa/NDNTYt8YBpzjoLWHUAejmOjLg== +screenfull@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-5.0.0.tgz#5c2010c0e84fd4157bf852877698f90b8cbe96f6" + integrity sha512-yShzhaIoE9OtOhWVyBBffA6V98CDCoyHTsp8228blmqYy1Z5bddzE/4FPiJKlr8DVR4VBiiUyfPzIQPIYDkeMA== scrollbarwidth@^0.1.3: version "0.1.3" @@ -12387,12 +12607,12 @@ ts-pnp@^1.1.2: resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.1.2.tgz#be8e4bfce5d00f0f58e0666a82260c34a57af552" integrity sha512-f5Knjh7XCyRIzoC/z1Su1yLLRrPrFCgtUAh/9fCSP6NKbATwpOL1+idQVXQokK9GRFURn/jYPGPfegIctwunoA== -tslib@1.9.0: +tslib@1.9.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" integrity sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ== -tslib@^1.10.0, tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.0: +tslib@^1.10.0, tslib@^1.9.3: version "1.10.0" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.10.0.tgz#c3c19f95973fb0a62973fb09d90d961ee43e5c8a" integrity sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ== @@ -13195,4 +13415,3 @@ yn@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/yn/-/yn-3.0.0.tgz#0073c6b56e92aed652fbdfd62431f2d6b9a7a091" integrity sha512-+Wo/p5VRfxUgBUGy2j/6KX2mj9AYJWOHuhMjMcbBFc3y54o9/4buK1ksBvuiK01C3kby8DH9lSmJdSxw+4G/2Q== - From 100a340fbbb3b3a7ed70b66acd5c2a37c2d1d8bb Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 14 Oct 2019 19:28:43 +0000 Subject: [PATCH 068/162] Update dependency @types/jest to v24.0.19 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 82941fbf6d..30df5e0524 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "@storybook/addon-options": "5.1.11", "@storybook/react": "5.1.11", "@testing-library/react-hooks": "2.0.3", - "@types/jest": "24.0.18", + "@types/jest": "24.0.19", "@types/react": "16.9.2", "babel-core": "6.26.3", "babel-loader": "8.0.6", diff --git a/yarn.lock b/yarn.lock index 58f934c09c..0fb8905df9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2289,10 +2289,10 @@ resolved "https://registry.yarnpkg.com/@types/jest-diff/-/jest-diff-20.0.1.tgz#35cc15b9c4f30a18ef21852e255fdb02f6d59b89" integrity sha512-yALhelO3i0hqZwhjtcr6dYyaLoCHbAMshwtj6cGxTvHZAKXHsYGdff6E8EPw3xLKY0ELUTQ69Q1rQiJENnccMA== -"@types/jest@24.0.18": - version "24.0.18" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.18.tgz#9c7858d450c59e2164a8a9df0905fc5091944498" - integrity sha512-jcDDXdjTcrQzdN06+TSVsPPqxvsZA/5QkYfIZlq1JMw7FdP5AZylbOc+6B/cuDurctRe+MziUMtQ3xQdrbjqyQ== +"@types/jest@24.0.19": + version "24.0.19" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-24.0.19.tgz#f7036058d2a5844fe922609187c0ad8be430aff5" + integrity sha512-YYiqfSjocv7lk5H/T+v5MjATYjaTMsUkbDnjGqSMoO88jWdtJXJV4ST/7DKZcoMHMBvB2SeSfyOzZfkxXHR5xg== dependencies: "@types/jest-diff" "*" From 695faa5f9775009ae9652d7e292a6eef5e75681b Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 15 Oct 2019 01:50:31 +0000 Subject: [PATCH 069/162] Update Node.js to v12.12.0 --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b56cb85850..1dd2e5f6bd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2 refs: container: &container docker: - - image: node:12.11.1 + - image: node:12.12.0 working_directory: ~/repo steps: - &Versions From 9e4ad43be9d40545dc7523a27e0f2d5e71fd1bce Mon Sep 17 00:00:00 2001 From: Ward Date: Tue, 15 Oct 2019 22:03:08 +1100 Subject: [PATCH 070/162] docs: add contributing guidelines (#679) --- CONTRIBUTING.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000000..eb54c7398f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,60 @@ +# Contributing + +Thanks for being willing to contribute 🙌 If you contribute to this project, you agree to release your work under the license of this project. + +**Working on your first Pull Request?** You can learn how from this [First Contributions](https://github.com/firstcontributions/first-contributions) guide. + +## Project setup + +1. Fork and clone the repo +1. Run `yarn install` to install dependencies +1. Create a branch for your PR with `git checkout -b pr/your-branch-name` + +> Tip: Keep your `master` branch pointing at the original repository and make +> pull requests from branches on your fork. To do this, run: +> +> ```sh +> git remote add upstream https://github.com/streamich/react-use.git +> git fetch upstream +> git branch --set-upstream-to=upstream/master master +> ``` +> +> This will add the original repository as a "remote" called "upstream," Then +> fetch the git information from that remote, then set your local `master` +> branch to use the upstream master branch whenever you run `git pull`. Then you +> can make all of your pull request branches based on this `master` branch. +> Whenever you want to update your version of `master`, do a regular `git pull`. + +## Development + +This library is a collection of React hooks so a proposal for a new hook will need to utilize the [React Hooks API](https://reactjs.org/docs/hooks-reference.html) internally to be taken into consideration. + +### Creating a new hook + +1. Create `src/useYourHookName.ts` and `src/__stories__/useYourHookName.story.tsx`, run `yarn start` to start the storybook development server and start coding your hook +1. Create `src/__tests__/useYourHookName.test.ts`, run `yarn test:watch` to start the test runner in watch mode and start writing tests for your hook +1. Create `src/docs/useYourHookName.md` and create documentation for your hook +1. Export your hook from `src/index.ts` and add your hook to `README.md` + +You can also write your tests first if you prefer [test-driven development](https://en.wikipedia.org/wiki/Test-driven_development). + +### Updating an existing hook + +1. Run `yarn start` to start the storybook development server and start applying changes +2. Update tests according to your changes using `yarn test:watch` +3. Update documentation according to your changes + +## Committing and Pushing changes + +### Commit messages + +This repo uses [Angular-style semantic commits](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#type) so prefix your commits with `fix:` or `feat:` if you want your changes to appear in [release notes](https://github.com/streamich/react-use/blob/master/CHANGELOG.md). + +### Git hooks + +There are git hooks set up with this project that are automatically enabled +when you install dependencies. These hooks automatically test and validate your code when creating commits. They're really handy but can be temporarily disabled by adding a `--no-verify` flag to your commit command. This is useful when you want to commit and push some uncompleted code. + +## Help needed + +Please have a look at the [open issues](https://github.com/streamich/react-use/issues) and respond to questions, bug reports and feature requests. Thanks! From 1fa104506ed9c6eed9de5dc2f2117c58716fbb3c Mon Sep 17 00:00:00 2001 From: Ward Date: Wed, 16 Oct 2019 20:10:10 +1100 Subject: [PATCH 071/162] docs: code coverage (#682) --- CONTRIBUTING.md | 6 ++++-- package.json | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eb54c7398f..1664243297 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,13 +48,15 @@ You can also write your tests first if you prefer [test-driven development](http ### Commit messages -This repo uses [Angular-style semantic commits](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#type) so prefix your commits with `fix:` or `feat:` if you want your changes to appear in [release notes](https://github.com/streamich/react-use/blob/master/CHANGELOG.md). +This repo uses [semantic-release](https://github.com/semantic-release/semantic-release) and [conventional commit messages](https://conventionalcommits.org) so prefix your commits with `fix:` or `feat:` if you want your changes to appear in [release notes](https://github.com/streamich/react-use/blob/master/CHANGELOG.md). ### Git hooks There are git hooks set up with this project that are automatically enabled -when you install dependencies. These hooks automatically test and validate your code when creating commits. They're really handy but can be temporarily disabled by adding a `--no-verify` flag to your commit command. This is useful when you want to commit and push some uncompleted code. +when you install dependencies. These hooks automatically test and validate your code when creating commits. They're really handy but can be temporarily disabled by adding a `--no-verify` flag to your commit command. This is useful when you want to commit and push to get feedback on uncompleted code. ## Help needed Please have a look at the [open issues](https://github.com/streamich/react-use/issues) and respond to questions, bug reports and feature requests. Thanks! + +We're also looking to improve the code coverage on this project. To easily know what hooks need tests run `yarn test:coverage` to generate a code coverage report. You can see the report in your terminal or open `coverage/lcov-report/index.html` to see the HTML report. diff --git a/package.json b/package.json index 30df5e0524..a8e150f290 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "start": "yarn storybook", "test": "jest", "test:watch": "jest --watch", + "test:coverage": "jest --coverage", "lint": "tslint 'src/**/*.{ts,tsx}' -t verbose", "lint:fix": "yarn lint --fix", "lint:types": "tsc --noEmit", From ae2698891be952f45d2ea9af0027497d1030f0ae Mon Sep 17 00:00:00 2001 From: xobotyi Date: Wed, 16 Oct 2019 12:14:41 +0300 Subject: [PATCH 072/162] feat: useMultiStateValidator --- README.md | 1 + docs/useMultiStateValidator.md | 55 ++++++++ .../useMultiStateValidator.story.tsx | 51 +++++++ src/__tests__/useMultiStateValidator.ts | 125 ++++++++++++++++++ src/index.ts | 1 + src/useMultiStateValidator.ts | 41 ++++++ 6 files changed, 274 insertions(+) create mode 100644 docs/useMultiStateValidator.md create mode 100644 src/__stories__/useMultiStateValidator.story.tsx create mode 100644 src/__tests__/useMultiStateValidator.ts create mode 100644 src/useMultiStateValidator.ts diff --git a/README.md b/README.md index ebe6c734db..33f88b1bcd 100644 --- a/README.md +++ b/README.md @@ -135,6 +135,7 @@ - [`useList`](./docs/useList.md) and [`useUpsert`](./docs/useUpsert.md) — tracks state of an array. [![][img-demo]](https://codesandbox.io/s/wonderful-mahavira-1sm0w) - [`useMap`](./docs/useMap.md) — tracks state of an object. [![][img-demo]](https://codesandbox.io/s/quirky-dewdney-gi161) - [`useStateValidator`](./docs/useStateValidator.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usestatevalidator--demo) + - [`useMultiStateValidator`](./docs/useMultiStateValidator.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usemultistatevalidator--demo)

diff --git a/docs/useMultiStateValidator.md b/docs/useMultiStateValidator.md new file mode 100644 index 0000000000..42de5b1e88 --- /dev/null +++ b/docs/useMultiStateValidator.md @@ -0,0 +1,55 @@ +# `useMultiStateValidator` + +Each time any of given states changes - validator function is invoked. + +## Usage +```ts +import * as React from 'react'; +import { useMultiStateValidator } from 'react-use'; + +const DemoStateValidator = (s: number[]) => [s.every((num: number) => !(num % 2))] as [boolean]; +const Demo = () => { + const [state1, setState1] = React.useState(1); + const [state2, setState2] = React.useState(1); + const [state3, setState3] = React.useState(1); + const [[isValid]] = useMultiStateValidator([state1, state2, state3], DemoStateValidator); + + return ( +
+
Below fields will be valid if all of them is even
+ ) => { + setState1((ev.target.value as unknown) as number); + }} + /> + ) => { + setState2((ev.target.value as unknown) as number); + }} + /> + ) => { + setState3((ev.target.value as unknown) as number); + }} + /> + {isValid !== null && {isValid ? 'Valid!' : 'Invalid'}} +
+ ); +}; +``` + +## Reference +```ts +const [validity, revalidate] = useStateValidator( + state: any[] | { [p: string]: any } | { [p: number]: any }, + validator: (state, setValidity?)=>[boolean|null, ...any[]], + initialValidity: any = [undefined] +); +``` +- **`state`**_`: any[] | { [p: string]: any } | { [p: number]: any }`_ can be both an array or object. It's _values_ will be used as a deps for inner `useEffect`. +- **`validity`**_`: [boolean|null, ...any[]]`_ result of validity check. First element is strictly nullable boolean, but others can contain arbitrary data; +- **`revalidate`**_`: ()=>void`_ runs validator once again +- **`validator`**_`: (state, setValidity?)=>[boolean|null, ...any[]]`_ should return an array suitable for validity state described above; + - `states` - current states values as the've been passed to the hook; + - `setValidity` - if defined hook will not trigger validity change automatically. Useful for async validators; +- `initialValidity` - validity value which set when validity is nt calculated yet; diff --git a/src/__stories__/useMultiStateValidator.story.tsx b/src/__stories__/useMultiStateValidator.story.tsx new file mode 100644 index 0000000000..91eb619401 --- /dev/null +++ b/src/__stories__/useMultiStateValidator.story.tsx @@ -0,0 +1,51 @@ +import { storiesOf } from '@storybook/react'; +import * as React from 'react'; +import { useMultiStateValidator } from '../'; +import ShowDocs from './util/ShowDocs'; + +const DemoStateValidator = (s: number[]) => [s.every((num: number) => !(num % 2))] as [boolean]; +const Demo = () => { + const [state1, setState1] = React.useState(1); + const [state2, setState2] = React.useState(1); + const [state3, setState3] = React.useState(1); + const [[isValid]] = useMultiStateValidator([state1, state2, state3], DemoStateValidator); + + return ( +
+
Below fields will be valid if all of them is even
+
+ ) => { + setState1((ev.target.value as unknown) as number); + }} + /> + ) => { + setState2((ev.target.value as unknown) as number); + }} + /> + ) => { + setState3((ev.target.value as unknown) as number); + }} + /> + {isValid !== null && {isValid ? 'Valid!' : 'Invalid'}} +
+ ); +}; + +storiesOf('State|useMultiStateValidator', module) + .add('Docs', () => ) + .add('Demo', () => ); diff --git a/src/__tests__/useMultiStateValidator.ts b/src/__tests__/useMultiStateValidator.ts new file mode 100644 index 0000000000..392af53d1d --- /dev/null +++ b/src/__tests__/useMultiStateValidator.ts @@ -0,0 +1,125 @@ +import { act, renderHook, RenderHookResult } from '@testing-library/react-hooks'; +import { useState } from 'react'; +import { MultiStateValidator, useMultiStateValidator } from '../useMultiStateValidator'; +import { UseValidatorReturn, ValidityState } from '../useStateValidator'; + +interface Mock extends jest.Mock {} + +describe('useMultiStateValidator', () => { + it('should be defined', () => { + expect(useMultiStateValidator).toBeDefined(); + }); + + const defaultStatesValidator = (states: number[]) => [states.every(num => !(num % 2))]; + + function getHook( + fn: MultiStateValidator = jest.fn(defaultStatesValidator), + initialStates = [1, 2], + initialValidity = [false] + ): [MultiStateValidator, RenderHookResult]>] { + return [ + fn, + renderHook( + ({ initStates, validator, initValidity }) => { + const [states, setStates] = useState(initStates); + + return [setStates, useMultiStateValidator(states, validator, initValidity)]; + }, + { + initialProps: { + initStates: initialStates, + initValidity: initialValidity, + validator: fn, + }, + } + ), + ]; + } + + it('should return an array of two elements', () => { + const [, hook] = getHook(); + const res = hook.result.current[1]; + + expect(Array.isArray(res)).toBe(true); + expect(res.length).toBe(2); + }); + + it('should call validator on init', () => { + const [spy] = getHook(); + + expect(spy).toHaveBeenCalledTimes(1); + }); + + it('should call validator on any of states changed', () => { + const [spy, hook] = getHook(); + + expect(spy).toHaveBeenCalledTimes(1); + act(() => hook.result.current[0]([4, 2])); + expect(spy).toHaveBeenCalledTimes(2); + }); + + it("should NOT call validator on it's change", () => { + const [spy, hook] = getHook(); + const newValidator: MultiStateValidator = jest.fn(states => [states!.every(num => !!(num % 2))]); + + expect(spy).toHaveBeenCalledTimes(1); + hook.rerender({ validator: newValidator }); + expect(spy).toHaveBeenCalledTimes(1); + }); + + it('should throw if states is not an object', () => { + try { + // @ts-ignore + getHook(defaultStatesValidator, 123); + } catch (err) { + expect(err).toBeDefined(); + expect(err instanceof Error).toBe(true); + expect(err.message).toBe('states expected to be an object or array, got number'); + } + }); + + it('first returned element should represent current validity state', () => { + const [, hook] = getHook(); + let [setState, [validity]] = hook.result.current; + expect(validity).toEqual([false]); + + act(() => setState([4, 2])); + [setState, [validity]] = hook.result.current; + expect(validity).toEqual([true]); + + act(() => setState([4, 5])); + [setState, [validity]] = hook.result.current; + expect(validity).toEqual([false]); + }); + + it('second returned element should re-call validation', () => { + const [spy, hook] = getHook(); + const [, [, revalidate]] = hook.result.current; + + expect(spy).toHaveBeenCalledTimes(1); + act(() => revalidate()); + expect(spy).toHaveBeenCalledTimes(2); + }); + + it('validator should receive states as a firs argument', () => { + const [spy, hook] = getHook(); + const [setState] = hook.result.current; + + expect((spy as Mock).mock.calls[0].length).toBe(1); + expect((spy as Mock).mock.calls[0][0]).toEqual([1, 2]); + act(() => setState([4, 6])); + expect((spy as Mock).mock.calls[1][0]).toEqual([4, 6]); + }); + + it('if validator expects 2nd parameters it should pass a validity setter there', () => { + const spy = (jest.fn((states: number[], done) => { + done([states.every(num => !!(num % 2))]); + }) as unknown) as MultiStateValidator; + const [, hook] = getHook(spy, [1, 3]); + const [, [validity]] = hook.result.current; + + expect((spy as Mock).mock.calls[0].length).toBe(2); + expect((spy as Mock).mock.calls[0][0]).toEqual([1, 3]); + expect(validity).toEqual([true]); + }); +}); diff --git a/src/index.ts b/src/index.ts index 65872134d6..69a7deefc8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -88,6 +88,7 @@ export { default as useUpdateEffect } from './useUpdateEffect'; export { default as useUpsert } from './useUpsert'; export { default as useVideo } from './useVideo'; export { default as useStateValidator } from './useStateValidator'; +export { useMultiStateValidator } from './useMultiStateValidator'; export { useWait, Waiter } from './useWait'; export { default as useWindowScroll } from './useWindowScroll'; export { default as useWindowSize } from './useWindowSize'; diff --git a/src/useMultiStateValidator.ts b/src/useMultiStateValidator.ts new file mode 100644 index 0000000000..19ed9f2108 --- /dev/null +++ b/src/useMultiStateValidator.ts @@ -0,0 +1,41 @@ +import { useCallback, useEffect, useRef, useState } from 'react'; +import { DispatchValidity, UseValidatorReturn, ValidityState } from './useStateValidator'; + +export type MultiStateValidatorStates = any[] | { [p: string]: any } | { [p: number]: any }; + +export interface MultiStateValidator< + V extends ValidityState = ValidityState, + S extends MultiStateValidatorStates = MultiStateValidatorStates +> { + (states: S): V; + + (states: S, done: DispatchValidity): void; +} + +export function useMultiStateValidator< + V extends ValidityState = ValidityState, + S extends MultiStateValidatorStates = MultiStateValidatorStates +>(states: S, validator: MultiStateValidator, initialValidity: V = [undefined] as V): UseValidatorReturn { + if (typeof states !== 'object') { + throw Error('states expected to be an object or array, got ' + typeof states); + } + + const validatorFn = useRef(validator); + + const [validity, setValidity] = useState(initialValidity); + + const deps = Array.isArray(states) ? states : Object.values(states); + const validate = useCallback(() => { + if (validatorFn.current.length === 2) { + validatorFn.current(states, setValidity); + } else { + setValidity(validatorFn.current(states)); + } + }, deps); + + useEffect(() => { + validate(); + }, deps); + + return [validity, validate]; +} From 8c7f7f5b729bce9be1f41096324517b8fc630666 Mon Sep 17 00:00:00 2001 From: xobotyi Date: Wed, 16 Oct 2019 14:32:11 +0300 Subject: [PATCH 073/162] fix: useMultiStateValidator readme description; --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 33f88b1bcd..14541732d2 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ - [`useList`](./docs/useList.md) and [`useUpsert`](./docs/useUpsert.md) — tracks state of an array. [![][img-demo]](https://codesandbox.io/s/wonderful-mahavira-1sm0w) - [`useMap`](./docs/useMap.md) — tracks state of an object. [![][img-demo]](https://codesandbox.io/s/quirky-dewdney-gi161) - [`useStateValidator`](./docs/useStateValidator.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usestatevalidator--demo) - - [`useMultiStateValidator`](./docs/useMultiStateValidator.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usemultistatevalidator--demo) + - [`useMultiStateValidator`](./docs/useMultiStateValidator.md) — alike the `useStateValidator`, but tracks multiple states at a time. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usemultistatevalidator--demo)

From 652b31890560becc38d9feadb57afea14360291b Mon Sep 17 00:00:00 2001 From: xobotyi Date: Wed, 16 Oct 2019 12:21:56 +0300 Subject: [PATCH 074/162] fix: rename story's mediator and add `g` flag to it's regex; fix: typo in readme; --- README.md | 2 +- src/__stories__/useMediatedState.story.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 502864511c..e3b9393c48 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ - [`useList`](./docs/useList.md) and [`useUpsert`](./docs/useUpsert.md) — tracks state of an array. [![][img-demo]](https://codesandbox.io/s/wonderful-mahavira-1sm0w) - [`useMap`](./docs/useMap.md) — tracks state of an object. [![][img-demo]](https://codesandbox.io/s/quirky-dewdney-gi161) - [`useStateValidator`](./docs/useStateValidator.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usestatevalidator--demo) - - [`useMedisatedState`](./docs/useMediatedState.md) — like the regular `useState` but with mediation by custom function. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usemediatedstate--demo) + - [`useMediatedState`](./docs/useMediatedState.md) — like the regular `useState` but with mediation by custom function. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usemediatedstate--demo)

diff --git a/src/__stories__/useMediatedState.story.tsx b/src/__stories__/useMediatedState.story.tsx index d3c946f6dd..96ee1a13e5 100644 --- a/src/__stories__/useMediatedState.story.tsx +++ b/src/__stories__/useMediatedState.story.tsx @@ -3,9 +3,9 @@ import * as React from 'react'; import { useMediatedState } from '../useMediatedState'; import ShowDocs from './util/ShowDocs'; -const InputMediator = s => s.replace(/[\s]+/, ' '); +const inputMediator = s => s.replace(/[\s]+/g, ' '); const Demo = () => { - const [state, setState] = useMediatedState(InputMediator, ''); + const [state, setState] = useMediatedState(inputMediator, ''); return (
From 00816a4ed04ae2ffa62b7e41651995ab24b1632a Mon Sep 17 00:00:00 2001 From: Ward Date: Wed, 16 Oct 2019 23:05:50 +1100 Subject: [PATCH 075/162] feat: useRafState (#684) --- README.md | 1 + docs/useRafState.md | 33 +++++++++++ src/__stories__/useRafState.story.tsx | 31 ++++++++++ src/__tests__/useRafState.test.ts | 83 +++++++++++++++++++++++++++ src/index.ts | 2 + src/useMouse.ts | 46 +++++++-------- src/useRafState.ts | 24 ++++++++ src/useScroll.ts | 27 ++++----- src/useWindowScroll.ts | 17 +++--- src/useWindowSize.ts | 19 +++--- 10 files changed, 219 insertions(+), 64 deletions(-) create mode 100644 docs/useRafState.md create mode 100644 src/__stories__/useRafState.story.tsx create mode 100644 src/__tests__/useRafState.test.ts create mode 100644 src/useRafState.ts diff --git a/README.md b/README.md index ebe6c734db..81e66d329e 100644 --- a/README.md +++ b/README.md @@ -128,6 +128,7 @@ - [`useGetSetState`](./docs/useGetSetState.md) — as if [`useGetSet`](./docs/useGetSet.md) and [`useSetState`](./docs/useSetState.md) had a baby. - [`usePrevious`](./docs/usePrevious.md) — returns the previous state or props. [![][img-demo]](https://codesandbox.io/s/fervent-galileo-krgx6) - [`useObservable`](./docs/useObservable.md) — tracks latest value of an `Observable`. + - [`useRafState`](./docs/useRafState.md) — creates `setState` method which only updates after `requestAnimationFrame`. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-userafstate--demo) - [`useSetState`](./docs/useSetState.md) — creates `setState` method which works like `this.setState`. [![][img-demo]](https://codesandbox.io/s/n75zqn1xp0) - [`useStateList`](./docs/useStateList.md) — circularly iterates over an array. [![][img-demo]](https://codesandbox.io/s/bold-dewdney-pjzkd) - [`useToggle` and `useBoolean`](./docs/useToggle.md) — tracks state of a boolean. [![][img-demo]](https://codesandbox.io/s/focused-sammet-brw2d) diff --git a/docs/useRafState.md b/docs/useRafState.md new file mode 100644 index 0000000000..7740724bb3 --- /dev/null +++ b/docs/useRafState.md @@ -0,0 +1,33 @@ +# `useRafState` + +React state hook that only updates state in the callback of [`requestAnimationFrame`](https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame). + +## Usage + +```jsx +import {useRafState, useMount} from 'react-use'; + +const Demo = () => { + const [state, setState] = useRafState({ + width: 0, + height: 0, + }); + + useMount(() => { + const onResize = () => { + setState({ + width: window.clientWidth, + height: window.height, + }); + }; + + window.addEventListener('resize', onResize); + + return () => { + window.removeEventListener('resize', onResize); + }; + }); + + return
{JSON.stringify(state, null, 2)}
; +}; +``` diff --git a/src/__stories__/useRafState.story.tsx b/src/__stories__/useRafState.story.tsx new file mode 100644 index 0000000000..1b03585973 --- /dev/null +++ b/src/__stories__/useRafState.story.tsx @@ -0,0 +1,31 @@ +import { storiesOf } from '@storybook/react'; +import * as React from 'react'; +import { useRafState, useMount } from '..'; +import ShowDocs from './util/ShowDocs'; + +const Demo = () => { + const [state, setState] = useRafState({ x: 0, y: 0 }); + + useMount(() => { + const onMouseMove = (event: MouseEvent) => { + setState({ x: event.clientX, y: event.clientY }); + }; + const onTouchMove = (event: TouchEvent) => { + setState({ x: event.changedTouches[0].clientX, y: event.changedTouches[0].clientY }); + }; + + document.addEventListener('mousemove', onMouseMove); + document.addEventListener('touchmove', onTouchMove); + + return () => { + document.removeEventListener('mousemove', onMouseMove); + document.removeEventListener('touchmove', onTouchMove); + }; + }); + + return
{JSON.stringify(state, null, 2)}
; +}; + +storiesOf('State|useRafState', module) + .add('Docs', () => ) + .add('Demo', () => ); diff --git a/src/__tests__/useRafState.test.ts b/src/__tests__/useRafState.test.ts new file mode 100644 index 0000000000..bbc1a65183 --- /dev/null +++ b/src/__tests__/useRafState.test.ts @@ -0,0 +1,83 @@ +import { act, renderHook } from '@testing-library/react-hooks'; +import { replaceRaf } from 'raf-stub'; +import useRafState from '../useRafState'; + +interface RequestAnimationFrame { + reset(): void; + step(): void; +} + +declare var requestAnimationFrame: RequestAnimationFrame; + +replaceRaf(); + +beforeEach(() => { + requestAnimationFrame.reset(); +}); + +afterEach(() => { + requestAnimationFrame.reset(); +}); + +describe('useRafState', () => { + it('should be defined', () => { + expect(useRafState).toBeDefined(); + }); + + it('should only update state after requestAnimationFrame when providing an object', () => { + const { result } = renderHook(() => useRafState(0)); + + act(() => { + result.current[1](1); + }); + expect(result.current[0]).toBe(0); + + act(() => { + requestAnimationFrame.step(); + }); + expect(result.current[0]).toBe(1); + + act(() => { + result.current[1](2); + requestAnimationFrame.step(); + }); + expect(result.current[0]).toBe(2); + + act(() => { + result.current[1](prevState => prevState * 2); + requestAnimationFrame.step(); + }); + expect(result.current[0]).toBe(4); + }); + + it('should only update state after requestAnimationFrame when providing a function', () => { + const { result } = renderHook(() => useRafState(0)); + + act(() => { + result.current[1](prevState => prevState + 1); + }); + expect(result.current[0]).toBe(0); + + act(() => { + requestAnimationFrame.step(); + }); + expect(result.current[0]).toBe(1); + + act(() => { + result.current[1](prevState => prevState * 3); + requestAnimationFrame.step(); + }); + expect(result.current[0]).toBe(3); + }); + + it('should cancel update state on unmount', () => { + const { unmount } = renderHook(() => useRafState(0)); + const spyRafCancel = jest.spyOn(global, 'cancelAnimationFrame' as any); + + expect(spyRafCancel).not.toHaveBeenCalled(); + + unmount(); + + expect(spyRafCancel).toHaveBeenCalledTimes(1); + }); +}); diff --git a/src/index.ts b/src/index.ts index 65872134d6..f1057a3015 100644 --- a/src/index.ts +++ b/src/index.ts @@ -60,6 +60,8 @@ export { default as usePreviousDistinct } from './usePreviousDistinct'; export { default as usePromise } from './usePromise'; export { default as useRaf } from './useRaf'; export { default as useRafLoop } from './useRafLoop'; +export { default as useRafState } from './useRafState'; + /** * @deprecated This hook is obsolete, use `useMountedState` instead */ diff --git a/src/useMouse.ts b/src/useMouse.ts index 665a126ba0..3acb6ccc8d 100644 --- a/src/useMouse.ts +++ b/src/useMouse.ts @@ -1,4 +1,6 @@ -import { RefObject, useEffect, useRef, useState } from 'react'; +import { RefObject, useEffect } from 'react'; + +import useRafState from './useRafState'; export interface State { docX: number; @@ -18,8 +20,7 @@ const useMouse = (ref: RefObject): State => { } } - const frame = useRef(0); - const [state, setState] = useState({ + const [state, setState] = useRafState({ docX: 0, docY: 0, posX: 0, @@ -32,34 +33,29 @@ const useMouse = (ref: RefObject): State => { useEffect(() => { const moveHandler = (event: MouseEvent) => { - cancelAnimationFrame(frame.current); - - frame.current = requestAnimationFrame(() => { - if (ref && ref.current) { - const { left, top, width: elW, height: elH } = ref.current.getBoundingClientRect(); - const posX = left + window.pageXOffset; - const posY = top + window.pageYOffset; - const elX = event.pageX - posX; - const elY = event.pageY - posY; + if (ref && ref.current) { + const { left, top, width: elW, height: elH } = ref.current.getBoundingClientRect(); + const posX = left + window.pageXOffset; + const posY = top + window.pageYOffset; + const elX = event.pageX - posX; + const elY = event.pageY - posY; - setState({ - docX: event.pageX, - docY: event.pageY, - posX, - posY, - elX, - elY, - elH, - elW, - }); - } - }); + setState({ + docX: event.pageX, + docY: event.pageY, + posX, + posY, + elX, + elY, + elH, + elW, + }); + } }; document.addEventListener('mousemove', moveHandler); return () => { - cancelAnimationFrame(frame.current); document.removeEventListener('mousemove', moveHandler); }; }, [ref]); diff --git a/src/useRafState.ts b/src/useRafState.ts new file mode 100644 index 0000000000..f5732ff8a4 --- /dev/null +++ b/src/useRafState.ts @@ -0,0 +1,24 @@ +import { useRef, useState, useCallback, Dispatch, SetStateAction } from 'react'; + +import useUnmount from './useUnmount'; + +const useRafState = (initialState: S | (() => S)): [S, Dispatch>] => { + const frame = useRef(0); + const [state, setState] = useState(initialState); + + const setRafState = useCallback((value: S | ((prevState: S) => S)) => { + cancelAnimationFrame(frame.current); + + frame.current = requestAnimationFrame(() => { + setState(value); + }); + }, []); + + useUnmount(() => { + cancelAnimationFrame(frame.current); + }); + + return [state, setRafState]; +}; + +export default useRafState; diff --git a/src/useScroll.ts b/src/useScroll.ts index caf78f4990..f1805783b9 100644 --- a/src/useScroll.ts +++ b/src/useScroll.ts @@ -1,4 +1,6 @@ -import { RefObject, useEffect, useRef, useState } from 'react'; +import { RefObject, useEffect } from 'react'; + +import useRafState from './useRafState'; export interface State { x: number; @@ -12,24 +14,19 @@ const useScroll = (ref: RefObject): State => { } } - const frame = useRef(0); - const [state, setState] = useState({ + const [state, setState] = useRafState({ x: 0, y: 0, }); useEffect(() => { const handler = () => { - cancelAnimationFrame(frame.current); - - frame.current = requestAnimationFrame(() => { - if (ref.current) { - setState({ - x: ref.current.scrollLeft, - y: ref.current.scrollTop, - }); - } - }); + if (ref.current) { + setState({ + x: ref.current.scrollLeft, + y: ref.current.scrollTop, + }); + } }; if (ref.current) { @@ -40,10 +37,6 @@ const useScroll = (ref: RefObject): State => { } return () => { - if (frame.current) { - cancelAnimationFrame(frame.current); - } - if (ref.current) { ref.current.removeEventListener('scroll', handler); } diff --git a/src/useWindowScroll.ts b/src/useWindowScroll.ts index 218392adc1..82d6be1557 100644 --- a/src/useWindowScroll.ts +++ b/src/useWindowScroll.ts @@ -1,26 +1,24 @@ -import { useEffect, useRef, useState } from 'react'; +import { useEffect } from 'react'; import { isClient } from './util'; +import useRafState from './useRafState'; + export interface State { x: number; y: number; } const useWindowScroll = (): State => { - const frame = useRef(0); - const [state, setState] = useState({ + const [state, setState] = useRafState({ x: isClient ? window.pageXOffset : 0, y: isClient ? window.pageYOffset : 0, }); useEffect(() => { const handler = () => { - cancelAnimationFrame(frame.current); - frame.current = requestAnimationFrame(() => { - setState({ - x: window.pageXOffset, - y: window.pageYOffset, - }); + setState({ + x: window.pageXOffset, + y: window.pageYOffset, }); }; @@ -30,7 +28,6 @@ const useWindowScroll = (): State => { }); return () => { - cancelAnimationFrame(frame.current); window.removeEventListener('scroll', handler); }; }, []); diff --git a/src/useWindowSize.ts b/src/useWindowSize.ts index 3f081a6a79..e3021a08dd 100644 --- a/src/useWindowSize.ts +++ b/src/useWindowSize.ts @@ -1,9 +1,10 @@ -import { useRef, useEffect, useState } from 'react'; +import { useEffect } from 'react'; + +import useRafState from './useRafState'; import { isClient } from './util'; const useWindowSize = (initialWidth = Infinity, initialHeight = Infinity) => { - const frame = useRef(0); - const [state, setState] = useState<{ width: number; height: number }>({ + const [state, setState] = useRafState<{ width: number; height: number }>({ width: isClient ? window.innerWidth : initialWidth, height: isClient ? window.innerHeight : initialHeight, }); @@ -11,21 +12,15 @@ const useWindowSize = (initialWidth = Infinity, initialHeight = Infinity) => { useEffect(() => { if (isClient) { const handler = () => { - cancelAnimationFrame(frame.current); - - frame.current = requestAnimationFrame(() => { - setState({ - width: window.innerWidth, - height: window.innerHeight, - }); + setState({ + width: window.innerWidth, + height: window.innerHeight, }); }; window.addEventListener('resize', handler); return () => { - cancelAnimationFrame(frame.current); - window.removeEventListener('resize', handler); }; } else { From 7f54cad64248575366d6154ad7dff68905c17ec5 Mon Sep 17 00:00:00 2001 From: xobotyi Date: Wed, 16 Oct 2019 15:07:33 +0300 Subject: [PATCH 076/162] fix: example in the docs; --- docs/useMediatedState.md | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/docs/useMediatedState.md b/docs/useMediatedState.md index 34a5cdb590..0779a2e97d 100644 --- a/docs/useMediatedState.md +++ b/docs/useMediatedState.md @@ -7,21 +7,18 @@ A lot like the standard `useState`, but with mediation process. import * as React from 'react'; import { useMediatedState } from '../useMediatedState'; -const InputMediator = s => s.replace(/[\s]+/, ' '); +const inputMediator = s => s.replace(/[\s]+/g, ' '); const Demo = () => { - const [state, setState] = useMediatedState('', InputMediator); + const [state, setState] = useMediatedState(inputMediator, ''); return (
You will not be able to enter more than one space
- ) => { - setState(ev.target.value); - }} + ) => { + setState(ev.target.value); + }} />
); From 109c6c4b7ec7b85ab0936d385ada18b44a0db2d8 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 16 Oct 2019 12:07:50 +0000 Subject: [PATCH 077/162] chore(release): 12.6.0 [skip ci] # [12.6.0](https://github.com/streamich/react-use/compare/v12.5.0...v12.6.0) (2019-10-16) ### Features * useRafState ([#684](https://github.com/streamich/react-use/issues/684)) ([00816a4](https://github.com/streamich/react-use/commit/00816a4)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 611807673f..78784e127d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [12.6.0](https://github.com/streamich/react-use/compare/v12.5.0...v12.6.0) (2019-10-16) + + +### Features + +* useRafState ([#684](https://github.com/streamich/react-use/issues/684)) ([00816a4](https://github.com/streamich/react-use/commit/00816a4)) + # [12.5.0](https://github.com/streamich/react-use/compare/v12.4.0...v12.5.0) (2019-10-13) diff --git a/package.json b/package.json index a8e150f290..ee8f3a41d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.5.0", + "version": "12.6.0", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From b256bb2b5c9eed5a69f68c1e47f4b0438dd7d703 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 16 Oct 2019 20:09:21 +0000 Subject: [PATCH 078/162] chore(deps): update dependency @shopify/jest-dom-mocks to v2.8.3 --- package.json | 2 +- yarn.lock | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index ee8f3a41d2..b502f85017 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@semantic-release/changelog": "3.0.4", "@semantic-release/git": "7.0.16", "@semantic-release/npm": "5.1.13", - "@shopify/jest-dom-mocks": "2.8.2", + "@shopify/jest-dom-mocks": "2.8.3", "@storybook/addon-actions": "5.1.11", "@storybook/addon-knobs": "5.1.11", "@storybook/addon-notes": "5.1.11", diff --git a/yarn.lock b/yarn.lock index 0fb8905df9..558545f821 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1712,10 +1712,10 @@ into-stream "^4.0.0" lodash "^4.17.4" -"@shopify/async@^2.0.7": - version "2.0.7" - resolved "https://registry.yarnpkg.com/@shopify/async/-/async-2.0.7.tgz#944992bc1721df6c363b3f0f31be1dad0e75e929" - integrity sha512-wYGjqPhpna4ShYbUmlD2fPv5ZkjNlCZtU7huUU8/snnyPmdgL/Rn5M5FPP6Apr7/hU5RgqMj2tJFs37ORz/VaQ== +"@shopify/async@^2.0.8": + version "2.0.8" + resolved "https://registry.yarnpkg.com/@shopify/async/-/async-2.0.8.tgz#6ecded5fe8c5f6f20a74f212e4cd8f307e9e5138" + integrity sha512-jiqVW8SA79eO3dWwJCCcLTch6TJK30i796WKyF1bGjIhwAaD6qRlspj5Ffzfg3r4RQbGMJheOVMdWhzctwxgKg== "@shopify/decorators@^1.1.5": version "1.1.5" @@ -1729,16 +1729,17 @@ resolved "https://registry.yarnpkg.com/@shopify/function-enhancers/-/function-enhancers-1.0.5.tgz#7c3e516e26ce7a9b63c263679bdcf5121d994a10" integrity sha512-34ML8DX4RmmA9hXDlf2BAz4SA37unShZxoBRPz585a+FaEzNcMvw5NzLD+Ih9XrP/wrxTUcN+p6pazvoS+jB7w== -"@shopify/jest-dom-mocks@2.8.2": - version "2.8.2" - resolved "https://registry.yarnpkg.com/@shopify/jest-dom-mocks/-/jest-dom-mocks-2.8.2.tgz#477c3159897807cc8d7797c33e8a79e787051779" - integrity sha512-4drt+S1cQ1ZSP1DaEHAj5XPPCiI2R8IIt+ZnH9h08Ngy8PjtjFFNHNcSJ6bKBmk7eO2c6+5UaJQzNcg56nt7gg== +"@shopify/jest-dom-mocks@2.8.3": + version "2.8.3" + resolved "https://registry.yarnpkg.com/@shopify/jest-dom-mocks/-/jest-dom-mocks-2.8.3.tgz#3c00872c1b996290dc2a8222d2701c131150b305" + integrity sha512-K544qSPkjlf/ze0urmgbN50ti4wcF+Vy1IQP8tbnkqA362slMXjdLokuB7oSIkntYLL9TmlEkWCxSRC17LXtnQ== dependencies: - "@shopify/async" "^2.0.7" + "@shopify/async" "^2.0.8" "@shopify/decorators" "^1.1.5" "@types/fetch-mock" "^6.0.1" "@types/lolex" "^2.1.3" fetch-mock "^6.3.0" + lodash ">=4.0.0 <5.0.0" lolex "^2.7.5" promise "^8.0.3" tslib "^1.9.3" @@ -8336,7 +8337,7 @@ lodash.without@~4.4.0: resolved "https://registry.yarnpkg.com/lodash.without/-/lodash.without-4.4.0.tgz#3cd4574a00b67bae373a94b748772640507b7aac" integrity sha1-PNRXSgC2e643OpS3SHcmQFB7eqw= -lodash@>4.17.4, lodash@^4.0.1, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.2.1: +lodash@>4.17.4, "lodash@>=4.0.0 <5.0.0", lodash@^4.0.1, lodash@^4.17.11, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.4, lodash@^4.2.1: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== From 056875ba535bd601f04e4365914064583aa52a07 Mon Sep 17 00:00:00 2001 From: xobotyi Date: Thu, 17 Oct 2019 10:47:44 +0300 Subject: [PATCH 079/162] fix: error throw tests; fix: better throw already `new Error`; --- src/__tests__/useMultiStateValidator.ts | 14 +++++++------- src/useMultiStateValidator.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/__tests__/useMultiStateValidator.ts b/src/__tests__/useMultiStateValidator.ts index 392af53d1d..cf191ca697 100644 --- a/src/__tests__/useMultiStateValidator.ts +++ b/src/__tests__/useMultiStateValidator.ts @@ -68,14 +68,14 @@ describe('useMultiStateValidator', () => { }); it('should throw if states is not an object', () => { - try { + expect(() => { // @ts-ignore - getHook(defaultStatesValidator, 123); - } catch (err) { - expect(err).toBeDefined(); - expect(err instanceof Error).toBe(true); - expect(err.message).toBe('states expected to be an object or array, got number'); - } + const [, hook] = getHook(defaultStatesValidator, 123); + + if (hook.result.error) { + throw hook.result.error; + } + }).toThrowError('states expected to be an object or array, got number'); }); it('first returned element should represent current validity state', () => { diff --git a/src/useMultiStateValidator.ts b/src/useMultiStateValidator.ts index 19ed9f2108..29cb12b338 100644 --- a/src/useMultiStateValidator.ts +++ b/src/useMultiStateValidator.ts @@ -17,7 +17,7 @@ export function useMultiStateValidator< S extends MultiStateValidatorStates = MultiStateValidatorStates >(states: S, validator: MultiStateValidator, initialValidity: V = [undefined] as V): UseValidatorReturn { if (typeof states !== 'object') { - throw Error('states expected to be an object or array, got ' + typeof states); + throw new Error('states expected to be an object or array, got ' + typeof states); } const validatorFn = useRef(validator); From 6e26237b5e428905e63501497a20a44a890bfe36 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 17 Oct 2019 13:39:31 +0000 Subject: [PATCH 080/162] chore(release): 12.7.0 [skip ci] # [12.7.0](https://github.com/streamich/react-use/compare/v12.6.0...v12.7.0) (2019-10-17) ### Bug Fixes * error throw tests; ([056875b](https://github.com/streamich/react-use/commit/056875b)) * useMultiStateValidator readme description; ([8c7f7f5](https://github.com/streamich/react-use/commit/8c7f7f5)) ### Features * useMultiStateValidator ([ae26988](https://github.com/streamich/react-use/commit/ae26988)) --- CHANGELOG.md | 13 +++++++++++++ package.json | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78784e127d..2bdc286658 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,16 @@ +# [12.7.0](https://github.com/streamich/react-use/compare/v12.6.0...v12.7.0) (2019-10-17) + + +### Bug Fixes + +* error throw tests; ([056875b](https://github.com/streamich/react-use/commit/056875b)) +* useMultiStateValidator readme description; ([8c7f7f5](https://github.com/streamich/react-use/commit/8c7f7f5)) + + +### Features + +* useMultiStateValidator ([ae26988](https://github.com/streamich/react-use/commit/ae26988)) + # [12.6.0](https://github.com/streamich/react-use/compare/v12.5.0...v12.6.0) (2019-10-16) diff --git a/package.json b/package.json index b502f85017..da12c654d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.6.0", + "version": "12.7.0", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From e59f63a1f6190a08617e09e8ae8f094bc7f95917 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 17 Oct 2019 13:45:01 +0000 Subject: [PATCH 081/162] chore(release): 12.7.1 [skip ci] ## [12.7.1](https://github.com/streamich/react-use/compare/v12.7.0...v12.7.1) (2019-10-17) ### Bug Fixes * example in the docs; ([7f54cad](https://github.com/streamich/react-use/commit/7f54cad)) * rename story's mediator and add `g` flag to it's regex; ([652b318](https://github.com/streamich/react-use/commit/652b318)) --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bdc286658..6d33219bf7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## [12.7.1](https://github.com/streamich/react-use/compare/v12.7.0...v12.7.1) (2019-10-17) + + +### Bug Fixes + +* example in the docs; ([7f54cad](https://github.com/streamich/react-use/commit/7f54cad)) +* rename story's mediator and add `g` flag to it's regex; ([652b318](https://github.com/streamich/react-use/commit/652b318)) + # [12.7.0](https://github.com/streamich/react-use/compare/v12.6.0...v12.7.0) (2019-10-17) diff --git a/package.json b/package.json index da12c654d7..3c4ad4286a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.7.0", + "version": "12.7.1", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From a1144741ea9786c987478415e0c89a4e83207669 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 17 Oct 2019 16:13:13 +0000 Subject: [PATCH 082/162] chore(deps): update dependency @shopify/jest-dom-mocks to v2.8.4 --- package.json | 2 +- yarn.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 3c4ad4286a..917a196663 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@semantic-release/changelog": "3.0.4", "@semantic-release/git": "7.0.16", "@semantic-release/npm": "5.1.13", - "@shopify/jest-dom-mocks": "2.8.3", + "@shopify/jest-dom-mocks": "2.8.4", "@storybook/addon-actions": "5.1.11", "@storybook/addon-knobs": "5.1.11", "@storybook/addon-notes": "5.1.11", diff --git a/yarn.lock b/yarn.lock index 558545f821..51d61cc736 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1712,10 +1712,10 @@ into-stream "^4.0.0" lodash "^4.17.4" -"@shopify/async@^2.0.8": - version "2.0.8" - resolved "https://registry.yarnpkg.com/@shopify/async/-/async-2.0.8.tgz#6ecded5fe8c5f6f20a74f212e4cd8f307e9e5138" - integrity sha512-jiqVW8SA79eO3dWwJCCcLTch6TJK30i796WKyF1bGjIhwAaD6qRlspj5Ffzfg3r4RQbGMJheOVMdWhzctwxgKg== +"@shopify/async@^2.0.9": + version "2.0.9" + resolved "https://registry.yarnpkg.com/@shopify/async/-/async-2.0.9.tgz#d097b99eb17c9368cdf0761870a162bfb93322c9" + integrity sha512-SAY9z9CXSZM/wQ5pSySpZ+MjiDwQiTdlXkCi8BiMUUgFRhEZ8CSgBQdy8R5pF64tqX1Iurmiwn+pl3sthWVyTQ== "@shopify/decorators@^1.1.5": version "1.1.5" @@ -1729,12 +1729,12 @@ resolved "https://registry.yarnpkg.com/@shopify/function-enhancers/-/function-enhancers-1.0.5.tgz#7c3e516e26ce7a9b63c263679bdcf5121d994a10" integrity sha512-34ML8DX4RmmA9hXDlf2BAz4SA37unShZxoBRPz585a+FaEzNcMvw5NzLD+Ih9XrP/wrxTUcN+p6pazvoS+jB7w== -"@shopify/jest-dom-mocks@2.8.3": - version "2.8.3" - resolved "https://registry.yarnpkg.com/@shopify/jest-dom-mocks/-/jest-dom-mocks-2.8.3.tgz#3c00872c1b996290dc2a8222d2701c131150b305" - integrity sha512-K544qSPkjlf/ze0urmgbN50ti4wcF+Vy1IQP8tbnkqA362slMXjdLokuB7oSIkntYLL9TmlEkWCxSRC17LXtnQ== +"@shopify/jest-dom-mocks@2.8.4": + version "2.8.4" + resolved "https://registry.yarnpkg.com/@shopify/jest-dom-mocks/-/jest-dom-mocks-2.8.4.tgz#065e770884f2853debf90647ba13d69d84153aa0" + integrity sha512-GjHl1SIuMe7RD1C1izKEt3kmSDKGbLzwx3sFmsbh/ov1XKAhQa4I8AFqkW5CadO2GylVVefANd+sd4WgMcQuaQ== dependencies: - "@shopify/async" "^2.0.8" + "@shopify/async" "^2.0.9" "@shopify/decorators" "^1.1.5" "@types/fetch-mock" "^6.0.1" "@types/lolex" "^2.1.3" From 9099f98f57717b6661a354b568c2516416ef3a9d Mon Sep 17 00:00:00 2001 From: Behnam Mohammadi Date: Mon, 21 Oct 2019 21:21:34 +0330 Subject: [PATCH 083/162] Added ActionsTabStory for log --- src/__stories__/useMount.story.tsx | 7 ++++--- src/__stories__/useUnmount.story.tsx | 7 ++++--- src/__stories__/util/ActionsTabStory.tsx | 5 +++++ 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 src/__stories__/util/ActionsTabStory.tsx diff --git a/src/__stories__/useMount.story.tsx b/src/__stories__/useMount.story.tsx index 966ab737e5..da6bcb8da2 100644 --- a/src/__stories__/useMount.story.tsx +++ b/src/__stories__/useMount.story.tsx @@ -1,13 +1,14 @@ import { storiesOf } from '@storybook/react'; +import { action } from '@storybook/addon-actions'; import * as React from 'react'; import { useMount } from '..'; -import ConsoleStory from './util/ConsoleStory'; +import ActionsTabStory from './util/ActionsTabStory'; import ShowDocs from './util/ShowDocs'; const Demo = () => { - useMount(() => console.log('MOUNTED')); + useMount(action('MOUNTED')); - return ; + return ; }; storiesOf('Lifecycle|useMount', module) diff --git a/src/__stories__/useUnmount.story.tsx b/src/__stories__/useUnmount.story.tsx index 87d58e3595..fda353e768 100644 --- a/src/__stories__/useUnmount.story.tsx +++ b/src/__stories__/useUnmount.story.tsx @@ -1,13 +1,14 @@ import { storiesOf } from '@storybook/react'; +import { action } from '@storybook/addon-actions'; import * as React from 'react'; import { useUnmount } from '..'; -import ConsoleStory from './util/ConsoleStory'; +import ActionsTabStory from './util/ActionsTabStory'; import ShowDocs from './util/ShowDocs'; const Demo = () => { - useUnmount(() => console.log('UNMOUNTED')); + useUnmount(action('UNMOUNTED')); - return ; + return ; }; storiesOf('Lifecycle|useUnmount', module) diff --git a/src/__stories__/util/ActionsTabStory.tsx b/src/__stories__/util/ActionsTabStory.tsx new file mode 100644 index 0000000000..8309618628 --- /dev/null +++ b/src/__stories__/util/ActionsTabStory.tsx @@ -0,0 +1,5 @@ +import * as React from 'react'; + +const ActionsTabStory = ({ message = 'Open actions tab to see logs' }) =>

{message}

; + +export default ActionsTabStory; From 8cdcfddae4d951a5f5d1f5ca067c30a2bf436b94 Mon Sep 17 00:00:00 2001 From: Jakkapat Boonroj Date: Tue, 22 Oct 2019 22:35:25 +0700 Subject: [PATCH 084/162] :sparkles: create useBreakpoint --- docs/useBreakpoint.md | 37 +++++++++++++++++++++++++ src/__stories__/useBreakpoint.story.tsx | 25 +++++++++++++++++ src/index.ts | 2 +- src/useBreakpoint.ts | 24 ++++++++++++++++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 docs/useBreakpoint.md create mode 100644 src/__stories__/useBreakpoint.story.tsx create mode 100644 src/useBreakpoint.ts diff --git a/docs/useBreakpoint.md b/docs/useBreakpoint.md new file mode 100644 index 0000000000..de346a46f7 --- /dev/null +++ b/docs/useBreakpoint.md @@ -0,0 +1,37 @@ +# `useBreakpoint` + +## Usage + +### use default breakpoint + +laptopL: 1440, laptop: 1024, tablet: 768 + +```jsx +import React from "react"; +import { useBreakpoint } from "react-use"; + +const Demo = () => { + const breakpoint = useBreakpoint(); + if (breakpoint === "laptopL") return
This is very big Laptop
; + else if (breakpoint == "laptop") return
This is Laptop
; + else if (breakpoint == "tablet") return
This is Tablet
; + else return
Too small!
; +}; +``` + +### use custom breakpoint + +XL: 1280, L: 768, S: 350 + +```jsx +import React from "react"; +import { useBreakpoint } from "react-use"; + +const Demo = () => { + const breakpoint = useBreakpoint(); + if (breakpoint === "XL") return
XL
; + else if (breakpoint == "L") return
LoL
; + else if (breakpoint == "S") return
Sexyy
; + else return
Wth
; +}; +``` diff --git a/src/__stories__/useBreakpoint.story.tsx b/src/__stories__/useBreakpoint.story.tsx new file mode 100644 index 0000000000..2fef483782 --- /dev/null +++ b/src/__stories__/useBreakpoint.story.tsx @@ -0,0 +1,25 @@ +import { number, withKnobs } from "@storybook/addon-knobs"; +import { storiesOf } from "@storybook/react"; +import React from "react"; +import { useBreakpoint } from ".."; +import ShowDocs from "./util/ShowDocs"; +const Demo = () => { + const breakpoint = useBreakpoint(); + const breakpointB = useBreakpoint({ mobileM: 350, laptop: 1024, tablet: 768 }); + return ( +
+

{"try resize your window"}

+

{"useBreakpoint() #default : { laptopL: 1440, laptop: 1024, tablet: 768 }"}

+

{breakpoint}

+

{"useBreakpoint({ mobileM: 350, laptop: 1024, tablet: 768 })"}

+

{breakpointB}

+
+ ); +}; + +storiesOf("sensors|useBreakpoint", module) + .addDecorator(withKnobs) + .add("Docs", () => ) + .add("Demo", () => { + return ; + }); diff --git a/src/index.ts b/src/index.ts index 9c660296a2..772f69fb17 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,6 +31,7 @@ export { default as useIntersection } from './useIntersection'; export { default as useInterval } from './useInterval'; export { default as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'; export { default as useKey } from './useKey'; +export { default as useBreakpoint } from './useBreakpoint'; // not exported because of peer dependency // export { default as useKeyboardJs } from './useKeyboardJs'; export { default as useKeyPress } from './useKeyPress'; @@ -62,7 +63,6 @@ export { default as usePromise } from './usePromise'; export { default as useRaf } from './useRaf'; export { default as useRafLoop } from './useRafLoop'; export { default as useRafState } from './useRafState'; - /** * @deprecated This hook is obsolete, use `useMountedState` instead */ diff --git a/src/useBreakpoint.ts b/src/useBreakpoint.ts new file mode 100644 index 0000000000..6b9f4e0268 --- /dev/null +++ b/src/useBreakpoint.ts @@ -0,0 +1,24 @@ +import { useEffect, useState } from 'react' + +function useBreakpoint(breakpoints: { [name: string]: number } = { laptopL: 1440, laptop: 1024, tablet: 768 }) { + const [useScreen, setScreen] = useState(0) + + useEffect(() => { + const setSideScreen = (): void => { + setScreen(window.innerWidth) + } + setSideScreen() + window.addEventListener('resize', setSideScreen) + return () => { + window.removeEventListener('resize', setSideScreen) + } + }) + const sortedBreakpoints = Object.entries(breakpoints).sort((a, b) => a[1] >= b[1] ? 1 : -1) + const result = sortedBreakpoints.reduce((acc, [name, width]) => { + if (useScreen >= width) return name + else return acc + }, sortedBreakpoints[0][0]) + return result +} + +export default useBreakpoint From 43ac4129dab37cf039be2b395ed04396b4895660 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 22 Oct 2019 21:33:49 +0000 Subject: [PATCH 085/162] chore(deps): update node.js to v10.17.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 917a196663..9ea159c4a4 100644 --- a/package.json +++ b/package.json @@ -143,7 +143,7 @@ ] }, "volta": { - "node": "10.16.3", + "node": "10.17.0", "yarn": "1.19.1" }, "collective": { From aa9090a1d319f83b6380302b1f881d7d24e7df3d Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 22 Oct 2019 21:34:02 +0000 Subject: [PATCH 086/162] chore(deps): update react monorepo to v16.11.0 --- package.json | 6 +++--- yarn.lock | 36 ++++++++++++++++++------------------ 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/package.json b/package.json index 9ea159c4a4..8c78c1869b 100644 --- a/package.json +++ b/package.json @@ -92,11 +92,11 @@ "markdown-loader": "5.1.0", "prettier": "1.18.2", "raf-stub": "3.0.0", - "react": "16.10.2", - "react-dom": "16.10.2", + "react": "16.11.0", + "react-dom": "16.11.0", "react-frame-component": "4.1.1", "react-spring": "8.0.27", - "react-test-renderer": "16.10.2", + "react-test-renderer": "16.11.0", "rebound": "0.1.0", "redux-logger": "3.0.6", "redux-thunk": "2.3.0", diff --git a/yarn.lock b/yarn.lock index 51d61cc736..d06e07c7b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10502,15 +10502,15 @@ react-docgen@^4.1.0: node-dir "^0.1.10" recast "^0.17.3" -react-dom@16.10.2: - version "16.10.2" - resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.10.2.tgz#4840bce5409176bc3a1f2bd8cb10b92db452fda6" - integrity sha512-kWGDcH3ItJK4+6Pl9DZB16BXYAZyrYQItU4OMy0jAkv5aNqc+mAKb4TpFtAteI6TJZu+9ZlNhaeNQSVQDHJzkw== +react-dom@16.11.0: + version "16.11.0" + resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-16.11.0.tgz#7e7c4a5a85a569d565c2462f5d345da2dd849af5" + integrity sha512-nrRyIUE1e7j8PaXSPtyRKtz+2y9ubW/ghNgqKFHHAHaeP0fpF5uXR+sq8IMRHC+ZUxw7W9NyCDTBtwWxvkb0iA== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" prop-types "^15.6.2" - scheduler "^0.16.2" + scheduler "^0.17.0" react-dom@^16.8.3: version "16.9.0" @@ -10667,15 +10667,15 @@ react-syntax-highlighter@^8.0.1: prismjs "^1.8.4" refractor "^2.4.1" -react-test-renderer@16.10.2: - version "16.10.2" - resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.10.2.tgz#4d8492f8678c9b43b721a7d79ed0840fdae7c518" - integrity sha512-k9Qzyev6cTIcIfrhgrFlYQAFxh5EEDO6ALNqYqmKsWVA7Q/rUMTay5nD3nthi6COmYsd4ghVYyi8U86aoeMqYQ== +react-test-renderer@16.11.0: + version "16.11.0" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.11.0.tgz#72574566496462c808ac449b0287a4c0a1a7d8f8" + integrity sha512-nh9gDl8R4ut+ZNNb2EeKO5VMvTKxwzurbSMuGBoKtjpjbg8JK/u3eVPVNi1h1Ue+eYK9oSzJjb+K3lzLxyA4ag== dependencies: object-assign "^4.1.1" prop-types "^15.6.2" react-is "^16.8.6" - scheduler "^0.16.2" + scheduler "^0.17.0" react-textarea-autosize@^7.1.0: version "7.1.0" @@ -10700,10 +10700,10 @@ react-wait@^0.3.0: resolved "https://registry.yarnpkg.com/react-wait/-/react-wait-0.3.0.tgz#0cdd4d919012451a5bc3ab0a16d00c6fd9a8c10b" integrity sha512-kB5x/kMKWcn0uVr9gBdNz21/oGbQwEQnF3P9p6E9yLfJ9DRcKS0fagbgYMFI0YFOoyKDj+2q6Rwax0kTYJF37g== -react@16.10.2: - version "16.10.2" - resolved "https://registry.yarnpkg.com/react/-/react-16.10.2.tgz#a5ede5cdd5c536f745173c8da47bda64797a4cf0" - integrity sha512-MFVIq0DpIhrHFyqLU0S3+4dIcBhhOvBE8bJ/5kHPVOVaGdo0KuiQzpcjCPsf585WvhypqtrMILyoE2th6dT+Lw== +react@16.11.0: + version "16.11.0" + resolved "https://registry.yarnpkg.com/react/-/react-16.11.0.tgz#d294545fe62299ccee83363599bf904e4a07fdbb" + integrity sha512-M5Y8yITaLmU0ynd0r1Yvfq98Rmll6q8AxaEe88c8e7LxO8fZ2cNgmFt0aGAS9wzf1Ao32NKXtCl+/tVVtkxq6g== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" @@ -11394,10 +11394,10 @@ scheduler@^0.15.0: loose-envify "^1.1.0" object-assign "^4.1.1" -scheduler@^0.16.2: - version "0.16.2" - resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.16.2.tgz#f74cd9d33eff6fc554edfb79864868e4819132c1" - integrity sha512-BqYVWqwz6s1wZMhjFvLfVR5WXP7ZY32M/wYPo04CcuPM7XZEbV2TBNW7Z0UkguPTl0dWMA59VbNXxK6q+pHItg== +scheduler@^0.17.0: + version "0.17.0" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.17.0.tgz#7c9c673e4ec781fac853927916d1c426b6f3ddfe" + integrity sha512-7rro8Io3tnCPuY4la/NuI5F2yfESpnfZyT6TtkXnSWVkcu0BCDJ+8gk5ozUaFaxpIyNuWAPXrH0yFcSi28fnDA== dependencies: loose-envify "^1.1.0" object-assign "^4.1.1" From 9c779b256b0a6fecaa9df0a999c372e37ac6c097 Mon Sep 17 00:00:00 2001 From: Jakkapat Boonroj Date: Wed, 23 Oct 2019 10:11:29 +0700 Subject: [PATCH 087/162] rename variable --- src/useBreakpoint.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/useBreakpoint.ts b/src/useBreakpoint.ts index 6b9f4e0268..696902d2f5 100644 --- a/src/useBreakpoint.ts +++ b/src/useBreakpoint.ts @@ -1,7 +1,7 @@ import { useEffect, useState } from 'react' function useBreakpoint(breakpoints: { [name: string]: number } = { laptopL: 1440, laptop: 1024, tablet: 768 }) { - const [useScreen, setScreen] = useState(0) + const [screen, setScreen] = useState(0) useEffect(() => { const setSideScreen = (): void => { @@ -15,7 +15,7 @@ function useBreakpoint(breakpoints: { [name: string]: number } = { laptopL: 1440 }) const sortedBreakpoints = Object.entries(breakpoints).sort((a, b) => a[1] >= b[1] ? 1 : -1) const result = sortedBreakpoints.reduce((acc, [name, width]) => { - if (useScreen >= width) return name + if (screen >= width) return name else return acc }, sortedBreakpoints[0][0]) return result From 20bdd507883ce41307a27df5d5c4b58c3a4078a5 Mon Sep 17 00:00:00 2001 From: Jakkapat Boonroj Date: Wed, 23 Oct 2019 10:13:25 +0700 Subject: [PATCH 088/162] add useMemo --- src/useBreakpoint.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/useBreakpoint.ts b/src/useBreakpoint.ts index 696902d2f5..f4a685cb36 100644 --- a/src/useBreakpoint.ts +++ b/src/useBreakpoint.ts @@ -1,4 +1,4 @@ -import { useEffect, useState } from 'react' +import { useEffect, useState, useMemo } from 'react' function useBreakpoint(breakpoints: { [name: string]: number } = { laptopL: 1440, laptop: 1024, tablet: 768 }) { const [screen, setScreen] = useState(0) @@ -13,7 +13,7 @@ function useBreakpoint(breakpoints: { [name: string]: number } = { laptopL: 1440 window.removeEventListener('resize', setSideScreen) } }) - const sortedBreakpoints = Object.entries(breakpoints).sort((a, b) => a[1] >= b[1] ? 1 : -1) + const sortedBreakpoints = useMemo(() => Object.entries(breakpoints).sort((a, b) => a[1] >= b[1] ? 1 : -1), [breakpoints]) const result = sortedBreakpoints.reduce((acc, [name, width]) => { if (screen >= width) return name else return acc From fa08f930046ac05911ada1ed9813eabe8c3e079a Mon Sep 17 00:00:00 2001 From: Jakkapat Boonroj Date: Wed, 23 Oct 2019 10:15:38 +0700 Subject: [PATCH 089/162] rename to createBreakpoint --- docs/{useBreakpoint.md => createBreakpoint.md} | 0 .../{useBreakpoint.story.tsx => createBreakpoint.story.tsx} | 4 ++-- src/{useBreakpoint.ts => createBreakpoint.ts} | 4 ++-- src/index.ts | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename docs/{useBreakpoint.md => createBreakpoint.md} (100%) rename src/__stories__/{useBreakpoint.story.tsx => createBreakpoint.story.tsx} (85%) rename src/{useBreakpoint.ts => createBreakpoint.ts} (83%) diff --git a/docs/useBreakpoint.md b/docs/createBreakpoint.md similarity index 100% rename from docs/useBreakpoint.md rename to docs/createBreakpoint.md diff --git a/src/__stories__/useBreakpoint.story.tsx b/src/__stories__/createBreakpoint.story.tsx similarity index 85% rename from src/__stories__/useBreakpoint.story.tsx rename to src/__stories__/createBreakpoint.story.tsx index 2fef483782..6e810e99df 100644 --- a/src/__stories__/useBreakpoint.story.tsx +++ b/src/__stories__/createBreakpoint.story.tsx @@ -17,9 +17,9 @@ const Demo = () => { ); }; -storiesOf("sensors|useBreakpoint", module) +storiesOf("sensors|createBreakpoint", module) .addDecorator(withKnobs) - .add("Docs", () => ) + .add("Docs", () => ) .add("Demo", () => { return ; }); diff --git a/src/useBreakpoint.ts b/src/createBreakpoint.ts similarity index 83% rename from src/useBreakpoint.ts rename to src/createBreakpoint.ts index f4a685cb36..a0542e75d4 100644 --- a/src/useBreakpoint.ts +++ b/src/createBreakpoint.ts @@ -1,6 +1,6 @@ import { useEffect, useState, useMemo } from 'react' -function useBreakpoint(breakpoints: { [name: string]: number } = { laptopL: 1440, laptop: 1024, tablet: 768 }) { +function createBreakpoint(breakpoints: { [name: string]: number } = { laptopL: 1440, laptop: 1024, tablet: 768 }) { const [screen, setScreen] = useState(0) useEffect(() => { @@ -21,4 +21,4 @@ function useBreakpoint(breakpoints: { [name: string]: number } = { laptopL: 1440 return result } -export default useBreakpoint +export default createBreakpoint diff --git a/src/index.ts b/src/index.ts index 772f69fb17..241f91db48 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,7 +31,7 @@ export { default as useIntersection } from './useIntersection'; export { default as useInterval } from './useInterval'; export { default as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'; export { default as useKey } from './useKey'; -export { default as useBreakpoint } from './useBreakpoint'; +export { default as useBreakpoint } from './createBreakpoint'; // not exported because of peer dependency // export { default as useKeyboardJs } from './useKeyboardJs'; export { default as useKeyPress } from './useKeyPress'; From 75827fd497d69dca17c39fe39a6374fd44002231 Mon Sep 17 00:00:00 2001 From: Jakkapat Boonroj Date: Wed, 23 Oct 2019 10:21:55 +0700 Subject: [PATCH 090/162] add createBreakpoint in readme --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 76fd92c187..b0f21b0f71 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ - [`useWindowScroll`](./docs/useWindowScroll.md) — tracks `Window` scroll position. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usewindowscroll--docs) - [`useWindowSize`](./docs/useWindowSize.md) — tracks `Window` dimensions. [![][img-demo]](https://codesandbox.io/s/m7ln22668) - [`useMeasure`](./docs/useMeasure.md) — tracks an HTML element's dimensions using the Resize Observer API.[![][img-demo]](https://streamich.github.io/react-use/?path=/story/sensors-usemeasure--demo) + - [`createBreakpoint`](./doc/createBreakpoint.md) — tracks `innerWidth`

- [**UI**](./docs/UI.md) From 13ac976b0d30788e8ee8a760c4e9dcf3aef8e725 Mon Sep 17 00:00:00 2001 From: Jakkapat Boonroj Date: Wed, 23 Oct 2019 10:33:36 +0700 Subject: [PATCH 091/162] change word --- docs/createBreakpoint.md | 12 +++++++++--- src/__stories__/createBreakpoint.story.tsx | 16 ++++++++++------ src/createBreakpoint.ts | 2 +- src/index.ts | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/docs/createBreakpoint.md b/docs/createBreakpoint.md index de346a46f7..a07cb68b15 100644 --- a/docs/createBreakpoint.md +++ b/docs/createBreakpoint.md @@ -1,4 +1,4 @@ -# `useBreakpoint` +# `createBreakpoint` ## Usage @@ -8,10 +8,13 @@ laptopL: 1440, laptop: 1024, tablet: 768 ```jsx import React from "react"; -import { useBreakpoint } from "react-use"; +import { createBreakpoint } from "react-use"; + +const useBreakpoint = createBreakpoint(); const Demo = () => { const breakpoint = useBreakpoint(); + if (breakpoint === "laptopL") return
This is very big Laptop
; else if (breakpoint == "laptop") return
This is Laptop
; else if (breakpoint == "tablet") return
This is Tablet
; @@ -25,10 +28,13 @@ XL: 1280, L: 768, S: 350 ```jsx import React from "react"; -import { useBreakpoint } from "react-use"; +import { createBreakpoint } from "react-use"; + +const useBreakpoint = createBreakpoint({ XL: 1280, L: 768, S: 350 }); const Demo = () => { const breakpoint = useBreakpoint(); + if (breakpoint === "XL") return
XL
; else if (breakpoint == "L") return
LoL
; else if (breakpoint == "S") return
Sexyy
; diff --git a/src/__stories__/createBreakpoint.story.tsx b/src/__stories__/createBreakpoint.story.tsx index 6e810e99df..92068f79b5 100644 --- a/src/__stories__/createBreakpoint.story.tsx +++ b/src/__stories__/createBreakpoint.story.tsx @@ -1,17 +1,21 @@ import { number, withKnobs } from "@storybook/addon-knobs"; import { storiesOf } from "@storybook/react"; import React from "react"; -import { useBreakpoint } from ".."; +import { createBreakpoint } from ".."; import ShowDocs from "./util/ShowDocs"; + +const useBreakpointA = createBreakpoint(); +const useBreakpointB = createBreakpoint({ mobileM: 350, laptop: 1024, tablet: 768 }); + const Demo = () => { - const breakpoint = useBreakpoint(); - const breakpointB = useBreakpoint({ mobileM: 350, laptop: 1024, tablet: 768 }); + const breakpointA = useBreakpointA(); + const breakpointB = useBreakpointB(); return (

{"try resize your window"}

-

{"useBreakpoint() #default : { laptopL: 1440, laptop: 1024, tablet: 768 }"}

-

{breakpoint}

-

{"useBreakpoint({ mobileM: 350, laptop: 1024, tablet: 768 })"}

+

{"createBreakpoint() #default : { laptopL: 1440, laptop: 1024, tablet: 768 }"}

+

{breakpointA}

+

{"createBreakpoint({ mobileM: 350, laptop: 1024, tablet: 768 })"}

{breakpointB}

); diff --git a/src/createBreakpoint.ts b/src/createBreakpoint.ts index a0542e75d4..966a03558c 100644 --- a/src/createBreakpoint.ts +++ b/src/createBreakpoint.ts @@ -1,6 +1,6 @@ import { useEffect, useState, useMemo } from 'react' -function createBreakpoint(breakpoints: { [name: string]: number } = { laptopL: 1440, laptop: 1024, tablet: 768 }) { +const createBreakpoint = (breakpoints: { [name: string]: number } = { laptopL: 1440, laptop: 1024, tablet: 768 }) => () => { const [screen, setScreen] = useState(0) useEffect(() => { diff --git a/src/index.ts b/src/index.ts index 241f91db48..88cd19a6e9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -31,7 +31,7 @@ export { default as useIntersection } from './useIntersection'; export { default as useInterval } from './useInterval'; export { default as useIsomorphicLayoutEffect } from './useIsomorphicLayoutEffect'; export { default as useKey } from './useKey'; -export { default as useBreakpoint } from './createBreakpoint'; +export { default as createBreakpoint } from './createBreakpoint'; // not exported because of peer dependency // export { default as useKeyboardJs } from './useKeyboardJs'; export { default as useKeyPress } from './useKeyPress'; From ad1da8463b4606e03e216a6e6f16b5f2b79e8caf Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 23 Oct 2019 06:28:18 +0000 Subject: [PATCH 092/162] chore(deps): update dependency ts-loader to v6.2.1 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8c78c1869b..38d72de52d 100644 --- a/package.json +++ b/package.json @@ -103,7 +103,7 @@ "rimraf": "3.0.0", "rxjs": "6.5.3", "semantic-release": "15.13.24", - "ts-loader": "6.2.0", + "ts-loader": "6.2.1", "ts-node": "8.4.1", "tslint": "5.20.0", "tslint-config-prettier": "1.18.0", diff --git a/yarn.lock b/yarn.lock index d06e07c7b3..4446cde0d5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12581,10 +12581,10 @@ ts-easing@^0.2.0: resolved "https://registry.yarnpkg.com/ts-easing/-/ts-easing-0.2.0.tgz#c8a8a35025105566588d87dbda05dd7fbfa5a4ec" integrity sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ== -ts-loader@6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.2.0.tgz#52d3993ecbc5474c1513242388e1049da0fce880" - integrity sha512-Da8h3fD+HiZ9GvZJydqzk3mTC9nuOKYlJcpuk+Zv6Y1DPaMvBL+56GRzZFypx2cWrZFMsQr869+Ua2slGoLxvQ== +ts-loader@6.2.1: + version "6.2.1" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.2.1.tgz#67939d5772e8a8c6bdaf6277ca023a4812da02ef" + integrity sha512-Dd9FekWuABGgjE1g0TlQJ+4dFUfYGbYcs52/HQObE0ZmUNjQlmLAS7xXsSzy23AMaMwipsx5sNHvoEpT2CZq1g== dependencies: chalk "^2.3.0" enhanced-resolve "^4.0.0" From f7c709afce7834d1430e2cef58ad4892e60c340d Mon Sep 17 00:00:00 2001 From: streamich Date: Wed, 23 Oct 2019 10:08:51 +0200 Subject: [PATCH 093/162] =?UTF-8?q?fix:=20=F0=9F=90=9B=20bump=20set-harmon?= =?UTF-8?q?ic-interval=20package=20version?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 38d72de52d..8972e043fb 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "react-wait": "^0.3.0", "resize-observer-polyfill": "^1.5.1", "screenfull": "^5.0.0", - "set-harmonic-interval": "^1.0.0", + "set-harmonic-interval": "^1.0.1", "throttle-debounce": "^2.0.1", "ts-easing": "^0.2.0", "tslib": "^1.10.0" diff --git a/yarn.lock b/yarn.lock index 4446cde0d5..b84e46863c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11540,10 +11540,10 @@ set-blocking@^2.0.0, set-blocking@~2.0.0: resolved "https://registry.yarnpkg.com/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" integrity sha1-BF+XgtARrppoA93TgrJDkrPYkPc= -set-harmonic-interval@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/set-harmonic-interval/-/set-harmonic-interval-1.0.0.tgz#2759658395579fc336b9cd026eefe1ad9e742f9b" - integrity sha512-RJtrhB5G10e5A1auBv/jHGq0KWfHH8PAb4ln4+kjiHS46aAP12rSdarSj9GDlxQ3QULA2pefEDpm9Y1Xnz+eng== +set-harmonic-interval@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/set-harmonic-interval/-/set-harmonic-interval-1.0.1.tgz#e1773705539cdfb80ce1c3d99e7f298bb3995249" + integrity sha512-AhICkFV84tBP1aWqPwLZqFvAwqEoVA9kxNMniGEUvzOlm4vLmOFLiTT3UZ6bziJTy4bOVpzWGTfSCbmaayGx8g== set-value@^0.4.3: version "0.4.3" From 1ed849490706fb8cccce3bd864cf8b77a2aedaab Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 23 Oct 2019 08:11:24 +0000 Subject: [PATCH 094/162] chore(release): 12.7.2 [skip ci] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## [12.7.2](https://github.com/streamich/react-use/compare/v12.7.1...v12.7.2) (2019-10-23) ### Bug Fixes * 🐛 bump set-harmonic-interval package version ([f7c709a](https://github.com/streamich/react-use/commit/f7c709a)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d33219bf7..87d3f0ed09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [12.7.2](https://github.com/streamich/react-use/compare/v12.7.1...v12.7.2) (2019-10-23) + + +### Bug Fixes + +* 🐛 bump set-harmonic-interval package version ([f7c709a](https://github.com/streamich/react-use/commit/f7c709a)) + ## [12.7.1](https://github.com/streamich/react-use/compare/v12.7.0...v12.7.1) (2019-10-17) diff --git a/package.json b/package.json index 8972e043fb..7aaed5003c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-use", - "version": "12.7.1", + "version": "12.7.2", "description": "Collection of React Hooks", "main": "lib/index.js", "module": "esm/index.js", From 711b48cfd1af7dfc3dbb4c52691c50b9226bd50a Mon Sep 17 00:00:00 2001 From: streamich Date: Wed, 23 Oct 2019 10:23:26 +0200 Subject: [PATCH 095/162] =?UTF-8?q?docs:=20=E2=9C=8F=EF=B8=8F=20use=20aler?= =?UTF-8?q?t()=20in=20useMount()=20and=20useUnmount()=20stories?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/useMount.md | 2 +- docs/useUnmount.md | 2 +- src/__stories__/useMount.story.tsx | 10 ++++++---- src/__stories__/useUnmount.story.tsx | 11 +++++++---- src/__stories__/util/ActionsTabStory.tsx | 5 ----- 5 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 src/__stories__/util/ActionsTabStory.tsx diff --git a/docs/useMount.md b/docs/useMount.md index 95b53ae8b9..7b357c55ff 100644 --- a/docs/useMount.md +++ b/docs/useMount.md @@ -8,7 +8,7 @@ React lifecycle hook that calls a function after the component is mounted. Use ` import {useMount} from 'react-use'; const Demo = () => { - useMount(() => console.log('MOUNTED')); + useMount(() => alert('MOUNTED')); return null; }; ``` diff --git a/docs/useUnmount.md b/docs/useUnmount.md index 83dc772219..c0a3e6c85b 100644 --- a/docs/useUnmount.md +++ b/docs/useUnmount.md @@ -8,7 +8,7 @@ React lifecycle hook that calls a function when the component will unmount. Use import {useUnmount} from 'react-use'; const Demo = () => { - useUnmount(() => console.log('UNMOUNTED')); + useUnmount(() => alert('UNMOUNTED')); return null; }; ``` diff --git a/src/__stories__/useMount.story.tsx b/src/__stories__/useMount.story.tsx index da6bcb8da2..31c16c5ca7 100644 --- a/src/__stories__/useMount.story.tsx +++ b/src/__stories__/useMount.story.tsx @@ -1,14 +1,16 @@ import { storiesOf } from '@storybook/react'; -import { action } from '@storybook/addon-actions'; import * as React from 'react'; import { useMount } from '..'; -import ActionsTabStory from './util/ActionsTabStory'; import ShowDocs from './util/ShowDocs'; const Demo = () => { - useMount(action('MOUNTED')); + useMount(() => alert('MOUNTED')); - return ; + return ( +
+ useMount() hook can be used to perform a side-effect when component is mounted. +
+ ); }; storiesOf('Lifecycle|useMount', module) diff --git a/src/__stories__/useUnmount.story.tsx b/src/__stories__/useUnmount.story.tsx index fda353e768..a08dfbb336 100644 --- a/src/__stories__/useUnmount.story.tsx +++ b/src/__stories__/useUnmount.story.tsx @@ -1,14 +1,17 @@ import { storiesOf } from '@storybook/react'; -import { action } from '@storybook/addon-actions'; import * as React from 'react'; import { useUnmount } from '..'; -import ActionsTabStory from './util/ActionsTabStory'; import ShowDocs from './util/ShowDocs'; const Demo = () => { - useUnmount(action('UNMOUNTED')); + useUnmount(() => alert('UNMOUNTED')); - return ; + return ( +
+ useUnmount() hook can be used to perform side-effects when component unmounts. This component will + alert you when it is un-mounted. +
+ ); }; storiesOf('Lifecycle|useUnmount', module) diff --git a/src/__stories__/util/ActionsTabStory.tsx b/src/__stories__/util/ActionsTabStory.tsx deleted file mode 100644 index 8309618628..0000000000 --- a/src/__stories__/util/ActionsTabStory.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import * as React from 'react'; - -const ActionsTabStory = ({ message = 'Open actions tab to see logs' }) =>

{message}

; - -export default ActionsTabStory; From c494aa3c3b993352f9cec0e4e834343d411ac52b Mon Sep 17 00:00:00 2001 From: streamich Date: Wed, 23 Oct 2019 10:59:39 +0200 Subject: [PATCH 096/162] =?UTF-8?q?chore:=20=F0=9F=A4=96=20upgrade=20Story?= =?UTF-8?q?book=20to=205.2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 10 +- yarn.lock | 892 +++++++++++++++++++++++++++------------------------ 2 files changed, 474 insertions(+), 428 deletions(-) diff --git a/package.json b/package.json index 7aaed5003c..bf911645fa 100644 --- a/package.json +++ b/package.json @@ -72,11 +72,11 @@ "@semantic-release/git": "7.0.16", "@semantic-release/npm": "5.1.13", "@shopify/jest-dom-mocks": "2.8.4", - "@storybook/addon-actions": "5.1.11", - "@storybook/addon-knobs": "5.1.11", - "@storybook/addon-notes": "5.1.11", - "@storybook/addon-options": "5.1.11", - "@storybook/react": "5.1.11", + "@storybook/addon-actions": "5.2.5", + "@storybook/addon-knobs": "5.2.5", + "@storybook/addon-notes": "5.2.5", + "@storybook/addon-options": "5.2.5", + "@storybook/react": "5.2.5", "@testing-library/react-hooks": "2.0.3", "@types/jest": "24.0.19", "@types/react": "16.9.2", diff --git a/yarn.lock b/yarn.lock index b84e46863c..9dc9186e24 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1136,13 +1136,20 @@ dependencies: regenerator-runtime "^0.13.2" -"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.3", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.4": +"@babel/runtime@^7.0.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.3.1", "@babel/runtime@^7.4.2", "@babel/runtime@^7.4.4", "@babel/runtime@^7.4.5", "@babel/runtime@^7.5.0", "@babel/runtime@^7.5.4": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" integrity sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ== dependencies: regenerator-runtime "^0.13.2" +"@babel/runtime@^7.5.5": + version "7.6.3" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.6.3.tgz#935122c74c73d2240cafd32ddb5fc2a6cd35cf1f" + integrity sha512-kq6anf9JGjW8Nt5rYfEuGRaEAaH1mkv3Bbu6rYvLOpPh/RusSJXuKPEAoZ7L7gybZkchE8+NV5g9vKF4AGAtsA== + dependencies: + regenerator-runtime "^0.13.2" + "@babel/template@^7.0.0", "@babel/template@^7.1.0", "@babel/template@^7.4.0", "@babel/template@^7.4.4": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.4.4.tgz#f4b88d1225689a08f5bc3a17483545be9e4ed237" @@ -1241,17 +1248,15 @@ exec-sh "^0.3.2" minimist "^1.2.0" -"@emotion/babel-utils@^0.6.4": - version "0.6.10" - resolved "https://registry.yarnpkg.com/@emotion/babel-utils/-/babel-utils-0.6.10.tgz#83dbf3dfa933fae9fc566e54fbb45f14674c6ccc" - integrity sha512-/fnkM/LTEp3jKe++T0KyTszVGWNKPNOUJfjNKLO17BzQ6QPxgbg3whayom1Qr2oLFH3V92tDymU+dT5q676uow== +"@emotion/cache@^10.0.17": + version "10.0.19" + resolved "https://registry.yarnpkg.com/@emotion/cache/-/cache-10.0.19.tgz#d258d94d9c707dcadaf1558def968b86bb87ad71" + integrity sha512-BoiLlk4vEsGBg2dAqGSJu0vJl/PgVtCYLBFJaEO8RmQzPugXewQCXZJNXTDFaRlfCs0W+quesayav4fvaif5WQ== dependencies: - "@emotion/hash" "^0.6.6" - "@emotion/memoize" "^0.6.6" - "@emotion/serialize" "^0.9.1" - convert-source-map "^1.5.1" - find-root "^1.1.0" - source-map "^0.7.2" + "@emotion/sheet" "0.9.3" + "@emotion/stylis" "0.8.4" + "@emotion/utils" "0.11.2" + "@emotion/weak-memoize" "0.2.4" "@emotion/cache@^10.0.9": version "10.0.9" @@ -1263,6 +1268,18 @@ "@emotion/utils" "0.11.1" "@emotion/weak-memoize" "0.2.2" +"@emotion/core@^10.0.14": + version "10.0.21" + resolved "https://registry.yarnpkg.com/@emotion/core/-/core-10.0.21.tgz#2e8398d2b92fd90d4ed6ac4d0b66214971de3458" + integrity sha512-U9zbc7ovZ2ceIwbLXYZPJy6wPgnOdTNT4jENZ31ee6v2lojetV5bTbCVk6ciT8G3wQRyVaTTfUCH9WCrMzpRIw== + dependencies: + "@babel/runtime" "^7.5.5" + "@emotion/cache" "^10.0.17" + "@emotion/css" "^10.0.14" + "@emotion/serialize" "^0.11.10" + "@emotion/sheet" "0.9.3" + "@emotion/utils" "0.11.2" + "@emotion/core@^10.0.9": version "10.0.10" resolved "https://registry.yarnpkg.com/@emotion/core/-/core-10.0.10.tgz#8d3114e5a2f8b178a7067c603a2937516f180b08" @@ -1274,6 +1291,15 @@ "@emotion/sheet" "0.9.2" "@emotion/utils" "0.11.1" +"@emotion/css@^10.0.14": + version "10.0.14" + resolved "https://registry.yarnpkg.com/@emotion/css/-/css-10.0.14.tgz#95dacabdd0e22845d1a1b0b5968d9afa34011139" + integrity sha512-MozgPkBEWvorcdpqHZE5x1D/PLEHUitALQCQYt2wayf4UNhpgQs2tN0UwHYS4FMy5ROBH+0ALyCFVYJ/ywmwlg== + dependencies: + "@emotion/serialize" "^0.11.8" + "@emotion/utils" "0.11.2" + babel-plugin-emotion "^10.0.14" + "@emotion/css@^10.0.9": version "10.0.9" resolved "https://registry.yarnpkg.com/@emotion/css/-/css-10.0.9.tgz#ea0df431965a308f6cb1d61386df8ad61e5befb5" @@ -1288,27 +1314,38 @@ resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.7.1.tgz#9833722341379fb7d67f06a4b00ab3c37913da53" integrity sha512-OYpa/Sg+2GDX+jibUfpZVn1YqSVRpYmTLF2eyAfrFTIJSbwyIrc+YscayoykvaOME/wV4BV0Sa0yqdMrgse6mA== -"@emotion/hash@^0.6.2", "@emotion/hash@^0.6.6": - version "0.6.6" - resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.6.6.tgz#62266c5f0eac6941fece302abad69f2ee7e25e44" - integrity sha512-ojhgxzUHZ7am3D2jHkMzPpsBAiB005GF5YU4ea+8DNPybMk01JJUM9V9YRlF/GE95tcOm8DxQvWA2jq19bGalQ== - -"@emotion/is-prop-valid@0.7.3": +"@emotion/hash@0.7.3": version "0.7.3" - resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.7.3.tgz#a6bf4fa5387cbba59d44e698a4680f481a8da6cc" - integrity sha512-uxJqm/sqwXw3YPA5GXX365OBcJGFtxUVkB6WyezqFHlNe9jqUWH5ur2O2M8dGBz61kn1g3ZBlzUunFQXQIClhA== + resolved "https://registry.yarnpkg.com/@emotion/hash/-/hash-0.7.3.tgz#a166882c81c0c6040975dd30df24fae8549bd96f" + integrity sha512-14ZVlsB9akwvydAdaEnVnvqu6J2P6ySv39hYyl/aoB6w/V+bXX0tay8cF6paqbgZsN2n5Xh15uF4pE+GvE+itw== + +"@emotion/is-prop-valid@0.8.3": + version "0.8.3" + resolved "https://registry.yarnpkg.com/@emotion/is-prop-valid/-/is-prop-valid-0.8.3.tgz#cbe62ddbea08aa022cdf72da3971570a33190d29" + integrity sha512-We7VBiltAJ70KQA0dWkdPMXnYoizlxOXpvtjmu5/MBnExd+u0PGgV27WCYanmLAbCwAU30Le/xA0CQs/F/Otig== dependencies: - "@emotion/memoize" "0.7.1" + "@emotion/memoize" "0.7.3" "@emotion/memoize@0.7.1": version "0.7.1" resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.1.tgz#e93c13942592cf5ef01aa8297444dc192beee52f" integrity sha512-Qv4LTqO11jepd5Qmlp3M1YEjBumoTHcHFdgPTQ+sFlIL5myi/7xu/POwP7IRu6odBdmLXdtIs1D6TuW6kbwbbg== -"@emotion/memoize@^0.6.1", "@emotion/memoize@^0.6.6": - version "0.6.6" - resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.6.6.tgz#004b98298d04c7ca3b4f50ca2035d4f60d2eed1b" - integrity sha512-h4t4jFjtm1YV7UirAFuSuFGyLa+NNxjdkq6DpFLANNQY5rHueFZHVY+8Cu1HYVP6DrheB0kv4m5xPjo7eKT7yQ== +"@emotion/memoize@0.7.3": + version "0.7.3" + resolved "https://registry.yarnpkg.com/@emotion/memoize/-/memoize-0.7.3.tgz#5b6b1c11d6a6dddf1f2fc996f74cf3b219644d78" + integrity sha512-2Md9mH6mvo+ygq1trTeVp2uzAKwE2P7In0cRpD/M9Q70aH8L+rxMLbb3JCN2JoSWsV2O+DdFjfbbXoMoLBczow== + +"@emotion/serialize@^0.11.10", "@emotion/serialize@^0.11.11", "@emotion/serialize@^0.11.8": + version "0.11.11" + resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-0.11.11.tgz#c92a5e5b358070a7242d10508143306524e842a4" + integrity sha512-YG8wdCqoWtuoMxhHZCTA+egL0RSGdHEc+YCsmiSBPBEDNuVeMWtjEWtGrhUterSChxzwnWBXvzSxIFQI/3sHLw== + dependencies: + "@emotion/hash" "0.7.3" + "@emotion/memoize" "0.7.3" + "@emotion/unitless" "0.7.4" + "@emotion/utils" "0.11.2" + csstype "^2.5.7" "@emotion/serialize@^0.11.6": version "0.11.6" @@ -1321,78 +1358,73 @@ "@emotion/utils" "0.11.1" csstype "^2.5.7" -"@emotion/serialize@^0.9.1": - version "0.9.1" - resolved "https://registry.yarnpkg.com/@emotion/serialize/-/serialize-0.9.1.tgz#a494982a6920730dba6303eb018220a2b629c145" - integrity sha512-zTuAFtyPvCctHBEL8KZ5lJuwBanGSutFEncqLn/m9T1a6a93smBStK+bZzcNPgj4QS8Rkw9VTwJGhRIUVO8zsQ== - dependencies: - "@emotion/hash" "^0.6.6" - "@emotion/memoize" "^0.6.6" - "@emotion/unitless" "^0.6.7" - "@emotion/utils" "^0.8.2" - "@emotion/sheet@0.9.2": version "0.9.2" resolved "https://registry.yarnpkg.com/@emotion/sheet/-/sheet-0.9.2.tgz#74e5c6b5e489a1ba30ab246ab5eedd96916487c4" integrity sha512-pVBLzIbC/QCHDKJF2E82V2H/W/B004mDFQZiyo/MSR+VC4pV5JLG0TF/zgQDFvP3fZL/5RTPGEmXlYJBMUuJ+A== -"@emotion/styled-base@^10.0.9": - version "10.0.9" - resolved "https://registry.yarnpkg.com/@emotion/styled-base/-/styled-base-10.0.9.tgz#634b43d1f0309c35c5b342c775b01610517d2529" - integrity sha512-uXOPP2V7g8lYWsqBfYGmEOXHMUPleOujFWusQyXezxe1VGlZjGJIQj+YmzkwzGBmFx2nAun0OKMYCBJMeGKojw== +"@emotion/sheet@0.9.3": + version "0.9.3" + resolved "https://registry.yarnpkg.com/@emotion/sheet/-/sheet-0.9.3.tgz#689f135ecf87d3c650ed0c4f5ddcbe579883564a" + integrity sha512-c3Q6V7Df7jfwSq5AzQWbXHa5soeE4F5cbqi40xn0CzXxWW9/6Mxq48WJEtqfWzbZtW9odZdnRAkwCQwN12ob4A== + +"@emotion/styled-base@^10.0.17": + version "10.0.19" + resolved "https://registry.yarnpkg.com/@emotion/styled-base/-/styled-base-10.0.19.tgz#53655274797194d86453354fdb2c947b46032db6" + integrity sha512-Sz6GBHTbOZoeZQKvkE9gQPzaJ6/qtoQ/OPvyG2Z/6NILlYk60Es1cEcTgTkm26H8y7A0GSgp4UmXl+srvsnFPg== dependencies: - "@emotion/is-prop-valid" "0.7.3" - "@emotion/serialize" "^0.11.6" - "@emotion/utils" "0.11.1" - object-assign "^4.1.1" + "@babel/runtime" "^7.5.5" + "@emotion/is-prop-valid" "0.8.3" + "@emotion/serialize" "^0.11.11" + "@emotion/utils" "0.11.2" -"@emotion/styled@^10.0.7": - version "10.0.9" - resolved "https://registry.yarnpkg.com/@emotion/styled/-/styled-10.0.9.tgz#3d940ec8b989853fd422dab6278a2803e1c4a608" - integrity sha512-V+BT+KE4NKCANS18TL0yGueIyVbL5qXbgKarLcIhxmz0/dEk2k6kA18sKguJpHYa0RpgkggdhUPWWohTu3DRPw== +"@emotion/styled@^10.0.14": + version "10.0.17" + resolved "https://registry.yarnpkg.com/@emotion/styled/-/styled-10.0.17.tgz#0cd38b8b36259541f2c6717fc22607a120623654" + integrity sha512-zHMgWjHDMNjD+ux64POtDnjLAObniu3znxFBLSdV/RiEhSLjHIowfvSbbd/C33/3uwtI6Uzs2KXnRZtka/PpAQ== dependencies: - "@emotion/styled-base" "^10.0.9" - babel-plugin-emotion "^10.0.9" + "@emotion/styled-base" "^10.0.17" + babel-plugin-emotion "^10.0.17" "@emotion/stylis@0.8.3": version "0.8.3" resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.8.3.tgz#3ca7e9bcb31b3cb4afbaeb66156d86ee85e23246" integrity sha512-M3nMfJ6ndJMYloSIbYEBq6G3eqoYD41BpDOxreE8j0cb4fzz/5qvmqU9Mb2hzsXcCnIlGlWhS03PCzVGvTAe0Q== -"@emotion/stylis@^0.7.0": - version "0.7.1" - resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.7.1.tgz#50f63225e712d99e2b2b39c19c70fff023793ca5" - integrity sha512-/SLmSIkN13M//53TtNxgxo57mcJk/UJIDFRKwOiLIBEyBHEcipgR6hNMQ/59Sl4VjCJ0Z/3zeAZyvnSLPG/1HQ== +"@emotion/stylis@0.8.4": + version "0.8.4" + resolved "https://registry.yarnpkg.com/@emotion/stylis/-/stylis-0.8.4.tgz#6c51afdf1dd0d73666ba09d2eb6c25c220d6fe4c" + integrity sha512-TLmkCVm8f8gH0oLv+HWKiu7e8xmBIaokhxcEKPh1m8pXiV/akCiq50FvYgOwY42rjejck8nsdQxZlXZ7pmyBUQ== "@emotion/unitless@0.7.3": version "0.7.3" resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.3.tgz#6310a047f12d21a1036fb031317219892440416f" integrity sha512-4zAPlpDEh2VwXswwr/t8xGNDGg8RQiPxtxZ3qQEXyQsBV39ptTdESCjuBvGze1nLMVrxmTIKmnO/nAV8Tqjjzg== -"@emotion/unitless@^0.6.2", "@emotion/unitless@^0.6.7": - version "0.6.7" - resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.6.7.tgz#53e9f1892f725b194d5e6a1684a7b394df592397" - integrity sha512-Arj1hncvEVqQ2p7Ega08uHLr1JuRYBuO5cIvcA+WWEQ5+VmkOE3ZXzl04NbQxeQpWX78G7u6MqxKuNX3wvYZxg== +"@emotion/unitless@0.7.4": + version "0.7.4" + resolved "https://registry.yarnpkg.com/@emotion/unitless/-/unitless-0.7.4.tgz#a87b4b04e5ae14a88d48ebef15015f6b7d1f5677" + integrity sha512-kBa+cDHOR9jpRJ+kcGMsysrls0leukrm68DmFQoMIWQcXdr2cZvyvypWuGYT7U+9kAExUE7+T7r6G3C3A6L8MQ== "@emotion/utils@0.11.1": version "0.11.1" resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-0.11.1.tgz#8529b7412a6eb4b48bdf6e720cc1b8e6e1e17628" integrity sha512-8M3VN0hetwhsJ8dH8VkVy7xo5/1VoBsDOk/T4SJOeXwTO1c4uIqVNx2qyecLFnnUWD5vvUqHQ1gASSeUN6zcTg== -"@emotion/utils@^0.8.2": - version "0.8.2" - resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-0.8.2.tgz#576ff7fb1230185b619a75d258cbc98f0867a8dc" - integrity sha512-rLu3wcBWH4P5q1CGoSSH/i9hrXs7SlbRLkoq9IGuoPYNGQvDJ3pt/wmOM+XgYjIDRMVIdkUWt0RsfzF50JfnCw== +"@emotion/utils@0.11.2": + version "0.11.2" + resolved "https://registry.yarnpkg.com/@emotion/utils/-/utils-0.11.2.tgz#713056bfdffb396b0a14f1c8f18e7b4d0d200183" + integrity sha512-UHX2XklLl3sIaP6oiMmlVzT0J+2ATTVpf0dHQVyPJHTkOITvXfaSqnRk6mdDhV9pR8T/tHc3cex78IKXssmzrA== "@emotion/weak-memoize@0.2.2": version "0.2.2" resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.2.tgz#63985d3d8b02530e0869962f4da09142ee8e200e" integrity sha512-n/VQ4mbfr81aqkx/XmVicOLjviMuy02eenSdJY33SVA7S2J42EU0P1H0mOogfYedb3wXA0d/LVtBrgTSm04WEA== -"@emotion/weak-memoize@0.2.3": - version "0.2.3" - resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.3.tgz#dfa0c92efe44a1d1a7974fb49ffeb40ef2da5a27" - integrity sha512-zVgvPwGK7c1aVdUVc9Qv7SqepOGRDrqCw7KZPSZziWGxSlbII3gmvGLPzLX4d0n0BMbamBacUrN22zOMyFFEkQ== +"@emotion/weak-memoize@0.2.4": + version "0.2.4" + resolved "https://registry.yarnpkg.com/@emotion/weak-memoize/-/weak-memoize-0.2.4.tgz#622a72bebd1e3f48d921563b4b60a762295a81fc" + integrity sha512-6PYY5DVdAY1ifaQW6XYTnOMihmBVT27elqSjEoodchsGjzYlEsTQMcEhSud99kVawatyTZRTiVkJ/c6lwbQ7nA== "@icons/material@^0.2.4": version "0.2.4" @@ -1744,161 +1776,169 @@ promise "^8.0.3" tslib "^1.9.3" -"@storybook/addon-actions@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-5.1.11.tgz#ebc299b9dfe476b5c65eb5d148c4b064f682ca08" - integrity sha512-Fp4b8cBYrl9zudvamVYTxE1XK2tzg91hgBDoVxIbDvSMZ2aQXSq8B5OFS4eSdvg+ldEOBbvIgUNS1NIw+FGntQ== - dependencies: - "@storybook/addons" "5.1.11" - "@storybook/api" "5.1.11" - "@storybook/components" "5.1.11" - "@storybook/core-events" "5.1.11" - "@storybook/theming" "5.1.11" +"@storybook/addon-actions@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/addon-actions/-/addon-actions-5.2.5.tgz#e8279907367392387d5c3c6af6031f9da2be9816" + integrity sha512-81N+M1GX4XB7Mirhhu3kiZJkjspfk2e1ysoJtwULjWeZfo2CLYLUAil4onr08Os2LH4RLJaj2hpS3hLflBio4g== + dependencies: + "@storybook/addons" "5.2.5" + "@storybook/api" "5.2.5" + "@storybook/client-api" "5.2.5" + "@storybook/components" "5.2.5" + "@storybook/core-events" "5.2.5" + "@storybook/theming" "5.2.5" core-js "^3.0.1" fast-deep-equal "^2.0.1" global "^4.3.2" - lodash "^4.17.11" polished "^3.3.1" prop-types "^15.7.2" react "^16.8.3" react-inspector "^3.0.2" uuid "^3.3.2" -"@storybook/addon-knobs@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/addon-knobs/-/addon-knobs-5.1.11.tgz#a7e7d986b45e8addb25151b81008af1648ef1f2a" - integrity sha512-16GY8IPxVBcmq5TqPtP6254Qw5FvdefDZjIQd+ByJJliQjXZMQKxEl6JhRq98iUfSxEB+6JCPnpKPa666jmCMA== - dependencies: - "@storybook/addons" "5.1.11" - "@storybook/client-api" "5.1.11" - "@storybook/components" "5.1.11" - "@storybook/core-events" "5.1.11" - "@storybook/theming" "5.1.11" +"@storybook/addon-knobs@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/addon-knobs/-/addon-knobs-5.2.5.tgz#cb3c617d2f017fc98c22b6db4384c90556cc074c" + integrity sha512-jr8HvtGciYaJqWgsl8CVYemcvC0Apw9YaLCV/ez8wmB4im94lmotE4llE+ZgpyIn6U6ikUYjQEeNzUMvEn25Xg== + dependencies: + "@storybook/addons" "5.2.5" + "@storybook/api" "5.2.5" + "@storybook/client-api" "5.2.5" + "@storybook/components" "5.2.5" + "@storybook/core-events" "5.2.5" + "@storybook/theming" "5.2.5" + "@types/react-color" "^3.0.1" copy-to-clipboard "^3.0.8" core-js "^3.0.1" escape-html "^1.0.3" fast-deep-equal "^2.0.1" global "^4.3.2" - lodash "^4.17.11" + lodash "^4.17.15" prop-types "^15.7.2" qs "^6.6.0" react-color "^2.17.0" react-lifecycles-compat "^3.0.4" - react-select "^2.2.0" - -"@storybook/addon-notes@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/addon-notes/-/addon-notes-5.1.11.tgz#ad68fd7f3eb8edc1a2f1de26364e777cbe61bf91" - integrity sha512-C+PV8vpS6g2bN96d88imQbi1RFn8wmNGaKUsncyz9ScdX9FhQwlbV8Lv1Lthholw0DwpcOjJVaf3pPml7XssGw== - dependencies: - "@storybook/addons" "5.1.11" - "@storybook/api" "5.1.11" - "@storybook/client-logger" "5.1.11" - "@storybook/components" "5.1.11" - "@storybook/core-events" "5.1.11" - "@storybook/router" "5.1.11" - "@storybook/theming" "5.1.11" + react-select "^3.0.0" + +"@storybook/addon-notes@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/addon-notes/-/addon-notes-5.2.5.tgz#bd5564dcee415f22f259721b5ee4f2faced625ed" + integrity sha512-5zfJNVNN0OuIYmtsyucLtwKt9d8fNNNk1Vm/gDFF0gQvS5MxrK7rbHqiODBJzBRY2KBG4bBQZqbKQ3Eqq/7Zxw== + dependencies: + "@storybook/addons" "5.2.5" + "@storybook/api" "5.2.5" + "@storybook/client-logger" "5.2.5" + "@storybook/components" "5.2.5" + "@storybook/core-events" "5.2.5" + "@storybook/router" "5.2.5" + "@storybook/theming" "5.2.5" core-js "^3.0.1" global "^4.3.2" - markdown-to-jsx "^6.9.3" + markdown-to-jsx "^6.10.3" memoizerific "^1.11.3" prop-types "^15.7.2" util-deprecate "^1.0.2" -"@storybook/addon-options@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/addon-options/-/addon-options-5.1.11.tgz#c93249359f4c3586dc707611392cd342df911125" - integrity sha512-sqquPt/5FBroqsqFrAmHacxS2Bjh9ZmVLJgN7tCBR0be99q5cAJA3o0QNLIG9dS22NRR2qhG3HHOtwUqj+nXpA== +"@storybook/addon-options@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/addon-options/-/addon-options-5.2.5.tgz#eab986dfa9a5716490b5efa4f709fad3467ff9f9" + integrity sha512-uDQmsmI/GcxWF2NecZdBB85g2P3alDqdIauaiFobUGVhYlBKVDyF59RXTh9Xqy0rTaTiiTkWO9Z0UiBywwp6hw== dependencies: - "@storybook/addons" "5.1.11" + "@storybook/addons" "5.2.5" core-js "^3.0.1" util-deprecate "^1.0.2" -"@storybook/addons@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-5.1.11.tgz#27f9cfed8d7f7c8a3fc341cdba3b0bdf608f02aa" - integrity sha512-714Xg6pX4rjDY1urL94w4oOxIiK6jCFSp4oKvqLj7dli5CG7d34Yt9joyTgOb2pkbrgmbMWAZJq0L0iOjHzpzw== +"@storybook/addons@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/addons/-/addons-5.2.5.tgz#e3e23d5ea6eb221df31e1a5d125be47454e9a0e8" + integrity sha512-CvMj7Bs3go9tv5rZuAvFwuwe8p/16LDCHS7+5nVFosvcL8nuN339V3rzakw8nLy/S6XKeZ1ACu4t3vYkreRE3w== dependencies: - "@storybook/api" "5.1.11" - "@storybook/channels" "5.1.11" - "@storybook/client-logger" "5.1.11" + "@storybook/api" "5.2.5" + "@storybook/channels" "5.2.5" + "@storybook/client-logger" "5.2.5" + "@storybook/core-events" "5.2.5" core-js "^3.0.1" global "^4.3.2" util-deprecate "^1.0.2" -"@storybook/api@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/api/-/api-5.1.11.tgz#71ef00285cd8602aad24cdb26c60c5d3c76631e5" - integrity sha512-zzPZM6W67D4YKCbUN4RhC/w+/CtnH/hFbSh/QUBdwXFB1aLh2qA1UTyB8i6m6OA6JgVHBqEkl10KhmeILLv/eA== +"@storybook/api@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/api/-/api-5.2.5.tgz#dcc68c873820485372a47c095a8fc5e4fb53a34c" + integrity sha512-JvLafqFVgA3dIWpLMoGNk4sRuogE5imhD6/g0d8DOwnCID9xowj5xIptSrCTKvGGGxuN3wWRGn6I2lEbY6969g== dependencies: - "@storybook/channels" "5.1.11" - "@storybook/client-logger" "5.1.11" - "@storybook/core-events" "5.1.11" - "@storybook/router" "5.1.11" - "@storybook/theming" "5.1.11" + "@storybook/channels" "5.2.5" + "@storybook/client-logger" "5.2.5" + "@storybook/core-events" "5.2.5" + "@storybook/router" "5.2.5" + "@storybook/theming" "5.2.5" core-js "^3.0.1" fast-deep-equal "^2.0.1" global "^4.3.2" - lodash "^4.17.11" + lodash "^4.17.15" memoizerific "^1.11.3" prop-types "^15.6.2" react "^16.8.3" semver "^6.0.0" shallow-equal "^1.1.0" store2 "^2.7.1" - telejson "^2.2.1" + telejson "^3.0.2" util-deprecate "^1.0.2" -"@storybook/channel-postmessage@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/channel-postmessage/-/channel-postmessage-5.1.11.tgz#e75ab7d59ba19476eb631cdb69ee713c3b956c2b" - integrity sha512-S7Uq7+c9kOJ9BB4H9Uro2+dVhqoMchYCipQzAkD4jIIwK99RNzGdAaRipDC1k0k/C+v2SOa+D5xBbb3XVYPSrg== +"@storybook/channel-postmessage@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/channel-postmessage/-/channel-postmessage-5.2.5.tgz#47397e543a87ea525cbe93f7d85bd8533edc9127" + integrity sha512-GoiC6dUM3YfNKpvj3syxQIQJLHBnH61CfLJzz4xygmn+3keHtjtz6yPHaU4+00MSSP2uDzqePkjgXx4DcLedHA== dependencies: - "@storybook/channels" "5.1.11" - "@storybook/client-logger" "5.1.11" + "@storybook/channels" "5.2.5" + "@storybook/client-logger" "5.2.5" core-js "^3.0.1" global "^4.3.2" - telejson "^2.2.1" + telejson "^3.0.2" -"@storybook/channels@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-5.1.11.tgz#77ddf9d777891f975ac10095772c840fed4c4620" - integrity sha512-MlrjVGNvYOnDvv2JDRhr4wikbnZ8HCFCpVsFqKPFxj7I3OYBR417RvFkydX3Rtx4kwB9rmZEgLhfAfsSytkALg== +"@storybook/channels@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/channels/-/channels-5.2.5.tgz#d6ca2b490281dacb272096563fe760ccb353c4bb" + integrity sha512-I+zB3ym5ozBcNBqyzZbvB6gRIG/ZKKkqy5k6LwKd5NMx7NU7zU74+LQUBBOcSIrigj8kCArZz7rlgb0tlSKXxQ== dependencies: core-js "^3.0.1" -"@storybook/client-api@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-5.1.11.tgz#30d82c09c6c40aa70d932e77b1d1e65526bddc0c" - integrity sha512-znzSxZ1ZCqtEKrFoW7xT8iBbdiAXaQ8RNxQFKHuYPqWX+RLol6S3duEOxu491X2SzUg0StUmrX5qL9Rnth8dRQ== - dependencies: - "@storybook/addons" "5.1.11" - "@storybook/client-logger" "5.1.11" - "@storybook/core-events" "5.1.11" - "@storybook/router" "5.1.11" +"@storybook/client-api@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/client-api/-/client-api-5.2.5.tgz#53151a236b6ffc2088acc4535a08e010013e3278" + integrity sha512-n7CAZ3+DZ7EUdmXbq8mXRb+stOavC8GMw3CzjGSo8O6t4rFcMpZQAzjS0YRX1RG/CGFSv9d3R3TNvEBcBGTwRg== + dependencies: + "@storybook/addons" "5.2.5" + "@storybook/channel-postmessage" "5.2.5" + "@storybook/channels" "5.2.5" + "@storybook/client-logger" "5.2.5" + "@storybook/core-events" "5.2.5" + "@storybook/router" "5.2.5" common-tags "^1.8.0" core-js "^3.0.1" - eventemitter3 "^3.1.0" + eventemitter3 "^4.0.0" global "^4.3.2" is-plain-object "^3.0.0" - lodash "^4.17.11" + lodash "^4.17.15" memoizerific "^1.11.3" qs "^6.6.0" + util-deprecate "^1.0.2" -"@storybook/client-logger@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.1.11.tgz#9509af3021b7a9977f9dba1f2ff038fd3c994437" - integrity sha512-je4To+9zD3SEJsKe9R4u15N4bdXFBR7pdBToaRIur+XSvvShLFehZGseQi+4uPAj8vyG34quGTCeUC/BKY0LwQ== +"@storybook/client-logger@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/client-logger/-/client-logger-5.2.5.tgz#6f386ac6f81b4a783c57d54bb328281abbea1bab" + integrity sha512-6DyYUrMgAvF+th0foH7UNz+2JJpRdvNbpvYKtvi/+hlvRIaI6AqANgLkPUgMibaif5TLzjCr0bLdAYcjeJz03w== dependencies: core-js "^3.0.1" -"@storybook/components@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/components/-/components-5.1.11.tgz#da253af0a8cb1b063c5c2e8016c4540c983f717d" - integrity sha512-EQgD7HL2CWnnY968KrwUSU2dtKFGTGRJVc4vwphYEeZwAI0lX6qbTMuwEP22hDZ2OSRBxcvcXT8cvduDlZlFng== +"@storybook/components@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/components/-/components-5.2.5.tgz#40190dafbee34f083182255d26c19a0ea50789c8" + integrity sha512-6NVaBJm5wY53e9k+2ZiL2ABsHghE1ssQciLTG3jJPahnM6rfkM8ue66rhxhP88jE9isT48JgOZOJepEyxDz/fg== dependencies: - "@storybook/client-logger" "5.1.11" - "@storybook/theming" "5.1.11" + "@storybook/client-logger" "5.2.5" + "@storybook/theming" "5.2.5" + "@types/react-syntax-highlighter" "10.1.0" + "@types/react-textarea-autosize" "^4.3.3" core-js "^3.0.1" global "^4.3.2" markdown-to-jsx "^6.9.1" @@ -1913,39 +1953,39 @@ react-popper-tooltip "^2.8.3" react-syntax-highlighter "^8.0.1" react-textarea-autosize "^7.1.0" - recompose "^0.30.0" simplebar-react "^1.0.0-alpha.6" -"@storybook/core-events@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-5.1.11.tgz#9d00503a936d30398f7a64336eb956303d053765" - integrity sha512-m+yIFRdB47+IPBFBGS2OUXrSLkoz5iAXvb3c0lGAePf5wSR+o/Ni/9VD5l6xBf+InxHLSc9gcDEJehrT0fJAaQ== +"@storybook/core-events@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/core-events/-/core-events-5.2.5.tgz#62881164a4a01aa99ff0691e70eaed2dd58e229e" + integrity sha512-O5GM8XEBbYNbM6Z7a4H1bbnbO2cxQrXMhEwansC7a7YinQdkTPiuGxke3NiyK+7pLDh778kpQyjoCjXq6UfAoQ== dependencies: core-js "^3.0.1" -"@storybook/core@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/core/-/core-5.1.11.tgz#d7c4b14b02f74c183ab5baffe9b3e5ec8289b320" - integrity sha512-LkSoAJlLEtrzFcoINX3dz4oT6xUPEHEp2/WAXLqUFeCnzJHAxIsRvbVxB49Kh/2TrgDFZpL9Or8XXMzZtE6KYw== +"@storybook/core@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/core/-/core-5.2.5.tgz#cc04313480a1847aa6881420c675517cc400dc2e" + integrity sha512-R6A6VzSh++pB1a+9DsywW5Mlp0/eauQz1A8m2DrllWcTHTjbn0ZovlG5HBrKjpknFXpCWxkUKE4eTAE2tWsryA== dependencies: "@babel/plugin-proposal-class-properties" "^7.3.3" "@babel/plugin-proposal-object-rest-spread" "^7.3.2" "@babel/plugin-syntax-dynamic-import" "^7.2.0" "@babel/plugin-transform-react-constant-elements" "^7.2.0" "@babel/preset-env" "^7.4.5" - "@storybook/addons" "5.1.11" - "@storybook/channel-postmessage" "5.1.11" - "@storybook/client-api" "5.1.11" - "@storybook/client-logger" "5.1.11" - "@storybook/core-events" "5.1.11" - "@storybook/node-logger" "5.1.11" - "@storybook/router" "5.1.11" - "@storybook/theming" "5.1.11" - "@storybook/ui" "5.1.11" + "@storybook/addons" "5.2.5" + "@storybook/channel-postmessage" "5.2.5" + "@storybook/client-api" "5.2.5" + "@storybook/client-logger" "5.2.5" + "@storybook/core-events" "5.2.5" + "@storybook/node-logger" "5.2.5" + "@storybook/router" "5.2.5" + "@storybook/theming" "5.2.5" + "@storybook/ui" "5.2.5" airbnb-js-shims "^1 || ^2" + ansi-to-html "^0.6.11" autoprefixer "^9.4.9" babel-plugin-add-react-displayname "^0.0.5" - babel-plugin-emotion "^10.0.9" + babel-plugin-emotion "^10.0.14" babel-plugin-macros "^2.4.5" babel-preset-minify "^0.5.0 || 0.6.0-alpha.5" boxen "^3.0.0" @@ -1955,8 +1995,8 @@ commander "^2.19.0" common-tags "^1.8.0" core-js "^3.0.1" - corejs-upgrade-webpack-plugin "^2.0.0" - css-loader "^2.1.1" + corejs-upgrade-webpack-plugin "^2.2.0" + css-loader "^3.0.0" detect-port "^1.3.0" dotenv-webpack "^1.7.0" ejs "^2.6.1" @@ -1971,7 +2011,7 @@ interpret "^1.2.0" ip "^1.1.5" json5 "^2.1.0" - lazy-universal-dotenv "^3.0.0" + lazy-universal-dotenv "^3.0.1" node-fetch "^2.6.0" open "^6.1.0" pnp-webpack-plugin "1.4.3" @@ -1990,16 +2030,16 @@ style-loader "^0.23.1" terser-webpack-plugin "^1.2.4" unfetch "^4.1.0" - url-loader "^1.1.2" + url-loader "^2.0.1" util-deprecate "^1.0.2" webpack "^4.33.0" webpack-dev-middleware "^3.7.0" webpack-hot-middleware "^2.25.0" -"@storybook/node-logger@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.1.11.tgz#bbf5ad0d148e6c9a9b7cf6f62ad4df4e9fa19e5d" - integrity sha512-LG0KM4lzb9LEffcO3Ps9FcHHsVgQUc/oG+kz3p0u9fljFoL3cJHF1Mb4o+HrSydtdWZs/spwZ/BLEo5n/AByDw== +"@storybook/node-logger@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/node-logger/-/node-logger-5.2.5.tgz#87f53de795db6eed912b54d3cca82fd7b7857771" + integrity sha512-UNyXGOhOr4Bn9wKwBTZABTBXQzrgvGxPLSmvAFZuMx9ZhqoT/EXAuLUl0/wiJtkyuYpoOOskNwIdKxLBdTKS2w== dependencies: chalk "^2.4.2" core-js "^3.0.1" @@ -2007,17 +2047,19 @@ pretty-hrtime "^1.0.3" regenerator-runtime "^0.12.1" -"@storybook/react@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/react/-/react-5.1.11.tgz#227e13670098e52d1537daf9dc349755cea17e0c" - integrity sha512-y8/L2OWvev3fGREhAmToLVDPf8YEZMs5+vzSdzXlVlPkqHyAmWPtLY4sRB6K+TsEF0gwaC5F2BvMnKxbNYwd/Q== +"@storybook/react@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/react/-/react-5.2.5.tgz#f0082d75b14a10642986c7934fcbc8ff855b07fe" + integrity sha512-yPOL0jBEfYo3YkRJkXnIzAQ3L9lTju27mg+0bW+y3lpJAM23ffAxrRyOGV7bzj99EA7dak2lw8Hj4yVHTplBdg== dependencies: "@babel/plugin-transform-react-constant-elements" "^7.2.0" "@babel/preset-flow" "^7.0.0" "@babel/preset-react" "^7.0.0" - "@storybook/core" "5.1.11" - "@storybook/node-logger" "5.1.11" + "@storybook/addons" "5.2.5" + "@storybook/core" "5.2.5" + "@storybook/node-logger" "5.2.5" "@svgr/webpack" "^4.0.3" + "@types/webpack-env" "^1.13.7" babel-plugin-add-react-displayname "^0.0.5" babel-plugin-named-asset-import "^0.3.1" babel-plugin-react-docgen "^3.0.0" @@ -2025,7 +2067,7 @@ common-tags "^1.8.0" core-js "^3.0.1" global "^4.3.2" - lodash "^4.17.11" + lodash "^4.17.15" mini-css-extract-plugin "^0.7.0" prop-types "^15.7.2" react-dev-utils "^9.0.0" @@ -2033,56 +2075,58 @@ semver "^6.0.0" webpack "^4.33.0" -"@storybook/router@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/router/-/router-5.1.11.tgz#75089e9e623482e52ed894c3f0cb0fc6a5372da9" - integrity sha512-Xt7R1IOWLlIxis6VKV9G8F+e/G4G8ng1zXCqoDq+/RlWzlQJ5ccO4bUm2/XGS1rEgY4agMzmzjum18HoATpLGA== +"@storybook/router@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/router/-/router-5.2.5.tgz#a005332bc6aa1e7849503187ad50c41b3f3bef92" + integrity sha512-e6ElDAWSoEW1KSnsTbVwbpzaZ8CNWYw0Ok3b5AHfY2fuSH5L4l6s6k/bP7QSYqvWUeTvkFQYux7A2rOFCriAgA== dependencies: "@reach/router" "^1.2.1" + "@types/reach__router" "^1.2.3" core-js "^3.0.1" global "^4.3.2" + lodash "^4.17.15" memoizerific "^1.11.3" qs "^6.6.0" -"@storybook/theming@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-5.1.11.tgz#0d1af46535f2e601293c999a314905069a93ec3b" - integrity sha512-PtRPfiAWx5pQbTm45yyPB+CuW/vyDmcmNOt+xnDzK52omeWaSD7XK2RfadN3u4QXCgha7zs35Ppx1htJio2NRA== +"@storybook/theming@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/theming/-/theming-5.2.5.tgz#9579e7944f61ded637d1d79be5fb859a617620f5" + integrity sha512-PGZNYrRgAhXFJKnktFpyyKlaDXEhtTi5XPq5ASVJrsPW6l963Mk2EMKSm4TCTxIJhs0Kx4cv2MnNZFDqHf47eg== dependencies: - "@emotion/core" "^10.0.9" - "@emotion/styled" "^10.0.7" - "@storybook/client-logger" "5.1.11" + "@emotion/core" "^10.0.14" + "@emotion/styled" "^10.0.14" + "@storybook/client-logger" "5.2.5" common-tags "^1.8.0" core-js "^3.0.1" deep-object-diff "^1.1.0" - emotion-theming "^10.0.9" + emotion-theming "^10.0.14" global "^4.3.2" memoizerific "^1.11.3" polished "^3.3.1" prop-types "^15.7.2" resolve-from "^5.0.0" -"@storybook/ui@5.1.11": - version "5.1.11" - resolved "https://registry.yarnpkg.com/@storybook/ui/-/ui-5.1.11.tgz#02246f7656f644a36908430de12abbdf4e2a8a72" - integrity sha512-mopuFSwtodvH4HRdaSBlgYxzYca1qyvzZ0BxOPocXhiFfFR+V9NyNJqKKRA3vinWuuZWpYcnPTu3h8skmjMirg== - dependencies: - "@storybook/addons" "5.1.11" - "@storybook/api" "5.1.11" - "@storybook/channels" "5.1.11" - "@storybook/client-logger" "5.1.11" - "@storybook/components" "5.1.11" - "@storybook/core-events" "5.1.11" - "@storybook/router" "5.1.11" - "@storybook/theming" "5.1.11" +"@storybook/ui@5.2.5": + version "5.2.5" + resolved "https://registry.yarnpkg.com/@storybook/ui/-/ui-5.2.5.tgz#0c2c67216e4c808e39cdb48301cafde81b77d074" + integrity sha512-C+5KmeTtdG6xkGXPmFDHPxTcSvVohuFD1399fnzjYhfLlRJ04ix3g16rcyDTxRtrFgFidOyGHdzCypgkdaN8dQ== + dependencies: + "@storybook/addons" "5.2.5" + "@storybook/api" "5.2.5" + "@storybook/channels" "5.2.5" + "@storybook/client-logger" "5.2.5" + "@storybook/components" "5.2.5" + "@storybook/core-events" "5.2.5" + "@storybook/router" "5.2.5" + "@storybook/theming" "5.2.5" copy-to-clipboard "^3.0.8" core-js "^3.0.1" core-js-pure "^3.0.1" - emotion-theming "^10.0.10" + emotion-theming "^10.0.14" fast-deep-equal "^2.0.1" fuse.js "^3.4.4" global "^4.3.2" - lodash "^4.17.11" + lodash "^4.17.15" markdown-to-jsx "^6.9.3" memoizerific "^1.11.3" polished "^3.3.1" @@ -2090,16 +2134,15 @@ qs "^6.6.0" react "^16.8.3" react-dom "^16.8.3" - react-draggable "^3.1.1" + react-draggable "^4.0.3" react-helmet-async "^1.0.2" react-hotkeys "2.0.0-pre4" - react-resize-detector "^4.0.5" - recompose "^0.30.0" + react-sizeme "^2.6.7" regenerator-runtime "^0.13.2" resolve-from "^5.0.0" semver "^6.0.0" store2 "^2.7.1" - telejson "^2.2.1" + telejson "^3.0.2" util-deprecate "^1.0.2" "@svgr/babel-plugin-add-jsx-attribute@^4.2.0": @@ -2265,6 +2308,16 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/history@*": + version "4.7.3" + resolved "https://registry.yarnpkg.com/@types/history/-/history-4.7.3.tgz#856c99cdc1551d22c22b18b5402719affec9839a" + integrity sha512-cS5owqtwzLN5kY+l+KgKdRJ/Cee8tlmQoGQuIE9tWnSmS3JMKzmxo2HIAk2wODMifGwO20d62xZQLYz+RLfXmw== + +"@types/is-function@^1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@types/is-function/-/is-function-1.0.0.tgz#1b0b819b1636c7baf0d6785d030d12edf70c3e83" + integrity sha512-iTs9HReBu7evG77Q4EC8hZnqRt57irBDkK9nvmHroiOIVwYMQc4IvYvdRgwKfYepunIY7Oh/dBuuld+Gj9uo6w== + "@types/istanbul-lib-coverage@*", "@types/istanbul-lib-coverage@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.1.tgz#42995b446db9a48a11a07ec083499a860e9138ff" @@ -2327,6 +2380,28 @@ resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.2.tgz#690a1475b84f2a884fd07cd797c00f5f31356ea8" integrity sha512-ce5d3q03Ex0sy4R14722Rmt6MT07Ua+k4FwDfdcToYJcMKNtRVQvJ6JCAPdAmAnbRb6CsX6aYb9m96NGod9uTw== +"@types/reach__router@^1.2.3": + version "1.2.6" + resolved "https://registry.yarnpkg.com/@types/reach__router/-/reach__router-1.2.6.tgz#b14cf1adbd1a365d204bbf6605cd9dd7b8816c87" + integrity sha512-Oh5DAVr/L2svBvubw6QEFpXGu295Y406BPs4i9t1n2pp7M+q3pmCmhzb9oZV5wncR41KCD3NHl1Yhi7uKnTPsA== + dependencies: + "@types/history" "*" + "@types/react" "*" + +"@types/react-color@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@types/react-color/-/react-color-3.0.1.tgz#5433e2f503ea0e0831cbc6fd0c20f8157d93add0" + integrity sha512-J6mYm43Sid9y+OjZ7NDfJ2VVkeeuTPNVImNFITgQNXodHteKfl/t/5pAR5Z9buodZ2tCctsZjgiMlQOpfntakw== + dependencies: + "@types/react" "*" + +"@types/react-syntax-highlighter@10.1.0": + version "10.1.0" + resolved "https://registry.yarnpkg.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-10.1.0.tgz#9c534e29bbe05dba9beae1234f3ae944836685d4" + integrity sha512-dF49hC4FZp1dIKyzacOrHvqMUe8U2IXyQCQXOcT1e6n64gLBp+xM6qGtPsThIT9XjiIHSg2W5Jc2V5IqekBfnA== + dependencies: + "@types/react" "*" + "@types/react-test-renderer@*": version "16.9.0" resolved "https://registry.yarnpkg.com/@types/react-test-renderer/-/react-test-renderer-16.9.0.tgz#d60f530ecf4c906721511603cca711b4fa830d41" @@ -2334,6 +2409,13 @@ dependencies: "@types/react" "*" +"@types/react-textarea-autosize@^4.3.3": + version "4.3.4" + resolved "https://registry.yarnpkg.com/@types/react-textarea-autosize/-/react-textarea-autosize-4.3.4.tgz#9a93f751c91ad5e86387bce75e3b7e11ed195813" + integrity sha512-LLqG27BJGt8ja9x4umQXbnK9pRd0dI23X/GXBcuf476feOZ+e5QiKJYmWOHwAJC3YLl3YixDSigzfF4gzVQZ5w== + dependencies: + "@types/react" "*" + "@types/react-wait@^0.3.0": version "0.3.0" resolved "https://registry.yarnpkg.com/@types/react-wait/-/react-wait-0.3.0.tgz#6f7ef17571a17e72c7864ede8cf7d3aa525a005e" @@ -2362,6 +2444,11 @@ "@types/react" "*" "@types/react-test-renderer" "*" +"@types/webpack-env@^1.13.7": + version "1.14.1" + resolved "https://registry.yarnpkg.com/@types/webpack-env/-/webpack-env-1.14.1.tgz#0d8a53f308f017c53a5ddc3d07f4d6fa76b790d7" + integrity sha512-0Ki9jAAhKDSuLDXOIMADg54Hu60SuBTEsWaJGGy5cV+SSUQ63J2a+RrYYGrErzz39fXzTibhKrAQJAb8M7PNcA== + "@types/yargs-parser@*": version "13.0.0" resolved "https://registry.yarnpkg.com/@types/yargs-parser/-/yargs-parser-13.0.0.tgz#453743c5bbf9f1bed61d959baab5b06be029b2d0" @@ -2723,6 +2810,13 @@ ansi-styles@^3.2.0, ansi-styles@^3.2.1: dependencies: color-convert "^1.9.0" +ansi-to-html@^0.6.11: + version "0.6.12" + resolved "https://registry.yarnpkg.com/ansi-to-html/-/ansi-to-html-0.6.12.tgz#9dcd1646f17770d02ec065615e97f979f4e313cb" + integrity sha512-qBkIqLW979675mP76yB7yVkzeAWtATegdnDQ0RA3CZzknx0yUlNxMSML4xFdBfTs2GWYFQ1FELfbGbVSPzJ+LA== + dependencies: + entities "^1.1.2" + ansicolors@~0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/ansicolors/-/ansicolors-0.3.2.tgz#665597de86a9ffe3aa9bfbe6cae5c6ea426b4979" @@ -3143,15 +3237,15 @@ babel-plugin-dynamic-import-node@2.3.0, babel-plugin-dynamic-import-node@^2.3.0: dependencies: object.assign "^4.1.0" -babel-plugin-emotion@^10.0.9: - version "10.0.9" - resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.9.tgz#04a0404d5a4084d5296357a393d344c0f8303ae4" - integrity sha512-IfWP12e9/wHtWHxVTzD692Nbcmrmcz2tip7acp6YUqtrP7slAyr5B+69hyZ8jd55GsyNSZwryNnmuDEVe0j+7w== +babel-plugin-emotion@^10.0.14, babel-plugin-emotion@^10.0.17: + version "10.0.21" + resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.21.tgz#9ebeb12edeea3e60a5476b0e07c9868605e65968" + integrity sha512-03o+T6sfVAJhNDcSdLapgv4IeewcFPzxlvBUVdSf7o5PI57ZSxoDvmy+ZulVWSu+rOWAWkEejNcsb29TuzJHbg== dependencies: "@babel/helper-module-imports" "^7.0.0" - "@emotion/hash" "0.7.1" - "@emotion/memoize" "0.7.1" - "@emotion/serialize" "^0.11.6" + "@emotion/hash" "0.7.3" + "@emotion/memoize" "0.7.3" + "@emotion/serialize" "^0.11.11" babel-plugin-macros "^2.0.0" babel-plugin-syntax-jsx "^6.18.0" convert-source-map "^1.5.0" @@ -3159,23 +3253,21 @@ babel-plugin-emotion@^10.0.9: find-root "^1.1.0" source-map "^0.5.7" -babel-plugin-emotion@^9.2.11: - version "9.2.11" - resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-9.2.11.tgz#319c005a9ee1d15bb447f59fe504c35fd5807728" - integrity sha512-dgCImifnOPPSeXod2znAmgc64NhaaOjGEHROR/M+lmStb3841yK1sgaDYAYMnlvWNz8GnpwIPN0VmNpbWYZ+VQ== +babel-plugin-emotion@^10.0.9: + version "10.0.9" + resolved "https://registry.yarnpkg.com/babel-plugin-emotion/-/babel-plugin-emotion-10.0.9.tgz#04a0404d5a4084d5296357a393d344c0f8303ae4" + integrity sha512-IfWP12e9/wHtWHxVTzD692Nbcmrmcz2tip7acp6YUqtrP7slAyr5B+69hyZ8jd55GsyNSZwryNnmuDEVe0j+7w== dependencies: "@babel/helper-module-imports" "^7.0.0" - "@emotion/babel-utils" "^0.6.4" - "@emotion/hash" "^0.6.2" - "@emotion/memoize" "^0.6.1" - "@emotion/stylis" "^0.7.0" + "@emotion/hash" "0.7.1" + "@emotion/memoize" "0.7.1" + "@emotion/serialize" "^0.11.6" babel-plugin-macros "^2.0.0" babel-plugin-syntax-jsx "^6.18.0" convert-source-map "^1.5.0" + escape-string-regexp "^1.0.5" find-root "^1.1.0" - mkdirp "^0.5.1" source-map "^0.5.7" - touch "^2.0.1" babel-plugin-istanbul@^5.1.0: version "5.1.1" @@ -3514,6 +3606,11 @@ base@^0.11.1: mixin-deep "^1.2.0" pascalcase "^0.1.1" +batch-processor@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/batch-processor/-/batch-processor-1.0.0.tgz#75c95c32b748e0850d10c2b168f6bdbe9891ace8" + integrity sha1-dclcMrdI4IUNEMKxaPa9vpiRrOg= + bcrypt-pbkdf@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz#a4301d389b6a43f9b67ff3ca11a3f6637e360e9e" @@ -3920,7 +4017,7 @@ camelcase@^4.0.0, camelcase@^4.1.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd" integrity sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0= -camelcase@^5.0.0, camelcase@^5.2.0, camelcase@^5.3.1: +camelcase@^5.0.0, camelcase@^5.3.1: version "5.3.1" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== @@ -3985,11 +4082,6 @@ chalk@^1.0.0, chalk@^1.1.3: strip-ansi "^3.0.0" supports-color "^2.0.0" -change-emitter@^0.1.2: - version "0.1.6" - resolved "https://registry.yarnpkg.com/change-emitter/-/change-emitter-0.1.6.tgz#e8b2fe3d7f1ab7d69a32199aff91ea6931409515" - integrity sha1-6LL+PX8at9aaMhma/5HqaTFAlRU= - character-entities-legacy@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/character-entities-legacy/-/character-entities-legacy-1.1.2.tgz#7c6defb81648498222c9855309953d05f4d63a9c" @@ -4487,7 +4579,7 @@ core-util-is@1.0.2, core-util-is@~1.0.0: resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac= -corejs-upgrade-webpack-plugin@^2.0.0: +corejs-upgrade-webpack-plugin@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/corejs-upgrade-webpack-plugin/-/corejs-upgrade-webpack-plugin-2.2.0.tgz#503293bf1fdcb104918eb40d0294e4776ad6923a" integrity sha512-J0QMp9GNoiw91Kj/dkIQFZeiCXgXoja/Wlht1SPybxerBWh4NCmb0pOgCv61lrlQZETwvVVfAFAA3IqoEO9aqQ== @@ -4513,19 +4605,6 @@ create-ecdh@^4.0.0: bn.js "^4.1.0" elliptic "^6.0.0" -create-emotion@^9.2.12: - version "9.2.12" - resolved "https://registry.yarnpkg.com/create-emotion/-/create-emotion-9.2.12.tgz#0fc8e7f92c4f8bb924b0fef6781f66b1d07cb26f" - integrity sha512-P57uOF9NL2y98Xrbl2OuiDQUZ30GVmASsv5fbsjF4Hlraip2kyAvMm+2PoYUvFFw03Fhgtxk3RqZSm2/qHL9hA== - dependencies: - "@emotion/hash" "^0.6.2" - "@emotion/memoize" "^0.6.1" - "@emotion/stylis" "^0.7.0" - "@emotion/unitless" "^0.6.2" - csstype "^2.5.2" - stylis "^3.5.0" - stylis-rule-sheet "^0.0.10" - create-error-class@^3.0.0: version "3.0.2" resolved "https://registry.yarnpkg.com/create-error-class/-/create-error-class-3.0.2.tgz#06be7abef947a3f14a30fd610671d401bca8b7b6" @@ -4614,22 +4693,23 @@ css-in-js-utils@^2.0.0: hyphenate-style-name "^1.0.2" isobject "^3.0.1" -css-loader@^2.1.1: - version "2.1.1" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-2.1.1.tgz#d8254f72e412bb2238bb44dd674ffbef497333ea" - integrity sha512-OcKJU/lt232vl1P9EEDamhoO9iKY3tIjY5GU+XDLblAykTdgs6Ux9P1hTHve8nFKy5KPpOXOsVI/hIwi3841+w== +css-loader@^3.0.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-3.2.0.tgz#bb570d89c194f763627fcf1f80059c6832d009b2" + integrity sha512-QTF3Ud5H7DaZotgdcJjGMvyDj5F3Pn1j/sC6VBEOVp94cbwqyIBdcs/quzj4MC1BKQSrTpQznegH/5giYbhnCQ== dependencies: - camelcase "^5.2.0" - icss-utils "^4.1.0" + camelcase "^5.3.1" + cssesc "^3.0.0" + icss-utils "^4.1.1" loader-utils "^1.2.3" normalize-path "^3.0.0" - postcss "^7.0.14" + postcss "^7.0.17" postcss-modules-extract-imports "^2.0.0" - postcss-modules-local-by-default "^2.0.6" + postcss-modules-local-by-default "^3.0.2" postcss-modules-scope "^2.1.0" - postcss-modules-values "^2.0.0" - postcss-value-parser "^3.3.0" - schema-utils "^1.0.0" + postcss-modules-values "^3.0.0" + postcss-value-parser "^4.0.0" + schema-utils "^2.0.0" css-select-base-adapter@^0.1.1: version "0.1.1" @@ -4701,7 +4781,7 @@ cssstyle@^1.0.0: dependencies: cssom "0.3.x" -csstype@^2.2.0, csstype@^2.5.2, csstype@^2.5.5, csstype@^2.5.7: +csstype@^2.2.0, csstype@^2.5.5, csstype@^2.5.7: version "2.6.3" resolved "https://registry.yarnpkg.com/csstype/-/csstype-2.6.3.tgz#b701e5968245bf9b08d54ac83d00b624e622a9fa" integrity sha512-rINUZXOkcBmoHWEyu7JdHu5JMzkGRoMX4ov9830WNgxf5UYxcBUO0QTKAqeJ5EZfSdlrcJYkC8WwfVW7JYi4yg== @@ -5180,6 +5260,13 @@ elegant-spinner@^1.0.1: resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" integrity sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4= +element-resize-detector@^1.1.15: + version "1.1.15" + resolved "https://registry.yarnpkg.com/element-resize-detector/-/element-resize-detector-1.1.15.tgz#48eba1a2eaa26969a4c998d972171128c971d8d2" + integrity sha512-16/5avDegXlUxytGgaumhjyQoM6hpp5j3+L79sYq5hlXfTNRy5WMMuTVWkZU3egp/CokCmTmvf18P3KeB57Iog== + dependencies: + batch-processor "^1.0.0" + elliptic@^6.0.0: version "6.5.0" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.0.tgz#2b8ed4c891b7de3200e14412a5b8248c7af505ca" @@ -5208,23 +5295,15 @@ emojis-list@^2.0.0: resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-2.1.0.tgz#4daa4d9db00f9819880c79fa457ae5b09a1fd389" integrity sha1-TapNnbAPmBmIDHn6RXrlsJof04k= -emotion-theming@^10.0.10, emotion-theming@^10.0.9: - version "10.0.14" - resolved "https://registry.yarnpkg.com/emotion-theming/-/emotion-theming-10.0.14.tgz#e548d388493d07bedbb0d9d3bbe221766174b1f4" - integrity sha512-zMGhPSYz48AAR6DYjQVaZHeO42cYKPq4VyB1XjxzgR62/NmO99679fx8qDDB1QZVYGkRWZtsOe+zJE/e30XdbA== +emotion-theming@^10.0.14: + version "10.0.19" + resolved "https://registry.yarnpkg.com/emotion-theming/-/emotion-theming-10.0.19.tgz#66d13db74fccaefad71ba57c915b306cf2250295" + integrity sha512-dQRBPLAAQ6eA8JKhkLCIWC8fdjPbiNC1zNTdFF292h9amhZXofcNGUP7axHoHX4XesqQESYwZrXp53OPInMrKw== dependencies: - "@babel/runtime" "^7.4.3" - "@emotion/weak-memoize" "0.2.3" + "@babel/runtime" "^7.5.5" + "@emotion/weak-memoize" "0.2.4" hoist-non-react-statics "^3.3.0" -emotion@^9.1.2: - version "9.2.12" - resolved "https://registry.yarnpkg.com/emotion/-/emotion-9.2.12.tgz#53925aaa005614e65c6e43db8243c843574d1ea9" - integrity sha512-hcx7jppaI8VoXxIWEhxpDW7I+B4kq9RNzQLmsrF6LY8BGKqe2N+gFAQr0EfuFucFlPs2A9HM4+xNj4NeqEWIOQ== - dependencies: - babel-plugin-emotion "^9.2.11" - create-emotion "^9.2.12" - encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" @@ -5253,7 +5332,7 @@ enhanced-resolve@^4.0.0, enhanced-resolve@^4.1.0: memory-fs "^0.4.0" tapable "^1.0.0" -entities@^1.1.1: +entities@^1.1.1, entities@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/entities/-/entities-1.1.2.tgz#bdfa735299664dfafd34529ed4f8522a275fea56" integrity sha512-f2LZMYl1Fzu7YSBKg+RoROelpOaNrcGmE9AZubeDfrCEia483oW4MI4VyFd5VNHIgQ/7qm1I0wUHK1eJnn2y2w== @@ -5415,10 +5494,10 @@ etag@~1.8.1: resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887" integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc= -eventemitter3@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.0.tgz#090b4d6cdbd645ed10bf750d4b5407942d7ba163" - integrity sha512-ivIvhpq/Y0uSjcHDcOIccjmYjGLcP09MFGE7ysAwkAvkXfpZlC985pH2/ui64DKazbTW/4kN3yqozUxlXzI6cA== +eventemitter3@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.0.tgz#d65176163887ee59f386d64c82610b696a4a74eb" + integrity sha512-qerSRB0p+UDEssxTtm6EDKcE7W4OaoisfIMl4CngyEhjpYglocpNg6UEqCvemdGhosAsg4sO2dXJOdyBifPGCg== events@^3.0.0: version "3.0.0" @@ -5682,7 +5761,7 @@ fb-watchman@^2.0.0: dependencies: bser "^2.0.0" -fbjs@^0.8.0, fbjs@^0.8.1: +fbjs@^0.8.0: version "0.8.17" resolved "https://registry.yarnpkg.com/fbjs/-/fbjs-0.8.17.tgz#c4d598ead6949112653d6588b01a5cdcd9f90fdd" integrity sha1-xNWY6taUkRJlPWWIsBpc3Nn5D90= @@ -6253,6 +6332,14 @@ global@^4.3.2: min-document "^2.19.0" process "~0.5.1" +global@^4.4.0: + version "4.4.0" + resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406" + integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w== + dependencies: + min-document "^2.19.0" + process "^0.11.10" + globals@^11.1.0: version "11.11.0" resolved "https://registry.yarnpkg.com/globals/-/globals-11.11.0.tgz#dcf93757fa2de5486fbeed7118538adf789e9c2e" @@ -6496,11 +6583,6 @@ hmac-drbg@^1.0.0: minimalistic-assert "^1.0.0" minimalistic-crypto-utils "^1.0.1" -hoist-non-react-statics@^2.3.1: - version "2.5.5" - resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-2.5.5.tgz#c5903cf409c0dfd908f388e619d86b9c1174cb47" - integrity sha512-rqcy4pJo55FTTLWt+bU8ukscqHeE/e9KWvsOW2b/a3afxQZhwkQdT1rPPCJ0rYXdj4vNcasY8zHTH+jF/qStxw== - hoist-non-react-statics@^3.3.0: version "3.3.0" resolved "https://registry.yarnpkg.com/hoist-non-react-statics/-/hoist-non-react-statics-3.3.0.tgz#b09178f0122184fb95acf525daaecb4d8f45958b" @@ -6677,12 +6759,7 @@ iconv-lite@0.4.24, iconv-lite@^0.4.24, iconv-lite@^0.4.4, iconv-lite@~0.4.13: dependencies: safer-buffer ">= 2.1.2 < 3" -icss-replace-symbols@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz#06ea6f83679a7749e386cfe1fe812ae5db223ded" - integrity sha1-Bupvg2ead0njhs/h/oEq5dsiPe0= - -icss-utils@^4.1.0: +icss-utils@^4.0.0, icss-utils@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-4.1.1.tgz#21170b53789ee27447c2f47dd683081403f9a467" integrity sha512-4aFq7wvWyMHKgxsH8QQtGpvbASCf+eM3wPRLI6R+MgAnTCZ6STYsRvttLvRWK0Nfif5piF394St3HeJDaljGPA== @@ -7933,7 +8010,7 @@ lazy-property@~1.0.0: resolved "https://registry.yarnpkg.com/lazy-property/-/lazy-property-1.0.0.tgz#84ddc4b370679ba8bd4cdcfa4c06b43d57111147" integrity sha1-hN3Es3Bnm6i9TNz6TAa0PVcREUc= -lazy-universal-dotenv@^3.0.0: +lazy-universal-dotenv@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/lazy-universal-dotenv/-/lazy-universal-dotenv-3.0.1.tgz#a6c8938414bca426ab8c9463940da451a911db38" integrity sha512-prXSYk799h3GY3iOWnC6ZigYzMPjxN2svgjJ9shk7oMadSNX3wXy0B6F32PMJv7qtMnrIbUxoEHzbutvxR2LBQ== @@ -8234,11 +8311,6 @@ lockfile@^1.0.4: dependencies: signal-exit "^3.0.2" -lodash-es@^4.17.11: - version "4.17.15" - resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78" - integrity sha512-rlrc3yU3+JNOpZ9zj5pQtxnx2THmvRykwL4Xlxoa8I9lHBlVbbyPhgyPMioxVZ4NqyxaVVtaJnzsyOidQIhyyQ== - lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -8277,11 +8349,6 @@ lodash.escaperegexp@^4.1.2: resolved "https://registry.yarnpkg.com/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz#64762c48618082518ac3df4ccf5d5886dae20347" integrity sha1-ZHYsSGGAglGKw99Mz11YhtriA0c= -lodash.get@^4.4.2: - version "4.4.2" - resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" - integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= - lodash.isplainobject@^4.0.6: version "4.0.6" resolved "https://registry.yarnpkg.com/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz#7c526a52d89b45c45cc690b88163be0497f550cb" @@ -8514,6 +8581,14 @@ markdown-loader@5.1.0: loader-utils "^1.2.3" marked "^0.7.0" +markdown-to-jsx@^6.10.3: + version "6.10.3" + resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.10.3.tgz#7f0946684acd321125ff2de7fd258a9b9c7c40b7" + integrity sha512-PSoUyLnW/xoW6RsxZrquSSz5eGEOTwa15H5eqp3enmrp8esmgDJmhzd6zmQ9tgAA9TxJzx1Hmf3incYU/IamoQ== + dependencies: + prop-types "^15.6.2" + unquote "^1.1.0" + markdown-to-jsx@^6.9.1, markdown-to-jsx@^6.9.3: version "6.10.2" resolved "https://registry.yarnpkg.com/markdown-to-jsx/-/markdown-to-jsx-6.10.2.tgz#644f602b81d088f10aef1c3674874876146cf38b" @@ -8701,7 +8776,7 @@ mime@1.6.0: resolved "https://registry.yarnpkg.com/mime/-/mime-1.6.0.tgz#32cd9e5c64553bd58d19a568af452acff04981b1" integrity sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg== -mime@^2.0.3, mime@^2.4.2: +mime@^2.0.3, mime@^2.4.2, mime@^2.4.4: version "2.4.4" resolved "https://registry.yarnpkg.com/mime/-/mime-2.4.4.tgz#bd7b91135fc6b01cde3e9bae33d659b63d8857e5" integrity sha512-LRxmNwziLPT828z+4YkNzloCFC2YM4wrB99k+AV5ZbEyfGNWfG8SO1FUXLmLDBSo89NrJZ4DIWeLjy1CHGhMGA== @@ -9073,13 +9148,6 @@ nopt@^4.0.1, nopt@~4.0.1: abbrev "1" osenv "^0.1.4" -nopt@~1.0.10: - version "1.0.10" - resolved "https://registry.yarnpkg.com/nopt/-/nopt-1.0.10.tgz#6ddd21bd2a31417b92727dd585f8a6f37608ebee" - integrity sha1-bd0hvSoxQXuScn3Vhfim83YI6+4= - dependencies: - abbrev "1" - normalize-package-data@^2.0.0, normalize-package-data@^2.3.2, normalize-package-data@^2.3.4, normalize-package-data@^2.4.0, normalize-package-data@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" @@ -10025,14 +10093,15 @@ postcss-modules-extract-imports@^2.0.0: dependencies: postcss "^7.0.5" -postcss-modules-local-by-default@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-2.0.6.tgz#dd9953f6dd476b5fd1ef2d8830c8929760b56e63" - integrity sha512-oLUV5YNkeIBa0yQl7EYnxMgy4N6noxmiwZStaEJUSe2xPMcdNc8WmBQuQCx18H5psYbVxz8zoHk0RAAYZXP9gA== +postcss-modules-local-by-default@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-3.0.2.tgz#e8a6561be914aaf3c052876377524ca90dbb7915" + integrity sha512-jM/V8eqM4oJ/22j0gx4jrp63GSvDH6v86OqyTHHUvk4/k1vceipZsaymiZ5PvocqZOl5SFHiFJqjs3la0wnfIQ== dependencies: - postcss "^7.0.6" - postcss-selector-parser "^6.0.0" - postcss-value-parser "^3.3.1" + icss-utils "^4.1.1" + postcss "^7.0.16" + postcss-selector-parser "^6.0.2" + postcss-value-parser "^4.0.0" postcss-modules-scope@^2.1.0: version "2.1.0" @@ -10042,15 +10111,15 @@ postcss-modules-scope@^2.1.0: postcss "^7.0.6" postcss-selector-parser "^6.0.0" -postcss-modules-values@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-2.0.0.tgz#479b46dc0c5ca3dc7fa5270851836b9ec7152f64" - integrity sha512-Ki7JZa7ff1N3EIMlPnGTZfUMe69FFwiQPnVSXC9mnn3jozCRBYIxiZd44yJOV2AmabOo4qFf8s0dC/+lweG7+w== +postcss-modules-values@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-3.0.0.tgz#5b5000d6ebae29b4255301b4a3a54574423e7f10" + integrity sha512-1//E5jCBrZ9DmRX+zCtmQtRSV6PV42Ix7Bzj9GbwJceduuf7IqP8MgeTXuRDHOWj2m0VzZD5+roFWDuU8RQjcg== dependencies: - icss-replace-symbols "^1.1.0" + icss-utils "^4.0.0" postcss "^7.0.6" -postcss-selector-parser@^6.0.0: +postcss-selector-parser@^6.0.0, postcss-selector-parser@^6.0.2: version "6.0.2" resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.2.tgz#934cf799d016c83411859e09dcecade01286ec5c" integrity sha512-36P2QR59jDTOAiIkqEprfJDsoNrvwFei3eCqKd1Y0tUsBimsq39BLp7RD+JWny3WgB1zGhJX8XVePwm9k4wdBg== @@ -10059,11 +10128,6 @@ postcss-selector-parser@^6.0.0: indexes-of "^1.0.1" uniq "^1.0.1" -postcss-value-parser@^3.3.0, postcss-value-parser@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-3.3.1.tgz#9ff822547e2893213cf1c30efa51ac5fd1ba8281" - integrity sha512-pISE66AbVkp4fDQ7VHBwRNXzAAKJjw4Vw7nWI/+Q3vuly7SNfgYXvm6i5IgFylHGK5sP/xHAbB7N49OS4gWNyQ== - postcss-value-parser@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.1.tgz#e3f6172cc91302912c89da55a42454025485250f" @@ -10078,6 +10142,15 @@ postcss@^7.0.0, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.5, postcss@^7.0.6 source-map "^0.6.1" supports-color "^6.1.0" +postcss@^7.0.16: + version "7.0.18" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.18.tgz#4b9cda95ae6c069c67a4d933029eddd4838ac233" + integrity sha512-/7g1QXXgegpF+9GJj4iN7ChGF40sYuGYJ8WZu8DZWnmhQ/G36hfdk3q9LBJmoK+lZ+yzZ5KYpOoxq7LF1BxE8g== + dependencies: + chalk "^2.4.2" + source-map "^0.6.1" + supports-color "^6.1.0" + prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" @@ -10368,23 +10441,11 @@ qw@~1.0.1: resolved "https://registry.yarnpkg.com/qw/-/qw-1.0.1.tgz#efbfdc740f9ad054304426acb183412cc8b996d4" integrity sha1-77/cdA+a0FQwRCassYNBLMi5ltQ= -raf-schd@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/raf-schd/-/raf-schd-4.0.2.tgz#bd44c708188f2e84c810bf55fcea9231bcaed8a0" - integrity sha512-VhlMZmGy6A6hrkJWHLNTGl5gtgMUm+xfGza6wbwnE914yeQ5Ybm18vgM734RZhMgfw4tacUrWseGZlpUrrakEQ== - raf-stub@3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/raf-stub/-/raf-stub-3.0.0.tgz#40e53dc3ad3b241311f914bbd41dc11a2c9ee0a9" integrity sha512-64wjDTI8NAkplC3WYF3DUBXmdx8AZF0ubxiicZi83BKW5hcdvMtbwDe6gpFBngTo6+XIJbfwmUP8lMa85UPK6A== -raf@^3.4.0: - version "3.4.0" - resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.0.tgz#a28876881b4bc2ca9117d4138163ddb80f781575" - integrity sha512-pDP/NMRAXoTfrhCfyfSEwJAKLaxBU9eApMeBPB1TkDouZmvPerIClV8lTAd+uF8ZiTaVl69e1FCxQrAd/VTjGw== - dependencies: - performance-now "^2.1.0" - ramda@^0.21.0: version "0.21.0" resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.21.0.tgz#a001abedb3ff61077d4ff1d577d44de77e8d0a35" @@ -10522,10 +10583,10 @@ react-dom@^16.8.3: prop-types "^15.6.2" scheduler "^0.15.0" -react-draggable@^3.1.1: - version "3.3.0" - resolved "https://registry.yarnpkg.com/react-draggable/-/react-draggable-3.3.0.tgz#2ed7ea3f92e7d742d747f9e6324860606cd4d997" - integrity sha512-U7/jD0tAW4T0S7DCPK0kkKLyL0z61sC/eqU+NUfDjnq+JtBKaYKDHpsK2wazctiA4alEzCXUnzkREoxppOySVw== +react-draggable@^4.0.3: + version "4.0.3" + resolved "https://registry.yarnpkg.com/react-draggable/-/react-draggable-4.0.3.tgz#6b9f76f66431c47b9070e9b805bbc520df8ca481" + integrity sha512-4vD6zms+9QGeZ2RQXzlUBw8PBYUXy+dzYX5r22idjp9YwQKIIvD/EojL0rbjS1GK4C3P0rAJnmKa8gDQYWUDyA== dependencies: classnames "^2.2.5" prop-types "^15.6.0" @@ -10573,10 +10634,10 @@ react-hotkeys@2.0.0-pre4: dependencies: prop-types "^15.6.1" -react-input-autosize@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/react-input-autosize/-/react-input-autosize-2.2.1.tgz#ec428fa15b1592994fb5f9aa15bb1eb6baf420f8" - integrity sha512-3+K4CD13iE4lQQ2WlF8PuV5htfmTRLH6MDnfndHM6LuBRszuXnuyIfE7nhSKt8AzRBZ50bu0sAhkNMeS5pxQQA== +react-input-autosize@^2.2.2: + version "2.2.2" + resolved "https://registry.yarnpkg.com/react-input-autosize/-/react-input-autosize-2.2.2.tgz#fcaa7020568ec206bc04be36f4eb68e647c4d8c2" + integrity sha512-jQJgYCA3S0j+cuOwzuCd1OjmBmnZLdqQdiLKRYrsMMzbjUrVDS5RvJUDwJqA7sKuksDuzFtm6hZGKFu7Mjk5aw== dependencies: prop-types "^15.5.8" @@ -10599,7 +10660,7 @@ react-is@^16.8.6: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.10.0.tgz#3d6a031e57fff73c3cfa0347feb3e8f40c5141e5" integrity sha512-WRki2sBb7MTpYp7FtDEmSeGKX2vamYyq3rc9o7fKUG+/DHVyJu69NnvJsiSwwhh2Tt8XN40MQHkDBEXwyfxncQ== -react-lifecycles-compat@^3.0.2, react-lifecycles-compat@^3.0.4: +react-lifecycles-compat@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362" integrity sha512-fBASbA6LnOU9dOU2eW7aQ8xmYBSXUIWr+UmF9b1efZBazGNO+rcXT/icdKnYm2pTwcRylVUYwW7H1PHfLekVzA== @@ -10624,30 +10685,30 @@ react-popper@^1.3.3: typed-styles "^0.0.7" warning "^4.0.2" -react-resize-detector@^4.0.5: - version "4.2.0" - resolved "https://registry.yarnpkg.com/react-resize-detector/-/react-resize-detector-4.2.0.tgz#b87aee6b37c9e8a52daca8736b3230cf6a2a8647" - integrity sha512-AtOaNIxs0ydua7tEoglXR3902/EdlIj9PXDu1Zj0ug2VAUnkSQjguLGzaG/N6CXLOhJSccTsUCZxjLayQ1mE9Q== +react-select@^3.0.0: + version "3.0.8" + resolved "https://registry.yarnpkg.com/react-select/-/react-select-3.0.8.tgz#06ff764e29db843bcec439ef13e196865242e0c1" + integrity sha512-v9LpOhckLlRmXN5A6/mGGEft4FMrfaBFTGAnuPHcUgVId7Je42kTq9y0Z+Ye5z8/j0XDT3zUqza8gaRaI1PZIg== dependencies: - lodash "^4.17.11" - lodash-es "^4.17.11" - prop-types "^15.7.2" - raf-schd "^4.0.0" - resize-observer-polyfill "^1.5.1" - -react-select@^2.2.0: - version "2.4.4" - resolved "https://registry.yarnpkg.com/react-select/-/react-select-2.4.4.tgz#ba72468ef1060c7d46fbb862b0748f96491f1f73" - integrity sha512-C4QPLgy9h42J/KkdrpVxNmkY6p4lb49fsrbDk/hRcZpX7JvZPNb6mGj+c5SzyEtBv1DmQ9oPH4NmhAFvCrg8Jw== - dependencies: - classnames "^2.2.5" - emotion "^9.1.2" + "@babel/runtime" "^7.4.4" + "@emotion/cache" "^10.0.9" + "@emotion/core" "^10.0.9" + "@emotion/css" "^10.0.9" memoize-one "^5.0.0" prop-types "^15.6.0" - raf "^3.4.0" - react-input-autosize "^2.2.1" + react-input-autosize "^2.2.2" react-transition-group "^2.2.1" +react-sizeme@^2.6.7: + version "2.6.10" + resolved "https://registry.yarnpkg.com/react-sizeme/-/react-sizeme-2.6.10.tgz#9993dcb5e67fab94a8e5d078a0d3820609010f17" + integrity sha512-OJAPQxSqbcpbsXFD+fr5ARw4hNSAOimWcaTOLcRkIqnTp9+IFWY0w3Qdw1sMez6Ao378aimVL/sW6TTsgigdOA== + dependencies: + element-resize-detector "^1.1.15" + invariant "^2.2.4" + shallowequal "^1.1.0" + throttle-debounce "^2.1.0" + react-spring@8.0.27: version "8.0.27" resolved "https://registry.yarnpkg.com/react-spring/-/react-spring-8.0.27.tgz#97d4dee677f41e0b2adcb696f3839680a3aa356a" @@ -10920,18 +10981,6 @@ rechoir@^0.6.2: dependencies: resolve "^1.1.6" -recompose@^0.30.0: - version "0.30.0" - resolved "https://registry.yarnpkg.com/recompose/-/recompose-0.30.0.tgz#82773641b3927e8c7d24a0d87d65aeeba18aabd0" - integrity sha512-ZTrzzUDa9AqUIhRk4KmVFihH0rapdCSMFXjhHbNrjAWxBuUD/guYlyysMnuHjlZC/KRiOKRtB4jf96yYSkKE8w== - dependencies: - "@babel/runtime" "^7.0.0" - change-emitter "^0.1.2" - fbjs "^0.8.1" - hoist-non-react-statics "^2.3.1" - react-lifecycles-compat "^3.0.2" - symbol-observable "^1.0.4" - recursive-readdir@2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.2.2.tgz#9946fb3274e1628de6e36b2f6714953b4845094f" @@ -11411,6 +11460,14 @@ schema-utils@^1.0.0: ajv-errors "^1.0.0" ajv-keywords "^3.1.0" +schema-utils@^2.0.0, schema-utils@^2.4.1: + version "2.5.0" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-2.5.0.tgz#8f254f618d402cc80257486213c8970edfd7c22f" + integrity sha512-32ISrwW2scPXHUSusP8qMg5dLUawKkyV+/qIEV9JdXKx+rsM6mi8vZY8khg2M69Qom16rtroWXD3Ybtiws38gQ== + dependencies: + ajv "^6.10.2" + ajv-keywords "^3.4.1" + screenfull@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/screenfull/-/screenfull-5.0.0.tgz#5c2010c0e84fd4157bf852877698f90b8cbe96f6" @@ -11846,11 +11903,6 @@ source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.0, source-map@~0.6.1: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@^0.7.2: - version "0.7.3" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.3.tgz#5302f8169031735226544092e64981f751750383" - integrity sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ== - sourcemap-codec@^1.4.1: version "1.4.3" resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.3.tgz#0ba615b73ec35112f63c2f2d9e7c3f87282b0e33" @@ -12234,12 +12286,7 @@ style-loader@^0.23.1: loader-utils "^1.1.0" schema-utils "^1.0.0" -stylis-rule-sheet@^0.0.10: - version "0.0.10" - resolved "https://registry.yarnpkg.com/stylis-rule-sheet/-/stylis-rule-sheet-0.0.10.tgz#44e64a2b076643f4b52e5ff71efc04d8c3c4a430" - integrity sha512-nTbZoaqoBnmK+ptANthb10ZRZOGC+EmTLLUxeYIuHNkEKcmKgXX1XWKkUBT2Ac4es3NybooPe0SmvKdhKJZAuw== - -stylis@3.5.0, stylis@^3.5.0: +stylis@3.5.0: version "3.5.0" resolved "https://registry.yarnpkg.com/stylis/-/stylis-3.5.0.tgz#016fa239663d77f868fef5b67cf201c4b7c701e1" integrity sha512-pP7yXN6dwMzAR29Q0mBrabPCe0/mNO1MSr93bhay+hcZondvMMTpeGyd8nbhYJdyperNT2DRxONQuUGcJr5iPw== @@ -12295,7 +12342,7 @@ svgo@^1.2.2: unquote "~1.1.1" util.promisify "~1.0.0" -symbol-observable@^1.0.4, symbol-observable@^1.1.0: +symbol-observable@^1.1.0: version "1.2.0" resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-1.2.0.tgz#c22688aed4eab3cdc2dfeacbb561660560a00804" integrity sha512-e900nM8RRtGhlV36KGEU9k65K3mPb1WV70OdjfxlG2EAuM1noi/E/BaW/uMhL7bPEssK8QV57vN3esixjUvcXQ== @@ -12339,17 +12386,18 @@ tar@^4, tar@^4.4.8: safe-buffer "^5.1.2" yallist "^3.0.2" -telejson@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/telejson/-/telejson-2.2.1.tgz#d9ee7e7eba0c81d9378257342fde7142a03787e2" - integrity sha512-JtFAnITek+Z9t+uQjVl4Fxur9Z3Bi3flytBLc3KZVXmMUHLXdtAxiP0g8IBkHvKn1kQIYZC57IG0jjGH1s64HQ== +telejson@^3.0.2: + version "3.0.3" + resolved "https://registry.yarnpkg.com/telejson/-/telejson-3.0.3.tgz#442af55f78d791d3744c9e7a696be6cdf789a4b5" + integrity sha512-gUOh6wox1zJjbGMg+e26NquZcp/F18EbIaqVvjiGqikRqVB4fYEAM8Nyin8smgwX30XhaRBOg+kCj4vInmvwAg== dependencies: - global "^4.3.2" + "@types/is-function" "^1.0.0" + global "^4.4.0" is-function "^1.0.1" is-regex "^1.0.4" is-symbol "^1.0.2" - isobject "^3.0.1" - lodash.get "^4.4.2" + isobject "^4.0.0" + lodash "^4.17.15" memoizerific "^1.11.3" term-size@^1.2.0: @@ -12413,6 +12461,11 @@ throttle-debounce@^2.0.1: resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-2.0.1.tgz#7307ddd6cd9acadb349132fbf6c18d78c88a5e62" integrity sha512-Sr6jZBlWShsAaSXKyNXyNicOrJW/KtkDqIEwHt4wYwWA2wa/q67Luhqoujg48V8hTk60wB56tYrJJn6jc2R7VA== +throttle-debounce@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/throttle-debounce/-/throttle-debounce-2.1.0.tgz#257e648f0a56bd9e54fe0f132c4ab8611df4e1d5" + integrity sha512-AOvyNahXQuU7NN+VVvOOX+uW6FPaWdAOdRP5HfwYxAfCzXTFKRMoIMk+n+po318+ktcChx+F1Dd91G3YHeMKyg== + through2@^2.0.0, through2@^2.0.2, through2@~2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/through2/-/through2-2.0.3.tgz#0004569b37c7c74ba39c43f3ced78d1ad94140be" @@ -12522,13 +12575,6 @@ toidentifier@1.0.0: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553" integrity sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw== -touch@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/touch/-/touch-2.0.2.tgz#ca0b2a3ae3211246a61b16ba9e6cbf1596287164" - integrity sha512-qjNtvsFXTRq7IuMLweVgFxmEuQ6gLbRs2jQxL80TtZ31dEKWYIxRXquij6w6VimyDek5hD3PytljHmEtAs2u0A== - dependencies: - nopt "~1.0.10" - tough-cookie@^2.3.3, tough-cookie@^2.3.4, tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" @@ -12913,14 +12959,14 @@ url-join@^4.0.0: resolved "https://registry.yarnpkg.com/url-join/-/url-join-4.0.0.tgz#4d3340e807d3773bda9991f8305acdcc2a665d2a" integrity sha1-TTNA6AfTdzvamZH4MFrNzCpmXSo= -url-loader@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-1.1.2.tgz#b971d191b83af693c5e3fea4064be9e1f2d7f8d8" - integrity sha512-dXHkKmw8FhPqu8asTc1puBfe3TehOCo2+RmOOev5suNCIYBcT626kxiWg1NBVkwc4rO8BGa7gP70W7VXuqHrjg== +url-loader@^2.0.1: + version "2.2.0" + resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-2.2.0.tgz#af321aece1fd0d683adc8aaeb27829f29c75b46e" + integrity sha512-G8nk3np8ZAnwhHXas1JxJEwJyQdqFXAKJehfgZ/XrC48volFBRtO+FIKtF2u0Ma3bw+4vnDVjHPAQYlF9p2vsw== dependencies: - loader-utils "^1.1.0" - mime "^2.0.3" - schema-utils "^1.0.0" + loader-utils "^1.2.3" + mime "^2.4.4" + schema-utils "^2.4.1" url-parse-lax@^1.0.0: version "1.0.0" From 2b30566ad3a25d0e4267ac1050487b20073a1f0a Mon Sep 17 00:00:00 2001 From: Marcel Tinner Date: Wed, 23 Oct 2019 15:13:22 +0200 Subject: [PATCH 097/162] add typings for createReducer --- src/createReducer.ts | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/src/createReducer.ts b/src/createReducer.ts index 781900f45a..cee9ba867d 100644 --- a/src/createReducer.ts +++ b/src/createReducer.ts @@ -1,18 +1,35 @@ import { useCallback, useRef, useState } from 'react'; import useUpdateEffect from './useUpdateEffect'; -function composeMiddleware(chain) { - return (context, dispatch) => { +type Dispatch = (action: Action) => void; + +type Store = { + getState: () => State; + dispatch: Dispatch; +}; + +type Middleware = ( + store: Store +) => (next: Dispatch) => (action: Action) => void; + +function composeMiddleware(chain: Middleware[]) { + return (context: Store, dispatch: Dispatch) => { return chain.reduceRight((res, middleware) => { return middleware(context)(res); }, dispatch); }; } -const createReducer = (...middlewares) => { - const composedMiddleware = composeMiddleware(middlewares); +const createReducer = ( + ...middlewares: Middleware[] +) => { + const composedMiddleware = composeMiddleware(middlewares); - return (reducer, initialState, initializer = value => value) => { + return ( + reducer: (state: State, action: Action) => State, + initialState: State, + initializer = (value: State) => value + ): [State, Dispatch] => { const ref = useRef(initializer(initialState)); const [, setState] = useState(ref.current); @@ -25,11 +42,11 @@ const createReducer = (...middlewares) => { [reducer] ); - const dispatchRef = useRef( + const dispatchRef: { current: Dispatch } = useRef( composedMiddleware( { getState: () => ref.current, - dispatch: (...args) => dispatchRef.current(...args), + dispatch: (...args: [Action]) => dispatchRef.current(...args) }, dispatch ) @@ -39,7 +56,7 @@ const createReducer = (...middlewares) => { dispatchRef.current = composedMiddleware( { getState: () => ref.current, - dispatch: (...args) => dispatchRef.current(...args), + dispatch: (...args: [Action]) => dispatchRef.current(...args) }, dispatch ); From 0c20fb98fa3b93d2674a21a4b63e191af64e8bd1 Mon Sep 17 00:00:00 2001 From: Marcel Date: Thu, 24 Oct 2019 07:06:54 +0200 Subject: [PATCH 098/162] change dispatchRef to mutableRefObject --- src/createReducer.ts | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/createReducer.ts b/src/createReducer.ts index cee9ba867d..7cece51cbc 100644 --- a/src/createReducer.ts +++ b/src/createReducer.ts @@ -1,18 +1,16 @@ -import { useCallback, useRef, useState } from 'react'; +import { MutableRefObject, useCallback, useRef, useState } from 'react'; import useUpdateEffect from './useUpdateEffect'; type Dispatch = (action: Action) => void; -type Store = { +interface Store { getState: () => State; dispatch: Dispatch; -}; +} -type Middleware = ( - store: Store -) => (next: Dispatch) => (action: Action) => void; +type Middleware = (store: Store) => (next: Dispatch) => (action: Action) => void; -function composeMiddleware(chain: Middleware[]) { +function composeMiddleware(chain: Array>) { return (context: Store, dispatch: Dispatch) => { return chain.reduceRight((res, middleware) => { return middleware(context)(res); @@ -20,9 +18,7 @@ function composeMiddleware(chain: Middleware[]) { }; } -const createReducer = ( - ...middlewares: Middleware[] -) => { +const createReducer = (...middlewares: Array>) => { const composedMiddleware = composeMiddleware(middlewares); return ( @@ -42,11 +38,11 @@ const createReducer = ( [reducer] ); - const dispatchRef: { current: Dispatch } = useRef( + const dispatchRef: MutableRefObject> = useRef( composedMiddleware( { getState: () => ref.current, - dispatch: (...args: [Action]) => dispatchRef.current(...args) + dispatch: (...args: [Action]) => dispatchRef.current(...args), }, dispatch ) @@ -56,7 +52,7 @@ const createReducer = ( dispatchRef.current = composedMiddleware( { getState: () => ref.current, - dispatch: (...args: [Action]) => dispatchRef.current(...args) + dispatch: (...args: [Action]) => dispatchRef.current(...args), }, dispatch ); From a80f3d01b3777ba3bd8e7146013ddf80e6a28471 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 24 Oct 2019 05:51:32 +0000 Subject: [PATCH 099/162] chore(deps): update dependency fork-ts-checker-webpack-plugin to v1.6.0 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index bf911645fa..99eaaa903a 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "babel-core": "6.26.3", "babel-loader": "8.0.6", "babel-plugin-dynamic-import-node": "2.3.0", - "fork-ts-checker-webpack-plugin": "1.5.1", + "fork-ts-checker-webpack-plugin": "1.6.0", "gh-pages": "2.1.1", "husky": "3.0.9", "jest": "24.9.0", diff --git a/yarn.lock b/yarn.lock index 9dc9186e24..08b2df992d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5990,10 +5990,10 @@ fork-ts-checker-webpack-plugin@1.1.1: tapable "^1.0.0" worker-rpc "^0.1.0" -fork-ts-checker-webpack-plugin@1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-1.5.1.tgz#f82d078ba8911c7b2c70703ffb3cbe588b33fbaa" - integrity sha512-IbVh1Z46dmCXJMg6We8s9jYwCAzzSv2Tgj+G2Sg/8pFantHDBrAg/rQyPnmAWLS/djW7n4VEltoEglbtTvt0wQ== +fork-ts-checker-webpack-plugin@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-1.6.0.tgz#a81fd1c6bf5258fa5318cf3e9a7e9bac006f7917" + integrity sha512-vqOY5gakcoon2s12V7MMe01OPwfgqulUWFzm+geQaPPOBKjW1I7aqqoBVlU0ECn97liMB0ECs16pRdIGe9qdRw== dependencies: babel-code-frame "^6.22.0" chalk "^2.4.1" From dc7fc55fe88f0c7a2a45ab3baca19356dc9732da Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Fri, 25 Oct 2019 12:40:50 +0000 Subject: [PATCH 100/162] chore(deps): update dependency fork-ts-checker-webpack-plugin to v2 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 99eaaa903a..9179858436 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "babel-core": "6.26.3", "babel-loader": "8.0.6", "babel-plugin-dynamic-import-node": "2.3.0", - "fork-ts-checker-webpack-plugin": "1.6.0", + "fork-ts-checker-webpack-plugin": "2.0.0", "gh-pages": "2.1.1", "husky": "3.0.9", "jest": "24.9.0", diff --git a/yarn.lock b/yarn.lock index 08b2df992d..0dd1ae2dbd 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5990,10 +5990,10 @@ fork-ts-checker-webpack-plugin@1.1.1: tapable "^1.0.0" worker-rpc "^0.1.0" -fork-ts-checker-webpack-plugin@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-1.6.0.tgz#a81fd1c6bf5258fa5318cf3e9a7e9bac006f7917" - integrity sha512-vqOY5gakcoon2s12V7MMe01OPwfgqulUWFzm+geQaPPOBKjW1I7aqqoBVlU0ECn97liMB0ECs16pRdIGe9qdRw== +fork-ts-checker-webpack-plugin@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fork-ts-checker-webpack-plugin/-/fork-ts-checker-webpack-plugin-2.0.0.tgz#6b77f0ba7edbe03246721a9f0519e32eb5765f41" + integrity sha512-9FWDlYAkuJFvWW6/uykliAAbhneLOS1PK3z9DjFAt3BLaUsCcFHFFzICSot998J4VPvT6aA8F+XIlxE0q0G6Tg== dependencies: babel-code-frame "^6.22.0" chalk "^2.4.1" From 1bfe0636643a519bcbc3e620d9e384b4870a5a8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oriol=20Colomer=20Aragon=C3=A9s?= Date: Thu, 24 Oct 2019 16:27:38 +0200 Subject: [PATCH 101/162] feat: add ensuredForwardRef and useEnsuredForwardedRef --- README.md | 5 ++ docs/useEnsuredForwardedRef.md | 63 +++++++++++++++ .../useEnsuredForwardedRef.story.tsx | 79 +++++++++++++++++++ src/__tests__/useEnsuredForwardedRef.test.tsx | 53 +++++++++++++ src/index.ts | 1 + src/useEnsuredForwardedRef.ts | 33 ++++++++ 6 files changed, 234 insertions(+) create mode 100644 docs/useEnsuredForwardedRef.md create mode 100644 src/__stories__/useEnsuredForwardedRef.story.tsx create mode 100644 src/__tests__/useEnsuredForwardedRef.test.tsx create mode 100644 src/useEnsuredForwardedRef.ts diff --git a/README.md b/README.md index 76fd92c187..d93ee9a387 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,11 @@ - [`useStateValidator`](./docs/useStateValidator.md) — tracks state of an object. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usestatevalidator--demo) - [`useMultiStateValidator`](./docs/useMultiStateValidator.md) — alike the `useStateValidator`, but tracks multiple states at a time. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usemultistatevalidator--demo) - [`useMediatedState`](./docs/useMediatedState.md) — like the regular `useState` but with mediation by custom function. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-usemediatedstate--demo) +
+
+- [**Miscellaneous**]() + - [`useEnsuredForwardedRef`](./docs/useEnsuredForwardedRef.md) and [`ensuredForwardRef`](./docs/useEnsuredForwardedRef.md) — use a React.forwardedRef safely. [![][img-demo]](https://streamich.github.io/react-use/?path=/story/state-useensuredforwardedref--demo) +

diff --git a/docs/useEnsuredForwardedRef.md b/docs/useEnsuredForwardedRef.md new file mode 100644 index 0000000000..b094a284bc --- /dev/null +++ b/docs/useEnsuredForwardedRef.md @@ -0,0 +1,63 @@ +# `useEnsuredForwardedRef` + +React hook to use a ForwardedRef safely. + +In some scenarios, you may need to use a _ref_ from inside and outside a component. If that's the case, you should use `React.forwardRef` to pass it through the child component. This is useful when you only want to forward that _ref_ and expose an internal `HTMLelement` to a parent component, for example. However, if you need to manipulate that reference inside a child's lifecycle hook... things get complicated, since you can't always ensure that the _ref_ is being sent by the parent component and if it is not, you will get `undefined` instead of a valid _ref_. + +This hook is useful in this specific case, it will __ensure__ that you get a valid reference on the other side. + +## Usage + +```jsx +import {ensuredForwardRef} from 'react-use'; + +const Demo = () => { + return ( + + ); +}; + +const Child = ensuredForwardRef((props, ref) => { + useEffect(() => { + console.log(ref.current.getBoundingClientRect()) + }, []) + + return ( +
+ ); +}); +``` + +## Alternative usage + +```jsx +import {useEnsuredForwardedRef} from 'react-use'; + +const Demo = () => { + return ( + + ); +}; + +const Child = React.forwardRef((props, ref) => { + // Here `ref` is undefined + const ensuredForwardRef = useEnsuredForwardedRef(ref); + // ensuredForwardRef will always be a valid reference. + + useEffect(() => { + console.log(ensuredForwardRef.current.getBoundingClientRect()) + }, []) + + return ( +
+ ); +}); +``` + +## Reference + +```ts +ensuredForwardRef(Component: RefForwardingComponent): ForwardRefExoticComponent & RefAttributes>; + +useEnsuredForwardedRef(ref: React.MutableRefObject): React.MutableRefObject; +``` diff --git a/src/__stories__/useEnsuredForwardedRef.story.tsx b/src/__stories__/useEnsuredForwardedRef.story.tsx new file mode 100644 index 0000000000..b2623f2fc4 --- /dev/null +++ b/src/__stories__/useEnsuredForwardedRef.story.tsx @@ -0,0 +1,79 @@ +import { storiesOf } from '@storybook/react'; +import React, { forwardRef, useRef, useState, useEffect, MutableRefObject } from 'react'; +import { useEnsuredForwardedRef } from '..'; +import ShowDocs from './util/ShowDocs'; + +import { boolean, withKnobs } from '@storybook/addon-knobs'; + +const INITIAL_SIZE = { + width: null, + height: null, +}; + +const Demo = ({ activeForwardRef }) => { + const ref = useRef(null); + + const [size, setSize] = useState(INITIAL_SIZE); + + useEffect(() => { + handleClick(); + }, [activeForwardRef]); + + const handleClick = () => { + if (activeForwardRef) { + const { width, height } = ref.current.getBoundingClientRect(); + setSize({ + width, + height, + }); + } else { + setSize(INITIAL_SIZE); + } + }; + + return ( + <> + +
Parent component using external ref: (textarea size)
+
{JSON.stringify(size, null, 2)}
+ + + ); +}; + +const Child = forwardRef(({}, ref: MutableRefObject) => { + const ensuredForwardRef = useEnsuredForwardedRef(ref); + + const [size, setSize] = useState(INITIAL_SIZE); + + useEffect(() => { + handleMouseUp(); + }, []); + + const handleMouseUp = () => { + const { width, height } = ensuredForwardRef.current.getBoundingClientRect(); + setSize({ + width, + height, + }); + }; + + return ( + <> +
Child forwardRef component using forwardRef: (textarea size)
+
{JSON.stringify(size, null, 2)}
+
You can resize this textarea:
+