@vectoriox/iox-ui 5.195.0 → 5.196.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 (33) hide show
  1. package/composite-core/index.d.ts +12 -2
  2. package/design-core/index.d.ts +353 -8
  3. package/fesm2022/vectoriox-iox-ui-composite-core.mjs +26 -4
  4. package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
  5. package/fesm2022/vectoriox-iox-ui-design-core.mjs +711 -264
  6. package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
  7. package/fesm2022/vectoriox-iox-ui-generation-core.mjs +642 -498
  8. package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
  9. package/fesm2022/vectoriox-iox-ui-harness-core.mjs +221 -2
  10. package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
  11. package/fesm2022/vectoriox-iox-ui-identity-core.mjs +11 -5
  12. package/fesm2022/vectoriox-iox-ui-identity-core.mjs.map +1 -1
  13. package/fesm2022/vectoriox-iox-ui.mjs +70 -17
  14. package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
  15. package/generation-core/index.d.ts +183 -93
  16. package/harness-core/index.d.ts +165 -3
  17. package/identity-core/index.d.ts +8 -1
  18. package/index.d.ts +23 -2
  19. package/package.json +1 -1
  20. package/src/composite-core/account-runtime.ts +2 -2
  21. package/src/composite-core/header.ts +23 -1
  22. package/src/design-core/contrast-audit.ts +38 -0
  23. package/src/design-core/flavor-spec.generated.ts +275 -1
  24. package/src/design-core/header-behaviour.ts +172 -3
  25. package/src/design-core/node-classes.ts +9 -2
  26. package/src/generation-core/compose-site.ts +25 -8
  27. package/src/generation-core/header-mix.ts +165 -12
  28. package/src/generation-core/site-spec.generated.ts +41 -9
  29. package/src/harness-core/business-types.ts +11 -0
  30. package/src/harness-core/harness-spec.generated.ts +213 -0
  31. package/src/harness-core/run-compose-context.ts +9 -3
  32. package/src/identity-core/site-auth-transport.ts +11 -4
  33. package/styles/iox-design.css +148 -6
@@ -910,6 +910,31 @@ export const SPEC_TIERS = {
910
910
  "type": "spacing",
911
911
  "default": "16px var(--iox-space-inline)"
912
912
  },
913
+ {
914
+ "name": "nav-glass-bg",
915
+ "type": "color",
916
+ "default": "color-mix(in srgb, var(--iox-bg) 90%, transparent)"
917
+ },
918
+ {
919
+ "name": "nav-glass-backdrop",
920
+ "type": "effect",
921
+ "default": "blur(12px) saturate(140%)"
922
+ },
923
+ {
924
+ "name": "nav-glass-border",
925
+ "type": "color",
926
+ "default": "var(--iox-line)"
927
+ },
928
+ {
929
+ "name": "nav-glass-shadow",
930
+ "type": "shadow",
931
+ "default": "none"
932
+ },
933
+ {
934
+ "name": "nav-over-veil",
935
+ "type": "paint",
936
+ "default": "linear-gradient(to bottom, color-mix(in srgb, var(--iox-bg) 32%, transparent), transparent)"
937
+ },
913
938
  {
914
939
  "name": "field-bg",
915
940
  "type": "color",
@@ -4151,9 +4176,11 @@ export const SPEC_A11Y = {
4151
4176
  "surface-glass": "var(--iox-surface)",
4152
4177
  "surface-glass-strong": "var(--iox-surface)",
4153
4178
  "blur-surface": "none",
4179
+ "nav-glass-bg": "var(--iox-bg)",
4154
4180
  "button-secondary-backdrop": "none",
4155
4181
  "card-backdrop": "none",
4156
4182
  "nav-backdrop": "none",
4183
+ "nav-glass-backdrop": "none",
4157
4184
  "dialog-backdrop": "none",
4158
4185
  "tabbar-backdrop": "none",
4159
4186
  "segmented-track-backdrop": "none"
@@ -6188,6 +6215,28 @@ export const SPEC_CONTRAST_AUDIT = {
6188
6215
  "scheme": "inverse",
6189
6216
  "image": "#FFFFFF"
6190
6217
  }
6218
+ ],
6219
+ "floatingGrounds": [
6220
+ {
6221
+ "ground": "nav-bg",
6222
+ "ink": "text"
6223
+ },
6224
+ {
6225
+ "ground": "nav-glass-bg",
6226
+ "ink": "text"
6227
+ },
6228
+ {
6229
+ "ground": "dialog-bg",
6230
+ "ink": "text"
6231
+ },
6232
+ {
6233
+ "ground": "popover-bg",
6234
+ "ink": "text"
6235
+ },
6236
+ {
6237
+ "ground": "surface-glass-strong",
6238
+ "ink": "text"
6239
+ }
6191
6240
  ]
6192
6241
  } as const;
6193
6242
 
@@ -7517,6 +7566,41 @@ export const SPEC_FLAVOR_PACKS = [
7517
7566
  "group": "components",
7518
7567
  "value": "16px var(--iox-space-inline)"
7519
7568
  },
7569
+ {
7570
+ "name": "nav-glass-bg",
7571
+ "tier": "component",
7572
+ "type": "color",
7573
+ "group": "components",
7574
+ "value": "color-mix(in srgb, var(--iox-bg) 90%, transparent)"
7575
+ },
7576
+ {
7577
+ "name": "nav-glass-backdrop",
7578
+ "tier": "component",
7579
+ "type": "effect",
7580
+ "group": "components",
7581
+ "value": "blur(12px) saturate(140%)"
7582
+ },
7583
+ {
7584
+ "name": "nav-glass-border",
7585
+ "tier": "component",
7586
+ "type": "color",
7587
+ "group": "components",
7588
+ "value": "var(--iox-line)"
7589
+ },
7590
+ {
7591
+ "name": "nav-glass-shadow",
7592
+ "tier": "component",
7593
+ "type": "shadow",
7594
+ "group": "components",
7595
+ "value": "none"
7596
+ },
7597
+ {
7598
+ "name": "nav-over-veil",
7599
+ "tier": "component",
7600
+ "type": "paint",
7601
+ "group": "components",
7602
+ "value": "linear-gradient(to bottom, color-mix(in srgb, var(--iox-bg) 32%, transparent), transparent)"
7603
+ },
7520
7604
  {
7521
7605
  "name": "field-bg",
7522
7606
  "tier": "component",
@@ -9976,6 +10060,44 @@ export const SPEC_FLAVOR_PACKS = [
9976
10060
  "group": "components",
9977
10061
  "value": "16px var(--iox-space-inline)"
9978
10062
  },
10063
+ {
10064
+ "name": "nav-glass-bg",
10065
+ "tier": "component",
10066
+ "type": "color",
10067
+ "group": "components",
10068
+ "value": "color-mix(in srgb, var(--iox-bg) 90%, transparent)"
10069
+ },
10070
+ {
10071
+ "name": "nav-glass-backdrop",
10072
+ "tier": "component",
10073
+ "type": "effect",
10074
+ "group": "components",
10075
+ "value": "blur(20px) saturate(135%)",
10076
+ "overridden": true
10077
+ },
10078
+ {
10079
+ "name": "nav-glass-border",
10080
+ "tier": "component",
10081
+ "type": "color",
10082
+ "group": "components",
10083
+ "value": "color-mix(in srgb, var(--iox-text) 10%, transparent)",
10084
+ "overridden": true
10085
+ },
10086
+ {
10087
+ "name": "nav-glass-shadow",
10088
+ "tier": "component",
10089
+ "type": "shadow",
10090
+ "group": "components",
10091
+ "value": "0 10px 30px color-mix(in srgb, var(--iox-text) 7%, transparent)",
10092
+ "overridden": true
10093
+ },
10094
+ {
10095
+ "name": "nav-over-veil",
10096
+ "tier": "component",
10097
+ "type": "paint",
10098
+ "group": "components",
10099
+ "value": "linear-gradient(to bottom, color-mix(in srgb, var(--iox-bg) 32%, transparent), transparent)"
10100
+ },
9979
10101
  {
9980
10102
  "name": "field-bg",
9981
10103
  "tier": "component",
@@ -12447,6 +12569,42 @@ export const SPEC_FLAVOR_PACKS = [
12447
12569
  "group": "components",
12448
12570
  "value": "16px var(--iox-space-inline)"
12449
12571
  },
12572
+ {
12573
+ "name": "nav-glass-bg",
12574
+ "tier": "component",
12575
+ "type": "color",
12576
+ "group": "components",
12577
+ "value": "color-mix(in srgb, var(--iox-bg) 72%, transparent)",
12578
+ "overridden": true
12579
+ },
12580
+ {
12581
+ "name": "nav-glass-backdrop",
12582
+ "tier": "component",
12583
+ "type": "effect",
12584
+ "group": "components",
12585
+ "value": "blur(12px) saturate(140%)"
12586
+ },
12587
+ {
12588
+ "name": "nav-glass-border",
12589
+ "tier": "component",
12590
+ "type": "color",
12591
+ "group": "components",
12592
+ "value": "var(--iox-line)"
12593
+ },
12594
+ {
12595
+ "name": "nav-glass-shadow",
12596
+ "tier": "component",
12597
+ "type": "shadow",
12598
+ "group": "components",
12599
+ "value": "none"
12600
+ },
12601
+ {
12602
+ "name": "nav-over-veil",
12603
+ "tier": "component",
12604
+ "type": "paint",
12605
+ "group": "components",
12606
+ "value": "linear-gradient(to bottom, color-mix(in srgb, var(--iox-bg) 32%, transparent), transparent)"
12607
+ },
12450
12608
  {
12451
12609
  "name": "field-bg",
12452
12610
  "tier": "component",
@@ -14883,7 +15041,7 @@ export const SPEC_FLAVOR_PACKS = [
14883
15041
  "tier": "component",
14884
15042
  "type": "color",
14885
15043
  "group": "components",
14886
- "value": "var(--iox-surface-glass)",
15044
+ "value": "var(--iox-surface-glass-strong)",
14887
15045
  "overridden": true
14888
15046
  },
14889
15047
  {
@@ -14934,6 +15092,45 @@ export const SPEC_FLAVOR_PACKS = [
14934
15092
  "value": "10px var(--iox-space-inline)",
14935
15093
  "overridden": true
14936
15094
  },
15095
+ {
15096
+ "name": "nav-glass-bg",
15097
+ "tier": "component",
15098
+ "type": "color",
15099
+ "group": "components",
15100
+ "value": "var(--iox-surface-glass-strong)",
15101
+ "overridden": true
15102
+ },
15103
+ {
15104
+ "name": "nav-glass-backdrop",
15105
+ "tier": "component",
15106
+ "type": "effect",
15107
+ "group": "components",
15108
+ "value": "var(--iox-blur-surface)",
15109
+ "overridden": true
15110
+ },
15111
+ {
15112
+ "name": "nav-glass-border",
15113
+ "tier": "component",
15114
+ "type": "color",
15115
+ "group": "components",
15116
+ "value": "var(--iox-glass-border)",
15117
+ "overridden": true
15118
+ },
15119
+ {
15120
+ "name": "nav-glass-shadow",
15121
+ "tier": "component",
15122
+ "type": "shadow",
15123
+ "group": "components",
15124
+ "value": "var(--iox-shadow-md), var(--iox-glass-edge)",
15125
+ "overridden": true
15126
+ },
15127
+ {
15128
+ "name": "nav-over-veil",
15129
+ "tier": "component",
15130
+ "type": "paint",
15131
+ "group": "components",
15132
+ "value": "linear-gradient(to bottom, color-mix(in srgb, var(--iox-bg) 32%, transparent), transparent)"
15133
+ },
14937
15134
  {
14938
15135
  "name": "field-bg",
14939
15136
  "tier": "component",
@@ -17411,6 +17608,44 @@ export const SPEC_FLAVOR_PACKS = [
17411
17608
  "group": "components",
17412
17609
  "value": "16px var(--iox-space-inline)"
17413
17610
  },
17611
+ {
17612
+ "name": "nav-glass-bg",
17613
+ "tier": "component",
17614
+ "type": "color",
17615
+ "group": "components",
17616
+ "value": "color-mix(in srgb, var(--iox-bg) 88%, transparent)",
17617
+ "overridden": true
17618
+ },
17619
+ {
17620
+ "name": "nav-glass-backdrop",
17621
+ "tier": "component",
17622
+ "type": "effect",
17623
+ "group": "components",
17624
+ "value": "blur(16px) saturate(150%)",
17625
+ "overridden": true
17626
+ },
17627
+ {
17628
+ "name": "nav-glass-border",
17629
+ "tier": "component",
17630
+ "type": "color",
17631
+ "group": "components",
17632
+ "value": "transparent",
17633
+ "overridden": true
17634
+ },
17635
+ {
17636
+ "name": "nav-glass-shadow",
17637
+ "tier": "component",
17638
+ "type": "shadow",
17639
+ "group": "components",
17640
+ "value": "none"
17641
+ },
17642
+ {
17643
+ "name": "nav-over-veil",
17644
+ "tier": "component",
17645
+ "type": "paint",
17646
+ "group": "components",
17647
+ "value": "linear-gradient(to bottom, color-mix(in srgb, var(--iox-bg) 32%, transparent), transparent)"
17648
+ },
17414
17649
  {
17415
17650
  "name": "field-bg",
17416
17651
  "tier": "component",
@@ -19876,6 +20111,45 @@ export const SPEC_FLAVOR_PACKS = [
19876
20111
  "group": "components",
19877
20112
  "value": "16px var(--iox-space-inline)"
19878
20113
  },
20114
+ {
20115
+ "name": "nav-glass-bg",
20116
+ "tier": "component",
20117
+ "type": "color",
20118
+ "group": "components",
20119
+ "value": "var(--iox-nav-bg)",
20120
+ "overridden": true
20121
+ },
20122
+ {
20123
+ "name": "nav-glass-backdrop",
20124
+ "tier": "component",
20125
+ "type": "effect",
20126
+ "group": "components",
20127
+ "value": "none",
20128
+ "overridden": true
20129
+ },
20130
+ {
20131
+ "name": "nav-glass-border",
20132
+ "tier": "component",
20133
+ "type": "color",
20134
+ "group": "components",
20135
+ "value": "var(--iox-nav-border)",
20136
+ "overridden": true
20137
+ },
20138
+ {
20139
+ "name": "nav-glass-shadow",
20140
+ "tier": "component",
20141
+ "type": "shadow",
20142
+ "group": "components",
20143
+ "value": "var(--iox-nav-shadow)",
20144
+ "overridden": true
20145
+ },
20146
+ {
20147
+ "name": "nav-over-veil",
20148
+ "tier": "component",
20149
+ "type": "paint",
20150
+ "group": "components",
20151
+ "value": "linear-gradient(to bottom, color-mix(in srgb, var(--iox-bg) 32%, transparent), transparent)"
20152
+ },
19879
20153
  {
19880
20154
  "name": "field-bg",
19881
20155
  "tier": "component",
@@ -36,6 +36,9 @@ export enum HeaderTrait {
36
36
  /** AW6 (AW6-D10): `follows` — its colours follow the section under it as the page scrolls. Absent / `opening`: it
37
37
  * wears the page's opening (#71), as before. Written by the Header studio ▸ Ground and the composer (`ink:follows`). */
38
38
  Ink = 'headerInk',
39
+ /** HI3 slice 1 (HI3-D1): what the header stands on — `glass` | `over` | `over-glass`. Absent / `solid`: its own ground,
40
+ * as before. Written by the Header studio ▸ Around the bar and the composer (`ground:<word>`). */
41
+ Ground = 'headerGround',
39
42
  }
40
43
 
41
44
  /** Whose colours the header wears (contract HEADER `ink`): the page's opening, or every section as it passes under it. */
@@ -54,6 +57,10 @@ export enum HeaderAttribute {
54
57
  /** `follows` on a header whose colours follow the section under it (the header ink runtime writes the page's
55
58
  * `data-iox-opening` as each section passes; the shared CSS cross-fades). Absent: it wears the opening. */
56
59
  Ink = 'data-iox-header-ink',
60
+ /** `glass` | `over` | `over-glass` on a header that does not stand on its own solid ground (HI3 slice 1): the shared
61
+ * CSS draws the ground on ONE `::before` faded by opacity, gives the bar's height back over a pictured opening and
62
+ * lays the veil under its words at rest. Absent: the bar's own ground, as before. */
63
+ Ground = 'data-iox-header-ground',
57
64
  }
58
65
 
59
66
  /** What a composed header gets (the `nav.*` patterns' `header`, the palette's Navigation bar). */
@@ -85,17 +92,179 @@ export function headerInkOf(value: unknown): HeaderInk {
85
92
  return value === HeaderInk.Follows ? HeaderInk.Follows : HeaderInk.Opening;
86
93
  }
87
94
 
88
- /** The attributes a header renders, from its trait values — `{}` for a header that keeps today's behaviour. */
89
- export function headerAttributes(behaviour: unknown, edge: unknown, ink?: unknown): Record<string, string> {
95
+ /** The attributes a header renders, from its trait values — `{}` for a header that keeps today's behaviour. A header on
96
+ * glass draws no scroll edge (HI3-D9: its set carries its own hairline and shadow), whatever edge it stores. */
97
+ export function headerAttributes(behaviour: unknown, edge: unknown, ink?: unknown, ground?: unknown): Record<string, string> {
90
98
  const out: Record<string, string> = {};
91
99
  if (headerInkOf(ink) === HeaderInk.Follows) out[HeaderAttribute.Ink] = HeaderInk.Follows;
92
100
  const b = headerBehaviourOf(behaviour);
93
101
  if (b !== HeaderBehaviour.Scrolls) out[HeaderAttribute.Behaviour] = b;
102
+ const g = headerGroundOf(ground);
103
+ if (g !== HeaderGround.Solid) out[HeaderAttribute.Ground] = g;
94
104
  const e = headerEdgeOf(edge);
95
- if (e) out[HeaderAttribute.Edge] = e;
105
+ if (e && !headerGroundIsGlass(g)) out[HeaderAttribute.Edge] = e;
96
106
  return out;
97
107
  }
98
108
 
109
+ // ── What the header stands on (HI3 slice 1: over · over-glass · glass) ───────────────────────────────────────────────
110
+
111
+ /**
112
+ * What a header stands on (contract HEADER `ground`, HI3-D1). `blend` waits for slice 2+ and is never a trait value
113
+ * (a stored `blend` reads as solid). ONE answer every renderer applies: `headerAttributes` writes the word, the shared
114
+ * CSS (`iox-design.css`) draws it, and `headerFirm` / the selectors below say when the ground shows.
115
+ */
116
+ export enum HeaderGround {
117
+ /** Its own ground (the look's bar), as every header before HI3. */
118
+ Solid = 'solid',
119
+ /** The look's glass from the first frame. */
120
+ Glass = 'glass',
121
+ /** Over the opening, clear at first; the look's own bar once the page moves. */
122
+ Over = 'over',
123
+ /** Over the opening, clear at first; the look's glass once the page moves. */
124
+ OverGlass = 'over-glass',
125
+ }
126
+
127
+ const GROUNDS = new Set<string>(Object.values(HeaderGround));
128
+
129
+ /** A stored ground, or Solid for anything else. */
130
+ export function headerGroundOf(value: unknown): HeaderGround {
131
+ return typeof value === 'string' && GROUNDS.has(value) ? value as HeaderGround : HeaderGround.Solid;
132
+ }
133
+
134
+ /** The grounds that stand over the opening at rest (clear until the page moves). */
135
+ export const OVER_GROUNDS: ReadonlyArray<HeaderGround> = [HeaderGround.Over, HeaderGround.OverGlass];
136
+ /** The grounds that turn into the look's glass (`nav-glass-*`), and draw no scroll edge (HI3-D9). */
137
+ export const GLASS_GROUNDS: ReadonlyArray<HeaderGround> = [HeaderGround.Glass, HeaderGround.OverGlass];
138
+
139
+ /** True for a ground that stands over the opening at rest. */
140
+ export function headerGroundIsOver(ground: unknown): boolean {
141
+ return OVER_GROUNDS.includes(headerGroundOf(ground));
142
+ }
143
+
144
+ /** True for a ground that turns into the look's glass. */
145
+ export function headerGroundIsGlass(ground: unknown): boolean {
146
+ return GLASS_GROUNDS.includes(headerGroundOf(ground));
147
+ }
148
+
149
+ /**
150
+ * Whether the page OPENS on a picture the header can stand over (HI3-D10), written by each renderer beside
151
+ * `data-iox-opening` (the engine's body, in the raw SSR; the canvas's globals layer) from `openingMediaOf(layout)`.
152
+ */
153
+ export const OPENING_MEDIA_ATTRIBUTE = 'data-iox-opening-media';
154
+
155
+ export enum OpeningMediaKind {
156
+ /** The first section's picture (a photo, a film, slides, an object, a material) fills the top of the page. */
157
+ Picture = 'picture',
158
+ /** The page opens on a plain ground (words, an inset card, a form): an over header shows its ground from the top. */
159
+ Plain = 'plain',
160
+ }
161
+
162
+ /** A node as `openingMediaOf` reads it (both renderers' shapes: the builder's ComponentNode, a SerializedNode). */
163
+ export interface OpeningMediaNode {
164
+ type?: string;
165
+ role?: string | null;
166
+ props?: Readonly<Record<string, unknown>> | null;
167
+ styleProps?: Readonly<Record<string, unknown>> | null;
168
+ children?: ReadonlyArray<unknown> | null;
169
+ }
170
+
171
+ /** The props key a composed opening stores its mix under (generation-core `OPENING_MIX_PROP`; spelled here: design-core
172
+ * reads no generation-core). Its words are `<ingredient>:<word>`, space-separated. */
173
+ const OPENING_MIX_PROP = 'openingMix';
174
+ const OPENING_NO_MEDIA = 'none';
175
+ /** The frame that leaves the page's own ground at the top: the picture is a card inset from the edges. */
176
+ const OPENING_INSET_FRAME = 'inset';
177
+ /** Node types that ARE a picture: a section that is one, or a layer of one laid behind its words. */
178
+ const PICTURE_TYPES: ReadonlySet<string> = new Set(['Image', 'Video', 'SliderContainer', 'Gallery']);
179
+ const LAYER_POSITIONS: ReadonlySet<string> = new Set(['absolute', 'fixed']);
180
+ const PICTURE_PAINT = /url\(|image-set\(/i;
181
+
182
+ const wordOf = (mix: string, ingredient: string): string | null =>
183
+ mix.split(/\s+/).find(w => w.startsWith(`${ingredient}:`))?.slice(ingredient.length + 1) ?? null;
184
+ const paintsPicture = (styles: Readonly<Record<string, unknown>> | null | undefined): boolean =>
185
+ ['backgroundImage', 'background'].some(k => PICTURE_PAINT.test(String(styles?.[k] ?? '')));
186
+
187
+ /**
188
+ * What a page opens on, from its own nodes in order (never its globals): a composed opening by its mix (a picture unless
189
+ * its media is `none` or its frame is `inset`); any other first section when it paints a picture as its background, IS a
190
+ * picture, or lays one behind its words (a positioned Image / Video / slider child). A page with no nodes is plain. Pure.
191
+ */
192
+ export function openingMediaOf(layout: ReadonlyArray<OpeningMediaNode | null | undefined> | null | undefined): OpeningMediaKind {
193
+ const first = layout?.find(n => !!n);
194
+ if (!first) return OpeningMediaKind.Plain;
195
+ const mix = first.props?.[OPENING_MIX_PROP];
196
+ if (typeof mix === 'string' && mix.trim()) {
197
+ const media = wordOf(mix, 'media');
198
+ const frame = wordOf(mix, 'frame');
199
+ return media && media !== OPENING_NO_MEDIA && frame !== OPENING_INSET_FRAME ? OpeningMediaKind.Picture : OpeningMediaKind.Plain;
200
+ }
201
+ if (paintsPicture(first.styleProps) || (first.type && PICTURE_TYPES.has(first.type))) return OpeningMediaKind.Picture;
202
+ const layer = ((first.children ?? []) as ReadonlyArray<OpeningMediaNode | null>).some(c =>
203
+ !!c && !!c.type && PICTURE_TYPES.has(c.type) && LAYER_POSITIONS.has(String(c.styleProps?.['position'] ?? '')));
204
+ return layer ? OpeningMediaKind.Picture : OpeningMediaKind.Plain;
205
+ }
206
+
207
+ /** The attribute a page's renderer writes beside `data-iox-opening`. */
208
+ export function openingMediaAttributes(layout: ReadonlyArray<OpeningMediaNode | null | undefined> | null | undefined): Record<string, string> {
209
+ return { [OPENING_MEDIA_ATTRIBUTE]: openingMediaOf(layout) };
210
+ }
211
+
212
+ /** Where the header is in its page's moment: has the page moved (the shipped Page scrolled state, G4), is its menu open,
213
+ * what does the page open on. */
214
+ export interface HeaderMoment {
215
+ scrolled?: boolean;
216
+ menuOpen?: boolean;
217
+ openingMedia?: OpeningMediaKind | `${OpeningMediaKind}` | null;
218
+ }
219
+
220
+ /**
221
+ * Whether the header shows its ground — FIRM (HI3-D4, D10, D11): a solid or glass header always; an over header once the
222
+ * page has moved, while its menu is open, and from the top on a page that opens without a picture. The ONE answer: the
223
+ * shared CSS draws it through `HEADER_AT_REST_SELECTOR` (held equal to this by header-behaviour.spec), the canvas's
224
+ * "At the top · Scrolled" pair asks it. Pure.
225
+ */
226
+ export function headerFirm(ground: unknown, moment: HeaderMoment = {}): boolean {
227
+ if (!headerGroundIsOver(ground)) return true;
228
+ return !(moment.openingMedia === OpeningMediaKind.Picture && !moment.scrolled && !moment.menuOpen);
229
+ }
230
+
231
+ /** Whether the header gives its height back to the page (HI3-D7): it does not stand on its own solid ground, over a page
232
+ * that opens on a picture — the picture starts at the top of the page, under the bar. */
233
+ export function headerGivesBack(ground: unknown, openingMedia: unknown): boolean {
234
+ return headerGroundOf(ground) !== HeaderGround.Solid && openingMedia === OpeningMediaKind.Picture;
235
+ }
236
+
237
+ /** The Page scrolled state's attribute (main entry `SCROLLED_ATTRIBUTE`; spelled here — design-core reads no Angular
238
+ * entry; held equal by the scrolled spec). */
239
+ export const HEADER_SCROLLED_ATTRIBUTE = 'data-iox-scrolled';
240
+ /** An open menu inside the header (the drawer / full / panel Dialog is the header's own child — T2). */
241
+ export const HEADER_OPEN_MENU_SELECTOR = 'dialog[open]';
242
+ /** The CSS custom property the header runtime writes its height in (`watchHeaderHeight`), on the scope around it. */
243
+ export const HEADER_HEIGHT_VAR = '--header-h';
244
+
245
+ const groundIs = (grounds: ReadonlyArray<HeaderGround>): string => `:is(${grounds.map(g => `[${HeaderAttribute.Ground}="${g}"]`).join(', ')})`;
246
+ const onPicture = `:is([${OPENING_MEDIA_ATTRIBUTE}="${OpeningMediaKind.Picture}"] *)`;
247
+
248
+ /**
249
+ * The header AT REST (not firm), as a compound selector on the header's own element — `headerFirm`'s twin in CSS: an over
250
+ * ground, inside a page that opens on a picture, not inside a scrolled page, holding no open menu.
251
+ */
252
+ export const HEADER_AT_REST_SELECTOR =
253
+ `${groundIs(OVER_GROUNDS)}${onPicture}:not([${HEADER_SCROLLED_ATTRIBUTE}] *):not(:has(${HEADER_OPEN_MENU_SELECTOR}))`;
254
+
255
+ /** The header that gives its height back (`headerGivesBack`'s twin): any ground word, inside a page that opens on a picture. */
256
+ export const HEADER_GIVES_BACK_SELECTOR = `[${HeaderAttribute.Ground}]${onPicture}`;
257
+
258
+ /**
259
+ * Whose colours a header wears at rest and once firm (HI3-D8), as the part of the opening follower's selector the header's
260
+ * element must match: a header with no ground word, or one that follows every section, wears the opening as before; a
261
+ * header standing on a ground wears the opening only AT REST — once firm, the page's own.
262
+ */
263
+ export const OPENING_FOLLOWER_GROUND_CLAUSES: ReadonlyArray<string> = [
264
+ `:where(:not([${HeaderAttribute.Ground}]:not([${HeaderAttribute.Ink}="${HeaderInk.Follows}"])))`,
265
+ `:where(${HEADER_AT_REST_SELECTOR})`,
266
+ ];
267
+
99
268
  // ── The header's name on a phone (vectoriox/iox-ui#98) ─────────────────────────────────────────────────────────────
100
269
 
101
270
  /** The brand's role (generation-core `NavRole.Brand`, spelled here: design-core reads no generation-core). */
@@ -3,6 +3,7 @@ import { SPEC_AXES, SPEC_SCHEME_INK, SPEC_SCHEMES } from './flavor-spec.generate
3
3
  import { isListMixClass, listMixClasses } from './list-classes';
4
4
  import { footerMixClasses, isFooterMixClass } from './footer-classes';
5
5
  import { isSectionDesignClass, sectionDesignClasses } from './section-edge';
6
+ import { OPENING_FOLLOWER_GROUND_CLAUSES } from './header-behaviour';
6
7
 
7
8
  /**
8
9
  * The design-system classes a node renders, in BOTH renderers (builder canvas, engine component
@@ -74,9 +75,15 @@ export function pageOpeningScheme(pageSettings: Readonly<Record<string, unknown>
74
75
  return colorSchemeClass(id) ? (id as ColorScheme) : null;
75
76
  }
76
77
 
77
- /** The header that follows an opening of scheme `id` and names none of its own, inside `scope` (the builder's token scope). */
78
+ /**
79
+ * The header that follows an opening of scheme `id` and names none of its own, inside `scope` (the builder's token scope).
80
+ * HI3-D8: a header standing on a ground (over · over-glass · glass) follows the opening only at rest — once it has turned
81
+ * it wears the page's own colours (unless its colours follow every section). Two selectors, each the same specificity as
82
+ * before (the ground clauses are `:where()`).
83
+ */
78
84
  export function openingFollowerSelector(id: string, scope?: string): string {
79
- return `${scope ? `${scope} ` : ''}[${OPENING_ATTRIBUTE}="${id}"] .${roleClass(OPENING_FOLLOWER_ROLE)}:not([class*="${SCHEME_PREFIX}"])`;
85
+ const base = `${scope ? `${scope} ` : ''}[${OPENING_ATTRIBUTE}="${id}"] .${roleClass(OPENING_FOLLOWER_ROLE)}:not([class*="${SCHEME_PREFIX}"])`;
86
+ return OPENING_FOLLOWER_GROUND_CLAUSES.map(clause => `${base}${clause}`).join(', ');
80
87
  }
81
88
 
82
89
  /**