@vitessce/layer-controller 3.1.2 → 3.2.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 (43) hide show
  1. package/dist/{deflate-460ebda8.js → deflate-4152c8e9.js} +1 -1
  2. package/dist/{index-7295e6e7.js → index-64da21ec.js} +982 -244
  3. package/dist/index.js +9 -2
  4. package/dist/{jpeg-5e6a02ae.js → jpeg-29889288.js} +1 -1
  5. package/dist/{lerc-f147b9b3.js → lerc-899a010f.js} +1 -1
  6. package/dist/{lzw-328dcf22.js → lzw-f5a9e721.js} +1 -1
  7. package/dist/{packbits-d1842d12.js → packbits-5fc9c646.js} +1 -1
  8. package/dist/{raw-e59a20ba.js → raw-0ae87697.js} +1 -1
  9. package/dist/{webimage-30f949aa.js → webimage-1731afb4.js} +1 -1
  10. package/dist-tsc/ChannelOptions.d.ts.map +1 -1
  11. package/dist-tsc/ChannelOptions.js +6 -1
  12. package/dist-tsc/LayerController.d.ts.map +1 -1
  13. package/dist-tsc/LayerController.js +1 -4
  14. package/dist-tsc/LayerOptions.d.ts.map +1 -1
  15. package/dist-tsc/LayerOptions.js +3 -4
  16. package/dist-tsc/RasterChannelController.d.ts.map +1 -1
  17. package/dist-tsc/RasterChannelController.js +1 -25
  18. package/dist-tsc/VolumeOptions.js +1 -1
  19. package/dist-tsc/index.d.ts +1 -0
  20. package/dist-tsc/index.js +1 -0
  21. package/dist-tsc/styles.d.ts +3 -3
  22. package/dist-tsc/styles.d.ts.map +1 -1
  23. package/dist-tsc/styles.js +10 -13
  24. package/package.json +6 -6
  25. package/src/ChannelOptions.js +7 -1
  26. package/src/LayerController.js +6 -5
  27. package/src/LayerOptions.js +11 -7
  28. package/src/RasterChannelController.js +7 -29
  29. package/src/VolumeOptions.js +1 -1
  30. package/src/index.js +9 -0
  31. package/src/styles.js +10 -14
  32. package/dist-tsc/RasterChannelController.test.d.ts +0 -2
  33. package/dist-tsc/RasterChannelController.test.d.ts.map +0 -1
  34. package/dist-tsc/RasterChannelController.test.js +0 -22
  35. package/dist-tsc/constants.d.ts +0 -2
  36. package/dist-tsc/constants.d.ts.map +0 -1
  37. package/dist-tsc/constants.js +0 -12
  38. package/dist-tsc/utils.d.ts +0 -24
  39. package/dist-tsc/utils.d.ts.map +0 -1
  40. package/dist-tsc/utils.js +0 -117
  41. package/src/RasterChannelController.test.js +0 -24
  42. package/src/constants.js +0 -14
  43. package/src/utils.js +0 -138
package/dist/index.js CHANGED
@@ -1,9 +1,16 @@
1
- import { a, L, V } from "./index-7295e6e7.js";
1
+ import { a, L, V, d, c, e, f, b, h, u } from "./index-64da21ec.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
5
5
  export {
6
6
  a as LayerController,
7
7
  L as LayerControllerSubscriber,
8
- V as VectorLayerController
8
+ V as VectorLayerController,
9
+ d as useAccordionStyles,
10
+ c as useControllerSectionStyles,
11
+ e as useInputLabelStyles,
12
+ f as useOverflowEllipsisGridStyles,
13
+ b as useSelectStyles,
14
+ h as useSelectionSliderStyles,
15
+ u as useSpanStyles
9
16
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-7295e6e7.js";
1
+ import { B as BaseDecoder } from "./index-64da21ec.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-7295e6e7.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-64da21ec.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-7295e6e7.js";
1
+ import { B as BaseDecoder } from "./index-64da21ec.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-7295e6e7.js";
1
+ import { B as BaseDecoder } from "./index-64da21ec.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-7295e6e7.js";
1
+ import { B as BaseDecoder } from "./index-64da21ec.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-7295e6e7.js";
1
+ import { B as BaseDecoder } from "./index-64da21ec.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1 +1 @@
1
- {"version":3,"file":"ChannelOptions.d.ts","sourceRoot":"","sources":["../src/ChannelOptions.js"],"names":[],"mappings":";AAoBA;;;;;GAKG;AACH;;;;gBA2CC"}
1
+ {"version":3,"file":"ChannelOptions.d.ts","sourceRoot":"","sources":["../src/ChannelOptions.js"],"names":[],"mappings":";AA0BA;;;;;GAKG;AACH;;;;gBA2CC"}
@@ -3,7 +3,7 @@ import React, { useState } from 'react';
3
3
  import { makeStyles, MenuItem } from '@material-ui/core';
4
4
  import { MoreVert as MoreVertIcon } from '@material-ui/icons';
5
5
  import { PopperMenu } from '@vitessce/vit-s';
6
- import { MuiSpan } from './styles.js';
6
+ import { useSpanStyles } from './styles.js';
7
7
  import ColorPalette from './ColorPalette.js';
8
8
  const useStyles = makeStyles(() => ({
9
9
  menuButton: {
@@ -17,6 +17,11 @@ const useStyles = makeStyles(() => ({
17
17
  paddingRight: '2px',
18
18
  },
19
19
  }));
20
+ function MuiSpan(props) {
21
+ const { children } = props;
22
+ const classes = useSpanStyles();
23
+ return _jsx("span", { className: classes.span, children: children });
24
+ }
20
25
  /**
21
26
  * Dropdown for options for a channel on the three dots button.
22
27
  * @prop {function} handlePropertyChange Callback for changing property (color, IQR of sliders).
@@ -1 +1 @@
1
- {"version":3,"file":"LayerController.d.ts","sourceRoot":"","sources":["../src/LayerController.js"],"names":[],"mappings":"AA2EA;;;;;;;GAOG;AACH,iEAuhBC"}
1
+ {"version":3,"file":"LayerController.d.ts","sourceRoot":"","sources":["../src/LayerController.js"],"names":[],"mappings":"AA4EA;;;;;;;GAOG;AACH,iEAuhBC"}
@@ -1,15 +1,12 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useState, useRef, useEffect, useId } from 'react';
3
3
  import { viv } from '@vitessce/gl';
4
- import { GLOBAL_LABELS, getSourceFromLoader, isRgb, } from '@vitessce/spatial-utils';
4
+ import { GLOBAL_LABELS, getSourceFromLoader, isRgb, getMultiSelectionStats, DOMAINS, canLoadResolution, } from '@vitessce/spatial-utils';
5
5
  import { Grid, Button, Slider, Tabs, Tab, InputLabel, Accordion, AccordionDetails, AccordionSummary, } from '@material-ui/core';
6
6
  import { Add as AddIcon, ExpandMore as ExpandMoreIcon, Visibility as VisibilityIcon, VisibilityOff as VisibilityOffIcon, } from '@material-ui/icons';
7
- import { canLoadResolution } from '@vitessce/utils';
8
7
  import LayerOptions from './LayerOptions.js';
9
8
  import VolumeOptions from './VolumeOptions.js';
10
9
  import { useControllerSectionStyles, useInputLabelStyles, useOverflowEllipsisGridStyles, useAccordionStyles, } from './styles.js';
11
- import { getMultiSelectionStats } from './utils.js';
12
- import { DOMAINS } from './constants.js';
13
10
  function TabPanel(props) {
14
11
  const { children, value, index, ...other } = props;
15
12
  return (_jsx("div", { role: "tabpanel", hidden: value !== index, id: `simple-tabpanel-${index}`, "aria-labelledby": `simple-tab-${index}`, ...other, children: value === index && children }));
@@ -1 +1 @@
1
- {"version":3,"file":"LayerOptions.d.ts","sourceRoot":"","sources":["../src/LayerOptions.js"],"names":[],"mappings":";AA0UA;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAyIC"}
1
+ {"version":3,"file":"LayerOptions.d.ts","sourceRoot":"","sources":["../src/LayerOptions.js"],"names":[],"mappings":";AA8UA;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAyIC"}
@@ -4,10 +4,9 @@ import { range } from 'lodash-es';
4
4
  import { Matrix4 } from 'math.gl';
5
5
  import { Grid, Slider, InputLabel, Select, Checkbox } from '@material-ui/core';
6
6
  import { viv } from '@vitessce/gl';
7
- import { DEFAULT_RASTER_DOMAIN_TYPE } from '@vitessce/spatial-utils';
8
- import { COLORMAP_OPTIONS, canLoadResolution, formatBytes, getStatsForResolution, } from '@vitessce/utils';
9
- import { getBoundingCube, getMultiSelectionStats, } from './utils.js';
10
- import { useSelectionSliderStyles, useSelectStyles, useChannelSliderStyles } from './styles.js';
7
+ import { getBoundingCube, getMultiSelectionStats, DEFAULT_RASTER_DOMAIN_TYPE, canLoadResolution, getStatsForResolution, } from '@vitessce/spatial-utils';
8
+ import { COLORMAP_OPTIONS, formatBytes, } from '@vitessce/utils';
9
+ import { useSelectionSliderStyles, useSelectStyles, useChannelSliderStyles, } from './styles.js';
11
10
  const DOMAIN_OPTIONS = ['Full', 'Min/Max'];
12
11
  /**
13
12
  * Wrapper for the dropdown that selects a colormap (None, viridis, magma, etc.).
@@ -1 +1 @@
1
- {"version":3,"file":"RasterChannelController.d.ts","sourceRoot":"","sources":["../src/RasterChannelController.js"],"names":[],"mappings":";AA8FA;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;;;;;;;;gBAgJC"}
1
+ {"version":3,"file":"RasterChannelController.d.ts","sourceRoot":"","sources":["../src/RasterChannelController.js"],"names":[],"mappings":";AAwEA;;;;;;;;;;;;;GAaG;AACH;;;;;;;;;;;;;;;;;;gBAgJC"}
@@ -2,34 +2,10 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useCallback, useState, useEffect } from 'react';
3
3
  import { Grid, Slider } from '@material-ui/core';
4
4
  import { debounce, isEqual } from 'lodash-es';
5
- import { getSourceFromLoader } from '@vitessce/spatial-utils';
5
+ import { getSourceFromLoader, getMultiSelectionStats, toRgbUIString, abbreviateNumber, DOMAINS, } from '@vitessce/spatial-utils';
6
6
  import ChannelOptions from './ChannelOptions.js';
7
- import { DOMAINS } from './constants.js';
8
- import { getMultiSelectionStats, toRgbUIString } from './utils.js';
9
7
  import { ChannelSelectionDropdown, ChannelVisibilityCheckbox, } from './shared-channel-controls.js';
10
8
  import { useChannelSliderStyles } from './styles.js';
11
- function abbreviateNumber(value) {
12
- // Return an abbreviated representation of value, in 5 characters or less.
13
- const maxLength = 5;
14
- let maxNaiveDigits = maxLength;
15
- /* eslint-disable no-plusplus */
16
- if (!Number.isInteger(value)) {
17
- --maxNaiveDigits;
18
- } // Wasted on "."
19
- if (value < 1) {
20
- --maxNaiveDigits;
21
- } // Wasted on "0."
22
- /* eslint-disable no-plusplus */
23
- const naive = Intl.NumberFormat('en-US', {
24
- maximumSignificantDigits: maxNaiveDigits,
25
- useGrouping: false,
26
- }).format(value);
27
- if (naive.length <= maxLength)
28
- return naive;
29
- // "e+9" consumes 3 characters, so if we even had two significant digits,
30
- // it would take take us to six characters, including the decimal point.
31
- return value.toExponential(0);
32
- }
33
9
  /**
34
10
  * Slider for controlling current colormap.
35
11
  * @prop {string} color Current color for this channel.
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { Matrix4 } from 'math.gl';
4
4
  import { Grid, Typography, Button, makeStyles, createStyles, FormControl, Select, InputLabel, Slider, } from '@material-ui/core';
5
5
  import { viv } from '@vitessce/gl';
6
- import { abbreviateNumber, getBoundingCube } from './utils.js';
6
+ import { abbreviateNumber, getBoundingCube } from '@vitessce/spatial-utils';
7
7
  import { useSelectStyles } from './styles.js';
8
8
  const useSlicerStyles = makeStyles(theme => createStyles({
9
9
  enabled: {},
@@ -1,4 +1,5 @@
1
1
  export { LayerControllerSubscriber } from "./LayerControllerSubscriber.js";
2
2
  export { default as LayerController } from "./LayerController.js";
3
3
  export { default as VectorLayerController } from "./VectorLayerController.js";
4
+ export { useSpanStyles, useSelectStyles, useControllerSectionStyles, useAccordionStyles, useInputLabelStyles, useOverflowEllipsisGridStyles, useSelectionSliderStyles } from "./styles.js";
4
5
  //# sourceMappingURL=index.d.ts.map
package/dist-tsc/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { LayerControllerSubscriber } from './LayerControllerSubscriber.js';
2
2
  export { default as LayerController } from './LayerController.js';
3
3
  export { default as VectorLayerController } from './VectorLayerController.js';
4
+ export { useSpanStyles, useSelectStyles, useControllerSectionStyles, useAccordionStyles, useInputLabelStyles, useOverflowEllipsisGridStyles, useSelectionSliderStyles, } from './styles.js';
@@ -1,8 +1,8 @@
1
- export function MuiSpan(props: any): import(".pnpm/@types+react@18.2.7/node_modules/@types/react").JSX.Element;
1
+ export const useSpanStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"span">;
2
2
  export const useChannelSliderStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"valueLabel">;
3
3
  export const useSelectStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"selectRoot">;
4
- export const useControllerSectionStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"layerControllerRoot">;
5
- export const useAccordionStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<never>;
4
+ export const useControllerSectionStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"layerControllerRoot" | "layerControllerGrid">;
5
+ export const useAccordionStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"content" | "expanded" | "accordionDetailsRoot" | "accordionSummaryRoot" | "expandIcon">;
6
6
  export const useInputLabelStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"inputLabelRoot">;
7
7
  export const useOverflowEllipsisGridStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"item">;
8
8
  export const useSelectionSliderStyles: (props?: any) => import("@material-ui/core/styles/withStyles").ClassNameMap<"selectionSliderRoot" | "markActive">;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.js"],"names":[],"mappings":"AAqBA,+GAIC;AAdD,+HAQI;AAQJ,wHAMI;AAOJ,4IAKI;AAEJ,oHAqBI;AAEJ,gIAII;AAEJ,gIAOI;AAEJ,yJAOI"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.js"],"names":[],"mappings":"AAEA,gHAOI;AAEJ,+HAQI;AAEJ,wHAQI;AAEJ,oKASI;AAEJ,sMAsBI;AAEJ,gIAII;AAEJ,gIAOI;AAEJ,yJAOI"}
@@ -1,6 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
1
  import { makeStyles } from '@material-ui/core';
3
- const useSpanStyles = makeStyles(() => ({
2
+ export const useSpanStyles = makeStyles(() => ({
4
3
  span: {
5
4
  width: '70px',
6
5
  textAlign: 'center',
@@ -17,31 +16,29 @@ export const useChannelSliderStyles = makeStyles(theme => ({
17
16
  },
18
17
  },
19
18
  }));
20
- export function MuiSpan(props) {
21
- const { children } = props;
22
- const classes = useSpanStyles();
23
- return _jsx("span", { className: classes.span, children: children });
24
- }
25
19
  export const useSelectStyles = makeStyles(() => ({
26
20
  selectRoot: {
27
21
  padding: 0,
28
22
  height: 'auto',
29
23
  margin: '4px 0',
24
+ fontSize: '14px',
25
+ width: '100%',
30
26
  },
31
27
  }));
32
- const sharedControllerStyles = {
33
- width: '100%',
34
- flexDirection: 'column',
35
- };
36
28
  export const useControllerSectionStyles = makeStyles(() => ({
37
29
  layerControllerRoot: {
38
- ...sharedControllerStyles,
30
+ width: '100%',
31
+ flexDirection: 'column',
39
32
  padding: '0px 8px',
40
33
  },
34
+ layerControllerGrid: {
35
+ marginTop: '10px',
36
+ },
41
37
  }));
42
38
  export const useAccordionStyles = makeStyles(theme => ({
43
39
  accordionDetailsRoot: {
44
- ...sharedControllerStyles,
40
+ width: '100%',
41
+ flexDirection: 'column',
45
42
  padding: '8px 8px 24px 8px',
46
43
  },
47
44
  accordionSummaryRoot: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/layer-controller",
3
- "version": "3.1.2",
3
+ "version": "3.2.0",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -20,11 +20,11 @@
20
20
  "@material-ui/icons": "~4.11.2",
21
21
  "lodash-es": "^4.17.21",
22
22
  "math.gl": "^3.5.6",
23
- "@vitessce/constants-internal": "3.1.2",
24
- "@vitessce/gl": "3.1.2",
25
- "@vitessce/spatial-utils": "3.1.2",
26
- "@vitessce/utils": "3.1.2",
27
- "@vitessce/vit-s": "3.1.2"
23
+ "@vitessce/constants-internal": "3.2.0",
24
+ "@vitessce/gl": "3.2.0",
25
+ "@vitessce/spatial-utils": "3.2.0",
26
+ "@vitessce/utils": "3.2.0",
27
+ "@vitessce/vit-s": "3.2.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "react": "^18.0.0",
@@ -2,7 +2,7 @@ import React, { useState } from 'react';
2
2
  import { makeStyles, MenuItem } from '@material-ui/core';
3
3
  import { MoreVert as MoreVertIcon } from '@material-ui/icons';
4
4
  import { PopperMenu } from '@vitessce/vit-s';
5
- import { MuiSpan } from './styles.js';
5
+ import { useSpanStyles } from './styles.js';
6
6
  import ColorPalette from './ColorPalette.js';
7
7
 
8
8
  const useStyles = makeStyles(() => ({
@@ -18,6 +18,12 @@ const useStyles = makeStyles(() => ({
18
18
  },
19
19
  }));
20
20
 
21
+ function MuiSpan(props) {
22
+ const { children } = props;
23
+ const classes = useSpanStyles();
24
+ return <span className={classes.span}>{children}</span>;
25
+ }
26
+
21
27
  /**
22
28
  * Dropdown for options for a channel on the three dots button.
23
29
  * @prop {function} handlePropertyChange Callback for changing property (color, IQR of sliders).
@@ -1,7 +1,12 @@
1
1
  import React, { useState, useRef, useEffect, useId } from 'react';
2
2
  import { viv } from '@vitessce/gl';
3
3
  import {
4
- GLOBAL_LABELS, getSourceFromLoader, isRgb,
4
+ GLOBAL_LABELS,
5
+ getSourceFromLoader,
6
+ isRgb,
7
+ getMultiSelectionStats,
8
+ DOMAINS,
9
+ canLoadResolution,
5
10
  } from '@vitessce/spatial-utils';
6
11
 
7
12
  import {
@@ -15,8 +20,6 @@ import {
15
20
  VisibilityOff as VisibilityOffIcon,
16
21
  } from '@material-ui/icons';
17
22
 
18
-
19
- import { canLoadResolution } from '@vitessce/utils';
20
23
  import LayerOptions from './LayerOptions.js';
21
24
  import VolumeOptions from './VolumeOptions.js';
22
25
  import {
@@ -25,9 +28,7 @@ import {
25
28
  useOverflowEllipsisGridStyles,
26
29
  useAccordionStyles,
27
30
  } from './styles.js';
28
- import { getMultiSelectionStats } from './utils.js';
29
31
 
30
- import { DOMAINS } from './constants.js';
31
32
 
32
33
  function TabPanel(props) {
33
34
  const {
@@ -3,18 +3,22 @@ import { range } from 'lodash-es';
3
3
  import { Matrix4 } from 'math.gl';
4
4
  import { Grid, Slider, InputLabel, Select, Checkbox } from '@material-ui/core';
5
5
  import { viv } from '@vitessce/gl';
6
- import { DEFAULT_RASTER_DOMAIN_TYPE } from '@vitessce/spatial-utils';
7
6
  import {
8
- COLORMAP_OPTIONS,
7
+ getBoundingCube,
8
+ getMultiSelectionStats,
9
+ DEFAULT_RASTER_DOMAIN_TYPE,
9
10
  canLoadResolution,
10
- formatBytes,
11
11
  getStatsForResolution,
12
+ } from '@vitessce/spatial-utils';
13
+ import {
14
+ COLORMAP_OPTIONS,
15
+ formatBytes,
12
16
  } from '@vitessce/utils';
13
17
  import {
14
- getBoundingCube, getMultiSelectionStats,
15
- } from './utils.js';
16
-
17
- import { useSelectionSliderStyles, useSelectStyles, useChannelSliderStyles } from './styles.js';
18
+ useSelectionSliderStyles,
19
+ useSelectStyles,
20
+ useChannelSliderStyles,
21
+ } from './styles.js';
18
22
 
19
23
  const DOMAIN_OPTIONS = ['Full', 'Min/Max'];
20
24
 
@@ -3,42 +3,20 @@ import React, { useCallback, useState, useEffect } from 'react';
3
3
  import { Grid, Slider } from '@material-ui/core';
4
4
  import { debounce, isEqual } from 'lodash-es';
5
5
 
6
- import { getSourceFromLoader } from '@vitessce/spatial-utils';
6
+ import {
7
+ getSourceFromLoader,
8
+ getMultiSelectionStats,
9
+ toRgbUIString,
10
+ abbreviateNumber,
11
+ DOMAINS,
12
+ } from '@vitessce/spatial-utils';
7
13
  import ChannelOptions from './ChannelOptions.js';
8
- import { DOMAINS } from './constants.js';
9
- import { getMultiSelectionStats, toRgbUIString } from './utils.js';
10
14
  import {
11
15
  ChannelSelectionDropdown,
12
16
  ChannelVisibilityCheckbox,
13
17
  } from './shared-channel-controls.js';
14
18
  import { useChannelSliderStyles } from './styles.js';
15
19
 
16
- function abbreviateNumber(value) {
17
- // Return an abbreviated representation of value, in 5 characters or less.
18
-
19
- const maxLength = 5;
20
- let maxNaiveDigits = maxLength;
21
-
22
- /* eslint-disable no-plusplus */
23
- if (!Number.isInteger(value)) {
24
- --maxNaiveDigits;
25
- } // Wasted on "."
26
- if (value < 1) {
27
- --maxNaiveDigits;
28
- } // Wasted on "0."
29
- /* eslint-disable no-plusplus */
30
-
31
- const naive = Intl.NumberFormat('en-US', {
32
- maximumSignificantDigits: maxNaiveDigits,
33
- useGrouping: false,
34
- }).format(value);
35
- if (naive.length <= maxLength) return naive;
36
-
37
- // "e+9" consumes 3 characters, so if we even had two significant digits,
38
- // it would take take us to six characters, including the decimal point.
39
- return value.toExponential(0);
40
- }
41
-
42
20
  /**
43
21
  * Slider for controlling current colormap.
44
22
  * @prop {string} color Current color for this channel.
@@ -12,7 +12,7 @@ import {
12
12
  Slider,
13
13
  } from '@material-ui/core';
14
14
  import { viv } from '@vitessce/gl';
15
- import { abbreviateNumber, getBoundingCube } from './utils.js';
15
+ import { abbreviateNumber, getBoundingCube } from '@vitessce/spatial-utils';
16
16
  import { useSelectStyles } from './styles.js';
17
17
 
18
18
  const useSlicerStyles = makeStyles(theme => createStyles({
package/src/index.js CHANGED
@@ -1,3 +1,12 @@
1
1
  export { LayerControllerSubscriber } from './LayerControllerSubscriber.js';
2
2
  export { default as LayerController } from './LayerController.js';
3
3
  export { default as VectorLayerController } from './VectorLayerController.js';
4
+ export {
5
+ useSpanStyles,
6
+ useSelectStyles,
7
+ useControllerSectionStyles,
8
+ useAccordionStyles,
9
+ useInputLabelStyles,
10
+ useOverflowEllipsisGridStyles,
11
+ useSelectionSliderStyles,
12
+ } from './styles.js';
package/src/styles.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { makeStyles } from '@material-ui/core';
2
2
 
3
- const useSpanStyles = makeStyles(() => ({
3
+ export const useSpanStyles = makeStyles(() => ({
4
4
  span: {
5
5
  width: '70px',
6
6
  textAlign: 'center',
@@ -19,35 +19,31 @@ export const useChannelSliderStyles = makeStyles(theme => ({
19
19
  },
20
20
  }));
21
21
 
22
- export function MuiSpan(props) {
23
- const { children } = props;
24
- const classes = useSpanStyles();
25
- return <span className={classes.span}>{children}</span>;
26
- }
27
-
28
22
  export const useSelectStyles = makeStyles(() => ({
29
23
  selectRoot: {
30
24
  padding: 0,
31
25
  height: 'auto',
32
26
  margin: '4px 0',
27
+ fontSize: '14px',
28
+ width: '100%',
33
29
  },
34
30
  }));
35
31
 
36
- const sharedControllerStyles = {
37
- width: '100%',
38
- flexDirection: 'column',
39
- };
40
-
41
32
  export const useControllerSectionStyles = makeStyles(() => ({
42
33
  layerControllerRoot: {
43
- ...sharedControllerStyles,
34
+ width: '100%',
35
+ flexDirection: 'column',
44
36
  padding: '0px 8px',
45
37
  },
38
+ layerControllerGrid: {
39
+ marginTop: '10px',
40
+ },
46
41
  }));
47
42
 
48
43
  export const useAccordionStyles = makeStyles(theme => ({
49
44
  accordionDetailsRoot: {
50
- ...sharedControllerStyles,
45
+ width: '100%',
46
+ flexDirection: 'column',
51
47
  padding: '8px 8px 24px 8px',
52
48
  },
53
49
  accordionSummaryRoot: {
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=RasterChannelController.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RasterChannelController.test.d.ts","sourceRoot":"","sources":["../src/RasterChannelController.test.js"],"names":[],"mappings":""}
@@ -1,22 +0,0 @@
1
- import { describe, it, expect } from 'vitest';
2
- import { toRgbUIString } from './utils.js';
3
- const GREY = [220, 220, 220];
4
- describe('layer-controller/RasterChannelController.js', () => {
5
- describe('toRgbUIString()', () => {
6
- it('Maps color value to itself when colormap off and not white with dark theme', () => {
7
- expect(toRgbUIString(false, [200, 200, 200], 'dark')).toEqual(`rgb(${[200, 200, 200]})`);
8
- });
9
- it('Maps color value to grey when colormap on with dark theme', () => {
10
- expect(toRgbUIString(true, [200, 200, 200], 'dark')).toEqual(`rgb(${GREY})`);
11
- });
12
- it('Maps color value to grey when colormap on with light theme', () => {
13
- expect(toRgbUIString(true, [200, 200, 200], 'light')).toEqual(`rgb(${GREY})`);
14
- });
15
- it('Maps color value to grey when colormap off and white with light theme', () => {
16
- expect(toRgbUIString(false, [255, 255, 255], 'light')).toEqual(`rgb(${GREY})`);
17
- });
18
- it('Maps color value to grey when colormap off and white with light theme', () => {
19
- expect(toRgbUIString(false, [200, 200, 200], 'light')).toEqual(`rgb(${[200, 200, 200]})`);
20
- });
21
- });
22
- });
@@ -1,2 +0,0 @@
1
- export const DOMAINS: {};
2
- //# sourceMappingURL=constants.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.js"],"names":[],"mappings":"AAaA,yBAAoC"}
@@ -1,12 +0,0 @@
1
- import { viv } from '@vitessce/gl';
2
- function getDomains() {
3
- const domains = {};
4
- const needMin = ['Int8', 'Int16', 'Int32'];
5
- Object.keys(viv.DTYPE_VALUES).forEach((dtype) => {
6
- const { max } = viv.DTYPE_VALUES[dtype];
7
- const min = needMin.includes(dtype) ? -(max + 1) : 0;
8
- domains[dtype] = [min, max];
9
- });
10
- return domains;
11
- }
12
- export const DOMAINS = getDomains();
@@ -1,24 +0,0 @@
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
@@ -1 +0,0 @@
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"}