@vitessce/layer-controller 2.0.3 → 3.0.1

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 (74) hide show
  1. package/dist/{deflate.b44720d0.mjs → deflate-0d7cf47d.js} +2 -2
  2. package/dist/{index.ca9e70ae.mjs → index-01dc75e1.js} +138098 -127210
  3. package/dist/{index.mjs → index.js} +2 -3
  4. package/dist/{jpeg.edb20ff0.mjs → jpeg-cad5557d.js} +1 -1
  5. package/dist/{lerc.df2f1733.mjs → lerc-1fa75ba5.js} +76 -5
  6. package/dist/{lzw.2a639594.mjs → lzw-487634db.js} +1 -1
  7. package/dist/{packbits.958f7a40.mjs → packbits-55abe2f6.js} +1 -1
  8. package/dist/{pako.esm.4b234125.mjs → pako.esm-68f84e2a.js} +97 -15
  9. package/dist/{raw.4239192e.mjs → raw-68f1e99a.js} +1 -1
  10. package/dist/{webimage.de21cf13.mjs → webimage-afaf2669.js} +1 -1
  11. package/dist-tsc/BitmaskChannelController.d.ts +21 -0
  12. package/dist-tsc/BitmaskChannelController.d.ts.map +1 -0
  13. package/dist-tsc/BitmaskChannelController.js +30 -0
  14. package/dist-tsc/ChannelOptions.d.ts +13 -0
  15. package/dist-tsc/ChannelOptions.d.ts.map +1 -0
  16. package/dist-tsc/ChannelOptions.js +38 -0
  17. package/dist-tsc/ColorPalette.d.ts +5 -0
  18. package/dist-tsc/ColorPalette.d.ts.map +1 -0
  19. package/dist-tsc/ColorPalette.js +30 -0
  20. package/dist-tsc/ImageAddButton.d.ts +6 -0
  21. package/dist-tsc/ImageAddButton.d.ts.map +1 -0
  22. package/dist-tsc/ImageAddButton.js +27 -0
  23. package/dist-tsc/LayerController.d.ts +10 -0
  24. package/dist-tsc/LayerController.d.ts.map +1 -0
  25. package/dist-tsc/LayerController.js +311 -0
  26. package/dist-tsc/LayerControllerSubscriber.d.ts +27 -0
  27. package/dist-tsc/LayerControllerSubscriber.d.ts.map +1 -0
  28. package/dist-tsc/LayerControllerSubscriber.js +194 -0
  29. package/dist-tsc/LayerOptions.d.ts +46 -0
  30. package/dist-tsc/LayerOptions.d.ts.map +1 -0
  31. package/dist-tsc/LayerOptions.js +208 -0
  32. package/dist-tsc/RasterChannelController.d.ts +35 -0
  33. package/dist-tsc/RasterChannelController.d.ts.map +1 -0
  34. package/dist-tsc/RasterChannelController.js +150 -0
  35. package/dist-tsc/RasterChannelController.test.d.ts +2 -0
  36. package/dist-tsc/RasterChannelController.test.d.ts.map +1 -0
  37. package/dist-tsc/RasterChannelController.test.js +22 -0
  38. package/dist-tsc/VectorLayerController.d.ts +2 -0
  39. package/dist-tsc/VectorLayerController.d.ts.map +1 -0
  40. package/dist-tsc/VectorLayerController.js +26 -0
  41. package/dist-tsc/VolumeOptions.d.ts +16 -0
  42. package/dist-tsc/VolumeOptions.d.ts.map +1 -0
  43. package/dist-tsc/VolumeOptions.js +71 -0
  44. package/dist-tsc/constants.d.ts +2 -0
  45. package/dist-tsc/constants.d.ts.map +1 -0
  46. package/dist-tsc/constants.js +12 -0
  47. package/dist-tsc/index.d.ts +4 -0
  48. package/dist-tsc/index.d.ts.map +1 -0
  49. package/dist-tsc/index.js +3 -3
  50. package/dist-tsc/shared-channel-controls.d.ts +27 -0
  51. package/dist-tsc/shared-channel-controls.d.ts.map +1 -0
  52. package/dist-tsc/shared-channel-controls.js +25 -0
  53. package/dist-tsc/styles.d.ts +8 -0
  54. package/dist-tsc/styles.d.ts.map +1 -0
  55. package/dist-tsc/styles.js +75 -0
  56. package/dist-tsc/utils.d.ts +24 -0
  57. package/dist-tsc/utils.d.ts.map +1 -0
  58. package/dist-tsc/utils.js +117 -0
  59. package/package.json +21 -12
  60. package/src/BitmaskChannelController.js +3 -4
  61. package/src/ChannelOptions.js +4 -5
  62. package/src/ColorPalette.js +4 -5
  63. package/src/ImageAddButton.js +2 -3
  64. package/src/LayerController.js +40 -29
  65. package/src/LayerControllerSubscriber.js +9 -18
  66. package/src/LayerOptions.js +7 -9
  67. package/src/RasterChannelController.js +7 -18
  68. package/src/RasterChannelController.test.js +2 -1
  69. package/src/VectorLayerController.js +3 -7
  70. package/src/VolumeOptions.js +13 -10
  71. package/src/index.js +3 -3
  72. package/src/shared-channel-controls.js +2 -3
  73. package/src/styles.js +14 -44
  74. package/src/utils.js +9 -0
@@ -1,27 +1,16 @@
1
1
  import React, { useCallback, useState, useEffect } from 'react';
2
2
 
3
- import Grid from '@material-ui/core/Grid';
4
- import Slider from '@material-ui/core/Slider';
5
- import debounce from 'lodash/debounce';
6
- import isEqual from 'lodash/isEqual';
3
+ import { Grid, Slider } from '@material-ui/core';
4
+ import { debounce, isEqual } from 'lodash-es';
7
5
 
8
6
  import { getSourceFromLoader } from '@vitessce/spatial-utils';
9
- import ChannelOptions from './ChannelOptions';
10
- import { DOMAINS } from './constants';
11
- import { getMultiSelectionStats } from './utils';
7
+ import ChannelOptions from './ChannelOptions.js';
8
+ import { DOMAINS } from './constants.js';
9
+ import { getMultiSelectionStats, toRgbUIString } from './utils.js';
12
10
  import {
13
11
  ChannelSelectionDropdown,
14
12
  ChannelVisibilityCheckbox,
15
- } from './shared-channel-controls';
16
-
17
- // Returns an rgb string for display, and changes the color (arr)
18
- // to use a grey for light theme + white color or if the colormap is on.
19
- export const toRgbUIString = (on, arr, theme) => {
20
- const color = on || (theme === 'light' && arr.every(i => i === 255))
21
- ? [220, 220, 220]
22
- : arr;
23
- return `rgb(${color})`;
24
- };
13
+ } from './shared-channel-controls.js';
25
14
 
26
15
  function abbreviateNumber(value) {
27
16
  // Return an abbreviated representation of value, in 5 characters or less.
@@ -76,7 +65,7 @@ function ChannelSlider({
76
65
  debounce(handleChange, 3, { trailing: true }),
77
66
  [handleChange],
78
67
  );
79
- const step = max - min < 500 && dtype === 'Float32' ? (max - min) / 500 : 1;
68
+ const step = max - min < 500 && dtype.startsWith('Float') ? (max - min) / 500 : 1;
80
69
  return (
81
70
  <Slider
82
71
  value={slider}
@@ -1,4 +1,5 @@
1
- import { toRgbUIString } from './RasterChannelController';
1
+ import { describe, it, expect } from 'vitest';
2
+ import { toRgbUIString } from './utils.js';
2
3
 
3
4
  const GREY = [220, 220, 220];
4
5
 
@@ -1,11 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
- import Grid from '@material-ui/core/Grid';
4
- import Checkbox from '@material-ui/core/Checkbox';
5
- import Paper from '@material-ui/core/Paper';
6
- import Typography from '@material-ui/core/Typography';
7
- import Slider from '@material-ui/core/Slider';
8
- import { useControllerSectionStyles } from './styles';
3
+ import { Grid, Checkbox, Paper, Typography, Slider } from '@material-ui/core';
4
+ import { useControllerSectionStyles } from './styles.js';
9
5
 
10
6
  export default function VectorLayerController(props) {
11
7
  const {
@@ -34,7 +30,7 @@ export default function VectorLayerController(props) {
34
30
  const classes = useControllerSectionStyles();
35
31
  return (
36
32
  <Grid item style={{ marginTop: '10px' }}>
37
- <Paper className={classes.root}>
33
+ <Paper className={classes.layerControllerRoot}>
38
34
  <Typography
39
35
  style={{
40
36
  padding: '15px 8px 0px 8px',
@@ -1,16 +1,19 @@
1
1
  import React from 'react';
2
2
  import { Matrix4 } from 'math.gl';
3
- import Grid from '@material-ui/core/Grid';
4
- import Typography from '@material-ui/core/Typography';
5
- import Button from '@material-ui/core/Button';
6
- import { makeStyles, createStyles } from '@material-ui/core/styles';
7
- import FormControl from '@material-ui/core/FormControl';
8
- import Select from '@material-ui/core/Select';
9
- import InputLabel from '@material-ui/core/InputLabel';
10
- import Slider from '@material-ui/core/Slider';
3
+ import {
4
+ Grid,
5
+ Typography,
6
+ Button,
7
+ makeStyles,
8
+ createStyles,
9
+ FormControl,
10
+ Select,
11
+ InputLabel,
12
+ Slider,
13
+ } from '@material-ui/core';
11
14
  import { viv } from '@vitessce/gl';
12
- import { abbreviateNumber, getBoundingCube } from './utils';
13
- import { useSelectStyles } from './styles';
15
+ import { abbreviateNumber, getBoundingCube } from './utils.js';
16
+ import { useSelectStyles } from './styles.js';
14
17
 
15
18
  const useSlicerStyles = makeStyles(theme => createStyles({
16
19
  enabled: {},
package/src/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { LayerControllerSubscriber, register } from './LayerControllerSubscriber';
2
- export { default as LayerController } from './LayerController';
3
- export { default as VectorLayerController } from './VectorLayerController';
1
+ export { LayerControllerSubscriber } from './LayerControllerSubscriber.js';
2
+ export { default as LayerController } from './LayerController.js';
3
+ export { default as VectorLayerController } from './VectorLayerController.js';
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
- import Checkbox from '@material-ui/core/Checkbox';
4
- import Select from '@material-ui/core/Select';
5
- import { useSelectStyles } from './styles';
3
+ import { Checkbox, Select } from '@material-ui/core';
4
+ import { useSelectStyles } from './styles.js';
6
5
 
7
6
  /**
8
7
  * Dropdown for selecting a channel.
package/src/styles.js CHANGED
@@ -1,9 +1,4 @@
1
- import { makeStyles, withStyles } from '@material-ui/core/styles';
2
- import AccordionSummary from '@material-ui/core/AccordionSummary';
3
- import AccordionDetails from '@material-ui/core/AccordionDetails';
4
- import InputLabel from '@material-ui/core/InputLabel';
5
- import Slider from '@material-ui/core/Slider';
6
- import Grid from '@material-ui/core/Grid';
1
+ import { makeStyles } from '@material-ui/core';
7
2
 
8
3
  const useSpanStyles = makeStyles(() => ({
9
4
  span: {
@@ -28,49 +23,24 @@ export const useSelectStyles = makeStyles(() => ({
28
23
  },
29
24
  }));
30
25
 
31
- export const useOptionStyles = withStyles(theme => ({
32
- paper: {
33
- backgroundColor: theme.palette.background.paper,
34
- },
35
- span: {
36
- width: '70px',
37
- textAlign: 'center',
38
- paddingLeft: '2px',
39
- paddingRight: '2px',
40
- },
41
- colors: {
42
- '&:hover': {
43
- backgroundColor: 'transparent',
44
- },
45
- paddingLeft: '2px',
46
- paddingRight: '2px',
47
- },
48
- popper: {
49
- zIndex: 4,
50
- },
51
- }));
52
-
53
26
  const sharedControllerStyles = {
54
27
  width: '100%',
55
28
  flexDirection: 'column',
56
29
  };
57
30
 
58
31
  export const useControllerSectionStyles = makeStyles(() => ({
59
- root: {
32
+ layerControllerRoot: {
60
33
  ...sharedControllerStyles,
61
34
  padding: '0px 8px',
62
35
  },
63
36
  }));
64
37
 
65
- export const StyledAccordionDetails = withStyles(() => ({
66
- root: {
38
+ export const useAccordionStyles = makeStyles(theme => ({
39
+ accordionDetailsRoot: {
67
40
  ...sharedControllerStyles,
68
41
  padding: '8px 8px 24px 8px',
69
42
  },
70
- }))(AccordionDetails);
71
-
72
- export const StyledAccordionSummary = withStyles(theme => ({
73
- root: {
43
+ accordionSummaryRoot: {
74
44
  padding: '0px 8px',
75
45
  },
76
46
  content: {
@@ -86,28 +56,28 @@ export const StyledAccordionSummary = withStyles(theme => ({
86
56
  top: theme.spacing(-1.3),
87
57
  },
88
58
  },
89
- }))(AccordionSummary);
59
+ }));
90
60
 
91
- export const StyledInputLabel = withStyles(() => ({
92
- root: {
61
+ export const useInputLabelStyles = makeStyles(() => ({
62
+ inputLabelRoot: {
93
63
  fontSize: '14px',
94
64
  },
95
- }))(InputLabel);
65
+ }));
96
66
 
97
- export const OverflowEllipsisGrid = withStyles(() => ({
67
+ export const useOverflowEllipsisGridStyles = makeStyles(() => ({
98
68
  item: {
99
69
  width: '100%',
100
70
  overflow: 'hidden',
101
71
  whiteSpace: 'nowrap',
102
72
  textOverflow: 'ellipsis',
103
73
  },
104
- }))(Grid);
74
+ }));
105
75
 
106
- export const StyledSelectionSlider = withStyles(() => ({
107
- root: {
76
+ export const useSelectionSliderStyles = makeStyles(() => ({
77
+ selectionSliderRoot: {
108
78
  marginTop: '7px',
109
79
  },
110
80
  markActive: {
111
81
  backgroundColor: 'rgba(128, 128, 128, 0.7)',
112
82
  },
113
- }))(Slider);
83
+ }));
package/src/utils.js CHANGED
@@ -1,6 +1,15 @@
1
1
  import { viv } from '@vitessce/gl';
2
2
  import { Matrix4 } from 'math.gl';
3
3
 
4
+ // Returns an rgb string for display, and changes the color (arr)
5
+ // to use a grey for light theme + white color or if the colormap is on.
6
+ export const toRgbUIString = (on, arr, theme) => {
7
+ const color = on || (theme === 'light' && arr.every(i => i === 255))
8
+ ? [220, 220, 220]
9
+ : arr;
10
+ return `rgb(${color})`;
11
+ };
12
+
4
13
  async function getSingleSelectionStats2D({ loader, selection }) {
5
14
  const data = Array.isArray(loader) ? loader[loader.length - 1] : loader;
6
15
  const raster = await data.getRaster({ selection });