@vectoriox/iox-ui 5.204.0 → 5.206.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/data-core/index.d.ts +13 -4
- package/design-core/index.d.ts +277 -6
- package/fesm2022/vectoriox-iox-ui-data-core.mjs +23 -4
- package/fesm2022/vectoriox-iox-ui-data-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +3065 -2673
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +1313 -197
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs +71 -19
- package/fesm2022/vectoriox-iox-ui-harness-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs +32 -4
- package/fesm2022/vectoriox-iox-ui-scene-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +145 -82
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +462 -41
- package/harness-core/index.d.ts +52 -12
- package/index.d.ts +44 -3
- package/package.json +1 -1
- package/scene-core/index.d.ts +16 -2
- package/src/data-core/placeholder-rows.ts +24 -3
- package/src/design-core/colour-eval.ts +22 -0
- package/src/design-core/contrast-audit.ts +96 -2
- package/src/design-core/design-token.model.ts +2 -0
- package/src/design-core/flavor-spec.generated.ts +184 -0
- package/src/design-core/font-metrics.ts +14 -1
- package/src/design-core/font-vertical.ts +80 -0
- package/src/design-core/node-links.ts +12 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/design-core/style-presets.ts +20 -1
- package/src/design-core/token-css.ts +3 -1
- package/src/generation-core/ai-run.ts +31 -0
- package/src/generation-core/audit-site.ts +5 -3
- package/src/generation-core/compose-free.ts +1 -1
- package/src/generation-core/compose-layout.ts +172 -22
- package/src/generation-core/critic-calibration.ts +30 -10
- package/src/generation-core/critic-numbers.ts +259 -0
- package/src/generation-core/critic-prompt.ts +74 -6
- package/src/generation-core/critic-rubric.generated.ts +7 -7
- package/src/generation-core/critic-sheet.ts +184 -6
- package/src/generation-core/critic.ts +27 -13
- package/src/generation-core/designer-brief.ts +4 -3
- package/src/generation-core/designer-estimate.ts +3 -3
- package/src/generation-core/layout-render-check.ts +35 -2
- package/src/generation-core/nav-shape.ts +67 -8
- package/src/generation-core/opening-mix.ts +61 -17
- package/src/generation-core/public-api.ts +2 -0
- package/src/generation-core/social-links.ts +47 -8
- package/src/generation-core/stock-photos.ts +149 -14
- package/src/generation-core/stock-search.ts +108 -19
- package/src/generation-core/stock-subjects.ts +204 -0
- package/src/harness-core/business-types.ts +3 -0
- package/src/harness-core/harness-spec.generated.ts +54 -15
- package/src/harness-core/intake.ts +18 -5
- package/src/scene-core/scene.ts +34 -3
- package/styles/iox-design.css +41 -2
- package/styles/iox-forms.css +7 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { toHexColor, wcagContrastRatio, WCAG_AA_TEXT } from './brand';
|
|
2
2
|
import { WCAG_AA_UI } from './brand-neutrals';
|
|
3
|
-
import { compositeOver, paintColours, parseCssColour, quantizeRgb, Rgba, ringColour } from './colour-eval';
|
|
3
|
+
import { compositeOver, paintColours, paintStops, parseCssColour, quantizeRgb, Rgba, ringColour } from './colour-eval';
|
|
4
4
|
import { ElementStyle, ELEMENT_STYLES } from './element-styles';
|
|
5
5
|
import { SPEC_CONTRAST_AUDIT, SPEC_INK_SCOPES, SPEC_SCHEMES } from './flavor-spec.generated';
|
|
6
6
|
import { colorSchemeOf, DesignClassSource, SCHEME_INK } from './node-classes';
|
|
@@ -503,7 +503,14 @@ export function renderedContrastPairs(trees: ReadonlyArray<ContrastTree>): Set<s
|
|
|
503
503
|
} else if (style) {
|
|
504
504
|
out.add(pairKey(here, container, style.id));
|
|
505
505
|
}
|
|
506
|
-
|
|
506
|
+
// iox-ui#211: a scrim LAYER (a scrim style holding nothing) lies over the picture; the siblings after it stand on it.
|
|
507
|
+
let layer: ContrastTreeNode | null = null;
|
|
508
|
+
for (const child of node.children ?? []) {
|
|
509
|
+
if (!child) continue;
|
|
510
|
+
if (layer && holdsLooseWords(child)) out.add(overScrimPair(child, ownScheme(child) ?? here, layer));
|
|
511
|
+
visit(child, here, inside);
|
|
512
|
+
if (isScrimLayer(child)) layer = child;
|
|
513
|
+
}
|
|
507
514
|
};
|
|
508
515
|
for (const tree of trees) {
|
|
509
516
|
for (const scheme of tree.schemes?.length ? tree.schemes : [DEFAULT_SCHEME]) {
|
|
@@ -514,6 +521,93 @@ export function renderedContrastPairs(trees: ReadonlyArray<ContrastTree>): Set<s
|
|
|
514
521
|
return out;
|
|
515
522
|
}
|
|
516
523
|
|
|
524
|
+
/**
|
|
525
|
+
* iox-ui#211 (pro-ceramics, Midnight in dark mode: the name near-black on the opening's dark wash, 1.88:1 / 1.33:1). The
|
|
526
|
+
* opening lays its scrim as a LAYER over the picture and its words as the layer's next sibling — not inside it — so the
|
|
527
|
+
* words never read the scrim's ink; they read their frame's scheme (Inverse: dark in a light look, LIGHT in a dark one).
|
|
528
|
+
* The gate judged the scrim's own ink over the scrim (`scrimFindings`) and the words on their scheme's ground — never the
|
|
529
|
+
* words over the scrim they stand on. Now: the words the shared stylesheet pins to the scrim's ink (the rule
|
|
530
|
+
* `.iox-role-opening .iox-role-opening-scrim ~ :is(…)`, pinned to this list by contrast-rendered.spec) are judged as the
|
|
531
|
+
* scrim's own; any other sibling after a scrim layer is judged by `scrimLayerFindings` — its scheme's ink over the scrim.
|
|
532
|
+
*/
|
|
533
|
+
export const SCRIM_LAYER_ROLE = 'opening.scrim';
|
|
534
|
+
export const SCRIM_LAYER_WORD_ROLES: ReadonlySet<string> = new Set(['opening.words', 'opening.apart', 'opening.aside', 'opening.cue']);
|
|
535
|
+
/** The container a finding of `scrimLayerFindings` names: what stands over a scrim layer of `style`. */
|
|
536
|
+
export const overScrim = (style: string) => `over ${style}`;
|
|
537
|
+
|
|
538
|
+
/** A scrim style that holds nothing: a layer laid over a picture, under what follows it. */
|
|
539
|
+
function isScrimLayer(node: ContrastTreeNode): boolean {
|
|
540
|
+
return !!node.elementStyle && SCRIM_STYLES.has(node.elementStyle) && !(node.children ?? []).some(c => !!c);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/** The node types that are words when they wear no element style. */
|
|
544
|
+
const WORD_TYPES: ReadonlySet<string> = new Set(['Heading', 'Text', 'Paragraph', 'RichText', 'Link', 'Label']);
|
|
545
|
+
|
|
546
|
+
/** Whether a node over a scrim layer holds words standing ON the scrim — not inside something that paints its own fill
|
|
547
|
+
* (a card, a badge: judged on that fill) and not a picture (the opening's cutout). */
|
|
548
|
+
function holdsLooseWords(node: ContrastTreeNode): boolean {
|
|
549
|
+
const style = node.elementStyle ? STYLE_BY_ID.get(node.elementStyle) : undefined;
|
|
550
|
+
if (style) {
|
|
551
|
+
if (NOT_CONTENT.has(style.id) || isBoxStyle(style) || SCRIM_STYLES.has(style.id)) return false;
|
|
552
|
+
if (isContentStyle(style)) {
|
|
553
|
+
const fill = ownStyle(style)['backgroundColor'];
|
|
554
|
+
return !fill || fill === 'transparent';
|
|
555
|
+
}
|
|
556
|
+
} else if (node.type && WORD_TYPES.has(node.type)) {
|
|
557
|
+
return true;
|
|
558
|
+
}
|
|
559
|
+
return (node.children ?? []).some(c => !!c && holdsLooseWords(c));
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/** The pair a node standing over a scrim layer renders: the scrim's own when the stylesheet pins it to the scrim's ink,
|
|
563
|
+
* else its scheme's ink over the scrim. */
|
|
564
|
+
function overScrimPair(node: ContrastTreeNode, scheme: string, layer: ContrastTreeNode): string {
|
|
565
|
+
const style = layer.elementStyle as string;
|
|
566
|
+
const pinned = layer.role === SCRIM_LAYER_ROLE && !!node.role && SCRIM_LAYER_WORD_ROLES.has(node.role);
|
|
567
|
+
return pinned ? pairKey(scheme, style, style) : pairKey(scheme, overScrim(style), INHERITED_TEXT);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
/**
|
|
571
|
+
* What stands over a scrim LAYER without its ink and ground (iox-ui#211, #212): in every scheme, the scheme's ink — and the
|
|
572
|
+
* heading, eyebrow and muted colours it holds — over the layer's THINNEST stop composited on a black AND a white picture
|
|
573
|
+
* (`FLOATING_BACKDROPS`: the scheme's ink may be light or dark, so either bound can be its worst case). The stock layer is a
|
|
574
|
+
* top-down gradient from `transparent`, so a loose word over it always fails: a word over a scrim layer carries the scrim
|
|
575
|
+
* as its own ground (the stylesheet's rule for `SCRIM_LAYER_WORD_ROLES`, judged as the scrim's own by `scrimFindings`). Judged only where the pages lay one (`renderedContrastFindings` keeps a finding whose scheme the sibling stands in);
|
|
576
|
+
* kept out of the sweep, which is the contract's audit 1:1.
|
|
577
|
+
*/
|
|
578
|
+
export function scrimLayerFindings(rows: ReadonlyArray<DesignTokenLike>, mode: ResolvedMode): ContrastFinding[] {
|
|
579
|
+
const valuesIn = schemeTokenResolver(rows, mode);
|
|
580
|
+
const out: ContrastFinding[] = [];
|
|
581
|
+
for (const scheme of SCHEME_IDS) {
|
|
582
|
+
const values = valuesIn(scheme);
|
|
583
|
+
for (const scrim of SCRIMS) {
|
|
584
|
+
// iox-ui#212: the layer's THINNEST stop — a word over a layer may stand anywhere on it (the stock layer opens on
|
|
585
|
+
// `transparent`: the bare picture), so a word with no ground of its own is judged where the layer is least.
|
|
586
|
+
const style = STYLE_BY_ID.get(scrim.style);
|
|
587
|
+
const stops = paintStops(resolveIn(values, style ? ownStyle(style)['backgroundColor'] : `var(--iox-${scrim.token})`));
|
|
588
|
+
const thinnest = stops.length ? stops.reduce((a, b) => (b.a < a.a ? b : a)) : parseCssColour(values[scrim.token]);
|
|
589
|
+
if (!thinnest) continue;
|
|
590
|
+
const ink = parseCssColour(resolveIn(values, SCHEME_INK));
|
|
591
|
+
const parts: Array<[string, Rgba | null]> = [
|
|
592
|
+
['text', ink], ...SCRIM_HELD_TOKENS.map((t): [string, Rgba | null] => [t, parseCssColour(resolveIn(values, `var(--iox-${t})`), ink)]),
|
|
593
|
+
];
|
|
594
|
+
for (const [name, image] of Object.entries(FLOATING_BACKDROPS)) {
|
|
595
|
+
const bg = quantizeRgb(compositeOver(thinnest, image));
|
|
596
|
+
for (const [part, fg] of parts) {
|
|
597
|
+
if (!fg) continue;
|
|
598
|
+
const f = quantizeRgb(fg.a < 1 ? compositeOver(fg, bg) : fg);
|
|
599
|
+
const ratio = wcagContrastRatio(f, bg);
|
|
600
|
+
out.push({
|
|
601
|
+
scheme, container: overScrim(scrim.style), element: INHERITED_TEXT, part: `${part} over a ${name} picture`,
|
|
602
|
+
fg: toHexColor(f), bg: toHexColor(bg), ratio: Math.round(ratio * 100) / 100, min: WCAG_AA_TEXT, pass: ratio >= WCAG_AA_TEXT - 1e-9,
|
|
603
|
+
});
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
return out;
|
|
609
|
+
}
|
|
610
|
+
|
|
517
611
|
/**
|
|
518
612
|
* The findings of `auditDesignContrast` that a site's pages RENDER (AD0 A6): the sweep judges every pairing the look COULD
|
|
519
613
|
* make (472 failing on both designer-loop proof sites, almost all in schemes and boxes nobody used), so the Publish gate
|
|
@@ -158,6 +158,8 @@ export interface FlavorTintConfig {
|
|
|
158
158
|
export interface FlavorPackV2 {
|
|
159
159
|
readonly id: string;
|
|
160
160
|
readonly name: string;
|
|
161
|
+
/** The name in Hebrew (iox-ui#217) — shown through `nameIn`. */
|
|
162
|
+
readonly nameHe: string;
|
|
161
163
|
readonly personality: string;
|
|
162
164
|
readonly inspiredBy: string;
|
|
163
165
|
readonly blurb: string;
|
|
@@ -2776,6 +2776,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
2776
2776
|
{
|
|
2777
2777
|
"id": "clear-care",
|
|
2778
2778
|
"name": "Clear care",
|
|
2779
|
+
"nameHe": "טיפול בהיר",
|
|
2779
2780
|
"flavorId": "crisp",
|
|
2780
2781
|
"seed": "#0E7490",
|
|
2781
2782
|
"tint": "subtle",
|
|
@@ -2808,6 +2809,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
2808
2809
|
{
|
|
2809
2810
|
"id": "swiss-grid",
|
|
2810
2811
|
"name": "Swiss grid",
|
|
2812
|
+
"nameHe": "רשת שוויצרית",
|
|
2811
2813
|
"flavorId": "crisp",
|
|
2812
2814
|
"seed": "#111827",
|
|
2813
2815
|
"tint": "neutral",
|
|
@@ -2841,6 +2843,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
2841
2843
|
{
|
|
2842
2844
|
"id": "trusted-advisor",
|
|
2843
2845
|
"name": "Trusted advisor",
|
|
2846
|
+
"nameHe": "יועץ אמין",
|
|
2844
2847
|
"flavorId": "crisp",
|
|
2845
2848
|
"seed": "#1E3A8A",
|
|
2846
2849
|
"tint": "subtle",
|
|
@@ -2872,6 +2875,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
2872
2875
|
{
|
|
2873
2876
|
"id": "fresh-practice",
|
|
2874
2877
|
"name": "Fresh practice",
|
|
2878
|
+
"nameHe": "קליניקה רעננה",
|
|
2875
2879
|
"flavorId": "crisp",
|
|
2876
2880
|
"seed": "#0284C7",
|
|
2877
2881
|
"tint": "rich",
|
|
@@ -2904,6 +2908,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
2904
2908
|
{
|
|
2905
2909
|
"id": "gallery-minimal",
|
|
2906
2910
|
"name": "Gallery minimal",
|
|
2911
|
+
"nameHe": "גלריה מינימלית",
|
|
2907
2912
|
"flavorId": "linen",
|
|
2908
2913
|
"seed": "#3F4A5A",
|
|
2909
2914
|
"tint": "neutral",
|
|
@@ -2937,6 +2942,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
2937
2942
|
{
|
|
2938
2943
|
"id": "warm-editorial",
|
|
2939
2944
|
"name": "Warm editorial",
|
|
2945
|
+
"nameHe": "מגזין חם",
|
|
2940
2946
|
"flavorId": "linen",
|
|
2941
2947
|
"seed": "#9A4F2B",
|
|
2942
2948
|
"tint": "subtle",
|
|
@@ -2969,6 +2975,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
2969
2975
|
{
|
|
2970
2976
|
"id": "soft-spa",
|
|
2971
2977
|
"name": "Soft spa",
|
|
2978
|
+
"nameHe": "ספא רך",
|
|
2972
2979
|
"flavorId": "linen",
|
|
2973
2980
|
"seed": "#7D4E5E",
|
|
2974
2981
|
"tint": "rich",
|
|
@@ -3001,6 +3008,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3001
3008
|
{
|
|
3002
3009
|
"id": "quiet-luxury",
|
|
3003
3010
|
"name": "Quiet luxury",
|
|
3011
|
+
"nameHe": "יוקרה שקטה",
|
|
3004
3012
|
"flavorId": "linen",
|
|
3005
3013
|
"seed": "#7A5B36",
|
|
3006
3014
|
"tint": "subtle",
|
|
@@ -3034,6 +3042,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3034
3042
|
{
|
|
3035
3043
|
"id": "after-dark",
|
|
3036
3044
|
"name": "After dark",
|
|
3045
|
+
"nameHe": "אחרי החשכה",
|
|
3037
3046
|
"flavorId": "midnight",
|
|
3038
3047
|
"seed": "#DB2777",
|
|
3039
3048
|
"tint": "subtle",
|
|
@@ -3066,6 +3075,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3066
3075
|
{
|
|
3067
3076
|
"id": "ink-studio",
|
|
3068
3077
|
"name": "Ink studio",
|
|
3078
|
+
"nameHe": "סטודיו דיו",
|
|
3069
3079
|
"flavorId": "midnight",
|
|
3070
3080
|
"seed": "#EA580C",
|
|
3071
3081
|
"tint": "neutral",
|
|
@@ -3098,6 +3108,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3098
3108
|
{
|
|
3099
3109
|
"id": "night-gallery",
|
|
3100
3110
|
"name": "Night gallery",
|
|
3111
|
+
"nameHe": "גלריית לילה",
|
|
3101
3112
|
"flavorId": "midnight",
|
|
3102
3113
|
"seed": "#8B9BB4",
|
|
3103
3114
|
"tint": "neutral",
|
|
@@ -3131,6 +3142,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3131
3142
|
{
|
|
3132
3143
|
"id": "tech-studio",
|
|
3133
3144
|
"name": "Tech studio",
|
|
3145
|
+
"nameHe": "סטודיו טק",
|
|
3134
3146
|
"flavorId": "midnight",
|
|
3135
3147
|
"seed": "#059669",
|
|
3136
3148
|
"tint": "subtle",
|
|
@@ -3164,6 +3176,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3164
3176
|
{
|
|
3165
3177
|
"id": "morning-glass",
|
|
3166
3178
|
"name": "Morning glass",
|
|
3179
|
+
"nameHe": "זכוכית בוקר",
|
|
3167
3180
|
"flavorId": "glass",
|
|
3168
3181
|
"seed": "#0E8A89",
|
|
3169
3182
|
"tint": "subtle",
|
|
@@ -3196,6 +3209,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3196
3209
|
{
|
|
3197
3210
|
"id": "holiday-light",
|
|
3198
3211
|
"name": "Holiday light",
|
|
3212
|
+
"nameHe": "אור של חופשה",
|
|
3199
3213
|
"flavorId": "glass",
|
|
3200
3214
|
"seed": "#0A66E8",
|
|
3201
3215
|
"tint": "rich",
|
|
@@ -3227,6 +3241,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3227
3241
|
{
|
|
3228
3242
|
"id": "frosted-portfolio",
|
|
3229
3243
|
"name": "Frosted portfolio",
|
|
3244
|
+
"nameHe": "תיק עבודות חלבי",
|
|
3230
3245
|
"flavorId": "glass",
|
|
3231
3246
|
"seed": "#1F2937",
|
|
3232
3247
|
"tint": "neutral",
|
|
@@ -3259,6 +3274,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3259
3274
|
{
|
|
3260
3275
|
"id": "coral-studio",
|
|
3261
3276
|
"name": "Coral studio",
|
|
3277
|
+
"nameHe": "סטודיו אלמוג",
|
|
3262
3278
|
"flavorId": "glass",
|
|
3263
3279
|
"seed": "#E5484D",
|
|
3264
3280
|
"tint": "subtle",
|
|
@@ -3290,6 +3306,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3290
3306
|
{
|
|
3291
3307
|
"id": "corner-cafe",
|
|
3292
3308
|
"name": "Corner café",
|
|
3309
|
+
"nameHe": "קפה פינתי",
|
|
3293
3310
|
"flavorId": "bloom",
|
|
3294
3311
|
"seed": "#9C4146",
|
|
3295
3312
|
"tint": "subtle",
|
|
@@ -3322,6 +3339,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3322
3339
|
{
|
|
3323
3340
|
"id": "kind-community",
|
|
3324
3341
|
"name": "Kind community",
|
|
3342
|
+
"nameHe": "קהילה חמה",
|
|
3325
3343
|
"flavorId": "bloom",
|
|
3326
3344
|
"seed": "#3B6939",
|
|
3327
3345
|
"tint": "subtle",
|
|
@@ -3354,6 +3372,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3354
3372
|
{
|
|
3355
3373
|
"id": "little-ones",
|
|
3356
3374
|
"name": "Little ones",
|
|
3375
|
+
"nameHe": "קטנטנים",
|
|
3357
3376
|
"flavorId": "bloom",
|
|
3358
3377
|
"seed": "#006A6A",
|
|
3359
3378
|
"tint": "rich",
|
|
@@ -3385,6 +3404,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3385
3404
|
{
|
|
3386
3405
|
"id": "garden-party",
|
|
3387
3406
|
"name": "Garden party",
|
|
3407
|
+
"nameHe": "מסיבת גן",
|
|
3388
3408
|
"flavorId": "bloom",
|
|
3389
3409
|
"seed": "#7D5260",
|
|
3390
3410
|
"tint": "subtle",
|
|
@@ -3417,6 +3437,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3417
3437
|
{
|
|
3418
3438
|
"id": "bold-maker",
|
|
3419
3439
|
"name": "Bold maker",
|
|
3440
|
+
"nameHe": "יוצר נועז",
|
|
3420
3441
|
"flavorId": "pop",
|
|
3421
3442
|
"seed": "#FF5C39",
|
|
3422
3443
|
"tint": "subtle",
|
|
@@ -3449,6 +3470,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3449
3470
|
{
|
|
3450
3471
|
"id": "festival",
|
|
3451
3472
|
"name": "Festival",
|
|
3473
|
+
"nameHe": "פסטיבל",
|
|
3452
3474
|
"flavorId": "pop",
|
|
3453
3475
|
"seed": "#FF4FA3",
|
|
3454
3476
|
"tint": "subtle",
|
|
@@ -3482,6 +3504,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3482
3504
|
{
|
|
3483
3505
|
"id": "zine",
|
|
3484
3506
|
"name": "Zine",
|
|
3507
|
+
"nameHe": "פנזין",
|
|
3485
3508
|
"flavorId": "pop",
|
|
3486
3509
|
"seed": "#3D5AFE",
|
|
3487
3510
|
"tint": "neutral",
|
|
@@ -3514,6 +3537,7 @@ export const SPEC_STYLE_PRESETS = [
|
|
|
3514
3537
|
{
|
|
3515
3538
|
"id": "fresh-market",
|
|
3516
3539
|
"name": "Fresh market",
|
|
3540
|
+
"nameHe": "שוק טרי",
|
|
3517
3541
|
"flavorId": "pop",
|
|
3518
3542
|
"seed": "#00B86B",
|
|
3519
3543
|
"tint": "subtle",
|
|
@@ -4122,6 +4146,160 @@ export const SPEC_FONT_METRICS = {
|
|
|
4122
4146
|
"fallback": {
|
|
4123
4147
|
"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",
|
|
4124
4148
|
"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"
|
|
4149
|
+
},
|
|
4150
|
+
"vertical": {
|
|
4151
|
+
"Archivo": {
|
|
4152
|
+
"ascent": 878,
|
|
4153
|
+
"descent": 210
|
|
4154
|
+
},
|
|
4155
|
+
"Archivo Black": {
|
|
4156
|
+
"ascent": 878,
|
|
4157
|
+
"descent": 210
|
|
4158
|
+
},
|
|
4159
|
+
"Assistant": {
|
|
4160
|
+
"ascent": 1021,
|
|
4161
|
+
"descent": 287
|
|
4162
|
+
},
|
|
4163
|
+
"Bellefair": {
|
|
4164
|
+
"ascent": 869,
|
|
4165
|
+
"descent": 277
|
|
4166
|
+
},
|
|
4167
|
+
"Bricolage Grotesque": {
|
|
4168
|
+
"ascent": 930,
|
|
4169
|
+
"descent": 270
|
|
4170
|
+
},
|
|
4171
|
+
"Cormorant Garamond": {
|
|
4172
|
+
"ascent": 924,
|
|
4173
|
+
"descent": 287
|
|
4174
|
+
},
|
|
4175
|
+
"DM Sans": {
|
|
4176
|
+
"ascent": 992,
|
|
4177
|
+
"descent": 310
|
|
4178
|
+
},
|
|
4179
|
+
"Figtree": {
|
|
4180
|
+
"ascent": 950,
|
|
4181
|
+
"descent": 250
|
|
4182
|
+
},
|
|
4183
|
+
"Frank Ruhl Libre": {
|
|
4184
|
+
"ascent": 957,
|
|
4185
|
+
"descent": 334
|
|
4186
|
+
},
|
|
4187
|
+
"Fraunces": {
|
|
4188
|
+
"ascent": 978,
|
|
4189
|
+
"descent": 255
|
|
4190
|
+
},
|
|
4191
|
+
"Geist": {
|
|
4192
|
+
"ascent": 1005,
|
|
4193
|
+
"descent": 295
|
|
4194
|
+
},
|
|
4195
|
+
"Geist Mono": {
|
|
4196
|
+
"ascent": 1005,
|
|
4197
|
+
"descent": 295
|
|
4198
|
+
},
|
|
4199
|
+
"Google Sans Flex": {
|
|
4200
|
+
"ascent": 966,
|
|
4201
|
+
"descent": 286
|
|
4202
|
+
},
|
|
4203
|
+
"Heebo": {
|
|
4204
|
+
"ascent": 1048,
|
|
4205
|
+
"descent": 421
|
|
4206
|
+
},
|
|
4207
|
+
"IBM Plex Sans": {
|
|
4208
|
+
"ascent": 1025,
|
|
4209
|
+
"descent": 275
|
|
4210
|
+
},
|
|
4211
|
+
"IBM Plex Sans Hebrew": {
|
|
4212
|
+
"ascent": 1025,
|
|
4213
|
+
"descent": 275
|
|
4214
|
+
},
|
|
4215
|
+
"Instrument Serif": {
|
|
4216
|
+
"ascent": 990,
|
|
4217
|
+
"descent": 310
|
|
4218
|
+
},
|
|
4219
|
+
"Inter": {
|
|
4220
|
+
"ascent": 969,
|
|
4221
|
+
"descent": 241
|
|
4222
|
+
},
|
|
4223
|
+
"Inter Tight": {
|
|
4224
|
+
"ascent": 969,
|
|
4225
|
+
"descent": 241
|
|
4226
|
+
},
|
|
4227
|
+
"JetBrains Mono": {
|
|
4228
|
+
"ascent": 1020,
|
|
4229
|
+
"descent": 300
|
|
4230
|
+
},
|
|
4231
|
+
"Lato": {
|
|
4232
|
+
"ascent": 987,
|
|
4233
|
+
"descent": 213
|
|
4234
|
+
},
|
|
4235
|
+
"Manrope": {
|
|
4236
|
+
"ascent": 1066,
|
|
4237
|
+
"descent": 300
|
|
4238
|
+
},
|
|
4239
|
+
"Montserrat": {
|
|
4240
|
+
"ascent": 968,
|
|
4241
|
+
"descent": 251
|
|
4242
|
+
},
|
|
4243
|
+
"Nunito": {
|
|
4244
|
+
"ascent": 1011,
|
|
4245
|
+
"descent": 353
|
|
4246
|
+
},
|
|
4247
|
+
"Open Sans": {
|
|
4248
|
+
"ascent": 1069,
|
|
4249
|
+
"descent": 293
|
|
4250
|
+
},
|
|
4251
|
+
"Oswald": {
|
|
4252
|
+
"ascent": 1193,
|
|
4253
|
+
"descent": 289
|
|
4254
|
+
},
|
|
4255
|
+
"Playfair Display": {
|
|
4256
|
+
"ascent": 1082,
|
|
4257
|
+
"descent": 251
|
|
4258
|
+
},
|
|
4259
|
+
"Plus Jakarta Sans": {
|
|
4260
|
+
"ascent": 1038,
|
|
4261
|
+
"descent": 222
|
|
4262
|
+
},
|
|
4263
|
+
"Poppins": {
|
|
4264
|
+
"ascent": 1050,
|
|
4265
|
+
"descent": 350
|
|
4266
|
+
},
|
|
4267
|
+
"Raleway": {
|
|
4268
|
+
"ascent": 940,
|
|
4269
|
+
"descent": 234
|
|
4270
|
+
},
|
|
4271
|
+
"Roboto": {
|
|
4272
|
+
"ascent": 928,
|
|
4273
|
+
"descent": 244
|
|
4274
|
+
},
|
|
4275
|
+
"Rubik": {
|
|
4276
|
+
"ascent": 935,
|
|
4277
|
+
"descent": 250
|
|
4278
|
+
},
|
|
4279
|
+
"Secular One": {
|
|
4280
|
+
"ascent": 1022,
|
|
4281
|
+
"descent": 433
|
|
4282
|
+
},
|
|
4283
|
+
"Space Grotesk": {
|
|
4284
|
+
"ascent": 984,
|
|
4285
|
+
"descent": 292
|
|
4286
|
+
},
|
|
4287
|
+
"Space Mono": {
|
|
4288
|
+
"ascent": 1120,
|
|
4289
|
+
"descent": 361
|
|
4290
|
+
},
|
|
4291
|
+
"Syne": {
|
|
4292
|
+
"ascent": 925,
|
|
4293
|
+
"descent": 275
|
|
4294
|
+
},
|
|
4295
|
+
"Ubuntu": {
|
|
4296
|
+
"ascent": 932,
|
|
4297
|
+
"descent": 189
|
|
4298
|
+
},
|
|
4299
|
+
"Varela Round": {
|
|
4300
|
+
"ascent": 918,
|
|
4301
|
+
"descent": 286
|
|
4302
|
+
}
|
|
4125
4303
|
}
|
|
4126
4304
|
} as const;
|
|
4127
4305
|
|
|
@@ -6385,6 +6563,7 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
6385
6563
|
{
|
|
6386
6564
|
"id": "crisp",
|
|
6387
6565
|
"name": "Crisp",
|
|
6566
|
+
"nameHe": "צלול",
|
|
6388
6567
|
"personality": "Professional",
|
|
6389
6568
|
"inspiredBy": "Swiss grid design, Stripe, Linear (light)",
|
|
6390
6569
|
"blurb": "Clean, precise, gets out of the way.",
|
|
@@ -8924,6 +9103,7 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
8924
9103
|
{
|
|
8925
9104
|
"id": "linen",
|
|
8926
9105
|
"name": "Linen",
|
|
9106
|
+
"nameHe": "פשתן",
|
|
8927
9107
|
"personality": "Sophisticated",
|
|
8928
9108
|
"inspiredBy": "Quiet luxury, interiors and hotel sites, print magazines",
|
|
8929
9109
|
"blurb": "Calm, warm and expensive.",
|
|
@@ -11489,6 +11669,7 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
11489
11669
|
{
|
|
11490
11670
|
"id": "midnight",
|
|
11491
11671
|
"name": "Midnight",
|
|
11672
|
+
"nameHe": "חצות",
|
|
11492
11673
|
"personality": "Bold",
|
|
11493
11674
|
"inspiredBy": "Dark product sites — Linear, Vercel, Raycast",
|
|
11494
11675
|
"blurb": "Dark, sharp, glowing.",
|
|
@@ -14042,6 +14223,7 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
14042
14223
|
{
|
|
14043
14224
|
"id": "glass",
|
|
14044
14225
|
"name": "Glass",
|
|
14226
|
+
"nameHe": "זכוכית",
|
|
14045
14227
|
"personality": "Light & layered",
|
|
14046
14228
|
"inspiredBy": "Apple iOS 26 Liquid Glass",
|
|
14047
14229
|
"blurb": "Translucent layers over a soft colour field.",
|
|
@@ -16642,6 +16824,7 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
16642
16824
|
{
|
|
16643
16825
|
"id": "bloom",
|
|
16644
16826
|
"name": "Bloom",
|
|
16827
|
+
"nameHe": "פריחה",
|
|
16645
16828
|
"personality": "Friendly",
|
|
16646
16829
|
"inspiredBy": "Android Material 3 Expressive",
|
|
16647
16830
|
"blurb": "Round, warm and a little bouncy.",
|
|
@@ -19203,6 +19386,7 @@ export const SPEC_FLAVOR_PACKS = [
|
|
|
19203
19386
|
{
|
|
19204
19387
|
"id": "pop",
|
|
19205
19388
|
"name": "Pop",
|
|
19389
|
+
"nameHe": "פופ",
|
|
19206
19390
|
"personality": "Playful",
|
|
19207
19391
|
"inspiredBy": "Neo-brutalism — Gumroad, Figma Config",
|
|
19208
19392
|
"blurb": "Loud, graphic, unmissable.",
|
|
@@ -3,6 +3,7 @@ import { DesignChoices } from './design-token.model';
|
|
|
3
3
|
import { ELEMENT_STYLES } from './element-styles';
|
|
4
4
|
import { SPEC_FONT_METRICS } from './flavor-spec.generated';
|
|
5
5
|
import { matchFontWeight, parseFontFamilies } from './fonts';
|
|
6
|
+
import { baselineDropCss, faceVerticalMetrics } from './font-vertical';
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* How wide words are in a face, from the catalog fonts' own letters (iox-ui#46). The contract's `fontMetrics` holds each
|
|
@@ -112,9 +113,12 @@ const DEFAULT_FACE: Readonly<Record<'fontFamily' | 'fontWeight' | 'letterSpacing
|
|
|
112
113
|
* The face an element style wears in a design: its font, weight and letter spacing as the design's tokens resolve them.
|
|
113
114
|
* An unknown style reads the display face; a letter spacing not in em reads none.
|
|
114
115
|
*/
|
|
116
|
+
const styleBase = (styleId: string) =>
|
|
117
|
+
(ELEMENT_STYLES.find(s => s.id === styleId)?.base ?? DEFAULT_FACE) as Readonly<Record<string, string | undefined>>;
|
|
118
|
+
|
|
115
119
|
export function elementStyleFace(choices: DesignChoices, styleId: string): TypeFace {
|
|
116
120
|
const rows = new Map(designTokenRows(choices).map(r => [r.name, r.value]));
|
|
117
|
-
const base = (
|
|
121
|
+
const base = styleBase(styleId);
|
|
118
122
|
const read = (prop: keyof typeof DEFAULT_FACE): string => {
|
|
119
123
|
const value = base[prop] ?? '';
|
|
120
124
|
const token = TOKEN.exec(value)?.[1];
|
|
@@ -123,3 +127,12 @@ export function elementStyleFace(choices: DesignChoices, styleId: string): TypeF
|
|
|
123
127
|
const spacing = /^(-?[\d.]+)em$/.exec(read('letterSpacing').trim());
|
|
124
128
|
return { stack: read('fontFamily'), weight: Number(read('fontWeight')) || 400, tracking: spacing ? Number(spacing[1]) : 0 };
|
|
125
129
|
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* iox-ui#215: the drop that stands a line of an element style ON its box's bottom edge, as CSS that follows the live
|
|
133
|
+
* face — the style's family token's derived metrics (`baselineDropCss`), falling back to the face `choices` give it now.
|
|
134
|
+
*/
|
|
135
|
+
export function elementStyleDropCss(choices: DesignChoices, styleId: string, lineHeight: number): string {
|
|
136
|
+
const family = styleBase(styleId)['fontFamily'] ?? DEFAULT_FACE.fontFamily;
|
|
137
|
+
return baselineDropCss(family, lineHeight, faceVerticalMetrics(elementStyleFace(choices, styleId).stack));
|
|
138
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { SPEC_FONT_METRICS } from './flavor-spec.generated';
|
|
2
|
+
import { FONT_FAMILY_TOKENS, parseFontFamilies } from './fonts';
|
|
3
|
+
|
|
4
|
+
// ── Vertical metrics: where a line box puts the baseline (iox-ui#206, #215) ────────────────────────────────────────
|
|
5
|
+
//
|
|
6
|
+
// Framework-free and light on imports: the token compiler (token-css) reads it, so it never imports what reads tokens.
|
|
7
|
+
|
|
8
|
+
/** A face's vertical metrics in em: how far its ascender rises above the baseline and its descender falls below it. */
|
|
9
|
+
export interface VerticalMetrics {
|
|
10
|
+
readonly ascent: number;
|
|
11
|
+
readonly descent: number;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const PER_EM = 1000;
|
|
15
|
+
type VerticalRow = { readonly ascent: number; readonly descent: number };
|
|
16
|
+
const VERTICAL = SPEC_FONT_METRICS.vertical as Readonly<Record<string, VerticalRow>>;
|
|
17
|
+
const metricsOf = (row: VerticalRow): VerticalMetrics => ({ ascent: row.ascent / PER_EM, descent: row.descent / PER_EM });
|
|
18
|
+
/**
|
|
19
|
+
* A face the catalog does not hold reads the catalog row that drops a set line the LEAST (the largest ascent over its
|
|
20
|
+
* descent): a name it stands on an edge may show a sliver of air under its letters, never a cut through them.
|
|
21
|
+
*/
|
|
22
|
+
const VERTICAL_FALLBACK: VerticalMetrics = metricsOf(
|
|
23
|
+
Object.values(VERTICAL).reduce((best, row) => (row.ascent - row.descent > best.ascent - best.descent ? row : best)),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* The vertical metrics a stack's line box is laid with: its PRIMARY face's (the first family — a browser sets the
|
|
28
|
+
* baseline of a whole line by it, a Hebrew letter drawn by the partner sits on that same baseline). A primary family
|
|
29
|
+
* the catalog does not hold (an uploaded font, system-ui) reads the fallback.
|
|
30
|
+
*/
|
|
31
|
+
export function faceVerticalMetrics(stack: string): VerticalMetrics {
|
|
32
|
+
const row = VERTICAL[parseFontFamilies(stack)[0] ?? ''];
|
|
33
|
+
return row ? metricsOf(row) : VERTICAL_FALLBACK;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* How far (em, signed) a line set at `lineHeight` (unitless) must move down for its baseline to stand on its line box's
|
|
38
|
+
* bottom edge. A set line height lays the face's ascent + descent in the middle of the line — half the leading above,
|
|
39
|
+
* half below — so the baseline stands `(lineHeight − ascent + descent) / 2` above the box's bottom. A name cropped on
|
|
40
|
+
* an edge (`words:on-edge`) moves by exactly that: its descenders go under the edge on purpose, its letters never do.
|
|
41
|
+
*/
|
|
42
|
+
export function baselineDropEm(metrics: VerticalMetrics, lineHeight: number): number {
|
|
43
|
+
return (lineHeight - metrics.ascent + metrics.descent) / 2;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The token a family token's face writes its ascent / descent to: `font-display` → `font-display-ascent` (unitless em). */
|
|
47
|
+
export const fontAscentToken = (familyToken: string): string => `${familyToken}-ascent`;
|
|
48
|
+
export const fontDescentToken = (familyToken: string): string => `${familyToken}-descent`;
|
|
49
|
+
|
|
50
|
+
const round = (n: number): string => String(Number(n.toFixed(4)));
|
|
51
|
+
const FAMILY_TOKEN_REF = /^var\(\s*--iox-([\w-]+)\s*\)$/;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* iox-ui#215: each font-family token's face, as two DERIVED tokens the token compiler writes beside it (both renderers —
|
|
55
|
+
* `compileTokenCssBlocks`): `--iox-font-display-ascent` / `--iox-font-display-descent`. A font changed in Design
|
|
56
|
+
* recompiles them with the token, so whatever reads them follows the face live — no node holds a face's number.
|
|
57
|
+
* `resolved` is every token's value with its references resolved (a role may read another: `var(--iox-font-body)`).
|
|
58
|
+
*/
|
|
59
|
+
export function fontVerticalTokenEntries(resolved: Readonly<Record<string, string>>): Array<[string, string]> {
|
|
60
|
+
const out: Array<[string, string]> = [];
|
|
61
|
+
for (const role of FONT_FAMILY_TOKENS) {
|
|
62
|
+
const stack = resolved[role];
|
|
63
|
+
if (!stack) continue;
|
|
64
|
+
const m = faceVerticalMetrics(stack);
|
|
65
|
+
out.push([fontAscentToken(role), round(m.ascent)], [fontDescentToken(role), round(m.descent)]);
|
|
66
|
+
}
|
|
67
|
+
return out;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* THE drop as CSS (iox-ui#215): for a node whose font is a family token (`var(--iox-font-display)`), the drop reads that
|
|
72
|
+
* family's derived tokens, so it follows the live face — `calc((0.82 − ascent + descent) * 0.5em)`. Each `var()` falls
|
|
73
|
+
* back to `fallback` (the face it was composed with), so a renderer whose token CSS predates the derived tokens draws
|
|
74
|
+
* what it drew before. A literal family (no token) is a fixed em from `fallback`.
|
|
75
|
+
*/
|
|
76
|
+
export function baselineDropCss(fontFamily: string, lineHeight: number, fallback: VerticalMetrics): string {
|
|
77
|
+
const role = FAMILY_TOKEN_REF.exec(fontFamily.trim())?.[1];
|
|
78
|
+
if (!role || !(FONT_FAMILY_TOKENS as ReadonlyArray<string>).includes(role)) return `${round(baselineDropEm(fallback, lineHeight))}em`;
|
|
79
|
+
return `calc((${lineHeight} - var(--iox-${fontAscentToken(role)}, ${round(fallback.ascent)}) + var(--iox-${fontDescentToken(role)}, ${round(fallback.descent)})) * 0.5em)`;
|
|
80
|
+
}
|
|
@@ -46,6 +46,18 @@ export const CARD_LINK_CLASS = 'iox-card-link';
|
|
|
46
46
|
* card stays clickable (board 8). */
|
|
47
47
|
export const CANVAS_LINK_ATTRIBUTE = 'data-iox-canvas';
|
|
48
48
|
|
|
49
|
+
/** The ONE target that opens a new tab. */
|
|
50
|
+
export const NEW_TAB_TARGET = '_blank';
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The `rel` a link opening `target` carries, or `null` for none: a new tab never reaches back to the page that
|
|
54
|
+
* opened it (`noopener`). ONE answer for every link a renderer draws — Link, a linked Heading, an `<a>`
|
|
55
|
+
* ButtonBlock — on the builder canvas and both engine paths.
|
|
56
|
+
*/
|
|
57
|
+
export function linkRel(target: unknown): string | null {
|
|
58
|
+
return target === NEW_TAB_TARGET ? 'noopener' : null;
|
|
59
|
+
}
|
|
60
|
+
|
|
49
61
|
/**
|
|
50
62
|
* The href a linked Heading renders (Card v2: the card's title IS its link), or `null` when it links
|
|
51
63
|
* nowhere — `none`, or a link with no target yet (the title then renders as plain words). A page link goes
|
|
@@ -39,6 +39,7 @@ export * from './spring';
|
|
|
39
39
|
export * from './entrance-timing';
|
|
40
40
|
export * from './fonts';
|
|
41
41
|
export * from './font-metrics';
|
|
42
|
+
export * from './font-vertical';
|
|
42
43
|
export * from './token-names';
|
|
43
44
|
export * from './design-settings';
|
|
44
45
|
export * from './design-apply';
|