@vitessce/dev 3.8.1 → 3.8.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,4 +1,4 @@
1
- import { aH as getDefaultExportFromCjs, aI as Raycaster, W as OrthographicCamera, K as PerspectiveCamera, av as Scene, aJ as PCFSoftShadowMap, aK as VSMShadowMap, aL as PCFShadowMap, aM as BasicShadowMap, aN as NoToneMapping, aO as ACESFilmicToneMapping, e as Vector3, V as Vector2, aP as Clock, aQ as WebGLRenderer, aR as Camera, x as BufferGeometry, r as Material, aS as Layers, a1 as Texture, aE as RGBAFormat, az as UnsignedByteType, C as Color, aj as _extends, aT as THREE, aU as EventDispatcher, aV as MOUSE, aW as TOUCH, aX as Spherical, Q as Quaternion, an as Ray, ak as Plane } from "./index-BFaSCwQo.js";
1
+ import { aH as getDefaultExportFromCjs, aI as Raycaster, W as OrthographicCamera, K as PerspectiveCamera, av as Scene, aJ as PCFSoftShadowMap, aK as VSMShadowMap, aL as PCFShadowMap, aM as BasicShadowMap, aN as NoToneMapping, aO as ACESFilmicToneMapping, e as Vector3, V as Vector2, aP as Clock, aQ as WebGLRenderer, aR as Camera, x as BufferGeometry, r as Material, aS as Layers, a1 as Texture, aE as RGBAFormat, az as UnsignedByteType, C as Color, aj as _extends, aT as THREE, aU as EventDispatcher, aV as MOUSE, aW as TOUCH, aX as Spherical, Q as Quaternion, an as Ray, ak as Plane } from "./index-DIrygUEo.js";
2
2
  import * as React from "react";
3
3
  import React__default, { useReducer, useRef, useEffect, useLayoutEffect, useDebugValue, useState, useMemo } from "react";
4
4
  var constants = { exports: {} };
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { aH as getDefaultExportFromCjs, b2 as requireAssign, b3 as require_export, b4 as require_core, b5 as require_fails, b6 as require_toObject, b7 as require_objectKeys, b8 as require_cof, b9 as require_wks, ba as require_iterators, bb as requireWeb_dom_iterable, bc as requireEs6_string_iterator, bd as require_anObject, be as require_hide, bf as require_ctx, bg as require_toLength, bh as require_global, bi as require_objectDp, bj as require_descriptors, bk as require_isObject, bl as require_objectCreate, bm as require_iterDefine, bn as require_iterStep, bo as require_meta, bp as require_isArray, bq as require_iobject, br as require_setToStringTag, bs as require_aFunction, bt as requireIterator, bu as require_propertyDesc, bv as require_root, bw as require_baseGetTag, bx as requireIsObjectLike, by as requireIsObject, bz as requireEs6_symbol, bA as requireDefineProperty, bB as require_toIobject, bC as require_objectGopd, bD as require_html, bE as require_domCreate, bF as require_library, bG as requireSymbol, bH as require_objectPie, bI as require_has, bJ as require_redefine, bK as require_objectAssign, bL as diffCameraState, ao as jsxRuntimeExports } from "./index-BFaSCwQo.js";
4
+ import { aH as getDefaultExportFromCjs, b2 as requireAssign, b3 as require_export, b4 as require_core, b5 as require_fails, b6 as require_toObject, b7 as require_objectKeys, b8 as require_cof, b9 as require_wks, ba as require_iterators, bb as requireWeb_dom_iterable, bc as requireEs6_string_iterator, bd as require_anObject, be as require_hide, bf as require_ctx, bg as require_toLength, bh as require_global, bi as require_objectDp, bj as require_descriptors, bk as require_isObject, bl as require_objectCreate, bm as require_iterDefine, bn as require_iterStep, bo as require_meta, bp as require_isArray, bq as require_iobject, br as require_setToStringTag, bs as require_aFunction, bt as requireIterator, bu as require_propertyDesc, bv as require_root, bw as require_baseGetTag, bx as requireIsObjectLike, by as requireIsObject, bz as requireEs6_symbol, bA as requireDefineProperty, bB as require_toIobject, bC as require_objectGopd, bD as require_html, bE as require_domCreate, bF as require_library, bG as requireSymbol, bH as require_objectPie, bI as require_has, bJ as require_redefine, bK as require_objectAssign, bL as diffCameraState, ao as jsxRuntimeExports } from "./index-DIrygUEo.js";
5
5
  import React__default from "react";
6
6
  var assignExports = requireAssign();
7
7
  const _Object$assign = /* @__PURE__ */ getDefaultExportFromCjs(assignExports);
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { aY as BaseDecoder } from "./index-BFaSCwQo.js";
2
+ import { aY as BaseDecoder } from "./index-DIrygUEo.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -1,7 +1,7 @@
1
1
  import * as React$7 from "react";
2
2
  import React__default, { isValidElement, PureComponent, Component, createElement, createContext, createRef } from "react";
3
3
  import ReactDOM__default, { findDOMNode as findDOMNode$1 } from "react-dom";
4
- import { a$ as commonjsGlobal$1, b0 as requireObjectAssign, aH as getDefaultExportFromCjs$1, b1 as earcut } from "./index-BFaSCwQo.js";
4
+ import { a$ as commonjsGlobal$1, b0 as requireObjectAssign, aH as getDefaultExportFromCjs$1, b1 as earcut } from "./index-DIrygUEo.js";
5
5
  var promise = {};
6
6
  var hasRequiredPromise;
7
7
  function requirePromise() {
@@ -215,6 +215,9 @@ const FileType$2 = {
215
215
  OBS_SEGMENTATIONS_OME_TIFF: "obsSegmentations.ome-tiff",
216
216
  // GLB
217
217
  OBS_SEGMENTATIONS_GLB: "obsSegmentations.glb",
218
+ // Neuroglancer
219
+ // Precomputed (mesh) format
220
+ OBS_SEGMENTATIONS_NG_PRECOMPUTED: "obsSegmentations.ng-precomputed",
218
221
  // New file types to support old file types:
219
222
  // - cells.json
220
223
  OBS_EMBEDDING_CELLS_JSON: "obsEmbedding.cells.json",
@@ -471,6 +474,7 @@ const ViewHelpMapping = {
471
474
  [FileType$2.OBS_LABELS_MUDATA_ZARR]: DataType$4.OBS_LABELS,
472
475
  [FileType$2.FEATURE_LABELS_MUDATA_ZARR]: DataType$4.FEATURE_LABELS,
473
476
  [FileType$2.OBS_SEGMENTATIONS_GLB]: DataType$4.OBS_SEGMENTATIONS,
477
+ [FileType$2.OBS_SEGMENTATIONS_NG_PRECOMPUTED]: DataType$4.OBS_SEGMENTATIONS,
474
478
  [FileType$2.IMAGE_SPATIALDATA_ZARR]: DataType$4.IMAGE,
475
479
  [FileType$2.LABELS_SPATIALDATA_ZARR]: DataType$4.OBS_SEGMENTATIONS,
476
480
  [FileType$2.SHAPES_SPATIALDATA_ZARR]: DataType$4.OBS_SEGMENTATIONS,
@@ -1333,7 +1337,7 @@ const COMPONENT_COORDINATION_TYPES = {
1333
1337
  CoordinationType$2.HIERARCHY_LEVELS
1334
1338
  ]
1335
1339
  };
1336
- const version$6 = "3.8.1";
1340
+ const version$6 = "3.8.2";
1337
1341
  const META_VERSION = {
1338
1342
  version: version$6
1339
1343
  };
@@ -78776,6 +78780,18 @@ const meshGlbSchema = z.object({
78776
78780
  sceneScaleZ: z.number(),
78777
78781
  materialSide: z.enum(["front", "back"])
78778
78782
  }).partial().nullable();
78783
+ const ngSchema = z.object({
78784
+ // TODO: Should this explicitly specify sharded vs. unsharded?
78785
+ // Or can/should that be inferred from the data?
78786
+ dimensionX: z.number(),
78787
+ dimensionY: z.number(),
78788
+ dimensionZ: z.number(),
78789
+ dimensionUnit: z.enum(["nm", "um", "µm", "mm", "cm", "m"]),
78790
+ // TODO: should the following be passed via coordination types instead?
78791
+ projectionScale: z.number(),
78792
+ position: z.array(z.number()).length(3),
78793
+ projectionOrientation: z.array(z.number()).length(4)
78794
+ }).partial().nullable();
78779
78795
  const obsEmbeddingAnndataSchema = annDataObsEmbedding;
78780
78796
  const obsSpotsAnndataSchema = annDataObsLocations;
78781
78797
  const obsPointsAnndataSchema = annDataObsLocations;
@@ -225703,22 +225719,22 @@ async function getDecoder(fileDirectory) {
225703
225719
  const Decoder = await importFn();
225704
225720
  return new Decoder(fileDirectory);
225705
225721
  }
225706
- addDecoder([void 0, 1], () => import("./raw-9J3HZFUF.js").then((m2) => m2.default));
225707
- addDecoder(5, () => import("./lzw-D8Crd9WH.js").then((m2) => m2.default));
225722
+ addDecoder([void 0, 1], () => import("./raw-VhRAjLEL.js").then((m2) => m2.default));
225723
+ addDecoder(5, () => import("./lzw-ba4YaiEC.js").then((m2) => m2.default));
225708
225724
  addDecoder(6, () => {
225709
225725
  throw new Error("old style JPEG compression is not supported.");
225710
225726
  });
225711
- addDecoder(7, () => import("./jpeg-CTFJ-qvd.js").then((m2) => m2.default));
225712
- addDecoder([8, 32946], () => import("./deflate-pqnulTpZ.js").then((m2) => m2.default));
225713
- addDecoder(32773, () => import("./packbits-DgJ8qADF.js").then((m2) => m2.default));
225727
+ addDecoder(7, () => import("./jpeg-DbFfMNYM.js").then((m2) => m2.default));
225728
+ addDecoder([8, 32946], () => import("./deflate-DlQnReEZ.js").then((m2) => m2.default));
225729
+ addDecoder(32773, () => import("./packbits-Csi8LnHd.js").then((m2) => m2.default));
225714
225730
  addDecoder(
225715
225731
  34887,
225716
- () => import("./lerc-CsVQv56k.js").then(async (m2) => {
225732
+ () => import("./lerc-czO-htrp.js").then(async (m2) => {
225717
225733
  await m2.zstd.init();
225718
225734
  return m2;
225719
225735
  }).then((m2) => m2.default)
225720
225736
  );
225721
- addDecoder(50001, () => import("./webimage-C-QuZxAg.js").then((m2) => m2.default));
225737
+ addDecoder(50001, () => import("./webimage-CcpJ0JSo.js").then((m2) => m2.default));
225722
225738
  function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
225723
225739
  return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
225724
225740
  }
@@ -264816,7 +264832,7 @@ let Location$1 = class Location {
264816
264832
  }
264817
264833
  resolve(path2) {
264818
264834
  let root2 = new URL(`file://${this.path.endsWith("/") ? this.path : `${this.path}/`}`);
264819
- return new Location(this.store, new URL(path2, root2).pathname);
264835
+ return new Location(this.store, decodeURIComponent(new URL(path2, root2).pathname));
264820
264836
  }
264821
264837
  };
264822
264838
  function root$1(store) {
@@ -269174,12 +269190,12 @@ class ErrorBoundary2 extends React__default.Component {
269174
269190
  }
269175
269191
  }
269176
269192
  const LazySpatialThree = React__default.lazy(async () => {
269177
- const { SpatialWrapper: SpatialWrapper2 } = await import("./index-BdmLXvmK.js");
269193
+ const { SpatialWrapper: SpatialWrapper2 } = await import("./index-YEppGSkr.js");
269178
269194
  return { default: SpatialWrapper2 };
269179
269195
  });
269180
269196
  const SpatialThreeAdapter = React__default.forwardRef((props, ref2) => jsxRuntimeExports.jsx("div", { ref: ref2, style: { width: "100%", height: "100%" }, children: jsxRuntimeExports.jsx(ErrorBoundary2, { children: jsxRuntimeExports.jsx(Suspense, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(LazySpatialThree, { ...props }) }) }) }));
269181
269197
  const LazySpatialAccelerated = React__default.lazy(async () => {
269182
- const { SpatialWrapper: SpatialWrapper2 } = await import("./index-CZFcaN77.js");
269198
+ const { SpatialWrapper: SpatialWrapper2 } = await import("./index-oX65IZC8.js");
269183
269199
  return { default: SpatialWrapper2 };
269184
269200
  });
269185
269201
  const SpatialAcceleratedAdapter = React__default.forwardRef((props, ref2) => jsxRuntimeExports.jsx("div", { ref: ref2, style: { width: "100%", height: "100%" }, children: jsxRuntimeExports.jsx(ErrorBoundary2, { children: jsxRuntimeExports.jsx(Suspense, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(LazySpatialAccelerated, { ...props }) }) }) }));
@@ -269384,6 +269400,7 @@ function SpatialSubscriber(props) {
269384
269400
  CoordinationType$2.LEGEND_VISIBLE
269385
269401
  ], coordinationScopes, coordinationScopesBy, CoordinationType$2.POINT_LAYER);
269386
269402
  const is3dMode = spatialRenderingMode === "3D";
269403
+ const shouldUseThree = threeFor3d && is3dMode;
269387
269404
  const [deckWidth, deckHeight, deckRef] = useDeckCanvasSize();
269388
269405
  const [threeWidth, threeHeight, threeRef] = useGridItemSize();
269389
269406
  const width2 = threeFor3d && deckWidth === void 0 ? threeWidth : deckWidth;
@@ -269652,7 +269669,7 @@ function SpatialSubscriber(props) {
269652
269669
  }
269653
269670
  }
269654
269671
  };
269655
- return jsxRuntimeExports.jsxs(TitleInfo, { title: title2, info: subtitle, isSpatial: true, urls: urls2, theme, closeButtonVisible, downloadButtonVisible, removeGridComponent, isReady, errors, children: [is3dMode ? acceleratedFor3d ? jsxRuntimeExports.jsx(SpatialAcceleratedAdapter, { ref: threeRef, uuid: uuid2, width: width2, height: height2, theme, hideTools: !isSelectable, rotation: [rotationX, rotationY, rotationZ], setRotationX, setRotationY, setRotationZ, targetT, targetZ, viewState: isValidViewState ? {
269672
+ return jsxRuntimeExports.jsxs(TitleInfo, { title: title2, info: subtitle, isSpatial: true, urls: urls2, theme, closeButtonVisible, downloadButtonVisible, removeGridComponent, isReady, errors, children: [shouldUseThree ? acceleratedFor3d ? jsxRuntimeExports.jsx(SpatialAcceleratedAdapter, { ref: threeRef, uuid: uuid2, width: width2, height: height2, theme, hideTools: !isSelectable, rotation: [rotationX, rotationY, rotationZ], setRotationX, setRotationY, setRotationZ, targetT, targetZ, viewState: isValidViewState ? {
269656
269673
  zoom: zoom2,
269657
269674
  target: [targetX2, targetY2, targetZ],
269658
269675
  rotationX,
@@ -281150,7 +281167,7 @@ function HiglassGlobalStyles(props) {
281150
281167
  }
281151
281168
  register({ dataFetcher: ZarrMultivecDataFetcher_default, config: ZarrMultivecDataFetcher_default.config }, { pluginType: "dataFetcher" });
281152
281169
  const LazyHiGlassComponent = React__default.lazy(async () => {
281153
- const { HiGlassComponent } = await import("./higlass-BHVqBoNN.js");
281170
+ const { HiGlassComponent } = await import("./higlass-Cy1Ky4Jj.js");
281154
281171
  return { default: HiGlassComponent };
281155
281172
  });
281156
281173
  const HG_SIZE = 800;
@@ -284097,7 +284114,7 @@ function NeuroglancerGlobalStyles(props) {
284097
284114
  const { classes: classes2 } = props;
284098
284115
  return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(GlobalStyles$3, { styles: globalNeuroglancerCss }), jsxRuntimeExports.jsx(ScopedGlobalStyles, { styles: globalNeuroglancerStyles, parentClassName: classes2.neuroglancerWrapper })] });
284099
284116
  }
284100
- const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-DyEmAPaR.js"));
284117
+ const LazyReactNeuroglancer = React__default.lazy(() => import("./ReactNeuroglancer-Cs6kn--K.js"));
284101
284118
  function createWorker() {
284102
284119
  return new WorkerFactory();
284103
284120
  }
@@ -284174,6 +284191,108 @@ class NeuroglancerComp extends PureComponent {
284174
284191
  return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(NeuroglancerGlobalStyles, { classes: classes2 }), jsxRuntimeExports.jsx("div", { className: classes2.neuroglancerWrapper, children: jsxRuntimeExports.jsx(Suspense, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(LazyReactNeuroglancer, { brainMapsClientId: "NOT_A_VALID_ID", viewerState, onViewerStateChanged: this.onViewerStateChanged, bundleRoot: this.bundleRoot, cellColorMapping, ref: this.onRef }) }) })] });
284175
284192
  }
284176
284193
  }
284194
+ const DEFAULT_NG_PROPS = {
284195
+ layout: "3d",
284196
+ position: [0, 0, 0],
284197
+ projectionOrientation: [0, 0, 0, 1],
284198
+ projectionScale: 1024,
284199
+ crossSectionScale: 1
284200
+ };
284201
+ function toPrecomputedSource(url) {
284202
+ if (!url) {
284203
+ return void 0;
284204
+ }
284205
+ return `precomputed://${url}`;
284206
+ }
284207
+ const UNIT_TO_NM = {
284208
+ nm: 1,
284209
+ um: 1e3,
284210
+ µm: 1e3,
284211
+ mm: 1e6,
284212
+ cm: 1e7,
284213
+ m: 1e9
284214
+ };
284215
+ function isInNanometerRange(value2, unit2, minNm = 1, maxNm = 100) {
284216
+ const n3 = typeof value2 === "number" ? value2 : Number(value2);
284217
+ if (!Number.isFinite(n3))
284218
+ return false;
284219
+ const factor = unit2 && UNIT_TO_NM[unit2];
284220
+ if (!factor)
284221
+ return false;
284222
+ const nm = n3 * factor;
284223
+ return nm >= minNm && nm <= maxNm;
284224
+ }
284225
+ function normalizeDimensionsToNanometers(opts2) {
284226
+ const { dimensionUnit, dimensionX, dimensionY, dimensionZ } = opts2;
284227
+ if (!dimensionUnit || !dimensionX || !dimensionY || !dimensionZ) {
284228
+ console.warn("Missing dimension info");
284229
+ }
284230
+ const xNm = isInNanometerRange(dimensionX, dimensionUnit);
284231
+ const yNm = isInNanometerRange(dimensionY, dimensionUnit);
284232
+ const zNm = isInNanometerRange(dimensionZ, dimensionUnit);
284233
+ if (!xNm || !yNm || !zNm) {
284234
+ console.warn("Dimension was converted to nm units");
284235
+ }
284236
+ return {
284237
+ x: xNm ? [dimensionX, dimensionUnit] : [1, "nm"],
284238
+ y: yNm ? [dimensionY, dimensionUnit] : [1, "nm"],
284239
+ z: zNm ? [dimensionZ, dimensionUnit] : [1, "nm"]
284240
+ };
284241
+ }
284242
+ function extractDataTypeEntities(loaders, dataset, dataType) {
284243
+ const datasetEntry = loaders?.[dataset];
284244
+ const internMap = datasetEntry?.loaders?.[dataType];
284245
+ if (!internMap || typeof internMap.entries !== "function")
284246
+ return [];
284247
+ return Array.from(internMap.entries()).map(([key2, loader2]) => {
284248
+ const url = loader2?.url ?? loader2?.dataSource?.url ?? void 0;
284249
+ const fileUid = key2?.fileUid ?? loader2?.coordinationValues?.fileUid ?? void 0;
284250
+ const { position: position2, projectionOrientation, projectionScale, crossSectionScale } = loader2?.options ?? {};
284251
+ const isPrecomputed = loader2?.fileType.includes("precomputed");
284252
+ if (!isPrecomputed) {
284253
+ console.warn("Filetype needs to be precomputed");
284254
+ }
284255
+ return {
284256
+ key: key2,
284257
+ type: "segmentation",
284258
+ fileUid,
284259
+ layout: DEFAULT_NG_PROPS.layout,
284260
+ url,
284261
+ source: toPrecomputedSource(url),
284262
+ name: fileUid ?? key2?.name ?? "segmentation",
284263
+ // For precomputed: nm is the unit used
284264
+ dimensions: normalizeDimensionsToNanometers(loader2?.options),
284265
+ // If not provided, no error, but difficult to see the data
284266
+ position: Array.isArray(position2) && position2.length === 3 ? position2 : DEFAULT_NG_PROPS.position,
284267
+ // If not provided, will have a default orientation
284268
+ projectionOrientation: Array.isArray(projectionOrientation) && projectionOrientation.length === 4 ? projectionOrientation : DEFAULT_NG_PROPS.projectionOrientation,
284269
+ projectionScale: Number.isFinite(projectionScale) ? projectionScale : DEFAULT_NG_PROPS.projectionScale,
284270
+ crossSectionScale: Number.isFinite(crossSectionScale) ? crossSectionScale : DEFAULT_NG_PROPS.crossSectionScale
284271
+ };
284272
+ });
284273
+ }
284274
+ function useExtractOptionsForNg(loaders, dataset, dataType) {
284275
+ const extractedEntities = useMemo$1(() => extractDataTypeEntities(loaders, dataset, dataType), [loaders, dataset, dataType]);
284276
+ const layers = useMemo$1(() => extractedEntities.filter((t4) => t4.source).map((t4) => ({
284277
+ type: t4.type,
284278
+ source: t4.source,
284279
+ segments: [],
284280
+ name: t4.name || "segmentation"
284281
+ })), [extractedEntities]);
284282
+ const viewerState = useMemo$1(() => ({
284283
+ dimensions: extractedEntities[0]?.dimensions,
284284
+ position: extractedEntities[0]?.position,
284285
+ crossSectionScale: extractedEntities[0]?.crossSectionScale,
284286
+ projectionOrientation: extractedEntities[0]?.projectionOrientation,
284287
+ projectionScale: extractedEntities[0]?.projectionScale,
284288
+ layers,
284289
+ layout: extractedEntities[0].layout
284290
+ }));
284291
+ return [viewerState];
284292
+ }
284293
+ function useNeuroglancerViewerState(loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
284294
+ return useExtractOptionsForNg(loaders, dataset, DataType$4.OBS_SEGMENTATIONS);
284295
+ }
284177
284296
  /**
284178
284297
  * @license
284179
284298
  * Copyright 2010-2023 Three.js Authors
@@ -313789,10 +313908,6 @@ const multiplyQuat = (a2, b2) => {
313789
313908
  const conjQuat = (q) => [-q[0], -q[1], -q[2], q[3]];
313790
313909
  const rad2deg = (r3) => r3 * 180 / Math.PI;
313791
313910
  const deg2rad = (d) => d * Math.PI / 180;
313792
- function isValidState(viewerState) {
313793
- const { projectionScale, projectionOrientation, position: position2, dimensions } = viewerState || {};
313794
- return dimensions !== void 0 && typeof projectionScale === "number" && Array.isArray(projectionOrientation) && projectionOrientation.length === 4 && Array.isArray(position2) && position2.length === 3;
313795
- }
313796
313911
  function valueGreaterThanEpsilon(a2, b2, epsilon3) {
313797
313912
  if (Array.isArray(a2) && Array.isArray(b2) && a2.length === b2.length) {
313798
313913
  return a2.some((val, i2) => Math.abs(val - b2[i2]) > epsilon3);
@@ -313804,8 +313919,6 @@ function valueGreaterThanEpsilon(a2, b2, epsilon3) {
313804
313919
  }
313805
313920
  const nearEq = (a2, b2, epsilon3) => Number.isFinite(a2) && Number.isFinite(b2) ? Math.abs(a2 - b2) <= epsilon3 : a2 === b2;
313806
313921
  function diffCameraState(prev2, next4) {
313807
- if (!isValidState(next4))
313808
- return { changed: false, scale: false, pos: false, rot: false };
313809
313922
  const eps = EPSILON_KEYS_MAPPING_NG;
313810
313923
  const scale2 = valueGreaterThanEpsilon(prev2?.projectionScale, next4?.projectionScale, eps.projectionScale);
313811
313924
  const posHard = valueGreaterThanEpsilon(prev2?.position, next4?.position, eps.position);
@@ -313852,7 +313965,7 @@ function rgbToHex$1(rgb2) {
313852
313965
  return typeof rgb2 === "string" ? rgb2 : `#${rgb2.map((c2) => c2.toString(16).padStart(2, "0")).join("")}`;
313853
313966
  }
313854
313967
  function NeuroglancerSubscriber(props) {
313855
- const { coordinationScopes: coordinationScopesRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Neuroglancer", helpText = ViewHelpMapping.NEUROGLANCER, viewerState: initialViewerState } = props;
313968
+ const { coordinationScopes: coordinationScopesRaw, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Neuroglancer", helpText = ViewHelpMapping.NEUROGLANCER } = props;
313856
313969
  const loaders = useLoaders();
313857
313970
  const coordinationScopes = useCoordinationScopes(coordinationScopesRaw);
313858
313971
  const [{
@@ -313884,11 +313997,12 @@ function NeuroglancerSubscriber(props) {
313884
313997
  setSpatialRotationOrbit: setRotationOrbit,
313885
313998
  setSpatialZoom: setZoom
313886
313999
  }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.NEUROGLANCER], coordinationScopes);
313887
- const latestViewerStateRef = useRef(initialViewerState);
313888
- const initialRotationPushedRef = useRef(false);
313889
314000
  const { classes: classes2 } = useStyles$4();
313890
314001
  const [{ obsSets: cellSets }] = useObsSetsData(loaders, dataset, false, { setObsSetSelection: setCellSetSelection, setObsSetColor: setCellSetColor }, { cellSetSelection, obsSetColor: cellSetColor }, { obsType });
313891
314002
  const [{ obsIndex }] = useObsEmbeddingData(loaders, dataset, true, {}, {}, { obsType, embeddingType: mapping });
314003
+ const [initalViewerState] = useNeuroglancerViewerState(loaders, dataset);
314004
+ const latestViewerStateRef = useRef(initalViewerState);
314005
+ const initialRotationPushedRef = useRef(false);
313892
314006
  const ngRotPushAtRef = useRef(0);
313893
314007
  const lastInteractionSource = useRef(null);
313894
314008
  const applyNgUpdateTimeoutRef = useRef(null);
@@ -313935,7 +314049,7 @@ function NeuroglancerSubscriber(props) {
313935
314049
  return;
313936
314050
  const zRef = Number.isFinite(spatialZoom) ? spatialZoom : 0;
313937
314051
  initialRenderCalibratorRef.current = makeVitNgZoomCalibrator(projectionScale, zRef);
313938
- const [px2 = 0, py2 = 0, pz2 = 0] = Array.isArray(position2) ? position2 : [0, 0, 0];
314052
+ const [px2 = 0, py2 = 0, pz2 = 0] = position2;
313939
314053
  const tX = Number.isFinite(spatialTargetX) ? spatialTargetX : 0;
313940
314054
  const tY = Number.isFinite(spatialTargetY) ? spatialTargetY : 0;
313941
314055
  translationOffsetRef.current = [px2 - tX, py2 - tY, pz2];
@@ -372230,6 +372344,22 @@ class SpatialDataObsEmbeddingLoader extends ObsEmbeddingAnndataLoader {
372230
372344
  this.tablePath = this.options.tablePath;
372231
372345
  }
372232
372346
  }
372347
+ class PrecomputedMeshSource {
372348
+ constructor({ url, requestInit: requestInit2 }) {
372349
+ this.url = url;
372350
+ this.requestInit = requestInit2;
372351
+ }
372352
+ }
372353
+ class PrecomputedMeshDataLoader extends AbstractTwoStepLoader {
372354
+ /* eslint-disable class-methods-use-this */
372355
+ async load(url) {
372356
+ return new LoaderResult({
372357
+ obsIndex: null,
372358
+ obsSegmentations: {},
372359
+ obsSegmentationsType: "mesh"
372360
+ }, url);
372361
+ }
372362
+ }
372233
372363
  const decoder = new TextDecoder("utf-8");
372234
372364
  const decodeUtf8 = (buffer2) => decoder.decode(buffer2);
372235
372365
  const encoder = new TextEncoder();
@@ -394017,6 +394147,7 @@ const baseFileTypes = [
394017
394147
  ...makeZarrFileTypes(FileType$2.OBS_EMBEDDING_SPATIALDATA_ZARR, DataType$4.OBS_EMBEDDING, SpatialDataObsEmbeddingLoader, SpatialDataTableSource, obsEmbeddingSpatialdataSchema),
394018
394148
  ...makeZarrFileTypes(FileType$2.FEATURE_LABELS_SPATIALDATA_ZARR, DataType$4.FEATURE_LABELS, FeatureLabelsAnndataLoader, SpatialDataTableSource, featureLabelsAnndataSchema),
394019
394149
  makeFileType(FileType$2.OBS_SEGMENTATIONS_GLB, DataType$4.OBS_SEGMENTATIONS, GlbDataLoader, GlbSource, meshGlbSchema),
394150
+ makeFileType(FileType$2.OBS_SEGMENTATIONS_NG_PRECOMPUTED, DataType$4.OBS_SEGMENTATIONS, PrecomputedMeshDataLoader, PrecomputedMeshSource, ngSchema),
394020
394151
  // All legacy file types
394021
394152
  makeFileType(FileType$2.OBS_FEATURE_MATRIX_EXPRESSION_MATRIX_ZARR, DataType$4.OBS_FEATURE_MATRIX, MatrixZarrAsObsFeatureMatrixLoader, ZarrDataSource, z.null()),
394022
394153
  makeFileType(FileType$2.IMAGE_RASTER_JSON, DataType$4.IMAGE, RasterJsonAsImageLoader, JsonSource, rasterJsonSchema),
@@ -1,7 +1,7 @@
1
- import { G as Group, M as Matrix4, T as TrianglesDrawMode, a as TriangleFanDrawMode, b as TriangleStripDrawMode, R as REVISION, L as Loader, c as LoaderUtils, F as FileLoader, d as MeshPhysicalMaterial, V as Vector2, C as Color, S as SpotLight, P as PointLight, D as DirectionalLight, e as Vector3, I as InstancedMesh, Q as Quaternion, O as Object3D, f as TextureLoader, g as ImageBitmapLoader, B as BufferAttribute, h as InterleavedBuffer, i as LinearMipmapLinearFilter, N as NearestMipmapLinearFilter, j as LinearMipmapNearestFilter, k as NearestMipmapNearestFilter, l as LinearFilter, m as NearestFilter, n as RepeatWrapping, o as MirroredRepeatWrapping, p as ClampToEdgeWrapping, q as PointsMaterial, r as Material, s as LineBasicMaterial, t as MeshStandardMaterial, u as DoubleSide, v as MeshBasicMaterial, w as PropertyBinding, x as BufferGeometry, y as SkinnedMesh, z as Mesh, A as LineSegments, E as Line$1, H as LineLoop, J as Points, K as PerspectiveCamera, U as MathUtils, W as OrthographicCamera, X as Skeleton, Y as InterpolateDiscrete, Z as InterpolateLinear, _ as AnimationClip, $ as Bone, a0 as InterleavedBufferAttribute, a1 as Texture, a2 as VectorKeyframeTrack, a3 as QuaternionKeyframeTrack, a4 as NumberKeyframeTrack, a5 as FrontSide, a6 as Interpolant, a7 as Box3, a8 as Sphere, a9 as InstancedBufferGeometry, aa as Float32BufferAttribute, ab as InstancedInterleavedBuffer, ac as WireframeGeometry, ad as ShaderMaterial, ae as UniformsUtils, af as UniformsLib, ag as Vector4, ah as Line3, ai as SphereGeometry, aj as _extends, ak as Plane, al as Triangle, am as BackSide, an as Ray$1, ao as jsxRuntimeExports, ap as Matrix3, aq as CoordinationType, ar as Data3DTexture, as as RedFormat, at as FloatType, au as getImageSize, av as Scene } from "./index-BFaSCwQo.js";
1
+ import { G as Group, M as Matrix4, T as TrianglesDrawMode, a as TriangleFanDrawMode, b as TriangleStripDrawMode, R as REVISION, L as Loader, c as LoaderUtils, F as FileLoader, d as MeshPhysicalMaterial, V as Vector2, C as Color, S as SpotLight, P as PointLight, D as DirectionalLight, e as Vector3, I as InstancedMesh, Q as Quaternion, O as Object3D, f as TextureLoader, g as ImageBitmapLoader, B as BufferAttribute, h as InterleavedBuffer, i as LinearMipmapLinearFilter, N as NearestMipmapLinearFilter, j as LinearMipmapNearestFilter, k as NearestMipmapNearestFilter, l as LinearFilter, m as NearestFilter, n as RepeatWrapping, o as MirroredRepeatWrapping, p as ClampToEdgeWrapping, q as PointsMaterial, r as Material, s as LineBasicMaterial, t as MeshStandardMaterial, u as DoubleSide, v as MeshBasicMaterial, w as PropertyBinding, x as BufferGeometry, y as SkinnedMesh, z as Mesh, A as LineSegments, E as Line$1, H as LineLoop, J as Points, K as PerspectiveCamera, U as MathUtils, W as OrthographicCamera, X as Skeleton, Y as InterpolateDiscrete, Z as InterpolateLinear, _ as AnimationClip, $ as Bone, a0 as InterleavedBufferAttribute, a1 as Texture, a2 as VectorKeyframeTrack, a3 as QuaternionKeyframeTrack, a4 as NumberKeyframeTrack, a5 as FrontSide, a6 as Interpolant, a7 as Box3, a8 as Sphere, a9 as InstancedBufferGeometry, aa as Float32BufferAttribute, ab as InstancedInterleavedBuffer, ac as WireframeGeometry, ad as ShaderMaterial, ae as UniformsUtils, af as UniformsLib, ag as Vector4, ah as Line3, ai as SphereGeometry, aj as _extends, ak as Plane, al as Triangle, am as BackSide, an as Ray$1, ao as jsxRuntimeExports, ap as Matrix3, aq as CoordinationType, ar as Data3DTexture, as as RedFormat, at as FloatType, au as getImageSize, av as Scene } from "./index-DIrygUEo.js";
2
2
  import * as React from "react";
3
3
  import { useRef, useEffect, useState, forwardRef } from "react";
4
- import { u as useThree, a as useFrame, c as create, e as extend, b as createPortal, O as OrbitControls, C as Canvas } from "./OrbitControls-C8SsS4Ne.js";
4
+ import { u as useThree, a as useFrame, c as create, e as extend, b as createPortal, O as OrbitControls, C as Canvas } from "./OrbitControls-jyOKa70-.js";
5
5
  const isPromise = (promise) => typeof promise === "object" && typeof promise.then === "function";
6
6
  const globalCache = [];
7
7
  function shallowEqualArrays(arrA, arrB, equal = (a, b) => a === b) {
@@ -5027,7 +5027,7 @@ const Text = /* @__PURE__ */ React.forwardRef(({
5027
5027
  const {
5028
5028
  Text: TextMeshImpl,
5029
5029
  preloadFont
5030
- } = suspend(async () => import("./troika-three-text.esm-UYx_VKWl.js"), []);
5030
+ } = suspend(async () => import("./troika-three-text.esm-Ck66ncOS.js"), []);
5031
5031
  const invalidate = useThree(({
5032
5032
  invalidate: invalidate2
5033
5033
  }) => invalidate2);
@@ -1,6 +1,6 @@
1
- import { aw as log, ax as isEqual, ay as atLeastLogLevel, ar as Data3DTexture, as as RedFormat, az as UnsignedByteType, l as LinearFilter, aA as RedIntegerFormat, aB as UnsignedIntType, m as NearestFilter, aC as LogLevel, e as Vector3, V as Vector2, ag as Vector4, ae as UniformsUtils, aq as CoordinationType, aD as WebGLMultipleRenderTargets, aE as RGBAFormat, av as Scene, W as OrthographicCamera, ad as ShaderMaterial, z as Mesh, aF as PlaneGeometry, ao as jsxRuntimeExports, aG as GLSL3, am as BackSide } from "./index-BFaSCwQo.js";
1
+ import { aw as log, ax as isEqual, ay as atLeastLogLevel, ar as Data3DTexture, as as RedFormat, az as UnsignedByteType, l as LinearFilter, aA as RedIntegerFormat, aB as UnsignedIntType, m as NearestFilter, aC as LogLevel, e as Vector3, V as Vector2, ag as Vector4, ae as UniformsUtils, aq as CoordinationType, aD as WebGLMultipleRenderTargets, aE as RGBAFormat, av as Scene, W as OrthographicCamera, ad as ShaderMaterial, z as Mesh, aF as PlaneGeometry, ao as jsxRuntimeExports, aG as GLSL3, am as BackSide } from "./index-DIrygUEo.js";
2
2
  import { useRef, useState, useMemo, useEffect, useCallback } from "react";
3
- import { u as useThree, a as useFrame, O as OrbitControls, C as Canvas } from "./OrbitControls-C8SsS4Ne.js";
3
+ import { u as useThree, a as useFrame, O as OrbitControls, C as Canvas } from "./OrbitControls-jyOKa70-.js";
4
4
  const BRICK_SIZE = 32;
5
5
  const BRICK_CACHE_SIZE_X = 64;
6
6
  const BRICK_CACHE_SIZE_Y = 64;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b$, bW, bU, bV, c3, c4, bX, cc, ca, c8, cb, c9, bT, c7, bY, bS, bR, c1, c0, c2, c6, c5, b_, ch, ck, ce, cl, cm, cf, ci, cj, cg, bZ, cd } from "./index-BFaSCwQo.js";
1
+ import { b$, bW, bU, bV, c3, c4, bX, cc, ca, c8, cb, c9, bT, c7, bY, bS, bR, c1, c0, c2, c6, c5, b_, ch, ck, ce, cl, cm, cf, ci, cj, cg, bZ, cd } from "./index-DIrygUEo.js";
2
2
  import "react";
3
3
  export {
4
4
  b$ as CoordinationLevel,
@@ -1,4 +1,4 @@
1
- import { aY as BaseDecoder } from "./index-BFaSCwQo.js";
1
+ import { aY as BaseDecoder } from "./index-DIrygUEo.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 { aH as getDefaultExportFromCjs, aY as BaseDecoder, aZ as LercParameters, a_ as LercAddCompression } from "./index-BFaSCwQo.js";
2
+ import { aH as getDefaultExportFromCjs, aY as BaseDecoder, aZ as LercParameters, a_ as LercAddCompression } from "./index-DIrygUEo.js";
3
3
  var LercDecode = { exports: {} };
4
4
  var hasRequiredLercDecode;
5
5
  function requireLercDecode() {
@@ -1,4 +1,4 @@
1
- import { aY as BaseDecoder } from "./index-BFaSCwQo.js";
1
+ import { aY as BaseDecoder } from "./index-DIrygUEo.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 { aY as BaseDecoder } from "./index-BFaSCwQo.js";
1
+ import { aY as BaseDecoder } from "./index-DIrygUEo.js";
2
2
  class PackbitsDecoder extends BaseDecoder {
3
3
  decodeBlock(buffer) {
4
4
  const dataView = new DataView(buffer);
@@ -1,4 +1,4 @@
1
- import { aY as BaseDecoder } from "./index-BFaSCwQo.js";
1
+ import { aY as BaseDecoder } from "./index-DIrygUEo.js";
2
2
  class RawDecoder extends BaseDecoder {
3
3
  decodeBlock(buffer) {
4
4
  return buffer;
@@ -1,4 +1,4 @@
1
- import { bM as MeshDistanceMaterial, bN as MeshDepthMaterial, bO as RGBADepthPacking, ae as UniformsUtils, bP as ShaderChunk, a9 as InstancedBufferGeometry, a8 as Sphere, a7 as Box3, am as BackSide, u as DoubleSide, z as Mesh, a5 as FrontSide, v as MeshBasicMaterial, C as Color, e as Vector3, M as Matrix4, V as Vector2, ap as Matrix3, ag as Vector4, a1 as Texture, l as LinearFilter, aF as PlaneGeometry, x as BufferGeometry, aa as Float32BufferAttribute, bQ as InstancedBufferAttribute } from "./index-BFaSCwQo.js";
1
+ import { bM as MeshDistanceMaterial, bN as MeshDepthMaterial, bO as RGBADepthPacking, ae as UniformsUtils, bP as ShaderChunk, a9 as InstancedBufferGeometry, a8 as Sphere, a7 as Box3, am as BackSide, u as DoubleSide, z as Mesh, a5 as FrontSide, v as MeshBasicMaterial, C as Color, e as Vector3, M as Matrix4, V as Vector2, ap as Matrix3, ag as Vector4, a1 as Texture, l as LinearFilter, aF as PlaneGeometry, x as BufferGeometry, aa as Float32BufferAttribute, bQ as InstancedBufferAttribute } from "./index-DIrygUEo.js";
2
2
  function workerBootstrap() {
3
3
  var modules = /* @__PURE__ */ Object.create(null);
4
4
  function registerModule(ref, callback) {
@@ -1,4 +1,4 @@
1
- import { aY as BaseDecoder } from "./index-BFaSCwQo.js";
1
+ import { aY as BaseDecoder } from "./index-DIrygUEo.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/dev",
3
- "version": "3.8.1",
3
+ "version": "3.8.2",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -16,10 +16,10 @@
16
16
  "dist-tsc"
17
17
  ],
18
18
  "dependencies": {
19
- "@vitessce/all": "3.8.1",
20
- "@vitessce/config": "3.8.1",
21
- "@vitessce/constants": "3.8.1",
22
- "@vitessce/export-utils": "3.8.1"
19
+ "@vitessce/all": "3.8.2",
20
+ "@vitessce/config": "3.8.2",
21
+ "@vitessce/constants": "3.8.2",
22
+ "@vitessce/export-utils": "3.8.2"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@vitejs/plugin-react": "^4.5.0",