components
All repositories: gitoria
15.7 KB
# components.hybriel.worldapi.orgHybriel components, developed standalone (CONCEPT.md). The home lists them; each component has a demo page, a READMEand a browser gate. Apps vendor a component by copying its folder. https://components.hybriel.worldapi.org## Components| Component | Demo | README ||-----------|------|--------|| Month view | `/month-view` | `components/month-view/README.md` (also `/month-view/README.md`) || Date picker | `/date-picker` | `components/date-picker/README.md` (also `/date-picker/README.md`) || Date range picker | `/range-picker` | `components/range-picker/README.md` (also `/range-picker/README.md`) || Pagination | `/pagination` | `components/pagination/README.md` (also `/pagination/README.md`) || Markdown editor | `/md-editor` | `components/md-editor/README.md` (also `/md-editor/README.md`) || Code editor | `/code-editor` | `components/code-editor/README.md` (also `/code-editor/README.md`) || File upload | `/file-upload` | `components/file-upload/README.md` (also `/file-upload/README.md`) || File upload, several files | `/files-upload` | `components/files-upload/README.md` (also `/files-upload/README.md`) || Modal | `/modal` | `components/modal/README.md` (also `/modal/README.md`) || Comments | `/comments` | `components/comments/README.md` (also `/comments/README.md`) |The Markdown editor takes files and images (drop, paste, File button) through `emit server mdUpload` (hybriel#94) and makes GitHub pipe tables (mission 004, creator notes#5: typed, pasted, Tab between cells — `components/md-editor/README.md` "Tables"). The one-file upload (`components/file-upload/`, ticket #4) sends its file through `emit server saveFile` (hybriel#94); the upload for several files (`components/files-upload/`, ticket #5, mission 005) sends each file through `emit server uploadFile`, one after the other, every file in its own row with its progress. The Pagination tells its host the target page through a function the host hands it, `onPage` (ticket #16, hybriel#87). The comments block (`components/comments/`, layouts#2, mission 006) shows the list and user its host passes, hears post / edit / delete / like the same way (`onPost`, `onEdit`, `onDelete`, `onLike`), types in the MdEditor and draws every text with it (`readonly = "true"`); it needs `components/md-editor/` beside it.## Look (ticket #15, mission 003)The library is generic: every component renders in a neutral **base look** — black, white and four greys for nuances, no app'spalette, no decorative frames. Light by default (white page, black text): it is the plain look of a document, and a theme can turnit dark without the base fighting it. The values are named once in `shared/base.hl`:| name | value | used for ||------|-------|----------|| `black` | `#000` | text, the selected day / current page / main modal button (white on black), today's ring, the site header || `greyDark` | `#555` | muted text, line numbers, syntax (keywords, strings, comments in italics), focus rings, the dim page behind a modal || `grey` | `#999` | functional lines only: the drop zone's dashed border || `greyLight` | `#ddd` | a strip or block on a field: editor toolbar, code, gutter; hover on a day tile; the days of a range || `greyLighter` | `#f2f2f2` | fields and tiles on the white page: inputs, editors, day cells; hover on white || `white` | `#fff` | the page, popups, the modal window, text on black |- A component's browser module cannot import `base.hl`, so each component writes the value as the FALLBACK of the semantic WorldAPItoken: `var(--color-text, #000)`. A bare copy (no tokens) shows the base look; an app that declares the tokens — layouts.worldapi.org's`theme/theme.hl` — restyles it. **The token names, elements and classes stay as they are** (the theme targets them).- No frames: a border or ring only where it means something — focus ring (`#555`), today (`#000`), an invalid field (dashed),the drop zone (dashed `#999`). A floating popup separates by a soft black shadow, the modal by the dimmed page.- The site itself (`components/styles.hl`) uses the base names and declares **none** of the WorldAPI tokens, so the showcase showseach component exactly as a bare copy looks. Header black, page white; icon white blocks on black (`icons/`).- Gate: the `base look:` checks in `tests/browser.mjs` — every colour in the 11 public files is a base value; on the home + 10 demos +open date popup + open modal at 1280 and 390 px: no `--color-…` on `:root`, white page / black text, every computed colour(text, background, visible border, outline, caret, accent, text decoration, shadow, `::backdrop`) is a grey (r = g = b), and novisible border inside a component except the drop zone. Screenshots `.scratch/gate-bw-<page>-<width>.png` — LOOK at them.- Chrome quirk found on the way: when a `<strong>`'s colour equals the text around it, Chrome's `insertHTML` writes it inline(`<strong style="color: …">`); `md-editor.hl` `inlineRule` removes every `style` attribute from the surface after it inserts.## Layout- Code order (antcolony docs/code-order.md, mission 002): `project.hl` is the MAP (its head comment says which file handles what) +config + routes, no functions; no other `.hl` in the root; `let` only for a variable that is reassigned(`python3 tests/letcount.py .` → "never reassigned 0"; kept: reassigned, loop body, a member's name, declared twice in one function).- `project.hl` routes · `components/styles.hl` the site's page layout only (colours from `shared/base.hl`, see "Look") ·`components/main.hl` shell · `components/index.hl` the home · `components/<name>/` one folder per component (component, demo,README) · `lib/comments.hl` the comments demo's mock thread (kept in the page) · `lib/uploads.hl` where the demos keep uploaded files (one day; the demos' `on server` handlers only call it).- **Public**: `components/<name>/<name>.hl` (+ `clock.hl`, READMEs) are what apps copy and what layouts.worldapi.org's `theme/theme.hl`styles (`html <element>` rules) — never rename them, their elements or classes; layouts keeps verbatim copies in its `components/`.- To add a component: its folder, a demo route + a README route in `project.hl`, one entry in `components/index.hl`, a line in theproject.hl map, its own `Style` in its file, checks in `tests/browser.mjs`.- **Mission 007: re-vendored to the shared static build 0f396652** (built 2026-10-19; `bin/hybriel` sha256 `60fa02f341ffa799b41a3dbd26d76057169f786e20dae0f98bb2ca3c46c39080`,statically linked; source `/media/STORAGE/claude-scratch/vendor-0f396652`; plugins now also fetch + mpackdb). Gate 324/0 on old and new. The paragraphbelow describes the earlier a832f73b vendoring (its build notes still hold).- `bin/hybriel` + `plugins/` (core crypto data fs http http1 proc time web) were vendored = hybriel **master a832f73b**(2026-10-18, mission 004: the compiler era — hybriel compiles the app at its start: this site cold 22.2 s, warm 0.9 s on Loreana;332 incremental build (BuildCache), one-file hybriel (`--carry-lib`: the binary alone, no libhlrt.a beside it), `HL_CACHE_DIR`,#151 run cache counts only what a listing was read for; #146/#147 since 9f912f3b). Built read-only:`git -C /media/STORAGE/projects/hybriel archive a832f73b | tar -x -C .scratch/w004/hyb-a832`, `HL_NO_PLUGINS=1 bash native/build.sh`(53 s), bin sha256 `e1b53f7ce687f5afbe3db34bcda69958f56e730571e4841923c9c8eb3d272db9`; the nine plugins copied from that archive(their committed `.so`). Previous copy (06617221) in `.scratch/pre-004/`. **Starts wait ≥ 120 s**: the gate and `tests/same-output.mjs`wait `COMPONENTS_COLD_MS` (default 120000) for every server start; `deploy.sh` waits `DEPLOY_URL_WAIT` (120 s) for the URL; thecontainer keeps the build cache on the named volume `hybriel-cache` (`HL_CACHE_DIR=/cache`) with `/tmp` a tmpfs(docker-compose.yml, as tickets b50a6f9). Gate `COMPONENTS_GATE_PORT=8720 COMPONENTS_GATE_CHROME=8721-8729 node tests/browser.mjs`→ 230/0 on the old app code (also with an empty `HL_CACHE_DIR`, every start cold), 252/0 with the tables.Before: master 06617221(2026-10-03, antcolony mission 074: plugin allocators 3a781359 + 413f60e4 (#126), http1 773de63e (request owns its parse —uploads no longer retained), mpackdb 2cb7ae5e, f0ac2d2d (plugin ABI field — bin and .so must match); no lambda semantics change;sha256 `21059cc7…d77bdb`, built the same way from `git archive 06617221`; previous copy (190aa11d) in `.scratch/pre-074/`. Gate`COMPONENTS_GATE_PORT=8760 COMPONENTS_GATE_CHROME=8761-8769 node tests/browser.mjs` → 220/0. Memory: `LOADS=N UPLOADS=N [IDLE=s]node .scratch/w074/memtest.mjs <vendor dir with bin/+plugins/> <label>` (port 8760, Chrome 8761–8769; needs the live storage copy in`.scratch/w074/live/storage`, deleted after the run): 2000 loads 184 → 205 MB flat, 400 × 1 MiB uploads level at ~363–403 MB(old 190aa11d: +1 MB per upload, 829 MB).Before: master 190aa11d (2026-10-02, antcolony mission 072: fc838894 GC correctness (string index / plugin error read freed memory), 038d84b3 #126returned closure scopes, #127 d98926c6/04df4428; no lambda semantics change since 8efba065), sha256 `860f5e61…0a23626`,built read-only from `git archive 190aa11d`; previous copy (8efba065) in `.scratch/pre-072/`. Gate`COMPONENTS_GATE_PORT=8720 COMPONENTS_GATE_CHROME=8721-8729 node tests/browser.mjs` 220/0. Memory:`node .scratch/w072/memtest.mjs <vendor dir> <label>` (port 8720, Chrome 8721-8728; LOADS/UPLOADS/IDLE; needs the livestorage copy in `.scratch/w072/live/storage`, deleted after each run — re-tar it): 200 loads new 182 → 205 MB (old 288 → 353);uploads still retain RAM: 400 × 1 MiB new 185 → 751 MB (old 8efba065 277 → 713 MB, HWM 823), nothing freed after 60 s idle.Before: master 8efba065 (2026-10-02, antcolony mission 069: #126 the collector also runs by bytes — memory is freed now; #48 a lambda PARAMETERCOPIES its argument like a method does, write `(&p) =>` when the caller must see the change; #112 #117 #119 #120 opt-in, notused; earlier: #113, #115/#116, #118, SVG namespace, #111, #103–#106, #94, #83 hashed URLs, #82).Built from a read-only `git archive master` with `zig build -Doptimize=ReleaseFast -Dtarget=x86_64-linux-gnu.2.39` in`native/`; binary sha256 `231fb9f2…395546fc6`. **No local patch**: a re-vendor = copy binary + plugins (the ones listed;the build also refreshes their `.so`), run the gate. Previous copy: `.scratch/pre-069/` (master ff51cf46).- **#48 lambda rule**: the app has 5 lambdas (`python3 .scratch/w069/lambdas.py` / `lambdas2.py` list them and flag writesto parameters); none writes to a parameter, so none needs `&`. Components are methods / faces, which already copied.Probe: `bin/hybriel .scratch/w069/probe48.hl` → `copy: n=1 len=0` = #48 active.- **Memory check** (RSS of one server, live storage copy, 200 loads of the 9 pages + 100 file-upload drops of 1 MiB):`node .scratch/w069/memtest.mjs <dir with bin/ + plugins/> <label>` (port 8730, Chrome 8722–8729; env LOADS, UPLOADS,IDLE; it copies the app without .env into `.scratch/w069/mem-<label>/` — copy the live `storage/` to`.scratch/w069/live/storage` first, delete both afterwards).## PWA (antcolony mission 046)Installable, the same way as calendar/tracker: hl:web's own manifest (`/__hl/manifest.webmanifest`) + service worker(`/__hl/sw.js`) from settings in `project.hl`, no JavaScript of ours.- `appTitle` "Hybriel components", `appShortName` "Components", `appIcons` (192 + 512 PNG, each `any` + `maskable`),`appTouchIcon` (180), `appFavicon` `/icons/favicon.svg`, `appThemeColor` = base `black` (the header, #000),`appBackgroundColor` = base `white` (#15; before: tokens `darker` / `dark`). `/favicon.ico` is a real icon (16/32/48). Each icon has a `file` route.- **Icons** (`icons/`): `icon.svg` = source (512, hand-written: three stacked building blocks with studs, white `#fff`on black `#000` (#15; before green-light on dark), all inside the maskable safe circle r = 204 → one image for `any` + `maskable`);`favicon.svg` = the same drawing cropped on a rounded tile. Rendered on Loreana:```bashrsvg-convert -w 192 -h 192 icons/icon.svg -o icons/icon-192.pngrsvg-convert -w 512 -h 512 icons/icon.svg -o icons/icon-512.pngrsvg-convert -w 180 -h 180 icons/icon.svg -o icons/apple-touch-icon.pngfor s in 16 32 48; do rsvg-convert -w $s -h $s icons/favicon.svg -o /tmp/fav-$s.png; donemagick /tmp/fav-16.png /tmp/fav-32.png /tmp/fav-48.png icons/favicon.ico```- **Offline**: `offline = [ Index ]` — the worker keeps the shell and `/` (the home list). Without a network `/` opensfrom the cache and says "You are offline. The demos need the network." (`components/main.hl`: an invisible `netProbe`runs a 1 s CSS animation, each `animationiteration` reads `navigator.onLine` — hl:web has no connection state / mounthook). Every demo page offline gets hl:web's "Unavailable offline" page.- Gate: the `pwa:` / `offline:` checks at the end of `tests/browser.mjs` (manifest + icons over HTTP, Chrome'sinstallability + manifest parse, worker scope `/`, then CDP offline + the server stopped → reload of `/` shows theshell; screenshots `.scratch/gate-pwa-phone-{online,offline}.png`, 390 px).## Run, test, deploy- `COMPONENTS_PORT=8700 ./bin/hybriel project.hl` (env: `COMPONENTS_WATCH=0` no watcher, `HL_HOST`).- `node tests/browser.mjs` — the gate (324 checks since mission 006: comments 34; 290 since mission 005: #17 5, #16 16, #5 17; 252 since mission 004; 230 since #15): own server + headless Chrome (ports 8700, 8701–8709). Other ports (workers):`COMPONENTS_GATE_PORT=8720 COMPONENTS_GATE_CHROME=8721-8729 node tests/browser.mjs`.- **Same output** (for cleanups, mission 002): run on CODE-ONLY copies (it wipes `<copy>/storage`), ports 8750 (server) + 8751–8759:```bashrsync -a --exclude .scratch --exclude storage --exclude .sessions --exclude .git --exclude '.env*' ./ /tmp/c-new/ # same for the old tree (git worktree / git archive)node tests/same-output.mjs /tmp/c-old .scratch/out-old; node tests/same-output.mjs /tmp/c-new .scratch/out-newpython3 tests/same-output-compare.py .scratch/out-old .scratch/out-new -v # every page, README, icon, css, manifest, worker, browser module;# hydrated DOM of the 9 pages; file-upload drop + choose; md-editor drop; stored files' sha256python3 tests/same-output-modules.py .scratch/out-old .scratch/out-new # browser modules: same component code + imported functions```Masks: `?v=` hashes, source positions, times, upload names. Two runs of one tree compare clean. A moved static changes only a module'simport tables; dropping `let` turns `var` into `const` in the modules (nothing else).- **Layouts theme gate** after a component change: commit here, then in layouts.worldapi.org `tools/sync-components.sh <commit>`(byte-verbatim copies out of git) — or for a dry run copy layouts code-only and copy `components/<name>/*` over its `components/<name>/` —, then `LAYOUTS_GATE_PORT=8750 LAYOUTS_GATE_CHROME=8751-8759 node tests/browser.mjs` (73/0) and`node theme/check-theme.mjs .` (0 problems) in that copy — never in parallel with this gate (same ports).- `./deploy.sh` on Loreana (architect): gate → backup → rsync → `docker compose up -d --build` on Byrodin (port 45006) → URL 200.## History and worker briefs- `LOG.md` — append-only history, one dated line per step (moved here from the antcolony LOG on 2026-10-01).- `missions/NNN-*.md` — worker briefs for this app; `reports/NNN-*.md` — their reports (same name). Numbered perproject since 2026-10-01 (antcolony#40); older text, code comments and commits use the old antcolony numbers →map: `/media/STORAGE/projects/antcolony-docs/docs/mission-map.md` (Byrodin: `/CONTAINERS/projects/antcolony/docs/mission-map.md`).
Branches
Latest commits
- 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
- 3f93d716components code order (mission 002) 4/4: docs, tests/letcount.py, tests/same-output*, reportmre
- e747cfa0components code order (mission 002) 3/4: let only where reassigned (257 dropped, 0 never-reassigned left); gate 220/0, layouts gate 73/0, same outputmre