@vectoriox/iox-ui 5.144.0 → 5.145.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.
@@ -556,25 +556,49 @@ export function layoutListShapes(plan: SitePlan): LayoutListShape[] {
556
556
  .filter(isLayoutListSource)
557
557
  .map(d => {
558
558
  const type = contentTypeOfSource(d.alias, plan);
559
- const played = (Object.values(ContentRole) as `${ContentRole}`[]).filter(role => !!roleField(type, role));
560
- const perItem = type?.seed?.perItem ?? {};
561
- const long = LIST_TEXT_ROLES.filter(role => {
562
- const field = roleField(type, role);
563
- const samples = field ? (perItem[field] ?? []).filter(s => typeof s === 'string') : [];
564
- return samples.length > 0 && median(samples.map(wordCount)) > LIST_LONG_WORDS;
565
- });
566
559
  // A shop list holds the plan's sample products (the build writes them unless the shop has its own).
567
- const count = d.type === PlanDataSourceType.Shop ? plan.shop?.products?.length : type?.seed?.count;
568
- // AW11: how long the planned names run (a long one is not set on its picture).
569
- const titleField = roleField(type, ContentRole.Title);
570
- const titles = titleField ? (perItem[titleField] ?? []).filter(s => typeof s === 'string') : [];
571
- return {
572
- alias: d.alias, label: type?.label ?? d.alias, items: typeof count === 'number' && count > 0 ? count : null, roles: played, long,
573
- ...(titles.length ? { titleWords: median(titles.map(wordCount)) } : {}),
574
- };
560
+ return listShapeOfType(d.alias, type, d.type === PlanDataSourceType.Shop ? { items: plan.shop?.products?.length ?? null } : {});
575
561
  });
576
562
  }
577
563
 
564
+ /** What is known of a list's items beyond its type: their count, or the items themselves (a studio's real rows). */
565
+ export interface ListShapeReading {
566
+ /** How many items it holds (absent: the type's planned sample count). */
567
+ readonly items?: number | null;
568
+ /** The items themselves, by field — their words are measured instead of the planned samples'. */
569
+ readonly rows?: ReadonlyArray<Readonly<Record<string, unknown>>>;
570
+ /** AW11-D9: every picture stands on a plain ground (measured at upload). */
571
+ readonly plainPictures?: boolean | null;
572
+ }
573
+
574
+ /**
575
+ * The shape of ONE list from its content type — what the layout check, the wire and Bindings ▸ List judge a list by:
576
+ * the roles its items play, which text roles run long, the names' length, how many items. From the plan's planned
577
+ * samples (`type.seed`) or, given `rows`, from the studio's real items. `layoutListShapes` is this, per plan source.
578
+ */
579
+ export function listShapeOfType(alias: string, type: Pick<ContentTypePlan, 'label' | 'roles' | 'seed'> | null | undefined,
580
+ reading: ListShapeReading = {}): LayoutListShape {
581
+ const played = (Object.values(ContentRole) as `${ContentRole}`[]).filter(role => !!roleField(type, role));
582
+ const perItem = type?.seed?.perItem ?? {};
583
+ const samples = (field: string | undefined): string[] => {
584
+ if (!field) return [];
585
+ const raw = reading.rows ? reading.rows.map(r => r[field]) : (perItem[field] ?? []);
586
+ return raw.filter((s): s is string => typeof s === 'string');
587
+ };
588
+ const long = LIST_TEXT_ROLES.filter(role => {
589
+ const words = samples(roleField(type, role));
590
+ return words.length > 0 && median(words.map(wordCount)) > LIST_LONG_WORDS;
591
+ });
592
+ const count = reading.items !== undefined ? reading.items : reading.rows ? reading.rows.length : type?.seed?.count;
593
+ // AW11: how long the names run (a long one is not set on its picture).
594
+ const titles = samples(roleField(type, ContentRole.Title));
595
+ return {
596
+ alias, label: type?.label ?? alias, items: typeof count === 'number' && count > 0 ? count : null, roles: played, long,
597
+ ...(titles.length ? { titleWords: median(titles.map(wordCount)) } : {}),
598
+ ...(reading.plainPictures !== undefined ? { plainPictures: reading.plainPictures } : {}),
599
+ };
600
+ }
601
+
578
602
  /**
579
603
  * How the list composer reads one list (LI1, `ComposeLayoutOptions.listOf`): the field that plays each role, and the
580
604
  * plan's page that shows one item — its route, its param and the item's field that fills it. Null for an alias that is
@@ -584,16 +608,22 @@ export function layoutListBinding(alias: string, plan: SitePlan): LayoutListBind
584
608
  const ds = plan.dataSources.find(d => d.alias === alias);
585
609
  if (!ds || !isLayoutListSource(ds)) return null;
586
610
  const type = contentTypeOfSource(alias, plan);
611
+ const page = type ? plan.pages.find(p => p.template === type.name && !!p.routeSource) : undefined;
612
+ const byRoute = page ? plan.dataSources.find(d => d.alias === page.routeSource) : undefined;
613
+ const filter = byRoute && byRoute.type !== PlanDataSourceType.Relative ? byRoute.filterByRouteParam : undefined;
614
+ const [param] = page ? routeParams(page.route) : [];
615
+ return listBindingOfType(type, page && filter && param ? { route: page.route, param, field: filter.field } : undefined);
616
+ }
617
+
618
+ /** How the list composer reads a list of `type` — the field playing each role — and, when there is one, the page that
619
+ * shows one item. The ONE reading `layoutListBinding` and Bindings ▸ List (`composeListFrame`) hand the composer. */
620
+ export function listBindingOfType(type: Pick<ContentTypePlan, 'roles'> | null | undefined, detail?: LayoutListBinding['detail']): LayoutListBinding {
587
621
  const roles: Record<string, string> = {};
588
622
  for (const role of Object.values(ContentRole) as `${ContentRole}`[]) {
589
623
  const field = roleField(type, role);
590
624
  if (field) roles[role] = field;
591
625
  }
592
- const page = type ? plan.pages.find(p => p.template === type.name && !!p.routeSource) : undefined;
593
- const byRoute = page ? plan.dataSources.find(d => d.alias === page.routeSource) : undefined;
594
- const filter = byRoute && byRoute.type !== PlanDataSourceType.Relative ? byRoute.filterByRouteParam : undefined;
595
- const [param] = page ? routeParams(page.route) : [];
596
- return { roles, ...(page && filter && param ? { detail: { route: page.route, param, field: filter.field } } : {}) };
626
+ return { roles, ...(detail ? { detail } : {}) };
597
627
  }
598
628
 
599
629
  /** One line of the brief: `works (Works): 6 items · name, picture, detail, quote (long)`. */
@@ -1438,9 +1438,12 @@ span.iox-video__play { pointer-events: none; }
1438
1438
  --list-number-ink: 0.1;
1439
1439
  --list-dir: 1;
1440
1440
  }
1441
- :where(.iox-role-list, .iox-role-list-dim):dir(rtl) { --list-dir: -1; }
1441
+ /* A right-to-left frame (design-core writes `iox-list-mirrored` from its own Text Direction — AW6's answer, never
1442
+ `:dir(rtl)`, which a composed Hebrew page never matches): what leans and fans turns the other way (R-H-AW11-8). */
1443
+ .iox-list-mirrored { --list-dir: -1; }
1442
1444
  /* The room a round-two list is laid out in is its frame's (a container query: the canvas's phone frame agrees). */
1443
- :where(.iox-role-list, .iox-role-list-dim):has(.iox-role-list-hang, .iox-role-list-hang-two, .iox-role-list-bento, .iox-role-list-rows, .iox-role-list-stage, .iox-role-list-fan, .iox-role-list-fan-stack, .iox-role-list-tilted, .iox-role-list-tilted-two) {
1445
+ :where(.iox-role-list, .iox-role-list-dim):has(.iox-role-list-hang, .iox-role-list-hang-two, .iox-role-list-bento, .iox-role-list-rows, .iox-role-list-stage, .iox-role-list-fan, .iox-role-list-fan-stack, .iox-role-list-tilted, .iox-role-list-tilted-two),
1446
+ :where(.iox-role-list, .iox-role-list-dim).iox-list-arrange-fan {
1444
1447
  container: iox-list / inline-size;
1445
1448
  }
1446
1449
 
@@ -1471,7 +1474,9 @@ span.iox-video__play { pointer-events: none; }
1471
1474
  }
1472
1475
  @container iox-list (max-width: 640px) {
1473
1476
  :is(.iox-role-list-hang, .iox-role-list-hang-two, .iox-role-list-hang > .repeater-wrapper, .iox-role-list-hang-two > .repeater-wrapper) > .repeater-root { grid-template-columns: minmax(0, 1fr); }
1474
- :is(.iox-role-list-hang, .iox-role-list-hang-two, .iox-role-list-hang > .repeater-wrapper, .iox-role-list-hang-two > .repeater-wrapper) > .repeater-root > * { grid-column: 1 / -1; margin: 0; }
1477
+ /* `:nth-child(n)` weighs as the laptop's `:nth-child(6n+4)` placement, so a phone's one column wins (#116 — that
1478
+ placement made implicit columns and the other items collapsed to nothing). */
1479
+ :is(.iox-role-list-hang, .iox-role-list-hang-two, .iox-role-list-hang > .repeater-wrapper, .iox-role-list-hang-two > .repeater-wrapper) > .repeater-root > :nth-child(n) { grid-column: 1 / -1; margin: 0; width: auto; }
1475
1480
  :is(.iox-role-list-hang, .iox-role-list-hang-two, .iox-role-list-hang > .repeater-wrapper, .iox-role-list-hang-two > .repeater-wrapper) > .repeater-root > :nth-child(3n+2) { margin-inline-start: 16%; }
1476
1481
  :is(.iox-role-list-hang, .iox-role-list-hang-two, .iox-role-list-hang > .repeater-wrapper, .iox-role-list-hang-two > .repeater-wrapper) > .repeater-root > :nth-child(3n) { margin-inline-end: 16%; }
1477
1482
  :is(.iox-role-list-hang-two, .iox-role-list-hang-two > .repeater-wrapper) > .repeater-root { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@@ -1490,21 +1495,28 @@ span.iox-video__play { pointer-events: none; }
1490
1495
  --bento-cols: 5;
1491
1496
  display: grid;
1492
1497
  grid-template-columns: repeat(var(--bento-cols), minmax(0, 1fr));
1498
+ /* every row is the bento's own (a Repeater's node style names `grid-template-rows: auto`, which grew the first row
1499
+ to its words and broke the tall tile's two-high — #116) */
1500
+ grid-template-rows: none;
1493
1501
  grid-auto-rows: clamp(140px, 15cqi, 240px);
1494
1502
  gap: var(--iox-space-gap);
1495
1503
  }
1496
1504
  :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root:has(> :nth-child(-n+2):last-child) { --bento-cols: 2; }
1497
1505
  :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root:has(> :nth-child(3):last-child, > :nth-child(4):last-child) { --bento-cols: 3; }
1498
1506
  :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root:has(> :nth-child(5):last-child, > :nth-child(6):last-child) { --bento-cols: 4; }
1499
- :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > :nth-child(n+8), :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root:has(> :nth-child(2n):last-child) > :last-child { display: none; }
1507
+ /* The trim out-ranks every arrangement rule below (a row that IS the card takes `display: flex`): `:is(*, .iox-role-card)`
1508
+ adds one class to its weight and matches every row (#116). */
1509
+ :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > :nth-child(n+8):is(*, .iox-role-card), :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root:has(> :nth-child(2n):last-child) > :last-child:is(*, .iox-role-card) { display: none; }
1500
1510
  :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > :first-child { grid-column: span 2; grid-row: span 2; }
1501
1511
  :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > * { min-width: 0; min-height: 0; height: 100%; }
1502
1512
  :is(:is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > :is(.iox-role-card, .iox-role-list-item), :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > * :is(.iox-role-card, .iox-role-list-item)) { height: 100%; min-height: 0; display: flex; flex-direction: column; }
1503
1513
  :is(:is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > .iox-role-list-item, :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > * :is(.iox-role-card-media, .iox-role-list-item)) { flex: 1 1 0; min-height: 0; aspect-ratio: auto; overflow: hidden; }
1504
1514
  :is(:is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > .iox-role-list-item, :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > * :is(.iox-role-card-media, .iox-role-list-item)) img { width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; }
1505
1515
  @container iox-list (max-width: 640px) {
1506
- :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root { --bento-cols: 2; grid-auto-rows: clamp(120px, 34cqi, 180px); }
1516
+ :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root { --bento-cols: 2; grid-auto-rows: clamp(150px, 44cqi, 200px); }
1507
1517
  :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > :first-child { grid-row: span 1; grid-column: 1 / -1; }
1518
+ /* a half-width tile holds its words at the lead size — set at the heading's size they ran out of it (#116) */
1519
+ :is(.iox-role-list-bento, .iox-role-list-bento > .repeater-wrapper) > .repeater-root > :not(:first-child) .iox-role-card-title { font-size: var(--iox-size-lead); }
1508
1520
  }
1509
1521
 
1510
1522
  /* ROWS — an index: one line per item between hairlines, the title in the display face, an arrow at the end that comes
@@ -1523,7 +1535,7 @@ span.iox-video__play { pointer-events: none; }
1523
1535
  color: var(--iox-accent-text, var(--iox-accent)); font-family: var(--iox-font-body);
1524
1536
  transition: opacity var(--iox-dur-ui) var(--iox-ease-hover), translate var(--iox-dur-ui) var(--iox-ease-hover);
1525
1537
  }
1526
- :is(:is(.iox-role-list-rows, .iox-role-list-rows > .repeater-wrapper) > .repeater-root > :is(.iox-role-card, .iox-role-list-item), :is(.iox-role-list-rows, .iox-role-list-rows > .repeater-wrapper) > .repeater-root > * :is(.iox-role-card, .iox-role-list-item)):dir(rtl)::after { content: "\2190"; content: "\2190" / ""; }
1538
+ .iox-list-mirrored :is(:is(.iox-role-list-rows, .iox-role-list-rows > .repeater-wrapper) > .repeater-root > :is(.iox-role-card, .iox-role-list-item), :is(.iox-role-list-rows, .iox-role-list-rows > .repeater-wrapper) > .repeater-root > * :is(.iox-role-card, .iox-role-list-item))::after { content: "\2190"; content: "\2190" / ""; }
1527
1539
  :is(.iox-role-list-rows, .iox-role-list-rows > .repeater-wrapper) > .repeater-root .iox-role-card-title { font-family: var(--iox-font-display); }
1528
1540
  @media (hover: hover) and (pointer: fine) {
1529
1541
  :is(:is(.iox-role-list-rows, .iox-role-list-rows > .repeater-wrapper) > .repeater-root > :is(.iox-role-card, .iox-role-list-item), :is(.iox-role-list-rows, .iox-role-list-rows > .repeater-wrapper) > .repeater-root > * :is(.iox-role-card, .iox-role-list-item))::after { opacity: 0; translate: calc(var(--list-dir, 1) * -6px) 0; }
@@ -1561,7 +1573,7 @@ span.iox-video__play { pointer-events: none; }
1561
1573
  :is(.iox-role-list-stage, .iox-role-list-stage > .repeater-wrapper) > .repeater-root:has(> :nth-child(7):last-child) { --stage-n: 7; }
1562
1574
  :is(.iox-role-list-stage, .iox-role-list-stage > .repeater-wrapper) > .repeater-root:has(> :nth-child(8):last-child) { --stage-n: 8; }
1563
1575
  :is(.iox-role-list-stage, .iox-role-list-stage > .repeater-wrapper) > .repeater-root:has(> :nth-child(9):last-child) { --stage-n: 9; }
1564
- :is(.iox-role-list-stage, .iox-role-list-stage > .repeater-wrapper) > .repeater-root > :nth-child(n+11) { display: none; }
1576
+ :is(.iox-role-list-stage, .iox-role-list-stage > .repeater-wrapper) > .repeater-root > :nth-child(n+11):is(*, .iox-role-card) { display: none; }
1565
1577
  :is(.iox-role-list-stage, .iox-role-list-stage > .repeater-wrapper) > .repeater-root > *, :is(:is(.iox-role-list-stage, .iox-role-list-stage > .repeater-wrapper) > .repeater-root > :is(.iox-role-card, .iox-role-list-item), :is(.iox-role-list-stage, .iox-role-list-stage > .repeater-wrapper) > .repeater-root > * :is(.iox-role-card, .iox-role-list-item)) { display: contents; }
1566
1578
  :is(.iox-role-list-stage, .iox-role-list-stage > .repeater-wrapper) > .repeater-root .iox-role-card-content {
1567
1579
  grid-column: 1; align-self: center; padding: 10px 2px; border-block-end: var(--iox-border-width, 1px) solid var(--iox-line);
@@ -1707,6 +1719,13 @@ span.iox-video__play { pointer-events: none; }
1707
1719
  --iox-text: var(--list-item-ink, var(--list-ramp-ink));
1708
1720
  --iox-text-muted: var(--list-item-ink, var(--list-ramp-ink));
1709
1721
  --iox-accent-text: var(--list-item-ink, var(--list-ramp-ink));
1722
+ /* Every part's own ink token too — the title (`heading-color`), the eyebrow, an icon, the title's link — or it
1723
+ resolves at the root and paints the page's ink on the item's ground (#116). */
1724
+ --iox-heading-color: var(--list-item-ink, var(--list-ramp-ink));
1725
+ --iox-eyebrow-color: var(--list-item-ink, var(--list-ramp-ink));
1726
+ --iox-icon-color: var(--list-item-ink, var(--list-ramp-ink));
1727
+ --iox-link-color: var(--list-item-ink, var(--list-ramp-ink));
1728
+ --iox-link-hover-color: var(--list-item-ink, var(--list-ramp-ink));
1710
1729
  --iox-card-border: transparent;
1711
1730
  background: var(--iox-card-bg); color: var(--iox-text);
1712
1731
  }
@@ -1777,10 +1796,21 @@ span.iox-video__play { pointer-events: none; }
1777
1796
  :is(.iox-role-list-drift-row, .iox-role-list-drift-row > .repeater-wrapper, .iox-role-list-drift-row .repeater-root) { display: flex; flex: none; gap: var(--iox-space-gap); }
1778
1797
  .iox-role-list-drift-row .repeater-root > * { flex: none; width: clamp(160px, 18cqi, 260px); }
1779
1798
  .iox-role-list-drift-row :is(.iox-role-card-media, .iox-role-list-item) img { aspect-ratio: 4 / 3; object-fit: cover; }
1780
- /* A fan you drag (Swiper's creative effect): drawn whole, like the deck — the cards waiting either side are never cut. */
1799
+ /* A fan you drag (Swiper's creative effect, planSwiperOptions `fan`): drawn whole, like the deck — the cards waiting
1800
+ either side are never cut. Its card is the still fan's size, set in the middle of the list, so the hand (two turned a
1801
+ side round a point below) fits its list (#116: a card the list's full height ran the hand off its section); the front
1802
+ card is raised, as the still fan's middle. */
1781
1803
  :is(.iox-role-list, .iox-role-list-dim) .swiper.swiper-creative,
1782
1804
  :is(.iox-role-list, .iox-role-list-dim) .swiper.swiper-creative > .swiper-wrapper { overflow: visible; }
1783
1805
  :is(.iox-role-list, .iox-role-list-dim) .swiper.swiper-creative > .swiper-wrapper { padding-block-end: 12%; }
1806
+ :is(.iox-role-list, .iox-role-list-dim).iox-list-arrange-fan.iox-list-move-drag .swiper {
1807
+ width: min(280px, 30cqi); height: auto; aspect-ratio: 3 / 4; margin: auto; flex: none;
1808
+ }
1809
+ :is(.iox-role-list, .iox-role-list-dim) .swiper.swiper-creative > .swiper-wrapper > .swiper-slide { transition-property: transform, translate; }
1810
+ :is(.iox-role-list, .iox-role-list-dim) .swiper.swiper-creative > .swiper-wrapper > .swiper-slide-active { translate: 0 -14px; }
1811
+ @container iox-list (max-width: 640px) {
1812
+ :is(.iox-role-list, .iox-role-list-dim).iox-list-arrange-fan.iox-list-move-drag .swiper { width: min(200px, 34cqi); }
1813
+ }
1784
1814
  /* Reduced motion (the board's floor): nothing travels or turns on a hover or a focus — fades stay. The rest pose (a
1785
1815
  fan's arc, a tilted card's lean, a wall's drops) is a place, not a motion, and stays. */
1786
1816
  @media (prefers-reduced-motion: reduce) {