@vitessce/dev 3.9.5 → 3.9.7

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 { aI as getDefaultExportFromCjs, aJ as Raycaster, W as OrthographicCamera, K as PerspectiveCamera, av as Scene, aK as PCFSoftShadowMap, aL as VSMShadowMap, aM as PCFShadowMap, aN as BasicShadowMap, aO as NoToneMapping, aP as ACESFilmicToneMapping, e as Vector3, V as Vector2, aQ as Clock, aR as WebGLRenderer, aS as Camera, x as BufferGeometry, r as Material, aT as Layers, a1 as Texture, aE as RGBAFormat, az as UnsignedByteType, C as Color, aj as _extends, aU as THREE, aV as EventDispatcher, aW as MOUSE, aX as TOUCH, aY as Spherical, Q as Quaternion, an as Ray, ak as Plane } from "./index-BOSHQFXK.js";
1
+ import { aI as getDefaultExportFromCjs, aJ as Raycaster, W as OrthographicCamera, K as PerspectiveCamera, av as Scene, aK as PCFSoftShadowMap, aL as VSMShadowMap, aM as PCFShadowMap, aN as BasicShadowMap, aO as NoToneMapping, aP as ACESFilmicToneMapping, e as Vector3, V as Vector2, aQ as Clock, aR as WebGLRenderer, aS as Camera, x as BufferGeometry, r as Material, aT as Layers, a1 as Texture, aE as RGBAFormat, az as UnsignedByteType, C as Color, aj as _extends, aU as THREE, aV as EventDispatcher, aW as MOUSE, aX as TOUCH, aY as Spherical, Q as Quaternion, an as Ray, ak as Plane } from "./index-BcB1ltME.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 { aI as getDefaultExportFromCjs, b3 as requireAssign, b4 as require_export, b5 as require_core, b6 as require_fails, b7 as require_toObject, b8 as require_objectKeys, b9 as require_cof, ba as require_wks, bb as require_iterators, bc as requireWeb_dom_iterable, bd as requireEs6_string_iterator, be as require_anObject, bf as require_hide, bg as require_ctx, bh as require_toLength, bi as require_global, bj as require_objectDp, bk as require_descriptors, bl as require_isObject, bm as require_objectCreate, bn as require_iterDefine, bo as require_iterStep, bp as require_meta, bq as require_isArray, br as require_iobject, bs as require_setToStringTag, bt as require_aFunction, bu as requireIterator, bv as require_propertyDesc, bw as require_root, bx as require_baseGetTag, by as requireIsObjectLike, bz as requireIsObject, bA as requireEs6_symbol, bB as requireDefineProperty, bC as require_toIobject, bD as require_objectGopd, bE as require_html, bF as require_domCreate, bG as require_library, bH as requireSymbol, bI as require_objectPie, bJ as require_has, bK as require_redefine, bL as require_objectAssign, bM as diffCameraState, ao as jsxRuntimeExports } from "./index-BOSHQFXK.js";
4
+ import { aI as getDefaultExportFromCjs, b3 as requireAssign, b4 as require_export, b5 as require_core, b6 as require_fails, b7 as require_toObject, b8 as require_objectKeys, b9 as require_cof, ba as require_wks, bb as require_iterators, bc as requireWeb_dom_iterable, bd as requireEs6_string_iterator, be as require_anObject, bf as require_hide, bg as require_ctx, bh as require_toLength, bi as require_global, bj as require_objectDp, bk as require_descriptors, bl as require_isObject, bm as require_objectCreate, bn as require_iterDefine, bo as require_iterStep, bp as require_meta, bq as require_isArray, br as require_iobject, bs as require_setToStringTag, bt as require_aFunction, bu as requireIterator, bv as require_propertyDesc, bw as require_root, bx as require_baseGetTag, by as requireIsObjectLike, bz as requireIsObject, bA as requireEs6_symbol, bB as requireDefineProperty, bC as require_toIobject, bD as require_objectGopd, bE as require_html, bF as require_domCreate, bG as require_library, bH as requireSymbol, bI as require_objectPie, bJ as require_has, bK as require_redefine, bL as require_objectAssign, bM as diffCameraState, ao as jsxRuntimeExports } from "./index-BcB1ltME.js";
5
5
  import React__default from "react";
6
6
  var assignExports = requireAssign();
7
7
  const _Object$assign = /* @__PURE__ */ getDefaultExportFromCjs(assignExports);
@@ -30037,9 +30037,7 @@ const svg_bin = "data:image/svg+xml,%3csvg%20role='img'%20xmlns='http://www.w3.o
30037
30037
  function makeDeleteButton(options = {}) {
30038
30038
  const icon = makeIcon(_Object$assign({ svg: svg_bin }, options));
30039
30039
  const svg = icon.firstElementChild;
30040
- if (svg) {
30041
- svg.style.fill = "white";
30042
- }
30040
+ if (svg) svg.style.fill = "white";
30043
30041
  return icon;
30044
30042
  }
30045
30043
  var es6_string_raw = {};
@@ -45684,6 +45682,18 @@ class DataManagementContext extends RefCounted {
45684
45682
  this.frameNumberCounter = frameNumberCounter;
45685
45683
  const chunk_worker_url = bundleRoot + "chunk_worker.bundle.js";
45686
45684
  this.worker = typeof bundleRoot === "string" ? new Worker(chunk_worker_url) : bundleRoot;
45685
+ if (typeof bundleRoot !== "string") {
45686
+ this.worker.addEventListener("message", (msg) => {
45687
+ if (msg.data?.functionName === "Worker" && msg.data?.path === "async_computation.bundle.js") {
45688
+ msg.stopImmediatePropagation();
45689
+ const AsyncWorker = bundleRoot.AsyncComputationWorker;
45690
+ if (AsyncWorker) {
45691
+ const asyncWorker = new AsyncWorker();
45692
+ asyncWorker.postMessage({ port: msg.data.port }, [msg.data.port]);
45693
+ }
45694
+ }
45695
+ }, true);
45696
+ }
45687
45697
  this.chunkQueueManager = this.registerDisposer(new ChunkQueueManager(new RPC(this.worker), this.gl, this.frameNumberCounter, {
45688
45698
  gpuMemory: new CapacitySpecification({ defaultItemLimit: 1e6, defaultSizeLimit: 1e9 }),
45689
45699
  systemMemory: new CapacitySpecification({ defaultItemLimit: 1e7, defaultSizeLimit: 2e9 }),
@@ -65362,24 +65372,26 @@ class Neuroglancer extends React__default.Component {
65362
65372
  return JSON.stringify(prevLayers) !== JSON.stringify(nextLayers);
65363
65373
  });
65364
65374
  /* To add colors to the segments, turning unselected to grey */
65365
- __publicField(this, "applyColorsAndVisibility", (cellColorMapping) => {
65375
+ __publicField(this, "applyColorsAndVisibility", (cellColorMappingByLayer) => {
65366
65376
  if (!this.viewer)
65367
65377
  return;
65368
- const selected = { ...cellColorMapping || {} };
65369
- for (const id of Object.keys(selected))
65370
- this.allKnownIds.add(id);
65371
- if (this.allKnownIds.size === 0) {
65372
- const init = this.props.viewerState?.layers?.[0]?.segmentColors || {};
65373
- for (const id of Object.keys(init))
65374
- this.allKnownIds.add(id);
65375
- }
65376
- const fullSegmentColors = {};
65377
- for (const id of this.allKnownIds) {
65378
- fullSegmentColors[id] = selected[id] || GREY_HEX;
65379
- }
65380
65378
  const baseLayers = this.props.viewerState?.layers ?? (this.viewer.state.toJSON().layers || []);
65381
- const newLayers = baseLayers.map((layer, idx) => {
65382
- if (idx === 0 || layer?.type === "segmentation") {
65379
+ const newLayers = baseLayers.map((layer) => {
65380
+ const layerScope = Object.keys(cellColorMappingByLayer).find((scope) => layer.name?.includes(scope));
65381
+ const selected = { ...cellColorMappingByLayer[layerScope] || {} };
65382
+ if (!this.allKnownIdsByLayer)
65383
+ this.allKnownIdsByLayer = {};
65384
+ if (!this.allKnownIdsByLayer[layerScope]) {
65385
+ this.allKnownIdsByLayer[layerScope] = /* @__PURE__ */ new Set();
65386
+ }
65387
+ for (const id of Object.keys(selected)) {
65388
+ this.allKnownIdsByLayer[layerScope].add(id);
65389
+ }
65390
+ const fullSegmentColors = {};
65391
+ for (const id of this.allKnownIdsByLayer[layerScope] || []) {
65392
+ fullSegmentColors[id] = selected[id] || GREY_HEX;
65393
+ }
65394
+ if (layer.type === "segmentation") {
65383
65395
  return { ...layer, segmentColors: fullSegmentColors };
65384
65396
  }
65385
65397
  return layer;
@@ -65489,7 +65501,7 @@ class Neuroglancer extends React__default.Component {
65489
65501
  this.disposers = [];
65490
65502
  this.prevColorOverrides = /* @__PURE__ */ new Set();
65491
65503
  this.overrideColorsById = /* @__PURE__ */ Object.create(null);
65492
- this.allKnownIds = /* @__PURE__ */ new Set();
65504
+ this.allKnownIdsByLayer = {};
65493
65505
  }
65494
65506
  componentDidMount() {
65495
65507
  const {
@@ -65531,7 +65543,7 @@ class Neuroglancer extends React__default.Component {
65531
65543
  }
65532
65544
  }
65533
65545
  componentDidUpdate(prevProps, prevState) {
65534
- const { viewerState, cellColorMapping } = this.props;
65546
+ const { viewerState, cellColorMapping: cellColorMappingByLayer } = this.props;
65535
65547
  const selectedSegments = {};
65536
65548
  for (const layer of this.viewer.layerManager.managedLayers) {
65537
65549
  if (layer.layer instanceof SegmentationUserLayer) {
@@ -65566,17 +65578,17 @@ class Neuroglancer extends React__default.Component {
65566
65578
  this.withoutEmitting(() => {
65567
65579
  const layers = Array.isArray(viewerState.layers) ? viewerState.layers : [];
65568
65580
  this.viewer.state.restoreState({ layers });
65569
- if (cellColorMapping && Object.keys(cellColorMapping).length) {
65570
- this.applyColorsAndVisibility(cellColorMapping);
65581
+ if (cellColorMappingByLayer && Object.keys(cellColorMappingByLayer).length) {
65582
+ this.applyColorsAndVisibility(cellColorMappingByLayer);
65571
65583
  }
65572
65584
  });
65573
65585
  }
65574
65586
  const prevSize = prevProps.cellColorMapping ? Object.keys(prevProps.cellColorMapping).length : 0;
65575
- const currSize = cellColorMapping ? Object.keys(cellColorMapping).length : 0;
65576
- const mappingRefChanged = prevProps.cellColorMapping !== cellColorMapping;
65587
+ const currSize = cellColorMappingByLayer ? Object.keys(cellColorMappingByLayer).length : 0;
65588
+ const mappingRefChanged = prevProps.cellColorMapping !== this.props.cellColorMapping;
65577
65589
  if (!this.didLayersChange(prevVS, viewerState) && (mappingRefChanged || prevSize !== currSize)) {
65578
65590
  this.withoutEmitting(() => {
65579
- this.applyColorsAndVisibility(cellColorMapping);
65591
+ this.applyColorsAndVisibility(cellColorMappingByLayer);
65580
65592
  });
65581
65593
  }
65582
65594
  const stripSegFields = (layers) => (layers || []).map((l) => {
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { aZ as BaseDecoder } from "./index-BOSHQFXK.js";
2
+ import { aZ as BaseDecoder } from "./index-BcB1ltME.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 { b0 as commonjsGlobal$1, b1 as requireObjectAssign, aI as getDefaultExportFromCjs$1, b2 as earcut } from "./index-BOSHQFXK.js";
4
+ import { b0 as commonjsGlobal$1, b1 as requireObjectAssign, aI as getDefaultExportFromCjs$1, b2 as earcut } from "./index-BcB1ltME.js";
5
5
  var promise = {};
6
6
  var hasRequiredPromise;
7
7
  function requirePromise() {