@aiquants/spreadsheet 0.17.0 → 0.17.2
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/CHANGELOG.md +77 -0
- package/README.md +27 -8
- package/dist/index.cjs +8 -8
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +3447 -3371
- package/dist/styles/spreadsheet.css +1 -1
- package/dist/styles/spreadsheet.standalone.css +1 -1
- package/package.json +1 -1
- package/src/Spreadsheet.tsx +213 -35
- package/src/header/useHeaderResize.ts +21 -5
- package/src/keyboard/useGridKeyboard.ts +15 -3
- package/src/styles/spreadsheet.css +12 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,83 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `@aiquants/spreadsheet` are documented here.
|
|
4
4
|
|
|
5
|
+
## 0.17.2 (2026-10-27)
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- **A press into a grid without focus no longer scrolls the page back to the previous active cell.** A press moved the
|
|
10
|
+
focus to the hidden input before it moved the selection, while the input still sat on the previous active cell, and
|
|
11
|
+
the browser scrolled the page to it: in a grid taller than its page (a box that shows every row), the first press on
|
|
12
|
+
a row below the window's top sent the page back to A1. Every press (cells, headings, the corner, resize strips, the
|
|
13
|
+
fill handle, scroll-bar bands, a reference while pointing) now focuses without scrolling, since the pressed point is
|
|
14
|
+
on screen; focus that reaches the root from a touch tap does too, while a keyboard entry (`:focus-visible`) still
|
|
15
|
+
scrolls the page to the active cell.
|
|
16
|
+
- **PageUp and PageDown measure the part of the grid the reader sees with the browser's own hit test.** 0.17.1 cut the
|
|
17
|
+
viewport by the clipping boxes it found walking the DOM's ancestors, which miscounted in common pages: an `html`
|
|
18
|
+
with `overflow-x: hidden` (its overflow belongs to the viewport, yet its box moves as the page scrolls) shortened the
|
|
19
|
+
move or sent it to the last row; a modal dialog, a popover or full screen (the top layer, which no ancestor clips), a
|
|
20
|
+
fixed or absolutely positioned grid (clipped only along its containing blocks) and a shadow tree were cut by boxes
|
|
21
|
+
that do not clip them, or not by the ones that do. The seen part is now found by hit testing down the middle of the
|
|
22
|
+
body pane (samples, then the edges bisected to 1 px), so every clip, the top layer, shadow trees and anything painted
|
|
23
|
+
over the grid count as drawn. While no part of the body is seen, a page move goes a screenful of the window, and a
|
|
24
|
+
move shorter than the row it starts on still goes one visible row (inside a row taller than the viewport, PageDown
|
|
25
|
+
stayed on that row since 0.2).
|
|
26
|
+
- **`onContentSizeChange` counts the bands in a box smaller than the bands.** 0.17.1 read the bands as the zoom
|
|
27
|
+
wrapper's inner size less the body pane's, which in a box smaller than the bands (a host that starts its box at 0 × 0)
|
|
28
|
+
is the box's size, so the first report missed the bands until the body resized. The bands are now read from the
|
|
29
|
+
corner, which fills their crossing whatever the box's size or the page's direction.
|
|
30
|
+
- **Autofit measures each font with its own letter and word spacing.** 0.17.1 copied the body pane's computed spacing
|
|
31
|
+
to every font, but a reader's override is usually written in em (WCAG 1.4.12's `0.12em` / `0.16em`), so a cell drawn
|
|
32
|
+
at another size was measured with the wrong spacing and a fitted column cut its text. Each measured font now reads
|
|
33
|
+
the spacing a hidden sample inside the body pane computes for it.
|
|
34
|
+
|
|
35
|
+
### Verification
|
|
36
|
+
|
|
37
|
+
- **公開面・DOM 属性**: 0.17.1 と同じ (公開面 143 export、`data-aqsp-*` のリテラル census 83 種)。
|
|
38
|
+
- **検証 — 走行台帳 (census の錨は本未リリース節)**: 単体 / 統合 **98 ファイル 4,252 テスト** 全緑 —
|
|
39
|
+
0.17.1 出荷時の 98 ファイル 4,246 に v0.17.2 進行分 +6 (`hostFit` +5、0.17.1 節の出荷時凍結ピンで `hxCensus` +1)。
|
|
40
|
+
`tsc --noEmit` / biome 0。E2E は `host-fit` +2 (焦点の無い表の途中のセルの押下でページが跳び戻らない、根の要素が
|
|
41
|
+
`overflow-x: hidden` でもページ送りが窓の 1 画面) を加えた全 25 ファイル 287 テスト。押下のスクロールを戻す変異は 493 px
|
|
42
|
+
から 0 px への跳び戻りで、ページ送りを 0.17.1 の祖先のたどりに戻す変異は「49 行目のはずが 28 行目」で赤。全数実行
|
|
43
|
+
(load average 11〜12) は 286 passed / 1 failed で、落ちたのは `styles` の 1 本 (Ctrl+B の直後に computed を 1 回だけ読む
|
|
44
|
+
競合。単独では 3 回とも合格)。操作の直後に 1 回だけ読む 15 か所を `expect.poll` に直し、`styles` の 41 件は全緑。
|
|
45
|
+
|
|
46
|
+
## 0.17.1 (2026-10-27)
|
|
47
|
+
|
|
48
|
+
### Fixed
|
|
49
|
+
|
|
50
|
+
- **`onContentSizeChange` reports what the grid draws in every layout.** A grid with no rows or no columns draws no
|
|
51
|
+
cells, bands or scroll bars and now reports 0 × 0; it reported nothing before, so a host kept the size of the table it
|
|
52
|
+
showed last. A grid without a layout box (under a `display: none` ancestor) reads its bands as 0, so it no longer
|
|
53
|
+
reports then and reports again once it has a box, as it now does when a host's stylesheet changes a band's size
|
|
54
|
+
without a render (the body pane is observed for both). In a right-to-left grid the row numbers sit to the right of
|
|
55
|
+
the cells, where the body's left offset does not count them, so the width came out one band short; the bands are now
|
|
56
|
+
the zoom wrapper's inner size less the body's, which counts them on either side.
|
|
57
|
+
- **PageUp and PageDown move by the part of the grid the page shows.** A grid taller than its scroll container (a box
|
|
58
|
+
that shows every row) holds every row in its own viewport, so a page move went from any row to the first or the last.
|
|
59
|
+
The travel is now the grid's viewport cut to the part of the body pane that the clipping boxes outside the grid and
|
|
60
|
+
the window show, so a page move goes one screenful, as it does in a grid that scrolls itself.
|
|
61
|
+
- **The reveal after a keyboard move lands at once** (`behavior: "instant"`). A host page with `scroll-behavior: smooth`
|
|
62
|
+
animated every reveal, so a held arrow key left the page behind the active cell.
|
|
63
|
+
- **The active cell's frame is at least 3 CSS px on screen at every zoom** (WCAG 2.4.13). The 2 px frame lived inside
|
|
64
|
+
the zoom wrapper and shrank with it (1.5 px at 75 %, 0.5 px at 25 %); its width is now 3 px divided by the zoom,
|
|
65
|
+
rounded up to a whole pixel, since browsers floor a border's width to whole pixels (divided alone, it came out 2.52 px
|
|
66
|
+
at 84 % and 1.68 px at 168 %). On screen that is 3 px to under 3 px plus the zoom. Its area inside a W × H cell, at
|
|
67
|
+
least 6 (W + H) − 36, is at least that of a 2 px perimeter around the cell, 4 (W + H) + 16, whenever W + H ≥ 26 — a
|
|
68
|
+
default 100 × 24 cell down to the 25 % zoom (25 × 6 px on screen).
|
|
69
|
+
- **Autofit measures with the cells' letter and word spacing**, a reader's text-spacing override included (WCAG 1.4.12).
|
|
70
|
+
A canvas does not inherit CSS spacing, so a fitted column cut off its widest text once the spacing was widened.
|
|
71
|
+
|
|
72
|
+
### Verification
|
|
73
|
+
|
|
74
|
+
- **公開面・DOM 属性**: 0.17.0 と同じ (公開面 143 export、`data-aqsp-*` のリテラル census 83 種)。内部の変数
|
|
75
|
+
`--_aqsp-zoom` (ズームの包みの倍率。既定 1 を `.aqsp-zoom` が宣言し、倍率が 1 でないときは部品がインラインで書く) を追加。
|
|
76
|
+
- **検証 — 走行台帳 (census の錨は本未リリース節)**: 単体 / 統合 **98 ファイル 4,246 テスト** 全緑 —
|
|
77
|
+
0.17.0 出荷時の 98 ファイル 4,231 に v0.17.1 進行分 +15 (`hostFit` +12、`useGridKeyboard` +2、0.17.0 節の出荷時凍結ピンで
|
|
78
|
+
`hxCensus` +1)。`tsc --noEmit` / biome 0。E2E は `host-fit` +4 (PageDown / PageUp の 1 画面、右から左の大きさ、キーで辿る
|
|
79
|
+
倍率の全部の段の枠の太さ、文字の間隔のある自動調整) を加えた全 25 ファイル 285 テストを全数実行で確かめた (枠の 1 件は、
|
|
80
|
+
倍率で割るだけの太さ (整数の px へ切り捨て) に戻すと倍率 0.84 の 2.52 px で落ちることも確かめた)。
|
|
81
|
+
|
|
5
82
|
## 0.17.0 (2026-10-27)
|
|
6
83
|
|
|
7
84
|
A host can now fit the grid's box to its content: hide the column letters and row numbers, read the content size, fit
|
package/README.md
CHANGED
|
@@ -367,9 +367,12 @@ Row autofit restores the default row height (cells render single-line clipped).
|
|
|
367
367
|
> **Autofit measures with the cells' base font.** Text measurement composes its font from the **body pane's** computed
|
|
368
368
|
> style (style / weight / size / family — the cells' parent, so the fit works whether `headings` shows the bands or not);
|
|
369
369
|
> the cell's **painted** format (bold / italic from the base format and width-relevant conditional formats, `fontSize` in
|
|
370
|
-
> pt × 4/3, `fontFamily`) overrides those parts per cell, bucketed so `ctx.font` is assigned once per distinct font.
|
|
371
|
-
>
|
|
372
|
-
>
|
|
370
|
+
> pt × 4/3, `fontFamily`) overrides those parts per cell, bucketed so `ctx.font` is assigned once per distinct font.
|
|
371
|
+
> Each bucket's letter and word spacing go to the canvas too (a canvas does not inherit CSS spacing), read from a hidden
|
|
372
|
+
> sample inside the pane that takes the bucket's font, so a reader's text-spacing override (WCAG 1.4.12, usually in em)
|
|
373
|
+
> widens the fit of every font size instead of cutting the widest text. If your CSS gives the cells a different base
|
|
374
|
+
> font or spacing than their pane, autofit will mismeasure — set them on the root, which the pane, the cells and the
|
|
375
|
+
> header bands all inherit (the shipped stylesheets do).
|
|
373
376
|
|
|
374
377
|
`enableResizeUI={false}` removes the strips **and the unhide markers** — a consumer with hidden tracks then has no
|
|
375
378
|
in-package restore affordance (only the imperative API). The imperative `resizeRow` / `resizeColumn` calls bypass every UI
|
|
@@ -488,7 +491,9 @@ keyboard input — this is what makes IME composition, clipboard events, and 16M
|
|
|
488
491
|
- Keyboard reachability is complete for the keymap below: every listed operation works without a pointer, and `Escape` from
|
|
489
492
|
the grid root returns focus to the page tab order (WCAG 2.1.2 — no keyboard trap). The grid never takes focus on mount
|
|
490
493
|
(the hidden input is armed focus-neutrally — WCAG 3.2.1 / 2.4.3): keyboard entry is the page tab order (Tab / Shift+Tab)
|
|
491
|
-
or a click, and re-entry always lands on the hidden input.
|
|
494
|
+
or a click, and re-entry always lands on the hidden input. A press focuses it without scrolling the page (the pressed
|
|
495
|
+
point is on screen, and the input still sits on the previous active cell until the press moves the selection), and so
|
|
496
|
+
does focus a touch tap sends to the root; a keyboard entry (`:focus-visible`) scrolls the page to the active cell. Resizing has keyboard commands of its own (Alt+Shift+Arrow,
|
|
492
497
|
Alt+Shift+= — see "Resizing from the keyboard"), and filling has `fillDown` / `fillRight` / `fillSelection` (Ctrl+D / Ctrl+R /
|
|
493
498
|
Ctrl+Enter).
|
|
494
499
|
- The hidden input's `inputmode` is a **virtual-keyboard invitation**, not a mirror of the editing session — and not an idle
|
|
@@ -611,6 +616,13 @@ the freeze divider `#858e9d` 3.31 / 3.0, the unhide markers at full opacity 4.7
|
|
|
611
616
|
input border `#8b95a4` 3.03. Grid lines, band edges, popover frames and the note tip's frame are decorative (the tip is identified by its
|
|
612
617
|
surface and shadow).
|
|
613
618
|
|
|
619
|
+
**Focus appearance (WCAG 2.4.13).** The active cell's frame is at least 3 CSS px of `--aqsp-accent` inside the cell at
|
|
620
|
+
every zoom: the zoom wrapper scales it, so its width is 3 px divided by the zoom, rounded up to a whole pixel (browsers
|
|
621
|
+
floor a border's width to whole pixels) — 3 px to under 3 px plus the zoom on screen. Its area in a W × H cell on screen,
|
|
622
|
+
at least 6 (W + H) − 36, is at least that of a 2 px perimeter around the cell, 4 (W + H) + 16, whenever W + H ≥ 26 — a
|
|
623
|
+
default 100 × 24 cell down to the 25 % zoom (25 × 6 px) — and the accent changes those pixels from the surface at
|
|
624
|
+
5.17:1. A browser without CSS `round()` drops the width and draws the initial 3 px, which the zoom scales.
|
|
625
|
+
|
|
614
626
|
**Contrast (WCAG 1.4.6, 7:1).** Every text / background pair of the light defaults is at least 7:1, measured with the WCAG 2
|
|
615
627
|
formula; the three pairs below 7:1 before v0.16 were re-solved by changing lightness only (the hue stays):
|
|
616
628
|
|
|
@@ -740,8 +752,8 @@ track, and paging moves by exact viewport-height pixel geometry, so page landing
|
|
|
740
752
|
| Home / End (+Ctrl) | First/last visible column / visible grid corner | Native | Native | — |
|
|
741
753
|
| Shift+Home / Shift+End | Extend to the first / last visible column | Native | Native | — |
|
|
742
754
|
| Ctrl+Shift+Home / End | Extend to the first / last visible grid corner | Native | Native | — |
|
|
743
|
-
| PageUp / PageDown | Page move
|
|
744
|
-
| Shift+PageUp / PageDown | Extend by one
|
|
755
|
+
| PageUp / PageDown | Page move by one screenful, exact: the grid's viewport cut to the part of it the reader sees (see *Fitting a box to the grid*) | Commit + page move | Commit + page move | — |
|
|
756
|
+
| Shift+PageUp / PageDown | Extend by one screenful | Native | Native | — |
|
|
745
757
|
| Ctrl+Space / Shift+Space | Select whole columns / rows of **every** selected range (anchor/active stay) | Native | Native | — |
|
|
746
758
|
| F2 | Start editing (edit) | Toggle the pointing arm — a session opens disarmed (Excel Edit mode: the first Arrow moves the caret), typing a trigger arms it, F2 is Excel's Edit ⇄ Enter (formula session with `getCellFormula`; otherwise native) | Toggle the pointing arm | — |
|
|
747
759
|
| F4 | — | Cycle the `$` anchor of the reference under the caret (`A1` → `$A$1` → `A$1` → `$A1`) | Same | — |
|
|
@@ -898,7 +910,7 @@ The grid's own UI chrome ships in English (`"en"`, the default) and Japanese (`"
|
|
|
898
910
|
| `maxOperationCells` | `number` | Bulk-operation ceiling (default 100,000). Row fan-out resize gates at 1/10 of it and autofit at 1/4 — see "Operation limits". |
|
|
899
911
|
| `enableResizeUI` | `boolean` | Default `true`. `false` removes resize strips **and unhide markers** — hidden tracks then have no in-package restore path (imperative API only). |
|
|
900
912
|
| `headings` | `boolean` | v0.17 — default `true`: shows the column letters, the row numbers and the corner (Excel's "headings"; not `headerRows`). `false` draws none of the three and collapses their grid tracks to 0, so the cells start at the grid's top-left corner; the gestures that live only on them go with them (header presses, the corner's select-all, the resize strips and unhide markers) and their keyboard twins stay (Ctrl+Space, Shift+Space, Ctrl+A, Alt+Shift+Arrow, Alt+Shift+=). The bands are `aria-hidden`, so assistive technology meets the same grid. The root carries `data-aqsp-headings-hidden` while they are hidden. LIVE prop. |
|
|
901
|
-
| `onContentSizeChange` | `(size: SpreadsheetContentSize) => void` | v0.17 — receives the size of the grid's content in CSS px: the bands (when shown), every column and row at its current size and the two scroll bars the grid always reserves, all scaled by the zoom (the scroll bars live inside the zoom wrapper, so they scale too). Called after the first layout and after every change of it — a track's size (a resize, an autofit, a hide or unhide, the imperative `resizeRow` / `resizeColumn`), the row or column count, the default sizes, the zoom or `headings` — never with an unchanged size. See *Fitting a box to the grid*. |
|
|
913
|
+
| `onContentSizeChange` | `(size: SpreadsheetContentSize) => void` | v0.17 — receives the size of the grid's content in CSS px: the bands (when shown), every column and row at its current size and the two scroll bars the grid always reserves, all scaled by the zoom (the scroll bars live inside the zoom wrapper, so they scale too). Called after the first layout and after every change of it — a track's size (a resize, an autofit, a hide or unhide, the imperative `resizeRow` / `resizeColumn`), the row or column count, the default sizes, the zoom or `headings` — never with an unchanged size. The bands count on whichever side of the cells they sit (a right-to-left grid too) and in a box smaller than them; a grid with no rows or no columns draws nothing and reports 0 × 0; a grid without a layout box (under a `display: none` ancestor) reports once it has one. See *Fitting a box to the grid*. |
|
|
902
914
|
| `zoom` / `defaultZoom` / `onZoomChange` | `number` / `number` / `(zoom: number) => void` | Package zoom (v0.3): visual transform scale, logic stays in logical px. Controlled (`zoom`) or uncontrolled (`defaultZoom`, default 1). Gestures — Alt+Wheel and Ctrl+Alt+`=` / `+` / `-` / `0` (reset; the four keys match the produced character, Shift-agnostic; AltGraph-state chords are never claimed — legacy-shape defense in depth, see Keymap notes) — request via `onZoomChange`; Ctrl+Wheel is deliberately unbound (the browser owns it). Clamped to [`SPREADSHEET_ZOOM_MIN`, `SPREADSHEET_ZOOM_MAX`] (0.25–4, `clampSpreadsheetZoom` of `@aiquants/spreadsheet/view`); a non-finite value (NaN / ±Infinity) throws a `RangeError` (fail-fast — no silent substitution). |
|
|
903
915
|
| `enableFillHandle` | `boolean` | Default `true`. Fill writes through `applyEdits` — disable for read-only adapters. |
|
|
904
916
|
| `onSelectionChange` | `(selection: SelectionState) => void` | Fires on confirmed changes only — never on mount, and never mid-drag with one documented exception: the header subtract reservation converts to a real press on the first movement that both really changes the pointer coordinates and lands on a different header index (in-index jitter and synthetic same-position moves keep the reservation), firing the deferred press replace mid-drag (total fire count matches v0.1). |
|
|
@@ -1014,7 +1026,14 @@ ref.current?.autoFitColumns(Array.from({ length: colCount }, (_, col) => col))
|
|
|
1014
1026
|
host's box, the page) by the least amount that shows the cell — block and inline "nearest", honouring their
|
|
1015
1027
|
`scroll-padding` (give a scroller with a sticky bar a matching `scroll-padding`). The reveal goes through a hidden
|
|
1016
1028
|
marker under the root (`data-aqsp-reveal`), clipped to the root's box, so no container inside the grid moves; a
|
|
1017
|
-
pointer selection does not scroll (the pressed cell is on screen).
|
|
1029
|
+
pointer selection does not scroll (the pressed cell is on screen). The reveal lands at once (`behavior: "instant"`),
|
|
1030
|
+
whatever the page's `scroll-behavior`, so a held arrow key does not leave the page behind.
|
|
1031
|
+
- **Page moves go by a screenful of the page.** PageUp / PageDown travel the grid's viewport cut to the part of the
|
|
1032
|
+
body the reader sees — a box that shows every row holds every row in the grid's own viewport, which would page from
|
|
1033
|
+
any row to the first or the last. The seen part comes from the browser's own hit test down the middle of the body,
|
|
1034
|
+
so every clip (scroll containers, the window, an `html` whose overflow belongs to the viewport), the top layer (a
|
|
1035
|
+
modal dialog, a popover, full screen), shadow trees and anything painted over the grid count as drawn. While no part
|
|
1036
|
+
of the body is seen, a page move goes a screenful of the window; a move shorter than its starting row goes one row.
|
|
1018
1037
|
|
|
1019
1038
|
The demo's `/fit` route is the reference wiring.
|
|
1020
1039
|
|