@vectoriox/iox-ui 5.169.0 → 5.170.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/design-core/index.d.ts +37 -2
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +61 -8
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +14 -7
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/generation-core/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/design-core/flavor-spec.generated.ts +24 -0
- package/src/design-core/font-metrics.ts +28 -8
- package/src/generation-core/footer-mix.ts +9 -5
- package/src/generation-core/layout-language.ts +6 -2
- package/styles/iox-design.css +8 -0
|
@@ -10551,7 +10551,7 @@ declare function layoutRoomPx(cols: number, width: number, phone: boolean, page?
|
|
|
10551
10551
|
* own face (design-core `textWidthEm`, from the face's measured letters) — and never stands taller than its rows; never
|
|
10552
10552
|
* under 36px or over 560px. `rows` 0 sizes by width alone (a phone's stacked word). Held sections are one screen tall.
|
|
10553
10553
|
*/
|
|
10554
|
-
declare function screenFontSize(widthEm: number, cols: number, rows: number, sectionRows: number, screens: number, columnPx?: number | null, capAlways?: boolean): string;
|
|
10554
|
+
declare function screenFontSize(widthEm: number, cols: number, rows: number, sectionRows: number, screens: number, columnPx?: number | null, capAlways?: boolean, typeCap?: boolean): string;
|
|
10555
10555
|
/** How many px a `screen` word `widthEm` wide runs past its room at its smallest size, on a screen `width` px wide — 0
|
|
10556
10556
|
* when it fits. The one thing sizing cannot mend: the static check refuses it (a browser would show it cut). */
|
|
10557
10557
|
declare function screenWordOverflowPx(widthEm: number, cols: number, width: number, phone: boolean, page?: LayoutRoomColumn): number;
|
package/package.json
CHANGED
|
@@ -4001,6 +4001,30 @@ export const SPEC_FONT_METRICS = {
|
|
|
4001
4001
|
}
|
|
4002
4002
|
}
|
|
4003
4003
|
},
|
|
4004
|
+
"display": {
|
|
4005
|
+
"Bricolage Grotesque": {
|
|
4006
|
+
"opsz": 96,
|
|
4007
|
+
"weights": {
|
|
4008
|
+
"500": {
|
|
4009
|
+
"latin": "211,220,274,584,563,913,677,149,267,271,391,486,150,300,178,330,594,264,534,556,572,551,591,471,599,592,182,179,486,486,486,398,878,621,588,625,614,531,507,645,625,209,306,594,450,784,664,657,566,656,591,573,504,620,606,897,579,556,534,276,329,276,516,588,283,514,552,524,554,526,340,546,534,197,203,504,197,830,534,560,551,552,359,497,339,532,515,775,502,522,454,323,193,331,486,152,152,288,288,475,738,616,178,486,671,685,621,621,621,621,621,621,846,625,531,531,531,531,209,209,209,209,664,657,657,657,657,657,662,620,620,620,620,556,608,514,514,514,514,514,514,827,524,526,526,526,526,206,197,197,197,534,560,560,560,560,560,560,532,532,532,532,522,522,941,916,573,497,534,454"
|
|
4010
|
+
},
|
|
4011
|
+
"700": {
|
|
4012
|
+
"latin": "206,252,318,603,571,936,690,165,291,292,435,486,179,309,223,342,594,294,545,562,595,560,592,489,605,599,227,216,486,486,486,397,916,646,601,629,618,537,509,648,633,231,317,613,457,809,684,660,579,658,607,581,512,625,623,909,608,582,545,289,342,289,525,547,283,533,568,534,568,533,364,548,553,222,230,529,222,850,553,564,566,566,386,510,358,548,525,791,529,533,473,322,210,324,486,179,179,351,351,491,762,710,223,486,677,686,646,646,646,646,646,646,857,629,537,537,537,537,231,231,231,231,684,660,660,660,660,660,667,625,625,625,625,582,628,533,533,533,533,533,533,848,534,533,533,533,533,237,222,222,222,553,564,564,564,564,564,564,548,548,548,548,533,533,942,924,581,510,545,473"
|
|
4013
|
+
}
|
|
4014
|
+
}
|
|
4015
|
+
},
|
|
4016
|
+
"Fraunces": {
|
|
4017
|
+
"opsz": 144,
|
|
4018
|
+
"weights": {
|
|
4019
|
+
"400": {
|
|
4020
|
+
"latin": "165,211,252,549,509,586,868,128,303,301,573,455,175,237,173,330,590,354,530,491,541,511,546,458,518,550,161,170,432,455,432,470,739,601,616,630,697,574,521,683,729,313,359,668,536,789,668,728,596,736,633,553,596,654,590,887,624,593,555,288,317,288,298,334,209,432,483,403,488,417,258,468,497,221,221,480,225,772,498,484,501,483,361,376,280,497,428,659,436,442,392,329,222,329,482,152,140,284,284,452,701,563,223,401,612,533,601,601,601,601,601,601,872,630,574,574,574,574,313,313,313,313,668,728,728,728,728,728,728,654,654,654,654,593,554,432,432,432,432,432,432,675,403,417,417,417,417,221,221,221,221,498,484,484,484,484,484,484,497,497,497,497,442,442,922,756,553,376,555,392"
|
|
4021
|
+
},
|
|
4022
|
+
"600": {
|
|
4023
|
+
"latin": "160,243,299,571,529,602,898,153,314,311,565,455,205,242,201,325,613,372,556,515,568,531,569,482,541,574,193,205,432,455,432,508,742,625,647,640,717,594,540,692,754,340,389,697,557,813,673,734,626,746,666,566,622,662,605,920,643,610,568,312,317,312,298,355,233,455,505,420,508,437,278,491,518,240,240,509,246,797,519,497,519,505,390,391,301,519,441,686,456,461,414,351,222,351,482,180,161,338,338,459,711,664,251,401,632,557,625,625,625,625,625,625,898,640,594,594,594,594,340,340,340,340,673,734,734,734,734,734,734,662,662,662,662,610,589,455,455,455,455,455,455,694,420,437,437,437,437,240,240,240,240,519,497,497,497,497,497,497,519,519,519,519,461,461,946,768,566,391,568,414"
|
|
4024
|
+
}
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
},
|
|
4004
4028
|
"fallback": {
|
|
4005
4029
|
"latin": "612,612,612,1392,857,1297,1220,612,612,612,666,780,612,612,612,698,1066,667,1003,1055,1094,1015,1133,1153,1081,1158,612,612,679,840,679,864,1498,1160,1140,1316,1302,1140,1128,1340,1280,612,1004,1215,943,1580,1300,1330,1177,1330,1232,1056,1100,1289,1160,1882,1140,1070,1200,612,802,612,709,980,722,1063,1098,994,1098,994,674,969,1008,612,612,942,612,1654,998,1016,1063,1098,612,842,628,998,918,1462,980,930,896,623,612,623,716,612,612,612,612,708,1100,1042,612,711,1406,1087,1160,1160,1160,1160,1160,1160,1681,1316,1140,1140,1140,1140,612,612,612,612,1300,1330,1330,1330,1330,1330,1330,1289,1289,1289,1289,1070,1138,1063,1063,1063,1063,1063,1063,1915,994,994,994,994,994,612,612,612,612,998,1016,1016,1016,1016,1016,1016,998,998,998,998,930,930,1962,1696,1056,842,1200,896",
|
|
4006
4030
|
"hebrew": "681,641,498,587,660,333,424,683,696,352,565,572,550,690,698,330,455,664,653,648,671,588,622,680,593,881,730,450,306,568"
|
|
@@ -11,8 +11,20 @@ import { matchFontWeight, parseFontFamilies } from './fonts';
|
|
|
11
11
|
* weight CSS font matching picks. A family the catalog does not hold (an uploaded font, system-ui) reads each letter at
|
|
12
12
|
* the widest any catalog face draws it — never narrower than what the page could wear. No kerning: a display face's
|
|
13
13
|
* kerning closes letters up, so the sum is the wider answer. Pure and deterministic: the composer and the check agree.
|
|
14
|
+
*
|
|
15
|
+
* R-H-AW12-5: a family with an optical-size axis draws narrower at large sizes (the browser sets `opsz` from the font
|
|
16
|
+
* size), so the contract also measures it at its largest optical size (`fontMetrics.display`). A word sized from those
|
|
17
|
+
* widths ({@link OpticalSize.Display}) must wear that optical size — iox-design.css pins it on the footer's closing name.
|
|
14
18
|
*/
|
|
15
19
|
|
|
20
|
+
/** Which optical size a word is measured at. */
|
|
21
|
+
export enum OpticalSize {
|
|
22
|
+
/** The instance Google serves by default (its smallest text size — the wider answer). */
|
|
23
|
+
Text = 'text',
|
|
24
|
+
/** The axis's largest optical size: what a word pinned to `font-variation-settings: 'opsz' <max>` wears. */
|
|
25
|
+
Display = 'display',
|
|
26
|
+
}
|
|
27
|
+
|
|
16
28
|
/** A face as a style wears it: its font stack, weight and letter spacing (em). */
|
|
17
29
|
export interface TypeFace {
|
|
18
30
|
stack: string;
|
|
@@ -35,6 +47,8 @@ const ALPHABETS: Readonly<Record<Script, ReadonlyArray<string>>> = {
|
|
|
35
47
|
[Script.Hebrew]: Array.from(SPEC_FONT_METRICS.alphabets.hebrew),
|
|
36
48
|
};
|
|
37
49
|
const FAMILIES = SPEC_FONT_METRICS.families as Readonly<Record<string, Readonly<Record<string, Partial<Record<Script, string>>>>>>;
|
|
50
|
+
type DisplayFamily = { readonly opsz: number; readonly weights: Readonly<Record<string, Partial<Record<Script, string>>>> };
|
|
51
|
+
const DISPLAY = SPEC_FONT_METRICS.display as Readonly<Record<string, DisplayFamily>>;
|
|
38
52
|
const parsed = new Map<string, Row>();
|
|
39
53
|
|
|
40
54
|
function rowOf(key: string, csv: string): Row {
|
|
@@ -49,21 +63,27 @@ const FALLBACK: Readonly<Record<Script, Row>> = {
|
|
|
49
63
|
[Script.Hebrew]: rowOf('fallback:hebrew', SPEC_FONT_METRICS.fallback.hebrew),
|
|
50
64
|
};
|
|
51
65
|
|
|
52
|
-
/**
|
|
53
|
-
|
|
66
|
+
/**
|
|
67
|
+
* A measured family's row for a script at the weight CSS would pick, or null when that family does not draw it. At the
|
|
68
|
+
* display optical size a family with an optical-size axis reads its display widths; any other family has one size.
|
|
69
|
+
*/
|
|
70
|
+
function familyRow(family: string, weight: number, script: Script, optical: OpticalSize): Row | null {
|
|
54
71
|
const weights = FAMILIES[family];
|
|
55
72
|
const face = matchFontWeight(Object.keys(weights).map(w => ({ weight: Number(w) })), weight);
|
|
56
|
-
|
|
57
|
-
|
|
73
|
+
if (!face) return null;
|
|
74
|
+
const display = optical === OpticalSize.Display ? DISPLAY[family]?.weights[String(face.weight)]?.[script] : undefined;
|
|
75
|
+
if (display) return rowOf(`${family}:${face.weight}:${script}:display`, display);
|
|
76
|
+
const csv = weights[String(face.weight)]?.[script];
|
|
77
|
+
return csv ? rowOf(`${family}:${face.weight}:${script}`, csv) : null;
|
|
58
78
|
}
|
|
59
79
|
|
|
60
80
|
/** One letter's advance in thousandths of an em, as the stack draws it. */
|
|
61
|
-
function advanceOf(ch: string, families: ReadonlyArray<string>, weight: number): number {
|
|
81
|
+
function advanceOf(ch: string, families: ReadonlyArray<string>, weight: number, optical: OpticalSize): number {
|
|
62
82
|
const script = HEBREW.test(ch) ? Script.Hebrew : Script.Latin;
|
|
63
83
|
const at = ALPHABETS[script].indexOf(ch);
|
|
64
84
|
for (const family of families) {
|
|
65
85
|
if (!FAMILIES[family]) break;
|
|
66
|
-
const row = familyRow(family, weight, script);
|
|
86
|
+
const row = familyRow(family, weight, script, optical);
|
|
67
87
|
if (!row) continue;
|
|
68
88
|
if (at < 0) return widest(row);
|
|
69
89
|
if (row[at] >= 0) return row[at];
|
|
@@ -73,12 +93,12 @@ function advanceOf(ch: string, families: ReadonlyArray<string>, weight: number):
|
|
|
73
93
|
}
|
|
74
94
|
|
|
75
95
|
/** How wide `text` stands in `face`, in em, on one line: every letter's advance plus the letter spacing after each. */
|
|
76
|
-
export function textWidthEm(text: string, face: TypeFace): number {
|
|
96
|
+
export function textWidthEm(text: string, face: TypeFace, optical: OpticalSize = OpticalSize.Text): number {
|
|
77
97
|
const families = parseFontFamilies(face.stack);
|
|
78
98
|
let width = 0;
|
|
79
99
|
for (const ch of Array.from(String(text ?? ''))) {
|
|
80
100
|
if (MARK.test(ch)) continue;
|
|
81
|
-
width += advanceOf(ch, families, face.weight) / PER_EM + face.tracking;
|
|
101
|
+
width += advanceOf(ch, families, face.weight, optical) / PER_EM + face.tracking;
|
|
82
102
|
}
|
|
83
103
|
return Math.max(0, width);
|
|
84
104
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DesignChoices, designTokenRows, elementStyleFace, FOOTER_MIX_PROP, resolveDesignChoices, SECTION_SHAPE_TRAIT, SectionShape, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
1
|
+
import { DesignChoices, designTokenRows, elementStyleFace, FOOTER_MIX_PROP, OpticalSize, resolveDesignChoices, SECTION_SHAPE_TRAIT, SectionShape, textWidthEm } from '@vectoriox/iox-ui/design-core';
|
|
2
2
|
|
|
3
3
|
import { layoutColumnPx, layoutGutterPx } from './layout-column';
|
|
4
4
|
import { layoutRoomPx, screenFontSize, screenWordOverflowPx } from './layout-language';
|
|
@@ -330,7 +330,8 @@ const rule = (k: string): number => Number(RULES[k]);
|
|
|
330
330
|
/** How wide `text` stands at 1em in an element style's face. */
|
|
331
331
|
const widthEm = (text: string, ctx: FooterContext, style = 'display'): number => textWidthEm(text, elementStyleFace(ctx.design, style));
|
|
332
332
|
/** How wide the name stands at 1em in the look's display face. */
|
|
333
|
-
|
|
333
|
+
/** R-H-AW12-5: the closing name wears its face's largest optical size (iox-design.css pins it), so it is measured there. */
|
|
334
|
+
const nameWidthEm = (ctx: FooterContext): number => textWidthEm(ctx.name, elementStyleFace(ctx.design, 'display'), OpticalSize.Display);
|
|
334
335
|
/** True when a word `em` wide runs past a phone's room at the smallest screen size. */
|
|
335
336
|
const overflowsPhone = (em: number, ctx: FooterContext): boolean =>
|
|
336
337
|
screenWordOverflowPx(em, 12, PHONE_WIDTH, true, { gutter: layoutGutterPx(ctx.design.density) }) > 0;
|
|
@@ -490,8 +491,8 @@ function columnsOf(count: number): Pick<PatternNode, 'lay' | 'resp'> {
|
|
|
490
491
|
/** A word fitted to the column as a layout's screen word is (`screenFontSize`, the 12-column room), never under the
|
|
491
492
|
* smallest or over the largest screen word. Award §0c CW2 / iox-ui#117: the column of the PAGE it is on (`content-cap`),
|
|
492
493
|
* the site's word only its fallback — a global footer fits a narrow page of a contained site. */
|
|
493
|
-
const columnSize = (em: number, ctx: FooterContext, cols = 12): string =>
|
|
494
|
-
screenFontSize(em, cols, 0, 0, 0, layoutColumnPx(ctx.design.column, ctx.design.density), true);
|
|
494
|
+
const columnSize = (em: number, ctx: FooterContext, cols = 12, typeCap = true): string =>
|
|
495
|
+
screenFontSize(em, cols, 0, 0, 0, layoutColumnPx(ctx.design.column, ctx.design.density), true, typeCap);
|
|
495
496
|
|
|
496
497
|
/** The closing name: the business name across the width, fitted to the name in the look's display face. A gradient or an
|
|
497
498
|
* embossed name is the decorative copy (AW12-D12). */
|
|
@@ -500,7 +501,10 @@ function closingName(ctx: FooterContext, mix: FooterMix): PatternNode {
|
|
|
500
501
|
const copy = style === FooterNameStyle.Gradient || style === FooterNameStyle.Emboss;
|
|
501
502
|
// An offset name starts at the second of twelve columns (iox-design.css), so it is fitted to eleven.
|
|
502
503
|
const cols = style === FooterNameStyle.Offset ? 11 : 12;
|
|
503
|
-
|
|
504
|
+
// R-H-AW12-5 (decided 2026-11-25): name-and-action's name stands on both column edges, so it takes no type-scale
|
|
505
|
+
// ceiling — a short name ("Nord", a four-letter Hebrew name) would otherwise stop at 560px, well short of the edge.
|
|
506
|
+
const edgeToEdge = mix.closing === FooterClosing.NameAndAction;
|
|
507
|
+
return { ...laid(part('name'), { fontSize: columnSize(nameWidthEm(ctx), ctx, cols, !edgeToEdge) }), ...(copy ? { role: FooterRole.NameCopy } : {}) };
|
|
504
508
|
}
|
|
505
509
|
|
|
506
510
|
/** The call word (AW12 `closing.word`): closed copy for the business, fitted to the column. */
|
|
@@ -783,8 +783,12 @@ function columnCapCss(cols: number, widthEm: number, fallback: string): string {
|
|
|
783
783
|
*/
|
|
784
784
|
export function screenFontSize(
|
|
785
785
|
widthEm: number, cols: number, rows: number, sectionRows: number, screens: number, columnPx: number | null = null, capAlways = false,
|
|
786
|
+
typeCap = true,
|
|
786
787
|
): string {
|
|
787
788
|
const [min, max] = LAYOUT_SCREEN_PX;
|
|
789
|
+
// `typeCap` false (R-H-AW12-5, decided 2026-11-25: name-and-action's closing name stands edge to edge): no 560px ceiling
|
|
790
|
+
// — the word is sized to its column alone, never to a type scale; the 36px floor stays.
|
|
791
|
+
const clamped = (inner: string): string => (typeCap ? `clamp(${min}px, ${inner}, ${max}px)` : `max(${min}px, ${inner})`);
|
|
788
792
|
const widthVw = round2((layoutColumnsVw(cols) / Math.max(widthEm, 0.01)) * SCREEN_FILL);
|
|
789
793
|
// T-CW3: in a column the word never runs past its columns — capped at the column in force, read as `content-cap` (a
|
|
790
794
|
// `%` in font-size is the parent's size, so never `content-width`), the page's word stamped as px its fallback.
|
|
@@ -795,9 +799,9 @@ export function screenFontSize(
|
|
|
795
799
|
const room = cols >= GRID_COLUMNS ? [`calc((100vw - 2 * var(--iox-space-gutter, ${LEGACY_GUTTER_PX}px)) * ${round4(SCREEN_FILL / Math.max(widthEm, 0.01))})`] : [];
|
|
796
800
|
const capFallback = columnPx ? `${columnPx}px` : capAlways ? WIDE_CAP : null;
|
|
797
801
|
const width = [`${widthVw}vw`, ...(capFallback ? [columnCapCss(cols, widthEm, capFallback)] : []), ...room];
|
|
798
|
-
if (!rows || !sectionRows) return width.length > 1 ? `
|
|
802
|
+
if (!rows || !sectionRows) return clamped(width.length > 1 ? `min(${width.join(', ')})` : `${widthVw}vw`);
|
|
799
803
|
const heightSvh = round2((((rows / sectionRows) * screens * 100) / 0.92) * SCREEN_FILL);
|
|
800
|
-
return `
|
|
804
|
+
return clamped(`min(${[...width, `${heightSvh}svh`].join(', ')})`);
|
|
801
805
|
}
|
|
802
806
|
|
|
803
807
|
/** How many px a `screen` word `widthEm` wide runs past its room at its smallest size, on a screen `width` px wide — 0
|
package/styles/iox-design.css
CHANGED
|
@@ -2647,6 +2647,14 @@ dialog[data-iox-dialog].iox-es.iox-role-shop-cart-drawer:is([data-iox-closing],
|
|
|
2647
2647
|
margin-block-end: calc(-1 * var(--iox-footer-name-cut, 0.12em));
|
|
2648
2648
|
}
|
|
2649
2649
|
|
|
2650
|
+
/* R-H-AW12-5 — the closing name wears its face's LARGEST optical size at any size: the composer sizes it from the widths
|
|
2651
|
+
measured there (fontMetrics.display), so it reaches its column's end edge. A value past the axis is clamped to the axis's
|
|
2652
|
+
largest; a face with no optical-size axis ignores it. */
|
|
2653
|
+
:is(.iox-role-footer-name, .iox-role-footer-name-copy) {
|
|
2654
|
+
font-optical-sizing: none;
|
|
2655
|
+
font-variation-settings: 'opsz' 1000;
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2650
2658
|
/* nameStyle (AW12-D12) — how the closing name is worn. A gradient or embossed name is a decorative copy (aria-hidden — the
|
|
2651
2659
|
brand block says the name), so its stops may be quieter than a word's; each stop is the scheme's own ink or accent. */
|
|
2652
2660
|
.iox-footer-namestyle-gradient :is(.iox-role-footer-name, .iox-role-footer-name-copy) {
|