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
- 172e66bemission brief 008mre
- 9db927dfpaths: projects moved into /media/STORAGE/projects/WorldAPI/mre
- 00a95329components (mission 007): re-vendor Hybriel to the shared static build 0f396652 (plugins; bin/ git-ignored), gate 324/0 old and new, real-data copy unchanged, report 007, same-output.mjs ports overridablemre
- fe50766bmission brief 007mre
- 2dce51b8components (mission 006) 4/4: docs (README comments + gate 324, STATUS, LOG), report reports/006-comments.mdmre
- 9ec7273ecomponents layouts#2 (mission 006) 3/4: comments — each text is MdEditor readonly directly in its row (hl:web builds a composed child anew when a bound value changes, so the keyed one-row list was not needed); demo 'bob edits his comment elsewhere (a push)' + gate check that a text the host changes from outside is drawn anew; theme radii (var(--radius-small/large) with 5px/10px fallbacks: layouts' check-theme 0 problems with comments.hl copied in); README 'How it is built'; gate 324/0 (34 comments checks)mre
- fd57c18bcomponents layouts#2 (mission 006) 2/3: comments block (components/comments, demo /comments) — pure Hybriel: '1 comment' / 'n comments', avatar initial, bubble with name, time, 'edited' (<details> with the earlier versions), the text drawn by MdEditor readonly (one-row list keyed by id + text, so an edit redraws), like ♥ n (aria-pressed), Edit / Delete (asks first) only where author == user, the form below in MdEditor (Comment button or Ctrl+Enter; a fresh editor after a post). Host passes comments + user and hands onPost / onEdit / onDelete / onLike (hybriel#87); demo keeps a mock thread from lib/comments.hl in the page, switches alice / bob / nobody. Home entry, routes, map line, README; base-look gate covers comments; 33 gate checks with real clicks / keysmre
- 850a376bcomponents (mission 006) 1/3: MdEditor readonly = "true" — the Markdown shown formatted and nothing else (no toolbar, link form, file rows, placeholder, source view or switch; article contenteditable false, tabindex -1, role document; no field background or focus ring); the mount only loads the value. For the comments block, which draws every comment with the editor's own renderermre
- ee9f1b57mission brief w6mre
- fe691586components (mission 005) 4/4: docs (README components + gate 290, STATUS, LOG), report reports/005-fixes-16-17-5.mdmre
- f1ebab53components #5 (mission 005) 3/4: file upload for several files (components/files-upload, demo /files-upload) — pure Hybriel, each file through emit server uploadFile (hybriel#94), drop or choose many, a row per file with live progress, one after the other in order, a drop during an upload waits, a file over uploadMax fails in its row and the next goes, 'n of m uploaded'; home entry, routes, map line, README; pagination keyboard focus ring #555 (Chrome painted its own orange one); docker-compose init: true (hybriel#156); gate 290/0 (17 #5 checks with real file drops, 1 #16 focus check)mre
- 3b73ae5bcomponents #16 (mission 005) 2/4: Pagination tells the host the target page — the host hands onPage (hybriel#87: a function, not emit), called on every click that changes the page (pointer, Enter/Space, script click; Previous/Next/numbers/first/last; not … or the current page) with the target read from the clicked button's data-page before the rebuild; demo shows what the page was told; README Data out; 15 gate checks (14 fail on the old pagination)mre
- 6b27c0f0components #17 (mission 005) 1/4: md-editor keeps backslash + r — parseInto dropped the two characters '\r' (C:\root -> C:oot) instead of a real carriage return; CR now decoded from JSON (String.fromCharCode does not parse in a member), real CRs also go from pasted plain text; 5 gate checks (3 fail on the old md-editor.hl)mre
- 1a5dc327mission brief w5mre
- a567b579components (mission 004) 3/3: docs (README Hybriel a832f73b + tables, STATUS, LOG), report reports/004-md-editor-tables.mdmre
- 70fe7ab5components (mission 004) 2/3: GitHub pipe tables in the Hybriel MdEditor (creator notes#5; behaviour of notes md-editor.js 9acc27f, no JavaScript) — parse/render (header, :--/:-:/--: alignment, \| in cells and code, inline Markdown in cells, outer pipes optional), padded writer, unchanged table byte for byte, typing | a | b | Enter |---|---| Enter makes a table, Tab/Shift+Tab, Enter new row, Enter in empty last row leaves, Backspace/Delete never merge, selection across a table empties cells, pasted HTML table -> table, thin #999 lines, wide table scrolls in its box; demo third editor 'plan'; gate 252/0 (22 new table checks, 20 fail on the old md-editor.hl)mre
- f2adb3f3components (mission 004) 1/3: Hybriel master a832f73b (incremental build cache, HL_CACHE_DIR, #151) — bin/hybriel sha256 e1b53f7ce687f5afbe3db34bcda69958f56e730571e4841923c9c8eb3d272db9 built from git archive a832f73b (HL_NO_PLUGINS=1 native/build.sh), the same nine plugins; container: HL_CACHE_DIR=/cache on volume hybriel-cache, /tmp tmpfs; tests wait COMPONENTS_COLD_MS (120 s) for every start; deploy.sh DEPLOY_URL_WAIT 120 s; gate 230/0 coldmre
- 91bd8a0dmission brief (w4)mre
- 3bc905c5components #15 (mission 003) 2/2: docs (README Look, STATUS, LOG), reportmre
- 5a98d77ecomponents #15 (mission 003) 1/2: black/white base look — greys for nuances, no WorldAPI fallbacks, no decorative frames; site + icon black/white; gate 230/0mre