@jbrowse/plugin-wiggle 2.13.0 → 2.14.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.
Files changed (93) hide show
  1. package/dist/BigWigAdapter/BigWigAdapter.d.ts +1 -1
  2. package/dist/BigWigAdapter/BigWigAdapter.js +1 -1
  3. package/dist/CreateMultiWiggleExtension/ConfirmDialog.js +12 -4
  4. package/dist/LinearWiggleDisplay/components/SetColorDialog.js +12 -4
  5. package/dist/LinearWiggleDisplay/components/Tooltip.d.ts +1 -1
  6. package/dist/LinearWiggleDisplay/components/Tooltip.js +7 -2
  7. package/dist/LinearWiggleDisplay/models/model.d.ts +1 -1
  8. package/dist/LinearWiggleDisplay/models/model.js +10 -4
  9. package/dist/MultiDensityRenderer/MultiDensityRenderer.js +1 -8
  10. package/dist/MultiLinearWiggleDisplay/components/ScoreLegend.js +1 -2
  11. package/dist/MultiLinearWiggleDisplay/components/SetColorDialog.js +3 -1
  12. package/dist/MultiLinearWiggleDisplay/components/SourcesGrid.js +22 -8
  13. package/dist/MultiLinearWiggleDisplay/components/Tooltip.js +4 -7
  14. package/dist/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +1 -1
  15. package/dist/MultiLinearWiggleDisplay/components/YScaleBars.js +2 -2
  16. package/dist/MultiLinearWiggleDisplay/models/model.d.ts +1 -1
  17. package/dist/MultiLinearWiggleDisplay/models/model.js +16 -6
  18. package/dist/MultiRowLineRenderer/MultiRowLineRenderer.js +1 -1
  19. package/dist/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +1 -1
  20. package/dist/MultiWiggleAdapter/MultiWiggleAdapter.js +1 -3
  21. package/dist/MultiWiggleAddTrackWorkflow/AddTrackWorkflow.js +8 -4
  22. package/dist/MultiWiggleRendering.d.ts +4 -4
  23. package/dist/MultiWiggleRendering.js +6 -3
  24. package/dist/Tooltip.d.ts +1 -1
  25. package/dist/Tooltip.js +1 -1
  26. package/dist/WiggleBaseRenderer.d.ts +1 -1
  27. package/dist/WiggleBaseRenderer.js +1 -1
  28. package/dist/WiggleRPC/MultiWiggleGetSources.d.ts +1 -1
  29. package/dist/WiggleRPC/MultiWiggleGetSources.js +0 -1
  30. package/dist/WiggleRPC/WiggleGetGlobalQuantitativeStats.js +0 -1
  31. package/dist/WiggleRPC/WiggleGetMultiRegionQuantitativeStats.d.ts +2 -2
  32. package/dist/WiggleRPC/WiggleGetMultiRegionQuantitativeStats.js +0 -1
  33. package/dist/WiggleRendering.d.ts +3 -3
  34. package/dist/WiggleRendering.js +3 -3
  35. package/dist/drawDensity.js +5 -3
  36. package/dist/drawLine.js +5 -3
  37. package/dist/drawXY.js +5 -3
  38. package/dist/index.d.ts +3 -3
  39. package/dist/index.js +1 -1
  40. package/dist/shared/SetMinMaxDialog.d.ts +2 -2
  41. package/dist/shared/SetMinMaxDialog.js +6 -2
  42. package/dist/shared/YScaleBar.d.ts +1 -1
  43. package/dist/shared/modelShared.d.ts +5 -5
  44. package/dist/shared/modelShared.js +15 -5
  45. package/dist/util.d.ts +2 -2
  46. package/dist/util.js +12 -16
  47. package/esm/BigWigAdapter/BigWigAdapter.d.ts +1 -1
  48. package/esm/BigWigAdapter/BigWigAdapter.js +1 -1
  49. package/esm/CreateMultiWiggleExtension/ConfirmDialog.js +12 -4
  50. package/esm/LinearWiggleDisplay/components/SetColorDialog.js +12 -4
  51. package/esm/LinearWiggleDisplay/components/Tooltip.d.ts +1 -1
  52. package/esm/LinearWiggleDisplay/components/Tooltip.js +7 -2
  53. package/esm/LinearWiggleDisplay/models/model.d.ts +1 -1
  54. package/esm/LinearWiggleDisplay/models/model.js +10 -4
  55. package/esm/MultiDensityRenderer/MultiDensityRenderer.js +1 -8
  56. package/esm/MultiLinearWiggleDisplay/components/ScoreLegend.js +1 -2
  57. package/esm/MultiLinearWiggleDisplay/components/SetColorDialog.js +3 -1
  58. package/esm/MultiLinearWiggleDisplay/components/SourcesGrid.js +22 -8
  59. package/esm/MultiLinearWiggleDisplay/components/Tooltip.js +4 -7
  60. package/esm/MultiLinearWiggleDisplay/components/WiggleDisplayComponent.js +1 -1
  61. package/esm/MultiLinearWiggleDisplay/components/YScaleBars.js +2 -2
  62. package/esm/MultiLinearWiggleDisplay/models/model.d.ts +1 -1
  63. package/esm/MultiLinearWiggleDisplay/models/model.js +16 -6
  64. package/esm/MultiRowLineRenderer/MultiRowLineRenderer.js +1 -1
  65. package/esm/MultiRowXYPlotRenderer/MultiRowXYPlotRenderer.js +1 -1
  66. package/esm/MultiWiggleAdapter/MultiWiggleAdapter.js +1 -3
  67. package/esm/MultiWiggleAddTrackWorkflow/AddTrackWorkflow.js +8 -4
  68. package/esm/MultiWiggleRendering.d.ts +4 -4
  69. package/esm/MultiWiggleRendering.js +6 -3
  70. package/esm/Tooltip.d.ts +1 -1
  71. package/esm/Tooltip.js +1 -1
  72. package/esm/WiggleBaseRenderer.d.ts +1 -1
  73. package/esm/WiggleBaseRenderer.js +1 -1
  74. package/esm/WiggleRPC/MultiWiggleGetSources.d.ts +1 -1
  75. package/esm/WiggleRPC/MultiWiggleGetSources.js +0 -1
  76. package/esm/WiggleRPC/WiggleGetGlobalQuantitativeStats.js +0 -1
  77. package/esm/WiggleRPC/WiggleGetMultiRegionQuantitativeStats.d.ts +2 -2
  78. package/esm/WiggleRPC/WiggleGetMultiRegionQuantitativeStats.js +0 -1
  79. package/esm/WiggleRendering.d.ts +3 -3
  80. package/esm/WiggleRendering.js +3 -3
  81. package/esm/drawDensity.js +5 -3
  82. package/esm/drawLine.js +5 -3
  83. package/esm/drawXY.js +5 -3
  84. package/esm/index.d.ts +3 -3
  85. package/esm/index.js +1 -1
  86. package/esm/shared/SetMinMaxDialog.d.ts +2 -2
  87. package/esm/shared/SetMinMaxDialog.js +6 -2
  88. package/esm/shared/YScaleBar.d.ts +1 -1
  89. package/esm/shared/modelShared.d.ts +5 -5
  90. package/esm/shared/modelShared.js +15 -5
  91. package/esm/util.d.ts +2 -2
  92. package/esm/util.js +12 -16
  93. package/package.json +5 -6
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { BaseLinearDisplayComponent } from '@jbrowse/plugin-linear-genome-view';
3
3
  import { observer } from 'mobx-react';
4
4
  import YScaleBars from './YScaleBars';
5
- const MultiLinearWiggleDisplayComponent = observer((props) => {
5
+ const MultiLinearWiggleDisplayComponent = observer(function (props) {
6
6
  const { model } = props;
7
7
  return (React.createElement("div", null,
8
8
  React.createElement(BaseLinearDisplayComponent, { ...props }),
@@ -27,9 +27,9 @@ export const YScaleBars = observer(function (props) {
27
27
  if (!ready) {
28
28
  return null;
29
29
  }
30
- const labelWidth = Math.max(...(sources
30
+ const labelWidth = Math.max(...sources
31
31
  .map(s => measureText(s.name, svgFontSize))
32
- .map(width => (canDisplayLabel ? width : minWidth)) || [0]));
32
+ .map(width => (canDisplayLabel ? width : minWidth)));
33
33
  return (React.createElement(Wrapper, { ...props }, needsFullHeightScalebar ? (React.createElement(React.Fragment, null,
34
34
  React.createElement("g", { transform: `translate(${!exportSVG ? getOffset(model) : 0},0)` },
35
35
  React.createElement(YScaleBar, { model: model, orientation: orientation })),
@@ -157,7 +157,7 @@ export declare function stateModelFactory(pluginManager: PluginManager, configSc
157
157
  }, import("mobx-state-tree" /**
158
158
  * #property
159
159
  */)._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
160
- onHorizontalScroll?: Function;
160
+ onHorizontalScroll?: () => void;
161
161
  blockState?: Record<string, any>;
162
162
  }>;
163
163
  readonly DisplayBlurb: React.FC<{
@@ -248,8 +248,12 @@ export function stateModelFactory(pluginManager, configSchema) {
248
248
  scaleOpts,
249
249
  sources,
250
250
  ticks,
251
- onMouseMove: (_, f) => self.setFeatureUnderMouse(f),
252
- onMouseLeave: () => self.setFeatureUnderMouse(undefined),
251
+ onMouseMove: (_, f) => {
252
+ self.setFeatureUnderMouse(f);
253
+ },
254
+ onMouseLeave: () => {
255
+ self.setFeatureUnderMouse(undefined);
256
+ },
253
257
  };
254
258
  },
255
259
  /**
@@ -271,7 +275,7 @@ export function stateModelFactory(pluginManager, configSchema) {
271
275
  if (self.filled) {
272
276
  return 0;
273
277
  }
274
- else if (!self.filled && self.minSize === 1) {
278
+ else if (self.minSize === 1) {
275
279
  return 1;
276
280
  }
277
281
  else {
@@ -302,7 +306,9 @@ export function stateModelFactory(pluginManager, configSchema) {
302
306
  label: elt,
303
307
  type: 'radio',
304
308
  checked: self.fillSetting === idx,
305
- onClick: () => self.setFill(idx),
309
+ onClick: () => {
310
+ self.setFill(idx);
311
+ },
306
312
  })),
307
313
  },
308
314
  ]
@@ -313,7 +319,9 @@ export function stateModelFactory(pluginManager, configSchema) {
313
319
  type: 'checkbox',
314
320
  label: 'Draw cross hatches',
315
321
  checked: self.displayCrossHatchesSetting,
316
- onClick: () => self.toggleCrossHatches(),
322
+ onClick: () => {
323
+ self.toggleCrossHatches();
324
+ },
317
325
  },
318
326
  ]
319
327
  : []),
@@ -331,7 +339,9 @@ export function stateModelFactory(pluginManager, configSchema) {
331
339
  label: key,
332
340
  type: 'radio',
333
341
  checked: self.rendererTypeNameSimple === key,
334
- onClick: () => self.setRendererType(key),
342
+ onClick: () => {
343
+ self.setRendererType(key);
344
+ },
335
345
  })),
336
346
  },
337
347
  ]
@@ -5,7 +5,7 @@ export default class MultiRowLineRenderer extends WiggleBaseRenderer {
5
5
  // @ts-expect-error
6
6
  async draw(ctx, props) {
7
7
  const { bpPerPx, sources, regions, features } = props;
8
- const [region] = regions;
8
+ const region = regions[0];
9
9
  const groups = groupBy(features.values(), f => f.get('source'));
10
10
  const height = props.height / sources.length;
11
11
  const width = (region.end - region.start) / bpPerPx;
@@ -5,7 +5,7 @@ export default class MultiXYPlotRenderer extends WiggleBaseRenderer {
5
5
  // @ts-expect-error
6
6
  async draw(ctx, props) {
7
7
  const { bpPerPx, sources, regions, features } = props;
8
- const [region] = regions;
8
+ const region = regions[0];
9
9
  const groups = groupBy(features.values(), f => f.get('source'));
10
10
  const height = props.height / sources.length;
11
11
  const width = (region.end - region.start) / bpPerPx;
@@ -24,9 +24,7 @@ class MultiWiggleAdapter extends BaseFeatureDataAdapter {
24
24
  },
25
25
  }));
26
26
  }
27
- return Promise.all(
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
- subConfs.map(async (conf) => {
27
+ return Promise.all(subConfs.map(async (conf) => {
30
28
  const dataAdapter = (await getSubAdapter(conf))
31
29
  .dataAdapter;
32
30
  return {
@@ -25,11 +25,13 @@ export default function MultiWiggleWidget({ model }) {
25
25
  React.createElement("ul", null,
26
26
  React.createElement("li", null, "Enter list of URLs for bigwig files in the textbox"),
27
27
  React.createElement("li", null, "Or, use the button below the text box to select files from your computer")),
28
- React.createElement(TextField, { multiline: true, rows: 10, value: val, onChange: event => setVal(event.target.value), placeholder: 'Paste list of URLs here, or use file selector below', variant: "outlined", className: classes.textbox }),
28
+ React.createElement(TextField, { multiline: true, rows: 10, value: val, onChange: event => {
29
+ setVal(event.target.value);
30
+ }, placeholder: 'Paste list of URLs here, or use file selector below', variant: "outlined", className: classes.textbox }),
29
31
  React.createElement(Button, { variant: "outlined", component: "label" },
30
32
  "Choose Files from your computer",
31
33
  React.createElement("input", { type: "file", hidden: true, multiple: true, onChange: ({ target }) => {
32
- const res = [...((target === null || target === void 0 ? void 0 : target.files) || [])].map(file => ({
34
+ const res = [...(target.files || [])].map(file => ({
33
35
  type: 'BigWigAdapter',
34
36
  bigWigLocation: isElectron
35
37
  ? {
@@ -41,13 +43,15 @@ export default function MultiWiggleWidget({ model }) {
41
43
  }));
42
44
  setVal(JSON.stringify(res, null, 2));
43
45
  } })),
44
- React.createElement(TextField, { value: trackName, onChange: event => setTrackName(event.target.value), helperText: "Track name" }),
46
+ React.createElement(TextField, { value: trackName, onChange: event => {
47
+ setTrackName(event.target.value);
48
+ }, helperText: "Track name" }),
45
49
  React.createElement(Button, { variant: "contained", className: classes.submit, onClick: () => {
46
50
  var _a;
47
51
  const session = getSession(model);
48
52
  const trackId = [
49
53
  `${trackName.toLowerCase().replaceAll(' ', '_')}-${Date.now()}`,
50
- `${session.adminMode ? '' : '-sessionTrack'}`,
54
+ session.adminMode ? '' : '-sessionTrack',
51
55
  ].join('');
52
56
  // allow list of bigwigs in JSON format or line-by-line
53
57
  let bigWigs;
@@ -8,13 +8,13 @@ declare const MultiWiggleRendering: (props: {
8
8
  bpPerPx: number;
9
9
  width: number;
10
10
  height: number;
11
- onMouseLeave: Function;
12
- onMouseMove: Function;
13
- onFeatureClick: Function;
14
11
  blockKey: string;
15
12
  sources: Source[];
16
- displayModel: {
13
+ displayModel?: {
17
14
  isMultiRow: boolean;
18
15
  };
16
+ onMouseLeave?: (event: React.MouseEvent) => void;
17
+ onMouseMove?: (event: React.MouseEvent, arg?: Feature) => void;
18
+ onFeatureClick?: (event: React.MouseEvent, arg?: Feature) => void;
19
19
  }) => React.JSX.Element;
20
20
  export default MultiWiggleRendering;
@@ -4,8 +4,9 @@ import { SimpleFeature } from '@jbrowse/core/util';
4
4
  import { PrerenderedCanvas } from '@jbrowse/core/ui';
5
5
  const MultiWiggleRendering = observer(function (props) {
6
6
  const { regions, features, bpPerPx, width, height, sources, onMouseLeave = () => { }, onMouseMove = () => { }, onFeatureClick = () => { }, displayModel, } = props;
7
- const [region] = regions;
7
+ const region = regions[0];
8
8
  const ref = useRef(null);
9
+ const { isMultiRow } = displayModel || {};
9
10
  function getFeatureUnderMouse(eventClientX, eventClientY) {
10
11
  if (!ref.current) {
11
12
  return;
@@ -20,7 +21,7 @@ const MultiWiggleRendering = observer(function (props) {
20
21
  const px = region.reversed ? width - offsetX : offsetX;
21
22
  const mouseoverBp = region.start + bpPerPx * px;
22
23
  let featureUnderMouse;
23
- if (displayModel.isMultiRow) {
24
+ if (isMultiRow) {
24
25
  for (const feature of features.values()) {
25
26
  if (feature.get('source') !== source.name) {
26
27
  continue;
@@ -66,7 +67,9 @@ const MultiWiggleRendering = observer(function (props) {
66
67
  const { clientX, clientY } = event;
67
68
  const featureUnderMouse = getFeatureUnderMouse(clientX, clientY);
68
69
  onFeatureClick(event, featureUnderMouse);
69
- }, onMouseLeave: event => onMouseLeave(event), style: {
70
+ }, onMouseLeave: event => {
71
+ onMouseLeave(event);
72
+ }, style: {
70
73
  overflow: 'visible',
71
74
  position: 'relative',
72
75
  height,
package/esm/Tooltip.d.ts CHANGED
@@ -7,7 +7,7 @@ export type TooltipContentsComponent = React.ForwardRefExoticComponent<{
7
7
  } & React.RefAttributes<HTMLDivElement>>;
8
8
  declare const Tooltip: ({ model, height, clientMouseCoord, offsetMouseCoord, clientRect, TooltipContents, useClientY, }: {
9
9
  model: {
10
- featureUnderMouse: Feature;
10
+ featureUnderMouse?: Feature;
11
11
  };
12
12
  useClientY?: boolean;
13
13
  height: number;
package/esm/Tooltip.js CHANGED
@@ -45,7 +45,7 @@ const Tooltip = observer(function Tooltip({ model, height, clientMouseCoord, off
45
45
  const y = useClientY ? clientMouseCoord[1] : (clientRect === null || clientRect === void 0 ? void 0 : clientRect.top) || 0;
46
46
  const clientPoint = useClientPoint(context, { x, y });
47
47
  const { getFloatingProps } = useInteractions([clientPoint]);
48
- const popperTheme = (_a = theme === null || theme === void 0 ? void 0 : theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
48
+ const popperTheme = (_a = theme.components) === null || _a === void 0 ? void 0 : _a.MuiPopper;
49
49
  return featureUnderMouse ? (React.createElement(React.Fragment, null,
50
50
  React.createElement(Portal, { container: (_b = popperTheme === null || popperTheme === void 0 ? void 0 : popperTheme.defaultProps) === null || _b === void 0 ? void 0 : _b.container },
51
51
  React.createElement("div", { className: classes.tooltip, ref: refs.setFloating, style: {
@@ -52,6 +52,6 @@ export default abstract class WiggleBaseRenderer extends FeatureRendererType {
52
52
  * draw features to context given props, to be used by derived renderer
53
53
  * classes
54
54
  */
55
- abstract draw<T extends RenderArgsDeserializedWithFeatures>(ctx: CanvasRenderingContext2D, props: T): Promise<Record<string, unknown> | void>;
55
+ abstract draw<T extends RenderArgsDeserializedWithFeatures>(ctx: CanvasRenderingContext2D, props: T): Promise<Record<string, unknown> | undefined>;
56
56
  }
57
57
  export { type RenderArgsSerialized, type RenderResults, type ResultsDeserialized, type ResultsSerialized, } from '@jbrowse/core/pluggableElementTypes/renderers/FeatureRendererType';
@@ -8,7 +8,7 @@ export default class WiggleBaseRenderer extends FeatureRendererType {
8
8
  async render(renderProps) {
9
9
  const features = await this.getFeatures(renderProps);
10
10
  const { height, regions, bpPerPx } = renderProps;
11
- const [region] = regions;
11
+ const region = regions[0];
12
12
  const width = (region.end - region.start) / bpPerPx;
13
13
  // @ts-expect-error
14
14
  const { reducedFeatures, ...rest } = await renderToAbstractCanvas(width, height, renderProps, ctx => this.draw(ctx, {
@@ -9,7 +9,7 @@ export declare class MultiWiggleGetSources extends RpcMethodType {
9
9
  serializeArguments(args: RenderArgs & {
10
10
  signal?: AbortSignal;
11
11
  statusCallback?: (arg: string) => void;
12
- }, rpcDriverClassName: string): Promise<{}>;
12
+ }, rpcDriverClassName: string): Promise<Record<string, unknown>>;
13
13
  execute(args: {
14
14
  adapterConfig: AnyConfigurationModel;
15
15
  signal?: RemoteAbortSignal;
@@ -7,7 +7,6 @@ export class MultiWiggleGetSources extends RpcMethodType {
7
7
  super(...arguments);
8
8
  this.name = 'MultiWiggleGetSources';
9
9
  }
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
10
  async deserializeArguments(args, rpcDriverClassName) {
12
11
  const l = await super.deserializeArguments(args, rpcDriverClassName);
13
12
  return {
@@ -6,7 +6,6 @@ export class WiggleGetGlobalQuantitativeStats extends RpcMethodType {
6
6
  super(...arguments);
7
7
  this.name = 'WiggleGetGlobalQuantitativeStats';
8
8
  }
9
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
9
  async deserializeArguments(args, rpcDriverClassName) {
11
10
  const l = await super.deserializeArguments(args, rpcDriverClassName);
12
11
  return {
@@ -8,9 +8,9 @@ export declare class WiggleGetMultiRegionQuantitativeStats extends RpcMethodType
8
8
  serializeArguments(args: RenderArgs & {
9
9
  signal?: AbortSignal;
10
10
  statusCallback?: (arg: string) => void;
11
- }, rpcDriverClassName: string): Promise<{}>;
11
+ }, rpcDriverClassName: string): Promise<Record<string, unknown>>;
12
12
  execute(args: {
13
- adapterConfig: {};
13
+ adapterConfig: Record<string, unknown>;
14
14
  signal?: RemoteAbortSignal;
15
15
  sessionId: string;
16
16
  headers?: Record<string, string>;
@@ -7,7 +7,6 @@ export class WiggleGetMultiRegionQuantitativeStats extends RpcMethodType {
7
7
  super(...arguments);
8
8
  this.name = 'WiggleGetMultiRegionQuantitativeStats';
9
9
  }
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
10
  async deserializeArguments(args, rpcDriverClassName) {
12
11
  const l = await super.deserializeArguments(args, rpcDriverClassName);
13
12
  return {
@@ -7,9 +7,9 @@ declare const WiggleRendering: (props: {
7
7
  bpPerPx: number;
8
8
  width: number;
9
9
  height: number;
10
- onMouseLeave: Function;
11
- onMouseMove: Function;
12
- onFeatureClick: Function;
13
10
  blockKey: string;
11
+ onMouseLeave?: (event: React.MouseEvent) => void;
12
+ onMouseMove?: (event: React.MouseEvent, arg?: string) => void;
13
+ onFeatureClick?: (event: React.MouseEvent, arg?: string) => void;
14
14
  }) => React.JSX.Element;
15
15
  export default WiggleRendering;
@@ -2,8 +2,8 @@ import { observer } from 'mobx-react';
2
2
  import React, { useRef } from 'react';
3
3
  import { PrerenderedCanvas } from '@jbrowse/core/ui';
4
4
  const WiggleRendering = observer(function (props) {
5
- const { regions, features, bpPerPx, width, height, onMouseLeave = () => { }, onMouseMove = () => { }, onFeatureClick = () => { }, } = props;
6
- const [region] = regions;
5
+ const { regions, features, bpPerPx, width, height, onMouseLeave, onMouseMove, onFeatureClick, } = props;
6
+ const region = regions[0];
7
7
  const ref = useRef(null);
8
8
  function getFeatureUnderMouse(eventClientX) {
9
9
  // calculates feature under mouse
@@ -25,7 +25,7 @@ const WiggleRendering = observer(function (props) {
25
25
  }
26
26
  return featureUnderMouse;
27
27
  }
28
- return (React.createElement("div", { ref: ref, "data-testid": "wiggle-rendering-test", onMouseMove: event => { var _a; return onMouseMove(event, (_a = getFeatureUnderMouse(event.clientX)) === null || _a === void 0 ? void 0 : _a.id()); }, onClick: event => { var _a; return onFeatureClick(event, (_a = getFeatureUnderMouse(event.clientX)) === null || _a === void 0 ? void 0 : _a.id()); }, onMouseLeave: event => onMouseLeave(event), style: {
28
+ return (React.createElement("div", { ref: ref, "data-testid": "wiggle-rendering-test", onMouseMove: e => { var _a; return onMouseMove === null || onMouseMove === void 0 ? void 0 : onMouseMove(e, (_a = getFeatureUnderMouse(e.clientX)) === null || _a === void 0 ? void 0 : _a.id()); }, onClick: e => { var _a; return onFeatureClick === null || onFeatureClick === void 0 ? void 0 : onFeatureClick(e, (_a = getFeatureUnderMouse(e.clientX)) === null || _a === void 0 ? void 0 : _a.id()); }, onMouseLeave: e => onMouseLeave === null || onMouseLeave === void 0 ? void 0 : onMouseLeave(e), style: {
29
29
  overflow: 'visible',
30
30
  position: 'relative',
31
31
  height,
@@ -6,7 +6,7 @@ const fudgeFactor = 0.3;
6
6
  const clipHeight = 2;
7
7
  export function drawDensity(ctx, props) {
8
8
  const { features, regions, bpPerPx, scaleOpts, height, config } = props;
9
- const [region] = regions;
9
+ const region = regions[0];
10
10
  const pivot = readConfObject(config, 'bicolorPivot');
11
11
  const pivotValue = readConfObject(config, 'bicolorPivotValue');
12
12
  const negColor = readConfObject(config, 'negColor');
@@ -23,8 +23,10 @@ export function drawDensity(ctx, props) {
23
23
  const cb = color === '#f0f'
24
24
  ? (_, score) => scale(score)
25
25
  : (feature, score) => readConfObject(config, 'color', { feature, score });
26
- const [niceMin, niceMax] = scale2.domain();
27
- let prevLeftPx = -Infinity;
26
+ const domain = scale2.domain();
27
+ const niceMin = domain[0];
28
+ const niceMax = domain[1];
29
+ let prevLeftPx = Number.NEGATIVE_INFINITY;
28
30
  let hasClipping = false;
29
31
  const reducedFeatures = [];
30
32
  for (const feature of features.values()) {
package/esm/drawLine.js CHANGED
@@ -6,7 +6,7 @@ const fudgeFactor = 0.3;
6
6
  const clipHeight = 2;
7
7
  export function drawLine(ctx, props) {
8
8
  const { features, regions, bpPerPx, scaleOpts, height: unadjustedHeight, ticks: { values }, displayCrossHatches, colorCallback, config, offset = 0, } = props;
9
- const [region] = regions;
9
+ const region = regions[0];
10
10
  const width = (region.end - region.start) / bpPerPx;
11
11
  // the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the
12
12
  // wiggle display, and makes the height of the actual drawn area add
@@ -14,10 +14,12 @@ export function drawLine(ctx, props) {
14
14
  const height = unadjustedHeight - offset * 2;
15
15
  const clipColor = readConfObject(config, 'clipColor');
16
16
  const scale = getScale({ ...scaleOpts, range: [0, height] });
17
- const [niceMin, niceMax] = scale.domain();
17
+ const domain = scale.domain();
18
+ const niceMin = domain[0];
19
+ const niceMax = domain[1];
18
20
  const toY = (n) => clamp(height - (scale(n) || 0), 0, height) + offset;
19
21
  let lastVal;
20
- let prevLeftPx = -Infinity;
22
+ let prevLeftPx = Number.NEGATIVE_INFINITY;
21
23
  const reducedFeatures = [];
22
24
  for (const feature of features.values()) {
23
25
  const [leftPx, rightPx] = featureSpanPx(feature, region, bpPerPx);
package/esm/drawXY.js CHANGED
@@ -17,7 +17,7 @@ const fudgeFactor = 0.3;
17
17
  const clipHeight = 2;
18
18
  export function drawXY(ctx, props) {
19
19
  const { features, bpPerPx, regions, scaleOpts, height: unadjustedHeight, config, ticks, displayCrossHatches, offset = 0, colorCallback, } = props;
20
- const [region] = regions;
20
+ const region = regions[0];
21
21
  const width = (region.end - region.start) / bpPerPx;
22
22
  // the adjusted height takes into account YSCALEBAR_LABEL_OFFSET from the
23
23
  // wiggle display, and makes the height of the actual drawn area add
@@ -30,12 +30,14 @@ export function drawXY(ctx, props) {
30
30
  const minSize = readConfObject(config, 'minSize');
31
31
  const scale = getScale({ ...scaleOpts, range: [0, height] });
32
32
  const originY = getOrigin(scaleOpts.scaleType);
33
- const [niceMin, niceMax] = scale.domain();
33
+ const domain = scale.domain();
34
+ const niceMin = domain[0];
35
+ const niceMax = domain[1];
34
36
  const toY = (n) => clamp(height - (scale(n) || 0), 0, height) + offset;
35
37
  const toOrigin = (n) => toY(originY) - toY(n);
36
38
  const getHeight = (n) => (filled ? toOrigin(n) : Math.max(minSize, 1));
37
39
  let hasClipping = false;
38
- let prevLeftPx = -Infinity;
40
+ let prevLeftPx = Number.NEGATIVE_INFINITY;
39
41
  const reducedFeatures = [];
40
42
  const crossingOrigin = niceMin < pivotValue && niceMax > pivotValue;
41
43
  // we handle whiskers separately to render max row, min row, and avg in three
package/esm/index.d.ts CHANGED
@@ -17,10 +17,10 @@ export default class WigglePlugin extends Plugin {
17
17
  bpPerPx: number;
18
18
  width: number;
19
19
  height: number;
20
- onMouseLeave: Function;
21
- onMouseMove: Function;
22
- onFeatureClick: Function;
23
20
  blockKey: string;
21
+ onMouseLeave?: (event: import("react").MouseEvent) => void;
22
+ onMouseMove?: (event: import("react").MouseEvent, arg?: string) => void;
23
+ onFeatureClick?: (event: import("react").MouseEvent, arg?: string) => void;
24
24
  }) => import("react").JSX.Element;
25
25
  XYPlotRenderer: typeof XYPlotRenderer;
26
26
  WiggleBaseRenderer: typeof WiggleBaseRenderer;
package/esm/index.js CHANGED
@@ -65,7 +65,7 @@ export default class WigglePlugin extends Plugin {
65
65
  if (regexGuess.test(fileName) && !hint) {
66
66
  return obj;
67
67
  }
68
- else if (hint === adapterName) {
68
+ if (hint === adapterName) {
69
69
  return obj;
70
70
  }
71
71
  return cb(file, index, hint);
@@ -4,8 +4,8 @@ export default function SetMinMaxDialog(props: {
4
4
  minScore: number;
5
5
  maxScore: number;
6
6
  scaleType: string;
7
- setMinScore: Function;
8
- setMaxScore: Function;
7
+ setMinScore: (arg?: number) => void;
8
+ setMaxScore: (arg?: number) => void;
9
9
  };
10
10
  handleClose: () => void;
11
11
  }): React.JSX.Element;
@@ -15,8 +15,12 @@ export default function SetMinMaxDialog(props) {
15
15
  React.createElement(Typography, null, "Enter min/max score: "),
16
16
  !ok ? (React.createElement(Typography, { color: "error" }, "Max is greater than or equal to min")) : null,
17
17
  !logOk ? (React.createElement(Typography, { color: "error" }, "Min score should be greater than 0 for log scale")) : null,
18
- React.createElement(TextField, { value: min, onChange: event => setMin(event.target.value), placeholder: "Enter min score" }),
19
- React.createElement(TextField, { value: max, onChange: event => setMax(event.target.value), placeholder: "Enter max score" })),
18
+ React.createElement(TextField, { value: min, onChange: event => {
19
+ setMin(event.target.value);
20
+ }, placeholder: "Enter min score" }),
21
+ React.createElement(TextField, { value: max, onChange: event => {
22
+ setMax(event.target.value);
23
+ }, placeholder: "Enter max score" })),
20
24
  React.createElement(DialogActions, null,
21
25
  React.createElement(Button, { variant: "contained", color: "primary", type: "submit", style: { marginLeft: 20 }, disabled: !ok, onClick: () => {
22
26
  model.setMinScore(min !== '' && !Number.isNaN(+min) ? +min : undefined);
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { axisPropsFromTickScale } from 'react-d3-axis-mod';
2
+ import type { axisPropsFromTickScale } from 'react-d3-axis-mod';
3
3
  type Ticks = ReturnType<typeof axisPropsFromTickScale>;
4
4
  declare const YScaleBar: ({ model, orientation, }: {
5
5
  model: {
@@ -181,7 +181,7 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
181
181
  error: unknown;
182
182
  message: string | undefined;
183
183
  }, import("mobx-state-tree")._NotCustomized, import("mobx-state-tree")._NotCustomized>>;
184
- onHorizontalScroll?: Function;
184
+ onHorizontalScroll?: () => void;
185
185
  blockState?: Record<string, any>;
186
186
  }>;
187
187
  readonly DisplayBlurb: import("react").FC<{
@@ -407,10 +407,10 @@ export default function SharedWiggleMixin(configSchema: AnyConfigurationSchemaTy
407
407
  } & import("mobx-state-tree/dist/internal").NonEmptyObject & {
408
408
  setSubschema(slotName: string, data: Record<string, unknown>): Record<string, unknown> | ({
409
409
  [x: string]: any;
410
- } & import("mobx-state-tree/dist/internal").NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
411
- } & import("mobx-state-tree" /**
412
- * #property
413
- */).IStateTreeNode<AnyConfigurationSchemaType>);
410
+ } & import("mobx-state-tree/dist/internal" /**
411
+ * #property
412
+ */).NonEmptyObject & any & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
413
+ } & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>);
414
414
  } & import("mobx-state-tree").IStateTreeNode<AnyConfigurationSchemaType>;
415
415
  /**
416
416
  * #getter
@@ -385,11 +385,15 @@ export default function SharedWiggleMixin(configSchema) {
385
385
  subMenu: [
386
386
  {
387
387
  label: 'Finer resolution',
388
- onClick: () => self.setResolution(self.resolution * 5),
388
+ onClick: () => {
389
+ self.setResolution(self.resolution * 5);
390
+ },
389
391
  },
390
392
  {
391
393
  label: 'Coarser resolution',
392
- onClick: () => self.setResolution(self.resolution / 5),
394
+ onClick: () => {
395
+ self.setResolution(self.resolution / 5);
396
+ },
393
397
  },
394
398
  ],
395
399
  },
@@ -399,14 +403,18 @@ export default function SharedWiggleMixin(configSchema) {
399
403
  label: elt,
400
404
  type: 'radio',
401
405
  checked: self.summaryScoreModeSetting === elt,
402
- onClick: () => self.setSummaryScoreMode(elt),
406
+ onClick: () => {
407
+ self.setSummaryScoreMode(elt);
408
+ },
403
409
  })),
404
410
  },
405
411
  ]
406
412
  : []),
407
413
  {
408
414
  label: self.scaleType === 'log' ? 'Set linear scale' : 'Set log scale',
409
- onClick: () => self.toggleLogScale(),
415
+ onClick: () => {
416
+ self.toggleLogScale();
417
+ },
410
418
  },
411
419
  {
412
420
  label: 'Autoscale type',
@@ -423,7 +431,9 @@ export default function SharedWiggleMixin(configSchema) {
423
431
  label,
424
432
  type: 'radio',
425
433
  checked: self.autoscaleType === val,
426
- onClick: () => self.setAutoscale(val),
434
+ onClick: () => {
435
+ self.setAutoscale(val);
436
+ },
427
437
  })),
428
438
  },
429
439
  {
package/esm/util.d.ts CHANGED
@@ -25,7 +25,7 @@ export interface Source {
25
25
  * - pivotValue (number)
26
26
  * - inverted (boolean)
27
27
  */
28
- export declare function getScale({ domain, range, scaleType, pivotValue, inverted, }: ScaleOpts): import("d3-scale").ScaleLinear<number, number, never> | import("d3-scale").ScaleQuantize<number, never>;
28
+ export declare function getScale({ domain, range, scaleType, pivotValue, inverted, }: ScaleOpts): import("@mui/x-charts-vendor/d3-scale").ScaleLinear<number, number, never> | import("@mui/x-charts-vendor/d3-scale").ScaleLogarithmic<number, number, never> | import("@mui/x-charts-vendor/d3-scale").ScaleQuantize<number, never>;
29
29
  /**
30
30
  * gets the origin for drawing the graph. for linear this is 0, for log this is arbitrarily set to log(1)==0
31
31
  *
@@ -56,7 +56,7 @@ export declare function getQuantitativeStats(self: {
56
56
  }, opts: {
57
57
  headers?: Record<string, string>;
58
58
  signal?: AbortSignal;
59
- filters?: string[];
59
+ filters: string[];
60
60
  }): Promise<QuantitativeStats>;
61
61
  export declare function quantitativeStatsAutorun(self: {
62
62
  featureDensityStatsReady: boolean;