strata-react 1.3.25 → 1.3.26
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/UPGRADING.md +4 -0
- package/dist/{api-types/cli.d.ts → api-types-cli.d.ts} +1 -0
- package/dist/api-types-cli.js +4 -3
- package/dist/api-types-cli.js.map +1 -1
- package/dist/{api-types/generate.d.ts → api-types.d.ts} +3 -3
- package/dist/api-types.js +3 -1
- package/dist/{button-KGJI6jQr.js → button-CYXjU-fs.js} +8 -5
- package/dist/button-CYXjU-fs.js.map +1 -0
- package/dist/{cursor-DDGBPiTJ.js → cursor-Cwyvgwsw.js} +9 -7
- package/dist/cursor-Cwyvgwsw.js.map +1 -0
- package/dist/{errors-BUvY1Z4d.js → errors-CmuwcWlb.js} +6 -6
- package/dist/{errors-BUvY1Z4d.js.map → errors-CmuwcWlb.js.map} +1 -1
- package/dist/{field-BjeE_FeB.js → field-DBCsFIng.js} +27 -23
- package/dist/field-DBCsFIng.js.map +1 -0
- package/dist/{follow-BTPs49FP.js → follow-CXQsL86O.js} +2 -2
- package/dist/follow-CXQsL86O.js.map +1 -0
- package/dist/{generate-CjTHKJ39.js → generate-BkWhh4k4.js} +8 -6
- package/dist/generate-BkWhh4k4.js.map +1 -0
- package/dist/{lib/geo.d.ts → geo-DfKa9JtK.d.ts} +35 -33
- package/dist/{hls/index.d.ts → hls.d.ts} +13 -12
- package/dist/hls.js +5 -4
- package/dist/hls.js.map +1 -1
- package/dist/index.d.ts +5300 -142
- package/dist/index.js +363 -226
- package/dist/index.js.map +1 -1
- package/dist/map.d.ts +184 -0
- package/dist/map.js +21 -17
- package/dist/map.js.map +1 -1
- package/dist/media-player-BETa3P7K.d.ts +758 -0
- package/dist/{microphone-Bo3WaXgD.js → microphone-76skMt6i.js} +41 -30
- package/dist/microphone-76skMt6i.js.map +1 -0
- package/dist/microphone-DDOnQHxf.d.ts +237 -0
- package/dist/{migrate/cli.d.ts → migrate-cli.d.ts} +1 -0
- package/dist/migrate-cli.js +8 -6
- package/dist/migrate-cli.js.map +1 -1
- package/dist/panorama.d.ts +102 -0
- package/dist/panorama.js +18 -15
- package/dist/panorama.js.map +1 -1
- package/dist/{run-BT2WKzMz.js → run-D_Ic1jE7.js} +23 -16
- package/dist/run-D_Ic1jE7.js.map +1 -0
- package/dist/scene.d.ts +147 -0
- package/dist/scene.js +15 -13
- package/dist/scene.js.map +1 -1
- package/dist/testing.d.ts +468 -0
- package/dist/testing.js +11 -3
- package/dist/testing.js.map +1 -1
- package/dist/{theme-CxYZkUNk.js → theme-1oOSMj_D.js} +19 -17
- package/dist/theme-1oOSMj_D.js.map +1 -0
- package/dist/{tooltip-DhqrDtyu.js → tooltip-BosfsWYh.js} +9 -6
- package/dist/tooltip-BosfsWYh.js.map +1 -0
- package/dist/types-B3TsF0Ey.d.ts +241 -0
- package/dist/{value-controls-Dm_EYfZW.js → value-controls-5u7sD_wG.js} +22 -17
- package/dist/value-controls-5u7sD_wG.js.map +1 -0
- package/dist/{viewer-input-CHU0Hx4A.js → viewer-input-3Qa-o35k.js} +3 -2
- package/dist/{viewer-input-CHU0Hx4A.js.map → viewer-input-3Qa-o35k.js.map} +1 -1
- package/dist/{visual/cli.d.ts → visual-cli.d.ts} +2 -1
- package/dist/visual-cli.js +5 -4
- package/dist/visual-cli.js.map +1 -1
- package/dist/visual.d.ts +105 -0
- package/dist/visual.js +4 -3
- package/dist/visual.js.map +1 -1
- package/package.json +24 -19
- package/dist/api-types/index.d.ts +0 -1
- package/dist/button-KGJI6jQr.js.map +0 -1
- package/dist/components/active-list.d.ts +0 -46
- package/dist/components/alert.d.ts +0 -17
- package/dist/components/app-shell.d.ts +0 -32
- package/dist/components/async-button.d.ts +0 -48
- package/dist/components/auto-recorder.d.ts +0 -67
- package/dist/components/book-viewer.d.ts +0 -50
- package/dist/components/box-overlay.d.ts +0 -44
- package/dist/components/boxed-picture.d.ts +0 -34
- package/dist/components/button.d.ts +0 -45
- package/dist/components/byte-view.d.ts +0 -32
- package/dist/components/checkbox.d.ts +0 -39
- package/dist/components/choice-grid.d.ts +0 -42
- package/dist/components/commands.d.ts +0 -104
- package/dist/components/compare-audio.d.ts +0 -30
- package/dist/components/compare-grid.d.ts +0 -24
- package/dist/components/compare-parts.d.ts +0 -90
- package/dist/components/compare-regions.d.ts +0 -37
- package/dist/components/compare-text.d.ts +0 -32
- package/dist/components/compare-video-grid.d.ts +0 -52
- package/dist/components/compare-video.d.ts +0 -61
- package/dist/components/compare.d.ts +0 -90
- package/dist/components/composition.d.ts +0 -44
- package/dist/components/console.d.ts +0 -34
- package/dist/components/conversation.d.ts +0 -83
- package/dist/components/cursor.d.ts +0 -44
- package/dist/components/data-table.d.ts +0 -89
- package/dist/components/data-view.d.ts +0 -66
- package/dist/components/density.d.ts +0 -16
- package/dist/components/dialog.d.ts +0 -45
- package/dist/components/difference.d.ts +0 -19
- package/dist/components/disclosure.d.ts +0 -49
- package/dist/components/done.d.ts +0 -14
- package/dist/components/drag-source.d.ts +0 -29
- package/dist/components/field.d.ts +0 -79
- package/dist/components/file-intake.d.ts +0 -60
- package/dist/components/film-strip.d.ts +0 -35
- package/dist/components/folder-picker.d.ts +0 -59
- package/dist/components/fullscreen-frame.d.ts +0 -18
- package/dist/components/history.d.ts +0 -61
- package/dist/components/hotkeys.d.ts +0 -44
- package/dist/components/infinite-list.d.ts +0 -77
- package/dist/components/inspector.d.ts +0 -66
- package/dist/components/job-action.d.ts +0 -30
- package/dist/components/job-status.d.ts +0 -55
- package/dist/components/jobs-table.d.ts +0 -35
- package/dist/components/key-glyphs.d.ts +0 -5
- package/dist/components/key-owner.d.ts +0 -11
- package/dist/components/lightbox.d.ts +0 -61
- package/dist/components/line-chart.d.ts +0 -169
- package/dist/components/link-card.d.ts +0 -32
- package/dist/components/link.d.ts +0 -54
- package/dist/components/markable-text.d.ts +0 -60
- package/dist/components/media-contents.d.ts +0 -28
- package/dist/components/media-group.d.ts +0 -32
- package/dist/components/media-player.d.ts +0 -251
- package/dist/components/media-progress.d.ts +0 -17
- package/dist/components/media-skip.d.ts +0 -31
- package/dist/components/media-spans.d.ts +0 -93
- package/dist/components/media.d.ts +0 -133
- package/dist/components/meter.d.ts +0 -32
- package/dist/components/metric.d.ts +0 -17
- package/dist/components/outbox-status.d.ts +0 -10
- package/dist/components/page-header.d.ts +0 -14
- package/dist/components/pair-vote.d.ts +0 -70
- package/dist/components/pause-button.d.ts +0 -7
- package/dist/components/pixel-image.d.ts +0 -29
- package/dist/components/place-board.d.ts +0 -39
- package/dist/components/player-warning.d.ts +0 -24
- package/dist/components/popover.d.ts +0 -20
- package/dist/components/recorder.d.ts +0 -73
- package/dist/components/region-editor.d.ts +0 -67
- package/dist/components/save.d.ts +0 -46
- package/dist/components/say-again.d.ts +0 -13
- package/dist/components/schedule-table.d.ts +0 -24
- package/dist/components/secret-field.d.ts +0 -34
- package/dist/components/selectable-grid.d.ts +0 -57
- package/dist/components/selection.d.ts +0 -104
- package/dist/components/sequence-timeline.d.ts +0 -50
- package/dist/components/shortcut-editor.d.ts +0 -44
- package/dist/components/sortable-list.d.ts +0 -39
- package/dist/components/status.d.ts +0 -9
- package/dist/components/switch.d.ts +0 -15
- package/dist/components/system-panel.d.ts +0 -58
- package/dist/components/tabs.d.ts +0 -16
- package/dist/components/theme.d.ts +0 -106
- package/dist/components/thumbnail.d.ts +0 -50
- package/dist/components/tile-grid.d.ts +0 -67
- package/dist/components/timeline-player.d.ts +0 -18
- package/dist/components/timeline.d.ts +0 -115
- package/dist/components/toast.d.ts +0 -36
- package/dist/components/toggle.d.ts +0 -51
- package/dist/components/toolbar.d.ts +0 -15
- package/dist/components/tooltip.d.ts +0 -19
- package/dist/components/transcript-view.d.ts +0 -63
- package/dist/components/tree.d.ts +0 -74
- package/dist/components/undo.d.ts +0 -63
- package/dist/components/use-timeline.d.ts +0 -44
- package/dist/components/value-controls.d.ts +0 -91
- package/dist/components/video-clock.d.ts +0 -68
- package/dist/components/view-options.d.ts +0 -105
- package/dist/components/viewport.d.ts +0 -85
- package/dist/components/virtual-list.d.ts +0 -19
- package/dist/components/waveform.d.ts +0 -71
- package/dist/components/workflow-steps.d.ts +0 -71
- package/dist/components/workspace.d.ts +0 -83
- package/dist/cursor-DDGBPiTJ.js.map +0 -1
- package/dist/field-BjeE_FeB.js.map +0 -1
- package/dist/follow-BTPs49FP.js.map +0 -1
- package/dist/generate-CjTHKJ39.js.map +0 -1
- package/dist/lib/base.d.ts +0 -10
- package/dist/lib/book.d.ts +0 -25
- package/dist/lib/boxes.d.ts +0 -55
- package/dist/lib/breakpoint.d.ts +0 -4
- package/dist/lib/choice.d.ts +0 -29
- package/dist/lib/chords.d.ts +0 -20
- package/dist/lib/client-work.d.ts +0 -24
- package/dist/lib/control.d.ts +0 -4
- package/dist/lib/dev.d.ts +0 -2
- package/dist/lib/errors.d.ts +0 -43
- package/dist/lib/file-intake.d.ts +0 -60
- package/dist/lib/follow.d.ts +0 -18
- package/dist/lib/format.d.ts +0 -243
- package/dist/lib/grouped-grid-layout.d.ts +0 -44
- package/dist/lib/icon.d.ts +0 -6
- package/dist/lib/image-diff.d.ts +0 -30
- package/dist/lib/in-view.d.ts +0 -21
- package/dist/lib/loudness.d.ts +0 -18
- package/dist/lib/marks.d.ts +0 -6
- package/dist/lib/microphone.d.ts +0 -24
- package/dist/lib/number-input.d.ts +0 -4
- package/dist/lib/object-url.d.ts +0 -2
- package/dist/lib/overlay.d.ts +0 -1
- package/dist/lib/recording.d.ts +0 -16
- package/dist/lib/region.d.ts +0 -64
- package/dist/lib/rich-text.d.ts +0 -44
- package/dist/lib/search-param.d.ts +0 -16
- package/dist/lib/segmenter.d.ts +0 -40
- package/dist/lib/sequence.d.ts +0 -34
- package/dist/lib/speech.d.ts +0 -53
- package/dist/lib/text-diff.d.ts +0 -16
- package/dist/lib/timeline.d.ts +0 -14
- package/dist/lib/transcript.d.ts +0 -53
- package/dist/lib/utils.d.ts +0 -4
- package/dist/lib/viewer-input.d.ts +0 -29
- package/dist/lib/viewport.d.ts +0 -55
- package/dist/lib/waveform.d.ts +0 -46
- package/dist/map/fan.d.ts +0 -15
- package/dist/map/index.d.ts +0 -3
- package/dist/map/map-styles.d.ts +0 -2
- package/dist/map/markers.d.ts +0 -60
- package/dist/map/route-map.d.ts +0 -146
- package/dist/microphone-Bo3WaXgD.js.map +0 -1
- package/dist/migrate/stock-classes.d.ts +0 -11
- package/dist/panorama/gl.d.ts +0 -16
- package/dist/panorama/index.d.ts +0 -2
- package/dist/panorama/panorama-viewer.d.ts +0 -56
- package/dist/panorama/projection.d.ts +0 -45
- package/dist/query/api.d.ts +0 -23
- package/dist/query/clips.d.ts +0 -48
- package/dist/query/index.d.ts +0 -55
- package/dist/query/infinite.d.ts +0 -60
- package/dist/query/job.d.ts +0 -26
- package/dist/query/outbox.d.ts +0 -85
- package/dist/query/poll.d.ts +0 -24
- package/dist/query/reserve.d.ts +0 -33
- package/dist/query/typed-api.d.ts +0 -84
- package/dist/query/workflow.d.ts +0 -17
- package/dist/run-BT2WKzMz.js.map +0 -1
- package/dist/scene/camera.d.ts +0 -99
- package/dist/scene/index.d.ts +0 -2
- package/dist/scene/scene-viewport.d.ts +0 -48
- package/dist/testing/buttons.d.ts +0 -7
- package/dist/testing/index.d.ts +0 -161
- package/dist/testing/intersection-observer.d.ts +0 -34
- package/dist/testing/layout.d.ts +0 -13
- package/dist/testing/microphone.d.ts +0 -35
- package/dist/testing/setup.d.ts +0 -14
- package/dist/testing/speech.d.ts +0 -38
- package/dist/testing/storage.d.ts +0 -7
- package/dist/theme-CxYZkUNk.js.map +0 -1
- package/dist/tooltip-DhqrDtyu.js.map +0 -1
- package/dist/value-controls-Dm_EYfZW.js.map +0 -1
- package/dist/visual/capture.d.ts +0 -37
- package/dist/visual/compare.d.ts +0 -46
- package/dist/visual/drop.d.ts +0 -19
- package/dist/visual/fonts.d.ts +0 -18
- package/dist/visual/index.d.ts +0 -19
- package/dist/visual/run.d.ts +0 -22
- package/dist/visual/serve.d.ts +0 -13
- package/dist/visual/targets.d.ts +0 -17
- package/dist/visual/types.d.ts +0 -188
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { i as typeSteps, n as KeyText, r as cn, t as Tooltip } from "./tooltip-
|
|
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-
|
|
3
|
-
import { a as isDev, i as buttonVariants, n as IconButton, o as useInView, r as RowAction, t as Button } from "./button-
|
|
4
|
-
import { t as followAim } from "./follow-
|
|
5
|
-
import { n as useViewPointers, r as useWheelZoom, t as useSettledStatus } from "./viewer-input-
|
|
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-
|
|
8
|
-
import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-
|
|
9
|
-
import { a as fieldErrorsOf, i as errorPayload, n as describeActionError, o as readErrorBody, r as describeHttpError, t as HttpError } from "./errors-
|
|
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-
|
|
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-DBCsFIng.js";
|
|
3
|
+
import { a as isDev, i as buttonVariants, n as IconButton, o as useInView, r as RowAction, t as Button } from "./button-CYXjU-fs.js";
|
|
4
|
+
import { t as followAim } from "./follow-CXQsL86O.js";
|
|
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-76skMt6i.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-5u7sD_wG.js";
|
|
8
|
+
import { n as useSharedCursor, r as geo, t as CursorScope } from "./cursor-Cwyvgwsw.js";
|
|
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-1oOSMj_D.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, 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";
|
|
@@ -18,6 +18,7 @@ import { createSortedRowModel, flexRender, rowSortingFeature, tableFeatures, use
|
|
|
18
18
|
import { UNSAFE_PortalProvider, VisuallyHidden, mergeProps, useDrag, useDrop, useFocusRing, useMove, useSlider, useSliderThumb, useUNSAFE_PortalContext } from "react-aria";
|
|
19
19
|
import { LayoutInfo, Rect, Size, useSliderState } from "react-stately";
|
|
20
20
|
import pixelmatch from "pixelmatch";
|
|
21
|
+
|
|
21
22
|
// src/lib/chords.ts
|
|
22
23
|
/** The platform this page runs on, read from the browser (`mac` for macOS and iOS). Server and test default: `other`. */
|
|
23
24
|
function detectPlatform() {
|
|
@@ -40,7 +41,7 @@ function parseChord(chord, platform = detectPlatform()) {
|
|
|
40
41
|
key
|
|
41
42
|
};
|
|
42
43
|
}
|
|
43
|
-
|
|
44
|
+
const symbol = (key) => key.length === 1 && key.toUpperCase() === key.toLowerCase();
|
|
44
45
|
/** Whether a key event is this chord. Exact on Ctrl, Meta and Alt; Shift is exact for letters and named keys. */
|
|
45
46
|
function matchesChord(e, chord, platform = detectPlatform()) {
|
|
46
47
|
const c = parseChord(chord, platform);
|
|
@@ -50,7 +51,7 @@ function matchesChord(e, chord, platform = detectPlatform()) {
|
|
|
50
51
|
if (e.key.toLowerCase() === c.key.toLowerCase()) return true;
|
|
51
52
|
return c.alt && /^[a-z]$/i.test(c.key) && e.code === `Key${c.key.toUpperCase()}`;
|
|
52
53
|
}
|
|
53
|
-
|
|
54
|
+
const NAMES = {
|
|
54
55
|
ArrowUp: {
|
|
55
56
|
mac: "↑",
|
|
56
57
|
other: "↑"
|
|
@@ -113,7 +114,7 @@ function formatChord(chord, platform = detectPlatform()) {
|
|
|
113
114
|
key
|
|
114
115
|
].filter(Boolean).join("+");
|
|
115
116
|
}
|
|
116
|
-
|
|
117
|
+
const RESERVED = [
|
|
117
118
|
"Mod+S",
|
|
118
119
|
"Mod+P",
|
|
119
120
|
"Mod+F",
|
|
@@ -146,12 +147,13 @@ function isReservedChord(chord, platform = detectPlatform()) {
|
|
|
146
147
|
return p.ctrl === c.ctrl && p.meta === c.meta && p.alt === c.alt && p.shift === c.shift && p.key.toLowerCase() === c.key.toLowerCase();
|
|
147
148
|
});
|
|
148
149
|
}
|
|
150
|
+
|
|
149
151
|
// src/components/commands.tsx
|
|
150
152
|
/** The text of a command's label, whether it is a string or a function. */
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
const labelOf = (c) => typeof c.label === "function" ? c.label() : c.label;
|
|
154
|
+
const isDisabled = (c) => Boolean(c.disabled);
|
|
155
|
+
const reasonOf = (c) => typeof c.disabled === "string" ? c.disabled : void 0;
|
|
156
|
+
const isCommand = (e) => typeof e === "object" && "run" in e;
|
|
155
157
|
/**
|
|
156
158
|
* Binds every command's chords on the window. Never while typing (unless the command says
|
|
157
159
|
* `inFields`), never during IME composition, not on a held key (unless `repeat`), not for a disabled
|
|
@@ -214,7 +216,7 @@ function CommandLegend({ commands, platform, label = "Keyboard shortcuts", class
|
|
|
214
216
|
}, c.id))
|
|
215
217
|
});
|
|
216
218
|
}
|
|
217
|
-
|
|
219
|
+
const itemClass = cn("flex min-h-(--control-h-sm) cursor-pointer items-center gap-2 rounded-control px-2 type-body-sm outline-none", "focus:bg-muted disabled:cursor-not-allowed disabled:text-muted-foreground disabled:opacity-70", "open:bg-muted");
|
|
218
220
|
function Item({ command, platform }) {
|
|
219
221
|
const Icon = command.icon ?? (command.destructive ? Trash2 : void 0);
|
|
220
222
|
const shortcut = commandShortcut(command, platform);
|
|
@@ -298,7 +300,7 @@ function Entries({ entries, platform }) {
|
|
|
298
300
|
})] }, `sub-${entry.submenu}`);
|
|
299
301
|
}) });
|
|
300
302
|
}
|
|
301
|
-
|
|
303
|
+
const surface = cn("layer-overlay min-w-48 p-1", overlaySurface);
|
|
302
304
|
/** A dropdown menu of commands: the menu roles and keyboard model, shortcuts shown per platform, unavailable items with their reason, separators, groups, checkable groups and submenus. */
|
|
303
305
|
function Menu({ label, trigger, items, open, onOpenChange, platform, className }) {
|
|
304
306
|
const where = platform ?? detectPlatform();
|
|
@@ -453,9 +455,10 @@ function CommandMenu({ commands, open, onOpenChange, shortcut = "Mod+K", label =
|
|
|
453
455
|
})
|
|
454
456
|
});
|
|
455
457
|
}
|
|
458
|
+
|
|
456
459
|
// src/components/toggle.tsx
|
|
457
|
-
|
|
458
|
-
|
|
460
|
+
const base = "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control border type-label transition-state press [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border-input bg-background text-muted-foreground hover:bg-muted hover:text-foreground selected:border-foreground selected:bg-muted selected:text-foreground disabled:pointer-events-none disabled:opacity-50";
|
|
461
|
+
const sizes$1 = {
|
|
459
462
|
default: "h-(--control-h)",
|
|
460
463
|
sm: "h-(--control-h-sm)"
|
|
461
464
|
};
|
|
@@ -536,6 +539,7 @@ function ToggleGroupView({ label, options, value, onChange, size = "default", cl
|
|
|
536
539
|
})
|
|
537
540
|
});
|
|
538
541
|
}
|
|
542
|
+
|
|
539
543
|
// src/components/pause-button.tsx
|
|
540
544
|
/** The pause control of a polled screen: a "Pause updates" toggle and when the readings were last taken ("Updated 12:00"). Takes the `Poll` from `usePoll`. */
|
|
541
545
|
function PauseButton({ poll, hideUpdated = false, className }) {
|
|
@@ -556,6 +560,7 @@ function PauseButton({ poll, hideUpdated = false, className }) {
|
|
|
556
560
|
})]
|
|
557
561
|
});
|
|
558
562
|
}
|
|
563
|
+
|
|
559
564
|
// src/components/switch.tsx
|
|
560
565
|
/** An on/off setting that applies at once, its label and control one target. */
|
|
561
566
|
function Switch({ label, detail, on, defaultOn, onChange, disabled, className }) {
|
|
@@ -589,8 +594,9 @@ function Switch({ label, detail, on, defaultOn, onChange, disabled, className })
|
|
|
589
594
|
})]
|
|
590
595
|
});
|
|
591
596
|
}
|
|
597
|
+
|
|
592
598
|
// src/components/dialog.tsx
|
|
593
|
-
|
|
599
|
+
const sizes = {
|
|
594
600
|
sm: "max-w-sm",
|
|
595
601
|
md: "max-w-lg",
|
|
596
602
|
lg: "max-w-3xl",
|
|
@@ -628,7 +634,7 @@ function Driven({ open, onOpenChange, children }) {
|
|
|
628
634
|
onOpenChange
|
|
629
635
|
});
|
|
630
636
|
}
|
|
631
|
-
|
|
637
|
+
const overlayClass = "layer-overlay fixed inset-0 grid overflow-hidden scrim";
|
|
632
638
|
/** A modal dialog with a required title; focus goes in and returns, Escape and a close control dismiss it. `placement="end"` makes it a sheet. */
|
|
633
639
|
function Dialog({ title, description, trigger, open, onOpenChange, className, children, actions, hideTitle, closable = true, placement = "center", size = "md" }) {
|
|
634
640
|
const descriptionId = React.useId();
|
|
@@ -762,8 +768,9 @@ function AlertDialog({ title, description, trigger, open, onOpenChange, classNam
|
|
|
762
768
|
})
|
|
763
769
|
});
|
|
764
770
|
}
|
|
771
|
+
|
|
765
772
|
// src/components/popover.tsx
|
|
766
|
-
|
|
773
|
+
const widths = {
|
|
767
774
|
sm: "w-52",
|
|
768
775
|
md: "w-72",
|
|
769
776
|
lg: "w-96"
|
|
@@ -786,6 +793,7 @@ function Popover({ label, trigger, children, side = "bottom", align = "start", o
|
|
|
786
793
|
})]
|
|
787
794
|
});
|
|
788
795
|
}
|
|
796
|
+
|
|
789
797
|
// src/components/checkbox.tsx
|
|
790
798
|
/** A checkbox and its label as one target. `label` is required; `hideLabel` keeps it as the accessible name only. */
|
|
791
799
|
function Checkbox({ label, hideLabel = false, detail, checked, onCheckedChange, className, disabled, required, ...props }) {
|
|
@@ -876,8 +884,9 @@ function TableSelectionCheckbox({ label, className, disabled, mixed }) {
|
|
|
876
884
|
})
|
|
877
885
|
});
|
|
878
886
|
}
|
|
887
|
+
|
|
879
888
|
// src/components/status.tsx
|
|
880
|
-
|
|
889
|
+
const tones$1 = {
|
|
881
890
|
neutral: "bg-muted text-muted-foreground",
|
|
882
891
|
info: "bg-info-subtle text-info",
|
|
883
892
|
success: "bg-success-subtle text-success",
|
|
@@ -894,6 +903,7 @@ function Status({ tone, icon: Icon, children, className }) {
|
|
|
894
903
|
}), children]
|
|
895
904
|
});
|
|
896
905
|
}
|
|
906
|
+
|
|
897
907
|
// src/components/metric.tsx
|
|
898
908
|
/** Headline figures as one description list split by hairlines. Holds `Metric`s. */
|
|
899
909
|
function MetricStrip({ label, children, className }) {
|
|
@@ -926,12 +936,13 @@ function Metric({ label, value, unit, note }) {
|
|
|
926
936
|
]
|
|
927
937
|
});
|
|
928
938
|
}
|
|
939
|
+
|
|
929
940
|
// src/components/meter.tsx
|
|
930
941
|
/** The threshold a share has crossed, if any: the most severe one reached in the worse direction. */
|
|
931
942
|
function crossedThreshold(share, thresholds = [], worseWhen = "higher") {
|
|
932
943
|
return thresholds.filter((t) => worseWhen === "higher" ? share >= t.at : share <= t.at).sort((a, b) => worseWhen === "higher" ? b.at - a.at : a.at - b.at)[0];
|
|
933
944
|
}
|
|
934
|
-
|
|
945
|
+
const fills = {
|
|
935
946
|
warning: "var(--warning)",
|
|
936
947
|
danger: "var(--danger)"
|
|
937
948
|
};
|
|
@@ -1012,6 +1023,7 @@ function Meter({ label, value, max = 1, valueText, detail, thresholds, worseWhen
|
|
|
1012
1023
|
]
|
|
1013
1024
|
});
|
|
1014
1025
|
}
|
|
1026
|
+
|
|
1015
1027
|
// src/lib/base.ts
|
|
1016
1028
|
/**
|
|
1017
1029
|
* Where the app is mounted: the path of the page's `<base href>` without its trailing slash, `""` at the root or where there is no base (SSR, a plain page).
|
|
@@ -1028,8 +1040,9 @@ function appBase(doc = typeof document === "undefined" ? void 0 : document) {
|
|
|
1028
1040
|
function withBase(path, base = appBase()) {
|
|
1029
1041
|
return path.startsWith("/") && !path.startsWith("//") ? base + path : path;
|
|
1030
1042
|
}
|
|
1043
|
+
|
|
1031
1044
|
// src/query/api.ts
|
|
1032
|
-
|
|
1045
|
+
const isRaw = (body) => typeof Blob !== "undefined" && body instanceof Blob || body instanceof ArrayBuffer || ArrayBuffer.isView(body) || typeof FormData !== "undefined" && body instanceof FormData || body instanceof URLSearchParams || typeof ReadableStream !== "undefined" && body instanceof ReadableStream;
|
|
1033
1046
|
/**
|
|
1034
1047
|
* A small client over `fetchJson` for the app's own server: root-relative paths get the app's base (so it works behind a reverse proxy),
|
|
1035
1048
|
* and `post`, `put` and `patch` send their body as JSON (a `Blob`, bytes, `FormData` or a stream is sent as it is, with the Blob's own type). `api.post<Learner>("/api/learners", { nickname })`.
|
|
@@ -1050,6 +1063,7 @@ function createApi({ base, ...options } = {}) {
|
|
|
1050
1063
|
delete: (path, init) => send("DELETE", path, void 0, init)
|
|
1051
1064
|
};
|
|
1052
1065
|
}
|
|
1066
|
+
|
|
1053
1067
|
// src/query/typed-api.ts
|
|
1054
1068
|
function fill(path, values, query) {
|
|
1055
1069
|
const filled = path.replace(/\{([^}]+)\}/g, (_, name) => {
|
|
@@ -1083,6 +1097,7 @@ function createTypedApi(options = {}) {
|
|
|
1083
1097
|
delete: call("delete")
|
|
1084
1098
|
};
|
|
1085
1099
|
}
|
|
1100
|
+
|
|
1086
1101
|
// src/query/infinite.ts
|
|
1087
1102
|
/** `useInfiniteQuery` for cursor-paged data, returned as an `InfiniteLoad<T>` for `InfiniteList` (or `DataView`). */
|
|
1088
1103
|
function useInfiniteLoad({ queryKey, queryFn, items, itemKey, hasMore = () => false, nextCursor, cursorAfter = itemKey, isRemoved, describeError = describeHttpError, enabled, staleTime }) {
|
|
@@ -1180,7 +1195,7 @@ function useInfiniteLoad({ queryKey, queryFn, items, itemKey, hasMore = () => fa
|
|
|
1180
1195
|
...extra
|
|
1181
1196
|
};
|
|
1182
1197
|
}
|
|
1183
|
-
|
|
1198
|
+
const none = /* @__PURE__ */ new Set();
|
|
1184
1199
|
/** Every page's items, in order, once each by key: the ones held (not dismissed) and the last one seen. */
|
|
1185
1200
|
function merge(pages, items, itemKey, hidden) {
|
|
1186
1201
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -1216,6 +1231,7 @@ function apiPage() {
|
|
|
1216
1231
|
nextCursor: (page) => page.next
|
|
1217
1232
|
};
|
|
1218
1233
|
}
|
|
1234
|
+
|
|
1219
1235
|
// src/query/job.ts
|
|
1220
1236
|
/** A long-running job's status: polled every `every` ms while `isRunning`, with the `invalidates` queries read again once when it ends. */
|
|
1221
1237
|
function useJob({ isRunning, every = 2e3, invalidates = [], describeError, ...options }) {
|
|
@@ -1250,6 +1266,7 @@ function useJob({ isRunning, every = 2e3, invalidates = [], describeError, ...op
|
|
|
1250
1266
|
function isTaskRunning(task, finished) {
|
|
1251
1267
|
return !(Array.isArray(finished) ? finished.includes(task.state) : finished.has(task.state));
|
|
1252
1268
|
}
|
|
1269
|
+
|
|
1253
1270
|
// src/query/workflow.ts
|
|
1254
1271
|
/** Whether the queue job advancing a workflow run is still going. `finished` is the generated `FINISHED` (or `["done", "failed", "cancelled"]`). */
|
|
1255
1272
|
function isWorkflowRunning(run, finished) {
|
|
@@ -1262,9 +1279,10 @@ function useWorkflowRun({ finished, ...options }) {
|
|
|
1262
1279
|
isRunning: (run) => isWorkflowRunning(run, finished)
|
|
1263
1280
|
});
|
|
1264
1281
|
}
|
|
1282
|
+
|
|
1265
1283
|
// src/components/system-panel.tsx
|
|
1266
1284
|
/** The shared limits for a folder's disk, as shares of its size: filling up at 80%, nearly full at 95%. */
|
|
1267
|
-
|
|
1285
|
+
const diskThresholds = [{
|
|
1268
1286
|
at: .8,
|
|
1269
1287
|
tone: "warning",
|
|
1270
1288
|
label: "Filling up"
|
|
@@ -1443,7 +1461,11 @@ function SystemPanel({ load, thresholds = diskThresholds, facts = [], now, headi
|
|
|
1443
1461
|
term: "Started",
|
|
1444
1462
|
children: [format.dateTime(s.started_at), /* @__PURE__ */ jsxs("span", {
|
|
1445
1463
|
className: "ml-2 text-muted-foreground tabular-nums",
|
|
1446
|
-
children: [
|
|
1464
|
+
children: [
|
|
1465
|
+
"up",
|
|
1466
|
+
" ",
|
|
1467
|
+
format.duration(((now ?? /* @__PURE__ */ new Date()).getTime() - new Date(s.started_at).getTime()) / 1e3, { style: "parts" })
|
|
1468
|
+
]
|
|
1447
1469
|
})]
|
|
1448
1470
|
}),
|
|
1449
1471
|
/* @__PURE__ */ jsx(Fact, {
|
|
@@ -1492,8 +1514,9 @@ function SystemPanel({ load, thresholds = diskThresholds, facts = [], now, headi
|
|
|
1492
1514
|
})
|
|
1493
1515
|
});
|
|
1494
1516
|
}
|
|
1517
|
+
|
|
1495
1518
|
// src/components/composition.tsx
|
|
1496
|
-
|
|
1519
|
+
const MAX_TOKENS = 5;
|
|
1497
1520
|
/** Keeps the four largest parts in their given order and sums the rest into one last part. */
|
|
1498
1521
|
function foldParts(parts, label) {
|
|
1499
1522
|
if (parts.length <= MAX_TOKENS) return parts;
|
|
@@ -1630,6 +1653,7 @@ function CompositionBar({ label, parts, formatValue, formatShare = format.share,
|
|
|
1630
1653
|
]
|
|
1631
1654
|
});
|
|
1632
1655
|
}
|
|
1656
|
+
|
|
1633
1657
|
// src/components/link-card.tsx
|
|
1634
1658
|
/** True when `href` is on another origin than the page (a relative one never is). Unreadable is treated as leaving. */
|
|
1635
1659
|
function leavesSite(href) {
|
|
@@ -1691,8 +1715,9 @@ function LinkCardList({ label, children, className }) {
|
|
|
1691
1715
|
}, React.isValidElement(child) && child.key != null ? child.key : i))
|
|
1692
1716
|
});
|
|
1693
1717
|
}
|
|
1718
|
+
|
|
1694
1719
|
// src/components/secret-field.tsx
|
|
1695
|
-
|
|
1720
|
+
const input = "w-full min-w-0 rounded-control border border-input bg-background pl-3 pr-1 type-body text-foreground transition-state placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-70 aria-invalid:border-danger";
|
|
1696
1721
|
/** A credential the server keeps and never shows again: "Not set", "Set" (no characters, not even its length), a masked entry with a named Show toggle, Replace, a confirmed Remove that says what stops working, and a Test with its result beside it. A set, untouched field reports nothing. */
|
|
1697
1722
|
function SecretField({ noun, isSet, setAt, onChange, onSave, onRemove, consequence, test, disabled, id: idProp, name, className }) {
|
|
1698
1723
|
const { field } = useFieldControl();
|
|
@@ -1868,8 +1893,9 @@ function SecretField({ noun, isSet, setAt, onChange, onSave, onRemove, consequen
|
|
|
1868
1893
|
})]
|
|
1869
1894
|
});
|
|
1870
1895
|
}
|
|
1896
|
+
|
|
1871
1897
|
// src/components/alert.tsx
|
|
1872
|
-
|
|
1898
|
+
const tones = {
|
|
1873
1899
|
info: {
|
|
1874
1900
|
box: "bg-info-subtle text-info",
|
|
1875
1901
|
icon: Info
|
|
@@ -1916,6 +1942,7 @@ function Alert({ tone, title, children, action, announce = false, className }) {
|
|
|
1916
1942
|
]
|
|
1917
1943
|
});
|
|
1918
1944
|
}
|
|
1945
|
+
|
|
1919
1946
|
// src/components/player-warning.tsx
|
|
1920
1947
|
/** Creates a warning channel for one player. Pass `warning` to MediaPlayer and call `warn` when a warning occurs. */
|
|
1921
1948
|
function usePlayerWarnings() {
|
|
@@ -1991,6 +2018,7 @@ function PlayerWarningToast({ warning }) {
|
|
|
1991
2018
|
]
|
|
1992
2019
|
});
|
|
1993
2020
|
}
|
|
2021
|
+
|
|
1994
2022
|
// src/lib/client-work.ts
|
|
1995
2023
|
/** Runs browser-side work with progress, cancel and a clear end state, ready for `JobStatus`. */
|
|
1996
2024
|
function useClientWork(run) {
|
|
@@ -2049,13 +2077,14 @@ function useClientWork(run) {
|
|
|
2049
2077
|
dismiss
|
|
2050
2078
|
};
|
|
2051
2079
|
}
|
|
2080
|
+
|
|
2052
2081
|
// src/components/job-status.tsx
|
|
2053
2082
|
/** The sentence for a job's progress: "3 of 9 done, 6 remaining · Night Sky". */
|
|
2054
2083
|
function jobProgressText({ done, total, current }) {
|
|
2055
2084
|
const d = Math.min(total, Math.max(0, done));
|
|
2056
2085
|
return `${format.integer(d)} of ${format.integer(total)} done, ${format.integer(total - d)} remaining${current ? ` · ${current}` : ""}`;
|
|
2057
2086
|
}
|
|
2058
|
-
|
|
2087
|
+
const Spinner = ({ className, ...props }) => /* @__PURE__ */ jsx(LoaderCircle, {
|
|
2059
2088
|
...props,
|
|
2060
2089
|
className: cn(className, "motion-safe:animate-spin")
|
|
2061
2090
|
});
|
|
@@ -2164,6 +2193,7 @@ function JobStatus({ label, running, words, summary, progress, current: currentP
|
|
|
2164
2193
|
]
|
|
2165
2194
|
});
|
|
2166
2195
|
}
|
|
2196
|
+
|
|
2167
2197
|
// src/components/job-action.tsx
|
|
2168
2198
|
/** One call for a button that starts a server job: busy until the job ends, a queued toast linking to the jobs page, a finished toast with the result, and a failure to start shown on the button. */
|
|
2169
2199
|
function useJobAction({ start, job, queued, done, jobsHref, jobsLabel = "Show jobs", ...asyncOptions }) {
|
|
@@ -2239,8 +2269,9 @@ function useJobAction({ start, job, queued, done, jobsHref, jobsLabel = "Show jo
|
|
|
2239
2269
|
running: waiting && (running || action.phase === "pending")
|
|
2240
2270
|
};
|
|
2241
2271
|
}
|
|
2272
|
+
|
|
2242
2273
|
// src/components/workflow-steps.tsx
|
|
2243
|
-
|
|
2274
|
+
const DEFAULT_WORDS = {
|
|
2244
2275
|
done: "Done",
|
|
2245
2276
|
approved: "Approved",
|
|
2246
2277
|
ready: "Not started",
|
|
@@ -2249,7 +2280,7 @@ var DEFAULT_WORDS = {
|
|
|
2249
2280
|
waiting: "Needs review",
|
|
2250
2281
|
blocked: "Waiting"
|
|
2251
2282
|
};
|
|
2252
|
-
|
|
2283
|
+
const LOOKS$2 = {
|
|
2253
2284
|
done: {
|
|
2254
2285
|
tone: "success",
|
|
2255
2286
|
icon: Check
|
|
@@ -2401,7 +2432,7 @@ function summariseWorkflow(stages, { running = false } = {}) {
|
|
|
2401
2432
|
total
|
|
2402
2433
|
});
|
|
2403
2434
|
}
|
|
2404
|
-
|
|
2435
|
+
const SUMMARY_LOOKS = {
|
|
2405
2436
|
running: {
|
|
2406
2437
|
tone: "info",
|
|
2407
2438
|
icon: Clock,
|
|
@@ -2467,8 +2498,9 @@ function WorkflowSummary({ stages, running, words, className }) {
|
|
|
2467
2498
|
})]
|
|
2468
2499
|
});
|
|
2469
2500
|
}
|
|
2501
|
+
|
|
2470
2502
|
// src/lib/breakpoint.ts
|
|
2471
|
-
|
|
2503
|
+
const DEFAULTS = {
|
|
2472
2504
|
sm: "40rem",
|
|
2473
2505
|
md: "48rem",
|
|
2474
2506
|
lg: "64rem"
|
|
@@ -2496,6 +2528,7 @@ function useNarrowerThan(active) {
|
|
|
2496
2528
|
}, [active]);
|
|
2497
2529
|
return below;
|
|
2498
2530
|
}
|
|
2531
|
+
|
|
2499
2532
|
// src/lib/choice.ts
|
|
2500
2533
|
function resolve(explicit, implies) {
|
|
2501
2534
|
const all = new Set(explicit);
|
|
@@ -2547,6 +2580,7 @@ function noteFor({ added, dropped, refused }) {
|
|
|
2547
2580
|
if (refused > 0) parts.push(refused === 1 ? "1 stays chosen because something chosen depends on it" : `${refused} stay chosen because something chosen depends on them`);
|
|
2548
2581
|
return parts.join(". ");
|
|
2549
2582
|
}
|
|
2583
|
+
|
|
2550
2584
|
// src/components/selection.tsx
|
|
2551
2585
|
function reconcile(prev, rows, keys, initial) {
|
|
2552
2586
|
const present = new Set(keys);
|
|
@@ -2564,7 +2598,7 @@ function reconcile(prev, rows, keys, initial) {
|
|
|
2564
2598
|
raw
|
|
2565
2599
|
};
|
|
2566
2600
|
}
|
|
2567
|
-
|
|
2601
|
+
const sameKeys = (a, b) => a.length === b.length && a.every((k, i) => k === b[i]);
|
|
2568
2602
|
/**
|
|
2569
2603
|
* Chosen row keys, pruned to the rows that exist, and the calls that change them. Spread into
|
|
2570
2604
|
* `DataTable`'s or `SelectableGrid`'s `selection` with a `rowLabel`. `initial` (keys, or a test on
|
|
@@ -2782,6 +2816,7 @@ function BulkBar({ count, noun, onClear, children, format: format$1 = format, cl
|
|
|
2782
2816
|
})]
|
|
2783
2817
|
});
|
|
2784
2818
|
}
|
|
2819
|
+
|
|
2785
2820
|
// src/components/disclosure.tsx
|
|
2786
2821
|
/** Shows more of one thing in place: a button with `aria-expanded` around `summary`, and a body mounted only while open (so a request inside it runs on first open). Controlled with `open`/`onOpenChange` or `useExpanded`, or uncontrolled with `defaultOpen`. */
|
|
2787
2822
|
function Disclosure({ summary, children, actions, open, defaultOpen = false, onOpenChange, className }) {
|
|
@@ -2872,12 +2907,13 @@ function useUrlExpanded(param, { single }) {
|
|
|
2872
2907
|
single
|
|
2873
2908
|
]);
|
|
2874
2909
|
}
|
|
2910
|
+
|
|
2875
2911
|
// src/components/data-table.tsx
|
|
2876
|
-
|
|
2912
|
+
const collator$1 = new Intl.Collator(void 0, {
|
|
2877
2913
|
numeric: true,
|
|
2878
2914
|
sensitivity: "base"
|
|
2879
2915
|
});
|
|
2880
|
-
|
|
2916
|
+
const kind = (v) => typeof v === "number" ? 0 : typeof v === "string" ? 1 : 2;
|
|
2881
2917
|
/** Orders two present values: numbers, then text (locale order, numbers in text read as numbers), then dates. */
|
|
2882
2918
|
function compareValues(a, b) {
|
|
2883
2919
|
if (kind(a) !== kind(b)) return kind(a) - kind(b);
|
|
@@ -2948,11 +2984,11 @@ function UrlSortedTable(props) {
|
|
|
2948
2984
|
sortState: useUrlSort(props.sortParam, props.initialSort)
|
|
2949
2985
|
});
|
|
2950
2986
|
}
|
|
2951
|
-
|
|
2987
|
+
const features = tableFeatures({
|
|
2952
2988
|
rowSortingFeature,
|
|
2953
2989
|
sortedRowModel: createSortedRowModel()
|
|
2954
2990
|
});
|
|
2955
|
-
|
|
2991
|
+
const HIDE_BELOW = {
|
|
2956
2992
|
sm: "max-sm:hidden",
|
|
2957
2993
|
md: "max-md:hidden",
|
|
2958
2994
|
lg: "max-lg:hidden"
|
|
@@ -3024,7 +3060,8 @@ function Table$1({ caption, columns: allColumns, rows, rowKey, sortState: [sort,
|
|
|
3024
3060
|
const shift = useShiftNote();
|
|
3025
3061
|
const pressed = React.useRef(null);
|
|
3026
3062
|
const notePress = (e) => void (pressed.current = e.target.closest("[data-key]")?.getAttribute("data-key") ?? null);
|
|
3027
|
-
const
|
|
3063
|
+
const sortedRows = React.useMemo(() => modelRows.map((r) => r.original), [modelRows]);
|
|
3064
|
+
const select = useSelectRows(sortedRows, rowKey, selection);
|
|
3028
3065
|
const changeSelection = (next) => {
|
|
3029
3066
|
if (!selection) return;
|
|
3030
3067
|
if (next !== "all") {
|
|
@@ -3182,9 +3219,9 @@ function Table$1({ caption, columns: allColumns, rows, rowKey, sortState: [sort,
|
|
|
3182
3219
|
}) : grid
|
|
3183
3220
|
});
|
|
3184
3221
|
}
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3222
|
+
const SELECT = "\0select";
|
|
3223
|
+
const EXPAND = "\0expand";
|
|
3224
|
+
const noop = () => {};
|
|
3188
3225
|
/** The loading placeholder for a `DataTable`, shaped like its rows. */
|
|
3189
3226
|
function TableSkeleton({ rows = 4, columns = 5 }) {
|
|
3190
3227
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -3199,8 +3236,9 @@ function TableSkeleton({ rows = 4, columns = 5 }) {
|
|
|
3199
3236
|
}, r))]
|
|
3200
3237
|
});
|
|
3201
3238
|
}
|
|
3239
|
+
|
|
3202
3240
|
// src/components/jobs-table.tsx
|
|
3203
|
-
|
|
3241
|
+
const LOOKS$1 = {
|
|
3204
3242
|
queued: {
|
|
3205
3243
|
tone: "neutral",
|
|
3206
3244
|
icon: Clock,
|
|
@@ -3315,8 +3353,9 @@ function JobsTable({ caption, jobs, describe = (j) => j.kind, onCancel, onRetry,
|
|
|
3315
3353
|
className: cn(className)
|
|
3316
3354
|
});
|
|
3317
3355
|
}
|
|
3356
|
+
|
|
3318
3357
|
// src/components/schedule-table.tsx
|
|
3319
|
-
|
|
3358
|
+
const LOOKS = {
|
|
3320
3359
|
ok: {
|
|
3321
3360
|
tone: "success",
|
|
3322
3361
|
icon: Check,
|
|
@@ -3401,8 +3440,9 @@ function ScheduleTable({ caption, rows, now, className }) {
|
|
|
3401
3440
|
className
|
|
3402
3441
|
});
|
|
3403
3442
|
}
|
|
3443
|
+
|
|
3404
3444
|
// src/components/film-strip.tsx
|
|
3405
|
-
|
|
3445
|
+
const GAP$1 = 4;
|
|
3406
3446
|
/** `n` of `items` spread evenly from the first to the last (all of them when there are no more than `n`). */
|
|
3407
3447
|
function pickEvenly(items, n) {
|
|
3408
3448
|
if (n <= 0) return [];
|
|
@@ -3485,6 +3525,7 @@ function FilmStrip({ label, frames, span, time, onSeek, aspect = "4/3", frameWid
|
|
|
3485
3525
|
})
|
|
3486
3526
|
});
|
|
3487
3527
|
}
|
|
3528
|
+
|
|
3488
3529
|
// src/components/media-contents.tsx
|
|
3489
3530
|
/** The index of the item whose span holds `time`, or -1. */
|
|
3490
3531
|
function currentItem(items, time) {
|
|
@@ -3505,7 +3546,7 @@ function MediaContents({ label, items, time, onSeek, onSelect, className }) {
|
|
|
3505
3546
|
}, item.id))
|
|
3506
3547
|
});
|
|
3507
3548
|
}
|
|
3508
|
-
|
|
3549
|
+
const ContentsRow = React.memo(function ContentsRow({ item, current, onSeek, onSelect }) {
|
|
3509
3550
|
const from = format.runningTime(item.start);
|
|
3510
3551
|
return /* @__PURE__ */ jsx("li", {
|
|
3511
3552
|
"aria-current": current ? "time" : void 0,
|
|
@@ -3538,8 +3579,9 @@ var ContentsRow = React.memo(function ContentsRow({ item, current, onSeek, onSel
|
|
|
3538
3579
|
})
|
|
3539
3580
|
});
|
|
3540
3581
|
});
|
|
3582
|
+
|
|
3541
3583
|
// src/components/media-skip.ts
|
|
3542
|
-
|
|
3584
|
+
const LEVEL_KIND = {
|
|
3543
3585
|
small: "scene",
|
|
3544
3586
|
large: "chapter"
|
|
3545
3587
|
};
|
|
@@ -3586,6 +3628,7 @@ function skipAction(marks, level, direction, time, { steps = {}, duration = null
|
|
|
3586
3628
|
by: "time"
|
|
3587
3629
|
};
|
|
3588
3630
|
}
|
|
3631
|
+
|
|
3589
3632
|
// src/components/fullscreen-frame.tsx
|
|
3590
3633
|
/** Whether this browser can show an element full screen. False in jsdom and on iPhone, where the modal fallback is used. */
|
|
3591
3634
|
function canFullscreen() {
|
|
@@ -3653,9 +3696,10 @@ function FullscreenFrame({ label, active, onActiveChange, modal: allowModal = tr
|
|
|
3653
3696
|
})
|
|
3654
3697
|
});
|
|
3655
3698
|
}
|
|
3699
|
+
|
|
3656
3700
|
// src/components/media.tsx
|
|
3657
|
-
|
|
3658
|
-
|
|
3701
|
+
const clamp$4 = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
3702
|
+
const timecode = (t, { precision, fps }) => format.timecode(t, {
|
|
3659
3703
|
precision,
|
|
3660
3704
|
fps
|
|
3661
3705
|
});
|
|
@@ -3695,14 +3739,14 @@ function TimeReadout({ time, duration, precision = "seconds", fps = 30, classNam
|
|
|
3695
3739
|
]
|
|
3696
3740
|
});
|
|
3697
3741
|
}
|
|
3698
|
-
|
|
3742
|
+
const SPAN_TONE = {
|
|
3699
3743
|
info: "bg-info",
|
|
3700
3744
|
success: "bg-success",
|
|
3701
3745
|
warning: "bg-warning",
|
|
3702
3746
|
danger: "bg-danger",
|
|
3703
3747
|
neutral: "bg-neutral-8"
|
|
3704
3748
|
};
|
|
3705
|
-
|
|
3749
|
+
const COLOUR_NAME = /^--[\w-]+$/;
|
|
3706
3750
|
/** One stretch drawn as a range of a bar of `duration` seconds, named with its times. Shared by the seek bar and the strip under the browser's own controls. */
|
|
3707
3751
|
function SpanRange({ span, duration, thin, ...time }) {
|
|
3708
3752
|
const name = `${span.label}, ${timecode(span.start, time)} to ${timecode(span.end, time)}`;
|
|
@@ -4189,27 +4233,28 @@ function StageGuides({ safe, thirds, centre, className }) {
|
|
|
4189
4233
|
children: [draw("stroke-foreground", 3), draw("stroke-background", 1)]
|
|
4190
4234
|
});
|
|
4191
4235
|
}
|
|
4236
|
+
|
|
4192
4237
|
// src/components/key-owner.ts
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4238
|
+
const members = /* @__PURE__ */ new Set();
|
|
4239
|
+
let active = null;
|
|
4240
|
+
let warned = false;
|
|
4241
|
+
let snapshot = {
|
|
4197
4242
|
count: 0,
|
|
4198
4243
|
active: null
|
|
4199
4244
|
};
|
|
4200
|
-
|
|
4201
|
-
|
|
4245
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
4246
|
+
const emit = () => {
|
|
4202
4247
|
snapshot = {
|
|
4203
4248
|
count: members.size,
|
|
4204
4249
|
active
|
|
4205
4250
|
};
|
|
4206
4251
|
listeners.forEach((l) => l());
|
|
4207
4252
|
};
|
|
4208
|
-
|
|
4253
|
+
const subscribe = (l) => {
|
|
4209
4254
|
listeners.add(l);
|
|
4210
4255
|
return () => void listeners.delete(l);
|
|
4211
4256
|
};
|
|
4212
|
-
|
|
4257
|
+
const get = () => snapshot;
|
|
4213
4258
|
/**
|
|
4214
4259
|
* Joins the page's key owners while `enabled`, and takes the keys whenever `playing` turns true. Spread nothing: call
|
|
4215
4260
|
* `claim` from the region's focus and pointer-down handlers, and bind the player's `useHotkeys` with `enabled: owner.owns`.
|
|
@@ -4248,8 +4293,9 @@ function useKeyOwner(enabled, playing = false) {
|
|
|
4248
4293
|
claim
|
|
4249
4294
|
};
|
|
4250
4295
|
}
|
|
4296
|
+
|
|
4251
4297
|
// src/components/media-group.tsx
|
|
4252
|
-
|
|
4298
|
+
const groups = /* @__PURE__ */ new Map();
|
|
4253
4299
|
/** Adds an element, or a `useTimeline` clock, to a named group until the returned function is called; whenever one plays, the others pause. */
|
|
4254
4300
|
function joinMediaGroup(name, el) {
|
|
4255
4301
|
let members = groups.get(name);
|
|
@@ -4265,7 +4311,7 @@ function joinMediaGroup(name, el) {
|
|
|
4265
4311
|
if (members.size === 0 && groups.get(name) === members) groups.delete(name);
|
|
4266
4312
|
};
|
|
4267
4313
|
}
|
|
4268
|
-
|
|
4314
|
+
const GroupContext = React.createContext(null);
|
|
4269
4315
|
/** The group a `MediaGroup` above this point names, or null. */
|
|
4270
4316
|
function useMediaGroupName() {
|
|
4271
4317
|
return React.useContext(GroupContext);
|
|
@@ -4279,7 +4325,7 @@ function MediaGroup({ name, children }) {
|
|
|
4279
4325
|
});
|
|
4280
4326
|
}
|
|
4281
4327
|
/** Whether two windows are the same stretch. */
|
|
4282
|
-
|
|
4328
|
+
const sameWindow = (a, b) => (a ?? null) === (b ?? null) || !!a && !!b && a.start === b.start && a.end === b.end;
|
|
4283
4329
|
/** A row's play button for one window of a shared element: named for what it plays, pressed while it plays, a second press pauses. */
|
|
4284
4330
|
function PlayWindowButton({ media, window: w, label, size = "sm", className }) {
|
|
4285
4331
|
const playing = media.playing && sameWindow(media.window, w);
|
|
@@ -4292,9 +4338,10 @@ function PlayWindowButton({ media, window: w, label, size = "sm", className }) {
|
|
|
4292
4338
|
onClick: () => playing ? media.pause() : void media.playWindow(w)
|
|
4293
4339
|
});
|
|
4294
4340
|
}
|
|
4341
|
+
|
|
4295
4342
|
// src/components/media-spans.tsx
|
|
4296
|
-
|
|
4297
|
-
|
|
4343
|
+
const lower = (label) => label.charAt(0).toLowerCase() + label.slice(1);
|
|
4344
|
+
const WORDS$1 = {
|
|
4298
4345
|
skip: (l) => `Skip ${lower(l)}`,
|
|
4299
4346
|
skipped: (l) => `Skipped ${lower(l)}`,
|
|
4300
4347
|
mute: (l) => `Mute ${lower(l)}`,
|
|
@@ -4302,7 +4349,7 @@ var WORDS$1 = {
|
|
|
4302
4349
|
undo: "Undo"
|
|
4303
4350
|
};
|
|
4304
4351
|
/** How long "Skipped intro, Undo" stays. */
|
|
4305
|
-
|
|
4352
|
+
const NOTICE_MS$1 = 6e3;
|
|
4306
4353
|
/** Draws the spans' ranges and acts on them as playback reaches them. See the file comment for the rules. */
|
|
4307
4354
|
function useMediaSpans({ spans, kinds = {}, words, onSpan, time, playing, duration, limit = Infinity, seek, volume, setVolume }) {
|
|
4308
4355
|
const w = {
|
|
@@ -4501,6 +4548,7 @@ function SpanActions({ state, other, className }) {
|
|
|
4501
4548
|
})]
|
|
4502
4549
|
});
|
|
4503
4550
|
}
|
|
4551
|
+
|
|
4504
4552
|
// src/components/media-progress.ts
|
|
4505
4553
|
function createWatchedRanges() {
|
|
4506
4554
|
let ranges = [];
|
|
@@ -4522,6 +4570,7 @@ function createWatchedRanges() {
|
|
|
4522
4570
|
clear: () => void (ranges = [])
|
|
4523
4571
|
};
|
|
4524
4572
|
}
|
|
4573
|
+
|
|
4525
4574
|
// src/components/link.tsx
|
|
4526
4575
|
function useTarget(target, newTab, state) {
|
|
4527
4576
|
const navigate = useNavigate();
|
|
@@ -4580,10 +4629,11 @@ function TextLink(all) {
|
|
|
4580
4629
|
children: [Icon && /* @__PURE__ */ jsx(Icon, { "aria-hidden": true }), children]
|
|
4581
4630
|
}));
|
|
4582
4631
|
}
|
|
4632
|
+
|
|
4583
4633
|
// src/components/media-player.tsx
|
|
4584
4634
|
/** How far one notch of the wheel over a focused video moves the volume, in percent. */
|
|
4585
|
-
|
|
4586
|
-
|
|
4635
|
+
const WHEEL_VOLUME_STEP = 5;
|
|
4636
|
+
const idle = {
|
|
4587
4637
|
ready: 0,
|
|
4588
4638
|
waitingForMore: false,
|
|
4589
4639
|
playing: false,
|
|
@@ -4597,7 +4647,7 @@ var idle = {
|
|
|
4597
4647
|
loading: false,
|
|
4598
4648
|
error: null
|
|
4599
4649
|
};
|
|
4600
|
-
|
|
4650
|
+
const LOAD_MESSAGES = {
|
|
4601
4651
|
2: "The connection dropped while it was loading.",
|
|
4602
4652
|
3: "The file could not be decoded.",
|
|
4603
4653
|
4: "This format is not supported or the file is not there."
|
|
@@ -4625,7 +4675,7 @@ function useElementListeners(ref, bind) {
|
|
|
4625
4675
|
bound.current = null;
|
|
4626
4676
|
}, []);
|
|
4627
4677
|
}
|
|
4628
|
-
|
|
4678
|
+
const EVENTS = [
|
|
4629
4679
|
"loadstart",
|
|
4630
4680
|
"loadedmetadata",
|
|
4631
4681
|
"durationchange",
|
|
@@ -5016,7 +5066,7 @@ function useAttachedSource(ref, src, attach, onProblem, growing, start) {
|
|
|
5016
5066
|
return React.useMemo(() => ({ reload: (at) => hold.current?.attachment.reload(at) }), []);
|
|
5017
5067
|
}
|
|
5018
5068
|
/** Playback speeds an audiobook or lecture listener expects. */
|
|
5019
|
-
|
|
5069
|
+
const SPEECH_RATES = [
|
|
5020
5070
|
.75,
|
|
5021
5071
|
1,
|
|
5022
5072
|
1.25,
|
|
@@ -5026,9 +5076,9 @@ var SPEECH_RATES = [
|
|
|
5026
5076
|
2.5,
|
|
5027
5077
|
3
|
|
5028
5078
|
];
|
|
5029
|
-
|
|
5079
|
+
const JUMP = 10;
|
|
5030
5080
|
/** How long a notice such as "Picked up at 2:05" stays once the player is playing. */
|
|
5031
|
-
|
|
5081
|
+
const NOTICE_MS = 6e3;
|
|
5032
5082
|
function useCoarsePointer() {
|
|
5033
5083
|
const [coarse, setCoarse] = React.useState(false);
|
|
5034
5084
|
React.useEffect(() => {
|
|
@@ -5819,11 +5869,12 @@ function HeadingLink({ to, state, className, label, children }) {
|
|
|
5819
5869
|
children
|
|
5820
5870
|
}));
|
|
5821
5871
|
}
|
|
5872
|
+
|
|
5822
5873
|
// src/lib/transcript.ts
|
|
5823
5874
|
/** The id of a word for marking (`TranscriptView`'s `marking`, `Mark`): its phrase and its place in it. */
|
|
5824
|
-
|
|
5875
|
+
const wordId = (phraseId, index) => `${phraseId}:${index}`;
|
|
5825
5876
|
/** The phrase an id made by `wordId` belongs to. */
|
|
5826
|
-
|
|
5877
|
+
const phraseOfWordId = (id) => id.slice(0, id.lastIndexOf(":"));
|
|
5827
5878
|
/** Whether a word is doubtful: the recogniser said so, or its confidence is under `below`. */
|
|
5828
5879
|
function isDoubtful(word, below = .6) {
|
|
5829
5880
|
return word.doubtful ?? (word.confidence !== void 0 && word.confidence < below);
|
|
@@ -5855,6 +5906,7 @@ function wordAt(phrase, time) {
|
|
|
5855
5906
|
else break;
|
|
5856
5907
|
return found;
|
|
5857
5908
|
}
|
|
5909
|
+
|
|
5858
5910
|
// src/lib/marks.ts
|
|
5859
5911
|
/** The ids from `a` to `b` inclusive, in document order whichever way round they are given. Empty when either is not in `ids`. */
|
|
5860
5912
|
function rangeBetween(ids, a, b) {
|
|
@@ -5880,8 +5932,9 @@ function stepId(ids, from, by) {
|
|
|
5880
5932
|
if (i < 0) return by >= 0 ? ids[0] : ids[ids.length - 1];
|
|
5881
5933
|
return ids[Math.min(Math.max(i + by, 0), ids.length - 1)];
|
|
5882
5934
|
}
|
|
5935
|
+
|
|
5883
5936
|
// src/components/markable-text.tsx
|
|
5884
|
-
|
|
5937
|
+
const TONE$2 = {
|
|
5885
5938
|
neutral: {
|
|
5886
5939
|
fill: "var(--muted)",
|
|
5887
5940
|
edge: "var(--muted-foreground)"
|
|
@@ -5903,7 +5956,7 @@ var TONE$2 = {
|
|
|
5903
5956
|
edge: "var(--danger)"
|
|
5904
5957
|
}
|
|
5905
5958
|
};
|
|
5906
|
-
|
|
5959
|
+
const MarksContext = React.createContext(null);
|
|
5907
5960
|
/** One word (or phrase, or clip) that can be marked. Draws its mark, its selection and the caret; inside a `MarkableText`. */
|
|
5908
5961
|
function Mark({ id, children, className, onClick, onHover }) {
|
|
5909
5962
|
const c = React.useContext(MarksContext);
|
|
@@ -6139,8 +6192,9 @@ function MarkableText({ label, ids, marks, kinds, onMark, clearKeys = [], onActi
|
|
|
6139
6192
|
]
|
|
6140
6193
|
});
|
|
6141
6194
|
}
|
|
6195
|
+
|
|
6142
6196
|
// src/components/virtual-list.tsx
|
|
6143
|
-
|
|
6197
|
+
const FOOTER = "\0footer";
|
|
6144
6198
|
/** A list that renders only its visible rows (React Aria's GridList and Virtualizer) from `virtualizeFrom` items, with arrow-key navigation between rows. */
|
|
6145
6199
|
function VirtualList({ label, items, itemKey, children, estimateSize = 48, rowHeight, height = 480, virtualizeFrom = 100, bounded = false, footer, className }) {
|
|
6146
6200
|
const virtual = items.length >= virtualizeFrom;
|
|
@@ -6180,10 +6234,11 @@ function VirtualList({ label, items, itemKey, children, estimateSize = 48, rowHe
|
|
|
6180
6234
|
children: list
|
|
6181
6235
|
}) : list;
|
|
6182
6236
|
}
|
|
6237
|
+
|
|
6183
6238
|
// src/components/transcript-view.tsx
|
|
6184
|
-
|
|
6185
|
-
|
|
6186
|
-
|
|
6239
|
+
const ALL = "all";
|
|
6240
|
+
const capital = (s) => s.charAt(0).toUpperCase() + s.slice(1);
|
|
6241
|
+
const range = (a, b) => `${format.runningTime(a)}–${format.runningTime(b)}`;
|
|
6187
6242
|
/** Timed text that follows playback: the heard word marked, any word or phrase pressed to play from, modes, speakers, follow and Jump to now. */
|
|
6188
6243
|
function TranscriptView({ label, groups, time, onSeek, marking, onCorrectionPress, mode: controlledMode, onModeChange, modeLabels = {}, speaker: controlledSpeaker, onSpeakerChange, follow = true, announce = false, renderPlay, doubtfulBelow = .6, states = [], onPhraseState, renderActions, onEdit, renderCard, cardDelay = 500, height = 480, className }) {
|
|
6189
6244
|
const [ownMode, setOwnMode] = React.useState("original");
|
|
@@ -6699,8 +6754,9 @@ function PhraseRow({ phrase, mode, active, word, onSeek, marking, onCorrectionPr
|
|
|
6699
6754
|
]
|
|
6700
6755
|
});
|
|
6701
6756
|
}
|
|
6757
|
+
|
|
6702
6758
|
// src/lib/waveform.ts
|
|
6703
|
-
|
|
6759
|
+
const isPair = (p) => typeof p.min === "object";
|
|
6704
6760
|
/** Makes the lowest and highest sample of each slice from either form. A magnitude `m` is the pair `-m` to `m`. */
|
|
6705
6761
|
function toPeakPair(peaks) {
|
|
6706
6762
|
if (isPair(peaks)) {
|
|
@@ -6808,15 +6864,16 @@ async function peaksFromAudio(audio, buckets, options = {}) {
|
|
|
6808
6864
|
};
|
|
6809
6865
|
}
|
|
6810
6866
|
/** The time at the pointer, given the visible range and the width. */
|
|
6811
|
-
|
|
6867
|
+
const timeAt = (px, width, from, to) => from + Math.min(Math.max(px, 0), width) / (width || 1) * (to - from);
|
|
6812
6868
|
/** Keeps a visible range of `span` seconds inside `0` to `duration`. */
|
|
6813
6869
|
function clampView(from, span, duration) {
|
|
6814
6870
|
const s = Math.min(Math.max(span, Math.min(duration, .05)), duration);
|
|
6815
6871
|
const a = Math.min(Math.max(from, 0), Math.max(duration - s, 0));
|
|
6816
6872
|
return [a, a + s];
|
|
6817
6873
|
}
|
|
6874
|
+
|
|
6818
6875
|
// src/components/waveform.tsx
|
|
6819
|
-
|
|
6876
|
+
const TONE$1 = {
|
|
6820
6877
|
neutral: {
|
|
6821
6878
|
fill: "var(--muted)",
|
|
6822
6879
|
edge: "var(--muted-foreground)"
|
|
@@ -6838,7 +6895,7 @@ var TONE$1 = {
|
|
|
6838
6895
|
edge: "var(--danger)"
|
|
6839
6896
|
}
|
|
6840
6897
|
};
|
|
6841
|
-
|
|
6898
|
+
const MARK_LINE = {
|
|
6842
6899
|
beat: {
|
|
6843
6900
|
width: 1,
|
|
6844
6901
|
opacity: .16
|
|
@@ -6857,7 +6914,7 @@ var MARK_LINE = {
|
|
|
6857
6914
|
dash: "4 3"
|
|
6858
6915
|
}
|
|
6859
6916
|
};
|
|
6860
|
-
|
|
6917
|
+
const WORDS = {
|
|
6861
6918
|
running: "Reading the waveform",
|
|
6862
6919
|
finished: "Waveform ready",
|
|
6863
6920
|
failed: "Could not read the waveform"
|
|
@@ -6872,8 +6929,8 @@ async function defaultDecode(data) {
|
|
|
6872
6929
|
ctx.close?.();
|
|
6873
6930
|
}
|
|
6874
6931
|
}
|
|
6875
|
-
|
|
6876
|
-
|
|
6932
|
+
const clamp$3 = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
6933
|
+
const clock = (t) => format.runningTime(t);
|
|
6877
6934
|
/** An audio waveform with marks, spans and a playhead: one slider you click, drag or key to seek, zoom, and a range to select. */
|
|
6878
6935
|
function Waveform({ label, peaks, source, duration: given, time, onSeek, marks = [], spans = [], underlay, range: controlledRange, onRangeChange, step = 5, bigStep = 30, defaultView, buckets = 2e3, normalise = false, decode = defaultDecode, words = WORDS, disabled, className }) {
|
|
6879
6936
|
const work = useClientWork(async ({ signal, progress }) => {
|
|
@@ -7319,8 +7376,9 @@ function Waveform({ label, peaks, source, duration: given, time, onSeek, marks =
|
|
|
7319
7376
|
]
|
|
7320
7377
|
});
|
|
7321
7378
|
}
|
|
7379
|
+
|
|
7322
7380
|
// src/components/use-timeline.ts
|
|
7323
|
-
|
|
7381
|
+
const clamp$2 = (v, lo, hi) => Math.min(Math.max(v, lo), hi);
|
|
7324
7382
|
/** A playhead the app owns, in the shape `Transport`, `SeekBar` and `transportShortcuts` take. */
|
|
7325
7383
|
function useTimeline({ duration, rate = 1, frame = 1 / 30, loop = false, startAt = "start", group, keys = true }) {
|
|
7326
7384
|
const length = Number.isFinite(duration) && duration > 0 ? duration : 0;
|
|
@@ -7421,6 +7479,7 @@ function useTimeline({ duration, rate = 1, frame = 1 / 30, loop = false, startAt
|
|
|
7421
7479
|
regionProps
|
|
7422
7480
|
};
|
|
7423
7481
|
}
|
|
7482
|
+
|
|
7424
7483
|
// src/components/timeline-player.tsx
|
|
7425
7484
|
/** A stage over a control bar for a timeline the app owns: transport, seek bar, time and speed, with the keys following the clock last used and the stage keeping its arrows. */
|
|
7426
7485
|
function TimelinePlayer({ clock, label, stage, rates, onRateChange, legend = false, className }) {
|
|
@@ -7487,9 +7546,10 @@ function TimelinePlayer({ clock, label, stage, rates, onRateChange, legend = fal
|
|
|
7487
7546
|
]
|
|
7488
7547
|
});
|
|
7489
7548
|
}
|
|
7549
|
+
|
|
7490
7550
|
// src/lib/timeline.ts
|
|
7491
7551
|
/** Steps a person would write on a scale, in seconds: 1, 2, 5 and 10 × 10ⁿ below a minute, then 15 s, 30 s, minutes, quarter hours, hours, days. ux-research components.md §3.8: ticks land on values people would write. */
|
|
7492
|
-
|
|
7552
|
+
const STEPS = [
|
|
7493
7553
|
.01,
|
|
7494
7554
|
.02,
|
|
7495
7555
|
.05,
|
|
@@ -7550,11 +7610,12 @@ function snapTo(time, points, pxPerUnit, thresholdPx = 8) {
|
|
|
7550
7610
|
};
|
|
7551
7611
|
}
|
|
7552
7612
|
/** Round away float noise from adding steps (0.1 + 0.2). */
|
|
7553
|
-
|
|
7613
|
+
const tidy = (n) => Math.round(n * 1e6) / 1e6;
|
|
7614
|
+
|
|
7554
7615
|
// src/components/timeline.tsx
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
|
|
7616
|
+
const EDGE_PX = 8;
|
|
7617
|
+
const DRAG_THRESHOLD = 3;
|
|
7618
|
+
const defaultFormat = (t) => tickLabel(t, 1);
|
|
7558
7619
|
/** Zoom state for a timeline: `zoomIn`, `zoomOut`, and `fit` to a viewport width. Pass `zoom` and `setZoom` as the timeline's `zoom` and `onZoomChange`. */
|
|
7559
7620
|
function useTimelineZoom({ initial = 20, min = .5, max = 400 } = {}) {
|
|
7560
7621
|
const [zoom, set] = React.useState(initial);
|
|
@@ -8190,7 +8251,8 @@ function Timeline({ label, lanes, items, from = 0, to, zoom, onZoomChange, posit
|
|
|
8190
8251
|
formatTime(info.next.start),
|
|
8191
8252
|
" to ",
|
|
8192
8253
|
formatTime(info.next.start + info.next.length),
|
|
8193
|
-
",
|
|
8254
|
+
",",
|
|
8255
|
+
" ",
|
|
8194
8256
|
laneLabel(info.next.lane)
|
|
8195
8257
|
] })
|
|
8196
8258
|
});
|
|
@@ -8240,10 +8302,11 @@ function LaneRow({ label, register, types, onHover, onLeave, onDropItems, childr
|
|
|
8240
8302
|
children
|
|
8241
8303
|
});
|
|
8242
8304
|
}
|
|
8305
|
+
|
|
8243
8306
|
// src/components/sortable-list.tsx
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8307
|
+
const KIND = "strata-kind/";
|
|
8308
|
+
const ID = "strata-item/id";
|
|
8309
|
+
const LIST = "strata-list/";
|
|
8247
8310
|
/** A list that reorders by drag and by keyboard, and takes items from other lists by kind. It reports what was asked and never changes the data itself. */
|
|
8248
8311
|
function SortableList({ label, items, getKey, getLabel, children, renderActions, empty, onReorder, onInsert, getKind = () => "item", accepts = [], refuses = {}, selectionMode = "none", selectedKeys, onSelectionChange, className }) {
|
|
8249
8312
|
const listId = React.useId();
|
|
@@ -8359,6 +8422,7 @@ function SortableList({ label, items, getKey, getLabel, children, renderActions,
|
|
|
8359
8422
|
})]
|
|
8360
8423
|
});
|
|
8361
8424
|
}
|
|
8425
|
+
|
|
8362
8426
|
// src/components/drag-source.tsx
|
|
8363
8427
|
/**
|
|
8364
8428
|
* The type every `DragSource` drag carries beside the app's own, so a drop target that takes only files (`FileDropZone`) can tell
|
|
@@ -8366,7 +8430,7 @@ function SortableList({ label, items, getKey, getLabel, children, renderActions,
|
|
|
8366
8430
|
* the types it is given, and React Aria's `DragTypes` cannot tell an app's `text/plain` from a dragged `.txt` file, so a type of
|
|
8367
8431
|
* our own is the one that can be recognised for certain.
|
|
8368
8432
|
*/
|
|
8369
|
-
|
|
8433
|
+
const STRATA_DRAG_TYPE = "application/x-strata-drag";
|
|
8370
8434
|
/** A row that can be dragged onto a drop target, such as a `Timeline` lane, by pointer or from the keyboard with its named grip. */
|
|
8371
8435
|
function DragSource({ label, items, onDragStart, onDragEnd, disabled, children, className }) {
|
|
8372
8436
|
const { dragProps, dragButtonProps, isDragging } = useDrag({
|
|
@@ -8398,6 +8462,7 @@ function DragSource({ label, items, onDragStart, onDragEnd, disabled, children,
|
|
|
8398
8462
|
})]
|
|
8399
8463
|
});
|
|
8400
8464
|
}
|
|
8465
|
+
|
|
8401
8466
|
// src/components/file-intake.tsx
|
|
8402
8467
|
/** The picker as a button. `children` is its visible name ("Add files"); `accept` narrows what the dialog shows. */
|
|
8403
8468
|
function FileButton({ accept, multiple = false, onFiles, icon: Icon, children, ...props }) {
|
|
@@ -8414,7 +8479,7 @@ function FileButton({ accept, multiple = false, onFiles, icon: Icon, children, .
|
|
|
8414
8479
|
})
|
|
8415
8480
|
});
|
|
8416
8481
|
}
|
|
8417
|
-
|
|
8482
|
+
const NEVER_CARRIED = "application/x-strata-never";
|
|
8418
8483
|
/** Whether a drag is the app's own, not files: it carries one of `refuse`, and the browser has not left its types unknown. */
|
|
8419
8484
|
function refusesDrag(types, refuse) {
|
|
8420
8485
|
return !types.has(NEVER_CARRIED) && refuse.some((type) => types.has(type));
|
|
@@ -8445,7 +8510,7 @@ function FileDropZone({ onFiles, acceptLabel, title, disabled, refuseTypes, chil
|
|
|
8445
8510
|
] })
|
|
8446
8511
|
});
|
|
8447
8512
|
}
|
|
8448
|
-
|
|
8513
|
+
const carriesFiles = (e, refuse) => {
|
|
8449
8514
|
const types = Array.from(e.dataTransfer?.types ?? []);
|
|
8450
8515
|
return types.includes("Files") && !refusesDrag({ has: (type) => types.includes(type) }, ["application/x-strata-drag", ...refuse]);
|
|
8451
8516
|
};
|
|
@@ -8521,7 +8586,7 @@ function FileDropOverlay({ onFiles, acceptLabel, disabled, refuseTypes }) {
|
|
|
8521
8586
|
})
|
|
8522
8587
|
});
|
|
8523
8588
|
}
|
|
8524
|
-
|
|
8589
|
+
const rowStatus = {
|
|
8525
8590
|
processing: {
|
|
8526
8591
|
tone: "info",
|
|
8527
8592
|
word: "Adding…",
|
|
@@ -8637,6 +8702,7 @@ function MissingFile({ name, accept, onRelink, thumbnail, className }) {
|
|
|
8637
8702
|
})]
|
|
8638
8703
|
});
|
|
8639
8704
|
}
|
|
8705
|
+
|
|
8640
8706
|
// src/lib/object-url.ts
|
|
8641
8707
|
/** Bytes (or a Blob) as an object URL: made once per value, revoked when the value changes or the component unmounts. `null` until made, and for `null` data. `type` is the MIME type for bytes ("audio/wav"); a Blob keeps its own unless `type` is given. */
|
|
8642
8708
|
function useObjectUrl(data, type) {
|
|
@@ -8656,8 +8722,9 @@ function useObjectUrl(data, type) {
|
|
|
8656
8722
|
}, [data, type]);
|
|
8657
8723
|
return url;
|
|
8658
8724
|
}
|
|
8725
|
+
|
|
8659
8726
|
// src/components/pixel-image.tsx
|
|
8660
|
-
|
|
8727
|
+
const sizeOf = (p) => p.image ? {
|
|
8661
8728
|
width: p.image.width,
|
|
8662
8729
|
height: p.image.height,
|
|
8663
8730
|
data: p.image.data
|
|
@@ -8741,25 +8808,26 @@ function rgbaToBlob(width, height, rgba) {
|
|
|
8741
8808
|
el.toBlob((blob) => blob ? resolve(blob) : reject(/* @__PURE__ */ new Error("The picture could not be saved.")), "image/png");
|
|
8742
8809
|
});
|
|
8743
8810
|
}
|
|
8811
|
+
|
|
8744
8812
|
// src/components/byte-view.tsx
|
|
8745
|
-
|
|
8746
|
-
|
|
8747
|
-
|
|
8748
|
-
|
|
8749
|
-
|
|
8813
|
+
const PER_ROW = 16;
|
|
8814
|
+
const ROW_PX = 20;
|
|
8815
|
+
const OVERSCAN = 4;
|
|
8816
|
+
const MAX_PX = 8e6;
|
|
8817
|
+
const tints = {
|
|
8750
8818
|
neutral: "bg-muted",
|
|
8751
8819
|
info: "bg-info-subtle",
|
|
8752
8820
|
success: "bg-success-subtle",
|
|
8753
8821
|
warning: "bg-warning-subtle",
|
|
8754
8822
|
danger: "bg-danger-subtle"
|
|
8755
8823
|
};
|
|
8756
|
-
|
|
8824
|
+
const cellStyle = (k) => ({
|
|
8757
8825
|
width: "2ch",
|
|
8758
8826
|
marginLeft: k === 8 ? "1ch" : void 0
|
|
8759
8827
|
});
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8828
|
+
const hex = (n, width = 2) => n.toString(16).padStart(width, "0");
|
|
8829
|
+
const tintOf = (h) => h ? tints[h.tone ?? "neutral"] : void 0;
|
|
8830
|
+
const printable = (b) => b >= 32 && b < 127 ? String.fromCharCode(b) : "·";
|
|
8763
8831
|
/** A virtualised hex dump: offsets, sixteen bytes a row and the printable characters, byte and range keyboard, and the selected range reported as `{ start, end }`. */
|
|
8764
8832
|
function ByteView({ bytes, label, offset = 0, highlight, defaultSelection, onSelectionChange, height = 320, className }) {
|
|
8765
8833
|
const total = bytes.length;
|
|
@@ -8987,8 +9055,9 @@ function ByteView({ bytes, label, offset = 0, highlight, defaultSelection, onSel
|
|
|
8987
9055
|
})]
|
|
8988
9056
|
});
|
|
8989
9057
|
}
|
|
9058
|
+
|
|
8990
9059
|
// src/components/console.tsx
|
|
8991
|
-
|
|
9060
|
+
const LEVEL_WORD = {
|
|
8992
9061
|
warning: {
|
|
8993
9062
|
word: "Warning",
|
|
8994
9063
|
tone: "warning"
|
|
@@ -8998,7 +9067,7 @@ var LEVEL_WORD = {
|
|
|
8998
9067
|
tone: "danger"
|
|
8999
9068
|
}
|
|
9000
9069
|
};
|
|
9001
|
-
|
|
9070
|
+
const lineKey = (line) => String(line.id);
|
|
9002
9071
|
function readHistory(key) {
|
|
9003
9072
|
if (!key) return [];
|
|
9004
9073
|
try {
|
|
@@ -9189,9 +9258,10 @@ function Console({ label, lines, onCommand, complete, historyKey, height = 320,
|
|
|
9189
9258
|
]
|
|
9190
9259
|
});
|
|
9191
9260
|
}
|
|
9261
|
+
|
|
9192
9262
|
// src/components/shortcut-editor.tsx
|
|
9193
|
-
|
|
9194
|
-
|
|
9263
|
+
const idOf = (s) => s.id ?? s.label;
|
|
9264
|
+
const MODIFIER_KEYS = /* @__PURE__ */ new Set([
|
|
9195
9265
|
"Shift",
|
|
9196
9266
|
"Control",
|
|
9197
9267
|
"Alt",
|
|
@@ -9443,6 +9513,7 @@ function ShortcutEditor({ rebinding, label = "Keyboard shortcuts", className })
|
|
|
9443
9513
|
})]
|
|
9444
9514
|
});
|
|
9445
9515
|
}
|
|
9516
|
+
|
|
9446
9517
|
// src/lib/file-intake.ts
|
|
9447
9518
|
/** Whether a file matches one entry of an `accept` list: extension, exact type or `family/*`, ignoring case. */
|
|
9448
9519
|
function matchesAccept(file, accept) {
|
|
@@ -9455,8 +9526,8 @@ function matchesAccept(file, accept) {
|
|
|
9455
9526
|
return type === a;
|
|
9456
9527
|
});
|
|
9457
9528
|
}
|
|
9458
|
-
|
|
9459
|
-
|
|
9529
|
+
const MB = 1048576;
|
|
9530
|
+
const sizeWords = (bytes) => bytes >= MB ? `${(bytes / MB).toFixed(bytes >= 100 * MB ? 0 : 1)} MB` : `${Math.max(1, Math.round(bytes / 1024))} kB`;
|
|
9460
9531
|
/** Per-file outcomes for files picked or dropped: type and size checks with a named reason, the app's own `process` per file, retry and dismiss. */
|
|
9461
9532
|
function useFileIntake(options) {
|
|
9462
9533
|
const [outcomes, setOutcomes] = React.useState([]);
|
|
@@ -9592,6 +9663,7 @@ function useFileIntake(options) {
|
|
|
9592
9663
|
pending
|
|
9593
9664
|
]);
|
|
9594
9665
|
}
|
|
9666
|
+
|
|
9595
9667
|
// src/components/inspector.tsx
|
|
9596
9668
|
function readRemembered(key) {
|
|
9597
9669
|
if (!key) return {};
|
|
@@ -9603,7 +9675,7 @@ function readRemembered(key) {
|
|
|
9603
9675
|
return {};
|
|
9604
9676
|
}
|
|
9605
9677
|
}
|
|
9606
|
-
|
|
9678
|
+
const InspectorContext = React.createContext(null);
|
|
9607
9679
|
/** A panel of properties for the selected thing: a labelled region with a heading, an empty state when `title` is null, and sections whose open state is remembered. */
|
|
9608
9680
|
function Inspector({ title, kind, empty, selectionKey, storageKey, actions, summary, children, className }) {
|
|
9609
9681
|
const headingId = React.useId();
|
|
@@ -9771,11 +9843,14 @@ function PropertyList({ items, label, className }) {
|
|
|
9771
9843
|
})
|
|
9772
9844
|
});
|
|
9773
9845
|
}
|
|
9846
|
+
|
|
9774
9847
|
// src/lib/grouped-grid-layout.ts
|
|
9775
9848
|
/** Keys of group headings start with this, so a tile key that is a plain id can never be mistaken for one. */
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9849
|
+
const GROUP_PREFIX = "group";
|
|
9850
|
+
const groupKey = (group) => `${GROUP_PREFIX}${group}`;
|
|
9851
|
+
const isGroupKey = (key) => typeof key === "string" && key.startsWith("group");
|
|
9852
|
+
/** The height of a group's heading row, in px. */
|
|
9853
|
+
const HEADER_HEIGHT = 40;
|
|
9779
9854
|
/**
|
|
9780
9855
|
* Rows of equal height, each picture at its own shape (Google Photos, Lightroom): fill a row with
|
|
9781
9856
|
* pictures at the target height `rowHeight` until it is full, then scale the row's height so it spans
|
|
@@ -9928,31 +10003,32 @@ var GroupedGridLayout = class extends GridLayout {
|
|
|
9928
10003
|
return [...visible.filter((l) => l.key !== current.key), stuck];
|
|
9929
10004
|
}
|
|
9930
10005
|
};
|
|
10006
|
+
|
|
9931
10007
|
// src/components/tile-grid.tsx
|
|
9932
|
-
|
|
10008
|
+
const minWidth = {
|
|
9933
10009
|
sm: 96,
|
|
9934
10010
|
md: 144,
|
|
9935
10011
|
lg: 192
|
|
9936
10012
|
};
|
|
9937
|
-
|
|
10013
|
+
const aspectClass = {
|
|
9938
10014
|
square: "aspect-square",
|
|
9939
10015
|
portrait: "aspect-3/4",
|
|
9940
10016
|
landscape: "aspect-4/3"
|
|
9941
10017
|
};
|
|
9942
|
-
|
|
10018
|
+
const aspectRatio = {
|
|
9943
10019
|
square: 1,
|
|
9944
10020
|
portrait: 4 / 3,
|
|
9945
10021
|
landscape: 3 / 4
|
|
9946
10022
|
};
|
|
9947
|
-
|
|
10023
|
+
const thumbnailAspect = {
|
|
9948
10024
|
square: 1,
|
|
9949
10025
|
portrait: 3 / 4,
|
|
9950
10026
|
landscape: 4 / 3
|
|
9951
10027
|
};
|
|
9952
|
-
|
|
9953
|
-
|
|
10028
|
+
const GAP = 12;
|
|
10029
|
+
const TILE_CHROME = 40;
|
|
9954
10030
|
/** A tile size as pixels: a named size's minimum width, or the number itself (a continuous size, issue #246). */
|
|
9955
|
-
|
|
10031
|
+
const tileWidth = (size) => typeof size === "number" ? size : minWidth[size];
|
|
9956
10032
|
/** `GridLayout` options for tiles of this size and aspect: they grow from the minimum width to fill the row, and each row is as tall as its tallest tile as measured. */
|
|
9957
10033
|
function tileLayoutOptions(tileSize, aspect) {
|
|
9958
10034
|
const w = tileWidth(tileSize);
|
|
@@ -10057,6 +10133,7 @@ function SelectableGridSkeleton({ count = 24, aspect = "square", tileSize = "md"
|
|
|
10057
10133
|
}, i))
|
|
10058
10134
|
});
|
|
10059
10135
|
}
|
|
10136
|
+
|
|
10060
10137
|
// src/components/selectable-grid.tsx
|
|
10061
10138
|
/** A grid of pictures to choose from: each tile one labelled target, "Select all shown", Shift-click ranges, virtualised from `virtualizeFrom` tiles. Pair with `useSelection` and a `BulkBar`. */
|
|
10062
10139
|
function SelectableGrid({ label, rows, rowKey, renderImage, detail, selection, aspect = "square", naturalAspect, tileSize = "md", onTileSizeChange, zoomRange = [64, 320], selectionMode = "multiple", selectionBehavior = "toggle", onAction, badge, mark, fit = "cover", groupBy, groupHeading, unselectableReason, virtualizeFrom = 100, maxHeight = 480, className }) {
|
|
@@ -10498,8 +10575,11 @@ function TileBox({ label }) {
|
|
|
10498
10575
|
})
|
|
10499
10576
|
});
|
|
10500
10577
|
}
|
|
10578
|
+
|
|
10501
10579
|
// src/components/compare-parts.tsx
|
|
10502
|
-
|
|
10580
|
+
const VIEWPORT_HEIGHT = "max(16rem, calc(100svh - 14rem))";
|
|
10581
|
+
/** The least a frame is made, however little room is left: a pair this small can still be told apart. */
|
|
10582
|
+
const MIN_FIT = 120;
|
|
10503
10583
|
/** The tallest each row of frames may be so that all of `chrome` and `rows` rows fit in `space` pixels. Pure, so it is tested without a layout. */
|
|
10504
10584
|
function fitFrames({ space, chrome, rows, min = 120 }) {
|
|
10505
10585
|
return Math.max(min, Math.floor((space - chrome) / Math.max(1, rows)));
|
|
@@ -10684,7 +10764,7 @@ function Picture({ c, blind, missing, onNatural, imgRef, pixelated }) {
|
|
|
10684
10764
|
className: "absolute inset-0 size-full object-contain"
|
|
10685
10765
|
})] });
|
|
10686
10766
|
}
|
|
10687
|
-
|
|
10767
|
+
const frameSize = (frame) => {
|
|
10688
10768
|
const r = frame.current?.getBoundingClientRect();
|
|
10689
10769
|
return {
|
|
10690
10770
|
width: r?.width ?? 0,
|
|
@@ -10795,6 +10875,7 @@ function useWidth$1(ref) {
|
|
|
10795
10875
|
});
|
|
10796
10876
|
return width;
|
|
10797
10877
|
}
|
|
10878
|
+
|
|
10798
10879
|
// src/components/viewport.tsx
|
|
10799
10880
|
/** Zoom and pan held in React state, to give to every `ViewportFrame` that should move together. */
|
|
10800
10881
|
function useViewport(initial = FIT) {
|
|
@@ -10804,15 +10885,15 @@ function useViewport(initial = FIT) {
|
|
|
10804
10885
|
setViewport
|
|
10805
10886
|
};
|
|
10806
10887
|
}
|
|
10807
|
-
|
|
10888
|
+
const PAN_STEP = 48;
|
|
10808
10889
|
/** A pointer that moves further than this between down and up is a pan, not a click. */
|
|
10809
|
-
|
|
10890
|
+
const CLICK_SLOP = 4;
|
|
10810
10891
|
/** A press held longer than this is not a click. */
|
|
10811
|
-
|
|
10892
|
+
const CLICK_MAX_MS = 500;
|
|
10812
10893
|
/** A click counts only once this long has passed with no second press: a double click zooms instead. */
|
|
10813
|
-
|
|
10894
|
+
const DOUBLE_CLICK_MS = 300;
|
|
10814
10895
|
/** A clipped frame whose children zoom and pan together; the viewport is the caller's, so frames can share one. */
|
|
10815
|
-
|
|
10896
|
+
const ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, viewport, setViewport, children, cover, overlay, maxHeight, onBox, outline, pick, className }, forwardedRef) {
|
|
10816
10897
|
const ref = React.useRef(null);
|
|
10817
10898
|
React.useImperativeHandle(forwardedRef, () => ref.current);
|
|
10818
10899
|
const latest = React.useRef(viewport);
|
|
@@ -11072,6 +11153,7 @@ var ViewportFrame = React.forwardRef(function ViewportFrame({ label, aspect, vie
|
|
|
11072
11153
|
]
|
|
11073
11154
|
});
|
|
11074
11155
|
});
|
|
11156
|
+
|
|
11075
11157
|
// src/components/lightbox.tsx
|
|
11076
11158
|
/** Keeps the open picture in the URL (`?view=<id>`): a link or a reload opens it, Back closes it, and stepping between pictures replaces the entry. */
|
|
11077
11159
|
function useLightboxUrl(items, { param = "view" } = {}) {
|
|
@@ -11093,7 +11175,7 @@ function useLightboxUrl(items, { param = "view" } = {}) {
|
|
|
11093
11175
|
show: (to) => set(to, false)
|
|
11094
11176
|
};
|
|
11095
11177
|
}
|
|
11096
|
-
|
|
11178
|
+
const NARROW = "(max-width: 719px)";
|
|
11097
11179
|
function useNarrow() {
|
|
11098
11180
|
const [narrow, setNarrow] = React.useState(() => typeof matchMedia === "function" && matchMedia(NARROW).matches);
|
|
11099
11181
|
React.useEffect(() => {
|
|
@@ -11135,7 +11217,7 @@ function Lightbox({ title, items, index, onIndexChange, open, onOpenChange, miss
|
|
|
11135
11217
|
items
|
|
11136
11218
|
]);
|
|
11137
11219
|
const go = (to) => onIndexChange(Math.min(Math.max(to, 0), last));
|
|
11138
|
-
const keys = React.useRef((
|
|
11220
|
+
const keys = React.useRef((() => {}));
|
|
11139
11221
|
keys.current = (e) => {
|
|
11140
11222
|
if (e.defaultPrevented || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
11141
11223
|
if (e.target.closest?.("[role=\"toolbar\"], [role=\"listbox\"], input, textarea, select, [contenteditable=\"true\"]")) return;
|
|
@@ -11293,8 +11375,9 @@ function ThumbnailStrip({ items, at, onPick, badge, label = "Pictures in this se
|
|
|
11293
11375
|
}, it.id))
|
|
11294
11376
|
});
|
|
11295
11377
|
}
|
|
11378
|
+
|
|
11296
11379
|
// src/components/view-options.tsx
|
|
11297
|
-
|
|
11380
|
+
const collator = new Intl.Collator(void 0, {
|
|
11298
11381
|
numeric: true,
|
|
11299
11382
|
sensitivity: "base"
|
|
11300
11383
|
});
|
|
@@ -11320,7 +11403,7 @@ function sortRows(rows, value, descending = false) {
|
|
|
11320
11403
|
});
|
|
11321
11404
|
return keyed.map((k) => k.row);
|
|
11322
11405
|
}
|
|
11323
|
-
|
|
11406
|
+
const storeKey = (id) => `strata-view:${id}`;
|
|
11324
11407
|
function readStore(id) {
|
|
11325
11408
|
try {
|
|
11326
11409
|
const raw = localStorage.getItem(storeKey(id));
|
|
@@ -11500,7 +11583,7 @@ function useUrlView(names) {
|
|
|
11500
11583
|
}, { replace: true })
|
|
11501
11584
|
};
|
|
11502
11585
|
}
|
|
11503
|
-
|
|
11586
|
+
const ASPECTS = {
|
|
11504
11587
|
square: "Square",
|
|
11505
11588
|
portrait: "Portrait",
|
|
11506
11589
|
landscape: "Landscape"
|
|
@@ -11622,13 +11705,14 @@ function ViewOptions({ view, shown, total, label = "View options", className })
|
|
|
11622
11705
|
]
|
|
11623
11706
|
});
|
|
11624
11707
|
}
|
|
11708
|
+
|
|
11625
11709
|
// src/components/choice-grid.tsx
|
|
11626
|
-
|
|
11710
|
+
const minSide = {
|
|
11627
11711
|
md: 120,
|
|
11628
11712
|
lg: 160
|
|
11629
11713
|
};
|
|
11630
|
-
|
|
11631
|
-
|
|
11714
|
+
const closed = (s) => s === "right" || s === "answer" || s === "picked";
|
|
11715
|
+
const columns = (size) => ({ gridTemplateColumns: `repeat(auto-fill, minmax(min(${minSide[size]}px, 100%), 1fr))` });
|
|
11632
11716
|
/** A grid of large picture tiles for answering one question with a tap: each tile open, wrong, right, shown as the answer or (no answer key) picked, with its word; answered tiles cannot be pressed again, and the grid closes once the answer shows. */
|
|
11633
11717
|
function ChoiceGrid({ label, items, itemKey, itemLabel, renderPicture, state, marks, onChoose, size = "md", className }) {
|
|
11634
11718
|
const byKey = new Map(items.map((item) => [itemKey(item), item]));
|
|
@@ -11677,11 +11761,12 @@ function ChoiceGridSkeleton({ count = 4, size = "md", className }) {
|
|
|
11677
11761
|
children: Array.from({ length: count }, (_, i) => /* @__PURE__ */ jsx("span", { className: "block aspect-square rounded-overlay bg-muted" }, i))
|
|
11678
11762
|
});
|
|
11679
11763
|
}
|
|
11764
|
+
|
|
11680
11765
|
// src/components/place-board.tsx
|
|
11681
|
-
|
|
11682
|
-
|
|
11683
|
-
|
|
11684
|
-
|
|
11766
|
+
const pieceSide = 96;
|
|
11767
|
+
const placedSide = 72;
|
|
11768
|
+
const placedPicture = { "--type-picture-size": "2.5rem" };
|
|
11769
|
+
const placeSide = 160;
|
|
11685
11770
|
/** Pictures put into places with two taps (pick up, put down) for an answer that is an arrangement: give a number, order, match, sort. The app owns where each piece is and checks it; the board only moves what the learner asks. */
|
|
11686
11771
|
function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places, placeKey, placeLabel, renderPlace, placement, onMove, pileLabel, placeState = () => "open", marks, locked = false, className }) {
|
|
11687
11772
|
const [heldKey, setHeld] = React.useState(null);
|
|
@@ -11782,8 +11867,9 @@ function PlaceBoard({ label, pieces, pieceKey, pieceLabel, renderPiece, places,
|
|
|
11782
11867
|
})]
|
|
11783
11868
|
});
|
|
11784
11869
|
}
|
|
11870
|
+
|
|
11785
11871
|
// src/components/infinite-list.tsx
|
|
11786
|
-
|
|
11872
|
+
const PendingFocus = React.createContext(null);
|
|
11787
11873
|
function MoreFailed({ message, retry }) {
|
|
11788
11874
|
return /* @__PURE__ */ jsxs("div", {
|
|
11789
11875
|
className: "flex flex-wrap items-start gap-3 border-t border-border bg-danger-subtle px-3 py-2 text-danger",
|
|
@@ -11804,7 +11890,7 @@ function MoreFailed({ message, retry }) {
|
|
|
11804
11890
|
]
|
|
11805
11891
|
});
|
|
11806
11892
|
}
|
|
11807
|
-
|
|
11893
|
+
const defaultMoreError = (failure) => /* @__PURE__ */ jsx(MoreFailed, { ...failure });
|
|
11808
11894
|
/**
|
|
11809
11895
|
* The row after a cursor-paged list or grid: loads the next page as it nears the screen, shows
|
|
11810
11896
|
* `moreSkeleton` while it comes, says why it failed with Try again, offers Show more for the
|
|
@@ -11984,8 +12070,9 @@ function InfiniteList({ state, label, children, skeleton, empty, moreLabel, more
|
|
|
11984
12070
|
})
|
|
11985
12071
|
});
|
|
11986
12072
|
}
|
|
12073
|
+
|
|
11987
12074
|
// src/components/line-chart.tsx
|
|
11988
|
-
|
|
12075
|
+
const TONE_FILL = {
|
|
11989
12076
|
neutral: "var(--muted)",
|
|
11990
12077
|
info: "var(--info-subtle)",
|
|
11991
12078
|
success: "var(--success-subtle)",
|
|
@@ -12059,7 +12146,7 @@ function yScale(values, pin = {}) {
|
|
|
12059
12146
|
].map((i) => min + (max - min) * i / 4)
|
|
12060
12147
|
};
|
|
12061
12148
|
}
|
|
12062
|
-
|
|
12149
|
+
const linearScale = (values, pin) => {
|
|
12063
12150
|
const y = yScale(values, pin);
|
|
12064
12151
|
return {
|
|
12065
12152
|
...y,
|
|
@@ -12144,7 +12231,7 @@ function valueAt(series, x) {
|
|
|
12144
12231
|
return sorted[sorted.length - 1].y;
|
|
12145
12232
|
}
|
|
12146
12233
|
/** Roughly how wide a 12px caption label is, in px. jsdom cannot measure text, so the chart estimates. */
|
|
12147
|
-
|
|
12234
|
+
const labelWidth = (text) => text.length * 7;
|
|
12148
12235
|
/**
|
|
12149
12236
|
* The x ticks that fit at this width: every k-th tick, the smallest k for which neighbouring labels
|
|
12150
12237
|
* leave a gap, so the spacing stays even. `scale` maps an x value to a pixel.
|
|
@@ -12899,6 +12986,7 @@ function LineChartGroup({ label, charts, formatX, xLabel, xTicks, spans, marks,
|
|
|
12899
12986
|
children: stack
|
|
12900
12987
|
});
|
|
12901
12988
|
}
|
|
12989
|
+
|
|
12902
12990
|
// src/components/page-header.tsx
|
|
12903
12991
|
/** The top of an Operate screen: a noun title, its scope, the main action, and the finding (the one fact in today's data that most needs attention). */
|
|
12904
12992
|
function PageHeader({ title, scope, actions, finding, as: Heading = "h1" }) {
|
|
@@ -12928,6 +13016,7 @@ function PageHeader({ title, scope, actions, finding, as: Heading = "h1" }) {
|
|
|
12928
13016
|
})]
|
|
12929
13017
|
});
|
|
12930
13018
|
}
|
|
13019
|
+
|
|
12931
13020
|
// src/components/undo.tsx
|
|
12932
13021
|
/**
|
|
12933
13022
|
* Schedules a reversible removal to commit after a window unless undone, and owns which items
|
|
@@ -13093,6 +13182,7 @@ function UndoBar({ undoable, inline = false }) {
|
|
|
13093
13182
|
})
|
|
13094
13183
|
});
|
|
13095
13184
|
}
|
|
13185
|
+
|
|
13096
13186
|
// src/components/done.tsx
|
|
13097
13187
|
/** The completion moment for a rare, earned finish: what happened (past tense, with its object), what happens next, and optionally a figure drawn from the person's own data. Focus moves to the heading. */
|
|
13098
13188
|
function Done({ title, next, figure, actions, focusOnMount = true, className }) {
|
|
@@ -13129,6 +13219,7 @@ function Done({ title, next, figure, actions, focusOnMount = true, className })
|
|
|
13129
13219
|
]
|
|
13130
13220
|
});
|
|
13131
13221
|
}
|
|
13222
|
+
|
|
13132
13223
|
// src/components/app-shell.tsx
|
|
13133
13224
|
/** The app frame: product name, side nav on the page ground (a scrollable row on phones), optional top bar, and the main region. */
|
|
13134
13225
|
function AppShell({ product, nav, navLabel = "Main", topBar, children, className }) {
|
|
@@ -13209,6 +13300,7 @@ function Breadcrumb({ items }) {
|
|
|
13209
13300
|
})
|
|
13210
13301
|
});
|
|
13211
13302
|
}
|
|
13303
|
+
|
|
13212
13304
|
// src/components/tabs.tsx
|
|
13213
13305
|
/** Tabs whose selection lives in a URL search parameter (React Router), with the ARIA tabs keyboard model. */
|
|
13214
13306
|
function Tabs({ param, items, label, children, className }) {
|
|
@@ -13241,6 +13333,7 @@ function Tabs({ param, items, label, children, className }) {
|
|
|
13241
13333
|
})]
|
|
13242
13334
|
});
|
|
13243
13335
|
}
|
|
13336
|
+
|
|
13244
13337
|
// src/components/active-list.tsx
|
|
13245
13338
|
/** Tracks the active item in a list worked through from the keyboard: moving, roving focus, and moving on when the active item is removed. */
|
|
13246
13339
|
function useActiveItem(items, getKey, { initial, noun } = {}) {
|
|
@@ -13362,6 +13455,7 @@ function ActiveList({ label, active, empty, children, className }) {
|
|
|
13362
13455
|
})
|
|
13363
13456
|
});
|
|
13364
13457
|
}
|
|
13458
|
+
|
|
13365
13459
|
// src/query/outbox.ts
|
|
13366
13460
|
/** Whether a failure is the server's answer for good (refused) rather than for now (waiting). */
|
|
13367
13461
|
function isRefusal(error) {
|
|
@@ -13609,6 +13703,7 @@ function useOutbox(outbox) {
|
|
|
13609
13703
|
function useOutboxStarted(outbox) {
|
|
13610
13704
|
React.useEffect(() => outbox.start(), [outbox]);
|
|
13611
13705
|
}
|
|
13706
|
+
|
|
13612
13707
|
// src/components/outbox-status.tsx
|
|
13613
13708
|
/** Says how many writes wait on this device and why, with Send now, and lists any the server refused; renders nothing while all is sent. */
|
|
13614
13709
|
function OutboxStatus({ outbox, noun, className }) {
|
|
@@ -13665,6 +13760,7 @@ function OutboxStatus({ outbox, noun, className }) {
|
|
|
13665
13760
|
})]
|
|
13666
13761
|
});
|
|
13667
13762
|
}
|
|
13763
|
+
|
|
13668
13764
|
// src/query/reserve.ts
|
|
13669
13765
|
function defaultStorage() {
|
|
13670
13766
|
try {
|
|
@@ -13763,8 +13859,9 @@ function useReserve(reserve, key) {
|
|
|
13763
13859
|
}, [reserve]);
|
|
13764
13860
|
return React.useSyncExternalStore(subscribe, () => reserve.kept(key), () => 0);
|
|
13765
13861
|
}
|
|
13862
|
+
|
|
13766
13863
|
// src/lib/speech.ts
|
|
13767
|
-
|
|
13864
|
+
const partsOf = (saying) => (typeof saying === "string" ? [{ text: saying }] : [...saying]).filter((p) => p.text.trim() || p.clip);
|
|
13768
13865
|
/** The words of what is said, as one sentence: what the browser's voice says when a recording is missing, and the button's name. */
|
|
13769
13866
|
function textOf(saying) {
|
|
13770
13867
|
return partsOf(saying).map((p) => p.text.trim()).filter(Boolean).join(" ");
|
|
@@ -13773,7 +13870,7 @@ function textOf(saying) {
|
|
|
13773
13870
|
function canPlayClips() {
|
|
13774
13871
|
return typeof window !== "undefined" && typeof window.Audio === "function";
|
|
13775
13872
|
}
|
|
13776
|
-
|
|
13873
|
+
const allRecorded = (parts) => parts.length > 0 && parts.every((p) => p.clip);
|
|
13777
13874
|
/** Whether `saying` can be said here: every part recorded and audio plays, or the browser has speech and there are words. */
|
|
13778
13875
|
function canSay(saying) {
|
|
13779
13876
|
const parts = partsOf(saying);
|
|
@@ -13791,7 +13888,7 @@ function pickVoice(voices, lang) {
|
|
|
13791
13888
|
return voices.find((v) => v.lang.toLowerCase().replace("_", "-") === wanted) ?? voices.find((v) => v.lang.toLowerCase().replace("_", "-").split("-")[0] === base);
|
|
13792
13889
|
}
|
|
13793
13890
|
/** The recording playing now, so the next prompt or `stopSpeaking` can cut it off. */
|
|
13794
|
-
|
|
13891
|
+
let playing;
|
|
13795
13892
|
function speakText(text, { lang, rate = .9, onEnd }) {
|
|
13796
13893
|
if (!canSpeak() || !text.trim()) return false;
|
|
13797
13894
|
const synth = window.speechSynthesis;
|
|
@@ -13905,10 +14002,11 @@ function useSpeech({ lang, rate, muted = false } = {}) {
|
|
|
13905
14002
|
}, [])
|
|
13906
14003
|
};
|
|
13907
14004
|
}
|
|
14005
|
+
|
|
13908
14006
|
// src/query/clips.tsx
|
|
13909
14007
|
/** The query key of the clip list: invalidate it after a recording is kept, `queryClient.invalidateQueries({ queryKey: clipsQueryKey })`. */
|
|
13910
|
-
|
|
13911
|
-
|
|
14008
|
+
const clipsQueryKey = ["strata", "clips"];
|
|
14009
|
+
const Context$1 = React.createContext({
|
|
13912
14010
|
ready: true,
|
|
13913
14011
|
parts: (text) => [{
|
|
13914
14012
|
text,
|
|
@@ -13978,6 +14076,7 @@ function useSayOnShow(text, { muted = false } = {}) {
|
|
|
13978
14076
|
text
|
|
13979
14077
|
]);
|
|
13980
14078
|
}
|
|
14079
|
+
|
|
13981
14080
|
// src/components/say-again.tsx
|
|
13982
14081
|
/** An icon button that says one sentence aloud, from its recordings when given, else with the browser's voice; hidden where neither can be heard or it is muted. */
|
|
13983
14082
|
function SayAgain({ text, parts, verb = "Say", className, ...options }) {
|
|
@@ -13996,9 +14095,10 @@ function SayAgain({ text, parts, verb = "Say", className, ...options }) {
|
|
|
13996
14095
|
className
|
|
13997
14096
|
});
|
|
13998
14097
|
}
|
|
14098
|
+
|
|
13999
14099
|
// src/lib/recording.ts
|
|
14000
14100
|
/** The quietest level a speech meter draws, in dBFS: below it is silence for speech. */
|
|
14001
|
-
|
|
14101
|
+
const LEVEL_FLOOR_DB = -60;
|
|
14002
14102
|
/** Joins chunks of samples into one buffer, in order. */
|
|
14003
14103
|
function joinSamples(chunks) {
|
|
14004
14104
|
const out = new Float32Array(chunks.reduce((n, c) => n + c.length, 0));
|
|
@@ -14059,6 +14159,7 @@ function speechLevel(peak) {
|
|
|
14059
14159
|
advice: "The level suits speech."
|
|
14060
14160
|
};
|
|
14061
14161
|
}
|
|
14162
|
+
|
|
14062
14163
|
// src/components/recorder.tsx
|
|
14063
14164
|
/** Records one take at a time from the microphone, with its live level, as a lossless WAV. */
|
|
14064
14165
|
function useRecorder({ maxSeconds, microphone }) {
|
|
@@ -14152,8 +14253,8 @@ function useRecorder({ maxSeconds, microphone }) {
|
|
|
14152
14253
|
};
|
|
14153
14254
|
}
|
|
14154
14255
|
/** `InputLevel`'s "Too loud" notch: -3 dBFS on the meter's `LEVEL_FLOOR_DB`..0 scale. */
|
|
14155
|
-
|
|
14156
|
-
at: -
|
|
14256
|
+
const inputLevelThresholds = [{
|
|
14257
|
+
at: (-60 + 3) / -60,
|
|
14157
14258
|
tone: "danger",
|
|
14158
14259
|
label: "Too loud"
|
|
14159
14260
|
}];
|
|
@@ -14163,7 +14264,7 @@ function InputLevel({ level, seconds, maxSeconds, label = "Input level", classNa
|
|
|
14163
14264
|
return /* @__PURE__ */ jsx(Meter, {
|
|
14164
14265
|
label,
|
|
14165
14266
|
value: db - -60,
|
|
14166
|
-
max: 60,
|
|
14267
|
+
max: - -60,
|
|
14167
14268
|
thresholds: inputLevelThresholds,
|
|
14168
14269
|
valueText: `${format.integer(Math.round(db) || 0)}\u00a0dBFS`,
|
|
14169
14270
|
detail: `Recording ${format.runningTime(seconds)} of at most ${format.runningTime(maxSeconds)}`,
|
|
@@ -14189,13 +14290,14 @@ function TakeLevel({ peak, lead, className }) {
|
|
|
14189
14290
|
})]
|
|
14190
14291
|
});
|
|
14191
14292
|
}
|
|
14293
|
+
|
|
14192
14294
|
// src/lib/segmenter.ts
|
|
14193
|
-
|
|
14194
|
-
|
|
14195
|
-
|
|
14196
|
-
|
|
14197
|
-
|
|
14198
|
-
|
|
14295
|
+
const FRAME_SECONDS = .02;
|
|
14296
|
+
const ONSET_FRAMES = 3;
|
|
14297
|
+
const HYSTERESIS_DB = 6;
|
|
14298
|
+
const RISE_DB_PER_SECOND = 2.5;
|
|
14299
|
+
const FALL = .2;
|
|
14300
|
+
const SILENT_DB = -100;
|
|
14199
14301
|
/** The RMS of `frame` in dBFS, `SILENT_DB` for zeros. */
|
|
14200
14302
|
function rmsDb(frame) {
|
|
14201
14303
|
let sum = 0;
|
|
@@ -14331,6 +14433,7 @@ function createSegmenter(sampleRate, { onsetDb = 12, floorDb = -55, silenceSecon
|
|
|
14331
14433
|
}
|
|
14332
14434
|
};
|
|
14333
14435
|
}
|
|
14436
|
+
|
|
14334
14437
|
// src/components/auto-recorder.tsx
|
|
14335
14438
|
/** Listens all the time and hands over each stretch of speech as its own lossless take. */
|
|
14336
14439
|
function useAutoRecorder({ maxSeconds, onTake, paused = false, microphone, ...tuning }) {
|
|
@@ -14465,18 +14568,19 @@ function ListeningLevel({ state, maxSeconds, label = "Input level", className })
|
|
|
14465
14568
|
return /* @__PURE__ */ jsx(Meter, {
|
|
14466
14569
|
label,
|
|
14467
14570
|
value: db - -60,
|
|
14468
|
-
max: 60,
|
|
14571
|
+
max: - -60,
|
|
14469
14572
|
thresholds: inputLevelThresholds,
|
|
14470
14573
|
valueText: `${format.integer(Math.round(db) || 0)} dBFS`,
|
|
14471
14574
|
detail,
|
|
14472
14575
|
className
|
|
14473
14576
|
});
|
|
14474
14577
|
}
|
|
14578
|
+
|
|
14475
14579
|
// src/lib/image-diff.ts
|
|
14476
14580
|
/** The longest side, in pixels, a picture is compared at. */
|
|
14477
|
-
|
|
14581
|
+
const MAX_SIDE = 2048;
|
|
14478
14582
|
/** pixelmatch's own default colour distance below which two pixels are the same. */
|
|
14479
|
-
|
|
14583
|
+
const DEFAULT_TOLERANCE = .1;
|
|
14480
14584
|
/** The picture drawn at another size, each new pixel taken from the nearest old one. Used to bring the second picture to the first's size. */
|
|
14481
14585
|
function resample(p, width, height) {
|
|
14482
14586
|
if (p.width === width && p.height === height) return p;
|
|
@@ -14541,6 +14645,7 @@ async function readPixels(src, maxSide = MAX_SIDE) {
|
|
|
14541
14645
|
height
|
|
14542
14646
|
};
|
|
14543
14647
|
}
|
|
14648
|
+
|
|
14544
14649
|
// src/components/difference.tsx
|
|
14545
14650
|
/** The pixels that differ between two pictures at a tolerance (0 to 1), read only while `enabled`. */
|
|
14546
14651
|
function useDifference(a, b, tolerance, enabled, read = readPixels) {
|
|
@@ -14597,8 +14702,9 @@ function DifferenceMarks({ difference }) {
|
|
|
14597
14702
|
className: "absolute inset-0 size-full object-contain"
|
|
14598
14703
|
});
|
|
14599
14704
|
}
|
|
14705
|
+
|
|
14600
14706
|
// src/components/compare-regions.tsx
|
|
14601
|
-
|
|
14707
|
+
const REGION_KEYS = [
|
|
14602
14708
|
"q",
|
|
14603
14709
|
"w",
|
|
14604
14710
|
"e",
|
|
@@ -14724,15 +14830,16 @@ function RegionChips({ state }) {
|
|
|
14724
14830
|
})
|
|
14725
14831
|
});
|
|
14726
14832
|
}
|
|
14833
|
+
|
|
14727
14834
|
// src/components/compare.tsx
|
|
14728
|
-
|
|
14835
|
+
const MODE_LABEL$1 = {
|
|
14729
14836
|
side: "Side by side",
|
|
14730
14837
|
swipe: "Swipe",
|
|
14731
14838
|
fade: "Fade",
|
|
14732
14839
|
blink: "Blink",
|
|
14733
14840
|
difference: "Difference"
|
|
14734
14841
|
};
|
|
14735
|
-
|
|
14842
|
+
const ALL_MODES = [
|
|
14736
14843
|
"side",
|
|
14737
14844
|
"swipe",
|
|
14738
14845
|
"fade",
|
|
@@ -15088,6 +15195,7 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
|
|
|
15088
15195
|
})
|
|
15089
15196
|
});
|
|
15090
15197
|
}
|
|
15198
|
+
|
|
15091
15199
|
// src/components/pair-vote.tsx
|
|
15092
15200
|
/** A blind pairwise judgment of two pictures: `Compare`, answer keys in its legend, and a vote bar that never leans on either side. */
|
|
15093
15201
|
function PairVote({ pair, skeleton, empty, onAnswer, pending, progress, flagReasons, preload, last, words, ...compare }) {
|
|
@@ -15257,7 +15365,11 @@ function Judged({ pair, onAnswer, pending, flagReasons, words, last, view }) {
|
|
|
15257
15365
|
onPick: pending ? void 0 : (side) => answer({ answer: side })
|
|
15258
15366
|
}, pair) });
|
|
15259
15367
|
}
|
|
15260
|
-
|
|
15368
|
+
|
|
15369
|
+
// src/lib/loudness.ts
|
|
15370
|
+
/** The most of a clip that is measured, in seconds. */
|
|
15371
|
+
const MAX_SECONDS = 120;
|
|
15372
|
+
const db$1 = (x) => x > 0 ? 20 * Math.log10(x) : -Infinity;
|
|
15261
15373
|
/** The RMS and peak of channel data (-1 to 1), over all channels together. */
|
|
15262
15374
|
function loudnessOf(channels) {
|
|
15263
15375
|
let sum = 0;
|
|
@@ -15291,7 +15403,7 @@ function matchGains(a, b) {
|
|
|
15291
15403
|
};
|
|
15292
15404
|
}
|
|
15293
15405
|
/** dB to a media element's volume (0 to 1). */
|
|
15294
|
-
|
|
15406
|
+
const gainToVolume = (decibels) => Math.min(1, Math.max(0, 10 ** (decibels / 20)));
|
|
15295
15407
|
/** Fetches and decodes a clip and measures it. Needs the Web Audio API; reads at most `MAX_SECONDS`. */
|
|
15296
15408
|
async function measureLoudness(src) {
|
|
15297
15409
|
const response = await fetch(src);
|
|
@@ -15305,8 +15417,9 @@ async function measureLoudness(src) {
|
|
|
15305
15417
|
context.close();
|
|
15306
15418
|
}
|
|
15307
15419
|
}
|
|
15420
|
+
|
|
15308
15421
|
// src/components/compare-audio.tsx
|
|
15309
|
-
|
|
15422
|
+
const db = (x) => `${Math.abs(x).toFixed(1)} dB`;
|
|
15310
15423
|
/** Two clips to judge by ear: one transport, a switch that keeps the playhead, a loop, and matched levels. */
|
|
15311
15424
|
function CompareAudio({ label, a, b, blind, missing, levelMatch = true, align = "auto", measure = measureLoudness, keys = true, extraShortcuts = [], footer, className }) {
|
|
15312
15425
|
const refA = React.useRef(null);
|
|
@@ -15619,9 +15732,10 @@ function CompareAudio({ label, a, b, blind, missing, levelMatch = true, align =
|
|
|
15619
15732
|
]
|
|
15620
15733
|
});
|
|
15621
15734
|
}
|
|
15735
|
+
|
|
15622
15736
|
// src/components/video-clock.tsx
|
|
15623
15737
|
/** Speeds offered by default: slow motion for sitting on a moment. */
|
|
15624
|
-
|
|
15738
|
+
const SLOW_RATES = [
|
|
15625
15739
|
.1,
|
|
15626
15740
|
.25,
|
|
15627
15741
|
.5,
|
|
@@ -16065,8 +16179,9 @@ function VideoControls({ clock, rates = SLOW_RATES, moments = [] }) {
|
|
|
16065
16179
|
]
|
|
16066
16180
|
})] });
|
|
16067
16181
|
}
|
|
16182
|
+
|
|
16068
16183
|
// src/components/compare-video-grid.tsx
|
|
16069
|
-
|
|
16184
|
+
const COLUMNS$1 = {
|
|
16070
16185
|
2: "sm:grid-cols-2",
|
|
16071
16186
|
3: "sm:grid-cols-2 lg:grid-cols-3",
|
|
16072
16187
|
4: "sm:grid-cols-2 lg:grid-cols-4"
|
|
@@ -16232,14 +16347,15 @@ function CompareVideoGrid({ label, items, reference, blind, missing, catchingUp
|
|
|
16232
16347
|
})
|
|
16233
16348
|
});
|
|
16234
16349
|
}
|
|
16350
|
+
|
|
16235
16351
|
// src/components/compare-video.tsx
|
|
16236
|
-
|
|
16352
|
+
const MODES = [
|
|
16237
16353
|
"side",
|
|
16238
16354
|
"swipe",
|
|
16239
16355
|
"fade",
|
|
16240
16356
|
"blink"
|
|
16241
16357
|
];
|
|
16242
|
-
|
|
16358
|
+
const MODE_LABEL = {
|
|
16243
16359
|
side: "Side by side",
|
|
16244
16360
|
swipe: "Swipe",
|
|
16245
16361
|
fade: "Fade",
|
|
@@ -16505,8 +16621,12 @@ function CompareVideo({ label, a, b, blind, missing, mode, onModeChange, rates =
|
|
|
16505
16621
|
})
|
|
16506
16622
|
});
|
|
16507
16623
|
}
|
|
16508
|
-
|
|
16509
|
-
|
|
16624
|
+
|
|
16625
|
+
// src/lib/text-diff.ts
|
|
16626
|
+
/** The most words in A times the most in B that are compared; a bigger pair is not. */
|
|
16627
|
+
const MAX_CELLS = 25e5;
|
|
16628
|
+
const tokens = (text) => text.split(/(\s+)/).filter((t) => t !== "");
|
|
16629
|
+
const isSpace = (t) => /^\s+$/.test(t);
|
|
16510
16630
|
/** Marks the words that differ between two texts, or returns null when the pair is too long to compare. */
|
|
16511
16631
|
function diffWords(a, b) {
|
|
16512
16632
|
const ta = tokens(a);
|
|
@@ -16557,6 +16677,7 @@ function diffWords(a, b) {
|
|
|
16557
16677
|
changedB: rb.changed
|
|
16558
16678
|
};
|
|
16559
16679
|
}
|
|
16680
|
+
|
|
16560
16681
|
// src/components/compare-text.tsx
|
|
16561
16682
|
function Words({ segments, changed }) {
|
|
16562
16683
|
return /* @__PURE__ */ jsx(Fragment, { children: segments.map((s, i) => changed && s.changed ? /* @__PURE__ */ jsx("mark", {
|
|
@@ -16687,8 +16808,9 @@ function CompareText({ label, a, b, blind, reference, defaultDiff = false, tooLo
|
|
|
16687
16808
|
]
|
|
16688
16809
|
});
|
|
16689
16810
|
}
|
|
16811
|
+
|
|
16690
16812
|
// src/components/compare-grid.tsx
|
|
16691
|
-
|
|
16813
|
+
const COLUMNS = {
|
|
16692
16814
|
2: "sm:grid-cols-2",
|
|
16693
16815
|
3: "sm:grid-cols-2 lg:grid-cols-3",
|
|
16694
16816
|
4: "sm:grid-cols-2 lg:grid-cols-4"
|
|
@@ -16783,8 +16905,9 @@ function CompareGrid({ label, items, blind, missing, actions, columns = 3, regio
|
|
|
16783
16905
|
})
|
|
16784
16906
|
});
|
|
16785
16907
|
}
|
|
16908
|
+
|
|
16786
16909
|
// src/components/workspace.tsx
|
|
16787
|
-
|
|
16910
|
+
const readPersisted = (key) => {
|
|
16788
16911
|
const empty = {
|
|
16789
16912
|
sizes: {},
|
|
16790
16913
|
collapsed: {}
|
|
@@ -16860,13 +16983,13 @@ function useWorkspaceState(persist) {
|
|
|
16860
16983
|
narrowOpen
|
|
16861
16984
|
]);
|
|
16862
16985
|
}
|
|
16863
|
-
|
|
16864
|
-
|
|
16986
|
+
const StateContext = React.createContext(null);
|
|
16987
|
+
const useState_ = () => {
|
|
16865
16988
|
const state = React.useContext(StateContext);
|
|
16866
16989
|
if (!state) throw new Error("strata-react: a Pane or Split must be inside a Workspace.");
|
|
16867
16990
|
return state;
|
|
16868
16991
|
};
|
|
16869
|
-
|
|
16992
|
+
const SlotContext = React.createContext({
|
|
16870
16993
|
direction: "row",
|
|
16871
16994
|
edge: "only",
|
|
16872
16995
|
stacked: false
|
|
@@ -16927,7 +17050,7 @@ function WorkspaceBar({ title, status, actions, end, className }) {
|
|
|
16927
17050
|
]
|
|
16928
17051
|
});
|
|
16929
17052
|
}
|
|
16930
|
-
|
|
17053
|
+
const iconsFor = (direction, edge, stacked) => {
|
|
16931
17054
|
if (stacked || direction === "column") return edge === "start" ? [PanelTopClose, PanelTopOpen] : [PanelBottomClose, PanelBottomOpen];
|
|
16932
17055
|
return edge === "end" ? [PanelRightClose, PanelRightOpen] : [PanelLeftClose, PanelLeftOpen];
|
|
16933
17056
|
};
|
|
@@ -16997,8 +17120,8 @@ function Pane({ id, name, grow, size = 280, min, max, collapsible, defaultCollap
|
|
|
16997
17120
|
})]
|
|
16998
17121
|
});
|
|
16999
17122
|
}
|
|
17000
|
-
|
|
17001
|
-
|
|
17123
|
+
const isPane = (c) => React.isValidElement(c) && c.type === Pane;
|
|
17124
|
+
const clamp = (n, lo, hi) => Math.min(Math.max(n, lo), hi);
|
|
17002
17125
|
function Separator$1({ pane, direction, sign, container }) {
|
|
17003
17126
|
const state = useState_();
|
|
17004
17127
|
const [moving, setMoving] = React.useState(false);
|
|
@@ -17120,8 +17243,9 @@ function Split({ direction, className, children }) {
|
|
|
17120
17243
|
children: out
|
|
17121
17244
|
});
|
|
17122
17245
|
}
|
|
17246
|
+
|
|
17123
17247
|
// src/components/history.tsx
|
|
17124
|
-
|
|
17248
|
+
const compose = (older, newer) => ({
|
|
17125
17249
|
label: older.label,
|
|
17126
17250
|
key: older.key,
|
|
17127
17251
|
undo: () => {
|
|
@@ -17285,6 +17409,7 @@ function useHistoryState(initial, options) {
|
|
|
17285
17409
|
history
|
|
17286
17410
|
};
|
|
17287
17411
|
}
|
|
17412
|
+
|
|
17288
17413
|
// src/components/save.tsx
|
|
17289
17414
|
/** Saves `value` after changes settle, never two at once, and says where it stands. The document's first `value` counts as saved. */
|
|
17290
17415
|
function useAutoSave({ value, save, delayMs = 1500, equals = Object.is, describeError = describeActionError }) {
|
|
@@ -17394,7 +17519,7 @@ function useLeaveGuard(active) {
|
|
|
17394
17519
|
return () => window.removeEventListener("beforeunload", onBeforeUnload);
|
|
17395
17520
|
}, [active]);
|
|
17396
17521
|
}
|
|
17397
|
-
|
|
17522
|
+
const labelOf$1 = (s) => s.status === "saved" ? s.at ? `Saved ${format.clock(s.at)}` : "Saved" : s.status === "saving" ? "Saving…" : s.status === "dirty" ? "Unsaved changes" : "Not saved";
|
|
17398
17523
|
/**
|
|
17399
17524
|
* The sign of whether the work is safe: "Saved 10:42", "Saving…", "Unsaved changes", or "Not saved"
|
|
17400
17525
|
* with the reason and "Try again". Fixed width, so it never moves what is beside it. Announces a
|
|
@@ -17462,8 +17587,9 @@ function SaveStatus({ state, onRetry, className }) {
|
|
|
17462
17587
|
]
|
|
17463
17588
|
});
|
|
17464
17589
|
}
|
|
17590
|
+
|
|
17465
17591
|
// src/lib/rich-text.ts
|
|
17466
|
-
|
|
17592
|
+
const WORD = /[\p{L}\p{N}_-]/u;
|
|
17467
17593
|
/** Finds ids in `text`, longest first, never inside a longer word. Overlaps go to the earlier, longer match. */
|
|
17468
17594
|
function matchEntities(text, matcher) {
|
|
17469
17595
|
if (!matcher) return [];
|
|
@@ -17627,8 +17753,9 @@ function parseRichText(text, matcher) {
|
|
|
17627
17753
|
function plainText(text) {
|
|
17628
17754
|
return text.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1").replace(/\*\*|`/g, "").replace(/^\s*(?:[-*]|\d+[.)])\s+/gm, "").replace(/\s+/g, " ").trim();
|
|
17629
17755
|
}
|
|
17756
|
+
|
|
17630
17757
|
// src/components/conversation.tsx
|
|
17631
|
-
|
|
17758
|
+
const LINK = "text-primary underline underline-offset-2 hover:no-underline";
|
|
17632
17759
|
function renderInline(nodes, onOpen, keyBase = "") {
|
|
17633
17760
|
return nodes.map((n, i) => {
|
|
17634
17761
|
const key = `${keyBase}${i}`;
|
|
@@ -17678,7 +17805,7 @@ function RichText({ children, entities, onOpen, className }) {
|
|
|
17678
17805
|
children: renderBlocks(blocks, onOpen)
|
|
17679
17806
|
});
|
|
17680
17807
|
}
|
|
17681
|
-
|
|
17808
|
+
const NEAR_BOTTOM = 24;
|
|
17682
17809
|
/** A thread of turns: answers stream, finish or fail in place; the log follows only while the person is at the bottom (with Jump to latest), and a finished answer is announced once, politely. */
|
|
17683
17810
|
function Conversation({ label, turns, answerName, personName = "You", entities, onOpen, onRetry, empty, lookedUpLabel = "What it looked up", className }) {
|
|
17684
17811
|
const box = React.useRef(null);
|
|
@@ -17885,8 +18012,9 @@ function Composer({ label, onSend, answering = false, onStop, answeringReason, s
|
|
|
17885
18012
|
]
|
|
17886
18013
|
});
|
|
17887
18014
|
}
|
|
18015
|
+
|
|
17888
18016
|
// src/lib/region.ts
|
|
17889
|
-
|
|
18017
|
+
const HANDLES = [
|
|
17890
18018
|
"nw",
|
|
17891
18019
|
"n",
|
|
17892
18020
|
"ne",
|
|
@@ -18024,7 +18152,7 @@ function lerpRect(a, b, t, easing = "ease-in-out") {
|
|
|
18024
18152
|
};
|
|
18025
18153
|
}
|
|
18026
18154
|
/** True when two rectangles are the same to the unit's thousandth. */
|
|
18027
|
-
|
|
18155
|
+
const sameRect = (a, b) => [
|
|
18028
18156
|
"x",
|
|
18029
18157
|
"y",
|
|
18030
18158
|
"w",
|
|
@@ -18094,7 +18222,7 @@ function joinRects(a, b) {
|
|
|
18094
18222
|
};
|
|
18095
18223
|
}
|
|
18096
18224
|
/** The x of the gutter between two windows: halfway between the left one's right edge and the right one's left edge. */
|
|
18097
|
-
|
|
18225
|
+
const gutterOf = (left, right) => (left.x + left.w + right.x) / 2;
|
|
18098
18226
|
/** Moves the gutter by `dx`: the left window's right edge and the right window's left edge both move, so they resize together and the gap between them is kept. Neither shrinks below `min` wide, and neither leaves the bounds. */
|
|
18099
18227
|
function moveGutter(left, right, dx, { bounds, min }) {
|
|
18100
18228
|
const mw = min?.w ?? 0;
|
|
@@ -18110,8 +18238,9 @@ function moveGutter(left, right, dx, { bounds, min }) {
|
|
|
18110
18238
|
w: right.w - d
|
|
18111
18239
|
}];
|
|
18112
18240
|
}
|
|
18241
|
+
|
|
18113
18242
|
// src/components/region-editor.tsx
|
|
18114
|
-
|
|
18243
|
+
const TONE = {
|
|
18115
18244
|
neutral: {
|
|
18116
18245
|
edge: "var(--foreground)",
|
|
18117
18246
|
fill: "var(--muted)"
|
|
@@ -18133,7 +18262,7 @@ var TONE = {
|
|
|
18133
18262
|
fill: "var(--danger-subtle)"
|
|
18134
18263
|
}
|
|
18135
18264
|
};
|
|
18136
|
-
|
|
18265
|
+
const CURSOR = {
|
|
18137
18266
|
n: "ns-resize",
|
|
18138
18267
|
s: "ns-resize",
|
|
18139
18268
|
e: "ew-resize",
|
|
@@ -18143,7 +18272,7 @@ var CURSOR = {
|
|
|
18143
18272
|
nw: "nwse-resize",
|
|
18144
18273
|
se: "nwse-resize"
|
|
18145
18274
|
};
|
|
18146
|
-
|
|
18275
|
+
const HANDLE_AT = {
|
|
18147
18276
|
nw: "left-0 top-0 -translate-x-1/2 -translate-y-1/2",
|
|
18148
18277
|
n: "left-1/2 top-0 -translate-x-1/2 -translate-y-1/2",
|
|
18149
18278
|
ne: "right-0 top-0 translate-x-1/2 -translate-y-1/2",
|
|
@@ -18153,9 +18282,9 @@ var HANDLE_AT = {
|
|
|
18153
18282
|
sw: "left-0 bottom-0 -translate-x-1/2 translate-y-1/2",
|
|
18154
18283
|
w: "left-0 top-1/2 -translate-x-1/2 -translate-y-1/2"
|
|
18155
18284
|
};
|
|
18156
|
-
|
|
18285
|
+
const round = (n) => format.integer(Math.round(n));
|
|
18157
18286
|
/** A window said in words. */
|
|
18158
|
-
|
|
18287
|
+
const describeRegion = (r) => `${r.label}: ${round(r.w)} wide by ${round(r.h)} high, ${round(r.x)} across and ${round(r.y)} down`;
|
|
18159
18288
|
/** Draw and move one or two named windows on a picture, with pointer, keyboard and numbers kept in step; aspect and bounds hold through all three; two windows make a from/to move with a Watch preview. */
|
|
18160
18289
|
function RegionEditor({ label, children, size, regions, onChange, selectedId, onSelectedChange, aspect, min, bounds, step, onDraw, mode = "single", onPreview, duration = 1500, easing = "ease-in-out", fields = true, unit = "px", defaults, angle = 0, onAngleChange, guide, spreadLabels = {
|
|
18161
18290
|
one: "Page",
|
|
@@ -18766,6 +18895,7 @@ function RegionEditor({ label, children, size, regions, onChange, selectedId, on
|
|
|
18766
18895
|
]
|
|
18767
18896
|
});
|
|
18768
18897
|
}
|
|
18898
|
+
|
|
18769
18899
|
// src/lib/book.ts
|
|
18770
18900
|
/**
|
|
18771
18901
|
* The pages shown together, as indexes into the set. In a spread the first page stands alone on
|
|
@@ -18783,7 +18913,7 @@ function viewsOf(count, spread) {
|
|
|
18783
18913
|
function viewOf(index, spread) {
|
|
18784
18914
|
return spread ? index <= 0 ? 0 : Math.floor((index + 1) / 2) : Math.max(index, 0);
|
|
18785
18915
|
}
|
|
18786
|
-
|
|
18916
|
+
const norm = (s) => s.trim().toLowerCase();
|
|
18787
18917
|
/**
|
|
18788
18918
|
* Finds the page a person typed. A printed label wins ("iv", "12") because that is what is printed
|
|
18789
18919
|
* on the page they are looking at; otherwise it is the scan's own position ("22" is the 22nd
|
|
@@ -18799,7 +18929,7 @@ function findPage(pages, query) {
|
|
|
18799
18929
|
return scan >= 0 ? scan : null;
|
|
18800
18930
|
}
|
|
18801
18931
|
/** A page said in words: "Page 22 (12)" or "Page 22" with no printed label. */
|
|
18802
|
-
|
|
18932
|
+
const pageName = (p, word = "Page") => `${word} ${p.scan}${p.printed ? ` (${p.printed})` : ""}`;
|
|
18803
18933
|
/** Where the viewer is, in words: "Page 22 (12) of 44", or "Pages 22 and 23 of 44" for a spread. */
|
|
18804
18934
|
function sayPosition(shown, total, word = "Page", plural = "Pages") {
|
|
18805
18935
|
if (shown.length === 0) return "";
|
|
@@ -18807,6 +18937,7 @@ function sayPosition(shown, total, word = "Page", plural = "Pages") {
|
|
|
18807
18937
|
const label = (p) => `${p.scan}${p.printed ? ` (${p.printed})` : ""}`;
|
|
18808
18938
|
return `${plural} ${label(shown[0])} and ${label(shown[1])} of ${total}`;
|
|
18809
18939
|
}
|
|
18940
|
+
|
|
18810
18941
|
// src/components/book-viewer.tsx
|
|
18811
18942
|
/** Keeps the page being read in the URL (`?page=22`, the 1-based position in the scan): a link or a reload opens it, and turning pages replaces the entry so Back leaves the book. */
|
|
18812
18943
|
function useBookUrl(count, { param = "page" } = {}) {
|
|
@@ -19035,6 +19166,7 @@ function BookViewer({ label, pages, index, onIndexChange, missing, layout = "spr
|
|
|
19035
19166
|
]
|
|
19036
19167
|
});
|
|
19037
19168
|
}
|
|
19169
|
+
|
|
19038
19170
|
// src/components/box-overlay.tsx
|
|
19039
19171
|
/** Holds the active and pointed box for a `BoxOverlay` and the `BoxList` beside it. */
|
|
19040
19172
|
function useBoxes(initial = null) {
|
|
@@ -19058,14 +19190,14 @@ function useBoxes(initial = null) {
|
|
|
19058
19190
|
choose
|
|
19059
19191
|
]);
|
|
19060
19192
|
}
|
|
19061
|
-
|
|
19193
|
+
const STROKE = {
|
|
19062
19194
|
neutral: "var(--foreground)",
|
|
19063
19195
|
info: "var(--info)",
|
|
19064
19196
|
success: "var(--success)",
|
|
19065
19197
|
warning: "var(--warning)",
|
|
19066
19198
|
danger: "var(--danger)"
|
|
19067
19199
|
};
|
|
19068
|
-
|
|
19200
|
+
const FILL = {
|
|
19069
19201
|
neutral: "var(--muted)",
|
|
19070
19202
|
info: "var(--info-subtle)",
|
|
19071
19203
|
success: "var(--success-subtle)",
|
|
@@ -19178,6 +19310,7 @@ function BoxList({ label, boxes, state, renderBox, className }) {
|
|
|
19178
19310
|
})
|
|
19179
19311
|
});
|
|
19180
19312
|
}
|
|
19313
|
+
|
|
19181
19314
|
// src/components/boxed-picture.tsx
|
|
19182
19315
|
/** A picture with its boxes drawn on it, opened zoomed to the chosen one (a face in its photo): `ViewportFrame` + `BoxOverlay` + `zoomToBox`, with the picture's missing state. Pair it with a `BoxList` through one `useBoxes`. */
|
|
19183
19316
|
function BoxedPicture({ label, src, alt, missing, of, boxes, state, boxesLabel, zoom = true, margin = .75, maxHeight = "70svh", onChoose, className }) {
|
|
@@ -19243,8 +19376,9 @@ function BoxedPicture({ label, src, alt, missing, of, boxes, state, boxesLabel,
|
|
|
19243
19376
|
})]
|
|
19244
19377
|
});
|
|
19245
19378
|
}
|
|
19379
|
+
|
|
19246
19380
|
// src/lib/sequence.ts
|
|
19247
|
-
|
|
19381
|
+
const EPS = 1e-9;
|
|
19248
19382
|
/** The grid point nearest to `time`, or `time` itself when there is no grid. */
|
|
19249
19383
|
function snapToGrid(time, grid) {
|
|
19250
19384
|
if (grid === void 0) return time;
|
|
@@ -19306,9 +19440,10 @@ function settleCut(wanted, grid, room) {
|
|
|
19306
19440
|
limit: held.limit
|
|
19307
19441
|
};
|
|
19308
19442
|
}
|
|
19443
|
+
|
|
19309
19444
|
// src/components/sequence-timeline.tsx
|
|
19310
|
-
|
|
19311
|
-
|
|
19445
|
+
const seconds = (n) => `${tidy(Math.round(n * 10) / 10)} s`;
|
|
19446
|
+
const at = (t) => tickLabel(t, .1);
|
|
19312
19447
|
/** A gapless strip of windows whose cuts are dragged or stepped, snapping to a beat grid inside the room the app gives; each cut is a slider that announces both windows' new lengths; Shift+click chooses a run. */
|
|
19313
19448
|
function SequenceTimeline({ label, items, zoom, onCutChange, room, minLength = .1, grid, step = .1, selected = [], onSelectRange, renderItem, height = "5rem", className }) {
|
|
19314
19449
|
const start = items[0]?.start ?? 0;
|
|
@@ -19514,12 +19649,13 @@ function SequenceTimeline({ label, items, zoom, onCutChange, room, minLength = .
|
|
|
19514
19649
|
]
|
|
19515
19650
|
});
|
|
19516
19651
|
}
|
|
19652
|
+
|
|
19517
19653
|
// src/components/tree.tsx
|
|
19518
|
-
|
|
19519
|
-
|
|
19520
|
-
|
|
19521
|
-
|
|
19522
|
-
|
|
19654
|
+
const Context = React.createContext(null);
|
|
19655
|
+
const useCtx = () => React.useContext(Context);
|
|
19656
|
+
const NOTE = "\0";
|
|
19657
|
+
const isNote = (key) => key.includes(NOTE);
|
|
19658
|
+
const ROW = "flex min-h-(--control-h-sm) min-w-0 items-center gap-1 rounded-control pr-2 type-body-sm";
|
|
19523
19659
|
function Row$1({ level, children }) {
|
|
19524
19660
|
return /* @__PURE__ */ jsx("div", {
|
|
19525
19661
|
className: ROW,
|
|
@@ -19928,17 +20064,18 @@ function Tree({ label, roots, useChildren, nodeKey, nodeLabel, isBranch, renderN
|
|
|
19928
20064
|
]
|
|
19929
20065
|
});
|
|
19930
20066
|
}
|
|
20067
|
+
|
|
19931
20068
|
// src/components/folder-picker.tsx
|
|
19932
|
-
|
|
19933
|
-
|
|
19934
|
-
|
|
20069
|
+
const SEP = "/";
|
|
20070
|
+
const parts = (path) => path.split(SEP).filter(Boolean);
|
|
20071
|
+
const join = (parent, name) => `${parent === SEP ? "" : parent}${SEP}${name}`;
|
|
19935
20072
|
/** The parent of a path, or `null` at the top. */
|
|
19936
|
-
|
|
20073
|
+
const parentOf = (path) => {
|
|
19937
20074
|
const p = parts(path);
|
|
19938
20075
|
return p.length <= 1 ? null : `${SEP}${p.slice(0, -1).join(SEP)}`;
|
|
19939
20076
|
};
|
|
19940
20077
|
/** Every folder from the top down to `path`, which the tree must have open to show it. */
|
|
19941
|
-
|
|
20078
|
+
const ancestorsOf = (path) => parts(path).slice(0, -1).map((_, i, a) => `${SEP}${a.slice(0, i + 1).join(SEP)}`);
|
|
19942
20079
|
/** A server folder chooser: a lazy tree, a breadcrumb that is also editable text, Up, recents, a New folder field that shows the server's refusal, and Choose this folder as the one filled button. */
|
|
19943
20080
|
function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose, expanded, recent, canChoose, chooseLabel = "Choose this folder", onOpen, onCreate, topLabel = "Top", emptyRow = "No folders", height = "18rem", className }) {
|
|
19944
20081
|
const useFolders = (path) => {
|
|
@@ -20158,6 +20295,6 @@ function FolderPicker({ label, useFolders: useListing, value, onChange, onChoose
|
|
|
20158
20295
|
]
|
|
20159
20296
|
});
|
|
20160
20297
|
}
|
|
20161
|
-
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, EmptyState, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, NBSP, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RateChoice, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, ShortcutEditor, SideNav, Skeleton, Slider, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, 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, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, ease, encodeWav, errorPayload, explainMicrophoneError, fetchJson, fieldErrorsOf, findPage, fitRect, followAim, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, inputLevelThresholds, isDoubtful, isRefusal, isReservedChord, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, moveGutter, moveRect, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, resample, resamplePeaks, resizeRect, rgbaToBlob, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, skipAction, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useDifference, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useRebindableShortcuts, useRecorder, useReserve, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
|
|
20162
20298
|
|
|
20299
|
+
export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DataTable, DataView$1 as DataView, Density, Dialog, Disclosure, Done, DragSource, EmptyState, FIT, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FilmStrip, FolderPicker, FullscreenFrame, HttpError, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, KeysLegend, LEVEL_FLOOR_DB, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, NBSP, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PauseButton, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RateChoice, RegionEditor, RichText, RowAction, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, ShortcutEditor, SideNav, Skeleton, Slider, SortableList, SpanActions, SpanStrip, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, 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, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, diffWords, differences, diskThresholds, drawRect, ease, encodeWav, errorPayload, explainMicrophoneError, fetchJson, fieldErrorsOf, findPage, fitRect, followAim, format, formatChord, frameAt, gainToVolume, geo, gridPoints, gutterOf, inputLevelThresholds, isDoubtful, isRefusal, isReservedChord, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, keyName, labelOf, lerpRect, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, moveGutter, moveRect, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, parseChord, parseInline, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, resample, resamplePeaks, resizeRect, rgbaToBlob, rmsDb, safeHref, sayPosition, serialiseSort, settleCut, skipAction, snapToGrid, sortRows, speak, speechLevel, splitRect, staleOf, stepId, stepOnGrid, stopSpeaking, summariseWorkflow, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnedSize, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useDifference, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useRebindableShortcuts, useRecorder, useReserve, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
|
|
20163
20300
|
//# sourceMappingURL=index.js.map
|