strata-react 1.1.1 → 1.1.2
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 +6 -0
- package/dist/components/fullscreen-frame.d.ts +3 -1
- package/dist/components/media-player.d.ts +3 -1
- package/dist/index.js +238 -183
- package/dist/index.js.map +1 -1
- package/dist/panorama.js +1 -1
- package/dist/{value-controls-DT3sb2MU.js → value-controls-miuzPdJZ.js} +11 -2
- package/dist/value-controls-miuzPdJZ.js.map +1 -0
- package/package.json +1 -1
- package/dist/value-controls-DT3sb2MU.js.map +0 -1
package/README.md
CHANGED
|
@@ -168,7 +168,7 @@ thousands of lines. Such an app imports the same stylesheet **without the reset*
|
|
|
168
168
|
| 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 |
|
|
169
169
|
| 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 |
|
|
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
|
-
| 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. |
|
|
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. 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. 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
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 |
|
package/UPGRADING.md
CHANGED
|
@@ -11,6 +11,12 @@ 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-15
|
|
15
|
+
|
|
16
|
+
- `MediaPlayer` (video, Strata's controls) now has a Full screen button after the volume and an `f` key (where the browser has the Fullscreen API); pass `fullscreen={false}` to remove them. The player is wrapped in `FullscreenFrame`, so a test that counts buttons or a baseline of a video player changes.
|
|
17
|
+
- `MediaPlayer` video: click plays or pauses, double click toggles full screen, and the wheel sets the volume while the player has focus. A test that clicks the video now changes playback.
|
|
18
|
+
- `useAsyncAction` no longer sets state or starts its settle timer after unmount; nothing to change.
|
|
19
|
+
|
|
14
20
|
## After v1.0.47 (2026-11-14)
|
|
15
21
|
|
|
16
22
|
- New, optional: the `strata-api-types` command (`strata-react/api-types`) generates API types from a server's OpenAPI schema. It needs `openapi-typescript` installed in the app (an optional peer) and, on a TypeScript other than 5, an `overrides` entry for its `typescript@^5` peer; see the README. Apps that do not run it change nothing.
|
|
@@ -7,10 +7,12 @@ export type FullscreenFrameProps = {
|
|
|
7
7
|
active: boolean;
|
|
8
8
|
/** Called with `false` when the person leaves with Escape or the browser's own control. */
|
|
9
9
|
onActiveChange: (active: boolean) => void;
|
|
10
|
+
/** Open a window-filling modal where the browser has no Fullscreen API or refuses. Default true. `false` for content that must not be mounted again (a playing video): where the browser cannot or will not, `onActiveChange(false)` is called instead. */
|
|
11
|
+
modal?: boolean;
|
|
10
12
|
children: React.ReactNode;
|
|
11
13
|
className?: string;
|
|
12
14
|
};
|
|
13
15
|
/** Whether this browser can show an element full screen. False in jsdom and on iPhone, where the modal fallback is used. */
|
|
14
16
|
export declare function canFullscreen(): boolean;
|
|
15
17
|
/** Shows its children full screen while `active`: the browser's Fullscreen API where there is one, a window-filling modal where there is not. */
|
|
16
|
-
export declare function FullscreenFrame({ label, active, onActiveChange, children, className }: FullscreenFrameProps): React.JSX.Element;
|
|
18
|
+
export declare function FullscreenFrame({ label, active, onActiveChange, modal: allowModal, children, className }: FullscreenFrameProps): React.JSX.Element;
|
|
@@ -173,6 +173,8 @@ export type MediaPlayerProps = {
|
|
|
173
173
|
overlay?: (media: MediaElementState) => React.ReactNode;
|
|
174
174
|
/** The picture's shape before its metadata loads (and after, when given): a width over a height, or "16/9". Default "16/9" until the video says its own. */
|
|
175
175
|
aspect?: number | `${number}/${number}`;
|
|
176
|
+
/** A video has a Full screen button (and the `f` key) beside the speed and volume. Default true; `false` for a picture that must stay in its place. Only where the browser has the Fullscreen API (the window-filling fallback would mount the video again and lose its place). Not drawn with the browser's own controls (`controls="native"`, or `"auto"` on a touch device), which have their own. */
|
|
177
|
+
fullscreen?: boolean;
|
|
176
178
|
className?: string;
|
|
177
179
|
};
|
|
178
180
|
/** Playback speeds an audiobook or lecture listener expects. */
|
|
@@ -182,4 +184,4 @@ export declare const SPEECH_RATES: readonly number[];
|
|
|
182
184
|
* a touch device), with the failure to load shown and retried. For an editor or a replay, use the
|
|
183
185
|
* parts and `useMediaElement` directly.
|
|
184
186
|
*/
|
|
185
|
-
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, mediaRef, overlay, aspect, className, }: MediaPlayerProps): React.JSX.Element;
|
|
187
|
+
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, mediaRef, overlay, aspect, fullscreen, className, }: MediaPlayerProps): React.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as Textarea, c as Tooltip, d as typeSteps, i as NativeSelect, l as KeyText, n as Field, o as useFieldControl, r as Input, s as controlHeight, t as ChoiceGroup, u as cn } from "./field-DeKNvGox.js";
|
|
2
2
|
import { a as toDate, i as format, n as NBSP, r as createFormat, t as MISSING } from "./format-B32-PVi2.js";
|
|
3
|
-
import { a as useAsyncAction, c as KeysLegend, d as useInView, i as AsyncButton, l as isTypingTarget, n as NumberField, o as Toolbar, r as Slider, s as ToolbarSeparator, t as ColorField, u as useHotkeys } from "./value-controls-
|
|
3
|
+
import { a as useAsyncAction, c as KeysLegend, d as useInView, i as AsyncButton, l as isTypingTarget, n as NumberField, o as Toolbar, r as Slider, s as ToolbarSeparator, t as ColorField, u as useHotkeys } from "./value-controls-miuzPdJZ.js";
|
|
4
4
|
import { a as fieldErrorsOf, c as IconButton, d as isDev, i as errorPayload, l as RowAction, n as describeActionError, o as readErrorBody, r as describeHttpError, s as Button, t as HttpError, u as buttonVariants } from "./errors-Dt--eHgK.js";
|
|
5
5
|
import { a as toLoad, c as toast, i as staleOf, l as toastTimeout, n as createQueryClient, o as useLoad, r as fetchJson, s as StrataToastRegion, t as StrataQueryProvider, u as overlaySurface } from "./query-CgE9YsRk.js";
|
|
6
6
|
import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-DDGBPiTJ.js";
|
|
@@ -2481,6 +2481,68 @@ function TableSkeleton({ rows = 4, columns = 5 }) {
|
|
|
2481
2481
|
}, r))]
|
|
2482
2482
|
});
|
|
2483
2483
|
}
|
|
2484
|
+
// src/components/fullscreen-frame.tsx
|
|
2485
|
+
/** Whether this browser can show an element full screen. False in jsdom and on iPhone, where the modal fallback is used. */
|
|
2486
|
+
function canFullscreen() {
|
|
2487
|
+
return typeof document !== "undefined" && document.fullscreenEnabled === true && typeof Element.prototype.requestFullscreen === "function";
|
|
2488
|
+
}
|
|
2489
|
+
/** Shows its children full screen while `active`: the browser's Fullscreen API where there is one, a window-filling modal where there is not. */
|
|
2490
|
+
function FullscreenFrame({ label, active, onActiveChange, modal: allowModal = true, children, className }) {
|
|
2491
|
+
const ref = React.useRef(null);
|
|
2492
|
+
const [native, setNative] = React.useState(false);
|
|
2493
|
+
const [refused, setRefused] = React.useState(false);
|
|
2494
|
+
const change = React.useRef(onActiveChange);
|
|
2495
|
+
change.current = onActiveChange;
|
|
2496
|
+
React.useEffect(() => {
|
|
2497
|
+
const el = ref.current;
|
|
2498
|
+
if (!active) {
|
|
2499
|
+
setNative(false);
|
|
2500
|
+
setRefused(false);
|
|
2501
|
+
if (document.fullscreenElement && document.fullscreenElement === el) document.exitFullscreen();
|
|
2502
|
+
return;
|
|
2503
|
+
}
|
|
2504
|
+
if (!el) return;
|
|
2505
|
+
if (!canFullscreen()) {
|
|
2506
|
+
if (!allowModal) change.current(false);
|
|
2507
|
+
return;
|
|
2508
|
+
}
|
|
2509
|
+
let cancelled = false;
|
|
2510
|
+
el.requestFullscreen().then(() => !cancelled && setNative(true), () => {
|
|
2511
|
+
if (cancelled) return;
|
|
2512
|
+
if (allowModal) setRefused(true);
|
|
2513
|
+
else change.current(false);
|
|
2514
|
+
});
|
|
2515
|
+
const onChange = () => {
|
|
2516
|
+
if (document.fullscreenElement !== el && !cancelled) change.current(false);
|
|
2517
|
+
};
|
|
2518
|
+
document.addEventListener("fullscreenchange", onChange);
|
|
2519
|
+
return () => {
|
|
2520
|
+
cancelled = true;
|
|
2521
|
+
document.removeEventListener("fullscreenchange", onChange);
|
|
2522
|
+
};
|
|
2523
|
+
}, [active, allowModal]);
|
|
2524
|
+
const modal = allowModal && active && !native && (!canFullscreen() || refused);
|
|
2525
|
+
const inner = /* @__PURE__ */ jsx("div", {
|
|
2526
|
+
ref,
|
|
2527
|
+
className: cn(active && "flex h-full min-h-0 flex-col bg-background p-4", className),
|
|
2528
|
+
children
|
|
2529
|
+
});
|
|
2530
|
+
if (!modal) return inner;
|
|
2531
|
+
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
2532
|
+
isOpen: true,
|
|
2533
|
+
onOpenChange: (o) => !o && onActiveChange(false),
|
|
2534
|
+
isDismissable: true,
|
|
2535
|
+
className: "layer-overlay fixed inset-0 scrim",
|
|
2536
|
+
children: /* @__PURE__ */ jsx(Modal, {
|
|
2537
|
+
className: cn("h-full w-full outline-none", overlaySurface, "rounded-none"),
|
|
2538
|
+
children: /* @__PURE__ */ jsx(Dialog$1, {
|
|
2539
|
+
"aria-label": label,
|
|
2540
|
+
className: "h-full outline-none",
|
|
2541
|
+
children: inner
|
|
2542
|
+
})
|
|
2543
|
+
})
|
|
2544
|
+
});
|
|
2545
|
+
}
|
|
2484
2546
|
// src/components/media.tsx
|
|
2485
2547
|
var clamp$3 = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
2486
2548
|
var timecode = (t, { precision, fps }) => format.timecode(t, {
|
|
@@ -3193,6 +3255,8 @@ function SpanActions({ state, className }) {
|
|
|
3193
3255
|
});
|
|
3194
3256
|
}
|
|
3195
3257
|
// src/components/media-player.tsx
|
|
3258
|
+
/** How far one notch of the wheel over a focused video moves the volume, in percent. */
|
|
3259
|
+
var WHEEL_VOLUME_STEP = 5;
|
|
3196
3260
|
var idle = {
|
|
3197
3261
|
ready: 0,
|
|
3198
3262
|
waitingForMore: false,
|
|
@@ -3596,7 +3660,7 @@ function useCoarsePointer() {
|
|
|
3596
3660
|
* a touch device), with the failure to load shown and retried. For an editor or a replay, use the
|
|
3597
3661
|
* parts and `useMediaElement` directly.
|
|
3598
3662
|
*/
|
|
3599
|
-
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, mediaRef, overlay, aspect, className }) {
|
|
3663
|
+
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, mediaRef, overlay, aspect, fullscreen = true, className }) {
|
|
3600
3664
|
const list = React.useMemo(() => sources ?? (src ? [{
|
|
3601
3665
|
src,
|
|
3602
3666
|
title: label
|
|
@@ -3744,6 +3808,25 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
3744
3808
|
React.useEffect(() => {
|
|
3745
3809
|
if (onTimeChange) onTimeChange(time);
|
|
3746
3810
|
}, [time]);
|
|
3811
|
+
const [full, setFull] = React.useState(false);
|
|
3812
|
+
const [fullApi, setFullApi] = React.useState(false);
|
|
3813
|
+
React.useEffect(() => setFullApi(canFullscreen()), []);
|
|
3814
|
+
const canFull = fullscreen && fullApi && kind === "video" && !native;
|
|
3815
|
+
const stage = React.useRef(null);
|
|
3816
|
+
const latest = React.useRef(media);
|
|
3817
|
+
latest.current = media;
|
|
3818
|
+
React.useEffect(() => {
|
|
3819
|
+
const el = stage.current;
|
|
3820
|
+
if (!el || kind !== "video") return;
|
|
3821
|
+
const onWheel = (e) => {
|
|
3822
|
+
if (!el.contains(document.activeElement) || e.ctrlKey || !e.deltaY) return;
|
|
3823
|
+
e.preventDefault();
|
|
3824
|
+
const m = latest.current;
|
|
3825
|
+
m.setVolume(Math.min(100, Math.max(0, m.volume + (e.deltaY < 0 ? WHEEL_VOLUME_STEP : -5))));
|
|
3826
|
+
};
|
|
3827
|
+
el.addEventListener("wheel", onWheel, { passive: false });
|
|
3828
|
+
return () => el.removeEventListener("wheel", onWheel);
|
|
3829
|
+
}, [kind]);
|
|
3747
3830
|
const keys = React.useMemo(() => [
|
|
3748
3831
|
{
|
|
3749
3832
|
keys: [" ", "k"],
|
|
@@ -3767,6 +3850,11 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
3767
3850
|
label: "Mute",
|
|
3768
3851
|
run: () => media.setVolume(media.muted ? 100 : 0)
|
|
3769
3852
|
},
|
|
3853
|
+
...canFull ? [{
|
|
3854
|
+
keys: ["f"],
|
|
3855
|
+
label: full ? "Leave full screen" : "Full screen",
|
|
3856
|
+
run: () => setFull((f) => !f)
|
|
3857
|
+
}] : [],
|
|
3770
3858
|
...offer ? [{
|
|
3771
3859
|
keys: ["s"],
|
|
3772
3860
|
label: offer.label,
|
|
@@ -3777,7 +3865,9 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
3777
3865
|
time,
|
|
3778
3866
|
offsets,
|
|
3779
3867
|
index,
|
|
3780
|
-
offer
|
|
3868
|
+
offer,
|
|
3869
|
+
canFull,
|
|
3870
|
+
full
|
|
3781
3871
|
]);
|
|
3782
3872
|
const id = React.useId();
|
|
3783
3873
|
React.useEffect(() => {
|
|
@@ -3857,12 +3947,16 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
3857
3947
|
};
|
|
3858
3948
|
const hasSpans = (spans?.length ?? 0) > 0;
|
|
3859
3949
|
const element = kind === "video" ? /* @__PURE__ */ jsxs("div", {
|
|
3860
|
-
|
|
3861
|
-
|
|
3950
|
+
ref: stage,
|
|
3951
|
+
tabIndex: -1,
|
|
3952
|
+
className: cn("relative w-full overflow-hidden rounded-surface bg-surface-sunken outline-none", full && "min-h-0 flex-1"),
|
|
3953
|
+
style: full ? void 0 : { aspectRatio: aspect ?? natural ?? 16 / 9 },
|
|
3862
3954
|
children: [/* @__PURE__ */ jsx("video", {
|
|
3863
3955
|
...common,
|
|
3864
3956
|
poster,
|
|
3865
3957
|
playsInline: true,
|
|
3958
|
+
onClick: native ? void 0 : () => media.toggle(),
|
|
3959
|
+
onDoubleClick: canFull ? () => setFull((f) => !f) : void 0,
|
|
3866
3960
|
className: "absolute inset-0 size-full object-contain"
|
|
3867
3961
|
}), (overlay || hasSpans) && /* @__PURE__ */ jsxs("div", {
|
|
3868
3962
|
className: "pointer-events-none absolute inset-0 [&>*]:pointer-events-auto",
|
|
@@ -3876,138 +3970,153 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
3876
3970
|
className: native ? "w-full" : "hidden"
|
|
3877
3971
|
});
|
|
3878
3972
|
const what = kind === "video" ? "this video" : "this recording";
|
|
3879
|
-
return /* @__PURE__ */
|
|
3880
|
-
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
className
|
|
3885
|
-
children:
|
|
3886
|
-
|
|
3887
|
-
|
|
3888
|
-
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
action: /* @__PURE__ */ jsx(Button, {
|
|
3897
|
-
size: "sm",
|
|
3898
|
-
variant: "outline",
|
|
3899
|
-
onClick: media.retry,
|
|
3900
|
-
children: "Try again"
|
|
3973
|
+
return /* @__PURE__ */ jsx(FullscreenFrame, {
|
|
3974
|
+
label,
|
|
3975
|
+
active: full,
|
|
3976
|
+
onActiveChange: setFull,
|
|
3977
|
+
modal: false,
|
|
3978
|
+
className,
|
|
3979
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
3980
|
+
role: "group",
|
|
3981
|
+
"aria-label": label,
|
|
3982
|
+
onFocusCapture: () => keyPlayers.use(id),
|
|
3983
|
+
onPointerDownCapture: () => keyPlayers.use(id),
|
|
3984
|
+
className: cn("grid w-full gap-2", full && "flex h-full min-h-0 flex-col"),
|
|
3985
|
+
children: [
|
|
3986
|
+
element,
|
|
3987
|
+
kind === "audio" && hasSpans && /* @__PURE__ */ jsx(SpanActions, {
|
|
3988
|
+
state: spanState,
|
|
3989
|
+
className: "flex flex-wrap items-center gap-2"
|
|
3901
3990
|
}),
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
/* @__PURE__ */ jsx(Status, {
|
|
3913
|
-
tone: "info",
|
|
3914
|
-
icon: LoaderCircle,
|
|
3915
|
-
children: "Still being made"
|
|
3916
|
-
}),
|
|
3917
|
-
growing.status && /* @__PURE__ */ jsx("span", {
|
|
3918
|
-
className: "type-body-sm text-muted-foreground",
|
|
3919
|
-
children: growing.status
|
|
3991
|
+
kind === "audio" && overlay?.(media),
|
|
3992
|
+
media.error?.kind === "load" && /* @__PURE__ */ jsx(Alert, {
|
|
3993
|
+
tone: "danger",
|
|
3994
|
+
announce: true,
|
|
3995
|
+
title: `Could not load ${what}`,
|
|
3996
|
+
action: /* @__PURE__ */ jsx(Button, {
|
|
3997
|
+
size: "sm",
|
|
3998
|
+
variant: "outline",
|
|
3999
|
+
onClick: media.retry,
|
|
4000
|
+
children: "Try again"
|
|
3920
4001
|
}),
|
|
3921
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
children: [
|
|
3931
|
-
format.runningTime(bound.start),
|
|
3932
|
-
" to ",
|
|
3933
|
-
format.runningTime(bound.end),
|
|
3934
|
-
loop ? ", looping" : ""
|
|
3935
|
-
]
|
|
3936
|
-
}), /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("span", {
|
|
3937
|
-
role: "status",
|
|
3938
|
-
children: media.playing ? `Playing ${format.runningTime(bound.start)} to ${format.runningTime(bound.end)}` : ""
|
|
3939
|
-
}) })] }),
|
|
3940
|
-
!native && /* @__PURE__ */ jsxs("div", {
|
|
3941
|
-
className: "grid gap-2",
|
|
3942
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
3943
|
-
className: "flex min-w-0 items-center gap-3",
|
|
3944
|
-
children: [/* @__PURE__ */ jsx(SeekBar, {
|
|
3945
|
-
time,
|
|
3946
|
-
duration,
|
|
3947
|
-
onSeek: seek,
|
|
3948
|
-
buffered: growing ? media.ready : offsets ? void 0 : media.buffered,
|
|
3949
|
-
spans: spanState.bars,
|
|
3950
|
-
marks: bound && showFull ? [{
|
|
3951
|
-
time: bound.start,
|
|
3952
|
-
label: "Window starts"
|
|
3953
|
-
}, {
|
|
3954
|
-
time: bound.end,
|
|
3955
|
-
label: "Window ends"
|
|
3956
|
-
}] : offsets ? list.map((s, i) => ({
|
|
3957
|
-
time: offsets[i],
|
|
3958
|
-
label: s.title
|
|
3959
|
-
})).slice(1) : [],
|
|
3960
|
-
step: JUMP,
|
|
3961
|
-
bigStep: 60,
|
|
3962
|
-
label: `Seek in ${label}`
|
|
3963
|
-
}), /* @__PURE__ */ jsx(TimeReadout, {
|
|
3964
|
-
time,
|
|
3965
|
-
duration
|
|
3966
|
-
})]
|
|
3967
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
3968
|
-
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
4002
|
+
children: media.error.message
|
|
4003
|
+
}),
|
|
4004
|
+
media.error?.kind === "blocked" && /* @__PURE__ */ jsx("p", {
|
|
4005
|
+
role: "status",
|
|
4006
|
+
className: "type-body-sm text-muted-foreground",
|
|
4007
|
+
children: media.error.message
|
|
4008
|
+
}),
|
|
4009
|
+
growing && /* @__PURE__ */ jsxs("div", {
|
|
4010
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-1",
|
|
3969
4011
|
children: [
|
|
3970
|
-
/* @__PURE__ */
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
children:
|
|
3974
|
-
icon: SkipBack,
|
|
3975
|
-
label: "Previous chapter",
|
|
3976
|
-
disabled: index === 0,
|
|
3977
|
-
onClick: () => step(-1)
|
|
3978
|
-
}), list.length > 1 && /* @__PURE__ */ jsx(IconButton, {
|
|
3979
|
-
icon: SkipForward,
|
|
3980
|
-
label: "Next chapter",
|
|
3981
|
-
disabled: index === list.length - 1,
|
|
3982
|
-
onClick: () => step(1)
|
|
3983
|
-
})]
|
|
4012
|
+
/* @__PURE__ */ jsx(Status, {
|
|
4013
|
+
tone: "info",
|
|
4014
|
+
icon: LoaderCircle,
|
|
4015
|
+
children: "Still being made"
|
|
3984
4016
|
}),
|
|
3985
|
-
|
|
4017
|
+
growing.status && /* @__PURE__ */ jsx("span", {
|
|
3986
4018
|
className: "type-body-sm text-muted-foreground",
|
|
3987
|
-
children:
|
|
3988
|
-
current?.title,
|
|
3989
|
-
" (",
|
|
3990
|
-
index + 1,
|
|
3991
|
-
" of ",
|
|
3992
|
-
list.length,
|
|
3993
|
-
")"
|
|
3994
|
-
]
|
|
4019
|
+
children: growing.status
|
|
3995
4020
|
}),
|
|
3996
|
-
/* @__PURE__ */
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
onRateChange: media.setRate,
|
|
4001
|
-
rates
|
|
4002
|
-
}), /* @__PURE__ */ jsx(VolumeControl, {
|
|
4003
|
-
volume: media.volume,
|
|
4004
|
-
onVolumeChange: media.setVolume
|
|
4005
|
-
})]
|
|
4021
|
+
/* @__PURE__ */ jsx("span", {
|
|
4022
|
+
role: "status",
|
|
4023
|
+
className: "type-body-sm text-muted-foreground",
|
|
4024
|
+
children: media.waitingForMore ? "Waiting for more to be made. It will carry on by itself." : ""
|
|
4006
4025
|
})
|
|
4007
4026
|
]
|
|
4008
|
-
})
|
|
4009
|
-
|
|
4010
|
-
|
|
4027
|
+
}),
|
|
4028
|
+
bound && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("p", {
|
|
4029
|
+
className: "type-caption text-muted-foreground tabular-nums",
|
|
4030
|
+
children: [
|
|
4031
|
+
format.runningTime(bound.start),
|
|
4032
|
+
" to ",
|
|
4033
|
+
format.runningTime(bound.end),
|
|
4034
|
+
loop ? ", looping" : ""
|
|
4035
|
+
]
|
|
4036
|
+
}), /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("span", {
|
|
4037
|
+
role: "status",
|
|
4038
|
+
children: media.playing ? `Playing ${format.runningTime(bound.start)} to ${format.runningTime(bound.end)}` : ""
|
|
4039
|
+
}) })] }),
|
|
4040
|
+
!native && /* @__PURE__ */ jsxs("div", {
|
|
4041
|
+
className: "grid gap-2",
|
|
4042
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4043
|
+
className: "flex min-w-0 items-center gap-3",
|
|
4044
|
+
children: [/* @__PURE__ */ jsx(SeekBar, {
|
|
4045
|
+
time,
|
|
4046
|
+
duration,
|
|
4047
|
+
onSeek: seek,
|
|
4048
|
+
buffered: growing ? media.ready : offsets ? void 0 : media.buffered,
|
|
4049
|
+
spans: spanState.bars,
|
|
4050
|
+
marks: bound && showFull ? [{
|
|
4051
|
+
time: bound.start,
|
|
4052
|
+
label: "Window starts"
|
|
4053
|
+
}, {
|
|
4054
|
+
time: bound.end,
|
|
4055
|
+
label: "Window ends"
|
|
4056
|
+
}] : offsets ? list.map((s, i) => ({
|
|
4057
|
+
time: offsets[i],
|
|
4058
|
+
label: s.title
|
|
4059
|
+
})).slice(1) : [],
|
|
4060
|
+
step: JUMP,
|
|
4061
|
+
bigStep: 60,
|
|
4062
|
+
label: `Seek in ${label}`
|
|
4063
|
+
}), /* @__PURE__ */ jsx(TimeReadout, {
|
|
4064
|
+
time,
|
|
4065
|
+
duration
|
|
4066
|
+
})]
|
|
4067
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
4068
|
+
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
4069
|
+
children: [
|
|
4070
|
+
/* @__PURE__ */ jsxs(Transport, {
|
|
4071
|
+
playing: media.playing,
|
|
4072
|
+
onPlayPause: media.toggle,
|
|
4073
|
+
children: [list.length > 1 && /* @__PURE__ */ jsx(IconButton, {
|
|
4074
|
+
icon: SkipBack,
|
|
4075
|
+
label: "Previous chapter",
|
|
4076
|
+
disabled: index === 0,
|
|
4077
|
+
onClick: () => step(-1)
|
|
4078
|
+
}), list.length > 1 && /* @__PURE__ */ jsx(IconButton, {
|
|
4079
|
+
icon: SkipForward,
|
|
4080
|
+
label: "Next chapter",
|
|
4081
|
+
disabled: index === list.length - 1,
|
|
4082
|
+
onClick: () => step(1)
|
|
4083
|
+
})]
|
|
4084
|
+
}),
|
|
4085
|
+
list.length > 1 && /* @__PURE__ */ jsxs("span", {
|
|
4086
|
+
className: "type-body-sm text-muted-foreground",
|
|
4087
|
+
children: [
|
|
4088
|
+
current?.title,
|
|
4089
|
+
" (",
|
|
4090
|
+
index + 1,
|
|
4091
|
+
" of ",
|
|
4092
|
+
list.length,
|
|
4093
|
+
")"
|
|
4094
|
+
]
|
|
4095
|
+
}),
|
|
4096
|
+
/* @__PURE__ */ jsxs("span", {
|
|
4097
|
+
className: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-2",
|
|
4098
|
+
children: [
|
|
4099
|
+
/* @__PURE__ */ jsx(RateChoice, {
|
|
4100
|
+
rate: media.rate,
|
|
4101
|
+
onRateChange: media.setRate,
|
|
4102
|
+
rates
|
|
4103
|
+
}),
|
|
4104
|
+
/* @__PURE__ */ jsx(VolumeControl, {
|
|
4105
|
+
volume: media.volume,
|
|
4106
|
+
onVolumeChange: media.setVolume
|
|
4107
|
+
}),
|
|
4108
|
+
canFull && /* @__PURE__ */ jsx(IconButton, {
|
|
4109
|
+
icon: full ? Minimize : Maximize,
|
|
4110
|
+
label: full ? "Leave full screen" : "Full screen",
|
|
4111
|
+
onPress: () => setFull(!full)
|
|
4112
|
+
})
|
|
4113
|
+
]
|
|
4114
|
+
})
|
|
4115
|
+
]
|
|
4116
|
+
})]
|
|
4117
|
+
})
|
|
4118
|
+
]
|
|
4119
|
+
})
|
|
4011
4120
|
});
|
|
4012
4121
|
}
|
|
4013
4122
|
// src/lib/transcript.ts
|
|
@@ -10511,60 +10620,6 @@ function useJob({ isRunning, every = 2e3, invalidates = [], describeError, ...op
|
|
|
10511
10620
|
function isTaskRunning(task, finished) {
|
|
10512
10621
|
return !(Array.isArray(finished) ? finished.includes(task.state) : finished.has(task.state));
|
|
10513
10622
|
}
|
|
10514
|
-
// src/components/fullscreen-frame.tsx
|
|
10515
|
-
/** Whether this browser can show an element full screen. False in jsdom and on iPhone, where the modal fallback is used. */
|
|
10516
|
-
function canFullscreen() {
|
|
10517
|
-
return typeof document !== "undefined" && document.fullscreenEnabled === true && typeof Element.prototype.requestFullscreen === "function";
|
|
10518
|
-
}
|
|
10519
|
-
/** Shows its children full screen while `active`: the browser's Fullscreen API where there is one, a window-filling modal where there is not. */
|
|
10520
|
-
function FullscreenFrame({ label, active, onActiveChange, children, className }) {
|
|
10521
|
-
const ref = React.useRef(null);
|
|
10522
|
-
const [native, setNative] = React.useState(false);
|
|
10523
|
-
const [refused, setRefused] = React.useState(false);
|
|
10524
|
-
const change = React.useRef(onActiveChange);
|
|
10525
|
-
change.current = onActiveChange;
|
|
10526
|
-
React.useEffect(() => {
|
|
10527
|
-
const el = ref.current;
|
|
10528
|
-
if (!active) {
|
|
10529
|
-
setNative(false);
|
|
10530
|
-
setRefused(false);
|
|
10531
|
-
if (document.fullscreenElement && document.fullscreenElement === el) document.exitFullscreen();
|
|
10532
|
-
return;
|
|
10533
|
-
}
|
|
10534
|
-
if (!el || !canFullscreen()) return;
|
|
10535
|
-
let cancelled = false;
|
|
10536
|
-
el.requestFullscreen().then(() => !cancelled && setNative(true), () => !cancelled && setRefused(true));
|
|
10537
|
-
const onChange = () => {
|
|
10538
|
-
if (document.fullscreenElement !== el && !cancelled) change.current(false);
|
|
10539
|
-
};
|
|
10540
|
-
document.addEventListener("fullscreenchange", onChange);
|
|
10541
|
-
return () => {
|
|
10542
|
-
cancelled = true;
|
|
10543
|
-
document.removeEventListener("fullscreenchange", onChange);
|
|
10544
|
-
};
|
|
10545
|
-
}, [active]);
|
|
10546
|
-
const modal = active && !native && (!canFullscreen() || refused);
|
|
10547
|
-
const inner = /* @__PURE__ */ jsx("div", {
|
|
10548
|
-
ref,
|
|
10549
|
-
className: cn(active && "flex h-full min-h-0 flex-col bg-background p-4", className),
|
|
10550
|
-
children
|
|
10551
|
-
});
|
|
10552
|
-
if (!modal) return inner;
|
|
10553
|
-
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
10554
|
-
isOpen: true,
|
|
10555
|
-
onOpenChange: (o) => !o && onActiveChange(false),
|
|
10556
|
-
isDismissable: true,
|
|
10557
|
-
className: "layer-overlay fixed inset-0 scrim",
|
|
10558
|
-
children: /* @__PURE__ */ jsx(Modal, {
|
|
10559
|
-
className: cn("h-full w-full outline-none", overlaySurface, "rounded-none"),
|
|
10560
|
-
children: /* @__PURE__ */ jsx(Dialog$1, {
|
|
10561
|
-
"aria-label": label,
|
|
10562
|
-
className: "h-full outline-none",
|
|
10563
|
-
children: inner
|
|
10564
|
-
})
|
|
10565
|
-
})
|
|
10566
|
-
});
|
|
10567
|
-
}
|
|
10568
10623
|
// src/lib/image-diff.ts
|
|
10569
10624
|
/** The longest side, in pixels, a picture is compared at. */
|
|
10570
10625
|
var MAX_SIDE = 2048;
|