strata-react 1.3.10 → 1.3.12
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 +1 -0
- package/dist/components/link.d.ts +10 -1
- package/dist/components/media-player.d.ts +19 -1
- package/dist/components/media.d.ts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +182 -93
- package/dist/index.js.map +1 -1
- package/dist/strata.css +9 -0
- package/dist/strata.migrate.css +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -173,7 +173,7 @@ thousands of lines. Such an app imports the same stylesheet **without the reset*
|
|
|
173
173
|
| 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 |
|
|
174
174
|
| 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 |
|
|
175
175
|
| 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` |
|
|
176
|
-
| Media player | `MediaPlayer`, `useMediaElement`, `SPEECH_RATES`, `useMediaSpans`, `SpanActions`, `PlayerNotice`, `SpanStrip` | 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. 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. |
|
|
176
|
+
| Media player | `MediaPlayer`, `useMediaElement`, `SPEECH_RATES`, `useMediaSpans`, `SpanActions`, `PlayerNotice`, `SpanStrip` | 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, `heading` (title, subtitle, avatar, each a link) 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. |
|
|
177
177
|
| 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` |
|
|
178
178
|
| 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 |
|
|
179
179
|
| 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
|
@@ -12,6 +12,7 @@ time. While the version is 0.x, any release may break.
|
|
|
12
12
|
Every PR that changes what an app sees adds a line here (see `CLAUDE.md`, "Changelog").
|
|
13
13
|
|
|
14
14
|
## 2026-11-24
|
|
15
|
+
- `RateChoice` (the speed in `MediaPlayer`, `VideoClock`, `CompareVideo`, `CompareVideoGrid`) is React Aria's `Select`, not a native select (#324): a test that did `user.selectOptions(getByRole("combobox", { name: "Playback speed" }), "1.5×")` now clicks `getByRole("button", { name: /Playback speed/ })` and then `findByRole("option", { name: "1.5×" })`. Visual baselines with a player move: the control is narrower, so a phone-width player's controls can fit on one row.
|
|
15
16
|
- `createApi`'s `post`/`put`/`patch` send a `Blob`, bytes, `FormData`, `URLSearchParams` or a stream as it is (a Blob with its own type as Content-Type); before, any body was `JSON.stringify`ed, so such a body arrived as `{}`. `createTypedApi` takes `body` (not `json`) on an operation whose request body has only a non-JSON media type, so a workaround that went round the typed client through `fetchJson` can be deleted.
|
|
16
17
|
- `SayAgain` inside a `ClipsProvider` takes the recordings of `text` and the provider's `lang` itself; one given `parts` or `lang` is unchanged, and outside a provider nothing changes.
|
|
17
18
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IconComponent } from '../lib/icon';
|
|
2
2
|
import { ButtonProps } from './button';
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
type Target = {
|
|
4
|
+
export type Target = {
|
|
5
5
|
/** An app route (React Router): `"/learners/7"`, `"?tab=log"`. Client-side navigation, the basename applied. */
|
|
6
6
|
to: string;
|
|
7
7
|
href?: undefined;
|
|
@@ -32,6 +32,15 @@ export type ButtonLinkProps = BaseProps & Target & {
|
|
|
32
32
|
export type TextLinkProps = BaseProps & Target & {
|
|
33
33
|
icon?: IconComponent;
|
|
34
34
|
};
|
|
35
|
+
export declare function useTarget(target: Target, newTab: boolean | undefined): {
|
|
36
|
+
provide: (node: React.ReactNode) => React.JSX.Element;
|
|
37
|
+
props: {
|
|
38
|
+
href: string;
|
|
39
|
+
download: string | boolean | undefined;
|
|
40
|
+
target: string | undefined;
|
|
41
|
+
rel: string | undefined;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
35
44
|
/**
|
|
36
45
|
* A link drawn as a `Button` (React Router `to`, or `href` for a download or another site): the same variants and heights, `variant="default"` is the filled one and counts for the one-filled-button rule (`data-variant` is set).
|
|
37
46
|
*/
|
|
@@ -136,6 +136,22 @@ export type MediaSession = {
|
|
|
136
136
|
album?: string;
|
|
137
137
|
artwork?: string;
|
|
138
138
|
};
|
|
139
|
+
/**
|
|
140
|
+
* What is playing, drawn across the top of a video while it is paused or the pointer is on it: a
|
|
141
|
+
* title, who made it, and their picture. Plain data; the player draws it.
|
|
142
|
+
*/
|
|
143
|
+
export type MediaHeading = {
|
|
144
|
+
/** What is playing ("Glazing a celadon bowl"). */
|
|
145
|
+
title: string;
|
|
146
|
+
/** An app route the title leads to. */
|
|
147
|
+
to?: string;
|
|
148
|
+
/** Under the title: who made it, or where it is from ("Kiln room"). */
|
|
149
|
+
subtitle?: string;
|
|
150
|
+
/** An app route the subtitle leads to, and the picture with it when there is a subtitle to name that link. */
|
|
151
|
+
subtitleTo?: string;
|
|
152
|
+
/** A small round picture before the words (the maker's avatar). `null` draws the subtitle's first letter instead. */
|
|
153
|
+
avatar?: string | null;
|
|
154
|
+
};
|
|
139
155
|
export type MediaPlayerProps = {
|
|
140
156
|
/** Names the player and its element. */
|
|
141
157
|
label: string;
|
|
@@ -200,6 +216,8 @@ export type MediaPlayerProps = {
|
|
|
200
216
|
progressEvery?: number;
|
|
201
217
|
/** The player's state and requests (`seek`, `setVolume`, `time`, `duration`…), for an app that acts on playback from beside it: a chapter list, comments at a time (strata-react issue #211). An object ref holds the latest state without rendering again; a function ref is called with it on every render. */
|
|
202
218
|
mediaRef?: React.Ref<MediaElementState>;
|
|
219
|
+
/** What is playing, across the top of a video: shown while it is paused, and for a few seconds after the pointer moves on it, a key is pressed or playing starts; hidden with the controls (strata-react issue #329). Video only. */
|
|
220
|
+
heading?: MediaHeading;
|
|
203
221
|
/** Drawn over the picture only (never the controls) in a box that fills it; the app's classes choose the corner (`absolute bottom-3 right-3`). Anything interactive in it is clickable and focusable. A video's box keeps its shape before the metadata loads, so the overlay has a stable place. */
|
|
204
222
|
overlay?: (media: MediaElementState) => React.ReactNode;
|
|
205
223
|
/** Content below the controls for playback-related messages and actions. Hides with the controls during idle fullscreen playback. */
|
|
@@ -219,4 +237,4 @@ export declare const SPEECH_RATES: readonly number[];
|
|
|
219
237
|
* a touch device), with the failure to load shown and retried. For an editor or a replay, use the
|
|
220
238
|
* parts and `useMediaElement` directly.
|
|
221
239
|
*/
|
|
222
|
-
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, onSpan, spanWords, start, resumeWords, onProgress, progressEvery, mediaRef, overlay, status, warning, aspect, fullscreen, className, }: MediaPlayerProps): React.JSX.Element;
|
|
240
|
+
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, onSpan, spanWords, start, resumeWords, onProgress, progressEvery, mediaRef, heading, overlay, status, warning, aspect, fullscreen, className, }: MediaPlayerProps): React.JSX.Element;
|
|
@@ -99,7 +99,7 @@ export type VolumeControlProps = {
|
|
|
99
99
|
};
|
|
100
100
|
/** A mute button and a volume slider with its value in percent. Muting sets the volume to 0 and remembers the level; unmuting puts it back. Moving the slider from 0 unmutes. */
|
|
101
101
|
export declare function VolumeControl({ volume, onVolumeChange, max, disabled, className }: VolumeControlProps): React.JSX.Element;
|
|
102
|
-
/** A choice of playback speed ("0.5×", "1×", "1.5×")
|
|
102
|
+
/** A choice of playback speed ("0.5×", "1×", "1.5×"), named "Playback speed": React Aria's Select. */
|
|
103
103
|
export declare function RateChoice({ rate, onRateChange, rates, className }: {
|
|
104
104
|
rate: number;
|
|
105
105
|
onRateChange: (rate: number) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export { JobsTable, type JobsTableProps, type JobRow } from './components/jobs-t
|
|
|
41
41
|
export { Thumbnail, ThumbnailSkeleton, type ThumbnailProps, type AspectRatio } from './components/thumbnail';
|
|
42
42
|
export { FilmStrip, pickEvenly, frameAt, type FilmStripProps, type FilmFrame } from './components/film-strip';
|
|
43
43
|
export { DataTable, TableSkeleton, parseSort, serialiseSort, type CellValue, type Column, type Sort, type DataTableProps, type RowSelection, type RowExpansion, } from './components/data-table';
|
|
44
|
-
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 MediaProgress, type ResumeWords } from './components/media-player';
|
|
44
|
+
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';
|
|
45
45
|
export { useMediaSpans, SpanActions, PlayerNotice, type SpanActionsNotice, type MediaSpanData, type SpanKind, type SpanBehaviour, type SpanOutcome, type SpanWords, type MediaSpansState } from './components/media-spans';
|
|
46
46
|
export { TranscriptView, type TranscriptViewProps, type TranscriptSeek } from './components/transcript-view';
|
|
47
47
|
export { phraseAt, wordAt, wordId, phraseOfWordId, isDoubtful, phraseDoubtful, type TranscriptGroup, type TranscriptPhrase, type TranscriptPhraseState, type TranscriptWord } from './lib/transcript';
|
package/dist/index.js
CHANGED
|
@@ -6,12 +6,12 @@ import { a as useMicrophone, c as fetchJson, d as useLoad, f as StrataToastRegio
|
|
|
6
6
|
import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-DDGBPiTJ.js";
|
|
7
7
|
import { a as useColorScheme, i as colorSchemeScript, n as ColorSchemeChoice, o as useSystemColorScheme, r as ThemeProvider, s as Density, t as COLOR_SCHEME_STORAGE_KEY } from "./theme-By3DSUTs.js";
|
|
8
8
|
import * as React from "react";
|
|
9
|
-
import { Autocomplete, Button as Button$1, Cell, Checkbox as Checkbox$1, Collection, Column, Dialog as Dialog$1, DialogTrigger, Disclosure as Disclosure$1, DisclosurePanel, DropIndicator, DropZone, FileTrigger, GridLayout, GridList, GridListItem, Header, Heading, Input as Input$1, Keyboard, Link, ListBox, ListBoxItem, ListLayout, ListStateContext, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal, ModalOverlay, Popover as Popover$1, RouterProvider, Row, SearchField, Separator, Slider as Slider$1, SliderThumb, SliderTrack, SubmenuTrigger, Switch as Switch$1, Tab, TabList, TabPanel, Table, TableBody, TableHeader, TableLayout, Tabs as Tabs$1, Text, ToggleButton, ToggleButtonGroup, Tree as Tree$1, TreeItem, TreeItemContent, Virtualizer, useDragAndDrop, useFilter } from "react-aria-components";
|
|
9
|
+
import { Autocomplete, Button as Button$1, Cell, Checkbox as Checkbox$1, Collection, Column, Dialog as Dialog$1, DialogTrigger, Disclosure as Disclosure$1, DisclosurePanel, DropIndicator, DropZone, FileTrigger, GridLayout, GridList, GridListItem, Header, Heading, Input as Input$1, Keyboard, Link, ListBox, ListBoxItem, ListLayout, ListStateContext, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal, ModalOverlay, Popover as Popover$1, RouterProvider, Row, SearchField, Select, SelectValue, Separator, Slider as Slider$1, SliderThumb, SliderTrack, SubmenuTrigger, Switch as Switch$1, Tab, TabList, TabPanel, Table, TableBody, TableHeader, TableLayout, Tabs as Tabs$1, Text, ToggleButton, ToggleButtonGroup, Tree as Tree$1, TreeItem, TreeItemContent, Virtualizer, useDragAndDrop, useFilter } from "react-aria-components";
|
|
10
10
|
import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Check, ChevronDown, ChevronLeft, ChevronRight, CircleAlert, CircleCheck, CircleDashed, Clock, CloudOff, Columns2, Ellipsis, Eye, EyeOff, FileQuestion, Flag, Folder, FolderOpen, GripVertical, History, ImageOff, Info, KeyRound, LayoutGrid, List, Loader, LoaderCircle, Lock, Maximize, Maximize2, Minimize, Minus, PanelBottomClose, PanelBottomOpen, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen, PanelTopClose, PanelTopOpen, Pause, Pencil, Play, Redo2, RotateCcw, RotateCw, Scan, Search, Send, SkipBack, SkipForward, SlidersHorizontal, Square, StepBack, StepForward, Trash2, TriangleAlert, Undo2, Upload, Volume2, VolumeX, X, ZoomIn, ZoomOut } from "lucide-react";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
12
|
import { Link as Link$1, NavLink, useHref, useNavigate, useSearchParams } from "react-router";
|
|
13
13
|
import { createSortedRowModel, flexRender, rowSortingFeature, tableFeatures, useTable } from "@tanstack/react-table";
|
|
14
|
-
import { VisuallyHidden, mergeProps, useDrag, useDrop, useFocusRing, useMove, useSlider, useSliderThumb } from "react-aria";
|
|
14
|
+
import { UNSAFE_PortalProvider, VisuallyHidden, mergeProps, useDrag, useDrop, useFocusRing, useMove, useSlider, useSliderThumb, useUNSAFE_PortalContext } from "react-aria";
|
|
15
15
|
import { LayoutInfo, Rect, Size, useSliderState } from "react-stately";
|
|
16
16
|
import { hashKey, useInfiniteQuery, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
17
17
|
import pixelmatch from "pixelmatch";
|
|
@@ -2935,10 +2935,15 @@ function FullscreenFrame({ label, active, onActiveChange, modal: allowModal = tr
|
|
|
2935
2935
|
};
|
|
2936
2936
|
}, [active, allowModal]);
|
|
2937
2937
|
const modal = allowModal && active && !native && (!canFullscreen() || refused);
|
|
2938
|
+
const outer = useUNSAFE_PortalContext();
|
|
2939
|
+
const getContainer = React.useCallback(() => native && ref.current ? ref.current : outer.getContainer?.() ?? document.body, [native, outer]);
|
|
2938
2940
|
const inner = /* @__PURE__ */ jsx("div", {
|
|
2939
2941
|
ref,
|
|
2940
2942
|
className: cn(active && "flex h-full min-h-0 flex-col bg-background p-4", className),
|
|
2941
|
-
children
|
|
2943
|
+
children: /* @__PURE__ */ jsx(UNSAFE_PortalProvider, {
|
|
2944
|
+
getContainer,
|
|
2945
|
+
children
|
|
2946
|
+
})
|
|
2942
2947
|
});
|
|
2943
2948
|
if (!modal) return inner;
|
|
2944
2949
|
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
@@ -3275,7 +3280,7 @@ function VolumeControl({ volume, onVolumeChange, max = 100, disabled, className
|
|
|
3275
3280
|
})]
|
|
3276
3281
|
});
|
|
3277
3282
|
}
|
|
3278
|
-
/** A choice of playback speed ("0.5×", "1×", "1.5×")
|
|
3283
|
+
/** A choice of playback speed ("0.5×", "1×", "1.5×"), named "Playback speed": React Aria's Select. */
|
|
3279
3284
|
function RateChoice({ rate, onRateChange, rates = [
|
|
3280
3285
|
.5,
|
|
3281
3286
|
1,
|
|
@@ -3283,15 +3288,34 @@ function RateChoice({ rate, onRateChange, rates = [
|
|
|
3283
3288
|
1.5,
|
|
3284
3289
|
2
|
|
3285
3290
|
], className }) {
|
|
3286
|
-
return /* @__PURE__ */
|
|
3291
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
3287
3292
|
"aria-label": "Playback speed",
|
|
3288
|
-
|
|
3289
|
-
|
|
3293
|
+
selectedKey: String(rate),
|
|
3294
|
+
onSelectionChange: (key) => key !== null && onRateChange(Number(key)),
|
|
3290
3295
|
className: cn("w-auto", className),
|
|
3291
|
-
children:
|
|
3292
|
-
|
|
3293
|
-
children:
|
|
3294
|
-
|
|
3296
|
+
children: [/* @__PURE__ */ jsxs(Button$1, {
|
|
3297
|
+
className: cn("flex w-full items-center justify-between gap-2 rounded-control border border-input bg-background pr-2 pl-3 type-body text-foreground transition-state", controlHeight.default),
|
|
3298
|
+
children: [/* @__PURE__ */ jsx(SelectValue, { className: "tabular-nums" }), /* @__PURE__ */ jsx(ChevronDown, {
|
|
3299
|
+
"aria-hidden": true,
|
|
3300
|
+
className: "size-4 text-muted-foreground"
|
|
3301
|
+
})]
|
|
3302
|
+
}), /* @__PURE__ */ jsx(Popover$1, {
|
|
3303
|
+
placement: "bottom start",
|
|
3304
|
+
offset: 4,
|
|
3305
|
+
className: cn("layer-overlay min-w-(--trigger-width) p-1", overlaySurface),
|
|
3306
|
+
children: /* @__PURE__ */ jsx(ListBox, {
|
|
3307
|
+
className: "outline-none",
|
|
3308
|
+
children: rates.map((r) => /* @__PURE__ */ jsx(ListBoxItem, {
|
|
3309
|
+
id: String(r),
|
|
3310
|
+
textValue: `${r}×`,
|
|
3311
|
+
className: "flex min-h-(--control-h-sm) cursor-pointer items-center justify-between gap-3 rounded-control px-2 type-body-sm tabular-nums outline-none focus:bg-muted selected:font-medium",
|
|
3312
|
+
children: ({ isSelected }) => /* @__PURE__ */ jsxs(Fragment, { children: [`${r}×`, isSelected && /* @__PURE__ */ jsx(Check, {
|
|
3313
|
+
"aria-hidden": true,
|
|
3314
|
+
className: "size-4"
|
|
3315
|
+
})] })
|
|
3316
|
+
}, r))
|
|
3317
|
+
})
|
|
3318
|
+
})]
|
|
3295
3319
|
});
|
|
3296
3320
|
}
|
|
3297
3321
|
/**
|
|
@@ -3730,6 +3754,64 @@ function createWatchedRanges() {
|
|
|
3730
3754
|
clear: () => void (ranges = [])
|
|
3731
3755
|
};
|
|
3732
3756
|
}
|
|
3757
|
+
// src/components/link.tsx
|
|
3758
|
+
function useTarget(target, newTab) {
|
|
3759
|
+
const navigate = useNavigate();
|
|
3760
|
+
return {
|
|
3761
|
+
provide: (node) => /* @__PURE__ */ jsx(RouterProvider, {
|
|
3762
|
+
navigate: (to) => void navigate(to),
|
|
3763
|
+
useHref,
|
|
3764
|
+
children: node
|
|
3765
|
+
}),
|
|
3766
|
+
props: {
|
|
3767
|
+
href: target.to ?? target.href,
|
|
3768
|
+
download: target.href === void 0 ? void 0 : target.download,
|
|
3769
|
+
target: newTab ? "_blank" : void 0,
|
|
3770
|
+
rel: newTab || target.href !== void 0 ? "noreferrer" : void 0
|
|
3771
|
+
}
|
|
3772
|
+
};
|
|
3773
|
+
}
|
|
3774
|
+
/**
|
|
3775
|
+
* A link drawn as a `Button` (React Router `to`, or `href` for a download or another site): the same variants and heights, `variant="default"` is the filled one and counts for the one-filled-button rule (`data-variant` is set).
|
|
3776
|
+
*/
|
|
3777
|
+
function ButtonLink(all) {
|
|
3778
|
+
const { to, href, download, newTab, variant, size, icon: Icon, className, children, ...rest } = all;
|
|
3779
|
+
const { provide, props } = useTarget({
|
|
3780
|
+
to,
|
|
3781
|
+
href,
|
|
3782
|
+
download
|
|
3783
|
+
}, newTab);
|
|
3784
|
+
return provide(/* @__PURE__ */ jsxs(Link, {
|
|
3785
|
+
...rest,
|
|
3786
|
+
...props,
|
|
3787
|
+
"data-variant": variant ?? "outline",
|
|
3788
|
+
className: cn(buttonVariants({
|
|
3789
|
+
variant,
|
|
3790
|
+
size
|
|
3791
|
+
}), "no-underline", className),
|
|
3792
|
+
children: [Icon && /* @__PURE__ */ jsx(Icon, { "aria-hidden": true }), typeof children === "string" ? /* @__PURE__ */ jsx("span", {
|
|
3793
|
+
className: "min-w-0 truncate",
|
|
3794
|
+
children
|
|
3795
|
+
}) : children]
|
|
3796
|
+
}));
|
|
3797
|
+
}
|
|
3798
|
+
/**
|
|
3799
|
+
* The house in-app link: accent ink, underlined, for a sentence, a table cell or an empty state's next step. `to` for a route, `href` for a file or another site.
|
|
3800
|
+
*/
|
|
3801
|
+
function TextLink(all) {
|
|
3802
|
+
const { to, href, download, newTab, icon: Icon, className, children, ...rest } = all;
|
|
3803
|
+
const { provide, props } = useTarget({
|
|
3804
|
+
to,
|
|
3805
|
+
href,
|
|
3806
|
+
download
|
|
3807
|
+
}, newTab);
|
|
3808
|
+
return provide(/* @__PURE__ */ jsxs(Link, {
|
|
3809
|
+
...rest,
|
|
3810
|
+
...props,
|
|
3811
|
+
className: cn("inline-flex items-center gap-1 rounded-control text-primary-11 underline underline-offset-4 transition-state hover:text-primary-12 [&_svg]:size-4 [&_svg]:shrink-0", className),
|
|
3812
|
+
children: [Icon && /* @__PURE__ */ jsx(Icon, { "aria-hidden": true }), children]
|
|
3813
|
+
}));
|
|
3814
|
+
}
|
|
3733
3815
|
// src/components/media-player.tsx
|
|
3734
3816
|
/** How far one notch of the wheel over a focused video moves the volume, in percent. */
|
|
3735
3817
|
var WHEEL_VOLUME_STEP = 5;
|
|
@@ -4238,7 +4320,7 @@ function useCoarsePointer() {
|
|
|
4238
4320
|
* a touch device), with the failure to load shown and retried. For an editor or a replay, use the
|
|
4239
4321
|
* parts and `useMediaElement` directly.
|
|
4240
4322
|
*/
|
|
4241
|
-
function MediaPlayer({ label, kind = "audio", src, sources, index: controlledIndex, onIndexChange, autoAdvance = true, controls = "auto", autoPlay, poster, session, rates, shortcuts = true, attach, growing, window: bound, loop, showFull, group, onTimeUpdate, onWindowEnd, onEnded, onTimeChange, spans, spanKinds, onSpan, spanWords, start, resumeWords, onProgress, progressEvery, mediaRef, overlay, status, warning, aspect, fullscreen = true, className }) {
|
|
4323
|
+
function MediaPlayer({ label, kind = "audio", src, sources, index: controlledIndex, onIndexChange, autoAdvance = true, controls = "auto", autoPlay, poster, session, rates, shortcuts = true, attach, growing, window: bound, loop, showFull, group, onTimeUpdate, onWindowEnd, onEnded, onTimeChange, spans, spanKinds, onSpan, spanWords, start, resumeWords, onProgress, progressEvery, mediaRef, heading, overlay, status, warning, aspect, fullscreen = true, className }) {
|
|
4242
4324
|
const list = React.useMemo(() => sources ?? (src ? [{
|
|
4243
4325
|
src,
|
|
4244
4326
|
title: label
|
|
@@ -4448,19 +4530,24 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
4448
4530
|
const [fullApi, setFullApi] = React.useState(false);
|
|
4449
4531
|
React.useEffect(() => setFullApi(canFullscreen()), []);
|
|
4450
4532
|
const canFull = fullscreen && fullApi && kind === "video" && !native;
|
|
4451
|
-
const
|
|
4533
|
+
const autoHide = media.playing && kind === "video";
|
|
4452
4534
|
const [controlsIdle, setControlsIdle] = React.useState(false);
|
|
4453
4535
|
const idleTimer = React.useRef(void 0);
|
|
4454
4536
|
const wakeControls = React.useCallback(() => {
|
|
4455
4537
|
clearTimeout(idleTimer.current);
|
|
4456
4538
|
setControlsIdle(false);
|
|
4457
|
-
if (
|
|
4458
|
-
}, [
|
|
4539
|
+
if (autoHide) idleTimer.current = setTimeout(() => setControlsIdle(true), 3e3);
|
|
4540
|
+
}, [autoHide]);
|
|
4541
|
+
const sleepControls = React.useCallback(() => {
|
|
4542
|
+
clearTimeout(idleTimer.current);
|
|
4543
|
+
setControlsIdle(true);
|
|
4544
|
+
}, []);
|
|
4459
4545
|
React.useEffect(() => {
|
|
4460
4546
|
wakeControls();
|
|
4461
4547
|
return () => clearTimeout(idleTimer.current);
|
|
4462
4548
|
}, [wakeControls]);
|
|
4463
|
-
const
|
|
4549
|
+
const idle = autoHide && controlsIdle;
|
|
4550
|
+
const hideControls = full && canFull && autoHide && controlsIdle;
|
|
4464
4551
|
const stage = React.useRef(null);
|
|
4465
4552
|
const latest = React.useRef(media);
|
|
4466
4553
|
latest.current = media;
|
|
@@ -4537,7 +4624,7 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
4537
4624
|
shortcuts,
|
|
4538
4625
|
native
|
|
4539
4626
|
]);
|
|
4540
|
-
const activeKeys =
|
|
4627
|
+
const activeKeys = autoHide ? keys.map((shortcut) => ({
|
|
4541
4628
|
...shortcut,
|
|
4542
4629
|
run: () => {
|
|
4543
4630
|
wakeControls();
|
|
@@ -4608,21 +4695,28 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
4608
4695
|
tabIndex: -1,
|
|
4609
4696
|
className: cn("relative w-full overflow-hidden rounded-surface bg-surface-sunken outline-none", full && "min-h-0 flex-1"),
|
|
4610
4697
|
style: full ? void 0 : { aspectRatio: aspect ?? natural ?? 16 / 9 },
|
|
4611
|
-
children: [
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4625
|
-
|
|
4698
|
+
children: [
|
|
4699
|
+
/* @__PURE__ */ jsx("video", {
|
|
4700
|
+
...common,
|
|
4701
|
+
poster,
|
|
4702
|
+
playsInline: true,
|
|
4703
|
+
onClick: native ? void 0 : () => media.toggle(),
|
|
4704
|
+
onDoubleClick: canFull ? () => setFull((f) => !f) : void 0,
|
|
4705
|
+
className: "absolute inset-0 size-full object-contain"
|
|
4706
|
+
}),
|
|
4707
|
+
heading && /* @__PURE__ */ jsx(PictureHeading, {
|
|
4708
|
+
heading,
|
|
4709
|
+
shown: !idle
|
|
4710
|
+
}),
|
|
4711
|
+
(overlay || showActions) && /* @__PURE__ */ jsxs("div", {
|
|
4712
|
+
className: "pointer-events-none absolute inset-0 [&>*]:pointer-events-auto",
|
|
4713
|
+
children: [overlay?.(media), showActions && /* @__PURE__ */ jsx(SpanActions, {
|
|
4714
|
+
state: spanState,
|
|
4715
|
+
other: resumeNotice,
|
|
4716
|
+
className: cn("absolute right-3 flex flex-col items-end gap-2", native ? "bottom-14" : "bottom-3")
|
|
4717
|
+
})]
|
|
4718
|
+
})
|
|
4719
|
+
]
|
|
4626
4720
|
}) : /* @__PURE__ */ jsx("audio", {
|
|
4627
4721
|
...common,
|
|
4628
4722
|
className: native ? "w-full" : "hidden"
|
|
@@ -4642,9 +4736,13 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
4642
4736
|
role: "group",
|
|
4643
4737
|
"aria-label": label,
|
|
4644
4738
|
onFocusCapture: () => keyPlayers.use(id),
|
|
4645
|
-
onMouseMoveCapture:
|
|
4646
|
-
onKeyDownCapture:
|
|
4647
|
-
|
|
4739
|
+
onMouseMoveCapture: autoHide ? wakeControls : void 0,
|
|
4740
|
+
onKeyDownCapture: autoHide ? wakeControls : void 0,
|
|
4741
|
+
onMouseLeave: autoHide && !full ? sleepControls : void 0,
|
|
4742
|
+
onPointerDownCapture: () => {
|
|
4743
|
+
keyPlayers.use(id);
|
|
4744
|
+
if (autoHide) wakeControls();
|
|
4745
|
+
},
|
|
4648
4746
|
className: cn("relative grid w-full gap-2", full && "flex h-full min-h-0 flex-col"),
|
|
4649
4747
|
children: [
|
|
4650
4748
|
element,
|
|
@@ -4796,6 +4894,55 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
4796
4894
|
})
|
|
4797
4895
|
});
|
|
4798
4896
|
}
|
|
4897
|
+
function PictureHeading({ heading, shown }) {
|
|
4898
|
+
const link = cn("min-w-0 truncate rounded-control underline-offset-4 hover:underline", shown && "pointer-events-auto");
|
|
4899
|
+
const avatar = heading.avatar !== void 0 && /* @__PURE__ */ jsx(Thumbnail, {
|
|
4900
|
+
src: heading.avatar,
|
|
4901
|
+
alt: "",
|
|
4902
|
+
eager: true,
|
|
4903
|
+
className: "w-9 shrink-0 rounded-pill",
|
|
4904
|
+
fallback: /* @__PURE__ */ jsx("span", {
|
|
4905
|
+
className: "grid size-full place-items-center bg-surface-sunken type-label text-foreground",
|
|
4906
|
+
children: (heading.subtitle ?? heading.title).slice(0, 1).toUpperCase()
|
|
4907
|
+
})
|
|
4908
|
+
});
|
|
4909
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
4910
|
+
"data-shown": shown || void 0,
|
|
4911
|
+
className: cn("picture-shade pointer-events-none absolute inset-x-0 top-0 flex items-center gap-3 px-4 pt-3 pb-10 transition-state", shown ? "opacity-100" : "opacity-0 has-[:focus-visible]:opacity-100 has-[:focus-visible]:[&_a]:pointer-events-auto"),
|
|
4912
|
+
children: [avatar && (heading.subtitleTo && heading.subtitle ? /* @__PURE__ */ jsx(HeadingLink, {
|
|
4913
|
+
to: heading.subtitleTo,
|
|
4914
|
+
className: cn("shrink-0 rounded-pill", shown && "pointer-events-auto"),
|
|
4915
|
+
label: heading.subtitle,
|
|
4916
|
+
children: avatar
|
|
4917
|
+
}) : avatar), /* @__PURE__ */ jsxs("div", {
|
|
4918
|
+
className: "grid min-w-0",
|
|
4919
|
+
children: [heading.to ? /* @__PURE__ */ jsx(HeadingLink, {
|
|
4920
|
+
to: heading.to,
|
|
4921
|
+
className: cn("type-heading", link),
|
|
4922
|
+
children: heading.title
|
|
4923
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
4924
|
+
className: "type-heading truncate",
|
|
4925
|
+
children: heading.title
|
|
4926
|
+
}), heading.subtitle && (heading.subtitleTo ? /* @__PURE__ */ jsx(HeadingLink, {
|
|
4927
|
+
to: heading.subtitleTo,
|
|
4928
|
+
className: cn("type-body-sm", link),
|
|
4929
|
+
children: heading.subtitle
|
|
4930
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
4931
|
+
className: "type-body-sm truncate",
|
|
4932
|
+
children: heading.subtitle
|
|
4933
|
+
}))]
|
|
4934
|
+
})]
|
|
4935
|
+
});
|
|
4936
|
+
}
|
|
4937
|
+
function HeadingLink({ to, className, label, children }) {
|
|
4938
|
+
const { provide, props } = useTarget({ to }, false);
|
|
4939
|
+
return provide(/* @__PURE__ */ jsx(Link, {
|
|
4940
|
+
...props,
|
|
4941
|
+
"aria-label": label,
|
|
4942
|
+
className,
|
|
4943
|
+
children
|
|
4944
|
+
}));
|
|
4945
|
+
}
|
|
4799
4946
|
// src/lib/transcript.ts
|
|
4800
4947
|
/** The id of a word for marking (`TranscriptView`'s `marking`, `Mark`): its phrase and its place in it. */
|
|
4801
4948
|
var wordId = (phraseId, index) => `${phraseId}:${index}`;
|
|
@@ -12447,64 +12594,6 @@ function TakeLevel({ peak, lead, className }) {
|
|
|
12447
12594
|
})]
|
|
12448
12595
|
});
|
|
12449
12596
|
}
|
|
12450
|
-
// src/components/link.tsx
|
|
12451
|
-
function useTarget(target, newTab) {
|
|
12452
|
-
const navigate = useNavigate();
|
|
12453
|
-
return {
|
|
12454
|
-
provide: (node) => /* @__PURE__ */ jsx(RouterProvider, {
|
|
12455
|
-
navigate: (to) => void navigate(to),
|
|
12456
|
-
useHref,
|
|
12457
|
-
children: node
|
|
12458
|
-
}),
|
|
12459
|
-
props: {
|
|
12460
|
-
href: target.to ?? target.href,
|
|
12461
|
-
download: target.href === void 0 ? void 0 : target.download,
|
|
12462
|
-
target: newTab ? "_blank" : void 0,
|
|
12463
|
-
rel: newTab || target.href !== void 0 ? "noreferrer" : void 0
|
|
12464
|
-
}
|
|
12465
|
-
};
|
|
12466
|
-
}
|
|
12467
|
-
/**
|
|
12468
|
-
* A link drawn as a `Button` (React Router `to`, or `href` for a download or another site): the same variants and heights, `variant="default"` is the filled one and counts for the one-filled-button rule (`data-variant` is set).
|
|
12469
|
-
*/
|
|
12470
|
-
function ButtonLink(all) {
|
|
12471
|
-
const { to, href, download, newTab, variant, size, icon: Icon, className, children, ...rest } = all;
|
|
12472
|
-
const { provide, props } = useTarget({
|
|
12473
|
-
to,
|
|
12474
|
-
href,
|
|
12475
|
-
download
|
|
12476
|
-
}, newTab);
|
|
12477
|
-
return provide(/* @__PURE__ */ jsxs(Link, {
|
|
12478
|
-
...rest,
|
|
12479
|
-
...props,
|
|
12480
|
-
"data-variant": variant ?? "outline",
|
|
12481
|
-
className: cn(buttonVariants({
|
|
12482
|
-
variant,
|
|
12483
|
-
size
|
|
12484
|
-
}), "no-underline", className),
|
|
12485
|
-
children: [Icon && /* @__PURE__ */ jsx(Icon, { "aria-hidden": true }), typeof children === "string" ? /* @__PURE__ */ jsx("span", {
|
|
12486
|
-
className: "min-w-0 truncate",
|
|
12487
|
-
children
|
|
12488
|
-
}) : children]
|
|
12489
|
-
}));
|
|
12490
|
-
}
|
|
12491
|
-
/**
|
|
12492
|
-
* The house in-app link: accent ink, underlined, for a sentence, a table cell or an empty state's next step. `to` for a route, `href` for a file or another site.
|
|
12493
|
-
*/
|
|
12494
|
-
function TextLink(all) {
|
|
12495
|
-
const { to, href, download, newTab, icon: Icon, className, children, ...rest } = all;
|
|
12496
|
-
const { provide, props } = useTarget({
|
|
12497
|
-
to,
|
|
12498
|
-
href,
|
|
12499
|
-
download
|
|
12500
|
-
}, newTab);
|
|
12501
|
-
return provide(/* @__PURE__ */ jsxs(Link, {
|
|
12502
|
-
...rest,
|
|
12503
|
-
...props,
|
|
12504
|
-
className: cn("inline-flex items-center gap-1 rounded-control text-primary-11 underline underline-offset-4 transition-state hover:text-primary-12 [&_svg]:size-4 [&_svg]:shrink-0", className),
|
|
12505
|
-
children: [Icon && /* @__PURE__ */ jsx(Icon, { "aria-hidden": true }), children]
|
|
12506
|
-
}));
|
|
12507
|
-
}
|
|
12508
12597
|
// src/lib/image-diff.ts
|
|
12509
12598
|
/** The longest side, in pixels, a picture is compared at. */
|
|
12510
12599
|
var MAX_SIDE = 2048;
|