@jbrowse/plugin-linear-genome-view 4.0.4 → 4.1.3

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 (63) hide show
  1. package/esm/BaseLinearDisplay/components/LinearBlocks.js +3 -1
  2. package/esm/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.d.ts +1 -0
  3. package/esm/BaseLinearDisplay/components/NonBlockCanvasDisplayComponent.js +7 -3
  4. package/esm/BaseLinearDisplay/model.d.ts +1 -1
  5. package/esm/BaseLinearDisplay/model.js +1 -1
  6. package/esm/BaseLinearDisplay/models/NonBlockCanvasDisplayMixin.d.ts +5 -0
  7. package/esm/BaseLinearDisplay/models/NonBlockCanvasDisplayMixin.js +11 -0
  8. package/esm/LinearBareDisplay/model.d.ts +1 -1
  9. package/esm/LinearBasicDisplay/model.d.ts +13 -4
  10. package/esm/LinearBasicDisplay/model.js +25 -21
  11. package/esm/LinearFeatureDisplay/components/AddFiltersDialog.d.ts +1 -1
  12. package/esm/LinearFeatureDisplay/components/AddFiltersDialog.js +6 -7
  13. package/esm/LinearFeatureDisplay/model.d.ts +5 -3
  14. package/esm/LinearFeatureDisplay/model.js +34 -24
  15. package/esm/LinearGenomeView/afterAttach.js +8 -2
  16. package/esm/LinearGenomeView/components/CenterLine.d.ts +1 -1
  17. package/esm/LinearGenomeView/components/Gridlines.d.ts +1 -1
  18. package/esm/LinearGenomeView/components/Gridlines.js +3 -2
  19. package/esm/LinearGenomeView/components/Header.d.ts +1 -1
  20. package/esm/LinearGenomeView/components/HeaderPanControls.d.ts +1 -1
  21. package/esm/LinearGenomeView/components/HeaderRegionWidth.d.ts +1 -1
  22. package/esm/LinearGenomeView/components/HeaderTrackSelectorButton.d.ts +1 -1
  23. package/esm/LinearGenomeView/components/HeaderZoomControls.d.ts +1 -1
  24. package/esm/LinearGenomeView/components/ImportForm.d.ts +1 -1
  25. package/esm/LinearGenomeView/components/ImportFormRefNameAutocomplete.d.ts +1 -1
  26. package/esm/LinearGenomeView/components/LinearGenomeView.d.ts +1 -1
  27. package/esm/LinearGenomeView/components/LinearGenomeViewContainer.d.ts +1 -1
  28. package/esm/LinearGenomeView/components/MiniControls.d.ts +1 -1
  29. package/esm/LinearGenomeView/components/NoTracksActiveButton.d.ts +1 -1
  30. package/esm/LinearGenomeView/components/OverviewRubberband.d.ts +1 -1
  31. package/esm/LinearGenomeView/components/OverviewRubberbandHoverTooltip.d.ts +1 -1
  32. package/esm/LinearGenomeView/components/OverviewScalebar.d.ts +1 -1
  33. package/esm/LinearGenomeView/components/OverviewScalebarPolygon.d.ts +1 -1
  34. package/esm/LinearGenomeView/components/OverviewScalebarTickLabels.d.ts +1 -1
  35. package/esm/LinearGenomeView/components/Rubberband.d.ts +1 -1
  36. package/esm/LinearGenomeView/components/Scalebar.d.ts +1 -1
  37. package/esm/LinearGenomeView/components/Scalebar.js +3 -2
  38. package/esm/LinearGenomeView/components/ScalebarCoordinateLabels.d.ts +1 -1
  39. package/esm/LinearGenomeView/components/ScalebarRefNameLabels.d.ts +1 -1
  40. package/esm/LinearGenomeView/components/ScalebarRefNameLabels.js +2 -2
  41. package/esm/LinearGenomeView/components/TrackContainer.d.ts +1 -1
  42. package/esm/LinearGenomeView/components/TrackLabelContainer.d.ts +1 -1
  43. package/esm/LinearGenomeView/components/TrackLabelDragHandle.d.ts +1 -1
  44. package/esm/LinearGenomeView/components/TrackRenderingContainer.d.ts +1 -1
  45. package/esm/LinearGenomeView/components/TracksContainer.d.ts +1 -1
  46. package/esm/LinearGenomeView/components/TracksContainer.js +2 -2
  47. package/esm/LinearGenomeView/components/VerticalGuide.d.ts +1 -1
  48. package/esm/LinearGenomeView/components/useRangeSelect.d.ts +1 -1
  49. package/esm/LinearGenomeView/components/useSideScroll.d.ts +1 -1
  50. package/esm/LinearGenomeView/index.d.ts +1 -0
  51. package/esm/LinearGenomeView/index.js +1 -0
  52. package/esm/LinearGenomeView/model.d.ts +3 -1
  53. package/esm/LinearGenomeView/model.js +4 -0
  54. package/esm/LinearGenomeView/svgcomponents/SVGGridlines.d.ts +1 -1
  55. package/esm/LinearGenomeView/svgcomponents/SVGHeader.d.ts +1 -1
  56. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.d.ts +1 -1
  57. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.d.ts +1 -1
  58. package/esm/LinearGenomeView/svgcomponents/SVGRuler.d.ts +1 -1
  59. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.d.ts +1 -1
  60. package/esm/LinearGenomeView/svgcomponents/SVGTracks.d.ts +1 -1
  61. package/esm/LinearGenomeView/types.d.ts +9 -1
  62. package/esm/index.d.ts +2 -1
  63. package/package.json +6 -5
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { getContainingView } from '@jbrowse/core/util';
2
3
  import { makeStyles } from '@jbrowse/core/util/tss-react';
3
4
  import { observer } from 'mobx-react';
4
5
  import RenderedBlocks from "./RenderedBlocks.js";
@@ -14,8 +15,9 @@ const useStyles = makeStyles()({
14
15
  const LinearBlocks = observer(function LinearBlocks({ model, }) {
15
16
  const { classes } = useStyles();
16
17
  const { blockDefinitions } = model;
18
+ const viewModel = getContainingView(model);
17
19
  return (_jsx("div", { className: classes.linearBlocks, style: {
18
- left: `calc(${blockDefinitions.offsetPx}px - var(--offset-px))`,
20
+ left: blockDefinitions.offsetPx - viewModel.offsetPx,
19
21
  }, children: _jsx(RenderedBlocks, { model: model }) }));
20
22
  });
21
23
  export default LinearBlocks;
@@ -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();
@@ -1171,8 +1171,8 @@ export declare const BaseLinearDisplay: import("@jbrowse/mobx-state-tree").IMode
1171
1171
  showLegend: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1172
1172
  showTooltips: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1173
1173
  }>>, {
1174
- id: string;
1175
1174
  type: string;
1175
+ id: string;
1176
1176
  configuration: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, any>>;
1177
1177
  rpcDriverName: string | undefined;
1178
1178
  heightPreConfig: number | undefined;
@@ -10,8 +10,8 @@ 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";
@@ -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() {
@@ -1173,8 +1173,8 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
1173
1173
  showLegend: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1174
1174
  showTooltips: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1175
1175
  }>> & import("@jbrowse/mobx-state-tree/dist/internal").NonEmptyObject & import("@jbrowse/mobx-state-tree")._NotCustomized, {
1176
- id: string;
1177
1176
  type: string;
1177
+ id: string;
1178
1178
  configuration: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, any>>;
1179
1179
  rpcDriverName: string | undefined;
1180
1180
  heightPreConfig: number | undefined;
@@ -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>>;
@@ -1096,7 +1096,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1096
1096
  } & {
1097
1097
  featureUnderMouseVolatile: import("@jbrowse/core/util").Feature | undefined;
1098
1098
  } & {
1099
- readonly activeFilters: string[];
1099
+ activeFilters(): string[];
1100
1100
  readonly rendererTypeName: any;
1101
1101
  readonly sequenceAdapter: any;
1102
1102
  readonly showLabels: any;
@@ -1243,6 +1243,8 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1243
1243
  readonly effectiveRpcDriverName: any;
1244
1244
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
1245
1245
  };
1246
+ filterMenuItems(): MenuItem[];
1247
+ } & {
1246
1248
  trackMenuItems(): MenuItem[];
1247
1249
  } & {
1248
1250
  afterAttach(): void;
@@ -1264,6 +1266,13 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1264
1266
  setGeneGlyphMode(val: string): void;
1265
1267
  setSubfeatureLabels(val: string): void;
1266
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
+ })[];
1267
1276
  } & {
1268
1277
  trackMenuItems(): MenuItem[];
1269
1278
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree").ModelSnapshotType<{
@@ -1358,7 +1367,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1358
1367
  trackDisplayMode: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
1359
1368
  trackMaxHeight: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<number>>;
1360
1369
  configuration: AnyConfigurationSchemaType;
1361
- 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>>>;
1362
1371
  } & {
1363
1372
  type: import("@jbrowse/mobx-state-tree").ISimpleType<"LinearBasicDisplay">;
1364
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: {
@@ -95,7 +95,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
95
95
  trackDisplayMode: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
96
96
  trackMaxHeight: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<number>>;
97
97
  configuration: AnyConfigurationSchemaType;
98
- jexlFilters: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>>;
98
+ jexlFiltersSetting: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>>;
99
99
  }, {
100
100
  rendererTypeName: string;
101
101
  error: unknown;
@@ -1092,7 +1092,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1092
1092
  } & {
1093
1093
  featureUnderMouseVolatile: Feature | undefined;
1094
1094
  } & {
1095
- readonly activeFilters: string[];
1095
+ activeFilters(): string[];
1096
1096
  readonly rendererTypeName: any;
1097
1097
  readonly sequenceAdapter: any;
1098
1098
  readonly showLabels: any;
@@ -1239,6 +1239,8 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1239
1239
  readonly effectiveRpcDriverName: any;
1240
1240
  }, import("@jbrowse/mobx-state-tree")._NotCustomized, import("@jbrowse/mobx-state-tree")._NotCustomized>>;
1241
1241
  };
1242
+ filterMenuItems(): MenuItem[];
1243
+ } & {
1242
1244
  trackMenuItems(): MenuItem[];
1243
1245
  } & {
1244
1246
  afterAttach(): void;
@@ -1421,7 +1423,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
1421
1423
  trackDisplayMode: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
1422
1424
  trackMaxHeight: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<number>>;
1423
1425
  configuration: AnyConfigurationSchemaType;
1424
- jexlFilters: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>>;
1426
+ jexlFiltersSetting: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISimpleType<string>>>;
1425
1427
  }>>;
1426
1428
  export type LinearFeatureDisplayStateModel = ReturnType<typeof stateModelFactory>;
1427
1429
  export type LinearFeatureDisplayModel = Instance<LinearFeatureDisplayStateModel>;
@@ -4,8 +4,9 @@ import SerializableFilterChain from '@jbrowse/core/pluggableElementTypes/rendere
4
4
  import { SimpleFeature, getSession } from '@jbrowse/core/util';
5
5
  import { getRpcSessionId } from '@jbrowse/core/util/tracks';
6
6
  import { addDisposer, cast, getParent, isAlive, types, } from '@jbrowse/mobx-state-tree';
7
+ import ClearAllIcon from '@mui/icons-material/ClearAll';
7
8
  import VisibilityIcon from '@mui/icons-material/Visibility';
8
- import { reaction } from 'mobx';
9
+ import { reaction, toJS } from 'mobx';
9
10
  import { BaseLinearDisplay } from "../BaseLinearDisplay/index.js";
10
11
  const SetMaxHeightDialog = lazy(() => import("./components/SetMaxHeightDialog.js"));
11
12
  const AddFiltersDialog = lazy(() => import("./components/AddFiltersDialog.js"));
@@ -18,14 +19,14 @@ function stateModelFactory(configSchema) {
18
19
  trackDisplayMode: types.maybe(types.string),
19
20
  trackMaxHeight: types.maybe(types.number),
20
21
  configuration: ConfigurationReference(configSchema),
21
- jexlFilters: types.maybe(types.array(types.string)),
22
+ jexlFiltersSetting: types.maybe(types.array(types.string)),
22
23
  }))
23
24
  .volatile(() => ({
24
25
  featureUnderMouseVolatile: undefined,
25
26
  }))
26
27
  .views(self => ({
27
- get activeFilters() {
28
- return (self.jexlFilters ??
28
+ activeFilters() {
29
+ return (toJS(self.jexlFiltersSetting) ??
29
30
  getConf(self, 'jexlFilters').map((r) => `jexl:${r}`));
30
31
  },
31
32
  get rendererTypeName() {
@@ -67,7 +68,7 @@ function stateModelFactory(configSchema) {
67
68
  }))
68
69
  .actions(self => ({
69
70
  setJexlFilters(f) {
70
- self.jexlFilters = cast(f);
71
+ self.jexlFiltersSetting = cast(f);
71
72
  },
72
73
  setFeatureUnderMouse(feat) {
73
74
  self.featureUnderMouseVolatile = feat;
@@ -91,7 +92,7 @@ function stateModelFactory(configSchema) {
91
92
  },
92
93
  }))
93
94
  .views(self => {
94
- const { trackMenuItems: superTrackMenuItems, renderProps: superRenderProps, renderingProps: superRenderingProps, } = self;
95
+ const { renderProps: superRenderProps, renderingProps: superRenderingProps, } = self;
95
96
  return {
96
97
  renderProps() {
97
98
  const superProps = superRenderProps();
@@ -99,7 +100,7 @@ function stateModelFactory(configSchema) {
99
100
  ...superProps,
100
101
  config: self.rendererConfig,
101
102
  filters: new SerializableFilterChain({
102
- filters: self.activeFilters,
103
+ filters: self.activeFilters(),
103
104
  }),
104
105
  sequenceAdapter: self.sequenceAdapter,
105
106
  };
@@ -163,6 +164,27 @@ function stateModelFactory(configSchema) {
163
164
  },
164
165
  };
165
166
  },
167
+ filterMenuItems() {
168
+ return [
169
+ {
170
+ label: 'Edit filters...',
171
+ onClick: () => {
172
+ getSession(self).queueDialog(handleClose => [
173
+ AddFiltersDialog,
174
+ {
175
+ model: self,
176
+ handleClose,
177
+ },
178
+ ]);
179
+ },
180
+ },
181
+ ];
182
+ },
183
+ };
184
+ })
185
+ .views(self => {
186
+ const { trackMenuItems: superTrackMenuItems } = self;
187
+ return {
166
188
  trackMenuItems() {
167
189
  return [
168
190
  ...superTrackMenuItems(),
@@ -226,21 +248,9 @@ function stateModelFactory(configSchema) {
226
248
  },
227
249
  },
228
250
  {
229
- label: 'Filters',
230
- subMenu: [
231
- {
232
- label: 'Edit filters...',
233
- onClick: () => {
234
- getSession(self).queueDialog(handleClose => [
235
- AddFiltersDialog,
236
- {
237
- model: self,
238
- handleClose,
239
- },
240
- ]);
241
- },
242
- },
243
- ],
251
+ label: 'Filter by...',
252
+ icon: ClearAllIcon,
253
+ subMenu: self.filterMenuItems(),
244
254
  },
245
255
  ];
246
256
  },
@@ -279,7 +289,7 @@ function stateModelFactory(configSchema) {
279
289
  if (!snap) {
280
290
  return snap;
281
291
  }
282
- const { trackShowLabels, trackShowDescriptions, trackDisplayMode, trackMaxHeight, jexlFilters, ...rest } = snap;
292
+ const { trackShowLabels, trackShowDescriptions, trackDisplayMode, trackMaxHeight, jexlFiltersSetting, ...rest } = snap;
283
293
  return {
284
294
  ...rest,
285
295
  ...(trackShowLabels !== undefined ? { trackShowLabels } : {}),
@@ -288,7 +298,7 @@ function stateModelFactory(configSchema) {
288
298
  : {}),
289
299
  ...(trackDisplayMode !== undefined ? { trackDisplayMode } : {}),
290
300
  ...(trackMaxHeight !== undefined ? { trackMaxHeight } : {}),
291
- ...(jexlFilters?.length ? { jexlFilters } : {}),
301
+ ...(jexlFiltersSetting?.length ? { jexlFiltersSetting } : {}),
292
302
  };
293
303
  });
294
304
  }
@@ -34,11 +34,17 @@ export function setupInitAutorun(self) {
34
34
  const idsNotFound = [];
35
35
  for (const t of init.tracks) {
36
36
  try {
37
- self.showTrack(t);
37
+ if (typeof t === 'string') {
38
+ self.showTrack(t);
39
+ }
40
+ else {
41
+ self.showTrack(t.trackId, t.trackSnapshot ?? {}, t.displaySnapshot ?? {});
42
+ }
38
43
  }
39
44
  catch (e) {
45
+ const trackId = typeof t === 'string' ? t : t.trackId;
40
46
  if (/Could not resolve identifier/.exec(`${e}`)) {
41
- idsNotFound.push(t);
47
+ idsNotFound.push(trackId);
42
48
  }
43
49
  else {
44
50
  throw e;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  declare const CenterLine: ({ model }: {
4
4
  model: LGV;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  declare const Gridlines: ({ model, offset, }: {
4
4
  model: LGV;
@@ -60,11 +60,12 @@ const RenderedVerticalGuides = observer(function RenderedVerticalGuides({ model,
60
60
  });
61
61
  const Gridlines = observer(function Gridlines({ model, offset = 0, }) {
62
62
  const { classes } = useStyles();
63
- const { staticBlocks, scaleFactor } = model;
63
+ const { staticBlocks, scaleFactor, offsetPx } = model;
64
+ const offsetLeft = staticBlocks.offsetPx - offsetPx;
64
65
  return (_jsx("div", { className: classes.verticalGuidesZoomContainer, style: {
65
66
  transform: scaleFactor !== 1 ? `scaleX(${scaleFactor})` : undefined,
66
67
  }, children: _jsx("div", { className: classes.verticalGuidesContainer, style: {
67
- left: `calc(${staticBlocks.offsetPx}px - var(--offset-px) - ${offset}px)`,
68
+ left: offsetLeft - offset,
68
69
  width: staticBlocks.totalWidthPx,
69
70
  }, children: _jsx(RenderedVerticalGuides, { model: model }) }) }));
70
71
  });
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  declare const LinearGenomeViewHeader: ({ model, }: {
3
3
  model: LinearGenomeViewModel;
4
4
  }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  export default function HeaderPanControls({ model }: {
4
4
  model: LGV;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  declare const HeaderRegionWidth: ({ model, }: {
3
3
  model: LinearGenomeViewModel;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  declare const HeaderTrackSelectorButton: ({ model, }: {
3
3
  model: LinearGenomeViewModel;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  declare const HeaderZoomControls: ({ model, }: {
3
3
  model: LinearGenomeViewModel;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  declare const LinearGenomeViewImportForm: ({ model }: {
4
4
  model: LGV;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type BaseResult from '@jbrowse/core/TextSearch/BaseResults';
3
3
  type LGV = LinearGenomeViewModel;
4
4
  declare const ImportFormRefNameAutocomplete: ({ model, selectedAsm, value, setValue, setOption, }: {
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  declare const LinearGenomeView: ({ model, }: {
3
3
  model: LinearGenomeViewModel;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  declare const LinearGenomeViewContainer: ({ model, }: {
3
3
  model: LinearGenomeViewModel;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  declare const MiniControls: ({ model, }: {
3
3
  model: LinearGenomeViewModel;
4
4
  }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  declare const NoTracksActiveButton: ({ model, }: {
3
3
  model: LinearGenomeViewModel;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel';
3
3
  type LGV = LinearGenomeViewModel;
4
4
  declare const OverviewRubberband: ({ model, overview, ControlComponent, }: {
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel';
3
3
  type LGV = LinearGenomeViewModel;
4
4
  declare const OverviewRubberbandHoverTooltip: ({ model, open, guideX, overview, }: {
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  declare const OverviewScalebar: ({ model, children, }: {
4
4
  model: LGV;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel';
3
3
  declare const OverviewScalebarPolygon: ({ model, overview, useOffset, }: {
4
4
  model: LinearGenomeViewModel;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type { Base1DViewModel } from '@jbrowse/core/util/Base1DViewModel';
3
3
  import type { ContentBlock } from '@jbrowse/core/util/blockTypes';
4
4
  declare const OverviewScalebarTickLabels: ({ block, scale, overview, model, }: {
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  declare const Rubberband: ({ model, ControlComponent, }: {
4
4
  model: LGV;
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { LinearGenomeViewModel } from '..';
2
+ import type { LinearGenomeViewModel } from '../index.ts';
3
3
  type LGV = LinearGenomeViewModel;
4
4
  interface ScalebarProps {
5
5
  model: LGV;
@@ -22,10 +22,11 @@ const useStyles = makeStyles()({
22
22
  const Scalebar = observer(function Scalebar({ model, style, className, ...other }) {
23
23
  const { classes } = useStyles();
24
24
  const { scaleFactor, staticBlocks, offsetPx } = model;
25
- return (_jsxs(Paper, { "data-resizer": "true", className: cx(classes.container, className), variant: "outlined", style: { ...style, '--offset-px': `${offsetPx}px` }, ...other, children: [_jsx(Gridlines, { model: model, offset: 1 }), _jsx("div", { className: classes.zoomContainer, style: {
25
+ const offsetLeft = Math.round(staticBlocks.offsetPx - offsetPx);
26
+ return (_jsxs(Paper, { "data-resizer": "true", className: cx(classes.container, className), variant: "outlined", style: style, ...other, children: [_jsx(Gridlines, { model: model, offset: 1 }), _jsx("div", { className: classes.zoomContainer, style: {
26
27
  transform: scaleFactor !== 1 ? `scaleX(${scaleFactor})` : undefined,
27
28
  }, children: _jsx("div", { className: classes.scalebar, style: {
28
- transform: `translateX(calc(${staticBlocks.offsetPx}px - var(--offset-px) - 1px))`,
29
+ transform: `translateX(${offsetLeft - 1}px)`,
29
30
  width: staticBlocks.totalWidthPx,
30
31
  }, children: _jsx(ScalebarCoordinateLabels, { model: model }) }) }), _jsx(ScalebarRefNameLabels, { model: model })] }));
31
32
  });
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  declare const ScalebarCoordinateLabels: ({ model, }: {
4
4
  model: LGV;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  declare const ScalebarRefNameLabels: ({ model, }: {
4
4
  model: LGV;
@@ -65,8 +65,8 @@ const ScalebarRefNameLabels = observer(function ScalebarRefNameLabels({ model, }
65
65
  (isLeftEndOfDisplayedRegion || last) &&
66
66
  hasEnoughSpace ? (_jsxs("span", { style: {
67
67
  left: last
68
- ? 'max(0px, calc(-1 * var(--offset-px)))'
69
- : `calc(${blockOffsetPx}px - var(--offset-px) - 1px)`,
68
+ ? Math.max(0, -offsetPx)
69
+ : blockOffsetPx - offsetPx - 1,
70
70
  paddingLeft: last ? 0 : 1,
71
71
  maxWidth: maxWidth !== undefined && maxWidth > 0 ? maxWidth : undefined,
72
72
  }, className: classes.refLabel, "data-testid": `refLabel-${refName}`, onMouseDown: () => {
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
3
3
  type LGV = LinearGenomeViewModel;
4
4
  declare const TrackContainer: ({ model, track, }: {
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
3
3
  type LGV = LinearGenomeViewModel;
4
4
  declare const TrackLabelContainer: ({ track, view, }: {
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
3
3
  declare function TrackLabelDragHandle({ trackId, view, track, }: {
4
4
  trackId: string;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type { BaseTrackModel } from '@jbrowse/core/pluggableElementTypes/models';
3
3
  type LGV = LinearGenomeViewModel;
4
4
  declare const TrackRenderingContainer: ({ model, track, }: {
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  declare const TracksContainer: ({ children, model, }: {
4
4
  children: React.ReactNode;
@@ -30,10 +30,10 @@ const TracksContainer = observer(function TracksContainer({ children, model, })
30
30
  const { guideX, rubberbandOn, leftBpOffset, rightBpOffset, numOfBpSelected, width, left, anchorPosition, open, isClick, clickBpOffset, handleMenuItemClick, handleClose, mouseMove, mouseDown: mouseDown2, } = useRangeSelect(ref, model, true);
31
31
  useWheelScroll(ref, model);
32
32
  const additional = pluginManager.evaluateExtensionPoint('LinearGenomeView-TracksContainerComponent', undefined, { model });
33
- return (_jsxs("div", { ref: ref, "data-testid": "tracksContainer", className: classes.tracksContainer, style: { '--offset-px': `${model.offsetPx}px` }, onMouseDown: event => {
33
+ return (_jsxs("div", { ref: ref, "data-testid": "tracksContainer", className: classes.tracksContainer, onMouseDown: event => {
34
34
  mouseDown1(event);
35
35
  mouseDown2(event);
36
- }, onMouseMove: mouseMove, onMouseUp: mouseUp, children: [showGridlines ? _jsx(Gridlines, { model: model }) : null, _jsx(Suspense, { fallback: null, children: showCenterLine ? _jsx(CenterLine, { model: model }) : null }), guideX !== undefined && !isScalebarRefNameMenuOpen ? (_jsx(VerticalGuide, { model: model, coordX: guideX })) : rubberbandOn ? (_jsx(Suspense, { fallback: null, children: _jsx(RubberbandSpan, { leftBpOffset: leftBpOffset, rightBpOffset: rightBpOffset, numOfBpSelected: numOfBpSelected, width: width, left: left, top: rubberbandTop, sticky: stickyViewHeaders }) })) : null, anchorPosition ? (_jsx(Menu, { anchorReference: "anchorPosition", anchorPosition: {
36
+ }, onMouseMove: mouseMove, onMouseUp: mouseUp, children: [showGridlines ? _jsx(Gridlines, { model: model }) : null, _jsx(Suspense, { fallback: null, children: showCenterLine ? _jsx(CenterLine, { model: model }) : null }), guideX !== undefined && !isScalebarRefNameMenuOpen ? (_jsx(VerticalGuide, { model: model, coordX: guideX })) : rubberbandOn ? (_jsx(Suspense, { fallback: null, children: _jsx(RubberbandSpan, { leftBpOffset: leftBpOffset, rightBpOffset: rightBpOffset, numOfBpSelected: numOfBpSelected, width: width, left: left, top: rubberbandTop, sticky: stickyViewHeaders }) })) : null, model.volatileGuides.map((guide, idx) => (_jsx(VerticalGuide, { model: model, coordX: guide.xPos }, idx))), anchorPosition ? (_jsx(Menu, { anchorReference: "anchorPosition", anchorPosition: {
37
37
  left: anchorPosition.clientX,
38
38
  top: anchorPosition.clientY,
39
39
  }, onMenuItemClick: handleMenuItemClick, open: open, onClose: handleClose, menuItems: isClick && clickBpOffset
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  declare const VerticalGuide: ({ model, coordX, }: {
4
4
  model: LGV;
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { LinearGenomeViewModel } from '..';
2
+ import type { LinearGenomeViewModel } from '../index.ts';
3
3
  interface AnchorPosition {
4
4
  offsetX: number;
5
5
  clientX: number;
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { LinearGenomeViewModel } from '..';
2
+ import type { LinearGenomeViewModel } from '../index.ts';
3
3
  export declare function useSideScroll(model: LinearGenomeViewModel): {
4
4
  mouseDown: (event: React.MouseEvent) => void;
5
5
  mouseUp: (event: React.MouseEvent) => void;
@@ -1,3 +1,4 @@
1
1
  import type PluginManager from '@jbrowse/core/PluginManager';
2
2
  export default function LinearGenomeViewF(pluginManager: PluginManager): void;
3
3
  export * from './model.ts';
4
+ export * from './types.ts';
@@ -12,3 +12,4 @@ export default function LinearGenomeViewF(pluginManager) {
12
12
  });
13
13
  }
14
14
  export * from "./model.js";
15
+ export * from "./types.js";
@@ -1,5 +1,5 @@
1
1
  import type React from 'react';
2
- import type { BpOffset, ExportSvgOptions, HighlightType, InitState, NavLocation } from './types.ts';
2
+ import type { BpOffset, ExportSvgOptions, HighlightType, InitState, NavLocation, VolatileGuide } from './types.ts';
3
3
  import type PluginManager from '@jbrowse/core/PluginManager';
4
4
  import type BaseResult from '@jbrowse/core/TextSearch/BaseResults';
5
5
  import type { Assembly } from '@jbrowse/core/assemblyManager/assembly';
@@ -54,6 +54,7 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
54
54
  rightOffset: undefined | BpOffset;
55
55
  isScalebarRefNameMenuOpen: boolean;
56
56
  scalebarRefNameClickPending: boolean;
57
+ volatileGuides: VolatileGuide[];
57
58
  } & {
58
59
  readonly pinnedTracks: any[];
59
60
  readonly unpinnedTracks: any[];
@@ -116,6 +117,7 @@ export declare function stateModelFactory(pluginManager: PluginManager): import(
116
117
  addToHighlights(highlight: HighlightType): void;
117
118
  setHighlight(highlight?: HighlightType[]): void;
118
119
  removeHighlight(highlight: HighlightType): void;
120
+ setVolatileGuides(guides: VolatileGuide[]): void;
119
121
  scrollTo(offsetPx: number): number;
120
122
  zoomTo(bpPerPx: number, offset?: number, centerAtOffset?: boolean): number;
121
123
  setOffsets(left?: BpOffset, right?: BpOffset): void;
@@ -58,6 +58,7 @@ export function stateModelFactory(pluginManager) {
58
58
  rightOffset: undefined,
59
59
  isScalebarRefNameMenuOpen: false,
60
60
  scalebarRefNameClickPending: false,
61
+ volatileGuides: [],
61
62
  }))
62
63
  .views(self => ({
63
64
  get pinnedTracks() {
@@ -322,6 +323,9 @@ export function stateModelFactory(pluginManager) {
322
323
  removeHighlight(highlight) {
323
324
  self.highlight.remove(highlight);
324
325
  },
326
+ setVolatileGuides(guides) {
327
+ self.volatileGuides = guides;
328
+ },
325
329
  scrollTo(offsetPx) {
326
330
  const newOffsetPx = clamp(offsetPx, self.minOffset, self.maxOffset);
327
331
  self.offsetPx = newOffsetPx;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  export default function SVGGridlines({ model, height, }: {
4
4
  model: LGV;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  export default function SVGHeader({ model, fontSize, cytobandHeight, rulerHeight, }: {
3
3
  model: LinearGenomeViewModel;
4
4
  rulerHeight: number;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type { ExportSvgOptions } from '../types.ts';
3
3
  type LGV = LinearGenomeViewModel;
4
4
  export declare function renderToSvg(model: LGV, opts: ExportSvgOptions): Promise<string>;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  export default function SVGRegionSeparators({ model, height, }: {
4
4
  height: number;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  export default function SVGRuler({ model, fontSize, }: {
4
4
  model: LGV;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  type LGV = LinearGenomeViewModel;
3
3
  export default function SVGScalebar({ model, fontSize, }: {
4
4
  model: LGV;
@@ -1,4 +1,4 @@
1
- import type { LinearGenomeViewModel } from '..';
1
+ import type { LinearGenomeViewModel } from '../index.ts';
2
2
  import type { AnyConfigurationModel } from '@jbrowse/core/configuration';
3
3
  type LGV = LinearGenomeViewModel;
4
4
  interface DisplayResult {
@@ -37,10 +37,18 @@ export interface NavLocation {
37
37
  end?: number;
38
38
  assemblyName?: string;
39
39
  }
40
+ export interface VolatileGuide {
41
+ xPos: number;
42
+ }
43
+ export type TrackInit = string | {
44
+ trackId: string;
45
+ displaySnapshot?: Record<string, unknown>;
46
+ trackSnapshot?: Record<string, unknown>;
47
+ };
40
48
  export interface InitState {
41
49
  loc?: string;
42
50
  assembly: string;
43
- tracks?: string[];
51
+ tracks?: TrackInit[];
44
52
  tracklist?: boolean;
45
53
  nav?: boolean;
46
54
  highlight?: string[];
package/esm/index.d.ts CHANGED
@@ -1171,8 +1171,8 @@ export default class LinearGenomeViewPlugin extends Plugin {
1171
1171
  showLegend: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1172
1172
  showTooltips: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>;
1173
1173
  }>>, {
1174
- id: string;
1175
1174
  type: string;
1175
+ id: string;
1176
1176
  configuration: import("@jbrowse/mobx-state-tree").ModelSnapshotType<Record<string, any>>;
1177
1177
  rpcDriverName: string | undefined;
1178
1178
  heightPreConfig: number | undefined;
@@ -1235,6 +1235,7 @@ export { configSchemaFactory as linearBareDisplayConfigSchemaFactory, stateModel
1235
1235
  export { BaseLinearDisplay, BaseLinearDisplayComponent, BlockMsg, FeatureDensityMixin, FloatingLegend, NonBlockCanvasDisplayComponent, NonBlockCanvasDisplayMixin, SVGLegend, TooLargeMessage, TrackHeightMixin, baseLinearDisplayConfigSchema, calculateSvgLegendWidth, createSubfeatureLabelMetadata, drawCanvasImageData, } from './BaseLinearDisplay/index.ts';
1236
1236
  export type { NonBlockCanvasDisplayMixinType, NonBlockCanvasDisplayModel, } from './BaseLinearDisplay/index.ts';
1237
1237
  export { type LinearGenomeViewModel, type LinearGenomeViewStateModel, RefNameAutocomplete, SearchBox, } from './LinearGenomeView/index.ts';
1238
+ export type { BpOffset, ExportSvgOptions, HighlightType, InitState, NavLocation, VolatileGuide, } from './LinearGenomeView/types.ts';
1238
1239
  export { SVGGridlines, SVGRuler, SVGTracks, renderToSvg, } from './LinearGenomeView/svgcomponents/SVGLinearGenomeView.tsx';
1239
1240
  export { totalHeight } from './LinearGenomeView/svgcomponents/util.ts';
1240
1241
  export { configSchema as linearBasicDisplayConfigSchemaFactory, modelFactory as linearBasicDisplayModelFactory, } from './LinearBasicDisplay/index.ts';
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-linear-genome-view",
3
- "version": "4.0.4",
3
+ "version": "4.1.3",
4
+ "type": "module",
4
5
  "description": "JBrowse 2 linear genome view",
5
6
  "keywords": [
6
7
  "jbrowse",
@@ -21,15 +22,15 @@
21
22
  ],
22
23
  "dependencies": {
23
24
  "@jbrowse/mobx-state-tree": "^5.5.0",
24
- "@mui/icons-material": "^7.3.6",
25
- "@mui/material": "^7.3.6",
25
+ "@mui/icons-material": "^7.3.7",
26
+ "@mui/material": "^7.3.7",
26
27
  "@types/file-saver-es": "^2.0.3",
27
28
  "copy-to-clipboard": "^3.3.3",
28
29
  "file-saver-es": "^2.0.5",
29
30
  "mobx": "^6.15.0",
30
31
  "mobx-react": "^9.2.1",
31
- "@jbrowse/core": "^4.0.4",
32
- "@jbrowse/product-core": "^4.0.4"
32
+ "@jbrowse/product-core": "^4.1.3",
33
+ "@jbrowse/core": "^4.1.3"
33
34
  },
34
35
  "peerDependencies": {
35
36
  "react": ">=18.0.0",