@jbrowse/core 2.16.1 → 2.18.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/ArrayValue.js +1 -2
- package/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +4 -8
- package/BaseFeatureWidget/BaseFeatureDetail/BaseCard.d.ts +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/BaseCard.js +1 -2
- package/BaseFeatureWidget/BaseFeatureDetail/BasicValue.js +2 -3
- package/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.d.ts +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.js +2 -3
- package/BaseFeatureWidget/BaseFeatureDetail/DataGridDetails.js +22 -25
- package/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.d.ts +2 -2
- package/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.js +6 -8
- package/BaseFeatureWidget/BaseFeatureDetail/Position.d.ts +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/SimpleField.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/UriField.js +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/index.d.ts +3 -4
- package/BaseFeatureWidget/BaseFeatureDetail/index.js +5 -9
- package/BaseFeatureWidget/BaseFeatureDetail/util.js +0 -5
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeatureDetails.js +0 -7
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/SequenceFeaturePanel.js +1 -7
- package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.d.ts +3 -3
- package/BaseFeatureWidget/SequenceFeatureDetails/SequencePanel.js +24 -33
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/HelpDialog.js +1 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceDialog.js +3 -4
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceFeatureMenu.js +3 -6
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SequenceTypeSelector.d.ts +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.d.ts +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/dialogs/SettingsDialog.js +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/hooks.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/hooks.js +1 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/model.d.ts +2 -35
- package/BaseFeatureWidget/SequenceFeatureDetails/model.js +19 -44
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDNASequence.d.ts +3 -3
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/CDSSequence.js +5 -6
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/GenomicSequence.js +0 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.d.ts +2 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/ProteinSequence.js +0 -2
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.d.ts +1 -1
- package/BaseFeatureWidget/SequenceFeatureDetails/seqtypes/SequenceDisplay.js +1 -3
- package/BaseFeatureWidget/SequenceFeatureDetails/util.js +1 -5
- package/BaseFeatureWidget/stateModelFactory.d.ts +3 -94
- package/BaseFeatureWidget/stateModelFactory.js +3 -73
- package/BaseFeatureWidget/types.d.ts +3 -3
- package/BaseFeatureWidget/util.js +0 -4
- package/CorePlugin.d.ts +1 -1
- package/CorePlugin.js +2 -5
- package/Plugin.d.ts +2 -5
- package/Plugin.js +0 -3
- package/PluginLoader.d.ts +1 -1
- package/PluginLoader.js +2 -19
- package/PluginManager.d.ts +15 -31
- package/PluginManager.js +11 -39
- package/ReExports/DataGrid.js +0 -1
- package/ReExports/list.d.ts +0 -5
- package/ReExports/list.js +0 -5
- package/ReExports/modules.d.ts +22 -20
- package/ReExports/modules.js +16 -25
- package/TextSearch/BaseResults.d.ts +3 -3
- package/TextSearch/TextSearchManager.d.ts +4 -16
- package/TextSearch/TextSearchManager.js +1 -13
- package/assemblyManager/assembly.d.ts +5 -100
- package/assemblyManager/assembly.js +27 -143
- package/assemblyManager/assemblyConfigSchema.d.ts +1 -34
- package/assemblyManager/assemblyConfigSchema.js +12 -46
- package/assemblyManager/assemblyManager.d.ts +7 -57
- package/assemblyManager/assemblyManager.js +2 -57
- package/configuration/configurationSchema.d.ts +4 -4
- package/configuration/configurationSchema.js +2 -14
- package/configuration/configurationSlot.d.ts +1 -12
- package/configuration/configurationSlot.js +2 -32
- package/configuration/index.d.ts +2 -2
- package/configuration/index.js +2 -2
- package/configuration/types.d.ts +2 -3
- package/configuration/util.d.ts +1 -25
- package/configuration/util.js +19 -56
- package/data_adapters/BaseAdapter/BaseAdapter.d.ts +4 -14
- package/data_adapters/BaseAdapter/BaseAdapter.js +1 -10
- package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.d.ts +10 -114
- package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +13 -79
- package/data_adapters/BaseAdapter/BaseOptions.d.ts +2 -2
- package/data_adapters/BaseAdapter/BaseRefNameAliasAdapter.d.ts +2 -2
- package/data_adapters/BaseAdapter/BaseSequenceAdapter.d.ts +3 -6
- package/data_adapters/BaseAdapter/BaseTextSearchAdapter.d.ts +3 -3
- package/data_adapters/BaseAdapter/RegionsAdapter.d.ts +3 -3
- package/data_adapters/BaseAdapter/index.d.ts +4 -4
- package/data_adapters/BaseAdapter/types.d.ts +2 -2
- package/data_adapters/BaseAdapter/util.d.ts +6 -6
- package/data_adapters/CytobandAdapter/CytobandAdapter.d.ts +2 -1
- package/data_adapters/CytobandAdapter/CytobandAdapter.js +11 -12
- package/data_adapters/CytobandAdapter/configSchema.d.ts +0 -3
- package/data_adapters/CytobandAdapter/configSchema.js +1 -7
- package/data_adapters/CytobandAdapter/index.d.ts +1 -1
- package/data_adapters/CytobandAdapter/index.js +1 -1
- package/data_adapters/dataAdapterCache.d.ts +4 -21
- package/data_adapters/dataAdapterCache.js +0 -19
- package/package.json +4 -5
- package/pluggableElementTypes/AdapterType.d.ts +2 -2
- package/pluggableElementTypes/AddTrackWorkflowType.d.ts +2 -2
- package/pluggableElementTypes/ConnectionType.d.ts +3 -3
- package/pluggableElementTypes/DisplayType.d.ts +3 -9
- package/pluggableElementTypes/InternetAccountType.d.ts +2 -2
- package/pluggableElementTypes/PluggableElementBase.d.ts +1 -1
- package/pluggableElementTypes/PluggableElementBase.js +2 -2
- package/pluggableElementTypes/RpcMethodType.d.ts +5 -11
- package/pluggableElementTypes/RpcMethodType.js +7 -19
- package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.d.ts +9 -0
- package/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.js +35 -0
- package/pluggableElementTypes/TextSearchAdapterType.d.ts +2 -2
- package/pluggableElementTypes/TrackType.d.ts +3 -3
- package/pluggableElementTypes/ViewType.d.ts +3 -3
- package/pluggableElementTypes/WidgetType.d.ts +4 -3
- package/pluggableElementTypes/index.d.ts +11 -11
- package/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +2 -29
- package/pluggableElementTypes/models/BaseConnectionModelFactory.js +1 -28
- package/pluggableElementTypes/models/BaseDisplayModel.d.ts +3 -83
- package/pluggableElementTypes/models/BaseDisplayModel.js +2 -69
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +4 -46
- package/pluggableElementTypes/models/BaseTrackModel.js +0 -58
- package/pluggableElementTypes/models/BaseViewModel.d.ts +2 -42
- package/pluggableElementTypes/models/BaseViewModel.js +2 -38
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +3 -119
- package/pluggableElementTypes/models/InternetAccountModel.js +3 -123
- package/pluggableElementTypes/models/baseConnectionConfig.d.ts +0 -6
- package/pluggableElementTypes/models/baseConnectionConfig.js +1 -13
- package/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +0 -15
- package/pluggableElementTypes/models/baseInternetAccountConfig.js +1 -23
- package/pluggableElementTypes/models/baseTrackConfig.d.ts +2 -53
- package/pluggableElementTypes/models/baseTrackConfig.js +1 -58
- package/pluggableElementTypes/renderers/BoxRendererType.d.ts +7 -15
- package/pluggableElementTypes/renderers/BoxRendererType.js +3 -14
- package/pluggableElementTypes/renderers/CircularChordRendererType.d.ts +3 -2
- package/pluggableElementTypes/renderers/CircularChordRendererType.js +1 -6
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.d.ts +6 -21
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +2 -25
- package/pluggableElementTypes/renderers/FeatureRendererType.d.ts +5 -47
- package/pluggableElementTypes/renderers/FeatureRendererType.js +15 -68
- package/pluggableElementTypes/renderers/RendererType.d.ts +4 -8
- package/pluggableElementTypes/renderers/RendererType.js +1 -5
- package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.d.ts +2 -2
- package/pluggableElementTypes/renderers/RpcRenderedSvgGroup.js +3 -12
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.d.ts +1 -1
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +6 -14
- package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +9 -49
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +7 -57
- package/pluggableElementTypes/renderers/index.d.ts +1 -1
- package/pluggableElementTypes/renderers/util/serializableFilterChain.js +1 -3
- package/rpc/BaseRpcDriver.d.ts +3 -4
- package/rpc/BaseRpcDriver.js +20 -80
- package/rpc/MainThreadRpcDriver.d.ts +3 -7
- package/rpc/MainThreadRpcDriver.js +0 -5
- package/rpc/RpcManager.d.ts +3 -3
- package/rpc/RpcManager.js +2 -4
- package/rpc/WebWorkerRpcDriver.d.ts +3 -2
- package/rpc/WebWorkerRpcDriver.js +2 -13
- package/rpc/baseRpcConfig.d.ts +0 -3
- package/rpc/baseRpcConfig.js +1 -7
- package/rpc/configSchema.d.ts +0 -6
- package/rpc/configSchema.js +2 -11
- package/rpc/mainThreadRpcConfig.js +1 -7
- package/rpc/methods/CoreFreeResources.d.ts +0 -6
- package/rpc/methods/CoreFreeResources.js +2 -9
- package/rpc/methods/CoreGetFeatureDensityStats.d.ts +4 -5
- package/rpc/methods/CoreGetFeatureDensityStats.js +1 -1
- package/rpc/methods/CoreGetFeatureDetails.d.ts +2 -7
- package/rpc/methods/CoreGetFeatureDetails.js +0 -5
- package/rpc/methods/CoreGetFeatures.d.ts +5 -5
- package/rpc/methods/CoreGetFeatures.js +4 -5
- package/rpc/methods/CoreGetFileInfo.d.ts +1 -2
- package/rpc/methods/CoreGetFileInfo.js +1 -1
- package/rpc/methods/CoreGetMetadata.d.ts +1 -2
- package/rpc/methods/CoreGetMetadata.js +1 -1
- package/rpc/methods/CoreGetRefNames.d.ts +1 -2
- package/rpc/methods/CoreGetRefNames.js +1 -1
- package/rpc/methods/CoreRender.d.ts +2 -6
- package/rpc/methods/CoreRender.js +5 -7
- package/rpc/methods/util.d.ts +3 -3
- package/rpc/methods/util.js +0 -1
- package/rpc/webWorkerRpcConfig.js +1 -7
- package/stories/JBrowseCore.stories.d.ts +1 -1
- package/stories/JBrowseCore.stories.js +3 -3
- package/stories/examples/WithSequencePanel.d.ts +1 -1
- package/stories/examples/WithSequencePanel.js +3 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AppLogo.d.ts +1 -1
- package/ui/AppLogo.js +0 -2
- package/ui/AssemblySelector.d.ts +2 -2
- package/ui/AssemblySelector.js +5 -5
- package/ui/BaseTooltip.js +2 -6
- package/ui/CascadingMenu.d.ts +2 -2
- package/ui/CascadingMenu.js +3 -4
- package/ui/CascadingMenuButton.d.ts +1 -1
- package/ui/CascadingMenuButton.js +1 -1
- package/ui/ColorPicker.js +1 -7
- package/ui/Dialog.d.ts +1 -1
- package/ui/Dialog.js +2 -6
- package/ui/DropDownMenu.d.ts +1 -1
- package/ui/DropDownMenu.js +2 -2
- package/ui/EditableTypography.d.ts +1 -1
- package/ui/EditableTypography.js +1 -5
- package/ui/ErrorBoundary.d.ts +2 -1
- package/ui/ErrorMessage.js +2 -9
- package/ui/ErrorMessageStackTraceDialog.js +2 -10
- package/ui/FactoryResetDialog.js +1 -1
- package/ui/FatalErrorDialog.js +1 -1
- package/ui/FileSelector/FileSelector.d.ts +4 -3
- package/ui/FileSelector/FileSelector.js +40 -40
- package/ui/FileSelector/LocalFileChooser.d.ts +1 -1
- package/ui/FileSelector/LocalFileChooser.js +0 -1
- package/ui/FileSelector/UrlChooser.d.ts +4 -3
- package/ui/FileSelector/UrlChooser.js +6 -2
- package/ui/Icons.d.ts +1 -1
- package/ui/Icons.js +1 -7
- package/ui/LoadingEllipses.d.ts +1 -1
- package/ui/LoadingEllipses.js +3 -3
- package/ui/Menu.d.ts +1 -1
- package/ui/Menu.js +3 -10
- package/ui/MenuButton.d.ts +1 -1
- package/ui/ResizeHandle.js +2 -2
- package/ui/ReturnToImportFormDialog.js +1 -1
- package/ui/SanitizedHTML.js +2 -19
- package/ui/Snackbar.d.ts +2 -2
- package/ui/Snackbar.js +1 -2
- package/ui/SnackbarModel.d.ts +1 -26
- package/ui/SnackbarModel.js +2 -30
- package/ui/colors.d.ts +1 -1
- package/ui/colors.js +1 -1
- package/ui/react-colorful.js +0 -3
- package/ui/theme.d.ts +1 -1
- package/ui/theme.js +24 -84
- package/util/Base1DUtils.d.ts +1 -1
- package/util/Base1DUtils.js +0 -12
- package/util/Base1DViewModel.d.ts +4 -81
- package/util/Base1DViewModel.js +4 -108
- package/util/QuickLRU.js +0 -9
- package/util/TimeTraveller.js +0 -4
- package/util/aborting.d.ts +0 -20
- package/util/aborting.js +0 -31
- package/util/analytics.js +1 -12
- package/util/blockTypes.d.ts +0 -11
- package/util/blockTypes.js +0 -13
- package/util/calculateDynamicBlocks.d.ts +1 -20
- package/util/calculateDynamicBlocks.js +1 -22
- package/util/calculateStaticBlocks.d.ts +2 -2
- package/util/calculateStaticBlocks.js +0 -2
- package/util/color/cssColorsLevel4.js +0 -1
- package/util/color/index.d.ts +0 -19
- package/util/color/index.js +0 -30
- package/util/compositeMap.js +0 -2
- package/util/dedupe.js +0 -1
- package/util/formatFastaStrings.d.ts +0 -13
- package/util/formatFastaStrings.js +0 -13
- package/util/idMaker.d.ts +1 -1
- package/util/idMaker.js +16 -12
- package/util/index.d.ts +25 -173
- package/util/index.js +87 -326
- package/util/io/RemoteFileWithRangeCache.d.ts +3 -2
- package/util/io/RemoteFileWithRangeCache.js +6 -10
- package/util/io/index.d.ts +3 -4
- package/util/io/index.js +3 -17
- package/util/jexl.js +3 -13
- package/util/jexlStrings.d.ts +0 -6
- package/util/jexlStrings.js +0 -8
- package/util/layouts/BaseLayout.d.ts +1 -1
- package/util/layouts/GranularRectLayout.d.ts +1 -17
- package/util/layouts/GranularRectLayout.js +4 -81
- package/util/layouts/MultiLayout.d.ts +1 -6
- package/util/layouts/MultiLayout.js +0 -6
- package/util/layouts/PrecomputedLayout.d.ts +1 -4
- package/util/layouts/PrecomputedLayout.js +0 -5
- package/util/layouts/PrecomputedMultiLayout.js +0 -2
- package/util/layouts/SceneGraph.d.ts +0 -12
- package/util/layouts/SceneGraph.js +0 -13
- package/util/makeAbortableReaction.d.ts +2 -0
- package/util/makeAbortableReaction.js +50 -0
- package/util/map-obj.js +0 -4
- package/util/mst-reflection.d.ts +1 -14
- package/util/mst-reflection.js +1 -28
- package/util/nanoid.js +0 -31
- package/util/nextTick.d.ts +1 -0
- package/util/nextTick.js +6 -0
- package/util/offscreenCanvasPonyfill.d.ts +0 -1
- package/util/offscreenCanvasPonyfill.js +1 -9
- package/util/offscreenCanvasUtils.js +1 -8
- package/util/range.d.ts +0 -25
- package/util/range.js +0 -34
- package/util/rxjs.d.ts +3 -7
- package/util/rxjs.js +2 -9
- package/util/simpleFeature.d.ts +0 -58
- package/util/simpleFeature.js +0 -35
- package/util/stats.d.ts +4 -34
- package/util/stats.js +0 -60
- package/util/stopToken.d.ts +3 -0
- package/util/stopToken.js +29 -0
- package/util/tracks.d.ts +3 -25
- package/util/tracks.js +0 -30
- package/util/types/index.d.ts +14 -30
- package/util/types/index.js +5 -14
- package/util/types/mst.js +0 -9
- package/util/types/util.d.ts +2 -9
- package/util/useMeasure.js +0 -1
- package/util/when.d.ts +1 -15
- package/util/when.js +3 -70
- package/rpc/remoteAbortSignals.d.ts +0 -36
- package/rpc/remoteAbortSignals.js +0 -79
package/util/stats.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NoAssemblyRegion } from './types';
|
|
3
|
-
import {
|
|
1
|
+
import type { Feature } from './simpleFeature';
|
|
2
|
+
import type { NoAssemblyRegion } from './types';
|
|
3
|
+
import type { Observable } from 'rxjs';
|
|
4
4
|
export interface UnrectifiedQuantitativeStats {
|
|
5
5
|
scoreMin: number;
|
|
6
6
|
scoreMax: number;
|
|
@@ -10,42 +10,12 @@ export interface UnrectifiedQuantitativeStats {
|
|
|
10
10
|
basesCovered: number;
|
|
11
11
|
}
|
|
12
12
|
export interface QuantitativeStats extends UnrectifiedQuantitativeStats {
|
|
13
|
+
currStatsBpPerPx: number;
|
|
13
14
|
featureDensity: number;
|
|
14
15
|
scoreMean: number;
|
|
15
16
|
scoreStdDev: number;
|
|
16
17
|
}
|
|
17
|
-
/**
|
|
18
|
-
* calculate standard deviation using the 'shortcut method' that accepts
|
|
19
|
-
* the sum and the sum squares of the elements
|
|
20
|
-
*
|
|
21
|
-
* @param sum - sum(i, 1..n)
|
|
22
|
-
* @param sumSquares - sum(i^2, 1..n)
|
|
23
|
-
* @param n - number of elements
|
|
24
|
-
* @param population - boolean: use population instead of sample correction
|
|
25
|
-
* @returns - the estimated std deviation
|
|
26
|
-
*/
|
|
27
18
|
export declare function calcStdFromSums(sum: number, sumSquares: number, n: number, population?: boolean): number;
|
|
28
|
-
/**
|
|
29
|
-
* @param stats - a summary stats object with scoreSum, featureCount,
|
|
30
|
-
* scoreSumSquares, and basesCovered
|
|
31
|
-
* @returns - a summary stats object with
|
|
32
|
-
* scoreMean, scoreStdDev, and featureDensity added
|
|
33
|
-
*/
|
|
34
19
|
export declare function rectifyStats(s: UnrectifiedQuantitativeStats): QuantitativeStats;
|
|
35
|
-
/**
|
|
36
|
-
* calculates per-base scores for variable width features over a region
|
|
37
|
-
*
|
|
38
|
-
* @param region - object contains start, end
|
|
39
|
-
* @param features - list of features with start, end, score
|
|
40
|
-
* @returns array of numeric scores
|
|
41
|
-
*/
|
|
42
|
-
export declare function calcPerBaseStats(region: NoAssemblyRegion, features: Feature[]): number[];
|
|
43
|
-
/**
|
|
44
|
-
* transform a list of scores to summary statistics
|
|
45
|
-
*
|
|
46
|
-
* @param region - object with start, end
|
|
47
|
-
* @param features - array of features which are possibly summary features
|
|
48
|
-
* @returns - object with scoreMax, scoreMin, scoreSum, scoreSumSquares, etc
|
|
49
|
-
*/
|
|
50
20
|
export declare function scoresToStats(region: NoAssemblyRegion, feats: Observable<Feature>): Promise<QuantitativeStats>;
|
|
51
21
|
export declare function blankStats(): QuantitativeStats;
|
package/util/stats.js
CHANGED
|
@@ -2,21 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.calcStdFromSums = calcStdFromSums;
|
|
4
4
|
exports.rectifyStats = rectifyStats;
|
|
5
|
-
exports.calcPerBaseStats = calcPerBaseStats;
|
|
6
5
|
exports.scoresToStats = scoresToStats;
|
|
7
6
|
exports.blankStats = blankStats;
|
|
8
7
|
const rxjs_1 = require("rxjs");
|
|
9
8
|
const operators_1 = require("rxjs/operators");
|
|
10
|
-
/**
|
|
11
|
-
* calculate standard deviation using the 'shortcut method' that accepts
|
|
12
|
-
* the sum and the sum squares of the elements
|
|
13
|
-
*
|
|
14
|
-
* @param sum - sum(i, 1..n)
|
|
15
|
-
* @param sumSquares - sum(i^2, 1..n)
|
|
16
|
-
* @param n - number of elements
|
|
17
|
-
* @param population - boolean: use population instead of sample correction
|
|
18
|
-
* @returns - the estimated std deviation
|
|
19
|
-
*/
|
|
20
9
|
function calcStdFromSums(sum, sumSquares, n, population = false) {
|
|
21
10
|
if (n === 0) {
|
|
22
11
|
return 0;
|
|
@@ -26,7 +15,6 @@ function calcStdFromSums(sum, sumSquares, n, population = false) {
|
|
|
26
15
|
variance = sumSquares / n - (sum * sum) / (n * n);
|
|
27
16
|
}
|
|
28
17
|
else {
|
|
29
|
-
// sample correction is n-1
|
|
30
18
|
variance = sumSquares - (sum * sum) / n;
|
|
31
19
|
if (n > 1) {
|
|
32
20
|
variance /= n - 1;
|
|
@@ -34,12 +22,6 @@ function calcStdFromSums(sum, sumSquares, n, population = false) {
|
|
|
34
22
|
}
|
|
35
23
|
return variance < 0 ? 0 : Math.sqrt(variance);
|
|
36
24
|
}
|
|
37
|
-
/**
|
|
38
|
-
* @param stats - a summary stats object with scoreSum, featureCount,
|
|
39
|
-
* scoreSumSquares, and basesCovered
|
|
40
|
-
* @returns - a summary stats object with
|
|
41
|
-
* scoreMean, scoreStdDev, and featureDensity added
|
|
42
|
-
*/
|
|
43
25
|
function rectifyStats(s) {
|
|
44
26
|
return {
|
|
45
27
|
...s,
|
|
@@ -48,47 +30,6 @@ function rectifyStats(s) {
|
|
|
48
30
|
featureDensity: (s.featureCount || 1) / s.basesCovered,
|
|
49
31
|
};
|
|
50
32
|
}
|
|
51
|
-
/**
|
|
52
|
-
* calculates per-base scores for variable width features over a region
|
|
53
|
-
*
|
|
54
|
-
* @param region - object contains start, end
|
|
55
|
-
* @param features - list of features with start, end, score
|
|
56
|
-
* @returns array of numeric scores
|
|
57
|
-
*/
|
|
58
|
-
function calcPerBaseStats(region, features) {
|
|
59
|
-
const { start, end } = region;
|
|
60
|
-
const scores = [];
|
|
61
|
-
const feats = features.sort((a, b) => a.get('start') - b.get('start'));
|
|
62
|
-
let pos = start;
|
|
63
|
-
let currentFeat = 0;
|
|
64
|
-
let i = 0;
|
|
65
|
-
while (pos < end) {
|
|
66
|
-
while (currentFeat < feats.length &&
|
|
67
|
-
pos >= feats[currentFeat].get('end')) {
|
|
68
|
-
currentFeat += 1;
|
|
69
|
-
}
|
|
70
|
-
const f = feats[currentFeat];
|
|
71
|
-
if (!f) {
|
|
72
|
-
scores[i] = 0;
|
|
73
|
-
}
|
|
74
|
-
else if (pos >= f.get('start') && pos < f.get('end')) {
|
|
75
|
-
scores[i] = f.get('score');
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
scores[i] = 0;
|
|
79
|
-
}
|
|
80
|
-
i += 1;
|
|
81
|
-
pos += 1;
|
|
82
|
-
}
|
|
83
|
-
return scores;
|
|
84
|
-
}
|
|
85
|
-
/**
|
|
86
|
-
* transform a list of scores to summary statistics
|
|
87
|
-
*
|
|
88
|
-
* @param region - object with start, end
|
|
89
|
-
* @param features - array of features which are possibly summary features
|
|
90
|
-
* @returns - object with scoreMax, scoreMin, scoreSum, scoreSumSquares, etc
|
|
91
|
-
*/
|
|
92
33
|
async function scoresToStats(region, feats) {
|
|
93
34
|
const { start, end } = region;
|
|
94
35
|
const seed = {
|
|
@@ -111,7 +52,6 @@ async function scoresToStats(region, feats) {
|
|
|
111
52
|
found = true;
|
|
112
53
|
return acc;
|
|
113
54
|
}, seed)));
|
|
114
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
115
55
|
return found
|
|
116
56
|
? rectifyStats({
|
|
117
57
|
scoreMax,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createStopToken = createStopToken;
|
|
4
|
+
exports.stopStopToken = stopStopToken;
|
|
5
|
+
exports.checkStopToken = checkStopToken;
|
|
6
|
+
function isWebWorker() {
|
|
7
|
+
return (typeof WorkerGlobalScope !== 'undefined' &&
|
|
8
|
+
self instanceof WorkerGlobalScope);
|
|
9
|
+
}
|
|
10
|
+
function createStopToken() {
|
|
11
|
+
var _a;
|
|
12
|
+
return ((_a = URL.createObjectURL) === null || _a === void 0 ? void 0 : _a.call(URL, new Blob())) || `${Math.random()}`;
|
|
13
|
+
}
|
|
14
|
+
function stopStopToken(stopToken) {
|
|
15
|
+
var _a;
|
|
16
|
+
(_a = URL.revokeObjectURL) === null || _a === void 0 ? void 0 : _a.call(URL, stopToken);
|
|
17
|
+
}
|
|
18
|
+
function checkStopToken(stopToken) {
|
|
19
|
+
if (typeof jest === 'undefined' && stopToken !== undefined && isWebWorker()) {
|
|
20
|
+
const xhr = new XMLHttpRequest();
|
|
21
|
+
xhr.open('GET', stopToken, false);
|
|
22
|
+
try {
|
|
23
|
+
xhr.send(null);
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
throw new Error('aborted');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
package/util/tracks.d.ts
CHANGED
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import type { FileLocation, PreFileLocation } from './types';
|
|
2
|
+
import type { AnyConfigurationModel } from '../configuration';
|
|
3
|
+
import type { IAnyStateTreeNode } from 'mobx-state-tree';
|
|
4
4
|
export declare function getTrackAssemblyNames(track: IAnyStateTreeNode & {
|
|
5
5
|
configuration: AnyConfigurationModel;
|
|
6
6
|
}): string[];
|
|
7
7
|
export declare function getConfAssemblyNames(conf: AnyConfigurationModel): string[];
|
|
8
|
-
/**
|
|
9
|
-
* return the rpcSessionId of the highest parent node in the tree that has an
|
|
10
|
-
* rpcSessionId */
|
|
11
8
|
export declare function getRpcSessionId(thisNode: IAnyStateTreeNode): string;
|
|
12
|
-
/**
|
|
13
|
-
* given an MST node, get the renderprops of the first parent container that
|
|
14
|
-
* has renderProps
|
|
15
|
-
* @param node -
|
|
16
|
-
* @returns renderprops, or empty object if none found
|
|
17
|
-
*/
|
|
18
9
|
export declare function getParentRenderProps(node: IAnyStateTreeNode): any;
|
|
19
10
|
export declare const UNKNOWN = "UNKNOWN";
|
|
20
11
|
export declare const UNSUPPORTED = "UNSUPPORTED";
|
|
@@ -26,12 +17,6 @@ export declare function storeBlobLocation(location: PreFileLocation): import("./
|
|
|
26
17
|
blobId: string;
|
|
27
18
|
locationType: string;
|
|
28
19
|
};
|
|
29
|
-
/**
|
|
30
|
-
* creates a new location from the provided location including the appropriate suffix and location type
|
|
31
|
-
* @param location - the FileLocation
|
|
32
|
-
* @param suffix - the file suffix (e.g. .bam)
|
|
33
|
-
* @returns the constructed location object from the provided parameters
|
|
34
|
-
*/
|
|
35
20
|
export declare function makeIndex(location: FileLocation, suffix: string): import("./types").BlobLocation | {
|
|
36
21
|
uri: string;
|
|
37
22
|
locationType: string;
|
|
@@ -41,13 +26,6 @@ export declare function makeIndex(location: FileLocation, suffix: string): impor
|
|
|
41
26
|
locationType: string;
|
|
42
27
|
uri?: undefined;
|
|
43
28
|
};
|
|
44
|
-
/**
|
|
45
|
-
* constructs a potential index file (with suffix) from the provided file name
|
|
46
|
-
* @param name - the name of the index file
|
|
47
|
-
* @param typeA - one option of a potential two file suffix (e.g. CSI, BAI)
|
|
48
|
-
* @param typeB - the second option of a potential two file suffix (e.g. CSI, BAI)
|
|
49
|
-
* @returns a likely name of the index file for a given filename
|
|
50
|
-
*/
|
|
51
29
|
export declare function makeIndexType(name: string | undefined, typeA: string, typeB: string): string;
|
|
52
30
|
export interface AdapterConfig {
|
|
53
31
|
type: string;
|
package/util/tracks.js
CHANGED
|
@@ -20,14 +20,12 @@ exports.getTrackName = getTrackName;
|
|
|
20
20
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
21
21
|
const index_1 = require("./index");
|
|
22
22
|
const configuration_1 = require("../configuration");
|
|
23
|
-
/* utility functions for use by track models and so forth */
|
|
24
23
|
function getTrackAssemblyNames(track) {
|
|
25
24
|
return getConfAssemblyNames(track.configuration);
|
|
26
25
|
}
|
|
27
26
|
function getConfAssemblyNames(conf) {
|
|
28
27
|
const trackAssemblyNames = (0, configuration_1.readConfObject)(conf, 'assemblyNames');
|
|
29
28
|
if (!trackAssemblyNames) {
|
|
30
|
-
// Check if it's an assembly sequence track
|
|
31
29
|
const parent = (0, mobx_state_tree_1.getParent)(conf);
|
|
32
30
|
if ('sequence' in parent) {
|
|
33
31
|
return [(0, configuration_1.readConfObject)(parent, 'name')];
|
|
@@ -38,9 +36,6 @@ function getConfAssemblyNames(conf) {
|
|
|
38
36
|
}
|
|
39
37
|
return trackAssemblyNames;
|
|
40
38
|
}
|
|
41
|
-
/**
|
|
42
|
-
* return the rpcSessionId of the highest parent node in the tree that has an
|
|
43
|
-
* rpcSessionId */
|
|
44
39
|
function getRpcSessionId(thisNode) {
|
|
45
40
|
let highestRpcSessionId;
|
|
46
41
|
for (let node = thisNode; !(0, mobx_state_tree_1.isRoot)(node); node = (0, mobx_state_tree_1.getParent)(node)) {
|
|
@@ -53,12 +48,6 @@ function getRpcSessionId(thisNode) {
|
|
|
53
48
|
}
|
|
54
49
|
return highestRpcSessionId;
|
|
55
50
|
}
|
|
56
|
-
/**
|
|
57
|
-
* given an MST node, get the renderprops of the first parent container that
|
|
58
|
-
* has renderProps
|
|
59
|
-
* @param node -
|
|
60
|
-
* @returns renderprops, or empty object if none found
|
|
61
|
-
*/
|
|
62
51
|
function getParentRenderProps(node) {
|
|
63
52
|
for (let currentNode = (0, mobx_state_tree_1.getParent)(node); !(0, mobx_state_tree_1.isRoot)(currentNode); currentNode = (0, mobx_state_tree_1.getParent)(currentNode)) {
|
|
64
53
|
if ('renderProps' in currentNode) {
|
|
@@ -70,22 +59,16 @@ function getParentRenderProps(node) {
|
|
|
70
59
|
exports.UNKNOWN = 'UNKNOWN';
|
|
71
60
|
exports.UNSUPPORTED = 'UNSUPPORTED';
|
|
72
61
|
let blobMap = {};
|
|
73
|
-
// get a specific blob
|
|
74
62
|
function getBlob(id) {
|
|
75
63
|
return blobMap[id];
|
|
76
64
|
}
|
|
77
|
-
// used to export entire context to webworker
|
|
78
65
|
function getBlobMap() {
|
|
79
66
|
return blobMap;
|
|
80
67
|
}
|
|
81
|
-
// used in new contexts like webworkers
|
|
82
68
|
function setBlobMap(map) {
|
|
83
69
|
blobMap = map;
|
|
84
70
|
}
|
|
85
71
|
let counter = 0;
|
|
86
|
-
// blob files are stored in a global map. the blobId is based on a combination
|
|
87
|
-
// of timestamp plus counter to be unique across sessions and fast repeated
|
|
88
|
-
// calls
|
|
89
72
|
function storeBlobLocation(location) {
|
|
90
73
|
if ('blob' in location) {
|
|
91
74
|
const blobId = `b${+Date.now()}-${counter++}`;
|
|
@@ -94,12 +77,6 @@ function storeBlobLocation(location) {
|
|
|
94
77
|
}
|
|
95
78
|
return location;
|
|
96
79
|
}
|
|
97
|
-
/**
|
|
98
|
-
* creates a new location from the provided location including the appropriate suffix and location type
|
|
99
|
-
* @param location - the FileLocation
|
|
100
|
-
* @param suffix - the file suffix (e.g. .bam)
|
|
101
|
-
* @returns the constructed location object from the provided parameters
|
|
102
|
-
*/
|
|
103
80
|
function makeIndex(location, suffix) {
|
|
104
81
|
if ('uri' in location) {
|
|
105
82
|
return { uri: location.uri + suffix, locationType: 'UriLocation' };
|
|
@@ -112,13 +89,6 @@ function makeIndex(location, suffix) {
|
|
|
112
89
|
}
|
|
113
90
|
return location;
|
|
114
91
|
}
|
|
115
|
-
/**
|
|
116
|
-
* constructs a potential index file (with suffix) from the provided file name
|
|
117
|
-
* @param name - the name of the index file
|
|
118
|
-
* @param typeA - one option of a potential two file suffix (e.g. CSI, BAI)
|
|
119
|
-
* @param typeB - the second option of a potential two file suffix (e.g. CSI, BAI)
|
|
120
|
-
* @returns a likely name of the index file for a given filename
|
|
121
|
-
*/
|
|
122
92
|
function makeIndexType(name, typeA, typeB) {
|
|
123
93
|
return (name === null || name === void 0 ? void 0 : name.toUpperCase().endsWith(typeA)) ? typeA : typeB;
|
|
124
94
|
}
|
package/util/types/index.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { AnyConfigurationModel } from '../../configuration';
|
|
5
|
-
import TextSearchManager from '../../TextSearch/TextSearchManager';
|
|
6
|
-
import { MenuItem } from '../../ui';
|
|
7
|
-
import RpcManager from '../../rpc/RpcManager';
|
|
8
|
-
import { Feature } from '../simpleFeature';
|
|
9
|
-
import { BaseInternetAccountModel } from '../../pluggableElementTypes/models';
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { BlobLocation as MUBlobLocation, LocalPathLocation as MULocalPathLocation, NoAssemblyRegion as MUNoAssemblyRegion, Region as MUIRegion, UriLocation as MUUriLocation } from './mst';
|
|
3
|
+
import type TextSearchManager from '../../TextSearch/TextSearchManager';
|
|
10
4
|
import type assemblyManager from '../../assemblyManager';
|
|
11
|
-
import type {
|
|
5
|
+
import type { AnyConfigurationModel } from '../../configuration';
|
|
6
|
+
import type { BaseInternetAccountModel } from '../../pluggableElementTypes/models';
|
|
7
|
+
import type RpcManager from '../../rpc/RpcManager';
|
|
8
|
+
import type { MenuItem } from '../../ui';
|
|
9
|
+
import type { Feature } from '../simpleFeature';
|
|
10
|
+
import type { ThemeOptions } from '@mui/material';
|
|
11
|
+
import type { IAnyStateTreeNode, IStateTreeNode, IType, Instance, SnapshotIn } from 'mobx-state-tree';
|
|
12
12
|
export * from './util';
|
|
13
|
-
|
|
14
|
-
export interface AbstractViewContainer extends IStateTreeNode<IType<any, unknown, any>> {
|
|
13
|
+
export interface AbstractViewContainer extends IStateTreeNode<IType<any, any, any>> {
|
|
15
14
|
views: AbstractViewModel[];
|
|
16
15
|
removeView(view: AbstractViewModel): void;
|
|
17
16
|
addView(typeName: string, initialState?: Record<string, unknown>): AbstractViewModel;
|
|
@@ -41,7 +40,6 @@ export interface JBrowsePlugin {
|
|
|
41
40
|
image?: string;
|
|
42
41
|
}
|
|
43
42
|
export type DialogComponentType = React.LazyExoticComponent<React.FC<any>> | React.FC<any>;
|
|
44
|
-
/** minimum interface that all session state models must implement */
|
|
45
43
|
export interface AbstractSessionModel extends AbstractViewContainer {
|
|
46
44
|
jbrowse: IAnyStateTreeNode;
|
|
47
45
|
drawerPosition?: string;
|
|
@@ -97,17 +95,14 @@ export interface AbstractSessionModel extends AbstractViewContainer {
|
|
|
97
95
|
tracks: AnyConfigurationModel[];
|
|
98
96
|
}
|
|
99
97
|
export declare function isSessionModel(thing: unknown): thing is AbstractSessionModel;
|
|
100
|
-
/** abstract interface for a session allows editing configurations */
|
|
101
98
|
export interface SessionWithConfigEditing extends AbstractSessionModel {
|
|
102
99
|
editConfiguration(configuration: AnyConfigurationModel): void;
|
|
103
100
|
}
|
|
104
|
-
export declare function isSessionModelWithConfigEditing(
|
|
105
|
-
|
|
106
|
-
export interface SessionWithConfigEditing extends AbstractSessionModel {
|
|
101
|
+
export declare function isSessionModelWithConfigEditing(t: unknown): t is SessionWithConfigEditing;
|
|
102
|
+
export interface SessionWithAddTracks extends AbstractSessionModel {
|
|
107
103
|
addTrackConf(configuration: AnyConfigurationModel | SnapshotIn<AnyConfigurationModel>): void;
|
|
108
104
|
}
|
|
109
|
-
export declare function isSessionWithAddTracks(
|
|
110
|
-
/** abstract interface for a session allows adding tracks */
|
|
105
|
+
export declare function isSessionWithAddTracks(t: unknown): t is SessionWithAddTracks;
|
|
111
106
|
export interface SessionWithShareURL extends AbstractSessionModel {
|
|
112
107
|
shareURL: string;
|
|
113
108
|
}
|
|
@@ -116,7 +111,6 @@ export interface Widget {
|
|
|
116
111
|
type: string;
|
|
117
112
|
id: string;
|
|
118
113
|
}
|
|
119
|
-
/** abstract interface for a session that manages widgets */
|
|
120
114
|
export interface SessionWithWidgets extends AbstractSessionModel {
|
|
121
115
|
minimized: boolean;
|
|
122
116
|
visibleWidget?: Widget;
|
|
@@ -152,18 +146,15 @@ export interface SessionWithSessionPlugins extends AbstractSessionModel {
|
|
|
152
146
|
removeSessionPlugin: Function;
|
|
153
147
|
}
|
|
154
148
|
export declare function isSessionWithSessionPlugins(thing: unknown): thing is SessionWithSessionPlugins;
|
|
155
|
-
/** abstract interface for a session that manages a global selection */
|
|
156
149
|
export interface SelectionContainer extends AbstractSessionModel {
|
|
157
150
|
selection?: unknown;
|
|
158
151
|
setSelection(thing: unknown): void;
|
|
159
152
|
}
|
|
160
153
|
export declare function isSelectionContainer(thing: unknown): thing is SelectionContainer;
|
|
161
|
-
/** abstract interface for a session allows applying focus to views and widgets */
|
|
162
154
|
export interface SessionWithFocusedViewAndDrawerWidgets extends SessionWithDrawerWidgets {
|
|
163
155
|
focusedViewId: string | undefined;
|
|
164
156
|
setFocusedViewId(id: string): void;
|
|
165
157
|
}
|
|
166
|
-
/** minimum interface that all view state models must implement */
|
|
167
158
|
export interface AbstractViewModel {
|
|
168
159
|
id: string;
|
|
169
160
|
type: string;
|
|
@@ -194,7 +185,6 @@ export interface TrackViewModel extends AbstractViewModel {
|
|
|
194
185
|
hideTrack(trackId: string): void;
|
|
195
186
|
}
|
|
196
187
|
export declare function isTrackViewModel(thing: unknown): thing is TrackViewModel;
|
|
197
|
-
/** minimum interface for the root MST model of a JBrowse app */
|
|
198
188
|
export interface AbstractRootModel {
|
|
199
189
|
jbrowse: IAnyStateTreeNode;
|
|
200
190
|
session?: AbstractSessionModel;
|
|
@@ -202,7 +192,6 @@ export interface AbstractRootModel {
|
|
|
202
192
|
adminMode?: boolean;
|
|
203
193
|
error?: unknown;
|
|
204
194
|
}
|
|
205
|
-
/** root model with more included for the heavier JBrowse web and desktop app */
|
|
206
195
|
export interface AppRootModel extends AbstractRootModel {
|
|
207
196
|
internetAccounts: BaseInternetAccountModel[];
|
|
208
197
|
findAppropriateInternetAccount(location: UriLocation): BaseInternetAccountModel | undefined;
|
|
@@ -213,7 +202,6 @@ export interface RootModelWithInternetAccounts extends AbstractRootModel {
|
|
|
213
202
|
findAppropriateInternetAccount(location: UriLocation): BaseInternetAccountModel | undefined;
|
|
214
203
|
}
|
|
215
204
|
export declare function isRootModelWithInternetAccounts(thing: unknown): thing is RootModelWithInternetAccounts;
|
|
216
|
-
/** a root model that manages global menus */
|
|
217
205
|
export interface AbstractMenuManager {
|
|
218
206
|
appendMenu(menuName: string): void;
|
|
219
207
|
insertMenu(menuName: string, position: number): number;
|
|
@@ -225,10 +213,6 @@ export interface AbstractMenuManager {
|
|
|
225
213
|
export declare function isAbstractMenuManager(thing: unknown): thing is AbstractMenuManager;
|
|
226
214
|
export interface NoAssemblyRegion extends SnapshotIn<typeof MUNoAssemblyRegion> {
|
|
227
215
|
}
|
|
228
|
-
/**
|
|
229
|
-
* a description of a specific genomic region. assemblyName, refName, start,
|
|
230
|
-
* end, and reversed
|
|
231
|
-
*/
|
|
232
216
|
export interface Region extends SnapshotIn<typeof MUIRegion> {
|
|
233
217
|
}
|
|
234
218
|
export interface AugmentedRegion extends Region {
|
package/util/types/index.js
CHANGED
|
@@ -54,13 +54,11 @@ function isSessionModel(thing) {
|
|
|
54
54
|
'rpcManager' in thing &&
|
|
55
55
|
'configuration' in thing);
|
|
56
56
|
}
|
|
57
|
-
function isSessionModelWithConfigEditing(
|
|
58
|
-
return isSessionModel(
|
|
57
|
+
function isSessionModelWithConfigEditing(t) {
|
|
58
|
+
return isSessionModel(t) && 'editConfiguration' in t;
|
|
59
59
|
}
|
|
60
|
-
function isSessionWithAddTracks(
|
|
61
|
-
return (
|
|
62
|
-
// @ts-expect-error
|
|
63
|
-
isSessionModel(thing) && 'addTrackConf' in thing && !thing.disableAddTracks);
|
|
60
|
+
function isSessionWithAddTracks(t) {
|
|
61
|
+
return (isSessionModel(t) && 'addTrackConf' in t && !t.disableAddTracks);
|
|
64
62
|
}
|
|
65
63
|
function isSessionWithShareURL(thing) {
|
|
66
64
|
return isSessionModel(thing) && 'shareURL' in thing && !!thing.shareURL;
|
|
@@ -93,14 +91,12 @@ function isTrackModel(thing) {
|
|
|
93
91
|
return (typeof thing === 'object' &&
|
|
94
92
|
thing !== null &&
|
|
95
93
|
'configuration' in thing &&
|
|
96
|
-
// @ts-expect-error
|
|
97
94
|
thing.configuration.trackId);
|
|
98
95
|
}
|
|
99
96
|
function isDisplayModel(thing) {
|
|
100
97
|
return (typeof thing === 'object' &&
|
|
101
98
|
thing !== null &&
|
|
102
99
|
'configuration' in thing &&
|
|
103
|
-
// @ts-expect-error
|
|
104
100
|
thing.configuration.displayId);
|
|
105
101
|
}
|
|
106
102
|
function isTrackViewModel(thing) {
|
|
@@ -165,16 +161,11 @@ class RetryError extends Error {
|
|
|
165
161
|
exports.RetryError = RetryError;
|
|
166
162
|
function isAuthNeededException(exception) {
|
|
167
163
|
return (exception instanceof Error &&
|
|
168
|
-
// DOMException
|
|
169
164
|
(exception.name === 'AuthNeededError' ||
|
|
170
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
171
165
|
exception.url !== undefined));
|
|
172
166
|
}
|
|
173
167
|
function isRetryException(exception) {
|
|
174
|
-
return (
|
|
175
|
-
// DOMException
|
|
176
|
-
exception.name === 'RetryError' ||
|
|
177
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
168
|
+
return (exception.name === 'RetryError' ||
|
|
178
169
|
exception.internetAccountId !== undefined);
|
|
179
170
|
}
|
|
180
171
|
var TextSearchManager_1 = require("../../TextSearch/TextSearchManager");
|
package/util/types/mst.js
CHANGED
|
@@ -23,7 +23,6 @@ exports.LocalPathLocation = mobx_state_tree_1.types.model('LocalPathLocation', {
|
|
|
23
23
|
locationType: mobx_state_tree_1.types.literal('LocalPathLocation'),
|
|
24
24
|
localPath: mobx_state_tree_1.types.string,
|
|
25
25
|
});
|
|
26
|
-
// like how blobId is used to get a blob map
|
|
27
26
|
exports.BlobLocation = mobx_state_tree_1.types.model('BlobLocation', {
|
|
28
27
|
locationType: mobx_state_tree_1.types.literal('BlobLocation'),
|
|
29
28
|
name: mobx_state_tree_1.types.string,
|
|
@@ -34,8 +33,6 @@ exports.UriLocationRaw = mobx_state_tree_1.types.model('UriLocation', {
|
|
|
34
33
|
uri: mobx_state_tree_1.types.string,
|
|
35
34
|
baseUri: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
36
35
|
internetAccountId: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.string),
|
|
37
|
-
// auths information (such as tokens) needed for using this resource.
|
|
38
|
-
// if provided, these must be completely sufficient for using it
|
|
39
36
|
internetAccountPreAuthorization: mobx_state_tree_1.types.maybe(mobx_state_tree_1.types.model('InternetAccountPreAuthorization', {
|
|
40
37
|
internetAccountType: mobx_state_tree_1.types.string,
|
|
41
38
|
authInfo: mobx_state_tree_1.types.frozen(),
|
|
@@ -43,7 +40,6 @@ exports.UriLocationRaw = mobx_state_tree_1.types.model('UriLocation', {
|
|
|
43
40
|
});
|
|
44
41
|
exports.UriLocation = mobx_state_tree_1.types.snapshotProcessor(exports.UriLocationRaw, {
|
|
45
42
|
postProcessor: snap => {
|
|
46
|
-
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
47
43
|
const { baseUri, ...rest } = snap;
|
|
48
44
|
if (!baseUri) {
|
|
49
45
|
return rest;
|
|
@@ -52,17 +48,12 @@ exports.UriLocation = mobx_state_tree_1.types.snapshotProcessor(exports.UriLocat
|
|
|
52
48
|
},
|
|
53
49
|
});
|
|
54
50
|
exports.FileLocation = mobx_state_tree_1.types.snapshotProcessor(mobx_state_tree_1.types.union(exports.LocalPathLocation, exports.UriLocation, exports.BlobLocation), {
|
|
55
|
-
// @ts-expect-error
|
|
56
51
|
preProcessor(snap) {
|
|
57
|
-
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
58
52
|
if (!snap) {
|
|
59
53
|
return undefined;
|
|
60
54
|
}
|
|
61
|
-
// @ts-expect-error
|
|
62
|
-
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
63
55
|
const { locationType, ...rest } = snap;
|
|
64
56
|
if (!locationType) {
|
|
65
|
-
// @ts-expect-error
|
|
66
57
|
const { uri, localPath, blob } = rest;
|
|
67
58
|
let locationType = '';
|
|
68
59
|
if (uri !== undefined) {
|
package/util/types/util.d.ts
CHANGED
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PluginManager from '../../PluginManager';
|
|
3
|
-
/**
|
|
4
|
-
* Obtain the return type of a constructor function type.
|
|
5
|
-
* Differs from core Typescript InstanceType in that it returns never if not matched.
|
|
6
|
-
*/
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type PluginManager from '../../PluginManager';
|
|
7
3
|
export type InstanceTypeRestrictive<CONSTRUCTOR extends new (...args: any[]) => any> = CONSTRUCTOR extends new (...args: any[]) => infer CLASS ? CLASS : never;
|
|
8
|
-
/** extracts the class type from a factory function that returns a constructor */
|
|
9
4
|
export type ClassReturnedBy<FACT extends (pm: PluginManager) => any> = InstanceTypeRestrictive<ReturnType<FACT>>;
|
|
10
|
-
/** A react component with any props. Consider using something more specific if possible */
|
|
11
5
|
export type AnyReactComponentType = React.ComponentType<any>;
|
|
12
|
-
/** get the type that a predicate asserts */
|
|
13
6
|
export type TypeTestedByPredicate<PREDICATE extends (thing: any) => boolean> = PREDICATE extends (thing: any) => thing is infer TYPE ? TYPE : never;
|
package/util/useMeasure.js
CHANGED
package/util/when.d.ts
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
interface WhenOpts extends IWhenOptions {
|
|
3
|
-
signal?: AbortSignal;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Wrapper for mobx `when` that adds timeout and aborting support.
|
|
7
|
-
*/
|
|
8
|
-
export declare function when(getter: () => boolean, { timeout, signal, name }?: WhenOpts): Promise<unknown>;
|
|
9
|
-
/**
|
|
10
|
-
* Wrapper for mobx `when` that makes a promise for the return value
|
|
11
|
-
* of the given function at the point in time when it becomes not
|
|
12
|
-
* undefined and not null.
|
|
13
|
-
*/
|
|
14
|
-
export declare function whenPresent<FUNCTION extends () => unknown>(getter: FUNCTION, opts?: WhenOpts): Promise<NonNullable<ReturnType<FUNCTION>>>;
|
|
15
|
-
export {};
|
|
1
|
+
export { when } from 'mobx';
|
package/util/when.js
CHANGED
|
@@ -1,72 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.when =
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const aborting_1 = require("./aborting");
|
|
7
|
-
/**
|
|
8
|
-
* Wrapper for mobx `when` that adds timeout and aborting support.
|
|
9
|
-
*/
|
|
10
|
-
function when(getter, { timeout, signal, name } = {}) {
|
|
11
|
-
return new Promise((resolve, reject) => {
|
|
12
|
-
let finished = false;
|
|
13
|
-
const whenPromise = (0, mobx_1.when)(getter);
|
|
14
|
-
// set up timeout
|
|
15
|
-
let timeoutId;
|
|
16
|
-
let finishTimeout = () => { };
|
|
17
|
-
if (timeout) {
|
|
18
|
-
timeoutId = setTimeout(() => {
|
|
19
|
-
if (!finished) {
|
|
20
|
-
finished = true;
|
|
21
|
-
whenPromise.cancel();
|
|
22
|
-
reject(new Error(`timed out waiting for ${name || 'whenPresent'}`));
|
|
23
|
-
}
|
|
24
|
-
}, timeout);
|
|
25
|
-
finishTimeout = () => {
|
|
26
|
-
if (timeoutId) {
|
|
27
|
-
clearTimeout(timeoutId);
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
// set up aborting
|
|
32
|
-
if (signal) {
|
|
33
|
-
signal.addEventListener('abort', () => {
|
|
34
|
-
if (!finished) {
|
|
35
|
-
finished = true;
|
|
36
|
-
// mobx when supports a cancel method
|
|
37
|
-
whenPromise.cancel();
|
|
38
|
-
finishTimeout();
|
|
39
|
-
reject((0, aborting_1.makeAbortError)());
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
whenPromise
|
|
44
|
-
.then(() => {
|
|
45
|
-
if (!finished) {
|
|
46
|
-
finished = true;
|
|
47
|
-
finishTimeout();
|
|
48
|
-
resolve(true);
|
|
49
|
-
}
|
|
50
|
-
})
|
|
51
|
-
.catch((err) => {
|
|
52
|
-
if (!finished) {
|
|
53
|
-
finished = true;
|
|
54
|
-
finishTimeout();
|
|
55
|
-
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
56
|
-
reject(err);
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Wrapper for mobx `when` that makes a promise for the return value
|
|
63
|
-
* of the given function at the point in time when it becomes not
|
|
64
|
-
* undefined and not null.
|
|
65
|
-
*/
|
|
66
|
-
async function whenPresent(getter, opts = {}) {
|
|
67
|
-
await when(() => {
|
|
68
|
-
const val = getter();
|
|
69
|
-
return val !== undefined && val !== null;
|
|
70
|
-
}, opts);
|
|
71
|
-
return getter();
|
|
72
|
-
}
|
|
3
|
+
exports.when = void 0;
|
|
4
|
+
var mobx_1 = require("mobx");
|
|
5
|
+
Object.defineProperty(exports, "when", { enumerable: true, get: function () { return mobx_1.when; } });
|