@vitessce/vit-s 3.3.4 → 3.3.6
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 +445 -427
- package/dist-tsc/VitS.d.ts +3 -0
- package/dist-tsc/VitS.d.ts.map +1 -1
- package/dist-tsc/VitS.js +4 -2
- package/dist-tsc/data-hook-utils.d.ts.map +1 -1
- package/dist-tsc/data-hook-utils.js +3 -3
- package/dist-tsc/data-hooks-multilevel.d.ts.map +1 -1
- package/dist-tsc/data-hooks-multilevel.js +3 -4
- package/dist-tsc/data-hooks.d.ts.map +1 -1
- package/dist-tsc/data-hooks.js +1 -2
- package/dist-tsc/hooks.d.ts.map +1 -1
- package/dist-tsc/hooks.js +4 -3
- package/dist-tsc/shared-mui/styles.d.ts +1 -0
- package/dist-tsc/shared-mui/styles.js +38 -19
- package/dist-tsc/state/hooks.d.ts +1 -3
- package/dist-tsc/state/hooks.d.ts.map +1 -1
- package/dist-tsc/state/hooks.js +15 -15
- package/dist-tsc/title-styles.js +1 -1
- package/dist-tsc/view-config-utils.js +6 -6
- package/dist-tsc/vitessce-grid-utils.d.ts.map +1 -1
- package/dist-tsc/vitessce-grid-utils.js +1 -2
- package/package.json +6 -6
- package/src/VitS.js +7 -1
- package/src/data-hook-utils.js +2 -3
- package/src/data-hooks-multilevel.js +17 -14
- package/src/data-hooks.js +1 -2
- package/src/hooks.js +19 -14
- package/src/shared-mui/styles.js +39 -19
- package/src/state/hooks.js +15 -15
- package/src/title-styles.js +1 -1
- package/src/view-config-utils.js +6 -6
- package/src/vitessce-grid-utils.js +1 -2
package/src/hooks.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from 'react';
|
|
4
4
|
import { debounce, every } from 'lodash-es';
|
|
5
5
|
import { extent } from 'd3-array';
|
|
6
|
-
import { capitalize
|
|
6
|
+
import { capitalize } from '@vitessce/utils';
|
|
7
7
|
import { STATUS } from '@vitessce/constants-internal';
|
|
8
8
|
import { useGridResize, useEmitGridResize } from './state/hooks.js';
|
|
9
9
|
import { VITESSCE_CONTAINER } from './classNames.js';
|
|
@@ -290,19 +290,24 @@ export function useGetObsInfo(obsType, obsLabelsTypes, obsLabelsData, obsSetsMem
|
|
|
290
290
|
const obsMembership = obsSetsMembership?.get(obsId) || [];
|
|
291
291
|
return {
|
|
292
292
|
[`${capitalize(obsType)} ID`]: obsId,
|
|
293
|
-
...fromEntries(
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
obsLabelsData?.[scopeKey]?.
|
|
304
|
-
|
|
305
|
-
|
|
293
|
+
...Object.fromEntries(
|
|
294
|
+
obsMembership
|
|
295
|
+
.flatMap(path => path.slice(1).map((pathEl, elLevel) => ([
|
|
296
|
+
`${path[0]}${path.length > 2 ? ` L${elLevel + 1}` : ''}`,
|
|
297
|
+
pathEl,
|
|
298
|
+
]))),
|
|
299
|
+
),
|
|
300
|
+
...Object.fromEntries(
|
|
301
|
+
Object.entries(obsLabelsTypes).map(([scopeKey, obsLabelsType]) => ([
|
|
302
|
+
obsLabelsType,
|
|
303
|
+
obsLabelsData?.[scopeKey]?.obsLabels?.[
|
|
304
|
+
// TODO: Maybe all loaders that return obsIndex should also return an obsIndexMap
|
|
305
|
+
// with keys: obsId, values: obsIdx
|
|
306
|
+
// which would avoid the indexOf calls.
|
|
307
|
+
obsLabelsData?.[scopeKey]?.obsIndex?.indexOf(obsId)
|
|
308
|
+
],
|
|
309
|
+
])).filter(([obsLabelsType]) => Boolean(obsLabelsType)),
|
|
310
|
+
),
|
|
306
311
|
};
|
|
307
312
|
}
|
|
308
313
|
return null;
|
package/src/shared-mui/styles.js
CHANGED
|
@@ -57,6 +57,29 @@ const sharedThemeOptions = {
|
|
|
57
57
|
},
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
const lightPalette = {
|
|
61
|
+
type: 'light',
|
|
62
|
+
primary: grey,
|
|
63
|
+
secondary: grey,
|
|
64
|
+
primaryBackground: '#F1F1F1',
|
|
65
|
+
primaryBackgroundHighlight: '#FFFFFF',
|
|
66
|
+
primaryBackgroundInput: '#FFFFFF',
|
|
67
|
+
primaryBackgroundDim: '#8A8A8A',
|
|
68
|
+
primaryBackgroundLight: '#e0e0e0',
|
|
69
|
+
primaryForeground: '#333333',
|
|
70
|
+
primaryForegroundL5: 'rgb(64, 64, 64)', // lighten(map-get($theme-colors, "primary-foreground"), 5%);
|
|
71
|
+
primaryForegroundL10: 'rgb(77, 77, 77)', // lighten(map-get($theme-colors, "primary-foreground"), 10%);
|
|
72
|
+
primaryForegroundD15: 'rgb(13, 13, 13)', // darken(map-get($theme-colors, "primary-foreground"), 15%);
|
|
73
|
+
primaryForegroundDim: '#808080',
|
|
74
|
+
primaryForegroundActive: '#0074D9',
|
|
75
|
+
secondaryBackground: '#F1F1F1',
|
|
76
|
+
secondaryBackgroundDim: '#C0C0C0',
|
|
77
|
+
secondaryForeground: '#222222',
|
|
78
|
+
gridLayoutBackground: '#FFFFFF',
|
|
79
|
+
cardBorder: 'rgba(241, 241, 241, 0.125)',
|
|
80
|
+
tooltipText: 'rgba(0, 0, 0, 0.87)',
|
|
81
|
+
};
|
|
82
|
+
|
|
60
83
|
export const muiTheme = {
|
|
61
84
|
dark: createTheme({
|
|
62
85
|
palette: {
|
|
@@ -83,31 +106,28 @@ export const muiTheme = {
|
|
|
83
106
|
...globalColors,
|
|
84
107
|
},
|
|
85
108
|
...sharedThemeOptions,
|
|
109
|
+
cardBorderSize: '1px',
|
|
86
110
|
}),
|
|
87
111
|
light: createTheme({
|
|
88
112
|
palette: {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
primaryForegroundActive: '#0074D9',
|
|
103
|
-
secondaryBackground: '#F1F1F1',
|
|
104
|
-
secondaryBackgroundDim: '#C0C0C0',
|
|
105
|
-
secondaryForeground: '#222222',
|
|
113
|
+
...lightPalette,
|
|
114
|
+
...globalColors,
|
|
115
|
+
},
|
|
116
|
+
...sharedThemeOptions,
|
|
117
|
+
cardBorderSize: '1px',
|
|
118
|
+
}),
|
|
119
|
+
light2: createTheme({
|
|
120
|
+
palette: {
|
|
121
|
+
...lightPalette,
|
|
122
|
+
primaryBackground: '#FFFFFF',
|
|
123
|
+
primaryBackgroundHighlight: '#F1F1F1',
|
|
124
|
+
primaryBackgroundInput: '#F1F1F1',
|
|
125
|
+
secondaryBackground: '#FFFFFF',
|
|
106
126
|
gridLayoutBackground: '#FFFFFF',
|
|
107
|
-
cardBorder: '
|
|
108
|
-
tooltipText: 'rgba(0, 0, 0, 0.87)',
|
|
127
|
+
cardBorder: '#ccc',
|
|
109
128
|
...globalColors,
|
|
110
129
|
},
|
|
111
130
|
...sharedThemeOptions,
|
|
131
|
+
cardBorderSize: '2px',
|
|
112
132
|
}),
|
|
113
133
|
};
|
package/src/state/hooks.js
CHANGED
|
@@ -6,7 +6,7 @@ import createContext from 'zustand/context';
|
|
|
6
6
|
import shallow from 'zustand/shallow';
|
|
7
7
|
import { isMatch, cloneDeep } from 'lodash-es';
|
|
8
8
|
import { CoordinationType } from '@vitessce/constants-internal';
|
|
9
|
-
import {
|
|
9
|
+
import { capitalize } from '@vitessce/utils';
|
|
10
10
|
import { getCoordinationSpaceAndScopes } from '@vitessce/config';
|
|
11
11
|
import {
|
|
12
12
|
removeImageChannelInMetaCoordinationScopesHelper,
|
|
@@ -444,7 +444,7 @@ const useGridSizeStore = create(set => ({
|
|
|
444
444
|
export function useInitialCoordination(parameters, coordinationScopes) {
|
|
445
445
|
const values = useViewConfigStore((state) => {
|
|
446
446
|
const { coordinationSpace } = state.initialViewConfig;
|
|
447
|
-
return fromEntries(parameters.map((parameter) => {
|
|
447
|
+
return Object.fromEntries(parameters.map((parameter) => {
|
|
448
448
|
if (coordinationSpace && coordinationSpace[parameter]) {
|
|
449
449
|
const value = coordinationSpace[parameter][coordinationScopes[parameter]];
|
|
450
450
|
return [parameter, value];
|
|
@@ -476,7 +476,7 @@ export function useCoordination(parameters, coordinationScopes) {
|
|
|
476
476
|
|
|
477
477
|
const values = useViewConfigStore((state) => {
|
|
478
478
|
const { coordinationSpace } = state.viewConfig;
|
|
479
|
-
return fromEntries(parameters.map((parameter) => {
|
|
479
|
+
return Object.fromEntries(parameters.map((parameter) => {
|
|
480
480
|
if (coordinationSpace) {
|
|
481
481
|
const parameterScope = getParameterScope(parameter, coordinationScopes);
|
|
482
482
|
if (coordinationSpace && coordinationSpace[parameter]) {
|
|
@@ -488,7 +488,7 @@ export function useCoordination(parameters, coordinationScopes) {
|
|
|
488
488
|
}));
|
|
489
489
|
}, shallow);
|
|
490
490
|
|
|
491
|
-
const setters = useMemo(() => fromEntries(parameters.map((parameter) => {
|
|
491
|
+
const setters = useMemo(() => Object.fromEntries(parameters.map((parameter) => {
|
|
492
492
|
const setterName = `set${capitalize(parameter)}`;
|
|
493
493
|
const setterFunc = value => setCoordinationValue({
|
|
494
494
|
parameter,
|
|
@@ -539,7 +539,7 @@ export function useMultiCoordinationScopesSecondary(
|
|
|
539
539
|
const scopes = getParameterScope(byType, coordinationScopes);
|
|
540
540
|
if (scopes && coordinationScopesBy?.[byType]?.[parameter]) {
|
|
541
541
|
const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
|
|
542
|
-
return [scopesArr, fromEntries(scopesArr.map((scope) => {
|
|
542
|
+
return [scopesArr, Object.fromEntries(scopesArr.map((scope) => {
|
|
543
543
|
const secondaryScopes = coordinationScopesBy[byType][parameter][scope];
|
|
544
544
|
const secondaryScopesArr = Array.isArray(secondaryScopes)
|
|
545
545
|
? secondaryScopes
|
|
@@ -550,7 +550,7 @@ export function useMultiCoordinationScopesSecondary(
|
|
|
550
550
|
// Fallback from fine-grained to coarse-grained.
|
|
551
551
|
if (scopes && !coordinationScopesBy?.[byType]?.[parameter] && coordinationScopes?.[parameter]) {
|
|
552
552
|
const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
|
|
553
|
-
return [scopesArr, fromEntries(scopesArr.map((scope) => {
|
|
553
|
+
return [scopesArr, Object.fromEntries(scopesArr.map((scope) => {
|
|
554
554
|
const secondaryScopes = coordinationScopes?.[parameter];
|
|
555
555
|
const secondaryScopesArr = Array.isArray(secondaryScopes)
|
|
556
556
|
? secondaryScopes
|
|
@@ -586,7 +586,7 @@ export function useMultiCoordinationScopesSecondaryNonNull(
|
|
|
586
586
|
}
|
|
587
587
|
return false;
|
|
588
588
|
});
|
|
589
|
-
return [scopesNonNull, fromEntries(scopesNonNull.map((scope) => {
|
|
589
|
+
return [scopesNonNull, Object.fromEntries(scopesNonNull.map((scope) => {
|
|
590
590
|
const secondaryScopes = coordinationScopesBy[byType][parameter][scope];
|
|
591
591
|
const secondaryScopesArr = Array.isArray(secondaryScopes)
|
|
592
592
|
? secondaryScopes
|
|
@@ -611,7 +611,7 @@ export function useMultiCoordinationScopesSecondaryNonNull(
|
|
|
611
611
|
}
|
|
612
612
|
return false;
|
|
613
613
|
});
|
|
614
|
-
return [scopesNonNull, fromEntries(scopesNonNull.map((scope) => {
|
|
614
|
+
return [scopesNonNull, Object.fromEntries(scopesNonNull.map((scope) => {
|
|
615
615
|
const secondaryScopes = coordinationScopes?.[parameter];
|
|
616
616
|
const secondaryScopesArr = Array.isArray(secondaryScopes)
|
|
617
617
|
? secondaryScopes
|
|
@@ -638,7 +638,7 @@ export function useMultiCoordinationValues(parameter, coordinationScopes) {
|
|
|
638
638
|
const { coordinationSpace } = state.viewConfig;
|
|
639
639
|
// Convert a single scope to an array of scopes to be consistent.
|
|
640
640
|
const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
|
|
641
|
-
return fromEntries(scopesArr.map((scope) => {
|
|
641
|
+
return Object.fromEntries(scopesArr.map((scope) => {
|
|
642
642
|
if (coordinationSpace && coordinationSpace[parameter]) {
|
|
643
643
|
const value = coordinationSpace[parameter][scope];
|
|
644
644
|
return [scope, value];
|
|
@@ -689,8 +689,8 @@ export function useComplexCoordination(
|
|
|
689
689
|
if (typeScopes) {
|
|
690
690
|
// Convert a single scope to an array of scopes to be consistent.
|
|
691
691
|
const typeScopesArr = Array.isArray(typeScopes) ? typeScopes : [typeScopes];
|
|
692
|
-
return fromEntries(typeScopesArr.map((datasetScope) => {
|
|
693
|
-
const datasetValues = fromEntries(parameters.map((parameter, i) => {
|
|
692
|
+
return Object.fromEntries(typeScopesArr.map((datasetScope) => {
|
|
693
|
+
const datasetValues = Object.fromEntries(parameters.map((parameter, i) => {
|
|
694
694
|
if (parameterSpaces[i]) {
|
|
695
695
|
const parameterSpace = parameterSpaces[i];
|
|
696
696
|
const parameterScope = getParameterScopeBy(
|
|
@@ -722,8 +722,8 @@ export function useComplexCoordination(
|
|
|
722
722
|
if (typeScopes) {
|
|
723
723
|
// Convert a single scope to an array of scopes to be consistent.
|
|
724
724
|
const typeScopesArr = Array.isArray(typeScopes) ? typeScopes : [typeScopes];
|
|
725
|
-
return fromEntries(typeScopesArr.map((datasetScope) => {
|
|
726
|
-
const datasetSetters = fromEntries(parameters.map((parameter) => {
|
|
725
|
+
return Object.fromEntries(typeScopesArr.map((datasetScope) => {
|
|
726
|
+
const datasetSetters = Object.fromEntries(parameters.map((parameter) => {
|
|
727
727
|
const setterName = `set${capitalize(parameter)}`;
|
|
728
728
|
const setterFunc = value => setCoordinationValue({
|
|
729
729
|
parameter,
|
|
@@ -939,7 +939,7 @@ export function useAuxiliaryCoordination(parameters, coordinationScopes) {
|
|
|
939
939
|
const mappedParameters = mapParameters(parameters);
|
|
940
940
|
const values = useAuxiliaryStore((state) => {
|
|
941
941
|
const { auxiliaryStore } = state;
|
|
942
|
-
return fromEntries(mappedParameters.map((parameter) => {
|
|
942
|
+
return Object.fromEntries(mappedParameters.map((parameter) => {
|
|
943
943
|
if (auxiliaryStore && auxiliaryStore[parameter]) {
|
|
944
944
|
const value = auxiliaryStore[parameter][mappedCoordinationScopes[parameter]];
|
|
945
945
|
return [parameter, value];
|
|
@@ -947,7 +947,7 @@ export function useAuxiliaryCoordination(parameters, coordinationScopes) {
|
|
|
947
947
|
return [parameter, undefined];
|
|
948
948
|
}));
|
|
949
949
|
}, shallow);
|
|
950
|
-
const setters = useMemo(() => fromEntries(mappedParameters.map((parameter) => {
|
|
950
|
+
const setters = useMemo(() => Object.fromEntries(mappedParameters.map((parameter) => {
|
|
951
951
|
const setterName = `set${capitalize(parameter)}`;
|
|
952
952
|
const setterFunc = value => setCoordinationValue({
|
|
953
953
|
parameter,
|
package/src/title-styles.js
CHANGED
|
@@ -37,7 +37,7 @@ export const useTitleStyles = makeStyles(theme => ({
|
|
|
37
37
|
},
|
|
38
38
|
},
|
|
39
39
|
card: {
|
|
40
|
-
border:
|
|
40
|
+
border: `${theme.cardBorderSize} solid ${theme.palette.cardBorder}`,
|
|
41
41
|
flex: '1 1 auto',
|
|
42
42
|
minHeight: '1px',
|
|
43
43
|
padding: '12px',
|
package/src/view-config-utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-plusplus */
|
|
2
2
|
/* eslint-disable camelcase */
|
|
3
3
|
import { cloneDeep } from 'lodash-es';
|
|
4
|
-
import {
|
|
4
|
+
import { getNextScope } from '@vitessce/utils';
|
|
5
5
|
import {
|
|
6
6
|
AUTO_INDEPENDENT_COORDINATION_TYPES,
|
|
7
7
|
META_VERSION,
|
|
@@ -39,7 +39,7 @@ export function getExistingScopesForCoordinationType(config, coordinationType) {
|
|
|
39
39
|
* @returns {object} The new view config.
|
|
40
40
|
*/
|
|
41
41
|
function coordinateComponentsTogether(config, coordinationType, scopeValue, viewTypes) {
|
|
42
|
-
const componentCoordinationTypes = fromEntries(
|
|
42
|
+
const componentCoordinationTypes = Object.fromEntries(
|
|
43
43
|
viewTypes.map(vt => ([vt.name, vt.coordinationTypes])),
|
|
44
44
|
);
|
|
45
45
|
const scopeName = getNextScope(getExistingScopesForCoordinationType(config, coordinationType));
|
|
@@ -83,7 +83,7 @@ function coordinateComponentsTogether(config, coordinationType, scopeValue, view
|
|
|
83
83
|
* @returns {object} The new view config.
|
|
84
84
|
*/
|
|
85
85
|
function coordinateComponentsIndependent(config, coordinationType, scopeValue, viewTypes) {
|
|
86
|
-
const componentCoordinationTypes = fromEntries(
|
|
86
|
+
const componentCoordinationTypes = Object.fromEntries(
|
|
87
87
|
viewTypes.map(vt => ([vt.name, vt.coordinationTypes])),
|
|
88
88
|
);
|
|
89
89
|
const newConfig = {
|
|
@@ -133,10 +133,10 @@ function initializeAuto(config, coordinationTypeObjs, viewTypeObjs) {
|
|
|
133
133
|
let newConfig = config;
|
|
134
134
|
const { layout, datasets } = newConfig;
|
|
135
135
|
|
|
136
|
-
const componentCoordinationTypes = fromEntries(
|
|
136
|
+
const componentCoordinationTypes = Object.fromEntries(
|
|
137
137
|
viewTypeObjs.map(vt => ([vt.name, vt.coordinationTypes])),
|
|
138
138
|
);
|
|
139
|
-
const defaultCoordinationValues = fromEntries(
|
|
139
|
+
const defaultCoordinationValues = Object.fromEntries(
|
|
140
140
|
coordinationTypeObjs.map(ct => ([ct.name, ct.defaultValue])),
|
|
141
141
|
);
|
|
142
142
|
const coordinationTypes = coordinationTypeObjs.map(ct => ct.name);
|
|
@@ -215,7 +215,7 @@ function assignViewUids(config) {
|
|
|
215
215
|
* @returns The view config containing expanded minimal file types.
|
|
216
216
|
*/
|
|
217
217
|
function expandConvenienceFileDefs(config, jointFileTypes) {
|
|
218
|
-
const convenienceFileTypes = fromEntries(
|
|
218
|
+
const convenienceFileTypes = Object.fromEntries(
|
|
219
219
|
jointFileTypes.map(ft => ([ft.name, ft.expandFunction])),
|
|
220
220
|
);
|
|
221
221
|
const { datasets: currDatasets } = config;
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
} from 'react';
|
|
4
4
|
import { InternMap } from 'internmap';
|
|
5
5
|
import { isEqual, pick } from 'lodash-es';
|
|
6
|
-
import { fromEntries } from '@vitessce/utils';
|
|
7
6
|
import { DATA_TYPE_COORDINATION_VALUE_USAGE } from '@vitessce/constants-internal';
|
|
8
7
|
import { getSourceAndLoaderFromFileType, getDataTypeFromFileType } from './data/loader-registry.js';
|
|
9
8
|
|
|
@@ -127,7 +126,7 @@ function withDefaults(
|
|
|
127
126
|
export function createLoaders(datasets, configDescription, fileTypes, coordinationTypes, stores) {
|
|
128
127
|
const result = {};
|
|
129
128
|
const dataSources = new InternMap([], JSON.stringify);
|
|
130
|
-
const defaultCoordinationValues = fromEntries(
|
|
129
|
+
const defaultCoordinationValues = Object.fromEntries(
|
|
131
130
|
coordinationTypes.map(ct => ([ct.name, ct.defaultValue])),
|
|
132
131
|
);
|
|
133
132
|
datasets.forEach((dataset) => {
|