strata-react 1.0.46 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/UPGRADING.md +4 -0
- package/dist/components/markable-text.d.ts +7 -3
- package/dist/components/transcript-view.d.ts +16 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1413 -1330
- package/dist/index.js.map +1 -1
- package/dist/lib/transcript.d.ts +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -170,7 +170,7 @@ thousands of lines. Such an app imports the same stylesheet **without the reset*
|
|
|
170
170
|
| Notices and progress | `Alert`, `toast`, `StrataToastRegion`, `useClientWork`, `JobStatus` | Three weights. A `toast` confirms finished work and goes by itself (5 s plus 40 ms a character, 8 s minimum with an action, paused under the pointer or focus, always dismissable); it has no danger tone, because an error a person must act on is an inline `Alert` with its recovery as `action` (`announce` makes it `role="alert"` only when it answers something the person just did). `StrataToastRegion` goes once at the app root. `useClientWork` runs browser work with progress, cancel (aborts its `signal`, ends `cancelled`, never `failed`) and a double-start guard; `JobStatus` shows it exactly as it shows a server job, with `onCancel`, `cancelled` and `onDismiss` |
|
|
171
171
|
| Media player | `MediaPlayer`, `useMediaElement`, `SPEECH_RATES`, `useMediaSpans`, `SpanActions` | Play a file or a sequence of chapters without the event glue: the element, its state, Strata's controls (or the browser's own on a touch device, `controls="auto"`), a load error with Try again, `navigator.mediaSession` metadata, the seek bar spanning the whole sequence. `useMediaElement(ref)` alone follows an element drawn with the browser's controls `spans` and `spanKinds` mark stretches (an intro, a recap, a sponsor read) on the seek bar as named ranges in a status role's tone and act on them as playback reaches them: `auto` skips (or mutes, for `action: "mute"`) with "Skipped intro" and Undo, `ask` offers a Skip button over the picture and on the `s` key, `off` only draws; each is acted on once, `onSpan` reports `skipped`, `muted`, `undone` or `played`, and `SeekBar` takes `spans` too. `mediaRef` hands out the player's state and requests (an object ref holds the latest, no render of its own), `overlay` draws the app's own thing over the picture only, and a video keeps a 16:9 (or `aspect`) box before its metadata loads. The HLS attacher starts a `growing` source at its beginning, honours `config.startPosition` and takes `words` for its failures. |
|
|
172
172
|
| Media playback | `Transport`, `SeekBar`, `TimeReadout`, `VolumeControl`, `RateChoice`, `MediaStage`, `StageGuides`, `transportShortcuts`, `format.timecode` | The controls around anything that plays, wired to a player the app owns (HTML media, Web Audio, a canvas, a data replay). Every control is a named icon button in one toolbar; the play button's name is "Play" or "Pause". `SeekBar` has the formatted time as its accessible value, arrows step 5 s and Page keys 30 s by default, and optional marks. `VolumeControl` shows its percent, and muting remembers the level. `transportShortcuts` is the one list for `useHotkeys` and `KeysLegend` (Space and K, J and L, the arrows by a frame, Home and End). `format.timecode` prints m:ss, m:ss.mmm or m:ss:ff. `MediaStage` fits a picture of any aspect ratio into the pane with a letterbox on the sunken surface role, and takes overlays such as `StageGuides` |
|
|
173
|
-
| Listening and reading | `Waveform`, `TranscriptView`, `PlayWindowButton`, `MediaGroup`; `resamplePeaks`, `peaksFromAudio`, `phraseAt`, `wordAt` | Timed media: a waveform from peaks or a decoded file (one slider, marks by line style, named spans, zoom, a keyboard-made range, a spectrogram underlay); timed text that marks the heard word and plays from any word (modes, speakers, follow and Jump to now, virtualised), with doubtful words (dotted, named, counted, "Only doubtful"), a mark per phrase set from a row menu (`states`, `onPhraseState`), correction in place (Enter or F2, `onEdit`) and a hover and focus card (`renderCard`); `MediaPlayer window` plays one stretch of a file, `MediaGroup` lets one player play at a time, `PlayWindowButton` is a row's play control on a shared element |
|
|
173
|
+
| Listening and reading | `Waveform`, `TranscriptView`, `PlayWindowButton`, `MediaGroup`; `resamplePeaks`, `peaksFromAudio`, `phraseAt`, `wordAt` | Timed media: a waveform from peaks or a decoded file (one slider, marks by line style, named spans, zoom, a keyboard-made range, a spectrogram underlay); timed text that marks the heard word and plays from any word (modes, speakers, follow and Jump to now, virtualised), with doubtful words (dotted, named, counted, "Only doubtful"), a mark per phrase set from a row menu (`states`, `onPhraseState`), correction in place (Enter or F2, `onEdit`) and a hover and focus card (`renderCard`); `MediaPlayer window` plays one stretch of a file, `MediaGroup` lets one player play at a time, `PlayWindowButton` is a row's play control on a shared element; a review transcript needs no player (`time` and `onSeek` are optional), takes `marking` (words become `MarkableText` marks with ids `wordId(phraseId, index)`, selected across rows that are not mounted) and shows a corrected word (`word.correction`) dotted with the original on hover and `onCorrectionPress` to open it |
|
|
174
174
|
| Streams | `MediaPlayer attach`/`growing`, `useAttachedSource`, `attachHls` (`strata-react/hls`) | A source the element cannot play is attached by an engine; a source still being made says so, shows what exists as ready, and waits at its end without ending |
|
|
175
175
|
| 360 | `PanoramaViewer` (`strata-react/panorama`), `project`, `unproject`, `describeView` | A 360 picture or video as a controlled window (yaw, pitch, field of view), drag, wheel, pinch and keys, an overlay in the picture's coordinates, said in words, a flat fallback with no WebGL2 |
|
|
176
176
|
| Conversation | `Conversation`, `Composer`, `RichText`; `matchEntities`, `parseRichText` | A question-and-answer thread: answers stream, finish or fail in place (Try again), one polite announcement per finished answer, following only while at the bottom (Jump to latest); answers can carry pictures (`images`, labelled, lazy, linked to full size) that stay visible beside the collapsed "looked up"; a composer that sends on Enter and is disabled with its reason while answering (Stop); a safe text subset (bold, code, lists, http links, never HTML) whose known ids, longest first and whole words only, become buttons |
|
package/UPGRADING.md
CHANGED
|
@@ -11,6 +11,10 @@ time. While the version is 0.x, any release may break.
|
|
|
11
11
|
|
|
12
12
|
Every PR that changes what an app sees adds a line here (see `CLAUDE.md`, "Changelog").
|
|
13
13
|
|
|
14
|
+
## After v1.0.46 (2026-11-14)
|
|
15
|
+
|
|
16
|
+
- `MarkableText` now acts on arrow, Home, End and Escape keys only while its own region has focus; keys from something focusable inside it (a list of rows) are that thing's. Words drawn as `Mark`s with nothing focusable around them behave as before.
|
|
17
|
+
|
|
14
18
|
## After v1.0.44 (2026-11-14)
|
|
15
19
|
|
|
16
20
|
- `SelectableGrid` with `groupBy` is now one virtualised list: a group's heading is a row of the grid (not a `region` with its own list per group), so a test that looked for `getByRole("region", { name })` finds the heading row instead, and only the visible rows are in the DOM. Tiles `isSelectable` refuses are now focusable (not selectable) so the arrow keys land on them and their `unselectableReason` can be read; they were skipped before. The grouped baselines move.
|
|
@@ -18,10 +18,12 @@ export type MarkKind = {
|
|
|
18
18
|
keys?: string[];
|
|
19
19
|
};
|
|
20
20
|
/** One word (or phrase, or clip) that can be marked. Draws its mark, its selection and the caret; inside a `MarkableText`. */
|
|
21
|
-
export declare function Mark({ id, children, className }: {
|
|
21
|
+
export declare function Mark({ id, children, className, onClick, onHover }: {
|
|
22
22
|
id: string;
|
|
23
23
|
children: React.ReactNode;
|
|
24
|
-
className?: string;
|
|
24
|
+
className?: string; /** A click on the word (a press and release on it), beside selecting it: a correction opens. */
|
|
25
|
+
onClick?: () => void; /** The pointer is over the word (its element) or has left (`null`). */
|
|
26
|
+
onHover?: (el: HTMLElement | null) => void;
|
|
25
27
|
}): React.JSX.Element;
|
|
26
28
|
/** "12 words must use, 3 never": a count for each kind in use, with its icon. */
|
|
27
29
|
export declare function MarkSummary({ marks, kinds, unit, className }: {
|
|
@@ -42,6 +44,8 @@ export type MarkableTextProps = {
|
|
|
42
44
|
onMark: (ids: readonly string[], kind: string | null) => void;
|
|
43
45
|
/** Chords that clear the selection's marks: `["w"]`. */
|
|
44
46
|
clearKeys?: string[];
|
|
47
|
+
/** Enter on the caret's id (a word that has something to open, such as a correction). Leave out and Enter does nothing. */
|
|
48
|
+
onActivate?: (id: string) => void;
|
|
45
49
|
/** The caret moved to this id (so a virtualised list can scroll it into view). */
|
|
46
50
|
onCaretChange?: (id: string) => void;
|
|
47
51
|
/** What one id is called in counts: `["word", "words"]`. */
|
|
@@ -53,4 +57,4 @@ export type MarkableTextProps = {
|
|
|
53
57
|
className?: string;
|
|
54
58
|
};
|
|
55
59
|
/** Selects ids over `<Mark>` words by drag, Shift+click and Shift+arrows (a run in the app's order, so it holds across virtualised rows), offers the app's marks as chorded commands in a bar, says each change in words, and lists what is marked. */
|
|
56
|
-
export declare function MarkableText({ label, ids, marks, kinds, onMark, clearKeys, onCaretChange, unit, summary, children, className }: MarkableTextProps): React.JSX.Element;
|
|
60
|
+
export declare function MarkableText({ label, ids, marks, kinds, onMark, clearKeys, onActivate, onCaretChange, unit, summary, children, className }: MarkableTextProps): React.JSX.Element;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { TranscriptGroup, TranscriptPhrase, TranscriptPhraseState } from '../lib/transcript';
|
|
2
|
+
import { MarkKind } from './markable-text';
|
|
2
3
|
import * as React from "react";
|
|
3
4
|
/** What a seek from the transcript says about where it came from. */
|
|
4
5
|
export type TranscriptSeek = {
|
|
@@ -10,10 +11,20 @@ export type TranscriptViewProps = {
|
|
|
10
11
|
label: string;
|
|
11
12
|
/** Phrases by clip, in time order. */
|
|
12
13
|
groups: readonly TranscriptGroup[];
|
|
13
|
-
/** The player's time, seconds. */
|
|
14
|
-
time
|
|
15
|
-
/** A word or phrase was pressed: seconds to play from, and which. */
|
|
16
|
-
onSeek
|
|
14
|
+
/** The player's time, seconds. Leave out for a transcript with no player: nothing is heard or followed. */
|
|
15
|
+
time?: number;
|
|
16
|
+
/** A word or phrase was pressed: seconds to play from, and which. Leave out and the words and times are text. */
|
|
17
|
+
onSeek?: (time: number, from: TranscriptSeek) => void;
|
|
18
|
+
/** Mark words (`MarkableText`): the kinds, the mark on each word id (`wordId(phraseId, index)`), and `onMark(ids, kind | null)`. Words become marks to select, not seek buttons. */
|
|
19
|
+
marking?: {
|
|
20
|
+
kinds: readonly MarkKind[];
|
|
21
|
+
marks: Readonly<Record<string, string | undefined>>;
|
|
22
|
+
onMark: (ids: readonly string[], kind: string | null) => void;
|
|
23
|
+
clearKeys?: string[];
|
|
24
|
+
summary?: boolean;
|
|
25
|
+
};
|
|
26
|
+
/** A corrected word was pressed (a click, with no drag): open it for editing. Takes the click on that word from seeking. */
|
|
27
|
+
onCorrectionPress?: (phraseId: string, wordIndex: number) => void;
|
|
17
28
|
/** The mode shown: "original" (the words) or a key of the phrases' `alt`. Leave out to let the component hold it. */
|
|
18
29
|
mode?: string;
|
|
19
30
|
onModeChange?: (mode: string) => void;
|
|
@@ -49,4 +60,4 @@ export type TranscriptViewProps = {
|
|
|
49
60
|
className?: string;
|
|
50
61
|
};
|
|
51
62
|
/** Timed text that follows playback: the heard word marked, any word or phrase pressed to play from, modes, speakers, follow and Jump to now. */
|
|
52
|
-
export declare function TranscriptView({ label, groups, time, onSeek, mode: controlledMode, onModeChange, modeLabels, speaker: controlledSpeaker, onSpeakerChange, follow, announce, renderPlay, doubtfulBelow, states, onPhraseState, renderActions, onEdit, renderCard, cardDelay, height, className }: TranscriptViewProps): React.JSX.Element;
|
|
63
|
+
export declare function TranscriptView({ label, groups, time, onSeek, marking, onCorrectionPress, mode: controlledMode, onModeChange, modeLabels, speaker: controlledSpeaker, onSpeakerChange, follow, announce, renderPlay, doubtfulBelow, states, onPhraseState, renderActions, onEdit, renderCard, cardDelay, height, className }: TranscriptViewProps): React.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -40,7 +40,7 @@ export { DataTable, TableSkeleton, parseSort, serialiseSort, type CellValue, typ
|
|
|
40
40
|
export { MediaPlayer, useMediaElement, useAttachedSource, SPEECH_RATES, type MediaPlayerProps, type MediaElementState, type MediaElementOptions, type MediaWindow, type StreamContext, type StreamAttachment, type SourceAttacher, type MediaProblem, type MediaSource, type MediaSession } from './components/media-player';
|
|
41
41
|
export { useMediaSpans, SpanActions, type MediaSpanData, type SpanKind, type SpanBehaviour, type SpanOutcome, type SpanWords, type MediaSpansState } from './components/media-spans';
|
|
42
42
|
export { TranscriptView, type TranscriptViewProps, type TranscriptSeek } from './components/transcript-view';
|
|
43
|
-
export { phraseAt, wordAt, isDoubtful, phraseDoubtful, type TranscriptGroup, type TranscriptPhrase, type TranscriptPhraseState, type TranscriptWord } from './lib/transcript';
|
|
43
|
+
export { phraseAt, wordAt, wordId, phraseOfWordId, isDoubtful, phraseDoubtful, type TranscriptGroup, type TranscriptPhrase, type TranscriptPhraseState, type TranscriptWord } from './lib/transcript';
|
|
44
44
|
export { Waveform, type WaveformProps, type WaveformMark, type WaveformMarkKind, type WaveformSpan, type WaveformTone } from './components/waveform';
|
|
45
45
|
export { resamplePeaks, toPeakPair, peaksFromAudio, type WaveformPeaks, type PeakPair, type DecodedAudio } from './lib/waveform';
|
|
46
46
|
export { MediaGroup, PlayWindowButton, joinMediaGroup, type PlayWindowButtonProps } from './components/media-group';
|