strata-react 1.0.12 → 1.0.18
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 +10 -3
- package/UPGRADING.md +4 -0
- package/dist/components/button.d.ts +6 -3
- package/dist/components/density.d.ts +16 -0
- package/dist/components/field.d.ts +9 -4
- package/dist/components/file-intake.d.ts +7 -2
- package/dist/components/history.d.ts +61 -0
- package/dist/components/line-chart.d.ts +3 -1
- package/dist/components/save.d.ts +46 -0
- package/dist/components/theme.d.ts +7 -1
- package/dist/components/timeline.d.ts +19 -2
- package/dist/components/value-controls.d.ts +4 -1
- package/dist/components/workspace.d.ts +63 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +901 -111
- package/dist/index.js.map +1 -1
- package/dist/lib/control.d.ts +4 -0
- package/dist/lib/format.d.ts +12 -6
- package/dist/{query-CXlmWmrY.js → query-CIh1Dpgn.js} +43 -11
- package/dist/query-CIh1Dpgn.js.map +1 -0
- package/dist/strata.css +7 -1
- package/dist/testing.js +1 -1
- package/package.json +1 -1
- package/dist/query-CXlmWmrY.js.map +0 -1
package/README.md
CHANGED
|
@@ -114,6 +114,10 @@ function KilnRoom() {
|
|
|
114
114
|
}
|
|
115
115
|
```
|
|
116
116
|
|
|
117
|
+
### Testing with Vitest, or with Jest
|
|
118
|
+
|
|
119
|
+
strata-react is ESM-only (`exports` has only `import`), as is its peer `react-router`. **Vitest is the supported runner**: it needs no configuration beyond the `strata-react/testing` helpers. An app on Jest has to do the work itself (strata-vid's `jest.base.config.js` is a working example): transform `.mjs` along with `.js`; leave `strata-react`, `react-router`, `@remix-run`, `cookie-es`, `@tanstack` and `pixelmatch` out of `transformIgnorePatterns` so Babel compiles them; and replace `import.meta` for CommonJS with a small Babel plugin (react-router reads it). Strata's own suite runs on Vitest only, so a Jest setup is the app's to keep working.
|
|
120
|
+
|
|
117
121
|
## Components
|
|
118
122
|
|
|
119
123
|
| Group | Exports | Notes |
|
|
@@ -121,7 +125,7 @@ function KilnRoom() {
|
|
|
121
125
|
| 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` |
|
|
122
126
|
| 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 |
|
|
123
127
|
| 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 |
|
|
124
|
-
| 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`) |
|
|
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`); `xLabel` names the x column of its table |
|
|
125
129
|
| 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 |
|
|
126
130
|
| 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 |
|
|
127
131
|
| 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 |
|
|
@@ -129,15 +133,18 @@ function KilnRoom() {
|
|
|
129
133
|
| Page and navigation | `AppShell`, `SideNav`, `Breadcrumb`, `Tabs`, `PageHeader`, `LinkCard`, `LinkCardList` | React Router; tab and sort state in the URL; a `LinkCard` is one link named by its title, described by its text and `Status` marks, with the whole card as the target (`to` a route, `href` elsewhere, marked with an arrow) |
|
|
130
134
|
| 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 |
|
|
131
135
|
| 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
|
+
| 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 |
|
|
137
|
+
| 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 |
|
|
138
|
+
| 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` |
|
|
132
139
|
| 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 |
|
|
133
140
|
| 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 |
|
|
134
141
|
| 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 |
|
|
135
142
|
| 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 |
|
|
136
143
|
| 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` |
|
|
137
144
|
| 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` |
|
|
138
|
-
| 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 |
|
|
145
|
+
| 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 |
|
|
139
146
|
| 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 |
|
|
140
|
-
| 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 |
|
|
147
|
+
| 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 |
|
|
141
148
|
| 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 |
|
|
142
149
|
| 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 |
|
|
143
150
|
| 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 |
|
package/UPGRADING.md
CHANGED
|
@@ -13,9 +13,13 @@ 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
|
+
- `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).
|
|
17
|
+
- `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
18
|
React Aria Components is now the primitives layer (`react-aria-components`, installed with the
|
|
17
19
|
package). `@radix-ui/react-slot` is gone.
|
|
18
20
|
|
|
21
|
+
- **`Input` and `NativeSelect` take `size="default" | "sm"`**, not the native numeric `size` attribute (it is no longer passed through). Their height comes from `--control-h` / `--control-h-sm`, so a root `data-density` changes them, as it does `Button`. `NumberField`'s box lost its fixed height for the same reason; its visual baselines may move by a pixel.
|
|
22
|
+
- **A `ColorField` inside a `Field` has its picker named after the field** ("Route colour, picker"), not "Colour picker"; query it by that name. A `Dialog` or `AlertDialog` with `open` and no `trigger` no longer renders a `DialogTrigger`.
|
|
19
23
|
- **`DataTable` is a `grid`**, not a `table`: query `getByRole("grid", { name: caption })`, cells as `gridcell` and the first column's cells as `rowheader` (React Aria requires a row header; it is the first column). A sortable header is the `columnheader` itself, with no inner `button`: click it, and `aria-sort` is `"none"` until sorted. The `region` that wrapped a table is gone, and a toggle has no `aria-controls`. A click on a cell no longer touches the selection: only the checkbox or Space chooses a row. A part-chosen "Select all shown" still clears. Virtualised tables (100+ rows) size columns evenly rather than to their content. In a jsdom test of a virtualised table with `expansion`, or of a `SelectableGrid` of 100+ tiles, set `Element.prototype.scrollHeight` (the Virtualizer measures rows by it).
|
|
20
24
|
- **`SelectableGrid` is a `grid` of `row`s** (was a `list` of `listitem`s, a `region` once virtualised): query `getByRole("grid", { name: label })`; a press anywhere on a tile toggles it as before, and Shift-click, Shift+Space and "Select all shown" still extend and clear. Virtualised tiles keep a margin of one gap around the box.
|
|
21
25
|
- **`@tanstack/react-virtual` is no longer a dependency.** Strata does not need it; if an app imported it through Strata, add it itself.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { PressEvent } from 'react-aria-components';
|
|
2
2
|
import { VariantProps } from 'class-variance-authority';
|
|
3
3
|
import { IconComponent } from '../lib/icon';
|
|
4
|
+
import { ControlSize } from '../lib/control';
|
|
4
5
|
import * as React from "react";
|
|
5
6
|
export declare const buttonVariants: (props?: ({
|
|
6
7
|
variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
|
|
7
|
-
size?: "default" | "sm" | "icon" | null | undefined;
|
|
8
|
+
size?: "default" | "sm" | "icon" | "icon-sm" | null | undefined;
|
|
8
9
|
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
9
10
|
export type ButtonProps = Omit<React.ComponentProps<"button">, "className" | "style"> & VariantProps<typeof buttonVariants> & {
|
|
10
11
|
className?: string;
|
|
@@ -17,15 +18,17 @@ export type ButtonProps = Omit<React.ComponentProps<"button">, "className" | "st
|
|
|
17
18
|
* `outline`; ask for the filled accent (`variant="default"`) once per view. `type` defaults to `button`.
|
|
18
19
|
* `onClick` and `disabled` are the DOM names and keep working; `onPress` is also accepted.
|
|
19
20
|
*/
|
|
20
|
-
export declare function Button({ className, variant, size, type, disabled, ...props }: ButtonProps): React.JSX.Element;
|
|
21
|
+
export declare function Button({ className, variant, size, type, disabled, children, ...props }: ButtonProps): React.JSX.Element;
|
|
21
22
|
export type IconButtonProps = Omit<ButtonProps, "size" | "children" | "aria-label"> & {
|
|
23
|
+
/** `sm` is --control-h-sm, the height of a small `Toggle` or `Button`, for a toolbar or property row. Default --control-h. */
|
|
24
|
+
size?: ControlSize;
|
|
22
25
|
icon: IconComponent;
|
|
23
26
|
label: string;
|
|
24
27
|
/** Shown after the label in its tooltip, muted: "Ctrl+Z". */
|
|
25
28
|
hint?: React.ReactNode;
|
|
26
29
|
};
|
|
27
30
|
/** An icon-only button. `label` is required and becomes the accessible name and the tooltip (hover and keyboard focus); `hint` adds a muted aside to it, such as a shortcut. */
|
|
28
|
-
export declare function IconButton({ icon: Icon, label, hint, variant, ...props }: IconButtonProps): React.JSX.Element;
|
|
31
|
+
export declare function IconButton({ icon: Icon, label, hint, variant, size, ...props }: IconButtonProps): React.JSX.Element;
|
|
29
32
|
export type RowActionProps = Omit<ButtonProps, "children" | "aria-label"> & {
|
|
30
33
|
/** The visible verb, sentence case: "Withdraw", "Remove". */
|
|
31
34
|
label: string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** How much a screen packs in: `default`, or `compact` for a tool screen. */
|
|
3
|
+
export type DensityName = "default" | "compact";
|
|
4
|
+
/** The density attribute's page-level setter, shared by `ThemeProvider`. @internal */
|
|
5
|
+
export declare function useDensityOn(value: DensityName | undefined, target?: HTMLElement | null): void;
|
|
6
|
+
/** Props for `Density`. */
|
|
7
|
+
export type DensityProps = {
|
|
8
|
+
value: DensityName;
|
|
9
|
+
/** Set it on the document's root element for the whole page, overlays included, instead of wrapping a region. Renders only its children. */
|
|
10
|
+
page?: boolean;
|
|
11
|
+
/** For the wrapper of a region: layout classes (the wrapper is a plain `div`; `contents` takes it out of layout). */
|
|
12
|
+
className?: string;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
};
|
|
15
|
+
/** Sets the density of a region (a wrapper `div`), or of the whole page with `page`, where overlays are reached too. */
|
|
16
|
+
export declare function Density({ value, page, className, children }: DensityProps): React.JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ControlSize } from '../lib/control';
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
type FieldState = {
|
|
3
4
|
id: string;
|
|
@@ -26,12 +27,16 @@ export type FieldProps = {
|
|
|
26
27
|
};
|
|
27
28
|
/** A labelled form field: wires the label, hint, error, `aria-describedby` and `aria-invalid` into the one control it wraps. */
|
|
28
29
|
export declare function Field({ label, id: idProp, hint, error, action, children, className }: FieldProps): React.JSX.Element;
|
|
29
|
-
/** A text input that picks up its id and descriptions from the surrounding `Field`. */
|
|
30
|
-
export declare function Input({ className, id, ...props }: React.ComponentProps<"input">
|
|
30
|
+
/** A text input that picks up its id and descriptions from the surrounding `Field`. `size="sm"` is --control-h-sm; the native `size` (a width in characters) is not passed on. */
|
|
31
|
+
export declare function Input({ className, id, size, ...props }: Omit<React.ComponentProps<"input">, "size"> & {
|
|
32
|
+
size?: ControlSize;
|
|
33
|
+
}): React.JSX.Element;
|
|
31
34
|
/** A multi-line input that picks up its id and descriptions from the surrounding `Field`. */
|
|
32
35
|
export declare function Textarea({ className, id, ...props }: React.ComponentProps<"textarea">): React.JSX.Element;
|
|
33
|
-
/** The platform select, styled. The default for short lists, especially on touch screens. */
|
|
34
|
-
export declare function NativeSelect({ className, id, ...props }: React.ComponentProps<"select">
|
|
36
|
+
/** The platform select, styled. The default for short lists, especially on touch screens. `size="sm"` is --control-h-sm. */
|
|
37
|
+
export declare function NativeSelect({ className, id, size, ...props }: Omit<React.ComponentProps<"select">, "size"> & {
|
|
38
|
+
size?: ControlSize;
|
|
39
|
+
}): React.JSX.Element;
|
|
35
40
|
export type Choice = {
|
|
36
41
|
value: string;
|
|
37
42
|
label: string;
|
|
@@ -29,12 +29,17 @@ export declare function FileOutcomes({ intake, className }: {
|
|
|
29
29
|
intake: FileIntake;
|
|
30
30
|
className?: string;
|
|
31
31
|
}): React.JSX.Element;
|
|
32
|
-
/**
|
|
33
|
-
|
|
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,61 @@
|
|
|
1
|
+
import { Command } from './commands';
|
|
2
|
+
/** One undoable step. `label` is the phrase after the verb ("move clip"); `undo` and `redo` must be inverses. */
|
|
3
|
+
export type HistoryStep = {
|
|
4
|
+
label: string;
|
|
5
|
+
undo: () => void;
|
|
6
|
+
redo: () => void;
|
|
7
|
+
/** Consecutive pushes with the same key merge into one step (a slider, a text drag). */
|
|
8
|
+
key?: string;
|
|
9
|
+
};
|
|
10
|
+
/** Options for `useHistory`. */
|
|
11
|
+
export type HistoryOptions = {
|
|
12
|
+
/** The most steps kept; the oldest is dropped past it. Default 100. */
|
|
13
|
+
limit?: number;
|
|
14
|
+
};
|
|
15
|
+
/** What `useHistory` returns. */
|
|
16
|
+
export type History = {
|
|
17
|
+
/** Records a step the app has just done. Clears what could have been redone. Inside `begin`/`end` it joins the group. */
|
|
18
|
+
push: (step: HistoryStep) => void;
|
|
19
|
+
/** Starts a group named `label`; every push until the returned `end()` is one step. Nested groups join the outer one. An empty group records nothing. */
|
|
20
|
+
begin: (label: string) => () => void;
|
|
21
|
+
/** `begin`, run a function, `end`. */
|
|
22
|
+
group: <T>(label: string, run: () => T) => T;
|
|
23
|
+
undo: () => void;
|
|
24
|
+
redo: () => void;
|
|
25
|
+
canUndo: boolean;
|
|
26
|
+
canRedo: boolean;
|
|
27
|
+
/** The name of the step Undo would take back, or undefined. */
|
|
28
|
+
undoLabel: string | undefined;
|
|
29
|
+
/** The name of the step Redo would repeat, or undefined. */
|
|
30
|
+
redoLabel: string | undefined;
|
|
31
|
+
/** Names of the steps that can be undone, oldest first. */
|
|
32
|
+
past: string[];
|
|
33
|
+
/** Names of the steps that can be redone, next first. */
|
|
34
|
+
future: string[];
|
|
35
|
+
/** The history holds `limit` steps, so the next push drops the oldest. */
|
|
36
|
+
atLimit: boolean;
|
|
37
|
+
/** Forgets every step (a document was opened or saved to a new place). */
|
|
38
|
+
clear: () => void;
|
|
39
|
+
/** Undo then Redo as commands: "Undo move clip", disabled with "Nothing to undo". Pass to `useCommands` and a `Menu`. */
|
|
40
|
+
commands: [undo: Command, redo: Command];
|
|
41
|
+
};
|
|
42
|
+
/** A history of named, undoable steps with grouping, a limit, and Undo and Redo as commands. */
|
|
43
|
+
export declare function useHistory({ limit }?: HistoryOptions): History;
|
|
44
|
+
/** Options for `useHistoryState`. */
|
|
45
|
+
export type HistoryStateOptions = HistoryOptions;
|
|
46
|
+
/** What `setValue` takes besides the new value. */
|
|
47
|
+
export type SetOptions = {
|
|
48
|
+
/** Merges consecutive changes with this key into one step (a slider, a drag). */
|
|
49
|
+
key?: string;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* React state with a history: `set(next, "move clip")` changes the value and records the step; Undo
|
|
53
|
+
* and Redo put the old and new values back. For an app whose document is a plain value. An app on its
|
|
54
|
+
* own store uses `useHistory` and pushes steps from its actions.
|
|
55
|
+
*/
|
|
56
|
+
export declare function useHistoryState<S>(initial: S | (() => S), options?: HistoryStateOptions): {
|
|
57
|
+
value: S;
|
|
58
|
+
set: (next: S | ((previous: S) => S), label: string, { key }?: SetOptions) => void;
|
|
59
|
+
reset: (next: S) => void;
|
|
60
|
+
history: History;
|
|
61
|
+
};
|
|
@@ -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,46 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** The state of a document's saving. */
|
|
3
|
+
export type SaveState = {
|
|
4
|
+
status: "saved"; /** When it last saved here; null for a document just opened. */
|
|
5
|
+
at: Date | null;
|
|
6
|
+
} | {
|
|
7
|
+
status: "dirty";
|
|
8
|
+
} | {
|
|
9
|
+
status: "saving";
|
|
10
|
+
} | {
|
|
11
|
+
status: "failed"; /** What happened, in the product's words. */
|
|
12
|
+
reason?: string;
|
|
13
|
+
};
|
|
14
|
+
/** Options for `useAutoSave`. */
|
|
15
|
+
export type AutoSaveOptions<V> = {
|
|
16
|
+
/** The document's current value. Compared with what was last saved by `equals`. */
|
|
17
|
+
value: V;
|
|
18
|
+
/** Saves a value. Throw (or reject) to fail. */
|
|
19
|
+
save: (value: V) => void | Promise<unknown>;
|
|
20
|
+
/** Wait this long after the last change before saving. `null`: never on its own, only `saveNow()`. Default 1500. */
|
|
21
|
+
delayMs?: number | null;
|
|
22
|
+
/** Whether two values are the same document. Default `Object.is`. */
|
|
23
|
+
equals?: (a: V, b: V) => boolean;
|
|
24
|
+
/** Turns a thrown error into the sentence shown. Default `describeActionError`. */
|
|
25
|
+
describeError?: (error: unknown) => string | undefined;
|
|
26
|
+
};
|
|
27
|
+
/** What `useAutoSave` returns. */
|
|
28
|
+
export type AutoSave = {
|
|
29
|
+
state: SaveState;
|
|
30
|
+
/** Saves now (and is "Try again" after a failure). Resolves when the save has finished, failed or not. */
|
|
31
|
+
saveNow: () => Promise<void>;
|
|
32
|
+
};
|
|
33
|
+
/** Saves `value` after changes settle, never two at once, and says where it stands. The document's first `value` counts as saved. */
|
|
34
|
+
export declare function useAutoSave<V>({ value, save, delayMs, equals, describeError }: AutoSaveOptions<V>): AutoSave;
|
|
35
|
+
/** Asks the browser to confirm before the page is closed or reloaded, while `active`. Off when there is nothing to lose. */
|
|
36
|
+
export declare function useLeaveGuard(active: boolean): void;
|
|
37
|
+
/**
|
|
38
|
+
* The sign of whether the work is safe: "Saved 10:42", "Saving…", "Unsaved changes", or "Not saved"
|
|
39
|
+
* with the reason and "Try again". Fixed width, so it never moves what is beside it. Announces a
|
|
40
|
+
* failure, and the recovery from one, politely; a routine save is silent.
|
|
41
|
+
*/
|
|
42
|
+
export declare function SaveStatus({ state, onRetry, className }: {
|
|
43
|
+
state: SaveState;
|
|
44
|
+
onRetry: () => void;
|
|
45
|
+
className?: string;
|
|
46
|
+
}): React.JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { DensityName } from './density';
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
/** What a person chose: follow the operating system, or a fixed light or dark theme. */
|
|
3
4
|
export type ColorSchemePreference = "system" | "light" | "dark";
|
|
@@ -14,7 +15,7 @@ export type ColorSchemeState = {
|
|
|
14
15
|
setPreference: (preference: ColorSchemePreference) => void;
|
|
15
16
|
};
|
|
16
17
|
/** Sets the `.dark` class strata.css keys on, from a system, light or dark preference that persists in localStorage when it can. */
|
|
17
|
-
export declare function ThemeProvider({ children, defaultPreference, storageKey, target, }: {
|
|
18
|
+
export declare function ThemeProvider({ children, defaultPreference, storageKey, target, density, }: {
|
|
18
19
|
children: React.ReactNode;
|
|
19
20
|
/** The preference before a person has chosen one. */
|
|
20
21
|
defaultPreference?: ColorSchemePreference;
|
|
@@ -28,6 +29,11 @@ export declare function ThemeProvider({ children, defaultPreference, storageKey,
|
|
|
28
29
|
* means it has not mounted yet, and nothing is set until it has.
|
|
29
30
|
*/
|
|
30
31
|
target?: HTMLElement | null;
|
|
32
|
+
/**
|
|
33
|
+
* How much the screen packs in, set on the same element as the colour scheme (the root, so
|
|
34
|
+
* overlays are reached): `compact` for a tool screen. See `Density`. Left out, nothing is set.
|
|
35
|
+
*/
|
|
36
|
+
density?: DensityName;
|
|
31
37
|
}): React.JSX.Element;
|
|
32
38
|
/** The person's colour-scheme preference, the scheme in effect, and a setter that persists it. Must be inside `ThemeProvider`. */
|
|
33
39
|
export declare function useColorScheme(): ColorSchemeState;
|
|
@@ -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;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ControlSize } from '../lib/control';
|
|
1
2
|
import * as React from "react";
|
|
2
3
|
/** Props shared by the number field and the slider. */
|
|
3
4
|
export type RangeProps = {
|
|
@@ -25,10 +26,12 @@ export type NumberFieldProps = RangeProps & {
|
|
|
25
26
|
"aria-label"?: string;
|
|
26
27
|
id?: string;
|
|
27
28
|
name?: string;
|
|
29
|
+
/** `sm` is --control-h-sm, the height of a small `Toggle` or `IconButton` beside it. Default --control-h. */
|
|
30
|
+
size?: ControlSize;
|
|
28
31
|
className?: string;
|
|
29
32
|
};
|
|
30
33
|
/** A number with a unit on React Aria's number field: typed input is validated, not clamped, so an out-of-range value is explained in the surrounding `Field` and never passed on; empty stays `null`. */
|
|
31
|
-
export declare function NumberField({ value, onChange, min, max, step, places, unit, locale, required, disabled, id: idProp, name, className, "aria-label": ariaLabel, }: NumberFieldProps): React.JSX.Element;
|
|
34
|
+
export declare function NumberField({ value, onChange, min, max, step, places, unit, locale, required, disabled, id: idProp, name, size, className, "aria-label": ariaLabel, }: NumberFieldProps): React.JSX.Element;
|
|
32
35
|
/** Props for `Slider`. */
|
|
33
36
|
export type SliderProps = RangeProps & {
|
|
34
37
|
value: number;
|
|
@@ -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;
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export { JobStatus, type JobStatusProps, type JobFailure, type JobWords } from '
|
|
|
35
35
|
export { Thumbnail, ThumbnailSkeleton, type ThumbnailProps, type AspectRatio } from './components/thumbnail';
|
|
36
36
|
export { DataTable, TableSkeleton, parseSort, serialiseSort, type CellValue, type Column, type Sort, type DataTableProps, type RowSelection, type RowExpansion, } from './components/data-table';
|
|
37
37
|
export { Transport, TimeReadout, SeekBar, VolumeControl, RateChoice, MediaStage, StageGuides, transportShortcuts, type TransportProps, type SeekBarProps, type VolumeControlProps, type Precision } from './components/media';
|
|
38
|
-
export { Timeline, TimelineZoomControls, useTimelineZoom, noOverlap, type TimelineProps, type TimelineItem, type TimelineLane, type TimelineMarker, type TimelineChange } from './components/timeline';
|
|
38
|
+
export { Timeline, TimelineZoomControls, useTimelineZoom, noOverlap, type TimelineProps, type TimelineItem, type TimelineLane, type TimelineMarker, type TimelineChange, type TimelineDrop } from './components/timeline';
|
|
39
39
|
export { tickStep, ticksBetween, tickLabel } from './lib/timeline';
|
|
40
40
|
export { SortableList, type SortableListProps, type DropTarget } from './components/sortable-list';
|
|
41
41
|
export { FileButton, FileDropZone, FileOutcomes, MissingFile } from './components/file-intake';
|
|
@@ -52,6 +52,8 @@ export { UndoBar, useUndoable, type PendingRemoval, type FailedRemoval, type Und
|
|
|
52
52
|
export { Done } from './components/done';
|
|
53
53
|
export { AppShell, SideNav, Breadcrumb, type NavItem } from './components/app-shell';
|
|
54
54
|
export { Tabs, type TabItem } from './components/tabs';
|
|
55
|
+
export { Density, type DensityName, type DensityProps } from './components/density';
|
|
56
|
+
export type { ControlSize } from './lib/control';
|
|
55
57
|
export { useHotkeys, KeysLegend, isTypingTarget, type Shortcut } from './components/hotkeys';
|
|
56
58
|
export { useActiveItem, ActiveList, type ActiveItem } from './components/active-list';
|
|
57
59
|
export { ThemeProvider, useColorScheme, useSystemColorScheme, ColorSchemeChoice, colorSchemeScript, COLOR_SCHEME_STORAGE_KEY, type ColorScheme, type ColorSchemePreference, type ColorSchemeLabels, type ColorSchemeState, } from './components/theme';
|
|
@@ -64,3 +66,6 @@ export { FIT, MIN_SCALE, MAX_SCALE, clampViewport, zoomAt, actualPixelsScale, ty
|
|
|
64
66
|
export { CompareGrid, type CompareGridProps } from './components/compare-grid';
|
|
65
67
|
export { useDifference, type DifferenceState, type ReadPixels } from './components/difference';
|
|
66
68
|
export { differences, readPixels, resample, MAX_SIDE, DEFAULT_TOLERANCE, type Difference, type Pixels } from './lib/image-diff';
|
|
69
|
+
export { Workspace, Split, Pane, useWorkspaceState, type WorkspaceState, type PaneProps } from './components/workspace';
|
|
70
|
+
export { useHistory, useHistoryState, type History, type HistoryOptions, type HistoryStep, type HistoryStateOptions, type SetOptions, } from './components/history';
|
|
71
|
+
export { useAutoSave, useLeaveGuard, SaveStatus, type AutoSave, type AutoSaveOptions, type SaveState } from './components/save';
|