@f-ewald/components 1.45.0 → 1.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +361 -73
- package/dist/app-shell.d.ts.map +1 -1
- package/dist/app-shell.js +4 -0
- package/dist/app-shell.js.map +1 -1
- package/dist/calendar-day.d.ts +0 -2
- package/dist/calendar-day.d.ts.map +1 -1
- package/dist/calendar-day.js +3 -30
- package/dist/calendar-day.js.map +1 -1
- package/dist/calendar-timeline-base.d.ts +4 -0
- package/dist/calendar-timeline-base.d.ts.map +1 -1
- package/dist/calendar-timeline-base.js +31 -2
- package/dist/calendar-timeline-base.js.map +1 -1
- package/dist/calendar-week.d.ts +0 -2
- package/dist/calendar-week.d.ts.map +1 -1
- package/dist/calendar-week.js +5 -32
- package/dist/calendar-week.js.map +1 -1
- package/dist/cron-schedule.d.ts.map +1 -1
- package/dist/cron-schedule.js +4 -2
- package/dist/cron-schedule.js.map +1 -1
- package/dist/dag-graph.d.ts +25 -1
- package/dist/dag-graph.d.ts.map +1 -1
- package/dist/dag-graph.js +133 -20
- package/dist/dag-graph.js.map +1 -1
- package/dist/distribution-chart.d.ts +1 -0
- package/dist/distribution-chart.d.ts.map +1 -1
- package/dist/distribution-chart.js +23 -2
- package/dist/distribution-chart.js.map +1 -1
- package/dist/multi-select.d.ts.map +1 -1
- package/dist/multi-select.js +1 -1
- package/dist/multi-select.js.map +1 -1
- package/dist/price-history-chart.d.ts.map +1 -1
- package/dist/price-history-chart.js +12 -7
- package/dist/price-history-chart.js.map +1 -1
- package/dist/range-slider.d.ts.map +1 -1
- package/dist/range-slider.js +1 -1
- package/dist/range-slider.js.map +1 -1
- package/dist/ui-checkbox.d.ts.map +1 -1
- package/dist/ui-checkbox.js +1 -1
- package/dist/ui-checkbox.js.map +1 -1
- package/dist/utils/calendar.d.ts +14 -1
- package/dist/utils/calendar.d.ts.map +1 -1
- package/dist/utils/calendar.js +17 -2
- package/dist/utils/calendar.js.map +1 -1
- package/dist/utils/cron.d.ts.map +1 -1
- package/dist/utils/cron.js +19 -10
- package/dist/utils/cron.js.map +1 -1
- package/dist/utils/dag-layout.d.ts +23 -6
- package/dist/utils/dag-layout.d.ts.map +1 -1
- package/dist/utils/dag-layout.js +32 -10
- package/dist/utils/dag-layout.js.map +1 -1
- package/dist/utils/layer-stack.d.ts +2 -0
- package/dist/utils/layer-stack.d.ts.map +1 -1
- package/dist/utils/layer-stack.js +4 -0
- package/dist/utils/layer-stack.js.map +1 -1
- package/docs/dag-graph.md +5 -2
- package/llms.txt +5 -2
- package/package.json +1 -1
package/dist/dag-graph.js
CHANGED
|
@@ -10,7 +10,7 @@ import { curveBasis, line } from "d3-shape";
|
|
|
10
10
|
import { tokens } from "./tokens.js";
|
|
11
11
|
import { iconArrowLongDown, iconArrowLongRight, iconArrowsPointingIn, iconMagnifyingGlassMinus, iconMagnifyingGlassPlus, iconViewfinderCircle, } from "./icons.js";
|
|
12
12
|
import "./icon-button.js";
|
|
13
|
-
import { approximateTextWidth, DAG_LABEL_OFFSET, DAG_LABEL_OFFSET_PLAIN, DAG_NODE_HEIGHT, layoutDag, } from "./utils/dag-layout.js";
|
|
13
|
+
import { approximateTextWidth, DAG_LABEL_OFFSET, DAG_EDGE_LABEL_HEIGHT, DAG_LABEL_OFFSET_PLAIN, DAG_NODE_HEIGHT, layoutDag, } from "./utils/dag-layout.js";
|
|
14
14
|
const ICON_SIZE = 14;
|
|
15
15
|
const MIN_SCALE = 0.05;
|
|
16
16
|
const MAX_SCALE = 3;
|
|
@@ -21,6 +21,8 @@ const DRAG_THRESHOLD = 4;
|
|
|
21
21
|
const KEY_PAN = 48;
|
|
22
22
|
const KEY_ZOOM = 1.25;
|
|
23
23
|
const CONTROLS = ["zoom", "fit", "center", "direction"];
|
|
24
|
+
/** Stroke width, in pixels, of the graph's heaviest edge. */
|
|
25
|
+
const MAX_EDGE_WIDTH = 6;
|
|
24
26
|
const route = line()
|
|
25
27
|
.x((point) => point.x)
|
|
26
28
|
.y((point) => point.y)
|
|
@@ -36,6 +38,9 @@ const route = line()
|
|
|
36
38
|
* focus on the graph, arrow keys pan, `+`/`-` zoom, and `0` fits the graph. Clicking a node, or pressing
|
|
37
39
|
* Enter/Space on it, selects it. A toolbar in the top-right corner offers the `controls` you enable.
|
|
38
40
|
*
|
|
41
|
+
* Edges can carry an optional `label`, drawn midway along the edge, and an optional `weight`, which draws the
|
|
42
|
+
* edge thicker in proportion to the heaviest weight in the graph.
|
|
43
|
+
*
|
|
39
44
|
* Set `static` to present a fixed picture: the graph is always fitted into view, panning and zooming
|
|
40
45
|
* are off, and the toolbar is hidden; nodes can still be selected.
|
|
41
46
|
*
|
|
@@ -153,7 +158,7 @@ let DagGraph = class DagGraph extends LitElement {
|
|
|
153
158
|
fill: none;
|
|
154
159
|
stroke: var(--dag-edge-color, var(--ui-text-muted, #64748b));
|
|
155
160
|
stroke-opacity: 0.45;
|
|
156
|
-
stroke-width:
|
|
161
|
+
stroke-width: var(--_dag-edge-width, 1px);
|
|
157
162
|
vector-effect: non-scaling-stroke;
|
|
158
163
|
}
|
|
159
164
|
.edge.backward {
|
|
@@ -169,7 +174,27 @@ let DagGraph = class DagGraph extends LitElement {
|
|
|
169
174
|
.edges.emphasis .edge.highlighted {
|
|
170
175
|
stroke: var(--dag-highlight-color, var(--ui-danger, #dc2626));
|
|
171
176
|
stroke-opacity: 1;
|
|
172
|
-
stroke-width:
|
|
177
|
+
stroke-width: calc(var(--_dag-edge-width, 1px) + 1px);
|
|
178
|
+
}
|
|
179
|
+
.edge-label rect {
|
|
180
|
+
rx: var(--ui-radius-sm, 0.25rem);
|
|
181
|
+
fill: var(--ui-surface, #ffffff);
|
|
182
|
+
}
|
|
183
|
+
.edge-label text {
|
|
184
|
+
fill: var(--ui-text-muted, #64748b);
|
|
185
|
+
text-anchor: middle;
|
|
186
|
+
dominant-baseline: central;
|
|
187
|
+
pointer-events: none;
|
|
188
|
+
}
|
|
189
|
+
.edge-label.highlighted text {
|
|
190
|
+
fill: var(--dag-highlight-color, var(--ui-danger, #dc2626));
|
|
191
|
+
}
|
|
192
|
+
.edge-labels.emphasis .edge-label {
|
|
193
|
+
opacity: 0.25;
|
|
194
|
+
}
|
|
195
|
+
.edge-labels.emphasis .edge-label.incident,
|
|
196
|
+
.edge-labels.emphasis .edge-label.highlighted {
|
|
197
|
+
opacity: 1;
|
|
173
198
|
}
|
|
174
199
|
.arrow {
|
|
175
200
|
fill: var(--dag-edge-color, var(--ui-text-muted, #64748b));
|
|
@@ -311,10 +336,14 @@ let DagGraph = class DagGraph extends LitElement {
|
|
|
311
336
|
fit() {
|
|
312
337
|
if (!this._layout.nodes.length || !this._size.width)
|
|
313
338
|
return;
|
|
314
|
-
const
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
339
|
+
const boxes = [
|
|
340
|
+
...this._layout.nodes.map((node) => ({ ...node, height: DAG_NODE_HEIGHT })),
|
|
341
|
+
...this._layout.edges.flatMap((edge) => (edge.label ? [{ ...edge.label, height: DAG_EDGE_LABEL_HEIGHT }] : [])),
|
|
342
|
+
];
|
|
343
|
+
const left = Math.min(...boxes.map((box) => box.x - box.width / 2));
|
|
344
|
+
const right = Math.max(...boxes.map((box) => box.x + box.width / 2));
|
|
345
|
+
const top = Math.min(...boxes.map((box) => box.y - box.height / 2));
|
|
346
|
+
const bottom = Math.max(...boxes.map((box) => box.y + box.height / 2));
|
|
318
347
|
const k = this._clamp(Math.min(1, (this._size.width - 2 * FIT_PADDING) / Math.max(right - left, 1), (this._size.height - 2 * FIT_PADDING) / Math.max(bottom - top, 1)));
|
|
319
348
|
this._centerOn({ x: (left + right) / 2, y: (top + bottom) / 2 }, k);
|
|
320
349
|
}
|
|
@@ -333,6 +362,8 @@ let DagGraph = class DagGraph extends LitElement {
|
|
|
333
362
|
const summary = `${this.label}: ${nodeCount} ${nodeCount === 1 ? "node" : "nodes"}, `
|
|
334
363
|
+ `${this._layout.edges.length} ${this._layout.edges.length === 1 ? "edge" : "edges"}`;
|
|
335
364
|
const { x, y, k } = this._view;
|
|
365
|
+
const edges = this._styledEdges();
|
|
366
|
+
const emphasis = this._hovered ? "emphasis" : "";
|
|
336
367
|
return html `
|
|
337
368
|
<div class="canvas">
|
|
338
369
|
<svg
|
|
@@ -355,13 +386,15 @@ let DagGraph = class DagGraph extends LitElement {
|
|
|
355
386
|
orient="auto">
|
|
356
387
|
<path class="arrow highlighted" d="M0,-4L8,0L0,4Z" />
|
|
357
388
|
</marker>
|
|
389
|
+
${this._renderWeightedArrows(edges)}
|
|
358
390
|
<linearGradient id="node-fill" x1="0" y1="0" x2="0" y2="1">
|
|
359
391
|
<stop class="gloss-start" offset="0%" />
|
|
360
392
|
<stop class="gloss-end" offset="100%" />
|
|
361
393
|
</linearGradient>
|
|
362
394
|
</defs>
|
|
363
395
|
<g transform="translate(${x},${y}) scale(${k})">
|
|
364
|
-
<g class="edges ${
|
|
396
|
+
<g class="edges ${emphasis}">${edges.map((edge) => this._renderEdge(edge))}</g>
|
|
397
|
+
<g class="edge-labels ${emphasis}">${edges.map((edge) => this._renderEdgeLabel(edge))}</g>
|
|
365
398
|
<g class="nodes">${this._layout.nodes.map((node) => this._renderNode(node))}</g>
|
|
366
399
|
</g>
|
|
367
400
|
</svg>
|
|
@@ -415,23 +448,103 @@ let DagGraph = class DagGraph extends LitElement {
|
|
|
415
448
|
composed: true,
|
|
416
449
|
}));
|
|
417
450
|
}
|
|
418
|
-
|
|
451
|
+
/** Pairs each laid-out edge with its input's presentation; on duplicate edges the last one wins. */
|
|
452
|
+
_styledEdges() {
|
|
453
|
+
const inputs = new Map(this.edges.map((edge) => [this._edgeKey(edge), edge]));
|
|
419
454
|
const highlighted = new Set(this.edges.filter((edge) => edge.highlighted).map((edge) => this._edgeKey(edge)));
|
|
420
455
|
const names = new Map(this.nodes.map((node) => [node.id, node.label]));
|
|
421
|
-
|
|
456
|
+
const weighted = this._layout.edges.map((edge) => {
|
|
457
|
+
const weight = inputs.get(this._edgeKey(edge))?.weight;
|
|
458
|
+
return typeof weight === "number" && Number.isFinite(weight) && weight >= 0 ? weight : undefined;
|
|
459
|
+
});
|
|
460
|
+
const heaviest = Math.max(0, ...weighted.map((weight) => weight ?? 0));
|
|
461
|
+
return this._layout.edges.map((edge, index) => {
|
|
462
|
+
const input = inputs.get(this._edgeKey(edge));
|
|
463
|
+
const weight = weighted[index];
|
|
422
464
|
const isHighlighted = highlighted.has(this._edgeKey(edge));
|
|
423
|
-
const
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
465
|
+
const width = weight === undefined
|
|
466
|
+
? undefined
|
|
467
|
+
: Math.round(2 * (1 + ((MAX_EDGE_WIDTH - 1) * weight) / (heaviest || 1))) / 2;
|
|
468
|
+
const title = `${names.get(edge.source)} → ${names.get(edge.target)}`
|
|
469
|
+
+ (input?.label ? `: ${input.label}` : "")
|
|
470
|
+
+ (weight === undefined ? "" : ` (weight ${weight.toLocaleString()})`);
|
|
471
|
+
return {
|
|
472
|
+
layout: edge,
|
|
473
|
+
title,
|
|
474
|
+
highlighted: isHighlighted,
|
|
475
|
+
incident: edge.source === this._hovered || edge.target === this._hovered,
|
|
476
|
+
width,
|
|
477
|
+
arrow: width === undefined ? undefined : 5 + 2 * (width + (isHighlighted ? 1 : 0)),
|
|
478
|
+
};
|
|
433
479
|
});
|
|
434
480
|
}
|
|
481
|
+
/**
|
|
482
|
+
* Arrowheads for weighted edges, one per size and color: they grow more slowly than the stroke and sit just
|
|
483
|
+
* past the shortened path, so a thick stroke never pokes out beside the arrow's tip.
|
|
484
|
+
*/
|
|
485
|
+
_renderWeightedArrows(edges) {
|
|
486
|
+
const sizes = new Map();
|
|
487
|
+
for (const { arrow, highlighted } of edges) {
|
|
488
|
+
if (arrow !== undefined)
|
|
489
|
+
sizes.set(this._arrowId(arrow, highlighted), { size: arrow, highlighted });
|
|
490
|
+
}
|
|
491
|
+
return [...sizes].map(([id, { size, highlighted }]) => svg `<marker id=${id} viewBox="0 -4 8 8" refX="0"
|
|
492
|
+
refY="0" markerUnits="userSpaceOnUse" markerWidth=${size} markerHeight=${size} orient="auto">
|
|
493
|
+
<path class="arrow ${highlighted ? "highlighted" : ""}" d="M0,-4L8,0L0,4Z" /></marker>`);
|
|
494
|
+
}
|
|
495
|
+
_arrowId(size, highlighted) {
|
|
496
|
+
return `arrow-${size}${highlighted ? "-highlighted" : ""}`;
|
|
497
|
+
}
|
|
498
|
+
_renderEdge(edge) {
|
|
499
|
+
const { layout, arrow } = edge;
|
|
500
|
+
const classes = [
|
|
501
|
+
"edge",
|
|
502
|
+
layout.backward ? "backward" : "",
|
|
503
|
+
edge.highlighted ? "highlighted" : "",
|
|
504
|
+
edge.incident ? "incident" : "",
|
|
505
|
+
].filter(Boolean).join(" ");
|
|
506
|
+
const marker = arrow === undefined
|
|
507
|
+
? (edge.highlighted ? "arrow-highlighted" : "arrow")
|
|
508
|
+
: this._arrowId(arrow, edge.highlighted);
|
|
509
|
+
const points = arrow === undefined ? layout.points : this._shortenEnd(layout.points, arrow);
|
|
510
|
+
return svg `<path class=${classes} data-source=${layout.source} data-target=${layout.target}
|
|
511
|
+
style=${edge.width === undefined ? nothing : `--_dag-edge-width: ${edge.width}px`}
|
|
512
|
+
d=${route(points) ?? ""} marker-end="url(#${marker})">
|
|
513
|
+
<title>${edge.title}</title></path>`;
|
|
514
|
+
}
|
|
515
|
+
_renderEdgeLabel(edge) {
|
|
516
|
+
const { layout } = edge;
|
|
517
|
+
const label = layout.label;
|
|
518
|
+
if (!label)
|
|
519
|
+
return nothing;
|
|
520
|
+
const classes = [
|
|
521
|
+
"edge-label",
|
|
522
|
+
edge.highlighted ? "highlighted" : "",
|
|
523
|
+
edge.incident ? "incident" : "",
|
|
524
|
+
].filter(Boolean).join(" ");
|
|
525
|
+
return svg `<g class=${classes} data-source=${layout.source} data-target=${layout.target}
|
|
526
|
+
transform="translate(${label.x},${label.y})">
|
|
527
|
+
<title>${edge.title}</title>
|
|
528
|
+
<rect x=${-label.width / 2} y=${-DAG_EDGE_LABEL_HEIGHT / 2} width=${label.width}
|
|
529
|
+
height=${DAG_EDGE_LABEL_HEIGHT}></rect>
|
|
530
|
+
<text>${label.text}</text>
|
|
531
|
+
</g>`;
|
|
532
|
+
}
|
|
533
|
+
/** Pulls the last point back by `length` (at most 80% of the final segment) to make room for an arrowhead. */
|
|
534
|
+
_shortenEnd(points, length) {
|
|
535
|
+
if (points.length < 2)
|
|
536
|
+
return points;
|
|
537
|
+
const end = points[points.length - 1];
|
|
538
|
+
const previous = points[points.length - 2];
|
|
539
|
+
const distance = Math.hypot(end.x - previous.x, end.y - previous.y);
|
|
540
|
+
if (!distance)
|
|
541
|
+
return points;
|
|
542
|
+
const ratio = Math.min(length, 0.8 * distance) / distance;
|
|
543
|
+
return [
|
|
544
|
+
...points.slice(0, -1),
|
|
545
|
+
{ x: end.x - (end.x - previous.x) * ratio, y: end.y - (end.y - previous.y) * ratio },
|
|
546
|
+
];
|
|
547
|
+
}
|
|
435
548
|
_renderNode(position) {
|
|
436
549
|
const node = this.nodes.find((candidate) => candidate.id === position.id);
|
|
437
550
|
const kind = node.kind ? this.kinds[node.kind] : undefined;
|
package/dist/dag-graph.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dag-graph.js","sourceRoot":"","sources":["../src/dag-graph.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAA+C,MAAM,KAAK,CAAC;AACvG,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,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pB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAkpBpB","sourcesContent":["import { LitElement, css, html, nothing, svg, type PropertyValues, type SVGTemplateResult } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { curveBasis, line } from \"d3-shape\";\nimport { tokens } from \"./tokens.js\";\nimport {\n iconArrowLongDown,\n iconArrowLongRight,\n iconArrowsPointingIn,\n iconMagnifyingGlassMinus,\n iconMagnifyingGlassPlus,\n iconViewfinderCircle,\n} from \"./icons.js\";\nimport \"./icon-button.js\";\nimport {\n approximateTextWidth,\n DAG_LABEL_OFFSET,\n DAG_LABEL_OFFSET_PLAIN,\n DAG_NODE_HEIGHT,\n layoutDag,\n type DagDirection,\n type DagLayout,\n type DagLayoutNode,\n type DagPoint,\n type MeasureText,\n} from \"./utils/dag-layout.js\";\n\nexport type { DagDirection } from \"./utils/dag-layout.js\";\n\n/** One node of a `dag-graph`. */\nexport interface DagNode {\n /** Unique id, referenced by edges and by `selected`. */\n id: string;\n /** Text shown on the node; long labels are shortened with an ellipsis (the full text is the tooltip). */\n label: string;\n /** Key into `kinds`, which supplies the node's icon, color, and border style. */\n kind?: string;\n /** Draws the node faded with a dotted border, e.g. for data that is incomplete or unavailable. */\n muted?: boolean;\n /** Emphasizes the node, e.g. as part of a highlighted path or cycle. */\n highlighted?: boolean;\n}\n\n/** One directed edge of a `dag-graph`, pointing from `source` to `target`. */\nexport interface DagEdge {\n source: string;\n target: string;\n /** Emphasizes the edge, e.g. as part of a highlighted path or cycle. */\n highlighted?: boolean;\n}\n\n/** Presentation of one node kind. */\nexport interface DagNodeKind {\n /** Name shown in the legend and appended to the node tooltip. */\n label?: string;\n /** Accent color (any CSS color) for the icon and border; defaults to `--ui-primary`. */\n color?: string;\n /** Icon factory, called with the icon size in pixels — e.g. one of the package's `icon*` exports. */\n icon?: (size: number) => SVGTemplateResult;\n /** Draws the node with a dashed border. */\n dashed?: boolean;\n}\n\n/** A built-in toolbar control: `zoom` (in and out), `fit`, `center` (on the selected node), or `direction`. */\nexport type DagControl = \"zoom\" | \"fit\" | \"center\" | \"direction\";\n\n/** Detail of the `direction-change` event. */\nexport interface DagDirectionChangeDetail {\n direction: DagDirection;\n}\n\n/** Detail of the `node-select` event. */\nexport interface DagNodeSelectDetail {\n id: string;\n}\n\ninterface View {\n x: number;\n y: number;\n k: number;\n}\n\nconst ICON_SIZE = 14;\nconst MIN_SCALE = 0.05;\nconst MAX_SCALE = 3;\nconst FIT_PADDING = 24;\n/** Below this fitted zoom labels get hard to read, so the selected node is shown at 100% instead. */\nconst READABLE_SCALE = 0.6;\nconst DRAG_THRESHOLD = 4;\nconst KEY_PAN = 48;\nconst KEY_ZOOM = 1.25;\nconst CONTROLS: readonly DagControl[] = [\"zoom\", \"fit\", \"center\", \"direction\"];\n\nconst route = line<DagPoint>()\n .x((point) => point.x)\n .y((point) => point.y)\n .curve(curveBasis);\n\n/**\n * Interactive layered drawing of a directed graph — dependencies, pipelines, or any node-link data.\n *\n * Nodes are placed in layers (via dagre) so edges flow left to right (or top to bottom with\n * `direction=\"TB\"`); cycles are allowed, and the edges closing them are drawn dashed and point backward.\n * Each node is a compact card sized to its label, with an optional icon, color, and border style from\n * `kinds`. The whole graph is shown when it fits at a readable zoom; otherwise the selected node is centered at\n * 100%. Drag to pan; pinch or Ctrl/⌘ + wheel to zoom (a plain wheel scrolls the page). With keyboard\n * focus on the graph, arrow keys pan, `+`/`-` zoom, and `0` fits the graph. Clicking a node, or pressing\n * Enter/Space on it, selects it. A toolbar in the top-right corner offers the `controls` you enable.\n *\n * Set `static` to present a fixed picture: the graph is always fitted into view, panning and zooming\n * are off, and the toolbar is hidden; nodes can still be selected.\n *\n * Colors can be changed with these custom properties: `--dag-node-background`, `--dag-node-text`,\n * `--dag-edge-color`, `--dag-selected-color`, and `--dag-highlight-color`; `--dag-graph-height` sets the\n * height (default `24rem`).\n *\n * @element dag-graph\n * @fires node-select - A node was clicked or activated with the keyboard; `detail` is `{ id }`.\n * @fires direction-change - The toolbar's direction control flipped `direction`; `detail` is `{ direction }`.\n * @slot empty - Shown when there are no nodes.\n */\n@customElement(\"dag-graph\")\nexport class DagGraph extends LitElement {\n /** Nodes to draw. */\n @property({ type: Array }) nodes: DagNode[] = [];\n\n /** Directed edges between `nodes`; edges with an unknown endpoint or to the node itself are ignored. */\n @property({ type: Array }) edges: DagEdge[] = [];\n\n /** Presentation per node `kind`: legend label, color, icon, and border style. */\n @property({ attribute: false }) kinds: Record<string, DagNodeKind> = {};\n\n /**\n * Id of the selected node. Selecting a node updates it; when it changes to a node outside the visible area,\n * the view follows.\n */\n @property({ reflect: true }) selected: string | null = null;\n\n /** Layer direction: `LR` (left to right) or `TB` (top to bottom). */\n @property({ reflect: true }) direction: DagDirection = \"LR\";\n\n /** Accessible name of the graph; the node and edge counts are appended. */\n @property() label = \"Directed graph\";\n\n /** Shows a legend of `kinds` below the graph. */\n @property({ type: Boolean, reflect: true }) legend = false;\n\n /**\n * Space-separated toolbar controls to show: any of `zoom`, `fit`, `center`, and `direction`, in that\n * order. An empty value hides the toolbar.\n */\n @property({ reflect: true }) controls = \"zoom fit center\";\n\n /** Presents a static picture: always fitted, with panning, zooming, and the toolbar turned off. */\n @property({ type: Boolean, reflect: true, attribute: \"static\" }) isStatic = false;\n\n @state() private _view: View = { x: 0, y: 0, k: 1 };\n @state() private _hovered: string | null = null;\n @state() private _panning = false;\n\n @query(\"svg\") private _svg!: SVGSVGElement;\n\n private _layout: DagLayout = { nodes: [], edges: [] };\n private _positions = new Map<string, DagLayoutNode>();\n private _size = { width: 0, height: 0 };\n private _viewReady = false;\n private _lastSelected: string | null = null;\n private _lastDirection: DagDirection | null = null;\n private _measure: MeasureText = approximateTextWidth;\n private _measureFont = \"\";\n private _resizeObserver: ResizeObserver | null = null;\n private _drag: { pointerId: number; x: number; y: number; view: View; moved: boolean } | null = null;\n private _suppressClick = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: flex;\n flex-direction: column;\n height: var(--dag-graph-height, 24rem);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-xs, 0.6875rem);\n color: var(--ui-text, #0f172a);\n }\n .canvas {\n position: relative;\n flex: 1;\n min-height: 0;\n }\n svg {\n display: block;\n width: 100%;\n height: 100%;\n cursor: grab;\n touch-action: none;\n user-select: none;\n outline: none;\n }\n svg.panning {\n cursor: grabbing;\n }\n :host([static]) svg {\n cursor: default;\n }\n .toolbar {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n display: flex;\n gap: 0.25rem;\n padding: 0.25rem;\n background:\n var(--ui-button-secondary-background, none),\n var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow:\n var(--ui-button-highlight, 0 0 0 0 transparent),\n var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n svg:focus-visible {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .edge {\n fill: none;\n stroke: var(--dag-edge-color, var(--ui-text-muted, #64748b));\n stroke-opacity: 0.45;\n stroke-width: 1;\n vector-effect: non-scaling-stroke;\n }\n .edge.backward {\n stroke-dasharray: 4 3;\n }\n .edges.emphasis .edge {\n stroke-opacity: 0.08;\n }\n .edges.emphasis .edge.incident {\n stroke-opacity: 0.9;\n }\n .edge.highlighted,\n .edges.emphasis .edge.highlighted {\n stroke: var(--dag-highlight-color, var(--ui-danger, #dc2626));\n stroke-opacity: 1;\n stroke-width: 2;\n }\n .arrow {\n fill: var(--dag-edge-color, var(--ui-text-muted, #64748b));\n fill-opacity: 0.7;\n }\n .arrow.highlighted {\n fill: var(--dag-highlight-color, var(--ui-danger, #dc2626));\n fill-opacity: 1;\n }\n .node {\n cursor: pointer;\n outline: none;\n }\n .gloss-start {\n stop-color: var(--ui-button-secondary-gloss-start, var(--ui-surface, #ffffff));\n }\n .gloss-end {\n stop-color: var(--ui-button-secondary-gloss-end, var(--ui-surface, #ffffff));\n }\n .node rect {\n rx: var(--ui-radius-sm, 0.25rem);\n fill: var(--dag-node-background, url(#node-fill));\n stroke: color-mix(\n in srgb,\n var(--dag-kind-color, var(--ui-primary, #4f46e5)) 55%,\n var(--dag-node-background, var(--ui-surface, #ffffff))\n );\n stroke-width: 1;\n }\n .node.dashed rect {\n stroke-dasharray: 4 2;\n }\n .node.muted rect {\n fill: var(--ui-surface-muted, #f8fafc);\n stroke: var(--ui-text-muted, #64748b);\n stroke-opacity: 0.6;\n stroke-dasharray: 1.5 2;\n }\n .node.muted .icon,\n .node.muted .label {\n opacity: 0.6;\n }\n .node.selected rect {\n fill: color-mix(\n in srgb,\n var(--dag-selected-color, var(--ui-warning, #d97706)) 15%,\n var(--dag-node-background, var(--ui-surface, #ffffff))\n );\n stroke: var(--dag-selected-color, var(--ui-warning, #d97706));\n stroke-opacity: 1;\n stroke-width: 1.5;\n }\n .node.highlighted rect {\n stroke: var(--dag-highlight-color, var(--ui-danger, #dc2626));\n stroke-opacity: 1;\n stroke-width: 1.5;\n }\n .node:hover rect,\n .node:focus-visible rect {\n stroke: var(--ui-primary, #4f46e5);\n stroke-opacity: 1;\n stroke-width: 2;\n }\n .icon {\n color: var(--dag-kind-color, var(--ui-primary, #4f46e5));\n }\n .label {\n fill: var(--dag-node-text, var(--ui-text, #0f172a));\n dominant-baseline: central;\n pointer-events: none;\n }\n .empty {\n position: absolute;\n inset: 0;\n display: grid;\n place-items: center;\n margin: 0;\n font-size: var(--ui-font-size, 0.875rem);\n color: var(--ui-text-muted, #64748b);\n pointer-events: none;\n }\n .legend {\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem 1rem;\n margin: 0;\n padding: 0.5rem 0 0;\n list-style: none;\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-text-muted, #64748b);\n }\n .legend li {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n }\n .legend .swatch {\n display: inline-flex;\n line-height: 0;\n color: var(--dag-kind-color, var(--ui-primary, #4f46e5));\n }\n @media (forced-colors: active) {\n .node:focus-visible rect,\n .node.selected rect {\n stroke: Highlight;\n }\n svg:focus-visible {\n outline: 2px solid CanvasText;\n }\n }\n `,\n ];\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._resizeObserver = new ResizeObserver((entries) => this._resize(entries[0]?.contentRect));\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._resizeObserver?.disconnect();\n this._resizeObserver = null;\n }\n\n protected override firstUpdated(): void {\n const canvas = this.renderRoot.querySelector(\".canvas\");\n if (canvas) this._resizeObserver?.observe(canvas);\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has(\"nodes\") || changed.has(\"edges\") || changed.has(\"direction\") || changed.has(\"kinds\")) {\n this._relayout();\n }\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n if (changed.has(\"isStatic\") && this.isStatic) this.fit();\n if (changed.has(\"selected\") && !this._layoutChanged(changed)) this._revealSelected();\n }\n\n /** Fits the whole graph into view, never enlarging it beyond 100%. */\n fit(): void {\n if (!this._layout.nodes.length || !this._size.width) return;\n const left = Math.min(...this._layout.nodes.map((node) => node.x - node.width / 2));\n const right = Math.max(...this._layout.nodes.map((node) => node.x + node.width / 2));\n const top = Math.min(...this._layout.nodes.map((node) => node.y)) - DAG_NODE_HEIGHT / 2;\n const bottom = Math.max(...this._layout.nodes.map((node) => node.y)) + DAG_NODE_HEIGHT / 2;\n const k = this._clamp(\n Math.min(\n 1,\n (this._size.width - 2 * FIT_PADDING) / Math.max(right - left, 1),\n (this._size.height - 2 * FIT_PADDING) / Math.max(bottom - top, 1),\n ),\n );\n this._centerOn({ x: (left + right) / 2, y: (top + bottom) / 2 }, k);\n }\n\n /** Centers the view on a node (the selected one by default) at 100% zoom. */\n center(id: string | null = this.selected): void {\n const node = id ? this._positions.get(id) : undefined;\n if (node) this._centerOn(node, 1);\n }\n\n /** Zooms by `factor` (e.g. `1.25` or `0.8`) around the center of the view. */\n zoomBy(factor: number): void {\n this._zoomAround(this._size.width / 2, this._size.height / 2, factor);\n }\n\n override render() {\n const nodeCount = this._layout.nodes.length;\n const summary = `${this.label}: ${nodeCount} ${nodeCount === 1 ? \"node\" : \"nodes\"}, `\n + `${this._layout.edges.length} ${this._layout.edges.length === 1 ? \"edge\" : \"edges\"}`;\n const { x, y, k } = this._view;\n return html`\n <div class=\"canvas\">\n <svg\n class=${this._panning ? \"panning\" : \"\"}\n role=\"group\"\n tabindex=${this.isStatic ? nothing : \"0\"}\n aria-label=${summary}\n @pointerdown=${this._onPointerDown}\n @pointermove=${this._onPointerMove}\n @pointerup=${this._onPointerUp}\n @pointercancel=${this._onPointerUp}\n @wheel=${this._onWheel}\n @keydown=${this._onKeyDown}\n >\n <defs>\n <marker id=\"arrow\" viewBox=\"0 -4 8 8\" refX=\"8\" refY=\"0\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto\">\n <path class=\"arrow\" d=\"M0,-4L8,0L0,4Z\" />\n </marker>\n <marker id=\"arrow-highlighted\" viewBox=\"0 -4 8 8\" refX=\"8\" refY=\"0\" markerWidth=\"7\" markerHeight=\"7\"\n orient=\"auto\">\n <path class=\"arrow highlighted\" d=\"M0,-4L8,0L0,4Z\" />\n </marker>\n <linearGradient id=\"node-fill\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop class=\"gloss-start\" offset=\"0%\" />\n <stop class=\"gloss-end\" offset=\"100%\" />\n </linearGradient>\n </defs>\n <g transform=\"translate(${x},${y}) scale(${k})\">\n <g class=\"edges ${this._hovered ? \"emphasis\" : \"\"}\">${this._renderEdges()}</g>\n <g class=\"nodes\">${this._layout.nodes.map((node) => this._renderNode(node))}</g>\n </g>\n </svg>\n ${nodeCount ? nothing : html`<p class=\"empty\"><slot name=\"empty\">No nodes to show.</slot></p>`}\n ${this._renderToolbar()}\n </div>\n ${this.legend ? this._renderLegend() : nothing}\n `;\n }\n\n /** The enabled `controls`, in their fixed order; none in static mode or without nodes. */\n private get _controls(): DagControl[] {\n if (this.isStatic || !this._layout.nodes.length) return [];\n const enabled = new Set(this.controls.split(/\\s+/));\n return CONTROLS.filter((control) => enabled.has(control));\n }\n\n private _renderToolbar() {\n const controls = this._controls;\n if (!controls.length) return nothing;\n const vertical = this.direction === \"TB\";\n const button = (control: string, label: string, icon: SVGTemplateResult, action: () => void) => html`\n <icon-button data-control=${control} label=${label} .icon=${icon} @click=${action}></icon-button>`;\n return html`<div class=\"toolbar\" role=\"toolbar\" aria-label=\"Graph view\">\n ${controls.map((control) => {\n switch (control) {\n case \"zoom\":\n return html`${button(\"zoom-in\", \"Zoom in\", iconMagnifyingGlassPlus(18), () => this.zoomBy(KEY_ZOOM))}\n ${button(\"zoom-out\", \"Zoom out\", iconMagnifyingGlassMinus(18), () => this.zoomBy(1 / KEY_ZOOM))}`;\n case \"fit\":\n return button(\"fit\", \"Fit graph\", iconArrowsPointingIn(18), () => this.fit());\n case \"center\":\n return html`<icon-button\n data-control=\"center\"\n label=\"Center selected node\"\n .icon=${iconViewfinderCircle(18)}\n ?disabled=${!this.selected || !this._positions.has(this.selected)}\n @click=${() => this.center()}\n ></icon-button>`;\n case \"direction\":\n return button(\n \"direction\",\n vertical ? \"Lay out left to right\" : \"Lay out top to bottom\",\n vertical ? iconArrowLongRight(18) : iconArrowLongDown(18),\n () => this._toggleDirection(),\n );\n }\n })}\n </div>`;\n }\n\n private _toggleDirection(): void {\n this.direction = this.direction === \"LR\" ? \"TB\" : \"LR\";\n this.dispatchEvent(\n new CustomEvent<DagDirectionChangeDetail>(\"direction-change\", {\n detail: { direction: this.direction },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n private _renderEdges(): SVGTemplateResult[] {\n const highlighted = new Set(\n this.edges.filter((edge) => edge.highlighted).map((edge) => this._edgeKey(edge)),\n );\n const names = new Map(this.nodes.map((node) => [node.id, node.label]));\n return this._layout.edges.map((edge) => {\n const isHighlighted = highlighted.has(this._edgeKey(edge));\n const incident = edge.source === this._hovered || edge.target === this._hovered;\n const classes = [\n \"edge\",\n edge.backward ? \"backward\" : \"\",\n isHighlighted ? \"highlighted\" : \"\",\n incident ? \"incident\" : \"\",\n ].filter(Boolean).join(\" \");\n return svg`<path class=${classes} data-source=${edge.source} data-target=${edge.target}\n d=${route(edge.points) ?? \"\"} marker-end=\"url(#${isHighlighted ? \"arrow-highlighted\" : \"arrow\"})\">\n <title>${names.get(edge.source)} → ${names.get(edge.target)}</title></path>`;\n });\n }\n\n private _renderNode(position: DagLayoutNode): SVGTemplateResult {\n const node = this.nodes.find((candidate) => candidate.id === position.id)!;\n const kind = node.kind ? this.kinds[node.kind] : undefined;\n const classes = [\n \"node\",\n kind?.dashed ? \"dashed\" : \"\",\n node.muted ? \"muted\" : \"\",\n node.highlighted ? \"highlighted\" : \"\",\n node.id === this.selected ? \"selected\" : \"\",\n ].filter(Boolean).join(\" \");\n const left = -position.width / 2;\n const offset = kind?.icon ? DAG_LABEL_OFFSET : DAG_LABEL_OFFSET_PLAIN;\n const name = kind?.label ? `${node.label} (${kind.label})` : node.label;\n return svg`<g class=${classes} data-id=${node.id} role=\"button\" tabindex=\"0\"\n aria-pressed=${node.id === this.selected ? \"true\" : \"false\"} aria-label=${name}\n style=${kind?.color ? `--dag-kind-color: ${kind.color}` : nothing}\n transform=\"translate(${position.x},${position.y})\"\n @click=${() => this._activate(node.id)}\n @keydown=${(event: KeyboardEvent) => this._onNodeKey(event, node.id)}\n @pointerenter=${() => { this._hovered = node.id; }}\n @pointerleave=${() => { this._hovered = null; }}\n @focus=${() => { this._hovered = node.id; }}\n @blur=${() => { this._hovered = null; }}>\n <title>${name}</title>\n <rect x=${left} y=${-DAG_NODE_HEIGHT / 2} width=${position.width} height=${DAG_NODE_HEIGHT}></rect>\n ${kind?.icon\n ? svg`<g class=\"icon\" transform=\"translate(${left + 6},${-ICON_SIZE / 2})\">${kind.icon(ICON_SIZE)}</g>`\n : nothing}\n <text class=\"label\" x=${left + offset}>${position.label}</text>\n </g>`;\n }\n\n private _renderLegend() {\n const entries = Object.entries(this.kinds).filter(([, kind]) => kind.label);\n if (!entries.length) return nothing;\n return html`<ul class=\"legend\" aria-label=\"Legend\">\n ${entries.map(([key, kind]) => html`<li data-kind=${key}\n style=${kind.color ? `--dag-kind-color: ${kind.color}` : nothing}>\n ${kind.icon ? html`<span class=\"swatch\" aria-hidden=\"true\">${kind.icon(ICON_SIZE)}</span>` : nothing}\n ${kind.label}</li>`)}\n </ul>`;\n }\n\n private _edgeKey(edge: { source: string; target: string }): string {\n return `${edge.source}\\u0000${edge.target}`;\n }\n\n private _layoutChanged(changed: PropertyValues<this>): boolean {\n return changed.has(\"nodes\") || changed.has(\"edges\") || changed.has(\"direction\") || changed.has(\"kinds\");\n }\n\n /** Lays the graph out again, keeping the selected node where it was on screen. */\n private _relayout(): void {\n const previous = this.selected ? this._positions.get(this.selected) : undefined;\n const previousSelected = this._lastSelected;\n this._updateMeasure();\n const inputs = this.nodes.map((node) => ({\n id: node.id,\n label: node.label,\n hasIcon: Boolean(node.kind && this.kinds[node.kind]?.icon),\n }));\n this._layout = layoutDag(inputs, this.edges, this.direction, this._measure);\n this._positions = new Map(this._layout.nodes.map((node) => [node.id, node]));\n const directionChanged = this._lastDirection !== null && this._lastDirection !== this.direction;\n this._lastSelected = this.selected;\n this._lastDirection = this.direction;\n if (!this._size.width) return;\n if (!this._viewReady) {\n this._initView();\n return;\n }\n const current = this.selected ? this._positions.get(this.selected) : undefined;\n if (current && previous && previousSelected === this.selected && !directionChanged && !this.isStatic) {\n const { x, y, k } = this._view;\n this._view = { k, x: x + k * (previous.x - current.x), y: y + k * (previous.y - current.y) };\n } else {\n this._frame();\n }\n }\n\n private _initView(): void {\n this._viewReady = true;\n this._frame();\n }\n\n /**\n * Shows the whole graph when it fits at a readable zoom (always, when static); otherwise centers the selected\n * node at 100%.\n */\n private _frame(): void {\n this.fit();\n if (this.isStatic) return;\n if (this._view.k < READABLE_SCALE && this.selected && this._positions.has(this.selected)) this.center();\n }\n\n /** Brings the selected node into view if it is outside the visible area. */\n private _revealSelected(): void {\n const node = this.selected ? this._positions.get(this.selected) : undefined;\n if (!node || !this._size.width || this.isStatic) return;\n const { x, y, k } = this._view;\n const screenX = x + k * node.x;\n const screenY = y + k * node.y;\n const visible = screenX > 0 && screenX < this._size.width && screenY > 0 && screenY < this._size.height;\n if (!visible) this.center();\n }\n\n /** Measures labels with the host's actual font, so themes with other fonts still size cards correctly. */\n private _updateMeasure(): void {\n const style = getComputedStyle(this);\n const font = `${style.fontSize} ${style.fontFamily}`;\n if (font === this._measureFont) return;\n this._measureFont = font;\n const context = document.createElement(\"canvas\").getContext(\"2d\");\n if (!context) {\n this._measure = approximateTextWidth;\n return;\n }\n context.font = font;\n const widths = new Map<string, number>();\n this._measure = (text) => {\n if (!widths.has(text)) widths.set(text, context.measureText(text).width);\n return widths.get(text)!;\n };\n }\n\n private _resize(rect: DOMRectReadOnly | undefined): void {\n if (!rect) return;\n const { width, height } = rect;\n const previous = this._size;\n this._size = { width, height };\n if (!width || !height) return;\n if (!this._viewReady) {\n if (this._layout.nodes.length) this._initView();\n return;\n }\n if (this.isStatic) {\n this.fit();\n return;\n }\n this._view = {\n ...this._view,\n x: this._view.x + (width - previous.width) / 2,\n y: this._view.y + (height - previous.height) / 2,\n };\n }\n\n private _clamp(k: number): number {\n return Math.min(MAX_SCALE, Math.max(MIN_SCALE, k));\n }\n\n private _centerOn(point: DagPoint, k: number): void {\n this._view = { k, x: this._size.width / 2 - k * point.x, y: this._size.height / 2 - k * point.y };\n }\n\n private _zoomAround(screenX: number, screenY: number, factor: number): void {\n const { x, y, k } = this._view;\n const next = this._clamp(k * factor);\n const ratio = next / k;\n this._view = { k: next, x: screenX - (screenX - x) * ratio, y: screenY - (screenY - y) * ratio };\n }\n\n private _activate(id: string): void {\n if (this._suppressClick) {\n this._suppressClick = false;\n return;\n }\n this.selected = id;\n this.dispatchEvent(\n new CustomEvent<DagNodeSelectDetail>(\"node-select\", { detail: { id }, bubbles: true, composed: true }),\n );\n }\n\n private _onNodeKey(event: KeyboardEvent, id: string): void {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n event.stopPropagation();\n this._activate(id);\n }\n\n private _onPointerDown(event: PointerEvent): void {\n if (event.button !== 0 || this.isStatic) return;\n this._suppressClick = false;\n this._drag = { pointerId: event.pointerId, x: event.clientX, y: event.clientY, view: this._view, moved: false };\n }\n\n private _onPointerMove(event: PointerEvent): void {\n const drag = this._drag;\n if (!drag || drag.pointerId !== event.pointerId) return;\n const dx = event.clientX - drag.x;\n const dy = event.clientY - drag.y;\n if (!drag.moved && Math.hypot(dx, dy) < DRAG_THRESHOLD) return;\n if (!drag.moved) {\n drag.moved = true;\n this._panning = true;\n this._svg.setPointerCapture(event.pointerId);\n }\n this._view = { ...drag.view, x: drag.view.x + dx, y: drag.view.y + dy };\n }\n\n private _onPointerUp(event: PointerEvent): void {\n const drag = this._drag;\n if (!drag || drag.pointerId !== event.pointerId) return;\n this._suppressClick = drag.moved;\n this._drag = null;\n this._panning = false;\n if (this._svg.hasPointerCapture(event.pointerId)) this._svg.releasePointerCapture(event.pointerId);\n }\n\n /** Pinch gestures and Ctrl/⌘ + wheel zoom; a plain wheel is left to the page so it can scroll. */\n private _onWheel(event: WheelEvent): void {\n if ((!event.ctrlKey && !event.metaKey) || this.isStatic) return;\n event.preventDefault();\n const bounds = this._svg.getBoundingClientRect();\n // d3-zoom's wheel scale: pixel, line, and page deltas, amplified for pinch (which reports ctrlKey and\n // small deltas); one event zooms at most 2x either way.\n const unit = event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002;\n const steps = Math.max(-1, Math.min(1, -event.deltaY * unit * (event.ctrlKey ? 10 : 1)));\n this._zoomAround(event.clientX - bounds.left, event.clientY - bounds.top, 2 ** steps);\n }\n\n private _onKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || this.isStatic) return;\n const pan: Record<string, [number, number]> = {\n ArrowLeft: [KEY_PAN, 0],\n ArrowRight: [-KEY_PAN, 0],\n ArrowUp: [0, KEY_PAN],\n ArrowDown: [0, -KEY_PAN],\n };\n if (event.key in pan) {\n const [dx, dy] = pan[event.key];\n this._view = { ...this._view, x: this._view.x + dx, y: this._view.y + dy };\n } else if (event.key === \"+\" || event.key === \"=\") {\n this.zoomBy(KEY_ZOOM);\n } else if (event.key === \"-\") {\n this.zoomBy(1 / KEY_ZOOM);\n } else if (event.key === \"0\") {\n this.fit();\n } else {\n return;\n }\n event.preventDefault();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dag-graph\": DagGraph;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dag-graph.js","sourceRoot":"","sources":["../src/dag-graph.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,EAA+C,MAAM,KAAK,CAAC;AACvG,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EACL,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,SAAS,GAOV,MAAM,uBAAuB,CAAC;AA+E/B,MAAM,SAAS,GAAG,EAA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EAAE,IAAI,EAAE,CAAC;0CAA8B;AAGO;IAAhE,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,CAAC;0CAAkB;AAEjE;IAAhB,KAAK,EAAE;uCAA4C;AACnC;IAAhB,KAAK,EAAE;0CAAwC;AAC/B;IAAhB,KAAK,EAAE;0CAA0B;AAEZ;IAArB,KAAK,CAAC,KAAK,CAAC;sCAA8B;AAtChC,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA+vBpB","sourcesContent":["import { LitElement, css, html, nothing, svg, type PropertyValues, type SVGTemplateResult } from \"lit\";\nimport { customElement, property, query, state } from \"lit/decorators.js\";\nimport { curveBasis, line } from \"d3-shape\";\nimport { tokens } from \"./tokens.js\";\nimport {\n iconArrowLongDown,\n iconArrowLongRight,\n iconArrowsPointingIn,\n iconMagnifyingGlassMinus,\n iconMagnifyingGlassPlus,\n iconViewfinderCircle,\n} from \"./icons.js\";\nimport \"./icon-button.js\";\nimport {\n approximateTextWidth,\n DAG_LABEL_OFFSET,\n DAG_EDGE_LABEL_HEIGHT,\n DAG_LABEL_OFFSET_PLAIN,\n DAG_NODE_HEIGHT,\n layoutDag,\n type DagDirection,\n type DagLayout,\n type DagLayoutEdge,\n type DagLayoutNode,\n type DagPoint,\n type MeasureText,\n} from \"./utils/dag-layout.js\";\n\nexport type { DagDirection } from \"./utils/dag-layout.js\";\n\n/** One node of a `dag-graph`. */\nexport interface DagNode {\n /** Unique id, referenced by edges and by `selected`. */\n id: string;\n /** Text shown on the node; long labels are shortened with an ellipsis (the full text is the tooltip). */\n label: string;\n /** Key into `kinds`, which supplies the node's icon, color, and border style. */\n kind?: string;\n /** Draws the node faded with a dotted border, e.g. for data that is incomplete or unavailable. */\n muted?: boolean;\n /** Emphasizes the node, e.g. as part of a highlighted path or cycle. */\n highlighted?: boolean;\n}\n\n/** One directed edge of a `dag-graph`, pointing from `source` to `target`. */\nexport interface DagEdge {\n source: string;\n target: string;\n /** Emphasizes the edge, e.g. as part of a highlighted path or cycle. */\n highlighted?: boolean;\n /**\n * Text shown midway along the edge, with room reserved for it in the layout; long labels are shortened with an\n * ellipsis (the full text is the tooltip).\n */\n label?: string;\n /**\n * Non-negative magnitude, e.g. a call count: the edge is drawn thicker in proportion to the graph's heaviest\n * weight (1px for none, up to 6px), and the weight is added to its tooltip. Other values are ignored.\n */\n weight?: number;\n}\n\n/** Presentation of one node kind. */\nexport interface DagNodeKind {\n /** Name shown in the legend and appended to the node tooltip. */\n label?: string;\n /** Accent color (any CSS color) for the icon and border; defaults to `--ui-primary`. */\n color?: string;\n /** Icon factory, called with the icon size in pixels — e.g. one of the package's `icon*` exports. */\n icon?: (size: number) => SVGTemplateResult;\n /** Draws the node with a dashed border. */\n dashed?: boolean;\n}\n\n/** A built-in toolbar control: `zoom` (in and out), `fit`, `center` (on the selected node), or `direction`. */\nexport type DagControl = \"zoom\" | \"fit\" | \"center\" | \"direction\";\n\n/** Detail of the `direction-change` event. */\nexport interface DagDirectionChangeDetail {\n direction: DagDirection;\n}\n\n/** Detail of the `node-select` event. */\nexport interface DagNodeSelectDetail {\n id: string;\n}\n\ninterface View {\n x: number;\n y: number;\n k: number;\n}\n\n/** A laid-out edge with everything needed to draw it and its label. */\ninterface StyledEdge {\n layout: DagLayoutEdge;\n title: string;\n highlighted: boolean;\n incident: boolean;\n /** Stroke width in pixels, for weighted edges only. */\n width?: number;\n /** Arrowhead length in layout units, for weighted edges only. */\n arrow?: number;\n}\n\nconst ICON_SIZE = 14;\nconst MIN_SCALE = 0.05;\nconst MAX_SCALE = 3;\nconst FIT_PADDING = 24;\n/** Below this fitted zoom labels get hard to read, so the selected node is shown at 100% instead. */\nconst READABLE_SCALE = 0.6;\nconst DRAG_THRESHOLD = 4;\nconst KEY_PAN = 48;\nconst KEY_ZOOM = 1.25;\nconst CONTROLS: readonly DagControl[] = [\"zoom\", \"fit\", \"center\", \"direction\"];\n/** Stroke width, in pixels, of the graph's heaviest edge. */\nconst MAX_EDGE_WIDTH = 6;\n\nconst route = line<DagPoint>()\n .x((point) => point.x)\n .y((point) => point.y)\n .curve(curveBasis);\n\n/**\n * Interactive layered drawing of a directed graph — dependencies, pipelines, or any node-link data.\n *\n * Nodes are placed in layers (via dagre) so edges flow left to right (or top to bottom with\n * `direction=\"TB\"`); cycles are allowed, and the edges closing them are drawn dashed and point backward.\n * Each node is a compact card sized to its label, with an optional icon, color, and border style from\n * `kinds`. The whole graph is shown when it fits at a readable zoom; otherwise the selected node is centered at\n * 100%. Drag to pan; pinch or Ctrl/⌘ + wheel to zoom (a plain wheel scrolls the page). With keyboard\n * focus on the graph, arrow keys pan, `+`/`-` zoom, and `0` fits the graph. Clicking a node, or pressing\n * Enter/Space on it, selects it. A toolbar in the top-right corner offers the `controls` you enable.\n *\n * Edges can carry an optional `label`, drawn midway along the edge, and an optional `weight`, which draws the\n * edge thicker in proportion to the heaviest weight in the graph.\n *\n * Set `static` to present a fixed picture: the graph is always fitted into view, panning and zooming\n * are off, and the toolbar is hidden; nodes can still be selected.\n *\n * Colors can be changed with these custom properties: `--dag-node-background`, `--dag-node-text`,\n * `--dag-edge-color`, `--dag-selected-color`, and `--dag-highlight-color`; `--dag-graph-height` sets the\n * height (default `24rem`).\n *\n * @element dag-graph\n * @fires node-select - A node was clicked or activated with the keyboard; `detail` is `{ id }`.\n * @fires direction-change - The toolbar's direction control flipped `direction`; `detail` is `{ direction }`.\n * @slot empty - Shown when there are no nodes.\n */\n@customElement(\"dag-graph\")\nexport class DagGraph extends LitElement {\n /** Nodes to draw. */\n @property({ type: Array }) nodes: DagNode[] = [];\n\n /** Directed edges between `nodes`; edges with an unknown endpoint or to the node itself are ignored. */\n @property({ type: Array }) edges: DagEdge[] = [];\n\n /** Presentation per node `kind`: legend label, color, icon, and border style. */\n @property({ attribute: false }) kinds: Record<string, DagNodeKind> = {};\n\n /**\n * Id of the selected node. Selecting a node updates it; when it changes to a node outside the visible area,\n * the view follows.\n */\n @property({ reflect: true }) selected: string | null = null;\n\n /** Layer direction: `LR` (left to right) or `TB` (top to bottom). */\n @property({ reflect: true }) direction: DagDirection = \"LR\";\n\n /** Accessible name of the graph; the node and edge counts are appended. */\n @property() label = \"Directed graph\";\n\n /** Shows a legend of `kinds` below the graph. */\n @property({ type: Boolean, reflect: true }) legend = false;\n\n /**\n * Space-separated toolbar controls to show: any of `zoom`, `fit`, `center`, and `direction`, in that\n * order. An empty value hides the toolbar.\n */\n @property({ reflect: true }) controls = \"zoom fit center\";\n\n /** Presents a static picture: always fitted, with panning, zooming, and the toolbar turned off. */\n @property({ type: Boolean, reflect: true, attribute: \"static\" }) isStatic = false;\n\n @state() private _view: View = { x: 0, y: 0, k: 1 };\n @state() private _hovered: string | null = null;\n @state() private _panning = false;\n\n @query(\"svg\") private _svg!: SVGSVGElement;\n\n private _layout: DagLayout = { nodes: [], edges: [] };\n private _positions = new Map<string, DagLayoutNode>();\n private _size = { width: 0, height: 0 };\n private _viewReady = false;\n private _lastSelected: string | null = null;\n private _lastDirection: DagDirection | null = null;\n private _measure: MeasureText = approximateTextWidth;\n private _measureFont = \"\";\n private _resizeObserver: ResizeObserver | null = null;\n private _drag: { pointerId: number; x: number; y: number; view: View; moved: boolean } | null = null;\n private _suppressClick = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: flex;\n flex-direction: column;\n height: var(--dag-graph-height, 24rem);\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n font-size: var(--ui-font-size-xs, 0.6875rem);\n color: var(--ui-text, #0f172a);\n }\n .canvas {\n position: relative;\n flex: 1;\n min-height: 0;\n }\n svg {\n display: block;\n width: 100%;\n height: 100%;\n cursor: grab;\n touch-action: none;\n user-select: none;\n outline: none;\n }\n svg.panning {\n cursor: grabbing;\n }\n :host([static]) svg {\n cursor: default;\n }\n .toolbar {\n position: absolute;\n top: 0.5rem;\n right: 0.5rem;\n display: flex;\n gap: 0.25rem;\n padding: 0.25rem;\n background:\n var(--ui-button-secondary-background, none),\n var(--ui-surface, #ffffff);\n border: var(--ui-border-width, 1px) solid var(--ui-button-secondary-border, var(--ui-border, #e2e8f0));\n border-radius: var(--ui-radius, 0.5rem);\n box-shadow:\n var(--ui-button-highlight, 0 0 0 0 transparent),\n var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n }\n svg:focus-visible {\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .edge {\n fill: none;\n stroke: var(--dag-edge-color, var(--ui-text-muted, #64748b));\n stroke-opacity: 0.45;\n stroke-width: var(--_dag-edge-width, 1px);\n vector-effect: non-scaling-stroke;\n }\n .edge.backward {\n stroke-dasharray: 4 3;\n }\n .edges.emphasis .edge {\n stroke-opacity: 0.08;\n }\n .edges.emphasis .edge.incident {\n stroke-opacity: 0.9;\n }\n .edge.highlighted,\n .edges.emphasis .edge.highlighted {\n stroke: var(--dag-highlight-color, var(--ui-danger, #dc2626));\n stroke-opacity: 1;\n stroke-width: calc(var(--_dag-edge-width, 1px) + 1px);\n }\n .edge-label rect {\n rx: var(--ui-radius-sm, 0.25rem);\n fill: var(--ui-surface, #ffffff);\n }\n .edge-label text {\n fill: var(--ui-text-muted, #64748b);\n text-anchor: middle;\n dominant-baseline: central;\n pointer-events: none;\n }\n .edge-label.highlighted text {\n fill: var(--dag-highlight-color, var(--ui-danger, #dc2626));\n }\n .edge-labels.emphasis .edge-label {\n opacity: 0.25;\n }\n .edge-labels.emphasis .edge-label.incident,\n .edge-labels.emphasis .edge-label.highlighted {\n opacity: 1;\n }\n .arrow {\n fill: var(--dag-edge-color, var(--ui-text-muted, #64748b));\n fill-opacity: 0.7;\n }\n .arrow.highlighted {\n fill: var(--dag-highlight-color, var(--ui-danger, #dc2626));\n fill-opacity: 1;\n }\n .node {\n cursor: pointer;\n outline: none;\n }\n .gloss-start {\n stop-color: var(--ui-button-secondary-gloss-start, var(--ui-surface, #ffffff));\n }\n .gloss-end {\n stop-color: var(--ui-button-secondary-gloss-end, var(--ui-surface, #ffffff));\n }\n .node rect {\n rx: var(--ui-radius-sm, 0.25rem);\n fill: var(--dag-node-background, url(#node-fill));\n stroke: color-mix(\n in srgb,\n var(--dag-kind-color, var(--ui-primary, #4f46e5)) 55%,\n var(--dag-node-background, var(--ui-surface, #ffffff))\n );\n stroke-width: 1;\n }\n .node.dashed rect {\n stroke-dasharray: 4 2;\n }\n .node.muted rect {\n fill: var(--ui-surface-muted, #f8fafc);\n stroke: var(--ui-text-muted, #64748b);\n stroke-opacity: 0.6;\n stroke-dasharray: 1.5 2;\n }\n .node.muted .icon,\n .node.muted .label {\n opacity: 0.6;\n }\n .node.selected rect {\n fill: color-mix(\n in srgb,\n var(--dag-selected-color, var(--ui-warning, #d97706)) 15%,\n var(--dag-node-background, var(--ui-surface, #ffffff))\n );\n stroke: var(--dag-selected-color, var(--ui-warning, #d97706));\n stroke-opacity: 1;\n stroke-width: 1.5;\n }\n .node.highlighted rect {\n stroke: var(--dag-highlight-color, var(--ui-danger, #dc2626));\n stroke-opacity: 1;\n stroke-width: 1.5;\n }\n .node:hover rect,\n .node:focus-visible rect {\n stroke: var(--ui-primary, #4f46e5);\n stroke-opacity: 1;\n stroke-width: 2;\n }\n .icon {\n color: var(--dag-kind-color, var(--ui-primary, #4f46e5));\n }\n .label {\n fill: var(--dag-node-text, var(--ui-text, #0f172a));\n dominant-baseline: central;\n pointer-events: none;\n }\n .empty {\n position: absolute;\n inset: 0;\n display: grid;\n place-items: center;\n margin: 0;\n font-size: var(--ui-font-size, 0.875rem);\n color: var(--ui-text-muted, #64748b);\n pointer-events: none;\n }\n .legend {\n display: flex;\n flex-wrap: wrap;\n gap: 0.25rem 1rem;\n margin: 0;\n padding: 0.5rem 0 0;\n list-style: none;\n font-size: var(--ui-font-size-sm, 0.75rem);\n color: var(--ui-text-muted, #64748b);\n }\n .legend li {\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n }\n .legend .swatch {\n display: inline-flex;\n line-height: 0;\n color: var(--dag-kind-color, var(--ui-primary, #4f46e5));\n }\n @media (forced-colors: active) {\n .node:focus-visible rect,\n .node.selected rect {\n stroke: Highlight;\n }\n svg:focus-visible {\n outline: 2px solid CanvasText;\n }\n }\n `,\n ];\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._resizeObserver = new ResizeObserver((entries) => this._resize(entries[0]?.contentRect));\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._resizeObserver?.disconnect();\n this._resizeObserver = null;\n }\n\n protected override firstUpdated(): void {\n const canvas = this.renderRoot.querySelector(\".canvas\");\n if (canvas) this._resizeObserver?.observe(canvas);\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n if (changed.has(\"nodes\") || changed.has(\"edges\") || changed.has(\"direction\") || changed.has(\"kinds\")) {\n this._relayout();\n }\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n if (changed.has(\"isStatic\") && this.isStatic) this.fit();\n if (changed.has(\"selected\") && !this._layoutChanged(changed)) this._revealSelected();\n }\n\n /** Fits the whole graph into view, never enlarging it beyond 100%. */\n fit(): void {\n if (!this._layout.nodes.length || !this._size.width) return;\n const boxes = [\n ...this._layout.nodes.map((node) => ({ ...node, height: DAG_NODE_HEIGHT })),\n ...this._layout.edges.flatMap((edge) => (edge.label ? [{ ...edge.label, height: DAG_EDGE_LABEL_HEIGHT }] : [])),\n ];\n const left = Math.min(...boxes.map((box) => box.x - box.width / 2));\n const right = Math.max(...boxes.map((box) => box.x + box.width / 2));\n const top = Math.min(...boxes.map((box) => box.y - box.height / 2));\n const bottom = Math.max(...boxes.map((box) => box.y + box.height / 2));\n const k = this._clamp(\n Math.min(\n 1,\n (this._size.width - 2 * FIT_PADDING) / Math.max(right - left, 1),\n (this._size.height - 2 * FIT_PADDING) / Math.max(bottom - top, 1),\n ),\n );\n this._centerOn({ x: (left + right) / 2, y: (top + bottom) / 2 }, k);\n }\n\n /** Centers the view on a node (the selected one by default) at 100% zoom. */\n center(id: string | null = this.selected): void {\n const node = id ? this._positions.get(id) : undefined;\n if (node) this._centerOn(node, 1);\n }\n\n /** Zooms by `factor` (e.g. `1.25` or `0.8`) around the center of the view. */\n zoomBy(factor: number): void {\n this._zoomAround(this._size.width / 2, this._size.height / 2, factor);\n }\n\n override render() {\n const nodeCount = this._layout.nodes.length;\n const summary = `${this.label}: ${nodeCount} ${nodeCount === 1 ? \"node\" : \"nodes\"}, `\n + `${this._layout.edges.length} ${this._layout.edges.length === 1 ? \"edge\" : \"edges\"}`;\n const { x, y, k } = this._view;\n const edges = this._styledEdges();\n const emphasis = this._hovered ? \"emphasis\" : \"\";\n return html`\n <div class=\"canvas\">\n <svg\n class=${this._panning ? \"panning\" : \"\"}\n role=\"group\"\n tabindex=${this.isStatic ? nothing : \"0\"}\n aria-label=${summary}\n @pointerdown=${this._onPointerDown}\n @pointermove=${this._onPointerMove}\n @pointerup=${this._onPointerUp}\n @pointercancel=${this._onPointerUp}\n @wheel=${this._onWheel}\n @keydown=${this._onKeyDown}\n >\n <defs>\n <marker id=\"arrow\" viewBox=\"0 -4 8 8\" refX=\"8\" refY=\"0\" markerWidth=\"7\" markerHeight=\"7\" orient=\"auto\">\n <path class=\"arrow\" d=\"M0,-4L8,0L0,4Z\" />\n </marker>\n <marker id=\"arrow-highlighted\" viewBox=\"0 -4 8 8\" refX=\"8\" refY=\"0\" markerWidth=\"7\" markerHeight=\"7\"\n orient=\"auto\">\n <path class=\"arrow highlighted\" d=\"M0,-4L8,0L0,4Z\" />\n </marker>\n ${this._renderWeightedArrows(edges)}\n <linearGradient id=\"node-fill\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop class=\"gloss-start\" offset=\"0%\" />\n <stop class=\"gloss-end\" offset=\"100%\" />\n </linearGradient>\n </defs>\n <g transform=\"translate(${x},${y}) scale(${k})\">\n <g class=\"edges ${emphasis}\">${edges.map((edge) => this._renderEdge(edge))}</g>\n <g class=\"edge-labels ${emphasis}\">${edges.map((edge) => this._renderEdgeLabel(edge))}</g>\n <g class=\"nodes\">${this._layout.nodes.map((node) => this._renderNode(node))}</g>\n </g>\n </svg>\n ${nodeCount ? nothing : html`<p class=\"empty\"><slot name=\"empty\">No nodes to show.</slot></p>`}\n ${this._renderToolbar()}\n </div>\n ${this.legend ? this._renderLegend() : nothing}\n `;\n }\n\n /** The enabled `controls`, in their fixed order; none in static mode or without nodes. */\n private get _controls(): DagControl[] {\n if (this.isStatic || !this._layout.nodes.length) return [];\n const enabled = new Set(this.controls.split(/\\s+/));\n return CONTROLS.filter((control) => enabled.has(control));\n }\n\n private _renderToolbar() {\n const controls = this._controls;\n if (!controls.length) return nothing;\n const vertical = this.direction === \"TB\";\n const button = (control: string, label: string, icon: SVGTemplateResult, action: () => void) => html`\n <icon-button data-control=${control} label=${label} .icon=${icon} @click=${action}></icon-button>`;\n return html`<div class=\"toolbar\" role=\"toolbar\" aria-label=\"Graph view\">\n ${controls.map((control) => {\n switch (control) {\n case \"zoom\":\n return html`${button(\"zoom-in\", \"Zoom in\", iconMagnifyingGlassPlus(18), () => this.zoomBy(KEY_ZOOM))}\n ${button(\"zoom-out\", \"Zoom out\", iconMagnifyingGlassMinus(18), () => this.zoomBy(1 / KEY_ZOOM))}`;\n case \"fit\":\n return button(\"fit\", \"Fit graph\", iconArrowsPointingIn(18), () => this.fit());\n case \"center\":\n return html`<icon-button\n data-control=\"center\"\n label=\"Center selected node\"\n .icon=${iconViewfinderCircle(18)}\n ?disabled=${!this.selected || !this._positions.has(this.selected)}\n @click=${() => this.center()}\n ></icon-button>`;\n case \"direction\":\n return button(\n \"direction\",\n vertical ? \"Lay out left to right\" : \"Lay out top to bottom\",\n vertical ? iconArrowLongRight(18) : iconArrowLongDown(18),\n () => this._toggleDirection(),\n );\n }\n })}\n </div>`;\n }\n\n private _toggleDirection(): void {\n this.direction = this.direction === \"LR\" ? \"TB\" : \"LR\";\n this.dispatchEvent(\n new CustomEvent<DagDirectionChangeDetail>(\"direction-change\", {\n detail: { direction: this.direction },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n /** Pairs each laid-out edge with its input's presentation; on duplicate edges the last one wins. */\n private _styledEdges(): StyledEdge[] {\n const inputs = new Map(this.edges.map((edge) => [this._edgeKey(edge), edge]));\n const highlighted = new Set(\n this.edges.filter((edge) => edge.highlighted).map((edge) => this._edgeKey(edge)),\n );\n const names = new Map(this.nodes.map((node) => [node.id, node.label]));\n const weighted = this._layout.edges.map((edge) => {\n const weight = inputs.get(this._edgeKey(edge))?.weight;\n return typeof weight === \"number\" && Number.isFinite(weight) && weight >= 0 ? weight : undefined;\n });\n const heaviest = Math.max(0, ...weighted.map((weight) => weight ?? 0));\n return this._layout.edges.map((edge, index) => {\n const input = inputs.get(this._edgeKey(edge));\n const weight = weighted[index];\n const isHighlighted = highlighted.has(this._edgeKey(edge));\n const width = weight === undefined\n ? undefined\n : Math.round(2 * (1 + ((MAX_EDGE_WIDTH - 1) * weight) / (heaviest || 1))) / 2;\n const title = `${names.get(edge.source)} → ${names.get(edge.target)}`\n + (input?.label ? `: ${input.label}` : \"\")\n + (weight === undefined ? \"\" : ` (weight ${weight.toLocaleString()})`);\n return {\n layout: edge,\n title,\n highlighted: isHighlighted,\n incident: edge.source === this._hovered || edge.target === this._hovered,\n width,\n arrow: width === undefined ? undefined : 5 + 2 * (width + (isHighlighted ? 1 : 0)),\n };\n });\n }\n\n /**\n * Arrowheads for weighted edges, one per size and color: they grow more slowly than the stroke and sit just\n * past the shortened path, so a thick stroke never pokes out beside the arrow's tip.\n */\n private _renderWeightedArrows(edges: StyledEdge[]): SVGTemplateResult[] {\n const sizes = new Map<string, { size: number; highlighted: boolean }>();\n for (const { arrow, highlighted } of edges) {\n if (arrow !== undefined) sizes.set(this._arrowId(arrow, highlighted), { size: arrow, highlighted });\n }\n return [...sizes].map(([id, { size, highlighted }]) => svg`<marker id=${id} viewBox=\"0 -4 8 8\" refX=\"0\"\n refY=\"0\" markerUnits=\"userSpaceOnUse\" markerWidth=${size} markerHeight=${size} orient=\"auto\">\n <path class=\"arrow ${highlighted ? \"highlighted\" : \"\"}\" d=\"M0,-4L8,0L0,4Z\" /></marker>`);\n }\n\n private _arrowId(size: number, highlighted: boolean): string {\n return `arrow-${size}${highlighted ? \"-highlighted\" : \"\"}`;\n }\n\n private _renderEdge(edge: StyledEdge): SVGTemplateResult {\n const { layout, arrow } = edge;\n const classes = [\n \"edge\",\n layout.backward ? \"backward\" : \"\",\n edge.highlighted ? \"highlighted\" : \"\",\n edge.incident ? \"incident\" : \"\",\n ].filter(Boolean).join(\" \");\n const marker = arrow === undefined\n ? (edge.highlighted ? \"arrow-highlighted\" : \"arrow\")\n : this._arrowId(arrow, edge.highlighted);\n const points = arrow === undefined ? layout.points : this._shortenEnd(layout.points, arrow);\n return svg`<path class=${classes} data-source=${layout.source} data-target=${layout.target}\n style=${edge.width === undefined ? nothing : `--_dag-edge-width: ${edge.width}px`}\n d=${route(points) ?? \"\"} marker-end=\"url(#${marker})\">\n <title>${edge.title}</title></path>`;\n }\n\n private _renderEdgeLabel(edge: StyledEdge): SVGTemplateResult | typeof nothing {\n const { layout } = edge;\n const label = layout.label;\n if (!label) return nothing;\n const classes = [\n \"edge-label\",\n edge.highlighted ? \"highlighted\" : \"\",\n edge.incident ? \"incident\" : \"\",\n ].filter(Boolean).join(\" \");\n return svg`<g class=${classes} data-source=${layout.source} data-target=${layout.target}\n transform=\"translate(${label.x},${label.y})\">\n <title>${edge.title}</title>\n <rect x=${-label.width / 2} y=${-DAG_EDGE_LABEL_HEIGHT / 2} width=${label.width}\n height=${DAG_EDGE_LABEL_HEIGHT}></rect>\n <text>${label.text}</text>\n </g>`;\n }\n\n /** Pulls the last point back by `length` (at most 80% of the final segment) to make room for an arrowhead. */\n private _shortenEnd(points: DagPoint[], length: number): DagPoint[] {\n if (points.length < 2) return points;\n const end = points[points.length - 1];\n const previous = points[points.length - 2];\n const distance = Math.hypot(end.x - previous.x, end.y - previous.y);\n if (!distance) return points;\n const ratio = Math.min(length, 0.8 * distance) / distance;\n return [\n ...points.slice(0, -1),\n { x: end.x - (end.x - previous.x) * ratio, y: end.y - (end.y - previous.y) * ratio },\n ];\n }\n\n private _renderNode(position: DagLayoutNode): SVGTemplateResult {\n const node = this.nodes.find((candidate) => candidate.id === position.id)!;\n const kind = node.kind ? this.kinds[node.kind] : undefined;\n const classes = [\n \"node\",\n kind?.dashed ? \"dashed\" : \"\",\n node.muted ? \"muted\" : \"\",\n node.highlighted ? \"highlighted\" : \"\",\n node.id === this.selected ? \"selected\" : \"\",\n ].filter(Boolean).join(\" \");\n const left = -position.width / 2;\n const offset = kind?.icon ? DAG_LABEL_OFFSET : DAG_LABEL_OFFSET_PLAIN;\n const name = kind?.label ? `${node.label} (${kind.label})` : node.label;\n return svg`<g class=${classes} data-id=${node.id} role=\"button\" tabindex=\"0\"\n aria-pressed=${node.id === this.selected ? \"true\" : \"false\"} aria-label=${name}\n style=${kind?.color ? `--dag-kind-color: ${kind.color}` : nothing}\n transform=\"translate(${position.x},${position.y})\"\n @click=${() => this._activate(node.id)}\n @keydown=${(event: KeyboardEvent) => this._onNodeKey(event, node.id)}\n @pointerenter=${() => { this._hovered = node.id; }}\n @pointerleave=${() => { this._hovered = null; }}\n @focus=${() => { this._hovered = node.id; }}\n @blur=${() => { this._hovered = null; }}>\n <title>${name}</title>\n <rect x=${left} y=${-DAG_NODE_HEIGHT / 2} width=${position.width} height=${DAG_NODE_HEIGHT}></rect>\n ${kind?.icon\n ? svg`<g class=\"icon\" transform=\"translate(${left + 6},${-ICON_SIZE / 2})\">${kind.icon(ICON_SIZE)}</g>`\n : nothing}\n <text class=\"label\" x=${left + offset}>${position.label}</text>\n </g>`;\n }\n\n private _renderLegend() {\n const entries = Object.entries(this.kinds).filter(([, kind]) => kind.label);\n if (!entries.length) return nothing;\n return html`<ul class=\"legend\" aria-label=\"Legend\">\n ${entries.map(([key, kind]) => html`<li data-kind=${key}\n style=${kind.color ? `--dag-kind-color: ${kind.color}` : nothing}>\n ${kind.icon ? html`<span class=\"swatch\" aria-hidden=\"true\">${kind.icon(ICON_SIZE)}</span>` : nothing}\n ${kind.label}</li>`)}\n </ul>`;\n }\n\n private _edgeKey(edge: { source: string; target: string }): string {\n return `${edge.source}\\u0000${edge.target}`;\n }\n\n private _layoutChanged(changed: PropertyValues<this>): boolean {\n return changed.has(\"nodes\") || changed.has(\"edges\") || changed.has(\"direction\") || changed.has(\"kinds\");\n }\n\n /** Lays the graph out again, keeping the selected node where it was on screen. */\n private _relayout(): void {\n const previous = this.selected ? this._positions.get(this.selected) : undefined;\n const previousSelected = this._lastSelected;\n this._updateMeasure();\n const inputs = this.nodes.map((node) => ({\n id: node.id,\n label: node.label,\n hasIcon: Boolean(node.kind && this.kinds[node.kind]?.icon),\n }));\n this._layout = layoutDag(inputs, this.edges, this.direction, this._measure);\n this._positions = new Map(this._layout.nodes.map((node) => [node.id, node]));\n const directionChanged = this._lastDirection !== null && this._lastDirection !== this.direction;\n this._lastSelected = this.selected;\n this._lastDirection = this.direction;\n if (!this._size.width) return;\n if (!this._viewReady) {\n this._initView();\n return;\n }\n const current = this.selected ? this._positions.get(this.selected) : undefined;\n if (current && previous && previousSelected === this.selected && !directionChanged && !this.isStatic) {\n const { x, y, k } = this._view;\n this._view = { k, x: x + k * (previous.x - current.x), y: y + k * (previous.y - current.y) };\n } else {\n this._frame();\n }\n }\n\n private _initView(): void {\n this._viewReady = true;\n this._frame();\n }\n\n /**\n * Shows the whole graph when it fits at a readable zoom (always, when static); otherwise centers the selected\n * node at 100%.\n */\n private _frame(): void {\n this.fit();\n if (this.isStatic) return;\n if (this._view.k < READABLE_SCALE && this.selected && this._positions.has(this.selected)) this.center();\n }\n\n /** Brings the selected node into view if it is outside the visible area. */\n private _revealSelected(): void {\n const node = this.selected ? this._positions.get(this.selected) : undefined;\n if (!node || !this._size.width || this.isStatic) return;\n const { x, y, k } = this._view;\n const screenX = x + k * node.x;\n const screenY = y + k * node.y;\n const visible = screenX > 0 && screenX < this._size.width && screenY > 0 && screenY < this._size.height;\n if (!visible) this.center();\n }\n\n /** Measures labels with the host's actual font, so themes with other fonts still size cards correctly. */\n private _updateMeasure(): void {\n const style = getComputedStyle(this);\n const font = `${style.fontSize} ${style.fontFamily}`;\n if (font === this._measureFont) return;\n this._measureFont = font;\n const context = document.createElement(\"canvas\").getContext(\"2d\");\n if (!context) {\n this._measure = approximateTextWidth;\n return;\n }\n context.font = font;\n const widths = new Map<string, number>();\n this._measure = (text) => {\n if (!widths.has(text)) widths.set(text, context.measureText(text).width);\n return widths.get(text)!;\n };\n }\n\n private _resize(rect: DOMRectReadOnly | undefined): void {\n if (!rect) return;\n const { width, height } = rect;\n const previous = this._size;\n this._size = { width, height };\n if (!width || !height) return;\n if (!this._viewReady) {\n if (this._layout.nodes.length) this._initView();\n return;\n }\n if (this.isStatic) {\n this.fit();\n return;\n }\n this._view = {\n ...this._view,\n x: this._view.x + (width - previous.width) / 2,\n y: this._view.y + (height - previous.height) / 2,\n };\n }\n\n private _clamp(k: number): number {\n return Math.min(MAX_SCALE, Math.max(MIN_SCALE, k));\n }\n\n private _centerOn(point: DagPoint, k: number): void {\n this._view = { k, x: this._size.width / 2 - k * point.x, y: this._size.height / 2 - k * point.y };\n }\n\n private _zoomAround(screenX: number, screenY: number, factor: number): void {\n const { x, y, k } = this._view;\n const next = this._clamp(k * factor);\n const ratio = next / k;\n this._view = { k: next, x: screenX - (screenX - x) * ratio, y: screenY - (screenY - y) * ratio };\n }\n\n private _activate(id: string): void {\n if (this._suppressClick) {\n this._suppressClick = false;\n return;\n }\n this.selected = id;\n this.dispatchEvent(\n new CustomEvent<DagNodeSelectDetail>(\"node-select\", { detail: { id }, bubbles: true, composed: true }),\n );\n }\n\n private _onNodeKey(event: KeyboardEvent, id: string): void {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n event.stopPropagation();\n this._activate(id);\n }\n\n private _onPointerDown(event: PointerEvent): void {\n if (event.button !== 0 || this.isStatic) return;\n this._suppressClick = false;\n this._drag = { pointerId: event.pointerId, x: event.clientX, y: event.clientY, view: this._view, moved: false };\n }\n\n private _onPointerMove(event: PointerEvent): void {\n const drag = this._drag;\n if (!drag || drag.pointerId !== event.pointerId) return;\n const dx = event.clientX - drag.x;\n const dy = event.clientY - drag.y;\n if (!drag.moved && Math.hypot(dx, dy) < DRAG_THRESHOLD) return;\n if (!drag.moved) {\n drag.moved = true;\n this._panning = true;\n this._svg.setPointerCapture(event.pointerId);\n }\n this._view = { ...drag.view, x: drag.view.x + dx, y: drag.view.y + dy };\n }\n\n private _onPointerUp(event: PointerEvent): void {\n const drag = this._drag;\n if (!drag || drag.pointerId !== event.pointerId) return;\n this._suppressClick = drag.moved;\n this._drag = null;\n this._panning = false;\n if (this._svg.hasPointerCapture(event.pointerId)) this._svg.releasePointerCapture(event.pointerId);\n }\n\n /** Pinch gestures and Ctrl/⌘ + wheel zoom; a plain wheel is left to the page so it can scroll. */\n private _onWheel(event: WheelEvent): void {\n if ((!event.ctrlKey && !event.metaKey) || this.isStatic) return;\n event.preventDefault();\n const bounds = this._svg.getBoundingClientRect();\n // d3-zoom's wheel scale: pixel, line, and page deltas, amplified for pinch (which reports ctrlKey and\n // small deltas); one event zooms at most 2x either way.\n const unit = event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 0.002;\n const steps = Math.max(-1, Math.min(1, -event.deltaY * unit * (event.ctrlKey ? 10 : 1)));\n this._zoomAround(event.clientX - bounds.left, event.clientY - bounds.top, 2 ** steps);\n }\n\n private _onKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.ctrlKey || event.metaKey || this.isStatic) return;\n const pan: Record<string, [number, number]> = {\n ArrowLeft: [KEY_PAN, 0],\n ArrowRight: [-KEY_PAN, 0],\n ArrowUp: [0, KEY_PAN],\n ArrowDown: [0, -KEY_PAN],\n };\n if (event.key in pan) {\n const [dx, dy] = pan[event.key];\n this._view = { ...this._view, x: this._view.x + dx, y: this._view.y + dy };\n } else if (event.key === \"+\" || event.key === \"=\") {\n this.zoomBy(KEY_ZOOM);\n } else if (event.key === \"-\") {\n this.zoomBy(1 / KEY_ZOOM);\n } else if (event.key === \"0\") {\n this.fit();\n } else {\n return;\n }\n event.preventDefault();\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"dag-graph\": DagGraph;\n }\n}\n"]}
|
|
@@ -34,6 +34,7 @@ export declare class DistributionChart extends LitElement {
|
|
|
34
34
|
/** Inner x coordinate (px) of the current hover position, or null when not hovering. */
|
|
35
35
|
private _hoverX;
|
|
36
36
|
private _fetchedFor;
|
|
37
|
+
private _abort;
|
|
37
38
|
private _ro;
|
|
38
39
|
connectedCallback(): void;
|
|
39
40
|
firstUpdated(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distribution-chart.d.ts","sourceRoot":"","sources":["../src/distribution-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAO,MAAM,KAAK,CAAC;AAqB1D,MAAM,WAAW,iBAAiB;IAChC,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AASD;;;;;;;;;;;GAWG;AACH,qBACa,iBAAkB,SAAQ,UAAU;IAC/C,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"distribution-chart.d.ts","sourceRoot":"","sources":["../src/distribution-chart.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,OAAO,EAAO,MAAM,KAAK,CAAC;AAqB1D,MAAM,WAAW,iBAAiB;IAChC,8FAA8F;IAC9F,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AASD;;;;;;;;;;;GAWG;AACH,qBACa,iBAAkB,SAAQ,UAAU;IAC/C,OAAgB,MAAM,4BAkGpB;IAEF,wEAAwE;IAC5D,MAAM,SAAM;IACxB,4DAA4D;IAC5B,MAAM,EAAE,iBAAiB,EAAE,CAAM;IACjE,oFAAoF;IACpD,YAAY,EAAE,MAAM,EAAE,CAAyB;IAC/E,8GAA8G;IAC1D,QAAQ,SAAM;IAEzD,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,MAAM,CAAuB;IAC9C,0EAA0E;IACjE,OAAO,CAAC,MAAM,CAAK;IAC5B,wFAAwF;IAC/E,OAAO,CAAC,OAAO,CAAuB;IAE/C,OAAO,CAAC,WAAW,CAAM;IACzB,OAAO,CAAC,MAAM,CAAgC;IAC9C,OAAO,CAAC,GAAG,CAA+B;IAEjC,iBAAiB,SAGzB;IAEQ,YAAY,SAMpB;IAEQ,oBAAoB,SAO5B;IAEQ,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,QAE7C;IAED,OAAO,CAAC,WAAW;IA2BnB,OAAO,CAAC,UAAU;IAiGlB,OAAO,CAAC,aAAa;IAmBZ,MAAM,0DAWd;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,oBAAoB,EAAE,iBAAiB,CAAC;KACzC;CACF"}
|
|
@@ -46,6 +46,7 @@ let DistributionChart = class DistributionChart extends LitElement {
|
|
|
46
46
|
/** Inner x coordinate (px) of the current hover position, or null when not hovering. */
|
|
47
47
|
this._hoverX = null;
|
|
48
48
|
this._fetchedFor = "";
|
|
49
|
+
this._abort = null;
|
|
49
50
|
this._ro = null;
|
|
50
51
|
}
|
|
51
52
|
static { this.styles = [
|
|
@@ -115,6 +116,11 @@ let DistributionChart = class DistributionChart extends LitElement {
|
|
|
115
116
|
color: var(--ui-danger, #dc2626);
|
|
116
117
|
padding: 0.5rem 0;
|
|
117
118
|
}
|
|
119
|
+
.empty {
|
|
120
|
+
font-size: var(--ui-font-size-sm, 0.75rem);
|
|
121
|
+
color: var(--ui-text-muted, #64748b);
|
|
122
|
+
padding: 0.5rem 0;
|
|
123
|
+
}
|
|
118
124
|
.legend {
|
|
119
125
|
display: flex;
|
|
120
126
|
flex-wrap: wrap;
|
|
@@ -158,28 +164,41 @@ let DistributionChart = class DistributionChart extends LitElement {
|
|
|
158
164
|
super.disconnectedCallback();
|
|
159
165
|
this._ro?.disconnect();
|
|
160
166
|
this._ro = null;
|
|
167
|
+
this._abort?.abort();
|
|
168
|
+
this._abort = null;
|
|
169
|
+
this._fetchedFor = "";
|
|
161
170
|
}
|
|
162
171
|
updated(changed) {
|
|
163
172
|
if (changed.has("metric"))
|
|
164
173
|
this._maybeFetch();
|
|
165
174
|
}
|
|
166
175
|
_maybeFetch() {
|
|
167
|
-
if (
|
|
176
|
+
if (this._fetchedFor === this.metric)
|
|
168
177
|
return;
|
|
178
|
+
this._abort?.abort();
|
|
179
|
+
this._abort = null;
|
|
169
180
|
this._fetchedFor = this.metric;
|
|
181
|
+
if (!this.metric)
|
|
182
|
+
return;
|
|
183
|
+
const controller = new AbortController();
|
|
184
|
+
this._abort = controller;
|
|
170
185
|
this._loading = true;
|
|
171
186
|
this._error = null;
|
|
172
|
-
fetch(`/api/distribution/${encodeURIComponent(this.metric)}
|
|
187
|
+
fetch(`/api/distribution/${encodeURIComponent(this.metric)}`, { signal: controller.signal })
|
|
173
188
|
.then((r) => {
|
|
174
189
|
if (!r.ok)
|
|
175
190
|
throw new Error(`HTTP ${r.status}`);
|
|
176
191
|
return r.json();
|
|
177
192
|
})
|
|
178
193
|
.then((data) => {
|
|
194
|
+
if (controller.signal.aborted)
|
|
195
|
+
return;
|
|
179
196
|
this._data = data;
|
|
180
197
|
this._loading = false;
|
|
181
198
|
})
|
|
182
199
|
.catch((err) => {
|
|
200
|
+
if (controller.signal.aborted)
|
|
201
|
+
return;
|
|
183
202
|
this._error = err instanceof Error ? err.message : "Failed to load";
|
|
184
203
|
this._loading = false;
|
|
185
204
|
});
|
|
@@ -294,6 +313,8 @@ let DistributionChart = class DistributionChart extends LitElement {
|
|
|
294
313
|
return html `<div class="wrap"><div class="error">Could not load distribution</div></div>`;
|
|
295
314
|
if (!this._data)
|
|
296
315
|
return nothing;
|
|
316
|
+
if (this._data.points.length < 2)
|
|
317
|
+
return html `<div class="wrap"><div class="empty">No distribution data</div></div>`;
|
|
297
318
|
return html `
|
|
298
319
|
<div class="wrap">
|
|
299
320
|
${this._renderSvg(this._data)}
|