diff --git a/.trellis/workspace/hechang27-sprt/index.md b/.trellis/workspace/hechang27-sprt/index.md index 2df5a3b..5a4dd9a 100644 --- a/.trellis/workspace/hechang27-sprt/index.md +++ b/.trellis/workspace/hechang27-sprt/index.md @@ -8,8 +8,8 @@ - **Active File**: `journal-1.md` -- **Total Sessions**: 14 -- **Last Active**: 2026-04-02 +- **Total Sessions**: 15 +- **Last Active**: 2026-04-03 --- @@ -19,7 +19,7 @@ | File | Lines | Status | |------|-------|--------| -| `journal-1.md` | ~587 | Active | +| `journal-1.md` | ~659 | Active | --- @@ -29,6 +29,7 @@ | # | Date | Title | Commits | |---|------|-------|---------| +| 15 | 2026-04-03 | Rebuild list-table-v2: Scaffold hooks and types | `0f72b83`, `87000d8` | | 14 | 2026-04-02 | Fix list-table-v2 fixed column cropping and horizontal scroll | - | | 13 | 2026-04-02 | Attempt Pretext row height estimation for el-table-v2 | stashed | | 12 | 2026-04-02 | Pretext integration exploration - virtual table issues | `0764ee2` | diff --git a/.trellis/workspace/hechang27-sprt/journal-1.md b/.trellis/workspace/hechang27-sprt/journal-1.md index 8631263..7c484ac 100644 --- a/.trellis/workspace/hechang27-sprt/journal-1.md +++ b/.trellis/workspace/hechang27-sprt/journal-1.md @@ -585,3 +585,75 @@ Fixed list-table-v2 issues: ### Next Steps - None - task complete + + +## Session 15: Rebuild list-table-v2: Scaffold hooks and types + +**Date**: 2026-04-03 +**Task**: Rebuild list-table-v2: Scaffold hooks and types + +### Summary + +Scaffolded list-table-v2 hooks for pretext-based virtualized table. PR1 complete: hooks + types created. + +### Main Changes + +## What was done + +**Research**: Explored pretext-table (ShipItAndPray) and virtual-table (aimerthyr) implementations. pretext-table uses custom prefix-sum virtualizer + pretext text measurement (no TanStack Virtual). + +**PRD Created**: Full requirements documented: +- Custom prefix-sum virtualizer (pretext-table style, lightweight) +- @chenglou/pretext for text measurement +- Variance-based flexGrow/flexShrink from sampled data +- Runtime augmentation for custom cellRenderers +- Cell renderers return plain VNode or {vnode, minHeight, minWidth} + +## PR1: Scaffold ✅ COMPLETE + +``` +packages/base/data/list-table-v2/ +├── index.ts # Exports all hooks and types +├── types.ts # ListTableColumn, ListTableProps, etc. +├── measureText.ts # Cached pretext measurement +├── usePretextColumnWidths.ts # Variance-based flex params +├── usePretextRowHeights.ts # Pre-computed row heights +├── useVirtualRows.ts # Prefix-sum + binary search virtualizer +└── useRuntimeHeightAugment.ts # ResizeObserver + running average +``` + +## Key Design Decisions + +1. **prepareWithSegments() caching**: Using prepareWithSegments for everything since it's the superset type that works with both layout() and walkLineRanges(). Cache is LRU-capped at 10,000 entries. + +2. **walkLineRanges for shrink-wrap**: Using walkLineRanges with large maxWidth to find widest line — handles embedded \n correctly and avoids binary search. + +3. **Variance formula**: varianceScore = min(1, σ / (μ * 0.5)); flexGrow/flexShrink = 0.1 + varianceScore * 1.9 + +## Remaining PRs + +| PR | Goal | +|----|------| +| PR2 | Wire hooks into Vue component, flex container, virtual scrolling | +| PR3 | cellRenderer {vnode, minHeight} return type, ResizeObserver augmentation | +| PR4 | Fixed columns, pagination, slots, polish | + + +### Git Commits + +| Hash | Message | +|------|---------| +| `0f72b83` | (see git log) | +| `87000d8` | (see git log) | + +### Testing + +- [OK] (Add test results) + +### Status + +[OK] **Completed** + +### Next Steps + +- None - task complete