redux-connected-devtools 0.0.15 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- package/.env +2 -0
- package/.prettierrc.js +10 -0
- package/.vscode/settings.json +12 -0
- package/.vscode/tasks.json +33 -0
- package/LICENSE +21 -0
- package/README.md +5 -0
- package/index.html +58 -0
- package/jest.config.js +8 -0
- package/package.json +47 -66
- package/public/devtools.html +8 -0
- package/public/icon.png +0 -0
- package/public/manifest.json +29 -0
- package/public/options.html +12 -0
- package/public/panel.html +39 -0
- package/public/popup.html +12 -0
- package/src/__tests__/sum.ts +9 -0
- package/src/background.ts +49 -0
- package/src/components/DevInspector/DevInspector.scss +2 -0
- package/src/components/DevInspector/DevInspector.style.tsx +8 -0
- package/src/components/DevInspector/DevInspector.tsx +34 -0
- package/src/components/DevList/DevList.scss +2 -0
- package/src/components/DevList/DevList.style.tsx +34 -0
- package/src/components/DevList/DevList.tsx +62 -0
- package/src/components/DevMenu/DevMenu.scss +2 -0
- package/src/components/DevMenu/DevMenu.style.tsx +53 -0
- package/src/components/DevMenu/DevMenu.tsx +76 -0
- package/src/components/DevPanel/DevPanel.scss +2 -0
- package/src/components/DevPanel/DevPanel.style.tsx +16 -0
- package/src/components/DevPanel/DevPanel.tsx +51 -0
- package/src/components/JourneyRow/JourneyRow.scss +2 -0
- package/src/components/JourneyRow/JourneyRow.style.tsx +46 -0
- package/src/components/JourneyRow/JourneyRow.tsx +58 -0
- package/src/components/JsonViewer/JsonViewer.scss +2 -0
- package/src/components/JsonViewer/JsonViewer.style.tsx +31 -0
- package/src/components/JsonViewer/JsonViewer.tsx +24 -0
- package/src/components/Lifecycle/Lifecycle.scss +2 -0
- package/src/components/Lifecycle/Lifecycle.style.tsx +6 -0
- package/src/components/Lifecycle/Lifecycle.tsx +31 -0
- package/src/components/LogsViewer/LogsViewer.scss +2 -0
- package/src/components/LogsViewer/LogsViewer.style.tsx +5 -0
- package/src/components/LogsViewer/LogsViewer.tsx +14 -0
- package/src/components/RequestDetails/RequestDetails.scss +2 -0
- package/src/components/RequestDetails/RequestDetails.style.tsx +20 -0
- package/src/components/RequestDetails/RequestDetails.tsx +60 -0
- package/src/components/RequestJourney/RequestJourney.scss +2 -0
- package/src/components/RequestJourney/RequestJourney.style.tsx +6 -0
- package/src/components/RequestJourney/RequestJourney.tsx +33 -0
- package/src/components/RequestRow/RequestRow.scss +2 -0
- package/src/components/RequestRow/RequestRow.style.tsx +31 -0
- package/src/components/RequestRow/RequestRow.tsx +37 -0
- package/src/components/Time/Time.scss +2 -0
- package/src/components/Time/Time.style.tsx +17 -0
- package/src/components/Time/Time.tsx +25 -0
- package/src/containers/DevMenuContainer.tsx +28 -0
- package/src/containers/DevPanelContainer.tsx +10 -0
- package/src/containers/EndpointConfigsContainer.tsx +12 -0
- package/src/containers/EndpointStatusContainer.tsx +12 -0
- package/src/containers/GlobalSettingsContainer.tsx +12 -0
- package/src/containers/GlobalStatsContainer.tsx +12 -0
- package/src/containers/LifecycleApiErrorContainer.tsx +11 -0
- package/src/containers/LifecycleGeneralErrorContainer.tsx +11 -0
- package/src/containers/LifecycleInQueueContainer.tsx +11 -0
- package/src/containers/LifecyclePendingApiContainer.tsx +11 -0
- package/src/containers/LifecyclePostActionContainer.tsx +11 -0
- package/src/containers/LifecycleReceivedContainer.tsx +11 -0
- package/src/content_script.ts +19 -0
- package/src/data/devComponents.tsx +25 -0
- package/src/data/devRoutes.ts +83 -0
- package/src/devtools.tsx +29 -0
- package/src/index.ts +1 -0
- package/src/injected_script.ts +9 -0
- package/src/options.tsx +77 -0
- package/src/panel.tsx +30 -0
- package/src/popup.tsx +63 -0
- package/src/store/initialState.ts +42 -0
- package/src/store/selectors.ts +205 -0
- package/src/sum.ts +3 -0
- package/src/types.ts +1 -0
- package/src/utils/date.ts +3 -0
- package/tsconfig.json +24 -0
- package/vite.config.ts +45 -0
- package/webpack/webpack.common.js +46 -0
- package/webpack/webpack.dev.js +7 -0
- package/webpack/webpack.prod.js +6 -0
- package/esm/components/Config/Config.d.ts +0 -6
- package/esm/components/Config/Config.js +0 -15
- package/esm/components/DevTools/DevTools.d.ts +0 -4
- package/esm/components/DevTools/DevTools.js +0 -19
- package/esm/components/DevToolsLocal/DevToolsLocal.d.ts +0 -4
- package/esm/components/DevToolsLocal/DevToolsLocal.js +0 -12
- package/esm/components/Dispatcher/Dispatcher.d.ts +0 -8
- package/esm/components/Dispatcher/Dispatcher.js +0 -61
- package/esm/components/GlobalSettings/GlobalSettings.d.ts +0 -6
- package/esm/components/GlobalSettings/GlobalSettings.js +0 -16
- package/esm/components/Group/Group.d.ts +0 -9
- package/esm/components/Group/Group.js +0 -14
- package/esm/components/Json/Json.d.ts +0 -7
- package/esm/components/Json/Json.js +0 -9
- package/esm/components/Logs/Logs.d.ts +0 -6
- package/esm/components/Logs/Logs.js +0 -49
- package/esm/components/Monitor/Monitor.d.ts +0 -6
- package/esm/components/Monitor/Monitor.js +0 -54
- package/esm/components/OverlayManager/OverlayManager.d.ts +0 -6
- package/esm/components/OverlayManager/OverlayManager.js +0 -17
- package/esm/components/Panel/Panel.d.ts +0 -14
- package/esm/components/Panel/Panel.js +0 -46
- package/esm/components/Preview/Preview.d.ts +0 -18
- package/esm/components/Preview/Preview.js +0 -58
- package/esm/components/Redux/Redux.d.ts +0 -6
- package/esm/components/Redux/Redux.js +0 -72
- package/esm/components/ReduxSettings/ReduxSettings.d.ts +0 -9
- package/esm/components/ReduxSettings/ReduxSettings.js +0 -60
- package/esm/components/Requests/Requests.d.ts +0 -6
- package/esm/components/Requests/Requests.js +0 -61
- package/esm/components/Status/Status.d.ts +0 -6
- package/esm/components/Status/Status.js +0 -16
- package/esm/components/TaskManager/TaskManager.d.ts +0 -9
- package/esm/components/TaskManager/TaskManager.js +0 -22
- package/esm/components/Timeline/Timeline.d.ts +0 -6
- package/esm/components/Timeline/Timeline.js +0 -13
- package/esm/components/TimelineEvent/TimelineEvent.d.ts +0 -7
- package/esm/components/TimelineEvent/TimelineEvent.js +0 -13
- package/esm/components/TimelineHeader/TimelineHeader.d.ts +0 -4
- package/esm/components/TimelineHeader/TimelineHeader.js +0 -5
- package/esm/components/TimelineRow/TimelineRow.d.ts +0 -7
- package/esm/components/TimelineRow/TimelineRow.js +0 -13
- package/esm/components/TimelineRowHeader/TimelineRowHeader.d.ts +0 -7
- package/esm/components/TimelineRowHeader/TimelineRowHeader.js +0 -10
- package/esm/components/Toggle/Toggle.d.ts +0 -8
- package/esm/components/Toggle/Toggle.js +0 -8
- package/esm/components/VirtualList/VirtualList.d.ts +0 -19
- package/esm/components/VirtualList/VirtualList.js +0 -30
- package/esm/components/Visual/Visual.d.ts +0 -6
- package/esm/components/Visual/Visual.js +0 -38
- package/esm/components/prefix.d.ts +0 -2
- package/esm/components/prefix.js +0 -2
- package/esm/data/boxSizes.d.ts +0 -2
- package/esm/data/boxSizes.js +0 -10
- package/esm/data/dispatcherActions.d.ts +0 -5
- package/esm/data/dispatcherActions.js +0 -35
- package/esm/data/layoutDefault.d.ts +0 -2
- package/esm/data/layoutDefault.js +0 -46
- package/esm/data/panels.d.ts +0 -2
- package/esm/data/panels.js +0 -14
- package/esm/data/panelsArrangements.d.ts +0 -19
- package/esm/data/panelsArrangements.js +0 -19
- package/esm/data/panelsLocal.d.ts +0 -2
- package/esm/data/panelsLocal.js +0 -7
- package/esm/data/reduxFilterOptions.d.ts +0 -20
- package/esm/data/reduxFilterOptions.js +0 -223
- package/esm/data/widgets.d.ts +0 -2
- package/esm/data/widgets.js +0 -154
- package/esm/data/widgetsLocal.d.ts +0 -2
- package/esm/data/widgetsLocal.js +0 -19
- package/esm/hooks/index.d.ts +0 -7
- package/esm/hooks/index.js +0 -7
- package/esm/hooks/misc/hookState.d.ts +0 -8
- package/esm/hooks/misc/hookState.js +0 -6
- package/esm/hooks/misc/util.d.ts +0 -5
- package/esm/hooks/misc/util.js +0 -21
- package/esm/hooks/useBoolean.d.ts +0 -3
- package/esm/hooks/useBoolean.js +0 -3
- package/esm/hooks/useClickAway.d.ts +0 -3
- package/esm/hooks/useClickAway.js +0 -27
- package/esm/hooks/useEvent.d.ts +0 -13
- package/esm/hooks/useEvent.js +0 -35
- package/esm/hooks/useKey.d.ts +0 -12
- package/esm/hooks/useKey.js +0 -29
- package/esm/hooks/useList.d.ts +0 -57
- package/esm/hooks/useList.js +0 -74
- package/esm/hooks/useLocalstorage.d.ts +0 -10
- package/esm/hooks/useLocalstorage.js +0 -75
- package/esm/hooks/usePanels.d.ts +0 -10
- package/esm/hooks/usePanels.js +0 -45
- package/esm/hooks/useSetState.d.ts +0 -2
- package/esm/hooks/useSetState.js +0 -10
- package/esm/hooks/useToggle.d.ts +0 -2
- package/esm/hooks/useToggle.js +0 -6
- package/esm/hooks/useUpdate.d.ts +0 -1
- package/esm/hooks/useUpdate.js +0 -6
- package/esm/index.d.ts +0 -4
- package/esm/index.js +0 -4
- package/esm/selectors/selectors.d.ts +0 -21
- package/esm/selectors/selectors.js +0 -20
- package/esm/theme/devtoolsTheme.d.ts +0 -2
- package/esm/theme/devtoolsTheme.js +0 -95
- package/esm/types.d.ts +0 -21
- package/esm/types.js +0 -1
- package/esm/utils/filter.d.ts +0 -3
- package/esm/utils/filter.js +0 -25
- package/esm/utils/localStorage.d.ts +0 -2
- package/esm/utils/localStorage.js +0 -21
- package/esm/utils/sockets.d.ts +0 -7
- package/esm/utils/sockets.js +0 -27
- package/lib/components/Colors copy.css +0 -3
- package/lib/components/Colors copy.css.map +0 -1
- package/lib/components/Colors.css +0 -3
- package/lib/components/Colors.css.map +0 -1
- package/lib/components/ColorsDark.css +0 -3
- package/lib/components/ColorsDark.css.map +0 -1
- package/lib/components/Config/Config.css +0 -15
- package/lib/components/Config/Config.css.map +0 -1
- package/lib/components/Config/Config.d.ts +0 -6
- package/lib/components/Config/Config.js +0 -20
- package/lib/components/DevTools/DevTools.css +0 -11
- package/lib/components/DevTools/DevTools.css.map +0 -1
- package/lib/components/DevTools/DevTools.d.ts +0 -4
- package/lib/components/DevTools/DevTools.js +0 -24
- package/lib/components/DevToolsLocal/DevToolsLocal.css +0 -11
- package/lib/components/DevToolsLocal/DevToolsLocal.css.map +0 -1
- package/lib/components/DevToolsLocal/DevToolsLocal.d.ts +0 -4
- package/lib/components/DevToolsLocal/DevToolsLocal.js +0 -17
- package/lib/components/Dispatcher/Dispatcher.css +0 -15
- package/lib/components/Dispatcher/Dispatcher.css.map +0 -1
- package/lib/components/Dispatcher/Dispatcher.d.ts +0 -8
- package/lib/components/Dispatcher/Dispatcher.js +0 -65
- package/lib/components/GlobalSettings/GlobalSettings.css +0 -3
- package/lib/components/GlobalSettings/GlobalSettings.css.map +0 -1
- package/lib/components/GlobalSettings/GlobalSettings.d.ts +0 -6
- package/lib/components/GlobalSettings/GlobalSettings.js +0 -21
- package/lib/components/Group/Group.css +0 -41
- package/lib/components/Group/Group.css.map +0 -1
- package/lib/components/Group/Group.d.ts +0 -9
- package/lib/components/Group/Group.js +0 -19
- package/lib/components/Json/Json.css +0 -5
- package/lib/components/Json/Json.css.map +0 -1
- package/lib/components/Json/Json.d.ts +0 -7
- package/lib/components/Json/Json.js +0 -14
- package/lib/components/Logs/Logs.css +0 -5
- package/lib/components/Logs/Logs.css.map +0 -1
- package/lib/components/Logs/Logs.d.ts +0 -6
- package/lib/components/Logs/Logs.js +0 -54
- package/lib/components/Monitor/Monitor.css +0 -5
- package/lib/components/Monitor/Monitor.css.map +0 -1
- package/lib/components/Monitor/Monitor.d.ts +0 -6
- package/lib/components/Monitor/Monitor.js +0 -59
- package/lib/components/OverlayManager/OverlayManager.css +0 -72
- package/lib/components/OverlayManager/OverlayManager.css.map +0 -1
- package/lib/components/OverlayManager/OverlayManager.d.ts +0 -6
- package/lib/components/OverlayManager/OverlayManager.js +0 -22
- package/lib/components/Panel/Panel.css +0 -35
- package/lib/components/Panel/Panel.css.map +0 -1
- package/lib/components/Panel/Panel.d.ts +0 -14
- package/lib/components/Panel/Panel.js +0 -51
- package/lib/components/Prefix copy.css +0 -3
- package/lib/components/Prefix copy.css.map +0 -1
- package/lib/components/Prefix.css +0 -3
- package/lib/components/Prefix.css.map +0 -1
- package/lib/components/Preview/Preview.css +0 -29
- package/lib/components/Preview/Preview.css.map +0 -1
- package/lib/components/Preview/Preview.d.ts +0 -18
- package/lib/components/Preview/Preview.js +0 -64
- package/lib/components/Reading.css +0 -107
- package/lib/components/Reading.css.map +0 -1
- package/lib/components/Redux/Redux.css +0 -86
- package/lib/components/Redux/Redux.css.map +0 -1
- package/lib/components/Redux/Redux.d.ts +0 -6
- package/lib/components/Redux/Redux.js +0 -77
- package/lib/components/ReduxSettings/ReduxSettings.css +0 -10
- package/lib/components/ReduxSettings/ReduxSettings.css.map +0 -1
- package/lib/components/ReduxSettings/ReduxSettings.d.ts +0 -9
- package/lib/components/ReduxSettings/ReduxSettings.js +0 -64
- package/lib/components/Requests/Requests.css +0 -8
- package/lib/components/Requests/Requests.css.map +0 -1
- package/lib/components/Requests/Requests.d.ts +0 -6
- package/lib/components/Requests/Requests.js +0 -66
- package/lib/components/Status/Status.css +0 -15
- package/lib/components/Status/Status.css.map +0 -1
- package/lib/components/Status/Status.d.ts +0 -6
- package/lib/components/Status/Status.js +0 -21
- package/lib/components/TaskManager/TaskManager.css +0 -9
- package/lib/components/TaskManager/TaskManager.css.map +0 -1
- package/lib/components/TaskManager/TaskManager.d.ts +0 -9
- package/lib/components/TaskManager/TaskManager.js +0 -28
- package/lib/components/Timeline/Timeline.css +0 -5
- package/lib/components/Timeline/Timeline.css.map +0 -1
- package/lib/components/Timeline/Timeline.d.ts +0 -6
- package/lib/components/Timeline/Timeline.js +0 -18
- package/lib/components/TimelineEvent/TimelineEvent.css +0 -20
- package/lib/components/TimelineEvent/TimelineEvent.css.map +0 -1
- package/lib/components/TimelineEvent/TimelineEvent.d.ts +0 -7
- package/lib/components/TimelineEvent/TimelineEvent.js +0 -18
- package/lib/components/TimelineHeader/TimelineHeader.css +0 -6
- package/lib/components/TimelineHeader/TimelineHeader.css.map +0 -1
- package/lib/components/TimelineHeader/TimelineHeader.d.ts +0 -4
- package/lib/components/TimelineHeader/TimelineHeader.js +0 -10
- package/lib/components/TimelineRow/TimelineRow.css +0 -14
- package/lib/components/TimelineRow/TimelineRow.css.map +0 -1
- package/lib/components/TimelineRow/TimelineRow.d.ts +0 -7
- package/lib/components/TimelineRow/TimelineRow.js +0 -18
- package/lib/components/TimelineRowHeader/TimelineRowHeader.css +0 -45
- package/lib/components/TimelineRowHeader/TimelineRowHeader.css.map +0 -1
- package/lib/components/TimelineRowHeader/TimelineRowHeader.d.ts +0 -7
- package/lib/components/TimelineRowHeader/TimelineRowHeader.js +0 -15
- package/lib/components/Toggle/Toggle.css +0 -3
- package/lib/components/Toggle/Toggle.css.map +0 -1
- package/lib/components/Toggle/Toggle.d.ts +0 -8
- package/lib/components/Toggle/Toggle.js +0 -13
- package/lib/components/Variables.css +0 -3
- package/lib/components/Variables.css.map +0 -1
- package/lib/components/VirtualList/VirtualList.css +0 -13
- package/lib/components/VirtualList/VirtualList.css.map +0 -1
- package/lib/components/VirtualList/VirtualList.d.ts +0 -19
- package/lib/components/VirtualList/VirtualList.js +0 -35
- package/lib/components/Visual/Visual.css +0 -57
- package/lib/components/Visual/Visual.css.map +0 -1
- package/lib/components/Visual/Visual.d.ts +0 -6
- package/lib/components/Visual/Visual.js +0 -43
- package/lib/components/prefix.d.ts +0 -2
- package/lib/components/prefix.js +0 -5
- package/lib/data/boxSizes.d.ts +0 -2
- package/lib/data/boxSizes.js +0 -13
- package/lib/data/dispatcherActions.d.ts +0 -5
- package/lib/data/dispatcherActions.js +0 -38
- package/lib/data/layoutDefault.d.ts +0 -2
- package/lib/data/layoutDefault.js +0 -49
- package/lib/data/panels.d.ts +0 -2
- package/lib/data/panels.js +0 -17
- package/lib/data/panelsArrangements.d.ts +0 -19
- package/lib/data/panelsArrangements.js +0 -22
- package/lib/data/panelsLocal.d.ts +0 -2
- package/lib/data/panelsLocal.js +0 -10
- package/lib/data/reduxFilterOptions.d.ts +0 -20
- package/lib/data/reduxFilterOptions.js +0 -227
- package/lib/data/widgets.d.ts +0 -2
- package/lib/data/widgets.js +0 -157
- package/lib/data/widgetsLocal.d.ts +0 -2
- package/lib/data/widgetsLocal.js +0 -22
- package/lib/hooks/index.d.ts +0 -7
- package/lib/hooks/index.js +0 -17
- package/lib/hooks/misc/hookState.d.ts +0 -8
- package/lib/hooks/misc/hookState.js +0 -10
- package/lib/hooks/misc/util.d.ts +0 -5
- package/lib/hooks/misc/util.js +0 -27
- package/lib/hooks/useBoolean.d.ts +0 -3
- package/lib/hooks/useBoolean.js +0 -7
- package/lib/hooks/useClickAway.d.ts +0 -3
- package/lib/hooks/useClickAway.js +0 -31
- package/lib/hooks/useEvent.d.ts +0 -13
- package/lib/hooks/useEvent.js +0 -37
- package/lib/hooks/useKey.d.ts +0 -12
- package/lib/hooks/useKey.js +0 -34
- package/lib/hooks/useList.d.ts +0 -57
- package/lib/hooks/useList.js +0 -79
- package/lib/hooks/useLocalstorage.d.ts +0 -10
- package/lib/hooks/useLocalstorage.js +0 -79
- package/lib/hooks/usePanels.d.ts +0 -10
- package/lib/hooks/usePanels.js +0 -49
- package/lib/hooks/useSetState.d.ts +0 -2
- package/lib/hooks/useSetState.js +0 -14
- package/lib/hooks/useToggle.d.ts +0 -2
- package/lib/hooks/useToggle.js +0 -10
- package/lib/hooks/useUpdate.d.ts +0 -1
- package/lib/hooks/useUpdate.js +0 -9
- package/lib/index.css +0 -605
- package/lib/index.css.map +0 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -11
- package/lib/selectors/selectors.d.ts +0 -21
- package/lib/selectors/selectors.js +0 -24
- package/lib/theme/devtoolsTheme.d.ts +0 -2
- package/lib/theme/devtoolsTheme.js +0 -97
- package/lib/types.d.ts +0 -21
- package/lib/types.js +0 -2
- package/lib/utils/filter.d.ts +0 -3
- package/lib/utils/filter.js +0 -29
- package/lib/utils/localStorage.d.ts +0 -2
- package/lib/utils/localStorage.js +0 -26
- package/lib/utils/sockets.d.ts +0 -7
- package/lib/utils/sockets.js +0 -34
package/lib/hooks/useList.d.ts
DELETED
@@ -1,57 +0,0 @@
|
|
1
|
-
import { IHookStateInitAction, IHookStateSetAction } from './misc/hookState';
|
2
|
-
export interface ListActions<T> {
|
3
|
-
/**
|
4
|
-
* @description Set new list instead old one
|
5
|
-
*/
|
6
|
-
set: (newList: IHookStateSetAction<T[]>) => void;
|
7
|
-
/**
|
8
|
-
* @description Add item(s) at the end of list
|
9
|
-
*/
|
10
|
-
push: (...items: T[]) => void;
|
11
|
-
/**
|
12
|
-
* @description Replace item at given position. If item at given position not exists it will be set.
|
13
|
-
*/
|
14
|
-
updateAt: (index: number, item: T) => void;
|
15
|
-
/**
|
16
|
-
* @description Insert item at given position, all items to the right will be shifted.
|
17
|
-
*/
|
18
|
-
insertAt: (index: number, item: T) => void;
|
19
|
-
/**
|
20
|
-
* @description Replace all items that matches predicate with given one.
|
21
|
-
*/
|
22
|
-
update: (predicate: (a: T, b: T) => boolean, newItem: T) => void;
|
23
|
-
/**
|
24
|
-
* @description Replace first item matching predicate with given one.
|
25
|
-
*/
|
26
|
-
updateFirst: (predicate: (a: T, b: T) => boolean, newItem: T) => void;
|
27
|
-
/**
|
28
|
-
* @description Like `updateFirst` bit in case of predicate miss - pushes item to the list
|
29
|
-
*/
|
30
|
-
upsert: (predicate: (a: T, b: T) => boolean, newItem: T) => void;
|
31
|
-
/**
|
32
|
-
* @description Sort list with given sorting function
|
33
|
-
*/
|
34
|
-
sort: (compareFn?: (a: T, b: T) => number) => void;
|
35
|
-
/**
|
36
|
-
* @description Same as native Array's method
|
37
|
-
*/
|
38
|
-
filter: (callbackFn: (value: T, index?: number, array?: T[]) => boolean, thisArg?: any) => void;
|
39
|
-
/**
|
40
|
-
* @description Removes item at given position. All items to the right from removed will be shifted.
|
41
|
-
*/
|
42
|
-
removeAt: (index: number) => void;
|
43
|
-
/**
|
44
|
-
* @deprecated Use removeAt method instead
|
45
|
-
*/
|
46
|
-
remove: (index: number) => void;
|
47
|
-
/**
|
48
|
-
* @description Make the list empty
|
49
|
-
*/
|
50
|
-
clear: () => void;
|
51
|
-
/**
|
52
|
-
* @description Reset list to initial value
|
53
|
-
*/
|
54
|
-
reset: () => void;
|
55
|
-
}
|
56
|
-
export declare function useList<T>(initialList?: IHookStateInitAction<T[]>): [T[], ListActions<T>];
|
57
|
-
export default useList;
|
package/lib/hooks/useList.js
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.useList = void 0;
|
4
|
-
var tslib_1 = require("tslib");
|
5
|
-
var react_1 = require("react");
|
6
|
-
var useUpdate_1 = tslib_1.__importDefault(require("./useUpdate"));
|
7
|
-
var hookState_1 = require("./misc/hookState");
|
8
|
-
function useList(initialList) {
|
9
|
-
if (initialList === void 0) { initialList = []; }
|
10
|
-
var list = react_1.useRef(hookState_1.resolveHookState(initialList));
|
11
|
-
var update = useUpdate_1.default();
|
12
|
-
var actions = react_1.useMemo(function () {
|
13
|
-
var a = {
|
14
|
-
set: function (newList) {
|
15
|
-
list.current = hookState_1.resolveHookState(newList, list.current);
|
16
|
-
update();
|
17
|
-
},
|
18
|
-
push: function () {
|
19
|
-
var items = [];
|
20
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
21
|
-
items[_i] = arguments[_i];
|
22
|
-
}
|
23
|
-
items.length && actions.set(function (curr) { return curr.concat(items); });
|
24
|
-
},
|
25
|
-
updateAt: function (index, item) {
|
26
|
-
actions.set(function (curr) {
|
27
|
-
var arr = curr.slice();
|
28
|
-
arr[index] = item;
|
29
|
-
return arr;
|
30
|
-
});
|
31
|
-
},
|
32
|
-
insertAt: function (index, item) {
|
33
|
-
actions.set(function (curr) {
|
34
|
-
var arr = curr.slice();
|
35
|
-
index > arr.length ? (arr[index] = item) : arr.splice(index, 0, item);
|
36
|
-
return arr;
|
37
|
-
});
|
38
|
-
},
|
39
|
-
update: function (predicate, newItem) {
|
40
|
-
actions.set(function (curr) { return curr.map(function (item) { return (predicate(item, newItem) ? newItem : item); }); });
|
41
|
-
},
|
42
|
-
updateFirst: function (predicate, newItem) {
|
43
|
-
var index = list.current.findIndex(function (item) { return predicate(item, newItem); });
|
44
|
-
index >= 0 && actions.updateAt(index, newItem);
|
45
|
-
},
|
46
|
-
upsert: function (predicate, newItem) {
|
47
|
-
var index = list.current.findIndex(function (item) { return predicate(item, newItem); });
|
48
|
-
index >= 0 ? actions.updateAt(index, newItem) : actions.push(newItem);
|
49
|
-
},
|
50
|
-
sort: function (compareFn) {
|
51
|
-
actions.set(function (curr) { return curr.slice().sort(compareFn); });
|
52
|
-
},
|
53
|
-
filter: function (callbackFn, thisArg) {
|
54
|
-
actions.set(function (curr) { return curr.slice().filter(callbackFn, thisArg); });
|
55
|
-
},
|
56
|
-
removeAt: function (index) {
|
57
|
-
actions.set(function (curr) {
|
58
|
-
var arr = curr.slice();
|
59
|
-
arr.splice(index, 1);
|
60
|
-
return arr;
|
61
|
-
});
|
62
|
-
},
|
63
|
-
clear: function () {
|
64
|
-
actions.set([]);
|
65
|
-
},
|
66
|
-
reset: function () {
|
67
|
-
actions.set(hookState_1.resolveHookState(initialList).slice());
|
68
|
-
},
|
69
|
-
};
|
70
|
-
/**
|
71
|
-
* @deprecated Use removeAt method instead
|
72
|
-
*/
|
73
|
-
a.remove = a.removeAt;
|
74
|
-
return a;
|
75
|
-
}, []);
|
76
|
-
return [list.current, actions];
|
77
|
-
}
|
78
|
-
exports.useList = useList;
|
79
|
-
exports.default = useList;
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { Dispatch, SetStateAction } from 'react';
|
2
|
-
declare type parserOptions<T> = {
|
3
|
-
raw: true;
|
4
|
-
} | {
|
5
|
-
raw: false;
|
6
|
-
serializer: (value: T) => string;
|
7
|
-
deserializer: (value: string) => T;
|
8
|
-
};
|
9
|
-
export declare const useLocalstorage: <T>(key: string, initialValue?: T | undefined, options?: parserOptions<T> | undefined) => [T | undefined, Dispatch<SetStateAction<T | undefined>>, () => void];
|
10
|
-
export default useLocalstorage;
|
@@ -1,79 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.useLocalstorage = void 0;
|
4
|
-
var react_1 = require("react");
|
5
|
-
var util_1 = require("./misc/util");
|
6
|
-
var useLocalstorage = function (key, initialValue, options) {
|
7
|
-
if (!util_1.isBrowser) {
|
8
|
-
return [initialValue, util_1.noop, util_1.noop];
|
9
|
-
}
|
10
|
-
if (!key) {
|
11
|
-
throw new Error('useLocalStorage key may not be falsy');
|
12
|
-
}
|
13
|
-
var deserializer = options ? (options.raw ? function (value) { return value; } : options.deserializer) : JSON.parse;
|
14
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
15
|
-
var initializer = react_1.useRef(function (key) {
|
16
|
-
try {
|
17
|
-
var serializer = options ? (options.raw ? String : options.serializer) : JSON.stringify;
|
18
|
-
var localStorageValue = localStorage.getItem(key);
|
19
|
-
if (localStorageValue !== null) {
|
20
|
-
return deserializer(localStorageValue);
|
21
|
-
}
|
22
|
-
else {
|
23
|
-
initialValue && localStorage.setItem(key, serializer(initialValue));
|
24
|
-
return initialValue;
|
25
|
-
}
|
26
|
-
}
|
27
|
-
catch (_a) {
|
28
|
-
// If user is in private mode or has storage restriction
|
29
|
-
// localStorage can throw. JSON.parse and JSON.stringify
|
30
|
-
// can throw, too.
|
31
|
-
return initialValue;
|
32
|
-
}
|
33
|
-
});
|
34
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
35
|
-
var _a = react_1.useState(function () { return initializer.current(key); }), state = _a[0], setState = _a[1];
|
36
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
37
|
-
react_1.useLayoutEffect(function () { return setState(initializer.current(key)); }, [key]);
|
38
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
39
|
-
var set = react_1.useCallback(function (valOrFunc) {
|
40
|
-
try {
|
41
|
-
var newState = typeof valOrFunc === 'function' ? valOrFunc(state) : valOrFunc;
|
42
|
-
if (typeof newState === 'undefined')
|
43
|
-
return;
|
44
|
-
var value = void 0;
|
45
|
-
if (options)
|
46
|
-
if (options.raw)
|
47
|
-
if (typeof newState === 'string')
|
48
|
-
value = newState;
|
49
|
-
else
|
50
|
-
value = JSON.stringify(newState);
|
51
|
-
else if (options.serializer)
|
52
|
-
value = options.serializer(newState);
|
53
|
-
else
|
54
|
-
value = JSON.stringify(newState);
|
55
|
-
else
|
56
|
-
value = JSON.stringify(newState);
|
57
|
-
localStorage.setItem(key, value);
|
58
|
-
setState(deserializer(value));
|
59
|
-
}
|
60
|
-
catch (_a) {
|
61
|
-
// If user is in private mode or has storage restriction
|
62
|
-
// localStorage can throw. Also JSON.stringify can throw.
|
63
|
-
}
|
64
|
-
}, [key, setState]);
|
65
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
66
|
-
var remove = react_1.useCallback(function () {
|
67
|
-
try {
|
68
|
-
localStorage.removeItem(key);
|
69
|
-
setState(undefined);
|
70
|
-
}
|
71
|
-
catch (_a) {
|
72
|
-
// If user is in private mode or has storage restriction
|
73
|
-
// localStorage can throw.
|
74
|
-
}
|
75
|
-
}, [key, setState]);
|
76
|
-
return [state, set, remove];
|
77
|
-
};
|
78
|
-
exports.useLocalstorage = useLocalstorage;
|
79
|
-
exports.default = exports.useLocalstorage;
|
package/lib/hooks/usePanels.d.ts
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
/// <reference types="react" />
|
2
|
-
export interface PanelState {
|
3
|
-
guid: string;
|
4
|
-
isWide?: boolean;
|
5
|
-
}
|
6
|
-
export interface PanelChildProps {
|
7
|
-
id: string;
|
8
|
-
isWide: boolean;
|
9
|
-
}
|
10
|
-
export declare function usePanels(Cmp: (props: any) => JSX.Element): JSX.Element;
|
package/lib/hooks/usePanels.js
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.usePanels = void 0;
|
4
|
-
var tslib_1 = require("tslib");
|
5
|
-
var React = tslib_1.__importStar(require("react"));
|
6
|
-
var Panel_1 = require("../components/Panel/Panel");
|
7
|
-
var react_1 = require("react");
|
8
|
-
var react_use_1 = require("react-use");
|
9
|
-
var localStorage_1 = require("../utils/localStorage");
|
10
|
-
function uuidv4() {
|
11
|
-
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
12
|
-
var r = (Math.random() * 16) | 0, v = c === 'x' ? r : (r & 0x3) | 0x8;
|
13
|
-
return v.toString(16);
|
14
|
-
});
|
15
|
-
}
|
16
|
-
function usePanels(Cmp) {
|
17
|
-
var _a = react_use_1.useLocalStorage('PANELS_STATE', []), savedList = _a[0], setSavedList = _a[1];
|
18
|
-
var _b = react_use_1.useList(savedList), list = _b[0], _c = _b[1], push = _c.push, updateAt = _c.updateAt, removeAt = _c.removeAt;
|
19
|
-
react_1.useEffect(function () {
|
20
|
-
setSavedList(list);
|
21
|
-
}, [list, setSavedList]);
|
22
|
-
react_use_1.useKey('`', function (ev) {
|
23
|
-
if (ev.ctrlKey) {
|
24
|
-
localStorage_1.loadPanelsArrangement();
|
25
|
-
}
|
26
|
-
else {
|
27
|
-
add();
|
28
|
-
}
|
29
|
-
});
|
30
|
-
var add = react_1.useCallback(function () {
|
31
|
-
var guid = uuidv4();
|
32
|
-
push({ guid: guid });
|
33
|
-
}, [push]);
|
34
|
-
var remove = react_1.useCallback(function (guid) {
|
35
|
-
var index = list.findIndex(function (item) { return item.guid === guid; });
|
36
|
-
removeAt(index);
|
37
|
-
}, [removeAt, list]);
|
38
|
-
var onToggleSize = react_1.useCallback(function (guid, isWide) {
|
39
|
-
var index = list.findIndex(function (item) { return item.guid === guid; });
|
40
|
-
var updatedItem = tslib_1.__assign(tslib_1.__assign({}, list[index]), { isWide: isWide });
|
41
|
-
updateAt(index, updatedItem);
|
42
|
-
}, [list, updateAt]);
|
43
|
-
var fullJsx = react_1.useMemo(function () { return (React.createElement(React.Fragment, null, list.map(function (panelState) { return (React.createElement(Panel_1.Panel, { id: panelState.guid, isWide: panelState.isWide, key: panelState.guid, onToggleSize: function (isWide) {
|
44
|
-
return onToggleSize(panelState.guid, isWide);
|
45
|
-
}, onNew: add, onClose: function () { return remove(panelState.guid); }, showDuplicate: true, showLock: true },
|
46
|
-
React.createElement(Cmp, { isWide: panelState.isWide, id: panelState.guid }))); }))); }, [list, Cmp, add, remove, onToggleSize]);
|
47
|
-
return fullJsx;
|
48
|
-
}
|
49
|
-
exports.usePanels = usePanels;
|
package/lib/hooks/useSetState.js
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.useSetState = void 0;
|
4
|
-
var react_1 = require("react");
|
5
|
-
var useSetState = function (initialState) {
|
6
|
-
if (initialState === void 0) { initialState = {}; }
|
7
|
-
var _a = react_1.useState(initialState), state = _a[0], set = _a[1];
|
8
|
-
var setState = react_1.useCallback(function (patch) {
|
9
|
-
set(function (prevState) { return Object.assign({}, prevState, patch instanceof Function ? patch(prevState) : patch); });
|
10
|
-
}, []);
|
11
|
-
return [state, setState];
|
12
|
-
};
|
13
|
-
exports.useSetState = useSetState;
|
14
|
-
exports.default = exports.useSetState;
|
package/lib/hooks/useToggle.d.ts
DELETED
package/lib/hooks/useToggle.js
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.useToggle = void 0;
|
4
|
-
var react_1 = require("react");
|
5
|
-
var toggleReducer = function (state, nextValue) { return (typeof nextValue === 'boolean' ? nextValue : !state); };
|
6
|
-
var useToggle = function (initialValue) {
|
7
|
-
return react_1.useReducer(toggleReducer, initialValue);
|
8
|
-
};
|
9
|
-
exports.useToggle = useToggle;
|
10
|
-
exports.default = exports.useToggle;
|
package/lib/hooks/useUpdate.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export default function useUpdate(): () => void;
|
package/lib/hooks/useUpdate.js
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
var react_1 = require("react");
|
4
|
-
var updateReducer = function (num) { return (num + 1) % 1000000; };
|
5
|
-
function useUpdate() {
|
6
|
-
var _a = react_1.useReducer(updateReducer, 0), update = _a[1];
|
7
|
-
return update;
|
8
|
-
}
|
9
|
-
exports.default = useUpdate;
|