@vitessce/vit-s 2.0.3 → 3.0.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.
- package/dist/index.js +41348 -0
- package/dist-tsc/CallbackPublisher.d.ts +18 -0
- package/dist-tsc/CallbackPublisher.d.ts.map +1 -0
- package/dist-tsc/CallbackPublisher.js +62 -0
- package/dist-tsc/LoadingIndicator.d.ts +2 -0
- package/dist-tsc/LoadingIndicator.d.ts.map +1 -0
- package/dist-tsc/LoadingIndicator.js +26 -0
- package/dist-tsc/TitleInfo.d.ts +2 -0
- package/dist-tsc/TitleInfo.d.ts.map +1 -0
- package/dist-tsc/TitleInfo.js +74 -0
- package/dist-tsc/VitS.d.ts +45 -0
- package/dist-tsc/VitS.d.ts.map +1 -0
- package/dist-tsc/VitS.js +119 -0
- package/dist-tsc/VitessceGrid.d.ts +23 -0
- package/dist-tsc/VitessceGrid.d.ts.map +1 -0
- package/dist-tsc/VitessceGrid.js +60 -0
- package/dist-tsc/VitessceGrid.test.d.ts +2 -0
- package/dist-tsc/VitessceGrid.test.d.ts.map +1 -0
- package/dist-tsc/VitessceGrid.test.js +40 -0
- package/dist-tsc/Warning.d.ts +2 -0
- package/dist-tsc/Warning.d.ts.map +1 -0
- package/dist-tsc/Warning.js +45 -0
- package/dist-tsc/classNames.d.ts +8 -0
- package/dist-tsc/classNames.d.ts.map +1 -0
- package/dist-tsc/classNames.js +8 -0
- package/dist-tsc/data/AbstractLoader.d.ts +22 -0
- package/dist-tsc/data/AbstractLoader.d.ts.map +1 -0
- package/dist-tsc/data/AbstractLoader.js +18 -0
- package/dist-tsc/data/AbstractTwoStepLoader.d.ts +6 -0
- package/dist-tsc/data/AbstractTwoStepLoader.d.ts.map +1 -0
- package/dist-tsc/data/AbstractTwoStepLoader.js +7 -0
- package/dist-tsc/data/LoaderResult.d.ts +7 -0
- package/dist-tsc/data/LoaderResult.d.ts.map +1 -0
- package/dist-tsc/data/LoaderResult.js +7 -0
- package/dist-tsc/data/index.d.ts +4 -0
- package/dist-tsc/data/index.d.ts.map +1 -0
- package/dist-tsc/data/index.js +3 -0
- package/dist-tsc/data/loader-registry.d.ts +9 -0
- package/dist-tsc/data/loader-registry.d.ts.map +1 -0
- package/dist-tsc/data/loader-registry.js +27 -0
- package/dist-tsc/data-hook-utils.d.ts +69 -0
- package/dist-tsc/data-hook-utils.d.ts.map +1 -0
- package/dist-tsc/data-hook-utils.js +173 -0
- package/dist-tsc/data-hooks.d.ts +77 -0
- package/dist-tsc/data-hooks.d.ts.map +1 -0
- package/dist-tsc/data-hooks.js +241 -0
- package/dist-tsc/errors/AbstractLoaderError.d.ts +10 -0
- package/dist-tsc/errors/AbstractLoaderError.d.ts.map +1 -0
- package/dist-tsc/errors/AbstractLoaderError.js +13 -0
- package/dist-tsc/errors/DataSourceFetchError.d.ts +8 -0
- package/dist-tsc/errors/DataSourceFetchError.d.ts.map +1 -0
- package/dist-tsc/errors/DataSourceFetchError.js +13 -0
- package/dist-tsc/errors/DatasetNotFoundError.d.ts +6 -0
- package/dist-tsc/errors/DatasetNotFoundError.d.ts.map +1 -0
- package/dist-tsc/errors/DatasetNotFoundError.js +17 -0
- package/dist-tsc/errors/LoaderNotFoundError.d.ts +10 -0
- package/dist-tsc/errors/LoaderNotFoundError.d.ts.map +1 -0
- package/dist-tsc/errors/LoaderNotFoundError.js +17 -0
- package/dist-tsc/errors/LoaderValidationError.d.ts +10 -0
- package/dist-tsc/errors/LoaderValidationError.d.ts.map +1 -0
- package/dist-tsc/errors/LoaderValidationError.js +15 -0
- package/dist-tsc/errors/index.d.ts +6 -0
- package/dist-tsc/errors/index.d.ts.map +1 -0
- package/dist-tsc/errors/index.js +5 -0
- package/dist-tsc/hooks.d.ts +80 -0
- package/dist-tsc/hooks.d.ts.map +1 -0
- package/dist-tsc/hooks.js +271 -0
- package/dist-tsc/index.d.ts +11 -0
- package/dist-tsc/index.d.ts.map +1 -0
- package/dist-tsc/index.js +10 -17
- package/dist-tsc/plugins.test.fixtures.d.ts +61 -0
- package/dist-tsc/plugins.test.fixtures.d.ts.map +1 -0
- package/dist-tsc/plugins.test.fixtures.js +76 -0
- package/dist-tsc/schemas/config-0.1.0.schema.json +84 -0
- package/dist-tsc/schemas/config-1.0.0.schema.json +733 -0
- package/dist-tsc/schemas/config-1.0.1.schema.json +909 -0
- package/dist-tsc/schemas/config-1.0.10.schema.json +969 -0
- package/dist-tsc/schemas/config-1.0.11.schema.json +990 -0
- package/dist-tsc/schemas/config-1.0.12.schema.json +997 -0
- package/dist-tsc/schemas/config-1.0.13.schema.json +1013 -0
- package/dist-tsc/schemas/config-1.0.14.schema.json +1048 -0
- package/dist-tsc/schemas/config-1.0.15.schema.json +1048 -0
- package/dist-tsc/schemas/config-1.0.16.schema.json +1089 -0
- package/dist-tsc/schemas/config-1.0.2.schema.json +910 -0
- package/dist-tsc/schemas/config-1.0.3.schema.json +910 -0
- package/dist-tsc/schemas/config-1.0.4.schema.json +949 -0
- package/dist-tsc/schemas/config-1.0.5.schema.json +949 -0
- package/dist-tsc/schemas/config-1.0.6.schema.json +949 -0
- package/dist-tsc/schemas/config-1.0.7.schema.json +949 -0
- package/dist-tsc/schemas/config-1.0.8.schema.json +965 -0
- package/dist-tsc/schemas/config-1.0.9.schema.json +965 -0
- package/dist-tsc/schemas/obsSets.schema.d.ts +179 -0
- package/dist-tsc/schemas/obsSets.schema.d.ts.map +1 -0
- package/dist-tsc/schemas/obsSets.schema.js +195 -0
- package/dist-tsc/schemas/obsSetsTabular.schema.d.ts +57 -0
- package/dist-tsc/schemas/obsSetsTabular.schema.d.ts.map +1 -0
- package/dist-tsc/schemas/obsSetsTabular.schema.js +38 -0
- package/dist-tsc/schemas/raster.schema.d.ts +239 -0
- package/dist-tsc/schemas/raster.schema.d.ts.map +1 -0
- package/dist-tsc/schemas/raster.schema.js +120 -0
- package/dist-tsc/shared-mui/components.d.ts +2 -0
- package/dist-tsc/shared-mui/components.d.ts.map +1 -0
- package/dist-tsc/shared-mui/components.js +29 -0
- package/dist-tsc/shared-mui/container.d.ts +2 -0
- package/dist-tsc/shared-mui/container.d.ts.map +1 -0
- package/dist-tsc/shared-mui/container.js +211 -0
- package/dist-tsc/shared-mui/styles.d.ts +5 -0
- package/dist-tsc/shared-mui/styles.d.ts.map +1 -0
- package/dist-tsc/shared-mui/styles.js +109 -0
- package/dist-tsc/shared-plot-options/CellColorEncodingOption.d.ts +2 -0
- package/dist-tsc/shared-plot-options/CellColorEncodingOption.d.ts.map +1 -0
- package/dist-tsc/shared-plot-options/CellColorEncodingOption.js +17 -0
- package/dist-tsc/shared-plot-options/OptionSelect.d.ts +2 -0
- package/dist-tsc/shared-plot-options/OptionSelect.d.ts.map +1 -0
- package/dist-tsc/shared-plot-options/OptionSelect.js +12 -0
- package/dist-tsc/shared-plot-options/OptionsContainer.d.ts +2 -0
- package/dist-tsc/shared-plot-options/OptionsContainer.d.ts.map +1 -0
- package/dist-tsc/shared-plot-options/OptionsContainer.js +9 -0
- package/dist-tsc/shared-plot-options/index.d.ts +5 -0
- package/dist-tsc/shared-plot-options/index.d.ts.map +1 -0
- package/dist-tsc/shared-plot-options/index.js +4 -0
- package/dist-tsc/shared-plot-options/styles.d.ts +2 -0
- package/dist-tsc/shared-plot-options/styles.d.ts.map +1 -0
- package/dist-tsc/shared-plot-options/styles.js +48 -0
- package/dist-tsc/state/hooks.d.ts +216 -0
- package/dist-tsc/state/hooks.d.ts.map +1 -0
- package/dist-tsc/state/hooks.js +575 -0
- package/dist-tsc/title-styles.d.ts +2 -0
- package/dist-tsc/title-styles.d.ts.map +1 -0
- package/dist-tsc/title-styles.js +72 -0
- package/dist-tsc/view-config-utils.d.ts +30 -0
- package/dist-tsc/view-config-utils.d.ts.map +1 -0
- package/dist-tsc/view-config-utils.js +234 -0
- package/dist-tsc/view-config-utils.test.d.ts +2 -0
- package/dist-tsc/view-config-utils.test.d.ts.map +1 -0
- package/dist-tsc/view-config-utils.test.fixtures.d.ts +1049 -0
- package/dist-tsc/view-config-utils.test.fixtures.d.ts.map +1 -0
- package/dist-tsc/view-config-utils.test.fixtures.js +883 -0
- package/dist-tsc/view-config-utils.test.js +209 -0
- package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.d.ts +8 -0
- package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.d.ts.map +1 -0
- package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.js +114 -0
- package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.d.ts +2 -0
- package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.d.ts.map +1 -0
- package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.test.js +48 -0
- package/dist-tsc/vitessce-grid-layout/index.d.ts +2 -0
- package/dist-tsc/vitessce-grid-layout/index.d.ts.map +1 -0
- package/dist-tsc/vitessce-grid-layout/index.js +1 -0
- package/dist-tsc/vitessce-grid-layout/layout-utils.d.ts +15 -0
- package/dist-tsc/vitessce-grid-layout/layout-utils.d.ts.map +1 -0
- package/dist-tsc/vitessce-grid-layout/layout-utils.js +61 -0
- package/dist-tsc/vitessce-grid-layout/layout-utils.test.d.ts +2 -0
- package/dist-tsc/vitessce-grid-layout/layout-utils.test.d.ts.map +1 -0
- package/dist-tsc/vitessce-grid-layout/layout-utils.test.js +148 -0
- package/dist-tsc/vitessce-grid-utils.d.ts +13 -0
- package/dist-tsc/vitessce-grid-utils.d.ts.map +1 -0
- package/dist-tsc/vitessce-grid-utils.js +141 -0
- package/package.json +23 -10
- package/src/CallbackPublisher.js +7 -11
- package/src/LoadingIndicator.js +1 -2
- package/src/TitleInfo.js +12 -85
- package/src/VitS.js +72 -50
- package/src/VitessceGrid.js +21 -13
- package/src/VitessceGrid.test.jsx +16 -7
- package/src/Warning.js +2 -2
- package/src/data/AbstractLoader.js +2 -25
- package/src/data/AbstractTwoStepLoader.js +1 -1
- package/src/data/index.js +3 -3
- package/src/data/loader-registry.js +22 -13
- package/src/data-hook-utils.js +4 -6
- package/src/data-hooks.js +4 -4
- package/src/errors/DataSourceFetchError.js +1 -1
- package/src/errors/DatasetNotFoundError.js +1 -1
- package/src/errors/LoaderNotFoundError.js +1 -1
- package/src/errors/LoaderValidationError.js +1 -1
- package/src/errors/index.js +5 -6
- package/src/hooks.js +70 -5
- package/src/index.js +21 -46
- package/src/schemas/config-1.0.16.schema.json +21 -1
- package/src/shared-mui/components.js +10 -8
- package/src/shared-mui/container.js +1 -1
- package/src/shared-mui/styles.js +5 -2
- package/src/shared-plot-options/CellColorEncodingOption.js +3 -4
- package/src/shared-plot-options/OptionSelect.js +2 -2
- package/src/shared-plot-options/OptionsContainer.js +2 -5
- package/src/shared-plot-options/index.js +4 -4
- package/src/shared-plot-options/styles.js +1 -1
- package/src/state/hooks.js +10 -3
- package/src/title-styles.js +73 -0
- package/src/view-config-utils.js +46 -98
- package/src/view-config-utils.test.jsx +222 -0
- package/src/vitessce-grid-layout/VitessceGridLayout.js +51 -30
- package/src/vitessce-grid-layout/VitessceGridLayout.test.jsx +17 -9
- package/src/vitessce-grid-layout/index.js +1 -1
- package/src/vitessce-grid-layout/layout-utils.js +1 -1
- package/src/vitessce-grid-layout/layout-utils.test.js +1 -1
- package/src/vitessce-grid-utils.js +27 -15
- package/dist/index.mjs +0 -84801
- package/src/component-registry.js +0 -21
- package/src/errors/OptionsValidationError.js +0 -25
- package/src/file-options-schemas-legacy.js +0 -139
- package/src/file-options-schemas-legacy.test.js +0 -138
- package/src/file-options-schemas.js +0 -327
- package/src/file-options-schemas.test.js +0 -26
- package/src/joint-file-types-legacy.js +0 -298
- package/src/joint-file-types-legacy.test.js +0 -412
- package/src/joint-file-types.js +0 -171
- package/src/joint-file-types.test.js +0 -144
- package/src/json-schemas.js +0 -9
- package/src/plugins.js +0 -186
- package/src/plugins.test.js +0 -42
- package/src/schemas/config-1.0.16.schema.test.js +0 -32
- package/src/schemas/schema.test-old.js +0 -49
- package/src/view-config-upgraders.js +0 -628
- package/src/view-config-utils.test.js +0 -95
- package/src/view-config-versions.js +0 -68
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is a dummy component which handles
|
|
3
|
+
* publishing new view configs and loaders to
|
|
4
|
+
* the provided callbacks on changes.
|
|
5
|
+
* @param {object} props
|
|
6
|
+
* @param {function} props.onConfigChange A callback function
|
|
7
|
+
* to execute on each change of the Vitessce view config.
|
|
8
|
+
* @param {function} props.onLoaderChange A callback function
|
|
9
|
+
* to execute on each change of the loaders object.
|
|
10
|
+
* @param {boolean} props.validateOnConfigChange Whether to validate
|
|
11
|
+
* against the view config schema when publishing changes.
|
|
12
|
+
*/
|
|
13
|
+
export default function CallbackPublisher(props: {
|
|
14
|
+
onConfigChange: Function;
|
|
15
|
+
onLoaderChange: Function;
|
|
16
|
+
validateOnConfigChange: boolean;
|
|
17
|
+
}): null;
|
|
18
|
+
//# sourceMappingURL=CallbackPublisher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CallbackPublisher.d.ts","sourceRoot":"","sources":["../src/CallbackPublisher.js"],"names":[],"mappings":"AAeA;;;;;;;;;;;GAWG;AACH;IAP2B,cAAc;IAEd,cAAc;IAEf,sBAAsB,EAArC,OAAO;SAoDjB"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useViewConfigStoreApi, useLoaders, useWarning } from './state/hooks.js';
|
|
3
|
+
function validateViewConfig(viewConfig, pluginSpecificConfigSchema) {
|
|
4
|
+
// Need the try-catch here since Zustand will actually
|
|
5
|
+
// just catch and ignore errors in its subscription callbacks.
|
|
6
|
+
try {
|
|
7
|
+
pluginSpecificConfigSchema.parse(viewConfig);
|
|
8
|
+
}
|
|
9
|
+
catch (e) {
|
|
10
|
+
console.error(e);
|
|
11
|
+
}
|
|
12
|
+
// Do nothing if successful.
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* This is a dummy component which handles
|
|
16
|
+
* publishing new view configs and loaders to
|
|
17
|
+
* the provided callbacks on changes.
|
|
18
|
+
* @param {object} props
|
|
19
|
+
* @param {function} props.onConfigChange A callback function
|
|
20
|
+
* to execute on each change of the Vitessce view config.
|
|
21
|
+
* @param {function} props.onLoaderChange A callback function
|
|
22
|
+
* to execute on each change of the loaders object.
|
|
23
|
+
* @param {boolean} props.validateOnConfigChange Whether to validate
|
|
24
|
+
* against the view config schema when publishing changes.
|
|
25
|
+
*/
|
|
26
|
+
export default function CallbackPublisher(props) {
|
|
27
|
+
const { onWarn, onConfigChange, onLoaderChange, validateOnConfigChange, pluginSpecificConfigSchema, } = props;
|
|
28
|
+
const warning = useWarning();
|
|
29
|
+
const loaders = useLoaders();
|
|
30
|
+
const viewConfigStoreApi = useViewConfigStoreApi();
|
|
31
|
+
// View config updates are often-occurring, so
|
|
32
|
+
// we want to use the "transient update" approach
|
|
33
|
+
// to subscribe to view config changes.
|
|
34
|
+
// Reference: https://github.com/react-spring/zustand#transient-updates-for-often-occuring-state-changes
|
|
35
|
+
useEffect(() => viewConfigStoreApi.subscribe(
|
|
36
|
+
// The function to run on each publish.
|
|
37
|
+
(viewConfig) => {
|
|
38
|
+
if (validateOnConfigChange && viewConfig) {
|
|
39
|
+
validateViewConfig(viewConfig, pluginSpecificConfigSchema);
|
|
40
|
+
}
|
|
41
|
+
if (onConfigChange && viewConfig) {
|
|
42
|
+
onConfigChange(viewConfig);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
// The function to specify which part of the store
|
|
46
|
+
// we want to subscribe to.
|
|
47
|
+
state => state.viewConfig), [onConfigChange, validateOnConfigChange, viewConfigStoreApi, pluginSpecificConfigSchema]);
|
|
48
|
+
// Emit updates to the warning message.
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (onWarn && warning) {
|
|
51
|
+
onWarn(warning);
|
|
52
|
+
}
|
|
53
|
+
}, [warning, onWarn]);
|
|
54
|
+
// Emit updates to the loaders.
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (onLoaderChange && loaders) {
|
|
57
|
+
onLoaderChange(loaders);
|
|
58
|
+
}
|
|
59
|
+
}, [loaders, onLoaderChange]);
|
|
60
|
+
// Render nothing.
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoadingIndicator.d.ts","sourceRoot":"","sources":["../src/LoadingIndicator.js"],"names":[],"mappings":"AAuBA,wDASC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { makeStyles, CircularProgress } from '@material-ui/core';
|
|
4
|
+
const useStyles = makeStyles(() => ({
|
|
5
|
+
loadingIndicatorBackdrop: {
|
|
6
|
+
position: 'absolute',
|
|
7
|
+
top: '0',
|
|
8
|
+
left: '0',
|
|
9
|
+
zIndex: '1040',
|
|
10
|
+
width: '100%',
|
|
11
|
+
height: '100%',
|
|
12
|
+
borderRadius: '4px',
|
|
13
|
+
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
14
|
+
},
|
|
15
|
+
loadingIndicatorContainer: {
|
|
16
|
+
display: 'grid',
|
|
17
|
+
placeItems: 'center',
|
|
18
|
+
position: 'absolute',
|
|
19
|
+
width: '100%',
|
|
20
|
+
height: '100%',
|
|
21
|
+
},
|
|
22
|
+
}));
|
|
23
|
+
export default function LoadingIndicator() {
|
|
24
|
+
const classes = useStyles();
|
|
25
|
+
return (_jsx("div", { className: classes.loadingIndicatorBackdrop, children: _jsx("div", { className: classes.loadingIndicatorContainer, children: _jsx(CircularProgress, {}) }) }));
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TitleInfo.d.ts","sourceRoot":"","sources":["../src/TitleInfo.js"],"names":[],"mappings":"AAuHA,mDA+CC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useState } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { makeStyles, MenuItem, IconButton, Link } from '@material-ui/core';
|
|
5
|
+
import { CloudDownload as CloudDownloadIcon, ArrowDropDown as ArrowDropDownIcon, ArrowDropUp as ArrowDropUpIcon, Settings as SettingsIcon, Close as CloseIcon, } from '@material-ui/icons';
|
|
6
|
+
import { TOOLTIP_ANCESTOR } from './classNames.js';
|
|
7
|
+
import LoadingIndicator from './LoadingIndicator.js';
|
|
8
|
+
import { PopperMenu } from './shared-mui/components.js';
|
|
9
|
+
import { useTitleStyles } from './title-styles.js';
|
|
10
|
+
const useStyles = makeStyles(theme => ({
|
|
11
|
+
iconButton: {
|
|
12
|
+
border: 'none',
|
|
13
|
+
marginLeft: 0,
|
|
14
|
+
background: 'none',
|
|
15
|
+
color: theme.palette.primaryForeground,
|
|
16
|
+
paddingLeft: '0.25em',
|
|
17
|
+
paddingRight: '0.25em',
|
|
18
|
+
borderRadius: '2px',
|
|
19
|
+
'&:hover': {
|
|
20
|
+
backgroundColor: theme.palette.primaryBackgroundLight,
|
|
21
|
+
},
|
|
22
|
+
'&:first-child': {
|
|
23
|
+
marginLeft: '0.25em',
|
|
24
|
+
},
|
|
25
|
+
'&:last-child': {
|
|
26
|
+
marginRight: '0.25em',
|
|
27
|
+
},
|
|
28
|
+
'& svg': {
|
|
29
|
+
width: '0.7em',
|
|
30
|
+
height: '0.7em',
|
|
31
|
+
verticalAlign: 'middle',
|
|
32
|
+
overflow: 'visible',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
downloadLink: {
|
|
36
|
+
color: theme.palette.primaryForeground,
|
|
37
|
+
},
|
|
38
|
+
}));
|
|
39
|
+
function SettingsIconWithArrow({ open }) {
|
|
40
|
+
return (_jsxs(_Fragment, { children: [_jsx(SettingsIcon, {}), open ? _jsx(ArrowDropUpIcon, {}) : _jsx(ArrowDropDownIcon, {})] }));
|
|
41
|
+
}
|
|
42
|
+
function PlotOptions(props) {
|
|
43
|
+
const { options } = props;
|
|
44
|
+
const [open, setOpen] = useState(false);
|
|
45
|
+
const classes = useStyles();
|
|
46
|
+
return (options ? (_jsx(PopperMenu, { open: open, setOpen: setOpen, buttonIcon: _jsx(SettingsIconWithArrow, { open: open }), buttonClassName: classes.iconButton, placement: "bottom-end", children: options })) : null);
|
|
47
|
+
}
|
|
48
|
+
function CloudDownloadIconWithArrow({ open }) {
|
|
49
|
+
return (_jsxs(_Fragment, { children: [_jsx(CloudDownloadIcon, {}), open ? _jsx(ArrowDropUpIcon, {}) : _jsx(ArrowDropDownIcon, {})] }));
|
|
50
|
+
}
|
|
51
|
+
function DownloadOptions(props) {
|
|
52
|
+
const { urls } = props;
|
|
53
|
+
const [open, setOpen] = useState(false);
|
|
54
|
+
const classes = useStyles();
|
|
55
|
+
return (urls && urls.length ? (_jsx(PopperMenu, { open: open, setOpen: setOpen, buttonIcon: _jsx(CloudDownloadIconWithArrow, { open: open }), buttonClassName: classes.iconButton, placement: "bottom-end", children: urls.map(({ url, name }) => (_jsx(MenuItem, { dense: true, children: _jsxs(Link, { underline: "none", href: url, target: "_blank", rel: "noopener", className: classes.downloadLink, children: ["Download ", name] }) }, `${url}_${name}`))) })) : null);
|
|
56
|
+
}
|
|
57
|
+
function ClosePaneButton(props) {
|
|
58
|
+
const { removeGridComponent } = props;
|
|
59
|
+
const classes = useStyles();
|
|
60
|
+
return (_jsx(IconButton, { onClick: removeGridComponent, size: "small", className: classes.iconButton, title: "close", children: _jsx(CloseIcon, {}) }));
|
|
61
|
+
}
|
|
62
|
+
export function TitleInfo(props) {
|
|
63
|
+
const { title, info, children, isScroll, isSpatial, removeGridComponent, urls, isReady, options, } = props;
|
|
64
|
+
const classes = useTitleStyles();
|
|
65
|
+
return (
|
|
66
|
+
// d-flex without wrapping div is not always full height; I don't understand the root cause.
|
|
67
|
+
_jsxs(_Fragment, { children: [_jsxs("div", { className: classes.title, children: [_jsx("div", { className: classes.titleLeft, children: title }), _jsx("div", { className: classes.titleInfo, title: info, children: info }), _jsxs("div", { className: classes.titleButtons, children: [_jsx(PlotOptions, { options: options }), _jsx(DownloadOptions, { urls: urls }), _jsx(ClosePaneButton, { removeGridComponent: removeGridComponent })] })] }), _jsxs("div", { className: clsx(TOOLTIP_ANCESTOR, classes.card, {
|
|
68
|
+
[classes.scrollCard]: isScroll,
|
|
69
|
+
[classes.spatialCard]: isSpatial,
|
|
70
|
+
[classes.noScrollCard]: !isScroll && !isSpatial,
|
|
71
|
+
}), children: [!isReady && _jsx(LoadingIndicator, {}), children] })] })
|
|
72
|
+
// "pl-2" only matters when the window is very narrow.
|
|
73
|
+
);
|
|
74
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Vitessce component.
|
|
3
|
+
* @param {object} props
|
|
4
|
+
* @param {object} props.config A Vitessce view config.
|
|
5
|
+
* If the config is valid, the VitessceGrid will be rendered as a child.
|
|
6
|
+
* If the config is invalid, a Warning will be rendered instead.
|
|
7
|
+
* @param {undefined|number} props.rowHeight Row height for grid layout. Optional.
|
|
8
|
+
* @param {number} props.height Total height for grid layout. Optional.
|
|
9
|
+
* @param {string} props.theme The theme, used for styling as
|
|
10
|
+
* light or dark. Optional. By default, "dark"
|
|
11
|
+
* @param {function} props.onWarn A callback for warning messages. Optional.
|
|
12
|
+
* @param {function} props.onConfigChange A callback for view config
|
|
13
|
+
* updates. Optional.
|
|
14
|
+
* @param {function} props.onLoaderChange A callback for loader
|
|
15
|
+
* updates. Optional.
|
|
16
|
+
* @param {boolean} props.validateOnConfigChange Whether to validate
|
|
17
|
+
* against the view config schema when publishing changes. Use for debugging
|
|
18
|
+
* purposes, as this may have a performance impact. By default, false.
|
|
19
|
+
* @param {undefined|string} props.uid A unique identifier for this Vitessce instance,
|
|
20
|
+
* for the purpose of avoiding CSS autogenerated class name conflicts. Must be valid as part
|
|
21
|
+
* of a CSS class name string.
|
|
22
|
+
* @param {array} props.viewTypes Plugin view types.
|
|
23
|
+
* @param {array} props.fileTypes Plugin file types.
|
|
24
|
+
* @param {array} props.jointFileTypes Plugin joint file types.
|
|
25
|
+
* @param {array} props.coordinationTypes Plugin coordination types.
|
|
26
|
+
* @param {null|object} props.warning A warning to render within the Vitessce grid,
|
|
27
|
+
* provided by the parent.
|
|
28
|
+
*/
|
|
29
|
+
export function VitS(props: {
|
|
30
|
+
config: object;
|
|
31
|
+
rowHeight: undefined | number;
|
|
32
|
+
height: number;
|
|
33
|
+
theme: string;
|
|
34
|
+
onWarn: Function;
|
|
35
|
+
onConfigChange: Function;
|
|
36
|
+
onLoaderChange: Function;
|
|
37
|
+
validateOnConfigChange: boolean;
|
|
38
|
+
uid: undefined | string;
|
|
39
|
+
viewTypes: array;
|
|
40
|
+
fileTypes: array;
|
|
41
|
+
jointFileTypes: array;
|
|
42
|
+
coordinationTypes: array;
|
|
43
|
+
warning: null | object;
|
|
44
|
+
}): JSX.Element;
|
|
45
|
+
//# sourceMappingURL=VitS.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VitS.d.ts","sourceRoot":"","sources":["../src/VitS.js"],"names":[],"mappings":"AA+BA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH;IAzByB,MAAM,EAApB,MAAM;IAGkB,SAAS,EAAjC,SAAS,GAAC,MAAM;IACF,MAAM,EAApB,MAAM;IACQ,KAAK,EAAnB,MAAM;IAEU,MAAM;IACN,cAAc;IAEd,cAAc;IAEf,sBAAsB,EAArC,OAAO;IAGiB,GAAG,EAA3B,SAAS,GAAC,MAAM;IAGH,SAAS;IACT,SAAS;IACT,cAAc;IACd,iBAAiB;IACX,OAAO,EAA1B,IAAI,GAAC,MAAM;gBAiJrB"}
|
package/dist-tsc/VitS.js
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useMemo } from 'react';
|
|
3
|
+
import { ThemeProvider, StylesProvider, createGenerateClassName, } from '@material-ui/core/es/styles/index.js';
|
|
4
|
+
import { isEqual } from 'lodash-es';
|
|
5
|
+
import { META_VERSION } from '@vitessce/constants-internal';
|
|
6
|
+
import { buildConfigSchema, latestConfigSchema } from '@vitessce/schemas';
|
|
7
|
+
import { muiTheme } from './shared-mui/styles.js';
|
|
8
|
+
import { ViewConfigProvider, createViewConfigStore, AuxiliaryProvider, createAuxiliaryStore, } from './state/hooks.js';
|
|
9
|
+
import VitessceGrid from './VitessceGrid.js';
|
|
10
|
+
import { Warning } from './Warning.js';
|
|
11
|
+
import CallbackPublisher from './CallbackPublisher.js';
|
|
12
|
+
import { initialize, } from './view-config-utils.js';
|
|
13
|
+
function logConfig(config, name) {
|
|
14
|
+
console.groupCollapsed(`🚄 Vitessce (${META_VERSION.version}) ${name}`);
|
|
15
|
+
console.info(`data:,${JSON.stringify(config)}`);
|
|
16
|
+
console.info(JSON.stringify(config, null, 2));
|
|
17
|
+
console.groupEnd();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* The Vitessce component.
|
|
21
|
+
* @param {object} props
|
|
22
|
+
* @param {object} props.config A Vitessce view config.
|
|
23
|
+
* If the config is valid, the VitessceGrid will be rendered as a child.
|
|
24
|
+
* If the config is invalid, a Warning will be rendered instead.
|
|
25
|
+
* @param {undefined|number} props.rowHeight Row height for grid layout. Optional.
|
|
26
|
+
* @param {number} props.height Total height for grid layout. Optional.
|
|
27
|
+
* @param {string} props.theme The theme, used for styling as
|
|
28
|
+
* light or dark. Optional. By default, "dark"
|
|
29
|
+
* @param {function} props.onWarn A callback for warning messages. Optional.
|
|
30
|
+
* @param {function} props.onConfigChange A callback for view config
|
|
31
|
+
* updates. Optional.
|
|
32
|
+
* @param {function} props.onLoaderChange A callback for loader
|
|
33
|
+
* updates. Optional.
|
|
34
|
+
* @param {boolean} props.validateOnConfigChange Whether to validate
|
|
35
|
+
* against the view config schema when publishing changes. Use for debugging
|
|
36
|
+
* purposes, as this may have a performance impact. By default, false.
|
|
37
|
+
* @param {undefined|string} props.uid A unique identifier for this Vitessce instance,
|
|
38
|
+
* for the purpose of avoiding CSS autogenerated class name conflicts. Must be valid as part
|
|
39
|
+
* of a CSS class name string.
|
|
40
|
+
* @param {array} props.viewTypes Plugin view types.
|
|
41
|
+
* @param {array} props.fileTypes Plugin file types.
|
|
42
|
+
* @param {array} props.jointFileTypes Plugin joint file types.
|
|
43
|
+
* @param {array} props.coordinationTypes Plugin coordination types.
|
|
44
|
+
* @param {null|object} props.warning A warning to render within the Vitessce grid,
|
|
45
|
+
* provided by the parent.
|
|
46
|
+
*/
|
|
47
|
+
export function VitS(props) {
|
|
48
|
+
const { config, rowHeight, height, theme, onWarn, onConfigChange, onLoaderChange, validateOnConfigChange = false, isBounded = false, uid, viewTypes: viewTypesProp, fileTypes: fileTypesProp, jointFileTypes: jointFileTypesProp, coordinationTypes: coordinationTypesProp, warning, } = props;
|
|
49
|
+
const viewTypes = useMemo(() => (viewTypesProp || []), [viewTypesProp]);
|
|
50
|
+
const fileTypes = useMemo(() => (fileTypesProp || []), [fileTypesProp]);
|
|
51
|
+
const jointFileTypes = useMemo(() => (jointFileTypesProp || []), [jointFileTypesProp]);
|
|
52
|
+
const coordinationTypes = useMemo(() => (coordinationTypesProp || []), [coordinationTypesProp]);
|
|
53
|
+
const generateClassName = useMemo(() => createGenerateClassName({
|
|
54
|
+
disableGlobal: false,
|
|
55
|
+
// Avoid conflicts with portal-ui MUI class names,
|
|
56
|
+
// and allow setting a UID.
|
|
57
|
+
productionPrefix: (uid ? `vit${uid}` : 'vit'),
|
|
58
|
+
}), [uid]);
|
|
59
|
+
const configUid = config?.uid;
|
|
60
|
+
const configVersion = config?.version;
|
|
61
|
+
const pluginSpecificConfigSchema = useMemo(() => buildConfigSchema(fileTypes, jointFileTypes, coordinationTypes, viewTypes), [viewTypes, fileTypes, jointFileTypes, coordinationTypes]);
|
|
62
|
+
// Process the view config and memoize the result:
|
|
63
|
+
// - Validate.
|
|
64
|
+
// - Upgrade, if legacy schema.
|
|
65
|
+
// - Validate after upgrade, if legacy schema.
|
|
66
|
+
// - Initialize (based on initStrategy).
|
|
67
|
+
const [configOrWarning, success] = useMemo(() => {
|
|
68
|
+
if (warning) {
|
|
69
|
+
return [warning, false];
|
|
70
|
+
}
|
|
71
|
+
logConfig(config, 'input view config');
|
|
72
|
+
const result = latestConfigSchema.safeParse(config);
|
|
73
|
+
if (result.success) {
|
|
74
|
+
const upgradedConfig = result.data;
|
|
75
|
+
logConfig(upgradedConfig, 'upgraded view config');
|
|
76
|
+
// Perform second round of parsing against plugin-specific config schema.
|
|
77
|
+
const pluginSpecificResult = pluginSpecificConfigSchema.safeParse(upgradedConfig);
|
|
78
|
+
// Initialize the view config according to the initStrategy.
|
|
79
|
+
if (pluginSpecificResult.success) {
|
|
80
|
+
try {
|
|
81
|
+
const upgradedConfigWithValidPlugins = pluginSpecificResult.data;
|
|
82
|
+
const initializedConfig = initialize(upgradedConfigWithValidPlugins, jointFileTypes, coordinationTypes, viewTypes);
|
|
83
|
+
logConfig(initializedConfig, 'initialized view config');
|
|
84
|
+
return [initializedConfig, true];
|
|
85
|
+
}
|
|
86
|
+
catch (e) {
|
|
87
|
+
return [
|
|
88
|
+
{
|
|
89
|
+
title: 'Config initialization failed.',
|
|
90
|
+
unformatted: e.message,
|
|
91
|
+
},
|
|
92
|
+
false,
|
|
93
|
+
];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return [
|
|
97
|
+
{
|
|
98
|
+
title: 'Config validation failed on second pass.',
|
|
99
|
+
unformatted: pluginSpecificResult.error.message,
|
|
100
|
+
},
|
|
101
|
+
false,
|
|
102
|
+
];
|
|
103
|
+
}
|
|
104
|
+
return [{
|
|
105
|
+
title: 'Config validation failed on first pass.',
|
|
106
|
+
unformatted: result.error.message,
|
|
107
|
+
}, result.success];
|
|
108
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
109
|
+
}, [configUid, configVersion, pluginSpecificConfigSchema, warning]);
|
|
110
|
+
// Emit the upgraded/initialized view config
|
|
111
|
+
// to onConfigChange if necessary.
|
|
112
|
+
useEffect(() => {
|
|
113
|
+
if (success && !isEqual(configOrWarning, config) && onConfigChange) {
|
|
114
|
+
onConfigChange(configOrWarning);
|
|
115
|
+
}
|
|
116
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
117
|
+
}, [success, configUid, configOrWarning, onConfigChange]);
|
|
118
|
+
return success ? (_jsx(StylesProvider, { generateClassName: generateClassName, children: _jsx(ThemeProvider, { theme: muiTheme[theme], children: _jsx(ViewConfigProvider, { createStore: createViewConfigStore, children: _jsxs(AuxiliaryProvider, { createStore: createAuxiliaryStore, children: [_jsx(VitessceGrid, { viewTypes: viewTypes, fileTypes: fileTypes, coordinationTypes: coordinationTypes, config: configOrWarning, rowHeight: rowHeight, height: height, theme: theme, isBounded: isBounded }), _jsx(CallbackPublisher, { onWarn: onWarn, onConfigChange: onConfigChange, onLoaderChange: onLoaderChange, validateOnConfigChange: validateOnConfigChange, pluginSpecificConfigSchema: pluginSpecificConfigSchema })] }) }) }) })) : (_jsx(StylesProvider, { generateClassName: generateClassName, children: _jsx(ThemeProvider, { theme: muiTheme[theme], children: _jsx(Warning, { ...configOrWarning }) }) }));
|
|
119
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The wrapper for the VitessceGrid and LoadingIndicator components.
|
|
3
|
+
* @param {object} props
|
|
4
|
+
* @param {number} props.rowHeight The height of each grid row. Optional.
|
|
5
|
+
* @param {object} props.config The view config.
|
|
6
|
+
* @param {string} props.theme The theme name.
|
|
7
|
+
* @param {number} props.height Total height for grid. Optional.
|
|
8
|
+
* @param {function} props.onWarn A callback for warning messages. Optional.
|
|
9
|
+
* @param {PluginViewType[]} props.viewTypes
|
|
10
|
+
* @param {PluginFileType[]} props.fileTypes
|
|
11
|
+
* @param {PluginCoordinationType[]} props.coordinationTypes
|
|
12
|
+
*/
|
|
13
|
+
export default function VitessceGrid(props: {
|
|
14
|
+
rowHeight: number;
|
|
15
|
+
config: object;
|
|
16
|
+
theme: string;
|
|
17
|
+
height: number;
|
|
18
|
+
onWarn: Function;
|
|
19
|
+
viewTypes: PluginViewType[];
|
|
20
|
+
fileTypes: PluginFileType[];
|
|
21
|
+
coordinationTypes: PluginCoordinationType[];
|
|
22
|
+
}): JSX.Element;
|
|
23
|
+
//# sourceMappingURL=VitessceGrid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VitessceGrid.d.ts","sourceRoot":"","sources":["../src/VitessceGrid.js"],"names":[],"mappings":"AA0BA;;;;;;;;;;;GAWG;AACH;IATyB,SAAS,EAAvB,MAAM;IACQ,MAAM,EAApB,MAAM;IACQ,KAAK,EAAnB,MAAM;IACQ,MAAM,EAApB,MAAM;IACU,MAAM;IACE,SAAS,EAAjC,gBAAgB;IACQ,SAAS,EAAjC,gBAAgB;IACgB,iBAAiB,EAAjD,wBAAwB;gBAiFlC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useCallback, } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { VITESSCE_CONTAINER } from './classNames.js';
|
|
5
|
+
import { VitessceGridLayout } from './vitessce-grid-layout/index.js';
|
|
6
|
+
import { useRowHeight, createLoaders } from './vitessce-grid-utils.js';
|
|
7
|
+
import { useViewConfigStoreApi, useSetViewConfig, useSetLoaders, useEmitGridResize, useRemoveComponent, useChangeLayout, useLayout, } from './state/hooks.js';
|
|
8
|
+
import { useClosestVitessceContainerSize, } from './hooks.js';
|
|
9
|
+
import { useVitessceContainerStyles } from './shared-mui/container.js';
|
|
10
|
+
import { useTitleStyles } from './title-styles.js';
|
|
11
|
+
const padding = 10;
|
|
12
|
+
const margin = 5;
|
|
13
|
+
/**
|
|
14
|
+
* The wrapper for the VitessceGrid and LoadingIndicator components.
|
|
15
|
+
* @param {object} props
|
|
16
|
+
* @param {number} props.rowHeight The height of each grid row. Optional.
|
|
17
|
+
* @param {object} props.config The view config.
|
|
18
|
+
* @param {string} props.theme The theme name.
|
|
19
|
+
* @param {number} props.height Total height for grid. Optional.
|
|
20
|
+
* @param {function} props.onWarn A callback for warning messages. Optional.
|
|
21
|
+
* @param {PluginViewType[]} props.viewTypes
|
|
22
|
+
* @param {PluginFileType[]} props.fileTypes
|
|
23
|
+
* @param {PluginCoordinationType[]} props.coordinationTypes
|
|
24
|
+
*/
|
|
25
|
+
export default function VitessceGrid(props) {
|
|
26
|
+
const { rowHeight: initialRowHeight, config, theme, height, isBounded, viewTypes, fileTypes, coordinationTypes, } = props;
|
|
27
|
+
const [rowHeight, containerRef] = useRowHeight(config, initialRowHeight, height, margin, padding);
|
|
28
|
+
const onResize = useEmitGridResize();
|
|
29
|
+
const [componentWidth] = useClosestVitessceContainerSize(containerRef);
|
|
30
|
+
const classes = useVitessceContainerStyles();
|
|
31
|
+
const titleClasses = useTitleStyles();
|
|
32
|
+
// When the row height has changed, publish a GRID_RESIZE event.
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
onResize();
|
|
35
|
+
}, [rowHeight, onResize]);
|
|
36
|
+
const viewConfigStoreApi = useViewConfigStoreApi();
|
|
37
|
+
const setViewConfig = useSetViewConfig(viewConfigStoreApi);
|
|
38
|
+
const setLoaders = useSetLoaders();
|
|
39
|
+
const removeComponent = useRemoveComponent();
|
|
40
|
+
const changeLayout = useChangeLayout();
|
|
41
|
+
const layout = useLayout();
|
|
42
|
+
const changeLayoutPostMount = useCallback((newComponentProps) => {
|
|
43
|
+
if (componentWidth > 0) {
|
|
44
|
+
changeLayout(newComponentProps);
|
|
45
|
+
}
|
|
46
|
+
}, [changeLayout, componentWidth]);
|
|
47
|
+
// Update the view config and loaders in the global state.
|
|
48
|
+
useEffect(() => {
|
|
49
|
+
if (config) {
|
|
50
|
+
setViewConfig(config);
|
|
51
|
+
const loaders = createLoaders(config.datasets, config.description, fileTypes, coordinationTypes);
|
|
52
|
+
setLoaders(loaders);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// No config found, so clear the loaders.
|
|
56
|
+
setLoaders({});
|
|
57
|
+
}
|
|
58
|
+
}, [config, setViewConfig, setLoaders, fileTypes, coordinationTypes]);
|
|
59
|
+
return (_jsx("div", { ref: containerRef, className: clsx(VITESSCE_CONTAINER, classes.vitessceContainer), children: layout && (_jsx(VitessceGridLayout, { layout: layout, height: height, rowHeight: rowHeight, theme: theme, viewTypes: viewTypes, draggableHandle: titleClasses.title, margin: margin, padding: padding, onRemoveComponent: removeComponent, onLayoutChange: changeLayoutPostMount, isBounded: isBounded, onResize: onResize, onResizeStop: onResize })) }));
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VitessceGrid.test.d.ts","sourceRoot":"","sources":["../src/VitessceGrid.test.jsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import '@testing-library/jest-dom';
|
|
3
|
+
import { cleanup, render, screen } from '@testing-library/react';
|
|
4
|
+
import { afterEach } from 'vitest';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { PluginViewType } from '@vitessce/plugins';
|
|
7
|
+
import VitessceGrid from './VitessceGrid.js';
|
|
8
|
+
import { ViewConfigProvider, createViewConfigStore, AuxiliaryProvider, createAuxiliaryStore, } from './state/hooks.js';
|
|
9
|
+
afterEach(() => {
|
|
10
|
+
cleanup();
|
|
11
|
+
});
|
|
12
|
+
describe('VitessceGrid.js', () => {
|
|
13
|
+
describe('<VitessceGrid />', () => {
|
|
14
|
+
it('renders', async () => {
|
|
15
|
+
const config = {
|
|
16
|
+
version: '1.0.0',
|
|
17
|
+
description: 'fake description',
|
|
18
|
+
datasets: [],
|
|
19
|
+
name: 'fake name',
|
|
20
|
+
layout: [
|
|
21
|
+
{
|
|
22
|
+
component: 'FakeComponent',
|
|
23
|
+
props: { description: 'fake prop description' },
|
|
24
|
+
uid: 'A',
|
|
25
|
+
x: 0,
|
|
26
|
+
y: 0,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
function FakeComponent() {
|
|
31
|
+
return _jsx("p", { children: "FakeComponent!" });
|
|
32
|
+
}
|
|
33
|
+
const viewTypes = [new PluginViewType('FakeComponent', FakeComponent, [])];
|
|
34
|
+
const fileTypes = [];
|
|
35
|
+
const coordinationTypes = [];
|
|
36
|
+
render(_jsx(ViewConfigProvider, { createStore: createViewConfigStore, children: _jsx(AuxiliaryProvider, { createStore: createAuxiliaryStore, children: _jsx(VitessceGrid, { config: config, viewTypes: viewTypes, fileTypes: fileTypes, coordinationTypes: coordinationTypes }) }) }));
|
|
37
|
+
expect(await screen.findByText('FakeComponent!'));
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Warning.d.ts","sourceRoot":"","sources":["../src/Warning.js"],"names":[],"mappings":"AAyCA,kHAoBC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { makeStyles } from '@material-ui/core';
|
|
4
|
+
import { VITESSCE_CONTAINER } from './classNames.js';
|
|
5
|
+
const useStyles = makeStyles(theme => ({
|
|
6
|
+
warningLayout: {
|
|
7
|
+
backgroundColor: theme.palette.gridLayoutBackground,
|
|
8
|
+
position: 'absolute',
|
|
9
|
+
width: '100%',
|
|
10
|
+
height: '100vh',
|
|
11
|
+
},
|
|
12
|
+
containerFluid: {
|
|
13
|
+
width: '100%',
|
|
14
|
+
padding: '15px',
|
|
15
|
+
marginRight: 'auto',
|
|
16
|
+
marginLeft: 'auto',
|
|
17
|
+
boxSizing: 'border-box',
|
|
18
|
+
display: 'flex',
|
|
19
|
+
},
|
|
20
|
+
row: {
|
|
21
|
+
flexGrow: '1',
|
|
22
|
+
},
|
|
23
|
+
card: {
|
|
24
|
+
border: `1px solid ${theme.palette.cardBorder}`,
|
|
25
|
+
flex: '1 1 auto',
|
|
26
|
+
minHeight: '1px',
|
|
27
|
+
padding: '12px',
|
|
28
|
+
marginTop: '8px',
|
|
29
|
+
marginBottom: '8px',
|
|
30
|
+
position: 'relative',
|
|
31
|
+
display: 'flex',
|
|
32
|
+
flexDirection: 'column',
|
|
33
|
+
minWidth: '0',
|
|
34
|
+
wordWrap: 'break-word',
|
|
35
|
+
backgroundClip: 'border-box',
|
|
36
|
+
borderRadius: '4px',
|
|
37
|
+
backgroundColor: theme.palette.primaryBackground,
|
|
38
|
+
color: theme.palette.primaryForeground,
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
41
|
+
export function Warning(props) {
|
|
42
|
+
const { title, preformatted, unformatted, } = props;
|
|
43
|
+
const classes = useStyles();
|
|
44
|
+
return (_jsx("div", { className: VITESSCE_CONTAINER, children: _jsx("div", { className: clsx(classes.warningLayout, classes.containerFluid), children: _jsx("div", { className: classes.row, children: _jsxs("div", { className: classes.card, children: [_jsx("h1", { children: title }), preformatted ? (_jsx("pre", { children: preformatted })) : null, _jsx("p", { children: unformatted })] }) }) }) }));
|
|
45
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const TOOLTIP_ANCESTOR: "tooltip-ancestor";
|
|
2
|
+
export const PRIMARY_CARD: string;
|
|
3
|
+
export const SECONDARY_CARD: string;
|
|
4
|
+
export const BLACK_CARD: string;
|
|
5
|
+
export const TITLE_CARD: "title";
|
|
6
|
+
export const SCROLL_CARD: string;
|
|
7
|
+
export const VITESSCE_CONTAINER: "vitessce-container";
|
|
8
|
+
//# sourceMappingURL=classNames.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classNames.d.ts","sourceRoot":"","sources":["../src/classNames.js"],"names":[],"mappings":"AAAA,kDAAmD;AAEnD,kCAAiD;AACjD,oCAAqD;AACrD,gCAA6C;AAC7C,iCAAkC;AAClC,iCAAoD;AACpD,sDAAuD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const TOOLTIP_ANCESTOR = 'tooltip-ancestor';
|
|
2
|
+
const CARD = `card card-body my-2 ${TOOLTIP_ANCESTOR}`;
|
|
3
|
+
export const PRIMARY_CARD = `${CARD} bg-primary`;
|
|
4
|
+
export const SECONDARY_CARD = `${CARD} bg-secondary`;
|
|
5
|
+
export const BLACK_CARD = `${CARD} bg-black`;
|
|
6
|
+
export const TITLE_CARD = 'title';
|
|
7
|
+
export const SCROLL_CARD = `${PRIMARY_CARD} scroll`;
|
|
8
|
+
export const VITESSCE_CONTAINER = 'vitessce-container';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A loader ancestor class containing a default constructor
|
|
3
|
+
* and a stub for the required load() method.
|
|
4
|
+
*/
|
|
5
|
+
export default class AbstractLoader {
|
|
6
|
+
constructor({ type, fileType, url, requestInit, options, coordinationValues, }: {
|
|
7
|
+
type: any;
|
|
8
|
+
fileType: any;
|
|
9
|
+
url: any;
|
|
10
|
+
requestInit: any;
|
|
11
|
+
options: any;
|
|
12
|
+
coordinationValues: any;
|
|
13
|
+
});
|
|
14
|
+
fileType: any;
|
|
15
|
+
type: any;
|
|
16
|
+
url: any;
|
|
17
|
+
requestInit: any;
|
|
18
|
+
options: any;
|
|
19
|
+
coordinationValues: any;
|
|
20
|
+
load(): Promise<boolean>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=AbstractLoader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractLoader.d.ts","sourceRoot":"","sources":["../../src/data/AbstractLoader.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;IACE;;;;;;;OAWC;IANC,cAAwB;IACxB,UAAgB;IAChB,SAAc;IACd,iBAA8B;IAC9B,aAAsB;IACtB,wBAA4C;IAI9C,yBAEC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A loader ancestor class containing a default constructor
|
|
3
|
+
* and a stub for the required load() method.
|
|
4
|
+
*/
|
|
5
|
+
export default class AbstractLoader {
|
|
6
|
+
constructor({ type, fileType, url, requestInit, options, coordinationValues, }) {
|
|
7
|
+
this.fileType = fileType;
|
|
8
|
+
this.type = type;
|
|
9
|
+
this.url = url;
|
|
10
|
+
this.requestInit = requestInit;
|
|
11
|
+
this.options = options;
|
|
12
|
+
this.coordinationValues = coordinationValues;
|
|
13
|
+
}
|
|
14
|
+
// eslint-disable-next-line class-methods-use-this
|
|
15
|
+
load() {
|
|
16
|
+
return Promise.resolve(true);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AbstractTwoStepLoader.d.ts","sourceRoot":"","sources":["../../src/data/AbstractTwoStepLoader.js"],"names":[],"mappings":"AAEA;IACE,0CAGC;IADC,gBAA4B;CAE/B"}
|