Columns (WIP): Luna's wording, AGENTS.md, build notes C1-C9, browser gates COL6 and COL10
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
8 files changed,
+353
−5
AGENTS.md+12 −0copy-review/columns/result.json+89 −0copy-review/columns/strings.json+122 −0docs/superpowers/specs/2026-11-22-mapa-columns-icons.md+12 −0internal/mapa/menus.go+3 −3internal/mapa/share.go+1 −1internal/mapa/templates/frame.html+1 −1internal/mapatest/columns_browser_test.go+113 −0
CI passed — run details
CI log
=== editor ===
cd editor && npm ci --no-audit --no-fund --loglevel=error
added 16 packages in 322ms
cd editor && node build-bundles.mjs
wrote internal/mapa/static/editor.ccaf5b9af3aa1928.js (361810 bytes, 113.7KB gzipped; L12 budget 120KB)
cd editor && node --test
✔ a badge is named for what it does, starting with its visible word (0.978805ms)
✔ first words stop at five words or forty characters (0.193709ms)
✔ the field keeps one trimmed line, without brackets (0.358455ms)
✔ the field holds at most MaxAlt bytes, cut at a character (0.493114ms)
✔ a block becomes column 1 of two, and undo gives it back (12.759338ms)
✔ a selection over blocks moves them all into column 1 (3.083255ms)
✔ no layout is made inside a layout (0.725455ms)
✔ Add a column, Remove this column and Undo columns (4.86647ms)
✔ Undo columns puts the blocks in reading order (0.895851ms)
✔ Backspace in an empty column takes the column away (2.375453ms)
✔ ⌥⌘→ and ⌥⌘← move between columns (0.474409ms)
✔ typing a fence line in a column never closes it (D16) (9.174313ms)
✔ days and weeks move across months and years (1.196988ms)
✔ a month keeps the day, or takes the month's last (1.60844ms)
✔ the grid is six weeks from Monday, as the month calendar draws it (0.381638ms)
✔ the grid starts the week where the locale does (0.289567ms)
✔ the keys move a day, a week, a month and a year (0.173972ms)
✔ the picked day is the chip [[ makes for a date (15.702292ms)
✔ Insert → Today's date still puts today in at once (1.822589ms)
✔ / offers Date, the picker, and Today's date beside it (0.366209ms)
✔ after a ! the chip goes in after a space, never as an embed (3.962384ms)
✔ where the Markdown would read the chip differently, it is refused (5.582226ms)
✔ over a selection the chip goes after it and the words stay (2.933718ms)
✔ today is the day in the viewer's zone (18.888115ms)
✔ every offered locale has cases (1.14935ms)
✔ dates.mjs writes every date Go writes, byte for byte (5.209724ms)
✔ a chip, the month and the week, in three locales (0.591456ms)
✔ dates.json is what ICU gives, byte for byte (558.238477ms)
✔ L1: mounting then serialising gives cleanBody(body), byte for byte (100.719328ms)
ℹ 901 bodies
✔ L1: mounting a stored body adds nothing, and saving it writes nothing new (107.756519ms)
✔ L2: one edited block changes only that block's bytes; undo gives the body back (178.274895ms)
ℹ 888 single-block edits
✔ L2: inserting or deleting a block changes bytes only at the new seams, by Join (167.689696ms)
ℹ 896 inserts, 837 deletes
✔ L3: seeded edits keep the document and its Markdown saying the same thing (5058.729558ms)
ℹ 21624 edits over 901 bodies
✔ L3: Link to a page makes exactly one chip, and changes nothing else (1328.609485ms)
ℹ 4710 links over 901 bodies; refused: {"A page link can’t hold another link or a line break. Select plain words.":945,"A page link can’t show [ or ]]. Select words without them.":404,"Select some words to link them to a page.":174,"Linked here, the Markdown around these words would read differently: a ! before them makes an embed, and a stray ` or * pairs up. Select other words.":18}
✔ L3: a picked date is one more date chip, or refused where a letter would be too (1319.767676ms)
ℹ over 901 bodies: {"inserted":5338,"spaced":23,"refused":45,"unstable":9}
✔ linear: trailing spaces (43.427056ms)
✔ linear: trailing whitespace (31.530967ms)
✔ linear: unclosed web links (25.86683ms)
✔ linear: web links with no address (25.832467ms)
✔ linear: unclosed wiki links (23.271641ms)
✔ linear: unclosed embeds (18.502351ms)
✔ linear: closes only (8.144163ms)
✔ the selected words become the chip's shown text (15.435398ms)
✔ words that are the title make a plain [[Title]] (6.714584ms)
✔ spaces at the selection's edges stay outside the chip (1.457572ms)
✔ a date makes a date link, in a heading, an item and a quote (8.75686ms)
✔ bold words lose their bold: a chip carries no marks in Mapa's Markdown (2.125689ms)
✔ only the linked block's bytes change, and undo gives the body back (3.321646ms)
✔ a selection across blocks, over a chip or a break, or of brackets is refused (1.995319ms)
✔ a target the words cannot be linked to as typed is refused (0.186215ms)
✔ ⌘L: over a selection it opens Page link; with none it types [[; in code it does nothing (4.196187ms)
✔ web-linked words are refused: the address would be lost (review M4) (1.229037ms)
✔ words whose Markdown would read otherwise are refused (review M3) (1.750804ms)
✔ ⌘A then ⌘L says why, instead of doing nothing (review low 1) (0.461625ms)
✔ linkCheck says why it refuses (review low 2) (1.433166ms)
✔ golden file has bodies (0.794562ms)
✔ markup.mjs parses every body into Go's blocks, byte offsets and all (56.009114ms)
✔ markup.mjs strips and spans every block as Go does (77.178668ms)
✔ the schema's toDOM draws every body as Go renders it (75.709005ms)
✔ emphasis draws the four pinned outputs (17.763763ms)
✔ a body ends in the editor's empty paragraph (0.280631ms)
✔ the editor labels date chips as Go does, in every locale L4 holds (12.014226ms)
✔ a POST that never answers is aborted after the timeout (21.999183ms)
✔ a keepalive POST carries no signal, and an answer clears the timer (1.083037ms)
✔ autosave sends only what differs, and the tab owns the draft it wrote (11.262383ms)
✔ an offered draft never commits by itself; Save commits it (1.272208ms)
✔ reload, then close: sessionStorage says the draft is this tab's own (0.553576ms)
✔ closing carries text not yet sent, and the cap leaves it out (34.321951ms)
✔ clean rebase: applied, the caret survives, the base moves by the rebase POST (3.517479ms)
✔ the block under the caret is the teammate's too, and undo brings back yours (2.78967ms)
✔ typing mid-flight: the merge is not applied and the base does not move (1.524957ms)
✔ a merge the editor cannot represent stops after three tries (5.103228ms)
✔ a conflict is shown, locks the editor's own commits, and Resolve settles it (1.670897ms)
✔ leaving: a conflict stays with the choice; a failed flush offers Leave anyway; a stored draft leaves (2.20671ms)
✔ a stale tab shows the newer draft, offered, and never overwrites it (1.44647ms)
✔ the first scratch commit: empty creates nothing, then one page, then drafts on it (0.903555ms)
✔ noBase and gone lead to the existing choices (0.840508ms)
✔ a commit that merged is applied when nothing was typed since (1.094559ms)
✔ back from the cache: nothing unsaved reloads, unsaved text autosaves at once (18.217392ms)
✔ an own draft committed meanwhile goes on as a new draft (1.722152ms)
✔ a reload keeps a stored draft; unsent text still commits (0.613307ms)
✔ a page deleted mid-edit: what is typed is still stored as the draft, and nothing commits (H1) (1.60244ms)
✔ an offered draft committed in another tab: typing goes on as a new draft (H1) (4.524526ms)
✔ a commit reply without a revision is not a commit; an emptied day starts afresh (H2) (2.425175ms)
✔ Resolve stores what was typed first, and takes no typing until its answer is applied (M1) (3.988241ms)
✔ closing with a choice open, or commits held, still writes the text, never commits (M2) (4.335385ms)
✔ closing inside the settling window sends the loaded version with settling=1 (M3) (0.607446ms)
✔ a clean merge not applied because of typing still ends the choice on show (M4) (1.627076ms)
✔ settling finds the draft committed with a teammate's text: a close still writes (M-A) (0.802727ms)
✔ settling finds another tab's newer draft: the tab shows it before any typing (1.142788ms)
✔ a page deleted before the first autosave: the text is offered as a scratch page, and a close makes one (M-B) (0.930143ms)
✔ an autosave that never answered but landed: its 409 keeps the typing since (L3) (1.029187ms)
✔ marks: em outside strong, bold reopened around italics, edges outside (7.398241ms)
✔ marks close before code, links and atoms, and reopen after (0.632281ms)
✔ untouched blocks and atoms re-emit their source; edited atoms are written from attributes (9.038251ms)
✔ empty blocks are written as nothing (3.343576ms)
✔ an unclosed fence that is no longer last gets its closing fence (2.887903ms)
✔ the structure check puts Join's seam where a kept one would merge two blocks (2.428862ms)
✔ prepareSave adopts the parse when no seam or rewrite can save the document (2.855622ms)
✔ reparse: typed emphasis becomes a mark, "- " after a break becomes an item (6.972331ms)
✔ a trailing hard break stays on screen and is written as nothing (0.921999ms)
✔ the reparse waits while an IME is composing (1.043985ms)
✔ copied blocks paste with their bytes and seams; a cut and paste gives the body back (3.755732ms)
✔ a forged x-mapa slice is refused, and text from outside is read as Markdown (0.756622ms)
✔ rebuild changes origins only, outside undo history (1.8721ms)
✔ applyBody takes a teammate's block, keeps the caret, and ends untouched (2.506364ms)
✔ a block whose context changed is written again: a task toggled, a bullet, a quote (2.053415ms)
✔ a duplicate ^id typed above its holder never takes the id from it (0.898515ms)
✔ a copy-dragged block is reparsed, and says what its Markdown says (1.277217ms)
✔ a history command that throws is refused, never thrown (5.425015ms)
✔ an image re-emits its source, and an edited alt changes only its span (1.982645ms)
✔ a paste whose image copy is refused says why and pastes nothing (15.516908ms)
✔ a line of image openers reads in linear time (146.517026ms)
✔ a line of shared link address reads in linear time (14.937184ms)
✔ a line of shared web address reads in linear time (54.120755ms)
✔ one rename at a time, from either field (2.321472ms)
✔ an empty or unchanged title sends nothing (0.238662ms)
✔ a refusal keeps what was typed, and the title (3.272325ms)
✔ the pending state holds for the busy rule (8.379801ms)
✔ a failed POST says so and keeps the title (1.37073ms)
✔ Update links posts the confirm page's POST (0.27479ms)
✔ clean is CleanTitle's whitespace rule (0.347414ms)
✔ the saver's base follows a rename made over it, and only that (0.343517ms)
✔ closing sends the rename as one keepalive POST (2.227858ms)
✔ the port answers every shared case as typeddate.go does (10.07948ms)
✔ numbers follow the locale: 12/11 is November in en-IE, December in en-US (0.26461ms)
✔ M6: several files land in the order they were chosen (52.632377ms)
✔ M5: one Backspace before the box keeps the image where the box is (11.960427ms)
✔ M5: undoing text typed just before the box keeps the upload (11.653228ms)
✔ L12: a failed upload an undo takes away does not stall the next (15.642891ms)
✔ M4: Replace… keeps the old image until the new one is in, and its alt (14.119007ms)
✔ M3 and N1: text wins, except over a picture copied from a page (1.911522ms)
✔ N2: a JPEG over 10 MB is scaled before its size is checked (6.027893ms)
✔ a drag whose anchor the document no longer reaches selects to its end (6.017161ms)
ℹ tests 134
ℹ suites 0
ℹ pass 134
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 8420.545836
=== vet ===
go vet ./...
go vet -tags browser ./internal/mapatest/
=== fmt ===
=== code ===
go tool rastrillo budget code
The base has no .rastrillo/code.txt: skipping the check that records only go down.
budget code: within the limits.
=== test ===
CGO_ENABLED=0 go test ./...
? amadan.net/oficina/mapa/cmd/mapa [no test files]
ok amadan.net/oficina/mapa/internal/mapa 3.334s
ok amadan.net/oficina/mapa/internal/mapa/emoji (cached)
? amadan.net/oficina/mapa/internal/mapa/icons [no test files]
ok amadan.net/oficina/mapa/internal/mapa/imagefile (cached)
ok amadan.net/oficina/mapa/internal/mapa/locale (cached)
ok amadan.net/oficina/mapa/internal/mapa/markup 0.120s
ok amadan.net/oficina/mapa/internal/mapa/notionmd (cached)
ok amadan.net/oficina/mapa/internal/mapa/seal (cached)
ok amadan.net/oficina/mapa/internal/mapatest 13.375s
? amadan.net/oficina/mapa/scripts/mutate [no test files]
? amadan.net/oficina/mapa/scripts/preview [no test files]
=== migration-check ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
=== credits-check ===
python3 scripts/credits.py --check
credits: checked
diff --git a/AGENTS.md b/AGENTS.md| index cfafc35..129063f 100644 |
| --- a/AGENTS.md |
| +++ b/AGENTS.md |
| @@ -154,6 +154,18 @@ Makefile, estilo's files served straight from the module). |
| uploads and Reposition). A record's references are its body's and |
| its look's images (`Record.images`); chips draw icons from their |
| resolution (`markup.ChipIcon`), never from a node attribute. |
| + - Column layouts (the same spec, §1, phase 2): `markup/columns.go` (the |
| + strict grammar of §1.1, fences as blocks with `Block.Column`, |
| + `FenceLike`, `Grammar`, `renderLayout`) and `markup/merge_columns.go` |
| + (`ValidLayouts`, the merge's layout rules, `alignKeys`, |
| + `addedColumns`, `WholeOrInside`); `grammar.go` (`countedHere`, the |
| + 409 for a post counted by another grammar); `versions_columns.go` |
| + (History's words). In `editor/`: `columns.mjs` (the commands), |
| + `markup.mjs`'s port of the grammar, the schema's `columns` and |
| + `column` nodes, fence pseudo-blocks in `serialize.mjs` (their |
| + origins on the containers: `originAttr`), and `fidelity.mjs`'s |
| + `fenceRule` (D16). `make pandoc-fixture` records Pandoc's reading |
| + (`markup/testdata/pandoc.json`, COL12). |
| - `internal/mapatest/` — the gates of spec §11, from the outside. |
| `browser_test.go` is behind the `browser` tag. |
| - `scripts/preview/`, `scripts/mutate/` — `make preview`, `make mutate`. |
diff --git a/copy-review/columns/result.json b/copy-review/columns/result.json| new file mode 100644 |
| index 0000000..6b5c6e9 |
| --- /dev/null |
| +++ b/copy-review/columns/result.json |
| @@ -0,0 +1,89 @@ |
| +{ |
| + "action": "approve", |
| + "guidance": null, |
| + "note": "Reviewed 2026-11-22 by Luna (gpt-5.6-luna through Codex). Luna's edits are applied, except where listed under not_applied.", |
| + "not_applied": [ |
| + { |
| + "id": "columns.slash.hint", |
| + "luna": "2, 3 or 4 columns", |
| + "why": "The / menu's Columns item makes two columns; the Insert menu offers 2, 3 and 4. The hint says what this item does." |
| + } |
| + ], |
| + "strings": [ |
| + { |
| + "id": "columns.insert.two", |
| + "text": "2 columns", |
| + "was": "Two columns" |
| + }, |
| + { |
| + "id": "columns.insert.three", |
| + "text": "3 columns", |
| + "was": "Three columns" |
| + }, |
| + { |
| + "id": "columns.insert.four", |
| + "text": "4 columns", |
| + "was": "Four columns" |
| + }, |
| + { |
| + "id": "columns.insert.add", |
| + "text": "Add a column", |
| + "was": null |
| + }, |
| + { |
| + "id": "columns.insert.remove", |
| + "text": "Remove this column", |
| + "was": null |
| + }, |
| + { |
| + "id": "columns.insert.undo", |
| + "text": "Undo columns", |
| + "was": null |
| + }, |
| + { |
| + "id": "columns.slash.name", |
| + "text": "Columns", |
| + "was": null |
| + }, |
| + { |
| + "id": "columns.slash.hint", |
| + "text": "two side by side", |
| + "was": null |
| + }, |
| + { |
| + "id": "columns.keys", |
| + "text": "Move to the next or previous column", |
| + "was": "In columns, the next or previous column" |
| + }, |
| + { |
| + "id": "columns.refusal.cut", |
| + "text": "Select whole columns or blocks inside one column.", |
| + "was": "Choose whole columns, or blocks inside one column." |
| + }, |
| + { |
| + "id": "columns.refusal.grammar", |
| + "text": "Mapa has been updated. Reload the page to keep editing.", |
| + "was": null |
| + }, |
| + { |
| + "id": "columns.history.added", |
| + "text": "Added columns", |
| + "was": null |
| + }, |
| + { |
| + "id": "columns.history.removed", |
| + "text": "Removed columns", |
| + "was": null |
| + }, |
| + { |
| + "id": "columns.history.added_one", |
| + "text": "Added a column", |
| + "was": null |
| + }, |
| + { |
| + "id": "columns.history.removed_one", |
| + "text": "Removed a column", |
| + "was": null |
| + } |
| + ] |
| +} |
| \ No newline at end of file |
diff --git a/copy-review/columns/strings.json b/copy-review/columns/strings.json| new file mode 100644 |
| index 0000000..ead9c75 |
| --- /dev/null |
| +++ b/copy-review/columns/strings.json |
| @@ -0,0 +1,122 @@ |
| +[ |
| + { |
| + "id": "columns.insert.two", |
| + "section": "Insert menu", |
| + "label": "columns.insert.two", |
| + "text": "Two columns", |
| + "context": "Insert menu item in the page editor. Puts the block the caret is in (or the selected blocks) into the left of two side-by-side columns; the right one starts empty with the caret in it.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.insert.three", |
| + "section": "Insert menu", |
| + "label": "columns.insert.three", |
| + "text": "Three columns", |
| + "context": "As above, three columns.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.insert.four", |
| + "section": "Insert menu", |
| + "label": "columns.insert.four", |
| + "text": "Four columns", |
| + "context": "As above, four columns (the most a layout holds).", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.insert.add", |
| + "section": "Insert menu", |
| + "label": "columns.insert.add", |
| + "text": "Add a column", |
| + "context": "With the caret in a layout: adds an empty column after the caret's. Does nothing outside a layout.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.insert.remove", |
| + "section": "Insert menu", |
| + "label": "columns.insert.remove", |
| + "text": "Remove this column", |
| + "context": "With the caret in a layout: takes the caret's column out, moving its text into the column beside it (never deleting text). From two columns it puts everything back as ordinary blocks.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.insert.undo", |
| + "section": "Insert menu", |
| + "label": "columns.insert.undo", |
| + "text": "Undo columns", |
| + "context": "With the caret in a layout: puts every column's blocks back one after another as ordinary blocks, in reading order.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.slash.name", |
| + "section": "Slash menu", |
| + "label": "columns.slash.name", |
| + "text": "Columns", |
| + "context": "Item in the / menu.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.slash.hint", |
| + "section": "Slash menu", |
| + "label": "columns.slash.hint", |
| + "text": "two side by side", |
| + "context": "The muted hint beside it, as other items show their Markdown (e.g. '---').", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.keys", |
| + "section": "Keyboard shortcuts", |
| + "label": "columns.keys", |
| + "text": "In columns, the next or previous column", |
| + "context": "Help → Keyboard shortcuts, beside ⌥⌘→ ⌥⌘←.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.refusal.cut", |
| + "section": "Refusals", |
| + "label": "columns.refusal.cut", |
| + "text": "Choose whole columns, or blocks inside one column.", |
| + "context": "Make team page: shown when the chosen blocks would cut a column layout in two.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.refusal.grammar", |
| + "section": "Refusals", |
| + "label": "columns.refusal.grammar", |
| + "text": "Mapa has been updated. Reload the page to keep editing.", |
| + "context": "Shown by an editor tab opened before an update, when it tries Make team page, Link to this block, Link it or a conflict choice. Nothing is lost: the person's unsaved text stays as their draft.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.history.added", |
| + "section": "History", |
| + "label": "columns.history.added", |
| + "text": "Added columns", |
| + "context": "One-line summary of a version that added a column layout.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.history.removed", |
| + "section": "History", |
| + "label": "columns.history.removed", |
| + "text": "Removed columns", |
| + "context": "A version that took a layout away, keeping its blocks.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.history.added_one", |
| + "section": "History", |
| + "label": "columns.history.added_one", |
| + "text": "Added a column", |
| + "context": "A version that added a column to a layout.", |
| + "notes": "" |
| + }, |
| + { |
| + "id": "columns.history.removed_one", |
| + "section": "History", |
| + "label": "columns.history.removed_one", |
| + "text": "Removed a column", |
| + "context": "A version that took a column out.", |
| + "notes": "" |
| + } |
| +] |
| \ No newline at end of file |
diff --git a/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md b/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md| index 3d8cba2..8ca1476 100644 |
| --- a/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md |
| +++ b/docs/superpowers/specs/2026-11-22-mapa-columns-icons.md |
| @@ -758,3 +758,15 @@ Fable found every round-1 finding answered in substance, and five mediums and si |
| - **B11, Fable on the build.** Round 1 (`2f10e0e`): CHANGES REQUIRED, no high, five mediums: ⌘K drew no icons; an icon post naming no picture stored an empty icon; Reposition recentred a banner at the top, and a position post choosing none moved it to the centre; dragging was broken with a mouse and stuck on touch; History drew a broken image for an old icon gone from Mapa. All five are fixed with gates (`7643c98`), with the lows that matter: the busy rule on the look's controls, Reposition a real button with Esc to cancel, a refused script upload dropped only when it is the person's own pending picture, the emoji field trimmed, the live region served by the page. Round 2 (`7643c98`): APPROVE, with one medium-to-low (Reposition armed only by a keyup), fixed in `3c5f177` by arming after 400 ms too. Left as they are, with Fable's agreement: the picker's ↑ ↓ across uneven group rows, and LOOK12's 200-icon timing, replaced by `TestSmallPicturesAreServedFromTheCache` and the cache's scope gate. |
| - **B12, the gates at landing.** `make ci` green; `make browser` green but for one known flake (a test's temporary directory still holding SQLite's WAL at cleanup, which passes on rerun); `make mutate`: all 141 mutations caught; hub CI green. |
| +### Phase 2: columns (`feat/columns`) |
| + |
| +- **C1, fences are pseudo-blocks in the editor.** `serialize.mjs`'s `docBlocks` lists a layout's four kinds of fence line as blocks whose origins live on the `columns` and `column` nodes (`openOrigin`, `closeOrigin`), read through `originAttr` and `originOf`. An untouched fence re-emits its source; one written from its node is a layout's own colons (four or more) or, for a column, three, which is always fewer than its layout's, so a new column never fails to close. That is simpler than §1.1's "copies the column before it", and every layout it writes is one Mapa and Pandoc read. |
| +- **C2, recorded nodes by origin.** An empty column holds a paragraph to type in that is no block of the body, so `recordBody` matches nodes to blocks by origin, not by place, and `bodyShapes` leaves that paragraph out. |
| +- **C3, the neutraliser is `fenceRule`.** Rather than §1.7's four rules separately, one rule runs in the settle plugin: when the body the document writes would read fences the document does not hold (or miss one it does), every fence-like line of text, code excepted, takes U+200B before its first `:`. It covers typing a fence, a block moved into a column holding one, and an edit elsewhere that would complete a layout from lines of text (the corpus's `columns/fence-like`). It runs only when needed, so a stored body with such a line read as text is untouched on mount (L1). Code in a column is always written closed because it is never last: the column's closer follows it. L2's locality allows the one case where the rule rewrites other blocks. |
| +- **C4, the merge.** Fence alignment keys on the block beside each fence (`alignKeys`), and a stretch where one side only added whole columns at its edge is split (`addedColumns`), so a column added beside a teammate's edit merges cleanly. When any side holds a fence and a conflict holds one, or the result would not keep its layouts (`layoutsHold`: opaque conflicts placed as §1.8 says, the parse agreeing taken mine and theirs), the whole merge runs again with layouts as units. `TestEveryMergeOfLayoutEditsHoldsValidLayouts` merges every pair of twelve edits and settles every conflict every way; its check is that no fence-like line is ever left as text, which a broken layout parses as. Both COL4 mutations are caught by it. |
| +- **C5, History's diff draws layouts flat.** The summaries are §1.9's. The diff view draws runs of blocks, and a fence drawn apart from its layout draws nothing, so a changed page with columns shows its blocks marked, one after another, not in columns. Drawing the diff in its layout is left for later. |
| +- **C6, menus.** Insert gains 2, 3 and 4 columns, Add a column, Remove this column and Undo columns, always drawn in the page editor; outside a layout the last three do nothing. The / menu's Columns makes two. The labels' digits are written as they are: every offered locale writes 2 to 4 as ASCII digits. |
| +- **C7, the grammar version.** `countedHere` wraps the four routes of §1.10's table. The scriptless forms carry `grammar`, as do the editor's Make team page and Resolve posts; the old bundle's error path shows the sentence. The tests' harness adds the field where the app's own forms would. |
| +- **C8, the importer.** `notionmd` writes two to four columns as a layout, flattens one, five or more, and a list inside a column at any depth (counted, but one column is no loss), and neutralises fence-like text lines. Column widths are not read: the notion module does not yet expose `width_ratio` (§6.5), which phase 4 adds. |
| +- **C9, COL12.** Pandoc 3.14 reads every layout Mapa recognises, and Join's output for each, as Mapa does; the negatives are recorded. Fence-like text Mapa writes as text (no escapes) is divs to Pandoc; that is outside the promise. |
| + |
diff --git a/internal/mapa/menus.go b/internal/mapa/menus.go| index d74fce4..0a1591e 100644 |
| --- a/internal/mapa/menus.go |
| +++ b/internal/mapa/menus.go |
| @@ -225,9 +225,9 @@ func pinEntry(page *PageView, pinned bool) menuEntry { |
| // layout those three do nothing. |
| func columnEntries() []menuEntry { |
| return []menuEntry{divider, |
| - command("Two columns", "insert-columns-2", ""), |
| - command("Three columns", "insert-columns-3", ""), |
| - command("Four columns", "insert-columns-4", ""), |
| + command("2 columns", "insert-columns-2", ""), |
| + command("3 columns", "insert-columns-3", ""), |
| + command("4 columns", "insert-columns-4", ""), |
| command("Add a column", "add-column", ""), |
| command("Remove this column", "remove-column", ""), |
| command("Undo columns", "undo-columns", "")} |
diff --git a/internal/mapa/share.go b/internal/mapa/share.go| index 37f304a..b519556 100644 |
| --- a/internal/mapa/share.go |
| +++ b/internal/mapa/share.go |
| @@ -14,7 +14,7 @@ var ErrNothingChosen = errors.New("Choose at least one block to share.") |
| // ErrCutsLayout is a choice that would cut a column layout: blocks must |
| // be whole layouts or lie inside one column (columns and icons §1.10). |
| -var ErrCutsLayout = errors.New("Choose whole columns, or blocks inside " + |
| +var ErrCutsLayout = errors.New("Select whole columns or blocks inside " + |
| "one column.") |
| // ErrNoteChanged is "Make team page" over a revision that is no longer |
diff --git a/internal/mapa/templates/frame.html b/internal/mapa/templates/frame.html| index fac0377..48f378a 100644 |
| --- a/internal/mapa/templates/frame.html |
| +++ b/internal/mapa/templates/frame.html |
| @@ -211,7 +211,7 @@ |
| <dt><kbd mapa-kbd>⌥F10</kbd></dt><dd>Move to the selection's toolbar, Make team page included</dd> |
| <dt><kbd mapa-kbd>Tab</kbd> <kbd mapa-kbd>⇧Tab</kbd></dt><dd>In a list, indent or outdent the item</dd> |
| <dt><kbd mapa-kbd>Esc</kbd>, then <kbd mapa-kbd>Tab</kbd></dt><dd>Leave the page's text, even inside a list</dd> |
| - <dt><kbd mapa-kbd>⌥⌘→</kbd> <kbd mapa-kbd>⌥⌘←</kbd></dt><dd>In columns, the next or previous column</dd> |
| + <dt><kbd mapa-kbd>⌥⌘→</kbd> <kbd mapa-kbd>⌥⌘←</kbd></dt><dd>Move to the next or previous column</dd> |
| <dt><kbd mapa-kbd>⌘Z</kbd> <kbd mapa-kbd>⇧⌘Z</kbd></dt><dd>Undo, redo</dd> |
| <dt><kbd mapa-kbd>Esc</kbd></dt><dd>Close a menu, a list or this dialog</dd> |
| </dl> |
diff --git a/internal/mapatest/columns_browser_test.go b/internal/mapatest/columns_browser_test.go| new file mode 100644 |
| index 0000000..1340391 |
| --- /dev/null |
| +++ b/internal/mapatest/columns_browser_test.go |
| @@ -0,0 +1,113 @@ |
| +//go:build browser |
| + |
| +package mapatest |
| + |
| +import ( |
| + "context" |
| + "runtime" |
| + "testing" |
| + |
| + "github.com/chromedp/chromedp" |
| + "github.com/chromedp/chromedp/kb" |
| + |
| + "amadan.net/oficina/mapa/internal/mapa" |
| +) |
| + |
| +// Column layouts in a real Chromium (columns and icons spec §9): COL6, |
| +// no shift with layouts of two and four columns, at three widths, light |
| +// and dark, with and without a draft, and stacking by the page column's |
| +// width; COL10, the keyboard: Insert → Two columns, ⌥⌘→ and Undo |
| +// columns, with axe. |
| + |
| +const layoutBody = "# Plan\n\n:::: columns\n\n::: column\nLeft, with " + |
| + "[[Pilot]].\n\n- one\n- two\n\n:::\n\n::: column\nRight.\n\n:::\n\n" + |
| + "::::\n\n:::: columns\n\n::: column\nA\n\n:::\n\n::: column\nB\n\n" + |
| + ":::\n\n::: column\nC\n\n:::\n\n::: column\n:::\n\n::::\n\nAfter." |
| + |
| +func TestCOL6LayoutsMountWithoutAShift(t *testing.T) { |
| + rig, store := browserRig(t, 0) |
| + ctx := context.Background() |
| + page, err := store.CreateTeamPage(ctx, Bo, "Pilot", layoutBody) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + viewer, _ := store.Viewer(ctx, Ana, nil) |
| + drive(t, rig, onNewDocument(shiftRecorder)) |
| + for _, draft := range []bool{false, true} { |
| + if draft { |
| + write := mapa.DraftWrite{Base: page.Revision, |
| + Body: layoutBody + "\n\nMine."} |
| + if _, err := store.Autosave(ctx, viewer, |
| + mapa.DraftKey{PageID: page.ID}, write); err != nil { |
| + t.Fatal(err) |
| + } |
| + } |
| + for _, dark := range []bool{false, true} { |
| + for _, width := range []int64{1440, 1000, 390} { |
| + noShift(t, rig, mapa.PagePath(page), width, dark, draft) |
| + } |
| + } |
| + } |
| +} |
| + |
| +// columnsSideBySide is whether the first layout's columns share a row. |
| +const columnsSideBySide = `(function () { |
| + var columns = document.querySelectorAll("[mapa-columns] > [mapa-column]"); |
| + return columns[0].getBoundingClientRect().top === |
| + columns[1].getBoundingClientRect().top; |
| +})()` |
| + |
| +func TestCOL6ColumnsStackByThePageColumnsWidth(t *testing.T) { |
| + rig, store := browserRig(t, 0) |
| + page, err := store.CreateTeamPage(context.Background(), Bo, "Pilot", |
| + layoutBody) |
| + if err != nil { |
| + t.Fatal(err) |
| + } |
| + for width, side := range map[int64]bool{1440: true, 390: false} { |
| + drive(t, rig, chromedp.EmulateViewport(width, 900), |
| + chromedp.Navigate(rig.Origin+mapa.PagePath(page)), |
| + chromedp.WaitVisible("[mapa-columns]")) |
| + if got := read(t, rig, chromedp.Evaluate[bool]( |
| + columnsSideBySide)); got != side { |
| + t.Errorf("%dpx: side by side is %v", width, got) |
| + } |
| + } |
| +} |
| + |
| +func TestCOL10ColumnsByKeyboard(t *testing.T) { |
| + rig, store := browserRig(t, 0) |
| + titledPage(t, rig, store, "Columns", "Make me columns.") |
| + drive(t, rig, chromedp.Click("article[mapa-body] p"), |
| + chromedp.Evaluate[chromedp.Void](`document.querySelector( |
| + '[data-mapa-command="insert-columns-2"]').click()`), |
| + chromedp.WaitVisible("[mapa-columns] [mapa-column]")) |
| + if found := axeSerious(t, rig); found != "" { |
| + t.Fatalf("axe, a page with columns:\n%s", found) |
| + } |
| + drive(t, rig, chromedp.KeyEvent("Right."), |
| + chromedp.KeyEvent(kb.ArrowLeft, modAlt())) |
| + at := evaluate(t, rig, `(function () { |
| + var column = getSelection().anchorNode.parentElement.closest("[mapa-column]"); |
| + return String([].indexOf.call(column.parentElement.children, column)); |
| +})()`) |
| + if at != "0" { |
| + t.Fatalf("⌥⌘← left the caret in column %s", at) |
| + } |
| + drive(t, rig, chromedp.Evaluate[chromedp.Void](`document.querySelector( |
| + '[data-mapa-command="undo-columns"]').click()`)) |
| + eventually(t, "the layout undone", func() bool { |
| + return evaluate(t, rig, |
| + `String(document.querySelectorAll("[mapa-columns]").length)`) == "0" |
| + }) |
| +} |
| + |
| +// modAlt is ⌥⌘ on a Mac, Ctrl+Alt elsewhere. |
| +func modAlt() chromedp.KeyOption { |
| + if runtime.GOOS == "darwin" { |
| + return chromedp.KeyModifiers(chromedp.ModifierMeta | |
| + chromedp.ModifierAlt) |
| + } |
| + return chromedp.KeyModifiers(chromedp.ModifierCtrl | |
| + chromedp.ModifierAlt) |
| +} |