react-iiif-vault 0.9.5 → 0.9.8
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/LICENSE +21 -0
- package/dist/cjs/index.js +1820 -1
- package/dist/esm/index.mjs +1752 -1
- package/dist/index.d.ts +174 -104
- package/dist/index.umd.js +31053 -14
- package/package.json +35 -25
package/dist/index.d.ts
CHANGED
|
@@ -1,80 +1,24 @@
|
|
|
1
|
-
import
|
|
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 as ExternalWebResource$1, 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 { ExternalWebResource } from '@iiif/presentation-3/resources/annotation';
|
|
9
|
+
import { ImageCandidate, ImageServiceLoader, ImageCandidateRequest } from '@atlas-viewer/iiif-image-api';
|
|
3
10
|
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
11
|
import * as _iiif_vault_helpers from '@iiif/vault-helpers';
|
|
7
12
|
|
|
8
|
-
declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
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;
|
|
13
|
+
declare function Viewer({ children, ...props }: AtlasProps & {
|
|
14
|
+
height?: number | string;
|
|
15
|
+
width?: number | string;
|
|
16
|
+
resizeHash?: number;
|
|
17
|
+
containerProps?: any;
|
|
18
|
+
aspectRatio?: number;
|
|
19
|
+
} & {
|
|
20
|
+
children: ReactNode;
|
|
21
|
+
}): JSX.Element;
|
|
78
22
|
|
|
79
23
|
interface SingleChoice {
|
|
80
24
|
type: 'single-choice';
|
|
@@ -186,6 +130,46 @@ declare type AnnotationPageDescription = {
|
|
|
186
130
|
pages: AnnotationPageNormalized[];
|
|
187
131
|
};
|
|
188
132
|
|
|
133
|
+
declare type ImageServiceLoaderType = (imageService: any | undefined, { height, width }: {
|
|
134
|
+
height: number;
|
|
135
|
+
width: number;
|
|
136
|
+
}) => ImageService | undefined;
|
|
137
|
+
declare function useLoadImageService(): readonly [ImageServiceLoaderType, Record<string, string>];
|
|
138
|
+
|
|
139
|
+
declare function parseSpecificResource(resource: ContentResource): any[];
|
|
140
|
+
interface Paintables {
|
|
141
|
+
choice: ChoiceDescription | null;
|
|
142
|
+
types: string[];
|
|
143
|
+
items: Array<{
|
|
144
|
+
type: string;
|
|
145
|
+
resource: IIIFExternalWebResource | SpecificResource;
|
|
146
|
+
target: any;
|
|
147
|
+
selector: any;
|
|
148
|
+
}>;
|
|
149
|
+
}
|
|
150
|
+
declare function getPaintables(vault: Vault, paintingAnnotations: AnnotationNormalized[], enabledChoices: string[]): Paintables;
|
|
151
|
+
declare const emptyActions: {
|
|
152
|
+
makeChoice: () => void;
|
|
153
|
+
};
|
|
154
|
+
declare const unknownResponse: UseRenderingStrategy[0];
|
|
155
|
+
declare const unsupportedStrategy: (reason: string) => UseRenderingStrategy[0];
|
|
156
|
+
|
|
157
|
+
declare type SingleImageStrategy = {
|
|
158
|
+
type: 'images';
|
|
159
|
+
image: ImageWithOptionalService;
|
|
160
|
+
images: Array<ImageWithOptionalService>;
|
|
161
|
+
choice?: ChoiceDescription;
|
|
162
|
+
annotations?: AnnotationPageDescription;
|
|
163
|
+
};
|
|
164
|
+
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): RenderingStrategy;
|
|
165
|
+
|
|
166
|
+
declare type Single3DModelStrategy = {
|
|
167
|
+
type: '3d-model';
|
|
168
|
+
model: ExternalWebResource;
|
|
169
|
+
choice?: ChoiceDescription;
|
|
170
|
+
annotations?: AnnotationPageDescription;
|
|
171
|
+
};
|
|
172
|
+
|
|
189
173
|
declare type MediaStrategy = {
|
|
190
174
|
type: 'media';
|
|
191
175
|
media: SingleAudio | SingleVideo | AudioSequence | VideoSequence;
|
|
@@ -203,13 +187,7 @@ declare type UnknownStrategy = {
|
|
|
203
187
|
reason?: string;
|
|
204
188
|
annotations?: AnnotationPageDescription;
|
|
205
189
|
};
|
|
206
|
-
declare type RenderingStrategy = SingleImageStrategy | MediaStrategy | ComplexTimelineStrategy | UnknownStrategy;
|
|
207
|
-
|
|
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>];
|
|
190
|
+
declare type RenderingStrategy = SingleImageStrategy | MediaStrategy | ComplexTimelineStrategy | Single3DModelStrategy | UnknownStrategy;
|
|
213
191
|
|
|
214
192
|
declare type StrategyActions = {
|
|
215
193
|
makeChoice: (id: string, options?: {
|
|
@@ -225,32 +203,116 @@ declare type UseRenderingStrategyOptions = {
|
|
|
225
203
|
};
|
|
226
204
|
declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
|
|
227
205
|
|
|
228
|
-
declare
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
206
|
+
declare type CanvasProps = {
|
|
207
|
+
x?: number;
|
|
208
|
+
y?: number;
|
|
209
|
+
onCreated?: any;
|
|
210
|
+
onChoiceChange?: (choice?: ChoiceDescription) => void;
|
|
211
|
+
registerActions?: (actions: StrategyActions) => void;
|
|
212
|
+
defaultChoices?: Array<{
|
|
213
|
+
id: string;
|
|
214
|
+
opacity?: number;
|
|
237
215
|
}>;
|
|
238
|
-
|
|
239
|
-
declare function getPaintables(vault: Vault, paintingAnnotations: AnnotationNormalized[], enabledChoices: string[]): Paintables;
|
|
240
|
-
declare const emptyActions: {
|
|
241
|
-
makeChoice: () => void;
|
|
216
|
+
isStatic?: boolean;
|
|
242
217
|
};
|
|
243
|
-
declare
|
|
244
|
-
declare const unsupportedStrategy: (reason: string) => UseRenderingStrategy[0];
|
|
218
|
+
declare function RenderCanvas({ x, y, onChoiceChange, registerActions, defaultChoices, isStatic }: CanvasProps): JSX.Element | null;
|
|
245
219
|
|
|
246
|
-
declare
|
|
247
|
-
|
|
220
|
+
declare function RenderImage({ id, image, thumbnail, isStatic, x, y, annotations, }: {
|
|
221
|
+
id: string;
|
|
248
222
|
image: ImageWithOptionalService;
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
223
|
+
thumbnail?: ImageCandidate;
|
|
224
|
+
isStatic?: boolean;
|
|
225
|
+
x?: number;
|
|
226
|
+
y?: number;
|
|
227
|
+
annotations?: JSX.Element;
|
|
228
|
+
}): JSX.Element;
|
|
229
|
+
|
|
230
|
+
declare const CanvasPanel: {
|
|
231
|
+
RenderImage: typeof RenderImage;
|
|
232
|
+
RenderCanvas: typeof RenderCanvas;
|
|
233
|
+
RenderAnnotationPage: React.FC<{
|
|
234
|
+
page: _iiif_presentation_3.AnnotationPageNormalized | _iiif_presentation_3.AnnotationPage;
|
|
235
|
+
className?: string | undefined;
|
|
236
|
+
}>;
|
|
237
|
+
RenderAnnotation: React.FC<{
|
|
238
|
+
id: string;
|
|
239
|
+
className?: string | undefined;
|
|
240
|
+
style?: _atlas_viewer_atlas.BoxStyle | undefined;
|
|
241
|
+
interactive?: boolean | undefined;
|
|
242
|
+
}>;
|
|
243
|
+
Viewer: typeof Viewer;
|
|
252
244
|
};
|
|
253
|
-
|
|
245
|
+
|
|
246
|
+
declare const AnnotationContext: React__default.FC<{
|
|
247
|
+
annotation: string;
|
|
248
|
+
}>;
|
|
249
|
+
|
|
250
|
+
declare const CanvasContext: React__default.FC<{
|
|
251
|
+
canvas: string;
|
|
252
|
+
}>;
|
|
253
|
+
|
|
254
|
+
declare const CollectionContext: React__default.FC<{
|
|
255
|
+
collection: string;
|
|
256
|
+
}>;
|
|
257
|
+
|
|
258
|
+
declare const ManifestContext: React__default.FC<{
|
|
259
|
+
manifest: string;
|
|
260
|
+
}>;
|
|
261
|
+
|
|
262
|
+
declare const RangeContext: React__default.FC<{
|
|
263
|
+
range: string;
|
|
264
|
+
}>;
|
|
265
|
+
|
|
266
|
+
declare type ResourceContextType = {
|
|
267
|
+
collection?: string;
|
|
268
|
+
manifest?: string;
|
|
269
|
+
range?: string;
|
|
270
|
+
canvas?: string;
|
|
271
|
+
annotation?: string;
|
|
272
|
+
};
|
|
273
|
+
declare const ResourceReactContext: React__default.Context<ResourceContextType>;
|
|
274
|
+
declare const useResourceContext: () => ResourceContextType;
|
|
275
|
+
declare const ResourceProvider: React__default.FC<{
|
|
276
|
+
value: ResourceContextType;
|
|
277
|
+
}>;
|
|
278
|
+
|
|
279
|
+
declare const ReactVaultContext: React__default.Context<{
|
|
280
|
+
vault: Vault | null;
|
|
281
|
+
setVaultInstance: (vault: Vault) => void;
|
|
282
|
+
}>;
|
|
283
|
+
declare const VaultProvider: React__default.FC<{
|
|
284
|
+
vault?: Vault;
|
|
285
|
+
useGlobal?: boolean;
|
|
286
|
+
vaultOptions?: VaultOptions;
|
|
287
|
+
resources?: ResourceContextType;
|
|
288
|
+
}>;
|
|
289
|
+
|
|
290
|
+
declare function useContextBridge(): {
|
|
291
|
+
VaultContext: {
|
|
292
|
+
vault: _iiif_vault__.Vault | null;
|
|
293
|
+
setVaultInstance: (vault: _iiif_vault__.Vault) => void;
|
|
294
|
+
};
|
|
295
|
+
ResourceContext: ResourceContextType;
|
|
296
|
+
SimpleViewerReactContext: {
|
|
297
|
+
setCurrentCanvasId: (newId: string | ((prev: string) => string)) => void;
|
|
298
|
+
setCurrentCanvasIndex: (newId: number | ((prev: number) => number)) => void;
|
|
299
|
+
currentCanvasIndex: number;
|
|
300
|
+
pagingView: boolean;
|
|
301
|
+
totalCanvases: number;
|
|
302
|
+
nextCanvas: () => void;
|
|
303
|
+
previousCanvas: () => void;
|
|
304
|
+
};
|
|
305
|
+
VisibleCanvasReactContext: string[];
|
|
306
|
+
};
|
|
307
|
+
declare const ContextBridge: React__default.FC<{
|
|
308
|
+
bridge: ReturnType<typeof useContextBridge>;
|
|
309
|
+
}>;
|
|
310
|
+
|
|
311
|
+
declare const VisibleCanvasReactContext: React__default.Context<string[]>;
|
|
312
|
+
declare function useVisibleCanvases(): CanvasNormalized[];
|
|
313
|
+
|
|
314
|
+
declare const ImageServiceLoaderContext: React__default.Context<ImageServiceLoader>;
|
|
315
|
+
declare function useImageServiceLoader(): ImageServiceLoader;
|
|
254
316
|
|
|
255
317
|
declare function useAnnotation(options?: {
|
|
256
318
|
id: string;
|
|
@@ -424,9 +486,17 @@ declare function useVirtualAnnotationPage(): readonly [AnnotationPageNormalized
|
|
|
424
486
|
readonly removeAnnotation: (id: string | Annotation | VaultActivatedAnnotation | AnnotationNormalized) => void;
|
|
425
487
|
}];
|
|
426
488
|
|
|
489
|
+
declare function useVirtualAnnotationPageContext(): readonly [AnnotationPageNormalized | null, {
|
|
490
|
+
readonly addAnnotation: (id: string | AnnotationNormalized | VaultActivatedAnnotation | Annotation, atIndex?: number | undefined) => void;
|
|
491
|
+
readonly removeAnnotation: (id: string | AnnotationNormalized | VaultActivatedAnnotation | Annotation) => void;
|
|
492
|
+
}];
|
|
493
|
+
declare function VirtualAnnotationProvider({ children }: {
|
|
494
|
+
children: any;
|
|
495
|
+
}): JSX.Element;
|
|
496
|
+
|
|
427
497
|
declare type SupportedTarget = {
|
|
428
498
|
type: 'SpecificResource';
|
|
429
|
-
source: ExternalWebResource | {
|
|
499
|
+
source: ExternalWebResource$1 | {
|
|
430
500
|
id: string;
|
|
431
501
|
type: 'Unknown' | 'Canvas' | 'Range' | 'Manifest';
|
|
432
502
|
partOf?: Array<{
|
|
@@ -464,11 +534,11 @@ declare type SimpleViewerContext = {
|
|
|
464
534
|
nextCanvas: () => void;
|
|
465
535
|
previousCanvas: () => void;
|
|
466
536
|
};
|
|
467
|
-
declare const SimpleViewerReactContext:
|
|
537
|
+
declare const SimpleViewerReactContext: React__default.Context<SimpleViewerContext>;
|
|
468
538
|
declare const SimpleViewerProvider: FC<{
|
|
469
539
|
manifest: string;
|
|
470
540
|
pagingEnabled?: boolean;
|
|
471
541
|
}>;
|
|
472
542
|
declare function useSimpleViewer(): SimpleViewerContext;
|
|
473
543
|
|
|
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 };
|
|
544
|
+
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 };
|