@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/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { Button, Kbd, ReadoutStrip, Select, Slider, StatusDot, Toaster, Tooltip, byDensity, cn, createToastStore, defaultToastStore, focusRing, toast, toneColor, useDensity } from "@vitavision/ui";
2
- import { cloneElement, createContext, isValidElement, use, useCallback, useEffect, useEffectEvent, useId, useRef, useState, useSyncExternalStore } from "react";
1
+ import { Button, Kbd, ReadoutStrip, Select, Slider, StatusDot, Toaster, Tooltip, byDensity, cn, createToastStore, defaultToastStore, focusRing, focusRingInset, toast, toneColor, useDensity } from "@vitavision/ui";
2
+ import { cloneElement, createContext, isValidElement, use, useCallback, useEffect, useEffectEvent, useId, useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
3
3
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
4
4
  import { Check, ChevronFirst, ChevronLast, ChevronLeft, ChevronRight, FolderOpen, Lock, Pause, Play, Repeat, SkipBack, SkipForward, StepBack, StepForward } from "lucide-react";
5
5
  //#region src/components/splitSize.ts
@@ -1645,6 +1645,551 @@ function isTypingTarget(target) {
1645
1645
  return tag === "INPUT" || tag === "TEXTAREA" || tag === "SELECT" || target.isContentEditable;
1646
1646
  }
1647
1647
  //#endregion
1648
+ //#region src/components/matrixModel.ts
1649
+ const clamp = (value, low, high) => Math.min(high, Math.max(low, value));
1650
+ /**
1651
+ * Where a navigation key takes the cursor.
1652
+ *
1653
+ * - Arrows move one cell and stop at the edge.
1654
+ * - `Home` and `End` go to the first and last column of the row; with `ctrl`, to the first and
1655
+ * last cell of the grid.
1656
+ * - `PageUp` and `PageDown` move `page` rows.
1657
+ *
1658
+ * @param from - The cursor.
1659
+ * @param key - A `KeyboardEvent.key`.
1660
+ * @param size - The grid.
1661
+ * @param page - Rows in a page, at least 1.
1662
+ * @param ctrl - Whether Ctrl (or Cmd) is held.
1663
+ * @returns The new position, or `null` when the key is not a navigation key or the grid is empty.
1664
+ * The position is clamped, so it may equal `from`.
1665
+ */
1666
+ function moveFocus(from, key, size, page, ctrl = false) {
1667
+ if (size.rows <= 0 || size.cols <= 0) return null;
1668
+ const lastRow = size.rows - 1;
1669
+ const lastCol = size.cols - 1;
1670
+ const step = Math.max(1, Math.floor(page));
1671
+ const at = (row, col) => ({
1672
+ row: clamp(row, 0, lastRow),
1673
+ col: clamp(col, 0, lastCol)
1674
+ });
1675
+ switch (key) {
1676
+ case "ArrowUp": return at(from.row - 1, from.col);
1677
+ case "ArrowDown": return at(from.row + 1, from.col);
1678
+ case "ArrowLeft": return at(from.row, from.col - 1);
1679
+ case "ArrowRight": return at(from.row, from.col + 1);
1680
+ case "Home": return ctrl ? at(0, 0) : at(from.row, 0);
1681
+ case "End": return ctrl ? at(lastRow, lastCol) : at(from.row, lastCol);
1682
+ case "PageUp": return at(from.row - step, from.col);
1683
+ case "PageDown": return at(from.row + step, from.col);
1684
+ default: return null;
1685
+ }
1686
+ }
1687
+ /**
1688
+ * The items of one axis to render for a scroll position, plus a margin.
1689
+ *
1690
+ * @param scroll - The scroll offset along the axis, in pixels, from the start of the body.
1691
+ * @param viewport - The room the body has on that axis (the scroller's size less the sticky header).
1692
+ * @param size - One item's size in pixels.
1693
+ * @param count - The number of items.
1694
+ * @param overscan - Extra items on each side.
1695
+ * @returns `[start, end)`: indices to render. `[0, 0)` for no items or a non-positive size.
1696
+ */
1697
+ function windowRange(scroll, viewport, size, count, overscan) {
1698
+ if (count <= 0 || !(size > 0)) return [0, 0];
1699
+ const first = Math.floor(Math.max(0, scroll) / size);
1700
+ const last = Math.ceil((Math.max(0, scroll) + Math.max(0, viewport)) / size);
1701
+ if (first >= count) return [Math.max(0, count - 1 - overscan), count];
1702
+ const start = clamp(first - overscan, 0, count);
1703
+ return [start, clamp(last + overscan, start, count)];
1704
+ }
1705
+ /**
1706
+ * The scroll offset that brings an item fully into view, moving as little as possible.
1707
+ *
1708
+ * @param scroll - The current offset.
1709
+ * @param viewport - The room the body has on this axis.
1710
+ * @param index - The item.
1711
+ * @param size - One item's size.
1712
+ * @returns The offset: unchanged when the item is in view already, never negative.
1713
+ */
1714
+ function revealScroll(scroll, viewport, index, size) {
1715
+ const start = index * size;
1716
+ const end = start + size;
1717
+ if (start < scroll) return Math.max(0, start);
1718
+ if (end > scroll + viewport) return Math.max(0, end - viewport);
1719
+ return scroll;
1720
+ }
1721
+ /** The rectangle between two cells, in whichever order they are given. */
1722
+ function rectBetween(a, b) {
1723
+ return {
1724
+ row0: Math.min(a.row, b.row),
1725
+ row1: Math.max(a.row, b.row),
1726
+ col0: Math.min(a.col, b.col),
1727
+ col1: Math.max(a.col, b.col)
1728
+ };
1729
+ }
1730
+ /** Whether a cell is in a rectangle. */
1731
+ function inRect(rect, row, col) {
1732
+ return rect !== null && row >= rect.row0 && row <= rect.row1 && col >= rect.col0 && col <= rect.col1;
1733
+ }
1734
+ //#endregion
1735
+ //#region src/components/SequenceMatrix.tsx
1736
+ const DEFAULTS = {
1737
+ rowHeight: 36,
1738
+ colWidth: 72,
1739
+ headerHeight: 32,
1740
+ rowHeaderWidth: 96,
1741
+ overscan: 3
1742
+ };
1743
+ /** The room assumed before the scroller is measured, and on the server. */
1744
+ const INITIAL_VIEWPORT = {
1745
+ width: 640,
1746
+ height: 400
1747
+ };
1748
+ const sameWin = (a, b) => a.rows[0] === b.rows[0] && a.rows[1] === b.rows[1] && a.cols[0] === b.cols[0] && a.cols[1] === b.cols[1];
1749
+ const nameOf = (item) => item.name ?? (typeof item.label === "string" || typeof item.label === "number" ? String(item.label) : item.id);
1750
+ /** The grid cell, row header or column header an event came from, with its position. */
1751
+ function locate(target) {
1752
+ const element = target?.closest?.("[data-cell],[data-row-header],[data-col-header]");
1753
+ if (!element) return null;
1754
+ const row = Number(element.dataset["r"] ?? -1);
1755
+ const col = Number(element.dataset["c"] ?? -1);
1756
+ if (element.hasAttribute("data-cell")) return {
1757
+ kind: "cell",
1758
+ row,
1759
+ col,
1760
+ element
1761
+ };
1762
+ return element.hasAttribute("data-row-header") ? {
1763
+ kind: "row",
1764
+ row,
1765
+ col,
1766
+ element
1767
+ } : {
1768
+ kind: "col",
1769
+ row,
1770
+ col,
1771
+ element
1772
+ };
1773
+ }
1774
+ /**
1775
+ * A windowed rows-by-columns grid with sticky headers and cell-level keyboard focus.
1776
+ *
1777
+ * - **Windowed in both axes**: only the cells in view (plus `overscan`, plus the focused cell) are
1778
+ * in the DOM, so ten columns by several hundred rows are a few dozen elements. Row height and
1779
+ * column width are uniform.
1780
+ * - **Keyboard**: the grid is one Tab stop (roving `tabindex` on the focused cell). Arrows move by
1781
+ * cell, Home/End to the ends of the row, Ctrl + Home/End to the corners, PageUp/PageDown by a
1782
+ * screenful of rows. Space or Enter selects the focused cell and Enter also calls `onCellAction`;
1783
+ * Shift + a move or Shift + click extends the selection to a rectangle; Shift + Space selects
1784
+ * the focused row, Ctrl + Space its column, Ctrl + A everything.
1785
+ * - **Selection**: one cell or a rectangle, controlled (`value`) or not. A click on a row or
1786
+ * column header selects that whole row or column.
1787
+ * - **Roles**: `grid` with `aria-rowcount` and `aria-colcount` (counting the headers), `row`s with
1788
+ * `aria-rowindex`, `columnheader`, `rowheader` and `gridcell`s with `aria-colindex` and
1789
+ * `aria-selected`; the whole rectangle is `aria-multiselectable`. Cells carry `data-selected`
1790
+ * and `data-focused`.
1791
+ * - **No listeners per cell**: clicks, keys and focus are handled once, on the scroller.
1792
+ *
1793
+ * Server rendering draws the first screenful of an assumed 640 by 400 px, without measuring.
1794
+ */
1795
+ function SequenceMatrix({ rows, columns, renderCell, cellLabel, renderRowHeader, renderColumnHeader, corner, rowHeight = DEFAULTS.rowHeight, colWidth = DEFAULTS.colWidth, headerHeight = DEFAULTS.headerHeight, rowHeaderWidth = DEFAULTS.rowHeaderWidth, overscan = DEFAULTS.overscan, windowed = true, value: controlled, defaultValue = null, onValueChange, selectionFollowsFocus = false, multiple = true, onCellAction, "aria-label": ariaLabel, className, style }) {
1796
+ const scrollerRef = useRef(null);
1797
+ const [inner, setInner] = useState(defaultValue);
1798
+ const value = controlled === void 0 ? inner : controlled;
1799
+ const [focus, setFocus] = useState(null);
1800
+ const [hasFocus, setHasFocus] = useState(false);
1801
+ const focusPending = useRef(false);
1802
+ const rowIndex = useMemo(() => new Map(rows.map((row, i) => [row.id, i])), [rows]);
1803
+ const colIndex = useMemo(() => new Map(columns.map((column, i) => [column.id, i])), [columns]);
1804
+ const nRows = rows.length;
1805
+ const nCols = columns.length;
1806
+ const initialWin = () => windowed ? {
1807
+ rows: windowRange(0, INITIAL_VIEWPORT.height - headerHeight, rowHeight, nRows, overscan),
1808
+ cols: windowRange(0, INITIAL_VIEWPORT.width - rowHeaderWidth, colWidth, nCols, overscan)
1809
+ } : {
1810
+ rows: [0, nRows],
1811
+ cols: [0, nCols]
1812
+ };
1813
+ const [win, setWin] = useState(initialWin);
1814
+ const measure = useCallback(() => {
1815
+ const el = scrollerRef.current;
1816
+ if (!el) return;
1817
+ const next = windowed ? {
1818
+ rows: windowRange(el.scrollTop, el.clientHeight - headerHeight, rowHeight, nRows, overscan),
1819
+ cols: windowRange(el.scrollLeft, el.clientWidth - rowHeaderWidth, colWidth, nCols, overscan)
1820
+ } : {
1821
+ rows: [0, nRows],
1822
+ cols: [0, nCols]
1823
+ };
1824
+ setWin((prev) => sameWin(prev, next) ? prev : next);
1825
+ }, [
1826
+ windowed,
1827
+ headerHeight,
1828
+ rowHeight,
1829
+ nRows,
1830
+ overscan,
1831
+ rowHeaderWidth,
1832
+ colWidth,
1833
+ nCols
1834
+ ]);
1835
+ useLayoutEffect(() => {
1836
+ measure();
1837
+ }, [measure]);
1838
+ useEffect(() => {
1839
+ const el = scrollerRef.current;
1840
+ if (!el || typeof ResizeObserver === "undefined") return;
1841
+ const observer = new ResizeObserver(() => measure());
1842
+ observer.observe(el);
1843
+ return () => observer.disconnect();
1844
+ }, [measure]);
1845
+ const range = useMemo(() => {
1846
+ if (!value) return null;
1847
+ const a = {
1848
+ row: rowIndex.get(value.row),
1849
+ col: colIndex.get(value.col)
1850
+ };
1851
+ const b = {
1852
+ row: rowIndex.get(value.rowTo ?? value.row),
1853
+ col: colIndex.get(value.colTo ?? value.col)
1854
+ };
1855
+ if (a.row === void 0 || a.col === void 0 || b.row === void 0 || b.col === void 0) return null;
1856
+ return rectBetween({
1857
+ row: a.row,
1858
+ col: a.col
1859
+ }, {
1860
+ row: b.row,
1861
+ col: b.col
1862
+ });
1863
+ }, [
1864
+ value,
1865
+ rowIndex,
1866
+ colIndex
1867
+ ]);
1868
+ const anchor = useMemo(() => {
1869
+ if (!value) return null;
1870
+ const row = rowIndex.get(value.row);
1871
+ const col = colIndex.get(value.col);
1872
+ return row === void 0 || col === void 0 ? null : {
1873
+ row,
1874
+ col
1875
+ };
1876
+ }, [
1877
+ value,
1878
+ rowIndex,
1879
+ colIndex
1880
+ ]);
1881
+ const clampPos = (pos) => ({
1882
+ row: Math.min(Math.max(0, pos.row), Math.max(0, nRows - 1)),
1883
+ col: Math.min(Math.max(0, pos.col), Math.max(0, nCols - 1))
1884
+ });
1885
+ const tabStop = clampPos(focus ?? anchor ?? {
1886
+ row: 0,
1887
+ col: 0
1888
+ });
1889
+ const commit = (next) => {
1890
+ if (controlled === void 0) setInner(next);
1891
+ onValueChange?.(next);
1892
+ };
1893
+ const selectRange = (from, to) => {
1894
+ const a = rows[from.row];
1895
+ const b = rows[to.row];
1896
+ const c = columns[from.col];
1897
+ const d = columns[to.col];
1898
+ if (!a || !b || !c || !d) return;
1899
+ const one = from.row === to.row && from.col === to.col;
1900
+ commit(one || !multiple ? {
1901
+ row: b.id,
1902
+ col: d.id
1903
+ } : {
1904
+ row: a.id,
1905
+ col: c.id,
1906
+ rowTo: b.id,
1907
+ colTo: d.id
1908
+ });
1909
+ };
1910
+ const bodyViewport = () => {
1911
+ const el = scrollerRef.current;
1912
+ return {
1913
+ height: (el?.clientHeight ?? INITIAL_VIEWPORT.height) - headerHeight,
1914
+ width: (el?.clientWidth ?? INITIAL_VIEWPORT.width) - rowHeaderWidth
1915
+ };
1916
+ };
1917
+ /** Moves the cursor to `pos`: scrolls it into view and gives it the DOM focus once rendered. */
1918
+ const moveTo = (pos) => {
1919
+ const el = scrollerRef.current;
1920
+ if (el) {
1921
+ const viewport = bodyViewport();
1922
+ el.scrollTop = revealScroll(el.scrollTop, viewport.height, pos.row, rowHeight);
1923
+ el.scrollLeft = revealScroll(el.scrollLeft, viewport.width, pos.col, colWidth);
1924
+ }
1925
+ focusPending.current = true;
1926
+ setFocus(pos);
1927
+ };
1928
+ useEffect(() => {
1929
+ if (!focusPending.current) return;
1930
+ const el = scrollerRef.current?.querySelector(`[data-cell][data-r="${tabStop.row}"][data-c="${tabStop.col}"]`);
1931
+ if (!el) return;
1932
+ focusPending.current = false;
1933
+ el.focus({ preventScroll: true });
1934
+ });
1935
+ const onKeyDown = (event) => {
1936
+ const hit = locate(event.target);
1937
+ if (!hit || hit.kind !== "cell" || hit.element !== event.target || nRows === 0 || nCols === 0) return;
1938
+ const here = {
1939
+ row: hit.row,
1940
+ col: hit.col
1941
+ };
1942
+ const ctrl = event.ctrlKey || event.metaKey;
1943
+ if (event.altKey) return;
1944
+ if (event.key === " ") {
1945
+ event.preventDefault();
1946
+ if (event.shiftKey && multiple) selectRange({
1947
+ row: here.row,
1948
+ col: 0
1949
+ }, {
1950
+ row: here.row,
1951
+ col: nCols - 1
1952
+ });
1953
+ else if (ctrl && multiple) selectRange({
1954
+ row: 0,
1955
+ col: here.col
1956
+ }, {
1957
+ row: nRows - 1,
1958
+ col: here.col
1959
+ });
1960
+ else selectRange(here, here);
1961
+ return;
1962
+ }
1963
+ if (event.key === "Enter") {
1964
+ event.preventDefault();
1965
+ selectRange(here, here);
1966
+ onCellAction?.(rows[here.row].id, columns[here.col].id);
1967
+ return;
1968
+ }
1969
+ if (ctrl && event.key.toLowerCase() === "a") {
1970
+ if (!multiple) return;
1971
+ event.preventDefault();
1972
+ selectRange({
1973
+ row: 0,
1974
+ col: 0
1975
+ }, {
1976
+ row: nRows - 1,
1977
+ col: nCols - 1
1978
+ });
1979
+ return;
1980
+ }
1981
+ const page = Math.max(1, Math.floor(bodyViewport().height / rowHeight) - 1);
1982
+ const next = moveFocus(here, event.key, {
1983
+ rows: nRows,
1984
+ cols: nCols
1985
+ }, page, ctrl);
1986
+ if (next === null) return;
1987
+ event.preventDefault();
1988
+ moveTo(next);
1989
+ if (event.shiftKey && multiple) selectRange(anchor ?? here, next);
1990
+ else if (selectionFollowsFocus) selectRange(next, next);
1991
+ };
1992
+ const onClick = (event) => {
1993
+ const hit = locate(event.target);
1994
+ if (!hit) return;
1995
+ if (hit.kind !== "cell" && event.target.closest("button,a,input,select,textarea,[role=menu]")) return;
1996
+ if (hit.kind === "cell") {
1997
+ setFocus({
1998
+ row: hit.row,
1999
+ col: hit.col
2000
+ });
2001
+ const here = {
2002
+ row: hit.row,
2003
+ col: hit.col
2004
+ };
2005
+ if (event.shiftKey && multiple && anchor) selectRange(anchor, here);
2006
+ else selectRange(here, here);
2007
+ } else if (multiple && hit.kind === "row") selectRange({
2008
+ row: hit.row,
2009
+ col: 0
2010
+ }, {
2011
+ row: hit.row,
2012
+ col: nCols - 1
2013
+ });
2014
+ else if (multiple && hit.kind === "col") selectRange({
2015
+ row: 0,
2016
+ col: hit.col
2017
+ }, {
2018
+ row: nRows - 1,
2019
+ col: hit.col
2020
+ });
2021
+ };
2022
+ const onDoubleClick = (event) => {
2023
+ const hit = locate(event.target);
2024
+ if (hit?.kind === "cell") onCellAction?.(rows[hit.row].id, columns[hit.col].id);
2025
+ };
2026
+ const withFocus = (window, at, count) => {
2027
+ const out = [];
2028
+ let placed = at < 0 || at >= count || at >= window[0] && at < window[1];
2029
+ for (let i = window[0]; i < window[1]; i++) {
2030
+ if (!placed && at < i) {
2031
+ out.push(at);
2032
+ placed = true;
2033
+ }
2034
+ out.push(i);
2035
+ }
2036
+ if (!placed) out.push(at);
2037
+ return out;
2038
+ };
2039
+ const rowsShown = withFocus(win.rows, tabStop.row, nRows);
2040
+ const colsShown = withFocus(win.cols, tabStop.col, nCols);
2041
+ const totalWidth = rowHeaderWidth + nCols * colWidth;
2042
+ const totalHeight = headerHeight + nRows * rowHeight;
2043
+ const fullRow = (i) => range !== null && range.row0 <= i && i <= range.row1 && range.col0 === 0 && range.col1 === nCols - 1;
2044
+ const fullCol = (j) => range !== null && range.col0 <= j && j <= range.col1 && range.row0 === 0 && range.row1 === nRows - 1;
2045
+ return /* @__PURE__ */ jsx("div", {
2046
+ ref: scrollerRef,
2047
+ role: "grid",
2048
+ "aria-label": ariaLabel,
2049
+ "aria-rowcount": nRows + 1,
2050
+ "aria-colcount": nCols + 1,
2051
+ "aria-multiselectable": multiple ? true : void 0,
2052
+ tabIndex: nRows === 0 || nCols === 0 ? 0 : void 0,
2053
+ onScroll: measure,
2054
+ onKeyDown,
2055
+ onClick,
2056
+ onDoubleClick,
2057
+ onFocus: (event) => {
2058
+ setHasFocus(true);
2059
+ const hit = locate(event.target);
2060
+ if (hit?.kind === "cell") setFocus({
2061
+ row: hit.row,
2062
+ col: hit.col
2063
+ });
2064
+ },
2065
+ onBlur: (event) => {
2066
+ if (!event.currentTarget.contains(event.relatedTarget)) setHasFocus(false);
2067
+ },
2068
+ style: {
2069
+ position: "relative",
2070
+ overflow: "auto",
2071
+ scrollPaddingTop: headerHeight,
2072
+ scrollPaddingLeft: rowHeaderWidth,
2073
+ ...style
2074
+ },
2075
+ className: cn("rounded-control border border-line bg-surface text-fg select-none", className),
2076
+ children: /* @__PURE__ */ jsxs("div", {
2077
+ style: {
2078
+ position: "relative",
2079
+ width: totalWidth,
2080
+ height: totalHeight
2081
+ },
2082
+ children: [/* @__PURE__ */ jsxs("div", {
2083
+ role: "row",
2084
+ "aria-rowindex": 1,
2085
+ style: {
2086
+ position: "sticky",
2087
+ top: 0,
2088
+ zIndex: 20,
2089
+ height: headerHeight,
2090
+ width: totalWidth
2091
+ },
2092
+ children: [/* @__PURE__ */ jsx("div", {
2093
+ role: "columnheader",
2094
+ "aria-colindex": 1,
2095
+ className: "flex items-center border-r border-b border-line bg-raised px-2 text-xs text-fg-muted",
2096
+ style: {
2097
+ position: "sticky",
2098
+ left: 0,
2099
+ zIndex: 30,
2100
+ width: rowHeaderWidth,
2101
+ height: headerHeight
2102
+ },
2103
+ children: corner ?? /* @__PURE__ */ jsx("span", {
2104
+ className: "sr-only",
2105
+ children: "Rows"
2106
+ })
2107
+ }), colsShown.map((j) => {
2108
+ const column = columns[j];
2109
+ return /* @__PURE__ */ jsx("div", {
2110
+ role: "columnheader",
2111
+ "aria-colindex": j + 2,
2112
+ "aria-label": nameOf(column),
2113
+ "aria-selected": fullCol(j) ? true : void 0,
2114
+ "data-col-header": "",
2115
+ "data-c": j,
2116
+ "data-selected": fullCol(j) ? "" : void 0,
2117
+ className: cn("flex items-center justify-center overflow-hidden border-r border-b border-line px-1 text-xs", fullCol(j) ? "bg-signal/12 text-fg" : "bg-raised text-fg-muted"),
2118
+ style: {
2119
+ position: "absolute",
2120
+ top: 0,
2121
+ left: rowHeaderWidth + j * colWidth,
2122
+ width: colWidth,
2123
+ height: headerHeight
2124
+ },
2125
+ children: renderColumnHeader ? renderColumnHeader(column) : column.label
2126
+ }, column.id);
2127
+ })]
2128
+ }), rowsShown.map((i) => {
2129
+ const row = rows[i];
2130
+ return /* @__PURE__ */ jsxs("div", {
2131
+ role: "row",
2132
+ "aria-rowindex": i + 2,
2133
+ style: {
2134
+ position: "absolute",
2135
+ top: headerHeight + i * rowHeight,
2136
+ left: 0,
2137
+ height: rowHeight,
2138
+ width: totalWidth
2139
+ },
2140
+ children: [/* @__PURE__ */ jsx("div", {
2141
+ role: "rowheader",
2142
+ "aria-colindex": 1,
2143
+ "aria-label": nameOf(row),
2144
+ "aria-selected": fullRow(i) ? true : void 0,
2145
+ "data-row-header": "",
2146
+ "data-r": i,
2147
+ "data-selected": fullRow(i) ? "" : void 0,
2148
+ className: cn("flex items-center overflow-hidden border-r border-b border-line px-2 text-xs", fullRow(i) ? "bg-signal/12 text-fg" : "bg-raised text-fg-muted"),
2149
+ style: {
2150
+ position: "sticky",
2151
+ left: 0,
2152
+ zIndex: 10,
2153
+ width: rowHeaderWidth,
2154
+ height: rowHeight
2155
+ },
2156
+ children: renderRowHeader ? renderRowHeader(row) : row.label
2157
+ }), colsShown.map((j) => {
2158
+ const column = columns[j];
2159
+ const selected = inRect(range, i, j);
2160
+ const isStop = i === tabStop.row && j === tabStop.col;
2161
+ const focused = hasFocus && isStop;
2162
+ return /* @__PURE__ */ jsx("div", {
2163
+ role: "gridcell",
2164
+ "aria-colindex": j + 2,
2165
+ "aria-selected": selected,
2166
+ "aria-label": cellLabel?.(row, column),
2167
+ tabIndex: isStop ? 0 : -1,
2168
+ "data-cell": "",
2169
+ "data-r": i,
2170
+ "data-c": j,
2171
+ "data-selected": selected ? "" : void 0,
2172
+ "data-focused": focused ? "" : void 0,
2173
+ className: cn("overflow-hidden border-r border-b border-line", selected ? "bg-signal/12" : "hover:bg-raised", focusRingInset),
2174
+ style: {
2175
+ position: "absolute",
2176
+ top: 0,
2177
+ left: rowHeaderWidth + j * colWidth,
2178
+ width: colWidth,
2179
+ height: rowHeight
2180
+ },
2181
+ children: renderCell(row, column, {
2182
+ focused,
2183
+ selected
2184
+ })
2185
+ }, column.id);
2186
+ })]
2187
+ }, row.id);
2188
+ })]
2189
+ })
2190
+ });
2191
+ }
2192
+ //#endregion
1648
2193
  //#region src/components/stepperModel.ts
1649
2194
  /**
1650
2195
  * Each step's state, in order.
@@ -1743,6 +2288,6 @@ function StepMarker({ state, number }) {
1743
2288
  });
1744
2289
  }
1745
2290
  //#endregion
1746
- export { AppShell, DEFAULT_SPEEDS, FileDrop, NavRail, NavRailItem, PlaybackBar, SequenceNavigator, SplitPane, StatusBar, Stepper, Toaster, TreeView, acceptsFile, acceptsPath, advance, ancestorIds, clampIndex, clampSize, collectDroppedFiles, createPlayhead, createToastStore, defaultToastStore, formatSeconds, parentIds, resolveLimits, resolveSize, stepIndex, stepStates, toast, treeKeyAction, usePlaybackClock, usePlayhead, usePlayheadTimeline, visibleRows };
2291
+ export { AppShell, DEFAULT_SPEEDS, FileDrop, NavRail, NavRailItem, PlaybackBar, SequenceMatrix, SequenceNavigator, SplitPane, StatusBar, Stepper, Toaster, TreeView, acceptsFile, acceptsPath, advance, ancestorIds, clampIndex, clampSize, collectDroppedFiles, createPlayhead, createToastStore, defaultToastStore, formatSeconds, parentIds, resolveLimits, resolveSize, stepIndex, stepStates, toast, treeKeyAction, usePlaybackClock, usePlayhead, usePlayheadTimeline, visibleRows };
1747
2292
 
1748
2293
  //# sourceMappingURL=index.js.map