components
All repositories: gitoria
8.9 KB
# Report 006 — comments block (layouts#2), first user tickets (worker w6, 2026-10-19)**Result: done, not deployed, not pushed.** Branch `w6`: 850a376 (MdEditor readonly), fd57c18 (comments block + demo + gate),9ec7273 (text via MdEditor directly, "edited elsewhere" check, theme radii), + docs commit. Hybriel: the vendored a832f73b bin, unchanged.## What the component does`components/comments/comments.hl` (+ `README.md`, demo `demo.hl` at `/comments`), pure Hybriel, own `Style`, base look (black/white/greys,semantic tokens with fallbacks), no app data. Shape of hybriel's demo-social-network: **"1 comment" / "n comments"** (0 → "0 comments" +"No comments yet."), then per comment an **avatar** (initial on a grey disc), a **bubble** with **name**, **time**, **"edited"** (a`<details>`: "Edited once" / "Edited n times" and the earlier versions, oldest first, as Markdown source) and the **text as formattedMarkdown**; under it a **like** (`♡ n` / `♥ n`, `aria-pressed`) and, for the author, **Edit** (the MdEditor opens with the text, Save /Cancel) and **Delete** ("Delete this comment?" Delete / Keep). **The form below** is the MdEditor (Comment button or Ctrl+Enter; emptysends nothing; an empty editor after a post). With no `user`: no form (optional `signInText` instead), no Edit / Delete, the like does nothing.## Interface`Comments { comments = list user = me onPost = posted onEdit = edited onDelete = deleted onLike = liked }`- **In**: `comments` = `[{ id, author, when, text (Markdown), likes, liked, history: [{ when, text }] }]` (oldest first); `user` = thecurrent user's name ('' = nobody). Edit / Delete show where `author == user`. Texts: `oneLabel`, `manyLabel`, `emptyText`,`placeholder`, `postLabel`, `editLabel`, `deleteLabel`, `saveLabel`, `cancelLabel`, `askText`, `keepLabel`, `editedLabel`, `likeLabel`,`signInText`.- **Out** (functions the host hands, hybriel#87, like Pagination's `onPage`): `onPost(text)` (answer `false` to keep the text in theeditor), `onEdit(id, text)` (only a changed, non-empty text), `onDelete(id)` (after the confirm), `onLike(id)` (host flips `liked` + count).The host stores and hands a new list back; the block shows what it is given.- Text rendering = **MdEditor `readonly = "true"`** (new, 850a376: no toolbar / link form / files / placeholder / source view, article`contenteditable=false`, `tabindex=-1`, `role=document`, no field background or ring; mount only loads). Same subset as typed.A vendoring app copies `components/comments/` **and** `components/md-editor/` (≥ 850a376).- Found and used: hl:web builds a composed child anew when a bound value changes (probe: a new `<md-editor>` element after the host changedthe text; untouched rows keep theirs), so an edited / pushed text redraws; rows are keyed by `id`.## Tests (ports 8740–8759)- Gate **before 290/0** (old code, `COMPONENTS_GATE_PORT=8740 COMPONENTS_GATE_CHROME=8741-8749`), **after 324/0**(`.scratch/w6/gate-new5.txt`; +34 comments checks; base look now covers 11 public files / 10 demos, home 10 entries).- The 34 checks, real CDP mouse presses and key events only: SSR counter + rows; Markdown drawn (exact HTML); readonly not editable / notoolbar; avatar / name / time; typing `Hello **world** and `code` here` formats while typing; Comment posts (host told, last row, author,formatted, "4 comments", editor empty); Ctrl+Enter posts; empty sends nothing; like ♡ 2 → ♥ 3 (pressed, told) → ♡ 2; a text the hostchanges from outside ("bob edits his comment elsewhere", = a push) redraws, "Edited 3 times"; Edit opens the editor with the text, typedkeys + Save → told "edit c3", new text drawn, "edited" opens "Edited once" + the old text; history oldest first; Cancel keeps all; Edit /Delete only for alice's comments as alice, only bob's as bob, none as nobody (no form, sign-in text, like inert); Delete asks, Keepkeeps, Delete removes (told, the next row keeps its own text); "4 comments" → "1 comment" → "0 comments" + "No comments yet." → a post→ "1 comment"; no console errors; 390 px no horizontal overflow (long word wraps).- **They bite**: the new gate on the old code (git archive HEAD before the mission): every comments check fails — 4 FAIL, then the gateaborts at the missing `/comments` (`.scratch/w6/gate-oldcode.txt`). Mutation "Edit / Delete for every user" (`mine = me != ''`): 2 FAIL(`gate-mut-author.txt`). Mutation "text row keyed by id only": still passes — the redraw comes from hl:web rebuilding the child, whichis why 9ec7273 dropped the keyed list (`gate-mut-key2.txt`, probe `.scratch/w6/probe/p4.mjs`).- `python3 tests/letcount.py .` → never reassigned 0.- **Screenshots looked at** (ASCII render + colour count, `.scratch/w6/probe/look.py`): `.scratch/gate-comments-1280.png`: title, intro,the black "You are" buttons, "3 comments", three rows — grey avatar discs, light grey bubbles (bob's with "edited" open: white boxes withthe earlier versions), the formatted text with the list, actions under each bubble, then the editor with its grey toolbar and the blackComment button at the right; `gate-comments-390.png`: the same stacked within 390 px, the long word wrapped inside the bubble, nothingcut. Both and `gate-bw-comments-{1280,390}.png`: 0 coloured px.- **layouts.worldapi.org** (not edited; code-only copy, deleted): `tools/sync-components.sh fd57c18` changes md-editor.hl + README (andpagination from mission 005); gate (8750/8751-8759) **76/0**, check-theme **0 problems** — also with `comments.hl` copied in (after9ec7273's radius tokens; before: 3 radius problems). Its sync list has neither `comments/` nor `files-upload/`.## What tickets must change to use it (not edited)1. Vendor `components/comments/` and `components/md-editor/` from components.hybriel ≥ 9ec7273 (tickets still uses shared/md-editor.js:its comment form `mdEditor { textarea … }` goes; `sendComment` / `commentText` / `keyed` go — the block owns the form).2. Data: comments are `kind = 'comment'` events in the ticket history (`putEvent`). The block shows comments only, so the ticket pageeither shows the comment events in the block and the other events (state, edits, assignments) in "History" apart, or keeps onehistory and drops the block — a page decision. Each comment row: `id` = the event id, `author` = `user.name`, `when` (localtime.hltext), `text`, `likes`, `liked` (for the viewer), `history`.3. Store (lib/tickets.hl): edit of a comment by its author (keep earlier versions: `[{ when, text }]`), delete by its author, likes percomment (user ids; count + liked-by-viewer) — none of these exist now. Faces (thin): `commentEdit`, `commentDelete`, `commentLike`beside `commentOn`, each checking rights on the server (the block only hides buttons) and answering / pushing the new list.4. Page: `Comments { comments = commentRows user = me onPost = posted … signInText = "…log in…" }`, `user = ''` when not logged in ornot a member (canWrite); the lambdas `posted = (text) => { … emit server commentOn(ticketId, text) … }` set the list from the answer;live pushes (`on client …`) just set the list.5. Identity: the block compares `author == user` (display names). Two accounts with the same name would both see Edit / Delete (theserver still refuses). A `mine` field (the host's own per-row verdict, by user id) was built and stopped at the Hybriel gap below —worth adding once the gap is fixed (tickets can set it in its faces without the gap: it only bit the demo's derived member).6. Rendering moves from tickets' server-side `Markdown { blocks }` to the MdEditor renderer (same subset per md-editor README); commenttext is drawn in the browser (the SSR HTML holds the Markdown in a hidden field).## Hybriel gaps- **A member derived through an IMPORTED static function is never re-derived in the browser** (computed right on the server). Through asame-file method it follows. Repro `.scratch/w6/gap-derive-import/` (`../../../bin/hybriel project.hl`, open :8750, press "next" twice:n 3, local 6, imported 2). No open ticket (related, done: #115, #121). Hit by the demo's `threadShown = withMine(thread, account)`(`mine` by account, two alices); that part was stopped and reverted, not worked around.- **A member's property as View text is empty in the server HTML** (`p { items.length " items" }` → `<p> items</p>`; a derived`Number n = items.length` renders 3; the browser fills the text after a change). Repro `.scratch/w6/gap-length/`. No open ticket found.Avoided by design (the counter is a derived String).- Not gaps (for the guide): two plain declarations of one name in an `if` / `else` → `ReferenceError` in the browser (known, report 004);hl:web rebuilds a composed child when a value bound into it changes (relied on).## Open points- `mine` override (see tickets 5), after the derivation gap.- History shows earlier versions as Markdown source, not formatted.- The demo's "You are" buttons do not mark the current user (the output beside them says it).- Not deployed.
Branches
Latest commits
- 3f0a7229Month view, date picker, range picker: names follow the page language (English by default, not the browser's), weekday/month names formatted in UTC (a UTC+12 zone showed Tue first), 44 px day cells and buttons, Send row air; gate checks at 390 px for every page, popup and dialog (MC)mre
- 29eb07eaPhone: 44 px targets on the site (brand, home links, buttons), comments, modal and pagination; the header is the brand alone on a phone; comments demo: labelled 'You are' group with the chosen user pressed (MC)mre
- d1cc83e2reports/E2-toolbar.mdmre
- 214c3183MdEditor on a phone: toolbar as two even rows of 44 px targets (no clipped icon, no swipe), 'Markdown source' label 15 px, table head 16 px; gate checks (E2)mre
- 9215bbaareports/F5-empty.mdmre
- 134b4e3eMdEditor: an editor the framework puts into the page is built at once (page observer), a surface put in anew under a built editor is redrawn; gates for both (hybriel#211)mre
- 0dce2899reports/K1-bubble.mdmre
- 6b0936a0comments: 'edited' foldable also drops the theme's border, margin and radius (display: contents alone left them computed)mre
- 8d79ff79comments bubble hugs its content: a readonly md-editor surface gets no inline min-height (it beat the stylesheet's min-height 0); 'edited' is a quiet label beside the time, versions unframed; gate checksmre
- ef253fecreports/F4-icons.mdmre
- ba96735ficons: README, md-editor README note, gate checks for the single focus ring and toolbar iconsmre
- 96c97691icons: shared Icon component; md-editor toolbar and files-upload remove use it; no inner focus ring in md-editormre
- 0d6863d6reports/F3-mdvalue.mdmre
- d58ed98bMdEditor: an older text of the editor handed back is not an outside change (kept surface, written back); gate for itmre
- c2d0de59MdEditor: show a value that changes from outside (data-value observer), demo button and gatemre
- c4272fa3re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
- 2e22618etests: cdp-blank/md-bg/md-keys-run Chrome range and base port from env (MDK_CHROME, MDK_PORT), defaults unchangedmre
- a5d2384bre-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
- 52902d23docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
- 022b943fdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre