@vitavision/workbench 0.3.0 → 0.3.3
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 +2 -1
- package/dist/index.d.ts +118 -2
- package/dist/index.js +548 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/AppShell.tsx +2 -11
- package/src/components/NavRail.tsx +3 -18
- package/src/components/PlaybackBar.tsx +6 -38
- package/src/components/SequenceMatrix.tsx +493 -0
- package/src/components/SplitPane.tsx +4 -14
- package/src/components/StatusBar.tsx +1 -8
- package/src/components/Stepper.tsx +1 -6
- package/src/components/TreeView.tsx +5 -24
- package/src/components/dropFiles.ts +2 -7
- package/src/components/matrixModel.ts +126 -0
- package/src/components/splitSize.ts +3 -11
- package/src/components/stepperModel.ts +1 -2
- package/src/components/treeModel.ts +1 -3
- package/src/components/usePlayback.ts +11 -10
- package/src/index.ts +14 -33
|
@@ -12,12 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
import { useCallback, useId, useRef, useState } from "react";
|
|
15
|
-
import type {
|
|
16
|
-
CSSProperties,
|
|
17
|
-
KeyboardEvent,
|
|
18
|
-
PointerEvent as ReactPointerEvent,
|
|
19
|
-
ReactNode,
|
|
20
|
-
} from "react";
|
|
15
|
+
import type { CSSProperties, KeyboardEvent, PointerEvent as ReactPointerEvent, ReactNode } from "react";
|
|
21
16
|
|
|
22
17
|
import { cn, focusRing } from "@vitavision/ui";
|
|
23
18
|
|
|
@@ -117,9 +112,7 @@ export function SplitPane({
|
|
|
117
112
|
|
|
118
113
|
const limits = length === null ? null : resolveLimits(length, minSize, maxSize, collapsible);
|
|
119
114
|
const size =
|
|
120
|
-
controlledSize ??
|
|
121
|
-
internalSize ??
|
|
122
|
-
(length === null || limits === null ? null : clampSize(resolveSize(defaultSize, length), limits));
|
|
115
|
+
controlledSize ?? internalSize ?? (length === null || limits === null ? null : clampSize(resolveSize(defaultSize, length), limits));
|
|
123
116
|
const collapsed = size === 0;
|
|
124
117
|
const controlled = controlledSize !== undefined;
|
|
125
118
|
|
|
@@ -227,8 +220,7 @@ export function SplitPane({
|
|
|
227
220
|
// Before the first measurement (and on the server) the pane is sized by CSS alone, from
|
|
228
221
|
// the default; afterwards by the measured size. The limits stay in CSS too, so a window
|
|
229
222
|
// resize never pushes the pane outside them between two measurements.
|
|
230
|
-
const basis =
|
|
231
|
-
size !== null ? `${size}px` : typeof defaultSize === "number" ? `${defaultSize}px` : defaultSize;
|
|
223
|
+
const basis = size !== null ? `${size}px` : typeof defaultSize === "number" ? `${defaultSize}px` : defaultSize;
|
|
232
224
|
const cssSize = (value: PaneSize) => (typeof value === "number" ? `${value}px` : value);
|
|
233
225
|
const sizedStyle: CSSProperties = {
|
|
234
226
|
flex: `0 0 ${basis}`,
|
|
@@ -254,9 +246,7 @@ export function SplitPane({
|
|
|
254
246
|
{sizedPane === "start" ? first : second}
|
|
255
247
|
</div>
|
|
256
248
|
);
|
|
257
|
-
const rest = (
|
|
258
|
-
<div className={cn(paneClasses, "flex-1 basis-0")}>{sizedPane === "start" ? second : first}</div>
|
|
259
|
-
);
|
|
249
|
+
const rest = <div className={cn(paneClasses, "flex-1 basis-0")}>{sizedPane === "start" ? second : first}</div>;
|
|
260
250
|
|
|
261
251
|
return (
|
|
262
252
|
<div
|
|
@@ -40,14 +40,7 @@ export interface StatusBarProps {
|
|
|
40
40
|
* operation finished), not for ones that change many times a second. The line does not wrap;
|
|
41
41
|
* keep it to a few short facts.
|
|
42
42
|
*/
|
|
43
|
-
export function StatusBar({
|
|
44
|
-
start,
|
|
45
|
-
end,
|
|
46
|
-
children,
|
|
47
|
-
"aria-label": ariaLabel = "Status",
|
|
48
|
-
live = false,
|
|
49
|
-
className,
|
|
50
|
-
}: StatusBarProps) {
|
|
43
|
+
export function StatusBar({ start, end, children, "aria-label": ariaLabel = "Status", live = false, className }: StatusBarProps) {
|
|
51
44
|
const hasChildren = children !== undefined && children !== null && children !== false;
|
|
52
45
|
return (
|
|
53
46
|
<div
|
|
@@ -113,12 +113,7 @@ export function Stepper({
|
|
|
113
113
|
);
|
|
114
114
|
return (
|
|
115
115
|
<li key={step.id} className={cn("flex", vertical ? "flex-col items-start" : "items-center")}>
|
|
116
|
-
{index > 0 && (
|
|
117
|
-
<span
|
|
118
|
-
aria-hidden
|
|
119
|
-
className={cn("bg-line-strong", vertical ? "ml-4 h-3 w-px" : "mx-1 h-px w-6")}
|
|
120
|
-
/>
|
|
121
|
-
)}
|
|
116
|
+
{index > 0 && <span aria-hidden className={cn("bg-line-strong", vertical ? "ml-4 h-3 w-px" : "mx-1 h-px w-6")} />}
|
|
122
117
|
{blocked ? <Tooltip content={step.blockedBy}>{button}</Tooltip> : button}
|
|
123
118
|
{blocked && (
|
|
124
119
|
<span id={reasonId} className="sr-only">
|
|
@@ -18,14 +18,7 @@ import type { KeyboardEvent, MouseEvent } from "react";
|
|
|
18
18
|
|
|
19
19
|
import { byDensity, cn, useDensity } from "@vitavision/ui";
|
|
20
20
|
|
|
21
|
-
import {
|
|
22
|
-
type TreeNode,
|
|
23
|
-
type TreeRow,
|
|
24
|
-
ancestorIds,
|
|
25
|
-
parentIds,
|
|
26
|
-
treeKeyAction,
|
|
27
|
-
visibleRows,
|
|
28
|
-
} from "./treeModel";
|
|
21
|
+
import { type TreeNode, type TreeRow, ancestorIds, parentIds, treeKeyAction, visibleRows } from "./treeModel";
|
|
29
22
|
|
|
30
23
|
/** Props of `TreeView`. */
|
|
31
24
|
export interface TreeViewProps {
|
|
@@ -162,12 +155,7 @@ export function TreeView({
|
|
|
162
155
|
};
|
|
163
156
|
|
|
164
157
|
return (
|
|
165
|
-
<div
|
|
166
|
-
role="tree"
|
|
167
|
-
aria-label={ariaLabel}
|
|
168
|
-
onKeyDown={onKeyDown}
|
|
169
|
-
className={cn("flex flex-col py-1 select-none", className)}
|
|
170
|
-
>
|
|
158
|
+
<div role="tree" aria-label={ariaLabel} onKeyDown={onKeyDown} className={cn("flex flex-col py-1 select-none", className)}>
|
|
171
159
|
{rows.map((row) => {
|
|
172
160
|
const { node } = row;
|
|
173
161
|
const selected = node.id === selectedId;
|
|
@@ -211,9 +199,7 @@ export function TreeView({
|
|
|
211
199
|
onClick={(event) => onChevron(event, row)}
|
|
212
200
|
className="grid size-4 shrink-0 place-items-center rounded-sm text-fg-subtle hover:text-fg"
|
|
213
201
|
>
|
|
214
|
-
<ChevronRight
|
|
215
|
-
className={cn("size-3.5 transition-transform", row.isExpanded && "rotate-90")}
|
|
216
|
-
/>
|
|
202
|
+
<ChevronRight className={cn("size-3.5 transition-transform", row.isExpanded && "rotate-90")} />
|
|
217
203
|
</span>
|
|
218
204
|
) : (
|
|
219
205
|
<span aria-hidden className="size-4 shrink-0" />
|
|
@@ -221,10 +207,7 @@ export function TreeView({
|
|
|
221
207
|
{node.icon !== undefined && (
|
|
222
208
|
<span
|
|
223
209
|
aria-hidden
|
|
224
|
-
className={cn(
|
|
225
|
-
"grid shrink-0 place-items-center [&>svg]:size-3.5",
|
|
226
|
-
selected ? "text-signal" : "text-fg-muted",
|
|
227
|
-
)}
|
|
210
|
+
className={cn("grid shrink-0 place-items-center [&>svg]:size-3.5", selected ? "text-signal" : "text-fg-muted")}
|
|
228
211
|
>
|
|
229
212
|
{node.icon}
|
|
230
213
|
</span>
|
|
@@ -232,9 +215,7 @@ export function TreeView({
|
|
|
232
215
|
<span className="min-w-0 flex-1 truncate">{node.label}</span>
|
|
233
216
|
{node.meta !== undefined && (
|
|
234
217
|
// On the selected row's tint both `fg-subtle` and `fg-muted` fall below AA at this size.
|
|
235
|
-
<span className={cn("shrink-0 font-mono text-[11px]", selected ? "text-fg" : "text-fg-subtle")}>
|
|
236
|
-
{node.meta}
|
|
237
|
-
</span>
|
|
218
|
+
<span className={cn("shrink-0 font-mono text-[11px]", selected ? "text-fg" : "text-fg-subtle")}>{node.meta}</span>
|
|
238
219
|
)}
|
|
239
220
|
</div>
|
|
240
221
|
);
|
|
@@ -71,10 +71,7 @@ export function acceptsPath(path: string, accept: string | undefined): boolean {
|
|
|
71
71
|
* @param accept - The accept string.
|
|
72
72
|
* @returns The accepted files and the rejected ones, each in their original order.
|
|
73
73
|
*/
|
|
74
|
-
export function partitionFiles(
|
|
75
|
-
files: readonly File[],
|
|
76
|
-
accept: string | undefined,
|
|
77
|
-
): { accepted: File[]; rejected: File[] } {
|
|
74
|
+
export function partitionFiles(files: readonly File[], accept: string | undefined): { accepted: File[]; rejected: File[] } {
|
|
78
75
|
const accepted: File[] = [];
|
|
79
76
|
const rejected: File[] = [];
|
|
80
77
|
for (const file of files) (acceptsFile(file, accept) ? accepted : rejected).push(file);
|
|
@@ -120,9 +117,7 @@ export interface DropEntry {
|
|
|
120
117
|
* @param dataTransfer - The drop's data.
|
|
121
118
|
* @returns The files, in the order the browser listed them.
|
|
122
119
|
*/
|
|
123
|
-
export async function collectDroppedFiles(
|
|
124
|
-
dataTransfer: Pick<DataTransfer, "files" | "items">,
|
|
125
|
-
): Promise<File[]> {
|
|
120
|
+
export async function collectDroppedFiles(dataTransfer: Pick<DataTransfer, "files" | "items">): Promise<File[]> {
|
|
126
121
|
// Everything is read before the first `await`: a drop's data is emptied once its event
|
|
127
122
|
// handler returns.
|
|
128
123
|
const plain = Array.from(dataTransfer.files);
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The arithmetic of `SequenceMatrix`, apart from the DOM: where the cursor goes on a key, which
|
|
3
|
+
* rows and columns a scroll position shows, how far to scroll to reveal a cell, and the rectangle
|
|
4
|
+
* of a selection. Pure, so the edges (an empty grid, a page past the end) are tested without a browser.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** A cell by position: zero-based row and column indices. */
|
|
8
|
+
export interface GridPos {
|
|
9
|
+
/** The row index. */
|
|
10
|
+
row: number;
|
|
11
|
+
/** The column index. */
|
|
12
|
+
col: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** The grid's size in cells. */
|
|
16
|
+
export interface GridSize {
|
|
17
|
+
/** The number of rows. */
|
|
18
|
+
rows: number;
|
|
19
|
+
/** The number of columns. */
|
|
20
|
+
cols: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A rectangle of cells, both ends inclusive. */
|
|
24
|
+
export interface GridRect {
|
|
25
|
+
/** The first row. */
|
|
26
|
+
row0: number;
|
|
27
|
+
/** The last row. */
|
|
28
|
+
row1: number;
|
|
29
|
+
/** The first column. */
|
|
30
|
+
col0: number;
|
|
31
|
+
/** The last column. */
|
|
32
|
+
col1: number;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const clamp = (value: number, low: number, high: number) => Math.min(high, Math.max(low, value));
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Where a navigation key takes the cursor.
|
|
39
|
+
*
|
|
40
|
+
* - Arrows move one cell and stop at the edge.
|
|
41
|
+
* - `Home` and `End` go to the first and last column of the row; with `ctrl`, to the first and
|
|
42
|
+
* last cell of the grid.
|
|
43
|
+
* - `PageUp` and `PageDown` move `page` rows.
|
|
44
|
+
*
|
|
45
|
+
* @param from - The cursor.
|
|
46
|
+
* @param key - A `KeyboardEvent.key`.
|
|
47
|
+
* @param size - The grid.
|
|
48
|
+
* @param page - Rows in a page, at least 1.
|
|
49
|
+
* @param ctrl - Whether Ctrl (or Cmd) is held.
|
|
50
|
+
* @returns The new position, or `null` when the key is not a navigation key or the grid is empty.
|
|
51
|
+
* The position is clamped, so it may equal `from`.
|
|
52
|
+
*/
|
|
53
|
+
export function moveFocus(from: GridPos, key: string, size: GridSize, page: number, ctrl = false): GridPos | null {
|
|
54
|
+
if (size.rows <= 0 || size.cols <= 0) return null;
|
|
55
|
+
const lastRow = size.rows - 1;
|
|
56
|
+
const lastCol = size.cols - 1;
|
|
57
|
+
const step = Math.max(1, Math.floor(page));
|
|
58
|
+
const at = (row: number, col: number): GridPos => ({ row: clamp(row, 0, lastRow), col: clamp(col, 0, lastCol) });
|
|
59
|
+
switch (key) {
|
|
60
|
+
case "ArrowUp":
|
|
61
|
+
return at(from.row - 1, from.col);
|
|
62
|
+
case "ArrowDown":
|
|
63
|
+
return at(from.row + 1, from.col);
|
|
64
|
+
case "ArrowLeft":
|
|
65
|
+
return at(from.row, from.col - 1);
|
|
66
|
+
case "ArrowRight":
|
|
67
|
+
return at(from.row, from.col + 1);
|
|
68
|
+
case "Home":
|
|
69
|
+
return ctrl ? at(0, 0) : at(from.row, 0);
|
|
70
|
+
case "End":
|
|
71
|
+
return ctrl ? at(lastRow, lastCol) : at(from.row, lastCol);
|
|
72
|
+
case "PageUp":
|
|
73
|
+
return at(from.row - step, from.col);
|
|
74
|
+
case "PageDown":
|
|
75
|
+
return at(from.row + step, from.col);
|
|
76
|
+
default:
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The items of one axis to render for a scroll position, plus a margin.
|
|
83
|
+
*
|
|
84
|
+
* @param scroll - The scroll offset along the axis, in pixels, from the start of the body.
|
|
85
|
+
* @param viewport - The room the body has on that axis (the scroller's size less the sticky header).
|
|
86
|
+
* @param size - One item's size in pixels.
|
|
87
|
+
* @param count - The number of items.
|
|
88
|
+
* @param overscan - Extra items on each side.
|
|
89
|
+
* @returns `[start, end)`: indices to render. `[0, 0)` for no items or a non-positive size.
|
|
90
|
+
*/
|
|
91
|
+
export function windowRange(scroll: number, viewport: number, size: number, count: number, overscan: number): [number, number] {
|
|
92
|
+
if (count <= 0 || !(size > 0)) return [0, 0];
|
|
93
|
+
const first = Math.floor(Math.max(0, scroll) / size);
|
|
94
|
+
const last = Math.ceil((Math.max(0, scroll) + Math.max(0, viewport)) / size);
|
|
95
|
+
// A scroll far past the end still shows the last item.
|
|
96
|
+
if (first >= count) return [Math.max(0, count - 1 - overscan), count];
|
|
97
|
+
const start = clamp(first - overscan, 0, count);
|
|
98
|
+
return [start, clamp(last + overscan, start, count)];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* The scroll offset that brings an item fully into view, moving as little as possible.
|
|
103
|
+
*
|
|
104
|
+
* @param scroll - The current offset.
|
|
105
|
+
* @param viewport - The room the body has on this axis.
|
|
106
|
+
* @param index - The item.
|
|
107
|
+
* @param size - One item's size.
|
|
108
|
+
* @returns The offset: unchanged when the item is in view already, never negative.
|
|
109
|
+
*/
|
|
110
|
+
export function revealScroll(scroll: number, viewport: number, index: number, size: number): number {
|
|
111
|
+
const start = index * size;
|
|
112
|
+
const end = start + size;
|
|
113
|
+
if (start < scroll) return Math.max(0, start);
|
|
114
|
+
if (end > scroll + viewport) return Math.max(0, end - viewport);
|
|
115
|
+
return scroll;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** The rectangle between two cells, in whichever order they are given. */
|
|
119
|
+
export function rectBetween(a: GridPos, b: GridPos): GridRect {
|
|
120
|
+
return { row0: Math.min(a.row, b.row), row1: Math.max(a.row, b.row), col0: Math.min(a.col, b.col), col1: Math.max(a.col, b.col) };
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Whether a cell is in a rectangle. */
|
|
124
|
+
export function inRect(rect: GridRect | null, row: number, col: number): boolean {
|
|
125
|
+
return rect !== null && row >= rect.row0 && row <= rect.row1 && col >= rect.col0 && col <= rect.col1;
|
|
126
|
+
}
|
|
@@ -44,12 +44,7 @@ export function resolveSize(size: PaneSize, length: number): number {
|
|
|
44
44
|
* @param collapsible - Whether the pane may close below `minSize`.
|
|
45
45
|
* @returns The resolved limits.
|
|
46
46
|
*/
|
|
47
|
-
export function resolveLimits(
|
|
48
|
-
length: number,
|
|
49
|
-
minSize: PaneSize = 0,
|
|
50
|
-
maxSize: PaneSize = "100%",
|
|
51
|
-
collapsible = false,
|
|
52
|
-
): SplitLimits {
|
|
47
|
+
export function resolveLimits(length: number, minSize: PaneSize = 0, maxSize: PaneSize = "100%", collapsible = false): SplitLimits {
|
|
53
48
|
const max = Math.min(resolveSize(maxSize, length), Math.max(0, length));
|
|
54
49
|
const min = Math.min(resolveSize(minSize, length), max);
|
|
55
50
|
return { min, max, collapsible };
|
|
@@ -75,9 +70,7 @@ export type SplitOrientation = "horizontal" | "vertical";
|
|
|
75
70
|
export type SizedPane = "start" | "end";
|
|
76
71
|
|
|
77
72
|
/** What a key press on the divider asks for. */
|
|
78
|
-
export type SplitKeyAction =
|
|
79
|
-
| { type: "resize"; size: number }
|
|
80
|
-
| { type: "toggle-collapse" };
|
|
73
|
+
export type SplitKeyAction = { type: "resize"; size: number } | { type: "toggle-collapse" };
|
|
81
74
|
|
|
82
75
|
/**
|
|
83
76
|
* The divider's keyboard (the WAI-ARIA window-splitter pattern).
|
|
@@ -100,8 +93,7 @@ export function splitKeyAction(
|
|
|
100
93
|
options: { orientation: SplitOrientation; sizedPane: SizedPane; step: number; limits: SplitLimits },
|
|
101
94
|
): SplitKeyAction | null {
|
|
102
95
|
const { orientation, sizedPane, step, limits } = options;
|
|
103
|
-
const [back, forward] =
|
|
104
|
-
orientation === "horizontal" ? ["ArrowLeft", "ArrowRight"] : ["ArrowUp", "ArrowDown"];
|
|
96
|
+
const [back, forward] = orientation === "horizontal" ? ["ArrowLeft", "ArrowRight"] : ["ArrowUp", "ArrowDown"];
|
|
105
97
|
const grow = sizedPane === "start" ? 1 : -1;
|
|
106
98
|
const delta = shift ? step * 4 : step;
|
|
107
99
|
|
|
@@ -42,8 +42,7 @@ export interface StepView {
|
|
|
42
42
|
*/
|
|
43
43
|
export function stepStates(steps: readonly StepGate[], current: string | null): StepView[] {
|
|
44
44
|
return steps.map(({ id, blockedBy, complete }) => {
|
|
45
|
-
const state: StepState =
|
|
46
|
-
id === current ? "current" : blockedBy ? "blocked" : complete ? "complete" : "upcoming";
|
|
45
|
+
const state: StepState = id === current ? "current" : blockedBy ? "blocked" : complete ? "complete" : "upcoming";
|
|
47
46
|
return { id, state, canActivate: state === "complete" || state === "upcoming" };
|
|
48
47
|
});
|
|
49
48
|
}
|
|
@@ -157,9 +157,7 @@ export function treeKeyAction(rows: readonly TreeRow[], focusedId: string, key:
|
|
|
157
157
|
return rows[index + 1]?.parentId === row.node.id ? focus(rows[index + 1]) : null;
|
|
158
158
|
case "ArrowLeft":
|
|
159
159
|
if (row.isExpanded) return { type: "collapse", id: row.node.id };
|
|
160
|
-
return row.parentId === null
|
|
161
|
-
? null
|
|
162
|
-
: focus(rows.find((candidate) => candidate.node.id === row.parentId));
|
|
160
|
+
return row.parentId === null ? null : focus(rows.find((candidate) => candidate.node.id === row.parentId));
|
|
163
161
|
case "Enter":
|
|
164
162
|
case " ":
|
|
165
163
|
return row.node.disabled ? null : { type: "select", id: row.node.id };
|
|
@@ -26,8 +26,16 @@ export function usePlayhead(playhead: Playhead): number {
|
|
|
26
26
|
* @returns The number of samples and the seconds between them.
|
|
27
27
|
*/
|
|
28
28
|
export function usePlayheadTimeline(playhead: Playhead): { count: number; dt: number } {
|
|
29
|
-
const count = useSyncExternalStore(
|
|
30
|
-
|
|
29
|
+
const count = useSyncExternalStore(
|
|
30
|
+
playhead.subscribe,
|
|
31
|
+
() => playhead.count,
|
|
32
|
+
() => playhead.count,
|
|
33
|
+
);
|
|
34
|
+
const dt = useSyncExternalStore(
|
|
35
|
+
playhead.subscribe,
|
|
36
|
+
() => playhead.dt,
|
|
37
|
+
() => playhead.dt,
|
|
38
|
+
);
|
|
31
39
|
return { count, dt };
|
|
32
40
|
}
|
|
33
41
|
|
|
@@ -65,14 +73,7 @@ export interface PlaybackClockOptions {
|
|
|
65
73
|
*
|
|
66
74
|
* @param options - The playhead and the transport state.
|
|
67
75
|
*/
|
|
68
|
-
export function usePlaybackClock({
|
|
69
|
-
playhead,
|
|
70
|
-
playing,
|
|
71
|
-
speed = 1,
|
|
72
|
-
loop = false,
|
|
73
|
-
onEnd,
|
|
74
|
-
maxFrameMs = 100,
|
|
75
|
-
}: PlaybackClockOptions): void {
|
|
76
|
+
export function usePlaybackClock({ playhead, playing, speed = 1, loop = false, onEnd, maxFrameMs = 100 }: PlaybackClockOptions): void {
|
|
76
77
|
const step = useEffectEvent((position: number, elapsedMs: number) => {
|
|
77
78
|
const delta = (Math.min(elapsedMs, maxFrameMs) / 1000) * (speed / playhead.dt);
|
|
78
79
|
return advance(position, delta, playhead.count, loop);
|
package/src/index.ts
CHANGED
|
@@ -11,13 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
export { AppShell, type AppShellProps, type SidePanelSize } from "./components/AppShell";
|
|
13
13
|
export { StatusBar, type StatusBarProps } from "./components/StatusBar";
|
|
14
|
-
export {
|
|
15
|
-
NavRail,
|
|
16
|
-
NavRailItem,
|
|
17
|
-
type NavRailItemProps,
|
|
18
|
-
type NavRailLabels,
|
|
19
|
-
type NavRailProps,
|
|
20
|
-
} from "./components/NavRail";
|
|
14
|
+
export { NavRail, NavRailItem, type NavRailItemProps, type NavRailLabels, type NavRailProps } from "./components/NavRail";
|
|
21
15
|
export { SplitPane, type SplitPaneProps } from "./components/SplitPane";
|
|
22
16
|
export {
|
|
23
17
|
type PaneSize,
|
|
@@ -40,38 +34,25 @@ export {
|
|
|
40
34
|
visibleRows,
|
|
41
35
|
} from "./components/treeModel";
|
|
42
36
|
|
|
43
|
-
export {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
type PlaybackBarProps,
|
|
47
|
-
type PlaybackMarker,
|
|
48
|
-
} from "./components/PlaybackBar";
|
|
49
|
-
export {
|
|
50
|
-
type AdvanceResult,
|
|
51
|
-
advance,
|
|
52
|
-
clampIndex,
|
|
53
|
-
createPlayhead,
|
|
54
|
-
formatSeconds,
|
|
55
|
-
type Playhead,
|
|
56
|
-
} from "./components/playhead";
|
|
57
|
-
export {
|
|
58
|
-
type PlaybackClockOptions,
|
|
59
|
-
usePlaybackClock,
|
|
60
|
-
usePlayhead,
|
|
61
|
-
usePlayheadTimeline,
|
|
62
|
-
} from "./components/usePlayback";
|
|
37
|
+
export { DEFAULT_SPEEDS, PlaybackBar, type PlaybackBarProps, type PlaybackMarker } from "./components/PlaybackBar";
|
|
38
|
+
export { type AdvanceResult, advance, clampIndex, createPlayhead, formatSeconds, type Playhead } from "./components/playhead";
|
|
39
|
+
export { type PlaybackClockOptions, usePlaybackClock, usePlayhead, usePlayheadTimeline } from "./components/usePlayback";
|
|
63
40
|
|
|
64
41
|
export { FileDrop, type FileDropProps, type PathSource } from "./components/FileDrop";
|
|
65
42
|
export { acceptsFile, acceptsPath, collectDroppedFiles, type DropEntry } from "./components/dropFiles";
|
|
66
43
|
|
|
67
|
-
export {
|
|
68
|
-
SequenceNavigator,
|
|
69
|
-
type SequenceItem,
|
|
70
|
-
type SequenceItemStatus,
|
|
71
|
-
type SequenceNavigatorProps,
|
|
72
|
-
} from "./components/SequenceNavigator";
|
|
44
|
+
export { SequenceNavigator, type SequenceItem, type SequenceItemStatus, type SequenceNavigatorProps } from "./components/SequenceNavigator";
|
|
73
45
|
export { stepIndex } from "./components/sequence";
|
|
74
46
|
|
|
47
|
+
export {
|
|
48
|
+
SequenceMatrix,
|
|
49
|
+
type SequenceMatrixCellState,
|
|
50
|
+
type SequenceMatrixColumn,
|
|
51
|
+
type SequenceMatrixProps,
|
|
52
|
+
type SequenceMatrixRow,
|
|
53
|
+
type SequenceMatrixSelection,
|
|
54
|
+
} from "./components/SequenceMatrix";
|
|
55
|
+
|
|
75
56
|
export { Stepper, type StepperProps, type StepperStep } from "./components/Stepper";
|
|
76
57
|
export { type StepGate, type StepState, type StepView, stepStates } from "./components/stepperModel";
|
|
77
58
|
|