@jbrowse/core 1.7.7 → 1.7.10
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.d.ts +3 -6
- package/BaseFeatureWidget/BaseFeatureDetail.js +158 -103
- package/BaseFeatureWidget/index.d.ts +23 -2
- package/BaseFeatureWidget/index.js +98 -3
- package/assemblyManager/assemblyManager.d.ts +1 -1
- package/assemblyManager/assemblyManager.js +21 -27
- package/package.json +6 -2
- package/pluggableElementTypes/models/InternetAccountModel.d.ts +2 -2
- package/pluggableElementTypes/models/baseTrackConfig.js +20 -13
- package/pluggableElementTypes/renderers/ComparativeServerSideRendererType.js +6 -14
- package/pluggableElementTypes/renderers/ServerSideRendererType.d.ts +6 -0
- package/pluggableElementTypes/renderers/ServerSideRendererType.js +44 -2
- package/pluggableElementTypes/renderers/declare.d.js +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/ui/AboutDialog.d.ts +1 -1
- package/ui/AboutDialog.js +24 -7
- package/ui/CascadingMenu.d.ts +9 -0
- package/ui/CascadingMenu.js +211 -0
- package/ui/Menu.d.ts +10 -0
- package/ui/Menu.js +9 -14
- package/ui/SanitizedHTML.js +26 -4
- package/ui/SnackbarModel.d.ts +2 -2
- package/ui/index.d.ts +1 -0
- package/ui/index.js +9 -0
- package/util/declare.d.js +1 -0
- package/util/index.d.ts +3 -0
- package/util/index.js +35 -1
- package/util/jexl.js +42 -43
- package/util/offscreenCanvasPonyfill.d.ts +8 -1
- package/util/offscreenCanvasPonyfill.js +140 -12
- package/util/offscreenCanvasUtils.d.ts +19 -1
- package/util/offscreenCanvasUtils.js +146 -12
- package/util/types/index.d.ts +1 -1
- package/util/types/mst.d.ts +9 -9
- package/util/offscreenCanvas/Canvas2DContextShim/Canvas2DContextShim.test.js +0 -15
- package/util/offscreenCanvas/Canvas2DContextShim/context.d.ts +0 -56
- package/util/offscreenCanvas/Canvas2DContextShim/context.js +0 -356
- package/util/offscreenCanvas/Canvas2DContextShim/index.d.ts +0 -2
- package/util/offscreenCanvas/Canvas2DContextShim/index.js +0 -13
- package/util/offscreenCanvas/Canvas2DContextShim/svg.d.ts +0 -3
- package/util/offscreenCanvas/Canvas2DContextShim/svg.js +0 -210
- package/util/offscreenCanvas/Canvas2DContextShim/types.d.ts +0 -50
- package/util/offscreenCanvas/Canvas2DContextShim/types.js +0 -59
- package/util/offscreenCanvas/Canvas2DContextShim/util.d.ts +0 -12
- package/util/offscreenCanvas/Canvas2DContextShim/util.js +0 -91
- package/util/offscreenCanvas/CanvasShim.d.ts +0 -11
- package/util/offscreenCanvas/CanvasShim.js +0 -54
- package/util/offscreenCanvas/index.d.ts +0 -14
- package/util/offscreenCanvas/index.js +0 -170
- package/util/offscreenCanvas/ponyfill.d.ts +0 -6
- package/util/offscreenCanvas/ponyfill.js +0 -145
- package/util/offscreenCanvas/types.d.ts +0 -16
- package/util/offscreenCanvas/types.js +0 -14
package/ui/AboutDialog.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { AnyConfigurationModel } from '../configuration
|
|
2
|
+
import { AnyConfigurationModel } from '../configuration';
|
|
3
3
|
export default function AboutDialog({ config, handleClose, }: {
|
|
4
4
|
config: AnyConfigurationModel;
|
|
5
5
|
handleClose: () => void;
|
package/ui/AboutDialog.js
CHANGED
|
@@ -17,6 +17,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
17
17
|
|
|
18
18
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
19
|
|
|
20
|
+
var _copyToClipboard = _interopRequireDefault(require("copy-to-clipboard"));
|
|
21
|
+
|
|
20
22
|
var _core = require("@material-ui/core");
|
|
21
23
|
|
|
22
24
|
var _Close = _interopRequireDefault(require("@material-ui/icons/Close"));
|
|
@@ -57,6 +59,11 @@ function AboutDialog(_ref) {
|
|
|
57
59
|
error = _useState4[0],
|
|
58
60
|
setError = _useState4[1];
|
|
59
61
|
|
|
62
|
+
var _useState5 = (0, _react.useState)(false),
|
|
63
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
64
|
+
copied = _useState6[0],
|
|
65
|
+
setCopied = _useState6[1];
|
|
66
|
+
|
|
60
67
|
var session = (0, _util.getSession)(config);
|
|
61
68
|
var rpcManager = session.rpcManager;
|
|
62
69
|
var conf = (0, _configuration.readConfObject)(config);
|
|
@@ -112,12 +119,10 @@ function AboutDialog(_ref) {
|
|
|
112
119
|
var trackName = (0, _configuration.readConfObject)(config, 'name');
|
|
113
120
|
|
|
114
121
|
if ((0, _configuration.readConfObject)(config, 'type') === 'ReferenceSequenceTrack') {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (assembly.sequence === config.configuration) {
|
|
118
|
-
trackName = "Reference Sequence (".concat((0, _configuration.readConfObject)(assembly, 'name'), ")");
|
|
119
|
-
}
|
|
122
|
+
var asm = session.assemblies.find(function (a) {
|
|
123
|
+
return a.sequence === config.configuration;
|
|
120
124
|
});
|
|
125
|
+
trackName = asm ? "Reference Sequence (".concat((0, _configuration.readConfObject)(asm, 'name'), ")") : 'Reference Sequence';
|
|
121
126
|
}
|
|
122
127
|
|
|
123
128
|
var details = typeof info === 'string' ? {
|
|
@@ -133,14 +138,26 @@ function AboutDialog(_ref) {
|
|
|
133
138
|
}
|
|
134
139
|
}, /*#__PURE__*/_react.default.createElement(_Close.default, null))), /*#__PURE__*/_react.default.createElement(_core.DialogContent, null, /*#__PURE__*/_react.default.createElement(_BaseFeatureDetail.BaseCard, {
|
|
135
140
|
title: "Configuration"
|
|
136
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
141
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Button, {
|
|
142
|
+
variant: "contained",
|
|
143
|
+
style: {
|
|
144
|
+
float: 'right'
|
|
145
|
+
},
|
|
146
|
+
onClick: function onClick() {
|
|
147
|
+
(0, _copyToClipboard.default)(JSON.stringify(conf, null, 2));
|
|
148
|
+
setCopied(true);
|
|
149
|
+
setTimeout(function () {
|
|
150
|
+
return setCopied(false);
|
|
151
|
+
}, 1000);
|
|
152
|
+
}
|
|
153
|
+
}, copied ? 'Copied to clipboard!' : 'Copy config'), /*#__PURE__*/_react.default.createElement(_BaseFeatureDetail.Attributes, {
|
|
137
154
|
attributes: conf,
|
|
138
155
|
omit: ['displays', 'baseUri', 'refNames']
|
|
139
156
|
})), info !== null ? /*#__PURE__*/_react.default.createElement(_BaseFeatureDetail.BaseCard, {
|
|
140
157
|
title: "File info"
|
|
141
158
|
}, error ? /*#__PURE__*/_react.default.createElement(_core.Typography, {
|
|
142
159
|
color: "error"
|
|
143
|
-
}, "".concat(error)) :
|
|
160
|
+
}, "".concat(error)) : info === undefined ? 'Loading file data...' : /*#__PURE__*/_react.default.createElement(_BaseFeatureDetail.Attributes, {
|
|
144
161
|
attributes: details
|
|
145
162
|
})) : null));
|
|
146
163
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MenuItem as JBMenuItem } from './Menu';
|
|
3
|
+
import { PopupState } from 'material-ui-popup-state/hooks';
|
|
4
|
+
declare function CascadingMenuChildren(props: {
|
|
5
|
+
onMenuItemClick: Function;
|
|
6
|
+
menuItems: JBMenuItem[];
|
|
7
|
+
popupState: PopupState;
|
|
8
|
+
}): JSX.Element;
|
|
9
|
+
export default CascadingMenuChildren;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.default = void 0;
|
|
11
|
+
|
|
12
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
|
+
|
|
14
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
15
|
+
|
|
16
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
+
|
|
18
|
+
var _core = require("@material-ui/core");
|
|
19
|
+
|
|
20
|
+
var _Menu = require("./Menu");
|
|
21
|
+
|
|
22
|
+
var _hooks = require("material-ui-popup-state/hooks");
|
|
23
|
+
|
|
24
|
+
var _HoverMenu = _interopRequireDefault(require("material-ui-popup-state/HoverMenu"));
|
|
25
|
+
|
|
26
|
+
var _ChevronRight = _interopRequireDefault(require("@material-ui/icons/ChevronRight"));
|
|
27
|
+
|
|
28
|
+
var _excluded = ["onClick"],
|
|
29
|
+
_excluded2 = ["title", "inset", "popupId"],
|
|
30
|
+
_excluded3 = ["popupState", "onMenuItemClick", "menuItems", "classes"],
|
|
31
|
+
_excluded4 = ["popupState", "onMenuItemClick", "menuItems"],
|
|
32
|
+
_excluded5 = ["onMenuItemClick", "menuItems"];
|
|
33
|
+
|
|
34
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
35
|
+
|
|
36
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
+
|
|
38
|
+
var CascadingContext = /*#__PURE__*/_react.default.createContext({
|
|
39
|
+
parentPopupState: null,
|
|
40
|
+
rootPopupState: null
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
function CascadingMenuItem(_ref) {
|
|
44
|
+
var onClick = _ref.onClick,
|
|
45
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
46
|
+
|
|
47
|
+
var _useContext = (0, _react.useContext)(CascadingContext),
|
|
48
|
+
rootPopupState = _useContext.rootPopupState;
|
|
49
|
+
|
|
50
|
+
if (!rootPopupState) {
|
|
51
|
+
throw new Error('must be used inside a CascadingMenu');
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var handleClick = (0, _react.useCallback)(function (event) {
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
rootPopupState.close(event);
|
|
57
|
+
|
|
58
|
+
if (onClick) {
|
|
59
|
+
onClick(event);
|
|
60
|
+
}
|
|
61
|
+
}, [rootPopupState, onClick]);
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_core.MenuItem, (0, _extends2.default)({}, props, {
|
|
63
|
+
onClick: handleClick
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function CascadingSubmenu(_ref2) {
|
|
68
|
+
var title = _ref2.title,
|
|
69
|
+
inset = _ref2.inset,
|
|
70
|
+
popupId = _ref2.popupId,
|
|
71
|
+
props = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
72
|
+
|
|
73
|
+
var _React$useContext = _react.default.useContext(CascadingContext),
|
|
74
|
+
parentPopupState = _React$useContext.parentPopupState;
|
|
75
|
+
|
|
76
|
+
var popupState = (0, _hooks.usePopupState)({
|
|
77
|
+
popupId: popupId,
|
|
78
|
+
variant: 'popover',
|
|
79
|
+
parentPopupState: parentPopupState
|
|
80
|
+
});
|
|
81
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_core.MenuItem, (0, _extends2.default)({}, (0, _hooks.bindHover)(popupState), (0, _hooks.bindFocus)(popupState)), /*#__PURE__*/_react.default.createElement(_core.ListItemText, {
|
|
82
|
+
primary: title,
|
|
83
|
+
inset: inset
|
|
84
|
+
}), /*#__PURE__*/_react.default.createElement(_ChevronRight.default, null)), /*#__PURE__*/_react.default.createElement(CascadingSubmenuHover, (0, _extends2.default)({}, props, {
|
|
85
|
+
anchorOrigin: {
|
|
86
|
+
vertical: 'top',
|
|
87
|
+
horizontal: 'right'
|
|
88
|
+
},
|
|
89
|
+
transformOrigin: {
|
|
90
|
+
vertical: 'top',
|
|
91
|
+
horizontal: 'left'
|
|
92
|
+
},
|
|
93
|
+
popupState: popupState
|
|
94
|
+
})));
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function CascadingSubmenuHover(_ref3) {
|
|
98
|
+
var popupState = _ref3.popupState,
|
|
99
|
+
onMenuItemClick = _ref3.onMenuItemClick,
|
|
100
|
+
menuItems = _ref3.menuItems,
|
|
101
|
+
classes = _ref3.classes,
|
|
102
|
+
props = (0, _objectWithoutProperties2.default)(_ref3, _excluded3);
|
|
103
|
+
|
|
104
|
+
var _useContext2 = (0, _react.useContext)(CascadingContext),
|
|
105
|
+
rootPopupState = _useContext2.rootPopupState;
|
|
106
|
+
|
|
107
|
+
var context = (0, _react.useMemo)(function () {
|
|
108
|
+
return {
|
|
109
|
+
rootPopupState: rootPopupState || popupState,
|
|
110
|
+
parentPopupState: popupState
|
|
111
|
+
};
|
|
112
|
+
}, [rootPopupState, popupState]);
|
|
113
|
+
return /*#__PURE__*/_react.default.createElement(CascadingContext.Provider, {
|
|
114
|
+
value: context
|
|
115
|
+
}, /*#__PURE__*/_react.default.createElement(_HoverMenu.default, (0, _extends2.default)({}, props, (0, _hooks.bindMenu)(popupState))));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function CascadingMenu(_ref4) {
|
|
119
|
+
var popupState = _ref4.popupState,
|
|
120
|
+
onMenuItemClick = _ref4.onMenuItemClick,
|
|
121
|
+
menuItems = _ref4.menuItems,
|
|
122
|
+
props = (0, _objectWithoutProperties2.default)(_ref4, _excluded4);
|
|
123
|
+
|
|
124
|
+
var _React$useContext2 = _react.default.useContext(CascadingContext),
|
|
125
|
+
rootPopupState = _React$useContext2.rootPopupState;
|
|
126
|
+
|
|
127
|
+
var context = _react.default.useMemo(function () {
|
|
128
|
+
return {
|
|
129
|
+
rootPopupState: rootPopupState || popupState,
|
|
130
|
+
parentPopupState: popupState
|
|
131
|
+
};
|
|
132
|
+
}, [rootPopupState, popupState]);
|
|
133
|
+
|
|
134
|
+
return /*#__PURE__*/_react.default.createElement(CascadingContext.Provider, {
|
|
135
|
+
value: context
|
|
136
|
+
}, /*#__PURE__*/_react.default.createElement(_core.Menu, (0, _extends2.default)({}, props, (0, _hooks.bindMenu)(popupState))));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function EndDecoration(_ref5) {
|
|
140
|
+
var item = _ref5.item;
|
|
141
|
+
|
|
142
|
+
if ('subMenu' in item) {
|
|
143
|
+
return /*#__PURE__*/_react.default.createElement(_Menu.MenuItemEndDecoration, {
|
|
144
|
+
type: "subMenu"
|
|
145
|
+
});
|
|
146
|
+
} else if (item.type === 'checkbox' || item.type === 'radio') {
|
|
147
|
+
return /*#__PURE__*/_react.default.createElement(_Menu.MenuItemEndDecoration, {
|
|
148
|
+
type: item.type,
|
|
149
|
+
checked: item.checked,
|
|
150
|
+
disabled: item.disabled
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
function CascadingMenuList(_ref6) {
|
|
158
|
+
var onMenuItemClick = _ref6.onMenuItemClick,
|
|
159
|
+
menuItems = _ref6.menuItems,
|
|
160
|
+
props = (0, _objectWithoutProperties2.default)(_ref6, _excluded5);
|
|
161
|
+
|
|
162
|
+
function handleClick(callback) {
|
|
163
|
+
return function (event) {
|
|
164
|
+
onMenuItemClick(event, callback);
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
var hasIcon = menuItems.some(function (menuItem) {
|
|
169
|
+
return 'icon' in menuItem && menuItem.icon;
|
|
170
|
+
});
|
|
171
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, menuItems.map(function (item, idx) {
|
|
172
|
+
return 'subMenu' in item ? /*#__PURE__*/_react.default.createElement(CascadingSubmenu, {
|
|
173
|
+
key: "subMenu-".concat(item.label, "-").concat(idx),
|
|
174
|
+
popupId: "subMenu-".concat(item.label),
|
|
175
|
+
title: item.label,
|
|
176
|
+
inset: hasIcon,
|
|
177
|
+
onMenuItemClick: onMenuItemClick,
|
|
178
|
+
menuItems: item.subMenu
|
|
179
|
+
}, /*#__PURE__*/_react.default.createElement(CascadingMenuList, (0, _extends2.default)({}, props, {
|
|
180
|
+
onMenuItemClick: onMenuItemClick,
|
|
181
|
+
menuItems: item.subMenu
|
|
182
|
+
}))) : item.type === 'divider' ? /*#__PURE__*/_react.default.createElement(_core.Divider, {
|
|
183
|
+
key: "divider-".concat(idx),
|
|
184
|
+
component: "li"
|
|
185
|
+
}) : item.type === 'subHeader' ? /*#__PURE__*/_react.default.createElement(_core.ListSubheader, {
|
|
186
|
+
key: "subHeader-".concat(item.label, "-").concat(idx)
|
|
187
|
+
}, item.label) : /*#__PURE__*/_react.default.createElement(CascadingMenuItem, {
|
|
188
|
+
key: "".concat(item.label, "-").concat(idx),
|
|
189
|
+
onClick: 'onClick' in item ? handleClick(item.onClick) : undefined,
|
|
190
|
+
disabled: Boolean(item.disabled)
|
|
191
|
+
}, item.icon ? /*#__PURE__*/_react.default.createElement(_core.ListItemIcon, null, /*#__PURE__*/_react.default.createElement(item.icon, null)) : null, ' ', /*#__PURE__*/_react.default.createElement(_core.ListItemText, {
|
|
192
|
+
primary: item.label,
|
|
193
|
+
secondary: item.subLabel,
|
|
194
|
+
inset: hasIcon && !item.icon
|
|
195
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
196
|
+
style: {
|
|
197
|
+
flexGrow: 1,
|
|
198
|
+
minWidth: 10
|
|
199
|
+
}
|
|
200
|
+
}), /*#__PURE__*/_react.default.createElement(EndDecoration, {
|
|
201
|
+
item: item
|
|
202
|
+
}));
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function CascadingMenuChildren(props) {
|
|
207
|
+
return /*#__PURE__*/_react.default.createElement(CascadingMenu, props, /*#__PURE__*/_react.default.createElement(CascadingMenuList, props));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
var _default = CascadingMenuChildren;
|
|
211
|
+
exports.default = _default;
|
package/ui/Menu.d.ts
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { PopoverProps, SvgIconProps } from '@material-ui/core';
|
|
3
|
+
interface MenuItemEndDecorationSubMenuProps {
|
|
4
|
+
type: 'subMenu';
|
|
5
|
+
}
|
|
6
|
+
interface MenuItemEndDecorationSelectorProps {
|
|
7
|
+
type: 'checkbox' | 'radio';
|
|
8
|
+
checked: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare type MenuItemEndDecorationProps = MenuItemEndDecorationSubMenuProps | MenuItemEndDecorationSelectorProps;
|
|
12
|
+
export declare function MenuItemEndDecoration(props: MenuItemEndDecorationProps): JSX.Element;
|
|
3
13
|
export interface MenuDivider {
|
|
4
14
|
priority?: number;
|
|
5
15
|
type: 'divider';
|
package/ui/Menu.js
CHANGED
|
@@ -7,6 +7,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", {
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
|
+
exports.MenuItemEndDecoration = MenuItemEndDecoration;
|
|
10
11
|
exports.default = void 0;
|
|
11
12
|
|
|
12
13
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
@@ -59,13 +60,9 @@ var useStyles = (0, _core.makeStyles)({
|
|
|
59
60
|
outline: 0
|
|
60
61
|
},
|
|
61
62
|
menuItemEndDecoration: {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
transform: 'translateY(-50%)',
|
|
66
|
-
padding: 2,
|
|
67
|
-
marginRight: -12,
|
|
68
|
-
display: 'inline-flex'
|
|
63
|
+
padding: 0,
|
|
64
|
+
margin: 0,
|
|
65
|
+
height: 16
|
|
69
66
|
}
|
|
70
67
|
});
|
|
71
68
|
|
|
@@ -215,18 +212,11 @@ var MenuPage = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
215
212
|
setPosition({});
|
|
216
213
|
}
|
|
217
214
|
}, [position, anchorEl]);
|
|
218
|
-
var hasEndDecoration = menuItems.some(function (menuItem) {
|
|
219
|
-
return 'subMenu' in menuItem || menuItem.type === 'checkbox' || menuItem.type === 'radio';
|
|
220
|
-
});
|
|
221
215
|
var hasIcon = menuItems.some(function (menuItem) {
|
|
222
216
|
return 'icon' in menuItem && menuItem.icon;
|
|
223
217
|
});
|
|
224
218
|
var menuItemStyle = {};
|
|
225
219
|
|
|
226
|
-
if (hasEndDecoration) {
|
|
227
|
-
menuItemStyle.paddingRight = 48;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
220
|
function handleClick(callback) {
|
|
231
221
|
return function (event) {
|
|
232
222
|
onMenuItemClick(event, callback);
|
|
@@ -314,6 +304,11 @@ var MenuPage = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
314
304
|
primary: menuItem.label,
|
|
315
305
|
secondary: menuItem.subLabel,
|
|
316
306
|
inset: hasIcon && !menuItem.icon
|
|
307
|
+
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
308
|
+
style: {
|
|
309
|
+
flexGrow: 1,
|
|
310
|
+
minWidth: 10
|
|
311
|
+
}
|
|
317
312
|
}), endDecoration);
|
|
318
313
|
})), menuItems.map(function (menuItem, idx) {
|
|
319
314
|
var subMenu = null;
|
package/ui/SanitizedHTML.js
CHANGED
|
@@ -2,24 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
10
|
exports.default = SanitizedHTML;
|
|
9
11
|
exports.isHTML = isHTML;
|
|
10
12
|
|
|
11
|
-
var _react =
|
|
13
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
14
|
|
|
13
15
|
var _escapeHtml = _interopRequireDefault(require("escape-html"));
|
|
14
16
|
|
|
15
17
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
16
18
|
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
|
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
22
|
+
|
|
17
23
|
// source https://github.com/sindresorhus/html-tags/blob/master/html-tags.json
|
|
18
24
|
// with some random uncommon ones removed. note: we just use this to run the content
|
|
19
25
|
// through dompurify without escaping if we see an htmlTag from this list
|
|
20
26
|
// otherwise we escape angle brackets and things prematurely because it might be
|
|
21
27
|
// something like <TRA> in VCF. Ref #657
|
|
22
|
-
var htmlTags = ['a', 'b', 'br', 'code', 'div', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'i', 'img', 'li', 'p', 'pre', 'span', 'small', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'u', 'ul'];
|
|
28
|
+
var htmlTags = ['a', 'b', 'br', 'code', 'div', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'i', 'img', 'li', 'p', 'pre', 'span', 'small', 'strong', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr', 'u', 'ul'];
|
|
29
|
+
var added = false; // adapted from is-html
|
|
30
|
+
// https://github.com/sindresorhus/is-html/blob/master/index.js
|
|
23
31
|
|
|
24
32
|
var full = new RegExp(htmlTags.map(function (tag) {
|
|
25
33
|
return "<".concat(tag, "\\b[^>]*>");
|
|
@@ -31,9 +39,23 @@ function isHTML(str) {
|
|
|
31
39
|
|
|
32
40
|
function SanitizedHTML(_ref) {
|
|
33
41
|
var html = _ref.html;
|
|
34
|
-
var value = isHTML(html) ? html : (0, _escapeHtml.default)(html);
|
|
35
|
-
|
|
42
|
+
var value = isHTML(html) ? html : (0, _escapeHtml.default)(html);
|
|
43
|
+
(0, _react.useEffect)(function () {
|
|
44
|
+
if (!added) {
|
|
45
|
+
added = true; // see https://github.com/cure53/DOMPurify/issues/317
|
|
46
|
+
// only have to add this once, and can't do it globally because dompurify
|
|
47
|
+
// not yet initialized at global scope
|
|
48
|
+
|
|
49
|
+
_dompurify.default.addHook('afterSanitizeAttributes', function (node) {
|
|
50
|
+
if (node.tagName === 'A') {
|
|
51
|
+
node.setAttribute('rel', 'noopener noreferrer');
|
|
52
|
+
node.setAttribute('target', '_blank');
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}, []);
|
|
36
57
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
58
|
+
// eslint-disable-next-line react/no-danger
|
|
37
59
|
dangerouslySetInnerHTML: {
|
|
38
60
|
__html: _dompurify.default.sanitize(value)
|
|
39
61
|
}
|
package/ui/SnackbarModel.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ declare function makeExtension(snackbarMessages: IObservableArray<any>): {
|
|
|
6
6
|
readonly snackbarMessages: IObservableArray<any>;
|
|
7
7
|
};
|
|
8
8
|
actions: {
|
|
9
|
-
notify(message: string, level?: NotificationLevel
|
|
10
|
-
pushSnackbarMessage(message: string, level?: NotificationLevel
|
|
9
|
+
notify(message: string, level?: NotificationLevel, action?: SnackAction): void;
|
|
10
|
+
pushSnackbarMessage(message: string, level?: NotificationLevel, action?: SnackAction): number;
|
|
11
11
|
popSnackbarMessage(): any;
|
|
12
12
|
removeSnackbarMessage(message: string): void;
|
|
13
13
|
};
|
package/ui/index.d.ts
CHANGED
|
@@ -12,5 +12,6 @@ export { default as FactoryResetDialog } from './FactoryResetDialog';
|
|
|
12
12
|
export { default as Tooltip } from './Tooltip';
|
|
13
13
|
export { default as FatalErrorDialog } from './FatalErrorDialog';
|
|
14
14
|
export { default as Menu } from './Menu';
|
|
15
|
+
export { default as CascadingMenu } from './CascadingMenu';
|
|
15
16
|
export { default as SanitizedHTML } from './SanitizedHTML';
|
|
16
17
|
export * from './Menu';
|
package/ui/index.js
CHANGED
|
@@ -22,6 +22,7 @@ var _exportNames = {
|
|
|
22
22
|
Tooltip: true,
|
|
23
23
|
FatalErrorDialog: true,
|
|
24
24
|
Menu: true,
|
|
25
|
+
CascadingMenu: true,
|
|
25
26
|
SanitizedHTML: true
|
|
26
27
|
};
|
|
27
28
|
Object.defineProperty(exports, "App", {
|
|
@@ -36,6 +37,12 @@ Object.defineProperty(exports, "AssemblySelector", {
|
|
|
36
37
|
return _AssemblySelector.default;
|
|
37
38
|
}
|
|
38
39
|
});
|
|
40
|
+
Object.defineProperty(exports, "CascadingMenu", {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function get() {
|
|
43
|
+
return _CascadingMenu.default;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
39
46
|
Object.defineProperty(exports, "EditableTypography", {
|
|
40
47
|
enumerable: true,
|
|
41
48
|
get: function get() {
|
|
@@ -167,6 +174,8 @@ Object.keys(_Menu).forEach(function (key) {
|
|
|
167
174
|
});
|
|
168
175
|
});
|
|
169
176
|
|
|
177
|
+
var _CascadingMenu = _interopRequireDefault(require("./CascadingMenu"));
|
|
178
|
+
|
|
170
179
|
var _SanitizedHTML = _interopRequireDefault(require("./SanitizedHTML"));
|
|
171
180
|
|
|
172
181
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/util/index.d.ts
CHANGED
|
@@ -342,6 +342,9 @@ export declare function viewBpToPx({ refName, coord, regionNumber, self, }: {
|
|
|
342
342
|
} | undefined;
|
|
343
343
|
export declare function supportedIndexingAdapters(type: string): boolean;
|
|
344
344
|
export declare function getBpDisplayStr(totalBp: number): string;
|
|
345
|
+
export declare function toLocale(n: number): string;
|
|
346
|
+
export declare function getTickDisplayStr(totalBp: number, bpPerPx: number): string;
|
|
347
|
+
export declare function getTickDisplayStr2(totalBp: number, bpPerPx: number): string;
|
|
345
348
|
export declare function getViewParams(model: IAnyStateTreeNode, exportSVG?: boolean): {
|
|
346
349
|
offsetPx: number;
|
|
347
350
|
offsetPx1: number;
|
package/util/index.js
CHANGED
|
@@ -58,6 +58,9 @@ var _exportNames = {
|
|
|
58
58
|
viewBpToPx: true,
|
|
59
59
|
supportedIndexingAdapters: true,
|
|
60
60
|
getBpDisplayStr: true,
|
|
61
|
+
toLocale: true,
|
|
62
|
+
getTickDisplayStr: true,
|
|
63
|
+
getTickDisplayStr2: true,
|
|
61
64
|
getViewParams: true,
|
|
62
65
|
getLayoutId: true,
|
|
63
66
|
SimpleFeature: true,
|
|
@@ -91,6 +94,8 @@ exports.getContainingTrack = getContainingTrack;
|
|
|
91
94
|
exports.getContainingView = getContainingView;
|
|
92
95
|
exports.getLayoutId = getLayoutId;
|
|
93
96
|
exports.getSession = getSession;
|
|
97
|
+
exports.getTickDisplayStr = getTickDisplayStr;
|
|
98
|
+
exports.getTickDisplayStr2 = getTickDisplayStr2;
|
|
94
99
|
exports.getViewParams = getViewParams;
|
|
95
100
|
exports.hashCode = hashCode;
|
|
96
101
|
exports.isElectron = exports.inProduction = exports.inDevelopment = void 0;
|
|
@@ -118,6 +123,7 @@ exports.revcom = revcom;
|
|
|
118
123
|
exports.springAnimate = springAnimate;
|
|
119
124
|
exports.stringify = stringify;
|
|
120
125
|
exports.supportedIndexingAdapters = supportedIndexingAdapters;
|
|
126
|
+
exports.toLocale = toLocale;
|
|
121
127
|
exports.updateStatus = updateStatus;
|
|
122
128
|
exports.useDebounce = useDebounce;
|
|
123
129
|
exports.useDebouncedCallback = useDebouncedCallback;
|
|
@@ -1417,7 +1423,35 @@ function getBpDisplayStr(totalBp) {
|
|
|
1417
1423
|
} else if (Math.floor(totalBp / 1000) > 0) {
|
|
1418
1424
|
str = "".concat(parseFloat((totalBp / 1000).toPrecision(3)), "Kbp");
|
|
1419
1425
|
} else {
|
|
1420
|
-
str = "".concat(Math.floor(totalBp), "bp");
|
|
1426
|
+
str = "".concat(Math.floor(totalBp).toLocaleString('en-US'), "bp");
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
return str;
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
function toLocale(n) {
|
|
1433
|
+
return n.toLocaleString('en-US');
|
|
1434
|
+
}
|
|
1435
|
+
|
|
1436
|
+
function getTickDisplayStr(totalBp, bpPerPx) {
|
|
1437
|
+
var str;
|
|
1438
|
+
|
|
1439
|
+
if (Math.floor(bpPerPx / 1000) > 0) {
|
|
1440
|
+
str = "".concat(toLocale(parseFloat((totalBp / 1000000).toFixed(2))), "M");
|
|
1441
|
+
} else {
|
|
1442
|
+
str = "".concat(toLocale(Math.floor(totalBp)));
|
|
1443
|
+
}
|
|
1444
|
+
|
|
1445
|
+
return str;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
function getTickDisplayStr2(totalBp, bpPerPx) {
|
|
1449
|
+
var str;
|
|
1450
|
+
|
|
1451
|
+
if (Math.floor(bpPerPx / 1000) > 0) {
|
|
1452
|
+
str = "".concat(toLocale(parseFloat((totalBp / 1000000).toFixed(2))), "Mbp");
|
|
1453
|
+
} else {
|
|
1454
|
+
str = "".concat(toLocale(Math.floor(totalBp)), "bp");
|
|
1421
1455
|
}
|
|
1422
1456
|
|
|
1423
1457
|
return str;
|