@jbrowse/plugin-breakpoint-split-view 2.18.0 → 3.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +1 -2
  2. package/dist/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +2 -9
  3. package/dist/BreakpointAlignmentsFeatureDetail/index.js +17 -7
  4. package/dist/BreakpointSplitView/components/AlignmentConnections.d.ts +2 -3
  5. package/dist/BreakpointSplitView/components/AlignmentConnections.js +91 -113
  6. package/dist/BreakpointSplitView/components/Breakends.d.ts +2 -3
  7. package/dist/BreakpointSplitView/components/Breakends.js +67 -89
  8. package/dist/BreakpointSplitView/components/BreakpointSplitView.d.ts +1 -2
  9. package/dist/BreakpointSplitView/components/BreakpointSplitView.js +12 -16
  10. package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +1 -2
  11. package/dist/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +9 -31
  12. package/dist/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
  13. package/dist/BreakpointSplitView/components/ExportSvgDialog.js +34 -73
  14. package/dist/BreakpointSplitView/components/Overlay.d.ts +2 -3
  15. package/dist/BreakpointSplitView/components/Overlay.js +7 -6
  16. package/dist/BreakpointSplitView/components/PairedFeatures.d.ts +2 -3
  17. package/dist/BreakpointSplitView/components/PairedFeatures.js +47 -69
  18. package/dist/BreakpointSplitView/components/Translocations.d.ts +2 -3
  19. package/dist/BreakpointSplitView/components/Translocations.js +57 -79
  20. package/dist/BreakpointSplitView/index.js +17 -7
  21. package/dist/BreakpointSplitView/model.d.ts +19 -46
  22. package/dist/BreakpointSplitView/model.js +46 -64
  23. package/dist/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
  24. package/dist/BreakpointSplitView/svgcomponents/SVGBackground.js +2 -5
  25. package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
  26. package/dist/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +2 -23
  27. package/dist/BreakpointSplitView/types.d.ts +22 -0
  28. package/dist/BreakpointSplitView/types.js +2 -0
  29. package/dist/BreakpointSplitView/util.d.ts +11 -1
  30. package/dist/BreakpointSplitView/util.js +34 -0
  31. package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.d.ts +1 -2
  32. package/esm/BreakpointAlignmentsFeatureDetail/BreakpointAlignmentsFeatureDetail.js +2 -6
  33. package/esm/BreakpointSplitView/components/AlignmentConnections.d.ts +2 -3
  34. package/esm/BreakpointSplitView/components/AlignmentConnections.js +91 -90
  35. package/esm/BreakpointSplitView/components/Breakends.d.ts +2 -3
  36. package/esm/BreakpointSplitView/components/Breakends.js +67 -66
  37. package/esm/BreakpointSplitView/components/BreakpointSplitView.d.ts +1 -2
  38. package/esm/BreakpointSplitView/components/BreakpointSplitView.js +12 -16
  39. package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.d.ts +1 -2
  40. package/esm/BreakpointSplitView/components/BreakpointSplitViewOverlay.js +9 -8
  41. package/esm/BreakpointSplitView/components/ExportSvgDialog.d.ts +2 -3
  42. package/esm/BreakpointSplitView/components/ExportSvgDialog.js +34 -50
  43. package/esm/BreakpointSplitView/components/Overlay.d.ts +2 -3
  44. package/esm/BreakpointSplitView/components/Overlay.js +7 -6
  45. package/esm/BreakpointSplitView/components/PairedFeatures.d.ts +2 -3
  46. package/esm/BreakpointSplitView/components/PairedFeatures.js +47 -46
  47. package/esm/BreakpointSplitView/components/Translocations.d.ts +2 -3
  48. package/esm/BreakpointSplitView/components/Translocations.js +57 -56
  49. package/esm/BreakpointSplitView/model.d.ts +19 -46
  50. package/esm/BreakpointSplitView/model.js +26 -53
  51. package/esm/BreakpointSplitView/svgcomponents/SVGBackground.d.ts +1 -2
  52. package/esm/BreakpointSplitView/svgcomponents/SVGBackground.js +2 -2
  53. package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.d.ts +2 -1
  54. package/esm/BreakpointSplitView/svgcomponents/SVGBreakpointSplitView.js +2 -23
  55. package/esm/BreakpointSplitView/types.d.ts +22 -0
  56. package/esm/BreakpointSplitView/types.js +1 -0
  57. package/esm/BreakpointSplitView/util.d.ts +11 -1
  58. package/esm/BreakpointSplitView/util.js +32 -1
  59. package/package.json +10 -10
@@ -1,4 +1,5 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
2
3
  import { getSession } from '@jbrowse/core/util';
3
4
  import { observer } from 'mobx-react';
4
5
  import { getSnapshot } from 'mobx-state-tree';
@@ -6,7 +7,7 @@ import { getMatchedPairedFeatures } from './util';
6
7
  import { getPxFromCoordinate, useNextFrame, yPos } from '../util';
7
8
  const [LEFT] = [0, 1, 2, 3];
8
9
  const PairedFeatures = observer(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
9
- const { views } = model;
10
+ const { interactiveOverlay, views } = model;
10
11
  const session = getSession(model);
11
12
  const { assemblyManager } = session;
12
13
  const totalFeatures = model.getTrackFeatures(trackId);
@@ -23,50 +24,50 @@ const PairedFeatures = observer(function ({ model, trackId, parentRef: ref, getT
23
24
  const rect = ref.current.getBoundingClientRect();
24
25
  yoff = rect.top;
25
26
  }
26
- return (React.createElement("g", { stroke: "green", strokeWidth: 5, fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
27
- const ret = [];
28
- for (let i = 0; i < chunk.length - 1; i += 1) {
29
- const { layout: c1, feature: f1, level: level1 } = chunk[i];
30
- const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
31
- const id = f1.id();
32
- if (!c1 || !c2) {
33
- return null;
27
+ return (_jsx("g", { stroke: "green", strokeWidth: 5, fill: "none", "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId, children: layoutMatches.map(chunk => {
28
+ const ret = [];
29
+ for (let i = 0; i < chunk.length - 1; i += 1) {
30
+ const { layout: c1, feature: f1, level: level1 } = chunk[i];
31
+ const { layout: c2, feature: f2, level: level2 } = chunk[i + 1];
32
+ const id = f1.id();
33
+ if (!c1 || !c2) {
34
+ return null;
35
+ }
36
+ const f1origref = f1.get('refName');
37
+ const f2origref = f2.get('refName');
38
+ const f1ref = assembly.getCanonicalRefName(f1origref);
39
+ const f2ref = assembly.getCanonicalRefName(f2origref);
40
+ if (!f1ref || !f2ref) {
41
+ throw new Error(`unable to find ref for ${f1ref || f2ref}`);
42
+ }
43
+ const x1 = getPxFromCoordinate(views[level1], f1ref, c1[LEFT]);
44
+ const x2 = getPxFromCoordinate(views[level2], f2ref, c2[LEFT]);
45
+ const tracks = views.map(v => v.getTrack(trackId));
46
+ const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
47
+ yoff;
48
+ const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
49
+ yoff;
50
+ const path = [
51
+ 'M',
52
+ x1,
53
+ y1,
54
+ 'L',
55
+ x2,
56
+ y2,
57
+ ].join(' ');
58
+ ret.push(_jsx("path", { d: path, "data-testid": "r2", pointerEvents: interactiveOverlay ? 'auto' : undefined, strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
59
+ var _a, _b, _c;
60
+ const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
61
+ featureData: (_b = totalFeatures.get(id)) === null || _b === void 0 ? void 0 : _b.toJSON(),
62
+ });
63
+ (_c = session.showWidget) === null || _c === void 0 ? void 0 : _c.call(session, featureWidget);
64
+ }, onMouseOver: () => {
65
+ setMouseoverElt(id);
66
+ }, onMouseOut: () => {
67
+ setMouseoverElt(undefined);
68
+ } }, JSON.stringify(path)));
34
69
  }
35
- const f1origref = f1.get('refName');
36
- const f2origref = f2.get('refName');
37
- const f1ref = assembly.getCanonicalRefName(f1origref);
38
- const f2ref = assembly.getCanonicalRefName(f2origref);
39
- if (!f1ref || !f2ref) {
40
- throw new Error(`unable to find ref for ${f1ref || f2ref}`);
41
- }
42
- const x1 = getPxFromCoordinate(views[level1], f1ref, c1[LEFT]);
43
- const x2 = getPxFromCoordinate(views[level2], f2ref, c2[LEFT]);
44
- const tracks = views.map(v => v.getTrack(trackId));
45
- const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
46
- yoff;
47
- const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
48
- yoff;
49
- const path = [
50
- 'M',
51
- x1,
52
- y1,
53
- 'L',
54
- x2,
55
- y2,
56
- ].join(' ');
57
- ret.push(React.createElement("path", { d: path, "data-testid": "r2", key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
58
- var _a, _b, _c;
59
- const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
60
- featureData: (_b = totalFeatures.get(id)) === null || _b === void 0 ? void 0 : _b.toJSON(),
61
- });
62
- (_c = session.showWidget) === null || _c === void 0 ? void 0 : _c.call(session, featureWidget);
63
- }, onMouseOver: () => {
64
- setMouseoverElt(id);
65
- }, onMouseOut: () => {
66
- setMouseoverElt(undefined);
67
- } }));
68
- }
69
- return ret;
70
- })));
70
+ return ret;
71
+ }) }));
71
72
  });
72
73
  export default PairedFeatures;
@@ -1,9 +1,8 @@
1
- import React from 'react';
2
1
  import type { BreakpointViewModel } from '../model';
3
2
  declare const Translocations: ({ model, trackId, parentRef: ref, getTrackYPosOverride, }: {
4
3
  model: BreakpointViewModel;
5
4
  trackId: string;
6
- parentRef: React.RefObject<SVGSVGElement>;
5
+ parentRef: React.RefObject<SVGSVGElement | null>;
7
6
  getTrackYPosOverride?: (trackId: string, level: number) => number;
8
- }) => React.JSX.Element | null;
7
+ }) => import("react/jsx-runtime").JSX.Element | null;
9
8
  export default Translocations;
@@ -1,4 +1,5 @@
1
- import React, { useMemo, useState } from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useMemo, useState } from 'react';
2
3
  import { getSession } from '@jbrowse/core/util';
3
4
  import { observer } from 'mobx-react';
4
5
  import { getSnapshot } from 'mobx-state-tree';
@@ -17,7 +18,7 @@ function str(s) {
17
18
  }
18
19
  }
19
20
  const Translocations = observer(function ({ model, trackId, parentRef: ref, getTrackYPosOverride, }) {
20
- const { views } = model;
21
+ const { interactiveOverlay, views } = model;
21
22
  const session = getSession(model);
22
23
  const { assemblyManager } = session;
23
24
  const totalFeatures = model.getTrackFeatures(trackId);
@@ -37,60 +38,60 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
37
38
  if (views.length < 2) {
38
39
  return null;
39
40
  }
40
- return (React.createElement("g", { fill: "none", stroke: "green", strokeWidth: 5, "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId }, layoutMatches.map(chunk => {
41
- var _a, _b;
42
- const ret = [];
43
- for (const { layout: c1, feature: f1, level: level1 } of chunk) {
44
- const level2 = level1 === 0 ? 1 : 0;
45
- const id = f1.id();
46
- if (!c1) {
47
- return null;
41
+ return (_jsx("g", { fill: "none", stroke: "green", strokeWidth: 5, "data-testid": layoutMatches.length ? `${trackId}-loaded` : trackId, children: layoutMatches.map(chunk => {
42
+ var _a, _b;
43
+ const ret = [];
44
+ for (const { layout: c1, feature: f1, level: level1 } of chunk) {
45
+ const level2 = level1 === 0 ? 1 : 0;
46
+ const id = f1.id();
47
+ if (!c1) {
48
+ return null;
49
+ }
50
+ const info = f1.get('INFO');
51
+ const chr2 = info.CHR2[0];
52
+ const end2 = info.END[0];
53
+ const res = (_b = (_a = info.STRANDS) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.split('');
54
+ const [myDirection, mateDirection] = res !== null && res !== void 0 ? res : ['.', '.'];
55
+ const r = getPxFromCoordinate(views[level2], chr2, end2);
56
+ if (r) {
57
+ const c2 = [r, 0, r + 1, 0];
58
+ const x1 = getPxFromCoordinate(views[level1], f1.get('refName'), c1[LEFT]);
59
+ const x2 = r;
60
+ const reversed1 = views[level1].pxToBp(x1).reversed;
61
+ const reversed2 = views[level2].pxToBp(x2).reversed;
62
+ const tracks = views.map(v => v.getTrack(trackId));
63
+ const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
64
+ yOffset;
65
+ const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
66
+ yOffset;
67
+ const path = [
68
+ 'M',
69
+ x1 - 20 * str(myDirection) * (reversed1 ? -1 : 1),
70
+ y1,
71
+ 'L',
72
+ x1,
73
+ y1,
74
+ 'L',
75
+ x2,
76
+ y2,
77
+ 'L',
78
+ x2 - 20 * str(mateDirection) * (reversed2 ? -1 : 1),
79
+ y2,
80
+ ].join(' ');
81
+ ret.push(_jsx("path", { d: path, pointerEvents: interactiveOverlay ? 'auto' : undefined, strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
82
+ var _a, _b;
83
+ const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
84
+ featureData: (totalFeatures.get(id) || { toJSON: () => { } }).toJSON(),
85
+ });
86
+ (_b = session.showWidget) === null || _b === void 0 ? void 0 : _b.call(session, featureWidget);
87
+ }, onMouseOver: () => {
88
+ setMouseoverElt(id);
89
+ }, onMouseOut: () => {
90
+ setMouseoverElt(undefined);
91
+ } }, JSON.stringify(path)));
92
+ }
48
93
  }
49
- const info = f1.get('INFO');
50
- const chr2 = info.CHR2[0];
51
- const end2 = info.END[0];
52
- const res = (_b = (_a = info.STRANDS) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.split('');
53
- const [myDirection, mateDirection] = res !== null && res !== void 0 ? res : ['.', '.'];
54
- const r = getPxFromCoordinate(views[level2], chr2, end2);
55
- if (r) {
56
- const c2 = [r, 0, r + 1, 0];
57
- const x1 = getPxFromCoordinate(views[level1], f1.get('refName'), c1[LEFT]);
58
- const x2 = r;
59
- const reversed1 = views[level1].pxToBp(x1).reversed;
60
- const reversed2 = views[level2].pxToBp(x2).reversed;
61
- const tracks = views.map(v => v.getTrack(trackId));
62
- const y1 = yPos(trackId, level1, views, tracks, c1, getTrackYPosOverride) -
63
- yOffset;
64
- const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
65
- yOffset;
66
- const path = [
67
- 'M',
68
- x1 - 20 * str(myDirection) * (reversed1 ? -1 : 1),
69
- y1,
70
- 'L',
71
- x1,
72
- y1,
73
- 'L',
74
- x2,
75
- y2,
76
- 'L',
77
- x2 - 20 * str(mateDirection) * (reversed2 ? -1 : 1),
78
- y2,
79
- ].join(' ');
80
- ret.push(React.createElement("path", { d: path, key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
81
- var _a, _b;
82
- const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
83
- featureData: (totalFeatures.get(id) || { toJSON: () => { } }).toJSON(),
84
- });
85
- (_b = session.showWidget) === null || _b === void 0 ? void 0 : _b.call(session, featureWidget);
86
- }, onMouseOver: () => {
87
- setMouseoverElt(id);
88
- }, onMouseOut: () => {
89
- setMouseoverElt(undefined);
90
- } }));
91
- }
92
- }
93
- return ret;
94
- })));
94
+ return ret;
95
+ }) }));
95
96
  });
96
97
  export default Translocations;
@@ -1,32 +1,7 @@
1
- import type React from 'react';
1
+ import type { ExportSvgOptions } from './types';
2
2
  import type PluginManager from '@jbrowse/core/PluginManager';
3
3
  import type { Feature } from '@jbrowse/core/util';
4
- import type { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
5
4
  import type { Instance } from 'mobx-state-tree';
6
- export declare function getClip(cigar: string, strand: number): number;
7
- export interface ExportSvgOptions {
8
- rasterizeLayers?: boolean;
9
- filename?: string;
10
- Wrapper?: React.FC<{
11
- children: React.ReactNode;
12
- }>;
13
- fontSize?: number;
14
- rulerHeight?: number;
15
- textHeight?: number;
16
- paddingHeight?: number;
17
- headerHeight?: number;
18
- cytobandHeight?: number;
19
- trackLabels?: string;
20
- themeName?: string;
21
- }
22
- type LGV = LinearGenomeViewModel;
23
- export interface Breakend {
24
- MateDirection: string;
25
- Join: string;
26
- Replacement: string;
27
- MatePosition: string;
28
- }
29
- export type LayoutRecord = [number, number, number, number];
30
5
  export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
31
6
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
32
7
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -37,7 +12,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
37
12
  trackSelectorType: import("mobx-state-tree").IType<string | undefined, string, string>;
38
13
  showIntraviewLinks: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
39
14
  linkViews: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
40
- interactToggled: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
15
+ interactiveOverlay: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
41
16
  views: import("mobx-state-tree").IArrayType<import("mobx-state-tree").IModelType<{
42
17
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
43
18
  displayName: import("mobx-state-tree").IMaybe<import("mobx-state-tree").ISimpleType<string>>;
@@ -57,7 +32,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
57
32
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
58
33
  trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
59
34
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
60
- 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]>;
35
+ highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType>>, [undefined]>;
61
36
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
62
37
  showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
63
38
  }, {
@@ -78,8 +53,8 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
78
53
  trackRefs: Record<string, HTMLDivElement>;
79
54
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
80
55
  coarseTotalBp: number;
81
- leftOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset;
82
- rightOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset;
56
+ leftOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset;
57
+ rightOffset: undefined | import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset;
83
58
  } & {
84
59
  readonly trackLabelsSetting: any;
85
60
  readonly width: number;
@@ -126,12 +101,12 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
126
101
  setHideHeaderOverview(b: boolean): void;
127
102
  setHideNoTracksActive(b: boolean): void;
128
103
  setShowGridlines(b: boolean): void;
129
- addToHighlights(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType): void;
130
- setHighlight(highlight?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType[]): void;
131
- removeHighlight(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").HighlightType): void;
104
+ addToHighlights(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType): void;
105
+ setHighlight(highlight?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType[]): void;
106
+ removeHighlight(highlight: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType): void;
132
107
  scrollTo(offsetPx: number): number;
133
108
  zoomTo(bpPerPx: number, offset?: number, centerAtOffset?: boolean): number;
134
- setOffsets(left?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset, right?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset): void;
109
+ setOffsets(left?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset, right?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset): void;
135
110
  setSearchResults(searchResults: import("@jbrowse/core/TextSearch/BaseResults").default[], searchQuery: string, assemblyName?: string): void;
136
111
  setNewView(bpPerPx: number, offsetPx: number): void;
137
112
  horizontallyFlip(): void;
@@ -148,7 +123,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
148
123
  setShowCenterLine(b: boolean): void;
149
124
  setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
150
125
  activateTrackSelector(): import("@jbrowse/core/util").Widget;
151
- getSelectedRegions(leftOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset, rightOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset): {
126
+ getSelectedRegions(leftOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset, rightOffset?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset): {
152
127
  start: number;
153
128
  end: number;
154
129
  type: string;
@@ -170,7 +145,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
170
145
  setDraggingTrackId(idx?: string): void;
171
146
  setScaleFactor(factor: number): void;
172
147
  clearView(): void;
173
- exportSvg(opts?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").ExportSvgOptions): Promise<void>;
148
+ exportSvg(opts?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").ExportSvgOptions): Promise<void>;
174
149
  } & {
175
150
  slide: (viewWidths: number) => void;
176
151
  } & {
@@ -192,15 +167,15 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
192
167
  setCoarseDynamicBlocks(blocks: import("@jbrowse/core/util/blockTypes").BlockSet): void;
193
168
  afterAttach(): void;
194
169
  } & {
195
- moveTo(start?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset, end?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset): void;
170
+ moveTo(start?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset, end?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").BpOffset): void;
196
171
  navToLocString(input: string, optAssemblyName?: string): Promise<void>;
197
172
  navToSearchString({ input, assembly, }: {
198
173
  input: string;
199
174
  assembly: import("@jbrowse/core/assemblyManager/assembly").Assembly;
200
175
  }): Promise<void>;
201
176
  navToLocations(parsedLocStrings: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string): Promise<void>;
202
- navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation): void;
203
- navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation[]): void;
177
+ navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation): void;
178
+ navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").NavLocation[]): void;
204
179
  } & {
205
180
  rubberBandMenuItems(): import("@jbrowse/core/ui").MenuItem[];
206
181
  bpToPx({ refName, coord, regionNumber, }: {
@@ -255,7 +230,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
255
230
  showCytobandsSetting: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
256
231
  trackLabels: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
257
232
  showGridlines: import("mobx-state-tree").IType<boolean | undefined, boolean, boolean>;
258
- 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]>;
233
+ highlight: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IArrayType<import("mobx-state-tree").IType<import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType, import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView/types").HighlightType>>, [undefined]>;
259
234
  colorByCDS: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
260
235
  showTrackOutlines: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<boolean>, [undefined]>;
261
236
  }>>, import("mobx-state-tree")._NotCustomized>>;
@@ -284,7 +259,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
284
259
  getTrackFeatures(trackConfigId: string): Map<string, Feature>;
285
260
  getMatchedFeaturesInLayout(trackConfigId: string, features: Feature[][]): {
286
261
  feature: Feature;
287
- layout: LayoutRecord | undefined;
262
+ layout: import("./types").LayoutRecord | undefined;
288
263
  level: number;
289
264
  clipPos: number;
290
265
  }[][];
@@ -292,10 +267,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
292
267
  afterAttach(): void;
293
268
  onSubviewAction(actionName: string, path: string, args?: unknown[]): void;
294
269
  setWidth(newWidth: number): void;
295
- removeView(view: LGV): void;
296
- toggleInteract(): void;
297
- toggleIntraviewLinks(): void;
298
- toggleLinkViews(): void;
270
+ setInteractiveOverlay(arg: boolean): void;
271
+ setShowIntraviewLinks(arg: boolean): void;
272
+ setLinkViews(arg: boolean): void;
299
273
  setMatchedTrackFeatures(obj: Record<string, Feature[][]>): void;
300
274
  reverseViewOrder(): void;
301
275
  } & {
@@ -335,4 +309,3 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
335
309
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
336
310
  export type BreakpointViewStateModel = ReturnType<typeof stateModelFactory>;
337
311
  export type BreakpointViewModel = Instance<BreakpointViewStateModel>;
338
- export {};
@@ -1,5 +1,4 @@
1
1
  import { lazy } from 'react';
2
- import { getConf } from '@jbrowse/core/configuration';
3
2
  import { BaseViewModel } from '@jbrowse/core/pluggableElementTypes/models';
4
3
  import { getSession, notEmpty } from '@jbrowse/core/util';
5
4
  import LinkIcon from '@mui/icons-material/Link';
@@ -7,38 +6,8 @@ import PhotoCamera from '@mui/icons-material/PhotoCamera';
7
6
  import { saveAs } from 'file-saver';
8
7
  import { autorun } from 'mobx';
9
8
  import { addDisposer, getPath, onAction, types } from 'mobx-state-tree';
10
- import { intersect } from './util';
9
+ import { calc, getBlockFeatures, getClip, intersect } from './util';
11
10
  const ExportSvgDialog = lazy(() => import('./components/ExportSvgDialog'));
12
- const startClip = new RegExp(/(\d+)[SH]$/);
13
- const endClip = new RegExp(/^(\d+)([SH])/);
14
- export function getClip(cigar, strand) {
15
- return strand === -1
16
- ? +(startClip.exec(cigar) || [])[1] || 0
17
- : +(endClip.exec(cigar) || [])[1] || 0;
18
- }
19
- function calc(track, f) {
20
- var _a, _b;
21
- return (_b = (_a = track.displays[0]).searchFeatureByID) === null || _b === void 0 ? void 0 : _b.call(_a, f.id());
22
- }
23
- async function getBlockFeatures(model, track) {
24
- var _a;
25
- const { views } = model;
26
- const { rpcManager, assemblyManager } = getSession(model);
27
- const assemblyName = (_a = model.views[0]) === null || _a === void 0 ? void 0 : _a.assemblyNames[0];
28
- if (!assemblyName) {
29
- return undefined;
30
- }
31
- const assembly = await assemblyManager.waitForAssembly(assemblyName);
32
- if (!assembly) {
33
- return undefined;
34
- }
35
- const sessionId = track.configuration.trackId;
36
- return Promise.all(views.map(async (view) => (await rpcManager.call(sessionId, 'CoreGetFeatures', {
37
- adapterConfig: getConf(track, ['adapter']),
38
- sessionId,
39
- regions: view.staticBlocks.contentBlocks,
40
- })).flat()));
41
- }
42
11
  export default function stateModelFactory(pluginManager) {
43
12
  const minHeight = 40;
44
13
  const defaultHeight = 400;
@@ -49,7 +18,7 @@ export default function stateModelFactory(pluginManager) {
49
18
  trackSelectorType: 'hierarchical',
50
19
  showIntraviewLinks: true,
51
20
  linkViews: false,
52
- interactToggled: false,
21
+ interactiveOverlay: true,
53
22
  views: types.array(pluginManager.getViewType('LinearGenomeView')
54
23
  .stateModel),
55
24
  }))
@@ -137,17 +106,14 @@ export default function stateModelFactory(pluginManager) {
137
106
  v.setWidth(newWidth);
138
107
  });
139
108
  },
140
- removeView(view) {
141
- self.views.remove(view);
142
- },
143
- toggleInteract() {
144
- self.interactToggled = !self.interactToggled;
109
+ setInteractiveOverlay(arg) {
110
+ self.interactiveOverlay = arg;
145
111
  },
146
- toggleIntraviewLinks() {
147
- self.showIntraviewLinks = !self.showIntraviewLinks;
112
+ setShowIntraviewLinks(arg) {
113
+ self.showIntraviewLinks = arg;
148
114
  },
149
- toggleLinkViews() {
150
- self.linkViews = !self.linkViews;
115
+ setLinkViews(arg) {
116
+ self.linkViews = arg;
151
117
  },
152
118
  setMatchedTrackFeatures(obj) {
153
119
  self.matchedTrackFeatures = obj;
@@ -182,26 +148,30 @@ export default function stateModelFactory(pluginManager) {
182
148
  label: `Row ${f[0] + 1} view menu`,
183
149
  subMenu: f[1],
184
150
  })),
185
- {
186
- label: 'Reverse view order',
187
- onClick: () => {
188
- self.reverseViewOrder();
189
- },
190
- },
151
+ ...(self.views.length > 1
152
+ ? [
153
+ {
154
+ label: 'Reverse view order',
155
+ onClick: () => {
156
+ self.reverseViewOrder();
157
+ },
158
+ },
159
+ ]
160
+ : []),
191
161
  {
192
162
  label: 'Show intra-view links',
193
163
  type: 'checkbox',
194
164
  checked: self.showIntraviewLinks,
195
165
  onClick: () => {
196
- self.toggleIntraviewLinks();
166
+ self.setShowIntraviewLinks(!self.showIntraviewLinks);
197
167
  },
198
168
  },
199
169
  {
200
170
  label: 'Allow clicking alignment squiggles?',
201
171
  type: 'checkbox',
202
- checked: self.interactToggled,
172
+ checked: self.interactiveOverlay,
203
173
  onClick: () => {
204
- self.toggleInteract();
174
+ self.setInteractiveOverlay(!self.interactiveOverlay);
205
175
  },
206
176
  },
207
177
  {
@@ -210,7 +180,7 @@ export default function stateModelFactory(pluginManager) {
210
180
  icon: LinkIcon,
211
181
  checked: self.linkViews,
212
182
  onClick: () => {
213
- self.toggleLinkViews();
183
+ self.setLinkViews(!self.linkViews);
214
184
  },
215
185
  },
216
186
  {
@@ -219,7 +189,10 @@ export default function stateModelFactory(pluginManager) {
219
189
  onClick: () => {
220
190
  getSession(self).queueDialog(handleClose => [
221
191
  ExportSvgDialog,
222
- { model: self, handleClose },
192
+ {
193
+ model: self,
194
+ handleClose,
195
+ },
223
196
  ]);
224
197
  },
225
198
  },
@@ -1,6 +1,5 @@
1
- import React from 'react';
2
1
  export default function SVGBackground({ width, height, shift, }: {
3
2
  width: number;
4
3
  height: number;
5
4
  shift: number;
6
- }): React.JSX.Element;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { stripAlpha } from '@jbrowse/core/util';
3
3
  import { useTheme } from '@mui/material';
4
4
  export default function SVGBackground({ width, height, shift, }) {
5
5
  const theme = useTheme();
6
- return (React.createElement("rect", { width: width + shift * 2, height: height, fill: stripAlpha(theme.palette.background.default) }));
6
+ return (_jsx("rect", { width: width + shift * 2, height: height, fill: stripAlpha(theme.palette.background.default) }));
7
7
  }
@@ -1,4 +1,5 @@
1
- import type { BreakpointViewModel, ExportSvgOptions } from '../model';
1
+ import type { BreakpointViewModel } from '../model';
2
+ import type { ExportSvgOptions } from '../types';
2
3
  type BSV = BreakpointViewModel;
3
4
  export declare function renderToSvg(model: BSV, opts: ExportSvgOptions): Promise<string>;
4
5
  export {};
@@ -1,17 +1,15 @@
1
- import React from 'react';
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { createJBrowseTheme } from '@jbrowse/core/ui';
3
3
  import { getSession, renderToStaticMarkup, sum } from '@jbrowse/core/util';
4
4
  import { SVGRuler, SVGTracks, totalHeight, } from '@jbrowse/plugin-linear-genome-view';
5
5
  import { ThemeProvider } from '@mui/material';
6
6
  import { when } from 'mobx';
7
- import { getRoot } from 'mobx-state-tree';
8
7
  import SVGBackground from './SVGBackground';
9
8
  import { getTrackNameMaxLen, getTrackOffsets } from './util';
10
9
  import Overlay from '../components/Overlay';
11
10
  export async function renderToSvg(model, opts) {
12
11
  var _a;
13
12
  const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => children, themeName = 'default', } = opts;
14
- const { createRootFn } = getRoot(model);
15
13
  const session = getSession(model);
16
14
  const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
17
15
  const { width, views } = model;
@@ -33,24 +31,5 @@ export async function renderToSvg(model, opts) {
33
31
  const trackOffsets = views.map((view, idx) => getTrackOffsets(view, textOffset, fontSize + (idx > 0 ? heights[idx - 1] : 0) + offset));
34
32
  const w = width + trackLabelOffset;
35
33
  const t = createJBrowseTheme(theme);
36
- return renderToStaticMarkup(React.createElement(ThemeProvider, { theme: t },
37
- React.createElement(Wrapper, null,
38
- React.createElement("svg", { width: width, height: totalHeightSvg, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, w + shift * 2, totalHeightSvg].toString() },
39
- React.createElement(SVGBackground, { width: w, height: totalHeightSvg, shift: shift }),
40
- views[0] ? (React.createElement("g", { transform: `translate(${shift} ${fontSize})` },
41
- React.createElement("g", { transform: `translate(${trackLabelOffset})` },
42
- React.createElement("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary }, views[0].assemblyNames.join(', ')),
43
- React.createElement(SVGRuler, { model: displayResults[0].view, fontSize: fontSize })),
44
- React.createElement("g", { transform: `translate(0 ${offset})` },
45
- React.createElement(SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[0].view, displayResults: displayResults[0].data, trackLabelOffset: trackLabelOffset })))) : null,
46
- views[1] ? (React.createElement("g", { transform: `translate(${shift} ${fontSize + heights[0]})` },
47
- React.createElement("g", { transform: `translate(${trackLabelOffset})` },
48
- React.createElement("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary }, views[1].assemblyNames.join(', ')),
49
- React.createElement(SVGRuler, { model: displayResults[1].view, fontSize: fontSize })),
50
- React.createElement("g", { transform: `translate(0 ${offset})` },
51
- React.createElement(SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[1].view, displayResults: displayResults[1].data, trackLabelOffset: trackLabelOffset })))) : null,
52
- React.createElement("defs", null,
53
- React.createElement("clipPath", { id: "clip-bsv" },
54
- React.createElement("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }))),
55
- React.createElement("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)" }, model.matchedTracks.map(track => (React.createElement(Overlay, { parentRef: { current: null }, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }))))))), createRootFn);
34
+ return renderToStaticMarkup(_jsx(ThemeProvider, { theme: t, children: _jsx(Wrapper, { children: _jsxs("svg", { width: width, height: totalHeightSvg, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, w + shift * 2, totalHeightSvg].toString(), children: [_jsx(SVGBackground, { width: w, height: totalHeightSvg, shift: shift }), views[0] ? (_jsxs("g", { transform: `translate(${shift} ${fontSize})`, children: [_jsxs("g", { transform: `translate(${trackLabelOffset})`, children: [_jsx("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary, children: views[0].assemblyNames.join(', ') }), _jsx(SVGRuler, { model: displayResults[0].view, fontSize: fontSize })] }), _jsx("g", { transform: `translate(0 ${offset})`, children: _jsx(SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[0].view, displayResults: displayResults[0].data, trackLabelOffset: trackLabelOffset }) })] })) : null, views[1] ? (_jsxs("g", { transform: `translate(${shift} ${fontSize + heights[0]})`, children: [_jsxs("g", { transform: `translate(${trackLabelOffset})`, children: [_jsx("text", { x: 0, fontSize: fontSize, fill: t.palette.text.primary, children: views[1].assemblyNames.join(', ') }), _jsx(SVGRuler, { model: displayResults[1].view, fontSize: fontSize })] }), _jsx("g", { transform: `translate(0 ${offset})`, children: _jsx(SVGTracks, { textHeight: textHeight, trackLabels: trackLabels, fontSize: fontSize, model: displayResults[1].view, displayResults: displayResults[1].data, trackLabelOffset: trackLabelOffset }) })] })) : null, _jsx("defs", { children: _jsx("clipPath", { id: "clip-bsv", children: _jsx("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }) }) }), _jsx("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)", children: model.matchedTracks.map(track => (_jsx(Overlay, { parentRef: { current: null }, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }, track.configuration.trackId))) })] }) }) }));
56
35
  }