react-iiif-vault 1.2.7 → 1.3.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
@@ -17,6 +17,7 @@ import { RenderState, InputShape, SlowState } from 'polygon-editor';
17
17
  import * as zustand_vanilla from 'zustand/vanilla';
18
18
  import { StoreApi } from 'zustand/vanilla';
19
19
  import * as zustand from 'zustand';
20
+ import { StoreApi as StoreApi$1 } from 'zustand';
20
21
  import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
21
22
  import { Paintables as Paintables$1 } from '@iiif/helpers/painting-annotations';
22
23
  import { VaultZustandStore } from '@iiif/helpers/vault/store';
@@ -123,7 +124,7 @@ type SingleImageStrategy = {
123
124
  choice?: ChoiceDescription;
124
125
  annotations?: AnnotationPageDescription;
125
126
  };
126
- declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): RenderingStrategy;
127
+ declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): SingleImageStrategy | UnknownStrategy;
127
128
 
128
129
  type Single3DModelStrategy = {
129
130
  type: '3d-model';
@@ -135,14 +136,16 @@ declare function get3dStrategy(canvas: CanvasNormalized, paintables: Paintables)
135
136
 
136
137
  type TextualContentStrategy = {
137
138
  type: 'textual-content';
138
- items: {
139
- annotationId: string;
140
- text: InternationalString;
141
- target: SupportedTarget | null;
142
- }[];
139
+ items: TextContent[];
143
140
  choice?: ChoiceDescription;
144
141
  annotations?: AnnotationPageDescription;
145
142
  };
143
+ type TextContent = {
144
+ type: 'Text';
145
+ annotationId: string;
146
+ text: InternationalString;
147
+ target: SupportedTarget | null;
148
+ };
146
149
  declare function getTextualContentStrategy(canvas: CanvasNormalized, paintables: Paintables): RenderingStrategy;
147
150
 
148
151
  type MediaStrategy = {
@@ -153,10 +156,20 @@ type MediaStrategy = {
153
156
  };
154
157
  type ComplexTimelineStrategy = {
155
158
  type: 'complex-timeline';
156
- items: Array<ImageWithOptionalService | SingleAudio | SingleVideo>;
159
+ items: Array<SingleImageStrategy['image'] | SingleAudio | SingleVideo | SingleYouTubeVideo | TextContent>;
160
+ keyframes: TimelineKeyframe[];
161
+ duration: number;
157
162
  choice?: ChoiceDescription;
158
163
  annotations?: AnnotationPageDescription;
159
164
  };
165
+ interface TimelineKeyframe {
166
+ id: string;
167
+ type: 'enter' | 'exit' | 'change';
168
+ resourceType: 'image' | 'audio' | 'video' | 'text';
169
+ timeDelta?: number;
170
+ isPrime?: boolean;
171
+ time: number;
172
+ }
160
173
  type EmptyStrategy = {
161
174
  type: 'empty';
162
175
  image: null;
@@ -218,6 +231,7 @@ type CanvasProps = {
218
231
  renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
219
232
  viewControlsDeps?: any[];
220
233
  renderMediaControls?: (strategy: MediaStrategy) => ReactNode;
234
+ renderComplexTimelineControls?: (strategy: ComplexTimelineStrategy) => ReactNode;
221
235
  mediaControlsDeps?: any[];
222
236
  strategies?: Array<RenderingStrategy['type']>;
223
237
  backgroundStyle?: BoxStyle;
@@ -228,7 +242,7 @@ type CanvasProps = {
228
242
  throwOnUnknown?: boolean;
229
243
  onClickPaintingAnnotation?: (id: string, image: ImageWithOptionalService, e: any) => void;
230
244
  };
231
- declare function RenderCanvas({ x, y, onChoiceChange, registerActions, defaultChoices, isStatic, renderViewerControls, renderMediaControls, viewControlsDeps, mediaControlsDeps, strategies, throwOnUnknown, backgroundStyle, alwaysShowBackground, keepCanvasScale, enableSizes, enableYouTube, onClickPaintingAnnotation, children, }: CanvasProps): react_jsx_runtime.JSX.Element | null;
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;
232
246
 
233
247
  declare function RenderImage({ id, image, thumbnail, isStatic, x, y, children, selector, onClick, enableSizes, }: {
234
248
  id: string;
@@ -347,6 +361,7 @@ interface CanvasPanelProps {
347
361
  components?: {
348
362
  ViewerControls?: FC;
349
363
  MediaControls?: FC;
364
+ ComplexTimelineControls?: FC;
350
365
  };
351
366
  canvasProps?: Omit<Partial<CanvasProps>, 'x'>;
352
367
  annotations?: ReactNode;
@@ -788,23 +803,6 @@ declare function CollectionContext({ collection, children }: {
788
803
  children: ReactNode;
789
804
  }): react_jsx_runtime.JSX.Element;
790
805
 
791
- interface EventContext {
792
- emitter: Emitter<any>;
793
- }
794
- declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
795
- declare const ReactEventContext: React__default.Context<{
796
- emitter: Emitter<Record<EventType, unknown>>;
797
- }>;
798
- declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
799
- declare function EventsProvider({ emitter, children }: EventContext & {
800
- children: React__default.ReactNode;
801
- }): react_jsx_runtime.JSX.Element;
802
-
803
- declare function ManifestContext({ manifest, children }: {
804
- manifest: string;
805
- children: ReactNode;
806
- }): react_jsx_runtime.JSX.Element;
807
-
808
806
  type MediaPlayerState = {
809
807
  isPlaying: boolean;
810
808
  isMuted: boolean;
@@ -837,6 +835,58 @@ declare function useSimpleMediaPlayer(props: {
837
835
  MediaPlayerActions
838
836
  ];
839
837
 
838
+ interface ComplexTimelineStore extends MediaPlayerActions {
839
+ complexTimeline: ComplexTimelineStrategy;
840
+ visibleElements: Record<string, TimelineKeyframe | null>;
841
+ isReady: boolean;
842
+ isBuffering: boolean;
843
+ bufferMap: Record<string, boolean>;
844
+ isMuted: boolean;
845
+ playRequested: boolean;
846
+ isPlaying: boolean;
847
+ isFinished: boolean;
848
+ volume: number;
849
+ duration: number;
850
+ primeTime: number;
851
+ clockRunning: boolean;
852
+ clockStartTime: number;
853
+ currentPrime: TimelineKeyframe | null;
854
+ clockStartRequests: number;
855
+ startClock: () => void;
856
+ stopClock: () => void;
857
+ setElement: (id: string, element: HTMLVideoElement | HTMLAudioElement) => void;
858
+ removeElement: (id: string) => void;
859
+ applyKeyframes(newIdx: number, keyframes: TimelineKeyframe[]): void;
860
+ nextKeyframeIndex: number;
861
+ setProgressElement(div: HTMLDivElement): void;
862
+ setCurrentTimeElement(div: HTMLDivElement): void;
863
+ clearProgressElement(): void;
864
+ clearCurrentTimeElement(): void;
865
+ }
866
+
867
+ declare function ComplexTimelineProvider({ children, store, }: {
868
+ children: React.ReactNode;
869
+ store: StoreApi$1<ComplexTimelineStore>;
870
+ }): react_jsx_runtime.JSX.Element;
871
+ declare function useComplexTimeline<T>(selector: (store: ComplexTimelineStore) => T): T;
872
+
873
+ interface EventContext {
874
+ emitter: Emitter<any>;
875
+ }
876
+ declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
877
+ declare const ReactEventContext: React__default.Context<{
878
+ emitter: Emitter<Record<EventType, unknown>>;
879
+ }>;
880
+ declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
881
+ declare function EventsProvider({ emitter, children }: EventContext & {
882
+ children: React__default.ReactNode;
883
+ }): react_jsx_runtime.JSX.Element;
884
+
885
+ declare function ManifestContext({ manifest, children }: {
886
+ manifest: string;
887
+ children: ReactNode;
888
+ }): react_jsx_runtime.JSX.Element;
889
+
840
890
  declare function useMediaState(): MediaPlayerState;
841
891
  declare function useMediaActions(): MediaPlayerActions;
842
892
  declare function useMediaElements(): {
@@ -1047,10 +1097,10 @@ declare const emptyActions: {
1047
1097
  makeChoice: () => void;
1048
1098
  };
1049
1099
  declare const unknownResponse: UseRenderingStrategy[0];
1050
- declare const unsupportedStrategy: (reason: string) => UseRenderingStrategy[0];
1100
+ declare const unsupportedStrategy: (reason: string) => UnknownStrategy;
1051
1101
  declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
1052
1102
 
1053
- declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables): RenderingStrategy;
1103
+ declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables): UnknownStrategy | MediaStrategy;
1054
1104
 
1055
1105
  interface GetRenderStrategyOptions {
1056
1106
  canvas: CanvasNormalized | null | undefined;
@@ -1060,6 +1110,8 @@ interface GetRenderStrategyOptions {
1060
1110
  }
1061
1111
  declare function getRenderingStrategy({ canvas, paintables, supports, loadImageService }: GetRenderStrategyOptions): RenderingStrategy;
1062
1112
 
1113
+ declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): ComplexTimelineStrategy;
1114
+
1063
1115
  declare function useAnnotation(options?: {
1064
1116
  id: string;
1065
1117
  }): AnnotationNormalized | undefined;
@@ -1449,4 +1501,4 @@ declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): A
1449
1501
  declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
1450
1502
  declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
1451
1503
 
1452
- 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, 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 TextualContentStrategy, 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, 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, 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 };
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 };