@vectoriox/iox-ui 5.147.0 → 5.149.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/composite-core/index.d.ts +15 -1
- package/design-core/index.d.ts +70 -6
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs +31 -2
- package/fesm2022/vectoriox-iox-ui-composite-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +101 -12
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1215 -970
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/generation-core/index.d.ts +116 -39
- package/harness-core/index.d.ts +8 -1
- package/package.json +1 -1
- package/src/composite-core/slider.ts +33 -2
- package/src/design-core/design-apply.ts +6 -0
- package/src/design-core/flavor-spec.generated.ts +48 -0
- package/src/design-core/flavor-tokens.ts +6 -2
- package/src/design-core/header-behaviour.ts +25 -8
- package/src/design-core/node-classes.ts +15 -0
- package/src/design-core/token-css.ts +6 -3
- package/src/generation-core/audit-site.ts +19 -3
- package/src/generation-core/check-layout.ts +34 -6
- package/src/generation-core/compose-layout.ts +64 -41
- package/src/generation-core/compose-site.ts +57 -11
- package/src/generation-core/footer-mix.ts +7 -2
- package/src/generation-core/layout-column.ts +120 -0
- package/src/generation-core/layout-language.ts +66 -12
- package/src/generation-core/layout-space.ts +6 -5
- package/src/generation-core/layout-type.ts +6 -3
- package/src/generation-core/layout-wire.ts +27 -5
- package/src/generation-core/site-spec.generated.ts +11 -23
- package/src/harness-core/business-types.ts +8 -0
- package/styles/iox-design.css +14 -3
|
@@ -1,6 +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, headerInkOf,
|
|
4
|
+
columnWordOf,
|
|
4
5
|
} from '@vectoriox/iox-ui/design-core';
|
|
5
6
|
import { SEO_DESCRIPTION_MAX, SEO_TITLE_MAX, SeoRawDoc } from '@vectoriox/iox-ui/seo-core';
|
|
6
7
|
import { channelOpensNewTab, FORM_ACTIONS_ROLE, FORM_CHANNEL_ROLE, FormPresetChannel, FormPresetDef, FormPresetField, formPresetById, presetFormActions } from '@vectoriox/iox-ui/forms-core';
|
|
@@ -197,7 +198,7 @@ export interface ComposedPage {
|
|
|
197
198
|
locale: `${SiteLocale}`;
|
|
198
199
|
/** DS3: every page the wizard creates follows the look (page-bg / text / font-body). M8 gate 2: a composed page names
|
|
199
200
|
* the plan page its layout is (`layoutSource`; the build adds its run) — what Design ▸ Re-fit recomposes it from. */
|
|
200
|
-
pageSettings: { designSystem: true; layoutSource?: { pageKey: string; runId?: string }; opening?: `${ColorScheme}`; legal?: `${LegalKind}
|
|
201
|
+
pageSettings: { designSystem: true; layoutSource?: { pageKey: string; runId?: string }; opening?: `${ColorScheme}`; legal?: `${LegalKind}`; column?: string };
|
|
201
202
|
/** M1-6c: the page's search-result words — written (a static page) or bound to the route item (a template page),
|
|
202
203
|
* in the seo-core document shape the shared `resolveSeo` reads. */
|
|
203
204
|
seo: SeoRawDoc;
|
|
@@ -1649,6 +1650,7 @@ function composeLayoutPage(
|
|
|
1649
1650
|
name: plan.business.name,
|
|
1650
1651
|
locale: plan.locale ?? DEFAULT_SITE_LOCALE,
|
|
1651
1652
|
dial: layout.dial,
|
|
1653
|
+
...(layout.column ? { column: layout.column } : {}),
|
|
1652
1654
|
look: { preset: preset.id },
|
|
1653
1655
|
motion: layoutMotionOf(preset.id),
|
|
1654
1656
|
sections: layout.sections,
|
|
@@ -1745,9 +1747,11 @@ export function composeSite(plan: SitePlan, context: ComposeContext): ComposedSi
|
|
|
1745
1747
|
const first = layout.sections[0];
|
|
1746
1748
|
const worn = wearPlanOpening(page, stamped, plan, context, design, placeholders, issues, !!(first?.pin || first?.carry));
|
|
1747
1749
|
const opening = worn === stamped ? layoutBandScheme(first?.ground) : schemeOfFirst(worn);
|
|
1750
|
+
// Award §0c CW2 (AW-D34): the column the model chose for this page is the page's own word (absent: the site's).
|
|
1751
|
+
const column = columnWordOf(layout.column);
|
|
1748
1752
|
return {
|
|
1749
1753
|
key: page.key, name: page.name, route: { path: page.route }, isHome: page.isHome === true, status: STATUS_DRAFT, locale,
|
|
1750
|
-
pageSettings: { designSystem: true, layoutSource: { pageKey: page.key }, ...(opening ? { opening } : {}) }, seo: composePageSeo(page, plan),
|
|
1754
|
+
pageSettings: { designSystem: true, layoutSource: { pageKey: page.key }, ...(opening ? { opening } : {}), ...(column ? { column } : {}) }, seo: composePageSeo(page, plan),
|
|
1751
1755
|
layout: wearBodyMix(worn, body),
|
|
1752
1756
|
};
|
|
1753
1757
|
}
|
|
@@ -2018,11 +2022,29 @@ function headerShapeOptions(recipe: HeaderRecipe | null, locale?: string): { eve
|
|
|
2018
2022
|
/** The header pattern the Studio template stamps — and the builder palette's "Navigation bar". */
|
|
2019
2023
|
export const SITE_HEADER_PATTERN = 'nav.inline-cta';
|
|
2020
2024
|
|
|
2021
|
-
/** A page
|
|
2025
|
+
/** A stored page's status, as iox-cms keeps it. */
|
|
2026
|
+
export enum SitePageStatus {
|
|
2027
|
+
Draft = 'draft',
|
|
2028
|
+
Published = 'published',
|
|
2029
|
+
Archived = 'archived',
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/** iox-cms `HandoverState.Moved` (`src/pages/page-handover.ts`): a page a build replaced, moved aside to its `-previous`
|
|
2033
|
+
* address once the new page went live — a copy kept for the owner, never a page of the site. */
|
|
2034
|
+
export const SITE_PAGE_MOVED_ASIDE = 'moved';
|
|
2035
|
+
|
|
2036
|
+
/** A page of the studio as the builder lists it. The facts after `isHome` are the stored page's; a caller that does not
|
|
2037
|
+
* know them (a Site Plan, a spec) leaves them out and the page counts as live. */
|
|
2022
2038
|
export interface SitePageRef {
|
|
2023
2039
|
readonly name: string;
|
|
2024
2040
|
readonly route: string;
|
|
2025
2041
|
readonly isHome?: boolean;
|
|
2042
|
+
/** `status` as stored — absent: live. */
|
|
2043
|
+
readonly status?: string;
|
|
2044
|
+
/** A legal page (`pageSettings.legal`): linked from the footer, never from the navigation. */
|
|
2045
|
+
readonly legal?: boolean;
|
|
2046
|
+
/** The build hand-over (`pages.handover`): a page moved aside is not a page of the site. */
|
|
2047
|
+
readonly handover?: { readonly state?: string } | null;
|
|
2026
2048
|
}
|
|
2027
2049
|
|
|
2028
2050
|
/** What the header is composed from when there is no Site Plan: the studio's name and its pages. */
|
|
@@ -2068,19 +2090,45 @@ const ROUTE_PARAM = ':';
|
|
|
2068
2090
|
const HOME_PATH = '/';
|
|
2069
2091
|
const KEY_UNSAFE = /[^a-z0-9]+/gi;
|
|
2070
2092
|
|
|
2071
|
-
|
|
2072
|
-
|
|
2093
|
+
const pageIsLive = (p: SitePageRef): boolean => p.status === undefined || p.status === SitePageStatus.Published;
|
|
2094
|
+
|
|
2095
|
+
/** The pages of the site: every page the studio holds but an archived one and a copy a build moved aside. What a section
|
|
2096
|
+
* may link to (a button to /contact), what a header is composed among. Pure. */
|
|
2097
|
+
export function sitePages(pages: ReadonlyArray<SitePageRef>): SitePageRef[] {
|
|
2098
|
+
return pages.filter(p => !!p.route && p.status !== SitePageStatus.Archived && p.handover?.state !== SITE_PAGE_MOVED_ASIDE);
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
/**
|
|
2102
|
+
* THE rule for which pages a navigation links to (iox-cms-client#82) — the header the builder composes, its phone menu,
|
|
2103
|
+
* "Pages in the bar", a section's `$navPages`: a page of the site (`sitePages`) that a visitor reaches on the live site —
|
|
2104
|
+
* published (a draft is a 404 there) — and is not Home (the brand links there), not a template page (a `/work/:slug`
|
|
2105
|
+
* route has no single address), not a legal page (the footer's), one per address, in the studio's order. While NOTHING
|
|
2106
|
+
* of the studio is published yet (a site just built, before Publish site) the drafts stand in: Publish site puts them
|
|
2107
|
+
* live together, so none of them is a dead link on the site it will be. Pure.
|
|
2108
|
+
*/
|
|
2073
2109
|
export function siteNavPages(pages: ReadonlyArray<SitePageRef>): SitePageRef[] {
|
|
2074
|
-
|
|
2110
|
+
const ofSite = sitePages(pages);
|
|
2111
|
+
const anyLive = ofSite.some(pageIsLive);
|
|
2112
|
+
const seen = new Set<string>();
|
|
2113
|
+
return ofSite.filter(p => {
|
|
2114
|
+
if (p.isHome || p.route === HOME_PATH || p.route.includes(ROUTE_PARAM) || p.legal) return false;
|
|
2115
|
+
if (anyLive && !pageIsLive(p)) return false;
|
|
2116
|
+
if (seen.has(p.route)) return false;
|
|
2117
|
+
seen.add(p.route);
|
|
2118
|
+
return true;
|
|
2119
|
+
});
|
|
2075
2120
|
}
|
|
2076
2121
|
|
|
2122
|
+
/** The site's pages as a plan's: each `inNav` exactly when `siteNavPages` links it — ONE rule for every composer. */
|
|
2077
2123
|
function navPagePlans(pages: ReadonlyArray<SitePageRef>): PagePlan[] {
|
|
2078
2124
|
const used = new Set<string>();
|
|
2079
|
-
|
|
2125
|
+
const ofSite = sitePages(pages);
|
|
2126
|
+
const nav = new Set(siteNavPages(ofSite));
|
|
2127
|
+
return ofSite.map((p, i) => {
|
|
2080
2128
|
let key = p.route.replace(KEY_UNSAFE, '-').replace(/^-+|-+$/g, '').toLowerCase() || `page-${i}`;
|
|
2081
2129
|
for (let n = 2; used.has(key); n++) key = `${key}-${n}`;
|
|
2082
2130
|
used.add(key);
|
|
2083
|
-
return { key, name: p.name, route: p.route, inNav:
|
|
2131
|
+
return { key, name: p.name, route: p.route, inNav: nav.has(p), isHome: p.isHome === true, sections: [] };
|
|
2084
2132
|
});
|
|
2085
2133
|
}
|
|
2086
2134
|
|
|
@@ -2093,9 +2141,7 @@ function navPagePlans(pages: ReadonlyArray<SitePageRef>): PagePlan[] {
|
|
|
2093
2141
|
/** The plan a studio with no Site Plan stands for, as far as its header goes: its name, its pages (in the navigation or
|
|
2094
2142
|
* not), its language, its look. */
|
|
2095
2143
|
function navHeaderPlan(input: Omit<NavHeaderInput, 'mix' | 'asAsked'>): SitePlan {
|
|
2096
|
-
const
|
|
2097
|
-
const navRoutes = new Set(siteNavPages(input.pages).map(p => p.route));
|
|
2098
|
-
const pages = all.map(p => ({ ...p, inNav: navRoutes.has(p.route) }));
|
|
2144
|
+
const pages = navPagePlans(input.pages);
|
|
2099
2145
|
return { business: input.business, pages, dataSources: [], contentTypes: [], locale: input.locale, design: input.design ?? {} } as unknown as SitePlan;
|
|
2100
2146
|
}
|
|
2101
2147
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { DesignChoices, elementStyleFace, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
|
|
3
|
+
import { layoutColumnPx, layoutGutterPx } from './layout-column';
|
|
3
4
|
import { screenFontSize, screenWordOverflowPx } from './layout-language';
|
|
4
5
|
import { PatternGlobalPosition, PatternNode, SITE_PATTERNS, SitePattern } from './patterns';
|
|
5
6
|
import { SPEC_SITE_FOOTER_PARTS, SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
@@ -271,7 +272,7 @@ export function checkFooter(given: FooterMix, ctx: FooterContext): { mix: Footer
|
|
|
271
272
|
if (left.length) repairs.push({ code: FooterRepairCode.LineHolds, said: `a one-line footer holds only ${F.rules.lineHolds.join(' and ')}: ${left.join(' and ')} left out` });
|
|
272
273
|
holds = kept;
|
|
273
274
|
}
|
|
274
|
-
if (closing === FooterClosing.Name && screenWordOverflowPx(nameWidthEm(ctx), 12, PHONE_WIDTH, true) > 0) {
|
|
275
|
+
if (closing === FooterClosing.Name && screenWordOverflowPx(nameWidthEm(ctx), 12, PHONE_WIDTH, true, { gutter: layoutGutterPx(ctx.design.density) }) > 0) {
|
|
275
276
|
repairs.push({ code: FooterRepairCode.NameTooLong, said: `"${ctx.name}" is too long to stand across a phone: the footer closes with nothing` });
|
|
276
277
|
closing = FooterClosing.None;
|
|
277
278
|
}
|
|
@@ -315,7 +316,11 @@ function columnsOf(count: number): Pick<PatternNode, 'lay' | 'resp'> {
|
|
|
315
316
|
/** The closing name: the business name across the width — fitted to the name in the look's display face as a layout's
|
|
316
317
|
* screen word is (`screenFontSize`, the 12-column room), never under the smallest or over the largest screen word. */
|
|
317
318
|
function closingName(ctx: FooterContext): PatternNode {
|
|
318
|
-
|
|
319
|
+
// Award §0c CW2: in a column the name never runs past it — the site's word stamped as px (a `%` in font-size is the
|
|
320
|
+
// parent's size). A page that wears a narrower word of its own is not known here (the footer is the site's).
|
|
321
|
+
// iox-ui#117: the name reads the column of the PAGE it is on (`content-cap`, re-declared by a page's word), the site's
|
|
322
|
+
// word only its fallback — a global footer fits a narrow page of a contained site.
|
|
323
|
+
return laid(part('name'), { fontSize: screenFontSize(nameWidthEm(ctx), 12, 0, 0, 0, layoutColumnPx(ctx.design.column, ctx.design.density), true) });
|
|
319
324
|
}
|
|
320
325
|
|
|
321
326
|
/** A block it holds: how to reach the business leaves its city to the visit block when the footer holds both. */
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { ColumnId, columnWordOf, contentWidthOf, DensityId, DesignChoices, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
|
|
2
|
+
|
|
3
|
+
import { LAYOUT_COLUMN_GAP } from './layout-language';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A COMPOSED page on the content column (award plan §0c, CW2 — AW-D33…AW-D41). Every composed (CL2) section is the
|
|
7
|
+
* 12-column grid the layout language places its layers on; since CW2 that grid sits on the SAME edge as the header, the
|
|
8
|
+
* footer and every pattern section: `space-inline` (= max(the one gutter `space-edge`, half of what the column leaves)).
|
|
9
|
+
*
|
|
10
|
+
* - The grid's inset is two OUTER tracks, never padding: `[bleed] inset − gap [12 columns] inset − gap [bleed]` — so a
|
|
11
|
+
* layer that bleeds spans into an outer track and reaches the window's edge with no negative margin (T-CW2: a `%` in a
|
|
12
|
+
* cell's margin is the CELL's). A `%` in `grid-template-columns` is the grid's own width, which for a section is the
|
|
13
|
+
* page's (the engine's page without its scrollbar, the canvas's simulated frame) — what `space-inline`'s `%` means.
|
|
14
|
+
* - A grid a sideways section carries `t` screens wide resolves its `%` against `t` pages: its inset is written for it
|
|
15
|
+
* from the same tokens (`layoutTrackInset`).
|
|
16
|
+
* - What cannot read a token — a `screen` word's size (a `%` in `font-size` is the parent's size) and the bar of a gallery
|
|
17
|
+
* that bleeds (a `%` there is the slider's) — is stamped from the PAGE's word at compose time (`layoutColumnPx`): the
|
|
18
|
+
* word composeSite writes as `pageSettings.column`. Wide stamps exactly what a page was before the column.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/** The one inset every composed grid reads — the token, with today's composed gutter where a studio's rows predate it. */
|
|
22
|
+
export const LAYOUT_INSET = 'var(--iox-space-inline, max(4vw, 16px))';
|
|
23
|
+
/** What a composed section stamped before CW2 (`max(4vw, 16px)` a side): the old grid's gutter. */
|
|
24
|
+
export const LAYOUT_LEGACY_GUTTER = 'max(4vw, 16px)';
|
|
25
|
+
/** The share of the window the one gutter takes (`space-edge` = max(4%, space-gutter)) — the contract's `axes.edgeShare`. */
|
|
26
|
+
const EDGE_SHARE = String(SPEC_AXES.edgeShare);
|
|
27
|
+
const EDGE_SHARE_NUM = parseFloat(EDGE_SHARE) / 100;
|
|
28
|
+
const GUTTER_FALLBACK = '16px';
|
|
29
|
+
/** The density a column is read at when the design names none (the packs' usual Spacing). */
|
|
30
|
+
const DEFAULT_DENSITY: DensityId = 'regular';
|
|
31
|
+
const GRID = 12;
|
|
32
|
+
/** The column gap in vw (`LAYOUT_COLUMN_GAP`, `1.2vw`). */
|
|
33
|
+
const GAP_VW = parseFloat(LAYOUT_COLUMN_GAP);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The inset of a grid `track` screens wide, from its own width: a section (`track` 1) reads `space-inline` itself; a
|
|
37
|
+
* sideways section's track holds its `%` against `track` pages, so the same rule is written over `100% / track`.
|
|
38
|
+
*/
|
|
39
|
+
export function layoutTrackInset(track = 1): string {
|
|
40
|
+
if (track <= 1) return LAYOUT_INSET;
|
|
41
|
+
return `max(calc(${EDGE_SHARE} / ${track}), var(--iox-space-gutter, ${GUTTER_FALLBACK}), calc((100% / ${track} - var(--iox-content-width, 100%)) / 2))`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** A composed grid's columns: an outer track a side (the inset less the gap that follows it), then 12 per screen. */
|
|
45
|
+
export function layoutGridColumns(track = 1): string {
|
|
46
|
+
const outer = `calc(${layoutTrackInset(track)} - ${LAYOUT_COLUMN_GAP})`;
|
|
47
|
+
return `${outer} repeat(${GRID * track}, minmax(0, 1fr)) ${outer}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** The grid line a layout line (1..13, 1..12×track+1) stands on, past the start's outer track. */
|
|
51
|
+
export const layoutGridLine = (line: number): number => line + 1;
|
|
52
|
+
/** The first and last lines of a composed grid: a bleed's ends (the window's edges — logical, so RTL mirrors them). */
|
|
53
|
+
export const LAYOUT_BLEED_START_LINE = 1;
|
|
54
|
+
export const LAYOUT_BLEED_END_LINE = -1;
|
|
55
|
+
|
|
56
|
+
/** The column word a composed page wears: its own (`LayoutPage.column`), else the site's (`design.column`), else wide. */
|
|
57
|
+
export function layoutColumnWord(own: unknown, design?: Pick<DesignChoices, 'column'> | null): ColumnId {
|
|
58
|
+
return (columnWordOf(own) ?? columnWordOf(design?.column) ?? SPEC_AXES.columnChoices.pre) as ColumnId;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** A column word's width in px at a density (`column-contained` / `column-narrow`), or null for wide (the window). */
|
|
62
|
+
export function layoutColumnPx(word: unknown, density: DensityId | string | undefined): number | null {
|
|
63
|
+
const densities = SPEC_AXES.densities as Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
64
|
+
const row = densities[String(density)] ?? densities[DEFAULT_DENSITY];
|
|
65
|
+
const value = contentWidthOf(word, name => row?.[name]);
|
|
66
|
+
if (!value || !/px$/.test(value)) return null;
|
|
67
|
+
return parseFloat(value);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** The page's inset at a window `width` px wide (no scrollbar), in px — `space-inline` evaluated: what the e2e and the
|
|
71
|
+
* judges read. `gutter` is the density's `space-gutter`. */
|
|
72
|
+
export function layoutInsetPx(width: number, columnPx: number | null, gutter: number): number {
|
|
73
|
+
const edge = Math.max(EDGE_SHARE_NUM * width, gutter);
|
|
74
|
+
return columnPx === null ? edge : Math.max(edge, (width - columnPx) / 2);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* The bled side's inset of a gallery's bar, in viewport units (inside the slider a `%` is the slider's): the one gutter,
|
|
79
|
+
* and half of what the column leaves when the page wears one. A classic scrollbar shifts it by ≤ 8px — the trade the
|
|
80
|
+
* slider bar already makes (composite-core `BAR_INLINE_PAD`).
|
|
81
|
+
*/
|
|
82
|
+
export function layoutBledBarInset(columnPx: number | null): string {
|
|
83
|
+
const edge = `max(${EDGE_SHARE.replace('%', 'vw')}, var(--iox-space-gutter, ${GUTTER_FALLBACK}))`;
|
|
84
|
+
return columnPx === null ? edge : `max(${EDGE_SHARE.replace('%', 'vw')}, var(--iox-space-gutter, ${GUTTER_FALLBACK}), calc((100vw - ${columnPx}px) / 2))`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Where column `n` (1-based) starts from the page's edge on a composed grid — the inset, then n − 1 columns and their
|
|
89
|
+
* gaps. A ready-made section's padding (`%` = the page's) so its words share the composed sections' edge.
|
|
90
|
+
*/
|
|
91
|
+
export function layoutColumnStart(n: number): string {
|
|
92
|
+
if (n <= 1) return LAYOUT_INSET;
|
|
93
|
+
const column = `((100% - 2 * ${LAYOUT_INSET} - ${GRID - 1} * ${LAYOUT_COLUMN_GAP}) / ${GRID} + ${LAYOUT_COLUMN_GAP})`;
|
|
94
|
+
return `calc(${LAYOUT_INSET} + ${n - 1} * ${column})`;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The grid's room on a laptop `width` px wide, in px: inside the inset, capped at the column (12 columns and 11 gaps). */
|
|
98
|
+
export function layoutGridPx(width: number, columnPx: number | null, gutter: number): number {
|
|
99
|
+
return width - 2 * layoutInsetPx(width, columnPx, gutter);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The column gap at a window `width` px wide, in px. */
|
|
103
|
+
export const layoutGapPx = (width: number): number => (GAP_VW / 100) * width;
|
|
104
|
+
|
|
105
|
+
/** A density's `space-gutter` in px (the one gutter's floor). */
|
|
106
|
+
export function layoutGutterPx(density: DensityId | string | undefined): number {
|
|
107
|
+
const densities = SPEC_AXES.densities as Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
108
|
+
return parseFloat((densities[String(density)] ?? densities[DEFAULT_DENSITY])['space-gutter']) || 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* The px one grid column is judged at on the check's laptop (`LAYOUT_CHECK_VIEWPORT`, AW-D38): wide stays the window's
|
|
113
|
+
* twelfth (the judges' model before the column — no wide page is judged differently); in a column, the column's twelfth
|
|
114
|
+
* (never more than the window's grid). Both contained and narrow bind at 1440.
|
|
115
|
+
*/
|
|
116
|
+
export function layoutJudgeColumnPx(word: unknown, density: DensityId | string | undefined, width: number): number {
|
|
117
|
+
const columnPx = layoutColumnPx(word, density);
|
|
118
|
+
if (columnPx === null) return width / GRID;
|
|
119
|
+
return Math.min(columnPx, width - 2 * layoutGutterPx(density)) / GRID;
|
|
120
|
+
}
|
|
@@ -373,6 +373,10 @@ export enum LayoutDial {
|
|
|
373
373
|
export interface LayoutPage {
|
|
374
374
|
dial: `${LayoutDial}`;
|
|
375
375
|
sections: LayoutSection[];
|
|
376
|
+
/** Award §0c CW2 (AW-D34): the content column the model chose for this page — `wide · contained · narrow` (design-core
|
|
377
|
+
* `ColumnId`), offered per type (a formal type is never offered `wide`; `checkLayout` mends one). Absent = the
|
|
378
|
+
* site's word. composeSite writes it as `pageSettings.column`. */
|
|
379
|
+
column?: string;
|
|
376
380
|
/** Silent section fallback (iox-ui#67): the model's sections given away — replaced by a ready-made one or dropped — each
|
|
377
381
|
* at its place in the model's page. The page's MINIMUMS forgive what these carried; set only by `fallBackBySection`. */
|
|
378
382
|
givenAway?: LayoutGivenAway[];
|
|
@@ -477,8 +481,15 @@ export enum LayoutMendKind {
|
|
|
477
481
|
/** A carried part whose action points at a node the new page no longer has (RD1 — a scroll link to a section that
|
|
478
482
|
* left): the action is dropped from the carry and the drop is said (`mendCarry`), never refused. */
|
|
479
483
|
Link = 'link',
|
|
484
|
+
/** Award §0c CW2 (AW-D34): a page asking a column word its business type never wears (a law firm's `wide`): it takes
|
|
485
|
+
* the column the type is offered first (`contained`) — said to the owner as `column-mended`. A word outside the
|
|
486
|
+
* axis is dropped (the page wears the site's). */
|
|
487
|
+
Column = 'column',
|
|
480
488
|
}
|
|
481
489
|
|
|
490
|
+
/** What the build says when the column a page asked for was mended (award §0c CW2). */
|
|
491
|
+
export const LAYOUT_COLUMN_MENDED = 'column-mended';
|
|
492
|
+
|
|
482
493
|
/** Why a layer's `scrub` is mended (AW10-D12) — the words the build says. */
|
|
483
494
|
export enum LayoutScrubRefusal {
|
|
484
495
|
/** The first screen never scrubs: it is wholly in view at load (AW10-D8); its scroll motion is copy-out. */
|
|
@@ -542,7 +553,8 @@ export type LayoutMend =
|
|
|
542
553
|
| { kind: LayoutMendKind.List; layer: string; mix: LayoutListMix }
|
|
543
554
|
| { kind: LayoutMendKind.ListWords; section: number; layer: number; side: 'start' | 'end'; heading?: string }
|
|
544
555
|
| { kind: LayoutMendKind.Link; handle: string; from: string; to: string }
|
|
545
|
-
| { kind: LayoutMendKind.ShowList; layer: string; source: string; mix: LayoutListMix }
|
|
556
|
+
| { kind: LayoutMendKind.ShowList; layer: string; source: string; mix: LayoutListMix }
|
|
557
|
+
| { kind: LayoutMendKind.Column; column: string | null };
|
|
546
558
|
|
|
547
559
|
export interface LayoutIssue {
|
|
548
560
|
code: `${LayoutIssueCode}`;
|
|
@@ -563,6 +575,8 @@ export interface LayoutSite {
|
|
|
563
575
|
motion?: { ease?: `${LayoutEase}`; pace?: `${LayoutPace}` };
|
|
564
576
|
nav?: { kind?: `${LayoutNavKind}`; links?: Array<{ label: string; to: string }> };
|
|
565
577
|
sections: LayoutSection[];
|
|
578
|
+
/** Award §0c CW2: the page's own column word (`LayoutPage.column`); absent = the design's (`ComposeLayoutOptions.design`). */
|
|
579
|
+
column?: string;
|
|
566
580
|
}
|
|
567
581
|
|
|
568
582
|
// ── The tables the composer reads (the prototype renderer v4's values, `code/renderer-round4.src.html`) ──────────────
|
|
@@ -618,8 +632,7 @@ export const LAYOUT_TEXT_KINDS: ReadonlySet<string> = new Set([
|
|
|
618
632
|
LayoutLayerKind.Word, LayoutLayerKind.Heading, LayoutLayerKind.Text, LayoutLayerKind.Label, LayoutLayerKind.Number, LayoutLayerKind.List,
|
|
619
633
|
]);
|
|
620
634
|
|
|
621
|
-
/** The grid's
|
|
622
|
-
export const LAYOUT_GUTTER = 'max(4vw, 16px)';
|
|
635
|
+
/** The grid's column gap (the prototype's `.grid`). Its inset is the page's column since CW2 — `layout-column.ts`. */
|
|
623
636
|
export const LAYOUT_COLUMN_GAP = '1.2vw';
|
|
624
637
|
/** A depth's `params.phone`: scene-core `ParallaxPhone.Rest` — stacked on a phone, a layer never glides into its neighbour.
|
|
625
638
|
* Stamped verbatim and read where it plays (not imported, as `PatternTrack`); compose-layout.spec holds the two equal. */
|
|
@@ -678,7 +691,7 @@ export function phoneGapBefore(prev: LayoutLayer | null, next: LayoutLayer): num
|
|
|
678
691
|
return 20;
|
|
679
692
|
}
|
|
680
693
|
|
|
681
|
-
/** The grid a laptop page is laid on, in vw: its width inside the gutters (
|
|
694
|
+
/** The grid a laptop page is laid on, in vw: its width inside the gutters (4vw a side in wide), the gap between
|
|
682
695
|
* columns (`LAYOUT_COLUMN_GAP`), and 12 columns. */
|
|
683
696
|
const GRID_VW = 92;
|
|
684
697
|
const COLUMN_GAP_VW = 1.2;
|
|
@@ -687,6 +700,7 @@ const GRID_COLUMNS = 12;
|
|
|
687
700
|
export const LAYOUT_SCREEN_PX: readonly [number, number] = [36, 560];
|
|
688
701
|
const SCREEN_FILL = 0.98;
|
|
689
702
|
const round2 = (n: number) => Math.round(n * 100) / 100;
|
|
703
|
+
const round4 = (n: number) => Math.round(n * 10000) / 10000;
|
|
690
704
|
|
|
691
705
|
/** How wide `cols` columns of the laptop grid stand, in vw (12 columns: 92vw). */
|
|
692
706
|
export function layoutColumnsVw(cols: number): number {
|
|
@@ -694,10 +708,39 @@ export function layoutColumnsVw(cols: number): number {
|
|
|
694
708
|
return cols * column + Math.max(0, cols - 1) * COLUMN_GAP_VW;
|
|
695
709
|
}
|
|
696
710
|
|
|
711
|
+
/** The page a word is judged on (award §0c CW2): the content column's width in px (null: wide — the window), and the
|
|
712
|
+
* density's gutter (the one gutter's floor; default today's composed 16px). */
|
|
713
|
+
export interface LayoutRoomColumn {
|
|
714
|
+
columnPx?: number | null;
|
|
715
|
+
gutter?: number;
|
|
716
|
+
}
|
|
717
|
+
const LEGACY_GUTTER_PX = 16;
|
|
718
|
+
/** `content-cap` in wide (design-core `WIDE_CONTENT_CAP`): the window. */
|
|
719
|
+
const WIDE_CAP = '100vw';
|
|
720
|
+
|
|
697
721
|
/** The room a layer of `cols` columns has on a screen `width` px wide, in px — a phone stacks every layer full width
|
|
698
|
-
* inside its gutters (`max(
|
|
699
|
-
|
|
700
|
-
|
|
722
|
+
* inside its gutters (`max(4%, gutter)` a side); a laptop in a column has the column's 12 columns, never more than the
|
|
723
|
+
* window's (wide: today's 92vw grid). */
|
|
724
|
+
export function layoutRoomPx(cols: number, width: number, phone: boolean, page: LayoutRoomColumn = {}): number {
|
|
725
|
+
const gutter = page.gutter ?? LEGACY_GUTTER_PX;
|
|
726
|
+
if (phone) return width - 2 * Math.max(0.04 * width, gutter);
|
|
727
|
+
const vw = (layoutColumnsVw(cols) * width) / 100;
|
|
728
|
+
if (page.columnPx === null || page.columnPx === undefined) return vw;
|
|
729
|
+
const gap = (COLUMN_GAP_VW / 100) * width;
|
|
730
|
+
const grid = Math.min(width - 2 * Math.max(0.04 * width, gutter), page.columnPx);
|
|
731
|
+
return Math.min(vw, (cols * (grid - (GRID_COLUMNS - 1) * gap)) / GRID_COLUMNS + Math.max(0, cols - 1) * gap);
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/** A `screen` word's width term at a column `columnPx` wide: the px its `cols` columns stand where the column binds
|
|
735
|
+
* (12 columns of the column, 11 gaps of 1.2vw), at `fill / em` — `A px − B vw`. */
|
|
736
|
+
/** The column cap a screen word reads: the COLUMN IN FORCE where it renders (`content-cap`, a length a font-size can
|
|
737
|
+
* read — re-declared by the page's word, iox-ui#117), the stamped column (`fallback`) where a studio's rows lack it. */
|
|
738
|
+
function columnCapCss(cols: number, widthEm: number, fallback: string): string {
|
|
739
|
+
const k = SCREEN_FILL / Math.max(widthEm, 0.01);
|
|
740
|
+
const share = round4((cols / GRID_COLUMNS) * k);
|
|
741
|
+
const vw = round2(COLUMN_GAP_VW * (1 - cols / GRID_COLUMNS) * k);
|
|
742
|
+
const cap = `var(--iox-content-cap, ${fallback})`;
|
|
743
|
+
return vw > 0 ? `calc(${cap} * ${share} - ${vw}vw)` : `calc(${cap} * ${share})`;
|
|
701
744
|
}
|
|
702
745
|
|
|
703
746
|
/**
|
|
@@ -705,16 +748,27 @@ export function layoutRoomPx(cols: number, width: number, phone: boolean): numbe
|
|
|
705
748
|
* own face (design-core `textWidthEm`, from the face's measured letters) — and never stands taller than its rows; never
|
|
706
749
|
* under 36px or over 560px. `rows` 0 sizes by width alone (a phone's stacked word). Held sections are one screen tall.
|
|
707
750
|
*/
|
|
708
|
-
export function screenFontSize(
|
|
751
|
+
export function screenFontSize(
|
|
752
|
+
widthEm: number, cols: number, rows: number, sectionRows: number, screens: number, columnPx: number | null = null, capAlways = false,
|
|
753
|
+
): string {
|
|
709
754
|
const [min, max] = LAYOUT_SCREEN_PX;
|
|
710
755
|
const widthVw = round2((layoutColumnsVw(cols) / Math.max(widthEm, 0.01)) * SCREEN_FILL);
|
|
711
|
-
|
|
756
|
+
// T-CW3: in a column the word never runs past its columns — capped at the column in force, read as `content-cap` (a
|
|
757
|
+
// `%` in font-size is the parent's size, so never `content-width`), the page's word stamped as px its fallback.
|
|
758
|
+
// `capAlways` (a global's word — the footer's closing name, iox-ui#117): capped on every page, `100vw` its fallback
|
|
759
|
+
// in wide, so a page set narrower than the site never sees it run past its column.
|
|
760
|
+
// CW2: a word across all twelve columns also keeps inside the one gutter (`space-gutter` is a px token, so font-size
|
|
761
|
+
// may read it): on a phone and wherever the gutter is wider than 4% of the window, 92vw is more than the room.
|
|
762
|
+
const room = cols >= GRID_COLUMNS ? [`calc((100vw - 2 * var(--iox-space-gutter, ${LEGACY_GUTTER_PX}px)) * ${round4(SCREEN_FILL / Math.max(widthEm, 0.01))})`] : [];
|
|
763
|
+
const capFallback = columnPx ? `${columnPx}px` : capAlways ? WIDE_CAP : null;
|
|
764
|
+
const width = [`${widthVw}vw`, ...(capFallback ? [columnCapCss(cols, widthEm, capFallback)] : []), ...room];
|
|
765
|
+
if (!rows || !sectionRows) return width.length > 1 ? `clamp(${min}px, min(${width.join(', ')}), ${max}px)` : `clamp(${min}px, ${widthVw}vw, ${max}px)`;
|
|
712
766
|
const heightSvh = round2((((rows / sectionRows) * screens * 100) / 0.92) * SCREEN_FILL);
|
|
713
|
-
return `clamp(${min}px, min(${
|
|
767
|
+
return `clamp(${min}px, min(${[...width, `${heightSvh}svh`].join(', ')}), ${max}px)`;
|
|
714
768
|
}
|
|
715
769
|
|
|
716
770
|
/** How many px a `screen` word `widthEm` wide runs past its room at its smallest size, on a screen `width` px wide — 0
|
|
717
771
|
* when it fits. The one thing sizing cannot mend: the static check refuses it (a browser would show it cut). */
|
|
718
|
-
export function screenWordOverflowPx(widthEm: number, cols: number, width: number, phone: boolean): number {
|
|
719
|
-
return Math.max(0, Math.round(LAYOUT_SCREEN_PX[0] * widthEm - layoutRoomPx(cols, width, phone)));
|
|
772
|
+
export function screenWordOverflowPx(widthEm: number, cols: number, width: number, phone: boolean, page: LayoutRoomColumn = {}): number {
|
|
773
|
+
return Math.max(0, Math.round(LAYOUT_SCREEN_PX[0] * widthEm - layoutRoomPx(cols, width, phone, page)));
|
|
720
774
|
}
|
|
@@ -46,17 +46,18 @@ const textOf = (l: LayoutLayer) => String(l.text ?? (l.items ?? []).join(' '));
|
|
|
46
46
|
const advanceOf = (text: string) => (HEBREW.test(text) ? LIM.advance.hebrew : LIM.advance.latin);
|
|
47
47
|
|
|
48
48
|
/** A grid box's size in px on the laptop. */
|
|
49
|
-
export function layoutBoxPx(col: readonly number[], row: readonly number[], s: Pick<LayoutSection, 'pin' | 'screens' | 'rows'
|
|
49
|
+
export function layoutBoxPx(col: readonly number[], row: readonly number[], s: Pick<LayoutSection, 'pin' | 'screens' | 'rows'>, columnPx: number = COLUMN_PX): { w: number; h: number } {
|
|
50
50
|
const height = (s.pin ? 1 : s.screens) * LAYOUT_CHECK_VIEWPORT.height;
|
|
51
|
-
return { w: span(col) *
|
|
51
|
+
return { w: span(col) * columnPx, h: (span(row) * height) / Math.max(1, s.rows) };
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
/** Whether a sized text layer's words fit its box at its size (the check's estimate; a `screen` word is sized to fit).
|
|
55
|
-
|
|
54
|
+
/** Whether a sized text layer's words fit its box at its size (the check's estimate; a `screen` word is sized to fit).
|
|
55
|
+
* `columnPx` is one grid column on the check's laptop — the page's column's twelfth (award §0c CW2, AW-D38). */
|
|
56
|
+
export function layoutTextFits(l: LayoutLayer, s: Pick<LayoutSection, 'pin' | 'screens' | 'rows'>, size: string | undefined = l.size, columnPx: number = COLUMN_PX): boolean {
|
|
56
57
|
const text = textOf(l);
|
|
57
58
|
if (!isText(l) || !size || size === LayoutSize.Screen || !text) return true;
|
|
58
59
|
const px = L.sizePx[size as keyof typeof L.sizePx];
|
|
59
|
-
const box = layoutBoxPx(l.col, l.row, s);
|
|
60
|
+
const box = layoutBoxPx(l.col, l.row, s, columnPx);
|
|
60
61
|
const lines = Math.floor(box.h / (px * LAYOUT_LINE_HEIGHT));
|
|
61
62
|
const items = l.kind === LayoutLayerKind.List ? Math.max(1, l.items?.length ?? 1) : 1;
|
|
62
63
|
return lines >= items && (text.length * px * advanceOf(text)) / Math.max(1, lines) <= box.w * LIM.textFitSlack;
|
|
@@ -2,6 +2,7 @@ import { NO_ELEMENT_STYLE } from '@vectoriox/iox-ui/composite-core';
|
|
|
2
2
|
import { DesignChoices, DesignMode, elementStyleFace, presetChoices, resolveDesignChoices, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
3
3
|
|
|
4
4
|
import { LayoutBleed, LayoutLayer, LayoutLayerKind, LayoutRole, LayoutSize, screenWordOverflowPx } from './layout-language';
|
|
5
|
+
import { layoutColumnPx, layoutGutterPx } from './layout-column';
|
|
5
6
|
|
|
6
7
|
/** The design a page wears when only its look's preset is known: the preset in `mode` (else its own), else the default. */
|
|
7
8
|
export function layoutDesignOf(presetId: string | null | undefined, mode?: string | null): DesignChoices {
|
|
@@ -35,13 +36,15 @@ export function screenWordColumns(l: Pick<LayoutLayer, 'col' | 'bleed'>): number
|
|
|
35
36
|
/** The screens a composed page is judged at (the render check's): a laptop and a phone. */
|
|
36
37
|
const SCREENS: ReadonlyArray<{ width: number; phone: boolean }> = [{ width: 1440, phone: false }, { width: 390, phone: true }];
|
|
37
38
|
|
|
38
|
-
/** Where a `screen` word cannot fit even at its smallest size: the screen and by how many px — null when it fits both.
|
|
39
|
-
|
|
39
|
+
/** Where a `screen` word cannot fit even at its smallest size: the screen and by how many px — null when it fits both.
|
|
40
|
+
* `column` is the page's word (award §0c CW2): on the laptop a column gives the word its columns of the column. */
|
|
41
|
+
export function screenWordMisfit(l: LayoutLayer, design: DesignChoices, column?: string | null): { width: number; phone: boolean; px: number } | null {
|
|
40
42
|
if (l.size !== LayoutSize.Screen || !l.text) return null;
|
|
41
43
|
const em = layoutTextWidthEm(l, design);
|
|
44
|
+
const page = { columnPx: column ? layoutColumnPx(column, design.density) : null, gutter: layoutGutterPx(design.density) };
|
|
42
45
|
for (const s of SCREENS) {
|
|
43
46
|
if (s.phone ? false : !!l.bleed && l.bleed !== LayoutBleed.None) continue;
|
|
44
|
-
const px = screenWordOverflowPx(em, s.phone ? 12 : screenWordColumns(l), s.width, s.phone);
|
|
47
|
+
const px = screenWordOverflowPx(em, s.phone ? 12 : screenWordColumns(l), s.width, s.phone, s.phone ? { gutter: page.gutter } : page);
|
|
45
48
|
if (px > 0) return { ...s, px };
|
|
46
49
|
}
|
|
47
50
|
return null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isScrubId, ScrubId } from '@vectoriox/iox-ui/design-core';
|
|
1
|
+
import { columnWordOf, isScrubId, ScrubId, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
|
|
3
3
|
import { JsonSchema, jsonClosedObject, jsonInteger, jsonListOf, jsonOneOf, jsonText } from './json-schema';
|
|
4
4
|
import {
|
|
@@ -79,8 +79,23 @@ export interface LayoutWireOptions {
|
|
|
79
79
|
/** AW10 (H3): the look's By the scroll (`design.scrub`). Not never, the wire offers `letters` and a layer's `scrub`
|
|
80
80
|
* switch; never or absent, neither (no property is added either way). */
|
|
81
81
|
scrub?: ScrubId | string | null;
|
|
82
|
+
/** Award §0c CW2 (AW-D34, H3): the column words this business type's pages may take (`layoutColumnsOffered` —
|
|
83
|
+
* harness `column.never` left out). Given, the page carries ONE enum `column` (+1 property, 0 unions); absent, or on
|
|
84
|
+
* a redesign (`carry` — its page keeps its word, and the request is at the budget's 40 already), the wire is
|
|
85
|
+
* byte-identical. */
|
|
86
|
+
columns?: ReadonlyArray<string>;
|
|
82
87
|
}
|
|
83
88
|
|
|
89
|
+
/** The column words a page of a type is offered (award §0c, AW-D34): the axis's words less what the type never wears. */
|
|
90
|
+
export function layoutColumnsOffered(never?: ReadonlyArray<string> | null): string[] {
|
|
91
|
+
const blocked = new Set(never ?? []);
|
|
92
|
+
return Object.keys(SPEC_AXES.columns).filter(w => !blocked.has(w));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** The column the layout wire offers, or none: given words and no carry. */
|
|
96
|
+
const columnsOnWire = (options: LayoutWireOptions): ReadonlyArray<string> | null =>
|
|
97
|
+
options.columns?.length && !options.carry ? options.columns : null;
|
|
98
|
+
|
|
84
99
|
/** AW10: the entrance and the switch a look that never scrubs is not offered. */
|
|
85
100
|
const LETTERS = 'letters';
|
|
86
101
|
const SCRUB_FLAG = 'scrub';
|
|
@@ -154,7 +169,7 @@ export interface LayoutWireSection {
|
|
|
154
169
|
id: string; kind: string; screens: number; hold: number; ground: string; rows: number; transition: string; phone: number[];
|
|
155
170
|
layers: LayoutWireLayer[];
|
|
156
171
|
}
|
|
157
|
-
export interface LayoutWire { sections: LayoutWireSection[] }
|
|
172
|
+
export interface LayoutWire { sections: LayoutWireSection[]; column?: string }
|
|
158
173
|
|
|
159
174
|
const text = (d: string) => ({ ...jsonText(), description: d });
|
|
160
175
|
const integer = (d: string) => ({ ...jsonInteger(), description: d });
|
|
@@ -221,7 +236,11 @@ export function layoutWireJsonSchema(options: LayoutWireOptions = {}): JsonSchem
|
|
|
221
236
|
phone: listOf(jsonInteger(), "every layer's index exactly once, in a phone's reading order"),
|
|
222
237
|
layers: listOf(layer, 'the layers'),
|
|
223
238
|
});
|
|
224
|
-
|
|
239
|
+
const columns = columnsOnWire(options);
|
|
240
|
+
const page: Record<string, JsonSchema> = columns
|
|
241
|
+
? { column: oneOf(columns, "the page's content column: wide = the window less the one gutter (a gallery, a bold page) · contained = one centred column · narrow = a reading column (a story, a case study); grounds and bleeds keep the window") }
|
|
242
|
+
: {};
|
|
243
|
+
return closed({ ...page, sections: listOf(section, '4..8 sections') }, 'one composed page in the layout language');
|
|
225
244
|
}
|
|
226
245
|
|
|
227
246
|
const nonEmpty = (v: unknown): v is string => typeof v === 'string' && v.trim() !== '';
|
|
@@ -421,7 +440,9 @@ export function expandLayoutWire(wire: unknown, dial: `${LayoutDial}`): { page:
|
|
|
421
440
|
else (s['layers'] as unknown[]).forEach((l, j) => { if (!isPlainObject(l)) add(`sections[${i}].layers[${j}]`, 'not an object'); });
|
|
422
441
|
});
|
|
423
442
|
if (issues.length) return { page: null, issues };
|
|
424
|
-
|
|
443
|
+
// A word outside the axis is kept as written (`checkLayout` refuses it with a path); none is the site's.
|
|
444
|
+
const column = typeof wire['column'] === 'string' && wire['column'].trim() ? String(wire['column']).trim() : null;
|
|
445
|
+
return { page: { dial, sections: (wire['sections'] as PlainObject[]).map(expandSection), ...(column ? { column } : {}) }, issues: [] };
|
|
425
446
|
}
|
|
426
447
|
|
|
427
448
|
function layerToWire(l: LayoutLayer): LayoutWireLayer {
|
|
@@ -478,8 +499,9 @@ function carryPlaceToWire(s: LayoutSection): LayoutWireSection {
|
|
|
478
499
|
}
|
|
479
500
|
|
|
480
501
|
/** A layout page (or a saved CL2.1 site's sections) → the wire. */
|
|
481
|
-
export function layoutToWire(page: Pick<LayoutPage, 'sections'>): LayoutWire {
|
|
502
|
+
export function layoutToWire(page: Pick<LayoutPage, 'sections'> & Partial<Pick<LayoutPage, 'column'>>): LayoutWire {
|
|
482
503
|
return {
|
|
504
|
+
...(columnWordOf(page.column) ? { column: page.column } : {}),
|
|
483
505
|
sections: page.sections.map(s => (s.carry ? carryPlaceToWire(s) : {
|
|
484
506
|
id: s.id,
|
|
485
507
|
kind: s.signature ? 'signature' : s.kind ?? 'content',
|
|
@@ -34,6 +34,7 @@ export const SPEC_SITE_PLAN_SHAPE = {
|
|
|
34
34
|
"layoutPage": {
|
|
35
35
|
"dial": "'distinct' | 'daring' — how far the page breaks the usual layout (site.layout.vocab.dials; follows How animated, never the model's)",
|
|
36
36
|
"sections": "layoutSection[] — the page in the layout language (site.layout): 4–8 sections of layers on a 12-column grid, checked by generation-core checkLayout, stamped by composeLayout",
|
|
37
|
+
"column?": "string — axes.columns: the content column the model chose for this page (award §0c CW2, AW-D34; offered per type — harness COLUMN_NEVER; absent = the site's word). composeSite writes it as pageSettings.column",
|
|
37
38
|
"givenAway?": "{ at, section }[] — the model's sections silent section fallback gave away (replaced by a ready-made section or dropped), at their places in the model's page; the page's minimums forgive what they carried (iox-ui#67). Set by the server, never by a model"
|
|
38
39
|
},
|
|
39
40
|
"film": {
|
|
@@ -6968,6 +6969,10 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
6968
6969
|
"minScale": 0.9,
|
|
6969
6970
|
"maxTextBlur": 5,
|
|
6970
6971
|
"maxRotate": 8,
|
|
6972
|
+
"listItemMinPx": {
|
|
6973
|
+
"picture": 280,
|
|
6974
|
+
"words": 240
|
|
6975
|
+
},
|
|
6971
6976
|
"longTextChars": 160,
|
|
6972
6977
|
"longTextColumns": 7,
|
|
6973
6978
|
"maxPhotos": 14,
|
|
@@ -11300,8 +11305,12 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
11300
11305
|
"where": "commerce track G (C-D21) — the shop's parts, handed over as words (AW-D19)"
|
|
11301
11306
|
},
|
|
11302
11307
|
"pageColumn": {
|
|
11303
|
-
"built": [
|
|
11304
|
-
|
|
11308
|
+
"built": [
|
|
11309
|
+
"wide",
|
|
11310
|
+
"contained",
|
|
11311
|
+
"narrow"
|
|
11312
|
+
],
|
|
11313
|
+
"where": "award §0c CW2: `LayoutPage.column` on the layout wire (generation-core layoutWireJsonSchema `columns`, offered per type — harness COLUMN_NEVER; `checkLayout` mends a never word, `column-mended`); composeSite writes it as `pageSettings.column`"
|
|
11305
11314
|
}
|
|
11306
11315
|
},
|
|
11307
11316
|
"rows": [
|
|
@@ -11416,27 +11425,6 @@ export const SPEC_SITE_LAYOUT = {
|
|
|
11416
11425
|
"drawnAs": null,
|
|
11417
11426
|
"tier": "pro",
|
|
11418
11427
|
"meaning": "an out-of-season card with notify me"
|
|
11419
|
-
},
|
|
11420
|
-
{
|
|
11421
|
-
"key": "pageColumn.wide",
|
|
11422
|
-
"phase": "CW2",
|
|
11423
|
-
"drawnAs": null,
|
|
11424
|
-
"tier": "all",
|
|
11425
|
-
"meaning": "the page runs the window minus the one gutter (a gallery, a bold page) — never a formal type"
|
|
11426
|
-
},
|
|
11427
|
-
{
|
|
11428
|
-
"key": "pageColumn.contained",
|
|
11429
|
-
"phase": "CW2",
|
|
11430
|
-
"drawnAs": null,
|
|
11431
|
-
"tier": "all",
|
|
11432
|
-
"meaning": "the page's words sit in one centred column; grounds keep the window"
|
|
11433
|
-
},
|
|
11434
|
-
{
|
|
11435
|
-
"key": "pageColumn.narrow",
|
|
11436
|
-
"phase": "CW2",
|
|
11437
|
-
"drawnAs": null,
|
|
11438
|
-
"tier": "all",
|
|
11439
|
-
"meaning": "a reading column — a story, a case study, a long page of words"
|
|
11440
11428
|
}
|
|
11441
11429
|
]
|
|
11442
11430
|
}
|