@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/index.js
CHANGED
|
@@ -17,7 +17,7 @@ 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.blobToDataURL = exports.isFeature = exports.SimpleFeature = exports.defaultCodonTable = exports.defaultStops = exports.defaultStarts = exports.rIC = exports.
|
|
20
|
+
exports.makeAbortableReaction = exports.blobToDataURL = exports.isFeature = exports.SimpleFeature = exports.defaultCodonTable = exports.defaultStops = exports.defaultStarts = exports.rIC = exports.complementTable = exports.isElectron = void 0;
|
|
21
21
|
exports.useDebounce = useDebounce;
|
|
22
22
|
exports.useWidthSetter = useWidthSetter;
|
|
23
23
|
exports.useDebouncedCallback = useDebouncedCallback;
|
|
@@ -45,7 +45,6 @@ exports.bpSpanPx = bpSpanPx;
|
|
|
45
45
|
exports.iterMap = iterMap;
|
|
46
46
|
exports.findLastIndex = findLastIndex;
|
|
47
47
|
exports.findLast = findLast;
|
|
48
|
-
exports.makeAbortableReaction = makeAbortableReaction;
|
|
49
48
|
exports.renameRegionIfNeeded = renameRegionIfNeeded;
|
|
50
49
|
exports.renameRegionsIfNeeded = renameRegionsIfNeeded;
|
|
51
50
|
exports.minmax = minmax;
|
|
@@ -53,10 +52,12 @@ exports.shorten = shorten;
|
|
|
53
52
|
exports.stringify = stringify;
|
|
54
53
|
exports.revcom = revcom;
|
|
55
54
|
exports.reverse = reverse;
|
|
55
|
+
exports.complement = complement;
|
|
56
56
|
exports.measureText = measureText;
|
|
57
57
|
exports.getFrame = getFrame;
|
|
58
58
|
exports.generateCodonTable = generateCodonTable;
|
|
59
59
|
exports.updateStatus = updateStatus;
|
|
60
|
+
exports.updateStatus2 = updateStatus2;
|
|
60
61
|
exports.hashCode = hashCode;
|
|
61
62
|
exports.objectHash = objectHash;
|
|
62
63
|
exports.bytesForRegions = bytesForRegions;
|
|
@@ -88,20 +89,17 @@ exports.getStrokeProps = getStrokeProps;
|
|
|
88
89
|
exports.getFillProps = getFillProps;
|
|
89
90
|
exports.renderToStaticMarkup = renderToStaticMarkup;
|
|
90
91
|
exports.isGzip = isGzip;
|
|
92
|
+
exports.fetchAndMaybeUnzip = fetchAndMaybeUnzip;
|
|
91
93
|
const react_1 = require("react");
|
|
94
|
+
const bgzf_filehandle_1 = require("@gmod/bgzf-filehandle");
|
|
95
|
+
const useMeasure_1 = __importDefault(require("@jbrowse/core/util/useMeasure"));
|
|
92
96
|
const is_object_1 = __importDefault(require("is-object"));
|
|
93
97
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
94
|
-
const mobx_1 = require("mobx");
|
|
95
|
-
const types_1 = require("./types");
|
|
96
|
-
const aborting_1 = require("./aborting");
|
|
97
|
-
const types_2 = require("./types");
|
|
98
|
-
// has to be the full path and not the relative path to get the jest mock
|
|
99
|
-
const useMeasure_1 = __importDefault(require("@jbrowse/core/util/useMeasure"));
|
|
100
|
-
const colord_1 = require("./colord");
|
|
101
|
-
// eslint-disable-next-line react/no-deprecated
|
|
102
98
|
const react_dom_1 = require("react-dom");
|
|
99
|
+
const colord_1 = require("./colord");
|
|
100
|
+
const stopToken_1 = require("./stopToken");
|
|
101
|
+
const types_1 = require("./types");
|
|
103
102
|
__exportStar(require("./types"), exports);
|
|
104
|
-
__exportStar(require("./aborting"), exports);
|
|
105
103
|
__exportStar(require("./when"), exports);
|
|
106
104
|
__exportStar(require("./range"), exports);
|
|
107
105
|
__exportStar(require("./dedupe"), exports);
|
|
@@ -119,14 +117,10 @@ function useDebounce(value, delay) {
|
|
|
119
117
|
}, [value, delay]);
|
|
120
118
|
return debouncedValue;
|
|
121
119
|
}
|
|
122
|
-
// used in ViewContainer files to get the width
|
|
123
120
|
function useWidthSetter(view, padding) {
|
|
124
121
|
const [ref, { width }] = (0, useMeasure_1.default)();
|
|
125
122
|
(0, react_1.useEffect)(() => {
|
|
126
123
|
if (width && (0, mobx_state_tree_1.isAlive)(view)) {
|
|
127
|
-
// sets after a requestAnimationFrame
|
|
128
|
-
// https://stackoverflow.com/a/58701523/2129219
|
|
129
|
-
// avoids ResizeObserver loop error being shown during development
|
|
130
124
|
requestAnimationFrame(() => {
|
|
131
125
|
view.setWidth(width - Number.parseInt(padding, 10) * 2);
|
|
132
126
|
});
|
|
@@ -134,26 +128,19 @@ function useWidthSetter(view, padding) {
|
|
|
134
128
|
}, [padding, view, width]);
|
|
135
129
|
return ref;
|
|
136
130
|
}
|
|
137
|
-
// https://stackoverflow.com/questions/56283920/
|
|
138
131
|
function useDebouncedCallback(callback, wait = 400) {
|
|
139
|
-
// track args & timeout handle between calls
|
|
140
132
|
const argsRef = (0, react_1.useRef)();
|
|
141
133
|
const timeout = (0, react_1.useRef)();
|
|
142
|
-
// make sure our timeout gets cleared if our consuming component gets
|
|
143
|
-
// unmounted
|
|
144
134
|
(0, react_1.useEffect)(() => {
|
|
145
135
|
if (timeout.current) {
|
|
146
136
|
clearTimeout(timeout.current);
|
|
147
137
|
}
|
|
148
138
|
}, []);
|
|
149
139
|
return function debouncedCallback(...args) {
|
|
150
|
-
// capture latest args
|
|
151
140
|
argsRef.current = args;
|
|
152
|
-
// clear debounce timer
|
|
153
141
|
if (timeout.current) {
|
|
154
142
|
clearTimeout(timeout.current);
|
|
155
143
|
}
|
|
156
|
-
// start waiting again
|
|
157
144
|
timeout.current = setTimeout(() => {
|
|
158
145
|
if (argsRef.current) {
|
|
159
146
|
callback(...argsRef.current);
|
|
@@ -161,9 +148,6 @@ function useDebouncedCallback(callback, wait = 400) {
|
|
|
161
148
|
}, wait);
|
|
162
149
|
};
|
|
163
150
|
}
|
|
164
|
-
/**
|
|
165
|
-
* find the first node in the hierarchy that matches the given predicate
|
|
166
|
-
*/
|
|
167
151
|
function findParentThat(node, predicate) {
|
|
168
152
|
if (!(0, mobx_state_tree_1.hasParent)(node)) {
|
|
169
153
|
throw new Error('node does not have parent');
|
|
@@ -182,7 +166,6 @@ function findParentThat(node, predicate) {
|
|
|
182
166
|
}
|
|
183
167
|
throw new Error('no matching node found');
|
|
184
168
|
}
|
|
185
|
-
// based on https://github.com/react-spring/react-spring/blob/cd5548a987383b8023efd620f3726a981f9e18ea/src/animated/FrameLoop.ts
|
|
186
169
|
function springAnimate(fromValue, toValue, setValue, onFinish = () => { }, precision = 0, tension = 400, friction = 20, clamp = true) {
|
|
187
170
|
const mass = 1;
|
|
188
171
|
if (!precision) {
|
|
@@ -194,11 +177,9 @@ function springAnimate(fromValue, toValue, setValue, onFinish = () => { }, preci
|
|
|
194
177
|
let position = animation.lastPosition;
|
|
195
178
|
let lastTime = animation.lastTime || time;
|
|
196
179
|
let velocity = animation.lastVelocity || 0;
|
|
197
|
-
// If we lost a lot of frames just jump to the end.
|
|
198
180
|
if (time > lastTime + 64) {
|
|
199
181
|
lastTime = time;
|
|
200
182
|
}
|
|
201
|
-
// http://gafferongames.com/game-physics/fix-your-timestep/
|
|
202
183
|
const numSteps = Math.floor(time - lastTime);
|
|
203
184
|
for (let i = 0; i < numSteps; ++i) {
|
|
204
185
|
const force = -tension * (position - toValue);
|
|
@@ -239,17 +220,9 @@ function springAnimate(fromValue, toValue, setValue, onFinish = () => { }, preci
|
|
|
239
220
|
},
|
|
240
221
|
];
|
|
241
222
|
}
|
|
242
|
-
/**
|
|
243
|
-
* find the first node in the hierarchy that matches the given 'is' typescript
|
|
244
|
-
* type guard predicate
|
|
245
|
-
*/
|
|
246
223
|
function findParentThatIs(node, predicate) {
|
|
247
224
|
return findParentThat(node, predicate);
|
|
248
225
|
}
|
|
249
|
-
/**
|
|
250
|
-
* get the current JBrowse session model, starting at any node in the state
|
|
251
|
-
* tree
|
|
252
|
-
*/
|
|
253
226
|
function getSession(node) {
|
|
254
227
|
try {
|
|
255
228
|
return findParentThatIs(node, types_1.isSessionModel);
|
|
@@ -258,10 +231,6 @@ function getSession(node) {
|
|
|
258
231
|
throw new Error('no session model found!');
|
|
259
232
|
}
|
|
260
233
|
}
|
|
261
|
-
/**
|
|
262
|
-
* get the state model of the view in the state tree that contains the given
|
|
263
|
-
* node
|
|
264
|
-
*/
|
|
265
234
|
function getContainingView(node) {
|
|
266
235
|
try {
|
|
267
236
|
return findParentThatIs(node, types_1.isViewModel);
|
|
@@ -270,10 +239,6 @@ function getContainingView(node) {
|
|
|
270
239
|
throw new Error('no containing view found');
|
|
271
240
|
}
|
|
272
241
|
}
|
|
273
|
-
/**
|
|
274
|
-
* get the state model of the view in the state tree that contains the given
|
|
275
|
-
* node
|
|
276
|
-
*/
|
|
277
242
|
function getContainingTrack(node) {
|
|
278
243
|
try {
|
|
279
244
|
return findParentThatIs(node, types_1.isTrackModel);
|
|
@@ -282,10 +247,6 @@ function getContainingTrack(node) {
|
|
|
282
247
|
throw new Error('no containing track found');
|
|
283
248
|
}
|
|
284
249
|
}
|
|
285
|
-
/**
|
|
286
|
-
* get the state model of the display in the state tree that contains the given
|
|
287
|
-
* node
|
|
288
|
-
*/
|
|
289
250
|
function getContainingDisplay(node) {
|
|
290
251
|
try {
|
|
291
252
|
return findParentThatIs(node, types_1.isDisplayModel);
|
|
@@ -294,46 +255,9 @@ function getContainingDisplay(node) {
|
|
|
294
255
|
throw new Error('no containing display found');
|
|
295
256
|
}
|
|
296
257
|
}
|
|
297
|
-
/**
|
|
298
|
-
* Assemble a 1-based "locString" from an interbase genomic location
|
|
299
|
-
* @param region - Region
|
|
300
|
-
* @example
|
|
301
|
-
* ```ts
|
|
302
|
-
* assembleLocString({ refName: 'chr1', start: 0, end: 100 })
|
|
303
|
-
* // ↳ 'chr1:1..100'
|
|
304
|
-
* ```
|
|
305
|
-
* @example
|
|
306
|
-
* ```ts
|
|
307
|
-
* assembleLocString({ assemblyName: 'hg19', refName: 'chr1', start: 0, end: 100 })
|
|
308
|
-
* // ↳ '{hg19}chr1:1..100'
|
|
309
|
-
* ```
|
|
310
|
-
* @example
|
|
311
|
-
* ```ts
|
|
312
|
-
* assembleLocString({ refName: 'chr1' })
|
|
313
|
-
* // ↳ 'chr1'
|
|
314
|
-
* ```
|
|
315
|
-
* @example
|
|
316
|
-
* ```ts
|
|
317
|
-
* assembleLocString({ refName: 'chr1', start: 0 })
|
|
318
|
-
* // ↳ 'chr1:1..'
|
|
319
|
-
* ```
|
|
320
|
-
* @example
|
|
321
|
-
* ```ts
|
|
322
|
-
* assembleLocString({ refName: 'chr1', end: 100 })
|
|
323
|
-
* // ↳ 'chr1:1..100'
|
|
324
|
-
* ```
|
|
325
|
-
* @example
|
|
326
|
-
* ```ts
|
|
327
|
-
* assembleLocString({ refName: 'chr1', start: 0, end: 1 })
|
|
328
|
-
* // ↳ 'chr1:1'
|
|
329
|
-
* ```
|
|
330
|
-
*/
|
|
331
258
|
function assembleLocString(region) {
|
|
332
259
|
return assembleLocStringFast(region, toLocale);
|
|
333
260
|
}
|
|
334
|
-
// same as assembleLocString above, but does not perform toLocaleString which
|
|
335
|
-
// can slow down the speed of block calculations which use assembleLocString
|
|
336
|
-
// for block.key
|
|
337
261
|
function assembleLocStringFast(region, cb = (n) => n) {
|
|
338
262
|
const { assemblyName, refName, start, end, reversed } = region;
|
|
339
263
|
const assemblyNameString = assemblyName ? `{${assemblyName}}` : '';
|
|
@@ -369,10 +293,7 @@ function parseLocStringOneBased(locString, isValidRefName) {
|
|
|
369
293
|
reversed = true;
|
|
370
294
|
locString = locString.replace(/\[rev]$/, '');
|
|
371
295
|
}
|
|
372
|
-
// remove any whitespace
|
|
373
296
|
locString = locString.replace(/\s/, '');
|
|
374
|
-
// refNames can have colons, refer to
|
|
375
|
-
// https://samtools.github.io/hts-specs/SAMv1.pdf Appendix A
|
|
376
297
|
const assemblyMatch = /({(.+)})?(.+)/.exec(locString);
|
|
377
298
|
if (!assemblyMatch) {
|
|
378
299
|
throw new Error(`invalid location string: "${locString}"`);
|
|
@@ -402,9 +323,7 @@ function parseLocStringOneBased(locString, isValidRefName) {
|
|
|
402
323
|
}
|
|
403
324
|
else if (isValidRefName(prefix, assemblyName)) {
|
|
404
325
|
if (suffix) {
|
|
405
|
-
// see if it's a range
|
|
406
326
|
const rangeMatch = /^(-?(\d+|\d{1,3}(,\d{3})*))(\.\.|-)(-?(\d+|\d{1,3}(,\d{3})*))$/.exec(suffix);
|
|
407
|
-
// see if it's a single point
|
|
408
327
|
const singleMatch = /^(-?(\d+|\d{1,3}(,\d{3})*))(\.\.|-)?$/.exec(suffix);
|
|
409
328
|
if (rangeMatch) {
|
|
410
329
|
const [, start, , , , end] = rangeMatch;
|
|
@@ -422,7 +341,6 @@ function parseLocStringOneBased(locString, isValidRefName) {
|
|
|
422
341
|
const [, start, , , separator] = singleMatch;
|
|
423
342
|
if (start !== undefined) {
|
|
424
343
|
if (separator) {
|
|
425
|
-
// indefinite end
|
|
426
344
|
return {
|
|
427
345
|
assemblyName,
|
|
428
346
|
refName: prefix,
|
|
@@ -460,43 +378,6 @@ function parseLocStringOneBased(locString, isValidRefName) {
|
|
|
460
378
|
}
|
|
461
379
|
throw new Error(`unknown reference sequence name in location "${locString}"`);
|
|
462
380
|
}
|
|
463
|
-
/**
|
|
464
|
-
* Parse a 1-based location string into an interbase genomic location
|
|
465
|
-
* @param locString - Location string
|
|
466
|
-
* @param isValidRefName - Function that checks if a refName exists in the set
|
|
467
|
-
* of all known refNames, or in the set of refNames for an assembly if
|
|
468
|
-
* assemblyName is given
|
|
469
|
-
* @example
|
|
470
|
-
* ```ts
|
|
471
|
-
* parseLocString('chr1:1..100', isValidRefName)
|
|
472
|
-
* // ↳ { refName: 'chr1', start: 0, end: 100 }
|
|
473
|
-
* ```
|
|
474
|
-
* @example
|
|
475
|
-
* ```ts
|
|
476
|
-
* parseLocString('chr1:1-100', isValidRefName)
|
|
477
|
-
* // ↳ { refName: 'chr1', start: 0, end: 100 }
|
|
478
|
-
* ```
|
|
479
|
-
* @example
|
|
480
|
-
* ```ts
|
|
481
|
-
* parseLocString(`{hg19}chr1:1..100`, isValidRefName)
|
|
482
|
-
* // ↳ { assemblyName: 'hg19', refName: 'chr1', start: 0, end: 100 }
|
|
483
|
-
* ```
|
|
484
|
-
* @example
|
|
485
|
-
* ```ts
|
|
486
|
-
* parseLocString('chr1', isValidRefName)
|
|
487
|
-
* // ↳ { refName: 'chr1' }
|
|
488
|
-
* ```
|
|
489
|
-
* @example
|
|
490
|
-
* ```ts
|
|
491
|
-
* parseLocString('chr1:1', isValidRefName)
|
|
492
|
-
* // ↳ { refName: 'chr1', start: 0, end: 1 }
|
|
493
|
-
* ```
|
|
494
|
-
* @example
|
|
495
|
-
* ```ts
|
|
496
|
-
* parseLocString('chr1:1..', isValidRefName)
|
|
497
|
-
* // ↳ { refName: 'chr1', start: 0}
|
|
498
|
-
* ```
|
|
499
|
-
*/
|
|
500
381
|
function parseLocString(locString, isValidRefName) {
|
|
501
382
|
const parsed = parseLocStringOneBased(locString, isValidRefName);
|
|
502
383
|
if (typeof parsed.start === 'number') {
|
|
@@ -536,13 +417,6 @@ function compareLocStrings(a, b, isValidRefName) {
|
|
|
536
417
|
const locB = parseLocString(b, isValidRefName);
|
|
537
418
|
return compareLocs(locA, locB);
|
|
538
419
|
}
|
|
539
|
-
/**
|
|
540
|
-
* Ensure that a number is at least min and at most max.
|
|
541
|
-
*
|
|
542
|
-
* @param num -
|
|
543
|
-
* @param min -
|
|
544
|
-
* @param max -
|
|
545
|
-
*/
|
|
546
420
|
function clamp(num, min, max) {
|
|
547
421
|
if (num < min) {
|
|
548
422
|
return min;
|
|
@@ -555,11 +429,6 @@ function clamp(num, min, max) {
|
|
|
555
429
|
function roundToNearestPointOne(num) {
|
|
556
430
|
return Math.round(num * 10) / 10;
|
|
557
431
|
}
|
|
558
|
-
/**
|
|
559
|
-
* @param bp -
|
|
560
|
-
* @param region -
|
|
561
|
-
* @param bpPerPx -
|
|
562
|
-
*/
|
|
563
432
|
function bpToPx(bp, { reversed, end = 0, start = 0, }, bpPerPx) {
|
|
564
433
|
return roundToNearestPointOne((reversed ? end - bp : bp - start) / bpPerPx);
|
|
565
434
|
}
|
|
@@ -571,17 +440,9 @@ function radToDeg(radians) {
|
|
|
571
440
|
function degToRad(degrees) {
|
|
572
441
|
return (degrees * piOverOneEighty) % (2 * Math.PI);
|
|
573
442
|
}
|
|
574
|
-
/**
|
|
575
|
-
* @returns [x, y]
|
|
576
|
-
*/
|
|
577
443
|
function polarToCartesian(rho, theta) {
|
|
578
444
|
return [rho * Math.cos(theta), rho * Math.sin(theta)];
|
|
579
445
|
}
|
|
580
|
-
/**
|
|
581
|
-
* @param x - the x
|
|
582
|
-
* @param y - the y
|
|
583
|
-
* @returns [rho, theta]
|
|
584
|
-
*/
|
|
585
446
|
function cartesianToPolar(x, y) {
|
|
586
447
|
const rho = Math.sqrt(x * x + y * y);
|
|
587
448
|
const theta = Math.atan(y / x);
|
|
@@ -595,7 +456,6 @@ function bpSpanPx(leftBp, rightBp, region, bpPerPx) {
|
|
|
595
456
|
const end = bpToPx(rightBp, region, bpPerPx);
|
|
596
457
|
return region.reversed ? [end, start] : [start, end];
|
|
597
458
|
}
|
|
598
|
-
// do an array map of an iterable
|
|
599
459
|
function iterMap(iter, func, sizeHint) {
|
|
600
460
|
const results = Array.from({ length: sizeHint || 0 });
|
|
601
461
|
let counter = 0;
|
|
@@ -605,19 +465,6 @@ function iterMap(iter, func, sizeHint) {
|
|
|
605
465
|
}
|
|
606
466
|
return results;
|
|
607
467
|
}
|
|
608
|
-
/**
|
|
609
|
-
* Returns the index of the last element in the array where predicate is true,
|
|
610
|
-
* and -1 otherwise.
|
|
611
|
-
* Based on https://stackoverflow.com/a/53187807
|
|
612
|
-
*
|
|
613
|
-
* @param array - The source array to search in
|
|
614
|
-
*
|
|
615
|
-
* @param predicate - find calls predicate once for each element of the array, in
|
|
616
|
-
* descending order, until it finds one where predicate returns true.
|
|
617
|
-
*
|
|
618
|
-
* @returns findLastIndex returns element index where predicate is true.
|
|
619
|
-
* Otherwise, findLastIndex returns -1.
|
|
620
|
-
*/
|
|
621
468
|
function findLastIndex(array, predicate) {
|
|
622
469
|
let l = array.length;
|
|
623
470
|
while (l--) {
|
|
@@ -636,87 +483,14 @@ function findLast(array, predicate) {
|
|
|
636
483
|
}
|
|
637
484
|
return undefined;
|
|
638
485
|
}
|
|
639
|
-
/**
|
|
640
|
-
* makes a mobx reaction with the given functions, that calls actions on the
|
|
641
|
-
* model for each stage of execution, and to abort the reaction function when
|
|
642
|
-
* the model is destroyed.
|
|
643
|
-
*
|
|
644
|
-
* Will call startedFunction(signal), successFunction(result), and
|
|
645
|
-
* errorFunction(error) when the async reaction function starts, completes, and
|
|
646
|
-
* errors respectively.
|
|
647
|
-
*
|
|
648
|
-
* @param self -
|
|
649
|
-
* @param dataFunction -
|
|
650
|
-
* @param asyncReactionFunction -
|
|
651
|
-
* @param reactionOptions -
|
|
652
|
-
* @param startedFunction -
|
|
653
|
-
* @param successFunction -
|
|
654
|
-
* @param errorFunction -
|
|
655
|
-
*/
|
|
656
|
-
function makeAbortableReaction(self, dataFunction, asyncReactionFunction,
|
|
657
|
-
// @ts-expect-error
|
|
658
|
-
reactionOptions, startedFunction, successFunction, errorFunction) {
|
|
659
|
-
let inProgress;
|
|
660
|
-
function handleError(error) {
|
|
661
|
-
if (!(0, aborting_1.isAbortException)(error)) {
|
|
662
|
-
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
663
|
-
errorFunction(error);
|
|
664
|
-
}
|
|
665
|
-
else {
|
|
666
|
-
console.error(error);
|
|
667
|
-
}
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
(0, mobx_state_tree_1.addDisposer)(self, (0, mobx_1.reaction)(() => {
|
|
671
|
-
try {
|
|
672
|
-
return dataFunction(self);
|
|
673
|
-
}
|
|
674
|
-
catch (e) {
|
|
675
|
-
handleError(e);
|
|
676
|
-
return undefined;
|
|
677
|
-
}
|
|
678
|
-
}, async (data, mobxReactionHandle) => {
|
|
679
|
-
if (inProgress && !inProgress.signal.aborted) {
|
|
680
|
-
inProgress.abort();
|
|
681
|
-
}
|
|
682
|
-
if (!(0, mobx_state_tree_1.isAlive)(self)) {
|
|
683
|
-
return;
|
|
684
|
-
}
|
|
685
|
-
inProgress = new AbortController();
|
|
686
|
-
const thisInProgress = inProgress;
|
|
687
|
-
startedFunction(thisInProgress);
|
|
688
|
-
try {
|
|
689
|
-
const result = await asyncReactionFunction(data, thisInProgress.signal, self,
|
|
690
|
-
// @ts-expect-error
|
|
691
|
-
mobxReactionHandle);
|
|
692
|
-
(0, aborting_1.checkAbortSignal)(thisInProgress.signal);
|
|
693
|
-
if ((0, mobx_state_tree_1.isAlive)(self)) {
|
|
694
|
-
successFunction(result);
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
catch (e) {
|
|
698
|
-
if (!thisInProgress.signal.aborted) {
|
|
699
|
-
thisInProgress.abort();
|
|
700
|
-
}
|
|
701
|
-
handleError(e);
|
|
702
|
-
}
|
|
703
|
-
}, reactionOptions));
|
|
704
|
-
(0, mobx_state_tree_1.addDisposer)(self, () => {
|
|
705
|
-
if (inProgress && !inProgress.signal.aborted) {
|
|
706
|
-
inProgress.abort();
|
|
707
|
-
}
|
|
708
|
-
});
|
|
709
|
-
}
|
|
710
486
|
function renameRegionIfNeeded(refNameMap, region) {
|
|
711
487
|
if ((0, mobx_state_tree_1.isStateTreeNode)(region) && !(0, mobx_state_tree_1.isAlive)(region)) {
|
|
712
488
|
return region;
|
|
713
489
|
}
|
|
714
490
|
if (refNameMap === null || refNameMap === void 0 ? void 0 : refNameMap[region.refName]) {
|
|
715
|
-
// clone the region so we don't modify it
|
|
716
491
|
region = (0, mobx_state_tree_1.isStateTreeNode)(region)
|
|
717
492
|
? { ...(0, mobx_state_tree_1.getSnapshot)(region) }
|
|
718
493
|
: { ...region };
|
|
719
|
-
// modify it directly in the container
|
|
720
494
|
const newRef = refNameMap[region.refName];
|
|
721
495
|
if (newRef) {
|
|
722
496
|
return { ...region, refName: newRef, originalRefName: region.refName };
|
|
@@ -738,9 +512,7 @@ async function renameRegionsIfNeeded(assemblyManager, args) {
|
|
|
738
512
|
})));
|
|
739
513
|
return {
|
|
740
514
|
...args,
|
|
741
|
-
regions: regions.map((region, i) =>
|
|
742
|
-
// note: uses assemblyNames defined above since region could be dead now
|
|
743
|
-
renameRegionIfNeeded(assemblyMaps[assemblyNames[i]], region)),
|
|
515
|
+
regions: regions.map((region, i) => renameRegionIfNeeded(assemblyMaps[assemblyNames[i]], region)),
|
|
744
516
|
};
|
|
745
517
|
}
|
|
746
518
|
function minmax(a, b) {
|
|
@@ -759,67 +531,66 @@ function stringify({ refName, coord, assemblyName, oob, }, useAssemblyName) {
|
|
|
759
531
|
: '',
|
|
760
532
|
].join('');
|
|
761
533
|
}
|
|
762
|
-
// this is recommended in a later comment in
|
|
763
|
-
// https://github.com/electron/electron/issues/2288 for detecting electron in a
|
|
764
|
-
// renderer process, which is the one that has node enabled for us
|
|
765
|
-
//
|
|
766
|
-
// const isElectron = process.versions.electron
|
|
767
|
-
// const i2 = process.versions.hasOwnProperty('electron')
|
|
768
534
|
exports.isElectron = /electron/i.test(typeof navigator !== 'undefined' ? navigator.userAgent : '');
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
}
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
535
|
+
exports.complementTable = {
|
|
536
|
+
S: 'S',
|
|
537
|
+
w: 'w',
|
|
538
|
+
T: 'A',
|
|
539
|
+
r: 'y',
|
|
540
|
+
a: 't',
|
|
541
|
+
N: 'N',
|
|
542
|
+
K: 'M',
|
|
543
|
+
x: 'x',
|
|
544
|
+
d: 'h',
|
|
545
|
+
Y: 'R',
|
|
546
|
+
V: 'B',
|
|
547
|
+
y: 'r',
|
|
548
|
+
M: 'K',
|
|
549
|
+
h: 'd',
|
|
550
|
+
k: 'm',
|
|
551
|
+
C: 'G',
|
|
552
|
+
g: 'c',
|
|
553
|
+
t: 'a',
|
|
554
|
+
A: 'T',
|
|
555
|
+
n: 'n',
|
|
556
|
+
W: 'W',
|
|
557
|
+
X: 'X',
|
|
558
|
+
m: 'k',
|
|
559
|
+
v: 'b',
|
|
560
|
+
B: 'V',
|
|
561
|
+
s: 's',
|
|
562
|
+
H: 'D',
|
|
563
|
+
c: 'g',
|
|
564
|
+
D: 'H',
|
|
565
|
+
b: 'v',
|
|
566
|
+
R: 'Y',
|
|
567
|
+
G: 'C',
|
|
568
|
+
};
|
|
569
|
+
function revcom(str) {
|
|
570
|
+
var _a;
|
|
571
|
+
let revcomped = '';
|
|
572
|
+
for (let i = str.length - 1; i >= 0; i--) {
|
|
573
|
+
revcomped += (_a = exports.complementTable[str[i]]) !== null && _a !== void 0 ? _a : str[i];
|
|
574
|
+
}
|
|
575
|
+
return revcomped;
|
|
576
|
+
}
|
|
577
|
+
function reverse(str) {
|
|
578
|
+
let reversed = '';
|
|
579
|
+
for (let i = str.length - 1; i >= 0; i--) {
|
|
580
|
+
reversed += str[i];
|
|
581
|
+
}
|
|
582
|
+
return reversed;
|
|
583
|
+
}
|
|
584
|
+
function complement(str) {
|
|
585
|
+
var _a;
|
|
586
|
+
let comp = '';
|
|
587
|
+
for (let i = 0; i < str.length; i++) {
|
|
588
|
+
comp += (_a = exports.complementTable[str[i]]) !== null && _a !== void 0 ? _a : str[i];
|
|
589
|
+
}
|
|
590
|
+
return comp;
|
|
591
|
+
}
|
|
821
592
|
exports.rIC = typeof jest === 'undefined'
|
|
822
|
-
?
|
|
593
|
+
?
|
|
823
594
|
typeof window !== 'undefined' && window.requestIdleCallback
|
|
824
595
|
? window.requestIdleCallback
|
|
825
596
|
: (cb) => setTimeout(() => {
|
|
@@ -828,9 +599,7 @@ exports.rIC = typeof jest === 'undefined'
|
|
|
828
599
|
: (cb) => {
|
|
829
600
|
cb();
|
|
830
601
|
};
|
|
831
|
-
// prettier-ignore
|
|
832
602
|
const widths = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.2796875, 0.2765625, 0.3546875, 0.5546875, 0.5546875, 0.8890625, 0.665625, 0.190625, 0.3328125, 0.3328125, 0.3890625, 0.5828125, 0.2765625, 0.3328125, 0.2765625, 0.3015625, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.2765625, 0.2765625, 0.584375, 0.5828125, 0.584375, 0.5546875, 1.0140625, 0.665625, 0.665625, 0.721875, 0.721875, 0.665625, 0.609375, 0.7765625, 0.721875, 0.2765625, 0.5, 0.665625, 0.5546875, 0.8328125, 0.721875, 0.7765625, 0.665625, 0.7765625, 0.721875, 0.665625, 0.609375, 0.721875, 0.665625, 0.94375, 0.665625, 0.665625, 0.609375, 0.2765625, 0.3546875, 0.2765625, 0.4765625, 0.5546875, 0.3328125, 0.5546875, 0.5546875, 0.5, 0.5546875, 0.5546875, 0.2765625, 0.5546875, 0.5546875, 0.221875, 0.240625, 0.5, 0.221875, 0.8328125, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.3328125, 0.5, 0.2765625, 0.5546875, 0.5, 0.721875, 0.5, 0.5, 0.5, 0.3546875, 0.259375, 0.353125, 0.5890625];
|
|
833
|
-
// xref https://gist.github.com/tophtucker/62f93a4658387bb61e4510c37e2e97cf
|
|
834
603
|
function measureText(str, fontSize = 10) {
|
|
835
604
|
var _a;
|
|
836
605
|
const avg = 0.5279276315789471;
|
|
@@ -915,10 +684,6 @@ exports.defaultCodonTable = {
|
|
|
915
684
|
GGG: 'G',
|
|
916
685
|
GGT: 'G',
|
|
917
686
|
};
|
|
918
|
-
/**
|
|
919
|
-
* take CodonTable above and generate larger codon table that includes all
|
|
920
|
-
* permutations of upper and lower case nucleotides
|
|
921
|
-
*/
|
|
922
687
|
function generateCodonTable(table) {
|
|
923
688
|
const tempCodonTable = {};
|
|
924
689
|
Object.keys(table).forEach(codon => {
|
|
@@ -944,13 +709,19 @@ function generateCodonTable(table) {
|
|
|
944
709
|
});
|
|
945
710
|
return tempCodonTable;
|
|
946
711
|
}
|
|
947
|
-
// call statusCallback with current status and clear when finished
|
|
948
712
|
async function updateStatus(msg, cb, fn) {
|
|
949
713
|
cb(msg);
|
|
950
714
|
const res = await fn();
|
|
951
715
|
cb('');
|
|
952
716
|
return res;
|
|
953
717
|
}
|
|
718
|
+
async function updateStatus2(msg, cb, stopToken, fn) {
|
|
719
|
+
cb(msg);
|
|
720
|
+
const res = await fn();
|
|
721
|
+
(0, stopToken_1.checkStopToken)(stopToken);
|
|
722
|
+
cb('');
|
|
723
|
+
return res;
|
|
724
|
+
}
|
|
954
725
|
function hashCode(str) {
|
|
955
726
|
let hash = 0;
|
|
956
727
|
if (str.length === 0) {
|
|
@@ -959,7 +730,7 @@ function hashCode(str) {
|
|
|
959
730
|
for (let i = 0; i < str.length; i++) {
|
|
960
731
|
const chr = str.charCodeAt(i);
|
|
961
732
|
hash = (hash << 5) - hash + chr;
|
|
962
|
-
hash |= 0;
|
|
733
|
+
hash |= 0;
|
|
963
734
|
}
|
|
964
735
|
return hash;
|
|
965
736
|
}
|
|
@@ -976,8 +747,6 @@ async function bytesForRegions(regions, index) {
|
|
|
976
747
|
}))
|
|
977
748
|
.reduce((a, b) => a + b.end - b.start, 0);
|
|
978
749
|
}
|
|
979
|
-
// supported adapter types by text indexer ensure that this matches the method
|
|
980
|
-
// found in @jbrowse/text-indexing/util
|
|
981
750
|
function isSupportedIndexingAdapter(type = '') {
|
|
982
751
|
return [
|
|
983
752
|
'Gff3TabixAdapter',
|
|
@@ -1006,7 +775,6 @@ function getTickDisplayStr(totalBp, bpPerPx) {
|
|
|
1006
775
|
: toLocale(Math.floor(totalBp));
|
|
1007
776
|
}
|
|
1008
777
|
function getViewParams(model, exportSVG) {
|
|
1009
|
-
// @ts-expect-error
|
|
1010
778
|
const { dynamicBlocks, staticBlocks, offsetPx } = getContainingView(model);
|
|
1011
779
|
const b = (dynamicBlocks === null || dynamicBlocks === void 0 ? void 0 : dynamicBlocks.contentBlocks[0]) || {};
|
|
1012
780
|
const staticblock = (staticBlocks === null || staticBlocks === void 0 ? void 0 : staticBlocks.contentBlocks[0]) || {};
|
|
@@ -1021,7 +789,6 @@ function getViewParams(model, exportSVG) {
|
|
|
1021
789
|
function getLayoutId({ sessionId, layoutId, }) {
|
|
1022
790
|
return `${sessionId}-${layoutId}`;
|
|
1023
791
|
}
|
|
1024
|
-
// Hook from https://usehooks.com/useLocalStorage/
|
|
1025
792
|
function useLocalStorage(key, initialValue) {
|
|
1026
793
|
const [storedValue, setStoredValue] = (0, react_1.useState)(() => {
|
|
1027
794
|
if (typeof window === 'undefined') {
|
|
@@ -1063,23 +830,18 @@ function getUriLink(value) {
|
|
|
1063
830
|
}
|
|
1064
831
|
function getStr(obj) {
|
|
1065
832
|
return (0, is_object_1.default)(obj)
|
|
1066
|
-
? (0,
|
|
833
|
+
? (0, types_1.isUriLocation)(obj)
|
|
1067
834
|
? getUriLink(obj)
|
|
1068
835
|
: JSON.stringify(obj)
|
|
1069
836
|
: String(obj);
|
|
1070
837
|
}
|
|
1071
|
-
// tries to measure grid width without HTML tags included
|
|
1072
838
|
function coarseStripHTML(s) {
|
|
1073
839
|
return s.replaceAll(/(<([^>]+)>)/gi, '');
|
|
1074
840
|
}
|
|
1075
|
-
// based on autolink-js, license MIT
|
|
1076
|
-
// https://github.com/bryanwoods/autolink-js/blob/1418049970152c56ced73d43dcc62d80b320fb71/autolink.js#L9
|
|
1077
841
|
function linkify(s) {
|
|
1078
842
|
const pattern = /(^|[\s\n]|<[A-Za-z]*\/?>)((?:https?|ftp):\/\/[-A-Z0-9+\u0026\u2019@#/%?=()~_|!:,.;]*[-A-Z0-9+\u0026@#/%=~()_|])/gi;
|
|
1079
843
|
return s.replaceAll(pattern, '$1<a href=\'$2\' target="_blank">$2</a>');
|
|
1080
844
|
}
|
|
1081
|
-
// heuristic measurement for a column of a @mui/x-data-grid, pass in
|
|
1082
|
-
// values from a column
|
|
1083
845
|
function measureGridWidth(elements, args) {
|
|
1084
846
|
const { padding = 30, minWidth = 80, fontSize = 12, maxWidth = 1000, stripHTML = false, } = args || {};
|
|
1085
847
|
return max(elements
|
|
@@ -1140,27 +902,18 @@ function notEmpty(value) {
|
|
|
1140
902
|
return value !== null && value !== undefined;
|
|
1141
903
|
}
|
|
1142
904
|
function mergeIntervals(intervals, w = 5000) {
|
|
1143
|
-
// test if there are at least 2 intervals
|
|
1144
905
|
if (intervals.length <= 1) {
|
|
1145
906
|
return intervals;
|
|
1146
907
|
}
|
|
1147
908
|
const stack = [];
|
|
1148
909
|
let top = null;
|
|
1149
|
-
// sort the intervals based on their start values
|
|
1150
910
|
intervals = intervals.sort((a, b) => a.start - b.start);
|
|
1151
|
-
// push the 1st interval into the stack
|
|
1152
911
|
stack.push(intervals[0]);
|
|
1153
|
-
// start from the next interval and merge if needed
|
|
1154
912
|
for (let i = 1; i < intervals.length; i++) {
|
|
1155
|
-
// get the top element
|
|
1156
913
|
top = stack.at(-1);
|
|
1157
|
-
// if the current interval doesn't overlap with the
|
|
1158
|
-
// stack top element, push it to the stack
|
|
1159
914
|
if (top.end + w < intervals[i].start - w) {
|
|
1160
915
|
stack.push(intervals[i]);
|
|
1161
916
|
}
|
|
1162
|
-
// otherwise update the end value of the top element
|
|
1163
|
-
// if end of current interval is higher
|
|
1164
917
|
else if (top.end < intervals[i].end) {
|
|
1165
918
|
top.end = Math.max(top.end, intervals[i].end);
|
|
1166
919
|
stack.pop();
|
|
@@ -1169,7 +922,6 @@ function mergeIntervals(intervals, w = 5000) {
|
|
|
1169
922
|
}
|
|
1170
923
|
return stack;
|
|
1171
924
|
}
|
|
1172
|
-
// returns new array non-overlapping features
|
|
1173
925
|
function gatherOverlaps(regions, w = 5000) {
|
|
1174
926
|
const memo = {};
|
|
1175
927
|
for (const x of regions) {
|
|
@@ -1197,7 +949,6 @@ function getFillProps(str) {
|
|
|
1197
949
|
fill: c.alpha(1).toHex(),
|
|
1198
950
|
};
|
|
1199
951
|
}
|
|
1200
|
-
// https://react.dev/reference/react-dom/server/renderToString#removing-rendertostring-from-the-client-code
|
|
1201
952
|
function renderToStaticMarkup(node, createRootFn) {
|
|
1202
953
|
const div = document.createElement('div');
|
|
1203
954
|
(0, react_dom_1.flushSync)(() => {
|
|
@@ -1213,8 +964,18 @@ function renderToStaticMarkup(node, createRootFn) {
|
|
|
1213
964
|
function isGzip(buf) {
|
|
1214
965
|
return buf[0] === 31 && buf[1] === 139 && buf[2] === 8;
|
|
1215
966
|
}
|
|
967
|
+
async function fetchAndMaybeUnzip(loc, opts) {
|
|
968
|
+
const { statusCallback = () => { } } = opts || {};
|
|
969
|
+
const buf = (await updateStatus('Downloading file', statusCallback, () => loc.readFile(opts)));
|
|
970
|
+
return isGzip(buf)
|
|
971
|
+
? await updateStatus('Unzipping', statusCallback, () => (0, bgzf_filehandle_1.unzip)(buf))
|
|
972
|
+
: buf;
|
|
973
|
+
}
|
|
1216
974
|
var simpleFeature_1 = require("./simpleFeature");
|
|
1217
975
|
Object.defineProperty(exports, "SimpleFeature", { enumerable: true, get: function () { return __importDefault(simpleFeature_1).default; } });
|
|
1218
976
|
Object.defineProperty(exports, "isFeature", { enumerable: true, get: function () { return simpleFeature_1.isFeature; } });
|
|
1219
977
|
var blobToDataURL_1 = require("./blobToDataURL");
|
|
1220
978
|
Object.defineProperty(exports, "blobToDataURL", { enumerable: true, get: function () { return blobToDataURL_1.blobToDataURL; } });
|
|
979
|
+
var makeAbortableReaction_1 = require("./makeAbortableReaction");
|
|
980
|
+
Object.defineProperty(exports, "makeAbortableReaction", { enumerable: true, get: function () { return makeAbortableReaction_1.makeAbortableReaction; } });
|
|
981
|
+
__exportStar(require("./aborting"), exports);
|