@vectoriox/iox-ui 5.205.0 → 5.206.1
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/data-core/index.d.ts +13 -4
- package/design-core/index.d.ts +269 -6
- package/fesm2022/vectoriox-iox-ui-data-core.mjs +23 -4
- package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +3064 -2682
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1184 -173
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +71 -19
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs +32 -4
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
- package/generation-core/index.d.ts +421 -34
- package/harness-core/index.d.ts +52 -12
- package/package.json +1 -1
- package/scene-core/index.d.ts +16 -2
- package/src/data-core/placeholder-rows.ts +24 -3
- package/src/design-core/colour-eval.ts +22 -0
- package/src/design-core/contrast-audit.ts +96 -2
- package/src/design-core/design-token.model.ts +2 -0
- package/src/design-core/flavor-spec.generated.ts +184 -0
- package/src/design-core/font-metrics.ts +14 -1
- package/src/design-core/font-vertical.ts +80 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/design-core/style-presets.ts +20 -1
- package/src/design-core/token-css.ts +3 -1
- package/src/generation-core/audit-site.ts +5 -3
- package/src/generation-core/compose-free.ts +1 -1
- package/src/generation-core/compose-layout.ts +197 -23
- package/src/generation-core/critic-calibration.ts +26 -9
- package/src/generation-core/critic-numbers.ts +259 -0
- package/src/generation-core/critic-prompt.ts +53 -6
- package/src/generation-core/critic-rubric.generated.ts +6 -6
- package/src/generation-core/critic-sheet.ts +112 -1
- package/src/generation-core/layout-render-check.ts +35 -2
- package/src/generation-core/layout-space.ts +2 -1
- package/src/generation-core/nav-shape.ts +67 -8
- package/src/generation-core/opening-mix.ts +61 -17
- package/src/generation-core/public-api.ts +2 -0
- package/src/generation-core/social-links.ts +47 -8
- package/src/generation-core/stock-photos.ts +149 -14
- package/src/generation-core/stock-search.ts +108 -19
- package/src/generation-core/stock-subjects.ts +204 -0
- package/src/harness-core/business-types.ts +3 -0
- package/src/harness-core/harness-spec.generated.ts +54 -15
- package/src/harness-core/intake.ts +18 -5
- package/src/scene-core/scene.ts +34 -3
- package/styles/iox-design.css +41 -2
- package/styles/iox-forms.css +7 -6
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { CriticDimension } from './critic';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* THE CARD'S NUMBERS, FOR BOTH SIDES (ai-designer-plan "The hotel level offset", AD-D29 (1)): a reference card
|
|
5
|
+
* (`team/reference-cards/<name>.md`) prints the reference's measured numbers row by row — palette shares, hero px, skeletons,
|
|
6
|
+
* picture area per screen, header and footer — while our page was read off downscaled stills, so the critic under-read our
|
|
7
|
+
* sizes by 15–35% (the hotel's hero 140 / 80 / 80 px against a measured 176 / 96 / 88). A round now runs the same visitor
|
|
8
|
+
* measures (iox-render `measures/visitor.mjs`: TYPE_AND_LAYOUT, PICTURE_AREA per screen, HEADER, FOOTER, the colours) and
|
|
9
|
+
* this ONE formatter prints both sides in the card's words (ported from the tester's `refnums-1128.cjs`). Row 7, motion, is
|
|
10
|
+
* `motionLine` (AD-D27). Pure.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** A screenshot's dominant colours (iox-render `colours`): `#482808 6%` each, and the mean saturation and luminance. */
|
|
14
|
+
export interface VisitColours {
|
|
15
|
+
top?: string[];
|
|
16
|
+
meanSat?: number;
|
|
17
|
+
meanLum?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** TYPE_AND_LAYOUT's `type`: the hero (the largest text on the first screen), the largest anywhere, the body size, the faces. */
|
|
21
|
+
export interface VisitType {
|
|
22
|
+
heroPx?: number;
|
|
23
|
+
heroText?: string;
|
|
24
|
+
heroFam?: string;
|
|
25
|
+
heroWeight?: string;
|
|
26
|
+
largestPx?: number;
|
|
27
|
+
largestFam?: string;
|
|
28
|
+
bodyPx?: number;
|
|
29
|
+
families?: string[];
|
|
30
|
+
headingFaces?: string[];
|
|
31
|
+
upperSharePct?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** TYPE_AND_LAYOUT's `layout`. */
|
|
35
|
+
export interface VisitLayout {
|
|
36
|
+
paraWidthMedian?: number;
|
|
37
|
+
textLeftP10?: number;
|
|
38
|
+
contentSpan?: number;
|
|
39
|
+
docHeight?: number;
|
|
40
|
+
screens?: number;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/** TYPE_AND_LAYOUT's `sections` (the tall full-width blocks and their skeletons). */
|
|
44
|
+
export interface VisitSections {
|
|
45
|
+
count?: number;
|
|
46
|
+
distinctSkeletons?: number;
|
|
47
|
+
consecutiveRepeats?: number;
|
|
48
|
+
padTopMedian?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** HEADER: the bar's box and ground. */
|
|
52
|
+
export interface VisitHeader {
|
|
53
|
+
pos?: string;
|
|
54
|
+
top?: number;
|
|
55
|
+
h?: number;
|
|
56
|
+
bg?: string;
|
|
57
|
+
backdrop?: string;
|
|
58
|
+
visibleLinks?: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** FOOTER. */
|
|
62
|
+
export interface VisitFooter {
|
|
63
|
+
h?: number;
|
|
64
|
+
bg?: string;
|
|
65
|
+
bgImage?: boolean;
|
|
66
|
+
links?: number;
|
|
67
|
+
columnsApprox?: number;
|
|
68
|
+
hasForm?: boolean;
|
|
69
|
+
social?: string[];
|
|
70
|
+
legal?: boolean;
|
|
71
|
+
largestTextPx?: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* The visitor measures of one width, under a visit's `metrics.json` keys (iox-render `visit.mjs`) — a round writes the same
|
|
76
|
+
* keys under `measures.<width>.visit`, so one reader serves both.
|
|
77
|
+
*/
|
|
78
|
+
export interface VisitNumbers {
|
|
79
|
+
colourFirst?: VisitColours;
|
|
80
|
+
colourFull?: VisitColours;
|
|
81
|
+
colourFooter?: VisitColours;
|
|
82
|
+
typeLayoutFirst?: { type?: VisitType };
|
|
83
|
+
typeLayout?: { type?: VisitType; layout?: VisitLayout; sections?: VisitSections };
|
|
84
|
+
firstPictureAreaPct?: number;
|
|
85
|
+
pictureAreaByScreen?: number[];
|
|
86
|
+
pictureAreaMean?: number;
|
|
87
|
+
headerAtLoad?: VisitHeader;
|
|
88
|
+
headerScrolledUp?: VisitHeader;
|
|
89
|
+
footer?: VisitFooter;
|
|
90
|
+
overflow?: { docW?: number; vw?: number };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
type Raw = Record<string, unknown>;
|
|
94
|
+
const obj = (v: unknown): Raw | undefined => (v && typeof v === 'object' && !Array.isArray(v) ? v as Raw : undefined);
|
|
95
|
+
const num = (v: unknown): number | undefined => (typeof v === 'number' && Number.isFinite(v) ? v : undefined);
|
|
96
|
+
const str = (v: unknown): string | undefined => (typeof v === 'string' && v.trim() ? v : undefined);
|
|
97
|
+
const bool = (v: unknown): boolean | undefined => (typeof v === 'boolean' ? v : undefined);
|
|
98
|
+
const strs = (v: unknown): string[] | undefined => (Array.isArray(v) ? v.filter((x): x is string => typeof x === 'string') : undefined);
|
|
99
|
+
const nums = (v: unknown): number[] | undefined => (Array.isArray(v) ? v.filter((x): x is number => typeof x === 'number' && Number.isFinite(x)) : undefined);
|
|
100
|
+
|
|
101
|
+
/** The keys of `o` that `read` gives a value for; undefined when none. */
|
|
102
|
+
function pick<T extends object>(raw: unknown, read: Readonly<Record<keyof T, (v: unknown) => unknown>>): T | undefined {
|
|
103
|
+
const o = obj(raw);
|
|
104
|
+
if (!o) return undefined;
|
|
105
|
+
const out: Raw = {};
|
|
106
|
+
for (const k of Object.keys(read) as Array<keyof T & string>) {
|
|
107
|
+
const v = read[k](o[k]);
|
|
108
|
+
if (v !== undefined) out[k] = v;
|
|
109
|
+
}
|
|
110
|
+
return Object.keys(out).length ? out as T : undefined;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const COLOURS = { top: strs, meanSat: num, meanLum: num } as const;
|
|
114
|
+
const TYPE = {
|
|
115
|
+
heroPx: num, heroText: str, heroFam: str, heroWeight: (v: unknown) => str(v) ?? (num(v) !== undefined ? String(v) : undefined), largestPx: num,
|
|
116
|
+
largestFam: str, bodyPx: num, families: strs, headingFaces: strs, upperSharePct: num,
|
|
117
|
+
} as const;
|
|
118
|
+
const LAYOUT = { paraWidthMedian: num, textLeftP10: num, contentSpan: num, docHeight: num, screens: num } as const;
|
|
119
|
+
const SECTIONS = { count: num, distinctSkeletons: num, consecutiveRepeats: num, padTopMedian: num } as const;
|
|
120
|
+
const HEADER = { pos: str, top: num, h: num, bg: str, backdrop: str, visibleLinks: num } as const;
|
|
121
|
+
const FOOTER = { h: num, bg: str, bgImage: bool, links: num, columnsApprox: num, hasForm: bool, social: strs, legal: bool, largestTextPx: num } as const;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* The card's numbers out of one width's measures (a visit's `metrics.json`, a round's `measures.<width>.visit`): each part
|
|
125
|
+
* kept only when it has its type — a measure that failed (`{ error }`) or was never taken is left out, never read as 0.
|
|
126
|
+
*/
|
|
127
|
+
export function visitNumbersOf(raw: unknown): VisitNumbers | undefined {
|
|
128
|
+
return pick<VisitNumbers>(raw, {
|
|
129
|
+
colourFirst: v => pick<VisitColours>(v, COLOURS),
|
|
130
|
+
colourFull: v => pick<VisitColours>(v, COLOURS),
|
|
131
|
+
colourFooter: v => pick<VisitColours>(v, COLOURS),
|
|
132
|
+
typeLayoutFirst: v => pick<{ type?: VisitType }>(v, { type: t => pick<VisitType>(t, TYPE) }),
|
|
133
|
+
typeLayout: v => pick<{ type?: VisitType; layout?: VisitLayout; sections?: VisitSections }>(v, {
|
|
134
|
+
type: t => pick<VisitType>(t, TYPE), layout: l => pick<VisitLayout>(l, LAYOUT), sections: s => pick<VisitSections>(s, SECTIONS),
|
|
135
|
+
}),
|
|
136
|
+
firstPictureAreaPct: num,
|
|
137
|
+
pictureAreaByScreen: v => { const a = nums(v); return a?.length ? a : undefined; },
|
|
138
|
+
pictureAreaMean: num,
|
|
139
|
+
headerAtLoad: v => pick<VisitHeader>(v, HEADER),
|
|
140
|
+
headerScrolledUp: v => pick<VisitHeader>(v, HEADER),
|
|
141
|
+
footer: v => pick<VisitFooter>(v, FOOTER),
|
|
142
|
+
overflow: v => pick<{ docW?: number; vw?: number }>(v, { docW: num, vw: num }),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** The rows the numbers fill, in the card's order. Motion (row 7) is `motionLine`'s, beside these. */
|
|
147
|
+
export const CARD_NUMBER_ROWS: ReadonlyArray<CriticDimension> = [
|
|
148
|
+
CriticDimension.Colour, CriticDimension.Type, CriticDimension.Composition, CriticDimension.Imagery,
|
|
149
|
+
CriticDimension.Header, CriticDimension.Footer, CriticDimension.Polish,
|
|
150
|
+
];
|
|
151
|
+
|
|
152
|
+
/** One width's numbers, row by row, in the card's words. A row with nothing measured is absent. */
|
|
153
|
+
export type CardNumbers = Partial<Record<CriticDimension, string>>;
|
|
154
|
+
|
|
155
|
+
const px = (v: number) => `${Math.round(v)}px`;
|
|
156
|
+
/** The row's parts that were measured, joined; a part is a string, or a falsy guard (`0` from an empty list's length). */
|
|
157
|
+
const parts = (...p: Array<string | number | false | undefined | null>) => p.filter((x): x is string => typeof x === 'string' && x !== '').join('; ');
|
|
158
|
+
/** How much of the hero's words the row quotes (enough to see what was counted as the hero — a clock, a label). */
|
|
159
|
+
export const CARD_HERO_TEXT_MAX = 32;
|
|
160
|
+
|
|
161
|
+
function colourRow(n: VisitNumbers): string {
|
|
162
|
+
const mean = n.colourFull ?? n.colourFirst;
|
|
163
|
+
return parts(
|
|
164
|
+
n.colourFirst?.top?.length && `first screen ${n.colourFirst.top.slice(0, 5).join(', ')}`,
|
|
165
|
+
n.colourFull?.top?.length && `whole page ${n.colourFull.top.slice(0, 5).join(', ')}`,
|
|
166
|
+
mean && mean.meanSat !== undefined && mean.meanLum !== undefined && `mean saturation ${mean.meanSat}, luminance ${mean.meanLum}`,
|
|
167
|
+
n.colourFooter?.top?.length && `footer ${n.colourFooter.top.slice(0, 3).join(', ')}`,
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function typeRow(n: VisitNumbers): string {
|
|
172
|
+
const hero = n.typeLayoutFirst?.type;
|
|
173
|
+
const page = n.typeLayout?.type;
|
|
174
|
+
const text = hero?.heroText?.replace(/\s+/g, ' ').trim();
|
|
175
|
+
return parts(
|
|
176
|
+
hero?.heroPx !== undefined && `first-screen largest ${px(hero.heroPx)}${hero.heroFam ? ` ${hero.heroFam}` : ''}${hero.heroWeight ? ` ${hero.heroWeight}` : ''}`
|
|
177
|
+
+ `${text ? ` ("${text.length > CARD_HERO_TEXT_MAX ? `${text.slice(0, CARD_HERO_TEXT_MAX)}…` : text}")` : ''}`,
|
|
178
|
+
page?.largestPx !== undefined && `largest text ${px(page.largestPx)}${page.largestFam ? ` (${page.largestFam})` : ''}`,
|
|
179
|
+
page?.bodyPx !== undefined && `body ${px(page.bodyPx)}`,
|
|
180
|
+
hero?.heroPx !== undefined && !!page?.bodyPx && `hero ÷ body ${(hero.heroPx / page.bodyPx).toFixed(1)}`,
|
|
181
|
+
page?.families?.length && `families by characters: ${page.families.join(' · ')}`,
|
|
182
|
+
page?.headingFaces?.length && `heading faces: ${page.headingFaces.join(' · ')}`,
|
|
183
|
+
page?.upperSharePct !== undefined && `caps share ${page.upperSharePct}%`,
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
function compositionRow(n: VisitNumbers): string {
|
|
188
|
+
const l = n.typeLayout?.layout;
|
|
189
|
+
const s = n.typeLayout?.sections;
|
|
190
|
+
return parts(
|
|
191
|
+
l?.docHeight !== undefined && `page ${px(l.docHeight)}${l.screens !== undefined ? ` = ${l.screens} screens` : ''}`,
|
|
192
|
+
l?.contentSpan !== undefined && `text span ${px(l.contentSpan)}${l.textLeftP10 !== undefined ? ` from x=${Math.round(l.textLeftP10)}` : ''}`,
|
|
193
|
+
l?.paraWidthMedian !== undefined && `paragraph width median ${px(l.paraWidthMedian)}`,
|
|
194
|
+
s?.count !== undefined && `${s.count} blocks${s.distinctSkeletons !== undefined ? `, ${s.distinctSkeletons} distinct skeletons` : ''}`
|
|
195
|
+
+ `${s.consecutiveRepeats !== undefined ? `, ${s.consecutiveRepeats} back-to-back repeats` : ''}`,
|
|
196
|
+
s?.padTopMedian !== undefined && `first text sits ${px(s.padTopMedian)} into a block (median)`,
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function imageryRow(n: VisitNumbers): string {
|
|
201
|
+
return parts(
|
|
202
|
+
n.firstPictureAreaPct !== undefined && `picture area: first screen ${n.firstPictureAreaPct}%`,
|
|
203
|
+
n.pictureAreaMean !== undefined && `mean per screen ${n.pictureAreaMean}%${n.pictureAreaByScreen?.length ? ` (per screen ${n.pictureAreaByScreen.join('/')})` : ''}`,
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const bar = (h: VisitHeader, scrolled: boolean) => [
|
|
208
|
+
h.pos, scrolled && h.top !== undefined ? `top ${Math.round(h.top)}` : '', h.h !== undefined ? px(h.h) : '', h.bg ? `bg ${h.bg}` : '',
|
|
209
|
+
h.backdrop && h.backdrop !== 'none' ? h.backdrop : '', !scrolled && h.visibleLinks !== undefined ? `links ${h.visibleLinks}` : '',
|
|
210
|
+
].filter(Boolean).join(' ');
|
|
211
|
+
|
|
212
|
+
function headerRow(n: VisitNumbers): string {
|
|
213
|
+
return parts(
|
|
214
|
+
n.headerAtLoad && bar(n.headerAtLoad, false) && `at load: ${bar(n.headerAtLoad, false)}`,
|
|
215
|
+
n.headerScrolledUp && bar(n.headerScrolledUp, true) && `after down→up: ${bar(n.headerScrolledUp, true)}`,
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** A footer measured 0 px tall is a measure that missed (an empty `<footer>` landmark), never a fact: the row is left out. */
|
|
220
|
+
function footerRow(n: VisitNumbers): string {
|
|
221
|
+
const f = n.footer;
|
|
222
|
+
if (!f || !(f.h! > 0)) return '';
|
|
223
|
+
return [
|
|
224
|
+
px(f.h!), f.bg ? `bg ${f.bg}${f.bgImage ? ' +image' : ''}` : '', f.links !== undefined ? `links ${f.links}` : '',
|
|
225
|
+
f.columnsApprox !== undefined ? `cols~${f.columnsApprox}` : '', f.hasForm !== undefined ? `form ${f.hasForm}` : '',
|
|
226
|
+
f.social ? `social [${f.social.join(',')}]` : '', f.legal !== undefined ? `legal ${f.legal}` : '',
|
|
227
|
+
f.largestTextPx !== undefined ? `biggest ${px(f.largestTextPx)}` : '',
|
|
228
|
+
].filter(Boolean).join(' ');
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function polishRow(n: VisitNumbers): string {
|
|
232
|
+
const o = n.overflow;
|
|
233
|
+
if (o?.docW === undefined || o.vw === undefined) return '';
|
|
234
|
+
return o.docW > o.vw ? `sideways overflow ${Math.round(o.docW)}px > ${Math.round(o.vw)}px` : 'sideways overflow: none';
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const ROW_FORMATS: Readonly<Partial<Record<CriticDimension, (n: VisitNumbers) => string>>> = {
|
|
238
|
+
[CriticDimension.Colour]: colourRow,
|
|
239
|
+
[CriticDimension.Type]: typeRow,
|
|
240
|
+
[CriticDimension.Composition]: compositionRow,
|
|
241
|
+
[CriticDimension.Imagery]: imageryRow,
|
|
242
|
+
[CriticDimension.Header]: headerRow,
|
|
243
|
+
[CriticDimension.Footer]: footerRow,
|
|
244
|
+
[CriticDimension.Polish]: polishRow,
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* ONE width's numbers in the reference card's words, row by row (`CARD_NUMBER_ROWS`) — the same function for the
|
|
249
|
+
* reference's visit and our round, so the critic compares numbers with numbers. Only what was measured is printed.
|
|
250
|
+
*/
|
|
251
|
+
export function cardNumbers(n: VisitNumbers | undefined): CardNumbers {
|
|
252
|
+
const out: CardNumbers = {};
|
|
253
|
+
if (!n) return out;
|
|
254
|
+
for (const row of CARD_NUMBER_ROWS) {
|
|
255
|
+
const line = ROW_FORMATS[row]?.(n);
|
|
256
|
+
if (line) out[row] = line;
|
|
257
|
+
}
|
|
258
|
+
return out;
|
|
259
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CRITIC_CHANGES, CRITIC_SCORE, CriticAnswer, criticVerdict } from './critic';
|
|
2
2
|
import { CRITIC_RUBRIC_DIMENSIONS, CRITIC_RUBRIC_HEADLINE, CRITIC_RUBRIC_POLISH, CRITIC_RUBRIC_SOURCE } from './critic-rubric.generated';
|
|
3
|
-
import { CaptureBox, CaptureView, CaptureWidth, CritiqueSheet, SheetPair } from './critic-sheet';
|
|
3
|
+
import { CaptureBox, CaptureView, CaptureWidth, CritiqueSheet, SheetMotion, SheetNumbers, SheetPair } from './critic-sheet';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* THE CRITIC'S PROMPT (ai-designer-plan §2d, AD3, AD-D18, R-H22): the instructions (stable — cached across rounds) and one
|
|
@@ -42,11 +42,21 @@ export enum CriticSheetLayout {
|
|
|
42
42
|
Paired = 'paired',
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
/** AD-D29 (2): the card's numbers describe the reference's level, never a target (the AD3 Opus answers marked every hotel
|
|
46
|
+
* footer down for being ≈ 850px beside the reference's ≈ 1,270px). Part of `CRITIC_LEVEL_RULE`. */
|
|
47
|
+
export const CRITIC_CARD_LEVEL_WORDS = 'The card\'s numbers describe the reference\'s level, not a target: a size, a height, a share or '
|
|
48
|
+
+ 'a count is never better for being nearer the reference\'s — a footer 850px tall is not worse for being shorter than the '
|
|
49
|
+
+ 'reference\'s 1,270px. Judge what ours does with its own numbers.';
|
|
50
|
+
|
|
45
51
|
/** AD-D18, in the words the critic reads. */
|
|
46
52
|
export const CRITIC_LEVEL_RULE = 'Score the LEVEL, never the likeness. Ask "is this page as good as the reference?", never "does it look '
|
|
47
53
|
+ 'like it?". Resemblance earns nothing: a page that borrows the reference\'s arrangement scores no higher than a different page made '
|
|
48
54
|
+ 'with the same care, and a page unlike the reference can score 10. The reference and its card show the standard to reach — its '
|
|
49
|
-
+ 'precision, its restraint, its finish — not a design to copy.'
|
|
55
|
+
+ 'precision, its restraint, its finish — not a design to copy. A capability the reference has and ours lacks lowers a score only '
|
|
56
|
+
+ 'where a visitor would feel the page is poorer for it; a different choice made with the same care scores the same (a slim bar '
|
|
57
|
+
+ 'beside a floating pill, a solid header beside a transparent one — say it as a change, never a lower score). This never '
|
|
58
|
+
+ 'softens the scale: a page that is plain, careless or unfinished scores 3–6 however different it is, and nothing is raised '
|
|
59
|
+
+ 'for being unlike the reference. ' + CRITIC_CARD_LEVEL_WORDS;
|
|
50
60
|
|
|
51
61
|
/** What a still sheet cannot show (AD3 calibration: a third of the critic's bugs, and every 5.0 cap on a proof page, were
|
|
52
62
|
* a Scene's scroll runway or an unplayed reveal on the whole-page view, or a menu caught mid-fade). */
|
|
@@ -55,13 +65,25 @@ export const CRITIC_STILL_RULE = 'THE SHOTS ARE STILL. The whole-page view is ta
|
|
|
55
65
|
+ 'empty band. That band is not a bug and not a fault of composition: judge the Scene and the reveals under motion, from the '
|
|
56
66
|
+ 'Scene views when the sheet has them. A band is a bug only when a screen-sized view, taken while scrolling like a visitor (the '
|
|
57
67
|
+ 'first screen, the header after scrolling, the footer, a list), shows it empty too. Likewise a view that shows two states at '
|
|
58
|
-
+ 'once (a menu half over the page, a logo drawn twice) was caught mid-transition: say so under motion, never mark it broken.'
|
|
68
|
+
+ 'once (a menu half over the page, a logo drawn twice) was caught mid-transition: say so under motion, never mark it broken. '
|
|
69
|
+
+ 'The same holds for COLOUR: a Scene\'s ground — a dark runway, a film\'s night — seen on the whole-page view is judged at the '
|
|
70
|
+
+ 'Scene views, where the visitor sees it with its picture, never as a band of colour on its own (AD-D29).';
|
|
59
71
|
|
|
60
72
|
/** What a bug is, so one fault is scored once (AD3 calibration: the critic listed ≈ 3× the tester's bugs). */
|
|
61
73
|
export const CRITIC_BUG_RULE = 'A BUG is a fault in the build a visitor would notice: words over words, a cut-off line, an empty '
|
|
62
74
|
+ 'frame where a picture belongs, a dead button, a contrast fail, placeholder text. A design choice — spacing, rhythm, an '
|
|
63
75
|
+ 'off palette, a weak picture — is not a bug: it is scored in its own dimension, once. Never list one fault twice, and never '
|
|
64
|
-
+ 'list it as a bug AND lower a design dimension for it
|
|
76
|
+
+ 'list it as a bug AND lower a design dimension for it: a header defect (the name against the edge, a button over the bar\'s '
|
|
77
|
+
+ 'edge) lowers Header and is not listed again. Content faults — a placeholder, a mislabelled picture, a list repeated — are '
|
|
78
|
+
+ 'the gate\'s to fix: list them together as ONE bug. Marks only the phone shows — a focus ring, a few px off — are listed '
|
|
79
|
+
+ 'together as ONE bug, never broken.';
|
|
80
|
+
|
|
81
|
+
/** How motion is judged when the shots are still (AD-D27; the AD3 calibration on 5.205.0: motion −0.92 below the tester, the
|
|
82
|
+
* reference card listing its motion while ours was read off stills). */
|
|
83
|
+
export const CRITIC_MOTION_RULE = 'MOTION is judged from the Scene views and from THE MOTION rows: what moves on each live page, '
|
|
84
|
+
+ 'counted the same way on both at the first screen (the card\'s Motion row prints the same counts — lenis is smooth scroll, '
|
|
85
|
+
+ 'sticky the pinned elements, anims the animations running, transitions the controls that ease). Compare those rows, not '
|
|
86
|
+
+ 'what a still cannot show: motion the reference has is a fault only when ours has nothing in its place.';
|
|
65
87
|
|
|
66
88
|
const WIDTH_WORDS: Readonly<Record<CaptureWidth, string>> = { [CaptureWidth.Laptop]: 'Laptop 1440', [CaptureWidth.Phone]: 'Phone 390' };
|
|
67
89
|
const VIEW_WORDS: Readonly<Record<CaptureView, string>> = {
|
|
@@ -82,6 +104,27 @@ const VIEW_WORDS: Readonly<Record<CaptureView, string>> = {
|
|
|
82
104
|
export const OURS_ALONE_WORDS = 'ours alone (the reference has no such view) — judge our motion: the Scene as the visitor scrolls';
|
|
83
105
|
const where = (width: CaptureWidth, view: CaptureView) => `${WIDTH_WORDS[width]} · ${VIEW_WORDS[view]}`;
|
|
84
106
|
|
|
107
|
+
/** THE MOTION rows (AD-D27): each width, the reference's count then ours, in the card's words; a side not measured says so. */
|
|
108
|
+
export function motionText(motion: ReadonlyArray<SheetMotion>, reference: string): string {
|
|
109
|
+
return [
|
|
110
|
+
'THE MOTION, counted the same way on both live pages at the first screen (the stills cannot show it):',
|
|
111
|
+
...motion.map(m => `${WIDTH_WORDS[m.width]} — ${reference}: ${m.reference ?? 'not measured'}; ours: ${m.ours ?? 'not measured'}`),
|
|
112
|
+
].join('\n');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** The rubric's name of a dimension (`Imagery`), for the numbers' rows. */
|
|
116
|
+
const DIMENSION_WORDS = (d: string) => CRITIC_RUBRIC_DIMENSIONS.find(r => r.key === d)?.name ?? d;
|
|
117
|
+
|
|
118
|
+
/** THE NUMBERS (AD-D29): row by row, each width, the reference's numbers then ours, in the card's words; a side not
|
|
119
|
+
* measured says so. */
|
|
120
|
+
export function numbersText(numbers: ReadonlyArray<SheetNumbers>, reference: string): string {
|
|
121
|
+
return [
|
|
122
|
+
'THE NUMBERS, row by row as the reference\'s card prints them, measured the same way on both live pages (read sizes and '
|
|
123
|
+
+ 'shares here, never off a scaled-down picture; the reference\'s numbers show its level, not a target):',
|
|
124
|
+
...numbers.map(n => `${DIMENSION_WORDS(n.dimension)} · ${WIDTH_WORDS[n.width]} — ${reference}: ${n.reference ?? 'not measured'}; ours: ${n.ours ?? 'not measured'}`),
|
|
125
|
+
].join('\n');
|
|
126
|
+
}
|
|
127
|
+
|
|
85
128
|
/** The rubric as the critic reads it: each dimension with what it compares, then the headline and the polish rule. */
|
|
86
129
|
export function criticRubricText(): string {
|
|
87
130
|
return [
|
|
@@ -104,11 +147,13 @@ export function criticSystem(): CriticPromptPart[] {
|
|
|
104
147
|
},
|
|
105
148
|
{ text: CRITIC_LEVEL_RULE },
|
|
106
149
|
{ text: criticRubricText() },
|
|
107
|
-
{ text: `${CRITIC_STILL_RULE}\n${CRITIC_BUG_RULE}` },
|
|
150
|
+
{ text: `${CRITIC_STILL_RULE}\n${CRITIC_MOTION_RULE}\n${CRITIC_BUG_RULE}` },
|
|
108
151
|
{
|
|
109
152
|
text: [
|
|
110
153
|
'EVIDENCE: one line per dimension, read off the sheet as a position, a size or a colour — "<reference> sets the hero at '
|
|
111
|
-
+ '≈ 100px on paper #FFFFFC; ours sets it at 64px on #F3F0EA". A line with no measurement is refused.'
|
|
154
|
+
+ '≈ 100px on paper #FFFFFC; ours sets it at 64px on #F3F0EA". A line with no measurement is refused. Where THE '
|
|
155
|
+
+ 'NUMBERS give a size or a share, take it from there: the pictures are scaled down, and a size read off them runs '
|
|
156
|
+
+ 'small.',
|
|
112
157
|
`CHANGES: ${CRITIC_CHANGES.min}–${CRITIC_CHANGES.max}, the ones that move the LOWEST score most, at least one aimed at it. Write `
|
|
113
158
|
+ 'each as a brief for the designer, in our own terms (what to change, where, by how much). Never name the reference in a '
|
|
114
159
|
+ 'brief, and never ask to copy it or make it look like it.',
|
|
@@ -163,6 +208,8 @@ export function criticRoundContent(input: CriticRoundInput, sheet: CritiqueSheet
|
|
|
163
208
|
if (c.reference) out.push(text(`${head} — the reference:`), { kind: CriticContentKind.Crop, ref: c.reference.ref, box: c.reference.box, zoom: c.zoom });
|
|
164
209
|
out.push(text(`${head} — ours:`), { kind: CriticContentKind.Crop, ref: c.ours.ref, box: c.ours.box, zoom: c.zoom });
|
|
165
210
|
});
|
|
211
|
+
if (sheet.numbers?.length) out.push(text(numbersText(sheet.numbers, input.reference)));
|
|
212
|
+
if (sheet.motion?.length) out.push(text(motionText(sheet.motion, input.reference)));
|
|
166
213
|
if (input.measures?.length) out.push(text(`THE MEASURES (ours):\n${input.measures.join('\n')}`));
|
|
167
214
|
if (input.gateFindings?.length) out.push(text(`THE GATE'S FINDINGS:\n${input.gateFindings.join('\n')}`));
|
|
168
215
|
if (input.lastCritique) {
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
5
|
/** Where the rubric came from, and a hash of its section (a changed rubric is a new hash). */
|
|
6
|
-
export const CRITIC_RUBRIC_SOURCE = { file: 'team/reference-score.md', section: '§2', hash: "
|
|
6
|
+
export const CRITIC_RUBRIC_SOURCE = { file: 'team/reference-score.md', section: '§2', hash: "08ab197d4bfd" } as const;
|
|
7
7
|
|
|
8
8
|
/** The eight dimensions in the rubric's order: the key the critic answers under, the name, what is compared. */
|
|
9
9
|
export const CRITIC_RUBRIC_DIMENSIONS: ReadonlyArray<{ readonly n: number; readonly key: string; readonly name: string; readonly compares: string }> = [
|
|
10
|
-
{ n: 1, key: "colour", name: "Colour", compares: "ground colour, how much accent and where, dark bands vs grey-black, palette harmony. Numbers: dominant colours, ΔE to the nearest target palette, contrast" },
|
|
10
|
+
{ n: 1, key: "colour", name: "Colour", compares: "ground colour, how much accent and where, dark bands vs grey-black, palette harmony. A Scene's ground (a dark runway, a film's night) is judged at the Scene views with its picture, never as a band on the whole-page still. Numbers: dominant colours, ΔE to the nearest target palette, contrast" },
|
|
11
11
|
{ n: 2, key: "type", name: "Type", compares: "the display face's character, hero size ÷ body size, weights, tracking, uppercase use. Numbers: hero px, ratio, families" },
|
|
12
12
|
{ n: 3, key: "composition", name: "Composition", compares: "column width, whitespace rhythm, asymmetry and overlap, section variety (two sections in a row on one skeleton = a fault). Numbers: content width, section padding, distinct skeletons per page" },
|
|
13
13
|
{ n: 4, key: "imagery", name: "Imagery", compares: "share of the screen that is picture, full-bleed use, crops, on-subject (an empty picture frame is a Polish bug, not scored here again). Numbers: picture area % per screen" },
|
|
14
|
-
{ n: 5, key: "header", name: "Header", compares: "
|
|
14
|
+
{ n: 5, key: "header", name: "Header", compares: "how well it is made: its craft, legibility, the menu (shelves, full screen), its behaviour on scroll, how it sits on the opening picture. Judged at its own level: a shape or a scroll behaviour different from the targets' is not a fault (a slim bar beside a floating pill, solid beside transparent), say it as a change, never a lower score. A header defect (the name against the edge, a button over the bar's edge, no menu control on the phone) is scored here, once" },
|
|
15
15
|
{ n: 6, key: "footer", name: "Footer", compares: "layout, richness (newsletter, social, facts), ground, legal row" },
|
|
16
|
-
{ n: 7, key: "motion", name: "Motion & feel", compares: "scroll scenes, reveals, hover, page transitions, smoothness on the phone" },
|
|
17
|
-
{ n: 8, key: "polish", name: "Polish (UI bugs)", compares: "overlaps, clipped text, misalignment, broken 390 layout, contrast fails, placeholder text, empty boxes. A bug is a fault in the build, counted here once and never again in 1–7; a design choice (spacing, rhythm, palette) is scored in its own dimension, not here. A still capture's blank Scene runway, an unplayed reveal or a menu caught mid-fade is not a bug. Each bug −1. Any bug a visitor would call broken caps the whole score at 5. Every bug becomes a GitHub issue" },
|
|
16
|
+
{ n: 7, key: "motion", name: "Motion & feel", compares: "scroll scenes, reveals, hover, page transitions, smoothness on the phone. Stills cannot show motion: judge it from the Scene views and from the motion rows, the card's and ours, measured the same way on both live pages (smooth scroll, sticky, animations running, transitions declared). Motion a target has is a fault only when ours has nothing in its place" },
|
|
17
|
+
{ n: 8, key: "polish", name: "Polish (UI bugs)", compares: "overlaps, clipped text, misalignment, broken 390 layout, contrast fails, placeholder text, empty boxes. A bug is a fault in the build, counted here once and never again in 1–7; a design choice (spacing, rhythm, palette) is scored in its own dimension, not here, and a header defect is scored under Header, not again here. Content faults (a placeholder, a mislabelled picture, a list repeated) are the gate's to fix: they are listed together as ONE bug. Marks only the phone shows (a focus ring, a few px off) are listed together as ONE bug, never broken. A still capture's blank Scene runway, an unplayed reveal or a menu caught mid-fade is not a bug. Each bug −1. Any bug a visitor would call broken caps the whole score at 5. Every bug becomes a GitHub issue" },
|
|
18
18
|
];
|
|
19
19
|
|
|
20
20
|
/** The headline rule, in the rubric's words. */
|
|
21
|
-
export const CRITIC_RUBRIC_HEADLINE = "Headline = the mean of 1–7, capped by 8. Every score has one sentence of evidence: \"hotelaurelia does X; ours does Y\", with the two crops side by side. The scale: 9–10 the reference's own level (a target reference scores 8–10, §3.1); 8 it stands beside the reference; 6 a careful template; 5 competent and plain; 3 unfinished.";
|
|
21
|
+
export const CRITIC_RUBRIC_HEADLINE = "Headline = the mean of 1–7, capped by 8. Every score has one sentence of evidence: \"hotelaurelia does X; ours does Y\", with the two crops side by side. The scale: 9–10 the reference's own level (a target reference scores 8–10, §3.1); 8 it stands beside the reference; 6 a careful template; 5 competent and plain; 3 unfinished. A capability a target has and ours lacks lowers a score only where a visitor would feel the page is poorer for it; a different choice made with the same care scores the same. The card's numbers describe the target's level, not a target to reach: a size, a height, a share or a count is never better for being nearer the target's (a footer 850px tall is not worse for being shorter than 1,270px); ours is read from its own numbers, measured the same way. The scale does not soften: a page that is plain, careless or unfinished scores 3–6 however different it is, and a page is never raised for being unlike the targets.";
|
|
22
22
|
|
|
23
23
|
/** The polish row's numbers: what each bug costs, and the cap a bug a visitor would call broken puts on the page. */
|
|
24
24
|
export const CRITIC_RUBRIC_POLISH = { bugPenalty: 1, brokenCap: 5 } as const;
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
* Pure.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import { CriticDimension } from './critic';
|
|
11
|
+
import { CARD_NUMBER_ROWS, cardNumbers, VisitNumbers, visitNumbersOf } from './critic-numbers';
|
|
12
|
+
|
|
10
13
|
export enum CaptureWidth {
|
|
11
14
|
Laptop = 'laptop',
|
|
12
15
|
Phone = 'phone',
|
|
@@ -54,12 +57,48 @@ export interface CaptureBox {
|
|
|
54
57
|
h: number;
|
|
55
58
|
}
|
|
56
59
|
|
|
60
|
+
/**
|
|
61
|
+
* What moves on a live page, counted at its first screen — iox-render's `MOTION` measure (`measures/visitor.mjs`), the
|
|
62
|
+
* one a reference visit and a round both run, so the two sides are counted the same way (AD-D27). A still cannot show
|
|
63
|
+
* motion: this is what the critic reads beside the Scene views. The reference card's Motion row prints the same counts.
|
|
64
|
+
*/
|
|
65
|
+
export interface CaptureMotion {
|
|
66
|
+
lenis?: boolean;
|
|
67
|
+
gsap?: boolean;
|
|
68
|
+
swiper?: boolean;
|
|
69
|
+
videos?: number;
|
|
70
|
+
canvases?: number;
|
|
71
|
+
stickyEls?: number;
|
|
72
|
+
animationsRunning?: number | null;
|
|
73
|
+
transitionsDeclared?: number;
|
|
74
|
+
/** A round only: how many Scenes the page holds (a reference is not an IOX site). */
|
|
75
|
+
scenes?: number;
|
|
76
|
+
}
|
|
77
|
+
|
|
57
78
|
/** The measures a capture knows (a subset of the tester's `metrics.json`; AD2's measures add to it). */
|
|
58
79
|
export interface CaptureMetrics {
|
|
59
80
|
/** The header's box at load. */
|
|
60
81
|
header?: CaptureBox;
|
|
61
82
|
/** Boxes a measure flagged (an overlap, a lone word, a clipped line) — each one is cropped first. */
|
|
62
83
|
flagged?: Array<{ box: CaptureBox; view: CaptureView; why: string }>;
|
|
84
|
+
/** What moves on the live page (AD-D27). */
|
|
85
|
+
motion?: CaptureMotion;
|
|
86
|
+
/** The visitor measures the reference card's Numbers column prints (AD-D29): type, layout, picture area per screen,
|
|
87
|
+
* header, footer, colours — taken the same way on both live pages. */
|
|
88
|
+
numbers?: VisitNumbers;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* A motion measure in the reference card's words (`team/reference-cards/*.md`, row 7's numbers):
|
|
93
|
+
* `lenis true gsap false swiper false videos 3 canvas 0 sticky 0 anims 21 transitions 33`, then `scenes N` when known.
|
|
94
|
+
* A count the measure did not take is left out, never printed as 0.
|
|
95
|
+
*/
|
|
96
|
+
export function motionLine(m: CaptureMotion): string {
|
|
97
|
+
const parts: Array<[string, unknown]> = [
|
|
98
|
+
['lenis', m.lenis], ['gsap', m.gsap], ['swiper', m.swiper], ['videos', m.videos], ['canvas', m.canvases],
|
|
99
|
+
['sticky', m.stickyEls], ['anims', m.animationsRunning], ['transitions', m.transitionsDeclared], ['scenes', m.scenes],
|
|
100
|
+
];
|
|
101
|
+
return parts.filter(([, v]) => typeof v === 'boolean' || (typeof v === 'number' && Number.isFinite(v))).map(([k, v]) => `${k} ${v}`).join(' ');
|
|
63
102
|
}
|
|
64
103
|
|
|
65
104
|
export interface CaptureSet {
|
|
@@ -115,9 +154,62 @@ export interface SheetCrop {
|
|
|
115
154
|
zoom: number;
|
|
116
155
|
}
|
|
117
156
|
|
|
157
|
+
/** The motion counts out of a measure's raw object (iox-render `MOTION`), each kept only when it has its type. */
|
|
158
|
+
export function captureMotionOf(raw: unknown): CaptureMotion | undefined {
|
|
159
|
+
if (!raw || typeof raw !== 'object') return undefined;
|
|
160
|
+
const r = raw as Record<string, unknown>;
|
|
161
|
+
const out: CaptureMotion = {};
|
|
162
|
+
for (const k of ['lenis', 'gsap', 'swiper'] as const) if (typeof r[k] === 'boolean') out[k] = r[k] as boolean;
|
|
163
|
+
for (const k of ['videos', 'canvases', 'stickyEls', 'animationsRunning', 'transitionsDeclared', 'scenes'] as const) {
|
|
164
|
+
if (typeof r[k] === 'number' && Number.isFinite(r[k])) out[k] = r[k] as number;
|
|
165
|
+
}
|
|
166
|
+
return Object.keys(out).length ? out : undefined;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* The measures the sheet uses, from one width's `metrics.json` of a visit (iox-render `visit.mjs`, the reference captures
|
|
171
|
+
* and the tester's): the header at load, the polish findings boxed on the whole page, what moves, the card's numbers
|
|
172
|
+
* (AD-D29). A malformed box is skipped; nothing found is `{}`.
|
|
173
|
+
*/
|
|
174
|
+
export function visitMetricsOf(metrics: unknown): CaptureMetrics {
|
|
175
|
+
const m = metrics as { headerAtLoad?: { left?: number; top?: number; w?: number; h?: number }; polish?: Array<{ kind?: string; text?: string; box?: number[] }>; motion?: unknown } | null;
|
|
176
|
+
const out: CaptureMetrics = {};
|
|
177
|
+
const h = m?.headerAtLoad;
|
|
178
|
+
if (h && [h.left, h.top, h.w, h.h].every(Number.isFinite) && h.h! > 0) out.header = { x: h.left!, y: h.top!, w: h.w!, h: h.h! };
|
|
179
|
+
const flagged = (m?.polish ?? [])
|
|
180
|
+
.filter(p => Array.isArray(p.box) && p.box.length === 4 && p.box.every(Number.isFinite))
|
|
181
|
+
.map(p => ({ view: CaptureView.Full, box: { x: p.box![0], y: p.box![1], w: p.box![2], h: p.box![3] }, why: `${p.kind}: "${String(p.text ?? '').slice(0, 60)}"` }));
|
|
182
|
+
if (flagged.length) out.flagged = flagged;
|
|
183
|
+
const motion = captureMotionOf(m?.motion);
|
|
184
|
+
if (motion) out.motion = motion;
|
|
185
|
+
const numbers = visitNumbersOf(m);
|
|
186
|
+
if (numbers) out.numbers = numbers;
|
|
187
|
+
return out;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/** One width's motion, measured on both live pages (AD-D27): the reference's and ours, in the card's words. */
|
|
191
|
+
export interface SheetMotion {
|
|
192
|
+
width: CaptureWidth;
|
|
193
|
+
reference?: string;
|
|
194
|
+
ours?: string;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** One row of the card's numbers at one width (AD-D29): the reference's and ours, each in the card's words (`cardNumbers`). */
|
|
198
|
+
export interface SheetNumbers {
|
|
199
|
+
dimension: CriticDimension;
|
|
200
|
+
width: CaptureWidth;
|
|
201
|
+
reference?: string;
|
|
202
|
+
ours?: string;
|
|
203
|
+
}
|
|
204
|
+
|
|
118
205
|
export interface CritiqueSheet {
|
|
119
206
|
pairs: SheetPair[];
|
|
120
207
|
crops: SheetCrop[];
|
|
208
|
+
/** Per width, what moves on each live page — words, not pictures, so they cost no image token. */
|
|
209
|
+
motion: SheetMotion[];
|
|
210
|
+
/** Row by row (the card's order), then per width: the card's numbers measured on both live pages (AD-D29) — words, so
|
|
211
|
+
* sizes and shares are read as numbers, never off a scaled-down still. */
|
|
212
|
+
numbers: SheetNumbers[];
|
|
121
213
|
/** The views one side has and the other has not (`phone/footer: no reference shot`). */
|
|
122
214
|
missing: string[];
|
|
123
215
|
/** What left the sheet to keep it inside `CRITIC_SHEET_MAX_IMAGES` (`phone/first`, `crop: the phone footer`), in order. */
|
|
@@ -261,10 +353,29 @@ export function planCritiqueSheet(ours: CaptureSet, reference: CaptureSet, maxIm
|
|
|
261
353
|
: fraction(o, recipe.box));
|
|
262
354
|
crops.push({ width: recipe.width, view: recipe.view, why: recipe.why, ours: { ref: o.ref, box }, reference: { ref: r.ref, box: clip(r, fraction(r, recipe.box)) }, zoom: zoomOf(box) });
|
|
263
355
|
}
|
|
356
|
+
const motion: SheetMotion[] = [];
|
|
357
|
+
for (const width of Object.values(CaptureWidth)) {
|
|
358
|
+
const o = ours.metrics?.[width]?.motion;
|
|
359
|
+
const r = reference.metrics?.[width]?.motion;
|
|
360
|
+
const line = (m?: CaptureMotion) => (m ? motionLine(m) : '');
|
|
361
|
+
if (line(o) || line(r)) motion.push({ width, ...(line(r) ? { reference: line(r) } : {}), ...(line(o) ? { ours: line(o) } : {}) });
|
|
362
|
+
}
|
|
363
|
+
const numbers: SheetNumbers[] = [];
|
|
364
|
+
// re-read on the way in (idempotent): a capture source may hand its measures over as they were written
|
|
365
|
+
const rowsOf = (set: CaptureSet) => Object.fromEntries(Object.values(CaptureWidth).map(w => [w, cardNumbers(visitNumbersOf(set.metrics?.[w]?.numbers))]));
|
|
366
|
+
const ourRows = rowsOf(ours);
|
|
367
|
+
const theirRows = rowsOf(reference);
|
|
368
|
+
for (const dimension of CARD_NUMBER_ROWS) {
|
|
369
|
+
for (const width of Object.values(CaptureWidth)) {
|
|
370
|
+
const o = ourRows[width][dimension];
|
|
371
|
+
const r = theirRows[width][dimension];
|
|
372
|
+
if (o || r) numbers.push({ dimension, width, ...(r ? { reference: r } : {}), ...(o ? { ours: o } : {}) });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
264
375
|
const dropped = fitSheet(pairs, crops, maxImages);
|
|
265
376
|
const referenceImageTokens = pairs.reduce((n, p) => n + (p.reference ? visionImageTokens(p.reference.w, p.reference.h) : 0), 0);
|
|
266
377
|
const pairTokens = referenceImageTokens + pairs.reduce((n, p) => n + visionImageTokens(p.ours.w, p.ours.h), 0);
|
|
267
378
|
const cropTokens = crops.reduce((n, c) => n + visionImageTokens(c.ours.box.w * c.zoom, c.ours.box.h * c.zoom)
|
|
268
379
|
+ (c.reference ? visionImageTokens(c.reference.box.w * c.zoom, c.reference.box.h * c.zoom) : 0), 0);
|
|
269
|
-
return { pairs, crops, missing, dropped, imageTokens: pairTokens + cropTokens, referenceImageTokens };
|
|
380
|
+
return { pairs, crops, motion, numbers, missing, dropped, imageTokens: pairTokens + cropTokens, referenceImageTokens };
|
|
270
381
|
}
|
|
@@ -38,6 +38,9 @@ export interface MeasuredLayer {
|
|
|
38
38
|
box: LayoutRect;
|
|
39
39
|
/** Where its words are (a text's line boxes, a button's box); null when it carries none. */
|
|
40
40
|
words: LayoutRect | null;
|
|
41
|
+
/** Where what it HOLDS stands, when that is not its box: a list's rows inside the cell it stretches over (iox-ui#207).
|
|
42
|
+
* Absent: its box. */
|
|
43
|
+
content?: LayoutRect;
|
|
41
44
|
/** On a laptop, in a held section: the stretches of its play its opacity tracks show it (`layerShownSpans`); absent,
|
|
42
45
|
* it shows throughout. Measured at rest every layer shows, so words that take turns would read as overlapping. */
|
|
43
46
|
shown?: Array<[number, number]>;
|
|
@@ -76,9 +79,15 @@ export interface LayerMetrics {
|
|
|
76
79
|
/** An element's box in the root's coordinates. */
|
|
77
80
|
box(el: Element): LayoutRect;
|
|
78
81
|
/** A node's box, its words (a text's line boxes, a button's box — when it carries words of a word `kind`), z and type. */
|
|
79
|
-
layer(el: Element, kind: string): Pick<MeasuredLayer, 'kind' | 'z' | 'box' | 'words' | 'size' | 'weight' | 'color'>;
|
|
82
|
+
layer(el: Element, kind: string): Pick<MeasuredLayer, 'kind' | 'z' | 'box' | 'words' | 'content' | 'size' | 'weight' | 'color'>;
|
|
80
83
|
}
|
|
81
84
|
|
|
85
|
+
/** The kinds whose box is a cell they stretch over, not what they hold (a list's frame): their content is measured. */
|
|
86
|
+
const HOLDER_KINDS: ReadonlySet<string> = new Set(['gallery']);
|
|
87
|
+
const union = (rects: ReadonlyArray<LayoutRect>): LayoutRect | null => (rects.length ? {
|
|
88
|
+
l: Math.min(...rects.map(r => r.l)), t: Math.min(...rects.map(r => r.t)), r: Math.max(...rects.map(r => r.r)), b: Math.max(...rects.map(r => r.b)),
|
|
89
|
+
} : null);
|
|
90
|
+
|
|
82
91
|
/** In the browser: the reader of the nodes rendered under `root`, in the root's own coordinates. */
|
|
83
92
|
export function layerMetricsOf(root: Element): LayerMetrics {
|
|
84
93
|
const origin = root.getBoundingClientRect();
|
|
@@ -102,8 +111,11 @@ export function layerMetricsOf(root: Element): LayerMetrics {
|
|
|
102
111
|
words = tight && tight.width > 0 ? rel(tight) : box;
|
|
103
112
|
}
|
|
104
113
|
}
|
|
114
|
+
const held = HOLDER_KINDS.has(kind)
|
|
115
|
+
? union(Array.from(el.children).map(c => rel(c.getBoundingClientRect())).filter(r => r.r > r.l && r.b > r.t))
|
|
116
|
+
: null;
|
|
105
117
|
return {
|
|
106
|
-
kind, z: Number(style?.zIndex) || 0, box, words,
|
|
118
|
+
kind, z: Number(style?.zIndex) || 0, box, words, ...(held ? { content: held } : {}),
|
|
107
119
|
size: parseFloat(style?.fontSize ?? '') || 16, weight: Number(style?.fontWeight) || 400, color: style?.color ?? '',
|
|
108
120
|
};
|
|
109
121
|
},
|
|
@@ -230,8 +242,20 @@ export const RENDER_CHECK = {
|
|
|
230
242
|
contrastBody: 4.5,
|
|
231
243
|
/** The light's spread over which a part of a photo is busy. */
|
|
232
244
|
busy: 0.11,
|
|
245
|
+
/** iox-ui#207: a laid section's content may end at most this share of a screen above its bottom — more reads as an
|
|
246
|
+
* empty screen at rest (the café's dish grid ended 1105 px above its section's bottom; one line held a whole screen). */
|
|
247
|
+
emptyBelow: 0.5,
|
|
233
248
|
} as const;
|
|
234
249
|
|
|
250
|
+
/** Kinds that decorate, never hold: a shape over a whole section does not make it full. */
|
|
251
|
+
const DECORATION_KINDS: ReadonlySet<string> = new Set(['shape']);
|
|
252
|
+
|
|
253
|
+
/** Where a section's content ends, by the bottoms of its layers' words, held content or boxes; null with none measured. */
|
|
254
|
+
function contentEnd(layers: ReadonlyArray<MeasuredLayer>): number | null {
|
|
255
|
+
const ends = layers.filter(l => !DECORATION_KINDS.has(l.kind)).map(l => (l.words ?? l.content ?? l.box).b);
|
|
256
|
+
return ends.length ? Math.max(...ends) : null;
|
|
257
|
+
}
|
|
258
|
+
|
|
235
259
|
const ratio = (a: number, b: number) => (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);
|
|
236
260
|
|
|
237
261
|
/** Measured boxes (each viewport) + the pixels under the words on photos → the render issues, by path, said once each. */
|
|
@@ -285,6 +309,15 @@ export function judgeLayoutRender(measured: ReadonlyArray<MeasuredLayout>, pixel
|
|
|
285
309
|
}
|
|
286
310
|
}
|
|
287
311
|
if (on === LayoutViewport.Phone && m.scrollWidth > m.width + 1) say('sideways', 'sections', `the page scrolls sideways on a phone (${m.scrollWidth - m.width}px too wide)`);
|
|
312
|
+
// iox-ui#207: no resting screen of flat ground — a section (not a held stage: its runway scrolls under it) whose
|
|
313
|
+
// content ends more than half a screen above its bottom.
|
|
314
|
+
m.sections.forEach((sec, i) => {
|
|
315
|
+
const end = sec.held || sec.height <= 0 ? null : contentEnd(m.layers.filter(l => l.section === i));
|
|
316
|
+
const empty = end === null ? 0 : sec.top + sec.height - end;
|
|
317
|
+
if (empty > RENDER_CHECK.emptyBelow * m.height) {
|
|
318
|
+
say(`empty:${i}:${on}`, `sections[${i}]`, `sections[${i}]: its content ends ${Math.round(empty)}px (${(empty / m.height).toFixed(1)} of a screen) above its bottom on the ${on} — fewer screens or rows, or something in the empty rows`);
|
|
319
|
+
}
|
|
320
|
+
});
|
|
288
321
|
}
|
|
289
322
|
const layerAt = new Map(measured.flatMap(m => m.layers.map(l => [`${m.viewport}:${l.path}`, l] as const)));
|
|
290
323
|
for (const px of pixels) {
|
|
@@ -135,7 +135,8 @@ export function layoutDriftPhoto(s: LayoutSection): number {
|
|
|
135
135
|
export const LAYOUT_DRIFT: Readonly<LayoutTrack> = { prop: LayoutTrackProp.Scale, from: 1, to: 1.08, at: [0, 1] };
|
|
136
136
|
|
|
137
137
|
/** A section whose screen is spoken for: what is on it never leaves it (held, sideways, a photo ground, ready-made), or
|
|
138
|
-
* its space is the point (an inhale — the page's one breath, a word in the quiet
|
|
138
|
+
* its space is the point (an inhale — the page's one breath, a word in the quiet; the composer lays its words in the
|
|
139
|
+
* middle of its screens, `inhaleRows`, so the quiet is shared above and below them — iox-ui#220). */
|
|
139
140
|
const filled = (s: LayoutSection) => !!s.pin || (s.track ?? 1) > 1 || !!s.readyMade || !!s.carry || String(s.ground ?? '').startsWith('photo:')
|
|
140
141
|
|| s.kind === LayoutSectionKind.Inhale;
|
|
141
142
|
|