@vectoriox/iox-ui 5.109.1 → 5.110.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.
@@ -70,6 +70,10 @@ export interface NavShapeOptions {
70
70
  newId?: (suffix: string) => string;
71
71
  /** The studio's pages, for a header that links to none (a hand-built one): its menu lists these. */
72
72
  pages?: ReadonlyArray<NavPage>;
73
+ /** Header ingredients (header-ingredients-plan.md HI-D8): the menu button and its drawer at EVERY width — the header's
74
+ * links and call to action are hidden at every width and the pages live in the drawer (a "name and menu" header).
75
+ * Drawer only. Default: what the header already does (`menuAtEveryWidth`), else phone widths only. */
76
+ everyWidth?: boolean;
73
77
  }
74
78
 
75
79
  export interface NavShapeResult {
@@ -77,6 +81,8 @@ export interface NavShapeResult {
77
81
  globals: SerializedNode[];
78
82
  shape: NavShape;
79
83
  at: PhoneMenuBreakpoint;
84
+ /** The menu button shows at every width (`NavShapeOptions.everyWidth`). */
85
+ everyWidth: boolean;
80
86
  }
81
87
 
82
88
  export class NavShapeError extends Error {}
@@ -290,11 +296,34 @@ function clickTo(kit: Kit, suffix: string, type: NavDialogAction, target: string
290
296
  }
291
297
 
292
298
  /** Show at the phone width, hidden above it (base `display: none`, the breakpoint's own `display`). */
299
+ const MENU_DISPLAY = 'inline-flex';
300
+ /** What a header part hidden at every width shows again when the menu goes back to phone widths only. */
301
+ const BUILT_DISPLAY: Readonly<Record<string, string>> = { [NavRole.Links]: 'flex' };
302
+
293
303
  function phoneOnly(node: SerializedNode, at: string, display: string): void {
294
304
  node.styleProps[DISPLAY] = NONE;
295
305
  node.responsive = { ...(node.responsive ?? {}), [at]: { ...(node.responsive?.[at] ?? {}), styleProps: { ...(node.responsive?.[at]?.styleProps ?? {}), [DISPLAY]: display } } };
296
306
  }
297
307
 
308
+ /** At every width (HI-D8): `display` lives in the base styles and no breakpoint overrides it. */
309
+ function displayEverywhere(node: SerializedNode, display: string): void {
310
+ node.styleProps[DISPLAY] = display;
311
+ for (const [bp, layer] of Object.entries(node.responsive ?? {})) {
312
+ if (!layer?.styleProps || !(DISPLAY in layer.styleProps)) continue;
313
+ const { [DISPLAY]: _drop, ...rest } = layer.styleProps;
314
+ node.responsive![bp] = { ...layer, styleProps: rest };
315
+ if (!Object.keys(rest).length && Object.keys(layer).length === 1) delete node.responsive![bp];
316
+ }
317
+ }
318
+
319
+ /** Does the header show its menu button at every width (a "name and menu" header)? Read from the button itself, so a
320
+ * later change of shape or breakpoint keeps it. */
321
+ export function menuAtEveryWidth(globals: ReadonlyArray<SerializedNode>, navId?: string | null): boolean {
322
+ const root = findNavRoot(globals, navId);
323
+ const menu = root ? find([root], NavRole.MenuButton) : null;
324
+ return !!menu && menu.styleProps?.[DISPLAY] !== NONE;
325
+ }
326
+
298
327
  /** Hidden at the phone width: the header's links row. */
299
328
  function hideAt(node: SerializedNode, at: string): void {
300
329
  node.responsive = { ...(node.responsive ?? {}), [at]: { ...(node.responsive?.[at] ?? {}), styleProps: { ...(node.responsive?.[at]?.styleProps ?? {}), [DISPLAY]: NONE } } };
@@ -331,7 +360,7 @@ function menuButton(kit: Kit, drawerId: string, at: string): SerializedNode {
331
360
  const btn = part(kit, 'menu', BUTTON, { tag: 'button', ariaLabel: NAV_SHAPE_COPY.menu }, 'button-ghost', NavRole.MenuButton, { ...MENU_BUTTON_LAY });
332
361
  btn.children = [iconNode(kit, 'menu-icon', MENU_ICON)];
333
362
  btn.interactions = [clickTo(kit, 'menu', NavDialogAction.Toggle, drawerId)];
334
- phoneOnly(btn, at, 'inline-flex');
363
+ phoneOnly(btn, at, MENU_DISPLAY);
335
364
  return btn;
336
365
  }
337
366
 
@@ -496,6 +525,9 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
496
525
  if (!root) throw new NavShapeError('no Navigation bar among the globals');
497
526
  const at = (options.at ?? navShapeBreakpoint(out)) as PhoneMenuBreakpoint;
498
527
  if (!(Object.values(PhoneMenuBreakpoint) as string[]).includes(at)) throw new NavShapeError(`a phone menu cannot switch at "${at}"`);
528
+ const wasEveryWidth = menuAtEveryWidth(out, root.id);
529
+ const everyWidth = shape === NavShape.Drawer && (options.everyWidth ?? wasEveryWidth);
530
+ if (options.everyWidth && shape !== NavShape.Drawer) throw new NavShapeError('only a drawer menu shows at every width');
499
531
  const kit = makeKit(out, root.id, options.newId);
500
532
 
501
533
  adoptRoles(root);
@@ -511,18 +543,37 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
511
543
  if (dr) { delete dr.isGlobal; delete dr.globalPosition; }
512
544
  if (wantDrawer && !dr) dr = drawer(kit, root, pages, at);
513
545
  if (!wantDrawer) dr = null;
514
- if (dr) dr.props = { ...dr.props, closeAbove: at };
546
+ // A drawer reached at every width never closes itself above a breakpoint.
547
+ if (dr) dr.props = { ...dr.props, closeAbove: everyWidth ? '' : at };
515
548
 
516
549
  // The menu button: Drawer only (Q4: with a bar, the phone header keeps only the brand).
517
550
  const existingMenu = removeRole(root, NavRole.MenuButton);
518
551
  const menu = wantMenuButton ? (existingMenu ? asToggle(existingMenu) : menuButton(kit, dr!.id, at)) : null;
519
552
 
520
- for (const p of phoneHiddenParts(root)) { moveDisplayOverride(p, at); hideAt(p, at); }
553
+ for (const p of phoneHiddenParts(root)) {
554
+ if (everyWidth) { displayEverywhere(p, NONE); continue; }
555
+ // Back from every width: the base `none` was this function's, not the author's. Base styles hold ONE display, so
556
+ // the part takes back what its role is built with (the links row is a row), else its type's own.
557
+ if (wasEveryWidth && p.styleProps?.[DISPLAY] === NONE) {
558
+ const back = BUILT_DISPLAY[roleOf(p) ?? ''];
559
+ if (back) p.styleProps[DISPLAY] = back;
560
+ else delete p.styleProps[DISPLAY];
561
+ }
562
+ moveDisplayOverride(p, at);
563
+ hideAt(p, at);
564
+ }
521
565
  centerBrandAt(root, at, wantBar);
522
566
  phoneRowAt(root, at, wantMenuButton);
523
567
 
524
568
  const kids = root.children ?? (root.children = []);
525
- if (menu) { moveDisplayOverride(menu, at); kids.push(menu); }
569
+ if (menu) {
570
+ if (everyWidth) displayEverywhere(menu, MENU_DISPLAY);
571
+ else {
572
+ moveDisplayOverride(menu, at);
573
+ if (wasEveryWidth) phoneOnly(menu, at, MENU_DISPLAY);
574
+ }
575
+ kids.push(menu);
576
+ }
526
577
  if (dr && shape === NavShape.Drawer) kids.push(dr);
527
578
  if (dr && shape === NavShape.Both) {
528
579
  dr.isGlobal = true;
@@ -552,7 +603,7 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
552
603
  }
553
604
  out.push(b);
554
605
  }
555
- return { globals: out, shape, at };
606
+ return { globals: out, shape, at, everyWidth };
556
607
  }
557
608
 
558
609
  /** Mark a hand-built header's parts with their roles, so every later edit can find them. */
@@ -54,4 +54,5 @@ export * from './check-layout';
54
54
  export * from './check-list';
55
55
  export * from './layout-space';
56
56
  export * from './layout-fingerprint';
57
+ export * from './header-mix';
57
58
  export * from './layout-edits';
@@ -7125,5 +7125,263 @@ export const SPEC_SITE_LAYOUT = {
7125
7125
  "masonry"
7126
7126
  ]
7127
7127
  }
7128
+ },
7129
+ "header": {
7130
+ "ingredients": {
7131
+ "arrange": [
7132
+ "split",
7133
+ "centred",
7134
+ "between",
7135
+ "name-only"
7136
+ ],
7137
+ "menuSide": [
7138
+ "end",
7139
+ "start"
7140
+ ],
7141
+ "pages": [
7142
+ "inline",
7143
+ "menu",
7144
+ "menu-pinned"
7145
+ ],
7146
+ "menu": [
7147
+ "drawer",
7148
+ "full",
7149
+ "panel"
7150
+ ],
7151
+ "menuShows": [
7152
+ "links",
7153
+ "pictures"
7154
+ ],
7155
+ "action": [
7156
+ "none",
7157
+ "button",
7158
+ "link",
7159
+ "two"
7160
+ ],
7161
+ "ground": [
7162
+ "solid",
7163
+ "over",
7164
+ "glass"
7165
+ ],
7166
+ "shape": [
7167
+ "bar",
7168
+ "pill",
7169
+ "islands"
7170
+ ],
7171
+ "brand": [
7172
+ "fits",
7173
+ "hangs",
7174
+ "later"
7175
+ ],
7176
+ "scroll": [
7177
+ "stays",
7178
+ "hides",
7179
+ "away"
7180
+ ],
7181
+ "edge": [
7182
+ "fade",
7183
+ "line",
7184
+ "none"
7185
+ ],
7186
+ "phone": [
7187
+ "drawer",
7188
+ "bar",
7189
+ "both",
7190
+ "full"
7191
+ ]
7192
+ },
7193
+ "meanings": {
7194
+ "arrange.split": "the name at the start, the pages at the end",
7195
+ "arrange.centred": "the name centred, the pages under it",
7196
+ "arrange.between": "the pages either side of a centred name",
7197
+ "arrange.name-only": "only the name and a menu button, at every width",
7198
+ "menuSide.end": "the menu button at the end",
7199
+ "menuSide.start": "the menu button at the start",
7200
+ "pages.inline": "every page in the bar",
7201
+ "pages.menu": "the pages behind the menu",
7202
+ "pages.menu-pinned": "the pages behind the menu, one or two key pages kept in the bar",
7203
+ "menu.drawer": "a sheet from the end edge",
7204
+ "menu.full": "a full-screen index of the page names, large",
7205
+ "menu.panel": "a panel that drops from the top, as tall as its content",
7206
+ "menuShows.links": "the page names",
7207
+ "menuShows.pictures": "pictured cards for the main collections beside the page names",
7208
+ "action.none": "no call to action",
7209
+ "action.button": "one button",
7210
+ "action.link": "one quiet link",
7211
+ "action.two": "a filled and an outlined button",
7212
+ "ground.solid": "its own ground",
7213
+ "ground.over": "over the opening, transparent until the page moves",
7214
+ "ground.glass": "frosted glass (a look with a blur)",
7215
+ "shape.bar": "a full-width bar",
7216
+ "shape.pill": "one floating rounded bar",
7217
+ "shape.islands": "separate floating pills",
7218
+ "brand.fits": "the name fits the bar",
7219
+ "brand.hangs": "a logo larger than the bar, hanging below it",
7220
+ "brand.later": "the name arrives once the page moves",
7221
+ "scroll.stays": "always there",
7222
+ "scroll.hides": "hides scrolling down, back scrolling up",
7223
+ "scroll.away": "scrolls away with the page",
7224
+ "edge.fade": "a soft shadow under it once the page moves",
7225
+ "edge.line": "a hairline under it once the page moves",
7226
+ "edge.none": "no edge",
7227
+ "phone.drawer": "a drawer on a phone",
7228
+ "phone.bar": "a bottom bar on a phone",
7229
+ "phone.both": "a bottom bar and a drawer on a phone",
7230
+ "phone.full": "a full-screen index on a phone"
7231
+ },
7232
+ "waits": {
7233
+ "arrange.between": {
7234
+ "phase": "HI1",
7235
+ "drawnAs": "centred"
7236
+ },
7237
+ "menuSide.start": {
7238
+ "phase": "HI1",
7239
+ "drawnAs": "end"
7240
+ },
7241
+ "pages.menu-pinned": {
7242
+ "phase": "HI1",
7243
+ "drawnAs": "menu"
7244
+ },
7245
+ "action.link": {
7246
+ "phase": "HI1",
7247
+ "drawnAs": "button"
7248
+ },
7249
+ "action.two": {
7250
+ "phase": "HI1",
7251
+ "drawnAs": "button"
7252
+ },
7253
+ "menu.full": {
7254
+ "phase": "HI2",
7255
+ "drawnAs": "drawer"
7256
+ },
7257
+ "menu.panel": {
7258
+ "phase": "HI2",
7259
+ "drawnAs": "drawer"
7260
+ },
7261
+ "menuShows.pictures": {
7262
+ "phase": "HI2",
7263
+ "drawnAs": "links"
7264
+ },
7265
+ "phone.full": {
7266
+ "phase": "HI2",
7267
+ "drawnAs": "drawer"
7268
+ },
7269
+ "ground.over": {
7270
+ "phase": "HI3",
7271
+ "drawnAs": "solid"
7272
+ },
7273
+ "ground.glass": {
7274
+ "phase": "HI3",
7275
+ "drawnAs": "solid"
7276
+ },
7277
+ "shape.pill": {
7278
+ "phase": "HI3",
7279
+ "drawnAs": "bar"
7280
+ },
7281
+ "shape.islands": {
7282
+ "phase": "HI3",
7283
+ "drawnAs": "bar"
7284
+ },
7285
+ "brand.hangs": {
7286
+ "phase": "HI3",
7287
+ "drawnAs": "fits"
7288
+ },
7289
+ "brand.later": {
7290
+ "phase": "HI3",
7291
+ "drawnAs": "fits"
7292
+ }
7293
+ },
7294
+ "defaults": {
7295
+ "arrange": "split",
7296
+ "menuSide": "end",
7297
+ "pages": "inline",
7298
+ "menu": "drawer",
7299
+ "menuShows": "links",
7300
+ "action": "button",
7301
+ "ground": "solid",
7302
+ "shape": "bar",
7303
+ "brand": "fits",
7304
+ "scroll": "hides",
7305
+ "edge": "fade",
7306
+ "phone": "drawer"
7307
+ },
7308
+ "named": {
7309
+ "nav.inline-cta": {},
7310
+ "nav.centered-logo": {
7311
+ "arrange": "centred",
7312
+ "action": "none"
7313
+ }
7314
+ },
7315
+ "navKinds": {
7316
+ "bar": {},
7317
+ "corner": {
7318
+ "arrange": "name-only",
7319
+ "pages": "menu",
7320
+ "action": "none"
7321
+ },
7322
+ "index": {
7323
+ "arrange": "name-only",
7324
+ "pages": "menu",
7325
+ "menu": "full",
7326
+ "action": "none",
7327
+ "phone": "full"
7328
+ },
7329
+ "side": {
7330
+ "arrange": "name-only",
7331
+ "pages": "menu",
7332
+ "menu": "full",
7333
+ "action": "none",
7334
+ "phone": "full"
7335
+ }
7336
+ },
7337
+ "fingerprint": [
7338
+ "arrange",
7339
+ "pages",
7340
+ "menu",
7341
+ "ground",
7342
+ "shape"
7343
+ ],
7344
+ "references": [
7345
+ {
7346
+ "id": "islands-hanging-logo",
7347
+ "after": "Delta Cafés",
7348
+ "added": "2026-11-19",
7349
+ "mix": {
7350
+ "arrange": "between",
7351
+ "ground": "over",
7352
+ "shape": "islands",
7353
+ "brand": "hangs",
7354
+ "action": "none",
7355
+ "edge": "none"
7356
+ }
7357
+ },
7358
+ {
7359
+ "id": "start-menu-top-panel",
7360
+ "after": "Vonder (closed + open)",
7361
+ "added": "2026-11-19",
7362
+ "mix": {
7363
+ "arrange": "name-only",
7364
+ "menuSide": "start",
7365
+ "pages": "menu-pinned",
7366
+ "menu": "panel",
7367
+ "menuShows": "pictures",
7368
+ "action": "none",
7369
+ "ground": "over",
7370
+ "brand": "later",
7371
+ "edge": "none",
7372
+ "phone": "full"
7373
+ }
7374
+ },
7375
+ {
7376
+ "id": "directory-two-actions",
7377
+ "after": "a design directory (the \"w.\" site)",
7378
+ "added": "2026-11-19",
7379
+ "mix": {
7380
+ "action": "two",
7381
+ "scroll": "stays",
7382
+ "edge": "line"
7383
+ }
7384
+ }
7385
+ ]
7128
7386
  }
7129
7387
  } as const;