react-iiif-vault 1.2.1 → 1.2.2

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/bundle.d.ts CHANGED
@@ -1,13 +1,15 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { ReactNode, FC, RefObject, ForwardRefExoticComponent, RefAttributes, FunctionComponent } from 'react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { AtlasProps, BoxStyle, ViewerMode, Preset } from '@atlas-viewer/atlas';
4
+ import { AtlasProps, Preset, BoxStyle, ViewerMode } from '@atlas-viewer/atlas';
5
5
  import { AnnotationPage, ImageService, ExternalWebResource, InternationalString, Reference, ImageSize, AuthProbeService2, Auth2LocationResource, Auth2SubstituteResource, AuthAccessService2, AuthAccessTokenService2, AuthAccessToken2, SearchServiceQueryParams, SearchServiceSearchResponse, SearchService as SearchService$1, SearchServiceAutocomplete, ContentResource, W3CAnnotationTarget, PointSelector, Annotation } from '@iiif/presentation-3';
6
6
  import { AnnotationPageNormalized, CanvasNormalized, AnnotationNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
7
7
  import * as _iiif_helpers from '@iiif/helpers';
8
- import { ChoiceDescription, Paintables, SupportedTarget, BoxSelector as BoxSelector$1, TemporalBoxSelector as TemporalBoxSelector$1 } from '@iiif/helpers';
8
+ import { ChoiceDescription, Paintables, SupportedTarget, ComplexChoice, BoxSelector as BoxSelector$1, TemporalBoxSelector as TemporalBoxSelector$1 } from '@iiif/helpers';
9
9
  import { BoxSelector, TemporalBoxSelector, TemporalSelector } from '@iiif/helpers/annotation-targets';
10
10
  export * from '@iiif/helpers/annotation-targets';
11
+ import * as mitt from 'mitt';
12
+ import { Emitter, EventType, Handler } from 'mitt';
11
13
  import { ImageCandidate, RegionParameter, RotationParameter, SizeParameter, ImageServiceLoader, ImageCandidateRequest } from '@atlas-viewer/iiif-image-api';
12
14
  import { Vault, VaultOptions, NormalizedEntity, IIIFStore } from '@iiif/helpers/vault';
13
15
  import * as polygon_editor from 'polygon-editor';
@@ -15,8 +17,6 @@ import { RenderState, InputShape, SlowState } from 'polygon-editor';
15
17
  import * as zustand_vanilla from 'zustand/vanilla';
16
18
  import { StoreApi } from 'zustand/vanilla';
17
19
  import * as zustand from 'zustand';
18
- import * as mitt from 'mitt';
19
- import { Handler } from 'mitt';
20
20
  import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
21
21
  import { Paintables as Paintables$1 } from '@iiif/helpers/painting-annotations';
22
22
  import { VaultZustandStore } from '@iiif/helpers/vault/store';
@@ -30,6 +30,7 @@ declare function Viewer({ children, errorFallback, outerContainerProps, worldSca
30
30
  outerContainerProps?: any;
31
31
  aspectRatio?: number;
32
32
  errorFallback?: any;
33
+ renderPreset?: Preset;
33
34
  worldScale?: number;
34
35
  } & {
35
36
  children: ReactNode;
@@ -178,11 +179,26 @@ type StrategyActions = {
178
179
  }) => void;
179
180
  };
180
181
  type UseRenderingStrategy = [RenderingStrategy, StrategyActions];
182
+ type ChoiceEvents = {
183
+ 'choice-change': {
184
+ choice: ComplexChoice;
185
+ partOf: {
186
+ canvasId?: string;
187
+ manifestId?: string;
188
+ };
189
+ };
190
+ 'make-choice': {
191
+ choiceId: string;
192
+ deselectOthers?: boolean;
193
+ deselect?: boolean;
194
+ };
195
+ };
181
196
  type UseRenderingStrategyOptions = {
182
197
  strategies?: Array<RenderingStrategy['type']>;
183
198
  annotationPageManagerId?: string;
184
199
  enableSingleAnnotation?: boolean;
185
200
  defaultChoices?: string[];
201
+ emitter?: Emitter<ChoiceEvents>;
186
202
  };
187
203
  declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
188
204
 
@@ -285,15 +301,17 @@ declare function Audio({ media, mediaControlsDeps, children, }: {
285
301
  children: ReactNode;
286
302
  }): null;
287
303
 
288
- declare function VideoHTML({ element, media, playPause, }: {
289
- element: RefObject<any>;
304
+ interface VideoComponentProps {
305
+ element: RefObject<HTMLVideoElement>;
290
306
  media: SingleVideo;
291
307
  playPause: () => void;
292
- }): react_jsx_runtime.JSX.Element;
293
- declare function Video({ media, mediaControlsDeps, children, }: {
308
+ }
309
+ declare function VideoHTML({ element, media, playPause }: VideoComponentProps): react_jsx_runtime.JSX.Element;
310
+ declare function Video({ media, mediaControlsDeps, children, videoComponent, }: {
294
311
  media: SingleVideo;
295
312
  mediaControlsDeps?: any[];
296
313
  children: ReactNode;
314
+ videoComponent?: FC<VideoComponentProps>;
297
315
  }): null;
298
316
 
299
317
  declare function ModelHTML({ model }: {
@@ -313,6 +331,8 @@ interface CanvasPanelProps {
313
331
  children?: ReactNode;
314
332
  mode?: ViewerMode;
315
333
  reuseAtlas?: boolean;
334
+ runtimeOptions?: any;
335
+ renderPreset?: any;
316
336
  height?: number;
317
337
  spacing?: number;
318
338
  components?: {
@@ -717,9 +737,6 @@ declare const AuthReactContextActions: React$1.Context<AuthContextActions | null
717
737
  declare function AuthProvider({ children }: {
718
738
  children: ReactNode;
719
739
  }): react_jsx_runtime.JSX.Element;
720
- declare function AuthProvider_Old({ children }: {
721
- children: ReactNode;
722
- }): react_jsx_runtime.JSX.Element;
723
740
  declare function useIsAuthEnabled(): boolean;
724
741
  declare function useAuthStore(): StoreApi<AuthContextState & AuthContextCurrentActions & AuthContextActions>;
725
742
  declare function useAuthActions(): {
@@ -735,11 +752,6 @@ declare function useCurrentAuth(): AuthContextState & AuthContextCurrentActions
735
752
  declare function useAuthService(id: string): AuthAccessState | undefined;
736
753
  declare function useAuthTokens(id?: string): string | undefined;
737
754
  declare function useAuthToken(id: string): string | null;
738
- declare function useCurrentAuth_old(): AuthContextState & AuthContextCurrentActions;
739
- declare function useAuthService_old(id: string): AuthState | null;
740
- declare function useAuthTokens_old(id?: string): string | null;
741
- declare function useAuthToken_old(id?: string): string | null;
742
- declare function useAuthActions_old(): AuthContextActions | null;
743
755
  interface AuthProps<T, Extra> {
744
756
  resource: T;
745
757
  extra?: Extra;
@@ -766,6 +778,15 @@ declare function CollectionContext({ collection, children }: {
766
778
  children: ReactNode;
767
779
  }): react_jsx_runtime.JSX.Element;
768
780
 
781
+ interface EventContext {
782
+ emitter: Emitter<any>;
783
+ }
784
+ declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
785
+ declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
786
+ declare function EventsProvider({ emitter, children }: EventContext & {
787
+ children: React__default.ReactNode;
788
+ }): react_jsx_runtime.JSX.Element;
789
+
769
790
  declare function ManifestContext({ manifest, children }: {
770
791
  manifest: string;
771
792
  children: ReactNode;
@@ -1062,6 +1083,21 @@ declare function useCanvas<T>(options?: {
1062
1083
  selector: (canvas: CanvasNormalized) => T;
1063
1084
  }, deps?: any[]): T | undefined;
1064
1085
 
1086
+ declare function useCanvasChoices({ canvasId }?: {
1087
+ canvasId?: string;
1088
+ }): {
1089
+ choices: Array<{
1090
+ canvasId: string;
1091
+ choice: ComplexChoice;
1092
+ }>;
1093
+ actions: {
1094
+ makeChoice: (id: string, options?: {
1095
+ deselectOthers?: boolean;
1096
+ deselect?: boolean;
1097
+ }) => void;
1098
+ };
1099
+ };
1100
+
1065
1101
  declare function useCanvasClock(canvasId?: string, autoplay?: boolean): void;
1066
1102
 
1067
1103
  declare function useCanvasSubset(idsOrRefs?: Array<string | Reference>): Reference<'Canvas'>[];
@@ -1387,4 +1423,4 @@ declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): A
1387
1423
  declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
1388
1424
  declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
1389
1425
 
1390
- export { AnnotationContext, AnnotationPageContext, type AnnotationPageDescription, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, type AudioSequence, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthProvider_Old, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CanvasPanel, CollectionContext, CombinedMetadata, type ComplexTimelineStrategy, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, type EmptyStrategy, Image, type ImageProps, ImageServiceLoaderContext, type ImageServiceLoaderType, type ImageServiceRequestOptions, type ImageWithOptionalService, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, type MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactVaultContext, RenderSvgEditorControls, type RenderingStrategy, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, type SimpleViewerActions, type SimpleViewerActionsType, type SimpleViewerContext, type SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, type SimpleViewerReducerState, type Single3DModelStrategy, type SingleAudio, SingleCanvasThumbnail, type SingleImageStrategy, type SingleVideo, type SingleYouTubeVideo, type StrategyActions, type SvgTheme, type TextualContentStrategy, TranslationProvider, type UnknownStrategy, type UseRenderingStrategy, type UseRenderingStrategyOptions, type VaultActivatedAnnotation, VaultProvider, type VideoSequence, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, emptyActions, emptyStrategy, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, get3dStrategy, getDefaultAnnotationStyles, getImageStrategy, getManifestSequence, getParsedTargetSelector, getRenderingStrategy, getTextualContentStrategy, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, parseSpecificResource, svgThemes, unknownResponse, unsupportedStrategy, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthActions_old, useAuthService, useAuthService_old, useAuthStore, useAuthToken, useAuthToken_old, useAuthTokens, useAuthTokens_old, useCanvas, useCanvasClock, useCanvasSequence, useCanvasSubset, useClosestLanguage, useCollection, useContextBridge, useCreateLocaleString, useCurrentAuth, useCurrentAuth_old, useDispatch, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLoadImageService, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useRenderingStrategy, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useSvgEditor, useThumbnail, useTranslations, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
1426
+ export { AnnotationContext, AnnotationPageContext, type AnnotationPageDescription, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, type AudioSequence, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CanvasPanel, type ChoiceEvents, CollectionContext, CombinedMetadata, type ComplexTimelineStrategy, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, type EmptyStrategy, EventsProvider, Image, type ImageProps, ImageServiceLoaderContext, type ImageServiceLoaderType, type ImageServiceRequestOptions, type ImageWithOptionalService, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, type MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactVaultContext, RenderSvgEditorControls, type RenderingStrategy, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, type SimpleViewerActions, type SimpleViewerActionsType, type SimpleViewerContext, type SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, type SimpleViewerReducerState, type Single3DModelStrategy, type SingleAudio, SingleCanvasThumbnail, type SingleImageStrategy, type SingleVideo, type SingleYouTubeVideo, type StrategyActions, type SvgTheme, type TextualContentStrategy, TranslationProvider, type UnknownStrategy, type UseRenderingStrategy, type UseRenderingStrategyOptions, type VaultActivatedAnnotation, VaultProvider, type VideoSequence, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, emptyActions, emptyStrategy, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, get3dStrategy, getDefaultAnnotationStyles, getImageStrategy, getManifestSequence, getParsedTargetSelector, getRenderingStrategy, getTextualContentStrategy, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, parseSpecificResource, svgThemes, unknownResponse, unsupportedStrategy, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasSubset, useClosestLanguage, useCollection, useContextBridge, useCreateLocaleString, useCurrentAuth, useDispatch, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLoadImageService, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useRenderingStrategy, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useSvgEditor, useThumbnail, useTranslations, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };