@transitrix/diagrams 1.8.3 → 1.8.6

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.
@@ -44,4 +44,12 @@ describe('horizontalCubicEdgePath', () => {
44
44
  it('omitting entryCurvature gives symmetric handles (historical behaviour)', () => {
45
45
  expect(horizontalCubicEdgePath(0, 0, 40, 0, 0.5)).toBe(horizontalCubicEdgePath(0, 0, 40, 0, 0.5, 0.5));
46
46
  });
47
+ it('caps the handle for a tall edge with a narrow column gap, instead of overshooting the target', () => {
48
+ // A network-view edge spanning several rows (|dy|=500) with a typical
49
+ // adjacent-column gap (dx=80): uncapped, |dy|*0.8=400 would push the exit
50
+ // control point 320px past the target's x, producing an exaggerated
51
+ // S-bow. Capped at 160, the control points stay close to the endpoints.
52
+ const d = horizontalCubicEdgePath(0, 0, 80, 500, 1);
53
+ expect(d).toBe('M0,0 C160,0 -80,500 80,500');
54
+ });
47
55
  });
@@ -60,7 +60,7 @@ export function renderCapabilityTreeSvg(map, opts = {}) {
60
60
  <text class="tree-collapse-lbl" x="${btnCx}" y="${btnCy}" text-anchor="middle">${n.isCollapsed ? '+' : '−'}</text>`
61
61
  : '';
62
62
  return `<g${nameTitle ? ` title="${nameTitle}"` : ''}>
63
- <rect class="tree-level-${band}" x="${x}" y="${y}" width="${n.width}" height="${n.height}" rx="11" stroke="var(--ts-node-stroke,#94a3b8)" stroke-width="3"/>
63
+ <rect class="tree-level-${band}" x="${x}" y="${y}" width="${n.width}" height="${n.height}" rx="11" stroke="var(--ts-node-stroke,#004d67)" stroke-width="3"/>
64
64
  <rect class="tree-maturity-${mat}" x="${badgeX}" y="${badgeY}" width="${badgeW}" height="${badgeH}" rx="4"/>
65
65
  <text class="text-pill" x="${badgeX + badgeW / 2}" y="${badgeY + badgeH / 2}" text-anchor="middle" fill="white">L${mat}</text>
66
66
  <text class="text-primary" x="${textX}" y="${nameY}" dominant-baseline="central">${escXml(nameText)}</text>
@@ -80,7 +80,7 @@ export function renderCapabilityTreeSvg(map, opts = {}) {
80
80
  legendX += bw;
81
81
  if (count === 0)
82
82
  return '';
83
- return `<rect class="tree-level-${i}" x="${bx}" y="${legendY}" width="${bw}" height="24" rx="4" stroke="var(--ts-node-stroke,#94a3b8)" stroke-width="1"/>
83
+ return `<rect class="tree-level-${i}" x="${bx}" y="${legendY}" width="${bw}" height="24" rx="4" stroke="var(--ts-node-stroke,#004d67)" stroke-width="1"/>
84
84
  <text class="text-id" x="${bx + bw / 2}" y="${legendY + 12}" text-anchor="middle" dominant-baseline="central">${escXml(BAND_LABELS[i])}</text>`;
85
85
  }).filter(Boolean).join('\n');
86
86
  return `<svg xmlns="http://www.w3.org/2000/svg" width="${svgW}" height="${svgH}" viewBox="0 0 ${svgW} ${svgH}">
package/dist/edge-path.js CHANGED
@@ -15,6 +15,15 @@
15
15
  export const EDGE_MIN_HANDLE = 64;
16
16
  const DX_FACTOR = 0.5;
17
17
  const DY_FACTOR = 0.8;
18
+ /**
19
+ * Ceiling on each span factor's contribution. Uncapped, a tall edge with a
20
+ * narrow column gap (large dy, small dx — the common case in a many-row
21
+ * network view) grows a handle far past the endpoints' actual x-distance;
22
+ * the two control points then overshoot each other, producing an
23
+ * exaggerated S-bow instead of a gentle curve. Capping keeps typical spans
24
+ * (within the existing historical range) untouched while reining in outliers.
25
+ */
26
+ const MAX_HANDLE = 160;
18
27
  /** Multiplier applied to the base handle length. 1 = historical appearance. */
19
28
  export const DEFAULT_EDGE_CURVATURE = 1;
20
29
  /**
@@ -33,7 +42,7 @@ export const DEFAULT_EDGE_CURVATURE = 1;
33
42
  export function horizontalCubicEdgePath(sx, sy, tx, ty, curvature = DEFAULT_EDGE_CURVATURE, entryCurvature) {
34
43
  const dx = tx - sx;
35
44
  const dy = ty - sy;
36
- const baseHandle = Math.max(EDGE_MIN_HANDLE, Math.abs(dx) * DX_FACTOR, Math.abs(dy) * DY_FACTOR);
45
+ const baseHandle = Math.max(EDGE_MIN_HANDLE, Math.min(Math.abs(dx) * DX_FACTOR, MAX_HANDLE), Math.min(Math.abs(dy) * DY_FACTOR, MAX_HANDLE));
37
46
  const exitHandle = baseHandle * curvature;
38
47
  const entryHandle = baseHandle * (entryCurvature ?? curvature);
39
48
  return `M${sx},${sy} C${sx + exitHandle},${sy} ${tx - entryHandle},${ty} ${tx},${ty}`;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,159 @@
1
+ /**
2
+ * Brand default-theme regression tests (hub issue #548).
3
+ *
4
+ * Locks in the three-role brand mapping from `brand/transitrix_brand.md`:
5
+ * - Petrol = structure (node/edge stroke) and hierarchy depth (fill tint).
6
+ * - A depth ramp never switches hue — only lightness/saturation move.
7
+ * - Text stays WCAG-AA readable against every fill it can be drawn on.
8
+ * `hc` (VS Code high-contrast) is intentionally excluded — it's an
9
+ * accessibility override, not one of the three brand-contract themes.
10
+ */
11
+ import { describe, expect, it } from 'vitest';
12
+ import { BRAND, BRAND_EMPHASIS, LAYER_COLORS, LEVEL_COLORS, MATURITY_COLORS, TREE_MATURITY_COLORS, STRUCTURAL, TREE_LEVEL_COLORS, } from '../tokens.js';
13
+ function hexToRgb(hex) {
14
+ const n = hex.replace('#', '');
15
+ return [0, 2, 4].map((i) => parseInt(n.slice(i, i + 2), 16));
16
+ }
17
+ function relativeLuminance([r, g, b]) {
18
+ const f = (v) => {
19
+ const c = v / 255;
20
+ return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
21
+ };
22
+ const [R, G, B] = [f(r), f(g), f(b)];
23
+ return 0.2126 * R + 0.7152 * G + 0.0722 * B;
24
+ }
25
+ /** WCAG 2.x contrast ratio between two hex colors (1..21). */
26
+ function contrast(a, b) {
27
+ const la = relativeLuminance(hexToRgb(a));
28
+ const lb = relativeLuminance(hexToRgb(b));
29
+ const [hi, lo] = la > lb ? [la, lb] : [lb, la];
30
+ return (hi + 0.05) / (lo + 0.05);
31
+ }
32
+ /** Hue in degrees (0-360) from a hex color; undefined (grey) hues return -1. */
33
+ function hue(hex) {
34
+ const [r, g, b] = hexToRgb(hex).map((v) => v / 255);
35
+ const max = Math.max(r, g, b), min = Math.min(r, g, b);
36
+ const delta = max - min;
37
+ if (delta < 0.001)
38
+ return -1; // achromatic
39
+ let h;
40
+ if (max === r)
41
+ h = ((g - b) / delta) % 6;
42
+ else if (max === g)
43
+ h = (b - r) / delta + 2;
44
+ else
45
+ h = (r - g) / delta + 4;
46
+ h *= 60;
47
+ return h < 0 ? h + 360 : h;
48
+ }
49
+ const PETROL_HUE = hue(BRAND.petrol);
50
+ const HUE_TOLERANCE = 6; // degrees — rounding slop from hand-tuned hex values
51
+ function expectSameHueFamily(hexes, label) {
52
+ for (const hex of hexes) {
53
+ const h = hue(hex);
54
+ const diff = Math.min(Math.abs(h - PETROL_HUE), 360 - Math.abs(h - PETROL_HUE));
55
+ expect(diff, `${label} ${hex} should stay in the petrol hue family (got hue ${h.toFixed(1)}, petrol is ${PETROL_HUE.toFixed(1)})`).toBeLessThanOrEqual(HUE_TOLERANCE);
56
+ }
57
+ }
58
+ // Minimum AA text-contrast ratios this design targets. Primary/secondary text
59
+ // is small (10-12px) so we hold the full 4.5:1 normal-text bar for the name
60
+ // label, and the calibrated ~4.0 bar the pre-brand palette already shipped
61
+ // for the muted secondary/id label (see brand-ramp calibration in PR #548).
62
+ const MIN_PRIMARY_CONTRAST = 4.5;
63
+ const MIN_SECONDARY_CONTRAST = 4.0;
64
+ describe('brand default theme (#548) — structure is petrol', () => {
65
+ it('nodeStroke and edgeStroke are brand petrol in the light theme', () => {
66
+ expect(STRUCTURAL.nodeStroke.light).toBe(BRAND.petrol);
67
+ expect(STRUCTURAL.edgeStroke.light).toBe(BRAND.petrol);
68
+ });
69
+ it('nodeStroke/edgeStroke stay in the petrol hue family in the dark theme', () => {
70
+ expectSameHueFamily([STRUCTURAL.nodeStroke.dark, STRUCTURAL.edgeStroke.dark], 'dark stroke');
71
+ });
72
+ });
73
+ describe('brand default theme (#548) — tint depth never switches hue', () => {
74
+ it('LEVEL_COLORS light ramp stays in the petrol hue family', () => {
75
+ expectSameHueFamily([...LEVEL_COLORS.light], 'LEVEL light');
76
+ });
77
+ it('LEVEL_COLORS dark ramp stays in the petrol hue family', () => {
78
+ expectSameHueFamily([...LEVEL_COLORS.dark], 'LEVEL dark');
79
+ });
80
+ it('LAYER_COLORS (DGCA/DGA columns) stay in the petrol hue family, both themes', () => {
81
+ const keys = ['driver', 'factor', 'goal', 'change', 'activity'];
82
+ expectSameHueFamily(keys.map((k) => LAYER_COLORS[k].light), 'LAYER light');
83
+ expectSameHueFamily(keys.map((k) => LAYER_COLORS[k].dark), 'LAYER dark');
84
+ });
85
+ it('TREE_LEVEL_COLORS (capability map bands) stay in the petrol hue family, both themes', () => {
86
+ const keys = ['band0', 'band1', 'band2'];
87
+ expectSameHueFamily(keys.map((k) => TREE_LEVEL_COLORS[k].light), 'BAND light');
88
+ expectSameHueFamily(keys.map((k) => TREE_LEVEL_COLORS[k].dark), 'BAND dark');
89
+ });
90
+ });
91
+ describe('brand default theme (#548) — WCAG-AA text-on-fill contrast', () => {
92
+ function checkFills(label, fills, textPrimary, textSecondary) {
93
+ for (const fill of fills) {
94
+ expect(contrast(fill, textPrimary), `${label} ${fill} vs text-primary`).toBeGreaterThanOrEqual(MIN_PRIMARY_CONTRAST);
95
+ expect(contrast(fill, textSecondary), `${label} ${fill} vs text-secondary`).toBeGreaterThanOrEqual(MIN_SECONDARY_CONTRAST);
96
+ }
97
+ }
98
+ it('LEVEL_COLORS — every slot, both themes', () => {
99
+ checkFills('LEVEL light', [...LEVEL_COLORS.light], STRUCTURAL.textPrimary.light, STRUCTURAL.textSecondary.light);
100
+ checkFills('LEVEL dark', [...LEVEL_COLORS.dark], STRUCTURAL.textPrimary.dark, STRUCTURAL.textSecondary.dark);
101
+ });
102
+ it('LAYER_COLORS — every column, both themes', () => {
103
+ const keys = ['driver', 'factor', 'goal', 'change', 'activity'];
104
+ checkFills('LAYER light', keys.map((k) => LAYER_COLORS[k].light), STRUCTURAL.textPrimary.light, STRUCTURAL.textSecondary.light);
105
+ checkFills('LAYER dark', keys.map((k) => LAYER_COLORS[k].dark), STRUCTURAL.textPrimary.dark, STRUCTURAL.textSecondary.dark);
106
+ });
107
+ it('TREE_LEVEL_COLORS — every band, both themes', () => {
108
+ const keys = ['band0', 'band1', 'band2'];
109
+ checkFills('BAND light', keys.map((k) => TREE_LEVEL_COLORS[k].light), STRUCTURAL.textPrimary.light, STRUCTURAL.textSecondary.light);
110
+ checkFills('BAND dark', keys.map((k) => TREE_LEVEL_COLORS[k].dark), STRUCTURAL.textPrimary.dark, STRUCTURAL.textSecondary.dark);
111
+ });
112
+ it('textPrimary/textSecondary stay readable against the shell background', () => {
113
+ expect(contrast(STRUCTURAL.textPrimary.light, '#ffffff')).toBeGreaterThanOrEqual(MIN_PRIMARY_CONTRAST);
114
+ expect(contrast(STRUCTURAL.textPrimary.dark, '#0a1628')).toBeGreaterThanOrEqual(MIN_PRIMARY_CONTRAST);
115
+ });
116
+ });
117
+ describe('brand default theme (#548) — amber/orange emphasis stays distinct from functional colors', () => {
118
+ it('does not reuse brand amber/orange for functional status', () => {
119
+ // FUNCTIONAL warning/error must remain visually distinct from the brand
120
+ // accents so a red error is never confused with brand orange, per
121
+ // brand/transitrix_brand.md "Don't reuse brand orange as semantic error".
122
+ expect(BRAND_EMPHASIS.orange.light).toBe(BRAND.orange);
123
+ expect(BRAND_EMPHASIS.amber.light).toBe(BRAND.amber);
124
+ });
125
+ it('critical-path emphasis tint pairs with the orange stroke, both themes', () => {
126
+ expect(contrast(BRAND_EMPHASIS.orange.light, BRAND_EMPHASIS.orangeTint.light)).toBeGreaterThan(1.5);
127
+ expect(contrast(BRAND_EMPHASIS.orange.dark, BRAND_EMPHASIS.orangeTint.dark)).toBeGreaterThan(1.5);
128
+ });
129
+ });
130
+ describe('maturity Likert ramp — one harmonious scale, white-label contrast', () => {
131
+ // .maturity-pill / tree-maturity badges hardcode white label text
132
+ // (capability-map-preview.ts, render-capability-tree.ts) regardless of
133
+ // theme, so every step needs AA (light/dark) or AAA (hc, since VS Code
134
+ // high-contrast mode exists specifically to demand stronger contrast)
135
+ // against white — not against the page's own text-primary/secondary.
136
+ const MIN_WHITE_CONTRAST_AA = 4.5;
137
+ const MIN_WHITE_CONTRAST_AAA = 7;
138
+ it('MATURITY_COLORS — every step reads white text at AA, light + dark', () => {
139
+ for (const hex of MATURITY_COLORS.light) {
140
+ expect(contrast(hex, '#ffffff'), `MATURITY light ${hex} vs white`).toBeGreaterThanOrEqual(MIN_WHITE_CONTRAST_AA);
141
+ }
142
+ for (const hex of MATURITY_COLORS.dark) {
143
+ expect(contrast(hex, '#ffffff'), `MATURITY dark ${hex} vs white`).toBeGreaterThanOrEqual(MIN_WHITE_CONTRAST_AA);
144
+ }
145
+ });
146
+ it('MATURITY_COLORS hc — every step reads white text at AAA', () => {
147
+ for (const hex of MATURITY_COLORS.hc) {
148
+ expect(contrast(hex, '#ffffff'), `MATURITY hc ${hex} vs white`).toBeGreaterThanOrEqual(MIN_WHITE_CONTRAST_AAA);
149
+ }
150
+ });
151
+ it('TREE_MATURITY_COLORS is the same harmonious ramp as MATURITY_COLORS', () => {
152
+ // Previously a divergent DSM-matching pink/yellow/blue set (plus a grey
153
+ // L1, an odd "no signal" hue for the worst rating) — "maturity" now
154
+ // means the same colors everywhere it's shown.
155
+ expect(TREE_MATURITY_COLORS.light).toEqual(MATURITY_COLORS.light);
156
+ expect(TREE_MATURITY_COLORS.dark).toEqual(MATURITY_COLORS.dark);
157
+ expect(TREE_MATURITY_COLORS.hc).toEqual(MATURITY_COLORS.hc);
158
+ });
159
+ });
@@ -1,4 +1,4 @@
1
1
  export type { AdaptiveTokens } from './tokens.js';
2
- export { BRAND, FUNCTIONAL, LAYER_COLORS, LEVEL_COLORS, MATURITY_COLORS, TREE_LEVEL_COLORS, TREE_MATURITY_COLORS, STRUCTURAL, TYPOGRAPHY, CSS_VAR, getBaseResetCss } from './tokens.js';
2
+ export { BRAND, BRAND_EMPHASIS, FUNCTIONAL, LAYER_COLORS, LEVEL_COLORS, MATURITY_COLORS, TREE_LEVEL_COLORS, TREE_MATURITY_COLORS, STRUCTURAL, TYPOGRAPHY, CSS_VAR, getBaseResetCss } from './tokens.js';
3
3
  export type { ThemeId } from './themes.js';
4
4
  export { generateWebviewCss, generateSvgEmbedCss } from './themes.js';
@@ -1,2 +1,2 @@
1
- export { BRAND, FUNCTIONAL, LAYER_COLORS, LEVEL_COLORS, MATURITY_COLORS, TREE_LEVEL_COLORS, TREE_MATURITY_COLORS, STRUCTURAL, TYPOGRAPHY, CSS_VAR, getBaseResetCss } from './tokens.js';
1
+ export { BRAND, BRAND_EMPHASIS, FUNCTIONAL, LAYER_COLORS, LEVEL_COLORS, MATURITY_COLORS, TREE_LEVEL_COLORS, TREE_MATURITY_COLORS, STRUCTURAL, TYPOGRAPHY, CSS_VAR, getBaseResetCss } from './tokens.js';
2
2
  export { generateWebviewCss, generateSvgEmbedCss } from './themes.js';
@@ -1,4 +1,4 @@
1
- import { LAYER_COLORS, LEVEL_COLORS, MATURITY_COLORS, TREE_LEVEL_COLORS, TREE_MATURITY_COLORS, STRUCTURAL, TYPOGRAPHY, CSS_VAR, getBaseResetCss, } from './tokens.js';
1
+ import { LAYER_COLORS, LEVEL_COLORS, MATURITY_COLORS, TREE_LEVEL_COLORS, TREE_MATURITY_COLORS, STRUCTURAL, BRAND_EMPHASIS, TYPOGRAPHY, CSS_VAR, getBaseResetCss, } from './tokens.js';
2
2
  const TRANSITRIX_LIGHT = {
3
3
  bg: '#ffffff',
4
4
  bgSurface: '#f8fafc',
@@ -89,6 +89,9 @@ function diagramVars(variant) {
89
89
  `${CSS_VAR.maturity3}:${mat[2]}`,
90
90
  `${CSS_VAR.maturity4}:${mat[3]}`,
91
91
  `${CSS_VAR.maturity5}:${mat[4]}`,
92
+ `${CSS_VAR.brandAmber}:${BRAND_EMPHASIS.amber[variant]}`,
93
+ `${CSS_VAR.brandOrange}:${BRAND_EMPHASIS.orange[variant]}`,
94
+ `${CSS_VAR.brandOrangeTint}:${BRAND_EMPHASIS.orangeTint[variant]}`,
92
95
  ].join(';') + ';' + levelVars + treeVars;
93
96
  }
94
97
  /** CSS for the webview shell (toolbar, canvas). */
@@ -1,4 +1,4 @@
1
- /** Transitrix brand palette. */
1
+ /** Transitrix brand palette (`brand/transitrix_brand.md` — canonical). */
2
2
  export declare const BRAND: {
3
3
  readonly petrol: "#004d67";
4
4
  readonly amber: "#ffaf00";
@@ -11,108 +11,167 @@ export declare const FUNCTIONAL: {
11
11
  readonly error: "#b91c1c";
12
12
  readonly info: "#1d6fa8";
13
13
  };
14
- /** Fill colors for FGCA/DGCA notation columns. */
14
+ /**
15
+ * Amber/orange "author emphasis" accents, theme-adjusted for contrast against
16
+ * each theme's background (dark theme gets the brand hues lightened per
17
+ * `brand/transitrix_brand.md` §Themes: "brand colours slightly desaturated
18
+ * for contrast on dark surfaces"). `orangeTint` is the light emphasis-fill
19
+ * paired with an `orange` stroke (e.g. Activities critical-path nodes).
20
+ * `hc` intentionally falls back to the plain BRAND hex — VS Code
21
+ * high-contrast mode prioritises accessibility overrides over brand fidelity.
22
+ */
23
+ export declare const BRAND_EMPHASIS: {
24
+ readonly amber: {
25
+ readonly light: "#ffaf00";
26
+ readonly dark: "#ffc83d";
27
+ readonly hc: "#ffaf00";
28
+ };
29
+ readonly orange: {
30
+ readonly light: "#ff4d00";
31
+ readonly dark: "#ff7542";
32
+ readonly hc: "#ff4d00";
33
+ };
34
+ readonly orangeTint: {
35
+ readonly light: "#ffeee5";
36
+ readonly dark: "#432114";
37
+ readonly hc: "#ffeee5";
38
+ };
39
+ };
40
+ /**
41
+ * Fill colors for FGCA/DGCA notation columns — a petrol tint per stage
42
+ * (Driver → Goal → Change → Activity), deepening left to right like the
43
+ * Goals-tree level ladder below. Petrol tint = structural position, never a
44
+ * hue switch, per the brand's "structure via petrol" role mapping.
45
+ */
15
46
  export declare const LAYER_COLORS: {
16
47
  readonly driver: {
17
- readonly light: "#fef3c7";
18
- readonly dark: "#292108";
48
+ readonly light: "#eaf3f6";
49
+ readonly dark: "#17262c";
19
50
  readonly hc: "#f59e0b";
20
51
  };
21
52
  readonly factor: {
22
- readonly light: "#fef3c7";
23
- readonly dark: "#292108";
53
+ readonly light: "#eaf3f6";
54
+ readonly dark: "#17262c";
24
55
  readonly hc: "#f59e0b";
25
56
  };
26
57
  readonly goal: {
27
- readonly light: "#e0e7ff";
28
- readonly dark: "#1e1b4b";
58
+ readonly light: "#d9ecf2";
59
+ readonly dark: "#192f37";
29
60
  readonly hc: "#818cf8";
30
61
  };
31
62
  readonly change: {
32
- readonly light: "#dbeafe";
33
- readonly dark: "#0c2042";
63
+ readonly light: "#c7e5ef";
64
+ readonly dark: "#1a3842";
34
65
  readonly hc: "#60a5fa";
35
66
  };
36
67
  readonly activity: {
37
- readonly light: "#d4edda";
38
- readonly dark: "#0a2414";
68
+ readonly light: "#b4e0ee";
69
+ readonly dark: "#1a414e";
39
70
  readonly hc: "#4ade80";
40
71
  };
41
72
  };
42
- /** Level fill colors for Goals tree nodes — 8 slots, cycled by level index. */
73
+ /**
74
+ * Level fill colors for Goals tree nodes — 8 slots, cycled by level index.
75
+ * A single-hue petrol tint ramp (level-0 lightest/root → level-7 deepest);
76
+ * hue never switches with depth. Saturation/lightness tuned so text-primary
77
+ * and text-secondary keep at least their pre-brand contrast ratio against
78
+ * every slot — see `theme/__tests__/tokens.test.ts`.
79
+ */
43
80
  export declare const LEVEL_COLORS: {
44
- readonly light: readonly ["#dbeafe", "#e0e7ff", "#d4edda", "#fef3c7", "#fce7f3", "#e0f2fe", "#f3e8ff", "#fef9c3"];
45
- readonly dark: readonly ["#0c2042", "#1e1b4b", "#0a2414", "#292108", "#2a0c1f", "#071e2e", "#1a0c33", "#2a2107"];
81
+ readonly light: readonly ["#eef4f7", "#e6f1f4", "#dfedf1", "#d7e9ef", "#cee6ed", "#c6e2ec", "#bfe0eb", "#b7deeb"];
82
+ readonly dark: readonly ["#152328", "#16292f", "#172e36", "#18333d", "#183944", "#183f4c", "#184554", "#174b5c"];
46
83
  readonly hc: readonly ["#60a5fa", "#818cf8", "#4ade80", "#f59e0b", "#f472b6", "#38bdf8", "#a78bfa", "#facc15"];
47
84
  };
48
- /** Structural diagram colors (nodes, edges, text). */
85
+ /**
86
+ * Structural diagram colors (nodes, edges, text). nodeStroke/edgeStroke are
87
+ * brand petrol — "structure via petrol" per the brand's role mapping.
88
+ * textPrimary is a dark petrol ink (light theme) / near-white petrol-tinted
89
+ * (dark theme); textSecondary stays a muted grey with a faint petrol lean.
90
+ * `hc` is untouched — VS Code high-contrast accessibility overrides win over
91
+ * brand fidelity there.
92
+ */
49
93
  export declare const STRUCTURAL: {
50
94
  readonly nodeStroke: {
51
- readonly light: "#94a3b8";
52
- readonly dark: "#475569";
95
+ readonly light: "#004d67";
96
+ readonly dark: "#53a9c6";
53
97
  readonly hc: "#e2e8f0";
54
98
  };
55
99
  readonly edgeStroke: {
56
- readonly light: "#94a3b8";
57
- readonly dark: "#475569";
100
+ readonly light: "#004d67";
101
+ readonly dark: "#53a9c6";
58
102
  readonly hc: "#e2e8f0";
59
103
  };
60
104
  readonly textPrimary: {
61
- readonly light: "#1e293b";
62
- readonly dark: "#f1f5f9";
105
+ readonly light: "#0d2b35";
106
+ readonly dark: "#edf5f8";
63
107
  readonly hc: "#ffffff";
64
108
  };
65
109
  readonly textSecondary: {
66
- readonly light: "#64748b";
67
- readonly dark: "#94a3b8";
110
+ readonly light: "#516970";
111
+ readonly dark: "#adc8d1";
68
112
  readonly hc: "#cbd5e1";
69
113
  };
70
114
  readonly headerText: {
71
- readonly light: "#374151";
72
- readonly dark: "#e5e7eb";
115
+ readonly light: "#0d2b35";
116
+ readonly dark: "#edf5f8";
73
117
  readonly hc: "#ffffff";
74
118
  };
75
119
  };
76
120
  /**
77
- * Maturity scale fill colors — Likert 1..5, danger→success.
121
+ * Maturity scale fill colors — Likert 1..5, danger→success. A single
122
+ * harmonious ramp: consistent saturation curve, hue stepping smoothly
123
+ * red→orange→gold→yellow-green→green (never jumping registers the way the
124
+ * previous per-theme picks did), tuned so the badge's hardcoded white label
125
+ * text (`.maturity-pill`, capability-map-preview.ts) stays ≥4.5:1 AA at
126
+ * every step. Same ramp for light/dark — these are small solid badges, not
127
+ * background tints, so theme brightness doesn't change the contrast need.
128
+ * `hc` pushes the same hues darker/more saturated for AAA (≥7:1), since VS
129
+ * Code high-contrast mode exists specifically to demand stronger contrast.
78
130
  * Used by Capability Map and any future maturity-based notation.
79
131
  */
80
132
  export declare const MATURITY_COLORS: {
81
- readonly light: readonly ["#b91c1c", "#d97706", "#ca8a04", "#65a30d", "#15803d"];
82
- readonly dark: readonly ["#7f1d1d", "#92400e", "#854d0e", "#3f6212", "#14532d"];
83
- readonly hc: readonly ["#f87171", "#fb923c", "#facc15", "#a3e635", "#4ade80"];
133
+ readonly light: readonly ["#bf2518", "#b05911", "#8d7011", "#407d21", "#237b48"];
134
+ readonly dark: readonly ["#bf2518", "#b05911", "#8d7011", "#407d21", "#237b48"];
135
+ readonly hc: readonly ["#a0190d", "#864109", "#5a4607", "#316317", "#155630"];
84
136
  };
85
137
  /**
86
- * DSM-matching capability tree node fill colors, grouped by depth band.
87
- * band0: depth 0–2 (pink)
88
- * band1: depth 3–4 (yellow)
89
- * band2: depth 5+ (blue)
138
+ * Capability tree node fill colors, grouped by depth band — a 3-step petrol
139
+ * tint (shallow → deep), same "petrol tint = structural depth" rule as
140
+ * LEVEL_COLORS above. Previously a DSM-matching pink/yellow/blue scheme;
141
+ * brand/transitrix_brand.md ("Components") anticipates DSM adopting the same
142
+ * shared color tokens, so Studio moving first is convergence, not drift.
143
+ * band0: depth 0–2 (shallowest)
144
+ * band1: depth 3–4
145
+ * band2: depth 5+ (deepest)
90
146
  */
91
147
  export declare const TREE_LEVEL_COLORS: {
92
148
  readonly band0: {
93
- readonly light: "#fee0e0";
94
- readonly dark: "#3d0f0f";
149
+ readonly light: "#e6f1f4";
150
+ readonly dark: "#152b32";
95
151
  readonly hc: "#ff9999";
96
152
  };
97
153
  readonly band1: {
98
- readonly light: "#ffffcb";
99
- readonly dark: "#3a3500";
154
+ readonly light: "#d0e9f1";
155
+ readonly dark: "#153b47";
100
156
  readonly hc: "#ffff88";
101
157
  };
102
158
  readonly band2: {
103
- readonly light: "#c2f0ff";
104
- readonly dark: "#003d4d";
159
+ readonly light: "#b5e3f2";
160
+ readonly dark: "#114c5f";
105
161
  readonly hc: "#66ccff";
106
162
  };
107
163
  };
108
164
  /**
109
- * DSM-matching maturity badge fills for the capability tree (L1–L5).
110
- * Distinct from MATURITY_COLORS which drives the cards / compliance views.
165
+ * Maturity badge fills for the capability tree (L1–L5). Same ramp as
166
+ * MATURITY_COLORS — previously a separate DSM-matching pink/yellow/blue set
167
+ * that didn't even share L1's meaning (grey = lowest maturity, an odd
168
+ * "no signal" hue for the worst rating) and had white-label contrast as low
169
+ * as 1.07:1 in `hc`. One harmonious Likert ramp for "maturity" everywhere.
111
170
  */
112
171
  export declare const TREE_MATURITY_COLORS: {
113
- readonly light: readonly ["#c1c1c1", "#ff3d67", "#ff9a59", "#fdef59", "#83cca3"];
114
- readonly dark: readonly ["#555555", "#cc1040", "#d06020", "#c8c000", "#4d9970"];
115
- readonly hc: readonly ["#cccccc", "#ff6699", "#ffbb77", "#ffff44", "#88ddaa"];
172
+ readonly light: readonly ["#bf2518", "#b05911", "#8d7011", "#407d21", "#237b48"];
173
+ readonly dark: readonly ["#bf2518", "#b05911", "#8d7011", "#407d21", "#237b48"];
174
+ readonly hc: readonly ["#a0190d", "#864109", "#5a4607", "#316317", "#155630"];
116
175
  };
117
176
  /**
118
177
  * Typography hierarchy. All previews resolve text styling from these roles
@@ -200,5 +259,8 @@ export declare const CSS_VAR: {
200
259
  readonly treeMaturity3: "--ts-tree-maturity-3";
201
260
  readonly treeMaturity4: "--ts-tree-maturity-4";
202
261
  readonly treeMaturity5: "--ts-tree-maturity-5";
262
+ readonly brandAmber: "--ts-brand-amber";
263
+ readonly brandOrange: "--ts-brand-orange";
264
+ readonly brandOrangeTint: "--ts-brand-orange-tint";
203
265
  };
204
266
  export declare function getBaseResetCss(): string;
@@ -1,4 +1,4 @@
1
- /** Transitrix brand palette. */
1
+ /** Transitrix brand palette (`brand/transitrix_brand.md` — canonical). */
2
2
  export const BRAND = {
3
3
  petrol: '#004d67',
4
4
  amber: '#ffaf00',
@@ -11,56 +11,103 @@ export const FUNCTIONAL = {
11
11
  error: '#b91c1c',
12
12
  info: '#1d6fa8',
13
13
  };
14
- /** Fill colors for FGCA/DGCA notation columns. */
14
+ /**
15
+ * Amber/orange "author emphasis" accents, theme-adjusted for contrast against
16
+ * each theme's background (dark theme gets the brand hues lightened per
17
+ * `brand/transitrix_brand.md` §Themes: "brand colours slightly desaturated
18
+ * for contrast on dark surfaces"). `orangeTint` is the light emphasis-fill
19
+ * paired with an `orange` stroke (e.g. Activities critical-path nodes).
20
+ * `hc` intentionally falls back to the plain BRAND hex — VS Code
21
+ * high-contrast mode prioritises accessibility overrides over brand fidelity.
22
+ */
23
+ export const BRAND_EMPHASIS = {
24
+ amber: { light: BRAND.amber, dark: '#ffc83d', hc: BRAND.amber },
25
+ orange: { light: BRAND.orange, dark: '#ff7542', hc: BRAND.orange },
26
+ orangeTint: { light: '#ffeee5', dark: '#432114', hc: '#ffeee5' },
27
+ };
28
+ /**
29
+ * Fill colors for FGCA/DGCA notation columns — a petrol tint per stage
30
+ * (Driver → Goal → Change → Activity), deepening left to right like the
31
+ * Goals-tree level ladder below. Petrol tint = structural position, never a
32
+ * hue switch, per the brand's "structure via petrol" role mapping.
33
+ */
15
34
  export const LAYER_COLORS = {
16
- driver: { light: '#fef3c7', dark: '#292108', hc: '#f59e0b' },
17
- factor: { light: '#fef3c7', dark: '#292108', hc: '#f59e0b' },
18
- goal: { light: '#e0e7ff', dark: '#1e1b4b', hc: '#818cf8' },
19
- change: { light: '#dbeafe', dark: '#0c2042', hc: '#60a5fa' },
20
- activity: { light: '#d4edda', dark: '#0a2414', hc: '#4ade80' },
35
+ driver: { light: '#eaf3f6', dark: '#17262c', hc: '#f59e0b' },
36
+ factor: { light: '#eaf3f6', dark: '#17262c', hc: '#f59e0b' },
37
+ goal: { light: '#d9ecf2', dark: '#192f37', hc: '#818cf8' },
38
+ change: { light: '#c7e5ef', dark: '#1a3842', hc: '#60a5fa' },
39
+ activity: { light: '#b4e0ee', dark: '#1a414e', hc: '#4ade80' },
21
40
  };
22
- /** Level fill colors for Goals tree nodes — 8 slots, cycled by level index. */
41
+ /**
42
+ * Level fill colors for Goals tree nodes — 8 slots, cycled by level index.
43
+ * A single-hue petrol tint ramp (level-0 lightest/root → level-7 deepest);
44
+ * hue never switches with depth. Saturation/lightness tuned so text-primary
45
+ * and text-secondary keep at least their pre-brand contrast ratio against
46
+ * every slot — see `theme/__tests__/tokens.test.ts`.
47
+ */
23
48
  export const LEVEL_COLORS = {
24
- light: ['#dbeafe', '#e0e7ff', '#d4edda', '#fef3c7', '#fce7f3', '#e0f2fe', '#f3e8ff', '#fef9c3'],
25
- dark: ['#0c2042', '#1e1b4b', '#0a2414', '#292108', '#2a0c1f', '#071e2e', '#1a0c33', '#2a2107'],
49
+ light: ['#eef4f7', '#e6f1f4', '#dfedf1', '#d7e9ef', '#cee6ed', '#c6e2ec', '#bfe0eb', '#b7deeb'],
50
+ dark: ['#152328', '#16292f', '#172e36', '#18333d', '#183944', '#183f4c', '#184554', '#174b5c'],
26
51
  hc: ['#60a5fa', '#818cf8', '#4ade80', '#f59e0b', '#f472b6', '#38bdf8', '#a78bfa', '#facc15'],
27
52
  };
28
- /** Structural diagram colors (nodes, edges, text). */
53
+ /**
54
+ * Structural diagram colors (nodes, edges, text). nodeStroke/edgeStroke are
55
+ * brand petrol — "structure via petrol" per the brand's role mapping.
56
+ * textPrimary is a dark petrol ink (light theme) / near-white petrol-tinted
57
+ * (dark theme); textSecondary stays a muted grey with a faint petrol lean.
58
+ * `hc` is untouched — VS Code high-contrast accessibility overrides win over
59
+ * brand fidelity there.
60
+ */
29
61
  export const STRUCTURAL = {
30
- nodeStroke: { light: '#94a3b8', dark: '#475569', hc: '#e2e8f0' },
31
- edgeStroke: { light: '#94a3b8', dark: '#475569', hc: '#e2e8f0' },
32
- textPrimary: { light: '#1e293b', dark: '#f1f5f9', hc: '#ffffff' },
33
- textSecondary: { light: '#64748b', dark: '#94a3b8', hc: '#cbd5e1' },
34
- headerText: { light: '#374151', dark: '#e5e7eb', hc: '#ffffff' },
62
+ nodeStroke: { light: BRAND.petrol, dark: '#53a9c6', hc: '#e2e8f0' },
63
+ edgeStroke: { light: BRAND.petrol, dark: '#53a9c6', hc: '#e2e8f0' },
64
+ textPrimary: { light: '#0d2b35', dark: '#edf5f8', hc: '#ffffff' },
65
+ textSecondary: { light: '#516970', dark: '#adc8d1', hc: '#cbd5e1' },
66
+ headerText: { light: '#0d2b35', dark: '#edf5f8', hc: '#ffffff' },
35
67
  };
36
68
  /**
37
- * Maturity scale fill colors — Likert 1..5, danger→success.
69
+ * Maturity scale fill colors — Likert 1..5, danger→success. A single
70
+ * harmonious ramp: consistent saturation curve, hue stepping smoothly
71
+ * red→orange→gold→yellow-green→green (never jumping registers the way the
72
+ * previous per-theme picks did), tuned so the badge's hardcoded white label
73
+ * text (`.maturity-pill`, capability-map-preview.ts) stays ≥4.5:1 AA at
74
+ * every step. Same ramp for light/dark — these are small solid badges, not
75
+ * background tints, so theme brightness doesn't change the contrast need.
76
+ * `hc` pushes the same hues darker/more saturated for AAA (≥7:1), since VS
77
+ * Code high-contrast mode exists specifically to demand stronger contrast.
38
78
  * Used by Capability Map and any future maturity-based notation.
39
79
  */
40
80
  export const MATURITY_COLORS = {
41
- light: ['#b91c1c', '#d97706', '#ca8a04', '#65a30d', '#15803d'],
42
- dark: ['#7f1d1d', '#92400e', '#854d0e', '#3f6212', '#14532d'],
43
- hc: ['#f87171', '#fb923c', '#facc15', '#a3e635', '#4ade80'],
81
+ light: ['#bf2518', '#b05911', '#8d7011', '#407d21', '#237b48'],
82
+ dark: ['#bf2518', '#b05911', '#8d7011', '#407d21', '#237b48'],
83
+ hc: ['#a0190d', '#864109', '#5a4607', '#316317', '#155630'],
44
84
  };
45
85
  /**
46
- * DSM-matching capability tree node fill colors, grouped by depth band.
47
- * band0: depth 0–2 (pink)
48
- * band1: depth 3–4 (yellow)
49
- * band2: depth 5+ (blue)
86
+ * Capability tree node fill colors, grouped by depth band — a 3-step petrol
87
+ * tint (shallow → deep), same "petrol tint = structural depth" rule as
88
+ * LEVEL_COLORS above. Previously a DSM-matching pink/yellow/blue scheme;
89
+ * brand/transitrix_brand.md ("Components") anticipates DSM adopting the same
90
+ * shared color tokens, so Studio moving first is convergence, not drift.
91
+ * band0: depth 0–2 (shallowest)
92
+ * band1: depth 3–4
93
+ * band2: depth 5+ (deepest)
50
94
  */
51
95
  export const TREE_LEVEL_COLORS = {
52
- band0: { light: '#fee0e0', dark: '#3d0f0f', hc: '#ff9999' },
53
- band1: { light: '#ffffcb', dark: '#3a3500', hc: '#ffff88' },
54
- band2: { light: '#c2f0ff', dark: '#003d4d', hc: '#66ccff' },
96
+ band0: { light: '#e6f1f4', dark: '#152b32', hc: '#ff9999' },
97
+ band1: { light: '#d0e9f1', dark: '#153b47', hc: '#ffff88' },
98
+ band2: { light: '#b5e3f2', dark: '#114c5f', hc: '#66ccff' },
55
99
  };
56
100
  /**
57
- * DSM-matching maturity badge fills for the capability tree (L1–L5).
58
- * Distinct from MATURITY_COLORS which drives the cards / compliance views.
101
+ * Maturity badge fills for the capability tree (L1–L5). Same ramp as
102
+ * MATURITY_COLORS — previously a separate DSM-matching pink/yellow/blue set
103
+ * that didn't even share L1's meaning (grey = lowest maturity, an odd
104
+ * "no signal" hue for the worst rating) and had white-label contrast as low
105
+ * as 1.07:1 in `hc`. One harmonious Likert ramp for "maturity" everywhere.
59
106
  */
60
107
  export const TREE_MATURITY_COLORS = {
61
- light: ['#c1c1c1', '#ff3d67', '#ff9a59', '#fdef59', '#83cca3'],
62
- dark: ['#555555', '#cc1040', '#d06020', '#c8c000', '#4d9970'],
63
- hc: ['#cccccc', '#ff6699', '#ffbb77', '#ffff44', '#88ddaa'],
108
+ light: MATURITY_COLORS.light,
109
+ dark: MATURITY_COLORS.dark,
110
+ hc: MATURITY_COLORS.hc,
64
111
  };
65
112
  /**
66
113
  * Typography hierarchy. All previews resolve text styling from these roles
@@ -129,6 +176,9 @@ export const CSS_VAR = {
129
176
  treeMaturity3: '--ts-tree-maturity-3',
130
177
  treeMaturity4: '--ts-tree-maturity-4',
131
178
  treeMaturity5: '--ts-tree-maturity-5',
179
+ brandAmber: '--ts-brand-amber',
180
+ brandOrange: '--ts-brand-orange',
181
+ brandOrangeTint: '--ts-brand-orange-tint',
132
182
  };
133
183
  export function getBaseResetCss() {
134
184
  return `*,*:before,*:after{box-sizing:border-box;}html,body{margin:0;padding:0;}`;