@jbrowse/core 1.7.10 → 1.7.11

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.
package/util/index.d.ts CHANGED
@@ -24,7 +24,7 @@ export declare function getSession(node: IAnyStateTreeNode): import("./types").A
24
24
  /** get the state model of the view in the state tree that contains the given node */
25
25
  export declare function getContainingView(node: IAnyStateTreeNode): import("./types").AbstractViewModel & IAnyStateTreeNode;
26
26
  /** get the state model of the view in the state tree that contains the given node */
27
- export declare function getContainingTrack(node: IAnyStateTreeNode): IAnyStateTreeNode;
27
+ export declare function getContainingTrack(node: IAnyStateTreeNode): import("./types").AbstractTrackModel & IAnyStateTreeNode;
28
28
  export declare function getContainingDisplay(node: IAnyStateTreeNode): import("./types").AbstractDisplayModel & IAnyStateTreeNode;
29
29
  /**
30
30
  * Assemble a 1-based "locString" from an interbase genomic location
@@ -344,7 +344,6 @@ export declare function supportedIndexingAdapters(type: string): boolean;
344
344
  export declare function getBpDisplayStr(totalBp: number): string;
345
345
  export declare function toLocale(n: number): string;
346
346
  export declare function getTickDisplayStr(totalBp: number, bpPerPx: number): string;
347
- export declare function getTickDisplayStr2(totalBp: number, bpPerPx: number): string;
348
347
  export declare function getViewParams(model: IAnyStateTreeNode, exportSVG?: boolean): {
349
348
  offsetPx: number;
350
349
  offsetPx1: number;
package/util/index.js CHANGED
@@ -60,7 +60,6 @@ var _exportNames = {
60
60
  getBpDisplayStr: true,
61
61
  toLocale: true,
62
62
  getTickDisplayStr: true,
63
- getTickDisplayStr2: true,
64
63
  getViewParams: true,
65
64
  getLayoutId: true,
66
65
  SimpleFeature: true,
@@ -95,7 +94,6 @@ exports.getContainingView = getContainingView;
95
94
  exports.getLayoutId = getLayoutId;
96
95
  exports.getSession = getSession;
97
96
  exports.getTickDisplayStr = getTickDisplayStr;
98
- exports.getTickDisplayStr2 = getTickDisplayStr2;
99
97
  exports.getViewParams = getViewParams;
100
98
  exports.hashCode = hashCode;
101
99
  exports.isElectron = exports.inProduction = exports.inDevelopment = void 0;
@@ -1423,7 +1421,7 @@ function getBpDisplayStr(totalBp) {
1423
1421
  } else if (Math.floor(totalBp / 1000) > 0) {
1424
1422
  str = "".concat(parseFloat((totalBp / 1000).toPrecision(3)), "Kbp");
1425
1423
  } else {
1426
- str = "".concat(Math.floor(totalBp).toLocaleString('en-US'), "bp");
1424
+ str = "".concat(toLocale(Math.floor(totalBp)), "bp");
1427
1425
  }
1428
1426
 
1429
1427
  return str;
@@ -1445,18 +1443,6 @@ function getTickDisplayStr(totalBp, bpPerPx) {
1445
1443
  return str;
1446
1444
  }
1447
1445
 
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
1446
  function getViewParams(model, exportSVG) {
1461
1447
  // @ts-ignore
1462
1448
  var _getContainingView = getContainingView(model),
@@ -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();
@@ -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
  }