strata-react 2.1.3 → 2.1.5
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 +2 -2
- package/dist/{field-DBCsFIng.js → field-BY42OY3g.js} +11 -1
- package/dist/field-BY42OY3g.js.map +1 -0
- package/dist/hls.d.ts +1 -1
- package/dist/hls.js +33 -0
- package/dist/hls.js.map +1 -1
- package/dist/index.d.ts +20 -3
- package/dist/index.js +227 -15
- package/dist/index.js.map +1 -1
- package/dist/map.js +2 -2
- package/dist/{media-player-Buvu2l7R.d.ts → media-player-C6j069Aa.d.ts} +66 -4
- package/dist/{microphone-D3sbBVka.js → microphone-Db5o3SHZ.js} +2 -2
- package/dist/{microphone-D3sbBVka.js.map → microphone-Db5o3SHZ.js.map} +1 -1
- package/dist/panorama.js +1 -1
- package/dist/strata.bare.css +7 -0
- package/dist/strata.css +7 -0
- package/dist/strata.migrate.css +7 -0
- package/dist/testing.js +2 -2
- package/dist/{theme-1oOSMj_D.js → theme-5Mb1ydlA.js} +2 -2
- package/dist/{theme-1oOSMj_D.js.map → theme-5Mb1ydlA.js.map} +1 -1
- package/dist/{value-controls-ColD28Pp.js → value-controls-D5zpPQuJ.js} +2 -2
- package/dist/{value-controls-ColD28Pp.js.map → value-controls-D5zpPQuJ.js.map} +1 -1
- package/package.json +1 -1
- package/dist/field-DBCsFIng.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { i as typeSteps, n as KeyText, r as cn, t as Tooltip } from "./tooltip-BosfsWYh.js";
|
|
2
|
-
import { a as Textarea, c as useSearchParam, d as createFormat, f as format, i as NativeSelect, l as MISSING, n as Field, o as useFieldControl, p as toDate, r as Input, s as controlHeight, t as ChoiceGroup, u as NBSP } from "./field-
|
|
2
|
+
import { a as Textarea, c as useSearchParam, d as createFormat, f as format, i as NativeSelect, l as MISSING, n as Field, o as useFieldControl, p as toDate, r as Input, s as controlHeight, t as ChoiceGroup, u as NBSP } from "./field-BY42OY3g.js";
|
|
3
3
|
import { a as isDev, i as buttonVariants, n as IconButton, o as useInView, r as RowAction, t as Button } from "./button-CjnotDTb.js";
|
|
4
4
|
import { t as followAim } from "./follow-CXQsL86O.js";
|
|
5
5
|
import { n as useViewPointers, r as useWheelZoom, t as useSettledStatus } from "./viewer-input-3Qa-o35k.js";
|
|
6
|
-
import { A as StrataQueryProvider, C as toast, D as LoadError, E as EmptyState, F as useLoad, I as usePoll, L as overlaySurface, M as fetchJson, N as staleOf, O as Skeleton, P as toLoad, S as StrataToastRegion, T as DataView$1, _ as clampViewport, a as useMicrophone, b as viewportTransform, d as zoomToBox, f as FIT, g as boxViewport, h as actualPixelsScale, i as explainMicrophoneError, j as createQueryClient, k as StaleNotice, l as readingOrder, m as MIN_SCALE, n as MicrophoneError, o as Thumbnail, p as MAX_SCALE, r as browserMicrophone, s as ThumbnailSkeleton, t as MicrophoneContext, u as regionStyle, v as frameBoxToShares, w as toastTimeout, x as zoomAt, y as regionShares } from "./microphone-
|
|
7
|
-
import { a as useAsyncAction, c as KeysLegend, d as useHotkeys, i as AsyncButton, l as isTypingTarget, n as NumberField, o as Toolbar, r as Slider, s as ToolbarSeparator, t as ColorField, u as keyName } from "./value-controls-
|
|
6
|
+
import { A as StrataQueryProvider, C as toast, D as LoadError, E as EmptyState, F as useLoad, I as usePoll, L as overlaySurface, M as fetchJson, N as staleOf, O as Skeleton, P as toLoad, S as StrataToastRegion, T as DataView$1, _ as clampViewport, a as useMicrophone, b as viewportTransform, d as zoomToBox, f as FIT, g as boxViewport, h as actualPixelsScale, i as explainMicrophoneError, j as createQueryClient, k as StaleNotice, l as readingOrder, m as MIN_SCALE, n as MicrophoneError, o as Thumbnail, p as MAX_SCALE, r as browserMicrophone, s as ThumbnailSkeleton, t as MicrophoneContext, u as regionStyle, v as frameBoxToShares, w as toastTimeout, x as zoomAt, y as regionShares } from "./microphone-Db5o3SHZ.js";
|
|
7
|
+
import { a as useAsyncAction, c as KeysLegend, d as useHotkeys, i as AsyncButton, l as isTypingTarget, n as NumberField, o as Toolbar, r as Slider, s as ToolbarSeparator, t as ColorField, u as keyName } from "./value-controls-D5zpPQuJ.js";
|
|
8
8
|
import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-Cwyvgwsw.js";
|
|
9
9
|
import { a as fieldErrorsOf, i as errorPayload, n as describeActionError, o as readErrorBody, r as describeHttpError, t as HttpError } from "./errors-CmuwcWlb.js";
|
|
10
|
-
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-
|
|
10
|
+
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-5Mb1ydlA.js";
|
|
11
11
|
import * as React from "react";
|
|
12
12
|
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";
|
|
13
13
|
import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronsUp, 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";
|
|
@@ -4811,6 +4811,176 @@ function TextLink(all) {
|
|
|
4811
4811
|
}));
|
|
4812
4812
|
}
|
|
4813
4813
|
|
|
4814
|
+
// src/components/media-stats.tsx
|
|
4815
|
+
const EMPTY = {
|
|
4816
|
+
width: null,
|
|
4817
|
+
height: null,
|
|
4818
|
+
shownWidth: null,
|
|
4819
|
+
shownHeight: null,
|
|
4820
|
+
fps: null,
|
|
4821
|
+
frames: null,
|
|
4822
|
+
dropped: null,
|
|
4823
|
+
ahead: 0,
|
|
4824
|
+
decodedBitrate: null
|
|
4825
|
+
};
|
|
4826
|
+
/** Seconds of file the bitrate and frame rate are measured over: a segment's bytes arrive in bursts, so one second is too jumpy. */
|
|
4827
|
+
const WINDOW = 4;
|
|
4828
|
+
/**
|
|
4829
|
+
* Measures the element in `ref` once a second while `enabled`: its picture size, the size it is drawn
|
|
4830
|
+
* at, frame rate, dropped frames, buffer ahead and (Chromium) the bitrate being decoded, with the stream
|
|
4831
|
+
* engine's report from `stream()` merged in.
|
|
4832
|
+
*/
|
|
4833
|
+
function useMediaStats(ref, { enabled = true, stream, every = 1e3 } = {}) {
|
|
4834
|
+
const [stats, setStats] = React.useState(EMPTY);
|
|
4835
|
+
const samples = React.useRef([]);
|
|
4836
|
+
const source = React.useRef(stream);
|
|
4837
|
+
source.current = stream;
|
|
4838
|
+
React.useEffect(() => {
|
|
4839
|
+
if (!enabled) return;
|
|
4840
|
+
const read = () => {
|
|
4841
|
+
const el = ref.current;
|
|
4842
|
+
if (!el) return;
|
|
4843
|
+
setStats(measure(el, samples.current, source.current?.() ?? {}));
|
|
4844
|
+
};
|
|
4845
|
+
read();
|
|
4846
|
+
const t = setInterval(read, every);
|
|
4847
|
+
return () => clearInterval(t);
|
|
4848
|
+
}, [
|
|
4849
|
+
enabled,
|
|
4850
|
+
every,
|
|
4851
|
+
ref
|
|
4852
|
+
]);
|
|
4853
|
+
return stats;
|
|
4854
|
+
}
|
|
4855
|
+
function measure(el, samples, stream) {
|
|
4856
|
+
const video = el instanceof HTMLVideoElement ? el : null;
|
|
4857
|
+
const quality = video && typeof video.getVideoPlaybackQuality === "function" ? video.getVideoPlaybackQuality() : null;
|
|
4858
|
+
const counts = el;
|
|
4859
|
+
const bytes = typeof counts.webkitVideoDecodedByteCount === "number" ? counts.webkitVideoDecodedByteCount + (counts.webkitAudioDecodedByteCount ?? 0) : null;
|
|
4860
|
+
const now = {
|
|
4861
|
+
at: el.currentTime,
|
|
4862
|
+
frames: quality?.totalVideoFrames ?? 0,
|
|
4863
|
+
bytes,
|
|
4864
|
+
wall: performance.now()
|
|
4865
|
+
};
|
|
4866
|
+
const last = samples[samples.length - 1];
|
|
4867
|
+
const reach = last ? (now.wall - last.wall) / 1e3 * Math.max(el.playbackRate, 1) * 1.5 + 1 : 0;
|
|
4868
|
+
if (!last || el.paused || el.seeking || now.at < last.at || now.at - last.at > reach || now.frames < last.frames) samples.length = 0;
|
|
4869
|
+
if (!el.paused && !el.seeking) samples.push(now);
|
|
4870
|
+
while (samples.length > 2 && now.at - samples[1].at >= WINDOW) samples.shift();
|
|
4871
|
+
const first = samples[0];
|
|
4872
|
+
const span = first ? now.at - first.at : 0;
|
|
4873
|
+
const fps = span >= .5 && quality ? (now.frames - first.frames) / span : null;
|
|
4874
|
+
const decodedBitrate = span >= .5 && bytes !== null && first.bytes !== null && bytes > first.bytes ? (bytes - first.bytes) * 8 / span : null;
|
|
4875
|
+
const width = video && video.videoWidth > 0 ? video.videoWidth : null;
|
|
4876
|
+
const height = video && video.videoHeight > 0 ? video.videoHeight : null;
|
|
4877
|
+
let shownWidth = null;
|
|
4878
|
+
let shownHeight = null;
|
|
4879
|
+
if (video && width && height && video.clientWidth > 0 && video.clientHeight > 0) {
|
|
4880
|
+
const scale = Math.min(video.clientWidth / width, video.clientHeight / height) * (window.devicePixelRatio || 1);
|
|
4881
|
+
shownWidth = Math.round(width * scale);
|
|
4882
|
+
shownHeight = Math.round(height * scale);
|
|
4883
|
+
}
|
|
4884
|
+
let ahead = 0;
|
|
4885
|
+
for (let i = 0; i < el.buffered.length; i++) if (el.currentTime >= el.buffered.start(i) && el.currentTime <= el.buffered.end(i)) ahead = el.buffered.end(i) - el.currentTime;
|
|
4886
|
+
return {
|
|
4887
|
+
...stream,
|
|
4888
|
+
width,
|
|
4889
|
+
height,
|
|
4890
|
+
shownWidth,
|
|
4891
|
+
shownHeight,
|
|
4892
|
+
fps: fps !== null && fps > 0 ? fps : null,
|
|
4893
|
+
frames: quality ? quality.totalVideoFrames : null,
|
|
4894
|
+
dropped: quality ? quality.droppedVideoFrames : null,
|
|
4895
|
+
ahead,
|
|
4896
|
+
decodedBitrate
|
|
4897
|
+
};
|
|
4898
|
+
}
|
|
4899
|
+
/** A gain factor in decibels, signed: 2 is "+6 dB", 0.5 "−6 dB". */
|
|
4900
|
+
function decibels(gain) {
|
|
4901
|
+
const db = 20 * Math.log10(gain);
|
|
4902
|
+
const rounded = Math.round(db * 10) / 10;
|
|
4903
|
+
return `${rounded > 0 ? "+" : rounded < 0 ? "−" : ""}${format.decimal(Math.abs(rounded))}${"\xA0"}dB`;
|
|
4904
|
+
}
|
|
4905
|
+
/** The panel's lines for what was measured, in the order a person asks: what the picture is, whether it plays smoothly, what it costs. Figures not known are left out. */
|
|
4906
|
+
function mediaStatRows(stats, { gain } = {}) {
|
|
4907
|
+
const rows = [];
|
|
4908
|
+
const size = (w, h) => `${w}${"\xA0"}×${"\xA0"}${h}`;
|
|
4909
|
+
if (stats.width && stats.height) rows.push({
|
|
4910
|
+
label: "Resolution",
|
|
4911
|
+
value: size(stats.width, stats.height)
|
|
4912
|
+
});
|
|
4913
|
+
if (stats.shownWidth && stats.shownHeight) rows.push({
|
|
4914
|
+
label: "Shown at",
|
|
4915
|
+
value: size(stats.shownWidth, stats.shownHeight)
|
|
4916
|
+
});
|
|
4917
|
+
if (stats.fps !== null) rows.push({
|
|
4918
|
+
label: "Frame rate",
|
|
4919
|
+
value: format.withUnit(stats.fps, "fps", format.decimal),
|
|
4920
|
+
live: true
|
|
4921
|
+
});
|
|
4922
|
+
if (stats.frames !== null && stats.dropped !== null && stats.frames > 0) rows.push({
|
|
4923
|
+
label: "Dropped frames",
|
|
4924
|
+
value: `${format.integer(stats.dropped)} of ${format.integer(stats.frames)}`,
|
|
4925
|
+
live: true
|
|
4926
|
+
});
|
|
4927
|
+
const codecs = [stats.videoCodec, stats.audioCodec].filter(Boolean).join(", ");
|
|
4928
|
+
if (codecs) rows.push({
|
|
4929
|
+
label: "Codecs",
|
|
4930
|
+
value: codecs
|
|
4931
|
+
});
|
|
4932
|
+
const average = stats.loaded && stats.loadedSeconds && stats.loadedSeconds > 0 ? stats.loaded * 8 / stats.loadedSeconds : null;
|
|
4933
|
+
const bitrate = stats.decodedBitrate ?? stats.bitrate ?? average;
|
|
4934
|
+
if (bitrate) rows.push({
|
|
4935
|
+
label: "Bitrate",
|
|
4936
|
+
value: format.bitrate(bitrate),
|
|
4937
|
+
live: true
|
|
4938
|
+
});
|
|
4939
|
+
if (stats.bandwidth) rows.push({
|
|
4940
|
+
label: "Connection",
|
|
4941
|
+
value: format.bitrate(stats.bandwidth),
|
|
4942
|
+
live: true
|
|
4943
|
+
});
|
|
4944
|
+
rows.push({
|
|
4945
|
+
label: "Buffer",
|
|
4946
|
+
value: `${format.duration(stats.ahead)} ahead`,
|
|
4947
|
+
live: true
|
|
4948
|
+
});
|
|
4949
|
+
if (stats.loaded) rows.push({
|
|
4950
|
+
label: "Fetched",
|
|
4951
|
+
value: format.bytes(stats.loaded),
|
|
4952
|
+
live: true
|
|
4953
|
+
});
|
|
4954
|
+
if (gain != null && gain > 0 && gain !== 1) rows.push({
|
|
4955
|
+
label: "Sound gain",
|
|
4956
|
+
value: decibels(gain)
|
|
4957
|
+
});
|
|
4958
|
+
return rows;
|
|
4959
|
+
}
|
|
4960
|
+
/** The panel over the picture: what was measured, then the app's own lines. Measures only while it is there to be seen. */
|
|
4961
|
+
function MediaStatsPanel({ media, stream, gain, extra = [], shown, className }) {
|
|
4962
|
+
const rows = [...mediaStatRows(useMediaStats(media, {
|
|
4963
|
+
enabled: shown,
|
|
4964
|
+
stream
|
|
4965
|
+
}), { gain }), ...extra];
|
|
4966
|
+
return /* @__PURE__ */ jsx("dl", {
|
|
4967
|
+
"aria-label": "Playback stats",
|
|
4968
|
+
"data-shown": shown || void 0,
|
|
4969
|
+
className: cn("picture-panel pointer-events-none grid max-w-80 gap-0.5 rounded-surface px-3 py-2 type-caption tabular-nums transition-state", shown ? "opacity-100" : "opacity-0", className),
|
|
4970
|
+
children: rows.map((r) => /* @__PURE__ */ jsxs("div", {
|
|
4971
|
+
"data-live": r.live || void 0,
|
|
4972
|
+
className: "flex gap-3",
|
|
4973
|
+
children: [/* @__PURE__ */ jsx("dt", {
|
|
4974
|
+
className: "w-24 shrink-0 opacity-75",
|
|
4975
|
+
children: r.label
|
|
4976
|
+
}), /* @__PURE__ */ jsx("dd", {
|
|
4977
|
+
className: "min-w-0 break-words",
|
|
4978
|
+
children: r.value
|
|
4979
|
+
})]
|
|
4980
|
+
}, r.label))
|
|
4981
|
+
});
|
|
4982
|
+
}
|
|
4983
|
+
|
|
4814
4984
|
// src/components/media-player.tsx
|
|
4815
4985
|
/** The most the volume goes to: a boost where Web Audio can play it, else 100. */
|
|
4816
4986
|
function maxVolumeOf(boost, el) {
|
|
@@ -5232,12 +5402,14 @@ function useMediaElement(ref, options = {}) {
|
|
|
5232
5402
|
* Use it for a plain `<video>` the app owns, with `useMediaElement`; `MediaPlayer` does it for `attach`.
|
|
5233
5403
|
* Returns `reload`, for the player's Try again (`useMediaElement`'s `onRetry`), and gives the engine's failures to `onProblem` (`reportProblem`).
|
|
5234
5404
|
*/
|
|
5235
|
-
function useAttachedSource(ref, src, attach, onProblem, growing, start) {
|
|
5405
|
+
function useAttachedSource(ref, src, attach, onProblem, growing, start, onStats) {
|
|
5236
5406
|
const hold = React.useRef(null);
|
|
5237
5407
|
const problem = React.useRef(onProblem);
|
|
5238
5408
|
problem.current = onProblem;
|
|
5239
5409
|
const grows = React.useRef(growing);
|
|
5240
5410
|
grows.current = growing;
|
|
5411
|
+
const stats = React.useRef(onStats);
|
|
5412
|
+
stats.current = onStats;
|
|
5241
5413
|
const first = React.useRef({
|
|
5242
5414
|
src: void 0,
|
|
5243
5415
|
start
|
|
@@ -5258,7 +5430,8 @@ function useAttachedSource(ref, src, attach, onProblem, growing, start) {
|
|
|
5258
5430
|
attachment: attach(el, src, {
|
|
5259
5431
|
startAt: begin ?? 0,
|
|
5260
5432
|
onProblem: (m) => problem.current?.(m),
|
|
5261
|
-
growing: grows.current
|
|
5433
|
+
growing: grows.current,
|
|
5434
|
+
onStats: (s) => stats.current?.(s)
|
|
5262
5435
|
})
|
|
5263
5436
|
};
|
|
5264
5437
|
});
|
|
@@ -5299,7 +5472,7 @@ function useCoarsePointer() {
|
|
|
5299
5472
|
* a touch device), with the failure to load shown and retried. For an editor or a replay, use the
|
|
5300
5473
|
* parts and `useMediaElement` directly.
|
|
5301
5474
|
*/
|
|
5302
|
-
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, gain, boost, crossOrigin, aspect, fullscreen = true, skip = {}, fps, float = false, className }) {
|
|
5475
|
+
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, gain, boost, crossOrigin, aspect, fullscreen = true, skip = {}, fps, float = false, stats = false, className }) {
|
|
5303
5476
|
const list = React.useMemo(() => sources ?? (src ? [{
|
|
5304
5477
|
src,
|
|
5305
5478
|
title: label
|
|
@@ -5333,7 +5506,18 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
5333
5506
|
boost
|
|
5334
5507
|
});
|
|
5335
5508
|
React.useEffect(() => void (sourceIndex.current = index), [index]);
|
|
5336
|
-
|
|
5509
|
+
const engineStats = React.useRef({});
|
|
5510
|
+
const onStats = React.useCallback((s) => void (engineStats.current = {
|
|
5511
|
+
...engineStats.current,
|
|
5512
|
+
...s
|
|
5513
|
+
}), []);
|
|
5514
|
+
const statsSrc = React.useRef(current?.src);
|
|
5515
|
+
if (statsSrc.current !== current?.src) {
|
|
5516
|
+
statsSrc.current = current?.src;
|
|
5517
|
+
engineStats.current = {};
|
|
5518
|
+
}
|
|
5519
|
+
const readEngineStats = React.useCallback(() => engineStats.current, []);
|
|
5520
|
+
stream.current = useAttachedSource(ref, current?.src, attach, media.reportProblem, growing !== void 0, start, onStats);
|
|
5337
5521
|
const coarse = useCoarsePointer();
|
|
5338
5522
|
const native = controls === "native" || controls === "auto" && coarse;
|
|
5339
5523
|
const go = React.useCallback((to) => {
|
|
@@ -5725,7 +5909,7 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
5725
5909
|
const element = kind === "video" ? /* @__PURE__ */ jsxs("div", {
|
|
5726
5910
|
ref: stage,
|
|
5727
5911
|
tabIndex: -1,
|
|
5728
|
-
className: cn("relative w-full overflow-hidden rounded-surface bg-surface-sunken outline-none", full && "min-h-0 flex-1"),
|
|
5912
|
+
className: cn("@container relative w-full overflow-hidden rounded-surface bg-surface-sunken outline-none", full && "min-h-0 flex-1"),
|
|
5729
5913
|
style: full ? void 0 : { aspectRatio: aspect ?? natural ?? 16 / 9 },
|
|
5730
5914
|
children: [
|
|
5731
5915
|
/* @__PURE__ */ jsx("video", {
|
|
@@ -5740,6 +5924,14 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
5740
5924
|
heading,
|
|
5741
5925
|
shown: !idle
|
|
5742
5926
|
}),
|
|
5927
|
+
stats !== false && !floating && /* @__PURE__ */ jsx(MediaStatsPanel, {
|
|
5928
|
+
media: ref,
|
|
5929
|
+
stream: readEngineStats,
|
|
5930
|
+
gain,
|
|
5931
|
+
extra: stats === true ? void 0 : stats,
|
|
5932
|
+
shown: !idle,
|
|
5933
|
+
className: cn("absolute right-3 hidden @lg:grid", heading ? "top-16" : "top-3")
|
|
5934
|
+
}),
|
|
5743
5935
|
(overlay || showActions) && /* @__PURE__ */ jsxs("div", {
|
|
5744
5936
|
className: "pointer-events-none absolute inset-0 [&>*]:pointer-events-auto",
|
|
5745
5937
|
children: [overlay?.(media), showActions && /* @__PURE__ */ jsx(SpanActions, {
|
|
@@ -12923,7 +13115,7 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
12923
13115
|
"data-piece": key,
|
|
12924
13116
|
onPointerDownCapture: press(key),
|
|
12925
13117
|
onDragStart: (e) => e.preventDefault(),
|
|
12926
|
-
className: cn("grid min-w-0", !locked && "touch-none", drag?.key === key && "opacity-30"),
|
|
13118
|
+
className: cn("grid min-w-0 items-start", !locked && "touch-none", drag?.key === key && "opacity-30"),
|
|
12927
13119
|
children: control
|
|
12928
13120
|
}, key);
|
|
12929
13121
|
};
|
|
@@ -12947,13 +13139,13 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
12947
13139
|
const swap = (out) => out === void 0 ? "" : ` in place of ${pieceLabel(out)}`;
|
|
12948
13140
|
return /* @__PURE__ */ jsxs("section", {
|
|
12949
13141
|
"aria-label": label,
|
|
12950
|
-
className: cn("grid min-w-0 gap-6", className),
|
|
13142
|
+
className: cn("grid min-w-0 items-start gap-6", className),
|
|
12951
13143
|
children: [
|
|
12952
13144
|
/* @__PURE__ */ jsx("div", {
|
|
12953
13145
|
ref: zone(PILE),
|
|
12954
13146
|
role: "group",
|
|
12955
13147
|
"aria-label": pileLabel,
|
|
12956
|
-
className: cn("grid min-w-0 gap-2 rounded-overlay transition-state", target(drag?.over === PILE && heldAt !== null)),
|
|
13148
|
+
className: cn("grid min-w-0 items-start gap-2 rounded-overlay transition-state", target(drag?.over === PILE && heldAt !== null)),
|
|
12957
13149
|
style: columns(pieceSide, fill),
|
|
12958
13150
|
children: pieces.map(slot)
|
|
12959
13151
|
}),
|
|
@@ -12969,7 +13161,7 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
12969
13161
|
return /* @__PURE__ */ jsxs("div", {
|
|
12970
13162
|
ref: zone(key),
|
|
12971
13163
|
"data-place": state,
|
|
12972
|
-
className: cn("grid min-w-0 content-start gap-2 rounded-overlay border-2 border-dashed border-input p-2 transition-state", takes && "border-solid border-info ring-4 ring-info", takes && target(drag?.over === key), state === "right" && "border-solid border-success bg-success-subtle ring-2 ring-success", state === "wrong" && "border-solid border-muted-foreground"),
|
|
13164
|
+
className: cn("grid min-w-0 content-start items-start gap-2 rounded-overlay border-2 border-dashed border-input p-2 transition-state", takes && "border-solid border-info ring-4 ring-info", takes && target(drag?.over === key), state === "right" && "border-solid border-success bg-success-subtle ring-2 ring-success", state === "wrong" && "border-solid border-muted-foreground"),
|
|
12973
13165
|
children: [/* @__PURE__ */ jsxs(Button$1, {
|
|
12974
13166
|
isDisabled: !takes || only !== void 0,
|
|
12975
13167
|
onPress: () => move(key),
|
|
@@ -12987,7 +13179,7 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
12987
13179
|
}), /* @__PURE__ */ jsxs("div", {
|
|
12988
13180
|
role: inside.length > 0 ? "group" : void 0,
|
|
12989
13181
|
"aria-label": inside.length > 0 ? `In ${name}` : void 0,
|
|
12990
|
-
className: "grid min-w-0 gap-2",
|
|
13182
|
+
className: "grid min-w-0 items-start gap-2",
|
|
12991
13183
|
style: columns(placedSide, "auto-fill"),
|
|
12992
13184
|
children: [inside.map((p) => piece(p, true)), Array.from({ length: Math.max(0, room(s) - inside.length) }, (_, i) => /* @__PURE__ */ jsx("div", {
|
|
12993
13185
|
"aria-hidden": true,
|
|
@@ -15356,6 +15548,26 @@ function SayAgain({ text, parts, verb = "Say", className, ...options }) {
|
|
|
15356
15548
|
className
|
|
15357
15549
|
});
|
|
15358
15550
|
}
|
|
15551
|
+
/** A picture that says one sentence when pressed (the big speaker over a listening round), from its recordings when given; just the picture where nothing can be heard or it is muted. */
|
|
15552
|
+
function SayPicture({ text, parts, verb = "Say", className, children, ...options }) {
|
|
15553
|
+
const clips = useClips();
|
|
15554
|
+
const { say, speaking } = useSpeech({
|
|
15555
|
+
...options,
|
|
15556
|
+
lang: options.lang ?? clips.lang
|
|
15557
|
+
});
|
|
15558
|
+
const saying = parts?.length ? parts : clips.parts(text);
|
|
15559
|
+
if (options.muted || !canSay(saying)) return /* @__PURE__ */ jsx("div", {
|
|
15560
|
+
className,
|
|
15561
|
+
children
|
|
15562
|
+
});
|
|
15563
|
+
return /* @__PURE__ */ jsx(Button$1, {
|
|
15564
|
+
"aria-label": `${verb}: ${text}`,
|
|
15565
|
+
"aria-pressed": speaking || void 0,
|
|
15566
|
+
onPress: () => say(saying),
|
|
15567
|
+
className: cn("cursor-pointer rounded-surface transition-state press", className),
|
|
15568
|
+
children
|
|
15569
|
+
});
|
|
15570
|
+
}
|
|
15359
15571
|
|
|
15360
15572
|
// src/lib/recording.ts
|
|
15361
15573
|
/** The quietest level a speech meter draws, in dBFS: below it is silence for speech. */
|
|
@@ -21865,5 +22077,5 @@ function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose
|
|
|
21865
22077
|
});
|
|
21866
22078
|
}
|
|
21867
22079
|
|
|
21868
|
-
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, EditListPlayer, EmptyState, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, 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, TimelinePlayer, 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, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, ease, editTimeOf, editTimes, encodeWav, errorPayload, explainMicrophoneError, fetchJson, fieldErrorsOf, findPage, fitRect, followAim, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, inkMatch, inputLevelThresholds, isDoubtful, isRefusal, isReservedChord, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, moveGutter, moveRect, nextBreak, 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, useCountdown, useDifference, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useRebindableShortcuts, useRecorder, useReserve, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
|
|
22080
|
+
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, EditListPlayer, EmptyState, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, 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, SayPicture, 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, TimelinePlayer, 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, continues, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, ease, editTimeOf, editTimes, encodeWav, errorPayload, explainMicrophoneError, fetchJson, fieldErrorsOf, findPage, fitRect, followAim, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, inkMatch, inputLevelThresholds, isDoubtful, isRefusal, isReservedChord, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, moveGutter, moveRect, nextBreak, 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, useCountdown, useDifference, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useRebindableShortcuts, useRecorder, useReserve, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
|
|
21869
22081
|
//# sourceMappingURL=index.js.map
|