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,51 @@
1
+ import * as _iiif_helpers_vault_4 from '@iiif/helpers/vault-4';
2
+ import { Vault } from '@iiif/helpers/vault';
3
+ import { Reference } from '@iiif/parser/presentation-3/types';
4
+ import { ReactNode } from 'react';
5
+ import { q as ViewableContainerReference } from './useRenderingStrategy-Vubk-vUU.cjs';
6
+
7
+ type SimpleViewerContext = {
8
+ items: ViewableContainerReference[];
9
+ sequence: number[][];
10
+ hasNext: boolean;
11
+ hasPrevious: boolean;
12
+ setSequenceIndex: (newId: number) => void;
13
+ setCurrentCanvasId: (newId: string) => void;
14
+ setCurrentCanvasIndex: (newId: number) => void;
15
+ currentSequenceIndex: number;
16
+ nextCanvas: () => void;
17
+ previousCanvas: () => void;
18
+ };
19
+ type SimpleViewerProps = {
20
+ vault?: Vault | _iiif_helpers_vault_4.Vault4;
21
+ manifest: string;
22
+ pagingEnabled?: boolean;
23
+ children: ReactNode;
24
+ startCanvas?: string;
25
+ rangeId?: string;
26
+ };
27
+ type SimpleViewerReducerState = {
28
+ sequence: number[][];
29
+ availableCanvases: Reference<'Canvas'>[];
30
+ visibleCanvases: Reference<'Canvas'>[];
31
+ currentCanvas: string | null;
32
+ isPaged: boolean;
33
+ rangeId: string | null;
34
+ };
35
+ interface SimpleViewerActions {
36
+ setCurrentCanvasId(newId: string): void;
37
+ setCurrentCanvasIndex(newId: number): void;
38
+ nextCanvas(): void;
39
+ previousCanvas(): void;
40
+ setCurrentRange(newId: string): void;
41
+ clearRange(): void;
42
+ setPagingEnabled(isEnabled: boolean): void;
43
+ }
44
+ type SimpleViewerActionsType = {
45
+ [T in keyof SimpleViewerActions]: {
46
+ type: T;
47
+ payload: Parameters<SimpleViewerActions[T]>[0];
48
+ };
49
+ }[keyof SimpleViewerActions];
50
+
51
+ export type { SimpleViewerContext as S, SimpleViewerProps as a, SimpleViewerReducerState as b, SimpleViewerActions as c, SimpleViewerActionsType as d };
@@ -0,0 +1,144 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { StoreApi } from 'zustand';
3
+ import * as mitt from 'mitt';
4
+ import * as zustand_vanilla from 'zustand/vanilla';
5
+ import { C as ComplexTimelineStrategy, T as TimelineKeyframe, R as RenderingStrategy, l as StrategyActions } from './useRenderingStrategy-Vubk-vUU.js';
6
+ import * as React$1 from 'react';
7
+ import { RefObject } from 'react';
8
+ import { ChoiceDescription } from '@iiif/helpers';
9
+ import { Preset } from '@atlas-viewer/atlas';
10
+
11
+ type MediaPlayerState = {
12
+ isPlaying: boolean;
13
+ isMuted: boolean;
14
+ playRequested: boolean;
15
+ volume: number;
16
+ isFinished: boolean;
17
+ duration: number;
18
+ };
19
+ type MediaPlayerActions = {
20
+ play(): void;
21
+ pause(): void;
22
+ playPause(): void;
23
+ mute(): void;
24
+ unmute(): void;
25
+ toggleMute(): void;
26
+ setVolume(volume: number): void;
27
+ setDurationPercent(percent: number): void;
28
+ setTime(time: number | ((t: number) => number)): void;
29
+ };
30
+ declare function formatTime(time: number): string;
31
+ declare function useSimpleMediaPlayer(props: {
32
+ duration: number;
33
+ }): readonly [
34
+ {
35
+ element: RefObject<HTMLAudioElement | HTMLVideoElement>;
36
+ currentTime: RefObject<HTMLDivElement>;
37
+ progress: RefObject<HTMLDivElement>;
38
+ },
39
+ MediaPlayerState,
40
+ MediaPlayerActions
41
+ ];
42
+
43
+ interface ComplexTimelineStore extends MediaPlayerActions {
44
+ complexTimeline: ComplexTimelineStrategy;
45
+ visibleElements: Record<string, TimelineKeyframe | null>;
46
+ isReady: boolean;
47
+ unseekableMedia: string[];
48
+ isBuffering: boolean;
49
+ bufferMap: Record<string, boolean>;
50
+ isMuted: boolean;
51
+ playRequested: boolean;
52
+ isPlaying: boolean;
53
+ isFinished: boolean;
54
+ volume: number;
55
+ duration: number;
56
+ primeTime: number;
57
+ clockRunning: boolean;
58
+ clockStartTime: number;
59
+ currentPrime: TimelineKeyframe | null;
60
+ clockStartRequests: number;
61
+ startClock: () => void;
62
+ stopClock: () => void;
63
+ playbackError: unknown | null;
64
+ attachMediaElement: (id: string, element: HTMLMediaElement) => () => void;
65
+ dispose: () => void;
66
+ updateTimeline: (timeline: ComplexTimelineStrategy) => void;
67
+ setElement: (id: string, element: HTMLVideoElement | HTMLAudioElement) => void;
68
+ removeElement: (id: string) => void;
69
+ applyKeyframes(newIdx: number, keyframes: TimelineKeyframe[]): void;
70
+ nextKeyframeIndex: number;
71
+ setProgressElement(div: HTMLDivElement): void;
72
+ setCurrentTimeElement(div: HTMLDivElement): void;
73
+ clearProgressElement(): void;
74
+ clearCurrentTimeElement(): void;
75
+ }
76
+ type ComplexTimelineEvents = {
77
+ 'complex-timeline.ready': {
78
+ complexTimeline: ComplexTimelineStrategy;
79
+ };
80
+ 'complex-timeline.keyframe': {
81
+ keyframe: TimelineKeyframe;
82
+ };
83
+ 'complex-timeline.prime-change': {
84
+ prime: TimelineKeyframe | null;
85
+ };
86
+ 'complex-timeline.buffering': {
87
+ id: string;
88
+ isBuffering: boolean;
89
+ };
90
+ 'complex-timeline.finished-buffering': {};
91
+ 'complex-timeline.play': {
92
+ id: string;
93
+ };
94
+ 'complex-timeline.pause': {
95
+ id: string;
96
+ };
97
+ 'complex-timeline.exit': {
98
+ id: string;
99
+ };
100
+ 'complex-timeline.enter': {
101
+ id: string;
102
+ };
103
+ };
104
+ declare function resolveKeyframeChanges({ currentKeyFrameIndex, keyframes, targetTime, currentTime, }: {
105
+ currentTime: number;
106
+ targetTime: number;
107
+ currentKeyFrameIndex: number;
108
+ keyframes: TimelineKeyframe[];
109
+ }): [number, TimelineKeyframe[]];
110
+ type ComplexTimelineController = ReturnType<typeof createComplexTimelineStore>;
111
+ declare function createComplexTimelineStore({ complexTimeline, startTime, }: {
112
+ complexTimeline: ComplexTimelineStrategy;
113
+ startTime?: number;
114
+ }): {
115
+ store: zustand_vanilla.StoreApi<ComplexTimelineStore>;
116
+ emitter: mitt.Emitter<ComplexTimelineEvents>;
117
+ attachMediaElement: (id: string, element: HTMLMediaElement) => () => void;
118
+ dispose: () => void;
119
+ getSnapshot: () => ComplexTimelineStore;
120
+ subscribe: (listener: (state: ComplexTimelineStore, prevState: ComplexTimelineStore) => void) => () => void;
121
+ };
122
+
123
+ declare function ComplexTimelineProvider({ children, store, }: {
124
+ children: React.ReactNode;
125
+ store: StoreApi<ComplexTimelineStore>;
126
+ }): react_jsx_runtime.JSX.Element;
127
+ declare function useComplexTimelineStore(): StoreApi<ComplexTimelineStore>;
128
+ declare function useComplexTimeline<T>(selector: (store: ComplexTimelineStore) => T): T;
129
+
130
+ interface StrategyContext {
131
+ strategy: RenderingStrategy;
132
+ actions?: StrategyActions;
133
+ imageStyles?: Record<string, {
134
+ opacity?: number;
135
+ }>;
136
+ choices: ChoiceDescription | null;
137
+ }
138
+ declare const StrategyReactContext: React$1.Context<StrategyContext | null>;
139
+ declare function useStrategy(): StrategyContext;
140
+
141
+ declare const ViewerPresetContext: React$1.Context<Preset | null | undefined>;
142
+ declare function useViewerPreset(): Preset | null | undefined;
143
+
144
+ export { ComplexTimelineProvider as C, type MediaPlayerState as M, type StrategyContext as S, ViewerPresetContext as V, useComplexTimeline as a, StrategyReactContext as b, useStrategy as c, useViewerPreset as d, type MediaPlayerActions as e, formatTime as f, useSimpleMediaPlayer as g, type ComplexTimelineController as h, createComplexTimelineStore as i, type ComplexTimelineStore as j, type ComplexTimelineEvents as k, resolveKeyframeChanges as r, useComplexTimelineStore as u };
@@ -0,0 +1,144 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { StoreApi } from 'zustand';
3
+ import * as mitt from 'mitt';
4
+ import * as zustand_vanilla from 'zustand/vanilla';
5
+ import { C as ComplexTimelineStrategy, T as TimelineKeyframe, R as RenderingStrategy, l as StrategyActions } from './useRenderingStrategy-Vubk-vUU.cjs';
6
+ import * as React$1 from 'react';
7
+ import { RefObject } from 'react';
8
+ import { ChoiceDescription } from '@iiif/helpers';
9
+ import { Preset } from '@atlas-viewer/atlas';
10
+
11
+ type MediaPlayerState = {
12
+ isPlaying: boolean;
13
+ isMuted: boolean;
14
+ playRequested: boolean;
15
+ volume: number;
16
+ isFinished: boolean;
17
+ duration: number;
18
+ };
19
+ type MediaPlayerActions = {
20
+ play(): void;
21
+ pause(): void;
22
+ playPause(): void;
23
+ mute(): void;
24
+ unmute(): void;
25
+ toggleMute(): void;
26
+ setVolume(volume: number): void;
27
+ setDurationPercent(percent: number): void;
28
+ setTime(time: number | ((t: number) => number)): void;
29
+ };
30
+ declare function formatTime(time: number): string;
31
+ declare function useSimpleMediaPlayer(props: {
32
+ duration: number;
33
+ }): readonly [
34
+ {
35
+ element: RefObject<HTMLAudioElement | HTMLVideoElement>;
36
+ currentTime: RefObject<HTMLDivElement>;
37
+ progress: RefObject<HTMLDivElement>;
38
+ },
39
+ MediaPlayerState,
40
+ MediaPlayerActions
41
+ ];
42
+
43
+ interface ComplexTimelineStore extends MediaPlayerActions {
44
+ complexTimeline: ComplexTimelineStrategy;
45
+ visibleElements: Record<string, TimelineKeyframe | null>;
46
+ isReady: boolean;
47
+ unseekableMedia: string[];
48
+ isBuffering: boolean;
49
+ bufferMap: Record<string, boolean>;
50
+ isMuted: boolean;
51
+ playRequested: boolean;
52
+ isPlaying: boolean;
53
+ isFinished: boolean;
54
+ volume: number;
55
+ duration: number;
56
+ primeTime: number;
57
+ clockRunning: boolean;
58
+ clockStartTime: number;
59
+ currentPrime: TimelineKeyframe | null;
60
+ clockStartRequests: number;
61
+ startClock: () => void;
62
+ stopClock: () => void;
63
+ playbackError: unknown | null;
64
+ attachMediaElement: (id: string, element: HTMLMediaElement) => () => void;
65
+ dispose: () => void;
66
+ updateTimeline: (timeline: ComplexTimelineStrategy) => void;
67
+ setElement: (id: string, element: HTMLVideoElement | HTMLAudioElement) => void;
68
+ removeElement: (id: string) => void;
69
+ applyKeyframes(newIdx: number, keyframes: TimelineKeyframe[]): void;
70
+ nextKeyframeIndex: number;
71
+ setProgressElement(div: HTMLDivElement): void;
72
+ setCurrentTimeElement(div: HTMLDivElement): void;
73
+ clearProgressElement(): void;
74
+ clearCurrentTimeElement(): void;
75
+ }
76
+ type ComplexTimelineEvents = {
77
+ 'complex-timeline.ready': {
78
+ complexTimeline: ComplexTimelineStrategy;
79
+ };
80
+ 'complex-timeline.keyframe': {
81
+ keyframe: TimelineKeyframe;
82
+ };
83
+ 'complex-timeline.prime-change': {
84
+ prime: TimelineKeyframe | null;
85
+ };
86
+ 'complex-timeline.buffering': {
87
+ id: string;
88
+ isBuffering: boolean;
89
+ };
90
+ 'complex-timeline.finished-buffering': {};
91
+ 'complex-timeline.play': {
92
+ id: string;
93
+ };
94
+ 'complex-timeline.pause': {
95
+ id: string;
96
+ };
97
+ 'complex-timeline.exit': {
98
+ id: string;
99
+ };
100
+ 'complex-timeline.enter': {
101
+ id: string;
102
+ };
103
+ };
104
+ declare function resolveKeyframeChanges({ currentKeyFrameIndex, keyframes, targetTime, currentTime, }: {
105
+ currentTime: number;
106
+ targetTime: number;
107
+ currentKeyFrameIndex: number;
108
+ keyframes: TimelineKeyframe[];
109
+ }): [number, TimelineKeyframe[]];
110
+ type ComplexTimelineController = ReturnType<typeof createComplexTimelineStore>;
111
+ declare function createComplexTimelineStore({ complexTimeline, startTime, }: {
112
+ complexTimeline: ComplexTimelineStrategy;
113
+ startTime?: number;
114
+ }): {
115
+ store: zustand_vanilla.StoreApi<ComplexTimelineStore>;
116
+ emitter: mitt.Emitter<ComplexTimelineEvents>;
117
+ attachMediaElement: (id: string, element: HTMLMediaElement) => () => void;
118
+ dispose: () => void;
119
+ getSnapshot: () => ComplexTimelineStore;
120
+ subscribe: (listener: (state: ComplexTimelineStore, prevState: ComplexTimelineStore) => void) => () => void;
121
+ };
122
+
123
+ declare function ComplexTimelineProvider({ children, store, }: {
124
+ children: React.ReactNode;
125
+ store: StoreApi<ComplexTimelineStore>;
126
+ }): react_jsx_runtime.JSX.Element;
127
+ declare function useComplexTimelineStore(): StoreApi<ComplexTimelineStore>;
128
+ declare function useComplexTimeline<T>(selector: (store: ComplexTimelineStore) => T): T;
129
+
130
+ interface StrategyContext {
131
+ strategy: RenderingStrategy;
132
+ actions?: StrategyActions;
133
+ imageStyles?: Record<string, {
134
+ opacity?: number;
135
+ }>;
136
+ choices: ChoiceDescription | null;
137
+ }
138
+ declare const StrategyReactContext: React$1.Context<StrategyContext | null>;
139
+ declare function useStrategy(): StrategyContext;
140
+
141
+ declare const ViewerPresetContext: React$1.Context<Preset | null | undefined>;
142
+ declare function useViewerPreset(): Preset | null | undefined;
143
+
144
+ export { ComplexTimelineProvider as C, type MediaPlayerState as M, type StrategyContext as S, ViewerPresetContext as V, useComplexTimeline as a, StrategyReactContext as b, useStrategy as c, useViewerPreset as d, type MediaPlayerActions as e, formatTime as f, useSimpleMediaPlayer as g, type ComplexTimelineController as h, createComplexTimelineStore as i, type ComplexTimelineStore as j, type ComplexTimelineEvents as k, resolveKeyframeChanges as r, useComplexTimelineStore as u };