@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
@@ -0,0 +1,25 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { Checkbox, Select } from '@material-ui/core';
4
+ import { useSelectStyles } from './styles.js';
5
+ /**
6
+ * Dropdown for selecting a channel.
7
+ * @prop {function} handleChange Callback for each new selection.
8
+ * @prop {array} channelOptions List of available selections, like ['DAPI', 'FITC', ...].
9
+ * @prop {boolean} disabled Whether or not the component is disabled.
10
+ * @prop {number} selectionIndex Current numeric index of a selection.
11
+ */
12
+ export function ChannelSelectionDropdown({ handleChange, disabled, channelOptions, selectionIndex, }) {
13
+ const classes = useSelectStyles();
14
+ return (_jsx(Select, { classes: { root: classes.selectRoot }, native: true, value: selectionIndex, onChange: e => handleChange(Number(e.target.value)), children: channelOptions.map((opt, i) => (_jsx("option", { disabled: disabled, value: i, children: opt }, opt))) }));
15
+ }
16
+ /**
17
+ * Checkbox for toggling on/off of a channel.
18
+ * @prop {string} color Current color for this channel.
19
+ * @prop {boolean} checked Whether or not this channel is "on".
20
+ * @prop {boolean} disabled Whether or not the component is disabled.
21
+ * @prop {function} toggle Callback for toggling on/off.
22
+ */
23
+ export function ChannelVisibilityCheckbox({ color, checked, toggle, disabled, }) {
24
+ return (_jsx(Checkbox, { onChange: toggle, checked: checked, disabled: disabled, style: { color, '&$checked': { color } } }));
25
+ }
@@ -0,0 +1,8 @@
1
+ export function MuiSpan(props: any): import(".pnpm/@types+react@18.2.7/node_modules/@types/react").JSX.Element;
2
+ export const useSelectStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"selectRoot">;
3
+ export const useControllerSectionStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"layerControllerRoot">;
4
+ export const useAccordionStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<never>;
5
+ export const useInputLabelStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"inputLabelRoot">;
6
+ export const useOverflowEllipsisGridStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"item">;
7
+ export const useSelectionSliderStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"selectionSliderRoot" | "markActive">;
8
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.js"],"names":[],"mappings":"AAWA,+GAIC;AAED,wHAMI;AAOJ,4IAKI;AAEJ,oHAqBI;AAEJ,gIAII;AAEJ,gIAOI;AAEJ,yJAOI"}
@@ -0,0 +1,75 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { makeStyles } from '@material-ui/core';
3
+ const useSpanStyles = makeStyles(() => ({
4
+ span: {
5
+ width: '70px',
6
+ textAlign: 'center',
7
+ paddingLeft: '2px',
8
+ paddingRight: '2px',
9
+ },
10
+ }));
11
+ export function MuiSpan(props) {
12
+ const { children } = props;
13
+ const classes = useSpanStyles();
14
+ return _jsx("span", { className: classes.span, children: children });
15
+ }
16
+ export const useSelectStyles = makeStyles(() => ({
17
+ selectRoot: {
18
+ padding: 0,
19
+ height: 'auto',
20
+ margin: '4px 0',
21
+ },
22
+ }));
23
+ const sharedControllerStyles = {
24
+ width: '100%',
25
+ flexDirection: 'column',
26
+ };
27
+ export const useControllerSectionStyles = makeStyles(() => ({
28
+ layerControllerRoot: {
29
+ ...sharedControllerStyles,
30
+ padding: '0px 8px',
31
+ },
32
+ }));
33
+ export const useAccordionStyles = makeStyles(theme => ({
34
+ accordionDetailsRoot: {
35
+ ...sharedControllerStyles,
36
+ padding: '8px 8px 24px 8px',
37
+ },
38
+ accordionSummaryRoot: {
39
+ padding: '0px 8px',
40
+ },
41
+ content: {
42
+ margin: '4px 0px',
43
+ minWidth: '0px',
44
+ },
45
+ expanded: {
46
+ marginBottom: theme.spacing(-3),
47
+ top: theme.spacing(-1),
48
+ },
49
+ expandIcon: {
50
+ '&$expanded': {
51
+ top: theme.spacing(-1.3),
52
+ },
53
+ },
54
+ }));
55
+ export const useInputLabelStyles = makeStyles(() => ({
56
+ inputLabelRoot: {
57
+ fontSize: '14px',
58
+ },
59
+ }));
60
+ export const useOverflowEllipsisGridStyles = makeStyles(() => ({
61
+ item: {
62
+ width: '100%',
63
+ overflow: 'hidden',
64
+ whiteSpace: 'nowrap',
65
+ textOverflow: 'ellipsis',
66
+ },
67
+ }));
68
+ export const useSelectionSliderStyles = makeStyles(() => ({
69
+ selectionSliderRoot: {
70
+ marginTop: '7px',
71
+ },
72
+ markActive: {
73
+ backgroundColor: 'rgba(128, 128, 128, 0.7)',
74
+ },
75
+ }));
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Get physical size scaling Matrix4
3
+ * @param {Object} loader PixelSource
4
+ * @returns {Object} matrix
5
+ */
6
+ export function getPhysicalSizeScalingMatrix(loader: Object): Object;
7
+ /**
8
+ * Get bounding cube for a given loader
9
+ * @param {Object} loader PixelSource|PixelSource[]
10
+ * @returns {Array} [0, width], [0, height], [0, depth]]
11
+ */
12
+ export function getBoundingCube(loader: Object): any[];
13
+ export function abbreviateNumber(value: any): any;
14
+ export function toRgbUIString(on: any, arr: any, theme: any): string;
15
+ export function getSingleSelectionStats({ loader, selection, use3d }: Object): Object;
16
+ export function getMultiSelectionStats({ loader, selections, use3d }: {
17
+ loader: any;
18
+ selections: any;
19
+ use3d: any;
20
+ }): Promise<{
21
+ domains: any[];
22
+ sliders: any[];
23
+ }>;
24
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":"AAgFA;;;;GAIG;AACH,qDAHW,MAAM,GACJ,MAAM,CAUlB;AAED;;;;GAIG;AACH,wCAHW,MAAM,SAchB;AAED,kDAwBC;AApIM,qEAKN;AAsDM,sEALI,MAAM,GAGJ,MAAM,CAOlB;AAEM;;;;;;;GAON"}
@@ -0,0 +1,117 @@
1
+ import { viv } from '@vitessce/gl';
2
+ import { Matrix4 } from 'math.gl';
3
+ // Returns an rgb string for display, and changes the color (arr)
4
+ // to use a grey for light theme + white color or if the colormap is on.
5
+ export const toRgbUIString = (on, arr, theme) => {
6
+ const color = on || (theme === 'light' && arr.every(i => i === 255))
7
+ ? [220, 220, 220]
8
+ : arr;
9
+ return `rgb(${color})`;
10
+ };
11
+ async function getSingleSelectionStats2D({ loader, selection }) {
12
+ const data = Array.isArray(loader) ? loader[loader.length - 1] : loader;
13
+ const raster = await data.getRaster({ selection });
14
+ const selectionStats = viv.getChannelStats(raster.data);
15
+ const { domain, contrastLimits: slider } = selectionStats;
16
+ return { domain, slider };
17
+ }
18
+ async function getSingleSelectionStats3D({ loader, selection }) {
19
+ const lowResSource = loader[loader.length - 1];
20
+ const { shape, labels } = lowResSource;
21
+ // eslint-disable-next-line no-bitwise
22
+ const sizeZ = shape[labels.indexOf('z')] >> (loader.length - 1);
23
+ const raster0 = await lowResSource.getRaster({
24
+ selection: { ...selection, z: 0 },
25
+ });
26
+ const rasterMid = await lowResSource.getRaster({
27
+ selection: { ...selection, z: Math.floor(sizeZ / 2) },
28
+ });
29
+ const rasterTop = await lowResSource.getRaster({
30
+ selection: { ...selection, z: Math.max(0, sizeZ - 1) },
31
+ });
32
+ const stats0 = viv.getChannelStats(raster0.data);
33
+ const statsMid = viv.getChannelStats(rasterMid.data);
34
+ const statsTop = viv.getChannelStats(rasterTop.data);
35
+ return {
36
+ domain: [
37
+ Math.min(stats0.domain[0], statsMid.domain[0], statsTop.domain[0]),
38
+ Math.max(stats0.domain[1], statsMid.domain[1], statsTop.domain[1]),
39
+ ],
40
+ slider: [
41
+ Math.min(stats0.contrastLimits[0], statsMid.contrastLimits[0], statsTop.contrastLimits[0]),
42
+ Math.max(stats0.contrastLimits[1], statsMid.contrastLimits[1], statsTop.contrastLimits[1]),
43
+ ],
44
+ };
45
+ }
46
+ /**
47
+ * Get bounding cube for a given loader i.e [[0, width], [0, height], [0, depth]]
48
+ * @param {Object} loader PixelSource|PixelSource[]
49
+ * @param {[]} selection Selection for stats.
50
+ * @param {boolean} use3d Whether or not to get 3d stats.
51
+ * @returns {Object} { domains, sliders }
52
+ */
53
+ export const getSingleSelectionStats = async ({ loader, selection, use3d }) => {
54
+ const getStats = use3d
55
+ ? getSingleSelectionStats3D
56
+ : getSingleSelectionStats2D;
57
+ return getStats({ loader, selection });
58
+ };
59
+ export const getMultiSelectionStats = async ({ loader, selections, use3d }) => {
60
+ const stats = await Promise.all(selections.map(selection => getSingleSelectionStats({ loader, selection, use3d })));
61
+ const domains = stats.map(stat => stat.domain);
62
+ const sliders = stats.map(stat => stat.slider);
63
+ return { domains, sliders };
64
+ };
65
+ /**
66
+ * Get physical size scaling Matrix4
67
+ * @param {Object} loader PixelSource
68
+ * @returns {Object} matrix
69
+ */
70
+ export function getPhysicalSizeScalingMatrix(loader) {
71
+ const { x, y, z } = loader?.meta?.physicalSizes ?? {};
72
+ if (x?.size && y?.size && z?.size) {
73
+ const min = Math.min(z.size, x.size, y.size);
74
+ const ratio = [x.size / min, y.size / min, z.size / min];
75
+ return new Matrix4().scale(ratio);
76
+ }
77
+ return new Matrix4().identity();
78
+ }
79
+ /**
80
+ * Get bounding cube for a given loader
81
+ * @param {Object} loader PixelSource|PixelSource[]
82
+ * @returns {Array} [0, width], [0, height], [0, depth]]
83
+ */
84
+ export function getBoundingCube(loader) {
85
+ const source = Array.isArray(loader) ? loader[0] : loader;
86
+ const { shape, labels } = source;
87
+ const physicalSizeScalingMatrix = getPhysicalSizeScalingMatrix(source);
88
+ const xSlice = [0, physicalSizeScalingMatrix[0] * shape[labels.indexOf('x')]];
89
+ const ySlice = [0, physicalSizeScalingMatrix[5] * shape[labels.indexOf('y')]];
90
+ const zSlice = [
91
+ 0,
92
+ physicalSizeScalingMatrix[10] * shape[labels.indexOf('z')],
93
+ ];
94
+ return [xSlice, ySlice, zSlice];
95
+ }
96
+ export function abbreviateNumber(value) {
97
+ // Return an abbreviated representation of value, in 5 characters or less.
98
+ const maxLength = 5;
99
+ let maxNaiveDigits = maxLength;
100
+ /* eslint-disable no-plusplus */
101
+ if (!Number.isInteger(value)) {
102
+ --maxNaiveDigits;
103
+ } // Wasted on "."
104
+ if (value < 1) {
105
+ --maxNaiveDigits;
106
+ } // Wasted on "0."
107
+ /* eslint-disable no-plusplus */
108
+ const naive = Intl.NumberFormat('en-US', {
109
+ maximumSignificantDigits: maxNaiveDigits,
110
+ useGrouping: false,
111
+ }).format(value);
112
+ if (naive.length <= maxLength)
113
+ return naive;
114
+ // "e+9" consumes 3 characters, so if we even had two significant digits,
115
+ // it would take take us to six characters, including the decimal point.
116
+ return value.toExponential(0);
117
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/layer-controller",
3
- "version": "2.0.3",
3
+ "version": "3.0.1",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -8,32 +8,41 @@
8
8
  "url": "git+https://github.com/vitessce/vitessce.git"
9
9
  },
10
10
  "license": "MIT",
11
- "main": "dist/index.mjs",
11
+ "type": "module",
12
+ "main": "dist/index.js",
12
13
  "files": [
14
+ "src",
13
15
  "dist",
14
- "src"
16
+ "dist-tsc"
15
17
  ],
16
18
  "dependencies": {
17
19
  "@material-ui/core": "~4.12.3",
18
20
  "@material-ui/icons": "~4.11.2",
19
- "lodash": "^4.17.21",
21
+ "lodash-es": "^4.17.21",
20
22
  "math.gl": "^3.5.6",
21
- "@vitessce/constants-internal": "2.0.3",
22
- "@vitessce/gl": "2.0.3",
23
- "@vitessce/spatial-utils": "2.0.3",
24
- "@vitessce/utils": "2.0.3",
25
- "@vitessce/vit-s": "2.0.3"
23
+ "@vitessce/constants-internal": "3.0.1",
24
+ "@vitessce/gl": "3.0.1",
25
+ "@vitessce/spatial-utils": "3.0.1",
26
+ "@vitessce/utils": "3.0.1",
27
+ "@vitessce/vit-s": "3.0.1"
26
28
  },
27
29
  "devDependencies": {
28
30
  "react": "^18.0.0",
29
- "vite": "^3.0.0",
30
- "vitest": "^0.23.4"
31
+ "vite": "^4.3.0",
32
+ "vitest": "^0.32.2"
31
33
  },
32
34
  "peerDependencies": {
33
35
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
34
36
  },
35
37
  "scripts": {
36
38
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
37
- "test": "pnpm exec vitest --run -r ../../../ --dir ."
39
+ "test": "pnpm exec vitest --run"
40
+ },
41
+ "module": "dist/index.js",
42
+ "exports": {
43
+ ".": {
44
+ "types": "./dist-tsc/index.d.ts",
45
+ "import": "./dist/index.js"
46
+ }
38
47
  }
39
48
  }
@@ -1,8 +1,7 @@
1
1
  import React from 'react';
2
- import RemoveCircleIcon from '@material-ui/icons/RemoveCircle';
3
- import IconButton from '@material-ui/core/IconButton';
4
- import Grid from '@material-ui/core/Grid';
5
- import { ChannelSelectionDropdown, ChannelVisibilityCheckbox } from './shared-channel-controls';
2
+ import { RemoveCircle as RemoveCircleIcon } from '@material-ui/icons';
3
+ import { IconButton, Grid } from '@material-ui/core';
4
+ import { ChannelSelectionDropdown, ChannelVisibilityCheckbox } from './shared-channel-controls.js';
6
5
 
7
6
  /**
8
7
  * Controller for the handling the bitmask channels.
@@ -1,10 +1,9 @@
1
1
  import React, { useState } from 'react';
2
- import { makeStyles } from '@material-ui/core/styles';
3
- import MoreVertIcon from '@material-ui/icons/MoreVert';
4
- import MenuItem from '@material-ui/core/MenuItem';
2
+ import { makeStyles, MenuItem } from '@material-ui/core';
3
+ import { MoreVert as MoreVertIcon } from '@material-ui/icons';
5
4
  import { PopperMenu } from '@vitessce/vit-s';
6
- import { MuiSpan } from './styles';
7
- import ColorPalette from './ColorPalette';
5
+ import { MuiSpan } from './styles.js';
6
+ import ColorPalette from './ColorPalette.js';
8
7
 
9
8
  const useStyles = makeStyles(() => ({
10
9
  menuButton: {
@@ -1,11 +1,10 @@
1
1
  import React from 'react';
2
- import IconButton from '@material-ui/core/IconButton';
3
- import LensIcon from '@material-ui/icons/Lens';
4
- import { makeStyles } from '@material-ui/core/styles';
2
+ import { IconButton, makeStyles } from '@material-ui/core';
3
+ import { Lens as LensIcon } from '@material-ui/icons';
5
4
  import { VIEWER_PALETTE } from '@vitessce/utils';
6
5
 
7
6
  const useStyles = makeStyles(theme => ({
8
- container: {
7
+ paletteContainer: {
9
8
  width: '70px',
10
9
  height: '40px',
11
10
  display: 'flex',
@@ -28,7 +27,7 @@ const useStyles = makeStyles(theme => ({
28
27
  const ColorPalette = ({ handleChange }) => {
29
28
  const classes = useStyles();
30
29
  return (
31
- <div className={classes.container} aria-label="color-swatch">
30
+ <div className={classes.paletteContainer} aria-label="color-swatch">
32
31
  {VIEWER_PALETTE.map(color => (
33
32
  <IconButton
34
33
  className={classes.button}
@@ -1,7 +1,6 @@
1
1
  import React, { useState } from 'react';
2
- import { makeStyles } from '@material-ui/core/styles';
3
- import AddIcon from '@material-ui/icons/Add';
4
- import MenuItem from '@material-ui/core/MenuItem';
2
+ import { makeStyles, MenuItem } from '@material-ui/core';
3
+ import { Add as AddIcon } from '@material-ui/icons';
5
4
  import { PopperMenu } from '@vitessce/vit-s';
6
5
 
7
6
  const useStyles = makeStyles(() => ({
@@ -4,31 +4,30 @@ import {
4
4
  GLOBAL_LABELS, getSourceFromLoader, isRgb,
5
5
  } from '@vitessce/spatial-utils';
6
6
 
7
- import Grid from '@material-ui/core/Grid';
8
- import Button from '@material-ui/core/Button';
9
- import AddIcon from '@material-ui/icons/Add';
10
- import Slider from '@material-ui/core/Slider';
11
- import Tabs from '@material-ui/core/Tabs';
12
- import Tab from '@material-ui/core/Tab';
13
-
14
- import Accordion from '@material-ui/core/Accordion';
15
- import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
16
- import VisibilityIcon from '@material-ui/icons/Visibility';
17
- import VisibilityOffIcon from '@material-ui/icons/VisibilityOff';
7
+ import {
8
+ Grid, Button, Slider, Tabs, Tab, InputLabel,
9
+ Accordion, AccordionDetails, AccordionSummary,
10
+ } from '@material-ui/core';
11
+ import {
12
+ Add as AddIcon,
13
+ ExpandMore as ExpandMoreIcon,
14
+ Visibility as VisibilityIcon,
15
+ VisibilityOff as VisibilityOffIcon,
16
+ } from '@material-ui/icons';
17
+
18
18
 
19
19
  import { canLoadResolution } from '@vitessce/utils';
20
- import LayerOptions from './LayerOptions';
21
- import VolumeOptions from './VolumeOptions';
20
+ import LayerOptions from './LayerOptions.js';
21
+ import VolumeOptions from './VolumeOptions.js';
22
22
  import {
23
23
  useControllerSectionStyles,
24
- StyledAccordionDetails,
25
- StyledAccordionSummary,
26
- StyledInputLabel,
27
- OverflowEllipsisGrid,
28
- } from './styles';
29
- import { getMultiSelectionStats } from './utils';
24
+ useInputLabelStyles,
25
+ useOverflowEllipsisGridStyles,
26
+ useAccordionStyles,
27
+ } from './styles.js';
28
+ import { getMultiSelectionStats } from './utils.js';
30
29
 
31
- import { DOMAINS } from './constants';
30
+ import { DOMAINS } from './constants.js';
32
31
 
33
32
  function TabPanel(props) {
34
33
  const {
@@ -398,6 +397,9 @@ export default function LayerController(props) {
398
397
  }
399
398
 
400
399
  const controllerSectionClasses = useControllerSectionStyles();
400
+ const accordionClasses = useAccordionStyles();
401
+ const inputLabelClasses = useInputLabelStyles();
402
+ const overflowEllipsisGridClasses = useOverflowEllipsisGridStyles();
401
403
 
402
404
  const { visible } = layer;
403
405
  const visibleSetting = typeof visible === 'boolean' ? visible : true;
@@ -466,7 +468,7 @@ export default function LayerController(props) {
466
468
  );
467
469
  return (
468
470
  <Accordion
469
- className={controllerSectionClasses.root}
471
+ className={controllerSectionClasses.layerControllerRoot}
470
472
  onChange={(e, expanded) => !disabled
471
473
  && setIsExpanded(
472
474
  expanded && e?.target?.attributes?.role?.value === 'presentation',
@@ -475,12 +477,18 @@ export default function LayerController(props) {
475
477
  TransitionProps={{ enter: false }}
476
478
  expanded={!disabled && isExpanded}
477
479
  >
478
- <StyledAccordionSummary
480
+ <AccordionSummary
481
+ classes={{
482
+ root: accordionClasses.accordionSummaryRoot,
483
+ content: accordionClasses.content,
484
+ expanded: accordionClasses.expanded,
485
+ expandIcon: accordionClasses.expandIcon,
486
+ }}
479
487
  expandIcon={<ExpandMoreIcon role="presentation" />}
480
488
  aria-controls={`layer-${name}-controls`}
481
489
  >
482
490
  <Grid container direction="column" m={1} justifyContent="center">
483
- <OverflowEllipsisGrid item>
491
+ <Grid item classes={{ item: overflowEllipsisGridClasses.item }}>
484
492
  <Button
485
493
  onClick={(e) => {
486
494
  if (!disabled) {
@@ -500,7 +508,7 @@ export default function LayerController(props) {
500
508
  <Visibility />
501
509
  </Button>
502
510
  {name}
503
- </OverflowEllipsisGrid>
511
+ </Grid>
504
512
  {!disabled && !isExpanded && !use3d && (
505
513
  <Grid
506
514
  container
@@ -509,9 +517,12 @@ export default function LayerController(props) {
509
517
  justifyContent="center"
510
518
  >
511
519
  <Grid item xs={6}>
512
- <StyledInputLabel htmlFor={`layer-${name}-opacity-closed`}>
520
+ <InputLabel
521
+ htmlFor={`layer-${name}-opacity-closed`}
522
+ classes={{ root: inputLabelClasses.inputLabelRoot }}
523
+ >
513
524
  Opacity:
514
- </StyledInputLabel>
525
+ </InputLabel>
515
526
  </Grid>
516
527
  <Grid item xs={6}>
517
528
  <Slider
@@ -529,8 +540,8 @@ export default function LayerController(props) {
529
540
  </Grid>
530
541
  )}
531
542
  </Grid>
532
- </StyledAccordionSummary>
533
- <StyledAccordionDetails>
543
+ </AccordionSummary>
544
+ <AccordionDetails classes={{ root: accordionClasses.accordionDetailsRoot }}>
534
545
  {useVolumeTabs ? (
535
546
  <>
536
547
  <Tabs
@@ -593,7 +604,7 @@ export default function LayerController(props) {
593
604
  Remove Image Layer
594
605
  </Button>
595
606
  ) : null}
596
- </StyledAccordionDetails>
607
+ </AccordionDetails>
597
608
  </Accordion>
598
609
  );
599
610
  }
@@ -3,7 +3,7 @@
3
3
  import React, {
4
4
  useCallback, useRef, forwardRef,
5
5
  } from 'react';
6
- import Grid from '@material-ui/core/Grid';
6
+ import { Grid } from '@material-ui/core';
7
7
  import {
8
8
  TitleInfo,
9
9
  useReady,
@@ -15,16 +15,15 @@ import {
15
15
  useLoaders,
16
16
  useAuxiliaryCoordination,
17
17
  useComponentLayout,
18
- registerPluginViewType,
19
18
  } from '@vitessce/vit-s';
20
19
  import { ViewType, COMPONENT_COORDINATION_TYPES } from '@vitessce/constants-internal';
21
20
  import { capitalize } from '@vitessce/utils';
22
21
  import { initializeLayerChannels, DEFAULT_RASTER_LAYER_PROPS } from '@vitessce/spatial-utils';
23
- import RasterChannelController from './RasterChannelController';
24
- import BitmaskChannelController from './BitmaskChannelController';
25
- import VectorLayerController from './VectorLayerController';
26
- import LayerController from './LayerController';
27
- import ImageAddButton from './ImageAddButton';
22
+ import RasterChannelController from './RasterChannelController.js';
23
+ import BitmaskChannelController from './BitmaskChannelController.js';
24
+ import VectorLayerController from './VectorLayerController.js';
25
+ import LayerController from './LayerController.js';
26
+ import ImageAddButton from './ImageAddButton.js';
28
27
 
29
28
  // LayerController is memoized to prevent updates from prop changes that
30
29
  // are caused by view state updates i.e zooming and panning within
@@ -371,7 +370,7 @@ export function LayerControllerSubscriber(props) {
371
370
  // Get data from loaders using the data hooks.
372
371
  // eslint-disable-next-line no-unused-vars
373
372
  const [obsLocationsData, obsLocationsStatus] = useObsLocationsData(
374
- loaders, dataset, () => {}, false,
373
+ loaders, dataset, false,
375
374
  { setSpatialPointLayer: setMoleculesLayer },
376
375
  { spatialPointLayer: moleculesLayer },
377
376
  {}, // TODO: use obsType once #1240 is merged.
@@ -380,13 +379,13 @@ export function LayerControllerSubscriber(props) {
380
379
  { obsSegmentations, obsSegmentationsType },
381
380
  obsSegmentationsStatus,
382
381
  ] = useObsSegmentationsData(
383
- loaders, dataset, () => {}, false,
382
+ loaders, dataset, false,
384
383
  { setSpatialSegmentationLayer: setCellsLayer },
385
384
  { spatialSegmentationLayer: cellsLayer },
386
385
  {}, // TODO: use obsType once #1240 is merged.
387
386
  );
388
387
  const [{ image }, imageStatus] = useImageData(
389
- loaders, dataset, () => {}, false,
388
+ loaders, dataset, false,
390
389
  { setSpatialImageLayer: setRasterLayers },
391
390
  { spatialImageLayer: rasterLayers },
392
391
  {}, // TODO: which values to match on
@@ -500,11 +499,3 @@ export function LayerControllerSubscriber(props) {
500
499
  />
501
500
  );
502
501
  }
503
-
504
- export function register() {
505
- registerPluginViewType(
506
- ViewType.LAYER_CONTROLLER,
507
- LayerControllerSubscriber,
508
- COMPONENT_COORDINATION_TYPES[ViewType.LAYER_CONTROLLER],
509
- );
510
- }
@@ -1,11 +1,7 @@
1
1
  import React from 'react';
2
- import range from 'lodash/range';
2
+ import { range } from 'lodash-es';
3
3
  import { Matrix4 } from 'math.gl';
4
- import Grid from '@material-ui/core/Grid';
5
- import Slider from '@material-ui/core/Slider';
6
- import InputLabel from '@material-ui/core/InputLabel';
7
- import Select from '@material-ui/core/Select';
8
- import Checkbox from '@material-ui/core/Checkbox';
4
+ import { Grid, Slider, InputLabel, Select, Checkbox } from '@material-ui/core';
9
5
  import { viv } from '@vitessce/gl';
10
6
  import { DEFAULT_RASTER_DOMAIN_TYPE } from '@vitessce/spatial-utils';
11
7
  import {
@@ -16,8 +12,8 @@ import {
16
12
  } from '@vitessce/utils';
17
13
  import {
18
14
  getBoundingCube, getMultiSelectionStats,
19
- } from './utils';
20
- import { StyledSelectionSlider, useSelectStyles } from './styles';
15
+ } from './utils.js';
16
+ import { useSelectionSliderStyles, useSelectStyles } from './styles.js';
21
17
 
22
18
  const DOMAIN_OPTIONS = ['Full', 'Min/Max'];
23
19
 
@@ -274,8 +270,10 @@ function GlobalSelectionSlider({
274
270
  handleChange,
275
271
  possibleValues,
276
272
  }) {
273
+ const classes = useSelectionSliderStyles();
277
274
  return (
278
- <StyledSelectionSlider
275
+ <Slider
276
+ classes={{ root: classes.selectionSliderRoot, markActive: classes.markActive }}
279
277
  value={value}
280
278
  // See https://github.com/hms-dbmi/viv/issues/176 for why
281
279
  // we have the two handlers.