@jbrowse/core 1.7.10 → 2.0.1

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 (86) hide show
  1. package/BaseFeatureWidget/BaseFeatureDetail.d.ts +14 -4
  2. package/BaseFeatureWidget/BaseFeatureDetail.js +97 -63
  3. package/BaseFeatureWidget/SequenceFeatureDetails.js +21 -15
  4. package/BaseFeatureWidget/index.d.ts +2 -2
  5. package/BaseFeatureWidget/index.js +5 -3
  6. package/BaseFeatureWidget/index.test.js +48 -30
  7. package/BaseFeatureWidget/types.d.ts +1 -0
  8. package/PluginManager.d.ts +68 -104
  9. package/ReExports/Attributes.d.ts +2 -0
  10. package/ReExports/Attributes.js +12 -0
  11. package/ReExports/BaseCard.d.ts +2 -0
  12. package/ReExports/BaseCard.js +12 -0
  13. package/ReExports/DataGrid.d.ts +2 -0
  14. package/ReExports/DataGrid.js +13 -0
  15. package/ReExports/FeatureDetails.d.ts +2 -0
  16. package/ReExports/FeatureDetails.js +12 -0
  17. package/ReExports/list.js +1 -1
  18. package/ReExports/material-ui-colors.d.ts +1 -19
  19. package/ReExports/material-ui-colors.js +11 -152
  20. package/ReExports/modules.d.ts +69 -109
  21. package/ReExports/modules.js +683 -127
  22. package/TextSearch/TextSearchManager.d.ts +3 -1
  23. package/assemblyManager/assembly.d.ts +6 -7
  24. package/assemblyManager/assembly.js +27 -16
  25. package/assemblyManager/assemblyManager.d.ts +82 -24
  26. package/assemblyManager/assemblyManager.js +11 -9
  27. package/configuration/util.d.ts +1 -1
  28. package/package.json +14 -16
  29. package/pluggableElementTypes/models/BaseDisplayModel.d.ts +10 -10
  30. package/pluggableElementTypes/models/BaseTrackModel.d.ts +1 -1
  31. package/pluggableElementTypes/models/BaseTrackModel.js +24 -25
  32. package/pluggableElementTypes/renderers/FeatureRendererType.js +17 -8
  33. package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +2 -2
  34. package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +2 -2
  35. package/pluggableElementTypes/renderers/ServerSideRendererType.js +1 -1
  36. package/rpc/BaseRpcDriver.js +1 -1
  37. package/rpc/coreRpcMethods.d.ts +1 -3
  38. package/rpc/coreRpcMethods.js +5 -5
  39. package/tsconfig.build.tsbuildinfo +1 -1
  40. package/ui/AboutDialog.js +15 -10
  41. package/ui/App.js +18 -37
  42. package/ui/AssemblySelector.d.ts +1 -1
  43. package/ui/AssemblySelector.js +10 -5
  44. package/ui/CascadingMenu.js +10 -14
  45. package/ui/Drawer.js +8 -5
  46. package/ui/DrawerWidget.js +39 -45
  47. package/ui/DropDownMenu.d.ts +0 -8
  48. package/ui/DropDownMenu.js +9 -15
  49. package/ui/EditableTypography.d.ts +1 -1
  50. package/ui/EditableTypography.js +42 -48
  51. package/ui/ErrorMessage.js +13 -23
  52. package/ui/FactoryResetDialog.js +6 -6
  53. package/ui/FatalErrorDialog.js +5 -5
  54. package/ui/FileSelector/FileSelector.js +19 -19
  55. package/ui/FileSelector/LocalFileChooser.js +12 -8
  56. package/ui/FileSelector/UrlChooser.js +2 -2
  57. package/ui/Icons.d.ts +1 -1
  58. package/ui/Icons.js +1 -1
  59. package/ui/Menu.d.ts +1 -1
  60. package/ui/Menu.js +28 -29
  61. package/ui/PrerenderedCanvas.js +10 -1
  62. package/ui/ResizeHandle.js +8 -6
  63. package/ui/ReturnToImportFormDialog.js +14 -10
  64. package/ui/SanitizedHTML.js +15 -21
  65. package/ui/Snackbar.js +11 -9
  66. package/ui/Tooltip.d.ts +3 -1
  67. package/ui/Tooltip.js +5 -3
  68. package/ui/ViewContainer.js +38 -25
  69. package/ui/theme.d.ts +279 -131
  70. package/ui/theme.js +174 -154
  71. package/ui/theme.test.js +56 -75
  72. package/util/Base1DUtils.d.ts +32 -0
  73. package/util/Base1DUtils.js +213 -0
  74. package/util/Base1DViewModel.d.ts +16 -37
  75. package/util/Base1DViewModel.js +34 -166
  76. package/util/color/index.js +6 -6
  77. package/util/index.d.ts +12 -21
  78. package/util/index.js +29 -90
  79. package/util/layouts/GranularRectLayout.js +1 -3
  80. package/util/layouts/PrecomputedLayout.js +1 -3
  81. package/util/offscreenCanvasPonyfill.js +10 -12
  82. package/util/tracks.js +4 -2
  83. package/util/types/index.d.ts +14 -4
  84. package/util/types/index.js +6 -0
  85. package/util/types/mst.d.ts +3 -3
  86. package/util/types/mst.js +11 -7
package/util/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { IAnyStateTreeNode } from 'mobx-state-tree';
1
+ import { IAnyStateTreeNode, IStateTreeNode } from 'mobx-state-tree';
2
2
  import { IReactionPublic, IReactionOptions } from 'mobx';
3
3
  import SimpleFeature, { Feature, isFeature } from './simpleFeature';
4
4
  import { AssemblyManager, Region, TypeTestedByPredicate } from './types';
5
+ import { BaseBlock } from './blockTypes';
5
6
  export type { Feature };
6
7
  export * from './types';
7
8
  export * from './aborting';
@@ -24,7 +25,7 @@ export declare function getSession(node: IAnyStateTreeNode): import("./types").A
24
25
  /** get the state model of the view in the state tree that contains the given node */
25
26
  export declare function getContainingView(node: IAnyStateTreeNode): import("./types").AbstractViewModel & IAnyStateTreeNode;
26
27
  /** get the state model of the view in the state tree that contains the given node */
27
- export declare function getContainingTrack(node: IAnyStateTreeNode): IAnyStateTreeNode;
28
+ export declare function getContainingTrack(node: IAnyStateTreeNode): import("./types").AbstractTrackModel & IAnyStateTreeNode;
28
29
  export declare function getContainingDisplay(node: IAnyStateTreeNode): import("./types").AbstractDisplayModel & IAnyStateTreeNode;
29
30
  /**
30
31
  * Assemble a 1-based "locString" from an interbase genomic location
@@ -149,12 +150,6 @@ export declare function bpSpanPx(leftBp: number, rightBp: number, region: {
149
150
  end: number;
150
151
  reversed?: boolean;
151
152
  }, bpPerPx: number): [number, number];
152
- export declare const objectFromEntries: {
153
- <T = any>(entries: Iterable<readonly [PropertyKey, T]>): {
154
- [k: string]: T;
155
- };
156
- (entries: Iterable<readonly any[]>): any;
157
- };
158
153
  export declare function iterMap<T, U>(iterable: Iterable<T>, func: (item: T) => U, sizeHint?: number): U[];
159
154
  interface Assembly {
160
155
  name: string;
@@ -222,7 +217,7 @@ export declare function renameRegionsIfNeeded<ARGTYPE extends {
222
217
  export declare function minmax(a: number, b: number): number[];
223
218
  export declare function stringify({ refName, coord, oob, }: {
224
219
  coord: number;
225
- refName: string;
220
+ refName?: string;
226
221
  oob?: boolean;
227
222
  }): string;
228
223
  export declare const isElectron: boolean;
@@ -324,27 +319,23 @@ export declare type ViewSnap = {
324
319
  interRegionPaddingWidth: number;
325
320
  minimumBlockWidth: number;
326
321
  width: number;
327
- displayedRegions: {
322
+ offsetPx: number;
323
+ staticBlocks: {
324
+ contentBlocks: BaseBlock[];
325
+ blocks: BaseBlock[];
326
+ };
327
+ displayedRegions: (IStateTreeNode & {
328
328
  start: number;
329
329
  end: number;
330
330
  refName: string;
331
331
  reversed: boolean;
332
- }[];
332
+ assemblyName: string;
333
+ })[];
333
334
  };
334
- export declare function viewBpToPx({ refName, coord, regionNumber, self, }: {
335
- refName: string;
336
- coord: number;
337
- regionNumber?: number;
338
- self: ViewSnap;
339
- }): {
340
- index: number;
341
- offsetPx: number;
342
- } | undefined;
343
335
  export declare function supportedIndexingAdapters(type: string): boolean;
344
336
  export declare function getBpDisplayStr(totalBp: number): string;
345
337
  export declare function toLocale(n: number): string;
346
338
  export declare function getTickDisplayStr(totalBp: number, bpPerPx: number): string;
347
- export declare function getTickDisplayStr2(totalBp: number, bpPerPx: number): string;
348
339
  export declare function getViewParams(model: IAnyStateTreeNode, exportSVG?: boolean): {
349
340
  offsetPx: number;
350
341
  offsetPx1: number;
package/util/index.js CHANGED
@@ -32,7 +32,6 @@ var _exportNames = {
32
32
  cartesianToPolar: true,
33
33
  featureSpanPx: true,
34
34
  bpSpanPx: true,
35
- objectFromEntries: true,
36
35
  iterMap: true,
37
36
  mergeConfigs: true,
38
37
  findLastIndex: true,
@@ -55,12 +54,10 @@ var _exportNames = {
55
54
  hashCode: true,
56
55
  objectHash: true,
57
56
  bytesForRegions: true,
58
- viewBpToPx: true,
59
57
  supportedIndexingAdapters: true,
60
58
  getBpDisplayStr: true,
61
59
  toLocale: true,
62
60
  getTickDisplayStr: true,
63
- getTickDisplayStr2: true,
64
61
  getViewParams: true,
65
62
  getLayoutId: true,
66
63
  SimpleFeature: true,
@@ -95,7 +92,6 @@ exports.getContainingView = getContainingView;
95
92
  exports.getLayoutId = getLayoutId;
96
93
  exports.getSession = getSession;
97
94
  exports.getTickDisplayStr = getTickDisplayStr;
98
- exports.getTickDisplayStr2 = getTickDisplayStr2;
99
95
  exports.getViewParams = getViewParams;
100
96
  exports.hashCode = hashCode;
101
97
  exports.isElectron = exports.inProduction = exports.inDevelopment = void 0;
@@ -110,7 +106,6 @@ exports.makeAbortableReaction = makeAbortableReaction;
110
106
  exports.measureText = measureText;
111
107
  exports.mergeConfigs = mergeConfigs;
112
108
  exports.minmax = minmax;
113
- exports.objectFromEntries = void 0;
114
109
  exports.objectHash = objectHash;
115
110
  exports.parseLocString = parseLocString;
116
111
  exports.parseLocStringOneBased = parseLocStringOneBased;
@@ -127,7 +122,6 @@ exports.toLocale = toLocale;
127
122
  exports.updateStatus = updateStatus;
128
123
  exports.useDebounce = useDebounce;
129
124
  exports.useDebouncedCallback = useDebouncedCallback;
130
- exports.viewBpToPx = viewBpToPx;
131
125
 
132
126
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
133
127
 
@@ -147,8 +141,6 @@ var _mobxStateTree = require("mobx-state-tree");
147
141
 
148
142
  var _mobx = require("mobx");
149
143
 
150
- var _object = _interopRequireDefault(require("object.fromentries"));
151
-
152
144
  var _deepmerge = _interopRequireDefault(require("deepmerge"));
153
145
 
154
146
  var _simpleFeature = _interopRequireWildcard(require("./simpleFeature"));
@@ -251,11 +243,6 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
251
243
 
252
244
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
253
245
 
254
- if (!Object.fromEntries) {
255
- // @ts-ignore
256
- _object.default.shim();
257
- }
258
-
259
246
  var inDevelopment = (typeof process === "undefined" ? "undefined" : (0, _typeof2.default)(process)) === 'object' && process.env && process.env.NODE_ENV === 'development';
260
247
  exports.inDevelopment = inDevelopment;
261
248
  var inProduction = !inDevelopment;
@@ -791,11 +778,8 @@ function bpSpanPx(leftBp, rightBp, region, bpPerPx) {
791
778
  var start = bpToPx(leftBp, region, bpPerPx);
792
779
  var end = bpToPx(rightBp, region, bpPerPx);
793
780
  return region.reversed ? [end, start] : [start, end];
794
- }
781
+ } // do an array map of an iterable
795
782
 
796
- var objectFromEntries = Object.fromEntries.bind(Object); // do an array map of an iterable
797
-
798
- exports.objectFromEntries = objectFromEntries;
799
783
 
800
784
  function iterMap(iterable, func, sizeHint) {
801
785
  var results = sizeHint ? new Array(sizeHint) : [];
@@ -873,7 +857,8 @@ function findLastIndex(array, predicate) {
873
857
  */
874
858
 
875
859
 
876
- function makeAbortableReaction(self, dataFunction, asyncReactionFunction, reactionOptions, startedFunction, successFunction, errorFunction) {
860
+ function makeAbortableReaction(self, dataFunction, asyncReactionFunction, // @ts-ignore
861
+ reactionOptions, startedFunction, successFunction, errorFunction) {
877
862
  var inProgress;
878
863
 
879
864
  function handleError(error) {
@@ -886,7 +871,7 @@ function makeAbortableReaction(self, dataFunction, asyncReactionFunction, reacti
886
871
  }
887
872
  }
888
873
 
889
- var reactionDisposer = (0, _mobx.reaction)(function () {
874
+ (0, _mobxStateTree.addDisposer)(self, (0, _mobx.reaction)(function () {
890
875
  try {
891
876
  return dataFunction(self);
892
877
  } catch (e) {
@@ -917,7 +902,8 @@ function makeAbortableReaction(self, dataFunction, asyncReactionFunction, reacti
917
902
  startedFunction(thisInProgress);
918
903
  _context.prev = 6;
919
904
  _context.next = 9;
920
- return asyncReactionFunction(data, thisInProgress.signal, self, mobxReactionHandle);
905
+ return asyncReactionFunction(data, thisInProgress.signal, self, // @ts-ignore
906
+ mobxReactionHandle);
921
907
 
922
908
  case 9:
923
909
  result = _context.sent;
@@ -951,8 +937,7 @@ function makeAbortableReaction(self, dataFunction, asyncReactionFunction, reacti
951
937
  return function (_x, _x2) {
952
938
  return _ref2.apply(this, arguments);
953
939
  };
954
- }(), reactionOptions);
955
- (0, _mobxStateTree.addDisposer)(self, reactionDisposer);
940
+ }(), reactionOptions));
956
941
  (0, _mobxStateTree.addDisposer)(self, function () {
957
942
  if (inProgress && !inProgress.signal.aborted) {
958
943
  inProgress.abort();
@@ -968,6 +953,7 @@ function renameRegionIfNeeded(refNameMap, region) {
968
953
  if (region && refNameMap && refNameMap[region.refName]) {
969
954
  // clone the region so we don't modify it
970
955
  if ((0, _mobxStateTree.isStateTreeNode)(region)) {
956
+ // @ts-ignore
971
957
  region = _objectSpread({}, (0, _mobxStateTree.getSnapshot)(region));
972
958
  } else {
973
959
  region = _objectSpread({}, region);
@@ -1015,7 +1001,7 @@ function _renameRegionsIfNeeded() {
1015
1001
  _context3.t0 = Object;
1016
1002
  _context3.next = 7;
1017
1003
  return Promise.all(assemblyNames.map( /*#__PURE__*/function () {
1018
- var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(assemblyName) {
1004
+ var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(assemblyName) {
1019
1005
  return _regenerator.default.wrap(function _callee2$(_context2) {
1020
1006
  while (1) {
1021
1007
  switch (_context2.prev = _context2.next) {
@@ -1037,7 +1023,7 @@ function _renameRegionsIfNeeded() {
1037
1023
  }));
1038
1024
 
1039
1025
  return function (_x10) {
1040
- return _ref6.apply(this, arguments);
1026
+ return _ref5.apply(this, arguments);
1041
1027
  };
1042
1028
  }()));
1043
1029
 
@@ -1070,7 +1056,7 @@ function stringify(_ref3) {
1070
1056
  var refName = _ref3.refName,
1071
1057
  coord = _ref3.coord,
1072
1058
  oob = _ref3.oob;
1073
- return "".concat(refName, ":").concat(coord.toLocaleString('en-US')).concat(oob ? ' (out of bounds)' : '');
1059
+ return refName ? "".concat(refName, ":").concat(coord.toLocaleString('en-US')).concat(oob ? ' (out of bounds)' : '') : '';
1074
1060
  } // this is recommended in a later comment in https://github.com/electron/electron/issues/2288
1075
1061
  // for detecting electron in a renderer process, which is the one that has node enabled for us
1076
1062
  // const isElectron = process.versions.electron
@@ -1158,20 +1144,25 @@ window.requestIdleCallback : function (cb) {
1158
1144
  }, 1);
1159
1145
  } : function (cb) {
1160
1146
  return cb();
1161
- }; // xref https://gist.github.com/tophtucker/62f93a4658387bb61e4510c37e2e97cf
1147
+ }; // prettier-ignore
1162
1148
 
1163
1149
  exports.rIC = rIC;
1150
+ var widths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2796875, 0.2765625, 0.3546875, 0.5546875, 0.5546875, 0.8890625, 0.665625, 0.190625, 0.3328125, 0.3328125, 0.3890625, 0.5828125, 0.2765625, 0.3328125, 0.2765625, 0.3015625, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.2765625, 0.2765625, 0.584375, 0.5828125, 0.584375, 0.5546875, 1.0140625, 0.665625, 0.665625, 0.721875, 0.721875, 0.665625, 0.609375, 0.7765625, 0.721875, 0.2765625, 0.5, 0.665625, 0.5546875, 0.8328125, 0.721875, 0.7765625, 0.665625, 0.7765625, 0.721875, 0.665625, 0.609375, 0.721875, 0.665625, 0.94375, 0.665625, 0.665625, 0.609375, 0.2765625, 0.3546875, 0.2765625, 0.4765625, 0.5546875, 0.3328125, 0.5546875, 0.5546875, 0.5, 0.5546875, 0.5546875, 0.2765625, 0.5546875, 0.5546875, 0.221875, 0.240625, 0.5, 0.221875, 0.8328125, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.3328125, 0.5, 0.2765625, 0.5546875, 0.5, 0.721875, 0.5, 0.5, 0.5, 0.3546875, 0.259375, 0.353125, 0.5890625]; // xref https://gist.github.com/tophtucker/62f93a4658387bb61e4510c37e2e97cf
1164
1151
 
1165
1152
  function measureText(str) {
1166
1153
  var fontSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10;
1167
- // prettier-ignore
1168
- var widths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2796875, 0.2765625, 0.3546875, 0.5546875, 0.5546875, 0.8890625, 0.665625, 0.190625, 0.3328125, 0.3328125, 0.3890625, 0.5828125, 0.2765625, 0.3328125, 0.2765625, 0.3015625, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.2765625, 0.2765625, 0.584375, 0.5828125, 0.584375, 0.5546875, 1.0140625, 0.665625, 0.665625, 0.721875, 0.721875, 0.665625, 0.609375, 0.7765625, 0.721875, 0.2765625, 0.5, 0.665625, 0.5546875, 0.8328125, 0.721875, 0.7765625, 0.665625, 0.7765625, 0.721875, 0.665625, 0.609375, 0.721875, 0.665625, 0.94375, 0.665625, 0.665625, 0.609375, 0.2765625, 0.3546875, 0.2765625, 0.4765625, 0.5546875, 0.3328125, 0.5546875, 0.5546875, 0.5, 0.5546875, 0.5546875, 0.2765625, 0.5546875, 0.5546875, 0.221875, 0.240625, 0.5, 0.221875, 0.8328125, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.3328125, 0.5, 0.2765625, 0.5546875, 0.5, 0.721875, 0.5, 0.5, 0.5, 0.3546875, 0.259375, 0.353125, 0.5890625];
1169
1154
  var avg = 0.5279276315789471;
1170
- return String(str).split('').map(function (c) {
1171
- return c.charCodeAt(0) < widths.length ? widths[c.charCodeAt(0)] : avg;
1172
- }).reduce(function (cur, acc) {
1173
- return acc + cur;
1174
- }, 0) * fontSize;
1155
+ var s = String(str);
1156
+ var total = 0;
1157
+
1158
+ for (var i = 0; i < s.length; i++) {
1159
+ var _widths$code;
1160
+
1161
+ var code = s.charCodeAt(i);
1162
+ total += (_widths$code = widths[code]) !== null && _widths$code !== void 0 ? _widths$code : avg;
1163
+ }
1164
+
1165
+ return total * fontSize;
1175
1166
  }
1176
1167
 
1177
1168
  var defaultStarts = ['ATG'];
@@ -1369,48 +1360,8 @@ function _bytesForRegions() {
1369
1360
  return _bytesForRegions.apply(this, arguments);
1370
1361
  }
1371
1362
 
1372
- function viewBpToPx(_ref4) {
1373
- var refName = _ref4.refName,
1374
- coord = _ref4.coord,
1375
- regionNumber = _ref4.regionNumber,
1376
- self = _ref4.self;
1377
- var offsetBp = 0;
1378
- var interRegionPaddingBp = self.interRegionPaddingWidth * self.bpPerPx;
1379
- var minimumBlockBp = self.minimumBlockWidth * self.bpPerPx;
1380
- var index = self.displayedRegions.findIndex(function (region, idx) {
1381
- var len = region.end - region.start;
1382
-
1383
- if (refName === region.refName && coord >= region.start && coord <= region.end) {
1384
- if (regionNumber ? regionNumber === idx : true) {
1385
- offsetBp += region.reversed ? region.end - coord : coord - region.start;
1386
- return true;
1387
- }
1388
- } // add the interRegionPaddingWidth if the boundary is in the screen
1389
- // e.g. offset>=0 && offset<width
1390
-
1391
-
1392
- if (len > minimumBlockBp && offsetBp / self.bpPerPx >= 0 && offsetBp / self.bpPerPx < self.width) {
1393
- offsetBp += len + interRegionPaddingBp;
1394
- } else {
1395
- offsetBp += len;
1396
- }
1397
-
1398
- return false;
1399
- });
1400
- var found = self.displayedRegions[index];
1401
-
1402
- if (found) {
1403
- return {
1404
- index: index,
1405
- offsetPx: Math.round(offsetBp / self.bpPerPx)
1406
- };
1407
- }
1408
-
1409
- return undefined;
1410
- } // supported adapter types by text indexer
1363
+ // supported adapter types by text indexer
1411
1364
  // ensure that this matches the method found in @jbrowse/text-indexing/util
1412
-
1413
-
1414
1365
  function supportedIndexingAdapters(type) {
1415
1366
  return ['Gff3TabixAdapter', 'VcfTabixAdapter', 'Gff3Adapter', 'VcfAdapter'].includes(type);
1416
1367
  }
@@ -1423,7 +1374,7 @@ function getBpDisplayStr(totalBp) {
1423
1374
  } else if (Math.floor(totalBp / 1000) > 0) {
1424
1375
  str = "".concat(parseFloat((totalBp / 1000).toPrecision(3)), "Kbp");
1425
1376
  } else {
1426
- str = "".concat(Math.floor(totalBp).toLocaleString('en-US'), "bp");
1377
+ str = "".concat(toLocale(Math.floor(totalBp)), "bp");
1427
1378
  }
1428
1379
 
1429
1380
  return str;
@@ -1445,18 +1396,6 @@ function getTickDisplayStr(totalBp, bpPerPx) {
1445
1396
  return str;
1446
1397
  }
1447
1398
 
1448
- function getTickDisplayStr2(totalBp, bpPerPx) {
1449
- var str;
1450
-
1451
- if (Math.floor(bpPerPx / 1000) > 0) {
1452
- str = "".concat(toLocale(parseFloat((totalBp / 1000000).toFixed(2))), "Mbp");
1453
- } else {
1454
- str = "".concat(toLocale(Math.floor(totalBp)), "bp");
1455
- }
1456
-
1457
- return str;
1458
- }
1459
-
1460
1399
  function getViewParams(model, exportSVG) {
1461
1400
  // @ts-ignore
1462
1401
  var _getContainingView = getContainingView(model),
@@ -1475,8 +1414,8 @@ function getViewParams(model, exportSVG) {
1475
1414
  };
1476
1415
  }
1477
1416
 
1478
- function getLayoutId(_ref5) {
1479
- var sessionId = _ref5.sessionId,
1480
- layoutId = _ref5.layoutId;
1417
+ function getLayoutId(_ref4) {
1418
+ var sessionId = _ref4.sessionId,
1419
+ layoutId = _ref4.layoutId;
1481
1420
  return sessionId + '-' + layoutId;
1482
1421
  }
@@ -15,8 +15,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
15
15
 
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
17
 
18
- var _index = require("../index");
19
-
20
18
  function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
21
19
 
22
20
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
@@ -588,7 +586,7 @@ var GranularRectLayout = /*#__PURE__*/function () {
588
586
  }, {
589
587
  key: "toJSON",
590
588
  value: function toJSON() {
591
- var rectangles = (0, _index.objectFromEntries)(this.getRectangles());
589
+ var rectangles = Object.fromEntries(this.getRectangles());
592
590
  return {
593
591
  rectangles: rectangles,
594
592
  containsNoTransferables: true,
@@ -15,8 +15,6 @@ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/creat
15
15
 
16
16
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
17
17
 
18
- var _ = require("..");
19
-
20
18
  var _rbush = _interopRequireDefault(require("rbush"));
21
19
 
22
20
  var PrecomputedLayout = /*#__PURE__*/function () {
@@ -116,7 +114,7 @@ var PrecomputedLayout = /*#__PURE__*/function () {
116
114
  key: "toJSON",
117
115
  value: function toJSON() {
118
116
  return {
119
- rectangles: (0, _.objectFromEntries)(this.rectangles),
117
+ rectangles: Object.fromEntries(this.rectangles),
120
118
  totalHeight: this.totalHeight,
121
119
  maxHeightReached: false,
122
120
  containsNoTransferables: true
@@ -31,10 +31,8 @@ imageData, context) {
31
31
  if (imageData.serializedCommands) {
32
32
  var seq = new _canvasSequencer.CanvasSequence(imageData.serializedCommands);
33
33
  seq.execute(context);
34
- } else if (imageData instanceof ImageBitmapType) {
34
+ } else {
35
35
  context.drawImage(imageData, 0, 0);
36
- } else if (imageData.dataURL) {
37
- throw new Error('dataURL deserialization no longer supported');
38
36
  }
39
37
  }
40
38
 
@@ -54,11 +52,11 @@ if (weHave.realOffscreenCanvas) {
54
52
  exports.ImageBitmapType = ImageBitmapType = window.ImageBitmap || self.ImageBitmap;
55
53
  } else if (weHave.node) {
56
54
  // use node-canvas if we are running in node (i.e. automated tests)
57
- var _require = require('canvas'),
58
- nodeCreateCanvas = _require.createCanvas,
59
- Image = _require.Image;
60
-
61
- exports.createCanvas = createCanvas = nodeCreateCanvas;
55
+ exports.createCanvas = createCanvas = function createCanvas() {
56
+ // @ts-ignore
57
+ // eslint-disable-next-line no-undef
58
+ return nodeCreateCanvas.apply(void 0, arguments);
59
+ };
62
60
 
63
61
  exports.createImageBitmap = createImageBitmap = /*#__PURE__*/function () {
64
62
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(canvas) {
@@ -77,8 +75,10 @@ if (weHave.realOffscreenCanvas) {
77
75
  throw new Error('only one-argument uses of createImageBitmap are supported by the node offscreencanvas ponyfill');
78
76
 
79
77
  case 2:
80
- dataUri = canvas.toDataURL();
81
- img = new Image();
78
+ dataUri = canvas.toDataURL(); // @ts-ignore
79
+ // eslint-disable-next-line no-undef
80
+
81
+ img = new nodeImage();
82
82
  return _context.abrupt("return", new Promise(function (resolve, reject) {
83
83
  img.onload = function () {
84
84
  return resolve(img);
@@ -100,8 +100,6 @@ if (weHave.realOffscreenCanvas) {
100
100
  return _ref.apply(this, arguments);
101
101
  };
102
102
  }();
103
-
104
- exports.ImageBitmapType = ImageBitmapType = Image;
105
103
  } else {
106
104
  exports.createCanvas = createCanvas = function createCanvas(width, height) {
107
105
  var context = new _canvasSequencer.CanvasSequence();
package/util/tracks.js CHANGED
@@ -46,7 +46,7 @@ function getTrackAssemblyNames(track) {
46
46
 
47
47
 
48
48
  function getRpcSessionId(thisNode) {
49
- var highestRpcSessionId;
49
+ var highestRpcSessionId; // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
50
 
51
51
  for (var node = thisNode; !(0, _mobxStateTree.isRoot)(node); node = (0, _mobxStateTree.getParent)(node)) {
52
52
  if ('rpcSessionId' in node) {
@@ -69,7 +69,9 @@ function getRpcSessionId(thisNode) {
69
69
 
70
70
 
71
71
  function getParentRenderProps(node) {
72
- for (var currentNode = (0, _mobxStateTree.getParent)(node); !(0, _mobxStateTree.isRoot)(currentNode); currentNode = (0, _mobxStateTree.getParent)(currentNode)) {
72
+ for ( // eslint-disable-next-line @typescript-eslint/no-explicit-any
73
+ var currentNode = (0, _mobxStateTree.getParent)(node); !(0, _mobxStateTree.isRoot)(currentNode); // eslint-disable-next-line @typescript-eslint/no-explicit-any
74
+ currentNode = (0, _mobxStateTree.getParent)(currentNode)) {
73
75
  if ('renderProps' in currentNode) {
74
76
  return currentNode.renderProps();
75
77
  }
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Instance, SnapshotIn, IAnyStateTreeNode } from 'mobx-state-tree';
2
+ import { Instance, SnapshotIn, IAnyStateTreeNode, IStateTreeNode, IType } from 'mobx-state-tree';
3
3
  import { AnyConfigurationModel } from '../../configuration/configurationSchema';
4
4
  import assemblyManager from '../../assemblyManager';
5
5
  import TextSearchManager from '../../TextSearch/TextSearchManager';
@@ -10,10 +10,10 @@ import { Feature } from '../simpleFeature';
10
10
  import { BaseInternetAccountModel } from '../../pluggableElementTypes/models';
11
11
  export * from './util';
12
12
  /** abstract type for a model that contains multiple views */
13
- export interface AbstractViewContainer extends IAnyStateTreeNode {
13
+ export interface AbstractViewContainer extends IStateTreeNode<IType<any, unknown, any>> {
14
14
  views: AbstractViewModel[];
15
15
  removeView(view: AbstractViewModel): void;
16
- addView(typeName: string, initialState?: Record<string, unknown>): void | AbstractViewModel;
16
+ addView(typeName: string, initialState?: Record<string, unknown>): AbstractViewModel;
17
17
  }
18
18
  export declare function isViewContainer(thing: unknown): thing is AbstractViewContainer;
19
19
  export declare type NotificationLevel = 'error' | 'info' | 'warning' | 'success';
@@ -43,6 +43,7 @@ export interface JBrowsePlugin {
43
43
  export declare 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
+ drawerPosition?: string;
46
47
  setSelection(feature: Feature): void;
47
48
  clearSelection(): void;
48
49
  configuration: AnyConfigurationModel;
@@ -63,6 +64,8 @@ export interface AbstractSessionModel extends AbstractViewContainer {
63
64
  sessionConnections?: AnyConfigurationModel[];
64
65
  connectionInstances?: {
65
66
  name: string;
67
+ connectionId: string;
68
+ tracks: AnyConfigurationModel[];
66
69
  }[];
67
70
  makeConnection?: Function;
68
71
  adminMode?: boolean;
@@ -73,6 +76,7 @@ export interface AbstractSessionModel extends AbstractViewContainer {
73
76
  queueDialog: (callback: (doneCallback: Function) => [DialogComponentType, any]) => void;
74
77
  name: string;
75
78
  id?: string;
79
+ tracks: AnyConfigurationModel[];
76
80
  }
77
81
  export declare function isSessionModel(thing: unknown): thing is AbstractSessionModel;
78
82
  /** abstract interface for a session allows editing configurations */
@@ -110,6 +114,10 @@ export interface SessionWithDrawerWidgets extends SessionWithWidgets {
110
114
  setDrawerPosition(arg: string): void;
111
115
  }
112
116
  export declare function isSessionModelWithWidgets(thing: unknown): thing is SessionWithWidgets;
117
+ interface SessionWithConnections {
118
+ addConnectionConf: (arg: AnyConfigurationModel) => void;
119
+ }
120
+ export declare function isSessionModelWithConnections(thing: unknown): thing is SessionWithConnections;
113
121
  export interface SessionWithSessionPlugins extends AbstractSessionModel {
114
122
  sessionPlugins: JBrowsePlugin[];
115
123
  addSessionPlugin: Function;
@@ -133,7 +141,9 @@ export interface AbstractViewModel {
133
141
  menuItems: () => MenuItem[];
134
142
  }
135
143
  export declare function isViewModel(thing: unknown): thing is AbstractViewModel;
136
- declare type AbstractTrackModel = {};
144
+ export interface AbstractTrackModel {
145
+ displays: AbstractDisplayModel[];
146
+ }
137
147
  export declare function isTrackModel(thing: unknown): thing is AbstractTrackModel;
138
148
  export interface AbstractDisplayModel {
139
149
  id: string;
@@ -11,6 +11,7 @@ var _exportNames = {
11
11
  isSessionModelWithConfigEditing: true,
12
12
  isSessionWithAddTracks: true,
13
13
  isSessionModelWithWidgets: true,
14
+ isSessionModelWithConnections: true,
14
15
  isSessionWithSessionPlugins: true,
15
16
  isSelectionContainer: true,
16
17
  isViewModel: true,
@@ -34,6 +35,7 @@ exports.isRetryException = isRetryException;
34
35
  exports.isSelectionContainer = isSelectionContainer;
35
36
  exports.isSessionModel = isSessionModel;
36
37
  exports.isSessionModelWithConfigEditing = isSessionModelWithConfigEditing;
38
+ exports.isSessionModelWithConnections = isSessionModelWithConnections;
37
39
  exports.isSessionModelWithWidgets = isSessionModelWithWidgets;
38
40
  exports.isSessionWithAddTracks = isSessionWithAddTracks;
39
41
  exports.isSessionWithSessionPlugins = isSessionWithSessionPlugins;
@@ -103,6 +105,10 @@ function isSessionModelWithWidgets(thing) {
103
105
  return isSessionModel(thing) && 'widgets' in thing;
104
106
  }
105
107
 
108
+ function isSessionModelWithConnections(thing) {
109
+ return isSessionModel(thing) && 'addConnectionConf' in thing;
110
+ }
111
+
106
112
  function isSessionWithSessionPlugins(thing) {
107
113
  return isSessionModel(thing) && 'sessionPlugins' in thing;
108
114
  }
@@ -108,11 +108,11 @@ export declare const FileLocation: import("mobx-state-tree").ISnapshotProcessor<
108
108
  internetAccountType: import("mobx-state-tree").ISimpleType<string>;
109
109
  authInfo: import("mobx-state-tree").IType<any, any, any>;
110
110
  }, {}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
111
- }>> | import("mobx-state-tree").ModelInstanceTypeProps<{
111
+ }>> | import("mobx-state-tree").ModelInstanceType<{
112
112
  locationType: import("mobx-state-tree").ISimpleType<"BlobLocation">;
113
113
  name: import("mobx-state-tree").ISimpleType<string>;
114
114
  blobId: import("mobx-state-tree").ISimpleType<string>;
115
- }> | import("mobx-state-tree").ModelInstanceTypeProps<{
115
+ }, {}> | import("mobx-state-tree").ModelInstanceType<{
116
116
  locationType: import("mobx-state-tree").ISimpleType<"LocalPathLocation">;
117
117
  localPath: import("mobx-state-tree").ISimpleType<string>;
118
- }>>, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
118
+ }, {}>>, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
package/util/types/mst.js CHANGED
@@ -98,8 +98,10 @@ exports.UriLocationRaw = UriLocationRaw;
98
98
 
99
99
  var UriLocation = _mobxStateTree.types.snapshotProcessor(UriLocationRaw, {
100
100
  postProcessor: function postProcessor(snap) {
101
- var baseUri = snap.baseUri,
102
- rest = (0, _objectWithoutProperties2.default)(snap, _excluded);
101
+ // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
102
+ var _ref = snap,
103
+ baseUri = _ref.baseUri,
104
+ rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
103
105
 
104
106
  if (!baseUri) {
105
107
  return rest;
@@ -113,14 +115,16 @@ exports.UriLocation = UriLocation;
113
115
 
114
116
  var FileLocation = _mobxStateTree.types.snapshotProcessor(_mobxStateTree.types.union(LocalPathLocation, UriLocation, BlobLocation), {
115
117
  // @ts-ignore
116
- preProcessor: function preProcessor(snapshot) {
117
- if (!snapshot) {
118
+ preProcessor: function preProcessor(snap) {
119
+ if (!snap) {
118
120
  return undefined;
119
121
  } // @ts-ignore
122
+ // xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
120
123
 
121
124
 
122
- var locationType = snapshot.locationType,
123
- rest = (0, _objectWithoutProperties2.default)(snapshot, _excluded2);
125
+ var _ref2 = snap,
126
+ locationType = _ref2.locationType,
127
+ rest = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
124
128
 
125
129
  if (!locationType) {
126
130
  // @ts-ignore
@@ -142,7 +146,7 @@ var FileLocation = _mobxStateTree.types.snapshotProcessor(_mobxStateTree.types.u
142
146
  });
143
147
  }
144
148
 
145
- return snapshot;
149
+ return snap;
146
150
  }
147
151
  });
148
152