@vectoriox/iox-ui 5.195.0 → 5.196.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 +12 -2
- package/design-core/index.d.ts +353 -8
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +26 -4
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +711 -264
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +642 -498
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +221 -2
- 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 +70 -17
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +183 -93
- package/harness-core/index.d.ts +165 -3
- 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/design-core/contrast-audit.ts +38 -0
- package/src/design-core/flavor-spec.generated.ts +275 -1
- package/src/design-core/header-behaviour.ts +172 -3
- package/src/design-core/node-classes.ts +9 -2
- package/src/generation-core/compose-site.ts +25 -8
- package/src/generation-core/header-mix.ts +165 -12
- package/src/generation-core/site-spec.generated.ts +41 -9
- 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 +9 -3
- package/src/identity-core/site-auth-transport.ts +11 -4
- package/styles/iox-design.css +148 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { carryInto, swapParts, type PageCarry } from './carry';
|
|
2
2
|
import {
|
|
3
|
-
AnimateId, COLOR_SCHEME_TRAIT, COLOR_SCHEMES, ColorScheme, colorSchemeClass, DEFAULT_MENU_LOOK, DesignChoices, LinkType, MenuLook, motionLanguageForPlan, resolveDesignChoices, setColorScheme, headerInkOf,
|
|
3
|
+
AnimateId, COLOR_SCHEME_TRAIT, COLOR_SCHEMES, ColorScheme, colorSchemeClass, DEFAULT_MENU_LOOK, DesignChoices, LinkType, MenuLook, motionLanguageForPlan, resolveDesignChoices, setColorScheme, headerGroundOf, headerInkOf,
|
|
4
4
|
columnWordOf,
|
|
5
5
|
} from '@vectoriox/iox-ui/design-core';
|
|
6
6
|
import { fitSeoText, SEO_DESCRIPTION_MAX, SEO_TITLE_MAX, SeoRawDoc } from '@vectoriox/iox-ui/seo-core';
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
AccordionAutoBinds, CompositeNodeSpec, findByRole, LIGHTBOX_LABEL, SLIDE_TO_ROW, SLIDE_TYPE, buildTabsRecipe, tabLabelNodeOf,
|
|
12
12
|
tabPanelImageOf, tabPanelTextOf, tabsListOf, tabsPanels, tabsPanelsOf, tabsTriggers, TABS_CONTENT_LIMIT, TABS_IMAGE_BIND_PROP, TABS_LABEL_BIND_PROP,
|
|
13
13
|
TABS_TEXT_BIND_PROP, tabsWords, TabsAutoBinds, BadgeTone, BADGE_TONES, buildSegmentedRecipe, CardWords, ITEM_OPEN_STATE, segmentedOptions,
|
|
14
|
-
setHeaderBehaviour, setHeaderInk, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget, ACCOUNT_RECIPES, AccountRecipe, AccountRole,
|
|
14
|
+
setHeaderBehaviour, setHeaderGround, setHeaderInk, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget, ACCOUNT_RECIPES, AccountRecipe, AccountRole,
|
|
15
15
|
buildConsentRecipe, ConsentActionType, CarouselFrom, carouselQuoteLabel, CAROUSEL_QUOTE_LABELS, pickCarouselAutoBinds,
|
|
16
16
|
} from '@vectoriox/iox-ui/composite-core';
|
|
17
17
|
import { ConsentCategory } from '@vectoriox/iox-ui/consent-core';
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
checkOpening, drawnOpeningMix, OpeningContext, openingIsTypeLed, openingMix, OpeningMix, openingMixOfPlan, openingRecipe, OpeningRole, stampOpeningMix,
|
|
29
29
|
stampOpeningMotion, TYPE_LED_OPTIONAL_PARTS, typeLedOpeningSection,
|
|
30
30
|
} from './opening-mix';
|
|
31
|
-
import { checkHeader, drawnHeaderMix, HeaderContext, headerContextOfPlan, HeaderIngredient, headerMix, HeaderMix, headerRecipe, HeaderRecipe, stampHeaderMix, wornHeaderOfPlan } from './header-mix';
|
|
31
|
+
import { checkHeader, drawnHeaderMix, HeaderContext, headerContextOfPlan, HeaderFacts, HeaderIngredient, HeaderNever, HeaderOpening, headerMix, HeaderMix, headerRecipe, HeaderRecipe, stampHeaderMix, wornHeaderOfPlan } from './header-mix';
|
|
32
32
|
import { bodyMixOfPlan, checkBody, drawnBodyMix, joinPageHeader, wearBodyMix } from './body-mix';
|
|
33
33
|
import { checkPopup, composePopup, POPUP_GLOBAL_ID } from './popup-plan';
|
|
34
34
|
import { NODE_BASELINES } from './node-baselines.generated';
|
|
@@ -178,6 +178,12 @@ export interface ComposeContext {
|
|
|
178
178
|
/** AW12-D10: what that kind of business's footer never wears (harness-core `BusinessType.footer`) — `checkFooter`
|
|
179
179
|
* mends it, said. Absent = nothing refused. */
|
|
180
180
|
footerNever?: FooterNever;
|
|
181
|
+
/** HI3-D12: what that kind of business never stands its header on (harness-core `BusinessType.header`) — `checkHeader`
|
|
182
|
+
* mends it to its own ground, said. Absent = nothing refused. */
|
|
183
|
+
headerNever?: HeaderNever;
|
|
184
|
+
/** HI3-D5: whether the header's words read at rest over the home opening's picture (`headerReadsAtRest`, judged where
|
|
185
|
+
* the picture's pixels are). Absent = not judged. */
|
|
186
|
+
headerReadable?: boolean;
|
|
181
187
|
/** AW1: what the studio holds that decides its legal pages and banner (country, trackers, its own legal pages, its
|
|
182
188
|
* routes, a banner it keeps). Absent = only what the plan and the composed pages say (no tracker, no country). */
|
|
183
189
|
legal?: LegalContext;
|
|
@@ -1977,7 +1983,10 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
|
|
|
1977
1983
|
for (const r of footer.repairs) issues.push({ code: ComposeIssueCode.FooterMended, nodeId: GlobalSlot.Footer, owner: GlobalSlot.Footer, detail: r.said });
|
|
1978
1984
|
// HI1: the header is the plan's header MIX (a stored pattern id is read as one), drawn as the product draws it, checked
|
|
1979
1985
|
// against the site and arranged from the contract's header parts; each mend is said.
|
|
1980
|
-
const header = planHeader(plan
|
|
1986
|
+
const header = planHeader(plan, {
|
|
1987
|
+
...(context?.headerNever ? { never: context.headerNever } : {}),
|
|
1988
|
+
...(context?.headerReadable !== undefined ? { readableAtRest: context.headerReadable } : {}),
|
|
1989
|
+
});
|
|
1981
1990
|
for (const said of header.said) issues.push({ code: ComposeIssueCode.HeaderMended, nodeId: GlobalSlot.Header, owner: GlobalSlot.Header, detail: said });
|
|
1982
1991
|
const patternOf = (slot: GlobalSlot): SitePattern => slot === GlobalSlot.Footer
|
|
1983
1992
|
? footerPattern(footer.mix, footerContext)
|
|
@@ -2006,6 +2015,8 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
|
|
|
2006
2015
|
if (headerRoot) stampHeaderMix(headerRoot, header.recipe.mix);
|
|
2007
2016
|
// AW6 (AW6-D10): a header whose ink follows the sections says so (the renderers' header ink runtime reads it).
|
|
2008
2017
|
if (headerRoot) setHeaderInk(headerRoot as unknown as CompositeNode, headerInkOf(header.recipe.mix[HeaderIngredient.Ink]));
|
|
2018
|
+
// HI3 (HI3-D1): what the header stands on — over the opening, glass, or its own ground — the same edit the Header section makes.
|
|
2019
|
+
if (headerRoot) setHeaderGround(headerRoot as unknown as CompositeNode, headerGroundOf(header.recipe.mix[HeaderIngredient.Ground]));
|
|
2009
2020
|
// AW12: the footer root says the mix it was composed as (the classes iox-design.css draws from); an inset one is a card.
|
|
2010
2021
|
const footerRoot = globals.find(g => g.id === GlobalSlot.Footer);
|
|
2011
2022
|
if (footerRoot) stampFooterMix(footerRoot as unknown as { props: Record<string, unknown>; styleProps?: Record<string, unknown> }, footer.mix);
|
|
@@ -2236,8 +2247,8 @@ function composeLegal(plan: SitePlan, context: LegalContext, pages: ReadonlyArra
|
|
|
2236
2247
|
|
|
2237
2248
|
/** A plan's header (HI1): its mix as the product draws it, checked against the site, and the recipe to stamp — with what
|
|
2238
2249
|
* was mended or drawn as something else, in words. */
|
|
2239
|
-
export function planHeader(plan: SitePlan): { recipe: HeaderRecipe; context: HeaderContext; said: string[] } {
|
|
2240
|
-
const { mix, context, said } = wornHeaderOfPlan(plan);
|
|
2250
|
+
export function planHeader(plan: SitePlan, facts: HeaderFacts = {}): { recipe: HeaderRecipe; context: HeaderContext; said: string[] } {
|
|
2251
|
+
const { mix, context, said } = wornHeaderOfPlan(plan, facts);
|
|
2241
2252
|
return { recipe: headerRecipe(mix, context), context, said };
|
|
2242
2253
|
}
|
|
2243
2254
|
|
|
@@ -2304,6 +2315,10 @@ export interface NavHeaderInput {
|
|
|
2304
2315
|
readonly asAsked?: boolean;
|
|
2305
2316
|
/** HI1b: the site sells — the header holds the account entry and the bag, as `composeSite` gives a selling site's. */
|
|
2306
2317
|
readonly storeSlots?: boolean;
|
|
2318
|
+
/** HI3-D10: the Home's opening as the studio reads it (`openingMediaOf` of its first section: a full picture is
|
|
2319
|
+
* `{ frame: 'full', media: 'photo' }`; null = it opens plain). Absent: not judged — a header over the opening is kept
|
|
2320
|
+
* as chosen (the builder knows the page; a studio with no Site Plan has no plan opening to read). */
|
|
2321
|
+
readonly opening?: HeaderOpening | null;
|
|
2307
2322
|
}
|
|
2308
2323
|
|
|
2309
2324
|
export interface NavHeaderOptions {
|
|
@@ -2386,7 +2401,8 @@ function navHeaderPlan(input: Omit<NavHeaderInput, 'mix' | 'asAsked'>): SitePlan
|
|
|
2386
2401
|
|
|
2387
2402
|
/** What a studio's header is judged against (`checkHeader`) — the same context `composeNavHeader` checks with. */
|
|
2388
2403
|
export function navHeaderContext(input: Omit<NavHeaderInput, 'mix' | 'asAsked'>): HeaderContext {
|
|
2389
|
-
|
|
2404
|
+
const { opening: _plan, ...context } = headerContextOfPlan(navHeaderPlan(input), input.shop ?? null);
|
|
2405
|
+
return input.opening === undefined ? context : { ...context, opening: input.opening };
|
|
2390
2406
|
}
|
|
2391
2407
|
|
|
2392
2408
|
export function composeNavHeader(input: NavHeaderInput, options: NavHeaderOptions): ComposedNavHeader {
|
|
@@ -2396,7 +2412,7 @@ export function composeNavHeader(input: NavHeaderInput, options: NavHeaderOption
|
|
|
2396
2412
|
const email = nonEmpty(input.business.facts?.email) ? input.business.facts!.email!.trim() : null;
|
|
2397
2413
|
const issues: ComposeIssue[] = [];
|
|
2398
2414
|
// HI1: ONE recipe with composeSite — the mix drawn as the product draws it, checked against this studio, arranged.
|
|
2399
|
-
const context =
|
|
2415
|
+
const context = navHeaderContext(input);
|
|
2400
2416
|
const { drawn, gaps } = drawnHeaderMix(input.mix ?? headerMix());
|
|
2401
2417
|
// R-H4: the Studio header (no mix asked) composes as it always did; a chosen mix is judged against the studio.
|
|
2402
2418
|
const checked = input.mix && !input.asAsked ? checkHeader(drawn, context) : { mix: drawn, repairs: [] };
|
|
@@ -2417,6 +2433,7 @@ export function composeNavHeader(input: NavHeaderInput, options: NavHeaderOption
|
|
|
2417
2433
|
if (pattern.header) setHeaderBehaviour(header as unknown as CompositeNode, pattern.header.behaviour, pattern.header.edge ?? null);
|
|
2418
2434
|
stampHeaderMix(header, recipe.mix);
|
|
2419
2435
|
setHeaderInk(header as unknown as CompositeNode, headerInkOf(recipe.mix[HeaderIngredient.Ink]));
|
|
2436
|
+
setHeaderGround(header as unknown as CompositeNode, headerGroundOf(recipe.mix[HeaderIngredient.Ground]));
|
|
2420
2437
|
if (input.storeSlots) withStoreSlots(header, input.locale ?? DEFAULT_SITE_LOCALE);
|
|
2421
2438
|
return { header, issues, mix: checked.mix, companions };
|
|
2422
2439
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
DesignChoices, elementStyleFace, HeaderTrait, MenuForm, menuButtonOf, menuFormOf, menuHoverOf, MenuLook, MenuPhoneForm,
|
|
2
|
+
DesignChoices, elementStyleFace, HeaderGround, headerGroundIsGlass, headerGroundIsOver, HeaderTrait, MenuForm, menuButtonOf, menuFormOf, menuHoverOf, MenuLook, MenuPhoneForm,
|
|
3
|
+
menuRevealOf, parseHexColor, resolveDesignChoices, 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 } 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,97 @@ 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-D2: does the look carry a header glass set (Pop draws its own solid bar). */
|
|
411
|
+
export function lookHasGlass(design: Pick<DesignChoices, 'flavorId'>): boolean {
|
|
412
|
+
return RULES.glassFlavors.includes(design.flavorId);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/** The ground rules (HI3-D2, D5, D9, D12), in order: the kind of business, the opening, the words at rest, the look's
|
|
416
|
+
* glass, then the edge glass does not draw. */
|
|
417
|
+
function mendGround(m: HeaderMix, ctx: HeaderContext, say: (code: HeaderRepairCode, said: string) => void): void {
|
|
418
|
+
const glass = lookHasGlass(ctx.design);
|
|
419
|
+
if (headerGroundIsOver(m.ground) && ctx.never?.grounds.includes(m.ground)) {
|
|
420
|
+
const why = ctx.never.say?.length ? ` — ${ctx.never.say.join(' ')}` : '';
|
|
421
|
+
m.ground = HeaderGround.Solid;
|
|
422
|
+
say(HeaderRepairCode.TypeNever, `this kind of business keeps its header on its own ground, never over the opening's picture${why}`);
|
|
423
|
+
}
|
|
424
|
+
if (headerGroundIsOver(m.ground) && ctx.opening !== undefined && !opensOnPicture(ctx.opening)) {
|
|
425
|
+
m.ground = HeaderGround.Solid;
|
|
426
|
+
say(HeaderRepairCode.OverPlain, 'the home page does not open on a full picture the header can stand over: it keeps its own ground');
|
|
427
|
+
}
|
|
428
|
+
if (headerGroundIsOver(m.ground) && ctx.readableAtRest === false) {
|
|
429
|
+
m.ground = glass ? HeaderGround.Glass : HeaderGround.Solid;
|
|
430
|
+
say(HeaderRepairCode.OverUnreadable, glass ? "the header's words do not read over the opening's picture: it stands on its glass from the top"
|
|
431
|
+
: "the header's words do not read over the opening's picture: it keeps its own ground");
|
|
432
|
+
}
|
|
433
|
+
if (headerGroundIsGlass(m.ground) && !glass) {
|
|
434
|
+
m.ground = m.ground === HeaderGround.OverGlass ? HeaderGround.Over : HeaderGround.Solid;
|
|
435
|
+
say(HeaderRepairCode.NoGlass, m.ground === HeaderGround.Over ? 'this look has no glass: over the opening, then its own solid bar'
|
|
436
|
+
: 'this look has no glass: the header keeps its own solid bar');
|
|
437
|
+
}
|
|
438
|
+
if (m.ground === HeaderGround.Over && RULES.glassIsOwnBar.includes(ctx.design.flavorId)) {
|
|
439
|
+
m.ground = HeaderGround.OverGlass;
|
|
440
|
+
say(HeaderRepairCode.GlassOwnBar, "in this look the header's own bar is glass: over the opening, then glass");
|
|
441
|
+
}
|
|
442
|
+
if (RULES.noEdgeGrounds.includes(m.ground) && m.edge !== 'none') {
|
|
443
|
+
m.edge = 'none';
|
|
444
|
+
say(HeaderRepairCode.GlassEdge, 'glass carries its own hairline and shadow: no scroll edge');
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// ── The words at rest over the opening (HI3-D5) ─────────────────────────────────────────────────────────────────────
|
|
449
|
+
|
|
450
|
+
/** 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
|
|
451
|
+
* under it — read at the words' line, the bar's middle (the board's measure, hi3-glass.build.mjs). */
|
|
452
|
+
export const HEADER_BAR_PX = 80;
|
|
453
|
+
export const HEADER_VEIL = Object.freeze({ top: 0.32, extendPx: 24 });
|
|
454
|
+
/** WCAG AA for the bar's words (small text). */
|
|
455
|
+
const AA_TEXT = 4.5;
|
|
456
|
+
const GRID_COLUMNS = 12;
|
|
457
|
+
|
|
458
|
+
/** The veil's alpha at the words' line of a `barPx` bar. */
|
|
459
|
+
export function headerVeilAt(barPx = HEADER_BAR_PX): number {
|
|
460
|
+
return HEADER_VEIL.top * (1 - (barPx / 2) / (barPx + HEADER_VEIL.extendPx));
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
const toGamma = (linear: number): number => (linear <= 0.0031308 ? 12.92 * linear : 1.055 * Math.pow(linear, 1 / 2.4) - 0.055);
|
|
464
|
+
|
|
465
|
+
/** One look's words at rest: their ink and the ground the veil is made of (the opening scheme's, in one mode). */
|
|
466
|
+
export interface HeaderRestInk {
|
|
467
|
+
readonly ink: string;
|
|
468
|
+
readonly veilGround: string;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* 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
|
|
473
|
+
* frame crops the picture (`calmUnder`), column by column across the bar, each read as its mean light with the veil laid
|
|
474
|
+
* over it — in EVERY mode the look offers (`inks`, one per mode; a film is judged on its poster). The weakest column
|
|
475
|
+
* decides. Pure.
|
|
476
|
+
*/
|
|
477
|
+
export function headerReadsAtRest(inv: PhotoInventory, frame: { w: number; h: number }, inks: ReadonlyArray<HeaderRestInk>, barPx = HEADER_BAR_PX): boolean {
|
|
478
|
+
const veil = headerVeilAt(barPx);
|
|
479
|
+
const band = Math.min(1, Math.max(0, barPx / Math.max(1, frame.h)));
|
|
480
|
+
for (const { ink, veilGround } of inks) {
|
|
481
|
+
const v = parseHexColor(veilGround);
|
|
482
|
+
if (!v || !parseHexColor(ink)) return false;
|
|
483
|
+
for (let i = 0; i < GRID_COLUMNS; i++) {
|
|
484
|
+
const grey = toGamma(calmUnder(inv, frame, { x0: i / GRID_COLUMNS, x1: (i + 1) / GRID_COLUMNS, y0: 0, y1: band }).luminance);
|
|
485
|
+
const under = { r: veil * v.r + (1 - veil) * grey, g: veil * v.g + (1 - veil) * grey, b: veil * v.b + (1 - veil) * grey };
|
|
486
|
+
if (wcagContrastRatio(ink, under) < AA_TEXT) return false;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
return true;
|
|
490
|
+
}
|
|
491
|
+
|
|
361
492
|
// ── The recipe: the mix arranged from the contract's parts (§4 — ONE recipe for the palette and the generator) ────
|
|
362
493
|
|
|
363
494
|
const clone = <T>(v: T): T => JSON.parse(JSON.stringify(v));
|
|
@@ -518,6 +649,7 @@ export function distinctHeader(mix: HeaderMix, taken: ReadonlyArray<string>, ctx
|
|
|
518
649
|
|
|
519
650
|
type HeaderPlan = {
|
|
520
651
|
readonly business: { readonly name: string }; readonly design?: Readonly<Partial<DesignChoices>>;
|
|
652
|
+
readonly mixes?: { readonly opening?: ReadonlyArray<string> };
|
|
521
653
|
readonly pages: ReadonlyArray<{ readonly name: string; readonly route: string; readonly inNav?: boolean; readonly isHome?: boolean; readonly sections?: ReadonlyArray<{ readonly binding?: string }> }>;
|
|
522
654
|
};
|
|
523
655
|
|
|
@@ -528,14 +660,35 @@ export function shopPageOfPlan(plan: HeaderPlan): string | null {
|
|
|
528
660
|
return plan.pages.find(p => p.inNav && list && (p.sections ?? []).some(s => s.binding === list))?.route ?? null;
|
|
529
661
|
}
|
|
530
662
|
|
|
531
|
-
/**
|
|
532
|
-
*
|
|
533
|
-
export
|
|
663
|
+
/** What the site's facts add to a plan's header context (HI3): the kind of business's never words and whether the words
|
|
664
|
+
* read at rest over the opening's picture — known to the caller (the reading, the picture's pixels), never to the plan. */
|
|
665
|
+
export interface HeaderFacts {
|
|
666
|
+
readonly never?: HeaderNever | null;
|
|
667
|
+
readonly readableAtRest?: boolean | null;
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
/** HI3-D12: the plan's home opening as the header reads it — null when the plan names none (or one the table lacks). */
|
|
671
|
+
function headerOpeningOfPlan(plan: HeaderPlan): HeaderOpening | null {
|
|
672
|
+
try {
|
|
673
|
+
const mix = openingMixOfPlan(plan);
|
|
674
|
+
return mix ? { frame: mix.frame, media: mix.media } : null;
|
|
675
|
+
} catch (e) {
|
|
676
|
+
if (e instanceof OpeningMixError) return null;
|
|
677
|
+
throw e;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/** The header context of a plan: its name, its look, its pages in the navigation, its shop page (found in the plan when
|
|
682
|
+
* not given), its home opening, and the site's facts. */
|
|
683
|
+
export function headerContextOfPlan(plan: HeaderPlan, shop?: string | null, facts: HeaderFacts = {}): HeaderContext {
|
|
534
684
|
return {
|
|
535
685
|
name: plan.business.name,
|
|
536
686
|
design: resolveDesignChoices(JSON.parse(JSON.stringify(plan.design ?? {}))),
|
|
537
687
|
pages: plan.pages.filter(p => p.inNav && !p.isHome && p.route !== '/').map(p => ({ name: p.name, route: p.route })),
|
|
538
688
|
shop: shop === undefined ? shopPageOfPlan(plan) : shop,
|
|
689
|
+
opening: headerOpeningOfPlan(plan),
|
|
690
|
+
...(facts.never ? { never: facts.never } : {}),
|
|
691
|
+
...(facts.readableAtRest !== undefined && facts.readableAtRest !== null ? { readableAtRest: facts.readableAtRest } : {}),
|
|
539
692
|
};
|
|
540
693
|
}
|
|
541
694
|
|
|
@@ -544,9 +697,9 @@ export function headerContextOfPlan(plan: HeaderPlan, shop?: string | null): Hea
|
|
|
544
697
|
* product draws it, judged against the site when the mix was chosen (`mixes.header`) — a stored header pattern (no mix)
|
|
545
698
|
* is worn as it always was (R-H4). With what was drawn as something else or mended, in words. Pure.
|
|
546
699
|
*/
|
|
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);
|
|
700
|
+
export function wornHeaderOfPlan(plan: HeaderPlan & { readonly globals?: Readonly<Record<string, string>>; readonly mixes?: { readonly header?: ReadonlyArray<string> } },
|
|
701
|
+
facts: HeaderFacts = {}): { mix: HeaderMix; context: HeaderContext; said: string[] } {
|
|
702
|
+
const context = headerContextOfPlan(plan, undefined, facts);
|
|
550
703
|
const { drawn, gaps } = drawnHeaderMix(headerMixOfPlan(plan));
|
|
551
704
|
const checked = plan.mixes?.header?.length ? checkHeader(drawn, context) : { mix: drawn, repairs: [] };
|
|
552
705
|
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 +710,8 @@ export function wornHeaderOfPlan(plan: HeaderPlan & { readonly globals?: Readonl
|
|
|
557
710
|
* when nothing was mended, else with the new mix in `mixes.header`. Pure. */
|
|
558
711
|
export function withDistinctHeader<P extends HeaderPlan & {
|
|
559
712
|
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);
|
|
713
|
+
}>(plan: P, taken: ReadonlyArray<string>, facts: HeaderFacts = {}): { plan: P; repairs: HeaderRepair[] } {
|
|
714
|
+
const worn = wornHeaderOfPlan(plan, facts);
|
|
562
715
|
const done = distinctHeader(worn.mix, taken, worn.context);
|
|
563
716
|
if (!done.repairs.length) return { plan, repairs: [] };
|
|
564
717
|
return { plan: { ...plan, mixes: { ...(plan.mixes ?? {}), header: headerMixWords(done.mix) } }, repairs: done.repairs };
|
|
@@ -8356,6 +8356,7 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8356
8356
|
"solid",
|
|
8357
8357
|
"over",
|
|
8358
8358
|
"glass",
|
|
8359
|
+
"over-glass",
|
|
8359
8360
|
"blend"
|
|
8360
8361
|
],
|
|
8361
8362
|
"shape": [
|
|
@@ -8444,6 +8445,7 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8444
8445
|
"ground.solid": "its own ground",
|
|
8445
8446
|
"ground.over": "over the opening, transparent until the page moves",
|
|
8446
8447
|
"ground.glass": "frosted glass (a look with a blur)",
|
|
8448
|
+
"ground.over-glass": "over the opening and clear at first; frosted glass once the page moves",
|
|
8447
8449
|
"ground.blend": "blends with what is under it, readable over any picture",
|
|
8448
8450
|
"shape.bar": "a full-width bar",
|
|
8449
8451
|
"shape.pill": "one floating rounded bar",
|
|
@@ -8509,6 +8511,7 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8509
8511
|
"ground.solid": "רקע משלו",
|
|
8510
8512
|
"ground.over": "מעל הפתיחה, שקוף עד שהדף זז",
|
|
8511
8513
|
"ground.glass": "זכוכית חלבית (מראה עם טשטוש)",
|
|
8514
|
+
"ground.over-glass": "מעל הפתיחה ושקופה בהתחלה; זכוכית חלבית ברגע שהדף זז",
|
|
8512
8515
|
"ground.blend": "נבלע במה שמתחתיו, קריא מעל כל תמונה",
|
|
8513
8516
|
"shape.bar": "פס ברוחב מלא",
|
|
8514
8517
|
"shape.pill": "פס מעוגל אחד שמרחף",
|
|
@@ -8564,14 +8567,6 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8564
8567
|
"phase": "HI6",
|
|
8565
8568
|
"drawnAs": "links"
|
|
8566
8569
|
},
|
|
8567
|
-
"ground.over": {
|
|
8568
|
-
"phase": "HI3",
|
|
8569
|
-
"drawnAs": "solid"
|
|
8570
|
-
},
|
|
8571
|
-
"ground.glass": {
|
|
8572
|
-
"phase": "HI3",
|
|
8573
|
-
"drawnAs": "solid"
|
|
8574
|
-
},
|
|
8575
8570
|
"ground.blend": {
|
|
8576
8571
|
"phase": "HI3",
|
|
8577
8572
|
"drawnAs": "solid"
|
|
@@ -8644,6 +8639,17 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8644
8639
|
"wordsHe": "שם ודפים · כפתור אחד · מגירה בטלפון",
|
|
8645
8640
|
"mix": {}
|
|
8646
8641
|
},
|
|
8642
|
+
{
|
|
8643
|
+
"id": "over-picture",
|
|
8644
|
+
"name": "Over the picture",
|
|
8645
|
+
"nameHe": "מעל התמונה",
|
|
8646
|
+
"words": "Over the opening, then glass · one button",
|
|
8647
|
+
"wordsHe": "מעל הפתיחה, ואז זכוכית · כפתור אחד",
|
|
8648
|
+
"mix": {
|
|
8649
|
+
"ground": "over-glass",
|
|
8650
|
+
"edge": "none"
|
|
8651
|
+
}
|
|
8652
|
+
},
|
|
8647
8653
|
{
|
|
8648
8654
|
"id": "card",
|
|
8649
8655
|
"name": "Card from the button",
|
|
@@ -8742,7 +8748,33 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
8742
8748
|
"pinnedMax": 1,
|
|
8743
8749
|
"inlineRoomPx": 1100,
|
|
8744
8750
|
"betweenNameEm": 7,
|
|
8745
|
-
"betweenMinPages": 2
|
|
8751
|
+
"betweenMinPages": 2,
|
|
8752
|
+
"overFrames": [
|
|
8753
|
+
"full",
|
|
8754
|
+
"shrinks",
|
|
8755
|
+
"grows"
|
|
8756
|
+
],
|
|
8757
|
+
"overMedia": [
|
|
8758
|
+
"photo",
|
|
8759
|
+
"film",
|
|
8760
|
+
"slideshow",
|
|
8761
|
+
"object",
|
|
8762
|
+
"material"
|
|
8763
|
+
],
|
|
8764
|
+
"glassFlavors": [
|
|
8765
|
+
"crisp",
|
|
8766
|
+
"linen",
|
|
8767
|
+
"midnight",
|
|
8768
|
+
"glass",
|
|
8769
|
+
"bloom"
|
|
8770
|
+
],
|
|
8771
|
+
"glassIsOwnBar": [
|
|
8772
|
+
"glass"
|
|
8773
|
+
],
|
|
8774
|
+
"noEdgeGrounds": [
|
|
8775
|
+
"glass",
|
|
8776
|
+
"over-glass"
|
|
8777
|
+
]
|
|
8746
8778
|
},
|
|
8747
8779
|
"references": [
|
|
8748
8780
|
{
|
|
@@ -136,6 +136,15 @@ export interface BusinessTypeFooter {
|
|
|
136
136
|
readonly sayHe: ReadonlyArray<string>;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
/** HI3-D12 (header-ingredients-plan §8): what a type's header never stands on (contract harness `businessTypes[].header`,
|
|
140
|
+
* from harness.mjs HEADER_NEVER) — handed to generation-core `composeSite` as `headerNever`, where `checkHeader` mends it
|
|
141
|
+
* to its own ground (`type-never`). Shaped as generation-core `HeaderNever`. */
|
|
142
|
+
export interface BusinessTypeHeader {
|
|
143
|
+
readonly grounds: ReadonlyArray<string>;
|
|
144
|
+
readonly say: ReadonlyArray<string>;
|
|
145
|
+
readonly sayHe: ReadonlyArray<string>;
|
|
146
|
+
}
|
|
147
|
+
|
|
139
148
|
/** Award §0b + §0b.7 (AW-D26, AW-D32): how a type's opening film is suggested, and what it may show (`filmIdeaFor`). */
|
|
140
149
|
export interface BusinessTypeFilm {
|
|
141
150
|
/** offer · ifAsked · never — the default the owner's words move one step. */
|
|
@@ -172,6 +181,8 @@ export interface BusinessType {
|
|
|
172
181
|
readonly column: BusinessTypeColumn;
|
|
173
182
|
/** AW12-D10: what its footer never closes with or stands on — trust and care never a call word, a scene or a film. */
|
|
174
183
|
readonly footer: BusinessTypeFooter;
|
|
184
|
+
/** HI3-D12: what its header never stands on — care and advice never over the opening's picture. */
|
|
185
|
+
readonly header: BusinessTypeHeader;
|
|
175
186
|
/** Award §0b + §0b.7 (AW-D26…D32): how a film is suggested to this type, and what it may show (`filmIdeaFor`). */
|
|
176
187
|
readonly film: BusinessTypeFilm;
|
|
177
188
|
/** Popups PU0 (popups-plan §10, PU-D11/PU-D12): offer · ifAsked · never — how a popup is suggested (`popupSuggestion`). */
|