@vectoriox/iox-ui 5.157.0 → 5.158.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.
@@ -436,7 +436,9 @@ export enum LayoutMendKind {
436
436
  /** Words over a busy or too-light part of a photo, in a look that allows scrims: the layer gets one. */
437
437
  Scrim = 'scrim',
438
438
  /** The accent on more layers than the look allows: the least important words go back to the ink, then — where words
439
- * cannot give enough back — the least important accent bands take the ground nearest the accent their words read on. */
439
+ * cannot give enough back — the least important accent bands take the ground nearest the accent their words read on,
440
+ * then the least important primary buttons step to secondary (never the main call to action — iox-ui#131: a page whose
441
+ * accent was on its buttons fell back whole). */
440
442
  Accent = 'accent',
441
443
  /** Words too faint on their ground, where the ink holds there: they go back to the ink. */
442
444
  Ink = 'ink',
@@ -485,6 +487,11 @@ export enum LayoutMendKind {
485
487
  * the column the type is offered first (`contained`) — said to the owner as `column-mended`. A word outside the
486
488
  * axis is dropped (the page wears the site's). */
487
489
  Column = 'column',
490
+ /** iox-ui#131: words a few characters too many for their box (a near miss): one size step down, where they then fit
491
+ * and the smaller size still holds them — never below a heading's reading size, never the opening's display. */
492
+ Size = 'size',
493
+ /** iox-ui#131: a form a column or two narrower than a form needs: it widens into empty cells of its own rows. */
494
+ Widen = 'widen',
488
495
  }
489
496
 
490
497
  /** What the build says when the column a page asked for was mended (award §0c CW2). */
@@ -543,7 +550,9 @@ export interface LayoutBandMove {
543
550
  export type LayoutMend =
544
551
  | { kind: LayoutMendKind.Scrim | LayoutMendKind.Ink | LayoutMendKind.Fade; layer: string }
545
552
  | { kind: LayoutMendKind.Scrub; layer: string; why: `${LayoutScrubRefusal}` }
546
- | { kind: LayoutMendKind.Accent; over: number; bands?: ReadonlyArray<LayoutBandMove> }
553
+ | { kind: LayoutMendKind.Accent; over: number; bands?: ReadonlyArray<LayoutBandMove>; buttons?: ReadonlyArray<string> }
554
+ | { kind: LayoutMendKind.Size; layer: string; size: `${LayoutSize}` }
555
+ | { kind: LayoutMendKind.Widen; layer: string; col: [number, number] }
547
556
  | { kind: LayoutMendKind.Depth; layers: ReadonlyArray<string> }
548
557
  | { kind: LayoutMendKind.Source; layer: string; source: string; by: `${LayoutSourceChoice}` }
549
558
  | { kind: LayoutMendKind.Words | LayoutMendKind.Drop | LayoutMendKind.Drift; layer: string }
@@ -36,6 +36,8 @@ const ROW_ROLES: Readonly<Record<OpeningIngredient, ReadonlyArray<string>>> = {
36
36
  [OpeningIngredient.Words]: [OpeningRole.Words, OpeningRole.Title, OpeningRole.Lead, OpeningRole.Action, OpeningRole.Apart, OpeningRole.ApartWord, OpeningRole.Aside, OpeningRole.Cutout, OpeningRole.Scrim],
37
37
  [OpeningIngredient.Extras]: [OpeningRole.Card, OpeningRole.Badge, OpeningRole.Cue],
38
38
  [OpeningIngredient.Motion]: [],
39
+ // iox-ui#131: a type-led first screen's ground is its frame's scheme.
40
+ [OpeningIngredient.Ground]: [OpeningRole.Frame, OpeningRole.FrameSettles],
39
41
  };
40
42
 
41
43
  /** The props that are the owner's CONTENT (words, pictures, a film, a form's identity) — never a sign of a hand edit. */
@@ -1,5 +1,6 @@
1
1
  import { DesignChoices, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
2
2
 
3
+ import { LAYOUT_INSET } from './layout-column';
3
4
  import { GenerationTier } from './site-plan.model';
4
5
  import { PatternNode, PatternPlaceholder, PatternRecipe, SitePattern } from './patterns';
5
6
  import { SerializedNode, walkSerialized } from './serialized-node';
@@ -49,6 +50,8 @@ interface OpeningTable {
49
50
  typeLed?: ReadonlyArray<{ frame: string; words: string }>;
50
51
  /** AW-D23 amended (2026-11-24): a type-led way is worn at every tier. */
51
52
  typeLedEveryTier?: boolean;
53
+ /** iox-ui#131: the grounds a type-led first screen may stand on, in the order tried (`inverse` first, no word). */
54
+ typeLedGrounds?: ReadonlyArray<string>;
52
55
  }
53
56
 
54
57
  /** The ingredients, by the contract's keys (held equal to it by opening-mix.spec). */
@@ -58,6 +61,8 @@ export enum OpeningIngredient {
58
61
  Words = 'words',
59
62
  Extras = 'extras',
60
63
  Motion = 'motion',
64
+ /** iox-ui#131: what a type-led first screen stands on (none named: the inverse scheme). The harness's alone. */
65
+ Ground = 'ground',
61
66
  }
62
67
 
63
68
  export enum OpeningFrame { Full = 'full', Inset = 'inset', Shrinks = 'shrinks', Grows = 'grows' }
@@ -65,6 +70,8 @@ export enum OpeningMedia { Photo = 'photo', Film = 'film', Slideshow = 'slidesho
65
70
  export enum OpeningWords { Headline = 'headline', OnEdge = 'on-edge', Apart = 'apart', Wordmark = 'wordmark', Behind = 'behind', None = 'none' }
66
71
  export enum OpeningExtra { Card = 'card', Badge = 'badge', Cue = 'cue' }
67
72
  export enum OpeningMotion { SlowZoom = 'slow-zoom', CopyOut = 'copy-out', PinnedCovered = 'pinned-covered' }
73
+ /** iox-ui#131: a type-led first screen's ground — `inverse` is the default and no word (the contract's `typeLedGrounds`). */
74
+ export enum OpeningGround { Inverse = 'inverse', Accent = 'accent', Subtle = 'subtle' }
68
75
 
69
76
  /** One word for each of frame, media and words; a list (in the table's order) for extras and motion. */
70
77
  export interface OpeningMix {
@@ -73,6 +80,8 @@ export interface OpeningMix {
73
80
  words: string;
74
81
  extras: string[];
75
82
  motion: string[];
83
+ /** iox-ui#131: at most one word; empty — the inverse scheme. Worn by a type-led first screen only. */
84
+ ground: string[];
76
85
  }
77
86
 
78
87
  export class OpeningMixError extends Error {}
@@ -122,7 +131,7 @@ const MANY: ReadonlySet<string> = new Set(O.many);
122
131
  const WAITS = O.waits;
123
132
  const ORDER: ReadonlyArray<OpeningIngredient> = Object.values(OpeningIngredient);
124
133
 
125
- const isMany = (k: string): k is OpeningIngredient.Extras | OpeningIngredient.Motion => MANY.has(k);
134
+ const isMany = (k: string): k is OpeningIngredient.Extras | OpeningIngredient.Motion | OpeningIngredient.Ground => MANY.has(k);
126
135
 
127
136
  /** The words an ingredient may take, in the table's order. */
128
137
  export function openingWords(ingredient: `${OpeningIngredient}`): ReadonlyArray<string> {
@@ -164,13 +173,14 @@ const ordered = (k: string, words: ReadonlyArray<string>): string[] => openingWo
164
173
  export function openingMix(partial: Partial<Record<string, string | ReadonlyArray<string>>> = {}): OpeningMix {
165
174
  const mix: OpeningMix = {
166
175
  frame: O.defaults['frame'] as string, media: O.defaults['media'] as string, words: O.defaults['words'] as string,
167
- extras: listOf(O.defaults['extras']), motion: listOf(O.defaults['motion']),
176
+ extras: listOf(O.defaults['extras']), motion: listOf(O.defaults['motion']), ground: listOf(O.defaults['ground']),
168
177
  };
169
178
  for (const [k, v] of Object.entries(partial)) {
170
179
  if (v === undefined) continue;
171
180
  if (!INGREDIENTS[k]) throw new OpeningMixError(`no opening ingredient "${k}"`);
172
181
  const words = listOf(v);
173
182
  for (const w of words) if (!INGREDIENTS[k].includes(w)) throw new OpeningMixError(`an opening's ${k} cannot be "${w}" (${INGREDIENTS[k].join(' · ')})`);
183
+ if (k === OpeningIngredient.Ground && words.length > 1) throw new OpeningMixError(`an opening stands on one ground ("${words.join('" and "')}")`);
174
184
  if (isMany(k)) mix[k] = ordered(k, words);
175
185
  else if (words.length !== 1) throw new OpeningMixError(`an opening has one ${k}`);
176
186
  else (mix as unknown as Record<string, string>)[k] = words[0];
@@ -331,9 +341,26 @@ export function drawnOpeningMix(mix: OpeningMix): { drawn: OpeningMix; gaps: Ope
331
341
  /** The fingerprint's prefix for an opening. */
332
342
  export const OPENING_TOKEN = 'opening';
333
343
 
334
- /** An opening as the fingerprint sees it: `opening:<frame>/<media>/<words>` — what a visitor takes in at once. */
344
+ /** What a type-led token says its ground is (`+<ground>`, iox-ui#131). */
345
+ const GROUND_MARK = '+';
346
+
347
+ /** An opening as the fingerprint sees it: `opening:<frame>/<media>/<words>` — what a visitor takes in at once; a type-led
348
+ * first screen on a ground other than the inverse adds it (`opening:full/none/wordmark+accent`, iox-ui#131). */
335
349
  export function openingTokenOf(mix: OpeningMix): string {
336
- return `${OPENING_TOKEN}:${O.fingerprint.map(k => (mix as unknown as Record<string, string>)[k]).join('/')}`;
350
+ const way = `${OPENING_TOKEN}:${O.fingerprint.map(k => (mix as unknown as Record<string, string>)[k]).join('/')}`;
351
+ const ground = mix.media === OpeningMedia.None ? mix.ground?.[0] : undefined;
352
+ return ground ? `${way}${GROUND_MARK}${ground}` : way;
353
+ }
354
+
355
+ /** iox-ui#131: a token's way (frame, media, words) and its ground — `inverse` when it names none. */
356
+ export function openingTokenParts(token: string): { way: string; ground: string } {
357
+ const [way, ground] = token.split(GROUND_MARK);
358
+ return { way, ground: ground || OpeningGround.Inverse };
359
+ }
360
+
361
+ /** iox-ui#131: the grounds a type-led first screen may stand on, in the order tried; a calm look never takes the accent. */
362
+ export function typeLedGrounds(calm = false): OpeningGround[] {
363
+ return ((O.typeLedGrounds ?? [OpeningGround.Inverse]) as OpeningGround[]).filter(g => !(calm && g === OpeningGround.Accent));
337
364
  }
338
365
 
339
366
  /** Every `<ingredient>:<word>` the generator's wire may carry at `tier`: drawn words only (a waiting word is never
@@ -493,6 +520,7 @@ export function checkOpening(mix: OpeningMix, ctx: OpeningContext): { mix: Openi
493
520
  m.extras = m.extras.filter(w => w !== OpeningExtra.Card);
494
521
  say(OpeningRepairCode.OneCard, 'the form is the first screen\'s card: the small card is left out');
495
522
  }
523
+ if (m.ground.length && m.media !== OpeningMedia.None) m.ground = [];
496
524
  const still = m.media === OpeningMedia.Photo || m.media === OpeningMedia.Diptych || m.media === OpeningMedia.Live;
497
525
  if (m.motion.includes(OpeningMotion.SlowZoom) && !still) {
498
526
  m.motion = m.motion.filter(w => w !== OpeningMotion.SlowZoom);
@@ -521,6 +549,9 @@ const ABS_FILL: Readonly<Record<string, string>> = { position: 'absolute', top:
521
549
  const MEDIA_FILL: Readonly<Record<string, string>> = { ...ABS_FILL, aspectRatio: 'auto', borderRadius: '0px', objectFit: 'cover' };
522
550
  const OVER = (z: number): Readonly<Record<string, string>> => ({ position: 'relative', zIndex: String(z) });
523
551
  const FRAME_PAD = 'clamp(20px, 4vw, 56px)';
552
+ /** iox-ui#133 (AW-D41, one edge): a frame's words start on the content column every other section starts on — its inline
553
+ * padding is never less than `space-inline`; the frame itself may bleed, its words do not. */
554
+ const framePadding = (block: string): string => `${block} max(${block}, ${LAYOUT_INSET})`;
524
555
  /** A display line is sized a little under its measured width, so a rounding never wraps it. */
525
556
  const FIT = 0.95;
526
557
 
@@ -544,17 +575,17 @@ function frameNode(mix: OpeningMix, children: PatternNode[]): PatternNode {
544
575
  const inset = mix.frame === OpeningFrame.Inset || mix.frame === OpeningFrame.Shrinks;
545
576
  const height = mix.media === OpeningMedia.None ? typeLedHeights(mix) : { laptop: OPENING_HEIGHT };
546
577
  const phone = {
547
- ...(inset ? { clipPath: insetClip(openingPhoneInset()), padding: phoneFramePad(mix) } : {}),
578
+ ...(inset ? { clipPath: insetClip(openingPhoneInset()), padding: framePadding(phoneFramePad(mix)) } : {}),
548
579
  ...(height.phone ? { minHeight: height.phone } : {}),
549
580
  };
550
581
  return {
551
582
  // A pictured frame is a box its picture fills; a type-led one (no picture) paints its scheme's own ground — a
552
583
  // box paints nothing, and the scheme's light words stood on the page's light ground (the #129 proof's shots).
553
- t: 'Container', es: mix.media === OpeningMedia.None ? 'section' : 'box', scheme: 'inverse',
584
+ t: 'Container', es: mix.media === OpeningMedia.None ? 'section' : 'box', scheme: mix.media === OpeningMedia.None ? (mix.ground?.[0] ?? OpeningGround.Inverse) : OpeningGround.Inverse,
554
585
  role: mix.frame === OpeningFrame.Shrinks ? OpeningRole.FrameSettles : OpeningRole.Frame,
555
586
  lay: {
556
587
  position: 'relative', overflow: 'hidden', display: 'flex', flexDirection: 'column', justifyContent: 'flex-end', gap: 'var(--iox-space-gap)',
557
- minHeight: height.laptop, padding: inset ? `calc(${INSET_LAPTOP} + ${FRAME_PAD})` : FRAME_PAD, borderRadius: '0px',
588
+ minHeight: height.laptop, padding: framePadding(inset ? `calc(${INSET_LAPTOP} + ${FRAME_PAD})` : FRAME_PAD), borderRadius: '0px',
558
589
  ...(inset ? { clipPath: insetClip(INSET_LAPTOP) } : {}),
559
590
  },
560
591
  ...(Object.keys(phone).length ? { resp: { mobile: phone } } : {}),
@@ -749,7 +780,7 @@ function wordsNodes(mix: OpeningMix, ctx: OpeningContext): PatternNode[] {
749
780
  : { t: 'Heading', es: 'display', level: 'h2', text: w, role: OpeningRole.ApartWord, lay: { fontSize: size, lineHeight: '0.9', margin: '0px', ...place[i] } });
750
781
  return [scrim(), {
751
782
  t: 'Container', es: 'box', role: OpeningRole.Apart,
752
- lay: { ...ABS_FILL, zIndex: '1', display: 'grid', gridTemplateRows: 'repeat(3, minmax(0, 1fr))', padding: FRAME_PAD },
783
+ lay: { ...ABS_FILL, zIndex: '1', display: 'grid', gridTemplateRows: 'repeat(3, minmax(0, 1fr))', padding: framePadding(FRAME_PAD) },
753
784
  c: words.map(word),
754
785
  }, aside('bottom')];
755
786
  }
@@ -9003,11 +9003,16 @@ export const SPEC_SITE_LAYOUT = {
9003
9003
  "slow-zoom",
9004
9004
  "copy-out",
9005
9005
  "pinned-covered"
9006
+ ],
9007
+ "ground": [
9008
+ "accent",
9009
+ "subtle"
9006
9010
  ]
9007
9011
  },
9008
9012
  "many": [
9009
9013
  "extras",
9010
- "motion"
9014
+ "motion",
9015
+ "ground"
9011
9016
  ],
9012
9017
  "meanings": {
9013
9018
  "frame.full": "edge to edge",
@@ -9033,7 +9038,9 @@ export const SPEC_SITE_LAYOUT = {
9033
9038
  "extras.cue": "a quiet scroll cue",
9034
9039
  "motion.slow-zoom": "the picture slowly zooms (15 s or longer), still under reduced motion",
9035
9040
  "motion.copy-out": "the first screen's words fade as the page leaves it, following the scroll",
9036
- "motion.pinned-covered": "the first screen holds while the next section slides over it"
9041
+ "motion.pinned-covered": "the first screen holds while the next section slides over it",
9042
+ "ground.accent": "a type-led first screen on the look's accent",
9043
+ "ground.subtle": "a type-led first screen on the look's quiet tint"
9037
9044
  },
9038
9045
  "meaningsHe": {
9039
9046
  "frame.full": "מקצה לקצה",
@@ -9059,7 +9066,9 @@ export const SPEC_SITE_LAYOUT = {
9059
9066
  "extras.cue": "סימן גלילה שקט",
9060
9067
  "motion.slow-zoom": "התמונה מתקרבת לאט (15 שניות ויותר), ונשארת דוממת כשמבקשים פחות תנועה",
9061
9068
  "motion.copy-out": "המילים של המסך הראשון נמוגות כשהדף עוזב אותו, עם הגלילה",
9062
- "motion.pinned-covered": "המסך הראשון נשאר במקומו והחלק הבא מחליק מעליו"
9069
+ "motion.pinned-covered": "המסך הראשון נשאר במקומו והחלק הבא מחליק מעליו",
9070
+ "ground.accent": "מסך ראשון של מילים, על צבע ההדגשה של המראה",
9071
+ "ground.subtle": "מסך ראשון של מילים, על הגוון השקט של המראה"
9063
9072
  },
9064
9073
  "waits": {
9065
9074
  "frame.grows": {
@@ -9080,10 +9089,13 @@ export const SPEC_SITE_LAYOUT = {
9080
9089
  "media": "photo",
9081
9090
  "words": "headline",
9082
9091
  "extras": [],
9083
- "motion": []
9092
+ "motion": [],
9093
+ "ground": []
9084
9094
  },
9085
9095
  "harness": [
9086
- "media.none"
9096
+ "media.none",
9097
+ "ground.accent",
9098
+ "ground.subtle"
9087
9099
  ],
9088
9100
  "typeLed": [
9089
9101
  {
@@ -9124,6 +9136,11 @@ export const SPEC_SITE_LAYOUT = {
9124
9136
  }
9125
9137
  ],
9126
9138
  "typeLedEveryTier": true,
9139
+ "typeLedGrounds": [
9140
+ "inverse",
9141
+ "subtle",
9142
+ "accent"
9143
+ ],
9127
9144
  "named": {
9128
9145
  "hero.split": {},
9129
9146
  "hero.full-bleed-media": {
@@ -9261,6 +9278,8 @@ export const SPEC_SITE_LAYOUT = {
9261
9278
  "media.object": "all",
9262
9279
  "media.none": "all",
9263
9280
  "words.headline": "all",
9281
+ "ground.accent": "all",
9282
+ "ground.subtle": "all",
9264
9283
  "rules.wordsNeverCut": "all",
9265
9284
  "rules.badgeOwnersOnly": "all",
9266
9285
  "rules.neverHoldsScroll": "all",
@@ -3,8 +3,8 @@ import { FingerprintedPage, wornOpenings } from './layout-fingerprint';
3
3
  import { LayoutIssue, LayoutIssueCode, LayoutLayerKind, LayoutPage, LayoutSection } from './layout-language';
4
4
  import { fallBackBySection, SectionFallbackLastResort, SectionSwapAction } from './layout-section-fallback';
5
5
  import {
6
- checkOpening, drawnOpeningMix, OPENING_MIX_PROP, OpeningMedia, OpeningMix, OpeningMotion, openingMixOfPlan, openingMixWords, openingTokenOf, typeLedOpeningSection,
7
- typeLedOpeningWays,
6
+ checkOpening, drawnOpeningMix, OPENING_MIX_PROP, OpeningGround, OpeningMedia, OpeningMix, openingMixOfPlan, openingMixWords, OpeningMotion,
7
+ openingTokenOf, openingTokenParts, typeLedGrounds, typeLedOpeningSection, typeLedOpeningWays,
8
8
  } from './opening-mix';
9
9
  import type { GenerationTier } from './site-plan.model';
10
10
  import { patternById, patternLinkSlots, patternOptionalParts, patternSlots, slotBudget } from './patterns';
@@ -107,8 +107,10 @@ export interface TypeLedChange {
107
107
  export interface TypeLedOpening {
108
108
  /** The mix's words, as `plan.mixes.opening` holds them. */
109
109
  words: string[];
110
- /** `opening:<frame>/none/<words>` — what the memory records and compares (`openingTokenOf`). */
110
+ /** `opening:<frame>/none/<words>[+<ground>]` — what the memory records and compares (`openingTokenOf`). */
111
111
  token: string;
112
+ /** iox-ui#131: what the first screen stands on (`inverse` when the token names none). */
113
+ ground: `${OpeningGround}`;
112
114
  /** Set when every way the site can carry is already another site's: it opens on the first of them anyway. */
113
115
  worn?: true;
114
116
  }
@@ -291,18 +293,38 @@ const isHome = (page: PagePlan) => page.isHome === true || page.route === '/';
291
293
  * (`typeLedOpeningWays`), the first the site carries unmended (its tier, the business name's fit) that no OTHER site of
292
294
  * the studio opens on — else the first it carries, said as worn. Pure.
293
295
  */
294
- export function chooseTypeLedOpening(plan: SitePlan, context: TypeLedRoundContext = {}): { mix: OpeningMix; token: string; worn: boolean } {
296
+ export function chooseTypeLedOpening(plan: SitePlan, context: TypeLedRoundContext = {}): { mix: OpeningMix; token: string; worn: boolean; ground: OpeningGround } {
295
297
  const own = openingMixOfPlan(plan);
296
298
  // The plan's own frame and words, on no picture (a slow zoom has nothing to move: it goes with the picture).
297
299
  const mine = own ? [{ ...own, media: OpeningMedia.None, extras: [...own.extras], motion: own.motion.filter(m => m !== OpeningMotion.SlowZoom) }] : [];
298
300
  const ways = [...mine, ...typeLedOpeningWays()];
299
301
  const site = openingContextOf({ business: plan.business, design: plan.design, tier: context.tier ?? BASIC, badge: null, cutOut: false });
300
302
  const carried = ways.map(m => drawnOpeningMix(m).drawn).filter(m => !checkOpening(m, site).repairs.length);
301
- const worn = wornOpenings(context.studio ?? []);
302
- const free = carried.find(m => !worn.has(openingTokenOf(m)));
303
+ const worn = [...wornOpenings(context.studio ?? [])].map(openingTokenParts);
304
+ const wornWays = new Set(worn.map(w => w.way));
305
+ const wayOf = (m: OpeningMix) => openingTokenOf({ ...m, ground: [] });
306
+ const free = carried.find(m => !wornWays.has(wayOf(m)));
303
307
  // The contract's last way is every tier's and fits any name (a heading): there is always one.
304
- const mix = free ?? carried[0] ?? checkOpening(ways[ways.length - 1], site).mix;
305
- return { mix, token: openingTokenOf(mix), worn: !free };
308
+ const way = free ?? carried[0] ?? checkOpening(ways[ways.length - 1], site).mix;
309
+ const ground = typeLedGroundFor(worn.filter(w => w.way.includes(TYPE_LED_MEDIA)), plan);
310
+ const mix: OpeningMix = { ...way, ground: ground === OpeningGround.Inverse ? [] : [ground] };
311
+ return { mix, token: openingTokenOf(mix), worn: !free, ground };
312
+ }
313
+
314
+ /** A token's media part when the first screen holds no picture (`opening:<frame>/none/<words>`). */
315
+ const TYPE_LED_MEDIA = `/${OpeningMedia.None}/`;
316
+ /** How animated, at which a look is calm: its type-led first screen never stands on the accent. */
317
+ const CALM_ANIMATE: ReadonlySet<string> = new Set(['still', 'subtle']);
318
+
319
+ /**
320
+ * iox-ui#131: what a type-led first screen stands on — the ground the studio's OTHER type-led sites wear least (the
321
+ * contract's `typeLedGrounds` order breaks a tie, `inverse` first), so six type-led Homes do not all open dark. A calm
322
+ * look never takes the accent. Pure.
323
+ */
324
+ export function typeLedGroundFor(others: ReadonlyArray<{ ground: string }>, plan: Pick<SitePlan, 'design'>): OpeningGround {
325
+ const grounds = typeLedGrounds(CALM_ANIMATE.has(String(plan.design?.animate ?? '')));
326
+ const count = (g: string) => others.filter(o => o.ground === g).length;
327
+ return grounds.reduce((best, g) => (count(g) < count(best) ? g : best), grounds[0]);
306
328
  }
307
329
 
308
330
  /**
@@ -417,7 +439,7 @@ export function typeLedRound(
417
439
  if (takes) {
418
440
  const words = openingMixWords(chosen.mix);
419
441
  next = { ...next, mixes: { ...next.mixes, opening: words } };
420
- opening = { words, token: chosen.token, ...(chosen.worn ? { worn: true as const } : {}) };
442
+ opening = { words, token: chosen.token, ground: chosen.ground, ...(chosen.worn ? { worn: true as const } : {}) };
421
443
  const was = plan.mixes?.opening?.join(' ');
422
444
  if (was !== words.join(' ')) {
423
445
  changes.push({