strata-react 1.3.21 → 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/dist/index.js CHANGED
@@ -8,7 +8,7 @@ import { a as fieldErrorsOf, i as errorPayload, n as describeActionError, o as r
8
8
  import { a as PaletteChoice, c as paletteScript, d as usePalette, f as useSystemColorScheme, i as PALETTE_STORAGE_KEY, l as palettes, n as ColorSchemeChoice, o as ThemeProvider, p as Density, r as DEFAULT_PALETTE, s as colorSchemeScript, t as COLOR_SCHEME_STORAGE_KEY, u as useColorScheme } from "./theme-CxYZkUNk.js";
9
9
  import * as React from "react";
10
10
  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";
11
- import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Check, ChevronDown, ChevronLeft, ChevronRight, CircleAlert, CircleCheck, CircleDashed, Clock, CloudOff, Columns2, Ellipsis, Eye, EyeOff, FileQuestion, Flag, Folder, FolderOpen, FolderX, GripVertical, 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
+ import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Check, ChevronDown, ChevronLeft, ChevronRight, CircleAlert, CircleCheck, CircleDashed, Clock, CloudOff, Columns2, Ellipsis, Eye, EyeOff, FastForward, FileQuestion, Flag, Folder, FolderOpen, FolderX, GripVertical, ImageOff, Info, KeyRound, LayoutGrid, List, Loader, LoaderCircle, Lock, Maximize, Maximize2, Minimize, Minus, PanelBottomClose, PanelBottomOpen, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen, PanelTopClose, PanelTopOpen, Pause, Pencil, Play, Redo2, Rewind, RotateCcw, RotateCw, Scan, Search, Send, SkipBack, SkipForward, SlidersHorizontal, Square, StepBack, StepForward, Trash2, TriangleAlert, Undo2, Upload, Volume2, VolumeX, X, ZoomIn, ZoomOut } from "lucide-react";
12
12
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
13
13
  import { Link as Link$1, NavLink, useHref, useNavigate, useSearchParams } from "react-router";
14
14
  import { hashKey, useInfiniteQuery, useQuery, useQueryClient } from "@tanstack/react-query";
@@ -3535,6 +3535,54 @@ var ContentsRow = React.memo(function ContentsRow({ item, current, onSeek, onSel
3535
3535
  })
3536
3536
  });
3537
3537
  });
3538
+ // src/components/media-skip.ts
3539
+ var LEVEL_KIND = {
3540
+ small: "scene",
3541
+ large: "chapter"
3542
+ };
3543
+ /** The marks a level skips by: scenes for small, chapters (and marks with no kind) for large, in time order. */
3544
+ function marksFor(marks, level) {
3545
+ const kind = LEVEL_KIND[level];
3546
+ return marks.filter((m) => (m.kind ?? "chapter") === kind).map((m) => m.time).sort((a, b) => a - b);
3547
+ }
3548
+ /** "1 min", "10 s", "90 s". */
3549
+ function stepWords(seconds) {
3550
+ return seconds >= 60 && seconds % 60 === 0 ? `${seconds / 60} min` : `${seconds} s`;
3551
+ }
3552
+ /**
3553
+ * Where a skip at `level` in `direction` from `time` goes: by the level's marks when the file has any
3554
+ * (the file's start counts as one), else by its time step. `restart` is how far into a part
3555
+ * "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.
3556
+ */
3557
+ function skipAction(marks, level, direction, time, { steps = {}, duration = null, restart = 2 } = {}) {
3558
+ const points = marksFor(marks, level).filter((p) => p >= 0 && (duration == null || p <= duration));
3559
+ const noun = LEVEL_KIND[level];
3560
+ if (points.length) {
3561
+ const all = points[0] > 0 ? [0, ...points] : points;
3562
+ if (direction > 0) {
3563
+ const next = all.find((p) => p > time + .01);
3564
+ return {
3565
+ label: `Next ${noun}`,
3566
+ to: next ?? null,
3567
+ by: "mark"
3568
+ };
3569
+ }
3570
+ const behind = all.filter((p) => p <= time - restart);
3571
+ return {
3572
+ label: `Previous ${noun}`,
3573
+ to: behind.length ? behind[behind.length - 1] : time > 0 ? 0 : null,
3574
+ by: "mark"
3575
+ };
3576
+ }
3577
+ const step = level === "small" ? steps.small ?? 10 : steps.large ?? 60;
3578
+ const raw = time + direction * step;
3579
+ const to = direction < 0 ? Math.max(0, raw) : duration ? Math.min(duration, raw) : raw;
3580
+ return {
3581
+ label: `${direction < 0 ? "Back" : "Forward"} ${stepWords(step)}`,
3582
+ to: direction < 0 && time <= 0 || direction > 0 && duration != null && time >= duration ? null : to,
3583
+ by: "time"
3584
+ };
3585
+ }
3538
3586
  // src/components/fullscreen-frame.tsx
3539
3587
  /** Whether this browser can show an element full screen. False in jsdom and on iPhone, where the modal fallback is used. */
3540
3588
  function canFullscreen() {
@@ -3817,27 +3865,37 @@ function SeekBar({ time, duration: known, onSeek, marks = [], spans = [], onMark
3817
3865
  className: "absolute top-1/2 h-4 w-px -translate-y-1/2 bg-foreground/60",
3818
3866
  style: { left: `${otherTime / duration * 100}%` }
3819
3867
  }),
3820
- duration > 0 && marks.map((m) => /* @__PURE__ */ jsx("button", {
3821
- type: "button",
3822
- tabIndex: -1,
3823
- disabled,
3824
- title: `${m.label}, ${timecode(m.time, {
3825
- precision,
3826
- fps
3827
- })}`,
3828
- "aria-label": `${m.label}, ${timecode(m.time, {
3868
+ duration > 0 && marks.filter((m) => m.time >= 0 && m.time <= duration).map((m) => {
3869
+ const at = timecode(m.time, {
3829
3870
  precision,
3830
3871
  fps
3831
- })}`,
3832
- onPointerDown: (e) => e.stopPropagation(),
3833
- onMouseDown: (e) => e.stopPropagation(),
3834
- onClick: () => onMarkPress ? onMarkPress(m) : seekTo(m.time),
3835
- className: "absolute top-1/2 h-3 w-1 -translate-y-1/2 cursor-pointer rounded-pill bg-foreground",
3836
- style: { left: `${m.time / duration * 100}%` }
3837
- }, `${m.time}-${m.label}`)),
3872
+ });
3873
+ const scene = m.kind === "scene";
3874
+ return /* @__PURE__ */ jsx(Tooltip, {
3875
+ label: m.label,
3876
+ hint: /* @__PURE__ */ jsx("span", {
3877
+ className: "tabular-nums",
3878
+ children: at
3879
+ }),
3880
+ delay: 150,
3881
+ children: /* @__PURE__ */ jsx(Button$1, {
3882
+ excludeFromTabOrder: true,
3883
+ isDisabled: disabled,
3884
+ "aria-label": `${m.label}, ${at}`,
3885
+ "data-kind": m.kind ?? "chapter",
3886
+ onPress: () => onMarkPress ? onMarkPress(m) : seekTo(m.time),
3887
+ className: cn("group/mark absolute inset-y-0 flex -translate-x-1/2 cursor-pointer items-center justify-center", scene ? "w-2" : "z-10 w-3"),
3888
+ style: { left: `${m.time / duration * 100}%` },
3889
+ children: /* @__PURE__ */ jsx("span", {
3890
+ "aria-hidden": true,
3891
+ className: cn("rounded-pill transition-state group-hover/mark:bg-primary", scene ? "h-2 w-0.5 bg-foreground/50" : "h-3.5 w-1 bg-foreground")
3892
+ })
3893
+ })
3894
+ }, `${m.time}-${m.kind ?? "chapter"}-${m.label}`);
3895
+ }),
3838
3896
  /* @__PURE__ */ jsx("div", {
3839
3897
  ...thumbProps,
3840
- className: cn("absolute top-1/2 size-4 -translate-x-1/2 -translate-y-1/2 rounded-pill border-2 border-primary bg-background", isFocusVisible && "outline-2 outline-offset-2 outline-ring"),
3898
+ className: cn("absolute top-1/2 z-20 size-4 -translate-x-1/2 -translate-y-1/2 rounded-pill border-2 border-primary bg-background", isFocusVisible && "outline-2 outline-offset-2 outline-ring"),
3841
3899
  style: { left: `${frac * 100}%` },
3842
3900
  children: /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("input", {
3843
3901
  ref: input,
@@ -4961,7 +5019,7 @@ function useCoarsePointer() {
4961
5019
  * a touch device), with the failure to load shown and retried. For an editor or a replay, use the
4962
5020
  * parts and `useMediaElement` directly.
4963
5021
  */
4964
- 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, marks, onSpan, spanWords, start, resumeWords, onProgress, progressEvery, mediaRef, heading, overlay, status, warning, aspect, fullscreen = true, className }) {
5022
+ 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, marks, onSpan, spanWords, start, resumeWords, onProgress, progressEvery, mediaRef, heading, overlay, status, warning, aspect, fullscreen = true, skip = {}, fps, float = false, className }) {
4965
5023
  const list = React.useMemo(() => sources ?? (src ? [{
4966
5024
  src,
4967
5025
  title: label
@@ -5077,6 +5135,21 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
5077
5135
  resume.current = media.playing;
5078
5136
  go(to);
5079
5137
  };
5138
+ const ownMarks = !cut && !offsets && list.length <= 1 && !bound ? marks ?? [] : [];
5139
+ const skipping = skip !== false;
5140
+ const skipTo = (level, direction) => skipAction(ownMarks, level, direction, time, {
5141
+ steps: skip || {},
5142
+ duration
5143
+ });
5144
+ const stepFrame = (direction) => {
5145
+ if (!fps) return;
5146
+ media.pause();
5147
+ const el = ref.current;
5148
+ const now = el && Number.isFinite(el.currentTime) ? cut ? el.currentTime - cut.start : (offsets ? offsets[index] : 0) + el.currentTime : time;
5149
+ const at = Math.floor(now * fps + .001);
5150
+ seek(Math.max(0, (at + direction + .5) / fps));
5151
+ };
5152
+ const frames = Boolean(fps) && kind === "video";
5080
5153
  const carried = React.useRef(null);
5081
5154
  React.useEffect(() => {
5082
5155
  const c = carried.current;
@@ -5189,6 +5262,35 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
5189
5262
  }, [wakeControls]);
5190
5263
  const idle = autoHide && controlsIdle;
5191
5264
  const hideControls = full && canFull && autoHide && controlsIdle;
5265
+ const floatable = float && kind === "video";
5266
+ const box = React.useRef(null);
5267
+ const below = React.useRef(null);
5268
+ const [offTop, setOffTop] = React.useState(false);
5269
+ const [played, setPlayed] = React.useState(false);
5270
+ const [closed, setClosed] = React.useState(false);
5271
+ React.useEffect(() => {
5272
+ if (media.playing) setPlayed(true);
5273
+ }, [media.playing]);
5274
+ React.useEffect(() => {
5275
+ const el = below.current;
5276
+ if (!floatable || !el || typeof IntersectionObserver === "undefined") return;
5277
+ const observer = new IntersectionObserver((entries) => {
5278
+ const e = entries[entries.length - 1];
5279
+ const gone = !e.isIntersecting && e.boundingClientRect.top < (e.rootBounds?.top ?? 0);
5280
+ setOffTop(gone);
5281
+ if (!gone) setClosed(false);
5282
+ });
5283
+ observer.observe(el);
5284
+ return () => observer.disconnect();
5285
+ }, [floatable]);
5286
+ const wantFloat = floatable && offTop && played && !closed && !full;
5287
+ const [held, setHeld] = React.useState(null);
5288
+ React.useLayoutEffect(() => setHeld(wantFloat ? box.current?.getBoundingClientRect().height ?? 0 : null), [wantFloat]);
5289
+ const floating = wantFloat && held !== null;
5290
+ const backToPlayer = () => {
5291
+ below.current?.previousElementSibling?.scrollIntoView({ block: "nearest" });
5292
+ setOffTop(false);
5293
+ };
5192
5294
  const stage = React.useRef(null);
5193
5295
  const latest = React.useRef(media);
5194
5296
  latest.current = media;
@@ -5227,6 +5329,17 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
5227
5329
  label: "Mute",
5228
5330
  run: () => media.setVolume(media.muted ? 100 : 0)
5229
5331
  },
5332
+ ...frames ? [{
5333
+ keys: [","],
5334
+ label: "Back one frame",
5335
+ run: () => stepFrame(-1),
5336
+ repeat: true
5337
+ }, {
5338
+ keys: ["."],
5339
+ label: "Forward one frame",
5340
+ run: () => stepFrame(1),
5341
+ repeat: true
5342
+ }] : [],
5230
5343
  ...canFull ? [{
5231
5344
  keys: ["f"],
5232
5345
  label: full ? "Leave full screen" : "Full screen",
@@ -5244,7 +5357,9 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
5244
5357
  index,
5245
5358
  offer,
5246
5359
  canFull,
5247
- full
5360
+ full,
5361
+ frames,
5362
+ fps
5248
5363
  ]);
5249
5364
  const id = React.useId();
5250
5365
  React.useEffect(() => {
@@ -5331,6 +5446,16 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
5331
5446
  };
5332
5447
  const hasSpans = (spans?.length ?? 0) > 0;
5333
5448
  const showActions = hasSpans || picked;
5449
+ const barMarks = bound && showFull ? [{
5450
+ time: bound.start,
5451
+ label: "Window starts"
5452
+ }, {
5453
+ time: bound.end,
5454
+ label: "Window ends"
5455
+ }] : offsets ? list.map((s, i) => ({
5456
+ time: offsets[i],
5457
+ label: s.title
5458
+ })).slice(1) : !bound && marks || [];
5334
5459
  const element = kind === "video" ? /* @__PURE__ */ jsxs("div", {
5335
5460
  ref: stage,
5336
5461
  tabIndex: -1,
@@ -5345,7 +5470,7 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
5345
5470
  onDoubleClick: canFull ? () => setFull((f) => !f) : void 0,
5346
5471
  className: "absolute inset-0 size-full object-contain"
5347
5472
  }),
5348
- heading && /* @__PURE__ */ jsx(PictureHeading, {
5473
+ heading && !floating && /* @__PURE__ */ jsx(PictureHeading, {
5349
5474
  heading,
5350
5475
  shown: !idle
5351
5476
  }),
@@ -5367,172 +5492,270 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
5367
5492
  children: /* @__PURE__ */ jsx(PlayerWarningToast, { warning }, warning.key)
5368
5493
  });
5369
5494
  const what = kind === "video" ? "this video" : "this recording";
5370
- return /* @__PURE__ */ jsx(FullscreenFrame, {
5495
+ return /* @__PURE__ */ jsxs(FullscreenFrame, {
5371
5496
  label,
5372
5497
  active: full,
5373
5498
  onActiveChange: setFull,
5374
5499
  modal: false,
5375
5500
  className,
5376
- children: /* @__PURE__ */ jsxs("div", {
5377
- role: "group",
5378
- "aria-label": label,
5379
- onFocusCapture: () => keyPlayers.use(id),
5380
- onMouseMoveCapture: autoHide ? wakeControls : void 0,
5381
- onKeyDownCapture: autoHide ? wakeControls : void 0,
5382
- onMouseLeave: autoHide && !full ? sleepControls : void 0,
5383
- onPointerDownCapture: () => {
5384
- keyPlayers.use(id);
5385
- if (autoHide) wakeControls();
5386
- },
5387
- className: cn("relative grid w-full gap-2", full && "flex h-full min-h-0 flex-col"),
5388
- children: [
5389
- element,
5390
- native && hasSpans && /* @__PURE__ */ jsx(SpanStrip, {
5391
- spans: spanState.bars,
5392
- duration,
5393
- label: `Marked parts of ${label}`
5394
- }),
5395
- warningToast,
5396
- kind === "audio" && showActions && /* @__PURE__ */ jsx(SpanActions, {
5397
- state: spanState,
5398
- other: resumeNotice,
5399
- className: "flex flex-wrap items-center gap-2"
5400
- }),
5401
- kind === "audio" && overlay?.(media),
5402
- media.error?.kind === "load" && /* @__PURE__ */ jsx(Alert, {
5403
- tone: "danger",
5404
- announce: true,
5405
- title: `Could not load ${what}`,
5406
- action: /* @__PURE__ */ jsx(Button, {
5407
- size: "sm",
5408
- variant: "outline",
5409
- onClick: media.retry,
5410
- children: "Try again"
5411
- }),
5412
- children: media.error.message
5413
- }),
5414
- media.error?.kind === "blocked" && /* @__PURE__ */ jsx("p", {
5415
- role: "status",
5416
- className: "type-body-sm text-muted-foreground",
5417
- children: media.error.message
5418
- }),
5419
- (growing || bound || !native || status) && /* @__PURE__ */ jsxs("div", {
5420
- className: cn("grid gap-2", hideControls && "pointer-events-none absolute inset-x-0 bottom-0 opacity-0 has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:static has-[:focus-visible]:opacity-100"),
5421
- children: [
5422
- growing && /* @__PURE__ */ jsxs("div", {
5423
- className: "flex flex-wrap items-center gap-x-3 gap-y-1",
5501
+ children: [
5502
+ /* @__PURE__ */ jsxs("div", {
5503
+ ref: box,
5504
+ role: "group",
5505
+ "aria-label": label,
5506
+ "data-floating": floating || void 0,
5507
+ onFocusCapture: () => keyPlayers.use(id),
5508
+ onMouseMoveCapture: autoHide ? wakeControls : void 0,
5509
+ onKeyDownCapture: autoHide ? wakeControls : void 0,
5510
+ onMouseLeave: autoHide && !full ? sleepControls : void 0,
5511
+ onPointerDownCapture: () => {
5512
+ keyPlayers.use(id);
5513
+ if (autoHide) wakeControls();
5514
+ },
5515
+ className: cn("relative grid w-full gap-2", full && "flex h-full min-h-0 flex-col", floating && cn("fixed right-4 bottom-4 layer-bar w-80 max-w-full gap-1.5 p-2", "rounded-overlay border border-border bg-popover text-popover-foreground shadow-overlay enter-overlay")),
5516
+ children: [
5517
+ element,
5518
+ floating && /* @__PURE__ */ jsxs("div", {
5519
+ className: "grid gap-1",
5520
+ children: [!native && /* @__PURE__ */ jsx(SeekBar, {
5521
+ time,
5522
+ duration,
5523
+ onSeek: seek,
5524
+ spans: spanState.bars,
5525
+ marks: barMarks,
5526
+ step: JUMP,
5527
+ bigStep: 60,
5528
+ label: `Seek in ${label}`
5529
+ }), /* @__PURE__ */ jsxs("div", {
5530
+ className: "flex items-center gap-1",
5424
5531
  children: [
5425
- /* @__PURE__ */ jsx(Status, {
5426
- tone: "info",
5427
- icon: LoaderCircle,
5428
- children: "Still being made"
5532
+ /* @__PURE__ */ jsx(IconButton, {
5533
+ icon: media.playing ? Pause : Play,
5534
+ label: media.playing ? "Pause" : "Play",
5535
+ hint: "Space",
5536
+ size: "sm",
5537
+ onClick: media.toggle
5429
5538
  }),
5430
- growing.status && /* @__PURE__ */ jsx("span", {
5431
- className: "type-body-sm text-muted-foreground",
5432
- children: growing.status
5539
+ /* @__PURE__ */ jsx(TimeReadout, {
5540
+ time,
5541
+ duration,
5542
+ className: "type-caption"
5433
5543
  }),
5434
- /* @__PURE__ */ jsx("span", {
5435
- role: "status",
5436
- className: "type-body-sm text-muted-foreground",
5437
- children: media.waitingForMore ? "Waiting for more to be made. It will carry on by itself." : ""
5544
+ /* @__PURE__ */ jsxs("span", {
5545
+ className: "ml-auto flex items-center gap-1",
5546
+ children: [/* @__PURE__ */ jsx(IconButton, {
5547
+ icon: ArrowUp,
5548
+ label: "Back to the player",
5549
+ size: "sm",
5550
+ onPress: backToPlayer
5551
+ }), /* @__PURE__ */ jsx(IconButton, {
5552
+ icon: X,
5553
+ label: "Close",
5554
+ size: "sm",
5555
+ onPress: () => setClosed(true)
5556
+ })]
5438
5557
  })
5439
5558
  ]
5559
+ })]
5560
+ }),
5561
+ !floating && native && hasSpans && /* @__PURE__ */ jsx(SpanStrip, {
5562
+ spans: spanState.bars,
5563
+ duration,
5564
+ label: `Marked parts of ${label}`
5565
+ }),
5566
+ warningToast,
5567
+ !floating && kind === "audio" && showActions && /* @__PURE__ */ jsx(SpanActions, {
5568
+ state: spanState,
5569
+ other: resumeNotice,
5570
+ className: "flex flex-wrap items-center gap-2"
5571
+ }),
5572
+ kind === "audio" && overlay?.(media),
5573
+ media.error?.kind === "load" && /* @__PURE__ */ jsx(Alert, {
5574
+ tone: "danger",
5575
+ announce: true,
5576
+ title: `Could not load ${what}`,
5577
+ action: /* @__PURE__ */ jsx(Button, {
5578
+ size: "sm",
5579
+ variant: "outline",
5580
+ onClick: media.retry,
5581
+ children: "Try again"
5440
5582
  }),
5441
- bound && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("p", {
5442
- className: "type-caption text-muted-foreground tabular-nums",
5443
- children: [
5444
- format.runningTime(bound.start),
5445
- " to ",
5446
- format.runningTime(bound.end),
5447
- loop ? ", looping" : ""
5448
- ]
5449
- }), /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("span", {
5450
- role: "status",
5451
- children: media.playing ? `Playing ${format.runningTime(bound.start)} to ${format.runningTime(bound.end)}` : ""
5452
- }) })] }),
5453
- !native && /* @__PURE__ */ jsxs("div", {
5454
- className: "grid gap-2",
5455
- children: [/* @__PURE__ */ jsxs("div", {
5456
- className: "flex min-w-0 items-center gap-3",
5457
- children: [/* @__PURE__ */ jsx(SeekBar, {
5458
- time,
5459
- duration,
5460
- onSeek: seek,
5461
- buffered: growing ? media.ready : offsets ? void 0 : media.buffered,
5462
- spans: spanState.bars,
5463
- marks: bound && showFull ? [{
5464
- time: bound.start,
5465
- label: "Window starts"
5466
- }, {
5467
- time: bound.end,
5468
- label: "Window ends"
5469
- }] : offsets ? list.map((s, i) => ({
5470
- time: offsets[i],
5471
- label: s.title
5472
- })).slice(1) : !bound && marks || [],
5473
- step: JUMP,
5474
- bigStep: 60,
5475
- label: `Seek in ${label}`
5476
- }), /* @__PURE__ */ jsx(TimeReadout, {
5477
- time,
5478
- duration
5479
- })]
5480
- }), /* @__PURE__ */ jsxs("div", {
5481
- className: "flex flex-wrap items-center gap-x-4 gap-y-2",
5583
+ children: media.error.message
5584
+ }),
5585
+ media.error?.kind === "blocked" && /* @__PURE__ */ jsx("p", {
5586
+ role: "status",
5587
+ className: "type-body-sm text-muted-foreground",
5588
+ children: media.error.message
5589
+ }),
5590
+ !floating && (growing || bound || !native || status) && /* @__PURE__ */ jsxs("div", {
5591
+ className: cn("grid gap-2", hideControls && "pointer-events-none absolute inset-x-0 bottom-0 opacity-0 has-[:focus-visible]:pointer-events-auto has-[:focus-visible]:static has-[:focus-visible]:opacity-100"),
5592
+ children: [
5593
+ growing && /* @__PURE__ */ jsxs("div", {
5594
+ className: "flex flex-wrap items-center gap-x-3 gap-y-1",
5482
5595
  children: [
5483
- /* @__PURE__ */ jsxs(Transport, {
5484
- playing: media.playing,
5485
- onPlayPause: media.toggle,
5486
- children: [list.length > 1 && /* @__PURE__ */ jsx(IconButton, {
5487
- icon: SkipBack,
5488
- label: "Previous chapter",
5489
- disabled: index === 0,
5490
- onClick: () => step(-1)
5491
- }), list.length > 1 && /* @__PURE__ */ jsx(IconButton, {
5492
- icon: SkipForward,
5493
- label: "Next chapter",
5494
- disabled: index === list.length - 1,
5495
- onClick: () => step(1)
5496
- })]
5596
+ /* @__PURE__ */ jsx(Status, {
5597
+ tone: "info",
5598
+ icon: LoaderCircle,
5599
+ children: "Still being made"
5497
5600
  }),
5498
- list.length > 1 && /* @__PURE__ */ jsxs("span", {
5601
+ growing.status && /* @__PURE__ */ jsx("span", {
5499
5602
  className: "type-body-sm text-muted-foreground",
5500
- children: [
5501
- current?.title,
5502
- " (",
5503
- index + 1,
5504
- " of ",
5505
- list.length,
5506
- ")"
5507
- ]
5603
+ children: growing.status
5508
5604
  }),
5509
- /* @__PURE__ */ jsxs("span", {
5510
- className: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-2",
5511
- children: [
5512
- /* @__PURE__ */ jsx(RateChoice, {
5513
- rate: media.rate,
5514
- onRateChange: media.setRate,
5515
- rates
5516
- }),
5517
- /* @__PURE__ */ jsx(VolumeControl, {
5518
- volume: media.volume,
5519
- onVolumeChange: media.setVolume
5520
- }),
5521
- canFull && /* @__PURE__ */ jsx(IconButton, {
5522
- icon: full ? Minimize : Maximize,
5523
- label: full ? "Leave full screen" : "Full screen",
5524
- onPress: () => setFull(!full)
5525
- })
5526
- ]
5605
+ /* @__PURE__ */ jsx("span", {
5606
+ role: "status",
5607
+ className: "type-body-sm text-muted-foreground",
5608
+ children: media.waitingForMore ? "Waiting for more to be made. It will carry on by itself." : ""
5527
5609
  })
5528
5610
  ]
5529
- })]
5530
- }),
5531
- status
5532
- ]
5533
- })
5534
- ]
5535
- })
5611
+ }),
5612
+ bound && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("p", {
5613
+ className: "type-caption text-muted-foreground tabular-nums",
5614
+ children: [
5615
+ format.runningTime(bound.start),
5616
+ " to ",
5617
+ format.runningTime(bound.end),
5618
+ loop ? ", looping" : ""
5619
+ ]
5620
+ }), /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("span", {
5621
+ role: "status",
5622
+ children: media.playing ? `Playing ${format.runningTime(bound.start)} to ${format.runningTime(bound.end)}` : ""
5623
+ }) })] }),
5624
+ !native && /* @__PURE__ */ jsxs("div", {
5625
+ className: "grid gap-2",
5626
+ children: [/* @__PURE__ */ jsxs("div", {
5627
+ className: "flex min-w-0 items-center gap-3",
5628
+ children: [/* @__PURE__ */ jsx(SeekBar, {
5629
+ time,
5630
+ duration,
5631
+ onSeek: seek,
5632
+ buffered: growing ? media.ready : offsets ? void 0 : media.buffered,
5633
+ spans: spanState.bars,
5634
+ marks: barMarks,
5635
+ step: JUMP,
5636
+ bigStep: 60,
5637
+ label: `Seek in ${label}`
5638
+ }), /* @__PURE__ */ jsx(TimeReadout, {
5639
+ time,
5640
+ duration
5641
+ })]
5642
+ }), /* @__PURE__ */ jsxs("div", {
5643
+ className: "flex flex-wrap items-center gap-x-4 gap-y-2",
5644
+ children: [
5645
+ /* @__PURE__ */ jsxs(Toolbar, {
5646
+ label: "Playback",
5647
+ className: "gap-2",
5648
+ children: [
5649
+ list.length > 1 ? /* @__PURE__ */ jsx(IconButton, {
5650
+ icon: SkipBack,
5651
+ label: "Previous chapter",
5652
+ disabled: index === 0,
5653
+ onClick: () => step(-1)
5654
+ }) : skipping && /* @__PURE__ */ jsx(SkipButton, {
5655
+ action: skipTo("large", -1),
5656
+ icon: SkipBack,
5657
+ seek
5658
+ }),
5659
+ skipping && /* @__PURE__ */ jsx(SkipButton, {
5660
+ action: skipTo("small", -1),
5661
+ icon: Rewind,
5662
+ seek
5663
+ }),
5664
+ frames && /* @__PURE__ */ jsx(IconButton, {
5665
+ icon: StepBack,
5666
+ label: "Back one frame",
5667
+ hint: ",",
5668
+ onClick: () => stepFrame(-1)
5669
+ }),
5670
+ /* @__PURE__ */ jsx(IconButton, {
5671
+ icon: media.playing ? Pause : Play,
5672
+ label: media.playing ? "Pause" : "Play",
5673
+ hint: "Space",
5674
+ variant: "outline",
5675
+ onClick: media.toggle
5676
+ }),
5677
+ frames && /* @__PURE__ */ jsx(IconButton, {
5678
+ icon: StepForward,
5679
+ label: "Forward one frame",
5680
+ hint: ".",
5681
+ onClick: () => stepFrame(1)
5682
+ }),
5683
+ skipping && /* @__PURE__ */ jsx(SkipButton, {
5684
+ action: skipTo("small", 1),
5685
+ icon: FastForward,
5686
+ seek
5687
+ }),
5688
+ list.length > 1 ? /* @__PURE__ */ jsx(IconButton, {
5689
+ icon: SkipForward,
5690
+ label: "Next chapter",
5691
+ disabled: index === list.length - 1,
5692
+ onClick: () => step(1)
5693
+ }) : skipping && /* @__PURE__ */ jsx(SkipButton, {
5694
+ action: skipTo("large", 1),
5695
+ icon: SkipForward,
5696
+ seek
5697
+ })
5698
+ ]
5699
+ }),
5700
+ list.length > 1 && /* @__PURE__ */ jsxs("span", {
5701
+ className: "type-body-sm text-muted-foreground",
5702
+ children: [
5703
+ current?.title,
5704
+ " (",
5705
+ index + 1,
5706
+ " of ",
5707
+ list.length,
5708
+ ")"
5709
+ ]
5710
+ }),
5711
+ /* @__PURE__ */ jsxs("span", {
5712
+ className: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-2",
5713
+ children: [
5714
+ /* @__PURE__ */ jsx(RateChoice, {
5715
+ rate: media.rate,
5716
+ onRateChange: media.setRate,
5717
+ rates
5718
+ }),
5719
+ /* @__PURE__ */ jsx(VolumeControl, {
5720
+ volume: media.volume,
5721
+ onVolumeChange: media.setVolume
5722
+ }),
5723
+ canFull && /* @__PURE__ */ jsx(IconButton, {
5724
+ icon: full ? Minimize : Maximize,
5725
+ label: full ? "Leave full screen" : "Full screen",
5726
+ onPress: () => setFull(!full)
5727
+ })
5728
+ ]
5729
+ })
5730
+ ]
5731
+ })]
5732
+ }),
5733
+ status
5734
+ ]
5735
+ })
5736
+ ]
5737
+ }),
5738
+ floating && /* @__PURE__ */ jsx("div", {
5739
+ "aria-hidden": true,
5740
+ "data-player-place": "",
5741
+ style: { height: held ?? 0 }
5742
+ }),
5743
+ floatable && /* @__PURE__ */ jsx("span", {
5744
+ ref: below,
5745
+ "aria-hidden": true,
5746
+ "data-player-end": "",
5747
+ className: "block"
5748
+ })
5749
+ ]
5750
+ });
5751
+ }
5752
+ /** One skip button: named for where it goes ("Next scene", "Back 10 s"), and not pressable when there is nowhere to go. */
5753
+ function SkipButton({ action, icon, seek }) {
5754
+ return /* @__PURE__ */ jsx(IconButton, {
5755
+ icon,
5756
+ label: action.label,
5757
+ disabled: action.to === null,
5758
+ onClick: () => action.to !== null && seek(action.to)
5536
5759
  });
5537
5760
  }
5538
5761
  function PictureHeading({ heading, shown }) {
@@ -19751,6 +19974,6 @@ function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose
19751
19974
  ]
19752
19975
  });
19753
19976
  }
19754
- export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, EmptyState, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, NBSP, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RateChoice, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, ShortcutEditor, SideNav, Skeleton, Slider, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, checkKey, clampToRoom, clampViewport, clipsQueryKey, cn, colorSchemeScript, commandShortcut, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, ease, encodeWav, errorPayload, explainMicrophoneError, fetchJson, fieldErrorsOf, findPage, fitRect, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, inputLevelThresholds, isDoubtful, isRefusal, isReservedChord, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, logScale, loudnessOf, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, moveGutter, moveRect, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, resample, resamplePeaks, resizeRect, rgbaToBlob, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useDifference, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useRebindableShortcuts, useRecorder, useReserve, useSayOnShow, useSearchParam, useSelection, useSharedCursor, useSpeech, useSystemColorScheme, useSystemInfo, useTimelineZoom, useUndoable, useViewOptions, useViewport, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
19977
+ export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, EmptyState, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, NBSP, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RateChoice, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, ShortcutEditor, SideNav, Skeleton, Slider, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, checkKey, clampToRoom, clampViewport, clipsQueryKey, cn, colorSchemeScript, commandShortcut, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, ease, encodeWav, errorPayload, explainMicrophoneError, fetchJson, fieldErrorsOf, findPage, fitRect, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, inputLevelThresholds, isDoubtful, isRefusal, isReservedChord, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, moveGutter, moveRect, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, resample, resamplePeaks, resizeRect, rgbaToBlob, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, skipAction, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useDifference, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useRebindableShortcuts, useRecorder, useReserve, useSayOnShow, useSearchParam, useSelection, useSharedCursor, useSpeech, useSystemColorScheme, useSystemInfo, useTimelineZoom, useUndoable, useViewOptions, useViewport, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
19755
19978
 
19756
19979
  //# sourceMappingURL=index.js.map