@jbrowse/core 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.
- package/BaseFeatureWidget/BaseFeatureDetail/Attributes.js +1 -1
- package/BaseFeatureWidget/configSchema.d.ts +2 -0
- package/BaseFeatureWidget/configSchema.js +6 -0
- package/BaseFeatureWidget/index.d.ts +2 -128
- package/BaseFeatureWidget/index.js +4 -168
- package/BaseFeatureWidget/stateModelFactory.d.ts +126 -0
- package/BaseFeatureWidget/stateModelFactory.js +168 -0
- package/Plugin.d.ts +1 -1
- package/Plugin.js +0 -3
- package/PluginLoader.d.ts +1 -1
- package/PluginLoader.js +1 -0
- package/PluginManager.d.ts +13 -9
- package/PluginManager.js +8 -3
- package/ReExports/modules.d.ts +8 -2
- package/ReExports/modules.js +16 -5
- package/package.json +3 -3
- package/pluggableElementTypes/models/BaseTrackModel.d.ts +1 -0
- package/pluggableElementTypes/models/BaseTrackModel.js +2 -1
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +1 -0
- package/pluggableElementTypes/renderers/ServerSideRenderedContent.js +3 -2
- package/rpc/BaseRpcDriver.d.ts +3 -3
- package/rpc/BaseRpcDriver.js +1 -0
- package/rpc/WebWorkerRpcDriver.d.ts +2 -3
- package/rpc/WebWorkerRpcDriver.js +1 -1
- package/rpc/methods/CoreRender.d.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AssemblySelector.d.ts +5 -5
- package/ui/CascadingMenuButton.d.ts +6 -6
- package/ui/Dialog.js +1 -1
- package/ui/ErrorMessage.d.ts +2 -1
- package/ui/ErrorMessage.js +16 -3
- package/ui/ErrorMessageStackTraceDialog.d.ts +3 -2
- package/ui/ErrorMessageStackTraceDialog.js +61 -31
- package/ui/FileSelector/FileSelector.d.ts +5 -5
- package/ui/FileSelector/UrlChooser.d.ts +2 -2
- package/ui/MenuButton.d.ts +5 -5
- package/ui/SnackbarModel.d.ts +21 -30
- package/ui/SnackbarModel.js +87 -50
- package/ui/Tooltip.d.ts +2 -2
- package/ui/theme.d.ts +38 -0
- package/ui/theme.js +121 -104
- package/util/Base1DViewModel.d.ts +1 -1
- package/util/index.d.ts +3 -1
- package/util/index.js +16 -5
- package/util/io/RemoteFileWithRangeCache.js +14 -31
- package/util/jexl.js +1 -0
- package/util/offscreenCanvasUtils.js +2 -2
- package/util/tracks.js +1 -1
- package/util/types/index.d.ts +2 -5
- package/util/types/index.js +0 -1
package/ui/AssemblySelector.d.ts
CHANGED
|
@@ -3,11 +3,11 @@ import { InputProps as IIP, TextFieldProps as TFP } from '@mui/material';
|
|
|
3
3
|
import { AbstractSessionModel } from '../util';
|
|
4
4
|
declare const AssemblySelector: ({ session, onChange, selected, InputProps, TextFieldProps, localStorageKey, helperText, }: {
|
|
5
5
|
session: AbstractSessionModel;
|
|
6
|
-
helperText?: string
|
|
6
|
+
helperText?: string;
|
|
7
7
|
onChange: (arg: string) => void;
|
|
8
|
-
selected?: string
|
|
9
|
-
localStorageKey?: string
|
|
10
|
-
InputProps?: IIP
|
|
11
|
-
TextFieldProps?: TFP
|
|
8
|
+
selected?: string;
|
|
9
|
+
localStorageKey?: string;
|
|
10
|
+
InputProps?: IIP;
|
|
11
|
+
TextFieldProps?: TFP;
|
|
12
12
|
}) => React.JSX.Element;
|
|
13
13
|
export default AssemblySelector;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MenuItem } from '@jbrowse/core/ui';
|
|
3
3
|
declare const CascadingMenuButton: ({ children, menuItems, closeAfterItemClick, stopPropagation, setOpen, onClick: onClickExtra, ...rest }: {
|
|
4
|
-
|
|
5
|
-
children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
4
|
+
children?: React.ReactElement;
|
|
6
5
|
menuItems: MenuItem[];
|
|
7
|
-
closeAfterItemClick?: boolean
|
|
8
|
-
stopPropagation?: boolean
|
|
9
|
-
onClick?: (
|
|
10
|
-
setOpen?: (
|
|
6
|
+
closeAfterItemClick?: boolean;
|
|
7
|
+
stopPropagation?: boolean;
|
|
8
|
+
onClick?: () => void;
|
|
9
|
+
setOpen?: (arg: boolean) => void;
|
|
10
|
+
[key: string]: unknown;
|
|
11
11
|
}) => React.JSX.Element;
|
|
12
12
|
export default CascadingMenuButton;
|
package/ui/Dialog.js
CHANGED
|
@@ -30,7 +30,7 @@ const Dialog = (0, mobx_react_1.observer)(function (props) {
|
|
|
30
30
|
const theme = (0, material_1.useTheme)();
|
|
31
31
|
return (react_1.default.createElement(material_1.Dialog, { ...props },
|
|
32
32
|
react_1.default.createElement(material_1.ScopedCssBaseline, null,
|
|
33
|
-
react_1.default.isValidElement(header) ? (
|
|
33
|
+
react_1.default.isValidElement(header) ? (header) : (react_1.default.createElement(material_1.DialogTitle, null,
|
|
34
34
|
title,
|
|
35
35
|
onClose ? (react_1.default.createElement(material_1.IconButton, { className: classes.closeButton, onClick: () => {
|
|
36
36
|
// @ts-expect-error
|
package/ui/ErrorMessage.d.ts
CHANGED
package/ui/ErrorMessage.js
CHANGED
|
@@ -28,7 +28,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const react_1 = __importStar(require("react"));
|
|
30
30
|
const material_1 = require("@mui/material");
|
|
31
|
+
// locals
|
|
31
32
|
const RedErrorMessageBox_1 = __importDefault(require("./RedErrorMessageBox"));
|
|
33
|
+
// icons
|
|
34
|
+
const Refresh_1 = __importDefault(require("@mui/icons-material/Refresh"));
|
|
35
|
+
const Report_1 = __importDefault(require("@mui/icons-material/Report"));
|
|
36
|
+
// lazies
|
|
32
37
|
const ErrorMessageStackTraceDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('./ErrorMessageStackTraceDialog'))));
|
|
33
38
|
function parseError(str) {
|
|
34
39
|
let snapshotError = '';
|
|
@@ -53,13 +58,21 @@ function parseError(str) {
|
|
|
53
58
|
}
|
|
54
59
|
return snapshotError;
|
|
55
60
|
}
|
|
56
|
-
const ErrorMessage = ({ error }) => {
|
|
61
|
+
const ErrorMessage = ({ error, onReset, }) => {
|
|
57
62
|
const str = `${error}`;
|
|
63
|
+
const str2 = str.indexOf('expected an instance of');
|
|
64
|
+
const str3 = str2 !== -1 ? str.slice(0, str2) : str;
|
|
58
65
|
const snapshotError = parseError(str);
|
|
59
66
|
const [showStack, setShowStack] = (0, react_1.useState)(false);
|
|
60
67
|
return (react_1.default.createElement(RedErrorMessageBox_1.default, null,
|
|
61
|
-
|
|
62
|
-
|
|
68
|
+
str3.slice(0, 10000),
|
|
69
|
+
react_1.default.createElement("div", { style: { float: 'right', marginLeft: 100 } },
|
|
70
|
+
typeof error === 'object' && error && 'stack' in error ? (react_1.default.createElement(material_1.Tooltip, { title: "Get stack trace" },
|
|
71
|
+
react_1.default.createElement(material_1.IconButton, { onClick: () => setShowStack(true), color: "primary" },
|
|
72
|
+
react_1.default.createElement(Report_1.default, null)))) : null,
|
|
73
|
+
onReset ? (react_1.default.createElement(material_1.Tooltip, { title: "Retry" },
|
|
74
|
+
react_1.default.createElement(material_1.IconButton, { onClick: onReset, color: "primary" },
|
|
75
|
+
react_1.default.createElement(Refresh_1.default, null)))) : null),
|
|
63
76
|
snapshotError ? (react_1.default.createElement("pre", { style: {
|
|
64
77
|
background: 'lightgrey',
|
|
65
78
|
border: '1px solid black',
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export default function ErrorMessageStackTraceDialog({ error, onClose, }: {
|
|
2
|
+
export default function ErrorMessageStackTraceDialog({ error, onClose, extra, }: {
|
|
3
3
|
onClose: () => void;
|
|
4
|
-
error:
|
|
4
|
+
error: unknown;
|
|
5
|
+
extra?: unknown;
|
|
5
6
|
}): React.JSX.Element;
|
|
@@ -33,6 +33,24 @@ const copy_to_clipboard_1 = __importDefault(require("copy-to-clipboard"));
|
|
|
33
33
|
// locals
|
|
34
34
|
const Dialog_1 = __importDefault(require("./Dialog"));
|
|
35
35
|
const LoadingEllipses_1 = __importDefault(require("./LoadingEllipses"));
|
|
36
|
+
function Link2({ href, children, }) {
|
|
37
|
+
return (react_1.default.createElement(material_1.Link, { target: "_blank", href: href }, children));
|
|
38
|
+
}
|
|
39
|
+
async function myfetch(uri) {
|
|
40
|
+
const res = await fetch(uri);
|
|
41
|
+
if (!res.ok) {
|
|
42
|
+
throw new Error(`HTTP ${res.status} fetching ${uri}: ${await res.text()}`);
|
|
43
|
+
}
|
|
44
|
+
return res;
|
|
45
|
+
}
|
|
46
|
+
async function myfetchjson(uri) {
|
|
47
|
+
const res = await myfetch(uri);
|
|
48
|
+
return res.json();
|
|
49
|
+
}
|
|
50
|
+
async function myfetchtext(uri) {
|
|
51
|
+
const res = await myfetch(uri);
|
|
52
|
+
return res.text();
|
|
53
|
+
}
|
|
36
54
|
// produce a source-map resolved stack trace
|
|
37
55
|
// reference code https://stackoverflow.com/a/77158517/2129219
|
|
38
56
|
const sourceMaps = {};
|
|
@@ -42,11 +60,12 @@ async function getSourceMapFromUri(uri) {
|
|
|
42
60
|
return sourceMaps[uri];
|
|
43
61
|
}
|
|
44
62
|
const uriQuery = new URL(uri).search;
|
|
45
|
-
const currentScriptContent = await (
|
|
63
|
+
const currentScriptContent = await myfetchtext(uri);
|
|
46
64
|
let mapUri = ((_a = new RegExp(/\/\/# sourceMappingURL=(.*)/).exec(currentScriptContent)) === null || _a === void 0 ? void 0 : _a[1]) ||
|
|
47
65
|
'';
|
|
48
66
|
mapUri = new URL(mapUri, uri).href + uriQuery;
|
|
49
|
-
const
|
|
67
|
+
const data = await myfetchjson(mapUri);
|
|
68
|
+
const map = new source_map_js_1.SourceMapConsumer(data);
|
|
50
69
|
sourceMaps[uri] = map;
|
|
51
70
|
return map;
|
|
52
71
|
}
|
|
@@ -54,13 +73,13 @@ async function mapStackTrace(stack) {
|
|
|
54
73
|
const stackLines = stack.split('\n');
|
|
55
74
|
const mappedStack = [];
|
|
56
75
|
for (const line of stackLines) {
|
|
57
|
-
const match = new RegExp(/(.*)(
|
|
76
|
+
const match = new RegExp(/(.*)(https?:\/\/.*):(\d+):(\d+)/).exec(line);
|
|
58
77
|
if (match === null) {
|
|
59
78
|
mappedStack.push(line);
|
|
60
79
|
continue;
|
|
61
80
|
}
|
|
62
81
|
const uri = match[2];
|
|
63
|
-
const consumer =
|
|
82
|
+
const consumer = await getSourceMapFromUri(uri);
|
|
64
83
|
const originalPosition = consumer.originalPositionFor({
|
|
65
84
|
line: parseInt(match[3]),
|
|
66
85
|
column: parseInt(match[4]),
|
|
@@ -88,12 +107,42 @@ function stripMessage(trace, error) {
|
|
|
88
107
|
return trace;
|
|
89
108
|
}
|
|
90
109
|
}
|
|
91
|
-
function
|
|
110
|
+
function Contents({ text, extra }) {
|
|
111
|
+
const err = encodeURIComponent([
|
|
112
|
+
'I got this error from JBrowse, here is the stack trace:\n',
|
|
113
|
+
'```',
|
|
114
|
+
text,
|
|
115
|
+
'```',
|
|
116
|
+
extra ? `supporting data: ${JSON.stringify(extra, null, 2)}` : '',
|
|
117
|
+
].join('\n') + '\n');
|
|
118
|
+
const err2 = [
|
|
119
|
+
text,
|
|
120
|
+
extra ? `supporting data: ${JSON.stringify(extra, null, 2)}` : '',
|
|
121
|
+
].join('\n');
|
|
122
|
+
const email = 'jbrowse2@berkeley.edu';
|
|
123
|
+
const githubLink = `https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${err}`;
|
|
124
|
+
const emailLink = `mailto:${email}?subject=JBrowse%202%20error&body=${err}`;
|
|
125
|
+
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
126
|
+
react_1.default.createElement(material_1.Typography, null,
|
|
127
|
+
"Post a new issue at ",
|
|
128
|
+
react_1.default.createElement(Link2, { href: githubLink }, "GitHub"),
|
|
129
|
+
" or send an email to ",
|
|
130
|
+
react_1.default.createElement(Link2, { href: emailLink }, email),
|
|
131
|
+
' '),
|
|
132
|
+
react_1.default.createElement("pre", { style: {
|
|
133
|
+
background: 'lightgrey',
|
|
134
|
+
border: '1px solid black',
|
|
135
|
+
overflow: 'auto',
|
|
136
|
+
margin: 20,
|
|
137
|
+
maxHeight: 300,
|
|
138
|
+
} }, err2)));
|
|
139
|
+
}
|
|
140
|
+
function ErrorMessageStackTraceDialog({ error, onClose, extra, }) {
|
|
92
141
|
const [mappedStackTrace, setMappedStackTrace] = (0, react_1.useState)();
|
|
93
142
|
const [secondaryError, setSecondaryError] = (0, react_1.useState)();
|
|
94
143
|
const [clicked, setClicked] = (0, react_1.useState)(false);
|
|
95
|
-
const stackTracePreProcessed = `${error.stack}`;
|
|
96
|
-
const errorText = `${error}
|
|
144
|
+
const stackTracePreProcessed = `${typeof error === 'object' && error !== null && 'stack' in error ? error.stack : ''}`;
|
|
145
|
+
const errorText = error ? `${error}` : '';
|
|
97
146
|
const stackTrace = stripMessage(stackTracePreProcessed, errorText);
|
|
98
147
|
(0, react_1.useEffect)(() => {
|
|
99
148
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
@@ -115,35 +164,16 @@ function ErrorMessageStackTraceDialog({ error, onClose, }) {
|
|
|
115
164
|
? 'Error loading source map, showing raw stack trace below:'
|
|
116
165
|
: '',
|
|
117
166
|
errorText.length > MAX_ERR_LEN
|
|
118
|
-
? errorText.slice(0, MAX_ERR_LEN)
|
|
167
|
+
? `${errorText.slice(0, MAX_ERR_LEN)}...`
|
|
119
168
|
: errorText,
|
|
120
169
|
mappedStackTrace || 'No stack trace available',
|
|
121
170
|
// @ts-expect-error add version info at bottom if we are in jbrowse-web
|
|
122
171
|
window.JBrowseSession ? `JBrowse ${window.JBrowseSession.version}` : '',
|
|
123
|
-
]
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
'\n```\n');
|
|
127
|
-
const githubLink = `https://github.com/GMOD/jbrowse-components/issues/new?labels=bug&title=JBrowse+issue&body=${err}`;
|
|
128
|
-
const emailLink = `mailto:jbrowse2dev@gmail.com?subject=JBrowse%202%20error&body=${err}`;
|
|
172
|
+
]
|
|
173
|
+
.filter(f => !!f)
|
|
174
|
+
.join('\n');
|
|
129
175
|
return (react_1.default.createElement(Dialog_1.default, { open: true, onClose: onClose, title: "Stack trace", maxWidth: "xl" },
|
|
130
|
-
react_1.default.createElement(material_1.DialogContent, null, mappedStackTrace === undefined ? (react_1.default.createElement(LoadingEllipses_1.default, { variant: "h6" })) : (react_1.default.createElement(
|
|
131
|
-
react_1.default.createElement(material_1.Typography, null,
|
|
132
|
-
"Post a new issue at",
|
|
133
|
-
' ',
|
|
134
|
-
react_1.default.createElement(material_1.Link, { href: githubLink, target: "_blank" }, "GitHub"),
|
|
135
|
-
' ',
|
|
136
|
-
"or send an email to",
|
|
137
|
-
' ',
|
|
138
|
-
react_1.default.createElement(material_1.Link, { href: emailLink, target: "_blank" }, "jbrowse2dev@gmail.com"),
|
|
139
|
-
' '),
|
|
140
|
-
react_1.default.createElement("pre", { style: {
|
|
141
|
-
background: 'lightgrey',
|
|
142
|
-
border: '1px solid black',
|
|
143
|
-
overflow: 'auto',
|
|
144
|
-
margin: 20,
|
|
145
|
-
maxHeight: 300,
|
|
146
|
-
} }, errorBoxText)))),
|
|
176
|
+
react_1.default.createElement(material_1.DialogContent, null, mappedStackTrace === undefined ? (react_1.default.createElement(LoadingEllipses_1.default, { variant: "h6" })) : (react_1.default.createElement(Contents, { text: errorBoxText, extra: extra }))),
|
|
147
177
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
148
178
|
react_1.default.createElement(material_1.Button, { variant: "contained", color: "secondary", onClick: () => {
|
|
149
179
|
(0, copy_to_clipboard_1.default)(errorBoxText);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileLocation, AbstractRootModel } from '../../util/types';
|
|
3
3
|
declare const FileSelector: (props: {
|
|
4
|
-
location?: FileLocation
|
|
4
|
+
location?: FileLocation;
|
|
5
5
|
setLocation: (param: FileLocation) => void;
|
|
6
|
-
setName?: (
|
|
7
|
-
name?: string
|
|
8
|
-
description?: string
|
|
9
|
-
rootModel?: AbstractRootModel
|
|
6
|
+
setName?: (str: string) => void;
|
|
7
|
+
name?: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
rootModel?: AbstractRootModel;
|
|
10
10
|
}) => React.JSX.Element;
|
|
11
11
|
export default FileSelector;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FileLocation } from '../../util/types';
|
|
3
3
|
declare const UrlChooser: ({ location, setLocation, label, }: {
|
|
4
|
-
location?: FileLocation
|
|
4
|
+
location?: FileLocation;
|
|
5
5
|
setLocation: (arg: FileLocation) => void;
|
|
6
|
-
label?: string
|
|
6
|
+
label?: string;
|
|
7
7
|
}) => React.JSX.Element;
|
|
8
8
|
export default UrlChooser;
|
package/ui/MenuButton.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { MenuItem } from '@jbrowse/core/ui';
|
|
3
3
|
declare const MenuButton: ({ children, menuItems, closeAfterItemClick, stopPropagation, setOpen, ...rest }: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
children?: React.ReactElement<any, string | React.JSXElementConstructor<any>> | undefined;
|
|
4
|
+
closeAfterItemClick?: boolean;
|
|
5
|
+
children?: React.ReactElement;
|
|
7
6
|
menuItems: MenuItem[];
|
|
8
|
-
stopPropagation?: boolean
|
|
9
|
-
setOpen?: (
|
|
7
|
+
stopPropagation?: boolean;
|
|
8
|
+
setOpen?: (arg: boolean) => void;
|
|
9
|
+
[key: string]: unknown;
|
|
10
10
|
}) => React.JSX.Element;
|
|
11
11
|
export default MenuButton;
|
package/ui/SnackbarModel.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { IModelType, ModelProperties } from 'mobx-state-tree';
|
|
2
|
-
import { IObservableArray } from 'mobx';
|
|
3
1
|
import { NotificationLevel, SnackAction } from '../util/types';
|
|
4
2
|
export interface SnackbarMessage {
|
|
5
3
|
message: string;
|
|
@@ -10,31 +8,24 @@ export interface SnackbarMessage {
|
|
|
10
8
|
* #stateModel SnackbarModel
|
|
11
9
|
* #category session
|
|
12
10
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
* #action
|
|
35
|
-
*/
|
|
36
|
-
removeSnackbarMessage(message: string): void;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export default function addSnackbarToModel<PROPS extends ModelProperties, OTHERS>(tree: IModelType<PROPS, OTHERS>): IModelType<PROPS, OTHERS & ReturnType<typeof makeExtension>['actions'] & ReturnType<typeof makeExtension>['views']>;
|
|
40
|
-
export {};
|
|
11
|
+
export default function SnackbarModel(): import("mobx-state-tree").IModelType<{}, {
|
|
12
|
+
snackbarMessages: import("mobx").IObservableArray<SnackbarMessage>;
|
|
13
|
+
} & {
|
|
14
|
+
/**
|
|
15
|
+
* #action
|
|
16
|
+
*/
|
|
17
|
+
notify(message: string, level?: NotificationLevel, action?: SnackAction): void;
|
|
18
|
+
notifyError(errorMessage: string, error?: unknown, extra?: unknown): void;
|
|
19
|
+
/**
|
|
20
|
+
* #action
|
|
21
|
+
*/
|
|
22
|
+
pushSnackbarMessage(message: string, level?: NotificationLevel, action?: SnackAction): number;
|
|
23
|
+
/**
|
|
24
|
+
* #action
|
|
25
|
+
*/
|
|
26
|
+
popSnackbarMessage(): SnackbarMessage | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* #action
|
|
29
|
+
*/
|
|
30
|
+
removeSnackbarMessage(message: string): void;
|
|
31
|
+
}, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>;
|
package/ui/SnackbarModel.js
CHANGED
|
@@ -1,60 +1,97 @@
|
|
|
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
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
2
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const mobx_state_tree_1 = require("mobx-state-tree");
|
|
3
31
|
const mobx_1 = require("mobx");
|
|
32
|
+
// icons
|
|
33
|
+
const Report_1 = __importDefault(require("@mui/icons-material/Report"));
|
|
34
|
+
// lazies
|
|
35
|
+
const ErrorMessageStackTraceDialog = (0, react_1.lazy)(() => Promise.resolve().then(() => __importStar(require('@jbrowse/core/ui/ErrorMessageStackTraceDialog'))));
|
|
4
36
|
/**
|
|
5
37
|
* #stateModel SnackbarModel
|
|
6
38
|
* #category session
|
|
7
39
|
*/
|
|
8
|
-
function
|
|
9
|
-
return
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
40
|
+
function SnackbarModel() {
|
|
41
|
+
return mobx_state_tree_1.types
|
|
42
|
+
.model({})
|
|
43
|
+
.volatile(() => ({
|
|
44
|
+
snackbarMessages: mobx_1.observable.array(),
|
|
45
|
+
}))
|
|
46
|
+
.actions(self => ({
|
|
47
|
+
/**
|
|
48
|
+
* #action
|
|
49
|
+
*/
|
|
50
|
+
notify(message, level, action) {
|
|
51
|
+
this.pushSnackbarMessage(message, level, action);
|
|
52
|
+
if (level === 'info' || level === 'success') {
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
this.removeSnackbarMessage(message);
|
|
55
|
+
}, 5000);
|
|
56
|
+
}
|
|
17
57
|
},
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
pushSnackbarMessage(message, level, action) {
|
|
34
|
-
return snackbarMessages.push({ message, level, action });
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* #action
|
|
38
|
-
*/
|
|
39
|
-
popSnackbarMessage() {
|
|
40
|
-
return snackbarMessages.pop();
|
|
41
|
-
},
|
|
42
|
-
/**
|
|
43
|
-
* #action
|
|
44
|
-
*/
|
|
45
|
-
removeSnackbarMessage(message) {
|
|
46
|
-
const element = snackbarMessages.find(f => f.message === message);
|
|
47
|
-
if (element) {
|
|
48
|
-
snackbarMessages.remove(element);
|
|
49
|
-
}
|
|
50
|
-
},
|
|
58
|
+
notifyError(errorMessage, error, extra) {
|
|
59
|
+
this.notify(errorMessage, 'error', {
|
|
60
|
+
name: react_1.default.createElement(Report_1.default, null),
|
|
61
|
+
onClick: () => {
|
|
62
|
+
// @ts-expect-error
|
|
63
|
+
self.queueDialog((onClose) => [
|
|
64
|
+
ErrorMessageStackTraceDialog,
|
|
65
|
+
{
|
|
66
|
+
onClose,
|
|
67
|
+
error,
|
|
68
|
+
extra,
|
|
69
|
+
},
|
|
70
|
+
]);
|
|
71
|
+
},
|
|
72
|
+
});
|
|
51
73
|
},
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
/**
|
|
75
|
+
* #action
|
|
76
|
+
*/
|
|
77
|
+
pushSnackbarMessage(message, level, action) {
|
|
78
|
+
return self.snackbarMessages.push({ message, level, action });
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* #action
|
|
82
|
+
*/
|
|
83
|
+
popSnackbarMessage() {
|
|
84
|
+
return self.snackbarMessages.pop();
|
|
85
|
+
},
|
|
86
|
+
/**
|
|
87
|
+
* #action
|
|
88
|
+
*/
|
|
89
|
+
removeSnackbarMessage(message) {
|
|
90
|
+
const element = self.snackbarMessages.find(f => f.message === message);
|
|
91
|
+
if (element) {
|
|
92
|
+
self.snackbarMessages.remove(element);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
}));
|
|
59
96
|
}
|
|
60
|
-
exports.default =
|
|
97
|
+
exports.default = SnackbarModel;
|
package/ui/Tooltip.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const Tooltip: ({ offsetX, offsetY, configuration, feature, timeout, }:
|
|
|
5
5
|
offsetX: number;
|
|
6
6
|
offsetY: number;
|
|
7
7
|
configuration: AnyConfigurationModel;
|
|
8
|
-
feature?: Feature
|
|
9
|
-
timeout?: number
|
|
8
|
+
feature?: Feature;
|
|
9
|
+
timeout?: number;
|
|
10
10
|
}) => React.JSX.Element | null;
|
|
11
11
|
export default Tooltip;
|
package/ui/theme.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ declare module '@mui/material/styles/createPalette' {
|
|
|
3
3
|
interface Palette {
|
|
4
4
|
tertiary: Palette['primary'];
|
|
5
5
|
quaternary: Palette['primary'];
|
|
6
|
+
highlight: Palette['primary'];
|
|
6
7
|
stopCodon?: string;
|
|
7
8
|
startCodon?: string;
|
|
8
9
|
bases: {
|
|
@@ -11,10 +12,29 @@ declare module '@mui/material/styles/createPalette' {
|
|
|
11
12
|
G: Palette['primary'];
|
|
12
13
|
T: Palette['primary'];
|
|
13
14
|
};
|
|
15
|
+
frames: [
|
|
16
|
+
null,
|
|
17
|
+
Palette['primary'] | undefined,
|
|
18
|
+
Palette['primary'] | undefined,
|
|
19
|
+
Palette['primary'] | undefined,
|
|
20
|
+
Palette['primary'] | undefined,
|
|
21
|
+
Palette['primary'] | undefined,
|
|
22
|
+
Palette['primary'] | undefined
|
|
23
|
+
];
|
|
24
|
+
framesCDS: [
|
|
25
|
+
null,
|
|
26
|
+
Palette['primary'] | undefined,
|
|
27
|
+
Palette['primary'] | undefined,
|
|
28
|
+
Palette['primary'] | undefined,
|
|
29
|
+
Palette['primary'] | undefined,
|
|
30
|
+
Palette['primary'] | undefined,
|
|
31
|
+
Palette['primary'] | undefined
|
|
32
|
+
];
|
|
14
33
|
}
|
|
15
34
|
interface PaletteOptions {
|
|
16
35
|
tertiary?: PaletteOptions['primary'];
|
|
17
36
|
quaternary?: PaletteOptions['primary'];
|
|
37
|
+
highlight?: PaletteOptions['primary'];
|
|
18
38
|
stopCodon?: string;
|
|
19
39
|
startCodon?: string;
|
|
20
40
|
bases?: {
|
|
@@ -23,6 +43,24 @@ declare module '@mui/material/styles/createPalette' {
|
|
|
23
43
|
G?: PaletteOptions['primary'];
|
|
24
44
|
T?: PaletteOptions['primary'];
|
|
25
45
|
};
|
|
46
|
+
framesCDS?: [
|
|
47
|
+
null,
|
|
48
|
+
Palette['primary'] | undefined,
|
|
49
|
+
Palette['primary'] | undefined,
|
|
50
|
+
Palette['primary'] | undefined,
|
|
51
|
+
Palette['primary'] | undefined,
|
|
52
|
+
Palette['primary'] | undefined,
|
|
53
|
+
Palette['primary'] | undefined
|
|
54
|
+
];
|
|
55
|
+
frames?: [
|
|
56
|
+
null,
|
|
57
|
+
Palette['primary'] | undefined,
|
|
58
|
+
Palette['primary'] | undefined,
|
|
59
|
+
Palette['primary'] | undefined,
|
|
60
|
+
Palette['primary'] | undefined,
|
|
61
|
+
Palette['primary'] | undefined,
|
|
62
|
+
Palette['primary'] | undefined
|
|
63
|
+
];
|
|
26
64
|
}
|
|
27
65
|
}
|
|
28
66
|
export declare const defaultThemes: ThemeMap;
|