diff --git a/package.json b/package.json index fff20d6..a56e89a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@technote-space/ga-framework", - "version": "0.3.0", + "version": "0.3.1", "description": "GA Framework", "author": { "name": "Technote", @@ -42,9 +42,9 @@ "react-dom": "^16.13.1", "react-helmet": "^6.1.0", "styled-components": "^5.1.1", - "vis-data": "^6.5.3", + "vis-data": "^6.6.0", "vis-network": "^7.6.10", - "vis-util": "^4.2.0" + "vis-util": "^4.3.0" }, "devDependencies": { "@babel/core": "^7.10.2", diff --git a/src/app/Store.tsx b/src/app/Store.tsx index 8273637..d63c05d 100644 --- a/src/app/Store.tsx +++ b/src/app/Store.tsx @@ -1,5 +1,6 @@ import React, {useReducer, createContext, useContext, useCallback, useMemo, useEffect, FC} from 'react'; import {AppOptions} from '../types'; +import {getProcessContext} from './common'; // eslint-disable-next-line @typescript-eslint/no-explicit-any const getReducer = (options: AppOptions) => (store, action): any => { @@ -30,7 +31,6 @@ const DispatchContext = createContext({}); export const useDispatchContext = (): any => useContext(DispatchContext); export const StoreContextProvider: FC<{ - children; options: AppOptions; }> = ({children, options}) => { const initialState = { @@ -38,6 +38,11 @@ export const StoreContextProvider: FC<{ themeColor: 'dark', status: 'none', worker: null, + control: { + reset: store => async(): Promise => store.worker?.reset(await getProcessContext(options, store)), + start: store => (): void => store.worker?.start(), + stop: store => (): void => store.worker?.stop(), + }, }; const [store, dispatch] = useReducer(getReducer(options), options.store?.state ? options.store.state(initialState) : initialState); diff --git a/src/app/templates/NavContentEx.tsx b/src/app/templates/NavContentEx.tsx index bc1d8a0..fdfba82 100644 --- a/src/app/templates/NavContentEx.tsx +++ b/src/app/templates/NavContentEx.tsx @@ -13,7 +13,6 @@ import {useSidebar} from '@mui-treasury/layout/hooks'; import clsx from 'clsx'; import {useStoreContext, useDispatchContext} from '../Store'; import {AppOptions} from '../../types'; -import {getProcessContext} from '../common'; const useStyles = makeStyles((theme: Theme) => createStyles({ list: { @@ -46,11 +45,11 @@ const useStyles = makeStyles((theme: Theme) => createStyles({ const NavContentEx: FC<{ options: AppOptions; }> = ({options}) => { - const {store: {page, status, worker}, store} = useStoreContext(); - const {dispatch} = useDispatchContext(); - const classes = useStyles(); - const {setOpen} = useSidebar('primarySidebar'); - const [controller, setController] = useState(null); + const {store: {page, status, worker, control}, store} = useStoreContext(); + const {dispatch} = useDispatchContext(); + const classes = useStyles(); + const {setOpen} = useSidebar('primarySidebar'); + const [controller, setController] = useState(null); const switchPerspective = next => (): void => { if (next !== page) { @@ -83,15 +82,15 @@ const NavContentEx: FC<{
- -
diff --git a/yarn.lock b/yarn.lock index e9c0d87..fdc727d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3827,9 +3827,9 @@ ini@^1.3.4: integrity sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw== inquirer@^7.0.0: - version "7.1.0" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.1.0.tgz#1298a01859883e17c7264b82870ae1034f92dd29" - integrity sha512-5fJMWEmikSYu0nv/flMc475MhGbB7TSPd/2IpFV4I4rMklboCH2rQjYY5kKiYGHqUF9gvaambupcJFFG9dvReg== + version "7.2.0" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-7.2.0.tgz#63ce99d823090de7eb420e4bb05e6f3449aa389a" + integrity sha512-E0c4rPwr9ByePfNlTIB8z51kK1s2n6jrHuJeEHENl/sbq2G/S1auvibgEwNR4uSyiU+PiYHqSwsgGiXjG8p5ZQ== dependencies: ansi-escapes "^4.2.1" chalk "^3.0.0" @@ -6582,20 +6582,20 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -vis-data@^6.5.3: - version "6.5.3" - resolved "https://registry.yarnpkg.com/vis-data/-/vis-data-6.5.3.tgz#39b3b66f93a393b9f2a61416e0185505e210d6f2" - integrity sha512-y7NlLWKnzEfVVUT6LYZrTbZGrFummHlHlRa/cv8OWL5O52fi9l0qUsHk/VhBkEEuoQRR+u6ZMyriFauvXXtSKQ== +vis-data@^6.6.0: + version "6.6.0" + resolved "https://registry.yarnpkg.com/vis-data/-/vis-data-6.6.0.tgz#68e9ab4936c6cddcda32b9d025b46cb0b1ea489a" + integrity sha512-qbFYARIYNt76AA/uYR/kcqatHsUdSGUNzg4Te2+x5ftcLPnbVyhbsL1E6ukzU84/1ua4XRMssdNaainShBHHWg== vis-network@^7.6.10: version "7.6.10" resolved "https://registry.yarnpkg.com/vis-network/-/vis-network-7.6.10.tgz#85fe40b0dfca17c9ff886f6ac98a7b1f182a62bd" integrity sha512-wL1dHBWWpzxvUaM0miccDuSLQ2tkw93jCA3j4Zizh4ruph+UXnjkouayaOyJIx43wULUSoKGWkhE6na1q208TA== -vis-util@^4.2.0: - version "4.2.0" - resolved "https://registry.yarnpkg.com/vis-util/-/vis-util-4.2.0.tgz#b53e243a4c05dbf1a95be2a0a175ccab69076ed3" - integrity sha512-8cE7FKiLCuu+khzDzHhszpAJQR0DP8k9+cIqXKiI86hK4vmilUQEp4vflyGYJp3YvSrsBwUSFgDvtezjO/IYFQ== +vis-util@^4.3.0: + version "4.3.0" + resolved "https://registry.yarnpkg.com/vis-util/-/vis-util-4.3.0.tgz#784357d9b2d9a7e8ce9c1ef3a5fe05493bfdbbbb" + integrity sha512-k/eKWwSK1VX/clp9L+LqFDXKoNHKM5zyHDJvHujfQiltVYNG7njlE2Qlh9+vkXYKznJKKrczTwGGme8E+Xg3uQ== vm-browserify@^1.0.1: version "1.1.2"