@vitessce/spatial-utils 3.5.5 → 3.5.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,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { B as BaseDecoder } from "./index-ac1a35fe.js";
2
+ import { B as BaseDecoder } from "./index-6813c045.js";
3
3
  import "react";
4
4
  class DeflateDecoder extends BaseDecoder {
5
5
  decodeBlock(buffer) {
@@ -9003,7 +9003,7 @@ function clone$6(obj) {
9003
9003
  Decimal2.floor = floor$1;
9004
9004
  Decimal2.hypot = hypot;
9005
9005
  Decimal2.ln = ln;
9006
- Decimal2.log = log$5;
9006
+ Decimal2.log = log$6;
9007
9007
  Decimal2.log10 = log10;
9008
9008
  Decimal2.log2 = log2$1;
9009
9009
  Decimal2.max = max$2;
@@ -9068,7 +9068,7 @@ function isDecimalInstance(obj) {
9068
9068
  function ln(x2) {
9069
9069
  return new this(x2).ln();
9070
9070
  }
9071
- function log$5(x2, y2) {
9071
+ function log$6(x2, y2) {
9072
9072
  return new this(x2).log(y2);
9073
9073
  }
9074
9074
  function log2$1(x2) {
@@ -19995,6 +19995,258 @@ var pluralizeExports = pluralize.exports;
19995
19995
  const plur = /* @__PURE__ */ getDefaultExportFromCjs(pluralizeExports);
19996
19996
  plur.addPluralRule("glomerulus", "glomeruli");
19997
19997
  plur.addPluralRule("interstitium", "interstitia");
19998
+ var loglevel = { exports: {} };
19999
+ (function(module2) {
20000
+ (function(root2, definition) {
20001
+ if (module2.exports) {
20002
+ module2.exports = definition();
20003
+ } else {
20004
+ root2.log = definition();
20005
+ }
20006
+ })(commonjsGlobal, function() {
20007
+ var noop2 = function() {
20008
+ };
20009
+ var undefinedType = "undefined";
20010
+ var isIE = typeof window !== undefinedType && typeof window.navigator !== undefinedType && /Trident\/|MSIE /.test(window.navigator.userAgent);
20011
+ var logMethods = [
20012
+ "trace",
20013
+ "debug",
20014
+ "info",
20015
+ "warn",
20016
+ "error"
20017
+ ];
20018
+ var _loggersByName = {};
20019
+ var defaultLogger = null;
20020
+ function bindMethod(obj, methodName) {
20021
+ var method = obj[methodName];
20022
+ if (typeof method.bind === "function") {
20023
+ return method.bind(obj);
20024
+ } else {
20025
+ try {
20026
+ return Function.prototype.bind.call(method, obj);
20027
+ } catch (e2) {
20028
+ return function() {
20029
+ return Function.prototype.apply.apply(method, [obj, arguments]);
20030
+ };
20031
+ }
20032
+ }
20033
+ }
20034
+ function traceForIE() {
20035
+ if (console.log) {
20036
+ if (console.log.apply) {
20037
+ console.log.apply(console, arguments);
20038
+ } else {
20039
+ Function.prototype.apply.apply(console.log, [console, arguments]);
20040
+ }
20041
+ }
20042
+ if (console.trace)
20043
+ console.trace();
20044
+ }
20045
+ function realMethod(methodName) {
20046
+ if (methodName === "debug") {
20047
+ methodName = "log";
20048
+ }
20049
+ if (typeof console === undefinedType) {
20050
+ return false;
20051
+ } else if (methodName === "trace" && isIE) {
20052
+ return traceForIE;
20053
+ } else if (console[methodName] !== void 0) {
20054
+ return bindMethod(console, methodName);
20055
+ } else if (console.log !== void 0) {
20056
+ return bindMethod(console, "log");
20057
+ } else {
20058
+ return noop2;
20059
+ }
20060
+ }
20061
+ function replaceLoggingMethods() {
20062
+ var level = this.getLevel();
20063
+ for (var i2 = 0; i2 < logMethods.length; i2++) {
20064
+ var methodName = logMethods[i2];
20065
+ this[methodName] = i2 < level ? noop2 : this.methodFactory(methodName, level, this.name);
20066
+ }
20067
+ this.log = this.debug;
20068
+ if (typeof console === undefinedType && level < this.levels.SILENT) {
20069
+ return "No console available for logging";
20070
+ }
20071
+ }
20072
+ function enableLoggingWhenConsoleArrives(methodName) {
20073
+ return function() {
20074
+ if (typeof console !== undefinedType) {
20075
+ replaceLoggingMethods.call(this);
20076
+ this[methodName].apply(this, arguments);
20077
+ }
20078
+ };
20079
+ }
20080
+ function defaultMethodFactory(methodName, _level, _loggerName) {
20081
+ return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
20082
+ }
20083
+ function Logger(name2, factory2) {
20084
+ var self2 = this;
20085
+ var inheritedLevel;
20086
+ var defaultLevel;
20087
+ var userLevel;
20088
+ var storageKey = "loglevel";
20089
+ if (typeof name2 === "string") {
20090
+ storageKey += ":" + name2;
20091
+ } else if (typeof name2 === "symbol") {
20092
+ storageKey = void 0;
20093
+ }
20094
+ function persistLevelIfPossible(levelNum) {
20095
+ var levelName = (logMethods[levelNum] || "silent").toUpperCase();
20096
+ if (typeof window === undefinedType || !storageKey)
20097
+ return;
20098
+ try {
20099
+ window.localStorage[storageKey] = levelName;
20100
+ return;
20101
+ } catch (ignore) {
20102
+ }
20103
+ try {
20104
+ window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
20105
+ } catch (ignore) {
20106
+ }
20107
+ }
20108
+ function getPersistedLevel() {
20109
+ var storedLevel;
20110
+ if (typeof window === undefinedType || !storageKey)
20111
+ return;
20112
+ try {
20113
+ storedLevel = window.localStorage[storageKey];
20114
+ } catch (ignore) {
20115
+ }
20116
+ if (typeof storedLevel === undefinedType) {
20117
+ try {
20118
+ var cookie = window.document.cookie;
20119
+ var cookieName = encodeURIComponent(storageKey);
20120
+ var location = cookie.indexOf(cookieName + "=");
20121
+ if (location !== -1) {
20122
+ storedLevel = /^([^;]+)/.exec(
20123
+ cookie.slice(location + cookieName.length + 1)
20124
+ )[1];
20125
+ }
20126
+ } catch (ignore) {
20127
+ }
20128
+ }
20129
+ if (self2.levels[storedLevel] === void 0) {
20130
+ storedLevel = void 0;
20131
+ }
20132
+ return storedLevel;
20133
+ }
20134
+ function clearPersistedLevel() {
20135
+ if (typeof window === undefinedType || !storageKey)
20136
+ return;
20137
+ try {
20138
+ window.localStorage.removeItem(storageKey);
20139
+ } catch (ignore) {
20140
+ }
20141
+ try {
20142
+ window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
20143
+ } catch (ignore) {
20144
+ }
20145
+ }
20146
+ function normalizeLevel(input) {
20147
+ var level = input;
20148
+ if (typeof level === "string" && self2.levels[level.toUpperCase()] !== void 0) {
20149
+ level = self2.levels[level.toUpperCase()];
20150
+ }
20151
+ if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) {
20152
+ return level;
20153
+ } else {
20154
+ throw new TypeError("log.setLevel() called with invalid level: " + input);
20155
+ }
20156
+ }
20157
+ self2.name = name2;
20158
+ self2.levels = {
20159
+ "TRACE": 0,
20160
+ "DEBUG": 1,
20161
+ "INFO": 2,
20162
+ "WARN": 3,
20163
+ "ERROR": 4,
20164
+ "SILENT": 5
20165
+ };
20166
+ self2.methodFactory = factory2 || defaultMethodFactory;
20167
+ self2.getLevel = function() {
20168
+ if (userLevel != null) {
20169
+ return userLevel;
20170
+ } else if (defaultLevel != null) {
20171
+ return defaultLevel;
20172
+ } else {
20173
+ return inheritedLevel;
20174
+ }
20175
+ };
20176
+ self2.setLevel = function(level, persist) {
20177
+ userLevel = normalizeLevel(level);
20178
+ if (persist !== false) {
20179
+ persistLevelIfPossible(userLevel);
20180
+ }
20181
+ return replaceLoggingMethods.call(self2);
20182
+ };
20183
+ self2.setDefaultLevel = function(level) {
20184
+ defaultLevel = normalizeLevel(level);
20185
+ if (!getPersistedLevel()) {
20186
+ self2.setLevel(level, false);
20187
+ }
20188
+ };
20189
+ self2.resetLevel = function() {
20190
+ userLevel = null;
20191
+ clearPersistedLevel();
20192
+ replaceLoggingMethods.call(self2);
20193
+ };
20194
+ self2.enableAll = function(persist) {
20195
+ self2.setLevel(self2.levels.TRACE, persist);
20196
+ };
20197
+ self2.disableAll = function(persist) {
20198
+ self2.setLevel(self2.levels.SILENT, persist);
20199
+ };
20200
+ self2.rebuild = function() {
20201
+ if (defaultLogger !== self2) {
20202
+ inheritedLevel = normalizeLevel(defaultLogger.getLevel());
20203
+ }
20204
+ replaceLoggingMethods.call(self2);
20205
+ if (defaultLogger === self2) {
20206
+ for (var childName in _loggersByName) {
20207
+ _loggersByName[childName].rebuild();
20208
+ }
20209
+ }
20210
+ };
20211
+ inheritedLevel = normalizeLevel(
20212
+ defaultLogger ? defaultLogger.getLevel() : "WARN"
20213
+ );
20214
+ var initialLevel = getPersistedLevel();
20215
+ if (initialLevel != null) {
20216
+ userLevel = normalizeLevel(initialLevel);
20217
+ }
20218
+ replaceLoggingMethods.call(self2);
20219
+ }
20220
+ defaultLogger = new Logger();
20221
+ defaultLogger.getLogger = function getLogger(name2) {
20222
+ if (typeof name2 !== "symbol" && typeof name2 !== "string" || name2 === "") {
20223
+ throw new TypeError("You must supply a name when creating a logger.");
20224
+ }
20225
+ var logger = _loggersByName[name2];
20226
+ if (!logger) {
20227
+ logger = _loggersByName[name2] = new Logger(
20228
+ name2,
20229
+ defaultLogger.methodFactory
20230
+ );
20231
+ }
20232
+ return logger;
20233
+ };
20234
+ var _log = typeof window !== undefinedType ? window.log : void 0;
20235
+ defaultLogger.noConflict = function() {
20236
+ if (typeof window !== undefinedType && window.log === defaultLogger) {
20237
+ window.log = _log;
20238
+ }
20239
+ return defaultLogger;
20240
+ };
20241
+ defaultLogger.getLoggers = function getLoggers2() {
20242
+ return _loggersByName;
20243
+ };
20244
+ defaultLogger["default"] = defaultLogger;
20245
+ return defaultLogger;
20246
+ });
20247
+ })(loglevel);
20248
+ var loglevelExports = loglevel.exports;
20249
+ const log$5 = /* @__PURE__ */ getDefaultExportFromCjs(loglevelExports);
19998
20250
  const VIEWER_PALETTE = [
19999
20251
  [0, 0, 255],
20000
20252
  [0, 255, 0],
@@ -119259,16 +119511,16 @@ function addDecoder(cases, importFn) {
119259
119511
  }
119260
119512
  cases.forEach((c) => registry$2.set(c, importFn));
119261
119513
  }
119262
- addDecoder([void 0, 1], () => import("./raw-50921dfc.js").then((m) => m.default));
119263
- addDecoder(5, () => import("./lzw-04aab5f2.js").then((m) => m.default));
119514
+ addDecoder([void 0, 1], () => import("./raw-f26a9f8d.js").then((m) => m.default));
119515
+ addDecoder(5, () => import("./lzw-5a827465.js").then((m) => m.default));
119264
119516
  addDecoder(6, () => {
119265
119517
  throw new Error("old style JPEG compression is not supported.");
119266
119518
  });
119267
- addDecoder(7, () => import("./jpeg-defa9e7c.js").then((m) => m.default));
119268
- addDecoder([8, 32946], () => import("./deflate-72995733.js").then((m) => m.default));
119269
- addDecoder(32773, () => import("./packbits-3b8eecdb.js").then((m) => m.default));
119270
- addDecoder(34887, () => import("./lerc-016c6bf9.js").then((m) => m.default));
119271
- addDecoder(50001, () => import("./webimage-98d89993.js").then((m) => m.default));
119519
+ addDecoder(7, () => import("./jpeg-1cb04461.js").then((m) => m.default));
119520
+ addDecoder([8, 32946], () => import("./deflate-fb583d27.js").then((m) => m.default));
119521
+ addDecoder(32773, () => import("./packbits-9a095897.js").then((m) => m.default));
119522
+ addDecoder(34887, () => import("./lerc-36bff55b.js").then((m) => m.default));
119523
+ addDecoder(50001, () => import("./webimage-54f03dd3.js").then((m) => m.default));
119272
119524
  function decodeRowAcc(row, stride) {
119273
119525
  let length2 = row.length - stride;
119274
119526
  let offset = 0;
@@ -133193,10 +133445,10 @@ function multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColo
133193
133445
  const valueTexHeight = Math.max(2, Math.ceil(totalValuesLength / texSize));
133194
133446
  const colorTexHeight = Math.max(2, Math.ceil(totalColorsLength / texSize));
133195
133447
  if (valueTexHeight > texSize) {
133196
- console.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
133448
+ log$5.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
133197
133449
  }
133198
133450
  if (colorTexHeight > texSize) {
133199
- console.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
133451
+ log$5.error("Error: length of concatenated quantitative feature values larger than maximum texture size");
133200
133452
  }
133201
133453
  const totalData = new Uint8Array(texSize * valueTexHeight);
133202
133454
  const totalColors = new Uint8Array(texSize * colorTexHeight);
@@ -133994,7 +134246,7 @@ function normalizeCoordinateTransformations(coordinateTransformations, datasets)
133994
134246
  if (type2 === "sequence") {
133995
134247
  return normalizeCoordinateTransformations(transform2.transformations, datasets);
133996
134248
  }
133997
- console.warn(`Coordinate transformation type "${type2}" is not supported.`);
134249
+ log$5.warn(`Coordinate transformation type "${type2}" is not supported.`);
133998
134250
  }
133999
134251
  return transform2;
134000
134252
  });
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { D, e, a, b, c, d, E, G, Z, A, r, n, C, z, x, l, m, y, w, h, q, u, o, i, f, j, k, t, s, p, v } from "./index-ac1a35fe.js";
1
+ import { D, e, a, b, c, d, E, G, Z, A, r, n, C, z, x, l, m, y, w, h, q, u, o, i, f, j, k, t, s, p, v } from "./index-6813c045.js";
2
2
  import "react";
3
3
  export {
4
4
  D as DEFAULT_CELLS_LAYER,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-ac1a35fe.js";
1
+ import { B as BaseDecoder } from "./index-6813c045.js";
2
2
  import "react";
3
3
  const dctZigZag = new Int32Array([
4
4
  0,
@@ -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-ac1a35fe.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-6813c045.js";
3
3
  import "react";
4
4
  const LercParameters = {
5
5
  Version: 0,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-ac1a35fe.js";
1
+ import { B as BaseDecoder } from "./index-6813c045.js";
2
2
  import "react";
3
3
  const MIN_BITS = 9;
4
4
  const CLEAR_CODE = 256;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-ac1a35fe.js";
1
+ import { B as BaseDecoder } from "./index-6813c045.js";
2
2
  import "react";
3
3
  class PackbitsDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-ac1a35fe.js";
1
+ import { B as BaseDecoder } from "./index-6813c045.js";
2
2
  import "react";
3
3
  class RawDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-ac1a35fe.js";
1
+ import { B as BaseDecoder } from "./index-6813c045.js";
2
2
  import "react";
3
3
  class WebImageDecoder extends BaseDecoder {
4
4
  constructor() {
@@ -3,6 +3,7 @@ import { Matrix4 } from 'math.gl';
3
3
  import { divide, compare, unit } from 'mathjs';
4
4
  import { VIEWER_PALETTE } from '@vitessce/utils';
5
5
  import { GLOBAL_LABELS, DEFAULT_RASTER_LAYER_PROPS } from '@vitessce/constants-internal';
6
+ import { log } from '@vitessce/globals';
6
7
  import { getMultiSelectionStats } from './layer-controller.js';
7
8
  /**
8
9
  * Get a representative PixelSource from a loader object returned from
@@ -448,7 +449,7 @@ export function normalizeCoordinateTransformations(coordinateTransformations, da
448
449
  if (type === 'sequence') {
449
450
  return normalizeCoordinateTransformations(transform.transformations, datasets);
450
451
  }
451
- console.warn(`Coordinate transformation type "${type}" is not supported.`);
452
+ log.warn(`Coordinate transformation type "${type}" is not supported.`);
452
453
  }
453
454
  // Assume it was already an old-style (NGFF v0.4) coordinate transformation.
454
455
  return transform;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/spatial-utils",
3
- "version": "3.5.5",
3
+ "version": "3.5.7",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -20,10 +20,11 @@
20
20
  "zarrita": "0.4.0-next.16",
21
21
  "math.gl": "^3.5.6",
22
22
  "mathjs": "^9.2.0",
23
- "@vitessce/gl": "3.5.5",
24
- "@vitessce/utils": "3.5.5",
25
- "@vitessce/zarr-utils": "3.5.5",
26
- "@vitessce/constants-internal": "3.5.5"
23
+ "@vitessce/gl": "3.5.7",
24
+ "@vitessce/utils": "3.5.7",
25
+ "@vitessce/constants-internal": "3.5.7",
26
+ "@vitessce/globals": "3.5.7",
27
+ "@vitessce/zarr-utils": "3.5.7"
27
28
  },
28
29
  "scripts": {
29
30
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
package/src/spatial.js CHANGED
@@ -3,8 +3,8 @@ import { Matrix4 } from 'math.gl';
3
3
  import { divide, compare, unit } from 'mathjs';
4
4
  import { VIEWER_PALETTE } from '@vitessce/utils';
5
5
  import { GLOBAL_LABELS, DEFAULT_RASTER_LAYER_PROPS } from '@vitessce/constants-internal';
6
+ import { log } from '@vitessce/globals';
6
7
  import { getMultiSelectionStats } from './layer-controller.js';
7
-
8
8
  /**
9
9
  * Get a representative PixelSource from a loader object returned from
10
10
  * the Vitessce imaging loaders
@@ -500,7 +500,7 @@ export function normalizeCoordinateTransformations(coordinateTransformations, da
500
500
  if (type === 'sequence') {
501
501
  return normalizeCoordinateTransformations(transform.transformations, datasets);
502
502
  }
503
- console.warn(`Coordinate transformation type "${type}" is not supported.`);
503
+ log.warn(`Coordinate transformation type "${type}" is not supported.`);
504
504
  }
505
505
  // Assume it was already an old-style (NGFF v0.4) coordinate transformation.
506
506
  return transform;