strata-react 1.1.0 → 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 +17 -2
- package/UPGRADING.md +10 -0
- package/bin/strata-api-types.js +5 -0
- package/dist/api-types/cli.d.ts +2 -0
- package/dist/api-types/generate.d.ts +9 -0
- package/dist/api-types/index.d.ts +1 -0
- package/dist/api-types-cli.js +67 -0
- package/dist/api-types-cli.js.map +1 -0
- package/dist/api-types.js +1 -0
- package/dist/components/fullscreen-frame.d.ts +3 -1
- package/dist/components/media-player.d.ts +3 -1
- package/dist/{errors-BXSbhx2s.js → errors-Dt--eHgK.js} +18 -4
- package/dist/{errors-BXSbhx2s.js.map → errors-Dt--eHgK.js.map} +1 -1
- package/dist/generate-DCRYZPJs.js +46 -0
- package/dist/generate-DCRYZPJs.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +260 -188
- package/dist/index.js.map +1 -1
- package/dist/lib/errors.d.ts +6 -0
- package/dist/panorama.js +1 -1
- package/dist/query/index.d.ts +4 -4
- package/dist/query/infinite.d.ts +16 -3
- package/dist/query/job.d.ts +4 -0
- package/dist/{query-V0TFPCcC.js → query-CgE9YsRk.js} +2 -2
- package/dist/{query-V0TFPCcC.js.map → query-CgE9YsRk.js.map} +1 -1
- package/dist/testing.js +1 -1
- package/dist/{value-controls-VNFdKanU.js → value-controls-miuzPdJZ.js} +12 -3
- package/dist/value-controls-miuzPdJZ.js.map +1 -0
- package/package.json +18 -2
- package/dist/value-controls-VNFdKanU.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
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-
|
|
4
|
-
import { a as
|
|
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-
|
|
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
|
+
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
|
+
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";
|
|
7
7
|
import { a as useColorScheme, i as colorSchemeScript, n as ColorSchemeChoice, o as useSystemColorScheme, r as ThemeProvider, s as Density, t as COLOR_SCHEME_STORAGE_KEY } from "./theme-DVaIxyNn.js";
|
|
8
8
|
import * as React from "react";
|
|
@@ -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
|
|
@@ -10346,7 +10455,7 @@ function ActiveList({ label, active, empty, children, className }) {
|
|
|
10346
10455
|
}
|
|
10347
10456
|
// src/query/infinite.ts
|
|
10348
10457
|
/** `useInfiniteQuery` for cursor-paged data, returned as an `InfiniteLoad<T>` for `InfiniteList` (or `DataView`). */
|
|
10349
|
-
function useInfiniteLoad({ queryKey, queryFn, items, itemKey, hasMore, cursorAfter = itemKey, isRemoved, describeError = describeHttpError, enabled, staleTime }) {
|
|
10458
|
+
function useInfiniteLoad({ queryKey, queryFn, items, itemKey, hasMore = () => false, nextCursor, cursorAfter = itemKey, isRemoved, describeError = describeHttpError, enabled, staleTime }) {
|
|
10350
10459
|
const queryHash = hashKey(queryKey);
|
|
10351
10460
|
const [stored, setStored] = React.useState(() => ({
|
|
10352
10461
|
query: queryHash,
|
|
@@ -10359,14 +10468,16 @@ function useInfiniteLoad({ queryKey, queryFn, items, itemKey, hasMore, cursorAft
|
|
|
10359
10468
|
items,
|
|
10360
10469
|
itemKey,
|
|
10361
10470
|
hasMore,
|
|
10362
|
-
cursorAfter
|
|
10471
|
+
cursorAfter,
|
|
10472
|
+
nextCursor
|
|
10363
10473
|
});
|
|
10364
10474
|
latest.current = {
|
|
10365
10475
|
hidden,
|
|
10366
10476
|
items,
|
|
10367
10477
|
itemKey,
|
|
10368
10478
|
hasMore,
|
|
10369
|
-
cursorAfter
|
|
10479
|
+
cursorAfter,
|
|
10480
|
+
nextCursor
|
|
10370
10481
|
};
|
|
10371
10482
|
const query = useInfiniteQuery({
|
|
10372
10483
|
queryKey,
|
|
@@ -10377,6 +10488,10 @@ function useInfiniteLoad({ queryKey, queryFn, items, itemKey, hasMore, cursorAft
|
|
|
10377
10488
|
initialPageParam: { cursor: void 0 },
|
|
10378
10489
|
getNextPageParam: (lastPage, pages) => {
|
|
10379
10490
|
const l = latest.current;
|
|
10491
|
+
if (l.nextCursor) {
|
|
10492
|
+
const next = l.nextCursor(lastPage);
|
|
10493
|
+
return next === null ? null : { cursor: next };
|
|
10494
|
+
}
|
|
10380
10495
|
if (!l.hasMore(lastPage)) return null;
|
|
10381
10496
|
const after = nextAfter(pages, l.items, l.itemKey, l.hidden);
|
|
10382
10497
|
return { cursor: after === void 0 ? void 0 : l.cursorAfter(after) };
|
|
@@ -10464,6 +10579,13 @@ function nextAfter(pages, items, itemKey, hidden) {
|
|
|
10464
10579
|
if (held.length === 0 || pages.length > 1 && !lastPageAddedAny) return last;
|
|
10465
10580
|
return held[held.length - 1];
|
|
10466
10581
|
}
|
|
10582
|
+
/** `useInfiniteLoad`'s `items` and `nextCursor` for the shared `Page<T>` shape: `useInfiniteLoad({ queryKey, queryFn, itemKey, ...apiPage<Item>() })`. */
|
|
10583
|
+
function apiPage() {
|
|
10584
|
+
return {
|
|
10585
|
+
items: (page) => page.items,
|
|
10586
|
+
nextCursor: (page) => page.next
|
|
10587
|
+
};
|
|
10588
|
+
}
|
|
10467
10589
|
// src/query/job.ts
|
|
10468
10590
|
/** A long-running job's status: polled every `every` ms while `isRunning`, with the `invalidates` queries read again once when it ends. */
|
|
10469
10591
|
function useJob({ isRunning, every = 2e3, invalidates = [], describeError, ...options }) {
|
|
@@ -10494,59 +10616,9 @@ function useJob({ isRunning, every = 2e3, invalidates = [], describeError, ...op
|
|
|
10494
10616
|
poll
|
|
10495
10617
|
};
|
|
10496
10618
|
}
|
|
10497
|
-
|
|
10498
|
-
|
|
10499
|
-
|
|
10500
|
-
return typeof document !== "undefined" && document.fullscreenEnabled === true && typeof Element.prototype.requestFullscreen === "function";
|
|
10501
|
-
}
|
|
10502
|
-
/** Shows its children full screen while `active`: the browser's Fullscreen API where there is one, a window-filling modal where there is not. */
|
|
10503
|
-
function FullscreenFrame({ label, active, onActiveChange, children, className }) {
|
|
10504
|
-
const ref = React.useRef(null);
|
|
10505
|
-
const [native, setNative] = React.useState(false);
|
|
10506
|
-
const [refused, setRefused] = React.useState(false);
|
|
10507
|
-
const change = React.useRef(onActiveChange);
|
|
10508
|
-
change.current = onActiveChange;
|
|
10509
|
-
React.useEffect(() => {
|
|
10510
|
-
const el = ref.current;
|
|
10511
|
-
if (!active) {
|
|
10512
|
-
setNative(false);
|
|
10513
|
-
setRefused(false);
|
|
10514
|
-
if (document.fullscreenElement && document.fullscreenElement === el) document.exitFullscreen();
|
|
10515
|
-
return;
|
|
10516
|
-
}
|
|
10517
|
-
if (!el || !canFullscreen()) return;
|
|
10518
|
-
let cancelled = false;
|
|
10519
|
-
el.requestFullscreen().then(() => !cancelled && setNative(true), () => !cancelled && setRefused(true));
|
|
10520
|
-
const onChange = () => {
|
|
10521
|
-
if (document.fullscreenElement !== el && !cancelled) change.current(false);
|
|
10522
|
-
};
|
|
10523
|
-
document.addEventListener("fullscreenchange", onChange);
|
|
10524
|
-
return () => {
|
|
10525
|
-
cancelled = true;
|
|
10526
|
-
document.removeEventListener("fullscreenchange", onChange);
|
|
10527
|
-
};
|
|
10528
|
-
}, [active]);
|
|
10529
|
-
const modal = active && !native && (!canFullscreen() || refused);
|
|
10530
|
-
const inner = /* @__PURE__ */ jsx("div", {
|
|
10531
|
-
ref,
|
|
10532
|
-
className: cn(active && "flex h-full min-h-0 flex-col bg-background p-4", className),
|
|
10533
|
-
children
|
|
10534
|
-
});
|
|
10535
|
-
if (!modal) return inner;
|
|
10536
|
-
return /* @__PURE__ */ jsx(ModalOverlay, {
|
|
10537
|
-
isOpen: true,
|
|
10538
|
-
onOpenChange: (o) => !o && onActiveChange(false),
|
|
10539
|
-
isDismissable: true,
|
|
10540
|
-
className: "layer-overlay fixed inset-0 scrim",
|
|
10541
|
-
children: /* @__PURE__ */ jsx(Modal, {
|
|
10542
|
-
className: cn("h-full w-full outline-none", overlaySurface, "rounded-none"),
|
|
10543
|
-
children: /* @__PURE__ */ jsx(Dialog$1, {
|
|
10544
|
-
"aria-label": label,
|
|
10545
|
-
className: "h-full outline-none",
|
|
10546
|
-
children: inner
|
|
10547
|
-
})
|
|
10548
|
-
})
|
|
10549
|
-
});
|
|
10619
|
+
/** Whether a task of the shared contract (`strata_python.contracts.Task`) is still going: its `state` is not one of the finished ones. Pass the generated `FINISHED`; for `useJob({ isRunning: (t) => isTaskRunning(t, FINISHED) })`. */
|
|
10620
|
+
function isTaskRunning(task, finished) {
|
|
10621
|
+
return !(Array.isArray(finished) ? finished.includes(task.state) : finished.has(task.state));
|
|
10550
10622
|
}
|
|
10551
10623
|
// src/lib/image-diff.ts
|
|
10552
10624
|
/** The longest side, in pixels, a picture is compared at. */
|
|
@@ -16167,6 +16239,6 @@ function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose
|
|
|
16167
16239
|
]
|
|
16168
16240
|
});
|
|
16169
16241
|
}
|
|
16170
|
-
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, Breadcrumb, BulkBar, Button, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGroup, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, ContextMenu, Conversation, CursorScope, DEFAULT_TOLERANCE, DataTable, DataView, Density, Dialog, Disclosure, Done, EmptyState, FIT, Field, FileButton, FileDropZone, FileOutcomes, FolderPicker, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, Inspector, InspectorSection, JobStatus, KeysLegend, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MissingFile, NBSP, NativeSelect, NumberField, PageHeader, PairJudge, PairVote, Pane, PlayWindowButton, Popover, PropertyList, PropertyRow, RateChoice, RegionEditor, RichText, RowAction, SPEECH_RATES, SaveStatus, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, SideNav, Skeleton, Slider, SortableList, SpanActions, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, TableSkeleton, Tabs, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, Workspace, actualPixelsScale, ancestorsOf, boxViewport, buttonVariants, canFullscreen, clampToRoom, clampViewport, cn, colorSchemeScript, commandShortcut, countMarks, createFormat, createQueryClient, crossedThreshold, describeActionError, describeHttpError, describeRegion, detectPlatform, diffWords, differences, drawRect, ease, fetchJson, fieldErrorsOf, findPage, fitRect, format, formatChord, gainToVolume, geo, gridPoints, gutterOf, isDoubtful, isReservedChord, isTypingTarget, jobProgressText, joinMediaGroup, joinRects, labelOf, lerpRect, logScale, loudnessOf, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, moveGutter, moveRect, noOverlap, normaliseAngle, pageName, parentOf, parseChord, parseInline, parseRichText, parseSort, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, plainText, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, resample, resamplePeaks, resizeRect, safeHref, sayPosition, serialiseSort, settleCut, snapToGrid, sortRows, splitRect, staleOf, stepId, stepOnGrid, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useColorScheme, useCommands, useDifference, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useSelection, useSharedCursor, useSystemColorScheme, useTimelineZoom, useUndoable, useViewOptions, useViewport, useWorkspaceState, valueAt, viewOf, viewsOf, wordAt, wordId, zoomAt, zoomToBox };
|
|
16242
|
+
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, Breadcrumb, BulkBar, Button, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGroup, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, ContextMenu, Conversation, CursorScope, DEFAULT_TOLERANCE, DataTable, DataView, Density, Dialog, Disclosure, Done, EmptyState, FIT, Field, FileButton, FileDropZone, FileOutcomes, FolderPicker, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, Inspector, InspectorSection, JobStatus, KeysLegend, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MissingFile, NBSP, NativeSelect, NumberField, PageHeader, PairJudge, PairVote, Pane, PlayWindowButton, Popover, PropertyList, PropertyRow, RateChoice, RegionEditor, RichText, RowAction, SPEECH_RATES, SaveStatus, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, SideNav, Skeleton, Slider, SortableList, SpanActions, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, TableSkeleton, Tabs, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, Workspace, actualPixelsScale, ancestorsOf, apiPage, boxViewport, buttonVariants, canFullscreen, clampToRoom, clampViewport, cn, colorSchemeScript, commandShortcut, countMarks, createFormat, createQueryClient, crossedThreshold, describeActionError, describeHttpError, describeRegion, detectPlatform, diffWords, differences, drawRect, ease, errorPayload, fetchJson, fieldErrorsOf, findPage, fitRect, format, formatChord, gainToVolume, geo, gridPoints, gutterOf, isDoubtful, isReservedChord, isTaskRunning, isTypingTarget, jobProgressText, joinMediaGroup, joinRects, labelOf, lerpRect, logScale, loudnessOf, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, moveGutter, moveRect, noOverlap, normaliseAngle, pageName, parentOf, parseChord, parseInline, parseRichText, parseSort, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, plainText, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, resample, resamplePeaks, resizeRect, safeHref, sayPosition, serialiseSort, settleCut, snapToGrid, sortRows, splitRect, staleOf, stepId, stepOnGrid, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useColorScheme, useCommands, useDifference, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useSelection, useSharedCursor, useSystemColorScheme, useTimelineZoom, useUndoable, useViewOptions, useViewport, useWorkspaceState, valueAt, viewOf, viewsOf, wordAt, wordId, zoomAt, zoomToBox };
|
|
16171
16243
|
|
|
16172
16244
|
//# sourceMappingURL=index.js.map
|