@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
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type PluginManager from '../PluginManager.ts';
|
|
2
2
|
import type { IsAny } from '../util/types/isAny.ts';
|
|
3
3
|
import type { ConfigSlotDefinition } from './configurationSlot.ts';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { ConfigurationSchemaRequirement } from './requirements.ts';
|
|
5
|
+
import type { AnyConfigurationModel, AnyConfigurationSchemaType, ConfigNodeActions, ConfigNodeBrand, ConfigNodeProps, IdentifierSlotDef, MergeConfigDef, TypeSlotDef } from './types.ts';
|
|
6
|
+
import type { IAnyType, ISimpleType, IType, ReferenceIdentifier, SnapshotIn, SnapshotOut } from '@jbrowse/mobx-state-tree';
|
|
6
7
|
export type { AnyConfigurationModel, AnyConfigurationSchemaType, } from './types.ts';
|
|
7
8
|
/**
|
|
8
9
|
* The three entry kinds `makeConfigurationSchemaModel` classifies: a slot
|
|
@@ -20,15 +21,37 @@ export type { AnyConfigurationModel, AnyConfigurationSchemaType, } from './types
|
|
|
20
21
|
export interface ConfigurationSchemaDefinition {
|
|
21
22
|
[n: string]: ConfigSlotDefinition | string | number | IAnyType;
|
|
22
23
|
}
|
|
23
|
-
export interface ConfigurationSchemaOptions<BASE_SCHEMA extends AnyConfigurationSchemaType | undefined, EXPLICIT_IDENTIFIER extends string | undefined> {
|
|
24
|
-
explicitlyTyped?:
|
|
24
|
+
export interface ConfigurationSchemaOptions<BASE_SCHEMA extends AnyConfigurationSchemaType | undefined, EXPLICIT_IDENTIFIER extends string | undefined, EXPLICITLY_TYPED extends boolean | undefined = boolean | undefined, REQUIREMENT extends ConfigurationSchemaRequirement = ConfigurationSchemaRequirement> {
|
|
25
|
+
explicitlyTyped?: EXPLICITLY_TYPED;
|
|
25
26
|
explicitIdentifier?: EXPLICIT_IDENTIFIER;
|
|
26
27
|
implicitIdentifier?: string | boolean;
|
|
27
28
|
baseConfiguration?: BASE_SCHEMA;
|
|
28
29
|
actions?: (self: unknown) => any;
|
|
29
30
|
views?: (self: unknown) => any;
|
|
30
31
|
extend?: (self: unknown) => any;
|
|
32
|
+
/**
|
|
33
|
+
* The slot a bare string snapshot lifts into, so `color: "red"` and
|
|
34
|
+
* `color: { value: "red" }` are one config. Applied before
|
|
35
|
+
* `preProcessSnapshot`, on every path a snapshot arrives by; the JSON schema,
|
|
36
|
+
* `describeSlots` and the config editor read it here.
|
|
37
|
+
*/
|
|
38
|
+
shorthand?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Slots a bare value sets beside `shorthand`, for a schema whose defaults
|
|
41
|
+
* would hide it: LGVSyntenyColor's `field` defaults to `strand`, so its
|
|
42
|
+
* `color: "steelblue"` is `{ value: "steelblue", scale: "none" }`.
|
|
43
|
+
*/
|
|
44
|
+
shorthandWith?: Record<string, unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Refuse a snapshot key the schema does not declare, where MST would drop
|
|
47
|
+
* it in silence. Checked after the `shorthand` lift and before
|
|
48
|
+
* `preProcessSnapshot`, on the same paths.
|
|
49
|
+
*/
|
|
50
|
+
closed?: boolean;
|
|
51
|
+
/** A colour object's scale by `field` while `scale` is unset, `*` for any other. */
|
|
52
|
+
fieldScale?: Readonly<Record<string, string>>;
|
|
31
53
|
preProcessSnapshot?: (snapshot: Record<string, unknown>) => Record<string, unknown>;
|
|
54
|
+
requires?: REQUIREMENT[];
|
|
32
55
|
}
|
|
33
56
|
type SchemaHook = (self: unknown) => any;
|
|
34
57
|
/**
|
|
@@ -55,45 +78,66 @@ export interface MergedConfigurationSchemaOptions<BASE_SCHEMA extends AnyConfigu
|
|
|
55
78
|
views?: SchemaHook | SchemaHook[];
|
|
56
79
|
extend?: SchemaHook | SchemaHook[];
|
|
57
80
|
}
|
|
58
|
-
declare function makeConfigurationSchemaModel<DEFINITION extends ConfigurationSchemaDefinition, OPTIONS extends MergedConfigurationSchemaOptions<any, any>>(modelName: string, schemaDefinition: DEFINITION, options: OPTIONS): import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IModelType<Record<string, any>,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
81
|
+
declare function makeConfigurationSchemaModel<DEFINITION extends ConfigurationSchemaDefinition, OPTIONS extends MergedConfigurationSchemaOptions<any, any>>(modelName: string, schemaDefinition: DEFINITION, options: OPTIONS): import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IModelType<Record<string, any>, ConfigNodeActions, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>, [undefined]>;
|
|
82
|
+
/**
|
|
83
|
+
* DEFINITION is unconstrained on purpose. It carries the *merged* definition —
|
|
84
|
+
* `MergeConfigDef`, an unresolved conditional that cannot be checked against a
|
|
85
|
+
* constraint — and intersecting it with `ConfigurationSchemaDefinition` to
|
|
86
|
+
* satisfy one would put an index signature straight back into
|
|
87
|
+
* `keyof DEFINITION`. The authoring check lives on `ConfigurationSchema`'s own
|
|
88
|
+
* parameter, where the literal arrives, and on the `extends` clause below.
|
|
89
|
+
*/
|
|
90
|
+
export interface ConfigurationSchemaType<out DEFINITION, OPTIONS extends ConfigurationSchemaOptions<any, any>> extends ReturnType<typeof makeConfigurationSchemaModel<DEFINITION & ConfigurationSchemaDefinition, OPTIONS>> {
|
|
91
|
+
/**
|
|
92
|
+
* Overrides the factory's, whose props come off a `Record<string, any>` and
|
|
93
|
+
* so admit every name. Slots come from the definition — the identifier and
|
|
94
|
+
* an `explicitlyTyped` schema's `type` ride in as two of them — and the brand
|
|
95
|
+
* names this schema, which is what `ConfigurationSchemaForModel` infers back
|
|
96
|
+
* out.
|
|
97
|
+
*/
|
|
98
|
+
readonly Type: ConfigNodeProps<DEFINITION> & ConfigNodeActions & ConfigNodeBrand<this>;
|
|
64
99
|
}
|
|
65
|
-
|
|
100
|
+
type RequirementPath<D> = {
|
|
101
|
+
[K in keyof D & string]: K | (D[K] extends ConfigurationSchemaType<infer SUB, any> ? `${K}.${RequirementPath<SUB>}` : never);
|
|
102
|
+
}[keyof D & string];
|
|
103
|
+
type RequirementWhen<D> = {
|
|
104
|
+
[K in keyof D & string as D[K] extends {
|
|
105
|
+
type: string;
|
|
106
|
+
} ? K : never]?: (D[K] extends {
|
|
107
|
+
model: ISimpleType<infer V extends string>;
|
|
108
|
+
} ? V : string)[];
|
|
109
|
+
};
|
|
110
|
+
type RequirementOf<D, BASE> = BASE extends ConfigurationSchemaType<infer BD, any> ? ConfigurationSchemaRequirement<RequirementWhen<D> & RequirementWhen<BD>, RequirementPath<D> | RequirementPath<BD>> : ConfigurationSchemaRequirement<RequirementWhen<D>, RequirementPath<D>>;
|
|
111
|
+
export declare function ConfigurationSchema<const DEFINITION extends ConfigurationSchemaDefinition, BASE_SCHEMA extends AnyConfigurationSchemaType | undefined = undefined, EXPLICIT_IDENTIFIER extends string | undefined = undefined, EXPLICITLY_TYPED extends boolean | undefined = undefined>(modelName: string, inputSchemaDefinition: DEFINITION, inputOptions?: ConfigurationSchemaOptions<BASE_SCHEMA, EXPLICIT_IDENTIFIER, EXPLICITLY_TYPED, RequirementOf<NoInfer<DEFINITION>, NoInfer<BASE_SCHEMA>>>): ConfigurationSchemaType<MergeConfigDef<DEFINITION & Record<EXPLICIT_IDENTIFIER & string, IdentifierSlotDef> & (EXPLICITLY_TYPED extends true ? {
|
|
112
|
+
type: TypeSlotDef;
|
|
113
|
+
} : unknown), BASE_SCHEMA>, ConfigurationSchemaOptions<BASE_SCHEMA, EXPLICIT_IDENTIFIER, EXPLICITLY_TYPED>>;
|
|
66
114
|
/**
|
|
67
115
|
* #api core/configuration
|
|
68
116
|
* Hydrate a plain track config into a live config node, dispatching on its
|
|
69
117
|
* `type` to find the schema. `session.tracks` holds `types.frozen` plain
|
|
70
|
-
* objects until something references a track (ADR-031)
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
118
|
+
* objects until something references a track (ADR-031). One of those holds only
|
|
119
|
+
* what was literally authored: a slot at its schema default is absent,
|
|
120
|
+
* `preProcessSnapshot` has not run, and nothing that walks a live node applies
|
|
121
|
+
* to it.
|
|
74
122
|
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
* config" is the case this exists for: it is reached from two menus, and one of
|
|
123
|
+
* Use it where a caller needs the resolved config and may be handed either
|
|
124
|
+
* form. The About dialog's "Copy config" is reached from two menus, and one of
|
|
78
125
|
* them passes a `session.tracks` entry.
|
|
79
126
|
*
|
|
80
|
-
* Returns **undefined**
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
* it as the plain object it is.
|
|
127
|
+
* Returns **undefined** when the config names a track type no plugin
|
|
128
|
+
* registered, or when `create` rejects it as invalid. An un-hydrated config has
|
|
129
|
+
* never been validated, so the dialog opening over it should not throw. Callers
|
|
130
|
+
* fall back to using the plain object.
|
|
85
131
|
*
|
|
86
132
|
* Shares `TrackConfigurationReference`'s per-PluginManager cache, so hydrating
|
|
87
|
-
* the same entry twice returns the same node
|
|
88
|
-
*
|
|
89
|
-
*
|
|
90
|
-
* the pristine mirror beside it. The two
|
|
91
|
-
*
|
|
133
|
+
* the same entry twice returns the same node, and in an admin session a track
|
|
134
|
+
* opened later resolves to that same node. A non-admin's open track
|
|
135
|
+
* resolves to the session's private working copy (ADR-032), and this function
|
|
136
|
+
* returns the pristine mirror beside it. The two have the same content;
|
|
137
|
+
* `CopyConfigEntryPoints.test.ts` tests both cases.
|
|
92
138
|
*/
|
|
93
139
|
export declare function hydrateTrackConfig(pluginManager: PluginManager, config: Record<string, unknown>): AnyConfigurationModel | undefined;
|
|
94
|
-
type ConfigReferenceInstance<SCHEMA extends AnyConfigurationSchemaType> =
|
|
95
|
-
[K in GetInheritedIdentifier<SCHEMA>]: string;
|
|
96
|
-
};
|
|
140
|
+
type ConfigReferenceInstance<SCHEMA extends AnyConfigurationSchemaType> = SCHEMA extends ConfigurationSchemaType<infer D, any> ? IsAny<D> extends true ? any : SCHEMA['Type'] : SCHEMA['Type'];
|
|
97
141
|
/**
|
|
98
142
|
* Static type of the value `ConfigurationReference` produces, and therefore of a
|
|
99
143
|
* track/display state model's `configuration` prop. Its **instance** type is a
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { getEnv, isArrayType, isMapType, isStateTreeNode, types, } from '@jbrowse/mobx-state-tree';
|
|
2
2
|
import { getContainingTrack, getSession } from '../util/mstUtils.js';
|
|
3
3
|
import { ElementId } from '../util/types/mst.js';
|
|
4
|
-
import ConfigSlot from './configurationSlot.js';
|
|
4
|
+
import ConfigSlot, { slotWriteRefusal } from './configurationSlot.js';
|
|
5
|
+
import { checkRequirements } from './requirements.js';
|
|
5
6
|
import { getConfigurationSchemaMetadata, registerConfigurationSchema, } from './schemaRegistry.js';
|
|
6
|
-
import { isConfigurationSchemaType, isConstantEntry, isSlotDefinitionEntry, } from './schemaTypes.js';
|
|
7
|
+
import { identifierName, isConfigurationSchemaType, isConstantEntry, isSlotDefinitionEntry, } from './schemaTypes.js';
|
|
8
|
+
import { preProcessSnapshotWith } from './snapshotPreprocess.js';
|
|
7
9
|
function hookList(hook) {
|
|
8
10
|
return hook === undefined ? [] : Array.isArray(hook) ? hook : [hook];
|
|
9
11
|
}
|
|
@@ -86,24 +88,17 @@ function preprocessConfigurationSchemaArguments(modelName, inputSchemaDefinition
|
|
|
86
88
|
function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
87
89
|
// now assemble the MST model of the configuration schema
|
|
88
90
|
const modelDefinition = {};
|
|
89
|
-
let identifier;
|
|
90
91
|
if (options.explicitlyTyped) {
|
|
91
92
|
modelDefinition.type = types.optional(types.literal(modelName), modelName);
|
|
92
93
|
}
|
|
93
94
|
if (options.explicitIdentifier && options.implicitIdentifier) {
|
|
94
95
|
throw new Error(`Cannot have both explicit and implicit identifiers in ${modelName}`);
|
|
95
96
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
: options.implicitIdentifier
|
|
102
|
-
? { name: options.implicitIdentifier, idType: ElementId }
|
|
103
|
-
: undefined;
|
|
104
|
-
if (idSpec) {
|
|
105
|
-
identifier = typeof idSpec.name === 'string' ? idSpec.name : 'id';
|
|
106
|
-
modelDefinition[identifier] = idSpec.idType;
|
|
97
|
+
const identifier = identifierName(options);
|
|
98
|
+
if (identifier) {
|
|
99
|
+
modelDefinition[identifier] = options.explicitIdentifier
|
|
100
|
+
? types.identifier
|
|
101
|
+
: ElementId;
|
|
107
102
|
}
|
|
108
103
|
// String/number entries in the schema definition become volatile instance
|
|
109
104
|
// constants (read via `model.someName`). Per-slot metadata lives in the
|
|
@@ -116,10 +111,17 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
116
111
|
// excluded here — collected as the loop classifies each entry rather than
|
|
117
112
|
// re-scanning modelDefinition afterward.
|
|
118
113
|
const subSchemaKeys = new Set();
|
|
114
|
+
// Keys of array-of-sub-schema slots, which `setSubschemaArray` replaces
|
|
115
|
+
// whole: a menu that authors a list of sub-schemas — the mark display's
|
|
116
|
+
// `marks` — has no slot to write and no single node to swap.
|
|
117
|
+
const arraySubSchemaKeys = new Set();
|
|
119
118
|
// The actual slots, which is a strictly smaller set than `modelDefinition`:
|
|
120
119
|
// that also holds the sub-schema properties and the identifier, neither of
|
|
121
120
|
// which setSlot may write. Same collect-as-you-classify as subSchemaKeys.
|
|
122
121
|
const slotKeys = new Set();
|
|
122
|
+
const storesNull = new Set();
|
|
123
|
+
const featureFields = new Set();
|
|
124
|
+
const takesNoCallback = new Map();
|
|
123
125
|
for (const [slotName, slotDefinition] of Object.entries(schemaDefinition)) {
|
|
124
126
|
if (isConfigurationSchemaType(slotDefinition)) {
|
|
125
127
|
// a sub-configuration. A bare sub-schema is already stripDefault-wrapped
|
|
@@ -128,6 +130,7 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
128
130
|
// snapshot.
|
|
129
131
|
if (isArrayType(slotDefinition)) {
|
|
130
132
|
modelDefinition[slotName] = types.stripDefault(slotDefinition, []);
|
|
133
|
+
arraySubSchemaKeys.add(slotName);
|
|
131
134
|
}
|
|
132
135
|
else if (isMapType(slotDefinition)) {
|
|
133
136
|
modelDefinition[slotName] = types.stripDefault(slotDefinition, {});
|
|
@@ -145,6 +148,15 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
145
148
|
slotKeys.add(slotName);
|
|
146
149
|
try {
|
|
147
150
|
modelDefinition[slotName] = ConfigSlot(slotDefinition);
|
|
151
|
+
if (modelDefinition[slotName].is(null)) {
|
|
152
|
+
storesNull.add(slotName);
|
|
153
|
+
}
|
|
154
|
+
if (slotDefinition.type === 'featureField') {
|
|
155
|
+
featureFields.add(slotName);
|
|
156
|
+
}
|
|
157
|
+
else if (!slotDefinition.contextVariable?.length) {
|
|
158
|
+
takesNoCallback.set(slotName, slotDefinition.type);
|
|
159
|
+
}
|
|
148
160
|
}
|
|
149
161
|
catch (e) {
|
|
150
162
|
throw new Error(`invalid config slot definition for ${modelName}.${slotName}: ${e}`, { cause: e });
|
|
@@ -159,9 +171,15 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
159
171
|
throw new Error(`invalid configuration schema definition, "${slotName}" must be either a valid configuration slot definition, a constant, or a nested configuration schema`);
|
|
160
172
|
}
|
|
161
173
|
}
|
|
174
|
+
checkRequirements(modelName, schemaDefinition, options.requires ?? []);
|
|
162
175
|
let completeModel = types
|
|
163
176
|
.model(`${modelName}ConfigurationSchema`, modelDefinition)
|
|
164
|
-
|
|
177
|
+
// annotated so `ConfigurationSchemaType['Type']`, which has to name these
|
|
178
|
+
// three by hand (the model's own props are a `Record<string, any>`, so
|
|
179
|
+
// nothing derived off them keeps a signature), cannot drift from them
|
|
180
|
+
.actions((self) => ({
|
|
181
|
+
// `data` is whatever the sub-schema's `preProcessSnapshot` takes, a
|
|
182
|
+
// string shorthand included.
|
|
165
183
|
setSubschema(slotName, data) {
|
|
166
184
|
if (!subSchemaKeys.has(slotName)) {
|
|
167
185
|
throw new Error(`${slotName} is not a subschema, cannot replace`);
|
|
@@ -172,6 +190,12 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
172
190
|
self[slotName] = newSchema;
|
|
173
191
|
return newSchema;
|
|
174
192
|
},
|
|
193
|
+
setSubschemaArray(slotName, data) {
|
|
194
|
+
if (!arraySubSchemaKeys.has(slotName)) {
|
|
195
|
+
throw new Error(`${slotName} is not an array of subschemas, cannot replace`);
|
|
196
|
+
}
|
|
197
|
+
self[slotName] = data;
|
|
198
|
+
},
|
|
175
199
|
// generic slot setter the config editor's slot facade routes through. A
|
|
176
200
|
// slot is a bare value-union property, so this is a plain assignment.
|
|
177
201
|
//
|
|
@@ -181,7 +205,14 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
181
205
|
// Slot-name safety is a write guard (ADR-052); `setSlot`'s tests in
|
|
182
206
|
// `configurationSchema.test.ts` pin both halves. `slotKeys` already has
|
|
183
207
|
// base-schema slots merged in, so an inherited slot passes.
|
|
184
|
-
|
|
208
|
+
// `null` resets, the same thing `undefined` does, because a JSON-borne
|
|
209
|
+
// caller cannot spell `undefined`: a session spec, share link or agent
|
|
210
|
+
// call can set a slot and then has no way to put it back. Omitting the
|
|
211
|
+
// key is not that — this action is the merge path, where an absent key
|
|
212
|
+
// means "leave it alone". A sub-schema already reads `null` this way
|
|
213
|
+
// (`mergedSubschemaValue`), and no slot stores `null` as a value.
|
|
214
|
+
setSlot(slotName, rawValue) {
|
|
215
|
+
const value = rawValue ?? undefined;
|
|
185
216
|
if (!slotKeys.has(slotName)) {
|
|
186
217
|
// the sub-schema branch re-classifies off the definition rather than
|
|
187
218
|
// carrying a second Set: it runs only on the way to a throw, and the
|
|
@@ -203,7 +234,7 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
203
234
|
const slotType = isSlotDefinitionEntry(declared)
|
|
204
235
|
? declared.type
|
|
205
236
|
: 'value';
|
|
206
|
-
throw new Error(`${modelName}.${slotName}
|
|
237
|
+
throw new Error(slotWriteRefusal(`${modelName}.${slotName}`, slotType, value));
|
|
207
238
|
}
|
|
208
239
|
self[slotName] = value;
|
|
209
240
|
},
|
|
@@ -222,9 +253,15 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
222
253
|
for (const hook of hookList(options.extend)) {
|
|
223
254
|
completeModel = completeModel.extend(hook);
|
|
224
255
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
256
|
+
const metadata = {
|
|
257
|
+
name: modelName,
|
|
258
|
+
definition: schemaDefinition,
|
|
259
|
+
options,
|
|
260
|
+
storesNull,
|
|
261
|
+
featureFields,
|
|
262
|
+
takesNoCallback,
|
|
263
|
+
};
|
|
264
|
+
completeModel = completeModel.preProcessSnapshot(snapshot => preProcessSnapshotWith(metadata, snapshot));
|
|
228
265
|
const identifierDefault = identifier ? { [identifier]: 'placeholderId' } : {};
|
|
229
266
|
const modelDefault = options.explicitlyTyped
|
|
230
267
|
? { type: modelName, ...identifierDefault }
|
|
@@ -237,7 +274,6 @@ function makeConfigurationSchemaModel(modelName, schemaDefinition, options) {
|
|
|
237
274
|
// returns for a live config — the config editor's slot facade looks it up
|
|
238
275
|
// from there) and the stripDefault wrapper (what ConfigurationSchema returns
|
|
239
276
|
// and what sub-schema properties hold), so a lookup succeeds from either.
|
|
240
|
-
const metadata = { definition: schemaDefinition, options };
|
|
241
277
|
registerConfigurationSchema(completeModel, metadata);
|
|
242
278
|
registerConfigurationSchema(wrappedModel, metadata);
|
|
243
279
|
return wrappedModel;
|
|
@@ -259,28 +295,26 @@ function hydrateInto(pluginManager, schemaType, frozen) {
|
|
|
259
295
|
* #api core/configuration
|
|
260
296
|
* Hydrate a plain track config into a live config node, dispatching on its
|
|
261
297
|
* `type` to find the schema. `session.tracks` holds `types.frozen` plain
|
|
262
|
-
* objects until something references a track (ADR-031)
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
298
|
+
* objects until something references a track (ADR-031). One of those holds only
|
|
299
|
+
* what was literally authored: a slot at its schema default is absent,
|
|
300
|
+
* `preProcessSnapshot` has not run, and nothing that walks a live node applies
|
|
301
|
+
* to it.
|
|
266
302
|
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
* config" is the case this exists for: it is reached from two menus, and one of
|
|
303
|
+
* Use it where a caller needs the resolved config and may be handed either
|
|
304
|
+
* form. The About dialog's "Copy config" is reached from two menus, and one of
|
|
270
305
|
* them passes a `session.tracks` entry.
|
|
271
306
|
*
|
|
272
|
-
* Returns **undefined**
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
* it as the plain object it is.
|
|
307
|
+
* Returns **undefined** when the config names a track type no plugin
|
|
308
|
+
* registered, or when `create` rejects it as invalid. An un-hydrated config has
|
|
309
|
+
* never been validated, so the dialog opening over it should not throw. Callers
|
|
310
|
+
* fall back to using the plain object.
|
|
277
311
|
*
|
|
278
312
|
* Shares `TrackConfigurationReference`'s per-PluginManager cache, so hydrating
|
|
279
|
-
* the same entry twice returns the same node
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* the pristine mirror beside it. The two
|
|
283
|
-
*
|
|
313
|
+
* the same entry twice returns the same node, and in an admin session a track
|
|
314
|
+
* opened later resolves to that same node. A non-admin's open track
|
|
315
|
+
* resolves to the session's private working copy (ADR-032), and this function
|
|
316
|
+
* returns the pristine mirror beside it. The two have the same content;
|
|
317
|
+
* `CopyConfigEntryPoints.test.ts` tests both cases.
|
|
284
318
|
*/
|
|
285
319
|
export function hydrateTrackConfig(pluginManager, config) {
|
|
286
320
|
const type = config.type;
|
|
@@ -349,8 +383,8 @@ function TrackConfigurationReference(schemaType) {
|
|
|
349
383
|
if (!isStateTreeNode(ret)) {
|
|
350
384
|
// A non-admin session hands back a private, per-track working copy so a
|
|
351
385
|
// shown track's in-place quick-edits (setSlot) mutate that copy and
|
|
352
|
-
// never the shared frozen base node (see agent-docs/ADR-032).
|
|
353
|
-
//
|
|
386
|
+
// never the shared frozen base node (see agent-docs/ADR-032). An admin
|
|
387
|
+
// session returns undefined here and falls through to the frozen
|
|
354
388
|
// hydration cache (ADR-031) — admin edits the frozen entry in place.
|
|
355
389
|
const editable = session.getEditableTrackConfig?.(String(id), ret, schemaType);
|
|
356
390
|
if (editable) {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ConfigurationSchemaOptions, ConfigurationSchemaType } from './configurationSchema.ts';
|
|
2
|
+
import type { AnyConfigurationSchemaType } from './types.ts';
|
|
3
|
+
import type { IAnyType, ISimpleType, IType, SnapshotIn, SnapshotOut } from '@jbrowse/mobx-state-tree';
|
|
4
|
+
interface NamedTypeSlotDef<NAME extends string> {
|
|
5
|
+
type: 'stringEnum';
|
|
6
|
+
model: ISimpleType<NAME>;
|
|
7
|
+
}
|
|
8
|
+
type Named<SCHEMA, NAME extends string> = SCHEMA extends ConfigurationSchemaType<infer D, infer O extends ConfigurationSchemaOptions<any, any>> ? ConfigurationSchemaType<{
|
|
9
|
+
[K in keyof D]: K extends 'type' ? NamedTypeSlotDef<NAME> : D[K];
|
|
10
|
+
}, O> : never;
|
|
11
|
+
type UnionNode<MEMBERS> = {
|
|
12
|
+
[K in keyof MEMBERS & string]: Named<MEMBERS[K], K>['Type'];
|
|
13
|
+
}[keyof MEMBERS & string];
|
|
14
|
+
/**
|
|
15
|
+
* A union of configuration schemas, each member's node reading its `type` as
|
|
16
|
+
* the key it is listed under — so a `switch` over it narrows to that member's
|
|
17
|
+
* own slots.
|
|
18
|
+
*/
|
|
19
|
+
export type ConfigurationSchemaUnionType<MEMBERS extends Record<string, AnyConfigurationSchemaType>> = Omit<IType<SnapshotIn<MEMBERS[keyof MEMBERS]>, SnapshotOut<MEMBERS[keyof MEMBERS]>, UnionNode<MEMBERS>>, 'Type'> & {
|
|
20
|
+
readonly Type: UnionNode<MEMBERS>;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* #api core/configuration
|
|
24
|
+
* A list entry that is one of several configuration schemas, each keyed by the
|
|
25
|
+
* `type` it answers to: `types.array(ConfigurationSchemaUnion('Step', { filter,
|
|
26
|
+
* bin }))`. The keys are the vocabulary, the snapshot's `type` picks the
|
|
27
|
+
* member, and a `type` naming no member is refused in every build — where a
|
|
28
|
+
* bare `types.union` would load it as its first member. Each member is an
|
|
29
|
+
* `explicitlyTyped`, `closed` schema named by its key, so a key belonging to
|
|
30
|
+
* another member is refused rather than dropped; one that is not throws here.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ConfigurationSchemaUnion<const MEMBERS extends Record<string, AnyConfigurationSchemaType>>(name: string, members: MEMBERS): ConfigurationSchemaUnionType<MEMBERS>;
|
|
33
|
+
/**
|
|
34
|
+
* #api core/configuration
|
|
35
|
+
* The `ConfigurationSchemaUnion` an array slot's entries answer to, read off
|
|
36
|
+
* the slot's MST type, or undefined for any other slot.
|
|
37
|
+
*/
|
|
38
|
+
export declare function arraySlotUnion(slotType: IAnyType): import("./schemaRegistry.ts").ConfigurationSchemaUnionMetadata | undefined;
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { isArrayType, isOptionalType, types } from '@jbrowse/mobx-state-tree';
|
|
2
|
+
import { getSubType } from '../util/mst-reflection.js';
|
|
3
|
+
import { getConfigurationSchemaMetadata, getConfigurationSchemaUnion, registerConfigurationSchemaUnion, } from './schemaRegistry.js';
|
|
4
|
+
import { listed } from './snapshotPreprocess.js';
|
|
5
|
+
function memberRefusal(key, member) {
|
|
6
|
+
const meta = getConfigurationSchemaMetadata(member);
|
|
7
|
+
return !meta
|
|
8
|
+
? 'which is not a configuration schema'
|
|
9
|
+
: meta.name !== key
|
|
10
|
+
? `whose schema names itself "${meta.name}"`
|
|
11
|
+
: !meta.options.explicitlyTyped
|
|
12
|
+
? 'which is not explicitlyTyped, so its snapshot names no type to dispatch on'
|
|
13
|
+
: !meta.options.closed
|
|
14
|
+
? 'which is not closed, so a key of another member would be dropped in silence'
|
|
15
|
+
: undefined;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* #api core/configuration
|
|
19
|
+
* A list entry that is one of several configuration schemas, each keyed by the
|
|
20
|
+
* `type` it answers to: `types.array(ConfigurationSchemaUnion('Step', { filter,
|
|
21
|
+
* bin }))`. The keys are the vocabulary, the snapshot's `type` picks the
|
|
22
|
+
* member, and a `type` naming no member is refused in every build — where a
|
|
23
|
+
* bare `types.union` would load it as its first member. Each member is an
|
|
24
|
+
* `explicitlyTyped`, `closed` schema named by its key, so a key belonging to
|
|
25
|
+
* another member is refused rather than dropped; one that is not throws here.
|
|
26
|
+
*/
|
|
27
|
+
export function ConfigurationSchemaUnion(name, members) {
|
|
28
|
+
for (const [key, member] of Object.entries(members)) {
|
|
29
|
+
const refusal = memberRefusal(key, member);
|
|
30
|
+
if (refusal) {
|
|
31
|
+
throw new Error(`${name} lists "${key}", ${refusal}`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const names = Object.keys(members);
|
|
35
|
+
const union = types.union({
|
|
36
|
+
dispatcher: (snapshot) => {
|
|
37
|
+
const type = snapshot?.type;
|
|
38
|
+
if (typeof type === 'string' && Object.hasOwn(members, type)) {
|
|
39
|
+
return members[type];
|
|
40
|
+
}
|
|
41
|
+
throw new Error(`a ${name} names its type, one of ${listed(names)}, ${type === undefined
|
|
42
|
+
? 'and names none'
|
|
43
|
+
: `not ${JSON.stringify(type)}`}`);
|
|
44
|
+
},
|
|
45
|
+
}, ...Object.values(members));
|
|
46
|
+
registerConfigurationSchemaUnion(union, { name, members });
|
|
47
|
+
return union;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* #api core/configuration
|
|
51
|
+
* The `ConfigurationSchemaUnion` an array slot's entries answer to, read off
|
|
52
|
+
* the slot's MST type, or undefined for any other slot.
|
|
53
|
+
*/
|
|
54
|
+
export function arraySlotUnion(slotType) {
|
|
55
|
+
const array = isOptionalType(slotType) ? getSubType(slotType) : slotType;
|
|
56
|
+
return isArrayType(array)
|
|
57
|
+
? getConfigurationSchemaUnion(array.getChildType())
|
|
58
|
+
: undefined;
|
|
59
|
+
}
|
|
@@ -5,6 +5,10 @@ declare const slotTypes: {
|
|
|
5
5
|
model: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
6
6
|
fallbackDefault: never[];
|
|
7
7
|
};
|
|
8
|
+
colorArray: {
|
|
9
|
+
model: import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
10
|
+
fallbackDefault: never[];
|
|
11
|
+
};
|
|
8
12
|
stringArrayMap: {
|
|
9
13
|
model: import("@jbrowse/mobx-state-tree").IMapType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>>;
|
|
10
14
|
fallbackDefault: {};
|
|
@@ -41,6 +45,9 @@ declare const slotTypes: {
|
|
|
41
45
|
maybeFrozen: {
|
|
42
46
|
model: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").IType<any, any, any>>;
|
|
43
47
|
};
|
|
48
|
+
maybeString: {
|
|
49
|
+
model: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
50
|
+
};
|
|
44
51
|
string: {
|
|
45
52
|
model: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
46
53
|
fallbackDefault: string;
|
|
@@ -49,6 +56,10 @@ declare const slotTypes: {
|
|
|
49
56
|
model: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
50
57
|
fallbackDefault: string;
|
|
51
58
|
};
|
|
59
|
+
featureField: {
|
|
60
|
+
model: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
61
|
+
fallbackDefault: string;
|
|
62
|
+
};
|
|
52
63
|
fileLocation: {
|
|
53
64
|
model: import("@jbrowse/mobx-state-tree").ISnapshotProcessor<import("@jbrowse/mobx-state-tree").ITypeUnion<import("@jbrowse/mobx-state-tree").ModelCreationType<{
|
|
54
65
|
locationType: "LocalPathLocation";
|
|
@@ -146,10 +157,10 @@ declare const slotTypes: {
|
|
|
146
157
|
* `types.ts`, which has to name the same set and is checked against this.
|
|
147
158
|
*/
|
|
148
159
|
export type BuiltinSlotTypeName = keyof typeof slotTypes;
|
|
149
|
-
declare const ENUM_SLOT_TYPES: readonly ['stringEnum', 'maybeStringEnum'];
|
|
160
|
+
declare const ENUM_SLOT_TYPES: readonly ['stringEnum', 'maybeStringEnum', 'stringEnumArray'];
|
|
150
161
|
/**
|
|
151
162
|
* Every legal `type` on a slot definition: the builtin table's own names, plus
|
|
152
|
-
* the
|
|
163
|
+
* the enum types.
|
|
153
164
|
*
|
|
154
165
|
* Closed on purpose. A name outside this set still *works* at runtime as long
|
|
155
166
|
* as a `model` is given — which is exactly the trap: the value round-trips
|
|
@@ -167,12 +178,17 @@ type MaybeBuiltinSlotTypeName = {
|
|
|
167
178
|
[K in keyof typeof slotTypes]: 'fallbackDefault' extends keyof (typeof slotTypes)[K] ? never : K;
|
|
168
179
|
}[keyof typeof slotTypes];
|
|
169
180
|
export type MaybeSlotTypeName = MaybeBuiltinSlotTypeName | 'maybeStringEnum';
|
|
181
|
+
/** Why the slot `name`, of type `type`, refuses `value` on a write. */
|
|
182
|
+
export declare function slotWriteRefusal(name: string, type: string, value: unknown): string;
|
|
170
183
|
interface ConfigSlotDefinitionCommon {
|
|
171
184
|
/** human-readable description of the slot's meaning */
|
|
172
185
|
description?: string;
|
|
173
186
|
/** custom base MST model for the slot's value */
|
|
174
187
|
model?: IAnyType;
|
|
175
|
-
/**
|
|
188
|
+
/**
|
|
189
|
+
* The names a `jexl:` callback in this slot reads. Declaring any is what
|
|
190
|
+
* makes the slot take a callback; every other slot refuses one.
|
|
191
|
+
*/
|
|
176
192
|
contextVariable?: string[];
|
|
177
193
|
/**
|
|
178
194
|
* hide this slot behind a "Show advanced settings" toggle in the config
|
|
@@ -211,16 +227,25 @@ export type ConfigSlotDefinition = (ConfigSlotDefinitionCommon & {
|
|
|
211
227
|
defaultValue: unknown;
|
|
212
228
|
});
|
|
213
229
|
/**
|
|
214
|
-
* A configuration slot is a plain
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
230
|
+
* A configuration slot is a plain MST property holding the slot's value type,
|
|
231
|
+
* or, where the slot declares a `contextVariable`, that or a `jexl:...`
|
|
232
|
+
* callback string. Every other slot refuses a `jexl:` string, so a callback
|
|
233
|
+
* the reader would evaluate is one the schema says it takes. A `featureField`
|
|
234
|
+
* holds a `jexl:` expression as its value, which the display evaluates per
|
|
235
|
+
* feature. The value lives directly on the parent configuration model — there
|
|
236
|
+
* is no per-slot sub-model. `types.stripDefault` omits the property from the
|
|
237
|
+
* parent snapshot when it equals the default, so saved sessions stay minimal.
|
|
238
|
+
* Per-slot metadata (type/description/defaultValue/contextVariable) lives in
|
|
239
|
+
* the schema registry (a WeakMap keyed by the MST type, see
|
|
240
|
+
* schemaRegistry.ts); jexl callbacks are evaluated on read by
|
|
241
|
+
* `readConfObject`.
|
|
242
|
+
*
|
|
243
|
+
* Interning the returned type on `(type, model, defaultValue)` was prototyped
|
|
244
|
+
* and declined: a session builds 1197 slot types for 222 distinct ones, and
|
|
245
|
+
* removing the repeats moves neither the time nor the heap
|
|
246
|
+
* (`config-schema-construction`, published in `reference/EAGER_BUNDLE.md`).
|
|
222
247
|
*/
|
|
223
|
-
export default function ConfigSlot(definition: ConfigSlotDefinition): import("@jbrowse/mobx-state-tree").IOptionalIType<
|
|
248
|
+
export default function ConfigSlot(definition: ConfigSlotDefinition): import("@jbrowse/mobx-state-tree").IOptionalIType<IAnyType, [undefined]>;
|
|
224
249
|
/**
|
|
225
250
|
* New value when converting a fixed-value slot to a jexl callback. Already-
|
|
226
251
|
* callback values are returned unchanged.
|