@vitavision/workbench 0.3.2 → 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/SequenceMatrix.tsx +493 -0
- package/src/components/matrixModel.ts +126 -0
- package/src/index.ts +9 -0
package/README.md
CHANGED
|
@@ -26,13 +26,14 @@ bun add @vitavision/workbench @vitavision/ui
|
|
|
26
26
|
| `createPlayhead`, `usePlayhead`, `usePlaybackClock` | The playback position as an external store, and the real-time clock that drives it. |
|
|
27
27
|
| `FileDrop` | Drop zone (or full-window `overlay`) plus an "Open files…" button; `accept` applied to both routes; dropped folders walked. In a desktop shell, a `pathSource` yields paths to `onPaths` instead of `File`s (see below). |
|
|
28
28
|
| `SequenceNavigator` | The current item of an ordered set (a frame of a capture) as a lazy thumbnail strip with previous/next, the position, and `[` / `]` from anywhere outside a text field. A per-item `status` (`{ tone, label }`) draws a dot in the thumbnail's corner and is said in the item's name. |
|
|
29
|
+
| `SequenceMatrix` | A rows-by-columns grid of captures (views by cameras) windowed in both axes, with sticky row and column headers, a caller-drawn cell, cell-level roving focus (arrows, Home/End, Ctrl + Home/End, PageUp/PageDown), single and range selection (Shift + move or click, header click, Ctrl + A), and `grid` roles with `aria-rowindex` / `aria-colindex`. Controlled or not. No listener per cell. |
|
|
29
30
|
| `Stepper` | The steps of a gated sequence (Teach, then Find, then Verify): numbered, the current one `aria-current="step"`, done ones checked. A step with a `blockedBy` reason stays focusable but `aria-disabled`, described by its reason (also its tooltip), and cannot be chosen. Row or column; controlled or not. |
|
|
30
31
|
| `Toaster`, `toast()` | Notifications from anywhere; one `<Toaster />` near the root. **Now lives in `@vitavision/ui`**; re-exported here (same bindings, one default store) so existing imports keep working. Prefer `import { toast } from "@vitavision/ui"`. |
|
|
31
32
|
|
|
32
33
|
The pure logic behind them is exported too and tested without a DOM: `splitSize.ts`
|
|
33
34
|
(`resolveSize`, `resolveLimits`, `clampSize`), `treeModel.ts` (`visibleRows`, `treeKeyAction`,
|
|
34
35
|
`ancestorIds`, `parentIds`), `playhead.ts` (`advance`, `clampIndex`, `formatSeconds`),
|
|
35
|
-
`dropFiles.ts` (`acceptsFile`, `collectDroppedFiles`), `stepperModel.ts` (`stepStates`).
|
|
36
|
+
`dropFiles.ts` (`acceptsFile`, `collectDroppedFiles`), `stepperModel.ts` (`stepStates`), `matrixModel.ts` (cursor moves, the window of rows and columns in view, scroll to reveal a cell, the selection rectangle).
|
|
36
37
|
|
|
37
38
|
### Playback without re-rendering the app
|
|
38
39
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MeasureTone, ReadoutItem, ToastOptions, ToastRecord, ToastStore, ToastTone, Toaster, ToasterProps, Tone, createToastStore, defaultToastStore, toast } from "@vitavision/ui";
|
|
2
|
-
import { ReactElement, ReactNode } from "react";
|
|
2
|
+
import { CSSProperties, ReactElement, ReactNode } from "react";
|
|
3
3
|
//#region src/components/splitSize.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* A pane size: CSS pixels as a number, or a share of the split's length as a percentage
|
|
@@ -794,6 +794,122 @@ export declare function SequenceNavigator({ items, value, onValueChange, renderT
|
|
|
794
794
|
*/
|
|
795
795
|
export declare function stepIndex(length: number, index: number, delta: 1 | -1, wrap?: boolean): number | null;
|
|
796
796
|
//#endregion
|
|
797
|
+
//#region src/components/SequenceMatrix.d.ts
|
|
798
|
+
/** One row of a `SequenceMatrix`: a view, a frame. */
|
|
799
|
+
interface SequenceMatrixRow {
|
|
800
|
+
/** Its identity, unique among the rows. */
|
|
801
|
+
id: string;
|
|
802
|
+
/** What the row header shows. */
|
|
803
|
+
label: ReactNode;
|
|
804
|
+
/** The row's name for assistive technology, when `label` is not text. Defaults to `label` as text, else `id`. */
|
|
805
|
+
name?: string | undefined;
|
|
806
|
+
}
|
|
807
|
+
/** One column of a `SequenceMatrix`: a camera, a channel. */
|
|
808
|
+
interface SequenceMatrixColumn {
|
|
809
|
+
/** Its identity, unique among the columns. */
|
|
810
|
+
id: string;
|
|
811
|
+
/** What the column header shows. */
|
|
812
|
+
label: ReactNode;
|
|
813
|
+
/** The column's name for assistive technology, when `label` is not text. Defaults to `label` as text, else `id`. */
|
|
814
|
+
name?: string | undefined;
|
|
815
|
+
}
|
|
816
|
+
/**
|
|
817
|
+
* A selection: the cell `row` / `col`, or the rectangle from it to `rowTo` / `colTo`.
|
|
818
|
+
*
|
|
819
|
+
* `row` and `col` are the anchor (where the selection started); a range extends from there, in
|
|
820
|
+
* either direction. A whole row is `{ row, col: firstColumn, colTo: lastColumn }`.
|
|
821
|
+
*/
|
|
822
|
+
interface SequenceMatrixSelection {
|
|
823
|
+
/** The anchor's row id. */
|
|
824
|
+
row: string;
|
|
825
|
+
/** The anchor's column id. */
|
|
826
|
+
col: string;
|
|
827
|
+
/** The row id the range extends to. Omitted: the anchor's row. */
|
|
828
|
+
rowTo?: string | undefined;
|
|
829
|
+
/** The column id the range extends to. Omitted: the anchor's column. */
|
|
830
|
+
colTo?: string | undefined;
|
|
831
|
+
}
|
|
832
|
+
/** What `renderCell` is told about the cell it draws. */
|
|
833
|
+
interface SequenceMatrixCellState {
|
|
834
|
+
/** The cell has the keyboard focus. */
|
|
835
|
+
focused: boolean;
|
|
836
|
+
/** The cell is in the selection. */
|
|
837
|
+
selected: boolean;
|
|
838
|
+
}
|
|
839
|
+
/** Props of `SequenceMatrix`. */
|
|
840
|
+
interface SequenceMatrixProps {
|
|
841
|
+
/** The rows, top to bottom. */
|
|
842
|
+
rows: readonly SequenceMatrixRow[];
|
|
843
|
+
/** The columns, left to right. */
|
|
844
|
+
columns: readonly SequenceMatrixColumn[];
|
|
845
|
+
/**
|
|
846
|
+
* Draws a cell's content. It fills the cell's box (`colWidth` by `rowHeight`) and is called for
|
|
847
|
+
* the cells in view only, so it may be as rich as a thumbnail. The cell is a `gridcell`; give
|
|
848
|
+
* it an accessible name with `cellLabel` when its content is not text.
|
|
849
|
+
*/
|
|
850
|
+
renderCell: (row: SequenceMatrixRow, column: SequenceMatrixColumn, state: SequenceMatrixCellState) => ReactNode;
|
|
851
|
+
/** The cell's accessible name (`aria-label`), e.g. `"view 12, camera 3, 48 corners"`. Omitted: the cell's content names it. */
|
|
852
|
+
cellLabel?: ((row: SequenceMatrixRow, column: SequenceMatrixColumn) => string | undefined) | undefined;
|
|
853
|
+
/** Draws a row header's content. Defaults to `row.label`. Interactive content here is the caller's to make focusable. */
|
|
854
|
+
renderRowHeader?: ((row: SequenceMatrixRow) => ReactNode) | undefined;
|
|
855
|
+
/** Draws a column header's content. Defaults to `column.label`. */
|
|
856
|
+
renderColumnHeader?: ((column: SequenceMatrixColumn) => ReactNode) | undefined;
|
|
857
|
+
/** The corner's text. Defaults to nothing visible; the corner is named "Rows". */
|
|
858
|
+
corner?: ReactNode;
|
|
859
|
+
/** A row's height in CSS pixels. Defaults to 36. */
|
|
860
|
+
rowHeight?: number | undefined;
|
|
861
|
+
/** Every column's width in CSS pixels. Defaults to 72. */
|
|
862
|
+
colWidth?: number | undefined;
|
|
863
|
+
/** The column headers' height. Defaults to 32. */
|
|
864
|
+
headerHeight?: number | undefined;
|
|
865
|
+
/** The row headers' width. Defaults to 96. */
|
|
866
|
+
rowHeaderWidth?: number | undefined;
|
|
867
|
+
/** Rows and columns rendered beyond the viewport on each side. Defaults to 3. */
|
|
868
|
+
overscan?: number | undefined;
|
|
869
|
+
/** Render only the cells in view. Defaults to true; off, every cell is rendered (a small matrix). */
|
|
870
|
+
windowed?: boolean | undefined;
|
|
871
|
+
/** The selection, controlled: `null` for none. Pair with `onValueChange`. */
|
|
872
|
+
value?: SequenceMatrixSelection | null | undefined;
|
|
873
|
+
/** The initial selection, when uncontrolled. */
|
|
874
|
+
defaultValue?: SequenceMatrixSelection | null | undefined;
|
|
875
|
+
/** Called with the new selection on a click, Space, Enter, or Shift + a move, and on a header click. */
|
|
876
|
+
onValueChange?: ((value: SequenceMatrixSelection) => void) | undefined;
|
|
877
|
+
/** Select the cell the arrow keys land on, as well as focus it. Defaults to false: arrows move, Space or Enter selects. */
|
|
878
|
+
selectionFollowsFocus?: boolean | undefined;
|
|
879
|
+
/** Allow a range (Shift + click or move, header click, Ctrl + A). Defaults to true; off, selection is one cell. */
|
|
880
|
+
multiple?: boolean | undefined;
|
|
881
|
+
/** Called with the cell's row and column ids on Enter and on a double click. */
|
|
882
|
+
onCellAction?: ((row: string, column: string) => void) | undefined;
|
|
883
|
+
/** Names the grid. */
|
|
884
|
+
"aria-label": string;
|
|
885
|
+
/** Merged onto the scroller with `cn`. Give the matrix a height (and a width): it scrolls inside its box. */
|
|
886
|
+
className?: string | undefined;
|
|
887
|
+
/** Inline style of the scroller, after the matrix's own: its size when a class is not at hand. */
|
|
888
|
+
style?: CSSProperties | undefined;
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* A windowed rows-by-columns grid with sticky headers and cell-level keyboard focus.
|
|
892
|
+
*
|
|
893
|
+
* - **Windowed in both axes**: only the cells in view (plus `overscan`, plus the focused cell) are
|
|
894
|
+
* in the DOM, so ten columns by several hundred rows are a few dozen elements. Row height and
|
|
895
|
+
* column width are uniform.
|
|
896
|
+
* - **Keyboard**: the grid is one Tab stop (roving `tabindex` on the focused cell). Arrows move by
|
|
897
|
+
* cell, Home/End to the ends of the row, Ctrl + Home/End to the corners, PageUp/PageDown by a
|
|
898
|
+
* screenful of rows. Space or Enter selects the focused cell and Enter also calls `onCellAction`;
|
|
899
|
+
* Shift + a move or Shift + click extends the selection to a rectangle; Shift + Space selects
|
|
900
|
+
* the focused row, Ctrl + Space its column, Ctrl + A everything.
|
|
901
|
+
* - **Selection**: one cell or a rectangle, controlled (`value`) or not. A click on a row or
|
|
902
|
+
* column header selects that whole row or column.
|
|
903
|
+
* - **Roles**: `grid` with `aria-rowcount` and `aria-colcount` (counting the headers), `row`s with
|
|
904
|
+
* `aria-rowindex`, `columnheader`, `rowheader` and `gridcell`s with `aria-colindex` and
|
|
905
|
+
* `aria-selected`; the whole rectangle is `aria-multiselectable`. Cells carry `data-selected`
|
|
906
|
+
* and `data-focused`.
|
|
907
|
+
* - **No listeners per cell**: clicks, keys and focus are handled once, on the scroller.
|
|
908
|
+
*
|
|
909
|
+
* Server rendering draws the first screenful of an assumed 640 by 400 px, without measuring.
|
|
910
|
+
*/
|
|
911
|
+
export declare function SequenceMatrix({ rows, columns, renderCell, cellLabel, renderRowHeader, renderColumnHeader, corner, rowHeight, colWidth, headerHeight, rowHeaderWidth, overscan, windowed, value: controlled, defaultValue, onValueChange, selectionFollowsFocus, multiple, onCellAction, "aria-label": ariaLabel, className, style }: SequenceMatrixProps): import("react").JSX.Element;
|
|
912
|
+
//#endregion
|
|
797
913
|
//#region src/components/Stepper.d.ts
|
|
798
914
|
/** One step of a `Stepper`. */
|
|
799
915
|
interface StepperStep {
|
|
@@ -875,5 +991,5 @@ interface StepView {
|
|
|
875
991
|
*/
|
|
876
992
|
export declare function stepStates(steps: readonly StepGate[], current: string | null): StepView[];
|
|
877
993
|
//#endregion
|
|
878
|
-
export { type AdvanceResult, type AppShellProps, type DropEntry, type FileDropProps, type NavRailItemProps, type NavRailLabels, type NavRailProps, type PaneSize, type PathSource, type PlaybackBarProps, type PlaybackClockOptions, type PlaybackMarker, type Playhead, type SequenceItem, type SequenceItemStatus, type SequenceNavigatorProps, type SidePanelSize, type SizedPane, type SplitLimits, type SplitOrientation, type SplitPaneProps, type StatusBarProps, type StepGate, type StepState, type StepView, type StepperProps, type StepperStep, type ToastOptions, type ToastRecord, type ToastStore, type ToastTone, Toaster, type ToasterProps, type TreeKeyAction, type TreeNode, type TreeRow, type TreeViewProps, createToastStore, defaultToastStore, toast };
|
|
994
|
+
export { type AdvanceResult, type AppShellProps, type DropEntry, type FileDropProps, type NavRailItemProps, type NavRailLabels, type NavRailProps, type PaneSize, type PathSource, type PlaybackBarProps, type PlaybackClockOptions, type PlaybackMarker, type Playhead, type SequenceItem, type SequenceItemStatus, type SequenceMatrixCellState, type SequenceMatrixColumn, type SequenceMatrixProps, type SequenceMatrixRow, type SequenceMatrixSelection, type SequenceNavigatorProps, type SidePanelSize, type SizedPane, type SplitLimits, type SplitOrientation, type SplitPaneProps, type StatusBarProps, type StepGate, type StepState, type StepView, type StepperProps, type StepperStep, type ToastOptions, type ToastRecord, type ToastStore, type ToastTone, Toaster, type ToasterProps, type TreeKeyAction, type TreeNode, type TreeRow, type TreeViewProps, createToastStore, defaultToastStore, toast };
|
|
879
995
|
//# sourceMappingURL=index.d.ts.map
|