@jbrowse/core 2.15.4 → 2.16.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/ui/Dialog.js CHANGED
@@ -7,7 +7,7 @@ const react_1 = __importDefault(require("react"));
7
7
  const material_1 = require("@mui/material");
8
8
  const mobx_react_1 = require("mobx-react");
9
9
  const mui_1 = require("tss-react/mui");
10
- const react_error_boundary_1 = require("react-error-boundary");
10
+ const ErrorBoundary_1 = require("@jbrowse/core/ui/ErrorBoundary");
11
11
  // icons
12
12
  const Close_1 = __importDefault(require("@mui/icons-material/Close"));
13
13
  // locals
@@ -39,7 +39,7 @@ const Dialog = (0, mobx_react_1.observer)(function (props) {
39
39
  } },
40
40
  react_1.default.createElement(Close_1.default, null))) : null)),
41
41
  react_1.default.createElement(material_1.Divider, null),
42
- react_1.default.createElement(react_error_boundary_1.ErrorBoundary, { FallbackComponent: DialogError },
42
+ react_1.default.createElement(ErrorBoundary_1.ErrorBoundary, { FallbackComponent: DialogError },
43
43
  react_1.default.createElement(material_1.ThemeProvider, { theme: (0, material_1.createTheme)(theme, {
44
44
  components: {
45
45
  MuiInputBase: {
@@ -0,0 +1,16 @@
1
+ import React, { Component, ErrorInfo } from 'react';
2
+ interface Props {
3
+ children: React.ReactNode;
4
+ FallbackComponent: React.FC<{
5
+ error: unknown;
6
+ }>;
7
+ }
8
+ interface State {
9
+ error: unknown;
10
+ }
11
+ declare class ErrorBoundary extends Component<Props, State> {
12
+ constructor(props: Props);
13
+ componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
14
+ render(): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
15
+ }
16
+ export { ErrorBoundary };
@@ -0,0 +1,41 @@
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
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.ErrorBoundary = void 0;
27
+ const react_1 = __importStar(require("react"));
28
+ class ErrorBoundary extends react_1.Component {
29
+ constructor(props) {
30
+ super(props);
31
+ this.state = { error: undefined };
32
+ }
33
+ componentDidCatch(error, errorInfo) {
34
+ console.error('ErrorBoundary caught an error:', error, errorInfo);
35
+ this.setState({ error });
36
+ }
37
+ render() {
38
+ return this.state.error ? (react_1.default.createElement(this.props.FallbackComponent, { error: this.state.error })) : (this.props.children);
39
+ }
40
+ }
41
+ exports.ErrorBoundary = ErrorBoundary;
package/util/index.js CHANGED
@@ -1104,14 +1104,14 @@ function localStorageSetItem(str, item) {
1104
1104
  function max(arr, init = Number.NEGATIVE_INFINITY) {
1105
1105
  let max = init;
1106
1106
  for (const entry of arr) {
1107
- max = entry > max ? entry : max;
1107
+ max = Math.max(entry, max);
1108
1108
  }
1109
1109
  return max;
1110
1110
  }
1111
1111
  function min(arr, init = Number.POSITIVE_INFINITY) {
1112
1112
  let min = init;
1113
1113
  for (const entry of arr) {
1114
- min = entry < min ? entry : min;
1114
+ min = Math.min(entry, min);
1115
1115
  }
1116
1116
  return min;
1117
1117
  }
@@ -1205,7 +1205,6 @@ function renderToStaticMarkup(node, createRootFn) {
1205
1205
  createRootFn(div).render(node);
1206
1206
  }
1207
1207
  else {
1208
- // eslint-disable-next-line @typescript-eslint/no-deprecated
1209
1208
  (0, react_dom_1.render)(node, div);
1210
1209
  }
1211
1210
  });