@vitessce/vit-s 3.3.2 → 3.3.3
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.
- package/dist/index.js +971 -212
- package/dist-tsc/VitS.d.ts.map +1 -1
- package/dist-tsc/VitS.js +1 -1
- package/dist-tsc/VitessceGrid.d.ts.map +1 -1
- package/dist-tsc/VitessceGrid.js +2 -2
- package/dist-tsc/data-hook-utils.d.ts +1 -1
- package/dist-tsc/data-hook-utils.d.ts.map +1 -1
- package/dist-tsc/data-hook-utils.js +14 -7
- package/dist-tsc/data-hooks-multilevel-utils.d.ts.map +1 -1
- package/dist-tsc/data-hooks-multilevel-utils.js +5 -3
- package/dist-tsc/data-hooks-multilevel.d.ts.map +1 -1
- package/dist-tsc/data-hooks-multilevel.js +5 -2
- package/dist-tsc/data-hooks.d.ts +4 -4
- package/dist-tsc/data-hooks.d.ts.map +1 -1
- package/dist-tsc/data-hooks.js +9 -9
- package/dist-tsc/index.d.ts +1 -1
- package/dist-tsc/index.js +1 -1
- package/dist-tsc/state/hooks.d.ts +7 -0
- package/dist-tsc/state/hooks.d.ts.map +1 -1
- package/dist-tsc/state/hooks.js +122 -3
- package/dist-tsc/state/spatial-reducers.js +1 -1
- package/dist-tsc/vitessce-grid-utils.js +1 -1
- package/package.json +6 -5
- package/src/VitS.js +1 -0
- package/src/VitessceGrid.js +2 -0
- package/src/data-hook-utils.js +24 -10
- package/src/data-hooks-multilevel-utils.js +5 -3
- package/src/data-hooks-multilevel.js +5 -2
- package/src/data-hooks.js +9 -5
- package/src/index.js +1 -0
- package/src/state/hooks.js +125 -3
- package/src/state/spatial-reducers.js +1 -1
- package/src/vitessce-grid-utils.js +1 -1
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$
|
|
1301
|
+
function isPlainObject$1(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$
|
|
1309
|
+
if (isPlainObject$1(target) && isPlainObject$1(source)) {
|
|
1310
1310
|
Object.keys(source).forEach(function(key) {
|
|
1311
1311
|
if (key === "__proto__") {
|
|
1312
1312
|
return;
|
|
1313
1313
|
}
|
|
1314
|
-
if (isPlainObject$
|
|
1314
|
+
if (isPlainObject$1(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$
|
|
1491
|
+
var hasOwnProperty$l = 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$
|
|
1538
|
+
if (hasOwnProperty$l.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
|
|
2955
|
+
function merge(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
|
|
3050
|
+
return merge(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
|
|
3118
|
+
return _extends$5({}, merge(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
|
|
3123
|
+
return _extends$5({}, merge(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, {});
|
|
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
|
|
16698
|
+
return JSON.stringify(queryKey, (_, val) => isPlainObject(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
|
|
16723
|
+
if (array || isPlainObject(a) && isPlainObject(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
|
|
16754
|
+
function isPlainObject(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$
|
|
19202
|
-
var hasOwnProperty$
|
|
19203
|
-
var nativeObjectToString$3 = objectProto$
|
|
19201
|
+
var objectProto$q = Object.prototype;
|
|
19202
|
+
var hasOwnProperty$k = objectProto$q.hasOwnProperty;
|
|
19203
|
+
var nativeObjectToString$3 = objectProto$q.toString;
|
|
19204
19204
|
var symToStringTag$3 = Symbol$6 ? Symbol$6.toStringTag : void 0;
|
|
19205
19205
|
function getRawTag$2(value) {
|
|
19206
|
-
var isOwn = hasOwnProperty$
|
|
19206
|
+
var isOwn = hasOwnProperty$k.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$
|
|
19223
|
-
var nativeObjectToString$2 = objectProto$
|
|
19222
|
+
var objectProto$p = Object.prototype;
|
|
19223
|
+
var nativeObjectToString$2 = objectProto$p.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$
|
|
19337
|
-
var funcToString$
|
|
19336
|
+
var funcProto$3 = Function.prototype;
|
|
19337
|
+
var funcToString$3 = funcProto$3.toString;
|
|
19338
19338
|
function toSource$3(func) {
|
|
19339
19339
|
if (func != null) {
|
|
19340
19340
|
try {
|
|
19341
|
-
return funcToString$
|
|
19341
|
+
return funcToString$3.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$
|
|
19354
|
-
var funcToString$
|
|
19355
|
-
var hasOwnProperty$
|
|
19353
|
+
var funcProto$2 = Function.prototype, objectProto$o = Object.prototype;
|
|
19354
|
+
var funcToString$2 = funcProto$2.toString;
|
|
19355
|
+
var hasOwnProperty$j = objectProto$o.hasOwnProperty;
|
|
19356
19356
|
var reIsNative$1 = RegExp(
|
|
19357
|
-
"^" + funcToString$
|
|
19357
|
+
"^" + funcToString$2.call(hasOwnProperty$j).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$
|
|
19488
|
-
var hasOwnProperty$
|
|
19487
|
+
var objectProto$n = Object.prototype;
|
|
19488
|
+
var hasOwnProperty$i = objectProto$n.hasOwnProperty;
|
|
19489
19489
|
function assignValue(object, key, value) {
|
|
19490
19490
|
var objValue = object[key];
|
|
19491
|
-
if (!(hasOwnProperty$
|
|
19491
|
+
if (!(hasOwnProperty$i.call(object, key) && eq$7(objValue, value)) || value === void 0 && !(key in object)) {
|
|
19492
19492
|
baseAssignValue(object, key, value);
|
|
19493
19493
|
}
|
|
19494
19494
|
}
|
|
@@ -19527,9 +19527,6 @@ 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
|
-
}
|
|
19533
19530
|
var MAX_SAFE_INTEGER$4 = 9007199254740991;
|
|
19534
19531
|
function isLength$3(value) {
|
|
19535
19532
|
return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER$4;
|
|
@@ -19547,27 +19544,9 @@ function isIterateeCall(value, index, object) {
|
|
|
19547
19544
|
}
|
|
19548
19545
|
return false;
|
|
19549
19546
|
}
|
|
19550
|
-
|
|
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;
|
|
19547
|
+
var objectProto$m = Object.prototype;
|
|
19569
19548
|
function isPrototype$2(value) {
|
|
19570
|
-
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$
|
|
19549
|
+
var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$m;
|
|
19571
19550
|
return value === proto;
|
|
19572
19551
|
}
|
|
19573
19552
|
function baseTimes$2(n, iteratee) {
|
|
@@ -19581,13 +19560,13 @@ var argsTag$6 = "[object Arguments]";
|
|
|
19581
19560
|
function baseIsArguments$2(value) {
|
|
19582
19561
|
return isObjectLike$5(value) && baseGetTag$5(value) == argsTag$6;
|
|
19583
19562
|
}
|
|
19584
|
-
var objectProto$
|
|
19585
|
-
var hasOwnProperty$
|
|
19586
|
-
var propertyIsEnumerable$3 = objectProto$
|
|
19563
|
+
var objectProto$l = Object.prototype;
|
|
19564
|
+
var hasOwnProperty$h = objectProto$l.hasOwnProperty;
|
|
19565
|
+
var propertyIsEnumerable$3 = objectProto$l.propertyIsEnumerable;
|
|
19587
19566
|
var isArguments$2 = baseIsArguments$2(function() {
|
|
19588
19567
|
return arguments;
|
|
19589
19568
|
}()) ? baseIsArguments$2 : function(value) {
|
|
19590
|
-
return isObjectLike$5(value) && hasOwnProperty$
|
|
19569
|
+
return isObjectLike$5(value) && hasOwnProperty$h.call(value, "callee") && !propertyIsEnumerable$3.call(value, "callee");
|
|
19591
19570
|
};
|
|
19592
19571
|
const isArguments$3 = isArguments$2;
|
|
19593
19572
|
function stubFalse$1() {
|
|
@@ -19600,11 +19579,11 @@ var Buffer$1 = moduleExports$2 ? root$a.Buffer : void 0;
|
|
|
19600
19579
|
var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
|
|
19601
19580
|
var isBuffer$3 = nativeIsBuffer || stubFalse$1;
|
|
19602
19581
|
const isBuffer$4 = isBuffer$3;
|
|
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$
|
|
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]";
|
|
19604
19583
|
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]";
|
|
19605
19584
|
var typedArrayTags$1 = {};
|
|
19606
19585
|
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;
|
|
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$
|
|
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;
|
|
19608
19587
|
function baseIsTypedArray$2(value) {
|
|
19609
19588
|
return isObjectLike$5(value) && isLength$3(value.length) && !!typedArrayTags$1[baseGetTag$5(value)];
|
|
19610
19589
|
}
|
|
@@ -19631,12 +19610,12 @@ const nodeUtil$2 = nodeUtil$1;
|
|
|
19631
19610
|
var nodeIsTypedArray$1 = nodeUtil$2 && nodeUtil$2.isTypedArray;
|
|
19632
19611
|
var isTypedArray$3 = nodeIsTypedArray$1 ? baseUnary$2(nodeIsTypedArray$1) : baseIsTypedArray$2;
|
|
19633
19612
|
const isTypedArray$4 = isTypedArray$3;
|
|
19634
|
-
var objectProto$
|
|
19635
|
-
var hasOwnProperty$
|
|
19613
|
+
var objectProto$k = Object.prototype;
|
|
19614
|
+
var hasOwnProperty$g = objectProto$k.hasOwnProperty;
|
|
19636
19615
|
function arrayLikeKeys$2(value, inherited) {
|
|
19637
19616
|
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;
|
|
19638
19617
|
for (var key in value) {
|
|
19639
|
-
if ((inherited || hasOwnProperty$
|
|
19618
|
+
if ((inherited || hasOwnProperty$g.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
|
|
19640
19619
|
(key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
|
|
19641
19620
|
isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
19642
19621
|
isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
|
|
@@ -19653,15 +19632,15 @@ function overArg$2(func, transform3) {
|
|
|
19653
19632
|
}
|
|
19654
19633
|
var nativeKeys$2 = overArg$2(Object.keys, Object);
|
|
19655
19634
|
const nativeKeys$3 = nativeKeys$2;
|
|
19656
|
-
var objectProto$
|
|
19657
|
-
var hasOwnProperty$
|
|
19635
|
+
var objectProto$j = Object.prototype;
|
|
19636
|
+
var hasOwnProperty$f = objectProto$j.hasOwnProperty;
|
|
19658
19637
|
function baseKeys$2(object) {
|
|
19659
19638
|
if (!isPrototype$2(object)) {
|
|
19660
19639
|
return nativeKeys$3(object);
|
|
19661
19640
|
}
|
|
19662
19641
|
var result = [];
|
|
19663
19642
|
for (var key in Object(object)) {
|
|
19664
|
-
if (hasOwnProperty$
|
|
19643
|
+
if (hasOwnProperty$f.call(object, key) && key != "constructor") {
|
|
19665
19644
|
result.push(key);
|
|
19666
19645
|
}
|
|
19667
19646
|
}
|
|
@@ -19679,15 +19658,15 @@ function nativeKeysIn(object) {
|
|
|
19679
19658
|
}
|
|
19680
19659
|
return result;
|
|
19681
19660
|
}
|
|
19682
|
-
var objectProto$
|
|
19683
|
-
var hasOwnProperty$
|
|
19661
|
+
var objectProto$i = Object.prototype;
|
|
19662
|
+
var hasOwnProperty$e = objectProto$i.hasOwnProperty;
|
|
19684
19663
|
function baseKeysIn(object) {
|
|
19685
19664
|
if (!isObject$3(object)) {
|
|
19686
19665
|
return nativeKeysIn(object);
|
|
19687
19666
|
}
|
|
19688
19667
|
var isProto = isPrototype$2(object), result = [];
|
|
19689
19668
|
for (var key in object) {
|
|
19690
|
-
if (!(key == "constructor" && (isProto || !hasOwnProperty$
|
|
19669
|
+
if (!(key == "constructor" && (isProto || !hasOwnProperty$e.call(object, key)))) {
|
|
19691
19670
|
result.push(key);
|
|
19692
19671
|
}
|
|
19693
19672
|
}
|
|
@@ -19719,21 +19698,21 @@ function hashDelete$2(key) {
|
|
|
19719
19698
|
return result;
|
|
19720
19699
|
}
|
|
19721
19700
|
var HASH_UNDEFINED$5 = "__lodash_hash_undefined__";
|
|
19722
|
-
var objectProto$
|
|
19723
|
-
var hasOwnProperty$
|
|
19701
|
+
var objectProto$h = Object.prototype;
|
|
19702
|
+
var hasOwnProperty$d = objectProto$h.hasOwnProperty;
|
|
19724
19703
|
function hashGet$2(key) {
|
|
19725
19704
|
var data = this.__data__;
|
|
19726
19705
|
if (nativeCreate$6) {
|
|
19727
19706
|
var result = data[key];
|
|
19728
19707
|
return result === HASH_UNDEFINED$5 ? void 0 : result;
|
|
19729
19708
|
}
|
|
19730
|
-
return hasOwnProperty$
|
|
19709
|
+
return hasOwnProperty$d.call(data, key) ? data[key] : void 0;
|
|
19731
19710
|
}
|
|
19732
|
-
var objectProto$
|
|
19733
|
-
var hasOwnProperty$
|
|
19711
|
+
var objectProto$g = Object.prototype;
|
|
19712
|
+
var hasOwnProperty$c = objectProto$g.hasOwnProperty;
|
|
19734
19713
|
function hashHas$2(key) {
|
|
19735
19714
|
var data = this.__data__;
|
|
19736
|
-
return nativeCreate$6 ? data[key] !== void 0 : hasOwnProperty$
|
|
19715
|
+
return nativeCreate$6 ? data[key] !== void 0 : hasOwnProperty$c.call(data, key);
|
|
19737
19716
|
}
|
|
19738
19717
|
var HASH_UNDEFINED$4 = "__lodash_hash_undefined__";
|
|
19739
19718
|
function hashSet$2(key, value) {
|
|
@@ -19971,22 +19950,6 @@ function flatRest(func) {
|
|
|
19971
19950
|
}
|
|
19972
19951
|
var getPrototype = overArg$2(Object.getPrototypeOf, Object);
|
|
19973
19952
|
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
|
-
}
|
|
19990
19953
|
function stackClear$2() {
|
|
19991
19954
|
this.__data__ = new ListCache$5();
|
|
19992
19955
|
this.size = 0;
|
|
@@ -20751,86 +20714,6 @@ function debounce(func, wait, options) {
|
|
|
20751
20714
|
debounced.flush = flush;
|
|
20752
20715
|
return debounced;
|
|
20753
20716
|
}
|
|
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
|
-
}
|
|
20834
20717
|
function arrayEvery(array, predicate) {
|
|
20835
20718
|
var index = -1, length = array == null ? 0 : array.length;
|
|
20836
20719
|
while (++index < length) {
|
|
@@ -20861,10 +20744,6 @@ function isEqual$1(value, other) {
|
|
|
20861
20744
|
function isMatch(object, source) {
|
|
20862
20745
|
return object === source || baseIsMatch(object, source, getMatchData(source));
|
|
20863
20746
|
}
|
|
20864
|
-
var merge = createAssigner(function(object, source, srcIndex) {
|
|
20865
|
-
baseMerge(object, source, srcIndex);
|
|
20866
|
-
});
|
|
20867
|
-
const merge$1 = merge;
|
|
20868
20747
|
function baseSet(object, path, value, customizer) {
|
|
20869
20748
|
if (!isObject$3(object)) {
|
|
20870
20749
|
return object;
|
|
@@ -25006,6 +24885,20 @@ function getNextScope(prevScopes) {
|
|
|
25006
24885
|
} while (prevScopes.includes(nextScope));
|
|
25007
24886
|
return nextScope;
|
|
25008
24887
|
}
|
|
24888
|
+
function createPrefixedGetNextScopeNumeric(prefix2) {
|
|
24889
|
+
return (prevScopes) => {
|
|
24890
|
+
let nextScopeInt = 0;
|
|
24891
|
+
let nextScopeStr;
|
|
24892
|
+
do {
|
|
24893
|
+
nextScopeStr = `${prefix2}${nextScopeInt}`;
|
|
24894
|
+
nextScopeInt += 1;
|
|
24895
|
+
} while (prevScopes.includes(nextScopeStr));
|
|
24896
|
+
return nextScopeStr;
|
|
24897
|
+
};
|
|
24898
|
+
}
|
|
24899
|
+
function getInitialCoordinationScopePrefix(datasetUid, dataType) {
|
|
24900
|
+
return `init_${datasetUid}_${dataType}_`;
|
|
24901
|
+
}
|
|
25009
24902
|
let getRandomValues;
|
|
25010
24903
|
const rnds8 = new Uint8Array(16);
|
|
25011
24904
|
function rng() {
|
|
@@ -35161,7 +35054,9 @@ const FileType$1 = {
|
|
|
35161
35054
|
OBS_SEGMENTATIONS_JSON: "obsSegmentations.json",
|
|
35162
35055
|
OBS_SETS_CSV: "obsSets.csv",
|
|
35163
35056
|
OBS_SETS_JSON: "obsSets.json",
|
|
35057
|
+
// OME-Zarr
|
|
35164
35058
|
IMAGE_OME_ZARR: "image.ome-zarr",
|
|
35059
|
+
OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
|
|
35165
35060
|
// AnnData
|
|
35166
35061
|
OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
|
|
35167
35062
|
OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
|
|
@@ -35344,6 +35239,7 @@ const STATUS = {
|
|
|
35344
35239
|
};
|
|
35345
35240
|
const DATA_TYPE_COORDINATION_VALUE_USAGE = {
|
|
35346
35241
|
[DataType$1.OBS_SEGMENTATIONS]: [
|
|
35242
|
+
CoordinationType$1.FILE_UID,
|
|
35347
35243
|
CoordinationType$1.OBS_TYPE
|
|
35348
35244
|
],
|
|
35349
35245
|
[DataType$1.OBS_EMBEDDING]: [
|
|
@@ -35375,7 +35271,9 @@ const DATA_TYPE_COORDINATION_VALUE_USAGE = {
|
|
|
35375
35271
|
CoordinationType$1.FEATURE_VALUE_TYPE
|
|
35376
35272
|
],
|
|
35377
35273
|
[DataType$1.GENOMIC_PROFILES]: [],
|
|
35378
|
-
[DataType$1.IMAGE]: [
|
|
35274
|
+
[DataType$1.IMAGE]: [
|
|
35275
|
+
CoordinationType$1.FILE_UID
|
|
35276
|
+
],
|
|
35379
35277
|
[DataType$1.NEIGHBORHOODS]: []
|
|
35380
35278
|
};
|
|
35381
35279
|
const AUTO_INDEPENDENT_COORDINATION_TYPES = [
|
|
@@ -35394,10 +35292,10 @@ const AUTO_INDEPENDENT_COORDINATION_TYPES = [
|
|
|
35394
35292
|
CoordinationType$1.EMBEDDING_OBS_OPACITY
|
|
35395
35293
|
];
|
|
35396
35294
|
const note = "This file is autogenerated by .changeset/post-changelog.mjs.";
|
|
35397
|
-
const version = "3.3.
|
|
35398
|
-
const date = "
|
|
35295
|
+
const version = "3.3.3";
|
|
35296
|
+
const date = "2024-01-25";
|
|
35399
35297
|
const branch = "changeset-release/main";
|
|
35400
|
-
const hash = "
|
|
35298
|
+
const hash = "c2264756";
|
|
35401
35299
|
const META_VERSION = {
|
|
35402
35300
|
note,
|
|
35403
35301
|
version,
|
|
@@ -35753,30 +35651,39 @@ const omeCoordinateTransformations = z.array(z.union([
|
|
|
35753
35651
|
scale: z.array(z.number())
|
|
35754
35652
|
})
|
|
35755
35653
|
]));
|
|
35756
|
-
z.object({
|
|
35654
|
+
const imageOmeTiffSchema = z.object({
|
|
35757
35655
|
offsetsUrl: z.string().optional(),
|
|
35758
35656
|
coordinateTransformations: omeCoordinateTransformations.optional()
|
|
35759
35657
|
});
|
|
35658
|
+
imageOmeTiffSchema.extend({
|
|
35659
|
+
obsTypesFromChannelNames: z.boolean().optional()
|
|
35660
|
+
});
|
|
35760
35661
|
const imageOmeZarrSchema = z.object({
|
|
35761
35662
|
coordinateTransformations: omeCoordinateTransformations.optional()
|
|
35762
35663
|
});
|
|
35763
35664
|
imageOmeZarrSchema.extend({
|
|
35665
|
+
obsTypesFromChannelNames: z.boolean().optional()
|
|
35666
|
+
});
|
|
35667
|
+
const imageSpatialdataSchema = imageOmeZarrSchema.extend({
|
|
35764
35668
|
path: z.string()
|
|
35765
35669
|
});
|
|
35766
|
-
z.object({
|
|
35670
|
+
const obsSegmentationsSpatialdataSchema = z.object({
|
|
35671
|
+
// TODO: should this also extend the imageOmeZarrSchema?
|
|
35672
|
+
// TODO: should this be renamed labelsSpatialdataSchema?
|
|
35673
|
+
// TODO: support obsTypesFromChannelNames?
|
|
35767
35674
|
path: z.string()
|
|
35768
35675
|
});
|
|
35769
35676
|
z.object({
|
|
35770
35677
|
path: z.string()
|
|
35771
35678
|
});
|
|
35772
|
-
z.object({
|
|
35679
|
+
const obsSpotsSpatialdataSchema = z.object({
|
|
35773
35680
|
path: z.string(),
|
|
35774
35681
|
tablePath: z.string().optional().describe("The path to a table which annotates the spots. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected.")
|
|
35775
35682
|
});
|
|
35776
|
-
annDataObsFeatureMatrix.extend({
|
|
35683
|
+
const obsFeatureMatrixSpatialdataSchema = annDataObsFeatureMatrix.extend({
|
|
35777
35684
|
region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
|
|
35778
35685
|
});
|
|
35779
|
-
z.object({
|
|
35686
|
+
const obsSetsSpatialdataSchema = z.object({
|
|
35780
35687
|
region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
|
|
35781
35688
|
tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
|
|
35782
35689
|
obsSets: annDataObsSets
|
|
@@ -35839,6 +35746,19 @@ z.object({
|
|
|
35839
35746
|
z.array(annDataConvenienceObsEmbeddingItem)
|
|
35840
35747
|
])
|
|
35841
35748
|
}).partial();
|
|
35749
|
+
z.object({
|
|
35750
|
+
// TODO: should `image` be a special schema
|
|
35751
|
+
// to allow specifying fileUid (like for embeddingType)?
|
|
35752
|
+
image: imageSpatialdataSchema,
|
|
35753
|
+
// TODO: should this be a special schema
|
|
35754
|
+
// to allow specifying fileUid (like for embeddingType)?
|
|
35755
|
+
labels: obsSegmentationsSpatialdataSchema,
|
|
35756
|
+
obsFeatureMatrix: obsFeatureMatrixSpatialdataSchema,
|
|
35757
|
+
obsSpots: obsSpotsSpatialdataSchema,
|
|
35758
|
+
// TODO: obsPoints
|
|
35759
|
+
// TODO: obsLocations
|
|
35760
|
+
obsSets: obsSetsSpatialdataSchema
|
|
35761
|
+
}).partial();
|
|
35842
35762
|
z.object({
|
|
35843
35763
|
obsLabelsTypes: z.array(z.string()).optional(),
|
|
35844
35764
|
embeddingTypes: z.array(z.string()).optional()
|
|
@@ -36185,6 +36105,712 @@ function shallow(objA, objB) {
|
|
|
36185
36105
|
}
|
|
36186
36106
|
return true;
|
|
36187
36107
|
}
|
|
36108
|
+
class VitessceConfigDatasetFile {
|
|
36109
|
+
/**
|
|
36110
|
+
* Construct a new file definition instance.
|
|
36111
|
+
* @param {string} url The URL to the file.
|
|
36112
|
+
* @param {string} dataType The type of data contained in the file.
|
|
36113
|
+
* @param {string} fileType The file type.
|
|
36114
|
+
* @param {object|array|null} options An optional object or array
|
|
36115
|
+
* which may provide additional parameters to the loader class
|
|
36116
|
+
* corresponding to the specified fileType.
|
|
36117
|
+
*/
|
|
36118
|
+
constructor(url, fileType, coordinationValues, options) {
|
|
36119
|
+
this.file = {
|
|
36120
|
+
url,
|
|
36121
|
+
fileType,
|
|
36122
|
+
...coordinationValues ? { coordinationValues } : {},
|
|
36123
|
+
...options ? { options } : {}
|
|
36124
|
+
};
|
|
36125
|
+
}
|
|
36126
|
+
/**
|
|
36127
|
+
* @returns {object} This dataset file as a JSON object.
|
|
36128
|
+
*/
|
|
36129
|
+
toJSON() {
|
|
36130
|
+
return this.file;
|
|
36131
|
+
}
|
|
36132
|
+
}
|
|
36133
|
+
class VitessceConfigDataset {
|
|
36134
|
+
/**
|
|
36135
|
+
* Construct a new dataset definition instance.
|
|
36136
|
+
* @param {string} uid The unique ID for the dataset.
|
|
36137
|
+
* @param {string} name The name of the dataset.
|
|
36138
|
+
* @param {string} description A description for the dataset.
|
|
36139
|
+
*/
|
|
36140
|
+
constructor(uid, name, description) {
|
|
36141
|
+
this.dataset = {
|
|
36142
|
+
uid,
|
|
36143
|
+
name,
|
|
36144
|
+
description,
|
|
36145
|
+
files: []
|
|
36146
|
+
};
|
|
36147
|
+
}
|
|
36148
|
+
/**
|
|
36149
|
+
* Add a file definition to the dataset.
|
|
36150
|
+
* @param {object} params An object with named arguments.
|
|
36151
|
+
* @param {string|undefined} params.url The URL to the file.
|
|
36152
|
+
* @param {string} params.fileType The file type.
|
|
36153
|
+
* @param {object|undefined} params.coordinationValues The coordination values.
|
|
36154
|
+
* @param {object|array|undefined} params.options An optional object or array
|
|
36155
|
+
* which may provide additional parameters to the loader class
|
|
36156
|
+
* corresponding to the specified fileType.
|
|
36157
|
+
* @returns {VitessceConfigDataset} This, to allow chaining.
|
|
36158
|
+
*/
|
|
36159
|
+
addFile(params, ...args) {
|
|
36160
|
+
let url;
|
|
36161
|
+
let fileType;
|
|
36162
|
+
let coordinationValues;
|
|
36163
|
+
let options;
|
|
36164
|
+
if (args.length > 0) {
|
|
36165
|
+
url = params;
|
|
36166
|
+
let dataType;
|
|
36167
|
+
if (args.length === 2) {
|
|
36168
|
+
[dataType, fileType] = args;
|
|
36169
|
+
} else if (args.length === 3) {
|
|
36170
|
+
[dataType, fileType, options] = args;
|
|
36171
|
+
}
|
|
36172
|
+
} else if (typeof params === "object") {
|
|
36173
|
+
({
|
|
36174
|
+
url,
|
|
36175
|
+
fileType,
|
|
36176
|
+
options,
|
|
36177
|
+
coordinationValues
|
|
36178
|
+
} = params);
|
|
36179
|
+
} else {
|
|
36180
|
+
throw new Error("Expected addFile argument to be an object.");
|
|
36181
|
+
}
|
|
36182
|
+
this.dataset.files.push(new VitessceConfigDatasetFile(url, fileType, coordinationValues, options));
|
|
36183
|
+
return this;
|
|
36184
|
+
}
|
|
36185
|
+
/**
|
|
36186
|
+
* @returns {object} This dataset as a JSON object.
|
|
36187
|
+
*/
|
|
36188
|
+
toJSON() {
|
|
36189
|
+
return {
|
|
36190
|
+
...this.dataset,
|
|
36191
|
+
files: this.dataset.files.map((f) => f.toJSON())
|
|
36192
|
+
};
|
|
36193
|
+
}
|
|
36194
|
+
}
|
|
36195
|
+
function useCoordinationByObjectHelper(scopes, coordinationScopes, coordinationScopesBy) {
|
|
36196
|
+
function processLevel(parentType, parentScope, levelType, levelVal) {
|
|
36197
|
+
var _a, _b;
|
|
36198
|
+
if (Array.isArray(levelVal)) {
|
|
36199
|
+
coordinationScopesBy[parentType] = {
|
|
36200
|
+
...coordinationScopesBy[parentType] || {},
|
|
36201
|
+
[levelType]: {
|
|
36202
|
+
...((_a = coordinationScopesBy[parentType]) == null ? void 0 : _a[levelType]) || {},
|
|
36203
|
+
[parentScope.cScope]: levelVal.map((childVal) => childVal.scope.cScope)
|
|
36204
|
+
}
|
|
36205
|
+
};
|
|
36206
|
+
levelVal.forEach((childVal) => {
|
|
36207
|
+
if (childVal.children) {
|
|
36208
|
+
Object.entries(childVal.children).forEach(([nextLevelType, nextLevelVal]) => processLevel(levelType, childVal.scope, nextLevelType, nextLevelVal));
|
|
36209
|
+
}
|
|
36210
|
+
});
|
|
36211
|
+
} else {
|
|
36212
|
+
coordinationScopesBy[parentType] = {
|
|
36213
|
+
...coordinationScopesBy[parentType] || {},
|
|
36214
|
+
[levelType]: {
|
|
36215
|
+
...((_b = coordinationScopesBy[parentType]) == null ? void 0 : _b[levelType]) || {},
|
|
36216
|
+
[parentScope.cScope]: levelVal.scope.cScope
|
|
36217
|
+
}
|
|
36218
|
+
};
|
|
36219
|
+
if (levelVal.children) {
|
|
36220
|
+
Object.entries(levelVal.children).forEach(([nextLevelType, nextLevelVal]) => processLevel(levelType, levelVal.scope, nextLevelType, nextLevelVal));
|
|
36221
|
+
}
|
|
36222
|
+
}
|
|
36223
|
+
}
|
|
36224
|
+
Object.entries(scopes).forEach(([topLevelType, topLevelVal]) => {
|
|
36225
|
+
if (Array.isArray(topLevelVal)) {
|
|
36226
|
+
coordinationScopes[topLevelType] = topLevelVal.map((levelVal) => levelVal.scope.cScope);
|
|
36227
|
+
topLevelVal.forEach((levelVal) => {
|
|
36228
|
+
if (levelVal.children) {
|
|
36229
|
+
Object.entries(levelVal.children).forEach(([nextLevelType, nextLevelVal]) => processLevel(topLevelType, levelVal.scope, nextLevelType, nextLevelVal));
|
|
36230
|
+
}
|
|
36231
|
+
});
|
|
36232
|
+
} else {
|
|
36233
|
+
coordinationScopes[topLevelType] = topLevelVal.scope.cScope;
|
|
36234
|
+
if (topLevelVal.children) {
|
|
36235
|
+
Object.entries(topLevelVal.children).forEach(([nextLevelType, nextLevelVal]) => processLevel(topLevelType, topLevelVal.scope, nextLevelType, nextLevelVal));
|
|
36236
|
+
}
|
|
36237
|
+
}
|
|
36238
|
+
});
|
|
36239
|
+
return [coordinationScopes, coordinationScopesBy];
|
|
36240
|
+
}
|
|
36241
|
+
class VitessceConfigView {
|
|
36242
|
+
/**
|
|
36243
|
+
* Construct a new view instance.
|
|
36244
|
+
* @param {string} component The name of the Vitessce component type.
|
|
36245
|
+
* @param {object} coordinationScopes A mapping from coordination type
|
|
36246
|
+
* names to coordination scope names.
|
|
36247
|
+
* @param {number} x The x-coordinate of the view in the layout.
|
|
36248
|
+
* @param {number} y The y-coordinate of the view in the layout.
|
|
36249
|
+
* @param {number} w The width of the view in the layout.
|
|
36250
|
+
* @param {number} h The height of the view in the layout.
|
|
36251
|
+
*/
|
|
36252
|
+
constructor(component, coordinationScopes, x, y, w, h) {
|
|
36253
|
+
this.view = {
|
|
36254
|
+
component,
|
|
36255
|
+
coordinationScopes,
|
|
36256
|
+
coordinationScopesBy: void 0,
|
|
36257
|
+
x,
|
|
36258
|
+
y,
|
|
36259
|
+
w,
|
|
36260
|
+
h
|
|
36261
|
+
};
|
|
36262
|
+
}
|
|
36263
|
+
/**
|
|
36264
|
+
* Attach coordination scopes to this view.
|
|
36265
|
+
* @param {...VitessceConfigCoordinationScope} args A variable number of
|
|
36266
|
+
* coordination scope instances.
|
|
36267
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
36268
|
+
*/
|
|
36269
|
+
useCoordination(...args) {
|
|
36270
|
+
const cScopes = args;
|
|
36271
|
+
cScopes.forEach((cScope) => {
|
|
36272
|
+
this.view.coordinationScopes[cScope.cType] = cScope.cScope;
|
|
36273
|
+
});
|
|
36274
|
+
return this;
|
|
36275
|
+
}
|
|
36276
|
+
/**
|
|
36277
|
+
* Attach potentially multi-level coordination scopes to this view.
|
|
36278
|
+
* @param {object} scopes A value returned by `VitessceConfig.addCoordinationByObject`.
|
|
36279
|
+
* Not intended to be a manually-constructed object.
|
|
36280
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
36281
|
+
*/
|
|
36282
|
+
useCoordinationByObject(scopes) {
|
|
36283
|
+
if (!this.view.coordinationScopes) {
|
|
36284
|
+
this.view.coordinationScopes = {};
|
|
36285
|
+
}
|
|
36286
|
+
if (!this.view.coordinationScopesBy) {
|
|
36287
|
+
this.view.coordinationScopesBy = {};
|
|
36288
|
+
}
|
|
36289
|
+
const [nextCoordinationScopes, nextCoordinationScopesBy] = useCoordinationByObjectHelper(scopes, this.view.coordinationScopes, this.view.coordinationScopesBy);
|
|
36290
|
+
this.view.coordinationScopes = nextCoordinationScopes;
|
|
36291
|
+
this.view.coordinationScopesBy = nextCoordinationScopesBy;
|
|
36292
|
+
return this;
|
|
36293
|
+
}
|
|
36294
|
+
/**
|
|
36295
|
+
* Attach meta coordination scopes to this view.
|
|
36296
|
+
* @param {VitessceConfigMetaCoordinationScope} metaScope A meta coordination scope instance.
|
|
36297
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
36298
|
+
*/
|
|
36299
|
+
useMetaCoordination(metaScope) {
|
|
36300
|
+
if (!this.view.coordinationScopes) {
|
|
36301
|
+
this.view.coordinationScopes = {};
|
|
36302
|
+
}
|
|
36303
|
+
this.view.coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES] = [
|
|
36304
|
+
...this.view.coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES] || [],
|
|
36305
|
+
metaScope.metaScope.cScope
|
|
36306
|
+
];
|
|
36307
|
+
this.view.coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES_BY] = [
|
|
36308
|
+
...this.view.coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES_BY] || [],
|
|
36309
|
+
metaScope.metaByScope.cScope
|
|
36310
|
+
];
|
|
36311
|
+
return this;
|
|
36312
|
+
}
|
|
36313
|
+
/**
|
|
36314
|
+
* Set the x, y, w, h values for this view.
|
|
36315
|
+
* @param {number} x The x-coordinate of the view in the layout.
|
|
36316
|
+
* @param {number} y The y-coordinate of the view in the layout.
|
|
36317
|
+
* @param {number} w The width of the view in the layout.
|
|
36318
|
+
* @param {number} h The height of the view in the layout.
|
|
36319
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
36320
|
+
*/
|
|
36321
|
+
setXYWH(x, y, w, h) {
|
|
36322
|
+
this.view.x = x;
|
|
36323
|
+
this.view.y = y;
|
|
36324
|
+
this.view.w = w;
|
|
36325
|
+
this.view.h = h;
|
|
36326
|
+
return this;
|
|
36327
|
+
}
|
|
36328
|
+
/**
|
|
36329
|
+
* Set props for this view.
|
|
36330
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
36331
|
+
*/
|
|
36332
|
+
setProps(props) {
|
|
36333
|
+
this.view.props = {
|
|
36334
|
+
...this.view.props || {},
|
|
36335
|
+
...props
|
|
36336
|
+
};
|
|
36337
|
+
return this;
|
|
36338
|
+
}
|
|
36339
|
+
/**
|
|
36340
|
+
* @returns {object} This view as a JSON object.
|
|
36341
|
+
*/
|
|
36342
|
+
toJSON() {
|
|
36343
|
+
return this.view;
|
|
36344
|
+
}
|
|
36345
|
+
}
|
|
36346
|
+
class VitessceConfigViewHConcat {
|
|
36347
|
+
constructor(views) {
|
|
36348
|
+
this.views = views;
|
|
36349
|
+
}
|
|
36350
|
+
}
|
|
36351
|
+
class VitessceConfigViewVConcat {
|
|
36352
|
+
constructor(views) {
|
|
36353
|
+
this.views = views;
|
|
36354
|
+
}
|
|
36355
|
+
}
|
|
36356
|
+
class CoordinationLevel {
|
|
36357
|
+
constructor(value) {
|
|
36358
|
+
this.value = value;
|
|
36359
|
+
this.cachedValue = null;
|
|
36360
|
+
}
|
|
36361
|
+
setCached(processedLevel) {
|
|
36362
|
+
this.cachedValue = processedLevel;
|
|
36363
|
+
}
|
|
36364
|
+
getCached() {
|
|
36365
|
+
return this.cachedValue;
|
|
36366
|
+
}
|
|
36367
|
+
isCached() {
|
|
36368
|
+
return this.cachedValue !== null;
|
|
36369
|
+
}
|
|
36370
|
+
}
|
|
36371
|
+
class VitessceConfigCoordinationScope {
|
|
36372
|
+
/**
|
|
36373
|
+
* Construct a new coordination scope instance.
|
|
36374
|
+
* @param {string} cType The coordination type for this coordination scope.
|
|
36375
|
+
* @param {string} cScope The name of the coordination scope.
|
|
36376
|
+
* @param {[any]} cValue Optional. The coordination value of the coordination scope.
|
|
36377
|
+
*/
|
|
36378
|
+
constructor(cType, cScope, cValue = null) {
|
|
36379
|
+
this.cType = cType;
|
|
36380
|
+
this.cScope = cScope;
|
|
36381
|
+
this.cValue = cValue;
|
|
36382
|
+
}
|
|
36383
|
+
/**
|
|
36384
|
+
* Set the coordination value of the coordination scope.
|
|
36385
|
+
* @param {any} cValue The value to set.
|
|
36386
|
+
* @returns {VitessceConfigCoordinationScope} This, to allow chaining.
|
|
36387
|
+
*/
|
|
36388
|
+
setValue(cValue) {
|
|
36389
|
+
this.cValue = cValue;
|
|
36390
|
+
return this;
|
|
36391
|
+
}
|
|
36392
|
+
}
|
|
36393
|
+
class VitessceConfigMetaCoordinationScope {
|
|
36394
|
+
/**
|
|
36395
|
+
* Construct a new coordination scope instance.
|
|
36396
|
+
* @param {string} metaScope The name of the coordination scope for metaCoordinationScopes.
|
|
36397
|
+
* @param {string} metaByScope The name of the coordination scope for metaCoordinationScopesBy.
|
|
36398
|
+
*/
|
|
36399
|
+
constructor(metaScope, metaByScope) {
|
|
36400
|
+
this.metaScope = new VitessceConfigCoordinationScope(CoordinationType$1.META_COORDINATION_SCOPES, metaScope);
|
|
36401
|
+
this.metaByScope = new VitessceConfigCoordinationScope(CoordinationType$1.META_COORDINATION_SCOPES_BY, metaByScope);
|
|
36402
|
+
}
|
|
36403
|
+
/**
|
|
36404
|
+
* Attach coordination scopes to this meta scope.
|
|
36405
|
+
* @param {...VitessceConfigCoordinationScope} args A variable number of
|
|
36406
|
+
* coordination scope instances.
|
|
36407
|
+
* @returns {VitessceConfigMetaCoordinationScope} This, to allow chaining.
|
|
36408
|
+
*/
|
|
36409
|
+
useCoordination(...args) {
|
|
36410
|
+
const cScopes = args;
|
|
36411
|
+
const metaScopesVal = this.metaScope.cValue;
|
|
36412
|
+
cScopes.forEach((cScope) => {
|
|
36413
|
+
metaScopesVal[cScope.cType] = cScope.cScope;
|
|
36414
|
+
});
|
|
36415
|
+
this.metaScope.setValue(metaScopesVal);
|
|
36416
|
+
return this;
|
|
36417
|
+
}
|
|
36418
|
+
/**
|
|
36419
|
+
* Attach potentially multi-level coordination scopes to this meta coordination
|
|
36420
|
+
* scope instance.
|
|
36421
|
+
* @param {object} scopes A value returned by `VitessceConfig.addCoordinationByObject`.
|
|
36422
|
+
* Not intended to be a manually-constructed object.
|
|
36423
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
36424
|
+
*/
|
|
36425
|
+
useCoordinationByObject(scopes) {
|
|
36426
|
+
if (!this.metaScope.cValue) {
|
|
36427
|
+
this.metaScope.setValue({});
|
|
36428
|
+
}
|
|
36429
|
+
if (!this.metaByScope.cValue) {
|
|
36430
|
+
this.metaByScope.setValue({});
|
|
36431
|
+
}
|
|
36432
|
+
const [metaScopesVal, metaByScopesVal] = useCoordinationByObjectHelper(scopes, this.metaScope.cValue, this.metaByScope.cValue);
|
|
36433
|
+
this.metaScope.setValue(metaScopesVal);
|
|
36434
|
+
this.metaByScope.setValue(metaByScopesVal);
|
|
36435
|
+
return this;
|
|
36436
|
+
}
|
|
36437
|
+
}
|
|
36438
|
+
class VitessceConfig {
|
|
36439
|
+
/**
|
|
36440
|
+
* Construct a new view config instance.
|
|
36441
|
+
* @param {object} params An object with named arguments.
|
|
36442
|
+
* @param {string} params.schemaVersion The view config schema version. Required.
|
|
36443
|
+
* @param {string} params.name A name for the config. Optional.
|
|
36444
|
+
* @param {string|undefined} params.description A description for the config. Optional.
|
|
36445
|
+
*/
|
|
36446
|
+
constructor(params, ...args) {
|
|
36447
|
+
let name;
|
|
36448
|
+
let description;
|
|
36449
|
+
let schemaVersion;
|
|
36450
|
+
if (typeof params === "string") {
|
|
36451
|
+
schemaVersion = "1.0.7";
|
|
36452
|
+
name = params || "";
|
|
36453
|
+
if (args.length === 1) {
|
|
36454
|
+
[description] = args;
|
|
36455
|
+
} else if (args.length > 1) {
|
|
36456
|
+
throw new Error("Expected only one VitessceConfig constructor argument.");
|
|
36457
|
+
}
|
|
36458
|
+
} else if (typeof params === "object") {
|
|
36459
|
+
({ schemaVersion, name, description } = params);
|
|
36460
|
+
if (!name) {
|
|
36461
|
+
throw new Error("Expected params.name argument in VitessceConfig constructor");
|
|
36462
|
+
}
|
|
36463
|
+
if (!schemaVersion) {
|
|
36464
|
+
throw new Error("Expected params.schemaVersion argument in VitessceConfig constructor");
|
|
36465
|
+
}
|
|
36466
|
+
} else {
|
|
36467
|
+
throw new Error("Expected VitessceConfig constructor argument to be an object.");
|
|
36468
|
+
}
|
|
36469
|
+
this.config = {
|
|
36470
|
+
version: schemaVersion,
|
|
36471
|
+
name,
|
|
36472
|
+
description,
|
|
36473
|
+
datasets: [],
|
|
36474
|
+
coordinationSpace: {},
|
|
36475
|
+
layout: [],
|
|
36476
|
+
initStrategy: "auto"
|
|
36477
|
+
};
|
|
36478
|
+
this.getNextScope = getNextScope;
|
|
36479
|
+
}
|
|
36480
|
+
/**
|
|
36481
|
+
* Add a new dataset to the config.
|
|
36482
|
+
* @param {string} name A name for the dataset. Optional.
|
|
36483
|
+
* @param {string} description A description for the dataset. Optional.
|
|
36484
|
+
* @param {object} options Extra parameters to be used internally. Optional.
|
|
36485
|
+
* @param {string} options.uid Override the automatically-generated dataset ID.
|
|
36486
|
+
* Intended for internal usage by the VitessceConfig.fromJSON code.
|
|
36487
|
+
* @returns {VitessceConfigDataset} A new dataset instance.
|
|
36488
|
+
*/
|
|
36489
|
+
addDataset(name = void 0, description = void 0, options = void 0) {
|
|
36490
|
+
const { uid } = options || {};
|
|
36491
|
+
const prevDatasetUids = this.config.datasets.map((d) => d.dataset.uid);
|
|
36492
|
+
const nextUid = uid || this.getNextScope(prevDatasetUids);
|
|
36493
|
+
const newDataset = new VitessceConfigDataset(nextUid, name, description);
|
|
36494
|
+
this.config.datasets.push(newDataset);
|
|
36495
|
+
const [newScope] = this.addCoordination(CoordinationType$1.DATASET);
|
|
36496
|
+
newScope.setValue(nextUid);
|
|
36497
|
+
return newDataset;
|
|
36498
|
+
}
|
|
36499
|
+
/**
|
|
36500
|
+
* Add a new view to the config.
|
|
36501
|
+
* @param {VitessceConfigDataset} dataset The dataset instance which defines the data
|
|
36502
|
+
* that will be displayed in the view.
|
|
36503
|
+
* @param {string} component A component name, such as "scatterplot" or "spatial".
|
|
36504
|
+
* @param {object} options Extra options for the component.
|
|
36505
|
+
* @param {number} options.x The x-coordinate for the view in the grid layout.
|
|
36506
|
+
* @param {number} options.y The y-coordinate for the view in the grid layout.
|
|
36507
|
+
* @param {number} options.w The width for the view in the grid layout.
|
|
36508
|
+
* @param {number} options.h The height for the view in the grid layout.
|
|
36509
|
+
* @param {number} options.mapping A convenience parameter for setting the EMBEDDING_TYPE
|
|
36510
|
+
* coordination value. Only applicable if the component is "scatterplot".
|
|
36511
|
+
* @returns {VitessceConfigView} A new view instance.
|
|
36512
|
+
*/
|
|
36513
|
+
addView(dataset, component, options) {
|
|
36514
|
+
const { x = 0, y = 0, w = 1, h = 1, mapping = null } = options || {};
|
|
36515
|
+
const datasetMatches = this.config.coordinationSpace[CoordinationType$1.DATASET] ? Object.entries(this.config.coordinationSpace[CoordinationType$1.DATASET]).filter(([scopeName, datasetScope2]) => datasetScope2.cValue === dataset.dataset.uid).map(([scopeName]) => scopeName) : [];
|
|
36516
|
+
let datasetScope;
|
|
36517
|
+
if (datasetMatches.length === 1) {
|
|
36518
|
+
[datasetScope] = datasetMatches;
|
|
36519
|
+
} else {
|
|
36520
|
+
throw new Error("No coordination scope matching the dataset parameter could be found in the coordination space.");
|
|
36521
|
+
}
|
|
36522
|
+
const coordinationScopes = {
|
|
36523
|
+
[CoordinationType$1.DATASET]: datasetScope
|
|
36524
|
+
};
|
|
36525
|
+
const newView = new VitessceConfigView(component, coordinationScopes, x, y, w, h);
|
|
36526
|
+
if (mapping) {
|
|
36527
|
+
const [etScope] = this.addCoordination(CoordinationType$1.EMBEDDING_TYPE);
|
|
36528
|
+
etScope.setValue(mapping);
|
|
36529
|
+
newView.useCoordination(etScope);
|
|
36530
|
+
}
|
|
36531
|
+
this.config.layout.push(newView);
|
|
36532
|
+
return newView;
|
|
36533
|
+
}
|
|
36534
|
+
/**
|
|
36535
|
+
* Get an array of new coordination scope instances corresponding to coordination types
|
|
36536
|
+
* of interest.
|
|
36537
|
+
* @param {...string} args A variable number of coordination type names.
|
|
36538
|
+
* @returns {VitessceConfigCoordinationScope[]} An array of coordination scope instances.
|
|
36539
|
+
*/
|
|
36540
|
+
addCoordination(...args) {
|
|
36541
|
+
const cTypes = args;
|
|
36542
|
+
const result = [];
|
|
36543
|
+
cTypes.forEach((cType) => {
|
|
36544
|
+
const prevScopes = this.config.coordinationSpace[cType] ? Object.keys(this.config.coordinationSpace[cType]) : [];
|
|
36545
|
+
const scope = new VitessceConfigCoordinationScope(cType, this.getNextScope(prevScopes));
|
|
36546
|
+
if (!this.config.coordinationSpace[scope.cType]) {
|
|
36547
|
+
this.config.coordinationSpace[scope.cType] = {};
|
|
36548
|
+
}
|
|
36549
|
+
this.config.coordinationSpace[scope.cType][scope.cScope] = scope;
|
|
36550
|
+
result.push(scope);
|
|
36551
|
+
});
|
|
36552
|
+
return result;
|
|
36553
|
+
}
|
|
36554
|
+
/**
|
|
36555
|
+
* Initialize a new meta coordination scope in the coordination space,
|
|
36556
|
+
* and get a reference to it in the form of a meta coordination scope instance.
|
|
36557
|
+
* @returns {VitessceConfigMetaCoordinationScope} A new meta coordination scope instance.
|
|
36558
|
+
*/
|
|
36559
|
+
addMetaCoordination() {
|
|
36560
|
+
const prevMetaScopes = this.config.coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES] ? Object.keys(this.config.coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES]) : [];
|
|
36561
|
+
const prevMetaByScopes = this.config.coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES_BY] ? Object.keys(this.config.coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES_BY]) : [];
|
|
36562
|
+
const metaContainer = new VitessceConfigMetaCoordinationScope(this.getNextScope(prevMetaScopes), this.getNextScope(prevMetaByScopes));
|
|
36563
|
+
if (!this.config.coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES]) {
|
|
36564
|
+
this.config.coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES] = {};
|
|
36565
|
+
}
|
|
36566
|
+
if (!this.config.coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES_BY]) {
|
|
36567
|
+
this.config.coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES_BY] = {};
|
|
36568
|
+
}
|
|
36569
|
+
this.config.coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES][metaContainer.metaScope.cScope] = metaContainer.metaScope;
|
|
36570
|
+
this.config.coordinationSpace[CoordinationType$1.META_COORDINATION_SCOPES_BY][metaContainer.metaByScope.cScope] = metaContainer.metaByScope;
|
|
36571
|
+
return metaContainer;
|
|
36572
|
+
}
|
|
36573
|
+
/**
|
|
36574
|
+
* Set up the initial values for multi-level coordination in the coordination space.
|
|
36575
|
+
* Get a reference to these values to pass to the `useCoordinationByObject` method
|
|
36576
|
+
* of either view or meta coordination scope instances.
|
|
36577
|
+
* @param {object} input A (potentially nested) object with coordination types as keys
|
|
36578
|
+
* and values being either the initial coordination value, a `VitessceConfigCoordinationScope`
|
|
36579
|
+
* instance, or a `CoordinationLevel` instance.
|
|
36580
|
+
* The CL function takes an array of objects as its argument, and returns a CoordinationLevel
|
|
36581
|
+
* instance, to support nesting.
|
|
36582
|
+
* @returns {object} A (potentially nested) object with coordination types as keys and values
|
|
36583
|
+
* being either { scope }, { scope, children }, or an array of these. Not intended to be
|
|
36584
|
+
* manipulated before being passed to a `useCoordinationByObject` function.
|
|
36585
|
+
*/
|
|
36586
|
+
addCoordinationByObject(input) {
|
|
36587
|
+
const processLevel = (level) => {
|
|
36588
|
+
const result = {};
|
|
36589
|
+
if (level === null) {
|
|
36590
|
+
return result;
|
|
36591
|
+
}
|
|
36592
|
+
Object.entries(level).forEach(([cType, nextLevelOrInitialValue]) => {
|
|
36593
|
+
if (nextLevelOrInitialValue instanceof CoordinationLevel) {
|
|
36594
|
+
const nextLevel = nextLevelOrInitialValue.value;
|
|
36595
|
+
if (nextLevelOrInitialValue.isCached()) {
|
|
36596
|
+
result[cType] = nextLevelOrInitialValue.getCached();
|
|
36597
|
+
} else if (Array.isArray(nextLevel)) {
|
|
36598
|
+
const processedLevel = nextLevel.map((nextEl) => {
|
|
36599
|
+
const [dummyScope] = this.addCoordination(cType);
|
|
36600
|
+
dummyScope.setValue("__dummy__");
|
|
36601
|
+
return {
|
|
36602
|
+
scope: dummyScope,
|
|
36603
|
+
children: processLevel(nextEl)
|
|
36604
|
+
};
|
|
36605
|
+
});
|
|
36606
|
+
nextLevelOrInitialValue.setCached(processedLevel);
|
|
36607
|
+
result[cType] = processedLevel;
|
|
36608
|
+
} else {
|
|
36609
|
+
const nextEl = nextLevel;
|
|
36610
|
+
const [dummyScope] = this.addCoordination(cType);
|
|
36611
|
+
dummyScope.setValue("__dummy__");
|
|
36612
|
+
const processedLevel = {
|
|
36613
|
+
scope: dummyScope,
|
|
36614
|
+
children: processLevel(nextEl)
|
|
36615
|
+
};
|
|
36616
|
+
nextLevelOrInitialValue.setCached(processedLevel);
|
|
36617
|
+
result[cType] = processedLevel;
|
|
36618
|
+
}
|
|
36619
|
+
} else {
|
|
36620
|
+
const initialValue = nextLevelOrInitialValue;
|
|
36621
|
+
if (initialValue instanceof VitessceConfigCoordinationScope) {
|
|
36622
|
+
result[cType] = { scope: initialValue };
|
|
36623
|
+
} else {
|
|
36624
|
+
const [scope] = this.addCoordination(cType);
|
|
36625
|
+
scope.setValue(initialValue);
|
|
36626
|
+
result[cType] = { scope };
|
|
36627
|
+
}
|
|
36628
|
+
}
|
|
36629
|
+
});
|
|
36630
|
+
return result;
|
|
36631
|
+
};
|
|
36632
|
+
const output = processLevel(input);
|
|
36633
|
+
return output;
|
|
36634
|
+
}
|
|
36635
|
+
/**
|
|
36636
|
+
* A convenience function for setting up new coordination scopes across a set of views.
|
|
36637
|
+
* @param {VitessceConfigView[]} views An array of view objects to link together.
|
|
36638
|
+
* @param {string[]} cTypes The coordination types on which to coordinate the views.
|
|
36639
|
+
* @param {any[]} cValues Initial values corresponding to each coordination type.
|
|
36640
|
+
* Should have the same length as the cTypes array. Optional.
|
|
36641
|
+
* @returns {VitessceConfig} This, to allow chaining.
|
|
36642
|
+
*/
|
|
36643
|
+
linkViews(views, cTypes, cValues = null) {
|
|
36644
|
+
const cScopes = this.addCoordination(...cTypes);
|
|
36645
|
+
views.forEach((view) => {
|
|
36646
|
+
cScopes.forEach((cScope) => {
|
|
36647
|
+
view.useCoordination(cScope);
|
|
36648
|
+
});
|
|
36649
|
+
});
|
|
36650
|
+
if (Array.isArray(cValues) && cValues.length === cTypes.length) {
|
|
36651
|
+
cScopes.forEach((cScope, i) => {
|
|
36652
|
+
cScope.setValue(cValues[i]);
|
|
36653
|
+
});
|
|
36654
|
+
}
|
|
36655
|
+
return this;
|
|
36656
|
+
}
|
|
36657
|
+
/**
|
|
36658
|
+
* A convenience function for setting up multi-level and meta-coordination scopes
|
|
36659
|
+
* across a set of views.
|
|
36660
|
+
* @param {VitessceConfigView[]} views An array of view objects to link together.
|
|
36661
|
+
* @param {object} input A (potentially nested) object with coordination types as keys
|
|
36662
|
+
* and values being either the initial coordination value, a `VitessceConfigCoordinationScope`
|
|
36663
|
+
* instance, or a `CoordinationLevel` instance.
|
|
36664
|
+
* The CL function takes an array of objects as its argument, and returns a CoordinationLevel
|
|
36665
|
+
* instance, to support nesting.
|
|
36666
|
+
* @param {object|null} options
|
|
36667
|
+
* @param {bool} options.meta Should meta-coordination be used? Optional.
|
|
36668
|
+
* By default, true.
|
|
36669
|
+
* @param {string|null} options.scopePrefix A prefix to add to all
|
|
36670
|
+
* coordination scope names. Optional.
|
|
36671
|
+
* @returns {VitessceConfig} This, to allow chaining.
|
|
36672
|
+
*/
|
|
36673
|
+
linkViewsByObject(views, input, options = null) {
|
|
36674
|
+
const { meta = true, scopePrefix = null } = options || {};
|
|
36675
|
+
if (scopePrefix) {
|
|
36676
|
+
this.getNextScope = createPrefixedGetNextScopeNumeric(scopePrefix);
|
|
36677
|
+
}
|
|
36678
|
+
const scopes = this.addCoordinationByObject(input);
|
|
36679
|
+
if (meta) {
|
|
36680
|
+
const metaScope = this.addMetaCoordination();
|
|
36681
|
+
metaScope.useCoordinationByObject(scopes);
|
|
36682
|
+
views.forEach((view) => {
|
|
36683
|
+
view.useMetaCoordination(metaScope);
|
|
36684
|
+
});
|
|
36685
|
+
} else {
|
|
36686
|
+
views.forEach((view) => {
|
|
36687
|
+
view.useCoordinationByObject(scopes);
|
|
36688
|
+
});
|
|
36689
|
+
}
|
|
36690
|
+
if (scopePrefix) {
|
|
36691
|
+
this.getNextScope = getNextScope;
|
|
36692
|
+
}
|
|
36693
|
+
return this;
|
|
36694
|
+
}
|
|
36695
|
+
/**
|
|
36696
|
+
* Set the value for a coordination scope.
|
|
36697
|
+
* If a coordination object for the coordination type does not yet exist
|
|
36698
|
+
* in the coordination space, it will be created.
|
|
36699
|
+
* @param {string} cType The coordination type.
|
|
36700
|
+
* @param {string} cScope The coordination scope.
|
|
36701
|
+
* @param {any} cValue The initial value for the coordination scope.
|
|
36702
|
+
* @returns {VitessceConfigCoordinationScope} A coordination scope instance.
|
|
36703
|
+
*/
|
|
36704
|
+
setCoordinationValue(cType, cScope, cValue) {
|
|
36705
|
+
const scope = new VitessceConfigCoordinationScope(cType, cScope, cValue);
|
|
36706
|
+
if (!this.config.coordinationSpace[scope.cType]) {
|
|
36707
|
+
this.config.coordinationSpace[scope.cType] = {};
|
|
36708
|
+
}
|
|
36709
|
+
this.config.coordinationSpace[scope.cType][scope.cScope] = scope;
|
|
36710
|
+
return scope;
|
|
36711
|
+
}
|
|
36712
|
+
/**
|
|
36713
|
+
* Set the layout of views.
|
|
36714
|
+
* @param {VitessceConfigView|VitessceConfigViewHConcat|VitessceConfigViewVConcat} viewConcat A
|
|
36715
|
+
* view or a concatenation of views.
|
|
36716
|
+
* @returns {VitessceConfig} This, to allow chaining.
|
|
36717
|
+
*/
|
|
36718
|
+
layout(viewConcat) {
|
|
36719
|
+
function layoutAux(obj, xMin, xMax, yMin, yMax) {
|
|
36720
|
+
const w = xMax - xMin;
|
|
36721
|
+
const h = yMax - yMin;
|
|
36722
|
+
if (obj instanceof VitessceConfigView) {
|
|
36723
|
+
obj.setXYWH(xMin, yMin, w, h);
|
|
36724
|
+
} else if (obj instanceof VitessceConfigViewHConcat) {
|
|
36725
|
+
const { views } = obj;
|
|
36726
|
+
const numViews = views.length;
|
|
36727
|
+
views.forEach((view, i) => {
|
|
36728
|
+
layoutAux(view, xMin + w / numViews * i, xMin + w / numViews * (i + 1), yMin, yMax);
|
|
36729
|
+
});
|
|
36730
|
+
} else if (obj instanceof VitessceConfigViewVConcat) {
|
|
36731
|
+
const { views } = obj;
|
|
36732
|
+
const numViews = views.length;
|
|
36733
|
+
views.forEach((view, i) => {
|
|
36734
|
+
layoutAux(view, xMin, xMax, yMin + h / numViews * i, yMin + h / numViews * (i + 1));
|
|
36735
|
+
});
|
|
36736
|
+
}
|
|
36737
|
+
}
|
|
36738
|
+
layoutAux(viewConcat, 0, 12, 0, 12);
|
|
36739
|
+
return this;
|
|
36740
|
+
}
|
|
36741
|
+
/**
|
|
36742
|
+
* Convert this instance to a JSON object that can be passed to the Vitessce component.
|
|
36743
|
+
* @returns {object} The view config as a JSON object.
|
|
36744
|
+
*/
|
|
36745
|
+
toJSON() {
|
|
36746
|
+
return {
|
|
36747
|
+
...this.config,
|
|
36748
|
+
datasets: this.config.datasets.map((d) => d.toJSON()),
|
|
36749
|
+
coordinationSpace: fromEntries(Object.entries(this.config.coordinationSpace).map(([cType, cScopes]) => [
|
|
36750
|
+
cType,
|
|
36751
|
+
fromEntries(Object.entries(cScopes).map(([cScopeName, cScope]) => [
|
|
36752
|
+
cScopeName,
|
|
36753
|
+
cScope.cValue
|
|
36754
|
+
]))
|
|
36755
|
+
])),
|
|
36756
|
+
layout: this.config.layout.map((c) => c.toJSON())
|
|
36757
|
+
};
|
|
36758
|
+
}
|
|
36759
|
+
/**
|
|
36760
|
+
* Create a VitessceConfig instance from an existing view config, to enable
|
|
36761
|
+
* manipulation with the JavaScript API.
|
|
36762
|
+
* @param {object} config An existing Vitessce view config as a JSON object.
|
|
36763
|
+
* @returns {VitessceConfig} A new config instance, with values set to match
|
|
36764
|
+
* the config parameter.
|
|
36765
|
+
*/
|
|
36766
|
+
static fromJSON(config2) {
|
|
36767
|
+
const { name, description, version: schemaVersion } = config2;
|
|
36768
|
+
const vc = new VitessceConfig({ schemaVersion, name, description });
|
|
36769
|
+
config2.datasets.forEach((d) => {
|
|
36770
|
+
const newDataset = vc.addDataset(d.name, d.description, { uid: d.uid });
|
|
36771
|
+
d.files.forEach((f) => {
|
|
36772
|
+
newDataset.addFile({
|
|
36773
|
+
url: f.url,
|
|
36774
|
+
fileType: f.fileType,
|
|
36775
|
+
coordinationValues: f.coordinationValues,
|
|
36776
|
+
options: f.options
|
|
36777
|
+
});
|
|
36778
|
+
});
|
|
36779
|
+
});
|
|
36780
|
+
Object.keys(config2.coordinationSpace).forEach((cType) => {
|
|
36781
|
+
if (cType !== CoordinationType$1.DATASET) {
|
|
36782
|
+
const cObj = config2.coordinationSpace[cType];
|
|
36783
|
+
vc.config.coordinationSpace[cType] = {};
|
|
36784
|
+
Object.entries(cObj).forEach(([cScopeName, cScopeValue]) => {
|
|
36785
|
+
const scope = new VitessceConfigCoordinationScope(cType, cScopeName);
|
|
36786
|
+
scope.setValue(cScopeValue);
|
|
36787
|
+
vc.config.coordinationSpace[cType][cScopeName] = scope;
|
|
36788
|
+
});
|
|
36789
|
+
}
|
|
36790
|
+
});
|
|
36791
|
+
config2.layout.forEach((c) => {
|
|
36792
|
+
const newView = new VitessceConfigView(c.component, c.coordinationScopes, c.x, c.y, c.w, c.h);
|
|
36793
|
+
vc.config.layout.push(newView);
|
|
36794
|
+
});
|
|
36795
|
+
return vc;
|
|
36796
|
+
}
|
|
36797
|
+
}
|
|
36798
|
+
function getCoordinationSpaceAndScopes(partialCoordinationValues, scopePrefix) {
|
|
36799
|
+
const vc = new VitessceConfig({ schemaVersion: "1.0.16", name: "__dummy__" });
|
|
36800
|
+
vc.getNextScope = createPrefixedGetNextScopeNumeric(scopePrefix);
|
|
36801
|
+
const dataset = vc.addDataset("__dummy__");
|
|
36802
|
+
const v1 = vc.addView(dataset, "__dummy__");
|
|
36803
|
+
vc.linkViewsByObject([v1], partialCoordinationValues, { meta: true });
|
|
36804
|
+
const vcJson = vc.toJSON();
|
|
36805
|
+
const { coordinationSpace } = vcJson;
|
|
36806
|
+
const { coordinationScopes } = vcJson.layout[0];
|
|
36807
|
+
const { coordinationScopesBy } = vcJson.layout[0];
|
|
36808
|
+
return {
|
|
36809
|
+
coordinationSpace,
|
|
36810
|
+
coordinationScopes,
|
|
36811
|
+
coordinationScopesBy
|
|
36812
|
+
};
|
|
36813
|
+
}
|
|
36188
36814
|
function getMetaScope(coordinationScopes, coordinationSpace, parameter) {
|
|
36189
36815
|
let latestMetaScope;
|
|
36190
36816
|
if (coordinationSpace) {
|
|
@@ -36193,7 +36819,8 @@ function getMetaScope(coordinationScopes, coordinationSpace, parameter) {
|
|
|
36193
36819
|
if (metaScopes && metaSpace) {
|
|
36194
36820
|
const metaScopesArr = Array.isArray(metaScopes) ? metaScopes : [metaScopes];
|
|
36195
36821
|
metaScopesArr.forEach((metaScope) => {
|
|
36196
|
-
|
|
36822
|
+
var _a;
|
|
36823
|
+
if ((_a = metaSpace[metaScope]) == null ? void 0 : _a[parameter]) {
|
|
36197
36824
|
latestMetaScope = metaScope;
|
|
36198
36825
|
}
|
|
36199
36826
|
});
|
|
@@ -36419,7 +37046,15 @@ function getScopes(coordinationScopes, metaSpace) {
|
|
|
36419
37046
|
if (metaScopes && metaSpace) {
|
|
36420
37047
|
const metaScopesArr = Array.isArray(metaScopes) ? metaScopes : [metaScopes];
|
|
36421
37048
|
metaScopesArr.forEach((metaScope) => {
|
|
36422
|
-
|
|
37049
|
+
let o1 = result;
|
|
37050
|
+
const o2 = metaSpace[metaScope] || {};
|
|
37051
|
+
Object.entries(o2).forEach(([cType, cScope]) => {
|
|
37052
|
+
o1 = {
|
|
37053
|
+
...o1,
|
|
37054
|
+
[cType]: cScope
|
|
37055
|
+
};
|
|
37056
|
+
});
|
|
37057
|
+
result = o1;
|
|
36423
37058
|
});
|
|
36424
37059
|
}
|
|
36425
37060
|
}
|
|
@@ -36432,7 +37067,26 @@ function getScopesBy(coordinationScopes, coordinationScopesBy, metaSpaceBy) {
|
|
|
36432
37067
|
if (metaSpaceBy && metaScopesBy) {
|
|
36433
37068
|
const metaScopesArr = Array.isArray(metaScopesBy) ? metaScopesBy : [metaScopesBy];
|
|
36434
37069
|
metaScopesArr.forEach((metaScope) => {
|
|
36435
|
-
|
|
37070
|
+
let o1 = result;
|
|
37071
|
+
const o2 = metaSpaceBy[metaScope] || {};
|
|
37072
|
+
Object.entries(o2).forEach(([primaryType, primaryObj]) => {
|
|
37073
|
+
Object.entries(primaryObj).forEach(([secondaryType, secondaryObj]) => {
|
|
37074
|
+
Object.entries(secondaryObj).forEach(([primaryScope, secondaryScopeVal]) => {
|
|
37075
|
+
var _a;
|
|
37076
|
+
o1 = {
|
|
37077
|
+
...o1,
|
|
37078
|
+
[primaryType]: {
|
|
37079
|
+
...(o1 == null ? void 0 : o1[primaryType]) || {},
|
|
37080
|
+
[secondaryType]: {
|
|
37081
|
+
...((_a = o1 == null ? void 0 : o1[primaryType]) == null ? void 0 : _a[secondaryType]) || {},
|
|
37082
|
+
[primaryScope]: secondaryScopeVal
|
|
37083
|
+
}
|
|
37084
|
+
}
|
|
37085
|
+
};
|
|
37086
|
+
});
|
|
37087
|
+
});
|
|
37088
|
+
});
|
|
37089
|
+
result = o1;
|
|
36436
37090
|
});
|
|
36437
37091
|
}
|
|
36438
37092
|
}
|
|
@@ -36501,6 +37155,83 @@ const createViewConfigStore = (initialLoaders, initialConfig) => create2((set2)
|
|
|
36501
37155
|
}
|
|
36502
37156
|
};
|
|
36503
37157
|
}),
|
|
37158
|
+
mergeCoordination: (newCoordinationValues, scopePrefix, viewUid) => set2((state) => {
|
|
37159
|
+
const { coordinationSpace, layout: layout2 } = state.viewConfig;
|
|
37160
|
+
const {
|
|
37161
|
+
coordinationSpace: newCoordinationSpace,
|
|
37162
|
+
coordinationScopes
|
|
37163
|
+
} = getCoordinationSpaceAndScopes(newCoordinationValues, scopePrefix);
|
|
37164
|
+
Object.entries(newCoordinationSpace).forEach(([coordinationType, coordinationObj]) => {
|
|
37165
|
+
if (coordinationType === CoordinationType$1.META_COORDINATION_SCOPES) {
|
|
37166
|
+
Object.entries(coordinationObj).forEach(([coordinationScope, coordinationValue]) => {
|
|
37167
|
+
var _a;
|
|
37168
|
+
coordinationSpace[coordinationType] = {
|
|
37169
|
+
...coordinationSpace[coordinationType],
|
|
37170
|
+
[coordinationScope]: {
|
|
37171
|
+
...coordinationValue,
|
|
37172
|
+
...((_a = coordinationSpace[coordinationType]) == null ? void 0 : _a[coordinationScope]) || {}
|
|
37173
|
+
}
|
|
37174
|
+
};
|
|
37175
|
+
});
|
|
37176
|
+
} else if (coordinationType === CoordinationType$1.META_COORDINATION_SCOPES_BY) {
|
|
37177
|
+
Object.entries(coordinationObj).forEach(([coordinationScope, coordinationValue]) => {
|
|
37178
|
+
Object.entries(coordinationValue).forEach(([primaryType, primaryObj]) => {
|
|
37179
|
+
Object.entries(primaryObj).forEach(([secondaryType, secondaryObj]) => {
|
|
37180
|
+
var _a, _b, _c, _d, _e, _f;
|
|
37181
|
+
coordinationSpace[coordinationType] = {
|
|
37182
|
+
...coordinationSpace[coordinationType],
|
|
37183
|
+
[coordinationScope]: {
|
|
37184
|
+
...((_a = coordinationSpace[coordinationType]) == null ? void 0 : _a[coordinationScope]) || {},
|
|
37185
|
+
[primaryType]: {
|
|
37186
|
+
...((_c = (_b = coordinationSpace[coordinationType]) == null ? void 0 : _b[coordinationScope]) == null ? void 0 : _c[primaryType]) || {},
|
|
37187
|
+
[secondaryType]: {
|
|
37188
|
+
...secondaryObj,
|
|
37189
|
+
...((_f = (_e = (_d = coordinationSpace[coordinationType]) == null ? void 0 : _d[coordinationScope]) == null ? void 0 : _e[primaryType]) == null ? void 0 : _f[secondaryType]) || {}
|
|
37190
|
+
}
|
|
37191
|
+
}
|
|
37192
|
+
}
|
|
37193
|
+
};
|
|
37194
|
+
});
|
|
37195
|
+
});
|
|
37196
|
+
});
|
|
37197
|
+
} else {
|
|
37198
|
+
coordinationSpace[coordinationType] = {
|
|
37199
|
+
...coordinationObj,
|
|
37200
|
+
// Existing coordination values should be preserved,
|
|
37201
|
+
// so that user-defined values take precedence over auto-initialization values.
|
|
37202
|
+
...coordinationSpace[coordinationType] || {}
|
|
37203
|
+
};
|
|
37204
|
+
}
|
|
37205
|
+
});
|
|
37206
|
+
const newViewConfig = {
|
|
37207
|
+
...state.viewConfig,
|
|
37208
|
+
coordinationSpace: {
|
|
37209
|
+
...coordinationSpace
|
|
37210
|
+
},
|
|
37211
|
+
layout: layout2.map((viewObj) => {
|
|
37212
|
+
if (viewObj.uid === viewUid) {
|
|
37213
|
+
return {
|
|
37214
|
+
...viewObj,
|
|
37215
|
+
coordinationScopes: {
|
|
37216
|
+
...viewObj.coordinationScopes,
|
|
37217
|
+
[CoordinationType$1.META_COORDINATION_SCOPES]: [
|
|
37218
|
+
...coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES] || [],
|
|
37219
|
+
...viewObj.coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES] || []
|
|
37220
|
+
],
|
|
37221
|
+
[CoordinationType$1.META_COORDINATION_SCOPES_BY]: [
|
|
37222
|
+
...coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES_BY] || [],
|
|
37223
|
+
...viewObj.coordinationScopes[CoordinationType$1.META_COORDINATION_SCOPES_BY] || []
|
|
37224
|
+
]
|
|
37225
|
+
}
|
|
37226
|
+
};
|
|
37227
|
+
}
|
|
37228
|
+
return viewObj;
|
|
37229
|
+
})
|
|
37230
|
+
};
|
|
37231
|
+
return {
|
|
37232
|
+
viewConfig: newViewConfig
|
|
37233
|
+
};
|
|
37234
|
+
}),
|
|
36504
37235
|
removeImageChannelInMetaCoordinationScopes: (coordinationScopesRaw, layerScope, channelScope) => set2((state) => {
|
|
36505
37236
|
const { coordinationSpace } = state.viewConfig;
|
|
36506
37237
|
return {
|
|
@@ -37008,6 +37739,9 @@ function useChangeLayout() {
|
|
|
37008
37739
|
function useSetLoaders() {
|
|
37009
37740
|
return useViewConfigStore((state) => state.setLoaders);
|
|
37010
37741
|
}
|
|
37742
|
+
function useMergeCoordination() {
|
|
37743
|
+
return useViewConfigStore((state) => state.mergeCoordination);
|
|
37744
|
+
}
|
|
37011
37745
|
function useSetViewConfig(viewConfigStoreApi) {
|
|
37012
37746
|
const setViewConfigRef = useRef(viewConfigStoreApi.getState().setViewConfig);
|
|
37013
37747
|
const setViewConfig = setViewConfigRef.current;
|
|
@@ -43154,7 +43888,7 @@ function useRowHeight(config2, initialRowHeight, height2, margin2, padding2) {
|
|
|
43154
43888
|
return [rowHeight, containerRef];
|
|
43155
43889
|
}
|
|
43156
43890
|
function withDefaults(coordinationValues, dataType, fileType, datasetUid, defaultCoordinationValues) {
|
|
43157
|
-
const defaultKeys = DATA_TYPE_COORDINATION_VALUE_USAGE[dataType].filter((k) => Object.keys(defaultCoordinationValues).includes(k) &&
|
|
43891
|
+
const defaultKeys = DATA_TYPE_COORDINATION_VALUE_USAGE[dataType].filter((k) => Object.keys(defaultCoordinationValues).includes(k) && !Object.keys(coordinationValues).includes(k));
|
|
43158
43892
|
const defaultValues = pick$1(defaultCoordinationValues, defaultKeys);
|
|
43159
43893
|
const coordinationValuesWithDefaults = {
|
|
43160
43894
|
...defaultValues,
|
|
@@ -43790,7 +44524,8 @@ function VitessceGrid(props) {
|
|
|
43790
44524
|
isBounded,
|
|
43791
44525
|
viewTypes,
|
|
43792
44526
|
fileTypes,
|
|
43793
|
-
coordinationTypes
|
|
44527
|
+
coordinationTypes,
|
|
44528
|
+
stores
|
|
43794
44529
|
} = props;
|
|
43795
44530
|
const [rowHeight, containerRef] = useRowHeight(config2, initialRowHeight, height2, margin, padding);
|
|
43796
44531
|
const onResize = useEmitGridResize();
|
|
@@ -43820,7 +44555,8 @@ function VitessceGrid(props) {
|
|
|
43820
44555
|
config2.datasets,
|
|
43821
44556
|
config2.description,
|
|
43822
44557
|
fileTypes,
|
|
43823
|
-
coordinationTypes
|
|
44558
|
+
coordinationTypes,
|
|
44559
|
+
stores
|
|
43824
44560
|
);
|
|
43825
44561
|
newConfig = config2;
|
|
43826
44562
|
}
|
|
@@ -44289,7 +45025,8 @@ function VitS(props) {
|
|
|
44289
45025
|
rowHeight,
|
|
44290
45026
|
height: height2,
|
|
44291
45027
|
theme,
|
|
44292
|
-
isBounded
|
|
45028
|
+
isBounded,
|
|
45029
|
+
stores
|
|
44293
45030
|
}
|
|
44294
45031
|
),
|
|
44295
45032
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -44687,7 +45424,7 @@ async function dataQueryFn(ctx) {
|
|
|
44687
45424
|
if (!payload)
|
|
44688
45425
|
return placeholderObject;
|
|
44689
45426
|
const { data, url, coordinationValues } = payload;
|
|
44690
|
-
const urls = Array.isArray(url) ? url : [{ url, name: dataType }];
|
|
45427
|
+
const urls = (Array.isArray(url) ? url : [{ url, name: dataType }]).filter((d) => d.url);
|
|
44691
45428
|
return { data, coordinationValues, urls };
|
|
44692
45429
|
}
|
|
44693
45430
|
if (isRequired) {
|
|
@@ -44733,7 +45470,7 @@ function useDataType(dataType, loaders, dataset, isRequired, coordinationSetters
|
|
|
44733
45470
|
const dataStatus = isFetching ? STATUS.LOADING : status;
|
|
44734
45471
|
return [loadedData, dataStatus, urls];
|
|
44735
45472
|
}
|
|
44736
|
-
function useDataTypeMulti(dataType, loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOnObj) {
|
|
45473
|
+
function useDataTypeMulti(dataType, loaders, dataset, isRequired, coordinationSetters, initialCoordinationValues, matchOnObj, mergeCoordination, viewUid) {
|
|
44737
45474
|
const placeholderObject = useMemo(() => ({}), []);
|
|
44738
45475
|
const setWarning = useSetWarning();
|
|
44739
45476
|
const matchOnEntries = matchOnObj ? Object.entries(matchOnObj) : [];
|
|
@@ -44759,15 +45496,25 @@ function useDataTypeMulti(dataType, loaders, dataset, isRequired, coordinationSe
|
|
|
44759
45496
|
const dataStatus = anyLoading ? STATUS.LOADING : anyError ? STATUS.ERROR : STATUS.SUCCESS;
|
|
44760
45497
|
const isSuccess = dataStatus === STATUS.SUCCESS;
|
|
44761
45498
|
useEffect(() => {
|
|
44762
|
-
dataQueries.
|
|
45499
|
+
dataQueries.filter((q) => {
|
|
44763
45500
|
var _a;
|
|
44764
|
-
return (_a = q.data) == null ? void 0 : _a.coordinationValues;
|
|
44765
|
-
}).
|
|
44766
|
-
|
|
44767
|
-
|
|
44768
|
-
|
|
44769
|
-
|
|
44770
|
-
|
|
45501
|
+
return Boolean((_a = q.data) == null ? void 0 : _a.coordinationValues);
|
|
45502
|
+
}).forEach((q) => {
|
|
45503
|
+
const { coordinationValues } = q.data;
|
|
45504
|
+
if (mergeCoordination) {
|
|
45505
|
+
mergeCoordination(
|
|
45506
|
+
coordinationValues,
|
|
45507
|
+
// Auto-generate based on the dataset and data type.
|
|
45508
|
+
getInitialCoordinationScopePrefix(dataset, dataType),
|
|
45509
|
+
viewUid
|
|
45510
|
+
);
|
|
45511
|
+
} else {
|
|
45512
|
+
initCoordinationSpace(
|
|
45513
|
+
coordinationValues,
|
|
45514
|
+
coordinationSetters,
|
|
45515
|
+
initialCoordinationValues
|
|
45516
|
+
);
|
|
45517
|
+
}
|
|
44771
45518
|
});
|
|
44772
45519
|
}, [isSuccess]);
|
|
44773
45520
|
useEffect(() => {
|
|
@@ -45046,7 +45793,7 @@ function useObsFeatureMatrixIndices(loaders, dataset, isRequired, matchOn) {
|
|
|
45046
45793
|
obsIndex: payloadData2.rows,
|
|
45047
45794
|
featureIndex: payloadData2.cols
|
|
45048
45795
|
},
|
|
45049
|
-
urls: [{ url: url2, name: DataType$1.OBS_FEATURE_MATRIX }]
|
|
45796
|
+
urls: url2 ? [{ url: url2, name: DataType$1.OBS_FEATURE_MATRIX }] : null
|
|
45050
45797
|
};
|
|
45051
45798
|
}
|
|
45052
45799
|
const payload = await loader.load();
|
|
@@ -45080,7 +45827,7 @@ function useObsFeatureMatrixIndices(loaders, dataset, isRequired, matchOn) {
|
|
|
45080
45827
|
}, [error, setWarning]);
|
|
45081
45828
|
return [loadedData, dataStatus, urls];
|
|
45082
45829
|
}
|
|
45083
|
-
function useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
45830
|
+
function useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, viewUid) {
|
|
45084
45831
|
const obsTypeCoordination = useComplexCoordination(
|
|
45085
45832
|
[
|
|
45086
45833
|
CoordinationType$1.OBS_TYPE
|
|
@@ -45103,11 +45850,13 @@ function useMultiObsPoints(coordinationScopes, coordinationScopesBy, loaders, da
|
|
|
45103
45850
|
false,
|
|
45104
45851
|
{},
|
|
45105
45852
|
{},
|
|
45106
|
-
matchOnObj
|
|
45853
|
+
matchOnObj,
|
|
45854
|
+
mergeCoordination,
|
|
45855
|
+
viewUid
|
|
45107
45856
|
);
|
|
45108
45857
|
return [obsPointsData, obsPointsDataStatus, obsPointsUrls];
|
|
45109
45858
|
}
|
|
45110
|
-
function useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
45859
|
+
function useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, viewUid) {
|
|
45111
45860
|
const obsTypeCoordination = useComplexCoordination(
|
|
45112
45861
|
[
|
|
45113
45862
|
CoordinationType$1.OBS_TYPE
|
|
@@ -45130,7 +45879,9 @@ function useMultiObsSpots(coordinationScopes, coordinationScopesBy, loaders, dat
|
|
|
45130
45879
|
false,
|
|
45131
45880
|
{},
|
|
45132
45881
|
{},
|
|
45133
|
-
matchOnObj
|
|
45882
|
+
matchOnObj,
|
|
45883
|
+
mergeCoordination,
|
|
45884
|
+
viewUid
|
|
45134
45885
|
);
|
|
45135
45886
|
return [obsSpotsData, obsSpotsDataStatus, obsSpotsUrls];
|
|
45136
45887
|
}
|
|
@@ -45183,7 +45934,7 @@ function useMultiObsLabels(coordinationScopes, obsType, loaders, dataset) {
|
|
|
45183
45934
|
);
|
|
45184
45935
|
return [obsLabelsTypes, obsLabelsData, obsLabelsDataStatus, obsLabelsUrls];
|
|
45185
45936
|
}
|
|
45186
|
-
function useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
45937
|
+
function useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, viewUid) {
|
|
45187
45938
|
const imageCoordination = useComplexCoordination(
|
|
45188
45939
|
[
|
|
45189
45940
|
CoordinationType$1.FILE_UID
|
|
@@ -45210,11 +45961,13 @@ function useMultiObsSegmentations(coordinationScopes, coordinationScopesBy, load
|
|
|
45210
45961
|
false,
|
|
45211
45962
|
{},
|
|
45212
45963
|
{},
|
|
45213
|
-
matchOnObj
|
|
45964
|
+
matchOnObj,
|
|
45965
|
+
mergeCoordination,
|
|
45966
|
+
viewUid
|
|
45214
45967
|
);
|
|
45215
45968
|
return [obsSegmentationsData, obsSegmentationsDataStatus, obsSegmentationsUrls];
|
|
45216
45969
|
}
|
|
45217
|
-
function useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset) {
|
|
45970
|
+
function useMultiImages(coordinationScopes, coordinationScopesBy, loaders, dataset, mergeCoordination, viewUid) {
|
|
45218
45971
|
const imageCoordination = useComplexCoordination(
|
|
45219
45972
|
[
|
|
45220
45973
|
CoordinationType$1.FILE_UID
|
|
@@ -45237,7 +45990,9 @@ function useMultiImages(coordinationScopes, coordinationScopesBy, loaders, datas
|
|
|
45237
45990
|
false,
|
|
45238
45991
|
{},
|
|
45239
45992
|
{},
|
|
45240
|
-
matchOnObj
|
|
45993
|
+
matchOnObj,
|
|
45994
|
+
mergeCoordination,
|
|
45995
|
+
viewUid
|
|
45241
45996
|
);
|
|
45242
45997
|
return [imageData, imageDataStatus, imageUrls];
|
|
45243
45998
|
}
|
|
@@ -45490,7 +46245,7 @@ function useFeatureSelectionMultiLevel(loaders, dataset, isRequired, matchOnObj,
|
|
|
45490
46245
|
const nestedExtents = nestFeatureSelectionQueryResults(queryKeyScopeTuples, flatExtents);
|
|
45491
46246
|
const nestedNormData = nestFeatureSelectionQueryResults(queryKeyScopeTuples, flatNormData);
|
|
45492
46247
|
return [nestedGeneData, nestedLoadedGeneName, nestedExtents, nestedNormData];
|
|
45493
|
-
}, [featureQueries.reduce((a, h) => a + h.dataUpdatedAt, 0)]);
|
|
46248
|
+
}, [featureQueries.reduce((a, h) => a + h.dataUpdatedAt, 0), queryKeyScopeTuples]);
|
|
45494
46249
|
return [geneData, loadedGeneName, extents, normData, dataStatus];
|
|
45495
46250
|
}
|
|
45496
46251
|
async function matrixIndicesQueryFn(ctx) {
|
|
@@ -45561,7 +46316,7 @@ function useObsFeatureMatrixIndicesMultiLevel(loaders, dataset, isRequired, matc
|
|
|
45561
46316
|
const indicesData = useMemo(() => {
|
|
45562
46317
|
const nestedIndicesData = nestQueryResults(queryKeyScopeTuples, flatIndicesData);
|
|
45563
46318
|
return nestedIndicesData;
|
|
45564
|
-
}, [indicesQueries.reduce((a, h) => a + h.dataUpdatedAt, 0)]);
|
|
46319
|
+
}, [indicesQueries.reduce((a, h) => a + h.dataUpdatedAt, 0), queryKeyScopeTuples]);
|
|
45565
46320
|
return [indicesData, dataStatus];
|
|
45566
46321
|
}
|
|
45567
46322
|
function useDataTypeMultiLevel(loaders, dataset, isRequired, matchOnObj, depth, dataType) {
|
|
@@ -45597,7 +46352,7 @@ function useDataTypeMultiLevel(loaders, dataset, isRequired, matchOnObj, depth,
|
|
|
45597
46352
|
const locationsData = useMemo(() => {
|
|
45598
46353
|
const nestedIndicesData = nestQueryResults(queryKeyScopeTuples, flatIndicesData);
|
|
45599
46354
|
return nestedIndicesData;
|
|
45600
|
-
}, [locationsQueries.reduce((a, h) => a + h.dataUpdatedAt, 0)]);
|
|
46355
|
+
}, [locationsQueries.reduce((a, h) => a + h.dataUpdatedAt, 0), queryKeyScopeTuples]);
|
|
45601
46356
|
return [locationsData, dataStatus];
|
|
45602
46357
|
}
|
|
45603
46358
|
function useObsLocationsMultiLevel(loaders, dataset, isRequired, matchOnObj, depth) {
|
|
@@ -45658,6 +46413,7 @@ function useSegmentationMultiFeatureSelection(coordinationScopes, coordinationSc
|
|
|
45658
46413
|
// indirect dependencies here.
|
|
45659
46414
|
[coordinationScopes, coordinationScopesBy]
|
|
45660
46415
|
);
|
|
46416
|
+
const useMemoDependency = Object.values(featureSelectionCoordination[0] || {}).flatMap((layerVal) => Object.values(layerVal).map((cVal) => cVal.featureSelection));
|
|
45661
46417
|
const selections = useMemo(
|
|
45662
46418
|
() => fromEntries(Object.entries(featureSelectionCoordination[0]).map(([layerScope, layerVal]) => [
|
|
45663
46419
|
layerScope,
|
|
@@ -45669,7 +46425,9 @@ function useSegmentationMultiFeatureSelection(coordinationScopes, coordinationSc
|
|
|
45669
46425
|
[
|
|
45670
46426
|
coordinationScopes,
|
|
45671
46427
|
coordinationScopesBy,
|
|
45672
|
-
|
|
46428
|
+
// We need to ensure there are always the same number of
|
|
46429
|
+
// entries in the full dependency array.
|
|
46430
|
+
JSON.stringify(useMemoDependency.length > 0 ? useMemoDependency : [null])
|
|
45673
46431
|
]
|
|
45674
46432
|
);
|
|
45675
46433
|
const [
|
|
@@ -46201,6 +46959,7 @@ export {
|
|
|
46201
46959
|
useInitialCoordination,
|
|
46202
46960
|
useLoaders,
|
|
46203
46961
|
useMatchingLoader,
|
|
46962
|
+
useMergeCoordination,
|
|
46204
46963
|
useMultiCoordinationScopes,
|
|
46205
46964
|
useMultiCoordinationScopesNonNull,
|
|
46206
46965
|
useMultiCoordinationScopesSecondary,
|