redux-connected-devtools 0.0.13 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (314) hide show
  1. package/.env +2 -0
  2. package/.prettierrc.js +10 -0
  3. package/.vscode/settings.json +12 -0
  4. package/.vscode/tasks.json +33 -0
  5. package/LICENSE +21 -0
  6. package/README.md +5 -0
  7. package/index.html +58 -0
  8. package/jest.config.js +8 -0
  9. package/package.json +47 -62
  10. package/public/devtools.html +8 -0
  11. package/public/icon.png +0 -0
  12. package/public/manifest.json +29 -0
  13. package/public/options.html +12 -0
  14. package/public/panel.html +39 -0
  15. package/public/popup.html +12 -0
  16. package/src/__tests__/sum.ts +9 -0
  17. package/src/background.ts +49 -0
  18. package/src/components/DevInspector/DevInspector.scss +2 -0
  19. package/src/components/DevInspector/DevInspector.style.tsx +8 -0
  20. package/src/components/DevInspector/DevInspector.tsx +34 -0
  21. package/src/components/DevList/DevList.scss +2 -0
  22. package/src/components/DevList/DevList.style.tsx +34 -0
  23. package/src/components/DevList/DevList.tsx +62 -0
  24. package/src/components/DevMenu/DevMenu.scss +2 -0
  25. package/src/components/DevMenu/DevMenu.style.tsx +53 -0
  26. package/src/components/DevMenu/DevMenu.tsx +76 -0
  27. package/src/components/DevPanel/DevPanel.scss +2 -0
  28. package/src/components/DevPanel/DevPanel.style.tsx +16 -0
  29. package/src/components/DevPanel/DevPanel.tsx +51 -0
  30. package/src/components/JourneyRow/JourneyRow.scss +2 -0
  31. package/src/components/JourneyRow/JourneyRow.style.tsx +46 -0
  32. package/src/components/JourneyRow/JourneyRow.tsx +58 -0
  33. package/src/components/JsonViewer/JsonViewer.scss +2 -0
  34. package/src/components/JsonViewer/JsonViewer.style.tsx +31 -0
  35. package/src/components/JsonViewer/JsonViewer.tsx +24 -0
  36. package/src/components/Lifecycle/Lifecycle.scss +2 -0
  37. package/src/components/Lifecycle/Lifecycle.style.tsx +6 -0
  38. package/src/components/Lifecycle/Lifecycle.tsx +31 -0
  39. package/src/components/LogsViewer/LogsViewer.scss +2 -0
  40. package/src/components/LogsViewer/LogsViewer.style.tsx +5 -0
  41. package/src/components/LogsViewer/LogsViewer.tsx +14 -0
  42. package/src/components/RequestDetails/RequestDetails.scss +2 -0
  43. package/src/components/RequestDetails/RequestDetails.style.tsx +20 -0
  44. package/src/components/RequestDetails/RequestDetails.tsx +60 -0
  45. package/src/components/RequestJourney/RequestJourney.scss +2 -0
  46. package/src/components/RequestJourney/RequestJourney.style.tsx +6 -0
  47. package/src/components/RequestJourney/RequestJourney.tsx +33 -0
  48. package/src/components/RequestRow/RequestRow.scss +2 -0
  49. package/src/components/RequestRow/RequestRow.style.tsx +31 -0
  50. package/src/components/RequestRow/RequestRow.tsx +37 -0
  51. package/src/components/Time/Time.scss +2 -0
  52. package/src/components/Time/Time.style.tsx +17 -0
  53. package/src/components/Time/Time.tsx +25 -0
  54. package/src/containers/DevMenuContainer.tsx +28 -0
  55. package/src/containers/DevPanelContainer.tsx +10 -0
  56. package/src/containers/EndpointConfigsContainer.tsx +12 -0
  57. package/src/containers/EndpointStatusContainer.tsx +12 -0
  58. package/src/containers/GlobalSettingsContainer.tsx +12 -0
  59. package/src/containers/GlobalStatsContainer.tsx +12 -0
  60. package/src/containers/LifecycleApiErrorContainer.tsx +11 -0
  61. package/src/containers/LifecycleGeneralErrorContainer.tsx +11 -0
  62. package/src/containers/LifecycleInQueueContainer.tsx +11 -0
  63. package/src/containers/LifecyclePendingApiContainer.tsx +11 -0
  64. package/src/containers/LifecyclePostActionContainer.tsx +11 -0
  65. package/src/containers/LifecycleReceivedContainer.tsx +11 -0
  66. package/src/content_script.ts +19 -0
  67. package/src/data/devComponents.tsx +25 -0
  68. package/src/data/devRoutes.ts +83 -0
  69. package/src/devtools.tsx +29 -0
  70. package/src/index.ts +1 -0
  71. package/src/injected_script.ts +9 -0
  72. package/src/options.tsx +77 -0
  73. package/src/panel.tsx +30 -0
  74. package/src/popup.tsx +63 -0
  75. package/src/store/initialState.ts +42 -0
  76. package/src/store/selectors.ts +205 -0
  77. package/src/sum.ts +3 -0
  78. package/src/types.ts +1 -0
  79. package/src/utils/date.ts +3 -0
  80. package/tsconfig.json +24 -0
  81. package/vite.config.ts +45 -0
  82. package/webpack/webpack.common.js +46 -0
  83. package/webpack/webpack.dev.js +7 -0
  84. package/webpack/webpack.prod.js +6 -0
  85. package/esm/components/Config/Config.d.ts +0 -6
  86. package/esm/components/Config/Config.js +0 -15
  87. package/esm/components/DevTools/DevTools.d.ts +0 -4
  88. package/esm/components/DevTools/DevTools.js +0 -19
  89. package/esm/components/Dispatcher/Dispatcher.d.ts +0 -8
  90. package/esm/components/Dispatcher/Dispatcher.js +0 -62
  91. package/esm/components/GlobalSettings/GlobalSettings.d.ts +0 -6
  92. package/esm/components/GlobalSettings/GlobalSettings.js +0 -16
  93. package/esm/components/Group/Group.d.ts +0 -9
  94. package/esm/components/Group/Group.js +0 -14
  95. package/esm/components/Json/Json.d.ts +0 -7
  96. package/esm/components/Json/Json.js +0 -9
  97. package/esm/components/Logs/Logs.d.ts +0 -6
  98. package/esm/components/Logs/Logs.js +0 -49
  99. package/esm/components/Monitor/Monitor.d.ts +0 -6
  100. package/esm/components/Monitor/Monitor.js +0 -52
  101. package/esm/components/OverlayManager/OverlayManager.d.ts +0 -6
  102. package/esm/components/OverlayManager/OverlayManager.js +0 -17
  103. package/esm/components/Panel/Panel.d.ts +0 -14
  104. package/esm/components/Panel/Panel.js +0 -46
  105. package/esm/components/Preview/Preview.d.ts +0 -19
  106. package/esm/components/Preview/Preview.js +0 -58
  107. package/esm/components/Redux/Redux.d.ts +0 -6
  108. package/esm/components/Redux/Redux.js +0 -72
  109. package/esm/components/ReduxSettings/ReduxSettings.d.ts +0 -9
  110. package/esm/components/ReduxSettings/ReduxSettings.js +0 -60
  111. package/esm/components/Requests/Requests.d.ts +0 -6
  112. package/esm/components/Requests/Requests.js +0 -61
  113. package/esm/components/Status/Status.d.ts +0 -6
  114. package/esm/components/Status/Status.js +0 -16
  115. package/esm/components/TaskManager/TaskManager.d.ts +0 -9
  116. package/esm/components/TaskManager/TaskManager.js +0 -22
  117. package/esm/components/Toggle/Toggle.d.ts +0 -9
  118. package/esm/components/Toggle/Toggle.js +0 -8
  119. package/esm/components/VirtualList/VirtualList.d.ts +0 -19
  120. package/esm/components/VirtualList/VirtualList.js +0 -30
  121. package/esm/components/Visual/Visual.d.ts +0 -6
  122. package/esm/components/Visual/Visual.js +0 -38
  123. package/esm/components/prefix.d.ts +0 -2
  124. package/esm/components/prefix.js +0 -2
  125. package/esm/data/boxSizes.d.ts +0 -2
  126. package/esm/data/boxSizes.js +0 -10
  127. package/esm/data/dispatcherActions.d.ts +0 -5
  128. package/esm/data/dispatcherActions.js +0 -35
  129. package/esm/data/panels.d.ts +0 -2
  130. package/esm/data/panels.js +0 -74
  131. package/esm/data/panelsArrangements.d.ts +0 -19
  132. package/esm/data/panelsArrangements.js +0 -19
  133. package/esm/data/reduxFilterOptions.d.ts +0 -20
  134. package/esm/data/reduxFilterOptions.js +0 -223
  135. package/esm/data/widgets.d.ts +0 -2
  136. package/esm/data/widgets.js +0 -85
  137. package/esm/hooks/index.d.ts +0 -7
  138. package/esm/hooks/index.js +0 -7
  139. package/esm/hooks/misc/hookState.d.ts +0 -8
  140. package/esm/hooks/misc/hookState.js +0 -6
  141. package/esm/hooks/misc/util.d.ts +0 -5
  142. package/esm/hooks/misc/util.js +0 -21
  143. package/esm/hooks/useBoolean.d.ts +0 -3
  144. package/esm/hooks/useBoolean.js +0 -3
  145. package/esm/hooks/useClickAway.d.ts +0 -3
  146. package/esm/hooks/useClickAway.js +0 -27
  147. package/esm/hooks/useEvent.d.ts +0 -13
  148. package/esm/hooks/useEvent.js +0 -35
  149. package/esm/hooks/useKey.d.ts +0 -12
  150. package/esm/hooks/useKey.js +0 -29
  151. package/esm/hooks/useList.d.ts +0 -57
  152. package/esm/hooks/useList.js +0 -74
  153. package/esm/hooks/useLocalstorage.d.ts +0 -10
  154. package/esm/hooks/useLocalstorage.js +0 -75
  155. package/esm/hooks/usePanels.d.ts +0 -10
  156. package/esm/hooks/usePanels.js +0 -43
  157. package/esm/hooks/useSetState.d.ts +0 -2
  158. package/esm/hooks/useSetState.js +0 -10
  159. package/esm/hooks/useToggle.d.ts +0 -2
  160. package/esm/hooks/useToggle.js +0 -6
  161. package/esm/hooks/useUpdate.d.ts +0 -1
  162. package/esm/hooks/useUpdate.js +0 -6
  163. package/esm/index.d.ts +0 -3
  164. package/esm/index.js +0 -3
  165. package/esm/selectors/selectors.d.ts +0 -21
  166. package/esm/selectors/selectors.js +0 -20
  167. package/esm/theme/devtoolsTheme.d.ts +0 -2
  168. package/esm/theme/devtoolsTheme.js +0 -95
  169. package/esm/utils/filter.d.ts +0 -3
  170. package/esm/utils/filter.js +0 -25
  171. package/esm/utils/localStorage.d.ts +0 -2
  172. package/esm/utils/localStorage.js +0 -21
  173. package/lib/components/Colors copy.css +0 -3
  174. package/lib/components/Colors copy.css.map +0 -1
  175. package/lib/components/Colors.css +0 -3
  176. package/lib/components/Colors.css.map +0 -1
  177. package/lib/components/ColorsDark.css +0 -3
  178. package/lib/components/ColorsDark.css.map +0 -1
  179. package/lib/components/Config/Config.css +0 -15
  180. package/lib/components/Config/Config.css.map +0 -1
  181. package/lib/components/Config/Config.d.ts +0 -6
  182. package/lib/components/Config/Config.js +0 -20
  183. package/lib/components/DevTools/DevTools.css +0 -3
  184. package/lib/components/DevTools/DevTools.css.map +0 -1
  185. package/lib/components/DevTools/DevTools.d.ts +0 -4
  186. package/lib/components/DevTools/DevTools.js +0 -24
  187. package/lib/components/Dispatcher/Dispatcher.css +0 -15
  188. package/lib/components/Dispatcher/Dispatcher.css.map +0 -1
  189. package/lib/components/Dispatcher/Dispatcher.d.ts +0 -8
  190. package/lib/components/Dispatcher/Dispatcher.js +0 -66
  191. package/lib/components/GlobalSettings/GlobalSettings.css +0 -3
  192. package/lib/components/GlobalSettings/GlobalSettings.css.map +0 -1
  193. package/lib/components/GlobalSettings/GlobalSettings.d.ts +0 -6
  194. package/lib/components/GlobalSettings/GlobalSettings.js +0 -21
  195. package/lib/components/Group/Group.css +0 -41
  196. package/lib/components/Group/Group.css.map +0 -1
  197. package/lib/components/Group/Group.d.ts +0 -9
  198. package/lib/components/Group/Group.js +0 -19
  199. package/lib/components/Json/Json.css +0 -3
  200. package/lib/components/Json/Json.css.map +0 -1
  201. package/lib/components/Json/Json.d.ts +0 -7
  202. package/lib/components/Json/Json.js +0 -14
  203. package/lib/components/Logs/Logs.css +0 -3
  204. package/lib/components/Logs/Logs.css.map +0 -1
  205. package/lib/components/Logs/Logs.d.ts +0 -6
  206. package/lib/components/Logs/Logs.js +0 -54
  207. package/lib/components/Monitor/Monitor.css +0 -3
  208. package/lib/components/Monitor/Monitor.css.map +0 -1
  209. package/lib/components/Monitor/Monitor.d.ts +0 -6
  210. package/lib/components/Monitor/Monitor.js +0 -57
  211. package/lib/components/OverlayManager/OverlayManager.css +0 -72
  212. package/lib/components/OverlayManager/OverlayManager.css.map +0 -1
  213. package/lib/components/OverlayManager/OverlayManager.d.ts +0 -6
  214. package/lib/components/OverlayManager/OverlayManager.js +0 -22
  215. package/lib/components/Panel/Panel.css +0 -35
  216. package/lib/components/Panel/Panel.css.map +0 -1
  217. package/lib/components/Panel/Panel.d.ts +0 -14
  218. package/lib/components/Panel/Panel.js +0 -51
  219. package/lib/components/Prefix copy.css +0 -3
  220. package/lib/components/Prefix copy.css.map +0 -1
  221. package/lib/components/Prefix.css +0 -3
  222. package/lib/components/Prefix.css.map +0 -1
  223. package/lib/components/Preview/Preview.css +0 -29
  224. package/lib/components/Preview/Preview.css.map +0 -1
  225. package/lib/components/Preview/Preview.d.ts +0 -19
  226. package/lib/components/Preview/Preview.js +0 -64
  227. package/lib/components/Reading.css +0 -107
  228. package/lib/components/Reading.css.map +0 -1
  229. package/lib/components/Redux/Redux.css +0 -86
  230. package/lib/components/Redux/Redux.css.map +0 -1
  231. package/lib/components/Redux/Redux.d.ts +0 -6
  232. package/lib/components/Redux/Redux.js +0 -77
  233. package/lib/components/ReduxSettings/ReduxSettings.css +0 -10
  234. package/lib/components/ReduxSettings/ReduxSettings.css.map +0 -1
  235. package/lib/components/ReduxSettings/ReduxSettings.d.ts +0 -9
  236. package/lib/components/ReduxSettings/ReduxSettings.js +0 -64
  237. package/lib/components/Requests/Requests.css +0 -8
  238. package/lib/components/Requests/Requests.css.map +0 -1
  239. package/lib/components/Requests/Requests.d.ts +0 -6
  240. package/lib/components/Requests/Requests.js +0 -66
  241. package/lib/components/Status/Status.css +0 -15
  242. package/lib/components/Status/Status.css.map +0 -1
  243. package/lib/components/Status/Status.d.ts +0 -6
  244. package/lib/components/Status/Status.js +0 -21
  245. package/lib/components/TaskManager/TaskManager.css +0 -9
  246. package/lib/components/TaskManager/TaskManager.css.map +0 -1
  247. package/lib/components/TaskManager/TaskManager.d.ts +0 -9
  248. package/lib/components/TaskManager/TaskManager.js +0 -28
  249. package/lib/components/Toggle/Toggle.css +0 -3
  250. package/lib/components/Toggle/Toggle.css.map +0 -1
  251. package/lib/components/Toggle/Toggle.d.ts +0 -9
  252. package/lib/components/Toggle/Toggle.js +0 -13
  253. package/lib/components/Variables.css +0 -3
  254. package/lib/components/Variables.css.map +0 -1
  255. package/lib/components/VirtualList/VirtualList.css +0 -13
  256. package/lib/components/VirtualList/VirtualList.css.map +0 -1
  257. package/lib/components/VirtualList/VirtualList.d.ts +0 -19
  258. package/lib/components/VirtualList/VirtualList.js +0 -35
  259. package/lib/components/Visual/Visual.css +0 -56
  260. package/lib/components/Visual/Visual.css.map +0 -1
  261. package/lib/components/Visual/Visual.d.ts +0 -6
  262. package/lib/components/Visual/Visual.js +0 -43
  263. package/lib/components/prefix.d.ts +0 -2
  264. package/lib/components/prefix.js +0 -5
  265. package/lib/data/boxSizes.d.ts +0 -2
  266. package/lib/data/boxSizes.js +0 -13
  267. package/lib/data/dispatcherActions.d.ts +0 -5
  268. package/lib/data/dispatcherActions.js +0 -38
  269. package/lib/data/panels.d.ts +0 -2
  270. package/lib/data/panels.js +0 -77
  271. package/lib/data/panelsArrangements.d.ts +0 -19
  272. package/lib/data/panelsArrangements.js +0 -22
  273. package/lib/data/reduxFilterOptions.d.ts +0 -20
  274. package/lib/data/reduxFilterOptions.js +0 -227
  275. package/lib/data/widgets.d.ts +0 -2
  276. package/lib/data/widgets.js +0 -89
  277. package/lib/hooks/index.d.ts +0 -7
  278. package/lib/hooks/index.js +0 -17
  279. package/lib/hooks/misc/hookState.d.ts +0 -8
  280. package/lib/hooks/misc/hookState.js +0 -10
  281. package/lib/hooks/misc/util.d.ts +0 -5
  282. package/lib/hooks/misc/util.js +0 -27
  283. package/lib/hooks/useBoolean.d.ts +0 -3
  284. package/lib/hooks/useBoolean.js +0 -7
  285. package/lib/hooks/useClickAway.d.ts +0 -3
  286. package/lib/hooks/useClickAway.js +0 -31
  287. package/lib/hooks/useEvent.d.ts +0 -13
  288. package/lib/hooks/useEvent.js +0 -37
  289. package/lib/hooks/useKey.d.ts +0 -12
  290. package/lib/hooks/useKey.js +0 -34
  291. package/lib/hooks/useList.d.ts +0 -57
  292. package/lib/hooks/useList.js +0 -79
  293. package/lib/hooks/useLocalstorage.d.ts +0 -10
  294. package/lib/hooks/useLocalstorage.js +0 -79
  295. package/lib/hooks/usePanels.d.ts +0 -10
  296. package/lib/hooks/usePanels.js +0 -47
  297. package/lib/hooks/useSetState.d.ts +0 -2
  298. package/lib/hooks/useSetState.js +0 -14
  299. package/lib/hooks/useToggle.d.ts +0 -2
  300. package/lib/hooks/useToggle.js +0 -10
  301. package/lib/hooks/useUpdate.d.ts +0 -1
  302. package/lib/hooks/useUpdate.js +0 -9
  303. package/lib/index.css +0 -488
  304. package/lib/index.css.map +0 -1
  305. package/lib/index.d.ts +0 -3
  306. package/lib/index.js +0 -9
  307. package/lib/selectors/selectors.d.ts +0 -21
  308. package/lib/selectors/selectors.js +0 -24
  309. package/lib/theme/devtoolsTheme.d.ts +0 -2
  310. package/lib/theme/devtoolsTheme.js +0 -97
  311. package/lib/utils/filter.d.ts +0 -3
  312. package/lib/utils/filter.js +0 -29
  313. package/lib/utils/localStorage.d.ts +0 -2
  314. package/lib/utils/localStorage.js +0 -26
@@ -0,0 +1,205 @@
1
+ import { createSelector } from 'reselect';
2
+ import { connectedSelectors, LifecycleStatus } from 'redux-connected';
3
+
4
+ export const $requests = createSelector(
5
+ connectedSelectors.$requests,
6
+ (requests) => {
7
+ return requests
8
+ .map((request) => {
9
+ const { items } = request;
10
+
11
+ const lastPoint = items[items.length - 1];
12
+
13
+ const journeyWithDelta = items.map((point, index) => {
14
+ const nextPoint = items[index + 1] || point;
15
+ const delta = nextPoint.timestamp - point.timestamp;
16
+
17
+ return {
18
+ ...point,
19
+ delta,
20
+ };
21
+ });
22
+
23
+ return {
24
+ ...request,
25
+ items: journeyWithDelta,
26
+ lastPointTimestamp: lastPoint.timestamp,
27
+ lastPointStatus: lastPoint.status,
28
+ };
29
+ })
30
+ .sort((a: any, b: any) => {
31
+ if (a.lastPointTimestamp === b.lastPointTimestamp) {
32
+ return 0;
33
+ }
34
+
35
+ return a.lastPointTimestamp > b.lastPointTimestamp ? -1 : 1;
36
+ });
37
+ }
38
+ );
39
+
40
+ // 1
41
+ export const $requestsReceived = createSelector($requests, (requests) => {
42
+ return requests.filter((request) => {
43
+ const { items } = request;
44
+ const lastPoint = items[items.length - 1];
45
+ return lastPoint && lastPoint.status === LifecycleStatus.RECEIVED;
46
+ });
47
+ });
48
+
49
+ export const $requestsReceivedPast = createSelector($requests, (requests) => {
50
+ return requests.filter((request) => {
51
+ const { items } = request;
52
+
53
+ return items.find((point) => point.status === LifecycleStatus.RECEIVED);
54
+ });
55
+ });
56
+
57
+ // 2
58
+ export const $requestsInQueue = createSelector($requests, (requests) => {
59
+ return requests.filter((request) => {
60
+ const { items } = request;
61
+ const lastPoint = items[items.length - 1];
62
+ return lastPoint && lastPoint.status === LifecycleStatus.IN_QUEUE;
63
+ });
64
+ });
65
+
66
+ export const $requestsInQueuePast = createSelector($requests, (requests) => {
67
+ return requests.filter((request) => {
68
+ const { items } = request;
69
+ return items.find((point) => point.status === LifecycleStatus.IN_QUEUE);
70
+ });
71
+ });
72
+
73
+ // 3
74
+ export const $requestsGeneralError = createSelector($requests, (requests) => {
75
+ return requests.filter((request) => {
76
+ const { items } = request;
77
+ const lastPoint = items[items.length - 1];
78
+ return lastPoint && lastPoint.status === LifecycleStatus.GENERAL_ERROR;
79
+ });
80
+ });
81
+
82
+ export const $requestsGeneralErrorPast = createSelector(
83
+ $requests,
84
+ (requests) => {
85
+ return requests.filter((request) => {
86
+ const { items } = request;
87
+
88
+ return items.find(
89
+ (point) => point.status === LifecycleStatus.GENERAL_ERROR
90
+ );
91
+ });
92
+ }
93
+ );
94
+
95
+ // 4
96
+ export const $requestsPendingApi = createSelector($requests, (requests) => {
97
+ return requests.filter((request) => {
98
+ const { items } = request;
99
+ const lastPoint = items[items.length - 1];
100
+ return (
101
+ lastPoint &&
102
+ lastPoint.status === LifecycleStatus.PENDING_API_RESPONSE
103
+ );
104
+ });
105
+ });
106
+
107
+ export const $requestsPendingApiPast = createSelector($requests, (requests) => {
108
+ return requests.filter((request) => {
109
+ const { items } = request;
110
+
111
+ return items.find(
112
+ (point) => point.status === LifecycleStatus.PENDING_API_RESPONSE
113
+ );
114
+ });
115
+ });
116
+
117
+ // 5
118
+ export const $requestsApiError = createSelector($requests, (requests) => {
119
+ return requests.filter((request) => {
120
+ const { items } = request;
121
+ const lastPoint = items[items.length - 1];
122
+ return lastPoint && lastPoint.status === LifecycleStatus.API_ERROR;
123
+ });
124
+ });
125
+
126
+ export const $requestsApiErrorPast = createSelector($requests, (requests) => {
127
+ return requests.filter((request) => {
128
+ const { items } = request;
129
+
130
+ return items.find(
131
+ (point) => point.status === LifecycleStatus.API_ERROR
132
+ );
133
+ });
134
+ });
135
+
136
+ // 6
137
+ export const $requestsPostAction = createSelector($requests, (requests) => {
138
+ return requests.filter((request) => {
139
+ const { items } = request;
140
+ const lastPoint = items[items.length - 1];
141
+ return lastPoint && lastPoint.status === LifecycleStatus.POST_ACTION;
142
+ });
143
+ });
144
+
145
+ export const $requestsPostActionPast = createSelector($requests, (requests) => {
146
+ return requests.filter((request) => {
147
+ const { items } = request;
148
+
149
+ return items.find(
150
+ (point) => point.status === LifecycleStatus.POST_ACTION
151
+ );
152
+ });
153
+ });
154
+
155
+ export const $menuBadges = createSelector(
156
+ $requestsReceived,
157
+ $requestsInQueue,
158
+ $requestsGeneralError,
159
+ $requestsPendingApi,
160
+ $requestsApiError,
161
+ $requestsPostAction,
162
+ (
163
+ requestsReceived,
164
+ requestsInQueue,
165
+ requestsGeneralError,
166
+ requestsPendingApi,
167
+ requestsApiError,
168
+ requestsPostAction
169
+ ) => {
170
+ return {
171
+ lifecycleReceived: requestsReceived.length,
172
+ lifecycleInQueue: requestsInQueue.length,
173
+ lifecycleGeneralError: requestsGeneralError.length,
174
+ lifecyclePendingApi: requestsPendingApi.length,
175
+ lifecycleApiError: requestsApiError.length,
176
+ lifecyclePostAction: requestsPostAction.length,
177
+ };
178
+ }
179
+ );
180
+
181
+ export const $menuBadgesTotal = createSelector(
182
+ $requestsReceivedPast,
183
+ $requestsInQueuePast,
184
+ $requestsGeneralErrorPast,
185
+ $requestsPendingApiPast,
186
+ $requestsApiErrorPast,
187
+ $requestsPostActionPast,
188
+ (
189
+ requestsReceived,
190
+ requestsInQueue,
191
+ requestsGeneralError,
192
+ requestsPendingApi,
193
+ requestsApiError,
194
+ requestsPostAction
195
+ ) => {
196
+ return {
197
+ lifecycleReceived: requestsReceived.length,
198
+ lifecycleInQueue: requestsInQueue.length,
199
+ lifecycleGeneralError: requestsGeneralError.length,
200
+ lifecyclePendingApi: requestsPendingApi.length,
201
+ lifecycleApiError: requestsApiError.length,
202
+ lifecyclePostAction: requestsPostAction.length,
203
+ };
204
+ }
205
+ );
package/src/sum.ts ADDED
@@ -0,0 +1,3 @@
1
+ export function sum(x: number, y: number) {
2
+ return x + y;
3
+ }
package/src/types.ts ADDED
@@ -0,0 +1 @@
1
+ export type Json = Record<string, any>;
@@ -0,0 +1,3 @@
1
+ export const timestamp = () => new Date().getTime();
2
+
3
+ export const startOfTime = timestamp();
package/tsconfig.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "compilerOptions": {
3
+ "strict": true,
4
+ "module": "commonjs",
5
+ "target": "es6",
6
+ "esModuleInterop": true,
7
+ "sourceMap": false,
8
+ "rootDir": "src",
9
+ "outDir": "dist/js",
10
+ "noEmitOnError": true,
11
+ "jsx": "react",
12
+ "typeRoots": [ "node_modules/@types" ],
13
+ "baseUrl": "../",
14
+ "paths": {
15
+ "redux-connected": [
16
+ "redux-connected"
17
+ ],
18
+ }
19
+ },
20
+ "exclude": [
21
+ "node_modules",
22
+ "vite.config.ts",
23
+ ]
24
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { defineConfig } from 'vite';
2
+ import react from '@vitejs/plugin-react';
3
+ import tsconfigPaths from 'vite-tsconfig-paths';
4
+ const svgLoader = require('vite-plugin-react-svg');
5
+ const path = require('path');
6
+ require('dotenv-flow').config();
7
+
8
+ const cwd = path.resolve(process.cwd(), '../../');
9
+ const host = (process.env.VITE_SERVER_DOMAIN||'').replace(/https?:\/\//, '');
10
+
11
+ // https://vitejs.dev/config/
12
+ export default defineConfig({
13
+ plugins: [
14
+ tsconfigPaths({
15
+ loose: true,
16
+ }),
17
+ react(),
18
+ svgLoader(),
19
+ ],
20
+ define: {
21
+ 'process.env.MONO': process.env.MONO,
22
+ },
23
+ resolve: {
24
+ alias: {
25
+ '@payem/forms': `${cwd}/packages/web-forms/src`,
26
+ '@payem/tables': `${cwd}/packages/web-tables/src`,
27
+ '@payem/details': `${cwd}/packages/web-details/src`,
28
+ '@payem/devtools': `${cwd}/packages/web-devtools/src`,
29
+ '@payem/router': `${cwd}/packages/web-router/src`,
30
+ '@payem/ui': `${cwd}/packages/web-ui/src`,
31
+ '@payem/base-ui': `${cwd}/packages/web-base-ui/src`,
32
+ '@payem/testing-base': `${cwd}/packages/web-testing-base/src`,
33
+ '@payem/hooks': `${cwd}/packages/hooks/src`,
34
+ '@payem/root-types': `${cwd}/packages/root-types/src`,
35
+ '@payem/themes': `${cwd}/packages/web-themes/src`,
36
+ '@minimal/widgets': `${cwd}/packages/minimal`,
37
+ '@payem/platformer': `${cwd}/packages/platformer`,
38
+ '@payem/app-home': `${cwd}/apps/home`,
39
+ },
40
+ },
41
+ server: {
42
+ host,
43
+ port: 3001,
44
+ },
45
+ });
@@ -0,0 +1,46 @@
1
+ const webpack = require('webpack');
2
+ const path = require('path');
3
+ const CopyPlugin = require('copy-webpack-plugin');
4
+ const srcDir = path.join(__dirname, '..', 'src');
5
+
6
+ module.exports = {
7
+ entry: {
8
+ popup: path.join(srcDir, 'popup.tsx'),
9
+ options: path.join(srcDir, 'options.tsx'),
10
+ devtools: path.join(srcDir, 'devtools.tsx'),
11
+ panel: path.join(srcDir, 'panel.tsx'),
12
+ background: path.join(srcDir, 'background.ts'),
13
+ content_script: path.join(srcDir, 'content_script.ts'),
14
+ injected_script: path.join(srcDir, 'injected_script.ts'),
15
+ },
16
+ output: {
17
+ path: path.join(__dirname, '../dist/js'),
18
+ filename: '[name].js',
19
+ },
20
+ optimization: {
21
+ splitChunks: {
22
+ name: 'vendor',
23
+ chunks(chunk) {
24
+ return chunk.name !== 'background';
25
+ },
26
+ },
27
+ },
28
+ module: {
29
+ rules: [
30
+ {
31
+ test: /\.tsx?$/,
32
+ use: 'ts-loader',
33
+ exclude: /node_modules/,
34
+ },
35
+ ],
36
+ },
37
+ resolve: {
38
+ extensions: ['.ts', '.tsx', '.js'],
39
+ },
40
+ plugins: [
41
+ new CopyPlugin({
42
+ patterns: [{ from: '.', to: '../', context: 'public' }],
43
+ options: {},
44
+ }),
45
+ ],
46
+ };
@@ -0,0 +1,7 @@
1
+ const { merge } = require('webpack-merge');
2
+ const common = require('./webpack.common.js');
3
+
4
+ module.exports = merge(common, {
5
+ devtool: 'inline-source-map',
6
+ mode: 'development'
7
+ });
@@ -0,0 +1,6 @@
1
+ const { merge } = require('webpack-merge');
2
+ const common = require('./webpack.common.js');
3
+
4
+ module.exports = merge(common, {
5
+ mode: 'production',
6
+ });
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- interface ConfigProps {
3
- isWide: boolean;
4
- }
5
- export declare function Config(props: ConfigProps): JSX.Element;
6
- export default Config;
@@ -1,15 +0,0 @@
1
- import * as React from 'react';
2
- import classnames from 'classnames';
3
- import Json from '../Json/Json';
4
- import * as selectors from '../../selectors/selectors';
5
- import { useSelector } from 'react-redux';
6
- export function Config(props) {
7
- var isWide = props.isWide;
8
- var configs = useSelector(selectors.$endpointsConfig);
9
- var className = classnames('__devtools__Config-container', {
10
- wide: isWide,
11
- });
12
- return (React.createElement("div", { className: className },
13
- React.createElement(Json, { value: configs })));
14
- }
15
- export default Config;
@@ -1,4 +0,0 @@
1
- /// <reference types="react" />
2
- declare type DevToolsProps = {};
3
- export declare function DevTools(_props: DevToolsProps): JSX.Element;
4
- export default DevTools;
@@ -1,19 +0,0 @@
1
- import * as React from 'react';
2
- import { Grid } from 'igrid';
3
- import { panels } from '../../data/panels';
4
- import { widgets } from '../../data/widgets';
5
- export function DevTools(_props) {
6
- function renderPanel(id) {
7
- var widget = widgets[id];
8
- if (!widget || !widget.component) {
9
- return React.createElement("div", null);
10
- }
11
- return React.createElement("div", { className: "panel" }, widget.component);
12
- }
13
- function renderInfo(_id) {
14
- return (React.createElement("div", { className: "panel" }, "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean emper congue. Mauris eget congue magna. Aliquam aliquam lorem lectus, eget auctor nisl fringilla eu. Donec semper tincidunt nibh, a hendrerit neque posuere in. Ut a augue libero."));
15
- }
16
- return (React.createElement("div", { className: "ExamplePick-container" },
17
- React.createElement(Grid, { defaultPanels: panels, renderPanel: renderPanel, renderInfo: renderInfo, widgets: widgets })));
18
- }
19
- export default DevTools;
@@ -1,8 +0,0 @@
1
- /// <reference types="react" />
2
- declare type DispatcherProps = {
3
- storeState: any;
4
- isWide?: boolean;
5
- onClose?: () => void;
6
- };
7
- export declare function Dispatcher(props: DispatcherProps): JSX.Element;
8
- export default Dispatcher;
@@ -1,62 +0,0 @@
1
- import { __awaiter, __generator } from "tslib";
2
- import * as React from 'react';
3
- import Group from '../Group/Group';
4
- import classnames from 'classnames';
5
- import { generateActionsForStore } from 'redux-store-generator';
6
- import * as dispatcherActions from '../../data/dispatcherActions';
7
- import { useSetState } from 'react-use';
8
- import { analyzeStructure } from 'redux-store-generator';
9
- import Panel from '../Panel/Panel';
10
- import { useDispatch } from 'react-redux';
11
- import cssPrefix from '../prefix';
12
- export function Dispatcher(props) {
13
- var dispatch = useDispatch();
14
- var _a = useSetState({}), requests = _a[0], setRequests = _a[1];
15
- var _b = props.isWide, isWide = _b === void 0 ? false : _b, storeState = props.storeState;
16
- var actions = generateActionsForStore(storeState);
17
- var nodeTypes = analyzeStructure(storeState);
18
- function dispatchAction(nodeName, verbType, actionParams) {
19
- return __awaiter(this, void 0, void 0, function () {
20
- var node, actionCreator, action;
21
- var _a, _b;
22
- return __generator(this, function (_c) {
23
- switch (_c.label) {
24
- case 0:
25
- node = actions[nodeName];
26
- actionCreator = node[verbType];
27
- action = actionCreator.apply(null, actionParams);
28
- setRequests((_a = {},
29
- _a[nodeName + "_" + verbType] = true,
30
- _a));
31
- return [4 /*yield*/, dispatch(action)];
32
- case 1:
33
- _c.sent();
34
- setRequests((_b = {},
35
- _b[nodeName + "_" + verbType] = false,
36
- _b));
37
- return [2 /*return*/];
38
- }
39
- });
40
- });
41
- }
42
- function renderAction(nodeName, verbType, actionParams) {
43
- var disabled = requests[nodeName + "_" + verbType];
44
- return (React.createElement("button", { onClick: function () { return dispatchAction(nodeName, verbType, actionParams); }, key: verbType, disabled: disabled }, verbType));
45
- }
46
- function renderActions(nodeName) {
47
- var nodeType = nodeTypes[nodeName];
48
- var actions = dispatcherActions[nodeType];
49
- var buttons = Object.keys(actions).map(function (verbType) {
50
- var actionParams = actions[verbType];
51
- return renderAction(nodeName, verbType, actionParams);
52
- });
53
- return buttons;
54
- }
55
- var className = classnames(cssPrefix + "Dispatcher-container", {
56
- wide: isWide,
57
- });
58
- return (React.createElement(Panel, { id: "dispatcher", zIndex: 999, onClose: props.onClose },
59
- React.createElement("div", { className: className }, Object.keys(nodeTypes).map(function (nodeName) { return (React.createElement(Group, { key: nodeName, title: nodeName, isWide: isWide, fluid: true },
60
- React.createElement(React.Fragment, null, renderActions(nodeName)))); }))));
61
- }
62
- export default Dispatcher;
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- declare type GlobalSettingsProps = {
3
- isWide: boolean;
4
- };
5
- export declare function GlobalSettings(props: GlobalSettingsProps): JSX.Element;
6
- export default GlobalSettings;
@@ -1,16 +0,0 @@
1
- import * as React from 'react';
2
- import classnames from 'classnames';
3
- import Json from '../Json/Json';
4
- import * as selectors from '../../selectors/selectors';
5
- import { useSelector } from 'react-redux';
6
- import cssPrefix from '../prefix';
7
- export function GlobalSettings(props) {
8
- var isWide = props.isWide;
9
- var settingsAndStats = useSelector(selectors.$settingsAndStats);
10
- var className = classnames(cssPrefix + "GlobalSettings-container", {
11
- wide: isWide,
12
- });
13
- return (React.createElement("div", { className: className },
14
- React.createElement(Json, { value: settingsAndStats })));
15
- }
16
- export default GlobalSettings;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- declare type GroupProps = {
3
- title: string;
4
- isWide?: boolean;
5
- fluid?: boolean;
6
- children: JSX.Element;
7
- };
8
- export declare function Group(props: GroupProps): JSX.Element;
9
- export default Group;
@@ -1,14 +0,0 @@
1
- import * as React from 'react';
2
- import classnames from 'classnames';
3
- import cssPrefix from '../prefix';
4
- export function Group(props) {
5
- var title = props.title, isWide = props.isWide, fluid = props.fluid;
6
- var className = classnames(cssPrefix + "Group-container", {
7
- wide: isWide,
8
- fluid: fluid,
9
- });
10
- return (React.createElement("div", { className: className },
11
- React.createElement("div", { className: "title" }, title),
12
- React.createElement("div", { className: "items" }, props.children)));
13
- }
14
- export default Group;
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- declare type JsonProps = {
3
- value: any;
4
- collapsed?: boolean;
5
- };
6
- export declare function Json(props: JsonProps): JSX.Element;
7
- export default Json;
@@ -1,9 +0,0 @@
1
- import * as React from 'react';
2
- import ReactJson from 'react-json-view';
3
- import cssPrefix from '../prefix';
4
- export function Json(props) {
5
- var value = props.value, collapsed = props.collapsed;
6
- return (React.createElement("div", { className: cssPrefix + "Json-container" },
7
- React.createElement(ReactJson, { src: value, collapsed: collapsed, enableClipboard: false, displayObjectSize: false, displayDataTypes: false, theme: 'monokai' })));
8
- }
9
- export default Json;
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- declare type LogsProps = {
3
- isWide: boolean;
4
- };
5
- export declare function Logs(props: LogsProps): JSX.Element;
6
- export default Logs;
@@ -1,49 +0,0 @@
1
- import * as React from 'react';
2
- import { useMonitor, clearMeta } from 'redux-connected';
3
- import VirtualList from '../VirtualList/VirtualList';
4
- import classnames from 'classnames';
5
- import { useDispatch } from 'react-redux';
6
- import { preview } from '../Preview/Preview';
7
- import cssPrefix from '../prefix';
8
- var now = new Date().getTime();
9
- export function Logs(props) {
10
- var dispatch = useDispatch();
11
- var readings = useMonitor({}, function (action) { return action.type === 'LOG'; })[0];
12
- function onClick(reading) {
13
- var action = reading.action;
14
- var log = action.payload;
15
- dispatch(preview(log, 'log'));
16
- }
17
- var isWide = props.isWide;
18
- var className = classnames(cssPrefix + "Logs-container", cssPrefix + "Rows-container", {
19
- wide: isWide,
20
- });
21
- var height = isWide ? 735 : 325;
22
- return (React.createElement("div", { className: className },
23
- React.createElement(VirtualList, { className: className, items: readings, height: height, onClick: onClick }, LowRow)));
24
- }
25
- var LowRow = function (props) {
26
- var index = props.index;
27
- var listItem = props.data[index];
28
- var reading = listItem.item;
29
- var action = reading.action;
30
- var payload = action.payload;
31
- var _a = payload || {}, meta = _a.meta, message = _a.message;
32
- var shortId = meta.shortId, createdTS = meta.createdTS, sequence = meta.sequence;
33
- var className = classnames('Reading-container', {});
34
- var delta = ((createdTS - now) / 1000).toFixed(2);
35
- var data = clearMeta(payload || {});
36
- delete data['message'];
37
- return (React.createElement("div", { className: className, style: props.style, onClick: listItem.onClick },
38
- React.createElement("div", { className: "col" },
39
- React.createElement("div", { className: "row" },
40
- React.createElement("div", { className: "sequence" }, sequence),
41
- React.createElement("div", { className: "message" }, message)),
42
- React.createElement("div", { className: "description" }, JSON.stringify(data))),
43
- React.createElement("div", { className: "col" },
44
- React.createElement("div", { className: "timestamp" },
45
- "+",
46
- delta),
47
- React.createElement("div", { className: "id" }, shortId))));
48
- };
49
- export default Logs;
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- declare type MonitorProps = {
3
- isWide: boolean;
4
- };
5
- export declare function Monitor(props: MonitorProps): JSX.Element;
6
- export default Monitor;
@@ -1,52 +0,0 @@
1
- import * as React from 'react';
2
- import { useDispatch, useSelector } from 'react-redux';
3
- import { formatDistance } from 'date-fns';
4
- import { startSaga, stopSaga } from 'redux-connected';
5
- import classnames from 'classnames';
6
- import VirtualList from '../VirtualList/VirtualList';
7
- import * as selectors from '../../selectors/selectors';
8
- import { preview } from '../Preview/Preview';
9
- import cssPrefix from '../prefix';
10
- import Toggle from '../Toggle/Toggle';
11
- export function Monitor(props) {
12
- var dispatch = useDispatch();
13
- var isWide = props.isWide;
14
- var sagas = useSelector(selectors.$sagas);
15
- function onClick(item) {
16
- dispatch(preview(item, 'process'));
17
- }
18
- var className = classnames(cssPrefix + "Monitor-container", cssPrefix + "Rows-container", {
19
- wide: isWide,
20
- });
21
- var height = isWide ? 735 : 325;
22
- return (React.createElement(VirtualList, { className: className, items: sagas, height: height, onClick: onClick }, SagaRow));
23
- }
24
- var SagaRow = function (props) {
25
- var dispatch = useDispatch();
26
- var index = props.index;
27
- var listItem = props.data[index];
28
- var saga = listItem.item;
29
- var distanceStart = formatDistance(new Date(), new Date(saga.startedTS || 0));
30
- var distanceStopped = formatDistance(new Date(), new Date(saga.stoppedTS || 0));
31
- var distance = saga.isRunning ? distanceStart : distanceStopped;
32
- function onChange(_ev, checked) {
33
- var sagaId = saga.id;
34
- var action = checked ? startSaga({ sagaId: sagaId }) : stopSaga({ sagaId: sagaId });
35
- dispatch(action);
36
- }
37
- var className = classnames(cssPrefix + "Reading-container", {
38
- disabled: !saga.isRunning,
39
- });
40
- return (React.createElement("div", { className: className, key: saga.id, style: props.style, onClick: listItem.onClick },
41
- React.createElement("div", { className: "col" },
42
- React.createElement("div", { className: "title" },
43
- saga.id,
44
- " ",
45
- React.createElement("span", { className: "timeAgo" },
46
- distance,
47
- " ago")),
48
- React.createElement("div", { className: "description", title: saga.description }, saga.description)),
49
- React.createElement("div", { className: "col" },
50
- React.createElement(Toggle, { defaultChecked: saga.isRunning, onChange: onChange }))));
51
- };
52
- export default Monitor;