@jbrowse/core 1.4.1 → 1.5.2

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 (159) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail.d.ts +4 -4
  2. package/BaseFeatureWidget/BaseFeatureDetail.js +27 -8
  3. package/BaseFeatureWidget/SequenceFeatureDetails.js +10 -10
  4. package/BaseFeatureWidget/index.js +1 -1
  5. package/BaseFeatureWidget/types.d.ts +1 -1
  6. package/BaseFeatureWidget/util.js +3 -3
  7. package/CorePlugin.d.ts +0 -1
  8. package/CorePlugin.js +13 -1
  9. package/PluginLoader.d.ts +26 -4
  10. package/PluginLoader.js +337 -51
  11. package/PluginManager.d.ts +18 -11
  12. package/PluginManager.js +53 -31
  13. package/ReExports/list.js +1 -1
  14. package/ReExports/material-ui-colors.js +38 -38
  15. package/ReExports/modules.d.ts +19 -20
  16. package/ReExports/modules.js +10 -3
  17. package/TextSearch/BaseResults.d.ts +5 -14
  18. package/TextSearch/BaseResults.js +16 -58
  19. package/TextSearch/BaseResults.test.js +1 -11
  20. package/TextSearch/TextSearchManager.d.ts +3 -3
  21. package/TextSearch/TextSearchManager.js +1 -1
  22. package/assemblyManager/assembly.d.ts +21 -8
  23. package/assemblyManager/assembly.js +163 -120
  24. package/assemblyManager/assemblyConfigSchema.d.ts +3 -0
  25. package/assemblyManager/{assemblyConfigSchemas.js → assemblyConfigSchema.js} +35 -27
  26. package/assemblyManager/assemblyManager.d.ts +169 -60
  27. package/assemblyManager/index.d.ts +1 -1
  28. package/assemblyManager/index.js +5 -5
  29. package/configuration/configurationSchema.d.ts +3 -2
  30. package/configuration/configurationSchema.js +7 -10
  31. package/configuration/configurationSchema.test.js +4 -2
  32. package/configuration/configurationSlot.js +5 -4
  33. package/configuration/index.js +4 -4
  34. package/configuration/util.js +5 -5
  35. package/data_adapters/BaseAdapter.d.ts +5 -3
  36. package/data_adapters/BaseAdapter.js +7 -4
  37. package/data_adapters/BaseAdapter.test.js +4 -2
  38. package/data_adapters/CytobandAdapter.d.ts +8 -0
  39. package/data_adapters/CytobandAdapter.js +128 -0
  40. package/data_adapters/dataAdapterCache.js +3 -3
  41. package/package.json +7 -6
  42. package/pluggableElementTypes/AdapterType.d.ts +9 -1
  43. package/pluggableElementTypes/AdapterType.js +20 -0
  44. package/pluggableElementTypes/InternetAccountType.d.ts +12 -0
  45. package/pluggableElementTypes/InternetAccountType.js +64 -0
  46. package/pluggableElementTypes/PluggableElementBase.d.ts +1 -2
  47. package/pluggableElementTypes/PluggableElementBase.js +2 -3
  48. package/pluggableElementTypes/RpcMethodType.d.ts +3 -0
  49. package/pluggableElementTypes/RpcMethodType.js +269 -26
  50. package/pluggableElementTypes/RpcMethodType.test.d.ts +4 -0
  51. package/pluggableElementTypes/RpcMethodType.test.js +118 -0
  52. package/pluggableElementTypes/ViewType.d.ts +1 -1
  53. package/pluggableElementTypes/WidgetType.d.ts +1 -0
  54. package/pluggableElementTypes/index.d.ts +7 -3
  55. package/pluggableElementTypes/index.js +127 -1
  56. package/pluggableElementTypes/models/BaseDisplayModel.d.ts +6 -6
  57. package/pluggableElementTypes/models/BaseDisplayModel.js +1 -3
  58. package/pluggableElementTypes/models/BaseViewModel.js +13 -15
  59. package/pluggableElementTypes/models/InternetAccountModel.d.ts +24 -0
  60. package/pluggableElementTypes/models/InternetAccountModel.js +85 -0
  61. package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +4 -0
  62. package/pluggableElementTypes/models/baseInternetAccountConfig.js +25 -0
  63. package/pluggableElementTypes/models/index.d.ts +3 -0
  64. package/pluggableElementTypes/models/index.js +24 -8
  65. package/pluggableElementTypes/renderers/BoxRendererType.js +1 -1
  66. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +1 -1
  67. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +15 -6
  68. package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +3 -3
  69. package/pluggableElementTypes/renderers/FeatureRendererType.js +17 -8
  70. package/pluggableElementTypes/renderers/RendererType.d.ts +1 -0
  71. package/pluggableElementTypes/renderers/RendererType.js +4 -1
  72. package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +1 -1
  73. package/pluggableElementTypes/renderers/index.d.ts +9 -0
  74. package/pluggableElementTypes/renderers/index.js +63 -0
  75. package/rpc/BaseRpcDriver.js +5 -9
  76. package/rpc/BaseRpcDriver.test.js +6 -6
  77. package/rpc/RpcManager.d.ts +1 -1
  78. package/rpc/RpcManager.js +44 -16
  79. package/rpc/WebWorkerRpcDriver.js +3 -3
  80. package/rpc/coreRpcMethods.d.ts +2 -1
  81. package/rpc/coreRpcMethods.js +109 -75
  82. package/rpc/remoteAbortSignals.js +2 -2
  83. package/ui/App.d.ts +17 -4
  84. package/ui/App.js +55 -41
  85. package/ui/Drawer.d.ts +6 -14
  86. package/ui/Drawer.js +11 -12
  87. package/ui/DrawerWidget.d.ts +5 -3
  88. package/ui/DrawerWidget.js +100 -61
  89. package/ui/ErrorMessage.d.ts +5 -0
  90. package/ui/ErrorMessage.js +54 -0
  91. package/ui/FileSelector/FileSelector.d.ts +11 -0
  92. package/ui/FileSelector/FileSelector.js +198 -0
  93. package/ui/FileSelector/LocalFileChooser.d.ts +7 -0
  94. package/ui/FileSelector/LocalFileChooser.js +79 -0
  95. package/ui/FileSelector/UrlChooser.d.ts +9 -0
  96. package/ui/FileSelector/UrlChooser.js +41 -0
  97. package/ui/FileSelector/index.d.ts +2 -0
  98. package/ui/FileSelector/index.js +13 -0
  99. package/ui/Icons.d.ts +4 -0
  100. package/ui/Icons.js +34 -0
  101. package/ui/Logo.js +1 -1
  102. package/ui/PrerenderedCanvas.d.ts +1 -0
  103. package/ui/PrerenderedCanvas.js +4 -1
  104. package/ui/ResizeHandle.d.ts +2 -3
  105. package/ui/ResizeHandle.js +6 -7
  106. package/ui/SanitizedHTML.js +1 -1
  107. package/ui/Snackbar.js +4 -6
  108. package/ui/SnackbarModel.d.ts +16 -0
  109. package/ui/SnackbarModel.js +56 -0
  110. package/ui/Tooltip.d.ts +1 -1
  111. package/ui/index.js +24 -24
  112. package/ui/theme.js +5 -5
  113. package/util/QuickLRU.d.ts +1 -1
  114. package/util/QuickLRU.js +3 -3
  115. package/util/aborting.d.ts +1 -1
  116. package/util/aborting.js +10 -11
  117. package/util/analytics.d.ts +2 -2
  118. package/util/analytics.js +20 -7
  119. package/util/blockTypes.d.ts +11 -6
  120. package/util/blockTypes.js +7 -1
  121. package/util/color/cssColorsLevel4.js +1 -1
  122. package/util/color/index.js +5 -5
  123. package/util/compositeMap.js +3 -3
  124. package/util/index.d.ts +6 -16
  125. package/util/index.js +76 -100
  126. package/util/io/RemoteFileWithRangeCache.d.ts +17 -0
  127. package/util/io/RemoteFileWithRangeCache.js +266 -0
  128. package/util/io/index.d.ts +4 -2
  129. package/util/io/index.js +134 -25
  130. package/util/jexl.js +4 -1
  131. package/util/layouts/BaseLayout.d.ts +3 -0
  132. package/util/layouts/GranularRectLayout.d.ts +19 -10
  133. package/util/layouts/GranularRectLayout.js +459 -100
  134. package/util/layouts/GranularRectLayout.test.js +57 -10
  135. package/util/layouts/PrecomputedLayout.js +2 -1
  136. package/util/layouts/index.d.ts +7 -0
  137. package/util/layouts/index.js +68 -0
  138. package/util/mst-reflection.js +3 -3
  139. package/util/offscreenCanvasPonyfill.js +1 -1
  140. package/util/range.js +1 -1
  141. package/util/simpleFeature.js +1 -1
  142. package/util/stats.js +2 -2
  143. package/util/tracks.d.ts +31 -362
  144. package/util/tracks.js +74 -190
  145. package/util/types/index.d.ts +54 -10
  146. package/util/types/index.js +110 -8
  147. package/util/types/mst.d.ts +46 -2
  148. package/util/types/mst.js +56 -8
  149. package/util/types/util.d.ts +1 -1
  150. package/util/when.js +1 -1
  151. package/assemblyManager/assemblyConfigSchemas.d.ts +0 -7
  152. package/ui/FileSelector.d.ts +0 -9
  153. package/ui/FileSelector.js +0 -150
  154. package/util/io/LocalFile.d.ts +0 -18
  155. package/util/io/LocalFile.js +0 -220
  156. package/util/io/rangeFetcher.d.ts +0 -3
  157. package/util/io/rangeFetcher.js +0 -236
  158. package/value.d.ts +0 -1
  159. package/value.js +0 -10
package/util/tracks.js CHANGED
@@ -3,22 +3,25 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.getTrackAssemblyNames = getTrackAssemblyNames;
7
- exports.getRpcSessionId = getRpcSessionId;
8
- exports.getParentRenderProps = getParentRenderProps;
6
+ exports.UNSUPPORTED = exports.UNKNOWN = void 0;
7
+ exports.generateUnknownTrackConf = generateUnknownTrackConf;
8
+ exports.generateUnsupportedTrackConf = generateUnsupportedTrackConf;
9
9
  exports.getBlob = getBlob;
10
10
  exports.getBlobMap = getBlobMap;
11
- exports.setBlobMap = setBlobMap;
12
- exports.storeBlobLocation = storeBlobLocation;
11
+ exports.getFileName = getFileName;
12
+ exports.getParentRenderProps = getParentRenderProps;
13
+ exports.getRpcSessionId = getRpcSessionId;
14
+ exports.getTrackAssemblyNames = getTrackAssemblyNames;
13
15
  exports.guessAdapter = guessAdapter;
14
16
  exports.guessTrackType = guessTrackType;
15
- exports.generateUnsupportedTrackConf = generateUnsupportedTrackConf;
16
- exports.generateUnknownTrackConf = generateUnknownTrackConf;
17
- exports.UNSUPPORTED = exports.UNKNOWN = void 0;
17
+ exports.makeIndex = makeIndex;
18
+ exports.makeIndexType = makeIndexType;
19
+ exports.setBlobMap = setBlobMap;
20
+ exports.storeBlobLocation = storeBlobLocation;
18
21
 
19
22
  var _mobxStateTree = require("mobx-state-tree");
20
23
 
21
- var _index = require("./index");
24
+ var _index2 = require("./index");
22
25
 
23
26
  var _configuration = require("../configuration");
24
27
 
@@ -105,190 +108,70 @@ function storeBlobLocation(location) {
105
108
  blobMap[blobId] = location.blob;
106
109
  return {
107
110
  name: location === null || location === void 0 ? void 0 : location.blob.name,
108
- blobId: blobId
111
+ blobId: blobId,
112
+ locationType: 'BlobLocation'
109
113
  };
110
114
  }
111
115
 
112
116
  return location;
113
117
  }
118
+ /**
119
+ * creates a new location from the provided location including the appropriate suffix and location type
120
+ * @param location - the FileLocation
121
+ * @param suffix - the file suffix (e.g. .bam)
122
+ * @returns the constructed location object from the provided prameters
123
+ */
114
124
 
115
- function guessAdapter(file, index, getFileName, adapterHint) {
116
- function makeIndex(location, suffix) {
117
- if ('uri' in location) {
118
- return {
119
- uri: location.uri + suffix
120
- };
121
- }
122
-
123
- if ('localPath' in location) {
124
- return {
125
- localPath: location.localPath + suffix
126
- };
127
- }
128
-
129
- return location;
130
- }
131
-
132
- var fileName = getFileName(file);
133
- var indexName = index && getFileName(index);
134
-
135
- function makeIndexType(name, typeA, typeB) {
136
- return name !== null && name !== void 0 && name.toUpperCase().endsWith(typeA) ? typeA : typeB;
137
- }
138
-
139
- if (/\.bam$/i.test(fileName) || adapterHint === 'BamAdapter') {
140
- return {
141
- type: 'BamAdapter',
142
- bamLocation: file,
143
- index: {
144
- location: index || makeIndex(file, '.bai'),
145
- indexType: makeIndexType(indexName, 'CSI', 'BAI')
146
- }
147
- };
148
- }
149
-
150
- if (/\.cram$/i.test(fileName) || adapterHint === 'CramAdapter') {
151
- return {
152
- type: 'CramAdapter',
153
- cramLocation: file,
154
- craiLocation: index || makeIndex(file, '.crai')
155
- };
156
- }
157
-
158
- if (/\.gff3?$/i.test(fileName)) {
159
- return {
160
- type: 'UNSUPPORTED'
161
- };
162
- }
163
-
164
- if (/\.gff3?\.b?gz$/i.test(fileName) || adapterHint === 'Gff3TabixAdapter') {
165
- return {
166
- type: 'Gff3TabixAdapter',
167
- gffGzLocation: file,
168
- index: {
169
- location: index || makeIndex(file, '.tbi'),
170
- indexType: makeIndexType(indexName, 'CSI', 'TBI')
171
- }
172
- };
173
- }
174
-
175
- if (/\.gtf?$/i.test(fileName)) {
176
- return {
177
- type: 'UNSUPPORTED'
178
- };
179
- }
180
-
181
- if (/\.vcf$/i.test(fileName) || adapterHint === 'VcfAdapter') {
182
- return {
183
- type: 'VcfAdapter',
184
- vcfLocation: file
185
- };
186
- }
187
-
188
- if (/\.vcf\.b?gz$/i.test(fileName) || adapterHint === 'VcfTabixAdapter') {
189
- return {
190
- type: 'VcfTabixAdapter',
191
- vcfGzLocation: file,
192
- index: {
193
- location: index || makeIndex(file, '.tbi'),
194
- indexType: makeIndexType(indexName, 'CSI', 'TBI')
195
- }
196
- };
197
- }
198
-
199
- if (/\.vcf\.idx$/i.test(fileName)) {
200
- return {
201
- type: 'UNSUPPORTED'
202
- };
203
- }
204
-
205
- if (/\.bed$/i.test(fileName)) {
206
- return {
207
- type: 'UNSUPPORTED'
208
- };
209
- }
210
-
211
- if (/\.bed\.b?gz$/i.test(fileName) || adapterHint === 'BedTabixAdapter') {
212
- return {
213
- type: 'BedTabixAdapter',
214
- bedGzLocation: file,
215
- index: {
216
- location: index || makeIndex(file, '.tbi'),
217
- indexType: makeIndexType(indexName, 'CSI', 'TBI')
218
- }
219
- };
220
- }
221
-
222
- if (/\.(bb|bigbed)$/i.test(fileName) || adapterHint === 'BigBedAdapter') {
223
- return {
224
- type: 'BigBedAdapter',
225
- bigBedLocation: file
226
- };
227
- }
228
-
229
- if (/\.(bw|bigwig)$/i.test(fileName) || adapterHint === 'BigWigAdapter') {
230
- return {
231
- type: 'BigWigAdapter',
232
- bigWigLocation: file
233
- };
234
- }
235
-
236
- if (/\.(fa|fasta|fas|fna|mfa)$/i.test(fileName) || adapterHint === 'IndexedFastaAdapter') {
237
- return {
238
- type: 'IndexedFastaAdapter',
239
- fastaLocation: file,
240
- faiLocation: index || makeIndex(file, '.fai')
241
- };
242
- }
243
125
 
244
- if (/\.(fa|fasta|fas|fna|mfa)\.b?gz$/i.test(fileName) || adapterHint === 'BgzipFastaAdapter') {
126
+ function makeIndex(location, suffix) {
127
+ if ('uri' in location) {
245
128
  return {
246
- type: 'BgzipFastaAdapter',
247
- fastaLocation: file,
248
- faiLocation: makeIndex(file, '.fai'),
249
- gziLocation: makeIndex(file, '.gzi')
129
+ uri: location.uri + suffix,
130
+ locationType: 'UriLocation'
250
131
  };
251
132
  }
252
133
 
253
- if (/\.2bit$/i.test(fileName) || adapterHint === 'TwoBitAdapter') {
134
+ if ('localPath' in location) {
254
135
  return {
255
- type: 'TwoBitAdapter',
256
- twoBitLocation: file
136
+ localPath: location.localPath + suffix,
137
+ locationType: 'LocalPathLocation'
257
138
  };
258
139
  }
259
140
 
260
- if (/\.sizes$/i.test(fileName)) {
261
- return {
262
- type: 'UNSUPPORTED'
263
- };
264
- }
141
+ return location;
142
+ }
143
+ /**
144
+ * constructs a potential index file (with suffix) from the provided file name
145
+ * @param name - the name of the index file
146
+ * @param typeA - one option of a potential two file suffix (e.g. CSI, BAI)
147
+ * @param typeB - the second option of a potential two file suffix (e.g. CSI, BAI)
148
+ * @returns a likely name of the index file for a given filename
149
+ */
265
150
 
266
- if (/\/trackData.jsonz?$/i.test(fileName) || adapterHint === 'NCListAdapter') {
267
- return {
268
- type: 'NCListAdapter',
269
- rootUrlTemplate: file
270
- };
271
- }
272
151
 
273
- if (/\/sparql$/i.test(fileName) || adapterHint === 'SPARQLAdapter') {
274
- return {
275
- type: 'SPARQLAdapter',
276
- endpoint: file
277
- };
278
- }
152
+ function makeIndexType(name, typeA, typeB) {
153
+ return name !== null && name !== void 0 && name.toUpperCase().endsWith(typeA) ? typeA : typeB;
154
+ }
279
155
 
280
- if (/\.hic/i.test(fileName) || adapterHint === 'HicAdapter') {
281
- return {
282
- type: 'HicAdapter',
283
- hicLocation: file
284
- };
285
- }
156
+ function getFileName(track) {
157
+ var uri = 'uri' in track ? track.uri : undefined;
158
+ var localPath = 'localPath' in track ? track.localPath : undefined;
159
+ var blob = 'blobId' in track ? track : undefined;
160
+ return (blob === null || blob === void 0 ? void 0 : blob.name) || (uri === null || uri === void 0 ? void 0 : uri.slice(uri.lastIndexOf('/') + 1)) || (localPath === null || localPath === void 0 ? void 0 : localPath.slice(localPath.lastIndexOf('/') + 1)) || '';
161
+ }
286
162
 
287
- if (/\.paf/i.test(fileName) || adapterHint === 'PAFAdapter') {
288
- return {
289
- type: 'PAFAdapter',
290
- pafLocation: file
291
- };
163
+ function guessAdapter(file, index, adapterHint, model) {
164
+ if (model) {
165
+ // @ts-ignore
166
+ var session = (0, _index2.getSession)(model);
167
+ var adapterGuesser = (0, _mobxStateTree.getEnv)(session).pluginManager.evaluateExtensionPoint('Core-guessAdapterForLocation', function (_file, _index, _adapterHint) {
168
+ return undefined;
169
+ });
170
+ var adapter = adapterGuesser(file, index, adapterHint);
171
+
172
+ if (adapter) {
173
+ return adapter;
174
+ }
292
175
  }
293
176
 
294
177
  return {
@@ -296,20 +179,21 @@ function guessAdapter(file, index, getFileName, adapterHint) {
296
179
  };
297
180
  }
298
181
 
299
- function guessTrackType(adapterType) {
300
- var known = {
301
- BamAdapter: 'AlignmentsTrack',
302
- CramAdapter: 'AlignmentsTrack',
303
- BgzipFastaAdapter: 'ReferenceSequenceTrack',
304
- BigWigAdapter: 'QuantitativeTrack',
305
- IndexedFastaAdapter: 'ReferenceSequenceTrack',
306
- TwoBitAdapter: 'ReferenceSequenceTrack',
307
- VcfAdapter: 'VariantTrack',
308
- VcfTabixAdapter: 'VariantTrack',
309
- HicAdapter: 'HicTrack',
310
- PAFAdapter: 'SyntenyTrack'
311
- };
312
- return known[adapterType] || 'FeatureTrack';
182
+ function guessTrackType(adapterType, model) {
183
+ if (model) {
184
+ // @ts-ignore
185
+ var session = (0, _index2.getSession)(model);
186
+ var trackTypeGuesser = (0, _mobxStateTree.getEnv)(session).pluginManager.evaluateExtensionPoint('Core-guessTrackTypeForLocation', function (_adapterName) {
187
+ return undefined;
188
+ });
189
+ var trackType = trackTypeGuesser(adapterType);
190
+
191
+ if (trackType) {
192
+ return trackType;
193
+ }
194
+ }
195
+
196
+ return 'FeatureTrack';
313
197
  }
314
198
 
315
199
  function generateUnsupportedTrackConf(trackName, trackUrl, categories) {
@@ -320,7 +204,7 @@ function generateUnsupportedTrackConf(trackName, trackUrl, categories) {
320
204
  category: categories,
321
205
  trackId: ''
322
206
  };
323
- conf.trackId = (0, _index.objectHash)(conf);
207
+ conf.trackId = (0, _index2.objectHash)(conf);
324
208
  return conf;
325
209
  }
326
210
 
@@ -332,6 +216,6 @@ function generateUnknownTrackConf(trackName, trackUrl, categories) {
332
216
  category: categories,
333
217
  trackId: ''
334
218
  };
335
- conf.trackId = (0, _index.objectHash)(conf);
219
+ conf.trackId = (0, _index2.objectHash)(conf);
336
220
  return conf;
337
221
  }
@@ -1,4 +1,4 @@
1
- /// <reference types="react" />
1
+ import React from 'react';
2
2
  import { Instance, SnapshotIn, IAnyStateTreeNode } from 'mobx-state-tree';
3
3
  import { AnyConfigurationModel } from '../../configuration/configurationSchema';
4
4
  import assemblyManager from '../../assemblyManager';
@@ -7,9 +7,10 @@ import { MenuItem } from '../../ui';
7
7
  import { NoAssemblyRegion as MUNoAssemblyRegion, Region as MUIRegion, LocalPathLocation as MULocalPathLocation, UriLocation as MUUriLocation, BlobLocation as MUBlobLocation } from './mst';
8
8
  import RpcManager from '../../rpc/RpcManager';
9
9
  import { Feature } from '../simpleFeature';
10
+ import { BaseInternetAccountModel } from '../../pluggableElementTypes/models';
10
11
  export * from './util';
11
12
  /** abstract type for a model that contains multiple views */
12
- export interface AbstractViewContainer {
13
+ export interface AbstractViewContainer extends IAnyStateTreeNode {
13
14
  views: AbstractViewModel[];
14
15
  removeView(view: AbstractViewModel): void;
15
16
  addView(typeName: string, initialState: Record<string, unknown>): void | AbstractViewModel;
@@ -28,7 +29,10 @@ export interface JBrowsePlugin {
28
29
  authors: string[];
29
30
  description: string;
30
31
  location: string;
31
- url: string;
32
+ url?: string;
33
+ umdUrl?: string;
34
+ esmUrl?: string;
35
+ cjsUrl?: string;
32
36
  license: string;
33
37
  image?: string;
34
38
  }
@@ -60,10 +64,11 @@ export interface AbstractSessionModel extends AbstractViewContainer {
60
64
  adminMode?: boolean;
61
65
  showWidget?: Function;
62
66
  addWidget?: Function;
63
- addTrackConf?: Function;
64
67
  DialogComponent?: DialogComponentType;
65
68
  DialogProps: any;
66
- setDialogComponent: (dlg?: DialogComponentType, props?: any) => void;
69
+ queueDialog: (callback: (doneCallback: Function) => [DialogComponentType, any]) => void;
70
+ name: string;
71
+ id?: string;
67
72
  }
68
73
  export declare function isSessionModel(thing: unknown): thing is AbstractSessionModel;
69
74
  /** abstract interface for a session allows editing configurations */
@@ -71,16 +76,34 @@ export interface SessionWithConfigEditing extends AbstractSessionModel {
71
76
  editConfiguration(configuration: AnyConfigurationModel): void;
72
77
  }
73
78
  export declare function isSessionModelWithConfigEditing(thing: unknown): thing is SessionWithConfigEditing;
79
+ /** abstract interface for a session allows adding tracks */
80
+ export interface SessionWithConfigEditing extends AbstractSessionModel {
81
+ addTrackConf(configuration: AnyConfigurationModel | SnapshotIn<AnyConfigurationModel>): void;
82
+ }
83
+ export declare function isSessionWithAddTracks(thing: unknown): thing is SessionWithConfigEditing;
84
+ export interface Widget {
85
+ type: string;
86
+ id: string;
87
+ }
74
88
  /** abstract interface for a session that manages widgets */
75
89
  export interface SessionWithWidgets extends AbstractSessionModel {
76
- visibleWidget?: {
77
- id: string;
78
- };
79
- widgets: Map<string, unknown>;
90
+ minimized: boolean;
91
+ visibleWidget?: Widget;
92
+ widgets: Map<string, Widget>;
93
+ activeWidgets: Map<string, Widget>;
80
94
  addWidget(typeName: string, id: string, initialState?: Record<string, unknown>, configuration?: {
81
95
  type: string;
82
- }): void;
96
+ }): Widget;
83
97
  showWidget(widget: unknown): void;
98
+ hideWidget(widget: unknown): void;
99
+ }
100
+ export interface SessionWithDrawerWidgets extends SessionWithWidgets {
101
+ drawerWidth: number;
102
+ resizeDrawer(arg: number): number;
103
+ minimizeWidgetDrawer(): void;
104
+ showWidgetDrawer: () => void;
105
+ drawerPosition: string;
106
+ setDrawerPosition(arg: string): void;
84
107
  }
85
108
  export declare function isSessionModelWithWidgets(thing: unknown): thing is SessionWithWidgets;
86
109
  export interface SessionWithSessionPlugins extends AbstractSessionModel {
@@ -101,6 +124,9 @@ export interface AbstractViewModel {
101
124
  type: string;
102
125
  width: number;
103
126
  setWidth(width: number): void;
127
+ displayName: string | undefined;
128
+ setDisplayName: (arg: string) => void;
129
+ menuItems: () => MenuItem[];
104
130
  }
105
131
  export declare function isViewModel(thing: unknown): thing is AbstractViewModel;
106
132
  declare type AbstractTrackModel = {};
@@ -124,6 +150,7 @@ export interface AbstractRootModel {
124
150
  session?: AbstractSessionModel;
125
151
  setDefaultSession?(): void;
126
152
  adminMode?: boolean;
153
+ error?: unknown;
127
154
  }
128
155
  /** root model with more included for the heavier JBrowse web and desktop app */
129
156
  export interface AppRootModel extends AbstractRootModel {
@@ -131,7 +158,10 @@ export interface AppRootModel extends AbstractRootModel {
131
158
  isDefaultSessionEditing: boolean;
132
159
  setAssemblyEditing: (arg: boolean) => boolean;
133
160
  setDefaultSessionEditing: (arg: boolean) => boolean;
161
+ internetAccounts: BaseInternetAccountModel[];
162
+ findAppropriateInternetAccount(location: UriLocation): BaseInternetAccountModel | undefined;
134
163
  }
164
+ export declare function isAppRootModel(thing: unknown): thing is AppRootModel;
135
165
  /** a root model that manages global menus */
136
166
  export interface AbstractMenuManager {
137
167
  appendMenu(menuName: string): void;
@@ -146,10 +176,24 @@ export interface NoAssemblyRegion extends SnapshotIn<typeof MUNoAssemblyRegion>
146
176
  }
147
177
  export interface Region extends SnapshotIn<typeof MUIRegion> {
148
178
  }
179
+ export interface AugmentedRegion extends Region {
180
+ originalRefName?: string;
181
+ }
149
182
  export interface LocalPathLocation extends SnapshotIn<typeof MULocalPathLocation> {
150
183
  }
151
184
  export interface UriLocation extends SnapshotIn<typeof MUUriLocation> {
152
185
  }
186
+ export declare function isUriLocation(location: unknown): location is UriLocation;
187
+ export declare class AuthNeededError extends Error {
188
+ location: UriLocation;
189
+ constructor(message: string, location: UriLocation);
190
+ }
191
+ export declare class RetryError extends Error {
192
+ internetAccountId: string;
193
+ constructor(message: string, internetAccountId: string);
194
+ }
195
+ export declare function isAuthNeededException(exception: Error): boolean;
196
+ export declare function isRetryException(exception: Error): boolean;
153
197
  export interface BlobLocation extends SnapshotIn<typeof MUBlobLocation> {
154
198
  }
155
199
  export declare type FileLocation = LocalPathLocation | UriLocation | BlobLocation;
@@ -9,6 +9,7 @@ var _exportNames = {
9
9
  isViewContainer: true,
10
10
  isSessionModel: true,
11
11
  isSessionModelWithConfigEditing: true,
12
+ isSessionWithAddTracks: true,
12
13
  isSessionModelWithWidgets: true,
13
14
  isSessionWithSessionPlugins: true,
14
15
  isSelectionContainer: true,
@@ -16,19 +17,45 @@ var _exportNames = {
16
17
  isTrackModel: true,
17
18
  isDisplayModel: true,
18
19
  isTrackViewModel: true,
19
- isAbstractMenuManager: true
20
+ isAppRootModel: true,
21
+ isAbstractMenuManager: true,
22
+ isUriLocation: true,
23
+ AuthNeededError: true,
24
+ RetryError: true,
25
+ isAuthNeededException: true,
26
+ isRetryException: true
20
27
  };
21
- exports.isViewContainer = isViewContainer;
28
+ exports.RetryError = exports.AuthNeededError = void 0;
29
+ exports.isAbstractMenuManager = isAbstractMenuManager;
30
+ exports.isAppRootModel = isAppRootModel;
31
+ exports.isAuthNeededException = isAuthNeededException;
32
+ exports.isDisplayModel = isDisplayModel;
33
+ exports.isRetryException = isRetryException;
34
+ exports.isSelectionContainer = isSelectionContainer;
22
35
  exports.isSessionModel = isSessionModel;
23
36
  exports.isSessionModelWithConfigEditing = isSessionModelWithConfigEditing;
24
37
  exports.isSessionModelWithWidgets = isSessionModelWithWidgets;
38
+ exports.isSessionWithAddTracks = isSessionWithAddTracks;
25
39
  exports.isSessionWithSessionPlugins = isSessionWithSessionPlugins;
26
- exports.isSelectionContainer = isSelectionContainer;
27
- exports.isViewModel = isViewModel;
28
40
  exports.isTrackModel = isTrackModel;
29
- exports.isDisplayModel = isDisplayModel;
30
41
  exports.isTrackViewModel = isTrackViewModel;
31
- exports.isAbstractMenuManager = isAbstractMenuManager;
42
+ exports.isUriLocation = isUriLocation;
43
+ exports.isViewContainer = isViewContainer;
44
+ exports.isViewModel = isViewModel;
45
+
46
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
47
+
48
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
49
+
50
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
51
+
52
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
53
+
54
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
55
+
56
+ var _wrapNativeSuper2 = _interopRequireDefault(require("@babel/runtime/helpers/wrapNativeSuper"));
57
+
58
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
32
59
 
33
60
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
34
61
 
@@ -48,6 +75,10 @@ Object.keys(_util).forEach(function (key) {
48
75
  });
49
76
  });
50
77
 
78
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
79
+
80
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
81
+
51
82
  function isViewContainer(thing) {
52
83
  return (0, _mobxStateTree.isStateTreeNode)(thing) && 'removeView' in thing && 'addView' in thing && 'views' in thing;
53
84
  }
@@ -61,9 +92,13 @@ function isSessionModel(thing) {
61
92
  function isSessionModelWithConfigEditing(thing) {
62
93
  return isSessionModel(thing) && 'editConfiguration' in thing;
63
94
  }
64
- /** abstract interface for a session that manages widgets */
95
+ /** abstract interface for a session allows adding tracks */
65
96
 
66
97
 
98
+ function isSessionWithAddTracks(thing) {
99
+ return isSessionModel(thing) && 'addTrackConf' in thing;
100
+ }
101
+
67
102
  function isSessionModelWithWidgets(thing) {
68
103
  return isSessionModel(thing) && 'widgets' in thing;
69
104
  }
@@ -100,9 +135,76 @@ function isTrackViewModel(thing) {
100
135
  /** minimum interface for the root MST model of a JBrowse app */
101
136
 
102
137
 
138
+ function isAppRootModel(thing) {
139
+ return (0, _typeof2.default)(thing) === 'object' && thing !== null && 'isAssemblyEditing' in thing && 'findAppropriateInternetAccount' in thing;
140
+ }
141
+ /** a root model that manages global menus */
142
+
143
+
103
144
  function isAbstractMenuManager(thing) {
104
145
  return (0, _typeof2.default)(thing) === 'object' && thing !== null && 'appendMenu' in thing && 'appendToSubMenu' in thing;
105
146
  } // Empty interfaces required by mobx-state-tree
106
147
  // See https://mobx-state-tree.js.org/tips/typescript#using-a-mst-type-at-design-time
107
148
 
108
- /* eslint-disable @typescript-eslint/no-empty-interface */
149
+ /* eslint-disable @typescript-eslint/no-empty-interface */
150
+
151
+
152
+ function isUriLocation(location) {
153
+ return (0, _typeof2.default)(location) === 'object' && location !== null && 'locationType' in location && 'uri' in location;
154
+ }
155
+
156
+ var AuthNeededError = /*#__PURE__*/function (_Error) {
157
+ (0, _inherits2.default)(AuthNeededError, _Error);
158
+
159
+ var _super = _createSuper(AuthNeededError);
160
+
161
+ function AuthNeededError(message, location) {
162
+ var _this;
163
+
164
+ (0, _classCallCheck2.default)(this, AuthNeededError);
165
+ _this = _super.call(this, message);
166
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "location", void 0);
167
+ _this.location = location;
168
+ _this.name = 'AuthNeededError';
169
+ Object.setPrototypeOf((0, _assertThisInitialized2.default)(_this), AuthNeededError.prototype);
170
+ return _this;
171
+ }
172
+
173
+ return AuthNeededError;
174
+ }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
175
+
176
+ exports.AuthNeededError = AuthNeededError;
177
+
178
+ var RetryError = /*#__PURE__*/function (_Error2) {
179
+ (0, _inherits2.default)(RetryError, _Error2);
180
+
181
+ var _super2 = _createSuper(RetryError);
182
+
183
+ function RetryError(message, internetAccountId) {
184
+ var _this2;
185
+
186
+ (0, _classCallCheck2.default)(this, RetryError);
187
+ _this2 = _super2.call(this, message);
188
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this2), "internetAccountId", void 0);
189
+ _this2.message = message;
190
+ _this2.internetAccountId = internetAccountId;
191
+ _this2.name = 'RetryError';
192
+ return _this2;
193
+ }
194
+
195
+ return RetryError;
196
+ }( /*#__PURE__*/(0, _wrapNativeSuper2.default)(Error));
197
+
198
+ exports.RetryError = RetryError;
199
+
200
+ function isAuthNeededException(exception) {
201
+ return (// DOMException
202
+ exception.name === 'AuthNeededError' || exception.location !== undefined
203
+ );
204
+ }
205
+
206
+ function isRetryException(exception) {
207
+ return (// DOMException
208
+ exception.name === 'RetryError' || exception.internetAccountId !== undefined
209
+ );
210
+ }