@vectoriox/iox-ui 5.146.0 → 5.148.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.
- package/composite-core/index.d.ts +15 -1
- package/design-core/index.d.ts +70 -6
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +31 -2
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +101 -12
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1154 -959
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +29 -1
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +81 -36
- package/harness-core/index.d.ts +8 -1
- package/index.d.ts +23 -2
- package/package.json +1 -1
- package/src/composite-core/slider.ts +33 -2
- package/src/design-core/design-apply.ts +6 -0
- package/src/design-core/flavor-spec.generated.ts +48 -0
- package/src/design-core/flavor-tokens.ts +6 -2
- package/src/design-core/header-behaviour.ts +25 -8
- package/src/design-core/node-classes.ts +15 -0
- package/src/design-core/token-css.ts +6 -3
- package/src/generation-core/check-layout.ts +34 -6
- package/src/generation-core/compose-layout.ts +64 -41
- package/src/generation-core/compose-site.ts +6 -2
- package/src/generation-core/footer-mix.ts +7 -2
- package/src/generation-core/layout-column.ts +120 -0
- package/src/generation-core/layout-language.ts +66 -12
- package/src/generation-core/layout-space.ts +6 -5
- package/src/generation-core/layout-type.ts +6 -3
- package/src/generation-core/layout-wire.ts +27 -5
- package/src/generation-core/site-spec.generated.ts +11 -23
- package/src/harness-core/business-types.ts +8 -0
- package/styles/iox-design.css +14 -3
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ColumnId, columnWordOf, contentWidthOf, DensityId, DesignChoices, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
|
|
2
|
+
|
|
3
|
+
import { LAYOUT_COLUMN_GAP } from './layout-language';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A COMPOSED page on the content column (award plan §0c, CW2 — AW-D33…AW-D41). Every composed (CL2) section is the
|
|
7
|
+
* 12-column grid the layout language places its layers on; since CW2 that grid sits on the SAME edge as the header, the
|
|
8
|
+
* footer and every pattern section: `space-inline` (= max(the one gutter `space-edge`, half of what the column leaves)).
|
|
9
|
+
*
|
|
10
|
+
* - The grid's inset is two OUTER tracks, never padding: `[bleed] inset − gap [12 columns] inset − gap [bleed]` — so a
|
|
11
|
+
* layer that bleeds spans into an outer track and reaches the window's edge with no negative margin (T-CW2: a `%` in a
|
|
12
|
+
* cell's margin is the CELL's). A `%` in `grid-template-columns` is the grid's own width, which for a section is the
|
|
13
|
+
* page's (the engine's page without its scrollbar, the canvas's simulated frame) — what `space-inline`'s `%` means.
|
|
14
|
+
* - A grid a sideways section carries `t` screens wide resolves its `%` against `t` pages: its inset is written for it
|
|
15
|
+
* from the same tokens (`layoutTrackInset`).
|
|
16
|
+
* - What cannot read a token — a `screen` word's size (a `%` in `font-size` is the parent's size) and the bar of a gallery
|
|
17
|
+
* that bleeds (a `%` there is the slider's) — is stamped from the PAGE's word at compose time (`layoutColumnPx`): the
|
|
18
|
+
* word composeSite writes as `pageSettings.column`. Wide stamps exactly what a page was before the column.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** The one inset every composed grid reads — the token, with today's composed gutter where a studio's rows predate it. */
|
|
22
|
+
export const LAYOUT_INSET = 'var(--iox-space-inline, max(4vw, 16px))';
|
|
23
|
+
/** What a composed section stamped before CW2 (`max(4vw, 16px)` a side): the old grid's gutter. */
|
|
24
|
+
export const LAYOUT_LEGACY_GUTTER = 'max(4vw, 16px)';
|
|
25
|
+
/** The share of the window the one gutter takes (`space-edge` = max(4%, space-gutter)) — the contract's `axes.edgeShare`. */
|
|
26
|
+
const EDGE_SHARE = String(SPEC_AXES.edgeShare);
|
|
27
|
+
const EDGE_SHARE_NUM = parseFloat(EDGE_SHARE) / 100;
|
|
28
|
+
const GUTTER_FALLBACK = '16px';
|
|
29
|
+
/** The density a column is read at when the design names none (the packs' usual Spacing). */
|
|
30
|
+
const DEFAULT_DENSITY: DensityId = 'regular';
|
|
31
|
+
const GRID = 12;
|
|
32
|
+
/** The column gap in vw (`LAYOUT_COLUMN_GAP`, `1.2vw`). */
|
|
33
|
+
const GAP_VW = parseFloat(LAYOUT_COLUMN_GAP);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The inset of a grid `track` screens wide, from its own width: a section (`track` 1) reads `space-inline` itself; a
|
|
37
|
+
* sideways section's track holds its `%` against `track` pages, so the same rule is written over `100% / track`.
|
|
38
|
+
*/
|
|
39
|
+
export function layoutTrackInset(track = 1): string {
|
|
40
|
+
if (track <= 1) return LAYOUT_INSET;
|
|
41
|
+
return `max(calc(${EDGE_SHARE} / ${track}), var(--iox-space-gutter, ${GUTTER_FALLBACK}), calc((100% / ${track} - var(--iox-content-width, 100%)) / 2))`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A composed grid's columns: an outer track a side (the inset less the gap that follows it), then 12 per screen. */
|
|
45
|
+
export function layoutGridColumns(track = 1): string {
|
|
46
|
+
const outer = `calc(${layoutTrackInset(track)} - ${LAYOUT_COLUMN_GAP})`;
|
|
47
|
+
return `${outer} repeat(${GRID * track}, minmax(0, 1fr)) ${outer}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The grid line a layout line (1..13, 1..12×track+1) stands on, past the start's outer track. */
|
|
51
|
+
export const layoutGridLine = (line: number): number => line + 1;
|
|
52
|
+
/** The first and last lines of a composed grid: a bleed's ends (the window's edges — logical, so RTL mirrors them). */
|
|
53
|
+
export const LAYOUT_BLEED_START_LINE = 1;
|
|
54
|
+
export const LAYOUT_BLEED_END_LINE = -1;
|
|
55
|
+
|
|
56
|
+
/** The column word a composed page wears: its own (`LayoutPage.column`), else the site's (`design.column`), else wide. */
|
|
57
|
+
export function layoutColumnWord(own: unknown, design?: Pick<DesignChoices, 'column'> | null): ColumnId {
|
|
58
|
+
return (columnWordOf(own) ?? columnWordOf(design?.column) ?? SPEC_AXES.columnChoices.pre) as ColumnId;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A column word's width in px at a density (`column-contained` / `column-narrow`), or null for wide (the window). */
|
|
62
|
+
export function layoutColumnPx(word: unknown, density: DensityId | string | undefined): number | null {
|
|
63
|
+
const densities = SPEC_AXES.densities as Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
64
|
+
const row = densities[String(density)] ?? densities[DEFAULT_DENSITY];
|
|
65
|
+
const value = contentWidthOf(word, name => row?.[name]);
|
|
66
|
+
if (!value || !/px$/.test(value)) return null;
|
|
67
|
+
return parseFloat(value);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The page's inset at a window `width` px wide (no scrollbar), in px — `space-inline` evaluated: what the e2e and the
|
|
71
|
+
* judges read. `gutter` is the density's `space-gutter`. */
|
|
72
|
+
export function layoutInsetPx(width: number, columnPx: number | null, gutter: number): number {
|
|
73
|
+
const edge = Math.max(EDGE_SHARE_NUM * width, gutter);
|
|
74
|
+
return columnPx === null ? edge : Math.max(edge, (width - columnPx) / 2);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The bled side's inset of a gallery's bar, in viewport units (inside the slider a `%` is the slider's): the one gutter,
|
|
79
|
+
* and half of what the column leaves when the page wears one. A classic scrollbar shifts it by ≤ 8px — the trade the
|
|
80
|
+
* slider bar already makes (composite-core `BAR_INLINE_PAD`).
|
|
81
|
+
*/
|
|
82
|
+
export function layoutBledBarInset(columnPx: number | null): string {
|
|
83
|
+
const edge = `max(${EDGE_SHARE.replace('%', 'vw')}, var(--iox-space-gutter, ${GUTTER_FALLBACK}))`;
|
|
84
|
+
return columnPx === null ? edge : `max(${EDGE_SHARE.replace('%', 'vw')}, var(--iox-space-gutter, ${GUTTER_FALLBACK}), calc((100vw - ${columnPx}px) / 2))`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Where column `n` (1-based) starts from the page's edge on a composed grid — the inset, then n − 1 columns and their
|
|
89
|
+
* gaps. A ready-made section's padding (`%` = the page's) so its words share the composed sections' edge.
|
|
90
|
+
*/
|
|
91
|
+
export function layoutColumnStart(n: number): string {
|
|
92
|
+
if (n <= 1) return LAYOUT_INSET;
|
|
93
|
+
const column = `((100% - 2 * ${LAYOUT_INSET} - ${GRID - 1} * ${LAYOUT_COLUMN_GAP}) / ${GRID} + ${LAYOUT_COLUMN_GAP})`;
|
|
94
|
+
return `calc(${LAYOUT_INSET} + ${n - 1} * ${column})`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The grid's room on a laptop `width` px wide, in px: inside the inset, capped at the column (12 columns and 11 gaps). */
|
|
98
|
+
export function layoutGridPx(width: number, columnPx: number | null, gutter: number): number {
|
|
99
|
+
return width - 2 * layoutInsetPx(width, columnPx, gutter);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The column gap at a window `width` px wide, in px. */
|
|
103
|
+
export const layoutGapPx = (width: number): number => (GAP_VW / 100) * width;
|
|
104
|
+
|
|
105
|
+
/** A density's `space-gutter` in px (the one gutter's floor). */
|
|
106
|
+
export function layoutGutterPx(density: DensityId | string | undefined): number {
|
|
107
|
+
const densities = SPEC_AXES.densities as Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
108
|
+
return parseFloat((densities[String(density)] ?? densities[DEFAULT_DENSITY])['space-gutter']) || 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The px one grid column is judged at on the check's laptop (`LAYOUT_CHECK_VIEWPORT`, AW-D38): wide stays the window's
|
|
113
|
+
* twelfth (the judges' model before the column — no wide page is judged differently); in a column, the column's twelfth
|
|
114
|
+
* (never more than the window's grid). Both contained and narrow bind at 1440.
|
|
115
|
+
*/
|
|
116
|
+
export function layoutJudgeColumnPx(word: unknown, density: DensityId | string | undefined, width: number): number {
|
|
117
|
+
const columnPx = layoutColumnPx(word, density);
|
|
118
|
+
if (columnPx === null) return width / GRID;
|
|
119
|
+
return Math.min(columnPx, width - 2 * layoutGutterPx(density)) / GRID;
|
|
120
|
+
}
|
|
@@ -373,6 +373,10 @@ export enum LayoutDial {
|
|
|
373
373
|
export interface LayoutPage {
|
|
374
374
|
dial: `${LayoutDial}`;
|
|
375
375
|
sections: LayoutSection[];
|
|
376
|
+
/** Award §0c CW2 (AW-D34): the content column the model chose for this page — `wide · contained · narrow` (design-core
|
|
377
|
+
* `ColumnId`), offered per type (a formal type is never offered `wide`; `checkLayout` mends one). Absent = the
|
|
378
|
+
* site's word. composeSite writes it as `pageSettings.column`. */
|
|
379
|
+
column?: string;
|
|
376
380
|
/** Silent section fallback (iox-ui#67): the model's sections given away — replaced by a ready-made one or dropped — each
|
|
377
381
|
* at its place in the model's page. The page's MINIMUMS forgive what these carried; set only by `fallBackBySection`. */
|
|
378
382
|
givenAway?: LayoutGivenAway[];
|
|
@@ -477,8 +481,15 @@ export enum LayoutMendKind {
|
|
|
477
481
|
/** A carried part whose action points at a node the new page no longer has (RD1 — a scroll link to a section that
|
|
478
482
|
* left): the action is dropped from the carry and the drop is said (`mendCarry`), never refused. */
|
|
479
483
|
Link = 'link',
|
|
484
|
+
/** Award §0c CW2 (AW-D34): a page asking a column word its business type never wears (a law firm's `wide`): it takes
|
|
485
|
+
* the column the type is offered first (`contained`) — said to the owner as `column-mended`. A word outside the
|
|
486
|
+
* axis is dropped (the page wears the site's). */
|
|
487
|
+
Column = 'column',
|
|
480
488
|
}
|
|
481
489
|
|
|
490
|
+
/** What the build says when the column a page asked for was mended (award §0c CW2). */
|
|
491
|
+
export const LAYOUT_COLUMN_MENDED = 'column-mended';
|
|
492
|
+
|
|
482
493
|
/** Why a layer's `scrub` is mended (AW10-D12) — the words the build says. */
|
|
483
494
|
export enum LayoutScrubRefusal {
|
|
484
495
|
/** The first screen never scrubs: it is wholly in view at load (AW10-D8); its scroll motion is copy-out. */
|
|
@@ -542,7 +553,8 @@ export type LayoutMend =
|
|
|
542
553
|
| { kind: LayoutMendKind.List; layer: string; mix: LayoutListMix }
|
|
543
554
|
| { kind: LayoutMendKind.ListWords; section: number; layer: number; side: 'start' | 'end'; heading?: string }
|
|
544
555
|
| { kind: LayoutMendKind.Link; handle: string; from: string; to: string }
|
|
545
|
-
| { kind: LayoutMendKind.ShowList; layer: string; source: string; mix: LayoutListMix }
|
|
556
|
+
| { kind: LayoutMendKind.ShowList; layer: string; source: string; mix: LayoutListMix }
|
|
557
|
+
| { kind: LayoutMendKind.Column; column: string | null };
|
|
546
558
|
|
|
547
559
|
export interface LayoutIssue {
|
|
548
560
|
code: `${LayoutIssueCode}`;
|
|
@@ -563,6 +575,8 @@ export interface LayoutSite {
|
|
|
563
575
|
motion?: { ease?: `${LayoutEase}`; pace?: `${LayoutPace}` };
|
|
564
576
|
nav?: { kind?: `${LayoutNavKind}`; links?: Array<{ label: string; to: string }> };
|
|
565
577
|
sections: LayoutSection[];
|
|
578
|
+
/** Award §0c CW2: the page's own column word (`LayoutPage.column`); absent = the design's (`ComposeLayoutOptions.design`). */
|
|
579
|
+
column?: string;
|
|
566
580
|
}
|
|
567
581
|
|
|
568
582
|
// ── The tables the composer reads (the prototype renderer v4's values, `code/renderer-round4.src.html`) ──────────────
|
|
@@ -618,8 +632,7 @@ export const LAYOUT_TEXT_KINDS: ReadonlySet<string> = new Set([
|
|
|
618
632
|
LayoutLayerKind.Word, LayoutLayerKind.Heading, LayoutLayerKind.Text, LayoutLayerKind.Label, LayoutLayerKind.Number, LayoutLayerKind.List,
|
|
619
633
|
]);
|
|
620
634
|
|
|
621
|
-
/** The grid's
|
|
622
|
-
export const LAYOUT_GUTTER = 'max(4vw, 16px)';
|
|
635
|
+
/** The grid's column gap (the prototype's `.grid`). Its inset is the page's column since CW2 — `layout-column.ts`. */
|
|
623
636
|
export const LAYOUT_COLUMN_GAP = '1.2vw';
|
|
624
637
|
/** A depth's `params.phone`: scene-core `ParallaxPhone.Rest` — stacked on a phone, a layer never glides into its neighbour.
|
|
625
638
|
* Stamped verbatim and read where it plays (not imported, as `PatternTrack`); compose-layout.spec holds the two equal. */
|
|
@@ -678,7 +691,7 @@ export function phoneGapBefore(prev: LayoutLayer | null, next: LayoutLayer): num
|
|
|
678
691
|
return 20;
|
|
679
692
|
}
|
|
680
693
|
|
|
681
|
-
/** The grid a laptop page is laid on, in vw: its width inside the gutters (
|
|
694
|
+
/** The grid a laptop page is laid on, in vw: its width inside the gutters (4vw a side in wide), the gap between
|
|
682
695
|
* columns (`LAYOUT_COLUMN_GAP`), and 12 columns. */
|
|
683
696
|
const GRID_VW = 92;
|
|
684
697
|
const COLUMN_GAP_VW = 1.2;
|
|
@@ -687,6 +700,7 @@ const GRID_COLUMNS = 12;
|
|
|
687
700
|
export const LAYOUT_SCREEN_PX: readonly [number, number] = [36, 560];
|
|
688
701
|
const SCREEN_FILL = 0.98;
|
|
689
702
|
const round2 = (n: number) => Math.round(n * 100) / 100;
|
|
703
|
+
const round4 = (n: number) => Math.round(n * 10000) / 10000;
|
|
690
704
|
|
|
691
705
|
/** How wide `cols` columns of the laptop grid stand, in vw (12 columns: 92vw). */
|
|
692
706
|
export function layoutColumnsVw(cols: number): number {
|
|
@@ -694,10 +708,39 @@ export function layoutColumnsVw(cols: number): number {
|
|
|
694
708
|
return cols * column + Math.max(0, cols - 1) * COLUMN_GAP_VW;
|
|
695
709
|
}
|
|
696
710
|
|
|
711
|
+
/** The page a word is judged on (award §0c CW2): the content column's width in px (null: wide — the window), and the
|
|
712
|
+
* density's gutter (the one gutter's floor; default today's composed 16px). */
|
|
713
|
+
export interface LayoutRoomColumn {
|
|
714
|
+
columnPx?: number | null;
|
|
715
|
+
gutter?: number;
|
|
716
|
+
}
|
|
717
|
+
const LEGACY_GUTTER_PX = 16;
|
|
718
|
+
/** `content-cap` in wide (design-core `WIDE_CONTENT_CAP`): the window. */
|
|
719
|
+
const WIDE_CAP = '100vw';
|
|
720
|
+
|
|
697
721
|
/** The room a layer of `cols` columns has on a screen `width` px wide, in px — a phone stacks every layer full width
|
|
698
|
-
* inside its gutters (`max(
|
|
699
|
-
|
|
700
|
-
|
|
722
|
+
* inside its gutters (`max(4%, gutter)` a side); a laptop in a column has the column's 12 columns, never more than the
|
|
723
|
+
* window's (wide: today's 92vw grid). */
|
|
724
|
+
export function layoutRoomPx(cols: number, width: number, phone: boolean, page: LayoutRoomColumn = {}): number {
|
|
725
|
+
const gutter = page.gutter ?? LEGACY_GUTTER_PX;
|
|
726
|
+
if (phone) return width - 2 * Math.max(0.04 * width, gutter);
|
|
727
|
+
const vw = (layoutColumnsVw(cols) * width) / 100;
|
|
728
|
+
if (page.columnPx === null || page.columnPx === undefined) return vw;
|
|
729
|
+
const gap = (COLUMN_GAP_VW / 100) * width;
|
|
730
|
+
const grid = Math.min(width - 2 * Math.max(0.04 * width, gutter), page.columnPx);
|
|
731
|
+
return Math.min(vw, (cols * (grid - (GRID_COLUMNS - 1) * gap)) / GRID_COLUMNS + Math.max(0, cols - 1) * gap);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/** A `screen` word's width term at a column `columnPx` wide: the px its `cols` columns stand where the column binds
|
|
735
|
+
* (12 columns of the column, 11 gaps of 1.2vw), at `fill / em` — `A px − B vw`. */
|
|
736
|
+
/** The column cap a screen word reads: the COLUMN IN FORCE where it renders (`content-cap`, a length a font-size can
|
|
737
|
+
* read — re-declared by the page's word, iox-ui#117), the stamped column (`fallback`) where a studio's rows lack it. */
|
|
738
|
+
function columnCapCss(cols: number, widthEm: number, fallback: string): string {
|
|
739
|
+
const k = SCREEN_FILL / Math.max(widthEm, 0.01);
|
|
740
|
+
const share = round4((cols / GRID_COLUMNS) * k);
|
|
741
|
+
const vw = round2(COLUMN_GAP_VW * (1 - cols / GRID_COLUMNS) * k);
|
|
742
|
+
const cap = `var(--iox-content-cap, ${fallback})`;
|
|
743
|
+
return vw > 0 ? `calc(${cap} * ${share} - ${vw}vw)` : `calc(${cap} * ${share})`;
|
|
701
744
|
}
|
|
702
745
|
|
|
703
746
|
/**
|
|
@@ -705,16 +748,27 @@ export function layoutRoomPx(cols: number, width: number, phone: boolean): numbe
|
|
|
705
748
|
* own face (design-core `textWidthEm`, from the face's measured letters) — and never stands taller than its rows; never
|
|
706
749
|
* under 36px or over 560px. `rows` 0 sizes by width alone (a phone's stacked word). Held sections are one screen tall.
|
|
707
750
|
*/
|
|
708
|
-
export function screenFontSize(
|
|
751
|
+
export function screenFontSize(
|
|
752
|
+
widthEm: number, cols: number, rows: number, sectionRows: number, screens: number, columnPx: number | null = null, capAlways = false,
|
|
753
|
+
): string {
|
|
709
754
|
const [min, max] = LAYOUT_SCREEN_PX;
|
|
710
755
|
const widthVw = round2((layoutColumnsVw(cols) / Math.max(widthEm, 0.01)) * SCREEN_FILL);
|
|
711
|
-
|
|
756
|
+
// T-CW3: in a column the word never runs past its columns — capped at the column in force, read as `content-cap` (a
|
|
757
|
+
// `%` in font-size is the parent's size, so never `content-width`), the page's word stamped as px its fallback.
|
|
758
|
+
// `capAlways` (a global's word — the footer's closing name, iox-ui#117): capped on every page, `100vw` its fallback
|
|
759
|
+
// in wide, so a page set narrower than the site never sees it run past its column.
|
|
760
|
+
// CW2: a word across all twelve columns also keeps inside the one gutter (`space-gutter` is a px token, so font-size
|
|
761
|
+
// may read it): on a phone and wherever the gutter is wider than 4% of the window, 92vw is more than the room.
|
|
762
|
+
const room = cols >= GRID_COLUMNS ? [`calc((100vw - 2 * var(--iox-space-gutter, ${LEGACY_GUTTER_PX}px)) * ${round4(SCREEN_FILL / Math.max(widthEm, 0.01))})`] : [];
|
|
763
|
+
const capFallback = columnPx ? `${columnPx}px` : capAlways ? WIDE_CAP : null;
|
|
764
|
+
const width = [`${widthVw}vw`, ...(capFallback ? [columnCapCss(cols, widthEm, capFallback)] : []), ...room];
|
|
765
|
+
if (!rows || !sectionRows) return width.length > 1 ? `clamp(${min}px, min(${width.join(', ')}), ${max}px)` : `clamp(${min}px, ${widthVw}vw, ${max}px)`;
|
|
712
766
|
const heightSvh = round2((((rows / sectionRows) * screens * 100) / 0.92) * SCREEN_FILL);
|
|
713
|
-
return `clamp(${min}px, min(${
|
|
767
|
+
return `clamp(${min}px, min(${[...width, `${heightSvh}svh`].join(', ')}), ${max}px)`;
|
|
714
768
|
}
|
|
715
769
|
|
|
716
770
|
/** How many px a `screen` word `widthEm` wide runs past its room at its smallest size, on a screen `width` px wide — 0
|
|
717
771
|
* when it fits. The one thing sizing cannot mend: the static check refuses it (a browser would show it cut). */
|
|
718
|
-
export function screenWordOverflowPx(widthEm: number, cols: number, width: number, phone: boolean): number {
|
|
719
|
-
return Math.max(0, Math.round(LAYOUT_SCREEN_PX[0] * widthEm - layoutRoomPx(cols, width, phone)));
|
|
772
|
+
export function screenWordOverflowPx(widthEm: number, cols: number, width: number, phone: boolean, page: LayoutRoomColumn = {}): number {
|
|
773
|
+
return Math.max(0, Math.round(LAYOUT_SCREEN_PX[0] * widthEm - layoutRoomPx(cols, width, phone, page)));
|
|
720
774
|
}
|
|
@@ -46,17 +46,18 @@ const textOf = (l: LayoutLayer) => String(l.text ?? (l.items ?? []).join(' '));
|
|
|
46
46
|
const advanceOf = (text: string) => (HEBREW.test(text) ? LIM.advance.hebrew : LIM.advance.latin);
|
|
47
47
|
|
|
48
48
|
/** A grid box's size in px on the laptop. */
|
|
49
|
-
export function layoutBoxPx(col: readonly number[], row: readonly number[], s: Pick<LayoutSection, 'pin' | 'screens' | 'rows'
|
|
49
|
+
export function layoutBoxPx(col: readonly number[], row: readonly number[], s: Pick<LayoutSection, 'pin' | 'screens' | 'rows'>, columnPx: number = COLUMN_PX): { w: number; h: number } {
|
|
50
50
|
const height = (s.pin ? 1 : s.screens) * LAYOUT_CHECK_VIEWPORT.height;
|
|
51
|
-
return { w: span(col) *
|
|
51
|
+
return { w: span(col) * columnPx, h: (span(row) * height) / Math.max(1, s.rows) };
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
/** Whether a sized text layer's words fit its box at its size (the check's estimate; a `screen` word is sized to fit).
|
|
55
|
-
|
|
54
|
+
/** Whether a sized text layer's words fit its box at its size (the check's estimate; a `screen` word is sized to fit).
|
|
55
|
+
* `columnPx` is one grid column on the check's laptop — the page's column's twelfth (award §0c CW2, AW-D38). */
|
|
56
|
+
export function layoutTextFits(l: LayoutLayer, s: Pick<LayoutSection, 'pin' | 'screens' | 'rows'>, size: string | undefined = l.size, columnPx: number = COLUMN_PX): boolean {
|
|
56
57
|
const text = textOf(l);
|
|
57
58
|
if (!isText(l) || !size || size === LayoutSize.Screen || !text) return true;
|
|
58
59
|
const px = L.sizePx[size as keyof typeof L.sizePx];
|
|
59
|
-
const box = layoutBoxPx(l.col, l.row, s);
|
|
60
|
+
const box = layoutBoxPx(l.col, l.row, s, columnPx);
|
|
60
61
|
const lines = Math.floor(box.h / (px * LAYOUT_LINE_HEIGHT));
|
|
61
62
|
const items = l.kind === LayoutLayerKind.List ? Math.max(1, l.items?.length ?? 1) : 1;
|
|
62
63
|
return lines >= items && (text.length * px * advanceOf(text)) / Math.max(1, lines) <= box.w * LIM.textFitSlack;
|
|
@@ -2,6 +2,7 @@ import { NO_ELEMENT_STYLE } from '@vectoriox/iox-ui/composite-core';
|
|
|
2
2
|
import { DesignChoices, DesignMode, elementStyleFace, presetChoices, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
3
3
|
|
|
4
4
|
import { LayoutBleed, LayoutLayer, LayoutLayerKind, LayoutRole, LayoutSize, screenWordOverflowPx } from './layout-language';
|
|
5
|
+
import { layoutColumnPx, layoutGutterPx } from './layout-column';
|
|
5
6
|
|
|
6
7
|
/** The design a page wears when only its look's preset is known: the preset in `mode` (else its own), else the default. */
|
|
7
8
|
export function layoutDesignOf(presetId: string | null | undefined, mode?: string | null): DesignChoices {
|
|
@@ -35,13 +36,15 @@ export function screenWordColumns(l: Pick<LayoutLayer, 'col' | 'bleed'>): number
|
|
|
35
36
|
/** The screens a composed page is judged at (the render check's): a laptop and a phone. */
|
|
36
37
|
const SCREENS: ReadonlyArray<{ width: number; phone: boolean }> = [{ width: 1440, phone: false }, { width: 390, phone: true }];
|
|
37
38
|
|
|
38
|
-
/** Where a `screen` word cannot fit even at its smallest size: the screen and by how many px — null when it fits both.
|
|
39
|
-
|
|
39
|
+
/** Where a `screen` word cannot fit even at its smallest size: the screen and by how many px — null when it fits both.
|
|
40
|
+
* `column` is the page's word (award §0c CW2): on the laptop a column gives the word its columns of the column. */
|
|
41
|
+
export function screenWordMisfit(l: LayoutLayer, design: DesignChoices, column?: string | null): { width: number; phone: boolean; px: number } | null {
|
|
40
42
|
if (l.size !== LayoutSize.Screen || !l.text) return null;
|
|
41
43
|
const em = layoutTextWidthEm(l, design);
|
|
44
|
+
const page = { columnPx: column ? layoutColumnPx(column, design.density) : null, gutter: layoutGutterPx(design.density) };
|
|
42
45
|
for (const s of SCREENS) {
|
|
43
46
|
if (s.phone ? false : !!l.bleed && l.bleed !== LayoutBleed.None) continue;
|
|
44
|
-
const px = screenWordOverflowPx(em, s.phone ? 12 : screenWordColumns(l), s.width, s.phone);
|
|
47
|
+
const px = screenWordOverflowPx(em, s.phone ? 12 : screenWordColumns(l), s.width, s.phone, s.phone ? { gutter: page.gutter } : page);
|
|
45
48
|
if (px > 0) return { ...s, px };
|
|
46
49
|
}
|
|
47
50
|
return null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isScrubId, ScrubId } from '@vectoriox/iox-ui/design-core';
|
|
1
|
+
import { columnWordOf, isScrubId, ScrubId, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
|
|
3
3
|
import { JsonSchema, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonText } from './json-schema';
|
|
4
4
|
import {
|
|
@@ -79,8 +79,23 @@ export interface LayoutWireOptions {
|
|
|
79
79
|
/** AW10 (H3): the look's By the scroll (`design.scrub`). Not never, the wire offers `letters` and a layer's `scrub`
|
|
80
80
|
* switch; never or absent, neither (no property is added either way). */
|
|
81
81
|
scrub?: ScrubId | string | null;
|
|
82
|
+
/** Award §0c CW2 (AW-D34, H3): the column words this business type's pages may take (`layoutColumnsOffered` —
|
|
83
|
+
* harness `column.never` left out). Given, the page carries ONE enum `column` (+1 property, 0 unions); absent, or on
|
|
84
|
+
* a redesign (`carry` — its page keeps its word, and the request is at the budget's 40 already), the wire is
|
|
85
|
+
* byte-identical. */
|
|
86
|
+
columns?: ReadonlyArray<string>;
|
|
82
87
|
}
|
|
83
88
|
|
|
89
|
+
/** The column words a page of a type is offered (award §0c, AW-D34): the axis's words less what the type never wears. */
|
|
90
|
+
export function layoutColumnsOffered(never?: ReadonlyArray<string> | null): string[] {
|
|
91
|
+
const blocked = new Set(never ?? []);
|
|
92
|
+
return Object.keys(SPEC_AXES.columns).filter(w => !blocked.has(w));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** The column the layout wire offers, or none: given words and no carry. */
|
|
96
|
+
const columnsOnWire = (options: LayoutWireOptions): ReadonlyArray<string> | null =>
|
|
97
|
+
options.columns?.length && !options.carry ? options.columns : null;
|
|
98
|
+
|
|
84
99
|
/** AW10: the entrance and the switch a look that never scrubs is not offered. */
|
|
85
100
|
const LETTERS = 'letters';
|
|
86
101
|
const SCRUB_FLAG = 'scrub';
|
|
@@ -154,7 +169,7 @@ export interface LayoutWireSection {
|
|
|
154
169
|
id: string; kind: string; screens: number; hold: number; ground: string; rows: number; transition: string; phone: number[];
|
|
155
170
|
layers: LayoutWireLayer[];
|
|
156
171
|
}
|
|
157
|
-
export interface LayoutWire { sections: LayoutWireSection[] }
|
|
172
|
+
export interface LayoutWire { sections: LayoutWireSection[]; column?: string }
|
|
158
173
|
|
|
159
174
|
const text = (d: string) => ({ ...jsonText(), description: d });
|
|
160
175
|
const integer = (d: string) => ({ ...jsonInteger(), description: d });
|
|
@@ -221,7 +236,11 @@ export function layoutWireJsonSchema(options: LayoutWireOptions = {}): JsonSchem
|
|
|
221
236
|
phone: listOf(jsonInteger(), "every layer's index exactly once, in a phone's reading order"),
|
|
222
237
|
layers: listOf(layer, 'the layers'),
|
|
223
238
|
});
|
|
224
|
-
|
|
239
|
+
const columns = columnsOnWire(options);
|
|
240
|
+
const page: Record<string, JsonSchema> = columns
|
|
241
|
+
? { column: oneOf(columns, "the page's content column: wide = the window less the one gutter (a gallery, a bold page) · contained = one centred column · narrow = a reading column (a story, a case study); grounds and bleeds keep the window") }
|
|
242
|
+
: {};
|
|
243
|
+
return closed({ ...page, sections: listOf(section, '4..8 sections') }, 'one composed page in the layout language');
|
|
225
244
|
}
|
|
226
245
|
|
|
227
246
|
const nonEmpty = (v: unknown): v is string => typeof v === 'string' && v.trim() !== '';
|
|
@@ -421,7 +440,9 @@ export function expandLayoutWire(wire: unknown, dial: `${LayoutDial}`): { page:
|
|
|
421
440
|
else (s['layers'] as unknown[]).forEach((l, j) => { if (!isPlainObject(l)) add(`sections[${i}].layers[${j}]`, 'not an object'); });
|
|
422
441
|
});
|
|
423
442
|
if (issues.length) return { page: null, issues };
|
|
424
|
-
|
|
443
|
+
// A word outside the axis is kept as written (`checkLayout` refuses it with a path); none is the site's.
|
|
444
|
+
const column = typeof wire['column'] === 'string' && wire['column'].trim() ? String(wire['column']).trim() : null;
|
|
445
|
+
return { page: { dial, sections: (wire['sections'] as PlainObject[]).map(expandSection), ...(column ? { column } : {}) }, issues: [] };
|
|
425
446
|
}
|
|
426
447
|
|
|
427
448
|
function layerToWire(l: LayoutLayer): LayoutWireLayer {
|
|
@@ -478,8 +499,9 @@ function carryPlaceToWire(s: LayoutSection): LayoutWireSection {
|
|
|
478
499
|
}
|
|
479
500
|
|
|
480
501
|
/** A layout page (or a saved CL2.1 site's sections) → the wire. */
|
|
481
|
-
export function layoutToWire(page: Pick<LayoutPage, 'sections'>): LayoutWire {
|
|
502
|
+
export function layoutToWire(page: Pick<LayoutPage, 'sections'> & Partial<Pick<LayoutPage, 'column'>>): LayoutWire {
|
|
482
503
|
return {
|
|
504
|
+
...(columnWordOf(page.column) ? { column: page.column } : {}),
|
|
483
505
|
sections: page.sections.map(s => (s.carry ? carryPlaceToWire(s) : {
|
|
484
506
|
id: s.id,
|
|
485
507
|
kind: s.signature ? 'signature' : s.kind ?? 'content',
|
|
@@ -34,6 +34,7 @@ export const SPEC_SITE_PLAN_SHAPE = {
|
|
|
34
34
|
"layoutPage": {
|
|
35
35
|
"dial": "'distinct' | 'daring' — how far the page breaks the usual layout (site.layout.vocab.dials; follows How animated, never the model's)",
|
|
36
36
|
"sections": "layoutSection[] — the page in the layout language (site.layout): 4–8 sections of layers on a 12-column grid, checked by generation-core checkLayout, stamped by composeLayout",
|
|
37
|
+
"column?": "string — axes.columns: the content column the model chose for this page (award §0c CW2, AW-D34; offered per type — harness COLUMN_NEVER; absent = the site's word). composeSite writes it as pageSettings.column",
|
|
37
38
|
"givenAway?": "{ at, section }[] — the model's sections silent section fallback gave away (replaced by a ready-made section or dropped), at their places in the model's page; the page's minimums forgive what they carried (iox-ui#67). Set by the server, never by a model"
|
|
38
39
|
},
|
|
39
40
|
"film": {
|
|
@@ -6968,6 +6969,10 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
6968
6969
|
"minScale": 0.9,
|
|
6969
6970
|
"maxTextBlur": 5,
|
|
6970
6971
|
"maxRotate": 8,
|
|
6972
|
+
"listItemMinPx": {
|
|
6973
|
+
"picture": 280,
|
|
6974
|
+
"words": 240
|
|
6975
|
+
},
|
|
6971
6976
|
"longTextChars": 160,
|
|
6972
6977
|
"longTextColumns": 7,
|
|
6973
6978
|
"maxPhotos": 14,
|
|
@@ -11300,8 +11305,12 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
11300
11305
|
"where": "commerce track G (C-D21) — the shop's parts, handed over as words (AW-D19)"
|
|
11301
11306
|
},
|
|
11302
11307
|
"pageColumn": {
|
|
11303
|
-
"built": [
|
|
11304
|
-
|
|
11308
|
+
"built": [
|
|
11309
|
+
"wide",
|
|
11310
|
+
"contained",
|
|
11311
|
+
"narrow"
|
|
11312
|
+
],
|
|
11313
|
+
"where": "award §0c CW2: `LayoutPage.column` on the layout wire (generation-core layoutWireJsonSchema `columns`, offered per type — harness COLUMN_NEVER; `checkLayout` mends a never word, `column-mended`); composeSite writes it as `pageSettings.column`"
|
|
11305
11314
|
}
|
|
11306
11315
|
},
|
|
11307
11316
|
"rows": [
|
|
@@ -11416,27 +11425,6 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
11416
11425
|
"drawnAs": null,
|
|
11417
11426
|
"tier": "pro",
|
|
11418
11427
|
"meaning": "an out-of-season card with notify me"
|
|
11419
|
-
},
|
|
11420
|
-
{
|
|
11421
|
-
"key": "pageColumn.wide",
|
|
11422
|
-
"phase": "CW2",
|
|
11423
|
-
"drawnAs": null,
|
|
11424
|
-
"tier": "all",
|
|
11425
|
-
"meaning": "the page runs the window minus the one gutter (a gallery, a bold page) — never a formal type"
|
|
11426
|
-
},
|
|
11427
|
-
{
|
|
11428
|
-
"key": "pageColumn.contained",
|
|
11429
|
-
"phase": "CW2",
|
|
11430
|
-
"drawnAs": null,
|
|
11431
|
-
"tier": "all",
|
|
11432
|
-
"meaning": "the page's words sit in one centred column; grounds keep the window"
|
|
11433
|
-
},
|
|
11434
|
-
{
|
|
11435
|
-
"key": "pageColumn.narrow",
|
|
11436
|
-
"phase": "CW2",
|
|
11437
|
-
"drawnAs": null,
|
|
11438
|
-
"tier": "all",
|
|
11439
|
-
"meaning": "a reading column — a story, a case study, a long page of words"
|
|
11440
11428
|
}
|
|
11441
11429
|
]
|
|
11442
11430
|
}
|
|
@@ -113,6 +113,12 @@ export interface BusinessTypeLists {
|
|
|
113
113
|
readonly say: ReadonlyArray<string>;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
/** Award §0c (AW-D34): the column words a type's pages are never offered (contract harness `businessTypes[].column`,
|
|
117
|
+
* from harness.mjs COLUMN_NEVER) — the layout wire leaves them out and checkLayout mends them (`column-mended`). */
|
|
118
|
+
export interface BusinessTypeColumn {
|
|
119
|
+
readonly never: ReadonlyArray<string>;
|
|
120
|
+
}
|
|
121
|
+
|
|
116
122
|
/** Award §0b + §0b.7 (AW-D26, AW-D32): how a type's opening film is suggested, and what it may show (`filmIdeaFor`). */
|
|
117
123
|
export interface BusinessTypeFilm {
|
|
118
124
|
/** offer · ifAsked · never — the default the owner's words move one step. */
|
|
@@ -145,6 +151,8 @@ export interface BusinessType {
|
|
|
145
151
|
/** List ingredients LI0 (list-ingredients-plan.md L-D12): what this type's lists never do — arrangements and moves
|
|
146
152
|
* the layout's list section is not offered, and the sentences saying why. Binds generated output only. */
|
|
147
153
|
readonly lists: BusinessTypeLists;
|
|
154
|
+
/** Award §0c (AW-D34): the column words its pages are never offered — formal types never `wide`. */
|
|
155
|
+
readonly column: BusinessTypeColumn;
|
|
148
156
|
/** Award §0b + §0b.7 (AW-D26…D32): how a film is suggested to this type, and what it may show (`filmIdeaFor`). */
|
|
149
157
|
readonly film: BusinessTypeFilm;
|
|
150
158
|
readonly imagery: string;
|
package/styles/iox-design.css
CHANGED
|
@@ -29,6 +29,14 @@ iox-gallery.iox-es-media[data-iox-empty] > .iox-gallery {
|
|
|
29
29
|
display: none;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
/* A text (ghost) button draws no line (no underlines, Doron 2026-11-22 — vectoriox/iox-ui#118): the token is re-declared
|
|
33
|
+
none here, as the link's two are below, so a studio still holding Linen's old `underline` row draws none either
|
|
34
|
+
(design-core SUPERSEDED_TOKEN_VALUES heals the row itself on the builder's load). It is told apart by weight and colour. */
|
|
35
|
+
.iox-es-button-ghost,
|
|
36
|
+
.iox-video__settings {
|
|
37
|
+
--iox-button-ghost-decoration: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
32
40
|
/* What a filled button HOLDS reads its ink (DS9, the contract's `inkScopes`, pinned by
|
|
33
41
|
ink-scopes.spec.ts). An Icon dropped into a Primary button wore the `icon` style — `icon-color`
|
|
34
42
|
= accent-text, painted on the accent fill: 1:1 in a Brand section. Inside a button every token a
|
|
@@ -492,9 +500,10 @@ dialog[data-iox-dialog]:has(> .iox-dialog-close),
|
|
|
492
500
|
/* vectoriox/iox-ui#98 — a header on a PHONE is one row, and its name is held whole on one or two lines. The controls (the
|
|
493
501
|
menu button, the bag, the account, a pinned page, the cells holding them) keep their size and sit at half the look's gap;
|
|
494
502
|
the name takes the room the hidden pages leave and wraps balanced, a word too long for the room breaking rather than
|
|
495
|
-
running under a control; a long name (design-core `brandNameAttributes` — `data-iox-name
|
|
496
|
-
type scale: `size-lead`, then `size-body
|
|
497
|
-
holds over the parts' own rules (one class
|
|
503
|
+
running under a control; a long name (design-core `brandNameAttributes` — `data-iox-name`, by its length and by its
|
|
504
|
+
longest word, iox-ui#120) steps down the look's own type scale: `size-lead`, then `size-body`, then `size-small`.
|
|
505
|
+
Nothing is cut off, so nothing is hidden from a visitor. Two classes, so it holds over the parts' own rules (one class
|
|
506
|
+
each); the canvas sizes by its frame (`@container iox-canvas`). */
|
|
498
507
|
@media (max-width: 767px) {
|
|
499
508
|
.iox-es.iox-role-nav { column-gap: calc(var(--iox-space-gap) / 2); }
|
|
500
509
|
.iox-role-nav .iox-role-nav-cell { min-width: auto; column-gap: calc(var(--iox-space-gap) / 2); }
|
|
@@ -503,6 +512,7 @@ dialog[data-iox-dialog]:has(> .iox-dialog-close),
|
|
|
503
512
|
.iox-role-nav .iox-role-nav-brand :is(h1, h2, h3, h4, h5, h6, p) { text-wrap: balance; overflow-wrap: break-word; }
|
|
504
513
|
.iox-role-nav .iox-role-nav-brand[data-iox-name='long'] :is(h1, h2, h3, h4, h5, h6, p) { font-size: var(--iox-size-lead); }
|
|
505
514
|
.iox-role-nav .iox-role-nav-brand[data-iox-name='longer'] :is(h1, h2, h3, h4, h5, h6, p) { font-size: var(--iox-size-body); }
|
|
515
|
+
.iox-role-nav .iox-role-nav-brand[data-iox-name='longest'] :is(h1, h2, h3, h4, h5, h6, p) { font-size: var(--iox-size-small); }
|
|
506
516
|
}
|
|
507
517
|
@container iox-canvas (max-width: 767px) {
|
|
508
518
|
.iox-es.iox-role-nav { column-gap: calc(var(--iox-space-gap) / 2); }
|
|
@@ -512,6 +522,7 @@ dialog[data-iox-dialog]:has(> .iox-dialog-close),
|
|
|
512
522
|
.iox-role-nav .iox-role-nav-brand :is(h1, h2, h3, h4, h5, h6, p) { text-wrap: balance; overflow-wrap: break-word; }
|
|
513
523
|
.iox-role-nav .iox-role-nav-brand[data-iox-name='long'] :is(h1, h2, h3, h4, h5, h6, p) { font-size: var(--iox-size-lead); }
|
|
514
524
|
.iox-role-nav .iox-role-nav-brand[data-iox-name='longer'] :is(h1, h2, h3, h4, h5, h6, p) { font-size: var(--iox-size-body); }
|
|
525
|
+
.iox-role-nav .iox-role-nav-brand[data-iox-name='longest'] :is(h1, h2, h3, h4, h5, h6, p) { font-size: var(--iox-size-small); }
|
|
515
526
|
}
|
|
516
527
|
|
|
517
528
|
/* ── Header ingredients HI2a: the MENU's forms, reveals, buttons and hover (header-builder board v2, HB-D1/HB-D2) ─────────
|