react-iiif-vault 1.3.5 → 1.4.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/bundle.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { ReactNode, FC, RefObject, ForwardRefExoticComponent, RefAttributes, FunctionComponent } from 'react';
2
+ import React__default, { ReactNode, FC, ComponentType, RefObject, ForwardRefExoticComponent, RefAttributes, FunctionComponent, Context } from 'react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
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, ComplexChoice, 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, Vault as Vault$1 } from '@iiif/helpers';
9
9
  import { BoxSelector, TemporalBoxSelector, TemporalSelector } from '@iiif/helpers/annotation-targets';
10
10
  export * from '@iiif/helpers/annotation-targets';
11
11
  import * as mitt from 'mitt';
@@ -153,6 +153,13 @@ type MediaStrategy = {
153
153
  media: SingleAudio | SingleVideo | AudioSequence | VideoSequence | SingleYouTubeVideo;
154
154
  choice?: ChoiceDescription;
155
155
  annotations?: AnnotationPageDescription;
156
+ captions?: Array<{
157
+ id: string;
158
+ type: string;
159
+ format: string;
160
+ label?: InternationalString;
161
+ language?: string;
162
+ }>;
156
163
  };
157
164
  type ComplexTimelineStrategy = {
158
165
  type: 'complex-timeline';
@@ -215,6 +222,38 @@ type UseRenderingStrategyOptions = {
215
222
  };
216
223
  declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
217
224
 
225
+ interface AudioComponentProps {
226
+ media: SingleAudio;
227
+ startTime?: number | null;
228
+ children: ReactNode;
229
+ }
230
+ declare function AudioHTML({ media, startTime, children }: AudioComponentProps): react_jsx_runtime.JSX.Element;
231
+ declare function Audio({ media, mediaControlsDeps, audioCopmonent, children, }: {
232
+ media: SingleAudio;
233
+ mediaControlsDeps?: any[];
234
+ children: ReactNode;
235
+ audioCopmonent?: ComponentType<AudioComponentProps>;
236
+ }): null;
237
+
238
+ interface VideoComponentProps {
239
+ element: RefObject<HTMLVideoElement>;
240
+ media: SingleVideo;
241
+ playPause: () => void;
242
+ canvas: CanvasNormalized;
243
+ poster?: string;
244
+ startTime?: number;
245
+ captions?: MediaStrategy['captions'];
246
+ }
247
+ declare function VideoHTML({ element, media, startTime, playPause, poster }: VideoComponentProps): react_jsx_runtime.JSX.Element;
248
+ declare function Video({ media, mediaControlsDeps, children, videoComponent, captions, }: {
249
+ media: SingleVideo;
250
+ mediaControlsDeps?: any[];
251
+ children: ReactNode;
252
+ posterCanvasId?: string;
253
+ videoComponent?: ComponentType<VideoComponentProps>;
254
+ captions?: MediaStrategy['captions'];
255
+ }): null;
256
+
218
257
  type CanvasProps = {
219
258
  x?: number;
220
259
  y?: number;
@@ -241,8 +280,12 @@ type CanvasProps = {
241
280
  ignoreSize?: boolean;
242
281
  throwOnUnknown?: boolean;
243
282
  onClickPaintingAnnotation?: (id: string, image: ImageWithOptionalService, e: any) => void;
283
+ components?: {
284
+ Video?: React__default.ComponentType<VideoComponentProps>;
285
+ Audio?: React__default.ComponentType<AudioComponentProps>;
286
+ };
244
287
  };
245
- declare function RenderCanvas({ x, y, onChoiceChange, registerActions, defaultChoices, isStatic, renderViewerControls, renderMediaControls, renderComplexTimelineControls, viewControlsDeps, mediaControlsDeps, strategies, throwOnUnknown, backgroundStyle, alwaysShowBackground, keepCanvasScale, enableSizes, enableYouTube, onClickPaintingAnnotation, children, }: CanvasProps): react_jsx_runtime.JSX.Element | null;
288
+ declare function RenderCanvas({ x, y, onChoiceChange, registerActions, defaultChoices, isStatic, renderViewerControls, renderMediaControls, renderComplexTimelineControls, viewControlsDeps, mediaControlsDeps, strategies, throwOnUnknown, backgroundStyle, alwaysShowBackground, keepCanvasScale, enableSizes, enableYouTube, onClickPaintingAnnotation, components, children, }: CanvasProps): react_jsx_runtime.JSX.Element | null;
246
289
 
247
290
  declare function RenderImage({ id, image, thumbnail, isStatic, x, y, children, selector, onClick, enableSizes, }: {
248
291
  id: string;
@@ -305,33 +348,6 @@ type SimpleViewerActionsType = {
305
348
  };
306
349
  }[keyof SimpleViewerActions];
307
350
 
308
- declare function AudioHTML({ media, startTime, children, }: {
309
- media: SingleAudio;
310
- startTime?: number | null;
311
- children: ReactNode;
312
- }): react_jsx_runtime.JSX.Element;
313
- declare function Audio({ media, mediaControlsDeps, children, }: {
314
- media: SingleAudio;
315
- mediaControlsDeps?: any[];
316
- children: ReactNode;
317
- }): null;
318
-
319
- interface VideoComponentProps {
320
- element: RefObject<HTMLVideoElement>;
321
- media: SingleVideo;
322
- playPause: () => void;
323
- poster?: string;
324
- startTime?: number;
325
- }
326
- declare function VideoHTML({ element, media, startTime, playPause, poster }: VideoComponentProps): react_jsx_runtime.JSX.Element;
327
- declare function Video({ media, mediaControlsDeps, children, videoComponent, }: {
328
- media: SingleVideo;
329
- mediaControlsDeps?: any[];
330
- children: ReactNode;
331
- posterCanvasId?: string;
332
- videoComponent?: FC<VideoComponentProps>;
333
- }): null;
334
-
335
351
  declare function ModelHTML({ model }: {
336
352
  model: any;
337
353
  }): react_jsx_runtime.JSX.Element;
@@ -956,6 +972,20 @@ interface Search1Store {
956
972
  nextResult: () => void;
957
973
  }
958
974
 
975
+ declare function useCustomContextBridge(): Record<string, {
976
+ value: any;
977
+ Provider: React__default.Provider<any>;
978
+ }>;
979
+ declare function CustomContextBridge(props: Record<string, {
980
+ value: any;
981
+ Provider: React__default.Provider<any>;
982
+ }> & {
983
+ children: React__default.ReactNode;
984
+ }): ReactNode;
985
+ declare function CustomContextBridgeProvider(props: {
986
+ providers: Record<string, Context<any>>;
987
+ children: React__default.ReactNode;
988
+ }): react_jsx_runtime.JSX.Element;
959
989
  declare function useContextBridge(): {
960
990
  VaultContext: {
961
991
  vault: _iiif_helpers.Vault | null;
@@ -972,6 +1002,7 @@ declare function useContextBridge(): {
972
1002
  };
973
1003
  declare function ContextBridge(props: {
974
1004
  bridge: ReturnType<typeof useContextBridge>;
1005
+ custom?: ReturnType<typeof useCustomContextBridge>;
975
1006
  children: ReactNode;
976
1007
  }): react_jsx_runtime.JSX.Element;
977
1008
 
@@ -1100,17 +1131,18 @@ declare const unknownResponse: UseRenderingStrategy[0];
1100
1131
  declare const unsupportedStrategy: (reason: string) => UnknownStrategy;
1101
1132
  declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
1102
1133
 
1103
- declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables): UnknownStrategy | MediaStrategy;
1134
+ declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables, vault: Vault$1): UnknownStrategy | MediaStrategy;
1104
1135
 
1105
1136
  interface GetRenderStrategyOptions {
1106
1137
  canvas: CanvasNormalized | null | undefined;
1107
1138
  paintables: Paintables$1;
1108
1139
  supports: string[];
1109
1140
  loadImageService: ImageServiceLoaderType;
1141
+ vault: Vault$1;
1110
1142
  }
1111
- declare function getRenderingStrategy({ canvas, paintables, supports, loadImageService }: GetRenderStrategyOptions): RenderingStrategy;
1143
+ declare function getRenderingStrategy({ canvas, paintables, supports, loadImageService, vault, }: GetRenderStrategyOptions): RenderingStrategy;
1112
1144
 
1113
- declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): ComplexTimelineStrategy;
1145
+ declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType, vault: Vault$1): ComplexTimelineStrategy;
1114
1146
 
1115
1147
  declare function useAnnotation(options?: {
1116
1148
  id: string;
@@ -1501,4 +1533,4 @@ declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): A
1501
1533
  declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
1502
1534
  declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
1503
1535
 
1504
- 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, ComplexTimelineProvider, 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, ReactEventContext, 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 TextContent, type TextualContentStrategy, type TimelineKeyframe, TranslationProvider, TransliterationProvider, 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, getComplexTimelineStrategy, 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, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, 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, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
1536
+ 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, ComplexTimelineProvider, type ComplexTimelineStrategy, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, 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, ReactEventContext, 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 TextContent, type TextualContentStrategy, type TimelineKeyframe, TranslationProvider, TransliterationProvider, 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, getComplexTimelineStrategy, 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, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAuth, useCustomContextBridge, 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, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };