@vectoriox/iox-ui 5.198.0 → 5.199.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/actions-core/index.d.ts +7 -1
- package/data-core/index.d.ts +11 -3
- package/design-core/index.d.ts +26 -1
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +6 -1
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-data-core.mjs +30 -4
- package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +65 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +10821 -10094
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +243 -38
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/generation-core/index.d.ts +463 -126
- package/harness-core/index.d.ts +93 -6
- package/package.json +1 -1
- package/src/actions-core/element-actions.ts +6 -0
- package/src/data-core/placeholder-rows.ts +29 -4
- package/src/design-core/menu-look.ts +23 -0
- package/src/design-core/node-classes.ts +39 -0
- package/src/generation-core/check-free.ts +17 -9
- package/src/generation-core/compose-free.ts +7 -2
- package/src/generation-core/compose-site.ts +167 -46
- package/src/generation-core/footer-mix.ts +161 -15
- package/src/generation-core/free-opening.ts +13 -2
- package/src/generation-core/free-wire.ts +8 -0
- package/src/generation-core/header-mix.ts +31 -2
- package/src/generation-core/legal.ts +24 -0
- package/src/generation-core/menu-shelves.ts +138 -0
- package/src/generation-core/nav-shape.ts +138 -15
- package/src/generation-core/node-baselines.generated.ts +1 -0
- package/src/generation-core/patterns.ts +7 -0
- package/src/generation-core/plan-wire.ts +1 -0
- package/src/generation-core/public-api.ts +1 -0
- package/src/generation-core/site-build-run.ts +8 -0
- package/src/generation-core/site-plan.model.ts +3 -0
- package/src/generation-core/site-spec.generated.ts +230 -70
- package/src/generation-core/validate-site-plan.ts +2 -0
- package/src/harness-core/business-types.ts +4 -0
- package/src/harness-core/harness-spec.generated.ts +189 -30
- package/src/harness-core/popup-stance.ts +56 -3
- package/src/harness-core/run-compose-context.ts +25 -5
- package/styles/iox-design.css +25 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CarouselFrom, ContentFieldLike, NO_ELEMENT_STYLE } from '@vectoriox/iox-ui/composite-core';
|
|
2
|
-
import { LinkType } from '@vectoriox/iox-ui/design-core';
|
|
2
|
+
import { LinkType, setColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
3
3
|
import { VideoMode, VideoSource } from '@vectoriox/iox-ui/media-core';
|
|
4
4
|
|
|
5
5
|
import { composeListFrame, LayoutListBinding } from './compose-layout';
|
|
@@ -7,7 +7,7 @@ import { composeListAccordion, composeListLightbox, composeListTabs, composePres
|
|
|
7
7
|
import { FREE_OPEN_LIGHTBOX, freeSlotOf, FreeSlotKind } from './free-slot-words';
|
|
8
8
|
import { freeNodeId } from './free-render-check';
|
|
9
9
|
import { freeStyleToSlots } from './free-slots';
|
|
10
|
-
import { FREE_BUILDER_TYPE, FreeLayer, FreeNode, FreeNodeType, FreePage, FreeStyle, FreeTrigger } from './free-wire';
|
|
10
|
+
import { FREE_BUILDER_TYPE, freeSchemeOf, FreeLayer, FreeNode, FreeNodeType, FreePage, FreeStyle, FreeTrigger } from './free-wire';
|
|
11
11
|
import { LAYOUT_BEAT_DELAY, LAYOUT_DEPTH_ON_PHONE, LAYOUT_EASING, LAYOUT_PACE, LAYOUT_RISE, LayoutEase, LayoutPace, LayoutRole, LayoutSite } from './layout-language';
|
|
12
12
|
import { listMixFromWords } from './layout-wire';
|
|
13
13
|
import { ComposeError, createSerializedNode, SerializedNode, setStyleProps } from './serialized-node';
|
|
@@ -118,6 +118,11 @@ function composeNode(n: FreeNode, ctx: Ctx, beat: number): SerializedNode {
|
|
|
118
118
|
if (n.href?.startsWith(SECTION_LINK)) ctx.links.push({ node, to: n.href.slice(1) });
|
|
119
119
|
}
|
|
120
120
|
styleInto(node, n, ctx);
|
|
121
|
+
// iox-ui#186: a box painted a scheme's own ground (a dark band, `var(--iox-inverse-bg)`) wears that scheme, so every
|
|
122
|
+
// token the look reads inside — a button's ink and outline, a line, a link — is the ground's, not only the words the
|
|
123
|
+
// answer coloured by hand. `freeContrastIssues` judges the tree in the same schemes (`freeSchemeOf`).
|
|
124
|
+
const scheme = freeSchemeOf(n);
|
|
125
|
+
if (scheme) setColorScheme(node, scheme);
|
|
121
126
|
const move = moveOf(n, id, ctx, beat);
|
|
122
127
|
if (move) node.interactions = [...node.interactions, move];
|
|
123
128
|
if (n.type === FreeNodeType.Slot) node.children = slotOf(n, id, ctx);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { carryInto, swapParts, type PageCarry } from './carry';
|
|
2
2
|
import {
|
|
3
3
|
AnimateId, COLOR_SCHEME_TRAIT, COLOR_SCHEMES, ColorScheme, colorSchemeClass, DEFAULT_MENU_LOOK, DesignChoices, LinkType, MenuLook, motionLanguageForPlan, resolveDesignChoices, setColorScheme, headerBrandOf, headerGroundOf, headerInkOf, headerShapeOf,
|
|
4
|
-
columnWordOf,
|
|
4
|
+
columnWordOf, elementStyleById,
|
|
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';
|
|
7
7
|
import { busyWord, channelOpensNewTab, FORM_ACTIONS_ROLE, FORM_CHANNEL_ROLE, FormPresetChannel, FormPresetDef, FormPresetField, formPresetById, FormPresetId, presetFormActions } from '@vectoriox/iox-ui/forms-core';
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
setHeaderBehaviour, setHeaderBrand, setHeaderGround, setHeaderInk, setHeaderShape, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget, ACCOUNT_RECIPES, AccountRecipe, AccountRole,
|
|
15
15
|
buildConsentRecipe, canOpenAtClickedItem, ConsentActionType, ContentFieldLike, CarouselFrom, carouselQuoteLabel, CAROUSEL_QUOTE_LABELS, pickCarouselAutoBinds,
|
|
16
16
|
} from '@vectoriox/iox-ui/composite-core';
|
|
17
|
-
import { ConsentCategory } from '@vectoriox/iox-ui/consent-core';
|
|
18
17
|
|
|
19
18
|
import { EntranceMark, EntrancePart, planEntrances } from './entrances';
|
|
20
19
|
import { scrubEntranceStamps } from './text-scroll';
|
|
@@ -22,10 +21,10 @@ import { filmOfPlan } from './film';
|
|
|
22
21
|
import { checkFooter, FooterArrange, footerMixOfPlan, FooterNever, footerPattern, FooterRole, stampFooterMix } from './footer-mix';
|
|
23
22
|
import {
|
|
24
23
|
countryLegalFacts, FOOTER_LEGAL_ROLE, FORM_LEGAL_ROLE, formAsksPersonalData, formLegalFacts, LEGAL_PAGE_SETTING, LegalContext, LegalFact, LegalFacts,
|
|
25
|
-
legalFormLine, LegalKind, legalKindsFor, legalLabel, legalRoute, legalTitle,
|
|
24
|
+
legalFormLine, LegalKind, legalKindsFor, legalLabel, legalRoute, legalTitle, measuredCategories, siteMeasures,
|
|
26
25
|
} from './legal';
|
|
27
26
|
import {
|
|
28
|
-
checkOpening, drawnOpeningMix, namedOpeningMix, OpeningContext, openingIsTypeLed, openingMix, OpeningMix, openingMixOfPlan, openingRecipe, OpeningRole, stampOpeningMix,
|
|
27
|
+
checkOpening, drawnOpeningMix, namedOpeningMix, OpeningContext, openingIsTypeLed, OpeningMedia, openingMix, OpeningMix, openingMixFromWords, openingMixOfPlan, openingRecipe, OpeningRole, stampOpeningMix,
|
|
29
28
|
stampOpeningMotion, TYPE_LED_OPTIONAL_PARTS, typeLedOpeningSection,
|
|
30
29
|
} from './opening-mix';
|
|
31
30
|
import { checkHeader, drawnHeaderMix, HeaderContext, headerContextOfPlan, HeaderFacts, HeaderIngredient, HeaderNever, HeaderOpening, headerMix, HeaderMix, headerRecipe, HeaderRecipe, stampHeaderMix, wornHeaderOfPlan } from './header-mix';
|
|
@@ -33,7 +32,7 @@ import { bodyMixOfPlan, checkBody, drawnBodyMix, joinPageHeader, wearBodyMix } f
|
|
|
33
32
|
import { checkPopup, composePopup, POPUP_GLOBAL_ID } from './popup-plan';
|
|
34
33
|
import { NODE_BASELINES } from './node-baselines.generated';
|
|
35
34
|
import {
|
|
36
|
-
BindScope, CardBindTarget, parsePatternPath, PatternDirective, PatternGlobalPosition, PatternNode, PatternOpens, PatternPlaceholder, PatternRecipe, PatternTrack,
|
|
35
|
+
BindScope, CardBindTarget, parsePatternPath, PatternDirective, PatternGlobalPosition, PatternNode, PatternOpens, PatternPlaceholder, PatternRecipe, PatternScrolls, PatternTrack,
|
|
37
36
|
PriceBindTarget, SitePattern, patternById,
|
|
38
37
|
} from './patterns';
|
|
39
38
|
import { planSells, shopCategoriesOf, shopContentType, shopListsShownOn, variantNamesOf } from './shop-plan';
|
|
@@ -47,13 +46,13 @@ import { SitePlanSourceKind, ContentFieldControl, ContentFieldPlan,
|
|
|
47
46
|
} from './site-plan.model';
|
|
48
47
|
import { assertValidSitePlan, nextSourceOf, routeParams } from './validate-site-plan';
|
|
49
48
|
import { PictureSupply, TypeLed, TypeLedChange, TypeLedChangeKind, typeLedRound } from './type-led';
|
|
50
|
-
import { MenuSide, NavRole, NavShape, planNavShape } from './nav-shape';
|
|
49
|
+
import { MenuSide, NavPage, NavRole, NavShape, planNavShape } from './nav-shape';
|
|
51
50
|
import { composeLayout, LayoutColourMode, layoutBandScheme, LayoutListBinding } from './compose-layout';
|
|
52
51
|
import { LayoutGalleryList, LayoutListShape, LayoutPage, LayoutPhotoShape, LayoutPhotoSource, LayoutSite, parseLayoutPhotoId } from './layout-language';
|
|
53
52
|
import { layoutMotionOf, layoutPresetOf } from './layout-look';
|
|
54
53
|
import { ComposeFreeOptions, composeFreePage, composeFreeSection } from './compose-free';
|
|
55
54
|
import { isFreeBox } from './free-opening';
|
|
56
|
-
import { FreePage } from './free-wire';
|
|
55
|
+
import { FreeNode, FreeNodeType, FreePage } from './free-wire';
|
|
57
56
|
|
|
58
57
|
/**
|
|
59
58
|
* THE composer — a Site Plan in, ordinary IOX data out (design-system plan §6b, W1). Deterministic and
|
|
@@ -194,6 +193,10 @@ export interface ComposeContext {
|
|
|
194
193
|
/** #129: which picture slots a picture fills (the owner's, a made one, a stock one). Given, a section whose picture
|
|
195
194
|
* nothing fills is composed type-led (`type-led.ts`); absent, the plan composes exactly as it says. */
|
|
196
195
|
pictures?: PictureSupply;
|
|
196
|
+
/** Pictures first (harness `BusinessType.opening`, given by harness-core `businessComposeContext` only when a picture can
|
|
197
|
+
* come — the owner's photo, or stock where the type allows it, never against the owner's "no pictures"): the opening
|
|
198
|
+
* words a Home whose plan names no opening takes (`withTypeOpening`). Absent: the Home opens as its plan writes. */
|
|
199
|
+
opening?: ReadonlyArray<string>;
|
|
197
200
|
}
|
|
198
201
|
|
|
199
202
|
/** Where a composed layout's photos are, as the server keeps them and the screens read them (M8 gate 2): id → address. */
|
|
@@ -743,8 +746,11 @@ enum DanglingFate {
|
|
|
743
746
|
Unlink = 'unlink',
|
|
744
747
|
}
|
|
745
748
|
|
|
749
|
+
/** FV1b: an address outside the site (a footer's social link, `footerSocialLinks` — https only) is an external link. */
|
|
750
|
+
const isExternalHref = (href: string): boolean => href.startsWith('https://');
|
|
751
|
+
|
|
746
752
|
function danglingFate(pn: PatternNode, ctx: Ctx): DanglingFate | null {
|
|
747
|
-
if (!pn.href || pn.href === PatternDirective.PageRoute || ctx.routes.has(pn.href)) return null;
|
|
753
|
+
if (!pn.href || pn.href === PatternDirective.PageRoute || ctx.routes.has(pn.href) || isExternalHref(pn.href)) return null;
|
|
748
754
|
if (ctx.email) return DanglingFate.Email;
|
|
749
755
|
return UNLINKED_TYPE[pn.t] || (ctx.keepButtons && pn.t === BUTTON_BLOCK) ? DanglingFate.Unlink : DanglingFate.Remove;
|
|
750
756
|
}
|
|
@@ -965,6 +971,11 @@ function composeNode(given: PatternNode, id: string, repeater: RepeaterScope | n
|
|
|
965
971
|
if (pn.opens !== PatternOpens.Lightbox) throw new ComposeError(`${id}: "opens" names the pattern's lightbox`);
|
|
966
972
|
(ctx.openers ??= []).push(id);
|
|
967
973
|
}
|
|
974
|
+
if (pn.scrolls) {
|
|
975
|
+
if (pn.scrolls !== PatternScrolls.Top) throw new ComposeError(`${id}: "scrolls" names the page's top`);
|
|
976
|
+
// A scrollTo with no target is the page's top in both renderers (actions-core `scrollsToPageTop`).
|
|
977
|
+
node.interactions = [{ id: `${id}-scrolls`, trigger: 'click', actions: [{ type: 'scrollTo', duration: 0, delay: 0, easing: 'ease' }] }];
|
|
978
|
+
}
|
|
968
979
|
|
|
969
980
|
// Images: an empty slot, or a bound one — both fall back to the DS3 empty image, never a stock URL.
|
|
970
981
|
if (pn.ph === PatternPlaceholder.Image) {
|
|
@@ -977,7 +988,8 @@ function composeNode(given: PatternNode, id: string, repeater: RepeaterScope | n
|
|
|
977
988
|
if (pn.href === PatternDirective.PageRoute) {
|
|
978
989
|
writePageLink(node, stampedPageValue(`${BindScope.Page}.route`, ctx, id));
|
|
979
990
|
} else if (pn.href && !fate) {
|
|
980
|
-
|
|
991
|
+
if (isExternalHref(pn.href)) writeExternalLink(node, pn.href);
|
|
992
|
+
else writePageLink(node, pn.href);
|
|
981
993
|
} else if (fate) {
|
|
982
994
|
if (fate === DanglingFate.Email) writeExternalLink(node, `${MAILTO}${ctx.email}`);
|
|
983
995
|
reportDangling(fate, pn, id, words.value, ctx);
|
|
@@ -1936,7 +1948,9 @@ function stampLayoutSections(page: PagePlan, layout: LayoutPage, nodes: Serializ
|
|
|
1936
1948
|
* Compose a Site Plan. Throws `SitePlanError` (every issue) when the plan does not validate — the
|
|
1937
1949
|
* composer never repairs a plan. `context` carries what the composer may not read for itself (the year).
|
|
1938
1950
|
*/
|
|
1939
|
-
export function composeSite(
|
|
1951
|
+
export function composeSite(given: SitePlan, context: ComposeContext): ComposedSite {
|
|
1952
|
+
// Pictures first: a Home whose plan names no opening takes its kind of business's (when a picture can come).
|
|
1953
|
+
const plan = withTypeOpening(given, context);
|
|
1940
1954
|
if (!context?.pictures) return composeSiteOnce(plan, context, NO_TYPES);
|
|
1941
1955
|
// #129: compose, find the pictures nothing fills, compose again type-led — until a round changes nothing (an opening
|
|
1942
1956
|
// left out shows its first section's own picture, judged in the next round). Monotone: a type-led section has no
|
|
@@ -1963,6 +1977,57 @@ export function composeSite(plan: SitePlan, context: ComposeContext): ComposedSi
|
|
|
1963
1977
|
}
|
|
1964
1978
|
|
|
1965
1979
|
const NO_TYPES: ReadonlySet<string> = new Set();
|
|
1980
|
+
|
|
1981
|
+
/** The pattern family whose section a Home's opening takes the place of (a hero gives it its words, slot by slot). */
|
|
1982
|
+
const HERO_FAMILY = 'hero';
|
|
1983
|
+
const PICTURE_FREE_TYPES: ReadonlySet<string> = new Set([FreeNodeType.Image, FreeNodeType.Video]);
|
|
1984
|
+
|
|
1985
|
+
/** True when a free node (or anything in it) shows a picture — the owner's photo, a box stock may fill, a film. */
|
|
1986
|
+
function freeShowsPicture(node: FreeNode): boolean {
|
|
1987
|
+
return PICTURE_FREE_TYPES.has(node.type) || (node.children ?? []).some(freeShowsPicture);
|
|
1988
|
+
}
|
|
1989
|
+
|
|
1990
|
+
/**
|
|
1991
|
+
* PICTURES FIRST (the 2026-11-28 reference baseline, gap #1: the references open on 70–100 % picture, six of eleven J10
|
|
1992
|
+
* sites opened on none). A Home whose plan names no opening (`mixes.opening`) takes its kind of business's
|
|
1993
|
+
* (`ComposeContext.opening` — harness OPENING_PICTURE, given only when a picture can come), so its first screen is a
|
|
1994
|
+
* picture the build fills: the owner's photo, a made picture or stock (`pictureTargets` finds the opening's empty image).
|
|
1995
|
+
* A free Home (FS3) whose own opening shows no picture gives its first place back to the plan's hero (the ready-made place
|
|
1996
|
+
* a fall back would give — iox-ui#180's move), which the opening is then worn over, carrying the hero's words slot by
|
|
1997
|
+
* slot; a free opening that already shows a picture, or a free Home with no hero to give, is left as the model laid it.
|
|
1998
|
+
* A plan that chose its own opening keeps it — only its free Home's picture-less opening gives way, so the choice is worn.
|
|
1999
|
+
* An opening chosen with no picture (`media:none`) is the plan's word and is never overridden.
|
|
2000
|
+
* When nothing fills the picture the type-led round opens the Home on its words, as every Home's (`typeLedRound`). The
|
|
2001
|
+
* same plan composes the same site, so a rebuild from a kept plan picks the picture up with no model call. Pure.
|
|
2002
|
+
*/
|
|
2003
|
+
export function withTypeOpening(plan: SitePlan, context: Pick<ComposeContext, 'opening'> | null | undefined): SitePlan {
|
|
2004
|
+
// A picture can come only when the run says so (`context.opening`, given by `businessComposeContext`); the plan's own
|
|
2005
|
+
// opening is then worn as chosen (the J10 free hotel and salon chose one their free Home never wore), else the type's.
|
|
2006
|
+
if (!context?.opening?.length) return plan;
|
|
2007
|
+
const own = plan.mixes?.opening?.length ? plan.mixes.opening : null;
|
|
2008
|
+
const words = own ?? context.opening;
|
|
2009
|
+
try {
|
|
2010
|
+
if (openingMixFromWords(words).media === OpeningMedia.None) return plan;
|
|
2011
|
+
} catch { return plan; }
|
|
2012
|
+
const at = plan.pages.findIndex(p => p.isHome === true || p.route === HOME_PATH);
|
|
2013
|
+
const home = plan.pages[at];
|
|
2014
|
+
if (!home) return plan;
|
|
2015
|
+
// Only a Home that opens on a hero: the opening takes the hero's place and words, never another section's.
|
|
2016
|
+
const hero = home.sections[0];
|
|
2017
|
+
if (!hero || patternById(hero.pattern)?.family !== HERO_FAMILY) return plan;
|
|
2018
|
+
let page: PagePlan = home;
|
|
2019
|
+
const first = home.free?.sections[0];
|
|
2020
|
+
if (own && !(home.free && first && !first.readyMade)) return plan;
|
|
2021
|
+
if (home.free && first && !first.readyMade) {
|
|
2022
|
+
if (freeShowsPicture(first)) return plan;
|
|
2023
|
+
const given: FreeNode = { id: first.id, type: FreeNodeType.Section, styleProps: {}, readyMade: { at: 0, pattern: hero.pattern } };
|
|
2024
|
+
page = { ...home, free: { ...home.free, sections: [given, ...home.free.sections.slice(1)] } };
|
|
2025
|
+
}
|
|
2026
|
+
const pages = [...plan.pages];
|
|
2027
|
+
pages[at] = page;
|
|
2028
|
+
return { ...plan, pages, mixes: { ...plan.mixes, opening: [...words] } };
|
|
2029
|
+
}
|
|
2030
|
+
|
|
1966
2031
|
/** The most rounds a composition takes to wear no empty picture: the opening, then its first section, then a margin. */
|
|
1967
2032
|
const TYPE_LED_ROUNDS = 4;
|
|
1968
2033
|
|
|
@@ -2055,6 +2120,8 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
|
|
|
2055
2120
|
name: plan.business.name, design, tagline: plan.business.tagline, locale: plan.locale, pages: plan.pages.filter(p => p.inNav).length,
|
|
2056
2121
|
// FV1 `closing.email`: the owner's address, the fact the email line shows (none given, no such closing — said).
|
|
2057
2122
|
...(plan.business.facts?.email?.trim() ? { email: plan.business.facts.email.trim() } : {}),
|
|
2123
|
+
// FV1b `holds.social`: the owner's stated links (none: the block is left out, said).
|
|
2124
|
+
...(plan.business.social?.length ? { social: plan.business.social } : {}),
|
|
2058
2125
|
...(context?.businessType ? { type: context.businessType } : {}), ...(context?.footerNever ? { never: context.footerNever } : {}),
|
|
2059
2126
|
// AW12-D13 (iox-ui#153): the build's tier — absent, Basic, as the body's — never wears an award word.
|
|
2060
2127
|
tier: context?.tier ?? GenerationTier.Basic,
|
|
@@ -2083,7 +2150,7 @@ function composeSiteOnce(plan: SitePlan, context: ComposeContext, pictureless: R
|
|
|
2083
2150
|
// pages are behind its menu shows the menu at every width, on the side the mix names.
|
|
2084
2151
|
for (const [slot, pattern] of slotPatterns) {
|
|
2085
2152
|
if (!pattern.phoneMenu) continue;
|
|
2086
|
-
globals = planNavShape(globals, pattern.phoneMenu as NavShape, headerShapeOptions(slot === GlobalSlot.Header ? header.recipe : null, plan.locale), slot).globals;
|
|
2153
|
+
globals = planNavShape(globals, pattern.phoneMenu as NavShape, headerShapeOptions(slot === GlobalSlot.Header ? header.recipe : null, plan.locale, header.context.collections), slot).globals;
|
|
2087
2154
|
}
|
|
2088
2155
|
// Premium M4 (T2): a header pattern's behaviour as the page scrolls — the same edit the Header section makes.
|
|
2089
2156
|
for (const [slot, pattern] of slotPatterns) {
|
|
@@ -2168,7 +2235,8 @@ export function legalFactsOf(plan: SitePlan, context: LegalContext, nodes: Reado
|
|
|
2168
2235
|
const sells = planSells(plan);
|
|
2169
2236
|
return {
|
|
2170
2237
|
...formLegalFacts(nodes),
|
|
2171
|
-
|
|
2238
|
+
// A site that will measure its visitors is judged as one with a tracker, before one is connected.
|
|
2239
|
+
[LegalFact.Tracker]: siteMeasures(context),
|
|
2172
2240
|
[LegalFact.Sells]: sells,
|
|
2173
2241
|
// The shop ships what it sells (commerce shipping, C-D9) — no product is digital yet.
|
|
2174
2242
|
[LegalFact.PhysicalGoods]: sells,
|
|
@@ -2222,6 +2290,15 @@ function legalRow(routes: ReadonlyMap<LegalKind, string>, settings: SerializedNo
|
|
|
2222
2290
|
}
|
|
2223
2291
|
|
|
2224
2292
|
/** The legal line beside a form (AW-D15): the owner's words to edit, its links to the site's terms and privacy pages. */
|
|
2293
|
+
/** iox-ui#185: a link inside the form's legal sentence is a WORD of it — the sentence's size and leading (its words wear
|
|
2294
|
+
* `small`; the `link` element style names no size, so the link kept the Link's 16px in a 14px line and wrapped alone on
|
|
2295
|
+
* a phone). Token refs read from the contract's `small`, never a literal; only the colour and weight say "link". */
|
|
2296
|
+
const LEGAL_SENTENCE_STYLE = 'small';
|
|
2297
|
+
const LEGAL_SENTENCE_TYPE: Readonly<Record<string, string>> = (() => {
|
|
2298
|
+
const base = (elementStyleById(LEGAL_SENTENCE_STYLE)?.base ?? {}) as Record<string, string>;
|
|
2299
|
+
return Object.fromEntries((['fontSize', 'lineHeight'] as const).filter(k => typeof base[k] === 'string').map(k => [k, base[k]]));
|
|
2300
|
+
})();
|
|
2301
|
+
|
|
2225
2302
|
function formLegalLine(form: SerializedNode, routes: ReadonlyMap<LegalKind, string>, locale: string): SerializedNode | null {
|
|
2226
2303
|
if (!routes.has(LegalKind.Privacy)) return null;
|
|
2227
2304
|
const id = `${form.id}-legal`;
|
|
@@ -2230,7 +2307,7 @@ function formLegalLine(form: SerializedNode, routes: ReadonlyMap<LegalKind, stri
|
|
|
2230
2307
|
line.label = 'Legal line';
|
|
2231
2308
|
setStyleProps(line, { display: 'block', width: '100%', minHeight: 'auto' });
|
|
2232
2309
|
line.children = legalFormLine(locale, routes.has(LegalKind.Terms)).map((part, i) => ('kind' in part
|
|
2233
|
-
? legalLink(`${id}-${i}`, part.kind, routes.get(part.kind)!, locale, INLINE)
|
|
2310
|
+
? legalLink(`${id}-${i}`, part.kind, routes.get(part.kind)!, locale, { ...INLINE, ...LEGAL_SENTENCE_TYPE })
|
|
2234
2311
|
: (() => {
|
|
2235
2312
|
const words = create(`${id}-${i}`, TEXT, { content: part.text, tag: 'span' }, 'small');
|
|
2236
2313
|
setStyleProps(words, INLINE);
|
|
@@ -2246,21 +2323,78 @@ function withFormLine(form: SerializedNode, line: SerializedNode): void {
|
|
|
2246
2323
|
kids.splice(at >= 0 ? at : kids.length, 0, line);
|
|
2247
2324
|
}
|
|
2248
2325
|
|
|
2249
|
-
/**
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2326
|
+
/** What `withConsentBanner` needs: the site's language, what it measures, its privacy page, a banner the studio keeps. */
|
|
2327
|
+
export interface ConsentStampInput {
|
|
2328
|
+
readonly locale: string;
|
|
2329
|
+
readonly trackers?: LegalContext['trackers'];
|
|
2330
|
+
readonly measures?: boolean | null;
|
|
2331
|
+
readonly privacyRoute?: string | null;
|
|
2332
|
+
/** The studio keeps its own banner: its preferences dialog's id — no second banner; Cookie settings opens it. */
|
|
2333
|
+
readonly keptPreferences?: string | null;
|
|
2334
|
+
/** Also put Cookie settings in the footer's legal row when it has none (a site built before it measured). */
|
|
2335
|
+
readonly intoFooter?: boolean;
|
|
2336
|
+
}
|
|
2337
|
+
|
|
2338
|
+
/** True when a global (or anything inside it) is a consent banner. */
|
|
2339
|
+
function holdsConsentBanner(globals: ReadonlyArray<SerializedNode>): boolean {
|
|
2340
|
+
let found = false;
|
|
2341
|
+
walkSerialized(globals, n => { if (!found && n.type === DIALOG && n.props['consentRole'] === true) found = true; });
|
|
2342
|
+
return found;
|
|
2343
|
+
}
|
|
2344
|
+
|
|
2345
|
+
/** True when a node (or anything inside it) opens the consent preferences. */
|
|
2346
|
+
function opensPreferences(node: SerializedNode): boolean {
|
|
2347
|
+
let found = false;
|
|
2348
|
+
walkSerialized([node], n => {
|
|
2349
|
+
for (const ix of n.interactions ?? []) for (const a of (ix as { actions?: Array<{ type?: string }> }).actions ?? []) if (a.type === ConsentActionType.OpenPreferences) found = true;
|
|
2350
|
+
});
|
|
2351
|
+
return found;
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
/**
|
|
2355
|
+
* THE privacy banner stamp (consent C5, 2026-11-28: "a privacy banner on every site that measures visitors"): a site that
|
|
2356
|
+
* MEASURES (`siteMeasures`) and holds no consent banner gets the palette's banner + preferences (`buildConsentRecipe`) as
|
|
2357
|
+
* globals after the page — at build time from `composeLegal`, and LATER by the same call when a tracker is connected
|
|
2358
|
+
* after the build (the audit's `tracker-without-banner` is the detector; iox-cms calls this on that finding). With
|
|
2359
|
+
* `intoFooter`, the footer's legal row gains Cookie settings when it has none. Never a second banner; a banner the studio
|
|
2360
|
+
* keeps is linked, never replaced. Pure: a new globals array; the footer row gains its link in place.
|
|
2361
|
+
*/
|
|
2362
|
+
export function withConsentBanner(globals: ReadonlyArray<SerializedNode>, input: ConsentStampInput): { globals: SerializedNode[]; settings: SerializedNode | null; added: boolean } {
|
|
2363
|
+
const out = [...globals];
|
|
2364
|
+
if (!siteMeasures(input) || (!input.keptPreferences && holdsConsentBanner(globals))) return { globals: out, settings: null, added: false };
|
|
2365
|
+
const privacy = input.privacyRoute ?? null;
|
|
2366
|
+
const consent = buildConsentRecipe(spec => create(spec.key, spec.type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as CompositeNode, {
|
|
2367
|
+
lang: input.locale, categories: measuredCategories(input), privacyRoute: privacy, privacyLabel: privacy ? legalTitle(LegalKind.Privacy, input.locale) : undefined,
|
|
2368
|
+
});
|
|
2369
|
+
const settings = consent.settings as SerializedNode;
|
|
2370
|
+
let added = false;
|
|
2371
|
+
if (input.keptPreferences) {
|
|
2372
|
+
// The studio keeps its own banner: the footer's Cookie settings opens ITS preferences, and no second banner.
|
|
2373
|
+
for (const ix of settings.interactions ?? []) for (const a of (ix as { actions?: Array<{ type?: string; target?: string }> }).actions ?? []) {
|
|
2374
|
+
if (a.type === ConsentActionType.OpenPreferences) a.target = input.keptPreferences;
|
|
2375
|
+
}
|
|
2376
|
+
} else {
|
|
2377
|
+
for (const root of [consent.banner, consent.preferences] as SerializedNode[]) {
|
|
2378
|
+
root.isGlobal = true;
|
|
2379
|
+
root.globalPosition = PatternGlobalPosition.After;
|
|
2380
|
+
out.push(root);
|
|
2381
|
+
}
|
|
2382
|
+
added = true;
|
|
2255
2383
|
}
|
|
2256
|
-
|
|
2384
|
+
if (input.intoFooter) {
|
|
2385
|
+
let row: SerializedNode | null = null;
|
|
2386
|
+
const footer = out.find(g => g.id === GlobalSlot.Footer);
|
|
2387
|
+
if (footer) walkSerialized([footer], n => { if (!row && n.role === FOOTER_LEGAL_ROLE) row = n; });
|
|
2388
|
+
if (row && !opensPreferences(row)) ((row as SerializedNode).children ?? ((row as SerializedNode).children = [])).push(settings);
|
|
2389
|
+
}
|
|
2390
|
+
return { globals: out, settings, added };
|
|
2257
2391
|
}
|
|
2258
2392
|
|
|
2259
2393
|
/**
|
|
2260
2394
|
* AW1 (C5): the law a site's facts call for — stamped, never asked. Each legal kind the facts need (`legalKindsFor`) is
|
|
2261
2395
|
* the studio's own page when it has one (linked, never stamped again), else an empty flagged page on a free route; the
|
|
2262
|
-
* cookie banner and its preferences are stamped as globals when
|
|
2263
|
-
* own); every footer gets the legal row (+ Cookie settings), every form that asks for personal details the legal line.
|
|
2396
|
+
* cookie banner and its preferences are stamped as globals when the site measures (`siteMeasures`: a tracker connected,
|
|
2397
|
+
* or the intent to count visitors — unless the studio keeps its own, `withConsentBanner`); every footer gets the legal row (+ Cookie settings), every form that asks for personal details the legal line.
|
|
2264
2398
|
* Pure: new globals, the stamped pages; forms and the footer gain their nodes in place.
|
|
2265
2399
|
*/
|
|
2266
2400
|
function composeLegal(plan: SitePlan, context: LegalContext, pages: ReadonlyArray<ComposedPage>, globals: SerializedNode[], footerArrange: string,
|
|
@@ -2284,28 +2418,11 @@ function composeLegal(plan: SitePlan, context: LegalContext, pages: ReadonlyArra
|
|
|
2284
2418
|
stamped.push(composeLegalPage(kind, key, route, plan, placeholders));
|
|
2285
2419
|
}
|
|
2286
2420
|
|
|
2287
|
-
const
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
const consent = buildConsentRecipe(spec => create(spec.key, spec.type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as CompositeNode, {
|
|
2293
|
-
lang: locale, categories, privacyRoute: privacy ?? null, privacyLabel: privacy ? legalTitle(LegalKind.Privacy, locale) : undefined,
|
|
2294
|
-
});
|
|
2295
|
-
settings = consent.settings as SerializedNode;
|
|
2296
|
-
if (context.keptPreferences) {
|
|
2297
|
-
// The studio keeps its own banner: the footer's Cookie settings opens ITS preferences, and no second banner.
|
|
2298
|
-
for (const ix of settings.interactions ?? []) for (const a of (ix as { actions?: Array<{ type?: string; target?: string }> }).actions ?? []) {
|
|
2299
|
-
if (a.type === ConsentActionType.OpenPreferences) a.target = context.keptPreferences;
|
|
2300
|
-
}
|
|
2301
|
-
} else {
|
|
2302
|
-
for (const root of [consent.banner, consent.preferences] as SerializedNode[]) {
|
|
2303
|
-
root.isGlobal = true;
|
|
2304
|
-
root.globalPosition = PatternGlobalPosition.After;
|
|
2305
|
-
out.push(root);
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2421
|
+
const privacy = routes.get(LegalKind.Privacy);
|
|
2422
|
+
const consent = withConsentBanner(globals, { locale, trackers: context.trackers, measures: context.measures, privacyRoute: privacy ?? null,
|
|
2423
|
+
keptPreferences: context.keptPreferences, intoFooter: false });
|
|
2424
|
+
const out = consent.globals;
|
|
2425
|
+
const settings = consent.settings;
|
|
2309
2426
|
const footer = out.find(g => g.id === GlobalSlot.Footer);
|
|
2310
2427
|
const row = footer ? legalRow(routes, settings, footerArrange, locale) : null;
|
|
2311
2428
|
// AW12-D3: a name-and-action footer keeps its legal row in its end block, above the thank-you line — the name stays last,
|
|
@@ -2337,7 +2454,9 @@ export function planHeader(plan: SitePlan, facts: HeaderFacts = {}): { recipe: H
|
|
|
2337
2454
|
|
|
2338
2455
|
/** The phone-menu options a header recipe asks for: its menu at every width and on its side (none for the defaults, so a
|
|
2339
2456
|
* stored header's edit is the one it always was). */
|
|
2340
|
-
function headerShapeOptions(recipe: HeaderRecipe | null, locale?: string
|
|
2457
|
+
function headerShapeOptions(recipe: HeaderRecipe | null, locale?: string, collections?: ReadonlyArray<{ name: string; route: string }>): {
|
|
2458
|
+
everyWidth?: boolean; menuSide?: MenuSide; look?: Partial<MenuLook>; locale?: string; collections?: NavPage[];
|
|
2459
|
+
} {
|
|
2341
2460
|
// vectoriox/iox-ui#100: the menu's words (and the names its parts are heard by) are the site's language — English
|
|
2342
2461
|
// words are the table's English, so an English header composes as it always did (R-H4).
|
|
2343
2462
|
const words = locale ? { locale } : {};
|
|
@@ -2347,6 +2466,8 @@ function headerShapeOptions(recipe: HeaderRecipe | null, locale?: string): { eve
|
|
|
2347
2466
|
return {
|
|
2348
2467
|
...(recipe.everyWidth ? { everyWidth: true } : {}), ...(recipe.menuSide === MenuSide.Start ? { menuSide: MenuSide.Start } : {}),
|
|
2349
2468
|
...(Object.keys(look).length ? { look } : {}), ...words,
|
|
2469
|
+
// HI2: a shelf's cards are the site's main collections (only a menu that shows pictures or a card needs them).
|
|
2470
|
+
...(look.shows && collections?.length ? { collections: collections.map(c => ({ label: c.name, route: c.route })) } : {}),
|
|
2350
2471
|
};
|
|
2351
2472
|
}
|
|
2352
2473
|
|
|
@@ -2512,7 +2633,7 @@ export function composeNavHeader(input: NavHeaderInput, options: NavHeaderOption
|
|
|
2512
2633
|
root.isGlobal = true;
|
|
2513
2634
|
root.globalPosition = pattern.global;
|
|
2514
2635
|
const shape = pattern.phoneMenu as NavShape | undefined;
|
|
2515
|
-
const [header, ...companions] = shape ? planNavShape([root], shape, { newId: options.newId, ...headerShapeOptions(recipe, input.locale) }, root.id).globals : [root];
|
|
2636
|
+
const [header, ...companions] = shape ? planNavShape([root], shape, { newId: options.newId, ...headerShapeOptions(recipe, input.locale, context.collections) }, root.id).globals : [root];
|
|
2516
2637
|
if (pattern.header) setHeaderBehaviour(header as unknown as CompositeNode, pattern.header.behaviour, pattern.header.edge ?? null);
|
|
2517
2638
|
stampHeaderMix(header, recipe.mix);
|
|
2518
2639
|
setHeaderInk(header as unknown as CompositeNode, headerInkOf(recipe.mix[HeaderIngredient.Ink]));
|