@jbrowse/core 2.17.0 → 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 +1 -1
- package/BaseFeatureWidget/BaseFeatureDetail/index.js +1 -7
- 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 -56
- package/BaseFeatureWidget/SequenceFeatureDetails/model.js +1 -56
- 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 +2 -93
- 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 +5 -114
- package/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +3 -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 +1 -1
- package/data_adapters/CytobandAdapter/CytobandAdapter.js +1 -2
- 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 +3 -4
- 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 +0 -3
- 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 +5 -3
- 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 +1 -21
- 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 +0 -40
- 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 +16 -164
- package/util/index.js +22 -282
- 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 -50
- package/util/simpleFeature.js +0 -35
- package/util/stats.d.ts +3 -26
- package/util/stats.js +0 -25
- 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/Base1DViewModel.js
CHANGED
|
@@ -4,42 +4,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
7
|
-
const
|
|
8
|
-
const mst_1 = require("./types/mst");
|
|
7
|
+
const Base1DUtils_1 = require("./Base1DUtils");
|
|
9
8
|
const calculateDynamicBlocks_1 = __importDefault(require("./calculateDynamicBlocks"));
|
|
10
9
|
const calculateStaticBlocks_1 = __importDefault(require("./calculateStaticBlocks"));
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* used in non-lgv view representations of a 1d view e.g. the two axes of the
|
|
15
|
-
* dotplot use this
|
|
16
|
-
*/
|
|
17
|
-
function x() { } // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
10
|
+
const index_1 = require("./index");
|
|
11
|
+
const mst_1 = require("./types/mst");
|
|
12
|
+
function x() { }
|
|
18
13
|
const Base1DView = mobx_state_tree_1.types
|
|
19
14
|
.model('Base1DView', {
|
|
20
|
-
/**
|
|
21
|
-
* #property
|
|
22
|
-
*/
|
|
23
15
|
id: mst_1.ElementId,
|
|
24
|
-
/**
|
|
25
|
-
* #property
|
|
26
|
-
*/
|
|
27
16
|
displayedRegions: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.frozen(), []),
|
|
28
|
-
/**
|
|
29
|
-
* #property
|
|
30
|
-
*/
|
|
31
17
|
bpPerPx: 0,
|
|
32
|
-
/**
|
|
33
|
-
* #property
|
|
34
|
-
*/
|
|
35
18
|
offsetPx: 0,
|
|
36
|
-
/**
|
|
37
|
-
* #property
|
|
38
|
-
*/
|
|
39
19
|
interRegionPaddingWidth: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 0),
|
|
40
|
-
/**
|
|
41
|
-
* #property
|
|
42
|
-
*/
|
|
43
20
|
minimumBlockWidth: mobx_state_tree_1.types.optional(mobx_state_tree_1.types.number, 0),
|
|
44
21
|
})
|
|
45
22
|
.volatile(() => ({
|
|
@@ -47,133 +24,72 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
47
24
|
volatileWidth: 0,
|
|
48
25
|
}))
|
|
49
26
|
.actions(self => ({
|
|
50
|
-
/**
|
|
51
|
-
* #action
|
|
52
|
-
*/
|
|
53
27
|
setDisplayedRegions(regions) {
|
|
54
28
|
self.displayedRegions = (0, mobx_state_tree_1.cast)(regions);
|
|
55
29
|
},
|
|
56
|
-
/**
|
|
57
|
-
* #action
|
|
58
|
-
*/
|
|
59
30
|
setBpPerPx(val) {
|
|
60
31
|
self.bpPerPx = val;
|
|
61
32
|
},
|
|
62
|
-
/**
|
|
63
|
-
* #action
|
|
64
|
-
*/
|
|
65
33
|
setVolatileWidth(width) {
|
|
66
34
|
self.volatileWidth = width;
|
|
67
35
|
},
|
|
68
36
|
}))
|
|
69
37
|
.views(self => ({
|
|
70
|
-
/**
|
|
71
|
-
* #getter
|
|
72
|
-
*/
|
|
73
38
|
get width() {
|
|
74
39
|
return self.volatileWidth;
|
|
75
40
|
},
|
|
76
|
-
/**
|
|
77
|
-
* #getter
|
|
78
|
-
*/
|
|
79
41
|
get assemblyNames() {
|
|
80
42
|
return [...new Set(self.displayedRegions.map(r => r.assemblyName))];
|
|
81
43
|
},
|
|
82
|
-
/**
|
|
83
|
-
* #getter
|
|
84
|
-
*/
|
|
85
44
|
get displayedRegionsTotalPx() {
|
|
86
45
|
return this.totalBp / self.bpPerPx;
|
|
87
46
|
},
|
|
88
|
-
/**
|
|
89
|
-
* #getter
|
|
90
|
-
*/
|
|
91
47
|
get maxOffset() {
|
|
92
|
-
// objectively determined to keep the linear genome on the main screen
|
|
93
48
|
const leftPadding = 10;
|
|
94
49
|
return this.displayedRegionsTotalPx - leftPadding;
|
|
95
50
|
},
|
|
96
|
-
/**
|
|
97
|
-
* #getter
|
|
98
|
-
*/
|
|
99
51
|
get minOffset() {
|
|
100
|
-
// objectively determined to keep the linear genome on the main screen
|
|
101
52
|
const rightPadding = 30;
|
|
102
53
|
return -this.width + rightPadding;
|
|
103
54
|
},
|
|
104
|
-
/**
|
|
105
|
-
* #getter
|
|
106
|
-
*/
|
|
107
55
|
get totalBp() {
|
|
108
56
|
return (0, index_1.sum)(self.displayedRegions.map(a => a.end - a.start));
|
|
109
57
|
},
|
|
110
58
|
}))
|
|
111
59
|
.views(self => ({
|
|
112
|
-
/**
|
|
113
|
-
* #getter
|
|
114
|
-
*/
|
|
115
60
|
get dynamicBlocks() {
|
|
116
61
|
return (0, calculateDynamicBlocks_1.default)(self);
|
|
117
62
|
},
|
|
118
|
-
/**
|
|
119
|
-
* #getter
|
|
120
|
-
*/
|
|
121
63
|
get staticBlocks() {
|
|
122
64
|
return (0, calculateStaticBlocks_1.default)(self);
|
|
123
65
|
},
|
|
124
|
-
/**
|
|
125
|
-
* #getter
|
|
126
|
-
*/
|
|
127
66
|
get currBp() {
|
|
128
67
|
return (0, index_1.sum)(this.dynamicBlocks.map(a => a.end - a.start));
|
|
129
68
|
},
|
|
130
69
|
}))
|
|
131
70
|
.views(self => ({
|
|
132
|
-
/**
|
|
133
|
-
* #method
|
|
134
|
-
*/
|
|
135
71
|
pxToBp(px) {
|
|
136
72
|
return (0, Base1DUtils_1.pxToBp)(self, px);
|
|
137
73
|
},
|
|
138
|
-
/**
|
|
139
|
-
* #method
|
|
140
|
-
*/
|
|
141
74
|
bpToPx({ refName, coord, regionNumber, }) {
|
|
142
75
|
var _a;
|
|
143
76
|
return (_a = (0, Base1DUtils_1.bpToPx)({ refName, coord, regionNumber, self })) === null || _a === void 0 ? void 0 : _a.offsetPx;
|
|
144
77
|
},
|
|
145
78
|
}))
|
|
146
79
|
.actions(self => ({
|
|
147
|
-
/**
|
|
148
|
-
* #action
|
|
149
|
-
*/
|
|
150
80
|
setFeatures(features) {
|
|
151
81
|
self.features = features;
|
|
152
82
|
},
|
|
153
|
-
/**
|
|
154
|
-
* #action
|
|
155
|
-
* this makes a zoomed out view that shows all displayedRegions that makes
|
|
156
|
-
* the overview bar square with the scale bar
|
|
157
|
-
*/
|
|
158
83
|
showAllRegions() {
|
|
159
84
|
self.bpPerPx = self.totalBp / self.width;
|
|
160
85
|
self.offsetPx = 0;
|
|
161
86
|
},
|
|
162
|
-
/**
|
|
163
|
-
* #action
|
|
164
|
-
*/
|
|
165
87
|
zoomOut() {
|
|
166
88
|
this.zoomTo(self.bpPerPx * 2);
|
|
167
89
|
},
|
|
168
|
-
/**
|
|
169
|
-
* #action
|
|
170
|
-
*/
|
|
171
90
|
zoomIn() {
|
|
172
91
|
this.zoomTo(self.bpPerPx / 2);
|
|
173
92
|
},
|
|
174
|
-
/**
|
|
175
|
-
* #action
|
|
176
|
-
*/
|
|
177
93
|
zoomTo(bpPerPx, offset = self.width / 2) {
|
|
178
94
|
const newBpPerPx = (0, index_1.clamp)(bpPerPx, 'minBpPerPx' in self ? self.minBpPerPx : 0, 'maxBpPerPx' in self
|
|
179
95
|
? self.maxBpPerPx
|
|
@@ -183,22 +99,14 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
183
99
|
return oldBpPerPx;
|
|
184
100
|
}
|
|
185
101
|
self.bpPerPx = newBpPerPx;
|
|
186
|
-
// tweak the offset so that the center of the view remains at the same
|
|
187
|
-
// coordinate
|
|
188
102
|
self.offsetPx = (0, index_1.clamp)(Math.round(((self.offsetPx + offset) * oldBpPerPx) / newBpPerPx - offset), self.minOffset, self.maxOffset);
|
|
189
103
|
return self.bpPerPx;
|
|
190
104
|
},
|
|
191
|
-
/**
|
|
192
|
-
* #action
|
|
193
|
-
*/
|
|
194
105
|
scrollTo(offsetPx) {
|
|
195
106
|
const newOffsetPx = (0, index_1.clamp)(offsetPx, self.minOffset, self.maxOffset);
|
|
196
107
|
self.offsetPx = newOffsetPx;
|
|
197
108
|
return newOffsetPx;
|
|
198
109
|
},
|
|
199
|
-
/**
|
|
200
|
-
* #action
|
|
201
|
-
*/
|
|
202
110
|
centerAt(coord, refName, regionNumber) {
|
|
203
111
|
if (!refName) {
|
|
204
112
|
return;
|
|
@@ -212,10 +120,6 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
212
120
|
this.scrollTo(Math.round(centerPx - self.width / 2));
|
|
213
121
|
}
|
|
214
122
|
},
|
|
215
|
-
/**
|
|
216
|
-
* #action
|
|
217
|
-
* note: the scroll is clamped to keep the view on the main screen
|
|
218
|
-
*/
|
|
219
123
|
scroll(distance) {
|
|
220
124
|
const oldOffsetPx = self.offsetPx;
|
|
221
125
|
const newOffsetPx = (0, index_1.clamp)(self.offsetPx + distance, self.minOffset, self.maxOffset);
|
|
@@ -224,14 +128,6 @@ const Base1DView = mobx_state_tree_1.types
|
|
|
224
128
|
},
|
|
225
129
|
}))
|
|
226
130
|
.actions(self => ({
|
|
227
|
-
/**
|
|
228
|
-
* #action
|
|
229
|
-
* offset is the base-pair-offset in the displayed region, index is the
|
|
230
|
-
* index of the displayed region in the linear genome view
|
|
231
|
-
*
|
|
232
|
-
* @param start - object as `{start, end, offset, index}`
|
|
233
|
-
* @param end - object as `{start, end, offset, index}`
|
|
234
|
-
*/
|
|
235
131
|
moveTo(start, end) {
|
|
236
132
|
(0, Base1DUtils_1.moveTo)(self, start, end);
|
|
237
133
|
},
|
package/util/QuickLRU.js
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
// vendored from quick-lru@6.1.1, didn't like being compiled as a 'pure-esm' nodejs dependency
|
|
3
|
-
// the license is reproduced below https://github.com/sindresorhus/quick-lru/blob/main/license
|
|
4
|
-
// MIT License
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
// Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
|
7
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
8
|
-
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
9
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
10
3
|
class QuickLRU extends Map {
|
|
11
4
|
constructor(options = {}) {
|
|
12
5
|
super();
|
|
@@ -16,7 +9,6 @@ class QuickLRU extends Map {
|
|
|
16
9
|
if (typeof options.maxAge === 'number' && options.maxAge === 0) {
|
|
17
10
|
throw new TypeError('`maxAge` must be a number greater than 0');
|
|
18
11
|
}
|
|
19
|
-
// TODO: Use private class fields when ESLint supports them.
|
|
20
12
|
this.maxSize = options.maxSize;
|
|
21
13
|
this.maxAge = options.maxAge || Number.POSITIVE_INFINITY;
|
|
22
14
|
this.onEviction = options.onEviction;
|
|
@@ -24,7 +16,6 @@ class QuickLRU extends Map {
|
|
|
24
16
|
this.oldCache = new Map();
|
|
25
17
|
this._size = 0;
|
|
26
18
|
}
|
|
27
|
-
// TODO: Use private class methods when targeting Node.js 16.
|
|
28
19
|
_emitEvictions(cache) {
|
|
29
20
|
if (typeof this.onEviction !== 'function') {
|
|
30
21
|
return;
|
package/util/TimeTraveller.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
// adapted from https://github.com/mobxjs/mobx-state-tree/blob/master/packages/mst-middlewares/src/time-traveller.ts
|
|
4
3
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
4
|
const MAX_HISTORY_LENGTH = 20;
|
|
6
5
|
function debounce(func, timeout = 300) {
|
|
@@ -34,11 +33,9 @@ const TimeTraveller = mobx_state_tree_1.types
|
|
|
34
33
|
let snapshotDisposer;
|
|
35
34
|
let skipNextUndoState = false;
|
|
36
35
|
return {
|
|
37
|
-
// allows user code to (temporarily) stop tracking undo states
|
|
38
36
|
stopTrackingUndo() {
|
|
39
37
|
self.notTrackingUndo = true;
|
|
40
38
|
},
|
|
41
|
-
// allows user code to resume tracking undo states
|
|
42
39
|
resumeTrackingUndo() {
|
|
43
40
|
self.notTrackingUndo = false;
|
|
44
41
|
},
|
|
@@ -47,7 +44,6 @@ const TimeTraveller = mobx_state_tree_1.types
|
|
|
47
44
|
return;
|
|
48
45
|
}
|
|
49
46
|
if (skipNextUndoState) {
|
|
50
|
-
// skip recording if this state was caused by undo / redo
|
|
51
47
|
skipNextUndoState = false;
|
|
52
48
|
return;
|
|
53
49
|
}
|
package/util/aborting.d.ts
CHANGED
|
@@ -2,29 +2,9 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
declare class AbortError extends Error {
|
|
3
3
|
code: string | undefined;
|
|
4
4
|
}
|
|
5
|
-
/**
|
|
6
|
-
* properly check if the given AbortSignal is aborted.
|
|
7
|
-
* per the standard, if the signal reads as aborted,
|
|
8
|
-
* this function throws either a DOMException AbortError, or a regular error
|
|
9
|
-
* with a `code` attribute set to `ERR_ABORTED`.
|
|
10
|
-
*
|
|
11
|
-
* for convenience, passing `undefined` is a no-op
|
|
12
|
-
*
|
|
13
|
-
* @param signal -
|
|
14
|
-
* @returns nothing
|
|
15
|
-
*/
|
|
16
5
|
export declare function checkAbortSignal(signal?: AbortSignal): void;
|
|
17
|
-
/**
|
|
18
|
-
* Skips to the next tick, then runs `checkAbortSignal`.
|
|
19
|
-
* Await this to inside an otherwise synchronous loop to
|
|
20
|
-
* provide a place to break when an abort signal is received.
|
|
21
|
-
*/
|
|
22
6
|
export declare function abortBreakPoint(signal?: AbortSignal): Promise<void>;
|
|
23
7
|
export declare function makeAbortError(): AbortError | DOMException;
|
|
24
8
|
export declare function observeAbortSignal(signal?: AbortSignal): Observable<Event>;
|
|
25
|
-
/**
|
|
26
|
-
* check if the given exception was caused by an operation being intentionally aborted
|
|
27
|
-
* @param exception -
|
|
28
|
-
*/
|
|
29
9
|
export declare function isAbortException(exception: unknown): boolean;
|
|
30
10
|
export {};
|
package/util/aborting.js
CHANGED
|
@@ -8,17 +8,6 @@ exports.isAbortException = isAbortException;
|
|
|
8
8
|
const rxjs_1 = require("rxjs");
|
|
9
9
|
class AbortError extends Error {
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* properly check if the given AbortSignal is aborted.
|
|
13
|
-
* per the standard, if the signal reads as aborted,
|
|
14
|
-
* this function throws either a DOMException AbortError, or a regular error
|
|
15
|
-
* with a `code` attribute set to `ERR_ABORTED`.
|
|
16
|
-
*
|
|
17
|
-
* for convenience, passing `undefined` is a no-op
|
|
18
|
-
*
|
|
19
|
-
* @param signal -
|
|
20
|
-
* @returns nothing
|
|
21
|
-
*/
|
|
22
11
|
function checkAbortSignal(signal) {
|
|
23
12
|
if (!signal) {
|
|
24
13
|
return;
|
|
@@ -33,16 +22,7 @@ function checkAbortSignal(signal) {
|
|
|
33
22
|
function timeout(ms) {
|
|
34
23
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
35
24
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Skips to the next tick, then runs `checkAbortSignal`.
|
|
38
|
-
* Await this to inside an otherwise synchronous loop to
|
|
39
|
-
* provide a place to break when an abort signal is received.
|
|
40
|
-
*/
|
|
41
25
|
async function abortBreakPoint(signal) {
|
|
42
|
-
// it was observed that an actual timeout is needed to get the aborting (wrap
|
|
43
|
-
// hicrenderer in a try catch, console.error the error, and rethrow the error
|
|
44
|
-
// to see). using await Promise.resolve() did not appear to allow aborting to
|
|
45
|
-
// occur
|
|
46
26
|
await timeout(1);
|
|
47
27
|
checkAbortSignal(signal);
|
|
48
28
|
}
|
|
@@ -60,20 +40,9 @@ function observeAbortSignal(signal) {
|
|
|
60
40
|
}
|
|
61
41
|
return (0, rxjs_1.fromEvent)(signal, 'abort');
|
|
62
42
|
}
|
|
63
|
-
/**
|
|
64
|
-
* check if the given exception was caused by an operation being intentionally aborted
|
|
65
|
-
* @param exception -
|
|
66
|
-
*/
|
|
67
43
|
function isAbortException(exception) {
|
|
68
44
|
return (exception instanceof Error &&
|
|
69
|
-
// DOMException
|
|
70
45
|
(exception.name === 'AbortError' ||
|
|
71
|
-
// standard-ish non-DOM abort exception
|
|
72
46
|
exception.code === 'ERR_ABORTED' ||
|
|
73
|
-
// message contains aborted for bubbling through RPC
|
|
74
|
-
// things we have seen that we want to catch here
|
|
75
|
-
// Error: aborted
|
|
76
|
-
// AbortError: aborted
|
|
77
|
-
// AbortError: The user aborted a request.
|
|
78
47
|
!!/\b(aborted|aborterror)\b/i.test(exception.message)));
|
|
79
48
|
}
|
package/util/analytics.js
CHANGED
|
@@ -12,7 +12,6 @@ async function writeAWSAnalytics(rootModel, initialTimeStamp, sessionQuery) {
|
|
|
12
12
|
const savedSessionCount = Object.keys(localStorage).filter(name => name.includes('localSaved-')).length;
|
|
13
13
|
const { jbrowse: config, session, version: ver } = rootModel;
|
|
14
14
|
const { tracks, assemblies, plugins } = config;
|
|
15
|
-
// stats to be recorded in db
|
|
16
15
|
const stats = {
|
|
17
16
|
ver,
|
|
18
17
|
'plugins-count': (plugins === null || plugins === void 0 ? void 0 : plugins.length) || 0,
|
|
@@ -23,29 +22,23 @@ async function writeAWSAnalytics(rootModel, initialTimeStamp, sessionQuery) {
|
|
|
23
22
|
'open-views': (session === null || session === void 0 ? void 0 : session.views.length) || 0,
|
|
24
23
|
'synteny-tracks-count': multiAssemblyTracks,
|
|
25
24
|
'saved-sessions-count': savedSessionCount,
|
|
26
|
-
// field if existing session param in query before autogenerated param
|
|
27
25
|
'existing-session-param-type': (sessionQuery === null || sessionQuery === void 0 ? void 0 : sessionQuery.split('-')[0]) || 'none',
|
|
28
|
-
// screen geometry
|
|
29
26
|
'scn-h': window.screen.height,
|
|
30
27
|
'scn-w': window.screen.width,
|
|
31
|
-
// window geometry
|
|
32
28
|
'win-h': window.innerHeight,
|
|
33
29
|
'win-w': window.innerWidth,
|
|
34
30
|
electron: util_1.isElectron,
|
|
35
31
|
loadTime: (Date.now() - initialTimeStamp) / 1000,
|
|
36
32
|
jb2: true,
|
|
37
33
|
};
|
|
38
|
-
// stringifies the track type counts, gets processed in lambda
|
|
39
34
|
tracks.forEach((track) => {
|
|
40
35
|
const key = `track-types-${track.type}`;
|
|
41
36
|
stats[key] = stats[key] + 1 || 1;
|
|
42
37
|
});
|
|
43
|
-
// stringifies the session track type counts, gets processed in lambda
|
|
44
38
|
session === null || session === void 0 ? void 0 : session.sessionTracks.forEach((track) => {
|
|
45
39
|
const key = `sessionTrack-types-${track.type}`;
|
|
46
40
|
stats[key] = stats[key] + 1 || 1;
|
|
47
41
|
});
|
|
48
|
-
// put stats into a query string for get request
|
|
49
42
|
const qs = Object.keys(stats)
|
|
50
43
|
.map(key => `${key}=${stats[key]}`)
|
|
51
44
|
.join('&');
|
|
@@ -59,13 +52,12 @@ async function writeGAAnalytics(rootModel, initialTimestamp) {
|
|
|
59
52
|
var _a;
|
|
60
53
|
const jbrowseUser = 'UA-7115575-5';
|
|
61
54
|
const stats = {
|
|
62
|
-
'tracks-count': rootModel.jbrowse.tracks.length,
|
|
55
|
+
'tracks-count': rootModel.jbrowse.tracks.length,
|
|
63
56
|
ver: rootModel.version,
|
|
64
57
|
electron: util_1.isElectron,
|
|
65
58
|
loadTime: Date.now() - initialTimestamp,
|
|
66
59
|
pluginNames: ((_a = rootModel.jbrowse.plugins) === null || _a === void 0 ? void 0 : _a.map((plugin) => plugin.name)) || '',
|
|
67
60
|
};
|
|
68
|
-
// create script
|
|
69
61
|
let analyticsScript = "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){";
|
|
70
62
|
analyticsScript +=
|
|
71
63
|
'(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),';
|
|
@@ -88,10 +80,7 @@ async function writeGAAnalytics(rootModel, initialTimestamp) {
|
|
|
88
80
|
function doAnalytics(rootModel, initialTimestamp, initialSessionQuery) {
|
|
89
81
|
if (rootModel &&
|
|
90
82
|
!(0, configuration_1.readConfObject)(rootModel.jbrowse.configuration, 'disableAnalytics')) {
|
|
91
|
-
// ok if these are unhandled
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
93
83
|
writeAWSAnalytics(rootModel, initialTimestamp, initialSessionQuery);
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
95
84
|
writeGAAnalytics(rootModel, initialTimestamp);
|
|
96
85
|
}
|
|
97
86
|
}
|
package/util/blockTypes.d.ts
CHANGED
|
@@ -33,9 +33,6 @@ export declare class BaseBlock {
|
|
|
33
33
|
widthPx: number;
|
|
34
34
|
variant?: string;
|
|
35
35
|
isLeftEndOfDisplayedRegion?: boolean;
|
|
36
|
-
/**
|
|
37
|
-
* a block that should be shown as filled with data
|
|
38
|
-
*/
|
|
39
36
|
constructor(data: Record<string, any>);
|
|
40
37
|
toRegion(): {
|
|
41
38
|
refName: string;
|
|
@@ -48,10 +45,6 @@ export declare class BaseBlock {
|
|
|
48
45
|
export declare class ContentBlock extends BaseBlock {
|
|
49
46
|
type: string;
|
|
50
47
|
}
|
|
51
|
-
/**
|
|
52
|
-
* marker block representing one or more blocks that are
|
|
53
|
-
* too small to be shown at the current zoom level
|
|
54
|
-
*/
|
|
55
48
|
export declare class ElidedBlock extends BaseBlock {
|
|
56
49
|
type: string;
|
|
57
50
|
widthPx: number;
|
|
@@ -59,10 +52,6 @@ export declare class ElidedBlock extends BaseBlock {
|
|
|
59
52
|
constructor(data: Record<string, any>);
|
|
60
53
|
push(otherBlock: ElidedBlock): void;
|
|
61
54
|
}
|
|
62
|
-
/**
|
|
63
|
-
* marker block that sits between two different displayed regions
|
|
64
|
-
* and provides a thick border between them
|
|
65
|
-
*/
|
|
66
55
|
export declare class InterRegionPaddingBlock extends BaseBlock {
|
|
67
56
|
type: string;
|
|
68
57
|
}
|
package/util/blockTypes.js
CHANGED
|
@@ -24,11 +24,9 @@ class BlockSet {
|
|
|
24
24
|
return this.blocks.map(block => block.toRegion());
|
|
25
25
|
}
|
|
26
26
|
map(func, thisarg) {
|
|
27
|
-
// eslint-disable-next-line unicorn/no-array-method-this-argument
|
|
28
27
|
return this.blocks.map(func, thisarg);
|
|
29
28
|
}
|
|
30
29
|
forEach(func, thisarg) {
|
|
31
|
-
// eslint-disable-next-line unicorn/no-array-method-this-argument
|
|
32
30
|
this.blocks.forEach(func, thisarg);
|
|
33
31
|
}
|
|
34
32
|
get length() {
|
|
@@ -58,9 +56,6 @@ class BlockSet {
|
|
|
58
56
|
}
|
|
59
57
|
exports.BlockSet = BlockSet;
|
|
60
58
|
class BaseBlock {
|
|
61
|
-
/**
|
|
62
|
-
* a block that should be shown as filled with data
|
|
63
|
-
*/
|
|
64
59
|
constructor(data) {
|
|
65
60
|
this.type = 'BaseBlock';
|
|
66
61
|
this.widthPx = 0;
|
|
@@ -90,10 +85,6 @@ class ContentBlock extends BaseBlock {
|
|
|
90
85
|
}
|
|
91
86
|
}
|
|
92
87
|
exports.ContentBlock = ContentBlock;
|
|
93
|
-
/**
|
|
94
|
-
* marker block representing one or more blocks that are
|
|
95
|
-
* too small to be shown at the current zoom level
|
|
96
|
-
*/
|
|
97
88
|
class ElidedBlock extends BaseBlock {
|
|
98
89
|
constructor(data) {
|
|
99
90
|
super(data);
|
|
@@ -110,10 +101,6 @@ class ElidedBlock extends BaseBlock {
|
|
|
110
101
|
}
|
|
111
102
|
}
|
|
112
103
|
exports.ElidedBlock = ElidedBlock;
|
|
113
|
-
/**
|
|
114
|
-
* marker block that sits between two different displayed regions
|
|
115
|
-
* and provides a thick border between them
|
|
116
|
-
*/
|
|
117
104
|
class InterRegionPaddingBlock extends BaseBlock {
|
|
118
105
|
constructor() {
|
|
119
106
|
super(...arguments);
|
|
@@ -1,22 +1,3 @@
|
|
|
1
1
|
import { BlockSet } from './blockTypes';
|
|
2
|
-
import { Base1DViewModel } from './calculateStaticBlocks';
|
|
3
|
-
/**
|
|
4
|
-
* returns a BlockSet of which the `blocks` attribute is an array of 'dynamic
|
|
5
|
-
* blocks', which are blocks representing only the regions that are visible in
|
|
6
|
-
* the view right now. these are mostly used by tracks for which static blocks
|
|
7
|
-
* are not feasible.
|
|
8
|
-
*
|
|
9
|
-
* each block is a plain JS object like:
|
|
10
|
-
* `{ refName, start, end, offsetPx, reversed? }`
|
|
11
|
-
*
|
|
12
|
-
* start and end are in bp, and start is always less than end, but if reversed
|
|
13
|
-
* is true, startBp will be on the right side of the visible region.
|
|
14
|
-
*
|
|
15
|
-
* offsetPx is the number of pixels from the left edge of the view to the left
|
|
16
|
-
* edge of the region
|
|
17
|
-
*
|
|
18
|
-
* NOTE: start, end, and offsetPx may all be fractional!
|
|
19
|
-
*
|
|
20
|
-
* @returns BlockSet of `{ refName, startBp, end, offset, reversed? }`
|
|
21
|
-
*/
|
|
2
|
+
import type { Base1DViewModel } from './calculateStaticBlocks';
|
|
22
3
|
export default function calculateDynamicBlocks(model: Base1DViewModel, padding?: boolean, elision?: boolean): BlockSet;
|
|
@@ -2,28 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = calculateDynamicBlocks;
|
|
4
4
|
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
5
|
-
const range_1 = require("./range");
|
|
6
5
|
const _1 = require(".");
|
|
7
6
|
const blockTypes_1 = require("./blockTypes");
|
|
8
|
-
|
|
9
|
-
* returns a BlockSet of which the `blocks` attribute is an array of 'dynamic
|
|
10
|
-
* blocks', which are blocks representing only the regions that are visible in
|
|
11
|
-
* the view right now. these are mostly used by tracks for which static blocks
|
|
12
|
-
* are not feasible.
|
|
13
|
-
*
|
|
14
|
-
* each block is a plain JS object like:
|
|
15
|
-
* `{ refName, start, end, offsetPx, reversed? }`
|
|
16
|
-
*
|
|
17
|
-
* start and end are in bp, and start is always less than end, but if reversed
|
|
18
|
-
* is true, startBp will be on the right side of the visible region.
|
|
19
|
-
*
|
|
20
|
-
* offsetPx is the number of pixels from the left edge of the view to the left
|
|
21
|
-
* edge of the region
|
|
22
|
-
*
|
|
23
|
-
* NOTE: start, end, and offsetPx may all be fractional!
|
|
24
|
-
*
|
|
25
|
-
* @returns BlockSet of `{ refName, startBp, end, offset, reversed? }`
|
|
26
|
-
*/
|
|
7
|
+
const range_1 = require("./range");
|
|
27
8
|
function calculateDynamicBlocks(model, padding = true, elision = true) {
|
|
28
9
|
const { offsetPx, displayedRegions, bpPerPx, width, minimumBlockWidth, interRegionPaddingWidth, } = model;
|
|
29
10
|
if (!width) {
|
|
@@ -41,7 +22,6 @@ function calculateDynamicBlocks(model, padding = true, elision = true) {
|
|
|
41
22
|
const parentRegion = (0, mobx_state_tree_1.isStateTreeNode)(region) ? (0, mobx_state_tree_1.getSnapshot)(region) : region;
|
|
42
23
|
const [leftPx, rightPx] = (0, range_1.intersection2)(windowLeftPx, windowRightPx, displayedRegionLeftPx, displayedRegionRightPx);
|
|
43
24
|
if (leftPx !== undefined && rightPx !== undefined) {
|
|
44
|
-
// this displayed region overlaps the view, so make a record for it
|
|
45
25
|
let start;
|
|
46
26
|
let end;
|
|
47
27
|
let isLeftEndOfDisplayedRegion;
|
|
@@ -92,7 +72,6 @@ function calculateDynamicBlocks(model, padding = true, elision = true) {
|
|
|
92
72
|
blocks.push(new blockTypes_1.ContentBlock(blockData));
|
|
93
73
|
}
|
|
94
74
|
if (padding) {
|
|
95
|
-
// insert a inter-region padding block if we are crossing a displayed region
|
|
96
75
|
if (regionWidthPx >= minimumBlockWidth &&
|
|
97
76
|
blockData.isRightEndOfDisplayedRegion &&
|
|
98
77
|
regionNumber < displayedRegions.length - 1) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Instance } from 'mobx-state-tree';
|
|
2
1
|
import { BlockSet } from './blockTypes';
|
|
3
|
-
import { Region } from './types';
|
|
2
|
+
import type { Region } from './types';
|
|
4
3
|
import type { Region as RegionModel } from './types/mst';
|
|
4
|
+
import type { Instance } from 'mobx-state-tree';
|
|
5
5
|
export interface Base1DViewModel {
|
|
6
6
|
offsetPx: number;
|
|
7
7
|
width: number;
|
|
@@ -10,7 +10,6 @@ function calculateStaticBlocks(model, padding = true, elision = true, extra = 0,
|
|
|
10
10
|
const windowRightBp = (offsetPx + modelWidth) * bpPerPx;
|
|
11
11
|
const blockSizePx = width;
|
|
12
12
|
const blockSizeBp = Math.ceil(blockSizePx * bpPerPx);
|
|
13
|
-
// for each displayed region
|
|
14
13
|
let regionBpOffset = 0;
|
|
15
14
|
const blocks = new blockTypes_1.BlockSet();
|
|
16
15
|
for (let regionNumber = 0; regionNumber < displayedRegions.length; regionNumber++) {
|
|
@@ -75,7 +74,6 @@ function calculateStaticBlocks(model, padding = true, elision = true, extra = 0,
|
|
|
75
74
|
blocks.push(new blockTypes_1.ContentBlock(blockData));
|
|
76
75
|
}
|
|
77
76
|
if (padding) {
|
|
78
|
-
// insert a inter-region padding block if we are crossing a displayed region
|
|
79
77
|
if (regionWidthPx >= minimumBlockWidth &&
|
|
80
78
|
blockData.isRightEndOfDisplayedRegion &&
|
|
81
79
|
regionNumber < displayedRegions.length - 1) {
|
package/util/color/index.d.ts
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Algorithmically pick a contrasting text color that will
|
|
3
|
-
* be visible on top of the given background color. Either
|
|
4
|
-
* black or white.
|
|
5
|
-
*
|
|
6
|
-
* @param color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(),
|
|
7
|
-
* hsl(), hsla(), or named color
|
|
8
|
-
* @returns 'black' or 'white'
|
|
9
|
-
*/
|
|
10
1
|
export declare function contrastingTextColor(color: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Darken or lighten a color, depending on its luminance.
|
|
13
|
-
* Light colors are darkened, dark colors are lightened.
|
|
14
|
-
* Uses MUI's `emphasize`, but adds support for named colors
|
|
15
|
-
*
|
|
16
|
-
* @param color - CSS color, i.e. one of: #nnn, #nnnnnn, rgb(), rgba(),
|
|
17
|
-
* hsl(), hsla(), or named color
|
|
18
|
-
* @param coefficient - multiplier in the range 0 - 1, defaults to 0.15
|
|
19
|
-
* @returns A CSS color string. Hex input values are returned as rgb
|
|
20
|
-
*/
|
|
21
2
|
export declare function emphasize(color: string, coefficient?: number): string;
|
|
22
3
|
export declare function makeContrasting(foreground: string, background?: string, minContrastRatio?: number): string;
|
|
23
4
|
export { isNamedColor, namedColorToHex } from './cssColorsLevel4';
|