@vitessce/vit-s 3.1.3 → 3.2.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.
Files changed (46) hide show
  1. package/dist/index.js +1673 -130
  2. package/dist-tsc/data-hook-utils.d.ts +1 -0
  3. package/dist-tsc/data-hook-utils.d.ts.map +1 -1
  4. package/dist-tsc/data-hook-utils.js +12 -4
  5. package/dist-tsc/data-hooks-multilevel-utils.d.ts +77 -0
  6. package/dist-tsc/data-hooks-multilevel-utils.d.ts.map +1 -0
  7. package/dist-tsc/data-hooks-multilevel-utils.js +418 -0
  8. package/dist-tsc/data-hooks-multilevel-utils.test.d.ts +2 -0
  9. package/dist-tsc/data-hooks-multilevel-utils.test.d.ts.map +1 -0
  10. package/dist-tsc/data-hooks-multilevel-utils.test.js +101 -0
  11. package/dist-tsc/data-hooks-multilevel.d.ts +8 -0
  12. package/dist-tsc/data-hooks-multilevel.d.ts.map +1 -0
  13. package/dist-tsc/data-hooks-multilevel.js +125 -0
  14. package/dist-tsc/data-hooks.d.ts +7 -0
  15. package/dist-tsc/data-hooks.d.ts.map +1 -1
  16. package/dist-tsc/data-hooks.js +75 -6
  17. package/dist-tsc/hooks.js +1 -1
  18. package/dist-tsc/index.d.ts +3 -2
  19. package/dist-tsc/index.js +3 -2
  20. package/dist-tsc/shared-mui/components.d.ts.map +1 -1
  21. package/dist-tsc/shared-mui/components.js +3 -2
  22. package/dist-tsc/state/hooks.d.ts +80 -21
  23. package/dist-tsc/state/hooks.d.ts.map +1 -1
  24. package/dist-tsc/state/hooks.js +428 -103
  25. package/dist-tsc/state/hooks.test.d.ts +2 -0
  26. package/dist-tsc/state/hooks.test.d.ts.map +1 -0
  27. package/dist-tsc/state/hooks.test.js +149 -0
  28. package/dist-tsc/state/spatial-reducers.d.ts +25 -0
  29. package/dist-tsc/state/spatial-reducers.d.ts.map +1 -0
  30. package/dist-tsc/state/spatial-reducers.js +251 -0
  31. package/dist-tsc/state/spatial-reducers.test.d.ts +2 -0
  32. package/dist-tsc/state/spatial-reducers.test.d.ts.map +1 -0
  33. package/dist-tsc/state/spatial-reducers.test.js +1382 -0
  34. package/package.json +5 -5
  35. package/src/data-hook-utils.js +19 -3
  36. package/src/data-hooks-multilevel-utils.js +571 -0
  37. package/src/data-hooks-multilevel-utils.test.js +110 -0
  38. package/src/data-hooks-multilevel.js +226 -0
  39. package/src/data-hooks.js +156 -6
  40. package/src/hooks.js +1 -1
  41. package/src/index.js +25 -0
  42. package/src/shared-mui/components.js +9 -4
  43. package/src/state/hooks.js +485 -104
  44. package/src/state/hooks.test.js +182 -0
  45. package/src/state/spatial-reducers.js +291 -0
  46. package/src/state/spatial-reducers.test.js +1432 -0
package/dist/index.js CHANGED
@@ -1298,7 +1298,7 @@ function _typeof$8(obj) {
1298
1298
  return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
1299
1299
  }, _typeof$8(obj);
1300
1300
  }
1301
- function isPlainObject$1(item) {
1301
+ function isPlainObject$2(item) {
1302
1302
  return item && _typeof$8(item) === "object" && item.constructor === Object;
1303
1303
  }
1304
1304
  function deepmerge(target, source) {
@@ -1306,12 +1306,12 @@ function deepmerge(target, source) {
1306
1306
  clone: true
1307
1307
  };
1308
1308
  var output = options.clone ? _extends$6({}, target) : target;
1309
- if (isPlainObject$1(target) && isPlainObject$1(source)) {
1309
+ if (isPlainObject$2(target) && isPlainObject$2(source)) {
1310
1310
  Object.keys(source).forEach(function(key) {
1311
1311
  if (key === "__proto__") {
1312
1312
  return;
1313
1313
  }
1314
- if (isPlainObject$1(source[key]) && key in target) {
1314
+ if (isPlainObject$2(source[key]) && key in target) {
1315
1315
  output[key] = deepmerge(target[key], source[key], options);
1316
1316
  } else {
1317
1317
  output[key] = source[key];
@@ -1488,7 +1488,7 @@ object-assign
1488
1488
  @license MIT
1489
1489
  */
1490
1490
  var getOwnPropertySymbols$1 = Object.getOwnPropertySymbols;
1491
- var hasOwnProperty$l = Object.prototype.hasOwnProperty;
1491
+ var hasOwnProperty$m = Object.prototype.hasOwnProperty;
1492
1492
  var propIsEnumerable = Object.prototype.propertyIsEnumerable;
1493
1493
  function toObject(val) {
1494
1494
  if (val === null || val === void 0) {
@@ -1535,7 +1535,7 @@ var objectAssign = shouldUseNative() ? Object.assign : function(target, source)
1535
1535
  for (var s = 1; s < arguments.length; s++) {
1536
1536
  from = Object(arguments[s]);
1537
1537
  for (var key in from) {
1538
- if (hasOwnProperty$l.call(from, key)) {
1538
+ if (hasOwnProperty$m.call(from, key)) {
1539
1539
  to[key] = from[key];
1540
1540
  }
1541
1541
  }
@@ -2952,7 +2952,7 @@ function _typeof$7(obj) {
2952
2952
  return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
2953
2953
  }, _typeof$7(obj);
2954
2954
  }
2955
- function merge(acc, item) {
2955
+ function merge$2(acc, item) {
2956
2956
  if (!item) {
2957
2957
  return acc;
2958
2958
  }
@@ -3047,7 +3047,7 @@ function compose() {
3047
3047
  return styles20.reduce(function(acc, style) {
3048
3048
  var output = style(props);
3049
3049
  if (output) {
3050
- return merge(acc, output);
3050
+ return merge$2(acc, output);
3051
3051
  }
3052
3052
  return acc;
3053
3053
  }, {});
@@ -3115,12 +3115,12 @@ function styleFunctionSx(styleFunction2) {
3115
3115
  var newStyleFunction = function newStyleFunction2(props) {
3116
3116
  var output = styleFunction2(props);
3117
3117
  if (props.css) {
3118
- return _extends$5({}, merge(output, styleFunction2(_extends$5({
3118
+ return _extends$5({}, merge$2(output, styleFunction2(_extends$5({
3119
3119
  theme: props.theme
3120
3120
  }, props.css))), omit$1(props.css, [styleFunction2.filterProps]));
3121
3121
  }
3122
3122
  if (props.sx) {
3123
- return _extends$5({}, merge(output, styleFunction2(_extends$5({
3123
+ return _extends$5({}, merge$2(output, styleFunction2(_extends$5({
3124
3124
  theme: props.theme
3125
3125
  }, props.sx))), omit$1(props.sx, [styleFunction2.filterProps]));
3126
3126
  }
@@ -3469,7 +3469,7 @@ function spacing(props) {
3469
3469
  var styleFromPropValue = getStyleFromPropValue(cssProperties, transformer);
3470
3470
  var propValue = props[prop];
3471
3471
  return handleBreakpoints(props, propValue, styleFromPropValue);
3472
- }).reduce(merge, {});
3472
+ }).reduce(merge$2, {});
3473
3473
  }
3474
3474
  spacing.propTypes = spacingKeys.reduce(function(obj, key) {
3475
3475
  obj[key] = responsivePropType$1;
@@ -16695,7 +16695,7 @@ function hashQueryKeyByOptions(queryKey, options) {
16695
16695
  return hashFn(queryKey);
16696
16696
  }
16697
16697
  function hashQueryKey(queryKey) {
16698
- return JSON.stringify(queryKey, (_, val) => isPlainObject(val) ? Object.keys(val).sort().reduce((result, key) => {
16698
+ return JSON.stringify(queryKey, (_, val) => isPlainObject$1(val) ? Object.keys(val).sort().reduce((result, key) => {
16699
16699
  result[key] = val[key];
16700
16700
  return result;
16701
16701
  }, {}) : val);
@@ -16720,7 +16720,7 @@ function replaceEqualDeep(a, b) {
16720
16720
  return a;
16721
16721
  }
16722
16722
  const array = isPlainArray(a) && isPlainArray(b);
16723
- if (array || isPlainObject(a) && isPlainObject(b)) {
16723
+ if (array || isPlainObject$1(a) && isPlainObject$1(b)) {
16724
16724
  const aSize = array ? a.length : Object.keys(a).length;
16725
16725
  const bItems = array ? b : Object.keys(b);
16726
16726
  const bSize = bItems.length;
@@ -16751,7 +16751,7 @@ function shallowEqualObjects(a, b) {
16751
16751
  function isPlainArray(value) {
16752
16752
  return Array.isArray(value) && value.length === Object.keys(value).length;
16753
16753
  }
16754
- function isPlainObject(o) {
16754
+ function isPlainObject$1(o) {
16755
16755
  if (!hasObjectPrototype(o)) {
16756
16756
  return false;
16757
16757
  }
@@ -19198,12 +19198,12 @@ var root$9 = freeGlobal$3 || freeSelf$1 || Function("return this")();
19198
19198
  const root$a = root$9;
19199
19199
  var Symbol$5 = root$a.Symbol;
19200
19200
  const Symbol$6 = Symbol$5;
19201
- var objectProto$q = Object.prototype;
19202
- var hasOwnProperty$k = objectProto$q.hasOwnProperty;
19203
- var nativeObjectToString$3 = objectProto$q.toString;
19201
+ var objectProto$r = Object.prototype;
19202
+ var hasOwnProperty$l = objectProto$r.hasOwnProperty;
19203
+ var nativeObjectToString$3 = objectProto$r.toString;
19204
19204
  var symToStringTag$3 = Symbol$6 ? Symbol$6.toStringTag : void 0;
19205
19205
  function getRawTag$2(value) {
19206
- var isOwn = hasOwnProperty$k.call(value, symToStringTag$3), tag = value[symToStringTag$3];
19206
+ var isOwn = hasOwnProperty$l.call(value, symToStringTag$3), tag = value[symToStringTag$3];
19207
19207
  try {
19208
19208
  value[symToStringTag$3] = void 0;
19209
19209
  var unmasked = true;
@@ -19219,8 +19219,8 @@ function getRawTag$2(value) {
19219
19219
  }
19220
19220
  return result;
19221
19221
  }
19222
- var objectProto$p = Object.prototype;
19223
- var nativeObjectToString$2 = objectProto$p.toString;
19222
+ var objectProto$q = Object.prototype;
19223
+ var nativeObjectToString$2 = objectProto$q.toString;
19224
19224
  function objectToString$2(value) {
19225
19225
  return nativeObjectToString$2.call(value);
19226
19226
  }
@@ -19333,12 +19333,12 @@ var maskSrcKey$1 = function() {
19333
19333
  function isMasked$2(func) {
19334
19334
  return !!maskSrcKey$1 && maskSrcKey$1 in func;
19335
19335
  }
19336
- var funcProto$3 = Function.prototype;
19337
- var funcToString$3 = funcProto$3.toString;
19336
+ var funcProto$4 = Function.prototype;
19337
+ var funcToString$4 = funcProto$4.toString;
19338
19338
  function toSource$3(func) {
19339
19339
  if (func != null) {
19340
19340
  try {
19341
- return funcToString$3.call(func);
19341
+ return funcToString$4.call(func);
19342
19342
  } catch (e) {
19343
19343
  }
19344
19344
  try {
@@ -19350,11 +19350,11 @@ function toSource$3(func) {
19350
19350
  }
19351
19351
  var reRegExpChar$1 = /[\\^$.*+?()[\]{}|]/g;
19352
19352
  var reIsHostCtor$1 = /^\[object .+?Constructor\]$/;
19353
- var funcProto$2 = Function.prototype, objectProto$o = Object.prototype;
19354
- var funcToString$2 = funcProto$2.toString;
19355
- var hasOwnProperty$j = objectProto$o.hasOwnProperty;
19353
+ var funcProto$3 = Function.prototype, objectProto$p = Object.prototype;
19354
+ var funcToString$3 = funcProto$3.toString;
19355
+ var hasOwnProperty$k = objectProto$p.hasOwnProperty;
19356
19356
  var reIsNative$1 = RegExp(
19357
- "^" + funcToString$2.call(hasOwnProperty$j).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
19357
+ "^" + funcToString$3.call(hasOwnProperty$k).replace(reRegExpChar$1, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
19358
19358
  );
19359
19359
  function baseIsNative$2(value) {
19360
19360
  if (!isObject$3(value) || isMasked$2(value)) {
@@ -19484,11 +19484,11 @@ function baseAssignValue(object, key, value) {
19484
19484
  function eq$7(value, other) {
19485
19485
  return value === other || value !== value && other !== other;
19486
19486
  }
19487
- var objectProto$n = Object.prototype;
19488
- var hasOwnProperty$i = objectProto$n.hasOwnProperty;
19487
+ var objectProto$o = Object.prototype;
19488
+ var hasOwnProperty$j = objectProto$o.hasOwnProperty;
19489
19489
  function assignValue(object, key, value) {
19490
19490
  var objValue = object[key];
19491
- if (!(hasOwnProperty$i.call(object, key) && eq$7(objValue, value)) || value === void 0 && !(key in object)) {
19491
+ if (!(hasOwnProperty$j.call(object, key) && eq$7(objValue, value)) || value === void 0 && !(key in object)) {
19492
19492
  baseAssignValue(object, key, value);
19493
19493
  }
19494
19494
  }
@@ -19527,6 +19527,9 @@ function overRest(func, start, transform3) {
19527
19527
  return apply(func, this, otherArgs);
19528
19528
  };
19529
19529
  }
19530
+ function baseRest(func, start) {
19531
+ return setToString$1(overRest(func, start, identity), func + "");
19532
+ }
19530
19533
  var MAX_SAFE_INTEGER$4 = 9007199254740991;
19531
19534
  function isLength$3(value) {
19532
19535
  return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
@@ -19544,9 +19547,27 @@ function isIterateeCall(value, index, object) {
19544
19547
  }
19545
19548
  return false;
19546
19549
  }
19547
- var objectProto$m = Object.prototype;
19550
+ function createAssigner(assigner) {
19551
+ return baseRest(function(object, sources) {
19552
+ var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : void 0, guard = length > 2 ? sources[2] : void 0;
19553
+ customizer = assigner.length > 3 && typeof customizer == "function" ? (length--, customizer) : void 0;
19554
+ if (guard && isIterateeCall(sources[0], sources[1], guard)) {
19555
+ customizer = length < 3 ? void 0 : customizer;
19556
+ length = 1;
19557
+ }
19558
+ object = Object(object);
19559
+ while (++index < length) {
19560
+ var source = sources[index];
19561
+ if (source) {
19562
+ assigner(object, source, index, customizer);
19563
+ }
19564
+ }
19565
+ return object;
19566
+ });
19567
+ }
19568
+ var objectProto$n = Object.prototype;
19548
19569
  function isPrototype$2(value) {
19549
- var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
19570
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$n;
19550
19571
  return value === proto;
19551
19572
  }
19552
19573
  function baseTimes$2(n, iteratee) {
@@ -19560,13 +19581,13 @@ var argsTag$6 = "[object Arguments]";
19560
19581
  function baseIsArguments$2(value) {
19561
19582
  return isObjectLike$5(value) && baseGetTag$5(value) == argsTag$6;
19562
19583
  }
19563
- var objectProto$l = Object.prototype;
19564
- var hasOwnProperty$h = objectProto$l.hasOwnProperty;
19565
- var propertyIsEnumerable$3 = objectProto$l.propertyIsEnumerable;
19584
+ var objectProto$m = Object.prototype;
19585
+ var hasOwnProperty$i = objectProto$m.hasOwnProperty;
19586
+ var propertyIsEnumerable$3 = objectProto$m.propertyIsEnumerable;
19566
19587
  var isArguments$2 = baseIsArguments$2(function() {
19567
19588
  return arguments;
19568
19589
  }()) ? baseIsArguments$2 : function(value) {
19569
- return isObjectLike$5(value) && hasOwnProperty$h.call(value, "callee") && !propertyIsEnumerable$3.call(value, "callee");
19590
+ return isObjectLike$5(value) && hasOwnProperty$i.call(value, "callee") && !propertyIsEnumerable$3.call(value, "callee");
19570
19591
  };
19571
19592
  const isArguments$3 = isArguments$2;
19572
19593
  function stubFalse$1() {
@@ -19579,11 +19600,11 @@ var Buffer$1 = moduleExports$2 ? root$a.Buffer : void 0;
19579
19600
  var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
19580
19601
  var isBuffer$3 = nativeIsBuffer || stubFalse$1;
19581
19602
  const isBuffer$4 = isBuffer$3;
19582
- var argsTag$5 = "[object Arguments]", arrayTag$4 = "[object Array]", boolTag$5 = "[object Boolean]", dateTag$5 = "[object Date]", errorTag$4 = "[object Error]", funcTag$3 = "[object Function]", mapTag$8 = "[object Map]", numberTag$5 = "[object Number]", objectTag$6 = "[object Object]", regexpTag$5 = "[object RegExp]", setTag$8 = "[object Set]", stringTag$5 = "[object String]", weakMapTag$4 = "[object WeakMap]";
19603
+ var argsTag$5 = "[object Arguments]", arrayTag$4 = "[object Array]", boolTag$5 = "[object Boolean]", dateTag$5 = "[object Date]", errorTag$4 = "[object Error]", funcTag$3 = "[object Function]", mapTag$8 = "[object Map]", numberTag$5 = "[object Number]", objectTag$7 = "[object Object]", regexpTag$5 = "[object RegExp]", setTag$8 = "[object Set]", stringTag$5 = "[object String]", weakMapTag$4 = "[object WeakMap]";
19583
19604
  var arrayBufferTag$5 = "[object ArrayBuffer]", dataViewTag$7 = "[object DataView]", float32Tag$3 = "[object Float32Array]", float64Tag$3 = "[object Float64Array]", int8Tag$3 = "[object Int8Array]", int16Tag$3 = "[object Int16Array]", int32Tag$3 = "[object Int32Array]", uint8Tag$3 = "[object Uint8Array]", uint8ClampedTag$3 = "[object Uint8ClampedArray]", uint16Tag$3 = "[object Uint16Array]", uint32Tag$3 = "[object Uint32Array]";
19584
19605
  var typedArrayTags$1 = {};
19585
19606
  typedArrayTags$1[float32Tag$3] = typedArrayTags$1[float64Tag$3] = typedArrayTags$1[int8Tag$3] = typedArrayTags$1[int16Tag$3] = typedArrayTags$1[int32Tag$3] = typedArrayTags$1[uint8Tag$3] = typedArrayTags$1[uint8ClampedTag$3] = typedArrayTags$1[uint16Tag$3] = typedArrayTags$1[uint32Tag$3] = true;
19586
- typedArrayTags$1[argsTag$5] = typedArrayTags$1[arrayTag$4] = typedArrayTags$1[arrayBufferTag$5] = typedArrayTags$1[boolTag$5] = typedArrayTags$1[dataViewTag$7] = typedArrayTags$1[dateTag$5] = typedArrayTags$1[errorTag$4] = typedArrayTags$1[funcTag$3] = typedArrayTags$1[mapTag$8] = typedArrayTags$1[numberTag$5] = typedArrayTags$1[objectTag$6] = typedArrayTags$1[regexpTag$5] = typedArrayTags$1[setTag$8] = typedArrayTags$1[stringTag$5] = typedArrayTags$1[weakMapTag$4] = false;
19607
+ typedArrayTags$1[argsTag$5] = typedArrayTags$1[arrayTag$4] = typedArrayTags$1[arrayBufferTag$5] = typedArrayTags$1[boolTag$5] = typedArrayTags$1[dataViewTag$7] = typedArrayTags$1[dateTag$5] = typedArrayTags$1[errorTag$4] = typedArrayTags$1[funcTag$3] = typedArrayTags$1[mapTag$8] = typedArrayTags$1[numberTag$5] = typedArrayTags$1[objectTag$7] = typedArrayTags$1[regexpTag$5] = typedArrayTags$1[setTag$8] = typedArrayTags$1[stringTag$5] = typedArrayTags$1[weakMapTag$4] = false;
19587
19608
  function baseIsTypedArray$2(value) {
19588
19609
  return isObjectLike$5(value) && isLength$3(value.length) && !!typedArrayTags$1[baseGetTag$5(value)];
19589
19610
  }
@@ -19610,12 +19631,12 @@ const nodeUtil$2 = nodeUtil$1;
19610
19631
  var nodeIsTypedArray$1 = nodeUtil$2 && nodeUtil$2.isTypedArray;
19611
19632
  var isTypedArray$3 = nodeIsTypedArray$1 ? baseUnary$2(nodeIsTypedArray$1) : baseIsTypedArray$2;
19612
19633
  const isTypedArray$4 = isTypedArray$3;
19613
- var objectProto$k = Object.prototype;
19614
- var hasOwnProperty$g = objectProto$k.hasOwnProperty;
19634
+ var objectProto$l = Object.prototype;
19635
+ var hasOwnProperty$h = objectProto$l.hasOwnProperty;
19615
19636
  function arrayLikeKeys$2(value, inherited) {
19616
19637
  var isArr = isArray$5(value), isArg = !isArr && isArguments$3(value), isBuff = !isArr && !isArg && isBuffer$4(value), isType = !isArr && !isArg && !isBuff && isTypedArray$4(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes$2(value.length, String) : [], length = result.length;
19617
19638
  for (var key in value) {
19618
- if ((inherited || hasOwnProperty$g.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
19639
+ if ((inherited || hasOwnProperty$h.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
19619
19640
  (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
19620
19641
  isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
19621
19642
  isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
@@ -19632,15 +19653,15 @@ function overArg$2(func, transform3) {
19632
19653
  }
19633
19654
  var nativeKeys$2 = overArg$2(Object.keys, Object);
19634
19655
  const nativeKeys$3 = nativeKeys$2;
19635
- var objectProto$j = Object.prototype;
19636
- var hasOwnProperty$f = objectProto$j.hasOwnProperty;
19656
+ var objectProto$k = Object.prototype;
19657
+ var hasOwnProperty$g = objectProto$k.hasOwnProperty;
19637
19658
  function baseKeys$2(object) {
19638
19659
  if (!isPrototype$2(object)) {
19639
19660
  return nativeKeys$3(object);
19640
19661
  }
19641
19662
  var result = [];
19642
19663
  for (var key in Object(object)) {
19643
- if (hasOwnProperty$f.call(object, key) && key != "constructor") {
19664
+ if (hasOwnProperty$g.call(object, key) && key != "constructor") {
19644
19665
  result.push(key);
19645
19666
  }
19646
19667
  }
@@ -19658,15 +19679,15 @@ function nativeKeysIn(object) {
19658
19679
  }
19659
19680
  return result;
19660
19681
  }
19661
- var objectProto$i = Object.prototype;
19662
- var hasOwnProperty$e = objectProto$i.hasOwnProperty;
19682
+ var objectProto$j = Object.prototype;
19683
+ var hasOwnProperty$f = objectProto$j.hasOwnProperty;
19663
19684
  function baseKeysIn(object) {
19664
19685
  if (!isObject$3(object)) {
19665
19686
  return nativeKeysIn(object);
19666
19687
  }
19667
19688
  var isProto = isPrototype$2(object), result = [];
19668
19689
  for (var key in object) {
19669
- if (!(key == "constructor" && (isProto || !hasOwnProperty$e.call(object, key)))) {
19690
+ if (!(key == "constructor" && (isProto || !hasOwnProperty$f.call(object, key)))) {
19670
19691
  result.push(key);
19671
19692
  }
19672
19693
  }
@@ -19698,21 +19719,21 @@ function hashDelete$2(key) {
19698
19719
  return result;
19699
19720
  }
19700
19721
  var HASH_UNDEFINED$5 = "__lodash_hash_undefined__";
19701
- var objectProto$h = Object.prototype;
19702
- var hasOwnProperty$d = objectProto$h.hasOwnProperty;
19722
+ var objectProto$i = Object.prototype;
19723
+ var hasOwnProperty$e = objectProto$i.hasOwnProperty;
19703
19724
  function hashGet$2(key) {
19704
19725
  var data = this.__data__;
19705
19726
  if (nativeCreate$6) {
19706
19727
  var result = data[key];
19707
19728
  return result === HASH_UNDEFINED$5 ? void 0 : result;
19708
19729
  }
19709
- return hasOwnProperty$d.call(data, key) ? data[key] : void 0;
19730
+ return hasOwnProperty$e.call(data, key) ? data[key] : void 0;
19710
19731
  }
19711
- var objectProto$g = Object.prototype;
19712
- var hasOwnProperty$c = objectProto$g.hasOwnProperty;
19732
+ var objectProto$h = Object.prototype;
19733
+ var hasOwnProperty$d = objectProto$h.hasOwnProperty;
19713
19734
  function hashHas$2(key) {
19714
19735
  var data = this.__data__;
19715
- return nativeCreate$6 ? data[key] !== void 0 : hasOwnProperty$c.call(data, key);
19736
+ return nativeCreate$6 ? data[key] !== void 0 : hasOwnProperty$d.call(data, key);
19716
19737
  }
19717
19738
  var HASH_UNDEFINED$4 = "__lodash_hash_undefined__";
19718
19739
  function hashSet$2(key, value) {
@@ -19950,6 +19971,22 @@ function flatRest(func) {
19950
19971
  }
19951
19972
  var getPrototype = overArg$2(Object.getPrototypeOf, Object);
19952
19973
  const getPrototype$1 = getPrototype;
19974
+ var objectTag$6 = "[object Object]";
19975
+ var funcProto$2 = Function.prototype, objectProto$g = Object.prototype;
19976
+ var funcToString$2 = funcProto$2.toString;
19977
+ var hasOwnProperty$c = objectProto$g.hasOwnProperty;
19978
+ var objectCtorString = funcToString$2.call(Object);
19979
+ function isPlainObject(value) {
19980
+ if (!isObjectLike$5(value) || baseGetTag$5(value) != objectTag$6) {
19981
+ return false;
19982
+ }
19983
+ var proto = getPrototype$1(value);
19984
+ if (proto === null) {
19985
+ return true;
19986
+ }
19987
+ var Ctor = hasOwnProperty$c.call(proto, "constructor") && proto.constructor;
19988
+ return typeof Ctor == "function" && Ctor instanceof Ctor && funcToString$2.call(Ctor) == objectCtorString;
19989
+ }
19953
19990
  function stackClear$2() {
19954
19991
  this.__data__ = new ListCache$5();
19955
19992
  this.size = 0;
@@ -20714,6 +20751,86 @@ function debounce(func, wait, options) {
20714
20751
  debounced.flush = flush;
20715
20752
  return debounced;
20716
20753
  }
20754
+ function assignMergeValue(object, key, value) {
20755
+ if (value !== void 0 && !eq$7(object[key], value) || value === void 0 && !(key in object)) {
20756
+ baseAssignValue(object, key, value);
20757
+ }
20758
+ }
20759
+ function isArrayLikeObject(value) {
20760
+ return isObjectLike$5(value) && isArrayLike$2(value);
20761
+ }
20762
+ function safeGet(object, key) {
20763
+ if (key === "constructor" && typeof object[key] === "function") {
20764
+ return;
20765
+ }
20766
+ if (key == "__proto__") {
20767
+ return;
20768
+ }
20769
+ return object[key];
20770
+ }
20771
+ function toPlainObject(value) {
20772
+ return copyObject(value, keysIn(value));
20773
+ }
20774
+ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
20775
+ var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue);
20776
+ if (stacked) {
20777
+ assignMergeValue(object, key, stacked);
20778
+ return;
20779
+ }
20780
+ var newValue = customizer ? customizer(objValue, srcValue, key + "", object, source, stack) : void 0;
20781
+ var isCommon = newValue === void 0;
20782
+ if (isCommon) {
20783
+ var isArr = isArray$5(srcValue), isBuff = !isArr && isBuffer$4(srcValue), isTyped = !isArr && !isBuff && isTypedArray$4(srcValue);
20784
+ newValue = srcValue;
20785
+ if (isArr || isBuff || isTyped) {
20786
+ if (isArray$5(objValue)) {
20787
+ newValue = objValue;
20788
+ } else if (isArrayLikeObject(objValue)) {
20789
+ newValue = copyArray(objValue);
20790
+ } else if (isBuff) {
20791
+ isCommon = false;
20792
+ newValue = cloneBuffer(srcValue, true);
20793
+ } else if (isTyped) {
20794
+ isCommon = false;
20795
+ newValue = cloneTypedArray(srcValue, true);
20796
+ } else {
20797
+ newValue = [];
20798
+ }
20799
+ } else if (isPlainObject(srcValue) || isArguments$3(srcValue)) {
20800
+ newValue = objValue;
20801
+ if (isArguments$3(objValue)) {
20802
+ newValue = toPlainObject(objValue);
20803
+ } else if (!isObject$3(objValue) || isFunction$4(objValue)) {
20804
+ newValue = initCloneObject(srcValue);
20805
+ }
20806
+ } else {
20807
+ isCommon = false;
20808
+ }
20809
+ }
20810
+ if (isCommon) {
20811
+ stack.set(srcValue, newValue);
20812
+ mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
20813
+ stack["delete"](srcValue);
20814
+ }
20815
+ assignMergeValue(object, key, newValue);
20816
+ }
20817
+ function baseMerge(object, source, srcIndex, customizer, stack) {
20818
+ if (object === source) {
20819
+ return;
20820
+ }
20821
+ baseFor$1(source, function(srcValue, key) {
20822
+ stack || (stack = new Stack$2());
20823
+ if (isObject$3(srcValue)) {
20824
+ baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
20825
+ } else {
20826
+ var newValue = customizer ? customizer(safeGet(object, key), srcValue, key + "", object, source, stack) : void 0;
20827
+ if (newValue === void 0) {
20828
+ newValue = srcValue;
20829
+ }
20830
+ assignMergeValue(object, key, newValue);
20831
+ }
20832
+ }, keysIn);
20833
+ }
20717
20834
  function arrayEvery(array, predicate) {
20718
20835
  var index = -1, length = array == null ? 0 : array.length;
20719
20836
  while (++index < length) {
@@ -20744,6 +20861,10 @@ function isEqual$1(value, other) {
20744
20861
  function isMatch(object, source) {
20745
20862
  return object === source || baseIsMatch(object, source, getMatchData(source));
20746
20863
  }
20864
+ var merge = createAssigner(function(object, source, srcIndex) {
20865
+ baseMerge(object, source, srcIndex);
20866
+ });
20867
+ const merge$1 = merge;
20747
20868
  function baseSet(object, path, value, customizer) {
20748
20869
  if (!isObject$3(object)) {
20749
20870
  return object;
@@ -34999,8 +35120,10 @@ const ViewType$1 = {
34999
35120
  STATUS: "status",
35000
35121
  SCATTERPLOT: "scatterplot",
35001
35122
  SPATIAL: "spatial",
35123
+ SPATIAL_BETA: "spatialBeta",
35002
35124
  HEATMAP: "heatmap",
35003
35125
  LAYER_CONTROLLER: "layerController",
35126
+ LAYER_CONTROLLER_BETA: "layerControllerBeta",
35004
35127
  GENOMIC_PROFILES: "genomicProfiles",
35005
35128
  GATING: "gating",
35006
35129
  FEATURE_LIST: "featureList",
@@ -35012,20 +35135,24 @@ const ViewType$1 = {
35012
35135
  const DataType$1 = {
35013
35136
  OBS_LABELS: "obsLabels",
35014
35137
  OBS_EMBEDDING: "obsEmbedding",
35015
- OBS_LOCATIONS: "obsLocations",
35016
35138
  OBS_FEATURE_MATRIX: "obsFeatureMatrix",
35017
35139
  OBS_SETS: "obsSets",
35018
35140
  FEATURE_LABELS: "featureLabels",
35019
35141
  IMAGE: "image",
35020
35142
  OBS_SEGMENTATIONS: "obsSegmentations",
35021
35143
  NEIGHBORHOODS: "neighborhoods",
35022
- GENOMIC_PROFILES: "genomic-profiles"
35144
+ GENOMIC_PROFILES: "genomic-profiles",
35145
+ OBS_SPOTS: "obsSpots",
35146
+ OBS_POINTS: "obsPoints",
35147
+ OBS_LOCATIONS: "obsLocations"
35023
35148
  };
35024
35149
  const FileType$1 = {
35025
35150
  // Joint file types
35026
35151
  ANNDATA_ZARR: "anndata.zarr",
35027
35152
  // Atomic file types
35028
35153
  OBS_EMBEDDING_CSV: "obsEmbedding.csv",
35154
+ OBS_SPOTS_CSV: "obsSpots.csv",
35155
+ OBS_POINTS_CSV: "obsPoints.csv",
35029
35156
  OBS_LOCATIONS_CSV: "obsLocations.csv",
35030
35157
  OBS_LABELS_CSV: "obsLabels.csv",
35031
35158
  FEATURE_LABELS_CSV: "featureLabels.csv",
@@ -35038,6 +35165,8 @@ const FileType$1 = {
35038
35165
  OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
35039
35166
  OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
35040
35167
  OBS_EMBEDDING_ANNDATA_ZARR: "obsEmbedding.anndata.zarr",
35168
+ OBS_SPOTS_ANNDATA_ZARR: "obsSpots.anndata.zarr",
35169
+ OBS_POINTS_ANNDATA_ZARR: "obsPoints.anndata.zarr",
35041
35170
  OBS_LOCATIONS_ANNDATA_ZARR: "obsLocations.anndata.zarr",
35042
35171
  OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
35043
35172
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
@@ -35046,6 +35175,8 @@ const FileType$1 = {
35046
35175
  OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
35047
35176
  OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
35048
35177
  OBS_EMBEDDING_MUDATA_ZARR: "obsEmbedding.mudata.zarr",
35178
+ OBS_SPOTS_MUDATA_ZARR: "obsSpots.mudata.zarr",
35179
+ OBS_POINTS_MUDATA_ZARR: "obsPoints.mudata.zarr",
35049
35180
  OBS_LOCATIONS_MUDATA_ZARR: "obsLocations.mudata.zarr",
35050
35181
  OBS_SEGMENTATIONS_MUDATA_ZARR: "obsSegmentations.mudata.zarr",
35051
35182
  OBS_LABELS_MUDATA_ZARR: "obsLabels.mudata.zarr",
@@ -35089,10 +35220,8 @@ const FileType$1 = {
35089
35220
  ANNDATA_EXPRESSION_MATRIX_ZARR: "anndata-expression-matrix.zarr"
35090
35221
  };
35091
35222
  const CoordinationType$1 = {
35092
- // Meta coordination scopes
35093
35223
  META_COORDINATION_SCOPES: "metaCoordinationScopes",
35094
35224
  META_COORDINATION_SCOPES_BY: "metaCoordinationScopesBy",
35095
- // Other coordination scopes
35096
35225
  DATASET: "dataset",
35097
35226
  // Entity types
35098
35227
  OBS_TYPE: "obsType",
@@ -35118,6 +35247,7 @@ const CoordinationType$1 = {
35118
35247
  SPATIAL_TARGET_X: "spatialTargetX",
35119
35248
  SPATIAL_TARGET_Y: "spatialTargetY",
35120
35249
  SPATIAL_TARGET_Z: "spatialTargetZ",
35250
+ SPATIAL_TARGET_T: "spatialTargetT",
35121
35251
  SPATIAL_ROTATION_X: "spatialRotationX",
35122
35252
  SPATIAL_ROTATION_Y: "spatialRotationY",
35123
35253
  SPATIAL_ROTATION_Z: "spatialRotationZ",
@@ -35155,7 +35285,46 @@ const CoordinationType$1 = {
35155
35285
  GATING_FEATURE_SELECTION_X: "gatingFeatureSelectionX",
35156
35286
  GATING_FEATURE_SELECTION_Y: "gatingFeatureSelectionY",
35157
35287
  FEATURE_VALUE_TRANSFORM_COEFFICIENT: "featureValueTransformCoefficient",
35158
- TOOLTIPS_VISIBLE: "tooltipsVisible"
35288
+ TOOLTIPS_VISIBLE: "tooltipsVisible",
35289
+ FILE_UID: "fileUid",
35290
+ IMAGE_LAYER: "imageLayer",
35291
+ IMAGE_CHANNEL: "imageChannel",
35292
+ SEGMENTATION_LAYER: "segmentationLayer",
35293
+ SEGMENTATION_CHANNEL: "segmentationChannel",
35294
+ SPATIAL_TARGET_C: "spatialTargetC",
35295
+ SPATIAL_LAYER_VISIBLE: "spatialLayerVisible",
35296
+ SPATIAL_LAYER_OPACITY: "spatialLayerOpacity",
35297
+ SPATIAL_LAYER_COLORMAP: "spatialLayerColormap",
35298
+ SPATIAL_LAYER_TRANSPARENT_COLOR: "spatialLayerTransparentColor",
35299
+ SPATIAL_LAYER_MODEL_MATRIX: "spatialLayerModelMatrix",
35300
+ SPATIAL_SEGMENTATION_FILLED: "spatialSegmentationFilled",
35301
+ SPATIAL_SEGMENTATION_STROKE_WIDTH: "spatialSegmentationStrokeWidth",
35302
+ SPATIAL_CHANNEL_COLOR: "spatialChannelColor",
35303
+ SPATIAL_CHANNEL_VISIBLE: "spatialChannelVisible",
35304
+ SPATIAL_CHANNEL_OPACITY: "spatialChannelOpacity",
35305
+ SPATIAL_CHANNEL_WINDOW: "spatialChannelWindow",
35306
+ PHOTOMETRIC_INTERPRETATION: "photometricInterpretation",
35307
+ // For 3D volume rendering
35308
+ SPATIAL_RENDERING_MODE: "spatialRenderingMode",
35309
+ VOLUMETRIC_RENDERING_ALGORITHM: "volumetricRenderingAlgorithm",
35310
+ SPATIAL_TARGET_RESOLUTION: "spatialTargetResolution",
35311
+ // For clipping plane sliders
35312
+ SPATIAL_SLICE_X: "spatialSliceX",
35313
+ SPATIAL_SLICE_Y: "spatialSliceY",
35314
+ SPATIAL_SLICE_Z: "spatialSliceZ",
35315
+ // For spatial spot and point layers
35316
+ SPOT_LAYER: "spotLayer",
35317
+ POINT_LAYER: "pointLayer",
35318
+ SPATIAL_SPOT_RADIUS: "spatialSpotRadius",
35319
+ SPATIAL_SPOT_FILLED: "spatialSpotFilled",
35320
+ SPATIAL_SPOT_STROKE_WIDTH: "spatialSpotStrokeWidth",
35321
+ SPATIAL_LAYER_COLOR: "spatialLayerColor",
35322
+ PIXEL_HIGHLIGHT: "pixelHighlight",
35323
+ TOOLTIP_CROSSHAIRS_VISIBLE: "tooltipCrosshairsVisible",
35324
+ LEGEND_VISIBLE: "legendVisible",
35325
+ SPATIAL_CHANNEL_LABELS_VISIBLE: "spatialChannelLabelsVisible",
35326
+ SPATIAL_CHANNEL_LABELS_ORIENTATION: "spatialChannelLabelsOrientation",
35327
+ SPATIAL_CHANNEL_LABEL_SIZE: "spatialChannelLabelSize"
35159
35328
  };
35160
35329
  const STATUS = {
35161
35330
  LOADING: "loading",
@@ -35170,6 +35339,12 @@ const DATA_TYPE_COORDINATION_VALUE_USAGE = {
35170
35339
  CoordinationType$1.OBS_TYPE,
35171
35340
  CoordinationType$1.EMBEDDING_TYPE
35172
35341
  ],
35342
+ [DataType$1.OBS_SPOTS]: [
35343
+ CoordinationType$1.OBS_TYPE
35344
+ ],
35345
+ [DataType$1.OBS_POINTS]: [
35346
+ CoordinationType$1.OBS_TYPE
35347
+ ],
35173
35348
  [DataType$1.OBS_LOCATIONS]: [
35174
35349
  CoordinationType$1.OBS_TYPE
35175
35350
  ],
@@ -35208,10 +35383,10 @@ const AUTO_INDEPENDENT_COORDINATION_TYPES = [
35208
35383
  CoordinationType$1.EMBEDDING_OBS_OPACITY
35209
35384
  ];
35210
35385
  const note = "This file is autogenerated by .changeset/post-changelog.mjs.";
35211
- const version = "3.1.3";
35212
- const date = "2023-09-05";
35386
+ const version = "3.2.0";
35387
+ const date = "2023-09-12";
35213
35388
  const branch = "changeset-release/main";
35214
- const hash = "daf84518";
35389
+ const hash = "13836ae8";
35215
35390
  const META_VERSION = {
35216
35391
  note,
35217
35392
  version,
@@ -35543,6 +35718,8 @@ const annDataObsSets = z.array(z.object({
35543
35718
  ]),
35544
35719
  scorePath: z.string().optional().describe("The location in the AnnData store for the set confidence scores, like 'obs/celltype_prediction_score.'")
35545
35720
  }));
35721
+ const annDataObsSpots = annDataObsm;
35722
+ const annDataObsPoints = annDataObsm;
35546
35723
  const annDataObsLocations = annDataObsm;
35547
35724
  const annDataObsEmbedding = annDataObsm;
35548
35725
  const annDataObsSegmentations = annDataObs;
@@ -35569,10 +35746,21 @@ z.object({
35569
35746
  z.object({
35570
35747
  obsIndex: z.string(),
35571
35748
  obsEmbedding: z.array(z.string()).length(2)
35749
+ // TODO: support 3D?
35750
+ });
35751
+ z.object({
35752
+ obsIndex: z.string(),
35753
+ obsSpots: z.array(z.string()).length(2)
35754
+ // TODO: support 3D?
35755
+ });
35756
+ z.object({
35757
+ obsIndex: z.string(),
35758
+ obsPoints: z.array(z.string()).length(3)
35572
35759
  });
35573
35760
  z.object({
35574
35761
  obsIndex: z.string(),
35575
35762
  obsLocations: z.array(z.string()).length(2)
35763
+ // TODO: support 3D?
35576
35764
  });
35577
35765
  z.object({
35578
35766
  obsIndex: z.string(),
@@ -35604,6 +35792,8 @@ z.object({
35604
35792
  ]),
35605
35793
  obsFeatureMatrix: annDataObsFeatureMatrix,
35606
35794
  obsSets: annDataObsSets,
35795
+ obsSpots: annDataObsSpots,
35796
+ obsPoints: annDataObsPoints,
35607
35797
  obsLocations: annDataObsLocations,
35608
35798
  obsSegmentations: annDataObsSegmentations,
35609
35799
  obsEmbedding: z.union([
@@ -35957,6 +36147,219 @@ function shallow(objA, objB) {
35957
36147
  }
35958
36148
  return true;
35959
36149
  }
36150
+ function getMetaScope(coordinationScopes, coordinationSpace, parameter) {
36151
+ let latestMetaScope;
36152
+ if (coordinationSpace) {
36153
+ const metaScopes = coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES];
36154
+ const metaSpace = coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES];
36155
+ if (metaScopes && metaSpace) {
36156
+ const metaScopesArr = Array.isArray(metaScopes) ? metaScopes : [metaScopes];
36157
+ metaScopesArr.forEach((metaScope) => {
36158
+ if (metaSpace[metaScope][parameter]) {
36159
+ latestMetaScope = metaScope;
36160
+ }
36161
+ });
36162
+ }
36163
+ }
36164
+ return latestMetaScope;
36165
+ }
36166
+ function getMetaScopeBy(coordinationScopes, coordinationSpace, byParameter, parameter, byScope) {
36167
+ let latestMetaScope;
36168
+ if (coordinationSpace) {
36169
+ const metaScopesBy = coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES_BY];
36170
+ const metaSpaceBy = coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES_BY];
36171
+ if (metaSpaceBy && metaScopesBy) {
36172
+ const metaScopesArr = Array.isArray(metaScopesBy) ? metaScopesBy : [metaScopesBy];
36173
+ metaScopesArr.forEach((metaScope) => {
36174
+ var _a, _b, _c;
36175
+ if ((_c = (_b = (_a = metaSpaceBy[metaScope]) == null ? void 0 : _a[byParameter]) == null ? void 0 : _b[parameter]) == null ? void 0 : _c[byScope]) {
36176
+ latestMetaScope = metaScope;
36177
+ }
36178
+ });
36179
+ }
36180
+ }
36181
+ return latestMetaScope;
36182
+ }
36183
+ function removeImageChannelInMetaCoordinationScopesHelper(coordinationScopesRaw, layerScope, channelScope, coordinationSpace) {
36184
+ var _a, _b, _c, _d, _e, _f, _g;
36185
+ const metaCoordinationScopes = coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES];
36186
+ const metaCoordinationScopesBy = coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES_BY];
36187
+ let newMetaCoordinationScopes = metaCoordinationScopes;
36188
+ let newMetaCoordinationScopesBy = metaCoordinationScopesBy;
36189
+ const channelMetaScopeBy = getMetaScopeBy(
36190
+ coordinationScopesRaw,
36191
+ coordinationSpace,
36192
+ CoordinationType$1.IMAGE_LAYER,
36193
+ CoordinationType$1.IMAGE_CHANNEL,
36194
+ layerScope
36195
+ );
36196
+ const channelMetaScope = getMetaScope(coordinationScopesRaw, coordinationSpace, CoordinationType$1.IMAGE_CHANNEL);
36197
+ const hasPerLayerChannels = !!channelMetaScopeBy;
36198
+ const prevChannels = hasPerLayerChannels ? (_c = (_b = (_a = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _a[CoordinationType$1.IMAGE_LAYER]) == null ? void 0 : _b[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _c[layerScope] : (_d = metaCoordinationScopes == null ? void 0 : metaCoordinationScopes[channelMetaScope]) == null ? void 0 : _d[CoordinationType$1.IMAGE_CHANNEL];
36199
+ const nextChannels = prevChannels.filter((channel) => channel !== channelScope);
36200
+ if (hasPerLayerChannels) {
36201
+ newMetaCoordinationScopesBy = {
36202
+ ...metaCoordinationScopesBy,
36203
+ [channelMetaScopeBy]: {
36204
+ ...metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy],
36205
+ [CoordinationType$1.IMAGE_LAYER]: {
36206
+ ...(_e = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _e[CoordinationType$1.IMAGE_LAYER],
36207
+ [CoordinationType$1.IMAGE_CHANNEL]: {
36208
+ ...(_g = (_f = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _f[CoordinationType$1.IMAGE_LAYER]) == null ? void 0 : _g[CoordinationType$1.IMAGE_CHANNEL],
36209
+ [layerScope]: nextChannels
36210
+ }
36211
+ }
36212
+ }
36213
+ };
36214
+ } else {
36215
+ newMetaCoordinationScopes = {
36216
+ ...metaCoordinationScopes,
36217
+ [channelMetaScope]: {
36218
+ ...metaCoordinationScopes == null ? void 0 : metaCoordinationScopes[channelMetaScope],
36219
+ [CoordinationType$1.IMAGE_CHANNEL]: nextChannels
36220
+ }
36221
+ };
36222
+ }
36223
+ return {
36224
+ ...coordinationSpace,
36225
+ [CoordinationType$1.META_COORDINATION_SCOPES]: newMetaCoordinationScopes,
36226
+ [CoordinationType$1.META_COORDINATION_SCOPES_BY]: newMetaCoordinationScopesBy
36227
+ };
36228
+ }
36229
+ function addImageChannelInMetaCoordinationScopesHelper(coordinationScopesRaw, layerScope, coordinationSpace) {
36230
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C;
36231
+ const metaCoordinationScopes = coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES];
36232
+ const metaCoordinationScopesBy = coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES_BY];
36233
+ let newMetaCoordinationScopes = metaCoordinationScopes;
36234
+ let newMetaCoordinationScopesBy = metaCoordinationScopesBy;
36235
+ const channelMetaScopeBy = getMetaScopeBy(
36236
+ coordinationScopesRaw,
36237
+ coordinationSpace,
36238
+ CoordinationType$1.IMAGE_LAYER,
36239
+ CoordinationType$1.IMAGE_CHANNEL,
36240
+ layerScope
36241
+ );
36242
+ const channelMetaScope = getMetaScope(coordinationScopesRaw, coordinationSpace, CoordinationType$1.IMAGE_CHANNEL);
36243
+ const hasPerLayerChannels = !!channelMetaScopeBy;
36244
+ const prevChannels = hasPerLayerChannels ? (_c = (_b = (_a = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _a[CoordinationType$1.IMAGE_LAYER]) == null ? void 0 : _b[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _c[layerScope] : (_d = metaCoordinationScopes == null ? void 0 : metaCoordinationScopes[channelMetaScope]) == null ? void 0 : _d[CoordinationType$1.IMAGE_CHANNEL];
36245
+ const allPrevChannelScopes = Object.keys(coordinationSpace[CoordinationType$1.IMAGE_CHANNEL] || {});
36246
+ const nextChannelScope = getNextScope(allPrevChannelScopes);
36247
+ const nextChannels = [...prevChannels, nextChannelScope];
36248
+ let newCoordinationSpace = coordinationSpace;
36249
+ const nextTargetCScope = getNextScope(Object.keys(coordinationSpace[CoordinationType$1.SPATIAL_TARGET_C] || {}));
36250
+ const nextColorScope = getNextScope(Object.keys(coordinationSpace[CoordinationType$1.SPATIAL_CHANNEL_COLOR] || {}));
36251
+ const nextWindowScope = getNextScope(Object.keys(coordinationSpace[CoordinationType$1.SPATIAL_CHANNEL_WINDOW] || {}));
36252
+ const nextVisibleScope = getNextScope(Object.keys(coordinationSpace[CoordinationType$1.SPATIAL_CHANNEL_VISIBLE] || {}));
36253
+ const nextOpacityScope = getNextScope(Object.keys(coordinationSpace[CoordinationType$1.SPATIAL_CHANNEL_OPACITY] || {}));
36254
+ newCoordinationSpace = {
36255
+ ...coordinationSpace,
36256
+ [CoordinationType$1.IMAGE_CHANNEL]: {
36257
+ ...coordinationSpace[CoordinationType$1.IMAGE_CHANNEL],
36258
+ [nextChannelScope]: "__dummy__"
36259
+ },
36260
+ [CoordinationType$1.SPATIAL_TARGET_C]: {
36261
+ ...coordinationSpace[CoordinationType$1.SPATIAL_TARGET_C],
36262
+ [nextTargetCScope]: 0
36263
+ // TODO: Use the default values for each coordination type.
36264
+ },
36265
+ [CoordinationType$1.SPATIAL_CHANNEL_COLOR]: {
36266
+ ...coordinationSpace[CoordinationType$1.SPATIAL_CHANNEL_COLOR],
36267
+ [nextColorScope]: [255, 255, 255]
36268
+ },
36269
+ [CoordinationType$1.SPATIAL_CHANNEL_WINDOW]: {
36270
+ ...coordinationSpace[CoordinationType$1.SPATIAL_CHANNEL_WINDOW],
36271
+ [nextWindowScope]: [0, 255]
36272
+ },
36273
+ [CoordinationType$1.SPATIAL_CHANNEL_VISIBLE]: {
36274
+ ...coordinationSpace[CoordinationType$1.SPATIAL_CHANNEL_VISIBLE],
36275
+ [nextVisibleScope]: true
36276
+ },
36277
+ [CoordinationType$1.SPATIAL_CHANNEL_OPACITY]: {
36278
+ ...coordinationSpace[CoordinationType$1.SPATIAL_CHANNEL_OPACITY],
36279
+ [nextOpacityScope]: 1
36280
+ }
36281
+ };
36282
+ if (hasPerLayerChannels) {
36283
+ newMetaCoordinationScopesBy = {
36284
+ ...metaCoordinationScopesBy,
36285
+ [channelMetaScopeBy]: {
36286
+ ...metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy],
36287
+ [CoordinationType$1.IMAGE_LAYER]: {
36288
+ ...(_e = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _e[CoordinationType$1.IMAGE_LAYER],
36289
+ [CoordinationType$1.IMAGE_CHANNEL]: {
36290
+ ...(_g = (_f = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _f[CoordinationType$1.IMAGE_LAYER]) == null ? void 0 : _g[CoordinationType$1.IMAGE_CHANNEL],
36291
+ [layerScope]: nextChannels
36292
+ }
36293
+ },
36294
+ [CoordinationType$1.IMAGE_CHANNEL]: {
36295
+ ...(_h = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _h[CoordinationType$1.IMAGE_CHANNEL],
36296
+ [CoordinationType$1.SPATIAL_TARGET_C]: {
36297
+ ...(_j = (_i = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _i[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _j[CoordinationType$1.SPATIAL_TARGET_C],
36298
+ [nextChannelScope]: nextTargetCScope
36299
+ },
36300
+ [CoordinationType$1.SPATIAL_CHANNEL_COLOR]: {
36301
+ ...(_l = (_k = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _k[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _l[CoordinationType$1.SPATIAL_CHANNEL_COLOR],
36302
+ [nextChannelScope]: nextColorScope
36303
+ },
36304
+ [CoordinationType$1.SPATIAL_CHANNEL_WINDOW]: {
36305
+ ...(_n = (_m = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _m[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _n[CoordinationType$1.SPATIAL_CHANNEL_WINDOW],
36306
+ [nextChannelScope]: nextWindowScope
36307
+ },
36308
+ [CoordinationType$1.SPATIAL_CHANNEL_VISIBLE]: {
36309
+ ...(_p = (_o = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _o[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _p[CoordinationType$1.SPATIAL_CHANNEL_VISIBLE],
36310
+ [nextChannelScope]: nextVisibleScope
36311
+ },
36312
+ [CoordinationType$1.SPATIAL_CHANNEL_OPACITY]: {
36313
+ ...(_r = (_q = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScopeBy]) == null ? void 0 : _q[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _r[CoordinationType$1.SPATIAL_CHANNEL_OPACITY],
36314
+ [nextChannelScope]: nextOpacityScope
36315
+ }
36316
+ }
36317
+ }
36318
+ };
36319
+ } else {
36320
+ newMetaCoordinationScopes = {
36321
+ ...metaCoordinationScopes,
36322
+ [channelMetaScope]: {
36323
+ ...metaCoordinationScopes == null ? void 0 : metaCoordinationScopes[channelMetaScope],
36324
+ [CoordinationType$1.IMAGE_CHANNEL]: nextChannels
36325
+ }
36326
+ };
36327
+ newMetaCoordinationScopesBy = {
36328
+ ...metaCoordinationScopesBy,
36329
+ [channelMetaScope]: {
36330
+ ...metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScope],
36331
+ [CoordinationType$1.IMAGE_CHANNEL]: {
36332
+ ...(_s = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScope]) == null ? void 0 : _s[CoordinationType$1.IMAGE_CHANNEL],
36333
+ [CoordinationType$1.SPATIAL_TARGET_C]: {
36334
+ ...(_u = (_t = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScope]) == null ? void 0 : _t[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _u[CoordinationType$1.SPATIAL_TARGET_C],
36335
+ [nextChannelScope]: nextTargetCScope
36336
+ },
36337
+ [CoordinationType$1.SPATIAL_CHANNEL_COLOR]: {
36338
+ ...(_w = (_v = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScope]) == null ? void 0 : _v[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _w[CoordinationType$1.SPATIAL_CHANNEL_COLOR],
36339
+ [nextChannelScope]: nextColorScope
36340
+ },
36341
+ [CoordinationType$1.SPATIAL_CHANNEL_WINDOW]: {
36342
+ ...(_y = (_x = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScope]) == null ? void 0 : _x[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _y[CoordinationType$1.SPATIAL_CHANNEL_WINDOW],
36343
+ [nextChannelScope]: nextWindowScope
36344
+ },
36345
+ [CoordinationType$1.SPATIAL_CHANNEL_VISIBLE]: {
36346
+ ...(_A = (_z = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScope]) == null ? void 0 : _z[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _A[CoordinationType$1.SPATIAL_CHANNEL_VISIBLE],
36347
+ [nextChannelScope]: nextVisibleScope
36348
+ },
36349
+ [CoordinationType$1.SPATIAL_CHANNEL_OPACITY]: {
36350
+ ...(_C = (_B = metaCoordinationScopesBy == null ? void 0 : metaCoordinationScopesBy[channelMetaScope]) == null ? void 0 : _B[CoordinationType$1.IMAGE_CHANNEL]) == null ? void 0 : _C[CoordinationType$1.SPATIAL_CHANNEL_OPACITY],
36351
+ [nextChannelScope]: nextOpacityScope
36352
+ }
36353
+ }
36354
+ }
36355
+ };
36356
+ }
36357
+ return {
36358
+ ...newCoordinationSpace,
36359
+ [CoordinationType$1.META_COORDINATION_SCOPES]: newMetaCoordinationScopes,
36360
+ [CoordinationType$1.META_COORDINATION_SCOPES_BY]: newMetaCoordinationScopesBy
36361
+ };
36362
+ }
35960
36363
  const {
35961
36364
  Provider: ViewConfigProviderLocal,
35962
36365
  useStore: useViewConfigStoreLocal,
@@ -35971,6 +36374,44 @@ const {
35971
36374
  } = createContext();
35972
36375
  const AuxiliaryProvider = AuxiliaryProviderLocal;
35973
36376
  const useAuxiliaryStore = useAuxiliaryStoreLocal;
36377
+ function getScopes(coordinationScopes, metaSpace) {
36378
+ let result = { ...coordinationScopes };
36379
+ if (metaSpace) {
36380
+ const metaScopes = coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES];
36381
+ if (metaScopes && metaSpace) {
36382
+ const metaScopesArr = Array.isArray(metaScopes) ? metaScopes : [metaScopes];
36383
+ metaScopesArr.forEach((metaScope) => {
36384
+ result = merge$1(result, metaSpace[metaScope]);
36385
+ });
36386
+ }
36387
+ }
36388
+ return result;
36389
+ }
36390
+ function getScopesBy(coordinationScopes, coordinationScopesBy, metaSpaceBy) {
36391
+ let result = { ...coordinationScopesBy };
36392
+ if (metaSpaceBy) {
36393
+ const metaScopesBy = coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES_BY];
36394
+ if (metaSpaceBy && metaScopesBy) {
36395
+ const metaScopesArr = Array.isArray(metaScopesBy) ? metaScopesBy : [metaScopesBy];
36396
+ metaScopesArr.forEach((metaScope) => {
36397
+ result = merge$1(result, metaSpaceBy[metaScope]);
36398
+ });
36399
+ }
36400
+ }
36401
+ return result;
36402
+ }
36403
+ function getParameterScope(parameter, coordinationScopes) {
36404
+ return coordinationScopes[parameter];
36405
+ }
36406
+ function getParameterScopeBy(parameter, byType, typeScope, coordinationScopes, coordinationScopesBy) {
36407
+ var _a;
36408
+ const parameterScopeGlobal = coordinationScopes[parameter];
36409
+ const parameterScopeByType = (_a = coordinationScopesBy == null ? void 0 : coordinationScopesBy[byType]) == null ? void 0 : _a[parameter];
36410
+ if (parameterScopeByType && parameterScopeByType[typeScope]) {
36411
+ return parameterScopeByType[typeScope];
36412
+ }
36413
+ return parameterScopeGlobal;
36414
+ }
35974
36415
  const createViewConfigStore = (initialLoaders, initialConfig) => create2((set2) => ({
35975
36416
  // State:
35976
36417
  // The viewConfig is an object which must conform to the schema
@@ -35985,18 +36426,70 @@ const createViewConfigStore = (initialLoaders, initialConfig) => create2((set2)
35985
36426
  // (although technically also part of state):
35986
36427
  setViewConfig: (viewConfig) => set2({ viewConfig, initialViewConfig: viewConfig }),
35987
36428
  setLoaders: (loaders) => set2({ loaders }),
35988
- setCoordinationValue: ({ parameter, scope, value }) => set2((state) => ({
35989
- viewConfig: {
35990
- ...state.viewConfig,
35991
- coordinationSpace: {
35992
- ...state.viewConfig.coordinationSpace,
35993
- [parameter]: {
35994
- ...state.viewConfig.coordinationSpace[parameter],
35995
- [scope]: value
35996
- }
36429
+ setCoordinationValue: ({
36430
+ parameter,
36431
+ value,
36432
+ coordinationScopes,
36433
+ byType,
36434
+ typeScope,
36435
+ coordinationScopesBy
36436
+ }) => set2((state) => {
36437
+ const { coordinationSpace } = state.viewConfig;
36438
+ let scope;
36439
+ if (!byType) {
36440
+ scope = getParameterScope(parameter, coordinationScopes);
36441
+ } else {
36442
+ scope = getParameterScopeBy(
36443
+ parameter,
36444
+ byType,
36445
+ typeScope,
36446
+ coordinationScopes,
36447
+ coordinationScopesBy
36448
+ );
36449
+ if (!scope) {
36450
+ scope = getParameterScope(parameter, coordinationScopes);
35997
36451
  }
35998
36452
  }
35999
- })),
36453
+ return {
36454
+ viewConfig: {
36455
+ ...state.viewConfig,
36456
+ coordinationSpace: {
36457
+ ...coordinationSpace,
36458
+ [parameter]: {
36459
+ ...coordinationSpace[parameter],
36460
+ [scope]: value
36461
+ }
36462
+ }
36463
+ }
36464
+ };
36465
+ }),
36466
+ removeImageChannelInMetaCoordinationScopes: (coordinationScopesRaw, layerScope, channelScope) => set2((state) => {
36467
+ const { coordinationSpace } = state.viewConfig;
36468
+ return {
36469
+ viewConfig: {
36470
+ ...state.viewConfig,
36471
+ coordinationSpace: removeImageChannelInMetaCoordinationScopesHelper(
36472
+ coordinationScopesRaw,
36473
+ layerScope,
36474
+ channelScope,
36475
+ coordinationSpace
36476
+ )
36477
+ }
36478
+ };
36479
+ }),
36480
+ addImageChannelInMetaCoordinationScopes: (coordinationScopesRaw, layerScope) => set2((state) => {
36481
+ const { coordinationSpace } = state.viewConfig;
36482
+ return {
36483
+ viewConfig: {
36484
+ ...state.viewConfig,
36485
+ coordinationSpace: addImageChannelInMetaCoordinationScopesHelper(
36486
+ coordinationScopesRaw,
36487
+ layerScope,
36488
+ coordinationSpace
36489
+ )
36490
+ }
36491
+ };
36492
+ }),
36000
36493
  removeComponent: (uid) => set2((state) => {
36001
36494
  const newLayout = state.viewConfig.layout.filter((c) => c.uid !== uid);
36002
36495
  return {
@@ -36084,9 +36577,12 @@ function useCoordination(parameters, coordinationScopes) {
36084
36577
  const values2 = useViewConfigStore((state) => {
36085
36578
  const { coordinationSpace } = state.viewConfig;
36086
36579
  return fromEntries(parameters.map((parameter) => {
36087
- if (coordinationSpace && coordinationSpace[parameter]) {
36088
- const value = coordinationSpace[parameter][coordinationScopes[parameter]];
36089
- return [parameter, value];
36580
+ if (coordinationSpace) {
36581
+ const parameterScope = getParameterScope(parameter, coordinationScopes);
36582
+ if (coordinationSpace && coordinationSpace[parameter]) {
36583
+ const value = coordinationSpace[parameter][parameterScope];
36584
+ return [parameter, value];
36585
+ }
36090
36586
  }
36091
36587
  return [parameter, void 0];
36092
36588
  }));
@@ -36095,15 +36591,121 @@ function useCoordination(parameters, coordinationScopes) {
36095
36591
  const setterName = `set${capitalize(parameter)}`;
36096
36592
  const setterFunc = (value) => setCoordinationValue({
36097
36593
  parameter,
36098
- scope: coordinationScopes[parameter],
36594
+ coordinationScopes,
36099
36595
  value
36100
36596
  });
36101
36597
  return [setterName, setterFunc];
36102
36598
  })), [parameters, coordinationScopes]);
36103
36599
  return [values2, setters];
36104
36600
  }
36601
+ function useMultiCoordinationScopes(parameter, coordinationScopes) {
36602
+ return useMemo(() => {
36603
+ const scopes = coordinationScopes[parameter];
36604
+ return Array.isArray(scopes) ? scopes : [scopes];
36605
+ }, [parameter, coordinationScopes]);
36606
+ }
36607
+ function useMultiCoordinationScopesNonNull(parameter, coordinationScopes) {
36608
+ const scopes = getParameterScope(parameter, coordinationScopes);
36609
+ const parameterSpace = useViewConfigStore((state) => {
36610
+ const { coordinationSpace } = state.viewConfig;
36611
+ return coordinationSpace == null ? void 0 : coordinationSpace[parameter];
36612
+ }, shallow);
36613
+ const nonNullScopes = useMemo(() => {
36614
+ const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
36615
+ return scopesArr.filter((scope) => {
36616
+ if (parameterSpace) {
36617
+ const value = parameterSpace[scope];
36618
+ return value !== null;
36619
+ }
36620
+ return false;
36621
+ });
36622
+ }, [parameter, coordinationScopes, scopes, parameterSpace]);
36623
+ return nonNullScopes;
36624
+ }
36625
+ function useMultiCoordinationScopesSecondary(parameter, byType, coordinationScopes, coordinationScopesBy) {
36626
+ return useMemo(() => {
36627
+ var _a, _b;
36628
+ const scopes = getParameterScope(byType, coordinationScopes);
36629
+ if (scopes && ((_a = coordinationScopesBy == null ? void 0 : coordinationScopesBy[byType]) == null ? void 0 : _a[parameter])) {
36630
+ const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
36631
+ return [scopesArr, fromEntries(scopesArr.map((scope) => {
36632
+ const secondaryScopes = coordinationScopesBy[byType][parameter][scope];
36633
+ const secondaryScopesArr = Array.isArray(secondaryScopes) ? secondaryScopes : [secondaryScopes];
36634
+ return [scope, secondaryScopesArr];
36635
+ }))];
36636
+ }
36637
+ if (scopes && !((_b = coordinationScopesBy == null ? void 0 : coordinationScopesBy[byType]) == null ? void 0 : _b[parameter]) && (coordinationScopes == null ? void 0 : coordinationScopes[parameter])) {
36638
+ const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
36639
+ return [scopesArr, fromEntries(scopesArr.map((scope) => {
36640
+ const secondaryScopes = coordinationScopes == null ? void 0 : coordinationScopes[parameter];
36641
+ const secondaryScopesArr = Array.isArray(secondaryScopes) ? secondaryScopes : [secondaryScopes];
36642
+ return [scope, secondaryScopesArr];
36643
+ }))];
36644
+ }
36645
+ return [[], {}];
36646
+ }, [parameter, byType, coordinationScopes, coordinationScopesBy]);
36647
+ }
36648
+ function useMultiCoordinationScopesSecondaryNonNull(parameter, byType, coordinationScopes, coordinationScopesBy) {
36649
+ const scopes = getParameterScope(byType, coordinationScopes);
36650
+ const parameterSpace = useViewConfigStore((state) => {
36651
+ const { coordinationSpace } = state.viewConfig;
36652
+ return coordinationSpace == null ? void 0 : coordinationSpace[parameter];
36653
+ }, shallow);
36654
+ const byTypeSpace = useViewConfigStore((state) => {
36655
+ const { coordinationSpace } = state.viewConfig;
36656
+ return coordinationSpace == null ? void 0 : coordinationSpace[byType];
36657
+ }, shallow);
36658
+ return useMemo(() => {
36659
+ var _a, _b;
36660
+ if (scopes && ((_a = coordinationScopesBy == null ? void 0 : coordinationScopesBy[byType]) == null ? void 0 : _a[parameter])) {
36661
+ const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
36662
+ const scopesNonNull = scopesArr.filter((scope) => {
36663
+ if (byTypeSpace) {
36664
+ const value = byTypeSpace[scope];
36665
+ return value !== null;
36666
+ }
36667
+ return false;
36668
+ });
36669
+ return [scopesNonNull, fromEntries(scopesNonNull.map((scope) => {
36670
+ const secondaryScopes = coordinationScopesBy[byType][parameter][scope];
36671
+ const secondaryScopesArr = Array.isArray(secondaryScopes) ? secondaryScopes : [secondaryScopes];
36672
+ const secondaryScopesNonNull = secondaryScopesArr.filter((innerScope) => {
36673
+ if (parameterSpace) {
36674
+ const value = parameterSpace[innerScope];
36675
+ return value !== null;
36676
+ }
36677
+ return false;
36678
+ });
36679
+ return [scope, secondaryScopesNonNull];
36680
+ }))];
36681
+ }
36682
+ if (scopes && !((_b = coordinationScopesBy == null ? void 0 : coordinationScopesBy[byType]) == null ? void 0 : _b[parameter]) && (coordinationScopes == null ? void 0 : coordinationScopes[parameter])) {
36683
+ const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
36684
+ const scopesNonNull = scopesArr.filter((scope) => {
36685
+ if (byTypeSpace) {
36686
+ const value = byTypeSpace[scope];
36687
+ return value !== null;
36688
+ }
36689
+ return false;
36690
+ });
36691
+ return [scopesNonNull, fromEntries(scopesNonNull.map((scope) => {
36692
+ const secondaryScopes = coordinationScopes == null ? void 0 : coordinationScopes[parameter];
36693
+ const secondaryScopesArr = Array.isArray(secondaryScopes) ? secondaryScopes : [secondaryScopes];
36694
+ const secondaryScopesNonNull = secondaryScopesArr.filter((innerScope) => {
36695
+ if (parameterSpace) {
36696
+ const value = parameterSpace[innerScope];
36697
+ return value !== null;
36698
+ }
36699
+ return false;
36700
+ });
36701
+ return [scope, secondaryScopesNonNull];
36702
+ }))];
36703
+ }
36704
+ return [[], {}];
36705
+ }, [parameter, byType, scopes, coordinationScopes, coordinationScopesBy, parameterSpace, byTypeSpace]);
36706
+ }
36105
36707
  function useMultiCoordinationValues(parameter, coordinationScopes) {
36106
- const scopes = coordinationScopes[parameter];
36708
+ const scopes = getParameterScope(parameter, coordinationScopes);
36107
36709
  const vals = useViewConfigStore((state) => {
36108
36710
  const { coordinationSpace } = state.viewConfig;
36109
36711
  const scopesArr = Array.isArray(scopes) ? scopes : [scopes];
@@ -36122,58 +36724,156 @@ function useDatasetUids(coordinationScopes) {
36122
36724
  }
36123
36725
  function useComplexCoordination(parameters, coordinationScopes, coordinationScopesBy, byType) {
36124
36726
  const setCoordinationValue = useViewConfigStore((state) => state.setCoordinationValue);
36125
- const typeScopes = coordinationScopes[byType];
36126
- const byTypeScopes = coordinationScopesBy[byType];
36127
- const typeScopesArr = Array.isArray(typeScopes) ? typeScopes : [typeScopes];
36128
- const values2 = useViewConfigStore((state) => {
36727
+ const parameterSpaces = useViewConfigStore((state) => {
36129
36728
  const { coordinationSpace } = state.viewConfig;
36130
- return fromEntries(typeScopesArr.map((datasetScope) => {
36131
- const datasetValues = fromEntries(parameters.map((parameter) => {
36132
- if (coordinationSpace && coordinationSpace[parameter]) {
36133
- let value;
36134
- const parameterSpace = coordinationSpace[parameter];
36135
- const parameterScopeGlobal = coordinationScopes[parameter];
36136
- const parameterScopeByDataset = byTypeScopes == null ? void 0 : byTypeScopes[parameter];
36137
- if (parameterScopeByDataset && parameterScopeByDataset[datasetScope]) {
36138
- value = parameterSpace[parameterScopeByDataset[datasetScope]];
36139
- } else if (parameterScopeGlobal) {
36140
- value = parameterSpace[parameterScopeGlobal];
36141
- } else {
36142
- console.error(`coordination scope for ${parameter} was not found.`);
36729
+ return parameters.map((parameter) => coordinationSpace[parameter]);
36730
+ }, shallow);
36731
+ const values2 = useMemo(() => {
36732
+ const typeScopes = getParameterScope(byType, coordinationScopes);
36733
+ if (typeScopes) {
36734
+ const typeScopesArr = Array.isArray(typeScopes) ? typeScopes : [typeScopes];
36735
+ return fromEntries(typeScopesArr.map((datasetScope) => {
36736
+ const datasetValues = fromEntries(parameters.map((parameter, i) => {
36737
+ if (parameterSpaces[i]) {
36738
+ const parameterSpace = parameterSpaces[i];
36739
+ const parameterScope = getParameterScopeBy(
36740
+ parameter,
36741
+ byType,
36742
+ datasetScope,
36743
+ coordinationScopes,
36744
+ coordinationScopesBy
36745
+ );
36746
+ if (parameterScope) {
36747
+ const value = parameterSpace[parameterScope];
36748
+ return [parameter, value];
36749
+ }
36750
+ const globalParameterScope = getParameterScope(parameter, coordinationScopes);
36751
+ const globalValue = parameterSpace[globalParameterScope];
36752
+ return [parameter, globalValue];
36143
36753
  }
36144
- return [parameter, value];
36145
- }
36146
- return [parameter, void 0];
36754
+ return [parameter, void 0];
36755
+ }));
36756
+ return [datasetScope, datasetValues];
36147
36757
  }));
36148
- return [datasetScope, datasetValues];
36149
- }));
36758
+ }
36759
+ return {};
36760
+ }, [byType, coordinationScopes, coordinationScopesBy, parameterSpaces]);
36761
+ const setters = useMemo(() => {
36762
+ const typeScopes = getParameterScope(byType, coordinationScopes);
36763
+ if (typeScopes) {
36764
+ const typeScopesArr = Array.isArray(typeScopes) ? typeScopes : [typeScopes];
36765
+ return fromEntries(typeScopesArr.map((datasetScope) => {
36766
+ const datasetSetters = fromEntries(parameters.map((parameter) => {
36767
+ const setterName = `set${capitalize(parameter)}`;
36768
+ const setterFunc = (value) => setCoordinationValue({
36769
+ parameter,
36770
+ byType,
36771
+ typeScope: datasetScope,
36772
+ coordinationScopes,
36773
+ coordinationScopesBy,
36774
+ value
36775
+ });
36776
+ return [setterName, setterFunc];
36777
+ }));
36778
+ return [datasetScope, datasetSetters];
36779
+ }));
36780
+ }
36781
+ return {};
36782
+ }, [coordinationScopes]);
36783
+ return [values2, setters];
36784
+ }
36785
+ function useCoordinationScopes(coordinationScopes) {
36786
+ const metaSpace = useViewConfigStore((state) => {
36787
+ const { coordinationSpace } = state.viewConfig;
36788
+ return coordinationSpace == null ? void 0 : coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES];
36150
36789
  }, shallow);
36151
- const setters = useMemo(() => fromEntries(typeScopesArr.map((datasetScope) => {
36152
- const datasetSetters = fromEntries(parameters.map((parameter) => {
36153
- const setterName = `set${capitalize(parameter)}`;
36154
- let setterFunc;
36155
- const parameterScopeGlobal = coordinationScopes[parameter];
36156
- const parameterScopeByDataset = byTypeScopes == null ? void 0 : byTypeScopes[parameter];
36157
- if (parameterScopeByDataset && parameterScopeByDataset[datasetScope]) {
36158
- setterFunc = (value) => setCoordinationValue({
36159
- parameter,
36160
- scope: parameterScopeByDataset[datasetScope],
36161
- value
36790
+ const vals = useMemo(() => {
36791
+ const scopes = getScopes(
36792
+ coordinationScopes,
36793
+ metaSpace
36794
+ );
36795
+ delete scopes[CoordinationType$1.META_COORDINATION_SCOPES];
36796
+ return scopes;
36797
+ }, [coordinationScopes, metaSpace]);
36798
+ return vals;
36799
+ }
36800
+ function useCoordinationScopesBy(coordinationScopes, coordinationScopesBy) {
36801
+ const metaSpaceBy = useViewConfigStore((state) => {
36802
+ const { coordinationSpace } = state.viewConfig;
36803
+ return coordinationSpace == null ? void 0 : coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES_BY];
36804
+ }, shallow);
36805
+ const vals = useMemo(() => {
36806
+ const scopesBy = getScopesBy(
36807
+ coordinationScopes,
36808
+ coordinationScopesBy,
36809
+ metaSpaceBy
36810
+ );
36811
+ return scopesBy;
36812
+ }, [coordinationScopes, coordinationScopesBy, metaSpaceBy]);
36813
+ return vals;
36814
+ }
36815
+ function useComplexCoordinationSecondary(parameters, coordinationScopes, coordinationScopesBy, primaryType, secondaryType) {
36816
+ const coordinationScopesFake = useMemo(() => {
36817
+ var _a;
36818
+ if ((_a = coordinationScopesBy == null ? void 0 : coordinationScopesBy[primaryType]) == null ? void 0 : _a[secondaryType]) {
36819
+ return {
36820
+ ...coordinationScopes,
36821
+ // TODO: this is needed for falling back to view-level coordination scopes, but does it affect performance?
36822
+ [secondaryType]: Object.values(coordinationScopesBy[primaryType][secondaryType]).flat()
36823
+ };
36824
+ }
36825
+ if ((coordinationScopes == null ? void 0 : coordinationScopes[secondaryType]) && Array.isArray(coordinationScopes[secondaryType])) {
36826
+ return {
36827
+ ...coordinationScopes,
36828
+ // TODO: this is needed for falling back to view-level coordination scopes, but does it affect performance?
36829
+ [secondaryType]: coordinationScopes[secondaryType]
36830
+ };
36831
+ }
36832
+ return { [secondaryType]: [] };
36833
+ }, [coordinationScopesBy, primaryType, secondaryType]);
36834
+ const [flatValues, flatSetters] = useComplexCoordination(
36835
+ parameters,
36836
+ coordinationScopesFake,
36837
+ coordinationScopesBy,
36838
+ secondaryType
36839
+ );
36840
+ const nestedValues = useMemo(() => {
36841
+ var _a;
36842
+ const result = {};
36843
+ if ((_a = coordinationScopesBy == null ? void 0 : coordinationScopesBy[primaryType]) == null ? void 0 : _a[secondaryType]) {
36844
+ Object.entries(coordinationScopesBy[primaryType][secondaryType]).forEach(([layerScope, channelScopes]) => {
36845
+ result[layerScope] = {};
36846
+ channelScopes.forEach((channelScope) => {
36847
+ result[layerScope][channelScope] = flatValues[channelScope];
36162
36848
  });
36163
- } else if (parameterScopeGlobal) {
36164
- setterFunc = (value) => setCoordinationValue({
36165
- parameter,
36166
- scope: parameterScopeGlobal,
36167
- value
36849
+ });
36850
+ } else if ((coordinationScopes == null ? void 0 : coordinationScopes[secondaryType]) && Array.isArray(coordinationScopes[secondaryType])) {
36851
+ const layerScopes = coordinationScopes[primaryType];
36852
+ layerScopes.forEach((layerScope) => {
36853
+ result[layerScope] = flatValues;
36854
+ });
36855
+ }
36856
+ return result;
36857
+ }, [flatValues]);
36858
+ const nestedSetters = useMemo(() => {
36859
+ var _a;
36860
+ const result = {};
36861
+ if ((_a = coordinationScopesBy == null ? void 0 : coordinationScopesBy[primaryType]) == null ? void 0 : _a[secondaryType]) {
36862
+ Object.entries(coordinationScopesBy[primaryType][secondaryType]).forEach(([layerScope, channelScopes]) => {
36863
+ result[layerScope] = {};
36864
+ channelScopes.forEach((channelScope) => {
36865
+ result[layerScope][channelScope] = flatSetters[channelScope];
36168
36866
  });
36169
- } else {
36170
- console.error(`coordination scope for ${parameter} was not found.`);
36171
- }
36172
- return [setterName, setterFunc];
36173
- }));
36174
- return [datasetScope, datasetSetters];
36175
- })), [parameters, coordinationScopes]);
36176
- return [values2, setters];
36867
+ });
36868
+ } else if ((coordinationScopes == null ? void 0 : coordinationScopes[secondaryType]) && Array.isArray(coordinationScopes[secondaryType])) {
36869
+ const layerScopes = coordinationScopes[primaryType];
36870
+ layerScopes.forEach((layerScope) => {
36871
+ result[layerScope] = flatSetters;
36872
+ });
36873
+ }
36874
+ return result;
36875
+ }, [flatSetters]);
36876
+ return [nestedValues, nestedSetters];
36177
36877
  }
36178
36878
  function useMultiDatasetCoordination(parameters, coordinationScopes, coordinationScopesBy) {
36179
36879
  return useComplexCoordination(
@@ -36258,6 +36958,12 @@ function useLayout() {
36258
36958
  function useRemoveComponent() {
36259
36959
  return useViewConfigStore((state) => state.removeComponent);
36260
36960
  }
36961
+ function useRemoveImageChannelInMetaCoordinationScopes() {
36962
+ return useViewConfigStore((state) => state.removeImageChannelInMetaCoordinationScopes);
36963
+ }
36964
+ function useAddImageChannelInMetaCoordinationScopes() {
36965
+ return useViewConfigStore((state) => state.addImageChannelInMetaCoordinationScopes);
36966
+ }
36261
36967
  function useChangeLayout() {
36262
36968
  return useViewConfigStore((state) => state.changeLayout);
36263
36969
  }
@@ -42598,7 +43304,7 @@ function useReady(statusValues) {
42598
43304
  function useUrls(urls) {
42599
43305
  const mergedUrls = useMemo(
42600
43306
  () => urls.filter((a) => Array.isArray(a)).flat().filter((url, index, array) => {
42601
- const firstIndex = array.findIndex((u) => u.name === url.name);
43307
+ const firstIndex = array.findIndex((u) => u && url && u.name === url.name);
42602
43308
  return index === firstIndex;
42603
43309
  }),
42604
43310
  // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -43582,6 +44288,8 @@ function PopperMenu(props) {
43582
44288
  children: children2,
43583
44289
  buttonClassName,
43584
44290
  placement = "bottom-end",
44291
+ withPaper = true,
44292
+ containerClassName,
43585
44293
  "aria-label": ariaLabel
43586
44294
  } = props;
43587
44295
  const classes = useStyles$2();
@@ -43594,7 +44302,7 @@ function PopperMenu(props) {
43594
44302
  };
43595
44303
  const id = open ? "v-popover-menu" : void 0;
43596
44304
  const getTooltipContainer = useVitessceContainer(anchorRef);
43597
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: anchorRef, className: classes.container, children: [
44305
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { ref: anchorRef, className: clsx(classes.container, containerClassName), children: [
43598
44306
  /* @__PURE__ */ jsxRuntimeExports.jsx(
43599
44307
  IconButton$1,
43600
44308
  {
@@ -43617,7 +44325,7 @@ function PopperMenu(props) {
43617
44325
  onClose: handleClose,
43618
44326
  placement,
43619
44327
  transition: true,
43620
- children: ({ TransitionProps }) => /* @__PURE__ */ jsxRuntimeExports.jsx(ClickAwayListener, { onClickAway: handleClose, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Fade$1, { ...TransitionProps, timeout: 100, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Paper$1, { elevation: 4, className: classes.paper, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuList$1, { children: children2 }) }) }) })
44328
+ children: ({ TransitionProps }) => /* @__PURE__ */ jsxRuntimeExports.jsx(ClickAwayListener, { onClickAway: handleClose, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Fade$1, { ...TransitionProps, timeout: 100, children: withPaper ? /* @__PURE__ */ jsxRuntimeExports.jsx(Paper$1, { elevation: 4, className: classes.paper, children: /* @__PURE__ */ jsxRuntimeExports.jsx(MenuList$1, { children: children2 }) }) : children2 }) })
43621
44329
  }
43622
44330
  )
43623
44331
  ] });
@@ -43909,6 +44617,9 @@ function useDataType(dataType, loaders, dataset, isRequired, coordinationSetters
43909
44617
  placeholderData: placeholderObject,
43910
44618
  // Include the hook name in the queryKey to prevent the case in which an identical queryKey
43911
44619
  // in a different hook would cause an accidental cache hit.
44620
+ // Note: same key structure/suffix as
44621
+ // useDataTypeMulti() and getQueryKeyScopeTuplesAux()
44622
+ // for shared caching.
43912
44623
  queryKey: [dataset, dataType, matchOn, isRequired, "useDataType"],
43913
44624
  // Query function should return an object
43914
44625
  // { data, dataKey } where dataKey is the loaded gene selection.
@@ -43945,6 +44656,9 @@ function useDataTypeMulti(dataType, loaders, dataset, isRequired, coordinationSe
43945
44656
  placeholderData: placeholderObject,
43946
44657
  // Query key should match useDataType for shared cacheing
43947
44658
  // and correctness of dataQueryFn.
44659
+ // Note: same key structure/suffix as
44660
+ // useDataType() and getQueryKeyScopeTuplesAux()
44661
+ // for shared caching.
43948
44662
  queryKey: [dataset, dataType, matchOn, isRequired, "useDataType"],
43949
44663
  // Query function should return an object
43950
44664
  // { data, dataKey } where dataKey is the loaded gene selection.
@@ -43978,10 +44692,20 @@ function useDataTypeMulti(dataType, loaders, dataset, isRequired, coordinationSe
43978
44692
  var _a;
43979
44693
  return [scopeKey, (_a = dataQueries[i].data) == null ? void 0 : _a.data];
43980
44694
  })
44695
+ // Deliberate dependency omissions: dataQueries and matchOnEntries,
44696
+ // since dataQueries changes every re-render. We use the in-direct
44697
+ // dependency of matchOnObj and the derived primitive value dataStatus.
44698
+ // eslint-disable-next-line react-hooks/exhaustive-deps
44699
+ ), [matchOnObj, dataStatus]);
44700
+ const urls = useMemo(() => fromEntries(
44701
+ matchOnEntries.map(([scopeKey], i) => {
44702
+ var _a;
44703
+ return [scopeKey, (_a = dataQueries[i].data) == null ? void 0 : _a.urls];
44704
+ })
43981
44705
  // Deliberate dependency omissions: matchOnEntries, since dataQueries depends on it.
43982
44706
  // eslint-disable-next-line react-hooks/exhaustive-deps
43983
44707
  ), [dataQueries]);
43984
- return [data, dataStatus];
44708
+ return [data, dataStatus, urls];
43985
44709
  }
43986
44710
  function useHasLoader(loaders, dataset, dataType, matchOn) {
43987
44711
  const loader = useMatchingLoader(loaders, dataset, dataType, matchOn);
@@ -44012,6 +44736,28 @@ function useObsEmbeddingData(loaders, dataset, isRequired, coordinationSetters,
44012
44736
  matchOn
44013
44737
  );
44014
44738
  }
44739
+ function useObsSpotsData(loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
44740
+ return useDataType(
44741
+ DataType$1.OBS_SPOTS,
44742
+ loaders,
44743
+ dataset,
44744
+ isRequired,
44745
+ coordinationSetters,
44746
+ initialCoordinationValues,
44747
+ matchOn
44748
+ );
44749
+ }
44750
+ function useObsPointsData(loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
44751
+ return useDataType(
44752
+ DataType$1.OBS_POINTS,
44753
+ loaders,
44754
+ dataset,
44755
+ isRequired,
44756
+ coordinationSetters,
44757
+ initialCoordinationValues,
44758
+ matchOn
44759
+ );
44760
+ }
44015
44761
  function useObsLocationsData(loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOn) {
44016
44762
  return useDataType(
44017
44763
  DataType$1.OBS_LOCATIONS,
@@ -44134,7 +44880,7 @@ function useFeatureSelection(loaders, dataset, isRequired, selection, matchOn) {
44134
44880
  if (!payload2)
44135
44881
  return null;
44136
44882
  const { data: data2 } = payload2;
44137
- return { data: data2[0], dataKey: selection };
44883
+ return { data: data2[0], dataKey: featureId };
44138
44884
  }
44139
44885
  const payload = await loader.load();
44140
44886
  if (!payload)
@@ -44187,7 +44933,9 @@ function useObsFeatureMatrixIndices(loaders, dataset, isRequired, matchOn) {
44187
44933
  placeholderData: placeholderObject,
44188
44934
  // Include the hook name in the queryKey to prevent the case in which an identical queryKey
44189
44935
  // in a different hook would cause an accidental cache hit.
44190
- queryKey: [dataset, DataType$1.OBS_FEATURE_MATRIX, matchOn, "useObsFeatureMatrixIndices"],
44936
+ // Note: this uses the same key structure/suffix as
44937
+ // getMatrixIndicesQueryKeyScopeTuplesAux for shared caching.
44938
+ queryKey: [dataset, DataType$1.OBS_FEATURE_MATRIX, matchOn, isRequired, "useObsFeatureMatrixIndices"],
44191
44939
  // Query function should return an object
44192
44940
  // { data, dataKey } where dataKey is the loaded gene selection.
44193
44941
  // TODO: use TypeScript to type the return value?
@@ -44244,6 +44992,87 @@ function useObsFeatureMatrixIndices(loaders, dataset, isRequired, matchOn) {
44244
44992
  }, [error, setWarning]);
44245
44993
  return [loadedData, dataStatus, urls];
44246
44994
  }
44995
+ function useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset) {
44996
+ const obsTypeCoordination = useComplexCoordination(
44997
+ [
44998
+ CoordinationType$1.OBS_TYPE
44999
+ ],
45000
+ coordinationScopes,
45001
+ coordinationScopesBy,
45002
+ CoordinationType$1.POINT_LAYER
45003
+ );
45004
+ const matchOnObj = useMemo(
45005
+ () => obsTypeCoordination[0],
45006
+ // imageCoordination reference changes each render,
45007
+ // use coordinationScopes and coordinationScopesBy which are
45008
+ // indirect dependencies here.
45009
+ [coordinationScopes, coordinationScopesBy]
45010
+ );
45011
+ const [obsPointsData, obsPointsDataStatus, obsPointsUrls] = useDataTypeMulti(
45012
+ DataType$1.OBS_POINTS,
45013
+ loaders,
45014
+ dataset,
45015
+ false,
45016
+ {},
45017
+ {},
45018
+ matchOnObj
45019
+ );
45020
+ return [obsPointsData, obsPointsDataStatus, obsPointsUrls];
45021
+ }
45022
+ function useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45023
+ const obsTypeCoordination = useComplexCoordination(
45024
+ [
45025
+ CoordinationType$1.OBS_TYPE
45026
+ ],
45027
+ coordinationScopes,
45028
+ coordinationScopesBy,
45029
+ CoordinationType$1.SPOT_LAYER
45030
+ );
45031
+ const matchOnObj = useMemo(
45032
+ () => obsTypeCoordination[0],
45033
+ // imageCoordination reference changes each render,
45034
+ // use coordinationScopes and coordinationScopesBy which are
45035
+ // indirect dependencies here.
45036
+ [coordinationScopes, coordinationScopesBy]
45037
+ );
45038
+ const [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls] = useDataTypeMulti(
45039
+ DataType$1.OBS_SPOTS,
45040
+ loaders,
45041
+ dataset,
45042
+ false,
45043
+ {},
45044
+ {},
45045
+ matchOnObj
45046
+ );
45047
+ return [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls];
45048
+ }
45049
+ function useSpotMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45050
+ const obsTypeCoordination = useComplexCoordination(
45051
+ [
45052
+ CoordinationType$1.OBS_TYPE
45053
+ ],
45054
+ coordinationScopes,
45055
+ coordinationScopesBy,
45056
+ CoordinationType$1.SPOT_LAYER
45057
+ );
45058
+ const matchOnObj = useMemo(
45059
+ () => obsTypeCoordination[0],
45060
+ // imageCoordination reference changes each render,
45061
+ // use coordinationScopes and coordinationScopesBy which are
45062
+ // indirect dependencies here.
45063
+ [coordinationScopes, coordinationScopesBy]
45064
+ );
45065
+ const [obsSetsData, obsSetsDataStatus, obsSetsUrls] = useDataTypeMulti(
45066
+ DataType$1.OBS_SETS,
45067
+ loaders,
45068
+ dataset,
45069
+ false,
45070
+ {},
45071
+ {},
45072
+ matchOnObj
45073
+ );
45074
+ return [obsSetsData, obsSetsDataStatus, obsSetsUrls];
45075
+ }
44247
45076
  function useMultiObsLabels(coordinationScopes, obsType, loaders, dataset) {
44248
45077
  const obsLabelsTypes = useMultiCoordinationValues(
44249
45078
  CoordinationType$1.OBS_LABELS_TYPE,
@@ -44255,7 +45084,7 @@ function useMultiObsLabels(coordinationScopes, obsType, loaders, dataset) {
44255
45084
  { obsLabelsType, obsType }
44256
45085
  ])
44257
45086
  ), [obsLabelsTypes, obsType]);
44258
- const [obsLabelsData, obsLabelsDataStatus] = useDataTypeMulti(
45087
+ const [obsLabelsData, obsLabelsDataStatus, obsLabelsUrls] = useDataTypeMulti(
44259
45088
  DataType$1.OBS_LABELS,
44260
45089
  loaders,
44261
45090
  dataset,
@@ -44264,8 +45093,699 @@ function useMultiObsLabels(coordinationScopes, obsType, loaders, dataset) {
44264
45093
  {},
44265
45094
  obsLabelsMatchOnObj
44266
45095
  );
44267
- const urls = null;
44268
- return [obsLabelsTypes, obsLabelsData, obsLabelsDataStatus, urls];
45096
+ return [obsLabelsTypes, obsLabelsData, obsLabelsDataStatus, obsLabelsUrls];
45097
+ }
45098
+ function useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45099
+ const imageCoordination = useComplexCoordination(
45100
+ [
45101
+ CoordinationType$1.FILE_UID
45102
+ ],
45103
+ coordinationScopes,
45104
+ coordinationScopesBy,
45105
+ CoordinationType$1.SEGMENTATION_LAYER
45106
+ );
45107
+ const matchOnObj = useMemo(
45108
+ () => imageCoordination[0],
45109
+ // imageCoordination reference changes each render,
45110
+ // use coordinationScopes and coordinationScopesBy which are
45111
+ // indirect dependencies here.
45112
+ [coordinationScopes, coordinationScopesBy]
45113
+ );
45114
+ const [
45115
+ obsSegmentationsData,
45116
+ obsSegmentationsDataStatus,
45117
+ obsSegmentationsUrls
45118
+ ] = useDataTypeMulti(
45119
+ DataType$1.OBS_SEGMENTATIONS,
45120
+ loaders,
45121
+ dataset,
45122
+ false,
45123
+ {},
45124
+ {},
45125
+ matchOnObj
45126
+ );
45127
+ return [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls];
45128
+ }
45129
+ function useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45130
+ const imageCoordination = useComplexCoordination(
45131
+ [
45132
+ CoordinationType$1.FILE_UID
45133
+ ],
45134
+ coordinationScopes,
45135
+ coordinationScopesBy,
45136
+ CoordinationType$1.IMAGE_LAYER
45137
+ );
45138
+ const matchOnObj = useMemo(
45139
+ () => imageCoordination[0],
45140
+ // imageCoordination reference changes each render,
45141
+ // use coordinationScopes and coordinationScopesBy which are
45142
+ // indirect dependencies here.
45143
+ [coordinationScopes, coordinationScopesBy]
45144
+ );
45145
+ const [imageData, imageDataStatus, imageUrls] = useDataTypeMulti(
45146
+ DataType$1.IMAGE,
45147
+ loaders,
45148
+ dataset,
45149
+ false,
45150
+ {},
45151
+ {},
45152
+ matchOnObj
45153
+ );
45154
+ return [imageData, imageDataStatus, imageUrls];
45155
+ }
45156
+ function getFeatureSelectionQueryKeyScopeTuplesAux(allSelections, allMatchOnObj, depth, dataset, dataType, isRequired, prevLevelScopes, currSelection, currMatchOn) {
45157
+ var _a;
45158
+ if (depth === 0) {
45159
+ return (currSelection == null ? void 0 : currSelection.map((featureId, featureIndex) => [
45160
+ // queryKey:
45161
+ // TODO: use same key suffix as useFeatureSelection for shared caching?
45162
+ [dataset, dataType, currMatchOn, featureId, isRequired, "useFeatureSelectionMultiLevel"],
45163
+ // scope info (for rolling up later)
45164
+ { levelScopes: prevLevelScopes, featureIndex, numFeatures: currSelection.length }
45165
+ ])) || [];
45166
+ }
45167
+ return ((_a = Object.entries(currSelection)) == null ? void 0 : _a.flatMap(([levelScope, levelSelections]) => getFeatureSelectionQueryKeyScopeTuplesAux(
45168
+ allSelections,
45169
+ allMatchOnObj,
45170
+ depth - 1,
45171
+ dataset,
45172
+ dataType,
45173
+ isRequired,
45174
+ [...prevLevelScopes, levelScope],
45175
+ levelSelections,
45176
+ currMatchOn == null ? void 0 : currMatchOn[levelScope]
45177
+ ))) || [];
45178
+ }
45179
+ function getFeatureSelectionQueryKeyScopeTuples(selections, matchOnObj, depth, dataset, dataType, isRequired) {
45180
+ return getFeatureSelectionQueryKeyScopeTuplesAux(
45181
+ selections,
45182
+ matchOnObj,
45183
+ depth,
45184
+ dataset,
45185
+ dataType,
45186
+ isRequired,
45187
+ [],
45188
+ selections,
45189
+ matchOnObj
45190
+ );
45191
+ }
45192
+ function getMatrixIndicesQueryKeyScopeTuplesAux(allMatchOnObj, depth, dataset, dataType, isRequired, prevLevelScopes, currMatchOn) {
45193
+ var _a;
45194
+ if (depth === 0) {
45195
+ return [[
45196
+ // queryKey:
45197
+ // Note: this uses the same key structure/suffix as
45198
+ // useObsFeatureMatrixIndices for shared caching.
45199
+ [dataset, dataType, currMatchOn, isRequired, "useObsFeatureMatrixIndices"],
45200
+ // scope info (for rolling up later)
45201
+ { levelScopes: prevLevelScopes }
45202
+ ]];
45203
+ }
45204
+ return ((_a = Object.entries(currMatchOn)) == null ? void 0 : _a.flatMap(([levelScope, levelMatchOn]) => getMatrixIndicesQueryKeyScopeTuplesAux(
45205
+ allMatchOnObj,
45206
+ depth - 1,
45207
+ dataset,
45208
+ dataType,
45209
+ isRequired,
45210
+ [...prevLevelScopes, levelScope],
45211
+ levelMatchOn
45212
+ ))) || [];
45213
+ }
45214
+ function getMatrixIndicesQueryKeyScopeTuples(matchOnObj, depth, dataset, dataType, isRequired) {
45215
+ return getMatrixIndicesQueryKeyScopeTuplesAux(
45216
+ matchOnObj,
45217
+ depth,
45218
+ dataset,
45219
+ dataType,
45220
+ isRequired,
45221
+ [],
45222
+ matchOnObj
45223
+ );
45224
+ }
45225
+ function getQueryKeyScopeTuplesAux(allMatchOnObj, depth, dataset, dataType, isRequired, prevLevelScopes, currMatchOn) {
45226
+ var _a;
45227
+ if (depth === 0) {
45228
+ return [[
45229
+ // queryKey:
45230
+ // Note: same key structure/suffix as
45231
+ // useDataType() and useDataTypeMulti()
45232
+ // for shared caching.
45233
+ [dataset, dataType, currMatchOn, isRequired, "useDataType"],
45234
+ // scope info (for rolling up later)
45235
+ { levelScopes: prevLevelScopes }
45236
+ ]];
45237
+ }
45238
+ return ((_a = Object.entries(currMatchOn)) == null ? void 0 : _a.flatMap(([levelScope, levelMatchOn]) => getQueryKeyScopeTuplesAux(
45239
+ allMatchOnObj,
45240
+ depth - 1,
45241
+ dataset,
45242
+ dataType,
45243
+ isRequired,
45244
+ [...prevLevelScopes, levelScope],
45245
+ levelMatchOn
45246
+ ))) || [];
45247
+ }
45248
+ function getQueryKeyScopeTuples(matchOnObj, depth, dataset, dataType, isRequired) {
45249
+ return getQueryKeyScopeTuplesAux(
45250
+ matchOnObj,
45251
+ depth,
45252
+ dataset,
45253
+ dataType,
45254
+ isRequired,
45255
+ [],
45256
+ matchOnObj
45257
+ );
45258
+ }
45259
+ function initializeNestedObjectAux(levelScopes, currObj, getBaseValue, currLevel) {
45260
+ const currScope = levelScopes[currLevel];
45261
+ const depthRemaining = levelScopes.length - currLevel;
45262
+ if (depthRemaining === 0) {
45263
+ return currObj;
45264
+ }
45265
+ if (!currObj[currScope]) {
45266
+ if (depthRemaining === 1) {
45267
+ currObj[currScope] = getBaseValue();
45268
+ } else {
45269
+ currObj[currScope] = {};
45270
+ }
45271
+ }
45272
+ return initializeNestedObjectAux(levelScopes, currObj[currScope], getBaseValue, currLevel + 1);
45273
+ }
45274
+ function initializeNestedObject(levelScopes, currObj, getBaseValue) {
45275
+ return initializeNestedObjectAux(levelScopes, currObj, getBaseValue, 0);
45276
+ }
45277
+ function nestFeatureSelectionQueryResults(queryKeyScopeTuples, flatQueryResults) {
45278
+ const nestedData = {};
45279
+ queryKeyScopeTuples.forEach(([queryKey, { levelScopes, featureIndex, numFeatures }], i) => {
45280
+ const getBaseValue = () => new Array(numFeatures);
45281
+ const subObj = initializeNestedObject(levelScopes, nestedData, getBaseValue);
45282
+ subObj[featureIndex] = flatQueryResults == null ? void 0 : flatQueryResults[i];
45283
+ });
45284
+ return nestedData;
45285
+ }
45286
+ function nestQueryResults(queryKeyScopeTuples, flatQueryResults) {
45287
+ const nestedData = {};
45288
+ queryKeyScopeTuples.forEach(([queryKey, { levelScopes }], i) => {
45289
+ const getBaseValue = () => ({});
45290
+ const subObj = initializeNestedObject(levelScopes, nestedData, getBaseValue);
45291
+ Object.entries((flatQueryResults == null ? void 0 : flatQueryResults[i]) || {}).forEach(([key, value]) => {
45292
+ subObj[key] = value;
45293
+ });
45294
+ });
45295
+ return nestedData;
45296
+ }
45297
+ async function featureSelectionQueryFn(ctx) {
45298
+ const { loaders } = ctx.meta;
45299
+ const [dataset, dataType, matchOn, featureId, isRequired] = ctx.queryKey;
45300
+ const loader = getMatchingLoader(loaders, dataset, dataType, matchOn);
45301
+ if (loader) {
45302
+ const implementsGeneSelection = typeof loader.loadGeneSelection === "function";
45303
+ if (implementsGeneSelection) {
45304
+ const payload2 = await loader.loadGeneSelection({ selection: [featureId] });
45305
+ if (!payload2)
45306
+ return null;
45307
+ const { data: data2 } = payload2;
45308
+ const expressionData2 = data2[0];
45309
+ const dataExtent2 = extent(expressionData2);
45310
+ const [min2, max2] = dataExtent2;
45311
+ const ratio2 = 255 / (max2 - min2);
45312
+ const normData2 = new Uint8Array(
45313
+ expressionData2.map((j) => Math.floor((j - min2) * ratio2))
45314
+ );
45315
+ return {
45316
+ data: expressionData2,
45317
+ normData: normData2,
45318
+ dataExtent: dataExtent2,
45319
+ dataKey: featureId
45320
+ };
45321
+ }
45322
+ const payload = await loader.load();
45323
+ if (!payload)
45324
+ return null;
45325
+ const { data } = payload;
45326
+ const { obsIndex, featureIndex, obsFeatureMatrix } = data;
45327
+ const geneIndex = featureIndex.indexOf(featureId);
45328
+ const numGenes = featureIndex.length;
45329
+ const numCells = obsIndex.length;
45330
+ const expressionData = new Float32Array(numCells);
45331
+ for (let cellIndex = 0; cellIndex < numCells; cellIndex += 1) {
45332
+ expressionData[cellIndex] = obsFeatureMatrix.data[cellIndex * numGenes + geneIndex];
45333
+ }
45334
+ const dataExtent = extent(expressionData);
45335
+ const [min, max] = dataExtent;
45336
+ const ratio = 255 / (max - min);
45337
+ const normData = new Uint8Array(
45338
+ expressionData.map((j) => Math.floor((j - min) * ratio))
45339
+ );
45340
+ return {
45341
+ data: expressionData,
45342
+ normData,
45343
+ dataExtent,
45344
+ dataKey: featureId
45345
+ };
45346
+ }
45347
+ if (isRequired) {
45348
+ throw new LoaderNotFoundError(loaders, dataset, dataType, matchOn);
45349
+ } else {
45350
+ return { data: null, dataKey: null };
45351
+ }
45352
+ }
45353
+ function useFeatureSelectionMultiLevel(loaders, dataset, isRequired, matchOnObj, selections, depth) {
45354
+ const setWarning = useSetWarning();
45355
+ const queryKeyScopeTuples = useMemo(() => getFeatureSelectionQueryKeyScopeTuples(
45356
+ selections,
45357
+ matchOnObj,
45358
+ depth,
45359
+ dataset,
45360
+ DataType$1.OBS_FEATURE_MATRIX,
45361
+ isRequired
45362
+ ), [selections, matchOnObj, depth, dataset]);
45363
+ const featureQueries = useQueries({
45364
+ queries: queryKeyScopeTuples.map(([queryKey]) => ({
45365
+ structuralSharing: false,
45366
+ placeholderData: null,
45367
+ queryKey,
45368
+ queryFn: featureSelectionQueryFn,
45369
+ meta: { loaders }
45370
+ }))
45371
+ });
45372
+ const anyLoading = featureQueries.some((q) => q.isFetching);
45373
+ const anyError = featureQueries.some((q) => q.isError);
45374
+ const dataStatus = anyLoading ? STATUS.LOADING : anyError ? STATUS.ERROR : STATUS.SUCCESS;
45375
+ const flatGeneData = featureQueries.map((q) => {
45376
+ var _a;
45377
+ return ((_a = q.data) == null ? void 0 : _a.data) || null;
45378
+ });
45379
+ const flatLoadedGeneName = featureQueries.map((q) => {
45380
+ var _a;
45381
+ return ((_a = q.data) == null ? void 0 : _a.dataKey) || null;
45382
+ });
45383
+ const flatExtents = featureQueries.map((q) => {
45384
+ var _a;
45385
+ return ((_a = q.data) == null ? void 0 : _a.dataExtent) || null;
45386
+ });
45387
+ const flatNormData = featureQueries.map((q) => {
45388
+ var _a;
45389
+ return ((_a = q.data) == null ? void 0 : _a.normData) || null;
45390
+ });
45391
+ useEffect(() => {
45392
+ featureQueries.map((q) => q.error).filter((e) => Boolean(e)).forEach((error) => {
45393
+ warn(error, setWarning);
45394
+ });
45395
+ }, [anyError, setWarning]);
45396
+ const [geneData, loadedGeneName, extents, normData] = useMemo(() => {
45397
+ const nestedGeneData = nestFeatureSelectionQueryResults(queryKeyScopeTuples, flatGeneData);
45398
+ const nestedLoadedGeneName = nestFeatureSelectionQueryResults(
45399
+ queryKeyScopeTuples,
45400
+ flatLoadedGeneName
45401
+ );
45402
+ const nestedExtents = nestFeatureSelectionQueryResults(queryKeyScopeTuples, flatExtents);
45403
+ const nestedNormData = nestFeatureSelectionQueryResults(queryKeyScopeTuples, flatNormData);
45404
+ return [nestedGeneData, nestedLoadedGeneName, nestedExtents, nestedNormData];
45405
+ }, [featureQueries.reduce((a, h) => a + h.dataUpdatedAt, 0)]);
45406
+ return [geneData, loadedGeneName, extents, normData, dataStatus];
45407
+ }
45408
+ async function matrixIndicesQueryFn(ctx) {
45409
+ const { loaders } = ctx.meta;
45410
+ const [dataset, dataType, matchOn, isRequired] = ctx.queryKey;
45411
+ const loader = getMatchingLoader(loaders, dataset, dataType, matchOn);
45412
+ if (loader) {
45413
+ const implementsLoadAttrs = typeof loader.loadAttrs === "function";
45414
+ if (implementsLoadAttrs) {
45415
+ const payload2 = await loader.loadAttrs();
45416
+ if (!payload2)
45417
+ return null;
45418
+ const { data: payloadData2 } = payload2;
45419
+ return {
45420
+ data: {
45421
+ obsIndex: payloadData2.rows,
45422
+ featureIndex: payloadData2.cols
45423
+ }
45424
+ };
45425
+ }
45426
+ const payload = await loader.load();
45427
+ if (!payload)
45428
+ return null;
45429
+ const { data: payloadData } = payload;
45430
+ return {
45431
+ data: {
45432
+ obsIndex: payloadData.obsIndex,
45433
+ featureIndex: payloadData.featureIndex
45434
+ }
45435
+ };
45436
+ }
45437
+ if (isRequired) {
45438
+ throw new LoaderNotFoundError(loaders, dataset, dataType, matchOn);
45439
+ } else {
45440
+ return { data: null, dataKey: null };
45441
+ }
45442
+ }
45443
+ function useObsFeatureMatrixIndicesMultiLevel(loaders, dataset, isRequired, matchOnObj, depth) {
45444
+ const setWarning = useSetWarning();
45445
+ const queryKeyScopeTuples = useMemo(() => getMatrixIndicesQueryKeyScopeTuples(
45446
+ matchOnObj,
45447
+ depth,
45448
+ dataset,
45449
+ DataType$1.OBS_FEATURE_MATRIX,
45450
+ isRequired
45451
+ ), [matchOnObj, depth, dataset]);
45452
+ const indicesQueries = useQueries({
45453
+ queries: queryKeyScopeTuples.map(([queryKey]) => ({
45454
+ structuralSharing: false,
45455
+ placeholderData: null,
45456
+ queryKey,
45457
+ queryFn: matrixIndicesQueryFn,
45458
+ meta: { loaders }
45459
+ }))
45460
+ });
45461
+ const anyLoading = indicesQueries.some((q) => q.isFetching);
45462
+ const anyError = indicesQueries.some((q) => q.isError);
45463
+ const dataStatus = anyLoading ? STATUS.LOADING : anyError ? STATUS.ERROR : STATUS.SUCCESS;
45464
+ const flatIndicesData = indicesQueries.map((q) => {
45465
+ var _a;
45466
+ return ((_a = q.data) == null ? void 0 : _a.data) || null;
45467
+ });
45468
+ useEffect(() => {
45469
+ indicesQueries.map((q) => q.error).filter((e) => Boolean(e)).forEach((error) => {
45470
+ warn(error, setWarning);
45471
+ });
45472
+ }, [anyError, setWarning]);
45473
+ const indicesData = useMemo(() => {
45474
+ const nestedIndicesData = nestQueryResults(queryKeyScopeTuples, flatIndicesData);
45475
+ return nestedIndicesData;
45476
+ }, [indicesQueries.reduce((a, h) => a + h.dataUpdatedAt, 0)]);
45477
+ return [indicesData, dataStatus];
45478
+ }
45479
+ function useDataTypeMultiLevel(loaders, dataset, isRequired, matchOnObj, depth, dataType) {
45480
+ const setWarning = useSetWarning();
45481
+ const queryKeyScopeTuples = useMemo(() => getQueryKeyScopeTuples(
45482
+ matchOnObj,
45483
+ depth,
45484
+ dataset,
45485
+ dataType,
45486
+ isRequired
45487
+ ), [matchOnObj, depth, dataset]);
45488
+ const locationsQueries = useQueries({
45489
+ queries: queryKeyScopeTuples.map(([queryKey]) => ({
45490
+ structuralSharing: false,
45491
+ placeholderData: null,
45492
+ queryKey,
45493
+ queryFn: dataQueryFn,
45494
+ meta: { loaders }
45495
+ }))
45496
+ });
45497
+ const anyLoading = locationsQueries.some((q) => q.isFetching);
45498
+ const anyError = locationsQueries.some((q) => q.isError);
45499
+ const dataStatus = anyLoading ? STATUS.LOADING : anyError ? STATUS.ERROR : STATUS.SUCCESS;
45500
+ const flatIndicesData = locationsQueries.map((q) => {
45501
+ var _a;
45502
+ return ((_a = q.data) == null ? void 0 : _a.data) || null;
45503
+ });
45504
+ useEffect(() => {
45505
+ locationsQueries.map((q) => q.error).filter((e) => Boolean(e)).forEach((error) => {
45506
+ warn(error, setWarning);
45507
+ });
45508
+ }, [anyError, setWarning]);
45509
+ const locationsData = useMemo(() => {
45510
+ const nestedIndicesData = nestQueryResults(queryKeyScopeTuples, flatIndicesData);
45511
+ return nestedIndicesData;
45512
+ }, [locationsQueries.reduce((a, h) => a + h.dataUpdatedAt, 0)]);
45513
+ return [locationsData, dataStatus];
45514
+ }
45515
+ function useObsLocationsMultiLevel(loaders, dataset, isRequired, matchOnObj, depth) {
45516
+ return useDataTypeMultiLevel(
45517
+ loaders,
45518
+ dataset,
45519
+ isRequired,
45520
+ matchOnObj,
45521
+ depth,
45522
+ DataType$1.OBS_LOCATIONS
45523
+ );
45524
+ }
45525
+ function useObsSetsMultiLevel(loaders, dataset, isRequired, matchOnObj, depth) {
45526
+ return useDataTypeMultiLevel(
45527
+ loaders,
45528
+ dataset,
45529
+ isRequired,
45530
+ matchOnObj,
45531
+ depth,
45532
+ DataType$1.OBS_SETS
45533
+ );
45534
+ }
45535
+ function useObsLabelsMultiLevel(loaders, dataset, isRequired, matchOnObj, depth) {
45536
+ return useDataTypeMultiLevel(
45537
+ loaders,
45538
+ dataset,
45539
+ isRequired,
45540
+ matchOnObj,
45541
+ depth,
45542
+ DataType$1.OBS_LABELS
45543
+ );
45544
+ }
45545
+ function useSegmentationMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45546
+ const obsFeatureMatrixCoordination = useComplexCoordinationSecondary(
45547
+ [
45548
+ CoordinationType$1.OBS_TYPE,
45549
+ CoordinationType$1.FEATURE_TYPE,
45550
+ CoordinationType$1.FEATURE_VALUE_TYPE
45551
+ ],
45552
+ coordinationScopes,
45553
+ coordinationScopesBy,
45554
+ CoordinationType$1.SEGMENTATION_LAYER,
45555
+ CoordinationType$1.SEGMENTATION_CHANNEL
45556
+ );
45557
+ const featureSelectionCoordination = useComplexCoordinationSecondary(
45558
+ [
45559
+ CoordinationType$1.FEATURE_SELECTION
45560
+ ],
45561
+ coordinationScopes,
45562
+ coordinationScopesBy,
45563
+ CoordinationType$1.SEGMENTATION_LAYER,
45564
+ CoordinationType$1.SEGMENTATION_CHANNEL
45565
+ );
45566
+ const matchOnObj = useMemo(
45567
+ () => obsFeatureMatrixCoordination[0],
45568
+ // imageCoordination reference changes each render,
45569
+ // use coordinationScopes and coordinationScopesBy which are
45570
+ // indirect dependencies here.
45571
+ [coordinationScopes, coordinationScopesBy]
45572
+ );
45573
+ const selections = useMemo(
45574
+ () => fromEntries(Object.entries(featureSelectionCoordination[0]).map(([layerScope, layerVal]) => [
45575
+ layerScope,
45576
+ fromEntries(
45577
+ Object.entries(layerVal).map(([cScope, cVal]) => [cScope, cVal.featureSelection])
45578
+ )
45579
+ ])),
45580
+ // Need to execute this more frequently, whenever the featureSelections update.
45581
+ [
45582
+ coordinationScopes,
45583
+ coordinationScopesBy,
45584
+ ...Object.values(featureSelectionCoordination[0] || {}).flatMap((layerVal) => Object.values(layerVal).map((cVal) => cVal.featureSelection))
45585
+ ]
45586
+ );
45587
+ const [
45588
+ featureData,
45589
+ loadedSelections,
45590
+ extents,
45591
+ normData,
45592
+ featureStatus
45593
+ ] = useFeatureSelectionMultiLevel(
45594
+ loaders,
45595
+ dataset,
45596
+ false,
45597
+ matchOnObj,
45598
+ selections,
45599
+ 2
45600
+ );
45601
+ return [featureData, loadedSelections, extents, normData, featureStatus];
45602
+ }
45603
+ function useSpotMultiFeatureSelection(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45604
+ const obsFeatureMatrixCoordination = useComplexCoordination(
45605
+ [
45606
+ CoordinationType$1.OBS_TYPE,
45607
+ CoordinationType$1.FEATURE_TYPE,
45608
+ CoordinationType$1.FEATURE_VALUE_TYPE
45609
+ ],
45610
+ coordinationScopes,
45611
+ coordinationScopesBy,
45612
+ CoordinationType$1.SPOT_LAYER
45613
+ );
45614
+ const featureSelectionCoordination = useComplexCoordination(
45615
+ [
45616
+ CoordinationType$1.FEATURE_SELECTION
45617
+ ],
45618
+ coordinationScopes,
45619
+ coordinationScopesBy,
45620
+ CoordinationType$1.SPOT_LAYER
45621
+ );
45622
+ const matchOnObj = useMemo(
45623
+ () => obsFeatureMatrixCoordination[0],
45624
+ // imageCoordination reference changes each render,
45625
+ // use coordinationScopes and coordinationScopesBy which are
45626
+ // indirect dependencies here.
45627
+ [coordinationScopes, coordinationScopesBy]
45628
+ );
45629
+ const selections = useMemo(
45630
+ () => fromEntries(Object.entries(featureSelectionCoordination[0]).map(([layerScope, layerVal]) => [
45631
+ layerScope,
45632
+ layerVal.featureSelection
45633
+ ])),
45634
+ // Need to execute this more frequently, whenever the featureSelections update.
45635
+ [
45636
+ coordinationScopes,
45637
+ coordinationScopesBy,
45638
+ ...Object.values(featureSelectionCoordination[0] || {}).flatMap((layerVal) => layerVal.featureSelection)
45639
+ ]
45640
+ );
45641
+ const [
45642
+ featureData,
45643
+ loadedSelections,
45644
+ extents,
45645
+ normData,
45646
+ featureStatus
45647
+ ] = useFeatureSelectionMultiLevel(
45648
+ loaders,
45649
+ dataset,
45650
+ false,
45651
+ matchOnObj,
45652
+ selections,
45653
+ 1
45654
+ );
45655
+ return [featureData, loadedSelections, extents, normData, featureStatus];
45656
+ }
45657
+ function useSegmentationMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45658
+ const obsFeatureMatrixCoordination = useComplexCoordinationSecondary(
45659
+ [
45660
+ CoordinationType$1.OBS_TYPE,
45661
+ CoordinationType$1.FEATURE_TYPE,
45662
+ CoordinationType$1.FEATURE_VALUE_TYPE
45663
+ ],
45664
+ coordinationScopes,
45665
+ coordinationScopesBy,
45666
+ CoordinationType$1.SEGMENTATION_LAYER,
45667
+ CoordinationType$1.SEGMENTATION_CHANNEL
45668
+ );
45669
+ const matchOnObj = useMemo(
45670
+ () => obsFeatureMatrixCoordination[0],
45671
+ // imageCoordination reference changes each render,
45672
+ // use coordinationScopes and coordinationScopesBy which are
45673
+ // indirect dependencies here.
45674
+ [coordinationScopes, coordinationScopesBy]
45675
+ );
45676
+ const [indicesData, indicesDataStatus] = useObsFeatureMatrixIndicesMultiLevel(
45677
+ loaders,
45678
+ dataset,
45679
+ false,
45680
+ matchOnObj,
45681
+ 2
45682
+ );
45683
+ return [indicesData, indicesDataStatus];
45684
+ }
45685
+ function useSpotMultiObsFeatureMatrixIndices(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45686
+ const obsFeatureMatrixCoordination = useComplexCoordination(
45687
+ [
45688
+ CoordinationType$1.OBS_TYPE,
45689
+ CoordinationType$1.FEATURE_TYPE,
45690
+ CoordinationType$1.FEATURE_VALUE_TYPE
45691
+ ],
45692
+ coordinationScopes,
45693
+ coordinationScopesBy,
45694
+ CoordinationType$1.SPOT_LAYER
45695
+ );
45696
+ const matchOnObj = useMemo(
45697
+ () => obsFeatureMatrixCoordination[0],
45698
+ // imageCoordination reference changes each render,
45699
+ // use coordinationScopes and coordinationScopesBy which are
45700
+ // indirect dependencies here.
45701
+ [coordinationScopes, coordinationScopesBy]
45702
+ );
45703
+ const [indicesData, indicesDataStatus] = useObsFeatureMatrixIndicesMultiLevel(
45704
+ loaders,
45705
+ dataset,
45706
+ false,
45707
+ matchOnObj,
45708
+ 1
45709
+ );
45710
+ return [indicesData, indicesDataStatus];
45711
+ }
45712
+ function usePointMultiObsLabels(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45713
+ const obsLabelsCoordination = useComplexCoordination(
45714
+ [
45715
+ CoordinationType$1.OBS_TYPE,
45716
+ CoordinationType$1.OBS_LABELS_TYPE
45717
+ ],
45718
+ coordinationScopes,
45719
+ coordinationScopesBy,
45720
+ CoordinationType$1.POINT_LAYER
45721
+ );
45722
+ const matchOnObj = useMemo(
45723
+ () => obsLabelsCoordination[0],
45724
+ // imageCoordination reference changes each render,
45725
+ // use coordinationScopes and coordinationScopesBy which are
45726
+ // indirect dependencies here.
45727
+ [coordinationScopes, coordinationScopesBy]
45728
+ );
45729
+ const [indicesData, indicesDataStatus] = useObsLabelsMultiLevel(
45730
+ loaders,
45731
+ dataset,
45732
+ false,
45733
+ matchOnObj,
45734
+ 1
45735
+ );
45736
+ return [indicesData, indicesDataStatus];
45737
+ }
45738
+ function useSegmentationMultiObsLocations(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45739
+ const obsTypeCoordination = useComplexCoordinationSecondary(
45740
+ [
45741
+ CoordinationType$1.OBS_TYPE
45742
+ ],
45743
+ coordinationScopes,
45744
+ coordinationScopesBy,
45745
+ CoordinationType$1.SEGMENTATION_LAYER,
45746
+ CoordinationType$1.SEGMENTATION_CHANNEL
45747
+ );
45748
+ const matchOnObj = useMemo(
45749
+ () => obsTypeCoordination[0],
45750
+ // imageCoordination reference changes each render,
45751
+ // use coordinationScopes and coordinationScopesBy which are
45752
+ // indirect dependencies here.
45753
+ [coordinationScopes, coordinationScopesBy]
45754
+ );
45755
+ const [indicesData, indicesDataStatus] = useObsLocationsMultiLevel(
45756
+ loaders,
45757
+ dataset,
45758
+ false,
45759
+ matchOnObj,
45760
+ 2
45761
+ );
45762
+ return [indicesData, indicesDataStatus];
45763
+ }
45764
+ function useSegmentationMultiObsSets(coordinationScopes, coordinationScopesBy, loaders, dataset) {
45765
+ const obsTypeCoordination = useComplexCoordinationSecondary(
45766
+ [
45767
+ CoordinationType$1.OBS_TYPE
45768
+ ],
45769
+ coordinationScopes,
45770
+ coordinationScopesBy,
45771
+ CoordinationType$1.SEGMENTATION_LAYER,
45772
+ CoordinationType$1.SEGMENTATION_CHANNEL
45773
+ );
45774
+ const matchOnObj = useMemo(
45775
+ () => obsTypeCoordination[0],
45776
+ // imageCoordination reference changes each render,
45777
+ // use coordinationScopes and coordinationScopesBy which are
45778
+ // indirect dependencies here.
45779
+ [coordinationScopes, coordinationScopesBy]
45780
+ );
45781
+ const [indicesData, indicesDataStatus] = useObsSetsMultiLevel(
45782
+ loaders,
45783
+ dataset,
45784
+ false,
45785
+ matchOnObj,
45786
+ 2
45787
+ );
45788
+ return [indicesData, indicesDataStatus];
44269
45789
  }
44270
45790
  class AbstractLoader {
44271
45791
  constructor({
@@ -44441,13 +45961,17 @@ export {
44441
45961
  TitleInfo,
44442
45962
  VitS,
44443
45963
  logConfig,
45964
+ useAddImageChannelInMetaCoordinationScopes,
44444
45965
  useAuxiliaryCoordination,
44445
45966
  useClosestVitessceContainerSize,
44446
45967
  useComplexCoordination,
45968
+ useComplexCoordinationSecondary,
44447
45969
  useComponentHover,
44448
45970
  useComponentLayout,
44449
45971
  useComponentViewInfo,
44450
45972
  useCoordination,
45973
+ useCoordinationScopes,
45974
+ useCoordinationScopesBy,
44451
45975
  useDatasetUids,
44452
45976
  useDeckCanvasSize,
44453
45977
  useDescription,
@@ -44463,22 +45987,41 @@ export {
44463
45987
  useInitialCoordination,
44464
45988
  useLoaders,
44465
45989
  useMatchingLoader,
45990
+ useMultiCoordinationScopes,
45991
+ useMultiCoordinationScopesNonNull,
45992
+ useMultiCoordinationScopesSecondary,
45993
+ useMultiCoordinationScopesSecondaryNonNull,
44466
45994
  useMultiCoordinationValues,
44467
45995
  useMultiDatasetCoordination,
45996
+ useMultiImages,
44468
45997
  useMultiObsLabels,
45998
+ useMultiObsPoints,
45999
+ useMultiObsSegmentations,
46000
+ useMultiObsSpots,
44469
46001
  useNeighborhoodsData,
44470
46002
  useObsEmbeddingData,
44471
46003
  useObsFeatureMatrixData,
44472
46004
  useObsFeatureMatrixIndices,
44473
46005
  useObsLabelsData,
44474
46006
  useObsLocationsData,
46007
+ useObsPointsData,
44475
46008
  useObsSegmentationsData,
44476
46009
  useObsSetsData,
46010
+ useObsSpotsData,
44477
46011
  useStyles as usePlotOptionsStyles,
46012
+ usePointMultiObsLabels,
44478
46013
  useReady,
46014
+ useRemoveImageChannelInMetaCoordinationScopes,
46015
+ useSegmentationMultiFeatureSelection,
46016
+ useSegmentationMultiObsFeatureMatrixIndices,
46017
+ useSegmentationMultiObsLocations,
46018
+ useSegmentationMultiObsSets,
44479
46019
  useSetComponentHover,
44480
46020
  useSetComponentViewInfo,
44481
46021
  useSetWarning,
46022
+ useSpotMultiFeatureSelection,
46023
+ useSpotMultiObsFeatureMatrixIndices,
46024
+ useSpotMultiObsSets,
44482
46025
  useUint8FeatureSelection,
44483
46026
  useUint8ObsFeatureMatrix,
44484
46027
  useUrls,