@vitessce/vit-s 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.
- package/dist/index.js +44072 -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 +50 -0
- package/dist-tsc/VitS.d.ts.map +1 -0
- package/dist-tsc/VitS.js +139 -0
- package/dist-tsc/VitessceGrid.d.ts +23 -0
- package/dist-tsc/VitessceGrid.d.ts.map +1 -0
- package/dist-tsc/VitessceGrid.js +63 -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 +43 -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 +12 -0
- package/dist-tsc/data/LoaderResult.d.ts.map +1 -0
- package/dist-tsc/data/LoaderResult.js +12 -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 +65 -0
- package/dist-tsc/data-hook-utils.d.ts.map +1 -0
- package/dist-tsc/data-hook-utils.js +191 -0
- package/dist-tsc/data-hooks.d.ts +73 -0
- package/dist-tsc/data-hooks.d.ts.map +1 -0
- package/dist-tsc/data-hooks.js +254 -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 +76 -0
- package/dist-tsc/hooks.d.ts.map +1 -0
- package/dist-tsc/hooks.js +262 -0
- package/dist-tsc/index.d.ts +12 -0
- package/dist-tsc/index.d.ts.map +1 -0
- package/dist-tsc/index.js +11 -17
- package/dist-tsc/mui-utils.d.ts +2 -0
- package/dist-tsc/mui-utils.d.ts.map +1 -0
- package/dist-tsc/mui-utils.js +44 -0
- 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/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 +242 -0
- package/dist-tsc/state/hooks.d.ts.map +1 -0
- package/dist-tsc/state/hooks.js +615 -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 +31 -0
- package/dist-tsc/view-config-utils.d.ts.map +1 -0
- package/dist-tsc/view-config-utils.js +240 -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 +210 -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 +149 -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 +25 -11
- package/src/CallbackPublisher.js +7 -11
- package/src/LoadingIndicator.js +1 -2
- package/src/TitleInfo.js +12 -85
- package/src/VitS.js +143 -85
- package/src/VitessceGrid.js +35 -21
- package/src/VitessceGrid.test.jsx +23 -8
- package/src/Warning.js +4 -4
- package/src/data/AbstractLoader.js +2 -25
- package/src/data/AbstractTwoStepLoader.js +1 -1
- package/src/data/LoaderResult.js +5 -0
- package/src/data/index.js +3 -3
- package/src/data/loader-registry.js +22 -13
- package/src/data-hook-utils.js +119 -86
- package/src/data-hooks.js +150 -131
- package/src/errors/DataSourceFetchError.js +2 -2
- 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 +81 -26
- package/src/index.js +23 -46
- package/src/mui-utils.js +52 -0
- 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 +3 -3
- 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 +2 -2
- package/src/state/hooks.js +75 -23
- package/src/title-styles.js +73 -0
- package/src/view-config-utils.js +54 -98
- package/src/view-config-utils.test.jsx +223 -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 +2 -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-0.1.0.schema.json +0 -85
- package/src/schemas/config-1.0.0.schema.json +0 -733
- package/src/schemas/config-1.0.1.schema.json +0 -909
- package/src/schemas/config-1.0.10.schema.json +0 -969
- package/src/schemas/config-1.0.11.schema.json +0 -990
- package/src/schemas/config-1.0.12.schema.json +0 -997
- package/src/schemas/config-1.0.13.schema.json +0 -1013
- package/src/schemas/config-1.0.14.schema.json +0 -1048
- package/src/schemas/config-1.0.15.schema.json +0 -1048
- package/src/schemas/config-1.0.16.schema.json +0 -1069
- package/src/schemas/config-1.0.16.schema.test.js +0 -32
- package/src/schemas/config-1.0.2.schema.json +0 -911
- package/src/schemas/config-1.0.3.schema.json +0 -911
- package/src/schemas/config-1.0.4.schema.json +0 -949
- package/src/schemas/config-1.0.5.schema.json +0 -949
- package/src/schemas/config-1.0.6.schema.json +0 -950
- package/src/schemas/config-1.0.7.schema.json +0 -950
- package/src/schemas/config-1.0.8.schema.json +0 -966
- package/src/schemas/config-1.0.9.schema.json +0 -965
- package/src/schemas/obsSets.schema.js +0 -195
- package/src/schemas/obsSetsTabular.schema.js +0 -39
- package/src/schemas/raster.schema.js +0 -121
- package/src/schemas/schema-schema.sh +0 -34
- 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
package/src/index.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
export { VitS } from './VitS';
|
|
2
|
-
export { TitleInfo } from './TitleInfo';
|
|
3
|
-
export { PopperMenu } from './shared-mui/components';
|
|
4
|
-
export {
|
|
5
|
-
registerPluginViewType,
|
|
6
|
-
registerPluginCoordinationType,
|
|
7
|
-
registerPluginFileType,
|
|
8
|
-
registerPluginJointFileType,
|
|
9
|
-
} from './plugins';
|
|
1
|
+
export { VitS } from './VitS.js';
|
|
2
|
+
export { TitleInfo } from './TitleInfo.js';
|
|
3
|
+
export { PopperMenu } from './shared-mui/components.js';
|
|
10
4
|
// For plugin view types:
|
|
11
5
|
export {
|
|
12
|
-
useReady,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
6
|
+
useReady,
|
|
7
|
+
useUrls,
|
|
8
|
+
useVitessceContainer,
|
|
9
|
+
useDeckCanvasSize,
|
|
10
|
+
useUint8ObsFeatureMatrix,
|
|
11
|
+
useUint8FeatureSelection,
|
|
12
|
+
useExpressionValueGetter,
|
|
13
|
+
useGetObsMembership,
|
|
14
|
+
useGetObsInfo,
|
|
15
|
+
useClosestVitessceContainerSize,
|
|
16
|
+
useWindowDimensions,
|
|
16
17
|
useGridItemSize,
|
|
17
|
-
} from './hooks';
|
|
18
|
+
} from './hooks.js';
|
|
18
19
|
export {
|
|
20
|
+
useInitialCoordination,
|
|
19
21
|
useCoordination,
|
|
20
22
|
useComplexCoordination,
|
|
21
23
|
useMultiCoordinationValues,
|
|
@@ -33,7 +35,7 @@ export {
|
|
|
33
35
|
useSetWarning,
|
|
34
36
|
useAuxiliaryCoordination,
|
|
35
37
|
useComponentLayout,
|
|
36
|
-
} from './state/hooks';
|
|
38
|
+
} from './state/hooks.js';
|
|
37
39
|
export {
|
|
38
40
|
useDescription,
|
|
39
41
|
useImageData,
|
|
@@ -51,51 +53,26 @@ export {
|
|
|
51
53
|
useObsFeatureMatrixData,
|
|
52
54
|
useFeatureLabelsData,
|
|
53
55
|
useGenomicProfilesData,
|
|
54
|
-
} from './data-hooks';
|
|
56
|
+
} from './data-hooks.js';
|
|
55
57
|
export {
|
|
56
58
|
useHasLoader,
|
|
57
|
-
} from './data-hook-utils';
|
|
59
|
+
} from './data-hook-utils.js';
|
|
58
60
|
export {
|
|
59
61
|
AbstractLoader,
|
|
60
62
|
AbstractTwoStepLoader,
|
|
61
63
|
LoaderResult,
|
|
62
|
-
} from './data/index';
|
|
64
|
+
} from './data/index.js';
|
|
63
65
|
export {
|
|
64
66
|
AbstractLoaderError,
|
|
65
67
|
DatasetNotFoundError,
|
|
66
68
|
LoaderNotFoundError,
|
|
67
69
|
LoaderValidationError,
|
|
68
|
-
OptionsValidationError,
|
|
69
70
|
DataSourceFetchError,
|
|
70
|
-
} from './errors/index';
|
|
71
|
-
export {
|
|
72
|
-
// TODO(monorepo): should these be in here? or within file-types/
|
|
73
|
-
obsEmbeddingAnndataSchema,
|
|
74
|
-
obsLocationsAnndataSchema,
|
|
75
|
-
obsSegmentationsAnndataSchema,
|
|
76
|
-
obsSetsAnndataSchema,
|
|
77
|
-
obsFeatureMatrixAnndataSchema,
|
|
78
|
-
obsLabelsAnndataSchema,
|
|
79
|
-
featureLabelsAnndataSchema,
|
|
80
|
-
obsEmbeddingCsvSchema,
|
|
81
|
-
obsLocationsCsvSchema,
|
|
82
|
-
obsLabelsCsvSchema,
|
|
83
|
-
featureLabelsCsvSchema,
|
|
84
|
-
obsSetsCsvSchema,
|
|
85
|
-
anndataZarrSchema,
|
|
86
|
-
emptySchema,
|
|
87
|
-
} from './file-options-schemas';
|
|
88
|
-
export {
|
|
89
|
-
SCHEMA_HANDLERS,
|
|
90
|
-
LATEST_VERSION,
|
|
91
|
-
} from './view-config-versions';
|
|
92
|
-
export {
|
|
93
|
-
upgradeAndValidate,
|
|
94
|
-
} from './view-config-utils';
|
|
71
|
+
} from './errors/index.js';
|
|
95
72
|
export {
|
|
96
73
|
CellColorEncodingOption,
|
|
97
74
|
OptionsContainer,
|
|
98
75
|
OptionSelect,
|
|
99
76
|
usePlotOptionsStyles,
|
|
100
|
-
} from './shared-plot-options';
|
|
101
|
-
export
|
|
77
|
+
} from './shared-plot-options/index.js';
|
|
78
|
+
export { logConfig } from './view-config-utils.js';
|
package/src/mui-utils.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// This function has been copied from MUI v4
|
|
2
|
+
// with logic related to randomness / random numbers removed.
|
|
3
|
+
// Reference: https://github.com/mui/material-ui/blob/0adada09/packages/mui-styles/src/createGenerateClassName/createGenerateClassName.js#L29
|
|
4
|
+
/**
|
|
5
|
+
* This is the list of the style rule name we use as drop in replacement for the built-in
|
|
6
|
+
* pseudo classes (:checked, :disabled, :focused, etc.).
|
|
7
|
+
*
|
|
8
|
+
* Why do they exist in the first place?
|
|
9
|
+
* These classes are used at a specificity of 2.
|
|
10
|
+
* It allows them to override previously defined styles as well as
|
|
11
|
+
* being untouched by simple user overrides.
|
|
12
|
+
*/
|
|
13
|
+
const stateClasses = [
|
|
14
|
+
'checked',
|
|
15
|
+
'disabled',
|
|
16
|
+
'error',
|
|
17
|
+
'focused',
|
|
18
|
+
'focusVisible',
|
|
19
|
+
'required',
|
|
20
|
+
'expanded',
|
|
21
|
+
'selected',
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const defaultPrefix = 'vit-';
|
|
25
|
+
|
|
26
|
+
export function createGenerateClassName(customPrefix) {
|
|
27
|
+
return (rule, styleSheet) => {
|
|
28
|
+
const {
|
|
29
|
+
name: styleSheetName,
|
|
30
|
+
link: styleSheetLink,
|
|
31
|
+
classNamePrefix,
|
|
32
|
+
} = styleSheet.options;
|
|
33
|
+
const { key: ruleKey } = rule;
|
|
34
|
+
|
|
35
|
+
const seedPrefix = customPrefix ? `${customPrefix}-` : defaultPrefix;
|
|
36
|
+
|
|
37
|
+
// Is a global static MUI style?
|
|
38
|
+
if (styleSheetName && styleSheetName.indexOf('Mui') === 0 && !styleSheetLink) {
|
|
39
|
+
// We can use a shorthand class name, we never use the keys to style the components.
|
|
40
|
+
if (stateClasses.indexOf(ruleKey) !== -1) {
|
|
41
|
+
return `Mui-${ruleKey}`;
|
|
42
|
+
}
|
|
43
|
+
const prefix = `${seedPrefix}${styleSheetName}-${ruleKey}`;
|
|
44
|
+
return prefix;
|
|
45
|
+
}
|
|
46
|
+
// Help with debuggability.
|
|
47
|
+
if (classNamePrefix) {
|
|
48
|
+
return `${seedPrefix}${classNamePrefix}-${ruleKey}`;
|
|
49
|
+
}
|
|
50
|
+
return `${seedPrefix}${ruleKey}`;
|
|
51
|
+
};
|
|
52
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import {
|
|
3
|
+
makeStyles,
|
|
4
|
+
Paper,
|
|
5
|
+
Popper,
|
|
6
|
+
IconButton,
|
|
7
|
+
MenuList,
|
|
8
|
+
ClickAwayListener,
|
|
9
|
+
Fade,
|
|
10
|
+
} from '@material-ui/core';
|
|
11
|
+
import { useVitessceContainer } from '../hooks.js';
|
|
10
12
|
|
|
11
13
|
const useStyles = makeStyles(() => ({
|
|
12
14
|
paper: {
|
package/src/shared-mui/styles.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { createTheme } from '@material-ui/core
|
|
2
|
-
|
|
1
|
+
import { createTheme, colors } from '@material-ui/core';
|
|
2
|
+
|
|
3
|
+
const { grey } = colors;
|
|
3
4
|
|
|
4
5
|
const globalColors = {
|
|
5
6
|
white: '#FFFFFF',
|
|
@@ -78,6 +79,7 @@ export const muiTheme = {
|
|
|
78
79
|
secondaryForeground: '#D3D3D3',
|
|
79
80
|
gridLayoutBackground: '#333333',
|
|
80
81
|
cardBorder: 'rgba(0, 0, 0, 0.125)',
|
|
82
|
+
tooltipText: '#FFFFFF',
|
|
81
83
|
...globalColors,
|
|
82
84
|
},
|
|
83
85
|
...sharedThemeOptions,
|
|
@@ -103,6 +105,7 @@ export const muiTheme = {
|
|
|
103
105
|
secondaryForeground: '#222222',
|
|
104
106
|
gridLayoutBackground: '#FFFFFF',
|
|
105
107
|
cardBorder: 'rgba(241, 241, 241, 0.125)',
|
|
108
|
+
tooltipText: 'rgba(0, 0, 0, 0.87)',
|
|
106
109
|
...globalColors,
|
|
107
110
|
},
|
|
108
111
|
...sharedThemeOptions,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import TableCell from '@material-ui/core
|
|
3
|
-
import TableRow from '@material-ui/core/TableRow';
|
|
2
|
+
import { TableCell, TableRow } from '@material-ui/core';
|
|
4
3
|
import { capitalize } from '@vitessce/utils';
|
|
5
|
-
import OptionSelect from './OptionSelect';
|
|
6
|
-
import { useStyles } from './styles';
|
|
4
|
+
import OptionSelect from './OptionSelect.js';
|
|
5
|
+
import { useStyles } from './styles.js';
|
|
7
6
|
|
|
8
7
|
export default function CellColorEncodingOption(props) {
|
|
9
8
|
const {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Select from '@material-ui/core
|
|
3
|
-
import { useStyles } from './styles';
|
|
2
|
+
import { Select } from '@material-ui/core';
|
|
3
|
+
import { useStyles } from './styles.js';
|
|
4
4
|
|
|
5
5
|
export default function OptionSelect(props) {
|
|
6
6
|
const { classes: classesProp = {} } = props;
|
|
@@ -11,7 +11,7 @@ export default function OptionSelect(props) {
|
|
|
11
11
|
disableUnderline
|
|
12
12
|
{...props}
|
|
13
13
|
classes={{
|
|
14
|
-
root: classes.
|
|
14
|
+
root: classes.optionSelectRoot,
|
|
15
15
|
...classesProp,
|
|
16
16
|
}}
|
|
17
17
|
/>
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import Box from '@material-ui/core
|
|
3
|
-
import
|
|
4
|
-
import TableBody from '@material-ui/core/TableBody';
|
|
5
|
-
import TableContainer from '@material-ui/core/TableContainer';
|
|
6
|
-
import { useStyles } from './styles';
|
|
2
|
+
import { Box, Table, TableBody, TableContainer } from '@material-ui/core';
|
|
3
|
+
import { useStyles } from './styles.js';
|
|
7
4
|
|
|
8
5
|
export default function OptionsContainer(props) {
|
|
9
6
|
const {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as CellColorEncodingOption } from './CellColorEncodingOption';
|
|
2
|
-
export { default as OptionsContainer } from './OptionsContainer';
|
|
3
|
-
export { default as OptionSelect } from './OptionSelect';
|
|
4
|
-
export { useStyles as usePlotOptionsStyles } from './styles';
|
|
1
|
+
export { default as CellColorEncodingOption } from './CellColorEncodingOption.js';
|
|
2
|
+
export { default as OptionsContainer } from './OptionsContainer.js';
|
|
3
|
+
export { default as OptionSelect } from './OptionSelect.js';
|
|
4
|
+
export { useStyles as usePlotOptionsStyles } from './styles.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { makeStyles } from '@material-ui/core
|
|
1
|
+
import { makeStyles } from '@material-ui/core';
|
|
2
2
|
|
|
3
3
|
export const useStyles = makeStyles(theme => ({
|
|
4
4
|
box: {
|
|
@@ -42,7 +42,7 @@ export const useStyles = makeStyles(theme => ({
|
|
|
42
42
|
fontSize: '14px',
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
|
-
|
|
45
|
+
optionSelectRoot: {
|
|
46
46
|
padding: 0,
|
|
47
47
|
height: 'auto',
|
|
48
48
|
},
|
package/src/state/hooks.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
/* eslint-disable react-refresh/only-export-components */
|
|
1
2
|
import { useRef, useCallback, useMemo } from 'react';
|
|
2
3
|
import create from 'zustand';
|
|
3
4
|
import createContext from 'zustand/context';
|
|
4
5
|
import shallow from 'zustand/shallow';
|
|
5
|
-
import isMatch from 'lodash
|
|
6
|
+
import { isMatch, cloneDeep } from 'lodash-es';
|
|
6
7
|
import { CoordinationType } from '@vitessce/constants-internal';
|
|
7
8
|
import { fromEntries, capitalize } from '@vitessce/utils';
|
|
8
9
|
|
|
@@ -31,20 +32,25 @@ export const useAuxiliaryStore = useAuxiliaryStoreLocal;
|
|
|
31
32
|
* The useViewConfigStore hook is initialized via the zustand
|
|
32
33
|
* create() function, which sets up both the state variables
|
|
33
34
|
* and the reducer-type functions.
|
|
34
|
-
*
|
|
35
|
+
* References:
|
|
36
|
+
* - https://github.com/react-spring/zustand
|
|
37
|
+
* - https://github.com/pmndrs/zustand/releases/tag/v3.6.0
|
|
38
|
+
* - https://github.com/pmndrs/zustand#using-subscribe-with-selector
|
|
35
39
|
* @returns {function} The useStore hook.
|
|
36
40
|
*/
|
|
37
|
-
export const createViewConfigStore = () => create(set => ({
|
|
41
|
+
export const createViewConfigStore = (initialLoaders, initialConfig) => create(set => ({
|
|
38
42
|
// State:
|
|
39
43
|
// The viewConfig is an object which must conform to the schema
|
|
40
44
|
// found in src/schemas/config.schema.json.
|
|
41
|
-
viewConfig:
|
|
45
|
+
viewConfig: initialConfig,
|
|
46
|
+
// Store the initial config so that its values can be used for resetting.
|
|
47
|
+
initialViewConfig: cloneDeep(initialConfig),
|
|
42
48
|
// The loaders object is a mapping from dataset ID to
|
|
43
49
|
// data type to loader object instance.
|
|
44
|
-
loaders:
|
|
50
|
+
loaders: initialLoaders,
|
|
45
51
|
// Reducer functions which update the state
|
|
46
52
|
// (although technically also part of state):
|
|
47
|
-
setViewConfig: viewConfig => set({ viewConfig }),
|
|
53
|
+
setViewConfig: viewConfig => set({ viewConfig, initialViewConfig: viewConfig }),
|
|
48
54
|
setLoaders: loaders => set({ loaders }),
|
|
49
55
|
setCoordinationValue: ({ parameter, scope, value }) => set(state => ({
|
|
50
56
|
viewConfig: {
|
|
@@ -177,6 +183,30 @@ const useGridSizeStore = create(set => ({
|
|
|
177
183
|
})),
|
|
178
184
|
}));
|
|
179
185
|
|
|
186
|
+
/**
|
|
187
|
+
* This hook uses the same logic as for the `values` part of
|
|
188
|
+
* the useCoordination hook, with the difference that it
|
|
189
|
+
* gets its values from the _initial_ view config rather
|
|
190
|
+
* than the current view config.
|
|
191
|
+
* @param {string[]} parameters Array of coordination types.
|
|
192
|
+
* @param {object} coordinationScopes Mapping of coordination types
|
|
193
|
+
* to scope names.
|
|
194
|
+
* @returns {object} Object containing all coordination values.
|
|
195
|
+
*/
|
|
196
|
+
export function useInitialCoordination(parameters, coordinationScopes) {
|
|
197
|
+
const values = useViewConfigStore((state) => {
|
|
198
|
+
const { coordinationSpace } = state.initialViewConfig;
|
|
199
|
+
return fromEntries(parameters.map((parameter) => {
|
|
200
|
+
if (coordinationSpace && coordinationSpace[parameter]) {
|
|
201
|
+
const value = coordinationSpace[parameter][coordinationScopes[parameter]];
|
|
202
|
+
return [parameter, value];
|
|
203
|
+
}
|
|
204
|
+
return [parameter, undefined];
|
|
205
|
+
}));
|
|
206
|
+
}, shallow);
|
|
207
|
+
return values;
|
|
208
|
+
}
|
|
209
|
+
|
|
180
210
|
/**
|
|
181
211
|
* The useCoordination hook returns both the
|
|
182
212
|
* values and setter functions for the coordination objects
|
|
@@ -430,6 +460,37 @@ export function useLoaders() {
|
|
|
430
460
|
return useViewConfigStore(state => state.loaders);
|
|
431
461
|
}
|
|
432
462
|
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Find a specific loader instance for a particular dataset, data type, and view
|
|
466
|
+
* coordination values (mapping from coordination types to coordination values).
|
|
467
|
+
* Uses lodash/isMatch to perform matching against the file definition's
|
|
468
|
+
* coordination value mapping.
|
|
469
|
+
* @param {object} loaders The value returned by useLoaders.
|
|
470
|
+
* @param {string} dataset The dataset UID.
|
|
471
|
+
* @param {string} dataType The data type for the matching file.
|
|
472
|
+
* @param {object} viewCoordinationValues Current coordination values
|
|
473
|
+
* from the view. Match these against a subset of file definition coordination
|
|
474
|
+
* values.
|
|
475
|
+
* @returns The matching loader instance or `null`.
|
|
476
|
+
*/
|
|
477
|
+
export function getMatchingLoader(loaders, dataset, dataType, viewCoordinationValues) {
|
|
478
|
+
if (!loaders[dataset]) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
const loaderInternMap = loaders[dataset].loaders[dataType];
|
|
482
|
+
if (!loaderInternMap) {
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
485
|
+
const loaderKeys = Array.from(loaderInternMap.keys());
|
|
486
|
+
const matchingKey = loaderKeys
|
|
487
|
+
.find(fileCoordinationValues => isMatch(fileCoordinationValues, viewCoordinationValues));
|
|
488
|
+
if (!matchingKey) {
|
|
489
|
+
return null;
|
|
490
|
+
}
|
|
491
|
+
return loaderInternMap.get(matchingKey);
|
|
492
|
+
}
|
|
493
|
+
|
|
433
494
|
/**
|
|
434
495
|
* Find a specific loader instance for a particular dataset, data type, and view
|
|
435
496
|
* coordination values (mapping from coordination types to coordination values).
|
|
@@ -444,22 +505,9 @@ export function useLoaders() {
|
|
|
444
505
|
* @returns The matching loader instance or `null`.
|
|
445
506
|
*/
|
|
446
507
|
export function useMatchingLoader(loaders, dataset, dataType, viewCoordinationValues) {
|
|
447
|
-
return useMemo(() =>
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
}
|
|
451
|
-
const loaderInternMap = loaders[dataset].loaders[dataType];
|
|
452
|
-
if (!loaderInternMap) {
|
|
453
|
-
return null;
|
|
454
|
-
}
|
|
455
|
-
const loaderKeys = Array.from(loaderInternMap.keys());
|
|
456
|
-
const matchingKey = loaderKeys
|
|
457
|
-
.find(fileCoordinationValues => isMatch(fileCoordinationValues, viewCoordinationValues));
|
|
458
|
-
if (!matchingKey) {
|
|
459
|
-
return null;
|
|
460
|
-
}
|
|
461
|
-
return loaderInternMap.get(matchingKey);
|
|
462
|
-
}, [loaders, dataset, dataType, viewCoordinationValues]);
|
|
508
|
+
return useMemo(() => getMatchingLoader(
|
|
509
|
+
loaders, dataset, dataType, viewCoordinationValues,
|
|
510
|
+
), [loaders, dataset, dataType, viewCoordinationValues]);
|
|
463
511
|
}
|
|
464
512
|
|
|
465
513
|
/**
|
|
@@ -467,6 +515,7 @@ export function useMatchingLoader(loaders, dataset, dataType, viewCoordinationVa
|
|
|
467
515
|
* coordination values (mapping from coordination types to coordination values).
|
|
468
516
|
* Uses lodash/isMatch to perform matching against the file definition's
|
|
469
517
|
* coordination value mapping.
|
|
518
|
+
* TODO: can this function be removed?
|
|
470
519
|
* @param {object} loaders The value returned by useLoaders.
|
|
471
520
|
* @param {string} dataset The dataset UID.
|
|
472
521
|
* @param {string} dataType The data type for the matching file.
|
|
@@ -609,7 +658,10 @@ export function useComponentViewInfo(uuid) {
|
|
|
609
658
|
*/
|
|
610
659
|
export function useSetComponentViewInfo(uuid) {
|
|
611
660
|
const setViewInfoRef = useRef(useViewInfoStore.getState().setComponentViewInfo);
|
|
612
|
-
const setComponentViewInfo =
|
|
661
|
+
const setComponentViewInfo = useCallback(
|
|
662
|
+
viewInfo => setViewInfoRef.current(uuid, viewInfo),
|
|
663
|
+
[uuid],
|
|
664
|
+
);
|
|
613
665
|
return setComponentViewInfo;
|
|
614
666
|
}
|
|
615
667
|
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { makeStyles } from '@material-ui/core';
|
|
2
|
+
|
|
3
|
+
export const useTitleStyles = makeStyles(theme => ({
|
|
4
|
+
title: {
|
|
5
|
+
color: theme.palette.primaryForeground,
|
|
6
|
+
overflowX: 'hidden',
|
|
7
|
+
display: 'flex',
|
|
8
|
+
flexDirection: 'row',
|
|
9
|
+
flexShrink: '0',
|
|
10
|
+
},
|
|
11
|
+
titleLeft: {
|
|
12
|
+
flexShrink: '1',
|
|
13
|
+
textOverflow: 'ellipsis',
|
|
14
|
+
whiteSpace: 'nowrap',
|
|
15
|
+
},
|
|
16
|
+
titleInfo: {
|
|
17
|
+
width: '100%',
|
|
18
|
+
textOverflow: 'ellipsis',
|
|
19
|
+
whiteSpace: 'nowrap',
|
|
20
|
+
overflow: 'hidden',
|
|
21
|
+
fontSize: '80% !important',
|
|
22
|
+
opacity: '.8',
|
|
23
|
+
padding: '0 4px',
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
lineHeight: '25px !important',
|
|
26
|
+
flexShrink: '1',
|
|
27
|
+
textAlign: 'right !important',
|
|
28
|
+
},
|
|
29
|
+
titleButtons: {
|
|
30
|
+
display: 'flex',
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
flexGrow: '1',
|
|
33
|
+
flexShrink: '0',
|
|
34
|
+
justifyContent: 'right',
|
|
35
|
+
'& div': {
|
|
36
|
+
display: 'inline-block',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
card: {
|
|
40
|
+
border: `1px solid ${theme.palette.cardBorder}`,
|
|
41
|
+
flex: '1 1 auto',
|
|
42
|
+
minHeight: '1px',
|
|
43
|
+
padding: '12px',
|
|
44
|
+
marginTop: '8px',
|
|
45
|
+
marginBottom: '8px',
|
|
46
|
+
position: 'relative',
|
|
47
|
+
display: 'flex',
|
|
48
|
+
flexDirection: 'column',
|
|
49
|
+
minWidth: '0',
|
|
50
|
+
wordWrap: 'break-word',
|
|
51
|
+
backgroundClip: 'border-box',
|
|
52
|
+
borderRadius: '4px',
|
|
53
|
+
},
|
|
54
|
+
noScrollCard: {
|
|
55
|
+
backgroundColor: theme.palette.secondaryBackground,
|
|
56
|
+
color: theme.palette.secondaryForeground,
|
|
57
|
+
},
|
|
58
|
+
scrollCard: {
|
|
59
|
+
backgroundColor: theme.palette.primaryBackground,
|
|
60
|
+
color: theme.palette.primaryForeground,
|
|
61
|
+
'& a': {
|
|
62
|
+
color: theme.palette.primaryForegroundActive,
|
|
63
|
+
},
|
|
64
|
+
overflowY: 'auto',
|
|
65
|
+
},
|
|
66
|
+
spatialCard: {
|
|
67
|
+
backgroundColor: theme.palette.black,
|
|
68
|
+
color: theme.palette.white,
|
|
69
|
+
'& a': {
|
|
70
|
+
color: theme.palette.white,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
}));
|