@knaw-huc/osd-iiif-viewer 0.5.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);
@@ -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.5.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"