@vectoriox/iox-ui 5.146.0 → 5.148.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 +1154 -959
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +29 -1
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +81 -36
- package/harness-core/index.d.ts +8 -1
- package/index.d.ts +23 -2
- 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/check-layout.ts +34 -6
- package/src/generation-core/compose-layout.ts +64 -41
- package/src/generation-core/compose-site.ts +6 -2
- 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
|
@@ -486,6 +486,12 @@ export const SPEC_TIERS = {
|
|
|
486
486
|
"group": "space",
|
|
487
487
|
"desc": "The column in force: 100% (wide) or a column's width — the site's word; a page's word re-declares it"
|
|
488
488
|
},
|
|
489
|
+
{
|
|
490
|
+
"name": "content-cap",
|
|
491
|
+
"type": "spacing",
|
|
492
|
+
"group": "space",
|
|
493
|
+
"desc": "The column in force as a length a font-size can read: the column's px, 100vw in wide (never a %) — a page's word re-declares it"
|
|
494
|
+
},
|
|
489
495
|
{
|
|
490
496
|
"name": "space-inline",
|
|
491
497
|
"type": "spacing",
|
|
@@ -6839,6 +6845,13 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
6839
6845
|
"group": "space",
|
|
6840
6846
|
"value": "1240px"
|
|
6841
6847
|
},
|
|
6848
|
+
{
|
|
6849
|
+
"name": "content-cap",
|
|
6850
|
+
"tier": "semantic",
|
|
6851
|
+
"type": "spacing",
|
|
6852
|
+
"group": "space",
|
|
6853
|
+
"value": "1240px"
|
|
6854
|
+
},
|
|
6842
6855
|
{
|
|
6843
6856
|
"name": "space-inline",
|
|
6844
6857
|
"tier": "semantic",
|
|
@@ -9250,6 +9263,13 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
9250
9263
|
"group": "space",
|
|
9251
9264
|
"value": "1280px"
|
|
9252
9265
|
},
|
|
9266
|
+
{
|
|
9267
|
+
"name": "content-cap",
|
|
9268
|
+
"tier": "semantic",
|
|
9269
|
+
"type": "spacing",
|
|
9270
|
+
"group": "space",
|
|
9271
|
+
"value": "1280px"
|
|
9272
|
+
},
|
|
9253
9273
|
{
|
|
9254
9274
|
"name": "space-inline",
|
|
9255
9275
|
"tier": "semantic",
|
|
@@ -11691,6 +11711,13 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
11691
11711
|
"group": "space",
|
|
11692
11712
|
"value": "1240px"
|
|
11693
11713
|
},
|
|
11714
|
+
{
|
|
11715
|
+
"name": "content-cap",
|
|
11716
|
+
"tier": "semantic",
|
|
11717
|
+
"type": "spacing",
|
|
11718
|
+
"group": "space",
|
|
11719
|
+
"value": "1240px"
|
|
11720
|
+
},
|
|
11694
11721
|
{
|
|
11695
11722
|
"name": "space-inline",
|
|
11696
11723
|
"tier": "semantic",
|
|
@@ -14130,6 +14157,13 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
14130
14157
|
"group": "space",
|
|
14131
14158
|
"value": "1240px"
|
|
14132
14159
|
},
|
|
14160
|
+
{
|
|
14161
|
+
"name": "content-cap",
|
|
14162
|
+
"tier": "semantic",
|
|
14163
|
+
"type": "spacing",
|
|
14164
|
+
"group": "space",
|
|
14165
|
+
"value": "1240px"
|
|
14166
|
+
},
|
|
14133
14167
|
{
|
|
14134
14168
|
"name": "space-inline",
|
|
14135
14169
|
"tier": "semantic",
|
|
@@ -16582,6 +16616,13 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
16582
16616
|
"group": "space",
|
|
16583
16617
|
"value": "1240px"
|
|
16584
16618
|
},
|
|
16619
|
+
{
|
|
16620
|
+
"name": "content-cap",
|
|
16621
|
+
"tier": "semantic",
|
|
16622
|
+
"type": "spacing",
|
|
16623
|
+
"group": "space",
|
|
16624
|
+
"value": "1240px"
|
|
16625
|
+
},
|
|
16585
16626
|
{
|
|
16586
16627
|
"name": "space-inline",
|
|
16587
16628
|
"tier": "semantic",
|
|
@@ -19003,6 +19044,13 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
19003
19044
|
"group": "space",
|
|
19004
19045
|
"value": "1200px"
|
|
19005
19046
|
},
|
|
19047
|
+
{
|
|
19048
|
+
"name": "content-cap",
|
|
19049
|
+
"tier": "semantic",
|
|
19050
|
+
"type": "spacing",
|
|
19051
|
+
"group": "space",
|
|
19052
|
+
"value": "1200px"
|
|
19053
|
+
},
|
|
19006
19054
|
{
|
|
19007
19055
|
"name": "space-inline",
|
|
19008
19056
|
"tier": "semantic",
|
|
@@ -6,7 +6,7 @@ import {
|
|
|
6
6
|
DesignChoices, DesignTokenRow, FlavorPackV2, FlavorSpecToken, flavorSourceStamp, PRE_MOTION, USER_TOKEN_SOURCE,
|
|
7
7
|
} from './design-token.model';
|
|
8
8
|
import { motionCurve, motionLanguageOf } from './motion-language';
|
|
9
|
-
import { CONTENT_WIDTH_TOKEN, contentWidthOf } from './node-classes';
|
|
9
|
+
import { CONTENT_CAP_TOKEN, CONTENT_WIDTH_TOKEN, contentCapOf, contentWidthOf } from './node-classes';
|
|
10
10
|
import { stylePresetOfChoices } from './style-presets';
|
|
11
11
|
|
|
12
12
|
/**
|
|
@@ -95,8 +95,12 @@ export function buildFlavorTokens(pack: FlavorPackV2, choices: DesignChoices): D
|
|
|
95
95
|
]) set(name, value);
|
|
96
96
|
|
|
97
97
|
// Award §0c: the column in force, as the literal the chosen density gives its word (wide = the whole page).
|
|
98
|
-
const
|
|
98
|
+
const word = choices.column ?? pack.defaults.column;
|
|
99
|
+
const content = contentWidthOf(word, name => byName.get(name)?.value);
|
|
99
100
|
if (content) set(CONTENT_WIDTH_TOKEN, content);
|
|
101
|
+
// …and as a length a font-size can read (`content-cap`, iox-ui#117) — only where the pack holds the row.
|
|
102
|
+
const cap = contentCapOf(word, name => byName.get(name)?.value);
|
|
103
|
+
if (cap && byName.has(CONTENT_CAP_TOKEN)) set(CONTENT_CAP_TOKEN, cap);
|
|
100
104
|
|
|
101
105
|
// AW3 (MB-D1, MB-D5): the look's own arrival and leave — every entrance, dialog and menu moves on them.
|
|
102
106
|
const language = motionLanguageOf(choices, stylePresetOfChoices(choices)?.id);
|
|
@@ -110,17 +110,34 @@ export enum BrandNameLength {
|
|
|
110
110
|
Long = 'long',
|
|
111
111
|
/** Wears `size-body` on a phone. */
|
|
112
112
|
Longer = 'longer',
|
|
113
|
+
/** Wears `size-small` on a phone (vectoriox/iox-ui#120: a name that took three lines at `size-body`). */
|
|
114
|
+
Longest = 'longest',
|
|
113
115
|
}
|
|
114
116
|
|
|
115
|
-
/** From this many characters a name is `long`, then `longer`. Below it the name keeps its own size (a
|
|
116
|
-
* 16-character name in two lines at the largest heading size the looks give a brand). */
|
|
117
|
+
/** From this many characters a name is `long`, then `longer`, then `longest`. Below it the name keeps its own size (a
|
|
118
|
+
* phone bar holds a 16-character name in two lines at the largest heading size the looks give a brand). */
|
|
117
119
|
export const BRAND_NAME_LONG_AT = 17;
|
|
118
120
|
export const BRAND_NAME_LONGER_AT = 29;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
export const BRAND_NAME_LONGEST_AT = 36;
|
|
122
|
+
|
|
123
|
+
/** vectoriox/iox-ui#120: a line never breaks inside a word, so the LONGEST WORD decides too — a word from this many
|
|
124
|
+
* letters does not fit one line of the bar at the size the name's length alone would give it ("Neighbourhoo|d Café"). */
|
|
125
|
+
export const BRAND_WORD_LONG_AT = 10;
|
|
126
|
+
export const BRAND_WORD_LONGER_AT = 12;
|
|
127
|
+
export const BRAND_WORD_LONGEST_AT = 15;
|
|
128
|
+
|
|
129
|
+
const BRAND_STEPS: ReadonlyArray<{ length: BrandNameLength; name: number; word: number }> = [
|
|
130
|
+
{ length: BrandNameLength.Longest, name: BRAND_NAME_LONGEST_AT, word: BRAND_WORD_LONGEST_AT },
|
|
131
|
+
{ length: BrandNameLength.Longer, name: BRAND_NAME_LONGER_AT, word: BRAND_WORD_LONGER_AT },
|
|
132
|
+
{ length: BrandNameLength.Long, name: BRAND_NAME_LONG_AT, word: BRAND_WORD_LONG_AT },
|
|
133
|
+
];
|
|
134
|
+
|
|
135
|
+
/** The name's attributes: `{}` for a name that keeps its size. Never shortens the words — the type steps down, by the
|
|
136
|
+
* name's length and by its longest word, whichever asks for the smaller step. */
|
|
121
137
|
export function brandNameAttributes(words: string): Record<string, string> {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
138
|
+
const text = words.replace(/<[^>]+>/g, '').replace(/\s+/g, ' ').trim();
|
|
139
|
+
const n = [...text].length;
|
|
140
|
+
const word = Math.max(0, ...text.split(' ').map(w => [...w].length));
|
|
141
|
+
const step = BRAND_STEPS.find(s => n >= s.name || word >= s.word);
|
|
142
|
+
return step ? { [BRAND_NAME_ATTRIBUTE]: step.length } : {};
|
|
126
143
|
}
|
|
@@ -92,6 +92,14 @@ export const COLUMN_SETTING = 'column';
|
|
|
92
92
|
export const CONTENT_WIDTH_TOKEN = 'content-width';
|
|
93
93
|
/** What `content-width` holds for Wide: the whole page, so the inset is the one gutter (`space-edge`). */
|
|
94
94
|
export const WIDE_CONTENT_WIDTH = '100%';
|
|
95
|
+
/**
|
|
96
|
+
* Award §0c CW2 (iox-ui#117): the column in force as a LENGTH a `font-size` can read — a `%` there is the parent's
|
|
97
|
+
* font size, so `content-width` (100% in wide) cannot be read by a screen word. The column's px, `100vw` in wide;
|
|
98
|
+
* re-declared beside `content-width` by a page's word, so a global footer's closing name fits the page it is on.
|
|
99
|
+
*/
|
|
100
|
+
export const CONTENT_CAP_TOKEN = 'content-cap';
|
|
101
|
+
/** What `content-cap` holds for Wide: the window. */
|
|
102
|
+
export const WIDE_CONTENT_CAP = '100vw';
|
|
95
103
|
|
|
96
104
|
type ColumnWord = keyof typeof SPEC_AXES.columns;
|
|
97
105
|
const COLUMN_WORDS = SPEC_AXES.columns as Readonly<Record<string, { readonly column: string | null }>>;
|
|
@@ -113,6 +121,13 @@ export function contentWidthOf(column: unknown, rowValue: (name: string) => stri
|
|
|
113
121
|
return row ? rowValue(row) ?? null : WIDE_CONTENT_WIDTH;
|
|
114
122
|
}
|
|
115
123
|
|
|
124
|
+
/** The literal `content-cap` holds for a column word: the column's px (the same row `content-width` reads), `100vw` in
|
|
125
|
+
* wide. Null for an unknown word or a column row the set lacks. */
|
|
126
|
+
export function contentCapOf(column: unknown, rowValue: (name: string) => string | undefined): string | null {
|
|
127
|
+
const width = contentWidthOf(column, rowValue);
|
|
128
|
+
return width === WIDE_CONTENT_WIDTH ? WIDE_CONTENT_CAP : width;
|
|
129
|
+
}
|
|
130
|
+
|
|
116
131
|
/** The selector a column word's block is declared on, inside `scope` (the builder's token scope — the attribute sits on
|
|
117
132
|
* the scope element itself) or anywhere (the engine's `<body>`). */
|
|
118
133
|
export function columnSelector(word: string, scope?: string): string {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DesignMode } from './design-token.model';
|
|
2
2
|
import { SPEC_A11Y, SPEC_AXES, SPEC_SCHEMES } from './flavor-spec.generated';
|
|
3
|
-
import { columnSelector, CONTENT_WIDTH_TOKEN, contentWidthOf, openingFollowerSelector, SCHEME_INK } from './node-classes';
|
|
3
|
+
import { columnSelector, CONTENT_CAP_TOKEN, CONTENT_WIDTH_TOKEN, contentCapOf, contentWidthOf, openingFollowerSelector, SCHEME_INK } from './node-classes';
|
|
4
4
|
import { specTokenNames } from './token-names';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -13,7 +13,7 @@ import { specTokenNames } from './token-names';
|
|
|
13
13
|
* 1. base `:root { --iox-*: … }`
|
|
14
14
|
* 2. schemes `.iox-scheme-<id> { overrides; every var()-referencing token re-declared }`, then the
|
|
15
15
|
* ONE scheme-ink rule `.iox-scheme-subtle, … { color: var(--iox-text) }` (iox-ui#15)
|
|
16
|
-
* columns `[data-iox-column="<word>"] { --iox-content-width: <literal>; every token reading it }` (award §0c)
|
|
16
|
+
* columns `[data-iox-column="<word>"] { --iox-content-width: <literal>; --iox-content-cap: <length>; every token reading it }` (award §0c)
|
|
17
17
|
* 3. reduced motion `@media (prefers-reduced-motion: reduce)`
|
|
18
18
|
* 4. reduced transparency `@media (prefers-reduced-transparency: reduce)`
|
|
19
19
|
* 5. dark — LAST `@media (prefers-color-scheme: dark)`
|
|
@@ -351,9 +351,12 @@ function columnCss(rows: ReadonlyArray<DesignTokenLike>, scope?: string): { base
|
|
|
351
351
|
.map(word => [word, contentWidthOf(word, value)] as const)
|
|
352
352
|
.filter((w): w is readonly [string, string] => w[1] !== null);
|
|
353
353
|
const darkDependents = dependents.map((t): [string, string | null] => [t.name, darkOf(t)]).filter((e): e is [string, string] => e[1] !== null);
|
|
354
|
+
// iox-ui#117: `content-cap` (the column as a length) moves with the word — only where the rows hold it.
|
|
355
|
+
const capped = rows.some(t => t.name === CONTENT_CAP_TOKEN);
|
|
354
356
|
return {
|
|
355
357
|
base: words.map(([word, width]) => rule(columnSelector(word, scope), [
|
|
356
|
-
[CONTENT_WIDTH_TOKEN, width], ...
|
|
358
|
+
[CONTENT_WIDTH_TOKEN, width], ...(capped ? [[CONTENT_CAP_TOKEN, contentCapOf(word, value)!] as [string, string]] : []),
|
|
359
|
+
...dependents.filter(t => t.name !== CONTENT_CAP_TOKEN).map((t): [string, string] => [t.name, t.value]),
|
|
357
360
|
])).filter(Boolean).join('\n'),
|
|
358
361
|
// A dependent with a dark value would keep its LIGHT value under the word's block in a dark visit.
|
|
359
362
|
dark: darkDependents.length ? words.map(([word]) => rule(columnSelector(word, scope), darkDependents, ' ')).join('\n') : '',
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { DesignChoices, designTokenRows, parseCssColour, presetChoices, relativeLuminance, resolveTokenValues, ScrubId, scrubOfChoices, toHexColor } from '@vectoriox/iox-ui/design-core';
|
|
1
|
+
import { columnWordOf, DesignChoices, designTokenRows, parseCssColour, presetChoices, relativeLuminance, resolveTokenValues, ScrubId, scrubOfChoices, SPEC_AXES, toHexColor } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
import { ParallaxDepth } from '@vectoriox/iox-ui/scene-core';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
LAYOUT_HIDDEN_OPACITY, LAYOUT_OPERATED, LAYOUT_TEXT_KINDS, LayoutBandMove, LayoutColour, LayoutDepth, LayoutDial, LayoutEnter, LayoutGalleryList, LayoutIssue, LayoutListShape, LayoutIssueCode, LayoutLayer, LayoutLayerKind, LayoutMend, LayoutMendKind,
|
|
5
|
+
LAYOUT_COLUMN_MENDED, LAYOUT_HIDDEN_OPACITY, LAYOUT_OPERATED, LAYOUT_TEXT_KINDS, LayoutBandMove, LayoutColour, LayoutDepth, LayoutDial, LayoutEnter, LayoutGalleryList, LayoutIssue, LayoutListShape, LayoutIssueCode, LayoutLayer, LayoutLayerKind, LayoutMend, LayoutMendKind,
|
|
6
6
|
LayoutGivenAway, LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListItem, LayoutListMix, LayoutListPhone, LayoutPage, LayoutPhotoSource,
|
|
7
7
|
LayoutRole, LayoutScrubRefusal, LayoutSection, LayoutSectionKind, LayoutSourceChoice, LayoutTrackProp, parseLayoutPhotoId,
|
|
8
8
|
} from './layout-language';
|
|
9
9
|
import { layoutScrubTakes } from './text-scroll';
|
|
10
|
+
import { layoutColumnsOffered } from './layout-wire';
|
|
11
|
+
import { layoutColumnWord, layoutJudgeColumnPx } from './layout-column';
|
|
10
12
|
import { DriftBox, driftOverlap, layoutGlideDepth } from './layout-drift';
|
|
11
13
|
import { layoutLookOf } from './layout-look';
|
|
12
14
|
import { patternById, SCENE_LEVEL } from './patterns';
|
|
@@ -80,6 +82,9 @@ export interface CheckLayoutContext {
|
|
|
80
82
|
rhythm?: string | null;
|
|
81
83
|
/** AW6: how the footer's ground reads — the `tail` rhythm's last sections wear it. Absent: the tail is not judged. */
|
|
82
84
|
footerTone?: GroundTone | null;
|
|
85
|
+
/** Award §0c CW2 (AW-D34): the column words this business type never wears (harness-core `BusinessType.column.never`):
|
|
86
|
+
* a page asking one is mended to the first word it may wear (`column-mended`). */
|
|
87
|
+
columnNever?: ReadonlyArray<string>;
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
/** The look's composition notes, read as one shape (the contract's looks differ in which limits they set). */
|
|
@@ -127,6 +132,21 @@ function presetPaint(presetId: string, mode: 'light' | 'dark'): { colours: Layou
|
|
|
127
132
|
return { colours, accentText: hex(ACCENT_TEXT_TOKEN) ?? colours[LayoutColour.Accent] };
|
|
128
133
|
}
|
|
129
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Award §0c CW2 (AW-D34, R-H25): the page's column word — a word outside the axis is dropped (the page wears the site's);
|
|
137
|
+
* a word the business type never wears (a formal type's `wide`) takes the first it may (`contained`). Both mend alone.
|
|
138
|
+
*/
|
|
139
|
+
export function columnIssues(page: Pick<LayoutPage, 'column'>, ctx: Pick<CheckLayoutContext, 'columnNever'>): LayoutIssue[] {
|
|
140
|
+
if (page?.column === undefined || page.column === null) return [];
|
|
141
|
+
const offered = layoutColumnsOffered(ctx.columnNever);
|
|
142
|
+
if (!columnWordOf(page.column)) {
|
|
143
|
+
return [{ code: LayoutIssueCode.Value, path: 'column', message: `${Object.keys(SPEC_AXES.columns).join(' | ')} — "${page.column}" is no column: the page wears the site's`, mend: { kind: LayoutMendKind.Column, column: null } }];
|
|
144
|
+
}
|
|
145
|
+
if (offered.includes(page.column)) return [];
|
|
146
|
+
const column = offered.includes(SPEC_AXES.columnChoices.new) ? SPEC_AXES.columnChoices.new : offered[0] ?? null;
|
|
147
|
+
return [{ code: LayoutIssueCode.Value, path: 'column', message: `${LAYOUT_COLUMN_MENDED}: this business never wears "${page.column}" — composed ${column ?? "in the site's column"}`, mend: { kind: LayoutMendKind.Column, column } }];
|
|
148
|
+
}
|
|
149
|
+
|
|
130
150
|
/** A preset's five colours in a mode as `#rrggbb` (the prototype's `presetColours`), or null when it does not wear that mode. */
|
|
131
151
|
export function layoutPresetColours(presetId: string, mode: 'light' | 'dark'): LayoutColours | null {
|
|
132
152
|
return presetPaint(presetId, mode)?.colours ?? null;
|
|
@@ -319,6 +339,10 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
319
339
|
const limits = look?.limits ?? {};
|
|
320
340
|
const daring = page.dial === LayoutDial.Daring;
|
|
321
341
|
if (!inList(V.dials, page.dial)) add(LayoutIssueCode.Value, 'dial', V.dials.join(' | '));
|
|
342
|
+
for (const issue of columnIssues(page, ctx)) issues.push(issue);
|
|
343
|
+
// Award §0c CW2 (AW-D38): the px judges read the page's column — its own word, else the design's when one is given.
|
|
344
|
+
const columnWord = layoutColumnWord(columnWordOf(page.column) ? page.column : undefined, ctx.design);
|
|
345
|
+
const judgeColumnPx = layoutJudgeColumnPx(columnWord, design.density, LAYOUT_CHECK_VIEWPORT.width);
|
|
322
346
|
const facts = String(ctx.facts ?? '');
|
|
323
347
|
const factKeys = ctx.factKeys ?? Object.keys(SPEC_SITE_FACTS);
|
|
324
348
|
const routes = ctx.routes ?? [];
|
|
@@ -468,14 +492,14 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
468
492
|
if ((l.size === 'm' || l.size === 's') && text.length > LIM.longTextChars && span(l.col) > LIM.longTextColumns) {
|
|
469
493
|
add(LayoutIssueCode.Reading, `${lp}.col`, `long text is never wider than ${LIM.longTextColumns} columns`);
|
|
470
494
|
}
|
|
471
|
-
if (placed && isText(l) && l.size && l.size !== 'screen' && text && !layoutTextFits(l, s)) {
|
|
472
|
-
const lines = Math.floor(boxPx(l.col, l.row, s).h / (L.sizePx[l.size] * LAYOUT_LINE_HEIGHT));
|
|
495
|
+
if (placed && isText(l) && l.size && l.size !== 'screen' && text && !layoutTextFits(l, s, l.size, judgeColumnPx)) {
|
|
496
|
+
const lines = Math.floor(boxPx(l.col, l.row, s, judgeColumnPx).h / (L.sizePx[l.size] * LAYOUT_LINE_HEIGHT));
|
|
473
497
|
add(LayoutIssueCode.Reading, `${lp}.row`, `${text.length} characters at ${l.size} do not fit a box of ${span(l.col)} columns × ${span(l.row)} rows (about ${Math.max(0, lines)} line${lines === 1 ? '' : 's'}) — give it more rows or columns, or fewer words`);
|
|
474
498
|
}
|
|
475
499
|
if (l.size === 'screen' || l.size === 'xxl') huge++;
|
|
476
500
|
if (l.size === 'screen') {
|
|
477
501
|
screenWords++;
|
|
478
|
-
const misfit = text ? screenWordMisfit(l, design) : null;
|
|
502
|
+
const misfit = text ? screenWordMisfit(l, design, columnWord) : null;
|
|
479
503
|
if (misfit) add(LayoutIssueCode.Reading, `${lp}.text`, `"${text}" is ${misfit.px}px too wide for ${misfit.phone ? `a ${misfit.width}px phone` : 'its columns'} even at the smallest screen size — fewer letters, ${misfit.phone ? '' : 'more columns, '}or size xxl`);
|
|
480
504
|
}
|
|
481
505
|
if (l.bleed && l.bleed !== 'none') bleeds++;
|
|
@@ -642,7 +666,7 @@ function examineLayout(page: LayoutPage, ctx: CheckLayoutContext, carried: Layou
|
|
|
642
666
|
if (placed && (isText(l) || l.kind === LayoutLayerKind.Button)) {
|
|
643
667
|
const under: PhotoUnder[] = layers
|
|
644
668
|
.filter(o => o !== l && o.kind === LayoutLayerKind.Photo && (o.z ?? 0) < (l.z ?? 0) && overlaps(o, l) && o.photo?.id)
|
|
645
|
-
.map(o => ({ id: o.photo!.id, frame: boxPx(o.col, o.row, s), region: regionInLayer(o, l) }));
|
|
669
|
+
.map(o => ({ id: o.photo!.id, frame: boxPx(o.col, o.row, s, judgeColumnPx), region: regionInLayer(o, l) }));
|
|
646
670
|
if (groundPhoto) under.push({ id: groundPhoto, frame: { w: LAYOUT_CHECK_VIEWPORT.width, h: s.screens * LAYOUT_CHECK_VIEWPORT.height }, region: regionOnGround(s, l) });
|
|
647
671
|
const fgHex = isText(l) ? colourHex(l.color, true) : null;
|
|
648
672
|
const fg = fgHex ? lumOf(fgHex) : null;
|
|
@@ -1177,6 +1201,10 @@ export function mendLayout(page: LayoutPage, issues: ReadonlyArray<LayoutIssue>)
|
|
|
1177
1201
|
if (mend.sections.some(m => !next.sections?.[m.section])) continue;
|
|
1178
1202
|
for (const m of mend.sections) next.sections[m.section].screens = m.screens;
|
|
1179
1203
|
mended.push(issue);
|
|
1204
|
+
} else if (mend?.kind === LayoutMendKind.Column) {
|
|
1205
|
+
if (mend.column) next.column = mend.column;
|
|
1206
|
+
else delete next.column;
|
|
1207
|
+
mended.push(issue);
|
|
1180
1208
|
} else if (mend?.kind === LayoutMendKind.Drop && layerAt(mend.layer)) {
|
|
1181
1209
|
drops.push(issue);
|
|
1182
1210
|
}
|
|
@@ -4,22 +4,27 @@ import {
|
|
|
4
4
|
SLIDER_PLACEMENT_TRAIT, SliderPlacement, SliderRole, syncSliderParts, SHOP_RECIPES, ShopRecipe, ShopRole, bindShopPart, ShopBindTarget,
|
|
5
5
|
} from '@vectoriox/iox-ui/composite-core';
|
|
6
6
|
|
|
7
|
-
import { ColorScheme, DesignChoices, LIST_MIX_PROP, LinkType, scrubOfChoices, setColorScheme } from '@vectoriox/iox-ui/design-core';
|
|
7
|
+
import { ColorScheme, DesignChoices, LIST_MIX_PROP, LinkType, scrubOfChoices, setColorScheme, SPEC_AXES } from '@vectoriox/iox-ui/design-core';
|
|
8
8
|
import { TextRevealBy } from '@vectoriox/iox-ui/scene-core';
|
|
9
9
|
import { FORM_AFTER_SEND_TRAIT, FormAfterSend, FormPresetId } from '@vectoriox/iox-ui/forms-core';
|
|
10
10
|
import { composeNavHeader, composePresetForm } from './compose-site';
|
|
11
11
|
import { drawnHeaderMix, headerMixOfNavKind } from './header-mix';
|
|
12
12
|
import { LIST_RULES, LIST_RHYTHMS, listWait } from './list-table';
|
|
13
|
+
import { SPEC_SITE_LAYOUT } from './site-spec.generated';
|
|
13
14
|
import { listMixWords } from './layout-wire';
|
|
14
15
|
import {
|
|
15
|
-
LAYOUT_ACCENT_TEXT, LAYOUT_BEAT_DELAY, LAYOUT_COLOUR_TOKEN, LAYOUT_COLUMN_GAP, LAYOUT_DEPTH_ON_PHONE, LAYOUT_EASING,
|
|
16
|
+
LAYOUT_ACCENT_TEXT, LAYOUT_BEAT_DELAY, LAYOUT_COLOUR_TOKEN, LAYOUT_COLUMN_GAP, LAYOUT_DEPTH_ON_PHONE, LAYOUT_EASING, LAYOUT_PACE, LAYOUT_PHONE_BREAKPOINT, LAYOUT_PHOTO_ASPECT, LAYOUT_TOOLTIP_TRAIT,
|
|
16
17
|
LAYOUT_PHONE_PADDING, LAYOUT_RISE, LAYOUT_TEXT_KINDS, LayoutBleed, LayoutColour, LayoutEase, LayoutEnter, LayoutForm, LayoutGallery, LayoutLayer,
|
|
17
18
|
LayoutListArrange, LayoutListArrive, LayoutListHover, LayoutListHow, LayoutListItem, LayoutListMix, LayoutListMove, LayoutListPhone, LayoutListWho,
|
|
18
19
|
LayoutLayerKind, LayoutNavKind, LayoutPace, LayoutPhotoShape, LayoutRole, LayoutSection, LayoutSide, LayoutSite, LayoutTrack, LayoutTrackProp, LayoutTransition, phoneGapBefore,
|
|
19
20
|
screenFontSize,
|
|
20
21
|
} from './layout-language';
|
|
21
22
|
import { layoutGlideDepth } from './layout-drift';
|
|
22
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
LAYOUT_BLEED_END_LINE, LAYOUT_BLEED_START_LINE, LAYOUT_INSET, layoutBledBarInset, layoutColumnPx, layoutColumnStart, layoutColumnWord, layoutGapPx,
|
|
25
|
+
layoutGridColumns, layoutGridLine, layoutGridPx,
|
|
26
|
+
} from './layout-column';
|
|
27
|
+
import { isLayoutRule, LAYOUT_CHECK_VIEWPORT, layoutRuleEdge } from './layout-space';
|
|
23
28
|
import { LIST_DECK_MAX_PX, LIST_DECK_SHARE, listOverhang } from './list-space';
|
|
24
29
|
import { layoutDesignOf, layoutElementStyle, layoutTextWidthEm, screenWordColumns } from './layout-type';
|
|
25
30
|
import { ComposeError, createSerializedNode, SerializedNode, setStyleProps, assertStyleSlots, walkSerialized } from './serialized-node';
|
|
@@ -257,6 +262,9 @@ interface Ctx {
|
|
|
257
262
|
sections: Record<string, string>;
|
|
258
263
|
gaps: LayoutGap[];
|
|
259
264
|
design: DesignChoices;
|
|
265
|
+
/** Award §0c CW2: the page's content column in px at its density, or null (wide): what a `screen` word, a bled
|
|
266
|
+
* gallery's bar and a list's item count are stamped for (`layout-column.ts`). */
|
|
267
|
+
columnPx: number | null;
|
|
260
268
|
photoSrc: (id: string) => string;
|
|
261
269
|
photoAlt: (id: string) => string;
|
|
262
270
|
photoAspect: (id: string) => string;
|
|
@@ -388,14 +396,15 @@ function isLight(colour: string | undefined, mode: LayoutColourMode): boolean {
|
|
|
388
396
|
|
|
389
397
|
const gridTemplate = (count: number) => `repeat(${count}, minmax(0, 1fr))`;
|
|
390
398
|
|
|
391
|
-
/** The grid a section's layers are placed on: 12 columns per screen
|
|
399
|
+
/** The grid a section's layers are placed on: 12 columns per screen between an outer track a side (the page's column,
|
|
400
|
+
* award §0c CW2 — `layoutGridColumns`), its rows. No inline padding: a bleed spans into an outer track. */
|
|
392
401
|
function gridLayout(rows: number, track: number): Record<string, string> {
|
|
393
402
|
return {
|
|
394
403
|
display: 'grid',
|
|
395
|
-
gridTemplateColumns:
|
|
404
|
+
gridTemplateColumns: layoutGridColumns(track),
|
|
396
405
|
gridTemplateRows: gridTemplate(rows),
|
|
397
406
|
gap: `${ZERO} ${LAYOUT_COLUMN_GAP}`,
|
|
398
|
-
padding:
|
|
407
|
+
padding: ZERO,
|
|
399
408
|
};
|
|
400
409
|
}
|
|
401
410
|
|
|
@@ -406,16 +415,10 @@ function phoneStack(first: boolean): Record<string, string> {
|
|
|
406
415
|
flexDirection: 'column',
|
|
407
416
|
height: 'auto',
|
|
408
417
|
gap: ZERO,
|
|
409
|
-
padding: `${first ? PHONE_FIRST_TOP : LAYOUT_PHONE_PADDING} ${
|
|
418
|
+
padding: `${first ? PHONE_FIRST_TOP : LAYOUT_PHONE_PADDING} ${LAYOUT_INSET} ${LAYOUT_PHONE_PADDING} ${LAYOUT_INSET}`,
|
|
410
419
|
};
|
|
411
420
|
}
|
|
412
421
|
|
|
413
|
-
/** A bleed's width: its cell and the gutters it runs into (a negative margin alone moves a box that holds its width). */
|
|
414
|
-
function bleedWidth(bleed: string | undefined): string | null {
|
|
415
|
-
if (!bleed || bleed === LayoutBleed.None) return null;
|
|
416
|
-
return bleed === LayoutBleed.Both ? `calc(100% + 2 * ${LAYOUT_GUTTER})` : `calc(100% + ${LAYOUT_GUTTER})`;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
422
|
/** The physical sides a bleed runs into, from the page's direction. */
|
|
420
423
|
function bleedSides(bleed: string | undefined, rtl: boolean): { left: boolean; right: boolean } | null {
|
|
421
424
|
if (!bleed || bleed === LayoutBleed.None) return null;
|
|
@@ -424,12 +427,16 @@ function bleedSides(bleed: string | undefined, rtl: boolean): { left: boolean; r
|
|
|
424
427
|
return rtl ? { left: end, right: start } : { left: start, right: end };
|
|
425
428
|
}
|
|
426
429
|
|
|
427
|
-
/**
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
430
|
+
/**
|
|
431
|
+
* A layer's columns on the grid (award §0c CW2): its layout lines past the outer track — and a bleed spans into the outer
|
|
432
|
+
* track on its side, to the window's edge (grid lines are logical, so a start bleed is the right edge in Hebrew). Never a
|
|
433
|
+
* negative margin: inside a cell a `%` is the cell's (T-CW2).
|
|
434
|
+
*/
|
|
435
|
+
function gridColumnOf(l: LayoutLayer): string {
|
|
436
|
+
const bleed = l.bleed && l.bleed !== LayoutBleed.None ? l.bleed : null;
|
|
437
|
+
const start = bleed === LayoutBleed.Start || bleed === LayoutBleed.Both ? LAYOUT_BLEED_START_LINE : layoutGridLine(l.col[0]);
|
|
438
|
+
const end = bleed === LayoutBleed.End || bleed === LayoutBleed.Both ? LAYOUT_BLEED_END_LINE : layoutGridLine(l.col[1]);
|
|
439
|
+
return `${start} / ${end}`;
|
|
433
440
|
}
|
|
434
441
|
|
|
435
442
|
// ── Motion ──────────────────────────────────────────────────────────────────────────────────────────────
|
|
@@ -552,17 +559,13 @@ interface LayerCtx {
|
|
|
552
559
|
function place(node: SerializedNode, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): void {
|
|
553
560
|
const stretch = STRETCH_KINDS.has(l.kind);
|
|
554
561
|
const values: Record<string, unknown> = {
|
|
555
|
-
gridColumn:
|
|
562
|
+
gridColumn: gridColumnOf(l),
|
|
556
563
|
gridRow: `${l.row[0]} / ${l.row[1]}`,
|
|
557
564
|
alignSelf: stretch ? 'stretch' : 'center',
|
|
558
565
|
zIndex: String(1 + (l.z ?? 0)),
|
|
559
566
|
position: 'relative',
|
|
560
567
|
minWidth: ZERO,
|
|
561
568
|
};
|
|
562
|
-
const margin = bleedMargin(l.bleed, ctx.rtl);
|
|
563
|
-
if (margin) values['margin'] = margin;
|
|
564
|
-
const width = l.kind === LayoutLayerKind.Button ? null : bleedWidth(l.bleed);
|
|
565
|
-
if (width) values['width'] = width;
|
|
566
569
|
if (l.rotate) values['rotate'] = `${l.rotate}deg`;
|
|
567
570
|
if (l.kind === LayoutLayerKind.Button) values['justifySelf'] = l.align === 'center' ? 'center' : l.align === 'end' ? 'end' : 'start';
|
|
568
571
|
else if (l.kind !== LayoutLayerKind.Photo && l.kind !== LayoutLayerKind.Gallery && l.kind !== LayoutLayerKind.Shape) values['textAlign'] = l.align ?? 'start';
|
|
@@ -571,7 +574,6 @@ function place(node: SerializedNode, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): vo
|
|
|
571
574
|
gridColumn: 'auto', gridRow: 'auto', alignSelf: l.kind === LayoutLayerKind.Button ? 'flex-start' : 'stretch', order: String(lc.order),
|
|
572
575
|
margin: `${lc.phoneGap}px ${ZERO} ${ZERO} ${ZERO}`,
|
|
573
576
|
};
|
|
574
|
-
if (width) onPhone['width'] = FULL;
|
|
575
577
|
if (l.kind === LayoutLayerKind.Button && lc.phoneAlign === 'center') onPhone['alignSelf'] = 'center';
|
|
576
578
|
if (values['textAlign']) onPhone['textAlign'] = lc.phoneAlign;
|
|
577
579
|
if (l.kind === LayoutLayerKind.Shape) onPhone['display'] = 'none';
|
|
@@ -633,7 +635,7 @@ function textLayer(id: string, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): Serializ
|
|
|
633
635
|
const rows = l.row[1] - l.row[0];
|
|
634
636
|
const em = layoutTextWidthEm(l, ctx.design);
|
|
635
637
|
const screens = lc.held ? 1 : lc.section.screens;
|
|
636
|
-
setStyleProps(node, { fontSize: screenFontSize(em, screenWordColumns(l), rows, lc.section.rows, screens) });
|
|
638
|
+
setStyleProps(node, { fontSize: screenFontSize(em, screenWordColumns(l), rows, lc.section.rows, screens, ctx.columnPx) });
|
|
637
639
|
phone(node, { fontSize: screenFontSize(em, GRID_COLUMNS, 0, 0, 0) });
|
|
638
640
|
gap(ctx, LayoutGapCode.ScreenFit, lc.path, 'sized from its face\'s measured letters (no kerning), not fitted in the browser');
|
|
639
641
|
}
|
|
@@ -758,7 +760,8 @@ function galleryLayer(id: string, l: LayoutLayer, lc: LayerCtx, ctx: Ctx): Seria
|
|
|
758
760
|
const sides = bleedSides(l.bleed, ctx.rtl);
|
|
759
761
|
const bar = (slider.children ?? []).find(c => c.role === SliderRole.Bar);
|
|
760
762
|
if (sides && bar) {
|
|
761
|
-
|
|
763
|
+
const inset = layoutBledBarInset(ctx.columnPx);
|
|
764
|
+
setStyleProps(bar, { padding: `${GALLERY_BAR_TOP} ${sides.right ? inset : ZERO} ${ZERO} ${sides.left ? inset : ZERO}` });
|
|
762
765
|
phone(bar, { padding: `${GALLERY_BAR_TOP} ${ZERO} ${ZERO} ${ZERO}` });
|
|
763
766
|
}
|
|
764
767
|
if (lc.held) gap(ctx, LayoutGapCode.StageSlider, lc.path, 'played by the Scene\'s driver, which plays any slider on its stage (vectoriox/iox-ui#54)');
|
|
@@ -797,9 +800,30 @@ function listOfLayer(l: LayoutLayer, ctx: Ctx): LayoutListBinding | null {
|
|
|
797
800
|
return g?.list && g.source ? ctx.listOf(g.source) : null;
|
|
798
801
|
}
|
|
799
802
|
|
|
800
|
-
/**
|
|
801
|
-
|
|
802
|
-
|
|
803
|
+
/** Award §0c CW2 (AW-D38, amended 2026-11-23 — Doron: half the contained column holds TWO pictures, not one): the least an
|
|
804
|
+
* item of a grid may stand at the check's laptop — a picture item, a words-only one. The ONE table: the contract's
|
|
805
|
+
* `layout.limits.listItemMinPx` (layout.mjs LIMITS), which build-spec's column gate holds every look to. */
|
|
806
|
+
export const LIST_ITEM_MIN_PX: Readonly<{ picture: number; words: number }> = SPEC_SITE_LAYOUT.limits.listItemMinPx;
|
|
807
|
+
const pxOf = (value: unknown): number => parseFloat(String(value ?? '')) || 0;
|
|
808
|
+
|
|
809
|
+
/**
|
|
810
|
+
* How many columns a grid of items takes in a cell `span` columns wide: three across most of the page, fewer in less
|
|
811
|
+
* room. On a page in a column (award §0c CW2, AW-D38) the count is also judged in px of the COLUMN at the check's laptop
|
|
812
|
+
* (1440): the most items that each keep their least (`LIST_ITEM_MIN_PX`: 280px a picture item, 240px words only) — contained keeps three
|
|
813
|
+
* across, narrow gives two pictures. Wide stays as it was (the span alone).
|
|
814
|
+
*/
|
|
815
|
+
export function listColumns(span: number, columnPx: number | null = null, picture = true, density?: string): number {
|
|
816
|
+
const most = span >= 9 ? 3 : span >= 5 ? 2 : 1;
|
|
817
|
+
if (columnPx === null) return most;
|
|
818
|
+
const width = LAYOUT_CHECK_VIEWPORT.width;
|
|
819
|
+
const room = (SPEC_AXES.densities as Readonly<Record<string, Readonly<Record<string, string>>>>)[String(density)] ?? SPEC_AXES.densities.regular;
|
|
820
|
+
const grid = layoutGridPx(width, columnPx, pxOf(room['space-gutter']));
|
|
821
|
+
const g = layoutGapPx(width);
|
|
822
|
+
const cell = (span * (grid - (GRID_COLUMNS - 1) * g)) / GRID_COLUMNS + Math.max(0, span - 1) * g;
|
|
823
|
+
const gap = pxOf(room['space-gap']);
|
|
824
|
+
const least = picture ? LIST_ITEM_MIN_PX.picture : LIST_ITEM_MIN_PX.words;
|
|
825
|
+
for (let n = most; n > 1; n--) if ((cell - (n - 1) * gap) / n >= least) return n;
|
|
826
|
+
return 1;
|
|
803
827
|
}
|
|
804
828
|
|
|
805
829
|
/** An item's way in, as the ONE interaction runtime plays it: together, one after another, or sliding in from the side
|
|
@@ -1020,7 +1044,7 @@ function composeList(id: string, l: LayoutLayer, mix: LayoutListMix, source: str
|
|
|
1020
1044
|
|
|
1021
1045
|
const items = create(`${id}-items`, 'Repeater', {}, 'box');
|
|
1022
1046
|
items.bindings.push({ prop: 'source', source, path: '' });
|
|
1023
|
-
const columns = listColumns((l.col?.[1] ?? 13) - (l.col?.[0] ?? 1));
|
|
1047
|
+
const columns = listColumns((l.col?.[1] ?? 13) - (l.col?.[0] ?? 1), ctx.columnPx, !!list.roles['image'], ctx.design?.density);
|
|
1024
1048
|
if (masonry) {
|
|
1025
1049
|
// A wall: CSS columns over the rows (iox-design.css), as many as the room holds — never a breakpoint, so the
|
|
1026
1050
|
// canvas's frame and the live page agree; `two-up` keeps two on a phone.
|
|
@@ -1060,6 +1084,10 @@ export interface ListFrameInput {
|
|
|
1060
1084
|
readonly col?: readonly [number, number];
|
|
1061
1085
|
/** Where the gaps are said (`sections[i].layers[j]`). */
|
|
1062
1086
|
readonly path?: string;
|
|
1087
|
+
/** Award §0c CW2: the page's column word and the look's Spacing — a grid's item count is judged in px of the column
|
|
1088
|
+
* (`listColumns`). Absent: wide, as before. */
|
|
1089
|
+
readonly column?: string;
|
|
1090
|
+
readonly density?: string;
|
|
1063
1091
|
}
|
|
1064
1092
|
|
|
1065
1093
|
/** A recomposed list frame, and what the composer said while composing it (a word drawn as its stand-in…). */
|
|
@@ -1089,6 +1117,7 @@ export function composeListFrame(input: ListFrameInput, previous?: SerializedNod
|
|
|
1089
1117
|
p: id, site, rtl: layoutRtl(input.locale), mode: LayoutColourMode.Light, pace,
|
|
1090
1118
|
ease: LAYOUT_EASING[(input.motion?.ease ?? LayoutEase.Out) as LayoutEase] ?? LAYOUT_EASING[LayoutEase.Out],
|
|
1091
1119
|
sections: {}, gaps: [], links: [], headingSeen: false, carry: new Map(), keptArrangement: [],
|
|
1120
|
+
columnPx: layoutColumnPx(input.column, input.density), design: input.density ? { density: input.density } : undefined,
|
|
1092
1121
|
listOf: () => input.list, sourceFields: () => null, photoSrc: () => '', photoAlt: () => '', photoAspect: () => LAYOUT_PHOTO_ASPECT[LayoutPhotoShape.Landscape],
|
|
1093
1122
|
} as unknown as Ctx;
|
|
1094
1123
|
const col = input.col ?? [1, 13];
|
|
@@ -1675,14 +1704,6 @@ export function readyMadeColumn(neighbour: LayoutSection | null): number {
|
|
|
1675
1704
|
return Math.min(READY_MADE_MAX_COLUMN, Math.max(1, starts.length ? Math.min(...starts) : 1));
|
|
1676
1705
|
}
|
|
1677
1706
|
|
|
1678
|
-
/** Where column `n` starts from the page's edge, on the composed sections' own grid (`gridLayout`): the gutter, then
|
|
1679
|
-
* n - 1 columns and their gaps. */
|
|
1680
|
-
function columnInset(n: number): string {
|
|
1681
|
-
if (n <= 1) return LAYOUT_GUTTER;
|
|
1682
|
-
const column = `((100% - 2 * ${LAYOUT_GUTTER} - ${GRID_COLUMNS - 1} * ${LAYOUT_COLUMN_GAP}) / ${GRID_COLUMNS} + ${LAYOUT_COLUMN_GAP})`;
|
|
1683
|
-
return `calc(${LAYOUT_GUTTER} + ${n - 1} * ${column})`;
|
|
1684
|
-
}
|
|
1685
|
-
|
|
1686
1707
|
/** A pattern that paints its own ground — a Scene, or a picture behind its words — keeps its colours. */
|
|
1687
1708
|
function paintsItsOwnGround(root: SerializedNode): boolean {
|
|
1688
1709
|
return root.role === SceneRole.Scene || (root.children ?? []).some(c => c.styleProps?.['position'] === 'absolute');
|
|
@@ -1697,8 +1718,8 @@ function paintsItsOwnGround(root: SerializedNode): boolean {
|
|
|
1697
1718
|
*/
|
|
1698
1719
|
function dressReadyMade(root: SerializedNode, ground: string | null, column: number): void {
|
|
1699
1720
|
if (root.styleProps?.['padding'] === PATTERN_SECTION_PAD) {
|
|
1700
|
-
setStyleProps(root, { padding: `${PATTERN_SECTION_SPACE} ${
|
|
1701
|
-
phone(root, { padding: `${PATTERN_SECTION_SPACE} ${
|
|
1721
|
+
setStyleProps(root, { padding: `${PATTERN_SECTION_SPACE} ${layoutColumnStart(column)}` });
|
|
1722
|
+
phone(root, { padding: `${PATTERN_SECTION_SPACE} ${LAYOUT_INSET}` });
|
|
1702
1723
|
}
|
|
1703
1724
|
if (ground === null || paintsItsOwnGround(root)) return;
|
|
1704
1725
|
setColorScheme(root, ColorScheme.Default);
|
|
@@ -1770,6 +1791,8 @@ export function composeLayout(site: LayoutSite, options: ComposeLayoutOptions):
|
|
|
1770
1791
|
sections: {},
|
|
1771
1792
|
gaps: [],
|
|
1772
1793
|
design: options.design ?? layoutDesignOf(site.look?.preset, options.mode),
|
|
1794
|
+
// The page's word, else the design's when one is given (a layout composed with no design keeps today's wide).
|
|
1795
|
+
columnPx: layoutColumnPx(layoutColumnWord(site.column, options.design), options.design?.density),
|
|
1773
1796
|
photoSrc: options.photoSrc,
|
|
1774
1797
|
photoAlt: options.photoAlt ?? (() => ''),
|
|
1775
1798
|
photoAspect: id => LAYOUT_PHOTO_ASPECT[(options.photoShape?.(id) ?? LayoutPhotoShape.Landscape) as LayoutPhotoShape] ?? LAYOUT_PHOTO_ASPECT[LayoutPhotoShape.Landscape],
|
|
@@ -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
|
}
|
|
@@ -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. */
|