@vitessce/all 3.2.1 → 3.2.2

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-68f84e2a.js";
2
- import { B as BaseDecoder } from "./index-f32678b1.js";
2
+ import { B as BaseDecoder } from "./index-f665a5d4.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -1,6 +1,6 @@
1
1
  import React__default from "react";
2
2
  import ReactDOM__default from "react-dom";
3
- import { c as commonjsGlobal, o as objectAssign, g as getDefaultExportFromCjs, e as earcut, b as getAugmentedNamespace } from "./index-f32678b1.js";
3
+ import { c as commonjsGlobal, o as objectAssign, g as getDefaultExportFromCjs, e as earcut, b as getAugmentedNamespace } from "./index-f665a5d4.js";
4
4
  function _mergeNamespaces(n, m) {
5
5
  for (var i = 0; i < m.length; i++) {
6
6
  const e = m[i];
@@ -155975,16 +155975,16 @@ async function getDecoder(fileDirectory) {
155975
155975
  const Decoder = await importFn();
155976
155976
  return new Decoder(fileDirectory);
155977
155977
  }
155978
- addDecoder([void 0, 1], () => import("./raw-7ca3593c.js").then((m2) => m2.default));
155979
- addDecoder(5, () => import("./lzw-39de0b59.js").then((m2) => m2.default));
155978
+ addDecoder([void 0, 1], () => import("./raw-8dc223b5.js").then((m2) => m2.default));
155979
+ addDecoder(5, () => import("./lzw-b35f334d.js").then((m2) => m2.default));
155980
155980
  addDecoder(6, () => {
155981
155981
  throw new Error("old style JPEG compression is not supported.");
155982
155982
  });
155983
- addDecoder(7, () => import("./jpeg-9980f30b.js").then((m2) => m2.default));
155984
- addDecoder([8, 32946], () => import("./deflate-5a5940c6.js").then((m2) => m2.default));
155985
- addDecoder(32773, () => import("./packbits-85aa5ade.js").then((m2) => m2.default));
155986
- addDecoder(34887, () => import("./lerc-38105022.js").then((m2) => m2.default));
155987
- addDecoder(50001, () => import("./webimage-73569cb7.js").then((m2) => m2.default));
155983
+ addDecoder(7, () => import("./jpeg-b55e77c5.js").then((m2) => m2.default));
155984
+ addDecoder([8, 32946], () => import("./deflate-432aacfa.js").then((m2) => m2.default));
155985
+ addDecoder(32773, () => import("./packbits-6e275aa4.js").then((m2) => m2.default));
155986
+ addDecoder(34887, () => import("./lerc-2523b21e.js").then((m2) => m2.default));
155987
+ addDecoder(50001, () => import("./webimage-917679ff.js").then((m2) => m2.default));
155988
155988
  function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
155989
155989
  return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
155990
155990
  }
@@ -170522,6 +170522,67 @@ function makeBoundingBox(viewState) {
170522
170522
  viewport.unproject([0, viewport.height])
170523
170523
  ];
170524
170524
  }
170525
+ const TARGETS = [1, 2, 3, 4, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1e3];
170526
+ const MIN_TARGET = TARGETS[0];
170527
+ const MAX_TARGET = TARGETS[TARGETS.length - 1];
170528
+ const SI_PREFIXES = [
170529
+ { symbol: "Y", exponent: 24 },
170530
+ { symbol: "Z", exponent: 21 },
170531
+ { symbol: "E", exponent: 18 },
170532
+ { symbol: "P", exponent: 15 },
170533
+ { symbol: "T", exponent: 12 },
170534
+ { symbol: "G", exponent: 9 },
170535
+ { symbol: "M", exponent: 6 },
170536
+ { symbol: "k", exponent: 3 },
170537
+ { symbol: "h", exponent: 2 },
170538
+ { symbol: "da", exponent: 1 },
170539
+ { symbol: "", exponent: 0 },
170540
+ { symbol: "d", exponent: -1 },
170541
+ { symbol: "c", exponent: -2 },
170542
+ { symbol: "m", exponent: -3 },
170543
+ { symbol: "µ", exponent: -6 },
170544
+ { symbol: "n", exponent: -9 },
170545
+ { symbol: "p", exponent: -12 },
170546
+ { symbol: "f", exponent: -15 },
170547
+ { symbol: "a", exponent: -18 },
170548
+ { symbol: "z", exponent: -21 },
170549
+ { symbol: "y", exponent: -24 }
170550
+ ];
170551
+ function sizeToMeters(size2, unit2) {
170552
+ if (!unit2 || unit2 === "m") {
170553
+ return size2;
170554
+ }
170555
+ if (unit2.length > 1) {
170556
+ let unitPrefix = unit2.substring(0, unit2.length - 1);
170557
+ if (unitPrefix === "u") {
170558
+ unitPrefix = "µ";
170559
+ }
170560
+ const unitObj = SI_PREFIXES.find((p) => p.symbol === unitPrefix);
170561
+ if (unitObj) {
170562
+ return size2 * 10 ** unitObj.exponent;
170563
+ }
170564
+ }
170565
+ throw new Error("Received unknown unit");
170566
+ }
170567
+ function snapValue(value2) {
170568
+ let magnitude = 0;
170569
+ if (value2 < MIN_TARGET || value2 > MAX_TARGET) {
170570
+ magnitude = Math.floor(Math.log10(value2));
170571
+ }
170572
+ let snappedUnit = SI_PREFIXES.find(
170573
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude
170574
+ );
170575
+ let adjustedValue = value2 / 10 ** snappedUnit.exponent;
170576
+ if (adjustedValue > 500 && adjustedValue <= 1e3) {
170577
+ snappedUnit = SI_PREFIXES.find(
170578
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
170579
+ );
170580
+ adjustedValue = value2 / 10 ** snappedUnit.exponent;
170581
+ }
170582
+ const targetNewUnits = TARGETS.find((t4) => t4 > adjustedValue);
170583
+ const targetOrigUnits = targetNewUnits * 10 ** snappedUnit.exponent;
170584
+ return [targetOrigUnits, targetNewUnits, snappedUnit.symbol];
170585
+ }
170525
170586
  const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
170526
170587
 
170527
170588
  precision highp float;
@@ -171289,26 +171350,27 @@ const OverviewLayer = class extends CompositeLayer {
171289
171350
  OverviewLayer.layerName = "OverviewLayer";
171290
171351
  OverviewLayer.defaultProps = defaultProps$3;
171291
171352
  function getPosition$1(boundingBox, position2, length2) {
171292
- const viewLength = boundingBox[2][0] - boundingBox[0][0];
171353
+ const viewWidth2 = boundingBox[2][0] - boundingBox[0][0];
171354
+ const viewHeight2 = boundingBox[2][1] - boundingBox[0][1];
171293
171355
  switch (position2) {
171294
171356
  case "bottom-right": {
171295
- const yCoord = boundingBox[2][1] - (boundingBox[2][1] - boundingBox[0][1]) * length2;
171296
- const xLeftCoord = boundingBox[2][0] - viewLength * length2;
171357
+ const yCoord = boundingBox[2][1] - viewHeight2 * length2;
171358
+ const xLeftCoord = boundingBox[2][0] - viewWidth2 * length2;
171297
171359
  return [yCoord, xLeftCoord];
171298
171360
  }
171299
171361
  case "top-right": {
171300
- const yCoord = (boundingBox[2][1] - boundingBox[0][1]) * length2;
171301
- const xLeftCoord = boundingBox[2][0] - viewLength * length2;
171362
+ const yCoord = boundingBox[0][1] + viewHeight2 * length2;
171363
+ const xLeftCoord = boundingBox[2][0] - viewWidth2 * length2;
171302
171364
  return [yCoord, xLeftCoord];
171303
171365
  }
171304
171366
  case "top-left": {
171305
- const yCoord = (boundingBox[2][1] - boundingBox[0][1]) * length2;
171306
- const xLeftCoord = viewLength * length2;
171367
+ const yCoord = boundingBox[0][1] + viewHeight2 * length2;
171368
+ const xLeftCoord = boundingBox[0][0] + viewWidth2 * length2;
171307
171369
  return [yCoord, xLeftCoord];
171308
171370
  }
171309
171371
  case "bottom-left": {
171310
- const yCoord = boundingBox[2][1] - (boundingBox[2][1] - boundingBox[0][1]) * length2;
171311
- const xLeftCoord = viewLength * length2;
171372
+ const yCoord = boundingBox[2][1] - viewHeight2 * length2;
171373
+ const xLeftCoord = boundingBox[0][0] + viewWidth2 * length2;
171312
171374
  return [yCoord, xLeftCoord];
171313
171375
  }
171314
171376
  default: {
@@ -171326,11 +171388,12 @@ const defaultProps$2 = {
171326
171388
  unit: { type: "string", value: "", compare: true },
171327
171389
  size: { type: "number", value: 1, compare: true },
171328
171390
  position: { type: "string", value: "bottom-right", compare: true },
171329
- length: { type: "number", value: 0.085, compare: true }
171391
+ length: { type: "number", value: 0.085, compare: true },
171392
+ snap: { type: "boolean", value: false, compare: true }
171330
171393
  };
171331
171394
  const ScaleBarLayer = class extends CompositeLayer {
171332
171395
  renderLayers() {
171333
- const { id: id2, unit: unit2, size: size2, position: position2, viewState, length: length2 } = this.props;
171396
+ const { id: id2, unit: unit2, size: size2, position: position2, viewState, length: length2, snap } = this.props;
171334
171397
  const boundingBox = makeBoundingBox(viewState);
171335
171398
  const { zoom: zoom2 } = viewState;
171336
171399
  const viewLength = boundingBox[2][0] - boundingBox[0][0];
@@ -171339,15 +171402,27 @@ const ScaleBarLayer = class extends CompositeLayer {
171339
171402
  2 ** (-zoom2 + 1.5),
171340
171403
  (boundingBox[2][1] - boundingBox[0][1]) * 7e-3
171341
171404
  );
171342
- const numUnits = barLength * size2;
171405
+ let adjustedBarLength = barLength;
171406
+ let displayNumber = (barLength * size2).toPrecision(5);
171407
+ let displayUnit = unit2;
171408
+ if (snap) {
171409
+ const meterSize = sizeToMeters(size2, unit2);
171410
+ const numUnits = barLength * meterSize;
171411
+ const [snappedOrigUnits, snappedNewUnits, snappedUnitPrefix] = snapValue(numUnits);
171412
+ adjustedBarLength = snappedOrigUnits / meterSize;
171413
+ displayNumber = snappedNewUnits;
171414
+ displayUnit = `${snappedUnitPrefix}m`;
171415
+ }
171343
171416
  const [yCoord, xLeftCoord] = getPosition$1(boundingBox, position2, length2);
171417
+ const xRightCoord = xLeftCoord + barLength;
171418
+ const isLeft = position2.endsWith("-left");
171344
171419
  const lengthBar = new LineLayer({
171345
171420
  id: `scale-bar-length-${id2}`,
171346
171421
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
171347
171422
  data: [
171348
171423
  [
171349
- [xLeftCoord, yCoord],
171350
- [xLeftCoord + barLength, yCoord]
171424
+ [isLeft ? xLeftCoord : xRightCoord - adjustedBarLength, yCoord],
171425
+ [isLeft ? xLeftCoord + adjustedBarLength : xRightCoord, yCoord]
171351
171426
  ]
171352
171427
  ],
171353
171428
  getSourcePosition: (d) => d[0],
@@ -171360,8 +171435,14 @@ const ScaleBarLayer = class extends CompositeLayer {
171360
171435
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
171361
171436
  data: [
171362
171437
  [
171363
- [xLeftCoord, yCoord - barHeight],
171364
- [xLeftCoord, yCoord + barHeight]
171438
+ [
171439
+ isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
171440
+ yCoord - barHeight
171441
+ ],
171442
+ [
171443
+ isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
171444
+ yCoord + barHeight
171445
+ ]
171365
171446
  ]
171366
171447
  ],
171367
171448
  getSourcePosition: (d) => d[0],
@@ -171374,8 +171455,14 @@ const ScaleBarLayer = class extends CompositeLayer {
171374
171455
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
171375
171456
  data: [
171376
171457
  [
171377
- [xLeftCoord + barLength, yCoord - barHeight],
171378
- [xLeftCoord + barLength, yCoord + barHeight]
171458
+ [
171459
+ isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
171460
+ yCoord - barHeight
171461
+ ],
171462
+ [
171463
+ isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
171464
+ yCoord + barHeight
171465
+ ]
171379
171466
  ]
171380
171467
  ],
171381
171468
  getSourcePosition: (d) => d[0],
@@ -171388,8 +171475,11 @@ const ScaleBarLayer = class extends CompositeLayer {
171388
171475
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
171389
171476
  data: [
171390
171477
  {
171391
- text: numUnits.toPrecision(5) + unit2,
171392
- position: [xLeftCoord + barLength * 0.5, yCoord + barHeight * 4]
171478
+ text: `${displayNumber}${displayUnit}`,
171479
+ position: [
171480
+ isLeft ? xLeftCoord + barLength * 0.5 : xRightCoord - barLength * 0.5,
171481
+ yCoord + barHeight * 4
171482
+ ]
171393
171483
  }
171394
171484
  ],
171395
171485
  getColor: [220, 220, 220, 255],
@@ -171398,7 +171488,7 @@ const ScaleBarLayer = class extends CompositeLayer {
171398
171488
  sizeUnits: "meters",
171399
171489
  sizeScale: 2 ** -zoom2,
171400
171490
  characterSet: [
171401
- ...unit2.split(""),
171491
+ ...displayUnit.split(""),
171402
171492
  ...range$5(10).map((i2) => String(i2)),
171403
171493
  ".",
171404
171494
  "e",
@@ -192514,6 +192604,7 @@ let Spatial$1 = class Spatial extends AbstractSpatialOrScatterplot {
192514
192604
  id: "scalebar-layer",
192515
192605
  unit: unit2,
192516
192606
  size: size2,
192607
+ snap: true,
192517
192608
  viewState: { ...viewState, width: width2, height: height2 }
192518
192609
  });
192519
192610
  }
@@ -193711,6 +193802,7 @@ class Spatial2 extends AbstractSpatialOrScatterplot {
193711
193802
  id: "scalebar-layer",
193712
193803
  unit: "um",
193713
193804
  size: 1,
193805
+ snap: true,
193714
193806
  viewState: { ...viewState, width: width2, height: height2 }
193715
193807
  });
193716
193808
  }
@@ -203667,7 +203759,7 @@ const HIGLASS_BUNDLE_VERSION = "1.11.13";
203667
203759
  const HIGLASS_CSS_URL = `https://unpkg.com/${HIGLASS_PKG_NAME}@${HIGLASS_BUNDLE_VERSION}/dist/hglib.css`;
203668
203760
  register({ dataFetcher: ZarrMultivecDataFetcher, config: ZarrMultivecDataFetcher.config }, { pluginType: "dataFetcher" });
203669
203761
  const LazyHiGlassComponent = React__default.lazy(async () => {
203670
- const { HiGlassComponent } = await import("./hglib-40512a35.js").then((n3) => n3.h);
203762
+ const { HiGlassComponent } = await import("./hglib-1bae5754.js").then((n3) => n3.h);
203671
203763
  return { default: HiGlassComponent };
203672
203764
  });
203673
203765
  const HG_SIZE = 800;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { f, P, h, d, V, z } from "./index-f32678b1.js";
1
+ import { f, P, h, d, V, z } from "./index-f665a5d4.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-f32678b1.js";
1
+ import { B as BaseDecoder } from "./index-f665a5d4.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-f32678b1.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder, L as LercParameters, a as LercAddCompression } from "./index-f665a5d4.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-f32678b1.js";
1
+ import { B as BaseDecoder } from "./index-f665a5d4.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-f32678b1.js";
1
+ import { B as BaseDecoder } from "./index-f665a5d4.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-f32678b1.js";
1
+ import { B as BaseDecoder } from "./index-f665a5d4.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-f32678b1.js";
1
+ import { B as BaseDecoder } from "./index-f665a5d4.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/all",
3
- "version": "3.2.1",
3
+ "version": "3.2.2",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -18,27 +18,27 @@
18
18
  "dependencies": {
19
19
  "@material-ui/core": "~4.12.3",
20
20
  "zod": "^3.21.4",
21
- "@vitessce/constants-internal": "3.2.1",
22
- "@vitessce/csv": "3.2.1",
23
- "@vitessce/description": "3.2.1",
24
- "@vitessce/feature-list": "3.2.1",
25
- "@vitessce/genomic-profiles": "3.2.1",
26
- "@vitessce/heatmap": "3.2.1",
27
- "@vitessce/json": "3.2.1",
28
- "@vitessce/layer-controller": "3.2.1",
29
- "@vitessce/layer-controller-beta": "3.2.1",
30
- "@vitessce/obs-sets-manager": "3.2.1",
31
- "@vitessce/ome-tiff": "3.2.1",
32
- "@vitessce/plugins": "3.2.1",
33
- "@vitessce/scatterplot-embedding": "3.2.1",
34
- "@vitessce/scatterplot-gating": "3.2.1",
35
- "@vitessce/schemas": "3.2.1",
36
- "@vitessce/spatial": "3.2.1",
37
- "@vitessce/spatial-beta": "3.2.1",
38
- "@vitessce/statistical-plots": "3.2.1",
39
- "@vitessce/status": "3.2.1",
40
- "@vitessce/vit-s": "3.2.1",
41
- "@vitessce/zarr": "3.2.1"
21
+ "@vitessce/constants-internal": "3.2.2",
22
+ "@vitessce/description": "3.2.2",
23
+ "@vitessce/csv": "3.2.2",
24
+ "@vitessce/genomic-profiles": "3.2.2",
25
+ "@vitessce/feature-list": "3.2.2",
26
+ "@vitessce/json": "3.2.2",
27
+ "@vitessce/heatmap": "3.2.2",
28
+ "@vitessce/layer-controller": "3.2.2",
29
+ "@vitessce/layer-controller-beta": "3.2.2",
30
+ "@vitessce/obs-sets-manager": "3.2.2",
31
+ "@vitessce/ome-tiff": "3.2.2",
32
+ "@vitessce/plugins": "3.2.2",
33
+ "@vitessce/scatterplot-embedding": "3.2.2",
34
+ "@vitessce/scatterplot-gating": "3.2.2",
35
+ "@vitessce/schemas": "3.2.2",
36
+ "@vitessce/spatial": "3.2.2",
37
+ "@vitessce/statistical-plots": "3.2.2",
38
+ "@vitessce/spatial-beta": "3.2.2",
39
+ "@vitessce/vit-s": "3.2.2",
40
+ "@vitessce/status": "3.2.2",
41
+ "@vitessce/zarr": "3.2.2"
42
42
  },
43
43
  "devDependencies": {
44
44
  "@types/react": "^18.0.28",