react-msaview 9.1.1 → 9.3.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.
- package/bundle/index.js +79 -79
- package/bundle/index.js.map +4 -4
- package/dist/components/DragHandle.js +2 -1
- package/dist/components/DragHandle.js.map +1 -1
- package/dist/components/MSAViewer.d.ts +31 -19
- package/dist/components/MSAViewer.js +2 -1
- package/dist/components/MSAViewer.js.map +1 -1
- package/dist/components/Track.js +2 -5
- package/dist/components/Track.js.map +1 -1
- package/dist/components/VerticalScrollbar.js +1 -1
- package/dist/components/VerticalScrollbar.js.map +1 -1
- package/dist/components/header/Header.js +2 -1
- package/dist/components/header/Header.js.map +1 -1
- package/dist/components/minimap/Minimap.js +1 -1
- package/dist/components/minimap/Minimap.js.map +1 -1
- package/dist/components/msa/MSACanvas.js +16 -27
- package/dist/components/msa/MSACanvas.js.map +1 -1
- package/dist/components/rowpanels/RowPanels.js +8 -6
- package/dist/components/rowpanels/RowPanels.js.map +1 -1
- package/dist/components/settings/SettingsPanel.js +2 -1
- package/dist/components/settings/SettingsPanel.js.map +1 -1
- package/dist/components/settings/TrackList.js +8 -5
- package/dist/components/settings/TrackList.js.map +1 -1
- package/dist/components/tracks/TrackTooltipContent.js +2 -1
- package/dist/components/tracks/TrackTooltipContent.js.map +1 -1
- package/dist/components/tracks/drawTracks.js +13 -6
- package/dist/components/tracks/drawTracks.js.map +1 -1
- package/dist/components/tree/TreeCanvas.js +8 -6
- package/dist/components/tree/TreeCanvas.js.map +1 -1
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +2 -0
- package/dist/constants.js.map +1 -1
- package/dist/element.d.ts +11 -7
- package/dist/element.js +46 -8
- package/dist/element.js.map +1 -1
- package/dist/featurePanels.d.ts +0 -7
- package/dist/featurePanels.js +1 -16
- package/dist/featurePanels.js.map +1 -1
- package/dist/ggplotPalettes.js +12 -1
- package/dist/ggplotPalettes.js.map +1 -1
- package/dist/groupKeys.d.ts +6 -0
- package/dist/groupKeys.js +52 -0
- package/dist/groupKeys.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/model.d.ts +40 -17
- package/dist/model.js +123 -54
- package/dist/model.js.map +1 -1
- package/dist/scales.d.ts +114 -13
- package/dist/scales.js +154 -19
- package/dist/scales.js.map +1 -1
- package/dist/svgTestUtil.d.ts +22 -12
- package/dist/types.d.ts +30 -28
- package/dist/useDragScroll.d.ts +4 -3
- package/dist/useDragScroll.js +9 -6
- package/dist/useDragScroll.js.map +1 -1
- package/dist/useWheelScroll.d.ts +26 -8
- package/dist/useWheelScroll.js +108 -71
- package/dist/useWheelScroll.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/viewerSnapshot.js +2 -1
- package/dist/viewerSnapshot.js.map +1 -1
- package/package.json +3 -3
- package/src/components/DragHandle.tsx +2 -1
- package/src/components/MSAViewer.tsx +11 -8
- package/src/components/Track.tsx +2 -8
- package/src/components/VerticalScrollbar.tsx +1 -1
- package/src/components/header/Header.tsx +2 -1
- package/src/components/minimap/Minimap.tsx +1 -1
- package/src/components/msa/MSACanvas.tsx +14 -35
- package/src/components/rowpanels/RowPanels.tsx +8 -10
- package/src/components/settings/SettingsPanel.tsx +2 -1
- package/src/components/settings/TrackList.tsx +9 -4
- package/src/components/tracks/TrackTooltipContent.tsx +2 -1
- package/src/components/tracks/drawTracks.ts +15 -7
- package/src/components/tree/TreeCanvas.tsx +8 -10
- package/src/constants.ts +2 -0
- package/src/element.ts +53 -8
- package/src/featurePanels.ts +1 -25
- package/src/ggplotPalettes.ts +13 -1
- package/src/groupKeys.ts +54 -0
- package/src/index.ts +13 -2
- package/src/model.ts +174 -72
- package/src/scales.ts +268 -25
- package/src/types.ts +29 -26
- package/src/useDragScroll.ts +11 -8
- package/src/useWheelScroll.ts +124 -84
- package/src/version.ts +1 -1
- package/src/viewerSnapshot.ts +3 -1
package/dist/scales.js
CHANGED
|
@@ -1,30 +1,165 @@
|
|
|
1
|
+
import { colord } from 'colord';
|
|
1
2
|
import { createPaletteMap } from './createPaletteMap.js';
|
|
2
3
|
import { paletteNamed } from './ggplotPalettes.js';
|
|
4
|
+
import { compareGroupKeys } from './groupKeys.js';
|
|
3
5
|
/**
|
|
4
|
-
* The
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* The colors a `range` lists, read the way jbrowse-components'
|
|
7
|
+
* `paletteFromSpec` reads a string: a palette name gives undefined here, and a
|
|
8
|
+
* comma-separated list of colors gives the list
|
|
9
|
+
*/
|
|
10
|
+
function rangeList(range) {
|
|
11
|
+
if (typeof range !== 'string') {
|
|
12
|
+
return range;
|
|
13
|
+
}
|
|
14
|
+
if (paletteNamed(range)) {
|
|
15
|
+
return undefined;
|
|
16
|
+
}
|
|
17
|
+
const colors = range.split(/,(?![^(]*\))/).map(c => c.trim());
|
|
18
|
+
return colors.every(c => colord(c).isValid()) ? colors : undefined;
|
|
19
|
+
}
|
|
20
|
+
function rangeColors(range, order) {
|
|
21
|
+
const list = rangeList(range);
|
|
22
|
+
return list
|
|
23
|
+
? new Map(order.slice(0, list.length).map((value, i) => [value, list[i]]))
|
|
24
|
+
: new Map(Object.entries(createPaletteMap(order, paletteNamed(typeof range === 'string' ? range : undefined))));
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The scale a channel reads its field through. `values` are the field's
|
|
28
|
+
* values, in any order and with repeats. The domain lists the values `domain`
|
|
29
|
+
* names first, then the rest in natural order, so a value keeps its color when
|
|
30
|
+
* rows are re-ordered, collapsed or filtered.
|
|
7
31
|
*
|
|
8
|
-
* `
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
32
|
+
* A palette name, or no `range` at all, colors every value: past the end of
|
|
33
|
+
* the palette each takes an evenly spaced hue. A list of colors leaves the
|
|
34
|
+
* values past its end uncolored, so `{domain, range}` colors the values it
|
|
35
|
+
* names and no others.
|
|
12
36
|
*/
|
|
13
37
|
export function resolveScale(spec, values) {
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
38
|
+
const present = new Set(values);
|
|
39
|
+
const listed = new Set(spec?.domain);
|
|
40
|
+
const order = [
|
|
41
|
+
...listed,
|
|
42
|
+
...[...present].filter(v => !listed.has(v)).sort(compareGroupKeys),
|
|
43
|
+
];
|
|
44
|
+
const colors = rangeColors(spec?.range, order);
|
|
19
45
|
return {
|
|
20
46
|
kind: 'categorical',
|
|
21
|
-
colorOf: (value) => colors
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
id: value,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
47
|
+
colorOf: (value) => colors.get(value),
|
|
48
|
+
legend: order
|
|
49
|
+
.filter(value => present.has(value) && colors.has(value))
|
|
50
|
+
.map(value => ({ id: value, label: value, color: colors.get(value) })),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The key records share a scale under: the table and the members as declared,
|
|
55
|
+
* with `title` standing in for the field. Two strips over one palette with no
|
|
56
|
+
* title read two fields and list two legends; naming one title gives them one
|
|
57
|
+
* scale and one legend.
|
|
58
|
+
*/
|
|
59
|
+
export function declarationKey({ spec, field, table, }) {
|
|
60
|
+
const { scale = 'categorical', domain, range, title = field } = spec;
|
|
61
|
+
return JSON.stringify([table, scale, domain, range, title]);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Resolves each declaration once over the union of its records' values, so a
|
|
65
|
+
* value two fields share takes one color in both
|
|
66
|
+
*/
|
|
67
|
+
export function resolveShared(uses) {
|
|
68
|
+
const groups = new Map();
|
|
69
|
+
for (const use of uses) {
|
|
70
|
+
const key = declarationKey(use);
|
|
71
|
+
groups.set(key, [...(groups.get(key) ?? []), use]);
|
|
72
|
+
}
|
|
73
|
+
return new Map([...groups].map(([key, group]) => {
|
|
74
|
+
const { spec, field } = group[0];
|
|
75
|
+
const resolved = resolveScale(spec, group.flatMap(u => u.values));
|
|
76
|
+
const shown = group[0].shown
|
|
77
|
+
? new Set(group.flatMap(u => u.shown ?? []))
|
|
78
|
+
: undefined;
|
|
79
|
+
const scale = {
|
|
80
|
+
...resolved,
|
|
81
|
+
key,
|
|
82
|
+
title: spec.title ?? field,
|
|
83
|
+
legend: shown
|
|
84
|
+
? resolved.legend.filter(entry => shown.has(entry.id))
|
|
85
|
+
: resolved.legend,
|
|
86
|
+
};
|
|
87
|
+
return [key, scale];
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Lifts the earlier spelling onto the color object: `{palette: p}` reads as
|
|
92
|
+
* `{range: p}`, `{map: m}` as `{domain: keys(m), range: values(m)}`, and a
|
|
93
|
+
* strip's `legend` as `title`. A member written in the new spelling wins.
|
|
94
|
+
*/
|
|
95
|
+
export function readColor(record) {
|
|
96
|
+
const { scale, legend, ...rest } = record;
|
|
97
|
+
if (typeof scale !== 'object' && legend === undefined) {
|
|
98
|
+
return record;
|
|
99
|
+
}
|
|
100
|
+
const lifted = typeof scale !== 'object'
|
|
101
|
+
? scale === undefined
|
|
102
|
+
? {}
|
|
103
|
+
: { scale }
|
|
104
|
+
: scale.map
|
|
105
|
+
? { domain: Object.keys(scale.map), range: Object.values(scale.map) }
|
|
106
|
+
: scale.palette === undefined
|
|
107
|
+
? {}
|
|
108
|
+
: { range: scale.palette };
|
|
109
|
+
return {
|
|
110
|
+
...(legend === undefined ? {} : { title: legend }),
|
|
111
|
+
...lifted,
|
|
112
|
+
...rest,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
export function readEncoding(encoding) {
|
|
116
|
+
return readColor(encoding);
|
|
117
|
+
}
|
|
118
|
+
export function readRowPanel(panel) {
|
|
119
|
+
if (panel.kind === 'strip') {
|
|
120
|
+
return readColor(panel);
|
|
121
|
+
}
|
|
122
|
+
const color = panel.encoding?.color;
|
|
123
|
+
return (color
|
|
124
|
+
? { ...panel, encoding: { ...panel.encoding, color: readColor(color) } }
|
|
125
|
+
: panel);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Lifts a column track's `colors` onto `encoding.color` and its `max` onto
|
|
129
|
+
* `scales.y.domainMax`
|
|
130
|
+
*/
|
|
131
|
+
export function readColumnTrack(track) {
|
|
132
|
+
const { max, colors, ...rest } = track;
|
|
133
|
+
if (max === undefined && colors === undefined) {
|
|
134
|
+
return track;
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
...(colors
|
|
138
|
+
? {
|
|
139
|
+
encoding: {
|
|
140
|
+
color: {
|
|
141
|
+
domain: Object.keys(colors),
|
|
142
|
+
range: Object.values(colors),
|
|
143
|
+
},
|
|
144
|
+
},
|
|
145
|
+
}
|
|
146
|
+
: {}),
|
|
147
|
+
...(max === undefined ? {} : { scales: { y: { domainMax: max } } }),
|
|
148
|
+
...rest,
|
|
28
149
|
};
|
|
29
150
|
}
|
|
151
|
+
/**
|
|
152
|
+
* The color a color object gives each value listed, for a reader that keys
|
|
153
|
+
* colors by value, such as the residue letters of a scheme or a text track
|
|
154
|
+
*/
|
|
155
|
+
export function colorTable(spec, values) {
|
|
156
|
+
return Object.fromEntries(resolveScale(spec, values).legend.map(e => [e.id, e.color]));
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* The letter-to-color table an object `colorScheme` gives, `{domain, range}`
|
|
160
|
+
* or the earlier `{map}`
|
|
161
|
+
*/
|
|
162
|
+
export function letterColors(scheme) {
|
|
163
|
+
return 'map' in scheme ? scheme.map : colorTable(scheme, scheme.domain ?? []);
|
|
164
|
+
}
|
|
30
165
|
//# sourceMappingURL=scales.js.map
|
package/dist/scales.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scales.js","sourceRoot":"","sources":["../src/scales.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|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,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAC5D,CAAA;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,MAAoC;IAC/D,OAAO,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAA;AAC/E,CAAC"}
|
package/dist/svgTestUtil.d.ts
CHANGED
|
@@ -365,7 +365,7 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
365
365
|
showOnly: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
366
366
|
turnedOffTracks: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IMapType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>, [undefined]>;
|
|
367
367
|
trackHeights: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IMapType<import("@jbrowse/mobx-state-tree").ISimpleType<number>>, [undefined]>;
|
|
368
|
-
columnTracks: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").ColumnTrackSpec, import("./types.ts").ColumnTrackSpec, import("./types.ts").ColumnTrackSpec>>, [undefined]>;
|
|
368
|
+
columnTracks: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISnapshotProcessor<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").ColumnTrackSpec, import("./types.ts").ColumnTrackSpec, import("./types.ts").ColumnTrackSpec>, import("./types.ts").ColumnTrackSpec, import("@jbrowse/mobx-state-tree")._NotCustomized>>, [undefined]>;
|
|
369
369
|
residueMappings: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").ResidueMapping, import("./types.ts").ResidueMapping, import("./types.ts").ResidueMapping>>, [undefined]>;
|
|
370
370
|
data: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IModelType<{
|
|
371
371
|
tree: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
@@ -388,8 +388,8 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
388
388
|
selection: import("@jbrowse/mobx-state-tree").IType<import("./types.ts").MsaSelection | undefined, import("./types.ts").MsaSelection | undefined, import("./types.ts").MsaSelection | undefined>;
|
|
389
389
|
region: import("@jbrowse/mobx-state-tree").IType<import("./types.ts").Region | undefined, import("./types.ts").Region | undefined, import("./types.ts").Region | undefined>;
|
|
390
390
|
clades: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").Clade, import("./types.ts").Clade, import("./types.ts").Clade>>, [undefined]>;
|
|
391
|
-
encodings: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").Encoding, import("./types.ts").Encoding, import("./types.ts").Encoding>>, [undefined]>;
|
|
392
|
-
rowPanels: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").RowPanelSpec, import("./types.ts").RowPanelSpec, import("./types.ts").RowPanelSpec>>, [undefined]>;
|
|
391
|
+
encodings: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISnapshotProcessor<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").Encoding, import("./types.ts").Encoding, import("./types.ts").Encoding>, import("./types.ts").Encoding | import("./scales.ts").LegacyEncoding, import("@jbrowse/mobx-state-tree")._NotCustomized>>, [undefined]>;
|
|
392
|
+
rowPanels: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISnapshotProcessor<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").RowPanelSpec, import("./types.ts").RowPanelSpec, import("./types.ts").RowPanelSpec>, import("./scales.ts").LegacyRowPanel | import("./types.ts").RowPanelSpec, import("@jbrowse/mobx-state-tree")._NotCustomized>>, [undefined]>;
|
|
393
393
|
}> & {
|
|
394
394
|
queueOfDialogs: [import("@jbrowse/core/util").DialogComponentType, any][];
|
|
395
395
|
} & {
|
|
@@ -635,6 +635,7 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
635
635
|
readonly adapterTrackModels: import("./types.ts").BasicTrack[];
|
|
636
636
|
readonly basePairTrackModels: import("./types.ts").BasicTrack[];
|
|
637
637
|
readonly computedTrackModels: import("./types.ts").BasicTrack[];
|
|
638
|
+
readonly referenceTrackModels: import("./types.ts").BasicTrack[];
|
|
638
639
|
readonly tracks: import("./types.ts").BasicTrack[];
|
|
639
640
|
readonly turnedOnTracks: import("./types.ts").BasicTrack[];
|
|
640
641
|
readonly showHorizontalScrollbar: boolean;
|
|
@@ -712,10 +713,10 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
712
713
|
applyGFFText(gffText: string): void;
|
|
713
714
|
doScrollX(deltaX: number): void;
|
|
714
715
|
setScrollX(n: number): void;
|
|
715
|
-
setColumnTracks(tracks: import("./types.ts").ColumnTrackSpec[]): void;
|
|
716
|
+
setColumnTracks(tracks: (import("./types.ts").ColumnTrackSpec | import("./scales.ts").LegacyColumnTrack)[]): void;
|
|
716
717
|
setRowData(rowData: import("./types.ts").RowDataInput): void;
|
|
717
|
-
setEncodings(encodings: import("./types.ts").Encoding[]): void;
|
|
718
|
-
setRowPanels(panels: import("./types.ts").RowPanelSpec[]): void;
|
|
718
|
+
setEncodings(encodings: (import("./types.ts").Encoding | import("./scales.ts").LegacyEncoding)[]): void;
|
|
719
|
+
setRowPanels(panels: (import("./types.ts").RowPanelSpec | import("./scales.ts").LegacyRowPanel)[]): void;
|
|
719
720
|
setResidueMappings(mappings: import("./types.ts").ResidueMapping[]): void;
|
|
720
721
|
toggleTrack(id: string): void;
|
|
721
722
|
setTracksShown(ids: string[], shown: boolean): void;
|
|
@@ -774,9 +775,12 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
774
775
|
rowData: Record<string, string> | undefined;
|
|
775
776
|
};
|
|
776
777
|
readonly resolvedEncodings: import("./types.ts").ResolvedEncoding[];
|
|
778
|
+
readonly resolvedScales: Map<string, import("./scales.ts").SharedScale>;
|
|
779
|
+
scaleOf(channel: import("./scales.ts").ColorChannel, table: import("./scales.ts").ScaleTable): import("./scales.ts").SharedScale;
|
|
777
780
|
readonly rowPanelScales: ({
|
|
778
781
|
header: string;
|
|
779
782
|
legend: import("./types.ts").LegendEntry[];
|
|
783
|
+
legendKey?: string;
|
|
780
784
|
legendTitle?: string;
|
|
781
785
|
kind: 'strip';
|
|
782
786
|
field: string;
|
|
@@ -784,6 +788,7 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
784
788
|
} | {
|
|
785
789
|
header: string;
|
|
786
790
|
legend: import("./types.ts").LegendEntry[];
|
|
791
|
+
legendKey?: string;
|
|
787
792
|
legendTitle?: string;
|
|
788
793
|
kind: 'features';
|
|
789
794
|
x: 'column' | 'position';
|
|
@@ -1188,7 +1193,7 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
1188
1193
|
showOnly: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
1189
1194
|
turnedOffTracks: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IMapType<import("@jbrowse/mobx-state-tree").ISimpleType<boolean>>, [undefined]>;
|
|
1190
1195
|
trackHeights: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IMapType<import("@jbrowse/mobx-state-tree").ISimpleType<number>>, [undefined]>;
|
|
1191
|
-
columnTracks: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").ColumnTrackSpec, import("./types.ts").ColumnTrackSpec, import("./types.ts").ColumnTrackSpec>>, [undefined]>;
|
|
1196
|
+
columnTracks: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISnapshotProcessor<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").ColumnTrackSpec, import("./types.ts").ColumnTrackSpec, import("./types.ts").ColumnTrackSpec>, import("./types.ts").ColumnTrackSpec, import("@jbrowse/mobx-state-tree")._NotCustomized>>, [undefined]>;
|
|
1192
1197
|
residueMappings: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").ResidueMapping, import("./types.ts").ResidueMapping, import("./types.ts").ResidueMapping>>, [undefined]>;
|
|
1193
1198
|
data: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IModelType<{
|
|
1194
1199
|
tree: import("@jbrowse/mobx-state-tree").IMaybe<import("@jbrowse/mobx-state-tree").ISimpleType<string>>;
|
|
@@ -1211,8 +1216,8 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
1211
1216
|
selection: import("@jbrowse/mobx-state-tree").IType<import("./types.ts").MsaSelection | undefined, import("./types.ts").MsaSelection | undefined, import("./types.ts").MsaSelection | undefined>;
|
|
1212
1217
|
region: import("@jbrowse/mobx-state-tree").IType<import("./types.ts").Region | undefined, import("./types.ts").Region | undefined, import("./types.ts").Region | undefined>;
|
|
1213
1218
|
clades: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").Clade, import("./types.ts").Clade, import("./types.ts").Clade>>, [undefined]>;
|
|
1214
|
-
encodings: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").Encoding, import("./types.ts").Encoding, import("./types.ts").Encoding>>, [undefined]>;
|
|
1215
|
-
rowPanels: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").RowPanelSpec, import("./types.ts").RowPanelSpec, import("./types.ts").RowPanelSpec>>, [undefined]>;
|
|
1219
|
+
encodings: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISnapshotProcessor<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").Encoding, import("./types.ts").Encoding, import("./types.ts").Encoding>, import("./types.ts").Encoding | import("./scales.ts").LegacyEncoding, import("@jbrowse/mobx-state-tree")._NotCustomized>>, [undefined]>;
|
|
1220
|
+
rowPanels: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IArrayType<import("@jbrowse/mobx-state-tree").ISnapshotProcessor<import("@jbrowse/mobx-state-tree").IType<import("./types.ts").RowPanelSpec, import("./types.ts").RowPanelSpec, import("./types.ts").RowPanelSpec>, import("./scales.ts").LegacyRowPanel | import("./types.ts").RowPanelSpec, import("@jbrowse/mobx-state-tree")._NotCustomized>>, [undefined]>;
|
|
1216
1221
|
}, {
|
|
1217
1222
|
queueOfDialogs: [import("@jbrowse/core/util").DialogComponentType, any][];
|
|
1218
1223
|
} & {
|
|
@@ -1458,6 +1463,7 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
1458
1463
|
readonly adapterTrackModels: import("./types.ts").BasicTrack[];
|
|
1459
1464
|
readonly basePairTrackModels: import("./types.ts").BasicTrack[];
|
|
1460
1465
|
readonly computedTrackModels: import("./types.ts").BasicTrack[];
|
|
1466
|
+
readonly referenceTrackModels: import("./types.ts").BasicTrack[];
|
|
1461
1467
|
readonly tracks: import("./types.ts").BasicTrack[];
|
|
1462
1468
|
readonly turnedOnTracks: import("./types.ts").BasicTrack[];
|
|
1463
1469
|
readonly showHorizontalScrollbar: boolean;
|
|
@@ -1535,10 +1541,10 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
1535
1541
|
applyGFFText(gffText: string): void;
|
|
1536
1542
|
doScrollX(deltaX: number): void;
|
|
1537
1543
|
setScrollX(n: number): void;
|
|
1538
|
-
setColumnTracks(tracks: import("./types.ts").ColumnTrackSpec[]): void;
|
|
1544
|
+
setColumnTracks(tracks: (import("./types.ts").ColumnTrackSpec | import("./scales.ts").LegacyColumnTrack)[]): void;
|
|
1539
1545
|
setRowData(rowData: import("./types.ts").RowDataInput): void;
|
|
1540
|
-
setEncodings(encodings: import("./types.ts").Encoding[]): void;
|
|
1541
|
-
setRowPanels(panels: import("./types.ts").RowPanelSpec[]): void;
|
|
1546
|
+
setEncodings(encodings: (import("./types.ts").Encoding | import("./scales.ts").LegacyEncoding)[]): void;
|
|
1547
|
+
setRowPanels(panels: (import("./types.ts").RowPanelSpec | import("./scales.ts").LegacyRowPanel)[]): void;
|
|
1542
1548
|
setResidueMappings(mappings: import("./types.ts").ResidueMapping[]): void;
|
|
1543
1549
|
toggleTrack(id: string): void;
|
|
1544
1550
|
setTracksShown(ids: string[], shown: boolean): void;
|
|
@@ -1597,9 +1603,12 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
1597
1603
|
rowData: Record<string, string> | undefined;
|
|
1598
1604
|
};
|
|
1599
1605
|
readonly resolvedEncodings: import("./types.ts").ResolvedEncoding[];
|
|
1606
|
+
readonly resolvedScales: Map<string, import("./scales.ts").SharedScale>;
|
|
1607
|
+
scaleOf(channel: import("./scales.ts").ColorChannel, table: import("./scales.ts").ScaleTable): import("./scales.ts").SharedScale;
|
|
1600
1608
|
readonly rowPanelScales: ({
|
|
1601
1609
|
header: string;
|
|
1602
1610
|
legend: import("./types.ts").LegendEntry[];
|
|
1611
|
+
legendKey?: string;
|
|
1603
1612
|
legendTitle?: string;
|
|
1604
1613
|
kind: 'strip';
|
|
1605
1614
|
field: string;
|
|
@@ -1607,6 +1616,7 @@ export declare function createTestModel(snapshot: Omit<Snapshot, 'type'>, width?
|
|
|
1607
1616
|
} | {
|
|
1608
1617
|
header: string;
|
|
1609
1618
|
legend: import("./types.ts").LegendEntry[];
|
|
1619
|
+
legendKey?: string;
|
|
1610
1620
|
legendTitle?: string;
|
|
1611
1621
|
kind: 'features';
|
|
1612
1622
|
x: 'column' | 'position';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ColorChannel, ColorSpec, SharedScale } from './scales.ts';
|
|
2
2
|
import type { Annotation } from 'msa-parsers';
|
|
3
3
|
export interface Accession {
|
|
4
4
|
accession: string;
|
|
5
5
|
name: string;
|
|
6
6
|
description: string;
|
|
7
7
|
}
|
|
8
|
-
export type TrackKind = 'text' | 'bar' | 'logo' | 'arc' | 'ruler';
|
|
8
|
+
export type TrackKind = 'text' | 'bar' | 'logo' | 'arc' | 'ruler' | 'reference';
|
|
9
9
|
/**
|
|
10
10
|
* Which channel the color scheme paints. `fill` colors the cell a residue sits
|
|
11
11
|
* in, `color` colors the letter itself, the same distinction a grammar of
|
|
@@ -13,11 +13,14 @@ export type TrackKind = 'text' | 'bar' | 'logo' | 'arc' | 'ruler';
|
|
|
13
13
|
*/
|
|
14
14
|
export type ResidueEncoding = 'fill' | 'color';
|
|
15
15
|
/**
|
|
16
|
-
* The residue colors: a scheme name from the built-in table, or a
|
|
17
|
-
*
|
|
18
|
-
* uncolored
|
|
16
|
+
* The residue colors: a scheme name from the built-in table, or a color object
|
|
17
|
+
* over residue letters, `{domain: ['K', 'R'], range: ['#1f77b4', '#1f77b4']}`,
|
|
18
|
+
* which leaves every letter it does not list uncolored
|
|
19
19
|
*/
|
|
20
|
-
export type ColorScheme = string |
|
|
20
|
+
export type ColorScheme = string | Pick<ColorSpec, 'domain' | 'range'> | {
|
|
21
|
+
/** @deprecated the earlier spelling of `{domain, range}` */
|
|
22
|
+
map: Record<string, string>;
|
|
23
|
+
};
|
|
21
24
|
export interface BasicTrackModel {
|
|
22
25
|
id: string;
|
|
23
26
|
name: string;
|
|
@@ -56,33 +59,33 @@ export interface ColumnTrackSpec {
|
|
|
56
59
|
values?: number[];
|
|
57
60
|
data?: string;
|
|
58
61
|
arcs?: ArcSpec[];
|
|
59
|
-
max?: number;
|
|
60
62
|
color?: string;
|
|
61
|
-
|
|
63
|
+
encoding?: {
|
|
64
|
+
color?: ColorSpec;
|
|
65
|
+
};
|
|
66
|
+
scales?: {
|
|
67
|
+
y?: {
|
|
68
|
+
domainMax?: number;
|
|
69
|
+
};
|
|
70
|
+
};
|
|
62
71
|
row?: string;
|
|
63
72
|
height?: number;
|
|
64
73
|
}
|
|
65
74
|
/**
|
|
66
|
-
* A strip panel: one cell per row, colored from a `rowData` field through
|
|
67
|
-
*
|
|
68
|
-
* the row height, and `header` labels the column and defaults
|
|
69
|
-
*
|
|
70
|
-
*
|
|
75
|
+
* A strip panel: one cell per row, colored from a `rowData` field through the
|
|
76
|
+
* color object's members, which is ggtree's `gheatmap`. `width` is in pixels
|
|
77
|
+
* and defaults to the row height, and `header` labels the column and defaults
|
|
78
|
+
* to the field. Strips declaring the same members and `title` share one scale
|
|
79
|
+
* and one legend.
|
|
71
80
|
*/
|
|
72
|
-
export interface RowStripSpec {
|
|
81
|
+
export interface RowStripSpec extends ColorChannel {
|
|
73
82
|
kind: 'strip';
|
|
74
|
-
field: string;
|
|
75
|
-
scale?: ScaleSpec;
|
|
76
83
|
width?: number;
|
|
77
84
|
header?: string;
|
|
78
|
-
legend?: string;
|
|
79
85
|
}
|
|
80
86
|
/** the channels a `features` panel reads off the feature table */
|
|
81
87
|
export interface FeatureEncodingSpec {
|
|
82
|
-
color?:
|
|
83
|
-
field: string;
|
|
84
|
-
scale?: ScaleSpec;
|
|
85
|
-
};
|
|
88
|
+
color?: ColorChannel;
|
|
86
89
|
label?: string;
|
|
87
90
|
}
|
|
88
91
|
/**
|
|
@@ -120,7 +123,8 @@ interface ResolvedPanelBase {
|
|
|
120
123
|
width: number;
|
|
121
124
|
offsetX: number;
|
|
122
125
|
legend: LegendEntry[];
|
|
123
|
-
/** the
|
|
126
|
+
/** the scale this panel's entries list under; absent means the domain key */
|
|
127
|
+
legendKey?: string;
|
|
124
128
|
legendTitle?: string;
|
|
125
129
|
}
|
|
126
130
|
/**
|
|
@@ -411,16 +415,14 @@ export type RowDataInput = Record<string, Record<string, string | number | boole
|
|
|
411
415
|
*/
|
|
412
416
|
export type EncodingChannel = 'tipLabel' | 'rowTint' | 'branch' | 'featureFill' | 'featureLabel';
|
|
413
417
|
/**
|
|
414
|
-
* A channel, the field feeding it, and the
|
|
415
|
-
* See docs/layers.md
|
|
418
|
+
* A channel, the field feeding it, and the color object's members it reads
|
|
419
|
+
* that field through. See docs/layers.md
|
|
416
420
|
*/
|
|
417
|
-
export interface Encoding {
|
|
421
|
+
export interface Encoding extends ColorChannel {
|
|
418
422
|
channel: EncodingChannel;
|
|
419
|
-
field: string;
|
|
420
|
-
scale?: ScaleSpec;
|
|
421
423
|
}
|
|
422
424
|
/** an Encoding with its scale resolved against the values in the table */
|
|
423
|
-
export type ResolvedEncoding = Encoding &
|
|
425
|
+
export type ResolvedEncoding = Encoding & SharedScale;
|
|
424
426
|
/** a Highlight resolved to visible column indices and row indices */
|
|
425
427
|
export interface ResolvedHighlight {
|
|
426
428
|
startCol?: number;
|
package/dist/useDragScroll.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Tracks a
|
|
3
|
-
* animation frame. Shared by the horizontal Minimap
|
|
2
|
+
* Tracks a pointer drag along a single axis and reports the scroll delta on
|
|
3
|
+
* each animation frame. Shared by the horizontal Minimap, the VerticalScrollbar
|
|
4
|
+
* and the dividers.
|
|
4
5
|
*
|
|
5
6
|
* `onScroll` is invoked with the pixel delta since drag start and the scroll
|
|
6
7
|
* offset captured when the drag began. Memoize it (useCallback) so the document
|
|
@@ -8,5 +9,5 @@
|
|
|
8
9
|
*/
|
|
9
10
|
export declare function useDragScroll(axis: 'x' | 'y', onScroll: (delta: number, startScroll: number) => void): {
|
|
10
11
|
dragging: boolean;
|
|
11
|
-
startDrag: (event: React.
|
|
12
|
+
startDrag: (event: React.PointerEvent, startScroll: number) => void;
|
|
12
13
|
};
|
package/dist/useDragScroll.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* Tracks a
|
|
4
|
-
* animation frame. Shared by the horizontal Minimap
|
|
3
|
+
* Tracks a pointer drag along a single axis and reports the scroll delta on
|
|
4
|
+
* each animation frame. Shared by the horizontal Minimap, the VerticalScrollbar
|
|
5
|
+
* and the dividers.
|
|
5
6
|
*
|
|
6
7
|
* `onScroll` is invoked with the pixel delta since drag start and the scroll
|
|
7
8
|
* offset captured when the drag began. Memoize it (useCallback) so the document
|
|
@@ -26,11 +27,13 @@ export function useDragScroll(axis, onScroll) {
|
|
|
26
27
|
function onUp() {
|
|
27
28
|
setMouseDown(undefined);
|
|
28
29
|
}
|
|
29
|
-
document.addEventListener('
|
|
30
|
-
document.addEventListener('
|
|
30
|
+
document.addEventListener('pointermove', onMove);
|
|
31
|
+
document.addEventListener('pointerup', onUp);
|
|
32
|
+
document.addEventListener('pointercancel', onUp);
|
|
31
33
|
return () => {
|
|
32
|
-
document.removeEventListener('
|
|
33
|
-
document.removeEventListener('
|
|
34
|
+
document.removeEventListener('pointermove', onMove);
|
|
35
|
+
document.removeEventListener('pointerup', onUp);
|
|
36
|
+
document.removeEventListener('pointercancel', onUp);
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
}, [axis, onScroll, mouseDown]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDragScroll.js","sourceRoot":"","sources":["../src/useDragScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD
|
|
1
|
+
{"version":3,"file":"useDragScroll.js","sourceRoot":"","sources":["../src/useDragScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,IAAe,EACf,QAAsD;IAEtD,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC/B,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,QAAQ,EAGtC,CAAA;IAEJ,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAC5B,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,SAAS,CAAA;YACtD,SAAS,MAAM,CAAC,KAAmB;gBACjC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;oBACvB,SAAS,CAAC,OAAO,GAAG,IAAI,CAAA;oBACxB,qBAAqB,CAAC,GAAG,EAAE;wBACzB,MAAM,MAAM,GAAG,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAA;wBAC3D,QAAQ,CAAC,MAAM,GAAG,WAAW,EAAE,WAAW,CAAC,CAAA;wBAC3C,SAAS,CAAC,OAAO,GAAG,KAAK,CAAA;oBAC3B,CAAC,CAAC,CAAA;gBACJ,CAAC;YACH,CAAC;YACD,SAAS,IAAI;gBACX,YAAY,CAAC,SAAS,CAAC,CAAA;YACzB,CAAC;YACD,QAAQ,CAAC,gBAAgB,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;YAChD,QAAQ,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;YAC5C,QAAQ,CAAC,gBAAgB,CAAC,eAAe,EAAE,IAAI,CAAC,CAAA;YAChD,OAAO,GAAG,EAAE;gBACV,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,MAAM,CAAC,CAAA;gBACnD,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,IAAI,CAAC,CAAA;gBAC/C,QAAQ,CAAC,mBAAmB,CAAC,eAAe,EAAE,IAAI,CAAC,CAAA;YACrD,CAAC,CAAA;QACH,CAAC;IACH,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAA;IAE/B,OAAO;QACL,QAAQ,EAAE,SAAS,KAAK,SAAS;QACjC,SAAS,EAAE,CAAC,KAAyB,EAAE,WAAmB,EAAE,EAAE;YAC5D,YAAY,CAAC;gBACX,MAAM,EAAE,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO;gBACpD,WAAW;aACZ,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/useWheelScroll.d.ts
CHANGED
|
@@ -1,12 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
import type { MsaViewModel } from './model.ts';
|
|
2
|
+
type Axes = 'x' | 'y' | 'xy';
|
|
3
|
+
/**
|
|
4
|
+
* Whether a vertical wheel `delta` moves a view at `scrollY`. At the top or
|
|
5
|
+
* bottom, or when every row fits, the page scrolls instead, so an embedded
|
|
6
|
+
* viewer never traps the reader scrolling past it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function canScrollY(model: MsaViewModel, delta: number): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* The CSS touch-action for a pannable area: the browser keeps a touch pan
|
|
11
|
+
* along every axis the view cannot scroll, and pinch zoom on the page where it
|
|
12
|
+
* supports that value.
|
|
13
|
+
*/
|
|
14
|
+
export declare function panTouchAction(model: MsaViewModel, axes: Axes): string;
|
|
15
|
+
/**
|
|
16
|
+
* Wheel scrolling, wheel zoom and pointer-drag panning of `model` over `ref`,
|
|
17
|
+
* along `axes`. The returned `onPointerDown` starts a pan with a mouse, a pen
|
|
18
|
+
* or a finger; put `touchAction` on the same element.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useWheelScroll({ ref, model, axes, zoom, onWheelScroll, }: {
|
|
2
21
|
ref: React.RefObject<HTMLDivElement | null>;
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
onZoomSettle?: () => void;
|
|
22
|
+
model: MsaViewModel;
|
|
23
|
+
axes: Axes;
|
|
24
|
+
zoom?: boolean;
|
|
7
25
|
onWheelScroll?: (event: WheelEvent) => void;
|
|
8
|
-
scrollZoom?: boolean;
|
|
9
26
|
}): {
|
|
10
|
-
|
|
11
|
-
|
|
27
|
+
onPointerDown: (event: React.PointerEvent) => void;
|
|
28
|
+
touchAction: string;
|
|
12
29
|
};
|
|
30
|
+
export {};
|