Expand description
The webview renderer for makeover_layout.
This crate takes no Palette. It emits CSS that names intents
(var(--surface-raised)), and the browser resolves them against whatever
themes.js last wrote onto :root.
§The stylesheet
stylesheet writes the component CSS. Part of what it emits is the
withdrawal of user-agent chrome: reset is where a primitive says which
parts of its element’s default look it does not take.
Pressed carries its fill: interactive_rules emits Depth::pressed
whole, so a control presses to --surface-well and hovers to
--hover-surface. A badge is flat (token_rules). No class prefix ships
by default.
§The markup’s names
The vocabulary’s members (fields, choices, columns, figures, meters, charts,
acts and the rest) are drawn by the quasi hosts: quasi-webview for this
renderer. This crate keeps what those hosts and hand-written apps share
with it:
form: the escaper,form::Markupandform::Filling, the field classes and the rules behind them. One function covers element text and attribute values.list: column names as classes, the kind, part and flow classes, the cell wrapper and sizer, and theshort-Nandstacks-Nladders a table narrows and stacks by.chart,figure,meter: class lists and rules only.facetrendersmakeover_layout::Facetitself: a dimension a set is narrowed by, where one gesture both selects a value and moves the browse position.placeholderdraws the stand-in a region shows while it has nothing.
The table rules (table_rules) are private and reach a consumer only
through stylesheet. Every class a host’s markup can carry is in one of
the modules’ class lists, and vocabulary::names is their union with the
generated sheet.
§Interaction states
interactive_rules emits four states, in emission order, and the order is
load-bearing: they are all specificity (0,2,0), so disabled beats hover by
coming last. No rule uses :not(:disabled).
Hover sits inside a capability query: makeover-layout’s Affordance
answers whether the pointer has hover and makeover-geometry spells the
condition.
§The layer contract
stylesheet emits into the makeover cascade layer (CSS_LAYER,
defined in makeover-geometry). makeover-geometry layers the density and
size-class blocks of geometry.css the same way; the compactness block
that closes that file is unlayered.
The cascade resolves origin and importance, then layer, then specificity, then source order, and unlayered normal declarations outrank every named layer. An app declares the order once, or the layer’s position is decided by whichever generated file the browser sees first:
@layer makeover, base, components, responsive;in_css_layer is re-exported for an app that assembles its own stylesheet
from this crate’s pieces, so the rules it generates from them land in the
same layer.
§Form rules
The field markup is the hosts’ and the look is this crate’s. A few rules key on a mark the markup carries rather than a class:
- A markdown field is marked
data-format="markdown", andform::editor_ruleskeys on that mark. The Write/Preview pair is a segmented control, taking the depth, the focus ring and the chosen state from the existing rules; the preview pane is a well. This crate renders no markdown: the pane is filled by whatever binds the editor. - A suggestion’s second line,
.form-suggestion-detail, is drawn in--content-mutedrather than in the disabled token, as are.form-option-detailand.form-unit. - An unavailable option’s reason is
.form-option-reason, and a group with an error carrieshas-errorwhile its message carriesvisible(form::FIELD_STATE_CLASSES).
§A cell says what it holds
CellPart names the four things a cell holds,
and table_rules turns them into .cell-value, .cell-tokens,
.cell-actions and .cell-link. The value and the link take a colour; a
token carries its own tone and an action is a control. The colour goes on
.cell-value, not on .cell, so it does not cascade into a control in the
cell.
§A table narrows itself
No rule is written per table. table_rules lays every table out as flex
rows, each column starting at its declared floor and giving up room by its
Priority, so the browser narrows a table at
the width its floors add up to. A host puts the column’s classes on every
cell (its name through list::push_column_name, its width and drop tiers
from list::CELL_WIDTH_CLASSES and list::CELL_DROP_CLASSES, its kind
from list::kind_class), and every cell’s contents go in
list::CELL_IN. A header row emitted by a renderer’s own code has to do
both too, or the header and the body disagree about which column just
closed and how wide the rest are.
.button takes the four tones off data-tone as a background tint
(--{tone}-surface) and, unlike the badge, no edge colour. A list is reset
rather than left bulleted. A row’s actions are never hidden until hover.
§The depth classes are not controls
.raised states a shape and carries no interactive set. .button is the
same depth and a control, and takes its states from surface_rules.
.card is a raised object that answers a pointer only when the element it
is written on is a control: a, button, label, or anything carrying
data-act.
§A theme with no well
Each renderer answers a theme with no surface-well its own way:
makeover-immediatesubstitutes nothing: itsPalette::from_themefails withMissingToken.makeover-tuidraws an edge instead.- here,
var(--surface-well, var(--surface-page))falls back in the browser.
Modules§
- build
- Build-script support: the generated files every webview consumer
materialises from its
build.rs, and the checks that keep its hand-written frontend agreeing with them. - chart
- The stylesheet half of a chart: a run of magnitudes against one axis, drawn as bars.
- facet
- A dimension a set is narrowed by, rendered as a list of values.
- figure
- The stylesheet half of a figure with a caption, and a strip of them.
- form
- The forms half: the escaper, the field classes and the rules a described field’s markup is drawn with.
- list
- The classes a list’s or a table’s columns, rows and cells carry.
- meter
- The stylesheet half of a meter: a proportion, drawn as a bar.
- placeholder
- What a region shows when it is not showing its content.
- reset
- What an HTML element brings uninvited, and how a primitive gives it back.
- vocabulary
- Every class this crate is responsible for, as a set rather than one name at a time.
Structs§
- Emit
- How the emitted CSS and markup are shaped, and the copy they carry.
Constants§
- CSS_
LAYER - The cascade layer every stylesheet the make-family generates is wrapped in.
- DENSITY_
CHOICE_ ATTR - The attribute a
FieldKind::Densitypicker carries, which is howVARS_JSfinds it. - DENSITY_
STORE_ KEY - The browser storage key a device’s density choice is kept under.
- RUN_
CLASSES - Every run class:
run, every classfallback_classcan return, andrun-overflowandrun-overflow-items, the overflow control a measuring script builds. A test holds the list tofallback_class. - STRIP_
CONTAINER - The container a vertical tab strip’s arrangement names when it can fold the strip over its pane.
- STRIP_
FOLD - The inline size of
STRIP_CONTAINERunder which a vertical strip runs across its pane. An arrangement that folds the strip folds at this width, or the tabs draw one way while laid out the other. - VARS_
ATTR - The attribute an element’s custom properties ride in, instead of
style. - VARS_JS
- The script that applies
VARS_ATTR, for a host to serve beside its other assets. - VERSION
- This crate’s version, as the generated stylesheet reports it.
Functions§
- bevel_
properties - The custom properties the bevels and edges resolve through, as
:rootdeclarations: one perBevel(bevel_var: raised, inset, raised open), the open bevel turned a quarter (--bevel-raised-open-side), the overlay cast (--elevation-overlay) and the control edge (--edge-control). A consumer that wants an edge without the fill reads the property directly. - bevel_
shadow - The two-tone edge as a
box-shadowvalue. - bevel_
var - The CSS custom property holding a bevel’s composition.
- class
- A prefixed class name.
- component_
rules - The component layer: the rules of every named component. No scrollbar rules.
- density_
options_ into - Write the options of a density picker, in
DENSITY_CHOICESorder. - depth_
class - The class name for a depth:
raised,wellorsunken, prefixed, andNoneforDepth::Flatand any depth this renderer does not know. - depth_
declarations - The fill and edge declarations for a depth, as a rule body.
- depth_
rule - One rule giving a selector a depth, or nothing when the depth declares nothing.
- depth_
rules - The depth classes’ rules, fill and edge together:
.raisedand.well.depth_classalso namessunken, which gets no rule here. - disabled_
rule - Present, visible, and not answering.
- fallback_
class - The class a run carries for what it does when it is tight.
- fill_
var - A
var()reference to a fill intent, with the browser’s own fallback where the intent may be absent. - focus_
rule - The keyboard focus ring, placed by the depth it lands on.
- in_
css_ layer - Wrap generated CSS in
CSS_LAYER. - interactive_
rules - Every state a selector that answers a click implies: hover, pressed, focus and disabled, in that order.
- option_
class - The class an option of a selector carries, which is what the rules key off.
- pressable_
card - The compound a card’s interactive states are written against: the class on an element that is itself a control.
- push_
class - A prefixed class name, written into a buffer the caller already has.
- stylesheet
- The whole phase-A stylesheet: properties, depth rules and components, in
CSS_LAYER, under a generated-file banner.