notes
All repositories: gitoria
5.8 KB
# Report 010 — notes on the Hybriel MdEditor block (worker W2) — branch w10-mdeditor-theme, NOT pushed, NOT deployed## What changed- `components/md-editor/` (md-editor.hl, README.md) + `components/SOURCE` = components.hybriel **1442e58**, byte-verbatim, by the new`tools/sync-components.sh` (modelled on tickets'; `--check` = "verbatim: 2 files").- `components/notes.hl`: `noteText { id = "notetext" on input(e) { emit typed(e) } MdEditor { name = "text" value = shownText rows = 16 files = "off" placeholder = "" } }`.`typed` ignores events whose `e.target.name != 'text'` (the block's link / file inputs also fire `input`). Everything else (autosave tick,offline queue, conflict copies) untouched. `value = shownText` stays bound: no focus loss, the winner of a conflict shows in the editor.- Removed: `<script src="/md-editor.js">` (main.hl), the `/md-editor.js` route and `offlineFiles = ["/md-editor.js"]` (project.hl),`shared/md-editor.js` (2529 lines), `md-editor::part(button)` and the `mdEditor { --md-* }` rule (styles.hl; the block reads the `--color-*`tokens notes already declares). README / CONCEPT updated.- styles.hl: `.empty` → `p.empty` (the class collision of tickets 021; all 3 uses are `<p class="empty">`); `noteEditor` got`gridTemplateColumns: minmax(0, 1fr)` and `noteText { display: block; min-width: 0 }` — found by the gate: without them the 690 px wide tablewidened the grid and the editor was 690 px on a 390 px phone (tickets 021 fix 4 only covers the toolbar).- No theme move; look otherwise the block's own (18 rem min-height → rows = 16 ≈ 24 em; files off, so no File button).## Parity (each checked in tests/browser.mjs, real keys)tables (typed header + delimiter → table, Tab, Enter, bold/code cells, `\|`, alignment, wide table scrolls in its box at 390, a cell edit changes onlythat cell, byte-for-byte Markdown, reopened from server and offline), heading `# `, bold (Ctrl+B in the E2E), lists, autosave (sidebar subject,server save, conflicts, delete, offline queue). Not re-implemented: `MdEditor.markdown` test API of the old script — two table checks now readthe Markdown lines instead. Not tested by hand: links (Ctrl+K), code block keys (the block's own gate covers them; notes only stores the text).## Proof- `tests/browser.mjs`: old (efa9217) **64/0** → new **66/0**. +2 checks: "no md-editor.js on the page / `/md-editor.js` 404 / no `md-editor` customelement" and "phone 390: editor fits, every toolbar button ≥ 44 px, text ≥ 16 px, no File button". The new tests on the OLD code: 16 passed, **3 failed**(both "no md-editor.js" checks + crash at the editor: no block surface), run with NOTES_GATE_SOFT=1. Test-side changes: shadow-DOM helpers → lightDOM (`#notetext input[name=text]`, `md-editor article`); `editorReady` waits for the surface's children (the block builds them from a 100 msanimation after the page is live); table cell html may carry the block's zero-width space. One earlier run failed once (delete, "one note less") andonce with the caret at the start (a click before the surface was built) — the second was the missing wait, fixed; the first did not reproduce (load).- `tests/realdata-offline.mjs` on the newest backup (notes.worldapi.org-20261020-2229.tgz, 28 notes): **12/0**, 390 px: no overflow, taps ≥ 44. Changes tothe test: block selectors; the toolbar's three scrolled-off buttons are not "wide" (the phone toolbar is one row that scrolls inside its own box, by design).- `tests/e2e-roundtrip.mjs` (new), copy of the same backup, real headless Chrome, all 28 notes: **OPEN** reads all 28 back byte-identical; edit nextto the table (click first paragraph, End, `x`, Backspace) on the one table note in the backup: editor and server text **byte-identical**; the other 27also identical after the edit (0 canonicalised) — **5 passed / 0 failed**. (Only 1 note of the 28 has a table; the check would fail on any difference, I did not mutate it.)- E2E in lisbeth's Chrome: tests/e2e-chrome.mjs, own tunnel `-L 8757:127.0.0.1:9223` and `-R 8758/8759`, ONE existing about:blank tab (put back toabout:blank), no clipboard, copy of the backup, real mouse + key events, at 390 and 1280: list, New note, `# heading`, bold, table, list, wait for theserver save, **reload (same text)**, **offline** (Network.emulateNetworkConditions on page and worker): the note and list open offline, typing works,back online the edit reaches the server, no sideways scroll. **new 24/0, old (live code) 24/0.**- **Finding (block):** in a background tab the block never builds its surface (its mount is a CSS animation; Chrome does not run it): the first runhung on an empty editor until `Page.bringToFront`. Not a bug for users with the tab in front; worth a line in components README.- **Observation, not isolated:** typing a table right after a list (list, Enter Enter, `| Item | Qty |`, Enter, `|:---|---:|`, Enter) stayed plainparagraphs once, in the E2E; table first then list works. No minimal repro made (out of this mission's budget); Atlas may pass it to components.## Shots (20 PNG, not viewable by me — I cannot look at PNGs; the numbers above count)/media/STORAGE/claude-scratch/atlas/W2/shots/{old,new}-{390,1280}-{1-list,2-typed,3-reloaded,4-offline,5-end}.png (20 files).## What changes in layouts docs/usage.md (Atlas)notes moves from "own copy md-editor.js (fork, listed in tools/usage.sh FORKS)" to a user of the MdEditor block: add `components/md-editor/` + SOURCEof notes to the usage table (tools/sync-components.sh, 1442e58) and drop notes' md-editor.js from the retire list / FORKS; notes' theme step stays open;notes keeps `p.empty`, files="off".## CleanupServers, tunnel and Chromes killed by PID; `ss`: nothing of mine on 8732–8759 (the two `hybriel` processes in `pgrep` belong to arachne). Data copies deleted.Scratch: old/ (live code archive), wt/ (branch), logs *.log, pids/.
Branches
Latest commits
- edeab20fnotes mission 015: mission, report, LOG, STATUSmre
- 542a0383notes mission 015: e2e-chrome E2E_HOST (own cookie jar in the shared Chrome)mre
- 8b30f510notes mission 015: main-menu from layouts 0bcc629, current = true kept (route marks only /), server-HTML marker checksmre
- 84b574c4notes mission 015: re-vendor plugins from hybriel f9614007 (incl. web, #117)mre
- 447da53dnotes mission 014: report — remaining gates and lisbeth E2E proofmre
- fd9f92c3notes mission 014: report (partial), LOG, STATUSmre
- b2501360notes mission 014: open() sets asking=false before flush(0) (hybriel#196)mre
- 9414ce59notes mission 014: merge theme 76f99f6, components 3794c59, strict single-press openAsk (fails on old open())mre
- c08c655anotes 013: theme re-copied from layouts 76f99f6 (menu marks the current page), current = true on the menu item, e2e marker checks, reportmre
- 21c8f65dnotes mission 012: STATUSmre
- 0bbb3dd9notes mission 012: delete section of the browser gate de-flaked (openAsk: calm wait, press again when the question closes by itself); report 012mre
- f431bdf8notes mission 011: notes on the layouts theme (ListFirst shell), styles cut, check-theme gate, E2E extended; reportmre
- 1a8603d1notes mission 011 WIP: deploy.sh gate summary also matches check-theme, browser.mjs logout via the user menumre
- dae2e508notes mission 011 WIP: theme dbe3de7, shell on AppHeader/MainMenu/UserMenu/Sidebar + ListFirst, styles cut to the app's own, check-theme gate, e2e auditmre
- fd36da27notes mission 010: the note editor is the Hybriel MdEditor block (components.hybriel 1442e58, verbatim); md-editor.js, its route, script tag and offlineFiles retired; gate 66/0, realdata-offline 12/0, round-trip and Chrome E2E tests; report 010mre
- efa92170notes tests/identkit.mjs: refuse a taken ident port, cold-wait deadline, emit, identities; mission 009 reportmre
- f3dec0f1Merge branch 'w7'mre
- d1cf966dre-vendor hybriel 97bcf128: offlineFiles for the editor script, 44 px taps, 390 px offline checks, mission 008mre
- 4a610a21paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
- eeaea980report 007: say which runs included the removed checkmre