lost-sia 2.0.1-alpha8 → 3.0.0

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 (280) hide show
  1. package/README.md +4 -0
  2. package/dist/Annotation/logic/Annotation.d.ts +17 -0
  3. package/dist/Annotation/logic/Annotation.js +1 -0
  4. package/dist/Annotation/ui/AnnotationComponent.d.ts +24 -0
  5. package/dist/Annotation/ui/AnnotationComponent.js +1 -0
  6. package/dist/Annotation/ui/atoms/AnnoBar.d.ts +15 -0
  7. package/dist/Annotation/ui/atoms/AnnoBar.js +1 -0
  8. package/dist/Annotation/ui/atoms/DaviIcon.d.ts +9 -0
  9. package/dist/Annotation/ui/atoms/DaviIcon.js +19 -0
  10. package/dist/Annotation/ui/atoms/Edge.d.ts +17 -0
  11. package/dist/Annotation/ui/atoms/Edge.js +1 -0
  12. package/dist/Annotation/ui/atoms/Node.d.ts +17 -0
  13. package/dist/Annotation/ui/atoms/Node.js +1 -0
  14. package/dist/Annotation/ui/atoms/PolygonArea.d.ts +16 -0
  15. package/dist/Annotation/ui/atoms/PolygonArea.js +1 -0
  16. package/dist/Annotation/ui/tools/BBox.d.ts +21 -0
  17. package/dist/Annotation/ui/tools/BBox.js +1 -0
  18. package/dist/Annotation/ui/tools/Line.d.ts +21 -0
  19. package/dist/Annotation/ui/tools/Line.js +1 -0
  20. package/dist/Annotation/ui/tools/Point.d.ts +16 -0
  21. package/dist/Annotation/ui/tools/Point.js +1 -0
  22. package/dist/Annotation/ui/tools/Polygon.d.ts +23 -0
  23. package/dist/Annotation/ui/tools/Polygon.js +1 -0
  24. package/dist/Canvas/Canvas.d.ts +31 -0
  25. package/dist/Canvas/Canvas.js +1 -0
  26. package/dist/Canvas/LabelInput.d.ts +11 -0
  27. package/dist/Canvas/LabelInput.js +1 -0
  28. package/dist/IconButton.d.ts +25 -0
  29. package/dist/IconButton.js +1 -0
  30. package/dist/Sia.d.ts +33 -0
  31. package/dist/Sia.js +1 -0
  32. package/dist/Toolbar/Toolbar.d.ts +21 -0
  33. package/dist/Toolbar/Toolbar.js +1 -0
  34. package/dist/Toolbar/ToolbarItems/AccessibilityTools.d.ts +7 -0
  35. package/dist/Toolbar/ToolbarItems/AccessibilityTools.js +1 -0
  36. package/dist/Toolbar/ToolbarItems/AnnoToolSelector.d.ts +11 -0
  37. package/dist/Toolbar/ToolbarItems/AnnoToolSelector.js +1 -0
  38. package/dist/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.d.ts +11 -0
  39. package/dist/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.js +1 -0
  40. package/dist/Toolbar/ToolbarItems/ImageToolItems/TagLabel.d.ts +11 -0
  41. package/dist/Toolbar/ToolbarItems/ImageToolItems/TagLabel.js +1 -0
  42. package/dist/Toolbar/ToolbarItems/ImageTools.d.ts +13 -0
  43. package/dist/Toolbar/ToolbarItems/ImageTools.js +1 -0
  44. package/dist/Toolbar/ToolbarItems/Instructions.d.ts +2 -0
  45. package/dist/Toolbar/ToolbarItems/Instructions.js +1 -0
  46. package/dist/Toolbar/ToolbarItems/InstructionsModal.d.ts +6 -0
  47. package/dist/Toolbar/ToolbarItems/InstructionsModal.js +1 -0
  48. package/dist/assets/SIA-BV1tYu3P.css +1 -0
  49. package/dist/assets/brand-icons-Cu_C0hZ4.svg +1008 -0
  50. package/dist/assets/brand-icons-F3SPCeH1.woff +0 -0
  51. package/dist/assets/brand-icons-XL9sxUpA.woff2 +0 -0
  52. package/dist/assets/brand-icons-sqJ2Pg7a.eot +0 -0
  53. package/dist/assets/brand-icons-ubhWoxly.ttf +0 -0
  54. package/dist/assets/flags-DOLqOU7Y.png +0 -0
  55. package/dist/assets/icons-BOCtAERH.woff +0 -0
  56. package/dist/assets/icons-CHzK1VD9.eot +0 -0
  57. package/dist/assets/icons-D29ZQHHw.ttf +0 -0
  58. package/dist/assets/icons-Du6TOHnR.woff2 +0 -0
  59. package/dist/assets/icons-RwhydX30.svg +1518 -0
  60. package/dist/assets/node_modules/semantic-ui-css/semantic.min-Bvulf91l.css +346 -0
  61. package/dist/assets/outline-icons-BfdLr8tr.svg +366 -0
  62. package/dist/assets/outline-icons-DD8jm0uy.ttf +0 -0
  63. package/dist/assets/outline-icons-DInHoiqI.woff2 +0 -0
  64. package/dist/assets/outline-icons-LX8adJ4n.eot +0 -0
  65. package/dist/assets/outline-icons-aQ88nltS.woff +0 -0
  66. package/dist/index.d.ts +5 -0
  67. package/dist/index.js +1 -0
  68. package/dist/models/AnnotationMode.d.ts +11 -0
  69. package/dist/models/AnnotationMode.js +1 -0
  70. package/dist/models/AnnotationStatus.d.ts +8 -0
  71. package/dist/models/AnnotationStatus.js +1 -0
  72. package/dist/models/AnnotationTool.d.ts +7 -0
  73. package/dist/models/AnnotationTool.js +1 -0
  74. package/dist/models/CanvasAction.d.ts +28 -0
  75. package/dist/models/CanvasAction.js +1 -0
  76. package/dist/models/Direction.d.ts +7 -0
  77. package/dist/models/Direction.js +1 -0
  78. package/dist/models/EditorModes.d.ts +11 -0
  79. package/dist/models/EditorModes.js +1 -0
  80. package/dist/models/KeyAction.d.ts +22 -0
  81. package/dist/models/KeyAction.js +1 -0
  82. package/dist/models/NotificationType.d.ts +7 -0
  83. package/dist/models/NotificationType.js +1 -0
  84. package/dist/models/index.d.ts +6 -0
  85. package/dist/models/index.js +1 -0
  86. package/dist/stories/AnnotationTools.stories.d.ts +40 -0
  87. package/dist/stories/Canvas/Canvas.stories.d.ts +50 -0
  88. package/dist/stories/Canvas/CanvasOffset.d.ts +13 -0
  89. package/dist/stories/Canvas/CanvasWithOffset.stories.d.ts +36 -0
  90. package/dist/stories/FilterDropdown.stories.d.ts +19 -0
  91. package/dist/stories/MinimalSia.stories.d.ts +66 -0
  92. package/dist/stories/SIA/DemoWrapper.d.ts +8 -0
  93. package/dist/stories/SIA/DemoWrapper.stories.d.ts +27 -0
  94. package/dist/stories/SIA/SIA.stories.d.ts +72 -0
  95. package/dist/stories/Toolbar/ImageTools/TagLabel.stories.d.ts +21 -0
  96. package/dist/stories/Toolbar/Instructions.stories.d.ts +11 -0
  97. package/dist/stories/Toolbar/Toolbar.stories.d.ts +37 -0
  98. package/dist/stories/exampleData/exampleAnnotations.d.ts +8 -0
  99. package/dist/stories/exampleData/exampleExternalAnnotations.d.ts +8 -0
  100. package/dist/stories/exampleData/exampleImage.d.ts +2 -0
  101. package/dist/stories/exampleData/exampleLabels.d.ts +6 -0
  102. package/dist/types.d.ts +57 -0
  103. package/dist/types.js +1 -0
  104. package/dist/utils/KeyMapper.d.ts +9 -0
  105. package/dist/utils/KeyMapper.js +1 -0
  106. package/dist/utils/TimeUtils.d.ts +4 -0
  107. package/dist/utils/TimeUtils.js +1 -0
  108. package/dist/utils/color.d.ts +2 -0
  109. package/dist/utils/color.js +1 -0
  110. package/dist/utils/index.d.ts +2 -0
  111. package/dist/utils/index.js +1 -0
  112. package/dist/utils/mouse.d.ts +6 -0
  113. package/dist/utils/mouse.js +1 -0
  114. package/dist/utils/siaIcons.js +12 -0
  115. package/dist/utils/transform.d.ts +28 -0
  116. package/dist/utils/transform.js +1 -0
  117. package/dist/utils/uiConfig.js +1 -0
  118. package/dist/utils/windowViewport.d.ts +22 -0
  119. package/dist/utils/windowViewport.js +1 -0
  120. package/package.json +19 -16
  121. package/src/AnnoExampleViewer.jsx +18 -18
  122. package/src/Annotation/logic/Annotation.ts +24 -26
  123. package/src/Annotation/ui/AnnotationComponent.tsx +115 -86
  124. package/src/Annotation/ui/atoms/AnnoBar.tsx +51 -53
  125. package/src/Annotation/ui/atoms/DaviIcon.tsx +12 -22
  126. package/src/Annotation/ui/atoms/Edge.tsx +25 -22
  127. package/src/Annotation/ui/atoms/Node.tsx +56 -50
  128. package/src/Annotation/ui/atoms/PolygonArea.tsx +30 -35
  129. package/src/Annotation/ui/tools/BBox.tsx +136 -150
  130. package/src/Annotation/ui/tools/Line.tsx +94 -91
  131. package/src/Annotation/ui/tools/Point.tsx +19 -17
  132. package/src/Annotation/ui/tools/Polygon.tsx +126 -95
  133. package/src/Canvas/Canvas.tsx +748 -594
  134. package/src/Canvas/LabelInput.tsx +68 -45
  135. package/src/IconButton.tsx +119 -0
  136. package/src/InfoBoxes/AnnoDetails.jsx +53 -53
  137. package/src/InfoBoxes/AnnoStats.jsx +41 -41
  138. package/src/InfoBoxes/InfoBox.jsx +16 -16
  139. package/src/InfoBoxes/InfoBoxArea.jsx +32 -34
  140. package/src/InfoBoxes/LabelInfo.jsx +30 -30
  141. package/src/SIASettingButton.jsx +25 -25
  142. package/src/Sia.tsx +484 -0
  143. package/src/Toolbar/Toolbar.tsx +38 -31
  144. package/src/Toolbar/ToolbarItems/AccessibilityTools.tsx +26 -46
  145. package/src/Toolbar/ToolbarItems/AnnoToolSelector.tsx +53 -46
  146. package/src/Toolbar/ToolbarItems/ImageToolItems/ImageLabelInput.tsx +127 -0
  147. package/src/Toolbar/ToolbarItems/ImageToolItems/TagLabel.tsx +29 -28
  148. package/src/Toolbar/ToolbarItems/ImageTools.tsx +43 -40
  149. package/src/Toolbar/ToolbarItems/Instructions.tsx +47 -50
  150. package/src/Toolbar/ToolbarItems/InstructionsModal.tsx +8 -8
  151. package/src/index.ts +9 -13
  152. package/src/models/{AnnotationMode.tsx → AnnotationMode.ts} +1 -1
  153. package/src/models/{AnnotationStatus.tsx → AnnotationStatus.ts} +1 -1
  154. package/src/models/{AnnotationTool.tsx → AnnotationTool.ts} +1 -1
  155. package/src/models/{CanvasAction.tsx → CanvasAction.ts} +1 -1
  156. package/src/models/{Direction.tsx → Direction.ts} +1 -1
  157. package/src/models/{EditorModes.tsx → EditorModes.ts} +1 -1
  158. package/src/models/{KeyAction.tsx → KeyAction.ts} +3 -1
  159. package/src/models/NotificationType.ts +8 -0
  160. package/src/models/index.ts +6 -7
  161. package/src/siaDummyData.js +71 -71
  162. package/src/stories/AnnotationTools.mdx +27 -0
  163. package/src/stories/AnnotationTools.stories.tsx +104 -0
  164. package/src/stories/Canvas/Canvas.stories.tsx +59 -113
  165. package/src/stories/Canvas/CanvasOffset.tsx +54 -38
  166. package/src/stories/Canvas/CanvasWithOffset.stories.tsx +42 -113
  167. package/src/stories/FilterDropdown.stories.ts +13 -11
  168. package/src/stories/MinimalSIA.mdx +20 -0
  169. package/src/stories/MinimalSia.stories.tsx +90 -0
  170. package/src/stories/SIA/DemoWrapper.stories.tsx +71 -0
  171. package/src/stories/SIA/DemoWrapper.tsx +55 -0
  172. package/src/stories/SIA/SIA.stories.tsx +79 -45
  173. package/src/stories/Toolbar/ImageTools/TagLabel.stories.tsx +11 -12
  174. package/src/stories/Toolbar/Instructions.stories.tsx +11 -11
  175. package/src/stories/Toolbar/Toolbar.stories.tsx +32 -47
  176. package/src/stories/Welcome.mdx +5 -0
  177. package/src/stories/development/CoordinateSystems.mdx +25 -0
  178. package/src/stories/exampleData/exampleAnnotations.ts +65 -0
  179. package/src/stories/exampleData/exampleExternalAnnotations.ts +115 -0
  180. package/src/stories/{siaDummyData2.ts → exampleData/exampleImage.ts} +3 -264
  181. package/src/stories/exampleData/exampleLabels.ts +146 -0
  182. package/src/stories/main.scss +6 -0
  183. package/src/styles/style.scss +1 -26
  184. package/src/types.ts +67 -0
  185. package/src/utils/KeyMapper.ts +76 -74
  186. package/src/utils/TimeUtils.ts +11 -0
  187. package/src/utils/color.ts +25 -25
  188. package/src/utils/hist.js +22 -22
  189. package/src/utils/index.ts +2 -3
  190. package/src/utils/mouse.ts +45 -0
  191. package/src/utils/siaIcons.jsx +5 -7
  192. package/src/utils/transform.ts +186 -0
  193. package/src/utils/uiConfig.js +19 -22
  194. package/src/utils/windowViewport.ts +34 -0
  195. package/src/AnnoLabelInput.jsx +0 -109
  196. package/src/AnnoToolBar.jsx +0 -153
  197. package/src/Annotation/AnnoBar.jsx +0 -154
  198. package/src/Annotation/Annotation.jsx +0 -395
  199. package/src/Annotation/Annotation.scss +0 -47
  200. package/src/Annotation/BBox.jsx +0 -299
  201. package/src/Annotation/Edge.jsx +0 -92
  202. package/src/Annotation/InfSelectionArea.jsx +0 -72
  203. package/src/Annotation/Line.jsx +0 -68
  204. package/src/Annotation/Node.jsx +0 -282
  205. package/src/Annotation/Point.jsx +0 -200
  206. package/src/Annotation/Polygon.jsx +0 -404
  207. package/src/Annotation/logic/AnnotationUtils.ts +0 -30
  208. package/src/Canvas.jsx +0 -2194
  209. package/src/ImgBar.jsx +0 -131
  210. package/src/LabelInput.jsx +0 -238
  211. package/src/Prompt.jsx +0 -45
  212. package/src/SIAFilterButton.jsx +0 -186
  213. package/src/Sia.jsx +0 -478
  214. package/src/Sia2.tsx +0 -392
  215. package/src/SiaPopup.jsx +0 -15
  216. package/src/ToolBar.jsx +0 -463
  217. package/src/Toolbar/NavigationButtons.tsx +0 -21
  218. package/src/Toolbar/ToolbarItem.jsx +0 -30
  219. package/src/Toolbar/ToolbarItems/ImageToolItems/ImageLabel.tsx +0 -62
  220. package/src/Toolbar.css +0 -13
  221. package/src/ToolbarItem.jsx +0 -31
  222. package/src/filterTools.js +0 -5
  223. package/src/models/AllowedTools.tsx +0 -9
  224. package/src/models/AnnotationSettings.tsx +0 -9
  225. package/src/models/ExternalAnnotation.ts +0 -15
  226. package/src/models/Label.tsx +0 -8
  227. package/src/models/UiConfig.tsx +0 -6
  228. package/src/stories/Button.jsx +0 -54
  229. package/src/stories/Button.stories.js +0 -48
  230. package/src/stories/Header.jsx +0 -69
  231. package/src/stories/Header.stories.js +0 -28
  232. package/src/stories/Page.jsx +0 -87
  233. package/src/stories/Page.stories.js +0 -28
  234. package/src/stories/SIA2/DemoWrapper.stories.tsx +0 -167
  235. package/src/stories/SIA2/DemoWrapper.tsx +0 -54
  236. package/src/stories/SIA2/Sia2.stories.tsx +0 -62
  237. package/src/stories/Toolbar/ImageTools/ImageLabel.stories.tsx +0 -32
  238. package/src/stories/assets/accessibility.png +0 -0
  239. package/src/stories/assets/accessibility.svg +0 -5
  240. package/src/stories/assets/addon-library.png +0 -0
  241. package/src/stories/assets/assets.png +0 -0
  242. package/src/stories/assets/avif-test-image.avif +0 -0
  243. package/src/stories/assets/context.png +0 -0
  244. package/src/stories/assets/discord.svg +0 -15
  245. package/src/stories/assets/docs.png +0 -0
  246. package/src/stories/assets/figma-plugin.png +0 -0
  247. package/src/stories/assets/github.svg +0 -3
  248. package/src/stories/assets/share.png +0 -0
  249. package/src/stories/assets/styling.png +0 -0
  250. package/src/stories/assets/testing.png +0 -0
  251. package/src/stories/assets/theming.png +0 -0
  252. package/src/stories/assets/tutorials.svg +0 -12
  253. package/src/stories/assets/youtube.svg +0 -4
  254. package/src/stories/button.css +0 -30
  255. package/src/stories/header.css +0 -32
  256. package/src/stories/lost.js +0 -54
  257. package/src/stories/page.css +0 -69
  258. package/src/stories/siaDummyData.js +0 -263
  259. package/src/stories/store.js +0 -18
  260. package/src/test.js +0 -7
  261. package/src/types/annoStatus.js +0 -4
  262. package/src/types/canvasActions.js +0 -58
  263. package/src/types/cursorstyles.js +0 -3
  264. package/src/types/modes.js +0 -9
  265. package/src/types/notificationType.js +0 -11
  266. package/src/types/toolbarEvents.js +0 -35
  267. package/src/types/tools.js +0 -17
  268. package/src/types.tsx +0 -11
  269. package/src/utils/annoConversion.js +0 -145
  270. package/src/utils/annoConversion2.ts +0 -145
  271. package/src/utils/colorlut.js +0 -68
  272. package/src/utils/constraints.js +0 -81
  273. package/src/utils/index.js +0 -1
  274. package/src/utils/keyActions.js +0 -113
  275. package/src/utils/mouse.js +0 -14
  276. package/src/utils/mouse2.ts +0 -35
  277. package/src/utils/transform.js +0 -336
  278. package/src/utils/transform2.ts +0 -343
  279. package/src/utils/windowViewport.js +0 -34
  280. package/src/utils/windowViewport2.ts +0 -50
@@ -0,0 +1 @@
1
+ const r=(t,o)=>{const n=((o-t)/1e3).toFixed(2);return Number.parseFloat(n)},d={getRoundedDuration:r};export{d as default};
@@ -0,0 +1,2 @@
1
+ export declare const getColor: (index?: number) => string;
2
+ export declare const getDefaultColor: () => string;
@@ -0,0 +1 @@
1
+ const a=["#46aed7","#e28f81","#50b897","#88712f","#9cb067","#a4527d","#a55046","#6e90da","#487b3b","#6360a7","#cd8fd3","#d5a442","#cf7635","#da4971","#a4b137","#d44da4","#aa54be","#5ab74d","#7166d9","#d14734"],e=(d=0)=>a[d%a.length],o=()=>a[0];export{e as getColor,o as getDefaultColor};
@@ -0,0 +1,2 @@
1
+ export { default as TimeUtils } from './TimeUtils';
2
+ export { uiConfig, SIA_INITIAL_UI_CONFIG } from './uiConfig';
@@ -0,0 +1 @@
1
+ import{default as e}from"./TimeUtils.js";import{SIA_INITIAL_UI_CONFIG as i,uiConfig as r}from"./uiConfig.js";export{i as SIA_INITIAL_UI_CONFIG,e as TimeUtils,r as uiConfig};
@@ -0,0 +1,6 @@
1
+ import { MouseEvent } from 'react';
2
+ import { Point, Vector2 } from '../types';
3
+ declare const _default: {
4
+ getAntiScaledMouseStagePosition: (e: MouseEvent, pageToStageOffset: Point, svgScale: number, svgTranslation: Vector2) => Point;
5
+ };
6
+ export default _default;
@@ -0,0 +1 @@
1
+ const d=(o,t,e,s)=>{const a={x:o.pageX,y:o.pageY},n={x:a.x-t.x,y:a.y-t.y},x={x:n.x/e,y:n.y/e};return{x:x.x-s.x,y:x.y-s.y}},y={getAntiScaledMouseStagePosition:d};export{y as default};
@@ -0,0 +1,12 @@
1
+ import{jsx as n}from"react/jsx-runtime";function o(){return n("svg",{version:"1.1",id:"Linie",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1190.549 841.891",width:"17px",children:n("path",{fill:"currentColor",d:`M986.331,109.582c7.141-10.669,28.926-51.179-2.968-85.299S891.011,8.972,891.011,8.972L539.125,133.474
2
+ L63.239,302.022c-21.503,7.998-53.586,30.072-60.956,61.716s-2.116,58.538,22.414,96.79S211.33,752.213,228.564,777.28
3
+ c26.453,36.868,62.16,58.042,105.507,57.154s365.665-7.485,365.665-7.485l331.7-8.325l89.453-2.293c0,0,70.998-7.179,69.861-60.287
4
+ c-1.135-53.108-74.618-62.721-74.618-62.721s-733.215,15.553-749.148,15.576c-22.688,0.201-45.355-15.278-54.146-28.928
5
+ s-175.79-272.956-175.79-272.956l600.587-212.338c0,0-73.179,67.087-99.315,100.041s-30.56,74.565-5.053,95.237
6
+ c31.188,24.081,91.974-3.708,123.127-39.312C782.35,323.912,979.191,120.251,986.331,109.582z`})})}function r(){return n("svg",{version:"1.1",id:"Linie",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1190.549 841.891",width:"17px",children:n("path",{fill:"none",stroke:"currentColor",strokeWidth:"120",strokeMiterlimit:"10",d:`M929.775,710.655
7
+ c0,23.386-19.134,42.52-42.52,42.52H278.991c-23.386,0-42.52-19.134-42.52-42.52V102.392c0-23.386,19.134-42.52,42.52-42.52
8
+ h608.264c23.386,0,42.52,19.134,42.52,42.52V710.655z`})})}function t(){return n("svg",{version:"1.1",id:"Linie",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1190.549 841.891",width:"17px",children:n("path",{fill:"none",stroke:"currentColor",strokeWidth:"120",strokeMiterlimit:"10",d:`M342.327,769.938
9
+ c-23.379,0.548-52.922-15.056-65.65-34.674L65.479,409.738c-12.729-19.619-5.085-41.998,16.984-49.732L917.331,67.421
10
+ c22.07-7.734,26.86-0.275,10.645,16.576L691.761,329.475c-16.216,16.852-14.503,42.542,3.807,57.092l425.212,337.901
11
+ c18.31,14.549,14.16,26.901-9.219,27.449L342.327,769.938z`})})}function c(){return n("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 1190.549 841.891",width:"17px",children:n("path",{fill:"currentColor",d:`M748.197,408.286c0,151.355-122.699,274.058-274.059,274.058c-151.357,0-274.057-122.703-274.057-274.058
12
+ c0-151.356,122.7-274.057,274.057-274.057C625.497,134.229,748.197,256.929,748.197,408.286z`})})}export{r as bBoxIcon,o as lineIcon,c as pointIcon,t as polygonIcon};
@@ -0,0 +1,28 @@
1
+ import { Point, Vector2 } from '../types';
2
+ /**
3
+ * Get point that is closest to the left browser side.
4
+ *
5
+ * @param points list of points {x,y}
6
+ * @returns {object} A list of point [{x,y}...]. Multiple points are
7
+ * returned when multiple points have the same distance to the left side.
8
+ */
9
+ export declare const getMostLeftPoints: (points: Point[]) => Point[];
10
+ /**
11
+ * Get point that is closest to the top of the browser.
12
+ *
13
+ * @param points list of points [x,y]
14
+ * @returns A list of point [[x,y]...]. Multiple points are
15
+ * returned when multiple points have the same distance to the top.
16
+ */
17
+ export declare const getTopPoint: (points: Point[]) => Point[];
18
+ declare const _default: {
19
+ convertImageCoordinatesToStage: (imageCoordinates: Point[], imageSize: Vector2, stageSize: Vector2) => Point[];
20
+ convertPercentagedCoordinatesToImage: (percentagedCoordinates: Point[], imageSize: Vector2) => Point[];
21
+ convertPercentagedCoordinatesToStage: (percentagedCoordinates: Point[], imageSize: Vector2, stageSize: Vector2) => Point[];
22
+ convertStageCoordinatesToImage: (stageCoordinates: Point[], imageToStageFactor: number) => Point[];
23
+ convertStageCoordinatesToPercentaged: (scaledCoordinates: Point[], imageToStageFactor: number, imageSize: Vector2) => Point[];
24
+ convertStageToPage: (stageCoordinates: Point, pageToStageOffset: Point, svgScale: number, svgTranslation: Vector2) => Point;
25
+ getMostLeftPoints: (points: Point[]) => Point[];
26
+ getTopPoint: (points: Point[]) => Point[];
27
+ };
28
+ export default _default;
@@ -0,0 +1 @@
1
+ const c=(r,o,t)=>{const e=t.x/o.x;return r.map(s=>({x:s.x*e,y:s.y*e}))},d=(r,o)=>r.map(e=>({x:e.x*o.x,y:e.y*o.y})),y=(r,o,t)=>{const e=d(r,o);return c(e,o,t)},x=(r,o)=>r.map(e=>({x:e.x/o,y:e.y/o})),C=(r,o,t)=>x(r,o).map(n=>(n.x<0&&(n.x=0),n.y<0&&(n.y=0),n.x>t.x&&(n.x=t.x),n.y>t.y&&(n.y=t.y),n)).map(n=>({x:n.x/t.x,y:n.y/t.y})),g=(r,o,t,e)=>{const a={x:r.x+e.x,y:r.y+e.y},s={x:a.x*t,y:a.y*t};return{x:s.x+o.x,y:s.y+o.y}},u=r=>{let o=1/0,t=[];return r.forEach(e=>{e.x<o?(o=e.x,t=[],t.push(e)):e.x===o&&t.push(e)}),t},m=r=>{let o=1/0,t=[];return r.forEach(e=>{e.y<o?(o=e.y,t=[],t.push(e)):e.y===o&&t.push(e)}),t},f={convertImageCoordinatesToStage:c,convertPercentagedCoordinatesToImage:d,convertPercentagedCoordinatesToStage:y,convertStageCoordinatesToImage:x,convertStageCoordinatesToPercentaged:C,convertStageToPage:g,getMostLeftPoints:u,getTopPoint:m};export{f as default,u as getMostLeftPoints,m as getTopPoint};
@@ -0,0 +1 @@
1
+ const i={nodeRadius:4,strokeWidth:4,annoDetails:{visible:!1},labelInfo:{visible:!1},annoStats:{visible:!1}},n=localStorage.getItem("sia-ui-config")?JSON.parse(localStorage.getItem("sia-ui-config")):i,o=(t,s)=>{Object.keys(t).forEach(e=>{const l={key:e,type:typeof t[e]};s.push(l),typeof t[e]=="object"&&o(t[e],s)})};let c=[],r=[];o(i,c);o(n,r);const a=()=>JSON.stringify(c)===JSON.stringify(r)?n:i,f=a();export{i as SIA_INITIAL_UI_CONFIG,f as uiConfig};
@@ -0,0 +1,22 @@
1
+ import { Point, Vector2 } from '../types';
2
+ declare const _default: {
3
+ getViewportCoordinates: (svgTranslation: Vector2, canvasSize: Vector2, svgScale: number, pointInViewport: Point) => {
4
+ window: {
5
+ xMin: number;
6
+ xMax: number;
7
+ yMin: number;
8
+ yMax: number;
9
+ };
10
+ viewport: {
11
+ xMin: number;
12
+ xMax: number;
13
+ yMin: number;
14
+ yMax: number;
15
+ };
16
+ vX: number;
17
+ vY: number;
18
+ scaleX: number;
19
+ scaleY: number;
20
+ };
21
+ };
22
+ export default _default;
@@ -0,0 +1 @@
1
+ const d=(y,n,o,t)=>{const x={xMin:-1*y.x,xMax:-1*y.x+n.x/o,yMin:-1*y.y,yMax:-1*y.y+n.y/o},M={xMin:0,xMax:n.x,yMin:0,yMax:n.y},i=(M.xMax-M.xMin)/(x.xMax-x.xMin),c=(M.yMax-M.yMin)/(x.yMax-x.yMin),w=M.xMin+(t.x-x.xMin)*i,e=M.yMin+(t.y-x.yMin)*c;return{window:x,viewport:M,vX:w,vY:e,scaleX:i,scaleY:c}},r={getViewportCoordinates:d};export{r as default};
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "lost-sia",
3
- "version": "2.0.1-alpha8",
3
+ "version": "3.0.0",
4
4
  "description": "Single Image Annotation Tool",
5
5
  "license": "MIT",
6
6
  "repository": "l3p-cv/lost-sia",
7
- "main": "src/index.js",
8
- "module": "src/index.js",
7
+ "main": "./dist/index.js",
8
+ "module": "./dist/index.js",
9
9
  "type": "module",
10
- "types": "src/index.d.ts",
10
+ "types": "./dist/index.d.ts",
11
11
  "keywords": [
12
12
  "lost",
13
13
  "annotation",
@@ -20,22 +20,17 @@
20
20
  },
21
21
  "exports": {
22
22
  ".": {
23
- "development": {
24
- "types": "./src/types.ts",
25
- "import": "./src/index.ts"
26
- },
27
23
  "types": "./dist/index.d.ts",
28
24
  "import": "./dist/index.js",
29
25
  "require": "./dist/index.js"
30
26
  },
31
27
  "./utils": {
32
- "development": "./src/utils/index.js",
33
28
  "types": "./dist/utils/index.d.ts",
34
29
  "import": "./dist/utils/index.js",
35
30
  "require": "./dist/utils/index.js"
36
31
  },
37
32
  "./models": {
38
- "development": "./src/models/index.js",
33
+ "bun": "./src/models/index.js",
39
34
  "types": "./dist/models/index.d.ts",
40
35
  "import": "./dist/models/index.js",
41
36
  "require": "./dist/models/index.js"
@@ -58,7 +53,8 @@
58
53
  "start": "storybook dev -p 6006",
59
54
  "storybook": "storybook dev -p 6006",
60
55
  "build-storybook": "storybook build",
61
- "format": "prettier --write src/"
56
+ "format": "prettier --write src/",
57
+ "pretty": "prettier --write \"./**/*.{js,jsx,mjs,cjs,ts,tsx,json}\""
62
58
  },
63
59
  "dependencies": {
64
60
  "@fortawesome/free-regular-svg-icons": "^6.7.2",
@@ -72,28 +68,35 @@
72
68
  "semantic-ui-react": "^2.0.3"
73
69
  },
74
70
  "peerDependencies": {
75
- "@coreui/react": "^5.7.0",
71
+ "@coreui/react": "^5.9.1",
76
72
  "prop-types": "^15.5.4",
77
73
  "react": "^18.0.0",
78
74
  "react-dom": "^18.0.0"
79
75
  },
80
76
  "devDependencies": {
77
+ "@eslint/eslintrc": "^3.3.1",
78
+ "@eslint/js": "^9.39.1",
81
79
  "@microsoft/api-extractor": "^7.52.13",
80
+ "@storybook/addon-docs": "^9.1.10",
82
81
  "@storybook/addon-links": "^9.0.12",
83
82
  "@storybook/react": "^9.0.12",
84
83
  "@storybook/react-vite": "^9.0.12",
85
84
  "@storybook/test": "9.0.0-alpha.2",
85
+ "@types/react": "^19.1.16",
86
+ "@typescript-eslint/eslint-plugin": "^8.46.1",
87
+ "@typescript-eslint/parser": "^8.46.1",
86
88
  "@vitejs/plugin-react": "^4.3.0",
87
89
  "cross-env": "^7.0.3",
88
- "eslint": "^8.0.1",
90
+ "eslint": "^9.39.1",
89
91
  "eslint-config-standard": "^17.1.0",
90
92
  "eslint-config-standard-react": "^13.0.0",
91
93
  "eslint-plugin-import": "^2.29.1",
92
94
  "eslint-plugin-node": "^11.1.0",
93
- "eslint-plugin-promise": "^6.6.0",
94
- "eslint-plugin-react": "^7.34.2",
95
+ "eslint-plugin-promise": "^7.2.1",
96
+ "eslint-plugin-react": "^7.37.5",
95
97
  "eslint-plugin-standard": "^5.0.0",
96
- "glob": "^10.4.5",
98
+ "eslint-plugin-storybook": "^10.0.7",
99
+ "glob": "^11.0.3",
97
100
  "lodash-es": "^4.17.21",
98
101
  "prettier": "^3.3.3",
99
102
  "react-redux": "^9.1.2",
@@ -1,24 +1,24 @@
1
- import Prompt from "./Prompt";
2
- import React from "react";
3
- import { Card, Image } from "semantic-ui-react";
1
+ import Prompt from './Prompt'
2
+ import React from 'react'
3
+ import { Card, Image } from 'semantic-ui-react'
4
4
 
5
5
  const LabelExampleViewer = (props) => {
6
6
  const requestExample = (e) => {
7
- e.stopPropagation();
7
+ e.stopPropagation()
8
8
  if (props.onRequestExample) {
9
- props.onRequestExample();
9
+ props.onRequestExample()
10
10
  }
11
- };
11
+ }
12
12
  const renderContent = () => {
13
- if (!props.lbl) return null;
14
- if (!props.exampleImg) return null;
13
+ if (!props.lbl) return null
14
+ if (!props.exampleImg) return null
15
15
  const description = (
16
16
  <div>
17
17
  {props.lbl.description}
18
18
  <h4>Comment:</h4>
19
- {props.exampleImg.anno ? props.exampleImg.anno.comment : "no comment"}
19
+ {props.exampleImg.anno ? props.exampleImg.anno.comment : 'no comment'}
20
20
  </div>
21
- );
21
+ )
22
22
  return (
23
23
  <div>
24
24
  <Card
@@ -46,24 +46,24 @@ const LabelExampleViewer = (props) => {
46
46
  {props.lbl.description}
47
47
  <Image src={props.exampleImg.img} centered size='medium'></Image> */}
48
48
  </div>
49
- );
50
- };
49
+ )
50
+ }
51
51
 
52
52
  const handlePromptClick = () => {
53
53
  if (props.onClose) {
54
- props.onClose();
54
+ props.onClose()
55
55
  }
56
- };
56
+ }
57
57
 
58
58
  return (
59
59
  <Prompt
60
60
  onClick={() => {
61
- handlePromptClick();
61
+ handlePromptClick()
62
62
  }}
63
63
  active={props.active}
64
64
  content={renderContent()}
65
65
  />
66
- );
67
- };
66
+ )
67
+ }
68
68
 
69
- export default LabelExampleViewer;
69
+ export default LabelExampleViewer
@@ -1,19 +1,18 @@
1
- import AnnotationMode from "../../models/AnnotationMode";
2
- import AnnotationStatus from "../../models/AnnotationStatus";
3
- import AnnotationTool from "../../models/AnnotationTool";
4
- import { Point } from "../../types";
1
+ import { AnnotationMode } from '../../models'
2
+ import AnnotationStatus from '../../models/AnnotationStatus'
3
+ import AnnotationTool from '../../models/AnnotationTool'
4
+ import { Point } from '../../types'
5
5
 
6
6
  class Annotation {
7
- internalId: number;
8
- externalId?: string;
9
- annoTime?: number;
10
- coordinates: Point[];
11
- labelIds?: number[];
12
- mode: AnnotationMode; // do we even need this globally? - only really used inside AnnotationComponent
13
- selectedNode: number;
14
- status?: AnnotationStatus;
15
- type: AnnotationTool;
16
- timestamp?: DOMHighResTimeStamp;
7
+ internalId: number
8
+ externalId?: string
9
+ annoTime: number
10
+ coordinates: Point[]
11
+ labelIds?: number[]
12
+ mode: AnnotationMode // do we even need this globally? - only really used inside AnnotationComponent
13
+ selectedNode: number
14
+ status: AnnotationStatus
15
+ type: AnnotationTool
17
16
 
18
17
  constructor(
19
18
  internalId: number,
@@ -21,19 +20,18 @@ class Annotation {
21
20
  coordinates: Point[],
22
21
  mode: AnnotationMode = AnnotationMode.CREATE,
23
22
  status: AnnotationStatus = AnnotationStatus.CREATING,
24
- externalId: string = "",
23
+ externalId: string = '',
25
24
  ) {
26
- this.internalId = internalId;
27
- this.externalId = externalId;
28
- this.labelIds = [];
29
- this.type = type;
30
- this.mode = mode;
31
- this.status = status;
32
- this.coordinates = coordinates;
33
- this.selectedNode = 1;
34
- this.timestamp = performance.now();
35
- this.annoTime = 0.0;
25
+ this.internalId = internalId
26
+ this.externalId = externalId
27
+ this.labelIds = []
28
+ this.type = type
29
+ this.mode = mode
30
+ this.status = status
31
+ this.coordinates = coordinates
32
+ this.selectedNode = 1
33
+ this.annoTime = 0
36
34
  }
37
35
  }
38
36
 
39
- export default Annotation;
37
+ export default Annotation