@vitessce/csv 4.0.8 → 4.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +178 -10
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1086,7 +1086,8 @@ const ViewType$1 = {
1086
1086
  TREEMAP: "treemap",
1087
1087
  SAMPLE_SET_PAIR_MANAGER: "sampleSetPairManager",
1088
1088
  FEATURE_STATS_TABLE: "featureStatsTable",
1089
- SINGLE_OBS_SET_SELECTOR: "singleObsSetSelector"
1089
+ SINGLE_OBS_SET_SELECTOR: "singleObsSetSelector",
1090
+ ANNOTATION_CONTROLLER: "annotationController"
1090
1091
  };
1091
1092
  const DataType$1 = {
1092
1093
  OBS_LABELS: "obsLabels",
@@ -1107,7 +1108,8 @@ const DataType$1 = {
1107
1108
  COMPARISON_METADATA: "comparisonMetadata",
1108
1109
  FEATURE_STATS: "featureStats",
1109
1110
  FEATURE_SET_STATS: "featureSetStats",
1110
- OBS_SET_STATS: "obsSetStats"
1111
+ OBS_SET_STATS: "obsSetStats",
1112
+ ANNOTATION_STORY: "annotationStory"
1111
1113
  };
1112
1114
  const FileType$1 = {
1113
1115
  // Joint file types
@@ -1129,6 +1131,7 @@ const FileType$1 = {
1129
1131
  OBS_SETS_CSV: "obsSets.csv",
1130
1132
  OBS_SETS_JSON: "obsSets.json",
1131
1133
  SAMPLE_SETS_CSV: "sampleSets.csv",
1134
+ ANNOTATION_STORY_JSON: "annotationStory.json",
1132
1135
  // OME-Zarr
1133
1136
  IMAGE_OME_ZARR: "image.ome-zarr",
1134
1137
  OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
@@ -1413,7 +1416,15 @@ const CoordinationType$1 = {
1413
1416
  FEATURE_POINT_FOLD_CHANGE_THRESHOLD: "featurePointFoldChangeThreshold",
1414
1417
  FEATURE_LABEL_FOLD_CHANGE_THRESHOLD: "featureLabelFoldChangeThreshold",
1415
1418
  // Treemap
1416
- HIERARCHY_LEVELS: "hierarchyLevels"
1419
+ HIERARCHY_LEVELS: "hierarchyLevels",
1420
+ // Annotation frames
1421
+ ANNOTATION_STORY: "annotationStory",
1422
+ ANNOTATION_FRAME_INDEX: "annotationFrameIndex",
1423
+ ANNOTATION_SHAPES: "annotationShapes",
1424
+ ANNOTATION_OVERLAY_VISIBLE: "annotationOverlayVisible",
1425
+ ANNOTATION_TRANSITION_DURATION: "annotationTransitionDuration",
1426
+ ANNOTATION_SEMANTIC_ZOOM: "annotationSemanticZoom",
1427
+ ANNOTATION_EDITABLE: "annotationEditable"
1417
1428
  };
1418
1429
  ({
1419
1430
  // For new file types
@@ -1429,6 +1440,7 @@ const CoordinationType$1 = {
1429
1440
  [FileType$1.OBS_SEGMENTATIONS_JSON]: DataType$1.OBS_SEGMENTATIONS,
1430
1441
  [FileType$1.OBS_SETS_CSV]: DataType$1.OBS_SETS,
1431
1442
  [FileType$1.OBS_SETS_JSON]: DataType$1.OBS_SETS,
1443
+ [FileType$1.ANNOTATION_STORY_JSON]: DataType$1.ANNOTATION_STORY,
1432
1444
  [FileType$1.IMAGE_OME_ZARR]: DataType$1.IMAGE,
1433
1445
  [FileType$1.OBS_SEGMENTATIONS_OME_ZARR]: DataType$1.OBS_SEGMENTATIONS,
1434
1446
  [FileType$1.OBS_FEATURE_MATRIX_ANNDATA_ZARR]: DataType$1.OBS_FEATURE_MATRIX,
@@ -1551,7 +1563,8 @@ const CoordinationType$1 = {
1551
1563
  [DataType$1.OBS_SET_STATS]: [
1552
1564
  CoordinationType$1.OBS_TYPE
1553
1565
  // TODO: should sampleType, obsSetSelection, and/or sampleSetSelection be used here?
1554
- ]
1566
+ ],
1567
+ [DataType$1.ANNOTATION_STORY]: []
1555
1568
  });
1556
1569
  ({
1557
1570
  // For AnnData:
@@ -1684,7 +1697,9 @@ const CoordinationType$1 = {
1684
1697
  CoordinationType$1.SPATIAL_TARGET_Z,
1685
1698
  CoordinationType$1.SPATIAL_AXIS_FIXED,
1686
1699
  CoordinationType$1.SPATIAL_ORBIT_AXIS,
1687
- CoordinationType$1.FEATURE_AGGREGATION_STRATEGY
1700
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
1701
+ // Annotation shapes are specific to a view's coordinate system.
1702
+ CoordinationType$1.ANNOTATION_SHAPES
1688
1703
  ];
1689
1704
  ({
1690
1705
  [ViewType$1.NEUROGLANCER]: [
@@ -1776,7 +1791,14 @@ const CoordinationType$1 = {
1776
1791
  CoordinationType$1.EMBEDDING_CONTOURS_FILLED,
1777
1792
  CoordinationType$1.EMBEDDING_CONTOUR_PERCENTILES,
1778
1793
  CoordinationType$1.CONTOUR_COLOR_ENCODING,
1779
- CoordinationType$1.CONTOUR_COLOR
1794
+ CoordinationType$1.CONTOUR_COLOR,
1795
+ CoordinationType$1.ANNOTATION_STORY,
1796
+ CoordinationType$1.ANNOTATION_SHAPES,
1797
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
1798
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
1799
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
1800
+ CoordinationType$1.ANNOTATION_EDITABLE,
1801
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
1780
1802
  ],
1781
1803
  [ViewType$1.DUAL_SCATTERPLOT]: [
1782
1804
  CoordinationType$1.DATASET,
@@ -1892,7 +1914,14 @@ const CoordinationType$1 = {
1892
1914
  CoordinationType$1.ADDITIONAL_OBS_SETS,
1893
1915
  CoordinationType$1.MOLECULE_HIGHLIGHT,
1894
1916
  CoordinationType$1.TOOLTIPS_VISIBLE,
1895
- CoordinationType$1.PHOTOMETRIC_INTERPRETATION
1917
+ CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
1918
+ CoordinationType$1.ANNOTATION_STORY,
1919
+ CoordinationType$1.ANNOTATION_SHAPES,
1920
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
1921
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
1922
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
1923
+ CoordinationType$1.ANNOTATION_EDITABLE,
1924
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
1896
1925
  ],
1897
1926
  [ViewType$1.SPATIAL_BETA]: [
1898
1927
  CoordinationType$1.META_COORDINATION_SCOPES,
@@ -1970,7 +1999,27 @@ const CoordinationType$1 = {
1970
1999
  CoordinationType$1.SPATIAL_CHANNEL_LABELS_ORIENTATION,
1971
2000
  CoordinationType$1.SPATIAL_CHANNEL_LABEL_SIZE,
1972
2001
  CoordinationType$1.SPATIAL_CHANNELS_SORT_ORDER,
1973
- CoordinationType$1.PHOTOMETRIC_INTERPRETATION
2002
+ CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
2003
+ CoordinationType$1.ANNOTATION_STORY,
2004
+ CoordinationType$1.ANNOTATION_SHAPES,
2005
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
2006
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
2007
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
2008
+ CoordinationType$1.ANNOTATION_EDITABLE,
2009
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
2010
+ ],
2011
+ [ViewType$1.ANNOTATION_CONTROLLER]: [
2012
+ CoordinationType$1.DATASET,
2013
+ CoordinationType$1.ANNOTATION_STORY,
2014
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
2015
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
2016
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
2017
+ CoordinationType$1.ANNOTATION_EDITABLE,
2018
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
2019
+ // Note: the annotation controller also needs to read the coordination state
2020
+ // of all other views/coordination types via the full config.
2021
+ // Note: we get/set the CoordinationType.ANNOTATION_SHAPES from the full config,
2022
+ // as this info is view-specific rather than global to the story.
1974
2023
  ],
1975
2024
  [ViewType$1.HEATMAP]: [
1976
2025
  CoordinationType$1.DATASET,
@@ -8409,7 +8458,7 @@ const latestFileDefSchema = z.object({
8409
8458
  options: fileOptionsSchema.optional(),
8410
8459
  requestInit: requestInit.optional(),
8411
8460
  // New: file def can have coordinationValues.
8412
- coordinationValues: z.record(z.string()).optional()
8461
+ coordinationValues: z.record(z.any()).optional()
8413
8462
  });
8414
8463
  const datasetsSchema1_0_13 = z.array(z.object({
8415
8464
  uid: z.string(),
@@ -8440,7 +8489,8 @@ const configSchema1_0_16 = configSchema1_0_13.extend({
8440
8489
  h: z.number().int().optional(),
8441
8490
  // Updates coordinationScopes and coordinationScopesBy
8442
8491
  coordinationScopes: componentCoordinationScopes.optional(),
8443
- coordinationScopesBy: componentCoordinationScopesBy.optional()
8492
+ coordinationScopesBy: componentCoordinationScopesBy.optional(),
8493
+ coordinationValues: z.record(z.any()).optional()
8444
8494
  }))
8445
8495
  });
8446
8496
  const configSchema1_0_17 = configSchema1_0_16.extend({
@@ -11525,6 +11575,124 @@ z.object({
11525
11575
  radius: z.number(),
11526
11576
  opacity: z.number()
11527
11577
  });
11578
+ const shapeBaseObj = z.object({
11579
+ uid: z.string(),
11580
+ text: z.string().optional(),
11581
+ strokeColor: z.array(z.number()).length(3).optional(),
11582
+ strokeWidth: z.number().optional(),
11583
+ // SVG-style dash pattern, e.g. "10 5" or "10 20 30 10". "none" or omitted = solid.
11584
+ strokeDashArray: z.string().optional(),
11585
+ visible: z.boolean().optional()
11586
+ // TODO: define unit modes for x and y axes
11587
+ // ("pixels" vs "normalized" vs "physical" etc.)
11588
+ // TODO: a coordinate system identifier (e.g., "DeckGL" for now,
11589
+ // but a coordinate system from OME-NGFF/SpatialData eventually?)
11590
+ });
11591
+ const rectangleShapeObj = shapeBaseObj.extend({
11592
+ type: z.literal("rectangle"),
11593
+ // OME-XML field names verbatim (upper-left origin)
11594
+ x: z.number(),
11595
+ y: z.number(),
11596
+ width: z.number(),
11597
+ height: z.number(),
11598
+ fillColor: z.array(z.number()).length(3).optional(),
11599
+ fillOpacity: z.number().optional()
11600
+ });
11601
+ const lineShapeObj = shapeBaseObj.extend({
11602
+ type: z.literal("line"),
11603
+ // OME-XML field names verbatim
11604
+ x1: z.number(),
11605
+ y1: z.number(),
11606
+ x2: z.number(),
11607
+ y2: z.number(),
11608
+ markerStart: z.enum(["Arrow", "Tick"]).nullable().optional(),
11609
+ markerEnd: z.enum(["Arrow", "Tick"]).nullable().optional(),
11610
+ textPosition: z.enum(["start", "middle", "end"]).optional(),
11611
+ textBufferPx: z.number().optional()
11612
+ });
11613
+ const ellipseShapeObj = shapeBaseObj.extend({
11614
+ type: z.literal("ellipse"),
11615
+ // OME-XML field names verbatim (centre point + radii)
11616
+ x1: z.number(),
11617
+ y1: z.number(),
11618
+ radiusX: z.number(),
11619
+ radiusY: z.number(),
11620
+ fillColor: z.array(z.number()).length(3).optional(),
11621
+ fillOpacity: z.number().optional()
11622
+ });
11623
+ const polygonShapeObj = shapeBaseObj.extend({
11624
+ type: z.literal("polygon"),
11625
+ // OME-XML: array of [x, y] coordinate pairs, closed automatically
11626
+ points: z.array(z.tuple([z.number(), z.number()])),
11627
+ fillColor: z.array(z.number()).length(3).optional(),
11628
+ fillOpacity: z.number().optional()
11629
+ });
11630
+ const polylineShapeObj = shapeBaseObj.extend({
11631
+ type: z.literal("polyline"),
11632
+ // OME-XML: array of [x, y] coordinate pairs, open (not closed)
11633
+ points: z.array(z.tuple([z.number(), z.number()])),
11634
+ markerStart: z.enum(["Arrow", "Tick"]).nullable().optional(),
11635
+ markerEnd: z.enum(["Arrow", "Tick"]).nullable().optional()
11636
+ });
11637
+ const annotationShapeObj = z.discriminatedUnion("type", [
11638
+ rectangleShapeObj,
11639
+ lineShapeObj,
11640
+ ellipseShapeObj,
11641
+ polygonShapeObj,
11642
+ polylineShapeObj
11643
+ ]);
11644
+ z.array(annotationShapeObj);
11645
+ const annotationFrameObj = z.object({
11646
+ uid: z.string(),
11647
+ title: z.string().optional(),
11648
+ description: z.string().optional(),
11649
+ descriptionType: z.enum(["text", "markdown"]).optional(),
11650
+ // A frame can define per-view: coordinationValues
11651
+ // (if the view's state should not be coordinated with other views)
11652
+ // or per-view coordinationScopes/coordinationScopesBy
11653
+ // (if at this frame, the view should be coordinated with other views).
11654
+ // We can also define a frame-level coordination space,
11655
+ // which will be merged with the global coordination space.
11656
+ // TODO: datasets
11657
+ // TODO: coordinationSpace
11658
+ layout: z.array(
11659
+ // Note: for now, we will infer view objects which have a uid
11660
+ // that is present in the global layout, and do NOT have x/y/w/h defined,
11661
+ // to mean that in this frame, the layout and set of views is unchanged
11662
+ // from the global layout.
11663
+ // This will allow each frame to omit the full list of views from the layout,
11664
+ // and only specify the views whose coordination state is changing in this frame.
11665
+ // If a frame includes a view with a uid that is not present
11666
+ // in the global layout, then that view will be added to the layout at this frame.
11667
+ // This frame should also define x/y/w/h for all views,
11668
+ // since it will otherwise be ambiguous how to layout the updated set of views
11669
+ // for this frame.
11670
+ z.object({
11671
+ // The view UID. If this view uid is not present in the global layout,
11672
+ // it will be added to the layout at this frame,
11673
+ // and will need to have its coordination values initialized to their defaults
11674
+ // for any that were not fully specified.
11675
+ uid: z.string(),
11676
+ coordinationValues: z.record(
11677
+ z.string(),
11678
+ // The coordination type name, e.g. "embeddingType"
11679
+ z.any()
11680
+ ).optional()
11681
+ // TODO: support coordinationScopes/coordinationScopesBy for per-view coordination
11682
+ // at this frame.
11683
+ // TODO: view x/y/w/h once we support view layout changes per-frame.
11684
+ })
11685
+ ).optional()
11686
+ });
11687
+ z.object({
11688
+ // TODO: schema version for the story schema?
11689
+ // Same as current Vitessce schema version?
11690
+ uid: z.string(),
11691
+ title: z.string().optional(),
11692
+ description: z.string().optional(),
11693
+ descriptionType: z.enum(["text", "markdown"]).optional(),
11694
+ frames: z.array(annotationFrameObj)
11695
+ });
11528
11696
  const SETS_DATATYPE_OBS = "obs";
11529
11697
  const HIERARCHICAL_SCHEMAS = {
11530
11698
  latestVersion: "0.1.3"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/csv",
3
- "version": "4.0.8",
3
+ "version": "4.0.10",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -18,11 +18,11 @@
18
18
  "dependencies": {
19
19
  "d3-array": "^2.4.0",
20
20
  "d3-dsv": "^1.1.1",
21
- "@vitessce/constants-internal": "4.0.8",
22
- "@vitessce/sets-utils": "4.0.8",
23
- "@vitessce/abstract": "4.0.8",
24
- "@vitessce/error": "4.0.8",
25
- "@vitessce/config": "4.0.8"
21
+ "@vitessce/constants-internal": "4.0.10",
22
+ "@vitessce/sets-utils": "4.0.10",
23
+ "@vitessce/abstract": "4.0.10",
24
+ "@vitessce/error": "4.0.10",
25
+ "@vitessce/config": "4.0.10"
26
26
  },
27
27
  "scripts": {
28
28
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",