Skip to main content

Module meter

Module meter 

Source
Expand description

A proportion, rendered as a bar.

The third phase-B emitter, beside form and list. It is much the smallest, and it is here rather than in the app because the trough it fills has been in phase A since before anything could describe one: progress_rules emitted .progress and .progress-fill[data-tone] for every tone while the only way to say “3 of 7” was to concatenate it into a heading.

§What the pair buys, at the last layer

makeover_layout::Meter carries done and total rather than a percentage, and the reason shows up here. A bar that is full because it landed exactly and a bar that is full because it ran over are the same width and are not the same fact, so the width is not allowed to be the only thing emitted.

§Neither number is divided here

--meter-done and --meter-total go out as themselves and progress_rules does the arithmetic. That is the property the residual seam needs, and chart states the reasoning in full: a residual is derived once from stand-in values, so a number this crate WORKS OUT from two of them is not a stand-in any filler can find, and one request’s percentage bakes into the template. A number handed over whole stays a hole.

It also retires data-over. That flag existed because a percentage was the only thing emitted, so the over-run had nowhere else to live; with both integers in the markup the comparison is there to be read, and a stylesheet that wants to react can make it where it uses it. Dropping it also clears a collision: quasi-webview writes data-over="<selection>" on a control, and goingson’s quasi-selection.js selects [data-over] blind.

What an over-run should look like stays app taste – goingson says it with Tone::Danger – and a renderer that picked a stripe for everyone would be decorating rather than describing.

Constants§

METER_CLASSES
Every class this module can put in markup.

Functions§

meter_html
A meter as a filled trough.
meter_html_into
A meter, written into a buffer the caller already has.
meter_text
The accessible name for a meter: the two numbers, and the noun if it has one.