react-iiif-vault 2.0.19 → 4.0.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.
Files changed (67) hide show
  1. package/README.md +77 -1
  2. package/dist/Image-CXsx26cA.d.ts +45 -0
  3. package/dist/Image-g-DyBvi0.d.cts +45 -0
  4. package/dist/ImageStrategy-BHLIi5gd.d.ts +55 -0
  5. package/dist/ImageStrategy-Be9YES5a.d.cts +55 -0
  6. package/dist/SimpleViewerContext.hooks-CTgfe0Gg.d.cts +617 -0
  7. package/dist/SimpleViewerContext.hooks-DYJSrd-U.d.ts +617 -0
  8. package/dist/SimpleViewerContext.types-CWf5OFM7.d.ts +51 -0
  9. package/dist/SimpleViewerContext.types-Df-cpBss.d.cts +51 -0
  10. package/dist/ViewerPresetContext-D7N6KH9p.d.ts +144 -0
  11. package/dist/ViewerPresetContext-DwFTIkDx.d.cts +144 -0
  12. package/dist/bundle.d.ts +290 -196
  13. package/dist/bundle.global.js +45 -74
  14. package/dist/canvas-panel/scene.cjs +1 -0
  15. package/dist/canvas-panel/scene.d.cts +133 -0
  16. package/dist/canvas-panel/scene.d.ts +133 -0
  17. package/dist/canvas-panel/scene.js +1 -0
  18. package/dist/canvas-panel.cjs +1 -47
  19. package/dist/canvas-panel.d.cts +10 -5
  20. package/dist/canvas-panel.d.ts +10 -5
  21. package/dist/canvas-panel.js +1 -1
  22. package/dist/chunk-3XPYQXUE.js +48 -0
  23. package/dist/chunk-6WG6RPHU.js +1 -0
  24. package/dist/chunk-DXC5VCRN.js +1 -0
  25. package/dist/chunk-DZ7DMQ3V.cjs +1 -0
  26. package/dist/chunk-HFC72RK6.js +1 -0
  27. package/dist/chunk-L2GTJVPY.js +1 -0
  28. package/dist/chunk-L576POBV.cjs +2 -0
  29. package/dist/chunk-LKWFF45D.cjs +1 -0
  30. package/dist/chunk-MEQI335A.js +2 -0
  31. package/dist/chunk-MIANDAMK.cjs +1 -0
  32. package/dist/chunk-ND2R7OTX.js +1 -0
  33. package/dist/chunk-R7HZTE2T.cjs +48 -0
  34. package/dist/chunk-WBVFSMED.cjs +1 -0
  35. package/dist/chunk-XULFR6E3.cjs +1 -0
  36. package/dist/chunk-YEU5T67O.js +1 -0
  37. package/dist/chunk-ZBGD3VEW.cjs +1 -0
  38. package/dist/chunk-ZEGT4BAR.cjs +1 -0
  39. package/dist/core.cjs +1 -0
  40. package/dist/core.d.cts +133 -0
  41. package/dist/core.d.ts +133 -0
  42. package/dist/core.js +1 -0
  43. package/dist/{index-DijgVxjb.d.ts → index-ClFUurPI.d.ts} +15 -69
  44. package/dist/{index-DHghDluJ.d.cts → index-QFlDahI_.d.cts} +15 -69
  45. package/dist/index.cjs +1 -49
  46. package/dist/index.d.cts +33 -1496
  47. package/dist/index.d.ts +33 -1496
  48. package/dist/index.js +1 -1
  49. package/dist/presentation-4.cjs +1 -0
  50. package/dist/presentation-4.d.cts +304 -0
  51. package/dist/presentation-4.d.ts +304 -0
  52. package/dist/presentation-4.js +1 -0
  53. package/dist/ranges-Cc2ppjFD.d.ts +689 -0
  54. package/dist/ranges-D-UBNcsJ.d.cts +689 -0
  55. package/dist/{useRenderingStrategy-CoKE915F.d.cts → useRenderingStrategy-Vubk-vUU.d.cts} +47 -24
  56. package/dist/{useRenderingStrategy-CoKE915F.d.ts → useRenderingStrategy-Vubk-vUU.d.ts} +47 -24
  57. package/dist/utils-DHWZGbVU.d.ts +54 -0
  58. package/dist/utils-De5WTLDh.d.cts +54 -0
  59. package/dist/utils.cjs +1 -1
  60. package/dist/utils.d.cts +7 -5
  61. package/dist/utils.d.ts +7 -5
  62. package/dist/utils.js +1 -1
  63. package/package.json +54 -15
  64. package/dist/chunk-OGCPXOIP.js +0 -49
  65. package/dist/chunk-P7XHGETS.js +0 -1
  66. package/dist/utils-BKdiug6F.d.cts +0 -41
  67. package/dist/utils-CmwQWQLa.d.ts +0 -41
@@ -0,0 +1,617 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import * as React$1 from 'react';
3
+ import React__default, { ReactNode, FunctionComponent, RefObject, DependencyList } from 'react';
4
+ import { BoxStyle } from '@atlas-viewer/atlas';
5
+ import * as zustand_vanilla from 'zustand/vanilla';
6
+ import { StoreApi } from 'zustand/vanilla';
7
+ import { AuthProbeService2, Auth2LocationResource, Auth2SubstituteResource, InternationalString, AuthAccessService2, AuthAccessTokenService2, AuthAccessToken2, Reference, ImageService, ImageSize, Annotation, SearchService } from '@iiif/parser/presentation-3/types';
8
+ import { M as MediaStrategy, a as SingleImageStrategy, E as EmptyStrategy, C as ComplexTimelineStrategy, r as CompatibleCanvas, k as ImageServiceLoaderType, U as UnknownStrategy, R as RenderingStrategy, q as ViewableContainerReference } from './useRenderingStrategy-Vubk-vUU.cjs';
9
+ import * as mitt from 'mitt';
10
+ import { Emitter, EventType, Handler } from 'mitt';
11
+ import { ImageServiceLoader, ImageCandidateRequest, ImageCandidate } from '@iiif/helpers/image-service';
12
+ import { M as MediaPlayerState, e as MediaPlayerActions } from './ViewerPresetContext-DwFTIkDx.cjs';
13
+ import { Vault, VaultOptions, IIIFStore, NormalizedEntity } from '@iiif/helpers/vault';
14
+ import { Vault4 } from '@iiif/helpers/vault-4';
15
+ import { CanvasNormalized, AnnotationPageNormalized, AnnotationNormalized } from '@iiif/parser/presentation-3-normalized/types';
16
+ import { Paintables } from '@iiif/helpers';
17
+ import { C as CompatVault } from './utils-De5WTLDh.cjs';
18
+ import { VaultZustandStore } from '@iiif/helpers/vault/store';
19
+ import { RegionParameter, RotationParameter } from '@iiif/parser/image-3';
20
+ import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
21
+ import * as zustand from 'zustand';
22
+ import * as _iiif_helpers_styles from '@iiif/helpers/styles';
23
+ import { S as SimpleViewerContext, a as SimpleViewerProps } from './SimpleViewerContext.types-Df-cpBss.cjs';
24
+
25
+ declare function AnnotationContext({ annotation, children }: {
26
+ annotation: string;
27
+ children: ReactNode;
28
+ }): react_jsx_runtime.JSX.Element;
29
+
30
+ declare function AnnotationPageContext({ annotationPage, children }: {
31
+ annotationPage: string;
32
+ children: ReactNode;
33
+ }): react_jsx_runtime.JSX.Element;
34
+
35
+ interface AnnotationStyles {
36
+ id: number;
37
+ name: string;
38
+ creator?: {
39
+ id: number;
40
+ name: string;
41
+ };
42
+ createdAt: Date;
43
+ theme: {
44
+ default: AnnotationThemeDefinition;
45
+ hidden: AnnotationThemeDefinition;
46
+ highlighted: AnnotationThemeDefinition;
47
+ } & Record<string, AnnotationThemeDefinition>;
48
+ }
49
+ type AnnotationThemeDefinition = BoxStyle & {
50
+ hidden?: boolean;
51
+ interactive?: boolean;
52
+ hotspot?: boolean;
53
+ hotspotSize?: 'lg' | 'md' | 'sm';
54
+ };
55
+ declare function getDefaultAnnotationStyles(): AnnotationStyles['theme'];
56
+ declare function useAnnotationStyles(): {
57
+ default: AnnotationThemeDefinition;
58
+ hidden: AnnotationThemeDefinition;
59
+ highlighted: AnnotationThemeDefinition;
60
+ } & Record<string, AnnotationThemeDefinition>;
61
+ declare function AnnotationStyleProvider({ theme, children, }: {
62
+ theme?: AnnotationStyles['theme'];
63
+ children: React.ReactNode;
64
+ }): react_jsx_runtime.JSX.Element;
65
+
66
+ declare function hasAuth(resource: any): boolean;
67
+ interface ProbeStore {
68
+ service?: AuthProbeService2;
69
+ status: 'unknown' | 'probing' | 'error' | 'success';
70
+ shouldRedirect: boolean;
71
+ redirectResource: Auth2LocationResource | null;
72
+ shouldSubstitute: boolean;
73
+ substituteResource: Auth2SubstituteResource | null;
74
+ error: string | null;
75
+ errorHeading: InternationalString | null;
76
+ errorNote: InternationalString | null;
77
+ shouldDisplayResource: boolean;
78
+ token: string | null;
79
+ probe: () => Promise<void>;
80
+ setToken: (token: string) => void;
81
+ }
82
+ interface AuthContextState {
83
+ currentAuth: number;
84
+ authItems: AuthAccessState[];
85
+ }
86
+ interface AuthContextCurrentActions {
87
+ login(): void;
88
+ logout(): void;
89
+ nextAuth(): void;
90
+ previousAuth(): void;
91
+ setAuth(index: number): void;
92
+ }
93
+ interface AuthContextActions {
94
+ addService(service: AuthAccessService2, probeId: string): void;
95
+ removeService(service: AuthAccessService2, probeId: string): void;
96
+ }
97
+ interface AuthAccessState {
98
+ id: string;
99
+ type: 'external' | 'kiosk' | 'active';
100
+ service: AuthAccessService2;
101
+ probeId: string;
102
+ isPending: boolean;
103
+ isLoggedIn: boolean;
104
+ canAuthenticate: boolean;
105
+ instances: number;
106
+ error?: string;
107
+ session: null | {
108
+ token: string;
109
+ expires: number;
110
+ };
111
+ }
112
+ declare const createAuthStateStore: () => zustand_vanilla.StoreApi<AuthContextCurrentActions & AuthContextState & AuthContextActions>;
113
+ declare const createProbe: (service?: AuthProbeService2, token?: string) => zustand_vanilla.StoreApi<ProbeStore>;
114
+ declare function authDetailsForResource(resource: any): {
115
+ hasAuth?: boolean | undefined;
116
+ services: {
117
+ probe?: AuthProbeService2;
118
+ access?: AuthAccessService2;
119
+ };
120
+ };
121
+ declare function makeAccessTokenRequest<T extends AuthAccessTokenService2>(service: T, { strict }?: {
122
+ strict?: boolean;
123
+ }): Promise<AuthAccessToken2>;
124
+ declare function makeAccessServiceRequest<T extends AuthAccessService2>(service: T): Promise<void>;
125
+
126
+ interface AuthState {
127
+ id: string;
128
+ type: 'external' | 'kiosk' | 'active';
129
+ service: AuthAccessService2;
130
+ probeId: string;
131
+ isPending: boolean;
132
+ isLoggedIn: boolean;
133
+ canAuthenticate: boolean;
134
+ instances: number;
135
+ error?: string;
136
+ session: null | {
137
+ token: string;
138
+ expires: number;
139
+ };
140
+ }
141
+ declare const AuthRContext: React$1.Context<StoreApi<AuthContextState & AuthContextCurrentActions & AuthContextActions> | null>;
142
+ declare const AuthReactContext: React$1.Context<(AuthContextState & AuthContextCurrentActions) | null>;
143
+ declare const AuthReactContextActions: React$1.Context<AuthContextActions | null>;
144
+ declare function AuthProvider({ children }: {
145
+ children: ReactNode;
146
+ }): react_jsx_runtime.JSX.Element;
147
+ declare function useIsAuthEnabled(): boolean;
148
+ declare function useAuthStore(): StoreApi<AuthContextState & AuthContextCurrentActions & AuthContextActions>;
149
+ declare function useAuthActions(): {
150
+ login: () => void;
151
+ logout: () => void;
152
+ nextAuth: () => void;
153
+ previousAuth: () => void;
154
+ setAuth: (index: number) => void;
155
+ addService: (service: AuthAccessService2, probeId: string) => void;
156
+ removeService: (service: AuthAccessService2, probeId: string) => void;
157
+ };
158
+ declare function useCurrentAuth(): AuthContextState & AuthContextCurrentActions & AuthContextActions;
159
+ declare function useAuthService(id: string): AuthAccessState | undefined;
160
+ declare function useAuthTokens(id?: string): string | undefined;
161
+ declare function useAuthToken(id: string): string | null;
162
+ interface AuthProps<T, Extra> {
163
+ resource: T;
164
+ extra?: Extra;
165
+ children: (service: T) => ReactNode;
166
+ fallbackComponent?: FunctionComponent<any> | null;
167
+ loadingComponent?: FunctionComponent<any> | null;
168
+ errorComponent?: FunctionComponent<{
169
+ resource: T;
170
+ error: string;
171
+ heading: InternationalString | null;
172
+ note: InternationalString | null;
173
+ extra: Extra | undefined;
174
+ }> | null;
175
+ }
176
+ declare function Auth<Element, Extra = any>(props: AuthProps<Element, Extra>): string | number | boolean | Iterable<ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
177
+
178
+ declare function CanvasContext({ canvas, children }: {
179
+ canvas: string;
180
+ children: ReactNode;
181
+ }): react_jsx_runtime.JSX.Element;
182
+
183
+ declare function CollectionContext({ collection, children }: {
184
+ collection: string;
185
+ children: ReactNode;
186
+ }): react_jsx_runtime.JSX.Element;
187
+
188
+ type ResourceContextType = {
189
+ collection?: string;
190
+ manifest?: string;
191
+ range?: string;
192
+ canvas?: string;
193
+ annotation?: string;
194
+ annotationPage?: string;
195
+ scene?: string;
196
+ timeline?: string;
197
+ };
198
+ declare const ResourceReactContext: React__default.Context<ResourceContextType>;
199
+ declare const useResourceContext: () => ResourceContextType;
200
+ declare function ResourceProvider({ value, children }: {
201
+ value: ResourceContextType;
202
+ children: ReactNode;
203
+ }): react_jsx_runtime.JSX.Element;
204
+
205
+ interface ControlsContext {
206
+ renderMediaControls?: (strategy: MediaStrategy) => ReactNode;
207
+ viewControlsDeps: any[];
208
+ renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
209
+ mediaControlsDeps: any[];
210
+ renderComplexTimelineControls?: (strategy: ComplexTimelineStrategy) => ReactNode;
211
+ complexTimelineControlsDeps: any[];
212
+ }
213
+ declare const ControlsReactContext: React$1.Context<ControlsContext | null>;
214
+ declare function useRenderControls(): ControlsContext;
215
+
216
+ interface EventContext {
217
+ emitter: Emitter<any>;
218
+ }
219
+ declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
220
+ declare const ReactEventContext: React__default.Context<{
221
+ emitter: Emitter<Record<EventType, unknown>>;
222
+ }>;
223
+ declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
224
+ declare function EventsProvider({ emitter, children }: EventContext & {
225
+ children: React__default.ReactNode;
226
+ }): react_jsx_runtime.JSX.Element;
227
+
228
+ declare const ImageServiceLoaderContext: React__default.Context<ImageServiceLoader>;
229
+ declare function useImageServiceLoader(): ImageServiceLoader;
230
+
231
+ declare function ManifestContext({ manifest, children }: {
232
+ manifest: string;
233
+ children: ReactNode;
234
+ }): react_jsx_runtime.JSX.Element;
235
+
236
+ declare function useMediaState(): MediaPlayerState;
237
+ declare function useMediaActions(): MediaPlayerActions;
238
+ declare function useMediaElements(): {
239
+ element: RefObject<HTMLAudioElement | HTMLVideoElement>;
240
+ currentTime: RefObject<HTMLDivElement>;
241
+ progress: RefObject<HTMLDivElement>;
242
+ };
243
+ declare function MediaPlayerProvider({ actions, state, children, currentTime, progress, element, }: {
244
+ actions: MediaPlayerActions;
245
+ state: MediaPlayerState;
246
+ children: ReactNode;
247
+ currentTime: RefObject<HTMLDivElement>;
248
+ progress: RefObject<HTMLDivElement>;
249
+ element: RefObject<HTMLAudioElement | HTMLVideoElement>;
250
+ }): react_jsx_runtime.JSX.Element;
251
+
252
+ declare function RangeContext({ range, children }: {
253
+ range: string;
254
+ children: ReactNode;
255
+ }): react_jsx_runtime.JSX.Element;
256
+
257
+ type SelectorHelperEventTypes = 'click' | 'hover' | 'selector-updated' | 'highlight' | 'clear-highlight' | 'zoom-to' | 'event-listener' | 'remove-event-listener' | 'image-preview-request';
258
+ declare function SelectorControllerProvider({ children }: {
259
+ children: ReactNode;
260
+ }): react_jsx_runtime.JSX.Element;
261
+ declare function useSelectorEmitter(): mitt.Emitter<Record<mitt.EventType, unknown>>;
262
+ declare function useSelectorEvents(id: string): {
263
+ controller: {
264
+ withSelector(selectorId: string): {
265
+ on<T extends {
266
+ selectorId: string;
267
+ } = any>(type: SelectorHelperEventTypes, handler: Handler<T>): () => void;
268
+ emit<T_1 = any>(type: SelectorHelperEventTypes, event: T_1): void;
269
+ };
270
+ on<T_2 extends {
271
+ selectorId: string;
272
+ } = any>(type: SelectorHelperEventTypes, handler: Handler<T_2>): () => void;
273
+ emit<T_3 extends {
274
+ selectorId: string;
275
+ } = any>(type: SelectorHelperEventTypes, event: T_3): void;
276
+ };
277
+ onClick: (e?: {
278
+ x: number;
279
+ y: number;
280
+ width: number;
281
+ height: number;
282
+ }) => void;
283
+ onHover: (e?: {
284
+ x: number;
285
+ y: number;
286
+ width: number;
287
+ height: number;
288
+ }) => void;
289
+ isHighlighted: boolean;
290
+ };
291
+ declare function useSelectorController(): {
292
+ withSelector(selectorId: string): {
293
+ on<T extends {
294
+ selectorId: string;
295
+ } = any>(type: SelectorHelperEventTypes, handler: Handler<T>): () => void;
296
+ emit<T_1 = any>(type: SelectorHelperEventTypes, event: T_1): void;
297
+ };
298
+ on<T_2 extends {
299
+ selectorId: string;
300
+ } = any>(type: SelectorHelperEventTypes, handler: Handler<T_2>): () => void;
301
+ emit<T_3 extends {
302
+ selectorId: string;
303
+ } = any>(type: SelectorHelperEventTypes, event: T_3): void;
304
+ };
305
+ declare function useSelectorHelper(): {
306
+ withSelector(selectorId: string): {
307
+ highlight(): void;
308
+ clearHighlight(): void;
309
+ zoomTo(): void;
310
+ addEventListener(name: string, callback: () => void): () => void;
311
+ getImagePreview(): Promise<any>;
312
+ on<T extends {
313
+ selectorId: string;
314
+ } = any>(type: SelectorHelperEventTypes, handler: Handler<T>): () => void;
315
+ };
316
+ highlight(selectorId: string): void;
317
+ clearHighlight(selectorId: string): void;
318
+ zoomTo(selectorId: string): void;
319
+ addEventListener(selectorId: string, name: string, callback: () => void): () => void;
320
+ getImagePreview(selectorId: string): Promise<any>;
321
+ on<T_1 extends {
322
+ selectorId: string;
323
+ } = any>(type: SelectorHelperEventTypes, handler: Handler<T_1>): () => void;
324
+ };
325
+
326
+ declare const ReactVaultContext: React__default.Context<{
327
+ vault: Vault | Vault4 | null;
328
+ setVaultInstance: (vault: Vault | Vault4) => void;
329
+ }>;
330
+ declare function VaultProvider({ vault, vaultOptions, useGlobal, resources, version, children, }: {
331
+ vault?: Vault | Vault4;
332
+ version?: 3 | 4;
333
+ useGlobal?: boolean;
334
+ vaultOptions?: VaultOptions;
335
+ resources?: ResourceContextType;
336
+ children: ReactNode;
337
+ }): react_jsx_runtime.JSX.Element;
338
+
339
+ declare const VisibleCanvasReactContext: React__default.Context<string[]>;
340
+ declare function useVisibleCanvases(): CanvasNormalized[];
341
+ declare function useVisibleCanvasContainers(): CompatibleCanvas[];
342
+
343
+ declare function getComplexTimelineStrategy(canvas: CompatibleCanvas, paintables: Paintables, loadImageService: ImageServiceLoaderType, vault: CompatVault): ComplexTimelineStrategy;
344
+
345
+ declare function getVideoStrategy(canvas: CompatibleCanvas, paintables: Paintables, vault: CompatVault, enforceSpatial?: boolean): UnknownStrategy | MediaStrategy;
346
+
347
+ type ActiveVault = Vault | Vault4;
348
+ declare function useActiveVault(): ActiveVault;
349
+ declare function useVault(): Vault;
350
+
351
+ type VaultHooks<TVault extends ActiveVault> = {
352
+ useVault(): TVault;
353
+ useExistingVault(vault?: TVault): TVault;
354
+ useVaultEffect(callback: (vault: TVault) => void, deps?: DependencyList): void;
355
+ useVaultSelector<T>(selector: (state: IIIFStore, vault: TVault) => T, deps?: DependencyList): T;
356
+ };
357
+ /** Creates Vault hooks bound to one Presentation version and rejects a mismatched provider at runtime. */
358
+ declare function createVaultHooks(): VaultHooks<Vault>;
359
+ declare function createVaultHooks(version: 3): VaultHooks<Vault>;
360
+ declare function createVaultHooks(version: 4): VaultHooks<Vault4>;
361
+
362
+ declare function useAnnotationPageManager(resourceId?: string, options?: {
363
+ all?: boolean;
364
+ }): {
365
+ availablePageIds: string[];
366
+ enabledPageIds: string[];
367
+ setPageEnabled: (id: string, opt?: {
368
+ deselectOthers?: boolean;
369
+ }) => void;
370
+ setPageDisabled: (deselectId: string) => void;
371
+ };
372
+
373
+ declare function useCanvasClock(canvasId?: string, autoplay?: boolean): void;
374
+
375
+ declare function useCanvasStartTime(): {
376
+ startTime: number;
377
+ endTime?: number | undefined;
378
+ } | null;
379
+
380
+ declare function useDispatch(): VaultZustandStore['dispatch'];
381
+
382
+ type SupportedEvents = 'onClick';
383
+ declare function useEventListener<T>(resource: Reference, name: SupportedEvents, listener: (e: any, resource: T) => void, scope?: string[], deps?: any[]): void;
384
+
385
+ declare const ReactEmitterContext: React$1.Context<Emitter<any>>;
386
+ declare function EventEmitterProvider({ children, emitter, }: {
387
+ children: React.ReactNode;
388
+ emitter: Emitter<any>;
389
+ }): react_jsx_runtime.JSX.Element;
390
+ declare function useEmitter<Event extends Record<string | symbol, unknown>>(): Emitter<Event>;
391
+ declare function useEvent<Event extends Record<string | symbol, unknown>, Key extends keyof Event>(key: Key, listener: (data: Event[Key]) => void, deps?: any[]): void;
392
+
393
+ type ResourceRequestOptions = {
394
+ noCache?: boolean;
395
+ };
396
+ declare function useExternalResource<T extends {
397
+ id: string;
398
+ }>(idOrRef: string | {
399
+ id: string;
400
+ type: string;
401
+ }, { noCache }?: ResourceRequestOptions): {
402
+ id: string;
403
+ requestId: string;
404
+ isLoaded: boolean;
405
+ error: Error | undefined;
406
+ cached: boolean;
407
+ resource?: T;
408
+ };
409
+
410
+ declare function useImage(service: ImageService | undefined, data?: {
411
+ size?: Partial<ImageSize>;
412
+ selector?: RegionParameter;
413
+ rotation?: number | RotationParameter;
414
+ format?: string;
415
+ region?: RegionParameter;
416
+ quality?: string;
417
+ }, deps?: any[]): string | null;
418
+
419
+ interface ImageServiceRequestOptions {
420
+ cacheKey?: string;
421
+ }
422
+ /** Returns the first painting image service on the current Canvas. */
423
+ declare function useImageService({ cacheKey }?: ImageServiceRequestOptions): {
424
+ data: ImageService | undefined;
425
+ isFetching: boolean;
426
+ status: 'error' | 'success' | 'loading' | 'idle';
427
+ error?: Error;
428
+ };
429
+
430
+ declare function useImageTile(): {
431
+ isLoading: boolean;
432
+ tile: {
433
+ id: string | undefined;
434
+ width: number | null | undefined;
435
+ height: number | null | undefined;
436
+ imageService: ImageService;
437
+ thumbnail: undefined;
438
+ } | null;
439
+ };
440
+
441
+ declare function usePaintables(options?: {
442
+ defaultChoices?: string[];
443
+ enableSingleAnnotation?: boolean;
444
+ }, deps?: any[]): readonly [_iiif_helpers_painting_annotations.Paintables, {
445
+ makeChoice: (id: string, { deselectOthers, deselect }?: {
446
+ deselectOthers?: boolean;
447
+ deselect?: boolean;
448
+ }) => void;
449
+ }];
450
+
451
+ declare function useStaticRenderingStrategy({ supports }?: {
452
+ supports?: Array<RenderingStrategy['type']>;
453
+ }): RenderingStrategy;
454
+
455
+ interface StylesheetStore {
456
+ stylesheets: Record<string, string>;
457
+ loading: string[];
458
+ errors: Array<{
459
+ url: string;
460
+ error: Error;
461
+ }>;
462
+ loadStylesheet(url: string): Promise<string>;
463
+ setStylesheet(value: string, url?: string): string;
464
+ parseStylesheet(stylesheet: Annotation['stylesheet'] | null): Promise<null | {
465
+ id: string;
466
+ type: 'CssStylesheet';
467
+ value: string;
468
+ }>;
469
+ }
470
+ declare const useStylesheetStore: zustand.UseBoundStore<zustand.StoreApi<StylesheetStore>>;
471
+ declare function useRemoteStylesheet(stylesheet?: Annotation['stylesheet'] | null): readonly [Record<string, string>, {
472
+ readonly id: string;
473
+ readonly stylesheets: Record<string, string>;
474
+ readonly loading: string[];
475
+ readonly errors: {
476
+ url: string;
477
+ error: Error;
478
+ }[];
479
+ }];
480
+
481
+ declare function useResourceEvents<T extends NormalizedEntity>(resource?: Reference, scope?: string[]): any;
482
+
483
+ declare function useResources<Type>(ids: string[], type: string): Type[];
484
+
485
+ declare function useSearchService(): SearchService | undefined;
486
+
487
+ declare function useStyleHelper(): _iiif_helpers_styles.StyledHelper<_iiif_helpers_styles.StyleDefinition>;
488
+
489
+ declare function useStyles<Style extends Record<string, Record<string, any>>>(resource: undefined | Reference<any>): Style;
490
+ declare function useStyles<Style extends Record<string, any>>(resource: undefined | Reference<any>, scope: string): Style;
491
+
492
+ declare function getCroppedThumbnail(thumbnail: any, request: ImageCandidateRequest): ImageCandidate | undefined;
493
+ declare function useThumbnail(request: ImageCandidateRequest, dereference?: boolean, { canvasId, manifestId }?: {
494
+ canvasId?: string;
495
+ manifestId?: string;
496
+ }): ImageCandidate | undefined;
497
+
498
+ type Rect = {
499
+ x: number;
500
+ y: number;
501
+ width: number;
502
+ height: number;
503
+ };
504
+ type Transition = {
505
+ from: Rect;
506
+ to: Rect;
507
+ };
508
+ declare const DEFAULT_BEZIER: [number, number, number, number];
509
+ declare const DEFAULT_POLL_INTERVAL = 16;
510
+ type EasingPreset = 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'ease-in-cubic' | 'ease-out-cubic';
511
+ declare const EASING_PRESETS: Record<EasingPreset, [number, number, number, number]>;
512
+ declare function interpolateRect(a: Rect, b: Rect, t: number): Rect;
513
+ declare function buildTransitions(initial: Rect, regions: Rect[]): Transition[];
514
+ /**
515
+ * Create a cubic-bezier easing function given control points [x1,y1,x2,y2].
516
+ * Uses a numeric solve to invert x(t) -> t for a given x input.
517
+ */
518
+ declare function cubicBezierEasing([x1, y1, x2, y2]: [number, number, number, number]): (x: number) => number;
519
+ /**
520
+ * Map a progress value to a step index and local t in [0,1].
521
+ * If progress < 0 returns index -1 and t 0. If progress >= transitions.length returns index = transitions.length and t 0.
522
+ */
523
+ declare function getStepFromProgress(progress: number, transitions: Transition[]): {
524
+ index: number;
525
+ t: number;
526
+ };
527
+
528
+ type EasingInput = ((t: number) => number) | EasingPreset | [number, number, number, number];
529
+ type UseViewportTourOptions = {
530
+ initial: Rect;
531
+ regions: Rect[];
532
+ /** Provide either a numeric progress or a function that returns progress */
533
+ progress?: number;
534
+ getProgress?: () => number;
535
+ enabled?: boolean;
536
+ easing?: EasingInput;
537
+ /** if true, report progress every tick; otherwise only when step index changes */
538
+ reportEveryFrame?: boolean;
539
+ pollInterval?: number;
540
+ loop?: boolean;
541
+ onEnter?: (index: number) => void;
542
+ onExit?: (index: number) => void;
543
+ onProgress?: (index: number, t: number) => void;
544
+ /** optional callback to receive jump-to function for programmatic navigation */
545
+ jumpTo?: (fn: (index: number) => void) => void;
546
+ };
547
+ declare function useViewportTour(options: UseViewportTourOptions): {
548
+ transitions: Transition[];
549
+ currentIndex: number;
550
+ currentTransition: Transition | undefined;
551
+ t: number;
552
+ rect: Rect | undefined;
553
+ jumpTo: (indexToJump: number) => void;
554
+ };
555
+
556
+ type UseViewportScrollOptions = {
557
+ axis?: 'y' | 'x';
558
+ offset?: number;
559
+ steps?: number;
560
+ enabled?: boolean;
561
+ };
562
+ /**
563
+ * Returns a progress value derived from scroll position of provided element.
564
+ * The returned value is in range [0, steps].
565
+ * Uses passive scroll listener + requestAnimationFrame for efficient updates.
566
+ */
567
+ declare function useViewportScroll(ref: {
568
+ current: HTMLElement | null;
569
+ } | null, options?: UseViewportScrollOptions): number;
570
+
571
+ interface VaultActivatedAnnotation {
572
+ __vault?: Vault;
573
+ bindToVault(vault: Vault): void;
574
+ source: string | {
575
+ id: string;
576
+ };
577
+ }
578
+ declare function useVirtualAnnotationPage(): readonly [AnnotationPageNormalized | null, {
579
+ readonly addAnnotation: (id: string | Annotation | VaultActivatedAnnotation | AnnotationNormalized, atIndex?: number) => void;
580
+ readonly removeAnnotation: (id: string | Annotation | VaultActivatedAnnotation | AnnotationNormalized) => void;
581
+ }];
582
+
583
+ declare function useVirtualAnnotationPageContext(): [AnnotationPageNormalized | null, {
584
+ addAnnotation: (id: string | Annotation | VaultActivatedAnnotation | AnnotationNormalized, atIndex?: number | undefined) => void;
585
+ removeAnnotation: (id: string | Annotation | VaultActivatedAnnotation | AnnotationNormalized) => void;
586
+ }];
587
+ declare function VirtualAnnotationProvider({ children }: {
588
+ children: any;
589
+ }): react_jsx_runtime.JSX.Element;
590
+
591
+ declare const SimpleViewerReactContext: React__default.Context<SimpleViewerContext>;
592
+ declare function InnerViewerProvider(props: SimpleViewerProps): react_jsx_runtime.JSX.Element | null;
593
+ declare function SimpleViewerProvider(props: SimpleViewerProps): react_jsx_runtime.JSX.Element;
594
+ declare function useSimpleViewer(): SimpleViewerContext;
595
+
596
+ declare function useContainerSequence({ startCanvas, disablePaging }: {
597
+ startCanvas?: string;
598
+ disablePaging?: boolean;
599
+ }): {
600
+ visibleItems: string[];
601
+ cursor: number;
602
+ items: ViewableContainerReference[];
603
+ sequence: number[][];
604
+ hasPrevious: boolean;
605
+ hasNext: boolean;
606
+ setSequenceIndex: React$1.Dispatch<React$1.SetStateAction<number>>;
607
+ setCanvasIndex: (index: number) => void;
608
+ setCanvasId: (id: string) => void;
609
+ next: () => void;
610
+ previous: () => void;
611
+ };
612
+ /** @deprecated Use useContainerSequence for Canvas and Timeline navigation. Root imports retain Presentation 3 item types. */
613
+ declare function useCanvasSequence(options: Parameters<typeof useContainerSequence>[0]): Omit<ReturnType<typeof useContainerSequence>, 'items'> & {
614
+ items: Reference<'Canvas'>[];
615
+ };
616
+
617
+ export { getComplexTimelineStrategy as $, AnnotationContext as A, ControlsReactContext as B, CanvasContext as C, useRenderControls as D, defaultEmitter as E, ReactEventContext as F, useEventEmitter as G, EventsProvider as H, ImageServiceLoaderContext as I, useImageServiceLoader as J, useMediaState as K, useMediaActions as L, ManifestContext as M, useMediaElements as N, MediaPlayerProvider as O, RangeContext as P, type ResourceContextType as Q, ResourceProvider as R, ResourceReactContext as S, useResourceContext as T, type SelectorHelperEventTypes as U, type VaultActivatedAnnotation as V, SelectorControllerProvider as W, useSelectorEmitter as X, useSelectorEvents as Y, useSelectorController as Z, useSelectorHelper as _, ReactVaultContext as a, useVisibleCanvasContainers as a$, getVideoStrategy as a0, type VaultHooks as a1, createVaultHooks as a2, useAnnotationPageManager as a3, useCanvasClock as a4, useCanvasStartTime as a5, useDispatch as a6, useEventListener as a7, ReactEmitterContext as a8, EventEmitterProvider as a9, DEFAULT_BEZIER as aA, DEFAULT_POLL_INTERVAL as aB, type EasingPreset as aC, EASING_PRESETS as aD, interpolateRect as aE, buildTransitions as aF, cubicBezierEasing as aG, getStepFromProgress as aH, SimpleViewerReactContext as aI, InnerViewerProvider as aJ, SimpleViewerProvider as aK, useSimpleViewer as aL, useContainerSequence as aM, useCanvasSequence as aN, hasAuth as aO, type ProbeStore as aP, type AuthContextState as aQ, type AuthContextCurrentActions as aR, type AuthContextActions as aS, type AuthAccessState as aT, createAuthStateStore as aU, createProbe as aV, authDetailsForResource as aW, makeAccessTokenRequest as aX, makeAccessServiceRequest as aY, VaultProvider as aZ, useVisibleCanvases as a_, useEmitter as aa, useEvent as ab, type ResourceRequestOptions as ac, useExternalResource as ad, useImage as ae, type ImageServiceRequestOptions as af, useImageService as ag, useImageTile as ah, usePaintables as ai, useStaticRenderingStrategy as aj, useStylesheetStore as ak, useRemoteStylesheet as al, useResourceEvents as am, useResources as an, useSearchService as ao, useStyleHelper as ap, useStyles as aq, getCroppedThumbnail as ar, useThumbnail as as, type EasingInput as at, type UseViewportTourOptions as au, useViewportTour as av, type UseViewportScrollOptions as aw, useViewportScroll as ax, type Rect as ay, type Transition as az, VisibleCanvasReactContext as b, type ActiveVault as b0, useActiveVault as b1, useVault as b2, useVirtualAnnotationPageContext as c, VirtualAnnotationProvider as d, AnnotationPageContext as e, type AnnotationStyles as f, type AnnotationThemeDefinition as g, getDefaultAnnotationStyles as h, useAnnotationStyles as i, AnnotationStyleProvider as j, type AuthState as k, AuthRContext as l, AuthReactContext as m, AuthReactContextActions as n, AuthProvider as o, useIsAuthEnabled as p, useAuthStore as q, useAuthActions as r, useCurrentAuth as s, useAuthService as t, useVirtualAnnotationPage as u, useAuthTokens as v, useAuthToken as w, Auth as x, CollectionContext as y, type ControlsContext as z };