@jbrowse/core 2.2.0 → 2.2.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 (80) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail.d.ts +1 -0
  2. package/BaseFeatureWidget/BaseFeatureDetail.js +43 -28
  3. package/BaseFeatureWidget/SequenceBox.js +4 -8
  4. package/BaseFeatureWidget/SequenceFeatureDetails.js +1 -0
  5. package/BaseFeatureWidget/SequenceFeatureSettingsDialog.js +2 -17
  6. package/BaseFeatureWidget/SequenceHelpDialog.js +3 -19
  7. package/Plugin.d.ts +1 -1
  8. package/PluginLoader.d.ts +2 -2
  9. package/PluginManager.d.ts +3 -3
  10. package/assemblyManager/assembly.d.ts +3 -3
  11. package/assemblyManager/assembly.js +1 -1
  12. package/configuration/configurationSchema.d.ts +2 -2
  13. package/data_adapters/BaseAdapter.d.ts +3 -3
  14. package/data_adapters/dataAdapterCache.d.ts +1 -1
  15. package/package.json +2 -2
  16. package/pluggableElementTypes/AdapterType.d.ts +1 -1
  17. package/pluggableElementTypes/AddTrackWorkflowType.d.ts +2 -2
  18. package/pluggableElementTypes/RpcMethodType.d.ts +1 -1
  19. package/pluggableElementTypes/ViewType.d.ts +2 -2
  20. package/pluggableElementTypes/index.d.ts +2 -2
  21. package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +23 -2
  22. package/pluggableElementTypes/models/BaseConnectionModelFactory.js +24 -2
  23. package/pluggableElementTypes/models/BaseDisplayModel.d.ts +2 -2
  24. package/pluggableElementTypes/models/BaseTrackModel.d.ts +49 -4
  25. package/pluggableElementTypes/models/BaseTrackModel.js +77 -26
  26. package/pluggableElementTypes/models/BaseViewModel.d.ts +22 -0
  27. package/pluggableElementTypes/models/BaseViewModel.js +41 -2
  28. package/pluggableElementTypes/models/InternetAccountModel.d.ts +53 -6
  29. package/pluggableElementTypes/models/InternetAccountModel.js +57 -6
  30. package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +0 -3
  31. package/pluggableElementTypes/models/baseTrackConfig.d.ts +2 -2
  32. package/pluggableElementTypes/models/baseTrackConfig.js +9 -0
  33. package/pluggableElementTypes/renderers/BoxRendererType.d.ts +1 -1
  34. package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +1 -1
  35. package/pluggableElementTypes/renderers/RendererType.d.ts +1 -1
  36. package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +2 -2
  37. package/pluggableElementTypes/renderers/ServerSideRendererType.js +1 -1
  38. package/pluggableElementTypes/renderers/util/serializableFilterChain.d.ts +2 -2
  39. package/rpc/BaseRpcDriver.js +1 -1
  40. package/rpc/RpcManager.d.ts +2 -2
  41. package/rpc/remoteAbortSignals.d.ts +1 -1
  42. package/tsconfig.build.tsbuildinfo +1 -1
  43. package/ui/AboutDialog.d.ts +1 -1
  44. package/ui/AboutDialog.js +8 -18
  45. package/ui/App.d.ts +2 -2
  46. package/ui/App.js +6 -8
  47. package/ui/AssemblySelector.d.ts +1 -1
  48. package/ui/AssemblySelector.js +12 -10
  49. package/ui/Dialog.d.ts +7 -0
  50. package/ui/Dialog.js +35 -0
  51. package/ui/EditableTypography.d.ts +4 -4
  52. package/ui/EditableTypography.js +7 -11
  53. package/ui/FactoryResetDialog.js +8 -13
  54. package/ui/Logo.d.ts +1 -1
  55. package/ui/Menu.d.ts +2 -2
  56. package/ui/ReturnToImportFormDialog.js +2 -17
  57. package/ui/Snackbar.d.ts +1 -1
  58. package/ui/ViewContainer.d.ts +2 -1
  59. package/ui/ViewContainer.js +34 -22
  60. package/ui/index.d.ts +1 -0
  61. package/ui/index.js +3 -1
  62. package/util/Base1DViewModel.d.ts +72 -2
  63. package/util/Base1DViewModel.js +94 -3
  64. package/util/analytics.js +3 -0
  65. package/util/blockTypes.d.ts +1 -1
  66. package/util/formatFastaStrings.d.ts +1 -1
  67. package/util/formatFastaStrings.js +1 -1
  68. package/util/index.d.ts +3 -1
  69. package/util/index.js +13 -3
  70. package/util/io/RemoteFileWithRangeCache.js +2 -2
  71. package/util/io/index.js +3 -3
  72. package/util/jexl.d.ts +1 -1
  73. package/util/layouts/BaseLayout.d.ts +1 -1
  74. package/util/offscreenCanvasPonyfill.d.ts +2 -2
  75. package/util/offscreenCanvasUtils.d.ts +1 -1
  76. package/util/tracks.d.ts +3 -3
  77. package/util/tracks.js +1 -1
  78. package/util/types/index.d.ts +15 -8
  79. package/util/types/index.js +8 -1
  80. package/util/types/util.d.ts +5 -5
@@ -22,21 +22,60 @@ declare const Base1DView: import("mobx-state-tree").IModelType<{
22
22
  features: Feature[] | undefined;
23
23
  volatileWidth: number;
24
24
  } & {
25
+ /**
26
+ * #action
27
+ */
25
28
  setDisplayedRegions(regions: IRegion[]): void;
29
+ /**
30
+ * #action
31
+ */
26
32
  setBpPerPx(val: number): void;
33
+ /**
34
+ * #action
35
+ */
27
36
  setVolatileWidth(width: number): void;
28
37
  } & {
38
+ /**
39
+ * #getter
40
+ */
29
41
  readonly width: number;
42
+ /**
43
+ * #getter
44
+ */
30
45
  readonly assemblyNames: string[];
46
+ /**
47
+ * #getter
48
+ */
31
49
  readonly displayedRegionsTotalPx: number;
50
+ /**
51
+ * #getter
52
+ */
32
53
  readonly maxOffset: number;
54
+ /**
55
+ * #getter
56
+ */
33
57
  readonly minOffset: number;
58
+ /**
59
+ * #getter
60
+ */
34
61
  readonly totalBp: number;
35
62
  } & {
63
+ /**
64
+ * #getter
65
+ */
36
66
  readonly dynamicBlocks: import("./blockTypes").BlockSet;
67
+ /**
68
+ * #getter
69
+ */
37
70
  readonly staticBlocks: import("./blockTypes").BlockSet;
71
+ /**
72
+ * #getter
73
+ */
38
74
  readonly currBp: number;
39
75
  } & {
76
+ /**
77
+ * #method
78
+ */
40
79
  pxToBp(px: number): {
41
80
  coord: number;
42
81
  index: number;
@@ -48,22 +87,53 @@ declare const Base1DView: import("mobx-state-tree").IModelType<{
48
87
  end: number;
49
88
  reversed: boolean;
50
89
  };
90
+ /**
91
+ * #method
92
+ */
51
93
  bpToPx({ refName, coord, regionNumber, }: {
52
94
  refName: string;
53
95
  coord: number;
54
96
  regionNumber?: number | undefined;
55
97
  }): number | undefined;
56
98
  } & {
99
+ /**
100
+ * #action
101
+ */
57
102
  setFeatures(features: Feature[]): void;
103
+ /**
104
+ * #action
105
+ * this makes a zoomed out view that shows all displayedRegions that makes
106
+ * the overview bar square with the scale bar
107
+ */
58
108
  showAllRegions(): void;
109
+ /**
110
+ * #action
111
+ */
59
112
  zoomOut(): void;
113
+ /**
114
+ * #action
115
+ */
60
116
  zoomIn(): void;
117
+ /**
118
+ * #action
119
+ */
61
120
  zoomTo(newBpPerPx: number, offset?: number): number;
121
+ /**
122
+ * #action
123
+ */
62
124
  scrollTo(offsetPx: number): number;
125
+ /**
126
+ * #action
127
+ */
63
128
  centerAt(coord: number, refName: string | undefined, regionNumber: number): void;
129
+ /**
130
+ * #action
131
+ * note: the scroll is clamped to keep the view on the main screen
132
+ */
64
133
  scroll(distance: number): number;
65
134
  } & {
66
135
  /**
136
+ * #action
67
137
  * offset is the base-pair-offset in the displayed region, index is the index of the
68
138
  * displayed region in the linear genome view
69
139
  *
@@ -72,6 +142,6 @@ declare const Base1DView: import("mobx-state-tree").IModelType<{
72
142
  */
73
143
  moveTo(start?: BpOffset, end?: BpOffset): void;
74
144
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
75
- export declare type Base1DViewStateModel = typeof Base1DView;
76
- export declare type Base1DViewModel = Instance<Base1DViewStateModel>;
145
+ export type Base1DViewStateModel = typeof Base1DView;
146
+ export type Base1DViewModel = Instance<Base1DViewStateModel>;
77
147
  export default Base1DView;
@@ -9,13 +9,37 @@ const mst_1 = require("./types/mst");
9
9
  const calculateDynamicBlocks_1 = __importDefault(require("./calculateDynamicBlocks"));
10
10
  const calculateStaticBlocks_1 = __importDefault(require("./calculateStaticBlocks"));
11
11
  const Base1DUtils_1 = require("./Base1DUtils");
12
+ /**
13
+ * #stateModel Base1DView
14
+ * used in non-lgv view representations of a 1d view e.g. the two axes of the
15
+ * dotplot use this
16
+ */
17
+ function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
12
18
  const Base1DView = mobx_state_tree_1.types
13
19
  .model('Base1DView', {
20
+ /**
21
+ * #property
22
+ */
14
23
  id: mst_1.ElementId,
24
+ /**
25
+ * #property
26
+ */
15
27
  displayedRegions: mobx_state_tree_1.types.array(mst_1.Region),
28
+ /**
29
+ * #property
30
+ */
16
31
  bpPerPx: 0,
32
+ /**
33
+ * #property
34
+ */
17
35
  offsetPx: 0,
36
+ /**
37
+ * #property
38
+ */
18
39
  interRegionPaddingWidth: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 0),
40
+ /**
41
+ * #property
42
+ */
19
43
  minimumBlockWidth: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 0),
20
44
  })
21
45
  .volatile(() => ({
@@ -23,38 +47,65 @@ const Base1DView = mobx_state_tree_1.types
23
47
  volatileWidth: 0,
24
48
  }))
25
49
  .actions(self => ({
50
+ /**
51
+ * #action
52
+ */
26
53
  setDisplayedRegions(regions) {
27
54
  self.displayedRegions = (0, mobx_state_tree_1.cast)(regions);
28
55
  },
56
+ /**
57
+ * #action
58
+ */
29
59
  setBpPerPx(val) {
30
60
  self.bpPerPx = val;
31
61
  },
62
+ /**
63
+ * #action
64
+ */
32
65
  setVolatileWidth(width) {
33
66
  self.volatileWidth = width;
34
67
  },
35
68
  }))
36
69
  .views(self => ({
70
+ /**
71
+ * #getter
72
+ */
37
73
  get width() {
38
74
  return self.volatileWidth;
39
75
  },
76
+ /**
77
+ * #getter
78
+ */
40
79
  get assemblyNames() {
41
80
  return [
42
81
  ...new Set(self.displayedRegions.map(region => region.assemblyName)),
43
82
  ];
44
83
  },
84
+ /**
85
+ * #getter
86
+ */
45
87
  get displayedRegionsTotalPx() {
46
88
  return this.totalBp / self.bpPerPx;
47
89
  },
90
+ /**
91
+ * #getter
92
+ */
48
93
  get maxOffset() {
49
94
  // objectively determined to keep the linear genome on the main screen
50
95
  const leftPadding = 10;
51
96
  return this.displayedRegionsTotalPx - leftPadding;
52
97
  },
98
+ /**
99
+ * #getter
100
+ */
53
101
  get minOffset() {
54
102
  // objectively determined to keep the linear genome on the main screen
55
103
  const rightPadding = 30;
56
104
  return -this.width + rightPadding;
57
105
  },
106
+ /**
107
+ * #getter
108
+ */
58
109
  get totalBp() {
59
110
  return self.displayedRegions
60
111
  .map(a => a.end - a.start)
@@ -62,12 +113,21 @@ const Base1DView = mobx_state_tree_1.types
62
113
  },
63
114
  }))
64
115
  .views(self => ({
116
+ /**
117
+ * #getter
118
+ */
65
119
  get dynamicBlocks() {
66
120
  return (0, calculateDynamicBlocks_1.default)(self);
67
121
  },
122
+ /**
123
+ * #getter
124
+ */
68
125
  get staticBlocks() {
69
126
  return (0, calculateStaticBlocks_1.default)(self);
70
127
  },
128
+ /**
129
+ * #getter
130
+ */
71
131
  get currBp() {
72
132
  return this.dynamicBlocks
73
133
  .map(a => a.end - a.start)
@@ -75,30 +135,51 @@ const Base1DView = mobx_state_tree_1.types
75
135
  },
76
136
  }))
77
137
  .views(self => ({
138
+ /**
139
+ * #method
140
+ */
78
141
  pxToBp(px) {
79
142
  return (0, Base1DUtils_1.pxToBp)(self, px);
80
143
  },
144
+ /**
145
+ * #method
146
+ */
81
147
  bpToPx({ refName, coord, regionNumber, }) {
82
148
  var _a;
83
149
  return (_a = (0, Base1DUtils_1.bpToPx)({ refName, coord, regionNumber, self })) === null || _a === void 0 ? void 0 : _a.offsetPx;
84
150
  },
85
151
  }))
86
152
  .actions(self => ({
153
+ /**
154
+ * #action
155
+ */
87
156
  setFeatures(features) {
88
157
  self.features = features;
89
158
  },
90
- // this makes a zoomed out view that shows all displayedRegions
91
- // that makes the overview bar square with the scale bar
159
+ /**
160
+ * #action
161
+ * this makes a zoomed out view that shows all displayedRegions that makes
162
+ * the overview bar square with the scale bar
163
+ */
92
164
  showAllRegions() {
93
165
  self.bpPerPx = self.totalBp / self.width;
94
166
  self.offsetPx = 0;
95
167
  },
168
+ /**
169
+ * #action
170
+ */
96
171
  zoomOut() {
97
172
  this.zoomTo(self.bpPerPx * 2);
98
173
  },
174
+ /**
175
+ * #action
176
+ */
99
177
  zoomIn() {
100
178
  this.zoomTo(self.bpPerPx / 2);
101
179
  },
180
+ /**
181
+ * #action
182
+ */
102
183
  zoomTo(newBpPerPx, offset = self.width / 2) {
103
184
  const bpPerPx = newBpPerPx;
104
185
  if (bpPerPx === self.bpPerPx) {
@@ -110,11 +191,17 @@ const Base1DView = mobx_state_tree_1.types
110
191
  self.offsetPx = (0, index_1.clamp)(Math.round(((self.offsetPx + offset) * oldBpPerPx) / bpPerPx - offset), self.minOffset, self.maxOffset);
111
192
  return self.bpPerPx;
112
193
  },
194
+ /**
195
+ * #action
196
+ */
113
197
  scrollTo(offsetPx) {
114
198
  const newOffsetPx = (0, index_1.clamp)(offsetPx, self.minOffset, self.maxOffset);
115
199
  self.offsetPx = newOffsetPx;
116
200
  return newOffsetPx;
117
201
  },
202
+ /**
203
+ * #action
204
+ */
118
205
  centerAt(coord, refName, regionNumber) {
119
206
  if (!refName) {
120
207
  return;
@@ -128,9 +215,12 @@ const Base1DView = mobx_state_tree_1.types
128
215
  this.scrollTo(Math.round(centerPx - self.width / 2));
129
216
  }
130
217
  },
218
+ /**
219
+ * #action
220
+ * note: the scroll is clamped to keep the view on the main screen
221
+ */
131
222
  scroll(distance) {
132
223
  const oldOffsetPx = self.offsetPx;
133
- // the scroll is clamped to keep the linear genome on the main screen
134
224
  const newOffsetPx = (0, index_1.clamp)(self.offsetPx + distance, self.minOffset, self.maxOffset);
135
225
  self.offsetPx = newOffsetPx;
136
226
  return newOffsetPx - oldOffsetPx;
@@ -138,6 +228,7 @@ const Base1DView = mobx_state_tree_1.types
138
228
  }))
139
229
  .actions(self => ({
140
230
  /**
231
+ * #action
141
232
  * offset is the base-pair-offset in the displayed region, index is the index of the
142
233
  * displayed region in the linear genome view
143
234
  *
package/util/analytics.js CHANGED
@@ -89,7 +89,10 @@ exports.writeGAAnalytics = writeGAAnalytics;
89
89
  function doAnalytics(rootModel, initialTimestamp, initialSessionQuery) {
90
90
  if (rootModel &&
91
91
  !(0, configuration_1.readConfObject)(rootModel.jbrowse.configuration, 'disableAnalytics')) {
92
+ // ok if these are unhandled
93
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
92
94
  writeAWSAnalytics(rootModel, initialTimestamp, initialSessionQuery);
95
+ // eslint-disable-next-line @typescript-eslint/no-floating-promises
93
96
  writeGAAnalytics(rootModel, initialTimestamp);
94
97
  }
95
98
  }
@@ -1,4 +1,4 @@
1
- declare type Func<T> = (value: BaseBlock, index: number, array: BaseBlock[]) => T;
1
+ type Func<T> = (value: BaseBlock, index: number, array: BaseBlock[]) => T;
2
2
  export declare class BlockSet {
3
3
  blocks: BaseBlock[];
4
4
  constructor(blocks?: BaseBlock[]);
@@ -7,7 +7,7 @@ export interface SeqChunk {
7
7
  * ref https://stackoverflow.com/a/51506718/2129219
8
8
  *
9
9
  * @param seqString - string
10
- * @returns formated sequence string
10
+ * @returns formatted sequence string
11
11
  */
12
12
  export declare function formatFastaLines(seqString: string): string;
13
13
  /**
@@ -6,7 +6,7 @@ exports.formatSeqFasta = exports.formatFastaLines = void 0;
6
6
  * ref https://stackoverflow.com/a/51506718/2129219
7
7
  *
8
8
  * @param seqString - string
9
- * @returns formated sequence string
9
+ * @returns formatted sequence string
10
10
  */
11
11
  function formatFastaLines(seqString) {
12
12
  return seqString.replace(/(.{1,80})/g, '$1\n').trimEnd();
package/util/index.d.ts CHANGED
@@ -197,6 +197,7 @@ export declare function renameRegionsIfNeeded<ARGTYPE extends {
197
197
  })[];
198
198
  }>;
199
199
  export declare function minmax(a: number, b: number): number[];
200
+ export declare function shorten(name: string, max?: number, short?: number): string;
200
201
  export declare function stringify({ refName, coord, oob, }: {
201
202
  coord: number;
202
203
  refName?: string;
@@ -297,7 +298,7 @@ interface Block {
297
298
  export declare function bytesForRegions(regions: Region[], index: {
298
299
  blocksForRange: (ref: string, start: number, end: number) => Promise<Block[]>;
299
300
  }): Promise<number>;
300
- export declare type ViewSnap = {
301
+ export type ViewSnap = {
301
302
  bpPerPx: number;
302
303
  interRegionPaddingWidth: number;
303
304
  minimumBlockWidth: number;
@@ -339,3 +340,4 @@ export declare function measureGridWidth(elements: string[]): number;
339
340
  export declare function getEnv(obj: any): {
340
341
  pluginManager: PluginManager;
341
342
  };
343
+ export declare function dedupe<T, U>(results: T[] | undefined, cb: (result: T) => U): T[];
package/util/index.js CHANGED
@@ -29,8 +29,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
29
29
  return (mod && mod.__esModule) ? mod : { "default": mod };
30
30
  };
31
31
  Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.supportedIndexingAdapters = exports.bytesForRegions = exports.objectHash = exports.hashCode = exports.updateStatus = exports.generateCodonTable = exports.defaultCodonTable = exports.defaultStops = exports.defaultStarts = exports.measureText = exports.rIC = exports.blobToDataURL = exports.complement = exports.reverse = exports.revcom = exports.isElectron = exports.stringify = exports.minmax = exports.renameRegionsIfNeeded = exports.renameRegionIfNeeded = exports.makeAbortableReaction = exports.findLastIndex = exports.iterMap = exports.bpSpanPx = exports.featureSpanPx = exports.cartesianToPolar = exports.polarToCartesian = exports.degToRad = exports.radToDeg = exports.bpToPx = exports.clamp = exports.compareLocStrings = exports.compareLocs = exports.parseLocString = exports.parseLocStringOneBased = exports.assembleLocStringFast = exports.assembleLocString = exports.getContainingDisplay = exports.getContainingTrack = exports.getContainingView = exports.getSession = exports.findParentThatIs = exports.springAnimate = exports.findParentThat = exports.useDebouncedCallback = exports.useDebounce = exports.inProduction = exports.inDevelopment = exports.isFeature = exports.SimpleFeature = void 0;
33
- exports.getEnv = exports.measureGridWidth = exports.getStr = exports.getUriLink = exports.useLocalStorage = exports.getLayoutId = exports.getViewParams = exports.getTickDisplayStr = exports.toLocale = exports.getBpDisplayStr = void 0;
32
+ exports.bytesForRegions = exports.objectHash = exports.hashCode = exports.updateStatus = exports.generateCodonTable = exports.defaultCodonTable = exports.defaultStops = exports.defaultStarts = exports.measureText = exports.rIC = exports.blobToDataURL = exports.complement = exports.reverse = exports.revcom = exports.isElectron = exports.stringify = exports.shorten = exports.minmax = exports.renameRegionsIfNeeded = exports.renameRegionIfNeeded = exports.makeAbortableReaction = exports.findLastIndex = exports.iterMap = exports.bpSpanPx = exports.featureSpanPx = exports.cartesianToPolar = exports.polarToCartesian = exports.degToRad = exports.radToDeg = exports.bpToPx = exports.clamp = exports.compareLocStrings = exports.compareLocs = exports.parseLocString = exports.parseLocStringOneBased = exports.assembleLocStringFast = exports.assembleLocString = exports.getContainingDisplay = exports.getContainingTrack = exports.getContainingView = exports.getSession = exports.findParentThatIs = exports.springAnimate = exports.findParentThat = exports.useDebouncedCallback = exports.useDebounce = exports.inProduction = exports.inDevelopment = exports.isFeature = exports.SimpleFeature = void 0;
33
+ exports.dedupe = exports.getEnv = exports.measureGridWidth = exports.getStr = exports.getUriLink = exports.useLocalStorage = exports.getLayoutId = exports.getViewParams = exports.getTickDisplayStr = exports.toLocale = exports.getBpDisplayStr = exports.supportedIndexingAdapters = void 0;
34
34
  /* eslint-disable @typescript-eslint/no-explicit-any */
35
35
  const react_1 = require("react");
36
36
  const is_object_1 = __importDefault(require("is-object"));
@@ -651,9 +651,15 @@ function minmax(a, b) {
651
651
  return [Math.min(a, b), Math.max(a, b)];
652
652
  }
653
653
  exports.minmax = minmax;
654
+ function shorten(name, max = 70, short = 30) {
655
+ return name.length > max
656
+ ? name.slice(0, short) + '...' + name.slice(-short)
657
+ : name;
658
+ }
659
+ exports.shorten = shorten;
654
660
  function stringify({ refName, coord, oob, }) {
655
661
  return refName
656
- ? `${refName}:${toLocale(coord)}${oob ? ' (out of bounds)' : ''}`
662
+ ? `${shorten(refName)}:${toLocale(coord)}${oob ? ' (out of bounds)' : ''}`
657
663
  : '';
658
664
  }
659
665
  exports.stringify = stringify;
@@ -1004,3 +1010,7 @@ function getEnv(obj) {
1004
1010
  return (0, mobx_state_tree_1.getEnv)(obj);
1005
1011
  }
1006
1012
  exports.getEnv = getEnv;
1013
+ function dedupe(results = [], cb) {
1014
+ return results.filter((elt, idx, self) => idx === self.findIndex(t => cb(t) === cb(elt)));
1015
+ }
1016
+ exports.dedupe = dedupe;
@@ -52,9 +52,9 @@ class RemoteFileWithRangeCache extends generic_filehandle_1.RemoteFile {
52
52
  const [, start, end] = rangeParse;
53
53
  const s = parseInt(start, 10);
54
54
  const e = parseInt(end, 10);
55
- const response = await globalRangeCache.getRange(url, s, e - s + 1, {
55
+ const response = (await globalRangeCache.getRange(url, s, e - s + 1, {
56
56
  signal: init && init.signal,
57
- });
57
+ }));
58
58
  const { headers } = response;
59
59
  return new Response(response.buffer, { status: 206, headers });
60
60
  }
package/util/io/index.js CHANGED
@@ -82,7 +82,7 @@ exports.getFetcher = getFetcher;
82
82
  function getInternetAccount(location, pluginManager) {
83
83
  const { rootModel } = pluginManager;
84
84
  // If there is an appRootModel, use it to find the internetAccount
85
- if (rootModel && (0, types_1.isAppRootModel)(rootModel)) {
85
+ if (rootModel && (0, types_1.isRootModelWithInternetAccounts)(rootModel)) {
86
86
  return rootModel.findAppropriateInternetAccount(location);
87
87
  }
88
88
  // If there is no appRootModel, but there is pre-auth, create a temporary
@@ -103,10 +103,10 @@ function getInternetAccount(location, pluginManager) {
103
103
  // "WWW-Authenticate: Basic" header. This is so downstream code can retry if
104
104
  // needed with HTTP Basic authentication included
105
105
  async function checkAuthNeededFetch(url, opts) {
106
+ var _a;
106
107
  const response = await fetch(url, opts);
107
108
  if (response.status === 401) {
108
- const authHeaders = response.headers.get('WWW-Authenticate');
109
- if (authHeaders && authHeaders.includes('Basic')) {
109
+ if ((_a = response.headers.get('WWW-Authenticate')) === null || _a === void 0 ? void 0 : _a.includes('Basic')) {
110
110
  throw new types_1.AuthNeededError('Accessing HTTPBasic resource without authentication', url.toString());
111
111
  }
112
112
  }
package/util/jexl.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import jexl from 'jexl';
2
- declare type JexlNonBuildable = Omit<typeof jexl, 'Jexl'>;
2
+ type JexlNonBuildable = Omit<typeof jexl, 'Jexl'>;
3
3
  export default function (): JexlNonBuildable;
4
4
  export {};
@@ -1,4 +1,4 @@
1
- export declare type RectTuple = [number, number, number, number];
1
+ export type RectTuple = [number, number, number, number];
2
2
  export interface SerializedLayout {
3
3
  rectangles: Record<string, RectTuple>;
4
4
  totalHeight: number;
@@ -1,5 +1,5 @@
1
- declare type AbstractCanvas = any;
2
- declare type AbstractImageBitmap = any;
1
+ type AbstractCanvas = any;
2
+ type AbstractImageBitmap = any;
3
3
  export declare let createCanvas: (width: number, height: number) => AbstractCanvas;
4
4
  export declare let createImageBitmap: (canvas: AbstractCanvas) => Promise<AbstractImageBitmap>;
5
5
  /** the JS class (constructor) for offscreen-generated image bitmap data */
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- export declare type RenderReturn = Record<string, unknown>;
2
+ export type RenderReturn = Record<string, unknown>;
3
3
  export declare function renderToAbstractCanvas(width: number, height: number, opts: {
4
4
  exportSVG?: {
5
5
  rasterizeLayers?: boolean;
package/util/tracks.d.ts CHANGED
@@ -31,7 +31,7 @@ export declare function storeBlobLocation(location: PreFileLocation): import("./
31
31
  * creates a new location from the provided location including the appropriate suffix and location type
32
32
  * @param location - the FileLocation
33
33
  * @param suffix - the file suffix (e.g. .bam)
34
- * @returns the constructed location object from the provided prameters
34
+ * @returns the constructed location object from the provided parameters
35
35
  */
36
36
  export declare function makeIndex(location: FileLocation, suffix: string): import("./types").BlobLocation | {
37
37
  uri: string;
@@ -54,8 +54,8 @@ export interface AdapterConfig {
54
54
  type: string;
55
55
  [key: string]: unknown;
56
56
  }
57
- export declare type AdapterGuesser = (file: FileLocation, index?: FileLocation, adapterHint?: string) => AdapterConfig | undefined;
58
- export declare type TrackTypeGuesser = (adapterName: string) => string | undefined;
57
+ export type AdapterGuesser = (file: FileLocation, index?: FileLocation, adapterHint?: string) => AdapterConfig | undefined;
58
+ export type TrackTypeGuesser = (adapterName: string) => string | undefined;
59
59
  export declare function getFileName(track: FileLocation): string;
60
60
  export declare function guessAdapter(file: FileLocation, index: FileLocation | undefined, adapterHint?: string, model?: IAnyStateTreeNode): AdapterConfig;
61
61
  export declare function guessTrackType(adapterType: string, model?: IAnyStateTreeNode): string;
package/util/tracks.js CHANGED
@@ -87,7 +87,7 @@ exports.storeBlobLocation = storeBlobLocation;
87
87
  * creates a new location from the provided location including the appropriate suffix and location type
88
88
  * @param location - the FileLocation
89
89
  * @param suffix - the file suffix (e.g. .bam)
90
- * @returns the constructed location object from the provided prameters
90
+ * @returns the constructed location object from the provided parameters
91
91
  */
92
92
  function makeIndex(location, suffix) {
93
93
  if ('uri' in location) {
@@ -16,12 +16,12 @@ export interface AbstractViewContainer extends IStateTreeNode<IType<any, unknown
16
16
  addView(typeName: string, initialState?: Record<string, unknown>): AbstractViewModel;
17
17
  }
18
18
  export declare function isViewContainer(thing: unknown): thing is AbstractViewContainer;
19
- export declare type NotificationLevel = 'error' | 'info' | 'warning' | 'success';
19
+ export type NotificationLevel = 'error' | 'info' | 'warning' | 'success';
20
20
  export interface SnackAction {
21
21
  name: string;
22
22
  onClick: () => void;
23
23
  }
24
- export declare type AssemblyManager = Instance<ReturnType<typeof assemblyManager>>;
24
+ export type AssemblyManager = Instance<ReturnType<typeof assemblyManager>>;
25
25
  export type { TextSearchManager };
26
26
  export interface BasePlugin {
27
27
  version?: string;
@@ -40,7 +40,7 @@ export interface JBrowsePlugin {
40
40
  license: string;
41
41
  image?: string;
42
42
  }
43
- export declare type DialogComponentType = React.LazyExoticComponent<React.FC<any>> | React.FC<any>;
43
+ export type DialogComponentType = React.LazyExoticComponent<React.FC<any>> | React.FC<any>;
44
44
  /** minimum interface that all session state models must implement */
45
45
  export interface AbstractSessionModel extends AbstractViewContainer {
46
46
  drawerPosition?: string;
@@ -135,7 +135,9 @@ export interface AbstractViewModel {
135
135
  id: string;
136
136
  type: string;
137
137
  width: number;
138
+ minimized: boolean;
138
139
  setWidth(width: number): void;
140
+ setMinimized(flag: boolean): void;
139
141
  displayName: string | undefined;
140
142
  setDisplayName: (arg: string) => void;
141
143
  menuItems: () => MenuItem[];
@@ -176,6 +178,11 @@ export interface AppRootModel extends AbstractRootModel {
176
178
  findAppropriateInternetAccount(location: UriLocation): BaseInternetAccountModel | undefined;
177
179
  }
178
180
  export declare function isAppRootModel(thing: unknown): thing is AppRootModel;
181
+ export interface RootModelWithInternetAccounts extends AbstractRootModel {
182
+ internetAccounts: BaseInternetAccountModel[];
183
+ findAppropriateInternetAccount(location: UriLocation): BaseInternetAccountModel | undefined;
184
+ }
185
+ export declare function isRootModelWithInternetAccounts(thing: unknown): thing is RootModelWithInternetAccounts;
179
186
  /** a root model that manages global menus */
180
187
  export interface AbstractMenuManager {
181
188
  appendMenu(menuName: string): void;
@@ -212,14 +219,14 @@ export declare function isAuthNeededException(exception: unknown): exception is
212
219
  export declare function isRetryException(exception: Error): boolean;
213
220
  export interface BlobLocation extends SnapshotIn<typeof MUBlobLocation> {
214
221
  }
215
- export declare type FileLocation = LocalPathLocation | UriLocation | BlobLocation;
216
- export declare type PreUriLocation = {
222
+ export type FileLocation = LocalPathLocation | UriLocation | BlobLocation;
223
+ export type PreUriLocation = {
217
224
  uri: string;
218
225
  };
219
- export declare type PreLocalPathLocation = {
226
+ export type PreLocalPathLocation = {
220
227
  localPath: string;
221
228
  };
222
- export declare type PreBlobLocation = {
229
+ export type PreBlobLocation = {
223
230
  blob: File;
224
231
  };
225
- export declare type PreFileLocation = PreUriLocation | PreLocalPathLocation | PreBlobLocation;
232
+ export type PreFileLocation = PreUriLocation | PreLocalPathLocation | PreBlobLocation;
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.isRetryException = exports.isAuthNeededException = exports.RetryError = exports.AuthNeededError = exports.isUriLocation = exports.isAbstractMenuManager = exports.isAppRootModel = exports.isTrackViewModel = exports.isDisplayModel = exports.isTrackModel = exports.isViewModel = exports.isSelectionContainer = exports.isSessionWithSessionPlugins = exports.isSessionModelWithConnections = exports.isSessionModelWithWidgets = exports.isSessionWithAddTracks = exports.isSessionModelWithConfigEditing = exports.isSessionModel = exports.isViewContainer = void 0;
17
+ exports.isRetryException = exports.isAuthNeededException = exports.RetryError = exports.AuthNeededError = exports.isUriLocation = exports.isAbstractMenuManager = exports.isRootModelWithInternetAccounts = exports.isAppRootModel = exports.isTrackViewModel = exports.isDisplayModel = exports.isTrackModel = exports.isViewModel = exports.isSelectionContainer = exports.isSessionWithSessionPlugins = exports.isSessionModelWithConnections = exports.isSessionModelWithWidgets = exports.isSessionWithAddTracks = exports.isSessionModelWithConfigEditing = exports.isSessionModel = exports.isViewContainer = void 0;
18
18
  const mobx_state_tree_1 = require("mobx-state-tree");
19
19
  __exportStar(require("./util"), exports);
20
20
  function isViewContainer(thing) {
@@ -97,6 +97,13 @@ function isAppRootModel(thing) {
97
97
  'findAppropriateInternetAccount' in thing);
98
98
  }
99
99
  exports.isAppRootModel = isAppRootModel;
100
+ function isRootModelWithInternetAccounts(thing) {
101
+ return (typeof thing === 'object' &&
102
+ thing !== null &&
103
+ 'internetAccounts' in thing &&
104
+ 'findAppropriateInternetAccount' in thing);
105
+ }
106
+ exports.isRootModelWithInternetAccounts = isRootModelWithInternetAccounts;
100
107
  function isAbstractMenuManager(thing) {
101
108
  return (typeof thing === 'object' &&
102
109
  thing !== null &&
@@ -5,12 +5,12 @@ import PluginManager from '../../PluginManager';
5
5
  * Obtain the return type of a constructor function type.
6
6
  * Differs from core Typescript InstanceType in that it returns never if not matched.
7
7
  */
8
- export declare type InstanceTypeRestrictive<CONSTRUCTOR extends new (...args: any[]) => any> = CONSTRUCTOR extends new (...args: any[]) => infer CLASS ? CLASS : never;
8
+ export type InstanceTypeRestrictive<CONSTRUCTOR extends new (...args: any[]) => any> = CONSTRUCTOR extends new (...args: any[]) => infer CLASS ? CLASS : never;
9
9
  /** extracts the class type from a factory function that returns a constructor */
10
- export declare type ClassReturnedBy<FACT extends (pm: PluginManager) => any> = InstanceTypeRestrictive<ReturnType<FACT>>;
10
+ export type ClassReturnedBy<FACT extends (pm: PluginManager) => any> = InstanceTypeRestrictive<ReturnType<FACT>>;
11
11
  /** A react component with any props. Consider using something more specific if possible */
12
- export declare type AnyReactComponentType = React.ComponentType<any>;
12
+ export type AnyReactComponentType = React.ComponentType<any>;
13
13
  /** get the type that a predicate asserts */
14
- export declare type TypeTestedByPredicate<PREDICATE extends (thing: any) => boolean> = PREDICATE extends (thing: any) => thing is infer TYPE ? TYPE : never;
14
+ export type TypeTestedByPredicate<PREDICATE extends (thing: any) => boolean> = PREDICATE extends (thing: any) => thing is infer TYPE ? TYPE : never;
15
15
  /** get the type for an instance of an MST model in a PM factory function */
16
- export declare type InstanceOfModelReturnedBy<FACTORY extends (pm: PluginManager) => IAnyModelType> = Instance<ReturnType<FACTORY>>;
16
+ export type InstanceOfModelReturnedBy<FACTORY extends (pm: PluginManager) => IAnyModelType> = Instance<ReturnType<FACTORY>>;