@vitessce/layer-controller 3.6.17 → 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-DtuIAdKG.js";
2
+ import { B as BaseDecoder } from "./index-CYIYE8B7.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -126951,6 +126951,8 @@ const PIXELATED_TEXTURE_PARAMETERS = {
126951
126951
  [GL$1.TEXTURE_WRAP_T]: GL$1.CLAMP_TO_EDGE
126952
126952
  };
126953
126953
  const GLSL_COLORMAPS = [
126954
+ // NOTE: the ordering of these is important,
126955
+ // as the shader code in bitmask-layer-beta-shaders hardcodes their indices.
126954
126956
  "plasma",
126955
126957
  "viridis",
126956
126958
  "jet",
@@ -128043,22 +128045,22 @@ function addDecoder(cases, importFn) {
128043
128045
  }
128044
128046
  cases.forEach((c) => registry$1.set(c, importFn));
128045
128047
  }
128046
- addDecoder([void 0, 1], () => import("./raw-CYFJJ3fA.js").then((m) => m.default));
128047
- addDecoder(5, () => import("./lzw-qy2qAJDy.js").then((m) => m.default));
128048
+ addDecoder([void 0, 1], () => import("./raw-BfRzHTth.js").then((m) => m.default));
128049
+ addDecoder(5, () => import("./lzw-CbTZfKs9.js").then((m) => m.default));
128048
128050
  addDecoder(6, () => {
128049
128051
  throw new Error("old style JPEG compression is not supported.");
128050
128052
  });
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));
128053
+ addDecoder(7, () => import("./jpeg-C-T48Smu.js").then((m) => m.default));
128054
+ addDecoder([8, 32946], () => import("./deflate-D3mL8ngO.js").then((m) => m.default));
128055
+ addDecoder(32773, () => import("./packbits-D6o4d29o.js").then((m) => m.default));
128054
128056
  addDecoder(
128055
128057
  34887,
128056
- () => import("./lerc-CFE3Ze_z.js").then(async (m) => {
128058
+ () => import("./lerc-BkWxYHtF.js").then(async (m) => {
128057
128059
  await m.zstd.init();
128058
128060
  return m;
128059
128061
  }).then((m) => m.default)
128060
128062
  );
128061
- addDecoder(50001, () => import("./webimage-CQEHV8_N.js").then((m) => m.default));
128063
+ addDecoder(50001, () => import("./webimage-DsTVvuUV.js").then((m) => m.default));
128062
128064
  function decodeRowAcc(row, stride) {
128063
128065
  let length2 = row.length - stride;
128064
128066
  let offset2 = 0;
@@ -141510,7 +141512,7 @@ uniform float channelOpacities[7];
141510
141512
  uniform bool channelIsStaticColorMode[7]; // TODO: should this be a single float?
141511
141513
  uniform bool channelIsSetColorMode[7]; // TODO: should this be a single float?
141512
141514
 
141513
- // TODO: can array of tuples/vec2 be used?
141515
+ uniform int channelColormapFuncIndices[7];
141514
141516
  uniform float channelColormapRangeStarts[7];
141515
141517
  uniform float channelColormapRangeEnds[7];
141516
141518
 
@@ -141576,7 +141578,30 @@ vec3 sampleAndGetData(sampler2D dataTex, vec2 coord, bool isFilled, float stroke
141576
141578
  return vec3(clampedSampledData * float(isOn), sampledData, float(isEdge));
141577
141579
  }
141578
141580
 
141579
- vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
141581
+ vec3 colormapFunc(float clampedScaledExpressionValue, int colormapIndex) {
141582
+ // Map indices of GLSL_COLORMAPS array to their function calls.
141583
+ // GLSL_COLORMAPS is defined in ./constants.js and needs to stay manually synced.
141584
+ // 0: 'plasma',
141585
+ // 1: 'viridis',
141586
+ // 2: 'jet',
141587
+ // 3: 'greys',
141588
+
141589
+ if (colormapIndex <= 0) {
141590
+ // This should also match -1, to account for a failed Array.indexOf lookup.
141591
+ return plasma(clampedScaledExpressionValue).rgb;
141592
+ }
141593
+ if (colormapIndex == 1) {
141594
+ return viridis(clampedScaledExpressionValue).rgb;
141595
+ }
141596
+ if (colormapIndex == 2) {
141597
+ return jet(clampedScaledExpressionValue).rgb;
141598
+ }
141599
+ if (colormapIndex == 3) {
141600
+ return greys(clampedScaledExpressionValue).rgb;
141601
+ }
141602
+ }
141603
+
141604
+ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channelColor, float channelOpacity, float valueOffset, int colormapFuncIndex, float rangeStart, float rangeEnd, bool isSetColorMode, float setColorOffset) {
141580
141605
  float clampedSampledDataAndIsOn = sampledDataAndIsEdge.x;
141581
141606
  float sampledData = sampledDataAndIsEdge.y;
141582
141607
  float isEdge = sampledDataAndIsEdge.z;
@@ -141620,7 +141645,7 @@ vec4 dataToColor(vec3 sampledDataAndIsEdge, bool isStaticColorMode, vec3 channel
141620
141645
  }
141621
141646
 
141622
141647
 
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);
141648
+ 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
141649
  // Only return a color if the data is non-zero.
141625
141650
 
141626
141651
  return clampedSampledDataAndIsOn * isEdge * sampledColor;
@@ -141636,15 +141661,15 @@ void main() {
141636
141661
  vec3 dat4 = sampleAndGetData(channel4, vTexCoord, channelsFilled[4], channelStrokeWidths[4], channelsVisible[4]);
141637
141662
  vec3 dat5 = sampleAndGetData(channel5, vTexCoord, channelsFilled[5], channelStrokeWidths[5], channelsVisible[5]);
141638
141663
  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
-
141664
+
141665
+ vec4 val0 = dataToColor(dat0, channelIsStaticColorMode[0], color0, channelOpacities[0], valueTexOffsets[0], channelColormapFuncIndices[0], channelColormapRangeStarts[0], channelColormapRangeEnds[0], channelIsSetColorMode[0], colorTexOffsets[0]);
141666
+ vec4 val1 = dataToColor(dat1, channelIsStaticColorMode[1], color1, channelOpacities[1], valueTexOffsets[1], channelColormapFuncIndices[1], channelColormapRangeStarts[1], channelColormapRangeEnds[1], channelIsSetColorMode[1], colorTexOffsets[1]);
141667
+ vec4 val2 = dataToColor(dat2, channelIsStaticColorMode[2], color2, channelOpacities[2], valueTexOffsets[2], channelColormapFuncIndices[2], channelColormapRangeStarts[2], channelColormapRangeEnds[2], channelIsSetColorMode[2], colorTexOffsets[2]);
141668
+ vec4 val3 = dataToColor(dat3, channelIsStaticColorMode[3], color3, channelOpacities[3], valueTexOffsets[3], channelColormapFuncIndices[3], channelColormapRangeStarts[3], channelColormapRangeEnds[3], channelIsSetColorMode[3], colorTexOffsets[3]);
141669
+ vec4 val4 = dataToColor(dat4, channelIsStaticColorMode[4], color4, channelOpacities[4], valueTexOffsets[4], channelColormapFuncIndices[4], channelColormapRangeStarts[4], channelColormapRangeEnds[4], channelIsSetColorMode[4], colorTexOffsets[4]);
141670
+ vec4 val5 = dataToColor(dat5, channelIsStaticColorMode[5], color5, channelOpacities[5], valueTexOffsets[5], channelColormapFuncIndices[5], channelColormapRangeStarts[5], channelColormapRangeEnds[5], channelIsSetColorMode[5], colorTexOffsets[5]);
141671
+ vec4 val6 = dataToColor(dat6, channelIsStaticColorMode[6], color6, channelOpacities[6], valueTexOffsets[6], channelColormapFuncIndices[6], channelColormapRangeStarts[6], channelColormapRangeEnds[6], channelIsSetColorMode[6], colorTexOffsets[6]);
141672
+
141648
141673
  // If all of the channels are "empty", then discard this pixel so that it is not considered during picking.
141649
141674
  float emptyDat = 0.;
141650
141675
  if(dat0.x == emptyDat && dat1.x == emptyDat && dat2.x == emptyDat && dat3.x == emptyDat && dat4.x == emptyDat && dat5.x == emptyDat && dat6.x == emptyDat) {
@@ -141828,14 +141853,10 @@ const defaultProps$1 = {
141828
141853
  class BitmaskLayer2 extends XRLayer {
141829
141854
  // eslint-disable-next-line class-methods-use-this
141830
141855
  getShaders() {
141831
- const { colormap } = this.props;
141832
141856
  return {
141833
141857
  fs,
141834
141858
  vs,
141835
- modules: [project32, picking],
141836
- defines: {
141837
- [COLORMAP_SHADER_PLACEHOLDER]: GLSL_COLORMAPS.includes(colormap) ? colormap : GLSL_COLORMAP_DEFAULT
141838
- }
141859
+ modules: [project32, picking]
141839
141860
  };
141840
141861
  }
141841
141862
  /**
@@ -141894,8 +141915,6 @@ class BitmaskLayer2 extends XRLayer {
141894
141915
  channelOpacities,
141895
141916
  channelColors,
141896
141917
  channelsVisible,
141897
- // TODO: use `channelFeatureValueColormaps` in shader,
141898
- // figure out how to call multiple GLSL colormap functions
141899
141918
  channelFeatureValueColormaps,
141900
141919
  channelFeatureValueColormapRanges,
141901
141920
  channelIsStaticColorMode,
@@ -141956,6 +141975,12 @@ class BitmaskLayer2 extends XRLayer {
141956
141975
  // There are six texture entries on the shaders
141957
141976
  MAX_CHANNELS - channelStrokeWidths.length
141958
141977
  ),
141978
+ channelColormapFuncIndices: padWithDefault(
141979
+ channelFeatureValueColormaps.map((d) => GLSL_COLORMAPS.indexOf(d)),
141980
+ 0,
141981
+ // There are six texture entries on the shaders
141982
+ MAX_CHANNELS - channelFeatureValueColormaps.length
141983
+ ),
141959
141984
  channelColormapRangeStarts: padWithDefault(
141960
141985
  channelFeatureValueColormapRanges.map((r2) => (r2 == null ? void 0 : r2[0]) || 0),
141961
141986
  0,
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-CYIYE8B7.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-CYIYE8B7.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-CYIYE8B7.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-CYIYE8B7.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-CYIYE8B7.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-CYIYE8B7.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-CYIYE8B7.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.17",
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
  "lodash-es": "^4.17.21",
20
20
  "math.gl": "^3.5.6",
21
21
  "react-aria": "^3.28.0",
22
- "@vitessce/styles": "3.6.17",
23
- "@vitessce/constants-internal": "3.6.17",
24
- "@vitessce/gl": "3.6.17",
25
- "@vitessce/spatial-utils": "3.6.17",
26
- "@vitessce/utils": "3.6.17",
27
- "@vitessce/vit-s": "3.6.17"
22
+ "@vitessce/styles": "3.7.0",
23
+ "@vitessce/constants-internal": "3.7.0",
24
+ "@vitessce/gl": "3.7.0",
25
+ "@vitessce/spatial-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",