gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit869f49c7869f49c7files-upload: Style in the language's form (nested like the View, one declaration per line, bare @media)mre869f49c7/reports/006-comments.md

8.9 KB

  1. # Report 006 — comments block (layouts#2), first user tickets (worker w6, 2026-10-19)
  2. **Result: done, not deployed, not pushed.** Branch `w6`: 850a376 (MdEditor readonly), fd57c18 (comments block + demo + gate),
  3. 9ec7273 (text via MdEditor directly, "edited elsewhere" check, theme radii), + docs commit. Hybriel: the vendored a832f73b bin, unchanged.
  4. ## What the component does
  5. `components/comments/comments.hl` (+ `README.md`, demo `demo.hl` at `/comments`), pure Hybriel, own `Style`, base look (black/white/greys,
  6. semantic tokens with fallbacks), no app data. Shape of hybriel's demo-social-network: **"1 comment" / "n comments"** (0 → "0 comments" +
  7. "No comments yet."), then per comment an **avatar** (initial on a grey disc), a **bubble** with **name**, **time**, **"edited"** (a
  8. `<details>`: "Edited once" / "Edited n times" and the earlier versions, oldest first, as Markdown source) and the **text as formatted
  9. Markdown**; under it a **like** (`♡ n` / `♥ n`, `aria-pressed`) and, for the author, **Edit** (the MdEditor opens with the text, Save /
  10. Cancel) and **Delete** ("Delete this comment?" Delete / Keep). **The form below** is the MdEditor (Comment button or Ctrl+Enter; empty
  11. sends nothing; an empty editor after a post). With no `user`: no form (optional `signInText` instead), no Edit / Delete, the like does nothing.
  12. ## Interface
  13. `Comments { comments = list user = me onPost = posted onEdit = edited onDelete = deleted onLike = liked }`
  14. - **In**: `comments` = `[{ id, author, when, text (Markdown), likes, liked, history: [{ when, text }] }]` (oldest first); `user` = the
  15. current user's name ('' = nobody). Edit / Delete show where `author == user`. Texts: `oneLabel`, `manyLabel`, `emptyText`,
  16. `placeholder`, `postLabel`, `editLabel`, `deleteLabel`, `saveLabel`, `cancelLabel`, `askText`, `keepLabel`, `editedLabel`, `likeLabel`,
  17. `signInText`.
  18. - **Out** (functions the host hands, hybriel#87, like Pagination's `onPage`): `onPost(text)` (answer `false` to keep the text in the
  19. editor), `onEdit(id, text)` (only a changed, non-empty text), `onDelete(id)` (after the confirm), `onLike(id)` (host flips `liked` + count).
  20. The host stores and hands a new list back; the block shows what it is given.
  21. - Text rendering = **MdEditor `readonly = "true"`** (new, 850a376: no toolbar / link form / files / placeholder / source view, article
  22. `contenteditable=false`, `tabindex=-1`, `role=document`, no field background or ring; mount only loads). Same subset as typed.
  23. A vendoring app copies `components/comments/` **and** `components/md-editor/` (≥ 850a376).
  24. - Found and used: hl:web builds a composed child anew when a bound value changes (probe: a new `<md-editor>` element after the host changed
  25. the text; untouched rows keep theirs), so an edited / pushed text redraws; rows are keyed by `id`.
  26. ## Tests (ports 8740–8759)
  27. - Gate **before 290/0** (old code, `COMPONENTS_GATE_PORT=8740 COMPONENTS_GATE_CHROME=8741-8749`), **after 324/0**
  28. (`.scratch/w6/gate-new5.txt`; +34 comments checks; base look now covers 11 public files / 10 demos, home 10 entries).
  29. - The 34 checks, real CDP mouse presses and key events only: SSR counter + rows; Markdown drawn (exact HTML); readonly not editable / no
  30. toolbar; avatar / name / time; typing `Hello **world** and `code` here` formats while typing; Comment posts (host told, last row, author,
  31. formatted, "4 comments", editor empty); Ctrl+Enter posts; empty sends nothing; like ♡ 2 → ♥ 3 (pressed, told) → ♡ 2; a text the host
  32. changes from outside ("bob edits his comment elsewhere", = a push) redraws, "Edited 3 times"; Edit opens the editor with the text, typed
  33. keys + Save → told "edit c3", new text drawn, "edited" opens "Edited once" + the old text; history oldest first; Cancel keeps all; Edit /
  34. 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, Keep
  35. keeps, Delete removes (told, the next row keeps its own text); "4 comments" → "1 comment" → "0 comments" + "No comments yet." → a post
  36. → "1 comment"; no console errors; 390 px no horizontal overflow (long word wraps).
  37. - **They bite**: the new gate on the old code (git archive HEAD before the mission): every comments check fails — 4 FAIL, then the gate
  38. aborts at the missing `/comments` (`.scratch/w6/gate-oldcode.txt`). Mutation "Edit / Delete for every user" (`mine = me != ''`): 2 FAIL
  39. (`gate-mut-author.txt`). Mutation "text row keyed by id only": still passes — the redraw comes from hl:web rebuilding the child, which
  40. is why 9ec7273 dropped the keyed list (`gate-mut-key2.txt`, probe `.scratch/w6/probe/p4.mjs`).
  41. - `python3 tests/letcount.py .` → never reassigned 0.
  42. - **Screenshots looked at** (ASCII render + colour count, `.scratch/w6/probe/look.py`): `.scratch/gate-comments-1280.png`: title, intro,
  43. the black "You are" buttons, "3 comments", three rows — grey avatar discs, light grey bubbles (bob's with "edited" open: white boxes with
  44. the earlier versions), the formatted text with the list, actions under each bubble, then the editor with its grey toolbar and the black
  45. Comment button at the right; `gate-comments-390.png`: the same stacked within 390 px, the long word wrapped inside the bubble, nothing
  46. cut. Both and `gate-bw-comments-{1280,390}.png`: 0 coloured px.
  47. - **layouts.worldapi.org** (not edited; code-only copy, deleted): `tools/sync-components.sh fd57c18` changes md-editor.hl + README (and
  48. pagination from mission 005); gate (8750/8751-8759) **76/0**, check-theme **0 problems** — also with `comments.hl` copied in (after
  49. 9ec7273's radius tokens; before: 3 radius problems). Its sync list has neither `comments/` nor `files-upload/`.
  50. ## What tickets must change to use it (not edited)
  51. 1. Vendor `components/comments/` and `components/md-editor/` from components.hybriel ≥ 9ec7273 (tickets still uses shared/md-editor.js:
  52. its comment form `mdEditor { textarea … }` goes; `sendComment` / `commentText` / `keyed` go — the block owns the form).
  53. 2. Data: comments are `kind = 'comment'` events in the ticket history (`putEvent`). The block shows comments only, so the ticket page
  54. either shows the comment events in the block and the other events (state, edits, assignments) in "History" apart, or keeps one
  55. history and drops the block — a page decision. Each comment row: `id` = the event id, `author` = `user.name`, `when` (localtime.hl
  56. text), `text`, `likes`, `liked` (for the viewer), `history`.
  57. 3. Store (lib/tickets.hl): edit of a comment by its author (keep earlier versions: `[{ when, text }]`), delete by its author, likes per
  58. comment (user ids; count + liked-by-viewer) — none of these exist now. Faces (thin): `commentEdit`, `commentDelete`, `commentLike`
  59. beside `commentOn`, each checking rights on the server (the block only hides buttons) and answering / pushing the new list.
  60. 4. Page: `Comments { comments = commentRows user = me onPost = posted … signInText = "…log in…" }`, `user = ''` when not logged in or
  61. not a member (canWrite); the lambdas `posted = (text) => { … emit server commentOn(ticketId, text) … }` set the list from the answer;
  62. live pushes (`on client …`) just set the list.
  63. 5. Identity: the block compares `author == user` (display names). Two accounts with the same name would both see Edit / Delete (the
  64. server still refuses). A `mine` field (the host's own per-row verdict, by user id) was built and stopped at the Hybriel gap below —
  65. 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).
  66. 6. Rendering moves from tickets' server-side `Markdown { blocks }` to the MdEditor renderer (same subset per md-editor README); comment
  67. text is drawn in the browser (the SSR HTML holds the Markdown in a hidden field).
  68. ## Hybriel gaps
  69. - **A member derived through an IMPORTED static function is never re-derived in the browser** (computed right on the server). Through a
  70. same-file method it follows. Repro `.scratch/w6/gap-derive-import/` (`../../../bin/hybriel project.hl`, open :8750, press "next" twice:
  71. n 3, local 6, imported 2). No open ticket (related, done: #115, #121). Hit by the demo's `threadShown = withMine(thread, account)`
  72. (`mine` by account, two alices); that part was stopped and reverted, not worked around.
  73. - **A member's property as View text is empty in the server HTML** (`p { items.length " items" }` → `<p> items</p>`; a derived
  74. `Number n = items.length` renders 3; the browser fills the text after a change). Repro `.scratch/w6/gap-length/`. No open ticket found.
  75. Avoided by design (the counter is a derived String).
  76. - Not gaps (for the guide): two plain declarations of one name in an `if` / `else` → `ReferenceError` in the browser (known, report 004);
  77. hl:web rebuilds a composed child when a value bound into it changes (relied on).
  78. ## Open points
  79. - `mine` override (see tickets 5), after the derivation gap.
  80. - History shows earlier versions as Markdown source, not formatted.
  81. - The demo's "You are" buttons do not mark the current user (the output beside them says it).
  82. - Not deployed.

Branches

Latest commits

  • 869f49c7files-upload: Style in the language's form (nested like the View, one declaration per line, bare @media)mre
  • f60dab20month-view: Style in the language's form (nested like the View, one declaration per line, bare @media)mre
  • 5b3c349aRe-vendor to Hybriel set day35 (cb9e480d): plugins core and web sources, README vendoring notemre
  • 3449b117components: a startup error prints its message before exit 1 (hybriel#247)mre
  • 59704ce1Merge branch 'n5b-pipes'mre
  • 23b9164aMdEditor: a clipboard whose text is only the names or file:// paths of its files (a file manager copy) is about the files, as before; any other text wins (tickets#49); gate casesmre
  • b0f1ec28MdEditor: a clipboard with text always pastes the text, also when a picture is on it too (a spreadsheet or office app), files on or off; a picture alone still goes to the files; real Ctrl+V gate tests/md-paste-files.mjs (tickets#49)mre
  • ad4e929bMdEditor: pipe rows without a delimiter row are a table (first row = header, short rows padded, written back without an invented | --- | line) (notes#5)mre
  • 4bd11128MdEditor: the Table button's empty table is written as a real pipe table (empty cells), so it survives the source switch, a save and a reload (notes#7)mre
  • 7437e32bMdEditor draws its surface at once when claimed from server HTML: 1 ms mount animation, the first editor mounts all editors of the pagemre
  • 5de0264cRe-vendor onto Hybriel master acaceaf3 (set-day27b): binary, lib and plugins; exit 1 on a startup fault; .gitignore binmre
  • 79c77e7dMerge sb3-standby: components deploys through its standbymre
  • c5442043components: no jobs switch needed in the standbymre
  • 8d2fb24ccomponents: a standby container (port 45016, profile standby); deploy hands over through standby-swap.sh without a gapmre
  • c2834dd3Merge mr-fixes: media player state after a queue pick, Range handling, cover-less audio, accessibility labelsmre
  • 354fe3c6Media player: audio without a cover starts and shows its time (the mount tick sits on the seek bar, which every item has); the speed button names the current speed, the seek slider says its time in words; a gate page for the first render on cover-less audio and a fourth demo queue item without a covermre
  • ee4aee1eMedia player: a new queue item shows its own speed, mute, play state and time and starts when asked, also for two videos in a row; the media route reads suffix ranges and ignores range lists and garbage instead of answering 500; stronger gate checks (the 10 percent drag, the played bar, the queue tap)mre
  • 9a4f9b31Merge mp-player: media served from the committed filesmre
  • ab96e686Media route: serve the demo's media from the committed files in components/media-player (storage/ is not in git, the deploy gate found no files)mre
  • b2980734Merge mp-player: the media player (components/media-player), its demo and the media iconsmre