@signalsafe/tree-spec-editor-react 0.3.6 → 0.3.8

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 (48) hide show
  1. package/CHANGELOG.md +23 -6
  2. package/README.md +15 -6
  3. package/dist/GraphEditorCanvasContext.d.ts +6 -0
  4. package/dist/GraphEditorCanvasContext.d.ts.map +1 -1
  5. package/dist/TreeSpecGraphEditor.d.ts +8 -1
  6. package/dist/TreeSpecGraphEditor.d.ts.map +1 -1
  7. package/dist/TreeSpecGraphEditor.js +24 -4
  8. package/dist/canvas/WrappedEdge.d.ts +17 -0
  9. package/dist/canvas/WrappedEdge.d.ts.map +1 -0
  10. package/dist/canvas/WrappedEdge.js +25 -0
  11. package/dist/canvas/constants.d.ts +1 -0
  12. package/dist/canvas/constants.d.ts.map +1 -1
  13. package/dist/canvas/constants.js +4 -2
  14. package/dist/canvas/edgeBuilders.d.ts +2 -1
  15. package/dist/canvas/edgeBuilders.d.ts.map +1 -1
  16. package/dist/canvas/edgeBuilders.js +25 -7
  17. package/dist/canvas/edgeStyle.d.ts +1 -0
  18. package/dist/canvas/edgeStyle.d.ts.map +1 -1
  19. package/dist/canvas/edgeStyle.js +2 -2
  20. package/dist/canvas/labelLanePath.d.ts +8 -0
  21. package/dist/canvas/labelLanePath.d.ts.map +1 -0
  22. package/dist/canvas/labelLanePath.js +19 -0
  23. package/dist/hooks/useCanvasGraphState.d.ts +3 -0
  24. package/dist/hooks/useCanvasGraphState.d.ts.map +1 -1
  25. package/dist/hooks/useCanvasGraphState.js +6 -3
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +1 -0
  29. package/dist/nodes/ChoiceCanvasRow.d.ts +2 -1
  30. package/dist/nodes/ChoiceCanvasRow.d.ts.map +1 -1
  31. package/dist/nodes/ChoiceCanvasRow.js +5 -3
  32. package/dist/nodes/PromptNode.d.ts.map +1 -1
  33. package/dist/nodes/PromptNode.js +3 -3
  34. package/dist/nodes/PromptNodeChoicesList.d.ts +2 -1
  35. package/dist/nodes/PromptNodeChoicesList.d.ts.map +1 -1
  36. package/dist/nodes/PromptNodeChoicesList.js +2 -2
  37. package/dist/nodes/PromptNodeHeader.d.ts.map +1 -1
  38. package/dist/nodes/PromptNodeHeader.js +2 -2
  39. package/dist/nodes/types.d.ts +1 -0
  40. package/dist/nodes/types.d.ts.map +1 -1
  41. package/dist/outcomeAppearance.d.ts +41 -0
  42. package/dist/outcomeAppearance.d.ts.map +1 -0
  43. package/dist/outcomeAppearance.js +13 -0
  44. package/dist/ui/editorClasses.d.ts +1 -0
  45. package/dist/ui/editorClasses.d.ts.map +1 -1
  46. package/dist/ui/editorClasses.js +1 -0
  47. package/docs/tree-spec-example-flow.svg +2 -2
  48. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,14 +1,17 @@
1
- # Changelog
1
+ ## 0.3.8 — 2026-12-03
2
2
 
3
- ## 0.3.6 — 2026-11-29
3
+ Add wrapped transparent edge labels, destination navigation, configurable outcome appearance and stable edge selection geometry.
4
4
 
5
- Qualify React 18.3.1 and 19.3.1. Commit canvas snapshots after React commits their nodes/edges, mutate history outside state updater callbacks, and retain the compiled loaded tree as the saved baseline. Renderer teardown in tests uses act; all behavioral assertions remain.
5
+ # tree-spec-editor-react 0.3.7 — 2026-12-02
6
6
 
7
+ Render automatic Next links and host-supplied Markdown displays while retaining graph selection and history behavior.
7
8
 
8
- ## 0.3.5 — 2026-11-23
9
+ # Changelog
10
+
11
+ ## 0.3.6 — unpublished candidate (2026-11-29)
12
+
13
+ Qualify React 18.3.1 and 19.3.1. Commit canvas snapshots after React commits their nodes/edges, mutate history outside state updater callbacks, and retain the compiled loaded tree as the saved baseline. Renderer teardown in tests uses act; all behavioral assertions remain.
9
14
 
10
- - Publish npm releases through GitHub Actions OIDC trusted publishing.
11
- - Document the designated publisher, validation and token retirement process.
12
15
 
13
16
  All notable changes to this project will be documented in this file.
14
17
 
@@ -175,3 +178,17 @@ This is an isolated local candidate; no registry release or host adoption is imp
175
178
  [0.2.0]: https://github.com/SignalSafeSoftware/tree-spec-editor-react/compare/v0.1.3...v0.2.0
176
179
  [0.1.3]: https://github.com/SignalSafeSoftware/tree-spec-editor-react/releases/tag/v0.1.3
177
180
  [0.1.2]: https://github.com/SignalSafeSoftware/tree-spec-editor-react/releases/tag/v0.1.2
181
+
182
+ Prompt nodes use the shared outlined question-bubble icon beside their key, with a Prompt tooltip and accessible label.
183
+
184
+ `renderNodeDisplay(node)` lets a host render sanitized Markdown using its existing content renderer. Choice-free `node` continuations use a separate non-editable Next edge, never a fabricated choice transition.
185
+
186
+ ## Unreleased
187
+
188
+ - Share terminal-outcome colors between canvas choice badges and edges; preserve colors when selected.
189
+
190
+ - Local: wrap canvas edge labels using authored label width and reserve label space during automatic layout.
191
+
192
+ - Select linked choices from canvas edges and keyboard-accessible edge labels.
193
+
194
+ - Split edge labels into choice controls and destination links that select the target node.
package/README.md CHANGED
@@ -1,11 +1,6 @@
1
1
  # @signalsafe/tree-spec-editor-react
2
2
 
3
- [![Build](https://github.com/SignalSafeSoftware/tree-spec-editor-react/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/SignalSafeSoftware/tree-spec-editor-react/actions/workflows/ci.yml)
4
- [![npm version](https://img.shields.io/npm/v/@signalsafe/tree-spec-editor-react?logo=npm)](https://www.npmjs.com/package/@signalsafe/tree-spec-editor-react)
5
- [![npm downloads per month](https://img.shields.io/npm/dm/@signalsafe/tree-spec-editor-react?label=downloads%2Fmonth)](https://www.npmjs.com/package/@signalsafe/tree-spec-editor-react)
6
- [![License: MIT](https://img.shields.io/badge/license-MIT-blue)](https://github.com/SignalSafeSoftware/tree-spec-editor-react/blob/main/LICENSE)
7
-
8
- Release candidate: Qualify React 18.3.1 and 19.3.1. Commit canvas snapshots after React commits their nodes/edges, mutate history outside state updater callbacks, and retain the compiled loaded tree as the saved baseline. Renderer teardown in tests uses act; all behavioral assertions remain. No publication or host adoption is implied; local verification uses explicit sealed upstream archives until release-order lockfiles can be regenerated normally.
3
+ Unpublished 0.3.6 candidate: Qualify React 18.3.1 and 19.3.1. Commit canvas snapshots after React commits their nodes/edges, mutate history outside state updater callbacks, and retain the compiled loaded tree as the saved baseline. Renderer teardown in tests uses act; all behavioral assertions remain. No publication or host adoption is implied; local verification uses explicit sealed upstream archives until release-order lockfiles can be regenerated normally.
9
4
 
10
5
  Current source and planned customer-subdomain impact: [current-state summary](docs/current-release-candidate.md).
11
6
 
@@ -191,3 +186,17 @@ Save failures retain the local graph and saved baseline, clear `saving`, set exi
191
186
  Release `0.3.4` is a compatible maintenance update over published `0.3.3`. It adopts verified current dependencies and reviewed tooling without changing the public authoring model or host responsibilities. React 18 / React Flow 11 support and current read-only/save-failure contracts remain. See [release preparation](./RELEASING.md) for exact quality, artifact and publication gates.
192
187
 
193
188
  See the [current release documentation](docs/current-release-candidate.md) for release-specific compatibility and verification boundaries.
189
+
190
+ `renderNodeDisplay(node)` lets a host render sanitized Markdown using its existing content renderer. Choice-free `node` continuations use a separate non-editable Next edge, never a fabricated choice transition.
191
+
192
+ ### Outcome appearance
193
+
194
+ `OUTCOME_APPEARANCE` defines the shared terminal-outcome labels and colors: at_risk orange, safe green, compromised red. Canvas choice badges, edge paths and arrowheads use this table. Outcome colors take priority over custom edge strokes for terminal transitions; choices without outcomes remain neutral. Selected edges retain their color and use a thicker stroke. This is presentation only and does not change TreeSpec documents.
195
+
196
+ Canvas edge labels support per-choice `render_hints.editor.labelWidth` (80–600px, default 200px). Automatic layout reserves horizontal room for wrapping labels and separates incoming labels into lanes; label positions follow their connected nodes. These hints do not affect learner text.
197
+
198
+ `onNodeNavigate(nodeId)` lets destination links use the host’s shared select-and-focus action. Without it, destination links retain the `onSelect` node-selection fallback.
199
+
200
+ `getChoiceOutcome(nodeId, choiceId)` optionally supplies host-authored choice classifications for edge and badge colors, including continuing routes; routing outcomes remain unchanged.
201
+
202
+ The canvas accepts an optional `outcomeAppearance` table, keyed by the values returned by `getChoiceOutcome`. Each definition supplies `label`, `color`, and `textColor`; edges and choice badges use the same definition. Hosts own catalog persistence and assessment policy. Omitting the table retains the default outcome appearance.
@@ -1,3 +1,6 @@
1
+ import type { OutcomeAppearanceTable } from './outcomeAppearance.js';
2
+ import { type ReactNode } from 'react';
3
+ import type { EditorNode } from '@signalsafe/tree-spec-editor-core';
1
4
  export type ChoiceDropTarget = {
2
5
  nodeId: string;
3
6
  index: number;
@@ -7,12 +10,15 @@ export type ChoiceDragState = {
7
10
  choiceId: string;
8
11
  };
9
12
  export type GraphEditorCanvasContextValue = {
13
+ outcomeAppearance?: OutcomeAppearanceTable | undefined;
10
14
  readOnly: boolean;
15
+ renderNodeDisplay?: ((node: EditorNode) => ReactNode) | undefined;
11
16
  onDuplicateNode: (nodeId: string) => void;
12
17
  onDeleteNode: (nodeId: string) => void;
13
18
  onResizeNode: (nodeId: string, width: number, height: number) => void;
14
19
  /** Lock the node box height when a resize drag begins (prevents wrap reflow jumps). */
15
20
  onResizeNodeStart: (nodeId: string, width: number, height: number) => void;
21
+ onSelectNode?: (nodeId: string) => void;
16
22
  onSelectChoice: (nodeId: string, choiceId: string) => void;
17
23
  choiceDrag: ChoiceDragState | null;
18
24
  choiceDropTarget: ChoiceDropTarget | null;
@@ -1 +1 @@
1
- {"version":3,"file":"GraphEditorCanvasContext.d.ts","sourceRoot":"","sources":["../src/GraphEditorCanvasContext.tsx"],"names":[],"mappings":"AAEA,MAAM,MAAM,gBAAgB,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IACxC,QAAQ,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,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C;CACzD,CAAC;AAmBF,eAAO,MAAM,wBAAwB,wDAA8B,CAAC;AAEpE,wBAAgB,oBAAoB,IAAI,6BAA6B,CAEpE"}
@@ -1,11 +1,18 @@
1
- import { type EditorTree, type GraphSelection, type GraphEditorIssue } from '@signalsafe/tree-spec-editor-core';
1
+ import type { OutcomeAppearanceTable } from './outcomeAppearance.js';
2
+ import { type ReactNode } from 'react';
3
+ import { type EditorTree, type EditorNode, type GraphSelection, type GraphEditorIssue } from '@signalsafe/tree-spec-editor-core';
2
4
  export type TreeSpecGraphEditorProps = {
3
5
  tree: EditorTree;
6
+ renderNodeDisplay?: (node: EditorNode) => ReactNode;
4
7
  onChange: (next: EditorTree) => void;
5
8
  issues?: GraphEditorIssue[];
6
9
  showMiniMap?: boolean;
7
10
  selected?: GraphSelection;
8
11
  onSelect?: (sel: GraphSelection) => void;
12
+ /** Navigate to a linked node, including host-managed canvas focus. */
13
+ outcomeAppearance?: OutcomeAppearanceTable;
14
+ getChoiceOutcome?: (nodeId: string, choiceId: string) => string | undefined;
15
+ onNodeNavigate?: (nodeId: string) => void;
9
16
  /** Called when a choice row is clicked on the canvas (after `onSelect` for the parent node). */
10
17
  onChoiceSelect?: (nodeId: string, choiceId: string) => void;
11
18
  /** Called when a choice is dropped after drag (reorder or move to another node). */
@@ -1 +1 @@
1
- {"version":3,"file":"TreeSpecGraphEditor.d.ts","sourceRoot":"","sources":["../src/TreeSpecGraphEditor.tsx"],"names":[],"mappings":"AAaA,OAAO,EAKH,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACxB,MAAM,mCAAmC,CAAC;AAuB3C,MAAM,MAAM,wBAAwB,GAAG;IACnC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,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,CAAC,EAAE,OAAO,CAAC;IACnB,uEAAuE;IACvE,eAAe,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,oEAAoE;IACpE,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CAChC,CAAC;AAkRF,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,KAAK,EAAE,QAAQ,CAAC,wBAAwB,CAAC,+BAMpF"}
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { wrappedEdgeTypes } from './canvas/WrappedEdge.js';
2
3
  import { useCallback, useMemo, useRef, useState } from 'react';
3
4
  import ReactFlow, { Background, ConnectionMode, Controls, MiniMap, ReactFlowProvider, useReactFlow, } from 'reactflow';
4
5
  import { GRAPH_SELECTION_KIND, choiceIdFromHandle, resolveGraphViewport, LAYOUT_SNAP_GRID, } from '@signalsafe/tree-spec-editor-core';
@@ -19,7 +20,7 @@ import { useCanvasNodeResize } from './hooks/useCanvasNodeResize.js';
19
20
  import { useCanvasViewport } from './hooks/useCanvasViewport.js';
20
21
  import { useChoiceDragDrop } from './hooks/useChoiceDragDrop.js';
21
22
  import { useGraphConnect } from './hooks/useGraphConnect.js';
22
- function TreeSpecGraphInner({ tree, onChange, issues = [], selected, onSelect, onChoiceSelect, onRepositionChoice, focusNodeId, focusChoiceId = null, showMiniMap = true, fitViewNonce, className = EDITOR_CANVAS_ROOT, readOnly = false, onDuplicateNode, onDeleteNode, onAutoLayout, contextualZoom = true, colorMode = 'light', }) {
23
+ function TreeSpecGraphInner({ tree, renderNodeDisplay, onChange, issues = [], selected, onSelect, onChoiceSelect, onNodeNavigate, outcomeAppearance, getChoiceOutcome, onRepositionChoice, focusNodeId, focusChoiceId = null, showMiniMap = true, fitViewNonce, className = EDITOR_CANVAS_ROOT, readOnly = false, onDuplicateNode, onDeleteNode, onAutoLayout, contextualZoom = true, colorMode = 'light', }) {
23
24
  const rf = useReactFlow();
24
25
  const treeRef = useRef(tree);
25
26
  treeRef.current = tree;
@@ -39,6 +40,8 @@ function TreeSpecGraphInner({ tree, onChange, issues = [], selected, onSelect, o
39
40
  const [resizeHeightByNodeId, setResizeHeightByNodeId] = useState({});
40
41
  const graphState = useCanvasGraphState({
41
42
  tree,
43
+ outcomeAppearance,
44
+ getChoiceOutcome,
42
45
  onChange,
43
46
  issues,
44
47
  issuesByNode,
@@ -82,17 +85,30 @@ function TreeSpecGraphInner({ tree, onChange, issues = [], selected, onSelect, o
82
85
  onSelect?.({ kind: GRAPH_SELECTION_KIND.NODE, id: node.id });
83
86
  }, [onSelect]);
84
87
  const onEdgeClick = useCallback((_evt, edge) => {
88
+ const choiceId = choiceIdFromHandle(edge.sourceHandle);
89
+ if (onChoiceSelect && tree.nodes[edge.source]?.choices.some(choice => choice.id === choiceId)) {
90
+ onChoiceSelect(edge.source, choiceId);
91
+ return;
92
+ }
85
93
  onSelect?.({ kind: GRAPH_SELECTION_KIND.EDGE, id: edge.id });
86
- }, [onSelect]);
94
+ }, [onSelect, onChoiceSelect, tree.nodes]);
87
95
  const onPaneClick = useCallback(() => {
88
96
  onSelect?.({ kind: null, id: null });
89
97
  }, [onSelect]);
90
98
  const canvasContextValue = useMemo(() => ({
91
99
  readOnly,
100
+ renderNodeDisplay,
101
+ outcomeAppearance,
92
102
  onDuplicateNode: (nodeId) => onDuplicateNode?.(nodeId),
93
103
  onDeleteNode: (nodeId) => onDeleteNode?.(nodeId),
94
104
  onResizeNode: resizeHandlers.handleResizeNode,
95
105
  onResizeNodeStart: resizeHandlers.handleResizeNodeStart,
106
+ onSelectNode: (nodeId) => {
107
+ if (onNodeNavigate)
108
+ onNodeNavigate(nodeId);
109
+ else
110
+ onSelect?.({ kind: GRAPH_SELECTION_KIND.NODE, id: nodeId });
111
+ },
96
112
  onSelectChoice: (nodeId, choiceId) => {
97
113
  if (onChoiceSelect) {
98
114
  onChoiceSelect(nodeId, choiceId);
@@ -108,11 +124,14 @@ function TreeSpecGraphInner({ tree, onChange, issues = [], selected, onSelect, o
108
124
  onChoiceDrop: handleChoiceDrop,
109
125
  }), [
110
126
  readOnly,
127
+ renderNodeDisplay,
128
+ outcomeAppearance,
111
129
  onDuplicateNode,
112
130
  onDeleteNode,
113
131
  resizeHandlers.handleResizeNode,
114
132
  resizeHandlers.handleResizeNodeStart,
115
133
  onSelect,
134
+ onNodeNavigate,
116
135
  onChoiceSelect,
117
136
  choiceDrag,
118
137
  choiceDropTarget,
@@ -133,7 +152,8 @@ function TreeSpecGraphInner({ tree, onChange, issues = [], selected, onSelect, o
133
152
  })), edges: edges.map((e) => {
134
153
  const fromChoiceId = choiceIdFromHandle(e.sourceHandle);
135
154
  const hasIssue = fromChoiceId ? issueKeySet.has(`${e.source}::${fromChoiceId}`) : false;
136
- const isEdgeSelected = selected?.kind === GRAPH_SELECTION_KIND.EDGE && selected.id === e.id;
155
+ const isEdgeSelected = (selected?.kind === GRAPH_SELECTION_KIND.EDGE && selected.id === e.id) ||
156
+ (focusNodeId === e.source && focusChoiceId === fromChoiceId);
137
157
  let style = getIssueEdgeStyle(e.style, hasIssue);
138
158
  const { style: resolvedStyle, stroke } = resolveSelectedEdgeStroke(style, isEdgeSelected);
139
159
  style = resolvedStyle;
@@ -143,7 +163,7 @@ function TreeSpecGraphInner({ tree, onChange, issues = [], selected, onSelect, o
143
163
  style,
144
164
  markerEnd: buildEdgeMarker(stroke),
145
165
  };
146
- }), onNodesChange: onNodesChangeWrapped, onEdgesChange: onEdgesChangeWrapped, onConnect: onConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, onReconnect: onReconnect, onEdgesDelete: onEdgesDelete, isValidConnection: isValidConnection, connectionMode: ConnectionMode.Strict, snapToGrid: true, snapGrid: [LAYOUT_SNAP_GRID, LAYOUT_SNAP_GRID], onNodeDragStart: onNodeDragStart, onNodeDragStop: onNodeDragStop, onNodeClick: onNodeClick, onEdgeClick: onEdgeClick, onPaneClick: onPaneClick, onNodeContextMenu: onNodeContextMenu, onPaneContextMenu: onPaneContextMenu, onMoveEnd: onMoveEnd, nodeTypes: nodeTypes, children: [showMiniMap ? _jsx(MiniMap, { pannable: true, ariaLabel: "Canvas overview \u2014 drag to pan" }) : null, _jsx(Controls, {}), _jsx(Background, {})] })] }) }));
166
+ }), onNodesChange: onNodesChangeWrapped, onEdgesChange: onEdgesChangeWrapped, onConnect: onConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, onReconnect: onReconnect, onEdgesDelete: onEdgesDelete, isValidConnection: isValidConnection, connectionMode: ConnectionMode.Strict, snapToGrid: true, snapGrid: [LAYOUT_SNAP_GRID, LAYOUT_SNAP_GRID], onNodeDragStart: onNodeDragStart, onNodeDragStop: onNodeDragStop, onNodeClick: onNodeClick, onEdgeClick: onEdgeClick, onPaneClick: onPaneClick, onNodeContextMenu: onNodeContextMenu, onPaneContextMenu: onPaneContextMenu, onMoveEnd: onMoveEnd, nodeTypes: nodeTypes, edgeTypes: wrappedEdgeTypes, children: [showMiniMap ? _jsx(MiniMap, { pannable: true, ariaLabel: "Canvas overview \u2014 drag to pan" }) : null, _jsx(Controls, {}), _jsx(Background, {})] })] }) }));
147
167
  }
148
168
  export default function TreeSpecGraphEditor(props) {
149
169
  return (_jsx(ReactFlowProvider, { children: _jsx(TreeSpecGraphInner, { ...props }) }));
@@ -0,0 +1,17 @@
1
+ import { type EdgeProps } from 'reactflow';
2
+ export interface WrappedEdgeData {
3
+ choiceId?: string;
4
+ choiceLabel?: string;
5
+ destinationId?: string;
6
+ routeType?: 'straight' | 'step' | 'smoothstep';
7
+ labelWidth?: number;
8
+ labelOffsetY?: number;
9
+ }
10
+ /** Shared routing with a bounded HTML label, outside SVG's single-line text renderer. */
11
+ export declare function WrappedEdge(props: EdgeProps<WrappedEdgeData>): import("react").JSX.Element;
12
+ export declare const wrappedEdgeTypes: {
13
+ straight: typeof WrappedEdge;
14
+ step: typeof WrappedEdge;
15
+ smoothstep: typeof WrappedEdge;
16
+ };
17
+ //# sourceMappingURL=WrappedEdge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WrappedEdge.d.ts","sourceRoot":"","sources":["../../src/canvas/WrappedEdge.tsx"],"names":[],"mappings":"AACA,OAAO,EAAgD,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAIzF,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,UAAU,GAAG,MAAM,GAAG,YAAY,CAAC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,yFAAyF;AACzF,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,CAAC,eAAe,CAAC,+BAiC5D;AAED,eAAO,MAAM,gBAAgB;IAAK,QAAQ;IAAe,IAAI;IAAe,UAAU;CAAe,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useGraphEditorCanvas } from '../GraphEditorCanvasContext.js';
3
+ import { BaseEdge, EdgeLabelRenderer, getStraightPath } from 'reactflow';
4
+ import { labelLanePath } from './labelLanePath.js';
5
+ import { DEFAULT_EDGE_LABEL_WIDTH } from '@signalsafe/tree-spec-editor-core';
6
+ /** Shared routing with a bounded HTML label, outside SVG's single-line text renderer. */
7
+ export function WrappedEdge(props) {
8
+ const { id, label, data, style, markerEnd, sourceX, sourceY, targetX, targetY, selected } = props;
9
+ const { onSelectChoice, onSelectNode } = useGraphEditorCanvas();
10
+ const choiceId = data?.choiceId;
11
+ const straight = data?.routeType === 'straight';
12
+ const y = straight || data?.labelOffsetY === undefined ? (sourceY + targetY) / 2 : targetY + data.labelOffsetY;
13
+ const x = (sourceX + targetX) / 2;
14
+ const path = straight ? getStraightPath(props)[0] : labelLanePath({ x: sourceX, y: sourceY }, { x: targetX, y: targetY }, y, data?.routeType === 'step' ? 0 : 5);
15
+ return _jsxs(_Fragment, { children: [_jsx(BaseEdge, { id: id, path: path, style: style, markerEnd: markerEnd, interactionWidth: props.interactionWidth }), label ? _jsx(EdgeLabelRenderer, { children: _jsxs("div", { className: "graph-editor-edge-label nodrag nopan", "data-edge-id": id, "aria-current": selected ? 'true' : undefined, style: { width: data?.labelWidth ?? DEFAULT_EDGE_LABEL_WIDTH, transform: `translate(-50%, -50%) translate(${x}px, ${y}px)` }, children: [choiceId ? _jsx("a", { href: `#choice-${encodeURIComponent(props.source)}-${encodeURIComponent(choiceId)}`, className: "graph-editor-edge-label-choice", onClick: (event) => {
16
+ event.preventDefault();
17
+ event.stopPropagation();
18
+ onSelectChoice(props.source, choiceId);
19
+ }, children: data?.choiceLabel ?? label }) : data?.choiceLabel ?? label, data?.destinationId ? _jsxs(_Fragment, { children: [" \u2192 ", _jsx("a", { className: "graph-editor-edge-label-target", href: `#node-${encodeURIComponent(data.destinationId)}`, onClick: (event) => {
20
+ event.preventDefault();
21
+ event.stopPropagation();
22
+ onSelectNode?.(props.target);
23
+ }, children: data.destinationId })] }) : null] }) }) : null] });
24
+ }
25
+ export const wrappedEdgeTypes = { straight: WrappedEdge, step: WrappedEdge, smoothstep: WrappedEdge };
@@ -34,6 +34,7 @@ export declare const MAX_NODE_HEIGHT = 480;
34
34
  export declare const SELECTED_EDGE_STROKE = "#555";
35
35
  export declare const EDGE_ARROW_MARKER: {
36
36
  type: MarkerType;
37
+ markerUnits: string;
37
38
  width: number;
38
39
  height: number;
39
40
  };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts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CAAC;AAEF,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AAExD,eAAO,MAAM,mBAAmB,4CAA4C,CAAC;AAC7E,eAAO,MAAM,oBAAoB,6CAA6C,CAAC;AAE/E,eAAO,MAAM,oBAAoB,wCAAwC,CAAC;AAE1E,eAAO,MAAM,sBAAsB,QAA8D,CAAC;AAElG,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,eAAO,MAAM,eAAe,KAAK,CAAC;AAClC,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,qGAAqG;AACrG,eAAO,MAAM,oBAAoB,SAAS,CAAC;AAE3C,eAAO,MAAM,iBAAiB;;;;;CAM7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,OAAO,CAAC;AACrC,eAAO,MAAM,oBAAoB,YAAY,CAAC"}
@@ -36,8 +36,10 @@ export const MAX_NODE_HEIGHT = 480;
36
36
  export const SELECTED_EDGE_STROKE = '#555';
37
37
  export const EDGE_ARROW_MARKER = {
38
38
  type: MarkerType.ArrowClosed,
39
- width: 16,
40
- height: 16,
39
+ // Keep the normal two-pixel stroke appearance without scaling on selection.
40
+ markerUnits: 'userSpaceOnUse',
41
+ width: 32,
42
+ height: 32,
41
43
  };
42
44
  export const TARGET_HANDLE_ID = 'in';
43
45
  export const CHOICE_HANDLE_PREFIX = 'choice:';
@@ -1,6 +1,7 @@
1
+ import { type OutcomeAppearanceTable } from '../outcomeAppearance.js';
1
2
  import { type EditorTree, type EditorTransition } from '@signalsafe/tree-spec-editor-core';
2
3
  import type { Edge } from 'reactflow';
3
4
  export declare function edgeLabelForTransition(tree: EditorTree, t: EditorTransition): string;
4
- export declare function buildEdgesFromTransitions(tree: EditorTree): Edge[];
5
+ export declare function buildEdgesFromTransitions(tree: EditorTree, getChoiceOutcome?: (nodeId: string, choiceId: string) => string | undefined, outcomeAppearance?: OutcomeAppearanceTable): Edge[];
5
6
  export declare function buildTransitionsFromEdges(edges: Edge[], existing: EditorTransition[]): EditorTransition[];
6
7
  //# sourceMappingURL=edgeBuilders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"edgeBuilders.d.ts","sourceRoot":"","sources":["../../src/canvas/edgeBuilders.ts"],"names":[],"mappings":"AACA,OAAO,EAOH,KAAK,UAAU,EACf,KAAK,gBAAgB,EACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQtC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,gBAAgB,GAAG,MAAM,CASpF;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,EAAE,CA0BlE;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAgBzG"}
1
+ {"version":3,"file":"edgeBuilders.d.ts","sourceRoot":"","sources":["../../src/canvas/edgeBuilders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,sBAAsB,EAAwB,MAAM,yBAAyB,CAAC;AAE5F,OAAO,EASH,KAAK,UAAU,EACf,KAAK,gBAAgB,EACxB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAQtC,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,CAAC,EAAE,gBAAgB,GAAG,MAAM,CAQpF;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,UAAU,EAAE,gBAAgB,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,EAAE,iBAAiB,CAAC,EAAE,sBAAsB,GAAG,IAAI,EAAE,CA2C3L;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE,GAAG,gBAAgB,EAAE,CAgBzG"}
@@ -1,5 +1,6 @@
1
+ import { getOutcomeAppearance } from '../outcomeAppearance.js';
1
2
  import { TERMINAL_OUTCOME } from '@signalsafe/tree-spec';
2
- import { END_NODE_ID, choiceIdFromHandle, resolveDefaultEdgeType, resolveEffectiveEdgeType, resolveEdgeStrokeColor, shouldShowEdgeLabel, } from '@signalsafe/tree-spec-editor-core';
3
+ import { END_NODE_ID, getEdgeLabelSize, EDGE_LABEL_GAP, choiceIdFromHandle, resolveDefaultEdgeType, resolveEffectiveEdgeType, resolveEdgeStrokeColor, shouldShowEdgeLabel, } from '@signalsafe/tree-spec-editor-core';
3
4
  import { CHOICE_HANDLE_PREFIX, TARGET_HANDLE_ID, } from './constants.js';
4
5
  import { buildEdgeMarker, buildEdgeStyle, resolveEdgePathStroke } from './edgeStyle.js';
5
6
  export function edgeLabelForTransition(tree, t) {
@@ -7,20 +8,29 @@ export function edgeLabelForTransition(tree, t) {
7
8
  const choice = node?.choices?.find((c) => c.id === t.fromChoiceId);
8
9
  const base = choice?.label || t.fromChoiceId;
9
10
  if (t.toNodeId === END_NODE_ID) {
10
- const oc = t.outcome ?? TERMINAL_OUTCOME.AT_RISK;
11
- return `${base} → END (${oc})`;
11
+ return `${base} → END`;
12
12
  }
13
13
  return base;
14
14
  }
15
- export function buildEdgesFromTransitions(tree) {
16
- return tree.transitions.map((t) => {
15
+ export function buildEdgesFromTransitions(tree, getChoiceOutcome, outcomeAppearance) {
16
+ const edges = tree.transitions.map((t) => {
17
17
  const node = tree.nodes[t.fromNodeId];
18
18
  const choice = node?.choices?.find((c) => c.id === t.fromChoiceId);
19
19
  const showLabel = choice ? shouldShowEdgeLabel(choice) : true;
20
- const strokeColor = choice ? resolveEdgeStrokeColor(choice) : undefined;
20
+ const outcomeColor = getOutcomeAppearance(getChoiceOutcome?.(t.fromNodeId, t.fromChoiceId) ?? (t.toNodeId === END_NODE_ID ? t.outcome : undefined), outcomeAppearance)?.color;
21
+ const strokeColor = outcomeColor ?? (choice ? resolveEdgeStrokeColor(choice) : undefined);
21
22
  const edgeType = choice
22
23
  ? resolveEffectiveEdgeType(choice, tree._meta)
23
24
  : resolveDefaultEdgeType(tree._meta);
25
+ const text = edgeLabelForTransition(tree, t);
26
+ const size = getEdgeLabelSize(choice, text);
27
+ const siblings = tree.transitions.filter(item => item.toNodeId === t.toNodeId);
28
+ const sizes = siblings.map(item => {
29
+ const sibling = tree.nodes[item.fromNodeId]?.choices.find(candidate => candidate.id === item.fromChoiceId);
30
+ return sibling && !shouldShowEdgeLabel(sibling) ? 0 : getEdgeLabelSize(sibling, edgeLabelForTransition(tree, item)).height + EDGE_LABEL_GAP;
31
+ });
32
+ const index = siblings.indexOf(t);
33
+ const labelOffsetY = sizes.slice(0, index).reduce((sum, height) => sum + height, 0) + (size.height + EDGE_LABEL_GAP) / 2 - sizes.reduce((sum, height) => sum + height, 0) / 2;
24
34
  const style = buildEdgeStyle(strokeColor);
25
35
  const markerStroke = resolveEdgePathStroke(style);
26
36
  return {
@@ -33,15 +43,23 @@ export function buildEdgesFromTransitions(tree) {
33
43
  type: edgeType,
34
44
  label: showLabel ? edgeLabelForTransition(tree, t) : undefined,
35
45
  labelShowBg: true,
46
+ data: { labelWidth: size.width, labelOffsetY, routeType: edgeType, choiceId: choice?.id, choiceLabel: choice?.label || t.fromChoiceId, destinationId: t.toNodeId },
36
47
  markerEnd: buildEdgeMarker(markerStroke),
37
48
  style,
38
49
  };
39
50
  });
51
+ for (const node of Object.values(tree.nodes)) {
52
+ if (node.type !== 'node' || !node.next || !Object.prototype.hasOwnProperty.call(tree.nodes, node.next))
53
+ continue;
54
+ const style = buildEdgeStyle(undefined);
55
+ edges.push({ id: `automatic:${node.id}`, source: node.id, target: node.next, sourceHandle: 'automatic', targetHandle: TARGET_HANDLE_ID, label: 'Next', data: { routeType: resolveDefaultEdgeType(tree._meta), destinationId: node.next }, focusable: false, deletable: false, reconnectable: false, type: resolveDefaultEdgeType(tree._meta), style: { ...style, pointerEvents: 'none' }, markerEnd: buildEdgeMarker(resolveEdgePathStroke(style)) });
56
+ }
57
+ return edges;
40
58
  }
41
59
  export function buildTransitionsFromEdges(edges, existing) {
42
60
  const existingById = new Map(existing.map((t) => [t.id, t]));
43
61
  return edges
44
- .filter((e) => e.source && e.target && e.source !== END_NODE_ID)
62
+ .filter((e) => e.source && e.target && e.source !== END_NODE_ID && e.sourceHandle !== 'automatic')
45
63
  .map((e) => {
46
64
  const fromChoiceId = choiceIdFromHandle(e.sourceHandle);
47
65
  const prior = existingById.get(String(e.id));
@@ -4,6 +4,7 @@ export declare function getIssueEdgeStyle(style: Edge['style'], hasIssue: boolea
4
4
  export declare function resolveEdgePathStroke(style: Edge['style'] | undefined): string;
5
5
  export declare function buildEdgeMarker(stroke: string): {
6
6
  type: import("reactflow").MarkerType;
7
+ markerUnits: string;
7
8
  width: number;
8
9
  height: number;
9
10
  color: string;
@@ -1 +1 @@
1
- {"version":3,"file":"edgeStyle.d.ts","sourceRoot":"","sources":["../../src/canvas/edgeStyle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAQzF;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CASxF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,CAK9E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM;;;;;EAK7C;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,CAE7E;AAED,wBAAgB,yBAAyB,CACrC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,EACpB,cAAc,EAAE,OAAO,GACxB;IAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAO1C"}
1
+ {"version":3,"file":"edgeStyle.d.ts","sourceRoot":"","sources":["../../src/canvas/edgeStyle.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAItC,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAQzF;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,CASxF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,SAAS,GAAG,MAAM,CAK9E;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM;;;;;;EAK7C;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,CAE7E;AAED,wBAAgB,yBAAyB,CACrC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,EACpB,cAAc,EAAE,OAAO,GACxB;IAAE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAO1C"}
@@ -36,9 +36,9 @@ export function buildEdgeStyle(strokeColor) {
36
36
  }
37
37
  export function resolveSelectedEdgeStroke(style, isEdgeSelected) {
38
38
  let nextStyle = style;
39
- const stroke = isEdgeSelected ? SELECTED_EDGE_STROKE : resolveEdgePathStroke(nextStyle);
39
+ const stroke = isEdgeSelected && !style?.stroke ? SELECTED_EDGE_STROKE : resolveEdgePathStroke(nextStyle);
40
40
  if (isEdgeSelected) {
41
- nextStyle = { ...nextStyle, stroke: SELECTED_EDGE_STROKE };
41
+ nextStyle = { ...nextStyle, stroke };
42
42
  }
43
43
  return { style: nextStyle, stroke };
44
44
  }
@@ -0,0 +1,8 @@
1
+ type Point = {
2
+ x: number;
3
+ y: number;
4
+ };
5
+ /** Route through a horizontal label lane, rounding step corners when requested. */
6
+ export declare function labelLanePath(source: Point, target: Point, y: number, radius: number): string;
7
+ export {};
8
+ //# sourceMappingURL=labelLanePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"labelLanePath.d.ts","sourceRoot":"","sources":["../../src/canvas/labelLanePath.ts"],"names":[],"mappings":"AAAA,KAAK,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEtC,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAiB7F"}
@@ -0,0 +1,19 @@
1
+ /** Route through a horizontal label lane, rounding step corners when requested. */
2
+ export function labelLanePath(source, target, y, radius) {
3
+ const gap = target.x - source.x;
4
+ const left = source.x + gap * 0.15;
5
+ const right = source.x + gap * 0.85;
6
+ const points = [source, { x: left, y: source.y }, { x: left, y }, { x: right, y }, { x: right, y: target.y }, target]
7
+ .filter((point, index, all) => index === 0 || point.x !== all[index - 1].x || point.y !== all[index - 1].y);
8
+ let path = `M${source.x},${source.y}`;
9
+ for (let index = 1; index < points.length - 1; index++) {
10
+ const previous = points[index - 1], point = points[index], next = points[index + 1];
11
+ const incoming = Math.hypot(point.x - previous.x, point.y - previous.y);
12
+ const outgoing = Math.hypot(next.x - point.x, next.y - point.y);
13
+ const r = Math.min(radius, incoming / 2, outgoing / 2);
14
+ const before = { x: point.x + (previous.x - point.x) * r / incoming, y: point.y + (previous.y - point.y) * r / incoming };
15
+ const after = { x: point.x + (next.x - point.x) * r / outgoing, y: point.y + (next.y - point.y) * r / outgoing };
16
+ path += ` L${before.x},${before.y} Q${point.x},${point.y} ${after.x},${after.y}`;
17
+ }
18
+ return `${path} L${target.x},${target.y}`;
19
+ }
@@ -1,6 +1,9 @@
1
+ import type { OutcomeAppearanceTable } from '../outcomeAppearance.js';
1
2
  import { type Edge, type Node, type OnEdgesChange, type OnNodesChange, type Viewport } from 'reactflow';
2
3
  import { type EditorTree, type GraphEditorIssue } from '@signalsafe/tree-spec-editor-core';
3
4
  export type UseCanvasGraphStateOptions = {
5
+ outcomeAppearance?: OutcomeAppearanceTable | undefined;
6
+ getChoiceOutcome?: (nodeId: string, choiceId: string) => string | undefined;
4
7
  tree: EditorTree;
5
8
  onChange: (next: EditorTree) => void;
6
9
  issues: GraphEditorIssue[];
@@ -1 +1 @@
1
- {"version":3,"file":"useCanvasGraphState.d.ts","sourceRoot":"","sources":["../../src/hooks/useCanvasGraphState.ts"],"names":[],"mappings":"AACA,OAAO,EAGH,KAAK,IAAI,EACT,KAAK,IAAI,EACT,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,QAAQ,EAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,EASH,KAAK,UAAU,EACf,KAAK,gBAAgB,EAGxB,MAAM,mCAAmC,CAAC;AAM3C,MAAM,MAAM,0BAA0B,GAAG;IACrC,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,IAAI,CAAC;IACrC,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC7F,QAAQ,EAAE,OAAO,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,aAAa,EAAE,KAA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ders.js';
5
5
  import { NODE_DRAG_HANDLE_SELECTOR } from '../canvas/constants.js';
6
6
  export function useCanvasGraphState(options) {
7
- const { tree, onChange, issues, issuesByNode, readOnly, resizeHeightByNodeId, isResizingRef, suppressViewportSaveRef, } = options;
7
+ const { outcomeAppearance, getChoiceOutcome, tree, onChange, issues, issuesByNode, readOnly, resizeHeightByNodeId, isResizingRef, suppressViewportSaveRef, } = options;
8
8
  const isDraggingRef = useRef(false);
9
9
  const pendingCommitRef = useRef(false);
10
10
  const nodesRef = useRef([]);
@@ -38,6 +38,9 @@ export function useCanvasGraphState(options) {
38
38
  },
39
39
  data: {
40
40
  node: n,
41
+ outcomesByChoice: Object.fromEntries((n.choices ?? []).map(choice => [choice.id,
42
+ getChoiceOutcome?.(n.id, choice.id) ?? tree.transitions.find(edge => edge.fromNodeId === n.id && edge.fromChoiceId === choice.id && edge.toNodeId === END_NODE_ID)?.outcome,
43
+ ])),
41
44
  isStart: tree.start_node === n.id,
42
45
  issuesTotal: issuesByNode.get(n.id)?.total ?? 0,
43
46
  issuesErrors: issuesByNode.get(n.id)?.errors ?? 0,
@@ -56,8 +59,8 @@ export function useCanvasGraphState(options) {
56
59
  draggable: true,
57
60
  });
58
61
  return arr;
59
- }, [tree.nodes, tree.start_node, endNodePosition, issuesByNode, readOnly, resizeHeightByNodeId]);
60
- const initialEdges = useMemo(() => buildEdgesFromTransitions(tree), [tree]);
62
+ }, [getChoiceOutcome, tree.nodes, tree.transitions, tree.start_node, endNodePosition, issuesByNode, readOnly, resizeHeightByNodeId]);
63
+ const initialEdges = useMemo(() => buildEdgesFromTransitions(tree, getChoiceOutcome, outcomeAppearance), [tree, getChoiceOutcome, outcomeAppearance]);
61
64
  const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
62
65
  const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
63
66
  const lastTreeRef = useRef('');
package/dist/index.d.ts CHANGED
@@ -14,4 +14,5 @@ export { default } from './TreeSpecGraphEditor.js';
14
14
  export type { TreeSpecGraphEditorProps } from './TreeSpecGraphEditor.js';
15
15
  export { useTreeSpecEditor } from './hooks/useTreeSpecEditor.js';
16
16
  export type { AdapterValidationIssue, GraphEditorVersionInfo, TreeSpecEditorAdapter, TreeSpecSaveConflict, TreeSpecSaveResult, UseTreeSpecEditorActions, UseTreeSpecEditorOptions, UseTreeSpecEditorResult, UseTreeSpecEditorState, } from './hooks/types.js';
17
+ export { OUTCOME_APPEARANCE, getOutcomeAppearance } from './outcomeAppearance.js';
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,YAAY,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,YAAY,EACR,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,GACzB,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,YAAY,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAEzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,YAAY,EACR,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,EACrB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,GACzB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
package/dist/index.js CHANGED
@@ -12,3 +12,4 @@
12
12
  */
13
13
  export { default } from './TreeSpecGraphEditor.js';
14
14
  export { useTreeSpecEditor } from './hooks/useTreeSpecEditor.js';
15
+ export { OUTCOME_APPEARANCE, getOutcomeAppearance } from './outcomeAppearance.js';
@@ -1,7 +1,8 @@
1
1
  import { type EditorChoice } from '@signalsafe/tree-spec-editor-core';
2
- export declare function ChoiceCanvasRow({ nodeId, choice, choiceIndex, focusChoiceId, choiceTextClass, readOnly, }: Readonly<{
2
+ export declare function ChoiceCanvasRow({ nodeId, choice, outcome, choiceIndex, focusChoiceId, choiceTextClass, readOnly, }: Readonly<{
3
3
  nodeId: string;
4
4
  choice: EditorChoice;
5
+ outcome?: string;
5
6
  choiceIndex: number;
6
7
  focusChoiceId: string | null;
7
8
  choiceTextClass: string;
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceCanvasRow.d.ts","sourceRoot":"","sources":["../../src/nodes/ChoiceCanvasRow.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAkCtE,wBAAgB,eAAe,CAAC,EAC5B,MAAM,EACN,MAAM,EACN,WAAW,EACX,aAAa,EACb,eAAe,EACf,QAAQ,GACX,EAAE,QAAQ,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC,+BAoID"}
1
+ {"version":3,"file":"ChoiceCanvasRow.d.ts","sourceRoot":"","sources":["../../src/nodes/ChoiceCanvasRow.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAkCtE,wBAAgB,eAAe,CAAC,EAC5B,MAAM,EACN,MAAM,EACN,OAAO,EACP,WAAW,EACX,aAAa,EACb,eAAe,EACf,QAAQ,GACX,EAAE,QAAQ,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC,+BAsID"}
@@ -1,10 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { getOutcomeAppearance } from '../outcomeAppearance.js';
2
3
  import { Handle, Position } from 'reactflow';
3
4
  import { CANVAS_NODE_SELECTED_CLASS, CANVAS_NODE_SELECTED_TEXT_CLASS, CANVAS_CHOICE_SELECTED_CLASS, CHOICE_DRAG_HANDLE_CLASS, CHOICE_DRAG_HANDLE_SELECTOR, CHOICE_DROP_TARGET_CLASS, CHOICE_HANDLE_CLASS, CHOICE_ROW_CLASS, CHOICE_ROW_SELECT_CLASS, CHOICE_ROW_SELECTABLE_CLASS, CHOICE_HANDLE_PREFIX, } from '../canvas/constants.js';
4
5
  import { useGraphEditorCanvas } from '../GraphEditorCanvasContext.js';
5
6
  import { EDITOR_FLEX_ALIGN_CENTER, EDITOR_FLEX_GROW_1, EDITOR_FLEX_ROW, EDITOR_FLEX_SHRINK_0, EDITOR_ICON, EDITOR_LIST_ITEM, EDITOR_MIN_W_0, EDITOR_SPACING_GAP_1, EDITOR_SPACING_P_0, EDITOR_SPACING_PX_2, EDITOR_SPACING_PY_2, EDITOR_TEXT_START, EDITOR_W_FULL, editorBadgeToneClass, joinClasses, } from '../ui/editorClasses.js';
6
- export function ChoiceCanvasRow({ nodeId, choice, choiceIndex, focusChoiceId, choiceTextClass, readOnly, }) {
7
- const { choiceDrag, choiceDropTarget, onSelectChoice, onChoiceDragStart, onChoiceDragEnd, onChoiceDragOver, onChoiceDrop, } = useGraphEditorCanvas();
7
+ export function ChoiceCanvasRow({ nodeId, choice, outcome, choiceIndex, focusChoiceId, choiceTextClass, readOnly, }) {
8
+ const { outcomeAppearance, choiceDrag, choiceDropTarget, onSelectChoice, onChoiceDragStart, onChoiceDragEnd, onChoiceDragOver, onChoiceDrop, } = useGraphEditorCanvas();
9
+ const appearance = getOutcomeAppearance(outcome, outcomeAppearance);
8
10
  const isFocused = focusChoiceId === choice.id;
9
11
  const isDropTarget = Boolean(choiceDrag) &&
10
12
  choiceDropTarget?.nodeId === nodeId &&
@@ -51,5 +53,5 @@ export function ChoiceCanvasRow({ nodeId, choice, choiceIndex, focusChoiceId, ch
51
53
  event.stopPropagation();
52
54
  onSelectChoice(nodeId, choice.id);
53
55
  }
54
- }, children: [_jsx("span", { className: joinClasses(choiceTextClass, EDITOR_FLEX_GROW_1, EDITOR_MIN_W_0), title: choice.label, children: choice.label }), _jsx("span", { className: joinClasses(editorBadgeToneClass('neutral'), EDITOR_FLEX_SHRINK_0), children: choice.id })] }), _jsx(Handle, { type: "source", position: Position.Right, id: `${CHOICE_HANDLE_PREFIX}${choice.id}`, className: CHOICE_HANDLE_CLASS })] }) }));
56
+ }, children: [_jsx("span", { className: joinClasses(choiceTextClass, EDITOR_FLEX_GROW_1, EDITOR_MIN_W_0), title: choice.label, children: choice.label }), _jsx("span", { title: appearance?.label, style: appearance ? { backgroundColor: appearance.color, color: appearance.textColor } : undefined, className: joinClasses(editorBadgeToneClass('neutral'), EDITOR_FLEX_SHRINK_0), children: choice.id })] }), _jsx(Handle, { type: "source", position: Position.Right, id: `${CHOICE_HANDLE_PREFIX}${choice.id}`, className: CHOICE_HANDLE_CLASS })] }) }));
55
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PromptNode.d.ts","sourceRoot":"","sources":["../../src/nodes/PromptNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAyD,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAoClG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,KAAK,eAAe,GAAG,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;AAE3D,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,eAAe,+BA6GjE"}
1
+ {"version":3,"file":"PromptNode.d.ts","sourceRoot":"","sources":["../../src/nodes/PromptNode.tsx"],"names":[],"mappings":"AACA,OAAO,EAAyD,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAoClG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,KAAK,eAAe,GAAG,QAAQ,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;AAE3D,wBAAgB,UAAU,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE,eAAe,+BA+GjE"}
@@ -13,7 +13,7 @@ export function PromptNode({ data, selected, id }) {
13
13
  const n = data.node;
14
14
  const choices = n.choices ?? [];
15
15
  const updateNodeInternals = useUpdateNodeInternals();
16
- const { readOnly, onDuplicateNode, onDeleteNode, onResizeNode, onResizeNodeStart, choiceDrag, choiceDropTarget, onChoiceDragOver, onChoiceDrop } = useGraphEditorCanvas();
16
+ const { readOnly, renderNodeDisplay, onDuplicateNode, onDeleteNode, onResizeNode, onResizeNodeStart, choiceDrag, choiceDropTarget, onChoiceDragOver, onChoiceDrop } = useGraphEditorCanvas();
17
17
  const hasErrors = data.issuesErrors > 0;
18
18
  const borderClass = getPromptNodeBorderClass(hasErrors, data.issuesWarnings);
19
19
  const focusChoiceId = data.focusChoiceId ?? null;
@@ -39,7 +39,7 @@ export function PromptNode({ data, selected, id }) {
39
39
  : undefined;
40
40
  useEffect(() => {
41
41
  updateNodeInternals(id);
42
- }, [id, choices.length, editor.height, editor.width, updateNodeInternals]);
42
+ }, [id, n.type, n.prompt, choices.length, editor.height, editor.width, updateNodeInternals]);
43
43
  const handleResize = useCallback(() => {
44
44
  updateNodeInternals(id);
45
45
  }, [id, updateNodeInternals]);
@@ -47,5 +47,5 @@ export function PromptNode({ data, selected, id }) {
47
47
  onResizeNodeStart(id, params.width, params.height);
48
48
  }, onResize: handleResize, onResizeEnd: (_event, params) => {
49
49
  onResizeNode(id, params.width, params.height);
50
- } })) : null, _jsxs("div", { className: joinClasses(CANVAS_NODE_CARD_CLASS, borderClass, showNodeHighlight && CANVAS_NODE_SELECTED_CLASS, showNodeHighlight && CANVAS_NODE_SELECTED_TEXT_CLASS), style: cardStyle, children: [_jsx(Handle, { type: "target", position: Position.Left, id: TARGET_HANDLE_ID, className: TARGET_HANDLE_CLASS_DEFAULT }), _jsx(PromptNodeHeader, { node: n, data: data, editor: editor, locked: locked, readOnly: readOnly }), _jsxs("div", { className: joinClasses(CANVAS_NODE_BODY_CLASS, EDITOR_MIN_W_0), style: scrollBodyStyle, children: [_jsx("div", { className: joinClasses(EDITOR_CARD_BODY, EDITOR_SPACING_PY_2, EDITOR_SPACING_PX_2, EDITOR_MIN_W_0, 'nodrag'), children: _jsx("div", { className: joinClasses(EDITOR_TEXT_SM, EDITOR_SPACING_MB_0, promptTextClass), title: n.prompt || undefined, children: n.prompt || _jsx("em", { className: EDITOR_MUTED, children: "(empty prompt)" }) }) }), _jsx(PromptNodeChoicesList, { nodeId: id, choices: choices, focusChoiceId: focusChoiceId, choiceTextClass: choiceTextClass, readOnly: readOnly, choiceDrag: choiceDrag, choiceDropTarget: choiceDropTarget, onChoiceDragOver: onChoiceDragOver, onChoiceDrop: onChoiceDrop })] })] })] }));
50
+ } })) : null, _jsxs("div", { className: joinClasses(CANVAS_NODE_CARD_CLASS, borderClass, showNodeHighlight && CANVAS_NODE_SELECTED_CLASS, showNodeHighlight && CANVAS_NODE_SELECTED_TEXT_CLASS), style: cardStyle, children: [_jsx(Handle, { type: "target", position: Position.Left, id: TARGET_HANDLE_ID, className: TARGET_HANDLE_CLASS_DEFAULT }), n.type === 'node' ? _jsx(Handle, { type: "source", position: Position.Right, id: "automatic", isConnectable: false }) : null, _jsx(PromptNodeHeader, { node: n, data: data, editor: editor, locked: locked, readOnly: readOnly }), _jsxs("div", { className: joinClasses(CANVAS_NODE_BODY_CLASS, EDITOR_MIN_W_0), style: scrollBodyStyle, children: [_jsx("div", { className: joinClasses(EDITOR_CARD_BODY, EDITOR_SPACING_PY_2, EDITOR_SPACING_PX_2, EDITOR_MIN_W_0, 'nodrag'), children: _jsx("div", { className: joinClasses(EDITOR_TEXT_SM, EDITOR_SPACING_MB_0, promptTextClass), title: n.prompt || undefined, children: renderNodeDisplay ? renderNodeDisplay(n) : n.prompt || _jsx("em", { className: EDITOR_MUTED, children: "(empty prompt)" }) }) }), n.type !== 'node' ? _jsx(PromptNodeChoicesList, { nodeId: id, choices: choices, outcomesByChoice: data.outcomesByChoice, focusChoiceId: focusChoiceId, choiceTextClass: choiceTextClass, readOnly: readOnly, choiceDrag: choiceDrag, choiceDropTarget: choiceDropTarget, onChoiceDragOver: onChoiceDragOver, onChoiceDrop: onChoiceDrop }) : null] })] })] }));
51
51
  }
@@ -1,8 +1,9 @@
1
1
  import { type EditorChoice } from '@signalsafe/tree-spec-editor-core';
2
2
  import { type GraphEditorCanvasContextValue } from '../GraphEditorCanvasContext.js';
3
- export declare function PromptNodeChoicesList({ nodeId, choices, focusChoiceId, choiceTextClass, readOnly, choiceDrag, choiceDropTarget, onChoiceDragOver, onChoiceDrop, }: Readonly<{
3
+ export declare function PromptNodeChoicesList({ nodeId, choices, outcomesByChoice, focusChoiceId, choiceTextClass, readOnly, choiceDrag, choiceDropTarget, onChoiceDragOver, onChoiceDrop, }: Readonly<{
4
4
  nodeId: string;
5
5
  choices: EditorChoice[];
6
+ outcomesByChoice?: Readonly<Record<string, string | undefined>>;
6
7
  focusChoiceId: string | null;
7
8
  choiceTextClass: string;
8
9
  readOnly: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"PromptNodeChoicesList.d.ts","sourceRoot":"","sources":["../../src/nodes/PromptNodeChoicesList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAMtE,OAAO,EAAE,KAAK,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAapF,wBAAgB,qBAAqB,CAAC,EAClC,MAAM,EACN,OAAO,EACP,aAAa,EACb,eAAe,EACf,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,GACf,EAAE,QAAQ,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,6BAA6B,CAAC,YAAY,CAAC,CAAC;IACxD,gBAAgB,EAAE,6BAA6B,CAAC,kBAAkB,CAAC,CAAC;IACpE,gBAAgB,EAAE,6BAA6B,CAAC,kBAAkB,CAAC,CAAC;IACpE,YAAY,EAAE,6BAA6B,CAAC,cAAc,CAAC,CAAC;CAC/D,CAAC,+BA8DD"}
1
+ {"version":3,"file":"PromptNodeChoicesList.d.ts","sourceRoot":"","sources":["../../src/nodes/PromptNodeChoicesList.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAMtE,OAAO,EAAE,KAAK,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAapF,wBAAgB,qBAAqB,CAAC,EAClC,MAAM,EACN,OAAO,EACP,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,GACf,EAAE,QAAQ,CAAC;IACR,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAChE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,6BAA6B,CAAC,YAAY,CAAC,CAAC;IACxD,gBAAgB,EAAE,6BAA6B,CAAC,kBAAkB,CAAC,CAAC;IACpE,gBAAgB,EAAE,6BAA6B,CAAC,kBAAkB,CAAC,CAAC;IACpE,YAAY,EAAE,6BAA6B,CAAC,cAAc,CAAC,CAAC;CAC/D,CAAC,+BA+DD"}
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { CHOICE_DROP_APPEND_CLASS, CHOICE_DROP_TARGET_CLASS, } from '../canvas/constants.js';
3
3
  import { EDITOR_LIST_FLUSH, EDITOR_LIST_ITEM_EMPTY, EDITOR_MIN_W_0, EDITOR_MUTED, EDITOR_SPACING_PX_2, EDITOR_SPACING_PY_2, EDITOR_TEXT_SM, joinClasses, } from '../ui/editorClasses.js';
4
4
  import { ChoiceCanvasRow } from './ChoiceCanvasRow.js';
5
- export function PromptNodeChoicesList({ nodeId, choices, focusChoiceId, choiceTextClass, readOnly, choiceDrag, choiceDropTarget, onChoiceDragOver, onChoiceDrop, }) {
5
+ export function PromptNodeChoicesList({ nodeId, choices, outcomesByChoice, focusChoiceId, choiceTextClass, readOnly, choiceDrag, choiceDropTarget, onChoiceDragOver, onChoiceDrop, }) {
6
6
  const handleListDragOver = (event) => {
7
7
  if (readOnly || !choiceDrag)
8
8
  return;
@@ -18,7 +18,7 @@ export function PromptNodeChoicesList({ nodeId, choices, focusChoiceId, choiceTe
18
18
  event.stopPropagation();
19
19
  onChoiceDrop(nodeId, choices.length);
20
20
  };
21
- return (_jsxs("ul", { className: joinClasses(EDITOR_LIST_FLUSH, EDITOR_TEXT_SM, EDITOR_MIN_W_0, 'nodrag'), "aria-label": "Node choices", onDragOver: handleListDragOver, onDrop: handleListDrop, children: [choices.length === 0 ? (_jsx("li", { className: joinClasses(EDITOR_LIST_ITEM_EMPTY, EDITOR_SPACING_PY_2, EDITOR_SPACING_PX_2, EDITOR_MUTED, choiceDrag && CHOICE_DROP_TARGET_CLASS), children: _jsx("em", { children: "No choices" }) })) : (choices.map((c, choiceIndex) => (_jsx(ChoiceCanvasRow, { nodeId: nodeId, choice: c, choiceIndex: choiceIndex, focusChoiceId: focusChoiceId, choiceTextClass: choiceTextClass, readOnly: readOnly }, c.id)))), choiceDrag && readOnly === false && choices.length > 0 ? (_jsx("li", { className: joinClasses(CHOICE_DROP_APPEND_CLASS, 'graph-editor-list__append-target', choiceDropTarget?.nodeId === nodeId &&
21
+ return (_jsxs("ul", { className: joinClasses(EDITOR_LIST_FLUSH, EDITOR_TEXT_SM, EDITOR_MIN_W_0, 'nodrag'), "aria-label": "Node choices", onDragOver: handleListDragOver, onDrop: handleListDrop, children: [choices.length === 0 ? (_jsx("li", { className: joinClasses(EDITOR_LIST_ITEM_EMPTY, EDITOR_SPACING_PY_2, EDITOR_SPACING_PX_2, EDITOR_MUTED, choiceDrag && CHOICE_DROP_TARGET_CLASS), children: _jsx("em", { children: "No choices" }) })) : (choices.map((c, choiceIndex) => (_jsx(ChoiceCanvasRow, { nodeId: nodeId, choice: c, outcome: outcomesByChoice?.[c.id], choiceIndex: choiceIndex, focusChoiceId: focusChoiceId, choiceTextClass: choiceTextClass, readOnly: readOnly }, c.id)))), choiceDrag && readOnly === false && choices.length > 0 ? (_jsx("li", { className: joinClasses(CHOICE_DROP_APPEND_CLASS, 'graph-editor-list__append-target', choiceDropTarget?.nodeId === nodeId &&
22
22
  choiceDropTarget.index === choices.length &&
23
23
  CHOICE_DROP_TARGET_CLASS), "aria-hidden": true })) : null] }));
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"PromptNodeHeader.d.ts","sourceRoot":"","sources":["../../src/nodes/PromptNodeHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAyBpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,wBAAgB,gBAAgB,CAAC,EAC7B,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,MAAM,EACN,QAAQ,GACX,EAAE,QAAQ,CAAC;IACR,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC,+BA2DD"}
1
+ {"version":3,"file":"PromptNodeHeader.d.ts","sourceRoot":"","sources":["../../src/nodes/PromptNodeHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,UAAU,EAAE,MAAM,mCAAmC,CAAC;AA0BpF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,wBAAgB,gBAAgB,CAAC,EAC7B,IAAI,EACJ,IAAI,EACJ,MAAM,EACN,MAAM,EACN,QAAQ,GACX,EAAE,QAAQ,CAAC;IACR,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IAC1C,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACrB,CAAC,+BA4DD"}
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { NODE_DRAG_HANDLE_CLASS } from '../canvas/constants.js';
3
- import { EDITOR_CARD_HEADER_MUTED, EDITOR_FLEX_ALIGN_START, EDITOR_FLEX_BETWEEN, EDITOR_FLEX_GROW_1, EDITOR_FLEX_ROW, EDITOR_FLEX_SHRINK_0, EDITOR_ICON, EDITOR_MIN_W_0, EDITOR_MUTED, EDITOR_OVERFLOW_HIDDEN, EDITOR_SPACING_GAP_1, EDITOR_SPACING_GAP_2, EDITOR_SPACING_MS_1, EDITOR_SPACING_PX_2, EDITOR_SPACING_PY_2, EDITOR_TEXT_BOLD, EDITOR_TEXT_MD, EDITOR_TEXT_XS, joinClasses, } from '../ui/editorClasses.js';
3
+ import { EDITOR_CARD_HEADER_MUTED, EDITOR_FLEX_ALIGN_START, EDITOR_FLEX_BETWEEN, EDITOR_FLEX_GROW_1, EDITOR_FLEX_ROW, EDITOR_FLEX_SHRINK_0, EDITOR_ICON, EDITOR_PROMPT_ICON, EDITOR_MIN_W_0, EDITOR_MUTED, EDITOR_OVERFLOW_HIDDEN, EDITOR_SPACING_GAP_1, EDITOR_SPACING_GAP_2, EDITOR_SPACING_MS_1, EDITOR_SPACING_PX_2, EDITOR_SPACING_PY_2, EDITOR_TEXT_BOLD, EDITOR_TEXT_MD, EDITOR_TEXT_XS, joinClasses, } from '../ui/editorClasses.js';
4
4
  import { PromptNodeIssueBadges } from './PromptNodeIssueBadges.js';
5
5
  export function PromptNodeHeader({ node, data, editor, locked, readOnly, }) {
6
- return (_jsx("div", { className: joinClasses(EDITOR_CARD_HEADER_MUTED, EDITOR_SPACING_PY_2, EDITOR_SPACING_PX_2, EDITOR_MIN_W_0, EDITOR_FLEX_SHRINK_0), children: _jsxs("div", { className: joinClasses(EDITOR_FLEX_BETWEEN, EDITOR_FLEX_ALIGN_START, EDITOR_SPACING_GAP_2, EDITOR_MIN_W_0), children: [_jsxs("div", { className: joinClasses(EDITOR_FLEX_ROW, EDITOR_FLEX_ALIGN_START, EDITOR_SPACING_GAP_1, EDITOR_MIN_W_0, EDITOR_FLEX_GROW_1, EDITOR_OVERFLOW_HIDDEN), children: [locked || readOnly ? null : (_jsx("span", { className: joinClasses(NODE_DRAG_HANDLE_CLASS, EDITOR_FLEX_SHRINK_0), title: "Drag node", "aria-label": "Drag node", children: _jsx("span", { className: joinClasses(EDITOR_ICON, 'graph-editor-icon--grip'), "aria-hidden": true, children: "\u22EE\u22EE" }) })), _jsx("div", { className: joinClasses(EDITOR_MIN_W_0, EDITOR_FLEX_GROW_1, EDITOR_OVERFLOW_HIDDEN), children: _jsxs("div", { className: joinClasses(EDITOR_TEXT_BOLD, EDITOR_TEXT_MD), children: [data.isStart ? '▶ ' : '', node.type, editor.locked ? (_jsx("span", { className: joinClasses(EDITOR_ICON, 'graph-editor-icon--lock', EDITOR_SPACING_MS_1), title: "Locked", "aria-hidden": true, children: "\uD83D\uDD12" })) : null, _jsx(PromptNodeIssueBadges, { issuesTotal: data.issuesTotal, issuesErrors: data.issuesErrors, issuesWarnings: data.issuesWarnings, issuesInfo: data.issuesInfo })] }) })] }), _jsx("div", { className: joinClasses(EDITOR_MUTED, EDITOR_TEXT_XS, EDITOR_FLEX_SHRINK_0), children: node.id.slice(0, 8) })] }) }));
6
+ return (_jsx("div", { className: joinClasses(EDITOR_CARD_HEADER_MUTED, EDITOR_SPACING_PY_2, EDITOR_SPACING_PX_2, EDITOR_MIN_W_0, EDITOR_FLEX_SHRINK_0), children: _jsxs("div", { className: joinClasses(EDITOR_FLEX_BETWEEN, EDITOR_FLEX_ALIGN_START, EDITOR_SPACING_GAP_2, EDITOR_MIN_W_0), children: [_jsxs("div", { className: joinClasses(EDITOR_FLEX_ROW, EDITOR_FLEX_ALIGN_START, EDITOR_SPACING_GAP_1, EDITOR_MIN_W_0, EDITOR_FLEX_GROW_1, EDITOR_OVERFLOW_HIDDEN), children: [locked || readOnly ? null : (_jsx("span", { className: joinClasses(NODE_DRAG_HANDLE_CLASS, EDITOR_FLEX_SHRINK_0), title: "Drag node", "aria-label": "Drag node", children: _jsx("span", { className: joinClasses(EDITOR_ICON, 'graph-editor-icon--grip'), "aria-hidden": true, children: "\u22EE\u22EE" }) })), _jsx("div", { className: joinClasses(EDITOR_MIN_W_0, EDITOR_FLEX_GROW_1, EDITOR_OVERFLOW_HIDDEN), children: _jsxs("div", { className: joinClasses(EDITOR_TEXT_BOLD, EDITOR_TEXT_MD), children: [node.type === 'prompt' ? _jsx("span", { className: EDITOR_PROMPT_ICON, role: "img", "aria-label": "Prompt", title: "Prompt" }) : null, node.id, editor.locked ? (_jsx("span", { className: joinClasses(EDITOR_ICON, 'graph-editor-icon--lock', EDITOR_SPACING_MS_1), title: "Locked", "aria-hidden": true, children: "\uD83D\uDD12" })) : null, _jsx(PromptNodeIssueBadges, { issuesTotal: data.issuesTotal, issuesErrors: data.issuesErrors, issuesWarnings: data.issuesWarnings, issuesInfo: data.issuesInfo })] }) })] }), data.isStart ? _jsx("span", { className: EDITOR_FLEX_SHRINK_0, role: "img", "aria-label": "Start node", title: "Start node", children: "\u2605" }) : null, node.type !== 'prompt' ? _jsx("div", { className: joinClasses(EDITOR_MUTED, EDITOR_TEXT_XS, EDITOR_FLEX_SHRINK_0), children: node.type }) : null] }) }));
7
7
  }
@@ -2,6 +2,7 @@ import type { EditorNode } from '@signalsafe/tree-spec-editor-core';
2
2
  export type PromptNodeData = {
3
3
  node: EditorNode;
4
4
  isStart: boolean;
5
+ outcomesByChoice?: Readonly<Record<string, string | undefined>>;
5
6
  issuesTotal: number;
6
7
  issuesErrors: number;
7
8
  issuesWarnings: number;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/nodes/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/nodes/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;IAChE,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC"}
@@ -0,0 +1,41 @@
1
+ /** Shared presentation for terminal outcomes; independent of the wire format. */
2
+ export declare const OUTCOME_APPEARANCE: {
3
+ readonly at_risk: {
4
+ readonly label: 'At risk';
5
+ readonly color: '#fd7e14';
6
+ readonly textColor: '#000000';
7
+ };
8
+ readonly safe: {
9
+ readonly label: 'Safe';
10
+ readonly color: '#198754';
11
+ readonly textColor: '#ffffff';
12
+ };
13
+ readonly compromised: {
14
+ readonly label: 'Compromised';
15
+ readonly color: '#dc3545';
16
+ readonly textColor: '#ffffff';
17
+ };
18
+ };
19
+ export type OutcomeAppearanceTable = Readonly<Record<string, {
20
+ label: string;
21
+ color: string;
22
+ textColor: string;
23
+ }>>;
24
+ export declare function getOutcomeAppearance(outcome: string | undefined, catalog?: OutcomeAppearanceTable): {
25
+ readonly label: 'At risk';
26
+ readonly color: '#fd7e14';
27
+ readonly textColor: '#000000';
28
+ } | {
29
+ readonly label: 'Safe';
30
+ readonly color: '#198754';
31
+ readonly textColor: '#ffffff';
32
+ } | {
33
+ readonly label: 'Compromised';
34
+ readonly color: '#dc3545';
35
+ readonly textColor: '#ffffff';
36
+ } | {
37
+ label: string;
38
+ color: string;
39
+ textColor: string;
40
+ } | undefined;
41
+ //# sourceMappingURL=outcomeAppearance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"outcomeAppearance.d.ts","sourceRoot":"","sources":["../src/outcomeAppearance.ts"],"names":[],"mappings":"AAEA,iFAAiF;AACjF,eAAO,MAAM,kBAAkB;;iBAChB,KAAK,EAAE,SAAS;iBAAE,KAAK,EAAE,SAAS;iBAAE,SAAS,EAAE,SAAS;;;iBAC3D,KAAK,EAAE,MAAM;iBAAE,KAAK,EAAE,SAAS;iBAAE,SAAS,EAAE,SAAS;;;iBAC9C,KAAK,EAAE,aAAa;iBAAE,KAAK,EAAE,SAAS;iBAAE,SAAS,EAAE,SAAS;;CACkB,CAAC;AAElG,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAAC;AAEnH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,sBAAsB;oBAP5E,SAAS;oBAAS,SAAS;wBAAa,SAAS;;oBACpD,MAAM;oBAAS,SAAS;wBAAa,SAAS;;oBACvC,aAAa;oBAAS,SAAS;wBAAa,SAAS;;WAGT,MAAM;WAAS,MAAM;eAAa,MAAM;cAO7G"}
@@ -0,0 +1,13 @@
1
+ /** Shared presentation for terminal outcomes; independent of the wire format. */
2
+ export const OUTCOME_APPEARANCE = {
3
+ at_risk: { label: 'At risk', color: '#fd7e14', textColor: '#000000' },
4
+ safe: { label: 'Safe', color: '#198754', textColor: '#ffffff' },
5
+ compromised: { label: 'Compromised', color: '#dc3545', textColor: '#ffffff' },
6
+ };
7
+ export function getOutcomeAppearance(outcome, catalog) {
8
+ if (outcome !== undefined && catalog && Object.hasOwn(catalog, outcome))
9
+ return catalog[outcome];
10
+ return outcome !== undefined && Object.hasOwn(OUTCOME_APPEARANCE, outcome)
11
+ ? OUTCOME_APPEARANCE[outcome]
12
+ : undefined;
13
+ }
@@ -50,4 +50,5 @@ export declare const EDITOR_CANVAS_ROOT = "graph-editor-canvas-root";
50
50
  export declare function editorBtnToneClass(variant?: string): string;
51
51
  export declare function editorBadgeToneClass(variant: 'danger' | 'warning' | 'info' | 'neutral'): string;
52
52
  export declare function editorDropdownItemClass(danger?: boolean): string;
53
+ export declare const EDITOR_PROMPT_ICON = "graph-editor-icon--prompt";
53
54
  //# sourceMappingURL=editorClasses.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editorClasses.d.ts","sourceRoot":"","sources":["../../src/ui/editorClasses.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,8BAA8B,CAAC;AAC9D,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAC1D,eAAO,MAAM,wBAAwB,0DAA0D,CAAC;AAEhG,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,iBAAiB,+CAA+C,CAAC;AAC9E,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAC1D,eAAO,MAAM,sBAAsB,2DAA2D,CAAC;AAE/F,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAC7C,eAAO,MAAM,gBAAgB,sDAAsD,CAAC;AACpF,eAAO,MAAM,YAAY,uBAAuB,CAAC;AAEjD,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAClE,eAAO,MAAM,oBAAoB,gCAAgC,CAAC;AAElE,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,M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C,OAAO,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAE/F;AAED,wBAAgB,uBAAuB,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAEhE;AAYD,eAAO,MAAM,kBAAkB,8BAA8B,CAAC"}
@@ -67,3 +67,4 @@ function normalizeBtnTone(variant) {
67
67
  };
68
68
  return map[variant] ?? variant.replace(/^outline-/, '');
69
69
  }
70
+ export const EDITOR_PROMPT_ICON = 'graph-editor-icon--prompt';
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <!-- Generated by docs/demo/generate-doc-images.mjs. Do not edit by hand. -->
3
- <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1400" height="840" viewBox="0 0 1400 840" data-tree-spec-demo-source-hash="f202d608ec6ae54fb06e4977accbdbf8cfa77a28dfa1099349d6633e0692ae4d">
3
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1400" height="840" viewBox="0 0 1400 840" data-tree-spec-demo-source-hash="7215879773184c5a0afe8a4a9d8f11d38fc68b269d57b770500ea78905c91b6d">
4
4
  <title>TreeSpec editor incident response example</title>
5
5
  <foreignObject x="0" y="0" width="1400" height="840">
6
6
  <div xmlns="http://www.w3.org/1999/xhtml">
@@ -708,7 +708,7 @@ body {
708
708
  .docs-preview .react-flow__controls {
709
709
  display: none;
710
710
  }</style>
711
- <main class="docs-preview" id="editor-preview"><header class="docs-preview__header"><div><div class="docs-preview__eyebrow">TreeSpec editor</div><h1>Incident response decision tree</h1></div><div class="docs-preview__status">Read-only example</div></header><p class="docs-preview__description">Generated from the exported <code>TreeSpecGraphEditor</code> with the editor model and live example data.</p><section class="docs-preview__canvas" aria-label="TreeSpec editor graph"><div class="graph-editor-canvas-root graph-editor-canvas" data-color-mode="light"><div class="react-flow" data-testid="rf__wrapper" style="width: 100%; height: 100%; overflow: hidden; position: relative; z-index: 0;"><div class="react-flow__renderer" style="position: absolute; width: 100%; height: 100%; top: 0px; left: 0px;"><div class="react-flow__pane" style="position: absolute; width: 100%; height: 100%; top: 0px; left: 0px;"><div class="react-flow__viewport react-flow__container" style="transform: translate(36px, 72px) scale(0.82);"><svg xmlns="http://www.w3.org/2000/svg" width="1322" height="668" class="react-flow__edges react-flow__container" style="z-index: 0;"><defs><marker class="react-flow__arrowhead" id="1__color=#b1b1b7&amp;height=16&amp;type=arrowclosed&amp;width=16" markerWidth="16" markerHeight="16" viewBox="-10 -10 20 20" markerUnits="strokeWidth" orient="auto-start-reverse" refX="0" refY="0"><polyline stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4 -5,-4" style="stroke: rgb(177, 177, 183); fill: rgb(177, 177, 183); stroke-width: 1;"></polyline></marker></defs><g><g class="react-flow__edge react-flow__edge-smoothstep nopan" tabindex="0" role="button" data-testid="rf__edge-triage-investigate" aria-label="Edge from triage to investigate" aria-describedby="react-flow__edge-desc-1"><path d="M324.00000818764295 172.49998436904536L344.00000818764295 172.49998436904536L 385.0000048381527,172.49998436904536Q 390.0000048381527,172.49998436904536 390.0000048381527,177.49998436904536L 390.0000048381527,227.5000029773247Q 390.0000048381527,232.5000029773247 395.0000048381527,232.5000029773247L436.00000148866235 232.5000029773247L456.00000148866235 232.5000029773247" fill="none" class="react-flow__edge-path" marker-end="url('#1__color=#b1b1b7&amp;height=16&amp;type=arrowclosed&amp;width=16')" marker-start="url('#')" style="stroke-width: 2;"></path><path d="M324.00000818764295 172.49998436904536L344.00000818764295 172.49998436904536L 385.0000048381527,172.49998436904536Q 390.0000048381527,172.49998436904536 390.0000048381527,177.49998436904536L 390.0000048381527,227.5000029773247Q 390.0000048381527,232.5000029773247 395.0000048381527,232.5000029773247L436.00000148866235 232.5000029773247L456.00000148866235 232.5000029773247" fill="none" stroke-opacity="0" stroke-width="20" class="react-flow__edge-interaction"></path><g transform="translate(265.0468798381527 196.49999367318503)" class="react-flow__edge-textwrapper" visibility="visible"><rect width="253.90625" x="-2" y="-4" height="20" class="react-flow__edge-textbg" rx="2" ry="2"></rect><text class="react-flow__edge-text" y="6" dy="0.3em">Investigate the email headers and isolate the device</text></g><circle class="react-flow__edgeupdater react-flow__edgeupdater-target" cx="446.00000148866235" cy="232.5000029773247" r="10" stroke="transparent" fill="transparent"></circle></g><g class="react-flow__edge react-flow__edge-smoothstep nopan" tabindex="0" role="button" data-testid="rf__edge-triage-dismiss" aria-label="Edge from triage to END" aria-describedby="react-flow__edge-desc-1"><path d="M324.00000818764295 172.49998436904536L344.00000818764295 172.49998436904536L 804.9999862298732,172.49998436904536Q 809.9999862298732,172.49998436904536 809.9999862298732,167.49998436904536L 809.9999862298732,119.49998362471418Q 809.9999862298732,114.49998362471418 814.9999862298732,114.49998362471418L1275.9999642721036 114.49998362471418L1295.9999642721036 114.49998362471418" fill="none" class="react-flow__edge-path" marker-end="url('#1__color=#b1b1b7&amp;height=16&amp;type=arrowclosed&amp;width=16')" marker-start="url('#')" style="stroke-width: 2;"></path><path d="M324.00000818764295 172.49998436904536L344.00000818764295 172.49998436904536L 804.9999862298732,172.49998436904536Q 809.9999862298732,172.49998436904536 809.9999862298732,167.49998436904536L 809.9999862298732,119.49998362471418Q 809.9999862298732,114.49998362471418 814.9999862298732,114.49998362471418L1275.9999642721036 114.49998362471418L1295.9999642721036 114.49998362471418" fill="none" stroke-opacity="0" stroke-width="20" class="react-flow__edge-interaction"></path><g transform="translate(646.1249862298732 137.49998399687976)" class="react-flow__edge-textwrapper" visibility="visible"><rect width="331.75" x="-2" y="-4" height="20" class="react-flow__edge-textbg" rx="2" ry="2"></rect><text class="react-flow__edge-text" y="6" dy="0.3em">Assume it is harmless and dismiss the report → END (compromised)</text></g><circle class="react-flow__edgeupdater react-flow__edgeupdater-target" cx="1285.9999642721036" cy="114.49998362471418" r="10" stroke="transparent" fill="transparent"></circle></g><g class="react-flow__edge react-flow__edge-smoothstep nopan" tabindex="0" role="button" data-testid="rf__edge-investigate-escalate" aria-label="Edge from investigate to recovery" aria-describedby="react-flow__edge-desc-1"><path d="M743.9999895793635 232.5000029773247L763.9999895793635 232.5000029773247L 805.0000141422922,232.5000029773247Q 810.0000141422922,232.5000029773247 810.0000141422922,237.5000029773247L 810.0000141422922,242.49997320407775Q 810.0000141422922,247.49997320407775 815.0000141422922,247.49997320407775L856.0000387052211 247.49997320407775L876.0000387052211 247.49997320407775" fill="none" class="react-flow__edge-path" marker-end="url('#1__color=#b1b1b7&amp;height=16&amp;type=arrowclosed&amp;width=16')" marker-start="url('#')" style="stroke-width: 2;"></path><path d="M743.9999895793635 232.5000029773247L763.9999895793635 232.5000029773247L 805.0000141422922,232.5000029773247Q 810.0000141422922,232.5000029773247 810.0000141422922,237.5000029773247L 810.0000141422922,242.49997320407775Q 810.0000141422922,247.49997320407775 815.0000141422922,247.49997320407775L856.0000387052211 247.49997320407775L876.0000387052211 247.49997320407775" fill="none" stroke-opacity="0" stroke-width="20" class="react-flow__edge-interaction"></path><g transform="translate(682.8672016422922 233.9999880907012)" class="react-flow__edge-textwrapper" visibility="visible"><rect width="258.265625" x="-2" y="-4" height="20" class="react-flow__edge-textbg" rx="2" ry="2"></rect><text class="react-flow__edge-text" y="6" dy="0.3em">Escalate to incident response and preserve evidence</text></g><circle class="react-flow__edgeupdater react-flow__edgeupdater-target" cx="866.0000387052211" cy="247.49997320407775" r="10" stroke="transparent" fill="transparent"></circle></g><g class="react-flow__edge react-flow__edge-smoothstep nopan" tabindex="0" role="button" data-testid="rf__edge-investigate-reimage" aria-label="Edge from investigate to END" aria-describedby="react-flow__edge-desc-1"><path d="M743.9999895793635 232.5000029773247L763.9999895793635 232.5000029773247L 1014.9999769257336,232.5000029773247Q 1019.9999769257336,232.5000029773247 1019.9999769257336,227.5000029773247L 1019.9999769257336,119.49998362471418Q 1019.9999769257336,114.49998362471418 1024.9999769257336,114.49998362471418L1275.9999642721036 114.49998362471418L1295.9999642721036 114.49998362471418" fill="none" class="react-flow__edge-path" marker-end="url('#1__color=#b1b1b7&amp;height=16&amp;type=arrowclosed&amp;width=16')" marker-start="url('#')" style="stroke-width: 2;"></path><path d="M743.9999895793635 232.5000029773247L763.9999895793635 232.5000029773247L 1014.9999769257336,232.5000029773247Q 1019.9999769257336,232.5000029773247 1019.9999769257336,227.5000029773247L 1019.9999769257336,119.49998362471418Q 1019.9999769257336,114.49998362471418 1024.9999769257336,114.49998362471418L1275.9999642721036 114.49998362471418L1295.9999642721036 114.49998362471418" fill="none" stroke-opacity="0" stroke-width="20" class="react-flow__edge-interaction"></path><g transform="translate(861.2499769257336 167.49999330101943)" class="react-flow__edge-textwrapper" visibility="visible"><rect width="321.5" x="-2" y="-4" height="20" class="react-flow__edge-textbg" rx="2" ry="2"></rect><text class="react-flow__edge-text" y="6" dy="0.3em">Reimage immediately without collecting evidence → END (at_risk)</text></g><circle class="react-flow__edgeupdater react-flow__edgeupdater-target" cx="1285.9999642721036" cy="114.49998362471418" r="10" stroke="transparent" fill="transparent"></circle></g><g class="react-flow__edge react-flow__edge-smoothstep nopan" tabindex="0" role="button" data-testid="rf__edge-recovery-close" aria-label="Edge from recovery to END" aria-describedby="react-flow__edge-desc-1"><path d="M1164.0001012290397 247.49997320407775L1184.0001012290397 247.49997320407775L 1225.0000327505718,247.49997320407775Q 1230.0000327505718,247.49997320407775 1230.0000327505718,242.49997320407775L 1230.0000327505718,119.49998362471418Q 1230.0000327505718,114.49998362471418 1235.0000327505718,114.49998362471418L1275.9999642721036 114.49998362471418L1295.9999642721036 114.49998362471418" fill="none" class="react-flow__edge-path" marker-end="url('#1__color=#b1b1b7&amp;height=16&amp;type=arrowclosed&amp;width=16')" marker-start="url('#')" style="stroke-width: 2;"></path><path d="M1164.0001012290397 247.49997320407775L1184.0001012290397 247.49997320407775L 1225.0000327505718,247.49997320407775Q 1230.0000327505718,247.49997320407775 1230.0000327505718,242.49997320407775L 1230.0000327505718,119.49998362471418Q 1230.0000327505718,114.49998362471418 1235.0000327505718,114.49998362471418L1275.9999642721036 114.49998362471418L1295.9999642721036 114.49998362471418" fill="none" stroke-opacity="0" stroke-width="20" class="react-flow__edge-interaction"></path><g transform="translate(1162.0703452505718 174.99997841439597)" class="react-flow__edge-textwrapper" visibility="visible"><rect width="139.859375" x="-2" y="-4" height="20" class="react-flow__edge-textbg" rx="2" ry="2"></rect><text class="react-flow__edge-text" y="6" dy="0.3em">Close incident → END (safe)</text></g><circle class="react-flow__edgeupdater react-flow__edgeupdater-target" cx="1285.9999642721036" cy="114.49998362471418" r="10" stroke="transparent" fill="transparent"></circle></g></g></svg><div class="react-flow__edgelabel-renderer"></div><div class="react-flow__nodes" style="position: absolute; width: 100%; height: 100%; top: 0px; left: 0px;"><div class="react-flow__node react-flow__node-promptNode nopan" data-id="triage" data-testid="rf__node-triage" tabindex="0" role="button" aria-describedby="react-flow__node-desc-1" style="z-index: 0; transform: translate(40px, 40px); pointer-events: all; visibility: visible; width: 280px;"><div class="graph-editor-card graph-editor-rounded graph-editor-canvas-node" style="width: 100%; height: 100%; min-width: 0px; box-sizing: border-box; display: flex; flex-direction: column;"><div data-handleid="in" data-nodeid="triage" data-handlepos="left" data-id="triage-in-target" class="react-flow__handle react-flow__handle-left nodrag nopan graph-editor-target-handle graph-editor-target-handle--default target connectable connectablestart connectableend connectionindicator"></div><div class="graph-editor-card__header graph-editor-surface--muted graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 graph-editor-flex-shrink-0"><div class="graph-editor-flex graph-editor-flex--between graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-2 graph-editor-min-w-0"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-text--bold graph-editor-text--md">▶ prompt</div></div></div><div class="graph-editor-muted graph-editor-text--xs graph-editor-flex-shrink-0">triage</div></div></div><div class="graph-editor-canvas-node-body graph-editor-min-w-0"><div class="graph-editor-card__body graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 nodrag"><div class="graph-editor-text--sm graph-editor-spacing--mb-0 graph-editor-node-text-wrap min-w-0" title="An employee reports a suspicious attachment. What is the first response?">An employee reports a suspicious attachment. What is the first response?</div></div><ul class="graph-editor-list graph-editor-list--flush graph-editor-text--sm graph-editor-min-w-0 nodrag" aria-label="Node choices"><li class="graph-editor-list__item graph-editor-spacing--p-0 graph-editor-list__item--plain"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-w-full graph-editor-choice-row"><button type="button" class="graph-editor-choice-row-select graph-editor-text--start graph-editor-flex-grow-1 graph-editor-min-w-0 graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1" disabled=""><span class="graph-editor-node-text-wrap min-w-0 graph-editor-flex-grow-1 graph-editor-min-w-0" title="Investigate the email headers and isolate the device">Investigate the email headers and isolate the device</span><span class="graph-editor-badge graph-editor-badge--neutral graph-editor-flex-shrink-0">investigate</span></button><div data-handleid="choice:investigate" data-nodeid="triage" data-handlepos="right" data-id="triage-choice:investigate-source" class="react-flow__handle react-flow__handle-right nodrag nopan graph-editor-handle graph-editor-choice-handle source connectable connectablestart connectableend connectionindicator"></div></div></li><li class="graph-editor-list__item graph-editor-spacing--p-0 graph-editor-list__item--plain"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-w-full graph-editor-choice-row"><button type="button" class="graph-editor-choice-row-select graph-editor-text--start graph-editor-flex-grow-1 graph-editor-min-w-0 graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1" disabled=""><span class="graph-editor-node-text-wrap min-w-0 graph-editor-flex-grow-1 graph-editor-min-w-0" title="Assume it is harmless and dismiss the report">Assume it is harmless and dismiss the report</span><span class="graph-editor-badge graph-editor-badge--neutral graph-editor-flex-shrink-0">dismiss</span></button><div data-handleid="choice:dismiss" data-nodeid="triage" data-handlepos="right" data-id="triage-choice:dismiss-source" class="react-flow__handle react-flow__handle-right nodrag nopan graph-editor-handle graph-editor-choice-handle source connectable connectablestart connectableend connectionindicator"></div></div></li></ul></div></div></div><div class="react-flow__node react-flow__node-promptNode nopan" data-id="investigate" data-testid="rf__node-investigate" tabindex="0" role="button" aria-describedby="react-flow__node-desc-1" style="z-index: 0; transform: translate(460px, 100px); pointer-events: all; visibility: visible; width: 280px;"><div class="graph-editor-card graph-editor-rounded graph-editor-canvas-node" style="width: 100%; height: 100%; min-width: 0px; box-sizing: border-box; display: flex; flex-direction: column;"><div data-handleid="in" data-nodeid="investigate" data-handlepos="left" data-id="investigate-in-target" class="react-flow__handle react-flow__handle-left nodrag nopan graph-editor-target-handle graph-editor-target-handle--default target connectable connectablestart connectableend connectionindicator"></div><div class="graph-editor-card__header graph-editor-surface--muted graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 graph-editor-flex-shrink-0"><div class="graph-editor-flex graph-editor-flex--between graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-2 graph-editor-min-w-0"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-text--bold graph-editor-text--md">prompt</div></div></div><div class="graph-editor-muted graph-editor-text--xs graph-editor-flex-shrink-0">investig</div></div></div><div class="graph-editor-canvas-node-body graph-editor-min-w-0"><div class="graph-editor-card__body graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 nodrag"><div class="graph-editor-text--sm graph-editor-spacing--mb-0 graph-editor-node-text-wrap min-w-0" title="The attachment contacted an unknown host. What do you do next?">The attachment contacted an unknown host. What do you do next?</div></div><ul class="graph-editor-list graph-editor-list--flush graph-editor-text--sm graph-editor-min-w-0 nodrag" aria-label="Node choices"><li class="graph-editor-list__item graph-editor-spacing--p-0 graph-editor-list__item--plain"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-w-full graph-editor-choice-row"><button type="button" class="graph-editor-choice-row-select graph-editor-text--start graph-editor-flex-grow-1 graph-editor-min-w-0 graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1" disabled=""><span class="graph-editor-node-text-wrap min-w-0 graph-editor-flex-grow-1 graph-editor-min-w-0" title="Escalate to incident response and preserve evidence">Escalate to incident response and preserve evidence</span><span class="graph-editor-badge graph-editor-badge--neutral graph-editor-flex-shrink-0">escalate</span></button><div data-handleid="choice:escalate" data-nodeid="investigate" data-handlepos="right" data-id="investigate-choice:escalate-source" class="react-flow__handle react-flow__handle-right nodrag nopan graph-editor-handle graph-editor-choice-handle source connectable connectablestart connectableend connectionindicator"></div></div></li><li class="graph-editor-list__item graph-editor-spacing--p-0 graph-editor-list__item--plain"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-w-full graph-editor-choice-row"><button type="button" class="graph-editor-choice-row-select graph-editor-text--start graph-editor-flex-grow-1 graph-editor-min-w-0 graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1" disabled=""><span class="graph-editor-node-text-wrap min-w-0 graph-editor-flex-grow-1 graph-editor-min-w-0" title="Reimage immediately without collecting evidence">Reimage immediately without collecting evidence</span><span class="graph-editor-badge graph-editor-badge--neutral graph-editor-flex-shrink-0">reimage</span></button><div data-handleid="choice:reimage" data-nodeid="investigate" data-handlepos="right" data-id="investigate-choice:reimage-source" class="react-flow__handle react-flow__handle-right nodrag nopan graph-editor-handle graph-editor-choice-handle source connectable connectablestart connectableend connectionindicator"></div></div></li></ul></div></div></div><div class="react-flow__node react-flow__node-promptNode nopan" data-id="recovery" data-testid="rf__node-recovery" tabindex="0" role="button" aria-describedby="react-flow__node-desc-1" style="z-index: 0; transform: translate(880px, 160px); pointer-events: all; visibility: visible; width: 280px;"><div class="graph-editor-card graph-editor-rounded graph-editor-canvas-node" style="width: 100%; height: 100%; min-width: 0px; box-sizing: border-box; display: flex; flex-direction: column;"><div data-handleid="in" data-nodeid="recovery" data-handlepos="left" data-id="recovery-in-target" class="react-flow__handle react-flow__handle-left nodrag nopan graph-editor-target-handle graph-editor-target-handle--default target connectable connectablestart connectableend connectionindicator"></div><div class="graph-editor-card__header graph-editor-surface--muted graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 graph-editor-flex-shrink-0"><div class="graph-editor-flex graph-editor-flex--between graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-2 graph-editor-min-w-0"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-text--bold graph-editor-text--md">info</div></div></div><div class="graph-editor-muted graph-editor-text--xs graph-editor-flex-shrink-0">recovery</div></div></div><div class="graph-editor-canvas-node-body graph-editor-min-w-0"><div class="graph-editor-card__body graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 nodrag"><div class="graph-editor-text--sm graph-editor-spacing--mb-0 graph-editor-node-text-wrap min-w-0" title="Notify stakeholders, document the timeline, and restore the endpoint safely.">Notify stakeholders, document the timeline, and restore the endpoint safely.</div></div><ul class="graph-editor-list graph-editor-list--flush graph-editor-text--sm graph-editor-min-w-0 nodrag" aria-label="Node choices"><li class="graph-editor-list__item graph-editor-spacing--p-0 graph-editor-list__item--plain"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-w-full graph-editor-choice-row"><button type="button" class="graph-editor-choice-row-select graph-editor-text--start graph-editor-flex-grow-1 graph-editor-min-w-0 graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1" disabled=""><span class="graph-editor-node-text-wrap min-w-0 graph-editor-flex-grow-1 graph-editor-min-w-0" title="Close incident">Close incident</span><span class="graph-editor-badge graph-editor-badge--neutral graph-editor-flex-shrink-0">close</span></button><div data-handleid="choice:close" data-nodeid="recovery" data-handlepos="right" data-id="recovery-choice:close-source" class="react-flow__handle react-flow__handle-right nodrag nopan graph-editor-handle graph-editor-choice-handle source connectable connectablestart connectableend connectionindicator"></div></div></li></ul></div></div></div><div class="react-flow__node react-flow__node-endNode nopan selectable" data-id="END" data-testid="rf__node-END" tabindex="0" role="button" aria-describedby="react-flow__node-desc-1" style="z-index: 0; transform: translate(1300px, 80px); pointer-events: all; visibility: visible;"><div class="graph-editor-card graph-editor-rounded graph-editor-canvas-node graph-editor-canvas-node--border-danger graph-editor-canvas-node--end-width"><div data-handleid="in" data-nodeid="END" data-handlepos="left" data-id="END-in-target" class="react-flow__handle react-flow__handle-left nodrag nopan graph-editor-target-handle graph-editor-target-handle--danger target connectable connectablestart connectableend connectionindicator"></div><div class="graph-editor-card__body graph-editor-spacing--p-2 graph-editor-text--center"><div class="graph-editor-text--bold graph-editor-text--danger">END</div><div class="graph-editor-muted graph-editor-text--sm">Outcome required</div></div></div></div></div></div></div></div><div class="react-flow__panel react-flow__controls bottom left" data-testid="rf__controls" style="pointer-events: all;"><button type="button" class="react-flow__controls-button react-flow__controls-zoomin" title="zoom in" aria-label="zoom in"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"></path></svg></button><button type="button" class="react-flow__controls-button react-flow__controls-zoomout" title="zoom out" aria-label="zoom out"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 5"><path d="M0 0h32v4.2H0z"></path></svg></button><button type="button" class="react-flow__controls-button react-flow__controls-fitview" title="fit view" aria-label="fit view"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 30"><path d="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"></path></svg></button><button type="button" class="react-flow__controls-button react-flow__controls-interactive" title="toggle interactivity" aria-label="toggle interactivity"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32"><path d="M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"></path></svg></button></div><svg xmlns="http://www.w3.org/2000/svg" class="react-flow__background" data-testid="rf__background" style="position: absolute; width: 100%; height: 100%; top: 0px; left: 0px;"><pattern id="pattern-1undefined" x="3.200000000000003" y="6.400000000000006" width="16.4" height="16.4" patternUnits="userSpaceOnUse" patternTransform="translate(-0.41,-0.41)"><circle cx="0.41" cy="0.41" r="0.41" fill="#91919a"></circle></pattern><rect x="0" y="0" width="100%" height="100%" fill="url(#pattern-1undefined)"></rect></svg><div class="react-flow__panel react-flow__attribution bottom right" data-message="Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro" style="pointer-events: all;"><a href="https://reactflow.dev" target="_blank" rel="noopener noreferrer" aria-label="React Flow attribution">React Flow</a></div><div id="react-flow__node-desc-1" style="display: none;">Press enter or space to select a node.You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel. </div><div id="react-flow__edge-desc-1" style="display: none;">Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.</div><div id="react-flow__aria-live-1" aria-live="assertive" aria-atomic="true" style="position: absolute; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(100%);"></div></div></div></section></main>
711
+ <main class="docs-preview" id="editor-preview"><header class="docs-preview__header"><div><div class="docs-preview__eyebrow">TreeSpec editor</div><h1>Incident response decision tree</h1></div><div class="docs-preview__status">Read-only example</div></header><p class="docs-preview__description">Generated from the exported <code>TreeSpecGraphEditor</code> with the editor model and live example data.</p><section class="docs-preview__canvas" aria-label="TreeSpec editor graph"><div class="graph-editor-canvas-root graph-editor-canvas" data-color-mode="light"><div class="react-flow" data-testid="rf__wrapper" style="width: 100%; height: 100%; overflow: hidden; position: relative; z-index: 0;"><div class="react-flow__renderer" style="position: absolute; width: 100%; height: 100%; top: 0px; left: 0px;"><div class="react-flow__pane" style="position: absolute; width: 100%; height: 100%; top: 0px; left: 0px;"><div class="react-flow__viewport react-flow__container" style="transform: translate(36px, 72px) scale(0.82);"><svg xmlns="http://www.w3.org/2000/svg" width="1322" height="668" class="react-flow__edges react-flow__container" style="z-index: 0;"><defs><marker class="react-flow__arrowhead" id="1__color=#198754&amp;height=32&amp;markerUnits=userSpaceOnUse&amp;type=arrowclosed&amp;width=32" markerWidth="32" markerHeight="32" viewBox="-10 -10 20 20" markerUnits="userSpaceOnUse" orient="auto-start-reverse" refX="0" refY="0"><polyline stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4 -5,-4" style="stroke: rgb(25, 135, 84); fill: rgb(25, 135, 84); stroke-width: 1;"></polyline></marker><marker class="react-flow__arrowhead" id="1__color=#b1b1b7&amp;height=32&amp;markerUnits=userSpaceOnUse&amp;type=arrowclosed&amp;width=32" markerWidth="32" markerHeight="32" viewBox="-10 -10 20 20" markerUnits="userSpaceOnUse" orient="auto-start-reverse" refX="0" refY="0"><polyline stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4 -5,-4" style="stroke: rgb(177, 177, 183); fill: rgb(177, 177, 183); stroke-width: 1;"></polyline></marker><marker class="react-flow__arrowhead" id="1__color=#dc3545&amp;height=32&amp;markerUnits=userSpaceOnUse&amp;type=arrowclosed&amp;width=32" markerWidth="32" markerHeight="32" viewBox="-10 -10 20 20" markerUnits="userSpaceOnUse" orient="auto-start-reverse" refX="0" refY="0"><polyline stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4 -5,-4" style="stroke: rgb(220, 53, 69); fill: rgb(220, 53, 69); stroke-width: 1;"></polyline></marker><marker class="react-flow__arrowhead" id="1__color=#fd7e14&amp;height=32&amp;markerUnits=userSpaceOnUse&amp;type=arrowclosed&amp;width=32" markerWidth="32" markerHeight="32" viewBox="-10 -10 20 20" markerUnits="userSpaceOnUse" orient="auto-start-reverse" refX="0" refY="0"><polyline stroke-linecap="round" stroke-linejoin="round" points="-5,-4 0,0 -5,4 -5,-4" style="stroke: rgb(253, 126, 20); fill: rgb(253, 126, 20); stroke-width: 1;"></polyline></marker></defs><g><g class="react-flow__edge react-flow__edge-smoothstep nopan" tabindex="0" role="button" data-testid="rf__edge-triage-investigate" aria-label="Edge from triage to investigate" aria-describedby="react-flow__edge-desc-1"><path id="triage-investigate" d="M324.00000818764295,172.49998436904536 L359.80000160031204,172.49998436904536 Q364.80000160031204,172.49998436904536 364.80000160031204,177.49998436904536 L364.80000160031204,287.5000029773247 Q364.80000160031204,292.5000029773247 369.80000160031204,292.5000029773247 L550.1999708594345,292.5000029773247 Q555.1999708594345,292.5000029773247 560.1999708594345,292.5000029773247 L595.9999642721036,292.5000029773247" fill="none" class="react-flow__edge-path" marker-end="url('#1__color=#b1b1b7&amp;height=32&amp;markerUnits=userSpaceOnUse&amp;type=arrowclosed&amp;width=32')" style="stroke-width: 2;"></path><path d="M324.00000818764295,172.49998436904536 L359.80000160031204,172.49998436904536 Q364.80000160031204,172.49998436904536 364.80000160031204,177.49998436904536 L364.80000160031204,287.5000029773247 Q364.80000160031204,292.5000029773247 369.80000160031204,292.5000029773247 L550.1999708594345,292.5000029773247 Q555.1999708594345,292.5000029773247 560.1999708594345,292.5000029773247 L595.9999642721036,292.5000029773247" fill="none" stroke-opacity="0" stroke-width="20" class="react-flow__edge-interaction"></path><circle class="react-flow__edgeupdater react-flow__edgeupdater-target" cx="585.9999642721036" cy="292.5000029773247" r="10" stroke="transparent" fill="transparent"></circle></g><g class="react-flow__edge react-flow__edge-smoothstep nopan" tabindex="0" role="button" data-testid="rf__edge-triage-dismiss" aria-label="Edge from triage to END" aria-describedby="react-flow__edge-desc-1"><path id="triage-dismiss" d="M324.00000818764295,172.49998436904536 L527.800001600312,172.49998436904536 Q532.800001600312,172.49998436904536 532.800001600312,167.49998436904536 L532.800001600312,115.50002084127286 Q532.800001600312,110.50002084127286 537.800001600312,110.50002084127286 L1502.1999708594344,110.50002084127286 Q1507.1999708594344,110.50002084127286 1507.1999708594344,115.50002084127286 L1507.1999708594344,169.50002084127286 Q1507.1999708594344,174.50002084127286 1512.1999708594344,174.50002084127286 L1715.9999642721036,174.50002084127286" fill="none" class="react-flow__edge-path" marker-end="url('#1__color=#dc3545&amp;height=32&amp;markerUnits=userSpaceOnUse&amp;type=arrowclosed&amp;width=32')" style="stroke: rgb(220, 53, 69); stroke-width: 2;"></path><path d="M324.00000818764295,172.49998436904536 L527.800001600312,172.49998436904536 Q532.800001600312,172.49998436904536 532.800001600312,167.49998436904536 L532.800001600312,115.50002084127286 Q532.800001600312,110.50002084127286 537.800001600312,110.50002084127286 L1502.1999708594344,110.50002084127286 Q1507.1999708594344,110.50002084127286 1507.1999708594344,115.50002084127286 L1507.1999708594344,169.50002084127286 Q1507.1999708594344,174.50002084127286 1512.1999708594344,174.50002084127286 L1715.9999642721036,174.50002084127286" fill="none" stroke-opacity="0" stroke-width="20" class="react-flow__edge-interaction"></path><circle class="react-flow__edgeupdater react-flow__edgeupdater-target" cx="1705.9999642721036" cy="174.50002084127286" r="10" stroke="transparent" fill="transparent"></circle></g><g class="react-flow__edge react-flow__edge-smoothstep nopan" tabindex="0" role="button" data-testid="rf__edge-investigate-escalate" aria-label="Edge from investigate to recovery" aria-describedby="react-flow__edge-desc-1"><path id="investigate-escalate" d="M884.0000267959223,292.5000029773247 L919.800028582317,292.5000029773247 Q924.800028582317,292.5000029773247 924.800028582317,297.5000029773247 L924.800028582317,362.50001042063644 Q924.800028582317,367.50001042063644 929.800028582317,367.50001042063644 L1110.200036918826,367.50001042063644 Q1115.200036918826,367.50001042063644 1120.200036918826,367.50001042063644 L1156.000038705221,367.50001042063644" fill="none" class="react-flow__edge-path" marker-end="url('#1__color=#b1b1b7&amp;height=32&amp;markerUnits=userSpaceOnUse&amp;type=arrowclosed&amp;width=32')" style="stroke-width: 2;"></path><path d="M884.0000267959223,292.5000029773247 L919.800028582317,292.5000029773247 Q924.800028582317,292.5000029773247 924.800028582317,297.5000029773247 L924.800028582317,362.50001042063644 Q924.800028582317,367.50001042063644 929.800028582317,367.50001042063644 L1110.200036918826,367.50001042063644 Q1115.200036918826,367.50001042063644 1120.200036918826,367.50001042063644 L1156.000038705221,367.50001042063644" fill="none" stroke-opacity="0" stroke-width="20" class="react-flow__edge-interaction"></path><circle class="react-flow__edgeupdater react-flow__edgeupdater-target" cx="1146.000038705221" cy="367.50001042063644" r="10" stroke="transparent" fill="transparent"></circle></g><g class="react-flow__edge react-flow__edge-smoothstep nopan" tabindex="0" role="button" data-testid="rf__edge-investigate-reimage" aria-label="Edge from investigate to END" aria-describedby="react-flow__edge-desc-1"><path id="investigate-reimage" d="M884.0000267959223,292.5000029773247 L1003.8000174173495,292.5000029773247 Q1008.8000174173495,292.5000029773247 1008.8000174173495,287.5000029773247 L1008.8000174173495,197.50002084127286 Q1008.8000174173495,192.50002084127286 1013.8000174173495,192.50002084127286 L1586.1999736506764,192.50002084127286 Q1591.1999736506764,192.50002084127286 1591.1999736506764,187.50002084127286 L1591.1999736506764,179.50002084127286 Q1591.1999736506764,174.50002084127286 1596.1999736506764,174.50002084127286 L1715.9999642721036,174.50002084127286" fill="none" class="react-flow__edge-path" marker-end="url('#1__color=#fd7e14&amp;height=32&amp;markerUnits=userSpaceOnUse&amp;type=arrowclosed&amp;width=32')" style="stroke: rgb(253, 126, 20); stroke-width: 2;"></path><path d="M884.0000267959223,292.5000029773247 L1003.8000174173495,292.5000029773247 Q1008.8000174173495,292.5000029773247 1008.8000174173495,287.5000029773247 L1008.8000174173495,197.50002084127286 Q1008.8000174173495,192.50002084127286 1013.8000174173495,192.50002084127286 L1586.1999736506764,192.50002084127286 Q1591.1999736506764,192.50002084127286 1591.1999736506764,187.50002084127286 L1591.1999736506764,179.50002084127286 Q1591.1999736506764,174.50002084127286 1596.1999736506764,174.50002084127286 L1715.9999642721036,174.50002084127286" fill="none" stroke-opacity="0" stroke-width="20" class="react-flow__edge-interaction"></path><circle class="react-flow__edgeupdater react-flow__edgeupdater-target" cx="1705.9999642721036" cy="174.50002084127286" r="10" stroke="transparent" fill="transparent"></circle></g><g class="react-flow__edge react-flow__edge-smoothstep nopan" tabindex="0" role="button" data-testid="rf__edge-recovery-close" aria-label="Edge from recovery to END" aria-describedby="react-flow__edge-desc-1"><path id="recovery-close" d="M1444.0001012290397,367.50001042063644 L1479.8000806854993,367.50001042063644 Q1484.8000806854993,367.50001042063644 1484.8000806854993,362.50001042063644 L1484.8000806854993,261.5000208412729 Q1484.8000806854993,256.5000208412729 1489.8000806854993,256.5000208412729 L1670.199984815644,256.5000208412729 Q1675.199984815644,256.5000208412729 1675.199984815644,251.50002084127289 L1675.199984815644,179.50002084127286 Q1675.199984815644,174.50002084127286 1680.199984815644,174.50002084127286 L1715.9999642721036,174.50002084127286" fill="none" class="react-flow__edge-path" marker-end="url('#1__color=#198754&amp;height=32&amp;markerUnits=userSpaceOnUse&amp;type=arrowclosed&amp;width=32')" style="stroke: rgb(25, 135, 84); stroke-width: 2;"></path><path d="M1444.0001012290397,367.50001042063644 L1479.8000806854993,367.50001042063644 Q1484.8000806854993,367.50001042063644 1484.8000806854993,362.50001042063644 L1484.8000806854993,261.5000208412729 Q1484.8000806854993,256.5000208412729 1489.8000806854993,256.5000208412729 L1670.199984815644,256.5000208412729 Q1675.199984815644,256.5000208412729 1675.199984815644,251.50002084127289 L1675.199984815644,179.50002084127286 Q1675.199984815644,174.50002084127286 1680.199984815644,174.50002084127286 L1715.9999642721036,174.50002084127286" fill="none" stroke-opacity="0" stroke-width="20" class="react-flow__edge-interaction"></path><circle class="react-flow__edgeupdater react-flow__edgeupdater-target" cx="1705.9999642721036" cy="174.50002084127286" r="10" stroke="transparent" fill="transparent"></circle></g></g></svg><div class="react-flow__edgelabel-renderer"><div class="graph-editor-edge-label nodrag nopan" data-edge-id="triage-investigate" style="width: 200px; transform: translate(-50%, -50%) translate(460px, 292.5px);"><a href="#choice-triage-investigate" class="graph-editor-edge-label-choice">Investigate the email headers and isolate the device</a> → <a class="graph-editor-edge-label-target" href="#node-investigate">investigate</a></div><div class="graph-editor-edge-label nodrag nopan" data-edge-id="investigate-escalate" style="width: 200px; transform: translate(-50%, -50%) translate(1020px, 367.5px);"><a href="#choice-investigate-escalate" class="graph-editor-edge-label-choice">Escalate to incident response and preserve evidence</a> → <a class="graph-editor-edge-label-target" href="#node-recovery">recovery</a></div><div class="graph-editor-edge-label nodrag nopan" data-edge-id="triage-dismiss" style="width: 200px; transform: translate(-50%, -50%) translate(1020px, 110.5px);"><a href="#choice-triage-dismiss" class="graph-editor-edge-label-choice">Assume it is harmless and dismiss the report</a> → <a class="graph-editor-edge-label-target" href="#node-END">END</a></div><div class="graph-editor-edge-label nodrag nopan" data-edge-id="investigate-reimage" style="width: 200px; transform: translate(-50%, -50%) translate(1300px, 192.5px);"><a href="#choice-investigate-reimage" class="graph-editor-edge-label-choice">Reimage immediately without collecting evidence</a> → <a class="graph-editor-edge-label-target" href="#node-END">END</a></div><div class="graph-editor-edge-label nodrag nopan" data-edge-id="recovery-close" style="width: 200px; transform: translate(-50%, -50%) translate(1580px, 256.5px);"><a href="#choice-recovery-close" class="graph-editor-edge-label-choice">Close incident</a> → <a class="graph-editor-edge-label-target" href="#node-END">END</a></div></div><div class="react-flow__nodes" style="position: absolute; width: 100%; height: 100%; top: 0px; left: 0px;"><div class="react-flow__node react-flow__node-promptNode nopan" data-id="triage" data-testid="rf__node-triage" tabindex="0" role="button" aria-describedby="react-flow__node-desc-1" style="z-index: 0; transform: translate(40px, 40px); pointer-events: all; visibility: visible; width: 280px;"><div class="graph-editor-card graph-editor-rounded graph-editor-canvas-node" style="width: 100%; height: 100%; min-width: 0px; box-sizing: border-box; display: flex; flex-direction: column;"><div data-handleid="in" data-nodeid="triage" data-handlepos="left" data-id="triage-in-target" class="react-flow__handle react-flow__handle-left nodrag nopan graph-editor-target-handle graph-editor-target-handle--default target connectable connectablestart connectableend connectionindicator"></div><div class="graph-editor-card__header graph-editor-surface--muted graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 graph-editor-flex-shrink-0"><div class="graph-editor-flex graph-editor-flex--between graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-2 graph-editor-min-w-0"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-text--bold graph-editor-text--md"><span class="graph-editor-icon--prompt" role="img" aria-label="Prompt" title="Prompt"></span>triage</div></div></div><span class="graph-editor-flex-shrink-0" role="img" aria-label="Start node" title="Start node">★</span></div></div><div class="graph-editor-canvas-node-body graph-editor-min-w-0"><div class="graph-editor-card__body graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 nodrag"><div class="graph-editor-text--sm graph-editor-spacing--mb-0 graph-editor-node-text-wrap min-w-0" title="An employee reports a suspicious attachment. What is the first response?">An employee reports a suspicious attachment. What is the first response?</div></div><ul class="graph-editor-list graph-editor-list--flush graph-editor-text--sm graph-editor-min-w-0 nodrag" aria-label="Node choices"><li class="graph-editor-list__item graph-editor-spacing--p-0 graph-editor-list__item--plain"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-w-full graph-editor-choice-row"><button type="button" class="graph-editor-choice-row-select graph-editor-text--start graph-editor-flex-grow-1 graph-editor-min-w-0 graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1" disabled=""><span class="graph-editor-node-text-wrap min-w-0 graph-editor-flex-grow-1 graph-editor-min-w-0" title="Investigate the email headers and isolate the device">Investigate the email headers and isolate the device</span><span class="graph-editor-badge graph-editor-badge--neutral graph-editor-flex-shrink-0">investigate</span></button><div data-handleid="choice:investigate" data-nodeid="triage" data-handlepos="right" data-id="triage-choice:investigate-source" class="react-flow__handle react-flow__handle-right nodrag nopan graph-editor-handle graph-editor-choice-handle source connectable connectablestart connectableend connectionindicator"></div></div></li><li class="graph-editor-list__item graph-editor-spacing--p-0 graph-editor-list__item--plain"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-w-full graph-editor-choice-row"><button type="button" class="graph-editor-choice-row-select graph-editor-text--start graph-editor-flex-grow-1 graph-editor-min-w-0 graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1" disabled=""><span class="graph-editor-node-text-wrap min-w-0 graph-editor-flex-grow-1 graph-editor-min-w-0" title="Assume it is harmless and dismiss the report">Assume it is harmless and dismiss the report</span><span title="Compromised" class="graph-editor-badge graph-editor-badge--neutral graph-editor-flex-shrink-0" style="background-color: rgb(220, 53, 69); color: rgb(255, 255, 255);">dismiss</span></button><div data-handleid="choice:dismiss" data-nodeid="triage" data-handlepos="right" data-id="triage-choice:dismiss-source" class="react-flow__handle react-flow__handle-right nodrag nopan graph-editor-handle graph-editor-choice-handle source connectable connectablestart connectableend connectionindicator"></div></div></li></ul></div></div></div><div class="react-flow__node react-flow__node-promptNode nopan" data-id="investigate" data-testid="rf__node-investigate" tabindex="0" role="button" aria-describedby="react-flow__node-desc-1" style="z-index: 0; transform: translate(600px, 160px); pointer-events: all; visibility: visible; width: 280px;"><div class="graph-editor-card graph-editor-rounded graph-editor-canvas-node" style="width: 100%; height: 100%; min-width: 0px; box-sizing: border-box; display: flex; flex-direction: column;"><div data-handleid="in" data-nodeid="investigate" data-handlepos="left" data-id="investigate-in-target" class="react-flow__handle react-flow__handle-left nodrag nopan graph-editor-target-handle graph-editor-target-handle--default target connectable connectablestart connectableend connectionindicator"></div><div class="graph-editor-card__header graph-editor-surface--muted graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 graph-editor-flex-shrink-0"><div class="graph-editor-flex graph-editor-flex--between graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-2 graph-editor-min-w-0"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-text--bold graph-editor-text--md"><span class="graph-editor-icon--prompt" role="img" aria-label="Prompt" title="Prompt"></span>investigate</div></div></div></div></div><div class="graph-editor-canvas-node-body graph-editor-min-w-0"><div class="graph-editor-card__body graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 nodrag"><div class="graph-editor-text--sm graph-editor-spacing--mb-0 graph-editor-node-text-wrap min-w-0" title="The attachment contacted an unknown host. What do you do next?">The attachment contacted an unknown host. What do you do next?</div></div><ul class="graph-editor-list graph-editor-list--flush graph-editor-text--sm graph-editor-min-w-0 nodrag" aria-label="Node choices"><li class="graph-editor-list__item graph-editor-spacing--p-0 graph-editor-list__item--plain"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-w-full graph-editor-choice-row"><button type="button" class="graph-editor-choice-row-select graph-editor-text--start graph-editor-flex-grow-1 graph-editor-min-w-0 graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1" disabled=""><span class="graph-editor-node-text-wrap min-w-0 graph-editor-flex-grow-1 graph-editor-min-w-0" title="Escalate to incident response and preserve evidence">Escalate to incident response and preserve evidence</span><span class="graph-editor-badge graph-editor-badge--neutral graph-editor-flex-shrink-0">escalate</span></button><div data-handleid="choice:escalate" data-nodeid="investigate" data-handlepos="right" data-id="investigate-choice:escalate-source" class="react-flow__handle react-flow__handle-right nodrag nopan graph-editor-handle graph-editor-choice-handle source connectable connectablestart connectableend connectionindicator"></div></div></li><li class="graph-editor-list__item graph-editor-spacing--p-0 graph-editor-list__item--plain"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-w-full graph-editor-choice-row"><button type="button" class="graph-editor-choice-row-select graph-editor-text--start graph-editor-flex-grow-1 graph-editor-min-w-0 graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1" disabled=""><span class="graph-editor-node-text-wrap min-w-0 graph-editor-flex-grow-1 graph-editor-min-w-0" title="Reimage immediately without collecting evidence">Reimage immediately without collecting evidence</span><span title="At risk" class="graph-editor-badge graph-editor-badge--neutral graph-editor-flex-shrink-0" style="background-color: rgb(253, 126, 20); color: rgb(0, 0, 0);">reimage</span></button><div data-handleid="choice:reimage" data-nodeid="investigate" data-handlepos="right" data-id="investigate-choice:reimage-source" class="react-flow__handle react-flow__handle-right nodrag nopan graph-editor-handle graph-editor-choice-handle source connectable connectablestart connectableend connectionindicator"></div></div></li></ul></div></div></div><div class="react-flow__node react-flow__node-promptNode nopan" data-id="recovery" data-testid="rf__node-recovery" tabindex="0" role="button" aria-describedby="react-flow__node-desc-1" style="z-index: 0; transform: translate(1160px, 280px); pointer-events: all; visibility: visible; width: 280px;"><div class="graph-editor-card graph-editor-rounded graph-editor-canvas-node" style="width: 100%; height: 100%; min-width: 0px; box-sizing: border-box; display: flex; flex-direction: column;"><div data-handleid="in" data-nodeid="recovery" data-handlepos="left" data-id="recovery-in-target" class="react-flow__handle react-flow__handle-left nodrag nopan graph-editor-target-handle graph-editor-target-handle--default target connectable connectablestart connectableend connectionindicator"></div><div class="graph-editor-card__header graph-editor-surface--muted graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 graph-editor-flex-shrink-0"><div class="graph-editor-flex graph-editor-flex--between graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-2 graph-editor-min-w-0"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-start graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-min-w-0 graph-editor-flex-grow-1 graph-editor-overflow-hidden"><div class="graph-editor-text--bold graph-editor-text--md">recovery</div></div></div><div class="graph-editor-muted graph-editor-text--xs graph-editor-flex-shrink-0">info</div></div></div><div class="graph-editor-canvas-node-body graph-editor-min-w-0"><div class="graph-editor-card__body graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-min-w-0 nodrag"><div class="graph-editor-text--sm graph-editor-spacing--mb-0 graph-editor-node-text-wrap min-w-0" title="Notify stakeholders, document the timeline, and restore the endpoint safely.">Notify stakeholders, document the timeline, and restore the endpoint safely.</div></div><ul class="graph-editor-list graph-editor-list--flush graph-editor-text--sm graph-editor-min-w-0 nodrag" aria-label="Node choices"><li class="graph-editor-list__item graph-editor-spacing--p-0 graph-editor-list__item--plain"><div class="graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1 graph-editor-min-w-0 graph-editor-spacing--py-2 graph-editor-spacing--px-2 graph-editor-w-full graph-editor-choice-row"><button type="button" class="graph-editor-choice-row-select graph-editor-text--start graph-editor-flex-grow-1 graph-editor-min-w-0 graph-editor-flex graph-editor-flex--row graph-editor-flex graph-editor-flex--align-center graph-editor-spacing--gap-1" disabled=""><span class="graph-editor-node-text-wrap min-w-0 graph-editor-flex-grow-1 graph-editor-min-w-0" title="Close incident">Close incident</span><span title="Safe" class="graph-editor-badge graph-editor-badge--neutral graph-editor-flex-shrink-0" style="background-color: rgb(25, 135, 84); color: rgb(255, 255, 255);">close</span></button><div data-handleid="choice:close" data-nodeid="recovery" data-handlepos="right" data-id="recovery-choice:close-source" class="react-flow__handle react-flow__handle-right nodrag nopan graph-editor-handle graph-editor-choice-handle source connectable connectablestart connectableend connectionindicator"></div></div></li></ul></div></div></div><div class="react-flow__node react-flow__node-endNode nopan selectable" data-id="END" data-testid="rf__node-END" tabindex="0" role="button" aria-describedby="react-flow__node-desc-1" style="z-index: 0; transform: translate(1720px, 140px); pointer-events: all; visibility: visible;"><div class="graph-editor-card graph-editor-rounded graph-editor-canvas-node graph-editor-canvas-node--border-danger graph-editor-canvas-node--end-width"><div data-handleid="in" data-nodeid="END" data-handlepos="left" data-id="END-in-target" class="react-flow__handle react-flow__handle-left nodrag nopan graph-editor-target-handle graph-editor-target-handle--danger target connectable connectablestart connectableend connectionindicator"></div><div class="graph-editor-card__body graph-editor-spacing--p-2 graph-editor-text--center"><div class="graph-editor-text--bold graph-editor-text--danger">END</div><div class="graph-editor-muted graph-editor-text--sm">Outcome required</div></div></div></div></div></div></div></div><div class="react-flow__panel react-flow__controls bottom left" data-testid="rf__controls" style="pointer-events: all;"><button type="button" class="react-flow__controls-button react-flow__controls-zoomin" title="zoom in" aria-label="zoom in"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><path d="M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"></path></svg></button><button type="button" class="react-flow__controls-button react-flow__controls-zoomout" title="zoom out" aria-label="zoom out"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 5"><path d="M0 0h32v4.2H0z"></path></svg></button><button type="button" class="react-flow__controls-button react-flow__controls-fitview" title="fit view" aria-label="fit view"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 30"><path d="M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"></path></svg></button><button type="button" class="react-flow__controls-button react-flow__controls-interactive" title="toggle interactivity" aria-label="toggle interactivity"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 25 32"><path d="M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"></path></svg></button></div><svg xmlns="http://www.w3.org/2000/svg" class="react-flow__background" data-testid="rf__background" style="position: absolute; width: 100%; height: 100%; top: 0px; left: 0px;"><pattern id="pattern-1undefined" x="3.200000000000003" y="6.400000000000006" width="16.4" height="16.4" patternUnits="userSpaceOnUse" patternTransform="translate(-0.41,-0.41)"><circle cx="0.41" cy="0.41" r="0.41" fill="#91919a"></circle></pattern><rect x="0" y="0" width="100%" height="100%" fill="url(#pattern-1undefined)"></rect></svg><div class="react-flow__panel react-flow__attribution bottom right" data-message="Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro" style="pointer-events: all;"><a href="https://reactflow.dev" target="_blank" rel="noopener noreferrer" aria-label="React Flow attribution">React Flow</a></div><div id="react-flow__node-desc-1" style="display: none;">Press enter or space to select a node.You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel. </div><div id="react-flow__edge-desc-1" style="display: none;">Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.</div><div id="react-flow__aria-live-1" aria-live="assertive" aria-atomic="true" style="position: absolute; width: 1px; height: 1px; margin: -1px; border: 0px; padding: 0px; overflow: hidden; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(100%);"></div></div></div></section></main>
712
712
  </div>
713
713
  </foreignObject>
714
714
  </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signalsafe/tree-spec-editor-react",
3
- "version": "0.3.6",
3
+ "version": "0.3.8",
4
4
  "type": "module",
5
5
  "description": "UI-kit agnostic React Flow canvas for the SignalSafe TreeSpec graph editor (no UI library).",
6
6
  "license": "MIT",
@@ -64,8 +64,8 @@
64
64
  "test:monorepo": "cd ../../frontend && yarn vitest run --config vitest.tree-spec-editor-react.config.ts"
65
65
  },
66
66
  "dependencies": {
67
- "@signalsafe/tree-spec": "^0.4.5",
68
- "@signalsafe/tree-spec-editor-core": "^0.2.6"
67
+ "@signalsafe/tree-spec": "^0.4.7",
68
+ "@signalsafe/tree-spec-editor-core": "^0.2.8"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "react": "^18.0.0 || ^19.3.1",