@aiquants/spreadsheet 0.14.0 → 0.15.0

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 CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
  All notable changes to `@aiquants/spreadsheet` are documented here.
4
4
 
5
+ ## 0.15.0 (2026-10-26)
6
+
7
+ グリッドがコピーと貼り付けに使う TSV の符号化を、グリッドを読み込まない副パス `@aiquants/spreadsheet/tsv` として公開する。
8
+ barrel も同じ関数を公開し続けるので、既存の import と描画・操作の動作は変わらない。
9
+
10
+ - **新機能 — `@aiquants/spreadsheet/tsv`**: `parseTsv` と `serializeTsv` (barrel と同じ関数で、定義は 1 つ) を、React も
11
+ `@aiquants/virtualscroll` も読まない入口から公開する (約 1 KB)。グリッドを遅延で読み込むホストが、最初の描画の時点で表の文字を
12
+ 読める (サーバーで描く代わりの表と、それと同じクライアントの最初の描画)。barrel から `parseTsv` だけを読むと、束ねる道具は
13
+ グリッドの大半を落とせない (約 260 KB と React・virtualscroll の import が残る) ため、別の入口にした。
14
+ - **ビルド**: 入口は `index`・`view`・`tsv` の 3 つ。符号化のモジュールは `index` と `tsv` が共有する塊 (`tsv-<hash>.js` /
15
+ `.cjs`) に入り、どちらもそれを読む。
16
+ - **peer**: `@aiquants/virtualscroll` の peer の範囲は `^3.22.0` のまま (0.14.0 と同じ)。
17
+ - **検証 — 走行台帳 (census の錨は本未リリース節)**: 単体 / 統合 **94 ファイル 4,097 テスト** 全緑 —
18
+ 0.14.0 出荷時の 93 ファイル 4,094 に v0.15 進行分 +3 (新規 `tsvEntry` 2、0.14.0 節の出荷時凍結ピンで `hxCensus` +1)。
19
+ barrel (`src/index.ts`) の export は変わらない。`tsc --noEmit` / biome 0。
20
+
5
21
  ## 0.14.0 (2026-10-26)
6
22
 
7
23
  グリッドの固定の寸法と拡大率の規則を、グリッドを読み込まない副パス `@aiquants/spreadsheet/view` として公開する。グリッド自身も
package/README.md CHANGED
@@ -844,9 +844,28 @@ const zoomIn = () => setZoom((zoom) => clampSpreadsheetZoom(stepSpreadsheetZoom(
844
844
  // <Spreadsheet zoom={zoom} onZoomChange={setZoom} … />
845
845
  ```
846
846
 
847
+ ## TSV codec (`@aiquants/spreadsheet/tsv`)
848
+
849
+ `@aiquants/spreadsheet/tsv` publishes `parseTsv` and `serializeTsv` — the codec the grid copies and pastes with — without
850
+ loading the grid (no React, no `@aiquants/virtualscroll`; about 1 KB). A host that lazily imports the grid can still read
851
+ the grid's text during the first render, for example to server-render a placeholder table of the rows the grid will show
852
+ (the same markup on the client, so hydration matches). The barrel exports the same two functions (one definition), so
853
+ code that already loads the grid keeps importing them from `@aiquants/spreadsheet`.
854
+
855
+ | Export | Contract |
856
+ | :--- | :--- |
857
+ | `parseTsv(text)` | A rectangular `string[][]`: one trailing line terminator dropped, empty text read as one empty cell (`[[""]]`), ragged rows padded with `""`; a quoted field is unquoted only when its content holds a tab or a line break (a value merely wrapped in quotes is literal text, as Excel writes it) |
858
+ | `serializeTsv(matrix)` | Rows joined with CRLF and a trailing CRLF; only a field with a tab or a line break is quoted (its quotes doubled) — every other field, quotes included, is written verbatim (Excel's behaviour) |
859
+
860
+ ```tsx
861
+ import { parseTsv } from "@aiquants/spreadsheet/tsv"
862
+
863
+ const rows = parseTsv(text) // ready before `import("@aiquants/spreadsheet")` resolves
864
+ ```
865
+
847
866
  ## Clipboard utilities (public)
848
867
 
849
- `parseTsv` / `serializeTsv` / `estimatePasteCellCount` / `expandPaste` are exported for building custom paste UIs and
868
+ `parseTsv` / `serializeTsv` (also at `@aiquants/spreadsheet/tsv`) / `estimatePasteCellCount` / `expandPaste` are exported for building custom paste UIs and
850
869
  importers with the exact same Excel-compatible semantics the grid uses. `enumerateRangeCells`, `makeRange`,
851
870
  `rangeContains`, `rangeSize`, `columnIndexToName`, `columnNameToIndex` round out the toolkit. The named unions
852
871
  `SpreadsheetDirection` (`"up" | "down" | "left" | "right"` — the `findDataEdge` direction), `SpreadsheetOperation` (the