@vitessce/scatterplot-embedding 2.0.3-beta.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,12 @@
1
+ import { B as BaseDecoder } from "./index-50142996.js";
2
+ import "react";
3
+ import "@vitessce/vit-s";
4
+ import "react-dom";
5
+ class RawDecoder extends BaseDecoder {
6
+ decodeBlock(buffer) {
7
+ return buffer;
8
+ }
9
+ }
10
+ export {
11
+ RawDecoder as default
12
+ };
@@ -0,0 +1,32 @@
1
+ import { B as BaseDecoder } from "./index-50142996.js";
2
+ import "react";
3
+ import "@vitessce/vit-s";
4
+ import "react-dom";
5
+ class WebImageDecoder extends BaseDecoder {
6
+ constructor() {
7
+ super();
8
+ if (typeof createImageBitmap === "undefined") {
9
+ throw new Error("Cannot decode WebImage as `createImageBitmap` is not available");
10
+ } else if (typeof document === "undefined" && typeof OffscreenCanvas === "undefined") {
11
+ throw new Error("Cannot decode WebImage as neither `document` nor `OffscreenCanvas` is not available");
12
+ }
13
+ }
14
+ async decode(fileDirectory, buffer) {
15
+ const blob = new Blob([buffer]);
16
+ const imageBitmap = await createImageBitmap(blob);
17
+ let canvas;
18
+ if (typeof document !== "undefined") {
19
+ canvas = document.createElement("canvas");
20
+ canvas.width = imageBitmap.width;
21
+ canvas.height = imageBitmap.height;
22
+ } else {
23
+ canvas = new OffscreenCanvas(imageBitmap.width, imageBitmap.height);
24
+ }
25
+ const ctx = canvas.getContext("2d");
26
+ ctx.drawImage(imageBitmap, 0, 0);
27
+ return ctx.getImageData(0, 0, imageBitmap.width, imageBitmap.height).data.buffer;
28
+ }
29
+ }
30
+ export {
31
+ WebImageDecoder as default
32
+ };
@@ -0,0 +1,2 @@
1
+ export default function EmbeddingScatterplotOptions(props: any): JSX.Element | null;
2
+ //# sourceMappingURL=EmbeddingScatterplotOptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmbeddingScatterplotOptions.d.ts","sourceRoot":"","sources":["../src/EmbeddingScatterplotOptions.js"],"names":[],"mappings":"AAIA,oFAyCC"}
@@ -1,7 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import TableCell from '@material-ui/core/TableCell';
4
- import TableRow from '@material-ui/core/TableRow';
3
+ import { TableCell, TableRow } from '@material-ui/core';
5
4
  import { usePlotOptionsStyles, OptionSelect } from '@vitessce/vit-s';
6
5
  export default function EmbeddingScatterplotOptions(props) {
7
6
  const { mappingSelectEnabled, mappings, selectedMapping, setSelectedMapping, } = props;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * A subscriber component for the scatterplot.
3
+ * @param {object} props
4
+ * @param {number} props.uuid The unique identifier for this component.
5
+ * @param {string} props.theme The current theme name.
6
+ * @param {object} props.coordinationScopes The mapping from coordination types to coordination
7
+ * scopes.
8
+ * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,
9
+ * to call when the component has been removed from the grid.
10
+ * @param {string} props.title An override value for the component title.
11
+ * @param {number} props.averageFillDensity Override the average fill density calculation
12
+ * when using dynamic opacity mode.
13
+ */
14
+ export function EmbeddingScatterplotSubscriber(props: {
15
+ uuid: number;
16
+ theme: string;
17
+ coordinationScopes: object;
18
+ removeGridComponent: Function;
19
+ title: string;
20
+ averageFillDensity: number;
21
+ }): JSX.Element;
22
+ //# sourceMappingURL=EmbeddingScatterplotSubscriber.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EmbeddingScatterplotSubscriber.d.ts","sourceRoot":"","sources":["../src/EmbeddingScatterplotSubscriber.js"],"names":[],"mappings":"AAkCA;;;;;;;;;;;;GAYG;AACH;IAVyB,IAAI,EAAlB,MAAM;IACQ,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;IAEU,mBAAmB;IAErB,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;gBA4VhB"}
@@ -1,12 +1,13 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useState, useEffect, useCallback, useMemo, } from 'react';
3
3
  import { extent } from 'd3-array';
4
- import isEqual from 'lodash/isEqual';
4
+ import { isEqual } from 'lodash-es';
5
5
  import plur from 'plur';
6
- import { TitleInfo, registerPluginViewType, useReady, useUrls, useDeckCanvasSize, useExpressionValueGetter, useGetObsInfo, useObsEmbeddingData, useObsSetsData, useFeatureSelection, useObsFeatureMatrixIndices, useMultiObsLabels, useCoordination, useLoaders, useSetComponentHover, useSetComponentViewInfo, } from '@vitessce/vit-s';
6
+ import { TitleInfo, useReady, useUrls, useDeckCanvasSize, useUint8FeatureSelection, useExpressionValueGetter, useGetObsInfo, useObsEmbeddingData, useObsSetsData, useFeatureSelection, useObsFeatureMatrixIndices, useFeatureLabelsData, useMultiObsLabels, useCoordination, useLoaders, useSetComponentHover, useSetComponentViewInfo, } from '@vitessce/vit-s';
7
7
  import { setObsSelection, mergeObsSets, getCellSetPolygons } from '@vitessce/sets-utils';
8
8
  import { getCellColors, commaNumber } from '@vitessce/utils';
9
9
  import { Scatterplot, ScatterplotTooltipSubscriber, ScatterplotOptions, getPointSizeDevicePixels, getPointOpacity, } from '@vitessce/scatterplot';
10
+ import { Legend } from '@vitessce/legend';
10
11
  import { ViewType, COMPONENT_COORDINATION_TYPES } from '@vitessce/constants-internal';
11
12
  /**
12
13
  * A subscriber component for the scatterplot.
@@ -15,7 +16,6 @@ import { ViewType, COMPONENT_COORDINATION_TYPES } from '@vitessce/constants-inte
15
16
  * @param {string} props.theme The current theme name.
16
17
  * @param {object} props.coordinationScopes The mapping from coordination types to coordination
17
18
  * scopes.
18
- * @param {boolean} props.disableTooltip Should the tooltip be disabled?
19
19
  * @param {function} props.removeGridComponent The callback function to pass to TitleInfo,
20
20
  * to call when the component has been removed from the grid.
21
21
  * @param {string} props.title An override value for the component title.
@@ -23,14 +23,14 @@ import { ViewType, COMPONENT_COORDINATION_TYPES } from '@vitessce/constants-inte
23
23
  * when using dynamic opacity mode.
24
24
  */
25
25
  export function EmbeddingScatterplotSubscriber(props) {
26
- const { uuid, coordinationScopes, removeGridComponent, theme, disableTooltip = false, observationsLabelOverride, title: titleOverride,
26
+ const { uuid, coordinationScopes, removeGridComponent, theme, observationsLabelOverride, title: titleOverride,
27
27
  // Average fill density for dynamic opacity calculation.
28
28
  averageFillDensity, } = props;
29
29
  const loaders = useLoaders();
30
30
  const setComponentHover = useSetComponentHover();
31
31
  const setComponentViewInfo = useSetComponentViewInfo(uuid);
32
32
  // Get "props" from the coordination space.
33
- const [{ dataset, obsType, featureType, featureValueType, embeddingZoom: zoom, embeddingTargetX: targetX, embeddingTargetY: targetY, embeddingTargetZ: targetZ, embeddingType: mapping, obsFilter: cellFilter, obsHighlight: cellHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, embeddingObsSetPolygonsVisible: cellSetPolygonsVisible, embeddingObsSetLabelsVisible: cellSetLabelsVisible, embeddingObsSetLabelSize: cellSetLabelSize, embeddingObsRadius: cellRadiusFixed, embeddingObsRadiusMode: cellRadiusMode, embeddingObsOpacity: cellOpacityFixed, embeddingObsOpacityMode: cellOpacityMode, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, }, { setEmbeddingZoom: setZoom, setEmbeddingTargetX: setTargetX, setEmbeddingTargetY: setTargetY, setEmbeddingTargetZ: setTargetZ, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setEmbeddingObsSetPolygonsVisible: setCellSetPolygonsVisible, setEmbeddingObsSetLabelsVisible: setCellSetLabelsVisible, setEmbeddingObsSetLabelSize: setCellSetLabelSize, setEmbeddingObsRadius: setCellRadiusFixed, setEmbeddingObsRadiusMode: setCellRadiusMode, setEmbeddingObsOpacity: setCellOpacityFixed, setEmbeddingObsOpacityMode: setCellOpacityMode, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.SCATTERPLOT], coordinationScopes);
33
+ const [{ dataset, obsType, featureType, featureValueType, embeddingZoom: zoom, embeddingTargetX: targetX, embeddingTargetY: targetY, embeddingTargetZ: targetZ, embeddingType: mapping, obsFilter: cellFilter, obsHighlight: cellHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, embeddingObsSetPolygonsVisible: cellSetPolygonsVisible, embeddingObsSetLabelsVisible: cellSetLabelsVisible, embeddingObsSetLabelSize: cellSetLabelSize, embeddingObsRadius: cellRadiusFixed, embeddingObsRadiusMode: cellRadiusMode, embeddingObsOpacity: cellOpacityFixed, embeddingObsOpacityMode: cellOpacityMode, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible, }, { setEmbeddingZoom: setZoom, setEmbeddingTargetX: setTargetX, setEmbeddingTargetY: setTargetY, setEmbeddingTargetZ: setTargetZ, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setEmbeddingObsSetPolygonsVisible: setCellSetPolygonsVisible, setEmbeddingObsSetLabelsVisible: setCellSetLabelsVisible, setEmbeddingObsSetLabelSize: setCellSetLabelSize, setEmbeddingObsRadius: setCellRadiusFixed, setEmbeddingObsRadiusMode: setCellRadiusMode, setEmbeddingObsOpacity: setCellOpacityFixed, setEmbeddingObsOpacityMode: setCellOpacityMode, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setTooltipsVisible, }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.SCATTERPLOT], coordinationScopes);
34
34
  const observationsLabel = observationsLabelOverride || obsType;
35
35
  const [urls, addUrl] = useUrls(loaders, dataset);
36
36
  const [width, height, deckRef] = useDeckCanvasSize();
@@ -43,30 +43,30 @@ export function EmbeddingScatterplotSubscriber(props) {
43
43
  // eslint-disable-next-line no-unused-vars
44
44
  const [expressionData, loadedFeatureSelection, featureSelectionStatus] = useFeatureSelection(loaders, dataset, false, geneSelection, { obsType, featureType, featureValueType });
45
45
  const [{ obsIndex: matrixObsIndex }, matrixIndicesStatus] = useObsFeatureMatrixIndices(loaders, dataset, addUrl, false, { obsType, featureType, featureValueType });
46
+ const [{ featureLabelsMap }, featureLabelsStatus] = useFeatureLabelsData(loaders, dataset, addUrl, false, {}, {}, { featureType });
46
47
  const isReady = useReady([
47
48
  obsEmbeddingStatus,
48
49
  obsSetsStatus,
49
50
  featureSelectionStatus,
51
+ featureLabelsStatus,
50
52
  matrixIndicesStatus,
51
53
  ]);
52
54
  const [dynamicCellRadius, setDynamicCellRadius] = useState(cellRadiusFixed);
53
55
  const [dynamicCellOpacity, setDynamicCellOpacity] = useState(cellOpacityFixed);
56
+ const [originalViewState, setOriginalViewState] = useState(null);
54
57
  const mergedCellSets = useMemo(() => mergeObsSets(cellSets, additionalCellSets), [cellSets, additionalCellSets]);
55
58
  const setCellSelectionProp = useCallback((v) => {
56
59
  setObsSelection(v, additionalCellSets, cellSetColor, setCellSetSelection, setAdditionalCellSets, setCellSetColor, setCellColorEncoding);
57
60
  }, [additionalCellSets, cellSetColor, setCellColorEncoding,
58
61
  setAdditionalCellSets, setCellSetColor, setCellSetSelection]);
59
62
  const cellColors = useMemo(() => getCellColors({
60
- cellColorEncoding,
61
- expressionData: expressionData && expressionData[0],
62
- geneSelection,
63
63
  cellSets: mergedCellSets,
64
64
  cellSetSelection,
65
65
  cellSetColor,
66
66
  obsIndex: matrixObsIndex,
67
67
  theme,
68
- }), [cellColorEncoding, geneSelection, mergedCellSets, theme,
69
- cellSetSelection, cellSetColor, expressionData, matrixObsIndex]);
68
+ }), [mergedCellSets, theme,
69
+ cellSetSelection, cellSetColor, matrixObsIndex]);
70
70
  // cellSetPolygonCache is an array of tuples like [(key0, val0), (key1, val1), ...],
71
71
  // where the keys are cellSetSelection arrays.
72
72
  const [cellSetPolygonCache, setCellSetPolygonCache] = useState([]);
@@ -109,12 +109,21 @@ export function EmbeddingScatterplotSubscriber(props) {
109
109
  // compute the cell radius scale based on the
110
110
  // extents of the cell coordinates on the x/y axes.
111
111
  useEffect(() => {
112
- if (xRange && yRange) {
112
+ // We do not really need isReady here, since the above useMemo that
113
+ // computes xRange and yRange will only run after obsEmbedding has loaded anyway.
114
+ // However, we include it here to ensure this effect waits as long as possible to run;
115
+ // For some reason, otherwise, in some cases this effect will run before the react-grid-layout
116
+ // initialization animation has finished,
117
+ // prior to `height` and `width` reaching their ultimate values, resulting in
118
+ // an initial viewState for that small view size, which looks bad.
119
+ if (xRange && yRange && isReady) {
113
120
  const pointSizeDevicePixels = getPointSizeDevicePixels(window.devicePixelRatio, zoom, xRange, yRange, width, height);
114
121
  setDynamicCellRadius(pointSizeDevicePixels);
115
122
  const nextCellOpacityScale = getPointOpacity(zoom, xRange, yRange, width, height, numCells, averageFillDensity);
116
123
  setDynamicCellOpacity(nextCellOpacityScale);
117
124
  if (typeof targetX !== 'number' || typeof targetY !== 'number') {
125
+ // The view config did not define an initial viewState so
126
+ // we calculate one based on the data and set it.
118
127
  const newTargetX = xExtent[0] + xRange / 2;
119
128
  const newTargetY = yExtent[0] + yRange / 2;
120
129
  const newZoom = Math.log2(Math.min(width / xRange, height / yRange));
@@ -122,32 +131,37 @@ export function EmbeddingScatterplotSubscriber(props) {
122
131
  // Graphics rendering has the y-axis going south so we need to multiply by negative one.
123
132
  setTargetY(-newTargetY);
124
133
  setZoom(newZoom);
134
+ setOriginalViewState({ target: [newTargetX, -newTargetY, 0], zoom: newZoom });
135
+ }
136
+ else if (!originalViewState) {
137
+ // originalViewState has not yet been set and
138
+ // the view config defined an initial viewState.
139
+ setOriginalViewState({ target: [targetX, targetY, 0], zoom });
125
140
  }
126
141
  }
127
142
  // eslint-disable-next-line react-hooks/exhaustive-deps
128
- }, [xRange, yRange, xExtent, yExtent, numCells,
143
+ }, [xRange, yRange, isReady, xExtent, yExtent, numCells,
129
144
  width, height, zoom, averageFillDensity]);
130
145
  const getObsInfo = useGetObsInfo(observationsLabel, obsLabelsTypes, obsLabelsData, obsSetsMembership);
131
146
  const cellSelectionSet = useMemo(() => new Set(cellSelection), [cellSelection]);
132
147
  const getCellIsSelected = useCallback((object, { index }) => ((cellSelectionSet || new Set([])).has(obsEmbeddingIndex[index]) ? 1.0 : 0.0), [cellSelectionSet, obsEmbeddingIndex]);
133
148
  const cellRadius = (cellRadiusMode === 'manual' ? cellRadiusFixed : dynamicCellRadius);
134
149
  const cellOpacity = (cellOpacityMode === 'manual' ? cellOpacityFixed : dynamicCellOpacity);
150
+ const [uint8ExpressionData, expressionExtents] = useUint8FeatureSelection(expressionData);
135
151
  // Set up a getter function for gene expression values, to be used
136
152
  // by the DeckGL layer to obtain values for instanced attributes.
137
153
  const getExpressionValue = useExpressionValueGetter({
138
154
  instanceObsIndex: obsEmbeddingIndex,
139
155
  matrixObsIndex,
140
- expressionData,
156
+ expressionData: uint8ExpressionData,
141
157
  });
142
- return (_jsxs(TitleInfo, { title: title, info: `${commaNumber(cellsCount)} ${plur(observationsLabel, cellsCount)}`, removeGridComponent: removeGridComponent, urls: urls, theme: theme, isReady: isReady, options: (_jsx(ScatterplotOptions, { observationsLabel: observationsLabel, cellRadius: cellRadiusFixed, setCellRadius: setCellRadiusFixed, cellRadiusMode: cellRadiusMode, setCellRadiusMode: setCellRadiusMode, cellOpacity: cellOpacityFixed, setCellOpacity: setCellOpacityFixed, cellOpacityMode: cellOpacityMode, setCellOpacityMode: setCellOpacityMode, cellSetLabelsVisible: cellSetLabelsVisible, setCellSetLabelsVisible: setCellSetLabelsVisible, cellSetLabelSize: cellSetLabelSize, setCellSetLabelSize: setCellSetLabelSize, cellSetPolygonsVisible: cellSetPolygonsVisible, setCellSetPolygonsVisible: setCellSetPolygonsVisible, cellColorEncoding: cellColorEncoding, setCellColorEncoding: setCellColorEncoding, geneExpressionColormap: geneExpressionColormap, setGeneExpressionColormap: setGeneExpressionColormap, geneExpressionColormapRange: geneExpressionColormapRange, setGeneExpressionColormapRange: setGeneExpressionColormapRange })), children: [_jsx(Scatterplot, { ref: deckRef, uuid: uuid, theme: theme, viewState: { zoom, target: [targetX, targetY, targetZ] }, setViewState: ({ zoom: newZoom, target }) => {
143
- setZoom(newZoom);
144
- setTargetX(target[0]);
145
- setTargetY(target[1]);
146
- setTargetZ(target[2] || 0);
147
- }, obsEmbeddingIndex: obsEmbeddingIndex, obsEmbedding: obsEmbedding, cellFilter: cellFilter, cellSelection: cellSelection, cellHighlight: cellHighlight, cellColors: cellColors, cellSetPolygons: cellSetPolygons, cellSetLabelSize: cellSetLabelSize, cellSetLabelsVisible: cellSetLabelsVisible, cellSetPolygonsVisible: cellSetPolygonsVisible, setCellFilter: setCellFilter, setCellSelection: setCellSelectionProp, setCellHighlight: setCellHighlight, cellRadius: cellRadius, cellOpacity: cellOpacity, cellColorEncoding: cellColorEncoding, geneExpressionColormap: geneExpressionColormap, geneExpressionColormapRange: geneExpressionColormapRange, setComponentHover: () => {
158
+ const setViewState = ({ zoom: newZoom, target }) => {
159
+ setZoom(newZoom);
160
+ setTargetX(target[0]);
161
+ setTargetY(target[1]);
162
+ setTargetZ(target[2] || 0);
163
+ };
164
+ return (_jsxs(TitleInfo, { title: title, info: `${commaNumber(cellsCount)} ${plur(observationsLabel, cellsCount)}`, removeGridComponent: removeGridComponent, urls: urls, theme: theme, isReady: isReady, options: (_jsx(ScatterplotOptions, { observationsLabel: observationsLabel, cellRadius: cellRadiusFixed, setCellRadius: setCellRadiusFixed, cellRadiusMode: cellRadiusMode, setCellRadiusMode: setCellRadiusMode, cellOpacity: cellOpacityFixed, setCellOpacity: setCellOpacityFixed, cellOpacityMode: cellOpacityMode, setCellOpacityMode: setCellOpacityMode, cellSetLabelsVisible: cellSetLabelsVisible, setCellSetLabelsVisible: setCellSetLabelsVisible, tooltipsVisible: tooltipsVisible, setTooltipsVisible: setTooltipsVisible, cellSetLabelSize: cellSetLabelSize, setCellSetLabelSize: setCellSetLabelSize, cellSetPolygonsVisible: cellSetPolygonsVisible, setCellSetPolygonsVisible: setCellSetPolygonsVisible, cellColorEncoding: cellColorEncoding, setCellColorEncoding: setCellColorEncoding, geneExpressionColormap: geneExpressionColormap, setGeneExpressionColormap: setGeneExpressionColormap, geneExpressionColormapRange: geneExpressionColormapRange, setGeneExpressionColormapRange: setGeneExpressionColormapRange })), children: [_jsx(Scatterplot, { ref: deckRef, uuid: uuid, theme: theme, viewState: { zoom, target: [targetX, targetY, targetZ] }, setViewState: setViewState, originalViewState: originalViewState, obsEmbeddingIndex: obsEmbeddingIndex, obsEmbedding: obsEmbedding, cellFilter: cellFilter, cellSelection: cellSelection, cellHighlight: cellHighlight, cellColors: cellColors, cellSetPolygons: cellSetPolygons, cellSetLabelSize: cellSetLabelSize, cellSetLabelsVisible: cellSetLabelsVisible, cellSetPolygonsVisible: cellSetPolygonsVisible, setCellFilter: setCellFilter, setCellSelection: setCellSelectionProp, setCellHighlight: setCellHighlight, cellRadius: cellRadius, cellOpacity: cellOpacity, cellColorEncoding: cellColorEncoding, geneExpressionColormap: geneExpressionColormap, geneExpressionColormapRange: geneExpressionColormapRange, setComponentHover: () => {
148
165
  setComponentHover(uuid);
149
- }, updateViewInfo: setComponentViewInfo, getExpressionValue: getExpressionValue, getCellIsSelected: getCellIsSelected }), !disableTooltip && (_jsx(ScatterplotTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width, height: height, getObsInfo: getObsInfo }))] }));
150
- }
151
- export function register() {
152
- registerPluginViewType(ViewType.SCATTERPLOT, EmbeddingScatterplotSubscriber, COMPONENT_COORDINATION_TYPES[ViewType.SCATTERPLOT]);
166
+ }, updateViewInfo: setComponentViewInfo, getExpressionValue: getExpressionValue, getCellIsSelected: getCellIsSelected }), tooltipsVisible && (_jsx(ScatterplotTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width, height: height, getObsInfo: getObsInfo })), _jsx(Legend, { visible: true, theme: theme, featureType: featureType, featureValueType: featureValueType, obsColorEncoding: cellColorEncoding, featureSelection: geneSelection, featureLabelsMap: featureLabelsMap, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, extent: expressionExtents?.[0] })] }));
153
167
  }
@@ -0,0 +1,2 @@
1
+ export { EmbeddingScatterplotSubscriber } from "./EmbeddingScatterplotSubscriber.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export { EmbeddingScatterplotSubscriber } from './EmbeddingScatterplotSubscriber.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/scatterplot-embedding",
3
- "version": "2.0.3-beta.0",
3
+ "version": "3.0.0",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -8,32 +8,42 @@
8
8
  "url": "git+https://github.com/vitessce/vitessce.git"
9
9
  },
10
10
  "license": "MIT",
11
+ "type": "module",
11
12
  "main": "dist/index.js",
12
13
  "files": [
13
- "dist"
14
+ "src",
15
+ "dist",
16
+ "dist-tsc"
14
17
  ],
15
18
  "dependencies": {
16
19
  "@material-ui/core": "~4.12.3",
17
20
  "d3-array": "^2.4.0",
18
- "lodash": "^4.17.21",
21
+ "lodash-es": "^4.17.21",
19
22
  "plur": "^5.1.0",
20
- "@vitessce/sets-utils": "2.0.3-beta.0",
21
- "@vitessce/constants-internal": "2.0.3-beta.0",
22
- "@vitessce/scatterplot": "2.0.3-beta.0",
23
- "@vitessce/vit-s": "2.0.3-beta.0",
24
- "@vitessce/utils": "2.0.3-beta.0"
23
+ "@vitessce/constants-internal": "3.0.0",
24
+ "@vitessce/legend": "3.0.0",
25
+ "@vitessce/scatterplot": "3.0.0",
26
+ "@vitessce/sets-utils": "3.0.0",
27
+ "@vitessce/utils": "3.0.0",
28
+ "@vitessce/vit-s": "3.0.0"
25
29
  },
26
30
  "devDependencies": {
27
31
  "react": "^18.0.0",
28
- "vite": "^3.0.0",
32
+ "vite": "^4.3.0",
29
33
  "vitest": "^0.23.4"
30
34
  },
31
35
  "peerDependencies": {
32
36
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
33
37
  },
34
38
  "scripts": {
35
- "start": "tsc --watch",
36
- "build": "tsc",
39
+ "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
37
40
  "test": "pnpm exec vitest --run -r ../../../ --dir ."
41
+ },
42
+ "module": "dist/index.js",
43
+ "exports": {
44
+ ".": {
45
+ "types": "./dist-tsc/index.d.ts",
46
+ "import": "./dist/index.js"
47
+ }
38
48
  }
39
49
  }
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { TableCell, TableRow } from '@material-ui/core';
3
+ import { usePlotOptionsStyles, OptionSelect } from '@vitessce/vit-s';
4
+
5
+ export default function EmbeddingScatterplotOptions(props) {
6
+ const {
7
+ mappingSelectEnabled,
8
+ mappings,
9
+ selectedMapping,
10
+ setSelectedMapping,
11
+ } = props;
12
+
13
+ const classes = usePlotOptionsStyles();
14
+
15
+ // Handlers for custom option field changes.
16
+ const handleSelectedMappingChange = (event) => {
17
+ setSelectedMapping(event.target.value);
18
+ };
19
+
20
+ return mappingSelectEnabled
21
+ ? (
22
+ <TableRow key="mapping-option-row">
23
+ <TableCell className={classes.labelCell}>
24
+ Embedding Type
25
+ </TableCell>
26
+ <TableCell className={classes.inputCell}>
27
+ <OptionSelect
28
+ key="scatterplot-mapping-select"
29
+ className={classes.select}
30
+ value={selectedMapping}
31
+ onChange={handleSelectedMappingChange}
32
+ inputProps={{
33
+ id: 'scatterplot-mapping-select',
34
+ }}
35
+ >
36
+ {mappings.map(name => (
37
+ <option key={name} value={name}>
38
+ {name}
39
+ </option>
40
+ ))}
41
+ </OptionSelect>
42
+ </TableCell>
43
+ </TableRow>
44
+ )
45
+ : null;
46
+ }