@terpjs/react-core 0.16.0 → 0.17.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.
@@ -99,6 +99,7 @@ export const LAYOUT_CONTRACTS: Readonly<Record<string, LayoutContractSpec>> = {
99
99
  DetailPage: {
100
100
  components: {
101
101
  DetailList: "detail-list",
102
+ DetailListGroup: "detail-list-group",
102
103
  Stack: "stack",
103
104
  Tabs: "tabs",
104
105
  ModuleNav: "module-nav",
@@ -132,6 +132,7 @@ const MARKERS = [
132
132
  "dataview-toolbar-spacer",
133
133
  "dataview-toolbar-status",
134
134
  "detail-list",
135
+ "detail-list-group",
135
136
  "detail-list-row",
136
137
  "detail-list-term",
137
138
  "detail-list-value",
@@ -140,6 +141,9 @@ const MARKERS = [
140
141
  "dialog-body",
141
142
  "dialog-description",
142
143
  "dialog-title",
144
+ "disclosure",
145
+ "disclosure-panel",
146
+ "disclosure-toggle",
143
147
  "divider",
144
148
  "drawer-focus-end",
145
149
  "drawer-focus-start",
@@ -464,6 +464,26 @@ describe("cascade structure", () => {
464
464
  expect(chrome, "the band is what separates chrome from content").toContain(
465
465
  "border-block-end: 1px solid var(--color-neutral-200)",
466
466
  );
467
+ // The block padding, and it has to be the same VALUE in both chrome rows rather than the
468
+ // same intention. A min-height is only a height while nothing legal can beat it, and
469
+ // var(--space-2) did not clear that bar: a 2.25rem control plus 8px of padding plus the
470
+ // 1px border is 53px against a floor of 48, so the app header (which always carries its
471
+ // toggle) was 53px, a band with an action button was 53px, and a band with only a title
472
+ // was 48px — the one row whose whole promise is that it matches the header above it,
473
+ // changing height per page.
474
+ //
475
+ // Zero, not a step: var(--space-1) leaves 39px of content box, which clears the 2.25rem
476
+ // control and not the 2.75rem one this package also ships, so a band with a large action
477
+ // button measured 53px again. Both rows spend the same value, and the resolved heights are
478
+ // pinned in the computed lane against the largest control there is; what belongs here is
479
+ // that neither row can move its padding without the other.
480
+ expect(chrome, "the band's block padding is the app header's").toContain(
481
+ "padding-block: var(--space-0)",
482
+ );
483
+ expect(
484
+ bodyFor('[data-terp="appshell-header"]'),
485
+ "both chrome rows spend the same block padding under the floor they share",
486
+ ).toContain("padding: var(--space-0) var(--shell-gutter)");
467
487
  expect(
468
488
  /padding-inline|padding:/.test(chrome),
469
489
  "an inline pad with no bleed would inset the band from the body beneath it",
@@ -860,7 +880,10 @@ describe("cascade structure", () => {
860
880
  '[data-terp="detail-list"][data-columns="2"]',
861
881
  '[data-terp="detail-list"][data-layout="aligned"]',
862
882
  '[data-terp="detail-list"][data-layout="aligned"][data-columns="2"]',
863
- '[data-terp="detail-list"][data-layout="aligned"] [data-terp="detail-list-row"]',
883
+ '[data-terp="detail-list"][data-layout="aligned"] [data-terp="detail-list-row"]:not([data-full="true"])',
884
+ // The group's subgrid is a property of the shared column, so it belongs to the width at
885
+ // which there IS one.
886
+ '[data-terp="detail-list-group"] > [data-terp="detail-list"][data-layout="aligned"]:not([data-columns])',
864
887
  ]) {
865
888
  expect(
866
889
  declaresRuleFor(wide, selector),
@@ -963,6 +986,174 @@ describe("cascade structure", () => {
963
986
  expect(base.slice(headerAt, base.indexOf("}", headerAt))).toContain("align-items: center");
964
987
  });
965
988
 
989
+ it("gives the breadcrumb trail one line box, leaf included", () => {
990
+ // The trail is a row of items that get CENTRED, so two line heights in it are two
991
+ // baselines. The leaf declared 1.3 while its ancestors inherited `normal`: measured at
992
+ // font-size-sm, a 19.00px ancestor line box against an 18.19px leaf, which left the
993
+ // page's own title 0.59px above the crumb it hangs off with the chevron centred on a
994
+ // third line. One declaration on the trail, inherited by every crumb and by the h1, is
995
+ // what makes the row share a baseline.
996
+ //
997
+ // The published step rather than a bare literal, and that is the second half of the fix
998
+ // rather than house style: `normal` is the FONT's metric, so the mismatch was as big as
999
+ // the app's typeface said it was, and an app on a webfont with taller natural leading got
1000
+ // a worse one than the system stack this was measured in.
1001
+ const base = layerBody("terp.base");
1002
+ const trail = base.slice(base.indexOf('[data-terp="breadcrumbs"] {'));
1003
+ expect(
1004
+ trail.slice(0, trail.indexOf("}")),
1005
+ "the trail declares the line box every crumb shares",
1006
+ ).toContain("line-height: var(--font-line-height-snug)");
1007
+ const leafAt = base.indexOf('[data-terp="page-title"] {');
1008
+ expect(leafAt, "the trail's leaf should have a rule").toBeGreaterThan(-1);
1009
+ expect(
1010
+ base.slice(leafAt, base.indexOf("}", leafAt)),
1011
+ "the leaf takes the trail's line box; a second value here is the misalignment",
1012
+ ).not.toContain("line-height");
1013
+ });
1014
+
1015
+ it("spans a full row across every track, and makes it a box that can", () => {
1016
+ // Two halves, and the second is the one that is easy to miss: a display: contents box
1017
+ // generates no box, so grid-column on it is DROPPED and the span silently does not happen.
1018
+ // The aligned row is a contents box above the cutover, so the full row has to become a
1019
+ // block again there — which also gives it the label-above-value reading, the same pair's
1020
+ // narrow shape.
1021
+ const base = layerBody("terp.base");
1022
+ // Anchored on the newline, because the wide block's rule ENDS with the same selector and
1023
+ // an unanchored search finds that one first — which is how this test first passed while
1024
+ // reading the wrong rule.
1025
+ const spanAt = base.indexOf('\n[data-terp="detail-list-row"][data-full="true"] {');
1026
+ expect(spanAt, "the full row should have a span rule").toBeGreaterThan(-1);
1027
+ expect(
1028
+ base.slice(spanAt, base.indexOf("}", spanAt)),
1029
+ "1 / -1, so the row need not know how many tracks the list has",
1030
+ ).toContain("grid-column: 1 / -1");
1031
+ // And the invariant that makes the span reach it: NO rule may turn a full row into a
1032
+ // display: contents box. Asserted over every such rule in the sheet rather than against
1033
+ // the two that exist, because the failure is silent and specificity-shaped — the first
1034
+ // version un-contents-ed the full row in a rule of its own, which tied with the auto
1035
+ // list's contents rule and lost to source order, so `full` did nothing in an auto list at
1036
+ // any width. An exclusion in the selector cannot lose that way; a third contents rule
1037
+ // added without one fails here.
1038
+ const contentsRules = [...base.matchAll(/([^{}]*detail-list-row[^{}]*)\{([^{}]*)\}/g)].filter(
1039
+ ([, , body]) => /display:\s*contents/.test(body!),
1040
+ );
1041
+ expect(contentsRules.length, "the sheet should have contents rules to check").toBeGreaterThan(
1042
+ 0,
1043
+ );
1044
+ for (const [, selector] of contentsRules) {
1045
+ expect(
1046
+ selector!.includes(':not([data-full="true"])'),
1047
+ `${selector!.trim()} would make a full row a contents box, which drops its span`,
1048
+ ).toBe(true);
1049
+ }
1050
+ });
1051
+
1052
+ it("floors both tracks of an auto pair, and caps each at a share of the container", () => {
1053
+ // The two failures this rule is shaped by, both measured rather than reasoned:
1054
+ //
1055
+ // A ZERO FLOOR makes an auto-fit repetition count unbounded — 35 pair repetitions with 31
1056
+ // collapsed to 0px, every pair on one row — so `auto` is the one place in this component
1057
+ // where a track may not be floored at zero. Hence a rem floor per track.
1058
+ //
1059
+ // A 100% CAP IS NOT ENOUGH FOR A PAIR. Grid's floor is min(16rem, 100%) because one track
1060
+ // wider than its container overflows it; two tracks at 100% each can sum to 200%, and the
1061
+ // list scrolled sideways in a narrow panel. The percentage shares are what keep one pair
1062
+ // inside one container, so they must stay strictly under 100% between them.
1063
+ const base = layerBody("terp.base");
1064
+ const at = base.indexOf('[data-terp="detail-list"][data-layout="aligned"][data-columns="auto"] {');
1065
+ expect(at, "aligned auto should have its own track list").toBeGreaterThan(-1);
1066
+ const body = base.slice(at, base.indexOf("}", at));
1067
+ const floors = [...body.matchAll(/min\((\d+)rem, (\d+)%\)/g)].map((match) => ({
1068
+ rem: Number(match[1]),
1069
+ share: Number(match[2]),
1070
+ }));
1071
+ expect(floors, "both tracks of the pair carry a floor").toHaveLength(2);
1072
+ expect(
1073
+ floors.every((floor) => floor.rem > 0),
1074
+ "a zero floor makes the repetition count unbounded",
1075
+ ).toBe(true);
1076
+ expect(
1077
+ floors.reduce((sum, floor) => sum + floor.share, 0),
1078
+ "the shares must leave room for the gap, or one pair overflows its container",
1079
+ ).toBeLessThan(100);
1080
+ // The layouts with no label column repeat ONE track, and at Grid's own floor, so a stacked
1081
+ // auto list and a grid of cards break at the same width by construction.
1082
+ const plainAt = base.indexOf('[data-terp="detail-list"][data-columns="auto"] {');
1083
+ expect(plainAt, "auto should have a no-label-column track list too").toBeGreaterThan(-1);
1084
+ expect(base.slice(plainAt, base.indexOf("}", plainAt))).toContain(
1085
+ "repeat(auto-fit, minmax(min(16rem, 100%), 1fr))",
1086
+ );
1087
+ // And the shared column for an auto list is declared at EVERY width, unlike the closed
1088
+ // counts': the cutover is what `auto` exists to not need.
1089
+ const rowAt = base.indexOf(
1090
+ '[data-terp="detail-list"][data-layout="aligned"][data-columns="auto"]\n [data-terp="detail-list-row"]',
1091
+ );
1092
+ expect(rowAt, "the auto row rule should exist").toBeGreaterThan(-1);
1093
+ const wideAt = base.indexOf("@media not all and (max-width: 768px)");
1094
+ expect(
1095
+ rowAt > wideAt && rowAt > base.indexOf("}", base.indexOf('[data-terp="detail-list"] {')),
1096
+ "the auto row rule belongs outside the wide block, at every width",
1097
+ ).toBe(true);
1098
+ });
1099
+
1100
+ it("gives the group the aligned track list verbatim, gutter included", () => {
1101
+ // A subgrid takes the PARENT's tracks and the parent's gutter along the axis it subgrids,
1102
+ // so these two declarations are one measure written twice — and a group whose tracks
1103
+ // disagreed with aligned's would line its lists up with each other and with nothing else
1104
+ // on the card. Compared rather than described, because the failure is invisible until two
1105
+ // cards are side by side.
1106
+ const base = layerBody("terp.base");
1107
+ const alignedAt = base.indexOf('[data-terp="detail-list"][data-layout="aligned"] {');
1108
+ const aligned = base.slice(alignedAt, base.indexOf("}", alignedAt));
1109
+ const groupAt = base.indexOf('[data-terp="detail-list-group"] {');
1110
+ expect(groupAt, "the group should have a base rule").toBeGreaterThan(-1);
1111
+ const group = base.slice(groupAt, base.indexOf("}", groupAt));
1112
+ const tracks = (body: string) => /grid-template-columns:\s*([^;]+);/.exec(body)?.[1]?.trim();
1113
+ const columnGap = (body: string) => /column-gap:\s*([^;]+);/.exec(body)?.[1]?.trim();
1114
+ expect(tracks(aligned), "aligned declares the shared track list").toBeTruthy();
1115
+ expect(tracks(group), "the group shares aligned's track list").toBe(tracks(aligned));
1116
+ expect(columnGap(group), "and its gutter, which the subgrid inherits").toBe(
1117
+ columnGap(aligned),
1118
+ );
1119
+ // Every child spans the group, or a subgridded list would occupy one track and its values
1120
+ // would land in the label column.
1121
+ const childAt = base.indexOf('[data-terp="detail-list-group"] > * {');
1122
+ expect(childAt, "the group's children should span it").toBeGreaterThan(-1);
1123
+ expect(base.slice(childAt, base.indexOf("}", childAt))).toContain("grid-column: 1 / -1");
1124
+ // And both of the group's rules reach its OWN children only. The child combinator looks
1125
+ // like a tightening that could be relaxed and is the opposite: subgrid needs the element to
1126
+ // be a grid item of the box owning the tracks, so as a descendant selector this would reach
1127
+ // a list nested in a Stack, compute to `none` for want of a parent grid, and take that
1128
+ // list's own label column with it. Not sharing is the correct outcome for a nested list;
1129
+ // losing its tracks is not.
1130
+ // Whitespace-normalised, because a selector this long is wrapped in the sheet and the
1131
+ // wrapping is not the contract.
1132
+ const flat = base.replace(/\s+/g, " ");
1133
+ for (const rule of [
1134
+ '[data-terp="detail-list-group"] > *',
1135
+ '[data-terp="detail-list-group"] > [data-terp="detail-list"][data-layout="aligned"]:not([data-columns])',
1136
+ ]) {
1137
+ expect(
1138
+ flat.includes(rule),
1139
+ `${rule} must stay a child combinator: subgrid on a nested list computes to none`,
1140
+ ).toBe(true);
1141
+ }
1142
+ // The group's gap is a row gap at every step, for the list's own reason: the column gap is
1143
+ // the shared measure and is not a caller's to move.
1144
+ for (const token of [0, 1, 2, 3, 4, 6, 8]) {
1145
+ const stepAt = base.indexOf(`[data-terp="detail-list-group"][data-gap="${token}"]`);
1146
+ expect(stepAt, `the group has no rule for gap ${token}`).toBeGreaterThan(-1);
1147
+ const step = base.slice(stepAt, base.indexOf("}", stepAt));
1148
+ expect(step, `gap ${token} must set the row gap only`).toContain(
1149
+ `row-gap: var(--space-${token})`,
1150
+ );
1151
+ expect(/[^-]column-gap|^column-gap/.test(step), `gap ${token} must not touch the columns`).toBe(
1152
+ false,
1153
+ );
1154
+ }
1155
+ });
1156
+
966
1157
  it("gives the page title, a card title and body copy three different steps", () => {
967
1158
  // The scale was flat: the single h1 of a view rendered at lg (18px) against a card title at
968
1159
  // base (16px) against 16px prose — one step from the h1 to a section heading, and a section
@@ -1525,6 +1716,7 @@ describe("cascade structure", () => {
1525
1716
  "splitpage-panes",
1526
1717
  "splitpane",
1527
1718
  "detail-list",
1719
+ "detail-list-group",
1528
1720
  "combobox",
1529
1721
  "combobox-list",
1530
1722
  "combobox-option",
package/src/styles.ts CHANGED
@@ -397,6 +397,37 @@ html {
397
397
  and the icon inherits — so a tone is one declaration pair rather than three
398
398
  places to keep in step. The body restates the reading colour, because the
399
399
  copy must stay neutral-900 while the frame and glyph carry the tone. */
400
+ /* Disclosure. The toggle is a text button that happens to carry a chevron, so it
401
+ inherits the reading colour rather than the accent -- a row of accent-coloured
402
+ "Technical details" links reads as navigation, and this navigates nowhere. The
403
+ chevron rotates by swapping the glyph rather than by transform, which keeps the
404
+ two states legible with animation disabled.
405
+
406
+ The panel is indented to the width of the chevron plus its gap, so the revealed
407
+ content lines up with the label above it instead of with the glyph. */
408
+ [data-terp="disclosure"] {
409
+ display: flex;
410
+ flex-direction: column;
411
+ gap: var(--space-2);
412
+ }
413
+ [data-terp="disclosure-toggle"] {
414
+ display: inline-flex;
415
+ align-items: center;
416
+ gap: var(--space-2);
417
+ align-self: flex-start;
418
+ padding: var(--space-1) var(--space-2);
419
+ margin-inline-start: calc(var(--space-2) * -1);
420
+ border: none;
421
+ border-radius: var(--radius-sm);
422
+ background: none;
423
+ color: var(--color-neutral-700);
424
+ font: inherit;
425
+ font-weight: 500;
426
+ cursor: pointer;
427
+ }
428
+ [data-terp="disclosure-panel"] {
429
+ padding-inline-start: calc(var(--space-4) + var(--space-2));
430
+ }
400
431
  [data-terp="alert"] {
401
432
  display: grid;
402
433
  grid-template-columns: auto 1fr;
@@ -609,10 +640,42 @@ textarea[data-terp="input"] {
609
640
  /* display: contents is what makes the dt and dd grid items of the dl itself, so labels align
610
641
  ACROSS rows without a DOM change — and it belongs in here rather than in the base rules
611
642
  because it is the mechanism of the shared column, which exists only above the cutover.
612
- Narrow, the row wrapper stays a block and each pair reads as two lines. */
613
- [data-terp="detail-list"][data-layout="aligned"] [data-terp="detail-list-row"] {
643
+ Narrow, the row wrapper stays a block and each pair reads as two lines.
644
+
645
+ EVERY ROW BUT THE FULL ONE, and the exclusion is the whole of how full works rather than
646
+ a special case bolted onto it. A box that generates no box has no grid area, so the
647
+ grid-column the full row asks for is DROPPED and its span silently does not happen. Said
648
+ as :not() here, the full row is simply never a contents box — in this rule, in the auto
649
+ rule below, and in any third one someone adds — instead of being un-contents-ed again
650
+ afterwards by a rule that has to out-specify each of them in turn. The first version did
651
+ it that way and the auto list was the case it lost: same weight, declared earlier, so
652
+ full did nothing there at any width. */
653
+ [data-terp="detail-list"][data-layout="aligned"]
654
+ [data-terp="detail-list-row"]:not([data-full="true"]) {
614
655
  display: contents;
615
656
  }
657
+ /* The shared measure across several lists (ADR 0113). The GROUP owns the track list -- see
658
+ its base rule below -- and each aligned list inside becomes a subgrid of it, so every
659
+ label in every list is measured against one track instead of each list measuring its own.
660
+ Four lists on a card had four different gutters before this, none of them wrong by that
661
+ list's own rules, which is why it read as sloppy rather than broken.
662
+
663
+ Keyed on :not([data-columns]) rather than on the marker alone, and that exclusion is the
664
+ honest half: a two-pair list needs FOUR tracks and the group publishes two, so folding it
665
+ in would reflow its pairs to one per row -- a layout change wearing an alignment fix's
666
+ clothes. It keeps its own tracks and its own measure, which is what it renders today.
667
+
668
+ Inside the wide block because that is where the shared column exists at all: below the
669
+ cutover every list is one column with the label above its value, so there is nothing to
670
+ share and the group is a plain stack of lists.
671
+
672
+ No feature query, and that is a property of subgrid rather than an omission: where it is
673
+ unsupported the declaration is dropped and each list keeps its own tracks, which is
674
+ exactly today's output. Baseline-wide since Chrome 117, Safari 16, Firefox 71. */
675
+ [data-terp="detail-list-group"]
676
+ > [data-terp="detail-list"][data-layout="aligned"]:not([data-columns]) {
677
+ grid-template-columns: subgrid;
678
+ }
616
679
  }
617
680
 
618
681
  /* Grids -------------------------------------------------------------------- */
@@ -689,6 +752,19 @@ textarea[data-terp="input"] {
689
752
  [data-terp="detail-list-row"] {
690
753
  min-width: 0;
691
754
  }
755
+ /* One pair across every track, for the value that cannot live in a column: a paragraph, a
756
+ payload, a code block. Declared at every width, which costs nothing where there is one track
757
+ to span and is the point where there are four -- and it is what stopped a wide value from
758
+ needing a SECOND list, whose independently measured label column put its values on a
759
+ different vertical line from the first list's.
760
+
761
+ 1 / -1 rather than a span count, so it does not have to know whether the list is one pair
762
+ wide, two, or an auto-fit count nobody wrote down. It is a grid item in every layout,
763
+ because the two rules that make a row a display: contents box both exclude it by
764
+ selector — a contents box has no grid area and would drop this declaration silently. */
765
+ [data-terp="detail-list-row"][data-full="true"] {
766
+ grid-column: 1 / -1;
767
+ }
692
768
  [data-terp="detail-list-term"] {
693
769
  display: inline;
694
770
  font-weight: var(--font-weight-medium);
@@ -729,6 +805,50 @@ textarea[data-terp="input"] {
729
805
  [data-terp="detail-list"][data-layout="stacked"] {
730
806
  row-gap: var(--space-3);
731
807
  }
808
+ /* columns="auto", and its tracks live HERE rather than in the wide-viewport block above --
809
+ which is the whole of what it is for. The closed counts need a cutover because a number
810
+ cannot fit a phone; an auto-fit floor needs none, so this list follows its CONTAINER instead
811
+ of the window. That is the difference that matters for a list inside a card inside a split
812
+ pane, where the window says nothing about the width the list actually got.
813
+
814
+ Two published floors, and they are the behaviour rather than a detail: a pair is at least
815
+ 9rem of label and 13rem of value. Measured across seven container widths -- three pairs at
816
+ 1200px, two at 900px, one from 700px down.
817
+
818
+ The percentage cap is the part that is not obvious, and it is a real failure rather than
819
+ defensive. Grid's floor is min(16rem, 100%) because ONE track wider than its container
820
+ overflows it; a PAIR has two floors and 100% each lets their sum reach 200%, so a detail
821
+ list in a narrow panel scrolled sideways -- measured overflowing at 120px with both floors
822
+ capped at 100%. 30% and 60% leave the gap its share, so one pair always fits: no sideways
823
+ scroll at 240px.
824
+
825
+ A zero floor is not an option here even though every other track in this component takes
826
+ one. minmax(0, max-content) inside an auto-fit repeat makes the repetition count unbounded:
827
+ measured, Chromium generated 35 pair repetitions and collapsed 31 of them to 0px, putting
828
+ every pair on one row. Floors are what make auto-fit mean anything.
829
+
830
+ 16rem for the layouts with no label column, which is Grid's own floor -- so a stacked auto
831
+ list and a Grid of cards break at the same width by construction rather than by coincidence,
832
+ the same argument the hub grid's floor already makes. */
833
+ [data-terp="detail-list"][data-columns="auto"] {
834
+ grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr));
835
+ column-gap: var(--space-4);
836
+ }
837
+ [data-terp="detail-list"][data-layout="aligned"][data-columns="auto"] {
838
+ grid-template-columns: repeat(
839
+ auto-fit,
840
+ minmax(min(9rem, 30%), max-content) minmax(min(13rem, 60%), 1fr)
841
+ );
842
+ column-gap: var(--space-3);
843
+ }
844
+ /* The shared column for an auto list, at EVERY width, which the aligned rule in the wide block
845
+ only gives above the cutover. Without it an auto list below the cutover would place each pair
846
+ BLOCK into one auto track, so the label would sit above its value in a list that had asked to
847
+ be measured -- the reflow this prop exists to replace, arriving through the back door. */
848
+ [data-terp="detail-list"][data-layout="aligned"][data-columns="auto"]
849
+ [data-terp="detail-list-row"]:not([data-full="true"]) {
850
+ display: contents;
851
+ }
732
852
  [data-terp="detail-list"][data-layout="aligned"] [data-terp="detail-list-term"],
733
853
  [data-terp="detail-list"][data-layout="aligned"] [data-terp="detail-list-value"],
734
854
  [data-terp="detail-list"][data-layout="stacked"] [data-terp="detail-list-term"],
@@ -767,6 +887,48 @@ textarea[data-terp="input"] {
767
887
  [data-terp="detail-list"][data-gap="6"] { row-gap: var(--space-6); }
768
888
  [data-terp="detail-list"][data-gap="8"] { row-gap: var(--space-8); }
769
889
 
890
+ /* The detail-list group (ADR 0113): several lists, one measured label column.
891
+ The subgrid half is in the wide-viewport block above, where the shared column exists; this
892
+ is the container that owns the tracks it shares.
893
+
894
+ THE TRACK LIST IS DECLARED ONCE, HERE, AND AT EVERY WIDTH -- not split into a narrow shape
895
+ and a wide override, and that is a placement decision rather than a shortcut. The wide block
896
+ sits ~100 lines above this section, so an override there would have to out-specify a rule
897
+ that comes later in source; the group root has no second attribute to spend on that. It does
898
+ not need one: with every child spanning 1 / -1, a group whose children are NOT subgrids
899
+ renders exactly as a stack of full-width lists, because the label track is then sized by
900
+ nothing and collapses to zero. So the narrow shape needs no rule at all and the two shapes
901
+ cannot drift apart.
902
+
903
+ It must be the aligned track list, verbatim, and column-gap with it: a subgrid takes the
904
+ PARENT's gutters along the axis it subgrids, so the group's column-gap becomes the
905
+ label-to-value distance inside every list in it. styles.test.ts pins the two against each
906
+ other, because a group whose tracks disagreed with aligned's would align the lists to each
907
+ other and to nothing else on the card. */
908
+ [data-terp="detail-list-group"] {
909
+ display: grid;
910
+ grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
911
+ column-gap: var(--space-3);
912
+ row-gap: var(--space-4);
913
+ min-width: 0;
914
+ }
915
+ /* Every child spans the group, lists and everything between them alike -- a heading, a
916
+ divider, a paragraph. A list that becomes a subgrid needs the span to reach both tracks;
917
+ a child that does not is simply full width, which is what it would have been on its own. */
918
+ [data-terp="detail-list-group"] > * {
919
+ grid-column: 1 / -1;
920
+ min-width: 0;
921
+ }
922
+ /* The distance between the lists. row-gap only, for the reason the list's own gap prop gives:
923
+ the column gap is the shared measure and belongs to the group's rule above, not to a caller. */
924
+ [data-terp="detail-list-group"][data-gap="0"] { row-gap: var(--space-0); }
925
+ [data-terp="detail-list-group"][data-gap="1"] { row-gap: var(--space-1); }
926
+ [data-terp="detail-list-group"][data-gap="2"] { row-gap: var(--space-2); }
927
+ [data-terp="detail-list-group"][data-gap="3"] { row-gap: var(--space-3); }
928
+ [data-terp="detail-list-group"][data-gap="4"] { row-gap: var(--space-4); }
929
+ [data-terp="detail-list-group"][data-gap="6"] { row-gap: var(--space-6); }
930
+ [data-terp="detail-list-group"][data-gap="8"] { row-gap: var(--space-8); }
931
+
770
932
  /* Checkboxes / radios / switches ------------------------------------------- */
771
933
  /* One label shape for all three, so the marker is shared: the control differs,
772
934
  the "box or dot, gap, then its text" arrangement does not. accent-color is
@@ -1130,9 +1292,32 @@ textarea[data-terp="input"] {
1130
1292
  /* Breadcrumbs -------------------------------------------------------------- */
1131
1293
  /* The trail owns its whole subtree, so the list and its items are addressed
1132
1294
  structurally and the current crumb by the aria-current it already carries —
1133
- no marker for something the accessibility tree already states. */
1295
+ no marker for something the accessibility tree already states.
1296
+
1297
+ ONE line-height for every crumb, declared here rather than left to inherit, and it is a
1298
+ repair rather than a tidy-up. The leaf declared 1.3 of its own (see page-title) while its
1299
+ ancestors inherited line-height: normal, so a row that centres its items was centring two
1300
+ different line boxes and the two could not share a baseline. Measured in the workbench at
1301
+ font-size-sm: the ancestors' line box resolved to 19.00px against the leaf's 18.19px, which
1302
+ left the leaf's glyphs 0.59px above the crumb it hangs off, with the chevron between them
1303
+ centred on a third line. Sub-pixel, and it reads as a trail whose end sits high.
1304
+
1305
+ DECLARED rather than inherited for the second half of the same defect: normal is the FONT's
1306
+ own metric, so the size of the mismatch was whatever the app's typeface happened to say, and
1307
+ an app on a webfont with taller natural leading got a worse one than the system stack this
1308
+ was measured in. A published step is the one value the ancestor links and the h1 can agree
1309
+ on without either of them asking the font.
1310
+
1311
+ What this does NOT fix is the chevron's optical centring, and that is a decision rather than
1312
+ an oversight. Its box centres on the line box at 95.48px while the crumb's ink centres at
1313
+ 96.00px, because the font's ascent carries 5px of empty space above the caps against 4px of
1314
+ descent below the baseline — so a box-centred glyph sits half a pixel high. Correcting it
1315
+ means a nudge in em against ONE font's metrics, and this package renders system-ui: Segoe UI
1316
+ here, SF on macOS, Roboto on Android. A correction that is right on one is wrong on the other
1317
+ two, so the half pixel stays. */
1134
1318
  [data-terp="breadcrumbs"] {
1135
1319
  font-size: var(--font-size-sm);
1320
+ line-height: var(--font-line-height-snug);
1136
1321
  color: var(--color-neutral-600);
1137
1322
  }
1138
1323
  [data-terp="breadcrumbs"] ol,
@@ -1472,8 +1657,41 @@ textarea[data-terp="input"] {
1472
1657
  above. That is a published contract token rather than a private property because
1473
1658
  tokens.guard.test.ts refuses a fallback-less var() against anything tokens.css does not
1474
1659
  declare — and a shell measure an app may want to move is what ADR 0097 §1 says a contract
1475
- token is for. The block padding is untouched and stays var(--space-2) under the
1476
- min-height floor.
1660
+ token is for.
1661
+
1662
+ The BLOCK padding is ZERO, and that is what makes --shell-header-height mean anything. It
1663
+ was var(--space-2) under the min-height floor and the floor never once applied: this header
1664
+ ALWAYS carries a control — the sidebar toggle, the theme and language triggers — and a
1665
+ control is --density-control-min-height, 2.25rem. 36px of control plus 8px of padding plus
1666
+ the 1px border is 53px against a floor of 48, so the token an app reads to line its own
1667
+ chrome up with this header was 5px short of the header itself, and the page band below
1668
+ (which reads the same token, and carries a control only on a page that has actions) was 48px
1669
+ on some pages and 53px on others. Measured, both of them, in the workbench.
1670
+
1671
+ Zero rather than a step, and the step is what the first attempt used: var(--space-1) leaves
1672
+ a 39px content box, which clears the 2.25rem control and NOT the 2.75rem one the package
1673
+ also ships (Button size="lg" is --density-control-min-height plus --space-2). Measured: a
1674
+ band whose action button was large came out at 53px again — the same defect, on a legal
1675
+ composition, four pixels of padding away. At zero the content box is the floor less its
1676
+ border, 47px, which clears every control this package has; the row centres its content, so
1677
+ a 36px control sits with 5.5px above and below it either way and nothing about the ordinary
1678
+ band moves.
1679
+
1680
+ What zero costs is the WRAPPED row's breathing room, and the row gap is what pays for it:
1681
+ a band that wraps grows past the floor and its two lines stay var(--space-2) apart, but the
1682
+ first line now starts at the border. That is the trade — a rare row a little tight against
1683
+ its edge, against a common row whose height depended on which control the page happened to
1684
+ put in it.
1685
+
1686
+ A headroom argument rather than a proof, so it is pinned where a resolved height can be read
1687
+ instead of inferred: the workbench's computed lane asserts both chrome rows come out at
1688
+ --shell-header-height with no control, with the default one, and with the largest one the
1689
+ package ships.
1690
+
1691
+ Not solved by raising the token instead, which was the other candidate. 3rem is published
1692
+ geometry an app can already move from its own theme.css, and a consumer reading it to
1693
+ offset something against this header is entitled to the number being true — so the fix is
1694
+ to make the header the height it claims, not to redefine the claim around the padding.
1477
1695
 
1478
1696
  No backticks anywhere above, and that is not a style preference: one here terminates
1479
1697
  TERP_STYLES_CSS and the parse then fails somewhere else entirely with "try inserting a
@@ -1487,7 +1705,7 @@ textarea[data-terp="input"] {
1487
1705
  align-items: center;
1488
1706
  justify-content: space-between;
1489
1707
  gap: var(--space-3);
1490
- padding: var(--space-2) var(--shell-gutter);
1708
+ padding: var(--space-0) var(--shell-gutter);
1491
1709
  min-height: var(--shell-header-height);
1492
1710
  box-sizing: border-box;
1493
1711
  background: var(--color-neutral-0);
@@ -1689,8 +1907,10 @@ textarea[data-terp="input"] {
1689
1907
  list. In a band the title is CHROME — it names where you are, above content that starts
1690
1908
  immediately under a border — and a 24px leaf on a trail of 14px ancestors reads as
1691
1909
  small-small-BIG rather than as one trail. It also does not fit: the band is
1692
- shell-header-height with space-2 of block padding, which leaves 2rem, and xl at
1693
- line-height 1.3 is 1.95rem of it before a badge or a lead line asks for room.
1910
+ shell-header-height less its 1px border, which leaves 47px, and xl at the trail's line
1911
+ height is 2.03rem of it before a badge or a lead line asks for room —
1912
+ and the row would then be set by the title rather than by the floor, which is the defect
1913
+ the padding above was cut to end.
1694
1914
  --font-size-xl keeps two readers (heading[data-size="xl"], login-title), so the top of the
1695
1915
  scale is still wired; an app that wants the masthead back redefines the marker from its own
1696
1916
  unlayered theme.css, exactly as the retired comment here said.
@@ -1727,14 +1947,18 @@ textarea[data-terp="input"] {
1727
1947
  specific the ancestor rule is: without this the leaf renders at twice the trail.
1728
1948
 
1729
1949
  Semibold at the trail's own size, which is the whole "the trail is the title" idea in one
1730
- declaration — heavier than its ancestors, not larger. */
1950
+ declaration — heavier than its ancestors, not larger.
1951
+
1952
+ And no line-height of its own, which is the other half of that idea: it takes the trail's
1953
+ (see breadcrumbs, where the value and the defect are recorded). A second value here — 1.3
1954
+ against the ancestors' inherited normal — is what left the leaf's glyphs sitting 0.59px
1955
+ above the crumb they hang off, in the same font at the same size. */
1731
1956
  [data-terp="page-title"] {
1732
1957
  margin: 0;
1733
1958
  font-size: var(--font-size-sm);
1734
1959
  font-weight: var(--font-weight-semibold);
1735
1960
  letter-spacing: 0;
1736
1961
  color: var(--color-neutral-900);
1737
- line-height: 1.3;
1738
1962
  }
1739
1963
  /* Status pills next to the title. A row of its own so a page passing several keeps them
1740
1964
  together when the band wraps, rather than letting one pill orphan onto the second line. */
@@ -1771,6 +1995,16 @@ textarea[data-terp="input"] {
1771
1995
  height this is reading. Without it the two are a padding apart and the "same height as the
1772
1996
  header above it" claim is off by 1rem.
1773
1997
 
1998
+ padding-block is ZERO for the reason the app header's rule states in full, and this row is
1999
+ where the symptom showed: with var(--space-2) a single action button beat the floor, so the
2000
+ band was 53px on a page with actions and 48px on a page without — the one piece of chrome
2001
+ whose entire promise is that it is the same height as the header above it, changing height
2002
+ per page. var(--space-1) fixed that for the default control and not for the large one, which
2003
+ is why this is zero rather than a step. It still grows past the floor when the row WRAPS, which is the
2004
+ one case that should move it: a long title meeting a wide action cluster takes a second
2005
+ line rather than overflowing, and a band that clipped its own title to keep a height would
2006
+ be the worse trade.
2007
+
1774
2008
  :not([data-measure="narrow"]) because a form is capped WITH its header (ADR 0098 §3) — a
1775
2009
  Save button a screen-width from its field is worse than one over it — so a form gets the
1776
2010
  one-row band with no chrome at all: a title row, which is what it wants.
@@ -1779,7 +2013,7 @@ textarea[data-terp="input"] {
1779
2013
  is nothing to bleed into and an inline pad with no negative margin would inset the band's
1780
2014
  content from the body beneath it for no reason. */
1781
2015
  [data-terp="page"]:not([data-measure="narrow"]) > [data-terp="page-header"] {
1782
- padding-block: var(--space-2);
2016
+ padding-block: var(--space-0);
1783
2017
  min-height: var(--shell-header-height);
1784
2018
  box-sizing: border-box;
1785
2019
  border-block-end: 1px solid var(--color-neutral-200);
@@ -3865,6 +4099,15 @@ button[data-terp="input"][data-placeholder="true"] {
3865
4099
  }
3866
4100
 
3867
4101
  @layer terp.state {
4102
+ /* Disclosure's toggle is a text button, so its hover is a quiet wash rather than a
4103
+ fill -- the control sits inside reading content and a solid hover would read as a
4104
+ row selection. No focus rule: the [data-terp]:focus-visible rule below already covers every
4105
+ marked element, and restating it here would be a copy that can drift out of step. */
4106
+ [data-terp="disclosure-toggle"]:hover {
4107
+ background: var(--color-neutral-100);
4108
+ color: var(--color-neutral-900);
4109
+ }
4110
+
3868
4111
  /* Shared focus-visible ring: every interactive element that opts in via
3869
4112
  [data-terp] shows a soft outline ring. It must stay in terp.state. It ties
3870
4113
  with [data-terp="button"][data-variant="primary"] on specificity — both
@@ -8,6 +8,7 @@ afterEach(() => {
8
8
  cleanup();
9
9
  window.localStorage.clear();
10
10
  document.documentElement.removeAttribute("data-theme");
11
+ document.documentElement.style.removeProperty("color-scheme");
11
12
  });
12
13
 
13
14
  describe("ThemeProvider + ThemeToggle", () => {
@@ -34,6 +35,35 @@ describe("ThemeProvider + ThemeToggle", () => {
34
35
  expect(window.localStorage.getItem(THEME_STORAGE_KEY)).toBe("dark");
35
36
  });
36
37
 
38
+ it("hands back the pre-paint bootstrap's inline color-scheme", () => {
39
+ // `public/theme-bootstrap.js` stamps the stored palette on <html> before the first paint
40
+ // and declares its appearance inline with it, because in a dev server the token sheet
41
+ // arrives with the bundle and the attribute alone has no palette to paint from. Inline
42
+ // is what makes that work and also what makes it a loan: a style attribute outranks
43
+ // every rule in every layer, so a viewer who loaded on a dark palette and then chose a
44
+ // light one would keep dark scrollbars, a dark caret and a dark select popup for the
45
+ // rest of the session, on a page that is no longer dark.
46
+ document.documentElement.setAttribute("data-theme", "dark");
47
+ document.documentElement.style.colorScheme = "dark";
48
+ window.localStorage.setItem(THEME_STORAGE_KEY, "dark");
49
+
50
+ render(
51
+ <ThemeProvider>
52
+ <ThemeToggle />
53
+ </ThemeProvider>,
54
+ );
55
+ // Taken back on mount, while the palette it described is still the live one — so the
56
+ // token sheet's own per-theme declaration is what governs from here.
57
+ expect(document.documentElement.style.getPropertyValue("color-scheme")).toBe("");
58
+ expect(document.documentElement.getAttribute("data-theme")).toBe("dark");
59
+
60
+ // And it does not come back when the choice changes, which is the case it exists for.
61
+ fireEvent.click(screen.getByRole("button", { name: "Theme" }));
62
+ fireEvent.click(screen.getByRole("menuitemradio", { name: "Light" }));
63
+ expect(document.documentElement.getAttribute("data-theme")).toBe("light");
64
+ expect(document.documentElement.style.getPropertyValue("color-scheme")).toBe("");
65
+ });
66
+
37
67
  it("applies a named theme beyond light and dark", () => {
38
68
  // The named themes are the reason the semantic token layer exists. They are compiled,
39
69
  // contrast-gated and published, and none of that reaches a user unless the control can