@jbrowse/plugin-circular-view 2.18.0 → 3.0.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/dist/BaseChordDisplay/components/BaseChordDisplay.d.ts +1 -2
- package/dist/BaseChordDisplay/components/BaseChordDisplay.js +3 -3
- package/dist/BaseChordDisplay/components/DisplayError.d.ts +1 -2
- package/dist/BaseChordDisplay/components/DisplayError.js +2 -11
- package/dist/BaseChordDisplay/components/Loading.d.ts +1 -2
- package/dist/BaseChordDisplay/components/Loading.js +3 -32
- package/dist/BaseChordDisplay/model.d.ts +1 -2
- package/dist/BaseChordDisplay/model.js +2 -5
- package/dist/CircularView/components/CircularView.d.ts +1 -2
- package/dist/CircularView/components/CircularView.js +20 -28
- package/dist/CircularView/components/Controls.d.ts +1 -2
- package/dist/CircularView/components/Controls.js +22 -58
- package/dist/CircularView/components/ExportSvgDialog.d.ts +1 -2
- package/dist/CircularView/components/ExportSvgDialog.js +31 -64
- package/dist/CircularView/components/ImportForm.d.ts +1 -2
- package/dist/CircularView/components/ImportForm.js +9 -39
- package/dist/CircularView/components/Ruler.d.ts +1 -2
- package/dist/CircularView/components/Ruler.js +17 -30
- package/dist/CircularView/index.js +17 -7
- package/dist/CircularView/model.js +17 -7
- package/dist/CircularView/svgcomponents/SVGBackground.d.ts +1 -2
- package/dist/CircularView/svgcomponents/SVGBackground.js +2 -5
- package/dist/CircularView/svgcomponents/SVGCircularView.js +3 -10
- package/esm/BaseChordDisplay/components/BaseChordDisplay.d.ts +1 -2
- package/esm/BaseChordDisplay/components/BaseChordDisplay.js +3 -3
- package/esm/BaseChordDisplay/components/DisplayError.d.ts +1 -2
- package/esm/BaseChordDisplay/components/DisplayError.js +2 -8
- package/esm/BaseChordDisplay/components/Loading.d.ts +1 -2
- package/esm/BaseChordDisplay/components/Loading.js +3 -9
- package/esm/BaseChordDisplay/model.d.ts +1 -2
- package/esm/BaseChordDisplay/model.js +2 -2
- package/esm/CircularView/components/CircularView.d.ts +1 -2
- package/esm/CircularView/components/CircularView.js +20 -28
- package/esm/CircularView/components/Controls.d.ts +1 -2
- package/esm/CircularView/components/Controls.js +22 -35
- package/esm/CircularView/components/ExportSvgDialog.d.ts +1 -2
- package/esm/CircularView/components/ExportSvgDialog.js +31 -41
- package/esm/CircularView/components/ImportForm.d.ts +1 -2
- package/esm/CircularView/components/ImportForm.js +9 -16
- package/esm/CircularView/components/Ruler.d.ts +1 -2
- package/esm/CircularView/components/Ruler.js +17 -27
- package/esm/CircularView/svgcomponents/SVGBackground.d.ts +1 -2
- package/esm/CircularView/svgcomponents/SVGBackground.js +2 -2
- package/esm/CircularView/svgcomponents/SVGCircularView.js +3 -10
- package/package.json +2 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { AssemblySelector, ErrorMessage } from '@jbrowse/core/ui';
|
|
3
4
|
import { getSession } from '@jbrowse/core/util';
|
|
4
5
|
import { Button, Container, Grid } from '@mui/material';
|
|
@@ -21,20 +22,12 @@ const ImportForm = observer(function ({ model }) {
|
|
|
21
22
|
: 'No configured assemblies';
|
|
22
23
|
const regions = (assembly === null || assembly === void 0 ? void 0 : assembly.regions) || [];
|
|
23
24
|
const err = assemblyError || error;
|
|
24
|
-
return (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
model.setError(undefined);
|
|
32
|
-
setSelectedAsm(val);
|
|
33
|
-
}, session: session, selected: selectedAsm })),
|
|
34
|
-
React.createElement(Grid, { item: true },
|
|
35
|
-
React.createElement(Button, { disabled: !regions.length, onClick: () => {
|
|
36
|
-
model.setError(undefined);
|
|
37
|
-
model.setDisplayedRegions(regions);
|
|
38
|
-
}, variant: "contained", color: "primary" }, regions.length || err ? 'Open' : 'Loading...')))));
|
|
25
|
+
return (_jsxs(Container, { className: classes.importFormContainer, children: [err ? (_jsx(Grid, { container: true, spacing: 1, justifyContent: "center", alignItems: "center", children: _jsx(Grid, { item: true, children: _jsx(ErrorMessage, { error: err }) }) })) : null, _jsxs(Grid, { container: true, spacing: 1, justifyContent: "center", alignItems: "center", children: [_jsx(Grid, { item: true, children: _jsx(AssemblySelector, { onChange: val => {
|
|
26
|
+
model.setError(undefined);
|
|
27
|
+
setSelectedAsm(val);
|
|
28
|
+
}, session: session, selected: selectedAsm }) }), _jsx(Grid, { item: true, children: _jsx(Button, { disabled: !regions.length, onClick: () => {
|
|
29
|
+
model.setError(undefined);
|
|
30
|
+
model.setDisplayedRegions(regions);
|
|
31
|
+
}, variant: "contained", color: "primary", children: regions.length || err ? 'Open' : 'Loading...' }) })] })] }));
|
|
39
32
|
});
|
|
40
33
|
export default ImportForm;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import type { CircularViewModel } from '../model';
|
|
3
2
|
import type { Slice } from '../slices';
|
|
4
3
|
declare const Ruler: ({ model, slice, }: {
|
|
5
4
|
model: CircularViewModel;
|
|
6
5
|
slice: Slice;
|
|
7
|
-
}) =>
|
|
6
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
8
7
|
export default Ruler;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { assembleLocString, getFillProps, getSession, getStrokeProps, polarToCartesian, radToDeg, } from '@jbrowse/core/util';
|
|
3
3
|
import { makeContrasting } from '@jbrowse/core/util/color';
|
|
4
4
|
import { useTheme } from '@mui/material/styles';
|
|
@@ -44,19 +44,17 @@ const ElisionRulerArc = observer(function ({ model, slice, region, }) {
|
|
|
44
44
|
const largeArc = endRadians - startRadians > Math.PI ? '1' : '0';
|
|
45
45
|
const centerRadians = (endRadians + startRadians) / 2;
|
|
46
46
|
const regionCount = `[${Number(region.regions.length).toLocaleString()}]`;
|
|
47
|
-
return (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
'
|
|
58
|
-
...endXY,
|
|
59
|
-
].join(' '), ...getStrokeProps(theme.palette.text.secondary), strokeWidth: 2, strokeDasharray: "2,2", fill: "none" })));
|
|
47
|
+
return (_jsxs(_Fragment, { children: [_jsx(RulerLabel, { text: regionCount, view: model, maxWidthPx: widthPx, radians: centerRadians, radiusPx: radiusPx, title: `${regionCount} more regions`, color: theme.palette.text.primary }), _jsx("path", { d: [
|
|
48
|
+
'M',
|
|
49
|
+
...startXY,
|
|
50
|
+
'A',
|
|
51
|
+
radiusPx,
|
|
52
|
+
radiusPx,
|
|
53
|
+
'0',
|
|
54
|
+
largeArc,
|
|
55
|
+
'1',
|
|
56
|
+
...endXY,
|
|
57
|
+
].join(' '), ...getStrokeProps(theme.palette.text.secondary), strokeWidth: 2, strokeDasharray: "2,2", fill: "none" })] }));
|
|
60
58
|
});
|
|
61
59
|
const RulerLabel = observer(function ({ view, text, maxWidthPx, radians, radiusPx, title, color, }) {
|
|
62
60
|
const { classes } = useStyles();
|
|
@@ -65,20 +63,14 @@ const RulerLabel = observer(function ({ view, text, maxWidthPx, radians, radiusP
|
|
|
65
63
|
return null;
|
|
66
64
|
}
|
|
67
65
|
if (text.length * 6.5 < maxWidthPx) {
|
|
68
|
-
return (
|
|
69
|
-
text,
|
|
70
|
-
React.createElement("title", null, title || text)));
|
|
66
|
+
return (_jsxs("text", { x: 0, y: 0, className: classes.rulerLabel, textAnchor: "middle", dominantBaseline: "baseline", transform: `translate(${textXY}) rotate(${radToDeg(radians) + 90})`, ...getFillProps(color), children: [text, _jsx("title", { children: title || text })] }));
|
|
71
67
|
}
|
|
72
68
|
if (maxWidthPx > 4) {
|
|
73
69
|
const overallRotation = radToDeg(radians + view.offsetRadians - Math.PI / 2);
|
|
74
70
|
if (overallRotation >= 180) {
|
|
75
|
-
return (
|
|
76
|
-
text,
|
|
77
|
-
React.createElement("title", null, title || text)));
|
|
71
|
+
return (_jsxs("text", { x: 0, y: 0, className: classes.rulerLabel, textAnchor: "start", dominantBaseline: "middle", transform: `translate(${textXY}) rotate(${radToDeg(radians)})`, fill: color, children: [text, _jsx("title", { children: title || text })] }));
|
|
78
72
|
}
|
|
79
|
-
return (
|
|
80
|
-
text,
|
|
81
|
-
React.createElement("title", null, title || text)));
|
|
73
|
+
return (_jsxs("text", { x: 0, y: 0, className: classes.rulerLabel, textAnchor: "end", dominantBaseline: "middle", transform: `translate(${textXY}) rotate(${radToDeg(radians) + 180})`, fill: color, children: [text, _jsx("title", { children: title || text })] }));
|
|
82
74
|
}
|
|
83
75
|
return null;
|
|
84
76
|
});
|
|
@@ -102,11 +94,9 @@ const RegionRulerArc = observer(function ({ model, slice, region, }) {
|
|
|
102
94
|
else {
|
|
103
95
|
color = theme.palette.text.primary;
|
|
104
96
|
}
|
|
105
|
-
return (
|
|
106
|
-
React.createElement(RulerLabel, { text: region.refName, view: model, maxWidthPx: widthPx, radians: centerRadians, radiusPx: radiusPx, color: color }),
|
|
107
|
-
React.createElement("path", { d: sliceArcPath(slice, radiusPx + 1, region.start, region.end), stroke: color, strokeWidth: 2, fill: "none" })));
|
|
97
|
+
return (_jsxs(_Fragment, { children: [_jsx(RulerLabel, { text: region.refName, view: model, maxWidthPx: widthPx, radians: centerRadians, radiusPx: radiusPx, color: color }), _jsx("path", { d: sliceArcPath(slice, radiusPx + 1, region.start, region.end), stroke: color, strokeWidth: 2, fill: "none" })] }));
|
|
108
98
|
});
|
|
109
99
|
const Ruler = observer(function ({ model, slice, }) {
|
|
110
|
-
return slice.region.elided ? (
|
|
100
|
+
return slice.region.elided ? (_jsx(ElisionRulerArc, { model: model, region: slice.region, slice: slice }, assembleLocString(slice.region.regions[0]))) : (_jsx(RegionRulerArc, { region: slice.region, model: model, slice: slice }, assembleLocString(slice.region)));
|
|
111
101
|
});
|
|
112
102
|
export default Ruler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { stripAlpha } from '@jbrowse/core/util';
|
|
3
3
|
import { useTheme } from '@mui/material';
|
|
4
4
|
export default function SVGBackground({ width, height, shift, }) {
|
|
5
5
|
const theme = useTheme();
|
|
6
|
-
return (
|
|
6
|
+
return (_jsx("rect", { width: width + shift * 2, height: height, fill: stripAlpha(theme.palette.background.default) }));
|
|
7
7
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
2
3
|
import { createJBrowseTheme } from '@jbrowse/core/ui';
|
|
3
4
|
import { getSession, radToDeg, renderToStaticMarkup } from '@jbrowse/core/util';
|
|
4
5
|
import { ThemeProvider } from '@mui/material';
|
|
5
6
|
import { when } from 'mobx';
|
|
6
|
-
import { getRoot } from 'mobx-state-tree';
|
|
7
7
|
import SVGBackground from './SVGBackground';
|
|
8
8
|
import Ruler from '../components/Ruler';
|
|
9
9
|
export async function renderToSvg(model, opts) {
|
|
@@ -12,7 +12,6 @@ export async function renderToSvg(model, opts) {
|
|
|
12
12
|
const { themeName = 'default', Wrapper = ({ children }) => children } = opts;
|
|
13
13
|
const session = getSession(model);
|
|
14
14
|
const theme = (_a = session.allThemes) === null || _a === void 0 ? void 0 : _a.call(session)[themeName];
|
|
15
|
-
const { createRootFn } = getRoot(model);
|
|
16
15
|
const { width, tracks, height } = model;
|
|
17
16
|
const shift = 50;
|
|
18
17
|
const displayResults = await Promise.all(tracks.map(async (track) => {
|
|
@@ -22,11 +21,5 @@ export async function renderToSvg(model, opts) {
|
|
|
22
21
|
}));
|
|
23
22
|
const { staticSlices, offsetRadians, centerXY } = model;
|
|
24
23
|
const deg = radToDeg(offsetRadians);
|
|
25
|
-
return renderToStaticMarkup(
|
|
26
|
-
React.createElement(Wrapper, null,
|
|
27
|
-
React.createElement("svg", { width: width, height: height, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, width + shift * 2, height].toString() },
|
|
28
|
-
React.createElement(SVGBackground, { width: width, height: height, shift: shift }),
|
|
29
|
-
React.createElement("g", { transform: `translate(${centerXY}) rotate(${deg})` },
|
|
30
|
-
staticSlices.map((slice, i) => (React.createElement(Ruler, { key: i, model: model, slice: slice }))),
|
|
31
|
-
displayResults.map(({ result }, i) => (React.createElement(React.Fragment, { key: i }, result))))))), createRootFn);
|
|
24
|
+
return renderToStaticMarkup(_jsx(ThemeProvider, { theme: createJBrowseTheme(theme), children: _jsx(Wrapper, { children: _jsxs("svg", { width: width, height: height, xmlns: "http://www.w3.org/2000/svg", xmlnsXlink: "http://www.w3.org/1999/xlink", viewBox: [0, 0, width + shift * 2, height].toString(), children: [_jsx(SVGBackground, { width: width, height: height, shift: shift }), _jsxs("g", { transform: `translate(${centerXY}) rotate(${deg})`, children: [staticSlices.map((slice, i) => (_jsx(Ruler, { model: model, slice: slice }, i))), displayResults.map(({ result }, i) => (_jsx(Fragment, { children: result }, i)))] })] }) }) }));
|
|
32
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jbrowse/plugin-circular-view",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "JBrowse 2 circular view",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"jbrowse",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"distModule": "esm/index.js",
|
|
57
57
|
"srcModule": "src/index.ts",
|
|
58
58
|
"module": "esm/index.js",
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "2c6897f1fa732b1db5b094d1dca197e333e95319"
|
|
60
60
|
}
|