Tables: grid editing, paste, table actions, phone scroll (mockup, then app) #619

Open
opened 2026-10-19 10:41:36 +00:00 by kayg · 5 comments
Owner

kayg (2026-10-19): tables, so a gym log can be kept. Decided in the tables grill:

  • T1 plain GFM pipe tables in the file; nothing extra stored.
  • T2 a clean grid you type into; pipes only in Show source; Tab/Shift-Tab between cells; Enter on the last row adds a row. "Our UI/UX around tables needs to be extremely good."
  • T3 /table or Insert → header + 2 rows × 3 columns; paste from a spreadsheet or web page becomes a table; typing a | a | b | line + Enter converts.
  • T4 nothing around the table at rest; selecting a cell morphs the bar into table actions (add row/column, delete, align, sort); tap a row/column edge to select it.
  • T5 phone: scrolls sideways inside the card (never the page), first column pinned, soft edge fade.
  • T6 number-only columns right-aligned with tabular figures on screen; the file keeps the user's alignment.
    Mockup first (tables.html), then the app. After tables: images and files in the app (today they exist only in the mockup).
kayg (2026-10-19): tables, so a gym log can be kept. Decided in the tables grill: - T1 plain GFM pipe tables in the file; nothing extra stored. - T2 a clean grid you type into; pipes only in Show source; Tab/Shift-Tab between cells; Enter on the last row adds a row. "Our UI/UX around tables needs to be extremely good." - T3 /table or Insert → header + 2 rows × 3 columns; paste from a spreadsheet or web page becomes a table; typing a `| a | b |` line + Enter converts. - T4 nothing around the table at rest; selecting a cell morphs the bar into table actions (add row/column, delete, align, sort); tap a row/column edge to select it. - T5 phone: scrolls sideways inside the card (never the page), first column pinned, soft edge fade. - T6 number-only columns right-aligned with tabular figures on screen; the file keeps the user's alignment. Mockup first (tables.html), then the app. After tables: images and files in the app (today they exist only in the mockup).
Author
Owner

Tables mockup is live: https://preview.calternal.cloud/tables.html (branch issue/tables-mockup, commit f6ac77d). It is its own page; chrome.html and tasks.html are untouched (the deploy script checked every other file's hash).

State links (all https://preview.calternal.cloud/tables.html#...; add &theme=dark for dark):

  • Gym log, two tables at rest: /note/gym-log?list=all
  • Caret in a cell, bar = table actions: &cell=2,1; header &cell=0,2; wrapping cell &cell=7,0
  • Row picked (drag the edge to move): &row=3; column picked: &col=3
  • Wide table (9 columns, scrolls inside the card on a phone): &cell=3,6&tbl=1
  • Show source (exact GFM text, alignment row included; also the note's ⋯ menu): &source=1
  • /table, Insert, typed line, paste: /note/table-scratch?list=all&slash=table, &sheet=insert&insertq=table, &typed=1 (press Enter), &paste=tsv, &paste=html
  • 50 rows for the speed check: /note/big-table?list=all&cell=25,2

Built: T1 file keeps plain GFM pipe text (the user's --- row stays; numbers are only right-aligned on screen, T6). T2 grid with Tab/Shift-Tab, arrows at cell edges, Enter (last row adds a row), Backspace in an empty last row removes it, Esc selects the block. T3 all four ways of making one. T4 the same capsule morphs (table / tablerow / tablecol), tiers 52 / 44 unchanged; row and column edges pick, drag moves on a spring. T5 phone scroller with pinned first column, edge shadow and right fade. Tests: tests/tables.spec.ts 24/24 in Chromium and WebKit (320/390/440), plus bun test src/tables for the model.

Frame check (iPhone simulator, real WebKit, 50-row table, rAF deltas; idle floor 17 ms): typing worst 17 ms, 0 frames over 20 ms (a plain paragraph in the same page: 40 ms worst); keystroke to painted frame 27 ms. Tab between cells: worst 32 ms, one slow frame each (the same cost as moving the caret between paragraphs, 41 ms worst). Over budget, not fixed yet: row insert / delete / sort and the bar morph on 50 rows show 40 to 100 ms worst frames (the whole grid is laid out again). Details in the final report.

Tables mockup is live: https://preview.calternal.cloud/tables.html (branch `issue/tables-mockup`, commit f6ac77d). It is its own page; chrome.html and tasks.html are untouched (the deploy script checked every other file's hash). State links (all `https://preview.calternal.cloud/tables.html#...`; add `&theme=dark` for dark): - Gym log, two tables at rest: `/note/gym-log?list=all` - Caret in a cell, bar = table actions: `&cell=2,1`; header `&cell=0,2`; wrapping cell `&cell=7,0` - Row picked (drag the edge to move): `&row=3`; column picked: `&col=3` - Wide table (9 columns, scrolls inside the card on a phone): `&cell=3,6&tbl=1` - Show source (exact GFM text, alignment row included; also the note's ⋯ menu): `&source=1` - /table, Insert, typed line, paste: `/note/table-scratch?list=all&slash=table`, `&sheet=insert&insertq=table`, `&typed=1` (press Enter), `&paste=tsv`, `&paste=html` - 50 rows for the speed check: `/note/big-table?list=all&cell=25,2` Built: T1 file keeps plain GFM pipe text (the user's `---` row stays; numbers are only right-aligned on screen, T6). T2 grid with Tab/Shift-Tab, arrows at cell edges, Enter (last row adds a row), Backspace in an empty last row removes it, Esc selects the block. T3 all four ways of making one. T4 the same capsule morphs (table / tablerow / tablecol), tiers 52 / 44 unchanged; row and column edges pick, drag moves on a spring. T5 phone scroller with pinned first column, edge shadow and right fade. Tests: `tests/tables.spec.ts` 24/24 in Chromium and WebKit (320/390/440), plus `bun test src/tables` for the model. Frame check (iPhone simulator, real WebKit, 50-row table, `rAF` deltas; idle floor 17 ms): typing worst 17 ms, 0 frames over 20 ms (a plain paragraph in the same page: 40 ms worst); keystroke to painted frame 27 ms. Tab between cells: worst 32 ms, one slow frame each (the same cost as moving the caret between paragraphs, 41 ms worst). Over budget, not fixed yet: row insert / delete / sort and the bar morph on 50 rows show 40 to 100 ms worst frames (the whole grid is laid out again). Details in the final report.
Author
Owner

Tables, second pass, live at https://preview.calternal.cloud/tables.html (commit 6439a34).

The real-iPhone bug (pill and mic cut off): found and fixed. Cells were 15 px, and iOS zooms the whole page into any editable smaller than 16 px. In the simulator, tapping a cell gave visualViewport.scale 1.067, the document 402 wide in a 377 viewport, so fixed things ran off the right. Cells are now at least 16 px on a phone. Same taps after the fix: scale 1, document = viewport, nothing outside, capsule and mic centred with 12 pt each side (keyboard up, wide table, light and dark). I also stopped scrollIntoView (it scrolls the clipped boxes around a table and can pan the page); only the page and the table scroller move for a caret. New test walks every fixed/sticky element in 8 states at 320/375/390/440, light and dark, in both engines (rects inside the screen, capsule+mic inside the side margins and centred, document no wider than the screen).

Layout: rows are now independent grids on shared column widths (measured once from the text with canvas, kept while typing, redone for a column when you leave a changed cell), content-visibility: auto on rows, rows inserted/removed/sorted in place and animated on the rows only, caret and edge picking painted by hand on a few cells. Text columns are at least 9.5 em (the pinned first one at most 60% of the card), numbers fit; what does not fit scrolls sideways. At 390 the long exercise name is 5 lines, not 8. Touch strips: row strip 44 pt wide; on a finger the whole header cell is the column strip (first tap picks the column, a second one goes in to type). The phone bar's strip lists the most-used four first (row below, column right, row above, column left).

Frame numbers, iPhone simulator, 50 rows (worst frame ms / frames over 20 ms; before = commit f6ac77d, after = 6439a34; idle floor 18 to 32; a plain paragraph in the same page: typing 46 to 68, bar morph 32):

  • typing: 17 / 0 before, 34 / 1 after (first frame 9 to 10, painted 26 to 44)
  • Tab: 32 / 9 before, 35 / 7 after
  • Enter on last row: 40 / 3 before, 33 / 4 after
  • Backspace removes row: 101 / 5 before, 93 / 5 after
  • bar add row: 39 / 4 before, 26 / 4 after
  • bar sort: 82 / 11 before, 59 / 5 after
  • bar morph into table actions: 72 / 12 before, 86 / 12 after
  • sideways scroll: 46 / 4 before, 45 / 2 after

Honest status: not at "no frame over 16.7 ms". Row and sort work got lighter, but the simulator idles at 18 to 32 ms worst and a plain paragraph morph already shows 32 ms with 10 slow frames, so most of what is left is the shared chrome's own cost; the table-specific excess is Backspace-row (93), bar morph (86) and sort (59). I did not find the cause of the Backspace-row frame (the JS for it is 3 to 7 ms).

Tables, second pass, live at https://preview.calternal.cloud/tables.html (commit 6439a34). **The real-iPhone bug (pill and mic cut off): found and fixed.** Cells were 15 px, and iOS zooms the whole page into any editable smaller than 16 px. In the simulator, tapping a cell gave `visualViewport.scale 1.067`, the document 402 wide in a 377 viewport, so fixed things ran off the right. Cells are now at least 16 px on a phone. Same taps after the fix: scale 1, document = viewport, nothing outside, capsule and mic centred with 12 pt each side (keyboard up, wide table, light and dark). I also stopped `scrollIntoView` (it scrolls the clipped boxes around a table and can pan the page); only the page and the table scroller move for a caret. New test walks every fixed/sticky element in 8 states at 320/375/390/440, light and dark, in both engines (rects inside the screen, capsule+mic inside the side margins and centred, document no wider than the screen). **Layout:** rows are now independent grids on shared column widths (measured once from the text with canvas, kept while typing, redone for a column when you leave a changed cell), `content-visibility: auto` on rows, rows inserted/removed/sorted in place and animated on the rows only, caret and edge picking painted by hand on a few cells. Text columns are at least 9.5 em (the pinned first one at most 60% of the card), numbers fit; what does not fit scrolls sideways. At 390 the long exercise name is 5 lines, not 8. Touch strips: row strip 44 pt wide; on a finger the whole header cell is the column strip (first tap picks the column, a second one goes in to type). The phone bar's strip lists the most-used four first (row below, column right, row above, column left). **Frame numbers, iPhone simulator, 50 rows (worst frame ms / frames over 20 ms; before = commit f6ac77d, after = 6439a34; idle floor 18 to 32; a plain paragraph in the same page: typing 46 to 68, bar morph 32):** - typing: 17 / 0 before, 34 / 1 after (first frame 9 to 10, painted 26 to 44) - Tab: 32 / 9 before, 35 / 7 after - Enter on last row: 40 / 3 before, 33 / 4 after - Backspace removes row: 101 / 5 before, 93 / 5 after - bar add row: 39 / 4 before, 26 / 4 after - bar sort: 82 / 11 before, 59 / 5 after - bar morph into table actions: 72 / 12 before, 86 / 12 after - sideways scroll: 46 / 4 before, 45 / 2 after Honest status: not at "no frame over 16.7 ms". Row and sort work got lighter, but the simulator idles at 18 to 32 ms worst and a plain paragraph morph already shows 32 ms with 10 slow frames, so most of what is left is the shared chrome's own cost; the table-specific excess is Backspace-row (93), bar morph (86) and sort (59). I did not find the cause of the Backspace-row frame (the JS for it is 3 to 7 ms).
Author
Owner

kayg (2026-10-19): column/row resizing on desktop and phone; the sideways toolbar strip → 4 actions + 'more' morph menu; bug: first column could scroll away from the left. TB1 decided: column widths persist in the note's frontmatter per table, in characters (table-widths: 14, 4, 4, 5); the table stays plain GFM.

kayg (2026-10-19): column/row resizing on desktop and phone; the sideways toolbar strip → 4 actions + 'more' morph menu; bug: first column could scroll away from the left. TB1 decided: column widths persist in the note's frontmatter per table, in characters (table-widths: [[14, 4, 4, 5]]); the table stays plain GFM.
Author
Owner

Tables, third pass, live at https://preview.calternal.cloud/tables.html (commit 4835b65).

  1. Pinned column drifting right (the empty band): the table was being rubber-banded by iOS at its left end, and the pinned column goes with the bounce. A touch handler now holds any horizontal drag that would go past either end (preventDefault on a non-passive touchmove, only for a mostly-horizontal drag), plus overscroll-behavior-x: none. I could not reproduce the bounce in the simulator, so please check on the phone.
  2. Resize: mouse drags a column's right border (8 px zone, col-resize cursor, double-click fits to content and forgets the width) or a row's bottom border (minimum height, not saved). A finger picks the column or row, then drags the handle that shows on its edge. Column widths are saved per kayg's decision (TB1): the note's frontmatter, in ch, one list per table in document order, e.g. table-widths: [[null, 11, null, null]] (seen in Show source, &source=1). The table's own pipe text is untouched; null means it sizes itself. Column add/delete/move keep the list in step; an entry whose column count no longer matches is ignored. Tables are matched by order.
  3. Phone bar: four tools and "more", no strip. Cell: row below, column right, align (cycles), sort (toggles). Row: row above, row below, delete, done. Column: column right, align, sort, done. "More" turns the capsule into a menu (the Attach menu's morph) with the rest; the mic steps aside while it is open. Capsule plus mic fit and stay centred at 320/375/390/440 (the screen-bounds test has a "more" state).

Tests: tests/tables.spec.ts, 56 cases in Chromium and WebKit; the page-load timeouts that showed under host load 30 pass when re-run.

Frames, iPhone simulator, 50-row table, per interaction (worst frame ms / input to first frame ms / painted ms). Caveat: the simulator's page runs at about 30 fps even idle (idle worst 17 to 33 ms, 120 of 179 idle frames over 16.7), so "frames over 8.3 / 16.7" counts are meaningless there (nearly every frame is over both, idle too); the worst frame and the latencies are what mean something. Normal / CPU-limited (taskpolicy -b on the page's WebContent process, restored; the simulator has no switch for Low Power Mode, so that was not tested, and the limit changed little):

  • typing 24 / 13 / 33 and 21 / 14 / 26 (a plain paragraph: 61 / 83 / 175 and 17 / 16 / 165)
  • Tab 50 / 75 / 130 and 49 / 33 / 78
  • Enter on last row 53 / 69 / 130 and 48 / 74 / 136
  • Backspace removes row 112 / 20 / 42 and 30 / 23 / 50
  • add row 24 / 41 / 80 and 18 / 36 / 66
  • sort 60 / 15 / 104 and 54 / 18 / 82
  • more menu open and close 91 / 42 / 133 and 89 / 43 / 132
  • bar morph into table actions 213 / 46 / 139 and 173 / 65 / 157 (a paragraph's morph: 23 / 21 / 125 and 35 / 20 / 71)
  • sideways scroll 35 / 5 / 250 and 31 / 8 / 269

Chromium, main-thread time from input to forced layout (390 wide, 50 rows), 1x and 6x CPU throttle (ms, median): typing 1.1 and 7.2; Tab 1.4 and 12.6; Enter 8.7 and 9.5; Backspace row 0.8 and 4; add row 11.7 and 82; sort 20.8 and 191; more menu 25.7 and 107; focus a cell 2.3 and 20.7. Chromium headless frame timing under host load 27 to 34 was useless (idle worst 266 ms), so no frame counts from it.

Not at 8.3 or 16.7 ms: sort, add row and the more menu on a pointer, Tab, and the bar morph. Found this pass: rows now render as stable objects (a sort no longer re-renders every cell); the rest of a bar morph is the shared keyboard-guard (kbUp, setRoom) and no-scroll (check) code, which forces layout every frame while a field has focus: in a CPU profile of 6 morphs it costs the same on a plain paragraph as on a cell (about 365 ms and 150 ms), so it is not table-specific. The 213 ms worst frame for the table's morph in the simulator is not explained by that and I did not find its cause.

Tables, third pass, live at https://preview.calternal.cloud/tables.html (commit 4835b65). 1. **Pinned column drifting right (the empty band):** the table was being rubber-banded by iOS at its left end, and the pinned column goes with the bounce. A touch handler now holds any horizontal drag that would go past either end (`preventDefault` on a non-passive touchmove, only for a mostly-horizontal drag), plus `overscroll-behavior-x: none`. I could not reproduce the bounce in the simulator, so please check on the phone. 2. **Resize:** mouse drags a column's right border (8 px zone, col-resize cursor, double-click fits to content and forgets the width) or a row's bottom border (minimum height, not saved). A finger picks the column or row, then drags the handle that shows on its edge. Column widths are saved per kayg's decision (TB1): the note's frontmatter, in ch, one list per table in document order, e.g. `table-widths: [[null, 11, null, null]]` (seen in Show source, `&source=1`). The table's own pipe text is untouched; null means it sizes itself. Column add/delete/move keep the list in step; an entry whose column count no longer matches is ignored. Tables are matched by order. 3. **Phone bar:** four tools and "more", no strip. Cell: row below, column right, align (cycles), sort (toggles). Row: row above, row below, delete, done. Column: column right, align, sort, done. "More" turns the capsule into a menu (the Attach menu's morph) with the rest; the mic steps aside while it is open. Capsule plus mic fit and stay centred at 320/375/390/440 (the screen-bounds test has a "more" state). Tests: tests/tables.spec.ts, 56 cases in Chromium and WebKit; the page-load timeouts that showed under host load 30 pass when re-run. **Frames**, iPhone simulator, 50-row table, per interaction (worst frame ms / input to first frame ms / painted ms). Caveat: the simulator's page runs at about 30 fps even idle (idle worst 17 to 33 ms, 120 of 179 idle frames over 16.7), so "frames over 8.3 / 16.7" counts are meaningless there (nearly every frame is over both, idle too); the worst frame and the latencies are what mean something. Normal / CPU-limited (`taskpolicy -b` on the page's WebContent process, restored; the simulator has no switch for Low Power Mode, so that was not tested, and the limit changed little): - typing 24 / 13 / 33 and 21 / 14 / 26 (a plain paragraph: 61 / 83 / 175 and 17 / 16 / 165) - Tab 50 / 75 / 130 and 49 / 33 / 78 - Enter on last row 53 / 69 / 130 and 48 / 74 / 136 - Backspace removes row 112 / 20 / 42 and 30 / 23 / 50 - add row 24 / 41 / 80 and 18 / 36 / 66 - sort 60 / 15 / 104 and 54 / 18 / 82 - more menu open and close 91 / 42 / 133 and 89 / 43 / 132 - bar morph into table actions 213 / 46 / 139 and 173 / 65 / 157 (a paragraph's morph: 23 / 21 / 125 and 35 / 20 / 71) - sideways scroll 35 / 5 / 250 and 31 / 8 / 269 Chromium, main-thread time from input to forced layout (390 wide, 50 rows), 1x and 6x CPU throttle (ms, median): typing 1.1 and 7.2; Tab 1.4 and 12.6; Enter 8.7 and 9.5; Backspace row 0.8 and 4; add row 11.7 and 82; sort 20.8 and 191; more menu 25.7 and 107; focus a cell 2.3 and 20.7. Chromium headless frame timing under host load 27 to 34 was useless (idle worst 266 ms), so no frame counts from it. Not at 8.3 or 16.7 ms: sort, add row and the more menu on a pointer, Tab, and the bar morph. Found this pass: rows now render as stable objects (a sort no longer re-renders every cell); the rest of a bar morph is the shared keyboard-guard (`kbUp`, `setRoom`) and no-scroll (`check`) code, which forces layout every frame while a field has focus: in a CPU profile of 6 morphs it costs the same on a plain paragraph as on a cell (about 365 ms and 150 ms), so it is not table-specific. The 213 ms worst frame for the table's morph in the simulator is not explained by that and I did not find its cause.
Author
Owner

Tables, fourth pass, live at https://preview.calternal.cloud/tables.html (commit e38087d, branch issue/tables-mockup). A column is never narrower than its longest word (header included, split only at spaces and after hyphens) plus padding; no mid-word breaks; dragging clamps there. The table spans the card: the header row is the row's own background, and the leftover goes to the widest text column; if you narrowed columns by hand and no text column is left, the rest is plain card (the header row and lines still run the full width). The phone bar is the same strip as the other bars again (five tools showing, scrolls inside the capsule, fixed order: row below, column right, row above, column left, align x3, sort x2, delete row, delete column); the more menu is gone. The text under the glass and between the capsule and the mic is the shared dock's behaviour: the text bar looks identical (shots e1-text-bar and e1-table-bar), so I left it. Tests: 57 of 58 pass in Chromium and WebKit (min width never below the longest word, no word split across lines via Range rects, header and last column span the card, strip order and five visible); the one miss is a page-load timeout under host load. Shared files touched vs the chrome round-8c base: blocks/insert.ts, components/BlockContent.svelte, BottomBar.svelte (one line: the table bar), Editor.svelte, VariantSwitcher.svelte, lib/route.svelte.ts.

Tables, fourth pass, live at https://preview.calternal.cloud/tables.html (commit e38087d, branch issue/tables-mockup). A column is never narrower than its longest word (header included, split only at spaces and after hyphens) plus padding; no mid-word breaks; dragging clamps there. The table spans the card: the header row is the row's own background, and the leftover goes to the widest text column; if you narrowed columns by hand and no text column is left, the rest is plain card (the header row and lines still run the full width). The phone bar is the same strip as the other bars again (five tools showing, scrolls inside the capsule, fixed order: row below, column right, row above, column left, align x3, sort x2, delete row, delete column); the more menu is gone. The text under the glass and between the capsule and the mic is the shared dock's behaviour: the text bar looks identical (shots e1-text-bar and e1-table-bar), so I left it. Tests: 57 of 58 pass in Chromium and WebKit (min width never below the longest word, no word split across lines via Range rects, header and last column span the card, strip order and five visible); the one miss is a page-load timeout under host load. Shared files touched vs the chrome round-8c base: blocks/insert.ts, components/BlockContent.svelte, BottomBar.svelte (one line: the table bar), Editor.svelte, VariantSwitcher.svelte, lib/route.svelte.ts.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#619
No description provided.