@vitessce/vit-s 3.1.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1673 -130
- package/dist-tsc/data-hook-utils.d.ts +1 -0
- package/dist-tsc/data-hook-utils.d.ts.map +1 -1
- package/dist-tsc/data-hook-utils.js +12 -4
- package/dist-tsc/data-hooks-multilevel-utils.d.ts +77 -0
- package/dist-tsc/data-hooks-multilevel-utils.d.ts.map +1 -0
- package/dist-tsc/data-hooks-multilevel-utils.js +418 -0
- package/dist-tsc/data-hooks-multilevel-utils.test.d.ts +2 -0
- package/dist-tsc/data-hooks-multilevel-utils.test.d.ts.map +1 -0
- package/dist-tsc/data-hooks-multilevel-utils.test.js +101 -0
- package/dist-tsc/data-hooks-multilevel.d.ts +8 -0
- package/dist-tsc/data-hooks-multilevel.d.ts.map +1 -0
- package/dist-tsc/data-hooks-multilevel.js +125 -0
- package/dist-tsc/data-hooks.d.ts +7 -0
- package/dist-tsc/data-hooks.d.ts.map +1 -1
- package/dist-tsc/data-hooks.js +75 -6
- package/dist-tsc/hooks.js +1 -1
- package/dist-tsc/index.d.ts +3 -2
- package/dist-tsc/index.js +3 -2
- package/dist-tsc/shared-mui/components.d.ts.map +1 -1
- package/dist-tsc/shared-mui/components.js +3 -2
- package/dist-tsc/state/hooks.d.ts +80 -21
- package/dist-tsc/state/hooks.d.ts.map +1 -1
- package/dist-tsc/state/hooks.js +428 -103
- package/dist-tsc/state/hooks.test.d.ts +2 -0
- package/dist-tsc/state/hooks.test.d.ts.map +1 -0
- package/dist-tsc/state/hooks.test.js +149 -0
- package/dist-tsc/state/spatial-reducers.d.ts +25 -0
- package/dist-tsc/state/spatial-reducers.d.ts.map +1 -0
- package/dist-tsc/state/spatial-reducers.js +251 -0
- package/dist-tsc/state/spatial-reducers.test.d.ts +2 -0
- package/dist-tsc/state/spatial-reducers.test.d.ts.map +1 -0
- package/dist-tsc/state/spatial-reducers.test.js +1382 -0
- package/package.json +5 -5
- package/src/data-hook-utils.js +19 -3
- package/src/data-hooks-multilevel-utils.js +571 -0
- package/src/data-hooks-multilevel-utils.test.js +110 -0
- package/src/data-hooks-multilevel.js +226 -0
- package/src/data-hooks.js +156 -6
- package/src/hooks.js +1 -1
- package/src/index.js +25 -0
- package/src/shared-mui/components.js +9 -4
- package/src/state/hooks.js +485 -104
- package/src/state/hooks.test.js +182 -0
- package/src/state/spatial-reducers.js +291 -0
- package/src/state/spatial-reducers.test.js +1432 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { initializeNestedObject, nestFeatureSelectionQueryResults, getFeatureSelectionQueryKeyScopeTuples, nestQueryResults, getQueryKeyScopeTuples, } from './data-hooks-multilevel-utils.js';
|
|
3
|
+
describe('recursive data hook utilities for nesting and un-nesting multi-level queries', () => {
|
|
4
|
+
describe('initializeNestedObject', () => {
|
|
5
|
+
it('should initialize an empty nested object', () => {
|
|
6
|
+
const nestedObject = {};
|
|
7
|
+
initializeNestedObject(['a', 'b', 'c'], nestedObject, () => true);
|
|
8
|
+
expect(nestedObject).toEqual({ a: { b: { c: true } } });
|
|
9
|
+
});
|
|
10
|
+
it('should initialize a non-empty nested object at the same path', () => {
|
|
11
|
+
const nestedObject = { a: { b: { c: [1, 2, 3] } } };
|
|
12
|
+
initializeNestedObject(['a', 'b', 'c'], nestedObject, () => []);
|
|
13
|
+
expect(nestedObject).toEqual({ a: { b: { c: [1, 2, 3] } } });
|
|
14
|
+
});
|
|
15
|
+
it('should initialize a non-empty nested object at a different path', () => {
|
|
16
|
+
const nestedObject = { a: { b: { c: [1, 2, 3] } } };
|
|
17
|
+
initializeNestedObject(['a', 'b', 'd'], nestedObject, () => []);
|
|
18
|
+
expect(nestedObject).toEqual({ a: { b: { c: [1, 2, 3], d: [] } } });
|
|
19
|
+
});
|
|
20
|
+
it('should initialize two paths', () => {
|
|
21
|
+
const nestedObject = {};
|
|
22
|
+
initializeNestedObject(['a', 'b', 'c'], nestedObject, () => true);
|
|
23
|
+
initializeNestedObject(['d', 'e', 'f'], nestedObject, () => true);
|
|
24
|
+
expect(nestedObject).toEqual({
|
|
25
|
+
a: { b: { c: true } },
|
|
26
|
+
d: { e: { f: true } },
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
});
|
|
30
|
+
describe('nestFeatureSelectionQueryResults', () => {
|
|
31
|
+
it('should nest flat query results', () => {
|
|
32
|
+
const queryKeyScopeTuples = [
|
|
33
|
+
[['someQueryKey', 'abc'], { levelScopes: ['a', 'b', 'c'], featureIndex: 0, numFeatures: 3 }],
|
|
34
|
+
[['someQueryKey', 'abc'], { levelScopes: ['a', 'b', 'c'], featureIndex: 1, numFeatures: 3 }],
|
|
35
|
+
[['someQueryKey', 'abd'], { levelScopes: ['a', 'b', 'd'], featureIndex: 0, numFeatures: 2 }],
|
|
36
|
+
];
|
|
37
|
+
const flatQueryResults = [
|
|
38
|
+
'abc0',
|
|
39
|
+
'abc1',
|
|
40
|
+
'abd0',
|
|
41
|
+
];
|
|
42
|
+
const nestedData = nestFeatureSelectionQueryResults(queryKeyScopeTuples, flatQueryResults);
|
|
43
|
+
expect(nestedData).toEqual({
|
|
44
|
+
a: { b: { c: ['abc0', 'abc1', undefined], d: ['abd0', undefined] } },
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('getFeatureSelectionQueryKeyScopeTuples', () => {
|
|
49
|
+
it('should convert nested selections and matchOn objects to array of tuples', () => {
|
|
50
|
+
const selections = { a: { b: { c: ['geneA', 'geneB', 'geneC'] } } };
|
|
51
|
+
const matchOn = { a: { b: { c: { obsType: 'cell', featureType: 'gene' } } } };
|
|
52
|
+
const queryKeyScopeTuples = getFeatureSelectionQueryKeyScopeTuples(selections, matchOn, 3, 'someDataset', 'someDataType', true);
|
|
53
|
+
expect(queryKeyScopeTuples).toEqual([
|
|
54
|
+
[
|
|
55
|
+
['someDataset', 'someDataType', { obsType: 'cell', featureType: 'gene' }, 'geneA', true, 'useFeatureSelectionMultiLevel'],
|
|
56
|
+
// scope info (for rolling up later)
|
|
57
|
+
{ levelScopes: ['a', 'b', 'c'], featureIndex: 0, numFeatures: 3 },
|
|
58
|
+
],
|
|
59
|
+
[
|
|
60
|
+
['someDataset', 'someDataType', { obsType: 'cell', featureType: 'gene' }, 'geneB', true, 'useFeatureSelectionMultiLevel'],
|
|
61
|
+
// scope info (for rolling up later)
|
|
62
|
+
{ levelScopes: ['a', 'b', 'c'], featureIndex: 1, numFeatures: 3 },
|
|
63
|
+
],
|
|
64
|
+
[
|
|
65
|
+
['someDataset', 'someDataType', { obsType: 'cell', featureType: 'gene' }, 'geneC', true, 'useFeatureSelectionMultiLevel'],
|
|
66
|
+
// scope info (for rolling up later)
|
|
67
|
+
{ levelScopes: ['a', 'b', 'c'], featureIndex: 2, numFeatures: 3 },
|
|
68
|
+
],
|
|
69
|
+
]);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
describe('nestQueryResults', () => {
|
|
73
|
+
it('should nest flat query results', () => {
|
|
74
|
+
const queryKeyScopeTuples = [
|
|
75
|
+
[['someQueryKey', 'abc'], { levelScopes: ['a', 'b', 'c'] }],
|
|
76
|
+
[['someQueryKey', 'abd'], { levelScopes: ['a', 'b', 'd'] }],
|
|
77
|
+
];
|
|
78
|
+
const flatQueryResults = [
|
|
79
|
+
{ someKey: 'abc0' },
|
|
80
|
+
{ someKey: 'abd0' },
|
|
81
|
+
];
|
|
82
|
+
const nestedData = nestQueryResults(queryKeyScopeTuples, flatQueryResults);
|
|
83
|
+
expect(nestedData).toEqual({
|
|
84
|
+
a: { b: { c: { someKey: 'abc0' }, d: { someKey: 'abd0' } } },
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
describe('getQueryKeyScopeTuples', () => {
|
|
89
|
+
it('should convert nested selections and matchOn objects to array of tuples', () => {
|
|
90
|
+
const matchOn = { a: { b: { c: { obsType: 'cell', featureType: 'gene' } } } };
|
|
91
|
+
const queryKeyScopeTuples = getQueryKeyScopeTuples(matchOn, 3, 'someDataset', 'someDataType', true);
|
|
92
|
+
expect(queryKeyScopeTuples).toEqual([
|
|
93
|
+
[
|
|
94
|
+
['someDataset', 'someDataType', { obsType: 'cell', featureType: 'gene' }, true, 'useDataType'],
|
|
95
|
+
// scope info (for rolling up later)
|
|
96
|
+
{ levelScopes: ['a', 'b', 'c'] },
|
|
97
|
+
],
|
|
98
|
+
]);
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function useSegmentationMultiFeatureSelection(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
2
|
+
export function useSpotMultiFeatureSelection(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
3
|
+
export function useSegmentationMultiObsFeatureMatrixIndices(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
4
|
+
export function useSpotMultiObsFeatureMatrixIndices(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
5
|
+
export function usePointMultiObsLabels(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
6
|
+
export function useSegmentationMultiObsLocations(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
7
|
+
export function useSegmentationMultiObsSets(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
8
|
+
//# sourceMappingURL=data-hooks-multilevel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-hooks-multilevel.d.ts","sourceRoot":"","sources":["../src/data-hooks-multilevel.js"],"names":[],"mappings":"AAgBA,4IA+CC;AAED,oIA0CC;AAED,mJAuBC;AAED,2IAsBC;AAED,8HAqBC;AAED,wIAqBC;AAED,mIAqBC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { CoordinationType } from '@vitessce/constants-internal';
|
|
3
|
+
import { fromEntries } from '@vitessce/utils';
|
|
4
|
+
import { useComplexCoordination, useComplexCoordinationSecondary, } from './state/hooks.js';
|
|
5
|
+
import { useFeatureSelectionMultiLevel, useObsFeatureMatrixIndicesMultiLevel, useObsLocationsMultiLevel, useObsSetsMultiLevel, useObsLabelsMultiLevel, } from './data-hooks-multilevel-utils.js';
|
|
6
|
+
export function useSegmentationMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
7
|
+
const obsFeatureMatrixCoordination = useComplexCoordinationSecondary([
|
|
8
|
+
CoordinationType.OBS_TYPE,
|
|
9
|
+
CoordinationType.FEATURE_TYPE,
|
|
10
|
+
CoordinationType.FEATURE_VALUE_TYPE,
|
|
11
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SEGMENTATION_LAYER, CoordinationType.SEGMENTATION_CHANNEL);
|
|
12
|
+
const featureSelectionCoordination = useComplexCoordinationSecondary([
|
|
13
|
+
CoordinationType.FEATURE_SELECTION,
|
|
14
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SEGMENTATION_LAYER, CoordinationType.SEGMENTATION_CHANNEL);
|
|
15
|
+
const matchOnObj = useMemo(() => obsFeatureMatrixCoordination[0],
|
|
16
|
+
// imageCoordination reference changes each render,
|
|
17
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
18
|
+
// indirect dependencies here.
|
|
19
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
20
|
+
const selections = useMemo(() => fromEntries(Object.entries(featureSelectionCoordination[0])
|
|
21
|
+
.map(([layerScope, layerVal]) => ([
|
|
22
|
+
layerScope,
|
|
23
|
+
fromEntries(Object.entries(layerVal)
|
|
24
|
+
.map(([cScope, cVal]) => ([cScope, cVal.featureSelection]))),
|
|
25
|
+
]))),
|
|
26
|
+
// Need to execute this more frequently, whenever the featureSelections update.
|
|
27
|
+
[coordinationScopes, coordinationScopesBy,
|
|
28
|
+
...Object.values(featureSelectionCoordination[0] || {})
|
|
29
|
+
.flatMap(layerVal => Object.values(layerVal).map(cVal => cVal.featureSelection)),
|
|
30
|
+
]);
|
|
31
|
+
const [featureData, loadedSelections, extents, normData, featureStatus,] = useFeatureSelectionMultiLevel(loaders, dataset, false, matchOnObj, selections, 2);
|
|
32
|
+
return [featureData, loadedSelections, extents, normData, featureStatus];
|
|
33
|
+
}
|
|
34
|
+
export function useSpotMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
35
|
+
const obsFeatureMatrixCoordination = useComplexCoordination([
|
|
36
|
+
CoordinationType.OBS_TYPE,
|
|
37
|
+
CoordinationType.FEATURE_TYPE,
|
|
38
|
+
CoordinationType.FEATURE_VALUE_TYPE,
|
|
39
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SPOT_LAYER);
|
|
40
|
+
const featureSelectionCoordination = useComplexCoordination([
|
|
41
|
+
CoordinationType.FEATURE_SELECTION,
|
|
42
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SPOT_LAYER);
|
|
43
|
+
const matchOnObj = useMemo(() => obsFeatureMatrixCoordination[0],
|
|
44
|
+
// imageCoordination reference changes each render,
|
|
45
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
46
|
+
// indirect dependencies here.
|
|
47
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
48
|
+
const selections = useMemo(() => fromEntries(Object.entries(featureSelectionCoordination[0])
|
|
49
|
+
.map(([layerScope, layerVal]) => ([
|
|
50
|
+
layerScope,
|
|
51
|
+
layerVal.featureSelection,
|
|
52
|
+
]))),
|
|
53
|
+
// Need to execute this more frequently, whenever the featureSelections update.
|
|
54
|
+
[coordinationScopes, coordinationScopesBy,
|
|
55
|
+
...Object.values(featureSelectionCoordination[0] || {})
|
|
56
|
+
.flatMap(layerVal => layerVal.featureSelection),
|
|
57
|
+
]);
|
|
58
|
+
const [featureData, loadedSelections, extents, normData, featureStatus,] = useFeatureSelectionMultiLevel(loaders, dataset, false, matchOnObj, selections, 1);
|
|
59
|
+
return [featureData, loadedSelections, extents, normData, featureStatus];
|
|
60
|
+
}
|
|
61
|
+
export function useSegmentationMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
62
|
+
const obsFeatureMatrixCoordination = useComplexCoordinationSecondary([
|
|
63
|
+
CoordinationType.OBS_TYPE,
|
|
64
|
+
CoordinationType.FEATURE_TYPE,
|
|
65
|
+
CoordinationType.FEATURE_VALUE_TYPE,
|
|
66
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SEGMENTATION_LAYER, CoordinationType.SEGMENTATION_CHANNEL);
|
|
67
|
+
const matchOnObj = useMemo(() => obsFeatureMatrixCoordination[0],
|
|
68
|
+
// imageCoordination reference changes each render,
|
|
69
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
70
|
+
// indirect dependencies here.
|
|
71
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
72
|
+
const [indicesData, indicesDataStatus] = useObsFeatureMatrixIndicesMultiLevel(loaders, dataset, false, matchOnObj, 2);
|
|
73
|
+
return [indicesData, indicesDataStatus];
|
|
74
|
+
}
|
|
75
|
+
export function useSpotMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
76
|
+
const obsFeatureMatrixCoordination = useComplexCoordination([
|
|
77
|
+
CoordinationType.OBS_TYPE,
|
|
78
|
+
CoordinationType.FEATURE_TYPE,
|
|
79
|
+
CoordinationType.FEATURE_VALUE_TYPE,
|
|
80
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SPOT_LAYER);
|
|
81
|
+
const matchOnObj = useMemo(() => obsFeatureMatrixCoordination[0],
|
|
82
|
+
// imageCoordination reference changes each render,
|
|
83
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
84
|
+
// indirect dependencies here.
|
|
85
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
86
|
+
const [indicesData, indicesDataStatus] = useObsFeatureMatrixIndicesMultiLevel(loaders, dataset, false, matchOnObj, 1);
|
|
87
|
+
return [indicesData, indicesDataStatus];
|
|
88
|
+
}
|
|
89
|
+
export function usePointMultiObsLabels(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
90
|
+
const obsLabelsCoordination = useComplexCoordination([
|
|
91
|
+
CoordinationType.OBS_TYPE,
|
|
92
|
+
CoordinationType.OBS_LABELS_TYPE,
|
|
93
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.POINT_LAYER);
|
|
94
|
+
const matchOnObj = useMemo(() => obsLabelsCoordination[0],
|
|
95
|
+
// imageCoordination reference changes each render,
|
|
96
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
97
|
+
// indirect dependencies here.
|
|
98
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
99
|
+
const [indicesData, indicesDataStatus] = useObsLabelsMultiLevel(loaders, dataset, false, matchOnObj, 1);
|
|
100
|
+
return [indicesData, indicesDataStatus];
|
|
101
|
+
}
|
|
102
|
+
export function useSegmentationMultiObsLocations(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
103
|
+
const obsTypeCoordination = useComplexCoordinationSecondary([
|
|
104
|
+
CoordinationType.OBS_TYPE,
|
|
105
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SEGMENTATION_LAYER, CoordinationType.SEGMENTATION_CHANNEL);
|
|
106
|
+
const matchOnObj = useMemo(() => obsTypeCoordination[0],
|
|
107
|
+
// imageCoordination reference changes each render,
|
|
108
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
109
|
+
// indirect dependencies here.
|
|
110
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
111
|
+
const [indicesData, indicesDataStatus] = useObsLocationsMultiLevel(loaders, dataset, false, matchOnObj, 2);
|
|
112
|
+
return [indicesData, indicesDataStatus];
|
|
113
|
+
}
|
|
114
|
+
export function useSegmentationMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
115
|
+
const obsTypeCoordination = useComplexCoordinationSecondary([
|
|
116
|
+
CoordinationType.OBS_TYPE,
|
|
117
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SEGMENTATION_LAYER, CoordinationType.SEGMENTATION_CHANNEL);
|
|
118
|
+
const matchOnObj = useMemo(() => obsTypeCoordination[0],
|
|
119
|
+
// imageCoordination reference changes each render,
|
|
120
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
121
|
+
// indirect dependencies here.
|
|
122
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
123
|
+
const [indicesData, indicesDataStatus] = useObsSetsMultiLevel(loaders, dataset, false, matchOnObj, 2);
|
|
124
|
+
return [indicesData, indicesDataStatus];
|
|
125
|
+
}
|
package/dist-tsc/data-hooks.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export function useDescription(loaders: object, dataset: string): array;
|
|
|
30
30
|
* number of items in the cells object.
|
|
31
31
|
*/
|
|
32
32
|
export function useObsEmbeddingData(loaders: object, dataset: string, isRequired: boolean, coordinationSetters: object, initialCoordinationValues: object, matchOn: any): array;
|
|
33
|
+
export function useObsSpotsData(loaders: any, dataset: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
|
|
34
|
+
export function useObsPointsData(loaders: any, dataset: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
|
|
33
35
|
export function useObsLocationsData(loaders: any, dataset: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
|
|
34
36
|
export function useObsLabelsData(loaders: any, dataset: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
|
|
35
37
|
export function useObsSegmentationsData(loaders: any, dataset: any, isRequired: any, coordinationSetters: any, initialCoordinationValues: any, matchOn: any): array;
|
|
@@ -69,5 +71,10 @@ export function useFeatureSelection(loaders: object, dataset: string, isRequired
|
|
|
69
71
|
* @returns {object} [attrs] { rows, cols } object containing cell and gene names.
|
|
70
72
|
*/
|
|
71
73
|
export function useObsFeatureMatrixIndices(loaders: object, dataset: string, isRequired: boolean, matchOn: any): object;
|
|
74
|
+
export function useMultiObsPoints(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
75
|
+
export function useMultiObsSpots(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
76
|
+
export function useSpotMultiObsSets(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
72
77
|
export function useMultiObsLabels(coordinationScopes: any, obsType: any, loaders: any, dataset: any): any[];
|
|
78
|
+
export function useMultiObsSegmentations(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
79
|
+
export function useMultiImages(coordinationScopes: any, coordinationScopesBy: any, loaders: any, dataset: any): any[];
|
|
73
80
|
//# sourceMappingURL=data-hooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-hooks.d.ts","sourceRoot":"","sources":["../src/data-hooks.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"data-hooks.d.ts","sourceRoot":"","sources":["../src/data-hooks.js"],"names":[],"mappings":"AAmBA;;;;;;;;GAQG;AACH,wCAPW,MAAM,WAEN,MAAM,SAsBhB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,6CAhBW,MAAM,WAEN,MAAM,cAEN,OAAO,uBAEP,MAAM,6BAGN,MAAM,uBAgBhB;AAED,4JASC;AAED,6JASC;AAED,gKASC;AAED,6JASC;AAED,oKASC;AAED,2JASC;AAED,oKASC;AAED,iKASC;AAED,yJASC;AAED,mKASC;AAED,iKASC;AAED;;;;;;;;;;;;;GAaG;AACH,6CAVW,MAAM,WAEN,MAAM,cAEN,OAAO,aAEP,OAAO,uBA4EjB;AAED;;;;;;;;;;;;;GAaG;AACH,oDARW,MAAM,WAEN,MAAM,cAEN,OAAO,iBAEL,MAAM,CA2ElB;AAED,yHAsBC;AAED,wHAsBC;AAED,2HAsBC;AAED,4GAmBC;AAED,gIA0BC;AAED,sHAwBC"}
|
package/dist-tsc/data-hooks.js
CHANGED
|
@@ -2,7 +2,7 @@ import { useState, useEffect, useMemo } from 'react';
|
|
|
2
2
|
import { CoordinationType, DataType, STATUS } from '@vitessce/constants-internal';
|
|
3
3
|
import { fromEntries } from '@vitessce/utils';
|
|
4
4
|
import { useQuery, useQueries } from '@tanstack/react-query';
|
|
5
|
-
import {
|
|
5
|
+
import { useMultiCoordinationValues, useComplexCoordination, useSetWarning, getMatchingLoader, } from './state/hooks.js';
|
|
6
6
|
import { LoaderNotFoundError, } from './errors/index.js';
|
|
7
7
|
import { warn, useDataType, useDataTypeMulti, } from './data-hook-utils.js';
|
|
8
8
|
/**
|
|
@@ -54,6 +54,12 @@ export function useDescription(loaders, dataset) {
|
|
|
54
54
|
export function useObsEmbeddingData(loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
|
|
55
55
|
return useDataType(DataType.OBS_EMBEDDING, loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
|
|
56
56
|
}
|
|
57
|
+
export function useObsSpotsData(loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
|
|
58
|
+
return useDataType(DataType.OBS_SPOTS, loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
|
|
59
|
+
}
|
|
60
|
+
export function useObsPointsData(loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
|
|
61
|
+
return useDataType(DataType.OBS_POINTS, loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
|
|
62
|
+
}
|
|
57
63
|
export function useObsLocationsData(loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
|
|
58
64
|
return useDataType(DataType.OBS_LOCATIONS, loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn);
|
|
59
65
|
}
|
|
@@ -113,7 +119,7 @@ export function useFeatureSelection(loaders, dataset, isRequired, selection, mat
|
|
|
113
119
|
if (!payload)
|
|
114
120
|
return null;
|
|
115
121
|
const { data } = payload;
|
|
116
|
-
return { data: data[0], dataKey:
|
|
122
|
+
return { data: data[0], dataKey: featureId };
|
|
117
123
|
}
|
|
118
124
|
// Loader does not implement loadGeneSelection.
|
|
119
125
|
const payload = await loader.load();
|
|
@@ -184,7 +190,9 @@ export function useObsFeatureMatrixIndices(loaders, dataset, isRequired, matchOn
|
|
|
184
190
|
placeholderData: placeholderObject,
|
|
185
191
|
// Include the hook name in the queryKey to prevent the case in which an identical queryKey
|
|
186
192
|
// in a different hook would cause an accidental cache hit.
|
|
187
|
-
|
|
193
|
+
// Note: this uses the same key structure/suffix as
|
|
194
|
+
// getMatrixIndicesQueryKeyScopeTuplesAux for shared caching.
|
|
195
|
+
queryKey: [dataset, DataType.OBS_FEATURE_MATRIX, matchOn, isRequired, 'useObsFeatureMatrixIndices'],
|
|
188
196
|
// Query function should return an object
|
|
189
197
|
// { data, dataKey } where dataKey is the loaded gene selection.
|
|
190
198
|
// TODO: use TypeScript to type the return value?
|
|
@@ -242,13 +250,74 @@ export function useObsFeatureMatrixIndices(loaders, dataset, isRequired, matchOn
|
|
|
242
250
|
}, [error, setWarning]);
|
|
243
251
|
return [loadedData, dataStatus, urls];
|
|
244
252
|
}
|
|
253
|
+
export function useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
254
|
+
const obsTypeCoordination = useComplexCoordination([
|
|
255
|
+
CoordinationType.OBS_TYPE,
|
|
256
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.POINT_LAYER);
|
|
257
|
+
const matchOnObj = useMemo(() => obsTypeCoordination[0],
|
|
258
|
+
// imageCoordination reference changes each render,
|
|
259
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
260
|
+
// indirect dependencies here.
|
|
261
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
262
|
+
const [obsPointsData, obsPointsDataStatus, obsPointsUrls] = useDataTypeMulti(DataType.OBS_POINTS, loaders, dataset, false, {}, {}, matchOnObj);
|
|
263
|
+
return [obsPointsData, obsPointsDataStatus, obsPointsUrls];
|
|
264
|
+
}
|
|
265
|
+
export function useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
266
|
+
const obsTypeCoordination = useComplexCoordination([
|
|
267
|
+
CoordinationType.OBS_TYPE,
|
|
268
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SPOT_LAYER);
|
|
269
|
+
const matchOnObj = useMemo(() => obsTypeCoordination[0],
|
|
270
|
+
// imageCoordination reference changes each render,
|
|
271
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
272
|
+
// indirect dependencies here.
|
|
273
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
274
|
+
const [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls] = useDataTypeMulti(DataType.OBS_SPOTS, loaders, dataset, false, {}, {}, matchOnObj);
|
|
275
|
+
return [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls];
|
|
276
|
+
}
|
|
277
|
+
export function useSpotMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
278
|
+
const obsTypeCoordination = useComplexCoordination([
|
|
279
|
+
CoordinationType.OBS_TYPE,
|
|
280
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SPOT_LAYER);
|
|
281
|
+
const matchOnObj = useMemo(() => obsTypeCoordination[0],
|
|
282
|
+
// imageCoordination reference changes each render,
|
|
283
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
284
|
+
// indirect dependencies here.
|
|
285
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
286
|
+
const [obsSetsData, obsSetsDataStatus, obsSetsUrls] = useDataTypeMulti(DataType.OBS_SETS, loaders, dataset, false, {}, {}, matchOnObj);
|
|
287
|
+
return [obsSetsData, obsSetsDataStatus, obsSetsUrls];
|
|
288
|
+
}
|
|
245
289
|
export function useMultiObsLabels(coordinationScopes, obsType, loaders, dataset) {
|
|
246
290
|
const obsLabelsTypes = useMultiCoordinationValues(CoordinationType.OBS_LABELS_TYPE, coordinationScopes);
|
|
247
291
|
const obsLabelsMatchOnObj = useMemo(() => fromEntries(Object.entries(obsLabelsTypes).map(([scope, obsLabelsType]) => ([
|
|
248
292
|
scope,
|
|
249
293
|
{ obsLabelsType, obsType },
|
|
250
294
|
]))), [obsLabelsTypes, obsType]);
|
|
251
|
-
const [obsLabelsData, obsLabelsDataStatus] = useDataTypeMulti(DataType.OBS_LABELS, loaders, dataset, false, {}, {}, obsLabelsMatchOnObj);
|
|
252
|
-
|
|
253
|
-
|
|
295
|
+
const [obsLabelsData, obsLabelsDataStatus, obsLabelsUrls] = useDataTypeMulti(DataType.OBS_LABELS, loaders, dataset, false, {}, {}, obsLabelsMatchOnObj);
|
|
296
|
+
return [obsLabelsTypes, obsLabelsData, obsLabelsDataStatus, obsLabelsUrls];
|
|
297
|
+
}
|
|
298
|
+
export function useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
299
|
+
const imageCoordination = useComplexCoordination([
|
|
300
|
+
CoordinationType.FILE_UID,
|
|
301
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.SEGMENTATION_LAYER);
|
|
302
|
+
const matchOnObj = useMemo(() => imageCoordination[0],
|
|
303
|
+
// imageCoordination reference changes each render,
|
|
304
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
305
|
+
// indirect dependencies here.
|
|
306
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
307
|
+
const [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls,] = useDataTypeMulti(DataType.OBS_SEGMENTATIONS, loaders, dataset, false, {}, {}, matchOnObj);
|
|
308
|
+
return [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls];
|
|
309
|
+
}
|
|
310
|
+
export function useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
311
|
+
// TODO: delegate the generation of matchOnObj to a different hoook and pass as a parameter?
|
|
312
|
+
// (in all of the useMulti data hooks)?
|
|
313
|
+
const imageCoordination = useComplexCoordination([
|
|
314
|
+
CoordinationType.FILE_UID,
|
|
315
|
+
], coordinationScopes, coordinationScopesBy, CoordinationType.IMAGE_LAYER);
|
|
316
|
+
const matchOnObj = useMemo(() => imageCoordination[0],
|
|
317
|
+
// imageCoordination reference changes each render,
|
|
318
|
+
// use coordinationScopes and coordinationScopesBy which are
|
|
319
|
+
// indirect dependencies here.
|
|
320
|
+
[coordinationScopes, coordinationScopesBy]);
|
|
321
|
+
const [imageData, imageDataStatus, imageUrls] = useDataTypeMulti(DataType.IMAGE, loaders, dataset, false, {}, {}, matchOnObj);
|
|
322
|
+
return [imageData, imageDataStatus, imageUrls];
|
|
254
323
|
}
|
package/dist-tsc/hooks.js
CHANGED
|
@@ -125,7 +125,7 @@ export function useReady(statusValues) {
|
|
|
125
125
|
*/
|
|
126
126
|
export function useUrls(urls) {
|
|
127
127
|
const mergedUrls = useMemo(() => urls.filter(a => Array.isArray(a)).flat().filter((url, index, array) => {
|
|
128
|
-
const firstIndex = array.findIndex(u => u.name === url.name);
|
|
128
|
+
const firstIndex = array.findIndex(u => u && url && u.name === url.name);
|
|
129
129
|
return index === firstIndex;
|
|
130
130
|
}),
|
|
131
131
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
package/dist-tsc/index.d.ts
CHANGED
|
@@ -4,8 +4,9 @@ export { PopperMenu } from "./shared-mui/components.js";
|
|
|
4
4
|
export { useHasLoader } from "./data-hook-utils.js";
|
|
5
5
|
export { logConfig } from "./view-config-utils.js";
|
|
6
6
|
export { useReady, useUrls, useVitessceContainer, useDeckCanvasSize, useUint8ObsFeatureMatrix, useUint8FeatureSelection, useExpressionValueGetter, useGetObsMembership, useGetObsInfo, useClosestVitessceContainerSize, useWindowDimensions, useGridItemSize } from "./hooks.js";
|
|
7
|
-
export { useInitialCoordination, useCoordination, useComplexCoordination, useMultiCoordinationValues, useMultiDatasetCoordination, useDatasetUids, useLoaders, useMatchingLoader, useViewConfigStore, useViewConfigStoreApi, useComponentHover, useSetComponentHover, useComponentViewInfo, useSetComponentViewInfo, useWarning, useSetWarning, useAuxiliaryCoordination, useComponentLayout } from "./state/hooks.js";
|
|
8
|
-
export { useDescription, useImageData, useObsSetsData, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useMultiObsLabels, useObsLocationsData, useObsSegmentationsData, useNeighborhoodsData, useObsLabelsData, useObsFeatureMatrixData, useFeatureLabelsData, useGenomicProfilesData } from "./data-hooks.js";
|
|
7
|
+
export { useCoordinationScopes, useCoordinationScopesBy, useInitialCoordination, useCoordination, useComplexCoordination, useComplexCoordinationSecondary, useMultiCoordinationScopes, useMultiCoordinationScopesNonNull, useMultiCoordinationScopesSecondary, useMultiCoordinationScopesSecondaryNonNull, useMultiCoordinationValues, useMultiDatasetCoordination, useDatasetUids, useLoaders, useMatchingLoader, useViewConfigStore, useViewConfigStoreApi, useComponentHover, useSetComponentHover, useComponentViewInfo, useSetComponentViewInfo, useWarning, useSetWarning, useAuxiliaryCoordination, useComponentLayout, useRemoveImageChannelInMetaCoordinationScopes, useAddImageChannelInMetaCoordinationScopes } from "./state/hooks.js";
|
|
8
|
+
export { useDescription, useImageData, useObsSetsData, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useMultiObsLabels, useMultiObsSpots, useMultiObsPoints, useSpotMultiObsSets, useMultiObsSegmentations, useMultiImages, useObsSpotsData, useObsPointsData, useObsLocationsData, useObsSegmentationsData, useNeighborhoodsData, useObsLabelsData, useObsFeatureMatrixData, useFeatureLabelsData, useGenomicProfilesData } from "./data-hooks.js";
|
|
9
|
+
export { usePointMultiObsLabels, useSpotMultiFeatureSelection, useSpotMultiObsFeatureMatrixIndices, useSegmentationMultiFeatureSelection, useSegmentationMultiObsFeatureMatrixIndices, useSegmentationMultiObsLocations, useSegmentationMultiObsSets } from "./data-hooks-multilevel.js";
|
|
9
10
|
export { AbstractLoader, AbstractTwoStepLoader, LoaderResult } from "./data/index.js";
|
|
10
11
|
export { AbstractLoaderError, DatasetNotFoundError, LoaderNotFoundError, LoaderValidationError, DataSourceFetchError } from "./errors/index.js";
|
|
11
12
|
export { CellColorEncodingOption, OptionsContainer, OptionSelect, usePlotOptionsStyles } from "./shared-plot-options/index.js";
|
package/dist-tsc/index.js
CHANGED
|
@@ -3,8 +3,9 @@ export { TitleInfo } from './TitleInfo.js';
|
|
|
3
3
|
export { PopperMenu } from './shared-mui/components.js';
|
|
4
4
|
// For plugin view types:
|
|
5
5
|
export { useReady, useUrls, useVitessceContainer, useDeckCanvasSize, useUint8ObsFeatureMatrix, useUint8FeatureSelection, useExpressionValueGetter, useGetObsMembership, useGetObsInfo, useClosestVitessceContainerSize, useWindowDimensions, useGridItemSize, } from './hooks.js';
|
|
6
|
-
export { useInitialCoordination, useCoordination, useComplexCoordination, useMultiCoordinationValues, useMultiDatasetCoordination, useDatasetUids, useLoaders, useMatchingLoader, useViewConfigStore, useViewConfigStoreApi, useComponentHover, useSetComponentHover, useComponentViewInfo, useSetComponentViewInfo, useWarning, useSetWarning, useAuxiliaryCoordination, useComponentLayout, } from './state/hooks.js';
|
|
7
|
-
export { useDescription, useImageData, useObsSetsData, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useMultiObsLabels, useObsLocationsData, useObsSegmentationsData, useNeighborhoodsData, useObsLabelsData, useObsFeatureMatrixData, useFeatureLabelsData, useGenomicProfilesData, } from './data-hooks.js';
|
|
6
|
+
export { useCoordinationScopes, useCoordinationScopesBy, useInitialCoordination, useCoordination, useComplexCoordination, useComplexCoordinationSecondary, useMultiCoordinationScopes, useMultiCoordinationScopesNonNull, useMultiCoordinationScopesSecondary, useMultiCoordinationScopesSecondaryNonNull, useMultiCoordinationValues, useMultiDatasetCoordination, useDatasetUids, useLoaders, useMatchingLoader, useViewConfigStore, useViewConfigStoreApi, useComponentHover, useSetComponentHover, useComponentViewInfo, useSetComponentViewInfo, useWarning, useSetWarning, useAuxiliaryCoordination, useComponentLayout, useRemoveImageChannelInMetaCoordinationScopes, useAddImageChannelInMetaCoordinationScopes, } from './state/hooks.js';
|
|
7
|
+
export { useDescription, useImageData, useObsSetsData, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useMultiObsLabels, useMultiObsSpots, useMultiObsPoints, useSpotMultiObsSets, useMultiObsSegmentations, useMultiImages, useObsSpotsData, useObsPointsData, useObsLocationsData, useObsSegmentationsData, useNeighborhoodsData, useObsLabelsData, useObsFeatureMatrixData, useFeatureLabelsData, useGenomicProfilesData, } from './data-hooks.js';
|
|
8
|
+
export { usePointMultiObsLabels, useSpotMultiFeatureSelection, useSpotMultiObsFeatureMatrixIndices, useSegmentationMultiFeatureSelection, useSegmentationMultiObsFeatureMatrixIndices, useSegmentationMultiObsLocations, useSegmentationMultiObsSets, } from './data-hooks-multilevel.js';
|
|
8
9
|
export { useHasLoader, } from './data-hook-utils.js';
|
|
9
10
|
export { AbstractLoader, AbstractTwoStepLoader, LoaderResult, } from './data/index.js';
|
|
10
11
|
export { AbstractLoaderError, DatasetNotFoundError, LoaderNotFoundError, LoaderValidationError, DataSourceFetchError, } from './errors/index.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/shared-mui/components.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/shared-mui/components.js"],"names":[],"mappings":"AAyBA,oDA+DC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React, { useRef } from 'react';
|
|
3
3
|
import { makeStyles, Paper, Popper, IconButton, MenuList, ClickAwayListener, Fade, } from '@material-ui/core';
|
|
4
|
+
import clsx from 'clsx';
|
|
4
5
|
import { useVitessceContainer } from '../hooks.js';
|
|
5
6
|
const useStyles = makeStyles(() => ({
|
|
6
7
|
paper: {
|
|
@@ -14,7 +15,7 @@ const useStyles = makeStyles(() => ({
|
|
|
14
15
|
},
|
|
15
16
|
}));
|
|
16
17
|
export function PopperMenu(props) {
|
|
17
|
-
const { buttonIcon, open, setOpen, children, buttonClassName, placement = 'bottom-end', 'aria-label': ariaLabel, } = props;
|
|
18
|
+
const { buttonIcon, open, setOpen, children, buttonClassName, placement = 'bottom-end', withPaper = true, containerClassName, 'aria-label': ariaLabel, } = props;
|
|
18
19
|
const classes = useStyles();
|
|
19
20
|
const anchorRef = useRef();
|
|
20
21
|
const handleClick = () => {
|
|
@@ -25,5 +26,5 @@ export function PopperMenu(props) {
|
|
|
25
26
|
};
|
|
26
27
|
const id = open ? 'v-popover-menu' : undefined;
|
|
27
28
|
const getTooltipContainer = useVitessceContainer(anchorRef);
|
|
28
|
-
return (_jsxs("div", { ref: anchorRef, className: classes.container, children: [_jsx(IconButton, { "aria-describedby": id, onClick: handleClick, onTouchEnd: handleClick, size: "small", className: buttonClassName, "aria-label": ariaLabel, children: buttonIcon }), _jsx(Popper, { id: id, open: open, anchorEl: anchorRef && anchorRef.current, container: getTooltipContainer, onClose: handleClose, placement: placement, transition: true, children: ({ TransitionProps }) => (_jsx(ClickAwayListener, { onClickAway: handleClose, children: _jsx(Fade, { ...TransitionProps, timeout: 100, children: _jsx(Paper, { elevation: 4, className: classes.paper, children: _jsx(MenuList, { children: children }) }) }) })) })] }));
|
|
29
|
+
return (_jsxs("div", { ref: anchorRef, className: clsx(classes.container, containerClassName), children: [_jsx(IconButton, { "aria-describedby": id, onClick: handleClick, onTouchEnd: handleClick, size: "small", className: buttonClassName, "aria-label": ariaLabel, children: buttonIcon }), _jsx(Popper, { id: id, open: open, anchorEl: anchorRef && anchorRef.current, container: getTooltipContainer, onClose: handleClose, placement: placement, transition: true, children: ({ TransitionProps }) => (_jsx(ClickAwayListener, { onClickAway: handleClose, children: _jsx(Fade, { ...TransitionProps, timeout: 100, children: withPaper ? (_jsx(Paper, { elevation: 4, className: classes.paper, children: _jsx(MenuList, { children: children }) })) : children }) })) })] }));
|
|
29
30
|
}
|
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the "computed" coordinationScopes after accounting for
|
|
3
|
+
* meta-coordination.
|
|
4
|
+
* @param {*} coordinationScopes The coordinationScopes for a view.
|
|
5
|
+
* @param {*} coordinationSpace The coordinationSpace for a config.
|
|
6
|
+
* @returns {string|undefined} The coordinationScopesBy after meta-coordination.
|
|
7
|
+
*/
|
|
8
|
+
export function getScopes(coordinationScopes: any, metaSpace: any): string | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Get the "computed" coordinationScopesBy after accounting for
|
|
11
|
+
* meta-coordination.
|
|
12
|
+
* @param {*} coordinationScopes The coordinationScopes for a view.
|
|
13
|
+
* @param {*} coordinationScopesBy The coordinationScopesBy for a view.
|
|
14
|
+
* @param {*} coordinationSpace The coordinationSpace for a config.
|
|
15
|
+
* @returns {string|undefined} The coordinationScopesBy after meta-coordination.
|
|
16
|
+
*/
|
|
17
|
+
export function getScopesBy(coordinationScopes: any, coordinationScopesBy: any, metaSpaceBy: any): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Get the matching parameter scope.
|
|
20
|
+
* @param {string} parameter A coordination type.
|
|
21
|
+
* @param {*} coordinationScopes The coordinationScopes for a view.
|
|
22
|
+
* @returns {string|undefined} The coordination scope that matches.
|
|
23
|
+
*/
|
|
24
|
+
export function getParameterScope(parameter: string, coordinationScopes: any): string | undefined;
|
|
25
|
+
/**
|
|
26
|
+
* Get the matching parameter scope.
|
|
27
|
+
* @param {string} parameter A coordination type.
|
|
28
|
+
* @param {*} coordinationScopes The coordinationScopes for a view.
|
|
29
|
+
* @param {*} coordinationScopesBy The coordinationScopesBy for a view.
|
|
30
|
+
* @returns {string|undefined} The coordination scope that matches.
|
|
31
|
+
*/
|
|
32
|
+
export function getParameterScopeBy(parameter: string, byType: any, typeScope: any, coordinationScopes: any, coordinationScopesBy: any): string | undefined;
|
|
1
33
|
/**
|
|
2
34
|
* This hook uses the same logic as for the `values` part of
|
|
3
35
|
* the useCoordination hook, with the difference that it
|
|
@@ -26,6 +58,10 @@ export function useInitialCoordination(parameters: string[], coordinationScopes:
|
|
|
26
58
|
* prefix.
|
|
27
59
|
*/
|
|
28
60
|
export function useCoordination(parameters: string[], coordinationScopes: object): array;
|
|
61
|
+
export function useMultiCoordinationScopes(parameter: any, coordinationScopes: any): any;
|
|
62
|
+
export function useMultiCoordinationScopesNonNull(parameter: any, coordinationScopes: any): any;
|
|
63
|
+
export function useMultiCoordinationScopesSecondary(parameter: any, byType: any, coordinationScopes: any, coordinationScopesBy: any): any;
|
|
64
|
+
export function useMultiCoordinationScopesSecondaryNonNull(parameter: any, byType: any, coordinationScopes: any, coordinationScopesBy: any): any;
|
|
29
65
|
export function useMultiCoordinationValues(parameter: any, coordinationScopes: any): any;
|
|
30
66
|
/**
|
|
31
67
|
* Get a mapping from dataset coordination scopes to dataset UIDs.
|
|
@@ -48,6 +84,30 @@ export function useDatasetUids(coordinationScopes: object): object;
|
|
|
48
84
|
* setter functions.
|
|
49
85
|
*/
|
|
50
86
|
export function useComplexCoordination(parameters: string[], coordinationScopes: object, coordinationScopesBy: object, byType: string): array;
|
|
87
|
+
/**
|
|
88
|
+
* Get the "computed" (i.e., after accounting for meta-coordination)
|
|
89
|
+
* value for coordinationScopes.
|
|
90
|
+
* @param {object} coordinationScopes The original coordinationScopes passed to the view.
|
|
91
|
+
* @returns {object} The coordinationScopes after filling in with meta-coordinationScopes.
|
|
92
|
+
*/
|
|
93
|
+
export function useCoordinationScopes(coordinationScopes: object): object;
|
|
94
|
+
/**
|
|
95
|
+
* Get the "computed" (i.e., after accounting for meta-coordination)
|
|
96
|
+
* value for coordinationScopesBy.
|
|
97
|
+
* @param {object} coordinationScopes The original coordinationScopes passed to the view.
|
|
98
|
+
* @param {object} coordinationScopesBy The original coordinationScopesBy passed to the view.
|
|
99
|
+
* @returns {object} The coordinationScopesBy after filling in with meta-coordinationScopesBy.
|
|
100
|
+
*/
|
|
101
|
+
export function useCoordinationScopesBy(coordinationScopes: object, coordinationScopesBy: object): object;
|
|
102
|
+
/**
|
|
103
|
+
* Use a second level of complex coordination.
|
|
104
|
+
* @param {string[]} parameters Array of coordination types.
|
|
105
|
+
* @param {object} coordinationScopesBy The coordinationScopesBy object from the view definition.
|
|
106
|
+
* @param {string} primaryType The first-level coordination type, such as spatialImageLayer.
|
|
107
|
+
* @param {string} secondaryType The second-level coordination type, such as spatialImageChannel.
|
|
108
|
+
* @returns The results of useComplexCoordination.
|
|
109
|
+
*/
|
|
110
|
+
export function useComplexCoordinationSecondary(parameters: string[], coordinationScopes: any, coordinationScopesBy: object, primaryType: string, secondaryType: string): any[];
|
|
51
111
|
/**
|
|
52
112
|
* Use coordination values and coordination setter functions corresponding to
|
|
53
113
|
* dataset-specific coordination scopes for each coordination type.
|
|
@@ -113,21 +173,6 @@ export function getMatchingLoader(loaders: object, dataset: string, dataType: st
|
|
|
113
173
|
* @returns The matching loader instance or `null`.
|
|
114
174
|
*/
|
|
115
175
|
export function useMatchingLoader(loaders: object, dataset: string, dataType: string, viewCoordinationValues: object): any;
|
|
116
|
-
/**
|
|
117
|
-
* Find a specific loader instance for a particular dataset, data type, and view
|
|
118
|
-
* coordination values (mapping from coordination types to coordination values).
|
|
119
|
-
* Uses lodash/isMatch to perform matching against the file definition's
|
|
120
|
-
* coordination value mapping.
|
|
121
|
-
* TODO: can this function be removed?
|
|
122
|
-
* @param {object} loaders The value returned by useLoaders.
|
|
123
|
-
* @param {string} dataset The dataset UID.
|
|
124
|
-
* @param {string} dataType The data type for the matching file.
|
|
125
|
-
* @param {object} viewCoordinationValues Current coordination values
|
|
126
|
-
* from the view. Match these against a subset of file definition coordination
|
|
127
|
-
* values.
|
|
128
|
-
* @returns The matching loader instance or `null`.
|
|
129
|
-
*/
|
|
130
|
-
export function useMatchingLoaders(loaders: object, dataset: string, dataType: string, viewCoordinationValuesObj: any): any;
|
|
131
176
|
/**
|
|
132
177
|
* Obtain the view config layout array from
|
|
133
178
|
* the global app state.
|
|
@@ -142,6 +187,20 @@ export function useLayout(): object[];
|
|
|
142
187
|
* in the `useViewInfoStore` store.
|
|
143
188
|
*/
|
|
144
189
|
export function useRemoveComponent(): Function;
|
|
190
|
+
/**
|
|
191
|
+
* Obtain the component removal function from
|
|
192
|
+
* the global app state.
|
|
193
|
+
* @returns {function} The remove component function
|
|
194
|
+
* in the `useViewInfoStore` store.
|
|
195
|
+
*/
|
|
196
|
+
export function useRemoveImageChannelInMetaCoordinationScopes(): Function;
|
|
197
|
+
/**
|
|
198
|
+
* Obtain the component removal function from
|
|
199
|
+
* the global app state.
|
|
200
|
+
* @returns {function} The remove component function
|
|
201
|
+
* in the `useViewInfoStore` store.
|
|
202
|
+
*/
|
|
203
|
+
export function useAddImageChannelInMetaCoordinationScopes(): Function;
|
|
145
204
|
/**
|
|
146
205
|
* Obtain the component prop setter function from
|
|
147
206
|
* the global app state.
|
|
@@ -221,9 +280,9 @@ export function useEmitGridResize(): Function;
|
|
|
221
280
|
export const ViewConfigProvider: ({ initialStore, createStore, children, }: {
|
|
222
281
|
initialStore?: import("zustand").UseBoundStore<object, import("zustand").StoreApi<object>> | undefined;
|
|
223
282
|
createStore: () => import("zustand").UseBoundStore<object, import("zustand").StoreApi<object>>;
|
|
224
|
-
children: import("../../../plugins/node_modules/@types/react/ts5.0").ReactNode;
|
|
225
|
-
}) => import("../../../plugins/node_modules/@types/react/ts5.0").FunctionComponentElement<import("../../../plugins/node_modules/@types/react/ts5.0").ProviderProps<import("zustand").UseBoundStore<object, import("zustand").StoreApi<object>> | undefined>>;
|
|
226
|
-
export const useViewConfigStore: import("zustand/context").UseContextStore<object>;
|
|
283
|
+
children: import("../../../plugins/node_modules/@types/react/ts5.0/index.js").ReactNode;
|
|
284
|
+
}) => import("../../../plugins/node_modules/@types/react/ts5.0/index.js").FunctionComponentElement<import("../../../plugins/node_modules/@types/react/ts5.0/index.js").ProviderProps<import("zustand").UseBoundStore<object, import("zustand").StoreApi<object>> | undefined>>;
|
|
285
|
+
export const useViewConfigStore: import("zustand/context.js").UseContextStore<object>;
|
|
227
286
|
export const useViewConfigStoreApi: () => {
|
|
228
287
|
getState: import("zustand").GetState<object>;
|
|
229
288
|
setState: import("zustand").SetState<object>;
|
|
@@ -233,9 +292,9 @@ export const useViewConfigStoreApi: () => {
|
|
|
233
292
|
export const AuxiliaryProvider: ({ initialStore, createStore, children, }: {
|
|
234
293
|
initialStore?: import("zustand").UseBoundStore<object, import("zustand").StoreApi<object>> | undefined;
|
|
235
294
|
createStore: () => import("zustand").UseBoundStore<object, import("zustand").StoreApi<object>>;
|
|
236
|
-
children: import("../../../plugins/node_modules/@types/react/ts5.0").ReactNode;
|
|
237
|
-
}) => import("../../../plugins/node_modules/@types/react/ts5.0").FunctionComponentElement<import("../../../plugins/node_modules/@types/react/ts5.0").ProviderProps<import("zustand").UseBoundStore<object, import("zustand").StoreApi<object>> | undefined>>;
|
|
238
|
-
export const useAuxiliaryStore: import("zustand/context").UseContextStore<object>;
|
|
295
|
+
children: import("../../../plugins/node_modules/@types/react/ts5.0/index.js").ReactNode;
|
|
296
|
+
}) => import("../../../plugins/node_modules/@types/react/ts5.0/index.js").FunctionComponentElement<import("../../../plugins/node_modules/@types/react/ts5.0/index.js").ProviderProps<import("zustand").UseBoundStore<object, import("zustand").StoreApi<object>> | undefined>>;
|
|
297
|
+
export const useAuxiliaryStore: import("zustand/context.js").UseContextStore<object>;
|
|
239
298
|
export function createViewConfigStore(initialLoaders: any, initialConfig: any): Function;
|
|
240
299
|
export function useComponentLayout(component: any, scopes: any, coordinationScopes: any): Object;
|
|
241
300
|
export function createAuxiliaryStore(): Function;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/state/hooks.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/state/hooks.js"],"names":[],"mappings":"AAkCA;;;;;;GAMG;AACH,oEAFa,MAAM,GAAC,SAAS,CAoB5B;AAED;;;;;;;GAOG;AACH,mGAFa,MAAM,GAAC,SAAS,CAoB5B;AAED;;;;;GAKG;AACH,6CAJW,MAAM,4BAEJ,MAAM,GAAC,SAAS,CAI5B;AAED;;;;;;GAMG;AACH,+CALW,MAAM,oFAGJ,MAAM,GAAC,SAAS,CAc5B;AA2MD;;;;;;;;;GASG;AACH,mDALW,MAAM,EAAE,sBACR,MAAM,GAEJ,MAAM,CAclB;AAED;;;;;;;;;;;;;;;GAeG;AACH,4CATW,MAAM,EAAE,sBACR,MAAM,SAqChB;AAED,yFAKC;AAED,gGAqBC;AAED,0IA4BC;AAED,iJAkEC;AAED,yFAmBC;AAED;;;;GAIG;AACH,mDAHW,MAAM,GACJ,MAAM,CAIlB;AAED;;;;;;;;;;;;;GAaG;AACH,mDAXW,MAAM,EAAE,sBACR,MAAM,wBACN,MAAM,UAEN,MAAM,SA6EhB;AAED;;;;;GAKG;AACH,0DAHW,MAAM,GACJ,MAAM,CAiBlB;AAED;;;;;;GAMG;AACH,4DAJW,MAAM,wBACN,MAAM,GACJ,MAAM,CAgBlB;AAED;;;;;;;GAOG;AACH,4DANW,MAAM,EAAE,iDACR,MAAM,eACN,MAAM,iBACN,MAAM,SAuEhB;AAGD;;;;;;;;;;;GAWG;AACH,wDATW,MAAM,EAAE,sBACR,MAAM,wBACN,MAAM,SAYhB;AA6BD;;;;;;;;;;;;;;;GAeG;AACH,qDATW,MAAM,EAAE,sBACR,MAAM,SAkChB;AAED;;;;;GAKG;AACH,8BAHa,MAAM,CAKlB;AAGD;;;;;;;;;;;;GAYG;AACH,2CARW,MAAM,WACN,MAAM,YACN,MAAM,0BACN,MAAM,OAoBhB;AAED;;;;;;;;;;;;GAYG;AACH,2CARW,MAAM,WACN,MAAM,YACN,MAAM,0BACN,MAAM,OAShB;AAED;;;;;GAKG;AACH,6BAHa,MAAM,EAAE,CAKpB;AAED;;;;;GAKG;AACH,+CAEC;AAED;;;;;GAKG;AACH,0EAEC;AAED;;;;;GAKG;AACH,uEAEC;AAED;;;;;GAKG;AACH,4CAEC;AAED;;;;;GAKG;AACH,0CAEC;AAED;;;;;GAKG;AACH,oEAIC;AAED;;;;;GAKG;AACH,qCAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,iDAEC;AAED;;;;;GAKG;AACH,8BAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,0CAEC;AAED;;;;;GAKG;AACH,iDAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,6DAOC;AAED;;;;GAIG;AACH,iCAFa,MAAM,CAIlB;AAED;;;;;GAKG;AACH,8CAEC;AAnhCD;;;;+QAA0D;AAC1D,sFAA0D;AAC1D;;;;;EAAgE;AAOhE;;;;+QAAwD;AACxD,qFAAwD;AAmGjD,yFA8FJ;AAOI,0FAFM,MAAM,CAOlB;AAcM,iDAUJ"}
|