@jbrowse/core 2.17.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (354) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.d.ts +1 -2
  2. package/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.js +7 -13
  3. package/BaseFeatureWidget/BaseFeatureDetail/Attributes.d.ts +1 -2
  4. package/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +20 -25
  5. package/BaseFeatureWidget/BaseFeatureDetail/BaseCard.d.ts +2 -3
  6. package/BaseFeatureWidget/BaseFeatureDetail/BaseCard.js +3 -7
  7. package/BaseFeatureWidget/BaseFeatureDetail/BasicValue.d.ts +1 -2
  8. package/BaseFeatureWidget/BaseFeatureDetail/BasicValue.js +5 -8
  9. package/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.d.ts +2 -3
  10. package/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.js +7 -10
  11. package/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.d.ts +1 -2
  12. package/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.js +25 -55
  13. package/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.d.ts +3 -4
  14. package/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.js +16 -34
  15. package/BaseFeatureWidget/BaseFeatureDetail/FieldName.d.ts +1 -2
  16. package/BaseFeatureWidget/BaseFeatureDetail/FieldName.js +2 -6
  17. package/BaseFeatureWidget/BaseFeatureDetail/Position.d.ts +2 -3
  18. package/BaseFeatureWidget/BaseFeatureDetail/Position.js +2 -5
  19. package/BaseFeatureWidget/BaseFeatureDetail/SimpleField.d.ts +1 -2
  20. package/BaseFeatureWidget/BaseFeatureDetail/SimpleField.js +3 -5
  21. package/BaseFeatureWidget/BaseFeatureDetail/UriField.d.ts +1 -2
  22. package/BaseFeatureWidget/BaseFeatureDetail/UriField.js +3 -5
  23. package/BaseFeatureWidget/BaseFeatureDetail/index.d.ts +4 -5
  24. package/BaseFeatureWidget/BaseFeatureDetail/index.js +6 -14
  25. package/BaseFeatureWidget/BaseFeatureDetail/util.js +4 -13
  26. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceContents.d.ts +10 -0
  27. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceContents.js +48 -0
  28. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.d.ts +3 -4
  29. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +33 -41
  30. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.d.ts +3 -4
  31. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.js +30 -29
  32. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceName.d.ts +8 -0
  33. package/BaseFeatureWidget/SequenceFeatureDetails/SequenceName.js +28 -0
  34. package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.d.ts +2 -10
  35. package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.js +11 -85
  36. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.d.ts +1 -2
  37. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.js +6 -25
  38. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.d.ts +3 -4
  39. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.js +11 -46
  40. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.d.ts +3 -4
  41. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.js +101 -96
  42. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.d.ts +2 -3
  43. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.js +49 -53
  44. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.d.ts +2 -3
  45. package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.js +20 -55
  46. package/BaseFeatureWidget/SequenceFeatureDetails/hooks.d.ts +2 -2
  47. package/BaseFeatureWidget/SequenceFeatureDetails/hooks.js +1 -2
  48. package/BaseFeatureWidget/SequenceFeatureDetails/model.d.ts +2 -56
  49. package/BaseFeatureWidget/SequenceFeatureDetails/model.js +4 -66
  50. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.d.ts +4 -5
  51. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.js +6 -9
  52. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.d.ts +3 -4
  53. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.js +6 -7
  54. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.d.ts +3 -4
  55. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.js +5 -9
  56. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.d.ts +3 -4
  57. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.js +2 -4
  58. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.d.ts +2 -3
  59. package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.js +3 -10
  60. package/BaseFeatureWidget/SequenceFeatureDetails/types.d.ts +8 -0
  61. package/BaseFeatureWidget/SequenceFeatureDetails/types.js +2 -0
  62. package/BaseFeatureWidget/SequenceFeatureDetails/util.js +1 -5
  63. package/BaseFeatureWidget/stateModelFactory.d.ts +2 -93
  64. package/BaseFeatureWidget/stateModelFactory.js +3 -73
  65. package/BaseFeatureWidget/types.d.ts +3 -3
  66. package/BaseFeatureWidget/util.js +0 -4
  67. package/CorePlugin.d.ts +1 -1
  68. package/CorePlugin.js +19 -12
  69. package/Plugin.d.ts +2 -5
  70. package/Plugin.js +0 -3
  71. package/PluginLoader.d.ts +1 -1
  72. package/PluginLoader.js +2 -19
  73. package/PluginManager.d.ts +17 -32
  74. package/PluginManager.js +15 -41
  75. package/ReExports/DataGrid.js +0 -1
  76. package/ReExports/list.d.ts +0 -5
  77. package/ReExports/list.js +3 -5
  78. package/ReExports/modules.d.ts +26 -22
  79. package/ReExports/modules.js +45 -44
  80. package/TextSearch/BaseResults.d.ts +4 -4
  81. package/TextSearch/TextSearchManager.d.ts +4 -16
  82. package/TextSearch/TextSearchManager.js +1 -13
  83. package/assemblyManager/assembly.d.ts +5 -100
  84. package/assemblyManager/assembly.js +30 -146
  85. package/assemblyManager/assemblyConfigSchema.d.ts +1 -34
  86. package/assemblyManager/assemblyConfigSchema.js +12 -46
  87. package/assemblyManager/assemblyManager.d.ts +7 -57
  88. package/assemblyManager/assemblyManager.js +2 -57
  89. package/configuration/configurationSchema.d.ts +4 -4
  90. package/configuration/configurationSchema.js +2 -14
  91. package/configuration/configurationSlot.d.ts +2 -13
  92. package/configuration/configurationSlot.js +2 -32
  93. package/configuration/index.d.ts +2 -2
  94. package/configuration/index.js +2 -2
  95. package/configuration/types.d.ts +2 -3
  96. package/configuration/util.d.ts +1 -25
  97. package/configuration/util.js +19 -56
  98. package/data_adapters/BaseAdapter/BaseAdapter.d.ts +4 -14
  99. package/data_adapters/BaseAdapter/BaseAdapter.js +1 -10
  100. package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.d.ts +5 -114
  101. package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +3 -79
  102. package/data_adapters/BaseAdapter/BaseOptions.d.ts +2 -2
  103. package/data_adapters/BaseAdapter/BaseRefNameAliasAdapter.d.ts +2 -2
  104. package/data_adapters/BaseAdapter/BaseSequenceAdapter.d.ts +3 -6
  105. package/data_adapters/BaseAdapter/BaseTextSearchAdapter.d.ts +3 -3
  106. package/data_adapters/BaseAdapter/RegionsAdapter.d.ts +3 -3
  107. package/data_adapters/BaseAdapter/index.d.ts +4 -4
  108. package/data_adapters/BaseAdapter/types.d.ts +2 -2
  109. package/data_adapters/BaseAdapter/util.d.ts +6 -6
  110. package/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +1 -1
  111. package/data_adapters/CytobandAdapter/CytobandAdapter.js +2 -6
  112. package/data_adapters/CytobandAdapter/configSchema.d.ts +0 -3
  113. package/data_adapters/CytobandAdapter/configSchema.js +1 -7
  114. package/data_adapters/CytobandAdapter/index.d.ts +1 -1
  115. package/data_adapters/CytobandAdapter/index.js +21 -8
  116. package/data_adapters/dataAdapterCache.d.ts +4 -22
  117. package/data_adapters/dataAdapterCache.js +2 -28
  118. package/data_adapters/util.d.ts +1 -0
  119. package/data_adapters/util.js +10 -0
  120. package/package.json +8 -11
  121. package/pluggableElementTypes/AdapterType.d.ts +2 -2
  122. package/pluggableElementTypes/AddTrackWorkflowType.d.ts +2 -2
  123. package/pluggableElementTypes/ConnectionType.d.ts +3 -3
  124. package/pluggableElementTypes/DisplayType.d.ts +3 -9
  125. package/pluggableElementTypes/InternetAccountType.d.ts +2 -2
  126. package/pluggableElementTypes/PluggableElementBase.d.ts +1 -1
  127. package/pluggableElementTypes/PluggableElementBase.js +2 -2
  128. package/pluggableElementTypes/RpcMethodType.d.ts +5 -11
  129. package/pluggableElementTypes/RpcMethodType.js +7 -19
  130. package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.d.ts +9 -0
  131. package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.js +35 -0
  132. package/pluggableElementTypes/TextSearchAdapterType.d.ts +2 -2
  133. package/pluggableElementTypes/TrackType.d.ts +3 -3
  134. package/pluggableElementTypes/ViewType.d.ts +3 -3
  135. package/pluggableElementTypes/WidgetType.d.ts +4 -3
  136. package/pluggableElementTypes/index.d.ts +11 -11
  137. package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +2 -29
  138. package/pluggableElementTypes/models/BaseConnectionModelFactory.js +1 -28
  139. package/pluggableElementTypes/models/BaseDisplayModel.d.ts +3 -83
  140. package/pluggableElementTypes/models/BaseDisplayModel.js +2 -69
  141. package/pluggableElementTypes/models/BaseTrackModel.d.ts +4 -46
  142. package/pluggableElementTypes/models/BaseTrackModel.js +9 -63
  143. package/pluggableElementTypes/models/BaseViewModel.d.ts +2 -42
  144. package/pluggableElementTypes/models/BaseViewModel.js +2 -38
  145. package/pluggableElementTypes/models/InternetAccountModel.d.ts +3 -119
  146. package/pluggableElementTypes/models/InternetAccountModel.js +3 -123
  147. package/pluggableElementTypes/models/baseConnectionConfig.d.ts +0 -6
  148. package/pluggableElementTypes/models/baseConnectionConfig.js +1 -13
  149. package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +0 -15
  150. package/pluggableElementTypes/models/baseInternetAccountConfig.js +1 -23
  151. package/pluggableElementTypes/models/baseTrackConfig.d.ts +2 -53
  152. package/pluggableElementTypes/models/baseTrackConfig.js +1 -58
  153. package/pluggableElementTypes/renderers/BoxRendererType.d.ts +7 -15
  154. package/pluggableElementTypes/renderers/BoxRendererType.js +3 -14
  155. package/pluggableElementTypes/renderers/CircularChordRendererType.d.ts +4 -4
  156. package/pluggableElementTypes/renderers/CircularChordRendererType.js +3 -8
  157. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +6 -21
  158. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +2 -25
  159. package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +5 -47
  160. package/pluggableElementTypes/renderers/FeatureRendererType.js +15 -68
  161. package/pluggableElementTypes/renderers/RendererType.d.ts +5 -9
  162. package/pluggableElementTypes/renderers/RendererType.js +3 -7
  163. package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.d.ts +3 -4
  164. package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.js +11 -76
  165. package/pluggableElementTypes/renderers/ServerSideRenderedContent.d.ts +2 -3
  166. package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +10 -74
  167. package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +9 -49
  168. package/pluggableElementTypes/renderers/ServerSideRendererType.js +10 -60
  169. package/pluggableElementTypes/renderers/index.d.ts +1 -1
  170. package/pluggableElementTypes/renderers/util/serializableFilterChain.js +1 -3
  171. package/rpc/BaseRpcDriver.d.ts +3 -4
  172. package/rpc/BaseRpcDriver.js +20 -80
  173. package/rpc/MainThreadRpcDriver.d.ts +3 -7
  174. package/rpc/MainThreadRpcDriver.js +0 -5
  175. package/rpc/RpcManager.d.ts +3 -3
  176. package/rpc/RpcManager.js +2 -4
  177. package/rpc/WebWorkerRpcDriver.d.ts +3 -2
  178. package/rpc/WebWorkerRpcDriver.js +2 -13
  179. package/rpc/baseRpcConfig.d.ts +0 -3
  180. package/rpc/baseRpcConfig.js +1 -7
  181. package/rpc/configSchema.d.ts +0 -6
  182. package/rpc/configSchema.js +2 -11
  183. package/rpc/mainThreadRpcConfig.js +1 -7
  184. package/rpc/methods/CoreFreeResources.d.ts +0 -6
  185. package/rpc/methods/CoreFreeResources.js +2 -9
  186. package/rpc/methods/CoreGetFeatureDensityStats.d.ts +4 -5
  187. package/rpc/methods/CoreGetFeatureDensityStats.js +1 -1
  188. package/rpc/methods/CoreGetFeatureDetails.d.ts +2 -7
  189. package/rpc/methods/CoreGetFeatureDetails.js +0 -5
  190. package/rpc/methods/CoreGetFeatures.d.ts +5 -5
  191. package/rpc/methods/CoreGetFeatures.js +4 -5
  192. package/rpc/methods/CoreGetFileInfo.d.ts +1 -2
  193. package/rpc/methods/CoreGetFileInfo.js +1 -1
  194. package/rpc/methods/CoreGetMetadata.d.ts +1 -2
  195. package/rpc/methods/CoreGetMetadata.js +1 -1
  196. package/rpc/methods/CoreGetRefNames.d.ts +1 -2
  197. package/rpc/methods/CoreGetRefNames.js +1 -1
  198. package/rpc/methods/CoreRender.d.ts +2 -6
  199. package/rpc/methods/CoreRender.js +5 -7
  200. package/rpc/methods/util.d.ts +3 -3
  201. package/rpc/methods/util.js +0 -1
  202. package/rpc/webWorkerRpcConfig.js +1 -7
  203. package/stories/JBrowseCore.stories.d.ts +1 -1
  204. package/stories/JBrowseCore.stories.js +3 -3
  205. package/stories/examples/WithSequencePanel.d.ts +6 -7
  206. package/stories/examples/WithSequencePanel.js +9 -9
  207. package/tsconfig.build.tsbuildinfo +1 -1
  208. package/ui/AppLogo.d.ts +2 -3
  209. package/ui/AppLogo.js +2 -7
  210. package/ui/AssemblySelector.d.ts +5 -5
  211. package/ui/AssemblySelector.js +11 -36
  212. package/ui/BaseTooltip.d.ts +1 -2
  213. package/ui/BaseTooltip.js +10 -17
  214. package/ui/CascadingMenu.d.ts +3 -4
  215. package/ui/CascadingMenu.js +18 -57
  216. package/ui/CascadingMenuButton.d.ts +2 -3
  217. package/ui/CascadingMenuButton.js +18 -42
  218. package/ui/ColorPicker.d.ts +3 -4
  219. package/ui/ColorPicker.js +33 -37
  220. package/ui/Dialog.d.ts +2 -3
  221. package/ui/Dialog.js +15 -27
  222. package/ui/DraggableDialog.d.ts +5 -0
  223. package/ui/DraggableDialog.js +32 -0
  224. package/ui/DropDownMenu.d.ts +2 -3
  225. package/ui/DropDownMenu.js +10 -36
  226. package/ui/EditableTypography.d.ts +2 -3
  227. package/ui/EditableTypography.js +30 -59
  228. package/ui/ErrorBoundary.d.ts +3 -2
  229. package/ui/ErrorBoundary.js +3 -25
  230. package/ui/ErrorMessage.d.ts +1 -2
  231. package/ui/ErrorMessage.js +27 -34
  232. package/ui/ErrorMessageStackTraceDialog.d.ts +1 -2
  233. package/ui/ErrorMessageStackTraceDialog.js +13 -54
  234. package/ui/FactoryResetDialog.d.ts +1 -2
  235. package/ui/FactoryResetDialog.js +8 -13
  236. package/ui/FatalErrorDialog.d.ts +1 -2
  237. package/ui/FatalErrorDialog.js +11 -42
  238. package/ui/FileSelector/FileSelector.d.ts +5 -5
  239. package/ui/FileSelector/FileSelector.js +41 -80
  240. package/ui/FileSelector/LocalFileChooser.d.ts +2 -3
  241. package/ui/FileSelector/LocalFileChooser.js +17 -29
  242. package/ui/FileSelector/UrlChooser.d.ts +5 -5
  243. package/ui/FileSelector/UrlChooser.js +6 -7
  244. package/ui/Icons.d.ts +10 -11
  245. package/ui/Icons.js +10 -25
  246. package/ui/LoadingEllipses.d.ts +2 -3
  247. package/ui/LoadingEllipses.js +4 -7
  248. package/ui/Logo.d.ts +2 -3
  249. package/ui/Logo.js +5 -23
  250. package/ui/Menu.d.ts +3 -4
  251. package/ui/Menu.js +85 -122
  252. package/ui/MenuButton.d.ts +2 -3
  253. package/ui/MenuButton.js +11 -35
  254. package/ui/PrerenderedCanvas.d.ts +1 -2
  255. package/ui/PrerenderedCanvas.js +3 -25
  256. package/ui/RedErrorMessageBox.d.ts +1 -2
  257. package/ui/RedErrorMessageBox.js +2 -5
  258. package/ui/ResizeHandle.d.ts +1 -2
  259. package/ui/ResizeHandle.js +5 -27
  260. package/ui/ReturnToImportFormDialog.d.ts +1 -2
  261. package/ui/ReturnToImportFormDialog.js +8 -13
  262. package/ui/SanitizedHTML.d.ts +2 -3
  263. package/ui/SanitizedHTML.js +4 -24
  264. package/ui/Snackbar.d.ts +3 -4
  265. package/ui/Snackbar.js +41 -21
  266. package/ui/SnackbarContents.d.ts +5 -0
  267. package/ui/SnackbarContents.js +16 -0
  268. package/ui/SnackbarModel.d.ts +1 -26
  269. package/ui/SnackbarModel.js +22 -39
  270. package/ui/colors.d.ts +1 -1
  271. package/ui/colors.js +2 -2
  272. package/ui/index.d.ts +0 -2
  273. package/ui/index.js +1 -5
  274. package/ui/react-colorful.js +17 -10
  275. package/ui/theme.d.ts +1 -1
  276. package/ui/theme.js +7 -40
  277. package/util/Base1DUtils.d.ts +1 -1
  278. package/util/Base1DUtils.js +0 -12
  279. package/util/Base1DViewModel.d.ts +4 -81
  280. package/util/Base1DViewModel.js +4 -108
  281. package/util/QuickLRU.js +0 -9
  282. package/util/TimeTraveller.js +0 -4
  283. package/util/aborting.d.ts +0 -20
  284. package/util/aborting.js +0 -31
  285. package/util/analytics.js +1 -12
  286. package/util/blockTypes.d.ts +0 -11
  287. package/util/blockTypes.js +0 -13
  288. package/util/calculateDynamicBlocks.d.ts +1 -20
  289. package/util/calculateDynamicBlocks.js +1 -22
  290. package/util/calculateStaticBlocks.d.ts +2 -2
  291. package/util/calculateStaticBlocks.js +0 -2
  292. package/util/color/cssColorsLevel4.js +0 -1
  293. package/util/color/index.d.ts +0 -19
  294. package/util/color/index.js +0 -30
  295. package/util/compositeMap.js +0 -2
  296. package/util/dedupe.js +0 -1
  297. package/util/formatFastaStrings.d.ts +0 -13
  298. package/util/formatFastaStrings.js +0 -13
  299. package/util/idMaker.d.ts +1 -1
  300. package/util/idMaker.js +16 -12
  301. package/util/index.d.ts +27 -173
  302. package/util/index.js +53 -293
  303. package/util/io/RemoteFileWithRangeCache.d.ts +4 -5
  304. package/util/io/RemoteFileWithRangeCache.js +12 -14
  305. package/util/io/index.d.ts +3 -4
  306. package/util/io/index.js +5 -19
  307. package/util/jexl.js +3 -13
  308. package/util/jexlStrings.d.ts +0 -6
  309. package/util/jexlStrings.js +0 -8
  310. package/util/layouts/BaseLayout.d.ts +1 -1
  311. package/util/layouts/GranularRectLayout.d.ts +1 -17
  312. package/util/layouts/GranularRectLayout.js +4 -81
  313. package/util/layouts/MultiLayout.d.ts +1 -6
  314. package/util/layouts/MultiLayout.js +0 -6
  315. package/util/layouts/PrecomputedLayout.d.ts +1 -4
  316. package/util/layouts/PrecomputedLayout.js +0 -5
  317. package/util/layouts/PrecomputedMultiLayout.js +0 -2
  318. package/util/layouts/SceneGraph.d.ts +0 -12
  319. package/util/layouts/SceneGraph.js +0 -13
  320. package/util/makeAbortableReaction.d.ts +2 -0
  321. package/util/makeAbortableReaction.js +50 -0
  322. package/util/map-obj.js +0 -4
  323. package/util/mst-reflection.d.ts +1 -14
  324. package/util/mst-reflection.js +1 -28
  325. package/util/nanoid.d.ts +1 -1
  326. package/util/nanoid.js +0 -31
  327. package/util/nextTick.d.ts +1 -0
  328. package/util/nextTick.js +6 -0
  329. package/util/offscreenCanvasPonyfill.d.ts +0 -1
  330. package/util/offscreenCanvasPonyfill.js +1 -9
  331. package/util/offscreenCanvasUtils.d.ts +2 -3
  332. package/util/offscreenCanvasUtils.js +22 -21
  333. package/util/range.d.ts +0 -25
  334. package/util/range.js +0 -34
  335. package/util/rxjs.d.ts +3 -7
  336. package/util/rxjs.js +2 -9
  337. package/util/simpleFeature.d.ts +0 -50
  338. package/util/simpleFeature.js +0 -35
  339. package/util/stats.d.ts +3 -26
  340. package/util/stats.js +0 -25
  341. package/util/stopToken.d.ts +3 -0
  342. package/util/stopToken.js +29 -0
  343. package/util/tracks.d.ts +4 -26
  344. package/util/tracks.js +8 -33
  345. package/util/types/index.d.ts +14 -30
  346. package/util/types/index.js +5 -14
  347. package/util/types/mst.js +0 -9
  348. package/util/types/util.d.ts +2 -9
  349. package/util/useMeasure.d.ts +1 -1
  350. package/util/useMeasure.js +0 -1
  351. package/util/when.d.ts +1 -15
  352. package/util/when.js +3 -70
  353. package/rpc/remoteAbortSignals.d.ts +0 -36
  354. package/rpc/remoteAbortSignals.js +0 -79
@@ -1,16 +1,15 @@
1
- import { Buffer } from 'buffer';
2
- import { RemoteFile, PolyfilledResponse } from 'generic-filehandle';
1
+ import { RemoteFile } from 'generic-filehandle2';
3
2
  export interface BinaryRangeResponse {
4
3
  headers: Record<string, string>;
5
4
  requestDate: Date;
6
5
  responseDate: Date;
7
- buffer: Buffer;
6
+ buffer: Uint8Array;
8
7
  }
9
8
  export declare function clearCache(): void;
10
9
  export declare class RemoteFileWithRangeCache extends RemoteFile {
11
- fetch(url: RequestInfo, init?: RequestInit): Promise<PolyfilledResponse>;
10
+ fetch(url: string | RequestInfo, init?: RequestInit): Promise<Response>;
12
11
  fetchBinaryRange(url: string, start: number, end: number, options?: {
13
12
  headers?: HeadersInit;
14
- signal?: AbortSignal;
13
+ stopToken?: string;
15
14
  }): Promise<BinaryRangeResponse>;
16
15
  }
@@ -3,8 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RemoteFileWithRangeCache = void 0;
4
4
  exports.clearCache = clearCache;
5
5
  const http_range_fetcher_1 = require("@gmod/http-range-fetcher");
6
- const buffer_1 = require("buffer");
7
- const generic_filehandle_1 = require("generic-filehandle");
6
+ const generic_filehandle2_1 = require("generic-filehandle2");
8
7
  const fetchers = {};
9
8
  function binaryRangeFetch(url, start, end, options = {}) {
10
9
  const fetcher = fetchers[url];
@@ -15,21 +14,20 @@ function binaryRangeFetch(url, start, end, options = {}) {
15
14
  }
16
15
  const globalRangeCache = new http_range_fetcher_1.HttpRangeFetcher({
17
16
  fetch: binaryRangeFetch,
18
- size: 500 * 1024 ** 2, // 500MiB
19
- chunkSize: 128 * 1024, // 128KiB
20
- maxFetchSize: 100 * 1024 ** 2, // 100MiB
21
- minimumTTL: 24 * 60 * 60 * 1000, // 1 day
17
+ size: 500 * 1024 ** 2,
18
+ chunkSize: 128 * 1024,
19
+ maxFetchSize: 100 * 1024 ** 2,
20
+ minimumTTL: 24 * 60 * 60 * 1000,
22
21
  });
23
22
  function clearCache() {
24
23
  globalRangeCache.reset();
25
24
  }
26
- class RemoteFileWithRangeCache extends generic_filehandle_1.RemoteFile {
25
+ class RemoteFileWithRangeCache extends generic_filehandle2_1.RemoteFile {
27
26
  async fetch(url, init) {
28
27
  const str = String(url);
29
28
  if (!fetchers[str]) {
30
29
  fetchers[str] = this.fetchBinaryRange.bind(this);
31
30
  }
32
- // if it is a range request, route it through the range cache
33
31
  const range = new Headers(init === null || init === void 0 ? void 0 : init.headers).get('range');
34
32
  if (range) {
35
33
  const rangeParse = /bytes=(\d+)-(\d+)/.exec(range);
@@ -38,8 +36,11 @@ class RemoteFileWithRangeCache extends generic_filehandle_1.RemoteFile {
38
36
  const s = Number.parseInt(start, 10);
39
37
  const e = Number.parseInt(end, 10);
40
38
  const len = e - s;
41
- const { buffer, headers } = (await globalRangeCache.getRange(url, s, len + 1, { signal: init === null || init === void 0 ? void 0 : init.signal }));
42
- return new Response(buffer, { status: 206, headers });
39
+ const { buffer, headers } = (await globalRangeCache.getRange(`${url}`, s, len + 1));
40
+ return new Response(buffer, {
41
+ status: 206,
42
+ headers,
43
+ });
43
44
  }
44
45
  }
45
46
  return super.fetch(url, init);
@@ -59,19 +60,16 @@ class RemoteFileWithRangeCache extends generic_filehandle_1.RemoteFile {
59
60
  const hint = ' (should be 206 for range requests)';
60
61
  throw new Error(`${errorMessage}${res.status === 200 ? hint : ''}`);
61
62
  }
62
- // translate the Headers object into a regular key -> value object.
63
- // will miss duplicate headers of course
64
63
  const headers = {};
65
64
  for (const [k, v] of res.headers.entries()) {
66
65
  headers[k] = v;
67
66
  }
68
- // return the response headers, and the data buffer
69
67
  const arrayBuffer = await res.arrayBuffer();
70
68
  return {
71
69
  headers,
72
70
  requestDate,
73
71
  responseDate,
74
- buffer: buffer_1.Buffer.from(arrayBuffer),
72
+ buffer: new Uint8Array(arrayBuffer),
75
73
  };
76
74
  }
77
75
  }
@@ -1,7 +1,6 @@
1
- import { GenericFilehandle, Fetcher } from 'generic-filehandle';
2
- import { FileLocation, UriLocation } from '../types';
3
- import PluginManager from '../../PluginManager';
4
- /** if a UriLocation has a baseUri, resolves its uri with respect to that base */
1
+ import type PluginManager from '../../PluginManager';
2
+ import type { FileLocation, UriLocation } from '../types';
3
+ import type { Fetcher, GenericFilehandle } from 'generic-filehandle2';
5
4
  export declare function resolveUriLocation(location: UriLocation): UriLocation;
6
5
  export declare function openLocation(location: FileLocation, pluginManager?: PluginManager): GenericFilehandle;
7
6
  export declare function getFetcher(location: FileLocation, pluginManager?: PluginManager): Fetcher;
package/util/io/index.js CHANGED
@@ -7,20 +7,18 @@ exports.RemoteFileWithRangeCache = void 0;
7
7
  exports.resolveUriLocation = resolveUriLocation;
8
8
  exports.openLocation = openLocation;
9
9
  exports.getFetcher = getFetcher;
10
- const generic_filehandle_1 = require("generic-filehandle");
11
10
  const detect_node_1 = __importDefault(require("detect-node"));
12
- // locals
11
+ const generic_filehandle2_1 = require("generic-filehandle2");
13
12
  const RemoteFileWithRangeCache_1 = require("./RemoteFileWithRangeCache");
14
- const types_1 = require("../types");
15
- const tracks_1 = require("../tracks");
16
13
  const __1 = require("../");
14
+ const tracks_1 = require("../tracks");
15
+ const types_1 = require("../types");
17
16
  function isLocalPathLocation(location) {
18
17
  return 'localPath' in location;
19
18
  }
20
19
  function isBlobLocation(location) {
21
20
  return 'blobId' in location;
22
21
  }
23
- /** if a UriLocation has a baseUri, resolves its uri with respect to that base */
24
22
  function resolveUriLocation(location) {
25
23
  return location.baseUri
26
24
  ? { ...location, uri: new URL(location.uri, location.baseUri).href }
@@ -32,36 +30,30 @@ function openLocation(location, pluginManager) {
32
30
  throw new Error('No local path provided');
33
31
  }
34
32
  if (detect_node_1.default || __1.isElectron) {
35
- return new generic_filehandle_1.LocalFile(location.localPath);
33
+ return new generic_filehandle2_1.LocalFile(location.localPath);
36
34
  }
37
35
  else {
38
36
  throw new Error("can't use local files in the browser");
39
37
  }
40
38
  }
41
39
  if (isBlobLocation(location)) {
42
- // special case where blob is not directly stored on the model, use a getter
43
40
  const blob = (0, tracks_1.getBlob)(location.blobId);
44
41
  if (!blob) {
45
42
  throw new Error(`file ("${location.name}") was opened locally from a previous session. To restore it, go to track settings and reopen the file`);
46
43
  }
47
- return new generic_filehandle_1.BlobFile(blob);
44
+ return new generic_filehandle2_1.BlobFile(blob);
48
45
  }
49
46
  if ((0, types_1.isUriLocation)(location)) {
50
- // Check for empty string
51
47
  if (!location.uri) {
52
48
  throw new Error('No URI provided');
53
49
  }
54
- // Resolve any relative URLs to absolute URLs
55
50
  const absoluteLocation = resolveUriLocation(location);
56
- // If there is a plugin manager, we can try internet accounts
57
51
  if (pluginManager) {
58
52
  const internetAccount = getInternetAccount(location, pluginManager);
59
- // If an internetAccount was found, use it to open the location
60
53
  if (internetAccount) {
61
54
  return internetAccount.openLocation(absoluteLocation);
62
55
  }
63
56
  }
64
- // Otherwise fall back on usual open
65
57
  return new RemoteFileWithRangeCache_1.RemoteFileWithRangeCache(absoluteLocation.uri, {
66
58
  fetch: checkAuthNeededFetch,
67
59
  });
@@ -82,12 +74,9 @@ function getFetcher(location, pluginManager) {
82
74
  }
83
75
  function getInternetAccount(location, pluginManager) {
84
76
  const { rootModel } = pluginManager;
85
- // If there is an appRootModel, use it to find the internetAccount
86
77
  if (rootModel && (0, types_1.isRootModelWithInternetAccounts)(rootModel)) {
87
78
  return rootModel.findAppropriateInternetAccount(location);
88
79
  }
89
- // If there is no appRootModel, but there is pre-auth, create a temporary
90
- // internetAccount. This is typical in a worker.
91
80
  if (location.internetAccountPreAuthorization) {
92
81
  if (!location.internetAccountPreAuthorization.authInfo.token) {
93
82
  throw new Error('Failed to obtain token from internet account. Try reloading the page');
@@ -101,9 +90,6 @@ function getInternetAccount(location, pluginManager) {
101
90
  }
102
91
  return undefined;
103
92
  }
104
- // This fetch throws a special error if the response is "401" and includes a
105
- // "WWW-Authenticate: Basic" header. This is so downstream code can retry if
106
- // needed with HTTP Basic authentication included
107
93
  async function checkAuthNeededFetch(url, opts) {
108
94
  var _a;
109
95
  const response = await fetch(url, opts);
package/util/jexl.js CHANGED
@@ -5,23 +5,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = JexlF;
7
7
  const jexl_1 = __importDefault(require("jexl"));
8
- function JexlF( /* config?: any*/) {
8
+ function JexlF() {
9
9
  const j = new jexl_1.default.Jexl();
10
- // someday will make sure all of configs callbacks are added in, including
11
- // ones passed in
12
- // below are core functions
13
10
  j.addFunction('get', (feature, data) => feature.get(data));
14
11
  j.addFunction('parent', (feature) => feature.parent());
15
12
  j.addFunction('id', (feature) => feature.id());
16
- // let user cast a jexl type into a javascript type
17
13
  j.addFunction('cast', (arg) => arg);
18
- // logging
19
14
  j.addFunction('log', (thing) => {
20
- console.log(thing); // eslint-disable-line no-console
15
+ console.log(thing);
21
16
  return thing;
22
17
  });
23
- // math
24
- // addfunction added in jexl 2.3 but types/jexl still on 2.2
25
18
  j.addFunction('max', Math.max);
26
19
  j.addFunction('min', Math.min);
27
20
  j.addFunction('sqrt', Math.sqrt);
@@ -32,7 +25,6 @@ function JexlF( /* config?: any*/) {
32
25
  j.addFunction('log10', Math.log10);
33
26
  j.addFunction('parseInt', Number.parseInt);
34
27
  j.addFunction('parseFloat', Number.parseFloat);
35
- // string
36
28
  j.addFunction('split', (s, char) => s.split(char));
37
29
  j.addFunction('charAt', (s, index) => s.charAt(index));
38
30
  j.addFunction('charCodeAt', (s, index) => s.charCodeAt(index));
@@ -46,9 +38,7 @@ function JexlF( /* config?: any*/) {
46
38
  j.addFunction('replaceAll', (s, match, sub) => s.replaceAll(match, sub));
47
39
  j.addFunction('slice', (s, start, end) => s.slice(start, end));
48
40
  j.addFunction('startsWith', (s, search, pos) => s.startsWith(search, pos));
49
- j.addFunction('substring', (s, start, end) =>
50
- // eslint-disable-next-line unicorn/prefer-string-slice
51
- s.substring(start, end));
41
+ j.addFunction('substring', (s, start, end) => s.substring(start, end));
52
42
  j.addFunction('toLowerCase', (s) => s.toLowerCase());
53
43
  j.addFunction('toUpperCase', (s) => s.toUpperCase());
54
44
  j.addFunction('jsonParse', (s) => JSON.parse(s));
@@ -1,7 +1 @@
1
- /**
2
- * compile a jexlExpression to a string
3
- *
4
- * @param str - string of code like `jexl:...`
5
- * @param options -
6
- */
7
1
  export declare function stringToJexlExpression(str: string, jexl?: any): any;
@@ -6,14 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.stringToJexlExpression = stringToJexlExpression;
7
7
  const jexl_1 = __importDefault(require("./jexl"));
8
8
  const compilationCache = {};
9
- // revert function strings back to main, create a different file for
10
- // jexlStrings.ts pass the jexl property of the pluginManager as a param
11
- /**
12
- * compile a jexlExpression to a string
13
- *
14
- * @param str - string of code like `jexl:...`
15
- * @param options -
16
- */
17
9
  function stringToJexlExpression(str, jexl) {
18
10
  const cacheKey = `nosig|${str}`;
19
11
  if (!compilationCache[cacheKey]) {
@@ -2,7 +2,7 @@ export type RectTuple = [number, number, number, number];
2
2
  export interface SerializedLayout {
3
3
  rectangles: Record<string, RectTuple>;
4
4
  totalHeight: number;
5
- containsNoTransferables: true;
5
+ containsNoTransferables?: true;
6
6
  maxHeightReached: boolean;
7
7
  }
8
8
  export interface Rectangle<T> {
@@ -1,4 +1,4 @@
1
- import { RectTuple, SerializedLayout, Rectangle, BaseLayout } from './BaseLayout';
1
+ import type { BaseLayout, RectTuple, Rectangle, SerializedLayout } from './BaseLayout';
2
2
  export default class GranularRectLayout<T> implements BaseLayout<T> {
3
3
  private pitchX;
4
4
  private pitchY;
@@ -9,11 +9,6 @@ export default class GranularRectLayout<T> implements BaseLayout<T> {
9
9
  private maxHeight;
10
10
  private displayMode;
11
11
  private pTotalHeight;
12
- /**
13
- * pitchX - layout grid pitch in the X direction
14
- * pitchY - layout grid pitch in the Y direction
15
- * maxHeight - maximum layout height, default Infinity (no max)
16
- */
17
12
  constructor({ pitchX, pitchY, maxHeight, hardRowLimit, displayMode, }?: {
18
13
  pitchX?: number;
19
14
  pitchY?: number;
@@ -21,21 +16,10 @@ export default class GranularRectLayout<T> implements BaseLayout<T> {
21
16
  displayMode?: string;
22
17
  hardRowLimit?: number;
23
18
  });
24
- /**
25
- * @returns top position for the rect, or Null if laying
26
- * out the rect would exceed maxHeight
27
- */
28
19
  addRect(id: string, left: number, right: number, height: number, data?: T): number | null;
29
20
  collides(rect: Rectangle<T>, top: number): boolean;
30
- /**
31
- * make a subarray if it does not exist
32
- */
33
21
  private autovivifyRow;
34
22
  addRectToBitmap(rect: Rectangle<T>): void;
35
- /**
36
- * Given a range of X coordinates, deletes all data dealing with
37
- * the features.
38
- */
39
23
  discardRange(left: number, right: number): void;
40
24
  hasSeen(id: string): boolean;
41
25
  getByCoord(x: number, y: number): string | Record<string, T> | undefined;
@@ -1,29 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * Rectangle-layout manager that lays out rectangles using bitmaps at
5
- * resolution that, for efficiency, may be somewhat lower than that of
6
- * the coordinate system for the rectangles being laid out. `pitchX`
7
- * and `pitchY` are the ratios of input scale resolution to internal
8
- * bitmap resolution.
9
- */
10
- // minimum excess size of the array at which we garbage collect
11
3
  const minSizeToBotherWith = 10000;
12
4
  const maxFeaturePitchWidth = 20000;
13
5
  function segmentsIntersect(x1, x2, y1, y2) {
14
6
  return x2 >= y1 && y2 >= x1;
15
7
  }
16
- // a single row in the layout
17
8
  class LayoutRow {
18
9
  constructor() {
19
10
  this.padding = 1;
20
11
  this.widthLimit = 1000000;
21
12
  }
22
- // this.rowState.bits is the array of items in the layout row, indexed by (x - this.offset)
23
- // this.rowState.min is the leftmost edge of all the rectangles we have in the layout
24
- // this.rowState.max is the rightmost edge of all the rectangles we have in the layout
25
- // this.rowState.offset is the offset of the bits array relative to the genomic coordinates
26
- // (modified by pitchX, but we don't know that in this class)
27
13
  setAllFilled(data) {
28
14
  this.allFilled = data;
29
15
  }
@@ -56,8 +42,6 @@ class LayoutRow {
56
42
  }
57
43
  return flag;
58
44
  }
59
- // NOTE: this.rowState.min, this.rowState.max, and this.rowState.offset are
60
- // interbase coordinates
61
45
  initialize(left, right) {
62
46
  const rectWidth = right - left;
63
47
  return {
@@ -69,15 +53,13 @@ class LayoutRow {
69
53
  }
70
54
  addRect(rect, data) {
71
55
  const left = rect.l;
72
- const right = rect.r + this.padding; // only padding on the right
56
+ const right = rect.r + this.padding;
73
57
  if (!this.rowState) {
74
58
  this.rowState = this.initialize(left, right);
75
59
  }
76
- // or check if we need to expand to the left and/or to the right
77
60
  let oLeft = left - this.rowState.offset;
78
61
  let oRight = right - this.rowState.offset;
79
62
  const currLength = this.rowState.bits.length;
80
- // expand rightward if necessary
81
63
  if (oRight >= this.rowState.bits.length) {
82
64
  const additionalLength = oRight + 1;
83
65
  if (this.rowState.bits.length + additionalLength > this.widthLimit) {
@@ -91,9 +73,7 @@ class LayoutRow {
91
73
  ];
92
74
  }
93
75
  }
94
- // expand leftward if necessary
95
76
  if (left < this.rowState.offset) {
96
- // use math.min to avoid negative lengths
97
77
  const additionalLength = Math.min(currLength - oLeft, this.rowState.offset);
98
78
  if (this.rowState.bits.length + additionalLength > this.widthLimit) {
99
79
  console.warn('Layout width limit exceeded, discarding old layout. Please be more careful about discarding unused blocks.');
@@ -123,82 +103,51 @@ class LayoutRow {
123
103
  this.rowState.max = right;
124
104
  }
125
105
  }
126
- /**
127
- * Given a range of interbase coordinates, deletes all data dealing with that range
128
- */
129
106
  discardRange(left, right) {
130
107
  if (this.allFilled) {
131
108
  return;
132
- } // allFilled is irrevocable currently
133
- // if we have no data, do nothing
109
+ }
134
110
  if (!this.rowState) {
135
111
  return;
136
112
  }
137
- // if doesn't overlap at all, do nothing
138
113
  if (right <= this.rowState.min || left >= this.rowState.max) {
139
114
  return;
140
115
  }
141
- // if completely encloses range, discard everything
142
116
  if (left <= this.rowState.min && right >= this.rowState.max) {
143
117
  this.rowState = undefined;
144
118
  return;
145
119
  }
146
- // if overlaps left edge, adjust the min
147
120
  if (right > this.rowState.min && left <= this.rowState.min) {
148
121
  this.rowState.min = right;
149
122
  }
150
- // if overlaps right edge, adjust the max
151
123
  if (left < this.rowState.max && right >= this.rowState.max) {
152
124
  this.rowState.max = left;
153
125
  }
154
- // now trim the left, right, or both sides of the array
155
126
  if (this.rowState.offset < this.rowState.min - minSizeToBotherWith &&
156
127
  this.rowState.bits.length >
157
128
  this.rowState.max + minSizeToBotherWith - this.rowState.offset) {
158
- // trim both sides
159
129
  const leftTrimAmount = this.rowState.min - this.rowState.offset;
160
130
  const rightTrimAmount = this.rowState.bits.length -
161
131
  1 -
162
132
  (this.rowState.max - this.rowState.offset);
163
- // if (rightTrimAmount <= 0) debugger
164
- // if (leftTrimAmount <= 0) debugger
165
- // this.log(`trim both sides, ${leftTrimAmount} from left, ${rightTrimAmount} from right`)
166
133
  this.rowState.bits = this.rowState.bits.slice(leftTrimAmount, this.rowState.bits.length - rightTrimAmount);
167
134
  this.rowState.offset += leftTrimAmount;
168
- // if (this.rowState.offset > this.rowState.min) debugger
169
- // if (this.rowState.bits.length <= this.rowState.max - this.rowState.offset) debugger
170
135
  }
171
136
  else if (this.rowState.offset < this.rowState.min - minSizeToBotherWith) {
172
- // trim left side
173
137
  const desiredOffset = this.rowState.min - Math.floor(minSizeToBotherWith / 2);
174
138
  const trimAmount = desiredOffset - this.rowState.offset;
175
- // this.log(`trim left side by ${trimAmount}`)
176
139
  this.rowState.bits.splice(0, trimAmount);
177
140
  this.rowState.offset += trimAmount;
178
- // if (this.rowState.offset > this.rowState.min) debugger
179
- // if (this.rowState.bits.length <= this.rowState.max - this.rowState.offset) debugger
180
141
  }
181
142
  else if (this.rowState.bits.length >
182
143
  this.rowState.max - this.rowState.offset + minSizeToBotherWith) {
183
- // trim right side
184
144
  const desiredLength = this.rowState.max -
185
145
  this.rowState.offset +
186
146
  1 +
187
147
  Math.floor(minSizeToBotherWith / 2);
188
- // this.log(`trim right side by ${this.rowState.bits.length-desiredLength}`)
189
- // if (desiredLength > this.rowState.bits.length) debugger
190
148
  this.rowState.bits.length = desiredLength;
191
- // if (this.rowState.offset > this.rowState.min) debugger
192
- // if (this.rowState.bits.length <= this.rowState.max - this.rowState.offset) debugger
193
149
  }
194
- // if (this.rowState.offset > this.rowState.min) debugger
195
- // if (this.rowState.bits.length <= this.rowState.max - this.rowState.offset) debugger
196
- // if range now enclosed in the new bounds, loop through and clear the bits
197
150
  const oLeft = Math.max(this.rowState.min, left) - this.rowState.offset;
198
- // if (oLeft < 0) debugger
199
- // if (oLeft >= this.rowState.bits.length) debugger
200
- // if (oRight < 0) debugger
201
- // if (oRight >= this.rowState.bits.length) debugger
202
151
  const oRight = Math.min(right, this.rowState.max) - this.rowState.offset;
203
152
  for (let x = oLeft; x >= 0 && x < oRight; x += 1) {
204
153
  this.rowState.bits[x] = undefined;
@@ -206,18 +155,12 @@ class LayoutRow {
206
155
  }
207
156
  }
208
157
  class GranularRectLayout {
209
- /**
210
- * pitchX - layout grid pitch in the X direction
211
- * pitchY - layout grid pitch in the Y direction
212
- * maxHeight - maximum layout height, default Infinity (no max)
213
- */
214
158
  constructor({ pitchX = 10, pitchY = 10, maxHeight = 10000, hardRowLimit = 10000, displayMode = 'normal', } = {}) {
215
159
  this.pitchX = pitchX;
216
160
  this.pitchY = pitchY;
217
161
  this.hardRowLimit = hardRowLimit;
218
162
  this.maxHeightReached = false;
219
163
  this.displayMode = displayMode;
220
- // reduce the pitchY to try and pack the features tighter
221
164
  if (this.displayMode === 'compact') {
222
165
  this.pitchY = Math.round(this.pitchY / 4) || 1;
223
166
  this.pitchX = Math.round(this.pitchX / 4) || 1;
@@ -225,21 +168,14 @@ class GranularRectLayout {
225
168
  this.bitmap = [];
226
169
  this.rectangles = new Map();
227
170
  this.maxHeight = Math.ceil(maxHeight / this.pitchY);
228
- this.pTotalHeight = 0; // total height, in units of bitmap squares (px/pitchY)
171
+ this.pTotalHeight = 0;
229
172
  }
230
- /**
231
- * @returns top position for the rect, or Null if laying
232
- * out the rect would exceed maxHeight
233
- */
234
173
  addRect(id, left, right, height, data) {
235
- // if we have already laid it out, return its layout
236
174
  const storedRec = this.rectangles.get(id);
237
175
  if (storedRec) {
238
176
  if (storedRec.top === null) {
239
177
  return null;
240
178
  }
241
- // add it to the bitmap again, since that bitmap range may have been
242
- // discarded
243
179
  this.addRectToBitmap(storedRec);
244
180
  return storedRec.top * this.pitchY;
245
181
  }
@@ -287,9 +223,6 @@ class GranularRectLayout {
287
223
  }
288
224
  return false;
289
225
  }
290
- /**
291
- * make a subarray if it does not exist
292
- */
293
226
  autovivifyRow(bitmap, y) {
294
227
  let row = bitmap[y];
295
228
  if (!row) {
@@ -308,11 +241,6 @@ class GranularRectLayout {
308
241
  const data = rect.id;
309
242
  const yEnd = rect.top + rect.h;
310
243
  if (rect.r - rect.l > maxFeaturePitchWidth) {
311
- // the rect is very big in relation to the view size, just pretend, for
312
- // the purposes of layout, that it extends infinitely. this will cause
313
- // weird layout if a user scrolls manually for a very, very long time
314
- // along the genome at the same zoom level. but most users will not do
315
- // that. hopefully.
316
244
  for (let y = rect.top; y < yEnd; y += 1) {
317
245
  this.autovivifyRow(this.bitmap, y).setAllFilled(data);
318
246
  }
@@ -323,10 +251,6 @@ class GranularRectLayout {
323
251
  }
324
252
  }
325
253
  }
326
- /**
327
- * Given a range of X coordinates, deletes all data dealing with
328
- * the features.
329
- */
330
254
  discardRange(left, right) {
331
255
  const pLeft = Math.floor(left / this.pitchX);
332
256
  const pRight = Math.floor(right / this.pitchX);
@@ -376,7 +300,7 @@ class GranularRectLayout {
376
300
  const { l, r, originalHeight, top } = rect;
377
301
  const t = (top || 0) * this.pitchY;
378
302
  const b = t + originalHeight;
379
- return [id, [l * this.pitchX, t, r * this.pitchX, b]]; // left, top, right, bottom
303
+ return [id, [l * this.pitchX, t, r * this.pitchX, b]];
380
304
  }));
381
305
  }
382
306
  serializeRegion(region) {
@@ -394,7 +318,6 @@ class GranularRectLayout {
394
318
  const y2 = r * this.pitchX;
395
319
  const x1 = region.start;
396
320
  const x2 = region.end;
397
- // add +/- pitchX to avoid resolution causing errors
398
321
  if (segmentsIntersect(x1, x2, y1 - this.pitchX, y2 + this.pitchX)) {
399
322
  regionRectangles[id] = [y1, t, y2, b];
400
323
  }
@@ -1,13 +1,8 @@
1
- import { BaseLayout, SerializedLayout } from './BaseLayout';
1
+ import type { BaseLayout, SerializedLayout } from './BaseLayout';
2
2
  export default class MultiLayout<SUB_LAYOUT_CLASS extends BaseLayout<T>, T> {
3
3
  SubLayoutClass: new (...args: any[]) => SUB_LAYOUT_CLASS;
4
4
  subLayoutConstructorArgs: Record<string, any>;
5
5
  subLayouts: Map<string, SUB_LAYOUT_CLASS>;
6
- /**
7
- * layout class that just keeps a number of named sub-layouts.
8
- * basically just a fancier
9
- * `{ layout1: new GranularRectLayout(), layout2: new GranularRectLayout() ...}`
10
- */
11
6
  constructor(SubLayoutClass: new (...args: any[]) => SUB_LAYOUT_CLASS, subLayoutConstructorArgs?: Record<string, any>);
12
7
  getDataByID(id: string): unknown;
13
8
  getSublayout(layoutName: string): SUB_LAYOUT_CLASS;
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  class MultiLayout {
4
- /**
5
- * layout class that just keeps a number of named sub-layouts.
6
- * basically just a fancier
7
- * `{ layout1: new GranularRectLayout(), layout2: new GranularRectLayout() ...}`
8
- */
9
4
  constructor(SubLayoutClass, subLayoutConstructorArgs = {}) {
10
5
  this.SubLayoutClass = SubLayoutClass;
11
6
  this.subLayoutConstructorArgs = subLayoutConstructorArgs;
@@ -13,7 +8,6 @@ class MultiLayout {
13
8
  }
14
9
  getDataByID(id) {
15
10
  for (const layout of this.subLayouts.values()) {
16
- // @ts-expect-error
17
11
  const r = layout.getDataByID(id);
18
12
  if (r) {
19
13
  return r;
@@ -1,4 +1,4 @@
1
- import { RectTuple, SerializedLayout, BaseLayout, Rectangle } from './BaseLayout';
1
+ import type { BaseLayout, RectTuple, Rectangle, SerializedLayout } from './BaseLayout';
2
2
  export interface Layout {
3
3
  minX: number;
4
4
  minY: number;
@@ -13,9 +13,6 @@ export default class PrecomputedLayout<T> implements BaseLayout<T> {
13
13
  private rbush;
14
14
  constructor({ rectangles, totalHeight, maxHeightReached }: SerializedLayout);
15
15
  addRect(id: string): number;
16
- /**
17
- * returns a Map of `feature id -> rectangle`
18
- */
19
16
  getRectangles(): Map<string, RectTuple>;
20
17
  getTotalHeight(): number;
21
18
  collides(_rect: Rectangle<T>, _top: number): boolean;
@@ -7,7 +7,6 @@ const rbush_1 = __importDefault(require("rbush"));
7
7
  class PrecomputedLayout {
8
8
  constructor({ rectangles, totalHeight, maxHeightReached }) {
9
9
  this.rectangles = new Map(Object.entries(rectangles));
10
- // rectangles is of the form "featureId": [leftPx, topPx, rightPx, bottomPx]
11
10
  this.totalHeight = totalHeight;
12
11
  this.maxHeightReached = maxHeightReached;
13
12
  this.rbush = new rbush_1.default();
@@ -26,12 +25,8 @@ class PrecomputedLayout {
26
25
  if (!rect) {
27
26
  throw new Error(`id ${id} not found in precomputed feature layout`);
28
27
  }
29
- // left, top, right, bottom
30
28
  return rect[1];
31
29
  }
32
- /**
33
- * returns a Map of `feature id -> rectangle`
34
- */
35
30
  getRectangles() {
36
31
  return this.rectangles;
37
32
  }
@@ -12,8 +12,6 @@ class ThrowingLayout {
12
12
  }
13
13
  class PrecomputedMultiLayout extends MultiLayout_1.default {
14
14
  constructor(json) {
15
- // use ThrowingLayout because there is not supposed to be any creation
16
- // of new layouts in a precomputed layout
17
15
  super(ThrowingLayout);
18
16
  Object.entries(json).forEach(([layoutName, sublayoutJson]) => {
19
17
  this.subLayouts.set(layoutName, new PrecomputedLayout_1.default(sublayoutJson));
@@ -17,21 +17,9 @@ export default class SceneGraph {
17
17
  private children;
18
18
  private absoluteCache;
19
19
  parent?: SceneGraph;
20
- /**
21
- * note: all coordinates are inter-base or inter-pixel coordinates
22
- */
23
20
  constructor(name: string, left: number, top: number, width: number, height: number, data?: Record<string, any> | undefined);
24
21
  addChild(nameOrSceneGraph: string | SceneGraph, left: number, top: number, width: number, height: number, data?: Record<string, any>): SceneGraph;
25
22
  getSubRecord(name: string): SceneGraph | undefined;
26
- /**
27
- * if the record does not already cover the given absolute extents, extend it
28
- * to cover them
29
- *
30
- * @param left -
31
- * @param right -
32
- * @param top -
33
- * @param bottom -
34
- */
35
23
  expand(newLeft: number, newRight: number, newTop: number, newBottom: number): void;
36
24
  get bottom(): number;
37
25
  get right(): number;