react-iiif-vault 0.9.6 → 0.9.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/dist/index.d.ts CHANGED
@@ -1,80 +1,23 @@
1
- import React, { FC } from 'react';
1
+ import * as _atlas_viewer_atlas from '@atlas-viewer/atlas';
2
+ import * as React from 'react';
3
+ import React__default, { ReactNode, FC } from 'react';
4
+ import * as _iiif_presentation_3 from '@iiif/presentation-3';
5
+ import { InternationalString, ImageService, AnnotationPageNormalized, ContentResource, IIIFExternalWebResource, SpecificResource, AnnotationNormalized, CanvasNormalized, CollectionNormalized, Reference, ManifestNormalized, RangeNormalized, SearchService, Annotation, ExternalWebResource, W3CAnnotationTarget, Selector } from '@iiif/presentation-3';
6
+ import { AtlasProps } from '@atlas-viewer/atlas/dist/types/modules/react-reconciler/Atlas';
2
7
  import { Vault, VaultOptions, ReduxStore, NormalizedEntity, IIIFStore } from '@iiif/vault';
8
+ import { ImageCandidate, ImageServiceLoader, ImageCandidateRequest } from '@atlas-viewer/iiif-image-api';
3
9
  import * as _iiif_vault__ from '@iiif/vault/*';
4
- import { CanvasNormalized, InternationalString, ImageService, AnnotationPageNormalized, ContentResource, IIIFExternalWebResource, SpecificResource, AnnotationNormalized, CollectionNormalized, Reference, ManifestNormalized, RangeNormalized, SearchService, Annotation, ExternalWebResource, W3CAnnotationTarget, Selector } from '@iiif/presentation-3';
5
- import { ImageServiceLoader, ImageCandidateRequest, ImageCandidate } from '@atlas-viewer/iiif-image-api';
6
10
  import * as _iiif_vault_helpers from '@iiif/vault-helpers';
7
11
 
8
- declare const AnnotationContext: React.FC<{
9
- annotation: string;
10
- }>;
11
-
12
- declare const CanvasContext: React.FC<{
13
- canvas: string;
14
- }>;
15
-
16
- declare const CollectionContext: React.FC<{
17
- collection: string;
18
- }>;
19
-
20
- declare const ManifestContext: React.FC<{
21
- manifest: string;
22
- }>;
23
-
24
- declare const RangeContext: React.FC<{
25
- range: string;
26
- }>;
27
-
28
- declare type ResourceContextType = {
29
- collection?: string;
30
- manifest?: string;
31
- range?: string;
32
- canvas?: string;
33
- annotation?: string;
34
- };
35
- declare const ResourceReactContext: React.Context<ResourceContextType>;
36
- declare const useResourceContext: () => ResourceContextType;
37
- declare const ResourceProvider: React.FC<{
38
- value: ResourceContextType;
39
- }>;
40
-
41
- declare const ReactVaultContext: React.Context<{
42
- vault: Vault | null;
43
- setVaultInstance: (vault: Vault) => void;
44
- }>;
45
- declare const VaultProvider: React.FC<{
46
- vault?: Vault;
47
- useGlobal?: boolean;
48
- vaultOptions?: VaultOptions;
49
- resources?: ResourceContextType;
50
- }>;
51
-
52
- declare function useContextBridge(): {
53
- VaultContext: {
54
- vault: _iiif_vault__.Vault | null;
55
- setVaultInstance: (vault: _iiif_vault__.Vault) => void;
56
- };
57
- ResourceContext: ResourceContextType;
58
- SimpleViewerReactContext: {
59
- setCurrentCanvasId: (newId: string | ((prev: string) => string)) => void;
60
- setCurrentCanvasIndex: (newId: number | ((prev: number) => number)) => void;
61
- currentCanvasIndex: number;
62
- pagingView: boolean;
63
- totalCanvases: number;
64
- nextCanvas: () => void;
65
- previousCanvas: () => void;
66
- };
67
- VisibleCanvasReactContext: string[];
68
- };
69
- declare const ContextBridge: React.FC<{
70
- bridge: ReturnType<typeof useContextBridge>;
71
- }>;
72
-
73
- declare const VisibleCanvasReactContext: React.Context<string[]>;
74
- declare function useVisibleCanvases(): CanvasNormalized[];
75
-
76
- declare const ImageServiceLoaderContext: React.Context<ImageServiceLoader>;
77
- declare function useImageServiceLoader(): ImageServiceLoader;
12
+ declare function Viewer({ children, ...props }: AtlasProps & {
13
+ height?: number | string;
14
+ width?: number | string;
15
+ resizeHash?: number;
16
+ containerProps?: any;
17
+ aspectRatio?: number;
18
+ } & {
19
+ children: ReactNode;
20
+ }): JSX.Element;
78
21
 
79
22
  interface SingleChoice {
80
23
  type: 'single-choice';
@@ -186,6 +129,39 @@ declare type AnnotationPageDescription = {
186
129
  pages: AnnotationPageNormalized[];
187
130
  };
188
131
 
132
+ declare type ImageServiceLoaderType = (imageService: any | undefined, { height, width }: {
133
+ height: number;
134
+ width: number;
135
+ }) => ImageService | undefined;
136
+ declare function useLoadImageService(): readonly [ImageServiceLoaderType, Record<string, string>];
137
+
138
+ declare function parseSpecificResource(resource: ContentResource): any[];
139
+ interface Paintables {
140
+ choice: ChoiceDescription | null;
141
+ types: string[];
142
+ items: Array<{
143
+ type: string;
144
+ resource: IIIFExternalWebResource | SpecificResource;
145
+ target: any;
146
+ selector: any;
147
+ }>;
148
+ }
149
+ declare function getPaintables(vault: Vault, paintingAnnotations: AnnotationNormalized[], enabledChoices: string[]): Paintables;
150
+ declare const emptyActions: {
151
+ makeChoice: () => void;
152
+ };
153
+ declare const unknownResponse: UseRenderingStrategy[0];
154
+ declare const unsupportedStrategy: (reason: string) => UseRenderingStrategy[0];
155
+
156
+ declare type SingleImageStrategy = {
157
+ type: 'images';
158
+ image: ImageWithOptionalService;
159
+ images: Array<ImageWithOptionalService>;
160
+ choice?: ChoiceDescription;
161
+ annotations?: AnnotationPageDescription;
162
+ };
163
+ declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): RenderingStrategy;
164
+
189
165
  declare type MediaStrategy = {
190
166
  type: 'media';
191
167
  media: SingleAudio | SingleVideo | AudioSequence | VideoSequence;
@@ -205,12 +181,6 @@ declare type UnknownStrategy = {
205
181
  };
206
182
  declare type RenderingStrategy = SingleImageStrategy | MediaStrategy | ComplexTimelineStrategy | UnknownStrategy;
207
183
 
208
- declare type ImageServiceLoaderType = (imageService: any | undefined, { height, width }: {
209
- height: number;
210
- width: number;
211
- }) => ImageService | undefined;
212
- declare function useLoadImageService(): readonly [ImageServiceLoaderType, Record<string, string>];
213
-
214
184
  declare type StrategyActions = {
215
185
  makeChoice: (id: string, options?: {
216
186
  deselectOthers?: boolean;
@@ -225,32 +195,116 @@ declare type UseRenderingStrategyOptions = {
225
195
  };
226
196
  declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
227
197
 
228
- declare function parseSpecificResource(resource: ContentResource): any[];
229
- interface Paintables {
230
- choice: ChoiceDescription | null;
231
- types: string[];
232
- items: Array<{
233
- type: string;
234
- resource: IIIFExternalWebResource | SpecificResource;
235
- target: any;
236
- selector: any;
198
+ declare type CanvasProps = {
199
+ x?: number;
200
+ y?: number;
201
+ onCreated?: any;
202
+ onChoiceChange?: (choice?: ChoiceDescription) => void;
203
+ registerActions?: (actions: StrategyActions) => void;
204
+ defaultChoices?: Array<{
205
+ id: string;
206
+ opacity?: number;
237
207
  }>;
238
- }
239
- declare function getPaintables(vault: Vault, paintingAnnotations: AnnotationNormalized[], enabledChoices: string[]): Paintables;
240
- declare const emptyActions: {
241
- makeChoice: () => void;
208
+ isStatic?: boolean;
242
209
  };
243
- declare const unknownResponse: UseRenderingStrategy[0];
244
- declare const unsupportedStrategy: (reason: string) => UseRenderingStrategy[0];
210
+ declare function RenderCanvas({ x, y, onChoiceChange, registerActions, defaultChoices, isStatic }: CanvasProps): JSX.Element | null;
245
211
 
246
- declare type SingleImageStrategy = {
247
- type: 'images';
212
+ declare function RenderImage({ id, image, thumbnail, isStatic, x, y, annotations, }: {
213
+ id: string;
248
214
  image: ImageWithOptionalService;
249
- images: Array<ImageWithOptionalService>;
250
- choice?: ChoiceDescription;
251
- annotations?: AnnotationPageDescription;
215
+ thumbnail?: ImageCandidate;
216
+ isStatic?: boolean;
217
+ x?: number;
218
+ y?: number;
219
+ annotations?: JSX.Element;
220
+ }): JSX.Element;
221
+
222
+ declare const CanvasPanel: {
223
+ RenderImage: typeof RenderImage;
224
+ RenderCanvas: typeof RenderCanvas;
225
+ RenderAnnotationPage: React.FC<{
226
+ page: _iiif_presentation_3.AnnotationPageNormalized | _iiif_presentation_3.AnnotationPage;
227
+ className?: string | undefined;
228
+ }>;
229
+ RenderAnnotation: React.FC<{
230
+ id: string;
231
+ className?: string | undefined;
232
+ style?: _atlas_viewer_atlas.BoxStyle | undefined;
233
+ interactive?: boolean | undefined;
234
+ }>;
235
+ Viewer: typeof Viewer;
252
236
  };
253
- declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): RenderingStrategy;
237
+
238
+ declare const AnnotationContext: React__default.FC<{
239
+ annotation: string;
240
+ }>;
241
+
242
+ declare const CanvasContext: React__default.FC<{
243
+ canvas: string;
244
+ }>;
245
+
246
+ declare const CollectionContext: React__default.FC<{
247
+ collection: string;
248
+ }>;
249
+
250
+ declare const ManifestContext: React__default.FC<{
251
+ manifest: string;
252
+ }>;
253
+
254
+ declare const RangeContext: React__default.FC<{
255
+ range: string;
256
+ }>;
257
+
258
+ declare type ResourceContextType = {
259
+ collection?: string;
260
+ manifest?: string;
261
+ range?: string;
262
+ canvas?: string;
263
+ annotation?: string;
264
+ };
265
+ declare const ResourceReactContext: React__default.Context<ResourceContextType>;
266
+ declare const useResourceContext: () => ResourceContextType;
267
+ declare const ResourceProvider: React__default.FC<{
268
+ value: ResourceContextType;
269
+ }>;
270
+
271
+ declare const ReactVaultContext: React__default.Context<{
272
+ vault: Vault | null;
273
+ setVaultInstance: (vault: Vault) => void;
274
+ }>;
275
+ declare const VaultProvider: React__default.FC<{
276
+ vault?: Vault;
277
+ useGlobal?: boolean;
278
+ vaultOptions?: VaultOptions;
279
+ resources?: ResourceContextType;
280
+ }>;
281
+
282
+ declare function useContextBridge(): {
283
+ VaultContext: {
284
+ vault: _iiif_vault__.Vault | null;
285
+ setVaultInstance: (vault: _iiif_vault__.Vault) => void;
286
+ };
287
+ ResourceContext: ResourceContextType;
288
+ SimpleViewerReactContext: {
289
+ setCurrentCanvasId: (newId: string | ((prev: string) => string)) => void;
290
+ setCurrentCanvasIndex: (newId: number | ((prev: number) => number)) => void;
291
+ currentCanvasIndex: number;
292
+ pagingView: boolean;
293
+ totalCanvases: number;
294
+ nextCanvas: () => void;
295
+ previousCanvas: () => void;
296
+ };
297
+ VisibleCanvasReactContext: string[];
298
+ };
299
+ declare const ContextBridge: React__default.FC<{
300
+ bridge: ReturnType<typeof useContextBridge>;
301
+ }>;
302
+
303
+ declare const VisibleCanvasReactContext: React__default.Context<string[]>;
304
+ declare function useVisibleCanvases(): CanvasNormalized[];
305
+
306
+ declare const ImageServiceLoaderContext: React__default.Context<ImageServiceLoader>;
307
+ declare function useImageServiceLoader(): ImageServiceLoader;
254
308
 
255
309
  declare function useAnnotation(options?: {
256
310
  id: string;
@@ -424,6 +478,14 @@ declare function useVirtualAnnotationPage(): readonly [AnnotationPageNormalized
424
478
  readonly removeAnnotation: (id: string | Annotation | VaultActivatedAnnotation | AnnotationNormalized) => void;
425
479
  }];
426
480
 
481
+ declare function useVirtualAnnotationPageContext(): readonly [AnnotationPageNormalized | null, {
482
+ readonly addAnnotation: (id: string | AnnotationNormalized | VaultActivatedAnnotation | Annotation, atIndex?: number | undefined) => void;
483
+ readonly removeAnnotation: (id: string | AnnotationNormalized | VaultActivatedAnnotation | Annotation) => void;
484
+ }];
485
+ declare function VirtualAnnotationProvider({ children }: {
486
+ children: any;
487
+ }): JSX.Element;
488
+
427
489
  declare type SupportedTarget = {
428
490
  type: 'SpecificResource';
429
491
  source: ExternalWebResource | {
@@ -464,11 +526,11 @@ declare type SimpleViewerContext = {
464
526
  nextCanvas: () => void;
465
527
  previousCanvas: () => void;
466
528
  };
467
- declare const SimpleViewerReactContext: React.Context<SimpleViewerContext>;
529
+ declare const SimpleViewerReactContext: React__default.Context<SimpleViewerContext>;
468
530
  declare const SimpleViewerProvider: FC<{
469
531
  manifest: string;
470
532
  pagingEnabled?: boolean;
471
533
  }>;
472
534
  declare function useSimpleViewer(): SimpleViewerContext;
473
535
 
474
- export { AnnotationContext, AnnotationPageDescription, AudioSequence, BoxSelector, CanvasContext, ChoiceDescription, CollectionContext, ComplexChoice, ComplexTimelineStrategy, ContextBridge, ImageServiceLoaderContext, ImageServiceLoaderType, ImageServiceRequestOptions, ImageWithOptionalService, ManifestContext, MediaStrategy, Paintables, ParsedSelector, PointSelector, RangeContext, ReactVaultContext, RenderingStrategy, ResourceContextType, ResourceProvider, ResourceReactContext, ResourceRequestOptions, SimpleViewerProvider, SimpleViewerReactContext, SingleAudio, SingleChoice, SingleImageStrategy, SingleVideo, StrategyActions, SupportedSelector, SupportedSelectors, SupportedTarget, TemporalBoxSelector, TemporalSelector, UnknownStrategy, UseRenderingStrategy, UseRenderingStrategyOptions, VaultActivatedAnnotation, VaultProvider, VideoSequence, VisibleCanvasReactContext, emptyActions, expandTarget, flattenAnnotationPageIds, getImageStrategy, getPaintables, parseSelector, parseSpecificResource, unknownResponse, unsupportedStrategy, useAnnotation, useAnnotationPageManager, useAnnotationsAtTime, useCanvas, useCanvasClock, useCollection, useContextBridge, useDispatch, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useImageService, useImageServiceLoader, useImageTile, useLoadImageService, useManifest, usePaintables, usePaintingAnnotations, useRange, useRenderingStrategy, useResourceContext, useResourceEvents, useResources, useSearchService, useSimpleViewer, useStyleHelper, useStyles, useThumbnail, useVault, useVaultEffect, useVaultSelector, useVirtualAnnotationPage, useVisibleCanvases };
536
+ export { AnnotationContext, AnnotationPageDescription, AudioSequence, BoxSelector, CanvasContext, CanvasPanel, ChoiceDescription, CollectionContext, ComplexChoice, ComplexTimelineStrategy, ContextBridge, ImageServiceLoaderContext, ImageServiceLoaderType, ImageServiceRequestOptions, ImageWithOptionalService, ManifestContext, MediaStrategy, Paintables, ParsedSelector, PointSelector, RangeContext, ReactVaultContext, RenderingStrategy, ResourceContextType, ResourceProvider, ResourceReactContext, ResourceRequestOptions, SimpleViewerProvider, SimpleViewerReactContext, SingleAudio, SingleChoice, SingleImageStrategy, SingleVideo, StrategyActions, SupportedSelector, SupportedSelectors, SupportedTarget, TemporalBoxSelector, TemporalSelector, UnknownStrategy, UseRenderingStrategy, UseRenderingStrategyOptions, VaultActivatedAnnotation, VaultProvider, VideoSequence, VirtualAnnotationProvider, VisibleCanvasReactContext, emptyActions, expandTarget, flattenAnnotationPageIds, getImageStrategy, getPaintables, parseSelector, parseSpecificResource, unknownResponse, unsupportedStrategy, useAnnotation, useAnnotationPageManager, useAnnotationsAtTime, useCanvas, useCanvasClock, useCollection, useContextBridge, useDispatch, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useImageService, useImageServiceLoader, useImageTile, useLoadImageService, useManifest, usePaintables, usePaintingAnnotations, useRange, useRenderingStrategy, useResourceContext, useResourceEvents, useResources, useSearchService, useSimpleViewer, useStyleHelper, useStyles, useThumbnail, useVault, useVaultEffect, useVaultSelector, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };