@jbrowse/plugin-breakpoint-split-view 2.8.0 → 2.10.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.
@@ -82,26 +82,26 @@ const Breakends = (0, mobx_react_1.observer)(function ({ model, trackId, parentR
82
82
  }
83
83
  else {
84
84
  const path = [
85
- 'M',
85
+ 'M', // move to
86
86
  x1 -
87
87
  20 *
88
88
  (relevantAlt.Join === 'left' ? -1 : 1) *
89
89
  (reversed1 ? -1 : 1),
90
90
  y1,
91
- 'L',
91
+ 'L', // line to
92
92
  x1,
93
93
  y1,
94
- 'L',
94
+ 'L', // line to
95
95
  x2,
96
96
  y2,
97
- 'L',
97
+ 'L', // line to
98
98
  x2 -
99
99
  20 *
100
100
  (relevantAlt.MateDirection === 'left' ? 1 : -1) *
101
101
  (reversed2 ? -1 : 1),
102
102
  y2,
103
103
  ].join(' ');
104
- ret.push(react_1.default.createElement("path", { d: path, key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
104
+ ret.push(react_1.default.createElement("path", { d: path, "data-testid": "r2", key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
105
105
  var _a, _b, _c;
106
106
  const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
107
107
  featureData: (_b = totalFeatures.get(id)) === null || _b === void 0 ? void 0 : _b.toJSON(),
@@ -83,16 +83,16 @@ const Translocations = (0, mobx_react_1.observer)(function ({ model, trackId, pa
83
83
  const y2 = (0, util_3.yPos)(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
84
84
  yOffset;
85
85
  const path = [
86
- 'M',
86
+ 'M', // move to
87
87
  x1 - 20 * (myDirection === '+' ? 1 : -1) * (reversed1 ? -1 : 1),
88
88
  y1,
89
- 'L',
89
+ 'L', // line to
90
90
  x1,
91
91
  y1,
92
- 'L',
92
+ 'L', // line to
93
93
  x2,
94
94
  y2,
95
- 'L',
95
+ 'L', // line to
96
96
  x2 - 20 * (mateDirection === '+' ? 1 : -1) * (reversed2 ? -1 : 1),
97
97
  y2,
98
98
  ].join(' ');
@@ -6,7 +6,9 @@ import { Feature } from '@jbrowse/core/util';
6
6
  export interface ExportSvgOptions {
7
7
  rasterizeLayers?: boolean;
8
8
  filename?: string;
9
- Wrapper?: React.FC<any>;
9
+ Wrapper?: React.FC<{
10
+ children: React.ReactNode;
11
+ }>;
10
12
  fontSize?: number;
11
13
  rulerHeight?: number;
12
14
  textHeight?: number;
@@ -26,6 +28,8 @@ export interface Breakend {
26
28
  export type LayoutRecord = [number, number, number, number];
27
29
  /**
28
30
  * #stateModel BreakpointSplitView
31
+ * extends
32
+ * - [BaseViewModel](../baseviewmodel)
29
33
  */
30
34
  export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
31
35
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
@@ -84,7 +88,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
84
88
  trackRefs: Record<string, HTMLDivElement>;
85
89
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
86
90
  coarseTotalBp: number;
87
- leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
91
+ leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined; /**
92
+ * #action
93
+ */
88
94
  rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
89
95
  } & {
90
96
  readonly trackLabelsSetting: any;
@@ -139,7 +145,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
139
145
  } & {
140
146
  moveTrack(movingId: string, targetId: string): void;
141
147
  closeView(): void;
142
- toggleTrack(trackId: string): void;
148
+ toggleTrack(trackId: string): boolean;
143
149
  setTrackLabels(setting: "hidden" | "offset" | "overlapping"): void;
144
150
  toggleCenterLine(): void;
145
151
  setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
@@ -189,6 +195,138 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
189
195
  } & {
190
196
  moveTo(start?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined, end?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined): void;
191
197
  navToLocString(input: string, optAssemblyName?: string | undefined): Promise<void>;
198
+ navToSearchString({ input, assembly, }: {
199
+ input: string;
200
+ assembly: {
201
+ configuration: any;
202
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
203
+ error: unknown;
204
+ loaded: boolean;
205
+ loadingP: Promise<void> | undefined;
206
+ volatileRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
207
+ refNameAliases: {
208
+ [x: string]: string | undefined;
209
+ } | undefined;
210
+ lowerCaseRefNameAliases: {
211
+ [x: string]: string | undefined;
212
+ } | undefined;
213
+ cytobands: Feature[] | undefined;
214
+ } & {
215
+ getConf(arg: string): any;
216
+ } & {
217
+ readonly initialized: boolean;
218
+ readonly name: string;
219
+ readonly regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
220
+ readonly aliases: string[];
221
+ readonly displayName: string | undefined;
222
+ hasName(name: string): boolean;
223
+ readonly allAliases: string[];
224
+ readonly allRefNames: string[] | undefined;
225
+ readonly lowerCaseRefNames: string[] | undefined;
226
+ readonly allRefNamesWithLowerCase: string[] | undefined;
227
+ readonly rpcManager: import("@jbrowse/core/rpc/RpcManager").default;
228
+ readonly refNameColors: string[];
229
+ } & {
230
+ readonly refNames: string[] | undefined;
231
+ } & {
232
+ getCanonicalRefName(refName: string): string | undefined;
233
+ getRefNameColor(refName: string): string | undefined; /**
234
+ * #property
235
+ */
236
+ isValidRefName(refName: string): boolean;
237
+ } & {
238
+ setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
239
+ setError(e: unknown): void;
240
+ setRegions(regions: import("@jbrowse/core/util").Region[]): void;
241
+ setRefNameAliases(aliases: {
242
+ [x: string]: string | undefined;
243
+ }, lcAliases: {
244
+ [x: string]: string | undefined;
245
+ }): void;
246
+ setCytobands(cytobands: Feature[]): void;
247
+ setLoadingP(p?: Promise<void> | undefined): void;
248
+ load(): Promise<void>;
249
+ loadPre(): Promise<void>;
250
+ } & {
251
+ getAdapterMapEntry(adapterConf: {
252
+ [x: string]: unknown;
253
+ }, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
254
+ getRefNameMapForAdapter(adapterConf: {
255
+ [x: string]: unknown;
256
+ }, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
257
+ [x: string]: string | undefined;
258
+ }>;
259
+ getReverseRefNameMapForAdapter(adapterConf: {
260
+ [x: string]: unknown;
261
+ }, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
262
+ [x: string]: string | undefined;
263
+ }>;
264
+ } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
265
+ configuration: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
266
+ }, {
267
+ error: unknown;
268
+ loaded: boolean;
269
+ loadingP: Promise<void> | undefined;
270
+ volatileRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
271
+ refNameAliases: {
272
+ [x: string]: string | undefined;
273
+ } | undefined;
274
+ lowerCaseRefNameAliases: {
275
+ [x: string]: string | undefined;
276
+ } | undefined;
277
+ cytobands: Feature[] | undefined;
278
+ } & {
279
+ getConf(arg: string): any;
280
+ } & {
281
+ readonly initialized: boolean;
282
+ readonly name: string;
283
+ readonly regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
284
+ readonly aliases: string[];
285
+ readonly displayName: string | undefined;
286
+ hasName(name: string): boolean;
287
+ readonly allAliases: string[];
288
+ readonly allRefNames: string[] | undefined;
289
+ readonly lowerCaseRefNames: string[] | undefined;
290
+ readonly allRefNamesWithLowerCase: string[] | undefined;
291
+ readonly rpcManager: import("@jbrowse/core/rpc/RpcManager").default;
292
+ readonly refNameColors: string[];
293
+ } & {
294
+ readonly refNames: string[] | undefined;
295
+ } & {
296
+ getCanonicalRefName(refName: string): string | undefined;
297
+ getRefNameColor(refName: string): string | undefined; /**
298
+ * #property
299
+ */
300
+ isValidRefName(refName: string): boolean;
301
+ } & {
302
+ setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
303
+ setError(e: unknown): void;
304
+ setRegions(regions: import("@jbrowse/core/util").Region[]): void;
305
+ setRefNameAliases(aliases: {
306
+ [x: string]: string | undefined;
307
+ }, lcAliases: {
308
+ [x: string]: string | undefined;
309
+ }): void;
310
+ setCytobands(cytobands: Feature[]): void;
311
+ setLoadingP(p?: Promise<void> | undefined): void;
312
+ load(): Promise<void>;
313
+ loadPre(): Promise<void>;
314
+ } & {
315
+ getAdapterMapEntry(adapterConf: {
316
+ [x: string]: unknown;
317
+ }, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
318
+ getRefNameMapForAdapter(adapterConf: {
319
+ [x: string]: unknown;
320
+ }, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
321
+ [x: string]: string | undefined;
322
+ }>;
323
+ getReverseRefNameMapForAdapter(adapterConf: {
324
+ [x: string]: unknown;
325
+ }, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
326
+ [x: string]: string | undefined;
327
+ }>;
328
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
329
+ }): Promise<void>;
192
330
  navToLocations(parsedLocStrings: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string | undefined): Promise<void>;
193
331
  navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation): void;
194
332
  navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation[]): void;
@@ -61,6 +61,8 @@ async function getBlockFeatures(model, track) {
61
61
  }
62
62
  /**
63
63
  * #stateModel BreakpointSplitView
64
+ * extends
65
+ * - [BaseViewModel](../baseviewmodel)
64
66
  */
65
67
  function stateModelFactory(pluginManager) {
66
68
  const minHeight = 40;
@@ -5,35 +5,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.renderToSvg = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
- const server_1 = require("react-dom/server");
9
8
  const mobx_1 = require("mobx");
10
9
  const util_1 = require("@jbrowse/core/util");
11
10
  const material_1 = require("@mui/material");
12
11
  const ui_1 = require("@jbrowse/core/ui");
13
- // locals
12
+ const mobx_state_tree_1 = require("mobx-state-tree");
14
13
  const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
15
14
  // locals
16
15
  const SVGBackground_1 = __importDefault(require("./SVGBackground"));
17
- const tracks_1 = require("@jbrowse/core/util/tracks");
18
16
  const Overlay_1 = __importDefault(require("../components/Overlay"));
19
- function getTrackNameMaxLen(views, fontSize, session) {
20
- return (0, util_1.max)(views.flatMap(view => view.tracks.map(t => (0, util_1.measureText)((0, tracks_1.getTrackName)(t.configuration, session), fontSize))), 0);
21
- }
22
- function getTrackOffsets(view, textOffset, extra = 0) {
23
- const offsets = {};
24
- let curr = textOffset;
25
- for (const track of view.tracks) {
26
- offsets[track.configuration.trackId] = curr + extra;
27
- curr += track.displays[0].height + textOffset;
28
- }
29
- return offsets;
30
- }
17
+ const util_2 = require("./util");
31
18
  // render LGV to SVG
32
19
  async function renderToSvg(model, opts) {
33
20
  var _a;
34
- const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset',
21
+ const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children), themeName = 'default', } = opts;
35
22
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- Wrapper = ({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children), themeName = 'default', } = opts;
23
+ const { createRootFn } = (0, mobx_state_tree_1.getRoot)(model);
37
24
  const session = (0, util_1.getSession)(model);
38
25
  const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
39
26
  const { width, views } = model;
@@ -49,17 +36,17 @@ async function renderToSvg(model, opts) {
49
36
  return { track, result: await d.renderSvg({ ...opts, theme }) };
50
37
  })),
51
38
  })));
52
- const trackLabelMaxLen = getTrackNameMaxLen(views, fontSize, session) + 40;
39
+ const trackLabelMaxLen = (0, util_2.getTrackNameMaxLen)(views, fontSize, session) + 40;
53
40
  const trackLabelOffset = trackLabels === 'left' ? trackLabelMaxLen : 0;
54
41
  const textOffset = trackLabels === 'offset' ? textHeight : 0;
55
42
  const trackOffsets = [
56
- getTrackOffsets(views[0], textOffset, fontSize + offset),
57
- getTrackOffsets(views[1], textOffset, fontSize + heights[0] + offset),
43
+ (0, util_2.getTrackOffsets)(views[0], textOffset, fontSize + offset),
44
+ (0, util_2.getTrackOffsets)(views[1], textOffset, fontSize + heights[0] + offset),
58
45
  ];
59
46
  const w = width + trackLabelOffset;
60
47
  const t = (0, ui_1.createJBrowseTheme)(theme);
61
48
  // the xlink namespace is used for rendering <image> tag
62
- return (0, server_1.renderToStaticMarkup)(react_1.default.createElement(material_1.ThemeProvider, { theme: t },
49
+ return (0, util_1.renderToStaticMarkup)(react_1.default.createElement(material_1.ThemeProvider, { theme: t },
63
50
  react_1.default.createElement(Wrapper, null,
64
51
  react_1.default.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() },
65
52
  react_1.default.createElement(SVGBackground_1.default, { width: w, height: totalHeightSvg, shift: shift }),
@@ -76,6 +63,6 @@ async function renderToSvg(model, opts) {
76
63
  react_1.default.createElement("defs", null,
77
64
  react_1.default.createElement("clipPath", { id: "clip-bsv" },
78
65
  react_1.default.createElement("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }))),
79
- react_1.default.createElement("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)" }, model.matchedTracks.map(track => (react_1.default.createElement(Overlay_1.default, { parentRef: { current: null }, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }))))))));
66
+ react_1.default.createElement("g", { transform: `translate(${trackLabelOffset + shift})`, clipPath: "url(#clip-bsv)" }, model.matchedTracks.map(track => (react_1.default.createElement(Overlay_1.default, { parentRef: { current: null }, key: track.configuration.trackId, model: model, trackId: track.configuration.trackId, getTrackYPosOverride: (id, level) => trackOffsets[level][id] }))))))), createRootFn);
80
67
  }
81
68
  exports.renderToSvg = renderToSvg;
@@ -0,0 +1,4 @@
1
+ import { AbstractSessionModel } from '@jbrowse/core/util';
2
+ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
+ export declare function getTrackNameMaxLen(views: LinearGenomeViewModel[], fontSize: number, session: AbstractSessionModel): number;
4
+ export declare function getTrackOffsets(view: LinearGenomeViewModel, textOffset: number, extra?: number): Record<string, number>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTrackOffsets = exports.getTrackNameMaxLen = void 0;
4
+ const util_1 = require("@jbrowse/core/util");
5
+ // locals
6
+ const tracks_1 = require("@jbrowse/core/util/tracks");
7
+ function getTrackNameMaxLen(views, fontSize, session) {
8
+ return (0, util_1.max)(views.flatMap(view => view.tracks.map(t => (0, util_1.measureText)((0, tracks_1.getTrackName)(t.configuration, session), fontSize))), 0);
9
+ }
10
+ exports.getTrackNameMaxLen = getTrackNameMaxLen;
11
+ function getTrackOffsets(view, textOffset, extra = 0) {
12
+ const offsets = {};
13
+ let curr = textOffset;
14
+ for (const track of view.tracks) {
15
+ offsets[track.configuration.trackId] = curr + extra;
16
+ curr += track.displays[0].height + textOffset;
17
+ }
18
+ return offsets;
19
+ }
20
+ exports.getTrackOffsets = getTrackOffsets;
@@ -57,26 +57,26 @@ const Breakends = observer(function ({ model, trackId, parentRef: ref, getTrackY
57
57
  }
58
58
  else {
59
59
  const path = [
60
- 'M',
60
+ 'M', // move to
61
61
  x1 -
62
62
  20 *
63
63
  (relevantAlt.Join === 'left' ? -1 : 1) *
64
64
  (reversed1 ? -1 : 1),
65
65
  y1,
66
- 'L',
66
+ 'L', // line to
67
67
  x1,
68
68
  y1,
69
- 'L',
69
+ 'L', // line to
70
70
  x2,
71
71
  y2,
72
- 'L',
72
+ 'L', // line to
73
73
  x2 -
74
74
  20 *
75
75
  (relevantAlt.MateDirection === 'left' ? 1 : -1) *
76
76
  (reversed2 ? -1 : 1),
77
77
  y2,
78
78
  ].join(' ');
79
- ret.push(React.createElement("path", { d: path, key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
79
+ ret.push(React.createElement("path", { d: path, "data-testid": "r2", key: JSON.stringify(path), strokeWidth: id === mouseoverElt ? 10 : 5, onClick: () => {
80
80
  var _a, _b, _c;
81
81
  const featureWidget = (_a = session.addWidget) === null || _a === void 0 ? void 0 : _a.call(session, 'VariantFeatureWidget', 'variantFeature', {
82
82
  featureData: (_b = totalFeatures.get(id)) === null || _b === void 0 ? void 0 : _b.toJSON(),
@@ -58,16 +58,16 @@ const Translocations = observer(function ({ model, trackId, parentRef: ref, getT
58
58
  const y2 = yPos(trackId, level2, views, tracks, c2, getTrackYPosOverride) -
59
59
  yOffset;
60
60
  const path = [
61
- 'M',
61
+ 'M', // move to
62
62
  x1 - 20 * (myDirection === '+' ? 1 : -1) * (reversed1 ? -1 : 1),
63
63
  y1,
64
- 'L',
64
+ 'L', // line to
65
65
  x1,
66
66
  y1,
67
- 'L',
67
+ 'L', // line to
68
68
  x2,
69
69
  y2,
70
- 'L',
70
+ 'L', // line to
71
71
  x2 - 20 * (mateDirection === '+' ? 1 : -1) * (reversed2 ? -1 : 1),
72
72
  y2,
73
73
  ].join(' ');
@@ -6,7 +6,9 @@ import { Feature } from '@jbrowse/core/util';
6
6
  export interface ExportSvgOptions {
7
7
  rasterizeLayers?: boolean;
8
8
  filename?: string;
9
- Wrapper?: React.FC<any>;
9
+ Wrapper?: React.FC<{
10
+ children: React.ReactNode;
11
+ }>;
10
12
  fontSize?: number;
11
13
  rulerHeight?: number;
12
14
  textHeight?: number;
@@ -26,6 +28,8 @@ export interface Breakend {
26
28
  export type LayoutRecord = [number, number, number, number];
27
29
  /**
28
30
  * #stateModel BreakpointSplitView
31
+ * extends
32
+ * - [BaseViewModel](../baseviewmodel)
29
33
  */
30
34
  export default function stateModelFactory(pluginManager: PluginManager): import("mobx-state-tree").IModelType<{
31
35
  id: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").ISimpleType<string>, [undefined]>;
@@ -84,7 +88,9 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
84
88
  trackRefs: Record<string, HTMLDivElement>;
85
89
  coarseDynamicBlocks: import("@jbrowse/core/util/blockTypes").BaseBlock[];
86
90
  coarseTotalBp: number;
87
- leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
91
+ leftOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined; /**
92
+ * #action
93
+ */
88
94
  rightOffset: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined;
89
95
  } & {
90
96
  readonly trackLabelsSetting: any;
@@ -139,7 +145,7 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
139
145
  } & {
140
146
  moveTrack(movingId: string, targetId: string): void;
141
147
  closeView(): void;
142
- toggleTrack(trackId: string): void;
148
+ toggleTrack(trackId: string): boolean;
143
149
  setTrackLabels(setting: "hidden" | "offset" | "overlapping"): void;
144
150
  toggleCenterLine(): void;
145
151
  setDisplayedRegions(regions: import("@jbrowse/core/util").Region[]): void;
@@ -189,6 +195,138 @@ export default function stateModelFactory(pluginManager: PluginManager): import(
189
195
  } & {
190
196
  moveTo(start?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined, end?: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").BpOffset | undefined): void;
191
197
  navToLocString(input: string, optAssemblyName?: string | undefined): Promise<void>;
198
+ navToSearchString({ input, assembly, }: {
199
+ input: string;
200
+ assembly: {
201
+ configuration: any;
202
+ } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
203
+ error: unknown;
204
+ loaded: boolean;
205
+ loadingP: Promise<void> | undefined;
206
+ volatileRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
207
+ refNameAliases: {
208
+ [x: string]: string | undefined;
209
+ } | undefined;
210
+ lowerCaseRefNameAliases: {
211
+ [x: string]: string | undefined;
212
+ } | undefined;
213
+ cytobands: Feature[] | undefined;
214
+ } & {
215
+ getConf(arg: string): any;
216
+ } & {
217
+ readonly initialized: boolean;
218
+ readonly name: string;
219
+ readonly regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
220
+ readonly aliases: string[];
221
+ readonly displayName: string | undefined;
222
+ hasName(name: string): boolean;
223
+ readonly allAliases: string[];
224
+ readonly allRefNames: string[] | undefined;
225
+ readonly lowerCaseRefNames: string[] | undefined;
226
+ readonly allRefNamesWithLowerCase: string[] | undefined;
227
+ readonly rpcManager: import("@jbrowse/core/rpc/RpcManager").default;
228
+ readonly refNameColors: string[];
229
+ } & {
230
+ readonly refNames: string[] | undefined;
231
+ } & {
232
+ getCanonicalRefName(refName: string): string | undefined;
233
+ getRefNameColor(refName: string): string | undefined; /**
234
+ * #property
235
+ */
236
+ isValidRefName(refName: string): boolean;
237
+ } & {
238
+ setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
239
+ setError(e: unknown): void;
240
+ setRegions(regions: import("@jbrowse/core/util").Region[]): void;
241
+ setRefNameAliases(aliases: {
242
+ [x: string]: string | undefined;
243
+ }, lcAliases: {
244
+ [x: string]: string | undefined;
245
+ }): void;
246
+ setCytobands(cytobands: Feature[]): void;
247
+ setLoadingP(p?: Promise<void> | undefined): void;
248
+ load(): Promise<void>;
249
+ loadPre(): Promise<void>;
250
+ } & {
251
+ getAdapterMapEntry(adapterConf: {
252
+ [x: string]: unknown;
253
+ }, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
254
+ getRefNameMapForAdapter(adapterConf: {
255
+ [x: string]: unknown;
256
+ }, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
257
+ [x: string]: string | undefined;
258
+ }>;
259
+ getReverseRefNameMapForAdapter(adapterConf: {
260
+ [x: string]: unknown;
261
+ }, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
262
+ [x: string]: string | undefined;
263
+ }>;
264
+ } & import("mobx-state-tree").IStateTreeNode<import("mobx-state-tree").IModelType<{
265
+ configuration: import("mobx-state-tree").IMaybe<import("mobx-state-tree").IReferenceType<import("mobx-state-tree").IAnyType>>;
266
+ }, {
267
+ error: unknown;
268
+ loaded: boolean;
269
+ loadingP: Promise<void> | undefined;
270
+ volatileRegions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
271
+ refNameAliases: {
272
+ [x: string]: string | undefined;
273
+ } | undefined;
274
+ lowerCaseRefNameAliases: {
275
+ [x: string]: string | undefined;
276
+ } | undefined;
277
+ cytobands: Feature[] | undefined;
278
+ } & {
279
+ getConf(arg: string): any;
280
+ } & {
281
+ readonly initialized: boolean;
282
+ readonly name: string;
283
+ readonly regions: import("@jbrowse/core/assemblyManager/assembly").BasicRegion[] | undefined;
284
+ readonly aliases: string[];
285
+ readonly displayName: string | undefined;
286
+ hasName(name: string): boolean;
287
+ readonly allAliases: string[];
288
+ readonly allRefNames: string[] | undefined;
289
+ readonly lowerCaseRefNames: string[] | undefined;
290
+ readonly allRefNamesWithLowerCase: string[] | undefined;
291
+ readonly rpcManager: import("@jbrowse/core/rpc/RpcManager").default;
292
+ readonly refNameColors: string[];
293
+ } & {
294
+ readonly refNames: string[] | undefined;
295
+ } & {
296
+ getCanonicalRefName(refName: string): string | undefined;
297
+ getRefNameColor(refName: string): string | undefined; /**
298
+ * #property
299
+ */
300
+ isValidRefName(refName: string): boolean;
301
+ } & {
302
+ setLoaded({ adapterRegionsWithAssembly, refNameAliases, lowerCaseRefNameAliases, cytobands, }: import("@jbrowse/core/assemblyManager/assembly").Loading): void;
303
+ setError(e: unknown): void;
304
+ setRegions(regions: import("@jbrowse/core/util").Region[]): void;
305
+ setRefNameAliases(aliases: {
306
+ [x: string]: string | undefined;
307
+ }, lcAliases: {
308
+ [x: string]: string | undefined;
309
+ }): void;
310
+ setCytobands(cytobands: Feature[]): void;
311
+ setLoadingP(p?: Promise<void> | undefined): void;
312
+ load(): Promise<void>;
313
+ loadPre(): Promise<void>;
314
+ } & {
315
+ getAdapterMapEntry(adapterConf: {
316
+ [x: string]: unknown;
317
+ }, options: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<import("@jbrowse/core/assemblyManager/assembly").RefNameMap>;
318
+ getRefNameMapForAdapter(adapterConf: {
319
+ [x: string]: unknown;
320
+ }, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
321
+ [x: string]: string | undefined;
322
+ }>;
323
+ getReverseRefNameMapForAdapter(adapterConf: {
324
+ [x: string]: unknown;
325
+ }, opts: import("@jbrowse/core/data_adapters/BaseAdapter").BaseOptions): Promise<{
326
+ [x: string]: string | undefined;
327
+ }>;
328
+ }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
329
+ }): Promise<void>;
192
330
  navToLocations(parsedLocStrings: import("@jbrowse/core/util").ParsedLocString[], assemblyName?: string | undefined): Promise<void>;
193
331
  navTo(query: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation): void;
194
332
  navToMultiple(locations: import("@jbrowse/plugin-linear-genome-view/src/LinearGenomeView").NavLocation[]): void;
@@ -33,6 +33,8 @@ async function getBlockFeatures(model, track) {
33
33
  }
34
34
  /**
35
35
  * #stateModel BreakpointSplitView
36
+ * extends
37
+ * - [BaseViewModel](../baseviewmodel)
36
38
  */
37
39
  export default function stateModelFactory(pluginManager) {
38
40
  const minHeight = 40;
@@ -1,33 +1,20 @@
1
1
  import React from 'react';
2
- import { renderToStaticMarkup } from 'react-dom/server';
3
2
  import { when } from 'mobx';
4
- import { getSession, max, measureText, sum, } from '@jbrowse/core/util';
3
+ import { getSession, renderToStaticMarkup, sum } from '@jbrowse/core/util';
5
4
  import { ThemeProvider } from '@mui/material';
6
5
  import { createJBrowseTheme } from '@jbrowse/core/ui';
7
- // locals
6
+ import { getRoot } from 'mobx-state-tree';
8
7
  import { SVGTracks, SVGRuler, totalHeight, } from '@jbrowse/plugin-linear-genome-view';
9
8
  // locals
10
9
  import SVGBackground from './SVGBackground';
11
- import { getTrackName } from '@jbrowse/core/util/tracks';
12
10
  import Overlay from '../components/Overlay';
13
- function getTrackNameMaxLen(views, fontSize, session) {
14
- return max(views.flatMap(view => view.tracks.map(t => measureText(getTrackName(t.configuration, session), fontSize))), 0);
15
- }
16
- function getTrackOffsets(view, textOffset, extra = 0) {
17
- const offsets = {};
18
- let curr = textOffset;
19
- for (const track of view.tracks) {
20
- offsets[track.configuration.trackId] = curr + extra;
21
- curr += track.displays[0].height + textOffset;
22
- }
23
- return offsets;
24
- }
11
+ import { getTrackNameMaxLen, getTrackOffsets } from './util';
25
12
  // render LGV to SVG
26
13
  export async function renderToSvg(model, opts) {
27
14
  var _a;
28
- const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset',
15
+ const { textHeight = 18, headerHeight = 30, rulerHeight = 30, fontSize = 13, trackLabels = 'offset', Wrapper = ({ children }) => React.createElement(React.Fragment, null, children), themeName = 'default', } = opts;
29
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
- Wrapper = ({ children }) => React.createElement(React.Fragment, null, children), themeName = 'default', } = opts;
17
+ const { createRootFn } = getRoot(model);
31
18
  const session = getSession(model);
32
19
  const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
33
20
  const { width, views } = model;
@@ -70,5 +57,5 @@ export async function renderToSvg(model, opts) {
70
57
  React.createElement("defs", null,
71
58
  React.createElement("clipPath", { id: "clip-bsv" },
72
59
  React.createElement("rect", { x: 0, y: 0, width: width, height: totalHeightSvg }))),
73
- 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] }))))))));
60
+ 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);
74
61
  }
@@ -0,0 +1,4 @@
1
+ import { AbstractSessionModel } from '@jbrowse/core/util';
2
+ import { LinearGenomeViewModel } from '@jbrowse/plugin-linear-genome-view';
3
+ export declare function getTrackNameMaxLen(views: LinearGenomeViewModel[], fontSize: number, session: AbstractSessionModel): number;
4
+ export declare function getTrackOffsets(view: LinearGenomeViewModel, textOffset: number, extra?: number): Record<string, number>;
@@ -0,0 +1,15 @@
1
+ import { max, measureText } from '@jbrowse/core/util';
2
+ // locals
3
+ import { getTrackName } from '@jbrowse/core/util/tracks';
4
+ export function getTrackNameMaxLen(views, fontSize, session) {
5
+ return max(views.flatMap(view => view.tracks.map(t => measureText(getTrackName(t.configuration, session), fontSize))), 0);
6
+ }
7
+ export function getTrackOffsets(view, textOffset, extra = 0) {
8
+ const offsets = {};
9
+ let curr = textOffset;
10
+ for (const track of view.tracks) {
11
+ offsets[track.configuration.trackId] = curr + extra;
12
+ curr += track.displays[0].height + textOffset;
13
+ }
14
+ return offsets;
15
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-breakpoint-split-view",
3
- "version": "2.8.0",
3
+ "version": "2.10.0",
4
4
  "description": "JBrowse 2 breakpoint detail split view",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -58,5 +58,5 @@
58
58
  "publishConfig": {
59
59
  "access": "public"
60
60
  },
61
- "gitHead": "ee8c2bdc8bd4f1a70b1eefda984f04a2830d9ca0"
61
+ "gitHead": "223d8bfb68fd1bacaf22852639ad5920f1b7f43b"
62
62
  }