@waveform-playlist/annotations 14.0.0-next.1 → 14.0.0-next.11
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/README.md +16 -9
- package/dist/index.d.mts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +90 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +90 -34
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -6
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Time-synchronized text annotations for waveform-playlist — mark up an audio timeline with editable regions for transcripts, podcast chapters, cue points, or music markers.
|
|
4
4
|
|
|
5
|
-
Used with [`@waveform-playlist/browser`](https://www.npmjs.com/package/@waveform-playlist/browser):
|
|
5
|
+
Used with [`@waveform-playlist/browser`](https://www.npmjs.com/package/@waveform-playlist/browser): make an annotation store with `useCreateAnnotationStore`, pass it as `annotationStore` to `WaveformPlaylistProvider` or `MediaElementPlaylistProvider`, and render `AnnotationProvider` above the view. `<Waveform />` and `<MediaElementWaveform />` then render the annotation boxes and the annotation text list. To give either one an option, compose the view with `<WaveformAnnotationBoxes>` and `<AnnotationList>` from `@waveform-playlist/browser`.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
@@ -20,20 +20,25 @@ Used with [`@waveform-playlist/browser`](https://www.npmjs.com/package/@waveform
|
|
|
20
20
|
npm install @waveform-playlist/annotations
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
Peer dependencies: `react` (^19.0.0), `styled-components` (^6.0.0), `@dnd-kit/react` and `@dnd-kit/dom` (^0.5.0), and `@waveform-playlist/browser` (matching major version).
|
|
23
|
+
Peer dependencies: `react` and `react-dom` (^19.0.0), `styled-components` (^6.0.0), `@dnd-kit/react` and `@dnd-kit/dom` (^0.5.0), and `@waveform-playlist/browser` (matching major version).
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
27
|
```tsx
|
|
28
|
-
import {
|
|
29
|
-
|
|
28
|
+
import {
|
|
29
|
+
WaveformPlaylistProvider,
|
|
30
|
+
Waveform,
|
|
31
|
+
useCreateArrangement,
|
|
32
|
+
useCreateAnnotationStore,
|
|
33
|
+
} from '@waveform-playlist/browser';
|
|
30
34
|
import { audioTrack } from '@waveform-playlist/core';
|
|
31
35
|
import { AnnotationProvider } from '@waveform-playlist/annotations';
|
|
32
36
|
|
|
33
37
|
function AnnotatedPlaylist() {
|
|
34
38
|
const arrangement = useCreateArrangement(() => [audioTrack({ src: '/audio/podcast.mp3', name: 'Podcast' })]);
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
// The owner of the annotations: the boxes, the list and your code change them through it.
|
|
41
|
+
const annotationStore = useCreateAnnotationStore(() => [
|
|
37
42
|
{ id: '1', start: 0, end: 5, lines: ['Introduction'] },
|
|
38
43
|
{ id: '2', start: 5, end: 15, lines: ['Topic Overview'] },
|
|
39
44
|
{ id: '3', start: 15, end: 30, lines: ['Main Discussion'] },
|
|
@@ -42,8 +47,8 @@ function AnnotatedPlaylist() {
|
|
|
42
47
|
return (
|
|
43
48
|
<WaveformPlaylistProvider
|
|
44
49
|
arrangement={arrangement}
|
|
45
|
-
|
|
46
|
-
|
|
50
|
+
annotationStore={annotationStore}
|
|
51
|
+
annotationList={{ editable: true }}
|
|
47
52
|
>
|
|
48
53
|
<AnnotationProvider>
|
|
49
54
|
<Waveform />
|
|
@@ -53,6 +58,8 @@ function AnnotatedPlaylist() {
|
|
|
53
58
|
}
|
|
54
59
|
```
|
|
55
60
|
|
|
61
|
+
Change the annotations with `annotationStore.set(list)` and `annotationStore.update((current) => next)`; read them with `useStoredAnnotations(annotationStore)` (also above the provider) or `useAnnotations()` below it. To save them, subscribe to the store. The store refuses an annotation without finite numeric `start` and `end`, and two annotations with one id (a `TypeError`). See the [Annotations guide](https://naomiaro.github.io/waveform-playlist/docs/react/guides/annotations#the-annotation-store).
|
|
62
|
+
|
|
56
63
|
Each annotation is a plain object:
|
|
57
64
|
|
|
58
65
|
```typescript
|
|
@@ -65,7 +72,7 @@ interface AnnotationData {
|
|
|
65
72
|
}
|
|
66
73
|
```
|
|
67
74
|
|
|
68
|
-
`annotationList`
|
|
75
|
+
`annotationList` holds the annotation options: `editable`, `linkEndpoints` and `isContinuousPlay`. The three options (`editable`, `linkEndpoints`, `isContinuousPlay`) are provider state that follows the prop. Read them with `useAnnotationOptions()` and change them with `setAnnotationsEditable`, `setLinkEndpoints` and `setContinuousPlay` from `usePlaybackControls()`, or render this package's checkboxes:
|
|
69
76
|
|
|
70
77
|
```tsx
|
|
71
78
|
import {
|
|
@@ -104,7 +111,7 @@ Without `AnnotationProvider` the boxes and the list draw nothing. The checkboxes
|
|
|
104
111
|
|
|
105
112
|
The checkboxes take `disabled`, `children` (the label; default "Continuous Play", "Link Endpoints", "Editable Annotations") and `className`. The download button takes `filename` (default `annotations.json`), `children` (the label; default "Download JSON"), `title` (the tooltip; default one of two English sentences), `disabled` and `className`, and is also disabled while there are no annotations. Every string the four controls draw can be supplied by your app. None of the four has a controlled form: `checked`, `onChange` and `annotations` props are not read.
|
|
106
113
|
|
|
107
|
-
`AnnotationText`, `AnnotationBox` and `AnnotationBoxesWrapper` are driven by props, for an annotation UI that does not go through a playlist provider. For a checkbox with a state of your own there, build one from `BaseCheckboxWrapper`, `BaseCheckbox` and `BaseCheckboxLabel` of `@waveform-playlist/ui-components`; move an edge with `updateAnnotationBoundaries` of `@waveform-playlist/core`; save with `annotations.map(serializeAeneas)`.
|
|
114
|
+
`AnnotationText`, `AnnotationBox` and `AnnotationBoxesWrapper` are driven by props, for an annotation UI that does not go through a playlist provider. `AnnotationText` draws its `annotations` and writes its text, id and action edits to its `store` prop (an `AnnotationStore`: `createAnnotationStore` of `@waveform-playlist/core`, or `useCreateAnnotationStore`); without `store` the list is read-only. For a checkbox with a state of your own there, build one from `BaseCheckboxWrapper`, `BaseCheckbox` and `BaseCheckboxLabel` of `@waveform-playlist/ui-components`; move an edge with `updateAnnotationBoundaries` of `@waveform-playlist/core`; save with `annotations.map(serializeAeneas)`.
|
|
108
115
|
|
|
109
116
|
`parseAeneas(fragment)` converts one Aeneas fragment to one annotation, and `serializeAeneas(annotation)` converts one back: `fragments.map(parseAeneas)`.
|
|
110
117
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnnotationData, AnnotationAction, AnnotationActionOptions, RenderAnnotationItemProps } from '@waveform-playlist/core';
|
|
1
|
+
import { AnnotationData, AnnotationAction, AnnotationActionOptions, AnnotationStore, RenderAnnotationItemProps } from '@waveform-playlist/core';
|
|
2
2
|
import React, { FunctionComponent } from 'react';
|
|
3
3
|
|
|
4
4
|
interface AeneasFragment {
|
|
@@ -34,7 +34,8 @@ interface AnnotationBoxesWrapperProps {
|
|
|
34
34
|
declare const AnnotationBoxesWrapper: FunctionComponent<AnnotationBoxesWrapperProps>;
|
|
35
35
|
|
|
36
36
|
interface AnnotationTextProps {
|
|
37
|
-
|
|
37
|
+
/** What the list draws. */
|
|
38
|
+
annotations: readonly AnnotationData[];
|
|
38
39
|
activeAnnotationId?: string;
|
|
39
40
|
shouldScrollToActive?: boolean;
|
|
40
41
|
/** Where to position the active annotation when scrolling: 'center', 'start', 'end', or 'nearest'. Defaults to 'center'. */
|
|
@@ -46,7 +47,15 @@ interface AnnotationTextProps {
|
|
|
46
47
|
annotationListConfig?: AnnotationActionOptions;
|
|
47
48
|
height?: number;
|
|
48
49
|
onAnnotationClick?: (annotation: AnnotationData) => void;
|
|
49
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Where the edits are written (#867): text, id and control edits call
|
|
52
|
+
* `store.update`, find their annotation by id in the store's current list,
|
|
53
|
+
* and a field whose edit was not stored shows the stored value again.
|
|
54
|
+
* `annotations` stays what the list draws. Without `store` the list is
|
|
55
|
+
* read-only: no field can be edited and no control is drawn, whatever
|
|
56
|
+
* `editable` says.
|
|
57
|
+
*/
|
|
58
|
+
store?: AnnotationStore;
|
|
50
59
|
/**
|
|
51
60
|
* Custom render function for annotation items.
|
|
52
61
|
* When provided, completely replaces the default annotation item rendering.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnnotationData, AnnotationAction, AnnotationActionOptions, RenderAnnotationItemProps } from '@waveform-playlist/core';
|
|
1
|
+
import { AnnotationData, AnnotationAction, AnnotationActionOptions, AnnotationStore, RenderAnnotationItemProps } from '@waveform-playlist/core';
|
|
2
2
|
import React, { FunctionComponent } from 'react';
|
|
3
3
|
|
|
4
4
|
interface AeneasFragment {
|
|
@@ -34,7 +34,8 @@ interface AnnotationBoxesWrapperProps {
|
|
|
34
34
|
declare const AnnotationBoxesWrapper: FunctionComponent<AnnotationBoxesWrapperProps>;
|
|
35
35
|
|
|
36
36
|
interface AnnotationTextProps {
|
|
37
|
-
|
|
37
|
+
/** What the list draws. */
|
|
38
|
+
annotations: readonly AnnotationData[];
|
|
38
39
|
activeAnnotationId?: string;
|
|
39
40
|
shouldScrollToActive?: boolean;
|
|
40
41
|
/** Where to position the active annotation when scrolling: 'center', 'start', 'end', or 'nearest'. Defaults to 'center'. */
|
|
@@ -46,7 +47,15 @@ interface AnnotationTextProps {
|
|
|
46
47
|
annotationListConfig?: AnnotationActionOptions;
|
|
47
48
|
height?: number;
|
|
48
49
|
onAnnotationClick?: (annotation: AnnotationData) => void;
|
|
49
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Where the edits are written (#867): text, id and control edits call
|
|
52
|
+
* `store.update`, find their annotation by id in the store's current list,
|
|
53
|
+
* and a field whose edit was not stored shows the stored value again.
|
|
54
|
+
* `annotations` stays what the list draws. Without `store` the list is
|
|
55
|
+
* read-only: no field can be edited and no control is drawn, whatever
|
|
56
|
+
* `editable` says.
|
|
57
|
+
*/
|
|
58
|
+
store?: AnnotationStore;
|
|
50
59
|
/**
|
|
51
60
|
* Custom render function for annotation items.
|
|
52
61
|
* When provided, completely replaces the default annotation item rendering.
|
package/dist/index.js
CHANGED
|
@@ -244,6 +244,39 @@ var AnnotationBoxesWrapper = ({
|
|
|
244
244
|
|
|
245
245
|
// src/components/AnnotationText.tsx
|
|
246
246
|
var import_react2 = __toESM(require("react"));
|
|
247
|
+
|
|
248
|
+
// src/utils/runAnnotationAction.ts
|
|
249
|
+
function copyAnnotation(annotation) {
|
|
250
|
+
return { ...annotation, lines: [...annotation.lines] };
|
|
251
|
+
}
|
|
252
|
+
function sameAnnotation(a, b) {
|
|
253
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
254
|
+
for (const key of keys) {
|
|
255
|
+
const x = a[key];
|
|
256
|
+
const y = b[key];
|
|
257
|
+
if (key === "lines" && Array.isArray(x) && Array.isArray(y)) {
|
|
258
|
+
if (x.length !== y.length || x.some((line, i) => line !== y[i])) return false;
|
|
259
|
+
} else if (x !== y) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
function runAnnotationAction(current, id, control, options) {
|
|
266
|
+
const index = current.findIndex((annotation) => annotation.id === id);
|
|
267
|
+
if (index < 0) return current;
|
|
268
|
+
const copies = current.map(copyAnnotation);
|
|
269
|
+
const originalOf = new Map(copies.map((copy, i) => [copy, current[i]]));
|
|
270
|
+
control.action(copies[index], index, copies, options);
|
|
271
|
+
const result = copies.map((copy) => {
|
|
272
|
+
const original = originalOf.get(copy);
|
|
273
|
+
return original && sameAnnotation(copy, original) ? original : copy;
|
|
274
|
+
});
|
|
275
|
+
const unchanged = result.length === current.length && result.every((annotation, i) => annotation === current[i]);
|
|
276
|
+
return unchanged ? current : result;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// src/components/AnnotationText.tsx
|
|
247
280
|
var import_styled_components3 = __toESM(require("styled-components"));
|
|
248
281
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
249
282
|
var activeColor = (props) => props.theme?.annotationTextItemActiveColor || "#ff9800";
|
|
@@ -402,7 +435,7 @@ var AnnotationListItem = import_react2.default.memo(function AnnotationListItem2
|
|
|
402
435
|
$isEditable: editable,
|
|
403
436
|
contentEditable: editable,
|
|
404
437
|
suppressContentEditableWarning: true,
|
|
405
|
-
onBlur: (e) => onIdEdit(index, e.currentTarget.textContent || ""),
|
|
438
|
+
onBlur: (e) => onIdEdit(index, e.currentTarget.textContent || "", e.currentTarget),
|
|
406
439
|
onKeyDown: blurOnEnter,
|
|
407
440
|
children: annotation.id
|
|
408
441
|
}
|
|
@@ -429,7 +462,7 @@ var AnnotationListItem = import_react2.default.memo(function AnnotationListItem2
|
|
|
429
462
|
$isEditable: editable,
|
|
430
463
|
contentEditable: editable,
|
|
431
464
|
suppressContentEditableWarning: true,
|
|
432
|
-
onBlur: (e) => onTextEdit(index, e.currentTarget.textContent || ""),
|
|
465
|
+
onBlur: (e) => onTextEdit(index, e.currentTarget.textContent || "", e.currentTarget),
|
|
433
466
|
onKeyDown: blurOnEnter,
|
|
434
467
|
children: annotation.lines.join("\n")
|
|
435
468
|
}
|
|
@@ -447,9 +480,12 @@ var AnnotationTextComponent = ({
|
|
|
447
480
|
annotationListConfig,
|
|
448
481
|
height,
|
|
449
482
|
onAnnotationClick,
|
|
450
|
-
|
|
483
|
+
store,
|
|
451
484
|
renderAnnotationItem
|
|
452
485
|
}) => {
|
|
486
|
+
const writable = store !== void 0;
|
|
487
|
+
const fieldsEditable = editable && writable;
|
|
488
|
+
const shownControls = writable ? controls : NO_CONTROLS;
|
|
453
489
|
const activeAnnotationRef = (0, import_react2.useRef)(null);
|
|
454
490
|
(0, import_react2.useEffect)(() => {
|
|
455
491
|
if (activeAnnotationId && activeAnnotationRef.current && shouldScrollToActive) {
|
|
@@ -464,45 +500,65 @@ var AnnotationTextComponent = ({
|
|
|
464
500
|
annotationsRef.current = annotations;
|
|
465
501
|
const annotationListConfigRef = (0, import_react2.useRef)(annotationListConfig);
|
|
466
502
|
annotationListConfigRef.current = annotationListConfig;
|
|
503
|
+
const showStored = (field, stored) => {
|
|
504
|
+
if (stored !== void 0 && field.textContent !== stored) field.textContent = stored;
|
|
505
|
+
};
|
|
467
506
|
const handleTextEdit = (0, import_react2.useCallback)(
|
|
468
|
-
(index, newText) => {
|
|
469
|
-
if (!editable
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
lines
|
|
474
|
-
|
|
475
|
-
|
|
507
|
+
(index, newText, field) => {
|
|
508
|
+
if (!editable) return;
|
|
509
|
+
const id = annotationsRef.current[index]?.id;
|
|
510
|
+
if (store) {
|
|
511
|
+
if (id === void 0) return;
|
|
512
|
+
const lines = newText.split("\n");
|
|
513
|
+
store.update((current) => {
|
|
514
|
+
const at = current.findIndex((a) => a.id === id);
|
|
515
|
+
if (at < 0 || current[at].lines.join("\n") === lines.join("\n")) return current;
|
|
516
|
+
const next = [...current];
|
|
517
|
+
next[at] = { ...current[at], lines };
|
|
518
|
+
return next;
|
|
519
|
+
});
|
|
520
|
+
showStored(
|
|
521
|
+
field,
|
|
522
|
+
store.getAnnotations().find((a) => a.id === id)?.lines.join("\n")
|
|
523
|
+
);
|
|
524
|
+
}
|
|
476
525
|
},
|
|
477
|
-
[editable,
|
|
526
|
+
[editable, store]
|
|
478
527
|
);
|
|
479
528
|
const handleIdEdit = (0, import_react2.useCallback)(
|
|
480
|
-
(index, newId) => {
|
|
481
|
-
if (!editable
|
|
529
|
+
(index, newId, field) => {
|
|
530
|
+
if (!editable) return;
|
|
482
531
|
const trimmedId = newId.trim();
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
532
|
+
const id = annotationsRef.current[index]?.id;
|
|
533
|
+
if (store) {
|
|
534
|
+
if (id === void 0) return;
|
|
535
|
+
if (trimmedId && trimmedId !== id) {
|
|
536
|
+
store.update((current) => {
|
|
537
|
+
const at = current.findIndex((a) => a.id === id);
|
|
538
|
+
if (at < 0 || current.some((a) => a.id === trimmedId)) return current;
|
|
539
|
+
const next = [...current];
|
|
540
|
+
next[at] = { ...current[at], id: trimmedId };
|
|
541
|
+
return next;
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
const list = store.getAnnotations();
|
|
545
|
+
const renamed = !list.some((a) => a.id === id) && list.some((a) => a.id === trimmedId);
|
|
546
|
+
showStored(field, renamed ? trimmedId : id);
|
|
547
|
+
}
|
|
490
548
|
},
|
|
491
|
-
[editable,
|
|
549
|
+
[editable, store]
|
|
492
550
|
);
|
|
493
551
|
const handleControlClick = (0, import_react2.useCallback)(
|
|
494
552
|
(control, index) => {
|
|
495
|
-
if (
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
);
|
|
503
|
-
onAnnotationUpdate(annotationsCopy);
|
|
553
|
+
if (store) {
|
|
554
|
+
const id = annotationsRef.current[index]?.id;
|
|
555
|
+
if (id === void 0) return;
|
|
556
|
+
store.update(
|
|
557
|
+
(current) => runAnnotationAction(current, id, control, annotationListConfigRef.current || {})
|
|
558
|
+
);
|
|
559
|
+
}
|
|
504
560
|
},
|
|
505
|
-
[
|
|
561
|
+
[store]
|
|
506
562
|
);
|
|
507
563
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(Container2, { $height: height, children: annotations.map((annotation, index) => {
|
|
508
564
|
const isActive = annotation.id === activeAnnotationId;
|
|
@@ -513,8 +569,8 @@ var AnnotationTextComponent = ({
|
|
|
513
569
|
index,
|
|
514
570
|
isActive,
|
|
515
571
|
itemRef: isActive ? activeAnnotationRef : void 0,
|
|
516
|
-
editable,
|
|
517
|
-
controls,
|
|
572
|
+
editable: fieldsEditable,
|
|
573
|
+
controls: shownControls,
|
|
518
574
|
onAnnotationClick,
|
|
519
575
|
onTextEdit: handleTextEdit,
|
|
520
576
|
onIdEdit: handleIdEdit,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/parsers/aeneas.ts","../src/components/AnnotationBox.tsx","../src/components/AnnotationBoxesWrapper.tsx","../src/components/AnnotationText.tsx","../src/components/AnnotationCheckboxes.tsx","../src/components/DownloadAnnotationsButton.tsx","../src/AnnotationProvider.tsx"],"sourcesContent":["// Parsers\nexport { parseAeneas, serializeAeneas } from './parsers/aeneas';\nexport type { AeneasFragment } from './parsers/aeneas';\n\n// Components\nexport { AnnotationBox } from './components/AnnotationBox';\nexport type { AnnotationBoxComponentProps } from './components/AnnotationBox';\n\nexport { AnnotationBoxesWrapper } from './components/AnnotationBoxesWrapper';\nexport type { AnnotationBoxesWrapperProps } from './components/AnnotationBoxesWrapper';\n\nexport { AnnotationText } from './components/AnnotationText';\nexport type { AnnotationTextProps } from './components/AnnotationText';\n\n// Controls, bound to the playlist provider above them\nexport {\n ContinuousPlayCheckbox,\n LinkEndpointsCheckbox,\n EditableCheckbox,\n} from './components/AnnotationCheckboxes';\nexport type { AnnotationCheckboxProps } from './components/AnnotationCheckboxes';\n\nexport { DownloadAnnotationsButton } from './components/DownloadAnnotationsButton';\nexport type { DownloadAnnotationsButtonProps } from './components/DownloadAnnotationsButton';\n\n// Provider (hands the box and list components to the browser package's views)\nexport { AnnotationProvider } from './AnnotationProvider';\n","import type { AnnotationData } from '@waveform-playlist/core';\n\nexport interface AeneasFragment {\n begin: string;\n end: string;\n id: string;\n language: string;\n lines: string[];\n}\n\nexport function parseAeneas(data: AeneasFragment): AnnotationData {\n return {\n id: data.id,\n start: parseFloat(data.begin),\n end: parseFloat(data.end),\n lines: data.lines,\n language: data.language,\n };\n}\n\nexport function serializeAeneas(annotation: AnnotationData): AeneasFragment {\n return {\n id: annotation.id,\n begin: annotation.start.toFixed(3),\n end: annotation.end.toFixed(3),\n lines: annotation.lines,\n language: annotation.language || 'en',\n };\n}\n","import React, { FunctionComponent } from 'react';\nimport styled from 'styled-components';\nimport { useDraggable } from '@dnd-kit/react';\nimport { Feedback } from '@dnd-kit/dom';\n\n// Per-entity Feedback plugin config (@dnd-kit 0.5+), hoisted for a stable\n// reference. 'none' disables the Feedback plugin for the edge handles — resize\n// visual feedback comes from React state repositioning the annotation, not CSS\n// translate. Declared on the entity so it works inside ANY DragDropProvider.\nconst EDGE_HANDLE_PLUGINS = [Feedback.configure({ feedback: 'none' })];\n\ninterface WrapperProps {\n readonly $left: number;\n readonly $width: number;\n}\n\n// Wrapper positions the annotation and contains both Box and ResizeHandles as siblings\nconst Wrapper = styled.div.attrs<WrapperProps>((props) => ({\n style: {\n left: `${props.$left}px`,\n width: `${props.$width}px`,\n },\n}))<WrapperProps>`\n position: absolute;\n top: 0;\n height: 100%;\n pointer-events: none; /* Let events pass through to children */\n`;\n\ninterface BoxProps {\n readonly $color: string;\n readonly $isActive?: boolean;\n}\n\nconst Box = styled.div<BoxProps>`\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background: ${(props) =>\n props.$isActive\n ? props.theme?.annotationBoxActiveBackground || 'rgba(255, 200, 100, 0.95)'\n : props.theme?.annotationBoxBackground || 'rgba(255, 255, 255, 0.85)'};\n border: ${(props) => (props.$isActive ? '3px' : '2px')} solid\n ${(props) =>\n props.$isActive ? props.theme?.annotationBoxActiveBorder || '#ff9800' : props.$color};\n border-radius: 4px;\n cursor: pointer;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: all 0.2s ease;\n box-shadow: ${(props) =>\n props.$isActive\n ? // The glow of the active box is the box colour (the theme's\n // `annotationBoxBorder`, through the `color` prop) at 40% and 20%.\n `0 2px 8px color-mix(in srgb, ${props.$color} 40%, transparent), inset 0 0 0 1px color-mix(in srgb, ${props.$color} 20%, transparent)`\n : '0 1px 3px rgba(0, 0, 0, 0.1)'};\n\n &:hover {\n background: ${(props) =>\n props.theme?.annotationBoxHoverBackground || 'rgba(255, 255, 255, 0.98)'};\n border-color: ${(props) => props.theme?.annotationBoxActiveBorder || '#ff9800'};\n border-width: 3px;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n }\n`;\n\nconst Label = styled.span`\n font-size: 12px;\n font-weight: 600;\n color: ${(props) => props.theme?.annotationLabelColor || '#2a2a2a'};\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: 0 6px;\n letter-spacing: 0.3px;\n user-select: none;\n`;\n\ninterface ResizeHandleStyledProps {\n $position: 'left' | 'right';\n $isDragging?: boolean;\n}\n\n// ResizeHandles sit inside their annotation's bounds so adjacent annotations'\n// handles never overlap — each handle is independently grabbable.\nconst ResizeHandle = styled.div<ResizeHandleStyledProps>`\n position: absolute;\n top: 0;\n ${(props) => (props.$position === 'left' ? 'left: 0' : 'right: 0')};\n width: 8px;\n height: 100%;\n cursor: ew-resize;\n z-index: 120;\n background: ${(props) =>\n props.$isDragging\n ? props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.2)'\n : 'transparent'};\n border-radius: 4px;\n touch-action: none; /* Important for @dnd-kit on touch devices */\n pointer-events: auto;\n\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 4px;\n height: 60%;\n background: ${(props) =>\n props.$isDragging\n ? props.theme?.annotationResizeHandleActiveColor || 'rgba(0, 0, 0, 0.8)'\n : props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.4)'};\n border-radius: 2px;\n opacity: ${(props) => (props.$isDragging ? 1 : 0.6)};\n transition:\n opacity 0.2s,\n background 0.2s;\n }\n\n &:hover {\n background: ${(props) => props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.1)'};\n }\n\n &:hover::before {\n opacity: 1;\n background: ${(props) =>\n props.theme?.annotationResizeHandleActiveColor || 'rgba(0, 0, 0, 0.7)'};\n }\n`;\n\nexport interface AnnotationBoxComponentProps {\n annotationId: string;\n annotationIndex: number;\n startPosition: number;\n endPosition: number;\n label?: string;\n color?: string;\n isActive?: boolean;\n onClick?: () => void;\n editable?: boolean; // Whether to show drag handles\n}\n\nexport const AnnotationBox: FunctionComponent<AnnotationBoxComponentProps> = ({\n annotationId,\n annotationIndex,\n startPosition,\n endPosition,\n label,\n color = '#ff9800',\n isActive = false,\n onClick,\n editable = true,\n}) => {\n const width = Math.max(0, endPosition - startPosition);\n\n // Left (start) boundary draggable\n const leftBoundaryId = `annotation-boundary-start-${annotationIndex}`;\n const { ref: leftRef, isDragSource: isLeftDragging } = useDraggable({\n id: leftBoundaryId,\n data: { annotationId, annotationIndex, edge: 'start' as const },\n disabled: !editable,\n plugins: EDGE_HANDLE_PLUGINS,\n });\n\n // Right (end) boundary draggable\n const rightBoundaryId = `annotation-boundary-end-${annotationIndex}`;\n const { ref: rightRef, isDragSource: isRightDragging } = useDraggable({\n id: rightBoundaryId,\n data: { annotationId, annotationIndex, edge: 'end' as const },\n disabled: !editable,\n plugins: EDGE_HANDLE_PLUGINS,\n });\n\n if (width <= 0) {\n return null;\n }\n\n const handleHandleClick = (e: React.MouseEvent) => {\n // Prevent clicks on resize handles from bubbling to annotation box\n e.stopPropagation();\n };\n\n return (\n <Wrapper $left={startPosition} $width={width}>\n <Box $color={color} $isActive={isActive} onClick={onClick}>\n {label && <Label>{label}</Label>}\n </Box>\n {editable && (\n <ResizeHandle\n ref={leftRef}\n $position=\"left\"\n $isDragging={isLeftDragging}\n onClick={handleHandleClick}\n />\n )}\n {editable && (\n <ResizeHandle\n ref={rightRef}\n $position=\"right\"\n $isDragging={isRightDragging}\n onClick={handleHandleClick}\n />\n )}\n </Wrapper>\n );\n};\n","import React, { FunctionComponent } from 'react';\nimport styled from 'styled-components';\n\ninterface ContainerProps {\n readonly $height: number;\n readonly $width?: number;\n}\n\nconst Container = styled.div.attrs<ContainerProps>((props) => ({\n style: {\n height: `${props.$height}px`,\n width: props.$width !== undefined ? `${props.$width}px` : undefined,\n },\n}))<ContainerProps>`\n position: relative;\n background: transparent;\n z-index: 110;\n`;\n\nconst BoxesContainer = styled.div<{ $offset?: number }>`\n position: relative;\n height: 100%;\n padding-left: ${(props) => props.$offset || 0}px;\n`;\n\nexport interface AnnotationBoxesWrapperProps {\n className?: string;\n children?: React.ReactNode;\n height?: number;\n offset?: number;\n width?: number;\n}\n\nexport const AnnotationBoxesWrapper: FunctionComponent<AnnotationBoxesWrapperProps> = ({\n children,\n className,\n height = 30,\n offset = 0,\n width,\n}) => {\n return (\n <Container className={className} $height={height} $width={width}>\n <BoxesContainer $offset={offset}>{children}</BoxesContainer>\n </Container>\n );\n};\n","import React, { FunctionComponent, useCallback, useRef, useEffect } from 'react';\nimport styled from 'styled-components';\nimport type {\n AnnotationData,\n AnnotationAction,\n AnnotationActionOptions,\n RenderAnnotationItemProps,\n} from '@waveform-playlist/core';\n\ninterface ContainerProps {\n $height?: number;\n}\n\n/** The colour of the active row and of the focus rings (theme: `annotationTextItemActiveColor`). */\nconst activeColor = (props: { theme?: { annotationTextItemActiveColor?: string } }) =>\n props.theme?.annotationTextItemActiveColor || '#ff9800';\n/** That colour at an opacity, as the tints and glows of the active row use it. */\nconst activeTint = (percent: number) => (props: Parameters<typeof activeColor>[0]) =>\n `color-mix(in srgb, ${activeColor(props)} ${percent}%, transparent)`;\n\nconst Container = styled.div<ContainerProps>`\n background: ${(props) => props.theme?.backgroundColor || '#fff'};\n ${(props) => (props.$height ? `height: ${props.$height}px;` : 'max-height: 200px;')}\n overflow-y: auto;\n padding: 8px;\n`;\n\nconst AnnotationItem = styled.div<{ $isActive?: boolean }>`\n padding: 12px;\n margin-bottom: 6px;\n border-left: 4px solid ${(props) => (props.$isActive ? activeColor(props) : 'transparent')};\n background: ${(props) => (props.$isActive ? activeTint(15)(props) : 'transparent')};\n border-radius: 4px;\n transition: all 0.2s;\n cursor: pointer;\n box-shadow: ${(props) =>\n props.$isActive\n ? `0 2px 8px ${activeTint(25)(props)}, inset 0 0 0 1px ${activeTint(30)(props)}`\n : 'none'};\n\n &:hover {\n background: ${(props) =>\n props.$isActive\n ? activeTint(20)(props)\n : props.theme?.annotationTextItemHoverBackground || 'rgba(0, 0, 0, 0.05)'};\n border-left-color: ${(props) =>\n props.$isActive ? activeColor(props) : props.theme?.borderColor || '#ddd'};\n }\n\n &:focus-visible {\n outline: 2px solid ${activeColor};\n outline-offset: 2px;\n }\n`;\n\nconst AnnotationHeader = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n`;\n\nconst AnnotationInfo = styled.div`\n display: flex;\n align-items: center;\n gap: 8px;\n`;\n\nconst AnnotationIdLabel = styled.span<{ $isEditable?: boolean }>`\n font-size: 11px;\n font-weight: 600;\n color: ${(props) => props.theme?.textColorMuted || '#666'};\n background: transparent;\n padding: 2px 6px;\n border-radius: 3px;\n min-width: 20px;\n outline: ${(props) =>\n props.$isEditable ? `1px dashed ${props.theme?.borderColor || '#ddd'}` : 'none'};\n\n &[contenteditable='true']:focus {\n outline: 2px solid ${activeColor};\n background: ${activeTint(10)};\n }\n`;\n\nconst TimeRange = styled.span`\n font-size: 12px;\n font-weight: 500;\n color: ${(props) => props.theme?.textColorMuted || '#555'};\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n letter-spacing: 0.5px;\n`;\n\nconst AnnotationControls = styled.div`\n display: flex;\n gap: 6px;\n`;\n\nconst ControlButton = styled.button`\n background: ${(props) => props.theme?.surfaceColor || '#f5f5f5'};\n border: 1px solid ${(props) => props.theme?.borderColor || '#ccc'};\n color: ${(props) => props.theme?.textColor || '#333'};\n padding: 4px 8px;\n font-size: 14px;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.15s ease;\n\n &:hover {\n background: ${(props) => props.theme?.inputBackground || '#3d3d3d'};\n border-color: ${(props) => props.theme?.textColorMuted || '#999'};\n transform: scale(1.05);\n }\n\n &:active {\n transform: scale(0.95);\n }\n`;\n\nconst AnnotationTextContent = styled.div<{ $isEditable?: boolean }>`\n font-size: 14px;\n line-height: 1.6;\n color: ${(props) => props.theme?.textColor || '#2a2a2a'};\n white-space: pre-wrap;\n word-break: break-word;\n outline: ${(props) =>\n props.$isEditable ? `1px dashed ${props.theme?.borderColor || '#ddd'}` : 'none'};\n padding: ${(props) => (props.$isEditable ? '6px' : '0')};\n border-radius: 3px;\n min-height: 20px;\n\n &[contenteditable='true']:focus {\n outline: 2px solid ${activeColor};\n background: ${activeTint(10)};\n }\n`;\n\nexport interface AnnotationTextProps {\n annotations: AnnotationData[];\n activeAnnotationId?: string;\n shouldScrollToActive?: boolean;\n /** Where to position the active annotation when scrolling: 'center', 'start', 'end', or 'nearest'. Defaults to 'center'. */\n scrollActivePosition?: ScrollLogicalPosition;\n /** Which scrollable containers to scroll: 'nearest' (only the annotation list) or 'all' (including viewport). Defaults to 'nearest'. */\n scrollActiveContainer?: 'nearest' | 'all';\n editable?: boolean;\n controls?: AnnotationAction[];\n annotationListConfig?: AnnotationActionOptions;\n height?: number;\n onAnnotationClick?: (annotation: AnnotationData) => void;\n onAnnotationUpdate?: (updatedAnnotations: AnnotationData[]) => void;\n /**\n * Custom render function for annotation items.\n * When provided, completely replaces the default annotation item rendering.\n * Use this to customize the appearance of each annotation in the list.\n */\n renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;\n}\n\nconst NO_CONTROLS: AnnotationAction[] = [];\n\nconst formatTime = (seconds: number): string => {\n if (isNaN(seconds) || !isFinite(seconds)) {\n return '0:00.000';\n }\n const mins = Math.floor(seconds / 60);\n const secs = (seconds % 60).toFixed(3);\n return `${mins}:${secs.padStart(6, '0')}`;\n};\n\nconst getIconClass = (classString: string) => {\n return classString.replace(/\\./g, ' ');\n};\n\nconst blurOnEnter = (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.currentTarget.blur();\n }\n};\n\ninterface AnnotationListItemProps {\n annotation: AnnotationData;\n index: number;\n isActive: boolean;\n /** Set on the active item only, so the list can scroll to it. */\n itemRef?: React.Ref<HTMLDivElement>;\n editable: boolean;\n controls: AnnotationAction[];\n onAnnotationClick?: (annotation: AnnotationData) => void;\n onTextEdit: (index: number, newText: string) => void;\n onIdEdit: (index: number, newId: string) => void;\n onControlClick: (control: AnnotationAction, index: number) => void;\n renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;\n}\n\n/**\n * One row of the list. Memoized: the active annotation changes at every\n * annotation boundary during playback, and only the row that stops being\n * active and the row that becomes active have a changed prop (#740). Every\n * function handed to it must therefore keep its identity across a render of\n * the list that did not change it.\n */\nconst AnnotationListItem = React.memo(function AnnotationListItem({\n annotation,\n index,\n isActive,\n itemRef,\n editable,\n controls,\n onAnnotationClick,\n onTextEdit,\n onIdEdit,\n onControlClick,\n renderAnnotationItem,\n}: AnnotationListItemProps) {\n const handleClick = () => onAnnotationClick?.(annotation);\n // The default row: a click in a field that is being edited places the\n // caret, it does not choose the annotation. (The action buttons stop their\n // own clicks.)\n const handleRowClick = (event: React.MouseEvent<HTMLElement>) => {\n const target = event.target as Element | null;\n if (target?.closest?.('[contenteditable=\"true\"]')) return;\n handleClick();\n };\n\n // Use custom render function if provided\n if (renderAnnotationItem) {\n return (\n <div ref={itemRef}>\n {renderAnnotationItem({\n annotation,\n index,\n isActive,\n onClick: handleClick,\n formatTime,\n })}\n </div>\n );\n }\n\n // Default rendering\n return (\n <AnnotationItem ref={itemRef} $isActive={isActive} onClick={handleRowClick}>\n <AnnotationHeader>\n <AnnotationInfo>\n <AnnotationIdLabel\n $isEditable={editable}\n contentEditable={editable}\n suppressContentEditableWarning\n onBlur={(e) => onIdEdit(index, e.currentTarget.textContent || '')}\n onKeyDown={blurOnEnter}\n >\n {annotation.id}\n </AnnotationIdLabel>\n <TimeRange>\n {formatTime(annotation.start)} - {formatTime(annotation.end)}\n </TimeRange>\n </AnnotationInfo>\n {controls.length > 0 && (\n <AnnotationControls onClick={(e) => e.stopPropagation()}>\n {controls.map((control, idx) => (\n <ControlButton\n key={idx}\n title={control.title}\n onClick={() => onControlClick(control, index)}\n >\n {control.text ? control.text : <i className={getIconClass(control.class || '')} />}\n </ControlButton>\n ))}\n </AnnotationControls>\n )}\n </AnnotationHeader>\n <AnnotationTextContent\n $isEditable={editable}\n contentEditable={editable}\n suppressContentEditableWarning\n onBlur={(e) => onTextEdit(index, e.currentTarget.textContent || '')}\n onKeyDown={blurOnEnter}\n >\n {annotation.lines.join('\\n')}\n </AnnotationTextContent>\n </AnnotationItem>\n );\n});\n\nconst AnnotationTextComponent: FunctionComponent<AnnotationTextProps> = ({\n annotations,\n activeAnnotationId,\n shouldScrollToActive = false,\n scrollActivePosition = 'center',\n scrollActiveContainer = 'nearest',\n editable = false,\n controls = NO_CONTROLS,\n annotationListConfig,\n height,\n onAnnotationClick,\n onAnnotationUpdate,\n renderAnnotationItem,\n}) => {\n const activeAnnotationRef = useRef<HTMLDivElement>(null);\n\n // Auto-scroll to active annotation when it changes\n useEffect(() => {\n // Only scroll if parent says we should (prevents scrolling on remount after pause)\n if (activeAnnotationId && activeAnnotationRef.current && shouldScrollToActive) {\n activeAnnotationRef.current.scrollIntoView({\n behavior: 'smooth',\n block: scrollActivePosition,\n container: scrollActiveContainer,\n } as ScrollIntoViewOptions);\n }\n }, [activeAnnotationId, shouldScrollToActive, scrollActivePosition, scrollActiveContainer]);\n\n // The three handlers below are props of every memoized row. Their\n // dependencies do not change when only the active annotation does.\n // The handlers below are props of every memoized row. They read the list\n // through a ref so that a change to one annotation (each move of an edge\n // drag) re-renders that annotation's row and not all of them.\n const annotationsRef = useRef(annotations);\n annotationsRef.current = annotations;\n // The options an action is called with are only needed when its button is\n // pressed. Read through a ref, a change of them (a link-endpoints or\n // continuous-play toggle) does not give every row a new handler.\n const annotationListConfigRef = useRef(annotationListConfig);\n annotationListConfigRef.current = annotationListConfig;\n\n const handleTextEdit = useCallback(\n (index: number, newText: string) => {\n if (!editable || !onAnnotationUpdate) return;\n\n const updatedAnnotations = [...annotationsRef.current];\n updatedAnnotations[index] = {\n ...updatedAnnotations[index],\n lines: newText.split('\\n'),\n };\n onAnnotationUpdate(updatedAnnotations);\n },\n [editable, onAnnotationUpdate]\n );\n\n const handleIdEdit = useCallback(\n (index: number, newId: string) => {\n if (!editable || !onAnnotationUpdate) return;\n\n const trimmedId = newId.trim();\n if (!trimmedId) return; // Don't allow empty IDs\n\n const updatedAnnotations = [...annotationsRef.current];\n updatedAnnotations[index] = {\n ...updatedAnnotations[index],\n id: trimmedId,\n };\n onAnnotationUpdate(updatedAnnotations);\n },\n [editable, onAnnotationUpdate]\n );\n\n const handleControlClick = useCallback(\n (control: AnnotationAction, index: number) => {\n if (!onAnnotationUpdate) return;\n\n const annotationsCopy = [...annotationsRef.current];\n control.action(\n annotationsCopy[index],\n index,\n annotationsCopy,\n annotationListConfigRef.current || {}\n );\n onAnnotationUpdate(annotationsCopy);\n },\n [onAnnotationUpdate]\n );\n\n return (\n <Container $height={height}>\n {annotations.map((annotation, index) => {\n const isActive = annotation.id === activeAnnotationId;\n return (\n <AnnotationListItem\n key={annotation.id}\n annotation={annotation}\n index={index}\n isActive={isActive}\n itemRef={isActive ? activeAnnotationRef : undefined}\n editable={editable}\n controls={controls}\n onAnnotationClick={onAnnotationClick}\n onTextEdit={handleTextEdit}\n onIdEdit={handleIdEdit}\n onControlClick={handleControlClick}\n renderAnnotationItem={renderAnnotationItem}\n />\n );\n })}\n </Container>\n );\n};\n\n// Memoize to prevent unnecessary remounting when parent re-renders\nexport const AnnotationText = React.memo(AnnotationTextComponent);\n","import React, { useId } from 'react';\nimport {\n BaseCheckboxWrapper,\n BaseCheckbox,\n BaseCheckboxLabel,\n} from '@waveform-playlist/ui-components';\nimport { useAnnotationOptions, usePlaybackControls } from '@waveform-playlist/browser';\n\nexport interface AnnotationCheckboxProps {\n /** On the element that wraps the checkbox and its label. */\n className?: string;\n disabled?: boolean;\n /** The label. Default (also for `null`): the option's English name. */\n children?: React.ReactNode;\n}\n\ninterface OptionCheckboxProps extends AnnotationCheckboxProps {\n checked: boolean;\n onChange: (checked: boolean) => void;\n /** Class of the input itself (kept from the older checkboxes). */\n inputClassName?: string;\n}\n\nconst OptionCheckbox: React.FC<OptionCheckboxProps> = ({\n checked,\n onChange,\n inputClassName,\n className,\n disabled,\n children,\n}) => {\n // Generated: two of one checkbox on a page must not share an id.\n const id = useId();\n return (\n <BaseCheckboxWrapper className={className}>\n <BaseCheckbox\n type=\"checkbox\"\n id={id}\n className={inputClassName}\n checked={checked}\n onChange={(e) => onChange(e.target.checked)}\n disabled={disabled}\n />\n <BaseCheckboxLabel htmlFor={id}>{children}</BaseCheckboxLabel>\n </BaseCheckboxWrapper>\n );\n};\n\n// In each control the props it was given come first and the bound ones after,\n// so a `checked` or `onChange` left over from the controlled form these names\n// had before cannot replace the provider's.\n\n/**\n * Shows and sets the provider's `continuousPlay` option: on, playback runs on\n * through the following annotations. Under either playlist provider.\n */\nexport const ContinuousPlayCheckbox: React.FC<AnnotationCheckboxProps> = ({\n children,\n ...rest\n}) => {\n const { continuousPlay } = useAnnotationOptions();\n const { setContinuousPlay } = usePlaybackControls();\n return (\n <OptionCheckbox\n {...rest}\n checked={continuousPlay}\n onChange={setContinuousPlay}\n inputClassName=\"continuous-play\"\n >\n {children ?? 'Continuous Play'}\n </OptionCheckbox>\n );\n};\n\n/**\n * Shows and sets the provider's `linkEndpoints` option: on, a dragged edge\n * takes the edge it touches along. Under either playlist provider.\n */\nexport const LinkEndpointsCheckbox: React.FC<AnnotationCheckboxProps> = ({ children, ...rest }) => {\n const { linkEndpoints } = useAnnotationOptions();\n const { setLinkEndpoints } = usePlaybackControls();\n return (\n <OptionCheckbox\n {...rest}\n checked={linkEndpoints}\n onChange={setLinkEndpoints}\n inputClassName=\"link-endpoints\"\n >\n {children ?? 'Link Endpoints'}\n </OptionCheckbox>\n );\n};\n\n/**\n * Shows and sets the provider's `editable` option: whether annotation edges\n * and text can be changed. Under either playlist provider.\n */\nexport const EditableCheckbox: React.FC<AnnotationCheckboxProps> = ({ children, ...rest }) => {\n const { editable } = useAnnotationOptions();\n const { setAnnotationsEditable } = usePlaybackControls();\n return (\n <OptionCheckbox {...rest} checked={editable} onChange={setAnnotationsEditable}>\n {children ?? 'Editable Annotations'}\n </OptionCheckbox>\n );\n};\n","import React from 'react';\nimport styled from 'styled-components';\nimport { useAnnotations } from '@waveform-playlist/browser';\nimport { serializeAeneas } from '../parsers/aeneas';\n\nconst StyledButton = styled.button`\n padding: 0.5rem 1rem;\n background: ${(props) => props.theme?.surfaceColor || '#f5f5f5'};\n color: ${(props) => props.theme?.textColor || '#333'};\n border: 1px solid ${(props) => props.theme?.borderColor || '#ccc'};\n border-radius: ${(props) => props.theme?.borderRadius || '4px'};\n cursor: pointer;\n font-family: ${(props) => props.theme?.fontFamily || 'inherit'};\n font-size: ${(props) => props.theme?.fontSize || '14px'};\n font-weight: 500;\n transition: all 0.15s ease;\n\n &:hover:not(:disabled) {\n background: ${(props) => props.theme?.inputBackground || '#3d3d3d'};\n border-color: ${(props) => props.theme?.textColorMuted || '#999'};\n }\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ${(props) => props.theme?.inputFocusBorder || '#007bff'}44;\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n`;\n\nexport interface DownloadAnnotationsButtonProps {\n /** Name of the downloaded file. Default: `annotations.json`. */\n filename?: string;\n disabled?: boolean;\n className?: string;\n /** The label. Default: `Download JSON`. */\n children?: React.ReactNode;\n /**\n * The tooltip. Default: an English sentence, a different one when there is\n * nothing to download. Given, it is used in both cases.\n */\n title?: string;\n}\n\n/**\n * Downloads the provider's annotations as an array of Aeneas fragments.\n * Under either playlist provider.\n */\nexport const DownloadAnnotationsButton: React.FC<DownloadAnnotationsButtonProps> = ({\n filename = 'annotations.json',\n disabled = false,\n className,\n children = 'Download JSON',\n title,\n}) => {\n const { annotations } = useAnnotations();\n const handleDownload = () => {\n // Serialize annotations to Aeneas JSON format\n const jsonData = annotations.map((annotation) => serializeAeneas(annotation));\n const jsonString = JSON.stringify(jsonData, null, 2);\n\n // Create a blob and download link\n const blob = new Blob([jsonString], { type: 'application/json' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n\n // Trigger download\n document.body.appendChild(link);\n link.click();\n\n // Cleanup\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n return (\n <StyledButton\n onClick={handleDownload}\n disabled={disabled || annotations.length === 0}\n className={className}\n title={\n title ??\n (annotations.length === 0\n ? 'No annotations to download'\n : 'Download the annotations as JSON')\n }\n >\n {children}\n </StyledButton>\n );\n};\n","import React from 'react';\nimport { AnnotationIntegrationProvider } from '@waveform-playlist/browser';\nimport type { AnnotationIntegration } from '@waveform-playlist/browser';\nimport { parseAeneas, serializeAeneas } from './parsers/aeneas';\nimport { AnnotationText } from './components/AnnotationText';\nimport { AnnotationBox } from './components/AnnotationBox';\nimport { AnnotationBoxesWrapper } from './components/AnnotationBoxesWrapper';\n\nconst annotationIntegration: AnnotationIntegration = {\n parseAeneas: parseAeneas as (data: unknown) => import('@waveform-playlist/core').AnnotationData,\n serializeAeneas: serializeAeneas as (\n annotation: import('@waveform-playlist/core').AnnotationData\n ) => unknown,\n AnnotationText,\n AnnotationBox,\n AnnotationBoxesWrapper,\n};\n\nexport const AnnotationProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n return (\n <AnnotationIntegrationProvider value={annotationIntegration}>\n {children}\n </AnnotationIntegrationProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUO,SAAS,YAAY,MAAsC;AAChE,SAAO;AAAA,IACL,IAAI,KAAK;AAAA,IACT,OAAO,WAAW,KAAK,KAAK;AAAA,IAC5B,KAAK,WAAW,KAAK,GAAG;AAAA,IACxB,OAAO,KAAK;AAAA,IACZ,UAAU,KAAK;AAAA,EACjB;AACF;AAEO,SAAS,gBAAgB,YAA4C;AAC1E,SAAO;AAAA,IACL,IAAI,WAAW;AAAA,I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AS;AAAA,MACT,UAAU,YAAY,YAAY,WAAW;AAAA,MAC7C;AAAA,MACA,OACE,UACC,YAAY,WAAW,IACpB,+BACA;AAAA,MAGL;AAAA;AAAA,EACH;AAEJ;;;AC9FA,IAAAC,kBAA8C;AAmB1C,IAAAC,sBAAA;AAZJ,IAAM,wBAA+C;AAAA,EACnD;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,qBAA8D,CAAC,EAAE,SAAS,MAAM;AAC3F,SACE,6CAAC,iDAA8B,OAAO,uBACnC,UACH;AAEJ;","names":["styled","import_styled_components","import_jsx_runtime","styled","import_react","import_styled_components","import_jsx_runtime","Container","styled","React","AnnotationListItem","import_react","import_jsx_runtime","import_styled_components","import_browser","import_jsx_runtime","styled","import_browser","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/parsers/aeneas.ts","../src/components/AnnotationBox.tsx","../src/components/AnnotationBoxesWrapper.tsx","../src/components/AnnotationText.tsx","../src/utils/runAnnotationAction.ts","../src/components/AnnotationCheckboxes.tsx","../src/components/DownloadAnnotationsButton.tsx","../src/AnnotationProvider.tsx"],"sourcesContent":["// Parsers\nexport { parseAeneas, serializeAeneas } from './parsers/aeneas';\nexport type { AeneasFragment } from './parsers/aeneas';\n\n// Components\nexport { AnnotationBox } from './components/AnnotationBox';\nexport type { AnnotationBoxComponentProps } from './components/AnnotationBox';\n\nexport { AnnotationBoxesWrapper } from './components/AnnotationBoxesWrapper';\nexport type { AnnotationBoxesWrapperProps } from './components/AnnotationBoxesWrapper';\n\nexport { AnnotationText } from './components/AnnotationText';\nexport type { AnnotationTextProps } from './components/AnnotationText';\n\n// Controls, bound to the playlist provider above them\nexport {\n ContinuousPlayCheckbox,\n LinkEndpointsCheckbox,\n EditableCheckbox,\n} from './components/AnnotationCheckboxes';\nexport type { AnnotationCheckboxProps } from './components/AnnotationCheckboxes';\n\nexport { DownloadAnnotationsButton } from './components/DownloadAnnotationsButton';\nexport type { DownloadAnnotationsButtonProps } from './components/DownloadAnnotationsButton';\n\n// Provider (hands the box and list components to the browser package's views)\nexport { AnnotationProvider } from './AnnotationProvider';\n","import type { AnnotationData } from '@waveform-playlist/core';\n\nexport interface AeneasFragment {\n begin: string;\n end: string;\n id: string;\n language: string;\n lines: string[];\n}\n\nexport function parseAeneas(data: AeneasFragment): AnnotationData {\n return {\n id: data.id,\n start: parseFloat(data.begin),\n end: parseFloat(data.end),\n lines: data.lines,\n language: data.language,\n };\n}\n\nexport function serializeAeneas(annotation: AnnotationData): AeneasFragment {\n return {\n id: annotation.id,\n begin: annotation.start.toFixed(3),\n end: annotation.end.toFixed(3),\n lines: annotation.lines,\n language: annotation.language || 'en',\n };\n}\n","import React, { FunctionComponent } from 'react';\nimport styled from 'styled-components';\nimport { useDraggable } from '@dnd-kit/react';\nimport { Feedback } from '@dnd-kit/dom';\n\n// Per-entity Feedback plugin config (@dnd-kit 0.5+), hoisted for a stable\n// reference. 'none' disables the Feedback plugin for the edge handles — resize\n// visual feedback comes from React state repositioning the annotation, not CSS\n// translate. Declared on the entity so it works inside ANY DragDropProvider.\nconst EDGE_HANDLE_PLUGINS = [Feedback.configure({ feedback: 'none' })];\n\ninterface WrapperProps {\n readonly $left: number;\n readonly $width: number;\n}\n\n// Wrapper positions the annotation and contains both Box and ResizeHandles as siblings\nconst Wrapper = styled.div.attrs<WrapperProps>((props) => ({\n style: {\n left: `${props.$left}px`,\n width: `${props.$width}px`,\n },\n}))<WrapperProps>`\n position: absolute;\n top: 0;\n height: 100%;\n pointer-events: none; /* Let events pass through to children */\n`;\n\ninterface BoxProps {\n readonly $color: string;\n readonly $isActive?: boolean;\n}\n\nconst Box = styled.div<BoxProps>`\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background: ${(props) =>\n props.$isActive\n ? props.theme?.annotationBoxActiveBackground || 'rgba(255, 200, 100, 0.95)'\n : props.theme?.annotationBoxBackground || 'rgba(255, 255, 255, 0.85)'};\n border: ${(props) => (props.$isActive ? '3px' : '2px')} solid\n ${(props) =>\n props.$isActive ? props.theme?.annotationBoxActiveBorder || '#ff9800' : props.$color};\n border-radius: 4px;\n cursor: pointer;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: all 0.2s ease;\n box-shadow: ${(props) =>\n props.$isActive\n ? // The glow of the active box is the box colour (the theme's\n // `annotationBoxBorder`, through the `color` prop) at 40% and 20%.\n `0 2px 8px color-mix(in srgb, ${props.$color} 40%, transparent), inset 0 0 0 1px color-mix(in srgb, ${props.$color} 20%, transparent)`\n : '0 1px 3px rgba(0, 0, 0, 0.1)'};\n\n &:hover {\n background: ${(props) =>\n props.theme?.annotationBoxHoverBackground || 'rgba(255, 255, 255, 0.98)'};\n border-color: ${(props) => props.theme?.annotationBoxActiveBorder || '#ff9800'};\n border-width: 3px;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n }\n`;\n\nconst Label = styled.span`\n font-size: 12px;\n font-weight: 600;\n color: ${(props) => props.theme?.annotationLabelColor || '#2a2a2a'};\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: 0 6px;\n letter-spacing: 0.3px;\n user-select: none;\n`;\n\ninterface ResizeHandleStyledProps {\n $position: 'left' | 'right';\n $isDragging?: boolean;\n}\n\n// ResizeHandles sit inside their annotation's bounds so adjacent annotations'\n// handles never overlap — each handle is independently grabbable.\nconst ResizeHandle = styled.div<ResizeHandleStyledProps>`\n position: absolute;\n top: 0;\n ${(props) => (props.$position === 'left' ? 'left: 0' : 'right: 0')};\n width: 8px;\n height: 100%;\n cursor: ew-resize;\n z-index: 120;\n background: ${(props) =>\n props.$isDragging\n ? props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.2)'\n : 'transparent'};\n border-radius: 4px;\n touch-action: none; /* Important for @dnd-kit on touch devices */\n pointer-events: auto;\n\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 4px;\n height: 60%;\n background: ${(props) =>\n props.$isDragging\n ? props.theme?.annotationResizeHandleActiveColor || 'rgba(0, 0, 0, 0.8)'\n : props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.4)'};\n border-radius: 2px;\n opacity: ${(props) => (props.$isDragging ? 1 : 0.6)};\n transition:\n opacity 0.2s,\n background 0.2s;\n }\n\n &:hover {\n background: ${(props) => props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.1)'};\n }\n\n &:hover::before {\n opacity: 1;\n background: ${(props) =>\n props.theme?.annotationResizeHandleActiveColor || 'rgba(0, 0, 0, 0.7)'};\n }\n`;\n\nexport interface AnnotationBoxComponentProps {\n annotationId: string;\n annotationIndex: number;\n startPosition: number;\n endPosition: number;\n label?: string;\n color?: string;\n isActive?: boolean;\n onClick?: () => void;\n editable?: boolean; // Whether to show drag handles\n}\n\nexport const AnnotationBox: FunctionComponent<AnnotationBoxComponentProps> = ({\n annotationId,\n annotationIndex,\n startPosition,\n endPosition,\n label,\n color = '#ff9800',\n isActive = false,\n onClick,\n editable = true,\n}) => {\n const width = Math.max(0, endPosition - startPosition);\n\n // Left (start) boundary draggable\n const leftBoundaryId = `annotation-boundary-start-${annotationIndex}`;\n const { ref: leftRef, isDragSource: isLeftDragging } = useDraggable({\n id: leftBoundaryId,\n data: { annotationId, annotationIndex, edge: 'start' as const },\n disabled: !editable,\n plugins: EDGE_HANDLE_PLUGINS,\n });\n\n // Right (end) boundary draggable\n const rightBoundaryId = `annotation-boundary-end-${annotationIndex}`;\n const { ref: rightRef, isDragSource: isRightDragging } = useDraggable({\n id: rightBoundaryId,\n data: { annotationId, annotationIndex, edge: 'end' as const },\n disabled: !editable,\n plugins: EDGE_HANDLE_PLUGINS,\n });\n\n if (width <= 0) {\n return null;\n }\n\n const handleHandleClick = (e: React.MouseEvent) => {\n // Prevent clicks on resize handles from bubbling to annotation box\n e.stopPropagation();\n };\n\n return (\n <Wrapper $left={startPosition} $width={width}>\n <Box $color={color} $isActive={isActive} onClick={onClick}>\n {label && <Label>{label}</Label>}\n </Box>\n {editable && (\n <ResizeHandle\n ref={leftRef}\n $position=\"left\"\n $isDragging={isLeftDragging}\n onClick={handleHandleClick}\n />\n )}\n {editable && (\n <ResizeHandle\n ref={rightRef}\n $position=\"right\"\n $isDragging={isRightDragging}\n onClick={handleHandleClick}\n />\n )}\n </Wrapper>\n );\n};\n","import React, { FunctionComponent } from 'react';\nimport styled from 'styled-components';\n\ninterface ContainerProps {\n readonly $height: number;\n readonly $width?: number;\n}\n\nconst Container = styled.div.attrs<ContainerProps>((props) => ({\n style: {\n height: `${props.$height}px`,\n width: props.$width !== undefined ? `${props.$width}px` : undefined,\n },\n}))<ContainerProps>`\n position: relative;\n background: transparent;\n z-index: 110;\n`;\n\nconst BoxesContainer = styled.div<{ $offset?: number }>`\n position: relative;\n height: 100%;\n padding-left: ${(props) => props.$offset || 0}px;\n`;\n\nexport interface AnnotationBoxesWrapperProps {\n className?: string;\n children?: React.ReactNode;\n height?: number;\n offset?: number;\n width?: number;\n}\n\nexport const AnnotationBoxesWrapper: FunctionComponent<AnnotationBoxesWrapperProps> = ({\n children,\n className,\n height = 30,\n offset = 0,\n width,\n}) => {\n return (\n <Container className={className} $height={height} $width={width}>\n <BoxesContainer $offset={offset}>{children}</BoxesContainer>\n </Container>\n );\n};\n","import React, { FunctionComponent, useCallback, useRef, useEffect } from 'react';\nimport { runAnnotationAction } from '../utils/runAnnotationAction';\nimport styled from 'styled-components';\nimport type {\n AnnotationData,\n AnnotationAction,\n AnnotationActionOptions,\n RenderAnnotationItemProps,\n AnnotationStore,\n} from '@waveform-playlist/core';\n\ninterface ContainerProps {\n $height?: number;\n}\n\n/** The colour of the active row and of the focus rings (theme: `annotationTextItemActiveColor`). */\nconst activeColor = (props: { theme?: { annotationTextItemActiveColor?: string } }) =>\n props.theme?.annotationTextItemActiveColor || '#ff9800';\n/** That colour at an opacity, as the tints and glows of the active row use it. */\nconst activeTint = (percent: number) => (props: Parameters<typeof activeColor>[0]) =>\n `color-mix(in srgb, ${activeColor(props)} ${percent}%, transparent)`;\n\nconst Container = styled.div<ContainerProps>`\n background: ${(props) => props.theme?.backgroundColor || '#fff'};\n ${(props) => (props.$height ? `height: ${props.$height}px;` : 'max-height: 200px;')}\n overflow-y: auto;\n padding: 8px;\n`;\n\nconst AnnotationItem = styled.div<{ $isActive?: boolean }>`\n padding: 12px;\n margin-bottom: 6px;\n border-left: 4px solid ${(props) => (props.$isActive ? activeColor(props) : 'transparent')};\n background: ${(props) => (props.$isActive ? activeTint(15)(props) : 'transparent')};\n border-radius: 4px;\n transition: all 0.2s;\n cursor: pointer;\n box-shadow: ${(props) =>\n props.$isActive\n ? `0 2px 8px ${activeTint(25)(props)}, inset 0 0 0 1px ${activeTint(30)(props)}`\n : 'none'};\n\n &:hover {\n background: ${(props) =>\n props.$isActive\n ? activeTint(20)(props)\n : props.theme?.annotationTextItemHoverBackground || 'rgba(0, 0, 0, 0.05)'};\n border-left-color: ${(props) =>\n props.$isActive ? activeColor(props) : props.theme?.borderColor || '#ddd'};\n }\n\n &:focus-visible {\n outline: 2px solid ${activeColor};\n outline-offset: 2px;\n }\n`;\n\nconst AnnotationHeader = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n`;\n\nconst AnnotationInfo = styled.div`\n display: flex;\n align-items: center;\n gap: 8px;\n`;\n\nconst AnnotationIdLabel = styled.span<{ $isEditable?: boolean }>`\n font-size: 11px;\n font-weight: 600;\n color: ${(props) => props.theme?.textColorMuted || '#666'};\n background: transparent;\n padding: 2px 6px;\n border-radius: 3px;\n min-width: 20px;\n outline: ${(props) =>\n props.$isEditable ? `1px dashed ${props.theme?.borderColor || '#ddd'}` : 'none'};\n\n &[contenteditable='true']:focus {\n outline: 2px solid ${activeColor};\n background: ${activeTint(10)};\n }\n`;\n\nconst TimeRange = styled.span`\n font-size: 12px;\n font-weight: 500;\n color: ${(props) => props.theme?.textColorMuted || '#555'};\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n letter-spacing: 0.5px;\n`;\n\nconst AnnotationControls = styled.div`\n display: flex;\n gap: 6px;\n`;\n\nconst ControlButton = styled.button`\n background: ${(props) => props.theme?.surfaceColor || '#f5f5f5'};\n border: 1px solid ${(props) => props.theme?.borderColor || '#ccc'};\n color: ${(props) => props.theme?.textColor || '#333'};\n padding: 4px 8px;\n font-size: 14px;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.15s ease;\n\n &:hover {\n background: ${(props) => props.theme?.inputBackground || '#3d3d3d'};\n border-color: ${(props) => props.theme?.textColorMuted || '#999'};\n transform: scale(1.05);\n }\n\n &:active {\n transform: scale(0.95);\n }\n`;\n\nconst AnnotationTextContent = styled.div<{ $isEditable?: boolean }>`\n font-size: 14px;\n line-height: 1.6;\n color: ${(props) => props.theme?.textColor || '#2a2a2a'};\n white-space: pre-wrap;\n word-break: break-word;\n outline: ${(props) =>\n props.$isEditable ? `1px dashed ${props.theme?.borderColor || '#ddd'}` : 'none'};\n padding: ${(props) => (props.$isEditable ? '6px' : '0')};\n border-radius: 3px;\n min-height: 20px;\n\n &[contenteditable='true']:focus {\n outline: 2px solid ${activeColor};\n background: ${activeTint(10)};\n }\n`;\n\nexport interface AnnotationTextProps {\n /** What the list draws. */\n annotations: readonly AnnotationData[];\n activeAnnotationId?: string;\n shouldScrollToActive?: boolean;\n /** Where to position the active annotation when scrolling: 'center', 'start', 'end', or 'nearest'. Defaults to 'center'. */\n scrollActivePosition?: ScrollLogicalPosition;\n /** Which scrollable containers to scroll: 'nearest' (only the annotation list) or 'all' (including viewport). Defaults to 'nearest'. */\n scrollActiveContainer?: 'nearest' | 'all';\n editable?: boolean;\n controls?: AnnotationAction[];\n annotationListConfig?: AnnotationActionOptions;\n height?: number;\n onAnnotationClick?: (annotation: AnnotationData) => void;\n /**\n * Where the edits are written (#867): text, id and control edits call\n * `store.update`, find their annotation by id in the store's current list,\n * and a field whose edit was not stored shows the stored value again.\n * `annotations` stays what the list draws. Without `store` the list is\n * read-only: no field can be edited and no control is drawn, whatever\n * `editable` says.\n */\n store?: AnnotationStore;\n /**\n * Custom render function for annotation items.\n * When provided, completely replaces the default annotation item rendering.\n * Use this to customize the appearance of each annotation in the list.\n */\n renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;\n}\n\nconst NO_CONTROLS: AnnotationAction[] = [];\n\nconst formatTime = (seconds: number): string => {\n if (isNaN(seconds) || !isFinite(seconds)) {\n return '0:00.000';\n }\n const mins = Math.floor(seconds / 60);\n const secs = (seconds % 60).toFixed(3);\n return `${mins}:${secs.padStart(6, '0')}`;\n};\n\nconst getIconClass = (classString: string) => {\n return classString.replace(/\\./g, ' ');\n};\n\nconst blurOnEnter = (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.currentTarget.blur();\n }\n};\n\ninterface AnnotationListItemProps {\n annotation: AnnotationData;\n index: number;\n isActive: boolean;\n /** Set on the active item only, so the list can scroll to it. */\n itemRef?: React.Ref<HTMLDivElement>;\n editable: boolean;\n controls: AnnotationAction[];\n onAnnotationClick?: (annotation: AnnotationData) => void;\n onTextEdit: (index: number, newText: string, field: HTMLElement) => void;\n onIdEdit: (index: number, newId: string, field: HTMLElement) => void;\n onControlClick: (control: AnnotationAction, index: number) => void;\n renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;\n}\n\n/**\n * One row of the list. Memoized: the active annotation changes at every\n * annotation boundary during playback, and only the row that stops being\n * active and the row that becomes active have a changed prop (#740). Every\n * function handed to it must therefore keep its identity across a render of\n * the list that did not change it.\n */\nconst AnnotationListItem = React.memo(function AnnotationListItem({\n annotation,\n index,\n isActive,\n itemRef,\n editable,\n controls,\n onAnnotationClick,\n onTextEdit,\n onIdEdit,\n onControlClick,\n renderAnnotationItem,\n}: AnnotationListItemProps) {\n const handleClick = () => onAnnotationClick?.(annotation);\n // The default row: a click in a field that is being edited places the\n // caret, it does not choose the annotation. (The action buttons stop their\n // own clicks.)\n const handleRowClick = (event: React.MouseEvent<HTMLElement>) => {\n const target = event.target as Element | null;\n if (target?.closest?.('[contenteditable=\"true\"]')) return;\n handleClick();\n };\n\n // Use custom render function if provided\n if (renderAnnotationItem) {\n return (\n <div ref={itemRef}>\n {renderAnnotationItem({\n annotation,\n index,\n isActive,\n onClick: handleClick,\n formatTime,\n })}\n </div>\n );\n }\n\n // Default rendering\n return (\n <AnnotationItem ref={itemRef} $isActive={isActive} onClick={handleRowClick}>\n <AnnotationHeader>\n <AnnotationInfo>\n <AnnotationIdLabel\n $isEditable={editable}\n contentEditable={editable}\n suppressContentEditableWarning\n onBlur={(e) => onIdEdit(index, e.currentTarget.textContent || '', e.currentTarget)}\n onKeyDown={blurOnEnter}\n >\n {annotation.id}\n </AnnotationIdLabel>\n <TimeRange>\n {formatTime(annotation.start)} - {formatTime(annotation.end)}\n </TimeRange>\n </AnnotationInfo>\n {controls.length > 0 && (\n <AnnotationControls onClick={(e) => e.stopPropagation()}>\n {controls.map((control, idx) => (\n <ControlButton\n key={idx}\n title={control.title}\n onClick={() => onControlClick(control, index)}\n >\n {control.text ? control.text : <i className={getIconClass(control.class || '')} />}\n </ControlButton>\n ))}\n </AnnotationControls>\n )}\n </AnnotationHeader>\n <AnnotationTextContent\n $isEditable={editable}\n contentEditable={editable}\n suppressContentEditableWarning\n onBlur={(e) => onTextEdit(index, e.currentTarget.textContent || '', e.currentTarget)}\n onKeyDown={blurOnEnter}\n >\n {annotation.lines.join('\\n')}\n </AnnotationTextContent>\n </AnnotationItem>\n );\n});\n\nconst AnnotationTextComponent: FunctionComponent<AnnotationTextProps> = ({\n annotations,\n activeAnnotationId,\n shouldScrollToActive = false,\n scrollActivePosition = 'center',\n scrollActiveContainer = 'nearest',\n editable = false,\n controls = NO_CONTROLS,\n annotationListConfig,\n height,\n onAnnotationClick,\n store,\n renderAnnotationItem,\n}) => {\n // Nowhere to write: the list is read-only.\n const writable = store !== undefined;\n const fieldsEditable = editable && writable;\n const shownControls = writable ? controls : NO_CONTROLS;\n const activeAnnotationRef = useRef<HTMLDivElement>(null);\n\n // Auto-scroll to active annotation when it changes\n useEffect(() => {\n // Only scroll if parent says we should (prevents scrolling on remount after pause)\n if (activeAnnotationId && activeAnnotationRef.current && shouldScrollToActive) {\n activeAnnotationRef.current.scrollIntoView({\n behavior: 'smooth',\n block: scrollActivePosition,\n container: scrollActiveContainer,\n } as ScrollIntoViewOptions);\n }\n }, [activeAnnotationId, shouldScrollToActive, scrollActivePosition, scrollActiveContainer]);\n\n // The three handlers below are props of every memoized row. Their\n // dependencies do not change when only the active annotation does.\n // The handlers below are props of every memoized row. They read the list\n // through a ref so that a change to one annotation (each move of an edge\n // drag) re-renders that annotation's row and not all of them.\n const annotationsRef = useRef(annotations);\n annotationsRef.current = annotations;\n // The options an action is called with are only needed when its button is\n // pressed. Read through a ref, a change of them (a link-endpoints or\n // continuous-play toggle) does not give every row a new handler.\n const annotationListConfigRef = useRef(annotationListConfig);\n annotationListConfigRef.current = annotationListConfig;\n\n /** Show the stored value in a field whose edit was not stored. */\n const showStored = (field: HTMLElement, stored: string | undefined) => {\n if (stored !== undefined && field.textContent !== stored) field.textContent = stored;\n };\n\n const handleTextEdit = useCallback(\n (index: number, newText: string, field: HTMLElement) => {\n if (!editable) return;\n const id = annotationsRef.current[index]?.id;\n if (store) {\n if (id === undefined) return;\n const lines = newText.split('\\n');\n store.update((current) => {\n const at = current.findIndex((a) => a.id === id);\n if (at < 0 || current[at].lines.join('\\n') === lines.join('\\n')) return current;\n const next = [...current];\n next[at] = { ...current[at], lines };\n return next;\n });\n showStored(\n field,\n store\n .getAnnotations()\n .find((a) => a.id === id)\n ?.lines.join('\\n')\n );\n }\n },\n [editable, store]\n );\n\n const handleIdEdit = useCallback(\n (index: number, newId: string, field: HTMLElement) => {\n if (!editable) return;\n const trimmedId = newId.trim();\n const id = annotationsRef.current[index]?.id;\n if (store) {\n if (id === undefined) return;\n // An empty id and one another annotation has are refused (#867).\n if (trimmedId && trimmedId !== id) {\n store.update((current) => {\n const at = current.findIndex((a) => a.id === id);\n if (at < 0 || current.some((a) => a.id === trimmedId)) return current;\n const next = [...current];\n next[at] = { ...current[at], id: trimmedId };\n return next;\n });\n }\n const list = store.getAnnotations();\n const renamed = !list.some((a) => a.id === id) && list.some((a) => a.id === trimmedId);\n showStored(field, renamed ? trimmedId : id);\n }\n },\n [editable, store]\n );\n\n const handleControlClick = useCallback(\n (control: AnnotationAction, index: number) => {\n if (store) {\n const id = annotationsRef.current[index]?.id;\n if (id === undefined) return;\n store.update((current) =>\n runAnnotationAction(current, id, control, annotationListConfigRef.current || {})\n );\n }\n },\n [store]\n );\n\n return (\n <Container $height={height}>\n {annotations.map((annotation, index) => {\n const isActive = annotation.id === activeAnnotationId;\n return (\n <AnnotationListItem\n key={annotation.id}\n annotation={annotation}\n index={index}\n isActive={isActive}\n itemRef={isActive ? activeAnnotationRef : undefined}\n editable={fieldsEditable}\n controls={shownControls}\n onAnnotationClick={onAnnotationClick}\n onTextEdit={handleTextEdit}\n onIdEdit={handleIdEdit}\n onControlClick={handleControlClick}\n renderAnnotationItem={renderAnnotationItem}\n />\n );\n })}\n </Container>\n );\n};\n\n// Memoize to prevent unnecessary remounting when parent re-renders\nexport const AnnotationText = React.memo(AnnotationTextComponent);\n","import type {\n AnnotationAction,\n AnnotationActionOptions,\n AnnotationData,\n} from '@waveform-playlist/core';\n\nfunction copyAnnotation(annotation: AnnotationData): AnnotationData {\n return { ...annotation, lines: [...annotation.lines] };\n}\n\n/** The same fields with the same values, `lines` compared element by element. */\nfunction sameAnnotation(a: AnnotationData, b: AnnotationData): boolean {\n const keys = new Set([...Object.keys(a), ...Object.keys(b)]);\n for (const key of keys) {\n const x = (a as unknown as Record<string, unknown>)[key];\n const y = (b as unknown as Record<string, unknown>)[key];\n if (key === 'lines' && Array.isArray(x) && Array.isArray(y)) {\n if (x.length !== y.length || x.some((line, i) => line !== y[i])) return false;\n } else if (x !== y) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Run a list control's `action` for the annotation with `id` on `current`,\n * the store's list as it is now, and return the list to store.\n *\n * An action changes the list and the annotation objects in place (the\n * example page's split sets `annotation.end`), and the store's objects are\n * frozen in development, so the action gets a new array of copies: each\n * annotation with its own `lines`. Afterwards every copy that is still equal\n * to its original is replaced by the original, so rows compared by object do\n * not re-render for annotations the action did not touch. `index` is the\n * position of `id` in `current`. Returns `current` itself when `id` is not\n * in it or the action changed nothing.\n */\nexport function runAnnotationAction(\n current: readonly AnnotationData[],\n id: string,\n control: AnnotationAction,\n options: AnnotationActionOptions\n): readonly AnnotationData[] {\n const index = current.findIndex((annotation) => annotation.id === id);\n if (index < 0) return current;\n\n const copies = current.map(copyAnnotation);\n const originalOf = new Map(copies.map((copy, i) => [copy, current[i]]));\n control.action(copies[index], index, copies, options);\n\n const result = copies.map((copy) => {\n const original = originalOf.get(copy);\n return original && sameAnnotation(copy, original) ? original : copy;\n });\n const unchanged =\n result.length === current.length && result.every((annotation, i) => annotation === current[i]);\n return unchanged ? current : result;\n}\n","import React, { useId } from 'react';\nimport {\n BaseCheckboxWrapper,\n BaseCheckbox,\n BaseCheckboxLabel,\n} from '@waveform-playlist/ui-components';\nimport { useAnnotationOptions, usePlaybackControls } from '@waveform-playlist/browser';\n\nexport interface AnnotationCheckboxProps {\n /** On the element that wraps the checkbox and its label. */\n className?: string;\n disabled?: boolean;\n /** The label. Default (also for `null`): the option's English name. */\n children?: React.ReactNode;\n}\n\ninterface OptionCheckboxProps extends AnnotationCheckboxProps {\n checked: boolean;\n onChange: (checked: boolean) => void;\n /** Class of the input itself (kept from the older checkboxes). */\n inputClassName?: string;\n}\n\nconst OptionCheckbox: React.FC<OptionCheckboxProps> = ({\n checked,\n onChange,\n inputClassName,\n className,\n disabled,\n children,\n}) => {\n // Generated: two of one checkbox on a page must not share an id.\n const id = useId();\n return (\n <BaseCheckboxWrapper className={className}>\n <BaseCheckbox\n type=\"checkbox\"\n id={id}\n className={inputClassName}\n checked={checked}\n onChange={(e) => onChange(e.target.checked)}\n disabled={disabled}\n />\n <BaseCheckboxLabel htmlFor={id}>{children}</BaseCheckboxLabel>\n </BaseCheckboxWrapper>\n );\n};\n\n// In each control the props it was given come first and the bound ones after,\n// so a `checked` or `onChange` left over from the controlled form these names\n// had before cannot replace the provider's.\n\n/**\n * Shows and sets the provider's `continuousPlay` option: on, playback runs on\n * through the following annotations. Under either playlist provider.\n */\nexport const ContinuousPlayCheckbox: React.FC<AnnotationCheckboxProps> = ({\n children,\n ...rest\n}) => {\n const { continuousPlay } = useAnnotationOptions();\n const { setContinuousPlay } = usePlaybackControls();\n return (\n <OptionCheckbox\n {...rest}\n checked={continuousPlay}\n onChange={setContinuousPlay}\n inputClassName=\"continuous-play\"\n >\n {children ?? 'Continuous Play'}\n </OptionCheckbox>\n );\n};\n\n/**\n * Shows and sets the provider's `linkEndpoints` option: on, a dragged edge\n * takes the edge it touches along. Under either playlist provider.\n */\nexport const LinkEndpointsCheckbox: React.FC<AnnotationCheckboxProps> = ({ children, ...rest }) => {\n const { linkEndpoints } = useAnnotationOptions();\n const { setLinkEndpoints } = usePlaybackControls();\n return (\n <OptionCheckbox\n {...rest}\n checked={linkEndpoints}\n onChange={setLinkEndpoints}\n inputClassName=\"link-endpoints\"\n >\n {children ?? 'Link Endpoints'}\n </OptionCheckbox>\n );\n};\n\n/**\n * Shows and sets the provider's `editable` option: whether annotation edges\n * and text can be changed. Under either playlist provider.\n */\nexport const EditableCheckbox: React.FC<AnnotationCheckboxProps> = ({ children, ...rest }) => {\n const { editable } = useAnnotationOptions();\n const { setAnnotationsEditable } = usePlaybackControls();\n return (\n <OptionCheckbox {...rest} checked={editable} onChange={setAnnotationsEditable}>\n {children ?? 'Editable Annotations'}\n </OptionCheckbox>\n );\n};\n","import React from 'react';\nimport styled from 'styled-components';\nimport { useAnnotations } from '@waveform-playlist/browser';\nimport { serializeAeneas } from '../parsers/aeneas';\n\nconst StyledButton = styled.button`\n padding: 0.5rem 1rem;\n background: ${(props) => props.theme?.surfaceColor || '#f5f5f5'};\n color: ${(props) => props.theme?.textColor || '#333'};\n border: 1px solid ${(props) => props.theme?.borderColor || '#ccc'};\n border-radius: ${(props) => props.theme?.borderRadius || '4px'};\n cursor: pointer;\n font-family: ${(props) => props.theme?.fontFamily || 'inherit'};\n font-size: ${(props) => props.theme?.fontSize || '14px'};\n font-weight: 500;\n transition: all 0.15s ease;\n\n &:hover:not(:disabled) {\n background: ${(props) => props.theme?.inputBackground || '#3d3d3d'};\n border-color: ${(props) => props.theme?.textColorMuted || '#999'};\n }\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ${(props) => props.theme?.inputFocusBorder || '#007bff'}44;\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n`;\n\nexport interface DownloadAnnotationsButtonProps {\n /** Name of the downloaded file. Default: `annotations.json`. */\n filename?: string;\n disabled?: boolean;\n className?: string;\n /** The label. Default: `Download JSON`. */\n children?: React.ReactNode;\n /**\n * The tooltip. Default: an English sentence, a different one when there is\n * nothing to download. Given, it is used in both cases.\n */\n title?: string;\n}\n\n/**\n * Downloads the provider's annotations as an array of Aeneas fragments.\n * Under either playlist provider.\n */\nexport const DownloadAnnotationsButton: React.FC<DownloadAnnotationsButtonProps> = ({\n filename = 'annotations.json',\n disabled = false,\n className,\n children = 'Download JSON',\n title,\n}) => {\n const { annotations } = useAnnotations();\n const handleDownload = () => {\n // Serialize annotations to Aeneas JSON format\n const jsonData = annotations.map((annotation) => serializeAeneas(annotation));\n const jsonString = JSON.stringify(jsonData, null, 2);\n\n // Create a blob and download link\n const blob = new Blob([jsonString], { type: 'application/json' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n\n // Trigger download\n document.body.appendChild(link);\n link.click();\n\n // Cleanup\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n return (\n <StyledButton\n onClick={handleDownload}\n disabled={disabled || annotations.length === 0}\n className={className}\n title={\n title ??\n (annotations.length === 0\n ? 'No annotations to download'\n : 'Download the annotations as JSON')\n }\n >\n {children}\n </StyledButton>\n );\n};\n","import React from 'react';\nimport { AnnotationIntegrationProvider } from '@waveform-playlist/browser';\nimport type { AnnotationIntegration } from '@waveform-playlist/browser';\nimport { parseAeneas, serializeAeneas } from './parsers/aeneas';\nimport { AnnotationText } from './components/AnnotationText';\nimport { AnnotationBox } from './components/AnnotationBox';\nimport { AnnotationBoxesWrapper } from './components/AnnotationBoxesWrapper';\n\nconst annotationIntegration: AnnotationIntegration = {\n parseAeneas: parseAeneas as (data: unknown) => import('@waveform-playlist/core').AnnotationData,\n serializeAeneas: serializeAeneas as (\n annotation: import('@waveform-playlist/core').AnnotationData\n ) => unknown,\n AnnotationText,\n AnnotationBox,\n AnnotationBoxesWrapper,\n};\n\nexport const AnnotationProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n return (\n <AnnotationIntegrationProvider value={annotationIntegration}>\n {children}\n </AnnotationIntegrationProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACUO,SAAS,YAAY,MAAsC;AAChE,SAAO;AAAA,IACL,IAAI,KAAK;AAAA,IACT,OAAO,WAAW,KAAK,KAAK;AAAA,IAC5B,KAAK,WAAW,KAAK,GAAG;AAAA,IACxB,OAAO,KAAK;AAAA,IACZ,UAAU,KAAK;AAAA,EACjB;AACF;AAEO,SAAS,gBAAgB,YAA4C;AAC1E,SAAO;AAAA,IACL,IAAI,WAAW;AAAA,IACf,OAAO,WAAW,MAAM,QAAQ,CAAC;AAAA,IACjC,KAAK,WAAW,IAAI,QAAQ,CAAC;AAAA,IAC7B,OAAO,WAAW;AAAA,IAClB,UAAU,WAAW,YAAY;AAAA,EACnC;AACF;;;AC3BA,+BAAmB;AAC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_react","import_styled_components","import_jsx_runtime","Container","styled","React","AnnotationListItem","import_react","import_jsx_runtime","import_styled_components","import_browser","import_jsx_runtime","styled","import_browser","import_jsx_runtime"]}
|
package/dist/index.mjs
CHANGED
|
@@ -199,6 +199,39 @@ var AnnotationBoxesWrapper = ({
|
|
|
199
199
|
|
|
200
200
|
// src/components/AnnotationText.tsx
|
|
201
201
|
import React, { useCallback, useRef, useEffect } from "react";
|
|
202
|
+
|
|
203
|
+
// src/utils/runAnnotationAction.ts
|
|
204
|
+
function copyAnnotation(annotation) {
|
|
205
|
+
return { ...annotation, lines: [...annotation.lines] };
|
|
206
|
+
}
|
|
207
|
+
function sameAnnotation(a, b) {
|
|
208
|
+
const keys = /* @__PURE__ */ new Set([...Object.keys(a), ...Object.keys(b)]);
|
|
209
|
+
for (const key of keys) {
|
|
210
|
+
const x = a[key];
|
|
211
|
+
const y = b[key];
|
|
212
|
+
if (key === "lines" && Array.isArray(x) && Array.isArray(y)) {
|
|
213
|
+
if (x.length !== y.length || x.some((line, i) => line !== y[i])) return false;
|
|
214
|
+
} else if (x !== y) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
function runAnnotationAction(current, id, control, options) {
|
|
221
|
+
const index = current.findIndex((annotation) => annotation.id === id);
|
|
222
|
+
if (index < 0) return current;
|
|
223
|
+
const copies = current.map(copyAnnotation);
|
|
224
|
+
const originalOf = new Map(copies.map((copy, i) => [copy, current[i]]));
|
|
225
|
+
control.action(copies[index], index, copies, options);
|
|
226
|
+
const result = copies.map((copy) => {
|
|
227
|
+
const original = originalOf.get(copy);
|
|
228
|
+
return original && sameAnnotation(copy, original) ? original : copy;
|
|
229
|
+
});
|
|
230
|
+
const unchanged = result.length === current.length && result.every((annotation, i) => annotation === current[i]);
|
|
231
|
+
return unchanged ? current : result;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// src/components/AnnotationText.tsx
|
|
202
235
|
import styled3 from "styled-components";
|
|
203
236
|
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
204
237
|
var activeColor = (props) => props.theme?.annotationTextItemActiveColor || "#ff9800";
|
|
@@ -357,7 +390,7 @@ var AnnotationListItem = React.memo(function AnnotationListItem2({
|
|
|
357
390
|
$isEditable: editable,
|
|
358
391
|
contentEditable: editable,
|
|
359
392
|
suppressContentEditableWarning: true,
|
|
360
|
-
onBlur: (e) => onIdEdit(index, e.currentTarget.textContent || ""),
|
|
393
|
+
onBlur: (e) => onIdEdit(index, e.currentTarget.textContent || "", e.currentTarget),
|
|
361
394
|
onKeyDown: blurOnEnter,
|
|
362
395
|
children: annotation.id
|
|
363
396
|
}
|
|
@@ -384,7 +417,7 @@ var AnnotationListItem = React.memo(function AnnotationListItem2({
|
|
|
384
417
|
$isEditable: editable,
|
|
385
418
|
contentEditable: editable,
|
|
386
419
|
suppressContentEditableWarning: true,
|
|
387
|
-
onBlur: (e) => onTextEdit(index, e.currentTarget.textContent || ""),
|
|
420
|
+
onBlur: (e) => onTextEdit(index, e.currentTarget.textContent || "", e.currentTarget),
|
|
388
421
|
onKeyDown: blurOnEnter,
|
|
389
422
|
children: annotation.lines.join("\n")
|
|
390
423
|
}
|
|
@@ -402,9 +435,12 @@ var AnnotationTextComponent = ({
|
|
|
402
435
|
annotationListConfig,
|
|
403
436
|
height,
|
|
404
437
|
onAnnotationClick,
|
|
405
|
-
|
|
438
|
+
store,
|
|
406
439
|
renderAnnotationItem
|
|
407
440
|
}) => {
|
|
441
|
+
const writable = store !== void 0;
|
|
442
|
+
const fieldsEditable = editable && writable;
|
|
443
|
+
const shownControls = writable ? controls : NO_CONTROLS;
|
|
408
444
|
const activeAnnotationRef = useRef(null);
|
|
409
445
|
useEffect(() => {
|
|
410
446
|
if (activeAnnotationId && activeAnnotationRef.current && shouldScrollToActive) {
|
|
@@ -419,45 +455,65 @@ var AnnotationTextComponent = ({
|
|
|
419
455
|
annotationsRef.current = annotations;
|
|
420
456
|
const annotationListConfigRef = useRef(annotationListConfig);
|
|
421
457
|
annotationListConfigRef.current = annotationListConfig;
|
|
458
|
+
const showStored = (field, stored) => {
|
|
459
|
+
if (stored !== void 0 && field.textContent !== stored) field.textContent = stored;
|
|
460
|
+
};
|
|
422
461
|
const handleTextEdit = useCallback(
|
|
423
|
-
(index, newText) => {
|
|
424
|
-
if (!editable
|
|
425
|
-
const
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
lines
|
|
429
|
-
|
|
430
|
-
|
|
462
|
+
(index, newText, field) => {
|
|
463
|
+
if (!editable) return;
|
|
464
|
+
const id = annotationsRef.current[index]?.id;
|
|
465
|
+
if (store) {
|
|
466
|
+
if (id === void 0) return;
|
|
467
|
+
const lines = newText.split("\n");
|
|
468
|
+
store.update((current) => {
|
|
469
|
+
const at = current.findIndex((a) => a.id === id);
|
|
470
|
+
if (at < 0 || current[at].lines.join("\n") === lines.join("\n")) return current;
|
|
471
|
+
const next = [...current];
|
|
472
|
+
next[at] = { ...current[at], lines };
|
|
473
|
+
return next;
|
|
474
|
+
});
|
|
475
|
+
showStored(
|
|
476
|
+
field,
|
|
477
|
+
store.getAnnotations().find((a) => a.id === id)?.lines.join("\n")
|
|
478
|
+
);
|
|
479
|
+
}
|
|
431
480
|
},
|
|
432
|
-
[editable,
|
|
481
|
+
[editable, store]
|
|
433
482
|
);
|
|
434
483
|
const handleIdEdit = useCallback(
|
|
435
|
-
(index, newId) => {
|
|
436
|
-
if (!editable
|
|
484
|
+
(index, newId, field) => {
|
|
485
|
+
if (!editable) return;
|
|
437
486
|
const trimmedId = newId.trim();
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
487
|
+
const id = annotationsRef.current[index]?.id;
|
|
488
|
+
if (store) {
|
|
489
|
+
if (id === void 0) return;
|
|
490
|
+
if (trimmedId && trimmedId !== id) {
|
|
491
|
+
store.update((current) => {
|
|
492
|
+
const at = current.findIndex((a) => a.id === id);
|
|
493
|
+
if (at < 0 || current.some((a) => a.id === trimmedId)) return current;
|
|
494
|
+
const next = [...current];
|
|
495
|
+
next[at] = { ...current[at], id: trimmedId };
|
|
496
|
+
return next;
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
const list = store.getAnnotations();
|
|
500
|
+
const renamed = !list.some((a) => a.id === id) && list.some((a) => a.id === trimmedId);
|
|
501
|
+
showStored(field, renamed ? trimmedId : id);
|
|
502
|
+
}
|
|
445
503
|
},
|
|
446
|
-
[editable,
|
|
504
|
+
[editable, store]
|
|
447
505
|
);
|
|
448
506
|
const handleControlClick = useCallback(
|
|
449
507
|
(control, index) => {
|
|
450
|
-
if (
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
);
|
|
458
|
-
onAnnotationUpdate(annotationsCopy);
|
|
508
|
+
if (store) {
|
|
509
|
+
const id = annotationsRef.current[index]?.id;
|
|
510
|
+
if (id === void 0) return;
|
|
511
|
+
store.update(
|
|
512
|
+
(current) => runAnnotationAction(current, id, control, annotationListConfigRef.current || {})
|
|
513
|
+
);
|
|
514
|
+
}
|
|
459
515
|
},
|
|
460
|
-
[
|
|
516
|
+
[store]
|
|
461
517
|
);
|
|
462
518
|
return /* @__PURE__ */ jsx3(Container2, { $height: height, children: annotations.map((annotation, index) => {
|
|
463
519
|
const isActive = annotation.id === activeAnnotationId;
|
|
@@ -468,8 +524,8 @@ var AnnotationTextComponent = ({
|
|
|
468
524
|
index,
|
|
469
525
|
isActive,
|
|
470
526
|
itemRef: isActive ? activeAnnotationRef : void 0,
|
|
471
|
-
editable,
|
|
472
|
-
controls,
|
|
527
|
+
editable: fieldsEditable,
|
|
528
|
+
controls: shownControls,
|
|
473
529
|
onAnnotationClick,
|
|
474
530
|
onTextEdit: handleTextEdit,
|
|
475
531
|
onIdEdit: handleIdEdit,
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/parsers/aeneas.ts","../src/components/AnnotationBox.tsx","../src/components/AnnotationBoxesWrapper.tsx","../src/components/AnnotationText.tsx","../src/components/AnnotationCheckboxes.tsx","../src/components/DownloadAnnotationsButton.tsx","../src/AnnotationProvider.tsx"],"sourcesContent":["import type { AnnotationData } from '@waveform-playlist/core';\n\nexport interface AeneasFragment {\n begin: string;\n end: string;\n id: string;\n language: string;\n lines: string[];\n}\n\nexport function parseAeneas(data: AeneasFragment): AnnotationData {\n return {\n id: data.id,\n start: parseFloat(data.begin),\n end: parseFloat(data.end),\n lines: data.lines,\n language: data.language,\n };\n}\n\nexport function serializeAeneas(annotation: AnnotationData): AeneasFragment {\n return {\n id: annotation.id,\n begin: annotation.start.toFixed(3),\n end: annotation.end.toFixed(3),\n lines: annotation.lines,\n language: annotation.language || 'en',\n };\n}\n","import React, { FunctionComponent } from 'react';\nimport styled from 'styled-components';\nimport { useDraggable } from '@dnd-kit/react';\nimport { Feedback } from '@dnd-kit/dom';\n\n// Per-entity Feedback plugin config (@dnd-kit 0.5+), hoisted for a stable\n// reference. 'none' disables the Feedback plugin for the edge handles — resize\n// visual feedback comes from React state repositioning the annotation, not CSS\n// translate. Declared on the entity so it works inside ANY DragDropProvider.\nconst EDGE_HANDLE_PLUGINS = [Feedback.configure({ feedback: 'none' })];\n\ninterface WrapperProps {\n readonly $left: number;\n readonly $width: number;\n}\n\n// Wrapper positions the annotation and contains both Box and ResizeHandles as siblings\nconst Wrapper = styled.div.attrs<WrapperProps>((props) => ({\n style: {\n left: `${props.$left}px`,\n width: `${props.$width}px`,\n },\n}))<WrapperProps>`\n position: absolute;\n top: 0;\n height: 100%;\n pointer-events: none; /* Let events pass through to children */\n`;\n\ninterface BoxProps {\n readonly $color: string;\n readonly $isActive?: boolean;\n}\n\nconst Box = styled.div<BoxProps>`\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background: ${(props) =>\n props.$isActive\n ? props.theme?.annotationBoxActiveBackground || 'rgba(255, 200, 100, 0.95)'\n : props.theme?.annotationBoxBackground || 'rgba(255, 255, 255, 0.85)'};\n border: ${(props) => (props.$isActive ? '3px' : '2px')} solid\n ${(props) =>\n props.$isActive ? props.theme?.annotationBoxActiveBorder || '#ff9800' : props.$color};\n border-radius: 4px;\n cursor: pointer;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: all 0.2s ease;\n box-shadow: ${(props) =>\n props.$isActive\n ? // The glow of the active box is the box colour (the theme's\n // `annotationBoxBorder`, through the `color` prop) at 40% and 20%.\n `0 2px 8px color-mix(in srgb, ${props.$color} 40%, transparent), inset 0 0 0 1px color-mix(in srgb, ${props.$color} 20%, transparent)`\n : '0 1px 3px rgba(0, 0, 0, 0.1)'};\n\n &:hover {\n background: ${(props) =>\n props.theme?.annotationBoxHoverBackground || 'rgba(255, 255, 255, 0.98)'};\n border-color: ${(props) => props.theme?.annotationBoxActiveBorder || '#ff9800'};\n border-width: 3px;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n }\n`;\n\nconst Label = styled.span`\n font-size: 12px;\n font-weight: 600;\n color: ${(props) => props.theme?.annotationLabelColor || '#2a2a2a'};\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: 0 6px;\n letter-spacing: 0.3px;\n user-select: none;\n`;\n\ninterface ResizeHandleStyledProps {\n $position: 'left' | 'right';\n $isDragging?: boolean;\n}\n\n// ResizeHandles sit inside their annotation's bounds so adjacent annotations'\n// handles never overlap — each handle is independently grabbable.\nconst ResizeHandle = styled.div<ResizeHandleStyledProps>`\n position: absolute;\n top: 0;\n ${(props) => (props.$position === 'left' ? 'left: 0' : 'right: 0')};\n width: 8px;\n height: 100%;\n cursor: ew-resize;\n z-index: 120;\n background: ${(props) =>\n props.$isDragging\n ? props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.2)'\n : 'transparent'};\n border-radius: 4px;\n touch-action: none; /* Important for @dnd-kit on touch devices */\n pointer-events: auto;\n\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 4px;\n height: 60%;\n background: ${(props) =>\n props.$isDragging\n ? props.theme?.annotationResizeHandleActiveColor || 'rgba(0, 0, 0, 0.8)'\n : props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.4)'};\n border-radius: 2px;\n opacity: ${(props) => (props.$isDragging ? 1 : 0.6)};\n transition:\n opacity 0.2s,\n background 0.2s;\n }\n\n &:hover {\n background: ${(props) => props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.1)'};\n }\n\n &:hover::before {\n opacity: 1;\n background: ${(props) =>\n props.theme?.annotationResizeHandleActiveColor || 'rgba(0, 0, 0, 0.7)'};\n }\n`;\n\nexport interface AnnotationBoxComponentProps {\n annotationId: string;\n annotationIndex: number;\n startPosition: number;\n endPosition: number;\n label?: string;\n color?: string;\n isActive?: boolean;\n onClick?: () => void;\n editable?: boolean; // Whether to show drag handles\n}\n\nexport const AnnotationBox: FunctionComponent<AnnotationBoxComponentProps> = ({\n annotationId,\n annotationIndex,\n startPosition,\n endPosition,\n label,\n color = '#ff9800',\n isActive = false,\n onClick,\n editable = true,\n}) => {\n const width = Math.max(0, endPosition - startPosition);\n\n // Left (start) boundary draggable\n const leftBoundaryId = `annotation-boundary-start-${annotationIndex}`;\n const { ref: leftRef, isDragSource: isLeftDragging } = useDraggable({\n id: leftBoundaryId,\n data: { annotationId, annotationIndex, edge: 'start' as const },\n disabled: !editable,\n plugins: EDGE_HANDLE_PLUGINS,\n });\n\n // Right (end) boundary draggable\n const rightBoundaryId = `annotation-boundary-end-${annotationIndex}`;\n const { ref: rightRef, isDragSource: isRightDragging } = useDraggable({\n id: rightBoundaryId,\n data: { annotationId, annotationIndex, edge: 'end' as const },\n disabled: !editable,\n plugins: EDGE_HANDLE_PLUGINS,\n });\n\n if (width <= 0) {\n return null;\n }\n\n const handleHandleClick = (e: React.MouseEvent) => {\n // Prevent clicks on resize handles from bubbling to annotation box\n e.stopPropagation();\n };\n\n return (\n <Wrapper $left={startPosition} $width={width}>\n <Box $color={color} $isActive={isActive} onClick={onClick}>\n {label && <Label>{label}</Label>}\n </Box>\n {editable && (\n <ResizeHandle\n ref={leftRef}\n $position=\"left\"\n $isDragging={isLeftDragging}\n onClick={handleHandleClick}\n />\n )}\n {editable && (\n <ResizeHandle\n ref={rightRef}\n $position=\"right\"\n $isDragging={isRightDragging}\n onClick={handleHandleClick}\n />\n )}\n </Wrapper>\n );\n};\n","import React, { FunctionComponent } from 'react';\nimport styled from 'styled-components';\n\ninterface ContainerProps {\n readonly $height: number;\n readonly $width?: number;\n}\n\nconst Container = styled.div.attrs<ContainerProps>((props) => ({\n style: {\n height: `${props.$height}px`,\n width: props.$width !== undefined ? `${props.$width}px` : undefined,\n },\n}))<ContainerProps>`\n position: relative;\n background: transparent;\n z-index: 110;\n`;\n\nconst BoxesContainer = styled.div<{ $offset?: number }>`\n position: relative;\n height: 100%;\n padding-left: ${(props) => props.$offset || 0}px;\n`;\n\nexport interface AnnotationBoxesWrapperProps {\n className?: string;\n children?: React.ReactNode;\n height?: number;\n offset?: number;\n width?: number;\n}\n\nexport const AnnotationBoxesWrapper: FunctionComponent<AnnotationBoxesWrapperProps> = ({\n children,\n className,\n height = 30,\n offset = 0,\n width,\n}) => {\n return (\n <Container className={className} $height={height} $width={width}>\n <BoxesContainer $offset={offset}>{children}</BoxesContainer>\n </Container>\n );\n};\n","import React, { FunctionComponent, useCallback, useRef, useEffect } from 'react';\nimport styled from 'styled-components';\nimport type {\n AnnotationData,\n AnnotationAction,\n AnnotationActionOptions,\n RenderAnnotationItemProps,\n} from '@waveform-playlist/core';\n\ninterface ContainerProps {\n $height?: number;\n}\n\n/** The colour of the active row and of the focus rings (theme: `annotationTextItemActiveColor`). */\nconst activeColor = (props: { theme?: { annotationTextItemActiveColor?: string } }) =>\n props.theme?.annotationTextItemActiveColor || '#ff9800';\n/** That colour at an opacity, as the tints and glows of the active row use it. */\nconst activeTint = (percent: number) => (props: Parameters<typeof activeColor>[0]) =>\n `color-mix(in srgb, ${activeColor(props)} ${percent}%, transparent)`;\n\nconst Container = styled.div<ContainerProps>`\n background: ${(props) => props.theme?.backgroundColor || '#fff'};\n ${(props) => (props.$height ? `height: ${props.$height}px;` : 'max-height: 200px;')}\n overflow-y: auto;\n padding: 8px;\n`;\n\nconst AnnotationItem = styled.div<{ $isActive?: boolean }>`\n padding: 12px;\n margin-bottom: 6px;\n border-left: 4px solid ${(props) => (props.$isActive ? activeColor(props) : 'transparent')};\n background: ${(props) => (props.$isActive ? activeTint(15)(props) : 'transparent')};\n border-radius: 4px;\n transition: all 0.2s;\n cursor: pointer;\n box-shadow: ${(props) =>\n props.$isActive\n ? `0 2px 8px ${activeTint(25)(props)}, inset 0 0 0 1px ${activeTint(30)(props)}`\n : 'none'};\n\n &:hover {\n background: ${(props) =>\n props.$isActive\n ? activeTint(20)(props)\n : props.theme?.annotationTextItemHoverBackground || 'rgba(0, 0, 0, 0.05)'};\n border-left-color: ${(props) =>\n props.$isActive ? activeColor(props) : props.theme?.borderColor || '#ddd'};\n }\n\n &:focus-visible {\n outline: 2px solid ${activeColor};\n outline-offset: 2px;\n }\n`;\n\nconst AnnotationHeader = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n`;\n\nconst AnnotationInfo = styled.div`\n display: flex;\n align-items: center;\n gap: 8px;\n`;\n\nconst AnnotationIdLabel = styled.span<{ $isEditable?: boolean }>`\n font-size: 11px;\n font-weight: 600;\n color: ${(props) => props.theme?.textColorMuted || '#666'};\n background: transparent;\n padding: 2px 6px;\n border-radius: 3px;\n min-width: 20px;\n outline: ${(props) =>\n props.$isEditable ? `1px dashed ${props.theme?.borderColor || '#ddd'}` : 'none'};\n\n &[contenteditable='true']:focus {\n outline: 2px solid ${activeColor};\n background: ${activeTint(10)};\n }\n`;\n\nconst TimeRange = styled.span`\n font-size: 12px;\n font-weight: 500;\n color: ${(props) => props.theme?.textColorMuted || '#555'};\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n letter-spacing: 0.5px;\n`;\n\nconst AnnotationControls = styled.div`\n display: flex;\n gap: 6px;\n`;\n\nconst ControlButton = styled.button`\n background: ${(props) => props.theme?.surfaceColor || '#f5f5f5'};\n border: 1px solid ${(props) => props.theme?.borderColor || '#ccc'};\n color: ${(props) => props.theme?.textColor || '#333'};\n padding: 4px 8px;\n font-size: 14px;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.15s ease;\n\n &:hover {\n background: ${(props) => props.theme?.inputBackground || '#3d3d3d'};\n border-color: ${(props) => props.theme?.textColorMuted || '#999'};\n transform: scale(1.05);\n }\n\n &:active {\n transform: scale(0.95);\n }\n`;\n\nconst AnnotationTextContent = styled.div<{ $isEditable?: boolean }>`\n font-size: 14px;\n line-height: 1.6;\n color: ${(props) => props.theme?.textColor || '#2a2a2a'};\n white-space: pre-wrap;\n word-break: break-word;\n outline: ${(props) =>\n props.$isEditable ? `1px dashed ${props.theme?.borderColor || '#ddd'}` : 'none'};\n padding: ${(props) => (props.$isEditable ? '6px' : '0')};\n border-radius: 3px;\n min-height: 20px;\n\n &[contenteditable='true']:focus {\n outline: 2px solid ${activeColor};\n background: ${activeTint(10)};\n }\n`;\n\nexport interface AnnotationTextProps {\n annotations: AnnotationData[];\n activeAnnotationId?: string;\n shouldScrollToActive?: boolean;\n /** Where to position the active annotation when scrolling: 'center', 'start', 'end', or 'nearest'. Defaults to 'center'. */\n scrollActivePosition?: ScrollLogicalPosition;\n /** Which scrollable containers to scroll: 'nearest' (only the annotation list) or 'all' (including viewport). Defaults to 'nearest'. */\n scrollActiveContainer?: 'nearest' | 'all';\n editable?: boolean;\n controls?: AnnotationAction[];\n annotationListConfig?: AnnotationActionOptions;\n height?: number;\n onAnnotationClick?: (annotation: AnnotationData) => void;\n onAnnotationUpdate?: (updatedAnnotations: AnnotationData[]) => void;\n /**\n * Custom render function for annotation items.\n * When provided, completely replaces the default annotation item rendering.\n * Use this to customize the appearance of each annotation in the list.\n */\n renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;\n}\n\nconst NO_CONTROLS: AnnotationAction[] = [];\n\nconst formatTime = (seconds: number): string => {\n if (isNaN(seconds) || !isFinite(seconds)) {\n return '0:00.000';\n }\n const mins = Math.floor(seconds / 60);\n const secs = (seconds % 60).toFixed(3);\n return `${mins}:${secs.padStart(6, '0')}`;\n};\n\nconst getIconClass = (classString: string) => {\n return classString.replace(/\\./g, ' ');\n};\n\nconst blurOnEnter = (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.currentTarget.blur();\n }\n};\n\ninterface AnnotationListItemProps {\n annotation: AnnotationData;\n index: number;\n isActive: boolean;\n /** Set on the active item only, so the list can scroll to it. */\n itemRef?: React.Ref<HTMLDivElement>;\n editable: boolean;\n controls: AnnotationAction[];\n onAnnotationClick?: (annotation: AnnotationData) => void;\n onTextEdit: (index: number, newText: string) => void;\n onIdEdit: (index: number, newId: string) => void;\n onControlClick: (control: AnnotationAction, index: number) => void;\n renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;\n}\n\n/**\n * One row of the list. Memoized: the active annotation changes at every\n * annotation boundary during playback, and only the row that stops being\n * active and the row that becomes active have a changed prop (#740). Every\n * function handed to it must therefore keep its identity across a render of\n * the list that did not change it.\n */\nconst AnnotationListItem = React.memo(function AnnotationListItem({\n annotation,\n index,\n isActive,\n itemRef,\n editable,\n controls,\n onAnnotationClick,\n onTextEdit,\n onIdEdit,\n onControlClick,\n renderAnnotationItem,\n}: AnnotationListItemProps) {\n const handleClick = () => onAnnotationClick?.(annotation);\n // The default row: a click in a field that is being edited places the\n // caret, it does not choose the annotation. (The action buttons stop their\n // own clicks.)\n const handleRowClick = (event: React.MouseEvent<HTMLElement>) => {\n const target = event.target as Element | null;\n if (target?.closest?.('[contenteditable=\"true\"]')) return;\n handleClick();\n };\n\n // Use custom render function if provided\n if (renderAnnotationItem) {\n return (\n <div ref={itemRef}>\n {renderAnnotationItem({\n annotation,\n index,\n isActive,\n onClick: handleClick,\n formatTime,\n })}\n </div>\n );\n }\n\n // Default rendering\n return (\n <AnnotationItem ref={itemRef} $isActive={isActive} onClick={handleRowClick}>\n <AnnotationHeader>\n <AnnotationInfo>\n <AnnotationIdLabel\n $isEditable={editable}\n contentEditable={editable}\n suppressContentEditableWarning\n onBlur={(e) => onIdEdit(index, e.currentTarget.textContent || '')}\n onKeyDown={blurOnEnter}\n >\n {annotation.id}\n </AnnotationIdLabel>\n <TimeRange>\n {formatTime(annotation.start)} - {formatTime(annotation.end)}\n </TimeRange>\n </AnnotationInfo>\n {controls.length > 0 && (\n <AnnotationControls onClick={(e) => e.stopPropagation()}>\n {controls.map((control, idx) => (\n <ControlButton\n key={idx}\n title={control.title}\n onClick={() => onControlClick(control, index)}\n >\n {control.text ? control.text : <i className={getIconClass(control.class || '')} />}\n </ControlButton>\n ))}\n </AnnotationControls>\n )}\n </AnnotationHeader>\n <AnnotationTextContent\n $isEditable={editable}\n contentEditable={editable}\n suppressContentEditableWarning\n onBlur={(e) => onTextEdit(index, e.currentTarget.textContent || '')}\n onKeyDown={blurOnEnter}\n >\n {annotation.lines.join('\\n')}\n </AnnotationTextContent>\n </AnnotationItem>\n );\n});\n\nconst AnnotationTextComponent: FunctionComponent<AnnotationTextProps> = ({\n annotations,\n activeAnnotationId,\n shouldScrollToActive = false,\n scrollActivePosition = 'center',\n scrollActiveContainer = 'nearest',\n editable = false,\n controls = NO_CONTROLS,\n annotationListConfig,\n height,\n onAnnotationClick,\n onAnnotationUpdate,\n renderAnnotationItem,\n}) => {\n const activeAnnotationRef = useRef<HTMLDivElement>(null);\n\n // Auto-scroll to active annotation when it changes\n useEffect(() => {\n // Only scroll if parent says we should (prevents scrolling on remount after pause)\n if (activeAnnotationId && activeAnnotationRef.current && shouldScrollToActive) {\n activeAnnotationRef.current.scrollIntoView({\n behavior: 'smooth',\n block: scrollActivePosition,\n container: scrollActiveContainer,\n } as ScrollIntoViewOptions);\n }\n }, [activeAnnotationId, shouldScrollToActive, scrollActivePosition, scrollActiveContainer]);\n\n // The three handlers below are props of every memoized row. Their\n // dependencies do not change when only the active annotation does.\n // The handlers below are props of every memoized row. They read the list\n // through a ref so that a change to one annotation (each move of an edge\n // drag) re-renders that annotation's row and not all of them.\n const annotationsRef = useRef(annotations);\n annotationsRef.current = annotations;\n // The options an action is called with are only needed when its button is\n // pressed. Read through a ref, a change of them (a link-endpoints or\n // continuous-play toggle) does not give every row a new handler.\n const annotationListConfigRef = useRef(annotationListConfig);\n annotationListConfigRef.current = annotationListConfig;\n\n const handleTextEdit = useCallback(\n (index: number, newText: string) => {\n if (!editable || !onAnnotationUpdate) return;\n\n const updatedAnnotations = [...annotationsRef.current];\n updatedAnnotations[index] = {\n ...updatedAnnotations[index],\n lines: newText.split('\\n'),\n };\n onAnnotationUpdate(updatedAnnotations);\n },\n [editable, onAnnotationUpdate]\n );\n\n const handleIdEdit = useCallback(\n (index: number, newId: string) => {\n if (!editable || !onAnnotationUpdate) return;\n\n const trimmedId = newId.trim();\n if (!trimmedId) return; // Don't allow empty IDs\n\n const updatedAnnotations = [...annotationsRef.current];\n updatedAnnotations[index] = {\n ...updatedAnnotations[index],\n id: trimmedId,\n };\n onAnnotationUpdate(updatedAnnotations);\n },\n [editable, onAnnotationUpdate]\n );\n\n const handleControlClick = useCallback(\n (control: AnnotationAction, index: number) => {\n if (!onAnnotationUpdate) return;\n\n const annotationsCopy = [...annotationsRef.current];\n control.action(\n annotationsCopy[index],\n index,\n annotationsCopy,\n annotationListConfigRef.current || {}\n );\n onAnnotationUpdate(annotationsCopy);\n },\n [onAnnotationUpdate]\n );\n\n return (\n <Container $height={height}>\n {annotations.map((annotation, index) => {\n const isActive = annotation.id === activeAnnotationId;\n return (\n <AnnotationListItem\n key={annotation.id}\n annotation={annotation}\n index={index}\n isActive={isActive}\n itemRef={isActive ? activeAnnotationRef : undefined}\n editable={editable}\n controls={controls}\n onAnnotationClick={onAnnotationClick}\n onTextEdit={handleTextEdit}\n onIdEdit={handleIdEdit}\n onControlClick={handleControlClick}\n renderAnnotationItem={renderAnnotationItem}\n />\n );\n })}\n </Container>\n );\n};\n\n// Memoize to prevent unnecessary remounting when parent re-renders\nexport const AnnotationText = React.memo(AnnotationTextComponent);\n","import React, { useId } from 'react';\nimport {\n BaseCheckboxWrapper,\n BaseCheckbox,\n BaseCheckboxLabel,\n} from '@waveform-playlist/ui-components';\nimport { useAnnotationOptions, usePlaybackControls } from '@waveform-playlist/browser';\n\nexport interface AnnotationCheckboxProps {\n /** On the element that wraps the checkbox and its label. */\n className?: string;\n disabled?: boolean;\n /** The label. Default (also for `null`): the option's English name. */\n children?: React.ReactNode;\n}\n\ninterface OptionCheckboxProps extends AnnotationCheckboxProps {\n checked: boolean;\n onChange: (checked: boolean) => void;\n /** Class of the input itself (kept from the older checkboxes). */\n inputClassName?: string;\n}\n\nconst OptionCheckbox: React.FC<OptionCheckboxProps> = ({\n checked,\n onChange,\n inputClassName,\n className,\n disabled,\n children,\n}) => {\n // Generated: two of one checkbox on a page must not share an id.\n const id = useId();\n return (\n <BaseCheckboxWrapper className={className}>\n <BaseCheckbox\n type=\"checkbox\"\n id={id}\n className={inputClassName}\n checked={checked}\n onChange={(e) => onChange(e.target.checked)}\n disabled={disabled}\n />\n <BaseCheckboxLabel htmlFor={id}>{children}</BaseCheckboxLabel>\n </BaseCheckboxWrapper>\n );\n};\n\n// In each control the props it was given come first and the bound ones after,\n// so a `checked` or `onChange` left over from the controlled form these names\n// had before cannot replace the provider's.\n\n/**\n * Shows and sets the provider's `continuousPlay` option: on, playback runs on\n * through the following annotations. Under either playlist provider.\n */\nexport const ContinuousPlayCheckbox: React.FC<AnnotationCheckboxProps> = ({\n children,\n ...rest\n}) => {\n const { continuousPlay } = useAnnotationOptions();\n const { setContinuousPlay } = usePlaybackControls();\n return (\n <OptionCheckbox\n {...rest}\n checked={continuousPlay}\n onChange={setContinuousPlay}\n inputClassName=\"continuous-play\"\n >\n {children ?? 'Continuous Play'}\n </OptionCheckbox>\n );\n};\n\n/**\n * Shows and sets the provider's `linkEndpoints` option: on, a dragged edge\n * takes the edge it touches along. Under either playlist provider.\n */\nexport const LinkEndpointsCheckbox: React.FC<AnnotationCheckboxProps> = ({ children, ...rest }) => {\n const { linkEndpoints } = useAnnotationOptions();\n const { setLinkEndpoints } = usePlaybackControls();\n return (\n <OptionCheckbox\n {...rest}\n checked={linkEndpoints}\n onChange={setLinkEndpoints}\n inputClassName=\"link-endpoints\"\n >\n {children ?? 'Link Endpoints'}\n </OptionCheckbox>\n );\n};\n\n/**\n * Shows and sets the provider's `editable` option: whether annotation edges\n * and text can be changed. Under either playlist provider.\n */\nexport const EditableCheckbox: React.FC<AnnotationCheckboxProps> = ({ children, ...rest }) => {\n const { editable } = useAnnotationOptions();\n const { setAnnotationsEditable } = usePlaybackControls();\n return (\n <OptionCheckbox {...rest} checked={editable} onChange={setAnnotationsEditable}>\n {children ?? 'Editable Annotations'}\n </OptionCheckbox>\n );\n};\n","import React from 'react';\nimport styled from 'styled-components';\nimport { useAnnotations } from '@waveform-playlist/browser';\nimport { serializeAeneas } from '../parsers/aeneas';\n\nconst StyledButton = styled.button`\n padding: 0.5rem 1rem;\n background: ${(props) => props.theme?.surfaceColor || '#f5f5f5'};\n color: ${(props) => props.theme?.textColor || '#333'};\n border: 1px solid ${(props) => props.theme?.borderColor || '#ccc'};\n border-radius: ${(props) => props.theme?.borderRadius || '4px'};\n cursor: pointer;\n font-family: ${(props) => props.theme?.fontFamily || 'inherit'};\n font-size: ${(props) => props.theme?.fontSize || '14px'};\n font-weight: 500;\n transition: all 0.15s ease;\n\n &:hover:not(:disabled) {\n background: ${(props) => props.theme?.inputBackground || '#3d3d3d'};\n border-color: ${(props) => props.theme?.textColorMuted || '#999'};\n }\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ${(props) => props.theme?.inputFocusBorder || '#007bff'}44;\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n`;\n\nexport interface DownloadAnnotationsButtonProps {\n /** Name of the downloaded file. Default: `annotations.json`. */\n filename?: string;\n disabled?: boolean;\n className?: string;\n /** The label. Default: `Download JSON`. */\n children?: React.ReactNode;\n /**\n * The tooltip. Default: an English sentence, a different one when there is\n * nothing to download. Given, it is used in both cases.\n */\n title?: string;\n}\n\n/**\n * Downloads the provider's annotations as an array of Aeneas fragments.\n * Under either playlist provider.\n */\nexport const DownloadAnnotationsButton: React.FC<DownloadAnnotationsButtonProps> = ({\n filename = 'annotations.json',\n disabled = false,\n className,\n children = 'Download JSON',\n title,\n}) => {\n const { annotations } = useAnnotations();\n const handleDownload = () => {\n // Serialize annotations to Aeneas JSON format\n const jsonData = annotations.map((annotation) => serializeAeneas(annotation));\n const jsonString = JSON.stringify(jsonData, null, 2);\n\n // Create a blob and download link\n const blob = new Blob([jsonString], { type: 'application/json' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n\n // Trigger download\n document.body.appendChild(link);\n link.click();\n\n // Cleanup\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n return (\n <StyledButton\n onClick={handleDownload}\n disabled={disabled || annotations.length === 0}\n className={className}\n title={\n title ??\n (annotations.length === 0\n ? 'No annotations to download'\n : 'Download the annotations as JSON')\n }\n >\n {children}\n </StyledButton>\n );\n};\n","import React from 'react';\nimport { AnnotationIntegrationProvider } from '@waveform-playlist/browser';\nimport type { AnnotationIntegration } from '@waveform-playlist/browser';\nimport { parseAeneas, serializeAeneas } from './parsers/aeneas';\nimport { AnnotationText } from './components/AnnotationText';\nimport { AnnotationBox } from './components/AnnotationBox';\nimport { AnnotationBoxesWrapper } from './components/AnnotationBoxesWrapper';\n\nconst annotationIntegration: AnnotationIntegration = {\n parseAeneas: parseAeneas as (data: unknown) => import('@waveform-playlist/core').AnnotationData,\n serializeAeneas: serializeAeneas as (\n annotation: import('@waveform-playlist/core').AnnotationData\n ) => unknown,\n AnnotationText,\n AnnotationBox,\n AnnotationBoxesWrapper,\n};\n\nexport const AnnotationProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n return (\n <AnnotationIntegrationProvider value={annotationIntegration}>\n {children}\n </AnnotationIntegrationProvider>\n );\n};\n"],"mappings":";AAUO,SAAS,YAAY,MAAsC;AAChE,SAAO;AAAA,IACL,IAAI,KAAK;AAAA,IACT,OAAO,WAAW,KAAK,KAAK;AAAA,IAC5B,KAAK,WAAW,KAAK,GAAG;AAAA,IACxB,OAAO,KAAK;AAAA,IACZ,UAAU,KAAK;AAAA,EACjB;AACF;AAEO,SAAS,gBAAgB,YAA4C;AAC1E,SAAO;AAAA,IACL,IAAI,WAAW;AAAA,IACf,OAAO,WAAW,MAAM,QAAQ,CAAC;AAAA,IACjC,KAAK,WAAW,IAAI,QAAQ,CAAC;AAAA,IAC7B,OAAO,WAAW;AAAA,IAClB,UAAU,WAAW,YAAY;AAAA,EACnC;AACF;;;AC3BA,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AA0LrB,SAEc,KAFd;AApLJ,IAAM,sBAAsB,CAAC,SAAS,UAAU,EAAE,UAAU,OAAO,CAAC,CAAC;AAQrE,IAAM,UAAU,OAAO,IAAI,MAAoB,CAAC,WAAW;AAAA,EACzD,OAAO;AAAA,IACL,MAAM,GAAG,MAAM,KAAK;AAAA,IACpB,OAAO,GAAG,MAAM,MAAM;AAAA,EACxB;AACF,EAAE;AAAA;AAAA;AAAA;AAAA;AAAA;AAYF,IAAM,MAAM,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAMH,CAAC,UACb,MAAM,YACF,MAAM,OAAO,iCAAiC,8BAC9C,MAAM,OAAO,2BAA2B,2BAA2B;AAAA,YAC/D,CAAC,UAAW,MAAM,YAAY,QAAQ,KAAM;AAAA,MA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AAA;AAAA;AAAA;AA2B1E,IAAM,4BAAsE,CAAC;AAAA,EAClF,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA,WAAW;AAAA,EACX;AACF,MAAM;AACJ,QAAM,EAAE,YAAY,IAAI,eAAe;AACvC,QAAM,iBAAiB,MAAM;AAE3B,UAAM,WAAW,YAAY,IAAI,CAAC,eAAe,gBAAgB,UAAU,CAAC;AAC5E,UAAM,aAAa,KAAK,UAAU,UAAU,MAAM,CAAC;AAGnD,UAAM,OAAO,IAAI,KAAK,CAAC,UAAU,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAChE,UAAM,MAAM,IAAI,gBAAgB,IAAI;AACpC,UAAM,OAAO,SAAS,cAAc,GAAG;AACvC,SAAK,OAAO;AACZ,SAAK,WAAW;AAGhB,aAAS,KAAK,YAAY,IAAI;AAC9B,SAAK,MAAM;AAGX,aAAS,KAAK,YAAY,IAAI;AAC9B,QAAI,gBAAgB,GAAG;AAAA,EACzB;AAEA,SACE,gBAAAD;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,UAAU,YAAY,YAAY,WAAW;AAAA,MAC7C;AAAA,MACA,OACE,UACC,YAAY,WAAW,IACpB,+BACA;AAAA,MAGL;AAAA;AAAA,EACH;AAEJ;;;AC9FA,SAAS,qCAAqC;AAmB1C,gBAAAE,YAAA;AAZJ,IAAM,wBAA+C;AAAA,EACnD;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AACF;AAEO,IAAM,qBAA8D,CAAC,EAAE,SAAS,MAAM;AAC3F,SACE,gBAAAA,KAAC,iCAA8B,OAAO,uBACnC,UACH;AAEJ;","names":["styled","jsx","styled","jsx","jsxs","Container","AnnotationListItem","jsx","jsxs","styled","jsx","styled","jsx"]}
|
|
1
|
+
{"version":3,"sources":["../src/parsers/aeneas.ts","../src/components/AnnotationBox.tsx","../src/components/AnnotationBoxesWrapper.tsx","../src/components/AnnotationText.tsx","../src/utils/runAnnotationAction.ts","../src/components/AnnotationCheckboxes.tsx","../src/components/DownloadAnnotationsButton.tsx","../src/AnnotationProvider.tsx"],"sourcesContent":["import type { AnnotationData } from '@waveform-playlist/core';\n\nexport interface AeneasFragment {\n begin: string;\n end: string;\n id: string;\n language: string;\n lines: string[];\n}\n\nexport function parseAeneas(data: AeneasFragment): AnnotationData {\n return {\n id: data.id,\n start: parseFloat(data.begin),\n end: parseFloat(data.end),\n lines: data.lines,\n language: data.language,\n };\n}\n\nexport function serializeAeneas(annotation: AnnotationData): AeneasFragment {\n return {\n id: annotation.id,\n begin: annotation.start.toFixed(3),\n end: annotation.end.toFixed(3),\n lines: annotation.lines,\n language: annotation.language || 'en',\n };\n}\n","import React, { FunctionComponent } from 'react';\nimport styled from 'styled-components';\nimport { useDraggable } from '@dnd-kit/react';\nimport { Feedback } from '@dnd-kit/dom';\n\n// Per-entity Feedback plugin config (@dnd-kit 0.5+), hoisted for a stable\n// reference. 'none' disables the Feedback plugin for the edge handles — resize\n// visual feedback comes from React state repositioning the annotation, not CSS\n// translate. Declared on the entity so it works inside ANY DragDropProvider.\nconst EDGE_HANDLE_PLUGINS = [Feedback.configure({ feedback: 'none' })];\n\ninterface WrapperProps {\n readonly $left: number;\n readonly $width: number;\n}\n\n// Wrapper positions the annotation and contains both Box and ResizeHandles as siblings\nconst Wrapper = styled.div.attrs<WrapperProps>((props) => ({\n style: {\n left: `${props.$left}px`,\n width: `${props.$width}px`,\n },\n}))<WrapperProps>`\n position: absolute;\n top: 0;\n height: 100%;\n pointer-events: none; /* Let events pass through to children */\n`;\n\ninterface BoxProps {\n readonly $color: string;\n readonly $isActive?: boolean;\n}\n\nconst Box = styled.div<BoxProps>`\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n height: 100%;\n background: ${(props) =>\n props.$isActive\n ? props.theme?.annotationBoxActiveBackground || 'rgba(255, 200, 100, 0.95)'\n : props.theme?.annotationBoxBackground || 'rgba(255, 255, 255, 0.85)'};\n border: ${(props) => (props.$isActive ? '3px' : '2px')} solid\n ${(props) =>\n props.$isActive ? props.theme?.annotationBoxActiveBorder || '#ff9800' : props.$color};\n border-radius: 4px;\n cursor: pointer;\n pointer-events: auto;\n display: flex;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n transition: all 0.2s ease;\n box-shadow: ${(props) =>\n props.$isActive\n ? // The glow of the active box is the box colour (the theme's\n // `annotationBoxBorder`, through the `color` prop) at 40% and 20%.\n `0 2px 8px color-mix(in srgb, ${props.$color} 40%, transparent), inset 0 0 0 1px color-mix(in srgb, ${props.$color} 20%, transparent)`\n : '0 1px 3px rgba(0, 0, 0, 0.1)'};\n\n &:hover {\n background: ${(props) =>\n props.theme?.annotationBoxHoverBackground || 'rgba(255, 255, 255, 0.98)'};\n border-color: ${(props) => props.theme?.annotationBoxActiveBorder || '#ff9800'};\n border-width: 3px;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n }\n`;\n\nconst Label = styled.span`\n font-size: 12px;\n font-weight: 600;\n color: ${(props) => props.theme?.annotationLabelColor || '#2a2a2a'};\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n padding: 0 6px;\n letter-spacing: 0.3px;\n user-select: none;\n`;\n\ninterface ResizeHandleStyledProps {\n $position: 'left' | 'right';\n $isDragging?: boolean;\n}\n\n// ResizeHandles sit inside their annotation's bounds so adjacent annotations'\n// handles never overlap — each handle is independently grabbable.\nconst ResizeHandle = styled.div<ResizeHandleStyledProps>`\n position: absolute;\n top: 0;\n ${(props) => (props.$position === 'left' ? 'left: 0' : 'right: 0')};\n width: 8px;\n height: 100%;\n cursor: ew-resize;\n z-index: 120;\n background: ${(props) =>\n props.$isDragging\n ? props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.2)'\n : 'transparent'};\n border-radius: 4px;\n touch-action: none; /* Important for @dnd-kit on touch devices */\n pointer-events: auto;\n\n &::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 4px;\n height: 60%;\n background: ${(props) =>\n props.$isDragging\n ? props.theme?.annotationResizeHandleActiveColor || 'rgba(0, 0, 0, 0.8)'\n : props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.4)'};\n border-radius: 2px;\n opacity: ${(props) => (props.$isDragging ? 1 : 0.6)};\n transition:\n opacity 0.2s,\n background 0.2s;\n }\n\n &:hover {\n background: ${(props) => props.theme?.annotationResizeHandleColor || 'rgba(0, 0, 0, 0.1)'};\n }\n\n &:hover::before {\n opacity: 1;\n background: ${(props) =>\n props.theme?.annotationResizeHandleActiveColor || 'rgba(0, 0, 0, 0.7)'};\n }\n`;\n\nexport interface AnnotationBoxComponentProps {\n annotationId: string;\n annotationIndex: number;\n startPosition: number;\n endPosition: number;\n label?: string;\n color?: string;\n isActive?: boolean;\n onClick?: () => void;\n editable?: boolean; // Whether to show drag handles\n}\n\nexport const AnnotationBox: FunctionComponent<AnnotationBoxComponentProps> = ({\n annotationId,\n annotationIndex,\n startPosition,\n endPosition,\n label,\n color = '#ff9800',\n isActive = false,\n onClick,\n editable = true,\n}) => {\n const width = Math.max(0, endPosition - startPosition);\n\n // Left (start) boundary draggable\n const leftBoundaryId = `annotation-boundary-start-${annotationIndex}`;\n const { ref: leftRef, isDragSource: isLeftDragging } = useDraggable({\n id: leftBoundaryId,\n data: { annotationId, annotationIndex, edge: 'start' as const },\n disabled: !editable,\n plugins: EDGE_HANDLE_PLUGINS,\n });\n\n // Right (end) boundary draggable\n const rightBoundaryId = `annotation-boundary-end-${annotationIndex}`;\n const { ref: rightRef, isDragSource: isRightDragging } = useDraggable({\n id: rightBoundaryId,\n data: { annotationId, annotationIndex, edge: 'end' as const },\n disabled: !editable,\n plugins: EDGE_HANDLE_PLUGINS,\n });\n\n if (width <= 0) {\n return null;\n }\n\n const handleHandleClick = (e: React.MouseEvent) => {\n // Prevent clicks on resize handles from bubbling to annotation box\n e.stopPropagation();\n };\n\n return (\n <Wrapper $left={startPosition} $width={width}>\n <Box $color={color} $isActive={isActive} onClick={onClick}>\n {label && <Label>{label}</Label>}\n </Box>\n {editable && (\n <ResizeHandle\n ref={leftRef}\n $position=\"left\"\n $isDragging={isLeftDragging}\n onClick={handleHandleClick}\n />\n )}\n {editable && (\n <ResizeHandle\n ref={rightRef}\n $position=\"right\"\n $isDragging={isRightDragging}\n onClick={handleHandleClick}\n />\n )}\n </Wrapper>\n );\n};\n","import React, { FunctionComponent } from 'react';\nimport styled from 'styled-components';\n\ninterface ContainerProps {\n readonly $height: number;\n readonly $width?: number;\n}\n\nconst Container = styled.div.attrs<ContainerProps>((props) => ({\n style: {\n height: `${props.$height}px`,\n width: props.$width !== undefined ? `${props.$width}px` : undefined,\n },\n}))<ContainerProps>`\n position: relative;\n background: transparent;\n z-index: 110;\n`;\n\nconst BoxesContainer = styled.div<{ $offset?: number }>`\n position: relative;\n height: 100%;\n padding-left: ${(props) => props.$offset || 0}px;\n`;\n\nexport interface AnnotationBoxesWrapperProps {\n className?: string;\n children?: React.ReactNode;\n height?: number;\n offset?: number;\n width?: number;\n}\n\nexport const AnnotationBoxesWrapper: FunctionComponent<AnnotationBoxesWrapperProps> = ({\n children,\n className,\n height = 30,\n offset = 0,\n width,\n}) => {\n return (\n <Container className={className} $height={height} $width={width}>\n <BoxesContainer $offset={offset}>{children}</BoxesContainer>\n </Container>\n );\n};\n","import React, { FunctionComponent, useCallback, useRef, useEffect } from 'react';\nimport { runAnnotationAction } from '../utils/runAnnotationAction';\nimport styled from 'styled-components';\nimport type {\n AnnotationData,\n AnnotationAction,\n AnnotationActionOptions,\n RenderAnnotationItemProps,\n AnnotationStore,\n} from '@waveform-playlist/core';\n\ninterface ContainerProps {\n $height?: number;\n}\n\n/** The colour of the active row and of the focus rings (theme: `annotationTextItemActiveColor`). */\nconst activeColor = (props: { theme?: { annotationTextItemActiveColor?: string } }) =>\n props.theme?.annotationTextItemActiveColor || '#ff9800';\n/** That colour at an opacity, as the tints and glows of the active row use it. */\nconst activeTint = (percent: number) => (props: Parameters<typeof activeColor>[0]) =>\n `color-mix(in srgb, ${activeColor(props)} ${percent}%, transparent)`;\n\nconst Container = styled.div<ContainerProps>`\n background: ${(props) => props.theme?.backgroundColor || '#fff'};\n ${(props) => (props.$height ? `height: ${props.$height}px;` : 'max-height: 200px;')}\n overflow-y: auto;\n padding: 8px;\n`;\n\nconst AnnotationItem = styled.div<{ $isActive?: boolean }>`\n padding: 12px;\n margin-bottom: 6px;\n border-left: 4px solid ${(props) => (props.$isActive ? activeColor(props) : 'transparent')};\n background: ${(props) => (props.$isActive ? activeTint(15)(props) : 'transparent')};\n border-radius: 4px;\n transition: all 0.2s;\n cursor: pointer;\n box-shadow: ${(props) =>\n props.$isActive\n ? `0 2px 8px ${activeTint(25)(props)}, inset 0 0 0 1px ${activeTint(30)(props)}`\n : 'none'};\n\n &:hover {\n background: ${(props) =>\n props.$isActive\n ? activeTint(20)(props)\n : props.theme?.annotationTextItemHoverBackground || 'rgba(0, 0, 0, 0.05)'};\n border-left-color: ${(props) =>\n props.$isActive ? activeColor(props) : props.theme?.borderColor || '#ddd'};\n }\n\n &:focus-visible {\n outline: 2px solid ${activeColor};\n outline-offset: 2px;\n }\n`;\n\nconst AnnotationHeader = styled.div`\n display: flex;\n justify-content: space-between;\n align-items: center;\n margin-bottom: 6px;\n`;\n\nconst AnnotationInfo = styled.div`\n display: flex;\n align-items: center;\n gap: 8px;\n`;\n\nconst AnnotationIdLabel = styled.span<{ $isEditable?: boolean }>`\n font-size: 11px;\n font-weight: 600;\n color: ${(props) => props.theme?.textColorMuted || '#666'};\n background: transparent;\n padding: 2px 6px;\n border-radius: 3px;\n min-width: 20px;\n outline: ${(props) =>\n props.$isEditable ? `1px dashed ${props.theme?.borderColor || '#ddd'}` : 'none'};\n\n &[contenteditable='true']:focus {\n outline: 2px solid ${activeColor};\n background: ${activeTint(10)};\n }\n`;\n\nconst TimeRange = styled.span`\n font-size: 12px;\n font-weight: 500;\n color: ${(props) => props.theme?.textColorMuted || '#555'};\n font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;\n letter-spacing: 0.5px;\n`;\n\nconst AnnotationControls = styled.div`\n display: flex;\n gap: 6px;\n`;\n\nconst ControlButton = styled.button`\n background: ${(props) => props.theme?.surfaceColor || '#f5f5f5'};\n border: 1px solid ${(props) => props.theme?.borderColor || '#ccc'};\n color: ${(props) => props.theme?.textColor || '#333'};\n padding: 4px 8px;\n font-size: 14px;\n cursor: pointer;\n border-radius: 4px;\n transition: all 0.15s ease;\n\n &:hover {\n background: ${(props) => props.theme?.inputBackground || '#3d3d3d'};\n border-color: ${(props) => props.theme?.textColorMuted || '#999'};\n transform: scale(1.05);\n }\n\n &:active {\n transform: scale(0.95);\n }\n`;\n\nconst AnnotationTextContent = styled.div<{ $isEditable?: boolean }>`\n font-size: 14px;\n line-height: 1.6;\n color: ${(props) => props.theme?.textColor || '#2a2a2a'};\n white-space: pre-wrap;\n word-break: break-word;\n outline: ${(props) =>\n props.$isEditable ? `1px dashed ${props.theme?.borderColor || '#ddd'}` : 'none'};\n padding: ${(props) => (props.$isEditable ? '6px' : '0')};\n border-radius: 3px;\n min-height: 20px;\n\n &[contenteditable='true']:focus {\n outline: 2px solid ${activeColor};\n background: ${activeTint(10)};\n }\n`;\n\nexport interface AnnotationTextProps {\n /** What the list draws. */\n annotations: readonly AnnotationData[];\n activeAnnotationId?: string;\n shouldScrollToActive?: boolean;\n /** Where to position the active annotation when scrolling: 'center', 'start', 'end', or 'nearest'. Defaults to 'center'. */\n scrollActivePosition?: ScrollLogicalPosition;\n /** Which scrollable containers to scroll: 'nearest' (only the annotation list) or 'all' (including viewport). Defaults to 'nearest'. */\n scrollActiveContainer?: 'nearest' | 'all';\n editable?: boolean;\n controls?: AnnotationAction[];\n annotationListConfig?: AnnotationActionOptions;\n height?: number;\n onAnnotationClick?: (annotation: AnnotationData) => void;\n /**\n * Where the edits are written (#867): text, id and control edits call\n * `store.update`, find their annotation by id in the store's current list,\n * and a field whose edit was not stored shows the stored value again.\n * `annotations` stays what the list draws. Without `store` the list is\n * read-only: no field can be edited and no control is drawn, whatever\n * `editable` says.\n */\n store?: AnnotationStore;\n /**\n * Custom render function for annotation items.\n * When provided, completely replaces the default annotation item rendering.\n * Use this to customize the appearance of each annotation in the list.\n */\n renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;\n}\n\nconst NO_CONTROLS: AnnotationAction[] = [];\n\nconst formatTime = (seconds: number): string => {\n if (isNaN(seconds) || !isFinite(seconds)) {\n return '0:00.000';\n }\n const mins = Math.floor(seconds / 60);\n const secs = (seconds % 60).toFixed(3);\n return `${mins}:${secs.padStart(6, '0')}`;\n};\n\nconst getIconClass = (classString: string) => {\n return classString.replace(/\\./g, ' ');\n};\n\nconst blurOnEnter = (e: React.KeyboardEvent<HTMLElement>) => {\n if (e.key === 'Enter') {\n e.preventDefault();\n e.currentTarget.blur();\n }\n};\n\ninterface AnnotationListItemProps {\n annotation: AnnotationData;\n index: number;\n isActive: boolean;\n /** Set on the active item only, so the list can scroll to it. */\n itemRef?: React.Ref<HTMLDivElement>;\n editable: boolean;\n controls: AnnotationAction[];\n onAnnotationClick?: (annotation: AnnotationData) => void;\n onTextEdit: (index: number, newText: string, field: HTMLElement) => void;\n onIdEdit: (index: number, newId: string, field: HTMLElement) => void;\n onControlClick: (control: AnnotationAction, index: number) => void;\n renderAnnotationItem?: (props: RenderAnnotationItemProps) => React.ReactNode;\n}\n\n/**\n * One row of the list. Memoized: the active annotation changes at every\n * annotation boundary during playback, and only the row that stops being\n * active and the row that becomes active have a changed prop (#740). Every\n * function handed to it must therefore keep its identity across a render of\n * the list that did not change it.\n */\nconst AnnotationListItem = React.memo(function AnnotationListItem({\n annotation,\n index,\n isActive,\n itemRef,\n editable,\n controls,\n onAnnotationClick,\n onTextEdit,\n onIdEdit,\n onControlClick,\n renderAnnotationItem,\n}: AnnotationListItemProps) {\n const handleClick = () => onAnnotationClick?.(annotation);\n // The default row: a click in a field that is being edited places the\n // caret, it does not choose the annotation. (The action buttons stop their\n // own clicks.)\n const handleRowClick = (event: React.MouseEvent<HTMLElement>) => {\n const target = event.target as Element | null;\n if (target?.closest?.('[contenteditable=\"true\"]')) return;\n handleClick();\n };\n\n // Use custom render function if provided\n if (renderAnnotationItem) {\n return (\n <div ref={itemRef}>\n {renderAnnotationItem({\n annotation,\n index,\n isActive,\n onClick: handleClick,\n formatTime,\n })}\n </div>\n );\n }\n\n // Default rendering\n return (\n <AnnotationItem ref={itemRef} $isActive={isActive} onClick={handleRowClick}>\n <AnnotationHeader>\n <AnnotationInfo>\n <AnnotationIdLabel\n $isEditable={editable}\n contentEditable={editable}\n suppressContentEditableWarning\n onBlur={(e) => onIdEdit(index, e.currentTarget.textContent || '', e.currentTarget)}\n onKeyDown={blurOnEnter}\n >\n {annotation.id}\n </AnnotationIdLabel>\n <TimeRange>\n {formatTime(annotation.start)} - {formatTime(annotation.end)}\n </TimeRange>\n </AnnotationInfo>\n {controls.length > 0 && (\n <AnnotationControls onClick={(e) => e.stopPropagation()}>\n {controls.map((control, idx) => (\n <ControlButton\n key={idx}\n title={control.title}\n onClick={() => onControlClick(control, index)}\n >\n {control.text ? control.text : <i className={getIconClass(control.class || '')} />}\n </ControlButton>\n ))}\n </AnnotationControls>\n )}\n </AnnotationHeader>\n <AnnotationTextContent\n $isEditable={editable}\n contentEditable={editable}\n suppressContentEditableWarning\n onBlur={(e) => onTextEdit(index, e.currentTarget.textContent || '', e.currentTarget)}\n onKeyDown={blurOnEnter}\n >\n {annotation.lines.join('\\n')}\n </AnnotationTextContent>\n </AnnotationItem>\n );\n});\n\nconst AnnotationTextComponent: FunctionComponent<AnnotationTextProps> = ({\n annotations,\n activeAnnotationId,\n shouldScrollToActive = false,\n scrollActivePosition = 'center',\n scrollActiveContainer = 'nearest',\n editable = false,\n controls = NO_CONTROLS,\n annotationListConfig,\n height,\n onAnnotationClick,\n store,\n renderAnnotationItem,\n}) => {\n // Nowhere to write: the list is read-only.\n const writable = store !== undefined;\n const fieldsEditable = editable && writable;\n const shownControls = writable ? controls : NO_CONTROLS;\n const activeAnnotationRef = useRef<HTMLDivElement>(null);\n\n // Auto-scroll to active annotation when it changes\n useEffect(() => {\n // Only scroll if parent says we should (prevents scrolling on remount after pause)\n if (activeAnnotationId && activeAnnotationRef.current && shouldScrollToActive) {\n activeAnnotationRef.current.scrollIntoView({\n behavior: 'smooth',\n block: scrollActivePosition,\n container: scrollActiveContainer,\n } as ScrollIntoViewOptions);\n }\n }, [activeAnnotationId, shouldScrollToActive, scrollActivePosition, scrollActiveContainer]);\n\n // The three handlers below are props of every memoized row. Their\n // dependencies do not change when only the active annotation does.\n // The handlers below are props of every memoized row. They read the list\n // through a ref so that a change to one annotation (each move of an edge\n // drag) re-renders that annotation's row and not all of them.\n const annotationsRef = useRef(annotations);\n annotationsRef.current = annotations;\n // The options an action is called with are only needed when its button is\n // pressed. Read through a ref, a change of them (a link-endpoints or\n // continuous-play toggle) does not give every row a new handler.\n const annotationListConfigRef = useRef(annotationListConfig);\n annotationListConfigRef.current = annotationListConfig;\n\n /** Show the stored value in a field whose edit was not stored. */\n const showStored = (field: HTMLElement, stored: string | undefined) => {\n if (stored !== undefined && field.textContent !== stored) field.textContent = stored;\n };\n\n const handleTextEdit = useCallback(\n (index: number, newText: string, field: HTMLElement) => {\n if (!editable) return;\n const id = annotationsRef.current[index]?.id;\n if (store) {\n if (id === undefined) return;\n const lines = newText.split('\\n');\n store.update((current) => {\n const at = current.findIndex((a) => a.id === id);\n if (at < 0 || current[at].lines.join('\\n') === lines.join('\\n')) return current;\n const next = [...current];\n next[at] = { ...current[at], lines };\n return next;\n });\n showStored(\n field,\n store\n .getAnnotations()\n .find((a) => a.id === id)\n ?.lines.join('\\n')\n );\n }\n },\n [editable, store]\n );\n\n const handleIdEdit = useCallback(\n (index: number, newId: string, field: HTMLElement) => {\n if (!editable) return;\n const trimmedId = newId.trim();\n const id = annotationsRef.current[index]?.id;\n if (store) {\n if (id === undefined) return;\n // An empty id and one another annotation has are refused (#867).\n if (trimmedId && trimmedId !== id) {\n store.update((current) => {\n const at = current.findIndex((a) => a.id === id);\n if (at < 0 || current.some((a) => a.id === trimmedId)) return current;\n const next = [...current];\n next[at] = { ...current[at], id: trimmedId };\n return next;\n });\n }\n const list = store.getAnnotations();\n const renamed = !list.some((a) => a.id === id) && list.some((a) => a.id === trimmedId);\n showStored(field, renamed ? trimmedId : id);\n }\n },\n [editable, store]\n );\n\n const handleControlClick = useCallback(\n (control: AnnotationAction, index: number) => {\n if (store) {\n const id = annotationsRef.current[index]?.id;\n if (id === undefined) return;\n store.update((current) =>\n runAnnotationAction(current, id, control, annotationListConfigRef.current || {})\n );\n }\n },\n [store]\n );\n\n return (\n <Container $height={height}>\n {annotations.map((annotation, index) => {\n const isActive = annotation.id === activeAnnotationId;\n return (\n <AnnotationListItem\n key={annotation.id}\n annotation={annotation}\n index={index}\n isActive={isActive}\n itemRef={isActive ? activeAnnotationRef : undefined}\n editable={fieldsEditable}\n controls={shownControls}\n onAnnotationClick={onAnnotationClick}\n onTextEdit={handleTextEdit}\n onIdEdit={handleIdEdit}\n onControlClick={handleControlClick}\n renderAnnotationItem={renderAnnotationItem}\n />\n );\n })}\n </Container>\n );\n};\n\n// Memoize to prevent unnecessary remounting when parent re-renders\nexport const AnnotationText = React.memo(AnnotationTextComponent);\n","import type {\n AnnotationAction,\n AnnotationActionOptions,\n AnnotationData,\n} from '@waveform-playlist/core';\n\nfunction copyAnnotation(annotation: AnnotationData): AnnotationData {\n return { ...annotation, lines: [...annotation.lines] };\n}\n\n/** The same fields with the same values, `lines` compared element by element. */\nfunction sameAnnotation(a: AnnotationData, b: AnnotationData): boolean {\n const keys = new Set([...Object.keys(a), ...Object.keys(b)]);\n for (const key of keys) {\n const x = (a as unknown as Record<string, unknown>)[key];\n const y = (b as unknown as Record<string, unknown>)[key];\n if (key === 'lines' && Array.isArray(x) && Array.isArray(y)) {\n if (x.length !== y.length || x.some((line, i) => line !== y[i])) return false;\n } else if (x !== y) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Run a list control's `action` for the annotation with `id` on `current`,\n * the store's list as it is now, and return the list to store.\n *\n * An action changes the list and the annotation objects in place (the\n * example page's split sets `annotation.end`), and the store's objects are\n * frozen in development, so the action gets a new array of copies: each\n * annotation with its own `lines`. Afterwards every copy that is still equal\n * to its original is replaced by the original, so rows compared by object do\n * not re-render for annotations the action did not touch. `index` is the\n * position of `id` in `current`. Returns `current` itself when `id` is not\n * in it or the action changed nothing.\n */\nexport function runAnnotationAction(\n current: readonly AnnotationData[],\n id: string,\n control: AnnotationAction,\n options: AnnotationActionOptions\n): readonly AnnotationData[] {\n const index = current.findIndex((annotation) => annotation.id === id);\n if (index < 0) return current;\n\n const copies = current.map(copyAnnotation);\n const originalOf = new Map(copies.map((copy, i) => [copy, current[i]]));\n control.action(copies[index], index, copies, options);\n\n const result = copies.map((copy) => {\n const original = originalOf.get(copy);\n return original && sameAnnotation(copy, original) ? original : copy;\n });\n const unchanged =\n result.length === current.length && result.every((annotation, i) => annotation === current[i]);\n return unchanged ? current : result;\n}\n","import React, { useId } from 'react';\nimport {\n BaseCheckboxWrapper,\n BaseCheckbox,\n BaseCheckboxLabel,\n} from '@waveform-playlist/ui-components';\nimport { useAnnotationOptions, usePlaybackControls } from '@waveform-playlist/browser';\n\nexport interface AnnotationCheckboxProps {\n /** On the element that wraps the checkbox and its label. */\n className?: string;\n disabled?: boolean;\n /** The label. Default (also for `null`): the option's English name. */\n children?: React.ReactNode;\n}\n\ninterface OptionCheckboxProps extends AnnotationCheckboxProps {\n checked: boolean;\n onChange: (checked: boolean) => void;\n /** Class of the input itself (kept from the older checkboxes). */\n inputClassName?: string;\n}\n\nconst OptionCheckbox: React.FC<OptionCheckboxProps> = ({\n checked,\n onChange,\n inputClassName,\n className,\n disabled,\n children,\n}) => {\n // Generated: two of one checkbox on a page must not share an id.\n const id = useId();\n return (\n <BaseCheckboxWrapper className={className}>\n <BaseCheckbox\n type=\"checkbox\"\n id={id}\n className={inputClassName}\n checked={checked}\n onChange={(e) => onChange(e.target.checked)}\n disabled={disabled}\n />\n <BaseCheckboxLabel htmlFor={id}>{children}</BaseCheckboxLabel>\n </BaseCheckboxWrapper>\n );\n};\n\n// In each control the props it was given come first and the bound ones after,\n// so a `checked` or `onChange` left over from the controlled form these names\n// had before cannot replace the provider's.\n\n/**\n * Shows and sets the provider's `continuousPlay` option: on, playback runs on\n * through the following annotations. Under either playlist provider.\n */\nexport const ContinuousPlayCheckbox: React.FC<AnnotationCheckboxProps> = ({\n children,\n ...rest\n}) => {\n const { continuousPlay } = useAnnotationOptions();\n const { setContinuousPlay } = usePlaybackControls();\n return (\n <OptionCheckbox\n {...rest}\n checked={continuousPlay}\n onChange={setContinuousPlay}\n inputClassName=\"continuous-play\"\n >\n {children ?? 'Continuous Play'}\n </OptionCheckbox>\n );\n};\n\n/**\n * Shows and sets the provider's `linkEndpoints` option: on, a dragged edge\n * takes the edge it touches along. Under either playlist provider.\n */\nexport const LinkEndpointsCheckbox: React.FC<AnnotationCheckboxProps> = ({ children, ...rest }) => {\n const { linkEndpoints } = useAnnotationOptions();\n const { setLinkEndpoints } = usePlaybackControls();\n return (\n <OptionCheckbox\n {...rest}\n checked={linkEndpoints}\n onChange={setLinkEndpoints}\n inputClassName=\"link-endpoints\"\n >\n {children ?? 'Link Endpoints'}\n </OptionCheckbox>\n );\n};\n\n/**\n * Shows and sets the provider's `editable` option: whether annotation edges\n * and text can be changed. Under either playlist provider.\n */\nexport const EditableCheckbox: React.FC<AnnotationCheckboxProps> = ({ children, ...rest }) => {\n const { editable } = useAnnotationOptions();\n const { setAnnotationsEditable } = usePlaybackControls();\n return (\n <OptionCheckbox {...rest} checked={editable} onChange={setAnnotationsEditable}>\n {children ?? 'Editable Annotations'}\n </OptionCheckbox>\n );\n};\n","import React from 'react';\nimport styled from 'styled-components';\nimport { useAnnotations } from '@waveform-playlist/browser';\nimport { serializeAeneas } from '../parsers/aeneas';\n\nconst StyledButton = styled.button`\n padding: 0.5rem 1rem;\n background: ${(props) => props.theme?.surfaceColor || '#f5f5f5'};\n color: ${(props) => props.theme?.textColor || '#333'};\n border: 1px solid ${(props) => props.theme?.borderColor || '#ccc'};\n border-radius: ${(props) => props.theme?.borderRadius || '4px'};\n cursor: pointer;\n font-family: ${(props) => props.theme?.fontFamily || 'inherit'};\n font-size: ${(props) => props.theme?.fontSize || '14px'};\n font-weight: 500;\n transition: all 0.15s ease;\n\n &:hover:not(:disabled) {\n background: ${(props) => props.theme?.inputBackground || '#3d3d3d'};\n border-color: ${(props) => props.theme?.textColorMuted || '#999'};\n }\n\n &:focus {\n outline: none;\n box-shadow: 0 0 0 2px ${(props) => props.theme?.inputFocusBorder || '#007bff'}44;\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n`;\n\nexport interface DownloadAnnotationsButtonProps {\n /** Name of the downloaded file. Default: `annotations.json`. */\n filename?: string;\n disabled?: boolean;\n className?: string;\n /** The label. Default: `Download JSON`. */\n children?: React.ReactNode;\n /**\n * The tooltip. Default: an English sentence, a different one when there is\n * nothing to download. Given, it is used in both cases.\n */\n title?: string;\n}\n\n/**\n * Downloads the provider's annotations as an array of Aeneas fragments.\n * Under either playlist provider.\n */\nexport const DownloadAnnotationsButton: React.FC<DownloadAnnotationsButtonProps> = ({\n filename = 'annotations.json',\n disabled = false,\n className,\n children = 'Download JSON',\n title,\n}) => {\n const { annotations } = useAnnotations();\n const handleDownload = () => {\n // Serialize annotations to Aeneas JSON format\n const jsonData = annotations.map((annotation) => serializeAeneas(annotation));\n const jsonString = JSON.stringify(jsonData, null, 2);\n\n // Create a blob and download link\n const blob = new Blob([jsonString], { type: 'application/json' });\n const url = URL.createObjectURL(blob);\n const link = document.createElement('a');\n link.href = url;\n link.download = filename;\n\n // Trigger download\n document.body.appendChild(link);\n link.click();\n\n // Cleanup\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n return (\n <StyledButton\n onClick={handleDownload}\n disabled={disabled || annotations.length === 0}\n className={className}\n title={\n title ??\n (annotations.length === 0\n ? 'No annotations to download'\n : 'Download the annotations as JSON')\n }\n >\n {children}\n </StyledButton>\n );\n};\n","import React from 'react';\nimport { AnnotationIntegrationProvider } from '@waveform-playlist/browser';\nimport type { AnnotationIntegration } from '@waveform-playlist/browser';\nimport { parseAeneas, serializeAeneas } from './parsers/aeneas';\nimport { AnnotationText } from './components/AnnotationText';\nimport { AnnotationBox } from './components/AnnotationBox';\nimport { AnnotationBoxesWrapper } from './components/AnnotationBoxesWrapper';\n\nconst annotationIntegration: AnnotationIntegration = {\n parseAeneas: parseAeneas as (data: unknown) => import('@waveform-playlist/core').AnnotationData,\n serializeAeneas: serializeAeneas as (\n annotation: import('@waveform-playlist/core').AnnotationData\n ) => unknown,\n AnnotationText,\n AnnotationBox,\n AnnotationBoxesWrapper,\n};\n\nexport const AnnotationProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {\n return (\n <AnnotationIntegrationProvider value={annotationIntegration}>\n {children}\n </AnnotationIntegrationProvider>\n );\n};\n"],"mappings":";AAUO,SAAS,YAAY,MAAsC;AAChE,SAAO;AAAA,IACL,IAAI,KAAK;AAAA,IACT,OAAO,WAAW,KAAK,KAAK;AAAA,IAC5B,KAAK,WAAW,KAAK,GAAG;AAAA,IACxB,OAAO,KAAK;AAAA,IACZ,UAAU,KAAK;AAAA,EACjB;AACF;AAEO,SAAS,gBAAgB,YAA4C;AAC1E,SAAO;AAAA,IACL,IAAI,WAAW;AAAA,IACf,OAAO,WAAW,MAAM,QAAQ,CAAC;AAAA,IACjC,KAAK,WAAW,IAAI,QAAQ,CAAC;AAAA,IAC7B,OAAO,WAAW;AAAA,IAClB,UAAU,WAAW,YAAY;AAAA,EACnC;AACF;;;AC3BA,OAAO,YAAY;AACnB,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AA0LrB,SAEc,KAFd;AApLJ,IAAM,sBAAsB,CAAC,SAAS,UAAU,EAAE,UAAU,OAAO,CAAC,CAAC;AAQrE,IAA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Item","jsx","jsxs","styled","jsx","styled","jsx"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@waveform-playlist/annotations",
|
|
3
|
-
"version": "14.0.0-next.
|
|
3
|
+
"version": "14.0.0-next.11",
|
|
4
4
|
"description": "Annotation support for waveform-playlist",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -38,25 +38,26 @@
|
|
|
38
38
|
"@testing-library/react": "^16.3.2",
|
|
39
39
|
"@types/react": "^19.2.0",
|
|
40
40
|
"@types/react-dom": "^19.2.0",
|
|
41
|
-
"@types/styled-components": "^5.1.36",
|
|
42
41
|
"jsdom": "^28.1.0",
|
|
43
42
|
"react": "^19.2.7",
|
|
44
43
|
"react-dom": "^19.2.7",
|
|
44
|
+
"styled-components": "^6.4.2",
|
|
45
45
|
"tsup": "^8.5.1",
|
|
46
46
|
"typescript": "^5.9.3",
|
|
47
47
|
"vitest": "^5.0.3",
|
|
48
|
-
"@waveform-playlist/browser": "17.0.0-next.
|
|
48
|
+
"@waveform-playlist/browser": "17.0.0-next.17"
|
|
49
49
|
},
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@waveform-playlist/
|
|
52
|
-
"@waveform-playlist/
|
|
51
|
+
"@waveform-playlist/ui-components": "15.0.0-next.11",
|
|
52
|
+
"@waveform-playlist/core": "13.0.0-next.7"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
55
|
"@dnd-kit/dom": "^0.5.0",
|
|
56
56
|
"@dnd-kit/react": "^0.5.0",
|
|
57
57
|
"react": "^19.0.0",
|
|
58
|
+
"react-dom": "^19.0.0",
|
|
58
59
|
"styled-components": "^6.0.0",
|
|
59
|
-
"@waveform-playlist/browser": "^17.0.0-next.
|
|
60
|
+
"@waveform-playlist/browser": "^17.0.0-next.17"
|
|
60
61
|
},
|
|
61
62
|
"scripts": {
|
|
62
63
|
"build": "tsup",
|