@vectoriox/iox-ui 5.141.0 → 5.143.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 +40 -1
- package/design-core/index.d.ts +262 -28
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +155 -90
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +539 -268
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-forms-core.mjs +61 -4
- package/fesm2022/vectoriox-iox-ui-forms-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1547 -742
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +510 -20
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +170 -22
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/forms-core/index.d.ts +17 -3
- package/generation-core/index.d.ts +638 -148
- package/harness-core/index.d.ts +359 -20
- package/index.d.ts +94 -10
- package/package.json +1 -1
- package/src/composite-core/accordion.ts +16 -1
- package/src/composite-core/card.ts +22 -2
- package/src/composite-core/consent.ts +2 -2
- package/src/composite-core/recipe-parts.ts +7 -0
- package/src/composite-core/segmented.ts +17 -2
- package/src/composite-core/slider.ts +19 -3
- package/src/composite-core/tabs.ts +16 -1
- package/src/design-core/contrast-audit.ts +18 -0
- package/src/design-core/flavor-spec.generated.ts +212 -25
- package/src/design-core/ink-on-ground.ts +36 -0
- package/src/design-core/list-classes.ts +37 -0
- package/src/design-core/locale-direction.ts +24 -0
- package/src/design-core/menu-look.ts +2 -1
- package/src/design-core/node-classes.ts +3 -2
- package/src/design-core/public-api.ts +3 -0
- package/src/forms-core/form-presets.ts +72 -3
- package/src/generation-core/check-layout.ts +4 -1
- package/src/generation-core/check-list.ts +144 -5
- package/src/generation-core/compose-layout.ts +165 -20
- package/src/generation-core/compose-site.ts +58 -21
- package/src/generation-core/footer-mix.ts +8 -0
- package/src/generation-core/layout-fingerprint.ts +5 -1
- package/src/generation-core/layout-language.ts +5 -0
- package/src/generation-core/layout-wire.ts +64 -24
- package/src/generation-core/list-panel.ts +122 -0
- package/src/generation-core/list-space.ts +54 -1
- package/src/generation-core/list-table.ts +101 -0
- package/src/generation-core/nav-shape.ts +3 -2
- package/src/generation-core/node-baselines.generated.ts +3 -1
- package/src/generation-core/patterns.ts +4 -0
- package/src/generation-core/public-api.ts +1 -0
- package/src/generation-core/serialized-node.ts +2 -0
- package/src/generation-core/site-plan.model.ts +16 -2
- package/src/generation-core/site-spec.generated.ts +469 -201
- package/src/generation-core/validate-site-plan.ts +8 -4
- package/src/harness-core/business-types.ts +11 -0
- package/src/harness-core/film-idea.ts +178 -0
- package/src/harness-core/harness-spec.generated.ts +380 -18
- package/src/harness-core/intake.ts +8 -1
- package/src/harness-core/public-api.ts +1 -0
- package/styles/iox-design.css +420 -45
|
@@ -5,11 +5,11 @@ import {
|
|
|
5
5
|
import { SEO_DESCRIPTION_MAX, SEO_TITLE_MAX, SeoRawDoc } from '@vectoriox/iox-ui/seo-core';
|
|
6
6
|
import { channelOpensNewTab, FORM_ACTIONS_ROLE, FORM_CHANNEL_ROLE, FormPresetChannel, FormPresetDef, FormPresetField, formPresetById, presetFormActions } from '@vectoriox/iox-ui/forms-core';
|
|
7
7
|
import {
|
|
8
|
-
ACCORDION_BIND_PROP, ACCORDION_CONTENT_LIMIT,
|
|
8
|
+
ACCORDION_BIND_PROP, ACCORDION_CONTENT_LIMIT, accordionWords, accordionAnswerOf, accordionItems, accordionQuestionOf, AccordionRole,
|
|
9
9
|
buildAccordionRecipe, buildCardRecipe, buildCarouselRecipe, buildLightboxRecipe, buildSlideshowRecipe, CardLayout, CardPart, CardRole, CARD_LAYOUTS, CARD_PARTS, CompositeNode,
|
|
10
10
|
AccordionAutoBinds, CompositeNodeSpec, findByRole, LIGHTBOX_LABEL, SLIDE_TO_ROW, SLIDE_TYPE, buildTabsRecipe, tabLabelNodeOf,
|
|
11
11
|
tabPanelImageOf, tabPanelTextOf, tabsListOf, tabsPanels, tabsPanelsOf, tabsTriggers, TABS_CONTENT_LIMIT, TABS_IMAGE_BIND_PROP, TABS_LABEL_BIND_PROP,
|
|
12
|
-
TABS_TEXT_BIND_PROP,
|
|
12
|
+
TABS_TEXT_BIND_PROP, tabsWords, TabsAutoBinds, BadgeTone, BADGE_TONES, buildSegmentedRecipe, CardWords, ITEM_OPEN_STATE, segmentedOptions,
|
|
13
13
|
setHeaderBehaviour, setHeaderInk, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget, ACCOUNT_RECIPES, AccountRecipe, AccountRole,
|
|
14
14
|
buildConsentRecipe, ConsentActionType,
|
|
15
15
|
} from '@vectoriox/iox-ui/composite-core';
|
|
@@ -38,7 +38,7 @@ import { assertStyleSlots, ComposeError, createSerializedNode, SerializedBinding
|
|
|
38
38
|
import { refreshSectionStamps, stampSection } from './section-stamp';
|
|
39
39
|
import { SitePlanSourceKind, ContentFieldControl, ContentFieldPlan,
|
|
40
40
|
ContentRole, ContentTypePlan, DataSourcePlan, DEFAULT_SITE_LOCALE, FactKey, FACT_KEYS, GlobalSlot, isRtlLocale, PagePlan, PageSectionPlan, PlanDataSourceMode,
|
|
41
|
-
PlanDataSourceType, RelativeOp, roleField, SiteLocale, SitePlan, SitePlanSource,
|
|
41
|
+
PlanDataSourceType, RelativeOp, roleField, SiteLocale, SitePlan, SitePlanSource, siteFactLabel, SiteBusiness, GenerationTier,
|
|
42
42
|
} from './site-plan.model';
|
|
43
43
|
import { assertValidSitePlan, nextSourceOf, routeParams } from './validate-site-plan';
|
|
44
44
|
import { MenuSide, NavRole, NavShape, planNavShape } from './nav-shape';
|
|
@@ -414,6 +414,15 @@ function ownWords(pn: PatternNode, locale: string | undefined): string {
|
|
|
414
414
|
return locale === SiteLocale.He && pn.textHe ? pn.textHe : pn.text!;
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
+
/** A recipe's words and a part's name in the site's language (iox-ui#112) — the contract's Hebrew on a Hebrew site. */
|
|
418
|
+
function ownRecipeWords(pn: PatternNode, locale: string | undefined): Readonly<Record<string, string>> | undefined {
|
|
419
|
+
return locale === SiteLocale.He && pn.wordsHe ? pn.wordsHe : pn.words as Readonly<Record<string, string>> | undefined;
|
|
420
|
+
}
|
|
421
|
+
function ownName(pn: PatternNode, locale: string | undefined): string | undefined {
|
|
422
|
+
return locale === SiteLocale.He && pn.nameHe ? pn.nameHe : pn.name;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
|
|
417
426
|
/** Where a node's words come from: the plan's slot → the business → the customer's fact → the pattern's
|
|
418
427
|
* own text. A missing fact shows its label and is a placeholder; nothing is ever made up. */
|
|
419
428
|
function chooseText(pn: PatternNode, ctx: Ctx): TextChoice {
|
|
@@ -426,7 +435,7 @@ function chooseText(pn: PatternNode, ctx: Ctx): TextChoice {
|
|
|
426
435
|
}
|
|
427
436
|
if (fact) {
|
|
428
437
|
const given = ctx.plan.business.facts?.[fact];
|
|
429
|
-
return nonEmpty(given) ? { value: given } : { value:
|
|
438
|
+
return nonEmpty(given) ? { value: given } : { value: siteFactLabel(fact, ctx.plan.locale), placeholder: { kind: PlaceholderKind.Fact, fact } };
|
|
430
439
|
}
|
|
431
440
|
const own = pn.text === undefined ? undefined : fillVariables(ownWords(pn, ctx.plan.locale), ctx);
|
|
432
441
|
if (pn.ph === PatternPlaceholder.Copy) return { value: own, placeholder: { kind: PlaceholderKind.Copy } };
|
|
@@ -531,7 +540,7 @@ export function layoutGalleryLists(plan: SitePlan): LayoutGalleryList[] {
|
|
|
531
540
|
/** The words a list's roles are called in the brief — what a visitor would see, never the field name. */
|
|
532
541
|
export const LIST_ROLE_WORDS: Readonly<Record<`${ContentRole}`, string>> = {
|
|
533
542
|
title: 'name', summary: 'summary', image: 'picture', meta: 'detail', date: 'date', gallery: 'pictures',
|
|
534
|
-
logo: 'mark', icon: 'icon', quote: 'quote', person: 'person', link: 'link', price: 'price', compareAt: 'earlier price',
|
|
543
|
+
logo: 'mark', icon: 'icon', quote: 'quote', person: 'person', link: 'link', colour: 'colour', price: 'price', compareAt: 'earlier price',
|
|
535
544
|
};
|
|
536
545
|
/** A text role whose planned samples run past this many words (median) is called long: a small card would cut it. */
|
|
537
546
|
export const LIST_LONG_WORDS = 20;
|
|
@@ -556,7 +565,13 @@ export function layoutListShapes(plan: SitePlan): LayoutListShape[] {
|
|
|
556
565
|
});
|
|
557
566
|
// A shop list holds the plan's sample products (the build writes them unless the shop has its own).
|
|
558
567
|
const count = d.type === PlanDataSourceType.Shop ? plan.shop?.products?.length : type?.seed?.count;
|
|
559
|
-
|
|
568
|
+
// AW11: how long the planned names run (a long one is not set on its picture).
|
|
569
|
+
const titleField = roleField(type, ContentRole.Title);
|
|
570
|
+
const titles = titleField ? (perItem[titleField] ?? []).filter(s => typeof s === 'string') : [];
|
|
571
|
+
return {
|
|
572
|
+
alias: d.alias, label: type?.label ?? d.alias, items: typeof count === 'number' && count > 0 ? count : null, roles: played, long,
|
|
573
|
+
...(titles.length ? { titleWords: median(titles.map(wordCount)) } : {}),
|
|
574
|
+
};
|
|
560
575
|
});
|
|
561
576
|
}
|
|
562
577
|
|
|
@@ -733,12 +748,13 @@ function composeForm(node: SerializedNode, pn: PatternNode, id: string, ctx: Ctx
|
|
|
733
748
|
// A section may give the pattern's form another preset (`form`: Practice's contact page asks to book).
|
|
734
749
|
const presetId = ctx.section?.form ?? pn.preset;
|
|
735
750
|
if (pn.c?.length) throw new ComposeError(`${id}: a preset Form takes its fields from the preset, not the pattern`);
|
|
736
|
-
stampPresetForm(node, presetId, id, ctx.owner);
|
|
751
|
+
stampPresetForm(node, presetId, id, ctx.owner, ctx.plan.locale);
|
|
737
752
|
}
|
|
738
753
|
|
|
739
754
|
/** A preset's name, stable form id, after-send steps (iox-cms#84: a contact form emails the owner) and children on a Form node — the ONE stamping `composeSite` and `composeLayout` share. */
|
|
740
|
-
function stampPresetForm(node: SerializedNode, presetId: string, id: string, owner: string): void {
|
|
741
|
-
|
|
755
|
+
function stampPresetForm(node: SerializedNode, presetId: string, id: string, owner: string, locale?: string): void {
|
|
756
|
+
// iox-ui#112: the form asks, answers and fails in the site's language.
|
|
757
|
+
const preset = formPresetById(presetId, locale);
|
|
742
758
|
if (!preset) throw new ComposeError(`${id}: no form preset "${presetId}" in forms-core`);
|
|
743
759
|
setProp(node, 'name', preset.formName);
|
|
744
760
|
setProp(node, 'formId', `${preset.id}-${stableHash(`${owner}/${id}`)}`);
|
|
@@ -748,9 +764,9 @@ function stampPresetForm(node: SerializedNode, presetId: string, id: string, own
|
|
|
748
764
|
}
|
|
749
765
|
|
|
750
766
|
/** A NEW Form stamped from a forms-core preset, exactly as a pattern's preset form is (premium M8: a layout's form layer). */
|
|
751
|
-
export function composePresetForm(id: string, presetId: string, owner: string): SerializedNode {
|
|
767
|
+
export function composePresetForm(id: string, presetId: string, owner: string, locale?: string): SerializedNode {
|
|
752
768
|
const node = create(id, FORM);
|
|
753
|
-
stampPresetForm(node, presetId, id, owner);
|
|
769
|
+
stampPresetForm(node, presetId, id, owner, locale);
|
|
754
770
|
return node;
|
|
755
771
|
}
|
|
756
772
|
|
|
@@ -856,7 +872,7 @@ function composeNode(given: PatternNode, id: string, repeater: RepeaterScope | n
|
|
|
856
872
|
setProp(node, 'src', '');
|
|
857
873
|
ctx.placeholders.push({ nodeId: id, owner: ctx.owner, kind: PlaceholderKind.Video, text: '' });
|
|
858
874
|
}
|
|
859
|
-
if (pn.name) setProp(node, 'ariaLabel', pn.
|
|
875
|
+
if (pn.name) setProp(node, 'ariaLabel', ownName(pn, ctx.plan.locale)!);
|
|
860
876
|
if (pn.icon) {
|
|
861
877
|
if (type !== ICON) throw new ComposeError(`${id}: "icon" belongs on an Icon`);
|
|
862
878
|
setProp(node, 'iconClass', pn.icon);
|
|
@@ -999,7 +1015,7 @@ function composeRecipe(pn: PatternNode, id: string, repeater: RepeaterScope | nu
|
|
|
999
1015
|
if (pn.recipe === PatternRecipe.Carousel) return composeCarousel(pn, id, ctx);
|
|
1000
1016
|
if (pn.recipe === PatternRecipe.Slideshow) return composeSlideshow(pn, id, ctx);
|
|
1001
1017
|
if (pn.recipe === PatternRecipe.Lightbox) return composeLightbox(pn, id, repeater, ctx);
|
|
1002
|
-
if (pn.recipe === PatternRecipe.Segmented) return composeSegmented(pn, id);
|
|
1018
|
+
if (pn.recipe === PatternRecipe.Segmented) return composeSegmented(pn, id, ctx);
|
|
1003
1019
|
if (pn.recipe !== PatternRecipe.Card) throw new ComposeError(`${id}: no recipe "${pn.recipe}" in composite-core`);
|
|
1004
1020
|
const layout = (pn.layout ?? CardLayout.Top) as CardLayout;
|
|
1005
1021
|
if (!CARD_LAYOUTS.includes(layout)) throw new ComposeError(`${id}: a card has no layout "${pn.layout}"`);
|
|
@@ -1023,7 +1039,7 @@ function composeRecipe(pn: PatternNode, id: string, repeater: RepeaterScope | nu
|
|
|
1023
1039
|
else throw new ComposeError(`${id}: a card's ${key} cannot be left out`);
|
|
1024
1040
|
}
|
|
1025
1041
|
const card = buildCardRecipe(factory, {
|
|
1026
|
-
layout, parts, words: pn.
|
|
1042
|
+
layout, parts, words: ownRecipeWords(pn, ctx.plan.locale) as Partial<CardWords> | undefined, badgeTone: tone, lang: ctx.plan.locale,
|
|
1027
1043
|
...(pn.icon ? { badgeIcon: pn.icon } : {}),
|
|
1028
1044
|
}) as SerializedNode;
|
|
1029
1045
|
markEntrance(pn, id, repeater, ctx);
|
|
@@ -1092,8 +1108,8 @@ function copyPlaceholders(card: SerializedNode, ctx: Ctx): void {
|
|
|
1092
1108
|
}
|
|
1093
1109
|
|
|
1094
1110
|
/** CC4b: the Segmented control — composite-core's recipe (Monthly · Yearly), named by the pattern, laid out by it. */
|
|
1095
|
-
function composeSegmented(pn: PatternNode, id: string): SerializedNode {
|
|
1096
|
-
const root = buildSegmentedRecipe(recipeFactory(id, 'segmented'), pn.name !== undefined ? { label: pn.
|
|
1111
|
+
function composeSegmented(pn: PatternNode, id: string, ctx: Ctx): SerializedNode {
|
|
1112
|
+
const root = buildSegmentedRecipe(recipeFactory(id, 'segmented'), { lang: ctx.plan.locale, ...(pn.name !== undefined ? { label: ownName(pn, ctx.plan.locale) } : {}) }) as SerializedNode;
|
|
1097
1113
|
applyLayout(root, pn);
|
|
1098
1114
|
return root;
|
|
1099
1115
|
}
|
|
@@ -1122,7 +1138,7 @@ function composeAccordion(pn: PatternNode, id: string, ctx: Ctx): SerializedNode
|
|
|
1122
1138
|
const type = isRoot && binding ? REPEATER : spec.type;
|
|
1123
1139
|
return create(isRoot ? id : `${id}-${spec.key}`, type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as CompositeNode;
|
|
1124
1140
|
};
|
|
1125
|
-
const root = buildAccordionRecipe(factory, binding ? { items:
|
|
1141
|
+
const root = buildAccordionRecipe(factory, binding ? { items: accordionWords(ctx.plan.locale).slice(0, 1) } : { lang: ctx.plan.locale }) as SerializedNode;
|
|
1126
1142
|
if (!binding) {
|
|
1127
1143
|
if (pn.ph === PatternPlaceholder.Copy) {
|
|
1128
1144
|
for (const item of accordionItems(root as CompositeNode)) {
|
|
@@ -1163,7 +1179,7 @@ function composeTabs(pn: PatternNode, id: string, ctx: Ctx): SerializedNode {
|
|
|
1163
1179
|
const type = binding && TABS_HOLDER_KEYS.has(spec.key) ? REPEATER : spec.type;
|
|
1164
1180
|
return create(spec.key === TABS_ROOT_KEY ? id : `${id}-${spec.key}`, type, { ...(spec.props ?? {}) }, spec.elementStyle ?? null) as CompositeNode;
|
|
1165
1181
|
};
|
|
1166
|
-
const root = buildTabsRecipe(factory, { tabs: binding ?
|
|
1182
|
+
const root = buildTabsRecipe(factory, { tabs: binding ? tabsWords(ctx.plan.locale).slice(0, 1) : undefined, label: ownName(pn, ctx.plan.locale), lang: ctx.plan.locale }) as SerializedNode;
|
|
1167
1183
|
const tree = root as CompositeNode;
|
|
1168
1184
|
if (!binding) {
|
|
1169
1185
|
if (pn.ph === PatternPlaceholder.Copy) {
|
|
@@ -1380,7 +1396,7 @@ function recipeFactory(id: string, rootKey: string): (spec: CompositeNodeSpec) =
|
|
|
1380
1396
|
* testimonials are facts, never invented.
|
|
1381
1397
|
*/
|
|
1382
1398
|
function composeCarousel(pn: PatternNode, id: string, ctx: Ctx): SerializedNode {
|
|
1383
|
-
const slider = buildCarouselRecipe(recipeFactory(id, 'carousel')) as SerializedNode;
|
|
1399
|
+
const slider = buildCarouselRecipe(recipeFactory(id, 'carousel'), { lang: ctx.plan.locale, ...(pn.name ? { name: ownName(pn, ctx.plan.locale) } : {}) }) as SerializedNode;
|
|
1384
1400
|
if (pn.ph === PatternPlaceholder.Copy) {
|
|
1385
1401
|
for (const slide of (slider.children ?? []).filter(c => c.type === SLIDE_TYPE)) {
|
|
1386
1402
|
for (const text of slide.children ?? []) ctx.placeholders.push({ nodeId: text.id, owner: ctx.owner, kind: PlaceholderKind.Copy, text: String(text.props?.['content'] ?? '') });
|
|
@@ -1641,7 +1657,7 @@ function composeLayoutPage(
|
|
|
1641
1657
|
const given = (facts as Record<string, string | undefined>)[key];
|
|
1642
1658
|
if (nonEmpty(given)) return given.trim();
|
|
1643
1659
|
missing.push(key as FactKey);
|
|
1644
|
-
return
|
|
1660
|
+
return siteFactLabel(key as FactKey, plan.locale) ?? key;
|
|
1645
1661
|
});
|
|
1646
1662
|
for (const fact of missing) placeholders.push({ nodeId: node.id, owner: page.key, kind: PlaceholderKind.Fact, fact, text: String(node.props[prop]) });
|
|
1647
1663
|
}
|
|
@@ -2101,6 +2117,9 @@ export const PRICING_PATTERN = 'pricing.tiers';
|
|
|
2101
2117
|
export interface SectionInput {
|
|
2102
2118
|
readonly business?: SiteBusiness;
|
|
2103
2119
|
readonly pages?: ReadonlyArray<SitePageRef>;
|
|
2120
|
+
/** The site's language (`SiteLocale`, iox-ui#112): the section's own words in it, as `composeSite` gives a page's.
|
|
2121
|
+
* English when not given. */
|
|
2122
|
+
readonly locale?: string;
|
|
2104
2123
|
}
|
|
2105
2124
|
|
|
2106
2125
|
export interface SectionOptions {
|
|
@@ -2127,7 +2146,7 @@ export function composeSection(patternId: string, input: SectionInput, options:
|
|
|
2127
2146
|
if (pattern.global) throw new ComposeError(`"${patternId}" is a header or footer — composeNavHeader / composeSite stamp those`);
|
|
2128
2147
|
const business: SiteBusiness = input.business ?? { name: '' } as SiteBusiness;
|
|
2129
2148
|
const pages = navPagePlans(input.pages ?? []);
|
|
2130
|
-
const plan = { business, pages, dataSources: [], contentTypes: [] } as unknown as SitePlan;
|
|
2149
|
+
const plan = { business, pages, dataSources: [], contentTypes: [], ...(input.locale ? { locale: input.locale } : {}) } as unknown as SitePlan;
|
|
2131
2150
|
const email = nonEmpty(business.facts?.email) ? business.facts!.email!.trim() : null;
|
|
2132
2151
|
const placeholders: ComposedPlaceholder[] = [];
|
|
2133
2152
|
const issues: ComposeIssue[] = [];
|
|
@@ -2136,9 +2155,27 @@ export function composeSection(patternId: string, input: SectionInput, options:
|
|
|
2136
2155
|
placeholders, issues, routes: new Set(pages.map(p => p.route)), keepButtons: true,
|
|
2137
2156
|
};
|
|
2138
2157
|
const section = composePattern(pattern, options.id, ctx);
|
|
2158
|
+
wearBaselineWords(section, input.locale);
|
|
2139
2159
|
return { section, placeholders, issues };
|
|
2140
2160
|
}
|
|
2141
2161
|
|
|
2162
|
+
/** iox-ui#112: a type's own placeholder words (its builder baseline — "Enter text here", "Heading", an Image's "Image", a
|
|
2163
|
+
* submit button's "Sending…") on a Hebrew page, where a fresh section's empty slot shows them until the author writes it. */
|
|
2164
|
+
export const BASELINE_WORDS_HE: Readonly<Record<string, Readonly<Record<string, string>>>> = {
|
|
2165
|
+
Text: { content: 'כתבו כאן טקסט' }, Heading: { content: 'כותרת' }, Image: { alt: 'תמונה' }, Button: { label: 'לחצו כאן' },
|
|
2166
|
+
Link: { label: 'לחצו כאן' }, Field: { label: 'תווית' }, SubmitButton: { label: 'שליחה', loadingLabel: 'שולחים…' },
|
|
2167
|
+
};
|
|
2168
|
+
|
|
2169
|
+
/** Every node still holding its type's English baseline words takes the language's (a word the composer wrote stays). */
|
|
2170
|
+
function wearBaselineWords(root: SerializedNode, locale: string | undefined): void {
|
|
2171
|
+
if (locale !== SiteLocale.He) return;
|
|
2172
|
+
walkSerialized([root], node => {
|
|
2173
|
+
for (const [prop, words] of Object.entries(BASELINE_WORDS_HE[node.type] ?? {})) {
|
|
2174
|
+
if (node.props[prop] === NODE_BASELINES[node.type]?.props[prop]) node.props[prop] = words;
|
|
2175
|
+
}
|
|
2176
|
+
});
|
|
2177
|
+
}
|
|
2178
|
+
|
|
2142
2179
|
// ── The opening (AW8, board award-opening) ──────────────────────────────────────────────────────────────────────
|
|
2143
2180
|
|
|
2144
2181
|
/** The colour scheme a page's first section wears — what the header over it follows (`pageSettings.opening`), or null. */
|
|
@@ -68,6 +68,14 @@ export enum FooterGround {
|
|
|
68
68
|
Inset = 'inset',
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/** The roles a footer's parts carry — the contract's (`site.footerParts` and the stored footers), written to the node's
|
|
72
|
+
* `role`, a class `iox-role-<role>` both renderers emit. */
|
|
73
|
+
export enum FooterRole {
|
|
74
|
+
/** The footer's page list (the Pages block, or the page row of a line or centred footer): a navigation list — its
|
|
75
|
+
* links rest with no line (vectoriox/iox-ui#87/#97, iox-design.css), as a header's do. */
|
|
76
|
+
Links = 'footer.links',
|
|
77
|
+
}
|
|
78
|
+
|
|
71
79
|
/** One word per ingredient; `holds` several, in the table's order. */
|
|
72
80
|
export interface FooterMix {
|
|
73
81
|
readonly arrange: string;
|
|
@@ -4,6 +4,7 @@ import { layoutPresetColours, splitSide } from './check-layout';
|
|
|
4
4
|
import { LayoutColour, LayoutEnter, LayoutIssue, LayoutIssueCode, LayoutLayerKind, LayoutListMix, LayoutListWho, LayoutPage, LayoutRole, LayoutSection, LayoutSectionKind, LayoutSize, LayoutTrackProp } from './layout-language';
|
|
5
5
|
import { FooterMix, footerMixOfPlan, footerTokenOf } from './footer-mix';
|
|
6
6
|
import { HeaderMix, headerTokenOf, wornHeaderOfPlan } from './header-mix';
|
|
7
|
+
import { listWordTier } from './list-table';
|
|
7
8
|
import { PHOTO_LIGHT_LUMINANCE, PhotoTone } from './photo-inventory';
|
|
8
9
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
9
10
|
|
|
@@ -101,7 +102,10 @@ export const LAYOUT_LIST_TOKEN = 'list';
|
|
|
101
102
|
export function listTokenOf(mix: LayoutListMix): string {
|
|
102
103
|
const who = mix.standout && mix.standout.who !== LayoutListWho.None ? `${mix.standout.who}${mix.standout.how ? `-${mix.standout.how}` : ''}` : 'none';
|
|
103
104
|
const moves = Array.isArray(mix.move) && mix.move.length ? [...new Set(mix.move)].sort().join('+') : 'still';
|
|
104
|
-
|
|
105
|
+
// AW11-D18: a round-two item (a name on its picture, a packshot, a colour block, a numeral) is seen at once too — it
|
|
106
|
+
// joins the token; a round-one item adds nothing, so every fingerprint stored before AW11 reads as it did.
|
|
107
|
+
const item = typeof mix.item === 'string' && listWordTier('item', mix.item) === 'pro' ? `/${mix.item}` : '';
|
|
108
|
+
return `${LAYOUT_LIST_TOKEN}:${mix.arrange}/${who}/${moves}${item}`;
|
|
105
109
|
}
|
|
106
110
|
|
|
107
111
|
/** A section's token in the sequence: a list section's mix, else its kind (`sequenceTokenOf`). */
|
|
@@ -516,6 +516,11 @@ export interface LayoutListShape {
|
|
|
516
516
|
roles: ReadonlyArray<string>;
|
|
517
517
|
/** Text roles whose planned samples run long (median over LIST_LONG_WORDS words). */
|
|
518
518
|
long: ReadonlyArray<string>;
|
|
519
|
+
/** AW11: the planned titles' median word count — a long name is not set on its picture (absent: not measured). */
|
|
520
|
+
titleWords?: number | null;
|
|
521
|
+
/** AW11-D9: every picture of the list stands on a plain, even ground (`assets.plainEdge`, measured at upload) — a
|
|
522
|
+
* packshot needs it; false: drawn as cards. Absent or null: not measured (the planned samples are). */
|
|
523
|
+
plainPictures?: boolean | null;
|
|
519
524
|
}
|
|
520
525
|
|
|
521
526
|
/** An accent band the accent mend may move, and the ground it takes. */
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
LayoutListHow, LayoutListItem, LayoutListMix, LayoutListPhone, LayoutListWho, LayoutPage, LayoutSection, LayoutTrack,
|
|
7
7
|
} from './layout-language';
|
|
8
8
|
import { isPlainObject, PlainObject } from './shape-check';
|
|
9
|
-
import { LIST_INGREDIENTS, LIST_TABLE, listBuiltWords, listIngredientWords } from './list-table';
|
|
9
|
+
import { LIST_INGREDIENTS, LIST_TABLE, listBuiltWords, listIngredientWords, listWordOffered, listWordRefusal } from './list-table';
|
|
10
10
|
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
11
11
|
import type { LayoutListNever } from './check-list';
|
|
12
12
|
|
|
@@ -50,12 +50,16 @@ export enum LayoutMixIngredient {
|
|
|
50
50
|
Phone = 'phone',
|
|
51
51
|
}
|
|
52
52
|
const MIX_SEPARATOR = ':';
|
|
53
|
+
const BASIC = 'basic';
|
|
54
|
+
const AWARD = 'award';
|
|
53
55
|
const PART_SEPARATOR = '.';
|
|
54
56
|
/** Every word a stored mix may hold, ingredient by ingredient (a waiting word too: a stored answer still reads). */
|
|
55
57
|
export const LAYOUT_MIX_WORDS: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listIngredientWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
56
|
-
/** The words the wire OFFERS — the built ones only (ingredients.md §3.3
|
|
57
|
-
* site that asked for it. */
|
|
58
|
-
export const LAYOUT_MIX_OFFERED: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
58
|
+
/** The words the wire OFFERS a site below the award tier — the built ones only (ingredients.md §3.3: a waiting word would
|
|
59
|
+
* put its stand-in on every site that asked for it), less the award tier's (AW-D23, AW11). */
|
|
60
|
+
export const LAYOUT_MIX_OFFERED: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).filter(w => listWordOffered(k, w, BASIC)).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
61
|
+
/** AW11: every built word, the award tier's included — what the wire offers an award site before the lists are read. */
|
|
62
|
+
export const LAYOUT_MIX_OFFERED_AWARD: ReadonlyArray<string> = LIST_INGREDIENTS.flatMap(k => listBuiltWords(k).map(w => `${k}${MIX_SEPARATOR}${w}`));
|
|
59
63
|
|
|
60
64
|
/** A list a composed page may show, as the wire's parts enum needs it (`layoutListShapes` gives these). */
|
|
61
65
|
export interface LayoutWireList { alias: string; roles: ReadonlyArray<string> }
|
|
@@ -66,6 +70,9 @@ export interface LayoutWireOptions {
|
|
|
66
70
|
lists?: ReadonlyArray<LayoutWireList>;
|
|
67
71
|
/** L-D12: what this business type's lists never do — those words are not offered (the check repairs one anyway). */
|
|
68
72
|
never?: LayoutListNever | null;
|
|
73
|
+
/** AW-D23 (AW11): the tier the site is built at — the award tier alone is offered the round-two list words. Absent:
|
|
74
|
+
* below it (no property changes either way). */
|
|
75
|
+
tier?: string | null;
|
|
69
76
|
/** A redesign (site-redesign RD2, H3): THIS page's carry handles (`carryHandles`) — given, every layer carries `carry`,
|
|
70
77
|
* closed to these handles: a model can place only the page's own parts (one property: 38, 40 with lists). */
|
|
71
78
|
carry?: ReadonlyArray<string>;
|
|
@@ -98,10 +105,28 @@ export function isSectionCarryHandle(handle: string): boolean {
|
|
|
98
105
|
return SECTION_HANDLE.test(handle);
|
|
99
106
|
}
|
|
100
107
|
|
|
101
|
-
/**
|
|
102
|
-
|
|
108
|
+
/** AW11: what else decides a word's offer — the tier (absent: below the award tier) and the plan's lists (absent: not
|
|
109
|
+
* judged). */
|
|
110
|
+
export interface LayoutMixOfferOptions {
|
|
111
|
+
readonly tier?: string | null;
|
|
112
|
+
readonly lists?: ReadonlyArray<LayoutWireList>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The mix words offered to a business whose lists never do `never` (L-D12): the built words less the forbidden ones —
|
|
117
|
+
* and since AW11, the award tier's only to an award site, and a word NO list of the plan can carry (a second picture, a
|
|
118
|
+
* picture at all) never (R-H-AW11-7: the one table, `listWordRefusal`; `checkList` judges each list).
|
|
119
|
+
*/
|
|
120
|
+
export function layoutMixOffered(never?: LayoutListNever | null, options: LayoutMixOfferOptions = {}): string[] {
|
|
103
121
|
const banned = new Set([...(never?.arranges ?? []).map(w => `arrange${MIX_SEPARATOR}${w}`), ...(never?.moves ?? []).map(w => `move${MIX_SEPARATOR}${w}`)]);
|
|
104
|
-
|
|
122
|
+
const offered = options.tier === AWARD ? LAYOUT_MIX_OFFERED_AWARD : LAYOUT_MIX_OFFERED;
|
|
123
|
+
const lists = options.lists;
|
|
124
|
+
return offered.filter(w => {
|
|
125
|
+
if (banned.has(w)) return false;
|
|
126
|
+
if (!lists?.length) return true;
|
|
127
|
+
const [k, word] = w.split(MIX_SEPARATOR) as [typeof LIST_INGREDIENTS[number], string];
|
|
128
|
+
return lists.some(l => listWordRefusal(k, word, l) === null);
|
|
129
|
+
});
|
|
105
130
|
}
|
|
106
131
|
const mixHint = (offered: ReadonlyArray<string>) => LIST_INGREDIENTS.map(k => {
|
|
107
132
|
const words = offered.filter(w => w.startsWith(`${k}${MIX_SEPARATOR}`)).map(w => w.slice(k.length + MIX_SEPARATOR.length));
|
|
@@ -140,9 +165,11 @@ const closed = (properties: Record<string, JsonSchema>, d?: string) => jsonClose
|
|
|
140
165
|
/** The strict format for one composed page — with the list ingredients when `options.lists` is given. */
|
|
141
166
|
export function layoutWireJsonSchema(options: LayoutWireOptions = {}): JsonSchema {
|
|
142
167
|
const partWords = options.lists ? layoutWirePartWords(options.lists) : [];
|
|
168
|
+
// A list (round one) keeps today's offer exactly: the plan's lists narrow only what the award tier adds.
|
|
169
|
+
const mixOffered = options.tier === AWARD ? layoutMixOffered(options.never, { tier: AWARD, lists: options.lists }) : layoutMixOffered(options.never);
|
|
143
170
|
const lists: Record<string, JsonSchema> = options.lists
|
|
144
171
|
? {
|
|
145
|
-
mix: listOf(jsonOneOf(
|
|
172
|
+
mix: listOf(jsonOneOf(mixOffered), `gallery showing a list (source): how its items are shown, one word per choice — ${mixHint(mixOffered)}; [] for none`),
|
|
146
173
|
parts: listOf(jsonOneOf(partWords.length ? partWords : [NONE]), "gallery showing a list as cards: the list's fields each card shows, <list>.<role>, the source's own; [] for none"),
|
|
147
174
|
}
|
|
148
175
|
: {};
|
|
@@ -236,6 +263,21 @@ function expandGallery(l: PlainObject, flags: ReadonlySet<string>, variant: stri
|
|
|
236
263
|
* parts of another list than the gallery's are left out, and the first part names the list when `source` is empty. */
|
|
237
264
|
function expandListMix(l: PlainObject, gallery: LayoutGallery): LayoutListMix | null {
|
|
238
265
|
const words = strings(l['mix']);
|
|
266
|
+
if (!words.length) return null;
|
|
267
|
+
const parts = strings(l['parts']).filter(p => p !== NONE).map(p => {
|
|
268
|
+
const at = p.lastIndexOf(PART_SEPARATOR);
|
|
269
|
+
return at > 0 ? { list: p.slice(0, at), role: p.slice(at + 1) } : null;
|
|
270
|
+
}).filter((p): p is { list: string; role: string } => !!p);
|
|
271
|
+
if (!gallery.source && parts[0]) gallery.source = parts[0].list;
|
|
272
|
+
return listMixFromWords(words, parts.filter(p => p.list === gallery.source).map(p => p.role));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* `<ingredient>:<word>` words (the wire's `mix`, or what a composed list's frame stores — design-core `LIST_MIX_PROP`)
|
|
277
|
+
* and the roles each item shows → a list mix, or null when there are no words. Words are kept as written (`checkList`
|
|
278
|
+
* judges them); what is not named takes the wire's defaults. Bindings ▸ List reads a list back through this.
|
|
279
|
+
*/
|
|
280
|
+
export function listMixFromWords(words: ReadonlyArray<string>, parts: ReadonlyArray<string> = []): LayoutListMix | null {
|
|
239
281
|
if (!words.length) return null;
|
|
240
282
|
const picked = new Map<string, string[]>();
|
|
241
283
|
for (const w of words) {
|
|
@@ -243,12 +285,7 @@ function expandListMix(l: PlainObject, gallery: LayoutGallery): LayoutListMix |
|
|
|
243
285
|
if (at > 0) (picked.get(w.slice(0, at)) ?? picked.set(w.slice(0, at), []).get(w.slice(0, at))!).push(w.slice(at + 1));
|
|
244
286
|
}
|
|
245
287
|
const one = (k: LayoutMixIngredient) => picked.get(k)?.[0];
|
|
246
|
-
const
|
|
247
|
-
const at = p.lastIndexOf(PART_SEPARATOR);
|
|
248
|
-
return at > 0 ? { list: p.slice(0, at), role: p.slice(at + 1) } : null;
|
|
249
|
-
}).filter((p): p is { list: string; role: string } => !!p);
|
|
250
|
-
if (!gallery.source && parts[0]) gallery.source = parts[0].list;
|
|
251
|
-
const own = parts.filter(p => p.list === gallery.source).map(p => p.role);
|
|
288
|
+
const own = [...parts];
|
|
252
289
|
const arrange = (one(LayoutMixIngredient.Arrange) ?? LayoutListArrange.Row) as LayoutListMix['arrange'];
|
|
253
290
|
const who = one(LayoutMixIngredient.Who);
|
|
254
291
|
const how = one(LayoutMixIngredient.How);
|
|
@@ -264,18 +301,21 @@ function expandListMix(l: PlainObject, gallery: LayoutGallery): LayoutListMix |
|
|
|
264
301
|
};
|
|
265
302
|
}
|
|
266
303
|
|
|
304
|
+
/** A list mix's words, `<ingredient>:<word>` — the wire's `mix`, and what a composed list's frame stores (AW11,
|
|
305
|
+
* design-core `LIST_MIX_PROP`) for Bindings ▸ List and the shared CSS. */
|
|
306
|
+
export function listMixWords(mix: LayoutListMix): string[] {
|
|
307
|
+
const w = (k: LayoutMixIngredient, v: string) => `${k}${MIX_SEPARATOR}${v}`;
|
|
308
|
+
return [
|
|
309
|
+
w(LayoutMixIngredient.Item, mix.item), w(LayoutMixIngredient.Arrange, mix.arrange),
|
|
310
|
+
...(mix.standout ? [w(LayoutMixIngredient.Who, mix.standout.who), ...(mix.standout.how ? [w(LayoutMixIngredient.How, mix.standout.how)] : [])] : []),
|
|
311
|
+
...mix.move.map(m => w(LayoutMixIngredient.Move, m)), ...mix.hover.map(h => w(LayoutMixIngredient.Hover, h)),
|
|
312
|
+
w(LayoutMixIngredient.Arrive, mix.arrive), w(LayoutMixIngredient.Phone, mix.phone),
|
|
313
|
+
];
|
|
314
|
+
}
|
|
315
|
+
|
|
267
316
|
/** A list mix → the wire's `mix` words and `parts`. */
|
|
268
317
|
function listMixToWire(mix: LayoutListMix, source: string): { mix: string[]; parts: string[] } {
|
|
269
|
-
|
|
270
|
-
return {
|
|
271
|
-
mix: [
|
|
272
|
-
w(LayoutMixIngredient.Item, mix.item), w(LayoutMixIngredient.Arrange, mix.arrange),
|
|
273
|
-
...(mix.standout ? [w(LayoutMixIngredient.Who, mix.standout.who), ...(mix.standout.how ? [w(LayoutMixIngredient.How, mix.standout.how)] : [])] : []),
|
|
274
|
-
...mix.move.map(m => w(LayoutMixIngredient.Move, m)), ...mix.hover.map(h => w(LayoutMixIngredient.Hover, h)),
|
|
275
|
-
w(LayoutMixIngredient.Arrive, mix.arrive), w(LayoutMixIngredient.Phone, mix.phone),
|
|
276
|
-
],
|
|
277
|
-
parts: mix.parts.map(r => `${source}${PART_SEPARATOR}${r}`),
|
|
278
|
-
};
|
|
318
|
+
return { mix: listMixWords(mix), parts: mix.parts.map(r => `${source}${PART_SEPARATOR}${r}`) };
|
|
279
319
|
}
|
|
280
320
|
|
|
281
321
|
function expandTrack(t: PlainObject): LayoutTrack {
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { checkList, LayoutListNever } from './check-list';
|
|
2
|
+
import {
|
|
3
|
+
LayoutIssue, LayoutIssueCode, LayoutListHow, LayoutListMix, LayoutListShape, LayoutListWho, LayoutMendKind,
|
|
4
|
+
} from './layout-language';
|
|
5
|
+
import {
|
|
6
|
+
LIST_INGREDIENTS, LIST_TABLE, ListIngredient, ListWordRefusal, listBuiltWords, listMeaning, listWordRefusal, listWordTier,
|
|
7
|
+
} from './list-table';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Bindings ▸ List (AW11-D18, board award-lists "Where an owner sets it"): the rows of the ONE list group, framework-free so
|
|
11
|
+
* the host (cms-client's Bindings panel) only draws them. P1 — the rows ARE the contract's ingredients and words (the
|
|
12
|
+
* same words the model writes, each with its meaning as the hint), so the panel can never offer a word the model can't
|
|
13
|
+
* write or the composer can't draw. P2 — a word the list's data can't carry is disabled with its reason (the same rule
|
|
14
|
+
* as the wire's per-list offer, `listWordRefusal`). P3 — what `checkList` mends after a pick is SAID under the group.
|
|
15
|
+
* Below Pro the round-two words show with the plan mark and cannot be picked (AW-D23).
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** One word of a row. */
|
|
19
|
+
export interface ListPanelWord {
|
|
20
|
+
readonly word: string;
|
|
21
|
+
/** The contract's meaning — the row's hint. */
|
|
22
|
+
readonly meaning: string;
|
|
23
|
+
/** A round-two word (the plan mark). */
|
|
24
|
+
readonly pro: boolean;
|
|
25
|
+
/** A hover word: phones never show it, so its hint says "(mouse)" (P4). */
|
|
26
|
+
readonly mouse: boolean;
|
|
27
|
+
/** Why it cannot be picked, or null. */
|
|
28
|
+
readonly refusal: ListWordRefusal | null;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** One row of the group: an ingredient, its words, what the list wears now. */
|
|
32
|
+
export interface ListPanelRow {
|
|
33
|
+
readonly ingredient: ListIngredient;
|
|
34
|
+
/** Several words at once (move, hover) — a multi-select. */
|
|
35
|
+
readonly many: boolean;
|
|
36
|
+
readonly words: ReadonlyArray<ListPanelWord>;
|
|
37
|
+
/** The word(s) the list wears. */
|
|
38
|
+
readonly value: string | ReadonlyArray<string>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** What the panel is judged against. */
|
|
42
|
+
export interface ListPanelContext {
|
|
43
|
+
/** The list the section shows (`layoutListShapes`), or null when unknown — nothing is refused for its data then. */
|
|
44
|
+
readonly shape: LayoutListShape | null;
|
|
45
|
+
/** The studio's plan tier (`award` wears every word); absent: nothing is held back for the plan. */
|
|
46
|
+
readonly tier?: string | null;
|
|
47
|
+
/** The business type's never rule (`LIST_NEVER`). */
|
|
48
|
+
readonly never?: LayoutListNever | null;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const MANY: ReadonlySet<string> = new Set(LIST_TABLE.many as ReadonlyArray<string>);
|
|
52
|
+
const HOVER: ListIngredient = 'hover';
|
|
53
|
+
|
|
54
|
+
/** The word(s) a mix wears for an ingredient. */
|
|
55
|
+
export function listMixValue(mix: LayoutListMix, k: ListIngredient): string | ReadonlyArray<string> {
|
|
56
|
+
switch (k) {
|
|
57
|
+
case 'who': return mix.standout?.who ?? LayoutListWho.None;
|
|
58
|
+
case 'how': return mix.standout?.how ?? String((LIST_TABLE.defaults as unknown as Readonly<Record<string, unknown>>)['how']);
|
|
59
|
+
case 'move': return mix.move;
|
|
60
|
+
case 'hover': return mix.hover;
|
|
61
|
+
default: return (mix as unknown as Record<string, string>)[k];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** The group's rows for a list — every ingredient the product draws, in the table's order. */
|
|
66
|
+
export function listPanelRows(mix: LayoutListMix, ctx: ListPanelContext): ListPanelRow[] {
|
|
67
|
+
return LIST_INGREDIENTS.map(k => ({
|
|
68
|
+
ingredient: k,
|
|
69
|
+
many: MANY.has(k),
|
|
70
|
+
value: listMixValue(mix, k),
|
|
71
|
+
words: listBuiltWords(k).map(word => ({
|
|
72
|
+
word,
|
|
73
|
+
meaning: listMeaning(k, word),
|
|
74
|
+
pro: listWordTier(k, word) === 'pro',
|
|
75
|
+
mouse: k === HOVER,
|
|
76
|
+
refusal: listWordRefusal(k, word, ctx.shape, ctx.tier, ctx.never),
|
|
77
|
+
})),
|
|
78
|
+
}));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** A pick's outcome: the mix the list is recomposed with, what the harness mended (said under the group), and what it
|
|
82
|
+
* refused (the pick is not applied). */
|
|
83
|
+
export interface ListPick {
|
|
84
|
+
readonly mix: LayoutListMix;
|
|
85
|
+
readonly said: ReadonlyArray<string>;
|
|
86
|
+
readonly refused: ReadonlyArray<LayoutIssue>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The mix with one ingredient set (a single word) or toggled (a word of a `many` ingredient). Pure. */
|
|
90
|
+
export function withListWord(mix: LayoutListMix, k: ListIngredient, word: string): LayoutListMix {
|
|
91
|
+
const next: LayoutListMix = structuredClone(mix);
|
|
92
|
+
if (k === 'move' || k === 'hover') {
|
|
93
|
+
const list = next[k] as string[];
|
|
94
|
+
(next as unknown as Record<string, string[]>)[k] = list.includes(word) ? list.filter(w => w !== word) : [...list, word];
|
|
95
|
+
} else if (k === 'who') {
|
|
96
|
+
if (word === LayoutListWho.None) delete next.standout;
|
|
97
|
+
else next.standout = { who: word as LayoutListWho, ...(next.standout?.how ? { how: next.standout.how } : {}) };
|
|
98
|
+
} else if (k === 'how') {
|
|
99
|
+
next.standout = { who: next.standout?.who ?? LayoutListWho.First, how: word as LayoutListHow };
|
|
100
|
+
} else {
|
|
101
|
+
(next as unknown as Record<string, string>)[k] = word;
|
|
102
|
+
}
|
|
103
|
+
return next;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* The owner picks a word: refused outright when the word cannot be picked here (the row shows why), else the new mix
|
|
108
|
+
* judged by the ONE `checkList` — its mends applied and said, its refusals returned (the list stays as it was). Pure.
|
|
109
|
+
*/
|
|
110
|
+
export function pickListWord(mix: LayoutListMix, k: ListIngredient, word: string, ctx: ListPanelContext): ListPick {
|
|
111
|
+
const refusal = listWordRefusal(k, word, ctx.shape, ctx.tier, ctx.never);
|
|
112
|
+
const adding = !(k === 'move' || k === 'hover') || !(mix[k] as string[]).includes(word);
|
|
113
|
+
if (refusal && adding) {
|
|
114
|
+
return { mix, said: [], refused: [{ code: LayoutIssueCode.Value, path: `list.${k}`, message: `${k} "${word}": ${refusal}` }] };
|
|
115
|
+
}
|
|
116
|
+
const next = withListWord(mix, k, word);
|
|
117
|
+
const issues = checkList(next, ctx.shape, 'list', ctx.never, { tier: ctx.tier });
|
|
118
|
+
const refused = issues.filter(i => !i.mend);
|
|
119
|
+
if (refused.length) return { mix, said: [], refused };
|
|
120
|
+
const mend = issues.map(i => i.mend).find(m => m?.kind === LayoutMendKind.List);
|
|
121
|
+
return { mix: mend?.kind === LayoutMendKind.List ? mend.mix : next, said: issues.map(i => i.message), refused: [] };
|
|
122
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
-
LAYOUT_TEXT_KINDS, LayoutLayer, LayoutLayerKind, LayoutListArrange, LayoutRole, LayoutSection, LayoutSize,
|
|
2
|
+
LAYOUT_TEXT_KINDS, LayoutLayer, LayoutLayerKind, LayoutListArrange, LayoutListHover, LayoutListMix, LayoutRole, LayoutSection, LayoutSize,
|
|
3
3
|
} from './layout-language';
|
|
4
|
+
import { LIST_RHYTHMS } from './list-table';
|
|
4
5
|
import { LAYOUT_CHECK_VIEWPORT, layoutTextFits } from './layout-space';
|
|
5
6
|
|
|
6
7
|
/**
|
|
@@ -150,3 +151,55 @@ export function layoutListPair(s: LayoutSection, li: number, side: `${LayoutList
|
|
|
150
151
|
next.phone = [...first, ...was.filter(i => !first.includes(i)), ...next.layers.map((_, i) => i).filter(i => !first.includes(i) && !was.includes(i))];
|
|
151
152
|
return next;
|
|
152
153
|
}
|
|
154
|
+
|
|
155
|
+
// ── AW11 (board award-lists, rule 2 "never cut"): the room a list paints past its items' boxes ─────────────────────
|
|
156
|
+
|
|
157
|
+
/** The room a list's frame keeps around its items, in px at the check's laptop: what leans, hangs or turns paints past
|
|
158
|
+
* its box, and its section clips (`overflow: clip`) — so the room is reserved INSIDE the frame, never left to chance. */
|
|
159
|
+
export interface ListOverhang {
|
|
160
|
+
blockStart: number;
|
|
161
|
+
blockEnd: number;
|
|
162
|
+
inline: number;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** The box a turned item is measured on (a card a third of the laptop's row). */
|
|
166
|
+
const TURNED_ITEM = { width: 360, height: 480 } as const;
|
|
167
|
+
/** A card's own lift under the mouse (the look's card-lift is at most this), added where an item may rise. */
|
|
168
|
+
const LIFT_ROOM = 8;
|
|
169
|
+
const deg = (d: number) => (d * Math.PI) / 180;
|
|
170
|
+
const up4 = (px: number) => Math.ceil(px / 4) * 4;
|
|
171
|
+
/** How far a box's corner passes its own edge, turned by `d` degrees about its middle. */
|
|
172
|
+
function turnRoom(d: number): { block: number; inline: number } {
|
|
173
|
+
const t = deg(Math.abs(d));
|
|
174
|
+
const { width: w, height: h } = TURNED_ITEM;
|
|
175
|
+
return { block: (w / 2) * Math.sin(t) + (h / 2) * (1 - Math.cos(t)), inline: (h / 2) * Math.sin(t) + (w / 2) * (1 - Math.cos(t)) };
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* The room a list mix keeps (AW11, R-H-AW11-2) — from the contract's rhythms, never a guess: a gallery wall's items hang
|
|
180
|
+
* by margins (real room, inside the list), so it keeps only the lift of a picture under the mouse; a tilted list turns
|
|
181
|
+
* its items up to `tiltMaxDeg`; a hover tilt turns a card's ground by `hoverTiltDeg`. A fan holds its arc in its own
|
|
182
|
+
* height (the shared CSS), so it needs none here. Pure.
|
|
183
|
+
*/
|
|
184
|
+
export function listOverhang(mix: Pick<LayoutListMix, 'arrange' | 'hover'>): ListOverhang {
|
|
185
|
+
let blockStart = 0;
|
|
186
|
+
let blockEnd = 0;
|
|
187
|
+
let inline = 0;
|
|
188
|
+
if (mix.arrange === LayoutListArrange.Hang) {
|
|
189
|
+
blockStart = LIFT_ROOM;
|
|
190
|
+
blockEnd = LIFT_ROOM;
|
|
191
|
+
}
|
|
192
|
+
if (mix.arrange === LayoutListArrange.Tilted) {
|
|
193
|
+
const room = turnRoom(LIST_RHYTHMS.tiltMaxDeg);
|
|
194
|
+
blockStart = Math.max(blockStart, room.block + LIFT_ROOM);
|
|
195
|
+
blockEnd = Math.max(blockEnd, room.block);
|
|
196
|
+
inline = Math.max(inline, room.inline);
|
|
197
|
+
}
|
|
198
|
+
if ((mix.hover ?? []).includes(LayoutListHover.Tilt)) {
|
|
199
|
+
const room = turnRoom(LIST_RHYTHMS.hoverTiltDeg);
|
|
200
|
+
blockStart = Math.max(blockStart, room.block);
|
|
201
|
+
blockEnd = Math.max(blockEnd, room.block);
|
|
202
|
+
inline = Math.max(inline, room.inline);
|
|
203
|
+
}
|
|
204
|
+
return { blockStart: up4(blockStart), blockEnd: up4(blockEnd), inline: up4(inline) };
|
|
205
|
+
}
|