strata-react 1.1.3 → 1.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 +1 -0
- package/UPGRADING.md +3 -0
- package/dist/components/choice-grid.d.ts +33 -0
- package/dist/components/media-player.d.ts +6 -1
- package/dist/components/player-warning.d.ts +24 -0
- package/dist/{errors-Dt--eHgK.js → errors-DqezYZgy.js} +2 -2
- package/dist/{errors-Dt--eHgK.js.map → errors-DqezYZgy.js.map} +1 -1
- package/dist/{field-DeKNvGox.js → field-CTd1l3md.js} +3 -2
- package/dist/field-CTd1l3md.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +248 -107
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/map.js +2 -2
- package/dist/panorama.js +2 -2
- package/dist/{query-CgE9YsRk.js → query-CgoGqE0T.js} +3 -3
- package/dist/{query-CgE9YsRk.js.map → query-CgoGqE0T.js.map} +1 -1
- package/dist/strata.css +20 -0
- package/dist/strata.migrate.css +20 -0
- package/dist/testing.js +2 -2
- package/dist/{theme-DVaIxyNn.js → theme-DB0Km2m2.js} +2 -2
- package/dist/{theme-DVaIxyNn.js.map → theme-DB0Km2m2.js.map} +1 -1
- package/dist/{value-controls-miuzPdJZ.js → value-controls-CiwdvJeH.js} +3 -3
- package/dist/{value-controls-miuzPdJZ.js.map → value-controls-CiwdvJeH.js.map} +1 -1
- package/package.json +1 -1
- package/dist/field-DeKNvGox.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-
|
|
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-CTd1l3md.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 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-
|
|
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-CiwdvJeH.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-DqezYZgy.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-CgoGqE0T.js";
|
|
6
6
|
import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-DDGBPiTJ.js";
|
|
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-
|
|
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-DB0Km2m2.js";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { Autocomplete, Button as Button$1, Cell, Checkbox as Checkbox$1, Collection, Column, Dialog as Dialog$1, DialogTrigger, Disclosure as Disclosure$1, DisclosurePanel, DropIndicator, DropZone, FileTrigger, GridLayout, GridList, GridListItem, Header, Heading, Input as Input$1, Keyboard, ListBox, ListBoxItem, ListLayout, ListStateContext, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal, ModalOverlay, Popover as Popover$1, RouterProvider, Row, SearchField, Separator, Slider as Slider$1, SliderThumb, SliderTrack, SubmenuTrigger, Switch as Switch$1, Tab, TabList, TabPanel, Table, TableBody, TableHeader, TableLayout, Tabs as Tabs$1, Text, ToggleButton, ToggleButtonGroup, Tree as Tree$1, TreeItem, TreeItemContent, Virtualizer, useDragAndDrop, useFilter } from "react-aria-components";
|
|
10
10
|
import { ArrowDown, ArrowUp, ArrowUpDown, ArrowUpRight, Ban, Check, ChevronDown, ChevronLeft, ChevronRight, CircleAlert, CircleCheck, Columns2, Ellipsis, Eye, EyeOff, FileQuestion, Flag, Folder, FolderOpen, GripVertical, History, ImageOff, Info, KeyRound, LayoutGrid, List, Loader, LoaderCircle, Lock, Maximize, Maximize2, Minimize, Minus, PanelBottomClose, PanelBottomOpen, PanelLeftClose, PanelLeftOpen, PanelRightClose, PanelRightOpen, PanelTopClose, PanelTopOpen, Pause, Pencil, Play, Redo2, RotateCcw, RotateCw, Scan, Search, Send, SkipBack, SkipForward, SlidersHorizontal, Square, StepBack, StepForward, Trash2, TriangleAlert, Undo2, Upload, Volume2, VolumeX, X, ZoomIn, ZoomOut } from "lucide-react";
|
|
@@ -1459,6 +1459,81 @@ function Alert({ tone, title, children, action, announce = false, className }) {
|
|
|
1459
1459
|
]
|
|
1460
1460
|
});
|
|
1461
1461
|
}
|
|
1462
|
+
// src/components/player-warning.tsx
|
|
1463
|
+
/** Creates a warning channel for one player. Pass `warning` to MediaPlayer and call `warn` when a warning occurs. */
|
|
1464
|
+
function usePlayerWarnings() {
|
|
1465
|
+
const [warning, setWarning] = React.useState();
|
|
1466
|
+
const next = React.useRef(0);
|
|
1467
|
+
return {
|
|
1468
|
+
warning,
|
|
1469
|
+
warn: React.useCallback((message) => setWarning({
|
|
1470
|
+
...message,
|
|
1471
|
+
key: ++next.current
|
|
1472
|
+
}), [])
|
|
1473
|
+
};
|
|
1474
|
+
}
|
|
1475
|
+
function PlayerWarningToast({ warning }) {
|
|
1476
|
+
const [phase, setPhase] = React.useState("visible");
|
|
1477
|
+
const titleId = React.useId();
|
|
1478
|
+
const delay = toastTimeout(warning);
|
|
1479
|
+
const dismiss = () => setPhase("leaving");
|
|
1480
|
+
React.useEffect(() => {
|
|
1481
|
+
if (phase !== "visible") return;
|
|
1482
|
+
const id = setTimeout(() => setPhase("leaving"), delay);
|
|
1483
|
+
return () => clearTimeout(id);
|
|
1484
|
+
}, [delay, phase]);
|
|
1485
|
+
React.useEffect(() => {
|
|
1486
|
+
if (phase !== "leaving") return;
|
|
1487
|
+
const id = setTimeout(() => setPhase("gone"), 250);
|
|
1488
|
+
return () => clearTimeout(id);
|
|
1489
|
+
}, [phase]);
|
|
1490
|
+
if (phase === "gone") return null;
|
|
1491
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1492
|
+
className: cn("player-warning pointer-events-auto flex w-full max-w-sm items-start gap-3 p-3", overlaySurface),
|
|
1493
|
+
role: "group",
|
|
1494
|
+
"aria-labelledby": titleId,
|
|
1495
|
+
"data-leaving": phase === "leaving" || void 0,
|
|
1496
|
+
inert: phase === "leaving",
|
|
1497
|
+
onAnimationEnd: (event) => {
|
|
1498
|
+
if (event.target === event.currentTarget && phase === "leaving" && event.animationName === "strata-player-warning-out") setPhase("gone");
|
|
1499
|
+
},
|
|
1500
|
+
children: [
|
|
1501
|
+
/* @__PURE__ */ jsx(TriangleAlert, {
|
|
1502
|
+
"aria-hidden": true,
|
|
1503
|
+
className: "mt-0.5 size-4 shrink-0 text-warning"
|
|
1504
|
+
}),
|
|
1505
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1506
|
+
className: "grid min-w-0 flex-1 justify-items-start gap-2",
|
|
1507
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1508
|
+
role: "status",
|
|
1509
|
+
className: "grid min-w-0 gap-0.5",
|
|
1510
|
+
children: [/* @__PURE__ */ jsx("strong", {
|
|
1511
|
+
id: titleId,
|
|
1512
|
+
className: "type-label",
|
|
1513
|
+
children: warning.title
|
|
1514
|
+
}), warning.description && /* @__PURE__ */ jsx("span", {
|
|
1515
|
+
className: "type-body-sm text-muted-foreground",
|
|
1516
|
+
children: warning.description
|
|
1517
|
+
})]
|
|
1518
|
+
}), warning.action && /* @__PURE__ */ jsx(Button, {
|
|
1519
|
+
size: "sm",
|
|
1520
|
+
onPress: () => {
|
|
1521
|
+
warning.action?.onPress();
|
|
1522
|
+
dismiss();
|
|
1523
|
+
},
|
|
1524
|
+
children: warning.action.label
|
|
1525
|
+
})]
|
|
1526
|
+
}),
|
|
1527
|
+
/* @__PURE__ */ jsx(IconButton, {
|
|
1528
|
+
size: "sm",
|
|
1529
|
+
variant: "ghost",
|
|
1530
|
+
icon: X,
|
|
1531
|
+
label: "Dismiss playback warning",
|
|
1532
|
+
onPress: dismiss
|
|
1533
|
+
})
|
|
1534
|
+
]
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1462
1537
|
// src/lib/client-work.ts
|
|
1463
1538
|
/** Runs browser-side work with progress, cancel and a clear end state, ready for `JobStatus`. */
|
|
1464
1539
|
function useClientWork(run) {
|
|
@@ -3660,7 +3735,7 @@ function useCoarsePointer() {
|
|
|
3660
3735
|
* a touch device), with the failure to load shown and retried. For an editor or a replay, use the
|
|
3661
3736
|
* parts and `useMediaElement` directly.
|
|
3662
3737
|
*/
|
|
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 }) {
|
|
3738
|
+
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, status, warning, aspect, fullscreen = true, className }) {
|
|
3664
3739
|
const list = React.useMemo(() => sources ?? (src ? [{
|
|
3665
3740
|
src,
|
|
3666
3741
|
title: label
|
|
@@ -3989,6 +4064,10 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
3989
4064
|
...common,
|
|
3990
4065
|
className: native ? "w-full" : "hidden"
|
|
3991
4066
|
});
|
|
4067
|
+
const warningToast = warning && /* @__PURE__ */ jsx("div", {
|
|
4068
|
+
className: "pointer-events-none absolute inset-x-3 top-3 z-10 grid justify-items-end",
|
|
4069
|
+
children: /* @__PURE__ */ jsx(PlayerWarningToast, { warning }, warning.key)
|
|
4070
|
+
});
|
|
3992
4071
|
const what = kind === "video" ? "this video" : "this recording";
|
|
3993
4072
|
return /* @__PURE__ */ jsx(FullscreenFrame, {
|
|
3994
4073
|
label,
|
|
@@ -4003,9 +4082,10 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
4003
4082
|
onMouseMoveCapture: autoHideControls ? wakeControls : void 0,
|
|
4004
4083
|
onKeyDownCapture: autoHideControls ? wakeControls : void 0,
|
|
4005
4084
|
onPointerDownCapture: () => keyPlayers.use(id),
|
|
4006
|
-
className: cn("grid w-full gap-2", full && "flex h-full min-h-0 flex-col"),
|
|
4085
|
+
className: cn("relative grid w-full gap-2", full && "flex h-full min-h-0 flex-col"),
|
|
4007
4086
|
children: [
|
|
4008
4087
|
element,
|
|
4088
|
+
warningToast,
|
|
4009
4089
|
kind === "audio" && hasSpans && /* @__PURE__ */ jsx(SpanActions, {
|
|
4010
4090
|
state: spanState,
|
|
4011
4091
|
className: "flex flex-wrap items-center gap-2"
|
|
@@ -4028,114 +4108,120 @@ function MediaPlayer({ label, kind = "audio", src, sources, index: controlledInd
|
|
|
4028
4108
|
className: "type-body-sm text-muted-foreground",
|
|
4029
4109
|
children: media.error.message
|
|
4030
4110
|
}),
|
|
4031
|
-
growing && /* @__PURE__ */ jsxs("div", {
|
|
4032
|
-
className: "
|
|
4111
|
+
(growing || bound || !native || status) && /* @__PURE__ */ jsxs("div", {
|
|
4112
|
+
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"),
|
|
4033
4113
|
children: [
|
|
4034
|
-
/* @__PURE__ */
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4114
|
+
growing && /* @__PURE__ */ jsxs("div", {
|
|
4115
|
+
className: "flex flex-wrap items-center gap-x-3 gap-y-1",
|
|
4116
|
+
children: [
|
|
4117
|
+
/* @__PURE__ */ jsx(Status, {
|
|
4118
|
+
tone: "info",
|
|
4119
|
+
icon: LoaderCircle,
|
|
4120
|
+
children: "Still being made"
|
|
4121
|
+
}),
|
|
4122
|
+
growing.status && /* @__PURE__ */ jsx("span", {
|
|
4123
|
+
className: "type-body-sm text-muted-foreground",
|
|
4124
|
+
children: growing.status
|
|
4125
|
+
}),
|
|
4126
|
+
/* @__PURE__ */ jsx("span", {
|
|
4127
|
+
role: "status",
|
|
4128
|
+
className: "type-body-sm text-muted-foreground",
|
|
4129
|
+
children: media.waitingForMore ? "Waiting for more to be made. It will carry on by itself." : ""
|
|
4130
|
+
})
|
|
4131
|
+
]
|
|
4042
4132
|
}),
|
|
4043
|
-
/* @__PURE__ */
|
|
4133
|
+
bound && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("p", {
|
|
4134
|
+
className: "type-caption text-muted-foreground tabular-nums",
|
|
4135
|
+
children: [
|
|
4136
|
+
format.runningTime(bound.start),
|
|
4137
|
+
" to ",
|
|
4138
|
+
format.runningTime(bound.end),
|
|
4139
|
+
loop ? ", looping" : ""
|
|
4140
|
+
]
|
|
4141
|
+
}), /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx("span", {
|
|
4044
4142
|
role: "status",
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
time: bound.start,
|
|
4074
|
-
label: "Window starts"
|
|
4075
|
-
}, {
|
|
4076
|
-
time: bound.end,
|
|
4077
|
-
label: "Window ends"
|
|
4078
|
-
}] : offsets ? list.map((s, i) => ({
|
|
4079
|
-
time: offsets[i],
|
|
4080
|
-
label: s.title
|
|
4081
|
-
})).slice(1) : [],
|
|
4082
|
-
step: JUMP,
|
|
4083
|
-
bigStep: 60,
|
|
4084
|
-
label: `Seek in ${label}`
|
|
4085
|
-
}), /* @__PURE__ */ jsx(TimeReadout, {
|
|
4086
|
-
time,
|
|
4087
|
-
duration
|
|
4088
|
-
})]
|
|
4089
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
4090
|
-
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
4091
|
-
children: [
|
|
4092
|
-
/* @__PURE__ */ jsxs(Transport, {
|
|
4093
|
-
playing: media.playing,
|
|
4094
|
-
onPlayPause: media.toggle,
|
|
4095
|
-
children: [list.length > 1 && /* @__PURE__ */ jsx(IconButton, {
|
|
4096
|
-
icon: SkipBack,
|
|
4097
|
-
label: "Previous chapter",
|
|
4098
|
-
disabled: index === 0,
|
|
4099
|
-
onClick: () => step(-1)
|
|
4100
|
-
}), list.length > 1 && /* @__PURE__ */ jsx(IconButton, {
|
|
4101
|
-
icon: SkipForward,
|
|
4102
|
-
label: "Next chapter",
|
|
4103
|
-
disabled: index === list.length - 1,
|
|
4104
|
-
onClick: () => step(1)
|
|
4143
|
+
children: media.playing ? `Playing ${format.runningTime(bound.start)} to ${format.runningTime(bound.end)}` : ""
|
|
4144
|
+
}) })] }),
|
|
4145
|
+
!native && /* @__PURE__ */ jsxs("div", {
|
|
4146
|
+
className: "grid gap-2",
|
|
4147
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
4148
|
+
className: "flex min-w-0 items-center gap-3",
|
|
4149
|
+
children: [/* @__PURE__ */ jsx(SeekBar, {
|
|
4150
|
+
time,
|
|
4151
|
+
duration,
|
|
4152
|
+
onSeek: seek,
|
|
4153
|
+
buffered: growing ? media.ready : offsets ? void 0 : media.buffered,
|
|
4154
|
+
spans: spanState.bars,
|
|
4155
|
+
marks: bound && showFull ? [{
|
|
4156
|
+
time: bound.start,
|
|
4157
|
+
label: "Window starts"
|
|
4158
|
+
}, {
|
|
4159
|
+
time: bound.end,
|
|
4160
|
+
label: "Window ends"
|
|
4161
|
+
}] : offsets ? list.map((s, i) => ({
|
|
4162
|
+
time: offsets[i],
|
|
4163
|
+
label: s.title
|
|
4164
|
+
})).slice(1) : [],
|
|
4165
|
+
step: JUMP,
|
|
4166
|
+
bigStep: 60,
|
|
4167
|
+
label: `Seek in ${label}`
|
|
4168
|
+
}), /* @__PURE__ */ jsx(TimeReadout, {
|
|
4169
|
+
time,
|
|
4170
|
+
duration
|
|
4105
4171
|
})]
|
|
4106
|
-
}),
|
|
4107
|
-
|
|
4108
|
-
className: "type-body-sm text-muted-foreground",
|
|
4109
|
-
children: [
|
|
4110
|
-
current?.title,
|
|
4111
|
-
" (",
|
|
4112
|
-
index + 1,
|
|
4113
|
-
" of ",
|
|
4114
|
-
list.length,
|
|
4115
|
-
")"
|
|
4116
|
-
]
|
|
4117
|
-
}),
|
|
4118
|
-
/* @__PURE__ */ jsxs("span", {
|
|
4119
|
-
className: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-2",
|
|
4172
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
4173
|
+
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
4120
4174
|
children: [
|
|
4121
|
-
/* @__PURE__ */
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4175
|
+
/* @__PURE__ */ jsxs(Transport, {
|
|
4176
|
+
playing: media.playing,
|
|
4177
|
+
onPlayPause: media.toggle,
|
|
4178
|
+
children: [list.length > 1 && /* @__PURE__ */ jsx(IconButton, {
|
|
4179
|
+
icon: SkipBack,
|
|
4180
|
+
label: "Previous chapter",
|
|
4181
|
+
disabled: index === 0,
|
|
4182
|
+
onClick: () => step(-1)
|
|
4183
|
+
}), list.length > 1 && /* @__PURE__ */ jsx(IconButton, {
|
|
4184
|
+
icon: SkipForward,
|
|
4185
|
+
label: "Next chapter",
|
|
4186
|
+
disabled: index === list.length - 1,
|
|
4187
|
+
onClick: () => step(1)
|
|
4188
|
+
})]
|
|
4125
4189
|
}),
|
|
4126
|
-
/* @__PURE__ */
|
|
4127
|
-
|
|
4128
|
-
|
|
4190
|
+
list.length > 1 && /* @__PURE__ */ jsxs("span", {
|
|
4191
|
+
className: "type-body-sm text-muted-foreground",
|
|
4192
|
+
children: [
|
|
4193
|
+
current?.title,
|
|
4194
|
+
" (",
|
|
4195
|
+
index + 1,
|
|
4196
|
+
" of ",
|
|
4197
|
+
list.length,
|
|
4198
|
+
")"
|
|
4199
|
+
]
|
|
4129
4200
|
}),
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4201
|
+
/* @__PURE__ */ jsxs("span", {
|
|
4202
|
+
className: "ml-auto flex min-w-0 flex-wrap items-center justify-end gap-x-3 gap-y-2",
|
|
4203
|
+
children: [
|
|
4204
|
+
/* @__PURE__ */ jsx(RateChoice, {
|
|
4205
|
+
rate: media.rate,
|
|
4206
|
+
onRateChange: media.setRate,
|
|
4207
|
+
rates
|
|
4208
|
+
}),
|
|
4209
|
+
/* @__PURE__ */ jsx(VolumeControl, {
|
|
4210
|
+
volume: media.volume,
|
|
4211
|
+
onVolumeChange: media.setVolume
|
|
4212
|
+
}),
|
|
4213
|
+
canFull && /* @__PURE__ */ jsx(IconButton, {
|
|
4214
|
+
icon: full ? Minimize : Maximize,
|
|
4215
|
+
label: full ? "Leave full screen" : "Full screen",
|
|
4216
|
+
onPress: () => setFull(!full)
|
|
4217
|
+
})
|
|
4218
|
+
]
|
|
4134
4219
|
})
|
|
4135
4220
|
]
|
|
4136
|
-
})
|
|
4137
|
-
|
|
4138
|
-
|
|
4221
|
+
})]
|
|
4222
|
+
}),
|
|
4223
|
+
status
|
|
4224
|
+
]
|
|
4139
4225
|
})
|
|
4140
4226
|
]
|
|
4141
4227
|
})
|
|
@@ -8895,6 +8981,61 @@ function ViewOptions({ view, shown, total, label = "View options", className })
|
|
|
8895
8981
|
]
|
|
8896
8982
|
});
|
|
8897
8983
|
}
|
|
8984
|
+
// src/components/choice-grid.tsx
|
|
8985
|
+
var minSide = {
|
|
8986
|
+
md: 120,
|
|
8987
|
+
lg: 160
|
|
8988
|
+
};
|
|
8989
|
+
var closed = (s) => s === "right" || s === "answer";
|
|
8990
|
+
var columns = (size) => ({ gridTemplateColumns: `repeat(auto-fill, minmax(min(${minSide[size]}px, 100%), 1fr))` });
|
|
8991
|
+
/** A grid of large picture tiles for answering one question with a tap: each tile open, wrong, right or shown as the answer, with its word; answered tiles cannot be pressed again, and the grid closes once the answer shows. */
|
|
8992
|
+
function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, marks, onChoose, size = "md", className }) {
|
|
8993
|
+
const byKey = new Map(items.map((item) => [itemKey(item), item]));
|
|
8994
|
+
const over = items.some((item) => closed(state(item)));
|
|
8995
|
+
const disabledKeys = items.filter((item) => over || state(item) !== "open").map(itemKey);
|
|
8996
|
+
return /* @__PURE__ */ jsx(GridList, {
|
|
8997
|
+
"aria-label": label,
|
|
8998
|
+
layout: "grid",
|
|
8999
|
+
disabledKeys,
|
|
9000
|
+
disabledBehavior: "all",
|
|
9001
|
+
onAction: (key) => {
|
|
9002
|
+
const item = byKey.get(String(key));
|
|
9003
|
+
if (item !== void 0) onChoose(item);
|
|
9004
|
+
},
|
|
9005
|
+
className: cn("grid min-w-0 gap-4 outline-none", className),
|
|
9006
|
+
style: columns(size),
|
|
9007
|
+
children: items.map((item) => {
|
|
9008
|
+
const key = itemKey(item);
|
|
9009
|
+
const s = state(item);
|
|
9010
|
+
const mark = s === "open" ? null : marks[s];
|
|
9011
|
+
return /* @__PURE__ */ jsxs(GridListItem, {
|
|
9012
|
+
id: key,
|
|
9013
|
+
textValue: itemLabel(item),
|
|
9014
|
+
"aria-label": mark ? `${itemLabel(item)}, ${mark.toLowerCase()}` : itemLabel(item),
|
|
9015
|
+
"data-choice": s,
|
|
9016
|
+
className: cn("flex aspect-square min-w-0 cursor-pointer flex-col items-center justify-center gap-1 rounded-overlay border-2 border-border bg-card p-2 text-card-foreground select-none outline-offset-2 transition-state press", "hover:border-primary disabled:cursor-default disabled:hover:border-border", closed(s) && "border-4 border-success bg-success-subtle disabled:hover:border-success"),
|
|
9017
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
9018
|
+
"aria-hidden": true,
|
|
9019
|
+
className: cn("type-picture transition-state", s === "wrong" && "opacity-40"),
|
|
9020
|
+
children: renderPicture(item)
|
|
9021
|
+
}), mark && /* @__PURE__ */ jsx(Status, {
|
|
9022
|
+
tone: s === "wrong" ? "neutral" : "success",
|
|
9023
|
+
className: "max-w-full truncate",
|
|
9024
|
+
children: mark
|
|
9025
|
+
})]
|
|
9026
|
+
}, key);
|
|
9027
|
+
})
|
|
9028
|
+
});
|
|
9029
|
+
}
|
|
9030
|
+
/** The loading shape of a `ChoiceGrid`: `count` tiles at the same size, for a `DataView` skeleton. */
|
|
9031
|
+
function ChoiceGridSkeleton({ count = 4, size = "md", className }) {
|
|
9032
|
+
return /* @__PURE__ */ jsx("div", {
|
|
9033
|
+
"aria-hidden": true,
|
|
9034
|
+
className: cn("grid min-w-0 gap-4", className),
|
|
9035
|
+
style: columns(size),
|
|
9036
|
+
children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx("span", { className: "block aspect-square rounded-overlay bg-muted" }, i))
|
|
9037
|
+
});
|
|
9038
|
+
}
|
|
8898
9039
|
// src/components/infinite-list.tsx
|
|
8899
9040
|
var PendingFocus = React.createContext(null);
|
|
8900
9041
|
function MoreFailed({ message, retry }) {
|
|
@@ -16261,6 +16402,6 @@ function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose
|
|
|
16261
16402
|
]
|
|
16262
16403
|
});
|
|
16263
16404
|
}
|
|
16264
|
-
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 };
|
|
16405
|
+
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, Breadcrumb, BulkBar, Button, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, 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, usePlayerWarnings, useSelection, useSharedCursor, useSystemColorScheme, useTimelineZoom, useUndoable, useViewOptions, useViewport, useWorkspaceState, valueAt, viewOf, viewsOf, wordAt, wordId, zoomAt, zoomToBox };
|
|
16265
16406
|
|
|
16266
16407
|
//# sourceMappingURL=index.js.map
|