@coral-viz/viz 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (191) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +11 -0
  3. package/dist/compatibility/CompatibilityEdge.d.ts +106 -0
  4. package/dist/compatibility/CompatibilityEdge.d.ts.map +1 -0
  5. package/dist/compatibility/CompatibilityEdge.js +233 -0
  6. package/dist/compatibility/CompatibilityEdge.js.map +1 -0
  7. package/dist/compatibility/IncompatibilityTooltip.d.ts +44 -0
  8. package/dist/compatibility/IncompatibilityTooltip.d.ts.map +1 -0
  9. package/dist/compatibility/IncompatibilityTooltip.js +145 -0
  10. package/dist/compatibility/IncompatibilityTooltip.js.map +1 -0
  11. package/dist/compatibility/index.d.ts +10 -0
  12. package/dist/compatibility/index.d.ts.map +1 -0
  13. package/dist/compatibility/index.js +10 -0
  14. package/dist/compatibility/index.js.map +1 -0
  15. package/dist/compatibility/useEdgeCompatibility.d.ts +82 -0
  16. package/dist/compatibility/useEdgeCompatibility.d.ts.map +1 -0
  17. package/dist/compatibility/useEdgeCompatibility.js +170 -0
  18. package/dist/compatibility/useEdgeCompatibility.js.map +1 -0
  19. package/dist/compatibility/validateConnection.d.ts +56 -0
  20. package/dist/compatibility/validateConnection.d.ts.map +1 -0
  21. package/dist/compatibility/validateConnection.js +382 -0
  22. package/dist/compatibility/validateConnection.js.map +1 -0
  23. package/dist/components/EditContext.d.ts +45 -0
  24. package/dist/components/EditContext.d.ts.map +1 -0
  25. package/dist/components/EditContext.js +41 -0
  26. package/dist/components/EditContext.js.map +1 -0
  27. package/dist/components/ShapeRenderer.d.ts +35 -0
  28. package/dist/components/ShapeRenderer.d.ts.map +1 -0
  29. package/dist/components/ShapeRenderer.js +77 -0
  30. package/dist/components/ShapeRenderer.js.map +1 -0
  31. package/dist/components/SymbolNode.d.ts +53 -0
  32. package/dist/components/SymbolNode.d.ts.map +1 -0
  33. package/dist/components/SymbolNode.js +333 -0
  34. package/dist/components/SymbolNode.js.map +1 -0
  35. package/dist/components/index.d.ts +8 -0
  36. package/dist/components/index.d.ts.map +1 -0
  37. package/dist/components/index.js +10 -0
  38. package/dist/components/index.js.map +1 -0
  39. package/dist/components/nodes.d.ts +43 -0
  40. package/dist/components/nodes.d.ts.map +1 -0
  41. package/dist/components/nodes.js +111 -0
  42. package/dist/components/nodes.js.map +1 -0
  43. package/dist/editor/CoralEditor.d.ts +29 -0
  44. package/dist/editor/CoralEditor.d.ts.map +1 -0
  45. package/dist/editor/CoralEditor.js +112 -0
  46. package/dist/editor/CoralEditor.js.map +1 -0
  47. package/dist/editor/FileControls.d.ts +34 -0
  48. package/dist/editor/FileControls.d.ts.map +1 -0
  49. package/dist/editor/FileControls.js +139 -0
  50. package/dist/editor/FileControls.js.map +1 -0
  51. package/dist/editor/LayoutControls.d.ts +41 -0
  52. package/dist/editor/LayoutControls.d.ts.map +1 -0
  53. package/dist/editor/LayoutControls.js +124 -0
  54. package/dist/editor/LayoutControls.js.map +1 -0
  55. package/dist/editor/converter.d.ts +37 -0
  56. package/dist/editor/converter.d.ts.map +1 -0
  57. package/dist/editor/converter.js +256 -0
  58. package/dist/editor/converter.js.map +1 -0
  59. package/dist/editor/index.d.ts +8 -0
  60. package/dist/editor/index.d.ts.map +1 -0
  61. package/dist/editor/index.js +8 -0
  62. package/dist/editor/index.js.map +1 -0
  63. package/dist/file/deserialize.d.ts +15 -0
  64. package/dist/file/deserialize.d.ts.map +1 -0
  65. package/dist/file/deserialize.js +145 -0
  66. package/dist/file/deserialize.js.map +1 -0
  67. package/dist/file/index.d.ts +15 -0
  68. package/dist/file/index.d.ts.map +1 -0
  69. package/dist/file/index.js +20 -0
  70. package/dist/file/index.js.map +1 -0
  71. package/dist/file/migrate.d.ts +29 -0
  72. package/dist/file/migrate.d.ts.map +1 -0
  73. package/dist/file/migrate.js +103 -0
  74. package/dist/file/migrate.js.map +1 -0
  75. package/dist/file/schema.d.ts +385 -0
  76. package/dist/file/schema.d.ts.map +1 -0
  77. package/dist/file/schema.js +180 -0
  78. package/dist/file/schema.js.map +1 -0
  79. package/dist/file/serialize.d.ts +30 -0
  80. package/dist/file/serialize.d.ts.map +1 -0
  81. package/dist/file/serialize.js +218 -0
  82. package/dist/file/serialize.js.map +1 -0
  83. package/dist/file/validate.d.ts +21 -0
  84. package/dist/file/validate.d.ts.map +1 -0
  85. package/dist/file/validate.js +165 -0
  86. package/dist/file/validate.js.map +1 -0
  87. package/dist/index.d.ts +24 -0
  88. package/dist/index.d.ts.map +1 -0
  89. package/dist/index.js +42 -0
  90. package/dist/index.js.map +1 -0
  91. package/dist/layout/elk.d.ts +77 -0
  92. package/dist/layout/elk.d.ts.map +1 -0
  93. package/dist/layout/elk.js +379 -0
  94. package/dist/layout/elk.js.map +1 -0
  95. package/dist/layout/index.d.ts +12 -0
  96. package/dist/layout/index.d.ts.map +1 -0
  97. package/dist/layout/index.js +12 -0
  98. package/dist/layout/index.js.map +1 -0
  99. package/dist/layout/nodeSizing.d.ts +65 -0
  100. package/dist/layout/nodeSizing.d.ts.map +1 -0
  101. package/dist/layout/nodeSizing.js +319 -0
  102. package/dist/layout/nodeSizing.js.map +1 -0
  103. package/dist/layout/positionStability.d.ts +73 -0
  104. package/dist/layout/positionStability.d.ts.map +1 -0
  105. package/dist/layout/positionStability.js +199 -0
  106. package/dist/layout/positionStability.js.map +1 -0
  107. package/dist/layout/useAxisConstrain.d.ts +20 -0
  108. package/dist/layout/useAxisConstrain.d.ts.map +1 -0
  109. package/dist/layout/useAxisConstrain.js +106 -0
  110. package/dist/layout/useAxisConstrain.js.map +1 -0
  111. package/dist/layout/useDiagramState.d.ts +92 -0
  112. package/dist/layout/useDiagramState.d.ts.map +1 -0
  113. package/dist/layout/useDiagramState.js +256 -0
  114. package/dist/layout/useDiagramState.js.map +1 -0
  115. package/dist/layout/useLayoutHistory.d.ts +53 -0
  116. package/dist/layout/useLayoutHistory.d.ts.map +1 -0
  117. package/dist/layout/useLayoutHistory.js +124 -0
  118. package/dist/layout/useLayoutHistory.js.map +1 -0
  119. package/dist/properties/NodePropertiesPanel.d.ts +47 -0
  120. package/dist/properties/NodePropertiesPanel.d.ts.map +1 -0
  121. package/dist/properties/NodePropertiesPanel.js +199 -0
  122. package/dist/properties/NodePropertiesPanel.js.map +1 -0
  123. package/dist/properties/index.d.ts +10 -0
  124. package/dist/properties/index.d.ts.map +1 -0
  125. package/dist/properties/index.js +10 -0
  126. package/dist/properties/index.js.map +1 -0
  127. package/dist/properties/propertyUtils.d.ts +60 -0
  128. package/dist/properties/propertyUtils.d.ts.map +1 -0
  129. package/dist/properties/propertyUtils.js +89 -0
  130. package/dist/properties/propertyUtils.js.map +1 -0
  131. package/dist/settings/FontSettingsForm.d.ts +28 -0
  132. package/dist/settings/FontSettingsForm.d.ts.map +1 -0
  133. package/dist/settings/FontSettingsForm.js +129 -0
  134. package/dist/settings/FontSettingsForm.js.map +1 -0
  135. package/dist/settings/LayoutSettingsForm.d.ts +37 -0
  136. package/dist/settings/LayoutSettingsForm.d.ts.map +1 -0
  137. package/dist/settings/LayoutSettingsForm.js +165 -0
  138. package/dist/settings/LayoutSettingsForm.js.map +1 -0
  139. package/dist/settings/SettingsPanel.d.ts +55 -0
  140. package/dist/settings/SettingsPanel.d.ts.map +1 -0
  141. package/dist/settings/SettingsPanel.js +84 -0
  142. package/dist/settings/SettingsPanel.js.map +1 -0
  143. package/dist/settings/index.d.ts +13 -0
  144. package/dist/settings/index.d.ts.map +1 -0
  145. package/dist/settings/index.js +13 -0
  146. package/dist/settings/index.js.map +1 -0
  147. package/dist/settings/useSettings.d.ts +51 -0
  148. package/dist/settings/useSettings.d.ts.map +1 -0
  149. package/dist/settings/useSettings.js +154 -0
  150. package/dist/settings/useSettings.js.map +1 -0
  151. package/dist/text-editor/SplitEditor.d.ts +72 -0
  152. package/dist/text-editor/SplitEditor.d.ts.map +1 -0
  153. package/dist/text-editor/SplitEditor.js +172 -0
  154. package/dist/text-editor/SplitEditor.js.map +1 -0
  155. package/dist/text-editor/TextEditor.d.ts +53 -0
  156. package/dist/text-editor/TextEditor.d.ts.map +1 -0
  157. package/dist/text-editor/TextEditor.js +181 -0
  158. package/dist/text-editor/TextEditor.js.map +1 -0
  159. package/dist/text-editor/hooks/useBidirectionalSync.d.ts +106 -0
  160. package/dist/text-editor/hooks/useBidirectionalSync.d.ts.map +1 -0
  161. package/dist/text-editor/hooks/useBidirectionalSync.js +151 -0
  162. package/dist/text-editor/hooks/useBidirectionalSync.js.map +1 -0
  163. package/dist/text-editor/index.d.ts +9 -0
  164. package/dist/text-editor/index.d.ts.map +1 -0
  165. package/dist/text-editor/index.js +11 -0
  166. package/dist/text-editor/index.js.map +1 -0
  167. package/dist/types.d.ts +242 -0
  168. package/dist/types.d.ts.map +1 -0
  169. package/dist/types.js +5 -0
  170. package/dist/types.js.map +1 -0
  171. package/dist/waypoints/index.d.ts +8 -0
  172. package/dist/waypoints/index.d.ts.map +1 -0
  173. package/dist/waypoints/index.js +7 -0
  174. package/dist/waypoints/index.js.map +1 -0
  175. package/dist/waypoints/operations.d.ts +29 -0
  176. package/dist/waypoints/operations.d.ts.map +1 -0
  177. package/dist/waypoints/operations.js +85 -0
  178. package/dist/waypoints/operations.js.map +1 -0
  179. package/dist/waypoints/router.d.ts +23 -0
  180. package/dist/waypoints/router.d.ts.map +1 -0
  181. package/dist/waypoints/router.js +109 -0
  182. package/dist/waypoints/router.js.map +1 -0
  183. package/dist/waypoints/types.d.ts +15 -0
  184. package/dist/waypoints/types.d.ts.map +1 -0
  185. package/dist/waypoints/types.js +5 -0
  186. package/dist/waypoints/types.js.map +1 -0
  187. package/dist/waypoints/useWaypointManager.d.ts +38 -0
  188. package/dist/waypoints/useWaypointManager.d.ts.map +1 -0
  189. package/dist/waypoints/useWaypointManager.js +106 -0
  190. package/dist/waypoints/useWaypointManager.js.map +1 -0
  191. package/package.json +76 -0
@@ -0,0 +1,53 @@
1
+ /**
2
+ * SymbolNode - React Flow node component that renders symbols
3
+ *
4
+ * This component looks up the symbol and shape from registries
5
+ * and renders them with proper styling and handles.
6
+ *
7
+ * Supports inline label editing via double-click.
8
+ */
9
+ import type { HandleDragState, CoralNodeData } from '../types.js';
10
+ export interface SymbolNodeData extends CoralNodeData {
11
+ /** Symbol ID (e.g., 'flowchart-process', 'arch-service') */
12
+ symbolId?: string;
13
+ /** Variant ID (e.g., 'start', 'end') */
14
+ variant?: string;
15
+ /** Override fill color */
16
+ fill?: string;
17
+ /** Override stroke color */
18
+ stroke?: string;
19
+ /** Override stroke width */
20
+ strokeWidth?: number;
21
+ /** Node width */
22
+ width?: number;
23
+ /** Node height */
24
+ height?: number;
25
+ /** Enable hand-drawn sketch rendering */
26
+ sketch?: boolean;
27
+ /**
28
+ * Live state of a connection gesture relative to this node, so its handles
29
+ * can show whether dropping here would be accepted (R-016).
30
+ */
31
+ dragState?: HandleDragState;
32
+ /** Live compatibility keyed by the concrete React Flow handle id. */
33
+ dragStates?: Record<string, HandleDragState>;
34
+ }
35
+ /**
36
+ * Props passed to SymbolNode by React Flow
37
+ */
38
+ interface SymbolNodeProps {
39
+ id: string;
40
+ data: SymbolNodeData;
41
+ selected?: boolean;
42
+ }
43
+ /**
44
+ * SymbolNode component - renders any symbol from the registry
45
+ *
46
+ * Supports inline label editing via double-click:
47
+ * - Double-click to edit the label
48
+ * - Press Enter or blur to save
49
+ * - Press Escape to cancel
50
+ */
51
+ export declare const SymbolNode: import("react").MemoExoticComponent<({ id, data, selected }: SymbolNodeProps) => import("react").JSX.Element>;
52
+ export default SymbolNode;
53
+ //# sourceMappingURL=SymbolNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SymbolNode.d.ts","sourceRoot":"","sources":["../../src/components/SymbolNode.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAQH,OAAO,KAAK,EACV,eAAe,EAAgC,aAAa,EAAE,MAAM,aAAa,CAAC;AAkBpF,MAAM,WAAW,cAAe,SAAQ,aAAa;IACnD,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yCAAyC;IACzC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,qEAAqE;IACrE,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC9C;AAED;;GAEG;AACH,UAAU,eAAe;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,cAAc,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAuHD;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,+DAAoD,eAAe,iCAqTxF,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,333 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * SymbolNode - React Flow node component that renders symbols
4
+ *
5
+ * This component looks up the symbol and shape from registries
6
+ * and renders them with proper styling and handles.
7
+ *
8
+ * Supports inline label editing via double-click.
9
+ */
10
+ import { memo, useMemo, useState, useCallback, useRef, useEffect } from 'react';
11
+ import { Handle, Position } from '@xyflow/react';
12
+ import { ShapeRenderer } from './ShapeRenderer.js';
13
+ import { symbolRegistry } from '@coral-viz/render';
14
+ import { shapeRegistry } from '@coral-viz/render';
15
+ import { useEditContext } from './EditContext.js';
16
+ /**
17
+ * Extended node data for symbol-aware rendering
18
+ */
19
+ /** Visually hidden, but announced. */
20
+ const SR_ONLY = {
21
+ position: 'absolute',
22
+ width: 1,
23
+ height: 1,
24
+ padding: 0,
25
+ margin: -1,
26
+ overflow: 'hidden',
27
+ clip: 'rect(0 0 0 0)',
28
+ whiteSpace: 'nowrap',
29
+ border: 0,
30
+ };
31
+ /**
32
+ * Map anchor direction to React Flow Position
33
+ */
34
+ function anchorToPosition(anchor) {
35
+ switch (anchor) {
36
+ case 'NORTH':
37
+ return Position.Top;
38
+ case 'SOUTH':
39
+ return Position.Bottom;
40
+ case 'EAST':
41
+ return Position.Right;
42
+ case 'WEST':
43
+ return Position.Left;
44
+ default:
45
+ return Position.Top;
46
+ }
47
+ }
48
+ /**
49
+ * Get port position offset based on port count and index
50
+ */
51
+ function getPortOffset(port, portIndex, totalPortsOnSide) {
52
+ if (port.position !== undefined) {
53
+ return `${port.position * 100}%`;
54
+ }
55
+ // Distribute ports evenly
56
+ const offset = ((portIndex + 1) / (totalPortsOnSide + 1)) * 100;
57
+ return `${offset}%`;
58
+ }
59
+ /**
60
+ * Get styling from symbol/variant defaults
61
+ */
62
+ function getSymbolStyle(symbol, variant) {
63
+ const defaultStyle = {
64
+ fill: '#ffffff',
65
+ stroke: '#666666',
66
+ strokeWidth: 2,
67
+ };
68
+ if (!symbol) {
69
+ return defaultStyle;
70
+ }
71
+ // Start with symbol defaults
72
+ const symbolDefaults = symbol.defaults || {};
73
+ let style = {
74
+ fill: symbolDefaults.fill || defaultStyle.fill,
75
+ stroke: symbolDefaults.stroke || defaultStyle.stroke,
76
+ strokeWidth: symbolDefaults.strokeWidth || defaultStyle.strokeWidth,
77
+ strokeDasharray: symbolDefaults.strokeDasharray,
78
+ };
79
+ // Apply variant overrides
80
+ if (variant && symbol.variants?.[variant]) {
81
+ const variantDefaults = symbol.variants[variant].defaults || {};
82
+ style = {
83
+ ...style,
84
+ fill: variantDefaults.fill || style.fill,
85
+ stroke: variantDefaults.stroke || style.stroke,
86
+ strokeWidth: variantDefaults.strokeWidth || style.strokeWidth,
87
+ strokeDasharray: variantDefaults.strokeDasharray || style.strokeDasharray,
88
+ };
89
+ }
90
+ return style;
91
+ }
92
+ /**
93
+ * Get ports to render from symbol definition
94
+ */
95
+ function getSymbolPorts(symbol, variant) {
96
+ if (!symbol) {
97
+ // Default ports
98
+ return [
99
+ { id: 'in', anchor: 'NORTH', direction: 'in' },
100
+ { id: 'out', anchor: 'SOUTH', direction: 'out' },
101
+ ];
102
+ }
103
+ // Check for variant-specific ports first
104
+ if (variant && symbol.variants?.[variant]?.ports) {
105
+ return symbol.variants[variant].ports;
106
+ }
107
+ // Fall back to symbol ports
108
+ if (symbol.ports && symbol.ports.length > 0) {
109
+ return symbol.ports;
110
+ }
111
+ // Default ports
112
+ return [
113
+ { id: 'in', anchor: 'NORTH', direction: 'in' },
114
+ { id: 'out', anchor: 'SOUTH', direction: 'out' },
115
+ ];
116
+ }
117
+ /**
118
+ * Fallback mapping from old node types to symbols
119
+ */
120
+ const legacyTypeMapping = {
121
+ service: 'arch-service',
122
+ database: 'arch-database',
123
+ module: 'flowchart-process',
124
+ external_api: 'arch-external-api',
125
+ actor: 'arch-actor',
126
+ group: 'arch-container',
127
+ process: 'flowchart-process',
128
+ decision: 'flowchart-decision',
129
+ terminal: 'flowchart-terminal',
130
+ io: 'flowchart-io',
131
+ document: 'flowchart-document',
132
+ };
133
+ /**
134
+ * SymbolNode component - renders any symbol from the registry
135
+ *
136
+ * Supports inline label editing via double-click:
137
+ * - Double-click to edit the label
138
+ * - Press Enter or blur to save
139
+ * - Press Escape to cancel
140
+ */
141
+ export const SymbolNode = memo(function SymbolNode({ id, data, selected }) {
142
+ // Edit context for label editing
143
+ const { onLabelEdit, editingNodeId, startEditing, stopEditing } = useEditContext();
144
+ const isEditing = editingNodeId === id;
145
+ // Local state for edit value
146
+ const [editValue, setEditValue] = useState(data.label);
147
+ const inputRef = useRef(null);
148
+ // Resolve symbol ID (support legacy types)
149
+ const symbolId = data.symbolId || legacyTypeMapping[data.nodeType] || 'flowchart-process';
150
+ // Look up symbol and shape
151
+ const symbol = symbolRegistry.get(symbolId);
152
+ const shape = symbol ? shapeRegistry.get(symbol.shape) : shapeRegistry.get('rectangle');
153
+ // Get styling
154
+ const baseStyle = getSymbolStyle(symbol, data.variant);
155
+ const style = {
156
+ fill: data.fill || baseStyle.fill,
157
+ stroke: data.stroke || baseStyle.stroke,
158
+ strokeWidth: data.strokeWidth || baseStyle.strokeWidth,
159
+ strokeDasharray: baseStyle.strokeDasharray,
160
+ };
161
+ // Get dimensions
162
+ const width = data.width || shape?.defaultSize?.width || 120;
163
+ const height = data.height || shape?.defaultSize?.height || 60;
164
+ // Get ports
165
+ const ports = getSymbolPorts(symbol, data.variant);
166
+ // Group ports by side for positioning
167
+ const portsBySide = useMemo(() => {
168
+ const grouped = {};
169
+ ports.forEach((port) => {
170
+ const side = port.anchor;
171
+ if (!grouped[side])
172
+ grouped[side] = [];
173
+ grouped[side].push(port);
174
+ });
175
+ return grouped;
176
+ }, [ports]);
177
+ // Focus input when editing starts
178
+ useEffect(() => {
179
+ if (isEditing && inputRef.current) {
180
+ inputRef.current.focus();
181
+ inputRef.current.select();
182
+ }
183
+ }, [isEditing]);
184
+ // Sync edit value when data.label changes (external updates)
185
+ useEffect(() => {
186
+ if (!isEditing) {
187
+ setEditValue(data.label);
188
+ }
189
+ }, [data.label, isEditing]);
190
+ // Handle double-click to start editing
191
+ const handleDoubleClick = useCallback((e) => {
192
+ e.stopPropagation(); // Prevent React Flow from handling
193
+ setEditValue(data.label);
194
+ startEditing(id);
195
+ }, [id, data.label, startEditing]);
196
+ // Handle save (Enter or blur)
197
+ const handleSave = useCallback(() => {
198
+ if (editValue.trim() !== data.label && onLabelEdit) {
199
+ onLabelEdit(id, editValue.trim());
200
+ }
201
+ stopEditing();
202
+ }, [id, editValue, data.label, onLabelEdit, stopEditing]);
203
+ // Handle cancel (Escape)
204
+ const handleCancel = useCallback(() => {
205
+ setEditValue(data.label);
206
+ stopEditing();
207
+ }, [data.label, stopEditing]);
208
+ // Handle key down events
209
+ const handleKeyDown = useCallback((e) => {
210
+ if (e.key === 'Enter') {
211
+ e.preventDefault();
212
+ handleSave();
213
+ }
214
+ else if (e.key === 'Escape') {
215
+ e.preventDefault();
216
+ handleCancel();
217
+ }
218
+ }, [handleSave, handleCancel]);
219
+ // Accessible name and state (R-014). Nodes carried no ARIA at all, so a
220
+ // screen reader announced an unlabelled group of divs.
221
+ const kindName = symbol?.name ?? data.symbolId ?? data.nodeType ?? 'node';
222
+ const accessibleName = `${data.label ?? id}, ${kindName}`;
223
+ const dragDescription = data.dragState === 'compatible'
224
+ ? 'can connect here'
225
+ : data.dragState === 'warning'
226
+ ? 'can connect here with a warning'
227
+ : data.dragState === 'incompatible'
228
+ ? 'cannot connect here'
229
+ : undefined;
230
+ return (_jsxs("div", { role: "group", "aria-label": accessibleName, "aria-selected": selected, "aria-describedby": dragDescription ? `${id}-drag-state` : undefined, tabIndex: 0, style: {
231
+ position: 'relative',
232
+ width,
233
+ height,
234
+ cursor: isEditing ? 'text' : 'grab',
235
+ }, onDoubleClick: handleDoubleClick, children: [dragDescription && (_jsx("span", { id: `${id}-drag-state`, style: SR_ONLY, children: dragDescription })), shape && (_jsx("div", { style: {
236
+ position: 'absolute',
237
+ top: 0,
238
+ left: 0,
239
+ width: '100%',
240
+ height: '100%',
241
+ }, children: _jsx(ShapeRenderer, { shape: shape, width: width, height: height, fill: style.fill, stroke: selected ? '#0066ff' : style.stroke, strokeWidth: selected ? style.strokeWidth + 1 : style.strokeWidth, strokeDasharray: style.strokeDasharray, parameters: symbol?.defaults, sketch: data.sketch }) })), _jsx("div", { style: {
242
+ position: 'absolute',
243
+ top: 0,
244
+ left: 0,
245
+ width: '100%',
246
+ height: '100%',
247
+ display: 'flex',
248
+ alignItems: 'center',
249
+ justifyContent: 'center',
250
+ padding: '8px',
251
+ boxSizing: 'border-box',
252
+ }, children: isEditing ? (_jsx("input", { ref: inputRef, type: "text", value: editValue, onChange: (e) => setEditValue(e.target.value), onBlur: handleSave, onKeyDown: handleKeyDown, style: {
253
+ fontSize: '12px',
254
+ fontWeight: 500,
255
+ textAlign: 'center',
256
+ width: '100%',
257
+ maxWidth: '100%',
258
+ padding: '2px 4px',
259
+ border: '1px solid #0066ff',
260
+ borderRadius: '2px',
261
+ outline: 'none',
262
+ background: 'white',
263
+ } })) : (_jsx("div", { style: {
264
+ fontSize: data.sketch ? '14px' : '12px',
265
+ fontWeight: 500,
266
+ fontFamily: data.sketch ? "'Caveat', 'Comic Sans MS', cursive" : undefined,
267
+ textAlign: 'center',
268
+ wordWrap: 'break-word',
269
+ maxWidth: '100%',
270
+ overflow: 'hidden',
271
+ textOverflow: 'ellipsis',
272
+ }, children: data.label })) }), ports.map((port, idx) => {
273
+ const portsOnSide = portsBySide[port.anchor] || [];
274
+ const indexOnSide = portsOnSide.indexOf(port);
275
+ const offset = getPortOffset(port, indexOnSide, portsOnSide.length);
276
+ const position = anchorToPosition(port.anchor);
277
+ const isVertical = position === Position.Top || position === Position.Bottom;
278
+ const handleStyle = {
279
+ position: 'absolute',
280
+ ...(isVertical
281
+ ? { left: offset, transform: 'translateX(-50%)' }
282
+ : { top: offset, transform: 'translateY(-50%)' }),
283
+ };
284
+ // While a connection is being dragged, handles say whether dropping
285
+ // here would be accepted. Idle handles keep the neutral colour.
286
+ const targetHandleId = port.direction === 'inout' ? `${port.id}-in` : port.id;
287
+ const sourceHandleId = port.direction === 'inout' ? `${port.id}-out` : port.id;
288
+ const stateFor = (handleId) => data.dragStates?.[handleId] ?? data.dragState ?? 'idle';
289
+ const dragState = stateFor(port.direction === 'out' ? sourceHandleId : targetHandleId);
290
+ const handleFill = dragState === 'compatible'
291
+ ? '#22c55e'
292
+ : dragState === 'warning'
293
+ ? '#f59e0b'
294
+ : dragState === 'incompatible'
295
+ ? '#ef4444'
296
+ : '#555';
297
+ const handleSize = dragState === 'idle' ? 8 : 12;
298
+ const handleVisual = {
299
+ background: handleFill,
300
+ width: handleSize,
301
+ height: handleSize,
302
+ ...(dragState === 'incompatible' ? { cursor: 'not-allowed' } : {}),
303
+ };
304
+ // Handle type based on direction
305
+ const handleType = port.direction === 'in'
306
+ ? 'target'
307
+ : port.direction === 'out'
308
+ ? 'source'
309
+ : undefined; // inout gets both
310
+ if (port.direction === 'inout') {
311
+ // Render both source and target for bidirectional ports
312
+ return (_jsxs("div", { children: [_jsx(Handle, { type: "target", position: position, id: `${port.id}-in`, "aria-label": `${port.label ?? port.id}: ${stateFor(targetHandleId)}`, style: {
313
+ ...handleStyle,
314
+ ...handleVisual,
315
+ background: stateFor(targetHandleId) === 'compatible' ? '#22c55e'
316
+ : stateFor(targetHandleId) === 'warning' ? '#f59e0b'
317
+ : stateFor(targetHandleId) === 'incompatible' ? '#ef4444' : '#555',
318
+ } }), _jsx(Handle, { type: "source", position: position, id: `${port.id}-out`, "aria-label": `${port.label ?? port.id}: ${stateFor(sourceHandleId)}`, style: {
319
+ ...handleStyle,
320
+ ...handleVisual,
321
+ background: stateFor(sourceHandleId) === 'compatible' ? '#22c55e'
322
+ : stateFor(sourceHandleId) === 'warning' ? '#f59e0b'
323
+ : stateFor(sourceHandleId) === 'incompatible' ? '#ef4444' : '#555',
324
+ } })] }, port.id));
325
+ }
326
+ return (_jsx(Handle, { type: handleType, position: position, id: port.id, "aria-label": `${port.label ?? port.id}: ${dragState}`, style: {
327
+ ...handleStyle,
328
+ ...handleVisual,
329
+ } }, port.id));
330
+ })] }));
331
+ });
332
+ export default SymbolNode;
333
+ //# sourceMappingURL=SymbolNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SymbolNode.js","sourceRoot":"","sources":["../../src/components/SymbolNode.tsx"],"names":[],"mappings":";AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjD,O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C;YACJ,CAAC,CAAC,IACE,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Coral Node Components
3
+ */
4
+ export { ServiceNode, DatabaseNode, ExternalApiNode, ActorNode, ModuleNode, GroupNode, nodeTypes, } from './nodes.js';
5
+ export { ShapeRenderer, type ShapeRendererProps } from './ShapeRenderer.js';
6
+ export { SymbolNode, type SymbolNodeData } from './SymbolNode.js';
7
+ export { EditProvider, useEditContext, useIsEditing, type EditProviderProps, type OnLabelEditCallback, } from './EditContext.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,GACV,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGlE,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Coral Node Components
3
+ */
4
+ export { ServiceNode, DatabaseNode, ExternalApiNode, ActorNode, ModuleNode, GroupNode, nodeTypes, } from './nodes.js';
5
+ // New symbol-aware components
6
+ export { ShapeRenderer } from './ShapeRenderer.js';
7
+ export { SymbolNode } from './SymbolNode.js';
8
+ // Edit context for inline label editing
9
+ export { EditProvider, useEditContext, useIsEditing, } from './EditContext.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,GACV,MAAM,YAAY,CAAC;AAEpB,8BAA8B;AAC9B,OAAO,EAAE,aAAa,EAA2B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAuB,MAAM,iBAAiB,CAAC;AAElE,wCAAwC;AACxC,OAAO,EACL,YAAY,EACZ,cAAc,EACd,YAAY,GAGb,MAAM,kBAAkB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Custom Node Components for Coral Editor
3
+ *
4
+ * Each node type gets a distinct visual style.
5
+ */
6
+ import React from 'react';
7
+ import type { CoralNodeProps } from '../types.js';
8
+ /**
9
+ * Service Node - rectangular with rounded corners
10
+ */
11
+ export declare const ServiceNode: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
12
+ /**
13
+ * Database Node - cylinder-like appearance
14
+ */
15
+ export declare const DatabaseNode: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
16
+ /**
17
+ * External API Node - cloud-like appearance
18
+ */
19
+ export declare const ExternalApiNode: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
20
+ /**
21
+ * Actor Node - stick figure / person shape
22
+ */
23
+ export declare const ActorNode: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
24
+ /**
25
+ * Module Node - smaller, component-like
26
+ */
27
+ export declare const ModuleNode: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
28
+ /**
29
+ * Group Node - container for other nodes
30
+ */
31
+ export declare const GroupNode: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
32
+ /**
33
+ * Node type registry for React Flow
34
+ */
35
+ export declare const nodeTypes: {
36
+ coralService: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
37
+ coralDatabase: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
38
+ coralExternalApi: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
39
+ coralActor: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
40
+ coralModule: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
41
+ coralGroup: React.MemoExoticComponent<({ data, selected }: CoralNodeProps) => React.JSX.Element>;
42
+ };
43
+ //# sourceMappingURL=nodes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/components/nodes.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAe,MAAM,OAAO,CAAC;AAEpC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAmClD;;GAEG;AACH,eAAO,MAAM,WAAW,iDAA6B,cAAc,uBAkBjE,CAAC;AAGH;;GAEG;AACH,eAAO,MAAM,YAAY,iDAA6B,cAAc,uBA4BlE,CAAC;AAGH;;GAEG;AACH,eAAO,MAAM,eAAe,iDAA6B,cAAc,uBAerE,CAAC;AAGH;;GAEG;AACH,eAAO,MAAM,SAAS,iDAA6B,cAAc,uBAqB/D,CAAC;AAGH;;GAEG;AACH,eAAO,MAAM,UAAU,iDAA6B,cAAc,uBAehE,CAAC;AAGH;;GAEG;AACH,eAAO,MAAM,SAAS,iDAA6B,cAAc,uBA8B/D,CAAC;AAGH;;GAEG;AACH,eAAO,MAAM,SAAS;iEAnK+B,cAAc;kEAwBb,cAAc;qEAkCX,cAAc;+DAqBpB,cAAc;gEA2Bb,cAAc;+DAqBf,cAAc;CA2ChE,CAAC"}
@@ -0,0 +1,111 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Custom Node Components for Coral Editor
4
+ *
5
+ * Each node type gets a distinct visual style.
6
+ */
7
+ import { memo } from 'react';
8
+ import { Handle, Position } from '@xyflow/react';
9
+ const NodeWrapper = ({ children, selected, className = '', style = {}, }) => (_jsx("div", { className: `coral-node ${className} ${selected ? 'selected' : ''}`, style: {
10
+ padding: '10px 15px',
11
+ borderRadius: '4px',
12
+ border: selected ? '2px solid #1a73e8' : '1px solid #ccc',
13
+ backgroundColor: '#fff',
14
+ boxShadow: selected ? '0 0 0 2px rgba(26, 115, 232, 0.2)' : '0 1px 3px rgba(0,0,0,0.1)',
15
+ minWidth: '100px',
16
+ textAlign: 'center',
17
+ ...style,
18
+ }, children: children }));
19
+ /**
20
+ * Service Node - rectangular with rounded corners
21
+ */
22
+ export const ServiceNode = memo(({ data, selected }) => (_jsxs(NodeWrapper, { selected: selected, className: "coral-node-service", style: {
23
+ backgroundColor: '#e3f2fd',
24
+ borderColor: selected ? '#1a73e8' : '#90caf9',
25
+ }, children: [_jsx(Handle, { type: "target", position: Position.Top }), _jsx("div", { style: { fontWeight: 500 }, children: data.label }), data.description && (_jsx("div", { style: { fontSize: '11px', color: '#666', marginTop: '4px' }, children: data.description })), _jsx(Handle, { type: "source", position: Position.Bottom })] })));
26
+ ServiceNode.displayName = 'ServiceNode';
27
+ /**
28
+ * Database Node - cylinder-like appearance
29
+ */
30
+ export const DatabaseNode = memo(({ data, selected }) => (_jsxs(NodeWrapper, { selected: selected, className: "coral-node-database", style: {
31
+ backgroundColor: '#fff3e0',
32
+ borderColor: selected ? '#1a73e8' : '#ffb74d',
33
+ borderRadius: '8px',
34
+ position: 'relative',
35
+ }, children: [_jsx(Handle, { type: "target", position: Position.Top }), _jsx("div", { style: {
36
+ position: 'absolute',
37
+ top: '-8px',
38
+ left: '10%',
39
+ right: '10%',
40
+ height: '16px',
41
+ backgroundColor: '#fff3e0',
42
+ borderRadius: '50%',
43
+ border: selected ? '2px solid #1a73e8' : '1px solid #ffb74d',
44
+ borderBottom: 'none',
45
+ } }), _jsx("div", { style: { fontWeight: 500, marginTop: '8px' }, children: data.label }), _jsx(Handle, { type: "source", position: Position.Bottom })] })));
46
+ DatabaseNode.displayName = 'DatabaseNode';
47
+ /**
48
+ * External API Node - cloud-like appearance
49
+ */
50
+ export const ExternalApiNode = memo(({ data, selected }) => (_jsxs(NodeWrapper, { selected: selected, className: "coral-node-external-api", style: {
51
+ backgroundColor: '#fce4ec',
52
+ borderColor: selected ? '#1a73e8' : '#f48fb1',
53
+ borderStyle: 'dashed',
54
+ }, children: [_jsx(Handle, { type: "target", position: Position.Top }), _jsx("div", { style: { fontWeight: 500 }, children: data.label }), _jsx("div", { style: { fontSize: '10px', color: '#888' }, children: "External" }), _jsx(Handle, { type: "source", position: Position.Bottom })] })));
55
+ ExternalApiNode.displayName = 'ExternalApiNode';
56
+ /**
57
+ * Actor Node - stick figure / person shape
58
+ */
59
+ export const ActorNode = memo(({ data, selected }) => (_jsxs(NodeWrapper, { selected: selected, className: "coral-node-actor", style: {
60
+ backgroundColor: '#e8f5e9',
61
+ borderColor: selected ? '#1a73e8' : '#81c784',
62
+ borderRadius: '50%',
63
+ width: '80px',
64
+ height: '80px',
65
+ display: 'flex',
66
+ flexDirection: 'column',
67
+ alignItems: 'center',
68
+ justifyContent: 'center',
69
+ }, children: [_jsx(Handle, { type: "target", position: Position.Top }), _jsx("div", { style: { fontSize: '24px' }, children: "\uD83D\uDC64" }), _jsx("div", { style: { fontWeight: 500, fontSize: '12px' }, children: data.label }), _jsx(Handle, { type: "source", position: Position.Bottom })] })));
70
+ ActorNode.displayName = 'ActorNode';
71
+ /**
72
+ * Module Node - smaller, component-like
73
+ */
74
+ export const ModuleNode = memo(({ data, selected }) => (_jsxs(NodeWrapper, { selected: selected, className: "coral-node-module", style: {
75
+ backgroundColor: '#f3e5f5',
76
+ borderColor: selected ? '#1a73e8' : '#ce93d8',
77
+ padding: '6px 12px',
78
+ fontSize: '13px',
79
+ }, children: [_jsx(Handle, { type: "target", position: Position.Top }), _jsx("div", { style: { fontWeight: 500 }, children: data.label }), _jsx(Handle, { type: "source", position: Position.Bottom })] })));
80
+ ModuleNode.displayName = 'ModuleNode';
81
+ /**
82
+ * Group Node - container for other nodes
83
+ */
84
+ export const GroupNode = memo(({ data, selected }) => (_jsxs("div", { className: `coral-node-group ${selected ? 'selected' : ''}`, style: {
85
+ padding: '10px',
86
+ borderRadius: '8px',
87
+ border: selected ? '2px dashed #1a73e8' : '2px dashed #bdbdbd',
88
+ backgroundColor: 'rgba(245, 245, 245, 0.5)',
89
+ minWidth: '200px',
90
+ minHeight: '150px',
91
+ }, children: [_jsx("div", { style: {
92
+ fontWeight: 600,
93
+ fontSize: '14px',
94
+ color: '#616161',
95
+ marginBottom: '10px',
96
+ paddingBottom: '5px',
97
+ borderBottom: '1px solid #e0e0e0',
98
+ }, children: data.label }), data.childCount !== undefined && data.childCount > 0 && (_jsxs("div", { style: { fontSize: '11px', color: '#9e9e9e' }, children: [data.childCount, " items"] }))] })));
99
+ GroupNode.displayName = 'GroupNode';
100
+ /**
101
+ * Node type registry for React Flow
102
+ */
103
+ export const nodeTypes = {
104
+ coralService: ServiceNode,
105
+ coralDatabase: DatabaseNode,
106
+ coralExternalApi: ExternalApiNode,
107
+ coralActor: ActorNode,
108
+ coralModule: ModuleNode,
109
+ coralGroup: GroupNode,
110
+ };
111
+ //# sourceMappingURL=nodes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes.js","sourceRoot":"","sources":["../../src/components/nodes.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAajD,MAAM,WAAW,GAA+B,CAAC,EAC/C,QAAQ,EACR,QAAQ,EACR,SAAS,GAAG,EAAE,EACd,KAAK,GAAG,EAAE,GACX,EAAE,EAAE,CAAC,CACJ,cACE,SAAS,EAAE,cAAc,SAAS,IAAI,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAA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AAE,OAAO;KACnB,aAED,cACE,KAAK,EAAE;gBACL,UAAU,EAAE,GAAG;gBACf,QAAQ,EAAE,MAAM;gBAChB,KAAK,EAAE,SAAS;gBAChB,YAAY,EAAE,MAAM;gBACpB,aAAa,EAAE,KAAK;gBACpB,YAAY,EAAE,mBAAmB;aAClC,YAEA,IAAI,CAAC,KAAK,GACP,EACL,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CACvD,eAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,aAC/C,IAAI,CAAC,UAAU,cACZ,CACP,IACG,CACP,CAAC,CAAC;AACH,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,YAAY,EAAE,WAAW;IACzB,aAAa,EAAE,YAAY;IAC3B,gBAAgB,EAAE,eAAe;IACjC,UAAU,EAAE,SAAS;IACrB,WAAW,EAAE,UAAU;IACvB,UAAU,EAAE,SAAS;CACtB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * CoralEditor - Main visual editor component
3
+ *
4
+ * Renders Graph-IR as an interactive diagram using React Flow.
5
+ */
6
+ import React from 'react';
7
+ import type { GraphIR, CoralNode, CoralEdge, EditorConfig, EditorCallbacks } from '../types.js';
8
+ export interface CoralEditorProps {
9
+ /** Graph-IR data to render */
10
+ graph: GraphIR;
11
+ /** Editor configuration */
12
+ config?: EditorConfig;
13
+ /** Callbacks for editor events */
14
+ callbacks?: EditorCallbacks;
15
+ /** CSS class name for the container */
16
+ className?: string;
17
+ /** Inline styles for the container */
18
+ style?: React.CSSProperties;
19
+ }
20
+ /**
21
+ * Main Coral Editor component
22
+ */
23
+ export declare const CoralEditor: React.FC<CoralEditorProps>;
24
+ /**
25
+ * Hook to get Graph-IR from current editor state
26
+ */
27
+ export declare function useGraphIR(nodes: CoralNode[], edges: CoralEdge[], originalGraph: GraphIR): GraphIR;
28
+ export default CoralEditor;
29
+ //# sourceMappingURL=CoralEditor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CoralEditor.d.ts","sourceRoot":"","sources":["../../src/editor/CoralEditor.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAyC,MAAM,OAAO,CAAC;AAiB9D,OAAO,KAAK,EACV,OAAO,EAGP,SAAS,EACT,SAAS,EACT,YAAY,EACZ,eAAe,EAChB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,gBAAgB;IAC/B,8BAA8B;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,2BAA2B;IAC3B,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,kCAAkC;IAClC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAaD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA0IlD,CAAC;AAEF;;GAEG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,EAAE,EAClB,KAAK,EAAE,SAAS,EAAE,EAClB,aAAa,EAAE,OAAO,GACrB,OAAO,CAWT;AAED,eAAe,WAAW,CAAC"}