@terpjs/react-core 0.27.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +31 -7
  2. package/package.json +4 -3
  3. package/src/Field.test.tsx +95 -1
  4. package/src/Field.tsx +70 -1
  5. package/src/LoginView.test.tsx +33 -0
  6. package/src/LoginView.tsx +36 -23
  7. package/src/Meter.test.tsx +304 -0
  8. package/src/Meter.tsx +159 -0
  9. package/src/QuietActions.test.tsx +118 -0
  10. package/src/QuietActions.tsx +75 -0
  11. package/src/UserMenu.test.tsx +23 -0
  12. package/src/UserMenu.tsx +9 -1
  13. package/src/admin/AccessAdmin.tsx +6 -2
  14. package/src/admin/AuditLogAdmin.tsx +1 -1
  15. package/src/admin/access.test.tsx +2 -1
  16. package/src/admin/admin.test.tsx +57 -5
  17. package/src/admin/module.tsx +9 -6
  18. package/src/bootstrap.test.tsx +1 -1
  19. package/src/bootstrap.tsx +2 -1
  20. package/src/dataview/DataView.test.tsx +99 -0
  21. package/src/dataview/DataViewPagination.tsx +2 -2
  22. package/src/dataview/DataViewToolbar.tsx +2 -2
  23. package/src/dataview/README.md +5 -3
  24. package/src/dataview/index.ts +1 -1
  25. package/src/dataview/internal.tsx +102 -21
  26. package/src/dataview/types.ts +11 -37
  27. package/src/errorMessages.test.tsx +21 -0
  28. package/src/errorMessages.tsx +33 -19
  29. package/src/index.ts +9 -3
  30. package/src/locale.test.tsx +164 -4
  31. package/src/locale.tsx +105 -10
  32. package/src/markers.test.ts +33 -11
  33. package/src/ssr.test.tsx +18 -0
  34. package/src/styles.test.ts +265 -14
  35. package/src/styles.ts +424 -49
  36. package/src/testing.test.tsx +162 -0
  37. package/src/testing.ts +84 -0
  38. package/src/tokens.guard.test.ts +11 -6
  39. package/src/ui/controlMessages.tsx +27 -14
  40. package/src/uiText.literals.test.ts +19 -6
  41. package/src/uiText.test.tsx +143 -2
  42. package/src/uiText.tsx +287 -15
  43. package/vitest.setup.ts +7 -20
package/src/styles.ts CHANGED
@@ -637,6 +637,21 @@ textarea[data-terp="input"] {
637
637
  [data-terp="detail-list"][data-layout="aligned"] {
638
638
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
639
639
  column-gap: var(--space-3);
640
+ /* The pair's alignment, and it belongs to the shared column rather than to the grid. A
641
+ dt and a dd are separate grid items here -- that is what display: contents below does
642
+ -- so under the default stretch each box starts at the row's top and each text sits at
643
+ the top of its own line box. The two line boxes are not the same height, because the
644
+ term is a type step smaller than the value, so the label rides ABOVE the value it
645
+ labels: measured at 4px on every row of a two-column card, which is precisely the
646
+ misalignment a shared label column exists to remove.
647
+
648
+ baseline rather than center, and the difference shows on the second line rather than
649
+ the first: a value that wraps would pull a centred label to the middle of a block it
650
+ is not describing, while a baseline holds the label on the line the value STARTS on.
651
+ That is also why it is align-items on the container rather than align-self on the dt --
652
+ a grid baseline group spans the row, so at two pairs per row all four items share one
653
+ line, which one item aligning itself cannot produce. */
654
+ align-items: baseline;
640
655
  }
641
656
  [data-terp="detail-list"][data-layout="aligned"][data-columns="2"] {
642
657
  grid-template-columns: repeat(2, minmax(0, max-content) minmax(0, 1fr));
@@ -680,6 +695,38 @@ textarea[data-terp="input"] {
680
695
  > [data-terp="detail-list"][data-layout="aligned"]:not([data-columns]) {
681
696
  grid-template-columns: subgrid;
682
697
  }
698
+ /* FieldRow's wide half: the three shared lines, and the columns that hold them.
699
+ align-items: start so a field shorter than its neighbour does not stretch, and
700
+ justify-content: start so the row is as wide as its fields rather than as wide as the
701
+ page. */
702
+ [data-terp="field-row"] {
703
+ grid-auto-flow: column;
704
+ grid-auto-columns: minmax(0, auto);
705
+ grid-template-rows: auto auto auto;
706
+ align-items: start;
707
+ justify-content: start;
708
+ }
709
+ /* Each field spans all three and subgrids them, which is what puts every label on one
710
+ line and every control on the next whatever any one field has to say. */
711
+ [data-terp="field-row"] > [data-terp="field"] {
712
+ display: grid;
713
+ grid-template-rows: subgrid;
714
+ grid-row: 1 / -1;
715
+ }
716
+ /* The label element generates no box, so the label TEXT and the control become items of
717
+ the field and can land on separate shared lines. It stays a <label> wrapping its
718
+ control in the DOM, which is what names the control -- display: contents changes the
719
+ box tree, and the accessible name is computed from the DOM. Field additionally points
720
+ aria-labelledby at the text, so the name is exact either way. */
721
+ [data-terp="field-row"] > [data-terp="field"] > [data-terp="field-label"] {
722
+ display: contents;
723
+ }
724
+ /* Anything that is not a field -- a remove button, an add button -- lands on the control
725
+ line rather than at the top of the row, which is where a box with no label of its own
726
+ would otherwise sit. */
727
+ [data-terp="field-row"] > :not([data-terp="field"]) {
728
+ grid-row: 2;
729
+ }
683
730
  }
684
731
 
685
732
  /* Grids -------------------------------------------------------------------- */
@@ -844,6 +891,12 @@ textarea[data-terp="input"] {
844
891
  minmax(min(9rem, 30%), max-content) minmax(min(13rem, 60%), 1fr)
845
892
  );
846
893
  column-gap: var(--space-3);
894
+ /* The baseline the wide block's aligned rule takes, declared again HERE and therefore at
895
+ every width. An auto list keeps its shared column below the cutover -- the contents rule
896
+ two blocks down says so -- so it is the one aligned list whose pairs are grid items in a
897
+ phone's width, and it would be the one place the label went back to riding above its
898
+ value. */
899
+ align-items: baseline;
847
900
  }
848
901
  /* The shared column for an auto list, at EVERY width, which the aligned rule in the wide block
849
902
  only gives above the cutover. Without it an auto list below the cutover would place each pair
@@ -874,6 +927,29 @@ textarea[data-terp="input"] {
874
927
  font-weight: var(--font-weight-normal);
875
928
  color: var(--color-fg-muted);
876
929
  }
930
+ /* And the value comes down to meet it. Muting the term above moved one half of the pair and
931
+ left the other at the inherited base, which is 12px against 16px -- two steps apart, far
932
+ enough that a reader sees two kinds of text rather than a label and the thing it labels.
933
+ Reported as the value being too big for its label, which is the same observation from the
934
+ other end.
935
+
936
+ sm is not a fresh judgement about this component. It is what every other dense record
937
+ surface in this sheet already renders: a DataView header cell is xs and its body cell is
938
+ sm, which IS this pair in a table, and card-description, input and field-label-text are all
939
+ sm. An aligned detail list beside a table on the same page was the one surface reading a
940
+ step larger than the record it describes.
941
+
942
+ inline is excluded for the reason the muting rule above gives. There the value is the second
943
+ half of a sentence whose first half is the term, so stepping one half down would break the
944
+ line rather than group it.
945
+
946
+ It sets the dd, so a value that declares its own size keeps it -- a Text inside a value
947
+ still renders at the step that Text asked for. That is the correct outcome for a caller who
948
+ said a size and the thing to know about a caller who did not. */
949
+ [data-terp="detail-list"][data-layout="aligned"] [data-terp="detail-list-value"],
950
+ [data-terp="detail-list"][data-layout="stacked"] [data-terp="detail-list-value"] {
951
+ font-size: var(--font-size-sm);
952
+ }
877
953
  /* The gap prop, and this block must stay AFTER the layout rules above. Both
878
954
  [data-terp="detail-list"][data-gap="3"] and [data-terp="detail-list"][data-layout="aligned"]
879
955
  weigh (0,2,0), so nothing but source order decides which row-gap a list carrying both
@@ -1035,44 +1111,52 @@ textarea[data-terp="input"] {
1035
1111
  }
1036
1112
 
1037
1113
  /* Cards -------------------------------------------------------------------- */
1038
- /* The surface model, and this is the rule that states it: an in-flow block declares a
1039
- FRAME and no fill. Border, radius and padding are the whole of a card's chrome, and
1040
- what shows through it is the canvas the page already paints.
1041
-
1042
- It used to paint --color-neutral-0 over a --color-neutral-50 canvas — a second colour
1043
- saying what the border already says, and it cost twice. A card dropped onto anything
1044
- that is itself a surface repainted it rather than sitting on it, which is the
1045
- frame-inside-a-frame the plain variant exists to escape; and an app that themed the
1046
- canvas found that its cards did not follow, because the fill named the OTHER end of
1047
- the ramp. Both go away with the declaration: the plain variant is now the base rule
1048
- minus a border and a padding, and a themed canvas reaches every block on the page.
1114
+ /* The surface model, and this is the rule that states it: an in-flow block is an OBJECT —
1115
+ a fill, a frame, a radius and a padding — sitting on a canvas that is tinted away from
1116
+ it. Two tokens, two jobs: --color-bg-surface is what an object is made of and
1117
+ --color-bg-canvas is what the page is made of, and the whole legibility of a screen
1118
+ rests on the gap between them.
1119
+
1120
+ It was frame-only for one release — border and radius with the canvas showing through —
1121
+ and that is what this reverses. The argument then was sound about the DEFECT and wrong
1122
+ about the fix: cards were painting --color-neutral-0, the far end of the primitive ramp,
1123
+ so an app that themed its canvas got cards that did not follow, and a card dropped on
1124
+ something already a surface repainted it. Naming the SEMANTIC surface answers the first
1125
+ (a theme moves both ends together, which is what the bg family is for) and
1126
+ variant="plain" already answered the second.
1127
+
1128
+ What frame-only cost was the thing a screen is judged on. With canvas and surface a
1129
+ rounding error apart there is no object anywhere on the page: measured on the light
1130
+ theme, a table, a hub card and the page behind them all rendered #f8fafc inside a
1131
+ #e2e8f0 hairline, which reads as a wireframe of an app rather than an app. Tinting the
1132
+ canvas alone does not fix it either — it just moves every object onto grey, and a data
1133
+ table with a grey ground reads as disabled. Both halves have to move, and they are one
1134
+ decision, so they are in one commit.
1049
1135
 
1050
1136
  Six rules follow the same line, and they are the framework's other in-flow blocks:
1051
1137
  hubcard-body, profile-card, resource-list-row, empty-state, dataview-card and the full
1052
- DataView's table frame — whose header cells carried the same fill, invisibly, since a
1053
- filled frame sat directly behind them. Three kinds of element deliberately do NOT. An
1054
- overlay has to be opaque over whatever it covers (dialog, popover-panel, toast, the
1055
- combobox list, and appshell-header, which the page scrolls under); a control needs a
1056
- surface of its own to read as a control against the page (input, select, the secondary
1057
- button); and login-card is the one object on an otherwise empty canvas, where the fill
1058
- IS the object.
1059
-
1060
- The washes moved with it, because a wash that painted --color-neutral-50 was painting
1061
- the canvas and on a card with no fill it painted nothing: the table's hover and
1062
- selection, the expanded row's panel, a code block, a neutral alert and a disabled
1063
- control each step one place along the ramp to --color-neutral-100 — which is already
1064
- this sheet's hover wash for every control — or to the --color-interactive-* token that
1065
- names the state. One step along the ramp rather than a value per rule, because the dark
1066
- themes invert it: the same step is darker than the canvas in light and lighter in dark,
1067
- midnight and twilight, which is the direction a recess and a wash want in each.
1068
- --color-bg-inset cannot do that job — in those three themes it is declared AS the
1069
- canvas value, so an inset named from it would be the one thing that disappears. */
1138
+ DataView's table frame. Three kinds of element already did and keep doing so for reasons
1139
+ of their own: an overlay has to be opaque over whatever it covers (dialog,
1140
+ popover-panel, toast, the combobox list, and appshell-header, which the page scrolls
1141
+ under); a control needs a surface of its own to read as a control (input, select, the
1142
+ secondary button); and login-card is the one object on an otherwise empty canvas.
1143
+
1144
+ The washes stay one step along the ramp — --color-neutral-100, or the
1145
+ --color-interactive-* token that names the state — rather than returning to
1146
+ --color-neutral-50. That step is now the canvas's neighbour rather than the canvas
1147
+ itself, so a hover on a card is a step DOWN from the object and a hover on the page is a
1148
+ step down from the page, in light; the dark themes invert both, which is the direction a
1149
+ recess wants in each. --color-bg-inset cannot do that job — in three themes it is
1150
+ declared AS the canvas value, so an inset named from it would be the one thing that
1151
+ disappears. */
1070
1152
  [data-terp="card"] {
1071
1153
  display: flex;
1072
1154
  flex-direction: column;
1073
1155
  gap: var(--space-3);
1156
+ background: var(--color-bg-surface);
1074
1157
  border: 1px solid var(--color-neutral-200);
1075
1158
  border-radius: var(--radius-lg);
1159
+ box-shadow: var(--shadow-sm);
1076
1160
  padding: var(--space-4);
1077
1161
  min-width: 0;
1078
1162
  }
@@ -1119,20 +1203,24 @@ textarea[data-terp="input"] {
1119
1203
  flex: 1 1 0;
1120
1204
  min-width: 0;
1121
1205
  }
1122
- /* Chrome off, heading kept. Two declarations removed rather than a second component
1206
+ /* Chrome off, heading kept. Three declarations removed rather than a second component
1123
1207
  with six markers of its own describing the same DOM: a titled region inside something
1124
- that is already a surface wants no second border, and the commonest instance is a
1208
+ that is already a surface wants no second frame, and the commonest instance is a
1125
1209
  section whose body is a DataView — boxed, the table gets a border inside a border and
1126
1210
  loses the full width its own scroll container gives it.
1127
1211
 
1128
- Two, and it was three: background: none went with the base rule's fill. Un-declaring
1129
- what nothing declares is the shape ADR 0094 exists to avoid, and here it would also
1130
- have been the only line in the sheet still implying a card has a colour of its own.
1212
+ background: none is back, and it is the un-declaration the base rule's note warns
1213
+ about, kept deliberately: this variant's whole meaning is "the surface you are already
1214
+ on", so the one thing it must not do is paint a second one. A plain card nested in a
1215
+ card would otherwise be a lighter rectangle inside a lighter rectangle in every dark
1216
+ theme, where surface and raised differ.
1131
1217
 
1132
1218
  padding: 0 rather than dropping the declaration, because the base rule sets it and an
1133
1219
  absent value inherits nothing useful. */
1134
1220
  [data-terp="card"][data-variant="plain"] {
1221
+ background: none;
1135
1222
  border-color: transparent;
1223
+ box-shadow: none;
1136
1224
  padding: 0;
1137
1225
  }
1138
1226
 
@@ -2165,18 +2253,35 @@ textarea[data-terp="input"] {
2165
2253
  2em } ON the element, and a declaration on the element beats an inherited value however
2166
2254
  specific the ancestor rule is: without this the leaf renders at twice the trail.
2167
2255
 
2168
- Semibold at the trail's own size, which is the whole "the trail is the title" idea in one
2169
- declaration — heavier than its ancestors, not larger.
2170
-
2171
- And no line-height of its own, which is the other half of that idea: it takes the trail's
2172
- (see breadcrumbs, where the value and the defect are recorded). A second value here — 1.3
2173
- against the ancestors' inherited normal — is what left the leaf's glyphs sitting 0.59px
2174
- above the crumb they hang off, in the same font at the same size. */
2256
+ xl, not the trail's own sm. "Heavier than its ancestors, not larger" was the rule while the
2257
+ band was 3rem and the leaf had no room to be anything else, and it cost the page its name:
2258
+ at sm/semibold the title measured the same as a table header, less than the action button
2259
+ beside it, and exactly as much as the card titles of the sections under it — so on a hub
2260
+ every HubCard outranked the page it was on. A screen whose largest type belongs to its
2261
+ content is a screen with no masthead, and that reads as unfinished before any one component
2262
+ does. The scale is 24 / 18 / 16 / 14 again: page title, card title, body, description.
2263
+
2264
+ The one-row band still holds its floor, which is the promise this row makes and the number
2265
+ to re-measure if either half moves. --shell-header-height is 3.5rem now, and xl at the TIGHT
2266
+ step is 28.8px, so the title's line box sits inside 56px with room to spare: measured, a hub's
2267
+ band and the app header above it are both 56.0. At the trail's snug step it would be 32.4 and
2268
+ still fit, but the band that carries meta — which has broken the floor by design, and does not
2269
+ make the claim — would take the extra 3.6px on every page with a lead line, so the tight step
2270
+ is what keeps the two bands one apart rather than two.
2271
+
2272
+ That is also the answer to the line height the trail's own rule argues for. Sharing it keeps
2273
+ the leaf's glyphs on the ancestors' baseline, which mattered when leaf and ancestors were the
2274
+ same size; at 24 against 14 they cannot share a baseline anyway and the li centres them, so
2275
+ the value is free to do the job only it can do here.
2276
+
2277
+ Tracking is the scale's tight step, which only starts earning its keep at this size: -0.02em
2278
+ is 0.48px here and nothing at all at 14px, which is why the trail below does not take it. */
2175
2279
  [data-terp="page-title"] {
2176
2280
  margin: 0;
2177
- font-size: var(--font-size-sm);
2281
+ font-size: var(--font-size-xl);
2282
+ line-height: var(--font-line-height-tight);
2178
2283
  font-weight: var(--font-weight-semibold);
2179
- letter-spacing: 0;
2284
+ letter-spacing: var(--font-letter-spacing-tight);
2180
2285
  color: var(--color-neutral-900);
2181
2286
  }
2182
2287
  /* Status pills next to the title. A row of its own so a page passing several keeps them
@@ -2438,6 +2543,14 @@ textarea[data-terp="input"] {
2438
2543
  display: grid;
2439
2544
  gap: var(--space-3);
2440
2545
  }
2546
+ /* The form's named parts, found by whoever cannot read the labels -- the conformance
2547
+ helpers drive this screen in every locale an app ships. No box, so each field and the
2548
+ button stay grid items of login-form and its gap falls between them as it always has. */
2549
+ [data-terp="login-email"],
2550
+ [data-terp="login-password"],
2551
+ [data-terp="login-submit"] {
2552
+ display: contents;
2553
+ }
2441
2554
  [data-terp="login-separator"] {
2442
2555
  display: flex;
2443
2556
  align-items: center;
@@ -2474,6 +2587,7 @@ textarea[data-terp="input"] {
2474
2587
  gap: var(--space-4);
2475
2588
  padding: var(--space-4);
2476
2589
  max-width: 32rem;
2590
+ background: var(--color-bg-surface);
2477
2591
  border: 1px solid var(--color-neutral-200);
2478
2592
  border-radius: var(--radius-lg);
2479
2593
  }
@@ -2616,8 +2730,10 @@ textarea[data-terp="input"] {
2616
2730
  height: 100%;
2617
2731
  min-height: 10rem;
2618
2732
  padding: var(--space-4);
2733
+ background: var(--color-bg-surface);
2619
2734
  border: 1px solid var(--color-neutral-200);
2620
2735
  border-radius: var(--radius-lg);
2736
+ box-shadow: var(--shadow-sm);
2621
2737
  color: var(--color-neutral-900);
2622
2738
  box-sizing: border-box;
2623
2739
  transition: border-color var(--motion-duration-fast) var(--motion-easing-standard);
@@ -2738,6 +2854,7 @@ textarea[data-terp="input"] {
2738
2854
  [data-terp="dataview"][data-variant="full"] > [data-terp="dataview-scroll"],
2739
2855
  [data-terp="dataview"][data-variant="full"] > [data-terp="dataview-error"],
2740
2856
  [data-terp="dataview"][data-variant="full"] > [data-terp="dataview-skeleton"] {
2857
+ background: var(--color-bg-surface);
2741
2858
  border: 1px solid var(--color-neutral-200);
2742
2859
  border-radius: var(--radius-lg);
2743
2860
  }
@@ -3018,19 +3135,46 @@ input[data-terp="input"][type="password"]::-ms-reveal {
3018
3135
  /* The header cell's inline axis follows density; its block axis does not,
3019
3136
  because --space-2 is already worth what --density-compact-cell-pad-y is. The
3020
3137
  0.04em tracking stays a literal: the contract's letter-spacing scale offers
3021
- tight / base / wide, and wide is 0.08em, which would double it. */
3138
+ tight / base / wide, and wide is 0.08em, which would double it.
3139
+
3140
+ The fill is the canvas step, so the header row reads as a recess in the table's own
3141
+ surface rather than as a first row that happens to be shouting. It is the same step the
3142
+ washes take, and it inverts with them: darker than the surface in light, lighter in the
3143
+ three dark themes. Without it the only thing separating nine uppercase labels from the
3144
+ data under them is a hairline, and at xs that is not enough to stop the eye reading the
3145
+ header as a row.
3146
+
3147
+ The ink moved one step WITH the fill, and that is the fill's cost rather than a separate
3148
+ opinion. --color-fg-subtle measured 4.76:1 on the surface it used to sit on, which is inside
3149
+ AA by six hundredths; against the recess it is 4.20 and axe failed every DataView specimen in
3150
+ light. A wash that dims its own label is not free, and the step that pays for it is
3151
+ --color-fg-muted: 6.69 light, and 8.14 at its worst across the other four. */
3022
3152
  [data-terp="dataview-table"] > thead > tr > th {
3023
3153
  position: relative;
3024
3154
  padding: var(--space-2) var(--density-cell-pad-x);
3025
3155
  text-align: left;
3026
3156
  font-size: var(--font-size-xs);
3027
3157
  font-weight: var(--font-weight-semibold);
3028
- color: var(--color-fg-subtle);
3158
+ color: var(--color-fg-muted);
3159
+ background: var(--color-neutral-50);
3029
3160
  text-transform: uppercase;
3030
3161
  letter-spacing: 0.04em;
3031
3162
  border-bottom: 1px solid var(--color-neutral-200);
3032
3163
  white-space: nowrap;
3033
3164
  }
3165
+ /* The header row's outer corners, which the fill above made visible. The full variant's frame
3166
+ carries the radius and deliberately no overflow: hidden — clipping it would trap the
3167
+ horizontal scroll container and any overlay a cell renders (see the frame's own rule) — so a
3168
+ filled th paints a square corner over the curve, and the grey then pokes outside the border
3169
+ at both top corners. Rounding the two end cells to the same step is the fix that leaves the
3170
+ scroller alone. Keyed on the FULL variant: the embedded one has no frame, and a rounded
3171
+ header cell there would be a curve against nothing. */
3172
+ [data-terp="dataview"][data-variant="full"] [data-terp="dataview-table"] > thead > tr > th:first-child {
3173
+ border-start-start-radius: var(--radius-lg);
3174
+ }
3175
+ [data-terp="dataview"][data-variant="full"] [data-terp="dataview-table"] > thead > tr > th:last-child {
3176
+ border-start-end-radius: var(--radius-lg);
3177
+ }
3034
3178
  /* A column's declared track. A MINIMUM rather than a width, because a specified width is only a
3035
3179
  preference under table-layout: auto and the algorithm shrinks it to fit — which is why the pixel
3036
3180
  hint this replaces did nothing at all, measured in the workbench at three columns asking for
@@ -3210,6 +3354,7 @@ th[data-terp="dataview-actions-cell"] > span {
3210
3354
  display: grid;
3211
3355
  gap: var(--space-2);
3212
3356
  padding: var(--density-cell-pad-y) var(--density-cell-pad-x);
3357
+ background: var(--color-bg-surface);
3213
3358
  border: 1px solid var(--color-neutral-200);
3214
3359
  border-radius: var(--radius-lg);
3215
3360
  box-shadow: var(--shadow-sm);
@@ -3529,6 +3674,7 @@ th[data-terp="dataview-actions-cell"] > span {
3529
3674
  justify-content: space-between;
3530
3675
  gap: var(--space-3);
3531
3676
  padding: var(--space-3);
3677
+ background: var(--color-bg-surface);
3532
3678
  border: 1px solid var(--color-neutral-200);
3533
3679
  border-radius: var(--radius-md);
3534
3680
  }
@@ -3536,8 +3682,9 @@ th[data-terp="dataview-actions-cell"] > span {
3536
3682
  /* Empty / error / loading states ------------------------------------------- */
3537
3683
  /* Same centred block, opposite messages: empty is a dashed outline on the page
3538
3684
  surface because nothing is wrong, error is a filled danger wash because
3539
- something is. Which is now literal — the outline is all of it, and the surface
3540
- underneath is whatever the block was dropped on. */
3685
+ something is. The fill is the surface token rather than the danger one — an
3686
+ empty collection is still the page's object, so it sits on the canvas as an
3687
+ object does. */
3541
3688
  [data-terp="empty-state"] {
3542
3689
  display: grid;
3543
3690
  justify-items: center;
@@ -3545,6 +3692,7 @@ th[data-terp="dataview-actions-cell"] > span {
3545
3692
  padding: var(--space-8) var(--space-6);
3546
3693
  text-align: center;
3547
3694
  color: var(--color-neutral-600);
3695
+ background: var(--color-bg-surface);
3548
3696
  border: 1px dashed var(--color-neutral-300);
3549
3697
  border-radius: var(--radius-lg);
3550
3698
  }
@@ -3920,6 +4068,16 @@ button[data-terp="input"][data-placeholder="true"] {
3920
4068
  gap: var(--space-1);
3921
4069
  justify-items: start;
3922
4070
  }
4071
+ /* The hint and the error as one box. It is emitted only when there is something to say, so
4072
+ a field with neither renders no envelope and no row -- see useControlMessages. The grid
4073
+ restates the gap the field used to put between two loose spans, so a field outside a row
4074
+ is unchanged to the pixel; justify-items keeps each message as wide as its own text
4075
+ rather than as wide as the field, which is what a stretched grid item would do. */
4076
+ [data-terp="field-messages"] {
4077
+ display: grid;
4078
+ gap: var(--space-1);
4079
+ justify-items: start;
4080
+ }
3923
4081
  [data-terp="field-hint"] {
3924
4082
  color: var(--color-fg-subtle);
3925
4083
  font-size: var(--font-size-xs);
@@ -3930,6 +4088,194 @@ button[data-terp="input"][data-placeholder="true"] {
3930
4088
  font-weight: var(--font-weight-medium);
3931
4089
  }
3932
4090
 
4091
+
4092
+ /* Field rows --------------------------------------------------------------- */
4093
+ /* Three shared lines -- label, control, messages -- and each field a subgrid of them.
4094
+
4095
+ THE BASE RULE IS THE NARROW SHAPE, mobile-first like SplitPage's panes and DetailList's
4096
+ columns: one column, each field full width, no subgrid and no alignment problem to solve.
4097
+ Everything below is the wide block's job. Declared this way round because three controls
4098
+ and an action do not fit a phone at any gap, so the row a caller writes is the one that
4099
+ has to give way, not the viewport.
4100
+
4101
+ justify-content: start so the tracks take their content's width and the row does not
4102
+ stretch four controls across a 1600px page. grid-auto-columns keeps each track floored at
4103
+ zero -- an auto track floors at min-content, which a long option label would push past its
4104
+ container, the same failure DetailList's minmax(0, 1fr) exists to stop.
4105
+
4106
+ ROW-GAP LIVES ON THE PARENT AND NOT ON THE SUBGRID. A subgrid takes its parent's gutters
4107
+ unless it declares its own, and a field that declared one would space its own three lines
4108
+ while the row's other tracks kept the parent's -- so a bare button, which is not a subgrid,
4109
+ sat 2px above every control on the row. Measured; it reads as a button that is almost
4110
+ aligned, which is worse than one that is obviously not. */
4111
+ [data-terp="field-row"] {
4112
+ display: grid;
4113
+ row-gap: var(--space-1);
4114
+ column-gap: var(--space-2);
4115
+ }
4116
+ /* The gap prop, column only. Declared after the base rule for the reason DetailList's own
4117
+ roll-call is: both weigh the same, so source order is the only thing deciding, and
4118
+ backwards the prop silently does nothing. */
4119
+ [data-terp="field-row"][data-gap="0"] { column-gap: var(--space-0); }
4120
+ [data-terp="field-row"][data-gap="1"] { column-gap: var(--space-1); }
4121
+ [data-terp="field-row"][data-gap="2"] { column-gap: var(--space-2); }
4122
+ [data-terp="field-row"][data-gap="3"] { column-gap: var(--space-3); }
4123
+ [data-terp="field-row"][data-gap="4"] { column-gap: var(--space-4); }
4124
+ [data-terp="field-row"][data-gap="6"] { column-gap: var(--space-6); }
4125
+ [data-terp="field-row"][data-gap="8"] { column-gap: var(--space-8); }
4126
+ /* Quiet actions ------------------------------------------------------------ */
4127
+ /* A value and the action attached to it, where the action is quiet until someone reaches for
4128
+ it. The row itself is unconditional -- inline-flex so it sits inside a sentence or a table
4129
+ cell rather than claiming a block, and baseline-aligned so a chip and its button sit on the
4130
+ value's own reading line. Only the FADE is conditional, and the whole of the condition is
4131
+ in the query below. */
4132
+ [data-terp="quiet-actions"] {
4133
+ display: inline-flex;
4134
+ align-items: baseline;
4135
+ gap: var(--space-1);
4136
+ }
4137
+ [data-terp="quiet-actions"][data-gap="0"] { gap: var(--space-0); }
4138
+ [data-terp="quiet-actions"][data-gap="1"] { gap: var(--space-1); }
4139
+ [data-terp="quiet-actions"][data-gap="2"] { gap: var(--space-2); }
4140
+ [data-terp="quiet-actions"][data-gap="3"] { gap: var(--space-3); }
4141
+ [data-terp="quiet-actions"][data-gap="4"] { gap: var(--space-4); }
4142
+ [data-terp="quiet-actions"][data-gap="6"] { gap: var(--space-6); }
4143
+ [data-terp="quiet-actions"][data-gap="8"] { gap: var(--space-8); }
4144
+ /* The slot holds the actions together and keeps them on the value's line. It exists at every
4145
+ width and in every pointer mode, because it is what reserves the space: the fade changes
4146
+ opacity and never layout, so nothing on the row moves when a pointer arrives. A value that
4147
+ reflows under the cursor is a value you cannot click. */
4148
+ [data-terp="quiet-actions-slot"] {
4149
+ display: inline-flex;
4150
+ align-items: center;
4151
+ gap: var(--space-1);
4152
+ transition: opacity var(--motion-duration-fast) var(--motion-easing-standard);
4153
+ }
4154
+ /* THE ONLY hover-capability query in this sheet, and it is a correctness gate rather than a
4155
+ refinement. On a touch screen there is no hover to reveal anything, so an unconditional
4156
+ rule would leave the action permanently invisible and permanently tappable -- a control
4157
+ that is operable and unfindable, which is worse than a busy row. Where hovering exists the
4158
+ action fades in on hover of the ROW, so reaching for the value reveals its action, and on
4159
+ :focus-within, because opacity does not remove an element from the tab order and a keyboard
4160
+ user must never be sent to a control they cannot see.
4161
+
4162
+ Introducing a media feature the sheet has not used before is a mechanism change; it is
4163
+ justified here because the alternative is not a worse-looking row but an unusable one, and
4164
+ styles.test.ts pins both halves so neither can be dropped without the other being noticed.
4165
+
4166
+ No prefers-reduced-motion clause is needed: that block already sets transition: none on
4167
+ every [data-terp] element, and this slot is one. */
4168
+ @media (hover: hover) {
4169
+ [data-terp="quiet-actions"] [data-terp="quiet-actions-slot"] {
4170
+ opacity: 0;
4171
+ }
4172
+ [data-terp="quiet-actions"]:hover [data-terp="quiet-actions-slot"],
4173
+ [data-terp="quiet-actions"]:focus-within [data-terp="quiet-actions-slot"] {
4174
+ opacity: 1;
4175
+ }
4176
+ }
4177
+
4178
+ /* Meters ------------------------------------------------------------------- */
4179
+ /* A bar and the value printed beside it. inline-flex so a meter sits in a sentence or a
4180
+ DetailList value as readily as in a stack, and it sets no colour and no size on the value:
4181
+ the printed number is text in its row and reads at that row's ink and step, which is also
4182
+ what keeps its contrast the row's own declared pairing rather than a new one. */
4183
+ [data-terp="meter"] {
4184
+ display: inline-flex;
4185
+ align-items: center;
4186
+ gap: var(--space-2);
4187
+ max-inline-size: 100%;
4188
+ }
4189
+ /* The bar is the native element, so the browser draws the proportion from its attributes and
4190
+ nothing here needs a width that depends on the value. A fixed measure rather than a bar
4191
+ that grows with its container, because meters are read against each other: two bars of
4192
+ different lengths make a 60% and a 40% impossible to compare at a glance. 10rem is what the
4193
+ narrowest hub card -- 16rem, less its padding -- holds beside a three-digit percentage
4194
+ without shrinking; below that it shrinks, to a floor.
4195
+
4196
+ An inline-size and not a flex-basis, and that was measured rather than chosen: an
4197
+ inline-flex root sizes itself from its items' own widths, and a meter's own width is the
4198
+ element's intrinsic 5em. With the measure written as a basis the bar came out 70px in a
4199
+ 14px list and 80px in a 16px sentence -- a length set by the surrounding type.
4200
+
4201
+ The track is --color-bg-inset, a recess, and every fill below holds 3:1 against it in all
4202
+ five themes -- declared in token-pairs.json, so the gate measures it rather than this
4203
+ comment. */
4204
+ [data-terp="meter-bar"] {
4205
+ appearance: none;
4206
+ flex: 0 1 auto;
4207
+ inline-size: 10rem;
4208
+ min-inline-size: 4rem;
4209
+ block-size: var(--space-2);
4210
+ margin: 0;
4211
+ border: 0;
4212
+ border-radius: var(--radius-full);
4213
+ background: var(--color-bg-inset);
4214
+ }
4215
+ /* Blink draws the track and the fill as pseudo-elements, one per region, and this is the
4216
+ block the screenshot lane sees; WebKit documents the same pseudo-elements, and no lane runs
4217
+ it. Each engine's selectors are their own rules and must
4218
+ stay that way: a selector list naming a pseudo-element the engine does not know is invalid
4219
+ as a whole, and the engine drops the entire rule -- measured, the adopted sheet keeps every
4220
+ rule here in Chromium and drops only the -moz ones below. */
4221
+ [data-terp="meter-bar"]::-webkit-meter-bar {
4222
+ block-size: 100%;
4223
+ border: 0;
4224
+ border-radius: var(--radius-full);
4225
+ background: var(--color-bg-inset);
4226
+ }
4227
+ [data-terp="meter-bar"]::-webkit-meter-optimum-value,
4228
+ [data-terp="meter-bar"]::-webkit-meter-suboptimum-value,
4229
+ [data-terp="meter-bar"]::-webkit-meter-even-less-good-value {
4230
+ border-radius: var(--radius-full);
4231
+ background: var(--color-fg-accent);
4232
+ }
4233
+ /* The bands, keyed on the region Meter computes rather than on which pseudo-element the
4234
+ engine chose. Unbanded, the browser still puts every value in its "optimum" region -- so
4235
+ styling by the engine's choice would paint a bare quota in the success tone, a judgement
4236
+ nobody made. The attribute is only stamped when a band is declared. */
4237
+ [data-terp="meter-bar"][data-region="optimum"]::-webkit-meter-optimum-value,
4238
+ [data-terp="meter-bar"][data-region="optimum"]::-webkit-meter-suboptimum-value,
4239
+ [data-terp="meter-bar"][data-region="optimum"]::-webkit-meter-even-less-good-value {
4240
+ background: var(--color-status-success);
4241
+ }
4242
+ [data-terp="meter-bar"][data-region="suboptimum"]::-webkit-meter-optimum-value,
4243
+ [data-terp="meter-bar"][data-region="suboptimum"]::-webkit-meter-suboptimum-value,
4244
+ [data-terp="meter-bar"][data-region="suboptimum"]::-webkit-meter-even-less-good-value {
4245
+ background: var(--color-status-warning);
4246
+ }
4247
+ [data-terp="meter-bar"][data-region="even-less-good"]::-webkit-meter-optimum-value,
4248
+ [data-terp="meter-bar"][data-region="even-less-good"]::-webkit-meter-suboptimum-value,
4249
+ [data-terp="meter-bar"][data-region="even-less-good"]::-webkit-meter-even-less-good-value {
4250
+ background: var(--color-status-danger);
4251
+ }
4252
+ /* Gecko draws the element itself as the track and one ::-moz-meter-bar as the fill. NO LANE
4253
+ SEES THESE: the workbench runs one browser, and that browser drops them. They are written
4254
+ to Gecko's documented pseudo-element, unmeasured, and pinned in Meter.test.tsx so that at
4255
+ least deleting or retoning one is noticed. */
4256
+ [data-terp="meter-bar"]::-moz-meter-bar {
4257
+ border-radius: var(--radius-full);
4258
+ background: var(--color-fg-accent);
4259
+ }
4260
+ [data-terp="meter-bar"][data-region="optimum"]::-moz-meter-bar {
4261
+ background: var(--color-status-success);
4262
+ }
4263
+ [data-terp="meter-bar"][data-region="suboptimum"]::-moz-meter-bar {
4264
+ background: var(--color-status-warning);
4265
+ }
4266
+ [data-terp="meter-bar"][data-region="even-less-good"]::-moz-meter-bar {
4267
+ background: var(--color-status-danger);
4268
+ }
4269
+ /* The value is the root's BASELINE, which is what puts a meter on the line of the text around
4270
+ it: the printed number sits on the baseline its label sits on, and the bar is centred on the
4271
+ number. Without it the root takes its baseline from the bar, whose own is its bottom edge.
4272
+ Tabular figures, so a value that changes does not change width and walk the row around. */
4273
+ [data-terp="meter-value"] {
4274
+ align-self: baseline;
4275
+ font-variant-numeric: tabular-nums;
4276
+ white-space: nowrap;
4277
+ }
4278
+
3933
4279
  /* Tooltips ----------------------------------------------------------------- */
3934
4280
  /* No display declaration here on purpose: the panel is hidden with the hidden
3935
4281
  attribute, and any author display would beat the UA's [hidden] rule and
@@ -4115,6 +4461,12 @@ button[data-terp="input"][data-placeholder="true"] {
4115
4461
  font-size: var(--font-size-sm);
4116
4462
  overflow-wrap: anywhere;
4117
4463
  }
4464
+ /* A name and nothing else: sign-out is found by it, and styled as the menu-item it wraps.
4465
+ No box, so the item stays a grid item of the menu and the menu's gap still spaces it --
4466
+ the markdown wrapper's reasoning, and the same one-declaration rule. */
4467
+ [data-terp="user-menu-sign-out"] {
4468
+ display: contents;
4469
+ }
4118
4470
 
4119
4471
  /* Page actions ------------------------------------------------------------- */
4120
4472
  [data-terp="page-actions"] {
@@ -4628,10 +4980,33 @@ button[data-terp="input"][data-placeholder="true"] {
4628
4980
  background: var(--color-sidebar-accent);
4629
4981
  color: var(--color-sidebar-fg);
4630
4982
  }
4983
+ /* The active route, and the brand is in the RAIL rather than in the fill or the ink. It used
4984
+ to be both: --color-brand-primary-soft behind --color-fg-accent. In the three dark themes
4985
+ that soft is a real navy against a near-black sidebar, so the one selected item outweighed
4986
+ the page beside it — measured on midnight, the pill carried more contrast against its own
4987
+ surface than any heading on the screen.
4988
+
4989
+ Moving the fill to neutral is what forced the ink to follow, and the numbers are why rather
4990
+ than a preference: accent ink on the neutral pill measures 4.07:1 in dark and 4.36 in
4991
+ twilight, both under AA, and axe failed every shell specimen in exactly those two themes and
4992
+ no others. --color-sidebar-fg is the pairing the hover rule above already proves, at 9.45 in
4993
+ its worst theme. So the accent survives as the one thing that needs no contrast bar at all.
4994
+
4995
+ Sharing the hover's fill is deliberate and not a collision: hovering the item you are
4996
+ already on should change nothing, and the four signals that separate active from hover are
4997
+ the rail, the weight, and the resting ink the hover is lifting FROM.
4998
+
4999
+ The rail is an inset shadow rather than a border or a pseudo-element: a border would move the
5000
+ label by its own width on selection, and a ::before would need the link to be positioned —
5001
+ the link is the app router's element and the shell owns only where it sits. An inset shadow
5002
+ paints inside the existing box and follows the radius, so nothing reflows and nothing has to
5003
+ be positioned. It is also what survives the icon rail, where the label is visually hidden and
5004
+ a neutral fill alone would say no more than hover does. */
4631
5005
  [data-terp="appshell-nav"] a[aria-current="page"] {
4632
- background: var(--color-brand-primary-soft);
4633
- color: var(--color-fg-accent);
5006
+ background: var(--color-sidebar-accent);
5007
+ color: var(--color-sidebar-fg);
4634
5008
  font-weight: var(--font-weight-semibold);
5009
+ box-shadow: inset var(--border-width-base) 0 0 var(--color-brand-primary);
4635
5010
  }
4636
5011
  [data-terp="appshell-sidebar"][data-collapsed="true"] [data-terp="appshell-nav"] {
4637
5012
  overflow-x: hidden;