@zenfg/inspector 0.1.0-beta.2 → 0.1.0-beta.3

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 (62) hide show
  1. package/README.md +63 -1
  2. package/dist/FrameGraphInspector.d.ts +2 -5
  3. package/dist/FrameGraphInspector.d.ts.map +1 -1
  4. package/dist/FrameGraphInspector.js +16 -38
  5. package/dist/FrameGraphInspector.js.map +1 -1
  6. package/dist/debugCaptureModel.d.ts +9 -4
  7. package/dist/debugCaptureModel.d.ts.map +1 -1
  8. package/dist/debugCaptureModel.js +36 -14
  9. package/dist/debugCaptureModel.js.map +1 -1
  10. package/dist/panelCytoscapeGraphRenderer.d.ts +3 -1
  11. package/dist/panelCytoscapeGraphRenderer.d.ts.map +1 -1
  12. package/dist/panelCytoscapeGraphRenderer.js +39 -19
  13. package/dist/panelCytoscapeGraphRenderer.js.map +1 -1
  14. package/dist/panelDiagnosticsView.js +2 -2
  15. package/dist/panelDiagnosticsView.js.map +1 -1
  16. package/dist/panelGraphLayout.d.ts.map +1 -1
  17. package/dist/panelGraphLayout.js +15 -1
  18. package/dist/panelGraphLayout.js.map +1 -1
  19. package/dist/panelGraphScene.d.ts +14 -26
  20. package/dist/panelGraphScene.d.ts.map +1 -1
  21. package/dist/panelGraphScene.js +141 -195
  22. package/dist/panelGraphScene.js.map +1 -1
  23. package/dist/panelGraphView.d.ts.map +1 -1
  24. package/dist/panelGraphView.js +31 -9
  25. package/dist/panelGraphView.js.map +1 -1
  26. package/dist/panelGraphVisuals.d.ts +7 -3
  27. package/dist/panelGraphVisuals.d.ts.map +1 -1
  28. package/dist/panelGraphVisuals.js +45 -80
  29. package/dist/panelGraphVisuals.js.map +1 -1
  30. package/dist/panelInspectorView.d.ts +5 -0
  31. package/dist/panelInspectorView.d.ts.map +1 -1
  32. package/dist/panelInspectorView.js +99 -13
  33. package/dist/panelInspectorView.js.map +1 -1
  34. package/dist/panelSelection.js +2 -2
  35. package/dist/panelSelection.js.map +1 -1
  36. package/dist/panelTypes.d.ts +8 -3
  37. package/dist/panelTypes.d.ts.map +1 -1
  38. package/dist/panelTypes.js.map +1 -1
  39. package/dist/panelVisualTheme.d.ts +21 -13
  40. package/dist/panelVisualTheme.d.ts.map +1 -1
  41. package/dist/panelVisualTheme.js +15 -7
  42. package/dist/panelVisualTheme.js.map +1 -1
  43. package/dist/panelWorkbenchHelpers.js +1 -1
  44. package/dist/panelWorkbenchHelpers.js.map +1 -1
  45. package/dist/styles.d.ts.map +1 -1
  46. package/dist/styles.js +16 -12
  47. package/dist/styles.js.map +1 -1
  48. package/package.json +2 -2
  49. package/src/FrameGraphInspector.ts +17 -39
  50. package/src/debugCaptureModel.ts +44 -19
  51. package/src/panelCytoscapeGraphRenderer.ts +38 -18
  52. package/src/panelDiagnosticsView.ts +3 -3
  53. package/src/panelGraphLayout.ts +15 -1
  54. package/src/panelGraphScene.ts +153 -279
  55. package/src/panelGraphView.ts +31 -9
  56. package/src/panelGraphVisuals.ts +46 -82
  57. package/src/panelInspectorView.ts +104 -16
  58. package/src/panelSelection.ts +2 -2
  59. package/src/panelTypes.ts +9 -3
  60. package/src/panelVisualTheme.ts +18 -7
  61. package/src/panelWorkbenchHelpers.ts +2 -2
  62. package/src/styles.ts +16 -12
@@ -1,4 +1,5 @@
1
1
  import { GRAPH_VISUAL_THEME } from "./panelVisualTheme.js";
2
+ import { declarationEntrances } from "./debugCaptureModel.js";
2
3
  export { GRAPH_VISUAL_THEME } from "./panelVisualTheme.js";
3
4
  export const GRAPH_GEOMETRY = {
4
5
  fitPadding: 28,
@@ -10,6 +11,8 @@ export const GRAPH_GEOMETRY = {
10
11
  groupPadding: 32,
11
12
  elkGroupPadding: { top: 46, right: 24, bottom: 24, left: 24 },
12
13
  edgeCornerRadius: 6,
14
+ outputWidth: 256,
15
+ outputLabelWidth: 144,
13
16
  };
14
17
  const ENDPOINT_EDGE_DISTANCES = 'endpoints';
15
18
  const EDGE_SEGMENT_RADII = `${GRAPH_GEOMETRY.edgeCornerRadius}px`;
@@ -19,50 +22,39 @@ const NODE_LEGEND_ENTRIES = {
19
22
  copy: nodeLegend('copy', 'Copy', GRAPH_VISUAL_THEME.copy.stroke),
20
23
  'clear-buffer': nodeLegend('clear', 'Clear', GRAPH_VISUAL_THEME.clear.stroke),
21
24
  command: nodeLegend('command', 'Command', GRAPH_VISUAL_THEME.command.stroke),
22
- 'external-submission': nodeLegend('external', 'External', GRAPH_VISUAL_THEME.external.stroke),
25
+ 'external-submission': { ...nodeLegend('external', 'External', GRAPH_VISUAL_THEME.external.stroke), shape: 'cut-rectangle' },
23
26
  };
24
- export function createGraphLegend(scene) {
27
+ export function createGraphLegend(snapshot) {
25
28
  const entries = [];
26
- const passKinds = new Set(scene.nodes.flatMap((node) => node.kind === 'pass' || node.kind === 'culled-pass'
27
- ? [node.passKind]
28
- : []));
29
+ const passKinds = new Set(snapshot.nodes.map((node) => node.kind));
29
30
  for (const kind of ['render', 'compute', 'copy', 'clear-buffer', 'command', 'external-submission']) {
30
31
  if (passKinds.has(kind))
31
32
  entries.push(NODE_LEGEND_ENTRIES[kind]);
32
33
  }
33
- if (scene.nodes.some((node) => node.kind === 'group')) {
34
- entries.push({ key: 'group', label: 'Group', color: GRAPH_VISUAL_THEME.group.stroke, shape: 'group' });
34
+ const retained = new Set(snapshot.nodes.map((node) => node.id));
35
+ const used = new Set([
36
+ ...snapshot.accessEdges.filter((access) => retained.has(access.nodeId)).map((access) => access.resource.id),
37
+ ...snapshot.roots.flatMap((root) => root.resource ? [root.resource.id] : []),
38
+ ]);
39
+ const resources = snapshot.resources.filter((resource) => used.has(resource.id));
40
+ if (resources.length)
41
+ entries.push({ group: 'Resources', key: 'declaration', label: 'Declaration', color: GRAPH_VISUAL_THEME.declaration.stroke, shape: 'ellipse' });
42
+ if (snapshot.roots.some((root) => root.resource))
43
+ entries.push({ group: 'Resources', key: 'output', label: 'Output', color: GRAPH_VISUAL_THEME.output.stroke, shape: 'tag' });
44
+ if ([...snapshot.nodes, ...resources].some((item) => item.debugGroupId !== undefined)) {
45
+ entries.push({ group: 'Relationships', key: 'group', label: 'Group', color: GRAPH_VISUAL_THEME.group.stroke, shape: 'group' });
35
46
  }
36
- if (scene.nodes.some((node) => node.kind === 'resource' && node.resourceKind === 'texture')) {
37
- entries.push({ key: 'texture', label: 'Texture', color: GRAPH_VISUAL_THEME.texture.stroke, shape: 'ellipse' });
47
+ if (snapshot.edges.some((edge) => edge.kind === 'value')
48
+ || declarationEntrances(snapshot.nodes, snapshot.accessEdges, snapshot.edges).length
49
+ || snapshot.roots.some((root) => root.resource && root.resolution && (root.resolution.usesInitialContents || root.resolution.producerNodeIds.length))) {
50
+ entries.push(edgeLegend('flow', 'Resource Flow', GRAPH_VISUAL_THEME.dependency.value, 'solid'));
38
51
  }
39
- if (scene.nodes.some((node) => node.kind === 'resource' && node.resourceKind === 'buffer')) {
40
- entries.push({ key: 'buffer', label: 'Buffer', color: GRAPH_VISUAL_THEME.buffer.stroke, shape: 'ellipse' });
41
- }
42
- if (scene.nodes.some((node) => node.kind === 'culled-pass')) {
43
- entries.push({
44
- key: 'culled',
45
- label: 'Culled',
46
- color: GRAPH_VISUAL_THEME.culled.stroke,
47
- shape: 'box',
48
- lineStyle: 'dashed',
49
- });
50
- }
51
- if (scene.edges.some((edge) => edge.kind === 'dependency' && edge.dependencyKind === 'value')) {
52
- entries.push(edgeLegend('value', 'Value', GRAPH_VISUAL_THEME.dependency.value, 'solid'));
53
- }
54
- if (scene.edges.some((edge) => edge.kind === 'dependency' && edge.dependencyKind === 'ordering')) {
52
+ if (snapshot.edges.some((edge) => edge.kind === 'ordering')) {
55
53
  entries.push({
56
54
  ...edgeLegend('ordering', 'Order', GRAPH_VISUAL_THEME.dependency.ordering, 'dotted'),
57
55
  hollowArrow: true,
58
56
  });
59
57
  }
60
- if (scene.edges.some((edge) => edge.kind === 'access' && edge.accessMode === 'read')) {
61
- entries.push(edgeLegend('read', 'Read', GRAPH_VISUAL_THEME.access.read, 'solid'));
62
- }
63
- if (scene.edges.some((edge) => edge.kind === 'access' && edge.accessMode === 'write')) {
64
- entries.push(edgeLegend('write', 'Write', GRAPH_VISUAL_THEME.access.write, 'solid'));
65
- }
66
58
  return entries;
67
59
  }
68
60
  export function createGraphStyles() {
@@ -84,6 +76,7 @@ export function createGraphStyles() {
84
76
  'background-color': theme.surfaceRaised,
85
77
  'border-color': theme.group.stroke,
86
78
  'border-width': 1.25,
79
+ 'border-style': 'solid',
87
80
  'text-valign': 'center',
88
81
  'text-halign': 'center',
89
82
  'overlay-opacity': 0,
@@ -100,34 +93,27 @@ export function createGraphStyles() {
100
93
  style: {
101
94
  'background-color': theme.external.fill,
102
95
  'border-color': theme.external.stroke,
103
- 'border-style': 'double',
104
- 'border-width': 3,
105
- },
106
- },
107
- {
108
- selector: 'node[kind = "culled-pass"]',
109
- style: {
110
- 'background-color': theme.culled.fill,
111
- 'border-color': theme.culled.stroke,
112
- 'color': theme.muted,
113
- 'border-style': 'dashed',
114
- 'opacity': 0.72,
96
+ 'shape': 'cut-rectangle',
97
+ 'corner-radius': '10px',
115
98
  },
116
99
  },
117
100
  {
118
- selector: 'node[kind = "resource"][resourceKind = "texture"]',
101
+ selector: 'node[kind = "resource"]',
119
102
  style: {
120
103
  'shape': 'ellipse',
121
- 'background-color': theme.texture.fill,
122
- 'border-color': theme.texture.stroke,
104
+ 'background-color': theme.declaration.fill,
105
+ 'border-color': theme.declaration.stroke,
123
106
  },
124
107
  },
125
108
  {
126
- selector: 'node[kind = "resource"][resourceKind = "buffer"]',
109
+ selector: 'node[kind = "root"]',
127
110
  style: {
128
- 'shape': 'ellipse',
129
- 'background-color': theme.buffer.fill,
130
- 'border-color': theme.buffer.stroke,
111
+ 'shape': 'tag',
112
+ 'background-color': theme.output.fill,
113
+ 'border-color': theme.output.stroke,
114
+ 'text-max-width': `${GRAPH_GEOMETRY.outputLabelWidth}px`,
115
+ // Native tag shoulders sit at 5/8 of its width. Center text in the rectangular body.
116
+ 'text-margin-x': -GRAPH_GEOMETRY.outputWidth * 3 / 16,
131
117
  },
132
118
  },
133
119
  {
@@ -178,7 +164,7 @@ export function createGraphStyles() {
178
164
  },
179
165
  },
180
166
  {
181
- selector: 'edge[dependencyKind = "ordering"]',
167
+ selector: 'edge[kind = "ordering"]',
182
168
  style: {
183
169
  'line-color': theme.dependency.ordering,
184
170
  'target-arrow-color': theme.dependency.ordering,
@@ -187,24 +173,6 @@ export function createGraphStyles() {
187
173
  'line-opacity': 0.72,
188
174
  },
189
175
  },
190
- {
191
- selector: 'edge[accessMode = "read"]',
192
- style: {
193
- 'line-color': theme.access.read,
194
- 'target-arrow-color': theme.access.read,
195
- },
196
- },
197
- {
198
- selector: 'edge[accessMode = "write"]',
199
- style: {
200
- 'line-color': theme.access.write,
201
- 'target-arrow-color': theme.access.write,
202
- },
203
- },
204
- {
205
- selector: 'edge[dashed = 1]',
206
- style: { 'line-style': 'dashed', 'line-opacity': 0.46, 'opacity': 0.58 },
207
- },
208
176
  {
209
177
  selector: 'edge.elk-route',
210
178
  style: {
@@ -245,9 +213,6 @@ export function createGraphStyles() {
245
213
  style: {
246
214
  'border-color': theme.selected,
247
215
  'border-width': 3,
248
- 'underlay-color': theme.selected,
249
- 'underlay-padding': 5,
250
- 'underlay-opacity': 0.18,
251
216
  'opacity': 1,
252
217
  'z-index': 20,
253
218
  },
@@ -268,10 +233,10 @@ export function nodeDimensions(node) {
268
233
  switch (node.kind) {
269
234
  case 'pass':
270
235
  return { width: 184, height: node.label.includes('\n') ? 62 : 48 };
271
- case 'culled-pass':
272
- return { width: 184, height: 64 };
236
+ case 'root':
237
+ return { width: GRAPH_GEOMETRY.outputWidth, height: Math.max(58, node.label.split('\n').length * 17 + 24) };
273
238
  case 'resource':
274
- return { width: 166, height: node.label.includes('\n') ? 58 : 46 };
239
+ return { width: 184, height: Math.max(58, node.label.split('\n').length * 17 + 24) };
275
240
  case 'group':
276
241
  return node.collapsed ? { width: 224, height: 68 } : { width: 120, height: 80 };
277
242
  }
@@ -281,12 +246,12 @@ export function graphLayoutGeometryKey(scene) {
281
246
  topology: scene.topologyKey,
282
247
  dimensions: scene.nodes.map((node) => {
283
248
  const dimensions = nodeDimensions(node);
284
- return [node.id, dimensions.width, dimensions.height];
249
+ return [node.id, dimensions.width, dimensions.height, node.kind === 'pass' && node.passKind === 'external-submission'];
285
250
  }),
286
251
  });
287
252
  }
288
- export function graphEdgeDisplayLabel(edge) {
289
- return edge.kind === 'access' ? '' : edge.label ?? '';
253
+ export function graphEdgeDisplayLabel(_edge) {
254
+ return '';
290
255
  }
291
256
  export function expandedGroupLabelMaxWidth(outerWidth) {
292
257
  return Math.max(80, Math.floor(outerWidth - GRAPH_GEOMETRY.groupTitleInset * 2));
@@ -295,10 +260,10 @@ export function isOverviewGraphScale(zoom) {
295
260
  return GRAPH_GEOMETRY.baseFontSize * zoom < GRAPH_GEOMETRY.overviewFontThreshold;
296
261
  }
297
262
  function nodeLegend(key, label, color) {
298
- return { key, label, color, shape: 'box' };
263
+ return { group: 'Execution', key, label, color, shape: 'box' };
299
264
  }
300
265
  function edgeLegend(key, label, color, lineStyle) {
301
- return { key, label, color, shape: 'line', lineStyle };
266
+ return { group: 'Relationships', key, label, color, shape: 'line', lineStyle };
302
267
  }
303
268
  function passStyle(kind, colors) {
304
269
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"panelGraphVisuals.js","sourceRoot":"","sources":["../src/panelGraphVisuals.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,EAAE;IAChB,qBAAqB,EAAE,CAAC;IACxB,qBAAqB,EAAE,CAAC;IACxB,eAAe,EAAE,CAAC;IAClB,oBAAoB,EAAE,GAAG;IACzB,YAAY,EAAE,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AI,IAAI;QACtC,KAAK,EAAE,EAAE,kBAAkB,EAAE,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE;KAC5E,CAAC;AACN,CAAC;AAED,SAAS,kBAAkB,CAAC,eAAuB;IAC/C,MAAM,QAAQ,GAAG,cAAc,CAAC;IAChC,OAAO;QACH,kBAAkB,EAAE,eAAe;QACnC,oBAAoB,EAAE,IAAI;QAC1B,cAAc,EAAE,kBAAkB,CAAC,KAAK,CAAC,MAAM;QAC/C,cAAc,EAAE,GAAG;QACnB,SAAS,EAAE,GAAG,QAAQ,CAAC,YAAY,IAAI;QACvC,4BAA4B,EAAE,SAAS;QACvC,WAAW,EAAE,OAAO;QACpB,YAAY,EAAE,MAAM;QACpB,aAAa,EAAE,YAAY;QAC3B,aAAa,EAAE,aAAa;QAC5B,oBAAoB,EAAE,MAAM;QAC5B,eAAe,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,YAAY,GAAG,CAAC;QACrE,eAAe,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,YAAY,GAAG,CAAC;QACrE,aAAa,EAAE,QAAQ,CAAC,oBAAoB;QAC5C,OAAO,EAAE,kBAAkB,CAAC,IAAI;QAChC,aAAa,EAAE,GAAG;KACrB,CAAC;AACN,CAAC","sourcesContent":["import type cytoscape from 'cytoscape';\n\nimport type { GraphScene, GraphSceneEdge, GraphSceneNode } from './panelGraphScene.ts';\nimport { GRAPH_VISUAL_THEME } from './panelVisualTheme.ts';\n\nexport { GRAPH_VISUAL_THEME } from './panelVisualTheme.ts';\n\n\nexport const GRAPH_GEOMETRY = {\n fitPadding: 28,\n baseFontSize: 13,\n overviewFontThreshold: 9,\n minimumZoomedFontSize: 5,\n groupTitleInset: 8,\n groupTitleLineHeight: 1.2,\n groupPadding: 32,\n elkGroupPadding: { top: 46, right: 24, bottom: 24, left: 24 },\n edgeCornerRadius: 6,\n} as const;\n\nconst ENDPOINT_EDGE_DISTANCES = 'endpoints' as unknown as cytoscape.Css.Edge['edge-distances'];\nconst EDGE_SEGMENT_RADII = `${GRAPH_GEOMETRY.edgeCornerRadius}px` as unknown as cytoscape.Css.Edge['segment-radii'];\n\nexport type GraphLegendEntry = {\n readonly key: string;\n readonly label: string;\n readonly color: string;\n readonly shape: 'box' | 'ellipse' | 'group' | 'line';\n readonly lineStyle?: 'solid' | 'dotted' | 'dashed';\n readonly hollowArrow?: boolean;\n};\n\nconst NODE_LEGEND_ENTRIES = {\n render: nodeLegend('render', 'Render', GRAPH_VISUAL_THEME.render.stroke),\n compute: nodeLegend('compute', 'Compute', GRAPH_VISUAL_THEME.compute.stroke),\n copy: nodeLegend('copy', 'Copy', GRAPH_VISUAL_THEME.copy.stroke),\n 'clear-buffer': nodeLegend('clear', 'Clear', GRAPH_VISUAL_THEME.clear.stroke),\n command: nodeLegend('command', 'Command', GRAPH_VISUAL_THEME.command.stroke),\n 'external-submission': nodeLegend('external', 'External', GRAPH_VISUAL_THEME.external.stroke),\n} as const;\n\nexport function createGraphLegend(scene: GraphScene): readonly GraphLegendEntry[] {\n const entries: GraphLegendEntry[] = [];\n const passKinds = new Set(scene.nodes.flatMap((node) => node.kind === 'pass' || node.kind === 'culled-pass'\n ? [node.passKind]\n : []));\n for (const kind of ['render', 'compute', 'copy', 'clear-buffer', 'command', 'external-submission'] as const) {\n if (passKinds.has(kind)) entries.push(NODE_LEGEND_ENTRIES[kind]);\n }\n if (scene.nodes.some((node) => node.kind === 'group')) {\n entries.push({ key: 'group', label: 'Group', color: GRAPH_VISUAL_THEME.group.stroke, shape: 'group' });\n }\n if (scene.nodes.some((node) => node.kind === 'resource' && node.resourceKind === 'texture')) {\n entries.push({ key: 'texture', label: 'Texture', color: GRAPH_VISUAL_THEME.texture.stroke, shape: 'ellipse' });\n }\n if (scene.nodes.some((node) => node.kind === 'resource' && node.resourceKind === 'buffer')) {\n entries.push({ key: 'buffer', label: 'Buffer', color: GRAPH_VISUAL_THEME.buffer.stroke, shape: 'ellipse' });\n }\n if (scene.nodes.some((node) => node.kind === 'culled-pass')) {\n entries.push({\n key: 'culled',\n label: 'Culled',\n color: GRAPH_VISUAL_THEME.culled.stroke,\n shape: 'box',\n lineStyle: 'dashed',\n });\n }\n if (scene.edges.some((edge) => edge.kind === 'dependency' && edge.dependencyKind === 'value')) {\n entries.push(edgeLegend('value', 'Value', GRAPH_VISUAL_THEME.dependency.value, 'solid'));\n }\n if (scene.edges.some((edge) => edge.kind === 'dependency' && edge.dependencyKind === 'ordering')) {\n entries.push({\n ...edgeLegend('ordering', 'Order', GRAPH_VISUAL_THEME.dependency.ordering, 'dotted'),\n hollowArrow: true,\n });\n }\n if (scene.edges.some((edge) => edge.kind === 'access' && edge.accessMode === 'read')) {\n entries.push(edgeLegend('read', 'Read', GRAPH_VISUAL_THEME.access.read, 'solid'));\n }\n if (scene.edges.some((edge) => edge.kind === 'access' && edge.accessMode === 'write')) {\n entries.push(edgeLegend('write', 'Write', GRAPH_VISUAL_THEME.access.write, 'solid'));\n }\n return entries;\n}\n\nexport function createGraphStyles(): cytoscape.StylesheetJson {\n const theme = GRAPH_VISUAL_THEME;\n return [\n {\n selector: 'node',\n style: {\n 'shape': 'round-rectangle',\n 'width': 'data(width)',\n 'height': 'data(height)',\n 'label': 'data(displayLabel)',\n 'text-wrap': 'wrap',\n 'text-max-width': '160px',\n 'font-family': 'ui-monospace, SFMono-Regular, Consolas, Liberation Mono, monospace',\n 'font-size': GRAPH_GEOMETRY.baseFontSize,\n 'min-zoomed-font-size': GRAPH_GEOMETRY.minimumZoomedFontSize,\n 'color': theme.text,\n 'background-color': theme.surfaceRaised,\n 'border-color': theme.group.stroke,\n 'border-width': 1.25,\n 'text-valign': 'center',\n 'text-halign': 'center',\n 'overlay-opacity': 0,\n 'underlay-opacity': 0,\n },\n },\n passStyle('render', theme.render),\n passStyle('compute', theme.compute),\n passStyle('copy', theme.copy),\n passStyle('clear-buffer', theme.clear),\n passStyle('command', theme.command),\n {\n selector: 'node[passKind = \"external-submission\"]',\n style: {\n 'background-color': theme.external.fill,\n 'border-color': theme.external.stroke,\n 'border-style': 'double',\n 'border-width': 3,\n },\n },\n {\n selector: 'node[kind = \"culled-pass\"]',\n style: {\n 'background-color': theme.culled.fill,\n 'border-color': theme.culled.stroke,\n 'color': theme.muted,\n 'border-style': 'dashed',\n 'opacity': 0.72,\n },\n },\n {\n selector: 'node[kind = \"resource\"][resourceKind = \"texture\"]',\n style: {\n 'shape': 'ellipse',\n 'background-color': theme.texture.fill,\n 'border-color': theme.texture.stroke,\n },\n },\n {\n selector: 'node[kind = \"resource\"][resourceKind = \"buffer\"]',\n style: {\n 'shape': 'ellipse',\n 'background-color': theme.buffer.fill,\n 'border-color': theme.buffer.stroke,\n },\n },\n {\n selector: 'node[kind = \"group\"]',\n style: {\n 'text-max-width': (element: cytoscape.SingularElementArgument) => `${element.data('labelMaxWidth') as number}px`,\n },\n },\n {\n selector: 'node[kind = \"group\"][collapsed = 1]',\n style: {\n 'background-color': theme.group.fill,\n 'border-color': theme.group.stroke,\n 'border-width': 2,\n 'color': theme.text,\n },\n },\n {\n selector: 'node[kind = \"group\"][collapsed = 0]',\n style: expandedGroupStyle(theme.group.fill),\n },\n {\n selector: 'node[kind = \"group\"][collapsed = 0][depthBand = 1]',\n style: { 'background-color': theme.group.alternateFill },\n },\n {\n selector: 'edge',\n style: {\n 'width': 1.5,\n 'line-color': theme.dependency.value,\n 'line-opacity': 0.82,\n 'target-arrow-color': theme.dependency.value,\n 'target-arrow-shape': 'triangle',\n 'target-arrow-fill': 'filled',\n 'arrow-scale': 0.8,\n 'curve-style': 'straight',\n 'label': 'data(displayLabel)',\n 'font-family': 'ui-monospace, SFMono-Regular, Consolas, Liberation Mono, monospace',\r\n 'font-size': 10,\n 'min-zoomed-font-size': GRAPH_GEOMETRY.minimumZoomedFontSize,\n 'color': theme.text,\n 'text-background-color': theme.canvas,\n 'text-background-opacity': 0.82,\n 'text-background-padding': '2px',\n 'text-rotation': 'autorotate',\n 'overlay-opacity': 0,\n 'underlay-opacity': 0,\n },\n },\n {\n selector: 'edge[dependencyKind = \"ordering\"]',\n style: {\n 'line-color': theme.dependency.ordering,\n 'target-arrow-color': theme.dependency.ordering,\n 'line-style': 'dotted',\n 'target-arrow-fill': 'hollow',\n 'line-opacity': 0.72,\n },\n },\n {\n selector: 'edge[accessMode = \"read\"]',\n style: {\n 'line-color': theme.access.read,\n 'target-arrow-color': theme.access.read,\n },\n },\n {\n selector: 'edge[accessMode = \"write\"]',\n style: {\n 'line-color': theme.access.write,\n 'target-arrow-color': theme.access.write,\n },\n },\n {\n selector: 'edge[dashed = 1]',\n style: { 'line-style': 'dashed', 'line-opacity': 0.46, 'opacity': 0.58 },\n },\n {\n selector: 'edge.elk-route',\n style: {\n 'source-endpoint': 'data(sourceEndpoint)',\n 'target-endpoint': 'data(targetEndpoint)',\n 'edge-distances': ENDPOINT_EDGE_DISTANCES,\n },\n },\n {\n selector: 'edge.elk-segments',\n style: {\n 'curve-style': 'round-segments',\n 'segment-distances': 'data(segmentDistances)',\n 'segment-weights': 'data(segmentWeights)',\n 'segment-radii': EDGE_SEGMENT_RADII,\n },\n },\n {\n selector: 'node.semantic-hover',\n style: {\n 'border-color': theme.hover,\n 'border-width': 2,\n 'z-index': 15,\n },\n },\n {\n selector: 'edge.semantic-hover',\n style: {\n 'line-color': theme.hover,\n 'target-arrow-color': theme.hover,\n 'line-opacity': 1,\n 'width': 2.5,\n 'z-index': 15,\n },\n },\n {\n selector: 'node.semantic-selected',\n style: {\n 'border-color': theme.selected,\n 'border-width': 3,\n 'underlay-color': theme.selected,\n 'underlay-padding': 5,\n 'underlay-opacity': 0.18,\n 'opacity': 1,\n 'z-index': 20,\n },\n },\n {\n selector: 'edge.semantic-selected',\n style: {\n 'line-color': theme.selected,\n 'target-arrow-color': theme.selected,\n 'line-opacity': 1,\n 'width': 3,\n 'z-index': 20,\n },\n },\n ];\n}\n\nexport function nodeDimensions(node: GraphSceneNode): { readonly width: number; readonly height: number } {\n switch (node.kind) {\n case 'pass':\n return { width: 184, height: node.label.includes('\\n') ? 62 : 48 };\n case 'culled-pass':\n return { width: 184, height: 64 };\n case 'resource':\n return { width: 166, height: node.label.includes('\\n') ? 58 : 46 };\n case 'group':\n return node.collapsed ? { width: 224, height: 68 } : { width: 120, height: 80 };\n }\n}\n\nexport function graphLayoutGeometryKey(scene: GraphScene): string {\n return JSON.stringify({\n topology: scene.topologyKey,\n dimensions: scene.nodes.map((node) => {\n const dimensions = nodeDimensions(node);\n return [node.id, dimensions.width, dimensions.height];\n }),\n });\n}\n\nexport function graphEdgeDisplayLabel(edge: GraphSceneEdge): string {\n return edge.kind === 'access' ? '' : edge.label ?? '';\n}\n\nexport function expandedGroupLabelMaxWidth(outerWidth: number): number {\n return Math.max(80, Math.floor(outerWidth - GRAPH_GEOMETRY.groupTitleInset * 2));\n}\n\nexport function isOverviewGraphScale(zoom: number): boolean {\n return GRAPH_GEOMETRY.baseFontSize * zoom < GRAPH_GEOMETRY.overviewFontThreshold;\n}\n\nfunction nodeLegend(key: string, label: string, color: string): GraphLegendEntry {\n return { key, label, color, shape: 'box' };\n}\n\nfunction edgeLegend(\n key: string,\n label: string,\n color: string,\n lineStyle: NonNullable<GraphLegendEntry['lineStyle']>,\n): GraphLegendEntry {\n return { key, label, color, shape: 'line', lineStyle };\n}\n\nfunction passStyle(\n kind: string,\n colors: { readonly stroke: string; readonly fill: string },\n): cytoscape.StylesheetStyle {\n return {\n selector: `node[passKind = \"${kind}\"]`,\n style: { 'background-color': colors.fill, 'border-color': colors.stroke },\n };\n}\n\nfunction expandedGroupStyle(backgroundColor: string): cytoscape.Css.Node {\n const geometry = GRAPH_GEOMETRY;\n return {\n 'background-color': backgroundColor,\n 'background-opacity': 0.34,\n 'border-color': GRAPH_VISUAL_THEME.group.stroke,\n 'border-width': 1.5,\n 'padding': `${geometry.groupPadding}px`,\n 'compound-sizing-wrt-labels': 'include',\n 'min-width': '120px',\n 'min-height': '80px',\n 'text-valign': 'top-inside',\n 'text-halign': 'left-inside',\n 'text-justification': 'left',\n 'text-margin-x': geometry.groupTitleInset - geometry.groupPadding * 2,\n 'text-margin-y': geometry.groupTitleInset - geometry.groupPadding * 2,\n 'line-height': geometry.groupTitleLineHeight,\n 'color': GRAPH_VISUAL_THEME.text,\n 'font-weight': 600,\n };\n}\n"]}
1
+ {"version":3,"file":"panelGraphVisuals.js","sourceRoot":"","sources":["../src/panelGraphVisuals.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAiC,MAAM,wBAAwB,CAAC;AAE7F,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG3D,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,UAAU,EAAE,EAAE;IACd,YAAY,EAAE,EAAE;IAChB,qBAAqB,EAAE,CAAC;IACxB,qBAAqB,EAAE,CAAC;IACxB,eAAe,EAAE,CAAC;IAClB,oBAAoB,EAAE,GAAG;IACzB,YAAY,EAAE,EAAE;IAChB,eAAe,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;IAC7D,gBAAgB,EAAE,CAAC;IACnB,WAAW,EAAE,GAAG;IAChB,gBAAgB,EAAE,GAAG;CACf,CAAC;AAEX,MAAM,uBAAuB,GAAG,WAA8D,CAAC;AAC/F,MAAM,kBAAkB,GAAG,GAAG,cAAc,CAAC,gBAAgB,IAAsD,CAAC;AAYpH,MAAM,mBAAmB,GAAG;IACxB,MAAM,EAAE,UAAU,CAAC,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC;IACxE,OAAO,EAAE,UAAU,CAAC,SAAS,EAAE,SAAS,EAAE,kBAAkB,CAAC,OAAO,CAAC,MAAM,CAAC;IAC5E,IAAI,EAAE,UAAU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EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AACnF,CAAC;AAED,SAAS,SAAS,CACd,IAAY,EACZ,MAA0D;IAE1D,OAAO;QACH,QAAQ,EAAE,oBAAoB,IAAI,IAAI;QACtC,KAAK,EAAE,EAAE,kBAAkB,EAAE,MAAM,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE;KAC5E,CAAC;AACN,CAAC;AAED,SAAS,kBAAkB,CAAC,eAAuB;IAC/C,MAAM,QAAQ,GAAG,cAAc,CAAC;IAChC,OAAO;QACH,kBAAkB,EAAE,eAAe;QACnC,oBAAoB,EAAE,IAAI;QAC1B,cAAc,EAAE,kBAAkB,CAAC,KAAK,CAAC,MAAM;QAC/C,cAAc,EAAE,GAAG;QACnB,SAAS,EAAE,GAAG,QAAQ,CAAC,YAAY,IAAI;QACvC,4BAA4B,EAAE,SAAS;QACvC,WAAW,EAAE,OAAO;QACpB,YAAY,EAAE,MAAM;QACpB,aAAa,EAAE,YAAY;QAC3B,aAAa,EAAE,aAAa;QAC5B,oBAAoB,EAAE,MAAM;QAC5B,eAAe,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,YAAY,GAAG,CAAC;QACrE,eAAe,EAAE,QAAQ,CAAC,eAAe,GAAG,QAAQ,CAAC,YAAY,GAAG,CAAC;QACrE,aAAa,EAAE,QAAQ,CAAC,oBAAoB;QAC5C,OAAO,EAAE,kBAAkB,CAAC,IAAI;QAChC,aAAa,EAAE,GAAG;KACrB,CAAC;AACN,CAAC","sourcesContent":["import type cytoscape from 'cytoscape';\n\nimport type { GraphScene, GraphSceneEdge, GraphSceneNode } from './panelGraphScene.ts';\nimport { GRAPH_VISUAL_THEME } from './panelVisualTheme.ts';\nimport { declarationEntrances, type FrameGraphDebugViewModel } from './debugCaptureModel.ts';\n\nexport { GRAPH_VISUAL_THEME } from './panelVisualTheme.ts';\n\n\nexport const GRAPH_GEOMETRY = {\n fitPadding: 28,\n baseFontSize: 13,\n overviewFontThreshold: 9,\n minimumZoomedFontSize: 5,\n groupTitleInset: 8,\n groupTitleLineHeight: 1.2,\n groupPadding: 32,\n elkGroupPadding: { top: 46, right: 24, bottom: 24, left: 24 },\n edgeCornerRadius: 6,\n outputWidth: 256,\n outputLabelWidth: 144,\n} as const;\n\nconst ENDPOINT_EDGE_DISTANCES = 'endpoints' as unknown as cytoscape.Css.Edge['edge-distances'];\nconst EDGE_SEGMENT_RADII = `${GRAPH_GEOMETRY.edgeCornerRadius}px` as unknown as cytoscape.Css.Edge['segment-radii'];\n\nexport type GraphLegendEntry = {\n readonly group: 'Execution' | 'Resources' | 'Relationships';\n readonly key: string;\n readonly label: string;\n readonly color: string;\n readonly shape: 'box' | 'cut-rectangle' | 'tag' | 'ellipse' | 'group' | 'line';\n readonly lineStyle?: 'solid' | 'dotted' | 'dashed';\n readonly hollowArrow?: boolean;\n};\n\nconst NODE_LEGEND_ENTRIES = {\n render: nodeLegend('render', 'Render', GRAPH_VISUAL_THEME.render.stroke),\n compute: nodeLegend('compute', 'Compute', GRAPH_VISUAL_THEME.compute.stroke),\n copy: nodeLegend('copy', 'Copy', GRAPH_VISUAL_THEME.copy.stroke),\n 'clear-buffer': nodeLegend('clear', 'Clear', GRAPH_VISUAL_THEME.clear.stroke),\n command: nodeLegend('command', 'Command', GRAPH_VISUAL_THEME.command.stroke),\n 'external-submission': { ...nodeLegend('external', 'External', GRAPH_VISUAL_THEME.external.stroke), shape: 'cut-rectangle' as const },\n} as const;\n\nexport function createGraphLegend(snapshot: FrameGraphDebugViewModel): readonly GraphLegendEntry[] {\n const entries: GraphLegendEntry[] = [];\n const passKinds = new Set(snapshot.nodes.map((node) => node.kind));\n for (const kind of ['render', 'compute', 'copy', 'clear-buffer', 'command', 'external-submission'] as const) {\n if (passKinds.has(kind)) entries.push(NODE_LEGEND_ENTRIES[kind]);\n }\n const retained = new Set(snapshot.nodes.map((node) => node.id));\n const used = new Set([\n ...snapshot.accessEdges.filter((access) => retained.has(access.nodeId)).map((access) => access.resource.id),\n ...snapshot.roots.flatMap((root) => root.resource ? [root.resource.id] : []),\n ]);\n const resources = snapshot.resources.filter((resource) => used.has(resource.id));\n if (resources.length) entries.push({ group: 'Resources', key: 'declaration', label: 'Declaration', color: GRAPH_VISUAL_THEME.declaration.stroke, shape: 'ellipse' });\n if (snapshot.roots.some((root) => root.resource)) entries.push({ group: 'Resources', key: 'output', label: 'Output', color: GRAPH_VISUAL_THEME.output.stroke, shape: 'tag' });\n if ([...snapshot.nodes, ...resources].some((item) => item.debugGroupId !== undefined)) {\n entries.push({ group: 'Relationships', key: 'group', label: 'Group', color: GRAPH_VISUAL_THEME.group.stroke, shape: 'group' });\n }\n if (snapshot.edges.some((edge) => edge.kind === 'value')\n || declarationEntrances(snapshot.nodes, snapshot.accessEdges, snapshot.edges).length\n || snapshot.roots.some((root) => root.resource && root.resolution && (root.resolution.usesInitialContents || root.resolution.producerNodeIds.length))) {\n entries.push(edgeLegend('flow', 'Resource Flow', GRAPH_VISUAL_THEME.dependency.value, 'solid'));\n }\n if (snapshot.edges.some((edge) => edge.kind === 'ordering')) {\n entries.push({\n ...edgeLegend('ordering', 'Order', GRAPH_VISUAL_THEME.dependency.ordering, 'dotted'),\n hollowArrow: true,\n });\n }\n return entries;\n}\n\nexport function createGraphStyles(): cytoscape.StylesheetJson {\n const theme = GRAPH_VISUAL_THEME;\n return [\n {\n selector: 'node',\n style: {\n 'shape': 'round-rectangle',\n 'width': 'data(width)',\n 'height': 'data(height)',\n 'label': 'data(displayLabel)',\n 'text-wrap': 'wrap',\n 'text-max-width': '160px',\n 'font-family': 'ui-monospace, SFMono-Regular, Consolas, Liberation Mono, monospace',\n 'font-size': GRAPH_GEOMETRY.baseFontSize,\n 'min-zoomed-font-size': GRAPH_GEOMETRY.minimumZoomedFontSize,\n 'color': theme.text,\n 'background-color': theme.surfaceRaised,\n 'border-color': theme.group.stroke,\n 'border-width': 1.25,\n 'border-style': 'solid',\n 'text-valign': 'center',\n 'text-halign': 'center',\n 'overlay-opacity': 0,\n 'underlay-opacity': 0,\n },\n },\n passStyle('render', theme.render),\n passStyle('compute', theme.compute),\n passStyle('copy', theme.copy),\n passStyle('clear-buffer', theme.clear),\n passStyle('command', theme.command),\n {\n selector: 'node[passKind = \"external-submission\"]',\n style: {\n 'background-color': theme.external.fill,\n 'border-color': theme.external.stroke,\n 'shape': 'cut-rectangle',\n 'corner-radius': '10px',\n },\n },\n {\n selector: 'node[kind = \"resource\"]',\n style: {\n 'shape': 'ellipse',\n 'background-color': theme.declaration.fill,\n 'border-color': theme.declaration.stroke,\n },\n },\n {\n selector: 'node[kind = \"root\"]',\n style: {\n 'shape': 'tag',\n 'background-color': theme.output.fill,\n 'border-color': theme.output.stroke,\n 'text-max-width': `${GRAPH_GEOMETRY.outputLabelWidth}px`,\n // Native tag shoulders sit at 5/8 of its width. Center text in the rectangular body.\n 'text-margin-x': -GRAPH_GEOMETRY.outputWidth * 3 / 16,\n },\n },\n {\n selector: 'node[kind = \"group\"]',\n style: {\n 'text-max-width': (element: cytoscape.SingularElementArgument) => `${element.data('labelMaxWidth') as number}px`,\n },\n },\n {\n selector: 'node[kind = \"group\"][collapsed = 1]',\n style: {\n 'background-color': theme.group.fill,\n 'border-color': theme.group.stroke,\n 'border-width': 2,\n 'color': theme.text,\n },\n },\n {\n selector: 'node[kind = \"group\"][collapsed = 0]',\n style: expandedGroupStyle(theme.group.fill),\n },\n {\n selector: 'node[kind = \"group\"][collapsed = 0][depthBand = 1]',\n style: { 'background-color': theme.group.alternateFill },\n },\n {\n selector: 'edge',\n style: {\n 'width': 1.5,\n 'line-color': theme.dependency.value,\n 'line-opacity': 0.82,\n 'target-arrow-color': theme.dependency.value,\n 'target-arrow-shape': 'triangle',\n 'target-arrow-fill': 'filled',\n 'arrow-scale': 0.8,\n 'curve-style': 'straight',\n 'label': 'data(displayLabel)',\n 'font-family': 'ui-monospace, SFMono-Regular, Consolas, Liberation Mono, monospace',\n 'font-size': 10,\n 'min-zoomed-font-size': GRAPH_GEOMETRY.minimumZoomedFontSize,\n 'color': theme.text,\n 'text-background-color': theme.canvas,\n 'text-background-opacity': 0.82,\n 'text-background-padding': '2px',\n 'text-rotation': 'autorotate',\n 'overlay-opacity': 0,\n 'underlay-opacity': 0,\n },\n },\n {\n selector: 'edge[kind = \"ordering\"]',\n style: {\n 'line-color': theme.dependency.ordering,\n 'target-arrow-color': theme.dependency.ordering,\n 'line-style': 'dotted',\n 'target-arrow-fill': 'hollow',\n 'line-opacity': 0.72,\n },\n },\n {\n selector: 'edge.elk-route',\n style: {\n 'source-endpoint': 'data(sourceEndpoint)',\n 'target-endpoint': 'data(targetEndpoint)',\n 'edge-distances': ENDPOINT_EDGE_DISTANCES,\n },\n },\n {\n selector: 'edge.elk-segments',\n style: {\n 'curve-style': 'round-segments',\n 'segment-distances': 'data(segmentDistances)',\n 'segment-weights': 'data(segmentWeights)',\n 'segment-radii': EDGE_SEGMENT_RADII,\n },\n },\n {\n selector: 'node.semantic-hover',\n style: {\n 'border-color': theme.hover,\n 'border-width': 2,\n 'z-index': 15,\n },\n },\n {\n selector: 'edge.semantic-hover',\n style: {\n 'line-color': theme.hover,\n 'target-arrow-color': theme.hover,\n 'line-opacity': 1,\n 'width': 2.5,\n 'z-index': 15,\n },\n },\n {\n selector: 'node.semantic-selected',\n style: {\n 'border-color': theme.selected,\n 'border-width': 3,\n 'opacity': 1,\n 'z-index': 20,\n },\n },\n {\n selector: 'edge.semantic-selected',\n style: {\n 'line-color': theme.selected,\n 'target-arrow-color': theme.selected,\n 'line-opacity': 1,\n 'width': 3,\n 'z-index': 20,\n },\n },\n ];\n}\n\nexport function nodeDimensions(node: GraphSceneNode): { readonly width: number; readonly height: number } {\n switch (node.kind) {\n case 'pass':\n return { width: 184, height: node.label.includes('\\n') ? 62 : 48 };\n case 'root':\n return { width: GRAPH_GEOMETRY.outputWidth, height: Math.max(58, node.label.split('\\n').length * 17 + 24) };\n case 'resource':\n return { width: 184, height: Math.max(58, node.label.split('\\n').length * 17 + 24) };\n case 'group':\n return node.collapsed ? { width: 224, height: 68 } : { width: 120, height: 80 };\n }\n}\n\nexport function graphLayoutGeometryKey(scene: GraphScene): string {\n return JSON.stringify({\n topology: scene.topologyKey,\n dimensions: scene.nodes.map((node) => {\n const dimensions = nodeDimensions(node);\n return [node.id, dimensions.width, dimensions.height, node.kind === 'pass' && node.passKind === 'external-submission'];\n }),\n });\n}\n\nexport function graphEdgeDisplayLabel(_edge: GraphSceneEdge): string {\n return '';\n}\n\nexport function expandedGroupLabelMaxWidth(outerWidth: number): number {\n return Math.max(80, Math.floor(outerWidth - GRAPH_GEOMETRY.groupTitleInset * 2));\n}\n\nexport function isOverviewGraphScale(zoom: number): boolean {\n return GRAPH_GEOMETRY.baseFontSize * zoom < GRAPH_GEOMETRY.overviewFontThreshold;\n}\n\nfunction nodeLegend(key: string, label: string, color: string): GraphLegendEntry {\n return { group: 'Execution', key, label, color, shape: 'box' };\n}\n\nfunction edgeLegend(\n key: string,\n label: string,\n color: string,\n lineStyle: NonNullable<GraphLegendEntry['lineStyle']>,\n): GraphLegendEntry {\n return { group: 'Relationships', key, label, color, shape: 'line', lineStyle };\n}\n\nfunction passStyle(\n kind: string,\n colors: { readonly stroke: string; readonly fill: string },\n): cytoscape.StylesheetStyle {\n return {\n selector: `node[passKind = \"${kind}\"]`,\n style: { 'background-color': colors.fill, 'border-color': colors.stroke },\n };\n}\n\nfunction expandedGroupStyle(backgroundColor: string): cytoscape.Css.Node {\n const geometry = GRAPH_GEOMETRY;\n return {\n 'background-color': backgroundColor,\n 'background-opacity': 0.34,\n 'border-color': GRAPH_VISUAL_THEME.group.stroke,\n 'border-width': 1.5,\n 'padding': `${geometry.groupPadding}px`,\n 'compound-sizing-wrt-labels': 'include',\n 'min-width': '120px',\n 'min-height': '80px',\n 'text-valign': 'top-inside',\n 'text-halign': 'left-inside',\n 'text-justification': 'left',\n 'text-margin-x': geometry.groupTitleInset - geometry.groupPadding * 2,\n 'text-margin-y': geometry.groupTitleInset - geometry.groupPadding * 2,\n 'line-height': geometry.groupTitleLineHeight,\n 'color': GRAPH_VISUAL_THEME.text,\n 'font-weight': 600,\n };\n}\n"]}
@@ -13,6 +13,7 @@ export declare class InspectorView {
13
13
  private selected;
14
14
  private activeTab;
15
15
  private open;
16
+ private hoveredLink;
16
17
  constructor(callbacks: WorkbenchCallbacks, onOpenChange: (open: boolean) => void, idPrefix: string);
17
18
  setSnapshot(snapshot: FrameGraphDebugViewModel): void;
18
19
  setSelection(selected: Selection | undefined, reveal?: boolean): void;
@@ -26,6 +27,10 @@ export declare class InspectorView {
26
27
  private accessRelations;
27
28
  private resourceRelations;
28
29
  private relationGroup;
30
+ private selectRelated;
31
+ private viewResourceButton;
32
+ private createDetailLink;
33
+ private clearLinkHover;
29
34
  private summary;
30
35
  private accessNodeLabel;
31
36
  private accessNodeSelection;
@@ -1 +1 @@
1
- {"version":3,"file":"panelInspectorView.d.ts","sourceRoot":"","sources":["../src/panelInspectorView.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGX,wBAAwB,EACxB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAAgB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAMN,KAAK,kBAAkB,EACvB,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,aAAa;IAYxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAZ9B,QAAQ,CAAC,IAAI,cAAmC;IAChD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAoC;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiC;IACzD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA8C;IACnE,OAAO,CAAC,QAAQ,CAAuC;IACvD,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,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,IAAI,CAA8C;IACnE,OAAO,CAAC,QAAQ,CAAuC;IACvD,OAAO,CAAC,QAAQ,CAAwB;IACxC,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,IAAI,CAAQ;IACpB,OAAO,CAAC,WAAW,CAAgC;gBAGjC,SAAS,EAAE,kBAAkB,EAC7B,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,EACtD,QAAQ,EAAE,MAAM;IAwCjB,WAAW,CAAC,QAAQ,EAAE,wBAAwB,GAAG,IAAI;IAKrD,YAAY,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,EAAE,MAAM,UAAO,GAAG,IAAI;IAQlE,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI;IAQ5B,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,MAAM;IAgCd,OAAO,CAAC,cAAc;IAkBtB,OAAO,CAAC,aAAa;IAyFrB,OAAO,CAAC,eAAe;IAmGvB,OAAO,CAAC,eAAe;IAQvB,OAAO,CAAC,iBAAiB;IAMzB,OAAO,CAAC,aAAa;IA4BrB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,kBAAkB;IAK1B,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,cAAc;IAMtB,OAAO,CAAC,OAAO;IAkBf,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,mBAAmB;CAK3B"}
@@ -2,6 +2,24 @@ import { labelNode, labelResource } from "./panelDomHelpers.js";
2
2
  import { createPanelIcon } from "./panelIcons.js";
3
3
  import { resolveSelectedDetail } from "./panelSelection.js";
4
4
  import { createRelationButton, formatEstimatedBytes, formatResourceDescriptor, groupPath, resourceLabel, } from "./panelWorkbenchHelpers.js";
5
+ function formatAccessFacts(access) {
6
+ return [
7
+ access.mode, access.access,
8
+ ...(access.mode === 'write' ? [access.contents, `producesValue: ${access.producesValue}`] : []),
9
+ ...(access.bufferRange ? [`bytes ${access.bufferRange.offset}–${access.bufferRange.size === undefined ? 'end' : access.bufferRange.offset + access.bufferRange.size}`] : []),
10
+ ...(access.textureRegion ? [JSON.stringify(access.textureRegion)] : []),
11
+ ...(access.textureViewId ? [`view ${access.textureViewId}`] : []),
12
+ ].join(' · ');
13
+ }
14
+ function formatRootRange(root) {
15
+ if (!root.range)
16
+ return 'Range unavailable';
17
+ if (root.range.kind === 'buffer')
18
+ return `bytes ${root.range.offset}–${root.range.offset + root.range.size}`;
19
+ return root.range.regions.map((region) => `mip ${region.baseMipLevel}+${region.mipLevelCount} · ${region.baseDepthSlice === undefined
20
+ ? `layers ${region.baseArrayLayer}+${region.arrayLayerCount}`
21
+ : `depth ${region.baseDepthSlice}+${region.depthSliceCount}`} · ${region.aspect}`).join('; ');
22
+ }
5
23
  export class InspectorView {
6
24
  callbacks;
7
25
  onOpenChange;
@@ -14,6 +32,7 @@ export class InspectorView {
14
32
  selected;
15
33
  activeTab = 'summary';
16
34
  open = true;
35
+ hoveredLink;
17
36
  constructor(callbacks, onOpenChange, idPrefix) {
18
37
  this.callbacks = callbacks;
19
38
  this.onOpenChange = onOpenChange;
@@ -58,6 +77,9 @@ export class InspectorView {
58
77
  this.render();
59
78
  }
60
79
  setSelection(selected, reveal = true) {
80
+ if (selected?.kind === 'resource'
81
+ && (this.selected?.kind !== 'resource' || this.selected.id !== selected.id))
82
+ this.activeTab = 'summary';
61
83
  this.selected = selected;
62
84
  if (selected && reveal)
63
85
  this.setOpen(true);
@@ -66,6 +88,8 @@ export class InspectorView {
66
88
  setOpen(open) {
67
89
  if (this.open === open)
68
90
  return;
91
+ if (!open)
92
+ this.clearLinkHover();
69
93
  this.open = open;
70
94
  this.updateOpenState();
71
95
  this.onOpenChange(open);
@@ -78,6 +102,7 @@ export class InspectorView {
78
102
  this.root.classList.toggle('open', this.open);
79
103
  }
80
104
  render() {
105
+ this.clearLinkHover();
81
106
  for (const [tab, button] of this.tabs) {
82
107
  const active = tab === this.activeTab;
83
108
  button.classList.toggle('active', active);
@@ -122,7 +147,7 @@ export class InspectorView {
122
147
  return resource ? labelResource(resource) : `Resource #${selection.id}`;
123
148
  }
124
149
  case 'allocation': return `Allocation #${selection.id}`;
125
- case 'root': return `Retention root #${selection.index}`;
150
+ case 'root': return 'Output root';
126
151
  case 'culled': return `Culled node #${selection.index}`;
127
152
  case 'segment': return `Segment #${selection.index}`;
128
153
  }
@@ -185,11 +210,16 @@ export class InspectorView {
185
210
  ]);
186
211
  }
187
212
  case 'root': {
188
- const root = snapshot.roots[selection.index];
213
+ const root = snapshot.roots.find((root) => root.key === selection.key);
189
214
  return this.summary(root ? [
190
215
  ['Reason', root.reason],
191
216
  ['Node', root.nodeId === undefined ? '-' : `#${root.nodeId}`],
192
- ['Resource', root.resource ? labelResource(root.resource) : '-'],
217
+ ['Resource', root.resource ? this.viewResourceButton(snapshot, root.resource.id) : '-'],
218
+ ...(root.reason === 'side-effect' ? [] : [
219
+ ['Range', root.range ? JSON.stringify(root.range) : 'Unavailable in Legacy capture'],
220
+ ['Initial contents', root.resolution ? String(root.resolution.usesInitialContents) : 'Unavailable in Legacy capture'],
221
+ ['Producers', root.resolution ? root.resolution.producerNodeIds.join(', ') || 'None' : 'Unavailable in Legacy capture'],
222
+ ]),
193
223
  ] : []);
194
224
  }
195
225
  case 'culled': {
@@ -233,7 +263,10 @@ export class InspectorView {
233
263
  case 'group': {
234
264
  const group = snapshot.groupByPathKey.get(selection.pathKey);
235
265
  if (group) {
236
- host.append(this.resourceRelations('Inputs', group.summary.inputResources), this.resourceRelations('Outputs', group.summary.outputResources));
266
+ host.append(this.resourceRelations('Inputs', group.summary.inputResources), this.resourceRelations('Outputs', group.summary.outputResources), this.relationGroup('Output roots', group.summary.outputRoots.map((root) => [
267
+ `${root.resource ? labelResource(root.resource) : '-'} · ${root.reason} · ${root.range ? JSON.stringify(root.range) : 'Range unavailable'}`,
268
+ { kind: 'root', key: root.key },
269
+ ])));
237
270
  }
238
271
  break;
239
272
  }
@@ -245,11 +278,17 @@ export class InspectorView {
245
278
  const nodeSelection = this.accessNodeSelection(snapshot, access.nodeId);
246
279
  if (nodeSelection)
247
280
  passRelations.push([
248
- `${access.mode} · ${this.accessNodeLabel(snapshot, access.nodeId)} · ${access.access}`,
281
+ this.accessNodeLabel(snapshot, access.nodeId),
249
282
  nodeSelection,
283
+ formatAccessFacts(access),
250
284
  ]);
251
285
  }
252
286
  host.appendChild(this.relationGroup('Pass accesses', passRelations));
287
+ const roots = snapshot.roots.filter((root) => root.resource?.id === selection.id);
288
+ if (roots.length)
289
+ host.appendChild(this.relationGroup('Output roots', roots.map((root) => [
290
+ `${root.reason} · ${formatRootRange(root)}`, { kind: 'root', key: root.key },
291
+ ])));
253
292
  if (resource?.physicalResourceId !== undefined)
254
293
  host.appendChild(this.relationGroup('Allocation', [
255
294
  [`#${resource.physicalResourceId}`, { kind: 'allocation', id: resource.physicalResourceId }],
@@ -265,15 +304,19 @@ export class InspectorView {
265
304
  break;
266
305
  }
267
306
  case 'root': {
268
- const root = snapshot.roots[selection.index];
307
+ const root = snapshot.roots.find((root) => root.key === selection.key);
269
308
  const relations = [];
270
309
  if (root?.nodeId !== undefined && snapshot.nodeById.has(root.nodeId))
271
310
  relations.push([
272
311
  this.accessNodeLabel(snapshot, root.nodeId), { kind: 'node', id: root.nodeId },
273
312
  ]);
274
313
  if (root?.resource)
275
- relations.push([labelResource(root.resource), { kind: 'resource', id: root.resource.id }]);
276
- host.appendChild(this.relationGroup('Retained object', relations));
314
+ host.appendChild(this.relationGroup('Resource', [[labelResource(root.resource), { kind: 'resource', id: root.resource.id }]]));
315
+ if (root?.resource && root.resolution?.usesInitialContents)
316
+ relations.push([`Initial contents · ${labelResource(root.resource)}`, { kind: 'resource', id: root.resource.id }]);
317
+ for (const id of root?.resolution?.producerNodeIds ?? [])
318
+ relations.push([this.accessNodeLabel(snapshot, id), { kind: 'node', id }]);
319
+ host.appendChild(this.relationGroup('Output sources', relations));
277
320
  break;
278
321
  }
279
322
  case 'culled': {
@@ -302,8 +345,9 @@ export class InspectorView {
302
345
  }
303
346
  accessRelations(title, accesses) {
304
347
  return this.relationGroup(title, accesses.map((access) => [
305
- `${labelResource(access.resource)} · ${access.access}${access.mode === 'write' ? ` · ${access.contents}` : ''}`,
348
+ labelResource(access.resource),
306
349
  { kind: 'resource', id: access.resource.id },
350
+ formatAccessFacts(access),
307
351
  ]));
308
352
  }
309
353
  resourceRelations(title, resources) {
@@ -316,8 +360,20 @@ export class InspectorView {
316
360
  const heading = document.createElement('h3');
317
361
  heading.textContent = `${title} ${relations.length}`;
318
362
  section.appendChild(heading);
319
- for (const [label, selection] of relations) {
320
- section.appendChild(createRelationButton(label, selection, this.callbacks.onSelect));
363
+ for (const [label, selection, description] of relations) {
364
+ const link = this.createDetailLink(label, selection);
365
+ if (description === undefined) {
366
+ section.appendChild(link);
367
+ }
368
+ else {
369
+ const entry = document.createElement('div');
370
+ entry.className = 'zenfg-inspector-relation-entry';
371
+ const metadata = document.createElement('span');
372
+ metadata.className = 'zenfg-inspector-muted';
373
+ metadata.textContent = description;
374
+ entry.append(link, metadata);
375
+ section.appendChild(entry);
376
+ }
321
377
  }
322
378
  if (relations.length === 0) {
323
379
  const empty = document.createElement('span');
@@ -327,6 +383,31 @@ export class InspectorView {
327
383
  }
328
384
  return section;
329
385
  }
386
+ selectRelated(selection) {
387
+ this.clearLinkHover();
388
+ this.callbacks.onSelect(selection);
389
+ }
390
+ viewResourceButton(snapshot, resourceId) {
391
+ return this.createDetailLink(`View resource · ${resourceLabel(snapshot, resourceId)}`, { kind: 'resource', id: resourceId });
392
+ }
393
+ createDetailLink(label, selection) {
394
+ const link = createRelationButton(label, selection, (target) => this.selectRelated(target));
395
+ link.addEventListener('mouseenter', () => {
396
+ this.hoveredLink = link;
397
+ this.callbacks.onHover(selection);
398
+ });
399
+ link.addEventListener('mouseleave', () => {
400
+ if (this.hoveredLink === link)
401
+ this.clearLinkHover();
402
+ });
403
+ return link;
404
+ }
405
+ clearLinkHover() {
406
+ if (!this.hoveredLink)
407
+ return;
408
+ this.hoveredLink = undefined;
409
+ this.callbacks.onHover(undefined);
410
+ }
330
411
  summary(rows) {
331
412
  const summary = document.createElement('dl');
332
413
  summary.className = 'zenfg-inspector-inspector-summary';
@@ -334,8 +415,13 @@ export class InspectorView {
334
415
  const term = document.createElement('dt');
335
416
  term.textContent = label;
336
417
  const description = document.createElement('dd');
337
- description.textContent = value;
338
- description.title = value;
418
+ if (typeof value === 'string') {
419
+ description.textContent = value;
420
+ description.title = value;
421
+ }
422
+ else {
423
+ description.appendChild(value);
424
+ }
339
425
  summary.append(term, description);
340
426
  }
341
427
  return summary;