react-iiif-vault 1.5.10 → 2.0.1

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,42 +1,478 @@
1
+ import { BoxSelector, TemporalBoxSelector, TemporalSelector } from '@iiif/helpers/annotation-targets';
2
+ export * from '@iiif/helpers/annotation-targets';
3
+ import { ViewerMode, Runtime, BoxStyle, AtlasProps, Preset } from '@atlas-viewer/atlas';
1
4
  import * as React$1 from 'react';
2
5
  import React__default, { ReactNode, FC, ComponentType, RefObject, ForwardRefExoticComponent, RefAttributes, FunctionComponent, Context } from 'react';
3
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
- import { AtlasProps, Preset, BoxStyle, ViewerMode } from '@atlas-viewer/atlas';
5
- import { AnnotationPage, ImageService as ImageService$1, 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
- import { AnnotationPageNormalized, AnnotationNormalized, CanvasNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
7
- import * as _iiif_helpers from '@iiif/helpers';
8
- import { ChoiceDescription, Paintables, SupportedTarget, ComplexChoice, ImageCandidate, BoxSelector as BoxSelector$1, TemporalBoxSelector as TemporalBoxSelector$1 } from '@iiif/helpers';
9
- import { BoxSelector, TemporalBoxSelector, TemporalSelector } from '@iiif/helpers/annotation-targets';
10
- export * from '@iiif/helpers/annotation-targets';
7
+ import * as zustand from 'zustand';
8
+ import { StoreApi } from 'zustand';
11
9
  import * as mitt from 'mitt';
12
10
  import { Emitter, EventType, Handler } from 'mitt';
11
+ import * as polygon_editor from 'polygon-editor';
12
+ import { RenderState, SlowState, InputShape, ValidTools, createHelper, PolygonEvents } from 'polygon-editor';
13
13
  import * as _iiif_helpers_vault from '@iiif/helpers/vault';
14
14
  import { Vault, VaultOptions, NormalizedEntity, IIIFStore } from '@iiif/helpers/vault';
15
- import { RegionParameter, RotationParameter, SizeParameter } from '@iiif/parser/image-3';
16
- import * as polygon_editor from 'polygon-editor';
17
- import { RenderState, InputShape, SlowState } from 'polygon-editor';
15
+ import { Reference, FragmentSelector, SvgSelector, AnnotationPage, ImageService as ImageService$1, ExternalWebResource, InternationalString, ImageSize, AuthProbeService2, Auth2LocationResource, Auth2SubstituteResource, AuthAccessService2, AuthAccessTokenService2, AuthAccessToken2, SearchServiceQueryParams, SearchServiceSearchResponse, SearchService as SearchService$1, SearchServiceAutocomplete, ContentResource, W3CAnnotationTarget, PointSelector, Annotation } from '@iiif/presentation-3';
18
16
  import * as zustand_vanilla from 'zustand/vanilla';
19
- import { StoreApi } from 'zustand/vanilla';
20
- import * as zustand from 'zustand';
21
- import { StoreApi as StoreApi$1 } from 'zustand';
17
+ import { StoreApi as StoreApi$1 } from 'zustand/vanilla';
18
+ import { AnnotationPageNormalized, AnnotationNormalized, CanvasNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
19
+ import * as _iiif_helpers from '@iiif/helpers';
20
+ import { ChoiceDescription, Paintables, SupportedTarget, ComplexChoice, ImageCandidate, BoxSelector as BoxSelector$1, TemporalBoxSelector as TemporalBoxSelector$1, SupportedSelector, SvgSelector as SvgSelector$1 } from '@iiif/helpers';
21
+ import { RegionParameter, RotationParameter, SizeParameter } from '@iiif/parser/image-3';
22
22
  import { ImageServiceLoader, ImageCandidateRequest, ImageCandidate as ImageCandidate$1 } from '@iiif/helpers/image-service';
23
23
  import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
24
24
  import { Paintables as Paintables$1 } from '@iiif/helpers/painting-annotations';
25
25
  import { VaultZustandStore } from '@iiif/helpers/vault/store';
26
26
  import * as _iiif_helpers_styles from '@iiif/helpers/styles';
27
27
 
28
- declare function Viewer({ children, errorFallback, outerContainerProps, worldScale: _worldScale, ...props }: AtlasProps & {
29
- height?: number | string;
30
- width?: number | string;
31
- resizeHash?: number;
32
- containerProps?: any;
33
- outerContainerProps?: any;
34
- aspectRatio?: number;
35
- errorFallback?: any;
36
- renderPreset?: Preset;
37
- worldScale?: number;
38
- } & {
28
+ type RenderContextProps = {
29
+ canvasId?: string;
30
+ position: {
31
+ x: number;
32
+ y: number;
33
+ };
34
+ close: () => void;
35
+ };
36
+ declare const useContextMenuStore: zustand.UseBoundStore<zustand.StoreApi<{
37
+ isMenuOpen: boolean;
38
+ menuPosition: {
39
+ x: number;
40
+ y: number;
41
+ };
42
+ open(position: {
43
+ x: number;
44
+ y: number;
45
+ }): void;
46
+ toggle(position: {
47
+ x: number;
48
+ y: number;
49
+ }): void;
50
+ setMenuPosition(position: {
51
+ x: number;
52
+ y: number;
53
+ }): void;
54
+ setIsMenuOpen(isMenuOpen: boolean | ((prev: boolean) => boolean)): void;
55
+ close(): void;
56
+ }>>;
57
+ declare function useAtlasContextMenu(id: string, canvasId?: string, renderContextMenu?: (props: RenderContextProps) => React.ReactNode): readonly [react_jsx_runtime.JSX.Element, {
58
+ onContextMenu: (e: any) => void;
59
+ }, {
60
+ readonly open: (position: {
61
+ x: number;
62
+ y: number;
63
+ }) => void;
64
+ readonly close: () => void;
65
+ readonly toggle: (position: {
66
+ x: number;
67
+ y: number;
68
+ }) => void;
69
+ readonly isMenuOpen: boolean;
70
+ readonly setIsMenuOpen: (isMenuOpen: boolean | ((prev: boolean) => boolean)) => void;
71
+ readonly menuPosition: {
72
+ x: number;
73
+ y: number;
74
+ };
75
+ readonly setMenuPosition: (position: {
76
+ x: number;
77
+ y: number;
78
+ }) => void;
79
+ }];
80
+
81
+ interface SvgEditorOptions {
82
+ image: {
83
+ height: number;
84
+ width: number;
85
+ };
86
+ hideShapeLines?: boolean;
87
+ onChange?: (shape: InputShape) => void;
88
+ theme?: Partial<SVGTheme>;
89
+ }
90
+ declare const defaultSvgTheme: {
91
+ shapeFill: string;
92
+ shapeStroke: string;
93
+ lineStroke: string;
94
+ ghostLineStroke: string;
95
+ activeLineStroke: string;
96
+ boundingBoxDottedStroke: string;
97
+ boundingBoxStroke: string;
98
+ controlFill: string;
99
+ };
100
+ type SVGTheme = typeof defaultSvgTheme;
101
+ declare function useSvgEditor(options: SvgEditorOptions): {
102
+ currentTool: polygon_editor.ValidTools;
103
+ setCurrentTool: (tool: polygon_editor.ValidTools) => void;
104
+ helper: {
105
+ state: RenderState;
106
+ setState: (newState: Partial<SlowState>) => void;
107
+ emitter: mitt.Emitter<polygon_editor.PolygonEvents>;
108
+ modifiers: {
109
+ reset(): void;
110
+ getForType(type: string | null): Record<string, string>;
111
+ set(modifier: string): void;
112
+ unset(modifier: string): void;
113
+ };
114
+ stamps: {
115
+ set(selectedStamp: InputShape | null): void;
116
+ clear(): void;
117
+ square(): void;
118
+ triangle(): void;
119
+ pentagon(): void;
120
+ hexagon(): void;
121
+ circle(): void;
122
+ };
123
+ history: {
124
+ undo: () => void;
125
+ redo: () => void;
126
+ readonly canUndo: boolean;
127
+ readonly canRedo: boolean;
128
+ };
129
+ key: {
130
+ down(inputKey: string): boolean | undefined;
131
+ up(inputKey: string): void;
132
+ };
133
+ setScale: (scale: number) => void;
134
+ clock: {
135
+ set: (renderFunc: polygon_editor.RenderFunc) => void;
136
+ start: (renderFunc?: polygon_editor.RenderFunc | undefined, setStateFunc?: polygon_editor.SetState | undefined) => void;
137
+ stop: () => void;
138
+ step: (deltaTime?: number | undefined) => void;
139
+ };
140
+ pointer: (pointers: ([number, number] | [number, number, number, number, number, number])[]) => void;
141
+ blur: () => void;
142
+ pointerDown: () => void;
143
+ pointerUp: () => void;
144
+ setShape: (shape: InputShape | null) => void;
145
+ label: (type: string | null) => string;
146
+ tools: {
147
+ setTool: (tool: polygon_editor.ValidTools) => void;
148
+ unsetTool: (tool: polygon_editor.ValidTools) => void;
149
+ toggleTool: (tool: polygon_editor.ValidTools) => void;
150
+ updateVisibility: (tool: polygon_editor.ValidTools) => void;
151
+ setCanDelete(canDelete: boolean): void;
152
+ setCanDeselect(canDeselect: boolean): void;
153
+ lockToolSwitching(): void;
154
+ unlockToolSwitching(): void;
155
+ toggleToolSwitching(): void;
156
+ shortcuts: {
157
+ [k: string]: string;
158
+ };
159
+ getValidIntents(tool?: polygon_editor.ValidTools | undefined): {
160
+ actions: polygon_editor.ActionIntent[];
161
+ transitions: polygon_editor.TransitionIntent[];
162
+ keys: polygon_editor.ActionIntent[];
163
+ all: Record<string, string>;
164
+ current: Record<string, string>;
165
+ };
166
+ getToolInfo(): {
167
+ name: polygon_editor.ValidTools;
168
+ cursor: string;
169
+ selectionCount: number;
170
+ pointCount: number;
171
+ isOpen: boolean;
172
+ };
173
+ smartSelect(): void;
174
+ clearSelection(): void;
175
+ autoSelect(): void;
176
+ };
177
+ snap: {
178
+ enabled: () => boolean;
179
+ enable: () => void;
180
+ disable: () => void;
181
+ toggle: () => void;
182
+ pointsEnabled: () => boolean;
183
+ enablePoints: () => void;
184
+ disablePoints: () => void;
185
+ togglePoints: () => void;
186
+ linesEnabled: () => boolean;
187
+ enableLines: () => void;
188
+ disableLines: () => void;
189
+ toggleLines: () => void;
190
+ intersectionsEnabled: () => boolean;
191
+ enableIntersections: () => void;
192
+ disableIntersections: () => void;
193
+ toggleIntersections: () => void;
194
+ gridEnabled: () => boolean;
195
+ enableGrid: () => void;
196
+ disableGrid: () => void;
197
+ toggleGrid: () => void;
198
+ parallelEnabled: () => boolean;
199
+ enableParallel: () => void;
200
+ disableParallel: () => void;
201
+ toggleParallel: () => void;
202
+ getThreshold: () => number;
203
+ setThreshold: (threshold: number) => void;
204
+ isActive: () => boolean;
205
+ getSnapPoint: () => ([number, number] | [number, number, number, number, number, number]) | null;
206
+ getActiveGuides: () => polygon_editor.SnapGuide[];
207
+ getTargets: () => polygon_editor.SnapTarget[];
208
+ };
209
+ selectAllPoints: () => void;
210
+ setBounds: (bounds: {
211
+ x: number;
212
+ y: number;
213
+ width: number;
214
+ height: number;
215
+ } | null) => void;
216
+ lockAspectRatio: () => void;
217
+ unlockAspectRatio: () => void;
218
+ };
219
+ currentShape: InputShape | null;
220
+ state: SlowState;
221
+ isAddingPoint: boolean;
222
+ isSplitting: boolean;
223
+ isStamping: boolean | null;
224
+ isHoveringPoint: boolean;
225
+ transitionDirection: string | null;
226
+ transitionRotate: boolean;
227
+ defs: react_jsx_runtime.JSX.Element;
228
+ editor: react_jsx_runtime.JSX.Element | null;
229
+ };
230
+
231
+ type SimpleViewerContext = {
232
+ items: Reference<'Canvas'>[];
233
+ sequence: number[][];
234
+ hasNext: boolean;
235
+ hasPrevious: boolean;
236
+ setSequenceIndex: (newId: number) => void;
237
+ setCurrentCanvasId: (newId: string) => void;
238
+ setCurrentCanvasIndex: (newId: number) => void;
239
+ currentSequenceIndex: number;
240
+ nextCanvas: () => void;
241
+ previousCanvas: () => void;
242
+ };
243
+ type SimpleViewerProps = {
244
+ vault?: Vault;
245
+ manifest: string;
246
+ pagingEnabled?: boolean;
39
247
  children: ReactNode;
248
+ startCanvas?: string;
249
+ rangeId?: string;
250
+ };
251
+ type SimpleViewerReducerState = {
252
+ sequence: number[][];
253
+ availableCanvases: Reference<'Canvas'>[];
254
+ visibleCanvases: Reference<'Canvas'>[];
255
+ currentCanvas: string | null;
256
+ isPaged: boolean;
257
+ rangeId: string | null;
258
+ };
259
+ interface SimpleViewerActions {
260
+ setCurrentCanvasId(newId: string): void;
261
+ setCurrentCanvasIndex(newId: number): void;
262
+ nextCanvas(): void;
263
+ previousCanvas(): void;
264
+ setCurrentRange(newId: string): void;
265
+ clearRange(): void;
266
+ setPagingEnabled(isEnabled: boolean): void;
267
+ }
268
+ type SimpleViewerActionsType = {
269
+ [T in keyof SimpleViewerActions]: {
270
+ type: T;
271
+ payload: Parameters<SimpleViewerActions[T]>[0];
272
+ };
273
+ }[keyof SimpleViewerActions];
274
+
275
+ type Polygons = ReturnType<typeof createHelper>;
276
+ type Point = [number, number] | [number, number, number, number, number, number];
277
+ type AnnotationRequest = {
278
+ annotationPopup?: React.ReactNode;
279
+ arguments?: Record<string, any>;
280
+ svgTheme?: Partial<SVGTheme>;
281
+ selectByDefault?: boolean;
282
+ bounds?: null | {
283
+ x: number;
284
+ y: number;
285
+ width: number;
286
+ height: number;
287
+ };
288
+ } & ({
289
+ type: 'polygon' | 'draw';
290
+ noBox?: boolean;
291
+ points?: Array<Point>;
292
+ open?: boolean;
293
+ selector?: undefined;
294
+ } | {
295
+ type: 'target';
296
+ selector: null | {
297
+ x: number;
298
+ y: number;
299
+ width: number;
300
+ height: number;
301
+ };
302
+ } | {
303
+ type: 'box';
304
+ selector?: null | {
305
+ x: number;
306
+ y: number;
307
+ width: number;
308
+ height: number;
309
+ };
310
+ });
311
+ type AnnotationRequestOptions = {
312
+ requestId: string;
313
+ canvasId?: string | null;
314
+ toolId?: keyof AtlasStore['switchTool'];
315
+ };
316
+ interface AtlasStore {
317
+ mode: ViewerMode;
318
+ tool: {
319
+ enabled: boolean;
320
+ requestId: string | null;
321
+ canvasId: string | null;
322
+ };
323
+ requestType: null | 'polygon' | 'target' | 'box' | 'draw';
324
+ metadata: Record<string, any>;
325
+ requests: Record<string, AnnotationRequest>;
326
+ switchTool: {
327
+ draw(): void;
328
+ pen(): void;
329
+ line(): void;
330
+ lineBox(): void;
331
+ box(): void;
332
+ triangle(): void;
333
+ hexagon(): void;
334
+ circle(): void;
335
+ remove(): void;
336
+ hand(): void;
337
+ pointer(): void;
338
+ };
339
+ history: {
340
+ canUndo: boolean;
341
+ canRedo: boolean;
342
+ undo(): void;
343
+ redo(): void;
344
+ };
345
+ stableViewport: null | {
346
+ x: number;
347
+ y: number;
348
+ width: number;
349
+ height: number;
350
+ zoom: number;
351
+ };
352
+ canvasRelativePositions: Record<string, {
353
+ x: number;
354
+ y: number;
355
+ width: number;
356
+ height: number;
357
+ }>;
358
+ canvasViewports: Record<string, {
359
+ x: number;
360
+ y: number;
361
+ width: number;
362
+ height: number;
363
+ zoom?: number;
364
+ }>;
365
+ validRequestIds: string[];
366
+ polygon: InputShape | null;
367
+ polygons: Polygons;
368
+ polygonState: SlowState;
369
+ setPolygonState: (state: SlowState | ((prev: SlowState) => SlowState)) => void;
370
+ setToolCanvasId: (canvasId: string) => void;
371
+ setMetadata(data: Record<string, any>, requestId?: string): void;
372
+ getRequestId(): {
373
+ requestId: string;
374
+ clear: () => void;
375
+ };
376
+ requestAnnotation(req: AnnotationRequest, options: AnnotationRequestOptions): Promise<AnnotationResponse | null>;
377
+ setAtlasRuntime(runtime: Runtime): void;
378
+ setCanvasRelativePosition(canvasId: string, position: {
379
+ x: number;
380
+ y: number;
381
+ width: number;
382
+ height: number;
383
+ }): void;
384
+ clearCanvasRelativePosition(canvasId: string): void;
385
+ clearAtlasRuntime(): void;
386
+ completeRequest(requestId?: string): void;
387
+ cancelRequest(requestId?: string): void;
388
+ reset(): void;
389
+ changeMode(mode: ViewerMode): void;
390
+ nudgeLeft(): void;
391
+ nudgeRight(): void;
392
+ nudgeUp(): void;
393
+ nudgeDown(): void;
394
+ zoomIn(): void;
395
+ zoomOut(): void;
396
+ goHome(): void;
397
+ }
398
+ declare function polygonToTarget(polygon: InputShape, on?: {
399
+ width: number;
400
+ height: number;
401
+ } | null): FragmentSelector | SvgSelector | null;
402
+ declare function requestToAnnotationResponse(request: AnnotationRequest): Omit<AnnotationResponse, 'id'>;
403
+ type AnnotationResponse = {
404
+ id: string;
405
+ canvasId?: string | null;
406
+ polygon: InputShape | null;
407
+ cancelled?: boolean;
408
+ requestType: 'draw' | 'polygon' | 'target' | 'box';
409
+ target: FragmentSelector | SvgSelector | null;
410
+ boundingBox: {
411
+ x: number;
412
+ y: number;
413
+ width: number;
414
+ height: number;
415
+ } | null;
416
+ metadata: Record<string, any>;
417
+ arguments: Record<string, any>;
418
+ };
419
+ type AtlasStoreEvents = {
420
+ 'atlas.canvas-click': {
421
+ canvasId: string;
422
+ target: {
423
+ x: number;
424
+ y: number;
425
+ };
426
+ worldTarget: {
427
+ x: number;
428
+ y: number;
429
+ };
430
+ };
431
+ 'atlas.viewport-change': {
432
+ x: number;
433
+ y: number;
434
+ width: number;
435
+ height: number;
436
+ zoom: number;
437
+ };
438
+ 'atlas.ready': {
439
+ runtime: Runtime;
440
+ };
441
+ 'atlas.annotation-completed': AnnotationResponse;
442
+ 'atlas.annotation-request': {
443
+ id: string;
444
+ };
445
+ 'atlas.request-cancelled': {
446
+ id: string;
447
+ };
448
+ 'atlas.polygon-render': {
449
+ state: RenderState;
450
+ slowState: SlowState;
451
+ dt: number;
452
+ };
453
+ 'atlas.polygon-update': {
454
+ id?: string;
455
+ points: Array<Point>;
456
+ open: boolean;
457
+ };
458
+ };
459
+ interface CreateAtlasStoreProps {
460
+ events: Emitter<AtlasStoreEvents>;
461
+ keyboardShortcutsEnabled?: boolean;
462
+ keyboardShortcutMapping?: Record<string, string>;
463
+ enabledTools?: Array<ValidTools>;
464
+ debug?: boolean;
465
+ }
466
+ declare function createAtlasStore({ events, enabledTools, keyboardShortcutMapping, keyboardShortcutsEnabled, debug, }: CreateAtlasStoreProps): zustand_vanilla.StoreApi<AtlasStore>;
467
+
468
+ declare const AtlasStoreReactContext: React$1.Context<StoreApi<AtlasStore> | null>;
469
+ declare function useAtlasStore(): StoreApi<AtlasStore>;
470
+ declare function getAtlasStoreByName(name?: string): AtlasStore;
471
+ declare function AtlasStoreProvider({ children, name, existing, atlasStoreConfig, }: {
472
+ name?: string;
473
+ children: React.ReactNode;
474
+ existing?: StoreApi<AtlasStore>;
475
+ atlasStoreConfig?: Partial<CreateAtlasStoreProps>;
40
476
  }): react_jsx_runtime.JSX.Element;
41
477
 
42
478
  declare const RenderAnnotation: FC<{
@@ -117,6 +553,19 @@ type AnnotationPageDescription = {
117
553
  pages: AnnotationPageNormalized[];
118
554
  };
119
555
 
556
+ interface AudioComponentProps {
557
+ media: SingleAudio;
558
+ startTime?: number | null;
559
+ children: ReactNode;
560
+ }
561
+ declare function AudioHTML({ media, startTime, children }: AudioComponentProps): react_jsx_runtime.JSX.Element;
562
+ declare function Audio({ media, mediaControlsDeps, audioCopmonent, children, }: {
563
+ media: SingleAudio;
564
+ mediaControlsDeps?: any[];
565
+ children: ReactNode;
566
+ audioCopmonent?: ComponentType<AudioComponentProps>;
567
+ }): null;
568
+
120
569
  type ImageServiceLoaderType = (imageService: any | undefined, { height, width }: {
121
570
  height: number;
122
571
  width: number;
@@ -129,15 +578,6 @@ declare function useLoadImageService(): readonly [ImageServiceLoaderType, Record
129
578
  real?: boolean | undefined;
130
579
  }>];
131
580
 
132
- type SingleImageStrategy = {
133
- type: 'images';
134
- image: ImageWithOptionalService;
135
- images: Array<ImageWithOptionalService>;
136
- choice?: ChoiceDescription;
137
- annotations?: AnnotationPageDescription;
138
- };
139
- declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): SingleImageStrategy | UnknownStrategy;
140
-
141
581
  type Single3DModelStrategy = {
142
582
  type: '3d-model';
143
583
  model: ExternalWebResource;
@@ -207,6 +647,15 @@ type UnknownStrategy = {
207
647
  };
208
648
  type RenderingStrategy = SingleImageStrategy | MediaStrategy | ComplexTimelineStrategy | Single3DModelStrategy | TextualContentStrategy | UnknownStrategy | EmptyStrategy;
209
649
 
650
+ type SingleImageStrategy = {
651
+ type: 'images';
652
+ image: ImageWithOptionalService;
653
+ images: Array<ImageWithOptionalService>;
654
+ choice?: ChoiceDescription;
655
+ annotations?: AnnotationPageDescription;
656
+ };
657
+ declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): SingleImageStrategy | UnknownStrategy;
658
+
210
659
  type StrategyActions = {
211
660
  makeChoice: (id: string, options?: {
212
661
  deselectOthers?: boolean;
@@ -237,19 +686,6 @@ type UseRenderingStrategyOptions = {
237
686
  };
238
687
  declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
239
688
 
240
- interface AudioComponentProps {
241
- media: SingleAudio;
242
- startTime?: number | null;
243
- children: ReactNode;
244
- }
245
- declare function AudioHTML({ media, startTime, children }: AudioComponentProps): react_jsx_runtime.JSX.Element;
246
- declare function Audio({ media, mediaControlsDeps, audioCopmonent, children, }: {
247
- media: SingleAudio;
248
- mediaControlsDeps?: any[];
249
- children: ReactNode;
250
- audioCopmonent?: ComponentType<AudioComponentProps>;
251
- }): null;
252
-
253
689
  interface VideoComponentProps {
254
690
  element: RefObject<HTMLVideoElement>;
255
691
  media: SingleVideo;
@@ -295,13 +731,21 @@ type CanvasProps = {
295
731
  enableYouTube?: boolean;
296
732
  ignoreSize?: boolean;
297
733
  throwOnUnknown?: boolean;
734
+ renderContextMenu?: (options: RenderContextProps) => ReactNode;
298
735
  onClickPaintingAnnotation?: (id: string, image: ImageWithOptionalService, e: any) => void;
299
736
  components?: {
300
737
  Video?: React__default.ComponentType<VideoComponentProps>;
301
738
  Audio?: React__default.ComponentType<AudioComponentProps>;
302
739
  };
740
+ annotationPopup?: React__default.ReactNode;
741
+ svgTheme?: Partial<SVGTheme>;
742
+ renderAnnotationContextMenu?: (options: RenderContextProps) => React__default.ReactNode;
303
743
  };
304
- declare function RenderCanvas({ x, y, onChoiceChange, registerActions, defaultChoices, isStatic, renderViewerControls, renderMediaControls, renderComplexTimelineControls, complexTimelineControlsDeps, viewControlsDeps, mediaControlsDeps, strategies, throwOnUnknown, backgroundStyle, alwaysShowBackground, keepCanvasScale, enableSizes, enableYouTube, onClickPaintingAnnotation, components, children, }: CanvasProps): react_jsx_runtime.JSX.Element;
744
+ declare function RenderCanvas({ x, y, onChoiceChange, registerActions, defaultChoices, isStatic, renderViewerControls, renderMediaControls, renderComplexTimelineControls, complexTimelineControlsDeps, viewControlsDeps, mediaControlsDeps, strategies, throwOnUnknown, backgroundStyle, alwaysShowBackground, keepCanvasScale, enableSizes, enableYouTube, onClickPaintingAnnotation, components, children, annotationPopup, svgTheme, renderContextMenu, renderAnnotationContextMenu, }: CanvasProps): react_jsx_runtime.JSX.Element;
745
+
746
+ declare function CanvasBackground({ style }: {
747
+ style?: BoxStyle;
748
+ }): react_jsx_runtime.JSX.Element | null;
305
749
 
306
750
  declare function RenderImage({ id, image, thumbnail, isStatic, x, y, children, selector, onClick, enableSizes, }: {
307
751
  id: string;
@@ -316,54 +760,6 @@ declare function RenderImage({ id, image, thumbnail, isStatic, x, y, children, s
316
760
  onClick?: (e: any) => void;
317
761
  }): react_jsx_runtime.JSX.Element;
318
762
 
319
- declare function CanvasBackground({ style }: {
320
- style?: BoxStyle;
321
- }): react_jsx_runtime.JSX.Element | null;
322
-
323
- type SimpleViewerContext = {
324
- items: Reference<'Canvas'>[];
325
- sequence: number[][];
326
- hasNext: boolean;
327
- hasPrevious: boolean;
328
- setSequenceIndex: (newId: number) => void;
329
- setCurrentCanvasId: (newId: string) => void;
330
- setCurrentCanvasIndex: (newId: number) => void;
331
- currentSequenceIndex: number;
332
- nextCanvas: () => void;
333
- previousCanvas: () => void;
334
- };
335
- type SimpleViewerProps = {
336
- vault?: Vault;
337
- manifest: string;
338
- pagingEnabled?: boolean;
339
- children: ReactNode;
340
- startCanvas?: string;
341
- rangeId?: string;
342
- };
343
- type SimpleViewerReducerState = {
344
- sequence: number[][];
345
- availableCanvases: Reference<'Canvas'>[];
346
- visibleCanvases: Reference<'Canvas'>[];
347
- currentCanvas: string | null;
348
- isPaged: boolean;
349
- rangeId: string | null;
350
- };
351
- interface SimpleViewerActions {
352
- setCurrentCanvasId(newId: string): void;
353
- setCurrentCanvasIndex(newId: number): void;
354
- nextCanvas(): void;
355
- previousCanvas(): void;
356
- setCurrentRange(newId: string): void;
357
- clearRange(): void;
358
- setPagingEnabled(isEnabled: boolean): void;
359
- }
360
- type SimpleViewerActionsType = {
361
- [T in keyof SimpleViewerActions]: {
362
- type: T;
363
- payload: Parameters<SimpleViewerActions[T]>[0];
364
- };
365
- }[keyof SimpleViewerActions];
366
-
367
763
  declare function ModelHTML({ model }: {
368
764
  model: any;
369
765
  }): react_jsx_runtime.JSX.Element;
@@ -377,6 +773,23 @@ interface PlaceholderCanvasProps {
377
773
  }
378
774
  declare function PlaceholderCanvas(props: PlaceholderCanvasProps): react_jsx_runtime.JSX.Element | null;
379
775
 
776
+ type ViewerProps = AtlasProps & {
777
+ name?: string;
778
+ height?: number | string;
779
+ width?: number | string;
780
+ resizeHash?: number;
781
+ containerProps?: any;
782
+ outerContainerProps?: any;
783
+ aspectRatio?: number;
784
+ errorFallback?: any;
785
+ renderPreset?: Preset;
786
+ worldScale?: number;
787
+ updateViewportTimeout?: number;
788
+ } & {
789
+ children: ReactNode;
790
+ };
791
+ declare function Viewer(props: ViewerProps): react_jsx_runtime.JSX.Element;
792
+
380
793
  interface CanvasPanelProps {
381
794
  manifest: string;
382
795
  startCanvas?: string;
@@ -388,6 +801,7 @@ interface CanvasPanelProps {
388
801
  reuseAtlas?: boolean;
389
802
  runtimeOptions?: any;
390
803
  renderPreset?: any;
804
+ name?: string;
391
805
  height?: number;
392
806
  spacing?: number;
393
807
  components?: {
@@ -397,6 +811,12 @@ interface CanvasPanelProps {
397
811
  };
398
812
  canvasProps?: Omit<Partial<CanvasProps>, 'x'>;
399
813
  annotations?: ReactNode;
814
+ annotationPopup?: ReactNode;
815
+ svgTheme?: SVGTheme;
816
+ updateViewportTimeout?: number;
817
+ renderContextMenu?: (options: RenderContextProps) => ReactNode;
818
+ keepCanvasScale?: boolean;
819
+ renderAnnotationContextMenu?: (options: RenderContextProps) => ReactNode;
400
820
  }
401
821
  type CanvasPanelType = ForwardRefExoticComponent<CanvasPanelProps & RefAttributes<SimpleViewerContext>> & {
402
822
  RenderImage: typeof RenderImage;
@@ -412,9 +832,17 @@ type CanvasPanelType = ForwardRefExoticComponent<CanvasPanelProps & RefAttribute
412
832
  VideoHTML: typeof VideoHTML;
413
833
  ModelHTML: typeof ModelHTML;
414
834
  PlaceholderCanvas: typeof PlaceholderCanvas;
835
+ getAtlasStoreByName: typeof getAtlasStoreByName;
415
836
  };
416
837
  declare const CanvasPanel: CanvasPanelType;
417
838
 
839
+ declare function RenderAnnotationEditing({ theme, renderContextMenu, children, }: {
840
+ theme?: Partial<SVGTheme>;
841
+ renderContextMenu?: (options: RenderContextProps) => React.ReactNode;
842
+ children?: React.ReactNode;
843
+ }): react_jsx_runtime.JSX.Element | null;
844
+ declare function DefaultEditingTools(): react_jsx_runtime.JSX.Element | null;
845
+
418
846
  interface CanvasStrategyProviderProps {
419
847
  onChoiceChange?: (choice?: ChoiceDescription) => void;
420
848
  strategies?: Array<RenderingStrategy['type']>;
@@ -439,27 +867,36 @@ interface CanvasWorldObjectProps {
439
867
  y?: number;
440
868
  keepCanvasScale?: boolean;
441
869
  children?: ReactNode;
870
+ renderContextMenu?: (options: RenderContextProps) => ReactNode;
442
871
  }
443
- declare function CanvasWorldObject({ x, y, keepCanvasScale, children }: CanvasWorldObjectProps): react_jsx_runtime.JSX.Element | null;
872
+ declare function CanvasWorldObject({ x, y, keepCanvasScale, renderContextMenu, children, }: CanvasWorldObjectProps): react_jsx_runtime.JSX.Element | null;
444
873
 
445
874
  declare function ThumbnailFallbackImage({ x, y }: {
446
875
  x?: number;
447
876
  y?: number;
448
877
  }): react_jsx_runtime.JSX.Element | null;
449
878
 
450
- interface RenderEmptyStrategyProps {
451
- backgroundStyle?: BoxStyle;
452
- alwaysShowBackground?: boolean;
879
+ declare function Render3DModelStrategy(): react_jsx_runtime.JSX.Element | null;
880
+
881
+ declare function RenderAccompanyingCanvas(): react_jsx_runtime.JSX.Element;
882
+
883
+ interface AnnotationStrategyProps {
884
+ children?: ReactNode;
453
885
  }
454
- declare function RenderEmptyStrategy({ backgroundStyle, alwaysShowBackground }: RenderEmptyStrategyProps): react_jsx_runtime.JSX.Element | null;
886
+ declare function RenderAnnotationStrategy({ children }: AnnotationStrategyProps): react_jsx_runtime.JSX.Element | null;
887
+
888
+ interface RenderAudioStrategyProps {
889
+ as?: React.ComponentType<AudioComponentProps>;
890
+ }
891
+ declare function RenderAudioStrategy({ as: CustomAudio }: RenderAudioStrategyProps): react_jsx_runtime.JSX.Element | null;
455
892
 
456
893
  declare function RenderComplexTimelineStrategy(): react_jsx_runtime.JSX.Element | null;
457
894
 
458
- interface TextualContextStrategyProps {
459
- onClickPaintingAnnotation?: (id: string, e: any) => void;
460
- children?: ReactNode;
895
+ interface RenderEmptyStrategyProps {
896
+ backgroundStyle?: BoxStyle;
897
+ alwaysShowBackground?: boolean;
461
898
  }
462
- declare function RenderTextualContentStrategy({ onClickPaintingAnnotation, children }: TextualContextStrategyProps): react_jsx_runtime.JSX.Element | null;
899
+ declare function RenderEmptyStrategy({ backgroundStyle, alwaysShowBackground }: RenderEmptyStrategyProps): react_jsx_runtime.JSX.Element | null;
463
900
 
464
901
  interface ImageStrategyProps {
465
902
  isStatic?: boolean;
@@ -469,19 +906,11 @@ interface ImageStrategyProps {
469
906
  }
470
907
  declare function RenderImageStrategy({ isStatic, enableSizes, onClickPaintingAnnotation, children, }: ImageStrategyProps): react_jsx_runtime.JSX.Element | null;
471
908
 
472
- declare function Render3DModelStrategy(): react_jsx_runtime.JSX.Element | null;
473
-
474
- interface AnnotationStrategyProps {
909
+ interface TextualContextStrategyProps {
910
+ onClickPaintingAnnotation?: (id: string, e: any) => void;
475
911
  children?: ReactNode;
476
912
  }
477
- declare function RenderAnnotationStrategy({ children }: AnnotationStrategyProps): react_jsx_runtime.JSX.Element | null;
478
-
479
- interface RenderAudioStrategyProps {
480
- as?: React.ComponentType<AudioComponentProps>;
481
- }
482
- declare function RenderAudioStrategy({ as: CustomAudio, }: RenderAudioStrategyProps): react_jsx_runtime.JSX.Element | null;
483
-
484
- declare function RenderAccompanyingCanvas(): react_jsx_runtime.JSX.Element;
913
+ declare function RenderTextualContentStrategy({ onClickPaintingAnnotation, children }: TextualContextStrategyProps): react_jsx_runtime.JSX.Element | null;
485
914
 
486
915
  interface RenderVideoStrategyProps {
487
916
  as?: React__default.ComponentType<VideoComponentProps>;
@@ -490,6 +919,74 @@ declare function RenderVideoStrategy({ as: CustomVideo, }: RenderVideoStrategyPr
490
919
 
491
920
  declare function RenderYouTubeStrategy(): react_jsx_runtime.JSX.Element | null;
492
921
 
922
+ declare const svgThemes: ({
923
+ name: string;
924
+ outer: {
925
+ borderWidth: number;
926
+ borderColor: string;
927
+ };
928
+ inner: {
929
+ borderWidth: number;
930
+ borderColor: string;
931
+ };
932
+ } | {
933
+ name: string;
934
+ outer: {
935
+ borderWidth: string;
936
+ borderColor: string;
937
+ };
938
+ inner: {
939
+ borderWidth: string;
940
+ borderColor: string;
941
+ };
942
+ } | {
943
+ name: string;
944
+ outer: {
945
+ borderWidth: string;
946
+ borderColor: string;
947
+ };
948
+ inner: {
949
+ borderWidth?: undefined;
950
+ borderColor?: undefined;
951
+ };
952
+ })[];
953
+ type HelperType = ReturnType<typeof useSvgEditor>['helper'];
954
+ type StateType = ReturnType<typeof useSvgEditor>['state'];
955
+ type SvgTheme = {
956
+ name?: string;
957
+ outer: BoxStyle;
958
+ inner: BoxStyle;
959
+ };
960
+ interface CreateCustomShapeProps {
961
+ image: {
962
+ width: number;
963
+ height: number;
964
+ };
965
+ shape?: any;
966
+ updateShape: any;
967
+ theme?: {
968
+ name?: string;
969
+ outer: BoxStyle;
970
+ inner: BoxStyle;
971
+ };
972
+ controlsHtmlId?: string;
973
+ renderControls?: (helper: HelperType, state: StateType, showShapes: boolean) => any;
974
+ }
975
+ declare function CreateCustomShape(props: CreateCustomShapeProps): null;
976
+
977
+ interface PolygonSelectorProps {
978
+ id: string;
979
+ polygon: InputShape;
980
+ annotationBucket?: string;
981
+ isHighlighted?: boolean;
982
+ updatePolygon?: (shape: InputShape) => void;
983
+ readOnly?: boolean;
984
+ theme?: SvgTheme;
985
+ controlsHtmlId?: string;
986
+ renderControls?: CreateCustomShapeProps['renderControls'];
987
+ }
988
+ declare function PolygonSelector(props: PolygonSelectorProps): react_jsx_runtime.JSX.Element | null;
989
+
493
990
  declare const CanvasAnnotations: React$1.ForwardRefExoticComponent<{
494
991
  canvasId?: string | undefined;
495
992
  } & React$1.RefAttributes<{
@@ -556,6 +1053,21 @@ interface ImageProps {
556
1053
  }
557
1054
  declare function Image(props: ImageProps): react_jsx_runtime.JSX.Element | null;
558
1055
 
1056
+ interface ImageServiceProps {
1057
+ src: string;
1058
+ atlas?: AtlasProps;
1059
+ errorFallback?: React__default.FC;
1060
+ interactive?: boolean;
1061
+ skipSizes?: boolean;
1062
+ renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
1063
+ viewControlsDeps?: any[];
1064
+ fluid?: boolean;
1065
+ x?: number;
1066
+ y?: number;
1067
+ children?: React__default.ReactNode;
1068
+ }
1069
+ declare function ImageService({ src, errorFallback, interactive, skipSizes, children, renderViewerControls, viewControlsDeps, fluid, x, y, ...atlasProps }: ImageServiceProps & Omit<AtlasProps, 'children'>): react_jsx_runtime.JSX.Element | null;
1070
+
559
1071
  type ManifestMetadataProps = Omit<MetadataProps, 'metadata'>;
560
1072
  declare function ManifestMetadata(props: ManifestMetadataProps): react_jsx_runtime.JSX.Element;
561
1073
 
@@ -602,96 +1114,24 @@ interface SingleCanvasThumbnailProps {
602
1114
  figure?: string;
603
1115
  img?: string;
604
1116
  label?: string;
605
- imageWrapper?: string;
606
- };
607
- placeholder?: React.ReactNode;
608
- fallback?: React.ReactNode;
609
- }
610
- declare function SingleCanvasThumbnail(props: SingleCanvasThumbnailProps): react_jsx_runtime.JSX.Element;
611
-
612
- interface SvgEditorOptions {
613
- image: {
614
- height: number;
615
- width: number;
616
- };
617
- currentShape: InputShape | null;
618
- onChange: (e: InputShape) => void;
619
- hideShapeLines?: boolean;
620
- }
621
- declare function useSvgEditor(options: SvgEditorOptions, deps: any[]): {
622
- helper: {
623
- draw: {
624
- enable(): void;
625
- disable(): void;
626
- toggle(): void;
627
- };
628
- state: RenderState;
629
- modifiers: {
630
- reset(): void;
631
- getForType(type: string | null): Record<string, string>;
632
- set(modifier: string): void;
633
- unset(modifier: string): void;
634
- };
635
- stamps: {
636
- set(selectedStamp: InputShape | null): void;
637
- clear(): void;
638
- square(): void;
639
- triangle(): void;
640
- pentagon(): void;
641
- hexagon(): void;
642
- };
643
- key: {
644
- down(key: string): true | undefined;
645
- up(key: string): void;
646
- };
647
- setScale: (scale: number) => void;
648
- clock: {
649
- set: (renderFunc: polygon_editor.RenderFunc) => void;
650
- start: (renderFunc?: polygon_editor.RenderFunc | undefined, setStateFunc?: polygon_editor.SetState | undefined) => void;
651
- stop: () => void;
652
- step: (deltaTime?: number | undefined) => void;
653
- };
654
- pointer: (pointers: ([number, number] | [number, number, number, number, number, number])[]) => void;
655
- blur: () => void;
656
- pointerDown: () => void;
657
- pointerUp: () => void;
658
- setShape: (shape: InputShape | null) => void;
659
- modes: {
660
- toggleLineBoxMode: () => void;
661
- toggleLineMode: () => void;
662
- enableLineMode(): void;
663
- disableLineMode(): void;
664
- enableLineBoxMode(): void;
665
- disableLineBoxMode(): void;
666
- };
667
- label: (type: string | null) => string;
1117
+ imageWrapper?: string;
668
1118
  };
669
- state: SlowState;
670
- isAddingPoint: boolean;
671
- isSplitting: boolean;
672
- isStamping: boolean | null;
673
- isHoveringPoint: boolean;
674
- transitionDirection: string | null;
675
- transitionRotate: boolean;
676
- defs: react_jsx_runtime.JSX.Element;
677
- editor: react_jsx_runtime.JSX.Element | null;
678
- };
1119
+ placeholder?: React.ReactNode;
1120
+ fallback?: React.ReactNode;
1121
+ }
1122
+ declare function SingleCanvasThumbnail(props: SingleCanvasThumbnailProps): react_jsx_runtime.JSX.Element;
679
1123
 
680
- type HelperType$1 = ReturnType<typeof useSvgEditor>['helper'];
681
- type StateType$1 = ReturnType<typeof useSvgEditor>['state'];
682
1124
  interface RenderSvgEditorControlsProps {
683
- helper: HelperType$1;
684
- state: StateType$1;
685
- showShapes: boolean;
1125
+ showShapes?: boolean;
686
1126
  classNames?: Partial<{
687
1127
  button: string;
688
1128
  }>;
689
1129
  enabled?: {
690
1130
  draw?: boolean;
691
- polygon?: boolean;
1131
+ pen?: boolean;
692
1132
  line?: boolean;
693
1133
  lineBox?: boolean;
694
- square?: boolean;
1134
+ box?: boolean;
695
1135
  triangle?: boolean;
696
1136
  hexagon?: boolean;
697
1137
  circle?: boolean;
@@ -699,101 +1139,20 @@ interface RenderSvgEditorControlsProps {
699
1139
  };
700
1140
  icons?: Partial<{
701
1141
  DrawIcon: ReactNode;
702
- PolygonIcon: ReactNode;
1142
+ PenIcon: ReactNode;
703
1143
  LineIcon: ReactNode;
704
1144
  LineBoxIcon: ReactNode;
705
1145
  ShapesIcon: ReactNode;
706
- SquareIcon: ReactNode;
1146
+ BoxIcon: ReactNode;
707
1147
  TriangleIcon: ReactNode;
708
1148
  HexagonIcon: ReactNode;
709
1149
  CircleIcon: ReactNode;
710
1150
  DeleteForeverIcon: ReactNode;
1151
+ PointerIcon: ReactNode;
1152
+ HandIcon: ReactNode;
711
1153
  }>;
712
1154
  }
713
- declare function RenderSvgEditorControls({ helper, showShapes, state, enabled, classNames, icons, }: RenderSvgEditorControlsProps): react_jsx_runtime.JSX.Element;
714
-
715
- declare const svgThemes: ({
716
- name: string;
717
- outer: {
718
- borderWidth: number;
719
- borderColor: string;
720
- };
721
- inner: {
722
- borderWidth: number;
723
- borderColor: string;
724
- };
725
- } | {
726
- name: string;
727
- outer: {
728
- borderWidth: string;
729
- borderColor: string;
730
- };
731
- inner: {
732
- borderWidth: string;
733
- borderColor: string;
734
- };
735
- } | {
736
- name: string;
737
- outer: {
738
- borderWidth: string;
739
- borderColor: string;
740
- };
741
- inner: {
742
- borderWidth?: undefined;
743
- borderColor?: undefined;
744
- };
745
- })[];
746
- type HelperType = ReturnType<typeof useSvgEditor>['helper'];
747
- type StateType = ReturnType<typeof useSvgEditor>['state'];
748
- type SvgTheme = {
749
- name?: string;
750
- outer: BoxStyle;
751
- inner: BoxStyle;
752
- };
753
- interface CreateCustomShapeProps {
754
- image: {
755
- width: number;
756
- height: number;
757
- };
758
- shape?: any;
759
- updateShape: any;
760
- theme?: {
761
- name?: string;
762
- outer: BoxStyle;
763
- inner: BoxStyle;
764
- };
765
- controlsHtmlId?: string;
766
- renderControls?: (helper: HelperType, state: StateType, showShapes: boolean) => any;
767
- }
768
- declare function CreateCustomShape(props: CreateCustomShapeProps): react_jsx_runtime.JSX.Element;
769
-
770
- interface PolygonSelectorProps {
771
- id: string;
772
- polygon: InputShape;
773
- annotationBucket?: string;
774
- isHighlighted?: boolean;
775
- updatePolygon?: (shape: InputShape) => void;
776
- readOnly?: boolean;
777
- theme?: SvgTheme;
778
- controlsHtmlId?: string;
779
- renderControls?: CreateCustomShapeProps['renderControls'];
780
- }
781
- declare function PolygonSelector(props: PolygonSelectorProps): react_jsx_runtime.JSX.Element | null;
782
-
783
- interface ImageServiceProps {
784
- src: string;
785
- atlas?: AtlasProps;
786
- errorFallback?: React__default.FC;
787
- interactive?: boolean;
788
- skipSizes?: boolean;
789
- renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
790
- viewControlsDeps?: any[];
791
- fluid?: boolean;
792
- x?: number;
793
- y?: number;
794
- children?: React__default.ReactNode;
795
- }
796
- declare function ImageService({ src, errorFallback, interactive, skipSizes, children, renderViewerControls, viewControlsDeps, fluid, x, y, ...atlasProps }: ImageServiceProps & Omit<AtlasProps, 'children'>): react_jsx_runtime.JSX.Element | null;
1155
+ declare function RenderSvgEditorControls({ showShapes, enabled, classNames, icons, }: RenderSvgEditorControlsProps): react_jsx_runtime.JSX.Element;
797
1156
 
798
1157
  declare function AnnotationContext({ annotation, children }: {
799
1158
  annotation: string;
@@ -805,6 +1164,37 @@ declare function AnnotationPageContext({ annotationPage, children }: {
805
1164
  children: ReactNode;
806
1165
  }): react_jsx_runtime.JSX.Element;
807
1166
 
1167
+ interface AnnotationStyles {
1168
+ id: number;
1169
+ name: string;
1170
+ creator?: {
1171
+ id: number;
1172
+ name: string;
1173
+ };
1174
+ createdAt: Date;
1175
+ theme: {
1176
+ default: AnnotationThemeDefinition;
1177
+ hidden: AnnotationThemeDefinition;
1178
+ highlighted: AnnotationThemeDefinition;
1179
+ } & Record<string, AnnotationThemeDefinition>;
1180
+ }
1181
+ type AnnotationThemeDefinition = BoxStyle & {
1182
+ hidden?: boolean;
1183
+ interactive?: boolean;
1184
+ hotspot?: boolean;
1185
+ hotspotSize?: 'lg' | 'md' | 'sm';
1186
+ };
1187
+ declare function getDefaultAnnotationStyles(): AnnotationStyles['theme'];
1188
+ declare function useAnnotationStyles(): {
1189
+ default: AnnotationThemeDefinition;
1190
+ hidden: AnnotationThemeDefinition;
1191
+ highlighted: AnnotationThemeDefinition;
1192
+ } & Record<string, AnnotationThemeDefinition>;
1193
+ declare function AnnotationStyleProvider({ theme, children, }: {
1194
+ theme?: AnnotationStyles['theme'];
1195
+ children: React.ReactNode;
1196
+ }): react_jsx_runtime.JSX.Element;
1197
+
808
1198
  declare function hasAuth(resource: any): boolean;
809
1199
  interface ProbeStore {
810
1200
  service?: AuthProbeService2;
@@ -880,14 +1270,14 @@ interface AuthState {
880
1270
  expires: number;
881
1271
  };
882
1272
  }
883
- declare const AuthRContext: React$1.Context<StoreApi<AuthContextState & AuthContextCurrentActions & AuthContextActions> | null>;
1273
+ declare const AuthRContext: React$1.Context<StoreApi$1<AuthContextState & AuthContextCurrentActions & AuthContextActions> | null>;
884
1274
  declare const AuthReactContext: React$1.Context<(AuthContextState & AuthContextCurrentActions) | null>;
885
1275
  declare const AuthReactContextActions: React$1.Context<AuthContextActions | null>;
886
1276
  declare function AuthProvider({ children }: {
887
1277
  children: ReactNode;
888
1278
  }): react_jsx_runtime.JSX.Element;
889
1279
  declare function useIsAuthEnabled(): boolean;
890
- declare function useAuthStore(): StoreApi<AuthContextState & AuthContextCurrentActions & AuthContextActions>;
1280
+ declare function useAuthStore(): StoreApi$1<AuthContextState & AuthContextCurrentActions & AuthContextActions>;
891
1281
  declare function useAuthActions(): {
892
1282
  login: () => void;
893
1283
  logout: () => void;
@@ -990,74 +1380,16 @@ interface ComplexTimelineStore extends MediaPlayerActions {
990
1380
 
991
1381
  declare function ComplexTimelineProvider({ children, store, }: {
992
1382
  children: React.ReactNode;
993
- store: StoreApi$1<ComplexTimelineStore>;
1383
+ store: StoreApi<ComplexTimelineStore>;
994
1384
  }): react_jsx_runtime.JSX.Element;
995
1385
  declare function useComplexTimeline<T>(selector: (store: ComplexTimelineStore) => T): T;
996
1386
 
997
- interface EventContext {
998
- emitter: Emitter<any>;
1387
+ interface StrategyContext {
1388
+ strategy: RenderingStrategy;
1389
+ choices: ChoiceDescription | null;
999
1390
  }
1000
- declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
1001
- declare const ReactEventContext: React__default.Context<{
1002
- emitter: Emitter<Record<EventType, unknown>>;
1003
- }>;
1004
- declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
1005
- declare function EventsProvider({ emitter, children }: EventContext & {
1006
- children: React__default.ReactNode;
1007
- }): react_jsx_runtime.JSX.Element;
1008
-
1009
- declare function ManifestContext({ manifest, children }: {
1010
- manifest: string;
1011
- children: ReactNode;
1012
- }): react_jsx_runtime.JSX.Element;
1013
-
1014
- declare function useMediaState(): MediaPlayerState;
1015
- declare function useMediaActions(): MediaPlayerActions;
1016
- declare function useMediaElements(): {
1017
- element: RefObject<HTMLAudioElement | HTMLVideoElement>;
1018
- currentTime: RefObject<HTMLDivElement>;
1019
- progress: RefObject<HTMLDivElement>;
1020
- };
1021
- declare function MediaPlayerProvider({ actions, state, children, currentTime, progress, element, }: {
1022
- actions: MediaPlayerActions;
1023
- state: MediaPlayerState;
1024
- children: ReactNode;
1025
- currentTime: RefObject<HTMLDivElement>;
1026
- progress: RefObject<HTMLDivElement>;
1027
- element: RefObject<HTMLAudioElement | HTMLVideoElement>;
1028
- }): react_jsx_runtime.JSX.Element;
1029
-
1030
- declare function RangeContext({ range, children }: {
1031
- range: string;
1032
- children: ReactNode;
1033
- }): react_jsx_runtime.JSX.Element;
1034
-
1035
- type ResourceContextType = {
1036
- collection?: string;
1037
- manifest?: string;
1038
- range?: string;
1039
- canvas?: string;
1040
- annotation?: string;
1041
- annotationPage?: string;
1042
- };
1043
- declare const ResourceReactContext: React__default.Context<ResourceContextType>;
1044
- declare const useResourceContext: () => ResourceContextType;
1045
- declare function ResourceProvider({ value, children }: {
1046
- value: ResourceContextType;
1047
- children: ReactNode;
1048
- }): react_jsx_runtime.JSX.Element;
1049
-
1050
- declare const ReactVaultContext: React__default.Context<{
1051
- vault: Vault | null;
1052
- setVaultInstance: (vault: Vault) => void;
1053
- }>;
1054
- declare function VaultProvider({ vault, vaultOptions, useGlobal, resources, children, }: {
1055
- vault?: Vault;
1056
- useGlobal?: boolean;
1057
- vaultOptions?: VaultOptions;
1058
- resources?: ResourceContextType;
1059
- children: ReactNode;
1060
- }): react_jsx_runtime.JSX.Element;
1391
+ declare const StrategyReactContext: React$1.Context<StrategyContext | null>;
1392
+ declare function useStrategy(): StrategyContext;
1061
1393
 
1062
1394
  type SearchService = SearchService$1 & {
1063
1395
  service: SearchServiceAutocomplete | SearchServiceAutocomplete[];
@@ -1080,6 +1412,21 @@ interface Search1Store {
1080
1412
  nextResult: () => void;
1081
1413
  }
1082
1414
 
1415
+ type ResourceContextType = {
1416
+ collection?: string;
1417
+ manifest?: string;
1418
+ range?: string;
1419
+ canvas?: string;
1420
+ annotation?: string;
1421
+ annotationPage?: string;
1422
+ };
1423
+ declare const ResourceReactContext: React__default.Context<ResourceContextType>;
1424
+ declare const useResourceContext: () => ResourceContextType;
1425
+ declare function ResourceProvider({ value, children }: {
1426
+ value: ResourceContextType;
1427
+ children: ReactNode;
1428
+ }): react_jsx_runtime.JSX.Element;
1429
+
1083
1430
  declare function useCustomContextBridge(): Record<string, {
1084
1431
  value: any;
1085
1432
  Provider: React__default.Provider<any>;
@@ -1089,39 +1436,85 @@ declare function CustomContextBridge(props: Record<string, {
1089
1436
  Provider: React__default.Provider<any>;
1090
1437
  }> & {
1091
1438
  children: React__default.ReactNode;
1092
- }): ReactNode;
1439
+ }): React__default.ReactNode;
1093
1440
  declare function CustomContextBridgeProvider(props: {
1094
1441
  providers: Record<string, Context<any>>;
1095
1442
  children: React__default.ReactNode;
1096
1443
  }): react_jsx_runtime.JSX.Element;
1097
- declare function useContextBridge(): {
1098
- VaultContext: {
1099
- vault: _iiif_helpers.Vault | null;
1100
- setVaultInstance: (vault: _iiif_helpers.Vault) => void;
1101
- };
1102
- ResourceContext: ResourceContextType;
1103
- SimpleViewerReactContext: SimpleViewerContext;
1104
- VisibleCanvasReactContext: string[];
1105
- AuthRContext: zustand.StoreApi<AuthContextState & AuthContextCurrentActions & AuthContextActions> | null;
1106
- SearchReactContext: zustand.StoreApi<Search1Store> | null;
1107
- ReactEventContext: {
1108
- emitter: mitt.Emitter<Record<mitt.EventType, unknown>>;
1109
- };
1444
+ declare function useContextBridge(): {
1445
+ VaultContext: {
1446
+ vault: _iiif_helpers.Vault | null;
1447
+ setVaultInstance: (vault: _iiif_helpers.Vault) => void;
1448
+ };
1449
+ ResourceContext: ResourceContextType;
1450
+ SimpleViewerReactContext: SimpleViewerContext;
1451
+ VisibleCanvasReactContext: string[];
1452
+ AuthRContext: zustand.StoreApi<AuthContextState & AuthContextCurrentActions & AuthContextActions> | null;
1453
+ SearchReactContext: zustand.StoreApi<Search1Store> | null;
1454
+ ReactEventContext: {
1455
+ emitter: mitt.Emitter<Record<mitt.EventType, unknown>>;
1456
+ };
1457
+ ContextBridgeReactContext: Record<string, React__default.Context<any>>;
1458
+ StrategyReactContext: StrategyContext | null;
1459
+ AtlasStoreReactContext: zustand.StoreApi<AtlasStore> | null;
1460
+ };
1461
+ declare function ContextBridge(props: {
1462
+ bridge: ReturnType<typeof useContextBridge>;
1463
+ custom?: ReturnType<typeof useCustomContextBridge>;
1464
+ children: ReactNode;
1465
+ }): react_jsx_runtime.JSX.Element;
1466
+
1467
+ interface ControlsContext {
1468
+ renderMediaControls?: (strategy: MediaStrategy) => ReactNode;
1469
+ viewControlsDeps: any[];
1470
+ renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
1471
+ mediaControlsDeps: any[];
1472
+ renderComplexTimelineControls?: (strategy: ComplexTimelineStrategy) => ReactNode;
1473
+ complexTimelineControlsDeps: any[];
1474
+ }
1475
+ declare const ControlsReactContext: React$1.Context<ControlsContext | null>;
1476
+ declare function useRenderControls(): ControlsContext;
1477
+
1478
+ interface EventContext {
1479
+ emitter: Emitter<any>;
1480
+ }
1481
+ declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
1482
+ declare const ReactEventContext: React__default.Context<{
1483
+ emitter: Emitter<Record<EventType, unknown>>;
1484
+ }>;
1485
+ declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
1486
+ declare function EventsProvider({ emitter, children }: EventContext & {
1487
+ children: React__default.ReactNode;
1488
+ }): react_jsx_runtime.JSX.Element;
1489
+
1490
+ declare const ImageServiceLoaderContext: React__default.Context<ImageServiceLoader>;
1491
+ declare function useImageServiceLoader(): ImageServiceLoader;
1492
+
1493
+ declare function ManifestContext({ manifest, children }: {
1494
+ manifest: string;
1495
+ children: ReactNode;
1496
+ }): react_jsx_runtime.JSX.Element;
1497
+
1498
+ declare function useMediaState(): MediaPlayerState;
1499
+ declare function useMediaActions(): MediaPlayerActions;
1500
+ declare function useMediaElements(): {
1501
+ element: RefObject<HTMLAudioElement | HTMLVideoElement>;
1502
+ currentTime: RefObject<HTMLDivElement>;
1503
+ progress: RefObject<HTMLDivElement>;
1110
1504
  };
1111
- declare function ContextBridge(props: {
1112
- bridge: ReturnType<typeof useContextBridge>;
1113
- custom?: ReturnType<typeof useCustomContextBridge>;
1505
+ declare function MediaPlayerProvider({ actions, state, children, currentTime, progress, element, }: {
1506
+ actions: MediaPlayerActions;
1507
+ state: MediaPlayerState;
1114
1508
  children: ReactNode;
1509
+ currentTime: RefObject<HTMLDivElement>;
1510
+ progress: RefObject<HTMLDivElement>;
1511
+ element: RefObject<HTMLAudioElement | HTMLVideoElement>;
1115
1512
  }): react_jsx_runtime.JSX.Element;
1116
1513
 
1117
- declare const VisibleCanvasReactContext: React__default.Context<string[]>;
1118
- declare function useVisibleCanvases(): CanvasNormalized[];
1119
-
1120
- declare const ViewerPresetContext: React$1.Context<Preset | null | undefined>;
1121
- declare function useViewerPreset(): Preset | null | undefined;
1122
-
1123
- declare const ImageServiceLoaderContext: React__default.Context<ImageServiceLoader>;
1124
- declare function useImageServiceLoader(): ImageServiceLoader;
1514
+ declare function RangeContext({ range, children }: {
1515
+ range: string;
1516
+ children: ReactNode;
1517
+ }): react_jsx_runtime.JSX.Element;
1125
1518
 
1126
1519
  type SelectorHelperEventTypes = 'click' | 'hover' | 'selector-updated' | 'highlight' | 'clear-highlight' | 'zoom-to' | 'event-listener' | 'remove-event-listener' | 'image-preview-request';
1127
1520
  declare function SelectorControllerProvider({ children }: {
@@ -1192,70 +1585,23 @@ declare function useSelectorHelper(): {
1192
1585
  } = any>(type: SelectorHelperEventTypes, handler: Handler<T_1>): () => void;
1193
1586
  };
1194
1587
 
1195
- interface AnnotationStyles {
1196
- id: number;
1197
- name: string;
1198
- creator?: {
1199
- id: number;
1200
- name: string;
1201
- };
1202
- createdAt: Date;
1203
- theme: {
1204
- default: AnnotationThemeDefinition;
1205
- hidden: AnnotationThemeDefinition;
1206
- highlighted: AnnotationThemeDefinition;
1207
- } & Record<string, AnnotationThemeDefinition>;
1208
- }
1209
- type AnnotationThemeDefinition = BoxStyle & {
1210
- hidden?: boolean;
1211
- interactive?: boolean;
1212
- hotspot?: boolean;
1213
- hotspotSize?: 'lg' | 'md' | 'sm';
1214
- };
1215
- declare function getDefaultAnnotationStyles(): AnnotationStyles['theme'];
1216
- declare function useAnnotationStyles(): {
1217
- default: AnnotationThemeDefinition;
1218
- hidden: AnnotationThemeDefinition;
1219
- highlighted: AnnotationThemeDefinition;
1220
- } & Record<string, AnnotationThemeDefinition>;
1221
- declare function AnnotationStyleProvider({ theme, children, }: {
1222
- theme?: AnnotationStyles['theme'];
1223
- children: React.ReactNode;
1588
+ declare const ReactVaultContext: React__default.Context<{
1589
+ vault: Vault | null;
1590
+ setVaultInstance: (vault: Vault) => void;
1591
+ }>;
1592
+ declare function VaultProvider({ vault, vaultOptions, useGlobal, resources, children, }: {
1593
+ vault?: Vault;
1594
+ useGlobal?: boolean;
1595
+ vaultOptions?: VaultOptions;
1596
+ resources?: ResourceContextType;
1597
+ children: ReactNode;
1224
1598
  }): react_jsx_runtime.JSX.Element;
1225
1599
 
1226
- interface StrategyContext {
1227
- strategy: RenderingStrategy;
1228
- choices: ChoiceDescription | null;
1229
- }
1230
- declare const StrategyReactContext: React$1.Context<StrategyContext | null>;
1231
- declare function useStrategy(): StrategyContext;
1232
-
1233
- interface ControlsContext {
1234
- renderMediaControls?: (strategy: MediaStrategy) => ReactNode;
1235
- viewControlsDeps: any[];
1236
- renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
1237
- mediaControlsDeps: any[];
1238
- renderComplexTimelineControls?: (strategy: ComplexTimelineStrategy) => ReactNode;
1239
- complexTimelineControlsDeps: any[];
1240
- }
1241
- declare const ControlsReactContext: React$1.Context<ControlsContext | null>;
1242
- declare function useRenderControls(): ControlsContext;
1600
+ declare const ViewerPresetContext: React$1.Context<Preset | null | undefined>;
1601
+ declare function useViewerPreset(): Preset | null | undefined;
1243
1602
 
1244
- /**
1245
- * Parse specific resource.
1246
- *
1247
- * This could be expanded to support pulling out more from the specific resource.
1248
- *
1249
- * @param resource
1250
- */
1251
- declare function parseSpecificResource(resource: ContentResource): any[];
1252
- declare function getParsedTargetSelector(canvas: CanvasNormalized, target: W3CAnnotationTarget | W3CAnnotationTarget[]): [TemporalBoxSelector$1 | BoxSelector$1 | PointSelector | null, SupportedTarget['source']];
1253
- declare const emptyActions: {
1254
- makeChoice: () => void;
1255
- };
1256
- declare const unknownResponse: UseRenderingStrategy[0];
1257
- declare const unsupportedStrategy: (reason: string) => UnknownStrategy;
1258
- declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
1603
+ declare const VisibleCanvasReactContext: React__default.Context<string[]>;
1604
+ declare function useVisibleCanvases(): CanvasNormalized[];
1259
1605
 
1260
1606
  type CompatVault = {
1261
1607
  get: _iiif_helpers_vault.Vault['get'];
@@ -1265,7 +1611,7 @@ type CompatVault = {
1265
1611
  requestStatus: _iiif_helpers_vault.Vault['requestStatus'];
1266
1612
  };
1267
1613
 
1268
- declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables, vault: CompatVault): UnknownStrategy | MediaStrategy;
1614
+ declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType, vault: CompatVault): ComplexTimelineStrategy;
1269
1615
 
1270
1616
  interface GetRenderStrategyOptions {
1271
1617
  canvas: CanvasNormalized | null | undefined;
@@ -1276,7 +1622,23 @@ interface GetRenderStrategyOptions {
1276
1622
  }
1277
1623
  declare function getRenderingStrategy({ canvas, paintables, supports, loadImageService, vault, }: GetRenderStrategyOptions): RenderingStrategy;
1278
1624
 
1279
- declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType, vault: CompatVault): ComplexTimelineStrategy;
1625
+ /**
1626
+ * Parse specific resource.
1627
+ *
1628
+ * This could be expanded to support pulling out more from the specific resource.
1629
+ *
1630
+ * @param resource
1631
+ */
1632
+ declare function parseSpecificResource(resource: ContentResource): any[];
1633
+ declare function getParsedTargetSelector(canvas: CanvasNormalized, target: W3CAnnotationTarget | W3CAnnotationTarget[]): [TemporalBoxSelector$1 | BoxSelector$1 | PointSelector | null, SupportedTarget['source']];
1634
+ declare const emptyActions: {
1635
+ makeChoice: () => void;
1636
+ };
1637
+ declare const unknownResponse: UseRenderingStrategy[0];
1638
+ declare const unsupportedStrategy: (reason: string) => UnknownStrategy;
1639
+ declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
1640
+
1641
+ declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables, vault: CompatVault): UnknownStrategy | MediaStrategy;
1280
1642
 
1281
1643
  declare function useAnnotation(options?: {
1282
1644
  id: string;
@@ -1334,13 +1696,13 @@ declare function useCanvasChoices({ canvasId }?: {
1334
1696
 
1335
1697
  declare function useCanvasClock(canvasId?: string, autoplay?: boolean): void;
1336
1698
 
1337
- declare function useCanvasSubset(idsOrRefs?: Array<string | Reference>): Reference<'Canvas'>[];
1338
-
1339
1699
  declare function useCanvasStartTime(): {
1340
1700
  startTime: number;
1341
1701
  endTime?: number | undefined;
1342
1702
  } | null;
1343
1703
 
1704
+ declare function useCanvasSubset(idsOrRefs?: Array<string | Reference>): Reference<'Canvas'>[];
1705
+
1344
1706
  declare function useCollection(options: {
1345
1707
  id: string;
1346
1708
  }): CollectionNormalized | undefined;
@@ -1349,11 +1711,37 @@ declare function useCollection<T>(options: {
1349
1711
  selector: (collection: CollectionNormalized) => T;
1350
1712
  }, deps?: any[]): T | undefined;
1351
1713
 
1714
+ declare function useCurrentAnnotationActions(): {
1715
+ saveAnnotation: () => void;
1716
+ cancelRequest: (requestId?: string | undefined) => void;
1717
+ };
1718
+
1719
+ declare function useCurrentAnnotationMetadata({ requestId: customRequestId }?: {
1720
+ requestId?: string;
1721
+ }): readonly [Record<string, any>, (data: Record<string, any>) => void];
1722
+
1723
+ declare function useCurrentAnnotationRequest(): AnnotationRequest | null;
1724
+
1725
+ declare function useCurrentAnnotationTransition(options: {
1726
+ requestId?: string | null;
1727
+ onStart?: (type: string) => void;
1728
+ onEnd?: (type: string, response: PolygonEvents['polygons.end-transition']['response']) => void;
1729
+ onTransition?: (type: string) => void;
1730
+ }): void;
1731
+
1352
1732
  declare function useDispatch(): VaultZustandStore['dispatch'];
1353
1733
 
1354
1734
  type SupportedEvents = 'onClick';
1355
1735
  declare function useEventListener<T>(resource: Reference, name: SupportedEvents, listener: (e: any, resource: T) => void, scope?: string[], deps?: any[]): void;
1356
1736
 
1737
+ declare const ReactEmitterContext: React$1.Context<Emitter<any>>;
1738
+ declare function EventEmitterProvider({ children, emitter, }: {
1739
+ children: React.ReactNode;
1740
+ emitter: Emitter<any>;
1741
+ }): react_jsx_runtime.JSX.Element;
1742
+ declare function useEmitter<Event extends Record<string | symbol, unknown>>(): Emitter<Event>;
1743
+ declare function useEvent<Event extends Record<string | symbol, unknown>, Key extends keyof Event>(key: Key, listener: (data: Event[Key]) => void, deps?: any[]): void;
1744
+
1357
1745
  declare function useExistingVault(vault?: Vault): Vault;
1358
1746
 
1359
1747
  type ResourceRequestOptions = {
@@ -1454,6 +1842,126 @@ declare function usePaintingAnnotations(options?: {
1454
1842
  enableSingleAnnotation?: boolean;
1455
1843
  }): AnnotationNormalized[];
1456
1844
 
1845
+ declare function usePolygonHelper(render: (t: any, s: any, dt: number) => void): {
1846
+ currentShape: polygon_editor.InputShape | null;
1847
+ state: polygon_editor.SlowState;
1848
+ helper: {
1849
+ state: polygon_editor.RenderState;
1850
+ setState: (newState: Partial<polygon_editor.SlowState>) => void;
1851
+ emitter: mitt.Emitter<polygon_editor.PolygonEvents>;
1852
+ modifiers: {
1853
+ reset(): void;
1854
+ getForType(type: string | null): Record<string, string>;
1855
+ set(modifier: string): void;
1856
+ unset(modifier: string): void;
1857
+ };
1858
+ stamps: {
1859
+ set(selectedStamp: polygon_editor.InputShape | null): void;
1860
+ clear(): void;
1861
+ square(): void;
1862
+ triangle(): void;
1863
+ pentagon(): void;
1864
+ hexagon(): void;
1865
+ circle(): void;
1866
+ };
1867
+ history: {
1868
+ undo: () => void;
1869
+ redo: () => void;
1870
+ readonly canUndo: boolean;
1871
+ readonly canRedo: boolean;
1872
+ };
1873
+ key: {
1874
+ down(inputKey: string): boolean | undefined;
1875
+ up(inputKey: string): void;
1876
+ };
1877
+ setScale: (scale: number) => void;
1878
+ clock: {
1879
+ set: (renderFunc: polygon_editor.RenderFunc) => void;
1880
+ start: (renderFunc?: polygon_editor.RenderFunc | undefined, setStateFunc?: polygon_editor.SetState | undefined) => void;
1881
+ stop: () => void;
1882
+ step: (deltaTime?: number | undefined) => void;
1883
+ };
1884
+ pointer: (pointers: ([number, number] | [number, number, number, number, number, number])[]) => void;
1885
+ blur: () => void;
1886
+ pointerDown: () => void;
1887
+ pointerUp: () => void;
1888
+ setShape: (shape: polygon_editor.InputShape | null) => void;
1889
+ label: (type: string | null) => string;
1890
+ tools: {
1891
+ setTool: (tool: polygon_editor.ValidTools) => void;
1892
+ unsetTool: (tool: polygon_editor.ValidTools) => void;
1893
+ toggleTool: (tool: polygon_editor.ValidTools) => void;
1894
+ updateVisibility: (tool: polygon_editor.ValidTools) => void;
1895
+ setCanDelete(canDelete: boolean): void;
1896
+ setCanDeselect(canDeselect: boolean): void;
1897
+ lockToolSwitching(): void;
1898
+ unlockToolSwitching(): void;
1899
+ toggleToolSwitching(): void;
1900
+ shortcuts: {
1901
+ [k: string]: string;
1902
+ };
1903
+ getValidIntents(tool?: polygon_editor.ValidTools | undefined): {
1904
+ actions: polygon_editor.ActionIntent[];
1905
+ transitions: polygon_editor.TransitionIntent[];
1906
+ keys: polygon_editor.ActionIntent[];
1907
+ all: Record<string, string>;
1908
+ current: Record<string, string>;
1909
+ };
1910
+ getToolInfo(): {
1911
+ name: polygon_editor.ValidTools;
1912
+ cursor: string;
1913
+ selectionCount: number;
1914
+ pointCount: number;
1915
+ isOpen: boolean;
1916
+ };
1917
+ smartSelect(): void;
1918
+ clearSelection(): void;
1919
+ autoSelect(): void;
1920
+ };
1921
+ snap: {
1922
+ enabled: () => boolean;
1923
+ enable: () => void;
1924
+ disable: () => void;
1925
+ toggle: () => void;
1926
+ pointsEnabled: () => boolean;
1927
+ enablePoints: () => void;
1928
+ disablePoints: () => void;
1929
+ togglePoints: () => void;
1930
+ linesEnabled: () => boolean;
1931
+ enableLines: () => void;
1932
+ disableLines: () => void;
1933
+ toggleLines: () => void;
1934
+ intersectionsEnabled: () => boolean;
1935
+ enableIntersections: () => void;
1936
+ disableIntersections: () => void;
1937
+ toggleIntersections: () => void;
1938
+ gridEnabled: () => boolean;
1939
+ enableGrid: () => void;
1940
+ disableGrid: () => void;
1941
+ toggleGrid: () => void;
1942
+ parallelEnabled: () => boolean;
1943
+ enableParallel: () => void;
1944
+ disableParallel: () => void;
1945
+ toggleParallel: () => void;
1946
+ getThreshold: () => number;
1947
+ setThreshold: (threshold: number) => void;
1948
+ isActive: () => boolean;
1949
+ getSnapPoint: () => ([number, number] | [number, number, number, number, number, number]) | null;
1950
+ getActiveGuides: () => polygon_editor.SnapGuide[];
1951
+ getTargets: () => polygon_editor.SnapTarget[];
1952
+ };
1953
+ selectAllPoints: () => void;
1954
+ setBounds: (bounds: {
1955
+ x: number;
1956
+ y: number;
1957
+ width: number;
1958
+ height: number;
1959
+ } | null) => void;
1960
+ lockAspectRatio: () => void;
1961
+ unlockAspectRatio: () => void;
1962
+ };
1963
+ };
1964
+
1457
1965
  declare function useRange(options?: {
1458
1966
  id: string;
1459
1967
  }): RangeNormalized | undefined;
@@ -1462,6 +1970,21 @@ declare function useRange<T>(options?: {
1462
1970
  selector: (range: RangeNormalized) => T;
1463
1971
  }, deps?: any[]): T | undefined;
1464
1972
 
1973
+ declare function useRequestAnnotation(opts?: {
1974
+ onSuccess?: (r: AnnotationResponse) => void;
1975
+ }): {
1976
+ id: number;
1977
+ busy: boolean;
1978
+ isPending: boolean;
1979
+ isActive: boolean;
1980
+ requestId: string | null;
1981
+ requestAnnotation: (request: AnnotationRequest, options?: Omit<AnnotationRequestOptions, 'requestId'>) => Promise<AnnotationResponse | null>;
1982
+ cancelRequest: () => void;
1983
+ completeRequest: () => void;
1984
+ reset: () => void;
1985
+ data: AnnotationResponse | null;
1986
+ };
1987
+
1465
1988
  declare function useResourceEvents<T extends NormalizedEntity>(resource?: Reference, scope?: string[]): any;
1466
1989
 
1467
1990
  declare function useResources<Type>(ids: string[], type: string): Type[];
@@ -1473,6 +1996,25 @@ declare function useStyleHelper(): _iiif_helpers_styles.StyledHelper<_iiif_helpe
1473
1996
  declare function useStyles<Style extends Record<string, Record<string, any>>>(resource: undefined | Reference<any>): Style;
1474
1997
  declare function useStyles<Style extends Record<string, any>>(resource: undefined | Reference<any>, scope: string): Style;
1475
1998
 
1999
+ declare function useSvgEditorControls(): {
2000
+ completeRequest: (requestId?: string | undefined) => void;
2001
+ currentTool: polygon_editor.ValidTools;
2002
+ selectedStamp: polygon_editor.InputShape | null;
2003
+ switchTool: {
2004
+ draw(): void;
2005
+ pen(): void;
2006
+ line(): void;
2007
+ lineBox(): void;
2008
+ box(): void;
2009
+ triangle(): void;
2010
+ hexagon(): void;
2011
+ circle(): void;
2012
+ remove(): void;
2013
+ hand(): void;
2014
+ pointer(): void;
2015
+ };
2016
+ };
2017
+
1476
2018
  declare function useThumbnail(request: ImageCandidateRequest, dereference?: boolean, { canvasId, manifestId }?: {
1477
2019
  canvasId?: string;
1478
2020
  manifestId?: string;
@@ -1504,57 +2046,6 @@ declare function VirtualAnnotationProvider({ children }: {
1504
2046
  children: any;
1505
2047
  }): react_jsx_runtime.JSX.Element;
1506
2048
 
1507
- declare function usePolygonHelper(data: any, render: (t: any, s: any) => void, commitShape: (shape: InputShape) => void): {
1508
- state: SlowState;
1509
- helper: {
1510
- draw: {
1511
- enable(): void;
1512
- disable(): void;
1513
- toggle(): void;
1514
- };
1515
- state: polygon_editor.RenderState;
1516
- modifiers: {
1517
- reset(): void;
1518
- getForType(type: string | null): Record<string, string>;
1519
- set(modifier: string): void;
1520
- unset(modifier: string): void;
1521
- };
1522
- stamps: {
1523
- set(selectedStamp: InputShape | null): void;
1524
- clear(): void;
1525
- square(): void;
1526
- triangle(): void;
1527
- pentagon(): void;
1528
- hexagon(): void;
1529
- };
1530
- key: {
1531
- down(key: string): true | undefined;
1532
- up(key: string): void;
1533
- };
1534
- setScale: (scale: number) => void;
1535
- clock: {
1536
- set: (renderFunc: polygon_editor.RenderFunc) => void;
1537
- start: (renderFunc?: polygon_editor.RenderFunc | undefined, setStateFunc?: polygon_editor.SetState | undefined) => void;
1538
- stop: () => void;
1539
- step: (deltaTime?: number | undefined) => void;
1540
- };
1541
- pointer: (pointers: ([number, number] | [number, number, number, number, number, number])[]) => void;
1542
- blur: () => void;
1543
- pointerDown: () => void;
1544
- pointerUp: () => void;
1545
- setShape: (shape: InputShape | null) => void;
1546
- modes: {
1547
- toggleLineBoxMode: () => void;
1548
- toggleLineMode: () => void;
1549
- enableLineMode(): void;
1550
- disableLineMode(): void;
1551
- enableLineBoxMode(): void;
1552
- disableLineBoxMode(): void;
1553
- };
1554
- label: (type: string | null) => string;
1555
- };
1556
- };
1557
-
1558
2049
  declare function flattenAnnotationPageIds({ canvas, manifest, all, canvases, }: {
1559
2050
  manifest?: ManifestNormalized;
1560
2051
  canvas?: CanvasNormalized;
@@ -1600,6 +2091,36 @@ type LocaleStringProps = {
1600
2091
  } & Record<string, any>;
1601
2092
  declare function LocaleString({ as: Component, defaultText, enableDangerouslySetInnerHTML, children, separator, ...props }: LocaleStringProps): react_jsx_runtime.JSX.Element;
1602
2093
 
2094
+ declare function targetIntersects(a: {
2095
+ x: number;
2096
+ y: number;
2097
+ width: number;
2098
+ height: number;
2099
+ }, b: {
2100
+ x: number;
2101
+ y: number;
2102
+ width: number;
2103
+ height: number;
2104
+ }): boolean;
2105
+
2106
+ declare function annotationResponseToSelector(response: {
2107
+ polygon: AnnotationResponse['polygon'];
2108
+ boundingBox?: AnnotationResponse['boundingBox'];
2109
+ target?: AnnotationResponse['target'];
2110
+ }, on?: {
2111
+ width: number;
2112
+ height: number;
2113
+ } | null): SupportedSelector;
2114
+
2115
+ declare function isRectangle(points: InputShape['points']): boolean;
2116
+
2117
+ declare function isSvgSelector(t: SupportedSelector): t is SvgSelector$1;
2118
+ declare function isBoxSelector(t: SupportedSelector): t is BoxSelector$1;
2119
+ declare function seraliseSupportedSelector(selector: SupportedSelector, on?: {
2120
+ width: number;
2121
+ height: number;
2122
+ } | null): null | SvgSelector | FragmentSelector;
2123
+
1603
2124
  declare const SimpleViewerReactContext: React__default.Context<SimpleViewerContext>;
1604
2125
  declare function InnerViewerProvider(props: SimpleViewerProps): react_jsx_runtime.JSX.Element | null;
1605
2126
  declare function SimpleViewerProvider(props: SimpleViewerProps): react_jsx_runtime.JSX.Element;
@@ -1625,6 +2146,11 @@ declare function useCanvasSequence({ startCanvas, disablePaging }: {
1625
2146
  previous: () => void;
1626
2147
  };
1627
2148
 
2149
+ declare function findFirstCanvasFromRange(vault: Vault, range: RangeNormalized): null | Reference<'Canvas'>;
2150
+ declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): Array<Reference<'Canvas'>>;
2151
+ declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
2152
+ declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
2153
+
1628
2154
  /**
1629
2155
  * Get visible canvases from canvas ID
1630
2156
  *
@@ -1662,9 +2188,4 @@ declare function getManifestSequence(vault: Vault, manifestOrRange: ManifestNorm
1662
2188
  skipNonPaged?: boolean;
1663
2189
  }): [Reference<'Canvas'>[], number[][]];
1664
2190
 
1665
- declare function findFirstCanvasFromRange(vault: Vault, range: RangeNormalized): null | Reference<'Canvas'>;
1666
- declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): Array<Reference<'Canvas'>>;
1667
- declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
1668
- declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
1669
-
1670
- export { AnnotationContext, AnnotationPageContext, type AnnotationPageDescription, type AnnotationStrategyProps, 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, CanvasStrategyProvider, CanvasWorldObject, type ChoiceEvents, CollectionContext, CombinedMetadata, ComplexTimelineProvider, type ComplexTimelineStrategy, ContextBridge, type ControlsContext, ControlsReactContext, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, type EmptyStrategy, EventsProvider, Image, type ImageProps, ImageService, ImageServiceLoaderContext, type ImageServiceLoaderType, type ImageServiceRequestOptions, type ImageStrategyProps, 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, Render3DModelStrategy, RenderAccompanyingCanvas, RenderAnnotationStrategy, RenderAudioStrategy, RenderComplexTimelineStrategy, RenderEmptyStrategy, RenderImageStrategy, RenderSvgEditorControls, RenderTextualContentStrategy, RenderVideoStrategy, RenderYouTubeStrategy, 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 StrategyContext, StrategyReactContext, type SvgTheme, type TextContent, type TextualContentStrategy, ThumbnailFallbackImage, 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, useRenderControls, useRenderingStrategy, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStrategy, useStyleHelper, useStyles, useSvgEditor, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
2191
+ export { AnnotationContext, AnnotationPageContext, type AnnotationPageDescription, type AnnotationRequest, type AnnotationRequestOptions, type AnnotationResponse, type AnnotationStrategyProps, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, type AtlasStore, type AtlasStoreEvents, AtlasStoreProvider, AtlasStoreReactContext, type AudioSequence, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CanvasPanel, type CanvasPanelProps, CanvasStrategyProvider, CanvasWorldObject, type ChoiceEvents, CollectionContext, CombinedMetadata, ComplexTimelineProvider, type ComplexTimelineStrategy, ContextBridge, type ControlsContext, ControlsReactContext, type CreateAtlasStoreProps, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, DefaultEditingTools, type EmptyStrategy, EventEmitterProvider, EventsProvider, Image, type ImageProps, ImageService, ImageServiceLoaderContext, type ImageServiceLoaderType, type ImageServiceRequestOptions, type ImageStrategyProps, type ImageWithOptionalService, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, type MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEmitterContext, ReactEventContext, ReactVaultContext, Render3DModelStrategy, RenderAccompanyingCanvas, RenderAnnotation, RenderAnnotationEditing, RenderAnnotationPage, RenderAnnotationStrategy, RenderAudioStrategy, RenderComplexTimelineStrategy, type RenderContextProps, RenderEmptyStrategy, RenderImageStrategy, RenderSvgEditorControls, RenderTextualContentStrategy, RenderVideoStrategy, RenderYouTubeStrategy, type RenderingStrategy, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, type SVGTheme, 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 StrategyContext, StrategyReactContext, type SvgTheme, type TextContent, type TextualContentStrategy, ThumbnailFallbackImage, type TimelineKeyframe, TranslationProvider, TransliterationProvider, type UnknownStrategy, type UseRenderingStrategy, type UseRenderingStrategyOptions, type VaultActivatedAnnotation, VaultProvider, type VideoSequence, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, annotationResponseToSelector, authDetailsForResource, createAtlasStore, createAuthStateStore, createProbe, defaultEmitter, defaultSvgTheme, emptyActions, emptyStrategy, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, get3dStrategy, getAtlasStoreByName, getComplexTimelineStrategy, getDefaultAnnotationStyles, getImageStrategy, getManifestSequence, getParsedTargetSelector, getRenderingStrategy, getTextualContentStrategy, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, isBoxSelector, isRectangle, isSvgSelector, makeAccessServiceRequest, makeAccessTokenRequest, parseSpecificResource, polygonToTarget, requestToAnnotationResponse, seraliseSupportedSelector, svgThemes, targetIntersects, unknownResponse, unsupportedStrategy, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAtlasContextMenu, useAtlasStore, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useContextMenuStore, useCreateLocaleString, useCurrentAnnotationActions, useCurrentAnnotationMetadata, useCurrentAnnotationRequest, useCurrentAnnotationTransition, useCurrentAuth, useCustomContextBridge, useDispatch, useEmitter, useEvent, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLoadImageService, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useRenderControls, useRenderingStrategy, useRequestAnnotation, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStrategy, useStyleHelper, useStyles, useSvgEditor, useSvgEditorControls, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };