@jbrowse/core 2.12.0 → 2.12.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.
- package/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/BasicValue.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/FieldName.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/SimpleField.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/UriField.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/index.js +3 -3
- package/BaseFeatureWidget/BaseFeatureDetail/util.js +4 -5
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.js +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/hooks.js +1 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/model.d.ts +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/model.js +1 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/util.js +2 -2
- package/BaseFeatureWidget/stateModelFactory.d.ts +2 -6
- package/BaseFeatureWidget/stateModelFactory.js +1 -2
- package/BaseFeatureWidget/util.d.ts +5 -5
- package/BaseFeatureWidget/util.js +6 -7
- package/PluginLoader.js +4 -5
- package/PluginManager.d.ts +6 -7
- package/ReExports/modules.d.ts +6 -6
- package/TextSearch/TextSearchManager.d.ts +6 -2
- package/assemblyManager/assembly.js +1 -1
- package/assemblyManager/assemblyManager.d.ts +9 -82
- package/configuration/configurationSchema.d.ts +7 -1
- package/configuration/configurationSchema.js +2 -3
- package/configuration/configurationSlot.js +1 -1
- package/configuration/util.d.ts +1 -1
- package/configuration/util.js +7 -8
- package/data_adapters/BaseAdapter/util.js +5 -6
- package/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +0 -1
- package/data_adapters/CytobandAdapter/CytobandAdapter.js +1 -2
- package/data_adapters/CytobandAdapter/index.js +1 -1
- package/data_adapters/dataAdapterCache.js +4 -5
- package/package.json +2 -2
- package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +1 -3
- package/pluggableElementTypes/models/BaseDisplayModel.d.ts +3 -3
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +6 -2
- package/pluggableElementTypes/models/BaseTrackModel.js +2 -3
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +13 -13
- package/pluggableElementTypes/models/baseTrackConfig.js +1 -2
- package/rpc/BaseRpcDriver.js +1 -2
- package/rpc/methods/util.js +1 -2
- package/rpc/remoteAbortSignals.js +5 -6
- package/stories/examples/WithSequencePanel.js +5 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/ColorPicker.js +3 -3
- package/ui/ErrorMessageStackTraceDialog.js +1 -1
- package/ui/FactoryResetDialog.js +1 -1
- package/ui/FatalErrorDialog.js +1 -1
- package/ui/Icons.js +9 -10
- package/ui/LoadingEllipses.js +1 -1
- package/ui/Logo.js +2 -3
- package/ui/Menu.js +1 -2
- package/ui/RedErrorMessageBox.js +1 -1
- package/ui/SanitizedHTML.js +1 -1
- package/ui/SnackbarModel.js +1 -1
- package/ui/theme.js +3 -3
- package/util/Base1DUtils.js +4 -5
- package/util/Base1DViewModel.d.ts +2 -2
- package/util/aborting.js +5 -6
- package/util/analytics.js +3 -4
- package/util/blobToDataURL.js +1 -2
- package/util/calculateDynamicBlocks.js +1 -1
- package/util/calculateStaticBlocks.js +1 -1
- package/util/color/cssColorsLevel4.js +2 -3
- package/util/color/index.js +4 -4
- package/util/dedupe.js +1 -2
- package/util/formatFastaStrings.js +2 -3
- package/util/idMaker.js +1 -1
- package/util/index.d.ts +2 -2
- package/util/index.js +70 -71
- package/util/io/RemoteFileWithRangeCache.d.ts +0 -1
- package/util/io/RemoteFileWithRangeCache.js +2 -2
- package/util/io/index.js +4 -4
- package/util/jexl.js +1 -1
- package/util/jexlStrings.js +1 -2
- package/util/map-obj.js +1 -1
- package/util/mst-reflection.js +6 -7
- package/util/offscreenCanvasPonyfill.js +2 -2
- package/util/offscreenCanvasUtils.js +3 -4
- package/util/range.js +3 -4
- package/util/rxjs.js +1 -2
- package/util/simpleFeature.js +1 -2
- package/util/stats.js +5 -6
- package/util/tracks.js +17 -17
- package/util/types/index.js +23 -23
- package/util/types/mst.d.ts +0 -1
- package/util/useMeasure.d.ts +2 -3
- package/util/useMeasure.js +1 -1
- package/util/when.js +2 -3
package/util/index.js
CHANGED
|
@@ -17,8 +17,76 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.
|
|
21
|
-
exports.
|
|
20
|
+
exports.blobToDataURL = exports.isFeature = exports.SimpleFeature = exports.defaultCodonTable = exports.defaultStops = exports.defaultStarts = exports.rIC = exports.complement = exports.isElectron = void 0;
|
|
21
|
+
exports.useDebounce = useDebounce;
|
|
22
|
+
exports.useWidthSetter = useWidthSetter;
|
|
23
|
+
exports.useDebouncedCallback = useDebouncedCallback;
|
|
24
|
+
exports.findParentThat = findParentThat;
|
|
25
|
+
exports.springAnimate = springAnimate;
|
|
26
|
+
exports.findParentThatIs = findParentThatIs;
|
|
27
|
+
exports.getSession = getSession;
|
|
28
|
+
exports.getContainingView = getContainingView;
|
|
29
|
+
exports.getContainingTrack = getContainingTrack;
|
|
30
|
+
exports.getContainingDisplay = getContainingDisplay;
|
|
31
|
+
exports.assembleLocString = assembleLocString;
|
|
32
|
+
exports.assembleLocStringFast = assembleLocStringFast;
|
|
33
|
+
exports.parseLocStringOneBased = parseLocStringOneBased;
|
|
34
|
+
exports.parseLocString = parseLocString;
|
|
35
|
+
exports.compareLocs = compareLocs;
|
|
36
|
+
exports.compareLocStrings = compareLocStrings;
|
|
37
|
+
exports.clamp = clamp;
|
|
38
|
+
exports.bpToPx = bpToPx;
|
|
39
|
+
exports.radToDeg = radToDeg;
|
|
40
|
+
exports.degToRad = degToRad;
|
|
41
|
+
exports.polarToCartesian = polarToCartesian;
|
|
42
|
+
exports.cartesianToPolar = cartesianToPolar;
|
|
43
|
+
exports.featureSpanPx = featureSpanPx;
|
|
44
|
+
exports.bpSpanPx = bpSpanPx;
|
|
45
|
+
exports.iterMap = iterMap;
|
|
46
|
+
exports.findLastIndex = findLastIndex;
|
|
47
|
+
exports.findLast = findLast;
|
|
48
|
+
exports.makeAbortableReaction = makeAbortableReaction;
|
|
49
|
+
exports.renameRegionIfNeeded = renameRegionIfNeeded;
|
|
50
|
+
exports.renameRegionsIfNeeded = renameRegionsIfNeeded;
|
|
51
|
+
exports.minmax = minmax;
|
|
52
|
+
exports.shorten = shorten;
|
|
53
|
+
exports.stringify = stringify;
|
|
54
|
+
exports.revcom = revcom;
|
|
55
|
+
exports.reverse = reverse;
|
|
56
|
+
exports.measureText = measureText;
|
|
57
|
+
exports.getFrame = getFrame;
|
|
58
|
+
exports.generateCodonTable = generateCodonTable;
|
|
59
|
+
exports.updateStatus = updateStatus;
|
|
60
|
+
exports.hashCode = hashCode;
|
|
61
|
+
exports.objectHash = objectHash;
|
|
62
|
+
exports.bytesForRegions = bytesForRegions;
|
|
63
|
+
exports.isSupportedIndexingAdapter = isSupportedIndexingAdapter;
|
|
64
|
+
exports.getBpDisplayStr = getBpDisplayStr;
|
|
65
|
+
exports.toLocale = toLocale;
|
|
66
|
+
exports.getTickDisplayStr = getTickDisplayStr;
|
|
67
|
+
exports.getViewParams = getViewParams;
|
|
68
|
+
exports.getLayoutId = getLayoutId;
|
|
69
|
+
exports.useLocalStorage = useLocalStorage;
|
|
70
|
+
exports.getUriLink = getUriLink;
|
|
71
|
+
exports.getStr = getStr;
|
|
72
|
+
exports.coarseStripHTML = coarseStripHTML;
|
|
73
|
+
exports.linkify = linkify;
|
|
74
|
+
exports.measureGridWidth = measureGridWidth;
|
|
75
|
+
exports.getEnv = getEnv;
|
|
76
|
+
exports.localStorageGetItem = localStorageGetItem;
|
|
77
|
+
exports.localStorageSetItem = localStorageSetItem;
|
|
78
|
+
exports.max = max;
|
|
79
|
+
exports.min = min;
|
|
80
|
+
exports.sum = sum;
|
|
81
|
+
exports.avg = avg;
|
|
82
|
+
exports.groupBy = groupBy;
|
|
83
|
+
exports.notEmpty = notEmpty;
|
|
84
|
+
exports.mergeIntervals = mergeIntervals;
|
|
85
|
+
exports.gatherOverlaps = gatherOverlaps;
|
|
86
|
+
exports.stripAlpha = stripAlpha;
|
|
87
|
+
exports.getStrokeProps = getStrokeProps;
|
|
88
|
+
exports.getFillProps = getFillProps;
|
|
89
|
+
exports.renderToStaticMarkup = renderToStaticMarkup;
|
|
22
90
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
23
91
|
const react_1 = require("react");
|
|
24
92
|
const is_object_1 = __importDefault(require("is-object"));
|
|
@@ -51,7 +119,6 @@ function useDebounce(value, delay) {
|
|
|
51
119
|
}, [value, delay]);
|
|
52
120
|
return debouncedValue;
|
|
53
121
|
}
|
|
54
|
-
exports.useDebounce = useDebounce;
|
|
55
122
|
// used in ViewContainer files to get the width
|
|
56
123
|
function useWidthSetter(view, padding) {
|
|
57
124
|
const [ref, { width }] = (0, useMeasure_1.default)();
|
|
@@ -65,7 +132,6 @@ function useWidthSetter(view, padding) {
|
|
|
65
132
|
}, [padding, view, width]);
|
|
66
133
|
return ref;
|
|
67
134
|
}
|
|
68
|
-
exports.useWidthSetter = useWidthSetter;
|
|
69
135
|
// https://stackoverflow.com/questions/56283920/
|
|
70
136
|
function useDebouncedCallback(callback, wait = 400) {
|
|
71
137
|
// track args & timeout handle between calls
|
|
@@ -92,7 +158,6 @@ function useDebouncedCallback(callback, wait = 400) {
|
|
|
92
158
|
}, wait);
|
|
93
159
|
};
|
|
94
160
|
}
|
|
95
|
-
exports.useDebouncedCallback = useDebouncedCallback;
|
|
96
161
|
/**
|
|
97
162
|
* find the first node in the hierarchy that matches the given predicate
|
|
98
163
|
*/
|
|
@@ -114,7 +179,6 @@ function findParentThat(node, predicate) {
|
|
|
114
179
|
}
|
|
115
180
|
throw new Error('no matching node found');
|
|
116
181
|
}
|
|
117
|
-
exports.findParentThat = findParentThat;
|
|
118
182
|
// based on https://github.com/react-spring/react-spring/blob/cd5548a987383b8023efd620f3726a981f9e18ea/src/animated/FrameLoop.ts
|
|
119
183
|
function springAnimate(fromValue, toValue, setValue, onFinish = () => { }, precision = 0, tension = 400, friction = 20, clamp = true) {
|
|
120
184
|
const mass = 1;
|
|
@@ -166,7 +230,6 @@ function springAnimate(fromValue, toValue, setValue, onFinish = () => { }, preci
|
|
|
166
230
|
() => cancelAnimationFrame(animationFrameId),
|
|
167
231
|
];
|
|
168
232
|
}
|
|
169
|
-
exports.springAnimate = springAnimate;
|
|
170
233
|
/**
|
|
171
234
|
* find the first node in the hierarchy that matches the given 'is' typescript
|
|
172
235
|
* type guard predicate
|
|
@@ -174,7 +237,6 @@ exports.springAnimate = springAnimate;
|
|
|
174
237
|
function findParentThatIs(node, predicate) {
|
|
175
238
|
return findParentThat(node, predicate);
|
|
176
239
|
}
|
|
177
|
-
exports.findParentThatIs = findParentThatIs;
|
|
178
240
|
/**
|
|
179
241
|
* get the current JBrowse session model, starting at any node in the state
|
|
180
242
|
* tree
|
|
@@ -187,7 +249,6 @@ function getSession(node) {
|
|
|
187
249
|
throw new Error('no session model found!');
|
|
188
250
|
}
|
|
189
251
|
}
|
|
190
|
-
exports.getSession = getSession;
|
|
191
252
|
/**
|
|
192
253
|
* get the state model of the view in the state tree that contains the given
|
|
193
254
|
* node
|
|
@@ -200,7 +261,6 @@ function getContainingView(node) {
|
|
|
200
261
|
throw new Error('no containing view found');
|
|
201
262
|
}
|
|
202
263
|
}
|
|
203
|
-
exports.getContainingView = getContainingView;
|
|
204
264
|
/**
|
|
205
265
|
* get the state model of the view in the state tree that contains the given
|
|
206
266
|
* node
|
|
@@ -213,7 +273,6 @@ function getContainingTrack(node) {
|
|
|
213
273
|
throw new Error('no containing track found');
|
|
214
274
|
}
|
|
215
275
|
}
|
|
216
|
-
exports.getContainingTrack = getContainingTrack;
|
|
217
276
|
/**
|
|
218
277
|
* get the state model of the display in the state tree that contains the given
|
|
219
278
|
* node
|
|
@@ -226,7 +285,6 @@ function getContainingDisplay(node) {
|
|
|
226
285
|
throw new Error('no containing display found');
|
|
227
286
|
}
|
|
228
287
|
}
|
|
229
|
-
exports.getContainingDisplay = getContainingDisplay;
|
|
230
288
|
/**
|
|
231
289
|
* Assemble a 1-based "locString" from an interbase genomic location
|
|
232
290
|
* @param region - Region
|
|
@@ -264,7 +322,6 @@ exports.getContainingDisplay = getContainingDisplay;
|
|
|
264
322
|
function assembleLocString(region) {
|
|
265
323
|
return assembleLocStringFast(region, toLocale);
|
|
266
324
|
}
|
|
267
|
-
exports.assembleLocString = assembleLocString;
|
|
268
325
|
// same as assembleLocString above, but does not perform toLocaleString which
|
|
269
326
|
// can slow down the speed of block calculations which use assembleLocString
|
|
270
327
|
// for block.key
|
|
@@ -294,7 +351,6 @@ function assembleLocStringFast(region, cb = (n) => n) {
|
|
|
294
351
|
}
|
|
295
352
|
return `${assemblyNameString}${refName}${startString}${endString}${rev}`;
|
|
296
353
|
}
|
|
297
|
-
exports.assembleLocStringFast = assembleLocStringFast;
|
|
298
354
|
function parseLocStringOneBased(locString, isValidRefName) {
|
|
299
355
|
if (!locString) {
|
|
300
356
|
throw new Error('no location string provided, could not parse');
|
|
@@ -380,7 +436,6 @@ function parseLocStringOneBased(locString, isValidRefName) {
|
|
|
380
436
|
}
|
|
381
437
|
throw new Error(`unknown reference sequence name in location "${locString}"`);
|
|
382
438
|
}
|
|
383
|
-
exports.parseLocStringOneBased = parseLocStringOneBased;
|
|
384
439
|
/**
|
|
385
440
|
* Parse a 1-based location string into an interbase genomic location
|
|
386
441
|
* @param locString - Location string
|
|
@@ -425,7 +480,6 @@ function parseLocString(locString, isValidRefName) {
|
|
|
425
480
|
}
|
|
426
481
|
return parsed;
|
|
427
482
|
}
|
|
428
|
-
exports.parseLocString = parseLocString;
|
|
429
483
|
function compareLocs(locA, locB) {
|
|
430
484
|
const assemblyComp = locA.assemblyName || locB.assemblyName
|
|
431
485
|
? (locA.assemblyName || '').localeCompare(locB.assemblyName || '')
|
|
@@ -453,13 +507,11 @@ function compareLocs(locA, locB) {
|
|
|
453
507
|
}
|
|
454
508
|
return 0;
|
|
455
509
|
}
|
|
456
|
-
exports.compareLocs = compareLocs;
|
|
457
510
|
function compareLocStrings(a, b, isValidRefName) {
|
|
458
511
|
const locA = parseLocString(a, isValidRefName);
|
|
459
512
|
const locB = parseLocString(b, isValidRefName);
|
|
460
513
|
return compareLocs(locA, locB);
|
|
461
514
|
}
|
|
462
|
-
exports.compareLocStrings = compareLocStrings;
|
|
463
515
|
/**
|
|
464
516
|
* Ensure that a number is at least min and at most max.
|
|
465
517
|
*
|
|
@@ -476,7 +528,6 @@ function clamp(num, min, max) {
|
|
|
476
528
|
}
|
|
477
529
|
return num;
|
|
478
530
|
}
|
|
479
|
-
exports.clamp = clamp;
|
|
480
531
|
function roundToNearestPointOne(num) {
|
|
481
532
|
return Math.round(num * 10) / 10;
|
|
482
533
|
}
|
|
@@ -488,24 +539,20 @@ function roundToNearestPointOne(num) {
|
|
|
488
539
|
function bpToPx(bp, { reversed, end = 0, start = 0, }, bpPerPx) {
|
|
489
540
|
return roundToNearestPointOne((reversed ? end - bp : bp - start) / bpPerPx);
|
|
490
541
|
}
|
|
491
|
-
exports.bpToPx = bpToPx;
|
|
492
542
|
const oneEightyOverPi = 180 / Math.PI;
|
|
493
543
|
const piOverOneEighty = Math.PI / 180;
|
|
494
544
|
function radToDeg(radians) {
|
|
495
545
|
return (radians * oneEightyOverPi) % 360;
|
|
496
546
|
}
|
|
497
|
-
exports.radToDeg = radToDeg;
|
|
498
547
|
function degToRad(degrees) {
|
|
499
548
|
return (degrees * piOverOneEighty) % (2 * Math.PI);
|
|
500
549
|
}
|
|
501
|
-
exports.degToRad = degToRad;
|
|
502
550
|
/**
|
|
503
551
|
* @returns [x, y]
|
|
504
552
|
*/
|
|
505
553
|
function polarToCartesian(rho, theta) {
|
|
506
554
|
return [rho * Math.cos(theta), rho * Math.sin(theta)];
|
|
507
555
|
}
|
|
508
|
-
exports.polarToCartesian = polarToCartesian;
|
|
509
556
|
/**
|
|
510
557
|
* @param x - the x
|
|
511
558
|
* @param y - the y
|
|
@@ -516,17 +563,14 @@ function cartesianToPolar(x, y) {
|
|
|
516
563
|
const theta = Math.atan(y / x);
|
|
517
564
|
return [rho, theta];
|
|
518
565
|
}
|
|
519
|
-
exports.cartesianToPolar = cartesianToPolar;
|
|
520
566
|
function featureSpanPx(feature, region, bpPerPx) {
|
|
521
567
|
return bpSpanPx(feature.get('start'), feature.get('end'), region, bpPerPx);
|
|
522
568
|
}
|
|
523
|
-
exports.featureSpanPx = featureSpanPx;
|
|
524
569
|
function bpSpanPx(leftBp, rightBp, region, bpPerPx) {
|
|
525
570
|
const start = bpToPx(leftBp, region, bpPerPx);
|
|
526
571
|
const end = bpToPx(rightBp, region, bpPerPx);
|
|
527
572
|
return region.reversed ? [end, start] : [start, end];
|
|
528
573
|
}
|
|
529
|
-
exports.bpSpanPx = bpSpanPx;
|
|
530
574
|
// do an array map of an iterable
|
|
531
575
|
function iterMap(iter, func, sizeHint) {
|
|
532
576
|
const results = Array.from({ length: sizeHint || 0 });
|
|
@@ -537,7 +581,6 @@ function iterMap(iter, func, sizeHint) {
|
|
|
537
581
|
}
|
|
538
582
|
return results;
|
|
539
583
|
}
|
|
540
|
-
exports.iterMap = iterMap;
|
|
541
584
|
/**
|
|
542
585
|
* Returns the index of the last element in the array where predicate is true,
|
|
543
586
|
* and -1 otherwise.
|
|
@@ -560,7 +603,6 @@ function findLastIndex(array, predicate) {
|
|
|
560
603
|
}
|
|
561
604
|
return -1;
|
|
562
605
|
}
|
|
563
|
-
exports.findLastIndex = findLastIndex;
|
|
564
606
|
function findLast(array, predicate) {
|
|
565
607
|
let l = array.length;
|
|
566
608
|
while (l--) {
|
|
@@ -570,7 +612,6 @@ function findLast(array, predicate) {
|
|
|
570
612
|
}
|
|
571
613
|
return undefined;
|
|
572
614
|
}
|
|
573
|
-
exports.findLast = findLast;
|
|
574
615
|
/**
|
|
575
616
|
* makes a mobx reaction with the given functions, that calls actions on the
|
|
576
617
|
* model for each stage of execution, and to abort the reaction function when
|
|
@@ -642,7 +683,6 @@ reactionOptions, startedFunction, successFunction, errorFunction) {
|
|
|
642
683
|
}
|
|
643
684
|
});
|
|
644
685
|
}
|
|
645
|
-
exports.makeAbortableReaction = makeAbortableReaction;
|
|
646
686
|
function renameRegionIfNeeded(refNameMap, region) {
|
|
647
687
|
if ((0, mobx_state_tree_1.isStateTreeNode)(region) && !(0, mobx_state_tree_1.isAlive)(region)) {
|
|
648
688
|
return region;
|
|
@@ -660,7 +700,6 @@ function renameRegionIfNeeded(refNameMap, region) {
|
|
|
660
700
|
}
|
|
661
701
|
return region;
|
|
662
702
|
}
|
|
663
|
-
exports.renameRegionIfNeeded = renameRegionIfNeeded;
|
|
664
703
|
async function renameRegionsIfNeeded(assemblyManager, args) {
|
|
665
704
|
const { regions = [], adapterConfig } = args;
|
|
666
705
|
if (!args.sessionId) {
|
|
@@ -680,17 +719,14 @@ async function renameRegionsIfNeeded(assemblyManager, args) {
|
|
|
680
719
|
renameRegionIfNeeded(assemblyMaps[assemblyNames[i]], region)),
|
|
681
720
|
};
|
|
682
721
|
}
|
|
683
|
-
exports.renameRegionsIfNeeded = renameRegionsIfNeeded;
|
|
684
722
|
function minmax(a, b) {
|
|
685
723
|
return [Math.min(a, b), Math.max(a, b)];
|
|
686
724
|
}
|
|
687
|
-
exports.minmax = minmax;
|
|
688
725
|
function shorten(name, max = 70, short = 30) {
|
|
689
726
|
return name.length > max
|
|
690
727
|
? name.slice(0, short) + '...' + name.slice(-short)
|
|
691
728
|
: name;
|
|
692
729
|
}
|
|
693
|
-
exports.shorten = shorten;
|
|
694
730
|
function stringify({ refName, coord, assemblyName, oob, }, useAssemblyName) {
|
|
695
731
|
return [
|
|
696
732
|
assemblyName && useAssemblyName ? `{${assemblyName}}` : '',
|
|
@@ -699,7 +735,6 @@ function stringify({ refName, coord, assemblyName, oob, }, useAssemblyName) {
|
|
|
699
735
|
: '',
|
|
700
736
|
].join('');
|
|
701
737
|
}
|
|
702
|
-
exports.stringify = stringify;
|
|
703
738
|
// this is recommended in a later comment in
|
|
704
739
|
// https://github.com/electron/electron/issues/2288 for detecting electron in a
|
|
705
740
|
// renderer process, which is the one that has node enabled for us
|
|
@@ -710,11 +745,9 @@ exports.isElectron = /electron/i.test(typeof navigator !== 'undefined' ? navigat
|
|
|
710
745
|
function revcom(seqString) {
|
|
711
746
|
return reverse((0, exports.complement)(seqString));
|
|
712
747
|
}
|
|
713
|
-
exports.revcom = revcom;
|
|
714
748
|
function reverse(seqString) {
|
|
715
749
|
return seqString.split('').reverse().join('');
|
|
716
750
|
}
|
|
717
|
-
exports.reverse = reverse;
|
|
718
751
|
exports.complement = (() => {
|
|
719
752
|
const complementRegex = /[ACGT]/gi;
|
|
720
753
|
// from bioperl: tr/acgtrymkswhbvdnxACGTRYMKSWHBVDNX/tgcayrkmswdvbhnxTGCAYRKMSWDVBHNX/
|
|
@@ -780,13 +813,11 @@ function measureText(str, fontSize = 10) {
|
|
|
780
813
|
}
|
|
781
814
|
return total * fontSize;
|
|
782
815
|
}
|
|
783
|
-
exports.measureText = measureText;
|
|
784
816
|
function getFrame(start, end, strand, phase) {
|
|
785
817
|
return strand === 1
|
|
786
818
|
? (((start + phase) % 3) + 1)
|
|
787
819
|
: (-1 * ((end - phase) % 3) - 1);
|
|
788
820
|
}
|
|
789
|
-
exports.getFrame = getFrame;
|
|
790
821
|
exports.defaultStarts = ['ATG'];
|
|
791
822
|
exports.defaultStops = ['TAA', 'TAG', 'TGA'];
|
|
792
823
|
exports.defaultCodonTable = {
|
|
@@ -884,7 +915,6 @@ function generateCodonTable(table) {
|
|
|
884
915
|
});
|
|
885
916
|
return tempCodonTable;
|
|
886
917
|
}
|
|
887
|
-
exports.generateCodonTable = generateCodonTable;
|
|
888
918
|
// call statusCallback with current status and clear when finished
|
|
889
919
|
async function updateStatus(msg, cb, fn) {
|
|
890
920
|
cb(msg);
|
|
@@ -892,7 +922,6 @@ async function updateStatus(msg, cb, fn) {
|
|
|
892
922
|
cb('');
|
|
893
923
|
return res;
|
|
894
924
|
}
|
|
895
|
-
exports.updateStatus = updateStatus;
|
|
896
925
|
function hashCode(str) {
|
|
897
926
|
let hash = 0;
|
|
898
927
|
if (str.length === 0) {
|
|
@@ -905,11 +934,9 @@ function hashCode(str) {
|
|
|
905
934
|
}
|
|
906
935
|
return hash;
|
|
907
936
|
}
|
|
908
|
-
exports.hashCode = hashCode;
|
|
909
937
|
function objectHash(obj) {
|
|
910
938
|
return `${hashCode(JSON.stringify(obj))}`;
|
|
911
939
|
}
|
|
912
|
-
exports.objectHash = objectHash;
|
|
913
940
|
async function bytesForRegions(regions, index) {
|
|
914
941
|
const blockResults = await Promise.all(regions.map(r => index.blocksForRange(r.refName, r.start, r.end)));
|
|
915
942
|
return blockResults
|
|
@@ -920,7 +947,6 @@ async function bytesForRegions(regions, index) {
|
|
|
920
947
|
}))
|
|
921
948
|
.reduce((a, b) => a + b.end - b.start, 0);
|
|
922
949
|
}
|
|
923
|
-
exports.bytesForRegions = bytesForRegions;
|
|
924
950
|
// supported adapter types by text indexer
|
|
925
951
|
// ensure that this matches the method found in @jbrowse/text-indexing/util
|
|
926
952
|
function isSupportedIndexingAdapter(type) {
|
|
@@ -931,7 +957,6 @@ function isSupportedIndexingAdapter(type) {
|
|
|
931
957
|
'VcfAdapter',
|
|
932
958
|
].includes(type);
|
|
933
959
|
}
|
|
934
|
-
exports.isSupportedIndexingAdapter = isSupportedIndexingAdapter;
|
|
935
960
|
function getBpDisplayStr(totalBp) {
|
|
936
961
|
let str;
|
|
937
962
|
if (Math.floor(totalBp / 1000000) > 0) {
|
|
@@ -945,17 +970,14 @@ function getBpDisplayStr(totalBp) {
|
|
|
945
970
|
}
|
|
946
971
|
return str;
|
|
947
972
|
}
|
|
948
|
-
exports.getBpDisplayStr = getBpDisplayStr;
|
|
949
973
|
function toLocale(n) {
|
|
950
974
|
return n.toLocaleString('en-US');
|
|
951
975
|
}
|
|
952
|
-
exports.toLocale = toLocale;
|
|
953
976
|
function getTickDisplayStr(totalBp, bpPerPx) {
|
|
954
977
|
return Math.floor(bpPerPx / 1000) > 0
|
|
955
978
|
? `${toLocale(Number.parseFloat((totalBp / 1000000).toFixed(2)))}M`
|
|
956
979
|
: `${toLocale(Math.floor(totalBp))}`;
|
|
957
980
|
}
|
|
958
|
-
exports.getTickDisplayStr = getTickDisplayStr;
|
|
959
981
|
function getViewParams(model, exportSVG) {
|
|
960
982
|
// @ts-expect-error
|
|
961
983
|
const { dynamicBlocks, staticBlocks, offsetPx } = getContainingView(model);
|
|
@@ -969,11 +991,9 @@ function getViewParams(model, exportSVG) {
|
|
|
969
991
|
end: b.end,
|
|
970
992
|
};
|
|
971
993
|
}
|
|
972
|
-
exports.getViewParams = getViewParams;
|
|
973
994
|
function getLayoutId({ sessionId, layoutId, }) {
|
|
974
995
|
return sessionId + '-' + layoutId;
|
|
975
996
|
}
|
|
976
|
-
exports.getLayoutId = getLayoutId;
|
|
977
997
|
// Hook from https://usehooks.com/useLocalStorage/
|
|
978
998
|
function useLocalStorage(key, initialValue) {
|
|
979
999
|
const [storedValue, setStoredValue] = (0, react_1.useState)(() => {
|
|
@@ -1003,7 +1023,6 @@ function useLocalStorage(key, initialValue) {
|
|
|
1003
1023
|
};
|
|
1004
1024
|
return [storedValue, setValue];
|
|
1005
1025
|
}
|
|
1006
|
-
exports.useLocalStorage = useLocalStorage;
|
|
1007
1026
|
function getUriLink(value) {
|
|
1008
1027
|
const { uri, baseUri = '' } = value;
|
|
1009
1028
|
let href;
|
|
@@ -1015,7 +1034,6 @@ function getUriLink(value) {
|
|
|
1015
1034
|
}
|
|
1016
1035
|
return href;
|
|
1017
1036
|
}
|
|
1018
|
-
exports.getUriLink = getUriLink;
|
|
1019
1037
|
function getStr(obj) {
|
|
1020
1038
|
return (0, is_object_1.default)(obj)
|
|
1021
1039
|
? (0, types_2.isUriLocation)(obj)
|
|
@@ -1023,18 +1041,15 @@ function getStr(obj) {
|
|
|
1023
1041
|
: JSON.stringify(obj)
|
|
1024
1042
|
: String(obj);
|
|
1025
1043
|
}
|
|
1026
|
-
exports.getStr = getStr;
|
|
1027
1044
|
// tries to measure grid width without HTML tags included
|
|
1028
1045
|
function coarseStripHTML(s) {
|
|
1029
1046
|
return s.replaceAll(/(<([^>]+)>)/gi, '');
|
|
1030
1047
|
}
|
|
1031
|
-
exports.coarseStripHTML = coarseStripHTML;
|
|
1032
1048
|
// based on autolink-js, license MIT
|
|
1033
1049
|
function linkify(s) {
|
|
1034
1050
|
const pattern = /(^|[\s\n]|<[A-Za-z]*\/?>)((?:https?|ftp):\/\/[-A-Z0-9+\u0026\u2019@#/%?=()~_|!:,.;]*[-A-Z0-9+\u0026@#/%=~()_|])/gi;
|
|
1035
1051
|
return s.replaceAll(pattern, '$1<a href=\'$2\' target="_blank">$2</a>');
|
|
1036
1052
|
}
|
|
1037
|
-
exports.linkify = linkify;
|
|
1038
1053
|
// heuristic measurement for a column of a @mui/x-data-grid, pass in values from a column
|
|
1039
1054
|
function measureGridWidth(elements, args) {
|
|
1040
1055
|
const { padding = 30, minWidth = 80, fontSize = 12, maxWidth = 1000, stripHTML = false, } = args || {};
|
|
@@ -1044,23 +1059,19 @@ function measureGridWidth(elements, args) {
|
|
|
1044
1059
|
.map(str => measureText(str, fontSize))
|
|
1045
1060
|
.map(n => Math.min(Math.max(n + padding, minWidth), maxWidth)));
|
|
1046
1061
|
}
|
|
1047
|
-
exports.measureGridWidth = measureGridWidth;
|
|
1048
1062
|
function getEnv(obj) {
|
|
1049
1063
|
return (0, mobx_state_tree_1.getEnv)(obj);
|
|
1050
1064
|
}
|
|
1051
|
-
exports.getEnv = getEnv;
|
|
1052
1065
|
function localStorageGetItem(item) {
|
|
1053
1066
|
return typeof localStorage !== 'undefined'
|
|
1054
1067
|
? localStorage.getItem(item)
|
|
1055
1068
|
: undefined;
|
|
1056
1069
|
}
|
|
1057
|
-
exports.localStorageGetItem = localStorageGetItem;
|
|
1058
1070
|
function localStorageSetItem(str, item) {
|
|
1059
1071
|
return typeof localStorage !== 'undefined'
|
|
1060
1072
|
? localStorage.setItem(str, item)
|
|
1061
1073
|
: undefined;
|
|
1062
1074
|
}
|
|
1063
|
-
exports.localStorageSetItem = localStorageSetItem;
|
|
1064
1075
|
function max(arr, init = -Infinity) {
|
|
1065
1076
|
let max = init;
|
|
1066
1077
|
for (const entry of arr) {
|
|
@@ -1068,7 +1079,6 @@ function max(arr, init = -Infinity) {
|
|
|
1068
1079
|
}
|
|
1069
1080
|
return max;
|
|
1070
1081
|
}
|
|
1071
|
-
exports.max = max;
|
|
1072
1082
|
function min(arr, init = Infinity) {
|
|
1073
1083
|
let min = init;
|
|
1074
1084
|
for (const entry of arr) {
|
|
@@ -1076,7 +1086,6 @@ function min(arr, init = Infinity) {
|
|
|
1076
1086
|
}
|
|
1077
1087
|
return min;
|
|
1078
1088
|
}
|
|
1079
|
-
exports.min = min;
|
|
1080
1089
|
function sum(arr) {
|
|
1081
1090
|
let sum = 0;
|
|
1082
1091
|
for (const entry of arr) {
|
|
@@ -1084,11 +1093,9 @@ function sum(arr) {
|
|
|
1084
1093
|
}
|
|
1085
1094
|
return sum;
|
|
1086
1095
|
}
|
|
1087
|
-
exports.sum = sum;
|
|
1088
1096
|
function avg(arr) {
|
|
1089
1097
|
return sum(arr) / arr.length;
|
|
1090
1098
|
}
|
|
1091
|
-
exports.avg = avg;
|
|
1092
1099
|
function groupBy(array, predicate) {
|
|
1093
1100
|
var _a;
|
|
1094
1101
|
const result = {};
|
|
@@ -1098,11 +1105,9 @@ function groupBy(array, predicate) {
|
|
|
1098
1105
|
}
|
|
1099
1106
|
return result;
|
|
1100
1107
|
}
|
|
1101
|
-
exports.groupBy = groupBy;
|
|
1102
1108
|
function notEmpty(value) {
|
|
1103
1109
|
return value !== null && value !== undefined;
|
|
1104
1110
|
}
|
|
1105
|
-
exports.notEmpty = notEmpty;
|
|
1106
1111
|
function mergeIntervals(intervals, w = 5000) {
|
|
1107
1112
|
// test if there are at least 2 intervals
|
|
1108
1113
|
if (intervals.length <= 1) {
|
|
@@ -1133,7 +1138,6 @@ function mergeIntervals(intervals, w = 5000) {
|
|
|
1133
1138
|
}
|
|
1134
1139
|
return stack;
|
|
1135
1140
|
}
|
|
1136
|
-
exports.mergeIntervals = mergeIntervals;
|
|
1137
1141
|
function gatherOverlaps(regions) {
|
|
1138
1142
|
const memo = {};
|
|
1139
1143
|
for (const x of regions) {
|
|
@@ -1144,22 +1148,18 @@ function gatherOverlaps(regions) {
|
|
|
1144
1148
|
}
|
|
1145
1149
|
return Object.values(memo).flatMap(group => mergeIntervals(group.sort((a, b) => a.start - b.start)));
|
|
1146
1150
|
}
|
|
1147
|
-
exports.gatherOverlaps = gatherOverlaps;
|
|
1148
1151
|
function stripAlpha(str) {
|
|
1149
1152
|
const c = (0, colord_1.colord)(str);
|
|
1150
1153
|
return c.alpha(1).toHex();
|
|
1151
1154
|
}
|
|
1152
|
-
exports.stripAlpha = stripAlpha;
|
|
1153
1155
|
function getStrokeProps(str) {
|
|
1154
1156
|
const c = (0, colord_1.colord)(str);
|
|
1155
1157
|
return { strokeOpacity: c.alpha(), stroke: c.alpha(1).toHex() };
|
|
1156
1158
|
}
|
|
1157
|
-
exports.getStrokeProps = getStrokeProps;
|
|
1158
1159
|
function getFillProps(str) {
|
|
1159
1160
|
const c = (0, colord_1.colord)(str);
|
|
1160
1161
|
return { fillOpacity: c.alpha(), fill: c.alpha(1).toHex() };
|
|
1161
1162
|
}
|
|
1162
|
-
exports.getFillProps = getFillProps;
|
|
1163
1163
|
// https://react.dev/reference/react-dom/server/renderToString#removing-rendertostring-from-the-client-code
|
|
1164
1164
|
function renderToStaticMarkup(node, createRootFn) {
|
|
1165
1165
|
const div = document.createElement('div');
|
|
@@ -1173,7 +1173,6 @@ function renderToStaticMarkup(node, createRootFn) {
|
|
|
1173
1173
|
});
|
|
1174
1174
|
return div.innerHTML.replaceAll(/\brgba\((.+?),[^,]+?\)/g, 'rgb($1)');
|
|
1175
1175
|
}
|
|
1176
|
-
exports.renderToStaticMarkup = renderToStaticMarkup;
|
|
1177
1176
|
var simpleFeature_1 = require("./simpleFeature");
|
|
1178
1177
|
Object.defineProperty(exports, "SimpleFeature", { enumerable: true, get: function () { return __importDefault(simpleFeature_1).default; } });
|
|
1179
1178
|
Object.defineProperty(exports, "isFeature", { enumerable: true, get: function () { return simpleFeature_1.isFeature; } });
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RemoteFileWithRangeCache =
|
|
3
|
+
exports.RemoteFileWithRangeCache = void 0;
|
|
4
|
+
exports.clearCache = clearCache;
|
|
4
5
|
const http_range_fetcher_1 = require("http-range-fetcher");
|
|
5
6
|
const buffer_1 = require("buffer");
|
|
6
7
|
const generic_filehandle_1 = require("generic-filehandle");
|
|
@@ -22,7 +23,6 @@ const globalRangeCache = new http_range_fetcher_1.HttpRangeFetcher({
|
|
|
22
23
|
function clearCache() {
|
|
23
24
|
globalRangeCache.reset();
|
|
24
25
|
}
|
|
25
|
-
exports.clearCache = clearCache;
|
|
26
26
|
class RemoteFileWithRangeCache extends generic_filehandle_1.RemoteFile {
|
|
27
27
|
async fetch(url, init) {
|
|
28
28
|
var _a;
|
package/util/io/index.js
CHANGED
|
@@ -3,7 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.RemoteFileWithRangeCache =
|
|
6
|
+
exports.RemoteFileWithRangeCache = void 0;
|
|
7
|
+
exports.resolveUriLocation = resolveUriLocation;
|
|
8
|
+
exports.openLocation = openLocation;
|
|
9
|
+
exports.getFetcher = getFetcher;
|
|
7
10
|
const generic_filehandle_1 = require("generic-filehandle");
|
|
8
11
|
const detect_node_1 = __importDefault(require("detect-node"));
|
|
9
12
|
// locals
|
|
@@ -23,7 +26,6 @@ function resolveUriLocation(location) {
|
|
|
23
26
|
? { ...location, uri: new URL(location.uri, location.baseUri).href }
|
|
24
27
|
: location;
|
|
25
28
|
}
|
|
26
|
-
exports.resolveUriLocation = resolveUriLocation;
|
|
27
29
|
function openLocation(location, pluginManager) {
|
|
28
30
|
if (!location) {
|
|
29
31
|
throw new Error('must provide a location to openLocation');
|
|
@@ -69,7 +71,6 @@ function openLocation(location, pluginManager) {
|
|
|
69
71
|
}
|
|
70
72
|
throw new Error('invalid fileLocation');
|
|
71
73
|
}
|
|
72
|
-
exports.openLocation = openLocation;
|
|
73
74
|
function getFetcher(location, pluginManager) {
|
|
74
75
|
if (!(0, types_1.isUriLocation)(location)) {
|
|
75
76
|
throw new Error(`Not a valid UriLocation: ${JSON.stringify(location)}`);
|
|
@@ -82,7 +83,6 @@ function getFetcher(location, pluginManager) {
|
|
|
82
83
|
}
|
|
83
84
|
return checkAuthNeededFetch;
|
|
84
85
|
}
|
|
85
|
-
exports.getFetcher = getFetcher;
|
|
86
86
|
function getInternetAccount(location, pluginManager) {
|
|
87
87
|
const { rootModel } = pluginManager;
|
|
88
88
|
// If there is an appRootModel, use it to find the internetAccount
|
package/util/jexl.js
CHANGED
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.default = JexlF;
|
|
6
7
|
const jexl_1 = __importDefault(require("jexl"));
|
|
7
8
|
function JexlF( /* config?: any*/) {
|
|
8
9
|
const j = new jexl_1.default.Jexl();
|
|
@@ -61,4 +62,3 @@ function JexlF( /* config?: any*/) {
|
|
|
61
62
|
j.addBinaryOp('&', 15, (a, b) => a & b);
|
|
62
63
|
return j;
|
|
63
64
|
}
|
|
64
|
-
exports.default = JexlF;
|
package/util/jexlStrings.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.stringToJexlExpression =
|
|
6
|
+
exports.stringToJexlExpression = stringToJexlExpression;
|
|
7
7
|
const jexl_1 = __importDefault(require("./jexl"));
|
|
8
8
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
9
|
const compilationCache = {};
|
|
@@ -32,4 +32,3 @@ jexl) {
|
|
|
32
32
|
}
|
|
33
33
|
return compilationCache[cacheKey];
|
|
34
34
|
}
|
|
35
|
-
exports.stringToJexlExpression = stringToJexlExpression;
|
package/util/map-obj.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = map;
|
|
3
4
|
// adapted from map-obj (MIT), with modifications to pass the "whole object"
|
|
4
5
|
// from an array of objects into itself
|
|
5
6
|
const isObject = (value) => typeof value === 'object' && value !== null;
|
|
@@ -30,4 +31,3 @@ function map(object, mapper, isSeen = new WeakSet()) {
|
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
exports.default = map;
|