@3cr/viewer-browser 0.0.247 → 0.0.292

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 (519) hide show
  1. package/.circleci/config.yml +53 -0
  2. package/README.md +79 -74
  3. package/components.d.ts +94 -36
  4. package/dist/Viewer3CR.js +663 -47
  5. package/dist/Viewer3CR.mjs +108285 -37154
  6. package/dist/Viewer3CR.umd.js +663 -47
  7. package/index.html +35 -33
  8. package/package.json +27 -8
  9. package/playground/img.png +0 -0
  10. package/playground/index.html +6 -2
  11. package/src/App.vue +41 -97
  12. package/src/__tests__/app.spec.ts +2 -1
  13. package/src/__tests__/main.spec.ts +14 -14
  14. package/src/assets/_palette.scss +112 -0
  15. package/src/assets/_settings.scss +64 -0
  16. package/src/assets/_typography.scss +187 -0
  17. package/src/assets/images/cloud-storage.svg +22 -0
  18. package/src/assets/images/courtney.png +0 -0
  19. package/src/assets/images/dark/magic-wand.svg +32 -0
  20. package/src/assets/images/dark-theme.svg +33 -0
  21. package/src/assets/images/dot.svg +5 -0
  22. package/src/assets/images/dr-miles.png +0 -0
  23. package/src/assets/images/illustration.svg +118 -0
  24. package/src/assets/images/intro.svg +30 -0
  25. package/src/assets/{magic_wand.svg → images/light/magic-wand.svg} +22 -14
  26. package/src/assets/images/light-theme.svg +33 -0
  27. package/src/assets/images/system-theme.svg +51 -0
  28. package/src/assets/images/totalSegmentator.png +0 -0
  29. package/src/assets/logos/3dicom/black/black.svg +30 -0
  30. package/src/assets/logos/3dicom/colour/colour.svg +18 -0
  31. package/src/assets/logos/3dicom/colour/colour_single.svg +18 -0
  32. package/src/assets/logos/3dicom/wordmark/patients/patients.svg +29 -0
  33. package/src/assets/logos/3dicom/wordmark/powered-by/powered-by.svg +41 -0
  34. package/src/assets/logos/3dicom/wordmark/practitioners/practitioner.svg +34 -0
  35. package/src/assets/logos/3dicom/wordmark/research/research.svg +29 -0
  36. package/src/assets/logos/license/black/black.svg +22 -0
  37. package/src/assets/logos/license/white/white.svg +22 -0
  38. package/src/assets/styles.scss +435 -12
  39. package/src/components/ShFlatIconBtn.vue +36 -0
  40. package/src/components/ShPlainIconBtn.vue +42 -0
  41. package/src/components/ShSelect.vue +48 -0
  42. package/src/components/ShTextField.vue +39 -0
  43. package/src/components/ShTextarea.vue +39 -0
  44. package/src/components/__tests__/ShFlatIconBtn.spec.ts +32 -0
  45. package/src/components/__tests__/ShPlainIconBtn.spec.ts +37 -0
  46. package/src/components/__tests__/ShSelect.spec.ts +30 -0
  47. package/src/components/__tests__/ShTextField.spec.ts +30 -0
  48. package/src/components/__tests__/ShTextarea.spec.ts +30 -0
  49. package/src/components/demo/CloudDropZone.vue +105 -0
  50. package/src/components/demo/DemoAvatarDropdownMenu.vue +343 -0
  51. package/src/components/demo/DemoInfoModal.vue +60 -0
  52. package/src/components/demo/DemoNotificationNavigationDrawer.vue +118 -0
  53. package/src/components/demo/DemoPurchaseCreditsModal.vue +141 -0
  54. package/src/components/demo/DemoUpgradeCloudStorageModal.vue +74 -0
  55. package/src/components/demo/DemoUpgradePlanModal.vue +17 -0
  56. package/src/components/demo/UploadDicomToCloudModal.vue +225 -0
  57. package/src/components/demo/__tests__/CloudDropZone.spec.ts +132 -0
  58. package/src/components/demo/__tests__/DemoAvatarDropdownMenu.spec.ts +16 -0
  59. package/src/components/demo/{licence/__tests__/DemoLicenceEnableCloudStorageModal.spec.ts → __tests__/DemoEnableCloudStorageModal.spec.ts} +11 -11
  60. package/src/components/demo/{licence/__tests__/DemoLicenceInfoModal.spec.ts → __tests__/DemoInfoModal.spec.ts} +11 -8
  61. package/src/components/demo/__tests__/DemoNotificationNavigationDrawer.spec.ts +56 -0
  62. package/src/components/demo/__tests__/UploadDicomToCloudModal.spec.ts +320 -0
  63. package/src/components/demo/__tests__/demo-payload.spec.ts +10 -0
  64. package/src/components/demo/demo-notifications.ts +45 -0
  65. package/src/components/demo/demo-payload.ts +9 -0
  66. package/src/components/demo/fileReader.ts +47 -0
  67. package/src/{composables/useViewerOptions.ts → components/demo/mockDemoViewerStlDecimator.ts} +8 -12
  68. package/src/components/intro/ViewerIntro.vue +56 -0
  69. package/src/components/intro/ViewerTour.vue +53 -0
  70. package/src/components/intro/tour/Tour.vue +205 -0
  71. package/src/components/intro/tour/step.ts +6 -0
  72. package/src/components/modal/ActionRail.vue +4 -0
  73. package/src/components/modal/Viewer3cr.vue +224 -0
  74. package/src/components/modal/Viewer3crWebGL.vue +65 -0
  75. package/src/components/modal/ViewerActionRail.vue +10 -27
  76. package/src/components/modal/ViewerMain.vue +83 -0
  77. package/src/components/modal/ViewerNavigationDrawer.vue +269 -68
  78. package/src/components/modal/ViewerScanView.vue +223 -67
  79. package/src/components/modal/__tests__/{MftpWebGL3DRModal.spec.ts → Viewer3cr.spec.ts} +154 -53
  80. package/src/components/modal/__tests__/{WebGL3DR.spec.ts → Viewer3crWebGL.spec.ts} +11 -11
  81. package/src/components/modal/__tests__/ViewerNavigationDrawer.spec.ts +271 -11
  82. package/src/components/modal/__tests__/ViewerScanView.spec.ts +15 -7
  83. package/src/components/modal/actions/Action.vue +3 -8
  84. package/src/components/modal/actions/Flip3dAction.vue +31 -16
  85. package/src/components/modal/actions/FlipHorizontalAction.vue +14 -5
  86. package/src/components/modal/actions/FlipVerticalAction.vue +14 -5
  87. package/src/components/modal/actions/FullscreenAction.vue +9 -5
  88. package/src/components/modal/actions/PanAction.vue +11 -51
  89. package/src/components/modal/actions/ResetViewAction.vue +10 -8
  90. package/src/components/modal/actions/Rotate2dAction.vue +25 -15
  91. package/src/components/modal/actions/Slice3dAction.vue +22 -10
  92. package/src/components/modal/actions/ZoomAction.vue +21 -13
  93. package/src/components/modal/actions/__tests__/Action.spec.ts +2 -2
  94. package/src/components/modal/actions/__tests__/Flip3dAction.spec.ts +58 -14
  95. package/src/components/modal/actions/__tests__/FlipHorizontalAction.spec.ts +15 -5
  96. package/src/components/modal/actions/__tests__/FlipVerticalAction.spec.ts +15 -5
  97. package/src/components/modal/actions/__tests__/FullscreenAction.spec.ts +7 -5
  98. package/src/components/modal/actions/__tests__/PanAction.spec.ts +13 -32
  99. package/src/components/modal/actions/__tests__/ResetViewAction.spec.ts +5 -3
  100. package/src/components/modal/actions/__tests__/Rotate2dAction.spec.ts +13 -6
  101. package/src/components/modal/actions/__tests__/Slice3dAction.spec.ts +1 -1
  102. package/src/components/modal/actions/__tests__/ZoomAction.spec.ts +25 -11
  103. package/src/components/modal/app-bars/ViewerActionBar.vue +224 -0
  104. package/src/components/modal/app-bars/ViewerAppBar.vue +126 -0
  105. package/src/components/modal/app-bars/__tests__/ViewerActionBar.spec.ts +176 -0
  106. package/src/components/modal/app-bars/__tests__/ViewerAppBar.spec.ts +99 -0
  107. package/src/components/modal/layouts/Layout1x3ClipPath.vue +35 -0
  108. package/src/components/modal/layouts/Layout2x2ClipPath.vue +35 -0
  109. package/src/components/modal/layouts/LayoutFullscreenClipPath.vue +29 -0
  110. package/src/components/modal/layouts/__tests__/Layout1x3ClipPath.spec.ts +15 -0
  111. package/src/components/modal/layouts/__tests__/Layout2x2ClipPath.spec.ts +15 -0
  112. package/src/components/modal/layouts/__tests__/LayoutFullscreenClipPath.spec.ts +15 -0
  113. package/src/components/modal/layouts/composables/__tests__/useLayout1x3.spec.ts +40 -0
  114. package/src/components/modal/layouts/composables/__tests__/useLayout2x2.spec.ts +40 -0
  115. package/src/components/modal/layouts/composables/__tests__/useLayoutFullscreen.spec.ts +40 -0
  116. package/src/components/modal/layouts/composables/useLayout1x3.ts +46 -0
  117. package/src/components/modal/layouts/composables/useLayout2x2.ts +46 -0
  118. package/src/components/modal/layouts/composables/useLayoutFullscreen.ts +24 -0
  119. package/src/components/modal/menus/AutoAnnotateMenu.vue +67 -0
  120. package/src/components/modal/menus/AvatarDropdownMenu.vue +66 -0
  121. package/src/components/modal/menus/HelpMenu.vue +47 -0
  122. package/src/components/modal/menus/SettingsMenu.vue +242 -92
  123. package/src/components/modal/menus/ShareMenu.vue +58 -0
  124. package/src/components/modal/menus/__tests__/AutoAnnotateMenu.spec.ts +80 -0
  125. package/src/components/modal/menus/__tests__/AvatarDropdownMenu.spec.ts +49 -0
  126. package/src/components/modal/menus/__tests__/HelpMenu.spec.ts +12 -0
  127. package/src/components/modal/menus/__tests__/SettingsMenu.spec.ts +163 -57
  128. package/src/components/modal/modal/AboutModal.vue +61 -0
  129. package/src/components/modal/modal/AiModelList.vue +70 -0
  130. package/src/components/modal/{AskAI.vue → modal/AskAiModal.vue} +26 -34
  131. package/src/components/modal/modal/AutoAnnotateModal.vue +136 -0
  132. package/src/components/modal/modal/CloseViewerModal.vue +108 -0
  133. package/src/components/modal/modal/DataOverlayGeneralModal.vue +122 -0
  134. package/src/components/modal/modal/DataOverlayMeasurementModal.vue +59 -0
  135. package/src/components/modal/modal/DataOverlayModal.vue +121 -0
  136. package/src/components/modal/modal/ShareModal.vue +201 -0
  137. package/src/components/modal/modal/UploadsDrawer.vue +165 -0
  138. package/src/components/modal/modal/WhatsNewModal.vue +45 -0
  139. package/src/components/modal/modal/__tests__/AboutModal.spec.ts +60 -0
  140. package/src/components/modal/modal/__tests__/AiModelList.spec.ts +50 -0
  141. package/src/components/modal/{__tests__ → modal/__tests__}/AskAI.spec.ts +8 -7
  142. package/src/components/modal/modal/__tests__/AutoAnnotateModal.spec.ts +29 -0
  143. package/src/components/modal/modal/__tests__/CloseViewerModal.spec.ts +60 -0
  144. package/src/components/modal/modal/__tests__/DataOverlayGeneralModal.spec.ts +55 -0
  145. package/src/components/modal/modal/__tests__/DataOverlayMeasurementModal.spec.ts +82 -0
  146. package/src/components/modal/modal/__tests__/DataOverlayModal.spec.ts +94 -0
  147. package/src/components/modal/modal/__tests__/ShareModal.spec.ts +262 -0
  148. package/src/components/modal/modal/__tests__/UploadsDrawer.spec.ts +174 -0
  149. package/src/components/modal/modal/__tests__/WhatsNewModal.spec.ts +29 -0
  150. package/src/components/modal/snackbars/AnnotationGeneratedSnackbar.vue +34 -0
  151. package/src/components/modal/snackbars/ImagesSharedSnackbar.vue +26 -0
  152. package/src/components/modal/snackbars/LinkCopiedSnackbar.vue +26 -0
  153. package/src/components/modal/snackbars/__tests__/AnnotationGeneratedSnackbar.spec.ts +43 -0
  154. package/src/components/modal/snackbars/__tests__/ImagesSharedSnackbar.spec.ts +22 -0
  155. package/src/components/modal/snackbars/__tests__/LinkCopiedSnackbar.spec.ts +21 -0
  156. package/src/components/navigation/annotation/AnnotationCreateModal.vue +114 -0
  157. package/src/components/navigation/annotation/AnnotationCreateSnackbar.vue +20 -0
  158. package/src/components/navigation/annotation/AnnotationDataTable.vue +157 -0
  159. package/src/components/navigation/annotation/AnnotationDeleteModal.vue +48 -0
  160. package/src/components/navigation/annotation/AnnotationDeleteSnackbar.vue +25 -0
  161. package/src/components/navigation/annotation/AnnotationForm.vue +277 -0
  162. package/src/components/navigation/annotation/AnnotationIcon.vue +45 -0
  163. package/src/components/navigation/annotation/AnnotationInfo.vue +141 -0
  164. package/src/components/navigation/annotation/AnnotationMenu.vue +99 -0
  165. package/src/components/navigation/annotation/AnnotationPanel.vue +30 -0
  166. package/src/components/navigation/annotation/AnnotationTools.vue +104 -0
  167. package/src/components/navigation/annotation/AnnotationUpdateModal.vue +78 -0
  168. package/src/components/navigation/annotation/AnnotationVisibilityBtn.vue +52 -0
  169. package/src/components/navigation/annotation/DrawerTitle.vue +25 -0
  170. package/src/components/navigation/annotation/__tests__/AnnotationCreateModal.spec.ts +178 -0
  171. package/src/components/navigation/annotation/__tests__/AnnotationCreateSnackbar.spec.ts +31 -0
  172. package/src/components/navigation/annotation/__tests__/AnnotationDataTable.spec.ts +79 -0
  173. package/src/components/navigation/annotation/__tests__/AnnotationDeleteSnackbar.spec.ts +66 -0
  174. package/src/components/navigation/annotation/__tests__/AnnotationForm.spec.ts +261 -0
  175. package/src/components/navigation/annotation/__tests__/AnnotationIcon.spec.ts +13 -0
  176. package/src/components/navigation/annotation/__tests__/AnnotationTools.spec.ts +116 -0
  177. package/src/components/navigation/display/DisplayPanel.vue +156 -0
  178. package/src/components/{views/__tests__/DisplaySettings.spec.ts → navigation/display/__tests__/DisplayPanel.spec.ts} +14 -3
  179. package/src/components/navigation/history/HistoryModal.vue +140 -0
  180. package/src/components/navigation/mcad/McadAddObjectBtn.vue +41 -0
  181. package/src/components/navigation/mcad/McadDataTable.vue +78 -0
  182. package/src/components/navigation/mcad/McadDataTableItems.vue +382 -0
  183. package/src/components/navigation/mcad/McadDeleteModal.vue +44 -0
  184. package/src/components/navigation/mcad/McadDropZone.vue +148 -0
  185. package/src/components/navigation/mcad/McadFloating.vue +193 -0
  186. package/src/components/navigation/mcad/McadIcon.vue +34 -0
  187. package/src/components/navigation/mcad/McadInvert.vue +91 -0
  188. package/src/components/navigation/mcad/McadLockBtn.vue +62 -0
  189. package/src/components/navigation/mcad/McadMenu.vue +248 -0
  190. package/src/components/navigation/mcad/McadOpacity.vue +79 -0
  191. package/src/components/navigation/mcad/McadPanel.vue +31 -0
  192. package/src/components/navigation/mcad/McadToggleSortBtn.vue +18 -0
  193. package/src/components/navigation/mcad/McadToggleVisibilityBtn.vue +46 -0
  194. package/src/components/navigation/mcad/McadUpdateModal.vue +108 -0
  195. package/src/components/navigation/mcad/McadVisibilityBtn.vue +46 -0
  196. package/src/components/navigation/mcad/__tests__/McadAddObjectBtn.spec.ts +73 -0
  197. package/src/components/navigation/mcad/__tests__/McadDataTable.spec.ts +27 -0
  198. package/src/components/navigation/mcad/__tests__/McadDataTableItems.spec.ts +621 -0
  199. package/src/components/navigation/mcad/__tests__/McadDeleteModal.spec.ts +67 -0
  200. package/src/components/navigation/mcad/__tests__/McadDropZone.spec.ts +109 -0
  201. package/src/components/navigation/mcad/__tests__/McadIcon.spec.ts +13 -0
  202. package/src/components/navigation/mcad/__tests__/McadInvert.spec.ts +45 -0
  203. package/src/components/navigation/mcad/__tests__/McadLockBtn.spec.ts +38 -0
  204. package/src/components/navigation/mcad/__tests__/McadMenu.spec.ts +258 -0
  205. package/src/components/navigation/mcad/__tests__/McadOpacity.spec.ts +68 -0
  206. package/src/components/navigation/mcad/__tests__/McadToggleSortBtn.spec.ts +36 -0
  207. package/src/components/navigation/mcad/__tests__/McadToggleVisibilityBtn.spec.ts +53 -0
  208. package/src/components/navigation/mcad/__tests__/McadUpdateModal.spec.ts +122 -0
  209. package/src/components/navigation/mcad/__tests__/McadVisibilityBtn.spec.ts +45 -0
  210. package/src/components/navigation/measurement/MeasurementAngleSnackbar.vue +18 -0
  211. package/src/components/navigation/measurement/MeasurementDataTable.vue +162 -0
  212. package/src/components/navigation/measurement/MeasurementDeleteModal.vue +49 -0
  213. package/src/components/navigation/measurement/MeasurementDeleteSnackbar.vue +40 -0
  214. package/src/components/navigation/measurement/MeasurementIcon.vue +41 -0
  215. package/src/components/navigation/measurement/MeasurementInfo.vue +25 -0
  216. package/src/components/navigation/measurement/MeasurementInfoAngle.vue +36 -0
  217. package/src/components/navigation/measurement/MeasurementInfoLength.vue +37 -0
  218. package/src/components/navigation/measurement/MeasurementInfoPolygon.vue +58 -0
  219. package/src/components/navigation/measurement/MeasurementLengthSnackbar.vue +18 -0
  220. package/src/components/navigation/measurement/MeasurementMenu.vue +97 -0
  221. package/src/components/navigation/measurement/MeasurementPanel.vue +30 -0
  222. package/src/components/navigation/measurement/MeasurementPolygonSnackbar.vue +18 -0
  223. package/src/components/navigation/measurement/MeasurementTools.vue +101 -0
  224. package/src/components/navigation/measurement/MeasurementVisibilityBtn.vue +53 -0
  225. package/src/components/navigation/measurement/__tests__/MeasurementAngleSnackbar.spec.ts +34 -0
  226. package/src/components/navigation/measurement/__tests__/MeasurementDataTable.spec.ts +79 -0
  227. package/src/components/navigation/measurement/__tests__/MeasurementDeleteSnackbar.spec.ts +51 -0
  228. package/src/components/navigation/measurement/__tests__/MeasurementInfo.spec.ts +77 -0
  229. package/src/components/navigation/measurement/__tests__/MeasurementLengthSnackbar.spec.ts +35 -0
  230. package/src/components/navigation/measurement/__tests__/MeasurementPolygonSnackbar.spec.ts +35 -0
  231. package/src/components/navigation/measurement/__tests__/MeasurementTools.spec.ts +87 -0
  232. package/src/components/shared/ColourPalette.vue +72 -0
  233. package/src/components/shared/DoubleSliderSelector.vue +66 -28
  234. package/src/components/shared/HorizontalSliderSelector.vue +80 -0
  235. package/src/components/shared/KeyboardShortcuts.vue +184 -0
  236. package/src/components/shared/LoadingSpinner.vue +508 -144
  237. package/src/components/shared/MultiLoginError.vue +98 -0
  238. package/src/components/shared/NotificationToaster.vue +112 -0
  239. package/src/components/shared/UpdateSnackbar.vue +22 -9
  240. package/src/components/shared/ValueSelector.vue +10 -10
  241. package/src/components/shared/VerticalSliderSelector.vue +45 -44
  242. package/src/components/shared/__tests__/ColourPalette.spec.ts +21 -0
  243. package/src/components/shared/__tests__/DoubleSliderSelector.spec.ts +58 -46
  244. package/src/components/shared/__tests__/HorizontalSliderSelector.spec.ts +35 -0
  245. package/src/components/shared/__tests__/KeyboardShortcuts.spec.ts +50 -0
  246. package/src/components/shared/__tests__/MultiLoginError.spec.ts +50 -0
  247. package/src/components/shared/__tests__/NotificationToaster.spec.ts +65 -0
  248. package/src/components/shared/__tests__/UpdateSnackbar.spec.ts +7 -7
  249. package/src/components/shared/__tests__/ValueSelector.spec.ts +6 -0
  250. package/src/composables/__tests__/useDebounce.spec.ts +17 -0
  251. package/src/composables/__tests__/useMovingAverage.spec.ts +40 -0
  252. package/src/composables/__tests__/useNavigationCube.spec.ts +79 -0
  253. package/src/{functions/__tests__/notification.spec.ts → composables/__tests__/useNotificationHandler.spec.ts} +74 -17
  254. package/src/composables/__tests__/useToolGroup.spec.ts +41 -0
  255. package/src/composables/__tests__/useViewName.spec.ts +29 -0
  256. package/src/composables/useBoundingBox.ts +32 -0
  257. package/src/composables/useEventListener.ts +7 -9
  258. package/src/composables/useMedia.ts +27 -0
  259. package/src/composables/useNavigationCube.ts +80 -0
  260. package/src/composables/useNotificationHandler.ts +82 -0
  261. package/src/composables/useResizeObserver.ts +31 -0
  262. package/src/composables/useToolGroup.ts +36 -0
  263. package/src/composables/useViewName.ts +34 -0
  264. package/src/composables/useViewer3cr.ts +3 -2
  265. package/src/config.ts +1 -1
  266. package/src/constants.ts +8 -0
  267. package/src/functions/HotkeyScope.ts +87 -0
  268. package/src/functions/__tests__/HotkeyScope.spec.ts +49 -0
  269. package/src/functions/__tests__/colours.spec.ts +42 -0
  270. package/src/functions/__tests__/fileReader.spec.ts +130 -0
  271. package/src/functions/__tests__/modelHelper.spec.ts +1 -0
  272. package/src/functions/__tests__/tsHelper.spec.ts +7 -0
  273. package/src/functions/chunker.ts +21 -0
  274. package/src/functions/colours.ts +45 -0
  275. package/src/functions/fileReader.ts +48 -0
  276. package/src/functions/guards/__tests__/isDataOverlayAngle.spec.ts +21 -0
  277. package/src/functions/guards/__tests__/isDataOverlayLength.spec.ts +21 -0
  278. package/src/functions/guards/__tests__/isDataOverlayPolygon.spec.ts +21 -0
  279. package/src/functions/guards/isDataOverlayAngle.ts +3 -4
  280. package/src/functions/guards/isDataOverlayLength.ts +3 -4
  281. package/src/functions/guards/isDataOverlayPolygon.ts +3 -4
  282. package/src/functions/openUrl.ts +3 -0
  283. package/src/functions/{__tests__ → parsers/__tests__}/parseAction.spec.ts +1 -1
  284. package/src/functions/{__tests__ → parsers/__tests__}/parseCallToAction.spec.ts +1 -1
  285. package/src/functions/{__tests__ → parsers/__tests__}/parseDataOverlay.spec.ts +1 -1
  286. package/src/functions/{__tests__ → parsers/__tests__}/parseDataOverlayData.spec.ts +1 -1
  287. package/src/functions/{__tests__ → parsers/__tests__}/parseDataOverlayEvent.spec.ts +3 -3
  288. package/src/functions/{__tests__ → parsers/__tests__}/parseMcadEvent.spec.ts +3 -3
  289. package/src/functions/{parseAction.ts → parsers/parseAction.ts} +1 -2
  290. package/src/functions/{parseCallToAction.ts → parsers/parseCallToAction.ts} +2 -2
  291. package/src/functions/{parseDataOverlay.ts → parsers/parseDataOverlay.ts} +3 -3
  292. package/src/functions/parsers/parseDataOverlayData.ts +9 -0
  293. package/src/functions/parsers/parseDataOverlayEvent.ts +19 -0
  294. package/src/functions/parsers/parseMcadEvent.ts +9 -0
  295. package/src/functions/platform.ts +7 -0
  296. package/src/functions/translateTooltipShortcut.ts +35 -0
  297. package/src/functions/tsHelper.ts +3 -0
  298. package/src/main.ts +68 -43
  299. package/src/models/__tests__/iso-languages.spec.ts +23 -0
  300. package/src/models/__tests__/scanState.spec.ts +14 -38
  301. package/src/models/iso-languages.ts +1609 -0
  302. package/src/models/progress.ts +23 -0
  303. package/src/models/scanState.ts +56 -100
  304. package/src/plugins/__tests__/pinia.spec.ts +7 -0
  305. package/src/plugins/__tests__/vue-i18n.spec.ts +7 -0
  306. package/src/plugins/__tests__/vuetify.spec.ts +3 -3
  307. package/src/plugins/locales/en.json +442 -0
  308. package/src/plugins/material-symbols/aliases.ts +43 -0
  309. package/src/plugins/material-symbols/material-symbols-filled.ts +11 -0
  310. package/src/plugins/material-symbols/material-symbols-outlined.ts +9 -0
  311. package/src/plugins/pinia.ts +3 -0
  312. package/src/plugins/vue-i18n.ts +9 -0
  313. package/src/plugins/vuetify.ts +157 -25
  314. package/src/services/__tests__/features.service.spec.ts +14 -0
  315. package/src/services/__tests__/gpt.service.spec.ts +64 -3
  316. package/src/services/__tests__/viewer-3cr.service.spec.ts +616 -192
  317. package/src/services/features.service.ts +32 -0
  318. package/src/services/gpt.service.ts +5 -2
  319. package/src/services/viewer-3cr.service.ts +374 -307
  320. package/src/stores/__tests__/data-overlay.store.spec.ts +92 -0
  321. package/src/stores/__tests__/demo.store.spec.ts +196 -0
  322. package/src/stores/__tests__/drawer.store.spec.ts +27 -0
  323. package/src/stores/__tests__/intro.store.spec.ts +102 -0
  324. package/src/stores/__tests__/language.store.spec.ts +83 -0
  325. package/src/stores/__tests__/mcad-floating.store.spec.ts +339 -0
  326. package/src/stores/__tests__/mcad.store.spec.ts +88 -0
  327. package/src/stores/__tests__/save.store.spec.ts +51 -0
  328. package/src/stores/__tests__/theme.store.spec.ts +18 -0
  329. package/src/stores/__tests__/tool.store.spec.ts +53 -0
  330. package/src/stores/__tests__/upload.store.spec.ts +19 -0
  331. package/src/stores/__tests__/viewer.store.spec.ts +20 -0
  332. package/src/stores/data-overlay.store.ts +93 -0
  333. package/src/stores/demo.store.ts +284 -0
  334. package/src/stores/drawer.store.ts +23 -0
  335. package/src/stores/intro.store.ts +35 -0
  336. package/src/stores/language.store.ts +59 -0
  337. package/src/stores/mcad-floating.store.ts +141 -0
  338. package/src/stores/mcad.store.ts +53 -0
  339. package/src/stores/save.store.ts +59 -0
  340. package/src/stores/theme.store.ts +45 -0
  341. package/src/stores/tool.store.ts +41 -0
  342. package/src/stores/upload.store.ts +19 -0
  343. package/src/stores/viewer.store.ts +34 -0
  344. package/src/tools/__tests__/annotation-create.tool.spec.ts +90 -0
  345. package/src/tools/__tests__/annotation-move.tool.spec.ts +107 -0
  346. package/src/tools/__tests__/data-overlay.tool.spec.ts +127 -0
  347. package/src/tools/__tests__/mcad-move.tool.spec.ts +106 -0
  348. package/src/tools/__tests__/mcad-rotate.tool.spec.ts +103 -0
  349. package/src/tools/__tests__/mcad-scale.tool.spec.ts +8 -0
  350. package/src/tools/__tests__/mcad-select.tool.spec.ts +63 -0
  351. package/src/tools/__tests__/measurement-angle.tool.spec.ts +26 -0
  352. package/src/tools/__tests__/measurement-length.tool.spec.ts +26 -0
  353. package/src/tools/__tests__/measurement-polygon.tool.spec.ts +26 -0
  354. package/src/tools/annotation-create.tool.ts +48 -0
  355. package/src/tools/annotation-move.tool.ts +48 -0
  356. package/src/tools/data-overlay.tool.ts +45 -48
  357. package/src/tools/mcad-move.tool.ts +47 -0
  358. package/src/tools/mcad-rotate.tool.ts +47 -0
  359. package/src/tools/mcad-scale-tool.ts +10 -0
  360. package/src/tools/mcad-select-tool.ts +32 -0
  361. package/src/tools/measurement-angle.tool.ts +20 -0
  362. package/src/tools/measurement-length.tool.ts +20 -0
  363. package/src/tools/measurement-polygon.tool.ts +20 -0
  364. package/src/types/feature.ts +6 -0
  365. package/src/types/viewer-tool.ts +5 -0
  366. package/test/MockImportOriginal.ts +7 -0
  367. package/test/assertions/beTypeOrNull.ts +24 -0
  368. package/test/fakers/action-data.faker.ts +1 -1
  369. package/test/fakers/action.faker.ts +1 -1
  370. package/test/fakers/call-to-action.faker.ts +1 -1
  371. package/test/fakers/data-overlay-angle.faker.ts +1 -1
  372. package/test/fakers/data-overlay-annotation.faker.ts +1 -1
  373. package/test/fakers/data-overlay-data.faker.ts +18 -15
  374. package/test/fakers/data-overlay-interaction.faker.ts +25 -17
  375. package/test/fakers/data-overlay-length.faker.ts +1 -1
  376. package/test/fakers/data-overlay-mcad.faker.ts +4 -3
  377. package/test/fakers/data-overlay-polygon.faker.ts +1 -1
  378. package/test/fakers/feature.faker.ts +13 -0
  379. package/test/fakers/file.faker.ts +11 -0
  380. package/test/fakers/gpt-question.faker.ts +1 -1
  381. package/test/fakers/gpt-response.faker.ts +1 -1
  382. package/test/fakers/mcad-object-interaction.faker.ts +4 -4
  383. package/test/fakers/orientation.faker.ts +1 -1
  384. package/test/fakers/segment-angle.faker.ts +1 -1
  385. package/test/fakers/upload.faker.ts +14 -0
  386. package/test/getAnimationFrame.ts +3 -0
  387. package/test/plugins/findByTestId.ts +13 -6
  388. package/test/plugins/pinia.ts +20 -0
  389. package/test/plugins/vitest.d.ts +8 -0
  390. package/test/plugins/vue-i18n.ts +22 -0
  391. package/test/plugins/vuetify.ts +10 -0
  392. package/test/setup.ts +37 -12
  393. package/tsconfig.json +1 -1
  394. package/vite.config.mts +48 -18
  395. package/vitest.config.mts +12 -3
  396. package/src/assets/images/MainBackdrop.svg +0 -48
  397. package/src/assets/images/dark/Singular-Health-Disc-Mono.svg +0 -9
  398. package/src/assets/images/dark/demo-icon-small.png +0 -0
  399. package/src/assets/images/dark/demo-logo-small.svg +0 -27
  400. package/src/assets/images/dark/demo-logo.svg +0 -1
  401. package/src/assets/images/light/Singular-Health-Disc-Mono.svg +0 -9
  402. package/src/assets/logos/3dicom/white-mini.svg +0 -20
  403. package/src/components/demo/DemoModal.vue +0 -44
  404. package/src/components/demo/DemoPatientModal.vue +0 -52
  405. package/src/components/demo/__tests__/DemoModal.spec.ts +0 -26
  406. package/src/components/demo/__tests__/DemoPatientModal.spec.ts +0 -38
  407. package/src/components/demo/__tests__/options.spec.ts +0 -25
  408. package/src/components/demo/licence/DemoLicenceEnableCloudStorageModal.vue +0 -64
  409. package/src/components/demo/licence/DemoLicenceInfoModal.vue +0 -49
  410. package/src/components/demo/licence/DemoLicenceSendToPartyModal.vue +0 -178
  411. package/src/components/demo/licence/DemoLicenceShareToMobileModal.vue +0 -102
  412. package/src/components/demo/licence/__tests__/DemoLicenceSendToPartyModal.spec.ts +0 -36
  413. package/src/components/demo/licence/__tests__/DemoLicenceShareToMobileModal.spec.ts +0 -52
  414. package/src/components/demo/options.ts +0 -170
  415. package/src/components/demo/patient/DemoPatientEnableCloudStorageModal.vue +0 -64
  416. package/src/components/demo/patient/DemoPatientInfoModal.vue +0 -49
  417. package/src/components/demo/patient/DemoPatientSendToPartyModal.vue +0 -177
  418. package/src/components/demo/patient/DemoPatientShareToMobileModal.vue +0 -102
  419. package/src/components/demo/patient/__tests__/DemoPatientEnableCloudStorageModal.spec.ts +0 -38
  420. package/src/components/demo/patient/__tests__/DemoPatientInfoModal.spec.ts +0 -38
  421. package/src/components/demo/patient/__tests__/DemoPatientSendToPartyModal.spec.ts +0 -36
  422. package/src/components/demo/patient/__tests__/DemoPatientShareToMobileModal.spec.ts +0 -52
  423. package/src/components/modal/CloseViewerModal.vue +0 -69
  424. package/src/components/modal/MftpWebGL3DRModal.vue +0 -336
  425. package/src/components/modal/ViewerNavigationDrawerContent.vue +0 -168
  426. package/src/components/modal/ViewerNavigationDrawerFooter.vue +0 -131
  427. package/src/components/modal/ViewerNavigationDrawerHeader.vue +0 -33
  428. package/src/components/modal/WebGL3DR.vue +0 -91
  429. package/src/components/modal/__tests__/CloseViewerModal.spec.ts +0 -70
  430. package/src/components/modal/__tests__/ViewerNavigationDrawerContent.spec.ts +0 -11
  431. package/src/components/modal/__tests__/ViewerNavigationDrawerFooter.spec.ts +0 -46
  432. package/src/components/modal/__tests__/ViewerNavigationDrawerHeader.spec.ts +0 -40
  433. package/src/components/modal/actions/NavigationCubeAction.vue +0 -26
  434. package/src/components/modal/actions/__tests__/NavigationCubeAction.spec.ts +0 -25
  435. package/src/components/modal/buttons/AutoAnnotateBtn.vue +0 -197
  436. package/src/components/modal/buttons/__tests__/AutoAnnotateBtn.spec.ts +0 -28
  437. package/src/components/modal/menus/FileMenu.vue +0 -73
  438. package/src/components/modal/menus/__tests__/FileMenu.spec.ts +0 -110
  439. package/src/components/navigation/mcad/McadGlobalActions.vue +0 -20
  440. package/src/components/navigation/mcad/McadGlobalOpacitySlider.vue +0 -103
  441. package/src/components/navigation/mcad/McadGlobalScanViewBtn.vue +0 -28
  442. package/src/components/navigation/mcad/McadGlobalVisibilityBtn.vue +0 -38
  443. package/src/components/views/AnnotationTreeView.vue +0 -236
  444. package/src/components/views/DisplaySettings.vue +0 -94
  445. package/src/components/views/MarkupTreeView.vue +0 -201
  446. package/src/components/views/McadObjectTreeView.vue +0 -129
  447. package/src/components/views/__tests__/AnnotationTreeView.spec.ts +0 -62
  448. package/src/components/views/__tests__/MarkupTreeView.spec.ts +0 -41
  449. package/src/components/views/__tests__/McadObjectTreeView.spec.ts +0 -47
  450. package/src/components/views/modals/DataOverlayGeneralModal.vue +0 -71
  451. package/src/components/views/modals/DataOverlayMarkupModal.vue +0 -60
  452. package/src/components/views/modals/DataOverlayModal.vue +0 -88
  453. package/src/components/views/shared/MaskIcon.vue +0 -44
  454. package/src/components/views/shared/ObjectColor.vue +0 -31
  455. package/src/components/views/shared/ObjectLabel.vue +0 -30
  456. package/src/components/views/shared/Opacity.vue +0 -65
  457. package/src/components/views/shared/VisibilityBtn.vue +0 -25
  458. package/src/components/views/shared/__tests__/MaskIcon.spec.ts +0 -10
  459. package/src/components/views/shared/__tests__/ObjectColor.spec.ts +0 -10
  460. package/src/components/views/shared/__tests__/ObjectLabel.spec.ts +0 -10
  461. package/src/components/views/shared/__tests__/Opacity.spec.ts +0 -24
  462. package/src/components/views/shared/__tests__/VisibilityBtn.spec.ts +0 -11
  463. package/src/components/views/types/annotation-tree-view-item-child-action.ts +0 -6
  464. package/src/components/views/types/annotation-tree-view-item-child.ts +0 -9
  465. package/src/components/views/types/annotation-tree-view-item.ts +0 -13
  466. package/src/components/views/types/markup-tree-view-item-child.ts +0 -6
  467. package/src/components/views/types/markup-tree-view-item.ts +0 -14
  468. package/src/components/views/types/mcad-object-tree-view-item.ts +0 -13
  469. package/src/composables/__tests__/useAnnotations.spec.ts +0 -35
  470. package/src/composables/__tests__/useIntroJs.spec.ts +0 -51
  471. package/src/composables/__tests__/useMarkups.spec.ts +0 -39
  472. package/src/composables/__tests__/useMcadObjects.spec.ts +0 -36
  473. package/src/composables/__tests__/useNavigationCubeObserver.spec.ts +0 -61
  474. package/src/composables/useAnnotations.ts +0 -37
  475. package/src/composables/useIntroJs.ts +0 -142
  476. package/src/composables/useMarkups.ts +0 -41
  477. package/src/composables/useMcadObjects.ts +0 -32
  478. package/src/composables/useNavigationCubeObserver.ts +0 -114
  479. package/src/composables/useVersion3cr.ts +0 -7
  480. package/src/functions/__tests__/layoutOverlayStyle.spec.ts +0 -325
  481. package/src/functions/layoutOverlayStyle.ts +0 -84
  482. package/src/functions/notification.ts +0 -82
  483. package/src/functions/parseDataOverlayData.ts +0 -10
  484. package/src/functions/parseDataOverlayEvent.ts +0 -17
  485. package/src/functions/parseMcadEvent.ts +0 -10
  486. package/src/functions/rgbaToCss.ts +0 -13
  487. package/src/models/__tests__/loadViewerOptions.spec.ts +0 -72
  488. package/src/models/__tests__/loadViewerPayload.spec.ts +0 -10
  489. package/src/models/callbacks.ts +0 -4
  490. package/src/models/loadViewerOptions.ts +0 -79
  491. package/src/models/loadViewerPayload.ts +0 -17
  492. package/src/plugins/__tests__/usePlugins.spec.ts +0 -12
  493. package/src/plugins/usePlugins.ts +0 -8
  494. package/src/types/action-data.ts +0 -4
  495. package/src/types/action.ts +0 -13
  496. package/src/types/call-to-action.ts +0 -9
  497. package/src/types/colour.ts +0 -6
  498. package/src/types/data-overlay-angle.ts +0 -16
  499. package/src/types/data-overlay-annotation.ts +0 -18
  500. package/src/types/data-overlay-data.ts +0 -15
  501. package/src/types/data-overlay-event.ts +0 -5
  502. package/src/types/data-overlay-info.ts +0 -18
  503. package/src/types/data-overlay-interaction.ts +0 -15
  504. package/src/types/data-overlay-length.ts +0 -16
  505. package/src/types/data-overlay-markup.ts +0 -7
  506. package/src/types/data-overlay-mcad.ts +0 -20
  507. package/src/types/data-overlay-polygon.ts +0 -18
  508. package/src/types/data-overlay.ts +0 -16
  509. package/src/types/demo-type.ts +0 -4
  510. package/src/types/gpt-question.ts +0 -4
  511. package/src/types/gpt-response-payload.ts +0 -6
  512. package/src/types/mcad-object-interaction.ts +0 -15
  513. package/src/types/segment-angle.ts +0 -5
  514. package/src/types/vector2.ts +0 -4
  515. package/src/types/vector3.ts +0 -5
  516. package/test/fakers/data-overlay-info.faker.ts +0 -29
  517. /package/src/assets/logos/3dicom/{white.svg → white/white.svg} +0 -0
  518. /package/src/assets/{images/light/Singular-Health-Trademark-mono.svg → logos/singular-health/black/black.svg} +0 -0
  519. /package/src/assets/{images/dark/Singular-Health-Trademark-mono.svg → logos/singular-health/white/white.svg} +0 -0
@@ -0,0 +1,50 @@
1
+ import KeyboardShortcuts from '@/components/shared/KeyboardShortcuts.vue';
2
+ import { mount } from '@vue/test-utils';
3
+ import { VBtn, VDialog, VTextField } from 'vuetify/components';
4
+ import { nextTick } from 'vue';
5
+
6
+ describe('KeyboardShortcuts', () => {
7
+ it('should render the dialog correctly', async () => {
8
+ const wrapper = mount(KeyboardShortcuts);
9
+ const dialog = wrapper.findComponent(VDialog);
10
+ expect(dialog.isVisible()).toBe(true);
11
+ });
12
+
13
+ it('should filter items based on search input', async () => {
14
+ const wrapper = mount(KeyboardShortcuts);
15
+ await wrapper.setProps({ modelValue: true });
16
+ const searchInput = wrapper.findComponent(VTextField);
17
+ expect(searchInput.isVisible()).toBe(true);
18
+ await searchInput.setValue('display');
19
+ await nextTick();
20
+ expect(wrapper.text()).not.toContain('Annotation');
21
+ });
22
+
23
+ it('should close the dialog when the close button is clicked', async () => {
24
+ const wrapper = mount(KeyboardShortcuts);
25
+ await wrapper.setProps({ modelValue: true });
26
+ const closeButton = wrapper.findAllComponents(VBtn)[0];
27
+ expect(closeButton.exists()).toBe(true);
28
+ await closeButton.trigger('click');
29
+ await nextTick();
30
+ const dialog = wrapper.findComponent(VDialog);
31
+ expect(dialog.props('modelValue')).toBe(false);
32
+ });
33
+
34
+ // Note: Coverage engine crashing with stackoverflow when triggered
35
+ // it('should clear the search when the close search button is clicked', async () => {
36
+ // const wrapper = mount(KeyboardShortcuts);
37
+ // await wrapper.setProps({ modelValue: true });
38
+ // const closeSearchButton = wrapper.findAllComponents(VBtn)[1];
39
+ // expect(closeSearchButton.exists()).toBe(true);
40
+ // const searchInput = wrapper.findComponent(VTextField);
41
+ // await searchInput.setValue('test');
42
+ // expect(searchInput.props('modelValue')).toBe('test');
43
+ // const foundSearchButton = wrapper.findComponentByTestId('close-btn-search');
44
+ //
45
+ // await flushPromises();
46
+ // await foundSearchButton.trigger('click');
47
+ // await nextTick();
48
+ // expect(searchInput.props('modelValue')).toBe('');
49
+ // });
50
+ });
@@ -0,0 +1,50 @@
1
+ import { mount } from '@vue/test-utils';
2
+ import MultiLoginError from '@/components/shared/MultiLoginError.vue';
3
+ import { VDialog, VSnackbar } from 'vuetify/components';
4
+ import { nextTick } from 'vue';
5
+
6
+ describe('MultiLoginError', () => {
7
+ it('should render the dialog', () => {
8
+ const wrapper = mount(MultiLoginError);
9
+ const dialog = wrapper.findComponent(VDialog);
10
+ expect(dialog.exists()).toBe(true);
11
+ });
12
+
13
+ it('calls verifyOwnership function', async () => {
14
+ const wrapper = mount(MultiLoginError);
15
+ wrapper.vm.verifyOwnership();
16
+ expect(wrapper.vm.snackbarTest).toBe(true);
17
+ });
18
+ it('requestAccess should set snackbar to true', () => {
19
+ const wrapper = mount(MultiLoginError);
20
+ wrapper.vm.requestAccess();
21
+ expect(wrapper.vm.snackbar).toBe(true);
22
+ const snackbar = wrapper.findAllComponents(VSnackbar)[0];
23
+ expect(snackbar.exists()).toBe(true);
24
+ expect(snackbar.isVisible()).toBe(true);
25
+ });
26
+ it('snackbar should initially be hidden and display when triggered', async () => {
27
+ const wrapper = mount(MultiLoginError);
28
+ expect(wrapper.vm.snackbar).toBe(false);
29
+ wrapper.vm.snackbar = true;
30
+ await nextTick();
31
+ const snackbar = wrapper.findAllComponents(VSnackbar)[0];
32
+ for (const snack of wrapper.findAllComponents(VSnackbar)) {
33
+ await snack.setValue(true);
34
+ }
35
+ expect(snackbar.exists()).toBe(true);
36
+ expect(snackbar.isVisible()).toBe(true);
37
+ });
38
+ it('should hide the snackbar when the close button is clicked', async () => {
39
+ const wrapper = mount(MultiLoginError);
40
+ wrapper.vm.snackbar = true;
41
+ await nextTick();
42
+ const snackbar = wrapper.findComponent({ name: 'VSnackbar' });
43
+ expect(snackbar.isVisible()).toBe(true);
44
+ const closeButton = wrapper.findComponent('[data-testid="closeSnackbar"]');
45
+ expect(closeButton.exists()).toBe(true);
46
+ await closeButton.trigger('click');
47
+ await nextTick();
48
+ expect(wrapper.vm.snackbar).toBe(false);
49
+ });
50
+ });
@@ -0,0 +1,65 @@
1
+ import NotificationToaster from '@/components/shared/NotificationToaster.vue';
2
+ import { mount } from '@vue/test-utils';
3
+ const mockNotify = vi.fn();
4
+ vi.mock('@kyvg/vue3-notification', () => ({
5
+ useNotification: () => ({
6
+ notify: mockNotify
7
+ }),
8
+ Notifications: {
9
+ name: 'Notifications'
10
+ }
11
+ }));
12
+
13
+ describe('NotificationToaster', () => {
14
+ it('should pass', async () => {
15
+ expect(true).toBe(true);
16
+ });
17
+ it('displays a success notification with the correct text and icon', () => {
18
+ const wrapper = mount(NotificationToaster);
19
+ wrapper.vm.notifySuccess();
20
+ expect(mockNotify).toHaveBeenCalledWith({
21
+ type: 'success',
22
+ text: 'This is a Success message!!',
23
+ duration: 300000,
24
+ data: { icon: 'check_circle' }
25
+ });
26
+ });
27
+ it('displays a Error notification with the correct text and icon', () => {
28
+ const wrapper = mount(NotificationToaster);
29
+ wrapper.vm.notifyError();
30
+ expect(mockNotify).toHaveBeenCalledWith({
31
+ type: 'error',
32
+ text: 'This is an Error Message!!',
33
+ duration: 300000,
34
+ data: { icon: 'error' }
35
+ });
36
+ });
37
+ it('displays a Warning notification with the correct text and icon', () => {
38
+ const wrapper = mount(NotificationToaster);
39
+ wrapper.vm.notifyWarning();
40
+ expect(mockNotify).toHaveBeenCalledWith({
41
+ type: 'warn',
42
+ text: 'This is a warning Message!!',
43
+ duration: 300000,
44
+ data: { icon: 'warning' }
45
+ });
46
+ });
47
+ it('displays a Info notification with the correct text and icon', () => {
48
+ const wrapper = mount(NotificationToaster);
49
+ wrapper.vm.notifyInfo();
50
+ expect(mockNotify).toHaveBeenCalledWith({
51
+ type: 'info',
52
+ text: 'This is an informational message!!',
53
+ duration: 300000,
54
+ data: { icon: 'check_circle' }
55
+ });
56
+ });
57
+ it('getButtonColor returns the correct color for each type', () => {
58
+ const wrapper = mount(NotificationToaster);
59
+ expect(wrapper.vm.getButtonColor('success')).toBe('rgba(29, 127, 22, 1)');
60
+ expect(wrapper.vm.getButtonColor('error')).toBe('rgba(202, 52, 74, 1)');
61
+ expect(wrapper.vm.getButtonColor('warn')).toBe('rgba(166, 103, 2, 1)');
62
+ expect(wrapper.vm.getButtonColor('info')).toBe('rgba(27, 109, 131, 1)');
63
+ expect(wrapper.vm.getButtonColor(undefined)).toBe('');
64
+ });
65
+ });
@@ -3,11 +3,11 @@ import { VAlert, VBtn, VSnackbar } from 'vuetify/components';
3
3
  import UpdateSnackbar from '../UpdateSnackbar.vue';
4
4
 
5
5
  const registration: any = {
6
- addEventListener: vi.fn().mockImplementation((e, callback) => {
6
+ addEventListener: vi.fn().mockImplementation((e: any, callback: any) => {
7
7
  callback();
8
8
  }),
9
9
  installing: {
10
- addEventListener: vi.fn().mockImplementation((e, callback) => {
10
+ addEventListener: vi.fn().mockImplementation((e: any, callback: any) => {
11
11
  callback();
12
12
  })
13
13
  },
@@ -29,7 +29,7 @@ const navigatorWithoutInstalling: any = {
29
29
  serviceWorker: {
30
30
  getRegistration() {
31
31
  return {
32
- addEventListener: vi.fn().mockImplementation((e, callback) => {
32
+ addEventListener: vi.fn().mockImplementation((e: any, callback: any) => {
33
33
  callback();
34
34
  })
35
35
  };
@@ -41,11 +41,11 @@ const navigatorWithoutWaiting: any = {
41
41
  serviceWorker: {
42
42
  getRegistration() {
43
43
  return {
44
- addEventListener: vi.fn().mockImplementation((e, callback) => {
44
+ addEventListener: vi.fn().mockImplementation((e: any, callback: any) => {
45
45
  callback();
46
46
  }),
47
47
  installing: {
48
- addEventListener: vi.fn().mockImplementation((e, callback) => {
48
+ addEventListener: vi.fn().mockImplementation((e: any, callback: any) => {
49
49
  callback();
50
50
  })
51
51
  }
@@ -96,14 +96,14 @@ describe('UpdateSnackbar tests', () => {
96
96
  vi.spyOn(global, 'navigator', 'get').mockReturnValue(navigatorWithoutInstalling);
97
97
  const wrapper = mount(UpdateSnackbar);
98
98
  await flushPromises();
99
- expect(wrapper.findComponent(VBtn).text()).toBe('Installing');
99
+ expect(wrapper.findComponent(VBtn).text()).toBe('labels.installing');
100
100
  });
101
101
 
102
102
  it('should ignore update if waiting not found', async () => {
103
103
  vi.spyOn(global, 'navigator', 'get').mockReturnValue(navigatorWithoutWaiting);
104
104
  const wrapper = mount(UpdateSnackbar);
105
105
  await flushPromises();
106
- expect(wrapper.findComponent(VBtn).text()).toBe('Installing');
106
+ expect(wrapper.findComponent(VBtn).text()).toBe('labels.installing');
107
107
  });
108
108
 
109
109
  it('should apply update on user confirmation', async () => {
@@ -32,6 +32,12 @@ describe('ValueSelector.vue', () => {
32
32
  expect(wrapper.emitted('update:value')).toStrictEqual([[100]]);
33
33
  });
34
34
 
35
+ it('should set text higher than max limits', async () => {
36
+ (wrapper.vm as any).sliderValue = '9000';
37
+ await flushPromises();
38
+ expect(wrapper.emitted('update:value')).toStrictEqual([[100]]);
39
+ });
40
+
35
41
  it('should set text', async () => {
36
42
  const slider = wrapper.findAllComponents('.v-text-field');
37
43
  await slider[0].setValue(10);
@@ -0,0 +1,17 @@
1
+ import { useDebounce } from '@/composables/useDebounce';
2
+
3
+ describe('useDebounce', () => {
4
+ it('should call the callback after the specified delay', async () => {
5
+ const callback = vi.fn();
6
+ const debounce = useDebounce(callback, 200);
7
+
8
+ debounce('test1');
9
+ debounce('test2');
10
+ debounce('test3');
11
+
12
+ expect(callback).not.toHaveBeenCalled();
13
+ await new Promise((resolve) => setTimeout(resolve, 200));
14
+ expect(callback).toHaveBeenCalledOnce();
15
+ expect(callback).toHaveBeenCalledWith('test3');
16
+ });
17
+ });
@@ -0,0 +1,40 @@
1
+ // import { useMovingAverage } from '@/composables/useMovingAverage';
2
+ // describe('useMovingAverage', () => {
3
+ // it('should calculate the correct average with fewer than "count" values', () => {
4
+ // const { average, next } = useMovingAverage(3);
5
+ // next(5);
6
+ // expect(average.value).toBe(5);
7
+ // next(10);
8
+ // expect(average.value).toBe(7.5);
9
+ // });
10
+ // it('should calculate the correct average with exactly "count" values', () => {
11
+ // const { average, next } = useMovingAverage(3);
12
+ // next(5);
13
+ // next(10);
14
+ // next(15);
15
+ // expect(average.value).toBe(10);
16
+ // });
17
+ //
18
+ // it('should maintain only "count" values and calculate the correct moving average', () => {
19
+ // const { average, next } = useMovingAverage(3);
20
+ //
21
+ // next(5);
22
+ // next(10);
23
+ // next(15);
24
+ // next(20);
25
+ // expect(average.value).toBe(15);
26
+ // });
27
+ //
28
+ // it('should handle an empty state correctly', () => {
29
+ // const { average } = useMovingAverage(3);
30
+ // expect(average.value).toBeNaN();
31
+ // });
32
+ // });
33
+
34
+ //TODO: Discuss w/ Ana, this composable does not exist
35
+
36
+ describe('TODO: useMovingAverage', () => {
37
+ it('TODO: should pass as blank file', () => {
38
+ expect(true).toBeTruthy();
39
+ });
40
+ });
@@ -0,0 +1,79 @@
1
+ import { useViewer3cr } from '@/composables/useViewer3cr';
2
+ import { isVisible, navCubeBoundingBox, useNavigationCube } from '@/composables/useNavigationCube';
3
+ import { fullscreenView, isFullscreen, isLayout1x3, isLayout2x2 } from '@/models/scanState';
4
+ import { ScanView } from '@3cr/types-ts';
5
+ import { flushPromises } from '@vue/test-utils';
6
+ import { MockInstance } from '@vitest/spy';
7
+
8
+ describe('useNavigationCube tests', () => {
9
+ const viewer3cr = useViewer3cr();
10
+ const canvas = document.createElement('canvas'); // jsdom does not implement bounds
11
+ canvas.getBoundingClientRect = vi.fn(() => ({ x: 0, y: 0, width: 100, height: 100 }) as DOMRect);
12
+
13
+ let setNavCubeVisibilitySpy: MockInstance;
14
+ let setNavCubePositionSizeSpy: MockInstance;
15
+
16
+ beforeEach(() => {
17
+ setNavCubeVisibilitySpy = vi.spyOn(viewer3cr, 'setNavCubeVisibility');
18
+ setNavCubePositionSizeSpy = vi.spyOn(viewer3cr, 'setNavCubePositionSize');
19
+ });
20
+
21
+ afterEach(() => {
22
+ setNavCubeVisibilitySpy.mockRestore();
23
+ setNavCubePositionSizeSpy.mockRestore();
24
+ });
25
+
26
+ it('should position correctly for 2x2', async () => {
27
+ vi.spyOn(isLayout2x2, 'value', 'get').mockReturnValue(true);
28
+ vi.spyOn(isFullscreen, 'value', 'get').mockReturnValue(false);
29
+
30
+ useNavigationCube(canvas);
31
+ await flushPromises();
32
+
33
+ expect(isVisible.value).toBe(true);
34
+ expect(navCubeBoundingBox.value).toEqual({ x: 40, y: 40, width: 10, height: 10 });
35
+ expect(setNavCubePositionSizeSpy).toHaveBeenCalled();
36
+ });
37
+
38
+ it('should position correctly for 1x3', async () => {
39
+ vi.spyOn(isLayout1x3, 'value', 'get').mockReturnValue(true);
40
+ vi.spyOn(isFullscreen, 'value', 'get').mockReturnValue(false);
41
+
42
+ useNavigationCube(canvas);
43
+ await flushPromises();
44
+
45
+ expect(isVisible.value).toBe(true);
46
+ expect(navCubeBoundingBox.value).toEqual({ x: 56, y: 90, width: 10, height: 10 });
47
+ expect(setNavCubePositionSizeSpy).toHaveBeenCalled();
48
+ });
49
+
50
+ it('should position correctly for 2d fullscreen', async () => {
51
+ vi.spyOn(isFullscreen, 'value', 'get').mockReturnValue(true);
52
+ vi.spyOn(fullscreenView, 'value', 'get').mockReturnValue(ScanView.Sagittal);
53
+
54
+ useNavigationCube(canvas);
55
+ await flushPromises();
56
+ isVisible.value = false;
57
+ await flushPromises();
58
+ isVisible.value = true;
59
+ await flushPromises();
60
+
61
+ expect(setNavCubeVisibilitySpy).toHaveBeenCalled();
62
+ });
63
+
64
+ it('should position correctly for 3d fullscreen', async () => {
65
+ vi.spyOn(isFullscreen, 'value', 'get').mockReturnValue(true);
66
+ vi.spyOn(fullscreenView, 'value', 'get').mockReturnValue(ScanView.Volume);
67
+
68
+ useNavigationCube(canvas);
69
+ await flushPromises();
70
+ isVisible.value = false;
71
+ await flushPromises();
72
+ isVisible.value = true;
73
+ await flushPromises();
74
+
75
+ expect(isVisible.value).toBe(true);
76
+ expect(navCubeBoundingBox.value).toEqual({ x: 90, y: 90, width: 10, height: 10 });
77
+ expect(setNavCubeVisibilitySpy).toHaveBeenCalled();
78
+ });
79
+ });
@@ -1,5 +1,4 @@
1
1
  import { useNotification } from '@kyvg/vue3-notification';
2
- import { handleNotification } from '@/functions/notification';
3
2
  import {
4
3
  FileManagementActions,
5
4
  InteractivityActions,
@@ -7,16 +6,18 @@ import {
7
6
  NotificationsActions,
8
7
  SlidersActions
9
8
  } from '@3cr/types-ts';
9
+ import { useNotificationHandler } from '@/composables/useNotificationHandler';
10
10
 
11
- describe('notification.ts', () => {
11
+ describe('useNotificationHandler tests', () => {
12
12
  const { notify } = useNotification();
13
+ const { handler, announce } = useNotificationHandler();
13
14
 
14
15
  it(`should handleNotification InteractivityActions.in01`, () => {
15
16
  const notification: NotificationPayload = {
16
17
  Action: InteractivityActions.in01,
17
18
  Code: 'S00001'
18
19
  } as NotificationPayload;
19
- handleNotification(NotificationsActions.no01, JSON.stringify(notification));
20
+ handler(NotificationsActions.no01, JSON.stringify(notification));
20
21
  expect(notify).not.toHaveBeenCalled();
21
22
  });
22
23
 
@@ -25,7 +26,7 @@ describe('notification.ts', () => {
25
26
  Action: InteractivityActions.in02,
26
27
  Code: 'S00001'
27
28
  } as NotificationPayload;
28
- handleNotification(NotificationsActions.no01, JSON.stringify(notification));
29
+ handler(NotificationsActions.no01, JSON.stringify(notification));
29
30
  expect(notify).not.toHaveBeenCalled();
30
31
  });
31
32
 
@@ -34,7 +35,7 @@ describe('notification.ts', () => {
34
35
  Action: InteractivityActions.in03,
35
36
  Code: 'S00001'
36
37
  } as NotificationPayload;
37
- handleNotification(NotificationsActions.no01, JSON.stringify(notification));
38
+ handler(NotificationsActions.no01, JSON.stringify(notification));
38
39
  expect(notify).not.toHaveBeenCalled();
39
40
  });
40
41
 
@@ -43,7 +44,7 @@ describe('notification.ts', () => {
43
44
  Action: InteractivityActions.in04,
44
45
  Code: 'S00001'
45
46
  } as NotificationPayload;
46
- handleNotification(NotificationsActions.no01, JSON.stringify(notification));
47
+ handler(NotificationsActions.no01, JSON.stringify(notification));
47
48
  expect(notify).not.toHaveBeenCalled();
48
49
  });
49
50
 
@@ -52,7 +53,7 @@ describe('notification.ts', () => {
52
53
  Action: SlidersActions.sl01,
53
54
  Code: 'S00001'
54
55
  } as NotificationPayload;
55
- handleNotification(NotificationsActions.no01, JSON.stringify(notification));
56
+ handler(NotificationsActions.no01, JSON.stringify(notification));
56
57
  expect(notify).not.toHaveBeenCalled();
57
58
  });
58
59
 
@@ -61,7 +62,7 @@ describe('notification.ts', () => {
61
62
  Action: FileManagementActions.fm01,
62
63
  Code: 'S00001'
63
64
  } as NotificationPayload;
64
- handleNotification(NotificationsActions.no01, JSON.stringify(notification));
65
+ handler(NotificationsActions.no01, JSON.stringify(notification));
65
66
  expect(notify).not.toHaveBeenCalledWith({
66
67
  title: notification.Code,
67
68
  text: notification.Action,
@@ -74,7 +75,7 @@ describe('notification.ts', () => {
74
75
  Action: FileManagementActions.fm01,
75
76
  Code: 'I00001'
76
77
  } as NotificationPayload;
77
- handleNotification(NotificationsActions.no04, JSON.stringify(notification));
78
+ handler(NotificationsActions.no04, JSON.stringify(notification));
78
79
  expect(notify).not.toHaveBeenCalledWith({
79
80
  title: notification.Code,
80
81
  text: notification.Action,
@@ -87,11 +88,11 @@ describe('notification.ts', () => {
87
88
  Action: FileManagementActions.fm01,
88
89
  Code: 'F00001'
89
90
  } as NotificationPayload;
90
- handleNotification(NotificationsActions.no03, JSON.stringify(notification));
91
+ handler(NotificationsActions.no03, JSON.stringify(notification));
91
92
  expect(notify).toHaveBeenCalledWith({
92
- title: notification.Code,
93
- text: notification.Action,
94
- type: 'error'
93
+ title: 'enums.notificationType.warning',
94
+ text: notification.Code,
95
+ type: 'warn'
95
96
  });
96
97
  });
97
98
 
@@ -100,11 +101,67 @@ describe('notification.ts', () => {
100
101
  Action: FileManagementActions.fm01,
101
102
  Code: 'A00001'
102
103
  } as NotificationPayload;
103
- handleNotification(NotificationsActions.no02, JSON.stringify(notification));
104
+ handler(NotificationsActions.no02, JSON.stringify(notification));
104
105
  expect(notify).toHaveBeenCalledWith({
105
- title: notification.Code,
106
- text: notification.Action,
107
- type: 'warn'
106
+ title: 'enums.notificationType.error',
107
+ text: notification.Code,
108
+ type: 'error'
109
+ });
110
+ });
111
+
112
+ it(`should handleNotification slider mute FileManagementActions.fm01`, () => {
113
+ vi.mocked(notify).mockClear();
114
+ const notification: NotificationPayload = {
115
+ Action: SlidersActions.sl01,
116
+ Code: 'A00001'
117
+ } as NotificationPayload;
118
+ handler(NotificationsActions.no02, JSON.stringify(notification));
119
+ expect(notify).not.toHaveBeenCalledWith({
120
+ title: 'enums.notificationType.error',
121
+ text: notification.Code,
122
+ type: 'error'
123
+ });
124
+ });
125
+
126
+ it(`should handleNotification success FileManagementActions.fm01`, () => {
127
+ vi.mocked(notify).mockClear();
128
+ const notification: NotificationPayload = {
129
+ Action: FileManagementActions.fm01,
130
+ Code: 'S00001'
131
+ } as NotificationPayload;
132
+ announce(NotificationsActions.no01, notification);
133
+ expect(notify).toHaveBeenCalledWith({
134
+ title: 'enums.notificationType.success',
135
+ text: notification.Code,
136
+ type: 'success'
137
+ });
138
+ });
139
+
140
+ it(`should handleNotification info FileManagementActions.fm01`, () => {
141
+ vi.mocked(notify).mockClear();
142
+ const notification: NotificationPayload = {
143
+ Action: FileManagementActions.fm01,
144
+ Code: 'I00001'
145
+ } as NotificationPayload;
146
+ announce(NotificationsActions.no04, notification);
147
+ expect(notify).toHaveBeenCalledWith({
148
+ title: 'enums.notificationType.info',
149
+ text: notification.Code,
150
+ type: 'info'
151
+ });
152
+ });
153
+
154
+ it(`should handleNotification default FileManagementActions.fm01`, () => {
155
+ vi.mocked(notify).mockClear();
156
+ const notification: NotificationPayload = {
157
+ Action: FileManagementActions.fm01,
158
+ Code: 'I00001'
159
+ } as NotificationPayload;
160
+ announce(0 as unknown as NotificationsActions, notification);
161
+ expect(notify).toHaveBeenCalledWith({
162
+ title: 'enums.notificationType.info',
163
+ text: notification.Code,
164
+ type: 'info'
108
165
  });
109
166
  });
110
167
  });
@@ -0,0 +1,41 @@
1
+ import { useToolGroup } from '@/composables/useToolGroup';
2
+ import { ref } from 'vue';
3
+ import { ViewerTool } from '@/types/viewer-tool';
4
+
5
+ describe('useToolGroup', () => {
6
+ const createTool = (_name: string): ViewerTool => ({
7
+ isActive: ref(false)
8
+ });
9
+
10
+ it('should only allow one tool to be active at a time', () => {
11
+ const tool1 = createTool('Tool1');
12
+ const tool2 = createTool('Tool2');
13
+ const tool3 = createTool('Tool3');
14
+
15
+ const { activeTool, activeIndex, toggleTool } = useToolGroup(tool1, tool2, tool3);
16
+ expect(activeTool.value).toBeNull();
17
+ expect(activeIndex.value).toBeNull();
18
+ toggleTool(tool1);
19
+ expect(activeTool.value).toBe(tool1);
20
+ expect(activeIndex.value).toBe(0);
21
+ expect(tool1.isActive.value).toBe(true);
22
+ expect(tool2.isActive.value).toBe(false);
23
+ expect(tool3.isActive.value).toBe(false);
24
+
25
+ toggleTool(tool2);
26
+ expect(activeTool.value).toBe(tool2);
27
+ expect(activeIndex.value).toBe(1);
28
+ expect(tool1.isActive.value).toBe(false);
29
+ expect(tool2.isActive.value).toBe(true);
30
+ expect(tool3.isActive.value).toBe(false);
31
+
32
+ toggleTool(tool2);
33
+ expect(activeTool.value).toBeNull();
34
+ expect(activeIndex.value).toBeNull();
35
+ expect(tool2.isActive.value).toBe(false);
36
+
37
+ toggleTool(tool3);
38
+ expect(activeTool.value).toBe(tool3);
39
+ expect(activeIndex.value).toBe(2);
40
+ });
41
+ });
@@ -0,0 +1,29 @@
1
+ import { ScanView } from '@3cr/types-ts';
2
+ import { useViewName } from '@/composables/useViewName';
3
+
4
+ describe('useViewName tests', () => {
5
+ it('should get name for coronal', () => {
6
+ const { name } = useViewName(ScanView.Coronal);
7
+ expect(name.value).toBe('enums.scanView.coronal');
8
+ });
9
+
10
+ it('should get name for sagittal', () => {
11
+ const { name } = useViewName(ScanView.Sagittal);
12
+ expect(name.value).toBe('enums.scanView.sagittal');
13
+ });
14
+
15
+ it('should get name for transverse', () => {
16
+ const { name } = useViewName(ScanView.Transverse);
17
+ expect(name.value).toBe('enums.scanView.transverse');
18
+ });
19
+
20
+ it('should get name for volume', () => {
21
+ const { name } = useViewName(ScanView.Volume);
22
+ expect(name.value).toBe('enums.scanView.volume');
23
+ });
24
+
25
+ it('should get empty string for unknown', () => {
26
+ const { name } = useViewName(-1 as ScanView);
27
+ expect(name.value).toBe('');
28
+ });
29
+ });
@@ -0,0 +1,32 @@
1
+ import { MaybeRef, ref, unref } from 'vue';
2
+ import { useResizeObserver } from '@/composables/useResizeObserver';
3
+
4
+ export function useBoundingBox(element: MaybeRef<Element | null | undefined>) {
5
+ const x = ref<number>(0);
6
+ const y = ref<number>(0);
7
+ const width = ref<number>(0);
8
+ const height = ref<number>(0);
9
+
10
+ useResizeObserver(element, onResize);
11
+
12
+ function onResize(): void {
13
+ const el = unref(element);
14
+ if (el) {
15
+ const { x, y, width, height } = el.getBoundingClientRect();
16
+ setBoundingBox(x, y, width, height);
17
+ } else {
18
+ setBoundingBox(0, 0, 0, 0);
19
+ }
20
+ }
21
+
22
+ function setBoundingBox(x_: number, y_: number, width_: number, height_: number): void {
23
+ x.value = x_;
24
+ y.value = y_;
25
+ width.value = width_;
26
+ height.value = height_;
27
+ }
28
+
29
+ onResize();
30
+
31
+ return { x, y, width, height };
32
+ }
@@ -1,24 +1,22 @@
1
- import { onBeforeUnmount, onMounted, Ref, unref, watch } from 'vue';
1
+ import { MaybeRef, onBeforeUnmount, unref, watch } from 'vue';
2
2
 
3
- type Target = Ref<EventTarget> | EventTarget;
3
+ type Target = MaybeRef<EventTarget>;
4
4
  type EventType = keyof HTMLElementEventMap;
5
5
  type Handler<T extends Event> = (event: T) => void | Promise<void>;
6
6
 
7
7
  export function useEventListener<T extends Event>(target: Target, event: EventType, handler: Handler<T>) {
8
8
  const wrapper = (e: Event) => handler(e as T);
9
9
 
10
- onMounted(() => {
11
- unref(target).addEventListener(event, wrapper);
12
- });
13
-
14
10
  watch(
15
11
  () => unref(target),
16
12
  (next, prev) => {
17
- prev.removeEventListener(event, wrapper);
18
- next.addEventListener(event, wrapper);
19
- }
13
+ prev?.removeEventListener(event, wrapper);
14
+ next?.addEventListener(event, wrapper);
15
+ },
16
+ { immediate: true }
20
17
  );
21
18
 
19
+ // TODO: Fix onBeforeUnmount is called when there is no active component instance to be associated with
22
20
  onBeforeUnmount(() => {
23
21
  unref(target).removeEventListener(event, wrapper);
24
22
  });