@jbrowse/core 1.7.9 → 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.
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { AnyConfigurationModel } from '../configuration/configurationSchema';
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
- trackName = 'Reference Sequence';
116
- session.assemblies.forEach(function (assembly) {
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(_BaseFeatureDetail.Attributes, {
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)) : !info ? 'Loading file data...' : /*#__PURE__*/_react.default.createElement(_BaseFeatureDetail.Attributes, {
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
- position: 'absolute',
63
- right: 16,
64
- top: '50%',
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/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); }
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;
package/util/jexl.js CHANGED
@@ -25,15 +25,14 @@ _default() {
25
25
  j.addFunction('id', function (feature) {
26
26
  return feature.id();
27
27
  }); // let user cast a jexl type into a javascript type
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
28
 
30
29
  j.addFunction('cast', function (arg) {
31
30
  return arg;
32
31
  }); // logging
33
32
 
34
33
  j.addFunction('log', function (thing) {
35
- // eslint-disable-next-line no-console
36
- console.log(thing);
34
+ console.log(thing); // eslint-disable-line no-console
35
+
37
36
  return thing;
38
37
  }); // math
39
38
  // addfunction added in jexl 2.3 but types/jexl still on 2.2
@@ -49,66 +48,66 @@ _default() {
49
48
  j.addFunction('parseInt', Number.parseInt);
50
49
  j.addFunction('parseFloat', Number.parseFloat); // string
51
50
 
52
- j.addFunction('split', function (str, char) {
53
- return str.split(char);
51
+ j.addFunction('split', function (s, char) {
52
+ return s.split(char);
54
53
  });
55
- j.addFunction('charAt', function (str, index) {
56
- return str.charAt(index);
54
+ j.addFunction('charAt', function (s, index) {
55
+ return s.charAt(index);
57
56
  });
58
- j.addFunction('charCodeAt', function (str, index) {
59
- return str.charCodeAt(index);
57
+ j.addFunction('charCodeAt', function (s, index) {
58
+ return s.charCodeAt(index);
60
59
  });
61
- j.addFunction('codePointAt', function (str, pos) {
62
- return str.codePointAt(pos);
60
+ j.addFunction('codePointAt', function (s, pos) {
61
+ return s.codePointAt(pos);
63
62
  });
64
- j.addFunction('startsWith', function (str, searchStr, length) {
65
- return str.startsWith(searchStr, length);
63
+ j.addFunction('startsWith', function (s, search, len) {
64
+ return s.startsWith(search, len);
66
65
  });
67
- j.addFunction('endsWith', function (str, searchStr, length) {
68
- return str.endsWith(searchStr, length);
66
+ j.addFunction('endsWith', function (s, search, len) {
67
+ return s.endsWith(search, len);
69
68
  });
70
- j.addFunction('padEnd', function (str, targetLength, padString) {
71
- return str.padEnd(targetLength, padString);
69
+ j.addFunction('padEnd', function (s, len, pad) {
70
+ return s.padEnd(len, pad);
72
71
  });
73
- j.addFunction('padStart', function (str, targetLength, fillString) {
74
- return str.padStart(targetLength, fillString);
72
+ j.addFunction('padStart', function (s, len, fill) {
73
+ return s.padStart(len, fill);
75
74
  });
76
- j.addFunction('repeat', function (str, count) {
77
- return str.repeat(count);
75
+ j.addFunction('repeat', function (s, count) {
76
+ return s.repeat(count);
78
77
  });
79
- j.addFunction('replace', function (str, match, newSubStr) {
80
- return str.replace(match, newSubStr);
78
+ j.addFunction('replace', function (s, match, sub) {
79
+ return s.replace(match, sub);
81
80
  });
82
- j.addFunction('replaceAll', function (str, match, newSubStr) {
83
- return str.replaceAll(match, newSubStr);
81
+ j.addFunction('replaceAll', function (s, match, sub) {
82
+ return s.replaceAll(match, sub);
84
83
  });
85
- j.addFunction('slice', function (str, start, end) {
86
- return str.slice(start, end);
84
+ j.addFunction('slice', function (s, start, end) {
85
+ return s.slice(start, end);
87
86
  });
88
- j.addFunction('startsWith', function (str, searchStr, position) {
89
- return str.startsWith(searchStr, position);
87
+ j.addFunction('startsWith', function (s, search, pos) {
88
+ return s.startsWith(search, pos);
90
89
  });
91
- j.addFunction('substring', function (str, start, end) {
92
- return str.substring(start, end);
90
+ j.addFunction('substring', function (s, start, end) {
91
+ return s.substring(start, end);
93
92
  });
94
- j.addFunction('toLowerCase', function (str) {
95
- return str.toLowerCase();
93
+ j.addFunction('toLowerCase', function (s) {
94
+ return s.toLowerCase();
96
95
  });
97
- j.addFunction('toUpperCase', function (str) {
98
- return str.toUpperCase();
96
+ j.addFunction('toUpperCase', function (s) {
97
+ return s.toUpperCase();
99
98
  });
100
- j.addFunction('trim', function (str) {
101
- str.trim();
99
+ j.addFunction('trim', function (s) {
100
+ return s.trim();
102
101
  });
103
- j.addFunction('trimEnd', function (str) {
104
- return str.trimEnd();
102
+ j.addFunction('trimEnd', function (s) {
103
+ return s.trimEnd();
105
104
  });
106
- j.addFunction('trimStart', function (str) {
107
- return str.trimStart();
105
+ j.addFunction('trimStart', function (s) {
106
+ return s.trimStart();
108
107
  });
109
- j.addFunction('getTag', function (feature, str) {
108
+ j.addFunction('getTag', function (feature, s) {
110
109
  var tags = feature.get('tags');
111
- return tags ? tags[str] : feature.get(str);
110
+ return tags ? tags[s] : feature.get(s);
112
111
  });
113
112
  j.addBinaryOp('&', 15, function (a, b) {
114
113
  return a & b;
@@ -13,7 +13,7 @@ export * from './util';
13
13
  export interface AbstractViewContainer extends IAnyStateTreeNode {
14
14
  views: AbstractViewModel[];
15
15
  removeView(view: AbstractViewModel): void;
16
- addView(typeName: string, initialState: Record<string, unknown>): void | AbstractViewModel;
16
+ addView(typeName: string, initialState?: Record<string, unknown>): void | AbstractViewModel;
17
17
  }
18
18
  export declare function isViewContainer(thing: unknown): thing is AbstractViewContainer;
19
19
  export declare type NotificationLevel = 'error' | 'info' | 'warning' | 'success';