@vectoriox/iox-ui 5.196.0 → 5.198.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/composite-core/index.d.ts +19 -2
- package/data-core/index.d.ts +101 -2
- package/design-core/index.d.ts +183 -30
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +49 -10
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-data-core.mjs +192 -2
- package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +299 -74
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +2287 -528
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +3 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +32 -2
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +1454 -200
- package/harness-core/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/composite-core/header.ts +34 -1
- package/src/composite-core/slider-runtime.ts +16 -8
- package/src/data-core/placeholder-rows.ts +220 -0
- package/src/data-core/public-api.ts +2 -1
- package/src/design-core/brand.ts +58 -5
- package/src/design-core/contrast-audit.ts +49 -22
- package/src/design-core/design-apply.ts +34 -3
- package/src/design-core/flavor-fixtures.generated.ts +123 -123
- package/src/design-core/flavor-spec.generated.ts +44 -4
- package/src/design-core/flavor-tokens.ts +1 -1
- package/src/design-core/header-behaviour.ts +82 -15
- package/src/design-core/motion-language.ts +5 -14
- package/src/design-core/node-links.ts +34 -0
- package/src/design-core/preloader.ts +4 -5
- package/src/generation-core/audit-site.ts +10 -1
- package/src/generation-core/audit-words.ts +5 -0
- package/src/generation-core/body-mix.ts +40 -102
- package/src/generation-core/check-free.ts +26 -5
- package/src/generation-core/check-layout.ts +10 -4
- package/src/generation-core/check-list.ts +3 -25
- package/src/generation-core/colour-mix.ts +296 -0
- package/src/generation-core/compose-free.ts +40 -18
- package/src/generation-core/compose-site.ts +124 -22
- package/src/generation-core/footer-mix.ts +102 -54
- package/src/generation-core/free-fallback.ts +6 -4
- package/src/generation-core/free-opening.ts +57 -0
- package/src/generation-core/free-parts.ts +87 -0
- package/src/generation-core/free-slot-words.ts +30 -0
- package/src/generation-core/generation-tier.ts +6 -17
- package/src/generation-core/header-mix.ts +125 -4
- package/src/generation-core/item-fill.ts +42 -0
- package/src/generation-core/layout-drawers.ts +3 -2
- package/src/generation-core/layout-wire.ts +10 -16
- package/src/generation-core/list-panel.ts +3 -3
- package/src/generation-core/list-table.ts +5 -14
- package/src/generation-core/list-words.ts +2 -1
- package/src/generation-core/nav-shape.ts +45 -16
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/opening-mix.ts +16 -33
- package/src/generation-core/part-tier.ts +14 -0
- package/src/generation-core/plan-wire.ts +31 -43
- package/src/generation-core/public-api.ts +4 -0
- package/src/generation-core/site-build-run.ts +4 -0
- package/src/generation-core/site-spec.generated.ts +1127 -93
- package/src/generation-core/stock-search.ts +106 -18
- package/src/generation-core/type-led.ts +19 -4
- package/src/generation-core/validate-site-plan.ts +4 -5
- package/src/harness-core/run-compose-context.ts +3 -1
- package/styles/iox-design.css +139 -4
|
@@ -5,6 +5,7 @@ import { layoutRoomPx, screenFontSize, screenWordOverflowPx } from './layout-lan
|
|
|
5
5
|
import { PatternGlobalPosition, PatternNode, SITE_PATTERNS, SitePattern } from './patterns';
|
|
6
6
|
import { SPEC_SITE_FOOTER_PARTS, SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
7
7
|
import type { GenerationTier } from './site-plan.model';
|
|
8
|
+
import { tierOffers } from './part-tier';
|
|
8
9
|
|
|
9
10
|
/**
|
|
10
11
|
* FOOTER INGREDIENTS (list-ingredients-plan.md LI5): a site's footer is a MIX — an arrangement, the blocks it holds, how
|
|
@@ -35,6 +36,10 @@ export enum FooterArrange {
|
|
|
35
36
|
Line = 'line',
|
|
36
37
|
Ruled = 'ruled',
|
|
37
38
|
ListBig = 'list-big',
|
|
39
|
+
/** FV0 (footer-v2 §4): laid by the model from the parts as a free section (waits for FV2). */
|
|
40
|
+
Free = 'free',
|
|
41
|
+
/** FV0: two zones divided by a vertical hairline (allerstudio, thepopuphotel; waits for FV1). */
|
|
42
|
+
Halves = 'halves',
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
export enum FooterHold {
|
|
@@ -49,6 +54,12 @@ export enum FooterHold {
|
|
|
49
54
|
Badges = 'badges',
|
|
50
55
|
Region = 'region',
|
|
51
56
|
Search = 'search',
|
|
57
|
+
/** FV0: the owner's social links (waits for FV1 and the reading's links, FV-D10). */
|
|
58
|
+
Social = 'social',
|
|
59
|
+
/** FV0: a round back-to-top button (waits for FV1). */
|
|
60
|
+
Top = 'top',
|
|
61
|
+
/** FV0: the owner's picture and a chat button (waits for FV1). */
|
|
62
|
+
Chat = 'chat',
|
|
52
63
|
}
|
|
53
64
|
|
|
54
65
|
export enum FooterClosing {
|
|
@@ -59,6 +70,10 @@ export enum FooterClosing {
|
|
|
59
70
|
Word = 'word',
|
|
60
71
|
Newsletter = 'newsletter',
|
|
61
72
|
NameAndAction = 'name-and-action',
|
|
73
|
+
/** FV0: the email set large as the footer's opening line (mdscollective; waits for FV1). */
|
|
74
|
+
Email = 'email',
|
|
75
|
+
/** FV0: the name or a farewell line huge and faint behind the blocks (haven; waits for FV3). */
|
|
76
|
+
Behind = 'behind',
|
|
62
77
|
}
|
|
63
78
|
|
|
64
79
|
export enum FooterGround {
|
|
@@ -70,6 +85,12 @@ export enum FooterGround {
|
|
|
70
85
|
Scene = 'scene',
|
|
71
86
|
Pattern = 'pattern',
|
|
72
87
|
Inset = 'inset',
|
|
88
|
+
/** FV0: the owner's photo, dimmed (waits for FV3). */
|
|
89
|
+
Photo = 'photo',
|
|
90
|
+
/** FV0: the colour's gradient wash (waits for FV3 with colour-v2 CV3). */
|
|
91
|
+
Gradient = 'gradient',
|
|
92
|
+
/** FV0: a ruled box inside the page frame (damaria; waits for FV1). */
|
|
93
|
+
Framed = 'framed',
|
|
73
94
|
}
|
|
74
95
|
|
|
75
96
|
export enum FooterNameStyle {
|
|
@@ -77,6 +98,8 @@ export enum FooterNameStyle {
|
|
|
77
98
|
Gradient = 'gradient',
|
|
78
99
|
Emboss = 'emboss',
|
|
79
100
|
Offset = 'offset',
|
|
101
|
+
/** FV0: the closing name in the look's script face (waits for TYPE's third family, AW13). */
|
|
102
|
+
Script = 'script',
|
|
80
103
|
}
|
|
81
104
|
|
|
82
105
|
/** The roles a footer's parts carry — the contract's (`site.footerParts` and the stored footers), written to the node's
|
|
@@ -99,6 +122,10 @@ export enum FooterRole {
|
|
|
99
122
|
Ruled = 'footer.ruled',
|
|
100
123
|
/** AW12 `arrange.list-big`: the pages stacked large. */
|
|
101
124
|
ListBig = 'footer.list-big',
|
|
125
|
+
/** FV1 `arrange.halves`: two zones (the brand · the blocks) divided by a vertical hairline (iox-design.css). */
|
|
126
|
+
Halves = 'footer.halves',
|
|
127
|
+
/** FV1 `closing.email`: the owner's email set large, the contact link. */
|
|
128
|
+
Email = 'footer.email',
|
|
102
129
|
}
|
|
103
130
|
|
|
104
131
|
|
|
@@ -136,10 +163,20 @@ export function footerWait(ingredient: `${FooterIngredient}`, word: string): Foo
|
|
|
136
163
|
return WAITS[`${ingredient}.${word}`] ?? null;
|
|
137
164
|
}
|
|
138
165
|
|
|
166
|
+
/**
|
|
167
|
+
* FV0 (FV-D9, vectoriox/iox-ai-guidance#2): blocks a footer holds that are no part of it — the legal row is stamped after
|
|
168
|
+
* EVERY footer by compose-site `legalRow` (`rules.legalAlways`), whether a mix names it or not. A mix may name it (stored
|
|
169
|
+
* mixes, the references); the recipe never looks for its part and the wire never offers it (there is no choice to make).
|
|
170
|
+
*/
|
|
171
|
+
export const FOOTER_ROW_HOLDS: ReadonlySet<string> = new Set(F.rules.legalAlways ? [FooterHold.Legal] : []);
|
|
172
|
+
/** The blocks of a mix the recipe lays as parts (the legal row is compose-site's). */
|
|
173
|
+
const partHolds = (holds: ReadonlyArray<string>): string[] => holds.filter(h => !FOOTER_ROW_HOLDS.has(h));
|
|
174
|
+
|
|
139
175
|
/** The words an ingredient may take — the DRAWN ones, the only ones the wire, the brief and the mender offer
|
|
140
|
-
* (ingredients.md §3.3: offering a waiting word would put its stand-in on every site that asked for it).
|
|
176
|
+
* (ingredients.md §3.3: offering a waiting word would put its stand-in on every site that asked for it). The legal row
|
|
177
|
+
* is drawn on every footer, so it is never offered as a choice (`FOOTER_ROW_HOLDS`). */
|
|
141
178
|
export function footerWords(ingredient: `${FooterIngredient}`): ReadonlyArray<string> {
|
|
142
|
-
return footerTableWords(ingredient).filter(w => !footerWait(ingredient, w));
|
|
179
|
+
return footerTableWords(ingredient).filter(w => !footerWait(ingredient, w) && !(ingredient === FooterIngredient.Holds && FOOTER_ROW_HOLDS.has(w)));
|
|
143
180
|
}
|
|
144
181
|
|
|
145
182
|
/** What a word means, as the brief and the builder say it. */
|
|
@@ -257,17 +294,14 @@ export function footerFaceOf(footer: FooterMix | string): string {
|
|
|
257
294
|
return `${FOOTER_TOKEN}:${at(FooterIngredient.Arrange)}/${at(FooterIngredient.Closing)}`;
|
|
258
295
|
}
|
|
259
296
|
|
|
260
|
-
/**
|
|
297
|
+
/** The tier a word was first drawn for (`all`, or `pro` — AW-D23 / AW12-D13); since AW-D42 every tier wears both. */
|
|
261
298
|
export function footerWordTier(ingredient: `${FooterIngredient}`, word: string): 'all' | 'pro' {
|
|
262
299
|
return (F.tiers as Readonly<Record<string, string>>)[`${ingredient}.${word}`] === 'pro' ? 'pro' : 'all';
|
|
263
300
|
}
|
|
264
301
|
|
|
265
|
-
/**
|
|
266
|
-
const AWARD = 'award' as `${GenerationTier}`;
|
|
267
|
-
|
|
268
|
-
/** May a footer at `tier` wear this word? No tier named: every drawn word (as before the tier was asked). */
|
|
302
|
+
/** May a footer at `tier` wear this word? Every tier wears every drawn word (AW-D42, `tierOffers`). */
|
|
269
303
|
export function footerWordOffered(ingredient: `${FooterIngredient}`, word: string, tier?: `${GenerationTier}`): boolean {
|
|
270
|
-
return
|
|
304
|
+
return tierOffers(footerWordTier(ingredient, word), tier);
|
|
271
305
|
}
|
|
272
306
|
|
|
273
307
|
/** A footer token in words: `footer:columns/none/inverse` → "columns · none · inverse". */
|
|
@@ -312,9 +346,11 @@ export enum FooterRepairCode {
|
|
|
312
346
|
/** AW12-D10 (H1): a word the kind of business never closes with or stands on (harness FOOTER_NEVER): the call · the
|
|
313
347
|
* dark band. */
|
|
314
348
|
TypeNever = 'type-never',
|
|
315
|
-
/**
|
|
316
|
-
|
|
317
|
-
|
|
349
|
+
/** FV1: the email closing is the owner's own address — none given (or too wide for a phone): no closing. */
|
|
350
|
+
EmailWithoutAddress = 'email-without-address',
|
|
351
|
+
EmailTooLong = 'email-too-long',
|
|
352
|
+
/** FV1: halves need a block in the end zone — none held: drawn as columns. */
|
|
353
|
+
HalvesEmpty = 'halves-empty',
|
|
318
354
|
}
|
|
319
355
|
|
|
320
356
|
export interface FooterRepair {
|
|
@@ -349,8 +385,10 @@ export interface FooterContext {
|
|
|
349
385
|
locale?: string;
|
|
350
386
|
/** AW12-D10: what this kind of business's footer never wears (absent = nothing refused). */
|
|
351
387
|
never?: FooterNever | null;
|
|
352
|
-
/**
|
|
353
|
-
|
|
388
|
+
/** FV1 `closing.email`: the owner's email (the plan's `facts.email`) — none given, the footer never closes with one. */
|
|
389
|
+
email?: string;
|
|
390
|
+
/** The tier the site is built at. Since AW-D42 it mends no word (every tier wears every drawn word); kept so its
|
|
391
|
+
* callers still read. */
|
|
354
392
|
tier?: `${GenerationTier}`;
|
|
355
393
|
}
|
|
356
394
|
|
|
@@ -426,32 +464,6 @@ export const footerNameFits = (ctx: FooterContext): boolean => !overflowsPhone(n
|
|
|
426
464
|
const an = (word: string): string => `${/^[aeiou]/.test(word) ? 'an' : 'a'} ${word}`;
|
|
427
465
|
const capital = (said: string): string => said.charAt(0).toUpperCase() + said.slice(1);
|
|
428
466
|
|
|
429
|
-
/** The ingredients a footer wears one word of — the ones a tier may mend to the table's default. */
|
|
430
|
-
const ONE_WORD: ReadonlyArray<FooterIngredient> = [FooterIngredient.Arrange, FooterIngredient.Closing, FooterIngredient.Ground, FooterIngredient.NameStyle];
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* AW12-D13 (iox-ui#153): the mix as `tier` may wear it — a word the award tier alone wears becomes the table's default
|
|
434
|
-
* (a held block is left out), each said. No tier, or the award tier: the mix as it is. Pure.
|
|
435
|
-
*/
|
|
436
|
-
export function footerAtTier(mix: FooterMix, tier?: `${GenerationTier}`): { mix: FooterMix; said: string[] } {
|
|
437
|
-
if (!tier || tier === AWARD) return { mix, said: [] };
|
|
438
|
-
const said: string[] = [];
|
|
439
|
-
const out: Record<string, string | ReadonlyArray<string>> = { ...mix };
|
|
440
|
-
const defaults = F.defaults as unknown as Readonly<Record<string, string>>;
|
|
441
|
-
for (const k of ONE_WORD) {
|
|
442
|
-
const word = mix[k as keyof FooterMix] as string | undefined;
|
|
443
|
-
if (!word || footerWordOffered(k, word, tier)) continue;
|
|
444
|
-
out[k] = defaults[k];
|
|
445
|
-
said.push(`"${footerMeaning(k, word)}" comes with the award plan: ${footerMeaning(k, defaults[k])} instead`);
|
|
446
|
-
}
|
|
447
|
-
const left = mix.holds.filter(h => !footerWordOffered(FooterIngredient.Holds, h, tier));
|
|
448
|
-
if (left.length) {
|
|
449
|
-
out[FooterIngredient.Holds] = mix.holds.filter(h => !left.includes(h));
|
|
450
|
-
said.push(`${left.map(h => `"${footerMeaning(FooterIngredient.Holds, h)}"`).join(' and ')} ${left.length > 1 ? 'come' : 'comes'} with the award plan: left out`);
|
|
451
|
-
}
|
|
452
|
-
return { mix: out as unknown as FooterMix, said };
|
|
453
|
-
}
|
|
454
|
-
|
|
455
467
|
/**
|
|
456
468
|
* 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
|
|
457
469
|
* is said. Never throws on a well-formed mix. Pure.
|
|
@@ -463,10 +475,7 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
|
|
|
463
475
|
if (drawn.waited.length) {
|
|
464
476
|
say(FooterRepairCode.Waits, drawn.waited.map(w => `the footer's ${w.ingredient} "${w.word}" is drawn in ${w.phase}: ${w.drawnAs ? `"${w.drawnAs}" meanwhile` : 'left out meanwhile'}`).join('; '));
|
|
465
477
|
}
|
|
466
|
-
|
|
467
|
-
const atTier = footerAtTier(drawn.mix, ctx.tier);
|
|
468
|
-
for (const said of atTier.said) say(FooterRepairCode.ProOnly, said);
|
|
469
|
-
const mix = atTier.mix;
|
|
478
|
+
const mix = drawn.mix;
|
|
470
479
|
let holds = inOrder(FooterIngredient.Holds, mix.holds);
|
|
471
480
|
let closing = mix.closing;
|
|
472
481
|
let arrange = mix.arrange;
|
|
@@ -501,6 +510,17 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
|
|
|
501
510
|
say(FooterRepairCode.WordTooLong, `"${footerCallWord(ctx.type, ctx.locale)}" is too wide for a phone even on two lines: the footer closes with a call`);
|
|
502
511
|
closing = FooterClosing.Call;
|
|
503
512
|
}
|
|
513
|
+
if (closing === FooterClosing.Email) {
|
|
514
|
+
// FV1 (rule 3, footer-v2 §4): the address is the owner's fact, never made up and never a placeholder.
|
|
515
|
+
const email = ctx.email?.trim();
|
|
516
|
+
if (!email) {
|
|
517
|
+
say(FooterRepairCode.EmailWithoutAddress, 'the email closing is the owner\'s own address and none was given: no closing');
|
|
518
|
+
closing = FooterClosing.None;
|
|
519
|
+
} else if (overflowsPhone(widthEm(email, ctx, 'link-display'), ctx)) {
|
|
520
|
+
say(FooterRepairCode.EmailTooLong, `"${email}" does not fit a phone even at the smallest size: no closing`);
|
|
521
|
+
closing = FooterClosing.None;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
504
524
|
if (closing === FooterClosing.Name && !footerNameFits(ctx)) {
|
|
505
525
|
say(FooterRepairCode.NameTooLong, `"${ctx.name}" is too long to stand across a phone: the footer closes with nothing`);
|
|
506
526
|
closing = FooterClosing.None;
|
|
@@ -511,8 +531,8 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
|
|
|
511
531
|
holds = holds.filter(h => END_HOLDS.includes(h));
|
|
512
532
|
if (!footerNameFits(ctx)) say(FooterRepairCode.NameTooLong, `"${ctx.name}" is too long to stand across a phone: the action stays, the name is left out`);
|
|
513
533
|
}
|
|
514
|
-
if (arrange === FooterArrange.Ruled && holds.length + 1 < rule('ruledMinBlocks')) {
|
|
515
|
-
say(FooterRepairCode.RuledFewBlocks, `ruled cells need company and the footer holds ${holds.length + 1} block${holds.length ? 's' : ''}: drawn as columns`);
|
|
534
|
+
if (arrange === FooterArrange.Ruled && partHolds(holds).length + 1 < rule('ruledMinBlocks')) {
|
|
535
|
+
say(FooterRepairCode.RuledFewBlocks, `ruled cells need company and the footer holds ${partHolds(holds).length + 1} block${partHolds(holds).length ? 's' : ''}: drawn as columns`);
|
|
516
536
|
arrange = FooterArrange.Columns;
|
|
517
537
|
}
|
|
518
538
|
if (arrange === FooterArrange.ListBig && ctx.pages !== undefined && ctx.pages > rule('listBigPages')) {
|
|
@@ -527,9 +547,13 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
|
|
|
527
547
|
say(FooterRepairCode.EmbossNeedsBrand, `${capital(an(nameStyle))} name is a copy of the name the brand block says, and this footer has none: plain`);
|
|
528
548
|
nameStyle = FooterNameStyle.Plain;
|
|
529
549
|
}
|
|
530
|
-
if (
|
|
550
|
+
if (arrange === FooterArrange.Halves && !partHolds(holds).length) {
|
|
551
|
+
say(FooterRepairCode.HalvesEmpty, 'halves need a block beside the name and the footer holds none: drawn as columns');
|
|
552
|
+
arrange = FooterArrange.Columns;
|
|
553
|
+
}
|
|
554
|
+
if (partHolds(holds).length < F.rules.minHolds && closing === FooterClosing.None) {
|
|
531
555
|
say(FooterRepairCode.Empty, 'a footer that holds nothing holds the pages');
|
|
532
|
-
holds = [FooterHold.Pages];
|
|
556
|
+
holds = inOrder(FooterIngredient.Holds, [FooterHold.Pages, ...holds]);
|
|
533
557
|
}
|
|
534
558
|
return { mix: { ...mix, holds, closing, arrange, nameStyle, ground }, repairs };
|
|
535
559
|
}
|
|
@@ -600,6 +624,12 @@ function callPart(ctx: FooterContext): PatternNode {
|
|
|
600
624
|
return { ...node, c: (node.c ?? []).map(n => (n.slot === 'closing' ? { ...n, text: line, ...(lineHe ? { textHe: lineHe } : {}) } : n)) };
|
|
601
625
|
}
|
|
602
626
|
|
|
627
|
+
/** The email closing (FV1 `closing.email`): the part's link, its words the owner's address (the fact), fitted to the
|
|
628
|
+
* column as the call word is. */
|
|
629
|
+
function emailLine(email: string, ctx: FooterContext): PatternNode {
|
|
630
|
+
return laid(part('email'), { fontSize: columnSize(widthEm(email, ctx, 'link-display'), ctx) });
|
|
631
|
+
}
|
|
632
|
+
|
|
603
633
|
/** A block it holds: how to reach the business leaves its city to the visit block when the footer holds both. */
|
|
604
634
|
function holdPart(hold: string, mix: FooterMix): PatternNode {
|
|
605
635
|
const node = part(hold);
|
|
@@ -622,7 +652,7 @@ function bigPages(ctx: FooterContext): PatternNode[] {
|
|
|
622
652
|
|
|
623
653
|
/** The body: the blocks it holds, arranged. */
|
|
624
654
|
function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
625
|
-
const holds = mix.holds.map(h => holdPart(h, mix));
|
|
655
|
+
const holds = partHolds(mix.holds).map(h => holdPart(h, mix));
|
|
626
656
|
switch (mix.arrange) {
|
|
627
657
|
case FooterArrange.Line: {
|
|
628
658
|
const row: PatternNode = { t: 'Container', es: 'box', lay: { display: 'flex', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'space-between', gap: GAP }, c: [
|
|
@@ -632,7 +662,7 @@ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
|
632
662
|
return [row];
|
|
633
663
|
}
|
|
634
664
|
case FooterArrange.Centred: {
|
|
635
|
-
const blocks = mix.holds.map(h => (h === FooterHold.Pages ? laid(part('pageRow'), { justifyContent: 'center' }) : centred(holdPart(h, mix))));
|
|
665
|
+
const blocks = partHolds(mix.holds).map(h => (h === FooterHold.Pages ? laid(part('pageRow'), { justifyContent: 'center' }) : centred(holdPart(h, mix))));
|
|
636
666
|
return [
|
|
637
667
|
{ t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: '28px', ...CENTRED }, c: [centred(brandPart(ctx, mix)), ...blocks] },
|
|
638
668
|
part('rule'),
|
|
@@ -648,7 +678,7 @@ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
|
648
678
|
resp: { tablet: { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' }, mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: cells }, part('rule'), part('copyright')];
|
|
649
679
|
}
|
|
650
680
|
case FooterArrange.ListBig: {
|
|
651
|
-
const others = mix.holds.filter(h => h !== FooterHold.Pages).map(h => holdPart(h, mix));
|
|
681
|
+
const others = partHolds(mix.holds).filter(h => h !== FooterHold.Pages).map(h => holdPart(h, mix));
|
|
652
682
|
const pages = mix.holds.includes(FooterHold.Pages) ? bigPages(ctx) : [];
|
|
653
683
|
return [{ t: 'Container', es: 'box', lay: { display: 'grid', gridTemplateColumns: 'minmax(0, 3fr) minmax(0, 2fr)', gap: GAP, alignItems: 'end' },
|
|
654
684
|
resp: { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: [
|
|
@@ -656,6 +686,14 @@ function bodyOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
|
656
686
|
{ t: 'Container', es: 'box', lay: { display: 'flex', flexDirection: 'column', gap: GAP }, c: [brandPart(ctx, mix), ...others] },
|
|
657
687
|
] }, part('rule'), part('copyright')];
|
|
658
688
|
}
|
|
689
|
+
case FooterArrange.Halves: {
|
|
690
|
+
// FV1 (footer-v2 §2, after thepopuphotel and allerstudio): the brand at the start, the blocks in columns at the
|
|
691
|
+
// end, a vertical hairline between them (iox-design.css `footer.halves`); one under another on a phone.
|
|
692
|
+
const end: PatternNode = { t: 'Container', es: 'box', lay: { display: 'grid', gridTemplateColumns: `repeat(${Math.max(holds.length, 1)}, minmax(0, 1fr))`, gap: GAP },
|
|
693
|
+
resp: { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: holds };
|
|
694
|
+
return [{ t: 'Container', es: 'box', role: FooterRole.Halves, lay: { display: 'grid', gridTemplateColumns: 'minmax(0, 1fr) minmax(0, 1fr)', gap: '0px' },
|
|
695
|
+
resp: { mobile: { gridTemplateColumns: 'minmax(0, 1fr)' } }, c: [brandPart(ctx, mix), end] }, part('rule'), part('copyright')];
|
|
696
|
+
}
|
|
659
697
|
default:
|
|
660
698
|
return [{ t: 'Container', es: 'box', ...columnsOf(holds.length), c: [brandPart(ctx, mix), ...holds] }, part('rule'), part('copyright')];
|
|
661
699
|
}
|
|
@@ -677,6 +715,8 @@ function endOf(mix: FooterMix, ctx: FooterContext): PatternNode[] {
|
|
|
677
715
|
const GROUND_SCHEME: Readonly<Record<string, string | null>> = {
|
|
678
716
|
[FooterGround.Inverse]: 'inverse', [FooterGround.Subtle]: 'subtle', [FooterGround.Accent]: 'accent', [FooterGround.Plain]: null,
|
|
679
717
|
[FooterGround.Inset]: 'inverse',
|
|
718
|
+
// FV1: a framed footer stands on the page's own ground, in a ruled box (stampFooterMix + iox-design.css).
|
|
719
|
+
[FooterGround.Framed]: null,
|
|
680
720
|
};
|
|
681
721
|
|
|
682
722
|
/** A footer mix as a pattern: what the composer stamps as the site's footer (global, after the page). Check it first. */
|
|
@@ -687,6 +727,7 @@ export function footerPattern(given: FooterMix, ctx: FooterContext): SitePattern
|
|
|
687
727
|
[FooterClosing.Call]: () => [mix.arrange === FooterArrange.Columns ? callPart(ctx) : centred(callPart(ctx))],
|
|
688
728
|
[FooterClosing.Statement]: () => [part('statement')],
|
|
689
729
|
[FooterClosing.Word]: () => [callWord(ctx)],
|
|
730
|
+
[FooterClosing.Email]: () => (ctx.email?.trim() ? [emailLine(ctx.email.trim(), ctx)] : []),
|
|
690
731
|
} as Readonly<Record<string, () => PatternNode[]>>;
|
|
691
732
|
const before = opens[mix.closing]?.() ?? [];
|
|
692
733
|
const body = mix.closing === FooterClosing.NameAndAction ? endOf(mix, ctx) : bodyOf(mix, ctx);
|
|
@@ -716,12 +757,22 @@ export const FOOTER_INSET_STYLES: Readonly<Record<string, string>> = {
|
|
|
716
757
|
borderRadius: 'var(--iox-radius-xl)',
|
|
717
758
|
};
|
|
718
759
|
|
|
760
|
+
/** FV1 `ground.framed`: the box stands at an inset footer's margin (inside the page frame) and pads its words back onto the
|
|
761
|
+
* column; its rule is iox-design.css's (`iox-footer-ground-framed`). */
|
|
762
|
+
export const FOOTER_FRAMED_STYLES: Readonly<Record<string, string>> = {
|
|
763
|
+
margin: FOOTER_INSET_STYLES['margin'], paddingLeft: FOOTER_INSET_STYLES['paddingLeft'], paddingRight: FOOTER_INSET_STYLES['paddingRight'],
|
|
764
|
+
};
|
|
765
|
+
|
|
719
766
|
/**
|
|
720
767
|
* The composed footer's root says the mix it was composed as (`FOOTER_MIX_PROP` — the classes iox-design.css draws from),
|
|
721
768
|
* and an inset footer wears the card shape (AW6's trait) at the footer's own margin. Pure on the node it is given.
|
|
722
769
|
*/
|
|
723
770
|
export function stampFooterMix(root: { props: Record<string, unknown>; styleProps?: Record<string, unknown> }, mix: FooterMix): void {
|
|
724
771
|
root.props = { ...root.props, [FOOTER_MIX_PROP]: footerMixWords({ ...mix, holds: [] }).filter(w => !w.startsWith(`${FooterIngredient.Holds}:`)).join(' ') };
|
|
772
|
+
if (mix.ground === FooterGround.Framed) {
|
|
773
|
+
root.styleProps = { ...(root.styleProps ?? {}), ...FOOTER_FRAMED_STYLES };
|
|
774
|
+
return;
|
|
775
|
+
}
|
|
725
776
|
if (mix.ground !== FooterGround.Inset) return;
|
|
726
777
|
root.props = { ...root.props, [SECTION_SHAPE_TRAIT]: SectionShape.Card };
|
|
727
778
|
root.styleProps = { ...(root.styleProps ?? {}), ...FOOTER_INSET_STYLES };
|
|
@@ -738,17 +789,14 @@ const MEND_ORDER: ReadonlyArray<FooterIngredient.Closing | FooterIngredient.Grou
|
|
|
738
789
|
/**
|
|
739
790
|
* A footer no other site wears (R-H10): the mix when no other site's footer READS like it (`footerFaceOf` — the same
|
|
740
791
|
* arrangement and closing, whatever the ground), else the nearest mix that reads otherwise — one changed ingredient before
|
|
741
|
-
* two, in `MEND_ORDER`, each word in the table's order and offered at `tier` (
|
|
742
|
-
* award word) — checked again (`checkFooter`), and said. When every face is worn, a free token is enough (the plan's own,
|
|
792
|
+
* two, in `MEND_ORDER`, each word in the table's order and offered at `tier` (every tier's since AW-D42) — checked again (`checkFooter`), and said. When every face is worn, a free token is enough (the plan's own,
|
|
743
793
|
* else the nearest); when every footer is worn, the mix as it is. Pure, deterministic.
|
|
744
794
|
*/
|
|
745
795
|
export function distinctFooter(mix: FooterMix, taken: ReadonlyArray<string>, ctx: FooterContext, tier?: `${GenerationTier}`): { mix: FooterMix; repairs: FooterRepair[] } {
|
|
746
796
|
const used = new Set(taken);
|
|
747
797
|
const faces = new Set(taken.map(footerFaceOf));
|
|
748
798
|
const free = (m: FooterMix, byFace: boolean) => !used.has(footerTokenOf(m)) && (!byFace || !faces.has(footerFaceOf(m)));
|
|
749
|
-
// judged as the tier will draw it (the composer's check says the tier's mends; here they only shape the judgement)
|
|
750
799
|
const asked = mix;
|
|
751
|
-
mix = footerAtTier(mix, tier).mix;
|
|
752
800
|
if (free(mix, true)) return { mix: asked, repairs: [] };
|
|
753
801
|
const words = (k: FooterIngredient) => footerWords(k).filter(w => footerWordOffered(k, w, tier));
|
|
754
802
|
const tries: FooterMix[] = [];
|
|
@@ -4,6 +4,7 @@ import { LayoutIssue, LayoutIssueCode, LayoutLayer, LayoutLayerKind, LayoutPage,
|
|
|
4
4
|
import { fallBackBySection, SectionFallback, SectionSwap } from './layout-section-fallback';
|
|
5
5
|
import { followedAfter, PromptLimit, sectionBreaks } from './prompt-limits';
|
|
6
6
|
import { PageSectionPlan } from './site-plan.model';
|
|
7
|
+
import { freeSlotOf, FreeSlotKind } from './free-slot-words';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* THE FREE PAGE'S SILENT FALL BACK (award plan §11.4 gate 6, R-H7): a free section that still breaks a rule after the
|
|
@@ -46,10 +47,11 @@ function layerOf(node: FreeNode): LayoutLayer | null {
|
|
|
46
47
|
if (word) return { kind: word, text: node.text ?? '', ...AT };
|
|
47
48
|
if (node.type === FreeNodeType.Image) return { kind: LayoutLayerKind.Photo, photo: { id: node.src ?? '' }, ...AT };
|
|
48
49
|
if (node.type !== FreeNodeType.Slot) return null;
|
|
49
|
-
const
|
|
50
|
-
if (
|
|
51
|
-
if (kind ===
|
|
52
|
-
|
|
50
|
+
const slot = freeSlotOf(String(node.slot ?? ''));
|
|
51
|
+
if (!slot) return null;
|
|
52
|
+
if (slot.kind === FreeSlotKind.Form) return { kind: LayoutLayerKind.Form, form: { preset: slot.ref } as LayoutLayer['form'], ...AT };
|
|
53
|
+
// A list, or a recipe over one (Accordion, Tabs, the quotes): the fit reads the list it shows.
|
|
54
|
+
return { kind: LayoutLayerKind.Gallery, gallery: { slides: [], source: slot.ref }, ...AT };
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
/** A free section read as a layout section (for the fit only — never stamped). */
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { LayoutPhotoShape, LayoutPhotoSource, parseLayoutPhotoId } from './layout-language';
|
|
2
|
+
import { PromptLimit, promptLimitsOf, PromptReading } from './prompt-limits';
|
|
3
|
+
import { wordPattern } from './plan-words';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A FREE HOME OPENS ON A PICTURE WHEN ONE CAN COME (iox-ui#180, J10 lever b for FS3). The ONE offer a free page's brief
|
|
7
|
+
* and its judge share: the owner's photos come first (they are the material already); with none, a business stock may
|
|
8
|
+
* show is offered the picture boxes (`box:<shape>`, the laid brief's own ids, `parseLayoutPhotoId`) — an empty picture the
|
|
9
|
+
* build fills with stock, or, when nothing fits, the type-led round opens the Home on its words like every Home. Never a
|
|
10
|
+
* picture claim: no box where stock may not stand in for the work (`BusinessType.stock: false`), none off the Home, and
|
|
11
|
+
* nothing against the owner's words: "no pictures" (`PromptLimit.NoPictures`) offers nothing, "no stock photos" no box. Pure.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** The shapes a free opening's box may take, as material ids (`box:wide` · `box:tall` · `box:square`). */
|
|
15
|
+
export const FREE_OPENING_BOXES: ReadonlyArray<string> = [LayoutPhotoShape.Wide, LayoutPhotoShape.Tall, LayoutPhotoShape.Square]
|
|
16
|
+
.map(shape => `${LayoutPhotoSource.Box}:${shape}`);
|
|
17
|
+
|
|
18
|
+
export interface FreeOpeningSite {
|
|
19
|
+
/** The page is the site's Home. */
|
|
20
|
+
home: boolean;
|
|
21
|
+
/** The business type may show stock (`BusinessType.stock`): stock may fill a box. */
|
|
22
|
+
stockAllowed: boolean;
|
|
23
|
+
/** How many photos of the owner's the page may place. */
|
|
24
|
+
ownPhotos: number;
|
|
25
|
+
/** The owner's words as the reading kept them (§11.4a): what they ruled out. */
|
|
26
|
+
reading?: PromptReading | null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Words that refuse stock photos ("no stock photos", "בלי תמונות סטוק") wherever the reading kept them. */
|
|
30
|
+
const STOCK_REFUSALS: ReadonlyArray<string> = ['stock', 'stock photos', 'stock images', 'סטוק', 'תמונות סטוק'];
|
|
31
|
+
const STOCK_RULINGS: ReadonlyArray<string> = ['no stock', 'without stock', 'not stock', 'never stock', 'בלי סטוק', 'ללא סטוק', 'בלי תמונות סטוק', 'ללא תמונות סטוק'];
|
|
32
|
+
|
|
33
|
+
/** Did the owner refuse stock photos? Read from the reading's own lists, never guessed. Pure. */
|
|
34
|
+
export function refusesStock(reading: PromptReading | null | undefined): boolean {
|
|
35
|
+
const plain = (t: string) => String(t ?? '').normalize('NFKC').toLowerCase().replace(/^(any|no|בלי|ללא)\s+/, '').trim();
|
|
36
|
+
const all = [...(reading?.refused ?? []), ...(reading?.asked ?? []), ...(reading?.said ?? [])].map(t => String(t ?? '').normalize('NFKC').toLowerCase());
|
|
37
|
+
return (reading?.refused ?? []).some(r => STOCK_REFUSALS.includes(plain(r))) || STOCK_RULINGS.some(phrase => all.some(text => wordPattern(phrase).test(text)));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface FreeOpeningOffer {
|
|
41
|
+
/** The box ids the page may place (material of kind image), empty when none is offered. */
|
|
42
|
+
boxes: string[];
|
|
43
|
+
/** The Home opens on a picture: one of the owner's photos, or a box. */
|
|
44
|
+
opensOnPicture: boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** What a free page's opening is offered, and whether it must open on a picture. */
|
|
48
|
+
export function freeOpeningOffer(site: FreeOpeningSite): FreeOpeningOffer {
|
|
49
|
+
if (!site.home || promptLimitsOf(site.reading).includes(PromptLimit.NoPictures)) return { boxes: [], opensOnPicture: false };
|
|
50
|
+
if (site.ownPhotos > 0) return { boxes: [], opensOnPicture: true };
|
|
51
|
+
return site.stockAllowed && !refusesStock(site.reading) ? { boxes: [...FREE_OPENING_BOXES], opensOnPicture: true } : { boxes: [], opensOnPicture: false };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Is a material id a picture box (`box:<shape>`)? */
|
|
55
|
+
export function isFreeBox(id: string | null | undefined): boolean {
|
|
56
|
+
return parseLayoutPhotoId(String(id ?? ''))?.source === LayoutPhotoSource.Box;
|
|
57
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { FormPresetId } from '@vectoriox/iox-ui/forms-core';
|
|
2
|
+
|
|
3
|
+
import type { FreeSlotOffer } from './check-free';
|
|
4
|
+
import { fieldsOf, layoutGalleryLists, layoutListBinding, layoutListShapes, listedContentType, quoteListOf } from './compose-site';
|
|
5
|
+
import { LIST_INGREDIENTS, listBuiltWords, ListIngredient, listWordOffered, listWordRefusal } from './list-table';
|
|
6
|
+
import { PatternRecipe } from './patterns';
|
|
7
|
+
import { recipeListBinds } from './recipe-fields';
|
|
8
|
+
import { SitePlan } from './site-plan.model';
|
|
9
|
+
import { FREE_OPEN_LIGHTBOX, FREE_SLOT_SEPARATOR, FreeSlotKind, freeSlotWord } from './free-slot-words';
|
|
10
|
+
|
|
11
|
+
export * from './free-slot-words';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* THE PARTS A FREE PAGE MAY PLACE (award-ingredients-plan §11.4, FS3; R-H2; "basic parts", 2026-11-28). A free page is
|
|
15
|
+
* the main path for a new site, so a part the product has built reaches a generated site only when a free page is
|
|
16
|
+
* OFFERED it. The ONE offer, read by iox-cms's free gate (the wire's `slot` enum, the brief, the judge) and by the free
|
|
17
|
+
* stamp (`composeFreePage`, which places each by its slot word). Every part is the builder palette's own recipe, bound
|
|
18
|
+
* to the plan's content — never words the model writes, so nothing here can state a fact the owner did not give:
|
|
19
|
+
*
|
|
20
|
+
* - `list:<alias>` — a list the plan shows with pictures (`composeListFrame`); its `opts` are the built list words the
|
|
21
|
+
* list can carry (every tier's since AW-D42) and `open:lightbox` (CC3: a click on a picture opens it large, at the
|
|
22
|
+
* clicked item) when the list has pictures and no page per item.
|
|
23
|
+
* - `accordion:<alias>` — CC2's Accordion over a list whose type fills it (a question and an answer field), never a list
|
|
24
|
+
* of quotes.
|
|
25
|
+
* - `tabs:<alias>` — CC4a's Tabs over a list whose type fills them (a short label and a longer text), never a list of
|
|
26
|
+
* quotes.
|
|
27
|
+
* - `quotes:<alias>` — CC3's testimonial carousel over the plan's list of REAL quotes (`quoteListOf`, iox-ui#132):
|
|
28
|
+
* offered only when the plan holds one, so a quote is never invented.
|
|
29
|
+
* - `form:contact` — the forms-core contact preset, the one every business takes.
|
|
30
|
+
*
|
|
31
|
+
* Pure.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
/** The form every free page may place. */
|
|
35
|
+
export const FREE_FORM_PRESET: string = FormPresetId.Contact;
|
|
36
|
+
|
|
37
|
+
/** The recipe a list-bound slot kind places (and whose fields `recipeListBinds` checks). */
|
|
38
|
+
const LIST_RECIPE_SLOTS: ReadonlyArray<readonly [FreeSlotKind, PatternRecipe]> = [
|
|
39
|
+
[FreeSlotKind.Accordion, PatternRecipe.Accordion],
|
|
40
|
+
[FreeSlotKind.Tabs, PatternRecipe.Tabs],
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
/** The list ingredients a free list slot's options are drawn from: how items are arranged and how a row moves (a row
|
|
44
|
+
* that turns by itself or by arrows is the carousel). */
|
|
45
|
+
const LIST_OPTION_INGREDIENTS: ReadonlyArray<ListIngredient> = LIST_INGREDIENTS.filter(k => k === 'arrange' || k === 'move');
|
|
46
|
+
|
|
47
|
+
/** Every part a free page of `plan` may place, by slot word (see the module's comment). */
|
|
48
|
+
export function freeSlotOffers(plan: SitePlan, tier?: string | null): Record<string, FreeSlotOffer> {
|
|
49
|
+
const offers: Record<string, FreeSlotOffer> = {};
|
|
50
|
+
const shapes = layoutListShapes(plan);
|
|
51
|
+
for (const list of layoutGalleryLists(plan).filter(l => l.pictures)) {
|
|
52
|
+
const shape = shapes.find(s => s.alias === list.alias) ?? null;
|
|
53
|
+
const words = LIST_OPTION_INGREDIENTS.flatMap(k => listBuiltWords(k)
|
|
54
|
+
.filter(w => listWordOffered(k, w, tier) && listWordRefusal(k, w, shape, tier) === null)
|
|
55
|
+
.map(w => `${k}${FREE_SLOT_SEPARATOR}${w}`));
|
|
56
|
+
const detail = !!layoutListBinding(list.alias, plan)?.detail;
|
|
57
|
+
offers[freeSlotWord(FreeSlotKind.List, list.alias)] = { kind: FreeSlotKind.List, ref: list.alias, opts: detail ? words : [...words, FREE_OPEN_LIGHTBOX] };
|
|
58
|
+
}
|
|
59
|
+
for (const list of layoutGalleryLists(plan)) {
|
|
60
|
+
const type = listedContentType(list.alias, plan);
|
|
61
|
+
// A list of quotes is shown as quotes only — never as questions or tabs made of someone's words.
|
|
62
|
+
if (type?.roles.quote) continue;
|
|
63
|
+
const fields = fieldsOf(type);
|
|
64
|
+
for (const [kind, recipe] of LIST_RECIPE_SLOTS) {
|
|
65
|
+
if (recipeListBinds(recipe, fields).gap === null) offers[freeSlotWord(kind, list.alias)] = { kind, ref: list.alias };
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const quotes = quoteListOf(plan);
|
|
69
|
+
if (quotes) offers[freeSlotWord(FreeSlotKind.Quotes, quotes.source)] = { kind: FreeSlotKind.Quotes, ref: quotes.source };
|
|
70
|
+
offers[freeSlotWord(FreeSlotKind.Form, FREE_FORM_PRESET)] = { kind: FreeSlotKind.Form, ref: FREE_FORM_PRESET };
|
|
71
|
+
return offers;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** What each slot kind places, in the words the model reads (the free brief's "parts it may place"). */
|
|
75
|
+
const SLOT_MEANING: Readonly<Record<FreeSlotKind, (ref: string) => string>> = {
|
|
76
|
+
[FreeSlotKind.List]: ref => `the ${ref} list`,
|
|
77
|
+
[FreeSlotKind.Form]: ref => `a ${ref} form`,
|
|
78
|
+
[FreeSlotKind.Accordion]: ref => `the ${ref} list as an accordion — each item a question that opens its answer`,
|
|
79
|
+
[FreeSlotKind.Tabs]: ref => `the ${ref} list as tabs — one item shown at a time`,
|
|
80
|
+
[FreeSlotKind.Quotes]: ref => `the ${ref} list as a testimonial carousel — the owner's real quotes, one at a time`,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** One line of the free brief for an offered part: its slot word, what it places, and its options. */
|
|
84
|
+
export function freeSlotLine(slot: string, offer: FreeSlotOffer): string {
|
|
85
|
+
const kind = (Object.values(FreeSlotKind) as string[]).includes(offer.kind) ? offer.kind as FreeSlotKind : FreeSlotKind.List;
|
|
86
|
+
return `- "${slot}" (${SLOT_MEANING[kind](offer.ref)})${offer.opts?.length ? ` · opts: ${offer.opts.join(', ')}` : ''}`;
|
|
87
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A free page's slot words (`<kind>:<ref>`, free-parts.ts) — a leaf module (no imports): the plan validator, the judge and
|
|
3
|
+
* the stamp read them without reordering the generation-core load. Pure.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export enum FreeSlotKind {
|
|
7
|
+
List = 'list',
|
|
8
|
+
Form = 'form',
|
|
9
|
+
Accordion = 'accordion',
|
|
10
|
+
Tabs = 'tabs',
|
|
11
|
+
Quotes = 'quotes',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** The separator between a slot's kind and what it names (`list:projects`). */
|
|
15
|
+
export const FREE_SLOT_SEPARATOR = ':';
|
|
16
|
+
|
|
17
|
+
/** A list slot's option that opens a clicked picture large (CC3 Lightbox) — not a list mix word. */
|
|
18
|
+
export const FREE_OPEN_LIGHTBOX = 'open:lightbox';
|
|
19
|
+
|
|
20
|
+
/** `<kind>:<ref>` — a slot word. */
|
|
21
|
+
export const freeSlotWord = (kind: FreeSlotKind, ref: string): string => `${kind}${FREE_SLOT_SEPARATOR}${ref}`;
|
|
22
|
+
|
|
23
|
+
/** A slot word read back: its kind and what it names (null for a word of no known kind). */
|
|
24
|
+
export function freeSlotOf(slot: string): { kind: FreeSlotKind; ref: string } | null {
|
|
25
|
+
const at = slot.indexOf(FREE_SLOT_SEPARATOR);
|
|
26
|
+
if (at < 0) return null;
|
|
27
|
+
const kind = slot.slice(0, at) as FreeSlotKind;
|
|
28
|
+
return (Object.values(FreeSlotKind) as string[]).includes(kind) ? { kind, ref: slot.slice(at + 1) } : null;
|
|
29
|
+
}
|
|
30
|
+
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { AI_COMPOSED_PAGES_ESTIMATED, AiFeature } from './ai-run';
|
|
2
2
|
import { GenerationTier, PagePlan, SitePlan, STAMPED_PAGE_ARCHETYPES } from './site-plan.model';
|
|
3
|
+
import { tierOffers } from './part-tier';
|
|
3
4
|
import { isPerItemPage } from './validate-site-plan';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
|
-
* The generation tier (award-ingredients-plan §0, AW-
|
|
7
|
-
* the award tier: the model composes every page that may be composed, not two
|
|
8
|
-
*
|
|
7
|
+
* The generation tier (award-ingredients-plan §0, AW-D24; AW-D42) — pure. A studio whose plan has `awardSites` builds at
|
|
8
|
+
* the award tier: the model composes every page that may be composed, not two. Since AW-D42 (2026-11-28) the tier holds
|
|
9
|
+
* back no PART — every word and recipe is every tier's (`tierOffers`); it decides only how much is composed. Read once, when a generation starts, and
|
|
9
10
|
* carried by the generation — never re-read mid-run, never written by the model.
|
|
10
11
|
*/
|
|
11
12
|
|
|
@@ -21,26 +22,14 @@ export function tierOf(stored: string | null | undefined): GenerationTier {
|
|
|
21
22
|
return stored === GenerationTier.Award ? GenerationTier.Award : GenerationTier.Basic;
|
|
22
23
|
}
|
|
23
24
|
|
|
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
25
|
/** A contract row that may be held for a tier (a word, a recipe, a table row) — no `tier` = every tier. */
|
|
31
26
|
export interface TieredRow {
|
|
32
27
|
readonly tier?: `${GenerationTier}` | null;
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
|
|
36
|
-
export function tierOffers(rowTier: `${GenerationTier}` | null | undefined, tier: `${GenerationTier}`): boolean {
|
|
37
|
-
return !rowTier || TIER_RANK[rowTier] <= TIER_RANK[tier];
|
|
38
|
-
}
|
|
30
|
+
export { tierOffers } from './part-tier';
|
|
39
31
|
|
|
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
|
-
*/
|
|
32
|
+
/** The rows a build at `tier` is offered — every row since AW-D42 (`tierOffers`). */
|
|
44
33
|
export function offeredForTier<T extends TieredRow>(rows: ReadonlyArray<T>, tier: `${GenerationTier}`): T[] {
|
|
45
34
|
return rows.filter(row => tierOffers(row.tier, tier));
|
|
46
35
|
}
|