@jbrowse/plugin-linear-comparative-view 2.13.0 → 2.14.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.
Files changed (63) hide show
  1. package/dist/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +9 -3
  2. package/dist/LGVSyntenyDisplay/components/util.js +4 -3
  3. package/dist/LGVSyntenyDisplay/model.d.ts +4 -3
  4. package/dist/LaunchLinearSyntenyView.js +7 -3
  5. package/dist/LinearComparativeDisplay/configSchemaF.js +0 -1
  6. package/dist/LinearComparativeDisplay/stateModelFactory.d.ts +3 -3
  7. package/dist/LinearComparativeDisplay/stateModelFactory.js +2 -2
  8. package/dist/LinearComparativeView/components/Header.js +6 -2
  9. package/dist/LinearComparativeView/components/Rubberband.js +9 -9
  10. package/dist/LinearComparativeView/model.d.ts +15 -18
  11. package/dist/LinearComparativeView/model.js +17 -23
  12. package/dist/LinearReadVsRef/LinearReadVsRef.js +6 -4
  13. package/dist/LinearSyntenyDisplay/afterAttach.js +2 -2
  14. package/dist/LinearSyntenyDisplay/components/Component.js +6 -2
  15. package/dist/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +29 -15
  16. package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.d.ts +4 -1
  17. package/dist/LinearSyntenyDisplay/components/SyntenyContextMenu.js +2 -6
  18. package/dist/LinearSyntenyDisplay/components/SyntenyTooltip.js +1 -1
  19. package/dist/LinearSyntenyDisplay/components/util.d.ts +3 -1
  20. package/dist/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
  21. package/dist/LinearSyntenyDisplay/drawSynteny.js +16 -8
  22. package/dist/LinearSyntenyDisplay/model.d.ts +9 -5
  23. package/dist/LinearSyntenyView/components/ExportSvgDialog.js +16 -6
  24. package/dist/LinearSyntenyView/components/ImportForm/ImportCustomTrack.js +14 -4
  25. package/dist/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelector.js +3 -1
  26. package/dist/LinearSyntenyView/components/ImportForm/index.js +15 -5
  27. package/dist/LinearSyntenyView/model.d.ts +12 -13
  28. package/dist/LinearSyntenyView/model.js +3 -1
  29. package/dist/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +9 -7
  30. package/dist/SyntenyFeatureDetail/SyntenyFeatureDetail.js +3 -1
  31. package/dist/util.js +4 -3
  32. package/esm/LGVSyntenyDisplay/components/LaunchSyntenyViewDialog.js +9 -3
  33. package/esm/LGVSyntenyDisplay/components/util.js +4 -3
  34. package/esm/LGVSyntenyDisplay/model.d.ts +4 -3
  35. package/esm/LaunchLinearSyntenyView.js +7 -3
  36. package/esm/LinearComparativeDisplay/configSchemaF.js +0 -1
  37. package/esm/LinearComparativeDisplay/stateModelFactory.d.ts +3 -3
  38. package/esm/LinearComparativeDisplay/stateModelFactory.js +2 -2
  39. package/esm/LinearComparativeView/components/Header.js +6 -2
  40. package/esm/LinearComparativeView/components/Rubberband.js +9 -9
  41. package/esm/LinearComparativeView/model.d.ts +15 -18
  42. package/esm/LinearComparativeView/model.js +18 -24
  43. package/esm/LinearReadVsRef/LinearReadVsRef.js +6 -4
  44. package/esm/LinearSyntenyDisplay/afterAttach.js +2 -2
  45. package/esm/LinearSyntenyDisplay/components/Component.js +6 -2
  46. package/esm/LinearSyntenyDisplay/components/LinearSyntenyRendering.js +29 -15
  47. package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.d.ts +4 -1
  48. package/esm/LinearSyntenyDisplay/components/SyntenyContextMenu.js +2 -6
  49. package/esm/LinearSyntenyDisplay/components/SyntenyTooltip.js +1 -1
  50. package/esm/LinearSyntenyDisplay/components/util.d.ts +3 -1
  51. package/esm/LinearSyntenyDisplay/drawSynteny.d.ts +1 -1
  52. package/esm/LinearSyntenyDisplay/drawSynteny.js +16 -8
  53. package/esm/LinearSyntenyDisplay/model.d.ts +9 -5
  54. package/esm/LinearSyntenyView/components/ExportSvgDialog.js +16 -6
  55. package/esm/LinearSyntenyView/components/ImportForm/ImportCustomTrack.js +14 -4
  56. package/esm/LinearSyntenyView/components/ImportForm/ImportSyntenyTrackSelector.js +3 -1
  57. package/esm/LinearSyntenyView/components/ImportForm/index.js +15 -5
  58. package/esm/LinearSyntenyView/model.d.ts +12 -13
  59. package/esm/LinearSyntenyView/model.js +3 -1
  60. package/esm/LinearSyntenyView/svgcomponents/SVGLinearSyntenyView.js +9 -7
  61. package/esm/SyntenyFeatureDetail/SyntenyFeatureDetail.js +3 -1
  62. package/esm/util.js +4 -3
  63. package/package.json +3 -3
@@ -30,9 +30,13 @@ export default function LaunchLinearSyntenyView(pluginManager) {
30
30
  throw new Error(`Assembly ${data.assembly} failed to load`);
31
31
  }
32
32
  await view.navToSearchString({ input: loc, assembly: asm });
33
- tracks.forEach(track => tryTrack(view, track, idsNotFound));
33
+ tracks.forEach(track => {
34
+ tryTrack(view, track, idsNotFound);
35
+ });
34
36
  }));
35
- tracks.forEach(track => tryTrack(model, track, idsNotFound));
37
+ tracks.forEach(track => {
38
+ tryTrack(model, track, idsNotFound);
39
+ });
36
40
  if (idsNotFound.length) {
37
41
  throw new Error(`Could not resolve identifiers: ${idsNotFound.join(',')}`);
38
42
  }
@@ -48,7 +52,7 @@ function tryTrack(model, trackId, idsNotFound) {
48
52
  model.showTrack(trackId);
49
53
  }
50
54
  catch (e) {
51
- if (`${e}`.match('Could not resolve identifier')) {
55
+ if (/Could not resolve identifier/.exec(`${e}`)) {
52
56
  idsNotFound.push(trackId);
53
57
  }
54
58
  else {
@@ -1,4 +1,3 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
1
  import { ConfigurationSchema } from '@jbrowse/core/configuration';
3
2
  /**
4
3
  * #config LinearComparativeDisplay
@@ -39,7 +39,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
39
39
  error: unknown;
40
40
  message: string | undefined;
41
41
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
42
- onHorizontalScroll?: Function;
42
+ onHorizontalScroll?: () => void;
43
43
  blockState?: Record<string, any>;
44
44
  }>;
45
45
  readonly DisplayBlurb: import("react").FC<{
@@ -125,7 +125,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
125
125
  error: unknown;
126
126
  message: string | undefined;
127
127
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
128
- onHorizontalScroll?: Function;
128
+ onHorizontalScroll?: () => void;
129
129
  blockState?: Record<string, any>;
130
130
  }>;
131
131
  readonly DisplayBlurb: import("react").FC<{
@@ -195,7 +195,7 @@ declare function stateModelFactory(configSchema: AnyConfigurationSchemaType): im
195
195
  error: unknown;
196
196
  message: string | undefined;
197
197
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
198
- onHorizontalScroll?: Function;
198
+ onHorizontalScroll?: () => void;
199
199
  blockState?: Record<string, any>;
200
200
  }>;
201
201
  readonly DisplayBlurb: import("react").FC<{
@@ -75,8 +75,8 @@ function stateModelFactory(configSchema) {
75
75
  }
76
76
  const { features } = args;
77
77
  const existingFeatures = self.features || [];
78
- const featIds = new Set(existingFeatures.map(f => f.id()) || []);
79
- const newFeatIds = new Set((features === null || features === void 0 ? void 0 : features.map(f => f.id())) || []);
78
+ const featIds = new Set(existingFeatures.map(f => f.id()));
79
+ const newFeatIds = new Set(features.map(f => f.id()));
80
80
  let foundNewFeatureNotInExistingMap = false;
81
81
  let foundExistingFeatureNotInNewMap = false;
82
82
  for (const feat of features) {
@@ -50,7 +50,9 @@ const Header = observer(function ({ model }) {
50
50
  const anyShowHeaders = model.views.some(view => !view.hideHeader);
51
51
  return (React.createElement("div", { className: classes.headerBar },
52
52
  React.createElement(TrackSelector, { model: model }),
53
- React.createElement(IconButton, { onClick: event => setMenuAnchorEl(event.currentTarget), className: classes.iconButton },
53
+ React.createElement(IconButton, { onClick: event => {
54
+ setMenuAnchorEl(event.currentTarget);
55
+ }, className: classes.iconButton },
54
56
  React.createElement(MoreVertIcon, null)),
55
57
  !anyShowHeaders
56
58
  ? model.views.map(view => (React.createElement("div", { key: view.id, className: classes.searchBox },
@@ -65,6 +67,8 @@ const Header = observer(function ({ model }) {
65
67
  menuAnchorEl ? (React.createElement(Menu, { anchorEl: menuAnchorEl, open: true, onMenuItemClick: (_event, callback) => {
66
68
  callback();
67
69
  setMenuAnchorEl(undefined);
68
- }, menuItems: model.headerMenuItems(), onClose: () => setMenuAnchorEl(undefined) })) : null));
70
+ }, menuItems: model.headerMenuItems(), onClose: () => {
71
+ setMenuAnchorEl(undefined);
72
+ } })) : null));
69
73
  });
70
74
  export default Header;
@@ -6,14 +6,10 @@ import { stringify } from '@jbrowse/core/util';
6
6
  import { Menu } from '@jbrowse/core/ui';
7
7
  import VerticalGuide from './VerticalGuide';
8
8
  const useStyles = makeStyles()(theme => {
9
- const { tertiary, primary } = theme.palette;
10
- const background = tertiary
11
- ? alpha(tertiary.main, 0.7)
12
- : alpha(primary.main, 0.7);
13
9
  return {
14
10
  rubberband: {
15
11
  height: '100%',
16
- background,
12
+ background: alpha(theme.palette.tertiary.main, 0.7),
17
13
  position: 'absolute',
18
14
  zIndex: 10,
19
15
  textAlign: 'center',
@@ -25,7 +21,7 @@ const useStyles = makeStyles()(theme => {
25
21
  minHeight: 8,
26
22
  },
27
23
  rubberbandText: {
28
- color: tertiary ? tertiary.contrastText : primary.contrastText,
24
+ color: theme.palette.tertiary.contrastText,
29
25
  },
30
26
  popover: {
31
27
  mouseEvents: 'none',
@@ -101,7 +97,7 @@ const LinearComparativeRubberband = observer(function Rubberband({ model, Contro
101
97
  };
102
98
  }
103
99
  return () => { };
104
- }, [startX, mouseDragging, anchorPosition, model]);
100
+ }, [startX, mouseDragging, model]);
105
101
  useEffect(() => {
106
102
  if (!mouseDragging &&
107
103
  currentX !== undefined &&
@@ -124,7 +120,9 @@ const LinearComparativeRubberband = observer(function Rubberband({ model, Contro
124
120
  }
125
121
  function mouseOut() {
126
122
  setGuideX(undefined);
127
- model.views.forEach(view => view.setOffsets(undefined, undefined));
123
+ model.views.forEach(view => {
124
+ view.setOffsets(undefined, undefined);
125
+ });
128
126
  }
129
127
  function handleClose() {
130
128
  setAnchorPosition(undefined);
@@ -165,7 +163,9 @@ const LinearComparativeRubberband = observer(function Rubberband({ model, Contro
165
163
  horizontal: 'left',
166
164
  }, keepMounted: true, disableRestoreFocus: true }, rightBpOffset.map((l, idx) => (React.createElement(Typography, { key: [JSON.stringify(l), idx, 'right'].join('-') }, stringify(l, true))))))) : null,
167
165
  React.createElement("div", { ref: rubberbandRef, className: classes.rubberband, style: { left, width } },
168
- React.createElement(Typography, { variant: "h6", className: classes.rubberbandText }, numOfBpSelected.map((n, i) => (React.createElement(Typography, { key: `${n}_${i}` }, `${n.toLocaleString('en-US')}bp`))))),
166
+ React.createElement(Typography, { variant: "h6", className: classes.rubberbandText }, numOfBpSelected.map((n, i) => (
167
+ /* biome-ignore lint/suspicious/noArrayIndexKey: */
168
+ React.createElement(Typography, { key: `${n}_${i}` }, `${n.toLocaleString('en-US')}bp`))))),
169
169
  React.createElement("div", { className: classes.rubberbandControl, ref: controlsRef, onMouseDown: mouseDown, onMouseOut: mouseOut, onMouseMove: mouseMove }, ControlComponent),
170
170
  anchorPosition ? (React.createElement(Menu, { anchorReference: "anchorPosition", anchorPosition: {
171
171
  left: anchorPosition.clientX,
@@ -38,8 +38,9 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
38
38
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
39
39
  trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
40
40
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
41
- highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<Required<import("@jbrowse/core/util").ParsedLocString>, Required<import("@jbrowse/core/util").ParsedLocString>, Required<import("@jbrowse/core/util").ParsedLocString>>>, [undefined]>;
41
+ highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType>>, [undefined]>;
42
42
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
43
+ showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
43
44
  }, {
44
45
  width: number;
45
46
  } & {
@@ -53,7 +54,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
53
54
  minimumBlockWidth: number;
54
55
  draggingTrackId: undefined | string;
55
56
  volatileError: unknown;
56
- afterDisplayedRegionsSetCallbacks: Function[];
57
+ afterDisplayedRegionsSetCallbacks: (() => void)[];
57
58
  scaleFactor: number;
58
59
  trackRefs: Record<string, HTMLDivElement>;
59
60
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
@@ -61,12 +62,12 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
61
62
  leftOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset;
62
63
  rightOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset;
63
64
  } & {
64
- scaleBarDisplayPrefix(): "";
65
65
  readonly trackLabelsSetting: any;
66
66
  readonly width: number;
67
67
  readonly interRegionPaddingWidth: number;
68
68
  readonly assemblyNames: string[];
69
69
  } & {
70
+ scaleBarDisplayPrefix(): string | undefined;
70
71
  MiniControlsComponent(): import("react").FC<any>;
71
72
  HeaderComponent(): import("react").FC<any>;
72
73
  readonly assemblyErrors: string;
@@ -81,7 +82,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
81
82
  readonly totalBp: number;
82
83
  readonly maxBpPerPx: number;
83
84
  readonly minBpPerPx: number;
84
- readonly error: {};
85
+ readonly error: unknown;
85
86
  readonly maxOffset: number;
86
87
  readonly minOffset: number;
87
88
  readonly displayedRegionsTotalPx: number;
@@ -96,6 +97,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
96
97
  rewriteOnClicks(trackType: string, viewMenuActions: MenuItem[]): void;
97
98
  readonly trackTypeActions: Map<string, MenuItem[]>;
98
99
  } & {
100
+ setShowTrackOutlines(arg: boolean): void;
99
101
  setColorByCDS(flag: boolean): void;
100
102
  setShowCytobands(flag: boolean): void;
101
103
  setWidth(newWidth: number): void;
@@ -104,9 +106,9 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
104
106
  setHideHeaderOverview(b: boolean): void;
105
107
  setHideNoTracksActive(b: boolean): void;
106
108
  setShowGridlines(b: boolean): void;
107
- addToHighlights(highlight: Required<import("@jbrowse/core/util").ParsedLocString>): void;
108
- setHighlight(highlight: Required<import("@jbrowse/core/util").ParsedLocString>[] | undefined): void;
109
- removeHighlight(highlight: Required<import("@jbrowse/core/util").ParsedLocString>): void;
109
+ addToHighlights(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType): void;
110
+ setHighlight(highlight?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType[]): void;
111
+ removeHighlight(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType): void;
110
112
  scrollTo(offsetPx: number): number;
111
113
  zoomTo(bpPerPx: number, offset?: number, centerAtOffset?: boolean): number;
112
114
  setOffsets(left?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset, right?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset): void;
@@ -121,7 +123,6 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
121
123
  moveTrackToTop(id: string): void;
122
124
  moveTrackToBottom(id: string): void;
123
125
  moveTrack(movingId: string, targetId: string): void;
124
- closeView(): void;
125
126
  toggleTrack(trackId: string): boolean;
126
127
  setTrackLabels(setting: "overlapping" | "offset" | "hidden"): void;
127
128
  setShowCenterLine(b: boolean): void;
@@ -141,7 +142,7 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
141
142
  variant?: string;
142
143
  isLeftEndOfDisplayedRegion?: boolean;
143
144
  }[];
144
- afterDisplayedRegionsSet(cb: Function): void;
145
+ afterDisplayedRegionsSet(cb: () => void): void;
145
146
  horizontalScroll(distance: number): number;
146
147
  center(): void;
147
148
  showAllRegions(): void;
@@ -215,8 +216,6 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
215
216
  } | undefined;
216
217
  } & {
217
218
  afterCreate(): void;
218
- } & {
219
- scaleBarDisplayPrefix(): string;
220
219
  }, import("mobx-state-tree").ModelCreationType<import("mobx-state-tree/dist/internal").ExtractCFromProps<{
221
220
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
222
221
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -236,8 +235,9 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
236
235
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
237
236
  trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
238
237
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
239
- highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<Required<import("@jbrowse/core/util").ParsedLocString>, Required<import("@jbrowse/core/util").ParsedLocString>, Required<import("@jbrowse/core/util").ParsedLocString>>>, [undefined]>;
238
+ highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType>>, [undefined]>;
240
239
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
240
+ showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
241
241
  }>>, import("mobx-state-tree")._NotCustomized>>;
242
242
  viewTrackConfigs: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IAnyModelType>;
243
243
  }, {
@@ -249,6 +249,9 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
249
249
  setWidth(newWidth: number): void;
250
250
  setMinimized(flag: boolean): void;
251
251
  } & {
252
+ /**
253
+ * #volatile
254
+ */
252
255
  width: number | undefined;
253
256
  } & {
254
257
  /**
@@ -282,12 +285,6 @@ declare function stateModelFactory(pluginManager: PluginManager): import("mobx-s
282
285
  * #action
283
286
  */
284
287
  removeView(view: LinearGenomeViewModel): void;
285
- /**
286
- * #action
287
- * removes the view itself from the state tree entirely by calling the
288
- * parent removeView
289
- */
290
- closeView(): void;
291
288
  /**
292
289
  * #action
293
290
  */
@@ -1,5 +1,5 @@
1
1
  import { lazy } from 'react';
2
- import { addDisposer, cast, getParent, getPath, getRoot, resolveIdentifier, types, } from 'mobx-state-tree';
2
+ import { addDisposer, cast, getPath, getRoot, resolveIdentifier, types, } from 'mobx-state-tree';
3
3
  import { autorun, transaction } from 'mobx';
4
4
  // jbrowse
5
5
  import BaseViewModel from '@jbrowse/core/pluggableElementTypes/models/BaseViewModel';
@@ -16,8 +16,6 @@ const ReturnToImportFormDialog = lazy(() => import('@jbrowse/core/ui/ReturnToImp
16
16
  * - [BaseViewModel](../baseviewmodel)
17
17
  */
18
18
  function stateModelFactory(pluginManager) {
19
- const model = pluginManager.getViewType('LinearGenomeView')
20
- .stateModel;
21
19
  return types
22
20
  .compose('LinearComparativeView', BaseViewModel, types.model({
23
21
  /**
@@ -52,20 +50,20 @@ function stateModelFactory(pluginManager) {
52
50
  * #property
53
51
  * currently this is limited to an array of two
54
52
  */
55
- views: types.array(model.views(self => ({
56
- scaleBarDisplayPrefix() {
57
- return self.assemblyNames[0];
58
- },
59
- }))),
53
+ views: types.array(pluginManager.getViewType('LinearGenomeView')
54
+ .stateModel),
60
55
  /**
61
56
  * #property
62
- * this represents tracks specific to this view specifically used
63
- * for read vs ref dotplots where this track would not really apply
57
+ * this represents tracks specific to this view specifically used for
58
+ * read vs ref dotplots where this track would not really apply
64
59
  * elsewhere
65
60
  */
66
61
  viewTrackConfigs: types.array(pluginManager.pluggableConfigSchemaType('track')),
67
62
  }))
68
63
  .volatile(() => ({
64
+ /**
65
+ * #volatile
66
+ */
69
67
  width: undefined,
70
68
  }))
71
69
  .views(self => ({
@@ -79,7 +77,9 @@ function stateModelFactory(pluginManager) {
79
77
  * #getter
80
78
  */
81
79
  get initialized() {
82
- return (self.width !== undefined &&
80
+ return (
81
+ // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
82
+ self.width !== undefined &&
83
83
  self.views.length > 0 &&
84
84
  self.views.every(view => view.initialized));
85
85
  },
@@ -135,15 +135,6 @@ function stateModelFactory(pluginManager) {
135
135
  removeView(view) {
136
136
  self.views.remove(view);
137
137
  },
138
- /**
139
- * #action
140
- * removes the view itself from the state tree entirely by calling the
141
- * parent removeView
142
- */
143
- closeView() {
144
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
145
- getParent(self, 2).removeView(self);
146
- },
147
138
  /**
148
139
  * #action
149
140
  */
@@ -210,7 +201,9 @@ function stateModelFactory(pluginManager) {
210
201
  const schema = pluginManager.pluggableConfigSchemaType('track');
211
202
  const config = resolveIdentifier(schema, getRoot(self), trackId);
212
203
  const shownTracks = self.tracks.filter(t => t.configuration === config);
213
- transaction(() => shownTracks.forEach(t => self.tracks.remove(t)));
204
+ transaction(() => {
205
+ shownTracks.forEach(t => self.tracks.remove(t));
206
+ });
214
207
  return shownTracks.length;
215
208
  },
216
209
  /**
@@ -252,8 +245,7 @@ function stateModelFactory(pluginManager) {
252
245
  menuItems() {
253
246
  return [
254
247
  ...self.views
255
- .map((view, idx) => { var _a; return [idx, (_a = view.menuItems) === null || _a === void 0 ? void 0 : _a.call(view)]; })
256
- .filter(f => !!f[1])
248
+ .map((view, idx) => [idx, view.menuItems()])
257
249
  .map(f => ({ label: `View ${f[0] + 1} Menu`, subMenu: f[1] })),
258
250
  {
259
251
  label: 'Return to import form',
@@ -295,7 +287,9 @@ function stateModelFactory(pluginManager) {
295
287
  afterAttach() {
296
288
  addDisposer(self, autorun(() => {
297
289
  if (self.width) {
298
- self.views.forEach(v => v.setWidth(self.width));
290
+ self.views.forEach(v => {
291
+ v.setWidth(self.width);
292
+ });
299
293
  }
300
294
  }));
301
295
  },
@@ -110,7 +110,7 @@ export default function ReadVsRefDialog({ track, feature: preFeature, handleClos
110
110
  const totalLength = flags & 2048 ? getLength(suppAlns[0].CIGAR) : getLength(cigar);
111
111
  const features = [feat, ...suppAlns];
112
112
  features.forEach((f, idx) => {
113
- f.refName = (assembly === null || assembly === void 0 ? void 0 : assembly.getCanonicalRefName(f.refName)) || f.refName;
113
+ f.refName = assembly.getCanonicalRefName(f.refName) || f.refName;
114
114
  f.syntenyId = idx;
115
115
  f.mate.syntenyId = idx;
116
116
  f.mate.uniqueId = `${f.uniqueId}_mate`;
@@ -131,10 +131,10 @@ export default function ReadVsRefDialog({ track, feature: preFeature, handleClos
131
131
  assemblyName: trackAssembly,
132
132
  })));
133
133
  (_a = session.addTemporaryAssembly) === null || _a === void 0 ? void 0 : _a.call(session, {
134
- name: `${readAssembly}`,
134
+ name: readAssembly,
135
135
  sequence: {
136
136
  type: 'ReferenceSequenceTrack',
137
- name: `Read sequence`,
137
+ name: 'Read sequence',
138
138
  trackId: seqTrackId,
139
139
  assemblyNames: [readAssembly],
140
140
  adapter: {
@@ -251,7 +251,9 @@ export default function ReadVsRefDialog({ track, feature: preFeature, handleClos
251
251
  React.createElement(CircularProgress, null))) : (React.createElement("div", { className: classes.root },
252
252
  primaryFeature.get('flags') & 256 ? (React.createElement(Typography, { style: { color: 'orange' } }, "Note: You selected a secondary alignment (which generally does not have SA tags or SEQ fields) so do a full reconstruction of the alignment")) : null,
253
253
  React.createElement(Typography, null, "Show an extra window size around each part of the split alignment. Using a larger value can allow you to see more genomic context."),
254
- React.createElement(TextField, { value: windowSize, onChange: event => setWindowSize(event.target.value), label: "Set window size" })))),
254
+ React.createElement(TextField, { value: windowSize, onChange: event => {
255
+ setWindowSize(event.target.value);
256
+ }, label: "Set window size" })))),
255
257
  React.createElement(DialogActions, null,
256
258
  React.createElement(Button, { variant: "contained", color: "secondary", onClick: handleClose }, "Cancel"),
257
259
  React.createElement(Button, { disabled: !primaryFeature, variant: "contained", color: "primary", onClick: onSubmit }, "Submit"))));
@@ -69,8 +69,8 @@ export function doAfterAttach(self) {
69
69
  ;
70
70
  [f1e, f1s] = [f1s, f1e];
71
71
  }
72
- const a1 = assemblyManager === null || assemblyManager === void 0 ? void 0 : assemblyManager.get(f.get('assemblyName'));
73
- const a2 = assemblyManager === null || assemblyManager === void 0 ? void 0 : assemblyManager.get(mate.assemblyName);
72
+ const a1 = assemblyManager.get(f.get('assemblyName'));
73
+ const a2 = assemblyManager.get(mate.assemblyName);
74
74
  const r1 = f.get('refName');
75
75
  const r2 = mate.refName;
76
76
  const ref1 = (a1 === null || a1 === void 0 ? void 0 : a1.getCanonicalRefName(r1)) || r1;
@@ -29,8 +29,12 @@ function LoadingMessage() {
29
29
  const [shown, setShown] = useState(false);
30
30
  const { classes } = useStyles();
31
31
  useEffect(() => {
32
- const timeout = setTimeout(() => setShown(true), 300);
33
- return () => clearTimeout(timeout);
32
+ const timeout = setTimeout(() => {
33
+ setShown(true);
34
+ }, 300);
35
+ return () => {
36
+ clearTimeout(timeout);
37
+ };
34
38
  });
35
39
  return shown ? (React.createElement("div", { className: classes.loading },
36
40
  React.createElement(LoadingEllipses, null))) : null;
@@ -41,15 +41,20 @@ const LinearSyntenyRendering = observer(function ({ model, }) {
41
41
  const [mouseInitialDownX, setMouseInitialDownX] = useState();
42
42
  const [currY, setCurrY] = useState();
43
43
  const { mouseoverId } = model;
44
- // these useCallbacks avoid new refs from being created on any mouseover, etc.
45
- const k1 = useCallback((ref) => model.setMouseoverCanvasRef(ref),
44
+ // these useCallbacks avoid new refs from being created on any mouseover,
45
+ // etc.
46
+ // biome-ignore lint/correctness/useExhaustiveDependencies:
47
+ const k1 = useCallback((ref) => {
48
+ model.setMouseoverCanvasRef(ref);
49
+ },
46
50
  // eslint-disable-next-line react-hooks/exhaustive-deps
47
51
  [model, height, width]);
52
+ // biome-ignore lint/correctness/useExhaustiveDependencies:
48
53
  const k2 = useCallback((ref) => {
49
54
  model.setMainCanvasRef(ref);
50
55
  function onWheel(event) {
51
56
  event.preventDefault();
52
- if (event.ctrlKey === true) {
57
+ if (event.ctrlKey) {
53
58
  delta.current += event.deltaY / 500;
54
59
  for (const v of view.views) {
55
60
  v.setScaleFactor(delta.current < 0 ? 1 - delta.current : 1 / (1 + delta.current));
@@ -84,21 +89,26 @@ const LinearSyntenyRendering = observer(function ({ model, }) {
84
89
  }
85
90
  }
86
91
  }
87
- if (ref) {
88
- ref.addEventListener('wheel', onWheel);
89
- // this is a react 19-ism to have a cleanup in the ref callback
90
- // https://react.dev/blog/2024/04/25/react-19#cleanup-functions-for-refs
91
- // note: it warns in earlier versions of react
92
- return () => ref.removeEventListener('wheel', onWheel);
93
- }
94
- return () => { };
92
+ ref === null || ref === void 0 ? void 0 : ref.addEventListener('wheel', onWheel);
93
+ // this is a react 19-ism to have a cleanup in the ref callback
94
+ // https://react.dev/blog/2024/04/25/react-19#cleanup-functions-for-refs
95
+ // note: it warns in earlier versions of react
96
+ return () => {
97
+ ref === null || ref === void 0 ? void 0 : ref.removeEventListener('wheel', onWheel);
98
+ };
95
99
  },
96
100
  // eslint-disable-next-line react-hooks/exhaustive-deps
97
101
  [model, height, width]);
98
- const k3 = useCallback((ref) => model.setClickMapCanvasRef(ref),
102
+ // biome-ignore lint/correctness/useExhaustiveDependencies:
103
+ const k3 = useCallback((ref) => {
104
+ model.setClickMapCanvasRef(ref);
105
+ },
99
106
  // eslint-disable-next-line react-hooks/exhaustive-deps
100
107
  [model, height, width]);
101
- const k4 = useCallback((ref) => model.setCigarClickMapCanvasRef(ref),
108
+ // biome-ignore lint/correctness/useExhaustiveDependencies:
109
+ const k4 = useCallback((ref) => {
110
+ model.setCigarClickMapCanvasRef(ref);
111
+ },
102
112
  // eslint-disable-next-line react-hooks/exhaustive-deps
103
113
  [model, height, width]);
104
114
  return (React.createElement("div", { className: classes.rel },
@@ -165,10 +175,14 @@ const LinearSyntenyRendering = observer(function ({ model, }) {
165
175
  Math.abs(evt.clientX - mouseInitialDownX) < 5) {
166
176
  onSynClick(evt, model);
167
177
  }
168
- }, onContextMenu: evt => onSynContextClick(evt, model, setAnchorEl), "data-testid": "synteny_canvas", className: classes.abs, width: width, height: height }),
178
+ }, onContextMenu: evt => {
179
+ onSynContextClick(evt, model, setAnchorEl);
180
+ }, "data-testid": "synteny_canvas", className: classes.abs, width: width, height: height }),
169
181
  React.createElement("canvas", { ref: k3, className: classes.pix, width: width, height: height }),
170
182
  React.createElement("canvas", { ref: k4, className: classes.pix, width: width, height: height }),
171
183
  mouseoverId && tooltip && currX && currY ? (React.createElement(SyntenyTooltip, { title: tooltip })) : null,
172
- anchorEl ? (React.createElement(SyntenyContextMenu, { model: model, anchorEl: anchorEl, onClose: () => setAnchorEl(undefined) })) : null));
184
+ anchorEl ? (React.createElement(SyntenyContextMenu, { model: model, anchorEl: anchorEl, onClose: () => {
185
+ setAnchorEl(undefined);
186
+ } })) : null));
173
187
  });
174
188
  export default LinearSyntenyRendering;
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
+ import { Feature } from '@jbrowse/core/util';
2
3
  import { LinearSyntenyDisplayModel } from '../model';
3
4
  interface ClickCoord {
4
5
  clientX: number;
5
6
  clientY: number;
6
- feature: any;
7
+ feature: {
8
+ f: Feature;
9
+ };
7
10
  }
8
11
  export default function SyntenyContextMenu({ model, onClose, anchorEl, }: {
9
12
  onClose: () => void;
@@ -33,15 +33,11 @@ export default function SyntenyContextMenu({ model, onClose, anchorEl, }) {
33
33
  const end = f.get('end');
34
34
  const refName = f.get('refName');
35
35
  const mate = f.get('mate');
36
- view.views[0]
37
- .navToLocString(`${refName}:${start}-${end}`)
38
- .catch(e => {
36
+ view.views[0].navToLocString(`${refName}:${start}-${end}`).catch((e) => {
39
37
  console.error(e);
40
38
  getSession(model).notifyError(`${e}`, e);
41
39
  });
42
- view.views[1]
43
- .navToLocString(`${mate.refName}:${mate.start}-${mate.end}`)
44
- .catch(e => {
40
+ view.views[1].navToLocString(`${mate.refName}:${mate.start}-${mate.end}`).catch((e) => {
45
41
  console.error(e);
46
42
  getSession(model).notifyError(`${e}`, e);
47
43
  });
@@ -34,7 +34,7 @@ const SyntenyTooltip = observer(function ({ title }) {
34
34
  });
35
35
  const clientPoint = useClientPoint(context);
36
36
  const { getFloatingProps } = useInteractions([clientPoint]);
37
- const popperTheme = (_a = theme === null || theme === void 0 ? void 0 : theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
37
+ const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
38
38
  return title ? (React.createElement(Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
39
39
  React.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
40
40
  ...floatingStyles,
@@ -7,7 +7,9 @@ interface Pos {
7
7
  export interface ClickCoord {
8
8
  clientX: number;
9
9
  clientY: number;
10
- feature: any;
10
+ feature: {
11
+ f: Feature;
12
+ };
11
13
  }
12
14
  interface FeatPos {
13
15
  p11: Pos;
@@ -1,5 +1,5 @@
1
1
  import { LinearSyntenyDisplayModel } from './model';
2
2
  export declare const MAX_COLOR_RANGE: number;
3
3
  export declare function getId(r: number, g: number, b: number, unitMultiplier: number): number;
4
- export declare function drawRef(model: LinearSyntenyDisplayModel, ctx1: CanvasRenderingContext2D, ctx3?: CanvasRenderingContext2D): void;
4
+ export declare function drawRef(model: LinearSyntenyDisplayModel, ctx1: CanvasRenderingContext2D, ctx3?: CanvasRenderingContext2D): undefined;
5
5
  export declare function drawMouseoverSynteny(model: LinearSyntenyDisplayModel): void;