strata-react 1.3.22 → 1.3.23

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 CHANGED
@@ -233,7 +233,7 @@ thousands of lines. Such an app imports the same stylesheet **without the reset*
233
233
  | Overlays | `Dialog`, `DialogProps`, `AlertDialog`, `Popover`, `Tooltip` | React Aria underneath. A dialog always has a title and, via `actions`'s close render prop, a way out; `closable={false}` while work cannot stop; `placement="end"` is a sheet. `AlertDialog` is the only confirm: required verb on the confirm button, Cancel focused first, no outside dismiss, stays open with the reason when an async confirm fails. `Popover` needs a `label`. `Tooltip` opens on hover and focus and `IconButton` uses it. All portal onto the `layer-*` stacking utilities |
234
234
  | Value controls | `NumberField`, `Slider`, `ColorField`, `SecretField` | Set a number or colour precisely, inside `Field`. `NumberField` and `Slider` are React Aria's; the number field runs with `commitBehavior="validate"`, so a typed value outside `min`/`max` is kept on screen, explained in the `Field` ("Enter a value from 0% to 500%.") and never passed to `onChange`. A value that is not known is `null` and shows an en dash, never 0 or NaN. Digits and decimal mark follow `locale`. The unit sits inside the control, and in the slider's spoken value when `Intl` has it (%, °, ms, s, kB, MB, GB, kbps, Mbps). Arrows step, Home/End jump to the limits; `Slider editable` adds a number field. `ColorField`: platform picker, typed hex that is normalised, app suggestions, and a contrast note against `against`. No motion on value changes. `NumberField` options for a value set a little at a time or that costs work to change: `nudge={[0.1, 1, 10]}` (a toolbar of named step buttons that repeat when held and stop at the limits), `suggestion={{ value, label, reason }}` (a row with the reason in words and Use this value, never applied by itself) and `preview` (changes wait behind Apply and Revert; `onChange` is Apply's). `SecretField` is a credential the server keeps and never shows again: not set, set (no characters, no length, no input in the DOM), a masked entry with a Show toggle named for what it reveals, `onSave` through `AsyncButton`, Replace, a confirmed Remove that says what stops working, and a Test whose result is text beside it; a set, untouched field reports nothing |
235
235
  | 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` |
236
- | Media player | `MediaPlayer`, `useMediaElement`, `SPEECH_RATES`, `useMediaSpans`, `SpanActions`, `PlayerNotice`, `SpanStrip`, `MediaContents` | Play a file or a sequence of chapters without the event glue: `marks` puts one file's own chapters on the seek bar, and `MediaContents` lists them beside the player (the playing one marked, pressing one plays from its start, never scrolling the page); 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, `heading` (title, subtitle, avatar, each a link, with the app's router `state`) is drawn across the top of a video while paused or the pointer moves, and a video keeps a 16:9 (or `aspect`) box before its metadata loads. A video has a Full screen button and the `f` key by default (`fullscreen={false}` removes them); on the picture a click plays or pauses, a double click toggles full screen and the wheel sets the volume while the player has focus. A kind's `colour` names a custom property of the app's theme (`"--seg-sponsor"`) instead of a tone, each range carries `data-kind`, and under the browser's own controls a `SpanStrip` under the picture draws the ranges. `start` begins a first load at a time (an attacher's `startAt`, or a seek once the metadata is in) and says "Picked up at 2:05" with Start over (`resumeWords`); `onProgress` reports the position and the seconds actually played through, each once, a skipped span counted (`useMediaElement` takes it too, with `markWatched`). The HLS attacher starts a `growing` source at its beginning, honours `config.startPosition` and takes `words` for its failures. |
236
+ | Media player | `MediaPlayer`, `useMediaElement`, `SPEECH_RATES`, `useMediaSpans`, `SpanActions`, `PlayerNotice`, `SpanStrip`, `MediaContents` | Play a file or a sequence of chapters without the event glue: `marks` puts one file's own chapters (and `kind: "scene"` scenes, shorter) on the seek bar, each named in a tooltip and pressed to jump; the skip buttons beside Play step by scene (small) and chapter (large), or by 10 s and 1 min where a file has none (`skip`, `skipAction`); `fps` adds frame steps (`,` and `.`); `float` keeps a playing video in a corner box once the player has scrolled off the screen; and `MediaContents` lists them beside the player (the playing one marked, pressing one plays from its start, never scrolling the page); 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, `heading` (title, subtitle, avatar, each a link, with the app's router `state`) is drawn across the top of a video while paused or the pointer moves, and a video keeps a 16:9 (or `aspect`) box before its metadata loads. A video has a Full screen button and the `f` key by default (`fullscreen={false}` removes them); on the picture a click plays or pauses, a double click toggles full screen and the wheel sets the volume while the player has focus. A kind's `colour` names a custom property of the app's theme (`"--seg-sponsor"`) instead of a tone, each range carries `data-kind`, and under the browser's own controls a `SpanStrip` under the picture draws the ranges. `start` begins a first load at a time (an attacher's `startAt`, or a seek once the metadata is in) and says "Picked up at 2:05" with Start over (`resumeWords`); `onProgress` reports the position and the seconds actually played through, each once, a skipped span counted (`useMediaElement` takes it too, with `markWatched`). The HLS attacher starts a `growing` source at its beginning, honours `config.startPosition` and takes `words` for its failures. |
237
237
  | 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` |
238
238
  | Listening and reading | `Waveform`, `TranscriptView`, `PlayWindowButton`, `MediaGroup`, `FilmStrip`; `resamplePeaks`, `peaksFromAudio`, `peakGain`, `phraseAt`, `wordAt`, `pickEvenly`, `frameAt` | 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, `normalise` to draw quiet sound to fill the height and say by how much); `FilmStrip` is a row of frames from a stretch of video that fits its width (picked evenly), each with its time, pressing one seeks (`onSeek`, one tab stop with arrow keys), and the frame at `time` inside `span` is ringed; 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 |
239
239
  | 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 |
package/UPGRADING.md CHANGED
@@ -11,6 +11,11 @@ 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
+ ## 2026-11-26 (player skips and frame steps, #387)
15
+ - **`MediaPlayer` draws skip buttons either side of Play** (`Back 10 s`, `Forward 10 s`, `Back 1 min`, `Forward 1 min`, or `Previous scene`, `Next chapter`… when `marks` has them), and a sequence's `Previous chapter` now comes before Play. A test that listed the `Playback` toolbar's buttons, or found the only "Play" by position, needs the new names; `skip={false}` removes them. Visual baselines with a player move.
16
+ - `SeekBar` marks are buttons with a `Tooltip`, not a `title`: a test that read a mark's `title` reads its accessible name (unchanged, "Dinner, 10:00") or hovers for the tooltip.
17
+ - `MediaPlayer` no longer renders `Transport`; the toolbar is still named "Playback".
18
+
14
19
  ## 2026-11-25 (seek bar marks past the end)
15
20
  - **`SeekBar` (and `MediaPlayer` through it) no longer draws a mark outside 0 to the duration.** A test that found a mark button past the loaded file's end will not find it; pass marks within the file.
16
21
 
@@ -1,4 +1,5 @@
1
1
  import { PlayerWarningEvent } from './player-warning';
2
+ import { MediaMark, SkipSteps } from './media-skip';
2
3
  import { MediaSpanData, SpanKind, SpanOutcome, SpanWords } from './media-spans';
3
4
  import { MediaProgress } from './media-progress';
4
5
  import * as React from "react";
@@ -202,11 +203,14 @@ export type MediaPlayerProps = {
202
203
  spans?: readonly MediaSpanData[];
203
204
  /** For each kind of span: its `label`, its `tone` (a status role) and what happens on reaching one: `"auto"` skips it (or mutes it, for a span whose `action` is `"mute"`) with "Skipped intro" and Undo, `"ask"` offers a Skip button over the picture (and the `s` key), `"off"` (default) only draws it. Keep the object stable (state or `useMemo`). */
204
205
  spanKinds?: Readonly<Record<string, SpanKind>>;
205
- /** Named points of one file drawn on the seek bar (its chapters: "Christmas dinner" at 40:12); pressing one seeks there (strata-react issue #371). For a single `src` without a `window`: a sequence's own marks (each source's start) and a window's take their place. Keep the array stable. */
206
- marks?: readonly {
207
- time: number;
208
- label: string;
209
- }[];
206
+ /** Named points of one file drawn on the seek bar (its chapters: "Christmas dinner" at 40:12, and `kind: "scene"` for the scenes within them), each named in a tooltip; pressing one seeks there (strata-react issues #371, #387). They are also what the skip buttons step through. For a single `src` without a `window`: a sequence's own marks (each source's start) and a window's take their place. Keep the array stable. */
207
+ marks?: readonly MediaMark[];
208
+ /** The skip buttons either side of Play. A file with marks skips by them (scenes small, chapters large: "Next scene", "Previous chapter"); a level without marks skips by time, `small` (default 10 s) and `large` (default 60 s). A sequence's large skip is its previous and next source. `false` draws none. */
209
+ skip?: SkipSteps | false;
210
+ /** The video's frame rate: draws Back one frame and Forward one frame beside Play (and the `,` and `.` keys), which pause and step one frame. Not drawn without it, since a browser does not say a file's rate. */
211
+ fps?: number;
212
+ /** Keep a playing video in sight while the page scrolls: once the player has scrolled off the top of the screen, the picture floats in a small box in the corner with its own seek bar, Play, Back to the player and Close, and goes back in place when the player is scrolled to. The same element moves, so playback carries on. Video only. */
213
+ float?: boolean;
210
214
  /** Told what was done with a span: `skipped`, `muted`, `undone` or `played`. */
211
215
  onSpan?: (span: MediaSpanData, what: SpanOutcome) => void;
212
216
  /** The Skip button's and the notice's words, in the product's language. */
@@ -244,4 +248,4 @@ export declare const SPEECH_RATES: readonly number[];
244
248
  * a touch device), with the failure to load shown and retried. For an editor or a replay, use the
245
249
  * parts and `useMediaElement` directly.
246
250
  */
247
- export declare function MediaPlayer({ label, kind, src, sources, index: controlledIndex, onIndexChange, autoAdvance, controls, autoPlay, poster, session, rates, shortcuts, attach, growing, window: bound, loop, showFull, group, onTimeUpdate, onWindowEnd, onEnded, onTimeChange, spans, spanKinds, marks, onSpan, spanWords, start, resumeWords, onProgress, progressEvery, mediaRef, heading, overlay, status, warning, aspect, fullscreen, className, }: MediaPlayerProps): React.JSX.Element;
251
+ export declare function MediaPlayer({ label, kind, src, sources, index: controlledIndex, onIndexChange, autoAdvance, controls, autoPlay, poster, session, rates, shortcuts, attach, growing, window: bound, loop, showFull, group, onTimeUpdate, onWindowEnd, onEnded, onTimeChange, spans, spanKinds, marks, onSpan, spanWords, start, resumeWords, onProgress, progressEvery, mediaRef, heading, overlay, status, warning, aspect, fullscreen, skip, fps, float, className, }: MediaPlayerProps): React.JSX.Element;
@@ -0,0 +1,31 @@
1
+ /** A named point on a player's timeline: a chapter (the default) or a scene within one. */
2
+ export type MediaMark = {
3
+ time: number;
4
+ label: string;
5
+ kind?: "chapter" | "scene";
6
+ };
7
+ /** The two skip levels. */
8
+ export type SkipLevel = "small" | "large";
9
+ /** The time steps for a file without parts at that level, in seconds. */
10
+ export type SkipSteps = {
11
+ small?: number;
12
+ large?: number;
13
+ };
14
+ /** What a skip does: its button's name, and where it goes (null when there is nowhere, at either end). */
15
+ export type SkipAction = {
16
+ label: string;
17
+ to: number | null;
18
+ by: "mark" | "time";
19
+ };
20
+ /** The marks a level skips by: scenes for small, chapters (and marks with no kind) for large, in time order. */
21
+ export declare function marksFor(marks: readonly MediaMark[], level: SkipLevel): number[];
22
+ /**
23
+ * Where a skip at `level` in `direction` from `time` goes: by the level's marks when the file has any
24
+ * (the file's start counts as one), else by its time step. `restart` is how far into a part
25
+ * "previous" still means its start. The target is kept within 0 to `duration` when that is known, and marks past it are not skipped to.
26
+ */
27
+ export declare function skipAction(marks: readonly MediaMark[], level: SkipLevel, direction: -1 | 1, time: number, { steps, duration, restart }?: {
28
+ steps?: SkipSteps;
29
+ duration?: number | null;
30
+ restart?: number;
31
+ }): SkipAction;
@@ -1,6 +1,7 @@
1
1
  import { SpanTone } from './line-chart';
2
2
  import { Shortcut } from './hotkeys';
3
3
  import { CursorMapping } from './cursor';
4
+ import { MediaMark } from './media-skip';
4
5
  import * as React from "react";
5
6
  export type Precision = "seconds" | "ms" | "frames";
6
7
  type TimeProps = {
@@ -44,18 +45,12 @@ export type SeekBarProps = TimeProps & {
44
45
  duration: number | null;
45
46
  /** The viewer asked for this time (drag, click or key). */
46
47
  onSeek: (time: number) => void;
47
- /** Named points on the bar (chapters, markers). Pressing one seeks to it. */
48
- marks?: readonly {
49
- time: number;
50
- label: string;
51
- }[];
48
+ /** Named points on the bar (chapters, scenes, markers), each with its name and time in a tooltip on hover. Pressing one seeks to it. A `kind: "scene"` mark is drawn shorter and fainter than a chapter, so the parts read inside the whole. */
49
+ marks?: readonly MediaMark[];
52
50
  /** Stretches drawn along the bar as ranges (strata-react issue #207): each named for a screen reader and in a tooltip, in a status role's colour, and never thinner than a few pixels so a one-second span still shows. They only draw; `MediaPlayer`'s `spans` is what acts on them. */
53
51
  spans?: readonly SeekBarSpan[];
54
52
  /** What pressing a mark does. Default seeks to it; a screen that wants to land on it and pause (a moment to look at) passes its own. */
55
- onMarkPress?: (mark: {
56
- time: number;
57
- label: string;
58
- }) => void;
53
+ onMarkPress?: (mark: MediaMark) => void;
59
54
  /** How far has loaded or been recorded, drawn behind the played part. */
60
55
  buffered?: number;
61
56
  /** Arrow key step in seconds. Default 5. */
package/dist/index.d.ts CHANGED
@@ -45,6 +45,7 @@ export { ScheduleTable, type ScheduleTableProps, type ScheduleRow } from './comp
45
45
  export { Thumbnail, ThumbnailSkeleton, type ThumbnailProps, type AspectRatio } from './components/thumbnail';
46
46
  export { FilmStrip, pickEvenly, frameAt, type FilmStripProps, type FilmFrame } from './components/film-strip';
47
47
  export { MediaContents, currentItem, type MediaContentsProps, type MediaContentsItem } from './components/media-contents';
48
+ export { skipAction, marksFor, type MediaMark, type SkipLevel, type SkipSteps, type SkipAction } from './components/media-skip';
48
49
  export { DataTable, TableSkeleton, parseSort, serialiseSort, type CellValue, type Column, type Sort, type DataTableProps, type RowSelection, type RowExpansion, } from './components/data-table';
49
50
  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, type MediaHeading, type MediaProgress, type ResumeWords } from './components/media-player';
50
51
  export { useMediaSpans, SpanActions, PlayerNotice, type SpanActionsNotice, type MediaSpanData, type SpanKind, type SpanBehaviour, type SpanOutcome, type SpanWords, type MediaSpansState } from './components/media-spans';