Repository navigation
dmvs_html: what a car HMI page needs - listeners, inline SVG, images - #3
Merged
Merged
Conversation
From converting a second real page (a 480x272 car HMI in Tailwind):
Scripts
- addEventListener('click', ...) and el.onclick = ... set up while the
page loads, with arrow / function expressions closing over their
scope; querySelector() / querySelectorAll() (css_select), forEach()
unrolled, getAttribute(), el.click() running an element's handlers,
string concatenation.
- Several class changes of an element in one handler are one look of
it (MOD_CLASSES "+a -b", a <id>_look variable for its looks).
- visibility: hidden fades as opacity 0.
Layout and style
- tailwind.config's theme.extend.fontFamily (Inter as font-sans).
- The static position of an absolutely positioned flex child follows
justify-content / align-items.
- content: '' makes a ::before / ::after box (a nav indicator).
Images
- object-fit / object-position of <img>; background-image: url() under
its gradients, background-size, background-position (also in the
background shorthand); filter: blur() blurs the image - as
dmvsi_image_t width / height / blur and DMVSI_IMAGE_* placement.
Tailwind's bg-cover, bg-center, object-cover, ...
- Inline <svg>: a replaced element whose subtree is written into an
SVG file of its box's size ($TMPDIR, <page>-svg<index>.svg), the
viewBox and camelCase names kept, currentColor resolved; drawn as an
image (dmimg_svg rasterizes it).
The dmodOS fixture converts to the same view as before.
Needs dmvsi with dmvsi_image_t width / height / blur.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds what a second real page needed: a 480×272 car HMI in Tailwind, with tabs, a speedometer gauge, a map with a route, and a music player with album covers. Its layout comes out close to Chrome's. Tab navigation (with the crossfade) and the mini-player opening the player work on the STM32F746G-DISCO.
Scripts
addEventListener('click', …)andel.onclick = …set up while the page loads. Arrow and function expressions close over their scope.querySelector()/querySelectorAll()(newcss_select),forEach()unrolled at conversion,getAttribute().el.click()runs an element's handlers inline. String concatenation works.MOD_CLASSES "+a -b", a<id>_lookvariable).visibility: hiddenfades as opacity 0.Layout and style
tailwind.config→theme.extend.fontFamily(Inter asfont-sans).justify-content/align-items.content: ''makes a::before/::afterbox (the nav indicator).Images
<img>:object-fit(cover,contain,fillwith the aspect kept,none,scale-down) andobject-position.background-image: url()under its gradient layers, withbackground-sizeandbackground-position. These also work in thebackgroundshorthand. Tailwind'sbg-cover,bg-center,object-coverand similar are mapped.filter: blur()on an element blurs its image. todmvs/todmvi make the blurred image once, at conversion.<svg>: it is now a replaced element. Its subtree is written into an SVG file of its box's size ($TMPDIR/<page>-svg<index>.svg), with theviewBoxand SVG's camelCase names kept andcurrentColorresolved. It is drawn as an image, and dmimg_svg rasterizes it.Depends on
feature/image-size:dmvsi_image_tgetswidth/height/blurand theDMVSI_IMAGE_*placement flags.feature/image-sizes, todmvifeature/blur, dmodfeature/image-blur-svg, dmimg_svgfeature/decoder, for the whole path to the board.Testing
test_dmvs_htmlpasses 8/8. Two steps are new:dmvs_html_draws_svg_and_images: the SVG file and its attributes,object-fit: cover,background: url() right bottom / containwithblur();dmvs_html_converts_listeners:querySelectorAll+forEach+addEventListener..dmvs, compared withmain.Known gaps
classList.replaceis not converted.🤖 Generated with Claude Code