@webpieces/nx-webpieces-rules 0.4.911 → 0.4.913

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 (85) hide show
  1. package/README.md +11 -0
  2. package/executors.json +5 -0
  3. package/package.json +7 -7
  4. package/src/executors/help/executor.js +2 -0
  5. package/src/executors/help/executor.js.map +1 -1
  6. package/src/executors/visualize-runtime/executor.d.ts +3 -1
  7. package/src/executors/visualize-runtime/executor.js +9 -3
  8. package/src/executors/visualize-runtime/executor.js.map +1 -1
  9. package/src/executors/visualize-runtime-goal/executor.d.ts +27 -0
  10. package/src/executors/visualize-runtime-goal/executor.js +98 -0
  11. package/src/executors/visualize-runtime-goal/executor.js.map +1 -0
  12. package/src/executors/visualize-runtime-goal/schema.json +13 -0
  13. package/src/index.d.ts +1 -1
  14. package/src/index.js +3 -1
  15. package/src/index.js.map +1 -1
  16. package/src/lib/graph-color-modes.d.ts +15 -1
  17. package/src/lib/graph-color-modes.js +19 -1
  18. package/src/lib/graph-color-modes.js.map +1 -1
  19. package/src/lib/graph-filter.client.d.ts +9 -2
  20. package/src/lib/graph-filter.client.js +15 -0
  21. package/src/lib/graph-filter.client.js.map +1 -1
  22. package/src/lib/graph-legend.js +1 -1
  23. package/src/lib/graph-legend.js.map +1 -1
  24. package/src/lib/graph-mode-state.client.d.ts +9 -2
  25. package/src/lib/graph-mode-state.client.js +17 -4
  26. package/src/lib/graph-mode-state.client.js.map +1 -1
  27. package/src/lib/graph-page-shell.d.ts +11 -4
  28. package/src/lib/graph-page-shell.js +11 -9
  29. package/src/lib/graph-page-shell.js.map +1 -1
  30. package/src/lib/graph-products.d.ts +22 -3
  31. package/src/lib/graph-products.js +63 -13
  32. package/src/lib/graph-products.js.map +1 -1
  33. package/src/lib/graph-render-model.d.ts +41 -0
  34. package/src/lib/graph-render-model.js +45 -1
  35. package/src/lib/graph-render-model.js.map +1 -1
  36. package/src/lib/graph-visualizer.client.d.ts +7 -1
  37. package/src/lib/graph-visualizer.client.js +37 -4
  38. package/src/lib/graph-visualizer.client.js.map +1 -1
  39. package/src/lib/graph-visualizer.js +1 -1
  40. package/src/lib/graph-visualizer.js.map +1 -1
  41. package/src/lib/runtime-goal-comparison.d.ts +55 -0
  42. package/src/lib/runtime-goal-comparison.js +209 -0
  43. package/src/lib/runtime-goal-comparison.js.map +1 -0
  44. package/src/lib/runtime-goal-details.d.ts +17 -0
  45. package/src/lib/runtime-goal-details.js +118 -0
  46. package/src/lib/runtime-goal-details.js.map +1 -0
  47. package/src/lib/runtime-goal-file.d.ts +72 -0
  48. package/src/lib/runtime-goal-file.js +201 -0
  49. package/src/lib/runtime-goal-file.js.map +1 -0
  50. package/src/lib/runtime-goal-styles.d.ts +10 -0
  51. package/src/lib/runtime-goal-styles.js +25 -0
  52. package/src/lib/runtime-goal-styles.js.map +1 -0
  53. package/src/lib/runtime-goal-validator.d.ts +39 -0
  54. package/src/lib/runtime-goal-validator.js +236 -0
  55. package/src/lib/runtime-goal-validator.js.map +1 -0
  56. package/src/lib/runtime-goal-view.d.ts +22 -0
  57. package/src/lib/runtime-goal-view.js +64 -0
  58. package/src/lib/runtime-goal-view.js.map +1 -0
  59. package/src/lib/runtime-graph-diff.d.ts +107 -0
  60. package/src/lib/runtime-graph-diff.js +346 -0
  61. package/src/lib/runtime-graph-diff.js.map +1 -0
  62. package/src/lib/runtime-html-page.d.ts +8 -0
  63. package/src/lib/runtime-html-page.js +39 -6
  64. package/src/lib/runtime-html-page.js.map +1 -1
  65. package/src/lib/runtime-layout.d.ts +2 -0
  66. package/src/lib/runtime-layout.js +4 -0
  67. package/src/lib/runtime-layout.js.map +1 -1
  68. package/src/lib/runtime-union-graph.d.ts +20 -0
  69. package/src/lib/runtime-union-graph.js +94 -0
  70. package/src/lib/runtime-union-graph.js.map +1 -0
  71. package/src/lib/runtime-viewer-adapter.js +7 -5
  72. package/src/lib/runtime-viewer-adapter.js.map +1 -1
  73. package/src/lib/runtime-visualizer.client.js +7 -3
  74. package/src/lib/runtime-visualizer.client.js.map +1 -1
  75. package/src/lib/runtime-visualizer.d.ts +8 -3
  76. package/src/lib/runtime-visualizer.js +18 -10
  77. package/src/lib/runtime-visualizer.js.map +1 -1
  78. package/src/lib/runtime-viz-options.d.ts +28 -1
  79. package/src/lib/runtime-viz-options.js +36 -2
  80. package/src/lib/runtime-viz-options.js.map +1 -1
  81. package/src/plugin.js +2 -2
  82. package/src/plugin.js.map +1 -1
  83. package/src/runtime-targets.d.ts +6 -0
  84. package/src/runtime-targets.js +17 -0
  85. package/src/runtime-targets.js.map +1 -1
@@ -10,6 +10,7 @@
10
10
  * Markup only. Behaviour is graph-visualizer.client.ts; styling is graph-page-styles.ts. No element
11
11
  * carries a `style=` attribute — every look is a class.
12
12
  */
13
+ import { ProductColor } from './graph-products';
13
14
  /**
14
15
  * The Filter popover's "Changes on this branch" choices. The page computes each set from the Impact
15
16
  * sidecar (graph-impact.ts): CHANGED = touched; DEPENDENTS = touched + affected (nx affected: their
@@ -48,15 +49,21 @@ export declare class ShellParts {
48
49
  readonly filterStatus: string;
49
50
  readonly snapshot: string;
50
51
  readonly responsibilities: string;
51
- /** Every declared product, sorted (#1179); empty hides the Filter's Product group. */
52
- readonly products: string[];
52
+ /**
53
+ * One chip per product (#1179), sorted, each colored from the page's ONE palette (#1244);
54
+ * empty hides the Filter's Product group.
55
+ */
56
+ readonly products: ProductColor[];
53
57
  readonly runtime: boolean;
54
58
  readonly frameworks: readonly string[];
55
59
  readonly roles: readonly string[];
56
60
  readonly emptyState: string;
57
61
  constructor(title: string, lockControl: string, legend: string, edgeKey: string, filterStatus: string, snapshot: string, responsibilities: string,
58
- /** Every declared product, sorted (#1179); empty hides the Filter's Product group. */
59
- products: string[], runtime?: boolean, frameworks?: readonly string[], roles?: readonly string[], emptyState?: string);
62
+ /**
63
+ * One chip per product (#1179), sorted, each colored from the page's ONE palette (#1244);
64
+ * empty hides the Filter's Product group.
65
+ */
66
+ products: ProductColor[], runtime?: boolean, frameworks?: readonly string[], roles?: readonly string[], emptyState?: string);
60
67
  }
61
68
  export declare class GraphPageShell {
62
69
  body(parts: ShellParts): string;
@@ -14,7 +14,6 @@
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.GraphPageShell = exports.ShellParts = exports.SCOPE_OPTIONS = exports.ScopeOption = exports.ChangeScope = void 0;
16
16
  const graph_color_modes_1 = require("./graph-color-modes");
17
- const graph_products_1 = require("./graph-products");
18
17
  /**
19
18
  * The Filter popover's "Changes on this branch" choices. The page computes each set from the Impact
20
19
  * sidecar (graph-impact.ts): CHANGED = touched; DEPENDENTS = touched + affected (nx affected: their
@@ -71,7 +70,10 @@ class ShellParts {
71
70
  roles;
72
71
  emptyState;
73
72
  constructor(title, lockControl, legend, edgeKey, filterStatus, snapshot, responsibilities,
74
- /** Every declared product, sorted (#1179); empty hides the Filter's Product group. */
73
+ /**
74
+ * One chip per product (#1179), sorted, each colored from the page's ONE palette (#1244);
75
+ * empty hides the Filter's Product group.
76
+ */
75
77
  products, runtime = false, frameworks = graph_color_modes_1.FRAMEWORK_ORDER, roles = graph_color_modes_1.ROLE_STYLES.map((style) => style.role), emptyState = '') {
76
78
  this.title = title;
77
79
  this.lockControl = lockControl;
@@ -104,7 +106,7 @@ class GraphPageShell {
104
106
  <div class="wp-brand">${this.brandIcon()}<span>${parts.title}</span></div>
105
107
  <div class="wp-group" role="group" aria-label="Color mode">
106
108
  <div class="wp-label">Color by</div>
107
- ${this.modePulldown()}
109
+ ${this.modePulldown(parts.runtime ? graph_color_modes_1.RUNTIME_GRAPH_MODES : graph_color_modes_1.GRAPH_MODES)}
108
110
  <p class="wp-mode-reason" id="wp-impact-reason" hidden></p>
109
111
  ${this.impactKinds('drawer')}
110
112
  </div>
@@ -136,13 +138,13 @@ class GraphPageShell {
136
138
  * menu of the four. Keys 1/2/3/4 and the #runtime / #architecture / #impact / #product links still
137
139
  * switch.
138
140
  */
139
- modePulldown() {
140
- const first = graph_color_modes_1.GRAPH_MODES[0];
141
+ modePulldown(modes) {
142
+ const first = modes[0];
141
143
  return `<div class="wp-pulldown">
142
144
  <button type="button" class="wp-pill-trigger" id="wp-mode-trigger" aria-haspopup="menu" aria-controls="wp-mode-menu" aria-expanded="false">
143
145
  <span class="wp-pill-text"><span class="wp-mode-name" id="wp-mode-current">${first.name}</span><span class="wp-mode-sub" id="wp-mode-current-sub">${first.subtitle}</span></span><span class="wp-caret" aria-hidden="true">▾</span>
144
146
  </button>
145
- <div class="wp-menu" id="wp-mode-menu" role="menu" aria-label="Color by" hidden>${graph_color_modes_1.GRAPH_MODES.map((info, index) => this.modeItem(info, index)).join('')}</div>
147
+ <div class="wp-menu" id="wp-mode-menu" role="menu" aria-label="Color by" hidden>${modes.map((info, index) => this.modeItem(info, index)).join('')}</div>
146
148
  </div>`;
147
149
  }
148
150
  /** One menu option, two lines: the mode's name, then its grey subtitle. */
@@ -182,8 +184,7 @@ class GraphPageShell {
182
184
  productGroup(products) {
183
185
  if (products.length === 0)
184
186
  return '';
185
- const palette = new graph_products_1.ProductPalette(products);
186
- const chips = palette.colors
187
+ const chips = products
187
188
  .map((color) => `<button type="button" class="wp-chip" data-wp-chip-group="product" data-wp-chip="${color.product}" aria-pressed="false">` +
188
189
  `<svg class="wp-chip-swatch" width="10" height="10" viewBox="0 0 10 10" aria-hidden="true"><circle cx="5" cy="5" r="4.5" fill="${color.color}"/></svg>` +
189
190
  `${color.product}</button>`)
@@ -232,7 +233,8 @@ class GraphPageShell {
232
233
  <p>Lock pins separate incoming and outgoing chains; hover adds another chain temporarily. Hide unconnected removes unrelated boxes independently. Clear all clears facets, leaving Lock and chain filtering intact.</p>
233
234
  <p>Filters intersect declared runtime, role, product closure and Nx build scope. Counts describe services; attached contextual nodes are counted separately. Impact uses compile-project sets, never runtime reachability. Queues and vendors are context, never source owners or CI projects.</p>
234
235
  <p>Runtime uses declared framework colors, Architecture declared roles; contextual nodes keep their kind colors. Product colors come from each project's declared product: tags; contextual nodes inherit adjacent memberships. Unknown metadata is neutral. Missing saved metadata requires explicit architecture:generate.</p>
235
- <p><kbd>/</kbd> Focus search · <kbd>1</kbd>–<kbd>4</kbd> modes · <kbd>Esc</kbd> dismiss or unlock</p>
236
+ <p><strong>Goal vs Current</strong> compares the saved goal (architecture/runtime-dependencies-goal.json) with the saved current graph, Current → Goal: green added, red dashed removed (still drawn), amber changed, grey unchanged. Click a box for its before/after details, or click an arrow.</p>
237
+ <p><kbd>/</kbd> Focus search · <kbd>1</kbd>–<kbd>5</kbd> modes · <kbd>Esc</kbd> dismiss or unlock</p>
236
238
  </div>`;
237
239
  return `<div class="wp-pop wp-help" id="wp-help" role="dialog" aria-label="How to read this graph" hidden>
238
240
  <header><span>Reading the graph</span><button type="button" class="wp-icon wp-icon-mini" id="wp-help-close" aria-label="Close help">✕</button></header>
@@ -1 +1 @@
1
- {"version":3,"file":"graph-page-shell.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-page-shell.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,2DAAgH;AAChH,qDAAgE;AAEhE;;;;;;;;;GASG;AACH,IAAY,WAMX;AAND,WAAY,WAAW;IACnB,wCAAyB,CAAA;IACzB,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,4CAA6B,CAAA;IAC7B,8BAAe,CAAA;AACnB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAED;;;;GAIG;AACH,MAAa,WAAW;IAEA;IACA;IACA;IAHpB,YACoB,KAAkB,EAClB,KAAa,EACb,QAAgB;QAFhB,UAAK,GAAL,KAAK,CAAa;QAClB,UAAK,GAAL,KAAK,CAAQ;QACb,aAAQ,GAAR,QAAQ,CAAQ;IACjC,CAAC;CACP;AAND,kCAMC;AAEY,QAAA,aAAa,GAA2B;IACjD,IAAI,WAAW,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,EAAE,eAAe,CAAC;IAC/D,IAAI,WAAW,CAAC,WAAW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AAG,IAAI,+BAAc,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,KAAK,GAAG,OAAO,CAAC,MAAM;aACvB,GAAG,CACA,CAAC,KAAmB,EAAU,EAAE,CAC5B,oFAAoF,KAAK,CAAC,OAAO,yBAAyB;YAC1H,iIAAiI,KAAK,CAAC,KAAK,WAAW;YACvJ,GAAG,KAAK,CAAC,OAAO,WAAW,CAClC;aACA,IAAI,CAAC,EAAE,CAAC,CAAC;QACd,OAAO,4HAA4H,KAAK,mBAAmB,CAAC;IAChK,CAAC;IAED;;;;OAIG;IACK,WAAW,CAAC,KAAa;QAC7B,OAAO,CACH,+DAA+D,KAAK,6CAA6C;YACjH,yHAAyH;YACzH,oHAAoH,CACvH,CAAC;IACN,CAAC;IAEO,MAAM,CAAC,KAAiB;QAC5B,OAAO;;;;cAID,KAAK,CAAC,YAAY;;eAEjB,CAAC;IACZ,CAAC;IAEO,QAAQ,CAAC,KAAiB;QAC9B,OAAO,GAAG,KAAK,CAAC,UAAU;;cAEpB,KAAK,CAAC,MAAM;;UAEhB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;UACxB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;kEAC+B,KAAK,CAAC,QAAQ;;;cAGlE,KAAK,CAAC,gBAAgB;iBACnB,CAAC;IACd,CAAC;IAED,6FAA6F;IACrF,IAAI,CAAC,OAAgB;QACzB,IAAI,OAAO;YAAE,OAAO;;;;;;;;eAQb,CAAC;QACR,OAAO;;;;;;;;eAQA,CAAC;IACZ,CAAC;IAEO,SAAS;QACb,OAAO,CACH,qEAAqE;YACrE,mGAAmG;YACnG,oGAAoG;YACpG,oGAAoG;YACpG,uFAAuF,CAC1F,CAAC;IACN,CAAC;CACJ;AA3LD,wCA2LC","sourcesContent":["/**\n * The architecture page's shell (#1155): a collapsible dark drawer on the left holding every control,\n * and the graph filling the rest of the viewport.\n *\n * Before this, two hint paragraphs, a ~650px three-column legend, a lock dropdown and a zoom bar all\n * sat ABOVE the graph, so a laptop's first screen showed no graph at all. Now the hints are a \"?\"\n * popover, the legend lives in the drawer (and can pop out over the graph), zoom floats bottom-right\n * (graph-navigation.ts) and the responsibilities open in a right-hand panel.\n *\n * Markup only. Behaviour is graph-visualizer.client.ts; styling is graph-page-styles.ts. No element\n * carries a `style=` attribute — every look is a class.\n */\n\nimport { FRAMEWORK_ORDER, GRAPH_MODES, GraphMode, ModeInfo, ROLE_STYLES, RoleStyle } from './graph-color-modes';\nimport { ProductColor, ProductPalette } from './graph-products';\n\n/**\n * The Filter popover's \"Changes on this branch\" choices. The page computes each set from the Impact\n * sidecar (graph-impact.ts): CHANGED = touched; DEPENDENTS = touched + affected (nx affected: their\n * tests re-run); DEPENDENCIES = touched + every transitive dependency of it; BUILD = touched +\n * affected + every build input — the dependencies of the DEPENDENTS too, which is why it is more than\n * the union of the two rows above it.\n *\n * \"Dependents\" are what USE a project and \"dependencies\" what it uses (#1179). \"Dependee\" would mean\n * the thing depended ON — the opposite of the dependents row — so it is never used.\n */\nexport enum ChangeScope {\n EVERYTHING = 'everything',\n CHANGED = 'changed',\n DEPENDENTS = 'dependents',\n DEPENDENCIES = 'dependencies',\n BUILD = 'build',\n}\n\n/**\n * One change scope: its name and the grey second line under it, like the Color-by menu. These are the\n * ONE copy of the labels — the page script reads each name back from its `data-wp-scope-label` (the\n * top-bar pill), so the two cannot drift apart.\n */\nexport class ScopeOption {\n constructor(\n public readonly scope: ChangeScope,\n public readonly label: string,\n public readonly subtitle: string,\n ) {}\n}\n\nexport const SCOPE_OPTIONS: readonly ScopeOption[] = [\n new ScopeOption(ChangeScope.EVERYTHING, 'All', 'every project'),\n new ScopeOption(ChangeScope.CHANGED, 'Changed', 'owns a changed file'),\n new ScopeOption(ChangeScope.DEPENDENTS, 'Changed + dependents', '+ everything that uses them (their tests re-run)'),\n new ScopeOption(ChangeScope.DEPENDENCIES, 'Changed + dependencies', '+ everything they use'),\n new ScopeOption(ChangeScope.BUILD, 'Changed + dependents + dependencies', 'everything CI builds for this branch'),\n];\n\n/** Everything the shell frames, already rendered by its owner. */\nexport class ShellParts {\n constructor(\n public readonly title: string,\n public readonly lockControl: string,\n public readonly legend: string,\n public readonly edgeKey: string,\n public readonly filterStatus: string,\n public readonly snapshot: string,\n public readonly responsibilities: string,\n /** Every declared product, sorted (#1179); empty hides the Filter's Product group. */\n public readonly products: string[],\n public readonly runtime: boolean = false,\n public readonly frameworks: readonly string[] = FRAMEWORK_ORDER,\n public readonly roles: readonly string[] = ROLE_STYLES.map((style: RoleStyle): string => style.role),\n public readonly emptyState: string = '',\n ) {}\n}\n\nexport class GraphPageShell {\n body(parts: ShellParts): string {\n return `<div class=\"wp-shell\" id=\"wp-shell\">\n ${this.drawer(parts)}\n <main class=\"wp-main\">\n ${this.topbar(parts)}\n <div id=\"graph\"></div>\n ${this.overlays(parts)}\n </main>\n</div>`;\n }\n\n private drawer(parts: ShellParts): string {\n return `<aside class=\"wp-side\" id=\"wp-side\" aria-label=\"Graph controls\">\n <div class=\"wp-brand\">${this.brandIcon()}<span>${parts.title}</span></div>\n <div class=\"wp-group\" role=\"group\" aria-label=\"Color mode\">\n <div class=\"wp-label\">Color by</div>\n ${this.modePulldown()}\n <p class=\"wp-mode-reason\" id=\"wp-impact-reason\" hidden></p>\n ${this.impactKinds('drawer')}\n </div>\n <div class=\"wp-group\">\n <button type=\"button\" class=\"wp-filter-btn\" id=\"wp-filter-open\" aria-controls=\"wp-filter-pop\" aria-expanded=\"false\"><span>Filter</span><span class=\"wp-badge\" id=\"wp-filter-badge\" hidden>0</span></button>\n </div>\n <div class=\"wp-group\">\n <label class=\"wp-label\" for=\"wp-lock\">Focus</label>\n ${parts.lockControl}\n <button type=\"button\" class=\"wp-toggle\" id=\"wp-lock-toggle\" aria-pressed=\"false\">Lock <span class=\"wp-sw\" aria-hidden=\"true\"></span></button>\n <button type=\"button\" class=\"wp-toggle\" id=\"wp-filter-toggle\" aria-pressed=\"false\">Hide unconnected <span class=\"wp-sw\" aria-hidden=\"true\"></span></button>\n </div>\n <div class=\"wp-group\">\n <div class=\"wp-label wp-label-row\">Legend <button type=\"button\" class=\"wp-icon wp-icon-mini wp-icon-dark\" id=\"wp-legend-pop\" title=\"Pop the legend out over the graph\" aria-label=\"Pop the legend out over the graph\">⇱</button></div>\n ${parts.legend}\n </div>\n <div class=\"wp-group\">\n <div class=\"wp-label\">Edges</div>\n ${parts.edgeKey}\n </div>\n <div class=\"wp-foot\">\n <button type=\"button\" class=\"wp-link\" id=\"wp-resp-open\" aria-expanded=\"false\">Responsibilities</button>\n <button type=\"button\" class=\"wp-link\" id=\"wp-snapshot-open\" aria-expanded=\"false\">Saved snapshot</button>\n </div>\n </aside>`;\n }\n\n /**\n * \"Color by\": ONE pill-shaped trigger showing the current mode (name + subtitle) that opens a\n * menu of the four. Keys 1/2/3/4 and the #runtime / #architecture / #impact / #product links still\n * switch.\n */\n private modePulldown(): string {\n const first = GRAPH_MODES[0];\n return `<div class=\"wp-pulldown\">\n <button type=\"button\" class=\"wp-pill-trigger\" id=\"wp-mode-trigger\" aria-haspopup=\"menu\" aria-controls=\"wp-mode-menu\" aria-expanded=\"false\">\n <span class=\"wp-pill-text\"><span class=\"wp-mode-name\" id=\"wp-mode-current\">${first.name}</span><span class=\"wp-mode-sub\" id=\"wp-mode-current-sub\">${first.subtitle}</span></span><span class=\"wp-caret\" aria-hidden=\"true\">▾</span>\n </button>\n <div class=\"wp-menu\" id=\"wp-mode-menu\" role=\"menu\" aria-label=\"Color by\" hidden>${GRAPH_MODES.map((info: ModeInfo, index: number): string => this.modeItem(info, index)).join('')}</div>\n </div>`;\n }\n\n /** One menu option, two lines: the mode's name, then its grey subtitle. */\n private modeItem(info: ModeInfo, index: number): string {\n const checked = info.mode === GraphMode.RUNTIME ? 'true' : 'false';\n return (\n `<button type=\"button\" class=\"wp-mode\" role=\"menuitemradio\" data-wp-mode=\"${info.mode}\" aria-checked=\"${checked}\" title=\"Key ${index + 1}\">` +\n `<span class=\"wp-mode-name\">${info.name}</span><span class=\"wp-mode-sub\">${info.subtitle}</span></button>`\n );\n }\n\n /**\n * The Filter popover. Its four groups INTERSECT: a box is shown when it is in the chosen change\n * scope AND carries any selected runtime chip (when any is selected) AND any selected role chip\n * (when any is selected) AND belongs to any selected product (when any is selected). Nothing\n * applies until \"Show N projects\".\n */\n private filterPopover(parts: ShellParts): string {\n const scopes = SCOPE_OPTIONS.map(\n (option: ScopeOption): string =>\n `<label class=\"wp-scope\"><input type=\"radio\" name=\"wp-scope\" value=\"${option.scope}\"${option.scope === ChangeScope.EVERYTHING ? ' checked' : ''}>` +\n `<span class=\"wp-scope-text\"><span class=\"wp-scope-name\" data-wp-scope-label=\"${option.scope}\">${option.label}</span>` +\n `<span class=\"wp-scope-sub\">${parts.runtime && option.scope === ChangeScope.EVERYTHING ? 'every service' : option.subtitle}</span></span>` +\n `<span class=\"wp-count\" data-wp-scope-count=\"${option.scope}\"></span></label>`,\n ).join('');\n const chips = (group: string, values: readonly string[]): string =>\n values\n .map(\n (value: string): string =>\n `<button type=\"button\" class=\"wp-chip\" data-wp-chip-group=\"${group}\" data-wp-chip=\"${value}\" aria-pressed=\"false\">${value}</button>`,\n )\n .join('');\n return `<div class=\"wp-pop wp-filter-pop\" id=\"wp-filter-pop\" role=\"dialog\" aria-label=\"Filter ${parts.runtime ? 'services' : 'projects'}\" hidden>\n <header><span>Filter</span><button type=\"button\" class=\"wp-icon wp-icon-mini\" id=\"wp-filter-close\" aria-label=\"Close the filter\">✕</button></header>\n <fieldset class=\"wp-fgroup\" id=\"wp-scope-group\"><legend id=\"wp-scope-legend\">Changes on this branch</legend>${this.impactKinds('filter')}${scopes}<p class=\"wp-scope-reason\" id=\"wp-scope-reason\" hidden></p></fieldset>\n <fieldset class=\"wp-fgroup\"><legend>Runtime <small>any match</small></legend><div class=\"wp-chips\">${chips('runtime', parts.frameworks)}</div>${parts.runtime && parts.frameworks.length === 0 ? '<p>No declared framework metadata in the saved project graph. Refresh explicitly with architecture:generate.</p>' : ''}</fieldset>\n <fieldset class=\"wp-fgroup\"><legend>Role <small>any match</small></legend><div class=\"wp-chips\">${chips('role', parts.roles)}</div></fieldset>\n ${this.productGroup(parts.products)}\n <footer><button type=\"button\" class=\"wp-text-btn\" id=\"wp-filter-clear\">Clear all</button><button type=\"button\" class=\"wp-primary\" id=\"wp-filter-apply\">Show all ${parts.runtime ? 'services' : 'projects'}</button></footer>\n </div>`;\n }\n\n /**\n * The Product group (#1179): one chip per declared product, each with its palette swatch. Several\n * chips select the UNION of their members; the group intersects with the others. Omitted when the\n * workspace declares no product.\n */\n private productGroup(products: string[]): string {\n if (products.length === 0) return '';\n const palette = new ProductPalette(products);\n const chips = palette.colors\n .map(\n (color: ProductColor): string =>\n `<button type=\"button\" class=\"wp-chip\" data-wp-chip-group=\"product\" data-wp-chip=\"${color.product}\" aria-pressed=\"false\">` +\n `<svg class=\"wp-chip-swatch\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\"><circle cx=\"5\" cy=\"5\" r=\"4.5\" fill=\"${color.color}\"/></svg>` +\n `${color.product}</button>`,\n )\n .join('');\n return `<fieldset class=\"wp-fgroup\" id=\"wp-product-group\"><legend>Product <small>any match</small></legend><div class=\"wp-chips\">${chips}</div></fieldset>`;\n }\n\n /**\n * Which Impact scan the page shows (#1163): \"Changed on this branch\" (fork point → working tree)\n * or \"Last commit\" (HEAD^ → working tree). Hidden until the page finds TWO scans in the sidecar;\n * `where` tells the drawer's copy (shown only in Impact mode) from the Filter popover's.\n */\n private impactKinds(where: string): string {\n return (\n `<div class=\"wp-chips wp-impact-kinds\" data-wp-impact-kinds=\"${where}\" role=\"group\" aria-label=\"Compare\" hidden>` +\n '<button type=\"button\" class=\"wp-chip\" data-wp-impact-kind=\"branch\" aria-pressed=\"false\">Changed on this branch</button>' +\n '<button type=\"button\" class=\"wp-chip\" data-wp-impact-kind=\"commit\" aria-pressed=\"false\">Last commit</button></div>'\n );\n }\n\n private topbar(parts: ShellParts): string {\n return `<div class=\"wp-topbar\">\n <button type=\"button\" class=\"wp-icon\" id=\"wp-collapse\" aria-label=\"Toggle the controls drawer\" aria-controls=\"wp-side\" aria-expanded=\"true\">☰</button>\n <div class=\"wp-crumb\" id=\"wp-crumb\">Mode: <b>Runtime</b></div>\n <div class=\"wp-pills\" id=\"wp-filter-pills\" aria-label=\"Active filters\"></div>\n ${parts.filterStatus}\n <button type=\"button\" class=\"wp-icon\" id=\"wp-help-btn\" aria-label=\"How to read this graph\" aria-controls=\"wp-help\" aria-expanded=\"false\">?</button>\n </div>`;\n }\n\n private overlays(parts: ShellParts): string {\n return `${parts.emptyState}<div class=\"wp-pop wp-legend-popout\" id=\"wp-legend-popout\" hidden>\n <header><span id=\"wp-legend-pop-title\">Legend · Runtime</span><button type=\"button\" class=\"wp-icon wp-icon-mini\" id=\"wp-legend-close\" aria-label=\"Close the legend\">✕</button></header>\n ${parts.legend}\n </div>\n ${this.help(parts.runtime)}\n ${this.filterPopover(parts)}\n <div class=\"wp-pop wp-snapshot\" id=\"wp-snapshot\" hidden>${parts.snapshot}</div>\n <aside class=\"wp-panel\" id=\"wp-resp-panel\" aria-label=\"Responsibilities\" hidden>\n <header><span>Responsibilities</span><button type=\"button\" class=\"wp-icon wp-icon-mini\" id=\"wp-resp-close\" aria-label=\"Close responsibilities\">✕</button></header>\n ${parts.responsibilities}\n </aside>`;\n }\n\n /** The two hint paragraphs that used to sit above the graph, plus the keyboard shortcuts. */\n private help(runtime: boolean): string {\n if (runtime) return `<div class=\"wp-pop wp-help\" id=\"wp-help\" role=\"dialog\" aria-label=\"How to read this graph\" hidden>\n <header><span>Reading the runtime graph</span><button type=\"button\" class=\"wp-icon wp-icon-mini\" id=\"wp-help-close\" aria-label=\"Close help\">✕</button></header>\n <p>Rows preserve saved runtime call-depth levels. Boxes are services; horizontal cylinders are queues, upright cylinders datastores, and clocks scheduled triggers. Solid arrows are RPC calls, dashed arrows queued events; red arrows admit legacy cycles.</p>\n <p>Click a box for Lock, Filter Unconnected, or Implements. Implements in the box is a plain summary. Click Uses on a relationship line for its complete details. Hover traces chains without opening details.</p>\n <p>Lock pins separate incoming and outgoing chains; hover adds another chain temporarily. Hide unconnected removes unrelated boxes independently. Clear all clears facets, leaving Lock and chain filtering intact.</p>\n <p>Filters intersect declared runtime, role, product closure and Nx build scope. Counts describe services; attached contextual nodes are counted separately. Impact uses compile-project sets, never runtime reachability. Queues and vendors are context, never source owners or CI projects.</p>\n <p>Runtime uses declared framework colors, Architecture declared roles; contextual nodes keep their kind colors. Product colors come from each project's declared product: tags; contextual nodes inherit adjacent memberships. Unknown metadata is neutral. Missing saved metadata requires explicit architecture:generate.</p>\n <p><kbd>/</kbd> Focus search · <kbd>1</kbd>–<kbd>4</kbd> modes · <kbd>Esc</kbd> dismiss or unlock</p>\n </div>`;\n return `<div class=\"wp-pop wp-help\" id=\"wp-help\" role=\"dialog\" aria-label=\"How to read this graph\" hidden>\n <header><span>Reading the graph</span><button type=\"button\" class=\"wp-icon wp-icon-mini\" id=\"wp-help-close\" aria-label=\"Close help\">✕</button></header>\n <p>Every row is one dependency level: the HIGHEST level is the top row and L0, the foundation libraries, is always the bottom row. Servers, clients and apps always form the top row (a bundle sits above the apps it aggregates). Transitive dependencies are allowed but not drawn.</p>\n <p>💡 <strong>Click any box</strong> for its menu: <strong>View Design</strong> (only where the project has a generated <strong>design.html</strong>, i.e. what the AI sees inside it), <strong>Lock/Unlock</strong> (the same lock as the Focus field), <strong>Filter Unconnected</strong> (removes unrelated boxes, keeping each L-number row).</p>\n <p><strong>Filter</strong> narrows the graph by what changed on this branch or in the last commit, by runtime, by role and by product; the groups combine. A product keeps its servers, clients and apps plus everything they depend on, so <strong>Product</strong> + <strong>Changed + dependents + dependencies</strong> is exactly what this branch builds that can affect that product. Every box keeps its own L-row, and a level left empty shows as a thin labeled band.</p>\n <p>🔦 <strong>Hover any box</strong> to trace its <em>entire</em> dependency chain — every ancestor above it and every dependency below it, with the lines between — while the rest of the graph dims.</p>\n <p><strong>Runtime</strong>: a box may depend on a box carrying every color it has. <strong>Architecture</strong>: what each box is in the system. <strong>Impact</strong>: what changed on this branch or in the last commit (amber) and its dependents (amber outline); with both available, a toggle picks which. <strong>Product</strong>: which products each box belongs to — one color per product, stripes for several, grey for every product, a dashed white box for none.</p>\n <p><kbd>/</kbd> focus the lock search · <kbd>1</kbd> <kbd>2</kbd> <kbd>3</kbd> <kbd>4</kbd> switch mode · <kbd>Esc</kbd> unlock</p>\n </div>`;\n }\n\n private brandIcon(): string {\n return (\n '<svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" aria-hidden=\"true\">' +\n '<rect x=\"1\" y=\"1\" width=\"8\" height=\"6\" rx=\"1.5\" fill=\"none\" stroke=\"#a46bf7\" stroke-width=\"1.6\"/>' +\n '<rect x=\"13\" y=\"1\" width=\"8\" height=\"6\" rx=\"1.5\" fill=\"none\" stroke=\"#e9eaf0\" stroke-width=\"1.6\"/>' +\n '<rect x=\"7\" y=\"15\" width=\"8\" height=\"6\" rx=\"1.5\" fill=\"none\" stroke=\"#e9eaf0\" stroke-width=\"1.6\"/>' +\n '<path d=\"M5 7v4h12V7M11 11v4\" fill=\"none\" stroke=\"#e9eaf0\" stroke-width=\"1.6\"/></svg>'\n );\n }\n}\n"]}
1
+ {"version":3,"file":"graph-page-shell.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-page-shell.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;AAEH,2DAAqI;AAGrI;;;;;;;;;GASG;AACH,IAAY,WAMX;AAND,WAAY,WAAW;IACnB,wCAAyB,CAAA;IACzB,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,4CAA6B,CAAA;IAC7B,8BAAe,CAAA;AACnB,CAAC,EANW,WAAW,2BAAX,WAAW,QAMtB;AAED;;;;GAIG;AACH,MAAa,WAAW;IAEA;IACA;IACA;IAHpB,YACoB,KAAkB,EAClB,KAAa,EACb,QA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C;IAEO,SAAS;QACb,OAAO,CACH,qEAAqE;YACrE,mGAAmG;YACnG,oGAAoG;YACpG,oGAAoG;YACpG,uFAAuF,CAC1F,CAAC;IACN,CAAC;CACJ;AA3LD,wCA2LC","sourcesContent":["/**\n * The architecture page's shell (#1155): a collapsible dark drawer on the left holding every control,\n * and the graph filling the rest of the viewport.\n *\n * Before this, two hint paragraphs, a ~650px three-column legend, a lock dropdown and a zoom bar all\n * sat ABOVE the graph, so a laptop's first screen showed no graph at all. Now the hints are a \"?\"\n * popover, the legend lives in the drawer (and can pop out over the graph), zoom floats bottom-right\n * (graph-navigation.ts) and the responsibilities open in a right-hand panel.\n *\n * Markup only. Behaviour is graph-visualizer.client.ts; styling is graph-page-styles.ts. No element\n * carries a `style=` attribute — every look is a class.\n */\n\nimport { FRAMEWORK_ORDER, GRAPH_MODES, GraphMode, ModeInfo, ROLE_STYLES, RoleStyle, RUNTIME_GRAPH_MODES } from './graph-color-modes';\nimport { ProductColor } from './graph-products';\n\n/**\n * The Filter popover's \"Changes on this branch\" choices. The page computes each set from the Impact\n * sidecar (graph-impact.ts): CHANGED = touched; DEPENDENTS = touched + affected (nx affected: their\n * tests re-run); DEPENDENCIES = touched + every transitive dependency of it; BUILD = touched +\n * affected + every build input — the dependencies of the DEPENDENTS too, which is why it is more than\n * the union of the two rows above it.\n *\n * \"Dependents\" are what USE a project and \"dependencies\" what it uses (#1179). \"Dependee\" would mean\n * the thing depended ON — the opposite of the dependents row — so it is never used.\n */\nexport enum ChangeScope {\n EVERYTHING = 'everything',\n CHANGED = 'changed',\n DEPENDENTS = 'dependents',\n DEPENDENCIES = 'dependencies',\n BUILD = 'build',\n}\n\n/**\n * One change scope: its name and the grey second line under it, like the Color-by menu. These are the\n * ONE copy of the labels — the page script reads each name back from its `data-wp-scope-label` (the\n * top-bar pill), so the two cannot drift apart.\n */\nexport class ScopeOption {\n constructor(\n public readonly scope: ChangeScope,\n public readonly label: string,\n public readonly subtitle: string,\n ) {}\n}\n\nexport const SCOPE_OPTIONS: readonly ScopeOption[] = [\n new ScopeOption(ChangeScope.EVERYTHING, 'All', 'every project'),\n new ScopeOption(ChangeScope.CHANGED, 'Changed', 'owns a changed file'),\n new ScopeOption(ChangeScope.DEPENDENTS, 'Changed + dependents', '+ everything that uses them (their tests re-run)'),\n new ScopeOption(ChangeScope.DEPENDENCIES, 'Changed + dependencies', '+ everything they use'),\n new ScopeOption(ChangeScope.BUILD, 'Changed + dependents + dependencies', 'everything CI builds for this branch'),\n];\n\n/** Everything the shell frames, already rendered by its owner. */\nexport class ShellParts {\n constructor(\n public readonly title: string,\n public readonly lockControl: string,\n public readonly legend: string,\n public readonly edgeKey: string,\n public readonly filterStatus: string,\n public readonly snapshot: string,\n public readonly responsibilities: string,\n /**\n * One chip per product (#1179), sorted, each colored from the page's ONE palette (#1244);\n * empty hides the Filter's Product group.\n */\n public readonly products: ProductColor[],\n public readonly runtime: boolean = false,\n public readonly frameworks: readonly string[] = FRAMEWORK_ORDER,\n public readonly roles: readonly string[] = ROLE_STYLES.map((style: RoleStyle): string => style.role),\n public readonly emptyState: string = '',\n ) {}\n}\n\nexport class GraphPageShell {\n body(parts: ShellParts): string {\n return `<div class=\"wp-shell\" id=\"wp-shell\">\n ${this.drawer(parts)}\n <main class=\"wp-main\">\n ${this.topbar(parts)}\n <div id=\"graph\"></div>\n ${this.overlays(parts)}\n </main>\n</div>`;\n }\n\n private drawer(parts: ShellParts): string {\n return `<aside class=\"wp-side\" id=\"wp-side\" aria-label=\"Graph controls\">\n <div class=\"wp-brand\">${this.brandIcon()}<span>${parts.title}</span></div>\n <div class=\"wp-group\" role=\"group\" aria-label=\"Color mode\">\n <div class=\"wp-label\">Color by</div>\n ${this.modePulldown(parts.runtime ? RUNTIME_GRAPH_MODES : GRAPH_MODES)}\n <p class=\"wp-mode-reason\" id=\"wp-impact-reason\" hidden></p>\n ${this.impactKinds('drawer')}\n </div>\n <div class=\"wp-group\">\n <button type=\"button\" class=\"wp-filter-btn\" id=\"wp-filter-open\" aria-controls=\"wp-filter-pop\" aria-expanded=\"false\"><span>Filter</span><span class=\"wp-badge\" id=\"wp-filter-badge\" hidden>0</span></button>\n </div>\n <div class=\"wp-group\">\n <label class=\"wp-label\" for=\"wp-lock\">Focus</label>\n ${parts.lockControl}\n <button type=\"button\" class=\"wp-toggle\" id=\"wp-lock-toggle\" aria-pressed=\"false\">Lock <span class=\"wp-sw\" aria-hidden=\"true\"></span></button>\n <button type=\"button\" class=\"wp-toggle\" id=\"wp-filter-toggle\" aria-pressed=\"false\">Hide unconnected <span class=\"wp-sw\" aria-hidden=\"true\"></span></button>\n </div>\n <div class=\"wp-group\">\n <div class=\"wp-label wp-label-row\">Legend <button type=\"button\" class=\"wp-icon wp-icon-mini wp-icon-dark\" id=\"wp-legend-pop\" title=\"Pop the legend out over the graph\" aria-label=\"Pop the legend out over the graph\">⇱</button></div>\n ${parts.legend}\n </div>\n <div class=\"wp-group\">\n <div class=\"wp-label\">Edges</div>\n ${parts.edgeKey}\n </div>\n <div class=\"wp-foot\">\n <button type=\"button\" class=\"wp-link\" id=\"wp-resp-open\" aria-expanded=\"false\">Responsibilities</button>\n <button type=\"button\" class=\"wp-link\" id=\"wp-snapshot-open\" aria-expanded=\"false\">Saved snapshot</button>\n </div>\n </aside>`;\n }\n\n /**\n * \"Color by\": ONE pill-shaped trigger showing the current mode (name + subtitle) that opens a\n * menu of the four. Keys 1/2/3/4 and the #runtime / #architecture / #impact / #product links still\n * switch.\n */\n private modePulldown(modes: readonly ModeInfo[]): string {\n const first = modes[0];\n return `<div class=\"wp-pulldown\">\n <button type=\"button\" class=\"wp-pill-trigger\" id=\"wp-mode-trigger\" aria-haspopup=\"menu\" aria-controls=\"wp-mode-menu\" aria-expanded=\"false\">\n <span class=\"wp-pill-text\"><span class=\"wp-mode-name\" id=\"wp-mode-current\">${first.name}</span><span class=\"wp-mode-sub\" id=\"wp-mode-current-sub\">${first.subtitle}</span></span><span class=\"wp-caret\" aria-hidden=\"true\">▾</span>\n </button>\n <div class=\"wp-menu\" id=\"wp-mode-menu\" role=\"menu\" aria-label=\"Color by\" hidden>${modes.map((info: ModeInfo, index: number): string => this.modeItem(info, index)).join('')}</div>\n </div>`;\n }\n\n /** One menu option, two lines: the mode's name, then its grey subtitle. */\n private modeItem(info: ModeInfo, index: number): string {\n const checked = info.mode === GraphMode.RUNTIME ? 'true' : 'false';\n return (\n `<button type=\"button\" class=\"wp-mode\" role=\"menuitemradio\" data-wp-mode=\"${info.mode}\" aria-checked=\"${checked}\" title=\"Key ${index + 1}\">` +\n `<span class=\"wp-mode-name\">${info.name}</span><span class=\"wp-mode-sub\">${info.subtitle}</span></button>`\n );\n }\n\n /**\n * The Filter popover. Its four groups INTERSECT: a box is shown when it is in the chosen change\n * scope AND carries any selected runtime chip (when any is selected) AND any selected role chip\n * (when any is selected) AND belongs to any selected product (when any is selected). Nothing\n * applies until \"Show N projects\".\n */\n private filterPopover(parts: ShellParts): string {\n const scopes = SCOPE_OPTIONS.map(\n (option: ScopeOption): string =>\n `<label class=\"wp-scope\"><input type=\"radio\" name=\"wp-scope\" value=\"${option.scope}\"${option.scope === ChangeScope.EVERYTHING ? ' checked' : ''}>` +\n `<span class=\"wp-scope-text\"><span class=\"wp-scope-name\" data-wp-scope-label=\"${option.scope}\">${option.label}</span>` +\n `<span class=\"wp-scope-sub\">${parts.runtime && option.scope === ChangeScope.EVERYTHING ? 'every service' : option.subtitle}</span></span>` +\n `<span class=\"wp-count\" data-wp-scope-count=\"${option.scope}\"></span></label>`,\n ).join('');\n const chips = (group: string, values: readonly string[]): string =>\n values\n .map(\n (value: string): string =>\n `<button type=\"button\" class=\"wp-chip\" data-wp-chip-group=\"${group}\" data-wp-chip=\"${value}\" aria-pressed=\"false\">${value}</button>`,\n )\n .join('');\n return `<div class=\"wp-pop wp-filter-pop\" id=\"wp-filter-pop\" role=\"dialog\" aria-label=\"Filter ${parts.runtime ? 'services' : 'projects'}\" hidden>\n <header><span>Filter</span><button type=\"button\" class=\"wp-icon wp-icon-mini\" id=\"wp-filter-close\" aria-label=\"Close the filter\">✕</button></header>\n <fieldset class=\"wp-fgroup\" id=\"wp-scope-group\"><legend id=\"wp-scope-legend\">Changes on this branch</legend>${this.impactKinds('filter')}${scopes}<p class=\"wp-scope-reason\" id=\"wp-scope-reason\" hidden></p></fieldset>\n <fieldset class=\"wp-fgroup\"><legend>Runtime <small>any match</small></legend><div class=\"wp-chips\">${chips('runtime', parts.frameworks)}</div>${parts.runtime && parts.frameworks.length === 0 ? '<p>No declared framework metadata in the saved project graph. Refresh explicitly with architecture:generate.</p>' : ''}</fieldset>\n <fieldset class=\"wp-fgroup\"><legend>Role <small>any match</small></legend><div class=\"wp-chips\">${chips('role', parts.roles)}</div></fieldset>\n ${this.productGroup(parts.products)}\n <footer><button type=\"button\" class=\"wp-text-btn\" id=\"wp-filter-clear\">Clear all</button><button type=\"button\" class=\"wp-primary\" id=\"wp-filter-apply\">Show all ${parts.runtime ? 'services' : 'projects'}</button></footer>\n </div>`;\n }\n\n /**\n * The Product group (#1179): one chip per declared product, each with its palette swatch. Several\n * chips select the UNION of their members; the group intersects with the others. Omitted when the\n * workspace declares no product.\n */\n private productGroup(products: ProductColor[]): string {\n if (products.length === 0) return '';\n const chips = products\n .map(\n (color: ProductColor): string =>\n `<button type=\"button\" class=\"wp-chip\" data-wp-chip-group=\"product\" data-wp-chip=\"${color.product}\" aria-pressed=\"false\">` +\n `<svg class=\"wp-chip-swatch\" width=\"10\" height=\"10\" viewBox=\"0 0 10 10\" aria-hidden=\"true\"><circle cx=\"5\" cy=\"5\" r=\"4.5\" fill=\"${color.color}\"/></svg>` +\n `${color.product}</button>`,\n )\n .join('');\n return `<fieldset class=\"wp-fgroup\" id=\"wp-product-group\"><legend>Product <small>any match</small></legend><div class=\"wp-chips\">${chips}</div></fieldset>`;\n }\n\n /**\n * Which Impact scan the page shows (#1163): \"Changed on this branch\" (fork point → working tree)\n * or \"Last commit\" (HEAD^ → working tree). Hidden until the page finds TWO scans in the sidecar;\n * `where` tells the drawer's copy (shown only in Impact mode) from the Filter popover's.\n */\n private impactKinds(where: string): string {\n return (\n `<div class=\"wp-chips wp-impact-kinds\" data-wp-impact-kinds=\"${where}\" role=\"group\" aria-label=\"Compare\" hidden>` +\n '<button type=\"button\" class=\"wp-chip\" data-wp-impact-kind=\"branch\" aria-pressed=\"false\">Changed on this branch</button>' +\n '<button type=\"button\" class=\"wp-chip\" data-wp-impact-kind=\"commit\" aria-pressed=\"false\">Last commit</button></div>'\n );\n }\n\n private topbar(parts: ShellParts): string {\n return `<div class=\"wp-topbar\">\n <button type=\"button\" class=\"wp-icon\" id=\"wp-collapse\" aria-label=\"Toggle the controls drawer\" aria-controls=\"wp-side\" aria-expanded=\"true\">☰</button>\n <div class=\"wp-crumb\" id=\"wp-crumb\">Mode: <b>Runtime</b></div>\n <div class=\"wp-pills\" id=\"wp-filter-pills\" aria-label=\"Active filters\"></div>\n ${parts.filterStatus}\n <button type=\"button\" class=\"wp-icon\" id=\"wp-help-btn\" aria-label=\"How to read this graph\" aria-controls=\"wp-help\" aria-expanded=\"false\">?</button>\n </div>`;\n }\n\n private overlays(parts: ShellParts): string {\n return `${parts.emptyState}<div class=\"wp-pop wp-legend-popout\" id=\"wp-legend-popout\" hidden>\n <header><span id=\"wp-legend-pop-title\">Legend · Runtime</span><button type=\"button\" class=\"wp-icon wp-icon-mini\" id=\"wp-legend-close\" aria-label=\"Close the legend\">✕</button></header>\n ${parts.legend}\n </div>\n ${this.help(parts.runtime)}\n ${this.filterPopover(parts)}\n <div class=\"wp-pop wp-snapshot\" id=\"wp-snapshot\" hidden>${parts.snapshot}</div>\n <aside class=\"wp-panel\" id=\"wp-resp-panel\" aria-label=\"Responsibilities\" hidden>\n <header><span>Responsibilities</span><button type=\"button\" class=\"wp-icon wp-icon-mini\" id=\"wp-resp-close\" aria-label=\"Close responsibilities\">✕</button></header>\n ${parts.responsibilities}\n </aside>`;\n }\n\n /** The two hint paragraphs that used to sit above the graph, plus the keyboard shortcuts. */\n private help(runtime: boolean): string {\n if (runtime) return `<div class=\"wp-pop wp-help\" id=\"wp-help\" role=\"dialog\" aria-label=\"How to read this graph\" hidden>\n <header><span>Reading the runtime graph</span><button type=\"button\" class=\"wp-icon wp-icon-mini\" id=\"wp-help-close\" aria-label=\"Close help\">✕</button></header>\n <p>Rows preserve saved runtime call-depth levels. Boxes are services; horizontal cylinders are queues, upright cylinders datastores, and clocks scheduled triggers. Solid arrows are RPC calls, dashed arrows queued events; red arrows admit legacy cycles.</p>\n <p>Click a box for Lock, Filter Unconnected, or Implements. Implements in the box is a plain summary. Click Uses on a relationship line for its complete details. Hover traces chains without opening details.</p>\n <p>Lock pins separate incoming and outgoing chains; hover adds another chain temporarily. Hide unconnected removes unrelated boxes independently. Clear all clears facets, leaving Lock and chain filtering intact.</p>\n <p>Filters intersect declared runtime, role, product closure and Nx build scope. Counts describe services; attached contextual nodes are counted separately. Impact uses compile-project sets, never runtime reachability. Queues and vendors are context, never source owners or CI projects.</p>\n <p>Runtime uses declared framework colors, Architecture declared roles; contextual nodes keep their kind colors. Product colors come from each project's declared product: tags; contextual nodes inherit adjacent memberships. Unknown metadata is neutral. Missing saved metadata requires explicit architecture:generate.</p>\n <p><strong>Goal vs Current</strong> compares the saved goal (architecture/runtime-dependencies-goal.json) with the saved current graph, Current → Goal: green added, red dashed removed (still drawn), amber changed, grey unchanged. Click a box for its before/after details, or click an arrow.</p>\n <p><kbd>/</kbd> Focus search · <kbd>1</kbd>–<kbd>5</kbd> modes · <kbd>Esc</kbd> dismiss or unlock</p>\n </div>`;\n return `<div class=\"wp-pop wp-help\" id=\"wp-help\" role=\"dialog\" aria-label=\"How to read this graph\" hidden>\n <header><span>Reading the graph</span><button type=\"button\" class=\"wp-icon wp-icon-mini\" id=\"wp-help-close\" aria-label=\"Close help\">✕</button></header>\n <p>Every row is one dependency level: the HIGHEST level is the top row and L0, the foundation libraries, is always the bottom row. Servers, clients and apps always form the top row (a bundle sits above the apps it aggregates). Transitive dependencies are allowed but not drawn.</p>\n <p>💡 <strong>Click any box</strong> for its menu: <strong>View Design</strong> (only where the project has a generated <strong>design.html</strong>, i.e. what the AI sees inside it), <strong>Lock/Unlock</strong> (the same lock as the Focus field), <strong>Filter Unconnected</strong> (removes unrelated boxes, keeping each L-number row).</p>\n <p><strong>Filter</strong> narrows the graph by what changed on this branch or in the last commit, by runtime, by role and by product; the groups combine. A product keeps its servers, clients and apps plus everything they depend on, so <strong>Product</strong> + <strong>Changed + dependents + dependencies</strong> is exactly what this branch builds that can affect that product. Every box keeps its own L-row, and a level left empty shows as a thin labeled band.</p>\n <p>🔦 <strong>Hover any box</strong> to trace its <em>entire</em> dependency chain — every ancestor above it and every dependency below it, with the lines between — while the rest of the graph dims.</p>\n <p><strong>Runtime</strong>: a box may depend on a box carrying every color it has. <strong>Architecture</strong>: what each box is in the system. <strong>Impact</strong>: what changed on this branch or in the last commit (amber) and its dependents (amber outline); with both available, a toggle picks which. <strong>Product</strong>: which products each box belongs to — one color per product, stripes for several, grey for every product, a dashed white box for none.</p>\n <p><kbd>/</kbd> focus the lock search · <kbd>1</kbd> <kbd>2</kbd> <kbd>3</kbd> <kbd>4</kbd> switch mode · <kbd>Esc</kbd> unlock</p>\n </div>`;\n }\n\n private brandIcon(): string {\n return (\n '<svg width=\"22\" height=\"22\" viewBox=\"0 0 22 22\" aria-hidden=\"true\">' +\n '<rect x=\"1\" y=\"1\" width=\"8\" height=\"6\" rx=\"1.5\" fill=\"none\" stroke=\"#a46bf7\" stroke-width=\"1.6\"/>' +\n '<rect x=\"13\" y=\"1\" width=\"8\" height=\"6\" rx=\"1.5\" fill=\"none\" stroke=\"#e9eaf0\" stroke-width=\"1.6\"/>' +\n '<rect x=\"7\" y=\"15\" width=\"8\" height=\"6\" rx=\"1.5\" fill=\"none\" stroke=\"#e9eaf0\" stroke-width=\"1.6\"/>' +\n '<path d=\"M5 7v4h12V7M11 11v4\" fill=\"none\" stroke=\"#e9eaf0\" stroke-width=\"1.6\"/></svg>'\n );\n }\n}\n"]}
@@ -15,9 +15,10 @@
15
15
  * declared `product:` tags. A service is never put in a product because another service calls it or
16
16
  * feeds its queue; a call from one product into another product's service shows as the runtime EDGE
17
17
  * between them. A service whose project carries no tag is in no product.
18
- * - ProductPalette — colors derived only from the product name, shared by both viewers. Adding or
19
- * removing another product never reassigns an existing color. Neutral means shared by EVERY
20
- * product; a dashed white box belongs to none.
18
+ * - ProductPalette — the Product color mode's colors (#1244): eight fixed saturated colors, each
19
+ * product hashed (SHA-256 of its name) to a preferred one, with collisions resolved in sorted-name
20
+ * order. Both viewers build it over the FULL declared product set, so they agree. Neutral means
21
+ * shared by EVERY product; a dashed white box belongs to none.
21
22
  * - ProductBoundary — which dependency edges cross from one product into another (#1204), drawn
22
23
  * dashed in the target product's color in the Product color mode.
23
24
  *
@@ -33,6 +34,14 @@ export declare class ProductColor {
33
34
  readonly fontColor: string;
34
35
  constructor(product: string, color: string, fontColor: string);
35
36
  }
37
+ /** One of the palette's eight colors, and the text color that reads on it. Data-only. */
38
+ export declare class ProductPaletteSlot {
39
+ readonly color: string;
40
+ readonly fontColor: string;
41
+ constructor(color: string, fontColor: string);
42
+ }
43
+ /** The eight product colors, indexed by slot. Distinct from every runtime and role color. */
44
+ export declare const PRODUCT_PALETTE_SLOTS: readonly ProductPaletteSlot[];
36
45
  /** A box shared by EVERY product. */
37
46
  export declare const PRODUCT_SHARED_FILL = "#c9ced8";
38
47
  /** A box in no product: white, with a dashed border. */
@@ -41,7 +50,17 @@ export declare const PRODUCT_NONE_BORDER = "#8a90a0";
41
50
  export declare class ProductPalette {
42
51
  /** Every declared product, sorted, each with its color. */
43
52
  readonly colors: ProductColor[];
53
+ /**
54
+ * @param products the FULL declared product set. Collision resolution depends on the set, so a
55
+ * viewer showing a subset must still pass every declared product, or its colors would
56
+ * disagree with the other viewer's.
57
+ */
44
58
  constructor(products: readonly string[]);
59
+ /** The slot a product's name hashes to: SHA-256 of the name, first byte, mod the palette size. */
60
+ preferredSlot(product: string): number;
61
+ /** The preferred slot when free, else the next free one (wrapping); with all taken, the preferred one. */
62
+ private freeSlot;
63
+ private paint;
45
64
  /** Every product carried by a project of the graph, as one palette. */
46
65
  static fromGraph(graph: EnhancedGraph): ProductPalette;
47
66
  names(): string[];
@@ -16,9 +16,10 @@
16
16
  * declared `product:` tags. A service is never put in a product because another service calls it or
17
17
  * feeds its queue; a call from one product into another product's service shows as the runtime EDGE
18
18
  * between them. A service whose project carries no tag is in no product.
19
- * - ProductPalette — colors derived only from the product name, shared by both viewers. Adding or
20
- * removing another product never reassigns an existing color. Neutral means shared by EVERY
21
- * product; a dashed white box belongs to none.
19
+ * - ProductPalette — the Product color mode's colors (#1244): eight fixed saturated colors, each
20
+ * product hashed (SHA-256 of its name) to a preferred one, with collisions resolved in sorted-name
21
+ * order. Both viewers build it over the FULL declared product set, so they agree. Neutral means
22
+ * shared by EVERY product; a dashed white box belongs to none.
22
23
  * - ProductBoundary — which dependency edges cross from one product into another (#1204), drawn
23
24
  * dashed in the target product's color in the Product color mode.
24
25
  *
@@ -26,12 +27,13 @@
26
27
  * the committed dependencies.json / runtime-dependencies.json rather than into a sidecar.
27
28
  */
28
29
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.RuntimeProductMembership = exports.ProductMembership = exports.ProductBoundary = exports.ProductPalette = exports.PRODUCT_NONE_BORDER = exports.PRODUCT_NONE_FILL = exports.PRODUCT_SHARED_FILL = exports.ProductColor = void 0;
30
+ exports.RuntimeProductMembership = exports.ProductMembership = exports.ProductBoundary = exports.ProductPalette = exports.PRODUCT_NONE_BORDER = exports.PRODUCT_NONE_FILL = exports.PRODUCT_SHARED_FILL = exports.PRODUCT_PALETTE_SLOTS = exports.ProductPaletteSlot = exports.ProductColor = void 0;
30
31
  const node_crypto_1 = require("node:crypto");
31
- // The same dark text color graph-color-modes.ts writes on light fills. Spelled here rather than
32
+ // The same two text colors graph-color-modes.ts writes on every fill. Spelled here rather than
32
33
  // imported because graph-color-modes.ts imports THIS file (for the palette), and a file-import cycle
33
34
  // is refused by `no-file-import-cycles`.
34
35
  const DARK_TEXT = '#1a1c22';
36
+ const LIGHT_TEXT = '#ffffff';
35
37
  /** One product's color, and the text color that reads on it. Data-only. */
36
38
  class ProductColor {
37
39
  product;
@@ -44,6 +46,27 @@ class ProductColor {
44
46
  }
45
47
  }
46
48
  exports.ProductColor = ProductColor;
49
+ /** One of the palette's eight colors, and the text color that reads on it. Data-only. */
50
+ class ProductPaletteSlot {
51
+ color;
52
+ fontColor;
53
+ constructor(color, fontColor) {
54
+ this.color = color;
55
+ this.fontColor = fontColor;
56
+ }
57
+ }
58
+ exports.ProductPaletteSlot = ProductPaletteSlot;
59
+ /** The eight product colors, indexed by slot. Distinct from every runtime and role color. */
60
+ exports.PRODUCT_PALETTE_SLOTS = [
61
+ new ProductPaletteSlot('#3f6fb5', LIGHT_TEXT),
62
+ new ProductPaletteSlot('#f28e2b', DARK_TEXT),
63
+ new ProductPaletteSlot('#c0392b', LIGHT_TEXT),
64
+ new ProductPaletteSlot('#5cb8b2', DARK_TEXT),
65
+ new ProductPaletteSlot('#3d8b3d', LIGHT_TEXT),
66
+ new ProductPaletteSlot('#edc948', DARK_TEXT),
67
+ new ProductPaletteSlot('#8e5ea2', LIGHT_TEXT),
68
+ new ProductPaletteSlot('#ff9da7', DARK_TEXT),
69
+ ];
47
70
  /** A box shared by EVERY product. */
48
71
  exports.PRODUCT_SHARED_FILL = '#c9ced8';
49
72
  /** A box in no product: white, with a dashed border. */
@@ -52,9 +75,36 @@ exports.PRODUCT_NONE_BORDER = '#8a90a0';
52
75
  class ProductPalette {
53
76
  /** Every declared product, sorted, each with its color. */
54
77
  colors;
78
+ /**
79
+ * @param products the FULL declared product set. Collision resolution depends on the set, so a
80
+ * viewer showing a subset must still pass every declared product, or its colors would
81
+ * disagree with the other viewer's.
82
+ */
55
83
  constructor(products) {
56
84
  const sorted = [...new Set(products)].sort();
57
- this.colors = sorted.map((product) => this.colorOf(product));
85
+ const taken = new Set();
86
+ this.colors = sorted.map((product) => {
87
+ const slot = this.freeSlot(this.preferredSlot(product), taken);
88
+ taken.add(slot);
89
+ return this.paint(product, slot);
90
+ });
91
+ }
92
+ /** The slot a product's name hashes to: SHA-256 of the name, first byte, mod the palette size. */
93
+ preferredSlot(product) {
94
+ return (0, node_crypto_1.createHash)('sha256').update(product, 'utf8').digest()[0] % exports.PRODUCT_PALETTE_SLOTS.length;
95
+ }
96
+ /** The preferred slot when free, else the next free one (wrapping); with all taken, the preferred one. */
97
+ freeSlot(preferred, taken) {
98
+ for (let step = 0; step < exports.PRODUCT_PALETTE_SLOTS.length; step++) {
99
+ const slot = (preferred + step) % exports.PRODUCT_PALETTE_SLOTS.length;
100
+ if (!taken.has(slot))
101
+ return slot;
102
+ }
103
+ return preferred;
104
+ }
105
+ paint(product, slot) {
106
+ const entry = exports.PRODUCT_PALETTE_SLOTS[slot];
107
+ return new ProductColor(product, entry.color, entry.fontColor);
58
108
  }
59
109
  /** Every product carried by a project of the graph, as one palette. */
60
110
  // webpieces-disable no-function-outside-class -- static factory of this class
@@ -68,13 +118,13 @@ class ProductPalette {
68
118
  return this.colors.map((color) => color.product);
69
119
  }
70
120
  colorOf(product) {
71
- // SHA-256 and these channel bounds are the assignment contract. Never use the product's
72
- // index, the graph's product set, or collision resolution: each would recolor other products.
73
- const digest = (0, node_crypto_1.createHash)('sha256').update(product, 'utf8').digest();
74
- // Keep every channel light enough for dark text, including text spanning product stripes.
75
- const channels = [digest[0], digest[1], digest[2]].map((value) => 136 + value % 96);
76
- const color = '#' + channels.map((value) => value.toString(16).padStart(2, '0')).join('');
77
- return new ProductColor(product, color, DARK_TEXT);
121
+ // The assignment contract (#1244): the slot SHA-256 of the name prefers, with collisions
122
+ // resolved in sorted-name order over the whole set — the earlier name keeps a contested slot,
123
+ // the later takes the next free one. So adding a product recolors nobody unless it hashes onto
124
+ // a taken slot AND sorts before its holder. Never assign by sorted index: every addition would
125
+ // shift every later product. A product outside the set gets its preferred slot.
126
+ return (this.colors.find((color) => color.product === product) ??
127
+ this.paint(product, this.preferredSlot(product)));
78
128
  }
79
129
  /** True for a box carrying every product of a workspace that declares two or more. */
80
130
  sharedByAll(products) {
@@ -1 +1 @@
1
- {"version":3,"file":"graph-products.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-products.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;;;AAEH,6CAAyC;AAIzC,gGAAgG;AAChG,qGAAqG;AACrG,yCAAyC;AACzC,MAAM,SAAS,GAAG,SAAS,CAAC;AAE5B,2EAA2E;AAC3E,MAAa,YAAY;IAED;IACA;IACA;IAHpB,YACoB,OAAe,EACf,KAAa,EACb,SAAiB;QAFjB,YAAO,GAAP,OAAO,CAAQ;QACf,UAAK,GAAL,KAAK,CAAQ;QACb,cAAS,GAAT,SAAS,CAAQ;IAClC,CAAC;CACP;AAND,oCAMC;AAED,qCAAqC;AACxB,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAC7C,wDAAwD;AAC3C,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAC9B,QAAA,mBAAmB,GAAG,SAAS,CAAC;AAE7C,MAAa,cAAc;IACvB,2DAA2D;IAClD,MAAM,CAAiB;IAEhC,YAAY,QAA2B;QACnC,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,OAAe,EAAgB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IACvF,CAAC;IAED,uEAAuE;IACvE,8EAA8E;IAC9E,MAAM,CAAC,SAAS,CAAC,KAAoB;QACjC,MAAM,GAAG,GAAa,EAAE,CAAC;QACzB,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAA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AM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,IAAI,EAAE,CAAC;YAChD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACrE,CAAC;IACL,CAAC;CACJ;AAZD,4DAYC","sourcesContent":["/**\n * Products on the architecture graphs (#1179).\n *\n * A monorepo can hold several PRODUCTS, each with its own clients and servers. A project declares the\n * products it belongs to with the nx tag `product:<name>` (product-resolver.ts). Membership is TAGS\n * ONLY (#1216) on both graphs — nothing is inherited over an edge:\n *\n * - ProductMembership — the dependency graph. A project's products are exactly its own declared\n * `product:` tags. An UNTAGGED project is in no product, however many tagged projects depend on it,\n * and renders as \"no product\" — a box that still needs a tag. A consumer that wants every project\n * assigned lists the library roles in `product-tags.roles`, so an untagged library fails generation\n * instead of quietly sitting outside every product (and outside the product dependency matrix,\n * which skips any edge with an untagged end — product-dependencies.ts).\n * - RuntimeProductMembership — the runtime graph. A service's products are exactly its project's\n * declared `product:` tags. A service is never put in a product because another service calls it or\n * feeds its queue; a call from one product into another product's service shows as the runtime EDGE\n * between them. A service whose project carries no tag is in no product.\n * - ProductPalette — colors derived only from the product name, shared by both viewers. Adding or\n * removing another product never reassigns an existing color. Neutral means shared by EVERY\n * product; a dashed white box belongs to none.\n * - ProductBoundary — which dependency edges cross from one product into another (#1204), drawn\n * dashed in the target product's color in the Product color mode.\n *\n * Membership is stable per checkout (it depends on tags only, never on a diff), so it is written into\n * the committed dependencies.json / runtime-dependencies.json rather than into a sidecar.\n */\n\nimport { createHash } from 'node:crypto';\nimport type { EnhancedGraph } from './graph-sorter';\nimport type { RuntimeGraph } from './runtime-graph-model';\n\n// The same dark text color graph-color-modes.ts writes on light fills. Spelled here rather than\n// imported because graph-color-modes.ts imports THIS file (for the palette), and a file-import cycle\n// is refused by `no-file-import-cycles`.\nconst DARK_TEXT = '#1a1c22';\n\n/** One product's color, and the text color that reads on it. Data-only. */\nexport class ProductColor {\n constructor(\n public readonly product: string,\n public readonly color: string,\n public readonly fontColor: string,\n ) {}\n}\n\n/** A box shared by EVERY product. */\nexport const PRODUCT_SHARED_FILL = '#c9ced8';\n/** A box in no product: white, with a dashed border. */\nexport const PRODUCT_NONE_FILL = '#ffffff';\nexport const PRODUCT_NONE_BORDER = '#8a90a0';\n\nexport class ProductPalette {\n /** Every declared product, sorted, each with its color. */\n readonly colors: ProductColor[];\n\n constructor(products: readonly string[]) {\n const sorted = [...new Set(products)].sort();\n this.colors = sorted.map((product: string): ProductColor => this.colorOf(product));\n }\n\n /** Every product carried by a project of the graph, as one palette. */\n // webpieces-disable no-function-outside-class -- static factory of this class\n static fromGraph(graph: EnhancedGraph): ProductPalette {\n const all: string[] = [];\n for (const entry of Object.values(graph)) all.push(...(entry.products ?? []));\n return new ProductPalette(all);\n }\n\n names(): string[] {\n return this.colors.map((color: ProductColor): string => color.product);\n }\n\n colorOf(product: string): ProductColor {\n // SHA-256 and these channel bounds are the assignment contract. Never use the product's\n // index, the graph's product set, or collision resolution: each would recolor other products.\n const digest = createHash('sha256').update(product, 'utf8').digest();\n // Keep every channel light enough for dark text, including text spanning product stripes.\n const channels = [digest[0], digest[1], digest[2]].map((value: number): number => 136 + value % 96);\n const color = '#' + channels.map((value: number): string => value.toString(16).padStart(2, '0')).join('');\n return new ProductColor(product, color, DARK_TEXT);\n }\n\n /** True for a box carrying every product of a workspace that declares two or more. */\n sharedByAll(products: readonly string[]): boolean {\n return this.colors.length > 1 && this.colors.every((color: ProductColor): boolean => products.includes(color.product));\n }\n}\n\n/**\n * Where a dependency edge crosses a product boundary (#1204), for the Product color mode: an edge\n * A -> B crosses when B does not carry every product of A, and it is drawn dashed in the color of the\n * product it crosses INTO, so the boundaries read at a glance while same-product edges stay quiet.\n * Whether a crossing is ALLOWED is the product dependency matrix's call (product-dependencies.ts):\n * with `product-tags` ON, generation already refused every crossing the matrix does not allow, so\n * every crossing drawn is an allowed one.\n */\nexport class ProductBoundary {\n /** The product the edge crosses into, or null when the target carries every product of the source. */\n crossedInto(from: readonly string[], to: readonly string[]): string | null {\n if (from.length === 0 || to.length === 0) return null;\n if (from.every((product: string): boolean => to.includes(product))) return null;\n return to.find((product: string): boolean => !from.includes(product)) ?? to[0];\n }\n}\n\n/**\n * The architecture graph's product membership: exactly each project's declared `product:` tags (#1216).\n */\nexport class ProductMembership {\n /**\n * @param seeds project → the products it DECLARES (its `product:` tags)\n * @returns project → its sorted declared products. An untagged project is absent — it is in no\n * product, however many tagged projects depend on it — so with no tag anywhere the map is\n * empty.\n */\n compute(seeds: ReadonlyMap<string, readonly string[]>, graph: EnhancedGraph): Map<string, string[]> {\n const result = new Map<string, string[]>();\n seeds.forEach((products: readonly string[], project: string): void => {\n if (products.length > 0 && graph[project] !== undefined) result.set(project, [...new Set(products)].sort());\n });\n return result;\n }\n}\n\n/**\n * The runtime graph's product membership: exactly each service's project's declared `product:` tags\n * (#1216). Never derived from who calls a service or feeds its queue.\n */\nexport class RuntimeProductMembership {\n /**\n * Stamp `products` onto every service of `graph` whose project declares any. `projects` is the\n * dependency graph, whose `products` are exactly each project's declared tags (ProductMembership);\n * a service whose project declares none gets no field.\n */\n apply(graph: RuntimeGraph, projects: EnhancedGraph): void {\n for (const [name, service] of Object.entries(graph.services)) {\n const declared = projects[name]?.products ?? [];\n if (declared.length > 0) service.products = [...declared].sort();\n }\n }\n}\n"]}
1
+ {"version":3,"file":"graph-products.js","sourceRoot":"","sources":["../../../../../../packages/tooling/nx-webpieces-rules/src/lib/graph-products.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AAEH,6CAAyC;AAIzC,+FAA+F;AAC/F,qGAAqG;AACrG,yCAAyC;AACzC,MAAM,SAAS,GAAG,SAAS,CAAC;AAC5B,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B,2EAA2E;AAC3E,MAAa,YAAY;IAED;IACA;I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AI,CAAC,CAAC,OAAe,EAAW,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC;CACJ;AAPD,0CAOC;AAED;;GAEG;AACH,MAAa,iBAAiB;IAC1B;;;;;OAKG;IACH,OAAO,CAAC,KAA6C,EAAE,KAAoB;QACvE,MAAM,MAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC,QAA2B,EAAE,OAAe,EAAQ,EAAE;YACjE,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,SAAS;gBAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAChH,CAAC,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AAdD,8CAcC;AAED;;;GAGG;AACH,MAAa,wBAAwB;IACjC;;;;OAIG;IACH,KAAK,CAAC,KAAmB,EAAE,QAAuB;QAC9C,KAAK,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC3D,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,QAAQ,IAAI,EAAE,CAAC;YAChD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;gBAAE,OAAO,CAAC,QAAQ,GAAG,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAC;QACrE,CAAC;IACL,CAAC;CACJ;AAZD,4DAYC","sourcesContent":["/**\n * Products on the architecture graphs (#1179).\n *\n * A monorepo can hold several PRODUCTS, each with its own clients and servers. A project declares the\n * products it belongs to with the nx tag `product:<name>` (product-resolver.ts). Membership is TAGS\n * ONLY (#1216) on both graphs — nothing is inherited over an edge:\n *\n * - ProductMembership — the dependency graph. A project's products are exactly its own declared\n * `product:` tags. An UNTAGGED project is in no product, however many tagged projects depend on it,\n * and renders as \"no product\" — a box that still needs a tag. A consumer that wants every project\n * assigned lists the library roles in `product-tags.roles`, so an untagged library fails generation\n * instead of quietly sitting outside every product (and outside the product dependency matrix,\n * which skips any edge with an untagged end — product-dependencies.ts).\n * - RuntimeProductMembership — the runtime graph. A service's products are exactly its project's\n * declared `product:` tags. A service is never put in a product because another service calls it or\n * feeds its queue; a call from one product into another product's service shows as the runtime EDGE\n * between them. A service whose project carries no tag is in no product.\n * - ProductPalette — the Product color mode's colors (#1244): eight fixed saturated colors, each\n * product hashed (SHA-256 of its name) to a preferred one, with collisions resolved in sorted-name\n * order. Both viewers build it over the FULL declared product set, so they agree. Neutral means\n * shared by EVERY product; a dashed white box belongs to none.\n * - ProductBoundary — which dependency edges cross from one product into another (#1204), drawn\n * dashed in the target product's color in the Product color mode.\n *\n * Membership is stable per checkout (it depends on tags only, never on a diff), so it is written into\n * the committed dependencies.json / runtime-dependencies.json rather than into a sidecar.\n */\n\nimport { createHash } from 'node:crypto';\nimport type { EnhancedGraph } from './graph-sorter';\nimport type { RuntimeGraph } from './runtime-graph-model';\n\n// The same two text colors graph-color-modes.ts writes on every fill. Spelled here rather than\n// imported because graph-color-modes.ts imports THIS file (for the palette), and a file-import cycle\n// is refused by `no-file-import-cycles`.\nconst DARK_TEXT = '#1a1c22';\nconst LIGHT_TEXT = '#ffffff';\n\n/** One product's color, and the text color that reads on it. Data-only. */\nexport class ProductColor {\n constructor(\n public readonly product: string,\n public readonly color: string,\n public readonly fontColor: string,\n ) {}\n}\n\n/** One of the palette's eight colors, and the text color that reads on it. Data-only. */\nexport class ProductPaletteSlot {\n constructor(\n public readonly color: string,\n public readonly fontColor: string,\n ) {}\n}\n\n/** The eight product colors, indexed by slot. Distinct from every runtime and role color. */\nexport const PRODUCT_PALETTE_SLOTS: readonly ProductPaletteSlot[] = [\n new ProductPaletteSlot('#3f6fb5', LIGHT_TEXT),\n new ProductPaletteSlot('#f28e2b', DARK_TEXT),\n new ProductPaletteSlot('#c0392b', LIGHT_TEXT),\n new ProductPaletteSlot('#5cb8b2', DARK_TEXT),\n new ProductPaletteSlot('#3d8b3d', LIGHT_TEXT),\n new ProductPaletteSlot('#edc948', DARK_TEXT),\n new ProductPaletteSlot('#8e5ea2', LIGHT_TEXT),\n new ProductPaletteSlot('#ff9da7', DARK_TEXT),\n];\n\n/** A box shared by EVERY product. */\nexport const PRODUCT_SHARED_FILL = '#c9ced8';\n/** A box in no product: white, with a dashed border. */\nexport const PRODUCT_NONE_FILL = '#ffffff';\nexport const PRODUCT_NONE_BORDER = '#8a90a0';\n\nexport class ProductPalette {\n /** Every declared product, sorted, each with its color. */\n readonly colors: ProductColor[];\n\n /**\n * @param products the FULL declared product set. Collision resolution depends on the set, so a\n * viewer showing a subset must still pass every declared product, or its colors would\n * disagree with the other viewer's.\n */\n constructor(products: readonly string[]) {\n const sorted = [...new Set(products)].sort();\n const taken = new Set<number>();\n this.colors = sorted.map((product: string): ProductColor => {\n const slot = this.freeSlot(this.preferredSlot(product), taken);\n taken.add(slot);\n return this.paint(product, slot);\n });\n }\n\n /** The slot a product's name hashes to: SHA-256 of the name, first byte, mod the palette size. */\n preferredSlot(product: string): number {\n return createHash('sha256').update(product, 'utf8').digest()[0] % PRODUCT_PALETTE_SLOTS.length;\n }\n\n /** The preferred slot when free, else the next free one (wrapping); with all taken, the preferred one. */\n private freeSlot(preferred: number, taken: ReadonlySet<number>): number {\n for (let step = 0; step < PRODUCT_PALETTE_SLOTS.length; step++) {\n const slot = (preferred + step) % PRODUCT_PALETTE_SLOTS.length;\n if (!taken.has(slot)) return slot;\n }\n return preferred;\n }\n\n private paint(product: string, slot: number): ProductColor {\n const entry = PRODUCT_PALETTE_SLOTS[slot];\n return new ProductColor(product, entry.color, entry.fontColor);\n }\n\n /** Every product carried by a project of the graph, as one palette. */\n // webpieces-disable no-function-outside-class -- static factory of this class\n static fromGraph(graph: EnhancedGraph): ProductPalette {\n const all: string[] = [];\n for (const entry of Object.values(graph)) all.push(...(entry.products ?? []));\n return new ProductPalette(all);\n }\n\n names(): string[] {\n return this.colors.map((color: ProductColor): string => color.product);\n }\n\n colorOf(product: string): ProductColor {\n // The assignment contract (#1244): the slot SHA-256 of the name prefers, with collisions\n // resolved in sorted-name order over the whole set — the earlier name keeps a contested slot,\n // the later takes the next free one. So adding a product recolors nobody unless it hashes onto\n // a taken slot AND sorts before its holder. Never assign by sorted index: every addition would\n // shift every later product. A product outside the set gets its preferred slot.\n return (\n this.colors.find((color: ProductColor): boolean => color.product === product) ??\n this.paint(product, this.preferredSlot(product))\n );\n }\n\n /** True for a box carrying every product of a workspace that declares two or more. */\n sharedByAll(products: readonly string[]): boolean {\n return this.colors.length > 1 && this.colors.every((color: ProductColor): boolean => products.includes(color.product));\n }\n}\n\n/**\n * Where a dependency edge crosses a product boundary (#1204), for the Product color mode: an edge\n * A -> B crosses when B does not carry every product of A, and it is drawn dashed in the color of the\n * product it crosses INTO, so the boundaries read at a glance while same-product edges stay quiet.\n * Whether a crossing is ALLOWED is the product dependency matrix's call (product-dependencies.ts):\n * with `product-tags` ON, generation already refused every crossing the matrix does not allow, so\n * every crossing drawn is an allowed one.\n */\nexport class ProductBoundary {\n /** The product the edge crosses into, or null when the target carries every product of the source. */\n crossedInto(from: readonly string[], to: readonly string[]): string | null {\n if (from.length === 0 || to.length === 0) return null;\n if (from.every((product: string): boolean => to.includes(product))) return null;\n return to.find((product: string): boolean => !from.includes(product)) ?? to[0];\n }\n}\n\n/**\n * The architecture graph's product membership: exactly each project's declared `product:` tags (#1216).\n */\nexport class ProductMembership {\n /**\n * @param seeds project → the products it DECLARES (its `product:` tags)\n * @returns project → its sorted declared products. An untagged project is absent — it is in no\n * product, however many tagged projects depend on it — so with no tag anywhere the map is\n * empty.\n */\n compute(seeds: ReadonlyMap<string, readonly string[]>, graph: EnhancedGraph): Map<string, string[]> {\n const result = new Map<string, string[]>();\n seeds.forEach((products: readonly string[], project: string): void => {\n if (products.length > 0 && graph[project] !== undefined) result.set(project, [...new Set(products)].sort());\n });\n return result;\n }\n}\n\n/**\n * The runtime graph's product membership: exactly each service's project's declared `product:` tags\n * (#1216). Never derived from who calls a service or feeds its queue.\n */\nexport class RuntimeProductMembership {\n /**\n * Stamp `products` onto every service of `graph` whose project declares any. `projects` is the\n * dependency graph, whose `products` are exactly each project's declared tags (ProductMembership);\n * a service whose project declares none gets no field.\n */\n apply(graph: RuntimeGraph, projects: EnhancedGraph): void {\n for (const [name, service] of Object.entries(graph.services)) {\n const declared = projects[name]?.products ?? [];\n if (declared.length > 0) service.products = [...declared].sort();\n }\n }\n}\n"]}
@@ -56,6 +56,8 @@ export declare class GraphRenderModel {
56
56
  footer: string;
57
57
  /** The colors and roles in use, so the page's legend lists exactly those (architecture graph). */
58
58
  legend: LegendFacts;
59
+ /** Runtime pages only (#1239): the Goal vs Current overlay, or why it is unavailable. */
60
+ comparison: RuntimeComparisonView | null;
59
61
  node(id: string, dot: string, products?: string[], queueKeys?: string[]): string;
60
62
  /**
61
63
  * Every product a declared box (a queue, a cron trigger, an external system) inherits from the
@@ -74,6 +76,45 @@ export declare class GraphRenderModel {
74
76
  */
75
77
  edge(from: string, to: string, dot: string, productAttrs?: string): string;
76
78
  }
79
+ /**
80
+ * What a runtime page carries for its Goal vs Current color mode (#1239), serialized into the page
81
+ * with the render model so it works opened straight from disk (`file://`, no fetch).
82
+ *
83
+ * Never a silent "no differences": an unavailable comparison says why (a missing or unusable input,
84
+ * naming its path and repair), and identical inputs say so explicitly with the normal graph context.
85
+ */
86
+ export declare class RuntimeComparisonView {
87
+ readonly available: boolean;
88
+ /** Why the mode is unavailable; '' when available. */
89
+ readonly reason: string;
90
+ /** Always "Current → Goal": the direction every added/removed word is read in. */
91
+ readonly direction: string;
92
+ /** One line: counts per status, or the explicit no-differences result. */
93
+ readonly summary: string;
94
+ /** The overlay drawn in this mode; null when unavailable. */
95
+ readonly model: GraphRenderModel | null;
96
+ /** Overlay render-node id -> before/after detail lines. */
97
+ readonly nodeDetails: Record<string, string[]>;
98
+ /** Overlay render-edge id (`wp-real-edge-N`) -> before/after detail lines. */
99
+ readonly edgeDetails: Record<string, string[]>;
100
+ /** Every added, removed and changed fact, one line each, for the legend. */
101
+ readonly differences: string[];
102
+ constructor(available: boolean,
103
+ /** Why the mode is unavailable; '' when available. */
104
+ reason: string,
105
+ /** Always "Current → Goal": the direction every added/removed word is read in. */
106
+ direction: string,
107
+ /** One line: counts per status, or the explicit no-differences result. */
108
+ summary: string,
109
+ /** The overlay drawn in this mode; null when unavailable. */
110
+ model: GraphRenderModel | null,
111
+ /** Overlay render-node id -> before/after detail lines. */
112
+ nodeDetails: Record<string, string[]>,
113
+ /** Overlay render-edge id (`wp-real-edge-N`) -> before/after detail lines. */
114
+ edgeDetails: Record<string, string[]>,
115
+ /** Every added, removed and changed fact, one line each, for the legend. */
116
+ differences: string[]);
117
+ }
77
118
  /** Shared filter chrome and script-safe JSON for pages opened directly from disk. */
78
119
  export declare class GraphFilterAssets {
79
120
  json<T>(value: T): string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GraphFilterAssets = exports.GraphRenderModel = exports.RenderEdge = exports.NodeTags = exports.RenderNode = void 0;
3
+ exports.GraphFilterAssets = exports.RuntimeComparisonView = exports.GraphRenderModel = exports.RenderEdge = exports.NodeTags = exports.RenderNode = void 0;
4
4
  const dot_syntax_1 = require("./dot-syntax");
5
5
  const graph_color_modes_1 = require("./graph-color-modes");
6
6
  /**
@@ -74,6 +74,8 @@ class GraphRenderModel {
74
74
  footer = '';
75
75
  /** The colors and roles in use, so the page's legend lists exactly those (architecture graph). */
76
76
  legend = new graph_color_modes_1.LegendFacts();
77
+ /** Runtime pages only (#1239): the Goal vs Current overlay, or why it is unavailable. */
78
+ comparison = null;
77
79
  node(id, dot, products = [], queueKeys = []) {
78
80
  this.nodes.push(new RenderNode(id, dot, null, null, products, queueKeys));
79
81
  return dot;
@@ -136,6 +138,48 @@ class GraphRenderModel {
136
138
  }
137
139
  }
138
140
  exports.GraphRenderModel = GraphRenderModel;
141
+ /**
142
+ * What a runtime page carries for its Goal vs Current color mode (#1239), serialized into the page
143
+ * with the render model so it works opened straight from disk (`file://`, no fetch).
144
+ *
145
+ * Never a silent "no differences": an unavailable comparison says why (a missing or unusable input,
146
+ * naming its path and repair), and identical inputs say so explicitly with the normal graph context.
147
+ */
148
+ class RuntimeComparisonView {
149
+ available;
150
+ reason;
151
+ direction;
152
+ summary;
153
+ model;
154
+ nodeDetails;
155
+ edgeDetails;
156
+ differences;
157
+ constructor(available,
158
+ /** Why the mode is unavailable; '' when available. */
159
+ reason,
160
+ /** Always "Current → Goal": the direction every added/removed word is read in. */
161
+ direction,
162
+ /** One line: counts per status, or the explicit no-differences result. */
163
+ summary,
164
+ /** The overlay drawn in this mode; null when unavailable. */
165
+ model,
166
+ /** Overlay render-node id -> before/after detail lines. */
167
+ nodeDetails,
168
+ /** Overlay render-edge id (`wp-real-edge-N`) -> before/after detail lines. */
169
+ edgeDetails,
170
+ /** Every added, removed and changed fact, one line each, for the legend. */
171
+ differences) {
172
+ this.available = available;
173
+ this.reason = reason;
174
+ this.direction = direction;
175
+ this.summary = summary;
176
+ this.model = model;
177
+ this.nodeDetails = nodeDetails;
178
+ this.edgeDetails = edgeDetails;
179
+ this.differences = differences;
180
+ }
181
+ }
182
+ exports.RuntimeComparisonView = RuntimeComparisonView;
139
183
  /** Shared filter chrome and script-safe JSON for pages opened directly from disk. */
140
184
  class GraphFilterAssets {
141
185
  json(value) {