port: Notes Float slice 5 — split cards #1101

Closed
kayg wants to merge 1 commit from port/notes-float-s5-split into port/notes-float
Owner

Slice 5 of the Notes Float port (#1088). Based on port/notes-float-1a (b9a319721), independent of slice 4.

  • The gap between two split cards is the window gap (--win-gap, 12 px) and stays empty (backdrop shows, nothing frosted or tinted); card padding 28 px.
  • A card of one line gets heading-card padding (14 px above and below).
  • No caret is drawn in the gap: the editor sets cm-caret-gap while the caret is on a --- line (state field, one tree lookup per selection change).
  • New e2e/split-cards.spec.ts.

Gates (incl. typing CPU ABAB) follow in comments.

Slice 5 of the Notes Float port (#1088). Based on `port/notes-float-1a` (b9a319721), independent of slice 4. - The gap between two split cards is the window gap (`--win-gap`, 12 px) and stays empty (backdrop shows, nothing frosted or tinted); card padding 28 px. - A card of one line gets heading-card padding (14 px above and below). - No caret is drawn in the gap: the editor sets `cm-caret-gap` while the caret is on a `---` line (state field, one tree lookup per selection change). - New `e2e/split-cards.spec.ts`. Gates (incl. typing CPU ABAB) follow in comments.
kayg added 22 commits 2026-11-12 15:33:59 +00:00
Replaces Shell's grid and glass panes with components/window/WindowLayout; Backdrop gets a follower
mode for the second picture; tokens for the window; sidebar title row is the one title line.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A spring on the page card's own width re-laid the editor out every frame: zen cost 76 ms in
real Safari against 37 on dev. --f-l is a registered property so the window edge, the list card
and the clip spring as one value.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
--f-l as a registered, inherited property re-styled the whole document every spring frame.
The window edge, its shadow and the handle move by left; the page's clip by --cl; one spring.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
web: the phone's places screen keeps the padding its own rules set (my .sidebar.phone padding outranked them)
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled
b9a319721a
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
web: split cards: an empty window-sized gap, a one-line card has heading-card padding, no caret in the gap
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled
5c94f70d9f
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Author
Owner

Slice 5 gates (head see PR)

Commands: CI=1 bunx playwright test e2e/split-cards.spec.ts e2e/width.spec.ts e2e/divider-rule.spec.ts --project=<p> --workers=1 --retries=0 under ~/bin/slot.

gate result
chromium-390 (dev-01) 11 passed
chromium-1440 (dev-01) 17 passed, 1 failed: width.spec.ts:39 "a short note: Narrow and Wide cards are the same height". It also fails 4/10 on the slice-1a head with --repeat-each=10 (3/10 on this branch): pre-existing flake from 1a, not caused by this slice.
webkit-1440 / webkit-390 (dev-02) 17 passed / 11 passed

Found on the way: :has() cannot be nested; the first version of the one-line-card selector was silently dropped by :is(), caught by split-cards.spec.ts.
Decision: a phone ignores the stored width (full page, dividers), so split cards stay desktop; at Full width a --- is still a divider line (the product's default width is Full; see the slice-4 PR for the question to the captain).

NOT done yet: typing CPU ABAB via ~/bin/perf-turn (the editor gained one state field, caretInGap, one syntax-tree lookup per selection change; no staged dist/fixtures for a client typing ABAB on the perf VMs yet); real-Safari frames; mockup-vs-product shot pairs.

## Slice 5 gates (head see PR) Commands: `CI=1 bunx playwright test e2e/split-cards.spec.ts e2e/width.spec.ts e2e/divider-rule.spec.ts --project=<p> --workers=1 --retries=0` under `~/bin/slot`. | gate | result | |---|---| | chromium-390 (dev-01) | 11 passed | | chromium-1440 (dev-01) | 17 passed, 1 failed: `width.spec.ts:39` "a short note: Narrow and Wide cards are the same height". It also fails 4/10 on the slice-1a head with `--repeat-each=10` (3/10 on this branch): pre-existing flake from 1a, not caused by this slice. | | webkit-1440 / webkit-390 (dev-02) | 17 passed / 11 passed | Found on the way: `:has()` cannot be nested; the first version of the one-line-card selector was silently dropped by `:is()`, caught by `split-cards.spec.ts`. Decision: a phone ignores the stored width (full page, dividers), so split cards stay desktop; at Full width a `---` is still a divider line (the product's default width is Full; see the slice-4 PR for the question to the captain). **NOT done yet:** typing CPU ABAB via `~/bin/perf-turn` (the editor gained one state field, `caretInGap`, one syntax-tree lookup per selection change; no staged dist/fixtures for a client typing ABAB on the perf VMs yet); real-Safari frames; mockup-vs-product shot pairs.
Author
Owner

Slice 5, final gates (head c1600c887). Rebased on the merged 1a (port/notes-float eb9d0552b).

gate result
svelte-check 0 errors (a type error in my first version of the caret-in-gap attribute was caught and fixed)
unit editor 575 passed (incl. the new cm-lone test)
e2e (split-cards, width, divider-rule, editor, hidden-blocks, fresh-note, CI=1 --retries=0 --workers=1, own --output per project) chromium-1440 39 passed, chromium-390 29 passed (10 skipped), webkit-1440 35 passed (4 skipped), webkit-390 26 passed (13 skipped); 0 failed
first-paint / total bundle vs the merged base first JS 229984 -> 230054 B (+70 B), first CSS 19663 -> 19737 B (+74 B), total JS 510277 -> 510110 B; budgets.json index set to the measured 224.662 (the base is already over 223.9)
typing CPU ABAB, perf-01 turn + perf-02 lock perf/split-typing.perf.ts is a throwaway test next to the repo's own typing.perf.ts (not committed): 21 cards (20 ---) at the Narrow width, 216 real keys at 60 ms with the CPU slowed 4x, in the middle card and in the last card; PERF_DIST of the merged base vs this branch, a 10k-note fixture Home per arm, same backend binary; 6 rounds, order rotated, plus a third arm. Main-thread CPU per key (ms): middle card: base mean 29.20 / median 29.05 (range 28.1 to 31.1), slice 5 mean 29.15 / median 29.25 (range 28.7 to 29.5); last card: base 25.17 / 25.00, slice 5 25.23 / 25.25. Per-round differences (slice 5 minus base): median +0.4 ms (+1.4%) middle, +0.2 ms (+0.8%) last, inside the base-to-base spread of 3 ms. An earlier version of this branch used a :has() selector for the one-line card and measured +0.2% on the same harness; the third arm (the same build without that CSS rule) was about 1% lower, so the rule became a line decoration (cm-lone) and the arms now match. Not shown to be strictly below dev: the harness cannot resolve differences under about 1%.
first ABAB (older head): 8 arms base mean 24.4 / 28.0, slice 5 24.45 / 28.35 (end/middle), same conclusion
real-Safari frames not applicable to this slice's gates beyond the above; the Mac VM is not rendering (see the slice 4 PR)

Also found: width.spec.ts:39 ("Narrow and Wide cards are the same height") flakes on the 1a head (4/10 with --repeat-each=10), not from this slice.

## Slice 5, final gates (head c1600c887). Rebased on the merged 1a (`port/notes-float` eb9d0552b). | gate | result | |---|---| | svelte-check | 0 errors (a type error in my first version of the caret-in-gap attribute was caught and fixed) | | unit | editor 575 passed (incl. the new `cm-lone` test) | | e2e (`split-cards`, `width`, `divider-rule`, `editor`, `hidden-blocks`, `fresh-note`, `CI=1 --retries=0 --workers=1`, own `--output` per project) | chromium-1440 39 passed, chromium-390 29 passed (10 skipped), webkit-1440 35 passed (4 skipped), webkit-390 26 passed (13 skipped); 0 failed | | first-paint / total bundle vs the merged base | first JS 229984 -> 230054 B (**+70 B**), first CSS 19663 -> 19737 B (+74 B), total JS 510277 -> 510110 B; `budgets.json` index set to the measured 224.662 (the base is already over 223.9) | | **typing CPU ABAB, perf-01 turn + perf-02 lock** | `perf/split-typing.perf.ts` is a throwaway test next to the repo's own `typing.perf.ts` (not committed): 21 cards (20 `---`) at the Narrow width, 216 real keys at 60 ms with the CPU slowed 4x, in the middle card and in the last card; `PERF_DIST` of the merged base vs this branch, a 10k-note fixture Home per arm, same backend binary; 6 rounds, order rotated, plus a third arm. Main-thread CPU per key (ms): **middle card: base mean 29.20 / median 29.05 (range 28.1 to 31.1), slice 5 mean 29.15 / median 29.25 (range 28.7 to 29.5); last card: base 25.17 / 25.00, slice 5 25.23 / 25.25.** Per-round differences (slice 5 minus base): median +0.4 ms (+1.4%) middle, +0.2 ms (+0.8%) last, inside the base-to-base spread of 3 ms. An earlier version of this branch used a `:has()` selector for the one-line card and measured +0.2% on the same harness; the third arm (the same build without that CSS rule) was about 1% lower, so the rule became a line decoration (`cm-lone`) and the arms now match. Not shown to be strictly below dev: the harness cannot resolve differences under about 1%. | | first ABAB (older head): 8 arms | base mean 24.4 / 28.0, slice 5 24.45 / 28.35 (end/middle), same conclusion | | real-Safari frames | not applicable to this slice's gates beyond the above; the Mac VM is not rendering (see the slice 4 PR) | Also found: `width.spec.ts:39` ("Narrow and Wide cards are the same height") flakes on the 1a head (4/10 with `--repeat-each=10`), not from this slice.
Author
Owner

Slice 5: typing fix pushed (head now bd7b63a5a) and e2e re-run

Why: the earlier ABAB (comment 94360) left slice 5 about +0.2 to +0.4 ms/key above the base, which is not accepted (no regression of any size). The two things slice 5 added to every key press were a line lookup per break in markLone (two lineAt per pair of breaks) and a state field (caretInGap) that ran on every transaction.

Change (packages/editor/src/syntax/breaks.ts only, commit bd7b63a5a):

  • each break keeps its line number and line end from the lineAt call that finds it (no extra lookup), so touched() no longer calls lineAt per break per draw (that was in the base too, so this removes base work) and markLone decides from line numbers; it reads lines only for a gap of 2 to 4 lines;
  • cm-caret-gap is set by the breaks plugin's own draw (it already knows which break lines the selection touches) and read through an editor attribute source, instead of a StateField updated on every transaction.

Checks on bd7b63a5a: editor unit 575 passed; svelte-check 0 errors, 19 warnings (none new).
e2e (split-cards, width, divider-rule, editor, hidden-blocks, fresh-note, CI=1 --retries=0 --workers=1, server built from the base): chromium-1440 39 passed; chromium-390 29 passed (10 skipped); webkit-1440 35 passed (4 skipped); webkit-390 26 passed (13 skipped); 0 failed (same counts as c1600c887).

Typing CPU numbers (CPU counters, ABAB, perf-01) follow in the next comment.

## Slice 5: typing fix pushed (head now bd7b63a5a) and e2e re-run Why: the earlier ABAB (comment 94360) left slice 5 about +0.2 to +0.4 ms/key above the base, which is not accepted (no regression of any size). The two things slice 5 added to every key press were a line lookup per break in `markLone` (two `lineAt` per pair of breaks) and a state field (`caretInGap`) that ran on every transaction. Change (`packages/editor/src/syntax/breaks.ts` only, commit bd7b63a5a): - each break keeps its line number and line end from the `lineAt` call that finds it (no extra lookup), so `touched()` no longer calls `lineAt` per break per draw (that was in the base too, so this removes base work) and `markLone` decides from line numbers; it reads lines only for a gap of 2 to 4 lines; - `cm-caret-gap` is set by the breaks plugin's own `draw` (it already knows which break lines the selection touches) and read through an editor attribute source, instead of a StateField updated on every transaction. Checks on bd7b63a5a: editor unit 575 passed; svelte-check 0 errors, 19 warnings (none new). e2e (`split-cards`, `width`, `divider-rule`, `editor`, `hidden-blocks`, `fresh-note`, `CI=1 --retries=0 --workers=1`, server built from the base): chromium-1440 39 passed; chromium-390 29 passed (10 skipped); webkit-1440 35 passed (4 skipped); webkit-390 26 passed (13 skipped); 0 failed (same counts as c1600c887). Typing CPU numbers (CPU counters, ABAB, perf-01) follow in the next comment.
Author
Owner

Slice 5 typing CPU, resolved: new head bd7b63a5a is at or below the base (perf-01, CPU counters, 16 rounds ABAB)

Method (replaces the wall-clock-style ms/key of the first comments, which could not resolve under about 1%):

  • Chromium's own main-thread counters (Performance.getMetrics: ScriptDuration, LayoutDuration, RecalcStyleDuration, TaskDuration) read before and after 160 real key presses at 40 ms, CPU slowed 4x, per key. sls = script + style + layout.
  • A second, steadier number, loop: the same edit path in a tight loop, CPU not slowed, each key forced through view.measure() + style + layout (200 edits per block, median of 4 blocks after 2 warm ones; loopMin = fastest block).
  • 3 arms in ONE process on perf-01 (~/bin/perf-turn, one VM, no perf-02 pooling), each with its own server and Home copy from the SAME server binary (built from the base eb9d0552b, sha256 dabede64...), each web app built from its own head: base = eb9d0552b, old = c1600c887 (slice 5 as first reviewed), new = bd7b63a5a (this fix). 16 rounds, order rotated every round; each round types in the middle card (card 10) and the last card (card 20) of a 21-card note (20 ---, Narrow, 1440x900, a few one-line cards). Dists compared by tree hash on perf-01 vs dev-01 (identical).
  • Pairs are per round and position (32 pairs per metric). One standard error (SE) shown; "95% upper" = mean + 2 SE.
metric (ms/key, 4x slow) base old c1600c887 vs base new bd7b63a5a vs base
sls, middle card 12.041 -0.19% ±0.49 -0.27% ±0.62
sls, last card 11.838 -0.62% ±0.42 -0.84% ±0.68
task (all main-thread work), middle 26.500 -0.32% ±0.41 -0.43% ±0.60
task, last 25.706 -1.00% ±0.44 -0.72% ±0.44
loop (unslowed, tight), middle 4.569 +0.99% ±0.95 -0.50% ±0.56
loop, last 4.525 +1.15% ±1.18 -0.29% ±1.31

Pooled over both positions (32 pairs):

metric old vs base new vs base new pairs below base new 95% upper bound
sls -0.40% ±0.32 -0.55% ±0.46 (-0.069 ms/key) 20/32 +0.36%
task -0.66% ±0.30 -0.57% ±0.37 (-0.155 ms/key) 19/32 +0.16%
script -0.47% ±0.41 -0.49% ±0.54 18/32 +0.58%
style -1.40% ±0.67 -1.84% ±0.73 23/32 -0.39%
layout +1.52% ±0.62 +1.13% ±0.65 (+0.016 ms/key) 13/32 +2.42%
loop +1.07% ±0.74 -0.40% ±0.70 (-0.021 ms/key) 16/32 +1.00%
loopMin +1.54% ±1.19 -0.48% ±0.96 19/32 +1.43%

Reading: the first head's cost showed only in the steadier loop metric (+1.1% pooled, +1.5% loopMin); the fix removes it (new minus old on loop: about -1.5%). On the aggregate metrics the new head is at or below the base in both positions, and no aggregate's 95% upper bound is above +0.4% (loop's is +1.0%, its noisiest). The one component that sits above base is layout (+1.1% ±0.65, i.e. +0.016 ms/key, 1.7 SE): the slice's CSS changes break and card heights, and it is more than paid for by style (-1.8%). I am not claiming a significant improvement, only that nothing above the base is detectable at about ±0.5% resolution; the change is also structurally no more work than base (it removes the per-break lineAt the base's touched() did on every draw, and the StateField).

Dev-01 runs (shared host, per-run noise about 5 to 10%) were too noisy to use and are not part of the result. Raw per-run rows attached (typing-run1.json).
Not covered: real-Safari frames (the Mac does not render, see #1100).

## Slice 5 typing CPU, resolved: new head bd7b63a5a is at or below the base (perf-01, CPU counters, 16 rounds ABAB) Method (replaces the wall-clock-style ms/key of the first comments, which could not resolve under about 1%): - Chromium's own main-thread counters (`Performance.getMetrics`: ScriptDuration, LayoutDuration, RecalcStyleDuration, TaskDuration) read before and after 160 real key presses at 40 ms, CPU slowed 4x, per key. `sls` = script + style + layout. - A second, steadier number, `loop`: the same edit path in a tight loop, CPU not slowed, each key forced through `view.measure()` + style + layout (200 edits per block, median of 4 blocks after 2 warm ones; `loopMin` = fastest block). - 3 arms in ONE process on perf-01 (`~/bin/perf-turn`, one VM, no perf-02 pooling), each with its own server and Home copy from the SAME server binary (built from the base `eb9d0552b`, sha256 dabede64...), each web app built from its own head: `base` = `eb9d0552b`, `old` = `c1600c887` (slice 5 as first reviewed), `new` = `bd7b63a5a` (this fix). 16 rounds, order rotated every round; each round types in the middle card (card 10) and the last card (card 20) of a 21-card note (20 `---`, Narrow, 1440x900, a few one-line cards). Dists compared by tree hash on perf-01 vs dev-01 (identical). - Pairs are per round and position (32 pairs per metric). One standard error (SE) shown; "95% upper" = mean + 2 SE. | metric (ms/key, 4x slow) | base | old c1600c887 vs base | **new bd7b63a5a vs base** | |---|---|---|---| | sls, middle card | 12.041 | -0.19% ±0.49 | **-0.27% ±0.62** | | sls, last card | 11.838 | -0.62% ±0.42 | **-0.84% ±0.68** | | task (all main-thread work), middle | 26.500 | -0.32% ±0.41 | **-0.43% ±0.60** | | task, last | 25.706 | -1.00% ±0.44 | **-0.72% ±0.44** | | loop (unslowed, tight), middle | 4.569 | +0.99% ±0.95 | **-0.50% ±0.56** | | loop, last | 4.525 | +1.15% ±1.18 | **-0.29% ±1.31** | Pooled over both positions (32 pairs): | metric | old vs base | **new vs base** | new pairs below base | new 95% upper bound | |---|---|---|---|---| | sls | -0.40% ±0.32 | **-0.55% ±0.46** (-0.069 ms/key) | 20/32 | +0.36% | | task | -0.66% ±0.30 | **-0.57% ±0.37** (-0.155 ms/key) | 19/32 | +0.16% | | script | -0.47% ±0.41 | -0.49% ±0.54 | 18/32 | +0.58% | | style | -1.40% ±0.67 | -1.84% ±0.73 | 23/32 | -0.39% | | layout | +1.52% ±0.62 | +1.13% ±0.65 (+0.016 ms/key) | 13/32 | +2.42% | | loop | +1.07% ±0.74 | **-0.40% ±0.70** (-0.021 ms/key) | 16/32 | +1.00% | | loopMin | +1.54% ±1.19 | -0.48% ±0.96 | 19/32 | +1.43% | Reading: the first head's cost showed only in the steadier `loop` metric (+1.1% pooled, +1.5% loopMin); the fix removes it (new minus old on `loop`: about -1.5%). On the aggregate metrics the new head is at or below the base in both positions, and no aggregate's 95% upper bound is above +0.4% (loop's is +1.0%, its noisiest). The one component that sits above base is layout (+1.1% ±0.65, i.e. +0.016 ms/key, 1.7 SE): the slice's CSS changes break and card heights, and it is more than paid for by style (-1.8%). I am not claiming a significant improvement, only that nothing above the base is detectable at about ±0.5% resolution; the change is also structurally no more work than base (it removes the per-break `lineAt` the base's `touched()` did on every draw, and the StateField). Dev-01 runs (shared host, per-run noise about 5 to 10%) were too noisy to use and are not part of the result. Raw per-run rows attached (`typing-run1.json`). Not covered: real-Safari frames (the Mac does not render, see #1100).
Author
Owner

Merged by git into port/notes-float at 4f0b583278 (head bd7b63a5a0 is an ancestor); closing. Housekeeping 14 Nov.

Merged by git into `port/notes-float` at 4f0b58327825 (head bd7b63a5a0dc is an ancestor); closing. Housekeeping 14 Nov.
kayg closed this pull request 2026-11-13 19:32:29 +00:00
Some checks failed
CI / server (pull_request) Has been cancelled
CI / rust (pull_request) Has been cancelled
CI / web (pull_request) Has been cancelled
Markdown extraction contract / markdown-native-contract (pull_request) Has been cancelled
Markdown extraction contract / markdown-editor-contract (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
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!1101
No description provided.