| 189 |
189 |
|
//! a renderer emits for one.
|
| 190 |
190 |
|
//!
|
| 191 |
191 |
|
//! `RowPart::revealed_on_hover` also stops being honoured, which its own doc
|
| 192 |
|
- |
//! sanctions: a renderer decides. The rule hid a row's actions until hover,
|
|
192 |
+ |
//! sanctioned: a renderer decides. It was retired outright in makeover-layout
|
|
193 |
+ |
//! 0.13.0, once this had been its only consumer for a release. The rule hid a
|
|
194 |
+ |
//! row's actions until hover,
|
| 193 |
195 |
|
//! and every escape it grew was a report that hiding was wrong for somebody:
|
| 194 |
196 |
|
//! `focus-within` for the keyboard, the capability gate for a fingertip with no
|
| 195 |
197 |
|
//! way to unhide. What survived hid the controls from pointer users alone, who
|
| 768 |
770 |
|
let _ = writeln!(css, ".{c} {{\n color: var(--{});\n}}", part.intent());
|
| 769 |
771 |
|
}
|
| 770 |
772 |
|
|
| 771 |
|
- |
// `RowPart::revealed_on_hover` is deliberately not honoured, and its
|
| 772 |
|
- |
// own doc is what sanctions that: "a renderer with no hover shows it
|
| 773 |
|
- |
// always. That is a renderer decision and this returning `true` does
|
| 774 |
|
- |
// not forbid it." This renderer now makes the same decision for every
|
| 775 |
|
- |
// device, and the reasoning is the one the gate had already been
|
| 776 |
|
- |
// forced into twice.
|
|
773 |
+ |
// A row's actions are shown at rest. `RowPart::revealed_on_hover` said
|
|
774 |
+ |
// otherwise and was not honoured here from 0.23.0; makeover-layout
|
|
775 |
+ |
// 0.13.0 retired the method, so there is no longer a description saying
|
|
776 |
+ |
// one thing and a renderer doing another.
|
| 777 |
777 |
|
//
|
| 778 |
778 |
|
// The rule was `opacity: 0` gated to pointer devices, revealed on
|
| 779 |
779 |
|
// `:hover` and on `:focus-within`. Each escape it needed was a report
|
| 855 |
855 |
|
let figure = class("figure", opts);
|
| 856 |
856 |
|
let value = class("figure-value", opts);
|
| 857 |
857 |
|
let caption = class("figure-caption", opts);
|
|
858 |
+ |
let change = class("figure-change", opts);
|
| 858 |
859 |
|
let mut css = String::new();
|
| 859 |
860 |
|
|
| 860 |
861 |
|
let _ = writeln!(
|
| 866 |
867 |
|
css,
|
| 867 |
868 |
|
".{figure} > .{caption} {{\n color: var(--content-muted);\n}}"
|
| 868 |
869 |
|
);
|
|
870 |
+ |
let _ = writeln!(
|
|
871 |
+ |
css,
|
|
872 |
+ |
".{figure} > .{change} {{\n color: var(--content-muted);\n}}"
|
|
873 |
+ |
);
|
| 869 |
874 |
|
|
| 870 |
|
- |
// A toned figure tones the value and never the caption. The caption is the
|
| 871 |
|
- |
// noun and stays muted; the number is the thing that is saying something.
|
|
875 |
+ |
// A toned figure tones one part and never the caption. The caption is the
|
|
876 |
+ |
// noun and stays muted.
|
|
877 |
+ |
//
|
|
878 |
+ |
// Which part depends on whether there is a change, and that is the whole of
|
|
879 |
+ |
// what 0.13.0 changed here. A figure with a delta is an ordinary number that
|
|
880 |
+ |
// has moved in a direction worth reading, so the delta takes the colour and
|
|
881 |
+ |
// the number stays plain; a figure without one has nowhere else to put it.
|
|
882 |
+ |
// `:has` is what lets one attribute mean both, and the alternative was the
|
|
883 |
+ |
// emitter deciding by writing the attribute onto a different element, which
|
|
884 |
+ |
// leaves two elements able to disagree about a figure's one meaning.
|
| 872 |
885 |
|
for tone in [Tone::Info, Tone::Success, Tone::Warning, Tone::Danger] {
|
| 873 |
886 |
|
let _ = writeln!(
|
| 874 |
887 |
|
css,
|
| 875 |
|
- |
".{figure}[data-tone=\"{0}\"] > .{value} {{\n color: var(--{0});\n}}",
|
|
888 |
+ |
".{figure}[data-tone=\"{0}\"] > .{change} {{\n color: var(--{0});\n}}",
|
|
889 |
+ |
tone.token()
|
|
890 |
+ |
);
|
|
891 |
+ |
let _ = writeln!(
|
|
892 |
+ |
css,
|
|
893 |
+ |
".{figure}[data-tone=\"{0}\"]:not(:has(> .{change})) > .{value} \
|
|
894 |
+ |
{{\n color: var(--{0});\n}}",
|
| 876 |
895 |
|
tone.token()
|
| 877 |
896 |
|
);
|
| 878 |
897 |
|
}
|
| 1484 |
1503 |
|
// order; the point is that neither is reached for.
|
| 1485 |
1504 |
|
assert!(!css.contains("display: none"), "{css}");
|
| 1486 |
1505 |
|
assert!(!css.contains("visibility:"), "{css}");
|
|
1506 |
+ |
}
|
| 1487 |
1507 |
|
|
| 1488 |
|
- |
// The description still says the part is revealed on hover. That is a
|
| 1489 |
|
- |
// renderer's decision to make, in the words of the method's own doc,
|
| 1490 |
|
- |
// and this renderer now decides otherwise for every device.
|
| 1491 |
|
- |
assert!(RowPart::Actions.revealed_on_hover());
|
|
1508 |
+ |
#[test]
|
|
1509 |
+ |
fn a_figures_tone_lands_on_the_delta_when_there_is_one() {
|
|
1510 |
+ |
// 0.13.0. The delta is the part that reads as good or bad; the number
|
|
1511 |
+ |
// itself is an ordinary fact. A figure with no delta has nowhere else to
|
|
1512 |
+ |
// put the colour, so the value takes it, and `:has` is what lets one
|
|
1513 |
+ |
// attribute mean both without the emitter choosing an element.
|
|
1514 |
+ |
let css = stylesheet(&Emit::default());
|
|
1515 |
+ |
|
|
1516 |
+ |
assert!(
|
|
1517 |
+ |
css.contains(".figure[data-tone=\"success\"] > .figure-change"),
|
|
1518 |
+ |
"{css}"
|
|
1519 |
+ |
);
|
|
1520 |
+ |
assert!(
|
|
1521 |
+ |
css.contains(
|
|
1522 |
+ |
".figure[data-tone=\"success\"]:not(:has(> .figure-change)) > .figure-value"
|
|
1523 |
+ |
),
|
|
1524 |
+ |
"{css}"
|
|
1525 |
+ |
);
|
|
1526 |
+ |
// The caption is the noun and never takes the tone.
|
|
1527 |
+ |
assert!(
|
|
1528 |
+ |
!css.contains("[data-tone=\"success\"] > .figure-caption"),
|
|
1529 |
+ |
"{css}"
|
|
1530 |
+ |
);
|
| 1492 |
1531 |
|
}
|
| 1493 |
1532 |
|
|
| 1494 |
1533 |
|
#[test]
|