From 8a0ff736b5f7bf7333d3f837efbb3e2d6248da60 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Thu, 24 Oct 2019 21:03:31 +0200 Subject: [PATCH 1/3] WIP: emission, current problem: can't call hooks outside of function bodies | TODO: wonka subscribe will be the way --- src/Form.tsx | 3 ++ src/FormHoc.tsx | 15 ++++---- src/context/createContext.ts | 15 ++------ src/context/emitter.ts | 67 ++++++++++++++++++++++++++++++++++++ src/context/useSelector.ts | 33 ------------------ src/helpers/context.ts | 3 +- src/useError.ts | 15 +++++--- src/useField.ts | 31 +++++++++-------- src/useFieldArray.ts | 19 ++++++---- src/useFormConnect.ts | 5 +-- 10 files changed, 124 insertions(+), 82 deletions(-) create mode 100644 src/context/emitter.ts delete mode 100644 src/context/useSelector.ts diff --git a/src/Form.tsx b/src/Form.tsx index 8a65c58a..5b6e628a 100644 --- a/src/Form.tsx +++ b/src/Form.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { emit } from './context/emitter'; import { formContext } from './helpers/context'; import { deriveInitial } from './helpers/deriveInitial'; import useState from './helpers/useState'; @@ -116,6 +117,7 @@ const Form = ({ const onChange = React.useCallback((fieldId: string, value: any) => { isDirty.current = true; setFieldValue(fieldId, value); + emit(fieldId, 'value'); }, []); const submit = React.useCallback((e?: React.SyntheticEvent) => { @@ -131,6 +133,7 @@ const Form = ({ isSubmitting, resetForm, setFieldTouched: (fieldId: string, value?: boolean) => { + emit(fieldId, 'touched'); touch(fieldId, value == null ? true : value); }, setFieldValue: onChange, diff --git a/src/FormHoc.tsx b/src/FormHoc.tsx index 987a3030..743f1f84 100644 --- a/src/FormHoc.tsx +++ b/src/FormHoc.tsx @@ -1,5 +1,4 @@ import * as React from 'react'; -import { useSelector } from './context/useSelector'; import Form, { FormOptions } from './Form'; import useFormConnect from './useFormConnect'; @@ -18,15 +17,15 @@ const OptionsContainer = ({ return function FormOuterWrapper(Component: React.ComponentType | React.FC) { const NewComponent = (props: any) => { - const form = useFormConnect(); + const ctx = useFormConnect(); return ( ctx.formError)} - handleSubmit={form.submit} - isSubmitting={useSelector(ctx => ctx.isSubmitting)} - resetForm={useSelector(ctx => ctx.resetForm)} - isDirty={useSelector(ctx => ctx.isDirty)} + change={ctx.setFieldValue} + formError={ctx.formError} + handleSubmit={ctx.submit} + isSubmitting={ctx.isSubmitting} + resetForm={ctx.resetForm} + isDirty={ctx.isDirty} {...props} /> ); diff --git a/src/context/createContext.ts b/src/context/createContext.ts index 424fa9e7..0cc989e8 100644 --- a/src/context/createContext.ts +++ b/src/context/createContext.ts @@ -1,14 +1,5 @@ import * as React from 'react'; +import { FormHookContext } from '../types'; -export const keyword = '__HF'; -// TODO: this can be optimised as an iife. -export function createContext() { - const context: any = React.createContext(null as any, () => 0); - const { Provider } = context; - context[keyword] = []; - context.Provider = React.memo((props: any) => { - context[keyword].forEach((listener: (val: any) => any) => { listener(props.value); }); - return React.createElement(Provider, { value: props.value }, props.children); - }); - return context; -} +export const context: any = React.createContext(null as any, () => 0); +export const { Provider } = context; diff --git a/src/context/emitter.ts b/src/context/emitter.ts new file mode 100644 index 00000000..ea9b7d59 --- /dev/null +++ b/src/context/emitter.ts @@ -0,0 +1,67 @@ +type Force = () => void; + +type SubField = 'error' | 'default' | 'value' | 'touched'; + +interface EmitMap { + [fieldId: string]: { + default?: Array; + error?: Array; + value?: Array; + touched?: Array; + }; +} + +const mapping: EmitMap = {}; + +export function on(fieldId: string, cb: Force, subField?: SubField | Array) { + subField = subField || 'default'; + if (!mapping[fieldId]) { + mapping[fieldId] = {}; + } + if (Array.isArray(subField)) { + const disposers: Array = []; + subField.forEach((sf) => { + if (mapping[fieldId][sf]) { + // @ts-ignore + mapping[fieldId][sf].push(cb); + } else { + mapping[fieldId][sf] = [cb]; + } + disposers.push(() => { + // @ts-ignore + if (mapping[fieldId][subField].indexOf(cb) !== -1) { + // @ts-ignore + mapping[fieldId][subField].splice(mapping[fieldId][subField].indexOf(cb), 1); + } + }); + }); + + return () => { + disposers.forEach(c => c()); + }; + } + if (mapping[fieldId][subField]) { + // @ts-ignore + mapping[fieldId][subField].push(cb); + } else { + mapping[fieldId][subField] = [cb]; + } + + return () => { + // @ts-ignore + if (mapping[fieldId][subField].indexOf(cb) !== -1) { + // @ts-ignore + mapping[fieldId][subField].splice(mapping[fieldId][subField].indexOf(cb), 1); + } + }; +} + +export function emit(fieldId: string, subField?: SubField) { + subField = subField || 'default'; + if (fieldId === 'ALL') { + // TODO: call all of them. + } else if (mapping[fieldId][subField]) { + // @ts-ignore + mapping[fieldId][subField].forEach(cb => cb()); + } +} diff --git a/src/context/useSelector.ts b/src/context/useSelector.ts deleted file mode 100644 index ccb56baf..00000000 --- a/src/context/useSelector.ts +++ /dev/null @@ -1,33 +0,0 @@ -import * as React from 'react'; -import { formContext } from '../helpers/context'; -import { FormHookContext } from '../types'; -import { keyword } from './createContext'; - -export const useSelector = ( - selector: (context: FormHookContext) => any, -) => { - const listeners = (formContext as any)[keyword]; - - const state = React.useReducer(c => !c, false); - const value = React.useContext(formContext); - const selected = selector(value as any); - const ref = React.useRef<{ f?: (context: FormHookContext) => any, s?: any}>({}); - - React.useLayoutEffect(() => { - ref.current.f = selector; - ref.current.s = selected; - }); - - React.useLayoutEffect(() => { - const callback = (nextValue: any) => { - // @ts-ignore - if (ref.current.s !== ref.current.f(nextValue)) state[1](); - }; - listeners.push(callback); - return () => { - listeners.splice(listeners.indexOf(callback), 1); - }; - }, [listeners]); - - return selected; -}; diff --git a/src/helpers/context.ts b/src/helpers/context.ts index 96f07898..f5cfcb90 100644 --- a/src/helpers/context.ts +++ b/src/helpers/context.ts @@ -1,4 +1,5 @@ -import { createContext } from '../context/createContext'; +import { createContext } from 'React'; import { FormHookContext } from '../types'; +// @ts-ignore export const formContext = createContext(); diff --git a/src/useError.ts b/src/useError.ts index a578064f..c6f87988 100644 --- a/src/useError.ts +++ b/src/useError.ts @@ -1,7 +1,6 @@ -import { useSelector } from './context/useSelector'; -import { formContext } from './helpers/context'; +import { on } from './context/emitter'; import { get } from './helpers/operations'; -import { FormHookContext } from './types'; +import useFormConnect from './useFormConnect'; export interface FieldInformation { error: string; @@ -11,7 +10,13 @@ export default function useError(fieldId: string): string | null { if (process.env.NODE_ENV !== 'production' && (!fieldId || typeof fieldId !== 'string')) { throw new Error('The Error needs a valid "fieldId" property to function correctly.'); } - return useSelector( - (ctx: FormHookContext) => get(ctx.errors, fieldId), + + on( + fieldId, + // @ts-ignore + React.useReducer(c => !c, false)[1], + 'error', ); + + return get(useFormConnect().errors, fieldId); } diff --git a/src/useField.ts b/src/useField.ts index 4fb38261..65253fb3 100644 --- a/src/useField.ts +++ b/src/useField.ts @@ -1,8 +1,7 @@ import * as React from 'react'; -import { useSelector } from './context/useSelector'; -import { formContext } from './helpers/context'; +import { on } from './context/emitter'; import { get } from './helpers/operations'; -import { FormHookContext } from './types'; +import useFormConnect from './useFormConnect'; export interface FieldOperations { onBlur: () => void; @@ -25,28 +24,32 @@ export default function useField( throw new Error('The Field needs a valid "fieldId" property to function correctly.'); } // Context - const _ctx = React.useContext(formContext); + const ctx = useFormConnect(); + + on( + fieldId, + // @ts-ignore + React.useReducer(c => !c, false)[1], + ['value', 'touched', 'error'], + ); return [ { onBlur: React.useCallback(() => { - _ctx.setFieldTouched(fieldId, true); + ctx.setFieldTouched(fieldId, true); }, []), onChange: React.useCallback((value: T) => { - _ctx.setFieldValue(fieldId, value); + ctx.setFieldValue(fieldId, value); }, []), onFocus: React.useCallback(() => { - _ctx.setFieldTouched(fieldId, false); + ctx.setFieldTouched(fieldId, false); }, []), - setFieldValue: _ctx.setFieldValue, + setFieldValue: ctx.setFieldValue, }, { - error: useSelector( - (ctx: FormHookContext) => get(ctx.errors, fieldId)), - touched: useSelector( - (ctx: FormHookContext) => get(ctx.touched, fieldId)), - value: useSelector( - (ctx: FormHookContext) => get(ctx.values, fieldId) || ''), + error: get(ctx.errors, fieldId), + touched: get(ctx.touched, fieldId), + value: get(ctx.values, fieldId) || '', }, ]; } diff --git a/src/useFieldArray.ts b/src/useFieldArray.ts index eaaeb842..c215d5ac 100644 --- a/src/useFieldArray.ts +++ b/src/useFieldArray.ts @@ -1,8 +1,7 @@ import * as React from 'react'; -import { useSelector } from './context/useSelector'; -import { formContext } from './helpers/context'; +import { on } from './context/emitter'; import { get } from './helpers/operations'; -import { FormHookContext } from './types'; +import useFormConnect from './useFormConnect'; export interface FieldOperations { add: (item: T) => void; @@ -25,9 +24,15 @@ export default function useFieldArray( throw new Error('The FieldArray needs a valid "fieldId" property to function correctly.'); } - const { setFieldValue } = React.useContext(formContext); - const value: Array = useSelector( - (ctx: FormHookContext) => get(ctx.values, fieldId) || []); + on( + fieldId, + // @ts-ignore + React.useReducer(c => !c, false)[1], + ['touched', 'error'], + ); + + const { setFieldValue, values, errors } = useFormConnect(); + const value: Array = get(values, fieldId); return [ { @@ -82,7 +87,7 @@ export default function useFieldArray( ), }, { - error: useSelector((ctx: FormHookContext) => get(ctx.errors, fieldId)), + error: get(errors, fieldId), value, }, ]; diff --git a/src/useFormConnect.ts b/src/useFormConnect.ts index e62ca52a..0acba2e8 100644 --- a/src/useFormConnect.ts +++ b/src/useFormConnect.ts @@ -1,4 +1,5 @@ -import { useSelector } from './context/useSelector'; +import { useContext } from 'react'; +import { formContext } from './helpers/context'; import { FormHookContext } from './types'; -export default (): FormHookContext => useSelector((ctx: any) => ctx); +export default (): FormHookContext => useContext(formContext); From a277b38a8b6897d15b2be7ffb23b89a56a06b96e Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Sat, 26 Oct 2019 13:07:09 +0200 Subject: [PATCH 2/3] temp implementation --- __tests__/helpers/deriveKeys.test.ts | 18 + ...rrorMessage.test.tsx => useError.test.tsx} | 0 .../{Field.test.tsx => useField.test.tsx} | 0 ...dArray.test.tsx => useFieldArray.test.tsx} | 35 +- __tests__/performance/ErrorMessage.test.tsx | 47 -- .../{Field.test.tsx => useField.test.tsx} | 2 +- ...dArray.test.tsx => useFieldArray.test.tsx} | 0 package.json | 10 +- src/Form.tsx | 24 +- src/FormHoc.tsx | 8 +- src/context/context.ts | 5 + src/context/createContext.ts | 5 - src/context/emitter.ts | 73 +-- src/helpers/context.ts | 5 - src/helpers/deriveKeys.ts | 18 + src/useError.ts | 22 +- src/useField.ts | 21 +- src/useFieldArray.ts | 37 +- src/useFormConnect.ts | 16 +- yarn.lock | 533 +++++++++--------- 20 files changed, 457 insertions(+), 422 deletions(-) create mode 100644 __tests__/helpers/deriveKeys.test.ts rename __tests__/hooks/{ErrorMessage.test.tsx => useError.test.tsx} (100%) rename __tests__/hooks/{Field.test.tsx => useField.test.tsx} (100%) rename __tests__/hooks/{FieldArray.test.tsx => useFieldArray.test.tsx} (83%) delete mode 100644 __tests__/performance/ErrorMessage.test.tsx rename __tests__/performance/{Field.test.tsx => useField.test.tsx} (97%) rename __tests__/performance/{FieldArray.test.tsx => useFieldArray.test.tsx} (100%) create mode 100644 src/context/context.ts delete mode 100644 src/context/createContext.ts delete mode 100644 src/helpers/context.ts create mode 100644 src/helpers/deriveKeys.ts diff --git a/__tests__/helpers/deriveKeys.test.ts b/__tests__/helpers/deriveKeys.test.ts new file mode 100644 index 00000000..608b9642 --- /dev/null +++ b/__tests__/helpers/deriveKeys.test.ts @@ -0,0 +1,18 @@ +import { deriveKeys } from '../../src/helpers/deriveKeys'; + +describe('deriveKeys', () => { + it('should correctly derive keys', () => { + const result = deriveKeys({ a: 'x', b: 'y' }); + expect(result).toEqual(['a', 'b']); + }); + + it('should correctly derive keys for nested objects', () => { + const result = deriveKeys({ a: 'x', b: 'y', c: { x: 'y', d: { h: 'y' } } }); + expect(result).toEqual(['a', 'b', 'c.x', 'c.d.h']); + }); + + it('should correctly derive keys for arrays', () => { + const result = deriveKeys({ a: 'x', b: 'y', e: [{ x: 'y', d: { h: 'y' } }], d: [{ freakz: 'hi' }] }); + expect(result).toEqual(['a', 'b', 'e[0].x', 'e[0].d.h', 'd[0].freakz']); + }); +}); diff --git a/__tests__/hooks/ErrorMessage.test.tsx b/__tests__/hooks/useError.test.tsx similarity index 100% rename from __tests__/hooks/ErrorMessage.test.tsx rename to __tests__/hooks/useError.test.tsx diff --git a/__tests__/hooks/Field.test.tsx b/__tests__/hooks/useField.test.tsx similarity index 100% rename from __tests__/hooks/Field.test.tsx rename to __tests__/hooks/useField.test.tsx diff --git a/__tests__/hooks/FieldArray.test.tsx b/__tests__/hooks/useFieldArray.test.tsx similarity index 83% rename from __tests__/hooks/FieldArray.test.tsx rename to __tests__/hooks/useFieldArray.test.tsx index 7d1c019e..61bf2f07 100644 --- a/__tests__/hooks/FieldArray.test.tsx +++ b/__tests__/hooks/useFieldArray.test.tsx @@ -18,32 +18,25 @@ const StringField = ({ fieldId }: { fieldId: string }) => { ) } -const ArrayContainer = ({ fieldId }: { fieldId: string }) => { - const [{ add, remove, swap, insert, move, replace }, { value }] = useFieldArray(fieldId); - return ( - - {value.map((val: object, i: number) => ( - - - - - ))} - - - - - - - ); -} - const makeHookedForm = (HookedFormOptions?: object, props?: object) => { let injectedProps: any; const TestHookedForm = () => { - injectedProps = useFormConnect(); + const fieldId = 'friends'; + const [{ add, remove, swap, insert, move, replace }, { value }] = useFieldArray(fieldId); + injectedProps = { ...useFormConnect(), value } return ( - + {value.map((val: object, i: number) => ( + + + + + ))} + + + + + ) } diff --git a/__tests__/performance/ErrorMessage.test.tsx b/__tests__/performance/ErrorMessage.test.tsx deleted file mode 100644 index d29d3e39..00000000 --- a/__tests__/performance/ErrorMessage.test.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import * as React from 'react'; -import { act, cleanup, render } from '@testing-library/react'; - -import { HookedForm, useFormConnect, useError } from '../../src'; - -let renders = 0; -const ErrorDisplay = React.memo(() => { - const error = useError('name'); - renders +=1; - return

{error}

; -}) - -const makeHookedForm = (HookedFormOptions?: object, props?: object) => { - let injectedProps: any; - const TestHookedForm = () => { - injectedProps = useFormConnect(); - return - } - return { - getProps: () => injectedProps, - ...render( null} {...HookedFormOptions}>), - }; -}; - -describe('ErorrMessage', () => { - afterEach(() => { - renders = 0; - cleanup(); - }); - - describe('perHookedFormance', () => { - it('should not rerender when props change or parent rerenders', () => { - const { getProps, getByTestId, rerender, ...rest } = - makeHookedForm({ validate: (values: any = {}) => values.name === 'jovi' ? ({ name: 'bad' }) : ({}), validateOnChange: true }); - const { setFieldValue } = getProps(); - expect(renders).toBe(1); - act(() => { - setFieldValue('name', 'j'); - }); - expect(renders).toBe(1); - act(() => { - setFieldValue('name', 'jovi'); - }); - expect(renders).toBe(2); - }) - }); -}); diff --git a/__tests__/performance/Field.test.tsx b/__tests__/performance/useField.test.tsx similarity index 97% rename from __tests__/performance/Field.test.tsx rename to __tests__/performance/useField.test.tsx index ea2e4322..22334c25 100644 --- a/__tests__/performance/Field.test.tsx +++ b/__tests__/performance/useField.test.tsx @@ -36,7 +36,7 @@ describe('ErorrMessage', () => { expect(renders).toBe(1); act(() => { - setFieldValue('name', 'j'); + setFieldValue('age', '2'); }); expect(renders).toBe(1); act(() => { diff --git a/__tests__/performance/FieldArray.test.tsx b/__tests__/performance/useFieldArray.test.tsx similarity index 100% rename from __tests__/performance/FieldArray.test.tsx rename to __tests__/performance/useFieldArray.test.tsx diff --git a/package.json b/package.json index 973add19..a39fe26a 100644 --- a/package.json +++ b/package.json @@ -50,13 +50,13 @@ "cross-env": "5.2.0", "jest": "24.9.0", "jest-cli": "24.9.0", - "microbundle": "^0.12.0-next.3", - "react": "16.10.2", - "react-dom": "16.10.2", + "microbundle": "0.12.0-next.6", + "react": "16.11.0", + "react-dom": "16.11.0", "rimraf": "2.6.3", - "rollup": "1.23.1", + "rollup": "1.25.2", "rollup-plugin-filesize": "6.1.1", - "rollup-plugin-node-resolve": "5.2.0", + "rollup-plugin-node-resolve": "4.2.1", "rollup-plugin-replace": "2.2.0", "rollup-plugin-terser": "5.1.2", "rollup-plugin-typescript2": "0.24.3", diff --git a/src/Form.tsx b/src/Form.tsx index 5b6e628a..b892b151 100644 --- a/src/Form.tsx +++ b/src/Form.tsx @@ -1,7 +1,8 @@ import * as React from 'react'; +import { formContext } from './context/context'; import { emit } from './context/emitter'; -import { formContext } from './helpers/context'; import { deriveInitial } from './helpers/deriveInitial'; +import { deriveKeys } from './helpers/deriveKeys'; import useState from './helpers/useState'; import { Errors, InitialValues, Touched } from './types'; @@ -63,12 +64,14 @@ const Form = ({ const validateForm = React.useCallback(() => { const validationErrors = validate ? validate(values) : EMPTY_OBJ; setErrorState(validationErrors); + emit(deriveKeys(Object.assign({}, validationErrors, formErrors))); return validationErrors; }, [values]); // Provide a way to reset the full form to the initialValues. const resetForm = React.useCallback(() => { isDirty.current = false; + emit(deriveKeys(Object.assign({}, initialValues, values))); setValuesState(initialValues || EMPTY_OBJ); setTouchedState(EMPTY_OBJ); setErrorState(EMPTY_OBJ); @@ -81,18 +84,26 @@ const Form = ({ const errors = validateForm(); setTouchedState(deriveInitial(errors, true)); if (!shouldSubmitWhenInvalid && Object.keys(errors).length > 0) { - return setSubmitting(false); + setSubmitting(false); + return emit('submitting'); } + const setFormErr = (err: string) => { + setFormError(err); + emit('formError'); + }; + return new Promise(resolve => resolve( - onSubmit(values, { setErrors: setErrorState, setFormError }))) + onSubmit(values, { setErrors: setErrorState, setFormError: setFormErr }))) .then((result: any) => { setSubmitting(false); + emit('submitting'); if (onSuccess) onSuccess(result, { resetForm }); }) .catch((e: any) => { setSubmitting(false); - if (onError) onError(e, { setErrors: setErrorState, setFormError }); + emit('submitting'); + if (onError) onError(e, { setErrors: setErrorState, setFormError: setFormErr }); }); }, [values], @@ -117,12 +128,13 @@ const Form = ({ const onChange = React.useCallback((fieldId: string, value: any) => { isDirty.current = true; setFieldValue(fieldId, value); - emit(fieldId, 'value'); + emit(fieldId); }, []); const submit = React.useCallback((e?: React.SyntheticEvent) => { if (e && e.preventDefault) e.preventDefault(); setSubmitting(() => true); + emit('submitting'); }, []); const providerValue = React.useMemo( @@ -133,7 +145,7 @@ const Form = ({ isSubmitting, resetForm, setFieldTouched: (fieldId: string, value?: boolean) => { - emit(fieldId, 'touched'); + emit(fieldId); touch(fieldId, value == null ? true : value); }, setFieldValue: onChange, diff --git a/src/FormHoc.tsx b/src/FormHoc.tsx index 743f1f84..bf286816 100644 --- a/src/FormHoc.tsx +++ b/src/FormHoc.tsx @@ -1,4 +1,5 @@ import * as React from 'react'; +import { on } from './context/emitter'; import Form, { FormOptions } from './Form'; import useFormConnect from './useFormConnect'; @@ -17,7 +18,12 @@ const OptionsContainer = ({ return function FormOuterWrapper(Component: React.ComponentType | React.FC) { const NewComponent = (props: any) => { - const ctx = useFormConnect(); + const ctx = useFormConnect(true); + const state = React.useReducer(c => !c, false); + on(['formError', 'isSubmitting', 'isDirty'], () => { + // @ts-ignore + state[1](); + }); return ( (undefined as any, () => 0); +export const { Provider } = formContext; diff --git a/src/context/createContext.ts b/src/context/createContext.ts deleted file mode 100644 index 0cc989e8..00000000 --- a/src/context/createContext.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as React from 'react'; -import { FormHookContext } from '../types'; - -export const context: any = React.createContext(null as any, () => 0); -export const { Provider } = context; diff --git a/src/context/emitter.ts b/src/context/emitter.ts index ea9b7d59..5b9f885a 100644 --- a/src/context/emitter.ts +++ b/src/context/emitter.ts @@ -1,67 +1,50 @@ type Force = () => void; -type SubField = 'error' | 'default' | 'value' | 'touched'; - interface EmitMap { - [fieldId: string]: { - default?: Array; - error?: Array; - value?: Array; - touched?: Array; - }; + [fieldId: string]: Array; } const mapping: EmitMap = {}; - -export function on(fieldId: string, cb: Force, subField?: SubField | Array) { - subField = subField || 'default'; - if (!mapping[fieldId]) { - mapping[fieldId] = {}; - } - if (Array.isArray(subField)) { +export function on(fieldId: string | Array, cb: Force) { + if (Array.isArray(fieldId)) { const disposers: Array = []; - subField.forEach((sf) => { - if (mapping[fieldId][sf]) { - // @ts-ignore - mapping[fieldId][sf].push(cb); - } else { - mapping[fieldId][sf] = [cb]; - } + fieldId.forEach((f) => { + if (!mapping[f]) { mapping[f] = []; } + + mapping[f].push(cb); disposers.push(() => { - // @ts-ignore - if (mapping[fieldId][subField].indexOf(cb) !== -1) { - // @ts-ignore - mapping[fieldId][subField].splice(mapping[fieldId][subField].indexOf(cb), 1); + if (mapping[f].indexOf(cb) !== -1) { + mapping[f].splice(mapping[f].indexOf(cb), 1); } }); + }); - return () => { - disposers.forEach(c => c()); - }; + return () => { disposers.forEach((c) => { c(); }); }; } - if (mapping[fieldId][subField]) { - // @ts-ignore - mapping[fieldId][subField].push(cb); - } else { - mapping[fieldId][subField] = [cb]; + if (!mapping[fieldId]) { + mapping[fieldId] = []; } + mapping[fieldId].push(cb); return () => { - // @ts-ignore - if (mapping[fieldId][subField].indexOf(cb) !== -1) { - // @ts-ignore - mapping[fieldId][subField].splice(mapping[fieldId][subField].indexOf(cb), 1); + if (mapping[fieldId].indexOf(cb) !== -1) { + mapping[fieldId].splice(mapping[fieldId].indexOf(cb), 1); } }; } -export function emit(fieldId: string, subField?: SubField) { - subField = subField || 'default'; - if (fieldId === 'ALL') { - // TODO: call all of them. - } else if (mapping[fieldId][subField]) { - // @ts-ignore - mapping[fieldId][subField].forEach(cb => cb()); +export function emit(fieldId: string | Array) { + if (Array.isArray(fieldId)) { + fieldId.forEach((f) => { notify(`${f}`); }); + } else { + notify(`${fieldId}`); + } + notify('all'); +} + +function notify(fieldId: string) { + if (mapping[fieldId]) { + mapping[fieldId].forEach((cb) => { cb(); }); } } diff --git a/src/helpers/context.ts b/src/helpers/context.ts deleted file mode 100644 index f5cfcb90..00000000 --- a/src/helpers/context.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { createContext } from 'React'; -import { FormHookContext } from '../types'; - -// @ts-ignore -export const formContext = createContext(); diff --git a/src/helpers/deriveKeys.ts b/src/helpers/deriveKeys.ts new file mode 100644 index 00000000..08895861 --- /dev/null +++ b/src/helpers/deriveKeys.ts @@ -0,0 +1,18 @@ +export const deriveKeys = (obj: { [key: string]: any }, parentKey?: string): Array => { + parentKey = parentKey || ''; + return Object.keys(obj).reduce>((acc, key) => { + const value = obj[key]; + if (Array.isArray(value)) { + value.forEach((v, i) => { + typeof v === 'object' ? + acc.push(...deriveKeys(v, `${parentKey}${key}[${i}].`)) : + acc.push(`${parentKey}${key}[${i}].`); + }); + } else if (typeof value === 'object') { + acc.push(...deriveKeys(value, `${parentKey}${key}.`)); + } else { + acc.push(`${parentKey}${key}`); + } + return acc; + }, []); +}; diff --git a/src/useError.ts b/src/useError.ts index c6f87988..93ddaa4d 100644 --- a/src/useError.ts +++ b/src/useError.ts @@ -1,6 +1,8 @@ +import * as React from 'react'; import { on } from './context/emitter'; import { get } from './helpers/operations'; -import useFormConnect from './useFormConnect'; +import { FormHookContext } from './types'; +import { formContext } from './context/context'; export interface FieldInformation { error: string; @@ -11,12 +13,16 @@ export default function useError(fieldId: string): string | null { throw new Error('The Error needs a valid "fieldId" property to function correctly.'); } - on( - fieldId, - // @ts-ignore - React.useReducer(c => !c, false)[1], - 'error', - ); + const state = React.useReducer(c => !c, false); + React.useEffect(() => { + on( + fieldId, + () => { + // @ts-ignore + state[1](); + }, + ); + }, []); - return get(useFormConnect().errors, fieldId); + return get(React.useContext(formContext).errors, fieldId); } diff --git a/src/useField.ts b/src/useField.ts index 65253fb3..db4f4eeb 100644 --- a/src/useField.ts +++ b/src/useField.ts @@ -1,7 +1,8 @@ import * as React from 'react'; import { on } from './context/emitter'; import { get } from './helpers/operations'; -import useFormConnect from './useFormConnect'; +import { formContext } from './context/context'; +import { FormHookContext } from './types'; export interface FieldOperations { onBlur: () => void; @@ -23,15 +24,19 @@ export default function useField( if (process.env.NODE_ENV !== 'production' && (!fieldId || typeof fieldId !== 'string')) { throw new Error('The Field needs a valid "fieldId" property to function correctly.'); } + const state = React.useReducer(c => !c, false); // Context - const ctx = useFormConnect(); + const ctx = React.useContext(formContext); - on( - fieldId, - // @ts-ignore - React.useReducer(c => !c, false)[1], - ['value', 'touched', 'error'], - ); + React.useEffect(() => { + return on( + fieldId, + () => { + // @ts-ignore + state[1](); + }, + ); + }, []); return [ { diff --git a/src/useFieldArray.ts b/src/useFieldArray.ts index c215d5ac..086d405c 100644 --- a/src/useFieldArray.ts +++ b/src/useFieldArray.ts @@ -1,7 +1,8 @@ import * as React from 'react'; import { on } from './context/emitter'; import { get } from './helpers/operations'; -import useFormConnect from './useFormConnect'; +import { FormHookContext } from './types'; +import { formContext } from './context/context'; export interface FieldOperations { add: (item: T) => void; @@ -24,21 +25,25 @@ export default function useFieldArray( throw new Error('The FieldArray needs a valid "fieldId" property to function correctly.'); } - on( - fieldId, - // @ts-ignore - React.useReducer(c => !c, false)[1], - ['touched', 'error'], - ); + const state = React.useReducer(c => !c, false); + React.useEffect(() => { + return on( + fieldId, + () => { + // @ts-ignore + state[1](); + }, + ); + }, []); - const { setFieldValue, values, errors } = useFormConnect(); - const value: Array = get(values, fieldId); + const ctx = React.useContext(formContext); + const value: Array = get(ctx.values, fieldId); return [ { add: React.useCallback( (element: T) => { - setFieldValue(fieldId, [...value, element]); + ctx.setFieldValue(fieldId, [...value, element]); }, [value], ), @@ -46,7 +51,7 @@ export default function useFieldArray( (at: number, element: T) => { const result = [...value]; result.splice(at, 0, element); - setFieldValue(fieldId, result); + ctx.setFieldValue(fieldId, result); }, [value], ), @@ -55,13 +60,13 @@ export default function useFieldArray( const result = [...value]; result.splice(from, 1); result.splice(to, 0, value[from]); - setFieldValue(fieldId, result); + ctx.setFieldValue(fieldId, result); }, [value], ), remove: React.useCallback( (element: T | number) => { - setFieldValue( + ctx.setFieldValue( fieldId, value.filter(x => x !== (typeof element === 'number' ? value[element] : element)), ); @@ -72,7 +77,7 @@ export default function useFieldArray( (at: number, element: T) => { const result = [...value]; result[at] = element; - setFieldValue(fieldId, result); + ctx.setFieldValue(fieldId, result); }, [value], ), @@ -81,13 +86,13 @@ export default function useFieldArray( const result = [...value]; result[from] = value[to]; result[to] = value[from]; - setFieldValue(fieldId, result); + ctx.setFieldValue(fieldId, result); }, [value], ), }, { - error: get(errors, fieldId), + error: get(ctx.errors, fieldId), value, }, ]; diff --git a/src/useFormConnect.ts b/src/useFormConnect.ts index 0acba2e8..c0a94d24 100644 --- a/src/useFormConnect.ts +++ b/src/useFormConnect.ts @@ -1,5 +1,15 @@ -import { useContext } from 'react'; -import { formContext } from './helpers/context'; +import * as React from 'react'; +import { formContext } from './context/context'; +import { on } from './context/emitter'; import { FormHookContext } from './types'; -export default (): FormHookContext => useContext(formContext); +export default (optOut?: boolean): FormHookContext => { + if (!optOut) { + const state = React.useReducer(c => !c, false); + on('all', () => { + // @ts-ignore + state[1](); + }); + } + return React.useContext(formContext); +}; diff --git a/yarn.lock b/yarn.lock index 56574e4b..738f95f8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -36,18 +36,18 @@ semver "^5.4.1" source-map "^0.5.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/core@^7.5.5": + 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.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" + "@babel/generator" "^7.6.4" + "@babel/helpers" "^7.6.2" + "@babel/parser" "^7.6.4" + "@babel/template" "^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" @@ -78,6 +78,16 @@ source-map "^0.5.0" trim-right "^1.0.1" +"@babel/generator@^7.6.3", "@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" @@ -110,10 +120,10 @@ "@babel/traverse" "^7.4.4" "@babel/types" "^7.4.4" -"@babel/helper-create-class-features-plugin@^7.4.4": - 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== +"@babel/helper-create-class-features-plugin@^7.5.5": + 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== dependencies: "@babel/helper-function-name" "^7.1.0" "@babel/helper-member-expression-to-functions" "^7.5.5" @@ -262,14 +272,14 @@ "@babel/traverse" "^7.4.4" "@babel/types" "^7.4.4" -"@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== +"@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.4.4" - "@babel/traverse" "^7.5.5" - "@babel/types" "^7.5.5" + "@babel/template" "^7.6.0" + "@babel/traverse" "^7.6.2" + "@babel/types" "^7.6.0" "@babel/highlight@^7.0.0": version "7.0.0" @@ -290,6 +300,11 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== +"@babel/parser@^7.6.0", "@babel/parser@^7.6.3", "@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" @@ -299,12 +314,12 @@ "@babel/helper-remap-async-to-generator" "^7.1.0" "@babel/plugin-syntax-async-generators" "^7.2.0" -"@babel/plugin-proposal-class-properties@7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.4.4.tgz#93a6486eed86d53452ab9bab35e368e9461198ce" - integrity sha512-WjKTI8g8d5w1Bc9zgwSz2nfrsNQsXcCf9J9cdCvrJV6RF56yztwm4TmJC0MgJ9tvwO9gUA/mcYe89bLdGfiXFg== +"@babel/plugin-proposal-class-properties@7.5.5": + version "7.5.5" + resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.5.tgz#a974cfae1e37c3110e71f3c6a2e48b8e71958cd4" + integrity sha512-AF79FsnWFxjlaosgdi421vmYG6/jg79bVD0dpD44QdgobzHKuLZ6S3vl8la9qIeSwGi8i1fS0O1mfuDAAdo1/A== dependencies: - "@babel/helper-create-class-features-plugin" "^7.4.4" + "@babel/helper-create-class-features-plugin" "^7.5.5" "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-proposal-dynamic-import@^7.5.0": @@ -323,10 +338,10 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-json-strings" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@^7.5.5": - version "7.5.5" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz#61939744f71ba76a3ae46b5eea18a54c16d22e58" - integrity sha512-F2DxJJSQ7f64FyTVl5cw/9MWn6naXGdk3Q3UhDbFEEHv+EilCPoeRD3Zh/Utx1CJz4uyKlQ4uH+bJPbEhMV7Zw== +"@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" @@ -339,14 +354,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" -"@babel/plugin-proposal-unicode-property-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz#501ffd9826c0b91da22690720722ac7cb1ca9c78" - integrity sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA== +"@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.5.4" + regexpu-core "^4.6.0" "@babel/plugin-syntax-async-generators@^7.2.0": version "7.2.0" @@ -420,10 +435,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.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== +"@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" @@ -449,21 +464,21 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@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== +"@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== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-dotall-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz#361a148bc951444312c69446d76ed1ea8e4450c3" - integrity sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg== +"@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.5.4" + regexpu-core "^4.6.0" "@babel/plugin-transform-duplicate-keys@^7.5.0": version "7.5.0" @@ -526,10 +541,10 @@ "@babel/helper-plugin-utils" "^7.0.0" babel-plugin-dynamic-import-node "^2.3.0" -"@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== +"@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== dependencies: "@babel/helper-module-transforms" "^7.4.4" "@babel/helper-plugin-utils" "^7.0.0" @@ -553,12 +568,12 @@ "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@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== +"@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: - regexp-tree "^0.1.6" + regexpu-core "^4.6.0" "@babel/plugin-transform-new-target@^7.4.4": version "7.4.4" @@ -621,10 +636,10 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-spread@^7.2.0": - version "7.2.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz#3103a9abe22f742b6d406ecd3cd49b774919b406" - integrity sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w== +"@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" @@ -651,28 +666,28 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-unicode-regex@^7.4.4": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz#ab4634bb4f14d36728bf5978322b35587787970f" - integrity sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA== +"@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.5.4" + regexpu-core "^4.6.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== +"@babel/preset-env@^7.5.5": + 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" "@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" @@ -681,11 +696,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.5.5" + "@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.5.0" - "@babel/plugin-transform-dotall-regex" "^7.4.4" + "@babel/plugin-transform-destructuring" "^7.6.0" + "@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" @@ -693,10 +708,10 @@ "@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-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.4.5" + "@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" @@ -704,12 +719,12 @@ "@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/types" "^7.5.5" + "@babel/plugin-transform-unicode-regex" "^7.6.2" + "@babel/types" "^7.6.3" browserslist "^4.6.0" core-js-compat "^3.1.1" invariant "^2.2.2" @@ -747,6 +762,15 @@ "@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== + dependencies: + "@babel/code-frame" "^7.0.0" + "@babel/parser" "^7.6.0" + "@babel/types" "^7.6.0" + "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.4.5": version "7.4.5" resolved "https://registry.npmjs.org/@babel/traverse/-/traverse-7.4.5.tgz#4e92d1728fd2f1897dafdd321efbff92156c3216" @@ -777,6 +801,21 @@ globals "^11.1.0" lodash "^4.17.13" +"@babel/traverse@^7.6.2", "@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.3.0", "@babel/types@^7.4.0", "@babel/types@^7.4.4": version "7.4.4" resolved "https://registry.npmjs.org/@babel/types/-/types-7.4.4.tgz#8db9e9a629bb7c29370009b4b779ed93fe57d5f0" @@ -795,6 +834,15 @@ lodash "^4.17.13" to-fast-properties "^2.0.0" +"@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" + to-fast-properties "^2.0.0" + "@cnakazawa/watch@^1.0.3": version "1.0.3" resolved "https://registry.npmjs.org/@cnakazawa/watch/-/watch-1.0.3.tgz#099139eaec7ebf07a27c1786a3ff64f39464d2ef" @@ -1089,11 +1137,6 @@ resolved "https://registry.npmjs.org/@types/node/-/node-12.0.8.tgz#551466be11b2adc3f3d47156758f610bd9f6b1d8" integrity sha512-b8bbUOTwzIY3V5vDTY1fIJ+ePKDUBqt2hC2woVGotdQQhG/2Sh62HOKHrT7ab+VerXAcPyAiTEipPu/FsreUtg== -"@types/node@^12.6.2": - version "12.6.8" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.6.8.tgz#e469b4bf9d1c9832aee4907ba8a051494357c12c" - integrity sha512-aX+gFgA5GHcDi89KG5keey2zf0WfZk/HAQotEamsK2kbey+8yGKcson0hbK8E+v0NArlCJQCqMP161YhV6ZXLg== - "@types/prop-types@*": version "15.7.1" resolved "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.1.tgz#f1a11e7babb0c3cad68100be381d1e064c68f1f6" @@ -1191,11 +1234,6 @@ acorn@^6.0.1: resolved "https://registry.npmjs.org/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== -acorn@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.2.0.tgz#67f0da2fc339d6cfb5d6fb244fd449f33cd8bbe3" - integrity sha512-8oe72N3WPMjA+2zVG71Ia0nXZ8DpQH+QyyHO+p06jT8eg8FGG3FbcUIi8KziHlAfheJQZeoqbvq1mQSQHXKYLw== - acorn@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.1.0.tgz#949d36f2c292535da602283586c2477c57eb2d6c" @@ -1375,18 +1413,18 @@ atob@^2.1.1: resolved "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg== -autoprefixer@^9.6.0: - version "9.6.1" - resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.6.1.tgz#51967a02d2d2300bb01866c1611ec8348d355a47" - integrity sha512-aVo5WxR3VyvyJxcJC3h4FKfwCQvQWb1tSI5VHNibddCVWrcD1NvlxEweg3TSgiPztMnWfjpy2FURKA2kvDE+Tw== +autoprefixer@^9.6.1: + version "9.7.0" + resolved "https://registry.yarnpkg.com/autoprefixer/-/autoprefixer-9.7.0.tgz#905ec19e50f04545fe9ff131182cc9ab25246901" + integrity sha512-j2IRvaCfrUxIiZun9ba4mhJ2omhw4OY88/yVzLO+lHhGBumAAK72PgM6gkbSN8iregPOn1ZlxGkmZh2CQ7X4AQ== dependencies: - browserslist "^4.6.3" - caniuse-lite "^1.0.30000980" + browserslist "^4.7.2" + caniuse-lite "^1.0.30001004" chalk "^2.4.2" normalize-range "^0.1.2" num2fraction "^1.2.2" - postcss "^7.0.17" - postcss-value-parser "^4.0.0" + postcss "^7.0.19" + postcss-value-parser "^4.0.2" aws-sign2@~0.7.0: version "0.7.0" @@ -1443,10 +1481,10 @@ babel-plugin-macros@^2.4.2: cosmiconfig "^5.2.0" resolve "^1.10.0" -babel-plugin-transform-async-to-promises@^0.8.12: - version "0.8.13" - resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-promises/-/babel-plugin-transform-async-to-promises-0.8.13.tgz#d45895658a670ddf16f4b8f0a16487d89bb43cd0" - integrity sha512-EG665Sn79e5ndzNIbbgtIGFUXggr6j8PIDEL7kWyRbmeli7/Gva2/osjEsVayz4k7U82LKrRa8B/kkL/7n0prQ== +babel-plugin-transform-async-to-promises@^0.8.14: + version "0.8.14" + resolved "https://registry.yarnpkg.com/babel-plugin-transform-async-to-promises/-/babel-plugin-transform-async-to-promises-0.8.14.tgz#8c783aecb1139f39c608f8bb0f5bb69c343c878e" + integrity sha512-BHw2WriDbnLwaaIydAjVeXXKBal0pWlFWxfo0UKL2CTaSorvRocrsTflni/mzIOP8c+EJ8xHqtbre8GbIm4ehQ== babel-plugin-transform-replace-expressions@^0.2.0: version "0.2.0" @@ -1544,7 +1582,7 @@ braces@^2.3.1: split-string "^3.0.2" to-regex "^3.0.1" -brotli-size@0.1.0, brotli-size@^0.1.0: +brotli-size@0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/brotli-size/-/brotli-size-0.1.0.tgz#a2c518096c7c1a75e9e66908a42cd9dc77d2b69f" integrity sha512-5ny7BNvpe2TSmdafF1T9dnFYp3AIrJ8qJt29K0DQJzORlK38LBim/CmlY26JtreV6SWmXza7Oa+9m61SzvxR0Q== @@ -1552,6 +1590,13 @@ brotli-size@0.1.0, brotli-size@^0.1.0: duplexer "^0.1.1" iltorb "^2.4.3" +brotli-size@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/brotli-size/-/brotli-size-4.0.0.tgz#a05ee3faad3c0e700a2f2da826ba6b4d76e69e5e" + integrity sha512-uA9fOtlTRC0iqKfzff1W34DXUA3GyVqbUaeo3Rw3d4gd1eavKVCETXrn3NzO74W+UVkG3UHu8WxUi+XvKI/huA== + dependencies: + duplexer "0.1.1" + browser-process-hrtime@^0.1.2: version "0.1.3" resolved "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.3.tgz#616f00faef1df7ec1b5bf9cfe2bdc3170f26c7b4" @@ -1573,7 +1618,7 @@ browserslist@^4.0.0: electron-to-chromium "^1.3.150" node-releases "^1.1.23" -browserslist@^4.6.0, browserslist@^4.6.2, browserslist@^4.6.3: +browserslist@^4.6.0, browserslist@^4.6.2: version "4.6.6" resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.6.6.tgz#6e4bf467cde520bc9dbdf3747dafa03531cec453" integrity sha512-D2Nk3W9JL9Fp/gIcWei8LrERCS+eXu9AM5cfXA8WEZ84lFks+ARnZ0q/R69m2SV3Wjma83QDDPxsNKXUwdIsyA== @@ -1582,6 +1627,15 @@ browserslist@^4.6.0, browserslist@^4.6.2, browserslist@^4.6.3: electron-to-chromium "^1.3.191" node-releases "^1.1.25" +browserslist@^4.7.2: + version "4.7.2" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.7.2.tgz#1bb984531a476b5d389cedecb195b2cd69fb1348" + integrity sha512-uZavT/gZXJd2UTi9Ov7/Z340WOSQ3+m1iBVRUknf+okKxonL9P83S3ctiBDtuRmRu8PiCHjqyueqQ9HYlJhxiw== + dependencies: + caniuse-lite "^1.0.30001004" + electron-to-chromium "^1.3.295" + node-releases "^1.1.38" + bs-logger@0.x: version "0.2.6" resolved "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" @@ -1624,7 +1678,7 @@ builtin-modules@^1.1.1: resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= -builtin-modules@^3.1.0: +builtin-modules@^3.0.0, builtin-modules@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== @@ -1693,11 +1747,16 @@ caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000974: resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000974.tgz#b7afe14ee004e97ce6dc73e3f878290a12928ad8" integrity sha512-xc3rkNS/Zc3CmpMKuczWEdY2sZgx09BkAxfvkxlAEBTqcMHeL8QnPqhKse+5sRTi3nrw2pJwToD2WvKn1Uhvww== -caniuse-lite@^1.0.30000980, caniuse-lite@^1.0.30000984: +caniuse-lite@^1.0.30000984: version "1.0.30000985" resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000985.tgz#0eb40f6c8a8c219155cbe43c4975c0efb4a0f77f" integrity sha512-1ngiwkgqAYPG0JSSUp3PUDGPKKY59EK7NrGGX+VOxaKCNzRbNc7uXMny+c3VJfZxtoK3wSImTvG9T9sXiTw2+w== +caniuse-lite@^1.0.30001004: + version "1.0.30001004" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001004.tgz#d879b73981b255488316da946c39327d8c00a586" + integrity sha512-3nfOR4O8Wa2RWoYfJkMtwRVOsK96TQ+eq57wd0iKaEWl8dwG4hKZ/g0MVBfCvysFvMLi9fQGR/DvozMdkEPl3g== + capture-exit@^2.0.0: version "2.0.0" resolved "https://registry.npmjs.org/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4" @@ -2294,7 +2353,7 @@ dot-prop@^4.1.1: dependencies: is-obj "^1.0.0" -duplexer@^0.1.1: +duplexer@0.1.1, duplexer@^0.1.1: version "0.1.1" resolved "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz#ace6ff808c1ce66b57d1ebf97977acb02334cfc1" integrity sha1-rOb/gIwc5mtX0ev5eXessCM0z8E= @@ -2317,6 +2376,11 @@ electron-to-chromium@^1.3.191: resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.197.tgz#9460310733423ac72869d4dd99d7fb0389faa40b" integrity sha512-SfD7WfmueKrtKeHUESLczuANgnpdnfrSz3ZzerLdtmZf2UBZmAB3z9Q525zI5p3n9I7ii/lllUlyKHm2pIG7QQ== +electron-to-chromium@^1.3.295: + version "1.3.296" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.296.tgz#a1d4322d742317945285d3ba88966561b67f3ac8" + integrity sha512-s5hv+TSJSVRsxH190De66YHb50pBGTweT9XGWYu/LMR20KX6TsjFzObo36CjVAzM+PUeeKSBRtm/mISlCzeojQ== + emoji-regex@^7.0.1: version "7.0.3" resolved "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" @@ -2421,7 +2485,7 @@ estraverse@^4.2.0: resolved "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz#0dee3fed31fcd469618ce7342099fc1afa0bdb13" integrity sha1-De4/7TH81GlhjOc0IJn8GvoL2xM= -estree-walker@^0.6.0, estree-walker@^0.6.1: +estree-walker@^0.6.1: version "0.6.1" resolved "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz#53049143f40c6eb918b23671d1fe3219f3a1b362" integrity sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w== @@ -2638,15 +2702,6 @@ fs-constants@^1.0.0: resolved "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad" integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow== -fs-extra@7.0.1: - version "7.0.1" - resolved "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" - integrity sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^4.0.0" - universalify "^0.1.0" - fs-extra@8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0" @@ -3887,7 +3942,7 @@ lodash.memoize@4.x, lodash.memoize@^4.1.2: resolved "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= -lodash.merge@^4.6.1: +lodash.merge@^4.6.2: version "4.6.2" resolved "https://registry.yarnpkg.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a" integrity sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ== @@ -3999,48 +4054,48 @@ merge-stream@^2.0.0: resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60" integrity sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w== -microbundle@^0.12.0-next.3: - version "0.12.0-next.3" - resolved "https://registry.yarnpkg.com/microbundle/-/microbundle-0.12.0-next.3.tgz#e47e049579e19101c0c035f062e71eac19db61f1" - integrity sha512-AmsTZkkfdfgM8iRswsuHSWRbxy5FI8Zb7CwFOwjI8vjqi0YhwVPbvCZqGMlBSW+ekPuEiYRPGzW1mpTeTiq1xQ== +microbundle@0.12.0-next.6: + version "0.12.0-next.6" + resolved "https://registry.yarnpkg.com/microbundle/-/microbundle-0.12.0-next.6.tgz#e5f60d45e2a082b7ddac3a6953715717019e2fa7" + integrity sha512-IoH9ooNAKAjg+kLXW9Q7/9viaccnRdRTq/IQoM9rRkfxJl+DoW8RPftxg2kEFKjbecQB0mGk/dvBQa208ayBJw== dependencies: - "@babel/core" "^7.4.5" - "@babel/plugin-proposal-class-properties" "7.4.4" + "@babel/core" "^7.5.5" + "@babel/plugin-proposal-class-properties" "7.5.5" "@babel/plugin-syntax-jsx" "^7.2.0" "@babel/plugin-transform-flow-strip-types" "^7.4.4" "@babel/plugin-transform-react-jsx" "^7.3.0" - "@babel/preset-env" "^7.4.5" + "@babel/preset-env" "^7.5.5" "@babel/preset-flow" "^7.0.0" asyncro "^3.0.0" - autoprefixer "^9.6.0" + autoprefixer "^9.6.1" babel-plugin-macros "^2.4.2" - babel-plugin-transform-async-to-promises "^0.8.12" + babel-plugin-transform-async-to-promises "^0.8.14" babel-plugin-transform-replace-expressions "^0.2.0" - brotli-size "^0.1.0" + brotli-size "^4.0.0" camelcase "^5.3.1" cssnano "^4.1.10" es6-promisify "^6.0.1" filesize "^4.1.2" gzip-size "^5.1.1" kleur "^3.0.3" - lodash.merge "^4.6.1" + lodash.merge "^4.6.2" module-details-from-path "^1.0.3" - pretty-bytes "^5.2.0" - rollup "^1.15.6" - rollup-plugin-alias "^1.5.2" - rollup-plugin-babel "^4.3.2" + pretty-bytes "^5.3.0" + rollup "^1.19.4" + rollup-plugin-alias "^2.0.0" + rollup-plugin-babel "^4.3.3" rollup-plugin-bundle-size "^1.0.1" - rollup-plugin-commonjs "^10.0.0" + rollup-plugin-commonjs "^10.0.2" rollup-plugin-es3 "^1.1.0" rollup-plugin-json "^4.0.0" - rollup-plugin-node-resolve "^5.0.3" + rollup-plugin-node-resolve "^5.2.0" rollup-plugin-postcss "^2.0.3" - rollup-plugin-terser "^5.0.0" - rollup-plugin-typescript2 "^0.21.2" - sade "^1.5.1" + rollup-plugin-terser "^5.1.1" + rollup-plugin-typescript2 "^0.23.0" + sade "^1.6.1" tiny-glob "^0.2.6" tslib "^1.10.0" - typescript "^3.5.2" + typescript "^3.5.3" micromatch@^3.1.10, micromatch@^3.1.4: version "3.1.10" @@ -4264,6 +4319,13 @@ node-releases@^1.1.25: dependencies: semver "^5.3.0" +node-releases@^1.1.38: + version "1.1.39" + resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.39.tgz#c1011f30343aff5b633153b10ff691d278d08e8d" + integrity sha512-8MRC/ErwNCHOlAFycy9OPca46fQYUjbJRDcZTHVWIGXIjYLM73k70vv3WkYutVnM4cCo4hE0MqBVVZjP6vjISA== + dependencies: + semver "^6.3.0" + noop-logger@^0.1.1: version "0.1.1" resolved "https://registry.npmjs.org/noop-logger/-/noop-logger-0.1.1.tgz#94a2b1633c4f1317553007d8966fd0e841b6a4c2" @@ -4939,10 +5001,10 @@ postcss-value-parser@^3.0.0, postcss-value-parser@^3.3.1: resolved "https://registry.npmjs.org/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.0" - resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.0.tgz#99a983d365f7b2ad8d0f9b8c3094926eab4b936d" - integrity sha512-ESPktioptiSUchCKgggAkzdmkgzKfmp0EU8jXH+5kbIUB+unr0Y4CY9SRMvibuvYUBjNh1ACLbxqYNpdTQOteQ== +postcss-value-parser@^4.0.2: + version "4.0.2" + resolved "https://registry.yarnpkg.com/postcss-value-parser/-/postcss-value-parser-4.0.2.tgz#482282c09a42706d1fc9a069b73f44ec08391dc9" + integrity sha512-LmeoohTpp/K4UiyQCwuGWlONxXamGzCMtFxLq4W1nZVGIQLYvMCJx3yAF9qyyuFpflABI9yVdtJAqbihOsCsJQ== postcss@6.0.1: version "6.0.1" @@ -4962,7 +5024,7 @@ postcss@^6.0.1: source-map "^0.6.1" supports-color "^5.4.0" -postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.5: +postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.5: version "7.0.17" resolved "https://registry.npmjs.org/postcss/-/postcss-7.0.17.tgz#4da1bdff5322d4a0acaab4d87f3e782436bad31f" integrity sha512-546ZowA+KZ3OasvQZHsbuEpysvwTZNGJv9EfyCQdsIDltPSWHAeTQ5fQy/Npi2ZDtLI3zs7Ps/p6wThErhm9fQ== @@ -4971,6 +5033,15 @@ postcss@^7.0.0, postcss@^7.0.1, postcss@^7.0.14, postcss@^7.0.17, postcss@^7.0.5 source-map "^0.6.1" supports-color "^6.1.0" +postcss@^7.0.19: + version "7.0.21" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-7.0.21.tgz#06bb07824c19c2021c5d056d5b10c35b989f7e17" + integrity sha512-uIFtJElxJo29QC753JzhidoAhvp/e/Exezkdhfmt8AymWT6/5B7W1WmponYWkHk2eg6sONyTch0A3nkMPun3SQ== + dependencies: + chalk "^2.4.2" + source-map "^0.6.1" + supports-color "^6.1.0" + prebuild-install@^5.3.0: version "5.3.0" resolved "https://registry.npmjs.org/prebuild-install/-/prebuild-install-5.3.0.tgz#58b4d8344e03590990931ee088dd5401b03004c8" @@ -5005,10 +5076,10 @@ pretty-bytes@^3.0.0: dependencies: number-is-nan "^1.0.0" -pretty-bytes@^5.2.0: - version "5.2.0" - resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.2.0.tgz#96c92c6e95a0b35059253fb33c03e260d40f5a1f" - integrity sha512-ujANBhiUsl9AhREUDUEY1GPOharMGm8x8juS7qOHybcLi7XsKfrYQ88hSly1l2i0klXHTDYrlL8ihMCG55Dc3w== +pretty-bytes@^5.3.0: + version "5.3.0" + resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.3.0.tgz#f2849e27db79fb4d6cfe24764fc4134f165989f2" + integrity sha512-hjGrh+P926p4R4WbaB6OckyRtO0F0/lQBiT+0gnxjV+5kjPBrfVBFCsCLbMqVQeydvIoouYTCmmEURiH3R1Bdg== pretty-format@^24.3.0, pretty-format@^24.9.0: version "24.9.0" @@ -5111,25 +5182,25 @@ rc@^1.2.7: minimist "^1.2.0" strip-json-comments "~2.0.1" -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-is@^16.8.1, react-is@^16.8.4: version "16.8.6" resolved "https://registry.npmjs.org/react-is/-/react-is-16.8.6.tgz#5bbc1e2d29141c9fbdfed456343fe2bc430a6a16" integrity sha512-aUk3bHfZ2bRSVFFbbeVS4i+lNPZr3/WM5jT2J5omUVV1zzcs1nAaf3l51ctA5FFvCRbhrH0bdAsRRQddFJZPtA== -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" @@ -5177,9 +5248,9 @@ reflect-metadata@^0.1.12: resolved "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz#67ae3ca57c972a2aa1642b10fe363fe32d49dc08" integrity sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg== -regenerate-unicode-properties@^8.0.2: +regenerate-unicode-properties@^8.1.0: version "8.1.0" - resolved "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-8.1.0.tgz#ef51e0f0ea4ad424b77bf7cb41f3e015c70a3f0e" + 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" @@ -5209,11 +5280,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.6: - version "0.1.11" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.11.tgz#c9c7f00fcf722e0a56c7390983a7a63dd6c272f3" - integrity sha512-7/l/DgapVVDzZobwMCCgMlqiqyLFJ0cduo/j+3BcDJIB+yJdsYCfKuI3l/04NV+H/rfNRdPIDbXNZHM9XvQatg== - regexpu-core@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/regexpu-core/-/regexpu-core-1.0.0.tgz#86a763f58ee4d7c2f6b102e4764050de7ed90c6b" @@ -5223,13 +5289,13 @@ regexpu-core@^1.0.0: regjsgen "^0.2.0" regjsparser "^0.1.4" -regexpu-core@^4.5.4: - version "4.5.4" - resolved "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.4.tgz#080d9d02289aa87fe1667a4f5136bc98a6aebaae" - integrity sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ== +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" @@ -5353,10 +5419,10 @@ resolve@1.1.7: resolved "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz#203114d82ad2c5ed9e8e0411b3932875e889e97b" integrity sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs= -resolve@1.10.1: - version "1.10.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.1.tgz#664842ac960795bbe758221cdccda61fb64b5f18" - integrity sha512-KuIe4mf++td/eFb6wkaPbMDnP6kObCaEtIDuHOUED6MNUo4K670KZUHuuvYPZDxNF0WVLw49n06M2m2dXphEzA== +resolve@1.11.1, resolve@^1.11.0, resolve@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" + integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw== dependencies: path-parse "^1.0.6" @@ -5374,13 +5440,6 @@ resolve@1.x, resolve@^1.10.0, resolve@^1.3.2, resolve@^1.5.0: dependencies: path-parse "^1.0.6" -resolve@^1.11.0, resolve@^1.11.1: - version "1.11.1" - resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.11.1.tgz#ea10d8110376982fef578df8fc30b9ac30a07a3e" - integrity sha512-vIpgF6wfuJOZI7KKKSP+HmiKggadPQAdsp5HiC1mvqnfp0gF1vdwgBWZIdrVft9pgqoMFQN+R7BSWZiBxx+BBw== - dependencies: - path-parse "^1.0.6" - ret@~0.1.10: version "0.1.15" resolved "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" @@ -5403,14 +5462,14 @@ rimraf@2.6.3, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: dependencies: glob "^7.1.3" -rollup-plugin-alias@^1.5.2: - version "1.5.2" - resolved "https://registry.yarnpkg.com/rollup-plugin-alias/-/rollup-plugin-alias-1.5.2.tgz#f15a1cc8ee0debf74ab5c2bb68a944a66b568411" - integrity sha512-ODeZXhTxpD48sfcYLAFc1BGrsXKDj7o1CSNH3uYbdK3o0NxyMmaQPTNgW+ko+am92DLC8QSTe4kyxTuEkI5S5w== +rollup-plugin-alias@^2.0.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-alias/-/rollup-plugin-alias-2.2.0.tgz#5004a2bc542a2eebb45b5a0fff8c6f540439decc" + integrity sha512-9ZK410qeFed4gGrHoojBpxLsHF74vPgsheGg9JRW5RbALAxqdvJbd357mSqWBqUrBfRVnZnNUXTZdYLxxQEA5A== dependencies: slash "^3.0.0" -rollup-plugin-babel@^4.3.2: +rollup-plugin-babel@^4.3.3: version "4.3.3" resolved "https://registry.yarnpkg.com/rollup-plugin-babel/-/rollup-plugin-babel-4.3.3.tgz#7eb5ac16d9b5831c3fd5d97e8df77ba25c72a2aa" integrity sha512-tKzWOCmIJD/6aKNz0H1GMM+lW1q9KyFubbWzGiOG540zxPPifnEAHTZwjo0g991Y+DyOZcLqBgqOdqazYE5fkw== @@ -5426,10 +5485,10 @@ rollup-plugin-bundle-size@^1.0.1: chalk "^1.1.3" maxmin "^2.1.0" -rollup-plugin-commonjs@^10.0.0: - version "10.0.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.0.1.tgz#fbfcadf4ce2e826068e056a9f5c19287d9744ddf" - integrity sha512-x0PcCVdEc4J8igv1qe2vttz8JKAKcTs3wfIA3L8xEty3VzxgORLrzZrNWaVMc+pBC4U3aDOb9BnWLAQ8J11vkA== +rollup-plugin-commonjs@^10.0.2: + version "10.1.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-commonjs/-/rollup-plugin-commonjs-10.1.0.tgz#417af3b54503878e084d127adf4d1caf8beb86fb" + integrity sha512-jlXbjZSQg8EIeAAvepNwhJj++qJWNJw1Cl0YnOqKtP5Djx+fFGkp3WRh+W0ASCaFG5w1jhmzDxgu3SJuVxPF4Q== dependencies: estree-walker "^0.6.1" is-reference "^1.1.2" @@ -5464,7 +5523,17 @@ rollup-plugin-json@^4.0.0: dependencies: rollup-pluginutils "^2.5.0" -rollup-plugin-node-resolve@5.2.0, rollup-plugin-node-resolve@^5.0.3: +rollup-plugin-node-resolve@4.2.1: + version "4.2.1" + resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.2.1.tgz#a949f3082c9839ca586d0e893425d1f83ed01fcf" + integrity sha512-zf2dcKBSv9KSnNbAPDYzwLpeI4Lc4bOsNlaRsq3ud80zquxWdu9iYA0ZgmHxFjBkbt8uHzXCGC4FkkejtngKng== + dependencies: + "@types/resolve" "0.0.8" + builtin-modules "^3.0.0" + is-module "^1.0.0" + resolve "^1.10.0" + +rollup-plugin-node-resolve@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" integrity sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw== @@ -5503,7 +5572,7 @@ rollup-plugin-replace@2.2.0: magic-string "^0.25.2" rollup-pluginutils "^2.6.0" -rollup-plugin-terser@5.1.2: +rollup-plugin-terser@5.1.2, rollup-plugin-terser@^5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-5.1.2.tgz#3e41256205cb75f196fc70d4634227d1002c255c" integrity sha512-sWKBCOS+vUkRtHtEiJPAf+WnBqk/C402fBD9AVHxSIXMqjsY7MnYWKYEUqGixtr0c8+1DjzUEPlNgOYQPVrS1g== @@ -5514,17 +5583,6 @@ rollup-plugin-terser@5.1.2: serialize-javascript "^1.7.0" terser "^4.1.0" -rollup-plugin-terser@^5.0.0: - version "5.1.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-5.1.1.tgz#e9d2545ec8d467f96ba99b9216d2285aad8d5b66" - integrity sha512-McIMCDEY8EU6Y839C09UopeRR56wXHGdvKKjlfiZG/GrP6wvZQ62u2ko/Xh1MNH2M9WDL+obAAHySljIZYCuPQ== - dependencies: - "@babel/code-frame" "^7.0.0" - jest-worker "^24.6.0" - rollup-pluginutils "^2.8.1" - serialize-javascript "^1.7.0" - terser "^4.1.0" - rollup-plugin-typescript2@0.24.3: version "0.24.3" resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.24.3.tgz#276fa33a9d584d500da62d3e5400307f4a46bdf2" @@ -5536,23 +5594,15 @@ rollup-plugin-typescript2@0.24.3: rollup-pluginutils "2.8.1" tslib "1.10.0" -rollup-plugin-typescript2@^0.21.2: - version "0.21.2" - resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.21.2.tgz#23586f4d2c706153870ec86dff48e4fa898d92cd" - integrity sha512-TfX+HLJ99p/P8kYZJdNYp9iGVWFCrj+G/V56LbEYtBqVMVHbGkrSoDH8AJjDtyRp6J9VosaKKmnBDBxhDo7TZw== - dependencies: - fs-extra "7.0.1" - resolve "1.10.1" - rollup-pluginutils "2.6.0" - tslib "1.9.3" - -rollup-pluginutils@2.6.0: - version "2.6.0" - resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.6.0.tgz#203706edd43dfafeaebc355d7351119402fc83ad" - integrity sha512-aGQwspEF8oPKvg37u3p7h0cYNwmJR1sCBMZGZ5b9qy8HGtETknqjzcxrDRrcAnJNXN18lBH4Q9vZYth/p4n8jQ== +rollup-plugin-typescript2@^0.23.0: + version "0.23.0" + resolved "https://registry.yarnpkg.com/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.23.0.tgz#a2b6669ec606862fff62a74a628a838ebad6f108" + integrity sha512-LocTdy/rtp7UVoQcxqO3nIDjuI6AhfmiO/iNTx0k3uGRGPFQzlAyw5hEFNMpAT2tlpoGqawRnOT9OCePuwfZ5w== dependencies: - estree-walker "^0.6.0" - micromatch "^3.1.10" + fs-extra "8.1.0" + resolve "1.11.1" + rollup-pluginutils "2.8.1" + tslib "1.10.0" rollup-pluginutils@2.8.1, rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.6.0, rollup-pluginutils@^2.8.1: version "2.8.1" @@ -5561,33 +5611,24 @@ rollup-pluginutils@2.8.1, rollup-pluginutils@^2.0.1, rollup-pluginutils@^2.5.0, dependencies: estree-walker "^0.6.1" -rollup@1.23.1: - version "1.23.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.23.1.tgz#0315a0f5d0dfb056e6363e1dff05b89ac2da6b8e" - integrity sha512-95C1GZQpr/NIA0kMUQmSjuMDQ45oZfPgDBcN0yZwBG7Kee//m7H68vgIyg+SPuyrTZ5PrXfyLK80OzXeKG5dAA== +rollup@1.25.2, rollup@^1.19.4: + version "1.25.2" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.25.2.tgz#739f508bd8f7ece52bb6c1fcda83466af82b7f6d" + integrity sha512-+7z6Wab/L45QCPcfpuTZKwKiB0tynj05s/+s2U3F2Bi7rOLPr9UcjUwO7/xpjlPNXA/hwnth6jBExFRGyf3tMg== dependencies: "@types/estree" "*" "@types/node" "*" acorn "^7.1.0" -rollup@^1.15.6: - version "1.17.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.17.0.tgz#47ee8b04514544fc93b39bae06271244c8db7dfa" - integrity sha512-k/j1m0NIsI4SYgCJR4MWPstGJOWfJyd6gycKoMhyoKPVXxm+L49XtbUwZyFsrSU2YXsOkM4u1ll9CS/ZgJBUpw== - dependencies: - "@types/estree" "0.0.39" - "@types/node" "^12.6.2" - acorn "^6.2.0" - rsvp@^4.8.4: version "4.8.5" resolved "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" integrity sha512-nfMOlASu9OnRJo1mbEk2cz0D56a1MBNrJ7orjRZQG10XDyuvwksKbuXNp6qa+kbn839HwjwhBzhFmdsaEAfauA== -sade@^1.5.1: - version "1.6.0" - resolved "https://registry.yarnpkg.com/sade/-/sade-1.6.0.tgz#b865b18113a73291f2a480f2e911ad5e975923e6" - integrity sha512-+CwYHyNlf2QvglE8MJLg+DAXruhz1tg9LeztL2qDf1NZx0OR8Ij4CajM5NxgscggwG9ypQXvTQFXcaerBSLQgg== +sade@^1.6.1: + version "1.6.1" + resolved "https://registry.yarnpkg.com/sade/-/sade-1.6.1.tgz#aba16655e998b2b68beb9f13938af010f42eddd2" + integrity sha512-USHm9quYNmJwFwhOnEuJohdnBhUOKV1mhL0koHSJMLJaesRX0nuDuzbWmtUBbUmXkwTalLtUBzDlEnU940BiQA== dependencies: mri "^1.1.0" @@ -5628,10 +5669,10 @@ sax@^1.2.4, sax@~1.2.4: resolved "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9" integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw== -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" @@ -5651,7 +5692,7 @@ semver@^6.1.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.2.0.tgz#4d813d9590aaf8a9192693d6c85b9344de5901db" integrity sha512-jdFC1VdUGT/2Scgbimf7FSx9iJLXoqfglSF+gJeuNWVpiE37OIbc1jywR/GJyFdz3mnkz2/id0L0J/cr0izR5A== -semver@^6.2.0: +semver@^6.2.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -6235,11 +6276,6 @@ tslib@1.9.0: resolved "https://registry.npmjs.org/tslib/-/tslib-1.9.0.tgz#e37a86fda8cbbaf23a057f473c9f4dc64e5fc2e8" integrity sha512-f/qGG2tUkrISBlQZEjEqoZ3B2+npJjIf04H1wuAv9iA8i04Icp+61KRXxFdha22670NJopsZCIjhC3SnjPRKrQ== -tslib@1.9.3: - version "1.9.3" - resolved "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz#d7e4dd79245d85428c4d7e4822a79917954ca286" - integrity sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ== - tslint-config-airbnb@5.11.1: version "5.11.1" resolved "https://registry.npmjs.org/tslint-config-airbnb/-/tslint-config-airbnb-5.11.1.tgz#51a27fbb8bf24c144d064a274a71da47e7ece617" @@ -6350,16 +6386,11 @@ type-fest@^0.5.2: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.5.2.tgz#d6ef42a0356c6cd45f49485c3b6281fc148e48a2" integrity sha512-DWkS49EQKVX//Tbupb9TFa19c7+MK1XmzkrZUR8TAktmE/DizXoaoJV6TZ/tSIPXipqNiRI6CyAe7x69Jb6RSw== -typescript@3.6.4: +typescript@3.6.4, typescript@^3.5.3: version "3.6.4" resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.6.4.tgz#b18752bb3792bc1a0281335f7f6ebf1bbfc5b91d" integrity sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg== -typescript@^3.5.2: - version "3.5.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.5.3.tgz#c830f657f93f1ea846819e929092f5fe5983e977" - integrity sha512-ACzBtm/PhXBDId6a6sDJfroT2pOWt/oOnk4/dElG5G33ZL776N3Y6/6bKZJBFpd+b05F3Ct9qDjMeJmRWtE2/g== - uglify-js@^3.1.4: version "3.6.0" resolved "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz#704681345c53a8b2079fb6cec294b05ead242ff5" From 901d26d19ca3b59074a71c1ac0ec402151efd052 Mon Sep 17 00:00:00 2001 From: Jovi De Croock Date: Sat, 26 Oct 2019 13:19:44 +0200 Subject: [PATCH 3/3] custom emitter finish up --- package.json | 2 +- src/Form.tsx | 5 +++-- src/FormHoc.tsx | 5 ++--- src/context/context.ts | 5 ----- src/useError.ts | 2 +- src/useField.ts | 2 +- src/useFieldArray.ts | 2 +- src/useFormConnect.ts | 2 +- yarn.lock | 14 ++------------ 9 files changed, 12 insertions(+), 27 deletions(-) delete mode 100644 src/context/context.ts diff --git a/package.json b/package.json index a39fe26a..989c6c21 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "rimraf": "2.6.3", "rollup": "1.25.2", "rollup-plugin-filesize": "6.1.1", - "rollup-plugin-node-resolve": "4.2.1", + "rollup-plugin-node-resolve": "5.2.0", "rollup-plugin-replace": "2.2.0", "rollup-plugin-terser": "5.1.2", "rollup-plugin-typescript2": "0.24.3", diff --git a/src/Form.tsx b/src/Form.tsx index b892b151..7d9aa4dd 100644 --- a/src/Form.tsx +++ b/src/Form.tsx @@ -1,10 +1,11 @@ import * as React from 'react'; -import { formContext } from './context/context'; import { emit } from './context/emitter'; import { deriveInitial } from './helpers/deriveInitial'; import { deriveKeys } from './helpers/deriveKeys'; import useState from './helpers/useState'; -import { Errors, InitialValues, Touched } from './types'; +import { Errors, FormHookContext, InitialValues, Touched } from './types'; + +export const formContext = React.createContext(null as any, () => 0); export interface SuccessBag { resetForm: () => void; diff --git a/src/FormHoc.tsx b/src/FormHoc.tsx index bf286816..dec18ee7 100644 --- a/src/FormHoc.tsx +++ b/src/FormHoc.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { on } from './context/emitter'; -import Form, { FormOptions } from './Form'; -import useFormConnect from './useFormConnect'; +import Form, { formContext, FormOptions } from './Form'; const OptionsContainer = ({ enableReinitialize, @@ -18,7 +17,7 @@ const OptionsContainer = ({ return function FormOuterWrapper(Component: React.ComponentType | React.FC) { const NewComponent = (props: any) => { - const ctx = useFormConnect(true); + const ctx = React.useContext(formContext); const state = React.useReducer(c => !c, false); on(['formError', 'isSubmitting', 'isDirty'], () => { // @ts-ignore diff --git a/src/context/context.ts b/src/context/context.ts deleted file mode 100644 index 0e39c91f..00000000 --- a/src/context/context.ts +++ /dev/null @@ -1,5 +0,0 @@ -import * as React from 'React'; -import { FormHookContext } from '../types'; - -export const formContext: any = React.createContext(undefined as any, () => 0); -export const { Provider } = formContext; diff --git a/src/useError.ts b/src/useError.ts index 93ddaa4d..094ff804 100644 --- a/src/useError.ts +++ b/src/useError.ts @@ -1,8 +1,8 @@ import * as React from 'react'; import { on } from './context/emitter'; +import { formContext } from './Form'; import { get } from './helpers/operations'; import { FormHookContext } from './types'; -import { formContext } from './context/context'; export interface FieldInformation { error: string; diff --git a/src/useField.ts b/src/useField.ts index db4f4eeb..f0676eff 100644 --- a/src/useField.ts +++ b/src/useField.ts @@ -1,7 +1,7 @@ import * as React from 'react'; import { on } from './context/emitter'; +import { formContext } from './Form'; import { get } from './helpers/operations'; -import { formContext } from './context/context'; import { FormHookContext } from './types'; export interface FieldOperations { diff --git a/src/useFieldArray.ts b/src/useFieldArray.ts index 086d405c..33f82f9c 100644 --- a/src/useFieldArray.ts +++ b/src/useFieldArray.ts @@ -1,8 +1,8 @@ import * as React from 'react'; import { on } from './context/emitter'; +import { formContext } from './Form'; import { get } from './helpers/operations'; import { FormHookContext } from './types'; -import { formContext } from './context/context'; export interface FieldOperations { add: (item: T) => void; diff --git a/src/useFormConnect.ts b/src/useFormConnect.ts index c0a94d24..2ff5b5fa 100644 --- a/src/useFormConnect.ts +++ b/src/useFormConnect.ts @@ -1,6 +1,6 @@ import * as React from 'react'; -import { formContext } from './context/context'; import { on } from './context/emitter'; +import { formContext } from './Form'; import { FormHookContext } from './types'; export default (optOut?: boolean): FormHookContext => { diff --git a/yarn.lock b/yarn.lock index 738f95f8..23d2609d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1678,7 +1678,7 @@ builtin-modules@^1.1.1: resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" integrity sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8= -builtin-modules@^3.0.0, builtin-modules@^3.1.0: +builtin-modules@^3.1.0: version "3.1.0" resolved "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== @@ -5523,17 +5523,7 @@ rollup-plugin-json@^4.0.0: dependencies: rollup-pluginutils "^2.5.0" -rollup-plugin-node-resolve@4.2.1: - version "4.2.1" - resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-4.2.1.tgz#a949f3082c9839ca586d0e893425d1f83ed01fcf" - integrity sha512-zf2dcKBSv9KSnNbAPDYzwLpeI4Lc4bOsNlaRsq3ud80zquxWdu9iYA0ZgmHxFjBkbt8uHzXCGC4FkkejtngKng== - dependencies: - "@types/resolve" "0.0.8" - builtin-modules "^3.0.0" - is-module "^1.0.0" - resolve "^1.10.0" - -rollup-plugin-node-resolve@^5.2.0: +rollup-plugin-node-resolve@5.2.0, rollup-plugin-node-resolve@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" integrity sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==