@jbrowse/core 2.11.1 → 2.12.0
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/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.js +17 -26
- package/BaseFeatureWidget/BaseFeatureDetail/index.js +1 -3
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +24 -85
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.js +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.d.ts +3 -4
- package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.js +55 -24
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.d.ts +9 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.js +69 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.d.ts +9 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.js +126 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.d.ts +6 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.js +68 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.js +19 -10
- package/BaseFeatureWidget/SequenceFeatureDetails/model.d.ts +47 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/model.js +83 -9
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.d.ts +3 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.js +76 -19
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.d.ts +5 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.js +12 -3
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.d.ts +7 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.js +51 -5
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.d.ts +5 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.js +12 -3
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.d.ts +11 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.js +30 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/util.d.ts +11 -0
- package/BaseFeatureWidget/SequenceFeatureDetails/util.js +43 -1
- package/BaseFeatureWidget/stateModelFactory.d.ts +32 -2
- package/PluginManager.d.ts +2 -11
- package/ReExports/modules.d.ts +2 -11
- package/configuration/util.js +4 -11
- package/package.json +5 -3
- package/pluggableElementTypes/models/BaseDisplayModel.d.ts +3 -3
- package/pluggableElementTypes/models/BaseDisplayModel.js +3 -3
- package/pluggableElementTypes/renderers/util/serializableFilterChain.js +4 -1
- package/rpc/methods/util.d.ts +3 -2
- package/rpc/methods/util.js +0 -7
- package/stories/JBrowseCore.stories.d.ts +5 -0
- package/stories/JBrowseCore.stories.js +10 -0
- package/stories/examples/WithSequencePanel.d.ts +7 -0
- package/stories/examples/WithSequencePanel.js +43 -0
- package/stories/examples/index.d.ts +1 -0
- package/stories/examples/index.js +17 -0
- package/stories/examples/util.d.ts +33 -0
- package/stories/examples/util.js +235 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/Dialog.js +2 -1
- package/ui/ErrorMessageStackTraceDialog.js +13 -8
- package/util/Base1DUtils.d.ts +1 -1
- package/util/Base1DUtils.js +3 -7
- package/util/Base1DViewModel.d.ts +5 -16
- package/util/Base1DViewModel.js +6 -12
- package/util/blockTypes.d.ts +4 -0
- package/util/blockTypes.js +14 -3
- package/util/calculateDynamicBlocks.js +2 -3
- package/util/index.d.ts +1 -1
- package/util/range.d.ts +1 -1
- package/util/tracks.d.ts +3 -2
- package/util/tracks.js +10 -6
- package/util/types/index.d.ts +4 -1
- package/ui/ResizeBar.d.ts +0 -7
- package/ui/ResizeBar.js +0 -80
- package/ui/useResizeBar.d.ts +0 -5
- package/ui/useResizeBar.js +0 -22
package/ui/Dialog.js
CHANGED
|
@@ -12,6 +12,7 @@ const react_error_boundary_1 = require("react-error-boundary");
|
|
|
12
12
|
const Close_1 = __importDefault(require("@mui/icons-material/Close"));
|
|
13
13
|
// locals
|
|
14
14
|
const ErrorMessage_1 = __importDefault(require("./ErrorMessage"));
|
|
15
|
+
const SanitizedHTML_1 = __importDefault(require("./SanitizedHTML"));
|
|
15
16
|
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
16
17
|
closeButton: {
|
|
17
18
|
position: 'absolute',
|
|
@@ -31,7 +32,7 @@ const Dialog = (0, mobx_react_1.observer)(function (props) {
|
|
|
31
32
|
return (react_1.default.createElement(material_1.Dialog, { ...props },
|
|
32
33
|
react_1.default.createElement(material_1.ScopedCssBaseline, null,
|
|
33
34
|
react_1.default.isValidElement(header) ? (header) : (react_1.default.createElement(material_1.DialogTitle, null,
|
|
34
|
-
title,
|
|
35
|
+
react_1.default.createElement(SanitizedHTML_1.default, { html: title || '' }),
|
|
35
36
|
onClose ? (react_1.default.createElement(material_1.IconButton, { className: classes.closeButton, onClick: () => {
|
|
36
37
|
// @ts-expect-error
|
|
37
38
|
onClose();
|
|
@@ -28,6 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
const material_1 = require("@mui/material");
|
|
31
|
+
const mui_1 = require("tss-react/mui");
|
|
31
32
|
const source_map_js_1 = require("source-map-js");
|
|
32
33
|
const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
|
|
33
34
|
// locals
|
|
@@ -90,7 +91,7 @@ async function mapStackTrace(stack) {
|
|
|
90
91
|
mappedStack.push(line);
|
|
91
92
|
continue;
|
|
92
93
|
}
|
|
93
|
-
mappedStack.push(`${originalPosition.source}:${originalPosition.line}:${originalPosition.column + 1}`);
|
|
94
|
+
mappedStack.push(`${originalPosition.source}:${originalPosition.line}:${originalPosition.column + 1} (${match[1].trim()})`);
|
|
94
95
|
}
|
|
95
96
|
return mappedStack.join('\n');
|
|
96
97
|
}
|
|
@@ -107,7 +108,17 @@ function stripMessage(trace, error) {
|
|
|
107
108
|
return trace;
|
|
108
109
|
}
|
|
109
110
|
}
|
|
111
|
+
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
112
|
+
pre: {
|
|
113
|
+
background: (0, material_1.alpha)(theme.palette.error.main, 0.2),
|
|
114
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
115
|
+
overflow: 'auto',
|
|
116
|
+
margin: 20,
|
|
117
|
+
maxHeight: 300,
|
|
118
|
+
},
|
|
119
|
+
}));
|
|
110
120
|
function Contents({ text, extra }) {
|
|
121
|
+
const { classes } = useStyles();
|
|
111
122
|
const err = encodeURIComponent([
|
|
112
123
|
'I got this error from JBrowse, here is the stack trace:\n',
|
|
113
124
|
'```',
|
|
@@ -129,13 +140,7 @@ function Contents({ text, extra }) {
|
|
|
129
140
|
" or send an email to ",
|
|
130
141
|
react_1.default.createElement(Link2, { href: emailLink }, email),
|
|
131
142
|
' '),
|
|
132
|
-
react_1.default.createElement("pre", {
|
|
133
|
-
background: 'lightgrey',
|
|
134
|
-
border: '1px solid black',
|
|
135
|
-
overflow: 'auto',
|
|
136
|
-
margin: 20,
|
|
137
|
-
maxHeight: 300,
|
|
138
|
-
} }, err2)));
|
|
143
|
+
react_1.default.createElement("pre", { className: classes.pre }, err2)));
|
|
139
144
|
}
|
|
140
145
|
function ErrorMessageStackTraceDialog({ error, onClose, extra, }) {
|
|
141
146
|
const [mappedStackTrace, setMappedStackTrace] = (0, react_1.useState)();
|
package/util/Base1DUtils.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare function pxToBp(self: ViewSnap, px: number): {
|
|
|
19
19
|
offset: number;
|
|
20
20
|
start: number;
|
|
21
21
|
end: number;
|
|
22
|
-
reversed
|
|
22
|
+
reversed?: boolean;
|
|
23
23
|
};
|
|
24
24
|
export declare function bpToPx({ refName, coord, regionNumber, self, }: {
|
|
25
25
|
refName: string;
|
package/util/Base1DUtils.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.bpToPxMap = exports.bpToPx = exports.pxToBp = exports.moveTo = void 0;
|
|
4
|
-
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
4
|
function lengthBetween(self, start, end) {
|
|
6
5
|
let bpSoFar = 0;
|
|
7
6
|
const { displayedRegions } = self;
|
|
@@ -69,8 +68,7 @@ function pxToBp(self, px) {
|
|
|
69
68
|
const bp = (offsetPx + px) * bpPerPx;
|
|
70
69
|
if (bp < 0) {
|
|
71
70
|
const r = displayedRegions[0];
|
|
72
|
-
const snap =
|
|
73
|
-
// @ts-expect-error
|
|
71
|
+
const snap = r;
|
|
74
72
|
return {
|
|
75
73
|
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
76
74
|
...snap,
|
|
@@ -87,8 +85,7 @@ function pxToBp(self, px) {
|
|
|
87
85
|
const len = r.end - r.start;
|
|
88
86
|
const offset = bp - bpSoFar;
|
|
89
87
|
if (len + bpSoFar > bp && bpSoFar <= bp) {
|
|
90
|
-
const snap =
|
|
91
|
-
// @ts-expect-error
|
|
88
|
+
const snap = r;
|
|
92
89
|
return {
|
|
93
90
|
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
94
91
|
...snap,
|
|
@@ -112,8 +109,7 @@ function pxToBp(self, px) {
|
|
|
112
109
|
const r = displayedRegions.at(-1);
|
|
113
110
|
const len = r.end - r.start;
|
|
114
111
|
const offset = bp - bpSoFar + len;
|
|
115
|
-
const snap =
|
|
116
|
-
// @ts-expect-error
|
|
112
|
+
const snap = r;
|
|
117
113
|
return {
|
|
118
114
|
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
119
115
|
...snap,
|
|
@@ -4,16 +4,7 @@ import { Region as IRegion } from './types';
|
|
|
4
4
|
import { BpOffset } from './Base1DUtils';
|
|
5
5
|
declare const Base1DView: import("mobx-state-tree").IModelType<{
|
|
6
6
|
id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
|
|
7
|
-
displayedRegions: import("mobx-state-tree").
|
|
8
|
-
refName: import("mobx-state-tree").ISimpleType<string>;
|
|
9
|
-
start: import("mobx-state-tree").ISimpleType<number>;
|
|
10
|
-
end: import("mobx-state-tree").ISimpleType<number>;
|
|
11
|
-
reversed: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
|
|
12
|
-
} & {
|
|
13
|
-
assemblyName: import("mobx-state-tree").ISimpleType<string>;
|
|
14
|
-
}, {
|
|
15
|
-
setRefName(newRefName: string): void;
|
|
16
|
-
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
|
|
7
|
+
displayedRegions: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IType<IRegion[], IRegion[], IRegion[]>, [undefined]>;
|
|
17
8
|
bpPerPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
18
9
|
offsetPx: import("mobx-state-tree").IType<number | undefined, number, number>;
|
|
19
10
|
interRegionPaddingWidth: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<number>, [undefined]>;
|
|
@@ -78,16 +69,14 @@ declare const Base1DView: import("mobx-state-tree").IModelType<{
|
|
|
78
69
|
*/
|
|
79
70
|
pxToBp(px: number): {
|
|
80
71
|
coord: number;
|
|
81
|
-
index: number;
|
|
82
|
-
* #getter
|
|
83
|
-
*/
|
|
72
|
+
index: number;
|
|
84
73
|
refName: string;
|
|
85
74
|
oob: boolean;
|
|
86
75
|
assemblyName: string;
|
|
87
76
|
offset: number;
|
|
88
77
|
start: number;
|
|
89
78
|
end: number;
|
|
90
|
-
reversed
|
|
79
|
+
reversed?: boolean | undefined;
|
|
91
80
|
};
|
|
92
81
|
/**
|
|
93
82
|
* #method
|
|
@@ -136,8 +125,8 @@ declare const Base1DView: import("mobx-state-tree").IModelType<{
|
|
|
136
125
|
} & {
|
|
137
126
|
/**
|
|
138
127
|
* #action
|
|
139
|
-
* offset is the base-pair-offset in the displayed region, index is the
|
|
140
|
-
* displayed region in the linear genome view
|
|
128
|
+
* offset is the base-pair-offset in the displayed region, index is the
|
|
129
|
+
* index of the displayed region in the linear genome view
|
|
141
130
|
*
|
|
142
131
|
* @param start - object as `{start, end, offset, index}`
|
|
143
132
|
* @param end - object as `{start, end, offset, index}`
|
package/util/Base1DViewModel.js
CHANGED
|
@@ -24,7 +24,7 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
24
24
|
/**
|
|
25
25
|
* #property
|
|
26
26
|
*/
|
|
27
|
-
displayedRegions: mobx_state_tree_1.types.
|
|
27
|
+
displayedRegions: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.frozen(), []),
|
|
28
28
|
/**
|
|
29
29
|
* #property
|
|
30
30
|
*/
|
|
@@ -77,9 +77,7 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
77
77
|
* #getter
|
|
78
78
|
*/
|
|
79
79
|
get assemblyNames() {
|
|
80
|
-
return [
|
|
81
|
-
...new Set(self.displayedRegions.map(region => region.assemblyName)),
|
|
82
|
-
];
|
|
80
|
+
return [...new Set(self.displayedRegions.map(r => r.assemblyName))];
|
|
83
81
|
},
|
|
84
82
|
/**
|
|
85
83
|
* #getter
|
|
@@ -107,9 +105,7 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
107
105
|
* #getter
|
|
108
106
|
*/
|
|
109
107
|
get totalBp() {
|
|
110
|
-
return self.displayedRegions
|
|
111
|
-
.map(a => a.end - a.start)
|
|
112
|
-
.reduce((a, b) => a + b, 0);
|
|
108
|
+
return (0, index_1.sum)(self.displayedRegions.map(a => a.end - a.start));
|
|
113
109
|
},
|
|
114
110
|
}))
|
|
115
111
|
.views(self => ({
|
|
@@ -129,9 +125,7 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
129
125
|
* #getter
|
|
130
126
|
*/
|
|
131
127
|
get currBp() {
|
|
132
|
-
return this.dynamicBlocks
|
|
133
|
-
.map(a => a.end - a.start)
|
|
134
|
-
.reduce((a, b) => a + b, 0);
|
|
128
|
+
return (0, index_1.sum)(this.dynamicBlocks.map(a => a.end - a.start));
|
|
135
129
|
},
|
|
136
130
|
}))
|
|
137
131
|
.views(self => ({
|
|
@@ -230,8 +224,8 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
230
224
|
.actions(self => ({
|
|
231
225
|
/**
|
|
232
226
|
* #action
|
|
233
|
-
* offset is the base-pair-offset in the displayed region, index is the
|
|
234
|
-
* displayed region in the linear genome view
|
|
227
|
+
* offset is the base-pair-offset in the displayed region, index is the
|
|
228
|
+
* index of the displayed region in the linear genome view
|
|
235
229
|
*
|
|
236
230
|
* @param start - object as `{start, end, offset, index}`
|
|
237
231
|
* @param end - object as `{start, end, offset, index}`
|
package/util/blockTypes.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export declare class BlockSet {
|
|
|
21
21
|
get totalBp(): number;
|
|
22
22
|
}
|
|
23
23
|
export declare class BaseBlock {
|
|
24
|
+
type: string;
|
|
24
25
|
regionNumber?: number;
|
|
25
26
|
reversed?: boolean;
|
|
26
27
|
refName: string;
|
|
@@ -45,12 +46,14 @@ export declare class BaseBlock {
|
|
|
45
46
|
};
|
|
46
47
|
}
|
|
47
48
|
export declare class ContentBlock extends BaseBlock {
|
|
49
|
+
type: string;
|
|
48
50
|
}
|
|
49
51
|
/**
|
|
50
52
|
* marker block representing one or more blocks that are
|
|
51
53
|
* too small to be shown at the current zoom level
|
|
52
54
|
*/
|
|
53
55
|
export declare class ElidedBlock extends BaseBlock {
|
|
56
|
+
type: string;
|
|
54
57
|
widthPx: number;
|
|
55
58
|
elidedBlockCount: number;
|
|
56
59
|
constructor(data: Record<string, any>);
|
|
@@ -61,5 +64,6 @@ export declare class ElidedBlock extends BaseBlock {
|
|
|
61
64
|
* and provides a thick border between them
|
|
62
65
|
*/
|
|
63
66
|
export declare class InterRegionPaddingBlock extends BaseBlock {
|
|
67
|
+
type: string;
|
|
64
68
|
}
|
|
65
69
|
export {};
|
package/util/blockTypes.js
CHANGED
|
@@ -7,9 +7,10 @@ class BlockSet {
|
|
|
7
7
|
this.blocks = blocks;
|
|
8
8
|
}
|
|
9
9
|
push(block) {
|
|
10
|
-
if (block
|
|
10
|
+
if (block.type === 'ElidedBlock' && this.blocks.length > 0) {
|
|
11
11
|
const lastBlock = this.blocks.at(-1);
|
|
12
|
-
if (lastBlock
|
|
12
|
+
if ((lastBlock === null || lastBlock === void 0 ? void 0 : lastBlock.type) === 'ElidedBlock') {
|
|
13
|
+
;
|
|
13
14
|
lastBlock.push(block);
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
@@ -49,7 +50,7 @@ class BlockSet {
|
|
|
49
50
|
return this.blocks.length > 0 ? this.blocks[0].offsetPx : 0;
|
|
50
51
|
}
|
|
51
52
|
get contentBlocks() {
|
|
52
|
-
return this.blocks.filter(block => block
|
|
53
|
+
return this.blocks.filter(block => block.type === 'ContentBlock');
|
|
53
54
|
}
|
|
54
55
|
get totalBp() {
|
|
55
56
|
return (0, _1.sum)(this.contentBlocks.map(block => block.end - block.start));
|
|
@@ -62,6 +63,7 @@ class BaseBlock {
|
|
|
62
63
|
*/
|
|
63
64
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
64
65
|
constructor(data) {
|
|
66
|
+
this.type = 'BaseBlock';
|
|
65
67
|
this.widthPx = 0;
|
|
66
68
|
Object.assign(this, data);
|
|
67
69
|
this.assemblyName = data.assemblyName;
|
|
@@ -83,6 +85,10 @@ class BaseBlock {
|
|
|
83
85
|
}
|
|
84
86
|
exports.BaseBlock = BaseBlock;
|
|
85
87
|
class ContentBlock extends BaseBlock {
|
|
88
|
+
constructor() {
|
|
89
|
+
super(...arguments);
|
|
90
|
+
this.type = 'ContentBlock';
|
|
91
|
+
}
|
|
86
92
|
}
|
|
87
93
|
exports.ContentBlock = ContentBlock;
|
|
88
94
|
/**
|
|
@@ -93,6 +99,7 @@ class ElidedBlock extends BaseBlock {
|
|
|
93
99
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
94
100
|
constructor(data) {
|
|
95
101
|
super(data);
|
|
102
|
+
this.type = 'ElidedBlock';
|
|
96
103
|
this.elidedBlockCount = 0;
|
|
97
104
|
this.widthPx = data.widthPx;
|
|
98
105
|
}
|
|
@@ -112,5 +119,9 @@ exports.ElidedBlock = ElidedBlock;
|
|
|
112
119
|
* and provides a thick border between them
|
|
113
120
|
*/
|
|
114
121
|
class InterRegionPaddingBlock extends BaseBlock {
|
|
122
|
+
constructor() {
|
|
123
|
+
super(...arguments);
|
|
124
|
+
this.type = 'InterRegionPaddingBlock';
|
|
125
|
+
}
|
|
115
126
|
}
|
|
116
127
|
exports.InterRegionPaddingBlock = InterRegionPaddingBlock;
|
|
@@ -38,10 +38,9 @@ function calculateDynamicBlocks(model, padding = true, elision = true) {
|
|
|
38
38
|
const displayedRegionRightPx = displayedRegionLeftPx + (regionEnd - regionStart) / bpPerPx;
|
|
39
39
|
const regionWidthPx = (regionEnd - regionStart) / bpPerPx;
|
|
40
40
|
const parentRegion = (0, mobx_state_tree_1.isStateTreeNode)(region) ? (0, mobx_state_tree_1.getSnapshot)(region) : region;
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
const [leftPx, rightPx] = (0, range_1.intersection2)(windowLeftPx, windowRightPx, displayedRegionLeftPx, displayedRegionRightPx);
|
|
42
|
+
if (leftPx !== undefined && rightPx !== undefined) {
|
|
43
43
|
// this displayed region overlaps the view, so make a record for it
|
|
44
|
-
const [leftPx, rightPx] = (0, range_1.intersection2)(windowLeftPx, windowRightPx, displayedRegionLeftPx, displayedRegionRightPx);
|
|
45
44
|
let start;
|
|
46
45
|
let end;
|
|
47
46
|
let isLeftEndOfDisplayedRegion;
|
package/util/index.d.ts
CHANGED
package/util/range.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @returns array of [left, right], or [] if the ranges do not intersect. the choice of [] is because it allows destructuring array assignment without check for undefined return
|
|
7
7
|
*/
|
|
8
|
-
export declare function intersection2(left1: number, right1: number, left2: number, right2: number): number[];
|
|
8
|
+
export declare function intersection2(left1: number, right1: number, left2: number, right2: number): [number, number] | [];
|
|
9
9
|
/**
|
|
10
10
|
* Return whether 2 interbase coordinate ranges intersect.
|
|
11
11
|
*
|
package/util/tracks.d.ts
CHANGED
|
@@ -4,11 +4,12 @@ import { AnyConfigurationModel } from '../configuration';
|
|
|
4
4
|
export declare function getTrackAssemblyNames(track: IAnyStateTreeNode & {
|
|
5
5
|
configuration: AnyConfigurationModel;
|
|
6
6
|
}): string[];
|
|
7
|
+
export declare function getConfAssemblyNames(conf: AnyConfigurationModel): string[];
|
|
7
8
|
/** return the rpcSessionId of the highest parent node in the tree that has an rpcSessionId */
|
|
8
9
|
export declare function getRpcSessionId(thisNode: IAnyStateTreeNode): string;
|
|
9
10
|
/**
|
|
10
|
-
* given an MST node, get the renderprops of the first parent container that
|
|
11
|
-
* renderProps
|
|
11
|
+
* given an MST node, get the renderprops of the first parent container that
|
|
12
|
+
* has renderProps
|
|
12
13
|
* @param node -
|
|
13
14
|
* @returns renderprops, or empty object if none found
|
|
14
15
|
*/
|
package/util/tracks.js
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getTrackName = exports.generateUnknownTrackConf = exports.generateUnsupportedTrackConf = exports.guessTrackType = exports.guessAdapter = exports.getFileName = exports.makeIndexType = exports.makeIndex = exports.storeBlobLocation = exports.setBlobMap = exports.getBlobMap = exports.getBlob = exports.UNSUPPORTED = exports.UNKNOWN = exports.getParentRenderProps = exports.getRpcSessionId = exports.getTrackAssemblyNames = void 0;
|
|
3
|
+
exports.getTrackName = exports.generateUnknownTrackConf = exports.generateUnsupportedTrackConf = exports.guessTrackType = exports.guessAdapter = exports.getFileName = exports.makeIndexType = exports.makeIndex = exports.storeBlobLocation = exports.setBlobMap = exports.getBlobMap = exports.getBlob = exports.UNSUPPORTED = exports.UNKNOWN = exports.getParentRenderProps = exports.getRpcSessionId = exports.getConfAssemblyNames = exports.getTrackAssemblyNames = void 0;
|
|
4
4
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
5
|
const index_1 = require("./index");
|
|
6
6
|
const configuration_1 = require("../configuration");
|
|
7
7
|
/* utility functions for use by track models and so forth */
|
|
8
8
|
function getTrackAssemblyNames(track) {
|
|
9
|
-
|
|
9
|
+
return getConfAssemblyNames(track.configuration);
|
|
10
|
+
}
|
|
11
|
+
exports.getTrackAssemblyNames = getTrackAssemblyNames;
|
|
12
|
+
function getConfAssemblyNames(conf) {
|
|
13
|
+
const trackAssemblyNames = (0, configuration_1.readConfObject)(conf, 'assemblyNames');
|
|
10
14
|
if (!trackAssemblyNames) {
|
|
11
15
|
// Check if it's an assembly sequence track
|
|
12
16
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
const parent = (0, mobx_state_tree_1.getParent)(
|
|
17
|
+
const parent = (0, mobx_state_tree_1.getParent)(conf);
|
|
14
18
|
if ('sequence' in parent) {
|
|
15
19
|
return [(0, configuration_1.readConfObject)(parent, 'name')];
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
22
|
return trackAssemblyNames;
|
|
19
23
|
}
|
|
20
|
-
exports.
|
|
24
|
+
exports.getConfAssemblyNames = getConfAssemblyNames;
|
|
21
25
|
/** return the rpcSessionId of the highest parent node in the tree that has an rpcSessionId */
|
|
22
26
|
function getRpcSessionId(thisNode) {
|
|
23
27
|
let highestRpcSessionId;
|
|
@@ -34,8 +38,8 @@ function getRpcSessionId(thisNode) {
|
|
|
34
38
|
}
|
|
35
39
|
exports.getRpcSessionId = getRpcSessionId;
|
|
36
40
|
/**
|
|
37
|
-
* given an MST node, get the renderprops of the first parent container that
|
|
38
|
-
* renderProps
|
|
41
|
+
* given an MST node, get the renderprops of the first parent container that
|
|
42
|
+
* has renderProps
|
|
39
43
|
* @param node -
|
|
40
44
|
* @returns renderprops, or empty object if none found
|
|
41
45
|
*/
|
package/util/types/index.d.ts
CHANGED
|
@@ -225,7 +225,10 @@ export interface AbstractMenuManager {
|
|
|
225
225
|
export declare function isAbstractMenuManager(thing: unknown): thing is AbstractMenuManager;
|
|
226
226
|
export interface NoAssemblyRegion extends SnapshotIn<typeof MUNoAssemblyRegion> {
|
|
227
227
|
}
|
|
228
|
-
/**
|
|
228
|
+
/**
|
|
229
|
+
* a description of a specific genomic region. assemblyName, refName, start,
|
|
230
|
+
* end, and reversed
|
|
231
|
+
*/
|
|
229
232
|
export interface Region extends SnapshotIn<typeof MUIRegion> {
|
|
230
233
|
}
|
|
231
234
|
export interface AugmentedRegion extends Region {
|
package/ui/ResizeBar.d.ts
DELETED
package/ui/ResizeBar.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const react_1 = __importStar(require("react"));
|
|
30
|
-
const mui_1 = require("tss-react/mui");
|
|
31
|
-
// locals
|
|
32
|
-
const ResizeHandle_1 = __importDefault(require("./ResizeHandle"));
|
|
33
|
-
const useStyles = (0, mui_1.makeStyles)()(theme => ({
|
|
34
|
-
resizeBar: {
|
|
35
|
-
background: theme.palette.action.disabledBackground,
|
|
36
|
-
height: 12,
|
|
37
|
-
position: 'relative',
|
|
38
|
-
overflow: 'hidden',
|
|
39
|
-
},
|
|
40
|
-
tick: {
|
|
41
|
-
position: 'absolute',
|
|
42
|
-
height: '100%',
|
|
43
|
-
pointerEvents: 'none',
|
|
44
|
-
background: theme.palette.action.disabled,
|
|
45
|
-
width: 1,
|
|
46
|
-
},
|
|
47
|
-
hiddenTick: {
|
|
48
|
-
position: 'absolute',
|
|
49
|
-
height: '100%',
|
|
50
|
-
width: 5,
|
|
51
|
-
},
|
|
52
|
-
}));
|
|
53
|
-
function Tick({ left, scrollLeft, idx, onDrag, onMouseDown, }) {
|
|
54
|
-
const { classes } = useStyles();
|
|
55
|
-
const onDragCallback = (0, react_1.useCallback)((lastFrameDistance, totalDistance) => onDrag(lastFrameDistance, totalDistance, idx), [idx, onDrag]);
|
|
56
|
-
// has an invisible wider than tick mark (1px) clickable area (5px)
|
|
57
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
58
|
-
react_1.default.createElement(ResizeHandle_1.default, { onDrag: onDragCallback, onMouseDown: onMouseDown, vertical: true, className: classes.hiddenTick, style: { left: left - scrollLeft - 2.5 } }),
|
|
59
|
-
react_1.default.createElement("div", { style: { left: left - scrollLeft }, className: classes.tick })));
|
|
60
|
-
}
|
|
61
|
-
function ResizeBar({ widths, setWidths, checkbox, scrollLeft = 0, }) {
|
|
62
|
-
const { classes } = useStyles();
|
|
63
|
-
const offsets = [];
|
|
64
|
-
const [initial, setInitial] = (0, react_1.useState)();
|
|
65
|
-
let init = checkbox ? 52 : 0;
|
|
66
|
-
for (let i = 0; i < widths.length; i++) {
|
|
67
|
-
const width = widths[i];
|
|
68
|
-
offsets[i] = width + init;
|
|
69
|
-
init += width;
|
|
70
|
-
}
|
|
71
|
-
return (react_1.default.createElement("div", { className: classes.resizeBar }, offsets.map((left, i) => (react_1.default.createElement(Tick, { key: i, onMouseDown: () => {
|
|
72
|
-
setInitial([...widths]);
|
|
73
|
-
}, left: i === offsets.length - 1 ? left - 3 : left, onDrag: (_, totalDistance, idx) => {
|
|
74
|
-
const newWidths = [...widths];
|
|
75
|
-
// mui doesn't allow columns smaller than 50
|
|
76
|
-
newWidths[idx] = Math.max(initial[idx] - totalDistance, 50);
|
|
77
|
-
setWidths(newWidths);
|
|
78
|
-
}, idx: i, scrollLeft: scrollLeft })))));
|
|
79
|
-
}
|
|
80
|
-
exports.default = ResizeBar;
|
package/ui/useResizeBar.d.ts
DELETED
package/ui/useResizeBar.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useResizeBar = void 0;
|
|
4
|
-
const react_1 = require("react");
|
|
5
|
-
function useResizeBar() {
|
|
6
|
-
const ref = (0, react_1.useRef)(null);
|
|
7
|
-
const [scrollLeft, setScrollLeft] = (0, react_1.useState)(0);
|
|
8
|
-
(0, react_1.useEffect)(() => {
|
|
9
|
-
const timer = setInterval(() => {
|
|
10
|
-
var _a;
|
|
11
|
-
const elt = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.querySelector('.MuiDataGrid-virtualScroller');
|
|
12
|
-
if (elt) {
|
|
13
|
-
setScrollLeft(elt.scrollLeft);
|
|
14
|
-
}
|
|
15
|
-
}, 100);
|
|
16
|
-
return () => {
|
|
17
|
-
clearInterval(timer);
|
|
18
|
-
};
|
|
19
|
-
}, []);
|
|
20
|
-
return { ref, scrollLeft };
|
|
21
|
-
}
|
|
22
|
-
exports.useResizeBar = useResizeBar;
|