@vitessce/heatmap 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-gbnJAInw.js";
2
+ import { B as BaseDecoder } from "./index-wqNAdDqn.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -33632,7 +33632,7 @@ function combineMissings(missings, featureAggregationStrategy) {
33632
33632
  return null;
33633
33633
  }
33634
33634
  function Legend(props) {
33635
- 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;
33635
+ 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;
33636
33636
  const svgRef = useRef();
33637
33637
  const { classes } = useStyles$2();
33638
33638
  const isDarkTheme = theme === "dark";
@@ -33644,6 +33644,8 @@ function Legend(props) {
33644
33644
  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);
33645
33645
  const levelZeroNames = useMemo(() => Array.from(new Set((obsSetSelection == null ? void 0 : obsSetSelection.map((setPath) => setPath[0])) || [])), [obsSetSelection]);
33646
33646
  const dynamicHeight = isSetColor && obsSetSelection ? levelZeroNames.length * titleHeight + (obsSetSelection == null ? void 0 : obsSetSelection.length) * (rectHeight + rectMarginY) : height2 + (!pointsVisible && contoursVisible ? 25 : 0);
33647
+ const availHeight = maxHeight2 !== null ? Math.max(0, maxHeight2 - 4) : Infinity;
33648
+ const needsScroll = Number.isFinite(availHeight) && dynamicHeight > availHeight + 1;
33647
33649
  useEffect(() => {
33648
33650
  const domElement = svgRef.current;
33649
33651
  const foregroundColor = highContrast ? "black" : isDarkTheme ? "white" : "black";
@@ -33776,7 +33778,9 @@ function Legend(props) {
33776
33778
  [classes.legendHighContrast]: highContrast,
33777
33779
  [classes.legendLowContrast]: !highContrast,
33778
33780
  [classes.legendInvisible]: !visible
33779
- }), children: jsxRuntimeExports.jsx("svg", { ref: svgRef, style: {
33781
+ }), style: {
33782
+ ...needsScroll ? { maxHeight: `${Math.floor(availHeight)}px`, overflowY: "auto" } : { maxHeight: void 0, overflowY: "visible" }
33783
+ }, children: jsxRuntimeExports.jsx("svg", { ref: svgRef, style: {
33780
33784
  width: `${width2}px`,
33781
33785
  height: `${dynamicHeight}px`
33782
33786
  } }) });
@@ -136708,6 +136712,8 @@ const PIXELATED_TEXTURE_PARAMETERS = {
136708
136712
  [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
136709
136713
  };
136710
136714
  const GLSL_COLORMAPS = [
136715
+ // NOTE: the ordering of these is important,
136716
+ // as the shader code in bitmask-layer-beta-shaders hardcodes their indices.
136711
136717
  "plasma",
136712
136718
  "viridis",
136713
136719
  "jet",
@@ -137800,22 +137806,22 @@ function addDecoder(cases, importFn) {
137800
137806
  }
137801
137807
  cases.forEach((c) => registry$1.set(c, importFn));
137802
137808
  }
137803
- addDecoder([void 0, 1], () => import("./raw-BqSl12fx.js").then((m) => m.default));
137804
- addDecoder(5, () => import("./lzw-DmLr47v3.js").then((m) => m.default));
137809
+ addDecoder([void 0, 1], () => import("./raw-RUWYtfg3.js").then((m) => m.default));
137810
+ addDecoder(5, () => import("./lzw-PVTKOGZx.js").then((m) => m.default));
137805
137811
  addDecoder(6, () => {
137806
137812
  throw new Error("old style JPEG compression is not supported.");
137807
137813
  });
137808
- addDecoder(7, () => import("./jpeg-D4w6F2QL.js").then((m) => m.default));
137809
- addDecoder([8, 32946], () => import("./deflate-9nZ87Z1F.js").then((m) => m.default));
137810
- addDecoder(32773, () => import("./packbits-BXfNep8e.js").then((m) => m.default));
137814
+ addDecoder(7, () => import("./jpeg-BOEyAvbW.js").then((m) => m.default));
137815
+ addDecoder([8, 32946], () => import("./deflate-BBecmfW2.js").then((m) => m.default));
137816
+ addDecoder(32773, () => import("./packbits-CIowXOvq.js").then((m) => m.default));
137811
137817
  addDecoder(
137812
137818
  34887,
137813
- () => import("./lerc-DDvnNSMa.js").then(async (m) => {
137819
+ () => import("./lerc-Dfs0vw1A.js").then(async (m) => {
137814
137820
  await m.zstd.init();
137815
137821
  return m;
137816
137822
  }).then((m) => m.default)
137817
137823
  );
137818
- addDecoder(50001, () => import("./webimage-DRT49Aaq.js").then((m) => m.default));
137824
+ addDecoder(50001, () => import("./webimage-hdqqAfOj.js").then((m) => m.default));
137819
137825
  function decodeRowAcc(row, stride) {
137820
137826
  let length2 = row.length - stride;
137821
137827
  let offset2 = 0;
@@ -147598,7 +147604,7 @@ uniform float channelOpacities[7];
147598
147604
  uniform bool channelIsStaticColorMode[7]; // TODO: should this be a single float?
147599
147605
  uniform bool channelIsSetColorMode[7]; // TODO: should this be a single float?
147600
147606
 
147601
- // TODO: can array of tuples/vec2 be used?
147607
+ uniform int channelColormapFuncIndices[7];
147602
147608
  uniform float channelColormapRangeStarts[7];
147603
147609
  uniform float channelColormapRangeEnds[7];
147604
147610
 
@@ -147664,7 +147670,30 @@ vec3 sampleAndGetData(sampler2D dataTex, vec2 coord, bool isFilled, float stroke
147664
147670
  return vec3(clampedSampledData * float(isOn), sampledData, float(isEdge));
147665
147671
  }
147666
147672
 
147667
- vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
147673
+ vec3 colormapFunc(float clampedScaledExpressionValue, int colormapIndex) {
147674
+ // Map indices of GLSL_COLORMAPS array to their function calls.
147675
+ // GLSL_COLORMAPS is defined in ./constants.js and needs to stay manually synced.
147676
+ // 0: 'plasma',
147677
+ // 1: 'viridis',
147678
+ // 2: 'jet',
147679
+ // 3: 'greys',
147680
+
147681
+ if (colormapIndex <= 0) {
147682
+ // This should also match -1, to account for a failed Array.indexOf lookup.
147683
+ return plasma(clampedScaledExpressionValue).rgb;
147684
+ }
147685
+ if (colormapIndex == 1) {
147686
+ return viridis(clampedScaledExpressionValue).rgb;
147687
+ }
147688
+ if (colormapIndex == 2) {
147689
+ return jet(clampedScaledExpressionValue).rgb;
147690
+ }
147691
+ if (colormapIndex == 3) {
147692
+ return greys(clampedScaledExpressionValue).rgb;
147693
+ }
147694
+ }
147695
+
147696
+ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, int colormapFuncIndex, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
147668
147697
  float clampedSampledDataAndIsOn = sampledDataAndIsEdge.x;
147669
147698
  float sampledData = sampledDataAndIsEdge.y;
147670
147699
  float isEdge = sampledDataAndIsEdge.z;
@@ -147708,7 +147737,7 @@ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channel
147708
147737
  }
147709
147738
 
147710
147739
 
147711
- 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);
147740
+ 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);
147712
147741
  // Only return a color if the data is non-zero.
147713
147742
 
147714
147743
  return clampedSampledDataAndIsOn * isEdge * sampledColor;
@@ -147724,15 +147753,15 @@ void main() {
147724
147753
  vec3 dat4 = sampleAndGetData(channel4, vTexCoord, channelsFilled[4], channelStrokeWidths[4], channelsVisible[4]);
147725
147754
  vec3 dat5 = sampleAndGetData(channel5, vTexCoord, channelsFilled[5], channelStrokeWidths[5], channelsVisible[5]);
147726
147755
  vec3 dat6 = sampleAndGetData(channel6, vTexCoord, channelsFilled[6], channelStrokeWidths[6], channelsVisible[6]);
147727
-
147728
- vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
147729
- vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
147730
- vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
147731
- vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
147732
- vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
147733
- vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
147734
- vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
147735
-
147756
+
147757
+ vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapFuncIndices[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
147758
+ vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapFuncIndices[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
147759
+ vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapFuncIndices[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
147760
+ vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapFuncIndices[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
147761
+ vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapFuncIndices[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
147762
+ vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapFuncIndices[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
147763
+ vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapFuncIndices[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
147764
+
147736
147765
  // If all of the channels are "empty", then discard this pixel so that it is not considered during picking.
147737
147766
  float emptyDat = 0.;
147738
147767
  if(dat0.x == emptyDat && dat1.x == emptyDat && dat2.x == emptyDat && dat3.x == emptyDat && dat4.x == emptyDat && dat5.x == emptyDat && dat6.x == emptyDat) {
@@ -147916,14 +147945,10 @@ const defaultProps$1 = {
147916
147945
  class BitmaskLayer2 extends XRLayer {
147917
147946
  // eslint-disable-next-line class-methods-use-this
147918
147947
  getShaders() {
147919
- const { colormap } = this.props;
147920
147948
  return {
147921
147949
  fs,
147922
147950
  vs,
147923
- modules: [project32, picking],
147924
- defines: {
147925
- [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
147926
- }
147951
+ modules: [project32, picking]
147927
147952
  };
147928
147953
  }
147929
147954
  /**
@@ -147982,8 +148007,6 @@ class BitmaskLayer2 extends XRLayer {
147982
148007
  channelOpacities,
147983
148008
  channelColors,
147984
148009
  channelsVisible,
147985
- // TODO: use `channelFeatureValueColormaps` in shader,
147986
- // figure out how to call multiple GLSL colormap functions
147987
148010
  channelFeatureValueColormaps,
147988
148011
  channelFeatureValueColormapRanges,
147989
148012
  channelIsStaticColorMode,
@@ -148044,6 +148067,12 @@ class BitmaskLayer2 extends XRLayer {
148044
148067
  // There are six texture entries on the shaders
148045
148068
  MAX_CHANNELS - channelStrokeWidths.length
148046
148069
  ),
148070
+ channelColormapFuncIndices: padWithDefault(
148071
+ channelFeatureValueColormaps.map((d) => GLSL_COLORMAPS.indexOf(d)),
148072
+ 0,
148073
+ // There are six texture entries on the shaders
148074
+ MAX_CHANNELS - channelFeatureValueColormaps.length
148075
+ ),
148047
148076
  channelColormapRangeStarts: padWithDefault(
148048
148077
  channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[0]) || 0),
148049
148078
  0,
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, H } from "./index-gbnJAInw.js";
1
+ import { a, H } from "./index-wqNAdDqn.js";
2
2
  export {
3
3
  a as Heatmap,
4
4
  H as HeatmapSubscriber
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-gbnJAInw.js";
1
+ import { B as BaseDecoder } from "./index-wqNAdDqn.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-gbnJAInw.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-wqNAdDqn.js";
3
3
  const LercParameters = {
4
4
  AddCompression: 1
5
5
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-gbnJAInw.js";
1
+ import { B as BaseDecoder } from "./index-wqNAdDqn.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-gbnJAInw.js";
1
+ import { B as BaseDecoder } from "./index-wqNAdDqn.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-gbnJAInw.js";
1
+ import { B as BaseDecoder } from "./index-wqNAdDqn.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-gbnJAInw.js";
1
+ import { B as BaseDecoder } from "./index-wqNAdDqn.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/heatmap",
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": {
@@ -19,29 +19,29 @@
19
19
  "lodash-es": "^4.17.21",
20
20
  "uuid": "^9.0.0",
21
21
  "react-aria": "^3.28.0",
22
- "@vitessce/styles": "3.6.18",
23
- "@vitessce/constants-internal": "3.6.18",
24
- "@vitessce/gl": "3.6.18",
25
- "@vitessce/legend": "3.6.18",
26
- "@vitessce/sets-utils": "3.6.18",
27
- "@vitessce/tooltip": "3.6.18",
28
- "@vitessce/utils": "3.6.18",
29
- "@vitessce/vit-s": "3.6.18",
30
- "@vitessce/workers": "3.6.18"
22
+ "@vitessce/styles": "3.7.0",
23
+ "@vitessce/constants-internal": "3.7.0",
24
+ "@vitessce/gl": "3.7.0",
25
+ "@vitessce/legend": "3.7.0",
26
+ "@vitessce/sets-utils": "3.7.0",
27
+ "@vitessce/tooltip": "3.7.0",
28
+ "@vitessce/utils": "3.7.0",
29
+ "@vitessce/vit-s": "3.7.0",
30
+ "@vitessce/workers": "3.7.0"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@testing-library/jest-dom": "^6.6.3",
34
34
  "@testing-library/react": "^16.3.0",
35
35
  "react": "^18.0.0",
36
36
  "react-dom": "^18.0.0",
37
- "vite": "^6.3.5",
37
+ "vite": "^7.0.0",
38
38
  "vitest": "^3.1.4"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
42
42
  },
43
43
  "scripts": {
44
- "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
44
+ "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",
45
45
  "test": "pnpm exec vitest --run"
46
46
  },
47
47
  "module": "dist/index.js",