@jbrowse/plugin-arc 2.10.2 → 2.11.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.
@@ -48,10 +48,8 @@ function Arc({ selectedFeatureId, region, bpPerPx, config, onFeatureClick, featu
48
48
  const ref = react_1.default.createRef();
49
49
  const t = 0.5;
50
50
  // formula: https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B%C3%A9zier_curves
51
- const textYCoord = (1 - t) * (1 - t) * (1 - t) * 0 +
52
- 3 * ((1 - t) * (1 - t)) * (t * height) +
53
- 3 * (1 - t) * (t * t) * height +
54
- t * t * t * 0;
51
+ const t1 = 1 - t;
52
+ const textYCoord = 3 * (t1 * t1) * (t * height) + 3 * t1 * (t * t) * height;
55
53
  return (react_1.default.createElement("g", null,
56
54
  react_1.default.createElement("path", { d: `M ${left} 0 C ${left} ${height}, ${right} ${height}, ${right} 0`, stroke: stroke, strokeWidth: strokeWidth, fill: "transparent", onClick: e => onFeatureClick === null || onFeatureClick === void 0 ? void 0 : onFeatureClick(e, featureId), onMouseOver: () => setIsMouseOvered(true), onMouseLeave: () => setIsMouseOvered(false), ref: ref, pointerEvents: "stroke" }),
57
55
  isMouseOvered ? react_1.default.createElement(ArcTooltip_1.default, { contents: caption }) : null,
@@ -110,6 +108,6 @@ const ArcRendering = (0, mobx_react_1.observer)(function ({ features, config, re
110
108
  return (react_1.default.createElement(Wrapper, { exportSVG: exportSVG, width: width, height: height }, [...features.values()].map(f => semicircles ? (react_1.default.createElement(SemiCircles, { key: f.id(), config: config, region: region, bpPerPx: bpPerPx, selectedFeatureId: selectedFeatureId, feature: f })) : (react_1.default.createElement(Arc, { key: f.id(), config: config, region: region, bpPerPx: bpPerPx, selectedFeatureId: selectedFeatureId, feature: f })))));
111
109
  });
112
110
  function Wrapper({ exportSVG, width, height, children, }) {
113
- return exportSVG ? (react_1.default.createElement(react_1.default.Fragment, null, children)) : (react_1.default.createElement("svg", { width: width, height: height }, children));
111
+ return exportSVG ? (children) : (react_1.default.createElement("svg", { width: width, height: height }, children));
114
112
  }
115
113
  exports.default = ArcRendering;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  declare const ArcTooltip: ({ contents }: {
3
- contents?: string | undefined;
3
+ contents?: string;
4
4
  }) => React.JSX.Element | null;
5
5
  export default ArcTooltip;
@@ -43,8 +43,18 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
43
43
  message: string | undefined;
44
44
  maxHeightReached: boolean;
45
45
  ReactComponent: ({ model, }: {
46
- model: any;
47
- }) => any;
46
+ /**
47
+ * #getter
48
+ */
49
+ model: {
50
+ error?: unknown;
51
+ reload: () => void;
52
+ message: import("react").ReactNode;
53
+ filled?: boolean | undefined;
54
+ status?: string | undefined;
55
+ reactElement?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
56
+ };
57
+ }) => import("react").JSX.Element | undefined;
48
58
  renderProps: any;
49
59
  } & {
50
60
  doReload(): void;
@@ -323,8 +333,18 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
323
333
  message: string | undefined;
324
334
  maxHeightReached: boolean;
325
335
  ReactComponent: ({ model, }: {
326
- model: any;
327
- }) => any;
336
+ /**
337
+ * #getter
338
+ */
339
+ model: {
340
+ error?: unknown;
341
+ reload: () => void;
342
+ message: import("react").ReactNode;
343
+ filled?: boolean | undefined;
344
+ status?: string | undefined;
345
+ reactElement?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
346
+ };
347
+ }) => import("react").JSX.Element | undefined;
328
348
  renderProps: any;
329
349
  } & {
330
350
  doReload(): void;
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  import { LinearArcDisplayModel } from '../model';
3
3
  declare const Arcs: ({ model, exportSVG, }: {
4
4
  model: LinearArcDisplayModel;
5
- exportSVG?: boolean | undefined;
5
+ exportSVG?: boolean;
6
6
  }) => React.JSX.Element | null;
7
7
  export default Arcs;
@@ -67,7 +67,7 @@ const Wrapper = (0, mobx_react_1.observer)(function ({ model, exportSVG, childre
67
67
  const { height } = model;
68
68
  const view = (0, util_1.getContainingView)(model);
69
69
  const width = Math.round(view.dynamicBlocks.totalWidthPx);
70
- return exportSVG ? (react_1.default.createElement(react_1.default.Fragment, null, children)) : (react_1.default.createElement("svg", { width: width, height: height }, children));
70
+ return exportSVG ? (children) : (react_1.default.createElement("svg", { width: width, height: height }, children));
71
71
  });
72
72
  const Arcs = (0, mobx_react_1.observer)(function ({ model, exportSVG, }) {
73
73
  const view = (0, util_1.getContainingView)(model);
@@ -1,13 +1,42 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
5
28
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const react_1 = __importDefault(require("react"));
29
+ const react_1 = __importStar(require("react"));
30
+ const material_1 = require("@mui/material");
7
31
  const ui_1 = require("@jbrowse/core/ui");
8
32
  const plugin_linear_genome_view_1 = require("@jbrowse/plugin-linear-genome-view");
9
33
  const mui_1 = require("tss-react/mui");
10
34
  const mobx_react_1 = require("mobx-react");
35
+ // icons
36
+ const Refresh_1 = __importDefault(require("@mui/icons-material/Refresh"));
37
+ const Report_1 = __importDefault(require("@mui/icons-material/Report"));
38
+ const util_1 = require("@jbrowse/core/util");
39
+ const ErrorMessageStackTraceDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('@jbrowse/core/ui/ErrorMessageStackTraceDialog'))));
11
40
  const useStyles = (0, mui_1.makeStyles)()(theme => ({
12
41
  loading: {
13
42
  backgroundColor: theme.palette.background.default,
@@ -23,7 +52,18 @@ const useStyles = (0, mui_1.makeStyles)()(theme => ({
23
52
  }));
24
53
  const BaseDisplayComponent = (0, mobx_react_1.observer)(function ({ model, children, }) {
25
54
  const { error, regionTooLarge } = model;
26
- return error ? (react_1.default.createElement(plugin_linear_genome_view_1.BlockMsg, { message: `${error}`, severity: "error", buttonText: "Reload", action: model.reload })) : regionTooLarge ? (model.regionCannotBeRendered()) : (react_1.default.createElement(DataDisplay, { model: model }, children));
55
+ return error ? (react_1.default.createElement(plugin_linear_genome_view_1.BlockMsg, { message: `${error}`, severity: "error", action: react_1.default.createElement(react_1.default.Fragment, null,
56
+ react_1.default.createElement(material_1.Tooltip, { title: "Reload" },
57
+ react_1.default.createElement(material_1.IconButton, { "data-testid": "reload_button", onClick: () => model.reload() },
58
+ react_1.default.createElement(Refresh_1.default, null))),
59
+ react_1.default.createElement(material_1.Tooltip, { title: "Show stack trace" },
60
+ react_1.default.createElement(material_1.IconButton, { onClick: () => {
61
+ (0, util_1.getSession)(model).queueDialog(onClose => [
62
+ ErrorMessageStackTraceDialog,
63
+ { onClose, error: model.error },
64
+ ]);
65
+ } },
66
+ react_1.default.createElement(Report_1.default, null)))) })) : regionTooLarge ? (model.regionCannotBeRendered()) : (react_1.default.createElement(DataDisplay, { model: model }, children));
27
67
  });
28
68
  const DataDisplay = (0, mobx_react_1.observer)(function ({ model, children, }) {
29
69
  const { loading } = model;
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  import { LinearArcDisplayModel } from '../model';
3
3
  declare const LinearArcReactComponent: ({ model, exportSVG, }: {
4
4
  model: LinearArcDisplayModel;
5
- exportSVG?: boolean | undefined;
5
+ exportSVG?: boolean;
6
6
  }) => React.JSX.Element;
7
7
  export default LinearArcReactComponent;
@@ -6,7 +6,7 @@ const util_1 = require("@jbrowse/core/util");
6
6
  function makeFeaturePair(feature, alt) {
7
7
  var _a, _b, _c, _d;
8
8
  const bnd = alt ? (0, vcf_1.parseBreakend)(alt) : undefined;
9
- let start = feature.get('start');
9
+ const start = feature.get('start');
10
10
  let end = feature.get('end');
11
11
  const strand = feature.get('strand');
12
12
  const mate = feature.get('mate');
@@ -29,7 +29,6 @@ function makeFeaturePair(feature, alt) {
29
29
  mateStart = e - 1;
30
30
  // re-adjust the arc to be from start to end of feature by re-assigning end
31
31
  // to the 'mate'
32
- start = start;
33
32
  end = start + 1;
34
33
  }
35
34
  else if (bnd === null || bnd === void 0 ? void 0 : bnd.MatePosition) {
@@ -20,10 +20,8 @@ function Arc({ selectedFeatureId, region, bpPerPx, config, onFeatureClick, featu
20
20
  const ref = React.createRef();
21
21
  const t = 0.5;
22
22
  // formula: https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B%C3%A9zier_curves
23
- const textYCoord = (1 - t) * (1 - t) * (1 - t) * 0 +
24
- 3 * ((1 - t) * (1 - t)) * (t * height) +
25
- 3 * (1 - t) * (t * t) * height +
26
- t * t * t * 0;
23
+ const t1 = 1 - t;
24
+ const textYCoord = 3 * (t1 * t1) * (t * height) + 3 * t1 * (t * t) * height;
27
25
  return (React.createElement("g", null,
28
26
  React.createElement("path", { d: `M ${left} 0 C ${left} ${height}, ${right} ${height}, ${right} 0`, stroke: stroke, strokeWidth: strokeWidth, fill: "transparent", onClick: e => onFeatureClick === null || onFeatureClick === void 0 ? void 0 : onFeatureClick(e, featureId), onMouseOver: () => setIsMouseOvered(true), onMouseLeave: () => setIsMouseOvered(false), ref: ref, pointerEvents: "stroke" }),
29
27
  isMouseOvered ? React.createElement(ArcTooltip, { contents: caption }) : null,
@@ -82,6 +80,6 @@ const ArcRendering = observer(function ({ features, config, regions, bpPerPx, he
82
80
  return (React.createElement(Wrapper, { exportSVG: exportSVG, width: width, height: height }, [...features.values()].map(f => semicircles ? (React.createElement(SemiCircles, { key: f.id(), config: config, region: region, bpPerPx: bpPerPx, selectedFeatureId: selectedFeatureId, feature: f })) : (React.createElement(Arc, { key: f.id(), config: config, region: region, bpPerPx: bpPerPx, selectedFeatureId: selectedFeatureId, feature: f })))));
83
81
  });
84
82
  function Wrapper({ exportSVG, width, height, children, }) {
85
- return exportSVG ? (React.createElement(React.Fragment, null, children)) : (React.createElement("svg", { width: width, height: height }, children));
83
+ return exportSVG ? (children) : (React.createElement("svg", { width: width, height: height }, children));
86
84
  }
87
85
  export default ArcRendering;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
2
  declare const ArcTooltip: ({ contents }: {
3
- contents?: string | undefined;
3
+ contents?: string;
4
4
  }) => React.JSX.Element | null;
5
5
  export default ArcTooltip;
@@ -43,8 +43,18 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
43
43
  message: string | undefined;
44
44
  maxHeightReached: boolean;
45
45
  ReactComponent: ({ model, }: {
46
- model: any;
47
- }) => any;
46
+ /**
47
+ * #getter
48
+ */
49
+ model: {
50
+ error?: unknown;
51
+ reload: () => void;
52
+ message: import("react").ReactNode;
53
+ filled?: boolean | undefined;
54
+ status?: string | undefined;
55
+ reactElement?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
56
+ };
57
+ }) => import("react").JSX.Element | undefined;
48
58
  renderProps: any;
49
59
  } & {
50
60
  doReload(): void;
@@ -323,8 +333,18 @@ export declare function stateModelFactory(configSchema: AnyConfigurationSchemaTy
323
333
  message: string | undefined;
324
334
  maxHeightReached: boolean;
325
335
  ReactComponent: ({ model, }: {
326
- model: any;
327
- }) => any;
336
+ /**
337
+ * #getter
338
+ */
339
+ model: {
340
+ error?: unknown;
341
+ reload: () => void;
342
+ message: import("react").ReactNode;
343
+ filled?: boolean | undefined;
344
+ status?: string | undefined;
345
+ reactElement?: import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
346
+ };
347
+ }) => import("react").JSX.Element | undefined;
328
348
  renderProps: any;
329
349
  } & {
330
350
  doReload(): void;
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  import { LinearArcDisplayModel } from '../model';
3
3
  declare const Arcs: ({ model, exportSVG, }: {
4
4
  model: LinearArcDisplayModel;
5
- exportSVG?: boolean | undefined;
5
+ exportSVG?: boolean;
6
6
  }) => React.JSX.Element | null;
7
7
  export default Arcs;
@@ -39,7 +39,7 @@ const Wrapper = observer(function ({ model, exportSVG, children, }) {
39
39
  const { height } = model;
40
40
  const view = getContainingView(model);
41
41
  const width = Math.round(view.dynamicBlocks.totalWidthPx);
42
- return exportSVG ? (React.createElement(React.Fragment, null, children)) : (React.createElement("svg", { width: width, height: height }, children));
42
+ return exportSVG ? (children) : (React.createElement("svg", { width: width, height: height }, children));
43
43
  });
44
44
  const Arcs = observer(function ({ model, exportSVG, }) {
45
45
  const view = getContainingView(model);
@@ -1,8 +1,14 @@
1
- import React from 'react';
1
+ import React, { lazy } from 'react';
2
+ import { IconButton, Tooltip } from '@mui/material';
2
3
  import { LoadingEllipses } from '@jbrowse/core/ui';
3
4
  import { BlockMsg } from '@jbrowse/plugin-linear-genome-view';
4
5
  import { makeStyles } from 'tss-react/mui';
5
6
  import { observer } from 'mobx-react';
7
+ // icons
8
+ import RefreshIcon from '@mui/icons-material/Refresh';
9
+ import ReportIcon from '@mui/icons-material/Report';
10
+ import { getSession } from '@jbrowse/core/util';
11
+ const ErrorMessageStackTraceDialog = lazy(() => import('@jbrowse/core/ui/ErrorMessageStackTraceDialog'));
6
12
  const useStyles = makeStyles()(theme => ({
7
13
  loading: {
8
14
  backgroundColor: theme.palette.background.default,
@@ -18,7 +24,18 @@ const useStyles = makeStyles()(theme => ({
18
24
  }));
19
25
  const BaseDisplayComponent = observer(function ({ model, children, }) {
20
26
  const { error, regionTooLarge } = model;
21
- return error ? (React.createElement(BlockMsg, { message: `${error}`, severity: "error", buttonText: "Reload", action: model.reload })) : regionTooLarge ? (model.regionCannotBeRendered()) : (React.createElement(DataDisplay, { model: model }, children));
27
+ return error ? (React.createElement(BlockMsg, { message: `${error}`, severity: "error", action: React.createElement(React.Fragment, null,
28
+ React.createElement(Tooltip, { title: "Reload" },
29
+ React.createElement(IconButton, { "data-testid": "reload_button", onClick: () => model.reload() },
30
+ React.createElement(RefreshIcon, null))),
31
+ React.createElement(Tooltip, { title: "Show stack trace" },
32
+ React.createElement(IconButton, { onClick: () => {
33
+ getSession(model).queueDialog(onClose => [
34
+ ErrorMessageStackTraceDialog,
35
+ { onClose, error: model.error },
36
+ ]);
37
+ } },
38
+ React.createElement(ReportIcon, null)))) })) : regionTooLarge ? (model.regionCannotBeRendered()) : (React.createElement(DataDisplay, { model: model }, children));
22
39
  });
23
40
  const DataDisplay = observer(function ({ model, children, }) {
24
41
  const { loading } = model;
@@ -2,6 +2,6 @@ import React from 'react';
2
2
  import { LinearArcDisplayModel } from '../model';
3
3
  declare const LinearArcReactComponent: ({ model, exportSVG, }: {
4
4
  model: LinearArcDisplayModel;
5
- exportSVG?: boolean | undefined;
5
+ exportSVG?: boolean;
6
6
  }) => React.JSX.Element;
7
7
  export default LinearArcReactComponent;
@@ -3,7 +3,7 @@ import { assembleLocString } from '@jbrowse/core/util';
3
3
  export function makeFeaturePair(feature, alt) {
4
4
  var _a, _b, _c, _d;
5
5
  const bnd = alt ? parseBreakend(alt) : undefined;
6
- let start = feature.get('start');
6
+ const start = feature.get('start');
7
7
  let end = feature.get('end');
8
8
  const strand = feature.get('strand');
9
9
  const mate = feature.get('mate');
@@ -26,7 +26,6 @@ export function makeFeaturePair(feature, alt) {
26
26
  mateStart = e - 1;
27
27
  // re-adjust the arc to be from start to end of feature by re-assigning end
28
28
  // to the 'mate'
29
- start = start;
30
29
  end = start + 1;
31
30
  }
32
31
  else if (bnd === null || bnd === void 0 ? void 0 : bnd.MatePosition) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jbrowse/plugin-arc",
3
- "version": "2.10.2",
3
+ "version": "2.11.0",
4
4
  "description": "JBrowse 2 arc adapters, tracks, etc.",
5
5
  "keywords": [
6
6
  "jbrowse",
@@ -53,5 +53,5 @@
53
53
  "publishConfig": {
54
54
  "access": "public"
55
55
  },
56
- "gitHead": "7ca3b7db337ebd88853e2d96cdab940ed550c4fb"
56
+ "gitHead": "3d43a820b9274a6160aa4dc15616147f390d9094"
57
57
  }