strata-react 1.0.15 → 1.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,6 +37,7 @@ it against the built files:
37
37
  |---|---|---|
38
38
  | `strata-react` | `react`, `react-dom`, `react-router`, `@tanstack/react-query`, `tailwindcss` | The stack is fixed: `DataTable` and `Tabs` keep sort and tab in the URL, `AppShell` links with `NavLink`, every remote read is `useLoad`. The barrel imports both libraries, so an app that uses only a `Button` still installs them (both are needed for anything past a static page) |
39
39
  | `strata-react/testing` | the above, plus `@testing-library/react` | `renderWithStrata` and `renderRoutes` wrap Testing Library's `render` |
40
+ | `strata-react/map` | `leaflet` (optional peer, `^1.9.4`) | `RouteMap`: themed routes and a moving position on the tiles an app supplies |
40
41
  | `strata-react/visual`, `strata-visual` | `playwright` (exact version), `msw`, `vite` | The screenshot runner; see [Visual regression for apps](#visual-regression-for-apps) |
41
42
 
42
43
  The last three are optional peers: an app that never imports those entries never needs them.
@@ -125,7 +126,7 @@ strata-react is ESM-only (`exports` has only `import`), as is its peer `react-ro
125
126
  | Actions | `Button`, `IconButton`, `RowAction`, `AsyncButton`, `useAsyncAction` | Default is `outline`; one filled button per view; `IconButton` requires `label`; `RowAction` is named for its row ("Withdraw Tom Ellery"); `AsyncButton` keeps one width through idle, pending, done and error, and announces `error` with its retry label; buttons carry `data-variant` and `AsyncButton` `data-phase` for tests; `useAsyncAction` returns `{ phase, run, error, thrown, fieldErrors, clearFieldError }` with a stable `run`, describes an `HttpError` in a sentence with the server's own reason for a 4xx (`describeActionError`, or the product's own `describeError`), and `validate` plus a server's 422 put messages on `fieldErrors` for each `Field` |
126
127
  | Form | `Field`, `Input`, `Textarea`, `NativeSelect`, `ChoiceGroup`, `Checkbox` | `Field` wires label, hint, error, `aria-describedby`, `aria-invalid`, and `action` puts a one-field form's button on the control's row with the hint and error under both; `Checkbox` requires `label` and is one target with it, and has a mixed state |
127
128
  | Status and figures | `Status`, `Metric`, `MetricStrip`, `Meter`, `crossedThreshold`, `CompositionBar` | A status is always a word; figures have no icons or sparklines; `Meter` is a `meter` named for what it measures, with its reading in words ("72% used"), threshold notches, and a `Status` word once a threshold is crossed (each threshold must name its state); `CompositionBar` is a stacked bar over a table naming every part, its amount and share, and names the remainder (`total` needs `restLabel`); a part that is there reads "<1%" and keeps a sliver, never "0%"; `JobStatus` is a long-running server job: a required word per state beside the app's sentence, a progress bar when the total is known, each failure named with its reason, announced only when the item changes or the job ends |
128
- | Data | `DataView`, `Load<T>`, `Stale`, `StaleNotice`, `LoadError`, `EmptyState`, `Skeleton`, `Thumbnail`, `ThumbnailSkeleton`, `DataTable`, `TableSkeleton`, `VirtualList`, `InfiniteList`, `LoadMore`, `useInView`, `LineChart` | `DataView` requires skeleton and empty, keeps data on screen under a `StaleNotice` (why, how old, Try again) when a refresh fails, and takes an `error` renderer for an app's own look of a failed read (default `LoadError`, always inside an alert); `Thumbnail` is a remote image in a box of fixed `aspect`, with a skeleton while it loads, the required `missing` words (or a `fallback` drawing, such as an avatar's initial) when it fails or `src` is null, required `alt`, `children` overlaid in its corners, and a request only once it nears the screen (`eager` for the first few); tables, lists and tile grids virtualise from 100 rows, on React Aria's Virtualizer; a `DataTable` is a React Aria table (a `grid`) over TanStack Table's data model; a `DataTable` column with `value` sorts by type with missing values last both ways and draws a placeholder (`missing`, default an en dash); `InfiniteList` loads the next page on approach, with a skeleton for it, a Try again row when it fails and a Show more button for the keyboard, and `scroll="page"` draws a grid that scrolls with the page; `LoadMore` is that next-page row for any list or grid; charts label values directly; `LineChart` can also follow an app's position (`current`), read a value at the pointer or by arrow keys (`readout`, one slider whose value text is the reading), report a picked x (`onPick`) and fill one flat area (`area`) |
129
+ | Data | `DataView`, `Load<T>`, `Stale`, `StaleNotice`, `LoadError`, `EmptyState`, `Skeleton`, `Thumbnail`, `ThumbnailSkeleton`, `DataTable`, `TableSkeleton`, `VirtualList`, `InfiniteList`, `LoadMore`, `useInView`, `LineChart` | `DataView` requires skeleton and empty, keeps data on screen under a `StaleNotice` (why, how old, Try again) when a refresh fails, and takes an `error` renderer for an app's own look of a failed read (default `LoadError`, always inside an alert); `Thumbnail` is a remote image in a box of fixed `aspect`, with a skeleton while it loads, the required `missing` words (or a `fallback` drawing, such as an avatar's initial) when it fails or `src` is null, required `alt`, `children` overlaid in its corners, and a request only once it nears the screen (`eager` for the first few); tables, lists and tile grids virtualise from 100 rows, on React Aria's Virtualizer; a `DataTable` is a React Aria table (a `grid`) over TanStack Table's data model; a `DataTable` column with `value` sorts by type with missing values last both ways and draws a placeholder (`missing`, default an en dash); `InfiniteList` loads the next page on approach, with a skeleton for it, a Try again row when it fails and a Show more button for the keyboard, and `scroll="page"` draws a grid that scrolls with the page; `LoadMore` is that next-page row for any list or grid; charts label values directly; `LineChart` can also follow an app's position (`current`), read a value at the pointer or by arrow keys (`readout`, one slider whose value text is the reading), report a picked x (`onPick`) and fill one flat area (`area`); `xLabel` names the x column of its table |
129
130
  | Compare | `Compare`, `CompareGrid`, `ViewportFrame`, `useViewport`, `FullscreenFrame`, `useDifference`, `differences` | Two pictures judged together: side by side, swipe (a divider that moves from the keyboard), fade, blink (`x` flips) and difference (a live difference blend with amplify, or pixelmatch's changed pixels with a tolerance and the share that differ; pixels are read only when that view is open, at most 2048 px on the long side, and a picture the browser will not let the page read says so in words); `CompareGrid` is every candidate at once with the same zoom and full screen, and `actions` for what a tile offers; one zoom and pan for both sides (buttons, `+` `-` `0`, Ctrl-wheel or trackpad pinch, drag, arrow keys, double click, `1:1`), and full screen (the browser's Fullscreen API, a modal where there is none). `blind` is required: a blind comparison names pictures by `label` only and never writes the variant `id`, `note` or `alt`. A picture that fails shows the required `missing` words in its place; the keys come from one `Shortcut[]` shared with `KeysLegend`, and `keys={false}` leaves them to a surrounding screen. Pictures only so far: voting, text, audio and video are the next changes |
130
131
  | Selection | `useSelection`, `BulkBar`, `SelectableGrid`, `DataTable`'s `selection` (`RowSelection<T>`) | Opt-in checkbox column with "Select all shown" that respects `isSelectable`; Shift-click or Shift+Space chooses or clears the run from the last row clicked, in the order shown; `initial` (keys or a test on the row) chooses a row the first time it appears, so it applies to data that loads later; the selection drops rows that are gone; `BulkBar` announces the count politely, and while it is up its one filled action is the view's only one (the screen's primary goes to `outline`); `SelectableGrid` is the same selection as a grid of pictures (`renderImage`), each tile one labelled target, virtualised from 100 tiles |
131
132
  | Expansion | `Disclosure`, `useExpanded`, `DataTable`'s `expansion` (`RowExpansion<T>`) | Show more of one row in place. The toggle is a button with `aria-expanded`; the body is mounted only while open, so a request inside it runs on first open (unlike `<details>`, which mounts every closed body); `useExpanded({ param })` shares the open keys across a list or table and keeps them in the URL; a table's detail row spans the data columns and is measured when virtualised |
@@ -134,16 +135,19 @@ strata-react is ESM-only (`exports` has only `import`), as is its peer `react-ro
134
135
  | Keyboard | `useHotkeys`, `KeysLegend`, `Shortcut`, `useActiveItem`, `ActiveList`, `isTypingTarget` | For queues worked from the keyboard; one shortcut list drives the handler and the legend; keys never fire while typing; answering moves focus to the next item |
135
136
  | Theme | `ThemeProvider`, `useColorScheme`, `useSystemColorScheme`, `ColorSchemeChoice`, `colorSchemeScript` | System, light or dark; sets `.dark`, persists in localStorage when it can; `ColorSchemeChoice` is a radio list for a settings page, or `compact` icon segments named "Appearance" for an app with no settings page |
136
137
  | Density | `Density`, `DensityName`, `ThemeProvider`'s `density`, `ControlSize` (`size="sm"` on `Input`, `NativeSelect`, `NumberField`, `IconButton`) | Control height is two variables, `--control-h` and `--control-h-sm`. `<ThemeProvider density="compact">` or `<Density page value="compact">` sets them app-wide, including dialogs and menus, which portal out of the app's root; `<Density value="compact">` is one region (a toolbar, a dense panel) and does not reach its overlays. A coarse pointer (touch) always gets 44px targets, whatever the density |
138
+ | Workspace | `Workspace`, `Split`, `Pane`, `useWorkspaceState`, `WorkspaceState` | One screen of panes for a tool: splits of panes with a growing stage, a header on every pane (name, actions, fold button), separators that resize by pointer and by keyboard (arrows, Shift, Home, End, Enter to restore) within each pane's `min` and `max`, panes that fold to a rail or header bar with a visible way back (and `state.toggle(id)` from a menu), sizes and folds remembered with `useWorkspaceState("name")`, and stacking below 720px. Each pane is a labelled region |
137
139
  | History and save state | `useHistory`, `useHistoryState`, `History`, `useAutoSave`, `SaveStatus`, `SaveState`, `useLeaveGuard` | Undo and redo for a document edited over a session: a step is a name and an `undo`/`redo` pair, `begin(label)` groups a drag into one step, a `key` merges a slider's pushes, a `limit` drops the oldest. `history.commands` are Undo and Redo as `Command`s ("Undo move clip", Mod+Z, Mod+Shift+Z or Mod+Y) for `useCommands` and `Menu`. `useAutoSave` debounces and never overlaps saves; `SaveStatus` is the fixed-width sign ("Saved 10:42", "Saving…", "Unsaved changes", "Not saved" with the reason and "Try again"), quiet except for a failure and its recovery. For one removal that commits after a few seconds, use `useUndoable` |
138
140
  | Toolbar and toggles | `Toolbar`, `ToolbarSeparator`, `Toggle`, `ToggleGroup`, `Switch` | A toolbar is one tab stop with arrows, Home and End inside; needs a `label`. `Toggle` (`aria-pressed`) and `ToggleGroup` (one of 2 to 7, always one chosen) show chosen as an ink border on a tint, never the filled primary, so they do not break the one-filled-button rule; an icon-only toggle still needs its `label` (shown as a tooltip). `Switch` is only for a setting that applies at once, label and control one target |
139
141
  | Commands | `Command`, `useCommands`, `Menu`, `ContextMenu`, `CommandMenu`, `CommandLegend`, `formatChord`, `matchesChord` | A command is declared once (label or label function, chords, `disabled` with a reason, `destructive`, `checked`) and drives the key handler, dropdown and menu-bar menus, the context menu, the searchable command menu (Mod+K) and the legend, so they cannot disagree. Chords are written once ("Mod+Shift+Z") and shown per platform (⇧⌘Z, Ctrl+Shift+Z); they never fire while typing or during IME composition, and a chord the browser keeps (Ctrl+S) needs `claim: true`. `useHotkeys` is unchanged for single keys |
140
142
  | Overlays | `Dialog`, `DialogProps`, `AlertDialog`, `Popover`, `Tooltip` | React Aria underneath. A dialog always has a title and, via `actions`'s close render prop, a way out; `closable={false}` while work cannot stop; `placement="end"` is a sheet. `AlertDialog` is the only confirm: required verb on the confirm button, Cancel focused first, no outside dismiss, stays open with the reason when an async confirm fails. `Popover` needs a `label`. `Tooltip` opens on hover and focus and `IconButton` uses it. All portal onto the `layer-*` stacking utilities |
141
143
  | Value controls | `NumberField`, `Slider`, `ColorField` | Set a number or colour precisely, inside `Field`. `NumberField` and `Slider` are React Aria's; the number field runs with `commitBehavior="validate"`, so a typed value outside `min`/`max` is kept on screen, explained in the `Field` ("Enter a value from 0% to 500%.") and never passed to `onChange`. A value that is not known is `null` and shows an en dash, never 0 or NaN. Digits and decimal mark follow `locale`. The unit sits inside the control, and in the slider's spoken value when `Intl` has it (%, °, ms, s, kB, MB, GB, kbps, Mbps). Arrows step, Home/End jump to the limits; `Slider editable` adds a number field. `ColorField`: platform picker, typed hex that is normalised, app suggestions, and a contrast note against `against`. No motion on value changes |
142
144
  | Notices and progress | `Alert`, `toast`, `StrataToastRegion`, `useClientWork`, `JobStatus` | Three weights. A `toast` confirms finished work and goes by itself (5 s plus 40 ms a character, 8 s minimum with an action, paused under the pointer or focus, always dismissable); it has no danger tone, because an error a person must act on is an inline `Alert` with its recovery as `action` (`announce` makes it `role="alert"` only when it answers something the person just did). `StrataToastRegion` goes once at the app root. `useClientWork` runs browser work with progress, cancel (aborts its `signal`, ends `cancelled`, never `failed`) and a double-start guard; `JobStatus` shows it exactly as it shows a server job, with `onCancel`, `cancelled` and `onDismiss` |
145
+ | Media player | `MediaPlayer`, `useMediaElement`, `SPEECH_RATES` | Play a file or a sequence of chapters without the event glue: the element, its state, Strata's controls (or the browser's own on a touch device, `controls="auto"`), a load error with Try again, `navigator.mediaSession` metadata, the seek bar spanning the whole sequence. `useMediaElement(ref)` alone follows an element drawn with the browser's controls |
143
146
  | Media playback | `Transport`, `SeekBar`, `TimeReadout`, `VolumeControl`, `RateChoice`, `MediaStage`, `StageGuides`, `transportShortcuts`, `format.timecode` | The controls around anything that plays, wired to a player the app owns (HTML media, Web Audio, a canvas, a data replay). Every control is a named icon button in one toolbar; the play button's name is "Play" or "Pause". `SeekBar` has the formatted time as its accessible value, arrows step 5 s and Page keys 30 s by default, and optional marks. `VolumeControl` shows its percent, and muting remembers the level. `transportShortcuts` is the one list for `useHotkeys` and `KeysLegend` (Space and K, J and L, the arrows by a frame, Home and End). `format.timecode` prints m:ss, m:ss.mmm or m:ss:ff. `MediaStage` fits a picture of any aspect ratio into the pane with a letterbox on the sunken surface role, and takes overlays such as `StageGuides` |
144
- | Timeline | `Timeline`, `useTimelineZoom`, `TimelineZoomControls`, `noOverlap` | Items with a start and a length in lanes on a zoomable time axis, for media edits, bookings, rotas and plans. The timeline draws and the app decides: every move, trim, lane change, selection and current-time change is reported (`onItemChange`, `onSelect`, `onPositionChange`) and the app applies it; `validate` refuses a change with a reason shown in words while it is made. One tab stop for the items; arrows move between them, Ctrl+arrows nudge and change lane, Alt+arrows trim, the current time is its own slider, `+` `-` `0` zoom, and each change is announced ("run-02.mp4 moved to 0:13"). The ruler picks steps people write on a scale so labels never collide. Only items near the view are rendered |
147
+ | Maps | `strata-react/map`: `RouteMap`; `geo`, `LatLng` (main entry) | Routes and a position that moves along them, on Leaflet (no react-leaflet), behind its own entry. Tiles are the app's (`tiles.light`, `tiles.dark`, each with its attribution); the dark scheme uses the dark set or a filter over the light one. Route colours are roles resolved at draw time; `values` with `colourScale` colour a route by value in runs of one step, with a key that names the steps; a single route gets direction chevrons and start/finish marks (a loop is one mark). The position is one marker moved with `setLatLng`: no route is redrawn for it (keep `routes` stable). Leaflet's keyboard pan and zoom stay; the map is named by `label` and described by a generated text alternative (routes, lengths, position along). Overlay slots `topEnd` and `bottomStart` avoid Leaflet's own controls and attribution. Leaflet's stylesheet is injected once, so an app imports nothing. `geo` (distance, bearing, bounds, `pointAlong`, `arrows`, `ends`) and `format.distance` need no map library |
148
+ | Timeline | `Timeline`, `useTimelineZoom`, `TimelineZoomControls`, `noOverlap` | Items with a start and a length in lanes on a zoomable time axis, for media edits, bookings, rotas and plans. The timeline draws and the app decides: every move, trim, lane change, selection and current-time change is reported (`onItemChange`, `onSelect`, `onPositionChange`) and the app applies it; `validate` refuses a change with a reason shown in words while it is made. One tab stop for the items; arrows move between them, Ctrl+arrows nudge and change lane, Alt+arrows trim, the current time is its own slider, `+` `-` `0` zoom, and each change is announced ("run-02.mp4 moved to 0:13"). The ruler picks steps people write on a scale so labels never collide. Lanes take drops from outside (`dropTypes`, `onDrop` with the lane and snapped time, `validateDrop`, and React Aria's keyboard drag landing at the current time), `laneRows` makes them taller, `kindColours` fixes each kind's stripe, and the header column fits its content. Only items near the view are rendered |
145
149
  | Sortable list | `SortableList` | Reorder a list and move items between lists, by pointer and by keyboard. React Aria's `GridList` with `useDragAndDrop` (no `@dnd-kit`): a grip per row is the drag handle, so clicking a row selects it and its own actions still work; Enter on the grip picks up, arrows and Tab choose a position or list, Enter drops, Escape cancels, with React Aria's screen-reader announcements. Items carry a kind (`getKind`); a list takes the kinds in `accepts` and says why it refuses another (`refuses`, shown with an icon while that kind is dragged over it). The list never changes the data: `onReorder` and `onInsert` report the move and the app applies it, undoably |
146
- | File intake | `FileButton`, `FileDropZone`, `FileOutcomes`, `MissingFile`, `useFileIntake` | Pick or drop local files, then one outcome per file. `FileButton` is React Aria's `FileTrigger` behind a real named button (the keyboard and phone route); `FileDropZone` is its `DropZone` and says what it takes while a drag is over it. `useFileIntake({ accept, acceptLabel, process })` judges each file after the drop, so a wrong one is named with its reason (type, `maxBytes`, your `check`), runs your own `process` per file (a throw becomes `Failed` with its message and a retry), and never blocks the rest. `FileOutcomes` draws the rows and announces one summary per batch. `MissingFile` is a status word and a "Relink" that opens the picker for that item. Nothing assumes a server |
150
+ | File intake | `FileButton`, `FileDropZone`, `FileOutcomes`, `MissingFile`, `useFileIntake` | Pick or drop local files, then one outcome per file. `FileButton` is React Aria's `FileTrigger` behind a real named button (the keyboard and phone route); `FileDropZone` is its `DropZone` and says what it takes while a drag is over it. `useFileIntake({ accept, acceptLabel, process })` judges each file after the drop, so a wrong one is named with its reason (type, `maxBytes`, your `check`), runs your own `process` per file (a throw becomes `Failed` with its message and a retry), and never blocks the rest. `FileOutcomes` draws the rows and announces one summary per batch. `MissingFile` is a status word and a "Relink" that opens the picker for that item; the name wraps in a narrow pane and a `thumbnail` can lead it. Nothing assumes a server |
147
151
  | Inspector | `Inspector`, `InspectorSection`, `PropertyRow`, `PropertyList` | Properties of the selected thing. `Inspector` is a labelled region with the selection's name as its heading and the empty state (`empty`, required) when `title` is `null`; `selectionKey` gives a new selection fresh controls and keeps focus in the panel. `InspectorSection` is React Aria's `Disclosure` with the body mounted only while open; open and closed are remembered under `storageKey` (storage that throws just means defaults). `PropertyRow` is a `Field` with a "Reset <label>" that shows only while `modified`. `PropertyList` is a `dl`: missing values print an en dash heard as "Not known", units follow a non-breaking space, long values truncate with the whole value in a tooltip |
148
152
  | Feedback | `UndoBar`, `useUndoable`, `Done` | Undo before confirm; the hook owns which rows are out of view (`isRemoved`), a failed commit brings the row back with Try again in the same bar, and `flush()` commits before a dependent action; `Done` is the one celebration, and it must say what happens next |
149
153
  | Helpers | `cn`, `format`, `createFormat`, `NBSP` | `cn` knows `type-*`; all numbers and dates through `Intl`; `format.integer(n)`, `.decimal(n)`, `.percent(n)` are callable and keep Intl's methods; `format.bytes(n, unit?)` writes sizes in decimal units (`byteUnit` shares one unit across figures); `format.date(at)` ("8 Nov 2026") and `format.dateTime(at)` ("8 Nov 2026, 06:05"), like `clock`, `day` and `shortDay`, take a Date, ISO string or epoch ms; `format.ago(at, now?)` ("3 weeks ago"), `format.compact(n)` ("1.2k", and `count(n, one, many, { compact: true })`), `format.runningTime(seconds)` ("1:02:09") and `format.share(n)` ("<1%" for a part that rounds to 0); every number and date formatter prints the placeholder (`format.missing`, an en dash) for `null` or `undefined`; `createFormat(locale, { timeZone, missing })` fixes the zone and the placeholder; units and counts join with a non-breaking space |
@@ -206,6 +210,8 @@ vite build && npx strata-visual # compare; diffs land in tests/visual
206
210
  npx strata-visual --filter review--error # only some shots
207
211
  ```
208
212
 
213
+ A shot's theme reaches the app itself: the runner stores it under the key `ThemeProvider` reads (`strata-color-scheme`) before the page loads, so light shots are light even in an app whose default is dark. To show a state that needs files dropped, use `dropFiles(page, "text=Drop files", [{ name: "clip.mp4", type: "video/mp4", content: bytes }])` from `strata-react/visual` in a `setup`: it dispatches the drag events with a data transfer that holds real `File`s and file-system entries (which React Aria's drop zones need) and a fixed `lastModified`, so a date shown from the file does not change between runs.
214
+
209
215
  Baselines are named `route--state--viewport--theme.png` (`review--empty--phone--dark.png`) and
210
216
  stories `story-id--theme.png`. A shot fails when it differs from its baseline, when any of its
211
217
  text is drawn in a font installed on the machine rather than one the page loaded, when the page
package/UPGRADING.md CHANGED
@@ -13,6 +13,12 @@ Every PR that changes what an app sees adds a line here (see `CLAUDE.md`, "Chang
13
13
 
14
14
  ## After v0.1.17 (2026-11-11 to 2026-11-12)
15
15
 
16
+ - `SeekBar` with a `duration` of 0, `NaN` or `Infinity` (or `null`, now allowed) is drawn disabled; before it was enabled with the thumb at 0. Nothing to change unless a test seeks a bar with no duration.
17
+ - Arrows and macOS modifiers in `KeysLegend`, `CommandLegend`, menu shortcuts and tooltip hints are drawn as icons, each followed by a screen-reader name (`←` reads "left arrow", `⌘` "Command"), so the text no longer contains the symbol: a test that queries `"j or ↓"` queries `"j or down arrow"`, and `"⌘Z"` is `"Command Z"`. Their baselines change a little.
18
+ - The dim behind a `Dialog`, `AlertDialog`, `CommandMenu` and full-screen view is black at an alpha (the `scrim` utility), not `foreground`: in a dark theme it now dims the page instead of brightening it. Dark baselines of anything with an open overlay change.
19
+ - `strata-visual` stores each shot's theme under `strata-color-scheme` before the page loads, so a shot is in the theme it is named for even in an app whose `ThemeProvider` defaults to dark. An app that worked around it by clicking the theme in a `setup` can drop that; its baselines for the light shots change. New: `dropFiles` in `strata-react/visual`; a system-font failure now names the CSS `font-family` stack.
20
+ - `Timeline`'s lane header column is content-sized (at least `w-40`, at most `w-80`) instead of a fixed `w-40`; a screen with a long lane name or several header controls is now wider there. Lane height is `--lane-h` (one `--control-h` by default).
21
+ - `format.timecode` with `precision: "frames"` now returns four parts (`0:04:05:15`, was `4:05:15`); update tests that read it. `MissingFile`'s markup changed (the name wraps; status and Relink may sit on a second row).
16
22
  React Aria Components is now the primitives layer (`react-aria-components`, installed with the
17
23
  package). `@radix-ui/react-slot` is gone.
18
24
 
@@ -29,12 +29,17 @@ export declare function FileOutcomes({ intake, className }: {
29
29
  intake: FileIntake;
30
30
  className?: string;
31
31
  }): React.JSX.Element;
32
- /** A saved item whose file is gone: the item's name, a "File missing" status (a word and an icon) and a "Relink" button that opens the picker for this one item. */
33
- export declare function MissingFile({ name, accept, onRelink, className, }: {
32
+ /**
33
+ * A saved item whose file is gone: the item's name, a "File missing" status (a word and an icon) and a "Relink" button that opens the picker for this one item.
34
+ * In a narrow column the name keeps its own line, in full, and the status and button wrap under it. An optional `thumbnail` sits beside all three.
35
+ */
36
+ export declare function MissingFile({ name, accept, onRelink, thumbnail, className, }: {
34
37
  /** The item's name as the person knows it ("run-02.mp4"). */
35
38
  name: string;
36
39
  accept: readonly string[];
37
40
  /** Called with the file the person chose to stand in for it. */
38
41
  onRelink: (file: File) => void;
42
+ /** A picture of the item (what it last looked like), drawn at the start. */
43
+ thumbnail?: React.ReactNode;
39
44
  className?: string;
40
45
  }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ import * as React from "react";
2
+ /** Key text with its arrows and modifier symbols drawn as icons, each with its name for screen readers. Other text is left as it is. */
3
+ export declare function KeyText({ children }: {
4
+ children: string;
5
+ }): React.JSX.Element;
@@ -15,6 +15,8 @@ export type LineChartProps = {
15
15
  label: string;
16
16
  };
17
17
  formatX: (x: number) => string;
18
+ /** What x is, as the screen-reader table's first column heading: "Distance", "Day". Default "Time". */
19
+ xLabel?: string;
18
20
  formatY: (y: number) => string;
19
21
  /** Where to put x labels, in x units. The chart drops every other one (and so on) when they would overlap at its width. */
20
22
  xTicks: number[];
@@ -67,4 +69,4 @@ export declare function yScale(values: number[], pin?: {
67
69
  */
68
70
  export declare function fitTicks(ticks: number[], scale: (x: number) => number, widthOf: (t: number) => number, gap?: number): number[];
69
71
  /** One measured series, drawn in real pixels, with the peak and current readings labelled on the chart and every reading in a screen-reader table. Optional plan, threshold band and `colourScale`. */
70
- export declare function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, formatX, formatY, xTicks, yMin, yMax, colour, colourScale, colourScaleLabel, current, formatCurrent, readout, onPick, area, height, className, }: LineChartProps): React.JSX.Element;
72
+ export declare function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, formatX, xLabel, formatY, xTicks, yMin, yMax, colour, colourScale, colourScaleLabel, current, formatCurrent, readout, onPick, area, height, className, }: LineChartProps): React.JSX.Element;
@@ -0,0 +1,90 @@
1
+ import * as React from "react";
2
+ /** Why a player is not playing, for the app to word. */
3
+ export type MediaProblem = {
4
+ kind: "load";
5
+ message: string;
6
+ } | {
7
+ kind: "blocked";
8
+ message: string;
9
+ };
10
+ /** What `useMediaElement` returns: the element's state as values, and the requests a player makes of it. */
11
+ export type MediaElementState = {
12
+ playing: boolean;
13
+ /** Seconds. */
14
+ time: number;
15
+ /** Seconds, or null until the element knows it (a stream reports NaN or Infinity). */
16
+ duration: number | null;
17
+ /** Seconds buffered from the start of the range holding `time`. */
18
+ buffered: number;
19
+ /** 0 to 100; 0 while muted. */
20
+ volume: number;
21
+ muted: boolean;
22
+ rate: number;
23
+ ended: boolean;
24
+ /** Waiting for data (the first load, or a seek into what is not buffered yet). */
25
+ loading: boolean;
26
+ error: MediaProblem | null;
27
+ play: () => Promise<void>;
28
+ pause: () => void;
29
+ toggle: () => void;
30
+ /** Seeks; before the metadata has loaded, remembers the time and applies it when it has. */
31
+ seek: (time: number) => void;
32
+ /** 0 to 100. 0 mutes; more unmutes at that level. */
33
+ setVolume: (volume: number) => void;
34
+ setRate: (rate: number) => void;
35
+ /** Loads again, and plays if it was playing. For the error state's "Try again". */
36
+ retry: () => void;
37
+ };
38
+ /** Follows an `<audio>` or `<video>` and returns its state and the requests a player makes. Works with the browser's own controls too. */
39
+ export declare function useMediaElement(ref: React.RefObject<HTMLMediaElement | null>): MediaElementState;
40
+ /** One file in a sequence. */
41
+ export type MediaSource = {
42
+ src: string;
43
+ /** Names the source on the seek bar's marks and in "Chapter 2 of 5". */
44
+ title: string;
45
+ /** Seconds. When every source gives it, the seek bar spans the whole sequence. */
46
+ duration?: number;
47
+ };
48
+ /** Lock-screen and headset metadata (`navigator.mediaSession`). */
49
+ export type MediaSession = {
50
+ title: string;
51
+ artist?: string;
52
+ album?: string;
53
+ artwork?: string;
54
+ };
55
+ export type MediaPlayerProps = {
56
+ /** Names the player and its element. */
57
+ label: string;
58
+ kind?: "audio" | "video";
59
+ /** One file. */
60
+ src?: string;
61
+ /** Or a sequence; ending moves to the next and keeps playing. */
62
+ sources?: readonly MediaSource[];
63
+ /** The current source, when the app holds it (a chapter list beside the player). */
64
+ index?: number;
65
+ onIndexChange?: (index: number) => void;
66
+ /** Move to the next source when one ends. Default true. */
67
+ autoAdvance?: boolean;
68
+ /** `"auto"`: the browser's controls on a touch device, Strata's on a desktop. Default. */
69
+ controls?: "auto" | "native" | "strata";
70
+ autoPlay?: boolean;
71
+ poster?: string;
72
+ session?: MediaSession;
73
+ /** The playback speeds offered. Default 0.5 to 2; for speech use {@link SPEECH_RATES}. */
74
+ rates?: readonly number[];
75
+ /** Keys on the page (Space or K, J and L for 10 s, M). Default true; turn off when the screen binds its own. */
76
+ shortcuts?: boolean;
77
+ /** The last source has ended. */
78
+ onEnded?: () => void;
79
+ /** Called as the element plays, with the time in the whole sequence. */
80
+ onTimeChange?: (time: number) => void;
81
+ className?: string;
82
+ };
83
+ /** Playback speeds an audiobook or lecture listener expects. */
84
+ export declare const SPEECH_RATES: readonly number[];
85
+ /**
86
+ * Plays a file or a sequence: the element, its state, and Strata's controls (or the browser's own on
87
+ * a touch device), with the failure to load shown and retried. For an editor or a replay, use the
88
+ * parts and `useMediaElement` directly.
89
+ */
90
+ export declare function MediaPlayer({ label, kind, src, sources, index: controlledIndex, onIndexChange, autoAdvance, controls, autoPlay, poster, session, rates, shortcuts, onEnded, onTimeChange, className, }: MediaPlayerProps): React.JSX.Element;
@@ -14,7 +14,8 @@ export declare function TimeReadout({ time, duration, precision, fps, className
14
14
  }): React.JSX.Element;
15
15
  export type SeekBarProps = TimeProps & {
16
16
  time: number;
17
- duration: number;
17
+ /** Seconds; null, NaN or 0 while it is not known (a stream before its metadata): the bar is drawn disabled, with no thumb. */
18
+ duration: number | null;
18
19
  /** The viewer asked for this time (drag, click or key). */
19
20
  onSeek: (time: number) => void;
20
21
  /** Named points on the bar (chapters, markers). Pressing one seeks to it. */
@@ -33,7 +34,7 @@ export type SeekBarProps = TimeProps & {
33
34
  className?: string;
34
35
  };
35
36
  /** A seek bar: dragged, clicked and moved by keys (arrows `step`, Page keys `bigStep`, Home and End), with its time as the accessible value. */
36
- export declare function SeekBar({ time, duration, onSeek, marks, buffered, step, bigStep, label, precision, fps, disabled, className }: SeekBarProps): React.JSX.Element;
37
+ export declare function SeekBar({ time, duration: known, onSeek, marks, buffered, step, bigStep, label, precision, fps, disabled: off, className }: SeekBarProps): React.JSX.Element;
37
38
  export type TransportProps = {
38
39
  playing: boolean;
39
40
  onPlayPause: () => void;
@@ -1,3 +1,4 @@
1
+ import { DropItem } from 'react-aria-components';
1
2
  import * as React from "react";
2
3
  export type TimelineItem = {
3
4
  id: string;
@@ -7,7 +8,7 @@ export type TimelineItem = {
7
8
  length: number;
8
9
  /** The item's name, in the item and for a screen reader. */
9
10
  label: string;
10
- /** What kind of thing it is (video, audio, booking). Shown as a word and a colour stripe, never colour alone. */
11
+ /** What kind of thing it is (video, audio, booking). Shown as a word and a colour stripe, never colour alone. Its colour is `kindColours[kind]`, else the chart palette in order of appearance. */
11
12
  kind?: string;
12
13
  };
13
14
  export type TimelineLane = {
@@ -27,6 +28,10 @@ export type TimelineChange = {
27
28
  length: number;
28
29
  lane: string;
29
30
  };
31
+ /** Where something dragged in from outside landed. */
32
+ export type TimelineDrop = TimelineChange & {
33
+ items: DropItem[];
34
+ };
30
35
  export type TimelineProps = {
31
36
  /** Names the timeline for a screen reader ("Firing schedule"). */
32
37
  label: string;
@@ -62,6 +67,18 @@ export type TimelineProps = {
62
67
  step?: number;
63
68
  /** Smallest an item may be, in time units. Default `step`. */
64
69
  minLength?: number;
70
+ /** The colour of each kind's stripe, chosen by the app: a CSS colour, normally a role or a subject colour of its theme (`var(--info)`, `var(--kind-gpx)`). Without an entry a kind takes the chart palette in order of appearance, which moves when the set of kinds changes. */
71
+ kindColours?: Readonly<Record<string, string>>;
72
+ /** How many control heights tall each lane is. Default 1; 2 or 3 for items that draw thumbnails or a waveform. */
73
+ laneRows?: number;
74
+ /** Drag types a lane accepts from outside the timeline (`"text/plain"`, an app type). Without it nothing can be dropped. */
75
+ dropTypes?: readonly string[];
76
+ /** Length of an item dropped from outside, for the preview and for `validateDrop`. Default five steps. */
77
+ dropLength?: number;
78
+ /** Something was dropped on a lane at a time (snapped like a move). The app makes the item. Not called for a drop `validateDrop` refused. */
79
+ onDrop?: (drop: TimelineDrop) => void;
80
+ /** A reason a drop cannot be made, in the product's words, or `null`. Called while a drag is over a lane, so keep it cheap. */
81
+ validateDrop?: (next: TimelineChange) => string | null;
65
82
  /** Draws an item's content (a strip of thumbnails, a waveform). Default: the label and kind. */
66
83
  renderItem?: (item: TimelineItem, state: {
67
84
  selected: boolean;
@@ -95,4 +112,4 @@ export declare function TimelineZoomControls({ zoom }: {
95
112
  /** A rule that refuses an item overlapping another in its lane, for `validate`: names the item in the way. */
96
113
  export declare function noOverlap(items: readonly TimelineItem[]): (id: string, next: TimelineChange) => string | null;
97
114
  /** Items placed on a zoomable time axis in lanes, with a current-time rule and markers. Reports every move, trim, selection and time change; the app applies them. Keyboard-complete, and only the items near the view are rendered. */
98
- export declare function Timeline({ label, lanes, items, from, to, zoom, onZoomChange, position, onPositionChange, follow, markers, selectedIds, onSelect, onItemChange, onDelete, validate, snapPoints, snap, step, minLength, renderItem, formatTime, empty, className, }: TimelineProps): React.JSX.Element;
115
+ export declare function Timeline({ label, lanes, items, from, to, zoom, onZoomChange, position, onPositionChange, follow, markers, selectedIds, onSelect, onItemChange, onDelete, validate, snapPoints, snap, step, minLength, renderItem, kindColours, laneRows, dropTypes, dropLength, onDrop, validateDrop, formatTime, empty, className, }: TimelineProps): React.JSX.Element;
@@ -0,0 +1,63 @@
1
+ import * as React from "react";
2
+ /** What `useWorkspaceState` returns: pass it to `Workspace`, and use it from outside (a menu, a shortcut) to fold or reset panes. */
3
+ export type WorkspaceState = {
4
+ /** Whether a pane is folded now. `fallback` is the pane's `defaultCollapsed`. */
5
+ isCollapsed: (id: string, fallback?: boolean) => boolean;
6
+ setCollapsed: (id: string, collapsed: boolean) => void;
7
+ /** Folds an open pane, opens a folded one. */
8
+ toggle: (id: string) => void;
9
+ /** Forgets every size and fold, back to the defaults. */
10
+ reset: () => void;
11
+ /** @internal */
12
+ sizeOf: (id: string) => number | undefined;
13
+ /** @internal */
14
+ setSize: (id: string, size: number | null) => void;
15
+ /** @internal */
16
+ register: (id: string, defaultCollapsed: boolean) => void;
17
+ /** @internal */
18
+ narrow: boolean;
19
+ /** @internal */
20
+ setNarrow: (narrow: boolean) => void;
21
+ };
22
+ /** The sizes and folded panes of a `Workspace`; with `persist`, remembered in localStorage under that name. */
23
+ export declare function useWorkspaceState(persist?: string): WorkspaceState;
24
+ /** The workspace: a labelled region that holds the splits and panes, and stacks them when narrow. */
25
+ export declare function Workspace({ label, state, narrowBelow, className, children, }: {
26
+ label: string;
27
+ state: WorkspaceState;
28
+ /** Stack side-by-side splits when the workspace is narrower than this many pixels. Default 720. */
29
+ narrowBelow?: number;
30
+ className?: string;
31
+ children: React.ReactNode;
32
+ }): React.JSX.Element;
33
+ /** What a `Pane` is, for the split that lays it out. */
34
+ export type PaneProps = {
35
+ /** Identifies the pane in the remembered state: unique in the workspace. */
36
+ id: string;
37
+ /** The pane's name, in its header and as its landmark: "Library", "Inspector". */
38
+ name: string;
39
+ /** Takes the space the fixed panes leave. One per split (a nested `Split` always does). */
40
+ grow?: boolean;
41
+ /** Starting size in pixels (width beside the stage, height above or below it). Default 280. */
42
+ size?: number;
43
+ /** Smallest size in pixels. Default 160; for a growing pane, the least it keeps (default 240 wide, 120 high). */
44
+ min?: number;
45
+ /** Largest size in pixels. Default none. */
46
+ max?: number;
47
+ /** Shows a collapse button in the header and lets the pane fold to a rail or its header. */
48
+ collapsible?: boolean;
49
+ /** Starts folded until the person opens it. */
50
+ defaultCollapsed?: boolean;
51
+ /** The pane's few actions, drawn in its header before the collapse button. */
52
+ actions?: React.ReactNode;
53
+ className?: string;
54
+ children?: React.ReactNode;
55
+ };
56
+ /** A region of a workspace with a consistent header (name, actions, fold button) and a body that scrolls. */
57
+ export declare function Pane({ id, name, grow, size, min, max, collapsible, defaultCollapsed, actions, className, children }: PaneProps): React.JSX.Element;
58
+ /** Lays its children out in a row or a column, with a separator between a fixed pane and its neighbour. A nested split takes the space the fixed panes leave. */
59
+ export declare function Split({ direction, className, children }: {
60
+ direction: "row" | "column";
61
+ className?: string;
62
+ children: React.ReactNode;
63
+ }): React.JSX.Element;