@vitessce/scatterplot-embedding 3.8.13 → 3.9.1

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.
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { B as BaseDecoder } from "./index-BK98jzeZ.js";
2
+ import { B as BaseDecoder } from "./index-DgPOdHp3.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,
@@ -11218,7 +11223,9 @@ const obsSegmentationsSpatialdataSchema = z.object({
11218
11223
  const obsPointsSpatialdataSchema = z.object({
11219
11224
  path: z.string().describe("The path to the point data."),
11220
11225
  tablePath: z.string().optional().describe("The path to a table which annotates the points. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected."),
11221
- coordinateSystem: z.string().optional().describe('The name of a coordinate transformation output used to transform the image. If not provided, the "global" coordinate system is assumed.')
11226
+ coordinateSystem: z.string().optional().describe('The name of a coordinate transformation output used to transform the image. If not provided, the "global" coordinate system is assumed.'),
11227
+ featureIndexColumn: z.string().optional().describe("The name of the column in the table which contains the feature (e.g., gene) indices associated with each point (aligned with the table var.index dataframe column)."),
11228
+ mortonCodeColumn: z.string().optional().describe('The name of the column in the table which contains the Morton codes for each point, used for efficient spatial querying. If not provided, Vitessce will assume the default column name "morton_code_2d".')
11222
11229
  });
11223
11230
  z.object({
11224
11231
  path: z.string(),
@@ -123403,22 +123410,22 @@ function addDecoder(cases, importFn) {
123403
123410
  }
123404
123411
  cases.forEach((c2) => registry$1.set(c2, importFn));
123405
123412
  }
123406
- addDecoder([void 0, 1], () => import("./raw-CDyxv3KP.js").then((m2) => m2.default));
123407
- addDecoder(5, () => import("./lzw--H4kL7kE.js").then((m2) => m2.default));
123413
+ addDecoder([void 0, 1], () => import("./raw-Cv7A6Is8.js").then((m2) => m2.default));
123414
+ addDecoder(5, () => import("./lzw-BdbvO0aS.js").then((m2) => m2.default));
123408
123415
  addDecoder(6, () => {
123409
123416
  throw new Error("old style JPEG compression is not supported.");
123410
123417
  });
123411
- addDecoder(7, () => import("./jpeg-Ci-wqRKm.js").then((m2) => m2.default));
123412
- addDecoder([8, 32946], () => import("./deflate-ClaAmriP.js").then((m2) => m2.default));
123413
- addDecoder(32773, () => import("./packbits-zSU7Xz9P.js").then((m2) => m2.default));
123418
+ addDecoder(7, () => import("./jpeg-C9Q09Dvz.js").then((m2) => m2.default));
123419
+ addDecoder([8, 32946], () => import("./deflate-Vi0b2b-T.js").then((m2) => m2.default));
123420
+ addDecoder(32773, () => import("./packbits-CLr-1bFS.js").then((m2) => m2.default));
123414
123421
  addDecoder(
123415
123422
  34887,
123416
- () => import("./lerc-S2pXAGyz.js").then(async (m2) => {
123423
+ () => import("./lerc-C3dlbBvE.js").then(async (m2) => {
123417
123424
  await m2.zstd.init();
123418
123425
  return m2;
123419
123426
  }).then((m2) => m2.default)
123420
123427
  );
123421
- addDecoder(50001, () => import("./webimage-dTZh6fML.js").then((m2) => m2.default));
123428
+ addDecoder(50001, () => import("./webimage-BI60-gR7.js").then((m2) => m2.default));
123422
123429
  function decodeRowAcc(row, stride) {
123423
123430
  let length2 = row.length - stride;
123424
123431
  let offset2 = 0;
@@ -153368,6 +153375,7 @@ function Legend(props) {
153368
153375
  positionRelative = false,
153369
153376
  highContrast = false,
153370
153377
  obsType,
153378
+ isPointsLayer = false,
153371
153379
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
153372
153380
  featureType: _featureType = void 0,
153373
153381
  // Unused but accepted for API compatibility
@@ -153375,6 +153383,9 @@ function Legend(props) {
153375
153383
  considerSelections = true,
153376
153384
  obsColorEncoding,
153377
153385
  featureSelection,
153386
+ featureFilterMode,
153387
+ featureColor,
153388
+ featureIndex,
153378
153389
  featureLabelsMap,
153379
153390
  featureValueColormap,
153380
153391
  featureValueColormapRange,
@@ -153418,15 +153429,95 @@ function Legend(props) {
153418
153429
  debouncedSetRange(rangeValue);
153419
153430
  }
153420
153431
  }, [debouncedSetRange]);
153432
+ const obsLabel = capitalize$2(obsType ?? null);
153421
153433
  const isDarkTheme = theme === "dark";
153422
- const isStaticColor = obsColorEncoding === "spatialChannelColor" || obsColorEncoding === "spatialLayerColor";
153423
- const isSetColor = obsColorEncoding === "cellSetSelection";
153434
+ const isStaticColor = !isPointsLayer && (obsColorEncoding === "spatialChannelColor" || obsColorEncoding === "spatialLayerColor");
153435
+ const isSetColor = !isPointsLayer && obsColorEncoding === "cellSetSelection";
153424
153436
  const layerColor = Array.isArray(spatialLayerColor) && spatialLayerColor.length === 3 ? spatialLayerColor : getDefaultColor(theme ?? "light");
153425
153437
  const channelColor = Array.isArray(spatialChannelColor) && spatialChannelColor.length === 3 ? spatialChannelColor : getDefaultColor(theme ?? "light");
153426
153438
  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);
153439
+ 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);
153440
+ const pointsLegendElements = [];
153441
+ if (isPointsLayer) {
153442
+ const MAX_NUM_COLORS = 10;
153443
+ const hasFeatureSelection = Array.isArray(featureSelection) && featureSelection.length > 0;
153444
+ const showUnselected = featureFilterMode !== "featureSelection";
153445
+ if (obsColorEncoding === "spatialLayerColor") {
153446
+ if (!hasFeatureSelection) {
153447
+ pointsLegendElements.push({
153448
+ name: obsLabel,
153449
+ color: staticColor
153450
+ });
153451
+ } else {
153452
+ const limitedFeatureSelection = featureSelection.slice(0, MAX_NUM_COLORS);
153453
+ limitedFeatureSelection.forEach((featureName) => {
153454
+ pointsLegendElements.push({
153455
+ name: featureName,
153456
+ color: staticColor
153457
+ });
153458
+ });
153459
+ }
153460
+ } else if (obsColorEncoding === "geneSelection") {
153461
+ if (!hasFeatureSelection) {
153462
+ pointsLegendElements.push({
153463
+ name: obsLabel,
153464
+ color: staticColor
153465
+ });
153466
+ } else {
153467
+ const limitedFeatureSelection = featureSelection.slice(0, MAX_NUM_COLORS);
153468
+ limitedFeatureSelection.forEach((featureName) => {
153469
+ var _a3;
153470
+ const featureColorMatch = Array.isArray(featureColor) ? (_a3 = featureColor.find((fc) => fc.name === featureName)) == null ? void 0 : _a3.color : null;
153471
+ pointsLegendElements.push({
153472
+ name: featureName,
153473
+ // If no color is specified for this feature, use staticColor.
153474
+ color: featureColorMatch ?? staticColor
153475
+ });
153476
+ });
153477
+ }
153478
+ } else if (obsColorEncoding === "randomByFeature") {
153479
+ if (!hasFeatureSelection) {
153480
+ pointsLegendElements.push({
153481
+ name: obsLabel,
153482
+ // For now, using black and white for this.
153483
+ // (It should not match any color in PALETTE)
153484
+ color: isDarkTheme ? [255, 255, 255] : [0, 0, 0]
153485
+ });
153486
+ } else {
153487
+ const limitedFeatureSelection = featureSelection.slice(0, MAX_NUM_COLORS);
153488
+ limitedFeatureSelection.forEach((featureName) => {
153489
+ const varIndex = (featureIndex ?? []).indexOf(featureName);
153490
+ const featureColorMatch = varIndex >= 0 ? PALETTE[varIndex % PALETTE.length] : null;
153491
+ pointsLegendElements.push({
153492
+ name: featureName,
153493
+ // If no color is specified for this feature, use staticColor.
153494
+ color: featureColorMatch ?? staticColor
153495
+ });
153496
+ });
153497
+ }
153498
+ } else if (obsColorEncoding === "random") {
153499
+ pointsLegendElements.push({
153500
+ name: obsLabel,
153501
+ // For now, using black and white for this.
153502
+ // (It should not match any color in PALETTE)
153503
+ color: isDarkTheme ? [255, 255, 255] : [0, 0, 0]
153504
+ });
153505
+ }
153506
+ if (showUnselected) {
153507
+ pointsLegendElements.push({
153508
+ name: "Unselected",
153509
+ color: getDefaultColor(theme ?? "light")
153510
+ });
153511
+ }
153512
+ }
153428
153513
  const levelZeroNames = useMemo(() => Array.from(new Set((obsSetSelection == null ? void 0 : obsSetSelection.map((setPath) => setPath[0])) || [])), [obsSetSelection]);
153429
- const dynamicHeight = isSetColor && obsSetSelection ? levelZeroNames.length * titleHeight + ((obsSetSelection == null ? void 0 : obsSetSelection.length) ?? 0) * (rectHeight + rectMarginY) : height2 + (!pointsVisible && contoursVisible ? 25 : 0);
153514
+ const dynamicHeight = isPointsLayer ? (
153515
+ // Height logic for points layers.
153516
+ pointsLegendElements.length * (rectHeight + rectMarginY) + titleHeight
153517
+ ) : (
153518
+ // Height logic for non-points layers.
153519
+ isSetColor && obsSetSelection ? levelZeroNames.length * titleHeight + ((obsSetSelection == null ? void 0 : obsSetSelection.length) ?? 0) * (rectHeight + rectMarginY) : height2 + (!pointsVisible && contoursVisible ? 25 : 0)
153520
+ );
153430
153521
  const availHeight = maxHeight2 !== null ? Math.max(0, maxHeight2 - 4) : Infinity;
153431
153522
  const needsScroll = Number.isFinite(availHeight) && dynamicHeight > availHeight + 1;
153432
153523
  useEffect(() => {
@@ -153438,8 +153529,8 @@ function Legend(props) {
153438
153529
  svg.selectAll("g").remove();
153439
153530
  svg.attr("width", width2).attr("height", dynamicHeight);
153440
153531
  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 ?? "")) {
153532
+ const showInteractiveSlider2 = !isPointsLayer && setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
153533
+ if (!isPointsLayer && (!considerSelections || ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? ""))) {
153443
153534
  const combinedExtent = combineExtents(extent2 ?? null, featureAggregationStrategy ?? null) || [0, 1];
153444
153535
  const [xMin, xMax] = combinedExtent;
153445
153536
  if (featureValueColormap && pointsVisible) {
@@ -153499,10 +153590,10 @@ function Legend(props) {
153499
153590
  });
153500
153591
  }
153501
153592
  }
153502
- if (isStaticColor) {
153593
+ if (!isPointsLayer && isStaticColor) {
153503
153594
  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
153595
  }
153505
- if (isSetColor && obsSetSelection && obsSetColor) {
153596
+ if (!isPointsLayer && isSetColor && obsSetSelection && obsSetColor) {
153506
153597
  const obsSetSelectionByLevelZero = {};
153507
153598
  obsSetSelection.forEach((setPath) => {
153508
153599
  const levelZeroName = setPath[0];
@@ -153524,6 +153615,16 @@ function Legend(props) {
153524
153615
  });
153525
153616
  });
153526
153617
  }
153618
+ if (isPointsLayer) {
153619
+ let y = 0;
153620
+ 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);
153621
+ y += titleHeight;
153622
+ pointsLegendElements.forEach(({ name: name2, color: color2 }) => {
153623
+ g2.append("rect").attr("x", 0).attr("y", y).attr("width", rectHeight).attr("height", rectHeight).attr("fill", `rgb(${color2[0]},${color2[1]},${color2[2]})`);
153624
+ 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);
153625
+ y += rectHeight + rectMarginY;
153626
+ });
153627
+ }
153527
153628
  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
153629
  let featureSelectionLabelRawStr = "";
153529
153630
  if (featureAggregationStrategy === "first") {
@@ -153550,12 +153651,11 @@ function Legend(props) {
153550
153651
  }
153551
153652
  const combinedMissing = combineMissings(missing ?? null, featureAggregationStrategy ?? null);
153552
153653
  const featureSelectionLabel = combinedMissing ? `${featureSelectionLabelRawStr} (${Math.round(combinedMissing * 100)}% NaN)` : featureSelectionLabelRawStr;
153553
- const obsLabel = capitalize$2(obsType ?? null);
153554
153654
  const featureLabel = considerSelections ? featureSelectionLabel || capitalize$2(featureValueType ?? null) : capitalize$2(featureValueType ?? null);
153555
153655
  const mainLabel = showObsLabel ? obsLabel : featureLabel;
153556
153656
  const subLabel = showObsLabel ? featureLabel : null;
153557
153657
  const hasSubLabel = subLabel !== null;
153558
- if (!isSetColor) {
153658
+ if (!isPointsLayer && !isSetColor) {
153559
153659
  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
153660
  if (hasSubLabel) {
153561
153661
  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 +153694,7 @@ function Legend(props) {
153594
153694
  showObsLabel,
153595
153695
  staticColor
153596
153696
  ]);
153597
- const showInteractiveSlider = setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
153697
+ const showInteractiveSlider = !isPointsLayer && setFeatureValueColormapRange && ["geneSelection", "geneExpression"].includes(obsColorEncoding ?? "") && pointsVisible && featureValueColormap;
153598
153698
  const globalExtent = useMemo(() => {
153599
153699
  const combined = combineExtents(extent2 ?? null, featureAggregationStrategy ?? null);
153600
153700
  return combined || [0, 1];
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, E } from "./index-BK98jzeZ.js";
1
+ import { D, E } from "./index-DgPOdHp3.js";
2
2
  export {
3
3
  D as DualEmbeddingScatterplotSubscriber,
4
4
  E as EmbeddingScatterplotSubscriber
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-BK98jzeZ.js";
1
+ import { B as BaseDecoder } from "./index-DgPOdHp3.js";
2
2
  const dctZigZag = new Int32Array([
3
3
  0,
4
4
  1,
@@ -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-BK98jzeZ.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-DgPOdHp3.js";
3
3
  const LercParameters = {
4
4
  AddCompression: 1
5
5
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-BK98jzeZ.js";
1
+ import { B as BaseDecoder } from "./index-DgPOdHp3.js";
2
2
  const MIN_BITS = 9;
3
3
  const CLEAR_CODE = 256;
4
4
  const EOI_CODE = 257;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-BK98jzeZ.js";
1
+ import { B as BaseDecoder } from "./index-DgPOdHp3.js";
2
2
  class PackbitsDecoder extends BaseDecoder {
3
3
  decodeBlock(buffer) {
4
4
  const dataView = new DataView(buffer);
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-BK98jzeZ.js";
1
+ import { B as BaseDecoder } from "./index-DgPOdHp3.js";
2
2
  class RawDecoder extends BaseDecoder {
3
3
  decodeBlock(buffer) {
4
4
  return buffer;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-BK98jzeZ.js";
1
+ import { B as BaseDecoder } from "./index-DgPOdHp3.js";
2
2
  class WebImageDecoder extends BaseDecoder {
3
3
  constructor() {
4
4
  super();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/scatterplot-embedding",
3
- "version": "3.8.13",
3
+ "version": "3.9.1",
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.8.13",
24
- "@vitessce/constants-internal": "3.8.13",
25
- "@vitessce/legend": "3.8.13",
26
- "@vitessce/sets-utils": "3.8.13",
27
- "@vitessce/utils": "3.8.13",
28
- "@vitessce/vit-s": "3.8.13",
29
- "@vitessce/scatterplot": "3.8.13"
23
+ "@vitessce/constants-internal": "3.9.1",
24
+ "@vitessce/scatterplot": "3.9.1",
25
+ "@vitessce/styles": "3.9.1",
26
+ "@vitessce/legend": "3.9.1",
27
+ "@vitessce/sets-utils": "3.9.1",
28
+ "@vitessce/utils": "3.9.1",
29
+ "@vitessce/vit-s": "3.9.1"
30
30
  },
31
31
  "devDependencies": {
32
32
  "react": "18.3.1",