@waveform-playlist/annotations 5.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/dist/index.d.mts +185 -0
- package/dist/index.d.ts +185 -0
- package/dist/index.js +1043 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +995 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +57 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 Naomi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
|
|
3
|
+
interface Annotation$1 {
|
|
4
|
+
id: string;
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
lines: string[];
|
|
8
|
+
lang?: string;
|
|
9
|
+
}
|
|
10
|
+
interface AnnotationFormat {
|
|
11
|
+
name: string;
|
|
12
|
+
parse: (data: unknown) => Annotation$1[];
|
|
13
|
+
serialize: (annotations: Annotation$1[]) => unknown;
|
|
14
|
+
}
|
|
15
|
+
interface AnnotationListOptions {
|
|
16
|
+
editable?: boolean;
|
|
17
|
+
linkEndpoints?: boolean;
|
|
18
|
+
isContinuousPlay?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface AnnotationEventMap {
|
|
21
|
+
'annotation-select': (annotation: Annotation$1) => void;
|
|
22
|
+
'annotation-update': (annotation: Annotation$1) => void;
|
|
23
|
+
'annotation-delete': (id: string) => void;
|
|
24
|
+
'annotation-create': (annotation: Annotation$1) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface AeneasFragment {
|
|
28
|
+
begin: string;
|
|
29
|
+
end: string;
|
|
30
|
+
id: string;
|
|
31
|
+
language: string;
|
|
32
|
+
lines: string[];
|
|
33
|
+
}
|
|
34
|
+
declare function parseAeneas(data: AeneasFragment): Annotation$1;
|
|
35
|
+
declare function serializeAeneas(annotation: Annotation$1): AeneasFragment;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Configuration options passed to annotation action handlers
|
|
39
|
+
*/
|
|
40
|
+
interface AnnotationActionOptions {
|
|
41
|
+
/** Whether annotation endpoints are linked (moving one endpoint moves the other) */
|
|
42
|
+
linkEndpoints?: boolean;
|
|
43
|
+
/** Whether to continue playing after an annotation ends */
|
|
44
|
+
continuousPlay?: boolean;
|
|
45
|
+
/** Additional custom properties */
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
interface AnnotationAction {
|
|
49
|
+
class?: string;
|
|
50
|
+
text?: string;
|
|
51
|
+
title: string;
|
|
52
|
+
action: (annotation: AnnotationData, index: number, annotations: AnnotationData[], opts: AnnotationActionOptions) => void;
|
|
53
|
+
}
|
|
54
|
+
interface AnnotationData {
|
|
55
|
+
id: string;
|
|
56
|
+
start: number;
|
|
57
|
+
end: number;
|
|
58
|
+
lines: string[];
|
|
59
|
+
language?: string;
|
|
60
|
+
}
|
|
61
|
+
interface AnnotationProps {
|
|
62
|
+
annotation: AnnotationData;
|
|
63
|
+
index: number;
|
|
64
|
+
allAnnotations: AnnotationData[];
|
|
65
|
+
startPosition: number;
|
|
66
|
+
endPosition: number;
|
|
67
|
+
color?: string;
|
|
68
|
+
editable?: boolean;
|
|
69
|
+
controls?: AnnotationAction[];
|
|
70
|
+
onAnnotationUpdate?: (updatedAnnotations: AnnotationData[]) => void;
|
|
71
|
+
annotationListConfig?: AnnotationActionOptions;
|
|
72
|
+
onClick?: (annotation: AnnotationData) => void;
|
|
73
|
+
}
|
|
74
|
+
declare const Annotation: FunctionComponent<AnnotationProps>;
|
|
75
|
+
|
|
76
|
+
interface AnnotationBoxComponentProps {
|
|
77
|
+
annotationId: string;
|
|
78
|
+
annotationIndex: number;
|
|
79
|
+
startPosition: number;
|
|
80
|
+
endPosition: number;
|
|
81
|
+
label?: string;
|
|
82
|
+
color?: string;
|
|
83
|
+
isActive?: boolean;
|
|
84
|
+
onClick?: () => void;
|
|
85
|
+
editable?: boolean;
|
|
86
|
+
}
|
|
87
|
+
declare const AnnotationBox: FunctionComponent<AnnotationBoxComponentProps>;
|
|
88
|
+
|
|
89
|
+
interface AnnotationBoxesWrapperProps {
|
|
90
|
+
className?: string;
|
|
91
|
+
children?: React.ReactNode;
|
|
92
|
+
height?: number;
|
|
93
|
+
offset?: number;
|
|
94
|
+
width?: number;
|
|
95
|
+
}
|
|
96
|
+
declare const AnnotationBoxesWrapper: FunctionComponent<AnnotationBoxesWrapperProps>;
|
|
97
|
+
|
|
98
|
+
interface AnnotationsTrackProps {
|
|
99
|
+
className?: string;
|
|
100
|
+
children?: React.ReactNode;
|
|
101
|
+
height?: number;
|
|
102
|
+
offset?: number;
|
|
103
|
+
width?: number;
|
|
104
|
+
}
|
|
105
|
+
declare const AnnotationsTrack: FunctionComponent<AnnotationsTrackProps>;
|
|
106
|
+
|
|
107
|
+
interface AnnotationTextProps {
|
|
108
|
+
annotations: AnnotationData[];
|
|
109
|
+
activeAnnotationId?: string;
|
|
110
|
+
shouldScrollToActive?: boolean;
|
|
111
|
+
editable?: boolean;
|
|
112
|
+
controls?: AnnotationAction[];
|
|
113
|
+
annotationListConfig?: AnnotationActionOptions;
|
|
114
|
+
height?: number;
|
|
115
|
+
onAnnotationClick?: (annotation: AnnotationData) => void;
|
|
116
|
+
onAnnotationUpdate?: (updatedAnnotations: AnnotationData[]) => void;
|
|
117
|
+
}
|
|
118
|
+
declare const AnnotationText: React.NamedExoticComponent<AnnotationTextProps>;
|
|
119
|
+
|
|
120
|
+
interface ContinuousPlayCheckboxProps {
|
|
121
|
+
checked: boolean;
|
|
122
|
+
onChange: (checked: boolean) => void;
|
|
123
|
+
disabled?: boolean;
|
|
124
|
+
className?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Checkbox control for enabling/disabling continuous play of annotations.
|
|
128
|
+
* When enabled, playback continues from one annotation to the next without stopping.
|
|
129
|
+
*/
|
|
130
|
+
declare const ContinuousPlayCheckbox: React.FC<ContinuousPlayCheckboxProps>;
|
|
131
|
+
|
|
132
|
+
interface LinkEndpointsCheckboxProps {
|
|
133
|
+
checked: boolean;
|
|
134
|
+
onChange: (checked: boolean) => void;
|
|
135
|
+
disabled?: boolean;
|
|
136
|
+
className?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Checkbox control for enabling/disabling linked endpoints between annotations.
|
|
140
|
+
* When enabled, the end time of one annotation is automatically linked to the start time of the next.
|
|
141
|
+
*/
|
|
142
|
+
declare const LinkEndpointsCheckbox: React.FC<LinkEndpointsCheckboxProps>;
|
|
143
|
+
|
|
144
|
+
interface EditableCheckboxProps {
|
|
145
|
+
checked: boolean;
|
|
146
|
+
onChange: (enabled: boolean) => void;
|
|
147
|
+
className?: string;
|
|
148
|
+
}
|
|
149
|
+
declare const EditableCheckbox: React.FC<EditableCheckboxProps>;
|
|
150
|
+
|
|
151
|
+
interface DownloadAnnotationsButtonProps {
|
|
152
|
+
annotations: Annotation$1[];
|
|
153
|
+
filename?: string;
|
|
154
|
+
disabled?: boolean;
|
|
155
|
+
className?: string;
|
|
156
|
+
children?: React.ReactNode;
|
|
157
|
+
}
|
|
158
|
+
declare const DownloadAnnotationsButton: React.FC<DownloadAnnotationsButtonProps>;
|
|
159
|
+
|
|
160
|
+
interface UseAnnotationControlsOptions {
|
|
161
|
+
initialContinuousPlay?: boolean;
|
|
162
|
+
initialLinkEndpoints?: boolean;
|
|
163
|
+
}
|
|
164
|
+
interface AnnotationUpdateParams {
|
|
165
|
+
annotationIndex: number;
|
|
166
|
+
newTime: number;
|
|
167
|
+
isDraggingStart: boolean;
|
|
168
|
+
annotations: Annotation$1[];
|
|
169
|
+
duration: number;
|
|
170
|
+
linkEndpoints: boolean;
|
|
171
|
+
}
|
|
172
|
+
interface UseAnnotationControlsReturn {
|
|
173
|
+
continuousPlay: boolean;
|
|
174
|
+
linkEndpoints: boolean;
|
|
175
|
+
setContinuousPlay: (value: boolean) => void;
|
|
176
|
+
setLinkEndpoints: (value: boolean) => void;
|
|
177
|
+
updateAnnotationBoundaries: (params: AnnotationUpdateParams) => Annotation$1[];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Hook for managing annotation control state and boundary logic.
|
|
181
|
+
* Handles continuous play mode and linked endpoints behavior.
|
|
182
|
+
*/
|
|
183
|
+
declare const useAnnotationControls: (options?: UseAnnotationControlsOptions) => UseAnnotationControlsReturn;
|
|
184
|
+
|
|
185
|
+
export { type AeneasFragment, Annotation, type AnnotationAction, type AnnotationActionOptions, AnnotationBox, type AnnotationBoxComponentProps, AnnotationBoxesWrapper, type AnnotationBoxesWrapperProps, type AnnotationData, type AnnotationEventMap, type AnnotationFormat, type AnnotationListOptions, type AnnotationProps, AnnotationText, type AnnotationTextProps, type Annotation$1 as AnnotationType, type AnnotationUpdateParams, AnnotationsTrack, type AnnotationsTrackProps, ContinuousPlayCheckbox, type ContinuousPlayCheckboxProps, DownloadAnnotationsButton, type DownloadAnnotationsButtonProps, EditableCheckbox, type EditableCheckboxProps, LinkEndpointsCheckbox, type LinkEndpointsCheckboxProps, type UseAnnotationControlsOptions, type UseAnnotationControlsReturn, parseAeneas, serializeAeneas, useAnnotationControls };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
|
|
3
|
+
interface Annotation$1 {
|
|
4
|
+
id: string;
|
|
5
|
+
start: number;
|
|
6
|
+
end: number;
|
|
7
|
+
lines: string[];
|
|
8
|
+
lang?: string;
|
|
9
|
+
}
|
|
10
|
+
interface AnnotationFormat {
|
|
11
|
+
name: string;
|
|
12
|
+
parse: (data: unknown) => Annotation$1[];
|
|
13
|
+
serialize: (annotations: Annotation$1[]) => unknown;
|
|
14
|
+
}
|
|
15
|
+
interface AnnotationListOptions {
|
|
16
|
+
editable?: boolean;
|
|
17
|
+
linkEndpoints?: boolean;
|
|
18
|
+
isContinuousPlay?: boolean;
|
|
19
|
+
}
|
|
20
|
+
interface AnnotationEventMap {
|
|
21
|
+
'annotation-select': (annotation: Annotation$1) => void;
|
|
22
|
+
'annotation-update': (annotation: Annotation$1) => void;
|
|
23
|
+
'annotation-delete': (id: string) => void;
|
|
24
|
+
'annotation-create': (annotation: Annotation$1) => void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface AeneasFragment {
|
|
28
|
+
begin: string;
|
|
29
|
+
end: string;
|
|
30
|
+
id: string;
|
|
31
|
+
language: string;
|
|
32
|
+
lines: string[];
|
|
33
|
+
}
|
|
34
|
+
declare function parseAeneas(data: AeneasFragment): Annotation$1;
|
|
35
|
+
declare function serializeAeneas(annotation: Annotation$1): AeneasFragment;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Configuration options passed to annotation action handlers
|
|
39
|
+
*/
|
|
40
|
+
interface AnnotationActionOptions {
|
|
41
|
+
/** Whether annotation endpoints are linked (moving one endpoint moves the other) */
|
|
42
|
+
linkEndpoints?: boolean;
|
|
43
|
+
/** Whether to continue playing after an annotation ends */
|
|
44
|
+
continuousPlay?: boolean;
|
|
45
|
+
/** Additional custom properties */
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
interface AnnotationAction {
|
|
49
|
+
class?: string;
|
|
50
|
+
text?: string;
|
|
51
|
+
title: string;
|
|
52
|
+
action: (annotation: AnnotationData, index: number, annotations: AnnotationData[], opts: AnnotationActionOptions) => void;
|
|
53
|
+
}
|
|
54
|
+
interface AnnotationData {
|
|
55
|
+
id: string;
|
|
56
|
+
start: number;
|
|
57
|
+
end: number;
|
|
58
|
+
lines: string[];
|
|
59
|
+
language?: string;
|
|
60
|
+
}
|
|
61
|
+
interface AnnotationProps {
|
|
62
|
+
annotation: AnnotationData;
|
|
63
|
+
index: number;
|
|
64
|
+
allAnnotations: AnnotationData[];
|
|
65
|
+
startPosition: number;
|
|
66
|
+
endPosition: number;
|
|
67
|
+
color?: string;
|
|
68
|
+
editable?: boolean;
|
|
69
|
+
controls?: AnnotationAction[];
|
|
70
|
+
onAnnotationUpdate?: (updatedAnnotations: AnnotationData[]) => void;
|
|
71
|
+
annotationListConfig?: AnnotationActionOptions;
|
|
72
|
+
onClick?: (annotation: AnnotationData) => void;
|
|
73
|
+
}
|
|
74
|
+
declare const Annotation: FunctionComponent<AnnotationProps>;
|
|
75
|
+
|
|
76
|
+
interface AnnotationBoxComponentProps {
|
|
77
|
+
annotationId: string;
|
|
78
|
+
annotationIndex: number;
|
|
79
|
+
startPosition: number;
|
|
80
|
+
endPosition: number;
|
|
81
|
+
label?: string;
|
|
82
|
+
color?: string;
|
|
83
|
+
isActive?: boolean;
|
|
84
|
+
onClick?: () => void;
|
|
85
|
+
editable?: boolean;
|
|
86
|
+
}
|
|
87
|
+
declare const AnnotationBox: FunctionComponent<AnnotationBoxComponentProps>;
|
|
88
|
+
|
|
89
|
+
interface AnnotationBoxesWrapperProps {
|
|
90
|
+
className?: string;
|
|
91
|
+
children?: React.ReactNode;
|
|
92
|
+
height?: number;
|
|
93
|
+
offset?: number;
|
|
94
|
+
width?: number;
|
|
95
|
+
}
|
|
96
|
+
declare const AnnotationBoxesWrapper: FunctionComponent<AnnotationBoxesWrapperProps>;
|
|
97
|
+
|
|
98
|
+
interface AnnotationsTrackProps {
|
|
99
|
+
className?: string;
|
|
100
|
+
children?: React.ReactNode;
|
|
101
|
+
height?: number;
|
|
102
|
+
offset?: number;
|
|
103
|
+
width?: number;
|
|
104
|
+
}
|
|
105
|
+
declare const AnnotationsTrack: FunctionComponent<AnnotationsTrackProps>;
|
|
106
|
+
|
|
107
|
+
interface AnnotationTextProps {
|
|
108
|
+
annotations: AnnotationData[];
|
|
109
|
+
activeAnnotationId?: string;
|
|
110
|
+
shouldScrollToActive?: boolean;
|
|
111
|
+
editable?: boolean;
|
|
112
|
+
controls?: AnnotationAction[];
|
|
113
|
+
annotationListConfig?: AnnotationActionOptions;
|
|
114
|
+
height?: number;
|
|
115
|
+
onAnnotationClick?: (annotation: AnnotationData) => void;
|
|
116
|
+
onAnnotationUpdate?: (updatedAnnotations: AnnotationData[]) => void;
|
|
117
|
+
}
|
|
118
|
+
declare const AnnotationText: React.NamedExoticComponent<AnnotationTextProps>;
|
|
119
|
+
|
|
120
|
+
interface ContinuousPlayCheckboxProps {
|
|
121
|
+
checked: boolean;
|
|
122
|
+
onChange: (checked: boolean) => void;
|
|
123
|
+
disabled?: boolean;
|
|
124
|
+
className?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Checkbox control for enabling/disabling continuous play of annotations.
|
|
128
|
+
* When enabled, playback continues from one annotation to the next without stopping.
|
|
129
|
+
*/
|
|
130
|
+
declare const ContinuousPlayCheckbox: React.FC<ContinuousPlayCheckboxProps>;
|
|
131
|
+
|
|
132
|
+
interface LinkEndpointsCheckboxProps {
|
|
133
|
+
checked: boolean;
|
|
134
|
+
onChange: (checked: boolean) => void;
|
|
135
|
+
disabled?: boolean;
|
|
136
|
+
className?: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Checkbox control for enabling/disabling linked endpoints between annotations.
|
|
140
|
+
* When enabled, the end time of one annotation is automatically linked to the start time of the next.
|
|
141
|
+
*/
|
|
142
|
+
declare const LinkEndpointsCheckbox: React.FC<LinkEndpointsCheckboxProps>;
|
|
143
|
+
|
|
144
|
+
interface EditableCheckboxProps {
|
|
145
|
+
checked: boolean;
|
|
146
|
+
onChange: (enabled: boolean) => void;
|
|
147
|
+
className?: string;
|
|
148
|
+
}
|
|
149
|
+
declare const EditableCheckbox: React.FC<EditableCheckboxProps>;
|
|
150
|
+
|
|
151
|
+
interface DownloadAnnotationsButtonProps {
|
|
152
|
+
annotations: Annotation$1[];
|
|
153
|
+
filename?: string;
|
|
154
|
+
disabled?: boolean;
|
|
155
|
+
className?: string;
|
|
156
|
+
children?: React.ReactNode;
|
|
157
|
+
}
|
|
158
|
+
declare const DownloadAnnotationsButton: React.FC<DownloadAnnotationsButtonProps>;
|
|
159
|
+
|
|
160
|
+
interface UseAnnotationControlsOptions {
|
|
161
|
+
initialContinuousPlay?: boolean;
|
|
162
|
+
initialLinkEndpoints?: boolean;
|
|
163
|
+
}
|
|
164
|
+
interface AnnotationUpdateParams {
|
|
165
|
+
annotationIndex: number;
|
|
166
|
+
newTime: number;
|
|
167
|
+
isDraggingStart: boolean;
|
|
168
|
+
annotations: Annotation$1[];
|
|
169
|
+
duration: number;
|
|
170
|
+
linkEndpoints: boolean;
|
|
171
|
+
}
|
|
172
|
+
interface UseAnnotationControlsReturn {
|
|
173
|
+
continuousPlay: boolean;
|
|
174
|
+
linkEndpoints: boolean;
|
|
175
|
+
setContinuousPlay: (value: boolean) => void;
|
|
176
|
+
setLinkEndpoints: (value: boolean) => void;
|
|
177
|
+
updateAnnotationBoundaries: (params: AnnotationUpdateParams) => Annotation$1[];
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Hook for managing annotation control state and boundary logic.
|
|
181
|
+
* Handles continuous play mode and linked endpoints behavior.
|
|
182
|
+
*/
|
|
183
|
+
declare const useAnnotationControls: (options?: UseAnnotationControlsOptions) => UseAnnotationControlsReturn;
|
|
184
|
+
|
|
185
|
+
export { type AeneasFragment, Annotation, type AnnotationAction, type AnnotationActionOptions, AnnotationBox, type AnnotationBoxComponentProps, AnnotationBoxesWrapper, type AnnotationBoxesWrapperProps, type AnnotationData, type AnnotationEventMap, type AnnotationFormat, type AnnotationListOptions, type AnnotationProps, AnnotationText, type AnnotationTextProps, type Annotation$1 as AnnotationType, type AnnotationUpdateParams, AnnotationsTrack, type AnnotationsTrackProps, ContinuousPlayCheckbox, type ContinuousPlayCheckboxProps, DownloadAnnotationsButton, type DownloadAnnotationsButtonProps, EditableCheckbox, type EditableCheckboxProps, LinkEndpointsCheckbox, type LinkEndpointsCheckboxProps, type UseAnnotationControlsOptions, type UseAnnotationControlsReturn, parseAeneas, serializeAeneas, useAnnotationControls };
|