react-msaview 7.0.0 → 8.1.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/README.md +11 -10
- package/bundle/index.js +122 -111
- package/bundle/index.js.map +4 -4
- package/dist/calculateBlocks.js +5 -3
- package/dist/calculateBlocks.js.map +1 -1
- package/dist/colorSchemes.js +1 -2
- package/dist/colorSchemes.js.map +1 -1
- package/dist/columnStats.d.ts +28 -0
- package/dist/columnStats.js +34 -0
- package/dist/columnStats.js.map +1 -0
- package/dist/components/DragHandle.d.ts +3 -2
- package/dist/components/DragHandle.js +11 -5
- package/dist/components/DragHandle.js.map +1 -1
- package/dist/components/Loading.js +2 -8
- package/dist/components/Loading.js.map +1 -1
- package/dist/components/MSAView.js +17 -6
- package/dist/components/MSAView.js.map +1 -1
- package/dist/components/MSAViewer.d.ts +64 -7
- package/dist/components/MSAViewer.js +128 -23
- package/dist/components/MSAViewer.js.map +1 -1
- package/dist/components/PortalTooltip.d.ts +11 -0
- package/dist/components/PortalTooltip.js +29 -0
- package/dist/components/PortalTooltip.js.map +1 -0
- package/dist/components/ResizeHandles.js +11 -29
- package/dist/components/ResizeHandles.js.map +1 -1
- package/dist/components/SequenceTextArea.js +3 -4
- package/dist/components/SequenceTextArea.js.map +1 -1
- package/dist/components/Track.js +43 -24
- package/dist/components/Track.js.map +1 -1
- package/dist/components/dialogs/AboutDialog.js +6 -6
- package/dist/components/dialogs/AboutDialog.js.map +1 -1
- package/dist/components/dialogs/AnnotationFileDialog.js +5 -2
- package/dist/components/dialogs/AnnotationFileDialog.js.map +1 -1
- package/dist/components/dialogs/ExportSVGDialog.js +6 -4
- package/dist/components/dialogs/ExportSVGDialog.js.map +1 -1
- package/dist/components/dialogs/FeatureDialog.js +8 -3
- package/dist/components/dialogs/FeatureDialog.js.map +1 -1
- package/dist/components/dialogs/TrackInfoDialog.js +1 -1
- package/dist/components/dialogs/TrackInfoDialog.js.map +1 -1
- package/dist/components/header/GappynessSlider.js +6 -11
- package/dist/components/header/GappynessSlider.js.map +1 -1
- package/dist/components/header/Header.js +4 -1
- package/dist/components/header/Header.js.map +1 -1
- package/dist/components/header/LoadWarnings.js +6 -23
- package/dist/components/header/LoadWarnings.js.map +1 -1
- package/dist/components/header/ScrollZoomIcons.d.ts +6 -0
- package/dist/components/header/ScrollZoomIcons.js +35 -0
- package/dist/components/header/ScrollZoomIcons.js.map +1 -0
- package/dist/components/header/TreeSettingsMenu.js +1 -3
- package/dist/components/header/TreeSettingsMenu.js.map +1 -1
- package/dist/components/header/UnshareableDataWarning.js +2 -4
- package/dist/components/header/UnshareableDataWarning.js.map +1 -1
- package/dist/components/header/ZoomControls.js +49 -6
- package/dist/components/header/ZoomControls.js.map +1 -1
- package/dist/components/header/getAnnotationsMenu.js +3 -6
- package/dist/components/header/getAnnotationsMenu.js.map +1 -1
- package/dist/components/header/settingsMenuItems.js +12 -9
- package/dist/components/header/settingsMenuItems.js.map +1 -1
- package/dist/components/import/ImportForm.js +1 -1
- package/dist/components/import/ImportForm.js.map +1 -1
- package/dist/components/import/util.js +1 -2
- package/dist/components/import/util.js.map +1 -1
- package/dist/components/minimap/Minimap.js +1 -2
- package/dist/components/minimap/Minimap.js.map +1 -1
- package/dist/components/msa/AnnotationLegend.js +27 -19
- package/dist/components/msa/AnnotationLegend.js.map +1 -1
- package/dist/components/msa/MSACanvas.js +2 -4
- package/dist/components/msa/MSACanvas.js.map +1 -1
- package/dist/components/msa/MSACanvasBlock.js +13 -15
- package/dist/components/msa/MSACanvasBlock.js.map +1 -1
- package/dist/components/msa/MSAMouseoverCanvas.js +2 -1
- package/dist/components/msa/MSAMouseoverCanvas.js.map +1 -1
- package/dist/components/msa/domainBandCursor.d.ts +7 -11
- package/dist/components/msa/domainBandCursor.js +7 -11
- package/dist/components/msa/domainBandCursor.js.map +1 -1
- package/dist/components/msa/drawFeatureSpans.d.ts +59 -0
- package/dist/components/msa/drawFeatureSpans.js +113 -0
- package/dist/components/msa/drawFeatureSpans.js.map +1 -0
- package/dist/components/msa/legendRows.d.ts +8 -0
- package/dist/components/msa/legendRows.js +16 -0
- package/dist/components/msa/legendRows.js.map +1 -0
- package/dist/components/msa/msaRaster.d.ts +24 -31
- package/dist/components/msa/msaRaster.js +30 -39
- package/dist/components/msa/msaRaster.js.map +1 -1
- package/dist/components/msa/packDomainLanes.d.ts +20 -0
- package/dist/components/msa/packDomainLanes.js +33 -0
- package/dist/components/msa/packDomainLanes.js.map +1 -0
- package/dist/components/msa/renderBoxFeatureCanvasBlock.d.ts +3 -1
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js +50 -87
- package/dist/components/msa/renderBoxFeatureCanvasBlock.js.map +1 -1
- package/dist/components/msa/renderHighlights.d.ts +15 -13
- package/dist/components/msa/renderHighlights.js +43 -20
- package/dist/components/msa/renderHighlights.js.map +1 -1
- package/dist/components/msa/renderMSABlock.js +12 -12
- package/dist/components/msa/renderMSABlock.js.map +1 -1
- package/dist/components/msa/tileColor.js +4 -7
- package/dist/components/msa/tileColor.js.map +1 -1
- package/dist/components/msa/useMsaBlockMouse.d.ts +5 -3
- package/dist/components/msa/useMsaBlockMouse.js +6 -6
- package/dist/components/msa/useMsaBlockMouse.js.map +1 -1
- package/dist/components/rowpanels/RowPanelBlock.d.ts +9 -0
- package/dist/components/rowpanels/RowPanelBlock.js +86 -0
- package/dist/components/rowpanels/RowPanelBlock.js.map +1 -0
- package/dist/components/rowpanels/RowPanelHeaders.d.ts +12 -0
- package/dist/components/rowpanels/RowPanelHeaders.js +38 -0
- package/dist/components/rowpanels/RowPanelHeaders.js.map +1 -0
- package/dist/components/{msa/ColumnStats.d.ts → rowpanels/RowPanels.d.ts} +2 -2
- package/dist/components/rowpanels/RowPanels.js +32 -0
- package/dist/components/rowpanels/RowPanels.js.map +1 -0
- package/dist/components/rowpanels/headerLayout.d.ts +1 -0
- package/dist/components/rowpanels/headerLayout.js +5 -0
- package/dist/components/rowpanels/headerLayout.js.map +1 -0
- package/dist/components/rowpanels/renderFeaturePanel.d.ts +21 -0
- package/dist/components/rowpanels/renderFeaturePanel.js +37 -0
- package/dist/components/rowpanels/renderFeaturePanel.js.map +1 -0
- package/dist/components/rowpanels/renderRowPanel.d.ts +23 -0
- package/dist/components/rowpanels/renderRowPanel.js +22 -0
- package/dist/components/rowpanels/renderRowPanel.js.map +1 -0
- package/dist/components/rowpanels/renderStrip.d.ts +20 -0
- package/dist/components/rowpanels/renderStrip.js +26 -0
- package/dist/components/rowpanels/renderStrip.js.map +1 -0
- package/dist/components/tracks/TrackBlocks.js +3 -5
- package/dist/components/tracks/TrackBlocks.js.map +1 -1
- package/dist/components/tracks/TrackTooltipContent.d.ts +15 -0
- package/dist/components/tracks/TrackTooltipContent.js +109 -0
- package/dist/components/tracks/TrackTooltipContent.js.map +1 -0
- package/dist/components/tracks/drawTracks.d.ts +4 -4
- package/dist/components/tracks/drawTracks.js +25 -39
- package/dist/components/tracks/drawTracks.js.map +1 -1
- package/dist/components/tracks/useTrackHover.d.ts +22 -0
- package/dist/components/tracks/useTrackHover.js +30 -0
- package/dist/components/tracks/useTrackHover.js.map +1 -0
- package/dist/components/tree/CladeLabels.d.ts +12 -0
- package/dist/components/tree/CladeLabels.js +48 -0
- package/dist/components/tree/CladeLabels.js.map +1 -0
- package/dist/components/tree/TreeBranchMenu.js +1 -1
- package/dist/components/tree/TreeBranchMenu.js.map +1 -1
- package/dist/components/tree/TreeCanvas.js +5 -4
- package/dist/components/tree/TreeCanvas.js.map +1 -1
- package/dist/components/tree/TreeCanvasBlock.js +4 -21
- package/dist/components/tree/TreeCanvasBlock.js.map +1 -1
- package/dist/components/tree/TreeNodeMenu.js +1 -1
- package/dist/components/tree/TreeNodeMenu.js.map +1 -1
- package/dist/components/tree/TreeOverview.d.ts +14 -0
- package/dist/components/tree/TreeOverview.js +75 -0
- package/dist/components/tree/TreeOverview.js.map +1 -0
- package/dist/components/tree/TreeRuler.js +9 -13
- package/dist/components/tree/TreeRuler.js.map +1 -1
- package/dist/components/tree/cladeBrackets.d.ts +25 -0
- package/dist/components/tree/cladeBrackets.js +51 -0
- package/dist/components/tree/cladeBrackets.js.map +1 -0
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js +2 -2
- package/dist/components/tree/dialogs/TreeNodeInfoDialog.js.map +1 -1
- package/dist/components/tree/renderTreeCanvas.js +160 -25
- package/dist/components/tree/renderTreeCanvas.js.map +1 -1
- package/dist/components/tree/renderTreeOverview.d.ts +52 -0
- package/dist/components/tree/renderTreeOverview.js +138 -0
- package/dist/components/tree/renderTreeOverview.js.map +1 -0
- package/dist/components/tree/useTreeHover.js +2 -4
- package/dist/components/tree/useTreeHover.js.map +1 -1
- package/dist/constants.d.ts +16 -0
- package/dist/constants.js +52 -22
- package/dist/constants.js.map +1 -1
- package/dist/createPaletteMap.d.ts +7 -6
- package/dist/createPaletteMap.js +10 -9
- package/dist/createPaletteMap.js.map +1 -1
- package/dist/element.d.ts +13 -0
- package/dist/element.js +269 -0
- package/dist/element.js.map +1 -0
- package/dist/featureFields.d.ts +11 -0
- package/dist/featureFields.js +17 -0
- package/dist/featureFields.js.map +1 -0
- package/dist/flatToTree.js +1 -2
- package/dist/flatToTree.js.map +1 -1
- package/dist/ggplotPalettes.d.ts +10 -0
- package/dist/ggplotPalettes.js +58 -0
- package/dist/ggplotPalettes.js.map +1 -1
- package/dist/hierarchy.d.ts +27 -0
- package/dist/hierarchy.js +66 -9
- package/dist/hierarchy.js.map +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/model/DataModel.js +2 -5
- package/dist/model/DataModel.js.map +1 -1
- package/dist/model/msaModel.d.ts +3 -2
- package/dist/model/msaModel.js +3 -2
- package/dist/model/msaModel.js.map +1 -1
- package/dist/model/treeModel.d.ts +30 -0
- package/dist/model/treeModel.js +37 -1
- package/dist/model/treeModel.js.map +1 -1
- package/dist/model.d.ts +549 -294
- package/dist/model.js +1412 -621
- package/dist/model.js.map +1 -1
- package/dist/mount.d.ts +11 -0
- package/dist/mount.js +22 -0
- package/dist/mount.js.map +1 -0
- package/dist/neighborJoining.js +8 -32
- package/dist/neighborJoining.js.map +1 -1
- package/dist/renderToStaticMarkup.d.ts +10 -19
- package/dist/renderToStaticMarkup.js +13 -24
- package/dist/renderToStaticMarkup.js.map +1 -1
- package/dist/renderToSvg.js +180 -56
- package/dist/renderToSvg.js.map +1 -1
- package/dist/rowCoordinateCalculations.d.ts +4 -6
- package/dist/rowCoordinateCalculations.js +4 -6
- package/dist/rowCoordinateCalculations.js.map +1 -1
- package/dist/scales.d.ts +22 -0
- package/dist/scales.js +30 -0
- package/dist/scales.js.map +1 -0
- package/dist/seqPosToGlobalCol.d.ts +2 -3
- package/dist/seqPosToGlobalCol.js +2 -3
- package/dist/seqPosToGlobalCol.js.map +1 -1
- package/dist/sequenceLogo.d.ts +6 -11
- package/dist/sequenceLogo.js +6 -11
- package/dist/sequenceLogo.js.map +1 -1
- package/dist/stripDefault.d.ts +7 -14
- package/dist/stripDefault.js +7 -14
- package/dist/stripDefault.js.map +1 -1
- package/dist/svgTestUtil.d.ts +186 -70
- package/dist/types.d.ts +221 -21
- package/dist/umd.d.ts +2 -0
- package/dist/umd.js +4 -2
- package/dist/umd.js.map +1 -1
- package/dist/useCanvasAutorun.d.ts +5 -10
- package/dist/useCanvasAutorun.js +5 -10
- package/dist/useCanvasAutorun.js.map +1 -1
- package/dist/useMsaSvgFigure.d.ts +20 -0
- package/dist/useMsaSvgFigure.js +46 -0
- package/dist/useMsaSvgFigure.js.map +1 -0
- package/dist/useWheelScroll.js +0 -4
- package/dist/useWheelScroll.js.map +1 -1
- package/dist/util.d.ts +5 -6
- package/dist/util.js +13 -6
- package/dist/util.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +19 -12
- package/src/calculateBlocks.ts +5 -3
- package/src/colorSchemes.ts +1 -2
- package/src/columnStats.ts +58 -0
- package/src/components/DragHandle.tsx +18 -7
- package/src/components/Loading.tsx +4 -36
- package/src/components/MSAView.tsx +19 -5
- package/src/components/MSAViewer.tsx +240 -28
- package/src/components/PortalTooltip.tsx +47 -0
- package/src/components/ResizeHandles.tsx +17 -32
- package/src/components/SequenceTextArea.tsx +3 -4
- package/src/components/Track.tsx +57 -19
- package/src/components/dialogs/AboutDialog.tsx +35 -6
- package/src/components/dialogs/AnnotationFileDialog.tsx +10 -1
- package/src/components/dialogs/ExportSVGDialog.tsx +8 -3
- package/src/components/dialogs/FeatureDialog.tsx +11 -3
- package/src/components/dialogs/TrackInfoDialog.tsx +1 -1
- package/src/components/header/GappynessSlider.tsx +6 -11
- package/src/components/header/Header.tsx +7 -1
- package/src/components/header/LoadWarnings.tsx +11 -25
- package/src/components/header/ScrollZoomIcons.tsx +52 -0
- package/src/components/header/TreeSettingsMenu.tsx +1 -3
- package/src/components/header/UnshareableDataWarning.tsx +2 -4
- package/src/components/header/ZoomControls.tsx +74 -14
- package/src/components/header/getAnnotationsMenu.ts +3 -6
- package/src/components/header/settingsMenuItems.ts +13 -8
- package/src/components/import/ImportForm.tsx +3 -5
- package/src/components/import/ImportFormExamples.tsx +2 -2
- package/src/components/import/util.ts +1 -2
- package/src/components/minimap/Minimap.tsx +1 -2
- package/src/components/msa/AnnotationLegend.tsx +48 -38
- package/src/components/msa/MSACanvas.tsx +3 -8
- package/src/components/msa/MSACanvasBlock.tsx +13 -16
- package/src/components/msa/MSAMouseoverCanvas.tsx +2 -1
- package/src/components/msa/domainBandCursor.ts +7 -11
- package/src/components/msa/drawFeatureSpans.ts +205 -0
- package/src/components/msa/legendRows.ts +24 -0
- package/src/components/msa/msaRaster.ts +30 -39
- package/src/components/msa/packDomainLanes.ts +36 -0
- package/src/components/msa/renderBoxFeatureCanvasBlock.ts +67 -123
- package/src/components/msa/renderHighlights.ts +53 -20
- package/src/components/msa/renderMSABlock.ts +14 -11
- package/src/components/msa/tileColor.ts +4 -7
- package/src/components/msa/useMsaBlockMouse.ts +6 -6
- package/src/components/rowpanels/RowPanelBlock.tsx +139 -0
- package/src/components/rowpanels/RowPanelHeaders.tsx +57 -0
- package/src/components/rowpanels/RowPanels.tsx +77 -0
- package/src/components/rowpanels/headerLayout.ts +5 -0
- package/src/components/rowpanels/renderFeaturePanel.ts +66 -0
- package/src/components/rowpanels/renderRowPanel.ts +41 -0
- package/src/components/rowpanels/renderStrip.ts +46 -0
- package/src/components/tracks/TrackBlocks.tsx +3 -5
- package/src/components/tracks/TrackTooltipContent.tsx +156 -0
- package/src/components/tracks/drawTracks.ts +25 -50
- package/src/components/tracks/useTrackHover.ts +42 -0
- package/src/components/tree/CladeLabels.tsx +77 -0
- package/src/components/tree/TreeBranchMenu.tsx +1 -2
- package/src/components/tree/TreeCanvas.tsx +2 -3
- package/src/components/tree/TreeCanvasBlock.tsx +8 -32
- package/src/components/tree/TreeNodeMenu.tsx +1 -2
- package/src/components/tree/TreeOverview.tsx +106 -0
- package/src/components/tree/TreeRuler.tsx +11 -22
- package/src/components/tree/cladeBrackets.ts +73 -0
- package/src/components/tree/dialogs/TreeNodeInfoDialog.tsx +2 -2
- package/src/components/tree/renderTreeCanvas.ts +242 -21
- package/src/components/tree/renderTreeOverview.ts +212 -0
- package/src/components/tree/useTreeHover.ts +2 -4
- package/src/constants.ts +61 -22
- package/src/createPaletteMap.ts +10 -9
- package/src/element.ts +321 -0
- package/src/featureFields.ts +19 -0
- package/src/flatToTree.ts +1 -2
- package/src/ggplotPalettes.ts +60 -0
- package/src/hierarchy.ts +77 -9
- package/src/index.ts +31 -7
- package/src/model/DataModel.ts +2 -5
- package/src/model/msaModel.ts +3 -2
- package/src/model/treeModel.ts +42 -0
- package/src/model.ts +1677 -643
- package/src/mount.tsx +32 -0
- package/src/neighborJoining.ts +8 -32
- package/src/renderToStaticMarkup.ts +13 -24
- package/src/renderToSvg.tsx +335 -68
- package/src/rowCoordinateCalculations.ts +4 -6
- package/src/scales.ts +47 -0
- package/src/seqPosToGlobalCol.ts +2 -3
- package/src/sequenceLogo.ts +6 -11
- package/src/stripDefault.ts +7 -14
- package/src/types.ts +260 -45
- package/src/umd.ts +4 -2
- package/src/useCanvasAutorun.ts +5 -10
- package/src/useMsaSvgFigure.ts +72 -0
- package/src/useWheelScroll.ts +0 -4
- package/src/util.ts +15 -6
- package/src/version.ts +1 -1
- package/dist/components/msa/ColumnStats.js +0 -42
- package/dist/components/msa/ColumnStats.js.map +0 -1
- package/src/components/msa/ColumnStats.tsx +0 -54
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ResolvedScale, ScaleSpec } from './scales.ts';
|
|
1
2
|
import type { Annotation } from 'msa-parsers';
|
|
2
3
|
export interface Accession {
|
|
3
4
|
accession: string;
|
|
@@ -5,12 +6,19 @@ export interface Accession {
|
|
|
5
6
|
description: string;
|
|
6
7
|
}
|
|
7
8
|
export type TrackKind = 'text' | 'bar' | 'logo' | 'arc' | 'ruler';
|
|
9
|
+
/**
|
|
10
|
+
* Which channel the color scheme paints. `fill` colors the cell a residue sits
|
|
11
|
+
* in, `color` colors the letter itself, the same distinction a grammar of
|
|
12
|
+
* graphics draws between a shape's interior and its own ink.
|
|
13
|
+
*/
|
|
14
|
+
export type ResidueEncoding = 'fill' | 'color';
|
|
8
15
|
export interface BasicTrackModel {
|
|
9
16
|
id: string;
|
|
10
17
|
name: string;
|
|
11
18
|
associatedRowName?: string;
|
|
12
19
|
height: number;
|
|
13
20
|
kind: TrackKind;
|
|
21
|
+
heightKey?: string;
|
|
14
22
|
defaultOff?: boolean;
|
|
15
23
|
}
|
|
16
24
|
export interface TextTrackModel extends BasicTrackModel {
|
|
@@ -51,6 +59,102 @@ export interface ColumnTrackSpec {
|
|
|
51
59
|
row?: string;
|
|
52
60
|
height?: number;
|
|
53
61
|
}
|
|
62
|
+
/**
|
|
63
|
+
* A strip panel: one cell per row, colored from a `rowData` field through
|
|
64
|
+
* `scale`, which is ggtree's `gheatmap`. `width` is in pixels and defaults to
|
|
65
|
+
* the row height, and `header` labels the column and defaults to the field.
|
|
66
|
+
* `legend` titles the strip's legend and defaults to the field, and strips
|
|
67
|
+
* naming one title share one legend.
|
|
68
|
+
*/
|
|
69
|
+
export interface RowStripSpec {
|
|
70
|
+
kind: 'strip';
|
|
71
|
+
field: string;
|
|
72
|
+
scale?: ScaleSpec;
|
|
73
|
+
width?: number;
|
|
74
|
+
header?: string;
|
|
75
|
+
legend?: string;
|
|
76
|
+
}
|
|
77
|
+
/** the channels a `features` panel reads off the feature table */
|
|
78
|
+
export interface FeatureEncodingSpec {
|
|
79
|
+
color?: {
|
|
80
|
+
field: string;
|
|
81
|
+
scale?: ScaleSpec;
|
|
82
|
+
};
|
|
83
|
+
label?: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Shifts each row so that the first feature named `on` starts at zero, which
|
|
87
|
+
* is gggenes' `make_alignment_dummies`. Only `x: "position"` reads it.
|
|
88
|
+
*/
|
|
89
|
+
export interface AlignTransform {
|
|
90
|
+
type: 'align';
|
|
91
|
+
on: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A features panel: the GFF's spans per row, as arrows where they carry a
|
|
95
|
+
* strand. `x: "column"` draws them in the alignment's columns, and
|
|
96
|
+
* `x: "position"` in each row's own residue positions on one linear scale, so
|
|
97
|
+
* a genome with no alignment has an x.
|
|
98
|
+
*/
|
|
99
|
+
export interface RowFeaturesSpec {
|
|
100
|
+
kind: 'features';
|
|
101
|
+
x: 'column' | 'position';
|
|
102
|
+
width?: number;
|
|
103
|
+
header?: string;
|
|
104
|
+
encoding?: FeatureEncodingSpec;
|
|
105
|
+
transform?: AlignTransform[];
|
|
106
|
+
/** how overlapping features share the row's height; see docs/layers.md */
|
|
107
|
+
position?: 'identity' | 'strandpile';
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A panel left of the alignment on the row scale, the counterpart of
|
|
111
|
+
* ColumnTrackSpec on the column scale. See docs/layers.md
|
|
112
|
+
*/
|
|
113
|
+
export type RowPanelSpec = RowStripSpec | RowFeaturesSpec;
|
|
114
|
+
interface ResolvedPanelBase {
|
|
115
|
+
id: string;
|
|
116
|
+
header: string;
|
|
117
|
+
width: number;
|
|
118
|
+
offsetX: number;
|
|
119
|
+
legend: LegendEntry[];
|
|
120
|
+
/** the legend this panel's entries go under; absent means the domain key */
|
|
121
|
+
legendTitle?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* A strip with its scale resolved: the color each row takes, keyed by row
|
|
125
|
+
* name, and the pixel column the panel draws in.
|
|
126
|
+
*/
|
|
127
|
+
export interface ResolvedStripPanel extends ResolvedPanelBase {
|
|
128
|
+
kind: 'strip';
|
|
129
|
+
field: string;
|
|
130
|
+
colors: Map<string, string>;
|
|
131
|
+
}
|
|
132
|
+
/** one feature of a features panel, at its pixel span inside the panel */
|
|
133
|
+
export interface RowPanelSpan {
|
|
134
|
+
annotation: Annotation;
|
|
135
|
+
xStart: number;
|
|
136
|
+
xEnd: number;
|
|
137
|
+
lane: number;
|
|
138
|
+
laneCount: number;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* A features panel with its x mapping and its scale resolved: the spans per
|
|
142
|
+
* row name in panel pixels, the fill and outline of each feature, and the
|
|
143
|
+
* label its `label` channel draws. `field` is the field its color scale reads,
|
|
144
|
+
* which its legend is titled by.
|
|
145
|
+
*/
|
|
146
|
+
export interface ResolvedFeaturePanel extends ResolvedPanelBase {
|
|
147
|
+
kind: 'features';
|
|
148
|
+
x: 'column' | 'position';
|
|
149
|
+
field?: string;
|
|
150
|
+
spans: Map<string, RowPanelSpan[]>;
|
|
151
|
+
colors: Map<Annotation, {
|
|
152
|
+
fill: string;
|
|
153
|
+
stroke: string;
|
|
154
|
+
}>;
|
|
155
|
+
labels?: Map<Annotation, string>;
|
|
156
|
+
}
|
|
157
|
+
export type ResolvedRowPanel = ResolvedStripPanel | ResolvedFeaturePanel;
|
|
54
158
|
export interface ResidueSegment {
|
|
55
159
|
rowStart: number;
|
|
56
160
|
rowEnd: number;
|
|
@@ -64,21 +168,16 @@ export interface MappedStructure {
|
|
|
64
168
|
url?: string;
|
|
65
169
|
}
|
|
66
170
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* structure by sequence equality fails for a construct with an expression tag,
|
|
71
|
-
* a truncation, an engineered residue, or a row that is a subsequence of the
|
|
72
|
-
* entry, and it fails in the direction that looks like it worked.
|
|
171
|
+
* The structure residue for each residue of a row, computed outside the viewer
|
|
172
|
+
* (SIFTS, an AlphaFold model, a curator). Sequence equality misplaces tagged
|
|
173
|
+
* constructs, truncations and subsequence rows; see docs/layers.md.
|
|
73
174
|
*
|
|
74
175
|
* Positions are 1-based and inclusive on both sides, as GFF and `highlights`
|
|
75
176
|
* are. Structure positions are `label_seq_id`, the index into the entity's
|
|
76
|
-
* SEQRES; author numbering carries insertion codes and
|
|
177
|
+
* SEQRES; author numbering carries insertion codes and is not used.
|
|
77
178
|
*
|
|
78
179
|
* `unobserved` is in structure positions: present in SEQRES with no
|
|
79
|
-
* coordinates
|
|
80
|
-
* crystallographer could not see it" and "this protein does not have that
|
|
81
|
-
* residue" mean different things to a reader.
|
|
180
|
+
* coordinates, as distinct from a residue the structure lacks.
|
|
82
181
|
*/
|
|
83
182
|
export interface ResidueMapping {
|
|
84
183
|
row: string;
|
|
@@ -87,11 +186,9 @@ export interface ResidueMapping {
|
|
|
87
186
|
segments: ResidueSegment[];
|
|
88
187
|
unobserved?: [number, number][];
|
|
89
188
|
/**
|
|
90
|
-
* ungapped length of the row this was computed against.
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* is the failure this whole layer exists to avoid. Declared here, the viewer
|
|
94
|
-
* can notice and refuse instead of answering from stale arithmetic.
|
|
189
|
+
* ungapped length of the row this was computed against. When set, the viewer
|
|
190
|
+
* ignores the mapping if the loaded row's length differs, as it does after a
|
|
191
|
+
* re-alignment, revision or swapped sequence.
|
|
95
192
|
*/
|
|
96
193
|
rowLength?: number;
|
|
97
194
|
generated?: {
|
|
@@ -104,9 +201,8 @@ export interface ResidueMappingProblem {
|
|
|
104
201
|
row: string;
|
|
105
202
|
structureId: string;
|
|
106
203
|
/**
|
|
107
|
-
* `mapping`
|
|
108
|
-
*
|
|
109
|
-
* segment, since the rest of the mapping still describes residues that exist.
|
|
204
|
+
* `mapping` ignores the whole mapping, because the problem concerns its row.
|
|
205
|
+
* `segment` ignores only that segment and keeps the rest.
|
|
110
206
|
*/
|
|
111
207
|
scope: 'mapping' | 'segment';
|
|
112
208
|
reason: string;
|
|
@@ -121,9 +217,8 @@ export interface RowResidue {
|
|
|
121
217
|
seqPos: number;
|
|
122
218
|
}
|
|
123
219
|
/**
|
|
124
|
-
* One loaded document that the snapshot
|
|
125
|
-
*
|
|
126
|
-
* would go to load it differently.
|
|
220
|
+
* One loaded document that the snapshot omits, and its size. `what` uses the
|
|
221
|
+
* import form's names for the documents.
|
|
127
222
|
*/
|
|
128
223
|
export interface UnshareableData {
|
|
129
224
|
what: 'alignment' | 'tree' | 'annotations' | 'row metadata' | 'data tracks';
|
|
@@ -136,6 +231,27 @@ export interface DomainBand {
|
|
|
136
231
|
startCol: number;
|
|
137
232
|
endCol: number;
|
|
138
233
|
stackIndex: number;
|
|
234
|
+
lane: number;
|
|
235
|
+
laneCount: number;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* One swatch of a categorical color key. `id` is the value the scale read, and
|
|
239
|
+
* `label` is the text drawn beside the swatch.
|
|
240
|
+
*/
|
|
241
|
+
export interface LegendEntry {
|
|
242
|
+
id: string;
|
|
243
|
+
label: string;
|
|
244
|
+
color: string;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* A categorical color key, drawn by the on-screen overlay and reserved as a
|
|
248
|
+
* column in the SVG export. `title` names the legend where the viewer draws
|
|
249
|
+
* more than one.
|
|
250
|
+
*/
|
|
251
|
+
export interface Legend {
|
|
252
|
+
id: string;
|
|
253
|
+
title: string;
|
|
254
|
+
entries: LegendEntry[];
|
|
139
255
|
}
|
|
140
256
|
/**
|
|
141
257
|
* A persistent, labeled highlight. Coordinates are 1-based and inclusive, as
|
|
@@ -150,6 +266,90 @@ export interface Highlight {
|
|
|
150
266
|
label?: string;
|
|
151
267
|
color?: string;
|
|
152
268
|
}
|
|
269
|
+
/**
|
|
270
|
+
* What the viewer draws over a clade. `highlight` fills the rows behind it,
|
|
271
|
+
* across the tree and the alignment. `bracket` draws a bar and the clade's
|
|
272
|
+
* `label` in the gutter right of the tip labels. `collapse` and `focus` seed
|
|
273
|
+
* the collapsed list and the subtree in focus at load.
|
|
274
|
+
*/
|
|
275
|
+
export type CladeMark = 'highlight' | 'bracket' | 'collapse' | 'focus';
|
|
276
|
+
/**
|
|
277
|
+
* A clade of the tree and the mark drawn over it. `mrca` names tips whose most
|
|
278
|
+
* recent common ancestor is the clade; `range` names the first and last tip of
|
|
279
|
+
* a run in display order, in either order. `tips` is the leaf count the
|
|
280
|
+
* producer measured, and a clade that resolves to a different count is dropped.
|
|
281
|
+
* `label` names the clade beside a bracket, and a highlight carrying one draws
|
|
282
|
+
* the label without the bar. See docs/layers.md
|
|
283
|
+
*/
|
|
284
|
+
export interface Clade {
|
|
285
|
+
mrca?: string[];
|
|
286
|
+
range?: [string, string];
|
|
287
|
+
tips: number;
|
|
288
|
+
mark: CladeMark;
|
|
289
|
+
color?: string;
|
|
290
|
+
label?: string;
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* A Clade resolved to the rows it covers, with its fill color settled. `color`
|
|
294
|
+
* is the highlight fill; `markColor` is the producer's own color for a bracket
|
|
295
|
+
* bar and its label, unset where the theme's text color stands. `nodeId` is the
|
|
296
|
+
* node an `mrca` resolved to, which `collapse` and `focus` seed themselves
|
|
297
|
+
* with, and a `range` record has none.
|
|
298
|
+
*/
|
|
299
|
+
export interface ResolvedClade {
|
|
300
|
+
rows: [number, number];
|
|
301
|
+
mark: CladeMark;
|
|
302
|
+
color: string;
|
|
303
|
+
markColor?: string;
|
|
304
|
+
label?: string;
|
|
305
|
+
nodeId?: string;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* A span in Highlight coordinates: 1-based inclusive residues of `row`, or
|
|
309
|
+
* columns of the file without it
|
|
310
|
+
*/
|
|
311
|
+
export interface Region {
|
|
312
|
+
row?: string;
|
|
313
|
+
start: number;
|
|
314
|
+
end: number;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* A cell of the alignment in the host's coordinates, 1-based like Highlight:
|
|
318
|
+
* `column` counts every column of the file, hidden gappy ones included, and
|
|
319
|
+
* `residue` counts the row's own letters, absent on a gap. A pointer over a
|
|
320
|
+
* track has a column and no row.
|
|
321
|
+
*/
|
|
322
|
+
export interface Cell {
|
|
323
|
+
column: number;
|
|
324
|
+
row?: string;
|
|
325
|
+
residue?: number;
|
|
326
|
+
letter?: string;
|
|
327
|
+
}
|
|
328
|
+
/** the alignment columns on screen, 1-based and inclusive */
|
|
329
|
+
export interface Viewport {
|
|
330
|
+
startColumn: number;
|
|
331
|
+
endColumn: number;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* A channel of a mark the viewer always draws. `tipLabel` colors each tip label
|
|
335
|
+
* in the tree, `rowTint` washes the row across the tree gutter and the
|
|
336
|
+
* alignment, and `branch` colors a tree edge whose tips all share one value;
|
|
337
|
+
* all three read a field of `rowData`. `featureFill` colors each span of the
|
|
338
|
+
* annotation overlay and `featureLabel` names the field drawn inside a span,
|
|
339
|
+
* both from a field of the feature table.
|
|
340
|
+
*/
|
|
341
|
+
export type EncodingChannel = 'tipLabel' | 'rowTint' | 'branch' | 'featureFill' | 'featureLabel';
|
|
342
|
+
/**
|
|
343
|
+
* A channel, the field feeding it, and the scale it reads that field through.
|
|
344
|
+
* See docs/layers.md
|
|
345
|
+
*/
|
|
346
|
+
export interface Encoding {
|
|
347
|
+
channel: EncodingChannel;
|
|
348
|
+
field: string;
|
|
349
|
+
scale?: ScaleSpec;
|
|
350
|
+
}
|
|
351
|
+
/** an Encoding with its scale resolved against the values in the table */
|
|
352
|
+
export type ResolvedEncoding = Encoding & ResolvedScale;
|
|
153
353
|
/** a Highlight resolved to visible column indices and row indices */
|
|
154
354
|
export interface ResolvedHighlight {
|
|
155
355
|
startCol?: number;
|
package/dist/umd.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
export { destroy } from '@jbrowse/mobx-state-tree';
|
|
3
3
|
export { default as MSAView } from './components/Loading.tsx';
|
|
4
|
+
export { mount } from './mount.tsx';
|
|
5
|
+
export { defineMsaElement } from './element.ts';
|
|
4
6
|
export { type MsaViewModel, default as MSAModelF } from './model.ts';
|
|
5
7
|
export * from 'react-dom/client';
|
|
6
8
|
export { React };
|
package/dist/umd.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
// a
|
|
3
|
-
//
|
|
2
|
+
// a page that builds models with MSAModelF destroys each one it replaces, so
|
|
3
|
+
// the disposers its autoruns registered run
|
|
4
4
|
export { destroy } from '@jbrowse/mobx-state-tree';
|
|
5
5
|
export { default as MSAView } from './components/Loading.js';
|
|
6
|
+
export { mount } from './mount.js';
|
|
7
|
+
export { defineMsaElement } from './element.js';
|
|
6
8
|
export { default as MSAModelF } from './model.js';
|
|
7
9
|
export * from 'react-dom/client';
|
|
8
10
|
export { React };
|
package/dist/umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"umd.js","sourceRoot":"","sources":["../src/umd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,
|
|
1
|
+
{"version":3,"file":"umd.js","sourceRoot":"","sources":["../src/umd.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,6EAA6E;AAC7E,4CAA4C;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAA;AAClD,OAAO,EAAE,OAAO,IAAI,OAAO,EAAE,MAAM,yBAA0B,CAAA;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAa,CAAA;AACnC,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/C,OAAO,EAAqB,OAAO,IAAI,SAAS,EAAE,MAAM,YAAY,CAAA;AAEpE,cAAc,kBAAkB,CAAA;AAEhC,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* Wires a canvas ref to a mobx autorun: grabs the 2d context once the canvas
|
|
4
|
-
* mounts and re-runs `draw` whenever any observable it reads changes.
|
|
5
|
-
* the getContext/null-guard/autorun-dispose boilerplate repeated by every canvas
|
|
6
|
-
* block host.
|
|
4
|
+
* mounts and re-runs `draw` whenever any observable it reads changes.
|
|
7
5
|
*
|
|
8
|
-
* `width`/`height` are the canvas
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* *after* the mobx reaction that already redrew at the old size. Without a redraw
|
|
13
|
-
* on the far side of that commit the canvas is left blank: it is what blanked the
|
|
14
|
-
* tree on a tree-area resize and the consensus tracks on a vertical zoom.
|
|
6
|
+
* `width`/`height` are the canvas backing store size (logical size times the
|
|
7
|
+
* high-res scale factor). Assigning either clears the bitmap, and React assigns
|
|
8
|
+
* them after the mobx reaction has drawn at the old size, so the effect redraws
|
|
9
|
+
* when they change.
|
|
15
10
|
*
|
|
16
11
|
* `deps` covers everything else the effect should re-subscribe on, matching a
|
|
17
12
|
* normal useEffect dep array.
|
package/dist/useCanvasAutorun.js
CHANGED
|
@@ -2,17 +2,12 @@ import { useEffect, useRef } from 'react';
|
|
|
2
2
|
import { autorun } from 'mobx';
|
|
3
3
|
/**
|
|
4
4
|
* Wires a canvas ref to a mobx autorun: grabs the 2d context once the canvas
|
|
5
|
-
* mounts and re-runs `draw` whenever any observable it reads changes.
|
|
6
|
-
* the getContext/null-guard/autorun-dispose boilerplate repeated by every canvas
|
|
7
|
-
* block host.
|
|
5
|
+
* mounts and re-runs `draw` whenever any observable it reads changes.
|
|
8
6
|
*
|
|
9
|
-
* `width`/`height` are the canvas
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* *after* the mobx reaction that already redrew at the old size. Without a redraw
|
|
14
|
-
* on the far side of that commit the canvas is left blank: it is what blanked the
|
|
15
|
-
* tree on a tree-area resize and the consensus tracks on a vertical zoom.
|
|
7
|
+
* `width`/`height` are the canvas backing store size (logical size times the
|
|
8
|
+
* high-res scale factor). Assigning either clears the bitmap, and React assigns
|
|
9
|
+
* them after the mobx reaction has drawn at the old size, so the effect redraws
|
|
10
|
+
* when they change.
|
|
16
11
|
*
|
|
17
12
|
* `deps` covers everything else the effect should re-subscribe on, matching a
|
|
18
13
|
* normal useEffect dep array.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useCanvasAutorun.js","sourceRoot":"","sources":["../src/useCanvasAutorun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAI9B
|
|
1
|
+
{"version":3,"file":"useCanvasAutorun.js","sourceRoot":"","sources":["../src/useCanvasAutorun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAI9B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAC/B,IAAI,EACJ,KAAK,EACL,MAAM,EACN,IAAI,GAML;IACC,MAAM,GAAG,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAA;IAC3C,8EAA8E;IAC9E,0EAA0E;IAC1E,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,GAAG,GAAG,GAAG,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,CAAC,CAAA;QACzC,OAAO,GAAG;YACR,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;gBACX,IAAI,CAAC,GAAG,CAAC,CAAA;YACX,CAAC,CAAC;YACJ,CAAC,CAAC,SAAS,CAAA;QACb,uDAAuD;IACzD,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;IAC5B,OAAO,GAAG,CAAA;AACZ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { MsaViewModel } from './model.ts';
|
|
2
|
+
import type { Theme } from '@mui/material';
|
|
3
|
+
export interface MsaSvgFigure {
|
|
4
|
+
/** the SVG document for what is on screen, once the first draw finishes */
|
|
5
|
+
svg?: string;
|
|
6
|
+
error?: unknown;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The viewer's SVG export of its viewport, as markup for the page to insert.
|
|
10
|
+
* It redraws after the view settles: `delay` ms after the last scroll, zoom,
|
|
11
|
+
* resize or change to the snapshot. A draw a later one overtakes is dropped.
|
|
12
|
+
*
|
|
13
|
+
* The figure's row names and letters are SVG text, so the browser's find
|
|
14
|
+
* locates them, a reader can select them, and print stylesheets apply.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useMsaSvgFigure(model: MsaViewModel, { theme, includeTracks, delay, }?: {
|
|
17
|
+
theme?: Theme;
|
|
18
|
+
includeTracks?: boolean;
|
|
19
|
+
delay?: number;
|
|
20
|
+
}): MsaSvgFigure;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { createJBrowseTheme } from '@jbrowse/core/ui/theme';
|
|
3
|
+
import { getSnapshot } from '@jbrowse/mobx-state-tree';
|
|
4
|
+
import { compareStructural, reaction } from 'mobx';
|
|
5
|
+
import { renderToSvg } from './renderToSvg.js';
|
|
6
|
+
/**
|
|
7
|
+
* The viewer's SVG export of its viewport, as markup for the page to insert.
|
|
8
|
+
* It redraws after the view settles: `delay` ms after the last scroll, zoom,
|
|
9
|
+
* resize or change to the snapshot. A draw a later one overtakes is dropped.
|
|
10
|
+
*
|
|
11
|
+
* The figure's row names and letters are SVG text, so the browser's find
|
|
12
|
+
* locates them, a reader can select them, and print stylesheets apply.
|
|
13
|
+
*/
|
|
14
|
+
export function useMsaSvgFigure(model, { theme, includeTracks = false, delay = 300, } = {}) {
|
|
15
|
+
const [figure, setFigure] = useState({});
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
let latest = 0;
|
|
18
|
+
const dispose = reaction(() => model.viewInitialized && model.dataInitialized
|
|
19
|
+
? [getSnapshot(model), model.width, model.height]
|
|
20
|
+
: undefined, key => {
|
|
21
|
+
if (!key) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const draw = ++latest;
|
|
25
|
+
renderToSvg(model, {
|
|
26
|
+
theme: theme ?? createJBrowseTheme(),
|
|
27
|
+
exportType: 'viewport',
|
|
28
|
+
includeTracks,
|
|
29
|
+
}).then(svg => {
|
|
30
|
+
if (draw === latest) {
|
|
31
|
+
setFigure({ svg });
|
|
32
|
+
}
|
|
33
|
+
}, (error) => {
|
|
34
|
+
if (draw === latest) {
|
|
35
|
+
setFigure({ error });
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
}, { delay, fireImmediately: true, equals: compareStructural });
|
|
39
|
+
return () => {
|
|
40
|
+
latest = -1;
|
|
41
|
+
dispose();
|
|
42
|
+
};
|
|
43
|
+
}, [model, theme, includeTracks, delay]);
|
|
44
|
+
return figure;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=useMsaSvgFigure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMsaSvgFigure.js","sourceRoot":"","sources":["../src/useMsaSvgFigure.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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,EAAE,CAAC;oBACpB,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;gBACtB,CAAC;YACH,CAAC,CACF,CAAA;QACH,CAAC,EACD,EAAE,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAC5D,CAAA;QACD,OAAO,GAAG,EAAE;YACV,MAAM,GAAG,CAAC,CAAC,CAAA;YACX,OAAO,EAAE,CAAA;QACX,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC,CAAA;IACxC,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/useWheelScroll.js
CHANGED
|
@@ -116,10 +116,6 @@ export function useWheelScroll({ ref, onScrollX, onScrollY, onZoom, scrollZoom,
|
|
|
116
116
|
};
|
|
117
117
|
}, [mouseDragging, onScrollX, onScrollY]);
|
|
118
118
|
function onMouseDown(event) {
|
|
119
|
-
const target = event.target;
|
|
120
|
-
if (target.draggable || target.dataset.resizer) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
119
|
if (event.button === 0) {
|
|
124
120
|
prevX.current = event.clientX;
|
|
125
121
|
prevY.current = event.clientY;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useWheelScroll.js","sourceRoot":"","sources":["../src/useWheelScroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEnD,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,gBAAgB,CAAA;AAEvB,MAAM,UAAU,cAAc,CAAC,EAC7B,GAAG,EACH,SAAS,EACT,SAAS,EACT,MAAM,EACN,UAAU,GAOX;IACC,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAC/B,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,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AAC;YACH,CAAC;QACH,CAAC;QAED,SAAS,aAAa;YACpB,KAAK,CAAC,OAAO,GAAG,CAAC,CAAA;YACjB,KAAK,CAAC,OAAO,GAAG,CAAC,CAAA;YACjB,gBAAgB,CAAC,KAAK,CAAC,CAAA;QACzB,CAAC;QAED,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,eAAe,EAAE,IAAI,CAAC,CAAA;QAC3D,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,CAAC,CAAA;QACvD,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,WAAW,EAAE,eAAe,EAAE,IAAI,CAAC,CAAA;YAC9D,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,aAAa,EAAE,IAAI,CAAC,CAAA;QAC5D,CAAC,CAAA;IACH,CAAC,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAA;IAEzC,SAAS,WAAW,CAAC,KAAuB;QAC1C,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;YAC7B,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC,OAAO,CAAA;YAC7B,gBAAgB,CAAC,IAAI,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;IAED,SAAS,SAAS,CAAC,KAAuB;QACxC,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,gBAAgB,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAED,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,CAAA;AACnC,CAAC"}
|
package/dist/util.d.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import type { Theme } from '@mui/material';
|
|
2
2
|
export declare function adjustColorForContrast(color: string, bg: string): string;
|
|
3
|
+
export declare function withAlpha(color: string, alpha: number): string;
|
|
4
|
+
export declare function outlineColor(fill: string): string;
|
|
3
5
|
export declare function transform<T>(obj: Record<string, T>, cb: (arg0: [string, T]) => [string, T]): {
|
|
4
6
|
[k: string]: T;
|
|
5
7
|
};
|
|
6
8
|
/**
|
|
7
9
|
* Readable letter color over a given cell color, memoized per theme.
|
|
8
10
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* uncolored cell sits on the theme's background, where the theme's own text
|
|
13
|
-
* color is what stays readable -- `black` turned every gap and every uncolored
|
|
14
|
-
* cell invisible in the dark theme.
|
|
11
|
+
* Keyed by cell color, since a dynamic scheme has no letter->color table; this
|
|
12
|
+
* covers static schemes and a track's own `colors` too. An uncolored cell gets
|
|
13
|
+
* the theme's text color, which stays readable in the dark theme.
|
|
15
14
|
*/
|
|
16
15
|
export declare function contrastTextFn(theme: Theme): (color: string | undefined) => string;
|
|
17
16
|
export declare function dropBlanks<T>(blanks: number[], arr: T[]): T[];
|
package/dist/util.js
CHANGED
|
@@ -23,6 +23,16 @@ export function adjustColorForContrast(color, bg) {
|
|
|
23
23
|
contrastAdjustCache.set(cacheKey, result);
|
|
24
24
|
return result;
|
|
25
25
|
}
|
|
26
|
+
// a wash over the alignment or the tree: a color carrying its own alpha draws
|
|
27
|
+
// at that alpha, and one with none takes `alpha` so the marks under it stay
|
|
28
|
+
// readable
|
|
29
|
+
export function withAlpha(color, alpha) {
|
|
30
|
+
const parsed = colord(color);
|
|
31
|
+
return parsed.alpha() === 1 ? parsed.alpha(alpha).toRgbString() : color;
|
|
32
|
+
}
|
|
33
|
+
export function outlineColor(fill) {
|
|
34
|
+
return colord(fill).darken(0.1).toHex();
|
|
35
|
+
}
|
|
26
36
|
export function transform(obj, cb) {
|
|
27
37
|
return Object.fromEntries(Object.entries(obj).map(cb));
|
|
28
38
|
}
|
|
@@ -30,12 +40,9 @@ const contrastTextCaches = new WeakMap();
|
|
|
30
40
|
/**
|
|
31
41
|
* Readable letter color over a given cell color, memoized per theme.
|
|
32
42
|
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* uncolored cell sits on the theme's background, where the theme's own text
|
|
37
|
-
* color is what stays readable -- `black` turned every gap and every uncolored
|
|
38
|
-
* cell invisible in the dark theme.
|
|
43
|
+
* Keyed by cell color, since a dynamic scheme has no letter->color table; this
|
|
44
|
+
* covers static schemes and a track's own `colors` too. An uncolored cell gets
|
|
45
|
+
* the theme's text color, which stays readable in the dark theme.
|
|
39
46
|
*/
|
|
40
47
|
export function contrastTextFn(theme) {
|
|
41
48
|
let cache = contrastTextCaches.get(theme);
|
package/dist/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvC,OAAO,UAAU,MAAM,qBAAqB,CAAA;AAC5C,OAAO,WAAW,MAAM,sBAAsB,CAAA;AAI9C,MAAM,CAAC,CAAC,WAAW,EAAE,UAAU,CAAC,CAAC,CAAA;AAEjC,MAAM,mBAAmB,GAAG,IAAI,GAAG,EAAkB,CAAA;AAErD,0EAA0E;AAC1E,uEAAuE;AACvE,8DAA8D;AAC9D,MAAM,UAAU,sBAAsB,CAAC,KAAa,EAAE,EAAU;IAC9D,MAAM,QAAQ,GAAG,GAAG,KAAK,IAAI,EAAE,EAAE,CAAA;IACjC,MAAM,MAAM,GAAG,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAChD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,MAAM,CAAA;IACf,CAAC;IACD,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IACrB,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,CAAC;QACtB,MAAM,QAAQ,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,GAAG,GAAG,CAAA;QAC7C,KAA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CAAC,KAAK,CAAC,EAAE,CAAC;YACnD,oEAAoE;YACpE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;gBAC3C,IAAI,gBAAgB,KAAK,UAAU,EAAE,CAAC;oBACpC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAE,CAAC,CAAA;gBAC3B,CAAC;qBAAM,CAAC;oBACN,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;wBAC3B,UAAU,CAAC,IAAI,CAAC;4BACd,GAAG,EAAE,gBAAgB;4BACrB,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC;yBAC9B,CAAC,CAAA;oBACJ,CAAC;oBACD,gBAAgB,GAAG,UAAU,CAAA;oBAC7B,WAAW,GAAG,CAAC,GAAG,CAAC,CAAC,CAAE,CAAC,CAAA;gBACzB,CAAC;YACH,CAAC;YACD,QAAQ,EAAE,CAAA;QACZ,CAAC;aAAM,CAAC;YACN,UAAU,EAAE,CAAA;QACd,CAAC;IACH,CAAC;IACD,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,UAAU,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IAC3E,CAAC;IACD,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,MAAM,UAAU,GAAG,CAAC,CAAiC;IACnD,OAAO,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAA;AACxB,CAAC"}
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "8.1.0";
|
package/dist/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '
|
|
1
|
+
export const version = '8.1.0';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|