@vitessce/vit-s 3.5.1 → 3.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/index.js +309 -502
  2. package/dist-tsc/VitessceGrid.d.ts.map +1 -1
  3. package/dist-tsc/VitessceGrid.js +1 -1
  4. package/dist-tsc/data-hook-utils.d.ts +1 -1
  5. package/dist-tsc/data-hook-utils.d.ts.map +1 -1
  6. package/dist-tsc/data-hook-utils.js +1 -1
  7. package/dist-tsc/data-hooks-multilevel-utils.js +1 -1
  8. package/dist-tsc/data-hooks.js +1 -1
  9. package/dist-tsc/hooks.d.ts +14 -0
  10. package/dist-tsc/hooks.d.ts.map +1 -1
  11. package/dist-tsc/hooks.js +39 -1
  12. package/dist-tsc/index.d.ts +2 -3
  13. package/dist-tsc/index.js +2 -3
  14. package/dist-tsc/state/hooks.d.ts.map +1 -1
  15. package/dist-tsc/state/hooks.js +14 -2
  16. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.d.ts.map +1 -1
  17. package/dist-tsc/vitessce-grid-layout/VitessceGridLayout.js +7 -3
  18. package/dist-tsc/vitessce-grid-utils.js +1 -1
  19. package/package.json +9 -8
  20. package/src/VitessceGrid.js +3 -0
  21. package/src/data-hook-utils.js +4 -4
  22. package/src/data-hooks-multilevel-utils.js +3 -3
  23. package/src/data-hooks.js +3 -3
  24. package/src/hooks.js +43 -1
  25. package/src/index.js +2 -12
  26. package/src/state/hooks.js +15 -2
  27. package/src/vitessce-grid-layout/VitessceGridLayout.js +18 -7
  28. package/src/vitessce-grid-utils.js +1 -1
  29. package/dist-tsc/data/AbstractLoader.d.ts +0 -28
  30. package/dist-tsc/data/AbstractLoader.d.ts.map +0 -1
  31. package/dist-tsc/data/AbstractLoader.js +0 -29
  32. package/dist-tsc/data/AbstractTwoStepLoader.d.ts +0 -16
  33. package/dist-tsc/data/AbstractTwoStepLoader.d.ts.map +0 -1
  34. package/dist-tsc/data/AbstractTwoStepLoader.js +0 -17
  35. package/dist-tsc/data/LoaderResult.d.ts +0 -17
  36. package/dist-tsc/data/LoaderResult.d.ts.map +0 -1
  37. package/dist-tsc/data/LoaderResult.js +0 -18
  38. package/dist-tsc/data/index.d.ts +0 -4
  39. package/dist-tsc/data/index.d.ts.map +0 -1
  40. package/dist-tsc/data/index.js +0 -3
  41. package/dist-tsc/data/loader-registry.d.ts +0 -9
  42. package/dist-tsc/data/loader-registry.d.ts.map +0 -1
  43. package/dist-tsc/data/loader-registry.js +0 -27
  44. package/dist-tsc/errors/AbstractLoaderError.d.ts +0 -10
  45. package/dist-tsc/errors/AbstractLoaderError.d.ts.map +0 -1
  46. package/dist-tsc/errors/AbstractLoaderError.js +0 -13
  47. package/dist-tsc/errors/DataSourceFetchError.d.ts +0 -8
  48. package/dist-tsc/errors/DataSourceFetchError.d.ts.map +0 -1
  49. package/dist-tsc/errors/DataSourceFetchError.js +0 -13
  50. package/dist-tsc/errors/DatasetNotFoundError.d.ts +0 -6
  51. package/dist-tsc/errors/DatasetNotFoundError.d.ts.map +0 -1
  52. package/dist-tsc/errors/DatasetNotFoundError.js +0 -17
  53. package/dist-tsc/errors/LoaderNotFoundError.d.ts +0 -10
  54. package/dist-tsc/errors/LoaderNotFoundError.d.ts.map +0 -1
  55. package/dist-tsc/errors/LoaderNotFoundError.js +0 -17
  56. package/dist-tsc/errors/LoaderValidationError.d.ts +0 -10
  57. package/dist-tsc/errors/LoaderValidationError.d.ts.map +0 -1
  58. package/dist-tsc/errors/LoaderValidationError.js +0 -15
  59. package/dist-tsc/errors/index.d.ts +0 -6
  60. package/dist-tsc/errors/index.d.ts.map +0 -1
  61. package/dist-tsc/errors/index.js +0 -5
  62. package/src/data/AbstractLoader.js +0 -41
  63. package/src/data/AbstractTwoStepLoader.js +0 -19
  64. package/src/data/LoaderResult.js +0 -19
  65. package/src/data/index.js +0 -3
  66. package/src/data/loader-registry.js +0 -28
  67. package/src/errors/AbstractLoaderError.js +0 -14
  68. package/src/errors/DataSourceFetchError.js +0 -15
  69. package/src/errors/DatasetNotFoundError.js +0 -23
  70. package/src/errors/LoaderNotFoundError.js +0 -24
  71. package/src/errors/LoaderValidationError.js +0 -23
  72. package/src/errors/index.js +0 -5
@@ -1 +1 @@
1
- {"version":3,"file":"VitessceGrid.d.ts","sourceRoot":"","sources":["../src/VitessceGrid.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;GAYG;AACH,4CAVG;IAAsB,SAAS,EAAvB,MAAM;IACQ,MAAM,EAApB,MAAM;IACQ,KAAK,EAAnB,MAAM;IACQ,MAAM,EAApB,MAAM;IACU,MAAM;IACE,SAAS,EAAjC,cAAc,EAAE;IACQ,SAAS,EAAjC,cAAc,EAAE;IACgB,iBAAiB,EAAjD,sBAAsB,EAAE;IACT,QAAQ,EAAvB,OAAO;CACjB,eAkGA"}
1
+ {"version":3,"file":"VitessceGrid.d.ts","sourceRoot":"","sources":["../src/VitessceGrid.js"],"names":[],"mappings":"AA4BA;;;;;;;;;;;;GAYG;AACH,4CAVG;IAAsB,SAAS,EAAvB,MAAM;IACQ,MAAM,EAApB,MAAM;IACQ,KAAK,EAAnB,MAAM;IACQ,MAAM,EAApB,MAAM;IACU,MAAM;IACE,SAAS,EAAjC,cAAc,EAAE;IACQ,SAAS,EAAjC,cAAc,EAAE;IACgB,iBAAiB,EAAjD,sBAAsB,EAAE;IACT,QAAQ,EAAvB,OAAO;CACjB,eAqGA"}
@@ -62,5 +62,5 @@ export default function VitessceGrid(props) {
62
62
  setLoaders(newLoaders);
63
63
  // eslint-disable-next-line react-hooks/exhaustive-deps
64
64
  }, [success, configKey]);
65
- return (_jsx("div", { ref: containerRef, className: clsx(VITESSCE_CONTAINER, classes.vitessceContainer), role: "group", "aria-label": altText, children: layout ? (_jsx(VitessceGridLayout, { pageMode: pageMode, role: "group", layout: layout, height: height, rowHeight: rowHeight, theme: theme, viewTypes: viewTypes, draggableHandle: titleClasses.title, margin: margin, padding: padding, onRemoveComponent: removeComponent, onLayoutChange: changeLayoutPostMount, isBounded: isBounded, onResize: onResize, onResizeStop: onResize, children: children })) : null }));
65
+ return (_jsx("div", { ref: containerRef, className: clsx(VITESSCE_CONTAINER, classes.vitessceContainer), role: "group", "aria-label": altText, children: layout ? (_jsx(VitessceGridLayout, { pageMode: pageMode, role: "group", layout: layout, height: height, rowHeight: rowHeight, theme: theme, viewTypes: viewTypes, fileTypes: fileTypes, coordinationTypes: coordinationTypes, stores: stores, draggableHandle: titleClasses.title, margin: margin, padding: padding, onRemoveComponent: removeComponent, onLayoutChange: changeLayoutPostMount, isBounded: isBounded, onResize: onResize, onResizeStop: onResize, children: children })) : null }));
66
66
  }
@@ -62,5 +62,5 @@ export function useDataType(dataType: any, loaders: object, dataset: string, isR
62
62
  */
63
63
  export function useDataTypeMulti(dataType: any, loaders: object, dataset: string, isRequired: boolean, coordinationSetters: object, initialCoordinationValues: object, matchOnObj: any, mergeCoordination: any, viewUid: any): array;
64
64
  export function useHasLoader(loaders: any, dataset: any, dataType: any, matchOn: any): boolean;
65
- import { AbstractLoaderError } from './errors/index.js';
65
+ import { AbstractLoaderError } from '@vitessce/abstract';
66
66
  //# sourceMappingURL=data-hook-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"data-hook-utils.d.ts","sourceRoot":"","sources":["../src/data-hook-utils.js"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,4BAFW,mBAAmB,yBAS7B;AAED;;;;;;;;;;GAUG;AACH,8CATW,MAAM,WAGN,MAAM,iBAGN,MAAM,QAiBhB;AAGD,oDAuBC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,oDAhBW,MAAM,WAEN,MAAM,cAEN,OAAO,uBAEP,MAAM,6BAGN,MAAM,iBAGJ,KAAK,CAiDjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,yDAhBW,MAAM,WAEN,MAAM,cAEN,OAAO,uBAEP,MAAM,6BAGN,MAAM,0DAGJ,KAAK,CAsFjB;AAED,+FAGC;oCArPM,mBAAmB"}
1
+ {"version":3,"file":"data-hook-utils.d.ts","sourceRoot":"","sources":["../src/data-hook-utils.js"],"names":[],"mappings":"AAiBA;;;;GAIG;AACH,4BAFW,mBAAmB,yBAS7B;AAED;;;;;;;;;;GAUG;AACH,8CATW,MAAM,WAGN,MAAM,iBAGN,MAAM,QAiBhB;AAGD,oDAuBC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,oDAhBW,MAAM,WAEN,MAAM,cAEN,OAAO,uBAEP,MAAM,6BAGN,MAAM,iBAGJ,KAAK,CAiDjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,yDAhBW,MAAM,WAEN,MAAM,cAEN,OAAO,uBAEP,MAAM,6BAGN,MAAM,0DAGJ,KAAK,CAsFjB;AAED,+FAGC;oCA1PM,oBAAoB"}
@@ -2,8 +2,8 @@ import { useEffect, useMemo } from 'react';
2
2
  import { useQuery, useQueries } from '@tanstack/react-query';
3
3
  import { capitalize, getInitialCoordinationScopePrefix, } from '@vitessce/utils';
4
4
  import { STATUS } from '@vitessce/constants-internal';
5
+ import { AbstractLoaderError, LoaderNotFoundError, } from '@vitessce/abstract';
5
6
  import { getMatchingLoader, useMatchingLoader, useSetWarning, } from './state/hooks.js';
6
- import { AbstractLoaderError, LoaderNotFoundError, } from './errors/index.js';
7
7
  /**
8
8
  * Warn via publishing to the console
9
9
  * and to the global warning store.
@@ -2,8 +2,8 @@ import { useEffect, useMemo } from 'react';
2
2
  import { useQueries } from '@tanstack/react-query';
3
3
  import { extent } from 'd3-array';
4
4
  import { DataType, STATUS } from '@vitessce/constants-internal';
5
+ import { LoaderNotFoundError, } from '@vitessce/abstract';
5
6
  import { getMatchingLoader, useSetWarning, } from './state/hooks.js';
6
- import { LoaderNotFoundError, } from './errors/index.js';
7
7
  import { warn, dataQueryFn, } from './data-hook-utils.js';
8
8
  function getFeatureSelectionQueryKeyScopeTuplesAux(allSelections, allMatchOnObj, depth, dataset, dataType, isRequired, prevLevelScopes, currSelection, currMatchOn) {
9
9
  // Base case
@@ -1,8 +1,8 @@
1
1
  import { useState, useEffect, useMemo } from 'react';
2
2
  import { CoordinationType, DataType, STATUS } from '@vitessce/constants-internal';
3
3
  import { useQuery, useQueries } from '@tanstack/react-query';
4
+ import { LoaderNotFoundError, } from '@vitessce/abstract';
4
5
  import { useMultiCoordinationValues, useComplexCoordination, useSetWarning, getMatchingLoader, } from './state/hooks.js';
5
- import { LoaderNotFoundError, } from './errors/index.js';
6
6
  import { warn, useDataType, useDataTypeMulti, } from './data-hook-utils.js';
7
7
  /**
8
8
  * Get the dataset description string.
@@ -82,4 +82,18 @@ export function useExpressionValueGetter({ instanceObsIndex, matrixObsIndex, exp
82
82
  }): any;
83
83
  export function useGetObsMembership(obsSetsMembership: any): any;
84
84
  export function useGetObsInfo(obsType: any, obsLabelsTypes: any, obsLabelsData: any, obsSetsMembership: any): any;
85
+ /**
86
+ * This hook expands a featureLabelsMap
87
+ * by including mappings from ENSEMBL to HGNC IDs.
88
+ * User-provided mappings should take precedence,
89
+ * but they are not always provided in the config or contained
90
+ * in a column of the AnnData.var dataframe, for example.
91
+ * @param {string} featureType A feature type. Fetching is only done for 'gene'.
92
+ * @param {Map|null} featureLabelsMap An optional user-supplied feature labels
93
+ * mapping from the dataset.
94
+ * @returns {{ stripCuriePrefixes: boolean }|null} An options object.
95
+ */
96
+ export function useExpandedFeatureLabelsMap(featureType: string, featureLabelsMap: Map<any, any> | null, options: any): {
97
+ stripCuriePrefixes: boolean;
98
+ } | null;
85
99
  //# sourceMappingURL=hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../src/hooks.js"],"names":[],"mappings":"AAkBA,oDAOC;AAED;;;;GAIG;AACH,uCAHa,KAAK,CAmBjB;AAED;;;;GAIG;AACH,mCAHa,KAAK,CAoCjB;AAED;;;;;GAKG;AACH,qCAJa,KAAK,CAqCjB;AAED;;;;;;GAMG;AACH,uCA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tC,OAAU,EAAE,MAAM,EAAE,CAAA;CACjB,CAwBH;AAED;;;;QA2BC;AAED,iEAOC;AAED,kHA4BC;AAED;;;;;;;;;;GAUG;AACH,yDALW,MAAM,oBACN,gBAAI,IAAI,iBAEN;IAAE,kBAAkB,EAAE,OAAO,CAAA;CAAE,GAAC,IAAI,CA4BhD"}
package/dist-tsc/hooks.js CHANGED
@@ -1,10 +1,12 @@
1
1
  import { useRef, useState, useEffect, useCallback, useMemo, } from 'react';
2
2
  import { debounce, every } from 'lodash-es';
3
3
  import { extent } from 'd3-array';
4
+ import { useQuery } from '@tanstack/react-query';
4
5
  import { capitalize } from '@vitessce/utils';
5
- import { STATUS } from '@vitessce/constants-internal';
6
+ import { STATUS, AsyncFunctionType } from '@vitessce/constants-internal';
6
7
  import { useGridResize, useEmitGridResize } from './state/hooks.js';
7
8
  import { VITESSCE_CONTAINER } from './classNames.js';
9
+ import { useAsyncFunction } from './contexts.js';
8
10
  function getWindowDimensions() {
9
11
  const { innerWidth: width, innerHeight: height } = window;
10
12
  return {
@@ -273,3 +275,39 @@ export function useGetObsInfo(obsType, obsLabelsTypes, obsLabelsData, obsSetsMem
273
275
  return null;
274
276
  }, [obsType, obsLabelsTypes, obsLabelsData, obsSetsMembership]);
275
277
  }
278
+ /**
279
+ * This hook expands a featureLabelsMap
280
+ * by including mappings from ENSEMBL to HGNC IDs.
281
+ * User-provided mappings should take precedence,
282
+ * but they are not always provided in the config or contained
283
+ * in a column of the AnnData.var dataframe, for example.
284
+ * @param {string} featureType A feature type. Fetching is only done for 'gene'.
285
+ * @param {Map|null} featureLabelsMap An optional user-supplied feature labels
286
+ * mapping from the dataset.
287
+ * @returns {{ stripCuriePrefixes: boolean }|null} An options object.
288
+ */
289
+ export function useExpandedFeatureLabelsMap(featureType, featureLabelsMap, options) {
290
+ // TODO: Should this be done via a hook?
291
+ // We could alternatively expand these types of mappings in the featureLabels data loader class.
292
+ // TODO: Add an option to opt-out?
293
+ const { stripCuriePrefixes = true } = options || {};
294
+ const getTermMapping = useAsyncFunction(AsyncFunctionType.GET_TERM_MAPPING);
295
+ const termMappingQuery = useQuery({
296
+ enabled: (featureType === 'gene'),
297
+ queryKey: ['useExpandedFeatureLabelsMap', 'ensembl', 'hgnc'],
298
+ queryFn: async () => getTermMapping('ensembl', 'hgnc'),
299
+ });
300
+ const { data: fetchedMapping, status, isFetching } = termMappingQuery;
301
+ const updatedFeatureLabelsMap = useMemo(() => {
302
+ if (!fetchedMapping)
303
+ return featureLabelsMap;
304
+ return new Map([
305
+ ...(stripCuriePrefixes
306
+ ? Array.from(fetchedMapping).map(([k, v]) => ([k.split(':')[1], v.split(':')[1]]))
307
+ : fetchedMapping),
308
+ ...(featureLabelsMap || []),
309
+ ]);
310
+ }, [fetchedMapping, featureLabelsMap, stripCuriePrefixes]);
311
+ const dataStatus = isFetching ? STATUS.LOADING : status;
312
+ return [updatedFeatureLabelsMap, dataStatus];
313
+ }
@@ -3,12 +3,11 @@ export { TitleInfo } from "./TitleInfo.js";
3
3
  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
- export { useReady, useUrls, useVitessceContainer, useDeckCanvasSize, useUint8ObsFeatureMatrix, useUint8FeatureSelection, useExpressionValueGetter, useGetObsMembership, useGetObsInfo, useClosestVitessceContainerSize, useWindowDimensions, useGridItemSize } from "./hooks.js";
6
+ export { createLoaders } from "./vitessce-grid-utils.js";
7
+ export { useReady, useUrls, useVitessceContainer, useDeckCanvasSize, useUint8ObsFeatureMatrix, useUint8FeatureSelection, useExpressionValueGetter, useGetObsMembership, useGetObsInfo, useClosestVitessceContainerSize, useWindowDimensions, useGridItemSize, useExpandedFeatureLabelsMap } from "./hooks.js";
7
8
  export { useCoordinationScopes, useCoordinationScopesBy, useInitialCoordination, useCoordination, useComplexCoordination, useComplexCoordinationSecondary, useMultiCoordinationScopes, useMultiCoordinationScopesNonNull, useMultiCoordinationScopesSecondary, useMultiCoordinationScopesSecondaryNonNull, useMultiCoordinationValues, useMultiDatasetCoordination, useDatasetUids, useLoaders, useMergeCoordination, useMatchingLoader, useViewConfigStore, useViewConfigStoreApi, useViewConfig, useSetViewConfig, useComponentHover, useSetComponentHover, useComponentViewInfo, useSetComponentViewInfo, useWarning, useSetWarning, useAuxiliaryCoordination, useComponentLayout, useRemoveImageChannelInMetaCoordinationScopes, useAddImageChannelInMetaCoordinationScopes } from "./state/hooks.js";
8
9
  export { useDescription, useImageData, useObsSetsData, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useSampleSetsData, useSampleEdgesData, useMultiObsLabels, useMultiObsSpots, useMultiObsPoints, useSpotMultiObsSets, useSpotMultiFeatureLabels, useMultiObsSegmentations, useMultiImages, useObsSpotsData, useObsPointsData, useObsLocationsData, useObsSegmentationsData, useNeighborhoodsData, useObsLabelsData, useObsFeatureMatrixData, useFeatureLabelsData, useGenomicProfilesData } from "./data-hooks.js";
9
10
  export { usePointMultiObsLabels, useSpotMultiFeatureSelection, useSpotMultiObsFeatureMatrixIndices, useSegmentationMultiFeatureSelection, useSegmentationMultiObsFeatureMatrixIndices, useSegmentationMultiObsLocations, useSegmentationMultiObsSets } from "./data-hooks-multilevel.js";
10
- export { AbstractLoader, AbstractTwoStepLoader, LoaderResult } from "./data/index.js";
11
- export { AbstractLoaderError, DatasetNotFoundError, LoaderNotFoundError, LoaderValidationError, DataSourceFetchError } from "./errors/index.js";
12
11
  export { CellColorEncodingOption, OptionsContainer, OptionSelect, usePlotOptionsStyles } from "./shared-plot-options/index.js";
13
12
  export { useAsyncFunction, usePageModeView } from "./contexts.js";
14
13
  //# sourceMappingURL=index.d.ts.map
package/dist-tsc/index.js CHANGED
@@ -2,13 +2,12 @@ export { VitS } from './VitS.js';
2
2
  export { TitleInfo } from './TitleInfo.js';
3
3
  export { PopperMenu } from './shared-mui/components.js';
4
4
  // For plugin view types:
5
- export { useReady, useUrls, useVitessceContainer, useDeckCanvasSize, useUint8ObsFeatureMatrix, useUint8FeatureSelection, useExpressionValueGetter, useGetObsMembership, useGetObsInfo, useClosestVitessceContainerSize, useWindowDimensions, useGridItemSize, } from './hooks.js';
5
+ export { useReady, useUrls, useVitessceContainer, useDeckCanvasSize, useUint8ObsFeatureMatrix, useUint8FeatureSelection, useExpressionValueGetter, useGetObsMembership, useGetObsInfo, useClosestVitessceContainerSize, useWindowDimensions, useGridItemSize, useExpandedFeatureLabelsMap, } from './hooks.js';
6
6
  export { useCoordinationScopes, useCoordinationScopesBy, useInitialCoordination, useCoordination, useComplexCoordination, useComplexCoordinationSecondary, useMultiCoordinationScopes, useMultiCoordinationScopesNonNull, useMultiCoordinationScopesSecondary, useMultiCoordinationScopesSecondaryNonNull, useMultiCoordinationValues, useMultiDatasetCoordination, useDatasetUids, useLoaders, useMergeCoordination, useMatchingLoader, useViewConfigStore, useViewConfigStoreApi, useViewConfig, useSetViewConfig, useComponentHover, useSetComponentHover, useComponentViewInfo, useSetComponentViewInfo, useWarning, useSetWarning, useAuxiliaryCoordination, useComponentLayout, useRemoveImageChannelInMetaCoordinationScopes, useAddImageChannelInMetaCoordinationScopes, } from './state/hooks.js';
7
7
  export { useDescription, useImageData, useObsSetsData, useObsEmbeddingData, useFeatureSelection, useObsFeatureMatrixIndices, useSampleSetsData, useSampleEdgesData, useMultiObsLabels, useMultiObsSpots, useMultiObsPoints, useSpotMultiObsSets, useSpotMultiFeatureLabels, useMultiObsSegmentations, useMultiImages, useObsSpotsData, useObsPointsData, useObsLocationsData, useObsSegmentationsData, useNeighborhoodsData, useObsLabelsData, useObsFeatureMatrixData, useFeatureLabelsData, useGenomicProfilesData, } from './data-hooks.js';
8
8
  export { usePointMultiObsLabels, useSpotMultiFeatureSelection, useSpotMultiObsFeatureMatrixIndices, useSegmentationMultiFeatureSelection, useSegmentationMultiObsFeatureMatrixIndices, useSegmentationMultiObsLocations, useSegmentationMultiObsSets, } from './data-hooks-multilevel.js';
9
9
  export { useHasLoader, } from './data-hook-utils.js';
10
- export { AbstractLoader, AbstractTwoStepLoader, LoaderResult, } from './data/index.js';
11
- export { AbstractLoaderError, DatasetNotFoundError, LoaderNotFoundError, LoaderValidationError, DataSourceFetchError, } from './errors/index.js';
12
10
  export { CellColorEncodingOption, OptionsContainer, OptionSelect, usePlotOptionsStyles, } from './shared-plot-options/index.js';
13
11
  export { logConfig } from './view-config-utils.js';
14
12
  export { useAsyncFunction, usePageModeView } from './contexts.js';
13
+ export { createLoaders } from './vitessce-grid-utils.js';
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../src/state/hooks.js"],"names":[],"mappings":"AAmCA;;;;;;GAMG;AACH,8CAJW,GAAC,mBAEC,MAAM,GAAC,SAAS,CA4B5B;AAED;;;;;;;GAOG;AACH,gDALW,GAAC,wBACD,GAAC,qBAEC,MAAM,GAAC,SAAS,CA0C5B;AAED;;;;;GAKG;AACH,6CAJW,MAAM,sBACN,GAAC,GACC,MAAM,GAAC,SAAS,CAI5B;AAED;;;;;;GAMG;AACH,+CALW,MAAM,mDACN,GAAC,wBACD,GAAC,GACC,MAAM,GAAC,SAAS,CAc5B;AA4RD;;;;;;;;;GASG;AACH,mDALW,MAAM,EAAE,sBACR,MAAM,GAEJ,MAAM,CAclB;AAED;;;;;;;;;;;;;;;GAeG;AACH,4CATW,MAAM,EAAE,sBACR,MAAM,GAEJ,KAAK,CAmCjB;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,GAEJ,KAAK,CA2EjB;AAED;;;;;GAKG;AACH,0DAHW,MAAM,GACJ,MAAM,CAiBlB;AAED;;;;;;GAMG;AACH,4DAJW,MAAM,wBACN,MAAM,GACJ,MAAM,CAgBlB;AAED;;;;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oBhB;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,iDAEC;AAED;;;;;GAKG;AACH,iCAHa,MAAM,CAKlB;AAED;;;;;GAKG;AACH,oEAIC;AAGD;;;;;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;AApqCD;;;;aAPG,OAAO,kCAAkC,OAAO,sEAOO;AAC1D,mFAA0D;AAC1D;;;;;EAAgE;AAOhE;;;;mIAAwD;AACxD,kFAAwD;AAiIjD,yFA4LJ;AAOI,0FAFM,MAAM,CAOlB;AAcM,iDAUJ"}
@@ -149,7 +149,14 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
149
149
  loaders: initialLoaders,
150
150
  // Reducer functions which update the state
151
151
  // (although technically also part of state):
152
- setViewConfig: viewConfig => set({ viewConfig, initialViewConfig: viewConfig }),
152
+ setViewConfig: viewConfig => set({
153
+ viewConfig,
154
+ initialViewConfig: viewConfig,
155
+ // mostRecentConfigSource is used by the LinkController to determine
156
+ // whether the config was set by this instance or an external linked
157
+ // instance of Vitessce, and used to prevent infinite loops.
158
+ mostRecentConfigSource: 'internal',
159
+ }),
153
160
  setLoaders: loaders => set({ loaders }),
154
161
  setCoordinationValue: ({ parameter, value, coordinationScopes, byType, typeScope, coordinationScopesBy, }) => set((state) => {
155
162
  const { coordinationSpace } = state.viewConfig;
@@ -175,6 +182,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
175
182
  },
176
183
  },
177
184
  },
185
+ mostRecentConfigSource: 'internal',
178
186
  };
179
187
  }),
180
188
  mergeCoordination: (newCoordinationValues, scopePrefix, viewUid) => set((state) => {
@@ -253,7 +261,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
253
261
  };
254
262
  // console.log('newViewConfig', newViewConfig);
255
263
  return {
256
- viewConfig: newViewConfig,
264
+ viewConfig: newViewConfig, mostRecentConfigSource: 'internal',
257
265
  };
258
266
  }),
259
267
  removeImageChannelInMetaCoordinationScopes: (coordinationScopesRaw, layerScope, channelScope) => set((state) => {
@@ -263,6 +271,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
263
271
  ...state.viewConfig,
264
272
  coordinationSpace: removeImageChannelInMetaCoordinationScopesHelper(coordinationScopesRaw, layerScope, channelScope, coordinationSpace),
265
273
  },
274
+ mostRecentConfigSource: 'internal',
266
275
  };
267
276
  }),
268
277
  addImageChannelInMetaCoordinationScopes: (coordinationScopesRaw, layerScope) => set((state) => {
@@ -272,6 +281,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
272
281
  ...state.viewConfig,
273
282
  coordinationSpace: addImageChannelInMetaCoordinationScopesHelper(coordinationScopesRaw, layerScope, coordinationSpace),
274
283
  },
284
+ mostRecentConfigSource: 'internal',
275
285
  };
276
286
  }),
277
287
  removeComponent: uid => set((state) => {
@@ -281,6 +291,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
281
291
  ...state.viewConfig,
282
292
  layout: newLayout,
283
293
  },
294
+ mostRecentConfigSource: 'internal',
284
295
  };
285
296
  }),
286
297
  changeLayout: newComponentProps => set((state) => {
@@ -295,6 +306,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
295
306
  ...state.viewConfig,
296
307
  layout: newLayout,
297
308
  },
309
+ mostRecentConfigSource: 'internal',
298
310
  };
299
311
  }),
300
312
  }));
@@ -1 +1 @@
1
- {"version":3,"file":"VitessceGridLayout.d.ts","sourceRoot":"","sources":["../../src/vitessce-grid-layout/VitessceGridLayout.js"],"names":[],"mappings":"AAgBA,oDAwLC"}
1
+ {"version":3,"file":"VitessceGridLayout.d.ts","sourceRoot":"","sources":["../../src/vitessce-grid-layout/VitessceGridLayout.js"],"names":[],"mappings":"AAgBA,oDAmMC"}
@@ -13,7 +13,7 @@ class ResponsiveHeightGridLayout extends ResponsiveGridLayout {
13
13
  }
14
14
  }
15
15
  export function VitessceGridLayout(props) {
16
- const { layout, viewTypes, padding, margin: marginProp, draggableHandle: draggableHandleClass, onResize, onResizeStop, rowHeight, theme, height, onRemoveComponent, onLayoutChange: onLayoutChangeProp, isBounded, pageMode, children, } = props;
16
+ const { layout, viewTypes, coordinationTypes, fileTypes, stores, padding, margin: marginProp, draggableHandle: draggableHandleClass, onResize, onResizeStop, rowHeight, theme, height, onRemoveComponent, onLayoutChange: onLayoutChangeProp, isBounded, pageMode, children, } = props;
17
17
  const getComponent = useCallback((viewType) => {
18
18
  if (Array.isArray(viewTypes)) {
19
19
  const matchingViewType = viewTypes.find(v => v.name === viewType);
@@ -102,7 +102,9 @@ export function VitessceGridLayout(props) {
102
102
  const gridComponentsValues = Object.values(gridComponents);
103
103
  const contextValue = Object.fromEntries(gridComponentsValues.map((v) => {
104
104
  const Component = getComponent(v.component);
105
- return [v.uid, () => (_jsx("div", { style: { display: 'flex', flexDirection: 'column', height: '100%' }, children: _jsx(Component, { ...v.props, uuid: v.uid, coordinationScopes: v.coordinationScopes, coordinationScopesBy: v.coordinationScopesBy, theme: theme, removeGridComponent: null }) }, v.uid))];
105
+ return [v.uid, () => (_jsx("div", { style: { display: 'flex', flexDirection: 'column', height: '100%' }, children: _jsx(Component, { ...v.props, uuid: v.uid, coordinationScopes: v.coordinationScopes, coordinationScopesBy: v.coordinationScopesBy, theme: theme, removeGridComponent: null,
106
+ // Props used by LinkControllerSubscriber:
107
+ viewTypes: viewTypes, fileTypes: fileTypes, coordinationTypes: coordinationTypes, stores: stores }) }, v.uid))];
106
108
  }));
107
109
  // Not pageMode, so no children to render.
108
110
  // We render the grid components based on the layout information.
@@ -111,7 +113,9 @@ export function VitessceGridLayout(props) {
111
113
  const removeGridComponent = () => {
112
114
  onRemoveComponent(v.uid);
113
115
  };
114
- return (_jsx("div", { children: _jsx(Component, { ...v.props, uuid: v.uid, coordinationScopes: v.coordinationScopes, coordinationScopesBy: v.coordinationScopesBy, theme: theme, removeGridComponent: removeGridComponent }) }, v.uid));
116
+ return (_jsx("div", { children: _jsx(Component, { ...v.props, uuid: v.uid, coordinationScopes: v.coordinationScopes, coordinationScopesBy: v.coordinationScopesBy, theme: theme, removeGridComponent: removeGridComponent,
117
+ // Props used by LinkControllerSubscriber:
118
+ viewTypes: viewTypes, fileTypes: fileTypes, coordinationTypes: coordinationTypes, stores: stores }) }, v.uid));
115
119
  }), contextValue];
116
120
  }, [gridComponents, getComponent, onRemoveComponent, theme]);
117
121
  return (pageMode
@@ -2,7 +2,7 @@ import { useState, useEffect, useRef, } from 'react';
2
2
  import { InternMap } from 'internmap';
3
3
  import { isEqual, pick } from 'lodash-es';
4
4
  import { DATA_TYPE_COORDINATION_VALUE_USAGE } from '@vitessce/constants-internal';
5
- import { getSourceAndLoaderFromFileType, getDataTypeFromFileType } from './data/loader-registry.js';
5
+ import { getSourceAndLoaderFromFileType, getDataTypeFromFileType } from '@vitessce/abstract';
6
6
  /**
7
7
  * Return the bottom coordinate of the layout.
8
8
  * https://github.com/STRML/react-grid-layout/blob/20dac73f91274526034c00968b5bedb9c2ed36b9/lib/utils.js#L82
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/vit-s",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -29,12 +29,13 @@
29
29
  "uuid": "^9.0.0",
30
30
  "zustand": "^3.5.10",
31
31
  "react-aria": "^3.28.0",
32
- "@vitessce/constants-internal": "3.5.1",
33
- "@vitessce/plugins": "3.5.1",
34
- "@vitessce/schemas": "3.5.1",
35
- "@vitessce/utils": "3.5.1",
36
- "@vitessce/sets-utils": "3.5.1",
37
- "@vitessce/config": "3.5.1"
32
+ "@vitessce/abstract": "3.5.3",
33
+ "@vitessce/constants-internal": "3.5.3",
34
+ "@vitessce/plugins": "3.5.3",
35
+ "@vitessce/schemas": "3.5.3",
36
+ "@vitessce/utils": "3.5.3",
37
+ "@vitessce/sets-utils": "3.5.3",
38
+ "@vitessce/config": "3.5.3"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@testing-library/jest-dom": "^5.16.4",
@@ -42,7 +43,7 @@
42
43
  "react": "^18.0.0",
43
44
  "vite": "^4.3.0",
44
45
  "vitest": "^0.32.2",
45
- "@vitessce/types": "3.5.1"
46
+ "@vitessce/types": "3.5.3"
46
47
  },
47
48
  "peerDependencies": {
48
49
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
@@ -122,6 +122,9 @@ export default function VitessceGrid(props) {
122
122
  rowHeight={rowHeight}
123
123
  theme={theme}
124
124
  viewTypes={viewTypes}
125
+ fileTypes={fileTypes}
126
+ coordinationTypes={coordinationTypes}
127
+ stores={stores}
125
128
  draggableHandle={titleClasses.title}
126
129
  margin={margin}
127
130
  padding={padding}
@@ -5,15 +5,15 @@ import {
5
5
  getInitialCoordinationScopePrefix,
6
6
  } from '@vitessce/utils';
7
7
  import { STATUS } from '@vitessce/constants-internal';
8
+ import {
9
+ AbstractLoaderError,
10
+ LoaderNotFoundError,
11
+ } from '@vitessce/abstract';
8
12
  import {
9
13
  getMatchingLoader,
10
14
  useMatchingLoader,
11
15
  useSetWarning,
12
16
  } from './state/hooks.js';
13
- import {
14
- AbstractLoaderError,
15
- LoaderNotFoundError,
16
- } from './errors/index.js';
17
17
 
18
18
  /**
19
19
  * Warn via publishing to the console
@@ -2,13 +2,13 @@ import { useEffect, useMemo } from 'react';
2
2
  import { useQueries } from '@tanstack/react-query';
3
3
  import { extent } from 'd3-array';
4
4
  import { DataType, STATUS } from '@vitessce/constants-internal';
5
+ import {
6
+ LoaderNotFoundError,
7
+ } from '@vitessce/abstract';
5
8
  import {
6
9
  getMatchingLoader,
7
10
  useSetWarning,
8
11
  } from './state/hooks.js';
9
- import {
10
- LoaderNotFoundError,
11
- } from './errors/index.js';
12
12
  import {
13
13
  warn,
14
14
  dataQueryFn,
package/src/data-hooks.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import { useState, useEffect, useMemo } from 'react';
2
2
  import { CoordinationType, DataType, STATUS } from '@vitessce/constants-internal';
3
3
  import { useQuery, useQueries } from '@tanstack/react-query';
4
+ import {
5
+ LoaderNotFoundError,
6
+ } from '@vitessce/abstract';
4
7
  import {
5
8
  useMultiCoordinationValues,
6
9
  useComplexCoordination,
7
10
  useSetWarning,
8
11
  getMatchingLoader,
9
12
  } from './state/hooks.js';
10
- import {
11
- LoaderNotFoundError,
12
- } from './errors/index.js';
13
13
  import {
14
14
  warn,
15
15
  useDataType,
package/src/hooks.js CHANGED
@@ -3,10 +3,13 @@ import {
3
3
  } from 'react';
4
4
  import { debounce, every } from 'lodash-es';
5
5
  import { extent } from 'd3-array';
6
+ import { useQuery } from '@tanstack/react-query';
6
7
  import { capitalize } from '@vitessce/utils';
7
- import { STATUS } from '@vitessce/constants-internal';
8
+ import { STATUS, AsyncFunctionType } from '@vitessce/constants-internal';
8
9
  import { useGridResize, useEmitGridResize } from './state/hooks.js';
9
10
  import { VITESSCE_CONTAINER } from './classNames.js';
11
+ import { useAsyncFunction } from './contexts.js';
12
+
10
13
 
11
14
  function getWindowDimensions() {
12
15
  const { innerWidth: width, innerHeight: height } = window;
@@ -322,3 +325,42 @@ export function useGetObsInfo(obsType, obsLabelsTypes, obsLabelsData, obsSetsMem
322
325
  return null;
323
326
  }, [obsType, obsLabelsTypes, obsLabelsData, obsSetsMembership]);
324
327
  }
328
+
329
+ /**
330
+ * This hook expands a featureLabelsMap
331
+ * by including mappings from ENSEMBL to HGNC IDs.
332
+ * User-provided mappings should take precedence,
333
+ * but they are not always provided in the config or contained
334
+ * in a column of the AnnData.var dataframe, for example.
335
+ * @param {string} featureType A feature type. Fetching is only done for 'gene'.
336
+ * @param {Map|null} featureLabelsMap An optional user-supplied feature labels
337
+ * mapping from the dataset.
338
+ * @returns {{ stripCuriePrefixes: boolean }|null} An options object.
339
+ */
340
+ export function useExpandedFeatureLabelsMap(featureType, featureLabelsMap, options) {
341
+ // TODO: Should this be done via a hook?
342
+ // We could alternatively expand these types of mappings in the featureLabels data loader class.
343
+ // TODO: Add an option to opt-out?
344
+ const { stripCuriePrefixes = true } = options || {};
345
+ const getTermMapping = useAsyncFunction(AsyncFunctionType.GET_TERM_MAPPING);
346
+
347
+ const termMappingQuery = useQuery({
348
+ enabled: (featureType === 'gene'),
349
+ queryKey: ['useExpandedFeatureLabelsMap', 'ensembl', 'hgnc'],
350
+ queryFn: async () => getTermMapping('ensembl', 'hgnc'),
351
+ });
352
+ const { data: fetchedMapping, status, isFetching } = termMappingQuery;
353
+
354
+ const updatedFeatureLabelsMap = useMemo(() => {
355
+ if (!fetchedMapping) return featureLabelsMap;
356
+ return new Map([
357
+ ...(stripCuriePrefixes
358
+ ? Array.from(fetchedMapping).map(([k, v]) => ([k.split(':')[1], v.split(':')[1]]))
359
+ : fetchedMapping
360
+ ),
361
+ ...(featureLabelsMap || []),
362
+ ]);
363
+ }, [fetchedMapping, featureLabelsMap, stripCuriePrefixes]);
364
+ const dataStatus = isFetching ? STATUS.LOADING : status;
365
+ return [updatedFeatureLabelsMap, dataStatus];
366
+ }
package/src/index.js CHANGED
@@ -15,6 +15,7 @@ export {
15
15
  useClosestVitessceContainerSize,
16
16
  useWindowDimensions,
17
17
  useGridItemSize,
18
+ useExpandedFeatureLabelsMap,
18
19
  } from './hooks.js';
19
20
  export {
20
21
  useCoordinationScopes,
@@ -88,18 +89,6 @@ export {
88
89
  export {
89
90
  useHasLoader,
90
91
  } from './data-hook-utils.js';
91
- export {
92
- AbstractLoader,
93
- AbstractTwoStepLoader,
94
- LoaderResult,
95
- } from './data/index.js';
96
- export {
97
- AbstractLoaderError,
98
- DatasetNotFoundError,
99
- LoaderNotFoundError,
100
- LoaderValidationError,
101
- DataSourceFetchError,
102
- } from './errors/index.js';
103
92
  export {
104
93
  CellColorEncodingOption,
105
94
  OptionsContainer,
@@ -108,3 +97,4 @@ export {
108
97
  } from './shared-plot-options/index.js';
109
98
  export { logConfig } from './view-config-utils.js';
110
99
  export { useAsyncFunction, usePageModeView } from './contexts.js';
100
+ export { createLoaders } from './vitessce-grid-utils.js';
@@ -172,7 +172,15 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
172
172
  loaders: initialLoaders,
173
173
  // Reducer functions which update the state
174
174
  // (although technically also part of state):
175
- setViewConfig: viewConfig => set({ viewConfig, initialViewConfig: viewConfig }),
175
+ setViewConfig: viewConfig => set({
176
+ viewConfig,
177
+ initialViewConfig:
178
+ viewConfig,
179
+ // mostRecentConfigSource is used by the LinkController to determine
180
+ // whether the config was set by this instance or an external linked
181
+ // instance of Vitessce, and used to prevent infinite loops.
182
+ mostRecentConfigSource: 'internal',
183
+ }),
176
184
  setLoaders: loaders => set({ loaders }),
177
185
  setCoordinationValue: ({
178
186
  parameter, value, coordinationScopes,
@@ -202,6 +210,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
202
210
  },
203
211
  },
204
212
  },
213
+ mostRecentConfigSource: 'internal',
205
214
  };
206
215
  }),
207
216
  mergeCoordination: (newCoordinationValues, scopePrefix, viewUid) => set((state) => {
@@ -282,7 +291,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
282
291
  };
283
292
  // console.log('newViewConfig', newViewConfig);
284
293
  return {
285
- viewConfig: newViewConfig,
294
+ viewConfig: newViewConfig, mostRecentConfigSource: 'internal',
286
295
  };
287
296
  }),
288
297
  removeImageChannelInMetaCoordinationScopes: (coordinationScopesRaw, layerScope, channelScope) => set((state) => {
@@ -297,6 +306,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
297
306
  coordinationSpace,
298
307
  ),
299
308
  },
309
+ mostRecentConfigSource: 'internal',
300
310
  };
301
311
  }),
302
312
  addImageChannelInMetaCoordinationScopes: (coordinationScopesRaw, layerScope) => set((state) => {
@@ -310,6 +320,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
310
320
  coordinationSpace,
311
321
  ),
312
322
  },
323
+ mostRecentConfigSource: 'internal',
313
324
  };
314
325
  }),
315
326
  removeComponent: uid => set((state) => {
@@ -319,6 +330,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
319
330
  ...state.viewConfig,
320
331
  layout: newLayout,
321
332
  },
333
+ mostRecentConfigSource: 'internal',
322
334
  };
323
335
  }),
324
336
  changeLayout: newComponentProps => set((state) => {
@@ -333,6 +345,7 @@ export const createViewConfigStore = (initialLoaders, initialConfig) => create(s
333
345
  ...state.viewConfig,
334
346
  layout: newLayout,
335
347
  },
348
+ mostRecentConfigSource: 'internal',
336
349
  };
337
350
  }),
338
351
  }));
@@ -17,7 +17,8 @@ class ResponsiveHeightGridLayout extends ResponsiveGridLayout {
17
17
  export function VitessceGridLayout(props) {
18
18
  const {
19
19
  layout,
20
- viewTypes, padding, margin: marginProp, draggableHandle: draggableHandleClass,
20
+ viewTypes, coordinationTypes, fileTypes, stores,
21
+ padding, margin: marginProp, draggableHandle: draggableHandleClass,
21
22
  onResize, onResizeStop, rowHeight, theme, height,
22
23
  onRemoveComponent, onLayoutChange: onLayoutChangeProp,
23
24
  isBounded,
@@ -137,6 +138,11 @@ export function VitessceGridLayout(props) {
137
138
  coordinationScopesBy={v.coordinationScopesBy}
138
139
  theme={theme}
139
140
  removeGridComponent={null}
141
+ // Props used by LinkControllerSubscriber:
142
+ viewTypes={viewTypes}
143
+ fileTypes={fileTypes}
144
+ coordinationTypes={coordinationTypes}
145
+ stores={stores}
140
146
  />
141
147
  </div>
142
148
  )];
@@ -152,12 +158,17 @@ export function VitessceGridLayout(props) {
152
158
  return (
153
159
  <div key={v.uid}>
154
160
  <Component
155
- {... v.props}
161
+ {...v.props}
156
162
  uuid={v.uid}
157
163
  coordinationScopes={v.coordinationScopes}
158
164
  coordinationScopesBy={v.coordinationScopesBy}
159
165
  theme={theme}
160
166
  removeGridComponent={removeGridComponent}
167
+ // Props used by LinkControllerSubscriber:
168
+ viewTypes={viewTypes}
169
+ fileTypes={fileTypes}
170
+ coordinationTypes={coordinationTypes}
171
+ stores={stores}
161
172
  />
162
173
  </div>
163
174
  );
@@ -179,11 +190,11 @@ export function VitessceGridLayout(props) {
179
190
  breakpoints={gridBreakpoints}
180
191
  height={height}
181
192
  rowHeight={
182
- rowHeight
183
- || (
184
- (window.innerHeight - 2 * padding - (maxRows - 1) * margin)
185
- / maxRows
186
- )}
193
+ rowHeight
194
+ || (
195
+ (window.innerHeight - 2 * padding - (maxRows - 1) * margin)
196
+ / maxRows
197
+ )}
187
198
  containerPadding={containerPadding}
188
199
  margin={margin}
189
200
  draggableHandle={draggableHandle}
@@ -4,7 +4,7 @@ import {
4
4
  import { InternMap } from 'internmap';
5
5
  import { isEqual, pick } from 'lodash-es';
6
6
  import { DATA_TYPE_COORDINATION_VALUE_USAGE } from '@vitessce/constants-internal';
7
- import { getSourceAndLoaderFromFileType, getDataTypeFromFileType } from './data/loader-registry.js';
7
+ import { getSourceAndLoaderFromFileType, getDataTypeFromFileType } from '@vitessce/abstract';
8
8
 
9
9
  /**
10
10
  * Return the bottom coordinate of the layout.