@vitessce/scatterplot-embedding 3.8.13 → 3.9.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/{deflate-ClaAmriP.js → deflate-CcLuHSgx.js} +1 -1
- package/dist/{index-BK98jzeZ.js → index-Bxpb2AKZ.js} +116 -18
- package/dist/index.js +1 -1
- package/dist/{jpeg-Ci-wqRKm.js → jpeg-DrCLRsoT.js} +1 -1
- package/dist/{lerc-S2pXAGyz.js → lerc-B9rIwWOn.js} +1 -1
- package/dist/{lzw--H4kL7kE.js → lzw-BUVadDKF.js} +1 -1
- package/dist/{packbits-zSU7Xz9P.js → packbits-CaNBbQQ0.js} +1 -1
- package/dist/{raw-CDyxv3KP.js → raw-DSxiAWgk.js} +1 -1
- package/dist/{webimage-dTZh6fML.js → webimage-Bg7AiNmf.js} +1 -1
- package/package.json +8 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-SxljTded.js";
|
|
2
|
-
import { B as BaseDecoder } from "./index-
|
|
2
|
+
import { B as BaseDecoder } from "./index-Bxpb2AKZ.js";
|
|
3
3
|
class DeflateDecoder extends BaseDecoder {
|
|
4
4
|
decodeBlock(buffer) {
|
|
5
5
|
return inflate_1(new Uint8Array(buffer)).buffer;
|
|
@@ -9855,6 +9855,7 @@ const CoordinationType$1 = {
|
|
|
9855
9855
|
OBS_SET_HIGHLIGHT: "obsSetHighlight",
|
|
9856
9856
|
OBS_SET_EXPANSION: "obsSetExpansion",
|
|
9857
9857
|
OBS_SET_COLOR: "obsSetColor",
|
|
9858
|
+
FEATURE_COLOR: "featureColor",
|
|
9858
9859
|
FEATURE_HIGHLIGHT: "featureHighlight",
|
|
9859
9860
|
FEATURE_SELECTION: "featureSelection",
|
|
9860
9861
|
FEATURE_SET_SELECTION: "featureSetSelection",
|
|
@@ -10432,6 +10433,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10432
10433
|
CoordinationType$1.OBS_SET_FILTER,
|
|
10433
10434
|
CoordinationType$1.OBS_SET_HIGHLIGHT,
|
|
10434
10435
|
CoordinationType$1.OBS_SET_COLOR,
|
|
10436
|
+
CoordinationType$1.FEATURE_COLOR,
|
|
10437
|
+
CoordinationType$1.FEATURE_FILTER_MODE,
|
|
10435
10438
|
CoordinationType$1.FEATURE_HIGHLIGHT,
|
|
10436
10439
|
CoordinationType$1.FEATURE_SELECTION,
|
|
10437
10440
|
CoordinationType$1.FEATURE_VALUE_COLORMAP,
|
|
@@ -10646,6 +10649,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
10646
10649
|
CoordinationType$1.SPATIAL_SPOT_STROKE_WIDTH,
|
|
10647
10650
|
CoordinationType$1.SPATIAL_LAYER_COLOR,
|
|
10648
10651
|
CoordinationType$1.OBS_COLOR_ENCODING,
|
|
10652
|
+
CoordinationType$1.FEATURE_COLOR,
|
|
10653
|
+
CoordinationType$1.FEATURE_FILTER_MODE,
|
|
10649
10654
|
CoordinationType$1.FEATURE_VALUE_COLORMAP,
|
|
10650
10655
|
CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
|
|
10651
10656
|
CoordinationType$1.FEATURE_SELECTION,
|
|
@@ -123403,22 +123408,22 @@ function addDecoder(cases, importFn) {
|
|
|
123403
123408
|
}
|
|
123404
123409
|
cases.forEach((c2) => registry$1.set(c2, importFn));
|
|
123405
123410
|
}
|
|
123406
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
123407
|
-
addDecoder(5, () => import("./lzw
|
|
123411
|
+
addDecoder([void 0, 1], () => import("./raw-DSxiAWgk.js").then((m2) => m2.default));
|
|
123412
|
+
addDecoder(5, () => import("./lzw-BUVadDKF.js").then((m2) => m2.default));
|
|
123408
123413
|
addDecoder(6, () => {
|
|
123409
123414
|
throw new Error("old style JPEG compression is not supported.");
|
|
123410
123415
|
});
|
|
123411
|
-
addDecoder(7, () => import("./jpeg-
|
|
123412
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
123413
|
-
addDecoder(32773, () => import("./packbits-
|
|
123416
|
+
addDecoder(7, () => import("./jpeg-DrCLRsoT.js").then((m2) => m2.default));
|
|
123417
|
+
addDecoder([8, 32946], () => import("./deflate-CcLuHSgx.js").then((m2) => m2.default));
|
|
123418
|
+
addDecoder(32773, () => import("./packbits-CaNBbQQ0.js").then((m2) => m2.default));
|
|
123414
123419
|
addDecoder(
|
|
123415
123420
|
34887,
|
|
123416
|
-
() => import("./lerc-
|
|
123421
|
+
() => import("./lerc-B9rIwWOn.js").then(async (m2) => {
|
|
123417
123422
|
await m2.zstd.init();
|
|
123418
123423
|
return m2;
|
|
123419
123424
|
}).then((m2) => m2.default)
|
|
123420
123425
|
);
|
|
123421
|
-
addDecoder(50001, () => import("./webimage-
|
|
123426
|
+
addDecoder(50001, () => import("./webimage-Bg7AiNmf.js").then((m2) => m2.default));
|
|
123422
123427
|
function decodeRowAcc(row, stride) {
|
|
123423
123428
|
let length2 = row.length - stride;
|
|
123424
123429
|
let offset2 = 0;
|
|
@@ -153368,6 +153373,7 @@ function Legend(props) {
|
|
|
153368
153373
|
positionRelative = false,
|
|
153369
153374
|
highContrast = false,
|
|
153370
153375
|
obsType,
|
|
153376
|
+
isPointsLayer = false,
|
|
153371
153377
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
153372
153378
|
featureType: _featureType = void 0,
|
|
153373
153379
|
// Unused but accepted for API compatibility
|
|
@@ -153375,6 +153381,9 @@ function Legend(props) {
|
|
|
153375
153381
|
considerSelections = true,
|
|
153376
153382
|
obsColorEncoding,
|
|
153377
153383
|
featureSelection,
|
|
153384
|
+
featureFilterMode,
|
|
153385
|
+
featureColor,
|
|
153386
|
+
featureIndex,
|
|
153378
153387
|
featureLabelsMap,
|
|
153379
153388
|
featureValueColormap,
|
|
153380
153389
|
featureValueColormapRange,
|
|
@@ -153418,15 +153427,95 @@ function Legend(props) {
|
|
|
153418
153427
|
debouncedSetRange(rangeValue);
|
|
153419
153428
|
}
|
|
153420
153429
|
}, [debouncedSetRange]);
|
|
153430
|
+
const obsLabel = capitalize$2(obsType ?? null);
|
|
153421
153431
|
const isDarkTheme = theme === "dark";
|
|
153422
|
-
const isStaticColor = obsColorEncoding === "spatialChannelColor" || obsColorEncoding === "spatialLayerColor";
|
|
153423
|
-
const isSetColor = obsColorEncoding === "cellSetSelection";
|
|
153432
|
+
const isStaticColor = !isPointsLayer && (obsColorEncoding === "spatialChannelColor" || obsColorEncoding === "spatialLayerColor");
|
|
153433
|
+
const isSetColor = !isPointsLayer && obsColorEncoding === "cellSetSelection";
|
|
153424
153434
|
const layerColor = Array.isArray(spatialLayerColor) && spatialLayerColor.length === 3 ? spatialLayerColor : getDefaultColor(theme ?? "light");
|
|
153425
153435
|
const channelColor = Array.isArray(spatialChannelColor) && spatialChannelColor.length === 3 ? spatialChannelColor : getDefaultColor(theme ?? "light");
|
|
153426
153436
|
const staticColor = obsColorEncoding === "spatialChannelColor" ? channelColor : layerColor;
|
|
153427
|
-
const visible = visibleProp && (!considerSelections || ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && featureSelection && Array.isArray(featureSelection) && featureSelection.length >= 1 || isSetColor && ((obsSetSelection == null ? void 0 : obsSetSelection.length) ?? 0) > 0 && ((obsSetColor == null ? void 0 : obsSetColor.length) ?? 0) > 0 || isStaticColor);
|
|
153437
|
+
const visible = visibleProp && (!considerSelections || ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && featureSelection && Array.isArray(featureSelection) && featureSelection.length >= 1 || isSetColor && ((obsSetSelection == null ? void 0 : obsSetSelection.length) ?? 0) > 0 && ((obsSetColor == null ? void 0 : obsSetColor.length) ?? 0) > 0 || isStaticColor || isPointsLayer);
|
|
153438
|
+
const pointsLegendElements = [];
|
|
153439
|
+
if (isPointsLayer) {
|
|
153440
|
+
const MAX_NUM_COLORS = 10;
|
|
153441
|
+
const hasFeatureSelection = Array.isArray(featureSelection) && featureSelection.length > 0;
|
|
153442
|
+
const showUnselected = featureFilterMode !== "featureSelection";
|
|
153443
|
+
if (obsColorEncoding === "spatialLayerColor") {
|
|
153444
|
+
if (!hasFeatureSelection) {
|
|
153445
|
+
pointsLegendElements.push({
|
|
153446
|
+
name: obsLabel,
|
|
153447
|
+
color: staticColor
|
|
153448
|
+
});
|
|
153449
|
+
} else {
|
|
153450
|
+
const limitedFeatureSelection = featureSelection.slice(0, MAX_NUM_COLORS);
|
|
153451
|
+
limitedFeatureSelection.forEach((featureName) => {
|
|
153452
|
+
pointsLegendElements.push({
|
|
153453
|
+
name: featureName,
|
|
153454
|
+
color: staticColor
|
|
153455
|
+
});
|
|
153456
|
+
});
|
|
153457
|
+
}
|
|
153458
|
+
} else if (obsColorEncoding === "geneSelection") {
|
|
153459
|
+
if (!hasFeatureSelection) {
|
|
153460
|
+
pointsLegendElements.push({
|
|
153461
|
+
name: obsLabel,
|
|
153462
|
+
color: staticColor
|
|
153463
|
+
});
|
|
153464
|
+
} else {
|
|
153465
|
+
const limitedFeatureSelection = featureSelection.slice(0, MAX_NUM_COLORS);
|
|
153466
|
+
limitedFeatureSelection.forEach((featureName) => {
|
|
153467
|
+
var _a3;
|
|
153468
|
+
const featureColorMatch = Array.isArray(featureColor) ? (_a3 = featureColor.find((fc) => fc.name === featureName)) == null ? void 0 : _a3.color : null;
|
|
153469
|
+
pointsLegendElements.push({
|
|
153470
|
+
name: featureName,
|
|
153471
|
+
// If no color is specified for this feature, use staticColor.
|
|
153472
|
+
color: featureColorMatch ?? staticColor
|
|
153473
|
+
});
|
|
153474
|
+
});
|
|
153475
|
+
}
|
|
153476
|
+
} else if (obsColorEncoding === "randomByFeature") {
|
|
153477
|
+
if (!hasFeatureSelection) {
|
|
153478
|
+
pointsLegendElements.push({
|
|
153479
|
+
name: obsLabel,
|
|
153480
|
+
// For now, using black and white for this.
|
|
153481
|
+
// (It should not match any color in PALETTE)
|
|
153482
|
+
color: isDarkTheme ? [255, 255, 255] : [0, 0, 0]
|
|
153483
|
+
});
|
|
153484
|
+
} else {
|
|
153485
|
+
const limitedFeatureSelection = featureSelection.slice(0, MAX_NUM_COLORS);
|
|
153486
|
+
limitedFeatureSelection.forEach((featureName) => {
|
|
153487
|
+
const varIndex = (featureIndex ?? []).indexOf(featureName);
|
|
153488
|
+
const featureColorMatch = varIndex >= 0 ? PALETTE[varIndex % PALETTE.length] : null;
|
|
153489
|
+
pointsLegendElements.push({
|
|
153490
|
+
name: featureName,
|
|
153491
|
+
// If no color is specified for this feature, use staticColor.
|
|
153492
|
+
color: featureColorMatch ?? staticColor
|
|
153493
|
+
});
|
|
153494
|
+
});
|
|
153495
|
+
}
|
|
153496
|
+
} else if (obsColorEncoding === "random") {
|
|
153497
|
+
pointsLegendElements.push({
|
|
153498
|
+
name: obsLabel,
|
|
153499
|
+
// For now, using black and white for this.
|
|
153500
|
+
// (It should not match any color in PALETTE)
|
|
153501
|
+
color: isDarkTheme ? [255, 255, 255] : [0, 0, 0]
|
|
153502
|
+
});
|
|
153503
|
+
}
|
|
153504
|
+
if (showUnselected) {
|
|
153505
|
+
pointsLegendElements.push({
|
|
153506
|
+
name: "Unselected",
|
|
153507
|
+
color: getDefaultColor(theme ?? "light")
|
|
153508
|
+
});
|
|
153509
|
+
}
|
|
153510
|
+
}
|
|
153428
153511
|
const levelZeroNames = useMemo(() => Array.from(new Set((obsSetSelection == null ? void 0 : obsSetSelection.map((setPath) => setPath[0])) || [])), [obsSetSelection]);
|
|
153429
|
-
const dynamicHeight =
|
|
153512
|
+
const dynamicHeight = isPointsLayer ? (
|
|
153513
|
+
// Height logic for points layers.
|
|
153514
|
+
pointsLegendElements.length * (rectHeight + rectMarginY) + titleHeight
|
|
153515
|
+
) : (
|
|
153516
|
+
// Height logic for non-points layers.
|
|
153517
|
+
isSetColor && obsSetSelection ? levelZeroNames.length * titleHeight + ((obsSetSelection == null ? void 0 : obsSetSelection.length) ?? 0) * (rectHeight + rectMarginY) : height2 + (!pointsVisible && contoursVisible ? 25 : 0)
|
|
153518
|
+
);
|
|
153430
153519
|
const availHeight = maxHeight2 !== null ? Math.max(0, maxHeight2 - 4) : Infinity;
|
|
153431
153520
|
const needsScroll = Number.isFinite(availHeight) && dynamicHeight > availHeight + 1;
|
|
153432
153521
|
useEffect(() => {
|
|
@@ -153438,8 +153527,8 @@ function Legend(props) {
|
|
|
153438
153527
|
svg.selectAll("g").remove();
|
|
153439
153528
|
svg.attr("width", width2).attr("height", dynamicHeight);
|
|
153440
153529
|
const g2 = svg.append("g").attr("width", width2).attr("height", dynamicHeight);
|
|
153441
|
-
const showInteractiveSlider2 = setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
|
|
153442
|
-
if (!considerSelections || ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "")) {
|
|
153530
|
+
const showInteractiveSlider2 = !isPointsLayer && setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
|
|
153531
|
+
if (!isPointsLayer && (!considerSelections || ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? ""))) {
|
|
153443
153532
|
const combinedExtent = combineExtents(extent2 ?? null, featureAggregationStrategy ?? null) || [0, 1];
|
|
153444
153533
|
const [xMin, xMax] = combinedExtent;
|
|
153445
153534
|
if (featureValueColormap && pointsVisible) {
|
|
@@ -153499,10 +153588,10 @@ function Legend(props) {
|
|
|
153499
153588
|
});
|
|
153500
153589
|
}
|
|
153501
153590
|
}
|
|
153502
|
-
if (isStaticColor) {
|
|
153591
|
+
if (!isPointsLayer && isStaticColor) {
|
|
153503
153592
|
g2.append("rect").attr("x", 0).attr("y", titleHeight).attr("width", width2 - 4).attr("height", rectHeight).attr("fill", `rgb(${staticColor[0]},${staticColor[1]},${staticColor[2]})`);
|
|
153504
153593
|
}
|
|
153505
|
-
if (isSetColor && obsSetSelection && obsSetColor) {
|
|
153594
|
+
if (!isPointsLayer && isSetColor && obsSetSelection && obsSetColor) {
|
|
153506
153595
|
const obsSetSelectionByLevelZero = {};
|
|
153507
153596
|
obsSetSelection.forEach((setPath) => {
|
|
153508
153597
|
const levelZeroName = setPath[0];
|
|
@@ -153524,6 +153613,16 @@ function Legend(props) {
|
|
|
153524
153613
|
});
|
|
153525
153614
|
});
|
|
153526
153615
|
}
|
|
153616
|
+
if (isPointsLayer) {
|
|
153617
|
+
let y = 0;
|
|
153618
|
+
g2.append("text").attr("text-anchor", "start").attr("dominant-baseline", "hanging").attr("x", 0).attr("y", y).text("Points").style("font-size", "9px").style("fill", foregroundColor);
|
|
153619
|
+
y += titleHeight;
|
|
153620
|
+
pointsLegendElements.forEach(({ name: name2, color: color2 }) => {
|
|
153621
|
+
g2.append("rect").attr("x", 0).attr("y", y).attr("width", rectHeight).attr("height", rectHeight).attr("fill", `rgb(${color2[0]},${color2[1]},${color2[2]})`);
|
|
153622
|
+
g2.append("text").attr("text-anchor", "start").attr("dominant-baseline", "hanging").attr("x", rectHeight + rectMarginX).attr("y", y).text(name2).style("font-size", "9px").style("fill", foregroundColor);
|
|
153623
|
+
y += rectHeight + rectMarginY;
|
|
153624
|
+
});
|
|
153625
|
+
}
|
|
153527
153626
|
const featureSelectionLabelRaw = featureSelection && featureSelection.length >= 1 && !isStaticColor ? featureSelection.map((geneName) => (featureLabelsMap == null ? void 0 : featureLabelsMap.get(geneName)) || (featureLabelsMap == null ? void 0 : featureLabelsMap.get(cleanFeatureId(geneName))) || geneName) : null;
|
|
153528
153627
|
let featureSelectionLabelRawStr = "";
|
|
153529
153628
|
if (featureAggregationStrategy === "first") {
|
|
@@ -153550,12 +153649,11 @@ function Legend(props) {
|
|
|
153550
153649
|
}
|
|
153551
153650
|
const combinedMissing = combineMissings(missing ?? null, featureAggregationStrategy ?? null);
|
|
153552
153651
|
const featureSelectionLabel = combinedMissing ? `${featureSelectionLabelRawStr} (${Math.round(combinedMissing * 100)}% NaN)` : featureSelectionLabelRawStr;
|
|
153553
|
-
const obsLabel = capitalize$2(obsType ?? null);
|
|
153554
153652
|
const featureLabel = considerSelections ? featureSelectionLabel || capitalize$2(featureValueType ?? null) : capitalize$2(featureValueType ?? null);
|
|
153555
153653
|
const mainLabel = showObsLabel ? obsLabel : featureLabel;
|
|
153556
153654
|
const subLabel = showObsLabel ? featureLabel : null;
|
|
153557
153655
|
const hasSubLabel = subLabel !== null;
|
|
153558
|
-
if (!isSetColor) {
|
|
153656
|
+
if (!isPointsLayer && !isSetColor) {
|
|
153559
153657
|
g2.append("text").attr("text-anchor", hasSubLabel ? "start" : "end").attr("dominant-baseline", "hanging").attr("x", hasSubLabel ? 0 : width2 - 4).attr("y", 0).text(mainLabel ?? "").style("font-size", "10px").style("fill", foregroundColor);
|
|
153560
153658
|
if (hasSubLabel) {
|
|
153561
153659
|
g2.append("text").attr("text-anchor", "end").attr("dominant-baseline", "hanging").attr("x", width2 - 5).attr("y", titleHeight + rectHeight).text(subLabel ?? "").style("font-size", "9px").style("fill", foregroundColor);
|
|
@@ -153594,7 +153692,7 @@ function Legend(props) {
|
|
|
153594
153692
|
showObsLabel,
|
|
153595
153693
|
staticColor
|
|
153596
153694
|
]);
|
|
153597
|
-
const showInteractiveSlider = setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
|
|
153695
|
+
const showInteractiveSlider = !isPointsLayer && setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
|
|
153598
153696
|
const globalExtent = useMemo(() => {
|
|
153599
153697
|
const combined = combineExtents(extent2 ?? null, featureAggregationStrategy ?? null);
|
|
153600
153698
|
return combined || [0, 1];
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-SxljTded.js";
|
|
2
|
-
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-Bxpb2AKZ.js";
|
|
3
3
|
const LercParameters = {
|
|
4
4
|
AddCompression: 1
|
|
5
5
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/scatterplot-embedding",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"author": "HIDIVE Lab at HMS",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"lodash-es": "^4.17.21",
|
|
21
21
|
"react-aria": "^3.28.0",
|
|
22
22
|
"@turf/circle": "^7.2.0",
|
|
23
|
-
"@vitessce/styles": "3.
|
|
24
|
-
"@vitessce/constants-internal": "3.
|
|
25
|
-
"@vitessce/legend": "3.
|
|
26
|
-
"@vitessce/
|
|
27
|
-
"@vitessce/utils": "3.
|
|
28
|
-
"@vitessce/
|
|
29
|
-
"@vitessce/
|
|
23
|
+
"@vitessce/styles": "3.9.0",
|
|
24
|
+
"@vitessce/constants-internal": "3.9.0",
|
|
25
|
+
"@vitessce/legend": "3.9.0",
|
|
26
|
+
"@vitessce/scatterplot": "3.9.0",
|
|
27
|
+
"@vitessce/sets-utils": "3.9.0",
|
|
28
|
+
"@vitessce/utils": "3.9.0",
|
|
29
|
+
"@vitessce/vit-s": "3.9.0"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"react": "18.3.1",
|