Skip to main content

makeover_layout/
column.rs

1// Names this module's prose links to, resolved for rustdoc.
2#[allow(unused_imports)]
3use crate::{Field, FieldKind, Fill, Region, RowPart};
4
5/// How much room a placement asks for.
6///
7/// A column says it, and so does a [`Field`]. An intent, so the actual floor
8/// stays with `makeover-geometry`. goingson's task table spells these as
9/// `minmax(200px, 1fr)`, `140px` and content-sized; only the first three words
10/// of that survive deferral.
11/// `#[non_exhaustive]`, for the reason [`Fill`] and [`FieldKind`] are: a
12/// renderer matches on this and a vocabulary that grows must not break every
13/// renderer when it does.
14#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
15#[non_exhaustive]
16pub enum Width {
17    /// Takes what it needs and no more.
18    Content,
19    /// A fixed share, the same at every width.
20    Fixed,
21    /// Absorbs whatever is left over.
22    ///
23    /// **Several fills divide what is left equally.** Stated because it would
24    /// otherwise be undefined and each renderer would invent something, and
25    /// stated this way because equal division is the only sharing rule that
26    /// answers to "Any width, one answer" without a tiebreak: allocating in
27    /// declaration order makes the result depend on the order the description
28    /// was written in, which is a fact about the source file and not about the
29    /// screen. It documents what both renderers already do (CSS grid gives
30    /// `1fr 1fr`, ratatui gives each a `Constraint::Fill(1)`) rather than
31    /// changing anything.
32    ///
33    /// So a row of fills is a legal thing to describe, and there is no rule
34    /// against it.
35    Fill,
36}
37
38/// What a member is worth when there is not room for all of them.
39///
40/// Written for table columns and no longer only theirs. Three shapes ask the
41/// same question and this answers all three: a table too narrow for its
42/// columns, a row too narrow for its parts (see [`RowPart::priority`]), and a
43/// group of regions sharing one run of room, goingson's tab strip and the
44/// [`Region::Band`] beside it, which is the case wiki `layout-room-and-fallback`
45/// was ruled on. It is what any member of a group is worth, not a table
46/// concept, and [`Fallback::Shed`] is what reads it.
47///
48/// The doc below is the column argument, which is where the type was measured;
49/// the sentence that gave it away is [`Priority::Essential`]'s, which was
50/// already written about a row.
51///
52/// Ordered: [`Priority::Optional`] drops first, [`Priority::Essential`] never
53/// drops. This replaces addressing columns by position, which is what both
54/// webview apps do today and is a live bug rather than only verbosity. goingson
55/// hides mobile columns with `nth-child(n+5)` against a seven-column table, so
56/// inserting a column silently hides the wrong one.
57/// `#[non_exhaustive]`, same reasoning as [`Width`]. Note the ordering is the
58/// whole point of the type, so a new tier has to be declared in its place in
59/// the sequence rather than appended.
60#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
61#[non_exhaustive]
62pub enum Priority {
63    /// Dropped first.
64    Optional,
65    /// Dropped once the optional members are gone.
66    Secondary,
67    /// Never dropped. Without it the group does not identify itself.
68    Essential,
69}
70
71impl Priority {
72    /// Every cutoff, weakest first: the order a narrowing renderer raises
73    /// through.
74    ///
75    /// The one list of tiers. A renderer walks this rather than writing its
76    /// own, so a tier added here is one every renderer narrows to.
77    pub const RAISING: &'static [Self] = &[Self::Optional, Self::Secondary, Self::Essential];
78}
79
80/// What the columns kept at a cutoff ask for.
81///
82/// Counted in `ch` and in columns, and never in a host's unit: each renderer
83/// turns it into its own with [`Budget::width`], which is the one gap model
84/// every native renderer budgets by.
85#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
86#[non_exhaustive]
87pub struct Budget {
88    /// How many columns are kept.
89    pub columns: u32,
90    /// Their [`floor`](Column::floor)s, summed, in `ch`.
91    pub floors: u32,
92}
93
94impl Budget {
95    /// The width these columns need, at `ch` per `ch` and `gap` between
96    /// adjacent columns and at each edge.
97    ///
98    /// `floors * ch + gap * (columns + 1)`. A terminal passes one cell per `ch`
99    /// and its column spacing; an immediate-mode painter passes the width of a
100    /// figure and its cell padding on both sides. One formula, so a table
101    /// drops a column at the same declared width in both.
102    #[must_use]
103    pub fn width(self, ch: f32, gap: f32) -> f32 {
104        self.floors as f32 * ch + gap * (self.columns + 1) as f32
105    }
106}
107
108/// What the columns kept at `cutoff` ask for.
109#[must_use]
110pub fn budget(columns: &[Column<'_>], cutoff: Priority) -> Budget {
111    columns.iter().filter(|column| column.kept_at(cutoff)).fold(
112        Budget::default(),
113        |budget, column| Budget {
114            columns: budget.columns + 1,
115            floors: budget.floors + u32::from(column.floor()),
116        },
117    )
118}
119
120/// The weakest cutoff whose kept columns `fits` accepts.
121///
122/// Raised through [`Priority::RAISING`] until the columns fit, and never past
123/// the strongest priority any column declares: the essential columns are what
124/// makes a row identify itself, so a window too narrow for them gets them
125/// squeezed rather than dropped. A table with no essential column therefore
126/// never rises to [`Priority::Essential`], where the budget would keep no
127/// column at all. Nothing here counts positions, so which column drops is a
128/// property of the column.
129#[must_use]
130pub fn cutoff_for(columns: &[Column<'_>], fits: impl Fn(Budget) -> bool) -> Priority {
131    let strongest = columns
132        .iter()
133        .map(|column| column.priority)
134        .max()
135        .unwrap_or(Priority::Essential);
136    Priority::RAISING
137        .iter()
138        .copied()
139        .take_while(|&cutoff| cutoff <= strongest)
140        .find(|&cutoff| fits(budget(columns, cutoff)))
141        .unwrap_or(strongest)
142}
143
144/// The lengths a description deferred, in a renderer's own unit.
145///
146/// [`Width`] says `Content`, `Fixed` or `Fill` and carries no magnitude,
147/// because a magnitude is an answer for one renderer. Each renderer holds this
148/// over its own unit (cells, points, CSS lengths) and looks a column up by
149/// name, because an app's columns are not all one size.
150#[derive(Debug, Clone, Copy, PartialEq, Default)]
151#[non_exhaustive]
152pub struct Sizing<'a, L> {
153    /// `(column name, length)`: the track for a [`Width::Fixed`] column and the
154    /// floor for a [`Width::Fill`] one.
155    pub lengths: &'a [(&'a str, L)],
156    /// Used for a column with no entry above.
157    pub fallback: L,
158}
159
160impl<'a, L: Copy> Sizing<'a, L> {
161    /// These lengths, and `fallback` for a column not among them.
162    #[must_use]
163    pub const fn new(lengths: &'a [(&'a str, L)], fallback: L) -> Self {
164        Self { lengths, fallback }
165    }
166
167    /// The length for a named column.
168    #[must_use]
169    pub fn length_for(&self, name: &str) -> L {
170        self.lengths
171            .iter()
172            .find(|(column, _)| *column == name)
173            .map_or(self.fallback, |(_, length)| *length)
174    }
175}
176
177/// What a group does when it runs out of room.
178///
179/// Authored, and required: the field carrying this has no `Default` and a group
180/// cannot be described without saying what it does when it runs out of room.
181/// More intentionality from layout designers is acceptable so long as the constraints are solvable, because the goal is
182/// enabling good layouts rather than rescuing bad ones. A default here would be
183/// the crate guessing, and the guess would be silently wrong on the screens
184/// that matter.
185///
186/// Relief resolves inside-out. A group asks its children to fall back before
187/// falling back itself, or an outer group collapses while an inner one still
188/// had slack.
189///
190/// # No `Swap`
191///
192/// An authored alternate group for the tight case is deliberately out of the
193/// first cut. It doubles the description for that group and the two halves can
194/// drift, which is the failure this vocabulary exists to end. Add it when a
195/// site proves it needs one.
196///
197/// `#[non_exhaustive]`, [`Width`]'s reasoning. Unlike [`Priority`] there is no
198/// order to preserve, so a member can be appended.
199#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
200#[non_exhaustive]
201pub enum Fallback {
202    /// One row becomes two. Every member stays, in the order described.
203    Wrap,
204    /// A row becomes a column. Every member stays, full width.
205    Stack,
206    /// Members drop by [`Priority`], down to [`Priority::Essential`].
207    ///
208    /// What a narrow table already does with its columns, applied to a group.
209    /// What drops is gone from the screen, so this is right when the dropped
210    /// members are facts the reader can do without and wrong when they are the
211    /// only way to act.
212    Shed,
213    /// The members [`Shed`](Self::Shed) would drop move into one overflow
214    /// control instead.
215    ///
216    /// The answer when a group holds actions. A control is not a fact: dropping
217    /// it does not cost the reader a detail, it costs them the only way to act,
218    /// which is [`RowPart::priority`]'s argument one level up.
219    Menu,
220}
221
222/// The widest a column's [`floor`](Column::floor) may be, in `ch`.
223///
224/// A bound so a webview can name every floor as a class from a fixed ladder:
225/// a container condition cannot read a custom property, so the length a
226/// column hides its contents under has to be written into the stylesheet.
227/// Wider than any column the tree declares, and a column wanting more is a
228/// [`Width::Fill`] with this as its floor.
229pub const MIN_CEILING: u16 = 64;
230
231/// The floor an undeclared [`Width::Fill`] column takes, in `ch`.
232const FILL_FLOOR: u16 = 16;
233
234/// The number of characters in a heading, for a `ch`-based floor.
235///
236/// `str::chars().count()` is not const and [`Column::floor`] is, so this counts
237/// UTF-8 code points by hand. `len()` counts bytes, which over-reserves a
238/// multi-byte heading: a Cyrillic `Статус` reads as 12 `ch` rather than 6.
239const fn char_len(s: &str) -> usize {
240    let bytes = s.as_bytes();
241    let mut chars = 0;
242    let mut i = 0;
243    while i < bytes.len() {
244        chars += 1;
245        let byte = bytes[i];
246        i += if byte < 0x80 {
247            1
248        } else if byte < 0xE0 {
249            2
250        } else if byte < 0xF0 {
251            3
252        } else {
253            4
254        };
255    }
256    chars
257}
258
259/// One column of a table.
260///
261/// Described once. The grid track, the cell order and the drop behaviour are
262/// all derived from this, rather than being three hand-written encodings that
263/// must agree and are never checked against each other.
264#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
265#[non_exhaustive]
266pub struct Column<'a> {
267    /// The heading, and the name the cell is addressed by.
268    pub name: &'a str,
269    /// How much room it asks for.
270    pub width: Width,
271    /// What it is worth when room runs out.
272    pub priority: Priority,
273    /// What the column holds, which is what carries its look.
274    pub kind: ColumnKind,
275    /// The narrowest the column may be before it drops, in `ch`.
276    ///
277    /// wiki `frontend-unification`: collapse points derive from declared
278    /// minimums only, so every host narrows at the same declared width rather
279    /// than at its own breakpoints. `ch` because every host has a direct
280    /// answer for it: a terminal cell is one, an immediate-mode painter
281    /// measures one off its face, and a webview draws one as nine sixteenths
282    /// of the base, a figure at a table's text size with room to spare. Not
283    /// the CSS `ch`
284    /// itself, because a container condition resolves font-relative units
285    /// against a different font than the cell's, and the column would hide at
286    /// one width and be sized at another.
287    ///
288    /// `None` derives it from the kind and the heading, which is what most
289    /// columns want. Read it through [`floor`](Self::floor), never directly:
290    /// that is where the derivation, the rounding and the ceiling live, and a
291    /// host reading this field would narrow somewhere the other two do not.
292    pub min: Option<u16>,
293    /// Whether the user can reorder the table by this column.
294    ///
295    /// What reordering *calls* is not here (that is an address, and this
296    /// crate names none) so a host pairs this with the route the way it pairs
297    /// a row's parts with the row's activation. This says the affordance
298    /// exists, which is what a renderer needs to draw a header a user can
299    /// press rather than a heading they cannot.
300    pub sortable: bool,
301    /// Which way the table is ordered by this column, if it is.
302    ///
303    /// `None` on every column but the one in force. A renderer draws the caret
304    /// from this and a webview sets `aria-sort`, which is why it is per column
305    /// rather than a single fact on the table: the host idiom is a property of
306    /// the header cell.
307    ///
308    /// Independent of [`sortable`](Self::sortable) rather than implied by it,
309    /// because both combinations mean something. A column sorted and not
310    /// sortable is a list ordered by a key the user cannot change, which is a
311    /// real thing to describe and a caret worth drawing.
312    pub sorted: Option<Sort>,
313}
314
315/// What a column holds.
316///
317/// wiki `table-model`: the kind is what carries a column's look, and four of
318/// the reference table's six rules were per kind rather than per table. A
319/// description states what the column is; each renderer decides what that
320/// looks like in its host, from the facts below rather than from the name.
321///
322/// `#[non_exhaustive]`, [`Width`]'s reasoning.
323#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
324#[non_exhaustive]
325pub enum ColumnKind {
326    /// Prose. Wraps. What a column is when it says nothing else.
327    #[default]
328    Text,
329    /// A name a machine made: a fingerprint, a hash, a slug. Monospace, and
330    /// breaks mid-string rather than widening the table.
331    Identifier,
332    /// A point in time. Never wraps, so a date cannot print over its
333    /// neighbour, and its figures line up down the column.
334    Date,
335    /// A quantity. Figures line up and the column aligns to its end, so
336    /// magnitudes compare by length.
337    Number,
338    /// Source text, one row per line. Monospace and never wrapped. A table
339    /// holding one is read as code, so its rows are not striped or spaced as
340    /// records.
341    Code,
342    /// A state the row is in, drawn as a chip rather than as coloured text.
343    Status,
344    /// The row's controls. Aligns to its end and shrinks to what it holds.
345    Actions,
346}
347
348impl ColumnKind {
349    /// The narrowest a column of this kind reads at, in `ch`, when it declares
350    /// nothing narrower.
351    ///
352    /// A date is ten characters in the form every host writes, and a number
353    /// cut short is a different number, so the kinds that cannot truncate
354    /// floor at what they hold. Prose and identifiers wrap or break, so theirs
355    /// is only enough to be recognisable.
356    #[must_use]
357    pub const fn floor(self) -> u16 {
358        match self {
359            Self::Text | Self::Code | Self::Status | Self::Actions => 8,
360            Self::Identifier => 12,
361            Self::Date => 10,
362            Self::Number => 6,
363        }
364    }
365
366    /// Whether the column aligns to its end rather than its start.
367    #[must_use]
368    pub const fn aligns_end(self) -> bool {
369        matches!(self, Self::Number | Self::Actions)
370    }
371
372    /// Whether the column's text may wrap onto a second line.
373    ///
374    /// An identifier wraps by breaking mid-string, which is still a wrap: the
375    /// alternative is a fingerprint forcing the table wider than its pane.
376    #[must_use]
377    pub const fn wraps(self) -> bool {
378        matches!(self, Self::Text | Self::Identifier)
379    }
380
381    /// Whether the column is set in the monospace face.
382    #[must_use]
383    pub const fn monospace(self) -> bool {
384        matches!(self, Self::Identifier | Self::Code)
385    }
386
387    /// Whether figures in the column take equal widths.
388    #[must_use]
389    pub const fn tabular(self) -> bool {
390        matches!(self, Self::Date | Self::Number)
391    }
392}
393
394/// Which way a column is ordered.
395///
396/// Two, because there is no third. "Unsorted" is [`Column::sorted`] being
397/// `None`, and folding it in here would be the same absence said twice.
398#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
399#[non_exhaustive]
400pub enum Sort {
401    /// Smallest, earliest or first alphabetically at the top.
402    Ascending,
403    /// The other way.
404    Descending,
405}
406
407impl Sort {
408    /// The other direction, for a header that flips when pressed.
409    #[must_use]
410    pub const fn reversed(self) -> Self {
411        match self {
412            Self::Ascending => Self::Descending,
413            Self::Descending => Self::Ascending,
414        }
415    }
416
417    /// What a webview writes into `aria-sort`.
418    ///
419    /// Named here rather than in the webview renderer because a terminal and an
420    /// immediate-mode painter both want the same two words for a caret's label,
421    /// and three renderers picking their own is the drift this crate ends.
422    #[must_use]
423    pub const fn as_str(self) -> &'static str {
424        match self {
425            Self::Ascending => "ascending",
426            Self::Descending => "descending",
427        }
428    }
429
430    /// The caret a renderer draws for this direction.
431    ///
432    /// Here for [`as_str`](Self::as_str)'s reason, said about a glyph rather
433    /// than a word: three renderers picking their own is the drift this crate
434    /// ends. They had picked their own (two on the solid triangles and
435    /// `makeover-webview` on the arrows U+2191/U+2193) and agreeing by
436    /// coincidence in three files is not agreement.
437    ///
438    /// The reason generalizes past this pair and is the house rule now,
439    /// prefer the bolder, simpler glyph over the thinner or more complicated
440    /// one. A third spelling is not open for re-argument.
441    ///
442    /// **Bare, with no spacing.** Where the gap goes is each renderer's
443    /// business: `makeover-tui` and `makeover-immediate` carry a leading space
444    /// inside their `TableStyle` string and a webview emits its own in
445    /// `content`, so folding a space in here would make one of the two wrong.
446    ///
447    /// Neither face the web apps self-host carries these (IBM Plex Mono has one
448    /// glyph in the whole geometric-shapes block and Lato has none) so a
449    /// browser falls back per glyph until the in-house face ships with them
450    /// drawn in (wiki `typography-standard`). Cosmetic
451    /// drift in one renderer, not a reason to spell it three ways.
452    #[must_use]
453    pub const fn glyph(self) -> &'static str {
454        match self {
455            Self::Ascending => "\u{25B2}",
456            Self::Descending => "\u{25BC}",
457        }
458    }
459}
460
461impl<'a> Column<'a> {
462    /// A column that absorbs slack and never drops.
463    ///
464    /// [`Priority::Essential`], and the default is the whole of the argument.
465    /// A table that states no priorities used to empty itself wherever a
466    /// renderer narrows (head and cells together, every column having
467    /// inherited a droppable rank) which is what goingson's task table did.
468    /// Undeclared now means kept, so a column goes only when someone demotes
469    /// it, and the remaining failure is a cramped table rather than a blank
470    /// one. That is the same judgment [`kept_at`](Self::kept_at)'s renderers
471    /// make about a rank they have not learned: of the two ways to be wrong,
472    /// showing a column that should have gone is the one a reader can see and
473    /// work around.
474    #[must_use]
475    pub const fn new(name: &'a str) -> Self {
476        Self {
477            name,
478            width: Width::Fill,
479            priority: Priority::Essential,
480            kind: ColumnKind::Text,
481            min: None,
482            sortable: false,
483            sorted: None,
484        }
485    }
486
487    /// The same column, declaring the narrowest it may be before it drops.
488    #[must_use]
489    pub const fn min(mut self, ch: u16) -> Self {
490        self.min = Some(ch);
491        self
492    }
493
494    /// The same column, asking for this much room.
495    #[must_use]
496    pub const fn width(mut self, width: Width) -> Self {
497        self.width = width;
498        self
499    }
500
501    /// The same column, worth this much when room runs out.
502    #[must_use]
503    pub const fn priority(mut self, priority: Priority) -> Self {
504        self.priority = priority;
505        self
506    }
507
508    /// The same column, holding this kind of value.
509    #[must_use]
510    pub const fn kind(mut self, kind: ColumnKind) -> Self {
511        self.kind = kind;
512        self
513    }
514
515    /// The same column, reorderable by the user or not.
516    #[must_use]
517    pub const fn sortable(mut self, sortable: bool) -> Self {
518        self.sortable = sortable;
519        self
520    }
521
522    /// The same column, the one the table is ordered by, in this direction.
523    #[must_use]
524    pub const fn sorted(mut self, sort: Sort) -> Self {
525        self.sorted = Some(sort);
526        self
527    }
528
529    /// The narrowest this column may be before it drops, in `ch`.
530    ///
531    /// What every host narrows by: a column is kept at a cutoff only while the
532    /// floors of every column kept there fit. The declared [`min`](Self::min),
533    /// or else the widest of the kind's [`floor`](ColumnKind::floor), the
534    /// heading with two for its capitals and two more for a caret, and sixteen
535    /// for a [`Width::Fill`] column. Rounded up to an even count and held under
536    /// [`MIN_CEILING`], so a webview can carry the whole range as a fixed ladder
537    /// of classes and the other two hosts round the same way.
538    #[must_use]
539    pub const fn floor(&self) -> u16 {
540        let raw = match self.min {
541            Some(ch) => ch,
542            None => {
543                let caret = if self.sortable || self.sorted.is_some() {
544                    2
545                } else {
546                    0
547                };
548                // Characters, not bytes: `ch` is the width of a glyph, so a
549                // multi-byte heading counted by `len()` over-reserves (`Статус`
550                // reads as 12 ch rather than 6) and a non-Latin table drops
551                // columns sooner than the same table in another locale. Two more
552                // for the heading's capitals and tracking, which run wider than
553                // the figures a `ch` is measured off: `AMOUNT` at six ch is cut.
554                let chars = char_len(self.name);
555                let heading = if chars > MIN_CEILING as usize {
556                    MIN_CEILING
557                } else {
558                    chars as u16 + 2 + caret
559                };
560                let kind = self.kind.floor();
561                // A column that takes the slack is the one holding prose, and
562                // floored at its kind it wraps a title onto three lines while
563                // the columns worth less still stand at full width.
564                let fill = if matches!(self.width, Width::Fill) {
565                    FILL_FLOOR
566                } else {
567                    0
568                };
569                let wider = if heading > kind { heading } else { kind };
570                if fill > wider { fill } else { wider }
571            }
572        };
573        // Clamped before rounding, so a declared `min(u16::MAX)` cannot
574        // overflow on its way to being held under the ceiling.
575        let raw = if raw > MIN_CEILING { MIN_CEILING } else { raw };
576        let even = raw + raw % 2;
577        if even < 2 {
578            2
579        } else if even > MIN_CEILING {
580            MIN_CEILING
581        } else {
582            even
583        }
584    }
585
586    /// Whether this column survives at the given cutoff.
587    ///
588    /// A renderer narrows by raising the cutoff, and never by counting
589    /// positions.
590    #[must_use]
591    pub const fn kept_at(&self, cutoff: Priority) -> bool {
592        (self.priority as u8) >= (cutoff as u8)
593    }
594}
595
596/// What a table cell holds.
597///
598/// [`RowPart`] for tables, and it exists for the same reason: a part that
599/// carries a control is not text, and a renderer with one class for the whole
600/// cell paints it as though it were: a button in a cell inherits the cell's
601/// content colour, which is the drift [`RowPart::intent`] prevents for rows.
602///
603/// Four members, and the count is what quasi's `Cell` was measured to carry: a
604/// value, tokens, actions and a link. Nothing was added past what something
605/// holds.
606///
607/// `#[non_exhaustive]` for [`RowPart`]'s reason: growth here must not be a
608/// lockstep event across three renderers.
609///
610/// # No hover-reveal
611///
612/// This enum never gets one. A cell's actions are shown at rest in every
613/// consumer measured, and a member nothing uses is one three renderers owe an
614/// answer for.
615#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
616#[non_exhaustive]
617pub enum CellPart {
618    /// The cell's own text.
619    Value,
620    /// Small labelled things in the cell: a status badge, a chip.
621    Tokens,
622    /// Controls that act on what the row is about.
623    Actions,
624    /// The cell's value, where the value is itself a link.
625    Link,
626}
627
628impl CellPart {
629    /// The content intent the part takes.
630    ///
631    /// One part is text and three are not, so three answer with the intent
632    /// inheriting already gives. That is [`RowPart::intent`]'s shape with the
633    /// text side narrower: a cell's secondary and muted readings are the
634    /// column's business, not the cell's.
635    #[must_use]
636    pub const fn intent(self) -> &'static str {
637        match self {
638            Self::Value => "content",
639            // A token carries its own tone, and a part-level intent underneath
640            // it would fight the token sitting on it.
641            Self::Tokens => "content",
642            // Actions carry controls rather than text.
643            Self::Actions => "content",
644            // A link in a cell is its row's title, so it reads in the ink the
645            // values beside it do.
646            Self::Link => "content",
647        }
648    }
649}