@vitessce/layer-controller 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-DtuIAdKG.js";
2
+ import { B as BaseDecoder } from "./index-Cg8VJ2KT.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -21860,6 +21860,7 @@ const COMPONENT_COORDINATION_TYPES = {
21860
21860
  CoordinationType.SPATIAL_ROTATION_Y,
21861
21861
  CoordinationType.SPATIAL_ROTATION_Z,
21862
21862
  CoordinationType.SPATIAL_AXIS_FIXED,
21863
+ CoordinationType.SPATIAL_ROTATION_ORBIT,
21863
21864
  CoordinationType.SPATIAL_ORBIT_AXIS,
21864
21865
  CoordinationType.SPATIAL_ZOOM,
21865
21866
  CoordinationType.OBS_FILTER,
@@ -21867,14 +21868,11 @@ const COMPONENT_COORDINATION_TYPES = {
21867
21868
  CoordinationType.OBS_SET_SELECTION,
21868
21869
  CoordinationType.OBS_SET_FILTER,
21869
21870
  CoordinationType.OBS_SET_HIGHLIGHT,
21870
- CoordinationType.OBS_SET_COLOR,
21871
21871
  CoordinationType.OBS_TYPE,
21872
- CoordinationType.ADDITIONAL_OBS_SETS,
21873
21872
  CoordinationType.OBS_SET_COLOR,
21874
21873
  CoordinationType.OBS_COLOR_ENCODING,
21875
- CoordinationType.OBS_SET_SELECTION,
21876
21874
  CoordinationType.EMBEDDING_TYPE,
21877
- CoordinationType.OBS_COLOR_ENCODING,
21875
+ CoordinationType.ADDITIONAL_OBS_SETS,
21878
21876
  CoordinationType.TOOLTIPS_VISIBLE
21879
21877
  ],
21880
21878
  [ViewType.SCATTERPLOT]: [
@@ -126951,6 +126949,8 @@ const PIXELATED_TEXTURE_PARAMETERS = {
126951
126949
  [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
126952
126950
  };
126953
126951
  const GLSL_COLORMAPS = [
126952
+ // NOTE: the ordering of these is important,
126953
+ // as the shader code in bitmask-layer-beta-shaders hardcodes their indices.
126954
126954
  "plasma",
126955
126955
  "viridis",
126956
126956
  "jet",
@@ -128043,22 +128043,22 @@ function addDecoder(cases, importFn) {
128043
128043
  }
128044
128044
  cases.forEach((c) => registry$1.set(c, importFn));
128045
128045
  }
128046
- addDecoder([void 0, 1], () => import("./raw-CYFJJ3fA.js").then((m) => m.default));
128047
- addDecoder(5, () => import("./lzw-qy2qAJDy.js").then((m) => m.default));
128046
+ addDecoder([void 0, 1], () => import("./raw-BJ4Qj133.js").then((m) => m.default));
128047
+ addDecoder(5, () => import("./lzw-O8XnQHW3.js").then((m) => m.default));
128048
128048
  addDecoder(6, () => {
128049
128049
  throw new Error("old style JPEG compression is not supported.");
128050
128050
  });
128051
- addDecoder(7, () => import("./jpeg-ClELP1Y7.js").then((m) => m.default));
128052
- addDecoder([8, 32946], () => import("./deflate-C1xwcx5I.js").then((m) => m.default));
128053
- addDecoder(32773, () => import("./packbits-u0sf9Ydw.js").then((m) => m.default));
128051
+ addDecoder(7, () => import("./jpeg-CtJBK85o.js").then((m) => m.default));
128052
+ addDecoder([8, 32946], () => import("./deflate-D2IuNnTJ.js").then((m) => m.default));
128053
+ addDecoder(32773, () => import("./packbits-0obvAeIX.js").then((m) => m.default));
128054
128054
  addDecoder(
128055
128055
  34887,
128056
- () => import("./lerc-CFE3Ze_z.js").then(async (m) => {
128056
+ () => import("./lerc-BeaUIbpj.js").then(async (m) => {
128057
128057
  await m.zstd.init();
128058
128058
  return m;
128059
128059
  }).then((m) => m.default)
128060
128060
  );
128061
- addDecoder(50001, () => import("./webimage-CQEHV8_N.js").then((m) => m.default));
128061
+ addDecoder(50001, () => import("./webimage-Dhg-pE0F.js").then((m) => m.default));
128062
128062
  function decodeRowAcc(row, stride) {
128063
128063
  let length2 = row.length - stride;
128064
128064
  let offset2 = 0;
@@ -141510,7 +141510,7 @@ uniform float channelOpacities[7];
141510
141510
  uniform bool channelIsStaticColorMode[7]; // TODO: should this be a single float?
141511
141511
  uniform bool channelIsSetColorMode[7]; // TODO: should this be a single float?
141512
141512
 
141513
- // TODO: can array of tuples/vec2 be used?
141513
+ uniform int channelColormapFuncIndices[7];
141514
141514
  uniform float channelColormapRangeStarts[7];
141515
141515
  uniform float channelColormapRangeEnds[7];
141516
141516
 
@@ -141576,7 +141576,30 @@ vec3 sampleAndGetData(sampler2D dataTex, vec2 coord, bool isFilled, float stroke
141576
141576
  return vec3(clampedSampledData * float(isOn), sampledData, float(isEdge));
141577
141577
  }
141578
141578
 
141579
- vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
141579
+ vec3 colormapFunc(float clampedScaledExpressionValue, int colormapIndex) {
141580
+ // Map indices of GLSL_COLORMAPS array to their function calls.
141581
+ // GLSL_COLORMAPS is defined in ./constants.js and needs to stay manually synced.
141582
+ // 0: 'plasma',
141583
+ // 1: 'viridis',
141584
+ // 2: 'jet',
141585
+ // 3: 'greys',
141586
+
141587
+ if (colormapIndex <= 0) {
141588
+ // This should also match -1, to account for a failed Array.indexOf lookup.
141589
+ return plasma(clampedScaledExpressionValue).rgb;
141590
+ }
141591
+ if (colormapIndex == 1) {
141592
+ return viridis(clampedScaledExpressionValue).rgb;
141593
+ }
141594
+ if (colormapIndex == 2) {
141595
+ return jet(clampedScaledExpressionValue).rgb;
141596
+ }
141597
+ if (colormapIndex == 3) {
141598
+ return greys(clampedScaledExpressionValue).rgb;
141599
+ }
141600
+ }
141601
+
141602
+ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, int colormapFuncIndex, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
141580
141603
  float clampedSampledDataAndIsOn = sampledDataAndIsEdge.x;
141581
141604
  float sampledData = sampledDataAndIsEdge.y;
141582
141605
  float isEdge = sampledDataAndIsEdge.z;
@@ -141620,7 +141643,7 @@ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channel
141620
141643
  }
141621
141644
 
141622
141645
 
141623
- 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);
141646
+ 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);
141624
141647
  // Only return a color if the data is non-zero.
141625
141648
 
141626
141649
  return clampedSampledDataAndIsOn * isEdge * sampledColor;
@@ -141636,15 +141659,15 @@ void main() {
141636
141659
  vec3 dat4 = sampleAndGetData(channel4, vTexCoord, channelsFilled[4], channelStrokeWidths[4], channelsVisible[4]);
141637
141660
  vec3 dat5 = sampleAndGetData(channel5, vTexCoord, channelsFilled[5], channelStrokeWidths[5], channelsVisible[5]);
141638
141661
  vec3 dat6 = sampleAndGetData(channel6, vTexCoord, channelsFilled[6], channelStrokeWidths[6], channelsVisible[6]);
141639
-
141640
- vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
141641
- vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
141642
- vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
141643
- vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
141644
- vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
141645
- vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
141646
- vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
141647
-
141662
+
141663
+ vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapFuncIndices[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
141664
+ vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapFuncIndices[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
141665
+ vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapFuncIndices[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
141666
+ vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapFuncIndices[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
141667
+ vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapFuncIndices[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
141668
+ vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapFuncIndices[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
141669
+ vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapFuncIndices[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
141670
+
141648
141671
  // If all of the channels are "empty", then discard this pixel so that it is not considered during picking.
141649
141672
  float emptyDat = 0.;
141650
141673
  if(dat0.x == emptyDat && dat1.x == emptyDat && dat2.x == emptyDat && dat3.x == emptyDat && dat4.x == emptyDat && dat5.x == emptyDat && dat6.x == emptyDat) {
@@ -141828,14 +141851,10 @@ const defaultProps$1 = {
141828
141851
  class BitmaskLayer2 extends XRLayer {
141829
141852
  // eslint-disable-next-line class-methods-use-this
141830
141853
  getShaders() {
141831
- const { colormap } = this.props;
141832
141854
  return {
141833
141855
  fs,
141834
141856
  vs,
141835
- modules: [project32, picking],
141836
- defines: {
141837
- [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
141838
- }
141857
+ modules: [project32, picking]
141839
141858
  };
141840
141859
  }
141841
141860
  /**
@@ -141894,8 +141913,6 @@ class BitmaskLayer2 extends XRLayer {
141894
141913
  channelOpacities,
141895
141914
  channelColors,
141896
141915
  channelsVisible,
141897
- // TODO: use `channelFeatureValueColormaps` in shader,
141898
- // figure out how to call multiple GLSL colormap functions
141899
141916
  channelFeatureValueColormaps,
141900
141917
  channelFeatureValueColormapRanges,
141901
141918
  channelIsStaticColorMode,
@@ -141956,6 +141973,12 @@ class BitmaskLayer2 extends XRLayer {
141956
141973
  // There are six texture entries on the shaders
141957
141974
  MAX_CHANNELS - channelStrokeWidths.length
141958
141975
  ),
141976
+ channelColormapFuncIndices: padWithDefault(
141977
+ channelFeatureValueColormaps.map((d) => GLSL_COLORMAPS.indexOf(d)),
141978
+ 0,
141979
+ // There are six texture entries on the shaders
141980
+ MAX_CHANNELS - channelFeatureValueColormaps.length
141981
+ ),
141959
141982
  channelColormapRangeStarts: padWithDefault(
141960
141983
  channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[0]) || 0),
141961
141984
  0,
@@ -145318,7 +145341,7 @@ const canLoadResolution = (loader, resolution) => {
145318
145341
  const { totalBytes, height: height2, width: width2, depthDownsampled } = getStatsForResolution(loader, resolution);
145319
145342
  const maxHeapSize = ((_a3 = window.performance) == null ? void 0 : _a3.memory) && ((_c = (_b2 = window.performance) == null ? void 0 : _b2.memory) == null ? void 0 : _c.jsHeapSizeLimit) / 2;
145320
145343
  const maxSize = maxHeapSize || 2 ** 31 - 1;
145321
- return totalBytes < maxSize && height2 <= 2048 && depthDownsampled <= 2048 && width2 <= 2048 && depthDownsampled > 1;
145344
+ return totalBytes < maxSize && height2 <= 2048 && width2 <= 2048 && depthDownsampled <= 2048;
145322
145345
  };
145323
145346
  function isRgb(loader, channels2) {
145324
145347
  const source = getSourceFromLoader(loader);
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, L, V, d, c, e, f, b, h, u } from "./index-DtuIAdKG.js";
1
+ import { a, L, V, d, c, e, f, b, h, u } from "./index-Cg8VJ2KT.js";
2
2
  export {
3
3
  a as LayerController,
4
4
  L as LayerControllerSubscriber,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-DtuIAdKG.js";
1
+ import { B as BaseDecoder } from "./index-Cg8VJ2KT.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-DtuIAdKG.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-Cg8VJ2KT.js";
3
3
  const LercParameters = {
4
4
  AddCompression: 1
5
5
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-DtuIAdKG.js";
1
+ import { B as BaseDecoder } from "./index-Cg8VJ2KT.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-DtuIAdKG.js";
1
+ import { B as BaseDecoder } from "./index-Cg8VJ2KT.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-DtuIAdKG.js";
1
+ import { B as BaseDecoder } from "./index-Cg8VJ2KT.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-DtuIAdKG.js";
1
+ import { B as BaseDecoder } from "./index-Cg8VJ2KT.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/layer-controller",
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
  "lodash-es": "^4.17.21",
20
20
  "math.gl": "^3.5.6",
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/spatial-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/gl": "3.7.1",
25
+ "@vitessce/spatial-utils": "3.7.1",
26
+ "@vitessce/utils": "3.7.1",
27
+ "@vitessce/vit-s": "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",