@jbrowse/plugin-linear-genome-view 4.0.3 → 4.1.1

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.
Files changed (74) hide show
  1. package/esm/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.d.ts +1 -0
  2. package/esm/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.js +7 -3
  3. package/esm/BaseLinearDisplay/components/Tooltip.js +1 -1
  4. package/esm/BaseLinearDisplay/model.d.ts +9 -0
  5. package/esm/BaseLinearDisplay/model.js +4 -4
  6. package/esm/BaseLinearDisplay/models/NonBlockCanvasDisplayMixin.d.ts +5 -0
  7. package/esm/BaseLinearDisplay/models/NonBlockCanvasDisplayMixin.js +11 -0
  8. package/esm/BaseLinearDisplay/util.d.ts +1 -0
  9. package/esm/BaseLinearDisplay/util.js +11 -1
  10. package/esm/LinearBareDisplay/model.d.ts +9 -0
  11. package/esm/LinearBasicDisplay/model.d.ts +26 -4
  12. package/esm/LinearBasicDisplay/model.js +25 -21
  13. package/esm/LinearFeatureDisplay/components/AddFiltersDialog.d.ts +1 -1
  14. package/esm/LinearFeatureDisplay/components/AddFiltersDialog.js +6 -7
  15. package/esm/LinearFeatureDisplay/model.d.ts +18 -3
  16. package/esm/LinearFeatureDisplay/model.js +64 -24
  17. package/esm/LinearGenomeView/afterAttach.js +8 -2
  18. package/esm/LinearGenomeView/components/CenterLine.d.ts +1 -1
  19. package/esm/LinearGenomeView/components/Gridlines.d.ts +1 -1
  20. package/esm/LinearGenomeView/components/Header.d.ts +1 -1
  21. package/esm/LinearGenomeView/components/HeaderPanControls.d.ts +1 -1
  22. package/esm/LinearGenomeView/components/HeaderRegionWidth.d.ts +1 -1
  23. package/esm/LinearGenomeView/components/HeaderRegionWidth.js +2 -2
  24. package/esm/LinearGenomeView/components/HeaderTrackSelectorButton.d.ts +1 -1
  25. package/esm/LinearGenomeView/components/HeaderZoomControls.d.ts +1 -1
  26. package/esm/LinearGenomeView/components/HeaderZoomControls.js +5 -5
  27. package/esm/LinearGenomeView/components/ImportForm.d.ts +1 -1
  28. package/esm/LinearGenomeView/components/ImportFormRefNameAutocomplete.d.ts +1 -1
  29. package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
  30. package/esm/LinearGenomeView/components/LinearGenomeViewContainer.d.ts +1 -1
  31. package/esm/LinearGenomeView/components/MiniControls.d.ts +1 -1
  32. package/esm/LinearGenomeView/components/MiniControls.js +3 -3
  33. package/esm/LinearGenomeView/components/NoTracksActiveButton.d.ts +1 -1
  34. package/esm/LinearGenomeView/components/OverviewRubberband.d.ts +1 -1
  35. package/esm/LinearGenomeView/components/OverviewRubberbandHoverTooltip.d.ts +1 -1
  36. package/esm/LinearGenomeView/components/OverviewScalebar.d.ts +1 -1
  37. package/esm/LinearGenomeView/components/OverviewScalebarPolygon.d.ts +1 -1
  38. package/esm/LinearGenomeView/components/OverviewScalebarTickLabels.d.ts +1 -1
  39. package/esm/LinearGenomeView/components/RefNameAutocomplete/AutocompleteTextField.js +4 -2
  40. package/esm/LinearGenomeView/components/Rubberband.d.ts +1 -1
  41. package/esm/LinearGenomeView/components/Rubberband.js +3 -3
  42. package/esm/LinearGenomeView/components/Scalebar.d.ts +2 -2
  43. package/esm/LinearGenomeView/components/Scalebar.js +3 -4
  44. package/esm/LinearGenomeView/components/ScalebarCoordinateLabels.d.ts +1 -1
  45. package/esm/LinearGenomeView/components/ScalebarRefNameLabels.d.ts +1 -1
  46. package/esm/LinearGenomeView/components/ScalebarRefNameLabels.js +126 -4
  47. package/esm/LinearGenomeView/components/TrackContainer.d.ts +1 -1
  48. package/esm/LinearGenomeView/components/TrackLabel.d.ts +1 -1
  49. package/esm/LinearGenomeView/components/TrackLabel.js +3 -4
  50. package/esm/LinearGenomeView/components/TrackLabelContainer.d.ts +1 -1
  51. package/esm/LinearGenomeView/components/TrackLabelDragHandle.d.ts +1 -1
  52. package/esm/LinearGenomeView/components/TrackRenderingContainer.d.ts +1 -1
  53. package/esm/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  54. package/esm/LinearGenomeView/components/TracksContainer.js +2 -2
  55. package/esm/LinearGenomeView/components/VerticalGuide.d.ts +1 -1
  56. package/esm/LinearGenomeView/components/useRangeSelect.d.ts +2 -2
  57. package/esm/LinearGenomeView/components/useRangeSelect.js +28 -4
  58. package/esm/LinearGenomeView/components/useSideScroll.d.ts +1 -1
  59. package/esm/LinearGenomeView/index.d.ts +1 -0
  60. package/esm/LinearGenomeView/index.js +1 -0
  61. package/esm/LinearGenomeView/model.d.ts +14 -3
  62. package/esm/LinearGenomeView/model.js +52 -16
  63. package/esm/LinearGenomeView/svgcomponents/SVGGridlines.d.ts +1 -1
  64. package/esm/LinearGenomeView/svgcomponents/SVGHeader.d.ts +1 -1
  65. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.d.ts +1 -1
  66. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +1 -1
  67. package/esm/LinearGenomeView/svgcomponents/SVGRuler.d.ts +1 -1
  68. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +1 -1
  69. package/esm/LinearGenomeView/svgcomponents/SVGTracks.d.ts +1 -1
  70. package/esm/LinearGenomeView/types.d.ts +9 -1
  71. package/esm/LinearGenomeView/util.d.ts +6 -2
  72. package/esm/LinearGenomeView/util.js +17 -18
  73. package/esm/index.d.ts +10 -0
  74. package/package.json +6 -5
@@ -8,6 +8,7 @@ export interface NonBlockCanvasDisplayModel {
8
8
  drawn: boolean;
9
9
  loading: boolean;
10
10
  lastDrawnOffsetPx?: number;
11
+ lastDrawnBpPerPx?: number;
11
12
  statusMessage?: string;
12
13
  showLegend?: boolean;
13
14
  legendItems?: () => LegendItem[];
@@ -31,14 +31,18 @@ const NonBlockCanvasDisplayComponent = observer(function NonBlockCanvasDisplayCo
31
31
  return error ? (_jsx(BlockErrorMessage, { model: model })) : regionTooLarge ? (model.regionCannotBeRendered()) : (_jsx(DataDisplay, { model: model, children: children }));
32
32
  });
33
33
  const DataDisplay = observer(function DataDisplay({ model, children, }) {
34
- const { drawn, loading, showLegend, legendItems } = model;
34
+ const { drawn, loading, showLegend, legendItems, lastDrawnBpPerPx } = model;
35
35
  const view = getContainingView(model);
36
36
  const items = legendItems?.() ?? [];
37
- const calculatedLeft = (model.lastDrawnOffsetPx ?? 0) - view.offsetPx;
37
+ const hasZoomed = lastDrawnBpPerPx !== undefined && lastDrawnBpPerPx !== view.bpPerPx;
38
+ const calculatedLeft = hasZoomed
39
+ ? 0
40
+ : (model.lastDrawnOffsetPx ?? 0) - view.offsetPx;
38
41
  return (_jsxs("div", { "data-testid": `drawn-${drawn}`, children: [_jsx("div", { style: {
39
42
  position: 'absolute',
40
43
  left: calculatedLeft,
41
- }, children: children }), showLegend && items.length > 0 ? _jsx(FloatingLegend, { items: items }) : null, calculatedLeft !== 0 || loading ? _jsx(LoadingBar, { model: model }) : null] }));
44
+ visibility: hasZoomed ? 'hidden' : undefined,
45
+ }, children: children }), showLegend && items.length > 0 ? _jsx(FloatingLegend, { items: items }) : null, hasZoomed || calculatedLeft !== 0 || loading ? (_jsx(LoadingBar, { model: model })) : null] }));
42
46
  });
43
47
  const LoadingBar = observer(function LoadingBar({ model, }) {
44
48
  const { classes } = useStyles();
@@ -11,7 +11,7 @@ const Tooltip = observer(function Tooltip({ model, clientMouseCoord, }) {
11
11
  const { featureUnderMouse, featureIdUnderMouse, mouseoverExtraInformation } = model;
12
12
  const x = clientMouseCoord[0] + 15;
13
13
  const y = clientMouseCoord[1];
14
- const contents = useMemo(() => featureUnderMouse || mouseoverExtraInformation
14
+ const contents = useMemo(() => featureUnderMouse && mouseoverExtraInformation
15
15
  ? getConf(model, 'mouseover', {
16
16
  feature: featureUnderMouse,
17
17
  mouseoverExtraInformation,
@@ -139,6 +139,7 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
139
139
  }> | null;
140
140
  readonly adapterConfig: any;
141
141
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
142
+ readonly isMinimized: boolean;
142
143
  readonly parentDisplay: any;
143
144
  readonly effectiveRpcDriverName: any;
144
145
  } & {
@@ -195,6 +196,7 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
195
196
  }> | null;
196
197
  readonly adapterConfig: any;
197
198
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
199
+ readonly isMinimized: boolean;
198
200
  readonly parentDisplay: any;
199
201
  readonly effectiveRpcDriverName: any;
200
202
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -248,6 +250,7 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
248
250
  }> | null;
249
251
  readonly adapterConfig: any;
250
252
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
253
+ readonly isMinimized: boolean;
251
254
  readonly parentDisplay: any;
252
255
  readonly effectiveRpcDriverName: any;
253
256
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -529,6 +532,7 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
529
532
  }> | null;
530
533
  readonly adapterConfig: any;
531
534
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
535
+ readonly isMinimized: boolean;
532
536
  readonly parentDisplay: any;
533
537
  readonly effectiveRpcDriverName: any;
534
538
  } & {
@@ -585,6 +589,7 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
585
589
  }> | null;
586
590
  readonly adapterConfig: any;
587
591
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
592
+ readonly isMinimized: boolean;
588
593
  readonly parentDisplay: any;
589
594
  readonly effectiveRpcDriverName: any;
590
595
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -638,6 +643,7 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
638
643
  }> | null;
639
644
  readonly adapterConfig: any;
640
645
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
646
+ readonly isMinimized: boolean;
641
647
  readonly parentDisplay: any;
642
648
  readonly effectiveRpcDriverName: any;
643
649
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -864,6 +870,7 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
864
870
  }> | null;
865
871
  readonly adapterConfig: any;
866
872
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
873
+ readonly isMinimized: boolean;
867
874
  readonly parentDisplay: any;
868
875
  readonly effectiveRpcDriverName: any;
869
876
  } & {
@@ -920,6 +927,7 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
920
927
  }> | null;
921
928
  readonly adapterConfig: any;
922
929
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
930
+ readonly isMinimized: boolean;
923
931
  readonly parentDisplay: any;
924
932
  readonly effectiveRpcDriverName: any;
925
933
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -973,6 +981,7 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
973
981
  }> | null;
974
982
  readonly adapterConfig: any;
975
983
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
984
+ readonly isMinimized: boolean;
976
985
  readonly parentDisplay: any;
977
986
  readonly effectiveRpcDriverName: any;
978
987
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -10,13 +10,13 @@ import CloseFullscreenIcon from '@mui/icons-material/CloseFullscreen';
10
10
  import ContentCopyIcon from '@mui/icons-material/ContentCopy';
11
11
  import MenuOpenIcon from '@mui/icons-material/MenuOpen';
12
12
  import { autorun } from 'mobx';
13
+ import { calculateSvgLegendWidth } from "./calculateSvgLegendWidth.js";
13
14
  import { deduplicateFeatureLabels } from "./components/util.js";
14
- import { calculateSvgLegendWidth } from "./index.js";
15
15
  import FeatureDensityMixin from "./models/FeatureDensityMixin.js";
16
16
  import TrackHeightMixin from "./models/TrackHeightMixin.js";
17
17
  import configSchema from "./models/configSchema.js";
18
18
  import BlockState from "./models/serverSideRenderedBlock.js";
19
- import { fetchFeatureByIdRpc, findSubfeatureById, getTranscripts, hasExonsOrCDS, } from "./util.js";
19
+ import { fetchFeatureByIdRpc, findSubfeatureById, getTranscripts, hasIntrons, } from "./util.js";
20
20
  const Tooltip = lazy(() => import("./components/Tooltip.js"));
21
21
  const CollapseIntronsDialog = lazy(() => import("./components/CollapseIntronsDialog/CollapseIntronsDialog.js"));
22
22
  function stateModelFactory() {
@@ -321,7 +321,7 @@ function stateModelFactory() {
321
321
  session.notify('Copied to clipboard', 'success');
322
322
  },
323
323
  },
324
- ...(hasExonsOrCDS(transcripts)
324
+ ...(hasIntrons(transcripts)
325
325
  ? [
326
326
  {
327
327
  label: 'Collapse introns',
@@ -379,7 +379,7 @@ function stateModelFactory() {
379
379
  afterAttach() {
380
380
  addDisposer(self, autorun(function blockDefinitionsAutorun() {
381
381
  try {
382
- if (!isAlive(self)) {
382
+ if (!isAlive(self) || self.isMinimized) {
383
383
  return;
384
384
  }
385
385
  const view = getContainingView(self);
@@ -2,19 +2,24 @@ import type { StopToken } from '@jbrowse/core/util/stopToken';
2
2
  export default function NonBlockCanvasDisplayMixin(): import("@jbrowse/mobx-state-tree").IModelType<{}, {
3
3
  loading: boolean;
4
4
  lastDrawnOffsetPx: number | undefined;
5
+ lastDrawnBpPerPx: number | undefined;
5
6
  ref: HTMLCanvasElement | null;
6
7
  renderingImageData: ImageBitmap | undefined;
7
8
  renderingStopToken: StopToken | undefined;
8
9
  statusMessage: string | undefined;
10
+ canvasDrawn: boolean;
9
11
  } & {
10
12
  readonly drawn: boolean;
13
+ readonly fullyDrawn: boolean;
11
14
  } & {
12
15
  setLastDrawnOffsetPx(n: number): void;
16
+ setLastDrawnBpPerPx(n: number): void;
13
17
  setLoading(f: boolean): void;
14
18
  setRef(ref: HTMLCanvasElement | null): void;
15
19
  setRenderingImageData(imageData: ImageBitmap | undefined): void;
16
20
  setRenderingStopToken(token?: StopToken): void;
17
21
  setStatusMessage(msg?: string): void;
22
+ setCanvasDrawn(drawn: boolean): void;
18
23
  } & {
19
24
  beforeDestroy(): void;
20
25
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>;
@@ -6,20 +6,28 @@ export default function NonBlockCanvasDisplayMixin() {
6
6
  .volatile(() => ({
7
7
  loading: false,
8
8
  lastDrawnOffsetPx: undefined,
9
+ lastDrawnBpPerPx: undefined,
9
10
  ref: null,
10
11
  renderingImageData: undefined,
11
12
  renderingStopToken: undefined,
12
13
  statusMessage: undefined,
14
+ canvasDrawn: false,
13
15
  }))
14
16
  .views(self => ({
15
17
  get drawn() {
16
18
  return self.lastDrawnOffsetPx !== undefined;
17
19
  },
20
+ get fullyDrawn() {
21
+ return this.drawn && !self.loading && self.canvasDrawn;
22
+ },
18
23
  }))
19
24
  .actions(self => ({
20
25
  setLastDrawnOffsetPx(n) {
21
26
  self.lastDrawnOffsetPx = n;
22
27
  },
28
+ setLastDrawnBpPerPx(n) {
29
+ self.lastDrawnBpPerPx = n;
30
+ },
23
31
  setLoading(f) {
24
32
  self.loading = f;
25
33
  },
@@ -35,6 +43,9 @@ export default function NonBlockCanvasDisplayMixin() {
35
43
  setStatusMessage(msg) {
36
44
  self.statusMessage = msg;
37
45
  },
46
+ setCanvasDrawn(drawn) {
47
+ self.canvasDrawn = drawn;
48
+ },
38
49
  }))
39
50
  .actions(self => ({
40
51
  beforeDestroy() {
@@ -11,5 +11,6 @@ export declare function fetchFeatureByIdRpc({ rpcManager, sessionId, trackId, re
11
11
  export declare function findSubfeatureById(feature: Feature, targetId: string): Feature | undefined;
12
12
  export declare function featureHasExonsOrCDS(feature: Feature): boolean;
13
13
  export declare function hasExonsOrCDS(transcripts: Feature[]): boolean;
14
+ export declare function hasIntrons(transcripts: Feature[]): boolean;
14
15
  export declare function getTranscripts(feature?: Feature): Feature[];
15
16
  export declare function drawCanvasImageData(canvas: HTMLCanvasElement | null, imageData: ImageBitmap | undefined): boolean;
@@ -1,4 +1,4 @@
1
- import { SimpleFeature } from '@jbrowse/core/util';
1
+ import { SimpleFeature, mergeIntervals } from '@jbrowse/core/util';
2
2
  export async function fetchFeatureByIdRpc({ rpcManager, sessionId, trackId, rendererType, featureId, parentFeatureId, }) {
3
3
  const lookupId = parentFeatureId || featureId;
4
4
  const { feature: featureData } = (await rpcManager.call(sessionId, 'CoreGetFeatureDetails', {
@@ -38,6 +38,16 @@ export function featureHasExonsOrCDS(feature) {
38
38
  export function hasExonsOrCDS(transcripts) {
39
39
  return transcripts.some(t => featureHasExonsOrCDS(t));
40
40
  }
41
+ export function hasIntrons(transcripts) {
42
+ const subs = transcripts.flatMap(transcript => transcript
43
+ .get('subfeatures')
44
+ ?.filter((f) => f.get('type') === 'exon' || f.get('type') === 'CDS') ?? []);
45
+ if (subs.length < 2) {
46
+ return false;
47
+ }
48
+ const merged = mergeIntervals(subs.map((f) => ({ start: f.get('start'), end: f.get('end') })), 0);
49
+ return merged.length > 1;
50
+ }
41
51
  export function getTranscripts(feature) {
42
52
  if (!feature) {
43
53
  return [];
@@ -134,6 +134,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
134
134
  }> | null;
135
135
  readonly adapterConfig: any;
136
136
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
137
+ readonly isMinimized: boolean;
137
138
  readonly parentDisplay: any;
138
139
  readonly effectiveRpcDriverName: any;
139
140
  } & {
@@ -190,6 +191,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
190
191
  }> | null;
191
192
  readonly adapterConfig: any;
192
193
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
194
+ readonly isMinimized: boolean;
193
195
  readonly parentDisplay: any;
194
196
  readonly effectiveRpcDriverName: any;
195
197
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -243,6 +245,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
243
245
  }> | null;
244
246
  readonly adapterConfig: any;
245
247
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
248
+ readonly isMinimized: boolean;
246
249
  readonly parentDisplay: any;
247
250
  readonly effectiveRpcDriverName: any;
248
251
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -524,6 +527,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
524
527
  }> | null;
525
528
  readonly adapterConfig: any;
526
529
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
530
+ readonly isMinimized: boolean;
527
531
  readonly parentDisplay: any;
528
532
  readonly effectiveRpcDriverName: any;
529
533
  } & {
@@ -580,6 +584,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
580
584
  }> | null;
581
585
  readonly adapterConfig: any;
582
586
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
587
+ readonly isMinimized: boolean;
583
588
  readonly parentDisplay: any;
584
589
  readonly effectiveRpcDriverName: any;
585
590
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -633,6 +638,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
633
638
  }> | null;
634
639
  readonly adapterConfig: any;
635
640
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
641
+ readonly isMinimized: boolean;
636
642
  readonly parentDisplay: any;
637
643
  readonly effectiveRpcDriverName: any;
638
644
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -859,6 +865,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
859
865
  }> | null;
860
866
  readonly adapterConfig: any;
861
867
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
868
+ readonly isMinimized: boolean;
862
869
  readonly parentDisplay: any;
863
870
  readonly effectiveRpcDriverName: any;
864
871
  } & {
@@ -915,6 +922,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
915
922
  }> | null;
916
923
  readonly adapterConfig: any;
917
924
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
925
+ readonly isMinimized: boolean;
918
926
  readonly parentDisplay: any;
919
927
  readonly effectiveRpcDriverName: any;
920
928
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -968,6 +976,7 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
968
976
  }> | null;
969
977
  readonly adapterConfig: any;
970
978
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
979
+ readonly isMinimized: boolean;
971
980
  readonly parentDisplay: any;
972
981
  readonly effectiveRpcDriverName: any;
973
982
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -1,5 +1,5 @@
1
1
  import type { AnyConfigurationSchemaType } from '@jbrowse/core/configuration';
2
- import type { MenuItem } from '@jbrowse/core/ui';
2
+ import type { MenuItem, SubMenuItem } from '@jbrowse/core/ui';
3
3
  import type { Instance } from '@jbrowse/mobx-state-tree';
4
4
  declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): import("@jbrowse/mobx-state-tree").IModelType<{
5
5
  id: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").ISimpleType<string>, [undefined]>;
@@ -93,7 +93,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
93
93
  trackDisplayMode: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
94
94
  trackMaxHeight: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<number>>;
95
95
  configuration: AnyConfigurationSchemaType;
96
- jexlFilters: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>>;
96
+ jexlFiltersSetting: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>>;
97
97
  } & {
98
98
  type: import("@jbrowse/mobx-state-tree").ISimpleType<"LinearBasicDisplay">;
99
99
  trackGeneGlyphMode: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
@@ -147,6 +147,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
147
147
  }> | null;
148
148
  readonly adapterConfig: any;
149
149
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
150
+ readonly isMinimized: boolean;
150
151
  readonly parentDisplay: any;
151
152
  readonly effectiveRpcDriverName: any;
152
153
  } & {
@@ -203,6 +204,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
203
204
  }> | null;
204
205
  readonly adapterConfig: any;
205
206
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
207
+ readonly isMinimized: boolean;
206
208
  readonly parentDisplay: any;
207
209
  readonly effectiveRpcDriverName: any;
208
210
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -256,6 +258,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
256
258
  }> | null;
257
259
  readonly adapterConfig: any;
258
260
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
261
+ readonly isMinimized: boolean;
259
262
  readonly parentDisplay: any;
260
263
  readonly effectiveRpcDriverName: any;
261
264
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -537,6 +540,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
537
540
  }> | null;
538
541
  readonly adapterConfig: any;
539
542
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
543
+ readonly isMinimized: boolean;
540
544
  readonly parentDisplay: any;
541
545
  readonly effectiveRpcDriverName: any;
542
546
  } & {
@@ -593,6 +597,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
593
597
  }> | null;
594
598
  readonly adapterConfig: any;
595
599
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
600
+ readonly isMinimized: boolean;
596
601
  readonly parentDisplay: any;
597
602
  readonly effectiveRpcDriverName: any;
598
603
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -646,6 +651,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
646
651
  }> | null;
647
652
  readonly adapterConfig: any;
648
653
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
654
+ readonly isMinimized: boolean;
649
655
  readonly parentDisplay: any;
650
656
  readonly effectiveRpcDriverName: any;
651
657
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -872,6 +878,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
872
878
  }> | null;
873
879
  readonly adapterConfig: any;
874
880
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
881
+ readonly isMinimized: boolean;
875
882
  readonly parentDisplay: any;
876
883
  readonly effectiveRpcDriverName: any;
877
884
  } & {
@@ -928,6 +935,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
928
935
  }> | null;
929
936
  readonly adapterConfig: any;
930
937
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
938
+ readonly isMinimized: boolean;
931
939
  readonly parentDisplay: any;
932
940
  readonly effectiveRpcDriverName: any;
933
941
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -981,6 +989,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
981
989
  }> | null;
982
990
  readonly adapterConfig: any;
983
991
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
992
+ readonly isMinimized: boolean;
984
993
  readonly parentDisplay: any;
985
994
  readonly effectiveRpcDriverName: any;
986
995
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
@@ -1087,7 +1096,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1087
1096
  } & {
1088
1097
  featureUnderMouseVolatile: import("@jbrowse/core/util").Feature | undefined;
1089
1098
  } & {
1090
- readonly activeFilters: any;
1099
+ activeFilters(): string[];
1091
1100
  readonly rendererTypeName: any;
1092
1101
  readonly sequenceAdapter: any;
1093
1102
  readonly showLabels: any;
@@ -1175,6 +1184,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1175
1184
  }> | null;
1176
1185
  readonly adapterConfig: any;
1177
1186
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
1187
+ readonly isMinimized: boolean;
1178
1188
  readonly parentDisplay: any;
1179
1189
  readonly effectiveRpcDriverName: any;
1180
1190
  } & import("@jbrowse/mobx-state-tree").IStateTreeNode<import("@jbrowse/mobx-state-tree").IModelType<{
@@ -1228,11 +1238,16 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1228
1238
  }> | null;
1229
1239
  readonly adapterConfig: any;
1230
1240
  readonly parentTrack: import("@jbrowse/core/util").AbstractTrackModel;
1241
+ readonly isMinimized: boolean;
1231
1242
  readonly parentDisplay: any;
1232
1243
  readonly effectiveRpcDriverName: any;
1233
1244
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
1234
1245
  };
1246
+ filterMenuItems(): MenuItem[];
1247
+ } & {
1235
1248
  trackMenuItems(): MenuItem[];
1249
+ } & {
1250
+ afterAttach(): void;
1236
1251
  } & {
1237
1252
  readonly geneGlyphMode: any;
1238
1253
  readonly subfeatureLabels: any;
@@ -1251,6 +1266,13 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1251
1266
  setGeneGlyphMode(val: string): void;
1252
1267
  setSubfeatureLabels(val: string): void;
1253
1268
  toggleDisplayDirectionalChevrons(): void;
1269
+ } & {
1270
+ filterMenuItems(): (import("@jbrowse/core/ui").MenuDivider | import("@jbrowse/core/ui").MenuSubHeader | import("@jbrowse/core/ui").NormalMenuItem | import("@jbrowse/core/ui").CheckboxMenuItem | import("@jbrowse/core/ui").RadioMenuItem | SubMenuItem | {
1271
+ label: string;
1272
+ type: string;
1273
+ checked: boolean;
1274
+ onClick: () => void;
1275
+ })[];
1254
1276
  } & {
1255
1277
  trackMenuItems(): MenuItem[];
1256
1278
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree").ModelSnapshotType<{
@@ -1345,7 +1367,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1345
1367
  trackDisplayMode: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
1346
1368
  trackMaxHeight: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<number>>;
1347
1369
  configuration: AnyConfigurationSchemaType;
1348
- jexlFilters: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>>;
1370
+ jexlFiltersSetting: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>>;
1349
1371
  } & {
1350
1372
  type: import("@jbrowse/mobx-state-tree").ISimpleType<"LinearBasicDisplay">;
1351
1373
  trackGeneGlyphMode: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
@@ -55,6 +55,31 @@ function stateModelFactory(configSchema) {
55
55
  self.trackDisplayDirectionalChevrons = !self.displayDirectionalChevrons;
56
56
  },
57
57
  }))
58
+ .views(self => {
59
+ const { filterMenuItems: superFilterMenuItems } = self;
60
+ return {
61
+ filterMenuItems() {
62
+ const filters = self.activeFilters();
63
+ return [
64
+ {
65
+ label: 'Show only genes',
66
+ type: 'checkbox',
67
+ checked: filters.includes("jexl:get(feature,'type')=='gene'"),
68
+ onClick: () => {
69
+ const geneFilter = "jexl:get(feature,'type')=='gene'";
70
+ if (filters.includes(geneFilter)) {
71
+ self.setJexlFilters(filters.filter(f => f !== geneFilter));
72
+ }
73
+ else {
74
+ self.setJexlFilters([...filters, geneFilter]);
75
+ }
76
+ },
77
+ },
78
+ ...superFilterMenuItems(),
79
+ ];
80
+ },
81
+ };
82
+ })
58
83
  .views(self => {
59
84
  const { trackMenuItems: superTrackMenuItems } = self;
60
85
  return {
@@ -109,27 +134,6 @@ function stateModelFactory(configSchema) {
109
134
  },
110
135
  ];
111
136
  }
112
- const filtersMenu = findSubMenu(items, 'Filters');
113
- if (filtersMenu) {
114
- filtersMenu.subMenu = [
115
- {
116
- label: 'Show only genes',
117
- type: 'checkbox',
118
- checked: self.activeFilters.includes("jexl:get(feature,'type')=='gene'"),
119
- onClick: () => {
120
- const geneFilter = "jexl:get(feature,'type')=='gene'";
121
- const currentFilters = self.activeFilters;
122
- if (currentFilters.includes(geneFilter)) {
123
- self.setJexlFilters(currentFilters.filter((f) => f !== geneFilter));
124
- }
125
- else {
126
- self.setJexlFilters([...currentFilters, geneFilter]);
127
- }
128
- },
129
- },
130
- ...filtersMenu.subMenu,
131
- ];
132
- }
133
137
  return items;
134
138
  },
135
139
  };
@@ -1,7 +1,7 @@
1
1
  declare const AddFiltersDialog: ({ model, handleClose, }: {
2
2
  model: {
3
3
  jexlFilters?: string[];
4
- activeFilters: string[];
4
+ activeFilters: () => string[];
5
5
  setJexlFilters: (arg?: string[]) => void;
6
6
  };
7
7
  handleClose: () => void;
@@ -23,17 +23,16 @@ function checkJexl(code) {
23
23
  const AddFiltersDialog = observer(function AddFiltersDialog({ model, handleClose, }) {
24
24
  const { classes } = useStyles();
25
25
  const { activeFilters } = model;
26
- const [data, setData] = useState(activeFilters.join('\n'));
26
+ const [data, setData] = useState(activeFilters().join('\n'));
27
27
  const [error, setError] = useState();
28
28
  useEffect(() => {
29
29
  try {
30
- data
30
+ for (const line of data
31
31
  .split('\n')
32
32
  .map(line => line.trim())
33
- .filter(line => !!line)
34
- .map(line => {
35
- checkJexl(line.trim());
36
- });
33
+ .filter(line => !!line)) {
34
+ checkJexl(line);
35
+ }
37
36
  setError(undefined);
38
37
  }
39
38
  catch (e) {
@@ -41,7 +40,7 @@ const AddFiltersDialog = observer(function AddFiltersDialog({ model, handleClose
41
40
  setError(e);
42
41
  }
43
42
  }, [data]);
44
- return (_jsxs(Dialog, { maxWidth: "xl", open: true, onClose: handleClose, title: "Add track filters", children: [_jsxs(DialogContent, { children: [_jsxs("div", { children: ["Add filters, in jexl format, one per line, starting with the string jexl:. Examples:", ' ', _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'name')=='BRCA1'" }), " - show only feature where the name attribute is BRCA1"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'type')=='gene'" }), " - show only gene type features in a GFF that has many other feature types"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'score') > 400" }), " - show only features that have a score greater than 400"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'end') - get(feature,'start') < 1000000" }), ' ', "- show only features with length less than 1Mbp"] })] })] }), error ? _jsx("p", { className: classes.error, children: `${error}` }) : null, _jsx(TextField, { variant: "outlined", multiline: true, minRows: 5, maxRows: 10, className: classes.dialogContent, fullWidth: true, value: data, onChange: event => {
43
+ return (_jsxs(Dialog, { maxWidth: "xl", open: true, onClose: handleClose, title: "Add track filters", children: [_jsxs(DialogContent, { children: [_jsxs("div", { children: ["Add filters, in jexl format, one per line, starting with the string jexl:. Examples:", ' ', _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'name')=='BRCA1'" }), " - show only feature where the name attribute is BRCA1"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:startsWith(get(feature,'name'),'PREFIX')" }), " - show only feature where the string 'PREFIX' is the prefix of feature name. endsWith also works"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:includes(get(feature,'name'),'PREFIX')" }), " - show only feature where the string 'PREFIX' is the prefix of feature name"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'type')=='gene'" }), " - show only gene type features in a GFF that has many other feature types"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'score') > 400" }), " - show only features that have a score greater than 400"] }), _jsxs("li", { children: [_jsx("code", { children: "jexl:get(feature,'end') - get(feature,'start') < 1000000" }), ' ', "- show only features with length less than 1Mbp"] })] }), _jsxs("p", { children: ["Please see", ' ', _jsx("a", { href: "https://jbrowse.org/jb2/docs/config_guides/jexl/", children: "Jexl" }), ' ', "documentation for more information"] })] }), error ? _jsx("p", { className: classes.error, children: `${error}` }) : null, _jsx(TextField, { variant: "outlined", multiline: true, minRows: 5, maxRows: 10, className: classes.dialogContent, fullWidth: true, value: data, onChange: event => {
45
44
  setData(event.target.value);
46
45
  }, slotProps: {
47
46
  input: {