@vitessce/scatterplot-embedding 3.6.18 → 3.7.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.
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { B as BaseDecoder } from "./index-DiAoKAaO.js";
2
+ import { B as BaseDecoder } from "./index-C-fHO-yW.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -122230,6 +122230,8 @@ const PIXELATED_TEXTURE_PARAMETERS = {
122230
122230
  [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
122231
122231
  };
122232
122232
  const GLSL_COLORMAPS = [
122233
+ // NOTE: the ordering of these is important,
122234
+ // as the shader code in bitmask-layer-beta-shaders hardcodes their indices.
122233
122235
  "plasma",
122234
122236
  "viridis",
122235
122237
  "jet",
@@ -123323,22 +123325,22 @@ function addDecoder(cases, importFn) {
123323
123325
  }
123324
123326
  cases.forEach((c2) => registry$1.set(c2, importFn));
123325
123327
  }
123326
- addDecoder([void 0, 1], () => import("./raw-HSp42GhA.js").then((m2) => m2.default));
123327
- addDecoder(5, () => import("./lzw-BhXUNPHF.js").then((m2) => m2.default));
123328
+ addDecoder([void 0, 1], () => import("./raw-DPiyC-FS.js").then((m2) => m2.default));
123329
+ addDecoder(5, () => import("./lzw-DfvLVwpS.js").then((m2) => m2.default));
123328
123330
  addDecoder(6, () => {
123329
123331
  throw new Error("old style JPEG compression is not supported.");
123330
123332
  });
123331
- addDecoder(7, () => import("./jpeg-DUYY678x.js").then((m2) => m2.default));
123332
- addDecoder([8, 32946], () => import("./deflate-Ccvs6Lib.js").then((m2) => m2.default));
123333
- addDecoder(32773, () => import("./packbits-D_7psHiO.js").then((m2) => m2.default));
123333
+ addDecoder(7, () => import("./jpeg-BBthUkDM.js").then((m2) => m2.default));
123334
+ addDecoder([8, 32946], () => import("./deflate-D_81Ious.js").then((m2) => m2.default));
123335
+ addDecoder(32773, () => import("./packbits-DsAbIEQN.js").then((m2) => m2.default));
123334
123336
  addDecoder(
123335
123337
  34887,
123336
- () => import("./lerc-C2z5Ot31.js").then(async (m2) => {
123338
+ () => import("./lerc-CFLZifbF.js").then(async (m2) => {
123337
123339
  await m2.zstd.init();
123338
123340
  return m2;
123339
123341
  }).then((m2) => m2.default)
123340
123342
  );
123341
- addDecoder(50001, () => import("./webimage-CaeLt8Sq.js").then((m2) => m2.default));
123343
+ addDecoder(50001, () => import("./webimage-BvW55TuC.js").then((m2) => m2.default));
123342
123344
  function decodeRowAcc(row, stride) {
123343
123345
  let length2 = row.length - stride;
123344
123346
  let offset2 = 0;
@@ -133121,7 +133123,7 @@ uniform float channelOpacities[7];
133121
133123
  uniform bool channelIsStaticColorMode[7]; // TODO: should this be a single float?
133122
133124
  uniform bool channelIsSetColorMode[7]; // TODO: should this be a single float?
133123
133125
 
133124
- // TODO: can array of tuples/vec2 be used?
133126
+ uniform int channelColormapFuncIndices[7];
133125
133127
  uniform float channelColormapRangeStarts[7];
133126
133128
  uniform float channelColormapRangeEnds[7];
133127
133129
 
@@ -133187,7 +133189,30 @@ vec3 sampleAndGetData(sampler2D dataTex, vec2 coord, bool isFilled, float stroke
133187
133189
  return vec3(clampedSampledData * float(isOn), sampledData, float(isEdge));
133188
133190
  }
133189
133191
 
133190
- vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
133192
+ vec3 colormapFunc(float clampedScaledExpressionValue, int colormapIndex) {
133193
+ // Map indices of GLSL_COLORMAPS array to their function calls.
133194
+ // GLSL_COLORMAPS is defined in ./constants.js and needs to stay manually synced.
133195
+ // 0: 'plasma',
133196
+ // 1: 'viridis',
133197
+ // 2: 'jet',
133198
+ // 3: 'greys',
133199
+
133200
+ if (colormapIndex <= 0) {
133201
+ // This should also match -1, to account for a failed Array.indexOf lookup.
133202
+ return plasma(clampedScaledExpressionValue).rgb;
133203
+ }
133204
+ if (colormapIndex == 1) {
133205
+ return viridis(clampedScaledExpressionValue).rgb;
133206
+ }
133207
+ if (colormapIndex == 2) {
133208
+ return jet(clampedScaledExpressionValue).rgb;
133209
+ }
133210
+ if (colormapIndex == 3) {
133211
+ return greys(clampedScaledExpressionValue).rgb;
133212
+ }
133213
+ }
133214
+
133215
+ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, int colormapFuncIndex, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
133191
133216
  float clampedSampledDataAndIsOn = sampledDataAndIsEdge.x;
133192
133217
  float sampledData = sampledDataAndIsEdge.y;
133193
133218
  float isEdge = sampledDataAndIsEdge.z;
@@ -133231,7 +133256,7 @@ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channel
133231
133256
  }
133232
133257
 
133233
133258
 
133234
- vec4 sampledColor = (1. - (float(isStaticColorMode) + float(isSetColorMode))) * vec4(COLORMAP_FUNC(clamp(scaledExpressionValue, 0.0, 1.0)).rgb, channelOpacity) + float(isStaticColorMode) * vec4(channelColor.rgb, channelOpacity) + float(isSetColorMode) * vec4(setColor, channelOpacity);
133259
+ vec4 sampledColor = (1. - (float(isStaticColorMode) + float(isSetColorMode))) * vec4(colormapFunc(clamp(scaledExpressionValue, 0.0, 1.0), colormapFuncIndex).rgb, channelOpacity) + float(isStaticColorMode) * vec4(channelColor.rgb, channelOpacity) + float(isSetColorMode) * vec4(setColor, channelOpacity);
133235
133260
  // Only return a color if the data is non-zero.
133236
133261
 
133237
133262
  return clampedSampledDataAndIsOn * isEdge * sampledColor;
@@ -133247,15 +133272,15 @@ void main() {
133247
133272
  vec3 dat4 = sampleAndGetData(channel4, vTexCoord, channelsFilled[4], channelStrokeWidths[4], channelsVisible[4]);
133248
133273
  vec3 dat5 = sampleAndGetData(channel5, vTexCoord, channelsFilled[5], channelStrokeWidths[5], channelsVisible[5]);
133249
133274
  vec3 dat6 = sampleAndGetData(channel6, vTexCoord, channelsFilled[6], channelStrokeWidths[6], channelsVisible[6]);
133250
-
133251
- vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
133252
- vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
133253
- vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
133254
- vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
133255
- vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
133256
- vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
133257
- vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
133258
-
133275
+
133276
+ vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapFuncIndices[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
133277
+ vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapFuncIndices[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
133278
+ vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapFuncIndices[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
133279
+ vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapFuncIndices[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
133280
+ vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapFuncIndices[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
133281
+ vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapFuncIndices[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
133282
+ vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapFuncIndices[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
133283
+
133259
133284
  // If all of the channels are "empty", then discard this pixel so that it is not considered during picking.
133260
133285
  float emptyDat = 0.;
133261
133286
  if(dat0.x == emptyDat && dat1.x == emptyDat && dat2.x == emptyDat && dat3.x == emptyDat && dat4.x == emptyDat && dat5.x == emptyDat && dat6.x == emptyDat) {
@@ -133411,14 +133436,10 @@ const defaultProps$2 = {
133411
133436
  class BitmaskLayer2 extends XRLayer {
133412
133437
  // eslint-disable-next-line class-methods-use-this
133413
133438
  getShaders() {
133414
- const { colormap } = this.props;
133415
133439
  return {
133416
133440
  fs,
133417
133441
  vs,
133418
- modules: [project32, picking],
133419
- defines: {
133420
- [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
133421
- }
133442
+ modules: [project32, picking]
133422
133443
  };
133423
133444
  }
133424
133445
  /**
@@ -133477,8 +133498,6 @@ class BitmaskLayer2 extends XRLayer {
133477
133498
  channelOpacities,
133478
133499
  channelColors,
133479
133500
  channelsVisible,
133480
- // TODO: use `channelFeatureValueColormaps` in shader,
133481
- // figure out how to call multiple GLSL colormap functions
133482
133501
  channelFeatureValueColormaps,
133483
133502
  channelFeatureValueColormapRanges,
133484
133503
  channelIsStaticColorMode,
@@ -133539,6 +133558,12 @@ class BitmaskLayer2 extends XRLayer {
133539
133558
  // There are six texture entries on the shaders
133540
133559
  MAX_CHANNELS - channelStrokeWidths.length
133541
133560
  ),
133561
+ channelColormapFuncIndices: padWithDefault(
133562
+ channelFeatureValueColormaps.map((d) => GLSL_COLORMAPS.indexOf(d)),
133563
+ 0,
133564
+ // There are six texture entries on the shaders
133565
+ MAX_CHANNELS - channelFeatureValueColormaps.length
133566
+ ),
133542
133567
  channelColormapRangeStarts: padWithDefault(
133543
133568
  channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[0]) || 0),
133544
133569
  0,
@@ -153146,7 +153171,7 @@ function combineMissings(missings, featureAggregationStrategy) {
153146
153171
  return null;
153147
153172
  }
153148
153173
  function Legend(props) {
153149
- const { visible: visibleProp, positionRelative = false, highContrast = false, obsType, featureValueType, considerSelections = true, obsColorEncoding, featureSelection, featureLabelsMap, featureValueColormap, featureValueColormapRange, spatialChannelColor, spatialLayerColor, obsSetSelection, obsSetColor, featureAggregationStrategy, extent: extent2, missing, width: width2 = 100, height: height2 = 36, theme, showObsLabel = false, pointsVisible = true, contoursVisible = false, contoursFilled, contourPercentiles, contourThresholds } = props;
153174
+ const { visible: visibleProp, positionRelative = false, highContrast = false, obsType, featureValueType, considerSelections = true, obsColorEncoding, featureSelection, featureLabelsMap, featureValueColormap, featureValueColormapRange, spatialChannelColor, spatialLayerColor, obsSetSelection, obsSetColor, featureAggregationStrategy, extent: extent2, missing, width: width2 = 100, height: height2 = 36, maxHeight: maxHeight2 = null, theme, showObsLabel = false, pointsVisible = true, contoursVisible = false, contoursFilled, contourPercentiles, contourThresholds } = props;
153150
153175
  const svgRef = useRef();
153151
153176
  const { classes } = useStyles();
153152
153177
  const isDarkTheme = theme === "dark";
@@ -153158,6 +153183,8 @@ function Legend(props) {
153158
153183
  const visible = visibleProp && (!considerSelections || obsColorEncoding === "geneSelection" && featureSelection && Array.isArray(featureSelection) && featureSelection.length >= 1 || isSetColor && (obsSetSelection == null ? void 0 : obsSetSelection.length) > 0 && (obsSetColor == null ? void 0 : obsSetColor.length) > 0 || isStaticColor);
153159
153184
  const levelZeroNames = useMemo(() => Array.from(new Set((obsSetSelection == null ? void 0 : obsSetSelection.map((setPath) => setPath[0])) || [])), [obsSetSelection]);
153160
153185
  const dynamicHeight = isSetColor && obsSetSelection ? levelZeroNames.length * titleHeight + (obsSetSelection == null ? void 0 : obsSetSelection.length) * (rectHeight + rectMarginY) : height2 + (!pointsVisible && contoursVisible ? 25 : 0);
153186
+ const availHeight = maxHeight2 !== null ? Math.max(0, maxHeight2 - 4) : Infinity;
153187
+ const needsScroll = Number.isFinite(availHeight) && dynamicHeight > availHeight + 1;
153161
153188
  useEffect(() => {
153162
153189
  const domElement = svgRef.current;
153163
153190
  const foregroundColor = highContrast ? "black" : isDarkTheme ? "white" : "black";
@@ -153290,7 +153317,9 @@ function Legend(props) {
153290
153317
  [classes.legendHighContrast]: highContrast,
153291
153318
  [classes.legendLowContrast]: !highContrast,
153292
153319
  [classes.legendInvisible]: !visible
153293
- }), children: jsxRuntimeExports.jsx("svg", { ref: svgRef, style: {
153320
+ }), style: {
153321
+ ...needsScroll ? { maxHeight: `${Math.floor(availHeight)}px`, overflowY: "auto" } : { maxHeight: void 0, overflowY: "visible" }
153322
+ }, children: jsxRuntimeExports.jsx("svg", { ref: svgRef, style: {
153294
153323
  width: `${width2}px`,
153295
153324
  height: `${dynamicHeight}px`
153296
153325
  } }) });
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, E } from "./index-DiAoKAaO.js";
1
+ import { D, E } from "./index-C-fHO-yW.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-DiAoKAaO.js";
1
+ import { B as BaseDecoder } from "./index-C-fHO-yW.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-DiAoKAaO.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-C-fHO-yW.js";
3
3
  const LercParameters = {
4
4
  AddCompression: 1
5
5
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-DiAoKAaO.js";
1
+ import { B as BaseDecoder } from "./index-C-fHO-yW.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-DiAoKAaO.js";
1
+ import { B as BaseDecoder } from "./index-C-fHO-yW.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-DiAoKAaO.js";
1
+ import { B as BaseDecoder } from "./index-C-fHO-yW.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-DiAoKAaO.js";
1
+ import { B as BaseDecoder } from "./index-C-fHO-yW.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.6.18",
3
+ "version": "3.7.0",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -20,25 +20,25 @@
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.6.18",
24
- "@vitessce/constants-internal": "3.6.18",
25
- "@vitessce/legend": "3.6.18",
26
- "@vitessce/scatterplot": "3.6.18",
27
- "@vitessce/sets-utils": "3.6.18",
28
- "@vitessce/utils": "3.6.18",
29
- "@vitessce/vit-s": "3.6.18"
23
+ "@vitessce/styles": "3.7.0",
24
+ "@vitessce/constants-internal": "3.7.0",
25
+ "@vitessce/legend": "3.7.0",
26
+ "@vitessce/scatterplot": "3.7.0",
27
+ "@vitessce/sets-utils": "3.7.0",
28
+ "@vitessce/utils": "3.7.0",
29
+ "@vitessce/vit-s": "3.7.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "react": "^18.0.0",
33
33
  "react-dom": "^18.0.0",
34
- "vite": "^6.3.5",
34
+ "vite": "^7.0.0",
35
35
  "vitest": "^3.1.4"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
39
39
  },
40
40
  "scripts": {
41
- "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
41
+ "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",
42
42
  "test": "pnpm exec vitest --run"
43
43
  },
44
44
  "module": "dist/index.js",