@searpent/react-image-annotate 2.0.76 → 2.0.78

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (224) hide show
  1. package/Annotator/exampleImages.js +41 -0
  2. package/Annotator/examplePhotos.js +6980 -0
  3. package/Annotator/index.js +417 -0
  4. package/Annotator/reducers/combine-reducers.js +14 -0
  5. package/Annotator/reducers/convert-expanding-line-to-polygon.js +73 -0
  6. package/{src/Annotator → Annotator}/reducers/fix-twisted.js +3 -5
  7. package/Annotator/reducers/general-reducer.js +1430 -0
  8. package/Annotator/reducers/get-active-image.js +27 -0
  9. package/Annotator/reducers/get-implied-video-regions.js +180 -0
  10. package/Annotator/reducers/history-handler.js +38 -0
  11. package/Annotator/reducers/image-reducer.js +20 -0
  12. package/Annotator/reducers/video-reducer.js +88 -0
  13. package/ClassSelectionMenu/index.js +140 -0
  14. package/Crosshairs/index.js +53 -0
  15. package/DebugSidebarBox/index.js +20 -0
  16. package/DemoSite/Editor.js +194 -0
  17. package/DemoSite/ErrorBoundaryDialog.js +64 -0
  18. package/DemoSite/index.js +40 -0
  19. package/{src/Editor → Editor}/annotation-plugin/annotation.css +20 -0
  20. package/Editor/annotation-plugin/annotation.js +697 -0
  21. package/Editor/index.js +93 -0
  22. package/Editor/readOnly.js +123 -0
  23. package/{src/Editor → Editor}/tools.js +2 -3
  24. package/Errorer/index.js +11 -0
  25. package/FullImageSegmentationAnnotator/index.js +7 -0
  26. package/GroupSelectorSidebarBox/index.js +63 -0
  27. package/GroupsEditorSidebarBox/index.js +138 -0
  28. package/HelpSidebarBox/index.js +58 -0
  29. package/HighlightBox/index.js +102 -0
  30. package/HistorySidebarBox/index.js +71 -0
  31. package/ImageCanvas/index.js +441 -0
  32. package/ImageCanvas/region-tools.js +165 -0
  33. package/{src/ImageCanvas → ImageCanvas}/styles.js +12 -8
  34. package/ImageCanvas/use-mouse.js +180 -0
  35. package/ImageCanvas/use-project-box.js +27 -0
  36. package/ImageCanvas/use-wasd-mode.js +62 -0
  37. package/ImageMask/index.js +133 -0
  38. package/ImageMask/load-image.js +25 -0
  39. package/ImageSelectorSidebarBox/index.js +60 -0
  40. package/KeyframeTimeline/get-time-string.js +27 -0
  41. package/KeyframeTimeline/index.js +233 -0
  42. package/KeyframesSelectorSidebarBox/index.js +93 -0
  43. package/LandingPage/index.js +159 -0
  44. package/Locker/index.js +11 -0
  45. package/MainLayout/RightSidebarItemsWrapper.js +19 -0
  46. package/MainLayout/icon-dictionary.js +104 -0
  47. package/MainLayout/index.js +526 -0
  48. package/{src/MainLayout → MainLayout}/styles.js +6 -7
  49. package/MainLayout/types.js +0 -0
  50. package/MainLayout/use-implied-video-regions.js +13 -0
  51. package/MetadataEditorSidebarBox/index.js +231 -0
  52. package/PageSelector/index.js +180 -0
  53. package/PointDistances/index.js +73 -0
  54. package/PreventScrollToParents/index.js +51 -0
  55. package/RegionLabel/index.js +232 -0
  56. package/{src/RegionLabel → RegionLabel}/styles.js +12 -15
  57. package/RegionSelectAndTransformBoxes/index.js +169 -0
  58. package/RegionSelectorSidebarBox/index.js +254 -0
  59. package/{src/RegionSelectorSidebarBox → RegionSelectorSidebarBox}/styles.js +13 -14
  60. package/RegionShapes/index.js +294 -0
  61. package/RegionTags/index.js +144 -0
  62. package/SettingsDialog/index.js +52 -0
  63. package/SettingsProvider/index.js +60 -0
  64. package/Shortcuts/ShortcutField.js +46 -0
  65. package/Shortcuts/index.js +133 -0
  66. package/ShortcutsManager/index.js +155 -0
  67. package/Sidebar/index.js +69 -0
  68. package/SidebarBoxContainer/index.js +93 -0
  69. package/SmallToolButton/index.js +42 -0
  70. package/TagsSidebarBox/index.js +105 -0
  71. package/TaskDescriptionSidebarBox/index.js +58 -0
  72. package/Theme/index.js +30 -0
  73. package/VideoOrImageCanvasBackground/index.js +151 -0
  74. package/colors.js +14 -0
  75. package/hooks/use-colors.js +127 -0
  76. package/hooks/use-event-callback.js +10 -0
  77. package/hooks/use-exclude-pattern.js +24 -0
  78. package/hooks/use-load-image.js +26 -0
  79. package/hooks/use-window-size.js +46 -0
  80. package/{src/hooks → hooks}/xpattern.js +1 -1
  81. package/index.js +3 -0
  82. package/lib.js +3 -0
  83. package/package.json +1 -1
  84. package/stories.js +5 -0
  85. package/utils/blocks-to-article.js +60 -0
  86. package/{src/utils → utils}/blocks-to-article.test.js +5 -8
  87. package/{src/utils → utils}/default-locked-until.js +2 -1
  88. package/{src/utils → utils}/filter-only-unique.js +1 -1
  89. package/utils/get-from-local-storage.js +7 -0
  90. package/utils/get-hotkey-help-text.js +9 -0
  91. package/utils/get-landmarks-with-transform.js +40 -0
  92. package/utils/photosToImages.js +85 -0
  93. package/utils/regions-groups.js +28 -0
  94. package/utils/regions-to-blocks.js +18 -0
  95. package/utils/saveable-actions-enum.js +3 -0
  96. package/utils/set-in-local-storage.js +3 -0
  97. package/utils/sleep.js +7 -0
  98. package/utils/uuid-to-hash.js +5 -0
  99. package/.babelrc +0 -6
  100. package/.env +0 -1
  101. package/.flowconfig +0 -2
  102. package/.github/workflows/release-on-master.yml +0 -32
  103. package/.github/workflows/test.yml +0 -16
  104. package/.prettierrc +0 -3
  105. package/.releaserc.js +0 -18
  106. package/.storybook/addons.js +0 -2
  107. package/.storybook/config.js +0 -16
  108. package/LICENSE +0 -21
  109. package/public/favicon.ico +0 -0
  110. package/public/index.html +0 -38
  111. package/src/Annotator/bike-pic.png +0 -0
  112. package/src/Annotator/bike-pic2.png +0 -0
  113. package/src/Annotator/dab-keyframes.story.json +0 -1
  114. package/src/Annotator/exampleImages.js +0 -48
  115. package/src/Annotator/examplePhotos.js +0 -7603
  116. package/src/Annotator/index.js +0 -380
  117. package/src/Annotator/index.story.js +0 -877
  118. package/src/Annotator/poses.story.js +0 -150
  119. package/src/Annotator/reducers/combine-reducers.js +0 -7
  120. package/src/Annotator/reducers/convert-expanding-line-to-polygon.js +0 -53
  121. package/src/Annotator/reducers/general-reducer.js +0 -1228
  122. package/src/Annotator/reducers/get-active-image.js +0 -21
  123. package/src/Annotator/reducers/get-implied-video-regions.js +0 -115
  124. package/src/Annotator/reducers/history-handler.js +0 -60
  125. package/src/Annotator/reducers/image-reducer.js +0 -23
  126. package/src/Annotator/reducers/video-reducer.js +0 -85
  127. package/src/Annotator/video.story.js +0 -51
  128. package/src/ClassSelectionMenu/index.js +0 -112
  129. package/src/Crosshairs/index.js +0 -64
  130. package/src/DebugSidebarBox/index.js +0 -36
  131. package/src/DemoSite/Editor.js +0 -235
  132. package/src/DemoSite/ErrorBoundaryDialog.js +0 -34
  133. package/src/DemoSite/index.js +0 -41
  134. package/src/DemoSite/index.story.js +0 -10
  135. package/src/DemoSite/simple-segmentation-example.json +0 -572
  136. package/src/Editor/annotation-plugin/annotation.js +0 -536
  137. package/src/Editor/index.js +0 -50
  138. package/src/Editor/readOnly.js +0 -21
  139. package/src/Errorer/index.js +0 -13
  140. package/src/FullImageSegmentationAnnotator/hard1.story.jpg +0 -0
  141. package/src/FullImageSegmentationAnnotator/hard2.story.jpg +0 -0
  142. package/src/FullImageSegmentationAnnotator/hard3.story.jpg +0 -0
  143. package/src/FullImageSegmentationAnnotator/index.js +0 -7
  144. package/src/FullImageSegmentationAnnotator/index.story.js +0 -177
  145. package/src/FullImageSegmentationAnnotator/orange.story.png +0 -0
  146. package/src/GroupSelectorSidebarBox/index.js +0 -48
  147. package/src/GroupsEditorSidebarBox/index.js +0 -108
  148. package/src/HelpSidebarBox/index.js +0 -43
  149. package/src/HighlightBox/index.js +0 -143
  150. package/src/HistorySidebarBox/index.js +0 -78
  151. package/src/ImageCanvas/dancing-man.story.jpg +0 -0
  152. package/src/ImageCanvas/index.js +0 -515
  153. package/src/ImageCanvas/index.story.js +0 -314
  154. package/src/ImageCanvas/mouse_mask.story.png +0 -0
  155. package/src/ImageCanvas/region-tools.js +0 -171
  156. package/src/ImageCanvas/seves_desk.story.jpg +0 -0
  157. package/src/ImageCanvas/use-mouse.js +0 -168
  158. package/src/ImageCanvas/use-project-box.js +0 -23
  159. package/src/ImageCanvas/use-wasd-mode.js +0 -50
  160. package/src/ImageMask/index.js +0 -127
  161. package/src/ImageMask/load-image.js +0 -32
  162. package/src/ImageSelectorSidebarBox/index.js +0 -54
  163. package/src/KeyframeTimeline/get-time-string.js +0 -25
  164. package/src/KeyframeTimeline/index.js +0 -223
  165. package/src/KeyframesSelectorSidebarBox/index.js +0 -93
  166. package/src/LandingPage/content.md +0 -57
  167. package/src/LandingPage/github-markdown.css +0 -964
  168. package/src/LandingPage/index.js +0 -147
  169. package/src/Locker/index.js +0 -13
  170. package/src/MainLayout/RightSidebarItemsWrapper.js +0 -21
  171. package/src/MainLayout/icon-dictionary.js +0 -79
  172. package/src/MainLayout/index.js +0 -564
  173. package/src/MainLayout/index.story.js +0 -240
  174. package/src/MainLayout/types.js +0 -171
  175. package/src/MainLayout/use-implied-video-regions.js +0 -17
  176. package/src/MetadataEditorSidebarBox/index.js +0 -160
  177. package/src/PageSelector/index.js +0 -159
  178. package/src/PointDistances/index.js +0 -90
  179. package/src/PreventScrollToParents/index.js +0 -48
  180. package/src/PreventScrollToParents/index.story.js +0 -23
  181. package/src/RegionLabel/index.js +0 -236
  182. package/src/RegionSelectAndTransformBoxes/index.js +0 -236
  183. package/src/RegionSelectorSidebarBox/index.js +0 -220
  184. package/src/RegionShapes/index.js +0 -254
  185. package/src/RegionTags/index.js +0 -136
  186. package/src/SettingsDialog/index.js +0 -58
  187. package/src/SettingsProvider/index.js +0 -57
  188. package/src/Shortcuts/ShortcutField.js +0 -44
  189. package/src/Shortcuts/index.js +0 -129
  190. package/src/ShortcutsManager/index.js +0 -162
  191. package/src/Sidebar/index.js +0 -117
  192. package/src/SidebarBoxContainer/index.js +0 -93
  193. package/src/SmallToolButton/index.js +0 -57
  194. package/src/TagsSidebarBox/index.js +0 -93
  195. package/src/TaskDescriptionSidebarBox/index.js +0 -43
  196. package/src/Theme/index.js +0 -36
  197. package/src/VideoOrImageCanvasBackground/index.js +0 -170
  198. package/src/colors.js +0 -32
  199. package/src/hooks/use-colors.js +0 -75
  200. package/src/hooks/use-event-callback.js +0 -11
  201. package/src/hooks/use-exclude-pattern.js +0 -27
  202. package/src/hooks/use-load-image.js +0 -21
  203. package/src/hooks/use-window-size.js +0 -46
  204. package/src/hooks/xpattern.png +0 -0
  205. package/src/index.js +0 -18
  206. package/src/lib.js +0 -7
  207. package/src/screenshot.png +0 -0
  208. package/src/site.css +0 -5
  209. package/src/stories.js +0 -2
  210. package/src/utils/blocks-to-article.js +0 -61
  211. package/src/utils/get-from-local-storage.js +0 -7
  212. package/src/utils/get-hotkey-help-text.js +0 -11
  213. package/src/utils/get-landmarks-with-transform.js +0 -23
  214. package/src/utils/photosToImages.js +0 -67
  215. package/src/utils/regions-groups.js +0 -19
  216. package/src/utils/regions-to-blocks.js +0 -16
  217. package/src/utils/saveable-actions-enum.js +0 -5
  218. package/src/utils/set-in-local-storage.js +0 -6
  219. package/src/utils/sleep.js +0 -3
  220. package/src/utils/uuid-to-hash.js +0 -5
  221. /package/{src/Errorer → Errorer}/errorer.css +0 -0
  222. /package/{src/Locker → Locker}/locker.css +0 -0
  223. /package/{src/PageSelector → PageSelector}/page-selector.css +0 -0
  224. /package/{src/utils → utils}/next-group-id.js +0 -0
@@ -0,0 +1,93 @@
1
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import React, { useState } from 'react';
5
+ import { createReactEditorJS } from 'react-editor-js';
6
+ import blocksToArticle from '../utils/blocks-to-article';
7
+ import { EDITOR_JS_TOOLS } from './tools';
8
+ import ReadOnly from './readOnly';
9
+ var ReactEditorJS = createReactEditorJS();
10
+
11
+ function Editor(_ref) {
12
+ var _ref$blocks = _ref.blocks,
13
+ blocks = _ref$blocks === void 0 ? [] : _ref$blocks,
14
+ onChange = _ref.onChange,
15
+ imageIndex = _ref.imageIndex,
16
+ selectedFrame = _ref.selectedFrame;
17
+
18
+ var _useState = useState(false),
19
+ _useState2 = _slicedToArray(_useState, 2),
20
+ editMode = _useState2[0],
21
+ setEditMode = _useState2[1];
22
+
23
+ var handleChange =
24
+ /*#__PURE__*/
25
+ function () {
26
+ var _ref2 = _asyncToGenerator(
27
+ /*#__PURE__*/
28
+ _regeneratorRuntime.mark(function _callee(instance) {
29
+ var data;
30
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
31
+ while (1) {
32
+ switch (_context.prev = _context.next) {
33
+ case 0:
34
+ _context.next = 2;
35
+ return instance.saver.save();
36
+
37
+ case 2:
38
+ data = _context.sent;
39
+ onChange({
40
+ imageIndex: imageIndex,
41
+ data: data
42
+ });
43
+
44
+ case 4:
45
+ case "end":
46
+ return _context.stop();
47
+ }
48
+ }
49
+ }, _callee);
50
+ }));
51
+
52
+ return function handleChange(_x) {
53
+ return _ref2.apply(this, arguments);
54
+ };
55
+ }();
56
+
57
+ var toggleEditMode = function toggleEditMode() {
58
+ setEditMode(function (prev) {
59
+ return !prev;
60
+ });
61
+ };
62
+
63
+ if (blocks.length < 1) {
64
+ return React.createElement("div", {
65
+ className: "instructions"
66
+ }, React.createElement("h1", null, "Click article to display text."));
67
+ }
68
+
69
+ return React.createElement("div", null, React.createElement("div", {
70
+ className: "show-metadata-wrapper"
71
+ }, React.createElement("label", {
72
+ className: "switch mr-2"
73
+ }, React.createElement("input", {
74
+ id: "show-metadata",
75
+ type: "checkbox",
76
+ value: editMode,
77
+ onChange: toggleEditMode
78
+ }), React.createElement("span", {
79
+ className: "slider round"
80
+ })), React.createElement("label", null, "Edit mode")), !editMode ? React.createElement(ReadOnly, {
81
+ article: blocksToArticle(blocks)
82
+ }) : React.createElement(ReactEditorJS, {
83
+ defaultValue: {
84
+ blocks: blocks
85
+ },
86
+ tools: EDITOR_JS_TOOLS,
87
+ onChange: handleChange,
88
+ enableReInitialize: true,
89
+ key: selectedFrame
90
+ }));
91
+ }
92
+
93
+ export default Editor;
@@ -0,0 +1,123 @@
1
+ import React from 'react';
2
+
3
+ function ReadOnly(_ref) {
4
+ var article = _ref.article;
5
+ return React.createElement("div", null, React.createElement("h1", {
6
+ className: "ro-title",
7
+ dangerouslySetInnerHTML: {
8
+ __html: article.title
9
+ }
10
+ }), React.createElement("h2", {
11
+ className: "ro-subtitle",
12
+ dangerouslySetInnerHTML: {
13
+ __html: article.subtitle
14
+ }
15
+ }), React.createElement("p", {
16
+ className: "ro-text",
17
+ dangerouslySetInnerHTML: {
18
+ __html: article.text
19
+ }
20
+ }), React.createElement("p", {
21
+ className: "ro-author",
22
+ dangerouslySetInnerHTML: {
23
+ __html: article.author
24
+ }
25
+ }), React.createElement("p", {
26
+ className: "ro-about-author",
27
+ dangerouslySetInnerHTML: {
28
+ __html: article.about_author
29
+ }
30
+ }), React.createElement("p", {
31
+ className: "ro-appendix",
32
+ dangerouslySetInnerHTML: {
33
+ __html: article.appendix
34
+ }
35
+ }), React.createElement("p", {
36
+ className: "ro-photo-author",
37
+ dangerouslySetInnerHTML: {
38
+ __html: article.photo_author
39
+ }
40
+ }), React.createElement("p", {
41
+ className: "ro-photo-caption",
42
+ dangerouslySetInnerHTML: {
43
+ __html: article.photo_caption
44
+ }
45
+ }), React.createElement("p", {
46
+ className: "ro-advertisment",
47
+ dangerouslySetInnerHTML: {
48
+ __html: article.advertisement
49
+ }
50
+ }), React.createElement("p", {
51
+ className: "ro-other-graphics",
52
+ dangerouslySetInnerHTML: {
53
+ __html: article.other_graphics
54
+ }
55
+ }), React.createElement("p", {
56
+ className: "ro-unknown",
57
+ dangerouslySetInnerHTML: {
58
+ __html: article.unknown
59
+ }
60
+ }), React.createElement("p", {
61
+ className: "ro-table",
62
+ dangerouslySetInnerHTML: {
63
+ __html: article.table
64
+ }
65
+ }), React.createElement("p", {
66
+ className: "ro-section",
67
+ dangerouslySetInnerHTML: {
68
+ __html: article.section
69
+ }
70
+ }), React.createElement("p", {
71
+ className: "ro-continuation_ref",
72
+ dangerouslySetInnerHTML: {
73
+ __html: article.continuation_ref
74
+ }
75
+ }), React.createElement("p", {
76
+ className: "ro-cover_clip",
77
+ dangerouslySetInnerHTML: {
78
+ __html: article.cover_clip
79
+ }
80
+ }), React.createElement("p", {
81
+ className: "ro-page_id",
82
+ dangerouslySetInnerHTML: {
83
+ __html: article.page_id
84
+ }
85
+ }), React.createElement("p", {
86
+ className: "ro-continuation_mark",
87
+ dangerouslySetInnerHTML: {
88
+ __html: article.continuation_mark
89
+ }
90
+ }), React.createElement("p", {
91
+ className: "ro-follow_up_mark",
92
+ dangerouslySetInnerHTML: {
93
+ __html: article.follow_up_mark
94
+ }
95
+ }), React.createElement("p", {
96
+ className: "ro-article_termination_mark",
97
+ dangerouslySetInnerHTML: {
98
+ __html: article.article_termination_mark
99
+ }
100
+ }), React.createElement("p", {
101
+ className: "ro-page_splitting_stripe",
102
+ dangerouslySetInnerHTML: {
103
+ __html: article.page_splitting_stripe
104
+ }
105
+ }), React.createElement("p", {
106
+ className: "ro-column_id_stripe",
107
+ dangerouslySetInnerHTML: {
108
+ __html: article.column_id_stripe
109
+ }
110
+ }), React.createElement("p", {
111
+ className: "ro-prev_page_reference",
112
+ dangerouslySetInnerHTML: {
113
+ __html: article.prev_page_reference
114
+ }
115
+ }), React.createElement("p", {
116
+ className: "ro-section_subcategory",
117
+ dangerouslySetInnerHTML: {
118
+ __html: article.section_subcategory
119
+ }
120
+ }));
121
+ }
122
+
123
+ export default ReadOnly;
@@ -1,6 +1,5 @@
1
1
  // tools.js
2
2
  import Annotation from './annotation-plugin/annotation';
3
-
4
- export const EDITOR_JS_TOOLS = {
3
+ export var EDITOR_JS_TOOLS = {
5
4
  annotation: Annotation
6
- }
5
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ import ErrorIcon from '@mui/icons-material/Error';
3
+ import './errorer.css';
4
+
5
+ function Errorer() {
6
+ return React.createElement("div", {
7
+ className: "errorer"
8
+ }, React.createElement(ErrorIcon, null));
9
+ }
10
+
11
+ export default Errorer;
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ import Annotator from "../Annotator";
3
+ export default (function (props) {
4
+ return React.createElement(Annotator, Object.assign({}, props, {
5
+ fullImageSegmentationMode: true
6
+ }));
7
+ });
@@ -0,0 +1,63 @@
1
+ import React, { memo } from "react";
2
+ import { makeStyles } from "@mui/styles";
3
+ import { createTheme, ThemeProvider } from "@mui/material/styles";
4
+ import SidebarBoxContainer from "../SidebarBoxContainer";
5
+ import CollectionsIcon from "@mui/icons-material/Collections";
6
+ import { grey } from "@mui/material/colors";
7
+ import List from "@mui/material/List";
8
+ import ListItem from "@mui/material/ListItem";
9
+ import ListItemText from "@mui/material/ListItemText";
10
+ import uuidToHash from '../utils/uuid-to-hash';
11
+ var theme = createTheme();
12
+ var useStyles = makeStyles(function (theme) {
13
+ return {
14
+ img: {
15
+ width: 40,
16
+ height: 40,
17
+ borderRadius: 8
18
+ }
19
+ };
20
+ });
21
+ export var GroupSelectorSidebarBox = function GroupSelectorSidebarBox(_ref) {
22
+ var title = _ref.title,
23
+ subtitle = _ref.subtitle,
24
+ groups = _ref.groups,
25
+ onSelect = _ref.onSelect,
26
+ selectedGroupId = _ref.selectedGroupId;
27
+ var classes = useStyles();
28
+ return React.createElement(ThemeProvider, {
29
+ theme: theme
30
+ }, React.createElement(SidebarBoxContainer, {
31
+ title: title || '',
32
+ subTitle: subtitle || '',
33
+ icon: React.createElement(CollectionsIcon, {
34
+ style: {
35
+ color: grey[700]
36
+ }
37
+ })
38
+ }, React.createElement(List, null, groups.map(function (_ref2, i) {
39
+ var id = _ref2.id,
40
+ groupTitle = _ref2.title,
41
+ groupSubtitle = _ref2.subtitle,
42
+ color = _ref2.color;
43
+ return React.createElement(ListItem, {
44
+ button: true,
45
+ onClick: function onClick() {
46
+ return onSelect(id);
47
+ },
48
+ dense: true,
49
+ key: id,
50
+ style: {
51
+ backgroundColor: id === selectedGroupId ? '#bbdefb' : null
52
+ }
53
+ }, React.createElement(ListItemText, {
54
+ primary: React.createElement("strong", {
55
+ style: {
56
+ color: color
57
+ }
58
+ }, uuidToHash(groupTitle)),
59
+ secondary: groupSubtitle
60
+ }));
61
+ }))));
62
+ };
63
+ export default GroupSelectorSidebarBox;
@@ -0,0 +1,138 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import React, { memo, useState } from "react";
3
+ import SidebarBoxContainer from "../SidebarBoxContainer";
4
+ import FilterNoneIcon from '@mui/icons-material/FilterNone';
5
+ import { styled } from "@mui/material/styles";
6
+ import { createTheme, ThemeProvider } from "@mui/material/styles";
7
+ import { grey } from "@mui/material/colors";
8
+ import uuidToHash from "../utils/uuid-to-hash";
9
+ var theme = createTheme();
10
+ var GroupItemDiv = styled("div")(function (_ref) {
11
+ var theme = _ref.theme;
12
+ return {
13
+ display: "flex",
14
+ flexDirection: "column",
15
+ marginBottom: "1rem",
16
+ "& > label": {
17
+ fontSize: "1rem",
18
+ marginBottom: ".5rem",
19
+ textTransform: "capitalize"
20
+ }
21
+ };
22
+ });
23
+
24
+ var GroupItem = function GroupItem(_ref2) {
25
+ var group = _ref2.group;
26
+ return React.createElement(GroupItemDiv, null, uuidToHash(group.id));
27
+ };
28
+
29
+ var GroupList = function GroupList(_ref3) {
30
+ var groups = _ref3.groups;
31
+ return React.createElement("div", null, React.createElement("h2", null, "Groups"), groups.map(function (g, idx) {
32
+ return React.createElement(GroupItem, {
33
+ key: "".concat(g, "-").concat(idx),
34
+ group: g
35
+ });
36
+ }));
37
+ };
38
+
39
+ var AddGroupFormDiv = styled("div")(function (_ref4) {
40
+ var theme = _ref4.theme;
41
+ return {
42
+ display: "flex",
43
+ flexDirection: "row"
44
+ };
45
+ });
46
+
47
+ var AddGroupFrom = function AddGroupFrom(_ref5) {
48
+ var onAddGroup = _ref5.onAddGroup;
49
+
50
+ var _useState = useState(""),
51
+ _useState2 = _slicedToArray(_useState, 2),
52
+ value = _useState2[0],
53
+ setValue = _useState2[1];
54
+
55
+ var handleChange = function handleChange(e) {
56
+ setValue(e.target.value);
57
+ };
58
+
59
+ var handleSubmit = function handleSubmit(e) {
60
+ e.preventDefault();
61
+ onAddGroup(value);
62
+ setValue('');
63
+ };
64
+
65
+ return React.createElement(AddGroupFormDiv, null, React.createElement("form", {
66
+ onSubmit: handleSubmit,
67
+ style: {
68
+ display: "flex",
69
+ paddingRight: "6px"
70
+ }
71
+ }, React.createElement("input", {
72
+ type: "text",
73
+ value: value,
74
+ name: "new-group",
75
+ placeholder: "New group name",
76
+ onChange: handleChange,
77
+ style: {
78
+ marginRight: "1rem"
79
+ }
80
+ }), React.createElement("input", {
81
+ type: "submit",
82
+ value: "Create group"
83
+ })));
84
+ };
85
+
86
+ var DivContainer = styled("div")(function (_ref6) {
87
+ var theme = _ref6.theme;
88
+ return {
89
+ paddingLeft: 16,
90
+ paddingRight: 16,
91
+ fontSize: 12,
92
+ "& h1": {
93
+ fontSize: 18
94
+ },
95
+ "& h2": {
96
+ fontSize: 14
97
+ },
98
+ "& h3": {
99
+ fontSize: 12
100
+ },
101
+ "& h4": {
102
+ fontSize: 12
103
+ },
104
+ "& h5": {
105
+ fontSize: 12
106
+ },
107
+ "& h6": {
108
+ fontSize: 12
109
+ },
110
+ "& p": {
111
+ fontSize: 12
112
+ },
113
+ "& a": {},
114
+ "& img": {
115
+ width: "100%"
116
+ }
117
+ };
118
+ });
119
+ export var GroupsEditorSidebarBox = function GroupsEditorSidebarBox(_ref7) {
120
+ var groups = _ref7.groups,
121
+ onAddGroup = _ref7.onAddGroup;
122
+ return React.createElement(ThemeProvider, {
123
+ theme: theme
124
+ }, React.createElement(SidebarBoxContainer, {
125
+ title: "Groups",
126
+ icon: React.createElement(FilterNoneIcon, {
127
+ style: {
128
+ color: grey[700]
129
+ }
130
+ }),
131
+ expandedByDefault: true
132
+ }, React.createElement(DivContainer, null, React.createElement("h2", null, "Add new group"), React.createElement(AddGroupFrom, {
133
+ onAddGroup: onAddGroup
134
+ }), React.createElement(GroupList, {
135
+ groups: groups
136
+ }))));
137
+ };
138
+ export default memo(GroupsEditorSidebarBox);
@@ -0,0 +1,58 @@
1
+ import React, { memo } from "react";
2
+ import SidebarBoxContainer from "../SidebarBoxContainer";
3
+ import HelpIcon from '@mui/icons-material/Help';
4
+ import { styled } from "@mui/material/styles";
5
+ import { createTheme, ThemeProvider } from "@mui/material/styles";
6
+ import { grey } from "@mui/material/colors";
7
+ import Markdown from "react-markdown";
8
+ var theme = createTheme();
9
+ var MarkdownContainer = styled("div")(function (_ref) {
10
+ var theme = _ref.theme;
11
+ return {
12
+ paddingLeft: 16,
13
+ paddingRight: 16,
14
+ fontSize: 12,
15
+ "& h1": {
16
+ fontSize: 18
17
+ },
18
+ "& h2": {
19
+ fontSize: 14
20
+ },
21
+ "& h3": {
22
+ fontSize: 12
23
+ },
24
+ "& h4": {
25
+ fontSize: 12
26
+ },
27
+ "& h5": {
28
+ fontSize: 12
29
+ },
30
+ "& h6": {
31
+ fontSize: 12
32
+ },
33
+ "& p": {
34
+ fontSize: 12
35
+ },
36
+ "& a": {},
37
+ "& img": {
38
+ width: "100%"
39
+ }
40
+ };
41
+ });
42
+ export var HelpSidebarBox = function HelpSidebarBox(_ref2) {
43
+ var help = _ref2.help;
44
+ return React.createElement(ThemeProvider, {
45
+ theme: theme
46
+ }, React.createElement(SidebarBoxContainer, {
47
+ title: "Help",
48
+ icon: React.createElement(HelpIcon, {
49
+ style: {
50
+ color: grey[700]
51
+ }
52
+ }),
53
+ expandedByDefault: help && help !== "" ? false : true
54
+ }, React.createElement(MarkdownContainer, null, React.createElement(Markdown, {
55
+ source: help
56
+ }))));
57
+ };
58
+ export default memo(HelpSidebarBox);
@@ -0,0 +1,102 @@
1
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread";
2
+ import React from "react";
3
+ import classnames from "classnames";
4
+ import { makeStyles } from "@mui/styles";
5
+ import { createTheme, ThemeProvider } from "@mui/material/styles";
6
+ var theme = createTheme();
7
+ var useStyles = makeStyles(function (theme) {
8
+ return {
9
+ "@keyframes borderDance": {
10
+ from: {
11
+ strokeDashoffset: 0
12
+ },
13
+ to: {
14
+ strokeDashoffset: 100
15
+ }
16
+ },
17
+ highlightBox: {
18
+ zIndex: 2,
19
+ transition: "opacity 500ms",
20
+ "&.highlighted": {
21
+ zIndex: 3
22
+ },
23
+ "&:not(.highlighted)": {
24
+ opacity: 0
25
+ },
26
+ "&:not(.highlighted):hover": {
27
+ opacity: 0.6
28
+ },
29
+ "& path": {
30
+ // NOTE: attributes below commnted because resetting screen caused old frame to highlight
31
+ // vectorEffect: "non-scaling-stroke",
32
+ // strokeWidth: 2,
33
+ // stroke: "#FFF",
34
+ // strokeDasharray: 5,
35
+ fill: "none",
36
+ animationName: "$borderDance",
37
+ animationDuration: "4s",
38
+ animationTimingFunction: "linear",
39
+ animationIterationCount: "infinite",
40
+ animationPlayState: "running"
41
+ }
42
+ }
43
+ };
44
+ });
45
+ export var HighlightBox = function HighlightBox(_ref) {
46
+ var mouseEvents = _ref.mouseEvents,
47
+ dragWithPrimary = _ref.dragWithPrimary,
48
+ zoomWithPrimary = _ref.zoomWithPrimary,
49
+ createWithPrimary = _ref.createWithPrimary,
50
+ onBeginMovePoint = _ref.onBeginMovePoint,
51
+ onSelectRegion = _ref.onSelectRegion,
52
+ r = _ref.region,
53
+ pbox = _ref.pbox;
54
+ var classes = useStyles();
55
+ if (!pbox.w || pbox.w === Infinity) return null;
56
+ if (!pbox.h || pbox.h === Infinity) return null;
57
+ if (r.unfinished) return null;
58
+ var styleCoords = r.type === "point" ? {
59
+ left: pbox.x + pbox.w / 2 - 30,
60
+ top: pbox.y + pbox.h / 2 - 30,
61
+ width: 60,
62
+ height: 60
63
+ } : {
64
+ left: pbox.x - 5,
65
+ top: pbox.y - 5,
66
+ width: pbox.w + 10,
67
+ height: pbox.h + 10
68
+ };
69
+ var pathD = r.type === "point" ? "M5,5 L".concat(styleCoords.width - 5, " 5L").concat(styleCoords.width - 5, " ").concat(styleCoords.height - 5, "L5 ").concat(styleCoords.height - 5, "Z") : "M5,5 L".concat(pbox.w + 5, ",5 L").concat(pbox.w + 5, ",").concat(pbox.h + 5, " L5,").concat(pbox.h + 5, " Z");
70
+ return React.createElement(ThemeProvider, {
71
+ theme: theme
72
+ }, React.createElement("svg", Object.assign({
73
+ key: r.id,
74
+ className: classnames(classes.highlightBox, {
75
+ highlighted: r.highlighted
76
+ })
77
+ }, mouseEvents, !zoomWithPrimary && !dragWithPrimary ? {
78
+ onMouseDown: function onMouseDown(e) {
79
+ if (!r.locked && r.type === "point" && r.highlighted && e.button === 0) {
80
+ return onBeginMovePoint(r);
81
+ }
82
+
83
+ if (e.button === 0 && !createWithPrimary) return onSelectRegion(_objectSpread({}, r, {
84
+ ctrlKey: e.ctrlKey
85
+ }));
86
+ mouseEvents.onMouseDown(e);
87
+ }
88
+ } : {}, {
89
+ style: _objectSpread({}, r.highlighted ? {
90
+ pointerEvents: r.type !== "point" ? "none" : undefined,
91
+ cursor: "grab"
92
+ } : {
93
+ cursor: !(zoomWithPrimary || dragWithPrimary || createWithPrimary) ? "pointer" : undefined,
94
+ pointerEvents: zoomWithPrimary || dragWithPrimary || createWithPrimary && !r.highlighted ? "none" : undefined
95
+ }, {
96
+ position: "absolute"
97
+ }, styleCoords)
98
+ }), React.createElement("path", {
99
+ d: pathD
100
+ })));
101
+ };
102
+ export default HighlightBox;
@@ -0,0 +1,71 @@
1
+ import React, { setState, memo } from "react";
2
+ import { makeStyles } from "@mui/styles";
3
+ import { createTheme, ThemeProvider } from "@mui/material/styles";
4
+ import SidebarBoxContainer from "../SidebarBoxContainer";
5
+ import HistoryIcon from "@mui/icons-material/History";
6
+ import List from "@mui/material/List";
7
+ import ListItem from "@mui/material/ListItem";
8
+ import ListItemText from "@mui/material/ListItemText";
9
+ import IconButton from "@mui/material/IconButton";
10
+ import ListItemSecondaryAction from "@mui/material/ListItemSecondaryAction";
11
+ import UndoIcon from "@mui/icons-material/Undo";
12
+ import moment from "moment";
13
+ import { grey } from "@mui/material/colors";
14
+ import isEqual from "lodash/isEqual";
15
+ import Box from "@mui/material/Box";
16
+ var theme = createTheme();
17
+ var useStyles = makeStyles(function (theme) {
18
+ return {
19
+ emptyText: {
20
+ fontSize: 14,
21
+ fontWeight: "bold",
22
+ color: grey[500],
23
+ textAlign: "center",
24
+ padding: 20
25
+ }
26
+ };
27
+ });
28
+ var listItemTextStyle = {
29
+ paddingLeft: 16
30
+ };
31
+ export var HistorySidebarBox = function HistorySidebarBox(_ref) {
32
+ var history = _ref.history,
33
+ onRestoreHistory = _ref.onRestoreHistory;
34
+ var classes = useStyles();
35
+ return React.createElement(ThemeProvider, {
36
+ theme: theme
37
+ }, React.createElement(SidebarBoxContainer, {
38
+ title: "History",
39
+ icon: React.createElement(HistoryIcon, {
40
+ style: {
41
+ color: grey[700]
42
+ }
43
+ }),
44
+ expandedByDefault: true
45
+ }, React.createElement(List, null, history.length === 0 && React.createElement("div", {
46
+ className: classes.emptyText
47
+ }, "No History Yet"), history.map(function (_ref2, i) {
48
+ var name = _ref2.name,
49
+ time = _ref2.time;
50
+ return React.createElement(ListItem, {
51
+ button: true,
52
+ dense: true,
53
+ key: i
54
+ }, React.createElement(ListItemText, {
55
+ style: listItemTextStyle,
56
+ primary: name,
57
+ secondary: moment(time).format("LT")
58
+ }), i === 0 && React.createElement(ListItemSecondaryAction, {
59
+ onClick: function onClick() {
60
+ return onRestoreHistory();
61
+ }
62
+ }, React.createElement(IconButton, null, React.createElement(UndoIcon, null))));
63
+ }))));
64
+ };
65
+ export default memo(HistorySidebarBox, function (prevProps, nextProps) {
66
+ return isEqual(prevProps.history.map(function (a) {
67
+ return [a.name, a.time];
68
+ }), nextProps.history.map(function (a) {
69
+ return [a.name, a.time];
70
+ }));
71
+ });