bdsa-react-components 0.1.19 → 0.1.21
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/CHANGELOG.md +66 -0
- package/CURSOR_INTEGRATION.md +75 -15
- package/dist/components/AnnotationManager/AnnotationManager.d.ts +2 -183
- package/dist/components/AnnotationManager/AnnotationManager.d.ts.map +1 -1
- package/dist/components/AnnotationManager/AnnotationManager.types.d.ts +120 -0
- package/dist/components/AnnotationManager/AnnotationManager.types.d.ts.map +1 -0
- package/dist/components/FolderBrowser/FolderBrowser.d.ts +2 -115
- package/dist/components/FolderBrowser/FolderBrowser.d.ts.map +1 -1
- package/dist/components/FolderBrowser/FolderBrowser.render.d.ts +12 -0
- package/dist/components/FolderBrowser/FolderBrowser.render.d.ts.map +1 -0
- package/dist/components/FolderBrowser/FolderBrowser.types.d.ts +94 -0
- package/dist/components/FolderBrowser/FolderBrowser.types.d.ts.map +1 -0
- package/dist/components/FolderBrowser/FolderBrowser.utils.d.ts +34 -0
- package/dist/components/FolderBrowser/FolderBrowser.utils.d.ts.map +1 -0
- package/dist/components/FolderBrowser/useFolderBrowserDataFetching.d.ts +58 -0
- package/dist/components/FolderBrowser/useFolderBrowserDataFetching.d.ts.map +1 -0
- package/dist/components/FolderThumbnailBrowser/FolderThumbnailBrowser.d.ts +54 -0
- package/dist/components/FolderThumbnailBrowser/FolderThumbnailBrowser.d.ts.map +1 -0
- package/dist/components/SlideViewer/SlideViewer.d.ts +2 -169
- package/dist/components/SlideViewer/SlideViewer.d.ts.map +1 -1
- package/dist/components/SlideViewer/SlideViewer.types.d.ts +175 -0
- package/dist/components/SlideViewer/SlideViewer.types.d.ts.map +1 -0
- package/dist/components/SlideViewer/SlideViewer.utils.d.ts +46 -0
- package/dist/components/SlideViewer/SlideViewer.utils.d.ts.map +1 -0
- package/dist/components/SlideViewer/hooks/index.d.ts +5 -0
- package/dist/components/SlideViewer/hooks/index.d.ts.map +1 -0
- package/dist/components/SlideViewer/hooks/useAnnotationFetching.d.ts +23 -0
- package/dist/components/SlideViewer/hooks/useAnnotationFetching.d.ts.map +1 -0
- package/dist/components/SlideViewer/hooks/useAnnotationOpacity.d.ts +8 -0
- package/dist/components/SlideViewer/hooks/useAnnotationOpacity.d.ts.map +1 -0
- package/dist/components/SlideViewer/hooks/useAnnotationRendering.d.ts +14 -0
- package/dist/components/SlideViewer/hooks/useAnnotationRendering.d.ts.map +1 -0
- package/dist/components/SlideViewer/hooks/useSlideViewerInitialization.d.ts +21 -0
- package/dist/components/SlideViewer/hooks/useSlideViewerInitialization.d.ts.map +1 -0
- package/dist/components/ThumbnailGrid/ThumbnailGrid.d.ts +55 -0
- package/dist/components/ThumbnailGrid/ThumbnailGrid.d.ts.map +1 -0
- package/dist/components/ThumbnailViewer/ThumbnailViewer.d.ts +45 -0
- package/dist/components/ThumbnailViewer/ThumbnailViewer.d.ts.map +1 -0
- package/dist/index.cjs +70 -70
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38794 -37706
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/utils/debugLog.d.ts +18 -0
- package/dist/utils/debugLog.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Item } from './FolderBrowser.types';
|
|
3
|
+
|
|
4
|
+
export interface RenderItemNodeParams {
|
|
5
|
+
item: Item;
|
|
6
|
+
depth: number;
|
|
7
|
+
isSelected: boolean;
|
|
8
|
+
onItemSelect: (item: Item) => void;
|
|
9
|
+
renderItem?: (item: Item, depth: number) => React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
export declare function renderItemNodeContent({ item, depth, isSelected, onItemSelect, renderItem, }: RenderItemNodeParams): React.ReactNode;
|
|
12
|
+
//# sourceMappingURL=FolderBrowser.render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FolderBrowser.render.d.ts","sourceRoot":"","sources":["../../../src/components/FolderBrowser/FolderBrowser.render.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAGjD,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,OAAO,CAAA;IACnB,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IAClC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC,SAAS,CAAA;CAC9D;AAED,wBAAgB,qBAAqB,CAAC,EAClC,IAAI,EACJ,KAAK,EACL,UAAU,EACV,YAAY,EACZ,UAAU,GACb,EAAE,oBAAoB,GAAG,KAAK,CAAC,SAAS,CAmCxC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
export interface Collection {
|
|
3
|
+
_id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
public?: boolean;
|
|
7
|
+
created?: string;
|
|
8
|
+
updated?: string;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export interface Folder {
|
|
12
|
+
_id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
public?: boolean;
|
|
16
|
+
created?: string;
|
|
17
|
+
updated?: string;
|
|
18
|
+
parentId?: string;
|
|
19
|
+
parentType?: 'collection' | 'folder';
|
|
20
|
+
[key: string]: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface Item {
|
|
23
|
+
_id: string;
|
|
24
|
+
name: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
folderId?: string;
|
|
27
|
+
collectionId?: string;
|
|
28
|
+
public?: boolean;
|
|
29
|
+
created?: string;
|
|
30
|
+
updated?: string;
|
|
31
|
+
[key: string]: unknown;
|
|
32
|
+
}
|
|
33
|
+
export type Resource = (Collection | Folder | Item) & {
|
|
34
|
+
type: 'collection' | 'folder' | 'item';
|
|
35
|
+
};
|
|
36
|
+
export interface FolderBrowserProps {
|
|
37
|
+
/** Base URL for DSA API (e.g., http://bdsa.pathology.emory.edu:8080/api/v1) */
|
|
38
|
+
apiBaseUrl?: string;
|
|
39
|
+
/** Custom fetch function for API requests. Useful for adding authentication headers. */
|
|
40
|
+
fetchFn?: (url: string, options?: RequestInit) => Promise<Response>;
|
|
41
|
+
/** Custom headers to add to all API requests. Merged with fetchFn headers if both are provided. */
|
|
42
|
+
apiHeaders?: HeadersInit;
|
|
43
|
+
/** Callback when a resource (collection or folder) is selected */
|
|
44
|
+
onResourceSelect?: (resource: Resource) => void;
|
|
45
|
+
/** Callback when an item is selected */
|
|
46
|
+
onItemSelect?: (item: Item) => void;
|
|
47
|
+
/** Unified callback for any selection (resource or item) */
|
|
48
|
+
onSelectionChange?: (resource: Resource) => void;
|
|
49
|
+
/** Whether to show collections (default: true) */
|
|
50
|
+
showCollections?: boolean;
|
|
51
|
+
/** Root collection or folder ID to start from (if provided, only shows that resource and its children) */
|
|
52
|
+
rootId?: string;
|
|
53
|
+
/** Type of root resource (required if rootId is provided) */
|
|
54
|
+
rootType?: 'collection' | 'folder';
|
|
55
|
+
/** Collection ID to auto-expand on load */
|
|
56
|
+
startCollectionId?: string;
|
|
57
|
+
/** Folder ID to auto-expand on load */
|
|
58
|
+
startFolderId?: string;
|
|
59
|
+
/** Start at a folder's subfolder (requires parentFolderId) (deprecated: use rootId and rootType) */
|
|
60
|
+
parentFolderId?: string;
|
|
61
|
+
/** Custom render function for collections */
|
|
62
|
+
renderCollection?: (collection: Collection, isExpanded: boolean, onToggle: () => void, itemCount?: number) => React.ReactNode;
|
|
63
|
+
/** Custom render function for folders */
|
|
64
|
+
renderFolder?: (folder: Folder, depth: number, isExpanded: boolean, onToggle: () => void, itemCount?: number) => React.ReactNode;
|
|
65
|
+
/** Custom render function for items */
|
|
66
|
+
renderItem?: (item: Item, depth: number) => React.ReactNode;
|
|
67
|
+
/** Custom CSS class name */
|
|
68
|
+
className?: string;
|
|
69
|
+
/** Whether to persist expansion state to localStorage (default: false) */
|
|
70
|
+
persistExpansion?: boolean;
|
|
71
|
+
/** Key prefix for localStorage keys when persistExpansion is true (default: 'bdsa-folder-browser') */
|
|
72
|
+
persistExpansionKey?: string;
|
|
73
|
+
/** Whether to persist selection to localStorage (default: false) */
|
|
74
|
+
persistSelection?: boolean;
|
|
75
|
+
/** Key for localStorage when persistSelection is true (default: 'bdsa-folder-browser-selection') */
|
|
76
|
+
persistSelectionKey?: string;
|
|
77
|
+
/** Maximum number of folders to fetch per page (0 = fetch all, default: 0) */
|
|
78
|
+
foldersPerPage?: number;
|
|
79
|
+
/** Maximum number of items to fetch per page (0 = fetch all, default: 0) */
|
|
80
|
+
itemsPerPage?: number;
|
|
81
|
+
/** Whether to fetch and display items (default: false) */
|
|
82
|
+
showItems?: boolean;
|
|
83
|
+
/** Whether to fetch items (for counting) even if not displaying them (default: false) */
|
|
84
|
+
fetchItems?: boolean;
|
|
85
|
+
/** Filter function for items (applied after fetching) */
|
|
86
|
+
itemFilter?: (item: Item) => boolean;
|
|
87
|
+
/** Callback when items are fetched for a folder */
|
|
88
|
+
onItemsFetched?: (folderId: string, items: Item[]) => void;
|
|
89
|
+
/** Whether to show item count next to folder names (default: false) */
|
|
90
|
+
showItemCount?: boolean;
|
|
91
|
+
/** If true, enables debug logging to console. Default: false */
|
|
92
|
+
debug?: boolean;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=FolderBrowser.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FolderBrowser.types.d.ts","sourceRoot":"","sources":["../../../src/components/FolderBrowser/FolderBrowser.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;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IAC3D,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,0EAA0E;IAC1E,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,sGAAsG;IACtG,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,oEAAoE;IACpE,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,oGAAoG;IACpG,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,0DAA0D;IAC1D,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,yFAAyF;IACzF,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,yDAAyD;IACzD,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAA;IACpC,mDAAmD;IACnD,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;IAC1D,uEAAuE;IACvE,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,gEAAgE;IAChE,KAAK,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Folder } from './FolderBrowser.types';
|
|
2
|
+
import { DebugLogger } from '../../utils/debugLog';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Build fetch options with API headers
|
|
6
|
+
*/
|
|
7
|
+
export declare function buildFetchOptions(apiHeaders?: HeadersInit): RequestInit;
|
|
8
|
+
/**
|
|
9
|
+
* Find the scrollable parent container for an element
|
|
10
|
+
*/
|
|
11
|
+
export declare function findScrollContainer(element: HTMLElement | null): HTMLElement | null;
|
|
12
|
+
/**
|
|
13
|
+
* Preserve scroll position when expanding/collapsing tree nodes
|
|
14
|
+
* Returns a function to restore scroll position after DOM updates
|
|
15
|
+
*/
|
|
16
|
+
export declare function preserveScrollPosition(container: HTMLElement | null, targetElement?: HTMLElement | null): {
|
|
17
|
+
scrollContainer: HTMLElement | null;
|
|
18
|
+
scrollTop: number;
|
|
19
|
+
initialTop: number;
|
|
20
|
+
restore: () => void;
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Parse paginated API response (handles both array and paginated object responses)
|
|
24
|
+
*/
|
|
25
|
+
export declare function parsePaginatedResponse<T>(data: unknown, currentOffset: number, pageSize: number): {
|
|
26
|
+
items: T[];
|
|
27
|
+
hasMore: boolean;
|
|
28
|
+
total?: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Search for a folder recursively in collections
|
|
32
|
+
*/
|
|
33
|
+
export declare function searchFolderInCollections(folderId: string, apiBaseUrl: string, customFetch: (url: string, options?: RequestInit) => Promise<Response>, fetchOptions: RequestInit, debugLog: DebugLogger): Promise<Folder | null>;
|
|
34
|
+
//# sourceMappingURL=FolderBrowser.utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FolderBrowser.utils.d.ts","sourceRoot":"","sources":["../../../src/components/FolderBrowser/FolderBrowser.utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,MAAM,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,CAAC,EAAE,WAAW,GAAG,WAAW,CAMvE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,WAAW,GAAG,IAAI,CAgBnF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAClC,SAAS,EAAE,WAAW,GAAG,IAAI,EAC7B,aAAa,CAAC,EAAE,WAAW,GAAG,IAAI,GACnC;IACC,eAAe,EAAE,WAAW,GAAG,IAAI,CAAA;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,EAAE,MAAM,IAAI,CAAA;CACtB,CAuCA;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACpC,IAAI,EAAE,OAAO,EACb,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,MAAM,GACjB;IAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAmBlD;AAED;;GAEG;AACH,wBAAsB,yBAAyB,CAC3C,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,EACtE,YAAY,EAAE,WAAW,EACzB,QAAQ,EAAE,WAAW,GACtB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAmExB"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { Collection, Folder, Item } from './FolderBrowser.types';
|
|
2
|
+
import { DebugLogger } from '../../utils/debugLog';
|
|
3
|
+
|
|
4
|
+
export interface UseFolderBrowserDataFetchingParams {
|
|
5
|
+
apiBaseUrl?: string;
|
|
6
|
+
fetchFn?: (url: string, options?: RequestInit) => Promise<Response>;
|
|
7
|
+
apiHeaders?: HeadersInit;
|
|
8
|
+
foldersPerPage?: number;
|
|
9
|
+
itemsPerPage?: number;
|
|
10
|
+
shouldFetchItems: boolean;
|
|
11
|
+
itemFilter?: (item: Item) => boolean;
|
|
12
|
+
onItemsFetched?: (folderId: string, items: Item[]) => void;
|
|
13
|
+
startCollectionId?: string;
|
|
14
|
+
startFolderId?: string;
|
|
15
|
+
rootId?: string;
|
|
16
|
+
rootType?: 'collection' | 'folder';
|
|
17
|
+
setCollections: React.Dispatch<React.SetStateAction<Collection[]>>;
|
|
18
|
+
setRootCollection: React.Dispatch<React.SetStateAction<Collection | null>>;
|
|
19
|
+
setRootFolder: React.Dispatch<React.SetStateAction<Folder | null>>;
|
|
20
|
+
setFolders: React.Dispatch<React.SetStateAction<Record<string, Folder[]>>>;
|
|
21
|
+
setItems: React.Dispatch<React.SetStateAction<Record<string, Item[]>>>;
|
|
22
|
+
setPaginationState: React.Dispatch<React.SetStateAction<Record<string, {
|
|
23
|
+
offset: number;
|
|
24
|
+
hasMore: boolean;
|
|
25
|
+
loaded: boolean;
|
|
26
|
+
}>>>;
|
|
27
|
+
setItemPaginationState: React.Dispatch<React.SetStateAction<Record<string, {
|
|
28
|
+
offset: number;
|
|
29
|
+
hasMore: boolean;
|
|
30
|
+
totalCount?: number;
|
|
31
|
+
}>>>;
|
|
32
|
+
setLoading: React.Dispatch<React.SetStateAction<boolean>>;
|
|
33
|
+
setLoadingFolders: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
|
|
34
|
+
setLoadingItems: React.Dispatch<React.SetStateAction<Record<string, boolean>>>;
|
|
35
|
+
setError: React.Dispatch<React.SetStateAction<Error | null>>;
|
|
36
|
+
setExpandedCollections: React.Dispatch<React.SetStateAction<Set<string>>>;
|
|
37
|
+
setExpandedFolders: React.Dispatch<React.SetStateAction<Set<string>>>;
|
|
38
|
+
paginationState: Record<string, {
|
|
39
|
+
offset: number;
|
|
40
|
+
hasMore: boolean;
|
|
41
|
+
loaded: boolean;
|
|
42
|
+
}>;
|
|
43
|
+
itemPaginationState: Record<string, {
|
|
44
|
+
offset: number;
|
|
45
|
+
hasMore: boolean;
|
|
46
|
+
totalCount?: number;
|
|
47
|
+
}>;
|
|
48
|
+
debugLog: DebugLogger;
|
|
49
|
+
}
|
|
50
|
+
export interface UseFolderBrowserDataFetchingReturn {
|
|
51
|
+
loadCollections: () => Promise<void>;
|
|
52
|
+
loadFoldersForCollection: (collection: Collection, append?: boolean) => Promise<void>;
|
|
53
|
+
loadFoldersForFolder: (folder: Folder, append?: boolean) => Promise<void>;
|
|
54
|
+
loadItemsForFolder: (folderId: string, folder?: Folder, append?: boolean) => Promise<void>;
|
|
55
|
+
loadRoot: () => Promise<void>;
|
|
56
|
+
}
|
|
57
|
+
export declare function useFolderBrowserDataFetching(params: UseFolderBrowserDataFetchingParams): UseFolderBrowserDataFetchingReturn;
|
|
58
|
+
//# sourceMappingURL=useFolderBrowserDataFetching.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFolderBrowserDataFetching.d.ts","sourceRoot":"","sources":["../../../src/components/FolderBrowser/useFolderBrowserDataFetching.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAErE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,WAAW,kCAAkC;IAE/C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAA;IACnE,UAAU,CAAC,EAAE,WAAW,CAAA;IACxB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,OAAO,CAAA;IACzB,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAA;IACpC,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,IAAI,CAAA;IAC1D,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,YAAY,GAAG,QAAQ,CAAA;IAGlC,cAAc,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK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CAAA;CAChC;AAED,wBAAgB,4BAA4B,CACxC,MAAM,EAAE,kCAAkC,GAC3C,kCAAkC,CAsbpC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Item } from '../../utils/itemUtils';
|
|
3
|
+
|
|
4
|
+
export interface FolderThumbnailBrowserProps {
|
|
5
|
+
/** DSA folder ID to fetch items from */
|
|
6
|
+
folderId?: string;
|
|
7
|
+
/** Array of specific image IDs to display */
|
|
8
|
+
imageIds?: string[];
|
|
9
|
+
/** Pre-loaded items array (takes precedence) */
|
|
10
|
+
items?: Item[];
|
|
11
|
+
/** DSA API base URL (e.g., "http://bdsa.pathology.emory.edu:8080/api/v1") */
|
|
12
|
+
apiBaseUrl: string;
|
|
13
|
+
/** Backend API base URL for annotation caching (optional, falls back to apiBaseUrl if not provided) */
|
|
14
|
+
backendApiBaseUrl?: string;
|
|
15
|
+
/** Headers for API requests (auth, etc.) */
|
|
16
|
+
apiHeaders?: HeadersInit;
|
|
17
|
+
/** Custom fetch function for API requests */
|
|
18
|
+
fetchFn?: (url: string, options?: RequestInit) => Promise<Response>;
|
|
19
|
+
/** Initial items per page estimate (default: 12) */
|
|
20
|
+
itemsPerPage?: number;
|
|
21
|
+
/** Thumbnail size preset (default: 'l') */
|
|
22
|
+
viewerSize?: 's' | 'm' | 'l' | 'xl';
|
|
23
|
+
/** Name of currently selected annotation to display */
|
|
24
|
+
selectedAnnotationName?: string;
|
|
25
|
+
/** Map of itemId -> annotationId */
|
|
26
|
+
annotationNameToIds?: Map<string, string> | Record<string, string>;
|
|
27
|
+
/** Opacity for annotations (0-1, default: 0.7) */
|
|
28
|
+
annotationOpacity?: number;
|
|
29
|
+
/** Callback when opacity changes */
|
|
30
|
+
onAnnotationOpacityChange?: (opacity: number) => void;
|
|
31
|
+
/** Display name for model (if viewing model training images) */
|
|
32
|
+
modelName?: string;
|
|
33
|
+
/** Dataset split information */
|
|
34
|
+
modelDatasetInfo?: {
|
|
35
|
+
train: string[];
|
|
36
|
+
val: string[];
|
|
37
|
+
test: string[];
|
|
38
|
+
};
|
|
39
|
+
/** Called when items are loaded/filtered */
|
|
40
|
+
onItemsLoaded?: (itemIds: string[]) => void;
|
|
41
|
+
/** Function to determine dataset type */
|
|
42
|
+
getDatasetType?: (itemId: string) => 'train' | 'val' | 'test' | null;
|
|
43
|
+
/** Show OpenSeadragon navigation controls (zoom, home, fullscreen) on thumbnails (default: false) */
|
|
44
|
+
showViewerControls?: boolean;
|
|
45
|
+
/** Debug mode for logging */
|
|
46
|
+
debug?: boolean;
|
|
47
|
+
/** Custom CSS class */
|
|
48
|
+
className?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Main container component that manages pagination, filtering, and layout for thumbnail grid.
|
|
52
|
+
*/
|
|
53
|
+
export declare const FolderThumbnailBrowser: React.ForwardRefExoticComponent<FolderThumbnailBrowserProps & React.RefAttributes<HTMLDivElement>>;
|
|
54
|
+
//# sourceMappingURL=FolderThumbnailBrowser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FolderThumbnailBrowser.d.ts","sourceRoot":"","sources":["../../../src/components/FolderThumbnailBrowser/FolderThumbnailBrowser.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAA;AAEhF,OAAO,EAAgC,KAAK,IAAI,EAAE,MAAM,uBAAuB,CAAA;AAE/E,OAAO,8BAA8B,CAAA;AAErC,MAAM,WAAW,2BAA2B;IAExC,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;IACnB,gDAAgD;IAChD,KAAK,CAAC,EAAE,IAAI,EAAE,CAAA;IAGd,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAA;IAClB,uGAAuG;IACvG,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,4CAA4C;IAC5C,UA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oGAgclC,CAAA"}
|
|
@@ -1,174 +1,7 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import { Viewer as OpenSeadragonViewer, Options as OpenSeadragonOptions } from 'openseadragon';
|
|
2
|
+
import { SlideViewerProps } from './SlideViewer.types';
|
|
4
3
|
|
|
5
|
-
export
|
|
6
|
-
/** Image ID from DSA (used if dziUrl is not provided) */
|
|
7
|
-
imageId?: string | number;
|
|
8
|
-
/** Image width in pixels (used if dziUrl is not provided) */
|
|
9
|
-
width?: number;
|
|
10
|
-
/** Image height in pixels (used if dziUrl is not provided) */
|
|
11
|
-
height?: number;
|
|
12
|
-
/** Tile width (used if dziUrl is not provided) */
|
|
13
|
-
tileWidth?: number;
|
|
14
|
-
/** Number of zoom levels (used if dziUrl is not provided) */
|
|
15
|
-
levels?: number;
|
|
16
|
-
/** Base URL for DSA tile server (used if dziUrl is not provided) */
|
|
17
|
-
baseUrl?: string;
|
|
18
|
-
/** DZI descriptor URL (e.g., 'http://bdsa.pathology.emory.edu:8080/api/v1/item/{itemId}/tiles/dzi.dzi')
|
|
19
|
-
* If provided, this will be used instead of manually constructing tile URLs */
|
|
20
|
-
dziUrl?: string;
|
|
21
|
-
}
|
|
22
|
-
export interface AnnotationFeature {
|
|
23
|
-
/** Unique identifier for the annotation */
|
|
24
|
-
id?: string | number;
|
|
25
|
-
/** Left coordinate in pixels */
|
|
26
|
-
left: number;
|
|
27
|
-
/** Top coordinate in pixels */
|
|
28
|
-
top: number;
|
|
29
|
-
/** Width in pixels */
|
|
30
|
-
width: number;
|
|
31
|
-
/** Height in pixels */
|
|
32
|
-
height: number;
|
|
33
|
-
/** Optional color for the annotation stroke */
|
|
34
|
-
color?: string;
|
|
35
|
-
/** Optional group identifier */
|
|
36
|
-
group?: string | number;
|
|
37
|
-
/** Optional label */
|
|
38
|
-
label?: string;
|
|
39
|
-
/** Type of annotation (rectangle, polyline, etc.) */
|
|
40
|
-
annotationType?: 'rectangle' | 'polyline';
|
|
41
|
-
/** Points array for polyline annotations */
|
|
42
|
-
points?: Array<[number, number]>;
|
|
43
|
-
/** Whether polyline is closed */
|
|
44
|
-
closed?: boolean;
|
|
45
|
-
/** Fill color for polyline */
|
|
46
|
-
fillColor?: string;
|
|
47
|
-
/** Store full element for rendering */
|
|
48
|
-
element?: unknown;
|
|
49
|
-
/** Optional additional properties */
|
|
50
|
-
[key: string]: unknown;
|
|
51
|
-
}
|
|
52
|
-
export interface AnnotationInfoProperty {
|
|
53
|
-
/** Key to access the property value from the annotation document */
|
|
54
|
-
key: string;
|
|
55
|
-
/** Display label for this property */
|
|
56
|
-
label: string;
|
|
57
|
-
/** Optional formatter function to transform the value before display */
|
|
58
|
-
formatter?: (value: unknown, doc: {
|
|
59
|
-
id: string | number;
|
|
60
|
-
elementCount: number;
|
|
61
|
-
totalPoints: number;
|
|
62
|
-
types: string[];
|
|
63
|
-
filteredCount?: number;
|
|
64
|
-
filteredPoints?: number;
|
|
65
|
-
}) => string | React.ReactNode;
|
|
66
|
-
/** Whether to display this property (default: true) */
|
|
67
|
-
show?: boolean;
|
|
68
|
-
}
|
|
69
|
-
export interface AnnotationInfoConfig {
|
|
70
|
-
/** Properties to display for each fetched annotation document */
|
|
71
|
-
documentProperties?: AnnotationInfoProperty[];
|
|
72
|
-
/** Whether to show the "Fetched from DSA API" section */
|
|
73
|
-
showFetchedSection?: boolean;
|
|
74
|
-
/** Whether to show the "Provided Annotations" section */
|
|
75
|
-
showProvidedSection?: boolean;
|
|
76
|
-
/** Whether to show the "Total Rendered" section */
|
|
77
|
-
showTotalSection?: boolean;
|
|
78
|
-
/** Custom header text */
|
|
79
|
-
headerText?: string;
|
|
80
|
-
}
|
|
81
|
-
export interface SlideViewerProps {
|
|
82
|
-
/** Image information for the slide to display */
|
|
83
|
-
imageInfo: SlideImageInfo;
|
|
84
|
-
/** Annotations to render on the slide (array of rectangles or GeoJSON) */
|
|
85
|
-
annotations?: AnnotationFeature[] | FeatureCollection;
|
|
86
|
-
/** Annotation IDs to fetch from DSA API (baseUrl/annotation/{id}) */
|
|
87
|
-
annotationIds?: (string | number)[];
|
|
88
|
-
/** Base URL for DSA API (e.g., 'http://bdsa.pathology.emory.edu:8080/api/v1') */
|
|
89
|
-
apiBaseUrl?: string;
|
|
90
|
-
/** Callback when viewer is ready */
|
|
91
|
-
onViewerReady?: (viewer: OpenSeadragonViewer) => void;
|
|
92
|
-
/** Callback when annotation is clicked */
|
|
93
|
-
onAnnotationClick?: (annotation: AnnotationFeature) => void;
|
|
94
|
-
/** Default stroke color for annotations */
|
|
95
|
-
defaultAnnotationColor?: string;
|
|
96
|
-
/** Stroke width for annotations */
|
|
97
|
-
strokeWidth?: number;
|
|
98
|
-
/** Additional OpenSeadragon configuration options */
|
|
99
|
-
osdOptions?: OpenSeadragonOptions;
|
|
100
|
-
/** Custom CSS class name */
|
|
101
|
-
className?: string;
|
|
102
|
-
/** Height for the viewer container (e.g., '600px', '100vh', '100%').
|
|
103
|
-
* Required: OpenSeadragon needs an explicit height to initialize properly. */
|
|
104
|
-
height?: string | number;
|
|
105
|
-
/** Width for the viewer container (defaults to '100%') */
|
|
106
|
-
width?: string | number;
|
|
107
|
-
/** Display information about loaded annotation documents */
|
|
108
|
-
showAnnotationInfo?: boolean;
|
|
109
|
-
/** Configuration for customizing the annotation info panel display */
|
|
110
|
-
annotationInfoConfig?: AnnotationInfoConfig;
|
|
111
|
-
/** Maximum number of points allowed per annotation element (default: 10000).
|
|
112
|
-
* Annotations exceeding this limit will be skipped with a warning. */
|
|
113
|
-
maxPointsPerAnnotation?: number;
|
|
114
|
-
/** Maximum total number of points allowed across all annotations (default: 100000).
|
|
115
|
-
* If exceeded, annotations will be filtered starting from the largest ones. */
|
|
116
|
-
maxTotalPoints?: number;
|
|
117
|
-
/** Custom fetch function for API requests. Useful for adding authentication headers.
|
|
118
|
-
* If not provided, uses the default `fetch`. The function should match the Fetch API signature. */
|
|
119
|
-
fetchFn?: (url: string, options?: RequestInit) => Promise<Response>;
|
|
120
|
-
/** Custom headers to add to all API requests. Merged with fetchFn headers if both are provided. */
|
|
121
|
-
apiHeaders?: HeadersInit;
|
|
122
|
-
/** Authentication token to use for requests. Can be extracted from apiHeaders automatically if not provided. */
|
|
123
|
-
authToken?: string;
|
|
124
|
-
/** If true, appends the authentication token as a query parameter (?token=...) to all requests (DZI, tiles, annotations).
|
|
125
|
-
* This is required for some DSA servers that validate tokens via query parameters instead of (or in addition to) headers.
|
|
126
|
-
* Default: false */
|
|
127
|
-
tokenQueryParam?: boolean;
|
|
128
|
-
/** Show annotation controls panel in the sidebar (default: false) */
|
|
129
|
-
showAnnotationControls?: boolean;
|
|
130
|
-
/** Default opacity for all annotations (0-1, default: 1) */
|
|
131
|
-
defaultAnnotationOpacity?: number;
|
|
132
|
-
/** Map of annotation IDs to their individual opacity values (0-1). Overrides defaultAnnotationOpacity for specific annotations. */
|
|
133
|
-
annotationOpacities?: Map<string | number, number> | Record<string, number>;
|
|
134
|
-
/** Map of annotation IDs to their visibility state. If provided, only visible annotations will be rendered/updated. */
|
|
135
|
-
visibleAnnotations?: Map<string | number, boolean> | Record<string, boolean>;
|
|
136
|
-
/** Callback when annotation has finished loading and rendering. Called with the annotation ID. */
|
|
137
|
-
onAnnotationReady?: (annotationId: string | number) => void;
|
|
138
|
-
/** Optional pull-through cache for annotation documents. Acts as a cache-aside proxy:
|
|
139
|
-
* 1. Checks cache first on fetch requests
|
|
140
|
-
* 2. On cache miss, fetches from API and stores in cache
|
|
141
|
-
* 3. On cache hit, returns cached data immediately (no API call)
|
|
142
|
-
* If not provided, automatically creates an IndexedDBAnnotationCache. Set to `null` to disable caching. */
|
|
143
|
-
annotationCache?: {
|
|
144
|
-
get(annotationId: string | number, versionHash?: string): Promise<unknown | null>;
|
|
145
|
-
set(annotationId: string | number, data: unknown, options?: {
|
|
146
|
-
ttl?: number;
|
|
147
|
-
versionHash?: string;
|
|
148
|
-
}): Promise<void>;
|
|
149
|
-
has(annotationId: string | number, versionHash?: string): Promise<boolean>;
|
|
150
|
-
delete(annotationId: string | number): Promise<void>;
|
|
151
|
-
clear(): Promise<void>;
|
|
152
|
-
getStats?(): Promise<{
|
|
153
|
-
size: number;
|
|
154
|
-
hits?: number;
|
|
155
|
-
misses?: number;
|
|
156
|
-
hitRate?: number;
|
|
157
|
-
}>;
|
|
158
|
-
} | null;
|
|
159
|
-
/** If true, disables caching entirely (equivalent to annotationCache={null}). Useful for debugging or forcing fresh fetches. */
|
|
160
|
-
disableCache?: boolean;
|
|
161
|
-
/** If true, disables the IntersectionObserver visibility check and initializes immediately.
|
|
162
|
-
* Useful for cases where you want immediate initialization regardless of viewport visibility.
|
|
163
|
-
* Default: false (visibility check enabled for better performance and error prevention) */
|
|
164
|
-
disableVisibilityCheck?: boolean;
|
|
165
|
-
/** Optional map of annotation headers (from /annotation?itemId=... endpoint) keyed by annotation ID.
|
|
166
|
-
* If provided, used to compute version hashes for cache invalidation when annotations change on the server.
|
|
167
|
-
* Should contain the metadata objects returned from AnnotationManager's annotation search endpoint.
|
|
168
|
-
* Typically obtained from AnnotationManager: `annotations.map(ann => [ann._id, ann])` or similar.
|
|
169
|
-
* If not provided, cache will work but version-based invalidation will be disabled. */
|
|
170
|
-
annotationHeaders?: Map<string | number, unknown> | Record<string, unknown>;
|
|
171
|
-
}
|
|
4
|
+
export type { SlideImageInfo, AnnotationFeature, AnnotationInfoProperty, AnnotationInfoConfig, SlideViewerProps } from './SlideViewer.types';
|
|
172
5
|
/**
|
|
173
6
|
* A slide viewer component that integrates OpenSeadragon with Paper.js annotations
|
|
174
7
|
* for viewing Digital Slide Archive images with annotation overlays.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SlideViewer.d.ts","sourceRoot":"","sources":["../../../src/components/SlideViewer/SlideViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"SlideViewer.d.ts","sourceRoot":"","sources":["../../../src/components/SlideViewer/SlideViewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAA;AAOhF,OAAO,KAAK,EAAE,gBAAgB,EAAqB,MAAM,qBAAqB,CAAA;AAO9E,OAAO,mBAAmB,CAAA;AAG1B,YAAY,EAAE,cAAc,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAE5I;;;GAGG;AACH,eAAO,MAAM,WAAW,yFA4xBvB,CAAA"}
|