@vitessce/layer-controller 4.1.1 → 4.1.3

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.
Files changed (47) hide show
  1. package/dist/{deflate-CnVyYTGe.js → deflate-C2UQgGog.js} +1 -1
  2. package/dist/{index-DkekH6sg.js → index-D02mrrF9.js} +222 -38
  3. package/dist/index.js +3 -1
  4. package/dist/{jpeg-CyLnUuWq.js → jpeg-CmPtEpc0.js} +1 -1
  5. package/dist/{lerc-Bq_FE49m.js → lerc-Rid4JLXA.js} +1 -1
  6. package/dist/{lzw-DowjN1eQ.js → lzw-DDjeHDA5.js} +1 -1
  7. package/dist/{packbits-C2KXotdV.js → packbits-y8Rve0qs.js} +1 -1
  8. package/dist/{raw-WWg3VUst.js → raw-Dqdv3Ys2.js} +1 -1
  9. package/dist/{webimage-BANVukkl.js → webimage-HwcV0mHJ.js} +1 -1
  10. package/dist-tsc/BitmaskChannelController.d.ts +3 -1
  11. package/dist-tsc/BitmaskChannelController.d.ts.map +1 -1
  12. package/dist-tsc/BitmaskChannelController.js +3 -2
  13. package/dist-tsc/BitmaskChannelController.js.map +1 -1
  14. package/dist-tsc/LayerController.d.ts.map +1 -1
  15. package/dist-tsc/LayerController.js +3 -3
  16. package/dist-tsc/LayerController.js.map +1 -1
  17. package/dist-tsc/LayerControllerSubscriber.d.ts.map +1 -1
  18. package/dist-tsc/LayerControllerSubscriber.js +5 -5
  19. package/dist-tsc/LayerControllerSubscriber.js.map +1 -1
  20. package/dist-tsc/LayerOptions.d.ts +5 -1
  21. package/dist-tsc/LayerOptions.d.ts.map +1 -1
  22. package/dist-tsc/LayerOptions.js +16 -2
  23. package/dist-tsc/LayerOptions.js.map +1 -1
  24. package/dist-tsc/RasterChannelController.d.ts +2 -1
  25. package/dist-tsc/RasterChannelController.d.ts.map +1 -1
  26. package/dist-tsc/RasterChannelController.js +3 -2
  27. package/dist-tsc/RasterChannelController.js.map +1 -1
  28. package/dist-tsc/channel-sort-utils.d.ts +21 -0
  29. package/dist-tsc/channel-sort-utils.d.ts.map +1 -0
  30. package/dist-tsc/channel-sort-utils.js +29 -0
  31. package/dist-tsc/channel-sort-utils.js.map +1 -0
  32. package/dist-tsc/index.d.ts +1 -0
  33. package/dist-tsc/index.js +1 -0
  34. package/dist-tsc/index.js.map +1 -1
  35. package/dist-tsc/shared-channel-controls.d.ts +3 -1
  36. package/dist-tsc/shared-channel-controls.d.ts.map +1 -1
  37. package/dist-tsc/shared-channel-controls.js +6 -3
  38. package/dist-tsc/shared-channel-controls.js.map +1 -1
  39. package/package.json +7 -7
  40. package/src/BitmaskChannelController.js +3 -0
  41. package/src/LayerController.js +5 -0
  42. package/src/LayerControllerSubscriber.js +10 -0
  43. package/src/LayerOptions.js +43 -0
  44. package/src/RasterChannelController.js +3 -0
  45. package/src/channel-sort-utils.js +30 -0
  46. package/src/index.js +1 -0
  47. package/src/shared-channel-controls.js +11 -4
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { B as BaseDecoder } from "./index-DkekH6sg.js";
2
+ import { B as BaseDecoder } from "./index-D02mrrF9.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -22487,6 +22487,8 @@ const CoordinationType = {
22487
22487
  SPATIAL_SEGMENTATION_FILLED: "spatialSegmentationFilled",
22488
22488
  SPATIAL_SEGMENTATION_STROKE_WIDTH: "spatialSegmentationStrokeWidth",
22489
22489
  SPATIAL_POINT_STROKE_WIDTH: "spatialPointStrokeWidth",
22490
+ SPATIAL_POINT_RADIUS: "spatialPointRadius",
22491
+ SPATIAL_POINT_PROJECTION_SPACING: "spatialPointProjectionSpacing",
22490
22492
  SPATIAL_CHANNEL_COLOR: "spatialChannelColor",
22491
22493
  SPATIAL_CHANNEL_VISIBLE: "spatialChannelVisible",
22492
22494
  SPATIAL_CHANNEL_OPACITY: "spatialChannelOpacity",
@@ -22501,6 +22503,12 @@ const CoordinationType = {
22501
22503
  // Per-spatial-layer
22502
22504
  SPATIAL_MAX_RESOLUTION: "spatialMaxResolution",
22503
22505
  // Per-image-channel (for spatial-accelerated)
22506
+ SPATIAL_AXIS_LINES_VISIBLE: "spatialAxisLinesVisible",
22507
+ // axisLines' visibility in Neuroglancer View
22508
+ SPATIAL_BOUNDS_VISIBLE: "spatialBoundsVisible",
22509
+ // annotationBounds' visibility in Neuroglancer View
22510
+ SPATIAL_SCALE_BAR_VISIBLE: "spatialScaleBarVisible",
22511
+ SPATIAL_BACKGROUND_THEME: "spatialBackgroundTheme",
22504
22512
  // For clipping plane sliders
22505
22513
  SPATIAL_SLICE_X: "spatialSliceX",
22506
22514
  SPATIAL_SLICE_Y: "spatialSliceY",
@@ -22510,6 +22518,7 @@ const CoordinationType = {
22510
22518
  POINT_LAYER: "pointLayer",
22511
22519
  SPATIAL_SPOT_RADIUS: "spatialSpotRadius",
22512
22520
  // In micrometers?
22521
+ SPATIAL_SPOT_SHAPE: "spatialSpotShape",
22513
22522
  SPATIAL_SPOT_FILLED: "spatialSpotFilled",
22514
22523
  SPATIAL_SPOT_STROKE_WIDTH: "spatialSpotStrokeWidth",
22515
22524
  SPATIAL_LAYER_COLOR: "spatialLayerColor",
@@ -22606,7 +22615,13 @@ const COMPONENT_COORDINATION_TYPES = {
22606
22615
  CoordinationType.SPATIAL_CHANNEL_OPACITY,
22607
22616
  CoordinationType.SPATIAL_CHANNEL_VISIBLE,
22608
22617
  CoordinationType.LEGEND_VISIBLE,
22609
- CoordinationType.SPATIAL_POINT_STROKE_WIDTH
22618
+ CoordinationType.SPATIAL_POINT_STROKE_WIDTH,
22619
+ CoordinationType.SPATIAL_POINT_RADIUS,
22620
+ CoordinationType.SPATIAL_AXIS_LINES_VISIBLE,
22621
+ CoordinationType.SPATIAL_BOUNDS_VISIBLE,
22622
+ CoordinationType.SPATIAL_POINT_PROJECTION_SPACING,
22623
+ CoordinationType.SPATIAL_SCALE_BAR_VISIBLE,
22624
+ CoordinationType.SPATIAL_BACKGROUND_THEME
22610
22625
  ],
22611
22626
  [ViewType.SCATTERPLOT]: [
22612
22627
  CoordinationType.DATASET,
@@ -22783,7 +22798,8 @@ const COMPONENT_COORDINATION_TYPES = {
22783
22798
  CoordinationType.ANNOTATION_OVERLAY_VISIBLE,
22784
22799
  CoordinationType.ANNOTATION_TRANSITION_DURATION,
22785
22800
  CoordinationType.ANNOTATION_EDITABLE,
22786
- CoordinationType.ANNOTATION_SEMANTIC_ZOOM
22801
+ CoordinationType.ANNOTATION_SEMANTIC_ZOOM,
22802
+ CoordinationType.SPATIAL_CHANNELS_SORT_ORDER
22787
22803
  ],
22788
22804
  [ViewType.SPATIAL_BETA]: [
22789
22805
  CoordinationType.META_COORDINATION_SCOPES,
@@ -22854,6 +22870,7 @@ const COMPONENT_COORDINATION_TYPES = {
22854
22870
  CoordinationType.SPOT_LAYER,
22855
22871
  CoordinationType.POINT_LAYER,
22856
22872
  CoordinationType.SPATIAL_SPOT_RADIUS,
22873
+ CoordinationType.SPATIAL_SPOT_SHAPE,
22857
22874
  CoordinationType.SPATIAL_SPOT_FILLED,
22858
22875
  CoordinationType.SPATIAL_SPOT_STROKE_WIDTH,
22859
22876
  CoordinationType.SPATIAL_LAYER_COLOR,
@@ -22871,7 +22888,10 @@ const COMPONENT_COORDINATION_TYPES = {
22871
22888
  CoordinationType.ANNOTATION_OVERLAY_VISIBLE,
22872
22889
  CoordinationType.ANNOTATION_TRANSITION_DURATION,
22873
22890
  CoordinationType.ANNOTATION_EDITABLE,
22874
- CoordinationType.ANNOTATION_SEMANTIC_ZOOM
22891
+ CoordinationType.ANNOTATION_SEMANTIC_ZOOM,
22892
+ CoordinationType.SPATIAL_POINT_RADIUS,
22893
+ CoordinationType.SPATIAL_POINT_STROKE_WIDTH,
22894
+ CoordinationType.SPATIAL_BACKGROUND_THEME
22875
22895
  ],
22876
22896
  [ViewType.ANNOTATION_CONTROLLER]: [
22877
22897
  CoordinationType.DATASET,
@@ -23001,7 +23021,8 @@ const COMPONENT_COORDINATION_TYPES = {
23001
23021
  CoordinationType.SPATIAL_ROTATION_Z,
23002
23022
  CoordinationType.SPATIAL_ROTATION_ORBIT,
23003
23023
  CoordinationType.SPATIAL_ORBIT_AXIS,
23004
- CoordinationType.PHOTOMETRIC_INTERPRETATION
23024
+ CoordinationType.PHOTOMETRIC_INTERPRETATION,
23025
+ CoordinationType.SPATIAL_CHANNELS_SORT_ORDER
23005
23026
  ],
23006
23027
  [ViewType.LAYER_CONTROLLER_BETA]: [
23007
23028
  CoordinationType.META_COORDINATION_SCOPES,
@@ -23035,6 +23056,7 @@ const COMPONENT_COORDINATION_TYPES = {
23035
23056
  CoordinationType.SPATIAL_SEGMENTATION_FILLED,
23036
23057
  CoordinationType.SPATIAL_SEGMENTATION_STROKE_WIDTH,
23037
23058
  CoordinationType.SPATIAL_POINT_STROKE_WIDTH,
23059
+ CoordinationType.SPATIAL_POINT_RADIUS,
23038
23060
  CoordinationType.IMAGE_CHANNEL,
23039
23061
  CoordinationType.IMAGE_LAYER,
23040
23062
  CoordinationType.SEGMENTATION_CHANNEL,
@@ -23053,6 +23075,7 @@ const COMPONENT_COORDINATION_TYPES = {
23053
23075
  CoordinationType.SPOT_LAYER,
23054
23076
  CoordinationType.POINT_LAYER,
23055
23077
  CoordinationType.SPATIAL_SPOT_RADIUS,
23078
+ CoordinationType.SPATIAL_SPOT_SHAPE,
23056
23079
  CoordinationType.SPATIAL_SPOT_FILLED,
23057
23080
  CoordinationType.SPATIAL_SPOT_STROKE_WIDTH,
23058
23081
  CoordinationType.SPATIAL_LAYER_COLOR,
@@ -127218,22 +127241,22 @@ function addDecoder(cases, importFn) {
127218
127241
  }
127219
127242
  cases.forEach((c) => registry$1.set(c, importFn));
127220
127243
  }
127221
- addDecoder([void 0, 1], () => import("./raw-WWg3VUst.js").then((m) => m.default));
127222
- addDecoder(5, () => import("./lzw-DowjN1eQ.js").then((m) => m.default));
127244
+ addDecoder([void 0, 1], () => import("./raw-Dqdv3Ys2.js").then((m) => m.default));
127245
+ addDecoder(5, () => import("./lzw-DDjeHDA5.js").then((m) => m.default));
127223
127246
  addDecoder(6, () => {
127224
127247
  throw new Error("old style JPEG compression is not supported.");
127225
127248
  });
127226
- addDecoder(7, () => import("./jpeg-CyLnUuWq.js").then((m) => m.default));
127227
- addDecoder([8, 32946], () => import("./deflate-CnVyYTGe.js").then((m) => m.default));
127228
- addDecoder(32773, () => import("./packbits-C2KXotdV.js").then((m) => m.default));
127249
+ addDecoder(7, () => import("./jpeg-CmPtEpc0.js").then((m) => m.default));
127250
+ addDecoder([8, 32946], () => import("./deflate-C2UQgGog.js").then((m) => m.default));
127251
+ addDecoder(32773, () => import("./packbits-y8Rve0qs.js").then((m) => m.default));
127229
127252
  addDecoder(
127230
127253
  34887,
127231
- () => import("./lerc-Bq_FE49m.js").then(async (m) => {
127254
+ () => import("./lerc-Rid4JLXA.js").then(async (m) => {
127232
127255
  await m.zstd.init();
127233
127256
  return m;
127234
127257
  }).then((m) => m.default)
127235
127258
  );
127236
- addDecoder(50001, () => import("./webimage-BANVukkl.js").then((m) => m.default));
127259
+ addDecoder(50001, () => import("./webimage-HwcV0mHJ.js").then((m) => m.default));
127237
127260
  function decodeRowAcc(row, stride) {
127238
127261
  let length2 = row.length - stride;
127239
127262
  let offset2 = 0;
@@ -138011,14 +138034,14 @@ vec4 colormap(float intensity) {
138011
138034
  }
138012
138035
  };
138013
138036
  }
138014
- const defaultProps$4$1 = {
138037
+ const defaultProps$4$2 = {
138015
138038
  colormap: { type: "string", value: "viridis", compare: true },
138016
138039
  opacity: { type: "number", value: 1, compare: true },
138017
138040
  useTransparentColor: { type: "boolean", value: false, compare: true }
138018
138041
  };
138019
138042
  const AdditiveColormapExtension = class extends LayerExtension {
138020
138043
  getShaders() {
138021
- const name2 = this?.props?.colormap || defaultProps$4$1.colormap.value;
138044
+ const name2 = this?.props?.colormap || defaultProps$4$2.colormap.value;
138022
138045
  const apply_cmap = cmaps[name2];
138023
138046
  if (!apply_cmap) {
138024
138047
  throw Error(`No colormap named ${name2} found in registry`);
@@ -138037,8 +138060,8 @@ const AdditiveColormapExtension = class extends LayerExtension {
138037
138060
  }
138038
138061
  draw() {
138039
138062
  const {
138040
- useTransparentColor = defaultProps$4$1.useTransparentColor.value,
138041
- opacity = defaultProps$4$1.opacity.value
138063
+ useTransparentColor = defaultProps$4$2.useTransparentColor.value,
138064
+ opacity = defaultProps$4$2.opacity.value
138042
138065
  } = this.props;
138043
138066
  const uniforms = {
138044
138067
  opacity,
@@ -138048,7 +138071,7 @@ const AdditiveColormapExtension = class extends LayerExtension {
138048
138071
  }
138049
138072
  };
138050
138073
  AdditiveColormapExtension.extensionName = "AdditiveColormapExtension";
138051
- AdditiveColormapExtension.defaultProps = defaultProps$4$1;
138074
+ AdditiveColormapExtension.defaultProps = defaultProps$4$2;
138052
138075
  const fs$1$2 = `uniform vec3 transparentColor;
138053
138076
  uniform bool useTransparentColor;
138054
138077
  uniform float opacity;
@@ -139341,7 +139364,7 @@ const ImageLayer = class extends CompositeLayer {
139341
139364
  };
139342
139365
  ImageLayer.layerName = "ImageLayer";
139343
139366
  ImageLayer.defaultProps = defaultProps$5;
139344
- const defaultProps$4 = {
139367
+ const defaultProps$4$1 = {
139345
139368
  pickable: { type: "boolean", value: true, compare: true },
139346
139369
  onHover: { type: "function", value: null, compare: false },
139347
139370
  contrastLimits: { type: "array", value: [], compare: true },
@@ -139453,7 +139476,7 @@ const MultiscaleImageLayer = class extends CompositeLayer {
139453
139476
  }
139454
139477
  };
139455
139478
  MultiscaleImageLayer.layerName = "MultiscaleImageLayer";
139456
- MultiscaleImageLayer.defaultProps = defaultProps$4;
139479
+ MultiscaleImageLayer.defaultProps = defaultProps$4$1;
139457
139480
  const defaultProps$3$1 = {
139458
139481
  pickable: { type: "boolean", value: true, compare: true },
139459
139482
  loader: {
@@ -140554,7 +140577,7 @@ function padWithDefault$1(arr, defaultValue2, padWidth) {
140554
140577
  }
140555
140578
  return newArr;
140556
140579
  }
140557
- const defaultProps$3 = {
140580
+ const defaultProps$4 = {
140558
140581
  hoveredCell: { type: "number", value: null, compare: true },
140559
140582
  // We do not want to deep-compare cellColorData,
140560
140583
  // as it is potentially a TypedArray with millions of elements.
@@ -140671,7 +140694,7 @@ let BitmaskLayer$1 = class BitmaskLayer extends XRLayer {
140671
140694
  }
140672
140695
  };
140673
140696
  BitmaskLayer$1.layerName = "BitmaskLayer";
140674
- BitmaskLayer$1.defaultProps = defaultProps$3;
140697
+ BitmaskLayer$1.defaultProps = defaultProps$4;
140675
140698
  const vs = `
140676
140699
  #define SHADER_NAME bitmask-layer-vertex-shader
140677
140700
 
@@ -141013,7 +141036,7 @@ function isEqualShallow(prevArr, nextArr) {
141013
141036
  }
141014
141037
  return prevArr === nextArr;
141015
141038
  }
141016
- const defaultProps$2 = {
141039
+ const defaultProps$3 = {
141017
141040
  channelStrokeWidths: { type: "array", value: null, compare: true },
141018
141041
  channelsFilled: { type: "array", value: null, compare: true },
141019
141042
  channelOpacities: { type: "array", value: null, compare: true },
@@ -141277,7 +141300,7 @@ class BitmaskLayer2 extends XRLayer {
141277
141300
  }
141278
141301
  }
141279
141302
  BitmaskLayer2.layerName = "BitmaskLayer";
141280
- BitmaskLayer2.defaultProps = defaultProps$2;
141303
+ BitmaskLayer2.defaultProps = defaultProps$3;
141281
141304
  function geomEach(geojson, callback) {
141282
141305
  var i2, j, g2, geometry2, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId2, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
141283
141306
  for (i2 = 0; i2 < stop; i2++) {
@@ -144366,7 +144389,7 @@ function distance(from2, to, options = {}) {
144366
144389
  );
144367
144390
  }
144368
144391
  const DEFAULT_THRESHOLD = 1;
144369
- const defaultProps$1 = {
144392
+ const defaultProps$2 = {
144370
144393
  // for text
144371
144394
  obsSetPath: { type: "object" },
144372
144395
  sampleSetPath: { type: "object" },
@@ -144540,7 +144563,7 @@ class ContourLayerWithText extends ContourLayer {
144540
144563
  }
144541
144564
  }
144542
144565
  ContourLayerWithText.layerName = "ContourLayerWithText";
144543
- ContourLayerWithText.defaultProps = defaultProps$1;
144566
+ ContourLayerWithText.defaultProps = defaultProps$2;
144544
144567
  const ARROW_SCREEN_PX = 14;
144545
144568
  const LABEL_FONT_FAMILY = '"Roboto", "Helvetica", "Arial", sans-serif';
144546
144569
  const LABEL_FONT_WEIGHT = "bold";
@@ -145547,7 +145570,7 @@ function createAnnotationLayers(shapes = [], zoom = 0, selectedShapeUid = null,
145547
145570
  });
145548
145571
  return [...selectionLayers, ...layers, ...measureLayers];
145549
145572
  }
145550
- const defaultProps = {
145573
+ const defaultProps$1 = {
145551
145574
  // Array of annotation shape objects (see annotationShapeObj in @vitessce/schemas).
145552
145575
  data: { type: "object", value: [], compare: true },
145553
145576
  // UID of the shape to highlight with a selection halo.
@@ -145606,7 +145629,101 @@ class AnnotationLayer extends CompositeLayer {
145606
145629
  }
145607
145630
  }
145608
145631
  AnnotationLayer.layerName = "AnnotationLayer";
145609
- AnnotationLayer.defaultProps = defaultProps;
145632
+ AnnotationLayer.defaultProps = defaultProps$1;
145633
+ const DIST_TO_CENTER_ORIGINAL = "float distToCenter = length(unitPosition) * outerRadiusPixels;";
145634
+ const DIST_TO_CENTER_REPLACEMENT = `float distToCenter = (
145635
+ uIsSquare
145636
+ ? max(abs(unitPosition.x), abs(unitPosition.y))
145637
+ : length(unitPosition)
145638
+ ) * outerRadiusPixels;`;
145639
+ const defaultProps = {
145640
+ spotShape: { type: "string", value: "circle", compare: true }
145641
+ };
145642
+ class SpotLayer extends ScatterplotLayer {
145643
+ getShaders() {
145644
+ const shaders = super.getShaders();
145645
+ if (!shaders.fs.includes(DIST_TO_CENTER_ORIGINAL)) {
145646
+ log$5.warn("SpotLayer: unable to modify ScatterplotLayer fragment shader; spots will be rendered as circles.");
145647
+ return shaders;
145648
+ }
145649
+ return {
145650
+ ...shaders,
145651
+ fs: shaders.fs.replace("uniform bool antialiasing;", "uniform bool antialiasing;\nuniform bool uIsSquare;").replace(DIST_TO_CENTER_ORIGINAL, DIST_TO_CENTER_REPLACEMENT)
145652
+ };
145653
+ }
145654
+ draw(opts) {
145655
+ const { spotShape } = this.props;
145656
+ super.draw({
145657
+ ...opts,
145658
+ uniforms: {
145659
+ ...opts.uniforms,
145660
+ uIsSquare: spotShape === "square"
145661
+ }
145662
+ });
145663
+ }
145664
+ }
145665
+ SpotLayer.layerName = "SpotLayer";
145666
+ SpotLayer.defaultProps = defaultProps;
145667
+ makeStyles()(() => ({
145668
+ toolButton: {
145669
+ display: "inline-flex",
145670
+ "&:active": {
145671
+ opacity: ".65",
145672
+ extend: "iconClicked"
145673
+ }
145674
+ },
145675
+ tool: {
145676
+ position: "absolute",
145677
+ display: "inline",
145678
+ zIndex: "1000",
145679
+ opacity: ".65",
145680
+ color: "black",
145681
+ "&:hover": {
145682
+ opacity: ".90"
145683
+ }
145684
+ },
145685
+ iconClicked: {
145686
+ // Styles for the clicked state
145687
+ boxShadow: "none",
145688
+ transform: "scale(0.98)"
145689
+ // make the button slightly smaller
145690
+ },
145691
+ toolIcon: {
145692
+ // btn btn-outline-secondary mr-2 icon
145693
+ padding: "0",
145694
+ height: "2em",
145695
+ width: "2em",
145696
+ backgroundColor: "white",
145697
+ display: "inline-block",
145698
+ fontWeight: "400",
145699
+ textAlign: "center",
145700
+ verticalAlign: "middle",
145701
+ cursor: "pointer",
145702
+ userSelect: "none",
145703
+ border: "1px solid #6c757d",
145704
+ fontSize: "16px",
145705
+ lineHeight: "1.5",
145706
+ borderRadius: "4px",
145707
+ transition: "color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",
145708
+ color: "#6c757d",
145709
+ marginRight: "8px",
145710
+ "& > svg": {
145711
+ verticalAlign: "middle",
145712
+ display: "inline-block",
145713
+ color: "black"
145714
+ },
145715
+ "&:active": {
145716
+ extend: "iconClicked"
145717
+ }
145718
+ },
145719
+ toolActive: {
145720
+ // active
145721
+ color: "#fff",
145722
+ backgroundColor: "#6c757d",
145723
+ borderColor: "#6c757d",
145724
+ boxShadow: "0 0 0 3px rgba(108, 117, 125, 0.5)"
145725
+ }
145726
+ }));
145610
145727
  const toRgbUIString = (on, arr, theme) => {
145611
145728
  const color2 = on || theme !== "dark" && arr?.every((i2) => i2 === 255) ? [220, 220, 220] : arr;
145612
145729
  return `rgb(${color2})`;
@@ -146006,13 +146123,34 @@ function ChannelOptions({ handlePropertyChange, handleChannelRemove, handleIQRUp
146006
146123
  )
146007
146124
  );
146008
146125
  }
146126
+ const CHANNELS_SORT_ORDER_OPTIONS = [
146127
+ { value: "original", label: "Original" },
146128
+ { value: "alphabetical", label: "Alphabetical" }
146129
+ ];
146130
+ function getSortedChannelOptions(channelNames, channelsSortOrder) {
146131
+ if (!Array.isArray(channelNames)) return [];
146132
+ const options = channelNames.map((channelName, channelIndex) => ({ channelName, channelIndex }));
146133
+ if (channelsSortOrder === "alphabetical") {
146134
+ return options.sort((a2, b) => String(a2.channelName).localeCompare(
146135
+ String(b.channelName),
146136
+ void 0,
146137
+ { numeric: true, sensitivity: "base" }
146138
+ ));
146139
+ }
146140
+ return options;
146141
+ }
146009
146142
  function ChannelSelectionDropdown({
146010
146143
  handleChange,
146011
146144
  disabled,
146012
146145
  channelOptions,
146013
- selectionIndex
146146
+ selectionIndex,
146147
+ channelsSortOrder
146014
146148
  }) {
146015
146149
  const { classes } = useSelectStyles();
146150
+ const sortedOptions = useMemo(
146151
+ () => getSortedChannelOptions(channelOptions, channelsSortOrder),
146152
+ [channelOptions, channelsSortOrder]
146153
+ );
146016
146154
  return /* @__PURE__ */ React__default.createElement(
146017
146155
  NativeSelect,
146018
146156
  {
@@ -146021,7 +146159,7 @@ function ChannelSelectionDropdown({
146021
146159
  onChange: (e2) => handleChange(Number(e2.target.value)),
146022
146160
  inputProps: { "aria-label": "Select a channel" }
146023
146161
  },
146024
- channelOptions.map((opt, i2) => /* @__PURE__ */ React__default.createElement("option", { disabled, key: opt, value: i2 }, opt))
146162
+ sortedOptions.map(({ channelName, channelIndex }) => /* @__PURE__ */ React__default.createElement("option", { disabled, key: `${channelName}-${channelIndex}`, value: channelIndex }, channelName))
146025
146163
  );
146026
146164
  }
146027
146165
  function ChannelVisibilityCheckbox({
@@ -146105,7 +146243,8 @@ function RasterChannelController({
146105
146243
  handleIQRUpdate,
146106
146244
  selectionIndex,
146107
146245
  isLoading,
146108
- use3d: newUse3d
146246
+ use3d: newUse3d,
146247
+ channelsSortOrder
146109
146248
  }) {
146110
146249
  const { dtype } = getSourceFromLoader(loader);
146111
146250
  const [domain, setDomain] = useState(null);
@@ -146198,7 +146337,8 @@ function RasterChannelController({
146198
146337
  handleChange: (v) => handlePropertyChange("selection", createSelection(v)),
146199
146338
  selectionIndex,
146200
146339
  channelOptions,
146201
- disabled: isLoading
146340
+ disabled: isLoading,
146341
+ channelsSortOrder
146202
146342
  }
146203
146343
  )),
146204
146344
  /* @__PURE__ */ React__default.createElement(Grid, { size: 1, sx: { marginTop: "4px" } }, /* @__PURE__ */ React__default.createElement(
@@ -146247,6 +146387,7 @@ function BitmaskChannelController({
146247
146387
  visibility = false,
146248
146388
  dimName,
146249
146389
  channelOptions,
146390
+ channelsSortOrder,
146250
146391
  handlePropertyChange,
146251
146392
  handleChannelRemove,
146252
146393
  selectionIndex,
@@ -146276,7 +146417,8 @@ function BitmaskChannelController({
146276
146417
  handleChange: (v) => handlePropertyChange("selection", createSelection(v)),
146277
146418
  selectionIndex,
146278
146419
  disableOptions,
146279
- channelOptions
146420
+ channelOptions,
146421
+ channelsSortOrder
146280
146422
  }
146281
146423
  )),
146282
146424
  /* @__PURE__ */ React__default.createElement(Grid, { size: 1 }, /* @__PURE__ */ React__default.createElement(
@@ -146633,6 +146775,21 @@ function OpacitySlider({ value, inputId, handleChange }) {
146633
146775
  }
146634
146776
  );
146635
146777
  }
146778
+ function ChannelsSortOrderSelect({ value, inputId, handleChange }) {
146779
+ const { classes } = useSelectStyles();
146780
+ return /* @__PURE__ */ React__default.createElement(
146781
+ NativeSelect,
146782
+ {
146783
+ onChange: (e2) => handleChange(e2.target.value),
146784
+ value: value || "original",
146785
+ id: inputId,
146786
+ inputProps: { "aria-label": "Channel sort order selector" },
146787
+ style: { width: "100%" },
146788
+ classes: { root: classes.selectRoot }
146789
+ },
146790
+ CHANNELS_SORT_ORDER_OPTIONS.map(({ value: optValue, label }) => /* @__PURE__ */ React__default.createElement("option", { key: optValue, value: optValue }, label))
146791
+ );
146792
+ }
146636
146793
  function SliderDomainSelector({ value, inputId, handleChange }) {
146637
146794
  const { classes } = useSelectStyles();
146638
146795
  return /* @__PURE__ */ React__default.createElement(
@@ -146704,6 +146861,8 @@ function LayerOptions({
146704
146861
  handleGlobalChannelsSelectionChange,
146705
146862
  handleSliderChange,
146706
146863
  handleDomainChange,
146864
+ channelsSortOrder,
146865
+ handleChannelsSortOrderChange,
146707
146866
  transparentColor,
146708
146867
  channels: channels2,
146709
146868
  domainType,
@@ -146734,6 +146893,7 @@ function LayerOptions({
146734
146893
  const domainSelectorId = $bdb11010cef70236$export$f680877a34711e37();
146735
146894
  const opacitySliderId = $bdb11010cef70236$export$f680877a34711e37();
146736
146895
  const zeroTransparentId = $bdb11010cef70236$export$f680877a34711e37();
146896
+ const channelsSortOrderId = $bdb11010cef70236$export$f680877a34711e37();
146737
146897
  return /* @__PURE__ */ React__default.createElement(Grid, { container: true, sx: { flexDirection: "column", width: "100%" } }, hasZStack && !disable3d && hasViewableResolutions && /* @__PURE__ */ React__default.createElement(
146738
146898
  VolumeDropdown,
146739
146899
  {
@@ -146770,6 +146930,13 @@ function LayerOptions({
146770
146930
  inputId: colormapSelectId,
146771
146931
  handleChange: handleColormapChange
146772
146932
  }
146933
+ ))), hasDimensionsAndChannels && handleChannelsSortOrderChange && /* @__PURE__ */ React__default.createElement(Grid, null, /* @__PURE__ */ React__default.createElement(LayerOption, { name: "Channel Order", inputId: channelsSortOrderId }, /* @__PURE__ */ React__default.createElement(
146934
+ ChannelsSortOrderSelect,
146935
+ {
146936
+ value: channelsSortOrder,
146937
+ inputId: channelsSortOrderId,
146938
+ handleChange: handleChannelsSortOrderChange
146939
+ }
146773
146940
  ))), shouldShowDomain && /* @__PURE__ */ React__default.createElement(Grid, null, /* @__PURE__ */ React__default.createElement(LayerOption, { name: "Domain", inputId: domainSelectorId }, /* @__PURE__ */ React__default.createElement(
146774
146941
  SliderDomainSelector,
146775
146942
  {
@@ -147055,7 +147222,9 @@ function LayerController(props) {
147055
147222
  spatialHeight,
147056
147223
  spatialWidth,
147057
147224
  photometricInterpretation,
147058
- shouldShowRemoveLayerButton
147225
+ shouldShowRemoveLayerButton,
147226
+ channelsSortOrder,
147227
+ setChannelsSortOrder
147059
147228
  } = props;
147060
147229
  const {
147061
147230
  colormap,
@@ -147295,7 +147464,8 @@ function LayerController(props) {
147295
147464
  handleIQRUpdate,
147296
147465
  setRasterLayerCallback: setImageLayerCallback,
147297
147466
  isLoading: areLayerChannelsLoading[channelId],
147298
- use3d
147467
+ use3d,
147468
+ channelsSortOrder
147299
147469
  }
147300
147470
  );
147301
147471
  }
@@ -147343,7 +147513,9 @@ function LayerController(props) {
147343
147513
  setViewState,
147344
147514
  spatialHeight,
147345
147515
  spatialWidth,
147346
- modelMatrix: modelMatrix2
147516
+ modelMatrix: modelMatrix2,
147517
+ channelsSortOrder,
147518
+ handleChannelsSortOrderChange: setChannelsSortOrder
147347
147519
  }
147348
147520
  ), photometricInterpretation === "RGB" ? null : channelControllers, photometricInterpretation === "RGB" ? null : /* @__PURE__ */ React__default.createElement(
147349
147521
  Button,
@@ -147605,6 +147777,8 @@ const LayerControllerMemoized = React__default.memo(
147605
147777
  spatialLayout,
147606
147778
  handleImageAdd,
147607
147779
  enableLayerButtonsWithOneLayer,
147780
+ channelsSortOrder,
147781
+ setChannelsSortOrder,
147608
147782
  helpText
147609
147783
  } = props;
147610
147784
  const shouldShowImageLayerButton = Boolean(
@@ -147702,7 +147876,9 @@ const LayerControllerMemoized = React__default.memo(
147702
147876
  areLayerChannelsLoading,
147703
147877
  spatialHeight: componentHeight * (spatialLayout ? spatialLayout.h : 1) / 12,
147704
147878
  spatialWidth: componentWidth * (spatialLayout ? spatialLayout.w : 1) / 12,
147705
- shouldShowRemoveLayerButton: shouldShowImageLayerButton
147879
+ shouldShowRemoveLayerButton: shouldShowImageLayerButton,
147880
+ channelsSortOrder,
147881
+ setChannelsSortOrder
147706
147882
  }
147707
147883
  )
147708
147884
  ) : null;
@@ -147768,7 +147944,9 @@ const LayerControllerMemoized = React__default.memo(
147768
147944
  areLayerChannelsLoading,
147769
147945
  spatialHeight: componentHeight * (spatialLayout ? spatialLayout.h : 1) / 12,
147770
147946
  spatialWidth: componentWidth * (spatialLayout ? spatialLayout.w : 1) / 12,
147771
- shouldShowRemoveLayerButton: shouldShowImageLayerButton
147947
+ shouldShowRemoveLayerButton: shouldShowImageLayerButton,
147948
+ channelsSortOrder,
147949
+ setChannelsSortOrder
147772
147950
  }
147773
147951
  )
147774
147952
  ) : null;
@@ -147804,7 +147982,8 @@ function LayerControllerSubscriber(props) {
147804
147982
  spatialImageLayer: rasterLayers,
147805
147983
  spatialSegmentationLayer: cellsLayer,
147806
147984
  spatialPointLayer: moleculesLayer,
147807
- photometricInterpretation: photometricInterpretationFromCoordination
147985
+ photometricInterpretation: photometricInterpretationFromCoordination,
147986
+ spatialChannelsSortOrder: channelsSortOrder
147808
147987
  },
147809
147988
  {
147810
147989
  setSpatialImageLayer: setRasterLayers,
@@ -147815,7 +147994,8 @@ function LayerControllerSubscriber(props) {
147815
147994
  setSpatialTargetZ: setTargetZ,
147816
147995
  setSpatialRotationX: setRotationX,
147817
147996
  setSpatialRotationOrbit: setRotationOrbit,
147818
- setSpatialZoom: setZoom
147997
+ setSpatialZoom: setZoom,
147998
+ setSpatialChannelsSortOrder: setChannelsSortOrder
147819
147999
  }
147820
148000
  ] = useCoordination(
147821
148001
  COMPONENT_COORDINATION_TYPES[ViewType.LAYER_CONTROLLER],
@@ -147959,6 +148139,8 @@ function LayerControllerSubscriber(props) {
147959
148139
  handleRasterLayerChange,
147960
148140
  handleRasterLayerRemove,
147961
148141
  photometricInterpretation,
148142
+ channelsSortOrder,
148143
+ setChannelsSortOrder,
147962
148144
  obsSegmentationsType,
147963
148145
  segmentationLayerLoaders,
147964
148146
  segmentationLayerMeta,
@@ -147988,6 +148170,7 @@ function LayerControllerSubscriber(props) {
147988
148170
  }
147989
148171
  export {
147990
148172
  BaseDecoder as B,
148173
+ CHANNELS_SORT_ORDER_OPTIONS as C,
147991
148174
  LayerControllerSubscriber as L,
147992
148175
  VectorLayerController as V,
147993
148176
  LayerController as a,
@@ -147998,5 +148181,6 @@ export {
147998
148181
  useOverflowEllipsisGridStyles as f,
147999
148182
  getDefaultExportFromCjs as g,
148000
148183
  useSelectionSliderStyles as h,
148184
+ getSortedChannelOptions as i,
148001
148185
  useSpanStyles as u
148002
148186
  };
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
- import { a, L, V, d, c, e, f, b, h, u } from "./index-DkekH6sg.js";
1
+ import { C, a, L, V, i, d, c, e, f, b, h, u } from "./index-D02mrrF9.js";
2
2
  export {
3
+ C as CHANNELS_SORT_ORDER_OPTIONS,
3
4
  a as LayerController,
4
5
  L as LayerControllerSubscriber,
5
6
  V as VectorLayerController,
7
+ i as getSortedChannelOptions,
6
8
  d as useAccordionStyles,
7
9
  c as useControllerSectionStyles,
8
10
  e as useInputLabelStyles,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-DkekH6sg.js";
1
+ import { B as BaseDecoder } from "./index-D02mrrF9.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-DkekH6sg.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-D02mrrF9.js";
3
3
  const LercParameters = {
4
4
  AddCompression: 1
5
5
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-DkekH6sg.js";
1
+ import { B as BaseDecoder } from "./index-D02mrrF9.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-DkekH6sg.js";
1
+ import { B as BaseDecoder } from "./index-D02mrrF9.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-DkekH6sg.js";
1
+ import { B as BaseDecoder } from "./index-D02mrrF9.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-DkekH6sg.js";
1
+ import { B as BaseDecoder } from "./index-D02mrrF9.js";
2
2
  class WebImageDecoder extends BaseDecoder {
3
3
  constructor() {
4
4
  super();
@@ -8,11 +8,13 @@ export default BitmaskChannelController;
8
8
  * @prop {function} handleChannelRemove When a channel is removed, this is called.
9
9
  * @prop {number} selectionIndex The current numeric index of the selection.
10
10
  * @prop {boolean} disableOptions Whether or not channel options are be disabled (default: false).
11
+ * @prop {string} channelsSortOrder Either 'original' or 'alphabetical'.
11
12
  */
12
- declare function BitmaskChannelController({ visibility, dimName, channelOptions, handlePropertyChange, handleChannelRemove, selectionIndex, disableOptions, }: {
13
+ declare function BitmaskChannelController({ visibility, dimName, channelOptions, channelsSortOrder, handlePropertyChange, handleChannelRemove, selectionIndex, disableOptions, }: {
13
14
  visibility?: boolean | undefined;
14
15
  dimName: any;
15
16
  channelOptions: any;
17
+ channelsSortOrder: any;
16
18
  handlePropertyChange: any;
17
19
  handleChannelRemove: any;
18
20
  selectionIndex: any;
@@ -1 +1 @@
1
- {"version":3,"file":"BitmaskChannelController.d.ts","sourceRoot":"","sources":["../src/BitmaskChannelController.js"],"names":[],"mappings":";AAIA;;;;;;;;;GASG;AACH;;;;;;;;QAsDC"}
1
+ {"version":3,"file":"BitmaskChannelController.d.ts","sourceRoot":"","sources":["../src/BitmaskChannelController.js"],"names":[],"mappings":";AAIA;;;;;;;;;;GAUG;AACH;;;;;;;;;QAwDC"}