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
//! The classes a list's or a table's columns, rows and cells carry.
//!
//! The row and cell markup is drawn by the quasi hosts (`quasi-webview` for
//! this renderer), which own the column and cell members of the vocabulary.
//! What stays here is the naming those hosts write into markup and the
//! generated stylesheet rules: a column's name as a class
//! ([`push_column_name`]), the kind, part and flow classes, the cell wrapper
//! ([`CELL_IN`]) and sizer ([`push_sizer`]), the `short-N`, `stacks-N` and
//! `drop-*-N` ladders ([`SHORT_RUNGS`], [`STACKS_RUNGS`], [`DROP_RUNGS`]), and
//! the class lists the vocabulary is checked against.
//!
//! # By priority, never by position
//!
//! A renderer narrows by what a column is worth,
//! [`Priority`](makeover_layout::Priority), as a shrink factor on the column's
//! own class (one of [`CELL_DROP_CLASSES`]), and never by counting positions:
//! inserting a column cannot hide the wrong one.
use crateMarkup;
use crate::;
use ;
/// A column's name as the identifier half of its class.
///
/// # Reduced, not escaped
///
/// The name is an app-supplied string written into a class attribute. It is
/// reduced to identifier characters: Unicode alphanumerics, `_` and `-` pass
/// through and every other character becomes `-`. The result is a valid CSS
/// identifier, so a selector written against it matches, and it holds none of
/// the characters that can end an attribute value, so it needs no escaping.
/// `Due date` becomes `Due-date`; `a" onclick="steal()` cannot leave the
/// attribute; `Größe` is unchanged.
/// The class saying what a column holds, or `None` for prose.
///
/// The class goes on every cell and on the heading, and the sheet rules each
/// kind once (wiki `table-model`). Text writes nothing, and a kind added
/// upstream reads as text.
/// Every class [`kind_class`] can return.
pub const KIND_CLASSES: & = &;
/// The wrapper every cell and heading holds its contents in.
///
/// The padding lives on this, and the column, a flex item that may close to
/// nothing, clips it. It is also what a droppable column hides when it is
/// under its floor, and where the type is set, so a heading and the cells under
/// it are the same box.
pub const CELL_IN: &str = "cell-in";
/// What a kept column is as wide as, when its floor cannot say.
///
/// For a column of controls, whose drawn width a `ch` floor does not state.
/// The host that knows what a column holds writes a copy of it here, once
/// per distinct run of controls, drawn in the row's own type and taking no
/// height and no ink. A kept column holding one is as wide as its widest copy,
/// which the browser measures in the face it draws, and every cell and the
/// heading hold the same copies, so the column is one width down the table.
/// Hidden rather than absent: a hidden box still has a width.
///
/// Write it with [`push_sizer`].
pub const CELL_SIZER: &str = "cell-sizer";
/// A [`CELL_SIZER`] around `copies`, which go inside a cell's or a heading's
/// [`CELL_IN`] after what it holds.
///
/// `copies` is the host's: one block per distinct run, each drawn with the
/// classes and the element the real controls take. Nothing in it may
/// be a control anyone can reach: `aria-hidden` here and `visibility: hidden`
/// in the sheet take it out of the accessibility tree and the tab order, and a
/// copy carries no address. Empty writes nothing.
///
/// [`Markup`], because the copies are the host's markup and are written as-is.
/// The class a run of row parts takes when what it holds is badges.
///
/// A part's [`Prominence`] says how far forward it stands; what it holds is the
/// node's to say, and the host reads it there. A run of badges, of controls or
/// of a meter carries one of these in place of its prominence class, and no
/// part-level colour.
pub const ROW_TOKENS: &str = "row-tokens";
/// The class a run of row parts takes when what it holds is controls. See
/// [`ROW_TOKENS`].
pub const ROW_ACTIONS: &str = "row-actions";
/// The class a run of row parts takes when what it holds is a meter. See
/// [`ROW_TOKENS`].
pub const ROW_PROPORTION: &str = "row-proportion";
/// Every class [`part_class`] can return, including the fallback, and the
/// three a run takes for what it holds.
///
/// Written out beside the match, since `Prominence` is `#[non_exhaustive]`;
/// a test holds the two together.
pub const ROW_PART_CLASSES: & = &;
/// Every class [`flow_class`] can return.
///
/// `Flow::Tight` has no class: one line is a run's default. Only the tier that
/// departs from it is named.
pub const FLOW_CLASSES: & = &;
/// The classes a row inside a hierarchy carries.
///
/// Part of [`crate::vocabulary::names`]; the generated sheet rules them.
pub const NESTING_CLASSES: & = &;
/// The class for a part's flow, if it needs one.
///
/// `None` for [`Flow::Tight`] and for any tier added upstream that this crate
/// does not know, which lands as one line.
/// Every class saying how wide a cell of a column asks to be, including the
/// fill a column that makes no claim lands on.
///
/// Written out, since `cell-fill` carries no rule: a fill is what a cell does
/// when the sheet says nothing, so the class is not in the scraped set.
pub const CELL_WIDTH_CLASSES: & = &;
/// Every class saying when a cell of a column drops, including the tier that
/// never does.
///
/// The class is a shrink factor: a table short of room takes the shortfall
/// from the columns worth least.
///
/// Written out, since `cell-keeps`, the tier the narrowing never hides, carries
/// no rule.
pub const CELL_DROP_CLASSES: & = &;
/// The rungs of the `short-N` ladder, in `rem`: the narrowest and widest table
/// width it can say, and the step between two.
///
/// Two `rem` a step, so a table is marked short at most 32px before its
/// essentials stop fitting. A table needing more than the ceiling gets no
/// class.
pub const SHORT_RUNGS: = ;
/// The rungs of the `stacks-N` ladder, in `rem`: the width under which a
/// table's rows stop being a grid and draw as stacked records.
///
/// The [`SHORT_RUNGS`] ladder under its own name: a table can carry a rung of
/// each. One that folds its acts into a row menu is short below the
/// width its essentials need with the acts in them, and stacks below the
/// narrower width they need with the acts folded away; the host works out both
/// from the same floors.
pub const STACKS_RUNGS: = SHORT_RUNGS;
/// How many `rem` of `tiles-N` rungs share one width query: a table carrying
/// any rung up to the next multiple of this tiles below that multiple.
///
/// The tiles ladder takes whatever rung the host's floors land on; the sheet
/// writes one width query per band of this many `rem`, not one per rung.
pub const TILES_STEP: u16 = 16;
const _: = assert!;
/// The rungs of the `drop-optional-N` and `drop-secondary-N` ladders, in
/// `rem`: the width under which a table's optional, then its secondary,
/// columns close outright.
///
/// The [`SHORT_RUNGS`] ladder again. A host puts the optional rung at every
/// column's floor added up and the secondary rung at the floors of the
/// essential and secondary columns, the same budget the terminal and egui
/// renderers raise their cutoff by.
pub const DROP_RUNGS: = SHORT_RUNGS;
/// Every class [`cell_part_class`] can return, including the fallback.
///
/// Written out, as [`ROW_PART_CLASSES`] is.
pub const CELL_PART_CLASSES: & = &;
/// The class for a row part, by how far forward it stands.
///
/// [`Prominence`] is `#[non_exhaustive]`, so a member added upstream does not stop
/// this compiling.
///
/// A member added upstream lands here as a bare `row-part`, which the sheet
/// lets shrink like its siblings and otherwise leaves plain.
///
/// Public for whichever host builds the row element.
/// The class for a cell part.
///
/// [`part_class`]'s table half, for [`CellPart`]. A member added upstream
/// lands as a bare `cell-part` with no rule of its own.