makeover-webview 0.130.0

The webview renderer for makeover-layout. Emits CSS, and is the one renderer that needs no palette: var() is the late binding, so resolution stays with the browser. With the build feature, writes a consumer's generated frontend files and checks the hand-written ones against them.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
//! The surfaces with a name, links, tokens, selectors and joined segments.

use crate::reset::Reset;
use crate::{
    DISABLED, Emit, OPEN_SIDE_VAR, STATUS_TONES, STRIP_CONTAINER, STRIP_FOLD, bevel_var, class,
    depth_rule, disabled_rule, fill_var, focus_rule, gated, hover_condition, interactive_rules,
    option_class, pressable_card, rest_declarations, tone_rules, toned_surface,
};
use makeover_layout::{Bevel, Depth, Fill, Intent as _, Selector, State, Token};

/// The three surfaces that are a depth with a name.
///
/// `button` and `card` are both [`Depth::Raised`], and `field` is a
/// [`Depth::Well`], the reading `Depth`'s own documentation gives a text
/// field. Each body comes from one [`depth_rule`] call per depth.
///
/// A card's states hang off [`pressable_card`] rather than the bare class: a
/// card answers a pointer only when it is written on a control (a link, a
/// label round a radio), and a card on any other element has no hover.
pub(crate) fn surface_rules(opts: &Emit) -> String {
    let mut css = String::new();
    let button = class("button", opts);
    css.push_str(&depth_rule(&button, Depth::Raised));
    css.push_str(&interactive_rules(&button, Depth::Raised, opts));

    let card = class("card", opts);
    css.push_str(&depth_rule(&card, Depth::Raised));
    css.push_str(&interactive_rules(
        &pressable_card(&card),
        Depth::Raised,
        opts,
    ));

    let field = class("field", opts);
    css.push_str(&depth_rule(&field, Depth::Well));

    // A field takes focus and refuses input like everything else here, and got
    // neither until now, which is why all three apps hand-write a focus ring
    // for it and no two of them match. No hover or pressed: a text field does
    // not light up under the pointer and does not invert when clicked, so the
    // two states `interactive_rules` would add are the two it does not have.
    css.push_str(&focus_rule(&field, Depth::Well, opts));
    css.push_str(&disabled_rule(&field, Depth::Well));

    // A multiline field shows its value, not a window onto it: a whole message
    // is content, not a scroll. `field-sizing: content` grows the `<textarea>`
    // with its value up to its container's ceiling; the floor is three lines,
    // the resting height and the answer for an engine without the property.
    // Scoped to `textarea`: a single-line input or select is already its own
    // size and must not grow. The floor rides a custom property the way the
    // table's `ch` floors do, so an app that wants a taller resting field says
    // so once instead of restyling the rule.
    putln!(
        css,
        "textarea.{field} {{\n    field-sizing: content;\n    min-block-size: var(--field-min-lines, 3lh);\n}}\n"
    );

    // A file field's own button is a button. `::file-selector-button` is the
    // one part of an `<input type="file">` a stylesheet reaches, and without a
    // rule the platform's grey control sits inside a well drawn in the theme's.
    // Raised, with the hover and the press a button has; no focus ring, because
    // the focus belongs to the input the pseudo-element is part of, and the
    // field's own ring already draws it.
    let chooser = format!("{field}::file-selector-button");
    css.push_str(&depth_rule(&chooser, Depth::Raised));
    putln!(
        css,
        ".{chooser} {{\n    border: none;\n    color: inherit;\n    font: inherit;\n    padding: var(--gap-bound) var(--gap-peer);\n    margin-inline-end: var(--gap-peer);\n    cursor: pointer;\n}}"
    );
    css.push_str(&gated(
        hover_condition(),
        &format!(".{chooser}:hover {{\n    background: var(--hover-surface);\n}}\n"),
    ));
    css.push_str(&depth_rule(
        &format!("{chooser}:active"),
        Depth::Raised.pressed(),
    ));
    // A disabled field's button stops answering with it. The state goes on the
    // input, before the pseudo-element, which a state cannot follow.
    putln!(
        css,
        ".{field}{DISABLED}::file-selector-button {{\n{}    cursor: not-allowed;\n}}",
        rest_declarations(Depth::Raised)
    );

    // Keyed on the ARIA attribute rather than on a class, so the visual state
    // and the accessible state cannot drift apart: there is one fact and both
    // read it. goingson already drove its invalid styling this way and was
    // right to; the `.invalid` class this emitted before 0.5.0 was a second
    // place to forget.
    //
    // The ring composes *after* the bevel rather than replacing it. box-shadow
    // is not additive, so a lone ring silently dropped the well out from under
    // an invalid field. Flat and unlit: this edge is saying "wrong", and
    // lighting one side would have it say "raised" at the same time.
    putln!(
        css,
        ".{field}[aria-invalid=\"true\"] {{\n    box-shadow: var({}), 0 0 0 {} var(--danger);\n}}",
        bevel_var(Bevel::Inset),
        opts.border_width
    );

    // The default-button ring, on the one control that commits
    // (the act that commits, wiki `explicit-commit-affordance`).
    // A flush frame twice the border width, composed after the bevel for the
    // invalid ring's reason, and outside the element, so the focus outline,
    // which stands off by its own width, lands beside it rather than over it.
    // The label keeps the weight every button has: the ring is the whole mark,
    // and a bold label made the default a different width from its neighbours.
    // Pressed keeps the ring and inverts only the bevel. Disabled drops the
    // ring: the ring says "this is what Return does",
    // and a control Return cannot reach is not the default. goingson's bulk
    // bars are the site: Complete and Delete stand disabled until a row is
    // ticked, and ringed they read as the strongest controls on a page with
    // nothing selected.
    //
    // An attribute rather than a class, for `data-tone`'s reason: it is a fact
    // about the act, and a renderer writes it beside the tone.
    let ring = format!("0 0 0 calc(2 * {})", opts.border_width);
    putln!(
        css,
        ".{button}[data-commits] {{\n    box-shadow: var({}), {ring} var(--border-strong);\n}}",
        bevel_var(Bevel::Raised)
    );
    putln!(
        css,
        ".{button}[data-commits]:active {{\n    box-shadow: var({}), {ring} var(--border-strong);\n}}",
        bevel_var(Bevel::Inset)
    );
    putln!(
        css,
        ".{button}[data-commits]{DISABLED} {{\n    box-shadow: var({});\n}}",
        bevel_var(Bevel::Raised)
    );

    // The act the screen is for (the leading act).
    //
    // **Leading fills and committing outlines**, which is what lets a control
    // wear both. The ring above is a frame outside the bevel and this is the
    // ground inside it, so the two compose rather than compete: a form that is
    // the screen's own work draws a filled button with the default ring round
    // it, and a sub-form's Add keeps the ring alone.
    //
    // `--content-on-action` rather than a hand-picked ink. The theme derives it
    // with `readable_on(action)`, so a theme whose action hue is pale gets dark
    // text without this file knowing which themes those are.
    //
    // The bevel stays. A leading control is still a button, and dropping its
    // raise to signal importance would make the one control a reader most needs
    // to press the one that least looks pressable.
    // `:not([data-tone])` is load-bearing, and a render caught it missing.
    // A toned control already says what pressing it means, and that outranks
    // how badly the screen wants it pressed, the rule `makeover-tui` states
    // and this file did not. Without the guard, goingson's compose drew Queue
    // with the Success tone's pale ground under `--content-on-action`'s near
    // white ink, which is a label nobody can read.
    //
    // The tone keeps the control; `leading` adds nothing to it. That is a
    // deliberate loss: a screen whose primary act is destructive or toned has
    // to lead by order and by what the tone already says.
    //
    // Two fills. A lead whose effect stays with the reader takes the routine
    // triple; one marked outward (what other people see, or money) takes the
    // action triple. `:where` holds the outward arms at the routine arms'
    // specificity, so the disabled rule below still wins on source order. The
    // routine triple falls back to the action triple, so a theme sheet built
    // before the routine intent existed draws the lead as it always did.
    let outward = ":where([data-outward])";
    putln!(
        css,
        ".{button}[data-leading]:not([data-tone]) {{\n    background: var(--action-routine, var(--action));\n    color: var(--content-on-action-routine, var(--content-on-action));\n}}"
    );
    putln!(
        css,
        ".{button}[data-leading]:not([data-tone]){outward} {{\n    background: var(--action);\n    color: var(--content-on-action);\n}}"
    );
    // Hover keeps the derived pair, so the fill does not fall back to the
    // ordinary button's ground mid-hover and leave `--content-on-action`
    // stranded on a surface it was never measured against.
    //
    // Gated through `hover_condition` like every other hover rule here: whether
    // a hover state exists at a density is `Affordance`'s to answer, and a
    // rule written outside the gate is this renderer inventing a second answer.
    // The vocabulary test catches exactly that, and caught this.
    css.push_str(&gated(
        hover_condition(),
        &format!(
            ".{button}[data-leading]:not([data-tone]):hover {{\n    background: var(--action-routine-hover, var(--action-hover));\n    color: var(--content-on-action-routine, var(--content-on-action));\n}}\n\
             .{button}[data-leading]:not([data-tone]){outward}:hover {{\n    background: var(--action-hover);\n    color: var(--content-on-action);\n}}\n"
        ),
    ));
    // Disabled drops to the disabled ink on the ordinary button ground: a filled
    // control that cannot be pressed still reads as the thing to press, which
    // is the one thing the fill must not say when it cannot be pressed.
    //
    // Through `fill_var` rather than naming the token, so this follows the
    // ordinary button if the raised fill is ever re-pointed.
    putln!(
        css,
        ".{button}[data-leading]:not([data-tone]){DISABLED} {{\n    background: {};\n    color: var(--{});\n}}",
        fill_var(Fill::Raised),
        State::Disabled.token()
    );
    css
}

/// Text that goes somewhere.
///
/// The inline control, for a link outside a table, such as one inside a
/// described run. A table cell carries `cell-link` instead.
///
/// Colour and underline only; no placement and no spacing. No `:visited`
/// arm.
pub(crate) fn link_rules(opts: &Emit) -> String {
    let mut css = String::new();
    let link = class("link", opts);

    putln!(
        css,
        ".{link} {{\n    color: var(--action);\n    \
         text-decoration: underline;\n}}"
    );
    // The pointer-target floor, and the scope is the whole of the design in it.
    //
    // A bare `.link` is its own line box, 21px at the body size, under the
    // floor `Emit::target_min` names. Applied to every `.link`
    // that floor would reach an anchor set in running prose, where growing the
    // box sets the leading of the paragraph around it: the fix would cost more
    // than the defect. So it is scoped to a link laid out as a piece rather
    // than set in text, which in the emitted markup is one inside a run or a
    // cell, a footer strip, a row of places, a table cell.
    //
    // Both sides, since a one-word link can be narrower than the touch floor.
    // `min-block-size` rather than padding: padding adds to the line box and
    // grows whatever holds the link, where a minimum lets the anchor take room
    // its container usually already has. `inline-flex` is what makes the
    // minimum apply to an inline element at all, and `align-items: center`
    // keeps the text on the box's centre line rather than its top.
    let run = class("run", opts);
    let cell = class("cell", opts);
    let least = opts.target_min;
    putln!(
        css,
        ".{run} .{link},\n.{cell} .{link} {{\n    display: inline-flex;\n    \
         align-items: center;\n    min-block-size: {least};\n    \
         min-inline-size: {least};\n}}"
    );
    // The hover step is the same one every other control takes, and it is a
    // colour rather than a surface: a link has no box to raise.
    css.push_str(&gated(
        hover_condition(),
        &format!(".{link}:hover {{\n    color: var(--action-hover);\n}}\n"),
    ));
    // A link written as a button can be disabled, and then answers no pointer.
    putln!(
        css,
        ".{link}{DISABLED} {{\n    color: var(--{});\n    cursor: not-allowed;\n}}",
        State::Disabled.token()
    );
    // The one ring, placed as on anything standing level with the page.
    css.push_str(&focus_rule(&link, Depth::Flat, opts));
    // A link is often a `<button>` rather than an `<a>`: a renderer picks the
    // element from the method, so a link that writes is a button that has to
    // stop looking like one. What that costs is named in [`reset`].
    css.push_str(&Reset::TEXT_BUTTON.rule(&format!("button.{link}")));
    css
}

/// Badges and chips.
///
/// [`Token::Badge`] is [`Depth::Flat`], so a badge emits no fill and no edge.
/// What a badge does carry is a [`Tone`], the intent family it shares with
/// notices. Neutral is the bare class rather than a variant.
pub(crate) fn token_rules(opts: &Emit) -> String {
    let mut css = String::new();

    // No `depth_rule` call here, deliberately: `Token::Badge.depth(_)` is Flat,
    // and a label with an edge says it can be pressed.
    let badge = class("badge", opts);
    // `content-muted` literally, not `Tone::Neutral.token()`. What makes a
    // badge quiet is `Token::Badge` answering no click, which this crate holds
    // and `Tone` genuinely does not know. Routing it through Neutral put the
    // claim where the evidence was not, and the bill arrived on the figure
    // value: it took the same muting from the same call and read as its own
    // caption. Neutral answers `content`.
    //
    // A badge is a chip, wiki `table-model`: an opaque fill inside an edge, in
    // the theme's own ink at normal weight. Coloured text was never ratified
    // and measured 1.34:1 on goingson's warning; muted text 2.78:1 on
    // solarized-dark. So the ink is `content` and what says which kind of
    // token it is moves to the fill and the edge: the table's raised ground for
    // a neutral chip, makeover's `*-surface` for a status, edged in its tone.
    // Still no bevel: a label with a raised edge says it can be pressed.
    //
    // `inline-block`, not a flex row: a badge whose label outruns its column
    // ends in an ellipsis, and `text-overflow` reads the text as inline content
    // rather than as a flex item. `min-width: 0` overrides the flex-item
    // `min-width: auto`, which would otherwise hold the badge at its label's
    // full width and refuse to shrink to the ellipsis.
    let bw = opts.border_width;
    putln!(
        css,
        ".{badge} {{\n    display: inline-block;\n    min-width: 0;\n    max-inline-size: 100%;\n    \
         overflow: hidden;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n    \
         padding: 0 var(--step-snug);\n    border: {bw} solid var(--border);\n    \
         border-radius: var(--radius-fine);\n    background: var(--surface-raised);\n    \
         color: var(--content);\n    font-weight: normal;\n}}"
    );
    tone_rules(&mut css, &format!(".{badge}"), toned_surface);

    // A button carries the four tones a badge does. It had none, on the reading
    // that a control's colour is its surface rather than its text, and that
    // reading has one hole big enough to matter: the button that destroys
    // something. Every consumer had written that rule itself, and a description
    // that says `Tone::Danger` on an act had nowhere for it to land.
    //
    // A fill and not the text, matching the badge exactly. Coloured text is
    // the shape wiki `table-model` ruled out for status text, and
    // `{tone}-surface`'s own derivation comment says why: the tone colours are
    // fills, and a fill used as
    // ink measures 3.36:1 for danger and 1.84:1 for success on goingson's
    // theme. Both are under the 4.5:1 floor, and success is under it by more
    // than the floor itself.
    //
    // It read as ratified for longer than it was because goingson set
    // `color` on `.button` in a later layer, so no described tone ever reached
    // a button and nobody saw the colour it would have drawn.
    //
    // The earlier note here said a red surface belongs to an app's own layer.
    // That argument was against a *saturated* fill, and it still holds: this is
    // the ground with 12 percent of the tone in it, which is the same tint a
    // status chip carries and is not something an app would draw over.
    //
    // The fill and NOT the edge, which is where this differs from the badge.
    // A badge's border is makeover's, so the badge tones it. A button's is the
    // app's: goingson writes `border: ... solid var(--border)` on `.button` in
    // a later layer, and a shorthand cancels a generated `border-color` the
    // same way its `color` cancelled the tone for months. goingson's own drift
    // check caught it on the first build. An edge an app silently overrides is
    // worse than no edge, so the tint carries the tone alone.
    let button = class("button", opts);
    for tone in STATUS_TONES {
        putln!(
            css,
            ".{button}[data-tone=\"{0}\"] {{\n    background: var(--{0}-surface);\n}}",
            tone.token()
        );
        // The pointer answer, at the specificity the tone rule just took. The
        // plain `.button:hover` is (0,2,0) and sits earlier in this sheet, so
        // without this a toned button is the one control on the screen that
        // does not move under a pointer.
        //
        // The fallback is for the version skew, and it is not decoration: the
        // hover tint is a `makeover` 3.8 token and this sheet is emitted from a
        // crate an app can upgrade on its own. An unresolved custom property
        // makes the whole declaration invalid at computed-value time rather
        // than dropping to the cascade, so without it a toned button on an
        // older theme would hover to `transparent`.
        css.push_str(&gated(
            hover_condition(),
            &format!(
                ".{button}[data-tone=\"{0}\"]:hover {{\n    background: \
                 var(--{0}-surface-hover, var(--hover-surface));\n}}\n",
                tone.token()
            ),
        ));
        // Disabled at the toned hover's specificity and after it, keeping the
        // tone's rest surface: the plain disabled rule is weaker than both.
        putln!(
            css,
            ".{button}[data-tone=\"{0}\"]{DISABLED} {{\n    background: var(--{0}-surface);\n}}",
            tone.token()
        );
    }

    // A chip holds itself down, which is `Depth::pressed` arrived at
    // independently by two apps. `removable` is a remove affordance, so it is
    // markup and waits for phase B.
    let chip = class("chip", opts);
    let unlatched = Token::Chip { removable: false };

    // The pointer floor, and the one number in this file that does not scale.
    // A chip drawn from its padding alone came out 23px at every width and
    // every density in goingson: 36 of one ui-fuzz run's 51 target findings
    // were this single rule. The length arrives from the caller, the way every
    // other length in this crate does, see `Emit::target_min` for why the
    // floor is an absolute rather than a `--step-*`.
    //
    // A floor and not a height: a chip with two lines of text or a larger root
    // size still grows. `.chip` is already `inline-flex` with its items
    // centred, from quasi-webview's box rules, so the extra block size opens
    // around the label rather than under it. `.chip.latched` takes it through
    // the same class; `.badge` is a separate class and deliberately does not,
    // because a badge is a label and never a target.
    putln!(
        css,
        ".{chip} {{\n    min-block-size: {};\n}}",
        opts.target_min
    );

    css.push_str(&depth_rule(&chip, unlatched.depth(false)));
    css.push_str(&interactive_rules(&chip, unlatched.depth(false), opts));
    css.push_str(&depth_rule(
        &format!("{chip}.latched"),
        unlatched.depth(true),
    ));
    css
}

/// The three selectors, each named by what it picks.
///
/// A chosen tab comes *forward* to join the pane it opens:
/// [`Selector::Tabs`] chooses [`Depth::Raised`] where a chosen segment and
/// toggle are held in.
///
/// [`Selector::abutting`] is not emitted: whether the options touch is
/// `makeover-geometry`'s spacing.
///
/// Both the chosen and the unchosen state emit a depth.
pub(crate) fn selector_rules(opts: &Emit) -> String {
    let mut css = String::new();
    for selector in [Selector::Tabs, Selector::Segmented, Selector::Toggle] {
        let c = class(option_class(selector), opts);
        css.push_str(&depth_rule(&c, selector.unchosen()));
        css.push_str(&interactive_rules(&c, selector.unchosen(), opts));
        if selector.joins_its_pane() {
            // Every tab in a folder strip rounds at the top and stays square
            // at the bottom, chosen or not: the corners belong to the strip's
            // shape rather than to which option is up. On the base class and
            // not only on the chosen arm, so that an app has no reason left to
            // carry a radius of its own. goingson's unlayered `.tab` rule beat
            // a chosen-only version of this outright, an unlayered rule being
            // ahead of every layer whatever its specificity.
            putln!(
                css,
                ".{c} {{\n    border-radius: var(--radius-control) var(--radius-control) 0 0;\n}}"
            );
            css.push_str(&joined_rule(&c, selector.chosen(), opts));
        } else {
            css.push_str(&depth_rule(&format!("{c}.chosen"), selector.chosen()));
        }
    }
    css
}

/// The chosen option of a selector that joins what it opens.
///
/// Where [`depth_rule`] draws a closed box, this rule joins the tab to its
/// pane with three declarations together:
///
/// - The depth's own fill, from [`Depth::fill`], so the tab and the pane are
///   the same surface.
/// - [`Bevel::RaisedOpen`], so the run between the two is not drawn.
/// - A pull down by one border width, so the tab covers the pane's own top
///   run where it passes underneath.
///
/// The corners round at the top and stay square at the bottom.
pub(crate) fn joined_rule(selector: &str, depth: Depth, opts: &Emit) -> String {
    let mut body = String::new();
    if let Some(fill) = depth.fill() {
        putln!(body, "    background: {};", fill_var(fill));
    }
    putln!(
        body,
        "    box-shadow: var({});",
        bevel_var(Bevel::RaisedOpen)
    );
    // No radius here. Every tab in a joining strip already rounds at the top
    // from the base rule, chosen or not, and repeating it on this arm would be
    // a second copy of one decision.
    putln!(
        body,
        "    margin-block-end: calc(-1 * {});",
        opts.border_width
    );
    // And it has to paint above what it overlaps. Both the tab and the pane are
    // in flow, the pane is the later sibling, so without this the pane draws
    // over the run the pull-down just covered and the join is undone by the
    // pane's own lit edge. Positioned, not raised by `z-index`: being
    // positioned is enough to paint above an unpositioned sibling, and a stack
    // index here would be a number this crate has no way to keep true against
    // whatever an app stacks around it.
    putln!(body, "    position: relative;");
    let mut css = format!(".{selector}.chosen {{\n{body}}}\n");

    // A strip that runs down its pane joins it on the side, and the join above
    // is written for a strip that runs across. Which way a strip runs is not
    // on [`Selector`], and it should not be: it is the arrangement, and the
    // renderer drawing the arrangement is the one that knows.
    //
    // `aria-orientation` is how that renderer has to say it anyway. It is
    // ARIA's word rather than a private attribute, required on any vertical
    // tablist for a screen reader, so keying on it couples this to the
    // standard and not to one caller's markup.
    //
    // The join turned a quarter: the open run faces the pane at the inline end,
    // the pull is one border width toward it rather than down, and the corners
    // round on the side away from the pane. Every tab in the column takes those
    // corners, chosen or not, for the across strip's reason: the corners are
    // the strip's shape, not the chosen option's. The pane has to sit against
    // the strip for this to read, which is the arrangement sheet's to say.
    putln!(
        css,
        "[aria-orientation=\"vertical\"] .{selector} {{\n    \
         border-radius: var(--radius-control) 0 0 var(--radius-control);\n}}"
    );
    putln!(
        css,
        "[aria-orientation=\"vertical\"] .{selector}.chosen {{\n    \
         box-shadow: var({OPEN_SIDE_VAR});\n    \
         margin-block-end: 0;\n    \
         margin-inline-end: calc(-1 * {});\n}}",
        opts.border_width
    );

    // A column of tabs that has folded over its pane runs across it, so inside
    // a folded strip the join turns back: corners round at the top and the
    // chosen tab pulls down. The arrangement sheet decides when a column folds
    // and says so by naming the container; `aria-orientation` cannot, since it
    // describes the keys and not the drawing.
    putln!(
        css,
        "@container {STRIP_CONTAINER} (inline-size < {STRIP_FOLD}) {{\n\
         [aria-orientation=\"vertical\"] .{selector} {{\n    \
         border-radius: var(--radius-control) var(--radius-control) 0 0;\n}}\n\
         [aria-orientation=\"vertical\"] .{selector}.chosen {{\n    \
         box-shadow: var({});\n    \
         margin-inline-end: 0;\n    \
         margin-block-end: calc(-1 * {});\n}}\n}}",
        bevel_var(Bevel::RaisedOpen),
        opts.border_width
    );
    css
}