@jbrowse/plugin-linear-genome-view 1.7.9 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +1 -5
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js +118 -226
- package/dist/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -0
- package/dist/BaseLinearDisplay/components/Block.js +53 -74
- package/dist/BaseLinearDisplay/components/Block.js.map +1 -0
- package/dist/BaseLinearDisplay/components/LinearBlocks.d.ts +11 -1
- package/dist/BaseLinearDisplay/components/LinearBlocks.js +64 -103
- package/dist/BaseLinearDisplay/components/LinearBlocks.js.map +1 -0
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +145 -175
- package/dist/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -0
- package/dist/BaseLinearDisplay/components/Tooltip.d.ts +8 -0
- package/dist/BaseLinearDisplay/components/Tooltip.js +118 -0
- package/dist/BaseLinearDisplay/components/Tooltip.js.map +1 -0
- package/dist/BaseLinearDisplay/index.js +13 -40
- package/dist/BaseLinearDisplay/index.js.map +1 -0
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +20 -15
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js +605 -683
- package/dist/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -0
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +15 -22
- package/dist/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -0
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +7 -8
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js +266 -312
- package/dist/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -0
- package/dist/LinearBareDisplay/configSchema.js +11 -17
- package/dist/LinearBareDisplay/configSchema.js.map +1 -0
- package/dist/LinearBareDisplay/index.js +7 -20
- package/dist/LinearBareDisplay/index.js.map +1 -0
- package/dist/LinearBareDisplay/model.d.ts +16 -14
- package/dist/LinearBareDisplay/model.js +36 -42
- package/dist/LinearBareDisplay/model.js.map +1 -0
- package/dist/LinearBasicDisplay/components/SetMaxHeight.d.ts +1 -1
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js +76 -85
- package/dist/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -0
- package/dist/LinearBasicDisplay/configSchema.js +15 -23
- package/dist/LinearBasicDisplay/configSchema.js.map +1 -0
- package/dist/LinearBasicDisplay/index.js +10 -22
- package/dist/LinearBasicDisplay/index.js.map +1 -0
- package/dist/LinearBasicDisplay/model.d.ts +20 -15
- package/dist/LinearBasicDisplay/model.js +180 -159
- package/dist/LinearBasicDisplay/model.js.map +1 -0
- package/dist/LinearGenomeView/components/CenterLine.d.ts +2 -8
- package/dist/LinearGenomeView/components/CenterLine.js +60 -74
- package/dist/LinearGenomeView/components/CenterLine.js.map +1 -0
- package/dist/LinearGenomeView/components/ExportSvgDialog.js +141 -141
- package/dist/LinearGenomeView/components/ExportSvgDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/Header.js +70 -123
- package/dist/LinearGenomeView/components/Header.js.map +1 -0
- package/dist/LinearGenomeView/components/HelpDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/HelpDialog.js +62 -45
- package/dist/LinearGenomeView/components/HelpDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/ImportForm.js +223 -320
- package/dist/LinearGenomeView/components/ImportForm.js.map +1 -0
- package/dist/LinearGenomeView/components/LinearGenomeView.js +64 -120
- package/dist/LinearGenomeView/components/LinearGenomeView.js.map +1 -0
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js +198 -337
- package/dist/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -0
- package/dist/LinearGenomeView/components/MiniControls.js +64 -78
- package/dist/LinearGenomeView/components/MiniControls.js.map +1 -0
- package/dist/LinearGenomeView/components/OverviewRubberBand.js +226 -293
- package/dist/LinearGenomeView/components/OverviewRubberBand.js.map +1 -0
- package/dist/LinearGenomeView/components/OverviewScaleBar.d.ts +24 -8
- package/dist/LinearGenomeView/components/OverviewScaleBar.js +277 -365
- package/dist/LinearGenomeView/components/OverviewScaleBar.js.map +1 -0
- package/dist/LinearGenomeView/components/RefNameAutocomplete.d.ts +1 -1
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js +237 -324
- package/dist/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -0
- package/dist/LinearGenomeView/components/RubberBand.js +229 -296
- package/dist/LinearGenomeView/components/RubberBand.js.map +1 -0
- package/dist/LinearGenomeView/components/Ruler.js +45 -90
- package/dist/LinearGenomeView/components/Ruler.js.map +1 -0
- package/dist/LinearGenomeView/components/ScaleBar.d.ts +8 -399
- package/dist/LinearGenomeView/components/ScaleBar.js +121 -167
- package/dist/LinearGenomeView/components/ScaleBar.js.map +1 -0
- package/dist/LinearGenomeView/components/SearchBox.js +158 -205
- package/dist/LinearGenomeView/components/SearchBox.js.map +1 -0
- package/dist/LinearGenomeView/components/SearchResultsDialog.d.ts +0 -1
- package/dist/LinearGenomeView/components/SearchResultsDialog.js +105 -150
- package/dist/LinearGenomeView/components/SearchResultsDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/SequenceDialog.js +219 -272
- package/dist/LinearGenomeView/components/SequenceDialog.js.map +1 -0
- package/dist/LinearGenomeView/components/TrackContainer.js +116 -156
- package/dist/LinearGenomeView/components/TrackContainer.js.map +1 -0
- package/dist/LinearGenomeView/components/TrackLabel.d.ts +6 -42
- package/dist/LinearGenomeView/components/TrackLabel.js +115 -150
- package/dist/LinearGenomeView/components/TrackLabel.js.map +1 -0
- package/dist/LinearGenomeView/components/TracksContainer.d.ts +1 -1
- package/dist/LinearGenomeView/components/TracksContainer.js +172 -199
- package/dist/LinearGenomeView/components/TracksContainer.js.map +1 -0
- package/dist/LinearGenomeView/components/VerticalGuides.d.ts +2 -3
- package/dist/LinearGenomeView/components/VerticalGuides.js +66 -104
- package/dist/LinearGenomeView/components/VerticalGuides.js.map +1 -0
- package/dist/LinearGenomeView/components/ZoomControls.js +72 -87
- package/dist/LinearGenomeView/components/ZoomControls.js.map +1 -0
- package/dist/LinearGenomeView/components/util.d.ts +12 -0
- package/dist/LinearGenomeView/components/util.js +95 -13
- package/dist/LinearGenomeView/components/util.js.map +1 -0
- package/dist/LinearGenomeView/index.d.ts +6 -11
- package/dist/LinearGenomeView/index.js +1163 -1387
- package/dist/LinearGenomeView/index.js.map +1 -0
- package/dist/LinearGenomeView/util.js +76 -83
- package/dist/LinearGenomeView/util.js.map +1 -0
- package/dist/index.d.ts +101 -51
- package/dist/index.js +225 -284
- package/dist/index.js.map +1 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.d.ts +9 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js +68 -0
- package/esm/BaseLinearDisplay/components/BaseLinearDisplay.js.map +1 -0
- package/esm/BaseLinearDisplay/components/Block.d.ts +15 -0
- package/esm/BaseLinearDisplay/components/Block.js +46 -0
- package/esm/BaseLinearDisplay/components/Block.js.map +1 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.d.ts +22 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.js +62 -0
- package/esm/BaseLinearDisplay/components/LinearBlocks.js.map +1 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.d.ts +4 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js +113 -0
- package/esm/BaseLinearDisplay/components/ServerSideRenderedBlockContent.js.map +1 -0
- package/esm/BaseLinearDisplay/components/Tooltip.d.ts +8 -0
- package/esm/BaseLinearDisplay/components/Tooltip.js +64 -0
- package/esm/BaseLinearDisplay/components/Tooltip.js.map +1 -0
- package/esm/BaseLinearDisplay/index.d.ts +5 -0
- package/esm/BaseLinearDisplay/index.js +4 -0
- package/esm/BaseLinearDisplay/index.js.map +1 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.d.ts +232 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js +541 -0
- package/esm/BaseLinearDisplay/models/BaseLinearDisplayModel.js.map +1 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.d.ts +1 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js +14 -0
- package/esm/BaseLinearDisplay/models/baseLinearDisplayConfigSchema.js.map +1 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.d.ts +96 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js +225 -0
- package/esm/BaseLinearDisplay/models/serverSideRenderedBlock.js.map +1 -0
- package/esm/LinearBareDisplay/configSchema.d.ts +2 -0
- package/esm/LinearBareDisplay/configSchema.js +9 -0
- package/esm/LinearBareDisplay/configSchema.js.map +1 -0
- package/esm/LinearBareDisplay/index.d.ts +2 -0
- package/esm/LinearBareDisplay/index.js +3 -0
- package/esm/LinearBareDisplay/index.js.map +1 -0
- package/esm/LinearBareDisplay/model.d.ts +194 -0
- package/esm/LinearBareDisplay/model.js +28 -0
- package/esm/LinearBareDisplay/model.js.map +1 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.d.ts +10 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js +40 -0
- package/esm/LinearBasicDisplay/components/SetMaxHeight.js.map +1 -0
- package/esm/LinearBasicDisplay/configSchema.d.ts +2 -0
- package/esm/LinearBasicDisplay/configSchema.js +14 -0
- package/esm/LinearBasicDisplay/configSchema.js.map +1 -0
- package/esm/LinearBasicDisplay/index.d.ts +2 -0
- package/esm/LinearBasicDisplay/index.js +3 -0
- package/esm/LinearBasicDisplay/index.js.map +1 -0
- package/esm/LinearBasicDisplay/model.d.ts +218 -0
- package/esm/LinearBasicDisplay/model.js +127 -0
- package/esm/LinearBasicDisplay/model.js.map +1 -0
- package/esm/LinearGenomeView/components/CenterLine.d.ts +8 -0
- package/esm/LinearGenomeView/components/CenterLine.js +40 -0
- package/esm/LinearGenomeView/components/CenterLine.js.map +1 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +6 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.js +52 -0
- package/esm/LinearGenomeView/components/ExportSvgDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/Header.d.ts +7 -0
- package/esm/LinearGenomeView/components/Header.js +81 -0
- package/esm/LinearGenomeView/components/Header.js.map +1 -0
- package/esm/LinearGenomeView/components/HelpDialog.d.ts +4 -0
- package/esm/LinearGenomeView/components/HelpDialog.js +58 -0
- package/esm/LinearGenomeView/components/HelpDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/ImportForm.d.ts +7 -0
- package/esm/LinearGenomeView/components/ImportForm.js +141 -0
- package/esm/LinearGenomeView/components/ImportForm.js.map +1 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +7 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.js +67 -0
- package/esm/LinearGenomeView/components/LinearGenomeView.js.map +1 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.d.ts +4 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js +132 -0
- package/esm/LinearGenomeView/components/LinearGenomeViewSvg.js.map +1 -0
- package/esm/LinearGenomeView/components/MiniControls.d.ts +6 -0
- package/esm/LinearGenomeView/components/MiniControls.js +25 -0
- package/esm/LinearGenomeView/components/MiniControls.js.map +1 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.d.ts +22 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.js +194 -0
- package/esm/LinearGenomeView/components/OverviewRubberBand.js.map +1 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.d.ts +148 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.js +287 -0
- package/esm/LinearGenomeView/components/OverviewScaleBar.js.map +1 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.d.ts +22 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js +136 -0
- package/esm/LinearGenomeView/components/RefNameAutocomplete.js.map +1 -0
- package/esm/LinearGenomeView/components/RubberBand.d.ts +9 -0
- package/esm/LinearGenomeView/components/RubberBand.js +198 -0
- package/esm/LinearGenomeView/components/RubberBand.js.map +1 -0
- package/esm/LinearGenomeView/components/Ruler.d.ts +27 -0
- package/esm/LinearGenomeView/components/Ruler.js +50 -0
- package/esm/LinearGenomeView/components/Ruler.js.map +1 -0
- package/esm/LinearGenomeView/components/ScaleBar.d.ts +10 -0
- package/esm/LinearGenomeView/components/ScaleBar.js +112 -0
- package/esm/LinearGenomeView/components/ScaleBar.js.map +1 -0
- package/esm/LinearGenomeView/components/SearchBox.d.ts +8 -0
- package/esm/LinearGenomeView/components/SearchBox.js +94 -0
- package/esm/LinearGenomeView/components/SearchBox.js.map +1 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +7 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.js +107 -0
- package/esm/LinearGenomeView/components/SearchResultsDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/SequenceDialog.d.ts +8 -0
- package/esm/LinearGenomeView/components/SequenceDialog.js +147 -0
- package/esm/LinearGenomeView/components/SequenceDialog.js.map +1 -0
- package/esm/LinearGenomeView/components/TrackContainer.d.ts +9 -0
- package/esm/LinearGenomeView/components/TrackContainer.js +109 -0
- package/esm/LinearGenomeView/components/TrackContainer.js.map +1 -0
- package/esm/LinearGenomeView/components/TrackLabel.d.ts +8 -0
- package/esm/LinearGenomeView/components/TrackLabel.js +89 -0
- package/esm/LinearGenomeView/components/TrackLabel.js.map +1 -0
- package/esm/LinearGenomeView/components/TracksContainer.d.ts +10 -0
- package/esm/LinearGenomeView/components/TracksContainer.js +142 -0
- package/esm/LinearGenomeView/components/TracksContainer.js.map +1 -0
- package/esm/LinearGenomeView/components/VerticalGuides.d.ts +8 -0
- package/esm/LinearGenomeView/components/VerticalGuides.js +71 -0
- package/esm/LinearGenomeView/components/VerticalGuides.js.map +1 -0
- package/esm/LinearGenomeView/components/ZoomControls.d.ts +7 -0
- package/esm/LinearGenomeView/components/ZoomControls.js +32 -0
- package/esm/LinearGenomeView/components/ZoomControls.js.map +1 -0
- package/esm/LinearGenomeView/components/util.d.ts +14 -0
- package/esm/LinearGenomeView/components/util.js +17 -0
- package/esm/LinearGenomeView/components/util.js.map +1 -0
- package/esm/LinearGenomeView/index.d.ts +288 -0
- package/esm/LinearGenomeView/index.js +1124 -0
- package/esm/LinearGenomeView/index.js.map +1 -0
- package/esm/LinearGenomeView/util.d.ts +14 -0
- package/esm/LinearGenomeView/util.js +62 -0
- package/esm/LinearGenomeView/util.js.map +1 -0
- package/esm/index.d.ts +615 -0
- package/esm/index.js +127 -0
- package/esm/index.js.map +1 -0
- package/package.json +21 -13
- package/src/BaseLinearDisplay/components/BaseLinearDisplay.tsx +6 -90
- package/src/BaseLinearDisplay/components/Block.tsx +5 -5
- package/src/BaseLinearDisplay/components/LinearBlocks.tsx +4 -4
- package/src/BaseLinearDisplay/components/ServerSideRenderedBlockContent.tsx +7 -8
- package/src/BaseLinearDisplay/components/Tooltip.tsx +107 -0
- package/src/BaseLinearDisplay/models/BaseLinearDisplayModel.tsx +16 -8
- package/src/BaseLinearDisplay/models/serverSideRenderedBlock.ts +1 -1
- package/src/LinearBasicDisplay/components/SetMaxHeight.tsx +10 -7
- package/src/LinearBasicDisplay/model.ts +21 -15
- package/src/LinearGenomeView/components/CenterLine.tsx +6 -11
- package/src/LinearGenomeView/components/ExportSvgDialog.tsx +5 -5
- package/src/LinearGenomeView/components/Header.tsx +12 -16
- package/src/LinearGenomeView/components/HelpDialog.tsx +10 -9
- package/src/LinearGenomeView/components/ImportForm.tsx +24 -37
- package/src/LinearGenomeView/components/LinearGenomeView.test.js +18 -8
- package/src/LinearGenomeView/components/LinearGenomeView.tsx +20 -13
- package/src/LinearGenomeView/components/MiniControls.tsx +29 -40
- package/src/LinearGenomeView/components/OverviewRubberBand.tsx +6 -10
- package/src/LinearGenomeView/components/OverviewScaleBar.tsx +103 -93
- package/src/LinearGenomeView/components/RefNameAutocomplete.tsx +13 -44
- package/src/LinearGenomeView/components/RubberBand.tsx +12 -17
- package/src/LinearGenomeView/components/Ruler.tsx +5 -11
- package/src/LinearGenomeView/components/ScaleBar.tsx +27 -34
- package/src/LinearGenomeView/components/SearchBox.tsx +22 -32
- package/src/LinearGenomeView/components/SearchResultsDialog.tsx +7 -7
- package/src/LinearGenomeView/components/SequenceDialog.tsx +9 -9
- package/src/LinearGenomeView/components/TrackContainer.tsx +12 -12
- package/src/LinearGenomeView/components/TrackLabel.tsx +37 -50
- package/src/LinearGenomeView/components/TracksContainer.tsx +8 -13
- package/src/LinearGenomeView/components/VerticalGuides.tsx +9 -11
- package/src/LinearGenomeView/components/ZoomControls.tsx +12 -13
- package/src/LinearGenomeView/components/__snapshots__/LinearGenomeView.test.js.snap +504 -568
- package/src/LinearGenomeView/components/util.ts +43 -0
- package/src/LinearGenomeView/index.test.ts +21 -5
- package/src/LinearGenomeView/index.tsx +101 -88
- package/src/index.ts +36 -31
- package/dist/LinearBareDisplay/index.test.js +0 -33
- package/dist/LinearGenomeView/components/LinearGenomeView.test.js +0 -234
- package/dist/LinearGenomeView/components/ScaleBar.test.js +0 -180
- package/dist/LinearGenomeView/index.test.js +0 -1170
- package/dist/LinearGenomeView/util.test.js +0 -78
package/esm/index.js
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { lazy } from 'react';
|
|
2
|
+
import { when } from 'mobx';
|
|
3
|
+
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
4
|
+
import { createBaseTrackConfig, createBaseTrackModel, } from '@jbrowse/core/pluggableElementTypes/models';
|
|
5
|
+
import TrackType from '@jbrowse/core/pluggableElementTypes/TrackType';
|
|
6
|
+
import DisplayType from '@jbrowse/core/pluggableElementTypes/DisplayType';
|
|
7
|
+
import ViewType from '@jbrowse/core/pluggableElementTypes/ViewType';
|
|
8
|
+
import Plugin from '@jbrowse/core/Plugin';
|
|
9
|
+
import { isAbstractMenuManager } from '@jbrowse/core/util';
|
|
10
|
+
import LineStyleIcon from '@mui/icons-material/LineStyle';
|
|
11
|
+
import { BaseLinearDisplay, BaseLinearDisplayComponent, baseLinearDisplayConfigSchema, } from './BaseLinearDisplay';
|
|
12
|
+
import { configSchemaFactory as linearBareDisplayConfigSchemaFactory, stateModelFactory as LinearBareDisplayStateModelFactory, } from './LinearBareDisplay';
|
|
13
|
+
import { stateModelFactory as linearGenomeViewStateModelFactory, renderToSvg, RefNameAutocomplete, SearchBox, } from './LinearGenomeView';
|
|
14
|
+
import { configSchema as linearBasicDisplayConfigSchemaFactory, modelFactory as linearBasicDisplayModelFactory, } from './LinearBasicDisplay';
|
|
15
|
+
export default class LinearGenomeViewPlugin extends Plugin {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
this.name = 'LinearGenomeViewPlugin';
|
|
19
|
+
this.exports = {
|
|
20
|
+
BaseLinearDisplayComponent,
|
|
21
|
+
BaseLinearDisplay,
|
|
22
|
+
baseLinearDisplayConfigSchema,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
install(pluginManager) {
|
|
26
|
+
pluginManager.addTrackType(() => {
|
|
27
|
+
const configSchema = ConfigurationSchema('FeatureTrack', {}, {
|
|
28
|
+
baseConfiguration: createBaseTrackConfig(pluginManager),
|
|
29
|
+
explicitIdentifier: 'trackId',
|
|
30
|
+
});
|
|
31
|
+
return new TrackType({
|
|
32
|
+
name: 'FeatureTrack',
|
|
33
|
+
configSchema,
|
|
34
|
+
stateModel: createBaseTrackModel(pluginManager, 'FeatureTrack', configSchema),
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
pluginManager.addTrackType(() => {
|
|
38
|
+
const configSchema = ConfigurationSchema('BasicTrack', {}, {
|
|
39
|
+
baseConfiguration: createBaseTrackConfig(pluginManager),
|
|
40
|
+
explicitIdentifier: 'trackId',
|
|
41
|
+
});
|
|
42
|
+
return new TrackType({
|
|
43
|
+
name: 'BasicTrack',
|
|
44
|
+
configSchema,
|
|
45
|
+
stateModel: createBaseTrackModel(pluginManager, 'BasicTrack', configSchema),
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
pluginManager.addDisplayType(() => {
|
|
49
|
+
const configSchema = linearBareDisplayConfigSchemaFactory(pluginManager);
|
|
50
|
+
return new DisplayType({
|
|
51
|
+
name: 'LinearBareDisplay',
|
|
52
|
+
configSchema,
|
|
53
|
+
stateModel: LinearBareDisplayStateModelFactory(configSchema),
|
|
54
|
+
trackType: 'BasicTrack',
|
|
55
|
+
viewType: 'LinearGenomeView',
|
|
56
|
+
ReactComponent: BaseLinearDisplayComponent,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
pluginManager.addDisplayType(() => {
|
|
60
|
+
const configSchema = linearBasicDisplayConfigSchemaFactory(pluginManager);
|
|
61
|
+
return new DisplayType({
|
|
62
|
+
name: 'LinearBasicDisplay',
|
|
63
|
+
configSchema,
|
|
64
|
+
stateModel: linearBasicDisplayModelFactory(configSchema),
|
|
65
|
+
trackType: 'FeatureTrack',
|
|
66
|
+
viewType: 'LinearGenomeView',
|
|
67
|
+
ReactComponent: BaseLinearDisplayComponent,
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
pluginManager.addViewType(() => new ViewType({
|
|
71
|
+
name: 'LinearGenomeView',
|
|
72
|
+
stateModel: linearGenomeViewStateModelFactory(pluginManager),
|
|
73
|
+
ReactComponent: lazy(() => import('./LinearGenomeView/components/LinearGenomeView')),
|
|
74
|
+
}));
|
|
75
|
+
pluginManager.addToExtensionPoint('LaunchView-LinearGenomeView',
|
|
76
|
+
// @ts-ignore
|
|
77
|
+
async ({ session, assembly, loc, tracks = [], }) => {
|
|
78
|
+
try {
|
|
79
|
+
const { assemblyManager } = session;
|
|
80
|
+
const view = session.addView('LinearGenomeView', {});
|
|
81
|
+
await when(() => !!view.volatileWidth);
|
|
82
|
+
if (!assembly) {
|
|
83
|
+
throw new Error('No assembly provided when launching linear genome view');
|
|
84
|
+
}
|
|
85
|
+
const asm = await assemblyManager.waitForAssembly(assembly);
|
|
86
|
+
if (!asm) {
|
|
87
|
+
throw new Error(`Assembly "${assembly}" not found when launching linear genome view`);
|
|
88
|
+
}
|
|
89
|
+
view.navToLocString(loc, assembly);
|
|
90
|
+
const idsNotFound = [];
|
|
91
|
+
tracks.forEach(track => {
|
|
92
|
+
try {
|
|
93
|
+
view.showTrack(track);
|
|
94
|
+
}
|
|
95
|
+
catch (e) {
|
|
96
|
+
if (`${e}`.match('Could not resolve identifier')) {
|
|
97
|
+
idsNotFound.push(track);
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
throw e;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
if (idsNotFound.length) {
|
|
105
|
+
throw new Error(`Could not resolve identifiers: ${idsNotFound.join(',')}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
session.notify(`${e}`, 'error');
|
|
110
|
+
throw e;
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
configure(pluginManager) {
|
|
115
|
+
if (isAbstractMenuManager(pluginManager.rootModel)) {
|
|
116
|
+
pluginManager.rootModel.appendToSubMenu(['Add'], {
|
|
117
|
+
label: 'Linear genome view',
|
|
118
|
+
icon: LineStyleIcon,
|
|
119
|
+
onClick: (session) => {
|
|
120
|
+
session.addView('LinearGenomeView', {});
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
export { baseLinearDisplayConfigSchema, linearBareDisplayConfigSchemaFactory, linearBasicDisplayConfigSchemaFactory, linearBasicDisplayModelFactory, renderToSvg, BaseLinearDisplayComponent, BaseLinearDisplay, RefNameAutocomplete, SearchBox, };
|
|
127
|
+
//# sourceMappingURL=index.js.map
|
package/esm/index.js.map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,EAAE;wBACV,IAAI,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE;4BAChD,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;yBACxB;6BAAM;4BACL,MAAM,CAAC,CAAA;yBACR;qBACF;gBACH,CAAC,CAAC,CAAA;gBACF,IAAI,WAAW,CAAC,MAAM,EAAE;oBACtB,MAAM,IAAI,KAAK,CACb,kCAAkC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAC1D,CAAA;iBACF;aACF;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;gBAC/B,MAAM,CAAC,CAAA;aACR;QACH,CAAC,CACF,CAAA;IACH,CAAC;IAED,SAAS,CAAC,aAA4B;QACpC,IAAI,qBAAqB,CAAC,aAAa,CAAC,SAAS,CAAC,EAAE;YAClD,aAAa,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,KAAK,CAAC,EAAE;gBAC/C,KAAK,EAAE,oBAAoB;gBAC3B,IAAI,EAAE,aAAa;gBACnB,OAAO,EAAE,CAAC,OAA6B,EAAE,EAAE;oBACzC,OAAO,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAA;gBACzC,CAAC;aACF,CAAC,CAAA;SACH;IACH,CAAC;CACF;AAED,OAAO,EACL,6BAA6B,EAC7B,oCAAoC,EACpC,qCAAqC,EACrC,8BAA8B,EAC9B,WAAW,EACX,0BAA0B,EAC1B,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,GACV,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-linear-genome-view",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "JBrowse 2 linear genome view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -16,46 +16,54 @@
|
|
|
16
16
|
},
|
|
17
17
|
"author": "JBrowse Team",
|
|
18
18
|
"distMain": "dist/index.js",
|
|
19
|
+
"distModule": "esm/index.js",
|
|
19
20
|
"srcMain": "src/index.ts",
|
|
21
|
+
"srcModule": "src/index.ts",
|
|
20
22
|
"main": "dist/index.js",
|
|
21
23
|
"files": [
|
|
22
24
|
"dist",
|
|
23
|
-
"src"
|
|
25
|
+
"src",
|
|
26
|
+
"esm"
|
|
24
27
|
],
|
|
25
28
|
"scripts": {
|
|
26
|
-
"
|
|
29
|
+
"prebuild": "npm run clean",
|
|
30
|
+
"build": "npm-run-all build:*",
|
|
31
|
+
"build:esm": "tsc --build tsconfig.build.esm.json",
|
|
32
|
+
"build:es5": "tsc --build tsconfig.build.es5.json",
|
|
33
|
+
"clean": "rimraf dist esm *.tsbuildinfo",
|
|
27
34
|
"test": "cd ../..; jest plugins/linear-genome-view",
|
|
28
35
|
"prepublishOnly": "yarn test",
|
|
29
36
|
"prepack": "yarn build; yarn useDist",
|
|
30
37
|
"postpack": "yarn useSrc",
|
|
31
38
|
"useDist": "node ../../scripts/useDist.js",
|
|
32
|
-
"useSrc": "node ../../scripts/useSrc.js"
|
|
33
|
-
"postbuild": "tsc --build tsconfig.build.json"
|
|
39
|
+
"useSrc": "node ../../scripts/useSrc.js"
|
|
34
40
|
},
|
|
35
41
|
"dependencies": {
|
|
36
42
|
"@babel/runtime": "^7.17.9",
|
|
37
|
-
"@
|
|
43
|
+
"@mui/icons-material": "^5.0.1",
|
|
38
44
|
"@popperjs/core": "^2.11.0",
|
|
39
45
|
"clone": "^2.1.2",
|
|
40
46
|
"clsx": "^1.0.4",
|
|
41
47
|
"copy-to-clipboard": "^3.3.1",
|
|
42
48
|
"file-saver": "^2.0.0",
|
|
49
|
+
"material-ui-popup-state": "^3.0.0",
|
|
43
50
|
"normalize-wheel": "^1.0.1",
|
|
44
51
|
"react-popper": "^2.0.0"
|
|
45
52
|
},
|
|
46
53
|
"peerDependencies": {
|
|
47
54
|
"@jbrowse/core": "^1.0.0",
|
|
48
|
-
"@material
|
|
49
|
-
"
|
|
50
|
-
"mobx": "^
|
|
51
|
-
"mobx-
|
|
52
|
-
"mobx-state-tree": "3.14.1",
|
|
55
|
+
"@mui/material": "^5.0.0",
|
|
56
|
+
"mobx": "^6.0.0",
|
|
57
|
+
"mobx-react": "^7.0.0",
|
|
58
|
+
"mobx-state-tree": "^5.0.0",
|
|
53
59
|
"prop-types": "^15.0.0",
|
|
54
60
|
"react": ">=16.8.0",
|
|
55
|
-
"react-dom": ">=16.8.0"
|
|
61
|
+
"react-dom": ">=16.8.0",
|
|
62
|
+
"tss-react": "^3.0.0"
|
|
56
63
|
},
|
|
57
64
|
"publishConfig": {
|
|
58
65
|
"access": "public"
|
|
59
66
|
},
|
|
60
|
-
"
|
|
67
|
+
"module": "esm/index.js",
|
|
68
|
+
"gitHead": "ecc7f5d47351a5ea04bc00f3a6eb6dfb607342e6"
|
|
61
69
|
}
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
import React, { useState, useRef
|
|
1
|
+
import React, { useState, useRef } from 'react'
|
|
2
2
|
import { observer } from 'mobx-react'
|
|
3
|
-
import {
|
|
3
|
+
import { useTheme } from '@mui/material'
|
|
4
|
+
import { makeStyles } from 'tss-react/mui'
|
|
4
5
|
import { getConf } from '@jbrowse/core/configuration'
|
|
5
6
|
import { Menu } from '@jbrowse/core/ui'
|
|
6
|
-
import { usePopper } from 'react-popper'
|
|
7
7
|
|
|
8
8
|
// locals
|
|
9
|
+
import Tooltip from './Tooltip'
|
|
9
10
|
import LinearBlocks from './LinearBlocks'
|
|
10
11
|
import { BaseLinearDisplayModel } from '../models/BaseLinearDisplayModel'
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
return Math.round(value * 1e5) / 1e5
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const useStyles = makeStyles(theme => ({
|
|
13
|
+
const useStyles = makeStyles()({
|
|
17
14
|
display: {
|
|
18
15
|
position: 'relative',
|
|
19
16
|
whiteSpace: 'nowrap',
|
|
@@ -21,93 +18,12 @@ const useStyles = makeStyles(theme => ({
|
|
|
21
18
|
width: '100%',
|
|
22
19
|
minHeight: '100%',
|
|
23
20
|
},
|
|
24
|
-
|
|
25
|
-
// these styles come from
|
|
26
|
-
// https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Tooltip/Tooltip.js
|
|
27
|
-
tooltip: {
|
|
28
|
-
pointerEvents: 'none',
|
|
29
|
-
backgroundColor: alpha(theme.palette.grey[700], 0.9),
|
|
30
|
-
borderRadius: theme.shape.borderRadius,
|
|
31
|
-
color: theme.palette.common.white,
|
|
32
|
-
fontFamily: theme.typography.fontFamily,
|
|
33
|
-
padding: '4px 8px',
|
|
34
|
-
fontSize: theme.typography.pxToRem(12),
|
|
35
|
-
lineHeight: `${round(14 / 10)}em`,
|
|
36
|
-
maxWidth: 300,
|
|
37
|
-
wordWrap: 'break-word',
|
|
38
|
-
},
|
|
39
|
-
}))
|
|
40
|
-
|
|
41
|
-
const TooltipContents = React.forwardRef<
|
|
42
|
-
HTMLDivElement,
|
|
43
|
-
{ message: React.ReactNode | string }
|
|
44
|
-
>(({ message }: { message: React.ReactNode | string }, ref) => {
|
|
45
|
-
return <div ref={ref}>{message}</div>
|
|
46
21
|
})
|
|
47
22
|
|
|
48
|
-
const Tooltip = observer(
|
|
49
|
-
({
|
|
50
|
-
model,
|
|
51
|
-
clientMouseCoord,
|
|
52
|
-
}: {
|
|
53
|
-
model: BaseLinearDisplayModel
|
|
54
|
-
clientMouseCoord: Coord
|
|
55
|
-
}) => {
|
|
56
|
-
const classes = useStyles()
|
|
57
|
-
const { featureUnderMouse } = model
|
|
58
|
-
const [width, setWidth] = useState(0)
|
|
59
|
-
const [popperElt, setPopperElt] = useState<HTMLDivElement | null>(null)
|
|
60
|
-
|
|
61
|
-
// must be memoized a la https://github.com/popperjs/react-popper/issues/391
|
|
62
|
-
const virtElement = useMemo(
|
|
63
|
-
() => ({
|
|
64
|
-
getBoundingClientRect: () => {
|
|
65
|
-
const x = clientMouseCoord[0] + width / 2 + 20
|
|
66
|
-
const y = clientMouseCoord[1]
|
|
67
|
-
return {
|
|
68
|
-
top: y,
|
|
69
|
-
left: x,
|
|
70
|
-
bottom: y,
|
|
71
|
-
right: x,
|
|
72
|
-
width: 0,
|
|
73
|
-
height: 0,
|
|
74
|
-
x,
|
|
75
|
-
y,
|
|
76
|
-
toJSON() {},
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
}),
|
|
80
|
-
[clientMouseCoord, width],
|
|
81
|
-
)
|
|
82
|
-
const { styles, attributes } = usePopper(virtElement, popperElt)
|
|
83
|
-
|
|
84
|
-
const contents = featureUnderMouse
|
|
85
|
-
? getConf(model, 'mouseover', { feature: featureUnderMouse })
|
|
86
|
-
: undefined
|
|
87
|
-
|
|
88
|
-
return featureUnderMouse && contents ? (
|
|
89
|
-
<Portal>
|
|
90
|
-
<div
|
|
91
|
-
ref={setPopperElt}
|
|
92
|
-
className={classes.tooltip}
|
|
93
|
-
// zIndex needed to go over widget drawer
|
|
94
|
-
style={{ ...styles.popper, zIndex: 100000 }}
|
|
95
|
-
{...attributes.popper}
|
|
96
|
-
>
|
|
97
|
-
<TooltipContents
|
|
98
|
-
ref={elt => setWidth(elt?.getBoundingClientRect().width || 0)}
|
|
99
|
-
message={contents}
|
|
100
|
-
/>
|
|
101
|
-
</div>
|
|
102
|
-
</Portal>
|
|
103
|
-
) : null
|
|
104
|
-
},
|
|
105
|
-
)
|
|
106
|
-
|
|
107
23
|
type Coord = [number, number]
|
|
108
24
|
const BaseLinearDisplay = observer(
|
|
109
25
|
(props: { model: BaseLinearDisplayModel; children?: React.ReactNode }) => {
|
|
110
|
-
const classes = useStyles()
|
|
26
|
+
const { classes } = useStyles()
|
|
111
27
|
const theme = useTheme()
|
|
112
28
|
const ref = useRef<HTMLDivElement>(null)
|
|
113
29
|
const [clientRect, setClientRect] = useState<DOMRect>()
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { BaseBlock } from '@jbrowse/core/util/blockTypes'
|
|
3
|
-
import { makeStyles } from '
|
|
3
|
+
import { makeStyles } from 'tss-react/mui'
|
|
4
4
|
import { observer } from 'mobx-react'
|
|
5
5
|
|
|
6
|
-
const useStyles = makeStyles(theme => ({
|
|
6
|
+
const useStyles = makeStyles()(theme => ({
|
|
7
7
|
contentBlock: {
|
|
8
8
|
position: 'relative',
|
|
9
9
|
minHeight: '100%',
|
|
@@ -30,7 +30,7 @@ const useStyles = makeStyles(theme => ({
|
|
|
30
30
|
|
|
31
31
|
const ContentBlock = observer(
|
|
32
32
|
({ block, children }: { block: BaseBlock; children: React.ReactNode }) => {
|
|
33
|
-
const classes = useStyles()
|
|
33
|
+
const { classes } = useStyles()
|
|
34
34
|
const { widthPx } = block
|
|
35
35
|
return (
|
|
36
36
|
<div style={{ width: widthPx }} className={classes.contentBlock}>
|
|
@@ -41,7 +41,7 @@ const ContentBlock = observer(
|
|
|
41
41
|
)
|
|
42
42
|
|
|
43
43
|
function ElidedBlock({ width }: { width: number }) {
|
|
44
|
-
const classes = useStyles()
|
|
44
|
+
const { classes } = useStyles()
|
|
45
45
|
return <div className={classes.elidedBlock} style={{ width }} />
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -54,7 +54,7 @@ function InterRegionPaddingBlock({
|
|
|
54
54
|
width: number
|
|
55
55
|
style?: React.CSSProperties
|
|
56
56
|
}) {
|
|
57
|
-
const classes = useStyles()
|
|
57
|
+
const { classes } = useStyles()
|
|
58
58
|
return (
|
|
59
59
|
<div
|
|
60
60
|
style={{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { makeStyles } from '
|
|
2
|
+
import { makeStyles } from 'tss-react/mui'
|
|
3
3
|
import { getContainingView } from '@jbrowse/core/util'
|
|
4
4
|
import { observer } from 'mobx-react'
|
|
5
5
|
import {
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from './Block'
|
|
17
17
|
import { LinearGenomeViewModel } from '../../LinearGenomeView'
|
|
18
18
|
|
|
19
|
-
const useStyles = makeStyles({
|
|
19
|
+
const useStyles = makeStyles()({
|
|
20
20
|
linearBlocks: {
|
|
21
21
|
whiteSpace: 'nowrap',
|
|
22
22
|
textAlign: 'left',
|
|
@@ -39,7 +39,7 @@ const useStyles = makeStyles({
|
|
|
39
39
|
})
|
|
40
40
|
const RenderedBlocks = observer(
|
|
41
41
|
({ model }: { model: BaseLinearDisplayModel }) => {
|
|
42
|
-
const classes = useStyles()
|
|
42
|
+
const { classes } = useStyles()
|
|
43
43
|
const { blockDefinitions, blockState } = model
|
|
44
44
|
return (
|
|
45
45
|
<>
|
|
@@ -95,7 +95,7 @@ const RenderedBlocks = observer(
|
|
|
95
95
|
},
|
|
96
96
|
)
|
|
97
97
|
function LinearBlocks({ model }: { model: BaseLinearDisplayModel }) {
|
|
98
|
-
const classes = useStyles()
|
|
98
|
+
const { classes } = useStyles()
|
|
99
99
|
const { blockDefinitions } = model
|
|
100
100
|
const viewModel = getContainingView(model) as LinearGenomeViewModel
|
|
101
101
|
return (
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import React, { useEffect, useState } from 'react'
|
|
2
|
-
import Typography from '@material
|
|
3
|
-
import { makeStyles } from '
|
|
2
|
+
import { Typography, Button } from '@mui/material'
|
|
3
|
+
import { makeStyles } from 'tss-react/mui'
|
|
4
4
|
import { observer } from 'mobx-react'
|
|
5
5
|
import { getParent } from 'mobx-state-tree'
|
|
6
6
|
import { getParentRenderProps } from '@jbrowse/core/util/tracks'
|
|
7
|
-
import
|
|
8
|
-
import RefreshIcon from '@material-ui/icons/Refresh'
|
|
7
|
+
import RefreshIcon from '@mui/icons-material/Refresh'
|
|
9
8
|
|
|
10
|
-
const useStyles = makeStyles(theme => ({
|
|
9
|
+
const useStyles = makeStyles()(theme => ({
|
|
11
10
|
loading: {
|
|
12
11
|
paddingLeft: '0.6em',
|
|
13
12
|
backgroundColor: theme.palette.action.disabledBackground,
|
|
@@ -73,7 +72,7 @@ function Repeater({ children }: { children: React.ReactNode }) {
|
|
|
73
72
|
const LoadingMessage = observer(({ model }: { model: any }) => {
|
|
74
73
|
// only show the loading message after 300ms to prevent excessive flickering
|
|
75
74
|
const [shown, setShown] = useState(false)
|
|
76
|
-
const classes = useStyles()
|
|
75
|
+
const { classes } = useStyles()
|
|
77
76
|
useEffect(() => {
|
|
78
77
|
let killed = false
|
|
79
78
|
const timeout = setTimeout(() => {
|
|
@@ -108,7 +107,7 @@ function BlockMessage({
|
|
|
108
107
|
}: {
|
|
109
108
|
messageContent: string | React.ReactNode
|
|
110
109
|
}) {
|
|
111
|
-
const classes = useStyles()
|
|
110
|
+
const { classes } = useStyles()
|
|
112
111
|
|
|
113
112
|
return React.isValidElement(messageContent) ? (
|
|
114
113
|
<div className={classes.blockReactNodeMessage}>{messageContent}</div>
|
|
@@ -128,7 +127,7 @@ function BlockError({
|
|
|
128
127
|
reload: () => void
|
|
129
128
|
displayHeight: number
|
|
130
129
|
}) {
|
|
131
|
-
const classes = useStyles()
|
|
130
|
+
const { classes } = useStyles()
|
|
132
131
|
return (
|
|
133
132
|
<div className={classes.blockError} style={{ height: displayHeight }}>
|
|
134
133
|
{reload ? (
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { useState, useMemo } from 'react'
|
|
2
|
+
import { getConf } from '@jbrowse/core/configuration'
|
|
3
|
+
import { SanitizedHTML } from '@jbrowse/core/ui'
|
|
4
|
+
import { observer } from 'mobx-react'
|
|
5
|
+
import { Portal, alpha } from '@mui/material'
|
|
6
|
+
import { makeStyles } from 'tss-react/mui'
|
|
7
|
+
import { usePopper } from 'react-popper'
|
|
8
|
+
|
|
9
|
+
// locals
|
|
10
|
+
import { BaseLinearDisplayModel } from '../models/BaseLinearDisplayModel'
|
|
11
|
+
|
|
12
|
+
function round(value: number) {
|
|
13
|
+
return Math.round(value * 1e5) / 1e5
|
|
14
|
+
}
|
|
15
|
+
const useStyles = makeStyles()(theme => ({
|
|
16
|
+
// these styles come from
|
|
17
|
+
// https://github.com/mui-org/material-ui/blob/master/packages/material-ui/src/Tooltip/Tooltip.js
|
|
18
|
+
tooltip: {
|
|
19
|
+
pointerEvents: 'none',
|
|
20
|
+
backgroundColor: alpha(theme.palette.grey[700], 0.9),
|
|
21
|
+
borderRadius: theme.shape.borderRadius,
|
|
22
|
+
color: theme.palette.common.white,
|
|
23
|
+
fontFamily: theme.typography.fontFamily,
|
|
24
|
+
padding: '4px 8px',
|
|
25
|
+
fontSize: theme.typography.pxToRem(12),
|
|
26
|
+
lineHeight: `${round(14 / 10)}em`,
|
|
27
|
+
maxWidth: 300,
|
|
28
|
+
wordWrap: 'break-word',
|
|
29
|
+
},
|
|
30
|
+
}))
|
|
31
|
+
|
|
32
|
+
const TooltipContents = React.forwardRef<
|
|
33
|
+
HTMLDivElement,
|
|
34
|
+
{ message: React.ReactNode | string }
|
|
35
|
+
>(({ message }: { message: React.ReactNode | string }, ref) => {
|
|
36
|
+
return (
|
|
37
|
+
<div ref={ref}>
|
|
38
|
+
{React.isValidElement(message) ? (
|
|
39
|
+
message
|
|
40
|
+
) : message ? (
|
|
41
|
+
<SanitizedHTML html={String(message)} />
|
|
42
|
+
) : null}
|
|
43
|
+
</div>
|
|
44
|
+
)
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
type Coord = [number, number]
|
|
48
|
+
const Tooltip = observer(
|
|
49
|
+
({
|
|
50
|
+
model,
|
|
51
|
+
clientMouseCoord,
|
|
52
|
+
}: {
|
|
53
|
+
model: BaseLinearDisplayModel
|
|
54
|
+
clientMouseCoord: Coord
|
|
55
|
+
}) => {
|
|
56
|
+
const { classes } = useStyles()
|
|
57
|
+
const { featureUnderMouse } = model
|
|
58
|
+
const [width, setWidth] = useState(0)
|
|
59
|
+
const [popperElt, setPopperElt] = useState<HTMLDivElement | null>(null)
|
|
60
|
+
|
|
61
|
+
// must be memoized a la https://github.com/popperjs/react-popper/issues/391
|
|
62
|
+
const virtElement = useMemo(
|
|
63
|
+
() => ({
|
|
64
|
+
getBoundingClientRect: () => {
|
|
65
|
+
const x = clientMouseCoord[0] + width / 2 + 20
|
|
66
|
+
const y = clientMouseCoord[1]
|
|
67
|
+
return {
|
|
68
|
+
top: y,
|
|
69
|
+
left: x,
|
|
70
|
+
bottom: y,
|
|
71
|
+
right: x,
|
|
72
|
+
width: 0,
|
|
73
|
+
height: 0,
|
|
74
|
+
x,
|
|
75
|
+
y,
|
|
76
|
+
toJSON() {},
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
}),
|
|
80
|
+
[clientMouseCoord, width],
|
|
81
|
+
)
|
|
82
|
+
const { styles, attributes } = usePopper(virtElement, popperElt)
|
|
83
|
+
|
|
84
|
+
const contents = featureUnderMouse
|
|
85
|
+
? getConf(model, 'mouseover', { feature: featureUnderMouse })
|
|
86
|
+
: undefined
|
|
87
|
+
|
|
88
|
+
return featureUnderMouse && contents ? (
|
|
89
|
+
<Portal>
|
|
90
|
+
<div
|
|
91
|
+
ref={setPopperElt}
|
|
92
|
+
className={classes.tooltip}
|
|
93
|
+
// zIndex needed to go over widget drawer
|
|
94
|
+
style={{ ...styles.popper, zIndex: 100000 }}
|
|
95
|
+
{...attributes.popper}
|
|
96
|
+
>
|
|
97
|
+
<TooltipContents
|
|
98
|
+
ref={elt => setWidth(elt?.getBoundingClientRect().width || 0)}
|
|
99
|
+
message={contents}
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
</Portal>
|
|
103
|
+
) : null
|
|
104
|
+
},
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
export default Tooltip
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
2
|
import React from 'react'
|
|
3
|
-
import { Button, Typography } from '@material
|
|
3
|
+
import { Button, Typography } from '@mui/material'
|
|
4
4
|
import { BaseDisplay } from '@jbrowse/core/pluggableElementTypes/models'
|
|
5
5
|
import { getConf } from '@jbrowse/core/configuration'
|
|
6
6
|
import { MenuItem } from '@jbrowse/core/ui'
|
|
7
7
|
import {
|
|
8
8
|
isAbortException,
|
|
9
9
|
getContainingView,
|
|
10
|
+
getContainingTrack,
|
|
10
11
|
getSession,
|
|
11
12
|
getViewParams,
|
|
12
13
|
isSelectionContainer,
|
|
@@ -24,7 +25,7 @@ import {
|
|
|
24
25
|
import { autorun } from 'mobx'
|
|
25
26
|
import { addDisposer, isAlive, types, Instance } from 'mobx-state-tree'
|
|
26
27
|
// icons
|
|
27
|
-
import MenuOpenIcon from '@
|
|
28
|
+
import MenuOpenIcon from '@mui/icons-material/MenuOpen'
|
|
28
29
|
|
|
29
30
|
import { LinearGenomeViewModel, ExportSvgOptions } from '../../LinearGenomeView'
|
|
30
31
|
import { Tooltip } from '../components/BaseLinearDisplay'
|
|
@@ -333,8 +334,13 @@ export const BaseLinearDisplay = types
|
|
|
333
334
|
const featureWidget = session.addWidget(
|
|
334
335
|
'BaseFeatureWidget',
|
|
335
336
|
'baseFeature',
|
|
336
|
-
{
|
|
337
|
+
{
|
|
338
|
+
view: getContainingView(self),
|
|
339
|
+
track: getContainingTrack(self),
|
|
340
|
+
featureData: feature.toJSON(),
|
|
341
|
+
},
|
|
337
342
|
)
|
|
343
|
+
|
|
338
344
|
session.showWidget(featureWidget)
|
|
339
345
|
}
|
|
340
346
|
if (isSelectionContainer(session)) {
|
|
@@ -546,12 +552,12 @@ export const BaseLinearDisplay = types
|
|
|
546
552
|
renderProps() {
|
|
547
553
|
const view = getContainingView(self) as LGV
|
|
548
554
|
return {
|
|
549
|
-
...getParentRenderProps(self),
|
|
555
|
+
...(getParentRenderProps(self) as any),
|
|
550
556
|
notReady:
|
|
551
557
|
self.currBpPerPx !== view.bpPerPx || !self.estimatedRegionStats,
|
|
552
558
|
rpcDriverName: self.rpcDriverName,
|
|
553
559
|
displayModel: self,
|
|
554
|
-
onFeatureClick(_: unknown, featureId
|
|
560
|
+
onFeatureClick(_: unknown, featureId?: string) {
|
|
555
561
|
const f = featureId || self.featureIdUnderMouse
|
|
556
562
|
if (!f) {
|
|
557
563
|
self.clearFeatureSelection()
|
|
@@ -566,7 +572,7 @@ export const BaseLinearDisplay = types
|
|
|
566
572
|
self.clearFeatureSelection()
|
|
567
573
|
},
|
|
568
574
|
// similar to click but opens a menu with further options
|
|
569
|
-
onFeatureContextMenu(_: unknown, featureId
|
|
575
|
+
onFeatureContextMenu(_: unknown, featureId?: string) {
|
|
570
576
|
const f = featureId || self.featureIdUnderMouse
|
|
571
577
|
if (!f) {
|
|
572
578
|
self.clearFeatureSelection()
|
|
@@ -576,7 +582,7 @@ export const BaseLinearDisplay = types
|
|
|
576
582
|
}
|
|
577
583
|
},
|
|
578
584
|
|
|
579
|
-
onMouseMove(_: unknown, featureId
|
|
585
|
+
onMouseMove(_: unknown, featureId?: string) {
|
|
580
586
|
self.setFeatureIdUnderMouse(featureId)
|
|
581
587
|
},
|
|
582
588
|
|
|
@@ -673,7 +679,9 @@ export const BaseLinearDisplay = types
|
|
|
673
679
|
},
|
|
674
680
|
}))
|
|
675
681
|
.postProcessSnapshot(self => {
|
|
676
|
-
|
|
682
|
+
// xref https://github.com/mobxjs/mobx-state-tree/issues/1524 for Omit
|
|
683
|
+
const r = self as Omit<typeof self, symbol>
|
|
684
|
+
const { blockState, ...rest } = r
|
|
677
685
|
return rest
|
|
678
686
|
})
|
|
679
687
|
|
|
@@ -163,7 +163,7 @@ const blockState = types
|
|
|
163
163
|
self.maxHeightReached = false
|
|
164
164
|
self.ReactComponent = ServerSideRenderedBlockContent
|
|
165
165
|
self.renderProps = undefined
|
|
166
|
-
getParent(self, 2).reload()
|
|
166
|
+
getParent<any>(self, 2).reload()
|
|
167
167
|
},
|
|
168
168
|
beforeDestroy() {
|
|
169
169
|
if (renderInProgress && !renderInProgress.signal.aborted) {
|