@knaw-huc/osd-iiif-viewer 0.1.5 → 0.1.7
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/README.md +11 -9
- package/dist/ControlSlice.d.ts +4 -1
- package/dist/InstanceSlice.d.ts +4 -1
- package/dist/Resettable.d.ts +3 -0
- package/dist/ViewerStore.d.ts +2 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1920 -139
- package/dist/manifest/CanvasSlice.d.ts +2 -2
- package/dist/manifest/ManifestSlice.d.ts +6 -8
- package/dist/manifest/findThumbnail.d.ts +3 -2
- package/dist/manifest/findTileSource.d.ts +3 -2
- package/dist/manifest/getImageServiceId.d.ts +4 -0
- package/dist/manifest/useCanvas.d.ts +3 -2
- package/dist/manifest/useManifest.d.ts +6 -1
- package/dist/manifest/useVault.d.ts +1 -0
- package/package.json +2 -1
- package/dist/manifest/findLanguage.d.ts +0 -4
- package/dist/manifest/model.d.ts +0 -29
- package/dist/manifest/parseManifest.d.ts +0 -2
- package/dist/manifest/parseManifest.spec.d.ts +0 -1
package/README.md
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
# @knaw-huc/osd-iiif-viewer
|
|
2
2
|
|
|
3
|
-
React wrapper around OpenSeadragon to display and browse image sources from
|
|
3
|
+
Lightweight React wrapper around OpenSeadragon to display and browse image sources from IIIF manifests.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Features:
|
|
6
6
|
- Canvas navigation
|
|
7
7
|
- Highlight overlay
|
|
8
8
|
- Zoom and fullscreen controls
|
|
9
|
-
-
|
|
9
|
+
- IIIF manifest loading
|
|
10
|
+
|
|
11
|
+
## Example
|
|
10
12
|
|
|
11
|
-
## Minimal example
|
|
12
13
|
```tsx
|
|
13
14
|
import {useEffect} from 'react';
|
|
14
15
|
import {
|
|
@@ -20,27 +21,28 @@ import {
|
|
|
20
21
|
|
|
21
22
|
export function Example() {
|
|
22
23
|
return <ViewerProvider>
|
|
23
|
-
<
|
|
24
|
+
<MyOsdIiifView/>
|
|
24
25
|
</ViewerProvider>
|
|
25
26
|
}
|
|
26
27
|
|
|
27
|
-
function
|
|
28
|
+
function MyOsdIiifView() {
|
|
28
29
|
const loadManifest = useLoadManifest();
|
|
29
|
-
const
|
|
30
|
+
const {isReady} = useManifest();
|
|
30
31
|
|
|
31
32
|
useEffect(() => {
|
|
32
33
|
loadManifest('/manifest.json');
|
|
33
34
|
}, [loadManifest]);
|
|
34
35
|
|
|
35
|
-
if (!
|
|
36
|
+
if (!isReady) {
|
|
36
37
|
return null;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
return (
|
|
40
41
|
<div style={{width: '100%', height: '100vh'}}>
|
|
41
|
-
<
|
|
42
|
+
<Viewer/>
|
|
42
43
|
</div>
|
|
43
44
|
);
|
|
44
45
|
}
|
|
45
46
|
```
|
|
46
47
|
|
|
48
|
+
For more examples, run `npm i && npm start` and open http://localhost:5173
|
package/dist/ControlSlice.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { StateCreator } from 'zustand/vanilla';
|
|
2
2
|
import { ViewerStore } from './ViewerStore.ts';
|
|
3
|
-
|
|
3
|
+
import { Resettable } from './Resettable.ts';
|
|
4
|
+
export type ControlState = {
|
|
4
5
|
zoomLevel: number | null;
|
|
5
6
|
zoomMin: number | null;
|
|
6
7
|
zoomMax: number | null;
|
|
7
8
|
isFullPage: boolean;
|
|
8
9
|
rotation: number;
|
|
10
|
+
};
|
|
11
|
+
export type ControlSlice = Resettable & ControlState & {
|
|
9
12
|
setZoomLevel: (zoomLevel: number | null) => void;
|
|
10
13
|
setZoomMin: (zoomMin: number | null) => void;
|
|
11
14
|
setZoomMax: (zoomMax: number | null) => void;
|
package/dist/InstanceSlice.d.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { StateCreator } from 'zustand/vanilla';
|
|
2
2
|
import { default as OpenSeadragon } from 'openseadragon';
|
|
3
3
|
import { ViewerStore } from './ViewerStore.ts';
|
|
4
|
-
|
|
4
|
+
import { Resettable } from './Resettable.ts';
|
|
5
|
+
export type InstanceState = {
|
|
5
6
|
viewer: OpenSeadragon.Viewer | null;
|
|
6
7
|
viewerReady: boolean;
|
|
8
|
+
};
|
|
9
|
+
export type InstanceSlice = Resettable & InstanceState & {
|
|
7
10
|
setViewer: (viewer: OpenSeadragon.Viewer | null) => void;
|
|
8
11
|
setViewerReady: (viewerReady: boolean) => void;
|
|
9
12
|
};
|
package/dist/ViewerStore.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ import { InstanceSlice } from './InstanceSlice.ts';
|
|
|
2
2
|
import { ControlSlice } from './ControlSlice.ts';
|
|
3
3
|
import { ManifestSlice } from './manifest/ManifestSlice.ts';
|
|
4
4
|
import { CanvasSlice } from './manifest/CanvasSlice.ts';
|
|
5
|
-
|
|
5
|
+
import { Resettable } from './Resettable.ts';
|
|
6
|
+
export type ViewerStore = InstanceSlice & ControlSlice & ManifestSlice & CanvasSlice & Resettable;
|
|
6
7
|
export declare const createViewerStore: () => import('zustand').StoreApi<ViewerStore>;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,7 @@ export { useViewerReady } from './useViewerReady';
|
|
|
8
8
|
export { useViewerStore } from './useViewerStore';
|
|
9
9
|
export { useManifest, useLoadManifest } from './manifest/useManifest';
|
|
10
10
|
export { useCanvas } from './manifest/useCanvas';
|
|
11
|
-
export
|
|
11
|
+
export { useVault } from './manifest/useVault';
|
|
12
|
+
export { findTileSource } from './manifest/findTileSource';
|
|
13
|
+
export { findThumbnail } from './manifest/findThumbnail';
|
|
14
|
+
export { getImageServiceId } from './manifest/getImageServiceId';
|