@jbrowse/plugin-breakpoint-split-view 2.6.3 → 2.7.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.
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { BreakpointViewModel } from '../model';
3
- declare const _default: (props: {
3
+ declare const Overlay: (props: {
4
4
  parentRef: React.RefObject<SVGSVGElement>;
5
5
  model: BreakpointViewModel;
6
6
  trackId: string;
7
7
  getTrackYPosOverride?: ((trackId: string, level: number) => number) | undefined;
8
8
  }) => React.JSX.Element | null;
9
- export default _default;
9
+ export default Overlay;
@@ -8,7 +8,7 @@ const mobx_react_1 = require("mobx-react");
8
8
  const AlignmentConnections_1 = __importDefault(require("./AlignmentConnections"));
9
9
  const Breakends_1 = __importDefault(require("./Breakends"));
10
10
  const Translocations_1 = __importDefault(require("./Translocations"));
11
- exports.default = (0, mobx_react_1.observer)(function (props) {
11
+ const Overlay = (0, mobx_react_1.observer)(function (props) {
12
12
  var _a, _b;
13
13
  const { model, trackId } = props;
14
14
  const tracks = model.getMatchedTracks(trackId);
@@ -20,3 +20,4 @@ exports.default = (0, mobx_react_1.observer)(function (props) {
20
20
  }
21
21
  return null;
22
22
  });
23
+ exports.default = Overlay;
@@ -60,8 +60,7 @@ const Translocations = (0, mobx_react_1.observer)(function ({ model, trackId, pa
60
60
  // we follow a path in the list of chunks, not from top to bottom,
61
61
  // just in series following x1,y1 -> x2,y2
62
62
  const ret = [];
63
- for (let i = 0; i < chunk.length; i += 1) {
64
- const { layout: c1, feature: f1, level: level1 } = chunk[i];
63
+ for (const { layout: c1, feature: f1, level: level1 } of chunk) {
65
64
  const level2 = level1 === 0 ? 1 : 0;
66
65
  const id = f1.id();
67
66
  if (!c1) {
@@ -75,12 +75,10 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
75
75
  volatileWidth: number | undefined;
76
76
  minimumBlockWidth: number;
77
77
  draggingTrackId: string | undefined;
78
- volatileError: Error | undefined;
78
+ volatileError: unknown;
79
79
  afterDisplayedRegionsSetCallbacks: Function[];
80
80
  scaleFactor: number;
81
- trackRefs: {
82
- [key: string]: HTMLDivElement;
83
- };
81
+ trackRefs: Record<string, HTMLDivElement>;
84
82
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
85
83
  coarseTotalBp: number;
86
84
  leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
@@ -104,7 +102,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
104
102
  readonly totalBp: number;
105
103
  readonly maxBpPerPx: number;
106
104
  readonly minBpPerPx: number;
107
- readonly error: string | Error;
105
+ readonly error: {};
108
106
  readonly maxOffset: number;
109
107
  readonly minOffset: number;
110
108
  readonly displayedRegionsTotalPx: number;
@@ -121,7 +119,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
121
119
  } & {
122
120
  setShowCytobands(flag: boolean): void;
123
121
  setWidth(newWidth: number): void;
124
- setError(error: Error | undefined): void;
122
+ setError(error: unknown): void;
125
123
  toggleHeader(): void;
126
124
  toggleHeaderOverview(): void;
127
125
  toggleNoTracksActive(): void;
@@ -223,6 +221,8 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
223
221
  end: number;
224
222
  reversed: boolean;
225
223
  } | undefined;
224
+ } & {
225
+ afterCreate(): void;
226
226
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
227
227
  }, {
228
228
  width: number;
@@ -234,9 +234,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
234
234
  setMinimized(flag: boolean): void;
235
235
  } & {
236
236
  width: number;
237
- matchedTrackFeatures: {
238
- [key: string]: Feature[][];
239
- };
237
+ matchedTrackFeatures: Record<string, Feature[][]>;
240
238
  } & {
241
239
  /**
242
240
  * #method
@@ -262,9 +260,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
262
260
  toggleInteract(): void;
263
261
  toggleIntraviewLinks(): void;
264
262
  toggleLinkViews(): void;
265
- setMatchedTrackFeatures(obj: {
266
- [key: string]: Feature[][];
267
- }): void;
263
+ setMatchedTrackFeatures(obj: Record<string, Feature[][]>): void;
268
264
  } & {
269
265
  afterAttach(): void;
270
266
  menuItems(): ({
@@ -151,7 +151,7 @@ function stateModelFactory(pluginManager) {
151
151
  onSubviewAction(actionName, path, args) {
152
152
  self.views.forEach(view => {
153
153
  const ret = (0, mobx_state_tree_1.getPath)(view);
154
- if (ret.lastIndexOf(path) !== ret.length - path.length) {
154
+ if (!ret.endsWith(path)) {
155
155
  // @ts-ignore
156
156
  view[actionName](args === null || args === void 0 ? void 0 : args[0]);
157
157
  }
@@ -5,9 +5,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const react_1 = __importDefault(require("react"));
7
7
  const material_1 = require("@mui/material");
8
- const color_1 = __importDefault(require("color"));
8
+ const util_1 = require("@jbrowse/core/util");
9
9
  function SVGBackground({ width, height, shift, }) {
10
10
  const theme = (0, material_1.useTheme)();
11
- return (react_1.default.createElement("rect", { width: width + shift * 2, height: height, fill: (0, color_1.default)(theme.palette.background.default).hex() }));
11
+ return (react_1.default.createElement("rect", { width: width + shift * 2, height: height, fill: (0, util_1.stripAlpha)(theme.palette.background.default) }));
12
12
  }
13
13
  exports.default = SVGBackground;
@@ -22,8 +22,7 @@ function getTrackNameMaxLen(views, fontSize, session) {
22
22
  function getTrackOffsets(view, textOffset, extra = 0) {
23
23
  const offsets = {};
24
24
  let curr = textOffset;
25
- for (let i = 0; i < view.tracks.length; i++) {
26
- const track = view.tracks[i];
25
+ for (const track of view.tracks) {
27
26
  offsets[track.configuration.trackId] = curr + extra;
28
27
  curr += track.displays[0].height + textOffset;
29
28
  }
@@ -14,7 +14,8 @@ function heightFromSpecificLevel(views, trackId, level, getYPosOverride) {
14
14
  : ((_a = views[level].trackRefs[trackId]) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().top) || 0;
15
15
  }
16
16
  function getPxFromCoordinate(view, refName, coord) {
17
- return ((view.bpToPx({ refName, coord }) || {}).offsetPx || 0) - view.offsetPx;
17
+ var _a;
18
+ return (((_a = view.bpToPx({ refName, coord })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - view.offsetPx;
18
19
  }
19
20
  exports.getPxFromCoordinate = getPxFromCoordinate;
20
21
  // get's the yposition of a layout record in a track
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
2
  import { BreakpointViewModel } from '../model';
3
- declare const _default: (props: {
3
+ declare const Overlay: (props: {
4
4
  parentRef: React.RefObject<SVGSVGElement>;
5
5
  model: BreakpointViewModel;
6
6
  trackId: string;
7
7
  getTrackYPosOverride?: ((trackId: string, level: number) => number) | undefined;
8
8
  }) => React.JSX.Element | null;
9
- export default _default;
9
+ export default Overlay;
@@ -3,7 +3,7 @@ import { observer } from 'mobx-react';
3
3
  import AlignmentConnections from './AlignmentConnections';
4
4
  import Breakends from './Breakends';
5
5
  import Translocations from './Translocations';
6
- export default observer(function (props) {
6
+ const Overlay = observer(function (props) {
7
7
  var _a, _b;
8
8
  const { model, trackId } = props;
9
9
  const tracks = model.getMatchedTracks(trackId);
@@ -15,3 +15,4 @@ export default observer(function (props) {
15
15
  }
16
16
  return null;
17
17
  });
18
+ export default Overlay;
@@ -35,8 +35,7 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
35
35
  // we follow a path in the list of chunks, not from top to bottom,
36
36
  // just in series following x1,y1 -> x2,y2
37
37
  const ret = [];
38
- for (let i = 0; i < chunk.length; i += 1) {
39
- const { layout: c1, feature: f1, level: level1 } = chunk[i];
38
+ for (const { layout: c1, feature: f1, level: level1 } of chunk) {
40
39
  const level2 = level1 === 0 ? 1 : 0;
41
40
  const id = f1.id();
42
41
  if (!c1) {
@@ -75,12 +75,10 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
75
75
  volatileWidth: number | undefined;
76
76
  minimumBlockWidth: number;
77
77
  draggingTrackId: string | undefined;
78
- volatileError: Error | undefined;
78
+ volatileError: unknown;
79
79
  afterDisplayedRegionsSetCallbacks: Function[];
80
80
  scaleFactor: number;
81
- trackRefs: {
82
- [key: string]: HTMLDivElement;
83
- };
81
+ trackRefs: Record<string, HTMLDivElement>;
84
82
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
85
83
  coarseTotalBp: number;
86
84
  leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
@@ -104,7 +102,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
104
102
  readonly totalBp: number;
105
103
  readonly maxBpPerPx: number;
106
104
  readonly minBpPerPx: number;
107
- readonly error: string | Error;
105
+ readonly error: {};
108
106
  readonly maxOffset: number;
109
107
  readonly minOffset: number;
110
108
  readonly displayedRegionsTotalPx: number;
@@ -121,7 +119,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
121
119
  } & {
122
120
  setShowCytobands(flag: boolean): void;
123
121
  setWidth(newWidth: number): void;
124
- setError(error: Error | undefined): void;
122
+ setError(error: unknown): void;
125
123
  toggleHeader(): void;
126
124
  toggleHeaderOverview(): void;
127
125
  toggleNoTracksActive(): void;
@@ -223,6 +221,8 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
223
221
  end: number;
224
222
  reversed: boolean;
225
223
  } | undefined;
224
+ } & {
225
+ afterCreate(): void;
226
226
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
227
227
  }, {
228
228
  width: number;
@@ -234,9 +234,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
234
234
  setMinimized(flag: boolean): void;
235
235
  } & {
236
236
  width: number;
237
- matchedTrackFeatures: {
238
- [key: string]: Feature[][];
239
- };
237
+ matchedTrackFeatures: Record<string, Feature[][]>;
240
238
  } & {
241
239
  /**
242
240
  * #method
@@ -262,9 +260,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
262
260
  toggleInteract(): void;
263
261
  toggleIntraviewLinks(): void;
264
262
  toggleLinkViews(): void;
265
- setMatchedTrackFeatures(obj: {
266
- [key: string]: Feature[][];
267
- }): void;
263
+ setMatchedTrackFeatures(obj: Record<string, Feature[][]>): void;
268
264
  } & {
269
265
  afterAttach(): void;
270
266
  menuItems(): ({
@@ -123,7 +123,7 @@ export default function stateModelFactory(pluginManager) {
123
123
  onSubviewAction(actionName, path, args) {
124
124
  self.views.forEach(view => {
125
125
  const ret = getPath(view);
126
- if (ret.lastIndexOf(path) !== ret.length - path.length) {
126
+ if (!ret.endsWith(path)) {
127
127
  // @ts-ignore
128
128
  view[actionName](args === null || args === void 0 ? void 0 : args[0]);
129
129
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { useTheme } from '@mui/material';
3
- import Color from 'color';
3
+ import { stripAlpha } from '@jbrowse/core/util';
4
4
  export default function SVGBackground({ width, height, shift, }) {
5
5
  const theme = useTheme();
6
- return (React.createElement("rect", { width: width + shift * 2, height: height, fill: Color(theme.palette.background.default).hex() }));
6
+ return (React.createElement("rect", { width: width + shift * 2, height: height, fill: stripAlpha(theme.palette.background.default) }));
7
7
  }
@@ -16,8 +16,7 @@ function getTrackNameMaxLen(views, fontSize, session) {
16
16
  function getTrackOffsets(view, textOffset, extra = 0) {
17
17
  const offsets = {};
18
18
  let curr = textOffset;
19
- for (let i = 0; i < view.tracks.length; i++) {
20
- const track = view.tracks[i];
19
+ for (const track of view.tracks) {
21
20
  offsets[track.configuration.trackId] = curr + extra;
22
21
  curr += track.displays[0].height + textOffset;
23
22
  }
@@ -11,7 +11,8 @@ function heightFromSpecificLevel(views, trackId, level, getYPosOverride) {
11
11
  : ((_a = views[level].trackRefs[trackId]) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().top) || 0;
12
12
  }
13
13
  export function getPxFromCoordinate(view, refName, coord) {
14
- return ((view.bpToPx({ refName, coord }) || {}).offsetPx || 0) - view.offsetPx;
14
+ var _a;
15
+ return (((_a = view.bpToPx({ refName, coord })) === null || _a === void 0 ? void 0 : _a.offsetPx) || 0) - view.offsetPx;
15
16
  }
16
17
  // get's the yposition of a layout record in a track
17
18
  export function yPos(trackId, level, views, tracks, c, getYPosOverride) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-breakpoint-split-view",
3
- "version": "2.6.3",
3
+ "version": "2.7.1",
4
4
  "description": "JBrowse 2 breakpoint detail split view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -39,7 +39,6 @@
39
39
  "@gmod/vcf": "^5.0.9",
40
40
  "@mui/icons-material": "^5.0.1",
41
41
  "@types/file-saver": "^2.0.1",
42
- "color": "^3.1.3",
43
42
  "file-saver": "^2.0.0"
44
43
  },
45
44
  "peerDependencies": {
@@ -47,7 +46,7 @@
47
46
  "@jbrowse/plugin-linear-genome-view": "^2.0.0",
48
47
  "@mui/material": "^5.0.0",
49
48
  "mobx": "^6.0.0",
50
- "mobx-react": "^7.0.0",
49
+ "mobx-react": "^9.0.0",
51
50
  "mobx-state-tree": "^5.0.0",
52
51
  "react": ">=16.8.4",
53
52
  "react-dom": ">=16.8.4",
@@ -59,5 +58,5 @@
59
58
  "publishConfig": {
60
59
  "access": "public"
61
60
  },
62
- "gitHead": "ed402c87efb0904858d602c363bd1757d5742129"
61
+ "gitHead": "2cda1611eebd12517f2a3cfc1b612face27005d4"
63
62
  }