bdsa-react-components 0.1.15 → 0.1.17

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.
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Utilities for handling different annotation formats (GeoJSON, DSA, etc.)
3
+ */
4
+ /**
5
+ * GeoJSON Feature types
6
+ */
7
+ interface GeoJSONFeature {
8
+ type: 'Feature';
9
+ geometry: {
10
+ type: 'Polygon' | 'LineString' | 'Point' | 'MultiPolygon' | 'MultiLineString' | 'MultiPoint';
11
+ coordinates: number[][] | number[][][] | number[];
12
+ };
13
+ properties?: {
14
+ [key: string]: unknown;
15
+ lineColor?: string;
16
+ fillColor?: string;
17
+ stroke?: string;
18
+ fill?: string;
19
+ 'stroke-width'?: number;
20
+ lineWidth?: number;
21
+ group?: string;
22
+ id?: string;
23
+ label?: string;
24
+ name?: string;
25
+ };
26
+ }
27
+ interface GeoJSONFeatureCollection {
28
+ type: 'FeatureCollection';
29
+ features: GeoJSONFeature[];
30
+ }
31
+ /**
32
+ * DSA Annotation Element format
33
+ */
34
+ export interface DSAElement {
35
+ type: 'polyline' | 'rectangle' | 'point';
36
+ points?: Array<[number, number]>;
37
+ x?: number;
38
+ y?: number;
39
+ width?: number;
40
+ height?: number;
41
+ closed?: boolean;
42
+ lineColor?: string;
43
+ fillColor?: string;
44
+ lineWidth?: number;
45
+ group?: string;
46
+ label?: string;
47
+ [key: string]: unknown;
48
+ }
49
+ /**
50
+ * Check if an object is a GeoJSON FeatureCollection
51
+ */
52
+ export declare function isGeoJSONFeatureCollection(obj: unknown): obj is GeoJSONFeatureCollection;
53
+ /**
54
+ * Check if an object is a DSA annotation format
55
+ */
56
+ export declare function isDSAAnnotation(obj: unknown): boolean;
57
+ /**
58
+ * Transform a GeoJSON Feature to DSA Element format
59
+ */
60
+ export declare function geoJSONFeatureToDSAElement(feature: GeoJSONFeature): DSAElement | null;
61
+ /**
62
+ * Transform a GeoJSON FeatureCollection to an array of DSA elements
63
+ */
64
+ export declare function geoJSONToDSAElements(featureCollection: GeoJSONFeatureCollection): DSAElement[];
65
+ /**
66
+ * Detect annotation format and extract elements array
67
+ * Supports both GeoJSON FeatureCollection and DSA formats
68
+ */
69
+ export declare function extractAnnotationElements(annotationDoc: unknown): DSAElement[];
70
+ /**
71
+ * Auto-detect annotation format and return format name
72
+ */
73
+ export declare function detectAnnotationFormat(annotationDoc: unknown): 'geojson' | 'dsa' | 'unknown';
74
+ export {};
75
+ //# sourceMappingURL=annotationFormats.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"annotationFormats.d.ts","sourceRoot":"","sources":["../../src/utils/annotationFormats.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,UAAU,cAAc;IACpB,IAAI,EAAE,SAAS,CAAA;IACf,QAAQ,EAAE;QACN,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,cAAc,GAAG,iBAAiB,GAAG,YAAY,CAAA;QAC5F,WAAW,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,EAAE,CAAA;KACpD,CAAA;IACD,UAAU,CAAC,EAAE;QACT,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;QACtB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,MAAM,CAAC,EAAE,MAAM,CAAA;QACf,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,cAAc,CAAC,EAAE,MAAM,CAAA;QACvB,SAAS,CAAC,EAAE,MAAM,CAAA;QAClB,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,EAAE,CAAC,EAAE,MAAM,CAAA;QACX,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,IAAI,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACJ;AAED,UAAU,wBAAwB;IAC9B,IAAI,EAAE,mBAAmB,CAAA;IACzB,QAAQ,EAAE,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
4
  "description": "Reusable React components for the Digital Slide Archive project",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",