@transitrix/diagrams 1.8.2 → 1.8.4
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/dist/blocks/layout.js +1 -1
- package/dist/capability-map/render-capability-tree.js +2 -2
- package/dist/theme/__tests__/tokens.test.d.ts +1 -0
- package/dist/theme/__tests__/tokens.test.js +159 -0
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/themes.js +4 -1
- package/dist/theme/tokens.d.ts +107 -45
- package/dist/theme/tokens.js +82 -32
- package/dist/webview/__tests__/entity-text-layout.test.js +96 -1
- package/dist/webview/entity-text-layout.d.ts +31 -3
- package/dist/webview/entity-text-layout.js +123 -55
- package/dist/webview/render-activities.d.ts +1 -1
- package/dist/webview/render-activities.js +2 -2
- package/dist/webview/render-process.d.ts +1 -1
- package/dist/webview/render-process.js +20 -20
- package/package.json +1 -1
- package/src/blocks/layout.ts +1 -1
- package/src/capability-map/render-capability-tree.ts +2 -2
- package/src/theme/__tests__/tokens.test.ts +185 -0
- package/src/theme/index.ts +1 -1
- package/src/theme/themes.ts +4 -0
- package/src/theme/tokens.ts +83 -32
- package/src/webview/__tests__/entity-text-layout.test.ts +109 -0
- package/src/webview/entity-text-layout.ts +140 -54
- package/src/webview/render-activities.ts +2 -2
- package/src/webview/render-process.ts +20 -20
package/dist/blocks/layout.js
CHANGED
|
@@ -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,#
|
|
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,#
|
|
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}">
|
|
@@ -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
|
+
});
|
package/dist/theme/index.d.ts
CHANGED
|
@@ -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';
|
package/dist/theme/index.js
CHANGED
|
@@ -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';
|
package/dist/theme/themes.js
CHANGED
|
@@ -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). */
|
package/dist/theme/tokens.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
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: "#
|
|
18
|
-
readonly dark: "#
|
|
48
|
+
readonly light: "#eaf3f6";
|
|
49
|
+
readonly dark: "#17262c";
|
|
19
50
|
readonly hc: "#f59e0b";
|
|
20
51
|
};
|
|
21
52
|
readonly factor: {
|
|
22
|
-
readonly light: "#
|
|
23
|
-
readonly dark: "#
|
|
53
|
+
readonly light: "#eaf3f6";
|
|
54
|
+
readonly dark: "#17262c";
|
|
24
55
|
readonly hc: "#f59e0b";
|
|
25
56
|
};
|
|
26
57
|
readonly goal: {
|
|
27
|
-
readonly light: "#
|
|
28
|
-
readonly dark: "#
|
|
58
|
+
readonly light: "#d9ecf2";
|
|
59
|
+
readonly dark: "#192f37";
|
|
29
60
|
readonly hc: "#818cf8";
|
|
30
61
|
};
|
|
31
62
|
readonly change: {
|
|
32
|
-
readonly light: "#
|
|
33
|
-
readonly dark: "#
|
|
63
|
+
readonly light: "#c7e5ef";
|
|
64
|
+
readonly dark: "#1a3842";
|
|
34
65
|
readonly hc: "#60a5fa";
|
|
35
66
|
};
|
|
36
67
|
readonly activity: {
|
|
37
|
-
readonly light: "#
|
|
38
|
-
readonly dark: "#
|
|
68
|
+
readonly light: "#b4e0ee";
|
|
69
|
+
readonly dark: "#1a414e";
|
|
39
70
|
readonly hc: "#4ade80";
|
|
40
71
|
};
|
|
41
72
|
};
|
|
42
|
-
/**
|
|
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 ["#
|
|
45
|
-
readonly dark: readonly ["#
|
|
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
|
-
/**
|
|
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: "#
|
|
52
|
-
readonly dark: "#
|
|
95
|
+
readonly light: "#004d67";
|
|
96
|
+
readonly dark: "#53a9c6";
|
|
53
97
|
readonly hc: "#e2e8f0";
|
|
54
98
|
};
|
|
55
99
|
readonly edgeStroke: {
|
|
56
|
-
readonly light: "#
|
|
57
|
-
readonly dark: "#
|
|
100
|
+
readonly light: "#004d67";
|
|
101
|
+
readonly dark: "#53a9c6";
|
|
58
102
|
readonly hc: "#e2e8f0";
|
|
59
103
|
};
|
|
60
104
|
readonly textPrimary: {
|
|
61
|
-
readonly light: "#
|
|
62
|
-
readonly dark: "#
|
|
105
|
+
readonly light: "#0d2b35";
|
|
106
|
+
readonly dark: "#edf5f8";
|
|
63
107
|
readonly hc: "#ffffff";
|
|
64
108
|
};
|
|
65
109
|
readonly textSecondary: {
|
|
66
|
-
readonly light: "#
|
|
67
|
-
readonly dark: "#
|
|
110
|
+
readonly light: "#516970";
|
|
111
|
+
readonly dark: "#adc8d1";
|
|
68
112
|
readonly hc: "#cbd5e1";
|
|
69
113
|
};
|
|
70
114
|
readonly headerText: {
|
|
71
|
-
readonly light: "#
|
|
72
|
-
readonly dark: "#
|
|
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 ["#
|
|
82
|
-
readonly dark: readonly ["#
|
|
83
|
-
readonly hc: readonly ["#
|
|
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
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
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: "#
|
|
94
|
-
readonly dark: "#
|
|
149
|
+
readonly light: "#e6f1f4";
|
|
150
|
+
readonly dark: "#152b32";
|
|
95
151
|
readonly hc: "#ff9999";
|
|
96
152
|
};
|
|
97
153
|
readonly band1: {
|
|
98
|
-
readonly light: "#
|
|
99
|
-
readonly dark: "#
|
|
154
|
+
readonly light: "#d0e9f1";
|
|
155
|
+
readonly dark: "#153b47";
|
|
100
156
|
readonly hc: "#ffff88";
|
|
101
157
|
};
|
|
102
158
|
readonly band2: {
|
|
103
|
-
readonly light: "#
|
|
104
|
-
readonly dark: "#
|
|
159
|
+
readonly light: "#b5e3f2";
|
|
160
|
+
readonly dark: "#114c5f";
|
|
105
161
|
readonly hc: "#66ccff";
|
|
106
162
|
};
|
|
107
163
|
};
|
|
108
164
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
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 ["#
|
|
114
|
-
readonly dark: readonly ["#
|
|
115
|
-
readonly hc: readonly ["#
|
|
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;
|
package/dist/theme/tokens.js
CHANGED
|
@@ -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
|
-
/**
|
|
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: '#
|
|
17
|
-
factor: { light: '#
|
|
18
|
-
goal: { light: '#
|
|
19
|
-
change: { light: '#
|
|
20
|
-
activity: { light: '#
|
|
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
|
-
/**
|
|
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: ['#
|
|
25
|
-
dark: ['#
|
|
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
|
-
/**
|
|
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:
|
|
31
|
-
edgeStroke: { light:
|
|
32
|
-
textPrimary: { light: '#
|
|
33
|
-
textSecondary: { light: '#
|
|
34
|
-
headerText: { light: '#
|
|
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: ['#
|
|
42
|
-
dark: ['#
|
|
43
|
-
hc: ['#
|
|
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
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
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: '#
|
|
53
|
-
band1: { light: '#
|
|
54
|
-
band2: { light: '#
|
|
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
|
-
*
|
|
58
|
-
*
|
|
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:
|
|
62
|
-
dark:
|
|
63
|
-
hc:
|
|
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;}`;
|