@vitessce/scatterplot-gating 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-DxIbmbec.js";
2
+ import { B as BaseDecoder } from "./index-wrQf0yLB.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -122031,6 +122031,8 @@ const PIXELATED_TEXTURE_PARAMETERS = {
122031
122031
  [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
122032
122032
  };
122033
122033
  const GLSL_COLORMAPS = [
122034
+ // NOTE: the ordering of these is important,
122035
+ // as the shader code in bitmask-layer-beta-shaders hardcodes their indices.
122034
122036
  "plasma",
122035
122037
  "viridis",
122036
122038
  "jet",
@@ -123124,22 +123126,22 @@ function addDecoder(cases, importFn) {
123124
123126
  }
123125
123127
  cases.forEach((c2) => registry$1.set(c2, importFn));
123126
123128
  }
123127
- addDecoder([void 0, 1], () => import("./raw-Cpi81EiU.js").then((m2) => m2.default));
123128
- addDecoder(5, () => import("./lzw-ByCiT6yw.js").then((m2) => m2.default));
123129
+ addDecoder([void 0, 1], () => import("./raw-g5V-yVQZ.js").then((m2) => m2.default));
123130
+ addDecoder(5, () => import("./lzw-BPz0RIPM.js").then((m2) => m2.default));
123129
123131
  addDecoder(6, () => {
123130
123132
  throw new Error("old style JPEG compression is not supported.");
123131
123133
  });
123132
- addDecoder(7, () => import("./jpeg-uWYr3prx.js").then((m2) => m2.default));
123133
- addDecoder([8, 32946], () => import("./deflate-X_zVM_Qy.js").then((m2) => m2.default));
123134
- addDecoder(32773, () => import("./packbits-BfbBkUze.js").then((m2) => m2.default));
123134
+ addDecoder(7, () => import("./jpeg-Di23zXFS.js").then((m2) => m2.default));
123135
+ addDecoder([8, 32946], () => import("./deflate-WkvPtv5P.js").then((m2) => m2.default));
123136
+ addDecoder(32773, () => import("./packbits-4y-CZhCi.js").then((m2) => m2.default));
123135
123137
  addDecoder(
123136
123138
  34887,
123137
- () => import("./lerc-SWg2S-02.js").then(async (m2) => {
123139
+ () => import("./lerc-BxU7w-lS.js").then(async (m2) => {
123138
123140
  await m2.zstd.init();
123139
123141
  return m2;
123140
123142
  }).then((m2) => m2.default)
123141
123143
  );
123142
- addDecoder(50001, () => import("./webimage-DDFe5y5S.js").then((m2) => m2.default));
123144
+ addDecoder(50001, () => import("./webimage-PnoeEp0u.js").then((m2) => m2.default));
123143
123145
  function decodeRowAcc(row, stride) {
123144
123146
  let length2 = row.length - stride;
123145
123147
  let offset2 = 0;
@@ -132922,7 +132924,7 @@ uniform float channelOpacities[7];
132922
132924
  uniform bool channelIsStaticColorMode[7]; // TODO: should this be a single float?
132923
132925
  uniform bool channelIsSetColorMode[7]; // TODO: should this be a single float?
132924
132926
 
132925
- // TODO: can array of tuples/vec2 be used?
132927
+ uniform int channelColormapFuncIndices[7];
132926
132928
  uniform float channelColormapRangeStarts[7];
132927
132929
  uniform float channelColormapRangeEnds[7];
132928
132930
 
@@ -132988,7 +132990,30 @@ vec3 sampleAndGetData(sampler2D dataTex, vec2 coord, bool isFilled, float stroke
132988
132990
  return vec3(clampedSampledData * float(isOn), sampledData, float(isEdge));
132989
132991
  }
132990
132992
 
132991
- vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
132993
+ vec3 colormapFunc(float clampedScaledExpressionValue, int colormapIndex) {
132994
+ // Map indices of GLSL_COLORMAPS array to their function calls.
132995
+ // GLSL_COLORMAPS is defined in ./constants.js and needs to stay manually synced.
132996
+ // 0: 'plasma',
132997
+ // 1: 'viridis',
132998
+ // 2: 'jet',
132999
+ // 3: 'greys',
133000
+
133001
+ if (colormapIndex <= 0) {
133002
+ // This should also match -1, to account for a failed Array.indexOf lookup.
133003
+ return plasma(clampedScaledExpressionValue).rgb;
133004
+ }
133005
+ if (colormapIndex == 1) {
133006
+ return viridis(clampedScaledExpressionValue).rgb;
133007
+ }
133008
+ if (colormapIndex == 2) {
133009
+ return jet(clampedScaledExpressionValue).rgb;
133010
+ }
133011
+ if (colormapIndex == 3) {
133012
+ return greys(clampedScaledExpressionValue).rgb;
133013
+ }
133014
+ }
133015
+
133016
+ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, int colormapFuncIndex, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
132992
133017
  float clampedSampledDataAndIsOn = sampledDataAndIsEdge.x;
132993
133018
  float sampledData = sampledDataAndIsEdge.y;
132994
133019
  float isEdge = sampledDataAndIsEdge.z;
@@ -133032,7 +133057,7 @@ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channel
133032
133057
  }
133033
133058
 
133034
133059
 
133035
- 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);
133060
+ 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);
133036
133061
  // Only return a color if the data is non-zero.
133037
133062
 
133038
133063
  return clampedSampledDataAndIsOn * isEdge * sampledColor;
@@ -133048,15 +133073,15 @@ void main() {
133048
133073
  vec3 dat4 = sampleAndGetData(channel4, vTexCoord, channelsFilled[4], channelStrokeWidths[4], channelsVisible[4]);
133049
133074
  vec3 dat5 = sampleAndGetData(channel5, vTexCoord, channelsFilled[5], channelStrokeWidths[5], channelsVisible[5]);
133050
133075
  vec3 dat6 = sampleAndGetData(channel6, vTexCoord, channelsFilled[6], channelStrokeWidths[6], channelsVisible[6]);
133051
-
133052
- vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
133053
- vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
133054
- vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
133055
- vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
133056
- vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
133057
- vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
133058
- vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
133059
-
133076
+
133077
+ vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapFuncIndices[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
133078
+ vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapFuncIndices[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
133079
+ vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapFuncIndices[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
133080
+ vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapFuncIndices[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
133081
+ vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapFuncIndices[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
133082
+ vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapFuncIndices[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
133083
+ vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapFuncIndices[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
133084
+
133060
133085
  // If all of the channels are "empty", then discard this pixel so that it is not considered during picking.
133061
133086
  float emptyDat = 0.;
133062
133087
  if(dat0.x == emptyDat && dat1.x == emptyDat && dat2.x == emptyDat && dat3.x == emptyDat && dat4.x == emptyDat && dat5.x == emptyDat && dat6.x == emptyDat) {
@@ -133212,14 +133237,10 @@ const defaultProps$2 = {
133212
133237
  class BitmaskLayer2 extends XRLayer {
133213
133238
  // eslint-disable-next-line class-methods-use-this
133214
133239
  getShaders() {
133215
- const { colormap } = this.props;
133216
133240
  return {
133217
133241
  fs,
133218
133242
  vs,
133219
- modules: [project32, picking],
133220
- defines: {
133221
- [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
133222
- }
133243
+ modules: [project32, picking]
133223
133244
  };
133224
133245
  }
133225
133246
  /**
@@ -133278,8 +133299,6 @@ class BitmaskLayer2 extends XRLayer {
133278
133299
  channelOpacities,
133279
133300
  channelColors,
133280
133301
  channelsVisible,
133281
- // TODO: use `channelFeatureValueColormaps` in shader,
133282
- // figure out how to call multiple GLSL colormap functions
133283
133302
  channelFeatureValueColormaps,
133284
133303
  channelFeatureValueColormapRanges,
133285
133304
  channelIsStaticColorMode,
@@ -133340,6 +133359,12 @@ class BitmaskLayer2 extends XRLayer {
133340
133359
  // There are six texture entries on the shaders
133341
133360
  MAX_CHANNELS - channelStrokeWidths.length
133342
133361
  ),
133362
+ channelColormapFuncIndices: padWithDefault(
133363
+ channelFeatureValueColormaps.map((d) => GLSL_COLORMAPS.indexOf(d)),
133364
+ 0,
133365
+ // There are six texture entries on the shaders
133366
+ MAX_CHANNELS - channelFeatureValueColormaps.length
133367
+ ),
133343
133368
  channelColormapRangeStarts: padWithDefault(
133344
133369
  channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[0]) || 0),
133345
133370
  0,
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { G } from "./index-DxIbmbec.js";
1
+ import { G } from "./index-wrQf0yLB.js";
2
2
  export {
3
3
  G as GatingSubscriber
4
4
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-DxIbmbec.js";
1
+ import { B as BaseDecoder } from "./index-wrQf0yLB.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-DxIbmbec.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-wrQf0yLB.js";
3
3
  const LercParameters = {
4
4
  AddCompression: 1
5
5
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-DxIbmbec.js";
1
+ import { B as BaseDecoder } from "./index-wrQf0yLB.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-DxIbmbec.js";
1
+ import { B as BaseDecoder } from "./index-wrQf0yLB.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-DxIbmbec.js";
1
+ import { B as BaseDecoder } from "./index-wrQf0yLB.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-DxIbmbec.js";
1
+ import { B as BaseDecoder } from "./index-wrQf0yLB.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-gating",
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,24 +19,24 @@
19
19
  "d3-array": "^2.4.0",
20
20
  "lodash-es": "^4.17.21",
21
21
  "react-aria": "^3.28.0",
22
- "@vitessce/styles": "3.6.18",
23
- "@vitessce/constants-internal": "3.6.18",
24
- "@vitessce/scatterplot": "3.6.18",
25
- "@vitessce/sets-utils": "3.6.18",
26
- "@vitessce/utils": "3.6.18",
27
- "@vitessce/vit-s": "3.6.18"
22
+ "@vitessce/styles": "3.7.0",
23
+ "@vitessce/constants-internal": "3.7.0",
24
+ "@vitessce/scatterplot": "3.7.0",
25
+ "@vitessce/sets-utils": "3.7.0",
26
+ "@vitessce/utils": "3.7.0",
27
+ "@vitessce/vit-s": "3.7.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "react": "^18.0.0",
31
31
  "react-dom": "^18.0.0",
32
- "vite": "^6.3.5",
32
+ "vite": "^7.0.0",
33
33
  "vitest": "^3.1.4"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
37
37
  },
38
38
  "scripts": {
39
- "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
39
+ "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",
40
40
  "test": "pnpm exec vitest --run"
41
41
  },
42
42
  "module": "dist/index.js",