strata-react 1.0.7 → 1.0.10
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 +4 -0
- package/dist/components/line-chart.d.ts +14 -1
- package/dist/components/media.d.ts +99 -0
- package/dist/components/sortable-list.d.ts +39 -0
- package/dist/components/timeline.d.ts +98 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1560 -115
- package/dist/index.js.map +1 -1
- package/dist/lib/format.d.ts +20 -0
- package/dist/lib/timeline.d.ts +14 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -121,6 +121,7 @@ function KilnRoom() {
|
|
|
121
121
|
| 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
122
|
| 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
123
|
| 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 and lists virtualise from 100 rows; 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`) |
|
|
124
125
|
| 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 and lists virtualise from 100 rows; 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 |
|
|
125
126
|
| 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
127
|
| 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 |
|
|
@@ -134,6 +135,9 @@ function KilnRoom() {
|
|
|
134
135
|
| 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
136
|
| 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
137
|
| 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` |
|
|
138
|
+
| 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` |
|
|
139
|
+
| 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 |
|
|
140
|
+
| 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 |
|
|
137
141
|
| 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 |
|
|
138
142
|
| 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 |
|
|
139
143
|
| 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 |
|
|
@@ -32,6 +32,19 @@ export type LineChartProps = {
|
|
|
32
32
|
}[];
|
|
33
33
|
/** Says what the colours mean, shown beside the legend swatch when `colourScale` is set. */
|
|
34
34
|
colourScaleLabel?: string;
|
|
35
|
+
/** The current x, supplied by the app and drawn as a rule with its value ("now" in a replay, a playhead). Cheap to update often. */
|
|
36
|
+
current?: number;
|
|
37
|
+
/** The value at the rule, as a sentence part. Default: `formatX` and the value read off the line. */
|
|
38
|
+
formatCurrent?: (at: {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
}) => string;
|
|
42
|
+
/** Read values at the pointer, and by keyboard on the plot (arrows, Home, End). `readout` words the reading; default `formatX: formatY`. */
|
|
43
|
+
readout?: boolean | ((p: Point) => string);
|
|
44
|
+
/** The viewer chose a reading (a click, or Enter on the plot): its x, so the app can seek or select. */
|
|
45
|
+
onPick?: (x: number) => void;
|
|
46
|
+
/** One flat, pale tint under the line. Only where the area carries the meaning (a profile, a running total). */
|
|
47
|
+
area?: boolean;
|
|
35
48
|
height?: number;
|
|
36
49
|
className?: string;
|
|
37
50
|
};
|
|
@@ -54,4 +67,4 @@ export declare function yScale(values: number[], pin?: {
|
|
|
54
67
|
*/
|
|
55
68
|
export declare function fitTicks(ticks: number[], scale: (x: number) => number, widthOf: (t: number) => number, gap?: number): number[];
|
|
56
69
|
/** 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`. */
|
|
57
|
-
export declare function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, formatX, formatY, xTicks, yMin, yMax, colour, colourScale, colourScaleLabel, height, className, }: LineChartProps): React.JSX.Element;
|
|
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;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Shortcut } from './hotkeys';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
export type Precision = "seconds" | "ms" | "frames";
|
|
4
|
+
type TimeProps = {
|
|
5
|
+
precision?: Precision;
|
|
6
|
+
fps?: number;
|
|
7
|
+
};
|
|
8
|
+
/** The current and total time, in `tabular-nums`, as `<time>` elements. */
|
|
9
|
+
export declare function TimeReadout({ time, duration, precision, fps, className }: {
|
|
10
|
+
time: number;
|
|
11
|
+
duration: number | null;
|
|
12
|
+
} & TimeProps & {
|
|
13
|
+
className?: string;
|
|
14
|
+
}): React.JSX.Element;
|
|
15
|
+
export type SeekBarProps = TimeProps & {
|
|
16
|
+
time: number;
|
|
17
|
+
duration: number;
|
|
18
|
+
/** The viewer asked for this time (drag, click or key). */
|
|
19
|
+
onSeek: (time: number) => void;
|
|
20
|
+
/** Named points on the bar (chapters, markers). Pressing one seeks to it. */
|
|
21
|
+
marks?: readonly {
|
|
22
|
+
time: number;
|
|
23
|
+
label: string;
|
|
24
|
+
}[];
|
|
25
|
+
/** How far has loaded or been recorded, drawn behind the played part. */
|
|
26
|
+
buffered?: number;
|
|
27
|
+
/** Arrow key step in seconds. Default 5. */
|
|
28
|
+
step?: number;
|
|
29
|
+
/** Page Up and Page Down step in seconds. Default 30. */
|
|
30
|
+
bigStep?: number;
|
|
31
|
+
label?: string;
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
className?: string;
|
|
34
|
+
};
|
|
35
|
+
/** 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 type TransportProps = {
|
|
38
|
+
playing: boolean;
|
|
39
|
+
onPlayPause: () => void;
|
|
40
|
+
onStop?: () => void;
|
|
41
|
+
onToStart?: () => void;
|
|
42
|
+
onToEnd?: () => void;
|
|
43
|
+
onStepBack?: () => void;
|
|
44
|
+
onStepForward?: () => void;
|
|
45
|
+
/** What a step is called in the buttons' names: "frame" (default) or "second". */
|
|
46
|
+
stepUnit?: string;
|
|
47
|
+
/** Anything else on the row: the time readout, a seek bar, volume. */
|
|
48
|
+
children?: React.ReactNode;
|
|
49
|
+
className?: string;
|
|
50
|
+
};
|
|
51
|
+
/** The transport buttons for a player the app owns. Every control is a named icon button; the play button's name is "Play" or "Pause" from `playing`. Only the buttons whose handler is passed are drawn. */
|
|
52
|
+
export declare function Transport({ playing, onPlayPause, onStop, onToStart, onToEnd, onStepBack, onStepForward, stepUnit, children, className }: TransportProps): React.JSX.Element;
|
|
53
|
+
export type VolumeControlProps = {
|
|
54
|
+
/** 0 to 100. */
|
|
55
|
+
volume: number;
|
|
56
|
+
onVolumeChange: (volume: number) => void;
|
|
57
|
+
/** Allow over 100 (a boost), up to this. Default 100. */
|
|
58
|
+
max?: number;
|
|
59
|
+
disabled?: boolean;
|
|
60
|
+
className?: string;
|
|
61
|
+
};
|
|
62
|
+
/** A mute button and a volume slider with its value in percent. Muting sets the volume to 0 and remembers the level; unmuting puts it back. Moving the slider from 0 unmutes. */
|
|
63
|
+
export declare function VolumeControl({ volume, onVolumeChange, max, disabled, className }: VolumeControlProps): React.JSX.Element;
|
|
64
|
+
/** A choice of playback speed ("0.5×", "1×", "1.5×") on a native select, named "Playback speed". */
|
|
65
|
+
export declare function RateChoice({ rate, onRateChange, rates, className }: {
|
|
66
|
+
rate: number;
|
|
67
|
+
onRateChange: (rate: number) => void;
|
|
68
|
+
rates?: readonly number[];
|
|
69
|
+
className?: string;
|
|
70
|
+
}): React.JSX.Element;
|
|
71
|
+
/**
|
|
72
|
+
* The shortcuts a player takes, as one list for `useHotkeys` and `KeysLegend`: Space and K play
|
|
73
|
+
* or pause, J and L go back or forward `jump` seconds, the arrows by `frame` seconds, Home and End
|
|
74
|
+
* to the ends, M mutes. Pass the player's actions; the labels are the legend's words.
|
|
75
|
+
*/
|
|
76
|
+
export declare function transportShortcuts({ toggle, seek, time, duration, frame, jump, toggleMute }: {
|
|
77
|
+
toggle: () => void;
|
|
78
|
+
seek: (time: number) => void;
|
|
79
|
+
time: number;
|
|
80
|
+
duration: number;
|
|
81
|
+
frame?: number;
|
|
82
|
+
jump?: number;
|
|
83
|
+
toggleMute?: () => void;
|
|
84
|
+
}): Shortcut[];
|
|
85
|
+
/** A frame that fits content of an aspect ratio into the pane, letterboxed on the sunken surface role (light and dark both), with room for the app's overlays. */
|
|
86
|
+
export declare function MediaStage({ aspect, children, label, className }: {
|
|
87
|
+
aspect: number | `${number}/${number}`;
|
|
88
|
+
children: React.ReactNode;
|
|
89
|
+
label: string;
|
|
90
|
+
className?: string;
|
|
91
|
+
}): React.JSX.Element;
|
|
92
|
+
/** Guides over a stage: action-safe and title-safe frames (90% and 80%), a centre cross and a rule-of-thirds grid. Drawn as two strokes (light over dark) so they read on any picture. */
|
|
93
|
+
export declare function StageGuides({ safe, thirds, centre, className }: {
|
|
94
|
+
safe?: boolean;
|
|
95
|
+
thirds?: boolean;
|
|
96
|
+
centre?: boolean;
|
|
97
|
+
className?: string;
|
|
98
|
+
}): React.JSX.Element;
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
/** Where a drop landed, relative to the item with `key`. */
|
|
3
|
+
export type DropTarget = {
|
|
4
|
+
key: string;
|
|
5
|
+
position: "before" | "after" | "on";
|
|
6
|
+
} | {
|
|
7
|
+
key: null;
|
|
8
|
+
position: "root";
|
|
9
|
+
};
|
|
10
|
+
export type SortableListProps<T> = {
|
|
11
|
+
/** Names the list ("Tracks"). Required. */
|
|
12
|
+
label: string;
|
|
13
|
+
items: readonly T[];
|
|
14
|
+
getKey: (item: T) => string;
|
|
15
|
+
/** The item's name for a screen reader, typeahead and announcements ("Picked up Moonbeam bowl"). */
|
|
16
|
+
getLabel: (item: T) => string;
|
|
17
|
+
/** The row's content, beside the grip. Plain text and marks; actions go in `renderActions`. */
|
|
18
|
+
children: (item: T) => React.ReactNode;
|
|
19
|
+
/** Controls for the row (a `RowAction`), outside the row's selection target. */
|
|
20
|
+
renderActions?: (item: T) => React.ReactNode;
|
|
21
|
+
/** Shown when the list is empty, and "Drop here" while something is dragged over it. */
|
|
22
|
+
empty: React.ReactNode;
|
|
23
|
+
/** The item was moved within this list: `keys` now sit at `target`. */
|
|
24
|
+
onReorder: (keys: string[], target: DropTarget) => void;
|
|
25
|
+
/** An item of another list was dropped here. The app finds it by id and moves it. Needs `accepts`. */
|
|
26
|
+
onInsert?: (ids: string[], target: DropTarget) => void;
|
|
27
|
+
/** What an item is, for deciding which lists take it. Default: every item is "item". */
|
|
28
|
+
getKind?: (item: T) => string;
|
|
29
|
+
/** Kinds this list takes from other lists. Default none: it only reorders. */
|
|
30
|
+
accepts?: readonly string[];
|
|
31
|
+
/** Why a kind is refused, in the product's words, shown while one is dragged over: `{ text: "Tracks take video and audio, not text clips." }`. React Aria cannot list what is being dragged, only ask about a kind, so name the kinds that exist. */
|
|
32
|
+
refuses?: Readonly<Record<string, string>>;
|
|
33
|
+
selectionMode?: "none" | "single" | "multiple";
|
|
34
|
+
selectedKeys?: ReadonlySet<string>;
|
|
35
|
+
onSelectionChange?: (keys: Set<string>) => void;
|
|
36
|
+
className?: string;
|
|
37
|
+
};
|
|
38
|
+
/** A list that reorders by drag and by keyboard, and takes items from other lists by kind. It reports what was asked and never changes the data itself. */
|
|
39
|
+
export declare function SortableList<T>({ label, items, getKey, getLabel, children, renderActions, empty, onReorder, onInsert, getKind, accepts, refuses, selectionMode, selectedKeys, onSelectionChange, className, }: SortableListProps<T>): React.JSX.Element;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type TimelineItem = {
|
|
3
|
+
id: string;
|
|
4
|
+
/** The lane's id. */
|
|
5
|
+
lane: string;
|
|
6
|
+
start: number;
|
|
7
|
+
length: number;
|
|
8
|
+
/** The item's name, in the item and for a screen reader. */
|
|
9
|
+
label: string;
|
|
10
|
+
/** What kind of thing it is (video, audio, booking). Shown as a word and a colour stripe, never colour alone. */
|
|
11
|
+
kind?: string;
|
|
12
|
+
};
|
|
13
|
+
export type TimelineLane = {
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
/** The app's controls for the lane (mute, lock, delete). Drawn in the lane's header, at the left. */
|
|
17
|
+
header?: React.ReactNode;
|
|
18
|
+
};
|
|
19
|
+
export type TimelineMarker = {
|
|
20
|
+
id: string;
|
|
21
|
+
time: number;
|
|
22
|
+
label: string;
|
|
23
|
+
};
|
|
24
|
+
/** What a move or trim would produce. */
|
|
25
|
+
export type TimelineChange = {
|
|
26
|
+
start: number;
|
|
27
|
+
length: number;
|
|
28
|
+
lane: string;
|
|
29
|
+
};
|
|
30
|
+
export type TimelineProps = {
|
|
31
|
+
/** Names the timeline for a screen reader ("Firing schedule"). */
|
|
32
|
+
label: string;
|
|
33
|
+
lanes: readonly TimelineLane[];
|
|
34
|
+
items: readonly TimelineItem[];
|
|
35
|
+
/** The axis runs from this time. Default 0. */
|
|
36
|
+
from?: number;
|
|
37
|
+
/** ... to this time. */
|
|
38
|
+
to: number;
|
|
39
|
+
/** Pixels per unit of time. Controlled with `onZoomChange`. */
|
|
40
|
+
zoom: number;
|
|
41
|
+
onZoomChange?: (zoom: number) => void;
|
|
42
|
+
/** The current time, drawn as a rule across the lanes and set by the slider on the ruler. */
|
|
43
|
+
position?: number;
|
|
44
|
+
onPositionChange?: (time: number) => void;
|
|
45
|
+
/** Keep the current time in view as it advances. */
|
|
46
|
+
follow?: boolean;
|
|
47
|
+
markers?: readonly TimelineMarker[];
|
|
48
|
+
selectedIds?: ReadonlySet<string>;
|
|
49
|
+
/** The selection changed: `ids` is the whole new selection. */
|
|
50
|
+
onSelect?: (ids: string[]) => void;
|
|
51
|
+
/** The item was moved, trimmed or put in another lane. Not called for a change `validate` refused. */
|
|
52
|
+
onItemChange?: (id: string, next: TimelineChange) => void;
|
|
53
|
+
/** The person asked to remove the selection (Delete). The app does it, undoably. */
|
|
54
|
+
onDelete?: (ids: string[]) => void;
|
|
55
|
+
/** A reason a change cannot be made, in the product's words, or `null`. Called while dragging, so keep it cheap. */
|
|
56
|
+
validate?: (id: string, next: TimelineChange) => string | null;
|
|
57
|
+
/** Extra times items snap to, besides the edges of other items, markers and the current time. */
|
|
58
|
+
snapPoints?: readonly number[];
|
|
59
|
+
/** Turn snapping off. Default on. */
|
|
60
|
+
snap?: boolean;
|
|
61
|
+
/** One keyboard step, in time units. Default 1. */
|
|
62
|
+
step?: number;
|
|
63
|
+
/** Smallest an item may be, in time units. Default `step`. */
|
|
64
|
+
minLength?: number;
|
|
65
|
+
/** Draws an item's content (a strip of thumbnails, a waveform). Default: the label and kind. */
|
|
66
|
+
renderItem?: (item: TimelineItem, state: {
|
|
67
|
+
selected: boolean;
|
|
68
|
+
width: number;
|
|
69
|
+
}) => React.ReactNode;
|
|
70
|
+
/** A time as words ("0:14", "13:30"). Default `m:ss`, with tenths on the ruler when zoomed far in. Also labels the ruler when given, so a schedule in hours reads as clock times. */
|
|
71
|
+
formatTime?: (time: number) => string;
|
|
72
|
+
/** Shown instead of the lanes' area when there are no lanes. */
|
|
73
|
+
empty?: React.ReactNode;
|
|
74
|
+
className?: string;
|
|
75
|
+
};
|
|
76
|
+
/** Zoom state for a timeline: `zoomIn`, `zoomOut`, and `fit` to a viewport width. Pass `zoom` and `setZoom` as the timeline's `zoom` and `onZoomChange`. */
|
|
77
|
+
export declare function useTimelineZoom({ initial, min, max }?: {
|
|
78
|
+
initial?: number;
|
|
79
|
+
min?: number;
|
|
80
|
+
max?: number;
|
|
81
|
+
}): {
|
|
82
|
+
zoom: number;
|
|
83
|
+
setZoom: (z: number) => void;
|
|
84
|
+
zoomIn: () => void;
|
|
85
|
+
zoomOut: () => void;
|
|
86
|
+
/** Zoom so `duration` fills `viewportWidth` pixels. */
|
|
87
|
+
fit: (viewportWidth: number, duration: number) => void;
|
|
88
|
+
};
|
|
89
|
+
/** Zoom in, zoom out and fit, as named icon buttons for a timeline's toolbar. */
|
|
90
|
+
export declare function TimelineZoomControls({ zoom }: {
|
|
91
|
+
zoom: Pick<ReturnType<typeof useTimelineZoom>, "zoomIn" | "zoomOut"> & {
|
|
92
|
+
fit: () => void;
|
|
93
|
+
};
|
|
94
|
+
}): React.JSX.Element;
|
|
95
|
+
/** A rule that refuses an item overlapping another in its lane, for `validate`: names the item in the way. */
|
|
96
|
+
export declare function noOverlap(items: readonly TimelineItem[]): (id: string, next: TimelineChange) => string | null;
|
|
97
|
+
/** 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;
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,10 @@ export { useClientWork, type ClientWork, type WorkContext, type WorkPhase } from
|
|
|
34
34
|
export { JobStatus, type JobStatusProps, type JobFailure, type JobWords } from './components/job-status';
|
|
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
|
+
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';
|
|
39
|
+
export { tickStep, ticksBetween, tickLabel } from './lib/timeline';
|
|
40
|
+
export { SortableList, type SortableListProps, type DropTarget } from './components/sortable-list';
|
|
37
41
|
export { FileButton, FileDropZone, FileOutcomes, MissingFile } from './components/file-intake';
|
|
38
42
|
export { useFileIntake, matchesAccept, type FileIntake, type FileIntakeOptions, type FileOutcome } from './lib/file-intake';
|
|
39
43
|
export { Inspector, InspectorSection, PropertyRow, PropertyList, type InspectorProps, type InspectorSectionProps, type PropertyRowProps, type Property, type PropertyListProps } from './components/inspector';
|