@vitessce/schemas 4.0.8 → 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 CHANGED
@@ -3975,7 +3975,7 @@ const latestFileDefSchema = z.object({
3975
3975
  options: fileOptionsSchema.optional(),
3976
3976
  requestInit: requestInit.optional(),
3977
3977
  // New: file def can have coordinationValues.
3978
- coordinationValues: z.record(z.string()).optional()
3978
+ coordinationValues: z.record(z.any()).optional()
3979
3979
  });
3980
3980
  const datasetsSchema1_0_13 = z.array(
3981
3981
  z.object({
@@ -4011,7 +4011,8 @@ const configSchema1_0_16 = configSchema1_0_13.extend({
4011
4011
  h: z.number().int().optional(),
4012
4012
  // Updates coordinationScopes and coordinationScopesBy
4013
4013
  coordinationScopes: componentCoordinationScopes.optional(),
4014
- coordinationScopesBy: componentCoordinationScopesBy.optional()
4014
+ coordinationScopesBy: componentCoordinationScopesBy.optional(),
4015
+ coordinationValues: z.record(z.any()).optional()
4015
4016
  })
4016
4017
  )
4017
4018
  });
@@ -7895,7 +7896,8 @@ const ViewType$1 = {
7895
7896
  TREEMAP: "treemap",
7896
7897
  SAMPLE_SET_PAIR_MANAGER: "sampleSetPairManager",
7897
7898
  FEATURE_STATS_TABLE: "featureStatsTable",
7898
- SINGLE_OBS_SET_SELECTOR: "singleObsSetSelector"
7899
+ SINGLE_OBS_SET_SELECTOR: "singleObsSetSelector",
7900
+ ANNOTATION_CONTROLLER: "annotationController"
7899
7901
  };
7900
7902
  const DataType$1 = {
7901
7903
  OBS_LABELS: "obsLabels",
@@ -7916,7 +7918,8 @@ const DataType$1 = {
7916
7918
  COMPARISON_METADATA: "comparisonMetadata",
7917
7919
  FEATURE_STATS: "featureStats",
7918
7920
  FEATURE_SET_STATS: "featureSetStats",
7919
- OBS_SET_STATS: "obsSetStats"
7921
+ OBS_SET_STATS: "obsSetStats",
7922
+ ANNOTATION_STORY: "annotationStory"
7920
7923
  };
7921
7924
  const FileType$1 = {
7922
7925
  // Joint file types
@@ -7938,6 +7941,7 @@ const FileType$1 = {
7938
7941
  OBS_SETS_CSV: "obsSets.csv",
7939
7942
  OBS_SETS_JSON: "obsSets.json",
7940
7943
  SAMPLE_SETS_CSV: "sampleSets.csv",
7944
+ ANNOTATION_STORY_JSON: "annotationStory.json",
7941
7945
  // OME-Zarr
7942
7946
  IMAGE_OME_ZARR: "image.ome-zarr",
7943
7947
  OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
@@ -8222,7 +8226,15 @@ const CoordinationType$1 = {
8222
8226
  FEATURE_POINT_FOLD_CHANGE_THRESHOLD: "featurePointFoldChangeThreshold",
8223
8227
  FEATURE_LABEL_FOLD_CHANGE_THRESHOLD: "featureLabelFoldChangeThreshold",
8224
8228
  // Treemap
8225
- HIERARCHY_LEVELS: "hierarchyLevels"
8229
+ HIERARCHY_LEVELS: "hierarchyLevels",
8230
+ // Annotation frames
8231
+ ANNOTATION_STORY: "annotationStory",
8232
+ ANNOTATION_FRAME_INDEX: "annotationFrameIndex",
8233
+ ANNOTATION_SHAPES: "annotationShapes",
8234
+ ANNOTATION_OVERLAY_VISIBLE: "annotationOverlayVisible",
8235
+ ANNOTATION_TRANSITION_DURATION: "annotationTransitionDuration",
8236
+ ANNOTATION_SEMANTIC_ZOOM: "annotationSemanticZoom",
8237
+ ANNOTATION_EDITABLE: "annotationEditable"
8226
8238
  };
8227
8239
  ({
8228
8240
  // For new file types
@@ -8238,6 +8250,7 @@ const CoordinationType$1 = {
8238
8250
  [FileType$1.OBS_SEGMENTATIONS_JSON]: DataType$1.OBS_SEGMENTATIONS,
8239
8251
  [FileType$1.OBS_SETS_CSV]: DataType$1.OBS_SETS,
8240
8252
  [FileType$1.OBS_SETS_JSON]: DataType$1.OBS_SETS,
8253
+ [FileType$1.ANNOTATION_STORY_JSON]: DataType$1.ANNOTATION_STORY,
8241
8254
  [FileType$1.IMAGE_OME_ZARR]: DataType$1.IMAGE,
8242
8255
  [FileType$1.OBS_SEGMENTATIONS_OME_ZARR]: DataType$1.OBS_SEGMENTATIONS,
8243
8256
  [FileType$1.OBS_FEATURE_MATRIX_ANNDATA_ZARR]: DataType$1.OBS_FEATURE_MATRIX,
@@ -8360,7 +8373,8 @@ const CoordinationType$1 = {
8360
8373
  [DataType$1.OBS_SET_STATS]: [
8361
8374
  CoordinationType$1.OBS_TYPE
8362
8375
  // TODO: should sampleType, obsSetSelection, and/or sampleSetSelection be used here?
8363
- ]
8376
+ ],
8377
+ [DataType$1.ANNOTATION_STORY]: []
8364
8378
  });
8365
8379
  ({
8366
8380
  // For AnnData:
@@ -8493,7 +8507,9 @@ const CoordinationType$1 = {
8493
8507
  CoordinationType$1.SPATIAL_TARGET_Z,
8494
8508
  CoordinationType$1.SPATIAL_AXIS_FIXED,
8495
8509
  CoordinationType$1.SPATIAL_ORBIT_AXIS,
8496
- CoordinationType$1.FEATURE_AGGREGATION_STRATEGY
8510
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
8511
+ // Annotation shapes are specific to a view's coordinate system.
8512
+ CoordinationType$1.ANNOTATION_SHAPES
8497
8513
  ];
8498
8514
  ({
8499
8515
  [ViewType$1.NEUROGLANCER]: [
@@ -8585,7 +8601,14 @@ const CoordinationType$1 = {
8585
8601
  CoordinationType$1.EMBEDDING_CONTOURS_FILLED,
8586
8602
  CoordinationType$1.EMBEDDING_CONTOUR_PERCENTILES,
8587
8603
  CoordinationType$1.CONTOUR_COLOR_ENCODING,
8588
- CoordinationType$1.CONTOUR_COLOR
8604
+ CoordinationType$1.CONTOUR_COLOR,
8605
+ CoordinationType$1.ANNOTATION_STORY,
8606
+ CoordinationType$1.ANNOTATION_SHAPES,
8607
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
8608
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
8609
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
8610
+ CoordinationType$1.ANNOTATION_EDITABLE,
8611
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
8589
8612
  ],
8590
8613
  [ViewType$1.DUAL_SCATTERPLOT]: [
8591
8614
  CoordinationType$1.DATASET,
@@ -8701,7 +8724,14 @@ const CoordinationType$1 = {
8701
8724
  CoordinationType$1.ADDITIONAL_OBS_SETS,
8702
8725
  CoordinationType$1.MOLECULE_HIGHLIGHT,
8703
8726
  CoordinationType$1.TOOLTIPS_VISIBLE,
8704
- CoordinationType$1.PHOTOMETRIC_INTERPRETATION
8727
+ CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
8728
+ CoordinationType$1.ANNOTATION_STORY,
8729
+ CoordinationType$1.ANNOTATION_SHAPES,
8730
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
8731
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
8732
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
8733
+ CoordinationType$1.ANNOTATION_EDITABLE,
8734
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
8705
8735
  ],
8706
8736
  [ViewType$1.SPATIAL_BETA]: [
8707
8737
  CoordinationType$1.META_COORDINATION_SCOPES,
@@ -8779,7 +8809,27 @@ const CoordinationType$1 = {
8779
8809
  CoordinationType$1.SPATIAL_CHANNEL_LABELS_ORIENTATION,
8780
8810
  CoordinationType$1.SPATIAL_CHANNEL_LABEL_SIZE,
8781
8811
  CoordinationType$1.SPATIAL_CHANNELS_SORT_ORDER,
8782
- CoordinationType$1.PHOTOMETRIC_INTERPRETATION
8812
+ CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
8813
+ CoordinationType$1.ANNOTATION_STORY,
8814
+ CoordinationType$1.ANNOTATION_SHAPES,
8815
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
8816
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
8817
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
8818
+ CoordinationType$1.ANNOTATION_EDITABLE,
8819
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
8820
+ ],
8821
+ [ViewType$1.ANNOTATION_CONTROLLER]: [
8822
+ CoordinationType$1.DATASET,
8823
+ CoordinationType$1.ANNOTATION_STORY,
8824
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
8825
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
8826
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
8827
+ CoordinationType$1.ANNOTATION_EDITABLE,
8828
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
8829
+ // Note: the annotation controller also needs to read the coordination state
8830
+ // of all other views/coordination types via the full config.
8831
+ // Note: we get/set the CoordinationType.ANNOTATION_SHAPES from the full config,
8832
+ // as this info is view-specific rather than global to the story.
8783
8833
  ],
8784
8834
  [ViewType$1.HEATMAP]: [
8785
8835
  CoordinationType$1.DATASET,
@@ -9502,7 +9552,19 @@ function buildConfigSchema(pluginFileTypes, pluginJointFileTypes, pluginCoordina
9502
9552
  w: z.number().int().optional(),
9503
9553
  h: z.number().int().optional(),
9504
9554
  coordinationScopes: componentCoordinationScopes.optional(),
9505
- coordinationScopesBy: componentCoordinationScopesBy.optional()
9555
+ coordinationScopesBy: componentCoordinationScopesBy.optional(),
9556
+ coordinationValues: z.object(
9557
+ // For view-level coordinationValues, the value schemas are used directly
9558
+ // (there is no coordination scope name as an intermediary).
9559
+ Object.fromEntries(
9560
+ pluginCoordinationTypes.map((ct) => [
9561
+ ct.name,
9562
+ ct.valueSchema.optional()
9563
+ ])
9564
+ )
9565
+ ).describe(
9566
+ "Mapping from coordination types to values, for values which do not need to be coordinated with other views. These take precedence over coordinationScopes."
9567
+ ).optional()
9506
9568
  })
9507
9569
  ).describe(
9508
9570
  "The layout array defines the views, or components, rendered in the grid."
@@ -9974,6 +10036,127 @@ const moleculesLayerObj = z.object({
9974
10036
  radius: z.number(),
9975
10037
  opacity: z.number()
9976
10038
  });
10039
+ const shapeBaseObj = z.object({
10040
+ uid: z.string(),
10041
+ text: z.string().optional(),
10042
+ strokeColor: z.array(z.number()).length(3).optional(),
10043
+ strokeWidth: z.number().optional(),
10044
+ // SVG-style dash pattern, e.g. "10 5" or "10 20 30 10". "none" or omitted = solid.
10045
+ strokeDashArray: z.string().optional(),
10046
+ visible: z.boolean().optional()
10047
+ // TODO: define unit modes for x and y axes
10048
+ // ("pixels" vs "normalized" vs "physical" etc.)
10049
+ // TODO: a coordinate system identifier (e.g., "DeckGL" for now,
10050
+ // but a coordinate system from OME-NGFF/SpatialData eventually?)
10051
+ });
10052
+ const rectangleShapeObj = shapeBaseObj.extend({
10053
+ type: z.literal("rectangle"),
10054
+ // OME-XML field names verbatim (upper-left origin)
10055
+ x: z.number(),
10056
+ y: z.number(),
10057
+ width: z.number(),
10058
+ height: z.number(),
10059
+ fillColor: z.array(z.number()).length(3).optional(),
10060
+ fillOpacity: z.number().optional()
10061
+ });
10062
+ const lineShapeObj = shapeBaseObj.extend({
10063
+ type: z.literal("line"),
10064
+ // OME-XML field names verbatim
10065
+ x1: z.number(),
10066
+ y1: z.number(),
10067
+ x2: z.number(),
10068
+ y2: z.number(),
10069
+ markerStart: z.enum(["Arrow", "Tick"]).nullable().optional(),
10070
+ markerEnd: z.enum(["Arrow", "Tick"]).nullable().optional(),
10071
+ textPosition: z.enum(["start", "middle", "end"]).optional(),
10072
+ textBufferPx: z.number().optional()
10073
+ });
10074
+ const ellipseShapeObj = shapeBaseObj.extend({
10075
+ type: z.literal("ellipse"),
10076
+ // OME-XML field names verbatim (centre point + radii)
10077
+ x1: z.number(),
10078
+ y1: z.number(),
10079
+ radiusX: z.number(),
10080
+ radiusY: z.number(),
10081
+ fillColor: z.array(z.number()).length(3).optional(),
10082
+ fillOpacity: z.number().optional()
10083
+ });
10084
+ const polygonShapeObj = shapeBaseObj.extend({
10085
+ type: z.literal("polygon"),
10086
+ // OME-XML: array of [x, y] coordinate pairs, closed automatically
10087
+ points: z.array(z.tuple([z.number(), z.number()])),
10088
+ fillColor: z.array(z.number()).length(3).optional(),
10089
+ fillOpacity: z.number().optional()
10090
+ });
10091
+ const polylineShapeObj = shapeBaseObj.extend({
10092
+ type: z.literal("polyline"),
10093
+ // OME-XML: array of [x, y] coordinate pairs, open (not closed)
10094
+ points: z.array(z.tuple([z.number(), z.number()])),
10095
+ markerStart: z.enum(["Arrow", "Tick"]).nullable().optional(),
10096
+ markerEnd: z.enum(["Arrow", "Tick"]).nullable().optional()
10097
+ });
10098
+ const annotationShapeObj = z.discriminatedUnion("type", [
10099
+ rectangleShapeObj,
10100
+ lineShapeObj,
10101
+ ellipseShapeObj,
10102
+ polygonShapeObj,
10103
+ polylineShapeObj
10104
+ ]);
10105
+ const annotationShapesArray = z.array(annotationShapeObj);
10106
+ const annotationFrameObj = z.object({
10107
+ uid: z.string(),
10108
+ title: z.string().optional(),
10109
+ description: z.string().optional(),
10110
+ descriptionType: z.enum(["text", "markdown"]).optional(),
10111
+ // A frame can define per-view: coordinationValues
10112
+ // (if the view's state should not be coordinated with other views)
10113
+ // or per-view coordinationScopes/coordinationScopesBy
10114
+ // (if at this frame, the view should be coordinated with other views).
10115
+ // We can also define a frame-level coordination space,
10116
+ // which will be merged with the global coordination space.
10117
+ // TODO: datasets
10118
+ // TODO: coordinationSpace
10119
+ layout: z.array(
10120
+ // Note: for now, we will infer view objects which have a uid
10121
+ // that is present in the global layout, and do NOT have x/y/w/h defined,
10122
+ // to mean that in this frame, the layout and set of views is unchanged
10123
+ // from the global layout.
10124
+ // This will allow each frame to omit the full list of views from the layout,
10125
+ // and only specify the views whose coordination state is changing in this frame.
10126
+ // If a frame includes a view with a uid that is not present
10127
+ // in the global layout, then that view will be added to the layout at this frame.
10128
+ // This frame should also define x/y/w/h for all views,
10129
+ // since it will otherwise be ambiguous how to layout the updated set of views
10130
+ // for this frame.
10131
+ z.object({
10132
+ // The view UID. If this view uid is not present in the global layout,
10133
+ // it will be added to the layout at this frame,
10134
+ // and will need to have its coordination values initialized to their defaults
10135
+ // for any that were not fully specified.
10136
+ uid: z.string(),
10137
+ coordinationValues: z.record(
10138
+ z.string(),
10139
+ // The coordination type name, e.g. "embeddingType"
10140
+ z.any()
10141
+ // The coordination value, e.g. "UMAP"
10142
+ // This should also support multi-level coordination via the schema defined in
10143
+ // https://github.com/keller-mark/use-coordination/pull/115
10144
+ ).optional()
10145
+ // TODO: support coordinationScopes/coordinationScopesBy for per-view coordination
10146
+ // at this frame.
10147
+ // TODO: view x/y/w/h once we support view layout changes per-frame.
10148
+ })
10149
+ ).optional()
10150
+ });
10151
+ const annotationStoryObj = z.object({
10152
+ // TODO: schema version for the story schema?
10153
+ // Same as current Vitessce schema version?
10154
+ uid: z.string(),
10155
+ title: z.string().optional(),
10156
+ description: z.string().optional(),
10157
+ descriptionType: z.enum(["text", "markdown"]).optional(),
10158
+ frames: z.array(annotationFrameObj)
10159
+ });
9977
10160
  export {
9978
10161
  VERSIONED_CONFIG_SCHEMAS,
9979
10162
  anndataCellSetsZarrSchema,
@@ -9981,6 +10164,10 @@ export {
9981
10164
  anndataExpressionMatrixZarrSchema,
9982
10165
  anndataH5adSchema,
9983
10166
  anndataZarrSchema,
10167
+ annotationFrameObj,
10168
+ annotationShapeObj,
10169
+ annotationShapesArray,
10170
+ annotationStoryObj,
9984
10171
  buildConfigSchema,
9985
10172
  cellsJsonSchema,
9986
10173
  cellsLayerObj,