@transitrix/diagrams 1.8.4 → 1.8.7

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.
Files changed (254) hide show
  1. package/dist/edge-path.js +10 -1
  2. package/dist/webview/render-activities.d.ts +1 -1
  3. package/dist/webview/render-activities.js +2 -2
  4. package/dist/webview/render-fgca.js +1 -4
  5. package/package.json +7 -2
  6. package/src/edge-path.ts +15 -1
  7. package/src/webview/render-activities.ts +2 -2
  8. package/src/webview/render-fgca.ts +1 -4
  9. package/dist/__tests__/edge-path.test.d.ts +0 -1
  10. package/dist/__tests__/edge-path.test.js +0 -47
  11. package/dist/__tests__/node-size-presets.test.d.ts +0 -1
  12. package/dist/__tests__/node-size-presets.test.js +0 -30
  13. package/dist/__tests__/scope.test.d.ts +0 -1
  14. package/dist/__tests__/scope.test.js +0 -23
  15. package/dist/__tests__/yaml-normalize.test.d.ts +0 -1
  16. package/dist/__tests__/yaml-normalize.test.js +0 -148
  17. package/dist/activities/__tests__/cpm.test.d.ts +0 -1
  18. package/dist/activities/__tests__/cpm.test.js +0 -146
  19. package/dist/activities/__tests__/gantt.test.d.ts +0 -1
  20. package/dist/activities/__tests__/gantt.test.js +0 -263
  21. package/dist/activities/__tests__/layout.test.d.ts +0 -1
  22. package/dist/activities/__tests__/layout.test.js +0 -98
  23. package/dist/activities/__tests__/validate.test.d.ts +0 -1
  24. package/dist/activities/__tests__/validate.test.js +0 -397
  25. package/dist/activity-card/__tests__/example.test.d.ts +0 -1
  26. package/dist/activity-card/__tests__/example.test.js +0 -73
  27. package/dist/activity-card/__tests__/layout.test.d.ts +0 -1
  28. package/dist/activity-card/__tests__/layout.test.js +0 -141
  29. package/dist/activity-card/__tests__/resolver.test.d.ts +0 -1
  30. package/dist/activity-card/__tests__/resolver.test.js +0 -325
  31. package/dist/activity-card/__tests__/validate.test.d.ts +0 -1
  32. package/dist/activity-card/__tests__/validate.test.js +0 -149
  33. package/dist/actor/__tests__/validate.test.d.ts +0 -1
  34. package/dist/actor/__tests__/validate.test.js +0 -95
  35. package/dist/applications/__tests__/validate.test.d.ts +0 -1
  36. package/dist/applications/__tests__/validate.test.js +0 -223
  37. package/dist/assertion/__tests__/example.test.d.ts +0 -1
  38. package/dist/assertion/__tests__/example.test.js +0 -32
  39. package/dist/assertion/__tests__/validate.test.d.ts +0 -1
  40. package/dist/assertion/__tests__/validate.test.js +0 -130
  41. package/dist/blocks/__tests__/layout.test.d.ts +0 -1
  42. package/dist/blocks/__tests__/layout.test.js +0 -153
  43. package/dist/blocks/__tests__/validate.test.d.ts +0 -1
  44. package/dist/blocks/__tests__/validate.test.js +0 -235
  45. package/dist/business-service/__tests__/validate.test.d.ts +0 -1
  46. package/dist/business-service/__tests__/validate.test.js +0 -135
  47. package/dist/capability-map/__tests__/CapabilityMapView.test.d.ts +0 -1
  48. package/dist/capability-map/__tests__/CapabilityMapView.test.js +0 -217
  49. package/dist/capability-map/__tests__/address.test.d.ts +0 -1
  50. package/dist/capability-map/__tests__/address.test.js +0 -49
  51. package/dist/capability-map/__tests__/dsm-layout.test.d.ts +0 -1
  52. package/dist/capability-map/__tests__/dsm-layout.test.js +0 -46
  53. package/dist/capability-map/__tests__/dsm-mutations.test.d.ts +0 -1
  54. package/dist/capability-map/__tests__/dsm-mutations.test.js +0 -125
  55. package/dist/capability-map/__tests__/dsm-validate.test.d.ts +0 -1
  56. package/dist/capability-map/__tests__/dsm-validate.test.js +0 -56
  57. package/dist/capability-map/__tests__/validate.test.d.ts +0 -1
  58. package/dist/capability-map/__tests__/validate.test.js +0 -212
  59. package/dist/change/__tests__/validate.test.d.ts +0 -1
  60. package/dist/change/__tests__/validate.test.js +0 -79
  61. package/dist/codex/__tests__/example.test.d.ts +0 -1
  62. package/dist/codex/__tests__/example.test.js +0 -33
  63. package/dist/codex/__tests__/validate.test.d.ts +0 -1
  64. package/dist/codex/__tests__/validate.test.js +0 -68
  65. package/dist/compliance/__tests__/canon-catalog.test.d.ts +0 -1
  66. package/dist/compliance/__tests__/canon-catalog.test.js +0 -60
  67. package/dist/compliance/__tests__/classify.test.d.ts +0 -1
  68. package/dist/compliance/__tests__/classify.test.js +0 -58
  69. package/dist/compliance/__tests__/confidence.test.d.ts +0 -1
  70. package/dist/compliance/__tests__/confidence.test.js +0 -78
  71. package/dist/compliance/__tests__/coverage-metric.test.d.ts +0 -1
  72. package/dist/compliance/__tests__/coverage-metric.test.js +0 -264
  73. package/dist/compliance/__tests__/demo-scenario.test.d.ts +0 -1
  74. package/dist/compliance/__tests__/demo-scenario.test.js +0 -226
  75. package/dist/compliance/__tests__/example.test.d.ts +0 -1
  76. package/dist/compliance/__tests__/example.test.js +0 -51
  77. package/dist/compliance/__tests__/gap-report.test.d.ts +0 -1
  78. package/dist/compliance/__tests__/gap-report.test.js +0 -113
  79. package/dist/compliance/__tests__/html.test.d.ts +0 -1
  80. package/dist/compliance/__tests__/html.test.js +0 -122
  81. package/dist/compliance/__tests__/impact.test.d.ts +0 -1
  82. package/dist/compliance/__tests__/impact.test.js +0 -913
  83. package/dist/compliance/__tests__/markdown.test.d.ts +0 -1
  84. package/dist/compliance/__tests__/markdown.test.js +0 -85
  85. package/dist/compliance/__tests__/trace.test.d.ts +0 -1
  86. package/dist/compliance/__tests__/trace.test.js +0 -144
  87. package/dist/compliance/__tests__/view-resolution.test.d.ts +0 -1
  88. package/dist/compliance/__tests__/view-resolution.test.js +0 -59
  89. package/dist/compliance/__tests__/views.test.d.ts +0 -1
  90. package/dist/compliance/__tests__/views.test.js +0 -59
  91. package/dist/compliance-matrix/__tests__/build.test.d.ts +0 -1
  92. package/dist/compliance-matrix/__tests__/build.test.js +0 -183
  93. package/dist/compliance-matrix/__tests__/example.test.d.ts +0 -1
  94. package/dist/compliance-matrix/__tests__/example.test.js +0 -49
  95. package/dist/confidence/__tests__/score.test.d.ts +0 -1
  96. package/dist/confidence/__tests__/score.test.js +0 -188
  97. package/dist/constraint/__tests__/example.test.d.ts +0 -1
  98. package/dist/constraint/__tests__/example.test.js +0 -14
  99. package/dist/constraint/__tests__/validate.test.d.ts +0 -1
  100. package/dist/constraint/__tests__/validate.test.js +0 -58
  101. package/dist/factor/__tests__/validate.test.d.ts +0 -1
  102. package/dist/factor/__tests__/validate.test.js +0 -112
  103. package/dist/fgca/__tests__/chain-table.test.d.ts +0 -1
  104. package/dist/fgca/__tests__/chain-table.test.js +0 -158
  105. package/dist/fgca/__tests__/layout.test.d.ts +0 -1
  106. package/dist/fgca/__tests__/layout.test.js +0 -140
  107. package/dist/fgca/__tests__/parse-canonical.test.d.ts +0 -1
  108. package/dist/fgca/__tests__/parse-canonical.test.js +0 -268
  109. package/dist/fgca/__tests__/preview-layout.test.d.ts +0 -1
  110. package/dist/fgca/__tests__/preview-layout.test.js +0 -106
  111. package/dist/fgca/__tests__/resolver.test.d.ts +0 -1
  112. package/dist/fgca/__tests__/resolver.test.js +0 -185
  113. package/dist/fgca/__tests__/validate.test.d.ts +0 -1
  114. package/dist/fgca/__tests__/validate.test.js +0 -125
  115. package/dist/goals/__tests__/GoalTreeView.test.d.ts +0 -1
  116. package/dist/goals/__tests__/GoalTreeView.test.js +0 -337
  117. package/dist/goals/__tests__/layout.test.d.ts +0 -1
  118. package/dist/goals/__tests__/layout.test.js +0 -153
  119. package/dist/goals/__tests__/mutations.test.d.ts +0 -1
  120. package/dist/goals/__tests__/mutations.test.js +0 -134
  121. package/dist/goals/__tests__/parse-canonical.test.d.ts +0 -1
  122. package/dist/goals/__tests__/parse-canonical.test.js +0 -131
  123. package/dist/goals/__tests__/validate.test.d.ts +0 -1
  124. package/dist/goals/__tests__/validate.test.js +0 -183
  125. package/dist/integration/__tests__/validate.test.d.ts +0 -1
  126. package/dist/integration/__tests__/validate.test.js +0 -169
  127. package/dist/location/__tests__/validate.test.d.ts +0 -1
  128. package/dist/location/__tests__/validate.test.js +0 -107
  129. package/dist/node/__tests__/validate.test.d.ts +0 -1
  130. package/dist/node/__tests__/validate.test.js +0 -100
  131. package/dist/process-blueprint/__tests__/compliance-lane.test.d.ts +0 -1
  132. package/dist/process-blueprint/__tests__/compliance-lane.test.js +0 -272
  133. package/dist/process-blueprint/__tests__/layout.test.d.ts +0 -1
  134. package/dist/process-blueprint/__tests__/layout.test.js +0 -196
  135. package/dist/process-blueprint/__tests__/validate.test.d.ts +0 -1
  136. package/dist/process-blueprint/__tests__/validate.test.js +0 -280
  137. package/dist/process-map/__tests__/validate.test.d.ts +0 -1
  138. package/dist/process-map/__tests__/validate.test.js +0 -199
  139. package/dist/products/__tests__/validate.test.d.ts +0 -1
  140. package/dist/products/__tests__/validate.test.js +0 -210
  141. package/dist/repo-validate/__tests__/validate-repo.test.d.ts +0 -1
  142. package/dist/repo-validate/__tests__/validate-repo.test.js +0 -576
  143. package/dist/requirement/__tests__/example.test.d.ts +0 -1
  144. package/dist/requirement/__tests__/example.test.js +0 -21
  145. package/dist/requirement/__tests__/validate.test.d.ts +0 -1
  146. package/dist/requirement/__tests__/validate.test.js +0 -80
  147. package/dist/scenarios/__tests__/validate.test.d.ts +0 -1
  148. package/dist/scenarios/__tests__/validate.test.js +0 -183
  149. package/dist/stakeholder/__tests__/validate.test.d.ts +0 -1
  150. package/dist/stakeholder/__tests__/validate.test.js +0 -88
  151. package/dist/target-state/__tests__/validate.test.d.ts +0 -1
  152. package/dist/target-state/__tests__/validate.test.js +0 -78
  153. package/dist/technology-service/__tests__/validate.test.d.ts +0 -1
  154. package/dist/technology-service/__tests__/validate.test.js +0 -121
  155. package/dist/theme/__tests__/tokens.test.d.ts +0 -1
  156. package/dist/theme/__tests__/tokens.test.js +0 -159
  157. package/dist/webview/__tests__/entity-text-layout.test.d.ts +0 -1
  158. package/dist/webview/__tests__/entity-text-layout.test.js +0 -155
  159. package/dist/webview/__tests__/entry-notations.test.d.ts +0 -1
  160. package/dist/webview/__tests__/entry-notations.test.js +0 -62
  161. package/dist/webview/__tests__/entry.test.d.ts +0 -1
  162. package/dist/webview/__tests__/entry.test.js +0 -56
  163. package/dist/webview/__tests__/render-activities.test.d.ts +0 -1
  164. package/dist/webview/__tests__/render-activities.test.js +0 -91
  165. package/dist/webview/__tests__/render-blocks.test.d.ts +0 -1
  166. package/dist/webview/__tests__/render-blocks.test.js +0 -175
  167. package/dist/webview/__tests__/render-goals.test.d.ts +0 -1
  168. package/dist/webview/__tests__/render-goals.test.js +0 -120
  169. package/dist/webview/__tests__/render-process.test.d.ts +0 -1
  170. package/dist/webview/__tests__/render-process.test.js +0 -463
  171. package/dist/webview/__tests__/render-util.test.d.ts +0 -1
  172. package/dist/webview/__tests__/render-util.test.js +0 -54
  173. package/src/__tests__/edge-path.test.ts +0 -58
  174. package/src/__tests__/node-size-presets.test.ts +0 -50
  175. package/src/__tests__/scope.test.ts +0 -27
  176. package/src/__tests__/yaml-normalize.test.ts +0 -158
  177. package/src/activities/__tests__/cpm.test.ts +0 -164
  178. package/src/activities/__tests__/gantt.test.ts +0 -290
  179. package/src/activities/__tests__/layout.test.ts +0 -112
  180. package/src/activities/__tests__/validate.test.ts +0 -446
  181. package/src/activity-card/__tests__/example.test.ts +0 -83
  182. package/src/activity-card/__tests__/layout.test.ts +0 -162
  183. package/src/activity-card/__tests__/resolver.test.ts +0 -357
  184. package/src/activity-card/__tests__/validate.test.ts +0 -167
  185. package/src/actor/__tests__/validate.test.ts +0 -114
  186. package/src/applications/__tests__/validate.test.ts +0 -256
  187. package/src/assertion/__tests__/example.test.ts +0 -37
  188. package/src/assertion/__tests__/validate.test.ts +0 -142
  189. package/src/blocks/__tests__/layout.test.ts +0 -169
  190. package/src/blocks/__tests__/validate.test.ts +0 -260
  191. package/src/business-service/__tests__/validate.test.ts +0 -160
  192. package/src/capability-map/__tests__/CapabilityMapView.test.tsx +0 -232
  193. package/src/capability-map/__tests__/address.test.ts +0 -59
  194. package/src/capability-map/__tests__/dsm-layout.test.ts +0 -52
  195. package/src/capability-map/__tests__/dsm-mutations.test.ts +0 -141
  196. package/src/capability-map/__tests__/dsm-validate.test.ts +0 -65
  197. package/src/capability-map/__tests__/validate.test.ts +0 -238
  198. package/src/change/__tests__/validate.test.ts +0 -97
  199. package/src/codex/__tests__/example.test.ts +0 -40
  200. package/src/codex/__tests__/validate.test.ts +0 -84
  201. package/src/compliance/__tests__/canon-catalog.test.ts +0 -68
  202. package/src/compliance/__tests__/classify.test.ts +0 -64
  203. package/src/compliance/__tests__/confidence.test.ts +0 -98
  204. package/src/compliance/__tests__/coverage-metric.test.ts +0 -300
  205. package/src/compliance/__tests__/demo-scenario.test.ts +0 -273
  206. package/src/compliance/__tests__/example.test.ts +0 -57
  207. package/src/compliance/__tests__/gap-report.test.ts +0 -129
  208. package/src/compliance/__tests__/html.test.ts +0 -142
  209. package/src/compliance/__tests__/impact.test.ts +0 -1060
  210. package/src/compliance/__tests__/markdown.test.ts +0 -95
  211. package/src/compliance/__tests__/trace.test.ts +0 -157
  212. package/src/compliance/__tests__/view-resolution.test.ts +0 -80
  213. package/src/compliance/__tests__/views.test.ts +0 -64
  214. package/src/compliance-matrix/__tests__/build.test.ts +0 -200
  215. package/src/compliance-matrix/__tests__/example.test.ts +0 -57
  216. package/src/confidence/__tests__/score.test.ts +0 -254
  217. package/src/constraint/__tests__/example.test.ts +0 -19
  218. package/src/constraint/__tests__/validate.test.ts +0 -68
  219. package/src/factor/__tests__/validate.test.ts +0 -133
  220. package/src/fgca/__tests__/chain-table.test.ts +0 -172
  221. package/src/fgca/__tests__/layout.test.ts +0 -179
  222. package/src/fgca/__tests__/parse-canonical.test.ts +0 -296
  223. package/src/fgca/__tests__/preview-layout.test.ts +0 -124
  224. package/src/fgca/__tests__/resolver.test.ts +0 -209
  225. package/src/fgca/__tests__/validate.test.ts +0 -142
  226. package/src/goals/__tests__/GoalTreeView.test.tsx +0 -361
  227. package/src/goals/__tests__/layout.test.ts +0 -175
  228. package/src/goals/__tests__/mutations.test.ts +0 -153
  229. package/src/goals/__tests__/parse-canonical.test.ts +0 -147
  230. package/src/goals/__tests__/validate.test.ts +0 -202
  231. package/src/integration/__tests__/validate.test.ts +0 -203
  232. package/src/location/__tests__/validate.test.ts +0 -127
  233. package/src/node/__tests__/validate.test.ts +0 -118
  234. package/src/process-blueprint/__tests__/compliance-lane.test.ts +0 -320
  235. package/src/process-blueprint/__tests__/layout.test.ts +0 -240
  236. package/src/process-blueprint/__tests__/validate.test.ts +0 -310
  237. package/src/process-map/__tests__/validate.test.ts +0 -223
  238. package/src/products/__tests__/validate.test.ts +0 -239
  239. package/src/repo-validate/__tests__/validate-repo.test.ts +0 -699
  240. package/src/requirement/__tests__/example.test.ts +0 -24
  241. package/src/requirement/__tests__/validate.test.ts +0 -96
  242. package/src/scenarios/__tests__/validate.test.ts +0 -209
  243. package/src/stakeholder/__tests__/validate.test.ts +0 -105
  244. package/src/target-state/__tests__/validate.test.ts +0 -95
  245. package/src/technology-service/__tests__/validate.test.ts +0 -143
  246. package/src/theme/__tests__/tokens.test.ts +0 -185
  247. package/src/webview/__tests__/entity-text-layout.test.ts +0 -182
  248. package/src/webview/__tests__/entry-notations.test.ts +0 -77
  249. package/src/webview/__tests__/entry.test.ts +0 -64
  250. package/src/webview/__tests__/render-activities.test.ts +0 -100
  251. package/src/webview/__tests__/render-blocks.test.ts +0 -206
  252. package/src/webview/__tests__/render-goals.test.ts +0 -128
  253. package/src/webview/__tests__/render-process.test.ts +0 -538
  254. package/src/webview/__tests__/render-util.test.ts +0 -66
@@ -1,159 +0,0 @@
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 +0,0 @@
1
- export {};
@@ -1,155 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { layoutCenteredEntityText, layoutLeafBlockText, layoutHeaderBlockText, LINE_H_PRIMARY, LINE_H_SECONDARY, TEXT_MARGIN_Y, maxCharsForInnerWidth, ROW_GROUP_GAP, wrapWords, wrapTextLines, } from '../entity-text-layout.js';
3
- import { ENTITY_NODE_SIZE } from '../../node-size-presets.js';
4
- describe('entity-text-layout', () => {
5
- it('wrapWords respects max lines and truncates with ellipsis', () => {
6
- const long = 'one two three four five six seven eight nine ten eleven twelve';
7
- const lines = wrapWords(long, 12, 2);
8
- expect(lines.length).toBeLessThanOrEqual(2);
9
- expect(lines[lines.length - 1]).toMatch(/…$/);
10
- });
11
- it('maxCharsForInnerWidth scales with inner width', () => {
12
- expect(maxCharsForInnerWidth(160, 7)).toBeGreaterThan(maxCharsForInnerWidth(120, 7));
13
- });
14
- it('layoutCenteredEntityText keeps name and type labels separated', () => {
15
- const specs = layoutCenteredEntityText({
16
- boxX: 0,
17
- boxY: 0,
18
- boxWidth: 250,
19
- boxHeight: 80,
20
- name: 'Grow enterprise value',
21
- type: 'Strategic',
22
- id: 'GOAL-VALUE-1',
23
- nameMaxLines: 2,
24
- idMaxLines: 1,
25
- });
26
- const nameY = specs.find((l) => l.cls === 'text-primary').y;
27
- const typeY = specs.find((l) => l.cls === 'text-secondary').y;
28
- const minGap = typeY - nameY - LINE_H_PRIMARY / 2 - LINE_H_SECONDARY / 2;
29
- expect(minGap).toBeGreaterThanOrEqual(ROW_GROUP_GAP - 1);
30
- });
31
- it('layoutCenteredEntityText emits more name capacity on wide boxes', () => {
32
- const narrow = layoutCenteredEntityText({
33
- boxX: 0,
34
- boxY: 0,
35
- boxWidth: 200,
36
- boxHeight: 80,
37
- name: 'Improve customer onboarding experience across regions',
38
- id: 'GOAL-001',
39
- nameMaxLines: 2,
40
- idMaxLines: 1,
41
- });
42
- const wide = layoutCenteredEntityText({
43
- boxX: 0,
44
- boxY: 0,
45
- boxWidth: 320,
46
- boxHeight: 80,
47
- name: 'Improve customer onboarding experience across regions',
48
- id: 'GOAL-001',
49
- nameMaxLines: 2,
50
- idMaxLines: 1,
51
- });
52
- const narrowPrimary = narrow.filter((l) => l.cls === 'text-primary').map((l) => l.text).join(' ');
53
- const widePrimary = wide.filter((l) => l.cls === 'text-primary').map((l) => l.text).join(' ');
54
- expect(widePrimary.replace(/…/g, '').length).toBeGreaterThanOrEqual(narrowPrimary.replace(/…/g, '').length);
55
- });
56
- it('wrapTextLines hard-breaks oversized tokens (blueprint cells)', () => {
57
- const lines = wrapTextLines('supercalifragilisticexpialidocious word', 10, 3);
58
- expect(lines.length).toBeGreaterThan(1);
59
- expect(lines.every((l) => l.length <= 10)).toBe(true);
60
- });
61
- });
62
- // Approximate half-extent (px) of each text class's glyphs around its centre
63
- // y — font-size / 2, the same heuristic the render-blocks overlap regression
64
- // test (#419) uses. Used below to assert text never visually crosses the box
65
- // border, not just that the *nominal* line-height budget fits.
66
- const HALF_EXTENT = {
67
- 'text-primary': 6, // 12px font
68
- 'text-secondary': 6, // 11px font, rounded up
69
- 'text-id': 5, // 10px font
70
- };
71
- describe('entity text layout — never overflows the box, always keeps padding', () => {
72
- const PRESETS = Object.entries(ENTITY_NODE_SIZE); // compact/normal/wide
73
- const NAMES = [
74
- 'Short',
75
- 'Achieve full GDPR & NIS2 compliance',
76
- 'A name so long it would need three or more lines to render in full without any height limit at all',
77
- ];
78
- function assertNoOverflowAndPadded(specs, boxTop, boxBottom) {
79
- for (const s of specs) {
80
- const half = HALF_EXTENT[s.cls] ?? 6;
81
- expect(s.y - half).toBeGreaterThanOrEqual(boxTop);
82
- expect(s.y + half).toBeLessThanOrEqual(boxBottom);
83
- }
84
- }
85
- for (const [presetName, size] of PRESETS) {
86
- for (const withType of [false, true]) {
87
- for (const name of NAMES) {
88
- it(`layoutCenteredEntityText: ${presetName} preset, type=${withType}, name="${name.slice(0, 20)}…" stays inside the box`, () => {
89
- const boxY = 0;
90
- const specs = layoutCenteredEntityText({
91
- boxX: 0,
92
- boxY,
93
- boxWidth: size.width,
94
- boxHeight: size.height,
95
- name,
96
- type: withType ? 'Strategic Goal' : undefined,
97
- id: 'GOAL-EU-COMPLIANCE-1',
98
- nameMaxLines: 2,
99
- idMaxLines: 1,
100
- });
101
- assertNoOverflowAndPadded(specs, boxY, boxY + size.height);
102
- });
103
- }
104
- }
105
- }
106
- it('reproduces the reported case (wide preset, 2-line name + type + long id) with real padding on all sides', () => {
107
- const size = ENTITY_NODE_SIZE.normal;
108
- const boxY = 100;
109
- const specs = layoutCenteredEntityText({
110
- boxX: 0,
111
- boxY,
112
- boxWidth: size.width,
113
- boxHeight: size.height,
114
- name: 'Achieve full GDPR & NIS2 compliance',
115
- type: 'Project Goal',
116
- id: 'GOAL-EU-COMPLIANCE-1',
117
- nameMaxLines: 2,
118
- idMaxLines: 1,
119
- });
120
- const nameLines = specs.filter((s) => s.cls === 'text-primary');
121
- expect(nameLines.length).toBe(2); // normal preset is tall enough to keep both lines
122
- assertNoOverflowAndPadded(specs, boxY, boxY + size.height);
123
- // Explicit padding, not just "doesn't cross the border".
124
- const firstTop = Math.min(...specs.map((s) => s.y - (HALF_EXTENT[s.cls] ?? 6)));
125
- const lastBottom = Math.max(...specs.map((s) => s.y + (HALF_EXTENT[s.cls] ?? 6)));
126
- expect(firstTop - boxY).toBeGreaterThanOrEqual(TEXT_MARGIN_Y);
127
- expect(boxY + size.height - lastBottom).toBeGreaterThanOrEqual(TEXT_MARGIN_Y);
128
- });
129
- it('layoutLeafBlockText stays inside the box for compact preset with a long name and id', () => {
130
- const size = ENTITY_NODE_SIZE.compact;
131
- const boxY = 0;
132
- const specs = layoutLeafBlockText({
133
- boxX: 0,
134
- boxY,
135
- boxWidth: size.width,
136
- boxHeight: size.height,
137
- name: 'Personal data records that linger after consent withdrawal across many systems and archives',
138
- id: 'VERY_LONG_BLOCK_IDENTIFIER_WITH_MANY_SEGMENTS_AND_MORE',
139
- });
140
- assertNoOverflowAndPadded(specs, boxY, boxY + size.height);
141
- });
142
- it('layoutHeaderBlockText stays inside a short header strip', () => {
143
- const boxY = 0;
144
- const headerHeight = 28;
145
- const specs = layoutHeaderBlockText({
146
- boxX: 0,
147
- boxY,
148
- boxWidth: 250,
149
- headerHeight,
150
- name: 'A fairly long container name here',
151
- id: 'VERY_LONG_CONTAINER_IDENTIFIER',
152
- });
153
- assertNoOverflowAndPadded(specs, boxY, boxY + headerHeight);
154
- });
155
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,62 +0,0 @@
1
- /**
2
- * Step 4 parity check: every supported notation must render through the
3
- * webview bundle's `render(kind, source)` API from the same example fixtures
4
- * the VS Code previews consume — a valid document yields `status: 'ok'` with
5
- * non-empty markup, and a malformed document degrades to the error panel
6
- * (structured errors, no thrown exception reaching the JVM host).
7
- */
8
- import { readFileSync } from 'node:fs';
9
- import path from 'node:path';
10
- import { fileURLToPath } from 'node:url';
11
- import { describe, expect, it } from 'vitest';
12
- import { api, render } from '../entry.js';
13
- const EXAMPLES = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../../../tests/fixtures/notation-corpus');
14
- // Mirrors the fixtures used by the VS Code previews. One representative
15
- // example per notation is enough to prove the dispatch + renderer wiring.
16
- const FIXTURES = [
17
- { kind: 'goals', file: 'goals/strategy-2026.goals.transitrix.yaml', markup: 'svg' },
18
- { kind: 'dgca', file: 'dgca/strategy-2026.dgca.transitrix.yaml', markup: 'svg' },
19
- { kind: 'dga', file: 'dga/strategy-2026.dga.transitrix.yaml', markup: 'svg' },
20
- { kind: 'action', file: 'action/platform-launch.action.transitrix.yaml', markup: 'svg' },
21
- { kind: 'action-card', file: 'action-card/eu-programme.action-card.transitrix.yaml', markup: 'svg' },
22
- { kind: 'process-blueprint', file: 'process-blueprint/order-fulfilment.process-blueprint.transitrix.yaml', markup: 'svg' },
23
- { kind: 'blocks', file: 'blocks/architecture.blocks.transitrix.yaml', markup: 'svg' },
24
- { kind: 'applications', file: 'applications/portfolio-2026.applications.transitrix.yaml', markup: 'section' },
25
- { kind: 'products', file: 'products/portfolio-2026.products.transitrix.yaml', markup: 'section' },
26
- { kind: 'process-map', file: 'process-map/enterprise.process-map.transitrix.yaml', markup: 'section' },
27
- { kind: 'scenarios', file: 'scenarios/omnichannel-2028.scenarios.transitrix.yaml', markup: 'section' },
28
- { kind: 'capability-map', file: 'capability-map/business.capability-map.transitrix.yaml', markup: 'section' },
29
- ];
30
- describe('webview/entry — Step 4 notation coverage', () => {
31
- it('wires every supported kind (no kind left on NOTATION-NOT-WIRED)', () => {
32
- // The fixture table must cover the full supported-kinds surface, so a new
33
- // kind added to the bundle without a renderer fails this test loudly.
34
- const covered = new Set(FIXTURES.map((f) => f.kind));
35
- for (const kind of api.supportedKinds) {
36
- expect(covered.has(kind)).toBe(true);
37
- }
38
- });
39
- for (const fx of FIXTURES) {
40
- it(`renders ${fx.kind} from its example fixture`, () => {
41
- const source = readFileSync(path.join(EXAMPLES, fx.file), 'utf8');
42
- const r = render(fx.kind, source);
43
- expect(r.notation).toBe(fx.kind);
44
- expect(r.errors).toEqual([]);
45
- expect(r.status).toBe('ok');
46
- expect(r.svg.length).toBeGreaterThan(0);
47
- expect(r.svg).toContain(fx.markup === 'svg' ? '<svg ' : '<section');
48
- });
49
- }
50
- it('degrades malformed input to the error panel for a diagram notation', () => {
51
- const r = render('process-blueprint', 'process_blueprint:\n stages: "not a list"\n');
52
- expect(r.status).toBe('error');
53
- expect(r.errors.length).toBeGreaterThan(0);
54
- expect(r.svg).toBe('');
55
- });
56
- it('degrades malformed input to the error panel for a catalogue notation', () => {
57
- const r = render('applications', 'applications_catalogue:\n applications: "not a list"\n');
58
- expect(r.status).toBe('error');
59
- expect(r.errors.length).toBeGreaterThan(0);
60
- expect(r.svg).toBe('');
61
- });
62
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,56 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import { api, render } from '../entry.js';
3
- const VALID_GOALS_DOC = `
4
- notation: goals
5
- id: GOALS-WEBVIEW-1
6
- name: "Webview entry smoke test"
7
- goal_types:
8
- - { name: "Strategy", level: 0 }
9
- goals:
10
- - id: GOAL-MOON-1
11
- name: "Reach the moon"
12
- type: "Strategy"
13
- level: 0
14
- `;
15
- describe('webview/entry — Step 2 host API', () => {
16
- it('exposes a version + supportedKinds + render() trio', () => {
17
- expect(api.version).toMatch(/^\d+\.\d+\.\d+/);
18
- expect(api.supportedKinds).toContain('goals');
19
- expect(typeof api.render).toBe('function');
20
- });
21
- it('parses + validates + renders SVG for a well-formed goals document', () => {
22
- const r = render('goals', VALID_GOALS_DOC);
23
- expect(r.notation).toBe('goals');
24
- expect(r.status).toBe('ok');
25
- expect(r.errors).toEqual([]);
26
- // Step 3 wires the goals renderer — SVG must now be non-empty and contain
27
- // the goal name from the YAML.
28
- expect(r.svg).toContain('<svg ');
29
- expect(r.svg).toContain('Reach the moon');
30
- });
31
- it('returns YAML-PARSE on malformed input — no exception escapes to the host', () => {
32
- const r = render('goals', 'goals:\n - id: g1\n name: [unterminated');
33
- expect(r.status).toBe('error');
34
- expect(r.errors[0].code).toBe('YAML-PARSE');
35
- });
36
- it('returns KIND-UNKNOWN for a non-Transitrix notation kind', () => {
37
- const r = render('plantuml', VALID_GOALS_DOC);
38
- expect(r.status).toBe('error');
39
- expect(r.errors[0].code).toBe('KIND-UNKNOWN');
40
- });
41
- it('routes non-goals kinds to their validator after Step 4 (no NOTATION-NOT-WIRED)', () => {
42
- // Every supported kind is now wired to its validator + renderer. A
43
- // malformed dgca document must surface a structured validation error from
44
- // the dgca validator — never the Step-2/3 "not wired" placeholder.
45
- const r = render('dgca', 'changes: []\n');
46
- expect(r.status).toBe('error');
47
- expect(r.errors.length).toBeGreaterThan(0);
48
- expect(r.errors.every((e) => e.code !== 'NOTATION-NOT-WIRED')).toBe(true);
49
- });
50
- it('surfaces goals validation errors structurally (e.g. missing notation header)', () => {
51
- const r = render('goals', 'goals: []\n');
52
- expect(r.status).toBe('error');
53
- // parseCanonicalGoals emits GOALS-* codes for canonical-shape violations.
54
- expect(r.errors.some((e) => e.code.startsWith('GOALS-'))).toBe(true);
55
- });
56
- });
@@ -1 +0,0 @@
1
- export {};
@@ -1,91 +0,0 @@
1
- /**
2
- * Unit tests for renderActivitiesSvg — project-node suppression (#421).
3
- *
4
- * Convention: activities with activity_type === 'project' are omitted from
5
- * the Network/PSND layout by default (suppressProjectNodes: true). Text/Tree
6
- * views keep them via the caller; data is never mutated.
7
- */
8
- import { describe, it, expect } from 'vitest';
9
- import { renderActivitiesSvg } from '../render-activities.js';
10
- const BASE_DOC = {
11
- notation: 'action',
12
- activities: [
13
- {
14
- id: 'PROJ-1',
15
- name: 'Platform Launch',
16
- activity_type: 'project',
17
- },
18
- {
19
- id: 'TASK-1',
20
- name: 'Design',
21
- activity_type: 'task',
22
- parent: 'PROJ-1',
23
- },
24
- {
25
- id: 'TASK-2',
26
- name: 'Implement',
27
- activity_type: 'task',
28
- parent: 'PROJ-1',
29
- predecessors: ['TASK-1'],
30
- },
31
- ],
32
- };
33
- describe('renderActivitiesSvg — project-node suppression (#421)', () => {
34
- it('suppresses project-type nodes in the network SVG by default', () => {
35
- const svg = renderActivitiesSvg(BASE_DOC);
36
- // TASK-1 and TASK-2 should appear as rendered nodes.
37
- expect(svg).toContain('TASK-1');
38
- expect(svg).toContain('TASK-2');
39
- // The project container should not appear as a rendered node.
40
- expect(svg).not.toContain('PROJ-1');
41
- });
42
- it('suppresses project nodes when suppressProjectNodes is explicitly true', () => {
43
- const svg = renderActivitiesSvg(BASE_DOC, { suppressProjectNodes: true });
44
- expect(svg).not.toContain('PROJ-1');
45
- expect(svg).toContain('TASK-1');
46
- });
47
- it('renders project nodes when suppressProjectNodes is false', () => {
48
- const svg = renderActivitiesSvg(BASE_DOC, { suppressProjectNodes: false });
49
- expect(svg).toContain('PROJ-1');
50
- expect(svg).toContain('TASK-1');
51
- expect(svg).toContain('TASK-2');
52
- });
53
- it('does not mutate the original doc', () => {
54
- const original = BASE_DOC.activities.length;
55
- renderActivitiesSvg(BASE_DOC);
56
- expect(BASE_DOC.activities).toHaveLength(original);
57
- });
58
- it('suppresses project_type matching case-insensitively', () => {
59
- const doc = {
60
- notation: 'action',
61
- activities: [
62
- { id: 'P1', name: 'Container', activity_type: 'Project' },
63
- { id: 'T1', name: 'Leaf', activity_type: 'task' },
64
- ],
65
- };
66
- const svg = renderActivitiesSvg(doc);
67
- expect(svg).not.toContain('P1');
68
- expect(svg).toContain('T1');
69
- });
70
- it('renders a valid SVG when all activities are project-type (graceful degrade)', () => {
71
- const doc = {
72
- notation: 'action',
73
- activities: [{ id: 'P1', name: 'Only project', activity_type: 'project' }],
74
- };
75
- const svg = renderActivitiesSvg(doc);
76
- // When all activities are filtered out, the renderer returns an empty SVG.
77
- expect(svg).toContain('<svg');
78
- });
79
- it('renders activities without activity_type unchanged', () => {
80
- const doc = {
81
- notation: 'action',
82
- activities: [
83
- { id: 'A1', name: 'Analysis', duration: 5 },
84
- { id: 'A2', name: 'Design', duration: 3, predecessors: ['A1'] },
85
- ],
86
- };
87
- const svg = renderActivitiesSvg(doc);
88
- expect(svg).toContain('A1');
89
- expect(svg).toContain('A2');
90
- });
91
- });
@@ -1 +0,0 @@
1
- export {};