gitoria

components

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit13389d6713389d67mission 008: report, LOG, STATUSmre13389d67/reports/008-files-upload-pick.md

7.4 KB

  1. # Report 008: FilesUpload pick first, send later (components.hybriel#18, for HyperConductor hycon#46). Worker H2, 2026-10-20
  2. **Result: done. Gate 343/0 on the new code; the new checks fail on the old code. NOT deployed, NOT pushed (branch `w18`, from main 9db927d, Hybriel 0f396652 unchanged).**
  3. ## Host interface (decided: the Comments block's pattern, hybriel#87: the host owns the list)
  4. ```
  5. Hybrid attached = []
  6. picked = (list) => { attached = list }
  7. FilesUpload { mode = "pick" files = attached onChange = picked maxSize = 10485760 accept = "image/*,.pdf"
  8. form { on submit(e) { emit chatSubmit(e) } textarea { name = "text" } button { type = "submit" "Send" } } // the host's input area = the slot
  9. }
  10. // Send: message = emit server chatSend(text, attached) (the framework uploads the Files first, hybriel#94) then: attached = []
  11. ```
  12. - `files` is the input: the host's list of browser Files, shown in that order. `onChange(list)` is the output: it gets the NEW list after every drop, choose, paste, photo or ✕.
  13. The component never sends anything in this mode. The host clears the list with `attached = []`.
  14. - The host's text field and Send go inside the component (the slot). A Ctrl+V or a drop of files there is caught; a text paste or a text drag stays in the field.
  15. - `maxSize` (bytes; 0 = none, also in the upload mode): a bigger file gets a row "Too big — at most 2.0 MB" with its own ✕ and is not collected or sent.
  16. - Phone: "Choose files" (multiple, `accept`) brings up the phone's own menu (gallery, camera, files). On a touch screen (`pointer: coarse`) a **Camera** button
  17. (`accept="image/*" capture="environment"`) opens the camera directly. Every button is ≥ 44 × 44 px.
  18. - Thumbnails come from `window.URL.createObjectURL` (pure Hybriel) and are revoked once drawn. Other files get a kind box ("TXT", "PDF") with name and size.
  19. - The upload-at-once mode is unchanged, apart from three things: it also takes a Ctrl+V on the focused drop zone (`tabindex="0"`), its Choose files button is 44 px high now (it was 35), and it honours `maxSize` when one is set.
  20. - Full host example and the member table: `components/files-upload/README.md` → "Pick first, send later".
  21. ## Files (what Hermes copies for hycon#46)
  22. **Copy `components/files-upload/files-upload.hl`** (the component, both modes, its own Style), plus `components/files-upload/README.md` if wanted, from commit
  23. **ab47e4a** (branch w18; the docs commit after it does not touch the component). Nothing else is needed: no import, no .js. `demo.hl` and `demo-pick.hl` are this site's pages.
  24. Other files in the commit: demo `components/files-upload/demo-pick.hl` (`/files-upload/pick`), `lib/uploads.hl` `storeMessage`, a route + map line in `project.hl`,
  25. a home link (`components/index.hl`), demo CSS (`components/styles.hl`), README, gate.
  26. ## Gates (ports 8740–8749; TMPDIR + Chrome profiles under the scratch dir)
  27. | run | result |
  28. |---|---|
  29. | NEW (w18) `node tests/browser.mjs` | **343 passed, 0 failed** (324 + 19 `#18` checks) |
  30. | OLD (main 9db927d, its own code, the NEW gate file) | **325 passed, 20 failed**: all 324 old checks pass. 18 of the 19 #18 checks FAIL. The 19th ("the upload mode shows no Camera and no pick rows") is a guard that holds on old code too. Plus 2 FAILs "base look: /files-upload/pick comes up" |
  31. | `python3 tests/letcount.py .` | never reassigned 0 |
  32. | layouts.worldapi.org dry run (code-only copy, files-upload.hl + README copied over its `components/files-upload/`) | gate **99/0** (8750–8759), `check-theme` **0 problems** (38 files) |
  33. The #18 checks use REAL input only: Chrome's drag and drop of files from disk (`Input.dispatchDragEvent`) onto the drop zone and onto the text field,
  34. `DOM.setFileInputFiles` on the Choose input, a real **Ctrl+V** (a PNG put on Chrome's clipboard through `navigator.clipboard.write`, then
  35. `Input.dispatchKeyEvent` with the paste command; text paste the same way), real clicks on ✕ and Send, real typing. They check:
  36. - the thumbnail is drawn (`naturalWidth` 320 / 120); other files show name + size + kind;
  37. - nothing is uploaded while picking (no `/__hl/upload` request, nothing stored);
  38. - the 3 MB file is refused in its row and not collected;
  39. - ✕ removes the file, and the thumbnails are still drawn after the re-render;
  40. - at Send the face gets the text and every byte (`photo.png (N B), a.txt (5 B), image.png (N B)`, three files stored), then rows, refused row, summary and field are empty;
  41. - at 390 px with touch emulation: 6 targets ≥ 44 × 44, Camera visible with capture, no horizontal overflow with an 87-character file name and a refused row;
  42. - the upload mode's button is ≥ 44 px at 390, and a pasted image uploads at once ("1 of 1 uploaded");
  43. - no console errors.
  44. The base-look loop now also covers `/files-upload/pick` (1280 + 390). It records a page that does not come up as a FAIL instead of ending the gate.
  45. ## Phone checks at 390 px (what the gate measured)
  46. ✕ 44×44 on every row, Choose files 123×44, Camera 90×44, Send 68×44. Rows are 48 px: a 48 px thumbnail or kind box, name and size, then ✕. The 87-character name
  47. wraps (`overflow-wrap: anywhere`). scrollWidth = innerWidth. Camera is hidden at 1280 (`pointer: fine`).
  48. ## Screenshots
  49. `.scratch/gate-files-pick-1280.png`, `.scratch/gate-files-pick-390.png` (+ `gate-bw-files-upload-pick-{1280,390}.png`). **I cannot view images.** What I checked instead:
  50. - coarse ASCII renders and a coloured-pixel scan. The only coloured pixels are inside the 48×48 thumbnail box (the red test photo: 1280 at 336..383 × 210..257;
  51. 390 @2x at 32..127 × 566..661). Everything else is grey or black;
  52. - the two bw screenshots have 0 coloured px;
  53. - a DOM geometry dump: rows, then the summary "2 files · 107.0 KB", the text field with Send beside it, then the dashed drop zone with Choose files / Camera.
  54. ## Hybriel gap
  55. - `Number.toFixed` exists in the browser realm but not in the native runtime: `'toFixed' is not a method of Number`. Repro:
  56. `/media/STORAGE/claude-scratch/atlas/H2/gap-tofixed/` (`repro.hl`, `out.txt`, `README.txt`). Not in the hybriel tickets.
  57. Found because a member derived on the server called `sizeText` → page 500. Worked around without JS: the size limit text is computed only in browser handlers.
  58. - No gap for clipboard files (`e.clipboardData.files`), object URLs, the `capture` attribute, a list of Files as an emit argument, or the slot. All work in 0f396652.
  59. ## Notes for HyperConductor (hycon#46)
  60. - One FilesUpload per page; face names are global (`uploadFile` is only used by the upload mode, not by the pick mode).
  61. - `uploadMax` of the app's WebFramework still bounds each file at Send. Keep `maxSize` ≤ `uploadMax`, so the user is told when picking, not when sending.
  62. - While Send uploads, the files stay listed; a refused emit (answer null) keeps them for a retry (the README example does that).
  63. - The layouts showcase (`components/showcase/files-upload.hl`) only shows the upload mode. A pick-mode showcase page and the real sync (`tools/sync-components.sh <commit>`) are layouts' step.
  64. ## Creator test on the phone (after deploy)
  65. 1. Open https://components.hybriel.worldapi.org/files-upload/pick. Tap **Camera**, take a photo: a thumbnail row appears. Tap **Choose files**, pick 2 photos from the gallery: two more thumbnails.
  66. 2. Tap ✕ on one row: it goes. Pick a file over 2 MB: it shows "Too big — at most 2.0 MB" and is not counted in "n files · …".
  67. 3. Type a text, tap **Send**: the message shows above with the file names and byte counts, and the list and the field are empty.

Branches

Latest commits

  • 13389d67mission 008: report, LOG, STATUSmre
  • ab47e4a2files-upload (mission 008, #18 for hycon#46): pick-first-send-later mode — host-owned list (files + onChange), slot for the host's input area, Ctrl+V paste (both modes), thumbnails, name+size rows, ✕ remove, maxSize per file, Camera on touch screens, 44 px targets; demo /files-upload/pick; gate 343/0 (19 new, 18 fail on the old code)mre
  • 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