@jbrowse/core 5.0.0-beta.8 → 5.0.0-beta.9
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/README.md +427 -130
- package/esm/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.d.ts +3 -2
- package/esm/BaseFeatureWidget/BaseFeatureDetail/ArrayValue.js +5 -3
- package/esm/BaseFeatureWidget/BaseFeatureDetail/Attributes.d.ts +3 -5
- package/esm/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +8 -9
- package/esm/BaseFeatureWidget/BaseFeatureDetail/CoreDetails.js +8 -13
- package/esm/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.d.ts +2 -1
- package/esm/BaseFeatureWidget/BaseFeatureDetail/FeatureDetails.js +3 -3
- package/esm/BaseFeatureWidget/BaseFeatureDetail/FieldActionsButton.d.ts +8 -0
- package/esm/BaseFeatureWidget/BaseFeatureDetail/FieldActionsButton.js +24 -0
- package/esm/BaseFeatureWidget/BaseFeatureDetail/SimpleField.d.ts +3 -2
- package/esm/BaseFeatureWidget/BaseFeatureDetail/SimpleField.js +5 -3
- package/esm/BaseFeatureWidget/BaseFeatureDetail/index.d.ts +1 -0
- package/esm/BaseFeatureWidget/BaseFeatureDetail/index.js +1 -4
- package/esm/BaseFeatureWidget/BaseFeatureDetail/jexlFilterActions.d.ts +16 -0
- package/esm/BaseFeatureWidget/BaseFeatureDetail/jexlFilterActions.js +53 -0
- package/esm/BaseFeatureWidget/BaseFeatureDetail/util.d.ts +0 -8
- package/esm/BaseFeatureWidget/BaseFeatureDetail/util.js +0 -16
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/SequenceContents.js +7 -34
- package/esm/BaseFeatureWidget/configSchema.d.ts +1 -1
- package/esm/BaseFeatureWidget/formatDetails.d.ts +13 -29
- package/esm/BaseFeatureWidget/formatDetails.js +46 -79
- package/esm/BaseFeatureWidget/index.d.ts +1 -0
- package/esm/BaseFeatureWidget/stateModelFactory.d.ts +35 -28
- package/esm/BaseFeatureWidget/stateModelFactory.js +94 -102
- package/esm/BaseFeatureWidget/types.d.ts +3 -0
- package/esm/BaseFeatureWidget/util.d.ts +0 -3
- package/esm/BaseFeatureWidget/util.js +0 -17
- package/esm/PluginLoader.d.ts +14 -9
- package/esm/PluginLoader.js +34 -26
- package/esm/PluginManager.d.ts +4 -4
- package/esm/PluginManager.js +1 -1
- package/esm/ReExports/coreModules.generated.d.ts +2 -0
- package/esm/ReExports/coreModules.generated.js +492 -0
- package/esm/ReExports/coreWorkerModules.generated.d.ts +2 -0
- package/esm/ReExports/coreWorkerModules.generated.js +453 -0
- package/esm/ReExports/frameworkModules.d.ts +2 -0
- package/esm/ReExports/frameworkModules.js +67 -0
- package/esm/ReExports/frameworkShared.d.ts +12 -0
- package/esm/ReExports/frameworkShared.js +16 -0
- package/esm/ReExports/frameworkWorkerModules.generated.d.ts +2 -0
- package/esm/ReExports/frameworkWorkerModules.generated.js +130 -0
- package/esm/ReExports/list.js +493 -79
- package/esm/ReExports/modules.d.ts +1 -1
- package/esm/ReExports/modules.js +10 -87
- package/esm/ReExports/registry.d.ts +1 -0
- package/esm/ReExports/registry.js +23 -5
- package/esm/ReExports/uiStub.d.ts +2 -1
- package/esm/ReExports/uiStub.js +24 -2
- package/esm/ReExports/workerModules.js +8 -12
- package/esm/TextSearch/TextSearchManager.d.ts +3 -12
- package/esm/TextSearch/TextSearchManager.js +22 -10
- package/esm/assemblyManager/assembly.d.ts +10 -14
- package/esm/assemblyManager/assembly.js +10 -14
- package/esm/assemblyManager/assemblyConfigSchema.d.ts +23 -81
- package/esm/assemblyManager/assemblyManager.d.ts +10 -16
- package/esm/assemblyManager/assemblyManager.js +7 -10
- package/esm/assemblyManager/loadRefNameMap.js +3 -3
- package/esm/configuration/configurationSchema.d.ts +75 -31
- package/esm/configuration/configurationSchema.js +74 -40
- package/esm/configuration/configurationSchemaUnion.d.ts +39 -0
- package/esm/configuration/configurationSchemaUnion.js +59 -0
- package/esm/configuration/configurationSlot.d.ts +37 -12
- package/esm/configuration/configurationSlot.js +83 -22
- package/esm/configuration/formatAboutConfigSchema.d.ts +7 -21
- package/esm/configuration/formatDetailsConfigSchema.d.ts +11 -37
- package/esm/configuration/formatDetailsConfigSchema.js +10 -13
- package/esm/configuration/getConf.d.ts +17 -9
- package/esm/configuration/getConf.js +52 -7
- package/esm/configuration/index.d.ts +11 -4
- package/esm/configuration/index.js +7 -4
- package/esm/configuration/mergeFormatCallbacks.d.ts +6 -7
- package/esm/configuration/mergeFormatCallbacks.js +13 -10
- package/esm/configuration/readConfObject.d.ts +2 -22
- package/esm/configuration/readConfObject.js +15 -49
- package/esm/configuration/requirements.d.ts +37 -0
- package/esm/configuration/requirements.js +88 -0
- package/esm/configuration/schemaRegistry.d.ts +21 -1
- package/esm/configuration/schemaRegistry.js +11 -0
- package/esm/configuration/schemaTypes.d.ts +3 -0
- package/esm/configuration/schemaTypes.js +10 -0
- package/esm/configuration/slotFacade.d.ts +35 -4
- package/esm/configuration/slotFacade.js +96 -9
- package/esm/configuration/snapshotPreprocess.d.ts +27 -0
- package/esm/configuration/snapshotPreprocess.js +102 -0
- package/esm/configuration/types.d.ts +161 -22
- package/esm/data_adapters/BaseAdapter/BaseAdapter.d.ts +2 -2
- package/esm/data_adapters/BaseAdapter/BaseFeatureDataAdapter.d.ts +11 -2
- package/esm/data_adapters/BaseAdapter/BaseFeatureDataAdapter.js +12 -1
- package/esm/data_adapters/BaseAdapter/featureDensity.d.ts +2 -3
- package/esm/data_adapters/BaseAdapter/featureDensity.js +2 -3
- package/esm/data_adapters/BaseAdapter/index.d.ts +22 -3
- package/esm/data_adapters/BaseAdapter/types.d.ts +3 -4
- package/esm/data_adapters/BaseAdapter/zoomRange.d.ts +10 -0
- package/esm/data_adapters/BaseAdapter/zoomRange.js +1 -0
- package/esm/data_adapters/CytobandAdapter/configSchema.d.ts +9 -11
- package/esm/data_adapters/getSequenceSubAdapter.d.ts +1 -3
- package/esm/data_adapters/getSequenceSubAdapter.js +1 -3
- package/esm/pluggableElementTypes/AdapterType.d.ts +7 -7
- package/esm/pluggableElementTypes/RpcMethodType.d.ts +1 -1
- package/esm/pluggableElementTypes/RpcMethodType.js +3 -8
- package/esm/pluggableElementTypes/RpcMethodTypeWithFiltersAndRenameRegions.d.ts +1 -2
- package/esm/pluggableElementTypes/TextSearchAdapterType.d.ts +7 -7
- package/esm/pluggableElementTypes/index.d.ts +1 -1
- package/esm/pluggableElementTypes/index.js +1 -1
- package/esm/pluggableElementTypes/models/BaseConnectionModelFactory.d.ts +17 -7
- package/esm/pluggableElementTypes/models/BaseDisplayModel.d.ts +45 -48
- package/esm/pluggableElementTypes/models/BaseDisplayModel.js +40 -36
- package/esm/pluggableElementTypes/models/BaseTrackModel.d.ts +10 -13
- package/esm/pluggableElementTypes/models/BaseTrackModel.js +6 -6
- package/esm/pluggableElementTypes/models/BaseViewModel.d.ts +37 -17
- package/esm/pluggableElementTypes/models/BaseViewModel.js +25 -10
- package/esm/pluggableElementTypes/models/InternetAccountModel.d.ts +26 -16
- package/esm/pluggableElementTypes/models/assertDisplayContract.d.ts +1 -1
- package/esm/pluggableElementTypes/models/baseConnectionConfig.d.ts +22 -18
- package/esm/pluggableElementTypes/models/baseConnectionConfig.js +5 -5
- package/esm/pluggableElementTypes/models/baseInternetAccountConfig.d.ts +26 -31
- package/esm/pluggableElementTypes/models/baseTrackConfig.d.ts +57 -141
- package/esm/pluggableElementTypes/models/baseTrackConfig.js +22 -26
- package/esm/pluggableElementTypes/models/components/SaveTrackData.js +2 -2
- package/esm/pluggableElementTypes/models/components/fetchTrackData.d.ts +3 -4
- package/esm/pluggableElementTypes/models/components/fetchTrackData.js +3 -3
- package/esm/pluggableElementTypes/models/expandTrackConfigShorthand.d.ts +15 -7
- package/esm/pluggableElementTypes/models/expandTrackConfigShorthand.js +38 -29
- package/esm/pluggableElementTypes/models/index.d.ts +1 -2
- package/esm/pluggableElementTypes/models/index.js +1 -2
- package/esm/pluggableElementTypes/models/saveTrackFileTypes/genbank.d.ts +3 -3
- package/esm/pluggableElementTypes/models/saveTrackFileTypes/genbank.js +4 -4
- package/esm/pluggableElementTypes/models/saveTrackFileTypes/types.d.ts +3 -3
- package/esm/rpc/BaseRpcDriver.d.ts +1 -2
- package/esm/rpc/BaseRpcDriver.js +23 -30
- package/esm/rpc/MainThreadRpcDriver.d.ts +2 -2
- package/esm/rpc/MainThreadRpcDriver.js +13 -8
- package/esm/rpc/RpcClient.d.ts +17 -6
- package/esm/rpc/RpcClient.js +42 -12
- package/esm/rpc/RpcManager.d.ts +8 -10
- package/esm/rpc/RpcManager.js +1 -1
- package/esm/rpc/RpcRegistry.d.ts +8 -2
- package/esm/rpc/RpcServer.d.ts +3 -1
- package/esm/rpc/RpcServer.js +19 -12
- package/esm/rpc/WebWorkerRpcDriver.d.ts +3 -3
- package/esm/rpc/WebWorkerRpcDriver.js +9 -47
- package/esm/rpc/byteBudget.d.ts +3 -5
- package/esm/rpc/byteBudget.js +4 -4
- package/esm/rpc/configSchema.d.ts +7 -21
- package/esm/rpc/coreRpcMethods.d.ts +1 -0
- package/esm/rpc/coreRpcMethods.js +1 -0
- package/esm/rpc/methods/CoreEncodeFeatures.d.ts +6 -5
- package/esm/rpc/methods/CoreEncodeFeatures.js +26 -31
- package/esm/rpc/methods/CoreGetEncodedFeature.d.ts +13 -0
- package/esm/rpc/methods/CoreGetEncodedFeature.js +31 -0
- package/esm/rpc/methods/CoreGetExportData.js +2 -2
- package/esm/rpc/methods/CoreGetFeatureDensity.js +2 -2
- package/esm/rpc/methods/CoreGetFeatures.js +2 -2
- package/esm/rpc/methods/CoreGetSequence.js +2 -2
- package/esm/rpc/methods/layerFeatures.d.ts +26 -0
- package/esm/rpc/methods/layerFeatures.js +40 -0
- package/esm/svg/SvgExport.js +3 -4
- package/esm/svg/SvgThemeProviders.d.ts +12 -0
- package/esm/svg/SvgThemeProviders.js +15 -0
- package/esm/svg/exportViewSvg.d.ts +32 -0
- package/esm/svg/exportViewSvg.js +13 -0
- package/esm/svg/normalizeSvgMarkup.d.ts +7 -0
- package/esm/svg/normalizeSvgMarkup.js +99 -0
- package/esm/svg/serializeSvg.d.ts +7 -0
- package/esm/svg/serializeSvg.js +11 -0
- package/esm/svg/svgReady.d.ts +8 -7
- package/esm/svg/svgReady.js +8 -7
- package/esm/svg/trackNames.d.ts +5 -5
- package/esm/svg/trackNames.js +6 -6
- package/esm/svg/wrapSvgExport.js +6 -74
- package/esm/ui/CascadingMenu.js +83 -86
- package/esm/ui/ErrorMessageStackTraceDialog.js +0 -5
- package/esm/ui/FileSelector/useInternetAccounts.d.ts +156 -96
- package/esm/ui/HoverMenu.d.ts +1 -2
- package/esm/ui/HoverMenu.js +6 -3
- package/esm/ui/JexlFilterDialog.d.ts +13 -10
- package/esm/ui/JexlFilterDialog.js +122 -49
- package/esm/ui/JexlFilterRowEditors.d.ts +15 -0
- package/esm/ui/JexlFilterRowEditors.js +90 -0
- package/esm/ui/LazyBaseTooltip.d.ts +4 -0
- package/esm/ui/LazyBaseTooltip.js +9 -0
- package/esm/ui/LoadingOverlay.js +3 -1
- package/esm/ui/MonospaceTextField.d.ts +2 -1
- package/esm/ui/MonospaceTextField.js +21 -19
- package/esm/ui/PaletteContext.d.ts +7 -9
- package/esm/ui/PaletteContext.js +24 -10
- package/esm/ui/RefNameAutocomplete/index.d.ts +1 -2
- package/esm/ui/RefNameAutocomplete/index.js +1 -1
- package/esm/ui/ScrollChrome.d.ts +6 -9
- package/esm/ui/ScrollChrome.js +5 -6
- package/esm/ui/ScrollEdgeShadow.d.ts +6 -9
- package/esm/ui/ScrollEdgeShadow.js +9 -24
- package/esm/ui/SettingsChangesTable.js +3 -3
- package/esm/ui/VerticalScrollbar.d.ts +13 -34
- package/esm/ui/VerticalScrollbar.js +29 -83
- package/esm/ui/ViewLoadingScreen.d.ts +2 -2
- package/esm/ui/ViewLoadingScreen.js +3 -3
- package/esm/ui/colorScale.d.ts +26 -1
- package/esm/ui/colorScale.js +28 -5
- package/esm/ui/colors.d.ts +49 -1
- package/esm/ui/colors.js +139 -4
- package/esm/ui/hoverBoxStyle.d.ts +14 -2
- package/esm/ui/hoverBoxStyle.js +17 -2
- package/esm/ui/index.d.ts +5 -3
- package/esm/ui/index.js +9 -7
- package/esm/ui/launchViewMenu.js +3 -3
- package/esm/ui/legendSpec.d.ts +2 -0
- package/esm/ui/legendSpec.js +3 -0
- package/esm/ui/palette.d.ts +0 -1
- package/esm/ui/palette.js +3 -27
- package/esm/ui/replaceViewAction.d.ts +1 -1
- package/esm/ui/replaceViewAction.js +1 -1
- package/esm/ui/theme.d.ts +1 -1
- package/esm/ui/theme.js +6 -40
- package/esm/ui/viewHeaderHeight.d.ts +1 -0
- package/esm/ui/viewHeaderHeight.js +1 -0
- package/esm/util/Base1DUtils.d.ts +1 -1
- package/esm/util/Base1DUtils.js +2 -2
- package/esm/util/SvgCanvas.d.ts +15 -13
- package/esm/util/SvgCanvas.js +72 -53
- package/esm/util/aborting.d.ts +39 -0
- package/esm/util/aborting.js +84 -0
- package/esm/util/adapterMetadata.d.ts +1 -1
- package/esm/util/adapterMetadata.js +6 -6
- package/esm/util/addAndShowTrack.d.ts +1 -4
- package/esm/util/addRelativeUris.d.ts +10 -2
- package/esm/util/addRelativeUris.js +22 -7
- package/esm/util/addTrackFromWidget.d.ts +2 -5
- package/esm/util/animationAllowed.d.ts +9 -0
- package/esm/util/animationAllowed.js +13 -0
- package/esm/util/applyRowResizeWheel.d.ts +10 -5
- package/esm/util/applyRowResizeWheel.js +10 -21
- package/esm/util/bandLayout.d.ts +4 -4
- package/esm/util/bandLayout.js +4 -4
- package/esm/util/bezierConnector.js +5 -4
- package/esm/util/bgzfWorkerPool.d.ts +20 -74
- package/esm/util/bgzfWorkerPool.js +20 -74
- package/esm/util/cachedSetup.d.ts +1 -1
- package/esm/util/cachedSetup.js +2 -2
- package/esm/util/categoricalField.d.ts +37 -0
- package/esm/util/categoricalField.js +52 -0
- package/esm/util/color/cssColorsLevel4.d.ts +1 -0
- package/esm/util/color/cssColorsLevel4.js +1 -0
- package/esm/util/color/index.d.ts +5 -3
- package/esm/util/color/index.js +7 -4
- package/esm/util/colorBits.d.ts +1 -2
- package/esm/util/colorBits.js +17 -39
- package/esm/util/colorRamp.d.ts +27 -1
- package/esm/util/colorRamp.js +56 -2
- package/esm/util/colorSchemes.d.ts +9 -0
- package/esm/util/colorSchemes.js +7 -0
- package/esm/util/{createStopTokenRotation.d.ts → createAbortRotation.d.ts} +11 -14
- package/esm/util/{createStopTokenRotation.js → createAbortRotation.js} +14 -26
- package/esm/util/cssColorParse.d.ts +15 -0
- package/esm/util/cssColorParse.js +53 -0
- package/esm/util/diagonalizeRegions.d.ts +2 -3
- package/esm/util/diagonalizeRegions.js +7 -12
- package/esm/util/expandLooseSearchIndex.d.ts +7 -0
- package/esm/util/expandLooseSearchIndex.js +25 -0
- package/esm/util/featureTransforms.d.ts +30 -3
- package/esm/util/featureTransforms.js +233 -36
- package/esm/util/fetchAndMaybeUnzip.js +5 -6
- package/esm/util/fetchContext.d.ts +5 -6
- package/esm/util/fetchContext.js +1 -1
- package/esm/util/fetchHub.d.ts +3 -1
- package/esm/util/fetchHub.js +2 -2
- package/esm/util/fetchSeq.d.ts +2 -3
- package/esm/util/fetchSeq.js +2 -2
- package/esm/util/fieldReader.d.ts +17 -0
- package/esm/util/fieldReader.js +62 -0
- package/esm/util/groupKeys.d.ts +75 -0
- package/esm/util/groupKeys.js +152 -0
- package/esm/util/highlights.d.ts +6 -4
- package/esm/util/highlights.js +12 -25
- package/esm/util/hooks.d.ts +1 -2
- package/esm/util/hooks.js +1 -2
- package/esm/util/index.d.ts +3 -3
- package/esm/util/index.js +4 -3
- package/esm/util/indexCandidates.js +1 -1
- package/esm/util/installFetch.d.ts +13 -10
- package/esm/util/installFetch.js +11 -10
- package/esm/util/installPrerequisiteFetch.d.ts +5 -3
- package/esm/util/installPrerequisiteFetch.js +3 -4
- package/esm/util/io/index.js +12 -12
- package/esm/util/isDataCurrent.d.ts +7 -5
- package/esm/util/isDataCurrent.js +9 -6
- package/esm/util/jexl.js +24 -21
- package/esm/util/jexlFilterRows.d.ts +89 -0
- package/esm/util/jexlFilterRows.js +252 -0
- package/esm/util/jexlFilters.d.ts +7 -5
- package/esm/util/jexlStrings.d.ts +3 -4
- package/esm/util/jexlStrings.js +2 -3
- package/esm/util/legendCandidates.d.ts +31 -27
- package/esm/util/legendCandidates.js +79 -53
- package/esm/util/localStorage.js +4 -4
- package/esm/util/markEncoding.d.ts +32 -16
- package/esm/util/markEncoding.js +177 -150
- package/esm/util/markEncodingTypes.d.ts +137 -66
- package/esm/util/mstUtils.d.ts +19 -22
- package/esm/util/mstUtils.js +19 -22
- package/esm/util/numericUtils.d.ts +7 -0
- package/esm/util/numericUtils.js +16 -0
- package/esm/util/numericValue.d.ts +14 -0
- package/esm/util/numericValue.js +34 -0
- package/esm/util/openFeatureWidget.js +1 -2
- package/esm/util/openViews.d.ts +1 -0
- package/esm/util/openViews.js +3 -3
- package/esm/util/parseLineByLine.d.ts +3 -4
- package/esm/util/parseLineByLine.js +7 -13
- package/esm/util/progress.d.ts +21 -21
- package/esm/util/progress.js +27 -26
- package/esm/util/renameRegions.d.ts +1 -2
- package/esm/util/renderToStaticMarkup.js +16 -16
- package/esm/util/rxjs.d.ts +7 -8
- package/esm/util/rxjs.js +12 -15
- package/esm/util/simpleFeature.d.ts +0 -1
- package/esm/util/svgColorProps.d.ts +11 -0
- package/esm/util/svgColorProps.js +28 -1
- package/esm/util/tabix.d.ts +3 -4
- package/esm/util/tabix.js +6 -7
- package/esm/util/thresholdScale.d.ts +54 -0
- package/esm/util/thresholdScale.js +112 -0
- package/esm/util/timeGate.d.ts +4 -5
- package/esm/util/timeGate.js +4 -5
- package/esm/util/trackConfigDelta.d.ts +22 -18
- package/esm/util/trackConfigDelta.js +40 -38
- package/esm/util/tracks.d.ts +27 -4
- package/esm/util/tracks.js +116 -43
- package/esm/util/translateTranscript.d.ts +44 -0
- package/esm/util/translateTranscript.js +102 -0
- package/esm/util/types/index.d.ts +19 -7
- package/esm/util/types/services.d.ts +1 -1
- package/esm/util/unknownSnapshotKeys.d.ts +15 -0
- package/esm/util/unknownSnapshotKeys.js +13 -0
- package/esm/util/useFeatureSequence.js +4 -4
- package/esm/util/useFetch.d.ts +3 -4
- package/esm/util/useFetch.js +5 -6
- package/esm/util/usePanelVirtualScroll.d.ts +7 -39
- package/esm/util/usePanelVirtualScroll.js +9 -40
- package/esm/util/useRowVirtualScroll.d.ts +6 -29
- package/esm/util/useRowVirtualScroll.js +8 -49
- package/esm/util/useVirtualScrollWheel.d.ts +20 -4
- package/esm/util/useVirtualScrollWheel.js +40 -84
- package/esm/util/viewHighlights.d.ts +3 -0
- package/esm/util/viewHighlights.js +5 -0
- package/esm/util/viewStatus.d.ts +24 -15
- package/esm/util/viewStatus.js +17 -0
- package/esm/util/withLaunchInput.d.ts +1 -1
- package/esm/util/withLaunchInput.js +0 -4
- package/package.json +26 -12
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/test_data/DLGAP3.d.ts +0 -80
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/test_data/DLGAP3.js +0 -583
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/test_data/NCDN.d.ts +0 -141
- package/esm/BaseFeatureWidget/SequenceFeatureDetails/test_data/NCDN.js +0 -1116
- package/esm/ReExports/BaseFeatureDetails.d.ts +0 -1
- package/esm/ReExports/BaseFeatureDetails.js +0 -10
- package/esm/ReExports/barrelOnlyNames.d.ts +0 -5
- package/esm/ReExports/barrelOnlyNames.js +0 -63
- package/esm/ReExports/index.d.ts +0 -1
- package/esm/ReExports/index.js +0 -1
- package/esm/ReExports/publicTracks.d.ts +0 -1
- package/esm/ReExports/publicTracks.js +0 -14
- package/esm/ReExports/publicUi.d.ts +0 -4
- package/esm/ReExports/publicUi.js +0 -33
- package/esm/ReExports/publicUtil.d.ts +0 -1
- package/esm/ReExports/publicUtil.js +0 -32
- package/esm/ReExports/sharedModules.d.ts +0 -96
- package/esm/ReExports/sharedModules.js +0 -66
- package/esm/ReExports/workerNamespaceNames.d.ts +0 -11
- package/esm/ReExports/workerNamespaceNames.js +0 -275
- package/esm/pluggableElementTypes/models/HighlightsMixin.d.ts +0 -51
- package/esm/pluggableElementTypes/models/HighlightsMixin.js +0 -78
- package/esm/ui/highlightChipReveal.d.ts +0 -32
- package/esm/ui/highlightChipReveal.js +0 -39
- package/esm/util/adapterConfigKey.d.ts +0 -12
- package/esm/util/adapterConfigKey.js +0 -14
- package/esm/util/stopToken.d.ts +0 -212
- package/esm/util/stopToken.js +0 -438
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** #api */
|
|
2
|
+
export declare const STRAND_FIELD = "strand";
|
|
3
|
+
/**
|
|
4
|
+
* #api
|
|
5
|
+
* The row a feature with nothing in a categorical field lands on, so a key
|
|
6
|
+
* says why a mark is grey rather than listing a blank value.
|
|
7
|
+
*/
|
|
8
|
+
export declare const NO_VALUE_LABEL = "(no value)";
|
|
9
|
+
/**
|
|
10
|
+
* #api
|
|
11
|
+
* One categorical field as every channel reads it — a facet's sections, a
|
|
12
|
+
* color's range entries, a key's rows. `key` files a value, `compare`
|
|
13
|
+
* orders keys (the `domain` first, the rest by `compareGroupKeys`, `''`
|
|
14
|
+
* after them), `label` names a key in a legend, `sectionLabel` on a chip, and
|
|
15
|
+
* `color` paints it. A key's color depends only on the key and the
|
|
16
|
+
* declaration, so every region agrees on it.
|
|
17
|
+
*/
|
|
18
|
+
export interface CategoricalField {
|
|
19
|
+
field: string;
|
|
20
|
+
/** The declared order, or the field's own where none is declared. */
|
|
21
|
+
domain: readonly string[];
|
|
22
|
+
/**
|
|
23
|
+
* Every key a value can file under is in `domain`, as a threshold scale's
|
|
24
|
+
* bins are, so a key lists all of them whether or not anything painted one.
|
|
25
|
+
*/
|
|
26
|
+
closed?: boolean;
|
|
27
|
+
key: (value: unknown) => string;
|
|
28
|
+
compare: (a: string, b: string) => number;
|
|
29
|
+
label: (key: string) => string;
|
|
30
|
+
sectionLabel: (key: string) => string;
|
|
31
|
+
color: (key: string) => string;
|
|
32
|
+
}
|
|
33
|
+
/** #api */
|
|
34
|
+
export declare function categoricalField(field: string, { domain, range, }?: {
|
|
35
|
+
domain?: readonly string[];
|
|
36
|
+
range?: readonly string[];
|
|
37
|
+
}): CategoricalField;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { categoricalColorScale } from '../ui/colors.js';
|
|
2
|
+
import { NO_CATEGORY_COLOR } from './color/index.js';
|
|
3
|
+
import { groupKeyComparator, valueText } from './groupKeys.js';
|
|
4
|
+
/** #api */
|
|
5
|
+
export const STRAND_FIELD = 'strand';
|
|
6
|
+
/**
|
|
7
|
+
* #api
|
|
8
|
+
* The row a feature with nothing in a categorical field lands on, so a key
|
|
9
|
+
* says why a mark is grey rather than listing a blank value.
|
|
10
|
+
*/
|
|
11
|
+
export const NO_VALUE_LABEL = '(no value)';
|
|
12
|
+
// A field whose values have names, an order and colors of their own, so
|
|
13
|
+
// every channel reading it agrees without a config saying so. Red forward and
|
|
14
|
+
// blue reverse is the vocabulary the synteny ribbons paint too.
|
|
15
|
+
const VOCABULARIES = {
|
|
16
|
+
[STRAND_FIELD]: {
|
|
17
|
+
missing: '0',
|
|
18
|
+
domain: ['1', '-1', '0'],
|
|
19
|
+
range: ['tomato', 'cornflowerblue', 'goldenrod'],
|
|
20
|
+
labels: {
|
|
21
|
+
'1': 'Forward strand',
|
|
22
|
+
'-1': 'Reverse strand',
|
|
23
|
+
'0': 'No strand',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
/** #api */
|
|
28
|
+
export function categoricalField(field, { domain = [], range = [], } = {}) {
|
|
29
|
+
const vocabulary = VOCABULARIES[field];
|
|
30
|
+
const order = domain.length > 0 ? domain : (vocabulary?.domain ?? []);
|
|
31
|
+
const colors = range.length > 0 ? range : (vocabulary?.range ?? []);
|
|
32
|
+
const named = (key) => vocabulary?.labels[key];
|
|
33
|
+
let colorOf;
|
|
34
|
+
return {
|
|
35
|
+
field,
|
|
36
|
+
domain: order,
|
|
37
|
+
key: value => {
|
|
38
|
+
const key = valueText(value);
|
|
39
|
+
return key === '' && vocabulary ? vocabulary.missing : key;
|
|
40
|
+
},
|
|
41
|
+
compare: groupKeyComparator(order),
|
|
42
|
+
label: key => named(key) ?? (key === '' ? NO_VALUE_LABEL : key),
|
|
43
|
+
sectionLabel: key => named(key) ?? `${field}: ${key === '' ? 'none' : key}`,
|
|
44
|
+
color: key => {
|
|
45
|
+
if (key === '') {
|
|
46
|
+
return NO_CATEGORY_COLOR;
|
|
47
|
+
}
|
|
48
|
+
colorOf ??= categoricalColorScale(order, colors);
|
|
49
|
+
return colorOf(key);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -20,7 +20,9 @@ export declare function emphasize(color: string, coefficient?: number): string;
|
|
|
20
20
|
* default refName colors.
|
|
21
21
|
*/
|
|
22
22
|
export declare function makeContrasting(foreground: string, background?: string, minContrastRatio?: number): string;
|
|
23
|
-
export { isNamedColor, namedColorToHex } from './cssColorsLevel4.ts';
|
|
23
|
+
export { CSS_COLOR_NAMES, isNamedColor, namedColorToHex, } from './cssColorsLevel4.ts';
|
|
24
|
+
export declare const NO_CATEGORY_COLOR = "#afafaf";
|
|
25
|
+
export declare const MISCONFIGURED_COLOR = "#808080";
|
|
24
26
|
/**
|
|
25
27
|
* #api
|
|
26
28
|
* Move a color's OKLCH lightness by `lightnessShift` and scale its chroma,
|
|
@@ -69,8 +71,8 @@ export declare function relight(color: string, lightnessShift: number, chromaSca
|
|
|
69
71
|
*
|
|
70
72
|
* A value that is absent gets NO_CATEGORY_COLOR rather than a hue, and that is
|
|
71
73
|
* the difference between this being usable on real data and not. The everyday
|
|
72
|
-
* caller is
|
|
73
|
-
*
|
|
74
|
+
* caller is a `jexl:randomColor(get(feature,'<attr>'))` color slot over a
|
|
75
|
+
* whole track — and most files
|
|
74
76
|
* have the attribute on some features and not others, so most of the time this
|
|
75
77
|
* is handed `undefined`. It used to throw on that (`str.length` of undefined),
|
|
76
78
|
* once per feature, and what a reader saw was every unlabelled feature in one
|
package/esm/util/color/index.js
CHANGED
|
@@ -72,7 +72,7 @@ export function makeContrasting(foreground, background = 'white', minContrastRat
|
|
|
72
72
|
}
|
|
73
73
|
return best;
|
|
74
74
|
}
|
|
75
|
-
export { isNamedColor, namedColorToHex } from './cssColorsLevel4.js';
|
|
75
|
+
export { CSS_COLOR_NAMES, isNamedColor, namedColorToHex, } from './cssColorsLevel4.js';
|
|
76
76
|
// The (lightness, chroma) tiers randomColor picks between, in OKLCH. Values are
|
|
77
77
|
// in the band a hand-built categorical palette occupies — bright enough to tell
|
|
78
78
|
// apart, dark enough that black text over one still reads, and never near
|
|
@@ -81,7 +81,10 @@ export { isNamedColor, namedColorToHex } from './cssColorsLevel4.js';
|
|
|
81
81
|
// What a value-less feature is painted. Neutral and unsaturated on purpose: it
|
|
82
82
|
// has to read as "not in a category" beside a palette whose every member is
|
|
83
83
|
// equally light and equally colorful, so it cannot be one more hue.
|
|
84
|
-
const NO_CATEGORY_COLOR = '#afafaf';
|
|
84
|
+
export const NO_CATEGORY_COLOR = '#afafaf';
|
|
85
|
+
// What a colour declaration paints where it reads nothing it can colour, so a
|
|
86
|
+
// misconfiguration surfaces rather than passing for the no-category grey.
|
|
87
|
+
export const MISCONFIGURED_COLOR = '#808080';
|
|
85
88
|
const RANDOM_COLOR_TIERS = [
|
|
86
89
|
{ lightness: 0.66, chroma: 0.15 },
|
|
87
90
|
{ lightness: 0.56, chroma: 0.14 },
|
|
@@ -175,8 +178,8 @@ export function relight(color, lightnessShift, chromaScale = 1) {
|
|
|
175
178
|
*
|
|
176
179
|
* A value that is absent gets NO_CATEGORY_COLOR rather than a hue, and that is
|
|
177
180
|
* the difference between this being usable on real data and not. The everyday
|
|
178
|
-
* caller is
|
|
179
|
-
*
|
|
181
|
+
* caller is a `jexl:randomColor(get(feature,'<attr>'))` color slot over a
|
|
182
|
+
* whole track — and most files
|
|
180
183
|
* have the attribute on some features and not others, so most of the time this
|
|
181
184
|
* is handed `undefined`. It used to throw on that (`str.length` of undefined),
|
|
182
185
|
* once per feature, and what a reader saw was every unlabelled feature in one
|
package/esm/util/colorBits.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { abgrToCssRgba } from '@jbrowse/render-core/marks/colorFill';
|
|
2
|
-
import type { Color } from './color-bits/index.ts';
|
|
3
2
|
import type { Feature } from './simpleFeature.ts';
|
|
4
3
|
export { abgrToCssRgba };
|
|
4
|
+
export { isCssColor, parseCssColorOr } from './cssColorParse.ts';
|
|
5
5
|
export { alpha, blend, darken, formatHEX, formatHEXA, formatRGBA, getAlpha, getBlue, getGreen, getLuminance, getRed, lighten, newColor, parse, toHSLA, toRGBA, } from './color-bits/index.ts';
|
|
6
6
|
export type { Color } from './color-bits/index.ts';
|
|
7
7
|
/**
|
|
@@ -19,7 +19,6 @@ export declare function featureItemRgb(raw: unknown): string | undefined;
|
|
|
19
19
|
* undefined if it declares none.
|
|
20
20
|
*/
|
|
21
21
|
export declare function featureBedColor(feature: Feature): string | undefined;
|
|
22
|
-
export declare function parseCssColorOr(color: string, fallback: Color): Color;
|
|
23
22
|
export declare function parseCssColor(color: string | undefined | null): number;
|
|
24
23
|
export declare function cssColorToNormalizedRgb(color: string): [number, number, number];
|
|
25
24
|
export declare function cssColorToRgb(color: string): [number, number, number];
|
package/esm/util/colorBits.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { abgrToCssRgba } from '@jbrowse/render-core/marks/colorFill';
|
|
2
|
-
import { getAlpha, getBlue, getGreen, getRed, newColor,
|
|
3
|
-
import {
|
|
2
|
+
import { getAlpha, getBlue, getGreen, getRed, newColor, } from './color-bits/index.js';
|
|
3
|
+
import { bedTriple, parseCssColorOr } from './cssColorParse.js';
|
|
4
4
|
export { abgrToCssRgba };
|
|
5
|
+
export { isCssColor, parseCssColorOr } from './cssColorParse.js';
|
|
5
6
|
export { alpha, blend, darken, formatHEX, formatHEXA, formatRGBA, getAlpha, getBlue, getGreen, getLuminance, getRed, lighten, newColor, parse, toHSLA, toRGBA, } from './color-bits/index.js';
|
|
6
7
|
// Magenta sentinel for invalid input. User-written jexl color callbacks can
|
|
7
8
|
// legitimately return undefined (e.g. when a feature lacks the field they
|
|
@@ -9,10 +10,6 @@ export { alpha, blend, darken, formatHEX, formatHEXA, formatRGBA, getAlpha, getB
|
|
|
9
10
|
// Returning magenta makes the bad slot visually obvious without breaking the
|
|
10
11
|
// rest of the render.
|
|
11
12
|
const INVALID_COLOR = newColor(255, 0, 255, 255);
|
|
12
|
-
// A bare BED color triple ("255,0,0"), which is not a CSS color but is what
|
|
13
|
-
// BED-family adapters put on the feature verbatim. The spec has no spaces, but
|
|
14
|
-
// tolerate them rather than silently ignoring an otherwise-usable color.
|
|
15
|
-
const BED_TRIPLE = /^(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/;
|
|
16
13
|
// UCSC's convention is that a color of "0" means "no color specified", and plain
|
|
17
14
|
// BED12 files fill the column with that placeholder (often spelled as the
|
|
18
15
|
// all-zero triple) rather than omitting it — every itemRgb in our own
|
|
@@ -20,17 +17,6 @@ const BED_TRIPLE = /^(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/;
|
|
|
20
17
|
// ordinary BED12 track solid black, so read them as absent. A file that really
|
|
21
18
|
// wants black can say so with an explicit `color` slot.
|
|
22
19
|
const BED_TRIPLE_UNSET = /^0(,0,0)?$/;
|
|
23
|
-
/**
|
|
24
|
-
* Normalize a bare BED color triple to canonical "r,g,b", or undefined if the
|
|
25
|
-
* string isn't one. Each component must be in range: the underlying parser
|
|
26
|
-
* masks to 8 bits, so a bogus "999,0,0" would otherwise *wrap* to 231 and paint
|
|
27
|
-
* a plausible-looking but wrong color rather than being caught.
|
|
28
|
-
*/
|
|
29
|
-
function bedTriple(str) {
|
|
30
|
-
const m = BED_TRIPLE.exec(str.trim());
|
|
31
|
-
const rgb = m?.slice(1, 4).map(Number);
|
|
32
|
-
return rgb?.every(n => n <= 255) ? rgb.join(',') : undefined;
|
|
33
|
-
}
|
|
34
20
|
/**
|
|
35
21
|
* One raw attribute value as a usable BED color, or undefined when it isn't
|
|
36
22
|
* one. Deliberately strict: this feeds an *automatic* coloring path, so a value
|
|
@@ -75,27 +61,6 @@ export function featureBedColor(feature) {
|
|
|
75
61
|
}
|
|
76
62
|
return found;
|
|
77
63
|
}
|
|
78
|
-
// Resolve a CSS color string to a Color: honors named colors, `transparent`,
|
|
79
|
-
// and bare BED color triples, and returns `fallback` on malformed-but-nonempty
|
|
80
|
-
// input. `parse` throws on e.g. an empty "rgb()"; callers pass a fallback so one
|
|
81
|
-
// bad per-feature color can't crash a whole render/RPC. An out-of-range triple
|
|
82
|
-
// is left to throw into `fallback` (magenta) rather than wrapping to a wrong
|
|
83
|
-
// color — the same rule featureItemRgb applies, so a jexl callback reading an
|
|
84
|
-
// itemRgb column and the automatic path agree on what counts as a color.
|
|
85
|
-
export function parseCssColorOr(color, fallback) {
|
|
86
|
-
const str = color.trim().toLowerCase();
|
|
87
|
-
if (str === 'transparent') {
|
|
88
|
-
return newColor(0, 0, 0, 0);
|
|
89
|
-
}
|
|
90
|
-
try {
|
|
91
|
-
const hex = namedColorToHex(str);
|
|
92
|
-
const triple = bedTriple(str);
|
|
93
|
-
return parse(hex ? hex : triple ? `rgb(${triple})` : str);
|
|
94
|
-
}
|
|
95
|
-
catch {
|
|
96
|
-
return fallback;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
64
|
export function parseCssColor(color) {
|
|
100
65
|
if (typeof color !== 'string' || color.length === 0) {
|
|
101
66
|
return INVALID_COLOR;
|
|
@@ -120,9 +85,22 @@ export function cssColorToRgba(color) {
|
|
|
120
85
|
export function packAbgr(r, g, b, a) {
|
|
121
86
|
return ((a << 24) | (b << 16) | (g << 8) | r) >>> 0;
|
|
122
87
|
}
|
|
88
|
+
// A packer resolves the same few strings once per primitive, so the parse is
|
|
89
|
+
// cached by string. Capped, because BED itemRgb triples are unbounded.
|
|
90
|
+
const ABGR_CACHE_LIMIT = 4096;
|
|
91
|
+
const abgrByCss = new Map();
|
|
123
92
|
export function cssColorToABGR(color) {
|
|
93
|
+
const cached = abgrByCss.get(color);
|
|
94
|
+
if (cached !== undefined) {
|
|
95
|
+
return cached;
|
|
96
|
+
}
|
|
124
97
|
const c = parseCssColor(color);
|
|
125
|
-
|
|
98
|
+
const packed = packAbgr(getRed(c), getGreen(c), getBlue(c), getAlpha(c));
|
|
99
|
+
if (abgrByCss.size >= ABGR_CACHE_LIMIT) {
|
|
100
|
+
abgrByCss.clear();
|
|
101
|
+
}
|
|
102
|
+
abgrByCss.set(color, packed);
|
|
103
|
+
return packed;
|
|
126
104
|
}
|
|
127
105
|
// Replace the alpha byte of an ABGR-packed u32, keeping its RGB. RGB already
|
|
128
106
|
// occupies the low 24 bits (b<<16 | g<<8 | r), so this is a mask + or — no
|
package/esm/util/colorRamp.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RampStop } from '../ui/colorScale.ts';
|
|
2
|
+
import type { ColorSchemeName } from './colorSchemes.ts';
|
|
2
3
|
/** One evenly-spaced ramp stop: 8-bit red, green, blue, alpha. */
|
|
3
4
|
export type ColorRampStop = readonly [number, number, number, number];
|
|
4
5
|
/**
|
|
@@ -8,6 +9,25 @@ export type ColorRampStop = readonly [number, number, number, number];
|
|
|
8
9
|
* stops.
|
|
9
10
|
*/
|
|
10
11
|
export declare const VIRIDIS_STOPS: readonly ColorRampStop[];
|
|
12
|
+
/**
|
|
13
|
+
* #api
|
|
14
|
+
* The domain a continuous colour scale spans: each end `min` or `max` pins,
|
|
15
|
+
* else the extent's, ascending, since a span has no direction and `reverse`
|
|
16
|
+
* is the ramp's. An open end stops at a pinned one rather than crossing it,
|
|
17
|
+
* and an extent holding no value (`[Infinity, -Infinity]`) spans [0, 1].
|
|
18
|
+
*/
|
|
19
|
+
export declare function rampDomain(min: number | undefined, max: number | undefined, extent: readonly [number, number]): [number, number];
|
|
20
|
+
/**
|
|
21
|
+
* #api
|
|
22
|
+
* The stops a continuous colour scale samples: `range`'s CSS colours where it
|
|
23
|
+
* lists any, else the named `scheme`, viridis while that is unset, turned
|
|
24
|
+
* round under `reverse`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function colorRampStops({ range, scheme, reverse, }: {
|
|
27
|
+
range?: readonly string[];
|
|
28
|
+
scheme?: ColorSchemeName;
|
|
29
|
+
reverse?: boolean;
|
|
30
|
+
}): readonly ColorRampStop[];
|
|
11
31
|
/**
|
|
12
32
|
* #api
|
|
13
33
|
* The color at `t` in `[0, 1]` across a list of EVENLY SPACED stops, linearly
|
|
@@ -22,8 +42,14 @@ export declare function sampleColorRamp(stops: readonly ColorRampStop[], t: numb
|
|
|
22
42
|
* texture both GPU backends upload and the Canvas2D twins index — entry `i` is
|
|
23
43
|
* the color at `t = i / (N - 1)`. N comes off the shader that samples it, so
|
|
24
44
|
* the table and `rampColor`'s texel mapping cannot disagree.
|
|
45
|
+
*
|
|
46
|
+
* `mid` is where the stop list's own midpoint lands in the table, so a
|
|
47
|
+
* diverging ramp whose middle colour belongs at a value off the centre of the
|
|
48
|
+
* domain is baked into the bytes. Every reader — the shader, the Canvas2D
|
|
49
|
+
* fillStyle table, the legend bar — then samples one evenly spaced table and
|
|
50
|
+
* cannot disagree about the warp.
|
|
25
51
|
*/
|
|
26
|
-
export declare function buildColorRampLut(stops: readonly ColorRampStop[]): Uint8Array<ArrayBuffer>;
|
|
52
|
+
export declare function buildColorRampLut(stops: readonly ColorRampStop[], mid?: number): Uint8Array<ArrayBuffer>;
|
|
27
53
|
/**
|
|
28
54
|
* #api
|
|
29
55
|
* `n` evenly spaced legend stops read straight out of a
|
package/esm/util/colorRamp.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { COLOR_RAMP_LUT_ENTRIES } from '@jbrowse/render-core/colorRampLut';
|
|
2
|
+
import { cssColorToRgba } from './colorBits.js';
|
|
2
3
|
// Viridis full 256-color hex spec, kept whole so a LUT built from these stops
|
|
3
4
|
// carries the smooth perceptually-uniform gradient rather than an
|
|
4
5
|
// interpolation over a subset. Lived in the hic plugin until wiggle density
|
|
@@ -25,6 +26,42 @@ function viridisStopsFromHex() {
|
|
|
25
26
|
* stops.
|
|
26
27
|
*/
|
|
27
28
|
export const VIRIDIS_STOPS = viridisStopsFromHex();
|
|
29
|
+
const SCHEME_STOPS = {
|
|
30
|
+
viridis: VIRIDIS_STOPS,
|
|
31
|
+
};
|
|
32
|
+
const EMPTY_EXTENT_DOMAIN = [0, 1];
|
|
33
|
+
/**
|
|
34
|
+
* #api
|
|
35
|
+
* The domain a continuous colour scale spans: each end `min` or `max` pins,
|
|
36
|
+
* else the extent's, ascending, since a span has no direction and `reverse`
|
|
37
|
+
* is the ramp's. An open end stops at a pinned one rather than crossing it,
|
|
38
|
+
* and an extent holding no value (`[Infinity, -Infinity]`) spans [0, 1].
|
|
39
|
+
*/
|
|
40
|
+
export function rampDomain(min, max, extent) {
|
|
41
|
+
const [lo, hi] = extent[0] <= extent[1] ? extent : EMPTY_EXTENT_DOMAIN;
|
|
42
|
+
if (min !== undefined && max !== undefined) {
|
|
43
|
+
return min <= max ? [min, max] : [max, min];
|
|
44
|
+
}
|
|
45
|
+
if (min !== undefined) {
|
|
46
|
+
return [min, Math.max(min, hi)];
|
|
47
|
+
}
|
|
48
|
+
if (max !== undefined) {
|
|
49
|
+
return [Math.min(lo, max), max];
|
|
50
|
+
}
|
|
51
|
+
return [lo, hi];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* #api
|
|
55
|
+
* The stops a continuous colour scale samples: `range`'s CSS colours where it
|
|
56
|
+
* lists any, else the named `scheme`, viridis while that is unset, turned
|
|
57
|
+
* round under `reverse`.
|
|
58
|
+
*/
|
|
59
|
+
export function colorRampStops({ range, scheme, reverse, }) {
|
|
60
|
+
const stops = range?.length
|
|
61
|
+
? range.map(c => cssColorToRgba(c))
|
|
62
|
+
: SCHEME_STOPS[scheme ?? 'viridis'];
|
|
63
|
+
return reverse ? stops.toReversed() : stops;
|
|
64
|
+
}
|
|
28
65
|
function lerp8(a, b, t) {
|
|
29
66
|
return Math.round(a * (1 - t) + b * t);
|
|
30
67
|
}
|
|
@@ -54,12 +91,20 @@ export function sampleColorRamp(stops, t) {
|
|
|
54
91
|
* texture both GPU backends upload and the Canvas2D twins index — entry `i` is
|
|
55
92
|
* the color at `t = i / (N - 1)`. N comes off the shader that samples it, so
|
|
56
93
|
* the table and `rampColor`'s texel mapping cannot disagree.
|
|
94
|
+
*
|
|
95
|
+
* `mid` is where the stop list's own midpoint lands in the table, so a
|
|
96
|
+
* diverging ramp whose middle colour belongs at a value off the centre of the
|
|
97
|
+
* domain is baked into the bytes. Every reader — the shader, the Canvas2D
|
|
98
|
+
* fillStyle table, the legend bar — then samples one evenly spaced table and
|
|
99
|
+
* cannot disagree about the warp.
|
|
57
100
|
*/
|
|
58
|
-
export function buildColorRampLut(stops) {
|
|
101
|
+
export function buildColorRampLut(stops, mid = 0.5) {
|
|
59
102
|
const last = COLOR_RAMP_LUT_ENTRIES - 1;
|
|
60
103
|
const data = new Uint8Array(COLOR_RAMP_LUT_ENTRIES * 4);
|
|
104
|
+
const m = Math.min(1, Math.max(0, mid));
|
|
61
105
|
for (let i = 0; i < COLOR_RAMP_LUT_ENTRIES; i++) {
|
|
62
|
-
const
|
|
106
|
+
const t = i / last;
|
|
107
|
+
const [r, g, b, a] = sampleColorRamp(stops, unwarp(t, m));
|
|
63
108
|
data[i * 4] = r;
|
|
64
109
|
data[i * 4 + 1] = g;
|
|
65
110
|
data[i * 4 + 2] = b;
|
|
@@ -67,6 +112,15 @@ export function buildColorRampLut(stops) {
|
|
|
67
112
|
}
|
|
68
113
|
return data;
|
|
69
114
|
}
|
|
115
|
+
function unwarp(t, mid) {
|
|
116
|
+
if (mid <= 0) {
|
|
117
|
+
return t >= 1 ? 1 : 0.5 + 0.5 * t;
|
|
118
|
+
}
|
|
119
|
+
if (mid >= 1) {
|
|
120
|
+
return t <= 0 ? 0 : 0.5 * t;
|
|
121
|
+
}
|
|
122
|
+
return t <= mid ? (0.5 * t) / mid : 0.5 + (0.5 * (t - mid)) / (1 - mid);
|
|
123
|
+
}
|
|
70
124
|
/**
|
|
71
125
|
* #api
|
|
72
126
|
* `n` evenly spaced legend stops read straight out of a
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* #api
|
|
3
|
+
* The named ramps a continuous colour scale's `scheme` takes, each one a stop
|
|
4
|
+
* table in `colorRamp.ts` that every ramp baker reads, so no display can name
|
|
5
|
+
* a scheme nothing bakes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const COLOR_SCHEMES: readonly ['viridis'];
|
|
8
|
+
/** #api */
|
|
9
|
+
export type ColorSchemeName = (typeof COLOR_SCHEMES)[number];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { RpcStatus, StatusWindow } from './progress.ts';
|
|
2
|
-
import type { StopToken } from './stopToken.ts';
|
|
3
2
|
import type { IStateTreeNode } from '@jbrowse/mobx-state-tree';
|
|
4
3
|
/**
|
|
5
4
|
* Where a rotation reports, in the one of two modes the host is actually in.
|
|
@@ -51,8 +50,7 @@ export interface StatusChannel {
|
|
|
51
50
|
}
|
|
52
51
|
export declare function createStatusChannel(): StatusChannel;
|
|
53
52
|
export interface ActiveFetch {
|
|
54
|
-
|
|
55
|
-
stopToken: StopToken;
|
|
53
|
+
signal: AbortSignal;
|
|
56
54
|
/**
|
|
57
55
|
* True only while this is still the most recent fetch AND `self` is alive.
|
|
58
56
|
* Gate every post-await write — result commit, error set — on it so a
|
|
@@ -73,8 +71,8 @@ export interface ActiveFetch {
|
|
|
73
71
|
* other operation on the host is still reporting.
|
|
74
72
|
*
|
|
75
73
|
* Both together, because a caller doing it by hand gets a subset.
|
|
76
|
-
* `isCurrent` is `
|
|
77
|
-
* never rotates its own
|
|
74
|
+
* `isCurrent` is `signal === current && isAlive`, and a run that *completes*
|
|
75
|
+
* never rotates its own signal — so without this the guard stays open past the
|
|
78
76
|
* work and a trailing write lands on top of a hand-written
|
|
79
77
|
* `setStatusMessage(undefined)` up to a window later.
|
|
80
78
|
*
|
|
@@ -85,19 +83,18 @@ export interface ActiveFetch {
|
|
|
85
83
|
end: () => void;
|
|
86
84
|
}
|
|
87
85
|
/**
|
|
88
|
-
* Latest-wins
|
|
86
|
+
* Latest-wins abort rotation for a fetch that runs in a bare `autorun`
|
|
89
87
|
* rather than through `FetchMixin.runFetch` (which welds the same mechanics to
|
|
90
88
|
* `fetchGeneration`, so it's only for viewport-driven LGV fetches). Each
|
|
91
|
-
* `begin()` aborts the prior fetch
|
|
92
|
-
* `isCurrent()` guard that captures this run
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* token by hand.
|
|
89
|
+
* `begin()` aborts the prior fetch and returns a fresh signal plus an
|
|
90
|
+
* `isCurrent()` guard that captures this run — gate every post-await write on
|
|
91
|
+
* it and a superseded or torn-down fetch can never clobber fresher data. The
|
|
92
|
+
* guard is the return value, so a caller can't forget to compare by hand.
|
|
96
93
|
*
|
|
97
94
|
* `end()` in the run's `finally` is the other half, and for the same reason —
|
|
98
95
|
* see {@link ActiveFetch.end} for the two things it does together.
|
|
99
96
|
*
|
|
100
|
-
* Owns the
|
|
97
|
+
* Owns the controller and the status channel; the caller keeps its own
|
|
101
98
|
* loading/error/commit side-effects. Three holders: `FetchMixin` as a member
|
|
102
99
|
* (so `cancelFetch` can reach it), `installFetch` one per installation (every
|
|
103
100
|
* other fetch in the tree runs on that skeleton), and the synteny diagonalize
|
|
@@ -111,8 +108,8 @@ export interface ActiveFetch {
|
|
|
111
108
|
* passes a {@link createStatusChannel}, which is one volatile instead of two
|
|
112
109
|
* fields and an action.
|
|
113
110
|
*/
|
|
114
|
-
export type
|
|
115
|
-
export declare function
|
|
111
|
+
export type AbortRotation = ReturnType<typeof createAbortRotation>;
|
|
112
|
+
export declare function createAbortRotation(self: IStateTreeNode, report: StatusReporter): {
|
|
116
113
|
begin(): ActiveFetch;
|
|
117
114
|
cancel: () => void;
|
|
118
115
|
dispose(): void;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { isAlive } from '@jbrowse/mobx-state-tree';
|
|
2
2
|
import { observable, runInAction } from 'mobx';
|
|
3
3
|
import { createStatusWindow, statusFraction, statusMessageText, } from './progress.js';
|
|
4
|
-
import { createStopToken, stopStopToken } from './stopToken.js';
|
|
5
4
|
export function createStatusChannel() {
|
|
6
5
|
// MobX rather than MST, so this is a value a model can hold rather than a
|
|
7
6
|
// node it has to parent. A volatile is `observable.ref`, so the fields have
|
|
@@ -28,8 +27,8 @@ export function createStatusChannel() {
|
|
|
28
27
|
},
|
|
29
28
|
};
|
|
30
29
|
}
|
|
31
|
-
export function
|
|
32
|
-
let
|
|
30
|
+
export function createAbortRotation(self, report) {
|
|
31
|
+
let current;
|
|
33
32
|
// The host's window when it has one, so a display composing `FetchMixin` has
|
|
34
33
|
// one window rather than two writing one field; our own otherwise. Lent means
|
|
35
34
|
// this fetch is one slot beside the host's others rather than a second writer
|
|
@@ -49,8 +48,8 @@ export function createStopTokenRotation(self, report) {
|
|
|
49
48
|
/**
|
|
50
49
|
* Stop the in-flight fetch without starting one, and retire its slot.
|
|
51
50
|
*
|
|
52
|
-
* Dropping `
|
|
53
|
-
*
|
|
51
|
+
* Dropping `current` rather than only aborting it is what closes every
|
|
52
|
+
* outstanding guard: `isCurrent` compares against this field, so one
|
|
54
53
|
* assignment makes a fetch already past its await stale, whether it is the one
|
|
55
54
|
* being cancelled or a superseded predecessor still unwinding.
|
|
56
55
|
*
|
|
@@ -61,10 +60,8 @@ export function createStopTokenRotation(self, report) {
|
|
|
61
60
|
* works: `addDisposer(self, rotation.dispose)` is a shape callers reach for.
|
|
62
61
|
*/
|
|
63
62
|
const cancel = () => {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
currentStopToken = undefined;
|
|
67
|
-
}
|
|
63
|
+
current?.abort();
|
|
64
|
+
current = undefined;
|
|
68
65
|
// a fetch in flight when this is called never reaches its `finally`, and a
|
|
69
66
|
// slot nobody retires goes on voting
|
|
70
67
|
openStream?.clear();
|
|
@@ -72,17 +69,15 @@ export function createStopTokenRotation(self, report) {
|
|
|
72
69
|
};
|
|
73
70
|
return {
|
|
74
71
|
begin() {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
const stopToken = createStopToken();
|
|
79
|
-
currentStopToken = stopToken;
|
|
72
|
+
current?.abort();
|
|
73
|
+
const controller = new AbortController();
|
|
74
|
+
current = controller;
|
|
80
75
|
// `ended` is the term a completed fetch has no other way to express: the
|
|
81
|
-
//
|
|
82
|
-
// finished still holds the current
|
|
76
|
+
// controller comparison catches a SUPERSEDED one, but a fetch that simply
|
|
77
|
+
// finished still holds the current one. The stream reads it as well as
|
|
83
78
|
// the caller's commit guard, which is why both go through this closure.
|
|
84
79
|
let ended = false;
|
|
85
|
-
const isCurrent = () => !ended &&
|
|
80
|
+
const isCurrent = () => !ended && controller === current && isAlive(self);
|
|
86
81
|
// Opened BEFORE the superseded run reaches its `finally`, which is what
|
|
87
82
|
// keeps the label the user is looking at from blanking between the two:
|
|
88
83
|
// the run being replaced is suspended at an await and resumes a microtask
|
|
@@ -92,18 +87,11 @@ export function createStopTokenRotation(self, report) {
|
|
|
92
87
|
const stream = statusWindow.open({ isCurrent });
|
|
93
88
|
openStream = stream;
|
|
94
89
|
return {
|
|
95
|
-
|
|
90
|
+
signal: controller.signal,
|
|
96
91
|
isCurrent,
|
|
97
92
|
statusCallback: stream.statusCallback,
|
|
98
93
|
end() {
|
|
99
94
|
ended = true;
|
|
100
|
-
// A completed fetch's token is released here, not only on supersede
|
|
101
|
-
// or cancel — otherwise it pins its AbortSignal controllers (and blob
|
|
102
|
-
// URL) until the next `begin()`, forever for a one-shot fetch that
|
|
103
|
-
// succeeds and never reruns. `stopStopToken` is guarded, so the
|
|
104
|
-
// superseded and cancelled runs that arrive here already-stopped cost
|
|
105
|
-
// nothing.
|
|
106
|
-
stopStopToken(stopToken);
|
|
107
95
|
if (openStream === stream) {
|
|
108
96
|
openStream = undefined;
|
|
109
97
|
}
|
|
@@ -114,7 +102,7 @@ export function createStopTokenRotation(self, report) {
|
|
|
114
102
|
cancel,
|
|
115
103
|
dispose() {
|
|
116
104
|
cancel();
|
|
117
|
-
// the window outlives the
|
|
105
|
+
// the window outlives the fetch: a trailing write is queued on a timer,
|
|
118
106
|
// and while the sink's `isCurrent` makes it a no-op rather than a write to
|
|
119
107
|
// a dead node, the timer itself still stands for up to a window past
|
|
120
108
|
// teardown. Only ours — resetting a lent one drops a write the host's
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Color } from './color-bits/core.ts';
|
|
2
|
+
/**
|
|
3
|
+
* Normalize a bare BED color triple to canonical "r,g,b", or undefined if the
|
|
4
|
+
* string isn't one. Each component must be in range: the underlying parser
|
|
5
|
+
* masks to 8 bits, so a bogus "999,0,0" would otherwise *wrap* to 231 and paint
|
|
6
|
+
* a plausible-looking but wrong color rather than being caught.
|
|
7
|
+
*/
|
|
8
|
+
export declare function bedTriple(str: string): string | undefined;
|
|
9
|
+
export declare function parseCssColorOr(color: string, fallback: Color): Color;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the painters read `color` as a color — a CSS name, hex, functional
|
|
12
|
+
* form, `transparent` or a BED triple — rather than as the invalid sentinel.
|
|
13
|
+
* What a `color` config slot admits.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isCssColor(color: string): boolean;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { newColor } from './color-bits/core.js';
|
|
2
|
+
import { parse } from './color-bits/parse.js';
|
|
3
|
+
import { namedColorToHex } from './color/cssColorsLevel4.js';
|
|
4
|
+
// Split out of colorBits.ts so a config slot can ask "is this a color?" without
|
|
5
|
+
// taking that module's re-export of render-core's packers: the closure ceiling
|
|
6
|
+
// in scripts/moduleClosure.test.ts is what says so.
|
|
7
|
+
// A bare BED color triple ("255,0,0"), which is not a CSS color but is what
|
|
8
|
+
// BED-family adapters put on the feature verbatim. The spec has no spaces, but
|
|
9
|
+
// tolerate them rather than silently ignoring an otherwise-usable color.
|
|
10
|
+
const BED_TRIPLE = /^(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})$/;
|
|
11
|
+
/**
|
|
12
|
+
* Normalize a bare BED color triple to canonical "r,g,b", or undefined if the
|
|
13
|
+
* string isn't one. Each component must be in range: the underlying parser
|
|
14
|
+
* masks to 8 bits, so a bogus "999,0,0" would otherwise *wrap* to 231 and paint
|
|
15
|
+
* a plausible-looking but wrong color rather than being caught.
|
|
16
|
+
*/
|
|
17
|
+
export function bedTriple(str) {
|
|
18
|
+
const m = BED_TRIPLE.exec(str.trim());
|
|
19
|
+
const rgb = m?.slice(1, 4).map(Number);
|
|
20
|
+
return rgb?.every(n => n <= 255) ? rgb.join(',') : undefined;
|
|
21
|
+
}
|
|
22
|
+
function tryParseCssColor(color) {
|
|
23
|
+
const str = color.trim().toLowerCase();
|
|
24
|
+
if (str === 'transparent') {
|
|
25
|
+
return newColor(0, 0, 0, 0);
|
|
26
|
+
}
|
|
27
|
+
try {
|
|
28
|
+
const hex = namedColorToHex(str);
|
|
29
|
+
const triple = bedTriple(str);
|
|
30
|
+
return parse(hex ? hex : triple ? `rgb(${triple})` : str);
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
// Resolve a CSS color string to a Color: honors named colors, `transparent`,
|
|
37
|
+
// and bare BED color triples, and returns `fallback` on malformed-but-nonempty
|
|
38
|
+
// input. `parse` throws on e.g. an empty "rgb()"; callers pass a fallback so one
|
|
39
|
+
// bad per-feature color can't crash a whole render/RPC. An out-of-range triple
|
|
40
|
+
// is left to throw into `fallback` (magenta) rather than wrapping to a wrong
|
|
41
|
+
// color — the same rule featureItemRgb applies, so a jexl callback reading an
|
|
42
|
+
// itemRgb column and the automatic path agree on what counts as a color.
|
|
43
|
+
export function parseCssColorOr(color, fallback) {
|
|
44
|
+
return tryParseCssColor(color) ?? fallback;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Whether the painters read `color` as a color — a CSS name, hex, functional
|
|
48
|
+
* form, `transparent` or a BED triple — rather than as the invalid sentinel.
|
|
49
|
+
* What a `color` config slot admits.
|
|
50
|
+
*/
|
|
51
|
+
export function isCssColor(color) {
|
|
52
|
+
return tryParseCssColor(color) !== undefined;
|
|
53
|
+
}
|