@vitessce/scatterplot 3.2.1 → 3.3.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-68f84e2a.js";
2
- import { B as BaseDecoder } from "./index-dee2d8c8.js";
2
+ import { B as BaseDecoder } from "./index-e56d07d4.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -104715,16 +104715,16 @@ function addDecoder(cases, importFn) {
104715
104715
  }
104716
104716
  cases.forEach((c2) => registry$1.set(c2, importFn));
104717
104717
  }
104718
- addDecoder([void 0, 1], () => import("./raw-509b9ed8.js").then((m2) => m2.default));
104719
- addDecoder(5, () => import("./lzw-2e11138a.js").then((m2) => m2.default));
104718
+ addDecoder([void 0, 1], () => import("./raw-c0ed9ed9.js").then((m2) => m2.default));
104719
+ addDecoder(5, () => import("./lzw-222a43b7.js").then((m2) => m2.default));
104720
104720
  addDecoder(6, () => {
104721
104721
  throw new Error("old style JPEG compression is not supported.");
104722
104722
  });
104723
- addDecoder(7, () => import("./jpeg-229281af.js").then((m2) => m2.default));
104724
- addDecoder([8, 32946], () => import("./deflate-4c27e1be.js").then((m2) => m2.default));
104725
- addDecoder(32773, () => import("./packbits-34cdac05.js").then((m2) => m2.default));
104726
- addDecoder(34887, () => import("./lerc-9e647d79.js").then((m2) => m2.default));
104727
- addDecoder(50001, () => import("./webimage-5aedafc5.js").then((m2) => m2.default));
104723
+ addDecoder(7, () => import("./jpeg-dc39f309.js").then((m2) => m2.default));
104724
+ addDecoder([8, 32946], () => import("./deflate-de78ef84.js").then((m2) => m2.default));
104725
+ addDecoder(32773, () => import("./packbits-e78514a9.js").then((m2) => m2.default));
104726
+ addDecoder(34887, () => import("./lerc-5ad03453.js").then((m2) => m2.default));
104727
+ addDecoder(50001, () => import("./webimage-ee2f72af.js").then((m2) => m2.default));
104728
104728
  function decodeRowAcc(row, stride) {
104729
104729
  let length2 = row.length - stride;
104730
104730
  let offset5 = 0;
@@ -113624,6 +113624,67 @@ function makeBoundingBox(viewState) {
113624
113624
  viewport.unproject([0, viewport.height])
113625
113625
  ];
113626
113626
  }
113627
+ const TARGETS = [1, 2, 3, 4, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1e3];
113628
+ const MIN_TARGET = TARGETS[0];
113629
+ const MAX_TARGET = TARGETS[TARGETS.length - 1];
113630
+ const SI_PREFIXES = [
113631
+ { symbol: "Y", exponent: 24 },
113632
+ { symbol: "Z", exponent: 21 },
113633
+ { symbol: "E", exponent: 18 },
113634
+ { symbol: "P", exponent: 15 },
113635
+ { symbol: "T", exponent: 12 },
113636
+ { symbol: "G", exponent: 9 },
113637
+ { symbol: "M", exponent: 6 },
113638
+ { symbol: "k", exponent: 3 },
113639
+ { symbol: "h", exponent: 2 },
113640
+ { symbol: "da", exponent: 1 },
113641
+ { symbol: "", exponent: 0 },
113642
+ { symbol: "d", exponent: -1 },
113643
+ { symbol: "c", exponent: -2 },
113644
+ { symbol: "m", exponent: -3 },
113645
+ { symbol: "µ", exponent: -6 },
113646
+ { symbol: "n", exponent: -9 },
113647
+ { symbol: "p", exponent: -12 },
113648
+ { symbol: "f", exponent: -15 },
113649
+ { symbol: "a", exponent: -18 },
113650
+ { symbol: "z", exponent: -21 },
113651
+ { symbol: "y", exponent: -24 }
113652
+ ];
113653
+ function sizeToMeters(size, unit) {
113654
+ if (!unit || unit === "m") {
113655
+ return size;
113656
+ }
113657
+ if (unit.length > 1) {
113658
+ let unitPrefix = unit.substring(0, unit.length - 1);
113659
+ if (unitPrefix === "u") {
113660
+ unitPrefix = "µ";
113661
+ }
113662
+ const unitObj = SI_PREFIXES.find((p) => p.symbol === unitPrefix);
113663
+ if (unitObj) {
113664
+ return size * 10 ** unitObj.exponent;
113665
+ }
113666
+ }
113667
+ throw new Error("Received unknown unit");
113668
+ }
113669
+ function snapValue(value) {
113670
+ let magnitude = 0;
113671
+ if (value < MIN_TARGET || value > MAX_TARGET) {
113672
+ magnitude = Math.floor(Math.log10(value));
113673
+ }
113674
+ let snappedUnit = SI_PREFIXES.find(
113675
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude
113676
+ );
113677
+ let adjustedValue = value / 10 ** snappedUnit.exponent;
113678
+ if (adjustedValue > 500 && adjustedValue <= 1e3) {
113679
+ snappedUnit = SI_PREFIXES.find(
113680
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
113681
+ );
113682
+ adjustedValue = value / 10 ** snappedUnit.exponent;
113683
+ }
113684
+ const targetNewUnits = TARGETS.find((t2) => t2 > adjustedValue);
113685
+ const targetOrigUnits = targetNewUnits * 10 ** snappedUnit.exponent;
113686
+ return [targetOrigUnits, targetNewUnits, snappedUnit.symbol];
113687
+ }
113627
113688
  const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
113628
113689
 
113629
113690
  precision highp float;
@@ -114391,26 +114452,27 @@ const OverviewLayer = class extends CompositeLayer {
114391
114452
  OverviewLayer.layerName = "OverviewLayer";
114392
114453
  OverviewLayer.defaultProps = defaultProps$3;
114393
114454
  function getPosition$1(boundingBox, position, length2) {
114394
- const viewLength = boundingBox[2][0] - boundingBox[0][0];
114455
+ const viewWidth = boundingBox[2][0] - boundingBox[0][0];
114456
+ const viewHeight = boundingBox[2][1] - boundingBox[0][1];
114395
114457
  switch (position) {
114396
114458
  case "bottom-right": {
114397
- const yCoord = boundingBox[2][1] - (boundingBox[2][1] - boundingBox[0][1]) * length2;
114398
- const xLeftCoord = boundingBox[2][0] - viewLength * length2;
114459
+ const yCoord = boundingBox[2][1] - viewHeight * length2;
114460
+ const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
114399
114461
  return [yCoord, xLeftCoord];
114400
114462
  }
114401
114463
  case "top-right": {
114402
- const yCoord = (boundingBox[2][1] - boundingBox[0][1]) * length2;
114403
- const xLeftCoord = boundingBox[2][0] - viewLength * length2;
114464
+ const yCoord = boundingBox[0][1] + viewHeight * length2;
114465
+ const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
114404
114466
  return [yCoord, xLeftCoord];
114405
114467
  }
114406
114468
  case "top-left": {
114407
- const yCoord = (boundingBox[2][1] - boundingBox[0][1]) * length2;
114408
- const xLeftCoord = viewLength * length2;
114469
+ const yCoord = boundingBox[0][1] + viewHeight * length2;
114470
+ const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
114409
114471
  return [yCoord, xLeftCoord];
114410
114472
  }
114411
114473
  case "bottom-left": {
114412
- const yCoord = boundingBox[2][1] - (boundingBox[2][1] - boundingBox[0][1]) * length2;
114413
- const xLeftCoord = viewLength * length2;
114474
+ const yCoord = boundingBox[2][1] - viewHeight * length2;
114475
+ const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
114414
114476
  return [yCoord, xLeftCoord];
114415
114477
  }
114416
114478
  default: {
@@ -114428,11 +114490,12 @@ const defaultProps$2$1 = {
114428
114490
  unit: { type: "string", value: "", compare: true },
114429
114491
  size: { type: "number", value: 1, compare: true },
114430
114492
  position: { type: "string", value: "bottom-right", compare: true },
114431
- length: { type: "number", value: 0.085, compare: true }
114493
+ length: { type: "number", value: 0.085, compare: true },
114494
+ snap: { type: "boolean", value: false, compare: true }
114432
114495
  };
114433
114496
  const ScaleBarLayer = class extends CompositeLayer {
114434
114497
  renderLayers() {
114435
- const { id, unit, size, position, viewState, length: length2 } = this.props;
114498
+ const { id, unit, size, position, viewState, length: length2, snap } = this.props;
114436
114499
  const boundingBox = makeBoundingBox(viewState);
114437
114500
  const { zoom } = viewState;
114438
114501
  const viewLength = boundingBox[2][0] - boundingBox[0][0];
@@ -114441,15 +114504,27 @@ const ScaleBarLayer = class extends CompositeLayer {
114441
114504
  2 ** (-zoom + 1.5),
114442
114505
  (boundingBox[2][1] - boundingBox[0][1]) * 7e-3
114443
114506
  );
114444
- const numUnits = barLength * size;
114507
+ let adjustedBarLength = barLength;
114508
+ let displayNumber = (barLength * size).toPrecision(5);
114509
+ let displayUnit = unit;
114510
+ if (snap) {
114511
+ const meterSize = sizeToMeters(size, unit);
114512
+ const numUnits = barLength * meterSize;
114513
+ const [snappedOrigUnits, snappedNewUnits, snappedUnitPrefix] = snapValue(numUnits);
114514
+ adjustedBarLength = snappedOrigUnits / meterSize;
114515
+ displayNumber = snappedNewUnits;
114516
+ displayUnit = `${snappedUnitPrefix}m`;
114517
+ }
114445
114518
  const [yCoord, xLeftCoord] = getPosition$1(boundingBox, position, length2);
114519
+ const xRightCoord = xLeftCoord + barLength;
114520
+ const isLeft = position.endsWith("-left");
114446
114521
  const lengthBar = new LineLayer({
114447
114522
  id: `scale-bar-length-${id}`,
114448
114523
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
114449
114524
  data: [
114450
114525
  [
114451
- [xLeftCoord, yCoord],
114452
- [xLeftCoord + barLength, yCoord]
114526
+ [isLeft ? xLeftCoord : xRightCoord - adjustedBarLength, yCoord],
114527
+ [isLeft ? xLeftCoord + adjustedBarLength : xRightCoord, yCoord]
114453
114528
  ]
114454
114529
  ],
114455
114530
  getSourcePosition: (d) => d[0],
@@ -114462,8 +114537,14 @@ const ScaleBarLayer = class extends CompositeLayer {
114462
114537
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
114463
114538
  data: [
114464
114539
  [
114465
- [xLeftCoord, yCoord - barHeight],
114466
- [xLeftCoord, yCoord + barHeight]
114540
+ [
114541
+ isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
114542
+ yCoord - barHeight
114543
+ ],
114544
+ [
114545
+ isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
114546
+ yCoord + barHeight
114547
+ ]
114467
114548
  ]
114468
114549
  ],
114469
114550
  getSourcePosition: (d) => d[0],
@@ -114476,8 +114557,14 @@ const ScaleBarLayer = class extends CompositeLayer {
114476
114557
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
114477
114558
  data: [
114478
114559
  [
114479
- [xLeftCoord + barLength, yCoord - barHeight],
114480
- [xLeftCoord + barLength, yCoord + barHeight]
114560
+ [
114561
+ isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
114562
+ yCoord - barHeight
114563
+ ],
114564
+ [
114565
+ isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
114566
+ yCoord + barHeight
114567
+ ]
114481
114568
  ]
114482
114569
  ],
114483
114570
  getSourcePosition: (d) => d[0],
@@ -114490,8 +114577,11 @@ const ScaleBarLayer = class extends CompositeLayer {
114490
114577
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
114491
114578
  data: [
114492
114579
  {
114493
- text: numUnits.toPrecision(5) + unit,
114494
- position: [xLeftCoord + barLength * 0.5, yCoord + barHeight * 4]
114580
+ text: `${displayNumber}${displayUnit}`,
114581
+ position: [
114582
+ isLeft ? xLeftCoord + barLength * 0.5 : xRightCoord - barLength * 0.5,
114583
+ yCoord + barHeight * 4
114584
+ ]
114495
114585
  }
114496
114586
  ],
114497
114587
  getColor: [220, 220, 220, 255],
@@ -114500,7 +114590,7 @@ const ScaleBarLayer = class extends CompositeLayer {
114500
114590
  sizeUnits: "meters",
114501
114591
  sizeScale: 2 ** -zoom,
114502
114592
  characterSet: [
114503
- ...unit.split(""),
114593
+ ...displayUnit.split(""),
114504
114594
  ...range$3(10).map((i2) => String(i2)),
114505
114595
  ".",
114506
114596
  "e",
@@ -123906,6 +123996,7 @@ const DataType$1 = {
123906
123996
  const FileType$1 = {
123907
123997
  // Joint file types
123908
123998
  ANNDATA_ZARR: "anndata.zarr",
123999
+ SPATIALDATA_ZARR: "spatialdata.zarr",
123909
124000
  // Atomic file types
123910
124001
  OBS_EMBEDDING_CSV: "obsEmbedding.csv",
123911
124002
  OBS_SPOTS_CSV: "obsSpots.csv",
@@ -123928,6 +124019,16 @@ const FileType$1 = {
123928
124019
  OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
123929
124020
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
123930
124021
  FEATURE_LABELS_ANNDATA_ZARR: "featureLabels.anndata.zarr",
124022
+ // SpatialData
124023
+ IMAGE_SPATIALDATA_ZARR: "image.spatialdata.zarr",
124024
+ LABELS_SPATIALDATA_ZARR: "labels.spatialdata.zarr",
124025
+ SHAPES_SPATIALDATA_ZARR: "shapes.spatialdata.zarr",
124026
+ OBS_FEATURE_MATRIX_SPATIALDATA_ZARR: "obsFeatureMatrix.spatialdata.zarr",
124027
+ OBS_SETS_SPATIALDATA_ZARR: "obsSets.spatialdata.zarr",
124028
+ OBS_SPOTS_SPATIALDATA_ZARR: "obsSpots.spatialdata.zarr",
124029
+ // TODO:
124030
+ // OBS_POINTS_SPATIALDATA_ZARR: 'obsPoints.spatialdata.zarr',
124031
+ // OBS_LOCATIONS_SPATIALDATA_ZARR: 'obsLocations.spatialdata.zarr',
123931
124032
  // MuData
123932
124033
  OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
123933
124034
  OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
@@ -124364,9 +124465,30 @@ z.object({
124364
124465
  offsetsUrl: z.string().optional(),
124365
124466
  coordinateTransformations: omeCoordinateTransformations.optional()
124366
124467
  });
124367
- z.object({
124468
+ const imageOmeZarrSchema = z.object({
124368
124469
  coordinateTransformations: omeCoordinateTransformations.optional()
124369
124470
  });
124471
+ imageOmeZarrSchema.extend({
124472
+ path: z.string()
124473
+ });
124474
+ z.object({
124475
+ path: z.string()
124476
+ });
124477
+ z.object({
124478
+ path: z.string()
124479
+ });
124480
+ z.object({
124481
+ path: z.string(),
124482
+ tablePath: z.string().optional().describe("The path to a table which annotates the spots. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected.")
124483
+ });
124484
+ annDataObsFeatureMatrix.extend({
124485
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
124486
+ });
124487
+ z.object({
124488
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
124489
+ tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
124490
+ obsSets: annDataObsSets
124491
+ });
124370
124492
  z.object({
124371
124493
  obsIndex: z.string(),
124372
124494
  obsEmbedding: z.array(z.string()).length(2)
@@ -130924,9 +131046,9 @@ const schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [2
130924
131046
  function rgbSpline(spline) {
130925
131047
  return (colors) => {
130926
131048
  const n2 = colors.length;
130927
- let r2 = new Array(n2);
130928
- let g2 = new Array(n2);
130929
- let b = new Array(n2);
131049
+ const r2 = new Array(n2);
131050
+ const g2 = new Array(n2);
131051
+ const b = new Array(n2);
130930
131052
  let i2;
130931
131053
  let color;
130932
131054
  for (i2 = 0; i2 < n2; ++i2) {
@@ -130935,10 +131057,10 @@ function rgbSpline(spline) {
130935
131057
  g2[i2] = color[1] || 0;
130936
131058
  b[i2] = color[2] || 0;
130937
131059
  }
130938
- r2 = spline(r2);
130939
- g2 = spline(g2);
130940
- b = spline(b);
130941
- return (t2) => [r2(t2), g2(t2), b(t2)];
131060
+ const rFunc = spline(r2);
131061
+ const gFunc = spline(g2);
131062
+ const bFunc = spline(b);
131063
+ return (t2) => [rFunc(t2), gFunc(t2), bFunc(t2)];
130942
131064
  };
130943
131065
  }
130944
131066
  function basis(values2) {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, E, S, a, b, f, e, d, c } from "./index-dee2d8c8.js";
1
+ import { A, E, S, a, b, f, e, d, c } from "./index-e56d07d4.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-dee2d8c8.js";
1
+ import { B as BaseDecoder } from "./index-e56d07d4.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 } from "./index-dee2d8c8.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-e56d07d4.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-dee2d8c8.js";
1
+ import { B as BaseDecoder } from "./index-e56d07d4.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-dee2d8c8.js";
1
+ import { B as BaseDecoder } from "./index-e56d07d4.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-dee2d8c8.js";
1
+ import { B as BaseDecoder } from "./index-e56d07d4.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-dee2d8c8.js";
1
+ import { B as BaseDecoder } from "./index-e56d07d4.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/scatterplot",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -23,12 +23,12 @@
23
23
  "d3-quadtree": "^1.0.7",
24
24
  "lodash-es": "^4.17.21",
25
25
  "react-aria": "^3.28.0",
26
- "@vitessce/constants-internal": "3.2.1",
27
- "@vitessce/gl": "3.2.1",
28
- "@vitessce/icons": "3.2.1",
29
- "@vitessce/tooltip": "3.2.1",
30
- "@vitessce/utils": "3.2.1",
31
- "@vitessce/vit-s": "3.2.1"
26
+ "@vitessce/constants-internal": "3.3.0",
27
+ "@vitessce/gl": "3.3.0",
28
+ "@vitessce/icons": "3.3.0",
29
+ "@vitessce/tooltip": "3.3.0",
30
+ "@vitessce/utils": "3.3.0",
31
+ "@vitessce/vit-s": "3.3.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@testing-library/jest-dom": "^5.16.4",