@jbrowse/plugin-arc 3.6.5 → 4.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/esm/ArcRenderer/ArcRendering.d.ts +1 -1
- package/esm/ArcRenderer/ArcRendering.js +31 -54
- package/esm/ArcRenderer/configSchema.d.ts +3 -3
- package/esm/ArcRenderer/configSchema.js +1 -1
- package/esm/ArcRenderer/index.js +4 -4
- package/esm/ArcTooltip.d.ts +1 -1
- package/esm/ArcTooltip.js +1 -1
- package/esm/LinearArcDisplay/configSchema.d.ts +4 -4
- package/esm/LinearArcDisplay/configSchema.js +1 -1
- package/esm/LinearArcDisplay/index.js +2 -2
- package/esm/LinearArcDisplay/model.d.ts +963 -94
- package/esm/LinearArcDisplay/model.js +4 -7
- package/esm/LinearPairedArcDisplay/afterAttach.d.ts +1 -1
- package/esm/LinearPairedArcDisplay/afterAttach.js +2 -2
- package/esm/LinearPairedArcDisplay/components/Arcs.d.ts +1 -1
- package/esm/LinearPairedArcDisplay/components/Arcs.js +9 -11
- package/esm/LinearPairedArcDisplay/components/BaseDisplayComponent.d.ts +1 -1
- package/esm/LinearPairedArcDisplay/components/BaseDisplayComponent.js +7 -38
- package/esm/LinearPairedArcDisplay/components/ErrorActions.d.ts +4 -0
- package/esm/LinearPairedArcDisplay/components/ErrorActions.js +20 -0
- package/esm/LinearPairedArcDisplay/components/ErrorMessage.d.ts +5 -0
- package/esm/LinearPairedArcDisplay/components/ErrorMessage.js +9 -0
- package/esm/LinearPairedArcDisplay/components/LoadingBar.d.ts +5 -0
- package/esm/LinearPairedArcDisplay/components/LoadingBar.js +23 -0
- package/esm/LinearPairedArcDisplay/components/ReactComponent.d.ts +1 -1
- package/esm/LinearPairedArcDisplay/components/ReactComponent.js +3 -3
- package/esm/LinearPairedArcDisplay/components/util.js +6 -8
- package/esm/LinearPairedArcDisplay/configSchema.d.ts +3 -3
- package/esm/LinearPairedArcDisplay/fetchChains.d.ts +2 -2
- package/esm/LinearPairedArcDisplay/fetchChains.js +3 -1
- package/esm/LinearPairedArcDisplay/index.js +5 -4
- package/esm/LinearPairedArcDisplay/model.d.ts +143 -31
- package/esm/LinearPairedArcDisplay/model.js +4 -5
- package/esm/LinearPairedArcDisplay/renderSvg.d.ts +1 -1
- package/esm/LinearPairedArcDisplay/renderSvg.js +1 -1
- package/esm/LinearPairedArcDisplay/util.d.ts +1 -1
- package/esm/LinearPairedArcDisplay/util.js +3 -5
- package/esm/index.js +9 -12
- package/package.json +27 -31
- package/dist/ArcRenderer/ArcRenderer.d.ts +0 -3
- package/dist/ArcRenderer/ArcRenderer.js +0 -9
- package/dist/ArcRenderer/ArcRendering.d.ts +0 -15
- package/dist/ArcRenderer/ArcRendering.js +0 -120
- package/dist/ArcRenderer/configSchema.d.ts +0 -39
- package/dist/ArcRenderer/configSchema.js +0 -44
- package/dist/ArcRenderer/index.d.ts +0 -2
- package/dist/ArcRenderer/index.js +0 -17
- package/dist/ArcTooltip.d.ts +0 -4
- package/dist/ArcTooltip.js +0 -17
- package/dist/LinearArcDisplay/configSchema.d.ts +0 -31
- package/dist/LinearArcDisplay/configSchema.js +0 -14
- package/dist/LinearArcDisplay/index.d.ts +0 -2
- package/dist/LinearArcDisplay/index.js +0 -21
- package/dist/LinearArcDisplay/model.d.ts +0 -327
- package/dist/LinearArcDisplay/model.js +0 -91
- package/dist/LinearPairedArcDisplay/afterAttach.d.ts +0 -2
- package/dist/LinearPairedArcDisplay/afterAttach.js +0 -10
- package/dist/LinearPairedArcDisplay/components/Arcs.d.ts +0 -6
- package/dist/LinearPairedArcDisplay/components/Arcs.js +0 -106
- package/dist/LinearPairedArcDisplay/components/BaseDisplayComponent.d.ts +0 -6
- package/dist/LinearPairedArcDisplay/components/BaseDisplayComponent.js +0 -83
- package/dist/LinearPairedArcDisplay/components/ReactComponent.d.ts +0 -6
- package/dist/LinearPairedArcDisplay/components/ReactComponent.js +0 -13
- package/dist/LinearPairedArcDisplay/components/util.d.ts +0 -17
- package/dist/LinearPairedArcDisplay/components/util.js +0 -66
- package/dist/LinearPairedArcDisplay/configSchema.d.ts +0 -35
- package/dist/LinearPairedArcDisplay/configSchema.js +0 -18
- package/dist/LinearPairedArcDisplay/fetchChains.d.ts +0 -27
- package/dist/LinearPairedArcDisplay/fetchChains.js +0 -21
- package/dist/LinearPairedArcDisplay/index.d.ts +0 -2
- package/dist/LinearPairedArcDisplay/index.js +0 -54
- package/dist/LinearPairedArcDisplay/model.d.ts +0 -129
- package/dist/LinearPairedArcDisplay/model.js +0 -105
- package/dist/LinearPairedArcDisplay/renderSvg.d.ts +0 -4
- package/dist/LinearPairedArcDisplay/renderSvg.js +0 -17
- package/dist/LinearPairedArcDisplay/util.d.ts +0 -27
- package/dist/LinearPairedArcDisplay/util.js +0 -119
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -43
|
@@ -11,5 +11,5 @@ declare const ArcRendering: ({ features, config, regions, bpPerPx, height, expor
|
|
|
11
11
|
};
|
|
12
12
|
onFeatureClick: (event: React.MouseEvent, featureId: string) => void;
|
|
13
13
|
exportSVG: boolean;
|
|
14
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element | import("react/jsx-runtime").JSX.Element[];
|
|
15
15
|
export default ArcRendering;
|
|
@@ -1,32 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Suspense, lazy,
|
|
2
|
+
import { Suspense, lazy, useState } from 'react';
|
|
3
3
|
import { readConfObject } from '@jbrowse/core/configuration';
|
|
4
4
|
import { bpSpanPx, getStrokeProps } from '@jbrowse/core/util';
|
|
5
5
|
import { observer } from 'mobx-react';
|
|
6
|
-
const ArcTooltip = lazy(() => import(
|
|
7
|
-
function Arc({ selectedFeatureId, region, bpPerPx, config, height: displayHeight, feature, onFeatureClick, }) {
|
|
8
|
-
const [isMouseOvered, setIsMouseOvered] = useState(false);
|
|
9
|
-
const [left, right] = bpSpanPx(feature.get('start'), feature.get('end'), region, bpPerPx);
|
|
10
|
-
const featureId = feature.id();
|
|
11
|
-
const selected = selectedFeatureId && String(selectedFeatureId) === String(feature.id());
|
|
12
|
-
const stroke = selected ? 'red' : readConfObject(config, 'color', { feature });
|
|
13
|
-
const textStroke = selected ? 'red' : 'black';
|
|
14
|
-
const label = readConfObject(config, 'label', { feature });
|
|
15
|
-
const caption = readConfObject(config, 'caption', { feature });
|
|
16
|
-
const strokeWidth = readConfObject(config, 'thickness', { feature }) || 2;
|
|
17
|
-
const height = Math.min(readConfObject(config, 'height', { feature }) || 100, displayHeight);
|
|
18
|
-
const ref = useRef(null);
|
|
19
|
-
const t = 0.5;
|
|
20
|
-
const t1 = 1 - t;
|
|
21
|
-
const textYCoord = 3 * (t1 * t1) * (t * height) + 3 * t1 * (t * t) * height;
|
|
22
|
-
return (_jsxs("g", { children: [_jsx("path", { ref: ref, ...getStrokeProps(stroke), d: `M ${left} 0 C ${left} ${height}, ${right} ${height}, ${right} 0`, strokeWidth: strokeWidth, fill: "transparent", onClick: e => {
|
|
23
|
-
onFeatureClick(e, featureId);
|
|
24
|
-
}, onMouseOver: () => {
|
|
25
|
-
setIsMouseOvered(true);
|
|
26
|
-
}, onMouseLeave: () => {
|
|
27
|
-
setIsMouseOvered(false);
|
|
28
|
-
}, pointerEvents: "stroke" }), isMouseOvered ? (_jsx(Suspense, { fallback: null, children: _jsx(ArcTooltip, { contents: caption }) })) : null, _jsx("text", { x: left + (right - left) / 2, y: textYCoord + 3, stroke: "white", strokeWidth: "0.6em", children: label }), _jsx("text", { x: left + (right - left) / 2, y: textYCoord + 3, stroke: textStroke, children: label })] }));
|
|
29
|
-
}
|
|
6
|
+
const ArcTooltip = lazy(() => import("../ArcTooltip.js"));
|
|
30
7
|
function polarToCartesian(centerX, centerY, radius, angleInDegrees) {
|
|
31
8
|
const angleInRadians = ((angleInDegrees - 90) * Math.PI) / 180;
|
|
32
9
|
return {
|
|
@@ -34,52 +11,52 @@ function polarToCartesian(centerX, centerY, radius, angleInDegrees) {
|
|
|
34
11
|
y: centerY + radius * Math.sin(angleInRadians),
|
|
35
12
|
};
|
|
36
13
|
}
|
|
37
|
-
function
|
|
38
|
-
const start = polarToCartesian(
|
|
39
|
-
const end = polarToCartesian(
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
0,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
].join(' ');
|
|
14
|
+
function getSemicirclePath(centerX, radius) {
|
|
15
|
+
const start = polarToCartesian(centerX, 0, radius, 270);
|
|
16
|
+
const end = polarToCartesian(centerX, 0, radius, 90);
|
|
17
|
+
return {
|
|
18
|
+
d: `M ${start.x} ${start.y} A ${radius} ${radius} 0 0 0 ${end.x} ${end.y}`,
|
|
19
|
+
textYCoord: radius,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function getBezierPath(left, right, config, feature, displayHeight) {
|
|
23
|
+
const height = Math.min(readConfObject(config, 'height', { feature }) || 100, displayHeight);
|
|
24
|
+
const t = 0.5;
|
|
25
|
+
const t1 = 1 - t;
|
|
26
|
+
return {
|
|
27
|
+
d: `M ${left} 0 C ${left} ${height}, ${right} ${height}, ${right} 0`,
|
|
28
|
+
textYCoord: 3 * (t1 * t1) * (t * height) + 3 * t1 * (t * t) * height,
|
|
29
|
+
};
|
|
54
30
|
}
|
|
55
|
-
function
|
|
31
|
+
function ArcFeature({ selectedFeatureId, region, bpPerPx, config, displayHeight, feature, semicircle, onFeatureClick, }) {
|
|
56
32
|
const [isMouseOvered, setIsMouseOvered] = useState(false);
|
|
57
33
|
const [left, right] = bpSpanPx(feature.get('start'), feature.get('end'), region, bpPerPx);
|
|
58
34
|
const featureId = feature.id();
|
|
59
|
-
const selected = selectedFeatureId
|
|
35
|
+
const selected = selectedFeatureId === featureId;
|
|
60
36
|
const stroke = selected ? 'red' : readConfObject(config, 'color', { feature });
|
|
61
37
|
const textStroke = selected ? 'red' : 'black';
|
|
62
38
|
const label = readConfObject(config, 'label', { feature });
|
|
63
39
|
const caption = readConfObject(config, 'caption', { feature });
|
|
64
40
|
const strokeWidth = readConfObject(config, 'thickness', { feature }) || 2;
|
|
65
|
-
const
|
|
66
|
-
const
|
|
67
|
-
|
|
41
|
+
const centerX = left + (right - left) / 2;
|
|
42
|
+
const radius = (right - left) / 2;
|
|
43
|
+
const { d, textYCoord } = semicircle
|
|
44
|
+
? getSemicirclePath(centerX, radius)
|
|
45
|
+
: getBezierPath(left, right, config, feature, displayHeight);
|
|
46
|
+
return (_jsxs("g", { children: [_jsx("path", { ...getStrokeProps(stroke), d: d, strokeWidth: strokeWidth, fill: "transparent", style: { cursor: 'pointer' }, onClick: e => {
|
|
68
47
|
onFeatureClick(e, featureId);
|
|
69
48
|
}, onMouseOver: () => {
|
|
70
49
|
setIsMouseOvered(true);
|
|
71
50
|
}, onMouseLeave: () => {
|
|
72
51
|
setIsMouseOvered(false);
|
|
73
|
-
},
|
|
52
|
+
}, pointerEvents: "stroke" }), isMouseOvered ? (_jsx(Suspense, { fallback: null, children: _jsx(ArcTooltip, { contents: caption }) })) : null, _jsx("text", { x: centerX, y: textYCoord + 3, stroke: "white", strokeWidth: "0.6em", children: label }), _jsx("text", { x: centerX, y: textYCoord + 3, stroke: textStroke, children: label })] }));
|
|
74
53
|
}
|
|
75
|
-
const ArcRendering = observer(function ({ features, config, regions, bpPerPx, height, exportSVG, displayModel, onFeatureClick, }) {
|
|
54
|
+
const ArcRendering = observer(function ArcRendering({ features, config, regions, bpPerPx, height, exportSVG, displayModel, onFeatureClick, }) {
|
|
76
55
|
const region = regions[0];
|
|
77
56
|
const width = (region.end - region.start) / bpPerPx;
|
|
78
|
-
const
|
|
57
|
+
const semicircle = readConfObject(config, 'displayMode') === 'semicircles';
|
|
79
58
|
const { selectedFeatureId } = displayModel || {};
|
|
80
|
-
|
|
81
|
-
});
|
|
82
|
-
function Wrapper({ exportSVG, width, height, children, }) {
|
|
59
|
+
const children = [...features.values()].map(f => (_jsx(ArcFeature, { displayHeight: height, config: config, region: region, bpPerPx: bpPerPx, selectedFeatureId: selectedFeatureId, onFeatureClick: onFeatureClick, feature: f, semicircle: semicircle }, f.id())));
|
|
83
60
|
return exportSVG ? (children) : (_jsx("svg", { width: width, height: height, children: children }));
|
|
84
|
-
}
|
|
61
|
+
});
|
|
85
62
|
export default ArcRendering;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
declare const ArcRenderer: import("
|
|
1
|
+
declare const ArcRenderer: import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
2
2
|
color: {
|
|
3
3
|
type: string;
|
|
4
4
|
description: string;
|
|
@@ -32,8 +32,8 @@ declare const ArcRenderer: import("@jbrowse/core/configuration/configurationSche
|
|
|
32
32
|
displayMode: {
|
|
33
33
|
type: string;
|
|
34
34
|
defaultValue: string;
|
|
35
|
-
model: import("mobx-state-tree").ISimpleType<string>;
|
|
35
|
+
model: import("@jbrowse/mobx-state-tree").ISimpleType<string>;
|
|
36
36
|
description: string;
|
|
37
37
|
};
|
|
38
|
-
}, import("
|
|
38
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, undefined>>;
|
|
39
39
|
export default ArcRenderer;
|
package/esm/ArcRenderer/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import configSchema from
|
|
1
|
+
import { lazy } from 'react';
|
|
2
|
+
import ArcRenderer from "./ArcRenderer.js";
|
|
3
|
+
import configSchema from "./configSchema.js";
|
|
4
4
|
export default function ArcRendererF(pluginManager) {
|
|
5
5
|
pluginManager.addRendererType(() => new ArcRenderer({
|
|
6
6
|
name: 'ArcRenderer',
|
|
7
|
-
ReactComponent,
|
|
7
|
+
ReactComponent: lazy(() => import("./ArcRendering.js")),
|
|
8
8
|
configSchema,
|
|
9
9
|
pluginManager,
|
|
10
10
|
}));
|
package/esm/ArcTooltip.d.ts
CHANGED
package/esm/ArcTooltip.js
CHANGED
|
@@ -6,7 +6,7 @@ import { observer } from 'mobx-react';
|
|
|
6
6
|
const TooltipContents = forwardRef(function TooltipContents2({ message }, ref) {
|
|
7
7
|
return (_jsx("div", { ref: ref, children: isValidElement(message) ? (message) : message ? (_jsx(SanitizedHTML, { html: String(message) })) : null }));
|
|
8
8
|
});
|
|
9
|
-
const ArcTooltip = observer(function ({ contents }) {
|
|
9
|
+
const ArcTooltip = observer(function ArcTooltip({ contents, }) {
|
|
10
10
|
return contents ? (_jsx(Suspense, { fallback: null, children: _jsx(BaseTooltip, { children: _jsx(TooltipContents, { message: contents }) }) })) : null;
|
|
11
11
|
});
|
|
12
12
|
export default ArcTooltip;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type PluginManager from '@jbrowse/core/PluginManager';
|
|
2
|
-
export declare function configSchemaFactory(pluginManager: PluginManager): import("
|
|
3
|
-
renderer: import("mobx-state-tree").IOptionalIType<import("mobx-state-tree").IAnyModelType, [undefined]>;
|
|
4
|
-
}, import("
|
|
2
|
+
export declare function configSchemaFactory(pluginManager: PluginManager): import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
3
|
+
renderer: import("@jbrowse/mobx-state-tree").IOptionalIType<import("@jbrowse/mobx-state-tree").IAnyModelType, [undefined]>;
|
|
4
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaType<{
|
|
5
5
|
maxFeatureScreenDensity: {
|
|
6
6
|
type: string;
|
|
7
7
|
description: string;
|
|
@@ -28,4 +28,4 @@ export declare function configSchemaFactory(pluginManager: PluginManager): impor
|
|
|
28
28
|
description: string;
|
|
29
29
|
defaultValue: never[];
|
|
30
30
|
};
|
|
31
|
-
}, import("
|
|
31
|
+
}, import("node_modules/@jbrowse/core/src/configuration/configurationSchema").ConfigurationSchemaOptions<undefined, "displayId">>, undefined>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ConfigurationSchema } from '@jbrowse/core/configuration';
|
|
2
|
+
import { types } from '@jbrowse/mobx-state-tree';
|
|
2
3
|
import { baseLinearDisplayConfigSchema } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
-
import { types } from 'mobx-state-tree';
|
|
4
4
|
export function configSchemaFactory(pluginManager) {
|
|
5
5
|
return ConfigurationSchema('LinearArcDisplay', {
|
|
6
6
|
renderer: types.optional(pluginManager.pluggableConfigSchemaType('renderer'), { type: 'ArcRenderer' }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DisplayType } from '@jbrowse/core/pluggableElementTypes';
|
|
2
2
|
import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
|
|
3
|
-
import { configSchemaFactory } from
|
|
4
|
-
import { stateModelFactory } from
|
|
3
|
+
import { configSchemaFactory } from "./configSchema.js";
|
|
4
|
+
import { stateModelFactory } from "./model.js";
|
|
5
5
|
export default function LinearArcDisplayF(pluginManager) {
|
|
6
6
|
pluginManager.addDisplayType(() => {
|
|
7
7
|
const configSchema = configSchemaFactory(pluginManager);
|