Repository navigation
dmvs_html: scripts compiled by dmvs_js - the host of its DOM - #4
Merged
Merged
Conversation
The page's scripts and onclick code are compiled by dmvs_js into the view's code (init, click handlers, timers, variables); script.c is now its host. Its own evaluator goes; what it did stays: a class or style change is laid out (moves, fades by transitions; other looks as variants; classes changed together - up to the compiler's flush - one look; pressed looks). A change is a CALL of a handler made when every change is laid out; one of the element a variable holds an IF for each element dmvs_js_object_domain() gives. innerText / textContent are text variables, with a number shadowing them (parseFloat(innerText)), painted on the element's first line, placed by text-align. Click handlers copy their listeners' actions (dmview's calls are 8 deep). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ned not set A text a script sets in a box as wide as its text (a flex item, its column as narrow) gets the room of the first wider ancestor, placed as the box is in it - centred, at its right, or from where it is: the car HMI's speed was "6" of 68. A text that is undefined is not set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The scripts' loading evaluated by dmvs_js (every variable known, functions run at each call): the elements they make - createElement, className, innerHTML of markup, appendChild - recorded as operations on the page's elements, applied each time it is laid out (its states too). A made element is marked data-dmvs-built="k": the compilation's k-th createElement() is it, so its listeners are its clicks; what it sets of it (className, innerHTML, appendChild, emptying its list) is as it was. The car HMI's playlist: its five songs, the current one highlighted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… look
el.className set to one of known class lists (a row rendered as
`row ${active ? 'on' : ''}`): a change to each, on which it is - the
row's looks follow the current song. img.src set to one of known images
(playlist[i].cover): a variant of the image for each, shown on its
variable. An element's look counts its text (an icon font's ::before):
play / pause changed nothing before.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A look of an element is laid out in a state of the page, where a screen hidden as the page loads (visibility) still is: revealed in the page by the change that shows it, not in the states. A row of a list in such a screen was painted unseen in its other look - it vanished when another song was chosen. A look is now seen where the element is. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A box that scrolls (overflow: auto) scrolls what is in it: a flex column of a definite height (flex-1) is laid out as tall as it is, its content height that too - so the playlist's queue, longer than its box, did not scroll. What can be scrolled to is now as far down as its children go, with its bottom padding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Keyframes (and Tailwind's spin, ping, pulse, bounce; animate-*, animate-[...]) of what dmview can move - transform: translate, opacity: an element animated gets its group's variables, and the view one timer, every 20 ms starting each animation's segment that is due (an ANIMATE to the next keyframe, its timing function and time; infinite; alternate there and back). The car HMI's equalizer bars bounce; rotate / scale (its spinning cover) are reported, not drawn. An image's corners: its own border-radius, or that of a box around it that clips and that it fills (a cover in a round frame) - dmvsi's image radius, made round by todmvs / todmvi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
dmvs_html loads dmvs_js to convert a page's scripts, so every conversion in the tests needs it installed. CI installs only what the test module's .dmd lists (dmf-get install -d), which was dmvsi alone: all 11 steps failed with "Cannot load required module 'dmvs_js'". It passed locally because dmvs_js was already installed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The test's .dmd lists what the test itself imports (dmvsi). dmvs_js is imported by dmvs_html, the module under test, so only its .dmd lists it: CI installed one package and every step failed with "Cannot load required module 'dmvs_js'". The ctest command had the same gap. Co-Authored-By: Claude Sonnet 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
The page's scripts are now compiled by dmvs_js. dmvs_html's own evaluator (lexer, parser, abstract runner: about 1800 lines) is gone, and
script.cis now the compiler's host, i.e. the DOM. Scripts get the whole language dmvs_js compiles:setTimeout/setInterval/clearInterval);innerText/textContent);parseFloat,toFixed,Math);Before, all of that was reported and left out.
What the host does
getElementById,querySelector(All)(an array) andgetAttribute, resolved at conversion.classList.add / remove / toggle / replace / containsandstyle.<property> = <static text>are laid out as before: moves and fades are variables animated by CSS transitions, other looks become variants, and:activegives pressed looks.CALLof a handler reserved during compilation and filled once every change is laid out.flushhook marks where the code changes direction, as the old code did.let current = null; … current = w): a change of the element a variable holds is anIFfor each elementdmvs_js_object_domain()gives.innerText/textContentis a text variable of 64 bytes.text-align.parseFloat(el.innerText)reads the number it shows.addEventListener('click', f),el.onclick = fandonclick="…"(withthisset to the element) make up an element's click handler.el.click()calls it.IFs copy their callees' actions instead of calling them, because dmview's calls nest only 8 deep.Still reported and left out:
createElement/innerHTML,src,setAttribute, styles known only at runtime,Date.Depends on
dmvs_js@>=0.1anddmvsi@>=0.4, so CI can't pass until that release exists.APPEND, format 0.5).Added after the board test (car HMI)
createElement,className,innerHTMLwith markup andappendChildare recorded as operations on the page's elements, and applied on every layout, states included.data-dmvs-built="k", so the compilation's k-thcreateElement()is that element, and its listeners become clicks.innerHTMLset to text in an element with no child elements becomes its text (the climate temperatures).Added for the car HMI's home screen and queue
@keyframes, Tailwind'sspin/ping/pulse/bounce, andanimate-*/animate-[...]are supported for what dmview can move:transform: translateandopacity.ANIMATEto the next keyframe with its timing function and duration. Animations repeat forever (infinite), andalternategoes there and back.border-radius, or of a box around it that clips and that it fills. Examples: a cover in a round frame, the queue's thumbnails.radius(dmvsi: an image's radius - shown in a rounded box dmvsi#6), which todmvs (dmvs_html: scripts compiled by dmvs_js - the host of its DOM #4) and todmvi (libtodmvi: cut and round - what a rounded box shows of an image todmvi#3) turn into a round image.classNameset to one of known class lists becomes a change to each list, applied according to which one it is. The queue's highlight follows the current song.img.srcset to one of known images becomes a variant per image, shown by its variable. The cover changes with the song.::before(play / pause) counts as a different look.Testing
test_dmvs_htmlpasses 11/11 locally (with dmvs_jsfeature/host-objects).CALLs inlined (flat_actions()). Those are the same actions the old code emitted: windows sliding in with their transition,currentheld and tested, a class toggled.setIntervaland a temperature changed by a click withparseFloat/toFixed. It checks:The car HMI (
car_hmi_480x272.html) converts with todmvs (#4) into 36 boxes and 247 instructions, and assembles with todmv (#7) into a 53 KB view. It hasn't been tested on the board yet.🤖 Generated with Claude Code