@vitessce/vit-s 3.5.11 → 3.6.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 (57) hide show
  1. package/dist/index.js +27266 -23266
  2. package/dist-tsc/DebugWindow.js +1 -1
  3. package/dist-tsc/LoadingIndicator.js +3 -3
  4. package/dist-tsc/TitleInfo.d.ts.map +1 -1
  5. package/dist-tsc/TitleInfo.js +8 -9
  6. package/dist-tsc/VitS.d.ts +3 -0
  7. package/dist-tsc/VitS.d.ts.map +1 -1
  8. package/dist-tsc/VitS.js +11 -6
  9. package/dist-tsc/VitessceGrid.d.ts.map +1 -1
  10. package/dist-tsc/VitessceGrid.js +5 -5
  11. package/dist-tsc/VitessceGrid.test.js +2 -6
  12. package/dist-tsc/Warning.js +1 -1
  13. package/dist-tsc/mui-utils.d.ts.map +1 -1
  14. package/dist-tsc/mui-utils.js +2 -0
  15. package/dist-tsc/shared-mui/components.d.ts.map +1 -1
  16. package/dist-tsc/shared-mui/components.js +5 -5
  17. package/dist-tsc/shared-mui/container.d.ts +10 -1
  18. package/dist-tsc/shared-mui/container.d.ts.map +1 -1
  19. package/dist-tsc/shared-mui/container.js +199 -190
  20. package/dist-tsc/shared-mui/styles.d.ts +3 -3
  21. package/dist-tsc/shared-mui/styles.js +9 -6
  22. package/dist-tsc/shared-plot-options/CellColorEncodingOption.js +2 -2
  23. package/dist-tsc/shared-plot-options/OptionSelect.d.ts.map +1 -1
  24. package/dist-tsc/shared-plot-options/OptionSelect.js +3 -3
  25. package/dist-tsc/shared-plot-options/OptionsContainer.js +2 -2
  26. package/dist-tsc/shared-plot-options/styles.d.ts +9 -1
  27. package/dist-tsc/shared-plot-options/styles.d.ts.map +1 -1
  28. package/dist-tsc/shared-plot-options/styles.js +4 -3
  29. package/dist-tsc/shared-warning-styles.d.ts +9 -1
  30. package/dist-tsc/shared-warning-styles.d.ts.map +1 -1
  31. package/dist-tsc/shared-warning-styles.js +2 -2
  32. package/dist-tsc/title-styles.d.ts +9 -1
  33. package/dist-tsc/title-styles.d.ts.map +1 -1
  34. package/dist-tsc/title-styles.js +2 -2
  35. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.d.ts +0 -6
  36. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.js +1 -5
  37. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.js +2 -6
  38. package/package.json +17 -17
  39. package/src/DebugWindow.js +1 -1
  40. package/src/LoadingIndicator.js +3 -3
  41. package/src/TitleInfo.js +9 -10
  42. package/src/VitS.js +19 -11
  43. package/src/VitessceGrid.js +7 -3
  44. package/src/VitessceGrid.test.jsx +3 -8
  45. package/src/Warning.js +1 -1
  46. package/src/mui-utils.js +2 -0
  47. package/src/shared-mui/components.js +11 -8
  48. package/src/shared-mui/container.js +206 -190
  49. package/src/shared-mui/styles.js +9 -7
  50. package/src/shared-plot-options/CellColorEncodingOption.js +2 -2
  51. package/src/shared-plot-options/OptionSelect.js +3 -4
  52. package/src/shared-plot-options/OptionsContainer.js +2 -2
  53. package/src/shared-plot-options/styles.js +4 -3
  54. package/src/shared-warning-styles.js +2 -2
  55. package/src/title-styles.js +2 -2
  56. package/src/vitessce-grid-layout/VitessceGridLayout.js +1 -6
  57. package/src/vitessce-grid-layout/VitessceGridLayout.test.jsx +2 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/vit-s",
3
- "version": "3.5.11",
3
+ "version": "3.6.0",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -16,8 +16,6 @@
16
16
  "dist-tsc"
17
17
  ],
18
18
  "dependencies": {
19
- "@material-ui/core": "~4.12.3",
20
- "@material-ui/icons": "~4.11.2",
21
19
  "@tanstack/react-query": "^4.29.12",
22
20
  "clsx": "^1.1.1",
23
21
  "d3-array": "^2.4.0",
@@ -30,25 +28,27 @@
30
28
  "zustand": "^3.5.10",
31
29
  "react-aria": "^3.28.0",
32
30
  "react-error-boundary": "^5.0.0",
33
- "@vitessce/abstract": "3.5.11",
34
- "@vitessce/constants-internal": "3.5.11",
35
- "@vitessce/plugins": "3.5.11",
36
- "@vitessce/schemas": "3.5.11",
37
- "@vitessce/utils": "3.5.11",
38
- "@vitessce/sets-utils": "3.5.11",
39
- "@vitessce/config": "3.5.11",
40
- "@vitessce/globals": "3.5.11"
31
+ "@vitessce/styles": "3.6.0",
32
+ "@vitessce/abstract": "3.6.0",
33
+ "@vitessce/constants-internal": "3.6.0",
34
+ "@vitessce/plugins": "3.6.0",
35
+ "@vitessce/schemas": "3.6.0",
36
+ "@vitessce/utils": "3.6.0",
37
+ "@vitessce/sets-utils": "3.6.0",
38
+ "@vitessce/config": "3.6.0",
39
+ "@vitessce/globals": "3.6.0"
41
40
  },
42
41
  "devDependencies": {
43
- "@testing-library/jest-dom": "^5.16.4",
44
- "@testing-library/react": "^13.3.0",
42
+ "@testing-library/jest-dom": "^6.6.3",
43
+ "@testing-library/react": "^16.3.0",
45
44
  "react": "^18.0.0",
46
- "vite": "^4.3.0",
47
- "vitest": "^0.32.2",
48
- "@vitessce/types": "3.5.11"
45
+ "react-dom": "^18.0.0",
46
+ "vite": "^6.3.5",
47
+ "vitest": "^3.1.4",
48
+ "@vitessce/types": "3.6.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
51
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
52
52
  },
53
53
  "scripts": {
54
54
  "bundle": "pnpm exec vite build -c ../../scripts/vite.config.js",
@@ -3,7 +3,7 @@ import { useStyles } from './shared-warning-styles.js';
3
3
  import { VITESSCE_CONTAINER } from './classNames.js';
4
4
 
5
5
  export function DebugWindow({ debugErrors }) {
6
- const classes = useStyles();
6
+ const { classes } = useStyles();
7
7
  return (
8
8
  <div className={VITESSCE_CONTAINER}>
9
9
  <div className={clsx(classes.warningLayout, classes.containerFluid)}>
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { makeStyles, CircularProgress } from '@material-ui/core';
2
+ import { makeStyles, CircularProgress } from '@vitessce/styles';
3
3
 
4
- const useStyles = makeStyles(() => ({
4
+ const useStyles = makeStyles()(() => ({
5
5
  loadingIndicatorBackdrop: {
6
6
  position: 'absolute',
7
7
  top: '0',
@@ -30,7 +30,7 @@ const useStyles = makeStyles(() => ({
30
30
  }));
31
31
 
32
32
  export default function LoadingIndicator() {
33
- const classes = useStyles();
33
+ const { classes } = useStyles();
34
34
  return (
35
35
  <div className={classes.loadingIndicatorBackdrop}>
36
36
  <div className={classes.loadingIndicatorContainer} role="status" aria-live="polite">
package/src/TitleInfo.js CHANGED
@@ -1,21 +1,20 @@
1
1
  import React, { useState, useMemo } from 'react';
2
2
  import clsx from 'clsx';
3
- import { makeStyles, MenuItem, IconButton, Link } from '@material-ui/core';
4
- import {
3
+ import { makeStyles, MenuItem, IconButton, Link,
5
4
  CloudDownload as CloudDownloadIcon,
6
5
  ArrowDropDown as ArrowDropDownIcon,
7
6
  ArrowDropUp as ArrowDropUpIcon,
8
7
  Settings as SettingsIcon,
9
8
  Close as CloseIcon,
10
9
  Help as HelpIcon,
11
- } from '@material-ui/icons';
10
+ } from '@vitessce/styles';
12
11
 
13
12
  import { TOOLTIP_ANCESTOR } from './classNames.js';
14
13
  import LoadingIndicator from './LoadingIndicator.js';
15
14
  import { PopperMenu } from './shared-mui/components.js';
16
15
  import { useTitleStyles } from './title-styles.js';
17
16
 
18
- const useStyles = makeStyles(theme => ({
17
+ const useStyles = makeStyles()(theme => ({
19
18
  iconButton: {
20
19
  border: 'none',
21
20
  marginLeft: 0,
@@ -27,7 +26,7 @@ const useStyles = makeStyles(theme => ({
27
26
  '&:hover': {
28
27
  backgroundColor: theme.palette.primaryBackgroundLight,
29
28
  },
30
- '&:first-child': {
29
+ '&:first-of-type': {
31
30
  marginLeft: '0.25em',
32
31
  },
33
32
  '&:last-child': {
@@ -69,7 +68,7 @@ function SettingsIconWithArrow({ open }) {
69
68
  function PlotOptions(props) {
70
69
  const { options } = props;
71
70
  const [open, setOpen] = useState(false);
72
- const classes = useStyles();
71
+ const { classes } = useStyles();
73
72
 
74
73
  const buttonIcon = useMemo(() => (<SettingsIconWithArrow open={open} />), [open]);
75
74
  return (options ? (
@@ -98,7 +97,7 @@ function CloudDownloadIconWithArrow({ open }) {
98
97
  function DownloadOptions(props) {
99
98
  const { urls } = props;
100
99
  const [open, setOpen] = useState(false);
101
- const classes = useStyles();
100
+ const { classes } = useStyles();
102
101
  const buttonIcon = useMemo(() => (<CloudDownloadIconWithArrow open={open} />), [open]);
103
102
  return (urls && urls.length ? (
104
103
  <PopperMenu
@@ -123,7 +122,7 @@ function DownloadOptions(props) {
123
122
  function HelpButton(props) {
124
123
  const { helpText } = props;
125
124
  const [open, setOpen] = useState(false);
126
- const classes = useStyles();
125
+ const { classes } = useStyles();
127
126
  return (
128
127
  <PopperMenu
129
128
  open={open}
@@ -142,7 +141,7 @@ function HelpButton(props) {
142
141
 
143
142
  function ClosePaneButton(props) {
144
143
  const { removeGridComponent } = props;
145
- const classes = useStyles();
144
+ const { classes } = useStyles();
146
145
  return (
147
146
  <IconButton
148
147
  onClick={removeGridComponent}
@@ -163,7 +162,7 @@ export function TitleInfo(props) {
163
162
  helpText, withPadding = true,
164
163
  } = props;
165
164
 
166
- const classes = useTitleStyles();
165
+ const { classes } = useTitleStyles();
167
166
 
168
167
  return (
169
168
  // d-flex without wrapping div is not always full height; I don't understand the root cause.
package/src/VitS.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import React, { useState, useEffect, useMemo, useCallback, useLayoutEffect } from 'react';
2
2
  import {
3
3
  ThemeProvider,
4
- StylesProvider,
5
- } from '@material-ui/core';
4
+ CacheProvider,
5
+ createCache,
6
+ } from '@vitessce/styles';
6
7
  import {
7
8
  QueryClient,
8
9
  QueryClientProvider,
@@ -30,7 +31,6 @@ import {
30
31
  logConfig,
31
32
  } from './view-config-utils.js';
32
33
  import { createLoaders } from './vitessce-grid-utils.js';
33
- import { createGenerateClassName } from './mui-utils.js';
34
34
  import { AsyncFunctionsContext } from './contexts.js';
35
35
 
36
36
 
@@ -59,6 +59,8 @@ import { AsyncFunctionsContext } from './contexts.js';
59
59
  * @param {null|string} props.uid A unique identifier for this Vitessce instance,
60
60
  * for the purpose of avoiding CSS autogenerated class name conflicts. Must be valid as part
61
61
  * of a CSS class name string.
62
+ * @param {undefined|Node} props.styleContainer The DOM node for insertion of styles,
63
+ * passed to Emotion's createCache.container. Useful when Vitessce is in the Shadow DOM.
62
64
  * @param {boolean} props.remountOnUidChange Whether to remount the coordination provider
63
65
  * upon changes to config.uid. By default, true.
64
66
  * @param {array} props.viewTypes Plugin view types.
@@ -85,6 +87,7 @@ export function VitS(props) {
85
87
  validateOnConfigChange = false,
86
88
  isBounded = false,
87
89
  uid = null,
90
+ styleContainer,
88
91
  remountOnUidChange = true,
89
92
  viewTypes: viewTypesProp,
90
93
  fileTypes: fileTypesProp,
@@ -110,7 +113,6 @@ export function VitS(props) {
110
113
  () => (coordinationTypesProp || []),
111
114
  [coordinationTypesProp],
112
115
  );
113
- const generateClassName = useMemo(() => createGenerateClassName(uid), [uid]);
114
116
 
115
117
  // Set error handling-related globals.
116
118
  useLayoutEffect(() => {
@@ -221,6 +223,12 @@ export function VitS(props) {
221
223
  [asyncFunctionsProp, queryClient],
222
224
  );
223
225
 
226
+ const muiCache = useMemo(() => createCache({
227
+ key: uid || 'vit',
228
+ prepend: true,
229
+ container: styleContainer,
230
+ }), [uid, styleContainer]);
231
+
224
232
  // Emit the upgraded/initialized view config
225
233
  // to onConfigChange if necessary.
226
234
  useEffect(() => {
@@ -252,20 +260,20 @@ export function VitS(props) {
252
260
  // so that when the child throws errors the parent can catch.
253
261
  if (debugMode && debugErrors.length > 0) {
254
262
  return (
255
- <StylesProvider generateClassName={generateClassName}>
263
+ <CacheProvider value={muiCache}>
256
264
  <ThemeProvider theme={muiTheme[theme]}>
257
265
  <DebugWindow debugErrors={debugErrors} />
258
266
  </ThemeProvider>
259
- </StylesProvider>
267
+ </CacheProvider>
260
268
  );
261
269
  }
262
270
  return success ? (
263
- <StylesProvider generateClassName={generateClassName}>
271
+ <CacheProvider value={muiCache}>
264
272
  <ThemeProvider theme={muiTheme[theme]}>
265
273
  <QueryClientProvider client={queryClient}>
266
274
  <ViewConfigProvider
267
275
  createStore={createViewConfigStoreClosure}
268
- {...(remountOnUidChange ? ({ key: configKey }) : {})}
276
+ key={(remountOnUidChange ? configKey : undefined)}
269
277
  >
270
278
  <AuxiliaryProvider createStore={createAuxiliaryStore}>
271
279
  <AsyncFunctionsContext.Provider value={asyncFunctions}>
@@ -297,12 +305,12 @@ export function VitS(props) {
297
305
  </ViewConfigProvider>
298
306
  </QueryClientProvider>
299
307
  </ThemeProvider>
300
- </StylesProvider>
308
+ </CacheProvider>
301
309
  ) : (
302
- <StylesProvider generateClassName={generateClassName}>
310
+ <CacheProvider value={muiCache}>
303
311
  <ThemeProvider theme={muiTheme[theme]}>
304
312
  <Warning {...configOrWarning} />
305
313
  </ThemeProvider>
306
- </StylesProvider>
314
+ </CacheProvider>
307
315
  );
308
316
  }
@@ -19,7 +19,10 @@ import {
19
19
  import {
20
20
  useClosestVitessceContainerSize,
21
21
  } from './hooks.js';
22
- import { useVitessceContainerStyles } from './shared-mui/container.js';
22
+ import {
23
+ useVitessceContainerStyles,
24
+ GridLayoutGlobalStyles,
25
+ } from './shared-mui/container.js';
23
26
  import { useTitleStyles } from './title-styles.js';
24
27
  import { getAltText } from './generate-alt-text.js';
25
28
 
@@ -61,8 +64,8 @@ export default function VitessceGrid(props) {
61
64
 
62
65
  const [componentWidth] = useClosestVitessceContainerSize(containerRef);
63
66
 
64
- const classes = useVitessceContainerStyles();
65
- const titleClasses = useTitleStyles();
67
+ const { classes } = useVitessceContainerStyles();
68
+ const { classes: titleClasses } = useTitleStyles();
66
69
 
67
70
  const altText = useMemo(() => getAltText(config), [configKey]);
68
71
 
@@ -113,6 +116,7 @@ export default function VitessceGrid(props) {
113
116
  role="group"
114
117
  aria-label={altText}
115
118
  >
119
+ <GridLayoutGlobalStyles classes={classes} />
116
120
  {layout ? (
117
121
  <VitessceGridLayout
118
122
  pageMode={pageMode}
@@ -1,8 +1,7 @@
1
- import { describe, it, expect, afterEach } from 'vitest';
2
- import '@testing-library/jest-dom';
3
- import { cleanup, render, screen } from '@testing-library/react';
4
-
5
1
  import React from 'react';
2
+ import { describe, it, expect } from 'vitest';
3
+ import { render, screen } from '@testing-library/react';
4
+
6
5
  import { PluginViewType } from '@vitessce/plugins';
7
6
  import VitessceGrid from './VitessceGrid.js';
8
7
  import {
@@ -10,10 +9,6 @@ import {
10
9
  AuxiliaryProvider, createAuxiliaryStore,
11
10
  } from './state/hooks.js';
12
11
 
13
- afterEach(() => {
14
- cleanup();
15
- });
16
-
17
12
  describe('VitessceGrid.js', () => {
18
13
  describe('<VitessceGrid />', () => {
19
14
  it('renders', async () => {
package/src/Warning.js CHANGED
@@ -8,7 +8,7 @@ export function Warning(props) {
8
8
  preformatted,
9
9
  unformatted,
10
10
  } = props;
11
- const classes = useStyles();
11
+ const { classes } = useStyles();
12
12
  return (
13
13
  <div className={VITESSCE_CONTAINER}>
14
14
  <div className={clsx(classes.warningLayout, classes.containerFluid)}>
package/src/mui-utils.js CHANGED
@@ -23,6 +23,8 @@ const stateClasses = [
23
23
 
24
24
  const defaultPrefix = 'vit-';
25
25
 
26
+ // TODO: We are no longer using this; is it still needed?
27
+ // Reference: https://mui.com/material-ui/experimental-api/classname-generator/
26
28
  export function createGenerateClassName(customPrefix) {
27
29
  return (rule, styleSheet) => {
28
30
  const {
@@ -7,11 +7,11 @@ import {
7
7
  MenuList,
8
8
  ClickAwayListener,
9
9
  Fade,
10
- } from '@material-ui/core';
10
+ } from '@vitessce/styles';
11
11
  import clsx from 'clsx';
12
12
  import { useVitessceContainer } from '../hooks.js';
13
13
 
14
- const useStyles = makeStyles(() => ({
14
+ const useStyles = makeStyles()(() => ({
15
15
  paper: {
16
16
  maxHeight: 200,
17
17
  overflow: 'auto',
@@ -33,9 +33,10 @@ export function PopperMenu(props) {
33
33
  placement = 'bottom-end',
34
34
  withPaper = true,
35
35
  containerClassName,
36
+ paperClassName,
36
37
  'aria-label': ariaLabel,
37
38
  } = props;
38
- const classes = useStyles();
39
+ const { classes } = useStyles();
39
40
 
40
41
  const anchorRef = useRef();
41
42
 
@@ -75,11 +76,13 @@ export function PopperMenu(props) {
75
76
  {({ TransitionProps }) => (
76
77
  <ClickAwayListener onClickAway={handleClose}>
77
78
  <Fade {...TransitionProps} timeout={100}>
78
- {withPaper ? (
79
- <Paper elevation={4} className={classes.paper}>
80
- <MenuList>{children}</MenuList>
81
- </Paper>
82
- ) : children}
79
+ <div>
80
+ {withPaper ? (
81
+ <Paper elevation={16} className={clsx(classes.paper, paperClassName)}>
82
+ <MenuList>{children}</MenuList>
83
+ </Paper>
84
+ ) : children}
85
+ </div>
83
86
  </Fade>
84
87
  </ClickAwayListener>
85
88
  )}