@vitessce/scatterplot-gating 3.6.18 → 3.7.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-DxIbmbec.js";
2
+ import { B as BaseDecoder } from "./index-CQUIaH69.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -10101,6 +10101,7 @@ const COMPONENT_COORDINATION_TYPES = {
10101
10101
  CoordinationType$1.SPATIAL_ROTATION_Y,
10102
10102
  CoordinationType$1.SPATIAL_ROTATION_Z,
10103
10103
  CoordinationType$1.SPATIAL_AXIS_FIXED,
10104
+ CoordinationType$1.SPATIAL_ROTATION_ORBIT,
10104
10105
  CoordinationType$1.SPATIAL_ORBIT_AXIS,
10105
10106
  CoordinationType$1.SPATIAL_ZOOM,
10106
10107
  CoordinationType$1.OBS_FILTER,
@@ -10108,14 +10109,11 @@ const COMPONENT_COORDINATION_TYPES = {
10108
10109
  CoordinationType$1.OBS_SET_SELECTION,
10109
10110
  CoordinationType$1.OBS_SET_FILTER,
10110
10111
  CoordinationType$1.OBS_SET_HIGHLIGHT,
10111
- CoordinationType$1.OBS_SET_COLOR,
10112
10112
  CoordinationType$1.OBS_TYPE,
10113
- CoordinationType$1.ADDITIONAL_OBS_SETS,
10114
10113
  CoordinationType$1.OBS_SET_COLOR,
10115
10114
  CoordinationType$1.OBS_COLOR_ENCODING,
10116
- CoordinationType$1.OBS_SET_SELECTION,
10117
10115
  CoordinationType$1.EMBEDDING_TYPE,
10118
- CoordinationType$1.OBS_COLOR_ENCODING,
10116
+ CoordinationType$1.ADDITIONAL_OBS_SETS,
10119
10117
  CoordinationType$1.TOOLTIPS_VISIBLE
10120
10118
  ],
10121
10119
  [ViewType$1.SCATTERPLOT]: [
@@ -122031,6 +122029,8 @@ const PIXELATED_TEXTURE_PARAMETERS = {
122031
122029
  [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
122032
122030
  };
122033
122031
  const GLSL_COLORMAPS = [
122032
+ // NOTE: the ordering of these is important,
122033
+ // as the shader code in bitmask-layer-beta-shaders hardcodes their indices.
122034
122034
  "plasma",
122035
122035
  "viridis",
122036
122036
  "jet",
@@ -123124,22 +123124,22 @@ function addDecoder(cases, importFn) {
123124
123124
  }
123125
123125
  cases.forEach((c2) => registry$1.set(c2, importFn));
123126
123126
  }
123127
- addDecoder([void 0, 1], () => import("./raw-Cpi81EiU.js").then((m2) => m2.default));
123128
- addDecoder(5, () => import("./lzw-ByCiT6yw.js").then((m2) => m2.default));
123127
+ addDecoder([void 0, 1], () => import("./raw-9dT3xwhD.js").then((m2) => m2.default));
123128
+ addDecoder(5, () => import("./lzw-C40QIo-x.js").then((m2) => m2.default));
123129
123129
  addDecoder(6, () => {
123130
123130
  throw new Error("old style JPEG compression is not supported.");
123131
123131
  });
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));
123132
+ addDecoder(7, () => import("./jpeg-CdsXFHlP.js").then((m2) => m2.default));
123133
+ addDecoder([8, 32946], () => import("./deflate-DBNG5DrN.js").then((m2) => m2.default));
123134
+ addDecoder(32773, () => import("./packbits-DuTPSgqu.js").then((m2) => m2.default));
123135
123135
  addDecoder(
123136
123136
  34887,
123137
- () => import("./lerc-SWg2S-02.js").then(async (m2) => {
123137
+ () => import("./lerc-BI9jJUb4.js").then(async (m2) => {
123138
123138
  await m2.zstd.init();
123139
123139
  return m2;
123140
123140
  }).then((m2) => m2.default)
123141
123141
  );
123142
- addDecoder(50001, () => import("./webimage-DDFe5y5S.js").then((m2) => m2.default));
123142
+ addDecoder(50001, () => import("./webimage-DCRfoRZ7.js").then((m2) => m2.default));
123143
123143
  function decodeRowAcc(row, stride) {
123144
123144
  let length2 = row.length - stride;
123145
123145
  let offset2 = 0;
@@ -132922,7 +132922,7 @@ uniform float channelOpacities[7];
132922
132922
  uniform bool channelIsStaticColorMode[7]; // TODO: should this be a single float?
132923
132923
  uniform bool channelIsSetColorMode[7]; // TODO: should this be a single float?
132924
132924
 
132925
- // TODO: can array of tuples/vec2 be used?
132925
+ uniform int channelColormapFuncIndices[7];
132926
132926
  uniform float channelColormapRangeStarts[7];
132927
132927
  uniform float channelColormapRangeEnds[7];
132928
132928
 
@@ -132988,7 +132988,30 @@ vec3 sampleAndGetData(sampler2D dataTex, vec2 coord, bool isFilled, float stroke
132988
132988
  return vec3(clampedSampledData * float(isOn), sampledData, float(isEdge));
132989
132989
  }
132990
132990
 
132991
- vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
132991
+ vec3 colormapFunc(float clampedScaledExpressionValue, int colormapIndex) {
132992
+ // Map indices of GLSL_COLORMAPS array to their function calls.
132993
+ // GLSL_COLORMAPS is defined in ./constants.js and needs to stay manually synced.
132994
+ // 0: 'plasma',
132995
+ // 1: 'viridis',
132996
+ // 2: 'jet',
132997
+ // 3: 'greys',
132998
+
132999
+ if (colormapIndex <= 0) {
133000
+ // This should also match -1, to account for a failed Array.indexOf lookup.
133001
+ return plasma(clampedScaledExpressionValue).rgb;
133002
+ }
133003
+ if (colormapIndex == 1) {
133004
+ return viridis(clampedScaledExpressionValue).rgb;
133005
+ }
133006
+ if (colormapIndex == 2) {
133007
+ return jet(clampedScaledExpressionValue).rgb;
133008
+ }
133009
+ if (colormapIndex == 3) {
133010
+ return greys(clampedScaledExpressionValue).rgb;
133011
+ }
133012
+ }
133013
+
133014
+ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, int colormapFuncIndex, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
132992
133015
  float clampedSampledDataAndIsOn = sampledDataAndIsEdge.x;
132993
133016
  float sampledData = sampledDataAndIsEdge.y;
132994
133017
  float isEdge = sampledDataAndIsEdge.z;
@@ -133032,7 +133055,7 @@ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channel
133032
133055
  }
133033
133056
 
133034
133057
 
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);
133058
+ 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
133059
  // Only return a color if the data is non-zero.
133037
133060
 
133038
133061
  return clampedSampledDataAndIsOn * isEdge * sampledColor;
@@ -133048,15 +133071,15 @@ void main() {
133048
133071
  vec3 dat4 = sampleAndGetData(channel4, vTexCoord, channelsFilled[4], channelStrokeWidths[4], channelsVisible[4]);
133049
133072
  vec3 dat5 = sampleAndGetData(channel5, vTexCoord, channelsFilled[5], channelStrokeWidths[5], channelsVisible[5]);
133050
133073
  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
-
133074
+
133075
+ vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapFuncIndices[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
133076
+ vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapFuncIndices[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
133077
+ vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapFuncIndices[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
133078
+ vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapFuncIndices[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
133079
+ vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapFuncIndices[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
133080
+ vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapFuncIndices[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
133081
+ vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapFuncIndices[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
133082
+
133060
133083
  // If all of the channels are "empty", then discard this pixel so that it is not considered during picking.
133061
133084
  float emptyDat = 0.;
133062
133085
  if(dat0.x == emptyDat && dat1.x == emptyDat && dat2.x == emptyDat && dat3.x == emptyDat && dat4.x == emptyDat && dat5.x == emptyDat && dat6.x == emptyDat) {
@@ -133212,14 +133235,10 @@ const defaultProps$2 = {
133212
133235
  class BitmaskLayer2 extends XRLayer {
133213
133236
  // eslint-disable-next-line class-methods-use-this
133214
133237
  getShaders() {
133215
- const { colormap } = this.props;
133216
133238
  return {
133217
133239
  fs,
133218
133240
  vs,
133219
- modules: [project32, picking],
133220
- defines: {
133221
- [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
133222
- }
133241
+ modules: [project32, picking]
133223
133242
  };
133224
133243
  }
133225
133244
  /**
@@ -133278,8 +133297,6 @@ class BitmaskLayer2 extends XRLayer {
133278
133297
  channelOpacities,
133279
133298
  channelColors,
133280
133299
  channelsVisible,
133281
- // TODO: use `channelFeatureValueColormaps` in shader,
133282
- // figure out how to call multiple GLSL colormap functions
133283
133300
  channelFeatureValueColormaps,
133284
133301
  channelFeatureValueColormapRanges,
133285
133302
  channelIsStaticColorMode,
@@ -133340,6 +133357,12 @@ class BitmaskLayer2 extends XRLayer {
133340
133357
  // There are six texture entries on the shaders
133341
133358
  MAX_CHANNELS - channelStrokeWidths.length
133342
133359
  ),
133360
+ channelColormapFuncIndices: padWithDefault(
133361
+ channelFeatureValueColormaps.map((d) => GLSL_COLORMAPS.indexOf(d)),
133362
+ 0,
133363
+ // There are six texture entries on the shaders
133364
+ MAX_CHANNELS - channelFeatureValueColormaps.length
133365
+ ),
133343
133366
  channelColormapRangeStarts: padWithDefault(
133344
133367
  channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[0]) || 0),
133345
133368
  0,
@@ -158136,6 +158159,9 @@ function getOnHoverCallback(obsIndex, setObsHighlight, setComponentHover) {
158136
158159
  }
158137
158160
  };
158138
158161
  }
158162
+ const ROTATION_THRESHOLD = 1;
158163
+ const ZOOM_THRESHOLD = 0.01;
158164
+ const TRANSLATION_THRESHOLD = 2;
158139
158165
  class AbstractSpatialOrScatterplot extends PureComponent {
158140
158166
  constructor(props) {
158141
158167
  super(props);
@@ -158143,6 +158169,7 @@ class AbstractSpatialOrScatterplot extends PureComponent {
158143
158169
  gl: null,
158144
158170
  tool: null
158145
158171
  };
158172
+ this.lastApplied = null;
158146
158173
  this.viewport = null;
158147
158174
  this.onViewStateChange = this.onViewStateChange.bind(this);
158148
158175
  this.onInitializeViewInfo = this.onInitializeViewInfo.bind(this);
@@ -158162,6 +158189,23 @@ class AbstractSpatialOrScatterplot extends PureComponent {
158162
158189
  onViewStateChange({ viewState: nextViewState }) {
158163
158190
  const { setViewState, viewState, spatialAxisFixed } = this.props;
158164
158191
  const use3d = this.use3d();
158192
+ let targetChanged = false;
158193
+ if (nextViewState.target && viewState.target) {
158194
+ const dx = Math.abs((nextViewState.target[0] ?? 0) - (viewState.target[0] ?? 0));
158195
+ const dy = Math.abs((nextViewState.target[1] ?? 0) - (viewState.target[1] ?? 0));
158196
+ const scale2 = 2 ** (nextViewState.zoom ?? 0);
158197
+ const dxPx = Math.abs(dx) * scale2;
158198
+ const dyPx = Math.abs(dy) * scale2;
158199
+ targetChanged = dxPx > TRANSLATION_THRESHOLD || dyPx > TRANSLATION_THRESHOLD;
158200
+ }
158201
+ const prev2 = this.lastApplied || viewState;
158202
+ const zoomChanged = Math.abs((nextViewState.zoom ?? 0) - (prev2.zoom ?? 0)) > ZOOM_THRESHOLD;
158203
+ const orbitChanged = Math.abs((nextViewState.rotationOrbit ?? 0) - (prev2.rotationOrbit ?? 0)) > ROTATION_THRESHOLD;
158204
+ const xChanged = Math.abs((nextViewState.rotationX ?? 0) - (prev2.rotationX ?? 0)) > ROTATION_THRESHOLD;
158205
+ if (!(zoomChanged || orbitChanged || xChanged || targetChanged)) {
158206
+ return;
158207
+ }
158208
+ this.lastApplied = nextViewState;
158165
158209
  setViewState({
158166
158210
  ...nextViewState,
158167
158211
  // If the axis is fixed, just use the current target in state i.e don't change target.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { G } from "./index-DxIbmbec.js";
1
+ import { G } from "./index-CQUIaH69.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-CQUIaH69.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-CQUIaH69.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-CQUIaH69.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-CQUIaH69.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-CQUIaH69.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-CQUIaH69.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.1",
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.1",
23
+ "@vitessce/constants-internal": "3.7.1",
24
+ "@vitessce/scatterplot": "3.7.1",
25
+ "@vitessce/sets-utils": "3.7.1",
26
+ "@vitessce/vit-s": "3.7.1",
27
+ "@vitessce/utils": "3.7.1"
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",