@vectoriox/iox-ui 5.204.0 → 5.206.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/data-core/index.d.ts +13 -4
- package/design-core/index.d.ts +277 -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 +3065 -2673
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1313 -197
- 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/fesm2022/vectoriox-iox-ui.mjs +145 -82
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +462 -41
- package/harness-core/index.d.ts +52 -12
- package/index.d.ts +44 -3
- 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/node-links.ts +12 -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/ai-run.ts +31 -0
- 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 +172 -22
- package/src/generation-core/critic-calibration.ts +30 -10
- package/src/generation-core/critic-numbers.ts +259 -0
- package/src/generation-core/critic-prompt.ts +74 -6
- package/src/generation-core/critic-rubric.generated.ts +7 -7
- package/src/generation-core/critic-sheet.ts +184 -6
- package/src/generation-core/critic.ts +27 -13
- package/src/generation-core/designer-brief.ts +4 -3
- package/src/generation-core/designer-estimate.ts +3 -3
- package/src/generation-core/layout-render-check.ts +35 -2
- 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
|
@@ -24,8 +24,9 @@ export type PresetMode = Exclude<DesignMode, 'auto'>;
|
|
|
24
24
|
|
|
25
25
|
export interface StylePreset {
|
|
26
26
|
readonly id: string;
|
|
27
|
-
/** A proper name — never translated. */
|
|
28
27
|
readonly name: string;
|
|
28
|
+
/** The name in Hebrew (iox-ui#217) — shown through `nameIn`, never read directly. */
|
|
29
|
+
readonly nameHe: string;
|
|
29
30
|
readonly blurb: string;
|
|
30
31
|
/** The blurb in Hebrew (2026-10-25). */
|
|
31
32
|
readonly blurbHe: string;
|
|
@@ -54,6 +55,24 @@ export function stylePresetById(id: string | null | undefined): StylePreset | un
|
|
|
54
55
|
return id ? STYLE_PRESETS.find(p => p.id === id) : undefined;
|
|
55
56
|
}
|
|
56
57
|
|
|
58
|
+
/** A row the contract names in English and Hebrew — a style (`StylePreset`) or a flavor (`FlavorPackV2`). */
|
|
59
|
+
export interface NamedInTwoLanguages {
|
|
60
|
+
readonly name: string;
|
|
61
|
+
readonly nameHe?: string;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const HEBREW_LOCALE = 'he';
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A style's or a flavor's name in the admin's language (iox-ui#217): the Hebrew name for `he`, else the English one;
|
|
68
|
+
* undefined for no row, so a caller keeps its own fallback (`nameIn(flavorPackById(id), lang) ?? id`). The ONE place a
|
|
69
|
+
* screen picks the language of a look's name — Design ▸ Look, the wizard, the Colour/Type/Motion tabs, the site map.
|
|
70
|
+
*/
|
|
71
|
+
export function nameIn(row: NamedInTwoLanguages | null | undefined, locale: string | null | undefined): string | undefined {
|
|
72
|
+
if (!row) return undefined;
|
|
73
|
+
return locale === HEBREW_LOCALE && row.nameHe ? row.nameHe : row.name;
|
|
74
|
+
}
|
|
75
|
+
|
|
57
76
|
const FOLLOW_VISITOR: DesignMode = 'auto';
|
|
58
77
|
|
|
59
78
|
/** The modes Design offers for a preset: the audited ones, then "Follow visitor" when it passed both (H-D3). */
|
|
@@ -3,6 +3,7 @@ import { CASELESS_LANGUAGES } from './locale-direction';
|
|
|
3
3
|
import { SPEC_A11Y, SPEC_AXES, SPEC_SCHEMES } from './flavor-spec.generated';
|
|
4
4
|
import { columnSelector, CONTENT_CAP_TOKEN, CONTENT_WIDTH_TOKEN, contentCapOf, contentWidthOf, openingFollowerSelector, SCHEME_INK } from './node-classes';
|
|
5
5
|
import { specTokenNames } from './token-names';
|
|
6
|
+
import { fontVerticalTokenEntries } from './font-vertical';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* Design-token → CSS compilation, shared by BOTH renderers (flavors F0, design-system DS1).
|
|
@@ -493,7 +494,8 @@ export function compileTokenCssBlocks(
|
|
|
493
494
|
: [];
|
|
494
495
|
const columns = columnCss(rows, opts.scope);
|
|
495
496
|
const base = [
|
|
496
|
-
|
|
497
|
+
// iox-ui#215: each font-family token's face as derived `<role>-ascent` / `-descent` (what an on-edge drop reads).
|
|
498
|
+
rule(root, [...unset, ...rows.map((t): [string, string] => [t.name, t.value]), ...fontVerticalTokenEntries(resolveTokenValues(rows))]),
|
|
497
499
|
compileSchemeCss(rows, opts.scope, opposite),
|
|
498
500
|
columns.base,
|
|
499
501
|
// CO5: the section space's phone step (after the base and the columns, so its re-declared readers win on a phone).
|
|
@@ -46,6 +46,17 @@ export enum AiStep {
|
|
|
46
46
|
AssistPicture = 'assistPicture',
|
|
47
47
|
/** AI Assist, Files box ▸ Generate: the look at a made picture — the same call as `CheckPictures`. */
|
|
48
48
|
AssistPictureReview = 'assistPictureReview',
|
|
49
|
+
/**
|
|
50
|
+
* The AI designer (ai-designer-plan AD4, Pro behind `features.designer`): the three concepts the owner picks from
|
|
51
|
+
* (§2a′, `designerConceptsSchema`) — words and a planned Home; their sketches are rendered, not asked.
|
|
52
|
+
*/
|
|
53
|
+
DesignConcepts = 'designConcepts',
|
|
54
|
+
/** The designer: the ten lines of art direction, once per site after the pick (§2a, `designerDirectionSchema`). */
|
|
55
|
+
DesignDirection = 'designDirection',
|
|
56
|
+
/** The designer: one round's builder operations on a page (§2b, §2e — `DESIGN_TOOL_SCHEMAS`). */
|
|
57
|
+
DesignRevise = 'designRevise',
|
|
58
|
+
/** The designer: one round's critique against the reference (§2d, `criticAnswerSchema`). */
|
|
59
|
+
DesignCritique = 'designCritique',
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
export const AI_STEPS: ReadonlyArray<AiStep> = Object.values(AiStep);
|
|
@@ -81,6 +92,10 @@ export const AI_STEP_LABELS: Readonly<Record<AiStep, string>> = {
|
|
|
81
92
|
[AiStep.AssistRead]: 'Read your photos',
|
|
82
93
|
[AiStep.AssistPicture]: 'Make a picture',
|
|
83
94
|
[AiStep.AssistPictureReview]: 'Check the picture',
|
|
95
|
+
[AiStep.DesignConcepts]: 'Sketch three directions',
|
|
96
|
+
[AiStep.DesignDirection]: 'Set the art direction',
|
|
97
|
+
[AiStep.DesignRevise]: 'Design a round',
|
|
98
|
+
[AiStep.DesignCritique]: 'Critique a round',
|
|
84
99
|
};
|
|
85
100
|
|
|
86
101
|
/** What a model must be able to do for a step to run on it. */
|
|
@@ -103,6 +118,10 @@ export const AI_STEP_NEEDS: Readonly<Record<AiStep, ReadonlyArray<AiCapability>>
|
|
|
103
118
|
[AiStep.AssistRead]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
104
119
|
[AiStep.AssistPicture]: [AiCapability.ImageOutput],
|
|
105
120
|
[AiStep.AssistPictureReview]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
121
|
+
[AiStep.DesignConcepts]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
122
|
+
[AiStep.DesignDirection]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
123
|
+
[AiStep.DesignRevise]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
124
|
+
[AiStep.DesignCritique]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
106
125
|
};
|
|
107
126
|
|
|
108
127
|
/**
|
|
@@ -181,6 +200,13 @@ export const AI_STEP_TYPICAL_TOKENS: Readonly<Record<AiStep, AiTokenCounts>> = {
|
|
|
181
200
|
// Files box ▸ Generate: the very calls of the two picture steps, so the very counts.
|
|
182
201
|
[AiStep.AssistPicture]: PICTURE_TOKENS,
|
|
183
202
|
[AiStep.AssistPictureReview]: PICTURE_REVIEW_TOKENS,
|
|
203
|
+
// The designer (ai-designer-plan §6b, estimates until AD3 measures a round): a concept writes words and a planned Home
|
|
204
|
+
// (no pictures out); the direction reads the references' cards and writes ten lines; a revise reads the brief and the
|
|
205
|
+
// page as compact ops and writes ops; a critique reads ≈ 20 pictures, the reference's from the cache from round 2.
|
|
206
|
+
[AiStep.DesignConcepts]: { input: 14_000, output: 6_000, cacheWrite: 0, cacheRead: 0 },
|
|
207
|
+
[AiStep.DesignDirection]: { input: 12_000, output: 2_000, cacheWrite: 0, cacheRead: 0 },
|
|
208
|
+
[AiStep.DesignRevise]: { input: 14_000, output: 10_000, cacheWrite: 0, cacheRead: 15_000 },
|
|
209
|
+
[AiStep.DesignCritique]: { input: 35_500, output: 4_000, cacheWrite: 0, cacheRead: 35_000 },
|
|
184
210
|
};
|
|
185
211
|
|
|
186
212
|
/** Tokens by the class a provider prices them in. */
|
|
@@ -437,6 +463,11 @@ export const AI_STEP_FEATURE: Readonly<Record<AiStep, AiFeature>> = {
|
|
|
437
463
|
[AiStep.AssistRead]: AiFeature.Assist,
|
|
438
464
|
[AiStep.AssistPicture]: AiFeature.Assist,
|
|
439
465
|
[AiStep.AssistPictureReview]: AiFeature.Assist,
|
|
466
|
+
// The designer is site generation; whether a studio has it is the plan's `designer` switch (PlanFeature.Designer).
|
|
467
|
+
[AiStep.DesignConcepts]: AiFeature.SiteGeneration,
|
|
468
|
+
[AiStep.DesignDirection]: AiFeature.SiteGeneration,
|
|
469
|
+
[AiStep.DesignRevise]: AiFeature.SiteGeneration,
|
|
470
|
+
[AiStep.DesignCritique]: AiFeature.SiteGeneration,
|
|
440
471
|
};
|
|
441
472
|
|
|
442
473
|
export enum AiLimit {
|
|
@@ -2,7 +2,7 @@ import { ELEMENT_ACTION_DESCRIPTORS, POPUP_RULES, popupEnded, resolveActionAvail
|
|
|
2
2
|
import { CheckoutGateCode, CheckoutGateRefusal, labelIn } from '@vectoriox/iox-ui/commerce-core';
|
|
3
3
|
import { PopupArrive, PopupForm, popupFormOf, PopupRole, PopupTrait, ShopRole } from '@vectoriox/iox-ui/composite-core';
|
|
4
4
|
import { isNumberedPlaceholderTitle } from '@vectoriox/iox-ui/data-core';
|
|
5
|
-
import { auditDesignContrast, colorSchemeOf, ContrastTree, DesignTokenLike, isDecorativeImage, renderedContrastFindings } from '@vectoriox/iox-ui/design-core';
|
|
5
|
+
import { auditDesignContrast, colorSchemeOf, ContrastTree, DesignTokenLike, isDecorativeImage, renderedContrastFindings, scrimLayerFindings } from '@vectoriox/iox-ui/design-core';
|
|
6
6
|
import { ConsentActionType } from '@vectoriox/iox-ui/composite-core';
|
|
7
7
|
import { collectFormSpec, FORM_CHANNEL_ROLE, FORM_NODE_TYPE, isChannelFilled } from '@vectoriox/iox-ui/forms-core';
|
|
8
8
|
|
|
@@ -604,8 +604,10 @@ function checkAccessibility(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: Readon
|
|
|
604
604
|
}
|
|
605
605
|
const rendered = renderedTrees(snapshot);
|
|
606
606
|
for (const mode of snapshot.design?.modes ?? []) {
|
|
607
|
-
// AD0 A6: only the pairs the site's pages render — the sweep judges every pairing the look COULD make.
|
|
608
|
-
|
|
607
|
+
// AD0 A6: only the pairs the site's pages render — the sweep judges every pairing the look COULD make. iox-ui#211:
|
|
608
|
+
// and what stands over a scrim layer, over the scrim.
|
|
609
|
+
const rows = snapshot.design!.rows;
|
|
610
|
+
const failing = renderedContrastFindings([...auditDesignContrast(rows, mode), ...scrimLayerFindings(rows, mode)], rendered).filter(f => !f.pass);
|
|
609
611
|
if (failing.length) add(ctx, SiteFindingCode.LowContrast, { variant: mode, count: failing.length });
|
|
610
612
|
}
|
|
611
613
|
for (const page of pages) {
|
|
@@ -207,7 +207,7 @@ function slotOf(n: FreeNode, id: string, ctx: Ctx): SerializedNode[] {
|
|
|
207
207
|
const asked = (n.opts ?? []).filter(o => o && o !== FREE_OPEN_LIGHTBOX);
|
|
208
208
|
const words = [...LIST_SLOT_WORDS.filter(w => !asked.some(a => a.split(':')[0] === w.split(':')[0])), ...asked];
|
|
209
209
|
const mix = listMixFromWords(words, Object.keys(list.roles))!;
|
|
210
|
-
const frame = composeListFrame({ id: `${id}-list`, mix, source: slot.ref, list, locale, label: n.purpose ?? slot.ref, path: n.id, ...(ctx.o.motion ? { motion: ctx.o.motion } : {}) }).frame;
|
|
210
|
+
const frame = composeListFrame({ id: `${id}-list`, mix, source: slot.ref, list, locale, label: n.purpose ?? slot.ref, path: n.id, flow: true, ...(ctx.o.motion ? { motion: ctx.o.motion } : {}) }).frame;
|
|
211
211
|
if (!(n.opts ?? []).includes(FREE_OPEN_LIGHTBOX)) return [frame];
|
|
212
212
|
const image = list.roles[IMAGE_ROLE];
|
|
213
213
|
const lightbox = image ? composeListLightbox(`${id}-lightbox`, frame, slot.ref, image, locale, list.roles[TITLE_ROLE]) : null;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from '@vectoriox/iox-ui/composite-core';
|
|
6
6
|
|
|
7
7
|
import { ColorScheme, DesignChoices, LIST_MIX_PROP, LinkType, scrubOfChoices, setColorScheme, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
|
|
8
|
-
import { SCENE_LAND_TRIGGER, SCENE_TRACK_EASE, SceneEase, SceneProp, SceneRange, SceneRevealFrom, TextRevealBy } from '@vectoriox/iox-ui/scene-core';
|
|
8
|
+
import { mergeSceneTracks, SCENE_LAND_TRIGGER, SCENE_TRACK_EASE, SceneEase, SceneProp, SceneRange, SceneRevealFrom, TextRevealBy } from '@vectoriox/iox-ui/scene-core';
|
|
9
9
|
import { FORM_AFTER_SEND_TRAIT, FormAfterSend, FormPresetId } from '@vectoriox/iox-ui/forms-core';
|
|
10
10
|
import { composeNavHeader, composePresetForm } from './compose-site';
|
|
11
11
|
import { drawnHeaderMix, headerMixOfNavKind } from './header-mix';
|
|
@@ -251,6 +251,8 @@ const ZERO = '0px';
|
|
|
251
251
|
const RULE_PX = '1px';
|
|
252
252
|
const PHONE_GROUND_BRIGHTNESS = '0.75';
|
|
253
253
|
const GALLERY_BAR_TOP = '12px';
|
|
254
|
+
/** How a list the section's rows are sized by stands in them (iox-ui#207). */
|
|
255
|
+
const CONTENT_SIZED_ALIGN = 'start';
|
|
254
256
|
const STRETCH_KINDS: ReadonlySet<string> = new Set([LayoutLayerKind.Photo, LayoutLayerKind.Shape, LayoutLayerKind.Gallery, LayoutLayerKind.Form]);
|
|
255
257
|
const STACKED_EFFECTS: ReadonlySet<string> = new Set(['fade', 'cube', 'flip', 'cards']);
|
|
256
258
|
const SHADOW_UNDER_LIGHT = '0 1px 2px rgba(0,0,0,.55), 0 6px 34px rgba(0,0,0,.6)';
|
|
@@ -404,20 +406,110 @@ function isLight(colour: string | undefined, mode: LayoutColourMode): boolean {
|
|
|
404
406
|
return mode === LayoutColourMode.Light ? ground : !ground;
|
|
405
407
|
}
|
|
406
408
|
|
|
407
|
-
|
|
409
|
+
/** The plan's equal row. */
|
|
410
|
+
const EQUAL_ROW = 'minmax(0, 1fr)';
|
|
411
|
+
const gridTemplate = (count: number) => `repeat(${count}, ${EQUAL_ROW})`;
|
|
408
412
|
|
|
409
413
|
/** The grid a section's layers are placed on: 12 columns per screen between an outer track a side (the page's column,
|
|
410
|
-
* award §0c CW2 — `layoutGridColumns`), its rows. No inline padding: a bleed
|
|
411
|
-
|
|
414
|
+
* award §0c CW2 — `layoutGridColumns`), its rows (`sectionRows`, or the plan's equal rows). No inline padding: a bleed
|
|
415
|
+
* spans into an outer track. */
|
|
416
|
+
function gridLayout(rows: number | string, track: number): Record<string, string> {
|
|
412
417
|
return {
|
|
413
418
|
display: 'grid',
|
|
414
419
|
gridTemplateColumns: layoutGridColumns(track),
|
|
415
|
-
gridTemplateRows: gridTemplate(rows),
|
|
420
|
+
gridTemplateRows: typeof rows === 'number' ? gridTemplate(rows) : rows,
|
|
416
421
|
gap: `${ZERO} ${LAYOUT_COLUMN_GAP}`,
|
|
417
422
|
padding: ZERO,
|
|
418
423
|
};
|
|
419
424
|
}
|
|
420
425
|
|
|
426
|
+
/** The rows [first, end) the section's content-sized lists stand in, or null when it holds none. */
|
|
427
|
+
export function contentSizedBand(layers: ReadonlyArray<Pick<LayoutLayer, 'row'>>): [number, number] | null {
|
|
428
|
+
if (!layers.length) return null;
|
|
429
|
+
return [Math.min(...layers.map(l => l.row[0])), Math.max(...layers.map(l => l.row[1]))];
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* iox-ui#207: a laid section that holds a list grid is sized by its content. A list's height is its DATA's (how many
|
|
434
|
+
* items, at the card's aspect), never the plan's: the café's four dishes ended 1105 px above the bottom of a two-screen
|
|
435
|
+
* section, two empty screens at rest. So the rows the lists stand in are `auto` (as tall as the list), every other row
|
|
436
|
+
* keeps its planned share of the plan's screens, and the section is as tall as its rows (`height: auto`, min-height 0):
|
|
437
|
+
* a list of three is short, a list of twelve grows the section instead of being clipped. Null: the plan's equal rows.
|
|
438
|
+
*/
|
|
439
|
+
export function sectionRows(rows: number, screens: number, band: readonly [number, number] | null): string | null {
|
|
440
|
+
if (!band) return null;
|
|
441
|
+
const planned = plannedRow(screens, rows);
|
|
442
|
+
return joinTracks(Array.from({ length: rows }, (_, i) => (i + 1 >= band[0] && i + 1 < band[1] ? AUTO_ROW : planned)));
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
const AUTO_ROW = 'auto';
|
|
446
|
+
/** A row's planned share of the section's screens. */
|
|
447
|
+
const plannedRow = (screens: number, rows: number): string => `calc(${screens * 100}svh / ${rows})`;
|
|
448
|
+
|
|
449
|
+
/** Tracks as a `grid-template-rows` value, a run of equal tracks as one `repeat()`. */
|
|
450
|
+
function joinTracks(tracks: ReadonlyArray<string>): string {
|
|
451
|
+
const runs: Array<{ track: string; n: number }> = [];
|
|
452
|
+
for (const track of tracks) {
|
|
453
|
+
const last = runs[runs.length - 1];
|
|
454
|
+
if (last?.track === track) last.n++;
|
|
455
|
+
else runs.push({ track, n: 1 });
|
|
456
|
+
}
|
|
457
|
+
return runs.map(({ track, n }) => (n === 1 ? track : `repeat(${n}, ${track})`)).join(' ');
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/** A `grid-template-rows` value as one track per row (`repeat(n, x)` expanded); null when it is not a list of tracks
|
|
461
|
+
* this composer writes (`none`, a named area, a nested repeat). */
|
|
462
|
+
function splitTracks(value: string): string[] | null {
|
|
463
|
+
const tokens: string[] = [];
|
|
464
|
+
let depth = 0, buf = '';
|
|
465
|
+
for (const ch of value.trim()) {
|
|
466
|
+
if (ch === '(') depth++;
|
|
467
|
+
if (ch === ')') depth--;
|
|
468
|
+
if (/\s/.test(ch) && depth === 0) { if (buf) tokens.push(buf); buf = ''; continue; }
|
|
469
|
+
buf += ch;
|
|
470
|
+
}
|
|
471
|
+
if (buf) tokens.push(buf);
|
|
472
|
+
const out: string[] = [];
|
|
473
|
+
for (const t of tokens) {
|
|
474
|
+
const rep = /^repeat\(\s*(\d+)\s*,\s*(.+)\)$/.exec(t);
|
|
475
|
+
if (rep) { if (rep[2].includes('repeat(')) return null; for (let i = 0; i < Number(rep[1]); i++) out.push(rep[2].trim()); }
|
|
476
|
+
else if (t === 'none' || t.startsWith('[')) return null;
|
|
477
|
+
else out.push(t);
|
|
478
|
+
}
|
|
479
|
+
return out.length ? out : null;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const GRID_ROW = /^\s*(\d+)\s*\/\s*(\d+)\s*$/;
|
|
483
|
+
const SCREENS_HEIGHT = /^(\d+(?:\.\d+)?)svh$/;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* iox-ui#216: the section a recomposed list frame stands in, sized for it — the half of `composeListFrame` that is not the
|
|
487
|
+
* frame. A list re-mixed from a row slider to a grid (a Repeater, as tall as its data) needs the rows it stands in `auto`
|
|
488
|
+
* and the section `height: auto`, exactly as `composeLayout` lays a section composed with that grid (`sectionRows`); every
|
|
489
|
+
* other row keeps its planned share of the section's screens (an equal `1fr` row becomes `calc(<screens>svh / rows)`).
|
|
490
|
+
* `section` is the laid section (its grid is itself or its transition body); `frameId` the frame's id. A frame that is
|
|
491
|
+
* not content-sized, not in a grid cell, or a grid this composer did not write → the section unchanged. Pure.
|
|
492
|
+
*/
|
|
493
|
+
export function listSectionRows(section: SerializedNode, frameId: string, contentSized: boolean): SerializedNode {
|
|
494
|
+
if (!contentSized) return section;
|
|
495
|
+
const out = structuredClone(section);
|
|
496
|
+
const grid = [out, ...(out.children ?? [])].find(n => (n.children ?? []).some(c => c.id === frameId));
|
|
497
|
+
const frame = grid?.children?.find(c => c.id === frameId);
|
|
498
|
+
const cell = GRID_ROW.exec(String(frame?.styleProps?.['gridRow'] ?? ''));
|
|
499
|
+
const tracks = splitTracks(String(grid?.styleProps?.['gridTemplateRows'] ?? ''));
|
|
500
|
+
if (!grid || !frame || !cell || !tracks) return section;
|
|
501
|
+
const screens = SCREENS_HEIGHT.exec(String(out.styleProps?.['height'] ?? ''));
|
|
502
|
+
const share = screens ? plannedRow(Number(screens[1]) / 100, tracks.length) : null;
|
|
503
|
+
const [from, to] = [Number(cell[1]), Number(cell[2])];
|
|
504
|
+
const sized = tracks.map((t, i) => (i + 1 >= from && i + 1 < to ? AUTO_ROW : t === EQUAL_ROW && share ? share : t));
|
|
505
|
+
if (sized.some(t => t === EQUAL_ROW)) return section; // a 1fr row of a section with no screens to share: leave it
|
|
506
|
+
setStyleProps(grid, { gridTemplateRows: joinTracks(sized) });
|
|
507
|
+
setStyleProps(out, { height: 'auto' });
|
|
508
|
+
setStyleProps(frame, { alignSelf: CONTENT_SIZED_ALIGN });
|
|
509
|
+
return out;
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
|
|
421
513
|
/** The same grid on a phone: one column, in the section's `phone` order, with the M1.3 padding. */
|
|
422
514
|
function phoneStack(first: boolean): Record<string, string> {
|
|
423
515
|
return {
|
|
@@ -639,15 +731,23 @@ interface LayerCtx {
|
|
|
639
731
|
phoneAlign: string;
|
|
640
732
|
/** A drawer's word: it arrives as its step lands (`drawerArrival`), never by the layout's own entrance. */
|
|
641
733
|
arrivesOnLanding?: boolean;
|
|
734
|
+
/** The layer stands in normal flow (a free section's slot), not in a grid cell that gives it a height: what would
|
|
735
|
+
* fill its cell (a row's slider, a deck's holder) sits in flow at every width, as tall as its items (iox-ui#197). */
|
|
736
|
+
flow?: boolean;
|
|
737
|
+
/** Set by the list composer: the layer is a list laid as a Repeater (a grid, a wall, a round-two arrangement) — as
|
|
738
|
+
* tall as its DATA, so its rows are sized by it (iox-ui#207, `sectionRows`). */
|
|
739
|
+
contentSized?: boolean;
|
|
642
740
|
}
|
|
643
741
|
|
|
644
742
|
/** The node that sits on the grid: its cell, its stacking, its bleed and its tilt — and on a phone, its place in the stack. */
|
|
645
743
|
function place(node: SerializedNode, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): void {
|
|
646
|
-
|
|
744
|
+
// iox-ui#207: a list as tall as its data stands at the top of its rows and takes no height from them — what a
|
|
745
|
+
// recompose reads as "in flow" (`listFrameInFlow`), so a grid re-mixed to a row keeps its height in the auto rows.
|
|
746
|
+
const stretch = STRETCH_KINDS.has(l.kind) && !lc.contentSized;
|
|
647
747
|
const values: Record<string, unknown> = {
|
|
648
748
|
gridColumn: gridColumnOf(l),
|
|
649
749
|
gridRow: `${l.row[0]} / ${l.row[1]}`,
|
|
650
|
-
alignSelf: stretch ? 'stretch' : 'center',
|
|
750
|
+
alignSelf: lc.contentSized ? CONTENT_SIZED_ALIGN : stretch ? 'stretch' : 'center',
|
|
651
751
|
zIndex: String(1 + (l.z ?? 0)),
|
|
652
752
|
position: 'relative',
|
|
653
753
|
minWidth: ZERO,
|
|
@@ -1062,6 +1162,10 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
1062
1162
|
}
|
|
1063
1163
|
const masonry = arrange === LayoutListArrange.Masonry || arrange === LayoutListArrange.Hang;
|
|
1064
1164
|
const item = listItem(`${id}-item`, mix, source, list, masonry, lc.path, ctx, strips);
|
|
1165
|
+
// iox-ui#207: a list laid as a Repeater (strips, a grid, a wall, a round-two arrangement) is as tall as its rows of
|
|
1166
|
+
// DATA — the section sizes the rows it stands in by it. A slider or a deck fills the cell it is given.
|
|
1167
|
+
const slides = arrange === LayoutListArrange.Row || deck || (arrange === LayoutListArrange.Fan && mix.move.includes(LayoutListMove.Drag));
|
|
1168
|
+
if (!slides) lc.contentSized = true;
|
|
1065
1169
|
if (strips) return composeStrips(id, frame, item, mix, source, ctx, listItemRadius(mix));
|
|
1066
1170
|
// AW11-D16: drifting picture rows — the Marquee holding the list's pictures, twice.
|
|
1067
1171
|
if (mix.move.includes(LayoutListMove.Rows) && arrange === LayoutListArrange.Row && !lc.held) return composeDriftRows(id, frame, item, source, l);
|
|
@@ -1077,7 +1181,7 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
1077
1181
|
const shown = standout && !standWait && !deck ? standWrap(`${id}-stand`, item, standout) : item;
|
|
1078
1182
|
|
|
1079
1183
|
const fanDragged = arrange === LayoutListArrange.Fan && mix.move.includes(LayoutListMove.Drag);
|
|
1080
|
-
if (
|
|
1184
|
+
if (slides) {
|
|
1081
1185
|
const scrollPlays = mix.move.includes(LayoutListMove.Page) && !lc.held;
|
|
1082
1186
|
const played = scrollPlays || lc.held;
|
|
1083
1187
|
const drag = mix.move.includes(LayoutListMove.Drag);
|
|
@@ -1096,6 +1200,9 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
1096
1200
|
setStyleProps(slider, scrollPlays ? { width: FULL, height: FULL, minHeight: ZERO } : deck ? {
|
|
1097
1201
|
// A deck fills its holder (below); the cards behind show past its edges.
|
|
1098
1202
|
width: FULL, height: FULL, minHeight: ZERO, display: 'flex', flexDirection: 'column', overflow: 'visible',
|
|
1203
|
+
} : lc.flow ? {
|
|
1204
|
+
// iox-ui#197: in flow there is no cell to fill — `inset: 0` in a frame of no height drew the row 0 px tall.
|
|
1205
|
+
position: 'relative', width: FULL, height: 'auto', minHeight: ZERO, display: 'flex', flexDirection: 'column',
|
|
1099
1206
|
} : {
|
|
1100
1207
|
position: 'absolute', top: ZERO, right: ZERO, bottom: ZERO, left: ZERO, width: FULL, height: FULL, minHeight: ZERO,
|
|
1101
1208
|
display: 'flex', flexDirection: 'column',
|
|
@@ -1118,7 +1225,7 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
1118
1225
|
walkSerialized([slider], node => {
|
|
1119
1226
|
if (node.role === SliderRole.Prev || node.role === SliderRole.Next) node.props[LAYOUT_TOOLTIP_TRAIT] = node.props['ariaLabel'];
|
|
1120
1227
|
});
|
|
1121
|
-
frame.children = [oneWide ? deckHolder(`${id}-deck`, slider) : slider];
|
|
1228
|
+
frame.children = [oneWide ? deckHolder(`${id}-deck`, slider, !!lc.flow) : slider];
|
|
1122
1229
|
return frame;
|
|
1123
1230
|
}
|
|
1124
1231
|
|
|
@@ -1186,6 +1293,9 @@ export interface ListFrameInput {
|
|
|
1186
1293
|
readonly was?: LayoutListMix | null;
|
|
1187
1294
|
/** The id a NEW frame is made under (a free page's slot, FS3); default `list`. A recompose keeps `previous`'s. */
|
|
1188
1295
|
readonly id?: string;
|
|
1296
|
+
/** The frame stands in normal flow (a free section's slot), not in a layout's grid cell (iox-ui#197). Absent: a NEW
|
|
1297
|
+
* frame is a cell's; a recompose reads it from `previous` (`listFrameInFlow`). */
|
|
1298
|
+
readonly flow?: boolean;
|
|
1189
1299
|
}
|
|
1190
1300
|
|
|
1191
1301
|
/** A recomposed list frame, and what the composer said while composing it (a word drawn as its stand-in…). */
|
|
@@ -1195,6 +1305,9 @@ export interface ListFrame {
|
|
|
1195
1305
|
/** vectoriox/iox-ui#122 (BL-D8): every part of the card the owner changed — kept on the new card, or redrawn (said
|
|
1196
1306
|
* before Apply). Empty with no frame on the page. */
|
|
1197
1307
|
readonly edits: ReadonlyArray<ListPartEdit>;
|
|
1308
|
+
/** iox-ui#216: the new arrangement is as tall as its data (a Repeater: a grid, a wall, strips…) — the section it stands
|
|
1309
|
+
* in must size the rows it stands in by it (`listSectionRows`; `composeListInSection` does both). */
|
|
1310
|
+
readonly contentSized: boolean;
|
|
1198
1311
|
}
|
|
1199
1312
|
|
|
1200
1313
|
/** The frame styles the list composer owns (laptop and phone) beyond a new Container's own: a recompose replaces them
|
|
@@ -1211,17 +1324,33 @@ const LIST_FRAME_PROPS: ReadonlyArray<string> = [LIST_MIX_PROP, 'colorScheme'];
|
|
|
1211
1324
|
* arrangement, role, room and classes. Pure.
|
|
1212
1325
|
*/
|
|
1213
1326
|
export function composeListFrame(input: ListFrameInput, previous?: SerializedNode | null): ListFrame {
|
|
1327
|
+
if (input.flow === undefined && previous) input = { ...input, flow: listFrameInFlow(previous) };
|
|
1214
1328
|
const composed = composeListOnly(input, previous?.id ?? input.id ?? 'list');
|
|
1215
|
-
if (!previous) return { frame: composed.frame, gaps: composed.gaps, edits: [] };
|
|
1329
|
+
if (!previous) return { frame: composed.frame, gaps: composed.gaps, edits: [], contentSized: composed.contentSized };
|
|
1216
1330
|
// What the composer draws for the mix the frame wears now: anything else on the page is the owner's (#122).
|
|
1217
1331
|
const was = input.was ?? listMixOfFrame(previous, input.list);
|
|
1218
1332
|
const baseline = was ? composeListOnly({ ...input, mix: was }, previous.id).frame : null;
|
|
1219
1333
|
const kept = keepListParts(previous, baseline, composed.frame);
|
|
1220
|
-
return { frame: keepPlace(previous, { ...composed.frame, children: kept.children }), gaps: composed.gaps, edits: kept.edits };
|
|
1334
|
+
return { frame: keepPlace(previous, { ...composed.frame, children: kept.children }), gaps: composed.gaps, edits: kept.edits, contentSized: composed.contentSized };
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* iox-ui#216: recompose the list frame `frameId` INSIDE its laid section — the frame (`composeListFrame`) and the section's
|
|
1339
|
+
* rows for it (`listSectionRows`), the one call a re-mix applies, so a row slider re-mixed to a grid gets the rows a
|
|
1340
|
+
* section composed with that grid has. `list` is null (and the section unchanged) when the section holds no such frame.
|
|
1341
|
+
*/
|
|
1342
|
+
export function composeListInSection(section: SerializedNode, frameId: string, input: ListFrameInput): { section: SerializedNode; list: ListFrame | null } {
|
|
1343
|
+
let previous: SerializedNode | null = null;
|
|
1344
|
+
walkSerialized([section], n => { if (!previous && n.id === frameId) previous = n; });
|
|
1345
|
+
if (!previous) return { section, list: null };
|
|
1346
|
+
const list = composeListFrame(input, previous);
|
|
1347
|
+
const replaced = structuredClone(section);
|
|
1348
|
+
walkSerialized([replaced], n => { if (n.children) n.children = n.children.map(c => (c.id === frameId ? list.frame : c)); });
|
|
1349
|
+
return { section: listSectionRows(replaced, frameId, list.contentSized), list };
|
|
1221
1350
|
}
|
|
1222
1351
|
|
|
1223
1352
|
/** `composeList` for one frame under an id. */
|
|
1224
|
-
function composeListOnly(input: ListFrameInput, id: string): { frame: SerializedNode; gaps: ReadonlyArray<LayoutGap
|
|
1353
|
+
function composeListOnly(input: ListFrameInput, id: string): { frame: SerializedNode; gaps: ReadonlyArray<LayoutGap>; contentSized: boolean } {
|
|
1225
1354
|
const pace = LAYOUT_PACE[(input.motion?.pace ?? LayoutPace.Normal) as LayoutPace] ?? LAYOUT_PACE[LayoutPace.Normal];
|
|
1226
1355
|
const site = { locale: input.locale, sections: [], motion: input.motion } as unknown as LayoutSite;
|
|
1227
1356
|
const ctx = {
|
|
@@ -1234,8 +1363,9 @@ function composeListOnly(input: ListFrameInput, id: string): { frame: Serialized
|
|
|
1234
1363
|
const col = input.col ?? [1, 13];
|
|
1235
1364
|
const layer = { kind: LayoutLayerKind.Gallery, col: [col[0], col[1]], row: [1, 2], text: input.label, gallery: { slides: [], source: input.source, list: input.mix } } as unknown as LayoutLayer;
|
|
1236
1365
|
const path = input.path ?? 'list';
|
|
1237
|
-
const lc = { section: { ground: input.ground } as LayoutSection, si: 0, li: 0, path, held: !!input.held, track: 1, order: 0, phoneGap: 0, phoneAlign: 'start' } as LayerCtx;
|
|
1238
|
-
|
|
1366
|
+
const lc = { section: { ground: input.ground } as LayoutSection, si: 0, li: 0, path, held: !!input.held, track: 1, order: 0, phoneGap: 0, phoneAlign: 'start', flow: !!input.flow } as LayerCtx;
|
|
1367
|
+
const frame = composeList(id, layer, input.mix, input.source, input.list, lc, ctx);
|
|
1368
|
+
return { frame, gaps: ctx.gaps, contentSized: !!lc.contentSized };
|
|
1239
1369
|
}
|
|
1240
1370
|
|
|
1241
1371
|
/** The props a part's field is bound to when the card SHOWS it (an image's alt and an item's page link only follow). */
|
|
@@ -1280,6 +1410,14 @@ function keepPlace(previous: SerializedNode, composed: SerializedNode): Serializ
|
|
|
1280
1410
|
return frame;
|
|
1281
1411
|
}
|
|
1282
1412
|
|
|
1413
|
+
/** A list frame on the page stands in flow when no layout placed it in a grid cell (`place` writes its `gridRow`): a free
|
|
1414
|
+
* section's slot (iox-ui#197) — or when its cell gives it no height: a list the section's rows are sized by stands at
|
|
1415
|
+
* their top (iox-ui#207, `place`). A Container's own `gridRow` is `auto`. */
|
|
1416
|
+
export function listFrameInFlow(frame: SerializedNode): boolean {
|
|
1417
|
+
const row = frame.styleProps?.['gridRow'];
|
|
1418
|
+
return !row || row === 'auto' || frame.styleProps?.['alignSelf'] === CONTENT_SIZED_ALIGN;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1283
1421
|
/** The page that shows one item, as a composed list frame links to it (`linkToDetail`) — so a recompose keeps the link.
|
|
1284
1422
|
* Undefined when its items link nowhere (or to an address of their own). */
|
|
1285
1423
|
export function listDetailOf(frame: SerializedNode | null | undefined): LayoutListBinding['detail'] {
|
|
@@ -1304,9 +1442,13 @@ function listItemRadius(mix: LayoutListMix): string {
|
|
|
1304
1442
|
* scoped `.swiper { width: 100% }` out-ranks a node's width class. On a phone the holder is the cell's width and the
|
|
1305
1443
|
* shared `.swiper.swiper-cards` rule (iox-design.css) makes the deck a centred card with its neighbours peeking.
|
|
1306
1444
|
*/
|
|
1307
|
-
function deckHolder(id: string, slider: SerializedNode): SerializedNode {
|
|
1445
|
+
function deckHolder(id: string, slider: SerializedNode, flow: boolean): SerializedNode {
|
|
1308
1446
|
const holder = create(id, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1309
|
-
|
|
1447
|
+
// In flow (a free section's slot, iox-ui#197) the deck stands as tall as its cards; in a cell it fills the cell.
|
|
1448
|
+
setStyleProps(holder, flow ? {
|
|
1449
|
+
position: 'relative', width: LIST_DECK_WIDTH, maxWidth: FULL, height: 'auto', minHeight: ZERO, margin: '0px auto',
|
|
1450
|
+
display: 'flex', flexDirection: 'column',
|
|
1451
|
+
} : {
|
|
1310
1452
|
position: 'absolute', top: ZERO, right: ZERO, bottom: ZERO, left: ZERO, width: LIST_DECK_WIDTH, maxWidth: FULL, height: FULL,
|
|
1311
1453
|
minHeight: ZERO, margin: '0px auto', display: 'flex', flexDirection: 'column',
|
|
1312
1454
|
});
|
|
@@ -1589,8 +1731,10 @@ function composeLayer(l: LayoutLayer, lc: LayerCtx, ctx: Ctx): SerializedNode {
|
|
|
1589
1731
|
if (framed) tracks.push({ ...WINDOW_SINK, keys: WINDOW_SINK.keys.map(([at, v]): [number, number] => [at, v]) });
|
|
1590
1732
|
if (l.kinetic && textual) tracks.push({ prop: 'words', keys: [[0, 0], [KINETIC_ALL_LIT, 100]] });
|
|
1591
1733
|
if (tracks.length) {
|
|
1592
|
-
|
|
1593
|
-
|
|
1734
|
+
// A step's in and out are one timeline (iox-ui#195): stamped as one track, as the editor and both renderers read it.
|
|
1735
|
+
const merged = mergeSceneTracks(tracks);
|
|
1736
|
+
outer.sceneTracks = merged;
|
|
1737
|
+
outer.scenePhoneTracks = restingTracks(merged);
|
|
1594
1738
|
gap(ctx, LayoutGapCode.PhoneRest, lc.path, 'stands at rest on a phone');
|
|
1595
1739
|
}
|
|
1596
1740
|
} else if (l.motion?.length) {
|
|
@@ -1672,6 +1816,7 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
|
|
|
1672
1816
|
const order = Array.isArray(s.phone) && s.phone.length ? s.phone : s.layers.map((_, i) => i);
|
|
1673
1817
|
const textKinds = s.layers.filter(x => LAYOUT_TEXT_KINDS.has(x.kind) || x.kind === LayoutLayerKind.Button);
|
|
1674
1818
|
const phoneAlign = textKinds.length && textKinds.every(x => x.align === 'center') ? 'center' : 'start';
|
|
1819
|
+
const contentSized: LayoutLayer[] = [];
|
|
1675
1820
|
const layers = s.layers.map((l, li) => {
|
|
1676
1821
|
const at = order.indexOf(li);
|
|
1677
1822
|
const prevIdx = at > 0 ? order[at - 1] : -1;
|
|
@@ -1680,8 +1825,13 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
|
|
|
1680
1825
|
section: s, si, li, path: `sections[${si}].layers[${li}]`, held, track: held ? track : 1,
|
|
1681
1826
|
order: at < 0 ? s.layers.length + li : at, phoneGap: phoneGapBefore(visiblePrev, l), phoneAlign,
|
|
1682
1827
|
};
|
|
1683
|
-
|
|
1828
|
+
const node = composeLayer(l, lc, ctx);
|
|
1829
|
+
if (lc.contentSized) contentSized.push(l);
|
|
1830
|
+
return node;
|
|
1684
1831
|
});
|
|
1832
|
+
// iox-ui#207: a section holding a list grid is as tall as what it holds (a held stage is one screen — never).
|
|
1833
|
+
const rowsByContent = held ? null : sectionRows(s.rows, s.screens, contentSizedBand(contentSized));
|
|
1834
|
+
const sized = rowsByContent ? { height: 'auto' } : {};
|
|
1685
1835
|
|
|
1686
1836
|
const root = create(id, T.Section, {}, NO_ELEMENT_STYLE);
|
|
1687
1837
|
root.label = s.id;
|
|
@@ -1696,11 +1846,11 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
|
|
|
1696
1846
|
|
|
1697
1847
|
if (!held && transition) {
|
|
1698
1848
|
// The previous ground behind; the section's own ground and layers in its body, opened together.
|
|
1699
|
-
setStyleProps(root, { ...base, backgroundColor: transition.under, display: 'block', padding: ZERO, overflow: 'clip' });
|
|
1849
|
+
setStyleProps(root, { ...base, ...sized, backgroundColor: transition.under, display: 'block', padding: ZERO, overflow: 'clip' });
|
|
1700
1850
|
phone(root, { height: 'auto', backgroundColor: veilPaint(ground) });
|
|
1701
1851
|
const body = create(`${id}-body`, T.Container, {}, NO_ELEMENT_STYLE);
|
|
1702
1852
|
body.label = `${s.id} · ${s.transition}`;
|
|
1703
|
-
setStyleProps(body, { position: 'relative', width: FULL, height: FULL, minHeight: ZERO, backgroundColor: veilPaint(ground), ...gridLayout(s.rows, 1) });
|
|
1853
|
+
setStyleProps(body, { position: 'relative', width: FULL, height: FULL, minHeight: ZERO, backgroundColor: veilPaint(ground), ...gridLayout(rowsByContent ?? s.rows, 1) });
|
|
1704
1854
|
phone(body, phoneStack(si === 0));
|
|
1705
1855
|
body.interactions = [transition.clip];
|
|
1706
1856
|
body.children = layers;
|
|
@@ -1708,7 +1858,7 @@ function composeSection(s: LayoutSection, si: number, prevGround: string | null,
|
|
|
1708
1858
|
return root;
|
|
1709
1859
|
}
|
|
1710
1860
|
if (!held) {
|
|
1711
|
-
setStyleProps(root, { ...base, ...gridLayout(s.rows, 1), overflow: 'clip' });
|
|
1861
|
+
setStyleProps(root, { ...base, ...sized, ...gridLayout(rowsByContent ?? s.rows, 1), overflow: 'clip' });
|
|
1712
1862
|
phone(root, phoneStack(si === 0));
|
|
1713
1863
|
root.children = [...behind, ...layers];
|
|
1714
1864
|
return root;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AiTokenCounts, AiTokenPrice, costUsd } from './ai-run';
|
|
2
|
-
import { CRITIC_DESIGN_DIMENSIONS, CRITIC_DIMENSIONS, CriticAnswer, criticAnswerIssues, CriticDimension, CriticIssue, CriticIssueCode, criticVerdict } from './critic';
|
|
2
|
+
import { CRITIC_DESIGN_DIMENSIONS, CRITIC_DIMENSIONS, CriticAnswer, criticAnswerIssues, CriticDimension, CriticIssue, CriticIssueCode, criticVerdict, polishOf } from './critic';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* THE CRITIC'S CALIBRATION (ai-designer-plan §7 AD3, R-H8, R-H22, AD-D3): the critic scores the 12 calibration pages
|
|
@@ -14,6 +14,9 @@ import { CRITIC_DESIGN_DIMENSIONS, CRITIC_DIMENSIONS, CriticAnswer, criticAnswer
|
|
|
14
14
|
export const CALIBRATION_MAX_ERROR = 0.5;
|
|
15
15
|
/** AD-D3: how close the cheaper critic must stay to the dearer one for a round to switch to it. */
|
|
16
16
|
export const CRITIC_SWITCH_WITHIN = 0.3;
|
|
17
|
+
/** R-H22 (AD-D28): on the mean over the copy/distinct pairs, the copy may score at most this much above the distinct pages —
|
|
18
|
+
* one half point on one dimension moves a design mean by 0.07, so a strict ≤ failed on a tie the tester scored alike. */
|
|
19
|
+
export const R_H22_TOLERANCE = 0.25;
|
|
17
20
|
|
|
18
21
|
export enum CalibrationKind {
|
|
19
22
|
/** A page of the designer-loop proof (law, hotel). */
|
|
@@ -81,12 +84,25 @@ export interface LikenessProbe {
|
|
|
81
84
|
distinct: string;
|
|
82
85
|
}
|
|
83
86
|
|
|
87
|
+
/** R-H22 for one model: each pair's design means, their means, and the verdict (AD-D28). */
|
|
88
|
+
export interface LikenessVerdict {
|
|
89
|
+
model: string;
|
|
90
|
+
pairs: Array<LikenessProbe & { copyMean: number | null; distinctMean: number | null }>;
|
|
91
|
+
copyMean: number | null;
|
|
92
|
+
distinctMean: number | null;
|
|
93
|
+
passes: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
84
96
|
export interface CalibrationReport {
|
|
85
97
|
models: ModelCalibration[];
|
|
86
98
|
/** AD-D3: the cheaper critic against the dearer, page by page (absent unless both were asked). */
|
|
87
99
|
agreement?: { dearer: string; cheaper: string; meanDifference: number | null; within: boolean };
|
|
88
|
-
/** R-H22, per model:
|
|
89
|
-
|
|
100
|
+
/** R-H22, per model (AD-D28): over every copy/distinct pair, the copies' mean design mean at most `R_H22_TOLERANCE`
|
|
101
|
+
* above the distinct pages' — every pair answered, else it fails. The design mean, not the headline: a broken bug caps
|
|
102
|
+
* a headline at 5 whatever the page resembles, so a capped distinct page would fail the probe on polish, not on
|
|
103
|
+
* likeness (AD3 calibration: every R-H22 failure was law-services' 5.0 cap). The calibration set gains a pair each
|
|
104
|
+
* time AD4 produces a copy. */
|
|
105
|
+
likeness: LikenessVerdict[];
|
|
90
106
|
}
|
|
91
107
|
|
|
92
108
|
export interface CalibrationOptions {
|
|
@@ -123,7 +139,8 @@ function rowOf(page: CalibrationPage, recorded: RecordedCritique | undefined, op
|
|
|
123
139
|
if (issues.length) return { ...base, issues, criticMean: null, error: null, dimensionErrors: {}, criticHeadline: null, costUsd };
|
|
124
140
|
const answer = recorded.answer as CriticAnswer;
|
|
125
141
|
const verdict = criticVerdict(answer);
|
|
126
|
-
const
|
|
142
|
+
const scoreOf = (d: CriticDimension) => (d === CriticDimension.Polish ? polishOf(answer) : answer.scores[d].score);
|
|
143
|
+
const dimensionErrors = Object.fromEntries(CRITIC_DIMENSIONS.map(d => [d, scoreOf(d) - page.tester[d]])) as Record<CriticDimension, number>;
|
|
127
144
|
return { ...base, issues, criticMean: verdict.designMean, error: verdict.designMean - testerMean, dimensionErrors, criticHeadline: verdict.headline, costUsd };
|
|
128
145
|
}
|
|
129
146
|
|
|
@@ -165,11 +182,14 @@ export function calibrationReport(pages: ReadonlyArray<CalibrationPage>, answers
|
|
|
165
182
|
const meanDifference = both.length === pages.length ? mean(both) : null;
|
|
166
183
|
agreement = { ...options.compare, meanDifference, within: meanDifference !== null && meanDifference <= CRITIC_SWITCH_WITHIN };
|
|
167
184
|
}
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
const
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
|
|
185
|
+
const probes = options.likenessProbes ?? [];
|
|
186
|
+
const likeness: LikenessVerdict[] = probes.length ? models.map(m => {
|
|
187
|
+
const designMean = (id: string) => m.rows.find(r => r.pageId === id)?.criticMean ?? null;
|
|
188
|
+
const pairs = probes.map(probe => ({ ...probe, copyMean: designMean(probe.copy), distinctMean: designMean(probe.distinct) }));
|
|
189
|
+
const answered = pairs.every(p => p.copyMean !== null && p.distinctMean !== null);
|
|
190
|
+
const copyMean = answered ? mean(pairs.map(p => p.copyMean!)) : null;
|
|
191
|
+
const distinctMean = answered ? mean(pairs.map(p => p.distinctMean!)) : null;
|
|
192
|
+
return { model: m.model, pairs, copyMean, distinctMean, passes: copyMean !== null && distinctMean !== null && copyMean <= distinctMean + R_H22_TOLERANCE };
|
|
193
|
+
}) : [];
|
|
174
194
|
return { models, agreement, likeness };
|
|
175
195
|
}
|