@jbrowse/core 2.1.0 → 2.1.3
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/TextSearch/BaseResults.d.ts +5 -1
- package/TextSearch/BaseResults.js +8 -1
- package/TextSearch/TextSearchManager.d.ts +9 -12
- package/TextSearch/TextSearchManager.js +24 -35
- package/assemblyManager/assembly.d.ts +7 -4
- package/assemblyManager/assembly.js +16 -2
- package/assemblyManager/assemblyManager.d.ts +51 -30
- package/assemblyManager/assemblyManager.js +12 -3
- package/package.json +2 -2
- package/pluggableElementTypes/models/BaseTrackModel.js +2 -2
- package/rpc/coreRpcMethods.d.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.js +1 -1
- package/ui/SanitizedHTML.js +1 -1
- package/ui/theme.d.ts +23 -1
- package/util/QuickLRU.d.ts +19 -11
- package/util/QuickLRU.js +170 -28
- package/util/calculateDynamicBlocks.js +3 -1
- package/util/calculateStaticBlocks.d.ts +3 -1
- package/util/calculateStaticBlocks.js +3 -1
- package/util/index.d.ts +2 -1
- package/util/index.js +7 -3
- package/util/io/index.d.ts +1 -1
- package/util/io/index.js +5 -3
- package/util/types/index.js +0 -4
- package/util/when.d.ts +2 -3
package/ui/AboutDialog.js
CHANGED
|
@@ -84,7 +84,7 @@ function AboutDialog({ config, handleClose, }) {
|
|
|
84
84
|
if ((0, configuration_1.readConfObject)(config, 'type') === 'ReferenceSequenceTrack') {
|
|
85
85
|
const asm = session.assemblies.find(a => a.sequence === config.configuration);
|
|
86
86
|
trackName = asm
|
|
87
|
-
? `Reference Sequence (${(0, configuration_1.readConfObject)(asm, 'name')})`
|
|
87
|
+
? `Reference Sequence (${(0, configuration_1.readConfObject)(asm, 'displayName') || (0, configuration_1.readConfObject)(asm, 'name')})`
|
|
88
88
|
: 'Reference Sequence';
|
|
89
89
|
}
|
|
90
90
|
const details = typeof info === 'string'
|
package/ui/SanitizedHTML.js
CHANGED
|
@@ -58,7 +58,7 @@ function SanitizedHTML({ html }) {
|
|
|
58
58
|
// see https://github.com/cure53/DOMPurify/issues/317
|
|
59
59
|
// only have to add this once, and can't do it globally because dompurify
|
|
60
60
|
// not yet initialized at global scope
|
|
61
|
-
dompurify_1.default.addHook('afterSanitizeAttributes', node => {
|
|
61
|
+
dompurify_1.default.addHook('afterSanitizeAttributes', (node) => {
|
|
62
62
|
if (node.tagName === 'A') {
|
|
63
63
|
node.setAttribute('rel', 'noopener noreferrer');
|
|
64
64
|
node.setAttribute('target', '_blank');
|
package/ui/theme.d.ts
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
|
-
import { PaletteOptions } from '@mui/material/styles/createPalette';
|
|
1
|
+
import type { PaletteOptions } from '@mui/material/styles/createPalette';
|
|
2
|
+
declare module '@mui/material/styles/createPalette' {
|
|
3
|
+
interface Palette {
|
|
4
|
+
tertiary: Palette['primary'];
|
|
5
|
+
quaternary: Palette['primary'];
|
|
6
|
+
bases: {
|
|
7
|
+
A: Palette['primary'];
|
|
8
|
+
C: Palette['primary'];
|
|
9
|
+
G: Palette['primary'];
|
|
10
|
+
T: Palette['primary'];
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface PaletteOptions {
|
|
14
|
+
tertiary?: PaletteOptions['primary'];
|
|
15
|
+
quaternary?: PaletteOptions['primary'];
|
|
16
|
+
bases?: {
|
|
17
|
+
A?: PaletteOptions['primary'];
|
|
18
|
+
C?: PaletteOptions['primary'];
|
|
19
|
+
G?: PaletteOptions['primary'];
|
|
20
|
+
T?: PaletteOptions['primary'];
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
2
24
|
export declare const jbrowseDefaultPalette: {
|
|
3
25
|
primary: {
|
|
4
26
|
main: string;
|
package/util/QuickLRU.d.ts
CHANGED
|
@@ -1,24 +1,32 @@
|
|
|
1
|
-
export default QuickLRU
|
|
2
|
-
/**
|
|
3
|
-
* Heavily based on [quick-lru](https://www.npmjs.com/package/quick-lru)
|
|
4
|
-
* (quick-lru didn't work for us because the export wouldn't compile in Webpack
|
|
5
|
-
* properly)
|
|
6
|
-
*/
|
|
7
|
-
declare class QuickLRU {
|
|
1
|
+
export default class QuickLRU extends Map<any, any> {
|
|
8
2
|
constructor(options?: {});
|
|
9
3
|
maxSize: any;
|
|
4
|
+
maxAge: any;
|
|
5
|
+
onEviction: any;
|
|
10
6
|
cache: Map<any, any>;
|
|
11
7
|
oldCache: Map<any, any>;
|
|
12
8
|
_size: number;
|
|
9
|
+
_emitEvictions(cache: any): void;
|
|
10
|
+
_deleteIfExpired(key: any, item: any): boolean;
|
|
11
|
+
_getOrDeleteIfExpired(key: any, item: any): any;
|
|
12
|
+
_getItemValue(key: any, item: any): any;
|
|
13
|
+
_peek(key: any, cache: any): any;
|
|
13
14
|
_set(key: any, value: any): void;
|
|
15
|
+
_moveToRecent(key: any, item: any): void;
|
|
16
|
+
_entriesAscending(): Generator<[any, any], void, unknown>;
|
|
14
17
|
get(key: any): any;
|
|
15
|
-
set(key: any, value: any
|
|
18
|
+
set(key: any, value: any, { maxAge }?: {
|
|
19
|
+
maxAge?: any;
|
|
20
|
+
}): void;
|
|
16
21
|
has(key: any): boolean;
|
|
17
22
|
peek(key: any): any;
|
|
18
23
|
delete(key: any): boolean;
|
|
19
|
-
|
|
24
|
+
resize(newSize: any): void;
|
|
20
25
|
keys(): Generator<any, void, unknown>;
|
|
21
26
|
values(): Generator<any, void, unknown>;
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
entriesDescending(): Generator<any[], void, unknown>;
|
|
28
|
+
entriesAscending(): Generator<any[], void, unknown>;
|
|
29
|
+
entries(): Generator<any[], void, unknown>;
|
|
30
|
+
forEach(callbackFunction: any, thisArgument?: QuickLRU): void;
|
|
31
|
+
[Symbol.iterator](): Generator<any[], void, unknown>;
|
|
24
32
|
}
|
package/util/QuickLRU.js
CHANGED
|
@@ -1,67 +1,140 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// vendored from quick-lru@6.1.1, didn't like being compiled as a 'pure-esm' nodejs dependency
|
|
3
|
+
// the license is reproduced below https://github.com/sindresorhus/quick-lru/blob/main/license
|
|
4
|
+
// MIT License
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
class QuickLRU {
|
|
6
|
+
// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
7
|
+
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
+
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
10
|
+
class QuickLRU extends Map {
|
|
10
11
|
constructor(options = {}) {
|
|
12
|
+
super();
|
|
11
13
|
if (!(options.maxSize && options.maxSize > 0)) {
|
|
12
14
|
throw new TypeError('`maxSize` must be a number greater than 0');
|
|
13
15
|
}
|
|
16
|
+
if (typeof options.maxAge === 'number' && options.maxAge === 0) {
|
|
17
|
+
throw new TypeError('`maxAge` must be a number greater than 0');
|
|
18
|
+
}
|
|
19
|
+
// TODO: Use private class fields when ESLint supports them.
|
|
14
20
|
this.maxSize = options.maxSize;
|
|
21
|
+
this.maxAge = options.maxAge || Number.POSITIVE_INFINITY;
|
|
22
|
+
this.onEviction = options.onEviction;
|
|
15
23
|
this.cache = new Map();
|
|
16
24
|
this.oldCache = new Map();
|
|
17
25
|
this._size = 0;
|
|
18
26
|
}
|
|
27
|
+
// TODO: Use private class methods when targeting Node.js 16.
|
|
28
|
+
_emitEvictions(cache) {
|
|
29
|
+
if (typeof this.onEviction !== 'function') {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
for (const [key, item] of cache) {
|
|
33
|
+
this.onEviction(key, item.value);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
_deleteIfExpired(key, item) {
|
|
37
|
+
if (typeof item.expiry === 'number' && item.expiry <= Date.now()) {
|
|
38
|
+
if (typeof this.onEviction === 'function') {
|
|
39
|
+
this.onEviction(key, item.value);
|
|
40
|
+
}
|
|
41
|
+
return this.delete(key);
|
|
42
|
+
}
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
_getOrDeleteIfExpired(key, item) {
|
|
46
|
+
const deleted = this._deleteIfExpired(key, item);
|
|
47
|
+
if (deleted === false) {
|
|
48
|
+
return item.value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
_getItemValue(key, item) {
|
|
52
|
+
return item.expiry ? this._getOrDeleteIfExpired(key, item) : item.value;
|
|
53
|
+
}
|
|
54
|
+
_peek(key, cache) {
|
|
55
|
+
const item = cache.get(key);
|
|
56
|
+
return this._getItemValue(key, item);
|
|
57
|
+
}
|
|
19
58
|
_set(key, value) {
|
|
20
59
|
this.cache.set(key, value);
|
|
21
|
-
this._size
|
|
60
|
+
this._size++;
|
|
22
61
|
if (this._size >= this.maxSize) {
|
|
23
62
|
this._size = 0;
|
|
63
|
+
this._emitEvictions(this.oldCache);
|
|
24
64
|
this.oldCache = this.cache;
|
|
25
65
|
this.cache = new Map();
|
|
26
66
|
}
|
|
27
67
|
}
|
|
68
|
+
_moveToRecent(key, item) {
|
|
69
|
+
this.oldCache.delete(key);
|
|
70
|
+
this._set(key, item);
|
|
71
|
+
}
|
|
72
|
+
*_entriesAscending() {
|
|
73
|
+
for (const item of this.oldCache) {
|
|
74
|
+
const [key, value] = item;
|
|
75
|
+
if (!this.cache.has(key)) {
|
|
76
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
77
|
+
if (deleted === false) {
|
|
78
|
+
yield item;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
for (const item of this.cache) {
|
|
83
|
+
const [key, value] = item;
|
|
84
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
85
|
+
if (deleted === false) {
|
|
86
|
+
yield item;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
28
90
|
get(key) {
|
|
29
91
|
if (this.cache.has(key)) {
|
|
30
|
-
|
|
92
|
+
const item = this.cache.get(key);
|
|
93
|
+
return this._getItemValue(key, item);
|
|
31
94
|
}
|
|
32
95
|
if (this.oldCache.has(key)) {
|
|
33
|
-
const
|
|
34
|
-
this.
|
|
35
|
-
|
|
36
|
-
|
|
96
|
+
const item = this.oldCache.get(key);
|
|
97
|
+
if (this._deleteIfExpired(key, item) === false) {
|
|
98
|
+
this._moveToRecent(key, item);
|
|
99
|
+
return item.value;
|
|
100
|
+
}
|
|
37
101
|
}
|
|
38
|
-
return undefined;
|
|
39
102
|
}
|
|
40
|
-
set(key, value) {
|
|
103
|
+
set(key, value, { maxAge = this.maxAge } = {}) {
|
|
104
|
+
const expiry = typeof maxAge === 'number' && maxAge !== Number.POSITIVE_INFINITY
|
|
105
|
+
? Date.now() + maxAge
|
|
106
|
+
: undefined;
|
|
41
107
|
if (this.cache.has(key)) {
|
|
42
|
-
this.cache.set(key,
|
|
108
|
+
this.cache.set(key, {
|
|
109
|
+
value,
|
|
110
|
+
expiry,
|
|
111
|
+
});
|
|
43
112
|
}
|
|
44
113
|
else {
|
|
45
|
-
this._set(key, value);
|
|
114
|
+
this._set(key, { value, expiry });
|
|
46
115
|
}
|
|
47
|
-
return this;
|
|
48
116
|
}
|
|
49
117
|
has(key) {
|
|
50
|
-
|
|
118
|
+
if (this.cache.has(key)) {
|
|
119
|
+
return !this._deleteIfExpired(key, this.cache.get(key));
|
|
120
|
+
}
|
|
121
|
+
if (this.oldCache.has(key)) {
|
|
122
|
+
return !this._deleteIfExpired(key, this.oldCache.get(key));
|
|
123
|
+
}
|
|
124
|
+
return false;
|
|
51
125
|
}
|
|
52
126
|
peek(key) {
|
|
53
127
|
if (this.cache.has(key)) {
|
|
54
|
-
return this.
|
|
128
|
+
return this._peek(key, this.cache);
|
|
55
129
|
}
|
|
56
130
|
if (this.oldCache.has(key)) {
|
|
57
|
-
return this.
|
|
131
|
+
return this._peek(key, this.oldCache);
|
|
58
132
|
}
|
|
59
|
-
return undefined;
|
|
60
133
|
}
|
|
61
134
|
delete(key) {
|
|
62
135
|
const deleted = this.cache.delete(key);
|
|
63
136
|
if (deleted) {
|
|
64
|
-
this._size
|
|
137
|
+
this._size--;
|
|
65
138
|
}
|
|
66
139
|
return this.oldCache.delete(key) || deleted;
|
|
67
140
|
}
|
|
@@ -70,6 +143,27 @@ class QuickLRU {
|
|
|
70
143
|
this.oldCache.clear();
|
|
71
144
|
this._size = 0;
|
|
72
145
|
}
|
|
146
|
+
resize(newSize) {
|
|
147
|
+
if (!(newSize && newSize > 0)) {
|
|
148
|
+
throw new TypeError('`maxSize` must be a number greater than 0');
|
|
149
|
+
}
|
|
150
|
+
const items = [...this._entriesAscending()];
|
|
151
|
+
const removeCount = items.length - newSize;
|
|
152
|
+
if (removeCount < 0) {
|
|
153
|
+
this.cache = new Map(items);
|
|
154
|
+
this.oldCache = new Map();
|
|
155
|
+
this._size = items.length;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
if (removeCount > 0) {
|
|
159
|
+
this._emitEvictions(items.slice(0, removeCount));
|
|
160
|
+
}
|
|
161
|
+
this.oldCache = new Map(items.slice(removeCount));
|
|
162
|
+
this.cache = new Map();
|
|
163
|
+
this._size = 0;
|
|
164
|
+
}
|
|
165
|
+
this.maxSize = newSize;
|
|
166
|
+
}
|
|
73
167
|
*keys() {
|
|
74
168
|
for (const [key] of this) {
|
|
75
169
|
yield key;
|
|
@@ -82,23 +176,71 @@ class QuickLRU {
|
|
|
82
176
|
}
|
|
83
177
|
*[Symbol.iterator]() {
|
|
84
178
|
for (const item of this.cache) {
|
|
85
|
-
|
|
179
|
+
const [key, value] = item;
|
|
180
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
181
|
+
if (deleted === false) {
|
|
182
|
+
yield [key, value.value];
|
|
183
|
+
}
|
|
86
184
|
}
|
|
87
185
|
for (const item of this.oldCache) {
|
|
88
|
-
const [key] = item;
|
|
186
|
+
const [key, value] = item;
|
|
89
187
|
if (!this.cache.has(key)) {
|
|
90
|
-
|
|
188
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
189
|
+
if (deleted === false) {
|
|
190
|
+
yield [key, value.value];
|
|
191
|
+
}
|
|
91
192
|
}
|
|
92
193
|
}
|
|
93
194
|
}
|
|
195
|
+
*entriesDescending() {
|
|
196
|
+
let items = [...this.cache];
|
|
197
|
+
for (let i = items.length - 1; i >= 0; --i) {
|
|
198
|
+
const item = items[i];
|
|
199
|
+
const [key, value] = item;
|
|
200
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
201
|
+
if (deleted === false) {
|
|
202
|
+
yield [key, value.value];
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
items = [...this.oldCache];
|
|
206
|
+
for (let i = items.length - 1; i >= 0; --i) {
|
|
207
|
+
const item = items[i];
|
|
208
|
+
const [key, value] = item;
|
|
209
|
+
if (!this.cache.has(key)) {
|
|
210
|
+
const deleted = this._deleteIfExpired(key, value);
|
|
211
|
+
if (deleted === false) {
|
|
212
|
+
yield [key, value.value];
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
*entriesAscending() {
|
|
218
|
+
for (const [key, value] of this._entriesAscending()) {
|
|
219
|
+
yield [key, value.value];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
94
222
|
get size() {
|
|
223
|
+
if (!this._size) {
|
|
224
|
+
return this.oldCache.size;
|
|
225
|
+
}
|
|
95
226
|
let oldCacheSize = 0;
|
|
96
227
|
for (const key of this.oldCache.keys()) {
|
|
97
228
|
if (!this.cache.has(key)) {
|
|
98
|
-
oldCacheSize
|
|
229
|
+
oldCacheSize++;
|
|
99
230
|
}
|
|
100
231
|
}
|
|
101
|
-
return this._size + oldCacheSize;
|
|
232
|
+
return Math.min(this._size + oldCacheSize, this.maxSize);
|
|
233
|
+
}
|
|
234
|
+
entries() {
|
|
235
|
+
return this.entriesAscending();
|
|
236
|
+
}
|
|
237
|
+
forEach(callbackFunction, thisArgument = this) {
|
|
238
|
+
for (const [key, value] of this.entriesAscending()) {
|
|
239
|
+
callbackFunction.call(thisArgument, value, key, this);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
get [Symbol.toStringTag]() {
|
|
243
|
+
return JSON.stringify([...this.entriesAscending()]);
|
|
102
244
|
}
|
|
103
245
|
}
|
|
104
246
|
exports.default = QuickLRU;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
3
4
|
const range_1 = require("./range");
|
|
4
5
|
const _1 = require(".");
|
|
5
6
|
const blockTypes_1 = require("./blockTypes");
|
|
@@ -35,6 +36,7 @@ function calculateDynamicBlocks(model, padding = true, elision = true) {
|
|
|
35
36
|
const { assemblyName, refName, start: regionStart, end: regionEnd, reversed, } = region;
|
|
36
37
|
const displayedRegionRightPx = displayedRegionLeftPx + (regionEnd - regionStart) / bpPerPx;
|
|
37
38
|
const regionWidthPx = (regionEnd - regionStart) / bpPerPx;
|
|
39
|
+
const parentRegion = (0, mobx_state_tree_1.isStateTreeNode)(region) ? (0, mobx_state_tree_1.getSnapshot)(region) : region;
|
|
38
40
|
if (displayedRegionLeftPx < windowRightPx &&
|
|
39
41
|
displayedRegionRightPx > windowLeftPx) {
|
|
40
42
|
// this displayed region overlaps the view, so make a record for it
|
|
@@ -66,7 +68,7 @@ function calculateDynamicBlocks(model, padding = true, elision = true) {
|
|
|
66
68
|
end,
|
|
67
69
|
reversed,
|
|
68
70
|
offsetPx: blockOffsetPx,
|
|
69
|
-
parentRegion
|
|
71
|
+
parentRegion,
|
|
70
72
|
regionNumber,
|
|
71
73
|
widthPx,
|
|
72
74
|
isLeftEndOfDisplayedRegion,
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { Instance } from 'mobx-state-tree';
|
|
1
2
|
import { BlockSet } from './blockTypes';
|
|
2
3
|
import { Region } from './types';
|
|
4
|
+
import { Region as RegionModel } from './types/mst';
|
|
3
5
|
export interface Base1DViewModel {
|
|
4
6
|
offsetPx: number;
|
|
5
7
|
width: number;
|
|
6
|
-
displayedRegions: Region[];
|
|
8
|
+
displayedRegions: (Region | Instance<typeof RegionModel>)[];
|
|
7
9
|
bpPerPx: number;
|
|
8
10
|
minimumBlockWidth: number;
|
|
9
11
|
interRegionPaddingWidth: number;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
3
4
|
const _1 = require(".");
|
|
4
5
|
const blockTypes_1 = require("./blockTypes");
|
|
5
6
|
function calculateStaticBlocks(model, padding = true, elision = true, extra = 0,
|
|
@@ -21,6 +22,7 @@ width = (typeof window !== 'undefined' && window.innerWidth) || model.width) {
|
|
|
21
22
|
// clamp those to the region range, and then make blocks for that range
|
|
22
23
|
const { assemblyName, refName, start: regionStart, end: regionEnd, reversed, } = region;
|
|
23
24
|
const regionBlockCount = Math.ceil((regionEnd - regionStart) / blockSizeBp);
|
|
25
|
+
const parentRegion = (0, mobx_state_tree_1.isStateTreeNode)(region) ? (0, mobx_state_tree_1.getSnapshot)(region) : region;
|
|
24
26
|
let windowRightBlockNum = Math.floor((windowRightBp - regionBpOffset) / blockSizeBp) + extra;
|
|
25
27
|
if (windowRightBlockNum >= regionBlockCount) {
|
|
26
28
|
windowRightBlockNum = regionBlockCount - 1;
|
|
@@ -55,7 +57,7 @@ width = (typeof window !== 'undefined' && window.innerWidth) || model.width) {
|
|
|
55
57
|
end,
|
|
56
58
|
reversed,
|
|
57
59
|
offsetPx: (regionBpOffset + blockNum * blockSizeBp) / bpPerPx,
|
|
58
|
-
parentRegion
|
|
60
|
+
parentRegion,
|
|
59
61
|
regionNumber,
|
|
60
62
|
widthPx,
|
|
61
63
|
isLeftEndOfDisplayedRegion,
|
package/util/index.d.ts
CHANGED
|
@@ -188,7 +188,7 @@ export declare function renameRegionsIfNeeded<ARGTYPE extends {
|
|
|
188
188
|
signal?: AbortSignal;
|
|
189
189
|
adapterConfig: unknown;
|
|
190
190
|
sessionId: string;
|
|
191
|
-
statusCallback?:
|
|
191
|
+
statusCallback?: (arg: string) => void;
|
|
192
192
|
}>(assemblyManager: AssemblyManager, args: ARGTYPE): Promise<ARGTYPE & {
|
|
193
193
|
regions: (Region & {
|
|
194
194
|
originalRefName?: string | undefined;
|
|
@@ -202,6 +202,7 @@ export declare function stringify({ refName, coord, oob, }: {
|
|
|
202
202
|
}): string;
|
|
203
203
|
export declare const isElectron: boolean;
|
|
204
204
|
export declare function revcom(seqString: string): string;
|
|
205
|
+
export declare function reverse(seqString: string): string;
|
|
205
206
|
export declare const complement: (seqString: string) => string;
|
|
206
207
|
export declare function blobToDataURL(blob: Blob): Promise<string>;
|
|
207
208
|
export declare const rIC: (((callback: IdleRequestCallback, options?: IdleRequestOptions | undefined) => number) & typeof requestIdleCallback) | ((cb: Function) => any);
|
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.
|
|
33
|
-
exports.measureGridWidth = exports.getStr = exports.getUriLink = exports.useLocalStorage = exports.getLayoutId = exports.getViewParams = exports.getTickDisplayStr = void 0;
|
|
32
|
+
exports.getBpDisplayStr = 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.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.measureGridWidth = exports.getStr = exports.getUriLink = exports.useLocalStorage = exports.getLayoutId = exports.getViewParams = exports.getTickDisplayStr = exports.toLocale = 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"));
|
|
@@ -659,9 +659,13 @@ exports.stringify = stringify;
|
|
|
659
659
|
// const i2 = process.versions.hasOwnProperty('electron')
|
|
660
660
|
exports.isElectron = /electron/i.test(typeof navigator !== 'undefined' ? navigator.userAgent : '');
|
|
661
661
|
function revcom(seqString) {
|
|
662
|
-
return (0, exports.complement)(seqString)
|
|
662
|
+
return reverse((0, exports.complement)(seqString));
|
|
663
663
|
}
|
|
664
664
|
exports.revcom = revcom;
|
|
665
|
+
function reverse(seqString) {
|
|
666
|
+
return seqString.split('').reverse().join('');
|
|
667
|
+
}
|
|
668
|
+
exports.reverse = reverse;
|
|
665
669
|
exports.complement = (() => {
|
|
666
670
|
const complementRegex = /[ACGT]/gi;
|
|
667
671
|
// from bioperl: tr/acgtrymkswhbvdnxACGTRYMKSWHBVDNX/tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX/
|
package/util/io/index.d.ts
CHANGED
|
@@ -4,4 +4,4 @@ import { FileLocation } from '../types';
|
|
|
4
4
|
import PluginManager from '../../PluginManager';
|
|
5
5
|
export { RemoteFileWithRangeCache };
|
|
6
6
|
export declare function openLocation(location: FileLocation, pluginManager?: PluginManager): GenericFilehandle;
|
|
7
|
-
export declare function getFetcher(location: FileLocation, pluginManager
|
|
7
|
+
export declare function getFetcher(location: FileLocation, pluginManager?: PluginManager): Fetcher;
|
package/util/io/index.js
CHANGED
|
@@ -70,9 +70,11 @@ function getFetcher(location, pluginManager) {
|
|
|
70
70
|
if (!(0, types_1.isUriLocation)(location)) {
|
|
71
71
|
throw new Error(`Not a valid UriLocation: ${JSON.stringify(location)}`);
|
|
72
72
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
if (pluginManager) {
|
|
74
|
+
const internetAccount = getInternetAccount(location, pluginManager);
|
|
75
|
+
if (internetAccount) {
|
|
76
|
+
return internetAccount.getFetcher(location);
|
|
77
|
+
}
|
|
76
78
|
}
|
|
77
79
|
return checkAuthNeededFetch;
|
|
78
80
|
}
|
package/util/types/index.js
CHANGED
|
@@ -13,13 +13,9 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
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;
|
|
21
18
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
22
|
-
const TextSearchManager_1 = __importDefault(require("../../TextSearch/TextSearchManager"));
|
|
23
19
|
__exportStar(require("./util"), exports);
|
|
24
20
|
function isViewContainer(thing) {
|
|
25
21
|
return ((0, mobx_state_tree_1.isStateTreeNode)(thing) &&
|
package/util/when.d.ts
CHANGED