@knaw-huc/osd-iiif-viewer 0.4.0 → 0.6.0

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
@@ -44,17 +44,17 @@ const defaultManifest = {
44
44
  }, createManifestSlice = (vault) => (set) => ({
45
45
  vault,
46
46
  ...defaultManifest,
47
- loadManifest: async (url, initialCanvasId) => {
47
+ loadManifest: async (url, { manifest, canvasId } = {}) => {
48
48
  set({ url, isLoading: !0, error: null });
49
49
  try {
50
- const id = (await vault.loadManifest(url))?.id || orThrow("No manifest"), updates = {
50
+ const id = (await vault.loadManifest(url, manifest))?.id || orThrow("No manifest"), updates = {
51
51
  id,
52
52
  url,
53
53
  isLoading: !1,
54
54
  error: null
55
55
  };
56
- if (initialCanvasId) {
57
- const index = findCanvasIndex(vault, id, initialCanvasId);
56
+ if (canvasId) {
57
+ const index = findCanvasIndex(vault, id, canvasId);
58
58
  index !== -1 && (updates.currentIndex = index);
59
59
  }
60
60
  set(updates);
@@ -206,7 +206,7 @@ function Viewer(props) {
206
206
  useEffect(openTileSource, [tileSource, store, isContainerReady]);
207
207
  function openTileSource() {
208
208
  const viewer = store.getState().viewer;
209
- !viewer || !tileSource || viewer.open(tileSource);
209
+ !viewer || !tileSource || viewer.open({ tileSource });
210
210
  }
211
211
  useEffect(resizeViewerOnContainerResize, [store]);
212
212
  function resizeViewerOnContainerResize() {
@@ -8,8 +8,12 @@ export type ManifestState = {
8
8
  isLoading: boolean;
9
9
  error: string | null;
10
10
  };
11
+ export type LoadManifestOptions = {
12
+ manifest?: unknown;
13
+ canvasId?: string;
14
+ };
11
15
  export type ManifestSlice = Resettable & ManifestState & {
12
16
  vault: Vault;
13
- loadManifest: (url: string, initialCanvasId?: string) => Promise<void>;
17
+ loadManifest: (url: string, options?: LoadManifestOptions) => Promise<void>;
14
18
  };
15
19
  export declare const createManifestSlice: (vault: Vault) => StateCreator<ViewerStore, [], [], ManifestSlice>;
@@ -0,0 +1 @@
1
+ export {};
@@ -5,6 +5,6 @@ export declare function useManifest(): {
5
5
  isLoading: boolean;
6
6
  error: string | null;
7
7
  isReady: boolean;
8
- loadManifest: (url: string, initialCanvasId?: string) => Promise<void>;
8
+ loadManifest: (url: string, options?: import('./ManifestSlice.ts').LoadManifestOptions) => Promise<void>;
9
9
  };
10
- export declare function useLoadManifest(): (url: string, initialCanvasId?: string) => Promise<void>;
10
+ export declare function useLoadManifest(): (url: string, options?: import('./ManifestSlice.ts').LoadManifestOptions) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knaw-huc/osd-iiif-viewer",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/knaw-huc/osd-iiif-viewer.git"
@@ -30,8 +30,7 @@
30
30
  "peerDependencies": {
31
31
  "@iiif/helpers": "^1.5.9",
32
32
  "@iiif/presentation-3": "^2.2.3",
33
- "openseadragon": "^5.0.1",
34
- "@types/openseadragon": "^5.0.1",
33
+ "openseadragon": "^6.1.1",
35
34
  "react": ">=18",
36
35
  "react-dom": ">=18",
37
36
  "zustand": "^4.0.0 || ^5.0.0"
@@ -39,17 +38,11 @@
39
38
  "peerDependenciesMeta": {
40
39
  "@iiif/presentation-3": {
41
40
  "optional": true
42
- },
43
- "@types/openseadragon": {
44
- "optional": true
45
41
  }
46
42
  },
47
43
  "devDependencies": {
48
- "@iiif/helpers": "^1.5.9",
49
- "openseadragon": "^5.0.1",
50
- "@types/openseadragon": "^5.0.1",
51
- "zustand": "^5.0.0",
52
44
  "@eslint/js": "^9.39.1",
45
+ "@iiif/helpers": "^1.5.9",
53
46
  "@iiif/presentation-3": "^2.2.3",
54
47
  "@stylistic/eslint-plugin": "^4.0.0",
55
48
  "@types/node": "^24.10.1",
@@ -60,12 +53,14 @@
60
53
  "eslint-plugin-react-hooks": "^7.0.1",
61
54
  "eslint-plugin-react-refresh": "^0.4.24",
62
55
  "globals": "^16.5.0",
56
+ "openseadragon": "^6.1.1",
63
57
  "react": "^19.2.4",
64
58
  "react-dom": "^19.2.4",
65
59
  "typescript": "~5.9.3",
66
60
  "typescript-eslint": "^8.46.4",
67
61
  "vite": "^7.2.4",
68
62
  "vite-plugin-dts": "^4.5.4",
69
- "vitest": "^3.2.1"
63
+ "vitest": "^3.2.1",
64
+ "zustand": "^5.0.0"
70
65
  }
71
66
  }