@vectoriox/iox-ui 5.124.0 → 5.126.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/assist-core/index.d.ts +289 -5
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs +408 -11
- package/fesm2022/vectoriox-iox-ui-assist-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +3375 -173
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +482 -0
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/generation-core/index.d.ts +2964 -158
- package/harness-core/index.d.ts +270 -0
- package/package.json +1 -1
- package/src/assist-core/assist-turn.ts +95 -2
- package/src/assist-core/brief.ts +4 -0
- package/src/assist-core/fields-schema.ts +21 -5
- package/src/assist-core/photo-drafts.ts +482 -0
- package/src/assist-core/public-api.ts +4 -1
- package/src/assist-core/surfaces.ts +28 -4
- package/src/generation-core/ai-run.ts +3 -0
- package/src/generation-core/check-list.ts +28 -9
- package/src/generation-core/compose-site.ts +8 -4
- package/src/generation-core/footer-mix.ts +67 -8
- package/src/generation-core/generation-tier.ts +103 -0
- package/src/generation-core/layout-language.ts +18 -0
- package/src/generation-core/public-api.ts +1 -0
- package/src/generation-core/site-plan.model.ts +17 -0
- package/src/generation-core/site-spec.generated.ts +3016 -24
- package/src/generation-core/validate-site-plan.ts +25 -7
- package/src/harness-core/harness-spec.generated.ts +482 -0
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
LayoutIssue, LayoutIssueCode, LayoutLayerKind, LayoutListArrange, LayoutListArrive, LayoutListHow, LayoutListHover, LayoutListItem, LayoutListMix,
|
|
3
3
|
LayoutListMove, LayoutListPhone, LayoutListShape, LayoutListWho, LayoutMendKind, LayoutPage,
|
|
4
4
|
} from './layout-language';
|
|
5
|
-
import { listMeaning } from './list-table';
|
|
5
|
+
import { listBuiltWords, listMeaning, listWait } from './list-table';
|
|
6
6
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -16,6 +16,8 @@ const R = SPEC_SITE_LAYOUT.list.rules;
|
|
|
16
16
|
const IMAGE = 'image';
|
|
17
17
|
const inList = (values: ReadonlyArray<string>, v: unknown): boolean => typeof v === 'string' && values.includes(v);
|
|
18
18
|
const enumValues = (e: object): string[] => Object.values(e);
|
|
19
|
+
/** The words a refusal names: the DRAWN ones only — a refusal is the model's next turn, and a waiting word is never offered. */
|
|
20
|
+
const allowed = (k: Parameters<typeof listBuiltWords>[0]): string => listBuiltWords(k).join(' | ');
|
|
19
21
|
const has = <T extends string>(list: ReadonlyArray<T>, v: string): boolean => (list as ReadonlyArray<string>).includes(v);
|
|
20
22
|
|
|
21
23
|
/** The words a repaired mix is said in (the brief and the owner read them). */
|
|
@@ -46,16 +48,16 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
|
|
|
46
48
|
|
|
47
49
|
// Values outside the contract are the model's to answer: nothing is repaired over a mix that is not a mix.
|
|
48
50
|
if (!mix || typeof mix !== 'object') return [{ code: LayoutIssueCode.Shape, path: at, message: 'a list section names its mix' }];
|
|
49
|
-
if (!inList(enumValues(LayoutListItem), mix.item)) refuse(LayoutIssueCode.Value, `${at}.item`,
|
|
50
|
-
if (!inList(enumValues(LayoutListArrange), mix.arrange)) refuse(LayoutIssueCode.Value, `${at}.arrange`,
|
|
51
|
-
if (!inList(enumValues(LayoutListArrive), mix.arrive)) refuse(LayoutIssueCode.Value, `${at}.arrive`,
|
|
52
|
-
if (!inList(enumValues(LayoutListPhone), mix.phone)) refuse(LayoutIssueCode.Value, `${at}.phone`,
|
|
51
|
+
if (!inList(enumValues(LayoutListItem), mix.item)) refuse(LayoutIssueCode.Value, `${at}.item`, allowed('item'));
|
|
52
|
+
if (!inList(enumValues(LayoutListArrange), mix.arrange)) refuse(LayoutIssueCode.Value, `${at}.arrange`, allowed('arrange'));
|
|
53
|
+
if (!inList(enumValues(LayoutListArrive), mix.arrive)) refuse(LayoutIssueCode.Value, `${at}.arrive`, allowed('arrive'));
|
|
54
|
+
if (!inList(enumValues(LayoutListPhone), mix.phone)) refuse(LayoutIssueCode.Value, `${at}.phone`, allowed('phone'));
|
|
53
55
|
if (!Array.isArray(mix.parts) || mix.parts.some(p => typeof p !== 'string')) refuse(LayoutIssueCode.Shape, `${at}.parts`, 'the roles each item shows');
|
|
54
|
-
if (!Array.isArray(mix.move) || mix.move.some(m => !inList(enumValues(LayoutListMove), m))) refuse(LayoutIssueCode.Value, `${at}.move`,
|
|
55
|
-
if (!Array.isArray(mix.hover) || mix.hover.some(h => !inList(enumValues(LayoutListHover), h))) refuse(LayoutIssueCode.Value, `${at}.hover`,
|
|
56
|
+
if (!Array.isArray(mix.move) || mix.move.some(m => !inList(enumValues(LayoutListMove), m))) refuse(LayoutIssueCode.Value, `${at}.move`, allowed('move'));
|
|
57
|
+
if (!Array.isArray(mix.hover) || mix.hover.some(h => !inList(enumValues(LayoutListHover), h))) refuse(LayoutIssueCode.Value, `${at}.hover`, allowed('hover'));
|
|
56
58
|
if (mix.standout !== undefined) {
|
|
57
|
-
if (!inList(enumValues(LayoutListWho), mix.standout?.who)) refuse(LayoutIssueCode.Value, `${at}.standout.who`,
|
|
58
|
-
if (mix.standout?.how !== undefined && !inList(enumValues(LayoutListHow), mix.standout.how)) refuse(LayoutIssueCode.Value, `${at}.standout.how`,
|
|
59
|
+
if (!inList(enumValues(LayoutListWho), mix.standout?.who)) refuse(LayoutIssueCode.Value, `${at}.standout.who`, allowed('who'));
|
|
60
|
+
if (mix.standout?.how !== undefined && !inList(enumValues(LayoutListHow), mix.standout.how)) refuse(LayoutIssueCode.Value, `${at}.standout.how`, allowed('how'));
|
|
59
61
|
}
|
|
60
62
|
if (refused.length || !shape) return refused;
|
|
61
63
|
|
|
@@ -66,6 +68,23 @@ export function checkList(mix: LayoutListMix, shape: LayoutListShape | null, lay
|
|
|
66
68
|
const next: LayoutListMix = structuredClone(mix);
|
|
67
69
|
const said: string[] = [];
|
|
68
70
|
const repair = (message: string) => said.push(message);
|
|
71
|
+
|
|
72
|
+
// A word the product draws in a later phase (the contract's list table, award AW0): drawn as its stand-in meanwhile,
|
|
73
|
+
// and said — first, so every rule below judges the mix the product will draw. The wire never offers one.
|
|
74
|
+
const waiting = (k: 'item' | 'arrange' | 'arrive' | 'move' | 'hover', w: string): string | null | undefined => {
|
|
75
|
+
const wait = listWait(k, w);
|
|
76
|
+
if (!wait) return undefined;
|
|
77
|
+
repair(`${k} "${w}" is drawn in ${wait.phase}: ${wait.drawnAs ? `"${wait.drawnAs}" meanwhile` : 'left out meanwhile'}`);
|
|
78
|
+
return wait.drawnAs;
|
|
79
|
+
};
|
|
80
|
+
for (const k of ['item', 'arrange', 'arrive'] as const) {
|
|
81
|
+
const stand = waiting(k, next[k]);
|
|
82
|
+
if (stand !== undefined) (next as unknown as Record<string, string>)[k] = stand ?? (k === 'arrive' ? LayoutListArrive.Together : k === 'item' ? LayoutListItem.Card : LayoutListArrange.Row);
|
|
83
|
+
}
|
|
84
|
+
for (const k of ['move', 'hover'] as const) {
|
|
85
|
+
const drawn = (next[k] as string[]).map(w => { const stand = waiting(k, w); return stand === undefined ? w : stand; }).filter((w): w is string => !!w);
|
|
86
|
+
(next as unknown as Record<string, string[]>)[k] = [...new Set(drawn)];
|
|
87
|
+
}
|
|
69
88
|
const roles = shape.roles as ReadonlyArray<string>;
|
|
70
89
|
const pictured = roles.includes(IMAGE);
|
|
71
90
|
|
|
@@ -26,7 +26,7 @@ import { recipeListBinds } from './recipe-fields';
|
|
|
26
26
|
import { assertStyleSlots, ComposeError, createSerializedNode, SerializedBinding, SerializedNode, setStyleProps, walkSerialized } from './serialized-node';
|
|
27
27
|
import { SitePlanSourceKind, ContentFieldControl, ContentFieldPlan,
|
|
28
28
|
ContentRole, ContentTypePlan, DataSourcePlan, DEFAULT_SITE_LOCALE, FactKey, FACT_KEYS, GlobalSlot, isRtlLocale, PagePlan, PageSectionPlan, PlanDataSourceMode,
|
|
29
|
-
PlanDataSourceType, RelativeOp, roleField, SiteLocale, SitePlan, SitePlanSource, SITE_FACT_LABELS, SiteBusiness,
|
|
29
|
+
PlanDataSourceType, RelativeOp, roleField, SiteLocale, SitePlan, SitePlanSource, SITE_FACT_LABELS, SiteBusiness, GenerationTier,
|
|
30
30
|
} from './site-plan.model';
|
|
31
31
|
import { assertValidSitePlan, nextSourceOf, routeParams } from './validate-site-plan';
|
|
32
32
|
import { MenuSide, NavRole, NavShape, planNavShape } from './nav-shape';
|
|
@@ -130,6 +130,8 @@ export interface ComposeContext {
|
|
|
130
130
|
photoAlt?: (photoId: string) => string;
|
|
131
131
|
/** A photo's shape (the inventory's); a `box:<shape>` id names its own. */
|
|
132
132
|
photoShape?: (photoId: string) => `${LayoutPhotoShape}` | undefined;
|
|
133
|
+
/** The tier the plan was made at (its generation's stored tier, AW-D23) — absent = Basic: at most two composed pages. */
|
|
134
|
+
tier?: `${GenerationTier}`;
|
|
133
135
|
}
|
|
134
136
|
|
|
135
137
|
/** Where a composed layout's photos are, as the server keeps them and the screens read them (M8 gate 2): id → address. */
|
|
@@ -140,10 +142,12 @@ export interface LayoutPhotoAddress {
|
|
|
140
142
|
}
|
|
141
143
|
|
|
142
144
|
/** The composer's context for a site whose layouts name photos: the year, and each photo's address, words and shape. */
|
|
143
|
-
export function composeContextOf(year: number, photos?: Readonly<Record<string, LayoutPhotoAddress
|
|
144
|
-
|
|
145
|
+
export function composeContextOf(year: number, photos?: Readonly<Record<string, LayoutPhotoAddress>>, tier?: `${GenerationTier}`): ComposeContext {
|
|
146
|
+
const tiered = tier ? { tier } : {};
|
|
147
|
+
if (!photos) return { year, ...tiered };
|
|
145
148
|
return {
|
|
146
149
|
year,
|
|
150
|
+
...tiered,
|
|
147
151
|
photoSrc: id => photos[id]?.url ?? '',
|
|
148
152
|
photoAlt: id => photos[id]?.alt ?? '',
|
|
149
153
|
photoShape: id => photos[id]?.shape as `${LayoutPhotoShape}` | undefined,
|
|
@@ -1501,7 +1505,7 @@ function composeLayoutPage(
|
|
|
1501
1505
|
* composer never repairs a plan. `context` carries what the composer may not read for itself (the year).
|
|
1502
1506
|
*/
|
|
1503
1507
|
export function composeSite(plan: SitePlan, context: ComposeContext): ComposedSite {
|
|
1504
|
-
assertValidSitePlan(plan);
|
|
1508
|
+
assertValidSitePlan(plan, context?.tier ? { tier: context.tier } : {});
|
|
1505
1509
|
if (!Number.isInteger(context?.year)) throw new ComposeError('composeSite needs the year (ComposeContext.year) — the composer reads no clock');
|
|
1506
1510
|
const placeholders: ComposedPlaceholder[] = [];
|
|
1507
1511
|
const issues: ComposeIssue[] = [];
|
|
@@ -24,22 +24,37 @@ export enum FooterIngredient {
|
|
|
24
24
|
Ground = 'ground',
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/** The words, by the table (a word that waits for its phase too — `footerWords` offers only the drawn ones). */
|
|
27
28
|
export enum FooterArrange {
|
|
28
29
|
Columns = 'columns',
|
|
29
30
|
Centred = 'centred',
|
|
30
31
|
Line = 'line',
|
|
32
|
+
Ruled = 'ruled',
|
|
33
|
+
ListBig = 'list-big',
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
export enum FooterHold {
|
|
34
37
|
Pages = 'pages',
|
|
35
38
|
Visit = 'visit',
|
|
36
39
|
Contact = 'contact',
|
|
40
|
+
Newsletter = 'newsletter',
|
|
41
|
+
Legal = 'legal',
|
|
42
|
+
Payments = 'payments',
|
|
43
|
+
Clock = 'clock',
|
|
44
|
+
Marquee = 'marquee',
|
|
45
|
+
Badges = 'badges',
|
|
46
|
+
Region = 'region',
|
|
47
|
+
Search = 'search',
|
|
37
48
|
}
|
|
38
49
|
|
|
39
50
|
export enum FooterClosing {
|
|
40
51
|
None = 'none',
|
|
41
52
|
Call = 'call',
|
|
42
53
|
Name = 'name',
|
|
54
|
+
Statement = 'statement',
|
|
55
|
+
Word = 'word',
|
|
56
|
+
Newsletter = 'newsletter',
|
|
57
|
+
NameAndAction = 'name-and-action',
|
|
43
58
|
}
|
|
44
59
|
|
|
45
60
|
export enum FooterGround {
|
|
@@ -47,6 +62,10 @@ export enum FooterGround {
|
|
|
47
62
|
Plain = 'plain',
|
|
48
63
|
Subtle = 'subtle',
|
|
49
64
|
Accent = 'accent',
|
|
65
|
+
Film = 'film',
|
|
66
|
+
Scene = 'scene',
|
|
67
|
+
Pattern = 'pattern',
|
|
68
|
+
Inset = 'inset',
|
|
50
69
|
}
|
|
51
70
|
|
|
52
71
|
/** One word per ingredient; `holds` several, in the table's order. */
|
|
@@ -62,22 +81,37 @@ export class FooterMixError extends Error {}
|
|
|
62
81
|
const INGREDIENTS = F.ingredients as unknown as Readonly<Record<string, ReadonlyArray<string>>>;
|
|
63
82
|
const MEANINGS = F.meanings as Readonly<Record<string, string>>;
|
|
64
83
|
const MANY: ReadonlyArray<string> = F.many;
|
|
84
|
+
/** A word the product does not draw yet (award-ingredients-plan.md AW0): the phase it waits for and the built word it is
|
|
85
|
+
* drawn as meanwhile (null: drawn without it). */
|
|
86
|
+
export interface FooterWait { phase: string; drawnAs: string | null }
|
|
87
|
+
const WAITS = F.waits as unknown as Readonly<Record<string, FooterWait>>;
|
|
65
88
|
|
|
66
89
|
/** The footer pattern a plan names when it names none the table knows (the Studio footer). */
|
|
67
90
|
export const DEFAULT_FOOTER_PATTERN = 'footer.three-column';
|
|
68
91
|
|
|
69
|
-
/**
|
|
70
|
-
export function
|
|
92
|
+
/** Every word of an ingredient in the table, waiting ones too. */
|
|
93
|
+
export function footerTableWords(ingredient: `${FooterIngredient}`): ReadonlyArray<string> {
|
|
71
94
|
return INGREDIENTS[ingredient] ?? [];
|
|
72
95
|
}
|
|
73
96
|
|
|
97
|
+
/** The wait of a word, or null when the product draws it. */
|
|
98
|
+
export function footerWait(ingredient: `${FooterIngredient}`, word: string): FooterWait | null {
|
|
99
|
+
return WAITS[`${ingredient}.${word}`] ?? null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The words an ingredient may take — the DRAWN ones, the only ones the wire, the brief and the mender offer
|
|
103
|
+
* (ingredients.md §3.3: offering a waiting word would put its stand-in on every site that asked for it). */
|
|
104
|
+
export function footerWords(ingredient: `${FooterIngredient}`): ReadonlyArray<string> {
|
|
105
|
+
return footerTableWords(ingredient).filter(w => !footerWait(ingredient, w));
|
|
106
|
+
}
|
|
107
|
+
|
|
74
108
|
/** What a word means, as the brief and the builder say it. */
|
|
75
109
|
export function footerMeaning(ingredient: `${FooterIngredient}`, word: string): string {
|
|
76
110
|
return MEANINGS[`${ingredient}.${word}`] ?? word;
|
|
77
111
|
}
|
|
78
112
|
|
|
79
113
|
/** A word list in the table's order, each once. */
|
|
80
|
-
const inOrder = (k: string, words: ReadonlyArray<string>): string[] =>
|
|
114
|
+
const inOrder = (k: string, words: ReadonlyArray<string>): string[] => footerTableWords(k as FooterIngredient).filter(w => words.includes(w));
|
|
81
115
|
|
|
82
116
|
/** A whole mix from part of one: what is not named is the default. Refuses a word the table lacks. */
|
|
83
117
|
export function footerMix(partial: Partial<FooterMix> = {}): FooterMix {
|
|
@@ -87,7 +121,7 @@ export function footerMix(partial: Partial<FooterMix> = {}): FooterMix {
|
|
|
87
121
|
if (!INGREDIENTS[k]) throw new FooterMixError(`no footer ingredient "${k}"`);
|
|
88
122
|
const words = typeof v === 'string' ? [v] : v as ReadonlyArray<string>;
|
|
89
123
|
if (MANY.includes(k) !== (typeof v !== 'string')) throw new FooterMixError(`a footer's ${k} is ${MANY.includes(k) ? 'a list of words' : 'one word'}`);
|
|
90
|
-
for (const w of words) if (!INGREDIENTS[k].includes(w)) throw new FooterMixError(`a footer's ${k} cannot be "${w}" (${
|
|
124
|
+
for (const w of words) if (!INGREDIENTS[k].includes(w)) throw new FooterMixError(`a footer's ${k} cannot be "${w}" (${footerWords(k as FooterIngredient).join(' · ')})`);
|
|
91
125
|
mix[k] = MANY.includes(k) ? inOrder(k, words) : words[0];
|
|
92
126
|
}
|
|
93
127
|
return mix as unknown as FooterMix;
|
|
@@ -113,9 +147,27 @@ export function footerMixWords(mix: FooterMix): string[] {
|
|
|
113
147
|
return Object.values(FooterIngredient).flatMap(k => (MANY.includes(k) ? mix[k] as ReadonlyArray<string> : [mix[k] as string]).map(w => `${k}:${w}`));
|
|
114
148
|
}
|
|
115
149
|
|
|
116
|
-
/** Every `<ingredient>:<word>` the wire may carry
|
|
150
|
+
/** Every `<ingredient>:<word>` the wire may carry: the drawn words only. */
|
|
117
151
|
export function footerWireWords(): string[] {
|
|
118
|
-
return Object.values(FooterIngredient).flatMap(k => footerWords(k).
|
|
152
|
+
return Object.values(FooterIngredient).flatMap(k => footerWords(k).map(w => `${k}:${w}`));
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** A mix as the product can draw it today: every waiting word drawn as its stand-in (a held block with none is left
|
|
156
|
+
* out), and the words that waited, for the check to say. A drawn mix comes back unchanged. Pure. */
|
|
157
|
+
export function drawnFooterMix(mix: FooterMix): { mix: FooterMix; waited: Array<{ ingredient: FooterIngredient; word: string } & FooterWait> } {
|
|
158
|
+
const waited: Array<{ ingredient: FooterIngredient; word: string } & FooterWait> = [];
|
|
159
|
+
const drawn = (k: FooterIngredient, w: string): string | null => {
|
|
160
|
+
const wait = footerWait(k, w);
|
|
161
|
+
if (!wait) return w;
|
|
162
|
+
waited.push({ ingredient: k, word: w, ...wait });
|
|
163
|
+
return wait.drawnAs;
|
|
164
|
+
};
|
|
165
|
+
const one = (k: FooterIngredient): string => drawn(k, mix[k] as string) ?? (F.defaults as unknown as FooterMix)[k] as string;
|
|
166
|
+
// In the table's order, so the words that waited are said as the table reads.
|
|
167
|
+
const arrange = one(FooterIngredient.Arrange);
|
|
168
|
+
const holds = inOrder(FooterIngredient.Holds, mix.holds.map(h => drawn(FooterIngredient.Holds, h)).filter((h): h is string => !!h));
|
|
169
|
+
const out = { arrange, holds, closing: one(FooterIngredient.Closing), ground: one(FooterIngredient.Ground) };
|
|
170
|
+
return { mix: waited.length ? out : mix, waited };
|
|
119
171
|
}
|
|
120
172
|
|
|
121
173
|
/** The words back into a mix: an ingredient not named is the default; a `holds` named is the whole list. Refuses an unknown
|
|
@@ -168,6 +220,8 @@ export enum FooterRepairCode {
|
|
|
168
220
|
NameTooLong = 'name-too-long',
|
|
169
221
|
/** Another site already wears this footer: the nearest free one (`distinctFooter`). */
|
|
170
222
|
Worn = 'worn',
|
|
223
|
+
/** A word the product draws in a later phase: drawn as its stand-in meanwhile (the table's `waits`). */
|
|
224
|
+
Waits = 'waits',
|
|
171
225
|
}
|
|
172
226
|
|
|
173
227
|
export interface FooterRepair {
|
|
@@ -195,8 +249,12 @@ const nameWidthEm = (ctx: FooterContext): number => textWidthEm(ctx.name, elemen
|
|
|
195
249
|
* The ONE judge of a footer mix: what the table's rules refuse is mended to the nearest mix that keeps them, and each mend
|
|
196
250
|
* is said. Never throws on a well-formed mix. Pure.
|
|
197
251
|
*/
|
|
198
|
-
export function checkFooter(
|
|
252
|
+
export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: FooterMix; repairs: FooterRepair[] } {
|
|
199
253
|
const repairs: FooterRepair[] = [];
|
|
254
|
+
const { mix, waited } = drawnFooterMix(given);
|
|
255
|
+
if (waited.length) {
|
|
256
|
+
repairs.push({ code: FooterRepairCode.Waits, said: waited.map(w => `the footer's ${w.ingredient} "${w.word}" is drawn in ${w.phase}: ${w.drawnAs ? `"${w.drawnAs}" meanwhile` : 'left out meanwhile'}`).join('; ') });
|
|
257
|
+
}
|
|
200
258
|
let holds = inOrder(FooterIngredient.Holds, mix.holds);
|
|
201
259
|
let closing = mix.closing;
|
|
202
260
|
if (mix.arrange === FooterArrange.Line) {
|
|
@@ -284,7 +342,8 @@ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
|
284
342
|
}
|
|
285
343
|
|
|
286
344
|
/** A footer mix as a pattern: what the composer stamps as the site's footer (global, after the page). Check it first. */
|
|
287
|
-
export function footerPattern(
|
|
345
|
+
export function footerPattern(given: FooterMix, ctx: FooterContext): SitePattern {
|
|
346
|
+
const mix = drawnFooterMix(given).mix;
|
|
288
347
|
const plain = mix.ground === FooterGround.Plain;
|
|
289
348
|
const call = mix.closing === FooterClosing.Call ? [mix.arrange === FooterArrange.Columns ? part('call') : centred(part('call'))] : [];
|
|
290
349
|
const name = mix.closing === FooterClosing.Name ? [closingName(ctx)] : [];
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { AI_COMPOSED_PAGES_ESTIMATED, AiFeature } from './ai-run';
|
|
2
|
+
import { GenerationTier, PagePlan, SitePlan, STAMPED_PAGE_ARCHETYPES } from './site-plan.model';
|
|
3
|
+
import { isPerItemPage } from './validate-site-plan';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The generation tier (award-ingredients-plan §0, AW-D23/AW-D24) — pure. A studio whose plan has `awardSites` builds at
|
|
7
|
+
* the award tier: the model composes every page that may be composed, not two, and a contract row marked
|
|
8
|
+
* `tier: 'award'` is offered to it alone. Basic is today's generation exactly. Read once, when a generation starts, and
|
|
9
|
+
* carried by the generation — never re-read mid-run, never written by the model.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export const DEFAULT_GENERATION_TIER: GenerationTier = GenerationTier.Basic;
|
|
13
|
+
|
|
14
|
+
/** The tier a studio's plan features give (the control plane's `features` map; absent or off = Basic). */
|
|
15
|
+
export function generationTierOf(features: Readonly<Record<string, boolean | undefined>> | null | undefined): GenerationTier {
|
|
16
|
+
return features?.[AiFeature.AwardSites] === true ? GenerationTier.Award : GenerationTier.Basic;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** A tier as stored (an older generation holds none) — anything but `award` is Basic. */
|
|
20
|
+
export function tierOf(stored: string | null | undefined): GenerationTier {
|
|
21
|
+
return stored === GenerationTier.Award ? GenerationTier.Award : GenerationTier.Basic;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The order the tiers open in: a row offered at a tier is offered at every tier above it. */
|
|
25
|
+
const TIER_RANK: Readonly<Record<GenerationTier, number>> = {
|
|
26
|
+
[GenerationTier.Basic]: 0,
|
|
27
|
+
[GenerationTier.Award]: 1,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/** A contract row that may be held for a tier (a word, a recipe, a table row) — no `tier` = every tier. */
|
|
31
|
+
export interface TieredRow {
|
|
32
|
+
readonly tier?: `${GenerationTier}` | null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** May a row of `rowTier` be offered to a build at `tier`? */
|
|
36
|
+
export function tierOffers(rowTier: `${GenerationTier}` | null | undefined, tier: `${GenerationTier}`): boolean {
|
|
37
|
+
return !rowTier || TIER_RANK[rowTier] <= TIER_RANK[tier];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The rows a build at `tier` is offered — the ONE word filter the plan wire, the layout wire and the checks apply once the
|
|
42
|
+
* contract's rows carry a `tier` (award-ingredients-plan R-H: a lower plan's site never wears an award-only word).
|
|
43
|
+
*/
|
|
44
|
+
export function offeredForTier<T extends TieredRow>(rows: ReadonlyArray<T>, tier: `${GenerationTier}`): T[] {
|
|
45
|
+
return rows.filter(row => tierOffers(row.tier, tier));
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** May this page be composed at the award tier: not a page per item, not a page type that is always stamped (AW-D24). */
|
|
49
|
+
export function composablePage(page: Pick<PagePlan, 'route' | 'template' | 'routeSource' | 'archetype'>): boolean {
|
|
50
|
+
return !isPerItemPage(page) && !(page.archetype && STAMPED_PAGE_ARCHETYPES.has(page.archetype));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The plan with the pages its tier composes marked `compose: true` — the generation decides, never the model.
|
|
55
|
+
* Basic (M8-G2-D3): Home is always composed and the model's own mark on one other page is kept, exactly as before.
|
|
56
|
+
* Award (AW-D24): every composable page is composed (home, about, services, a list's page, contact, a landing page)
|
|
57
|
+
* and no other — a page per item and a legal page stay stamped whatever the model wrote.
|
|
58
|
+
*/
|
|
59
|
+
export function withComposedPages(plan: SitePlan, tier: `${GenerationTier}`): SitePlan {
|
|
60
|
+
if (tier !== GenerationTier.Award) return { ...plan, pages: plan.pages.map(p => (p.isHome ? { ...p, compose: true } : p)) };
|
|
61
|
+
return {
|
|
62
|
+
...plan,
|
|
63
|
+
pages: plan.pages.map(p => {
|
|
64
|
+
if (composablePage(p)) return p.compose === true ? p : { ...p, compose: true };
|
|
65
|
+
if (p.compose === undefined) return p;
|
|
66
|
+
const { compose: _dropped, ...rest } = p;
|
|
67
|
+
return rest;
|
|
68
|
+
}),
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The award tier's start estimate counts this many composed pages — the plan is not written yet when a generation
|
|
74
|
+
* starts. A typical award site: home, about, services, a list's page, contact and one more. Once the plan is written the
|
|
75
|
+
* composing step is gated on the pages actually waiting (`composingShare`).
|
|
76
|
+
*/
|
|
77
|
+
export const AWARD_COMPOSED_PAGES_ESTIMATED = 6;
|
|
78
|
+
|
|
79
|
+
/** The composed pages a tier's start estimate counts. */
|
|
80
|
+
export const AI_COMPOSED_PAGES_BY_TIER: Readonly<Record<GenerationTier, number>> = {
|
|
81
|
+
[GenerationTier.Basic]: AI_COMPOSED_PAGES_ESTIMATED,
|
|
82
|
+
[GenerationTier.Award]: AWARD_COMPOSED_PAGES_ESTIMATED,
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/** `pages` composed pages as a share of the composing step's typical estimate (which covers `AI_COMPOSED_PAGES_ESTIMATED`). */
|
|
86
|
+
export function composedPagesShare(pages: number): number {
|
|
87
|
+
return pages / AI_COMPOSED_PAGES_ESTIMATED;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/** The composing step's share of a generation's start estimate, at a tier (Basic: exactly the whole step, as before). */
|
|
91
|
+
export function startComposingShare(tier: `${GenerationTier}`): number {
|
|
92
|
+
return composedPagesShare(AI_COMPOSED_PAGES_BY_TIER[tierOf(tier)]);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* What the composing step must find before it starts, as a share of its typical estimate: Basic is held to the whole
|
|
97
|
+
* step (as before — at most its two pages); Award counts every page waiting (AW-D24: the estimate follows the actual
|
|
98
|
+
* composed count). Credits running out mid-run still never fail a build (m8-gate2 §22).
|
|
99
|
+
*/
|
|
100
|
+
export function composingShare(waiting: number, tier: `${GenerationTier}`): number {
|
|
101
|
+
const share = composedPagesShare(waiting);
|
|
102
|
+
return tier === GenerationTier.Award ? share : Math.min(1, share);
|
|
103
|
+
}
|
|
@@ -168,9 +168,15 @@ export enum LayoutNavKind {
|
|
|
168
168
|
|
|
169
169
|
/** List ingredients (list-ingredients-plan.md §2): the seven choices a list section mixes. Held equal to the contract's
|
|
170
170
|
* `site.layout.list` by layout-language.spec. */
|
|
171
|
+
/** The list words, by the contract's table — a word that waits for its phase too (only `listBuiltWords` are offered;
|
|
172
|
+
* `checkList` draws a waiting one as its stand-in). */
|
|
171
173
|
export enum LayoutListItem {
|
|
172
174
|
Photo = 'photo',
|
|
173
175
|
Card = 'card',
|
|
176
|
+
TitleOnPhoto = 'title-on-photo',
|
|
177
|
+
Packshot = 'packshot',
|
|
178
|
+
ColourBlock = 'colour-block',
|
|
179
|
+
Numbered = 'numbered',
|
|
174
180
|
}
|
|
175
181
|
|
|
176
182
|
export enum LayoutListArrange {
|
|
@@ -179,6 +185,12 @@ export enum LayoutListArrange {
|
|
|
179
185
|
Masonry = 'masonry',
|
|
180
186
|
Strips = 'strips',
|
|
181
187
|
Deck = 'deck',
|
|
188
|
+
Hang = 'hang',
|
|
189
|
+
Bento = 'bento',
|
|
190
|
+
Rows = 'rows',
|
|
191
|
+
Stage = 'stage',
|
|
192
|
+
Fan = 'fan',
|
|
193
|
+
Tilted = 'tilted',
|
|
182
194
|
}
|
|
183
195
|
|
|
184
196
|
export enum LayoutListWho {
|
|
@@ -200,6 +212,7 @@ export enum LayoutListMove {
|
|
|
200
212
|
Drag = 'drag',
|
|
201
213
|
Auto = 'auto',
|
|
202
214
|
Page = 'page',
|
|
215
|
+
Rows = 'rows',
|
|
203
216
|
}
|
|
204
217
|
|
|
205
218
|
export enum LayoutListHover {
|
|
@@ -207,12 +220,17 @@ export enum LayoutListHover {
|
|
|
207
220
|
Open = 'open',
|
|
208
221
|
Zoom = 'zoom',
|
|
209
222
|
Dim = 'dim',
|
|
223
|
+
Swap = 'swap',
|
|
224
|
+
Unveil = 'unveil',
|
|
225
|
+
Fill = 'fill',
|
|
226
|
+
Tilt = 'tilt',
|
|
210
227
|
}
|
|
211
228
|
|
|
212
229
|
export enum LayoutListArrive {
|
|
213
230
|
Together = 'together',
|
|
214
231
|
OneByOne = 'one-by-one',
|
|
215
232
|
SlideIn = 'slide-in',
|
|
233
|
+
ClipUp = 'clip-up',
|
|
216
234
|
}
|
|
217
235
|
|
|
218
236
|
export enum LayoutListPhone {
|
|
@@ -27,6 +27,7 @@ export * from './plan-data';
|
|
|
27
27
|
export * from './showcase';
|
|
28
28
|
export * from './site-build-run';
|
|
29
29
|
export * from './ai-run';
|
|
30
|
+
export * from './generation-tier';
|
|
30
31
|
export * from './recipe-fields';
|
|
31
32
|
export * from './plan-derived';
|
|
32
33
|
export * from './shop-plan';
|
|
@@ -280,6 +280,23 @@ export interface PagePlan {
|
|
|
280
280
|
readonly layout?: LayoutPage;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
/**
|
|
284
|
+
* What a build is made at (award-ingredients-plan AW-D23): read from the studio's plan (`awardSites`), never from the
|
|
285
|
+
* model. Basic = today's generation exactly (Home + one page composed by the model); Award = the model composes most
|
|
286
|
+
* pages (AW-D24) and the award-only words are offered (each contract row's `tier`, filtered by `offeredForTier`).
|
|
287
|
+
*/
|
|
288
|
+
export enum GenerationTier {
|
|
289
|
+
Basic = 'basic',
|
|
290
|
+
Award = 'award',
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* The page types never composed on any tier (AW-D24): a page per item shows its item from patterns, a legal page is the
|
|
295
|
+
* owner's own words. `legal` joins the contract's page types with AW1 — named here so a legal page is never composed
|
|
296
|
+
* the day it lands.
|
|
297
|
+
*/
|
|
298
|
+
export const STAMPED_PAGE_ARCHETYPES: ReadonlySet<string> = new Set(['detail', 'legal']);
|
|
299
|
+
|
|
283
300
|
export enum GlobalSlot {
|
|
284
301
|
Header = 'header',
|
|
285
302
|
Footer = 'footer',
|