@jbrowse/plugin-linear-genome-view 5.0.0-beta.2 → 5.0.0-beta.20

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 (177) hide show
  1. package/esm/LinearGenomeView/afterAttach.d.ts +22 -5
  2. package/esm/LinearGenomeView/afterAttach.js +129 -106
  3. package/esm/LinearGenomeView/axisConfigSchema.d.ts +18 -0
  4. package/esm/LinearGenomeView/axisConfigSchema.js +22 -0
  5. package/esm/LinearGenomeView/components/CenterLine.js +10 -5
  6. package/esm/LinearGenomeView/components/ConnectedHoverHighlight.js +2 -3
  7. package/esm/LinearGenomeView/components/CrisprGuidePanel.js +3 -5
  8. package/esm/LinearGenomeView/components/ExportSvgDialog.d.ts +9 -4
  9. package/esm/LinearGenomeView/components/ExportSvgDialog.js +45 -8
  10. package/esm/LinearGenomeView/components/GetSequenceDialog.js +2 -2
  11. package/esm/LinearGenomeView/components/Header.js +11 -1
  12. package/esm/LinearGenomeView/components/HeaderClearHighlightButton.js +2 -2
  13. package/esm/LinearGenomeView/components/HeaderPanControls.d.ts +3 -3
  14. package/esm/LinearGenomeView/components/HeaderPanControls.js +6 -3
  15. package/esm/LinearGenomeView/components/HeaderSearchBoxes.js +4 -1
  16. package/esm/LinearGenomeView/components/HeaderZoomControls.js +6 -35
  17. package/esm/LinearGenomeView/components/Highlight.js +27 -11
  18. package/esm/LinearGenomeView/components/HighlightBand.d.ts +11 -2
  19. package/esm/LinearGenomeView/components/HighlightBand.js +32 -13
  20. package/esm/LinearGenomeView/components/HighlightChip.d.ts +3 -3
  21. package/esm/LinearGenomeView/components/HighlightChip.js +13 -8
  22. package/esm/LinearGenomeView/components/HighlightLabelDialog.d.ts +6 -0
  23. package/esm/LinearGenomeView/components/HighlightLabelDialog.js +18 -0
  24. package/esm/LinearGenomeView/components/HoverPositionHighlight.js +3 -3
  25. package/esm/LinearGenomeView/components/ImportForm.js +7 -9
  26. package/esm/LinearGenomeView/components/LinearGenomeView.js +5 -12
  27. package/esm/LinearGenomeView/components/LinearGenomeViewContainer.js +13 -14
  28. package/esm/LinearGenomeView/components/MiniControls.js +11 -5
  29. package/esm/LinearGenomeView/components/OverviewHighlight.js +3 -3
  30. package/esm/LinearGenomeView/components/OverviewHighlightBand.d.ts +3 -2
  31. package/esm/LinearGenomeView/components/OverviewHighlightBand.js +6 -5
  32. package/esm/LinearGenomeView/components/OverviewRubberband.js +25 -48
  33. package/esm/LinearGenomeView/components/OverviewScalebar.js +4 -5
  34. package/esm/LinearGenomeView/components/OverviewScalebarPolygon.js +5 -3
  35. package/esm/LinearGenomeView/components/PaddingBlocks.js +3 -8
  36. package/esm/LinearGenomeView/components/RangeSelectOverlay.js +5 -6
  37. package/esm/LinearGenomeView/components/RegionWidthEditorDialog.d.ts +3 -2
  38. package/esm/LinearGenomeView/components/RegionWidthEditorDialog.js +4 -4
  39. package/esm/LinearGenomeView/components/ResizeAllTracksHandle.d.ts +5 -0
  40. package/esm/LinearGenomeView/components/ResizeAllTracksHandle.js +74 -0
  41. package/esm/LinearGenomeView/components/Rubberband.d.ts +1 -2
  42. package/esm/LinearGenomeView/components/Rubberband.js +3 -2
  43. package/esm/LinearGenomeView/components/SVGHighlightBand.d.ts +10 -1
  44. package/esm/LinearGenomeView/components/SVGHighlightBand.js +16 -5
  45. package/esm/LinearGenomeView/components/Scalebar.d.ts +2 -6
  46. package/esm/LinearGenomeView/components/Scalebar.js +8 -5
  47. package/esm/LinearGenomeView/components/ScalebarRefNameLabels.js +51 -36
  48. package/esm/LinearGenomeView/components/SearchBox.js +10 -16
  49. package/esm/LinearGenomeView/components/SearchPanelForm.d.ts +3 -2
  50. package/esm/LinearGenomeView/components/SearchPanelForm.js +4 -2
  51. package/esm/LinearGenomeView/components/SearchResultsDialog.d.ts +4 -8
  52. package/esm/LinearGenomeView/components/SearchResultsDialog.js +7 -4
  53. package/esm/LinearGenomeView/components/SearchResultsTable.d.ts +4 -7
  54. package/esm/LinearGenomeView/components/SearchResultsTable.js +25 -53
  55. package/esm/LinearGenomeView/components/SequenceFeatureHoverHighlight.js +2 -3
  56. package/esm/LinearGenomeView/components/SequenceSearchDialog.d.ts +2 -4
  57. package/esm/LinearGenomeView/components/StrandCheckboxes.d.ts +3 -2
  58. package/esm/LinearGenomeView/components/StrandCheckboxes.js +4 -2
  59. package/esm/LinearGenomeView/components/TrackContainer.d.ts +2 -3
  60. package/esm/LinearGenomeView/components/TrackContainer.js +63 -10
  61. package/esm/LinearGenomeView/components/TrackLabel.js +14 -4
  62. package/esm/LinearGenomeView/components/TrackLabelButtons.js +2 -2
  63. package/esm/LinearGenomeView/components/TrackLabelDragHandle.js +4 -5
  64. package/esm/LinearGenomeView/components/TrackLabelMenu.js +11 -14
  65. package/esm/LinearGenomeView/components/TrackLabelRefNameWarning.d.ts +3 -4
  66. package/esm/LinearGenomeView/components/TrackLabelRefNameWarning.js +23 -10
  67. package/esm/LinearGenomeView/components/TrackRenderingContainer.d.ts +6 -4
  68. package/esm/LinearGenomeView/components/TrackRenderingContainer.js +12 -24
  69. package/esm/LinearGenomeView/components/TracksContainer.js +11 -23
  70. package/esm/LinearGenomeView/components/VerticalGuide.d.ts +1 -2
  71. package/esm/LinearGenomeView/components/VerticalGuide.js +3 -16
  72. package/esm/LinearGenomeView/components/fetchSequence.d.ts +1 -2
  73. package/esm/LinearGenomeView/components/fetchSequence.js +15 -7
  74. package/esm/LinearGenomeView/components/recentLocationsMenu.js +10 -0
  75. package/esm/LinearGenomeView/components/useRangeSelect.d.ts +0 -3
  76. package/esm/LinearGenomeView/components/useRangeSelect.js +26 -61
  77. package/esm/LinearGenomeView/components/useSearchBoxPrefs.d.ts +3 -1
  78. package/esm/LinearGenomeView/components/useSearchBoxPrefs.js +4 -2
  79. package/esm/LinearGenomeView/components/useSideScroll.d.ts +17 -2
  80. package/esm/LinearGenomeView/components/useSideScroll.js +156 -102
  81. package/esm/LinearGenomeView/components/util.d.ts +4 -0
  82. package/esm/LinearGenomeView/components/util.js +4 -2
  83. package/esm/LinearGenomeView/consts.d.ts +2 -0
  84. package/esm/LinearGenomeView/consts.js +3 -1
  85. package/esm/LinearGenomeView/containingLgv.d.ts +21 -0
  86. package/esm/LinearGenomeView/containingLgv.js +23 -0
  87. package/esm/LinearGenomeView/headerFit.d.ts +4 -2
  88. package/esm/LinearGenomeView/headerFit.js +20 -7
  89. package/esm/LinearGenomeView/index.d.ts +2 -7
  90. package/esm/LinearGenomeView/index.js +5 -7
  91. package/esm/LinearGenomeView/keyboardHandler.d.ts +8 -7
  92. package/esm/LinearGenomeView/keyboardHandler.js +61 -23
  93. package/esm/LinearGenomeView/launchKeys.d.ts +1 -1
  94. package/esm/LinearGenomeView/launchKeys.js +11 -6
  95. package/esm/LinearGenomeView/lazyDialogs.d.ts +16 -3
  96. package/esm/LinearGenomeView/lazyDialogs.js +1 -0
  97. package/esm/LinearGenomeView/linkedViewSync.d.ts +3 -11
  98. package/esm/LinearGenomeView/linkedViewSync.js +27 -49
  99. package/esm/LinearGenomeView/menuItems.d.ts +16 -18
  100. package/esm/LinearGenomeView/menuItems.js +264 -164
  101. package/esm/LinearGenomeView/model.d.ts +1192 -560
  102. package/esm/LinearGenomeView/model.js +805 -590
  103. package/esm/LinearGenomeView/rExport/exportLinearView.d.ts +17 -0
  104. package/esm/LinearGenomeView/rExport/exportLinearView.js +117 -0
  105. package/esm/LinearGenomeView/rExport/rScript.d.ts +110 -0
  106. package/esm/LinearGenomeView/rExport/rScript.js +524 -0
  107. package/esm/LinearGenomeView/sharedScaleContainer.d.ts +1 -1
  108. package/esm/LinearGenomeView/sharedScaleContainer.js +2 -12
  109. package/esm/LinearGenomeView/showFiles.d.ts +2 -0
  110. package/esm/LinearGenomeView/showFiles.js +19 -0
  111. package/esm/LinearGenomeView/showRegionsWithUndo.d.ts +1 -1
  112. package/esm/LinearGenomeView/showRegionsWithUndo.js +13 -5
  113. package/esm/LinearGenomeView/stickyChrome.d.ts +5 -9
  114. package/esm/LinearGenomeView/stickyChrome.js +5 -9
  115. package/esm/LinearGenomeView/svgcomponents/SVGGridlines.js +4 -4
  116. package/esm/LinearGenomeView/svgcomponents/SVGHeader.d.ts +4 -1
  117. package/esm/LinearGenomeView/svgcomponents/SVGHeader.js +8 -21
  118. package/esm/LinearGenomeView/svgcomponents/SVGHighlights.d.ts +3 -1
  119. package/esm/LinearGenomeView/svgcomponents/SVGHighlights.js +9 -9
  120. package/esm/LinearGenomeView/svgcomponents/SVGHighlightsOverlay.d.ts +3 -1
  121. package/esm/LinearGenomeView/svgcomponents/SVGHighlightsOverlay.js +5 -5
  122. package/esm/LinearGenomeView/svgcomponents/SVGLinearGenomeView.js +13 -18
  123. package/esm/LinearGenomeView/svgcomponents/SVGRegionSeparators.js +2 -5
  124. package/esm/LinearGenomeView/svgcomponents/SVGRowHeader.js +5 -6
  125. package/esm/LinearGenomeView/svgcomponents/SVGRuler.js +9 -10
  126. package/esm/LinearGenomeView/svgcomponents/SVGScalebar.js +3 -3
  127. package/esm/LinearGenomeView/svgcomponents/SVGStackedRow.d.ts +26 -0
  128. package/esm/LinearGenomeView/svgcomponents/SVGStackedRow.js +12 -0
  129. package/esm/LinearGenomeView/svgcomponents/SVGTrackLabel.js +21 -13
  130. package/esm/LinearGenomeView/svgcomponents/SVGTracks.d.ts +4 -5
  131. package/esm/LinearGenomeView/svgcomponents/SVGTracks.js +7 -6
  132. package/esm/LinearGenomeView/svgcomponents/SVGView.d.ts +2 -3
  133. package/esm/LinearGenomeView/svgcomponents/SVGView.js +17 -3
  134. package/esm/LinearGenomeView/svgcomponents/renderViewTracks.d.ts +24 -20
  135. package/esm/LinearGenomeView/svgcomponents/renderViewTracks.js +42 -29
  136. package/esm/LinearGenomeView/svgcomponents/useViewSvgFigure.js +74 -77
  137. package/esm/LinearGenomeView/svgcomponents/util.d.ts +28 -12
  138. package/esm/LinearGenomeView/svgcomponents/util.js +41 -29
  139. package/esm/LinearGenomeView/types.d.ts +13 -10
  140. package/esm/LinearGenomeView/types.js +0 -1
  141. package/esm/LinearGenomeView/util.d.ts +103 -46
  142. package/esm/LinearGenomeView/util.js +222 -170
  143. package/esm/MultiLevelRubberband/MultiLevelRubberband.js +9 -6
  144. package/esm/MultiLevelRubberband/index.d.ts +2 -0
  145. package/esm/MultiLevelRubberband/index.js +2 -0
  146. package/esm/MultiLevelRubberband/menuItems.d.ts +34 -0
  147. package/esm/MultiLevelRubberband/menuItems.js +52 -0
  148. package/esm/MultiLevelRubberband/rowLabel.d.ts +22 -0
  149. package/esm/MultiLevelRubberband/rowLabel.js +27 -0
  150. package/esm/MultiLevelRubberband/types.d.ts +1 -0
  151. package/esm/MultiLevelRubberband/useRangeSelect.d.ts +2 -1
  152. package/esm/MultiLevelRubberband/useRangeSelect.js +45 -59
  153. package/esm/TrackModifiers/index.d.ts +83 -0
  154. package/esm/TrackModifiers/index.js +231 -0
  155. package/esm/displayKitTests/perRegionTestEnv.d.ts +244 -68
  156. package/esm/displayKitTests/perRegionTestEnv.js +30 -26
  157. package/esm/index.d.ts +21 -99
  158. package/esm/index.js +17 -38
  159. package/esm/searchUtils.d.ts +26 -10
  160. package/esm/searchUtils.js +137 -137
  161. package/esm/shared/RubberbandSpan.d.ts +3 -2
  162. package/esm/shared/RubberbandSpan.js +6 -3
  163. package/esm/shared/coordLabels.d.ts +11 -4
  164. package/esm/shared/coordLabels.js +20 -5
  165. package/esm/shared/useWindowDrag.d.ts +18 -0
  166. package/esm/shared/useWindowDrag.js +47 -0
  167. package/package.json +12 -11
  168. package/esm/FeatureTrack/configSchema.d.ts +0 -124
  169. package/esm/FeatureTrack/configSchema.js +0 -54
  170. package/esm/FeatureTrack/index.d.ts +0 -2
  171. package/esm/FeatureTrack/index.js +0 -13
  172. package/esm/LinearGenomeView/initKeys.d.ts +0 -12
  173. package/esm/LinearGenomeView/initKeys.js +0 -68
  174. package/esm/MultiLevelRubberband/VerticalGuide.d.ts +0 -6
  175. package/esm/MultiLevelRubberband/VerticalGuide.js +0 -21
  176. package/esm/lazyPluginExports.d.ts +0 -23
  177. package/esm/lazyPluginExports.js +0 -36
@@ -1,34 +1,72 @@
1
1
  import { getSession } from '@jbrowse/core/util';
2
+ import { isTextEntryFocused } from '@jbrowse/core/util/isTextEntryFocused';
2
3
  import { addDisposer } from '@jbrowse/mobx-state-tree';
3
- /**
4
- * Sets up keyboard shortcuts for the LinearGenomeView
5
- * - Ctrl/Cmd + ArrowLeft: slide left
6
- * - Ctrl/Cmd + ArrowRight: slide right
7
- * - Ctrl/Cmd + ArrowUp: zoom in
8
- * - Ctrl/Cmd + ArrowDown: zoom out
9
- */
4
+ // every entry also needs Ctrl or Cmd; an arrow fires with or without Shift
5
+ export const lgvKeyboardShortcuts = [
6
+ {
7
+ keys: 'Ctrl/Cmd + ←',
8
+ description: 'Pan left',
9
+ code: 'ArrowLeft',
10
+ run: self => {
11
+ self.slide(-0.9);
12
+ },
13
+ },
14
+ {
15
+ keys: 'Ctrl/Cmd + →',
16
+ description: 'Pan right',
17
+ code: 'ArrowRight',
18
+ run: self => {
19
+ self.slide(0.9);
20
+ },
21
+ },
22
+ {
23
+ keys: 'Ctrl/Cmd + ↑',
24
+ description: 'Zoom in',
25
+ code: 'ArrowUp',
26
+ run: self => {
27
+ self.zoom(self.bpPerPx / 2);
28
+ },
29
+ },
30
+ {
31
+ keys: 'Ctrl/Cmd + ↓',
32
+ description: 'Zoom out',
33
+ code: 'ArrowDown',
34
+ run: self => {
35
+ self.zoom(self.bpPerPx * 2);
36
+ },
37
+ },
38
+ {
39
+ keys: 'Ctrl/Cmd + Shift + D',
40
+ description: 'Highlight the region in view',
41
+ code: 'KeyD',
42
+ shift: true,
43
+ run: self => {
44
+ self.highlightCurrentRegion();
45
+ getSession(self).notify('Region highlighted.', 'success');
46
+ },
47
+ },
48
+ {
49
+ keys: 'Ctrl/Cmd + Shift + M',
50
+ description: 'Go to the newest highlight',
51
+ code: 'KeyM',
52
+ shift: true,
53
+ run: self => {
54
+ void self.navigateNewestHighlight();
55
+ },
56
+ },
57
+ ];
10
58
  export function setupKeyboardHandler(self) {
11
59
  if (typeof document === 'undefined') {
12
60
  return;
13
61
  }
14
62
  function handler(e) {
15
- const session = getSession(self);
16
- if (session.focusedViewId === self.id && (e.ctrlKey || e.metaKey)) {
17
- if (e.code === 'ArrowLeft') {
63
+ if (getSession(self).focusedViewId === self.id &&
64
+ (e.ctrlKey || e.metaKey) &&
65
+ !isTextEntryFocused()) {
66
+ const shortcut = lgvKeyboardShortcuts.find(s => s.code === e.code && (!s.shift || e.shiftKey));
67
+ if (shortcut) {
18
68
  e.preventDefault();
19
- self.slide(-0.9);
20
- }
21
- else if (e.code === 'ArrowRight') {
22
- e.preventDefault();
23
- self.slide(0.9);
24
- }
25
- else if (e.code === 'ArrowUp') {
26
- e.preventDefault();
27
- self.zoom(self.bpPerPx / 2);
28
- }
29
- else if (e.code === 'ArrowDown') {
30
- e.preventDefault();
31
- self.zoom(self.bpPerPx * 2);
69
+ shortcut.run(self);
32
70
  }
33
71
  }
34
72
  }
@@ -1,2 +1,2 @@
1
1
  import type { InitState } from './types.ts';
2
- export declare const lgvLaunchKeys: import("@jbrowse/core/util/withLaunchInput").LaunchKeyRegistration<InitState, "bpPerPx" | "offsetPx">;
2
+ export declare const lgvLaunchKeys: import("@jbrowse/core/util/withLaunchInput").LaunchKeyRegistration<InitState, "bpPerPx" | "colorByCDS" | "offsetPx" | "showCytobandsSetting">;
@@ -3,10 +3,12 @@ import { defineLaunchKeys } from '@jbrowse/core/util/withLaunchInput';
3
3
  // view interprets and nobody registered here is a compile error rather than a
4
4
  // key that partitions as a typo.
5
5
  //
6
- // `bpPerPx`/`offsetPx` are the viewport spelling from before it was stored as a
7
- // window. They are no longer declared properties, so the partition would read
8
- // them as typos; the model's own preProcessSnapshot still converts them, so a
9
- // URL or saved spec naming them goes on working. Deletable with `legacyBpPerPx`.
6
+ // `bpPerPx`/`offsetPx` are v4's viewport spelling from before it was stored as
7
+ // a window, `showCytobandsSetting` its cytoband toggle and `colorByCDS` its
8
+ // frame coloring. None is a declared property, so the partition would read them
9
+ // as typos; the model's own preProcessSnapshot still converts them, so a URL or
10
+ // saved spec naming them goes on working. Share links carry all four, so they
11
+ // stay.
10
12
  //
11
13
  // #launchKeys LinearGenomeView — the URL parameters page renders this list
12
14
  // rather than restating it; each of these keys has its own `&param=` section
@@ -14,10 +16,13 @@ import { defineLaunchKeys } from '@jbrowse/core/util/withLaunchInput';
14
16
  export const lgvLaunchKeys = defineLaunchKeys()({
15
17
  loc: { kind: 'launch' },
16
18
  grow: { kind: 'launch' },
19
+ showHitTrack: { kind: 'launch' },
17
20
  assembly: { kind: 'launch' },
18
21
  displayedRegionNames: { kind: 'launch' },
19
22
  tracklist: { kind: 'launch' },
20
23
  nav: { kind: 'launch' },
21
24
  tracks: { kind: 'trackEntries' },
22
- highlight: { kind: 'highlightEntries' },
23
- }, { passThrough: ['bpPerPx', 'offsetPx'] });
25
+ highlight: { kind: 'launch' },
26
+ }, {
27
+ passThrough: ['bpPerPx', 'offsetPx', 'showCytobandsSetting', 'colorByCDS'],
28
+ });
@@ -5,15 +5,28 @@ export declare const ReturnToImportFormDialog: import("react").LazyExoticCompone
5
5
  handleClose: () => void;
6
6
  }) => import("react").JSX.Element>;
7
7
  export declare const SequenceSearchDialog: import("react").LazyExoticComponent<({ model, handleClose, }: {
8
+ model: import("./components/searchModes.ts").SequenceSearchModel;
9
+ handleClose: () => void;
10
+ }) => import("react").JSX.Element>;
11
+ export declare const ExportSvgDialog: import("react").LazyExoticComponent<({ model, handleClose, chooseWidth, }: {
8
12
  model: {
9
- assemblyNames: string[];
10
- launchTrack: (trackId: string) => Promise<unknown>;
13
+ width?: number;
14
+ effectiveTrackLabels?: import("@jbrowse/display-kit/types").ViewTrackLabelMode;
15
+ exportSvg(opts: import("@jbrowse/core/ui").BaseExportSvgOptions & {
16
+ trackLabels: import("@jbrowse/display-kit/types").TrackLabelMode;
17
+ showGridlines: boolean;
18
+ viewWidth?: number;
19
+ }): Promise<unknown>;
11
20
  };
12
21
  handleClose: () => void;
22
+ chooseWidth?: boolean;
13
23
  }) => import("react").JSX.Element>;
14
- export declare const ExportSvgDialog: import("react").LazyExoticComponent<typeof import("./components/ExportSvgDialog.tsx").default>;
15
24
  export declare const GetSequenceDialog: import("react").LazyExoticComponent<({ model, regions, handleClose, }: {
16
25
  model: import("@jbrowse/mobx-state-tree").IAnyStateTreeNode;
17
26
  regions: import("@jbrowse/core/util").Region[];
18
27
  handleClose: () => void;
19
28
  }) => import("react").JSX.Element>;
29
+ export declare const RegionWidthEditorDialog: import("react").LazyExoticComponent<({ model, handleClose, }: {
30
+ model: import("./model.ts").LinearGenomeViewModel;
31
+ handleClose: () => void;
32
+ }) => import("react").JSX.Element>;
@@ -3,3 +3,4 @@ export const ReturnToImportFormDialog = lazy(() => import('@jbrowse/core/ui/Retu
3
3
  export const SequenceSearchDialog = lazy(() => import('./components/SequenceSearchDialog.js'));
4
4
  export const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog.js'));
5
5
  export const GetSequenceDialog = lazy(() => import('./components/GetSequenceDialog.js'));
6
+ export const RegionWidthEditorDialog = lazy(() => import('./components/RegionWidthEditorDialog.js'));
@@ -1,20 +1,12 @@
1
1
  import type { LinearGenomeViewModel } from './model.ts';
2
2
  import type { IStateTreeNode } from '@jbrowse/mobx-state-tree';
3
- /**
4
- * The single source of truth for which LinearGenomeView actions can be
5
- * replayed across linked views. Keeping it here (rather than as loose string
6
- * arrays in each parent view) means the dispatch below stays exhaustive and a
7
- * typo can't silently produce a no-op sync.
8
- */
9
- export type SyncableViewAction = 'horizontalScroll' | 'zoomTo' | 'showTrack' | 'toggleTrack' | 'launchTrack' | 'launchToggleTrack' | 'hideTrack' | 'setTrackLabels' | 'setShowCenterLine';
10
3
  interface LinkableViews {
11
4
  linkViews: boolean;
12
5
  views: LinearGenomeViewModel[];
13
6
  }
14
7
  /**
15
- * Install a middleware that, while `linkViews` is on, replays each listed
16
- * action onto every other sub-view so panning/zooming/track-toggling stays in
17
- * sync. Used by linear-comparative-view and breakpoint-split-view.
8
+ * While `linkViews` is on, replay each pan, zoom and track toggle made on one
9
+ * sub-view onto every other, with the same arguments.
18
10
  */
19
- export declare function installLinkedViewSync(self: IStateTreeNode & LinkableViews, syncActions: readonly SyncableViewAction[]): void;
11
+ export declare function installLinkedViewSync(self: IStateTreeNode & LinkableViews): void;
20
12
  export {};
@@ -1,58 +1,36 @@
1
- import { addDisposer, addMiddleware, getPath } from '@jbrowse/mobx-state-tree';
2
- function applyViewAction(view, name, args) {
3
- switch (name) {
4
- case 'horizontalScroll':
5
- view.horizontalScroll(args[0]);
6
- break;
7
- case 'zoomTo':
8
- view.zoomTo(args[0]);
9
- break;
10
- case 'showTrack':
11
- view.showTrack(args[0]);
12
- break;
13
- case 'toggleTrack':
14
- view.toggleTrack(args[0]);
15
- break;
16
- case 'launchTrack':
17
- void view.launchTrack(args[0]);
18
- break;
19
- case 'launchToggleTrack':
20
- void view.launchToggleTrack(args[0]);
21
- break;
22
- case 'hideTrack':
23
- view.hideTrack(args[0]);
24
- break;
25
- case 'setTrackLabels':
26
- view.setTrackLabels(args[0]);
27
- break;
28
- case 'setShowCenterLine':
29
- view.setShowCenterLine(args[0]);
30
- break;
31
- }
1
+ import { addDisposer, addMiddleware } from '@jbrowse/mobx-state-tree';
2
+ const LINKED_ACTIONS = [
3
+ 'horizontalScroll',
4
+ 'zoomTo',
5
+ 'showTrack',
6
+ 'toggleTrack',
7
+ 'launchTrack',
8
+ 'launchToggleTrack',
9
+ 'hideTrack',
10
+ 'setTrackLabels',
11
+ 'setShowCenterLine',
12
+ ];
13
+ function isLinkedAction(name) {
14
+ return LINKED_ACTIONS.includes(name);
32
15
  }
33
16
  /**
34
- * Install a middleware that, while `linkViews` is on, replays each listed
35
- * action onto every other sub-view so panning/zooming/track-toggling stays in
36
- * sync. Used by linear-comparative-view and breakpoint-split-view.
17
+ * While `linkViews` is on, replay each pan, zoom and track toggle made on one
18
+ * sub-view onto every other, with the same arguments.
37
19
  */
38
- export function installLinkedViewSync(self, syncActions) {
39
- addDisposer(self, addMiddleware(self, (rawCall, next) => {
40
- const handler = rawCall.type === 'action' &&
41
- rawCall.id === rawCall.rootId &&
42
- self.linkViews
43
- ? syncActions.find(action => action === rawCall.name)
44
- : undefined;
45
- if (handler) {
46
- const sourcePath = getPath(rawCall.context);
47
- next(rawCall);
20
+ export function installLinkedViewSync(self) {
21
+ addDisposer(self, addMiddleware(self, (call, next) => {
22
+ next(call);
23
+ const { name, args, context } = call;
24
+ if (call.type === 'action' &&
25
+ call.id === call.rootId &&
26
+ self.linkViews &&
27
+ isLinkedAction(name)) {
48
28
  for (const view of self.views) {
49
- if (getPath(view) !== sourcePath) {
50
- applyViewAction(view, handler, rawCall.args);
29
+ if (view !== context) {
30
+ const action = view[name];
31
+ void action(...args);
51
32
  }
52
33
  }
53
34
  }
54
- else {
55
- next(rawCall);
56
- }
57
35
  }));
58
36
  }
@@ -1,29 +1,27 @@
1
1
  import type { LinearGenomeViewModel } from './model.ts';
2
2
  import type { BpOffset } from './types.ts';
3
3
  import type { MenuItem } from '@jbrowse/core/ui';
4
+ export declare function zoomMenuItems(self: LinearGenomeViewModel): MenuItem[];
5
+ export declare function buildHighlightsSubMenuItems(self: LinearGenomeViewModel): MenuItem[];
4
6
  /**
5
- * Zoom all the way out, shared by the view menu and the header's zoom menu —
6
- * one definition so the two cannot drift in label, and the view menu is the
7
- * only one of the two that survives `hideHeader`.
8
- *
9
- * The zoom menu earns it on the merits: this is the bottom of the same "Zoom
10
- * out 100x" ladder, and it is where someone already zooming looks.
11
- *
12
- * The label is the import form's button text verbatim (`ImportForm.tsx`), which
13
- * is where most people meet the phrase. No icon: the four-arrows glyph it
14
- * carried reads as "fullscreen", and nothing else names the same gesture, so a
15
- * substitute would be decoration rather than a distinction.
7
+ * Build the main view menu items. A row stacked in another view has no import
8
+ * form of its own, so only a top-level view offers the way back to one.
16
9
  */
17
- export declare function showAllRegionsMenuItem(self: LinearGenomeViewModel): MenuItem;
10
+ export declare function buildMenuItems(self: LinearGenomeViewModel): MenuItem[];
18
11
  /**
19
- * Build the main view menu items
12
+ * Open a copy of the view, tracks and their settings included, framed on the
13
+ * span between two offsets. The same copy as the view menu's "Copy view", and
14
+ * nothing links it back to the original.
20
15
  */
21
- export declare function buildMenuItems(self: LinearGenomeViewModel): MenuItem[];
16
+ export declare function openSpanInNewView(view: LinearGenomeViewModel, start?: BpOffset, end?: BpOffset): import("@jbrowse/core/util").AbstractViewModel | undefined;
22
17
  /**
23
- * Build rubberband selection menu items. `launchItems` are the plugin-supplied
24
- * things a selection can start (`rubberBandLaunchMenuItems()`); they collect
25
- * under one "Launch" submenu so the menu stays three actions plus a group
26
- * however many plugins are loaded, and vanish entirely when none apply.
18
+ * Build rubberband selection menu items. What a selection can open collects
19
+ * under one "Launch" submenu, which sorts last, below any row a plugin appends
20
+ * to the menu itself: a new linear genome view of the span first, then
21
+ * `launchItems`, the plugin-supplied ones (`rubberBandLaunchMenuItems()`).
22
+ *
23
+ * The new view is a copy of this one, so only a top-level view offers it: a row
24
+ * of a comparative view carries that view's framing, such as a hidden header.
27
25
  */
28
26
  export declare function buildRubberBandMenuItems(self: LinearGenomeViewModel, launchItems: MenuItem[]): MenuItem[];
29
27
  /**