@vectoriox/iox-ui 5.195.0 → 5.197.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/composite-core/index.d.ts +15 -2
- package/data-core/index.d.ts +101 -2
- package/design-core/index.d.ts +374 -8
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +41 -12
- 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 +749 -264
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1084 -630
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +224 -3
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-identity-core.mjs +11 -5
- package/fesm2022/vectoriox-iox-ui-identity-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +100 -17
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +351 -109
- package/harness-core/index.d.ts +166 -4
- package/identity-core/index.d.ts +8 -1
- package/index.d.ts +23 -2
- package/package.json +1 -1
- package/src/composite-core/account-runtime.ts +2 -2
- package/src/composite-core/header.ts +23 -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/contrast-audit.ts +38 -0
- package/src/design-core/flavor-spec.generated.ts +275 -1
- package/src/design-core/header-behaviour.ts +180 -3
- package/src/design-core/node-classes.ts +9 -2
- package/src/design-core/node-links.ts +34 -0
- package/src/generation-core/audit-site.ts +10 -1
- package/src/generation-core/audit-words.ts +5 -0
- package/src/generation-core/check-free.ts +21 -3
- package/src/generation-core/compose-site.ts +57 -17
- package/src/generation-core/free-opening.ts +57 -0
- package/src/generation-core/header-mix.ts +245 -12
- package/src/generation-core/item-fill.ts +42 -0
- 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 +10 -0
- package/src/generation-core/public-api.ts +2 -0
- package/src/generation-core/site-build-run.ts +4 -0
- package/src/generation-core/site-spec.generated.ts +41 -9
- package/src/generation-core/stock-search.ts +106 -18
- package/src/generation-core/type-led.ts +19 -4
- package/src/harness-core/business-types.ts +11 -0
- package/src/harness-core/harness-spec.generated.ts +213 -0
- package/src/harness-core/run-compose-context.ts +12 -4
- package/src/identity-core/site-auth-transport.ts +11 -4
- package/styles/iox-design.css +149 -6
|
@@ -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
|
+
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DesignChoices, elementStyleFace, HeaderTrait, MenuForm, menuButtonOf, menuFormOf, menuHoverOf, MenuLook, MenuPhoneForm,
|
|
2
|
+
DesignChoices, designTokenRows, elementStyleFace, HeaderGround, headerGroundIsGlass, headerGroundIsOver, HeaderTrait, MenuForm, menuButtonOf, menuFormOf, menuHoverOf, MenuLook, MenuPhoneForm,
|
|
3
|
+
menuRevealOf, parseHexColor, resolveDesignChoices, resolveSchemeTokenValues, resolveTokenValues, ResolvedMode, textWidthEm, wcagContrastRatio,
|
|
3
4
|
} from '@vectoriox/iox-ui/design-core';
|
|
4
5
|
|
|
5
6
|
import { MenuSide, NavRole, NavShape } from './nav-shape';
|
|
7
|
+
import { OpeningMixError, openingMixOfPlan, OpeningRole } from './opening-mix';
|
|
8
|
+
import { calmUnder, PhotoInventory } from './photo-inventory';
|
|
6
9
|
import { PatternGlobalPosition, PatternNode, SITE_PATTERNS, SitePattern } from './patterns';
|
|
7
10
|
import { planSells, ShopSourceRole, shopSourceAliases } from './shop-plan';
|
|
8
11
|
import { SPEC_SITE_HEADER_PARTS, SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
@@ -269,6 +272,19 @@ export enum HeaderRepairCode {
|
|
|
269
272
|
OneDestination = 'one-destination',
|
|
270
273
|
/** Another site already wears this header: the nearest free one (`distinctHeader`). */
|
|
271
274
|
Worn = 'worn',
|
|
275
|
+
/** HI3-D12: this kind of business never stands its header over the opening (harness HEADER_NEVER): its own ground. */
|
|
276
|
+
TypeNever = 'type-never',
|
|
277
|
+
/** HI3-D10 / D12: the home page does not open on a picture the header can stand over: its own ground. */
|
|
278
|
+
OverPlain = 'over-plain',
|
|
279
|
+
/** HI3-D5: the header's words do not read over the opening's picture at rest: glass from the top (its own ground in a
|
|
280
|
+
* look with no glass). */
|
|
281
|
+
OverUnreadable = 'over-unreadable',
|
|
282
|
+
/** HI3-D2: the look has no glass (Pop): glass is its own solid bar, over-then-glass is over. */
|
|
283
|
+
NoGlass = 'no-glass',
|
|
284
|
+
/** HI3-D12: in a look whose own bar is glass (Glass), over is over-then-glass. */
|
|
285
|
+
GlassOwnBar = 'glass-own-bar',
|
|
286
|
+
/** HI3-D9: glass carries its own hairline and shadow: no scroll edge. */
|
|
287
|
+
GlassEdge = 'glass-edge',
|
|
272
288
|
}
|
|
273
289
|
|
|
274
290
|
export interface HeaderRepair {
|
|
@@ -283,6 +299,21 @@ export interface HeaderPage {
|
|
|
283
299
|
readonly route: string;
|
|
284
300
|
}
|
|
285
301
|
|
|
302
|
+
/** HI3-D12: the home page's opening, as the plan chose it (`mixes.opening`): its frame and its media words. */
|
|
303
|
+
export interface HeaderOpening {
|
|
304
|
+
readonly frame: string;
|
|
305
|
+
readonly media: string;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** HI3-D12: what a kind of business never stands its header on (contract harness `businessTypes[].header`, from
|
|
309
|
+
* harness.mjs HEADER_NEVER; harness-core `BusinessType.header`). */
|
|
310
|
+
export interface HeaderNever {
|
|
311
|
+
readonly grounds: ReadonlyArray<string>;
|
|
312
|
+
/** Why, in the owner's words — said with the mend. */
|
|
313
|
+
readonly say?: ReadonlyArray<string>;
|
|
314
|
+
readonly sayHe?: ReadonlyArray<string>;
|
|
315
|
+
}
|
|
316
|
+
|
|
286
317
|
/** What the check and the recipe need of the site. */
|
|
287
318
|
export interface HeaderContext {
|
|
288
319
|
readonly name: string;
|
|
@@ -291,9 +322,21 @@ export interface HeaderContext {
|
|
|
291
322
|
readonly pages: ReadonlyArray<HeaderPage>;
|
|
292
323
|
/** The shop's page when the site sells (the second action, and the page a shop pins — HI-D16). */
|
|
293
324
|
readonly shop?: string | null;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
325
|
+
/** HI3-D12: the home page's opening — null when it opens on its sections as written (no picture the header can stand
|
|
326
|
+
* over). Absent: not judged (an over header is kept). */
|
|
327
|
+
readonly opening?: HeaderOpening | null;
|
|
328
|
+
/** HI3-D5: whether the header's words read at rest over the opening's picture in every mode the look offers
|
|
329
|
+
* (`headerReadsAtRest`, judged where the picture's pixels are). Absent / null: not judged. */
|
|
330
|
+
readonly readableAtRest?: boolean | null;
|
|
331
|
+
/** HI3-D12: what this kind of business never stands its header on. Absent: nothing refused. */
|
|
332
|
+
readonly never?: HeaderNever | null;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const RULES = H.rules as unknown as Readonly<{
|
|
336
|
+
menuMinLinks: number; pinnedMax: number; inlineRoomPx: number; betweenNameEm: number; betweenMinPages: number;
|
|
337
|
+
overFrames: ReadonlyArray<string>; overMedia: ReadonlyArray<string>; glassFlavors: ReadonlyArray<string>;
|
|
338
|
+
glassIsOwnBar: ReadonlyArray<string>; noEdgeGrounds: ReadonlyArray<string>;
|
|
339
|
+
}>;
|
|
297
340
|
/** How a laptop's bar is measured (an estimate on the look's own faces — never a guess at a page's words): the name at
|
|
298
341
|
* the brand's size, each page at the link's, the gap between them, and a button's padding around its words. */
|
|
299
342
|
const BRAND_PX = 24;
|
|
@@ -355,9 +398,177 @@ export function checkHeader(mix: HeaderMix, ctx: HeaderContext): { mix: HeaderMi
|
|
|
355
398
|
m.action = HeaderAction.Button;
|
|
356
399
|
say(HeaderRepairCode.OneDestination, 'two actions need two places to go (the contact page and the shop): one button');
|
|
357
400
|
}
|
|
401
|
+
mendGround(m, ctx, say);
|
|
358
402
|
return { mix: m, repairs };
|
|
359
403
|
}
|
|
360
404
|
|
|
405
|
+
/** HI3-D12: does the home page open on a picture the header can stand over — the contract's frames and media. */
|
|
406
|
+
export function opensOnPicture(opening: HeaderOpening | null | undefined): boolean {
|
|
407
|
+
return !!opening && RULES.overFrames.includes(opening.frame) && RULES.overMedia.includes(opening.media);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/** HI3-D5: what an over header stands on when its words do not read over the opening — the look's glass from the top,
|
|
411
|
+
* or its own solid bar in a look with no glass (Pop). The ONE answer `checkHeader` and a build's late mend share. */
|
|
412
|
+
export function headerGroundWhenUnreadable(design: Pick<DesignChoices, 'flavorId'>): HeaderGround {
|
|
413
|
+
return lookHasGlass(design) ? HeaderGround.Glass : HeaderGround.Solid;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/** HI3-D2: does the look carry a header glass set (Pop draws its own solid bar). */
|
|
417
|
+
export function lookHasGlass(design: Pick<DesignChoices, 'flavorId'>): boolean {
|
|
418
|
+
return RULES.glassFlavors.includes(design.flavorId);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/** The ground rules (HI3-D2, D5, D9, D12), in order: the kind of business, the opening, the words at rest, the look's
|
|
422
|
+
* glass, then the edge glass does not draw. */
|
|
423
|
+
function mendGround(m: HeaderMix, ctx: HeaderContext, say: (code: HeaderRepairCode, said: string) => void): void {
|
|
424
|
+
const glass = lookHasGlass(ctx.design);
|
|
425
|
+
if (headerGroundIsOver(m.ground) && ctx.never?.grounds.includes(m.ground)) {
|
|
426
|
+
const why = ctx.never.say?.length ? ` — ${ctx.never.say.join(' ')}` : '';
|
|
427
|
+
m.ground = HeaderGround.Solid;
|
|
428
|
+
say(HeaderRepairCode.TypeNever, `this kind of business keeps its header on its own ground, never over the opening's picture${why}`);
|
|
429
|
+
}
|
|
430
|
+
if (headerGroundIsOver(m.ground) && ctx.opening !== undefined && !opensOnPicture(ctx.opening)) {
|
|
431
|
+
m.ground = HeaderGround.Solid;
|
|
432
|
+
say(HeaderRepairCode.OverPlain, 'the home page does not open on a full picture the header can stand over: it keeps its own ground');
|
|
433
|
+
}
|
|
434
|
+
if (headerGroundIsOver(m.ground) && ctx.readableAtRest === false) {
|
|
435
|
+
m.ground = headerGroundWhenUnreadable(ctx.design);
|
|
436
|
+
say(HeaderRepairCode.OverUnreadable, glass ? "the header's words do not read over the opening's picture: it stands on its glass from the top"
|
|
437
|
+
: "the header's words do not read over the opening's picture: it keeps its own ground");
|
|
438
|
+
}
|
|
439
|
+
if (headerGroundIsGlass(m.ground) && !glass) {
|
|
440
|
+
m.ground = m.ground === HeaderGround.OverGlass ? HeaderGround.Over : HeaderGround.Solid;
|
|
441
|
+
say(HeaderRepairCode.NoGlass, m.ground === HeaderGround.Over ? 'this look has no glass: over the opening, then its own solid bar'
|
|
442
|
+
: 'this look has no glass: the header keeps its own solid bar');
|
|
443
|
+
}
|
|
444
|
+
if (m.ground === HeaderGround.Over && RULES.glassIsOwnBar.includes(ctx.design.flavorId)) {
|
|
445
|
+
m.ground = HeaderGround.OverGlass;
|
|
446
|
+
say(HeaderRepairCode.GlassOwnBar, "in this look the header's own bar is glass: over the opening, then glass");
|
|
447
|
+
}
|
|
448
|
+
if (RULES.noEdgeGrounds.includes(m.ground) && m.edge !== 'none') {
|
|
449
|
+
m.edge = 'none';
|
|
450
|
+
say(HeaderRepairCode.GlassEdge, 'glass carries its own hairline and shadow: no scroll edge');
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// ── The words at rest over the opening (HI3-D5) ─────────────────────────────────────────────────────────────────────
|
|
455
|
+
|
|
456
|
+
/** The bar's height on a laptop, and the veil (`nav-over-veil`): the opening's ground at 32 % at the bar's top, clear 24px
|
|
457
|
+
* under it — read at the words' line, the bar's middle (the board's measure, hi3-glass.build.mjs). */
|
|
458
|
+
export const HEADER_BAR_PX = 80;
|
|
459
|
+
export const HEADER_VEIL = Object.freeze({ top: 0.32, extendPx: 24 });
|
|
460
|
+
/** WCAG AA for the bar's words (small text). */
|
|
461
|
+
const AA_TEXT = 4.5;
|
|
462
|
+
const GRID_COLUMNS = 12;
|
|
463
|
+
|
|
464
|
+
/** The veil's alpha at the words' line of a `barPx` bar. */
|
|
465
|
+
export function headerVeilAt(barPx = HEADER_BAR_PX): number {
|
|
466
|
+
return HEADER_VEIL.top * (1 - (barPx / 2) / (barPx + HEADER_VEIL.extendPx));
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
const toGamma = (linear: number): number => (linear <= 0.0031308 ? 12.92 * linear : 1.055 * Math.pow(linear, 1 / 2.4) - 0.055);
|
|
470
|
+
|
|
471
|
+
/** One look's words at rest: their ink and the ground the veil is made of (the opening scheme's, in one mode). */
|
|
472
|
+
export interface HeaderRestInk {
|
|
473
|
+
readonly ink: string;
|
|
474
|
+
readonly veilGround: string;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* HI3-D5: whether the header's words read at rest over the top of the opening's picture — the band the bar covers, as the
|
|
479
|
+
* frame crops the picture (`calmUnder`), column by column across the bar, each read as its mean light with the veil laid
|
|
480
|
+
* over it — in EVERY mode the look offers (`inks`, one per mode; a film is judged on its poster). The weakest column
|
|
481
|
+
* decides. Pure.
|
|
482
|
+
*/
|
|
483
|
+
export function headerReadsAtRest(inv: PhotoInventory, frame: { w: number; h: number }, inks: ReadonlyArray<HeaderRestInk>, barPx = HEADER_BAR_PX): boolean {
|
|
484
|
+
const veil = headerVeilAt(barPx);
|
|
485
|
+
const band = Math.min(1, Math.max(0, barPx / Math.max(1, frame.h)));
|
|
486
|
+
for (const { ink, veilGround } of inks) {
|
|
487
|
+
const v = parseHexColor(veilGround);
|
|
488
|
+
if (!v || !parseHexColor(ink)) return false;
|
|
489
|
+
for (let i = 0; i < GRID_COLUMNS; i++) {
|
|
490
|
+
const grey = toGamma(calmUnder(inv, frame, { x0: i / GRID_COLUMNS, x1: (i + 1) / GRID_COLUMNS, y0: 0, y1: band }).luminance);
|
|
491
|
+
const under = { r: veil * v.r + (1 - veil) * grey, g: veil * v.g + (1 - veil) * grey, b: veil * v.b + (1 - veil) * grey };
|
|
492
|
+
if (wcagContrastRatio(ink, under) < AA_TEXT) return false;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
return true;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
/** The frames the words at rest are judged in (HI3-D5): a laptop's first screen under its 80px bar, a phone's under 64px
|
|
499
|
+
* (the shared CSS's bar fallbacks, iox-design.css). */
|
|
500
|
+
export const HEADER_REST_FRAMES: ReadonlyArray<{ readonly w: number; readonly h: number; readonly barPx: number }> = [
|
|
501
|
+
{ w: 1440, h: 900, barPx: HEADER_BAR_PX },
|
|
502
|
+
{ w: 390, h: 760, barPx: 64 },
|
|
503
|
+
];
|
|
504
|
+
const DEFAULT_SCHEME = 'default';
|
|
505
|
+
const MODES_OF: Readonly<Record<string, ReadonlyArray<ResolvedMode>>> = { light: ['light'], dark: ['dark'], auto: ['light', 'dark'] };
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* HI3-D5: the header's words at rest, one per mode the look offers — the opening scheme's `text` (what an over header
|
|
509
|
+
* wears at rest, HI3-D8) over a veil of its `bg` — resolved from the look's own token rows. A scheme the rows lack reads
|
|
510
|
+
* as the page's. Pure.
|
|
511
|
+
*/
|
|
512
|
+
export function headerRestInks(design: DesignChoices, scheme?: string | null): HeaderRestInk[] {
|
|
513
|
+
const rows = designTokenRows(design);
|
|
514
|
+
return (MODES_OF[design.mode] ?? MODES_OF['light']).map(mode => {
|
|
515
|
+
const values = scheme && scheme !== DEFAULT_SCHEME ? resolveSchemeTokenValues(rows, mode, scheme) : resolveTokenValues(rows, mode);
|
|
516
|
+
return { ink: values['text'] ?? '', veilGround: values['bg'] ?? '' };
|
|
517
|
+
});
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/** A node as the readable check walks it (a composed page's SerializedNode). */
|
|
521
|
+
export interface HeaderRestNode {
|
|
522
|
+
readonly role?: string | null;
|
|
523
|
+
readonly type?: string;
|
|
524
|
+
readonly props?: Readonly<Record<string, unknown>> | null;
|
|
525
|
+
readonly children?: ReadonlyArray<HeaderRestNode> | null;
|
|
526
|
+
}
|
|
527
|
+
/** A composed page as the readable check reads it. */
|
|
528
|
+
export interface HeaderRestPage {
|
|
529
|
+
readonly isHome?: boolean;
|
|
530
|
+
readonly route?: { readonly path?: string } | string | null;
|
|
531
|
+
readonly pageSettings?: { readonly opening?: string | null } | null;
|
|
532
|
+
readonly layout?: ReadonlyArray<HeaderRestNode> | null;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
const PICTURE_ROLES: ReadonlySet<string> = new Set([OpeningRole.Media, OpeningRole.MediaZooms, OpeningRole.Slides, OpeningRole.Film]);
|
|
536
|
+
|
|
537
|
+
/** The address of the picture the home opening shows first: its picture, the first slide, a film's poster — or null. */
|
|
538
|
+
export function openingPictureSrc(opening: HeaderRestNode | null | undefined): string | null {
|
|
539
|
+
let found: string | null = null;
|
|
540
|
+
const walk = (n: HeaderRestNode, inside: boolean): void => {
|
|
541
|
+
if (found) return;
|
|
542
|
+
const here = inside || PICTURE_ROLES.has(n.role ?? '');
|
|
543
|
+
if (here) {
|
|
544
|
+
const src = n.type === 'Video' ? n.props?.['poster'] : n.type === 'Image' ? n.props?.['src'] : null;
|
|
545
|
+
if (typeof src === 'string' && src.trim()) { found = src; return; }
|
|
546
|
+
}
|
|
547
|
+
for (const c of n.children ?? []) walk(c, here);
|
|
548
|
+
};
|
|
549
|
+
if (opening?.role === OpeningRole.Root) walk(opening, false);
|
|
550
|
+
return found;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
|
+
* HI3-D5 on a COMPOSED site: whether its header's words read at rest over the home opening's picture — the picture's pixels
|
|
555
|
+
* (`inventoryOf` its address: the caller holds them, the reading), the opening's scheme, in every mode the look offers
|
|
556
|
+
* and in both frames (`HEADER_REST_FRAMES`). Null — not judged — when the home page opens on no composed picture or its
|
|
557
|
+
* pixels are unknown (a placeholder, a stock picture not read yet). The ONE judgement the build (iox-cms, which then
|
|
558
|
+
* composes with `headerReadable`) and the Header studio's advice share. Pure.
|
|
559
|
+
*/
|
|
560
|
+
export function headerReadableOfSite(
|
|
561
|
+
site: { readonly pages: ReadonlyArray<HeaderRestPage>; readonly design: DesignChoices },
|
|
562
|
+
inventoryOf: (src: string) => PhotoInventory | null | undefined,
|
|
563
|
+
): boolean | null {
|
|
564
|
+
const home = site.pages.find(p => p.isHome === true) ?? site.pages.find(p => (typeof p.route === 'string' ? p.route : p.route?.path) === '/');
|
|
565
|
+
const src = openingPictureSrc(home?.layout?.[0]);
|
|
566
|
+
const inv = src ? inventoryOf(src) : null;
|
|
567
|
+
if (!inv) return null;
|
|
568
|
+
const inks = headerRestInks(site.design, home?.pageSettings?.opening ?? null);
|
|
569
|
+
return HEADER_REST_FRAMES.every(f => headerReadsAtRest(inv, f, inks, f.barPx));
|
|
570
|
+
}
|
|
571
|
+
|
|
361
572
|
// ── The recipe: the mix arranged from the contract's parts (§4 — ONE recipe for the palette and the generator) ────
|
|
362
573
|
|
|
363
574
|
const clone = <T>(v: T): T => JSON.parse(JSON.stringify(v));
|
|
@@ -518,6 +729,7 @@ export function distinctHeader(mix: HeaderMix, taken: ReadonlyArray<string>, ctx
|
|
|
518
729
|
|
|
519
730
|
type HeaderPlan = {
|
|
520
731
|
readonly business: { readonly name: string }; readonly design?: Readonly<Partial<DesignChoices>>;
|
|
732
|
+
readonly mixes?: { readonly opening?: ReadonlyArray<string> };
|
|
521
733
|
readonly pages: ReadonlyArray<{ readonly name: string; readonly route: string; readonly inNav?: boolean; readonly isHome?: boolean; readonly sections?: ReadonlyArray<{ readonly binding?: string }> }>;
|
|
522
734
|
};
|
|
523
735
|
|
|
@@ -528,14 +740,35 @@ export function shopPageOfPlan(plan: HeaderPlan): string | null {
|
|
|
528
740
|
return plan.pages.find(p => p.inNav && list && (p.sections ?? []).some(s => s.binding === list))?.route ?? null;
|
|
529
741
|
}
|
|
530
742
|
|
|
531
|
-
/**
|
|
532
|
-
*
|
|
533
|
-
export
|
|
743
|
+
/** What the site's facts add to a plan's header context (HI3): the kind of business's never words and whether the words
|
|
744
|
+
* read at rest over the opening's picture — known to the caller (the reading, the picture's pixels), never to the plan. */
|
|
745
|
+
export interface HeaderFacts {
|
|
746
|
+
readonly never?: HeaderNever | null;
|
|
747
|
+
readonly readableAtRest?: boolean | null;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/** HI3-D12: the plan's home opening as the header reads it — null when the plan names none (or one the table lacks). */
|
|
751
|
+
function headerOpeningOfPlan(plan: HeaderPlan): HeaderOpening | null {
|
|
752
|
+
try {
|
|
753
|
+
const mix = openingMixOfPlan(plan);
|
|
754
|
+
return mix ? { frame: mix.frame, media: mix.media } : null;
|
|
755
|
+
} catch (e) {
|
|
756
|
+
if (e instanceof OpeningMixError) return null;
|
|
757
|
+
throw e;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
/** The header context of a plan: its name, its look, its pages in the navigation, its shop page (found in the plan when
|
|
762
|
+
* not given), its home opening, and the site's facts. */
|
|
763
|
+
export function headerContextOfPlan(plan: HeaderPlan, shop?: string | null, facts: HeaderFacts = {}): HeaderContext {
|
|
534
764
|
return {
|
|
535
765
|
name: plan.business.name,
|
|
536
766
|
design: resolveDesignChoices(JSON.parse(JSON.stringify(plan.design ?? {}))),
|
|
537
767
|
pages: plan.pages.filter(p => p.inNav && !p.isHome && p.route !== '/').map(p => ({ name: p.name, route: p.route })),
|
|
538
768
|
shop: shop === undefined ? shopPageOfPlan(plan) : shop,
|
|
769
|
+
opening: headerOpeningOfPlan(plan),
|
|
770
|
+
...(facts.never ? { never: facts.never } : {}),
|
|
771
|
+
...(facts.readableAtRest !== undefined && facts.readableAtRest !== null ? { readableAtRest: facts.readableAtRest } : {}),
|
|
539
772
|
};
|
|
540
773
|
}
|
|
541
774
|
|
|
@@ -544,9 +777,9 @@ export function headerContextOfPlan(plan: HeaderPlan, shop?: string | null): Hea
|
|
|
544
777
|
* product draws it, judged against the site when the mix was chosen (`mixes.header`) — a stored header pattern (no mix)
|
|
545
778
|
* is worn as it always was (R-H4). With what was drawn as something else or mended, in words. Pure.
|
|
546
779
|
*/
|
|
547
|
-
export function wornHeaderOfPlan(plan: HeaderPlan & { readonly globals?: Readonly<Record<string, string>>; readonly mixes?: { readonly header?: ReadonlyArray<string> } }
|
|
548
|
-
{ mix: HeaderMix; context: HeaderContext; said: string[] } {
|
|
549
|
-
const context = headerContextOfPlan(plan);
|
|
780
|
+
export function wornHeaderOfPlan(plan: HeaderPlan & { readonly globals?: Readonly<Record<string, string>>; readonly mixes?: { readonly header?: ReadonlyArray<string> } },
|
|
781
|
+
facts: HeaderFacts = {}): { mix: HeaderMix; context: HeaderContext; said: string[] } {
|
|
782
|
+
const context = headerContextOfPlan(plan, undefined, facts);
|
|
550
783
|
const { drawn, gaps } = drawnHeaderMix(headerMixOfPlan(plan));
|
|
551
784
|
const checked = plan.mixes?.header?.length ? checkHeader(drawn, context) : { mix: drawn, repairs: [] };
|
|
552
785
|
const said = [...gaps.map(g => `the header's ${g.ingredient} "${g.word}" is drawn as "${g.drawnAs}" until ${g.phase}`), ...checked.repairs.map(r => r.said)];
|
|
@@ -557,8 +790,8 @@ export function wornHeaderOfPlan(plan: HeaderPlan & { readonly globals?: Readonl
|
|
|
557
790
|
* when nothing was mended, else with the new mix in `mixes.header`. Pure. */
|
|
558
791
|
export function withDistinctHeader<P extends HeaderPlan & {
|
|
559
792
|
readonly globals?: Readonly<Record<string, string>>; readonly mixes?: { readonly header?: ReadonlyArray<string>; readonly footer?: ReadonlyArray<string> };
|
|
560
|
-
}>(plan: P, taken: ReadonlyArray<string
|
|
561
|
-
const worn = wornHeaderOfPlan(plan);
|
|
793
|
+
}>(plan: P, taken: ReadonlyArray<string>, facts: HeaderFacts = {}): { plan: P; repairs: HeaderRepair[] } {
|
|
794
|
+
const worn = wornHeaderOfPlan(plan, facts);
|
|
562
795
|
const done = distinctHeader(worn.mix, taken, worn.context);
|
|
563
796
|
if (!done.repairs.length) return { plan, repairs: [] };
|
|
564
797
|
return { plan: { ...plan, mixes: { ...(plan.mixes ?? {}), header: headerMixWords(done.mix) } }, repairs: done.repairs };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ContentTypePlan, SitePlan, SitePlanSourceKind } from './site-plan.model';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* WHICH SAMPLE ITEMS ARE THE PLAN'S OWN, AND WHICH ARE NUMBERED PLACEHOLDERS (vectoriox/iox-ui#178). A generated site
|
|
5
|
+
* showed "Piece 2", "Product 2", "Room 2": the sample items of a content type whose plan gave no words for each item
|
|
6
|
+
* (the business's own products, rooms, team — neutral by `SAMPLE_CONTENT_RULE`, Doron 2026-11-01), every title its seed
|
|
7
|
+
* template (`"Product {n}"`) with the number filled in. Doron, 2026-11-28 — GHOST CARDS: those items stay in the data and
|
|
8
|
+
* every page and section stays; the builder draws such a row as an owner prompt ("Add your first room"), the live site
|
|
9
|
+
* never shows a list made only of them, and the Publishable gate ASKS about one still titled like a placeholder.
|
|
10
|
+
*
|
|
11
|
+
* This file is the reading both halves share: which items the PLAN fills (the composer, the proof) and how a stored item
|
|
12
|
+
* is recognised as a numbered placeholder (the gate, the renderers). Pure.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** The rule is about a plan the model wrote — a template's samples are its structure, an import's items are real. */
|
|
16
|
+
export function itemFillApplies(plan: Pick<SitePlan, 'source'>): boolean {
|
|
17
|
+
return plan.source?.kind === SitePlanSourceKind.Ai;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const TEMPLATE_NUMBER = /\{n\}/;
|
|
21
|
+
|
|
22
|
+
/** Whether the plan gives item `n` (1-based) of `type` its own title: a real item, or a sample with its own words. */
|
|
23
|
+
export function isFilledItem(type: ContentTypePlan, n: number): boolean {
|
|
24
|
+
const seed = type.seed;
|
|
25
|
+
if (!seed || n < 1 || n > seed.count) return false;
|
|
26
|
+
if (!seed.sample) return true;
|
|
27
|
+
const own = seed.perItem?.[type.roles.title]?.[n - 1];
|
|
28
|
+
return typeof own === 'string' && own.trim() !== '' && !TEMPLATE_NUMBER.test(own);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The numbers (1-based) of the items of `type` the plan fills. */
|
|
32
|
+
export function filledItemNumbers(type: ContentTypePlan): number[] {
|
|
33
|
+
const out: number[] = [];
|
|
34
|
+
for (let n = 1; n <= (type.seed?.count ?? 0); n++) if (isFilledItem(type, n)) out.push(n);
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** The content types of an AI plan whose samples are all numbered placeholders — the lists that start as ghost cards. */
|
|
39
|
+
export function placeholderContentTypes(plan: SitePlan): Set<string> {
|
|
40
|
+
if (!itemFillApplies(plan)) return new Set();
|
|
41
|
+
return new Set(plan.contentTypes.filter(t => t.seed?.sample && t.seed.count > 0 && !filledItemNumbers(t).length).map(t => t.name));
|
|
42
|
+
}
|
|
@@ -145,8 +145,39 @@ const MENU_WORDS: Readonly<Record<string, MenuWords>> = {
|
|
|
145
145
|
he: { menu: 'תפריט', close: 'סגירה', closeMenu: 'סגירת התפריט', more: 'עוד', home: 'בית' },
|
|
146
146
|
};
|
|
147
147
|
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
/** vectoriox/iox-ui#177: the words a menu button may be named, in order — the next is taken while a page of the site is
|
|
149
|
+
* called like the one before (a café's "Menu" page beside a "Menu" button: a visitor cannot tell which gives the food).
|
|
150
|
+
* Its Close is named with it. */
|
|
151
|
+
const MENU_BUTTON_LADDER: Readonly<Record<string, ReadonlyArray<Pick<MenuWords, 'menu' | 'closeMenu'>>>> = {
|
|
152
|
+
en: [{ menu: 'Menu', closeMenu: 'Close menu' }, { menu: 'Pages', closeMenu: 'Close pages' }, { menu: 'Navigation', closeMenu: 'Close navigation' }],
|
|
153
|
+
he: [{ menu: 'תפריט', closeMenu: 'סגירת התפריט' }, { menu: 'עמודים', closeMenu: 'סגירת העמודים' }, { menu: 'ניווט', closeMenu: 'סגירת הניווט' }],
|
|
154
|
+
};
|
|
155
|
+
/** The same for the bottom bar's More (a page called "More"). */
|
|
156
|
+
const MORE_LADDER: Readonly<Record<string, ReadonlyArray<string>>> = {
|
|
157
|
+
en: ['More', 'Other pages'],
|
|
158
|
+
he: ['עוד', 'עמודים נוספים'],
|
|
159
|
+
};
|
|
160
|
+
/** An article a page name may start with that does not make it another word ("The menu", "התפריט"). */
|
|
161
|
+
const LEADING_ARTICLE: Readonly<Record<string, RegExp>> = { en: /^(?:the|our)\s+/u, he: /^ה(?=\p{L}{2})/u };
|
|
162
|
+
|
|
163
|
+
/** One word of the navigation said the same way: case, stops and a leading article aside. */
|
|
164
|
+
function navWordKey(words: string, lang: string): string {
|
|
165
|
+
const plain = words.normalize('NFC').toLocaleLowerCase().replace(/[^\p{L}\p{N}\s]/gu, '').replace(/\s+/g, ' ').trim();
|
|
166
|
+
return plain.replace(LEADING_ARTICLE[lang] ?? /^$/u, '');
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/** The words of the menu's parts in the site's language. Given the labels of the pages it links to (iox-ui#177), the
|
|
170
|
+
* menu button (and its drawer and Close) and the bar's More never say a word a page is called: each takes the next word
|
|
171
|
+
* of its ladder. */
|
|
172
|
+
export function menuWords(locale: string | undefined, labels: ReadonlyArray<string> = []): MenuWords {
|
|
173
|
+
const lang = MENU_WORDS[commerceLanguage(locale)] ? commerceLanguage(locale) : 'en';
|
|
174
|
+
const base = MENU_WORDS[lang];
|
|
175
|
+
if (!labels.length) return base;
|
|
176
|
+
const taken = new Set(labels.map(l => navWordKey(l, lang)));
|
|
177
|
+
const free = (w: string) => !taken.has(navWordKey(w, lang));
|
|
178
|
+
const buttons = MENU_BUTTON_LADDER[lang];
|
|
179
|
+
const mores = MORE_LADDER[lang];
|
|
180
|
+
return { ...base, ...(buttons.find(b => free(b.menu)) ?? buttons[buttons.length - 1]), more: mores.find(free) ?? mores[mores.length - 1] };
|
|
150
181
|
}
|
|
151
182
|
|
|
152
183
|
/** The layer names of the parts (R2: the tree, the breadcrumb and the toolbar read them). */
|
|
@@ -467,12 +498,9 @@ const WORD_BUTTON_LAY = { width: 'auto', minWidth: '48px' };
|
|
|
467
498
|
|
|
468
499
|
/** What a menu button shows for its kind — closed (the menu button) or open (the drawer's Close, which lands where the
|
|
469
500
|
* menu button is): the list icon and an X, the nine dots and an X (the shared CSS draws both as dots), or the word. */
|
|
470
|
-
function buttonFace(kit: Kit, suffix: string, kind: MenuButtonKind, open: boolean,
|
|
501
|
+
function buttonFace(kit: Kit, suffix: string, kind: MenuButtonKind, open: boolean, words: MenuWords): SerializedNode[] {
|
|
471
502
|
switch (kind) {
|
|
472
|
-
case MenuButtonKind.Word: {
|
|
473
|
-
const words = menuWords(locale);
|
|
474
|
-
return [labelText(kit, `${suffix}-word`, open ? words.close : words.menu)];
|
|
475
|
-
}
|
|
503
|
+
case MenuButtonKind.Word: return [labelText(kit, `${suffix}-word`, open ? words.close : words.menu)];
|
|
476
504
|
case MenuButtonKind.Dots: return [iconNode(kit, `${suffix}-dots`, open ? CLOSE_ICON : DOTS_ICON)];
|
|
477
505
|
default: return [iconNode(kit, `${suffix}-icon`, open ? CLOSE_ICON : MENU_ICON)];
|
|
478
506
|
}
|
|
@@ -480,12 +508,12 @@ function buttonFace(kit: Kit, suffix: string, kind: MenuButtonKind, open: boolea
|
|
|
480
508
|
|
|
481
509
|
/** Give a menu button (or the drawer's Close) a kind. The same kind keeps the author's children; another kind gets that
|
|
482
510
|
* kind's face and size. */
|
|
483
|
-
function dressButton(kit: Kit, btn: SerializedNode, suffix: string, kind: MenuButtonKind, open: boolean,
|
|
511
|
+
function dressButton(kit: Kit, btn: SerializedNode, suffix: string, kind: MenuButtonKind, open: boolean, words: MenuWords): void {
|
|
484
512
|
const was = menuButtonOf(btn.props?.[MenuTrait.Button]);
|
|
485
513
|
const { [MenuTrait.Button]: _drop, ...props } = btn.props ?? {};
|
|
486
514
|
btn.props = { ...props, ...menuButtonProps(kind) };
|
|
487
515
|
if (was === kind) return;
|
|
488
|
-
btn.children = buttonFace(kit, suffix, kind, open,
|
|
516
|
+
btn.children = buttonFace(kit, suffix, kind, open, words);
|
|
489
517
|
if (kind === MenuButtonKind.Word) Object.assign(btn.styleProps, WORD_BUTTON_LAY);
|
|
490
518
|
else if (was === MenuButtonKind.Word) Object.assign(btn.styleProps, { width: MENU_BUTTON_LAY.width, minWidth: ICON_BUTTON_MIN_WIDTH });
|
|
491
519
|
}
|
|
@@ -494,12 +522,12 @@ function dressButton(kit: Kit, btn: SerializedNode, suffix: string, kind: MenuBu
|
|
|
494
522
|
const ICON_BUTTON_MIN_WIDTH = String(createSerializedNode('min-width', BUTTON, { tag: 'button' }, 'button-ghost', COMPOSED).styleProps['minWidth'] ?? '0px');
|
|
495
523
|
|
|
496
524
|
/** Put a look on a header's menu: the drawer's traits, and the menu button's and the Close's kind. */
|
|
497
|
-
function dressMenu(kit: Kit, dr: SerializedNode | null, menu: SerializedNode | null, look: Partial<MenuLook>,
|
|
525
|
+
function dressMenu(kit: Kit, dr: SerializedNode | null, menu: SerializedNode | null, look: Partial<MenuLook>, words: MenuWords): void {
|
|
498
526
|
if (dr) dressDrawer(dr, look);
|
|
499
527
|
if (!look.button) return;
|
|
500
|
-
if (menu) dressButton(kit, menu, 'menu', look.button, false,
|
|
528
|
+
if (menu) dressButton(kit, menu, 'menu', look.button, false, words);
|
|
501
529
|
const close = dr ? find([dr], NavRole.DrawerClose) : null;
|
|
502
|
-
if (close) dressButton(kit, close, 'drawer-close', look.button, true,
|
|
530
|
+
if (close) dressButton(kit, close, 'drawer-close', look.button, true, words);
|
|
503
531
|
}
|
|
504
532
|
|
|
505
533
|
function barItem(kit: Kit, i: number, page: NavPage): SerializedNode {
|
|
@@ -655,10 +683,10 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
|
|
|
655
683
|
const everyWidth = shape === NavShape.Drawer && (options.everyWidth ?? wasEveryWidth);
|
|
656
684
|
if (options.everyWidth && shape !== NavShape.Drawer) throw new NavShapeError('only a drawer menu shows at every width');
|
|
657
685
|
const kit = makeKit(out, root.id, options.newId);
|
|
658
|
-
const words = menuWords(options.locale);
|
|
659
686
|
|
|
660
687
|
adoptRoles(root);
|
|
661
688
|
const { pages } = phoneMenuPages(root, options.pages);
|
|
689
|
+
const words = menuWords(options.locale, pages.map(p => p.label));
|
|
662
690
|
const wantDrawer = shape !== NavShape.Bar;
|
|
663
691
|
const wantBar = shape !== NavShape.Drawer;
|
|
664
692
|
const wantMenuButton = shape === NavShape.Drawer;
|
|
@@ -704,7 +732,7 @@ export function planNavShape(globals: ReadonlyArray<SerializedNode>, shape: NavS
|
|
|
704
732
|
placeMenu(root, menu, (options.menuSide as MenuSide | undefined) ?? null, was);
|
|
705
733
|
}
|
|
706
734
|
// HI2a: the menu's look, when one is asked (the composer's header recipe; the Header studio later).
|
|
707
|
-
if (options.look) dressMenu(kit, dr, menu, options.look,
|
|
735
|
+
if (options.look) dressMenu(kit, dr, menu, options.look, words);
|
|
708
736
|
if (dr && shape === NavShape.Drawer) kids.push(dr);
|
|
709
737
|
if (dr && shape === NavShape.Both) {
|
|
710
738
|
dr.isGlobal = true;
|
|
@@ -789,8 +817,9 @@ export function addBarItem(globals: ReadonlyArray<SerializedNode>, options: Pick
|
|
|
789
817
|
const kids = b.children ?? (b.children = []);
|
|
790
818
|
if (kids.length >= BAR_ITEMS_MAX) return { globals: out, added: false };
|
|
791
819
|
const linked = new Set(kids.filter(c => c.role === NavRole.BarItem).map(c => prop(c, 'pageRoute')));
|
|
792
|
-
const
|
|
793
|
-
const
|
|
820
|
+
const sitePages = phoneMenuPages(root, options.pages).pages;
|
|
821
|
+
const words = menuWords(options.locale, sitePages.map(p => p.label));
|
|
822
|
+
const page = barPages(root, sitePages, BAR_ITEMS_MAX + 1, words).find(p => !linked.has(p.route))
|
|
794
823
|
?? { label: words.home, route: HOME_ROUTE };
|
|
795
824
|
const item = barItem(makeKit(out, root.id, options.newId), kids.length, page);
|
|
796
825
|
const more = kids.findIndex(c => c.role === NavRole.More);
|
|
@@ -456,6 +456,9 @@ export enum OpeningRepairCode {
|
|
|
456
456
|
ProOnly = 'pro-only',
|
|
457
457
|
/** The name behind the subject needs a cut-out picture: the name, large. */
|
|
458
458
|
NeedsCutOut = 'needs-cut-out',
|
|
459
|
+
/** J10 lever (b): a looping film is the owner's own clip — a build with none draws a picture there, which the owner's
|
|
460
|
+
* photo, a made picture or stock can fill (an empty Video was never offered to any of them). */
|
|
461
|
+
FilmIsTheOwners = 'film-is-the-owners',
|
|
459
462
|
/** "The film is the message" needs a film or pictures that move: a heading. */
|
|
460
463
|
NoneNeedsFilm = 'none-needs-film',
|
|
461
464
|
/** Words placed apart need two or three of them. */
|
|
@@ -489,6 +492,9 @@ export interface OpeningContext {
|
|
|
489
492
|
readonly tier?: `${GenerationTier}`;
|
|
490
493
|
/** The owner gives a cut-out picture (a transparent background) for the name behind the subject. */
|
|
491
494
|
readonly cutOut?: boolean;
|
|
495
|
+
/** J10 lever (b): the owner's own clip plays in the first screen. `false` = none (a build: its film is drawn as a
|
|
496
|
+
* picture, said), absent = a placeholder the owner fills (the builder). */
|
|
497
|
+
readonly film?: boolean;
|
|
492
498
|
/** The owner's own badge words; `null` = none given (the generator: left out), absent = a placeholder (the builder). */
|
|
493
499
|
readonly badge?: string | null;
|
|
494
500
|
}
|
|
@@ -552,6 +558,10 @@ export function checkOpening(mix: OpeningMix, ctx: OpeningContext): { mix: Openi
|
|
|
552
558
|
say(OpeningRepairCode.ProOnly, `"${openingMeaning(k, word)}" comes with the award plan: ${openingMeaning(k, tierStandIn(k))} instead`);
|
|
553
559
|
}
|
|
554
560
|
}
|
|
561
|
+
if (m.media === OpeningMedia.Film && ctx.film === false) {
|
|
562
|
+
m.media = OpeningMedia.Photo;
|
|
563
|
+
say(OpeningRepairCode.FilmIsTheOwners, 'a looping film is the owner\'s own clip, and there is none yet: a picture stands in, filled by their photo or one that fits the business');
|
|
564
|
+
}
|
|
555
565
|
if (m.words === OpeningWords.Behind && !ctx.cutOut) {
|
|
556
566
|
m.words = OpeningWords.Wordmark;
|
|
557
567
|
say(OpeningRepairCode.NeedsCutOut, 'the name behind the subject needs a cut-out picture: the name, large, until there is one');
|
|
@@ -28,6 +28,7 @@ export * from './validate-site-plan';
|
|
|
28
28
|
export * from './compose-site';
|
|
29
29
|
export * from './contact-facts';
|
|
30
30
|
export * from './nav-shape';
|
|
31
|
+
export * from './item-fill';
|
|
31
32
|
export * from './entrances';
|
|
32
33
|
export * from './text-scroll';
|
|
33
34
|
export * from './plan-data';
|
|
@@ -71,6 +72,7 @@ export * from './free-fallback';
|
|
|
71
72
|
export * from './free-slots';
|
|
72
73
|
export * from './compose-free';
|
|
73
74
|
export * from './free-render-check';
|
|
75
|
+
export * from './free-opening';
|
|
74
76
|
export * from './prompt-limits';
|
|
75
77
|
export * from './layout-photos';
|
|
76
78
|
export * from './photo-inventory';
|
|
@@ -338,6 +338,10 @@ export interface BuildComposeDecisions {
|
|
|
338
338
|
legal?: LegalContext | null;
|
|
339
339
|
/** The reading's kind of business (harness-core id): calm (AW6), the footer's call word and what it never wears (AW12). */
|
|
340
340
|
businessType?: string | null;
|
|
341
|
+
/** HI3-D5: the preflight's judgement of the header's words at rest over the home opening's picture
|
|
342
|
+
* (`headerReadableOfSite`, where the picture's pixels are known) — every compose of the run takes the same answer.
|
|
343
|
+
* Absent or null: not judged. */
|
|
344
|
+
headerReadable?: boolean | null;
|
|
341
345
|
}
|
|
342
346
|
|
|
343
347
|
/** The run as `GET …/site-builds/:id` (and `?latest=1`) answers it. */
|