@vitessce/sets-utils 4.0.7 → 4.0.9
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 +184 -10
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -6527,7 +6527,7 @@ const latestFileDefSchema = z.object({
|
|
|
6527
6527
|
options: fileOptionsSchema.optional(),
|
|
6528
6528
|
requestInit: requestInit.optional(),
|
|
6529
6529
|
// New: file def can have coordinationValues.
|
|
6530
|
-
coordinationValues: z.record(z.
|
|
6530
|
+
coordinationValues: z.record(z.any()).optional()
|
|
6531
6531
|
});
|
|
6532
6532
|
const datasetsSchema1_0_13 = z.array(z.object({
|
|
6533
6533
|
uid: z.string(),
|
|
@@ -6558,7 +6558,8 @@ const configSchema1_0_16 = configSchema1_0_13.extend({
|
|
|
6558
6558
|
h: z.number().int().optional(),
|
|
6559
6559
|
// Updates coordinationScopes and coordinationScopesBy
|
|
6560
6560
|
coordinationScopes: componentCoordinationScopes.optional(),
|
|
6561
|
-
coordinationScopesBy: componentCoordinationScopesBy.optional()
|
|
6561
|
+
coordinationScopesBy: componentCoordinationScopesBy.optional(),
|
|
6562
|
+
coordinationValues: z.record(z.any()).optional()
|
|
6562
6563
|
}))
|
|
6563
6564
|
});
|
|
6564
6565
|
const configSchema1_0_17 = configSchema1_0_16.extend({
|
|
@@ -9064,7 +9065,9 @@ const ViewType$1 = {
|
|
|
9064
9065
|
DUAL_SCATTERPLOT: "dualScatterplot",
|
|
9065
9066
|
TREEMAP: "treemap",
|
|
9066
9067
|
SAMPLE_SET_PAIR_MANAGER: "sampleSetPairManager",
|
|
9067
|
-
FEATURE_STATS_TABLE: "featureStatsTable"
|
|
9068
|
+
FEATURE_STATS_TABLE: "featureStatsTable",
|
|
9069
|
+
SINGLE_OBS_SET_SELECTOR: "singleObsSetSelector",
|
|
9070
|
+
ANNOTATION_CONTROLLER: "annotationController"
|
|
9068
9071
|
};
|
|
9069
9072
|
const DataType$1 = {
|
|
9070
9073
|
OBS_LABELS: "obsLabels",
|
|
@@ -9085,7 +9088,8 @@ const DataType$1 = {
|
|
|
9085
9088
|
COMPARISON_METADATA: "comparisonMetadata",
|
|
9086
9089
|
FEATURE_STATS: "featureStats",
|
|
9087
9090
|
FEATURE_SET_STATS: "featureSetStats",
|
|
9088
|
-
OBS_SET_STATS: "obsSetStats"
|
|
9091
|
+
OBS_SET_STATS: "obsSetStats",
|
|
9092
|
+
ANNOTATION_STORY: "annotationStory"
|
|
9089
9093
|
};
|
|
9090
9094
|
const FileType$1 = {
|
|
9091
9095
|
// Joint file types
|
|
@@ -9107,6 +9111,7 @@ const FileType$1 = {
|
|
|
9107
9111
|
OBS_SETS_CSV: "obsSets.csv",
|
|
9108
9112
|
OBS_SETS_JSON: "obsSets.json",
|
|
9109
9113
|
SAMPLE_SETS_CSV: "sampleSets.csv",
|
|
9114
|
+
ANNOTATION_STORY_JSON: "annotationStory.json",
|
|
9110
9115
|
// OME-Zarr
|
|
9111
9116
|
IMAGE_OME_ZARR: "image.ome-zarr",
|
|
9112
9117
|
OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
|
|
@@ -9391,7 +9396,15 @@ const CoordinationType$1 = {
|
|
|
9391
9396
|
FEATURE_POINT_FOLD_CHANGE_THRESHOLD: "featurePointFoldChangeThreshold",
|
|
9392
9397
|
FEATURE_LABEL_FOLD_CHANGE_THRESHOLD: "featureLabelFoldChangeThreshold",
|
|
9393
9398
|
// Treemap
|
|
9394
|
-
HIERARCHY_LEVELS: "hierarchyLevels"
|
|
9399
|
+
HIERARCHY_LEVELS: "hierarchyLevels",
|
|
9400
|
+
// Annotation frames
|
|
9401
|
+
ANNOTATION_STORY: "annotationStory",
|
|
9402
|
+
ANNOTATION_FRAME_INDEX: "annotationFrameIndex",
|
|
9403
|
+
ANNOTATION_SHAPES: "annotationShapes",
|
|
9404
|
+
ANNOTATION_OVERLAY_VISIBLE: "annotationOverlayVisible",
|
|
9405
|
+
ANNOTATION_TRANSITION_DURATION: "annotationTransitionDuration",
|
|
9406
|
+
ANNOTATION_SEMANTIC_ZOOM: "annotationSemanticZoom",
|
|
9407
|
+
ANNOTATION_EDITABLE: "annotationEditable"
|
|
9395
9408
|
};
|
|
9396
9409
|
({
|
|
9397
9410
|
// For new file types
|
|
@@ -9407,6 +9420,7 @@ const CoordinationType$1 = {
|
|
|
9407
9420
|
[FileType$1.OBS_SEGMENTATIONS_JSON]: DataType$1.OBS_SEGMENTATIONS,
|
|
9408
9421
|
[FileType$1.OBS_SETS_CSV]: DataType$1.OBS_SETS,
|
|
9409
9422
|
[FileType$1.OBS_SETS_JSON]: DataType$1.OBS_SETS,
|
|
9423
|
+
[FileType$1.ANNOTATION_STORY_JSON]: DataType$1.ANNOTATION_STORY,
|
|
9410
9424
|
[FileType$1.IMAGE_OME_ZARR]: DataType$1.IMAGE,
|
|
9411
9425
|
[FileType$1.OBS_SEGMENTATIONS_OME_ZARR]: DataType$1.OBS_SEGMENTATIONS,
|
|
9412
9426
|
[FileType$1.OBS_FEATURE_MATRIX_ANNDATA_ZARR]: DataType$1.OBS_FEATURE_MATRIX,
|
|
@@ -9529,7 +9543,8 @@ const CoordinationType$1 = {
|
|
|
9529
9543
|
[DataType$1.OBS_SET_STATS]: [
|
|
9530
9544
|
CoordinationType$1.OBS_TYPE
|
|
9531
9545
|
// TODO: should sampleType, obsSetSelection, and/or sampleSetSelection be used here?
|
|
9532
|
-
]
|
|
9546
|
+
],
|
|
9547
|
+
[DataType$1.ANNOTATION_STORY]: []
|
|
9533
9548
|
});
|
|
9534
9549
|
({
|
|
9535
9550
|
// For AnnData:
|
|
@@ -9662,7 +9677,9 @@ const CoordinationType$1 = {
|
|
|
9662
9677
|
CoordinationType$1.SPATIAL_TARGET_Z,
|
|
9663
9678
|
CoordinationType$1.SPATIAL_AXIS_FIXED,
|
|
9664
9679
|
CoordinationType$1.SPATIAL_ORBIT_AXIS,
|
|
9665
|
-
CoordinationType$1.FEATURE_AGGREGATION_STRATEGY
|
|
9680
|
+
CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
|
|
9681
|
+
// Annotation shapes are specific to a view's coordinate system.
|
|
9682
|
+
CoordinationType$1.ANNOTATION_SHAPES
|
|
9666
9683
|
];
|
|
9667
9684
|
({
|
|
9668
9685
|
[ViewType$1.NEUROGLANCER]: [
|
|
@@ -9754,7 +9771,14 @@ const CoordinationType$1 = {
|
|
|
9754
9771
|
CoordinationType$1.EMBEDDING_CONTOURS_FILLED,
|
|
9755
9772
|
CoordinationType$1.EMBEDDING_CONTOUR_PERCENTILES,
|
|
9756
9773
|
CoordinationType$1.CONTOUR_COLOR_ENCODING,
|
|
9757
|
-
CoordinationType$1.CONTOUR_COLOR
|
|
9774
|
+
CoordinationType$1.CONTOUR_COLOR,
|
|
9775
|
+
CoordinationType$1.ANNOTATION_STORY,
|
|
9776
|
+
CoordinationType$1.ANNOTATION_SHAPES,
|
|
9777
|
+
CoordinationType$1.ANNOTATION_FRAME_INDEX,
|
|
9778
|
+
CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
|
|
9779
|
+
CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
|
|
9780
|
+
CoordinationType$1.ANNOTATION_EDITABLE,
|
|
9781
|
+
CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
|
|
9758
9782
|
],
|
|
9759
9783
|
[ViewType$1.DUAL_SCATTERPLOT]: [
|
|
9760
9784
|
CoordinationType$1.DATASET,
|
|
@@ -9870,7 +9894,14 @@ const CoordinationType$1 = {
|
|
|
9870
9894
|
CoordinationType$1.ADDITIONAL_OBS_SETS,
|
|
9871
9895
|
CoordinationType$1.MOLECULE_HIGHLIGHT,
|
|
9872
9896
|
CoordinationType$1.TOOLTIPS_VISIBLE,
|
|
9873
|
-
CoordinationType$1.PHOTOMETRIC_INTERPRETATION
|
|
9897
|
+
CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
|
|
9898
|
+
CoordinationType$1.ANNOTATION_STORY,
|
|
9899
|
+
CoordinationType$1.ANNOTATION_SHAPES,
|
|
9900
|
+
CoordinationType$1.ANNOTATION_FRAME_INDEX,
|
|
9901
|
+
CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
|
|
9902
|
+
CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
|
|
9903
|
+
CoordinationType$1.ANNOTATION_EDITABLE,
|
|
9904
|
+
CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
|
|
9874
9905
|
],
|
|
9875
9906
|
[ViewType$1.SPATIAL_BETA]: [
|
|
9876
9907
|
CoordinationType$1.META_COORDINATION_SCOPES,
|
|
@@ -9948,7 +9979,27 @@ const CoordinationType$1 = {
|
|
|
9948
9979
|
CoordinationType$1.SPATIAL_CHANNEL_LABELS_ORIENTATION,
|
|
9949
9980
|
CoordinationType$1.SPATIAL_CHANNEL_LABEL_SIZE,
|
|
9950
9981
|
CoordinationType$1.SPATIAL_CHANNELS_SORT_ORDER,
|
|
9951
|
-
CoordinationType$1.PHOTOMETRIC_INTERPRETATION
|
|
9982
|
+
CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
|
|
9983
|
+
CoordinationType$1.ANNOTATION_STORY,
|
|
9984
|
+
CoordinationType$1.ANNOTATION_SHAPES,
|
|
9985
|
+
CoordinationType$1.ANNOTATION_FRAME_INDEX,
|
|
9986
|
+
CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
|
|
9987
|
+
CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
|
|
9988
|
+
CoordinationType$1.ANNOTATION_EDITABLE,
|
|
9989
|
+
CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
|
|
9990
|
+
],
|
|
9991
|
+
[ViewType$1.ANNOTATION_CONTROLLER]: [
|
|
9992
|
+
CoordinationType$1.DATASET,
|
|
9993
|
+
CoordinationType$1.ANNOTATION_STORY,
|
|
9994
|
+
CoordinationType$1.ANNOTATION_FRAME_INDEX,
|
|
9995
|
+
CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
|
|
9996
|
+
CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
|
|
9997
|
+
CoordinationType$1.ANNOTATION_EDITABLE,
|
|
9998
|
+
CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
|
|
9999
|
+
// Note: the annotation controller also needs to read the coordination state
|
|
10000
|
+
// of all other views/coordination types via the full config.
|
|
10001
|
+
// Note: we get/set the CoordinationType.ANNOTATION_SHAPES from the full config,
|
|
10002
|
+
// as this info is view-specific rather than global to the story.
|
|
9952
10003
|
],
|
|
9953
10004
|
[ViewType$1.HEATMAP]: [
|
|
9954
10005
|
CoordinationType$1.DATASET,
|
|
@@ -10258,6 +10309,11 @@ const CoordinationType$1 = {
|
|
|
10258
10309
|
CoordinationType$1.FEATURE_POINT_FOLD_CHANGE_THRESHOLD,
|
|
10259
10310
|
CoordinationType$1.FEATURE_LABEL_FOLD_CHANGE_THRESHOLD
|
|
10260
10311
|
],
|
|
10312
|
+
[ViewType$1.SINGLE_OBS_SET_SELECTOR]: [
|
|
10313
|
+
CoordinationType$1.OBS_TYPE,
|
|
10314
|
+
CoordinationType$1.OBS_SET_COLOR,
|
|
10315
|
+
CoordinationType$1.OBS_SET_SELECTION
|
|
10316
|
+
],
|
|
10261
10317
|
[ViewType$1.OBS_SET_COMPOSITION_BAR_PLOT]: [
|
|
10262
10318
|
CoordinationType$1.DATASET,
|
|
10263
10319
|
CoordinationType$1.OBS_TYPE,
|
|
@@ -10961,6 +11017,124 @@ z.object({
|
|
|
10961
11017
|
radius: z.number(),
|
|
10962
11018
|
opacity: z.number()
|
|
10963
11019
|
});
|
|
11020
|
+
const shapeBaseObj = z.object({
|
|
11021
|
+
uid: z.string(),
|
|
11022
|
+
text: z.string().optional(),
|
|
11023
|
+
strokeColor: z.array(z.number()).length(3).optional(),
|
|
11024
|
+
strokeWidth: z.number().optional(),
|
|
11025
|
+
// SVG-style dash pattern, e.g. "10 5" or "10 20 30 10". "none" or omitted = solid.
|
|
11026
|
+
strokeDashArray: z.string().optional(),
|
|
11027
|
+
visible: z.boolean().optional()
|
|
11028
|
+
// TODO: define unit modes for x and y axes
|
|
11029
|
+
// ("pixels" vs "normalized" vs "physical" etc.)
|
|
11030
|
+
// TODO: a coordinate system identifier (e.g., "DeckGL" for now,
|
|
11031
|
+
// but a coordinate system from OME-NGFF/SpatialData eventually?)
|
|
11032
|
+
});
|
|
11033
|
+
const rectangleShapeObj = shapeBaseObj.extend({
|
|
11034
|
+
type: z.literal("rectangle"),
|
|
11035
|
+
// OME-XML field names verbatim (upper-left origin)
|
|
11036
|
+
x: z.number(),
|
|
11037
|
+
y: z.number(),
|
|
11038
|
+
width: z.number(),
|
|
11039
|
+
height: z.number(),
|
|
11040
|
+
fillColor: z.array(z.number()).length(3).optional(),
|
|
11041
|
+
fillOpacity: z.number().optional()
|
|
11042
|
+
});
|
|
11043
|
+
const lineShapeObj = shapeBaseObj.extend({
|
|
11044
|
+
type: z.literal("line"),
|
|
11045
|
+
// OME-XML field names verbatim
|
|
11046
|
+
x1: z.number(),
|
|
11047
|
+
y1: z.number(),
|
|
11048
|
+
x2: z.number(),
|
|
11049
|
+
y2: z.number(),
|
|
11050
|
+
markerStart: z.enum(["Arrow", "Tick"]).nullable().optional(),
|
|
11051
|
+
markerEnd: z.enum(["Arrow", "Tick"]).nullable().optional(),
|
|
11052
|
+
textPosition: z.enum(["start", "middle", "end"]).optional(),
|
|
11053
|
+
textBufferPx: z.number().optional()
|
|
11054
|
+
});
|
|
11055
|
+
const ellipseShapeObj = shapeBaseObj.extend({
|
|
11056
|
+
type: z.literal("ellipse"),
|
|
11057
|
+
// OME-XML field names verbatim (centre point + radii)
|
|
11058
|
+
x1: z.number(),
|
|
11059
|
+
y1: z.number(),
|
|
11060
|
+
radiusX: z.number(),
|
|
11061
|
+
radiusY: z.number(),
|
|
11062
|
+
fillColor: z.array(z.number()).length(3).optional(),
|
|
11063
|
+
fillOpacity: z.number().optional()
|
|
11064
|
+
});
|
|
11065
|
+
const polygonShapeObj = shapeBaseObj.extend({
|
|
11066
|
+
type: z.literal("polygon"),
|
|
11067
|
+
// OME-XML: array of [x, y] coordinate pairs, closed automatically
|
|
11068
|
+
points: z.array(z.tuple([z.number(), z.number()])),
|
|
11069
|
+
fillColor: z.array(z.number()).length(3).optional(),
|
|
11070
|
+
fillOpacity: z.number().optional()
|
|
11071
|
+
});
|
|
11072
|
+
const polylineShapeObj = shapeBaseObj.extend({
|
|
11073
|
+
type: z.literal("polyline"),
|
|
11074
|
+
// OME-XML: array of [x, y] coordinate pairs, open (not closed)
|
|
11075
|
+
points: z.array(z.tuple([z.number(), z.number()])),
|
|
11076
|
+
markerStart: z.enum(["Arrow", "Tick"]).nullable().optional(),
|
|
11077
|
+
markerEnd: z.enum(["Arrow", "Tick"]).nullable().optional()
|
|
11078
|
+
});
|
|
11079
|
+
const annotationShapeObj = z.discriminatedUnion("type", [
|
|
11080
|
+
rectangleShapeObj,
|
|
11081
|
+
lineShapeObj,
|
|
11082
|
+
ellipseShapeObj,
|
|
11083
|
+
polygonShapeObj,
|
|
11084
|
+
polylineShapeObj
|
|
11085
|
+
]);
|
|
11086
|
+
z.array(annotationShapeObj);
|
|
11087
|
+
const annotationFrameObj = z.object({
|
|
11088
|
+
uid: z.string(),
|
|
11089
|
+
title: z.string().optional(),
|
|
11090
|
+
description: z.string().optional(),
|
|
11091
|
+
descriptionType: z.enum(["text", "markdown"]).optional(),
|
|
11092
|
+
// A frame can define per-view: coordinationValues
|
|
11093
|
+
// (if the view's state should not be coordinated with other views)
|
|
11094
|
+
// or per-view coordinationScopes/coordinationScopesBy
|
|
11095
|
+
// (if at this frame, the view should be coordinated with other views).
|
|
11096
|
+
// We can also define a frame-level coordination space,
|
|
11097
|
+
// which will be merged with the global coordination space.
|
|
11098
|
+
// TODO: datasets
|
|
11099
|
+
// TODO: coordinationSpace
|
|
11100
|
+
layout: z.array(
|
|
11101
|
+
// Note: for now, we will infer view objects which have a uid
|
|
11102
|
+
// that is present in the global layout, and do NOT have x/y/w/h defined,
|
|
11103
|
+
// to mean that in this frame, the layout and set of views is unchanged
|
|
11104
|
+
// from the global layout.
|
|
11105
|
+
// This will allow each frame to omit the full list of views from the layout,
|
|
11106
|
+
// and only specify the views whose coordination state is changing in this frame.
|
|
11107
|
+
// If a frame includes a view with a uid that is not present
|
|
11108
|
+
// in the global layout, then that view will be added to the layout at this frame.
|
|
11109
|
+
// This frame should also define x/y/w/h for all views,
|
|
11110
|
+
// since it will otherwise be ambiguous how to layout the updated set of views
|
|
11111
|
+
// for this frame.
|
|
11112
|
+
z.object({
|
|
11113
|
+
// The view UID. If this view uid is not present in the global layout,
|
|
11114
|
+
// it will be added to the layout at this frame,
|
|
11115
|
+
// and will need to have its coordination values initialized to their defaults
|
|
11116
|
+
// for any that were not fully specified.
|
|
11117
|
+
uid: z.string(),
|
|
11118
|
+
coordinationValues: z.record(
|
|
11119
|
+
z.string(),
|
|
11120
|
+
// The coordination type name, e.g. "embeddingType"
|
|
11121
|
+
z.any()
|
|
11122
|
+
).optional()
|
|
11123
|
+
// TODO: support coordinationScopes/coordinationScopesBy for per-view coordination
|
|
11124
|
+
// at this frame.
|
|
11125
|
+
// TODO: view x/y/w/h once we support view layout changes per-frame.
|
|
11126
|
+
})
|
|
11127
|
+
).optional()
|
|
11128
|
+
});
|
|
11129
|
+
z.object({
|
|
11130
|
+
// TODO: schema version for the story schema?
|
|
11131
|
+
// Same as current Vitessce schema version?
|
|
11132
|
+
uid: z.string(),
|
|
11133
|
+
title: z.string().optional(),
|
|
11134
|
+
description: z.string().optional(),
|
|
11135
|
+
descriptionType: z.enum(["text", "markdown"]).optional(),
|
|
11136
|
+
frames: z.array(annotationFrameObj)
|
|
11137
|
+
});
|
|
10964
11138
|
const FILE_EXTENSION_JSON = "json";
|
|
10965
11139
|
const MIME_TYPE_JSON = "application/json";
|
|
10966
11140
|
const FILE_EXTENSION_TABULAR = "csv";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/sets-utils",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9",
|
|
4
4
|
"author": "HIDIVE Lab at HMS",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -25,10 +25,10 @@
|
|
|
25
25
|
"lodash-es": "^4.17.21",
|
|
26
26
|
"tinycolor2": "^1.4.1",
|
|
27
27
|
"uuid": "^9.0.0",
|
|
28
|
-
"@vitessce/schemas": "4.0.
|
|
29
|
-
"@vitessce/utils": "4.0.
|
|
30
|
-
"@vitessce/
|
|
31
|
-
"@vitessce/
|
|
28
|
+
"@vitessce/schemas": "4.0.9",
|
|
29
|
+
"@vitessce/utils": "4.0.9",
|
|
30
|
+
"@vitessce/globals": "4.0.9",
|
|
31
|
+
"@vitessce/workers": "4.0.9"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",
|