components
All repositories: gitoria
7.4 KB
# Report 008: FilesUpload pick first, send later (components.hybriel#18, for HyperConductor hycon#46). Worker H2, 2026-10-20**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).**## Host interface (decided: the Comments block's pattern, hybriel#87: the host owns the list)```Hybrid attached = []picked = (list) => { attached = list }FilesUpload { mode = "pick" files = attached onChange = picked maxSize = 10485760 accept = "image/*,.pdf"form { on submit(e) { emit chatSubmit(e) } textarea { name = "text" } button { type = "submit" "Send" } } // the host's input area = the slot}// Send: message = emit server chatSend(text, attached) (the framework uploads the Files first, hybriel#94) then: attached = []```- `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 ✕.The component never sends anything in this mode. The host clears the list with `attached = []`.- 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.- `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.- Phone: "Choose files" (multiple, `accept`) brings up the phone's own menu (gallery, camera, files). On a touch screen (`pointer: coarse`) a **Camera** button(`accept="image/*" capture="environment"`) opens the camera directly. Every button is ≥ 44 × 44 px.- 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.- 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.- Full host example and the member table: `components/files-upload/README.md` → "Pick first, send later".## Files (what Hermes copies for hycon#46)**Copy `components/files-upload/files-upload.hl`** (the component, both modes, its own Style), plus `components/files-upload/README.md` if wanted, from commit**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.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`,a home link (`components/index.hl`), demo CSS (`components/styles.hl`), README, gate.## Gates (ports 8740–8749; TMPDIR + Chrome profiles under the scratch dir)| run | result ||---|---|| NEW (w18) `node tests/browser.mjs` | **343 passed, 0 failed** (324 + 19 `#18` checks) || 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" || `python3 tests/letcount.py .` | never reassigned 0 || 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) |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,`DOM.setFileInputFiles` on the Choose input, a real **Ctrl+V** (a PNG put on Chrome's clipboard through `navigator.clipboard.write`, then`Input.dispatchKeyEvent` with the paste command; text paste the same way), real clicks on ✕ and Send, real typing. They check:- the thumbnail is drawn (`naturalWidth` 320 / 120); other files show name + size + kind;- nothing is uploaded while picking (no `/__hl/upload` request, nothing stored);- the 3 MB file is refused in its row and not collected;- ✕ removes the file, and the thumbnails are still drawn after the re-render;- 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;- 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;- the upload mode's button is ≥ 44 px at 390, and a pasted image uploads at once ("1 of 1 uploaded");- no console errors.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.## Phone checks at 390 px (what the gate measured)✕ 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 namewraps (`overflow-wrap: anywhere`). scrollWidth = innerWidth. Camera is hidden at 1280 (`pointer: fine`).## Screenshots`.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:- 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;390 @2x at 32..127 × 566..661). Everything else is grey or black;- the two bw screenshots have 0 coloured px;- 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.## Hybriel gap- `Number.toFixed` exists in the browser realm but not in the native runtime: `'toFixed' is not a method of Number`. Repro:`/media/STORAGE/claude-scratch/atlas/H2/gap-tofixed/` (`repro.hl`, `out.txt`, `README.txt`). Not in the hybriel tickets.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.- 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.## Notes for HyperConductor (hycon#46)- One FilesUpload per page; face names are global (`uploadFile` is only used by the upload mode, not by the pick mode).- `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.- While Send uploads, the files stay listed; a refused emit (answer null) keeps them for a retry (the README example does that).- 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.## Creator test on the phone (after deploy)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.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 · …".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
- b27b
- mainmain branch
- vendor-day72
- vl27-baseline
- vl27-resetkey
Latest commits
- 3d43c187ident-access: server-side check of an ident access key (Bearer or Basic password), asks ident on every call, README, gate tests/ident-access.mjs (ident#27 app side)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
- 1c41293eMediaPlayer: back / forward 10 s as replay / forward 10 icons (circular arrow with a 10), the play button keeps its surface background on audio and video, the media route's range end is a letmre
- 9e1ab228MP: report, LOG line, STATUS entrymre
- dd003e5dMediaPlayer: audio and video in one phone-first player (components/media-player), its demo /media-player with a queue, the media icons in components/icons, the demo's media files served with ranges (lib/media.hl), 35 gate checksmre