react-msaview 4.8.1 → 5.0.3

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 (240) hide show
  1. package/README.md +9 -2
  2. package/bundle/index.js +87 -187
  3. package/bundle/index.js.LICENSE.txt +0 -83
  4. package/bundle/index.js.map +1 -1
  5. package/dist/colorSchemes.js +1 -1
  6. package/dist/colorSchemes.js.map +1 -1
  7. package/dist/components/ConservationTrack.d.ts +2 -2
  8. package/dist/components/ConservationTrack.js +1 -2
  9. package/dist/components/ConservationTrack.js.map +1 -1
  10. package/dist/components/Loading.d.ts +1 -1
  11. package/dist/components/Loading.js +2 -2
  12. package/dist/components/Loading.js.map +1 -1
  13. package/dist/components/MSAView.d.ts +1 -1
  14. package/dist/components/MSAView.js +8 -8
  15. package/dist/components/MSAView.js.map +1 -1
  16. package/dist/components/ResizeHandles.d.ts +1 -1
  17. package/dist/components/SequenceTextArea.js +2 -2
  18. package/dist/components/SequenceTextArea.js.map +1 -1
  19. package/dist/components/TextTrack.d.ts +2 -2
  20. package/dist/components/TextTrack.js +1 -1
  21. package/dist/components/TextTrack.js.map +1 -1
  22. package/dist/components/Track.d.ts +1 -1
  23. package/dist/components/Track.js +1 -1
  24. package/dist/components/Track.js.map +1 -1
  25. package/dist/components/VerticalScrollbar.d.ts +1 -1
  26. package/dist/components/dialogs/AboutDialog.js +1 -1
  27. package/dist/components/dialogs/AboutDialog.js.map +1 -1
  28. package/dist/components/dialogs/AddTrackDialog.d.ts +1 -1
  29. package/dist/components/dialogs/DomainDialog.d.ts +1 -1
  30. package/dist/components/dialogs/DomainDialog.js +3 -3
  31. package/dist/components/dialogs/DomainDialog.js.map +1 -1
  32. package/dist/components/dialogs/ExportSVGDialog.d.ts +1 -1
  33. package/dist/components/dialogs/ExportSVGDialog.js +1 -1
  34. package/dist/components/dialogs/ExportSVGDialog.js.map +1 -1
  35. package/dist/components/dialogs/FeatureDialog.d.ts +1 -1
  36. package/dist/components/dialogs/FeatureDialog.js +1 -1
  37. package/dist/components/dialogs/FeatureDialog.js.map +1 -1
  38. package/dist/components/dialogs/InterProScanDialog.d.ts +1 -1
  39. package/dist/components/dialogs/InterProScanDialog.js +1 -1
  40. package/dist/components/dialogs/InterProScanDialog.js.map +1 -1
  41. package/dist/components/dialogs/MetadataDialog.d.ts +1 -1
  42. package/dist/components/dialogs/MetadataDialog.js +1 -1
  43. package/dist/components/dialogs/MetadataDialog.js.map +1 -1
  44. package/dist/components/dialogs/SettingsDialog.d.ts +1 -1
  45. package/dist/components/dialogs/SettingsDialog.js +2 -2
  46. package/dist/components/dialogs/SettingsDialog.js.map +1 -1
  47. package/dist/components/dialogs/TrackInfoDialog.js +1 -1
  48. package/dist/components/dialogs/TrackInfoDialog.js.map +1 -1
  49. package/dist/components/dialogs/UserProvidedDomainsDialog.d.ts +1 -1
  50. package/dist/components/dialogs/UserProvidedDomainsDialog.js +1 -1
  51. package/dist/components/dialogs/UserProvidedDomainsDialog.js.map +1 -1
  52. package/dist/components/header/GappynessSlider.d.ts +1 -1
  53. package/dist/components/header/Header.d.ts +1 -1
  54. package/dist/components/header/Header.js +10 -10
  55. package/dist/components/header/Header.js.map +1 -1
  56. package/dist/components/header/HeaderInfoArea.d.ts +1 -1
  57. package/dist/components/header/HeaderMenu.d.ts +1 -1
  58. package/dist/components/header/HeaderMenu.js +6 -6
  59. package/dist/components/header/HeaderMenu.js.map +1 -1
  60. package/dist/components/header/HeaderStatusArea.d.ts +1 -1
  61. package/dist/components/header/MultiAlignmentSelector.d.ts +1 -1
  62. package/dist/components/header/SettingsMenu.d.ts +1 -1
  63. package/dist/components/header/SettingsMenu.js +1 -1
  64. package/dist/components/header/SettingsMenu.js.map +1 -1
  65. package/dist/components/header/ZoomControls.d.ts +1 -1
  66. package/dist/components/header/ZoomMenu.d.ts +1 -1
  67. package/dist/components/header/ZoomStar.d.ts +1 -1
  68. package/dist/components/import/ImportForm.d.ts +1 -1
  69. package/dist/components/import/ImportForm.js +2 -2
  70. package/dist/components/import/ImportForm.js.map +1 -1
  71. package/dist/components/import/ImportFormExamples.d.ts +1 -1
  72. package/dist/components/import/ImportFormExamples.js +2 -2
  73. package/dist/components/import/ImportFormExamples.js.map +1 -1
  74. package/dist/components/import/util.d.ts +1 -1
  75. package/dist/components/minimap/Minimap.d.ts +1 -1
  76. package/dist/components/minimap/MinimapSVG.d.ts +1 -1
  77. package/dist/components/msa/MSACanvas.d.ts +1 -1
  78. package/dist/components/msa/MSACanvas.js +2 -2
  79. package/dist/components/msa/MSACanvas.js.map +1 -1
  80. package/dist/components/msa/MSACanvasBlock.d.ts +1 -1
  81. package/dist/components/msa/MSACanvasBlock.js +3 -3
  82. package/dist/components/msa/MSACanvasBlock.js.map +1 -1
  83. package/dist/components/msa/MSAMouseoverCanvas.d.ts +1 -1
  84. package/dist/components/msa/MSAMouseoverCanvas.js +2 -2
  85. package/dist/components/msa/MSAMouseoverCanvas.js.map +1 -1
  86. package/dist/components/msa/MSAPanel.d.ts +1 -1
  87. package/dist/components/msa/MSAPanel.js +2 -2
  88. package/dist/components/msa/MSAPanel.js.map +1 -1
  89. package/dist/components/msa/renderBoxFeatureCanvasBlock.d.ts +1 -1
  90. package/dist/components/msa/renderMSABlock.d.ts +1 -1
  91. package/dist/components/msa/renderMSAMouseover.d.ts +1 -1
  92. package/dist/components/tracks/renderTracksSvg.d.ts +2 -2
  93. package/dist/components/tree/TreeBranchMenu.d.ts +1 -1
  94. package/dist/components/tree/TreeCanvas.d.ts +1 -1
  95. package/dist/components/tree/TreeCanvas.js +3 -3
  96. package/dist/components/tree/TreeCanvas.js.map +1 -1
  97. package/dist/components/tree/TreeCanvasBlock.d.ts +1 -1
  98. package/dist/components/tree/TreeCanvasBlock.js +3 -3
  99. package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
  100. package/dist/components/tree/TreeNodeMenu.d.ts +1 -1
  101. package/dist/components/tree/TreeNodeMenu.js +1 -1
  102. package/dist/components/tree/TreeNodeMenu.js.map +1 -1
  103. package/dist/components/tree/TreePanel.d.ts +1 -1
  104. package/dist/components/tree/TreePanel.js +1 -1
  105. package/dist/components/tree/TreePanel.js.map +1 -1
  106. package/dist/components/tree/TreeRuler.d.ts +1 -1
  107. package/dist/components/tree/dialogs/TreeNodeInfoDialog.d.ts +1 -1
  108. package/dist/components/tree/dialogs/TreeNodeInfoDialog.js +1 -1
  109. package/dist/components/tree/dialogs/TreeNodeInfoDialog.js.map +1 -1
  110. package/dist/components/tree/renderTreeCanvas.d.ts +1 -1
  111. package/dist/createPaletteMap.d.ts +7 -0
  112. package/dist/createPaletteMap.js +11 -0
  113. package/dist/createPaletteMap.js.map +1 -0
  114. package/dist/createPaletteMap.test.d.ts +1 -0
  115. package/dist/createPaletteMap.test.js +49 -0
  116. package/dist/createPaletteMap.test.js.map +1 -0
  117. package/dist/index.d.ts +3 -2
  118. package/dist/index.js +2 -2
  119. package/dist/index.js.map +1 -1
  120. package/dist/launchInterProScan.d.ts +1 -1
  121. package/dist/launchInterProScan.js +1 -1
  122. package/dist/launchInterProScan.js.map +1 -1
  123. package/dist/model/DataModel.d.ts +5 -5
  124. package/dist/model/DataModel.js +1 -1
  125. package/dist/model/DataModel.js.map +1 -1
  126. package/dist/model/DialogQueue.d.ts +2 -2
  127. package/dist/model/DialogQueue.js +1 -1
  128. package/dist/model/DialogQueue.js.map +1 -1
  129. package/dist/model/msaModel.d.ts +4 -4
  130. package/dist/model/msaModel.js +2 -2
  131. package/dist/model/msaModel.js.map +1 -1
  132. package/dist/model/treeModel.d.ts +10 -10
  133. package/dist/model/treeModel.js +2 -2
  134. package/dist/model/treeModel.js.map +1 -1
  135. package/dist/model.d.ts +524 -420
  136. package/dist/model.js +63 -40
  137. package/dist/model.js.map +1 -1
  138. package/dist/neighborJoining.test.js +1 -1
  139. package/dist/neighborJoining.test.js.map +1 -1
  140. package/dist/parseAsn1.test.js +1 -1
  141. package/dist/parseAsn1.test.js.map +1 -1
  142. package/dist/renderToSvg.d.ts +1 -1
  143. package/dist/renderToSvg.js +10 -10
  144. package/dist/renderToSvg.js.map +1 -1
  145. package/dist/reparseTree.d.ts +1 -1
  146. package/dist/rowCoordinateCalculations.js +1 -1
  147. package/dist/rowCoordinateCalculations.js.map +1 -1
  148. package/dist/rowCoordinateCalculations.test.js +1 -1
  149. package/dist/rowCoordinateCalculations.test.js.map +1 -1
  150. package/dist/seqPosToGlobalCol.js +1 -1
  151. package/dist/seqPosToGlobalCol.js.map +1 -1
  152. package/dist/seqPosToGlobalCol.test.js +1 -1
  153. package/dist/seqPosToGlobalCol.test.js.map +1 -1
  154. package/dist/util.d.ts +1 -1
  155. package/dist/vendor/copyToClipboard.d.ts +10 -0
  156. package/dist/vendor/copyToClipboard.js +113 -0
  157. package/dist/vendor/copyToClipboard.js.map +1 -0
  158. package/dist/vendor/fileSaver.d.ts +11 -0
  159. package/dist/vendor/fileSaver.js +80 -0
  160. package/dist/vendor/fileSaver.js.map +1 -0
  161. package/dist/version.d.ts +1 -1
  162. package/dist/version.js +1 -1
  163. package/dist/webpack.d.ts +2 -2
  164. package/dist/webpack.js +2 -2
  165. package/dist/webpack.js.map +1 -1
  166. package/package.json +26 -23
  167. package/src/colorSchemes.ts +1 -1
  168. package/src/components/ConservationTrack.tsx +3 -4
  169. package/src/components/Loading.tsx +3 -3
  170. package/src/components/MSAView.tsx +12 -9
  171. package/src/components/ResizeHandles.tsx +1 -1
  172. package/src/components/SequenceTextArea.tsx +2 -2
  173. package/src/components/TextTrack.tsx +3 -3
  174. package/src/components/Track.tsx +2 -2
  175. package/src/components/VerticalScrollbar.tsx +1 -1
  176. package/src/components/dialogs/AboutDialog.tsx +1 -1
  177. package/src/components/dialogs/AddTrackDialog.tsx +1 -1
  178. package/src/components/dialogs/DomainDialog.tsx +4 -4
  179. package/src/components/dialogs/ExportSVGDialog.tsx +2 -2
  180. package/src/components/dialogs/FeatureDialog.tsx +2 -2
  181. package/src/components/dialogs/InterProScanDialog.tsx +2 -2
  182. package/src/components/dialogs/MetadataDialog.tsx +2 -2
  183. package/src/components/dialogs/SettingsDialog.tsx +3 -3
  184. package/src/components/dialogs/TrackInfoDialog.tsx +2 -1
  185. package/src/components/dialogs/UserProvidedDomainsDialog.tsx +3 -3
  186. package/src/components/header/GappynessSlider.tsx +1 -1
  187. package/src/components/header/Header.tsx +11 -11
  188. package/src/components/header/HeaderInfoArea.tsx +1 -1
  189. package/src/components/header/HeaderMenu.tsx +9 -7
  190. package/src/components/header/HeaderStatusArea.tsx +1 -1
  191. package/src/components/header/MultiAlignmentSelector.tsx +1 -1
  192. package/src/components/header/SettingsMenu.tsx +2 -2
  193. package/src/components/header/ZoomControls.tsx +1 -1
  194. package/src/components/header/ZoomMenu.tsx +1 -1
  195. package/src/components/header/ZoomStar.tsx +1 -1
  196. package/src/components/import/ImportForm.tsx +3 -3
  197. package/src/components/import/ImportFormExamples.tsx +3 -3
  198. package/src/components/import/util.ts +1 -1
  199. package/src/components/minimap/Minimap.tsx +1 -1
  200. package/src/components/minimap/MinimapSVG.tsx +1 -1
  201. package/src/components/msa/MSACanvas.tsx +3 -3
  202. package/src/components/msa/MSACanvasBlock.tsx +4 -4
  203. package/src/components/msa/MSAMouseoverCanvas.tsx +3 -3
  204. package/src/components/msa/MSAPanel.tsx +3 -3
  205. package/src/components/msa/renderBoxFeatureCanvasBlock.ts +2 -2
  206. package/src/components/msa/renderMSABlock.ts +2 -2
  207. package/src/components/msa/renderMSAMouseover.ts +1 -1
  208. package/src/components/tracks/renderTracksSvg.ts +2 -2
  209. package/src/components/tree/TreeBranchMenu.tsx +1 -1
  210. package/src/components/tree/TreeCanvas.tsx +4 -4
  211. package/src/components/tree/TreeCanvasBlock.tsx +4 -4
  212. package/src/components/tree/TreeNodeMenu.tsx +4 -2
  213. package/src/components/tree/TreePanel.tsx +2 -2
  214. package/src/components/tree/TreeRuler.tsx +1 -1
  215. package/src/components/tree/dialogs/TreeNodeInfoDialog.tsx +2 -2
  216. package/src/components/tree/renderTreeCanvas.ts +1 -1
  217. package/src/createPaletteMap.test.ts +57 -0
  218. package/src/createPaletteMap.ts +11 -0
  219. package/src/index.ts +3 -2
  220. package/src/launchInterProScan.ts +2 -2
  221. package/src/model/DataModel.ts +1 -1
  222. package/src/model/DialogQueue.ts +1 -1
  223. package/src/model/msaModel.ts +2 -2
  224. package/src/model/treeModel.ts +2 -2
  225. package/src/model.ts +71 -46
  226. package/src/neighborJoining.test.ts +1 -1
  227. package/src/parseAsn1.test.ts +1 -1
  228. package/src/renderToSvg.tsx +17 -19
  229. package/src/reparseTree.ts +1 -1
  230. package/src/rowCoordinateCalculations.test.ts +1 -1
  231. package/src/rowCoordinateCalculations.ts +1 -1
  232. package/src/seqPosToGlobalCol.test.ts +1 -1
  233. package/src/seqPosToGlobalCol.ts +1 -1
  234. package/src/util.ts +1 -1
  235. package/src/vendor/copyToClipboard.ts +125 -0
  236. package/src/vendor/fileSaver.ts +107 -0
  237. package/src/version.ts +1 -1
  238. package/src/webpack.ts +2 -2
  239. package/dist/__snapshots__/parseAsn1.test.js.snap +0 -2400
  240. package/src/declare.d.ts +0 -1
@@ -2,10 +2,11 @@ import React, { useState } from 'react'
2
2
 
3
3
  import { Dialog } from '@jbrowse/core/ui'
4
4
  import { Button, DialogActions, DialogContent } from '@mui/material'
5
- import copy from 'copy-to-clipboard'
6
5
  import { observer } from 'mobx-react'
7
6
  import { makeStyles } from 'tss-react/mui'
8
7
 
8
+ import copy from '../../vendor/copyToClipboard.ts'
9
+
9
10
  const useStyles = makeStyles()(theme => ({
10
11
  textArea: {
11
12
  padding: theme.spacing(2),
@@ -15,10 +15,10 @@ import {
15
15
  } from '@mui/material'
16
16
  import { observer } from 'mobx-react'
17
17
 
18
- import { jsonfetch } from '../../fetchUtils'
18
+ import { jsonfetch } from '../../fetchUtils.ts'
19
19
 
20
- import type { InterProScanResponse } from '../../launchInterProScan'
21
- import type { MsaViewModel } from '../../model'
20
+ import type { InterProScanResponse } from '../../launchInterProScan.ts'
21
+ import type { MsaViewModel } from '../../model.ts'
22
22
 
23
23
  const UserProvidedDomainsDialog = observer(function ({
24
24
  handleClose,
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  import { Slider, Typography } from '@mui/material'
4
4
  import { observer } from 'mobx-react'
5
5
 
6
- import type { MsaViewModel } from '../../model'
6
+ import type { MsaViewModel } from '../../model.ts'
7
7
 
8
8
  const GappynessSlider = observer(function GappynessSlider({
9
9
  model,
@@ -5,19 +5,19 @@ import Help from '@mui/icons-material/Help'
5
5
  import { IconButton } from '@mui/material'
6
6
  import { observer } from 'mobx-react'
7
7
 
8
- import GappynessSlider from './GappynessSlider'
9
- import HeaderInfoArea from './HeaderInfoArea'
10
- import HeaderMenu from './HeaderMenu'
11
- import HeaderStatusArea from './HeaderStatusArea'
12
- import MultiAlignmentSelector from './MultiAlignmentSelector'
13
- import SettingsMenu from './SettingsMenu'
14
- import ZoomControls from './ZoomControls'
15
- import ZoomMenu from './ZoomMenu'
16
- import ZoomStar from './ZoomStar'
8
+ import GappynessSlider from './GappynessSlider.tsx'
9
+ import HeaderInfoArea from './HeaderInfoArea.tsx'
10
+ import HeaderMenu from './HeaderMenu.tsx'
11
+ import HeaderStatusArea from './HeaderStatusArea.tsx'
12
+ import MultiAlignmentSelector from './MultiAlignmentSelector.tsx'
13
+ import SettingsMenu from './SettingsMenu.tsx'
14
+ import ZoomControls from './ZoomControls.tsx'
15
+ import ZoomMenu from './ZoomMenu.tsx'
16
+ import ZoomStar from './ZoomStar.tsx'
17
17
 
18
- import type { MsaViewModel } from '../../model'
18
+ import type { MsaViewModel } from '../../model.ts'
19
19
 
20
- const AboutDialog = lazy(() => import('../dialogs/AboutDialog'))
20
+ const AboutDialog = lazy(() => import('../dialogs/AboutDialog.tsx'))
21
21
 
22
22
  const Header = observer(function ({ model }: { model: MsaViewModel }) {
23
23
  const [ref, { height }] = useMeasure()
@@ -4,7 +4,7 @@ import { Typography } from '@mui/material'
4
4
  import { observer } from 'mobx-react'
5
5
  import { makeStyles } from 'tss-react/mui'
6
6
 
7
- import type { MsaViewModel } from '../../model'
7
+ import type { MsaViewModel } from '../../model.ts'
8
8
 
9
9
  const useStyles = makeStyles()({
10
10
  margin: {
@@ -12,17 +12,19 @@ import Sort from '@mui/icons-material/Sort'
12
12
  import Visibility from '@mui/icons-material/Visibility'
13
13
  import { observer } from 'mobx-react'
14
14
 
15
- import type { MsaViewModel } from '../../model'
15
+ import type { MsaViewModel } from '../../model.ts'
16
16
 
17
17
  // lazies
18
- const MetadataDialog = lazy(() => import('../dialogs/MetadataDialog'))
19
- const ExportSVGDialog = lazy(() => import('../dialogs/ExportSVGDialog'))
20
- const FeatureFilterDialog = lazy(() => import('../dialogs/FeatureDialog'))
21
- const SettingsDialog = lazy(() => import('../dialogs/SettingsDialog'))
18
+ const MetadataDialog = lazy(() => import('../dialogs/MetadataDialog.tsx'))
19
+ const ExportSVGDialog = lazy(() => import('../dialogs/ExportSVGDialog.tsx'))
20
+ const FeatureFilterDialog = lazy(() => import('../dialogs/FeatureDialog.tsx'))
21
+ const SettingsDialog = lazy(() => import('../dialogs/SettingsDialog.tsx'))
22
22
  const UserProvidedDomainsDialog = lazy(
23
- () => import('../dialogs/UserProvidedDomainsDialog'),
23
+ () => import('../dialogs/UserProvidedDomainsDialog.tsx'),
24
+ )
25
+ const InterProScanDialog = lazy(
26
+ () => import('../dialogs/InterProScanDialog.tsx'),
24
27
  )
25
- const InterProScanDialog = lazy(() => import('../dialogs/InterProScanDialog'))
26
28
 
27
29
  const HeaderMenu = observer(({ model }: { model: MsaViewModel }) => {
28
30
  const {
@@ -5,7 +5,7 @@ import { Typography } from '@mui/material'
5
5
  import { observer } from 'mobx-react'
6
6
  import { makeStyles } from 'tss-react/mui'
7
7
 
8
- import type { MsaViewModel } from '../../model'
8
+ import type { MsaViewModel } from '../../model.ts'
9
9
 
10
10
  const useStyles = makeStyles()({
11
11
  margin: {
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  import { MenuItem, TextField } from '@mui/material'
4
4
  import { observer } from 'mobx-react'
5
5
 
6
- import type { MsaViewModel } from '../../model'
6
+ import type { MsaViewModel } from '../../model.ts'
7
7
 
8
8
  const MultiAlignmentSelector = observer(function ({
9
9
  model,
@@ -6,9 +6,9 @@ import Palette from '@mui/icons-material/Palette'
6
6
  import Settings from '@mui/icons-material/Settings'
7
7
  import { observer } from 'mobx-react'
8
8
 
9
- import colorSchemes from '../../colorSchemes'
9
+ import colorSchemes from '../../colorSchemes.ts'
10
10
 
11
- import type { MsaViewModel } from '../../model'
11
+ import type { MsaViewModel } from '../../model.ts'
12
12
 
13
13
  const SettingsMenu = observer(function ({ model }: { model: MsaViewModel }) {
14
14
  const {
@@ -5,7 +5,7 @@ import ZoomOut from '@mui/icons-material/ZoomOut'
5
5
  import { IconButton } from '@mui/material'
6
6
  import { observer } from 'mobx-react'
7
7
 
8
- import type { MsaViewModel } from '../../model'
8
+ import type { MsaViewModel } from '../../model.ts'
9
9
 
10
10
  const ZoomControls = observer(function ZoomControls({
11
11
  model,
@@ -5,7 +5,7 @@ import MoreVert from '@mui/icons-material/MoreVert'
5
5
  import RestartAlt from '@mui/icons-material/RestartAlt'
6
6
  import { observer } from 'mobx-react'
7
7
 
8
- import type { MsaViewModel } from '../../model'
8
+ import type { MsaViewModel } from '../../model.ts'
9
9
 
10
10
  const ZoomMenu = observer(function ({ model }: { model: MsaViewModel }) {
11
11
  return (
@@ -5,7 +5,7 @@ import { IconButton } from '@mui/material'
5
5
  import { observer } from 'mobx-react'
6
6
  import { makeStyles } from 'tss-react/mui'
7
7
 
8
- import type { MsaViewModel } from '../../model'
8
+ import type { MsaViewModel } from '../../model.ts'
9
9
 
10
10
  const useStyles = makeStyles()(theme => ({
11
11
  dpad: {
@@ -4,10 +4,10 @@ import { ErrorMessage, FileSelector } from '@jbrowse/core/ui'
4
4
  import { Button, Container, Typography } from '@mui/material'
5
5
  import { observer } from 'mobx-react'
6
6
 
7
- import ImportFormExamples from './ImportFormExamples'
8
- import { load } from './util'
7
+ import ImportFormExamples from './ImportFormExamples.tsx'
8
+ import { load } from './util.ts'
9
9
 
10
- import type { MsaViewModel } from '../../model'
10
+ import type { MsaViewModel } from '../../model.ts'
11
11
  import type { FileLocation } from '@jbrowse/core/util/types'
12
12
 
13
13
  const ImportForm = observer(function ({ model }: { model: MsaViewModel }) {
@@ -3,10 +3,10 @@ import React from 'react'
3
3
  import { Link, Typography } from '@mui/material'
4
4
  import { observer } from 'mobx-react'
5
5
 
6
- import { smallMSA, smallMSAOnly, smallTree } from './data/seq2'
7
- import { load } from './util'
6
+ import { smallMSA, smallMSAOnly, smallTree } from './data/seq2.ts'
7
+ import { load } from './util.ts'
8
8
 
9
- import type { MsaViewModel } from '../../model'
9
+ import type { MsaViewModel } from '../../model.ts'
10
10
 
11
11
  function ListItem({
12
12
  onClick,
@@ -1,4 +1,4 @@
1
- import type { MsaViewModel } from '../../model'
1
+ import type { MsaViewModel } from '../../model.ts'
2
2
  import type { FileLocation } from '@jbrowse/core/util'
3
3
 
4
4
  export async function load(
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from 'react'
2
2
 
3
3
  import { observer } from 'mobx-react'
4
4
 
5
- import type { MsaViewModel } from '../../model'
5
+ import type { MsaViewModel } from '../../model.ts'
6
6
 
7
7
  interface ClickCoord {
8
8
  clientX: number
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import { observer } from 'mobx-react'
4
4
 
5
- import type { MsaViewModel } from '../../model'
5
+ import type { MsaViewModel } from '../../model.ts'
6
6
 
7
7
  const MinimapSVG = observer(({ model }: { model: MsaViewModel }) => {
8
8
  const {
@@ -2,10 +2,10 @@ import React, { useEffect, useRef, useState } from 'react'
2
2
 
3
3
  import { observer } from 'mobx-react'
4
4
 
5
- import Loading from './Loading'
6
- import MSACanvasBlock from './MSACanvasBlock'
5
+ import Loading from './Loading.tsx'
6
+ import MSACanvasBlock from './MSACanvasBlock.tsx'
7
7
 
8
- import type { MsaViewModel } from '../../model'
8
+ import type { MsaViewModel } from '../../model.ts'
9
9
 
10
10
  const MSACanvas = observer(function ({ model }: { model: MsaViewModel }) {
11
11
  const {
@@ -5,11 +5,11 @@ import { useTheme } from '@mui/material'
5
5
  import { autorun } from 'mobx'
6
6
  import { observer } from 'mobx-react'
7
7
 
8
- import { renderBoxFeatureCanvasBlock } from './renderBoxFeatureCanvasBlock'
9
- import { renderMSABlock } from './renderMSABlock'
10
- import { colorContrast } from '../../util'
8
+ import { renderBoxFeatureCanvasBlock } from './renderBoxFeatureCanvasBlock.ts'
9
+ import { renderMSABlock } from './renderMSABlock.ts'
10
+ import { colorContrast } from '../../util.ts'
11
11
 
12
- import type { MsaViewModel } from '../../model'
12
+ import type { MsaViewModel } from '../../model.ts'
13
13
 
14
14
  const MSACanvasBlock = observer(function ({
15
15
  model,
@@ -1,12 +1,12 @@
1
1
  import React, { useEffect, useRef } from 'react'
2
2
 
3
+ import { isAlive } from '@jbrowse/mobx-state-tree'
3
4
  import { autorun } from 'mobx'
4
5
  import { observer } from 'mobx-react'
5
- import { isAlive } from 'mobx-state-tree'
6
6
 
7
- import { renderMouseover } from './renderMSAMouseover'
7
+ import { renderMouseover } from './renderMSAMouseover.ts'
8
8
 
9
- import type { MsaViewModel } from '../../model'
9
+ import type { MsaViewModel } from '../../model.ts'
10
10
 
11
11
  const MSAMouseoverCanvas = observer(function ({
12
12
  model,
@@ -2,11 +2,11 @@ import React from 'react'
2
2
 
3
3
  import { observer } from 'mobx-react'
4
4
 
5
- import MSACanvas from './MSACanvas'
6
- import MSAMouseoverCanvas from './MSAMouseoverCanvas'
5
+ import MSACanvas from './MSACanvas.tsx'
6
+ import MSAMouseoverCanvas from './MSAMouseoverCanvas.tsx'
7
7
 
8
8
  // types
9
- import type { MsaViewModel } from '../../model'
9
+ import type { MsaViewModel } from '../../model.ts'
10
10
 
11
11
  const MSAPanel = observer(function ({ model }: { model: MsaViewModel }) {
12
12
  return (
@@ -1,5 +1,5 @@
1
- import type { MsaViewModel } from '../../model'
2
- import type { NodeWithIdsAndLength } from '../../types'
1
+ import type { MsaViewModel } from '../../model.ts'
2
+ import type { NodeWithIdsAndLength } from '../../types.ts'
3
3
  import type { HierarchyNode } from 'd3-hierarchy'
4
4
 
5
5
  export function renderBoxFeatureCanvasBlock({
@@ -1,5 +1,5 @@
1
- import type { MsaViewModel } from '../../model'
2
- import type { NodeWithIdsAndLength } from '../../types'
1
+ import type { MsaViewModel } from '../../model.ts'
2
+ import type { NodeWithIdsAndLength } from '../../types.ts'
3
3
  import type { Theme } from '@mui/material'
4
4
  import type { HierarchyNode } from 'd3-hierarchy'
5
5
 
@@ -1,4 +1,4 @@
1
- import type { MsaViewModel } from '../../model'
1
+ import type { MsaViewModel } from '../../model.ts'
2
2
 
3
3
  const hoverColor = 'rgba(0,0,0,0.15)'
4
4
  const highlightColor = 'rgba(128,128,0,0.2)'
@@ -1,5 +1,5 @@
1
- import type { MsaViewModel } from '../../model'
2
- import type { BasicTrack } from '../../types'
1
+ import type { MsaViewModel } from '../../model.ts'
2
+ import type { BasicTrack } from '../../types.ts'
3
3
 
4
4
  export function renderConservationTrack({
5
5
  model,
@@ -3,7 +3,7 @@ import React from 'react'
3
3
  import { Menu, MenuItem } from '@mui/material'
4
4
  import { observer } from 'mobx-react'
5
5
 
6
- import type { MsaViewModel } from '../../model'
6
+ import type { MsaViewModel } from '../../model.ts'
7
7
 
8
8
  interface Node {
9
9
  x: number
@@ -1,13 +1,13 @@
1
1
  import React, { useEffect, useRef, useState } from 'react'
2
2
 
3
+ import { isAlive } from '@jbrowse/mobx-state-tree'
3
4
  import { autorun } from 'mobx'
4
5
  import { observer } from 'mobx-react'
5
- import { isAlive } from 'mobx-state-tree'
6
6
 
7
- import TreeCanvasBlock from './TreeCanvasBlock'
8
- import { padding } from './renderTreeCanvas'
7
+ import TreeCanvasBlock from './TreeCanvasBlock.tsx'
8
+ import { padding } from './renderTreeCanvas.ts'
9
9
 
10
- import type { MsaViewModel } from '../../model'
10
+ import type { MsaViewModel } from '../../model.ts'
11
11
 
12
12
  const TreeCanvas = observer(function ({ model }: { model: MsaViewModel }) {
13
13
  const ref = useRef<HTMLDivElement>(null)
@@ -5,11 +5,11 @@ import Flatbush from 'flatbush'
5
5
  import { autorun } from 'mobx'
6
6
  import { observer } from 'mobx-react'
7
7
 
8
- import TreeBranchMenu from './TreeBranchMenu'
9
- import TreeNodeMenu from './TreeNodeMenu'
10
- import { padding, renderTreeCanvas } from './renderTreeCanvas'
8
+ import TreeBranchMenu from './TreeBranchMenu.tsx'
9
+ import TreeNodeMenu from './TreeNodeMenu.tsx'
10
+ import { padding, renderTreeCanvas } from './renderTreeCanvas.ts'
11
11
 
12
- import type { MsaViewModel } from '../../model'
12
+ import type { MsaViewModel } from '../../model.ts'
13
13
 
14
14
  interface TooltipData {
15
15
  name: string
@@ -3,10 +3,12 @@ import React, { lazy } from 'react'
3
3
  import { Menu, MenuItem } from '@mui/material'
4
4
  import { observer } from 'mobx-react'
5
5
 
6
- import type { MsaViewModel } from '../../model'
6
+ import type { MsaViewModel } from '../../model.ts'
7
7
 
8
8
  // lazies
9
- const TreeNodeInfoDialog = lazy(() => import('./dialogs/TreeNodeInfoDialog'))
9
+ const TreeNodeInfoDialog = lazy(
10
+ () => import('./dialogs/TreeNodeInfoDialog.tsx'),
11
+ )
10
12
 
11
13
  const TreeMenu = observer(function ({
12
14
  node,
@@ -2,9 +2,9 @@ import React from 'react'
2
2
 
3
3
  import { observer } from 'mobx-react'
4
4
 
5
- import TreeCanvas from './TreeCanvas'
5
+ import TreeCanvas from './TreeCanvas.tsx'
6
6
 
7
- import type { MsaViewModel } from '../../model'
7
+ import type { MsaViewModel } from '../../model.ts'
8
8
 
9
9
  const TreePanel = observer(function ({ model }: { model: MsaViewModel }) {
10
10
  const { treeAreaWidth } = model
@@ -2,7 +2,7 @@ import React from 'react'
2
2
 
3
3
  import { observer } from 'mobx-react'
4
4
 
5
- import type { MsaViewModel } from '../../model'
5
+ import type { MsaViewModel } from '../../model.ts'
6
6
 
7
7
  const TreeRuler = observer(({ model }: { model: MsaViewModel }) => {
8
8
  const { treeAreaWidth } = model
@@ -6,9 +6,9 @@ import { Dialog } from '@jbrowse/core/ui'
6
6
  import { DialogContent } from '@mui/material'
7
7
  import { observer } from 'mobx-react'
8
8
 
9
- import SequenceTextArea from '../../SequenceTextArea'
9
+ import SequenceTextArea from '../../SequenceTextArea.tsx'
10
10
 
11
- import type { MsaViewModel } from '../../../model'
11
+ import type { MsaViewModel } from '../../../model.ts'
12
12
 
13
13
  const TreeNodeInfoDialog = observer(function ({
14
14
  info,
@@ -1,4 +1,4 @@
1
- import type { MsaViewModel } from '../../model'
1
+ import type { MsaViewModel } from '../../model.ts'
2
2
  import type { Theme } from '@mui/material'
3
3
 
4
4
  export const padding = 600
@@ -0,0 +1,57 @@
1
+ import { expect, test } from 'vitest'
2
+
3
+ import { createPaletteMap } from './createPaletteMap.ts'
4
+ import palettes from './ggplotPalettes.ts'
5
+
6
+ // Original implementation for comparison
7
+ function originalFillPalette(keys: string[]) {
8
+ let i = 0
9
+ const map = {} as Record<string, string>
10
+ for (const key of keys) {
11
+ const k = Math.min(keys.length - 1, palettes.length - 1)
12
+ map[key] = palettes[k]![i]!
13
+ i++
14
+ }
15
+ return map
16
+ }
17
+
18
+ test('createPaletteMap matches original implementation with 1 key', () => {
19
+ const keys = ['IPR001234']
20
+ expect(createPaletteMap(keys)).toEqual(originalFillPalette(keys))
21
+ })
22
+
23
+ test('createPaletteMap matches original implementation with 3 keys', () => {
24
+ const keys = ['IPR001234', 'IPR005678', 'IPR009012']
25
+ expect(createPaletteMap(keys)).toEqual(originalFillPalette(keys))
26
+ })
27
+
28
+ test('createPaletteMap matches original implementation with 8 keys (max palette size)', () => {
29
+ const keys = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H']
30
+ expect(createPaletteMap(keys)).toEqual(originalFillPalette(keys))
31
+ })
32
+
33
+ test('createPaletteMap matches original implementation with more keys than palette colors', () => {
34
+ const keys = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J']
35
+ expect(createPaletteMap(keys)).toEqual(originalFillPalette(keys))
36
+ })
37
+
38
+ test('createPaletteMap returns correct colors for 3 keys', () => {
39
+ const keys = ['X', 'Y', 'Z']
40
+ const result = createPaletteMap(keys)
41
+ // With 3 keys, uses palette index 2 (0-indexed)
42
+ expect(result).toEqual({
43
+ X: '#F8766D',
44
+ Y: '#00BA38',
45
+ Z: '#619CFF',
46
+ })
47
+ })
48
+
49
+ test('createPaletteMap returns empty object for empty keys', () => {
50
+ expect(createPaletteMap([])).toEqual({})
51
+ })
52
+
53
+ test('createPaletteMap preserves key order', () => {
54
+ const keys = ['Z', 'A', 'M']
55
+ const result = createPaletteMap(keys)
56
+ expect(Object.keys(result)).toEqual(['Z', 'A', 'M'])
57
+ })
@@ -0,0 +1,11 @@
1
+ import palettes from './ggplotPalettes.ts'
2
+
3
+ /**
4
+ * Creates a map from keys to colors using ggplot-style palettes.
5
+ * The palette is selected based on the number of keys.
6
+ */
7
+ export function createPaletteMap(keys: string[]) {
8
+ const k = Math.min(keys.length - 1, palettes.length - 1)
9
+ const palette = palettes[k]!
10
+ return Object.fromEntries(keys.map((key, i) => [key, palette[i]!]))
11
+ }
package/src/index.ts CHANGED
@@ -1,2 +1,3 @@
1
- export { default as MSAView } from './components/Loading'
2
- export { type MsaViewModel, default as MSAModelF } from './model'
1
+ export { default as MSAView } from './components/Loading.tsx'
2
+ export { type MsaViewModel, default as MSAModelF } from './model.ts'
3
+ export type { MSAParserType } from 'msa-parsers'
@@ -1,8 +1,8 @@
1
1
  import { getSession } from '@jbrowse/core/util'
2
2
 
3
- import { jsonfetch, textfetch, timeout } from './fetchUtils'
3
+ import { jsonfetch, textfetch, timeout } from './fetchUtils.ts'
4
4
 
5
- import type { MsaViewModel } from './model'
5
+ import type { MsaViewModel } from './model.ts'
6
6
 
7
7
  const base = 'https://www.ebi.ac.uk/Tools/services/rest'
8
8
 
@@ -1,4 +1,4 @@
1
- import { types } from 'mobx-state-tree'
1
+ import { types } from '@jbrowse/mobx-state-tree'
2
2
 
3
3
  /**
4
4
  * #stateModel DataModel
@@ -1,4 +1,4 @@
1
- import { types } from 'mobx-state-tree'
1
+ import { types } from '@jbrowse/mobx-state-tree'
2
2
 
3
3
  import type { DialogComponentType } from '@jbrowse/core/util'
4
4
 
@@ -1,6 +1,6 @@
1
- import { types } from 'mobx-state-tree'
1
+ import { types } from '@jbrowse/mobx-state-tree'
2
2
 
3
- import { defaultBgColor, defaultColorSchemeName } from '../constants'
3
+ import { defaultBgColor, defaultColorSchemeName } from '../constants.ts'
4
4
 
5
5
  /**
6
6
  * #stateModel MSAModel
@@ -1,4 +1,4 @@
1
- import { types } from 'mobx-state-tree'
1
+ import { types } from '@jbrowse/mobx-state-tree'
2
2
 
3
3
  import {
4
4
  defaultDrawLabels,
@@ -9,7 +9,7 @@ import {
9
9
  defaultTreeAreaWidth,
10
10
  defaultTreeWidth,
11
11
  defaultTreeWidthMatchesArea,
12
- } from '../constants'
12
+ } from '../constants.ts'
13
13
 
14
14
  /**
15
15
  * #stateModel Tree