@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,218 @@
1
+ /**
2
+ * Coral Document Serialization (CORAL-REQ-008)
3
+ *
4
+ * Converts React Flow nodes/edges to CoralDocument format.
5
+ */
6
+ import { CURRENT_SCHEMA_VERSION } from './schema.js';
7
+ /**
8
+ * Default layout settings
9
+ */
10
+ const DEFAULT_LAYOUT_SETTINGS = {
11
+ algorithm: 'layered',
12
+ direction: 'DOWN',
13
+ spacing: {
14
+ nodeNode: 50,
15
+ layerSpacing: 70,
16
+ },
17
+ };
18
+ /**
19
+ * Default document settings
20
+ */
21
+ const DEFAULT_SETTINGS = {
22
+ notation: 'flowchart',
23
+ layout: DEFAULT_LAYOUT_SETTINGS,
24
+ };
25
+ /**
26
+ * Create a new CoralDocument with default values
27
+ *
28
+ * @param options - Document creation options
29
+ * @returns New CoralDocument
30
+ */
31
+ export function createDocument(options) {
32
+ const now = new Date().toISOString();
33
+ const settings = {
34
+ ...options.settings,
35
+ notation: options.settings?.notation ?? DEFAULT_SETTINGS.notation,
36
+ layout: {
37
+ ...DEFAULT_LAYOUT_SETTINGS,
38
+ ...options.settings?.layout,
39
+ },
40
+ };
41
+ return {
42
+ schemaVersion: CURRENT_SCHEMA_VERSION,
43
+ metadata: {
44
+ name: options.name,
45
+ description: options.description,
46
+ tags: options.tags,
47
+ version: options.version,
48
+ created: now,
49
+ modified: now,
50
+ },
51
+ content: {
52
+ format: options.content?.format ?? 'graph-ir',
53
+ dslType: options.content?.dslType,
54
+ text: options.content?.text,
55
+ graphIR: options.content?.graphIR ?? {
56
+ version: '1.0.0',
57
+ id: 'untitled',
58
+ nodes: [],
59
+ edges: [],
60
+ },
61
+ },
62
+ settings,
63
+ viewState: options.viewState,
64
+ nodePositions: options.nodePositions,
65
+ };
66
+ }
67
+ /**
68
+ * Convert a CoralNode to a GraphNode
69
+ */
70
+ function nodeToGraphNode(node) {
71
+ const canonical = node.data.canonical;
72
+ return {
73
+ ...canonical,
74
+ id: node.id,
75
+ type: node.data.nodeType || node.type || 'default',
76
+ label: node.data.label,
77
+ description: node.data.description,
78
+ properties: node.data.properties,
79
+ parent: node.parentId ?? canonical?.parent,
80
+ position: { x: node.position.x, y: node.position.y },
81
+ ...(node.data.pinned !== undefined ? { pinned: node.data.pinned } : {}),
82
+ dimensions: (typeof node.width === 'number' && typeof node.height === 'number')
83
+ ? { width: node.width, height: node.height }
84
+ : canonical?.dimensions,
85
+ };
86
+ }
87
+ /**
88
+ * Convert a CoralEdge to a GraphEdge
89
+ */
90
+ function edgeToGraphEdge(edge) {
91
+ // Only use string labels (React nodes can't be serialized)
92
+ const label = edge.data?.label ?? (typeof edge.label === 'string' ? edge.label : undefined);
93
+ const lineStyle = edge.data?.lineStyle
94
+ ?? (edge.style?.strokeDasharray
95
+ ? (String(edge.style.strokeDasharray).includes('2') ? 'dotted' : 'dashed')
96
+ : undefined);
97
+ return {
98
+ ...edge.data?.canonical,
99
+ id: edge.id,
100
+ source: edge.source,
101
+ target: edge.target,
102
+ sourcePort: edge.sourceHandle ?? undefined,
103
+ targetPort: edge.targetHandle ?? undefined,
104
+ type: edge.data?.edgeType,
105
+ label,
106
+ properties: edge.data?.properties,
107
+ ...((lineStyle || edge.data?.canonical?.style)
108
+ ? { style: { ...edge.data?.canonical?.style, ...(lineStyle ? { lineStyle } : {}) } }
109
+ : {}),
110
+ routingPoints: edge.data?.routingPoints,
111
+ };
112
+ }
113
+ /**
114
+ * Extract node positions from CoralNodes
115
+ */
116
+ function extractNodePositions(nodes) {
117
+ const positions = {};
118
+ for (const node of nodes) {
119
+ if (node.position) {
120
+ positions[node.id] = {
121
+ x: node.position.x,
122
+ y: node.position.y,
123
+ };
124
+ }
125
+ }
126
+ return positions;
127
+ }
128
+ /**
129
+ * Serialize React Flow nodes and edges to a CoralDocument
130
+ *
131
+ * @param nodes - React Flow nodes
132
+ * @param edges - React Flow edges
133
+ * @param options - Serialization options
134
+ * @param waypointMap - Optional map of edge ID to waypoints (CORAL-REQ-015)
135
+ * @returns CoralDocument
136
+ */
137
+ export function serialize(nodes, edges, options, waypointMap) {
138
+ const now = new Date().toISOString();
139
+ const flatNodes = nodes.map(nodeToGraphNode);
140
+ const nodeIds = new Set(flatNodes.map((node) => node.id));
141
+ const byParent = new Map();
142
+ const topLevel = [];
143
+ for (const node of flatNodes) {
144
+ if (node.parent && nodeIds.has(node.parent)) {
145
+ const children = byParent.get(node.parent) ?? [];
146
+ children.push(node);
147
+ byParent.set(node.parent, children);
148
+ }
149
+ else {
150
+ topLevel.push(node);
151
+ }
152
+ }
153
+ const attachChildren = (node) => {
154
+ const children = byParent.get(node.id);
155
+ return children?.length
156
+ ? { ...node, children: children.map(attachChildren) }
157
+ : node;
158
+ };
159
+ const graphIR = {
160
+ ...options.graphIR,
161
+ version: options.graphIR?.version ?? '1.0.0',
162
+ id: options.graphIR?.id ?? options.name.toLowerCase().replace(/\s+/g, '-'),
163
+ name: options.graphIR?.name ?? options.name,
164
+ nodes: topLevel.map(attachChildren),
165
+ edges: edges.map(edgeToGraphEdge),
166
+ };
167
+ const settings = {
168
+ ...options.settings,
169
+ notation: options.settings?.notation ?? DEFAULT_SETTINGS.notation,
170
+ layout: {
171
+ ...DEFAULT_LAYOUT_SETTINGS,
172
+ ...options.settings?.layout,
173
+ },
174
+ };
175
+ // Build edge routing data from waypoints (CORAL-REQ-015)
176
+ let edgeRouting;
177
+ if (waypointMap && waypointMap.size > 0) {
178
+ edgeRouting = {};
179
+ for (const [edgeId, waypoints] of waypointMap) {
180
+ if (waypoints.length > 0) {
181
+ const graphEdge = graphIR.edges.find((edge) => edge.id === edgeId);
182
+ if (graphEdge) {
183
+ graphEdge.routingPoints = waypoints.map((wp) => ({ x: wp.x, y: wp.y }));
184
+ }
185
+ edgeRouting[edgeId] = {
186
+ bendPoints: waypoints.map((wp) => ({ x: wp.x, y: wp.y })),
187
+ isPinned: true,
188
+ waypoints: waypoints.map((wp) => ({
189
+ id: wp.id,
190
+ x: wp.x,
191
+ y: wp.y,
192
+ type: wp.type,
193
+ })),
194
+ };
195
+ }
196
+ }
197
+ }
198
+ return {
199
+ schemaVersion: CURRENT_SCHEMA_VERSION,
200
+ metadata: {
201
+ name: options.name,
202
+ description: options.description,
203
+ tags: options.tags,
204
+ version: options.version,
205
+ created: options.created ?? now,
206
+ modified: now,
207
+ },
208
+ content: {
209
+ format: 'graph-ir',
210
+ graphIR,
211
+ },
212
+ settings,
213
+ viewState: options.viewState,
214
+ nodePositions: extractNodePositions(nodes),
215
+ edgeRouting,
216
+ };
217
+ }
218
+ //# sourceMappingURL=serialize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"serialize.js","sourceRoot":"","sources":["../../src/file/serialize.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,MAAM,uBAAuB,GAAmB;IAC9C,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,MAAM;IACjB,OAAO,EAAE;QACP,QAAQ,EAAE,EAAE;QACZ,YAAY,EAAE,EAAE;KACjB;CACF,CAAC;AAEF;;GAEG;AACH,MAAM,gBAAgB,GAAqB;IACzC,QAAQ,EAAE,WAAW;IACrB,MAAM,EAAE,uBAAuB;CAChC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,OAA8B;IAC3D,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAErC,MAAM,QAAQ,GAAqB;QACjC,GAAG,OAAO,CAAC,QAAQ;QACnB,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,QAAQ,IAAI,gBAAgB,CAAC,QAAQ;QACjE,MAAM,EAAE;YACN,GAAG,uBAAuB;YAC1B,GAAG,OAAO,CAAC,QAAQ,EAAE,MAAM;SAC5B;KACF,CAAC;IAEF,OAAO;QACL,aAAa,EAAE,sBAAsB;QACrC,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,OA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P,IAAI,EAAE,EAAE,CAAC,IAAI;qBACd,CAAC,CAAC;iBACJ,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,aAAa,EAAE,sBAAsB;QACrC,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,GAAG;YAC/B,QAAQ,EAAE,GAAG;SACd;QACD,OAAO,EAAE;YACP,MAAM,EAAE,UAAU;YAClB,OAAO;SACR;QACD,QAAQ;QACR,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,aAAa,EAAE,oBAAoB,CAAC,KAAK,CAAC;QAC1C,WAAW;KACZ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Coral Document Validation (CORAL-REQ-008)
3
+ *
4
+ * Validates CoralDocument structure with helpful error messages.
5
+ */
6
+ import type { CoralDocument, ValidationResult } from './schema.js';
7
+ /**
8
+ * Validate a CoralDocument
9
+ *
10
+ * @param doc - Document to validate
11
+ * @returns Validation result with errors
12
+ */
13
+ export declare function validateDocument(doc: unknown): ValidationResult;
14
+ /**
15
+ * Assert that a document is valid, throwing if not
16
+ *
17
+ * @param doc - Document to validate
18
+ * @throws Error if document is invalid
19
+ */
20
+ export declare function assertValidDocument(doc: unknown): asserts doc is CoralDocument;
21
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/file/validate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAkBnE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAuI/D;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,GAAG,IAAI,aAAa,CAK9E"}
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Coral Document Validation (CORAL-REQ-008)
3
+ *
4
+ * Validates CoralDocument structure with helpful error messages.
5
+ */
6
+ import { SUPPORTED_SCHEMA_VERSIONS } from './schema.js';
7
+ /**
8
+ * Valid layout directions
9
+ */
10
+ const VALID_DIRECTIONS = ['UP', 'DOWN', 'LEFT', 'RIGHT'];
11
+ /**
12
+ * Valid content formats
13
+ */
14
+ const VALID_FORMATS = ['dsl', 'graph-ir'];
15
+ /**
16
+ * Valid DSL types
17
+ */
18
+ const VALID_DSL_TYPES = ['coral', 'mermaid', 'dot'];
19
+ /**
20
+ * Validate a CoralDocument
21
+ *
22
+ * @param doc - Document to validate
23
+ * @returns Validation result with errors
24
+ */
25
+ export function validateDocument(doc) {
26
+ const errors = [];
27
+ if (!doc || typeof doc !== 'object') {
28
+ return { valid: false, errors: ['Document must be an object'] };
29
+ }
30
+ const d = doc;
31
+ // Schema version
32
+ if (!d.schemaVersion || typeof d.schemaVersion !== 'string') {
33
+ errors.push('Missing or invalid schemaVersion');
34
+ }
35
+ else if (!SUPPORTED_SCHEMA_VERSIONS.includes(d.schemaVersion)) {
36
+ errors.push(`Unknown schemaVersion: ${d.schemaVersion}. Supported: ${SUPPORTED_SCHEMA_VERSIONS.join(', ')}`);
37
+ }
38
+ // Metadata
39
+ if (!d.metadata || typeof d.metadata !== 'object') {
40
+ errors.push('Missing or invalid metadata');
41
+ }
42
+ else {
43
+ const meta = d.metadata;
44
+ if (!meta.name || typeof meta.name !== 'string') {
45
+ errors.push('Missing or invalid metadata.name');
46
+ }
47
+ if (meta.created !== undefined && typeof meta.created !== 'string') {
48
+ errors.push('metadata.created must be a string');
49
+ }
50
+ if (meta.modified !== undefined && typeof meta.modified !== 'string') {
51
+ errors.push('metadata.modified must be a string');
52
+ }
53
+ if (meta.tags !== undefined && !Array.isArray(meta.tags)) {
54
+ errors.push('metadata.tags must be an array');
55
+ }
56
+ }
57
+ // Content
58
+ if (!d.content || typeof d.content !== 'object') {
59
+ errors.push('Missing or invalid content');
60
+ }
61
+ else {
62
+ const content = d.content;
63
+ if (!content.format || !VALID_FORMATS.includes(content.format)) {
64
+ errors.push(`content.format must be one of: ${VALID_FORMATS.join(', ')}`);
65
+ }
66
+ if (content.format === 'dsl') {
67
+ if (content.dslType && !VALID_DSL_TYPES.includes(content.dslType)) {
68
+ errors.push(`content.dslType must be one of: ${VALID_DSL_TYPES.join(', ')}`);
69
+ }
70
+ if (!content.text || typeof content.text !== 'string') {
71
+ errors.push('content.text is required when format is "dsl"');
72
+ }
73
+ }
74
+ if (content.format === 'graph-ir') {
75
+ if (content.graphIR !== undefined && typeof content.graphIR !== 'object') {
76
+ errors.push('content.graphIR must be an object');
77
+ }
78
+ }
79
+ }
80
+ // Settings
81
+ if (!d.settings || typeof d.settings !== 'object') {
82
+ errors.push('Missing or invalid settings');
83
+ }
84
+ else {
85
+ const settings = d.settings;
86
+ if (!settings.notation || typeof settings.notation !== 'string') {
87
+ errors.push('Missing or invalid settings.notation');
88
+ }
89
+ if (!settings.layout || typeof settings.layout !== 'object') {
90
+ errors.push('Missing or invalid settings.layout');
91
+ }
92
+ else {
93
+ const layout = settings.layout;
94
+ if (layout.direction !== undefined && !VALID_DIRECTIONS.includes(layout.direction)) {
95
+ errors.push(`settings.layout.direction must be one of: ${VALID_DIRECTIONS.join(', ')}`);
96
+ }
97
+ if (layout.spacing !== undefined && typeof layout.spacing !== 'object') {
98
+ errors.push('settings.layout.spacing must be an object');
99
+ }
100
+ if (layout.elkOptions !== undefined && typeof layout.elkOptions !== 'object') {
101
+ errors.push('settings.layout.elkOptions must be an object');
102
+ }
103
+ }
104
+ }
105
+ // View state (optional)
106
+ if (d.viewState !== undefined) {
107
+ if (typeof d.viewState !== 'object') {
108
+ errors.push('viewState must be an object');
109
+ }
110
+ else {
111
+ const vs = d.viewState;
112
+ if (vs.zoom !== undefined && typeof vs.zoom !== 'number') {
113
+ errors.push('viewState.zoom must be a number');
114
+ }
115
+ if (vs.pan !== undefined) {
116
+ if (typeof vs.pan !== 'object') {
117
+ errors.push('viewState.pan must be an object');
118
+ }
119
+ else {
120
+ const pan = vs.pan;
121
+ if (typeof pan.x !== 'number' || typeof pan.y !== 'number') {
122
+ errors.push('viewState.pan must have numeric x and y properties');
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ // Node positions (optional)
129
+ if (d.nodePositions !== undefined) {
130
+ if (typeof d.nodePositions !== 'object' || d.nodePositions === null) {
131
+ errors.push('nodePositions must be an object');
132
+ }
133
+ else {
134
+ const positions = d.nodePositions;
135
+ for (const [nodeId, pos] of Object.entries(positions)) {
136
+ if (typeof pos !== 'object' || pos === null) {
137
+ errors.push(`nodePositions.${nodeId} must be an object`);
138
+ }
139
+ else {
140
+ const p = pos;
141
+ if (typeof p.x !== 'number' || typeof p.y !== 'number') {
142
+ errors.push(`nodePositions.${nodeId} must have numeric x and y properties`);
143
+ }
144
+ }
145
+ }
146
+ }
147
+ }
148
+ return {
149
+ valid: errors.length === 0,
150
+ errors,
151
+ };
152
+ }
153
+ /**
154
+ * Assert that a document is valid, throwing if not
155
+ *
156
+ * @param doc - Document to validate
157
+ * @throws Error if document is invalid
158
+ */
159
+ export function assertValidDocument(doc) {
160
+ const result = validateDocument(doc);
161
+ if (!result.valid) {
162
+ throw new Error(`Invalid CoralDocument:\n${result.errors.join('\n')}`);
163
+ }
164
+ }
165
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/file/validate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD;;GAEG;AACH,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EA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 /**
2
+ * @coral-viz/viz - Coral Visual Diagram Editor
3
+ */
4
+ export { CoralEditor, useGraphIR, type CoralEditorProps } from './editor/index.js';
5
+ export { LayoutControls, type LayoutControlsProps } from './editor/index.js';
6
+ export { FileControls, type FileControlsProps } from './editor/index.js';
7
+ export { TextEditor, SplitEditor, useBidirectionalSync, type TextEditorProps, type SplitEditorProps, type SyntaxLanguage, type SplitLayout, type PrimaryPane, type SyncState, type SyncActions, type SyncOptions, type ParseFunction, type PrintFunction, type SyncParseResult, type SyncParseError, type ParseResult, type ParseError, type ChangeSource, } from './text-editor/index.js';
8
+ export { convertGraphToFlow, convertNode, convertEdge, flattenNodes, convertFlowToGraphNodes, convertFlowToGraphEdges, } from './editor/index.js';
9
+ export { ServiceNode, DatabaseNode, ExternalApiNode, ActorNode, ModuleNode, GroupNode, nodeTypes, ShapeRenderer, SymbolNode, type ShapeRendererProps, type SymbolNodeData, EditProvider, useEditContext, useIsEditing, type EditProviderProps, type OnLabelEditCallback, } from './components/index.js';
10
+ export { layoutGraph, layoutFlowNodes, layoutFlowNodesWithEdges, extractEdgeSections, getElk, type LayoutFlowResult, type ElkEdgeRouting, } from './layout/index.js';
11
+ export { useLayoutHistory, type PositionSnapshot, type UndoRedoResult, type UseLayoutHistoryOptions, type UseLayoutHistoryResult, } from './layout/index.js';
12
+ export { useAxisConstrain, type UseAxisConstrainResult, } from './layout/index.js';
13
+ export { diffGraphs, resolvePositions, incrementalLayout, } from './layout/index.js';
14
+ export { useDiagramState, type ParsedGraph, type DiagramNode, type DiagramEdge, type UseDiagramStateOptions, type UseDiagramStateResult, } from './layout/index.js';
15
+ export { shapeRegistry, getShape, getAllShapes, } from '@coral-viz/render';
16
+ export { symbolRegistry, getSymbol, getSymbolsByTag, getSymbolsForNotation, getAllSymbols, getAllLibraries, flowchartSymbols, bpmnSymbols, erdSymbols, codeSymbols, architectureSymbols, aimlSymbols, dataEngineeringSymbols, sketchSymbols, } from '@coral-viz/render';
17
+ export { notationRegistry, getNotation, getAllNotations, validateDiagram, flowchartNotation, bpmnNotation, erdNotation, codeNotation, architectureNotation, aimlNotation, dataEngineeringNotation, sketchNotation, } from '@coral-viz/render';
18
+ export { CURRENT_SCHEMA_VERSION, SUPPORTED_SCHEMA_VERSIONS, createDocument, serialize, deserialize, validateDocument, migrateDocument, needsMigration, getMigrationSteps, type CoralDocument, type DocumentMetadata, type DocumentContent, type DocumentSettings, type LayoutDirection, type LayoutSettings, type LayoutSpacing, type ViewState, type NodePosition, type DslType, type CreateDocumentOptions, type SerializeOptions, type DeserializeResult, type ValidationResult as FileValidationResult, type EdgeRouting, type LayoutAlgorithm, type LayoutPresetId, type LayoutPreset, type UserPreferences, type LLMProviderPreference, type SpeechRecognitionMode, type SettingsPanelState, DEFAULT_USER_PREFERENCES, DEFAULT_LAYOUT_SETTINGS, LAYOUT_PRESETS, getLayoutPreset, } from './file/index.js';
19
+ export { useSettings, type UseSettingsOptions, type UseSettingsResult, LayoutSettingsForm, type LayoutSettingsFormProps, SettingsPanel, type SettingsPanelProps, type SettingsPanelTheme, } from './settings/index.js';
20
+ export { validateConnection, checkPortDirection, checkMaxConnections, getEdgeCompatibility, useEdgeCompatibility, IncompatibilityTooltip, CompatibilityEdge, getEdgeStyleForStatus, buildRoutedPath, type UseEdgeCompatibilityOptions, type UseEdgeCompatibilityResult, type IncompatibilityTooltipProps, type CompatibilityEdgeProps, type CompatibilityEdgeData, } from './compatibility/index.js';
21
+ export { NodePropertiesPanel, type NodePropertiesPanelProps, type PropertyChange, detectPropertyType, isEditableProperty, parsePropertyValue, extractPropertyFields, type PropertyType, type PropertyValue, type PropertyFieldMeta, } from './properties/index.js';
22
+ export { createWaypoint, addWaypointToEdge, removeWaypointFromEdge, moveWaypoint, insertWaypointAtPosition, routeWithWaypoints, useWaypointManager, type EdgeWaypoint, type RoutedPath, type UseWaypointManagerOptions, type UseWaypointManagerResult, } from './waypoints/index.js';
23
+ export type { GraphIR, GraphNode, GraphEdge, Position, Dimensions, EdgeStyle, LayoutOptions, CoralNode, CoralEdge, CoralNodeData, CoralEdgeData, CoralNodeProps, EditorState, EditorCallbacks, EditorConfig, PortAnchor, ShapeParameter, ShapeDefinition, SymbolPort, SymbolVariant, SymbolDefinition, SymbolLibrary, NotationEdgeStyle, ConnectionConstraints, ConnectionRule, ValidationRule, FlowPoint, NotationValidation, NotationDefinition, ShapeRegistry, SymbolRegistry, NotationRegistry, ValidationResult, PositionSource, PositionedNode, GraphDiff, PositionResolution, DiffableNode, DiffableGraph, IncompatibilityReason, ConnectionValidation, ConnectionInfo, NodeConnectionInfo, EdgeCompatibilityStatus, EdgeCompatibility, HandleDragState, ConnectionValidationContext, } from './types.js';
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EACL,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EAEnB,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,YAAY,GAClB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC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,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,iBAAiB,GACvB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,EAClB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,GAC9B,MAAM,sBAAsB,CAAC;AAG9B,YAAY,EACV,OAAO,EACP,SAAS,EACT,SAAS,EACT,QAAQ,EACR,UAAU,EACV,SAAS,EACT,aAAa,EACb,SAAS,EACT,SAAS,EACT,aAAa,EACb,aAAa,EACb,cAAc,EACd,WAAW,EACX,eAAe,EACf,YAAY,EAEZ,UAAU,EACV,cAAc,EACd,eAAe,EACf,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAEhB,cAAc,EACd,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,YAAY,EACZ,aAAa,EAEb,qBAAqB,EACrB,oBAAoB,EACpB,cAAc,EACd,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,2BAA2B,GAC5B,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
1
+ /**
2
+ * @coral-viz/viz - Coral Visual Diagram Editor
3
+ */
4
+ // Main Editor
5
+ export { CoralEditor, useGraphIR } from './editor/index.js';
6
+ export { LayoutControls } from './editor/index.js';
7
+ export { FileControls } from './editor/index.js';
8
+ // Text Editor
9
+ export { TextEditor, SplitEditor, useBidirectionalSync, } from './text-editor/index.js';
10
+ // Converters
11
+ export { convertGraphToFlow, convertNode, convertEdge, flattenNodes, convertFlowToGraphNodes, convertFlowToGraphEdges, } from './editor/index.js';
12
+ // Components
13
+ export { ServiceNode, DatabaseNode, ExternalApiNode, ActorNode, ModuleNode, GroupNode, nodeTypes,
14
+ // New symbol-aware components
15
+ ShapeRenderer, SymbolNode,
16
+ // Edit context for inline label editing
17
+ EditProvider, useEditContext, useIsEditing, } from './components/index.js';
18
+ // Layout
19
+ export { layoutGraph, layoutFlowNodes, layoutFlowNodesWithEdges, extractEdgeSections, getElk, } from './layout/index.js';
20
+ export { useLayoutHistory, } from './layout/index.js';
21
+ // Axis Constraint (Shift+drag)
22
+ export { useAxisConstrain, } from './layout/index.js';
23
+ // Position Stability (CORAL-REQ-013)
24
+ export { diffGraphs, resolvePositions, incrementalLayout, } from './layout/index.js';
25
+ export { useDiagramState, } from './layout/index.js';
26
+ // Shapes, Symbols, Notations (Three-Layer Architecture)
27
+ export { shapeRegistry, getShape, getAllShapes, } from '@coral-viz/render';
28
+ export { symbolRegistry, getSymbol, getSymbolsByTag, getSymbolsForNotation, getAllSymbols, getAllLibraries, flowchartSymbols, bpmnSymbols, erdSymbols, codeSymbols, architectureSymbols, aimlSymbols, dataEngineeringSymbols, sketchSymbols, } from '@coral-viz/render';
29
+ export { notationRegistry, getNotation, getAllNotations, validateDiagram, flowchartNotation, bpmnNotation, erdNotation, codeNotation, architectureNotation, aimlNotation, dataEngineeringNotation, sketchNotation, } from '@coral-viz/render';
30
+ // File Format (CORAL-REQ-008)
31
+ export { CURRENT_SCHEMA_VERSION, SUPPORTED_SCHEMA_VERSIONS, createDocument, serialize, deserialize, validateDocument, migrateDocument, needsMigration, getMigrationSteps, DEFAULT_USER_PREFERENCES, DEFAULT_LAYOUT_SETTINGS, LAYOUT_PRESETS, getLayoutPreset, } from './file/index.js';
32
+ // Settings (CORAL-REQ-009)
33
+ export { useSettings, LayoutSettingsForm, SettingsPanel, } from './settings/index.js';
34
+ // Compatibility (CORAL-REQ-010)
35
+ export { validateConnection, checkPortDirection, checkMaxConnections, getEdgeCompatibility, useEdgeCompatibility, IncompatibilityTooltip, CompatibilityEdge, getEdgeStyleForStatus, buildRoutedPath, } from './compatibility/index.js';
36
+ // Properties Panel
37
+ export { NodePropertiesPanel,
38
+ // Utilities
39
+ detectPropertyType, isEditableProperty, parsePropertyValue, extractPropertyFields, } from './properties/index.js';
40
+ // Waypoints (CORAL-REQ-015)
41
+ export { createWaypoint, addWaypointToEdge, removeWaypointFromEdge, moveWaypoint, insertWaypointAtPosition, routeWithWaypoints, useWaypointManager, } from './waypoints/index.js';
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc;AACd,OAAO,EAAE,WAAW,EAAE,UAAU,EAAyB,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,cAAc,EAA4B,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,YAAY,EAA0B,MAAM,mBAAmB,CAAC;AAEzE,cAAc;AACd,OAAO,EACL,UAAU,EACV,WAAW,EACX,oBAAoB,GAiBrB,MAAM,wBAAwB,CAAC;AAEhC,aAAa;AACb,OAAO,EACL,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,YAAY,EACZ,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,mBAAmB,CAAC;AAE3B,aAAa;AACb,OAAO,EACL,WAAW,EACX,YAAY,EACZ,eAAe,EACf,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS;AACT,8BAA8B;AAC9B,aAAa,EACb,UAAU;AAGV,wCAAwC;AACxC,YAAY,EACZ,cAAc,EACd,YAAY,GAGb,MAAM,uBAAuB,CAAC;AAE/B,SAAS;AACT,OAAO,EACL,WAAW,EACX,eAAe,EACf,wBAAwB,EACxB,mBAAmB,EACnB,MAAM,GAGP,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,gBAAgB,GAKjB,MAAM,mBAAmB,CAAC;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,YAAY;AACZ,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,qBAAqB,GAItB,MAAM,uBAAuB,CAAC;AAE/B,4BAA4B;AAC5B,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,YAAY,EACZ,wBAAwB,EACxB,kBAAkB,EAClB,kBAAkB,GAKnB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * ELK Layout Integration
3
+ *
4
+ * Uses elkjs to compute automatic layouts for Graph-IR diagrams.
5
+ */
6
+ import type { ElkExtendedEdge } from 'elkjs';
7
+ import type { GraphIR, LayoutOptions, CoralNode, CoralEdge, SizingMode, Position } from '../types.js';
8
+ declare const elk: import("elkjs").ELK;
9
+ /**
10
+ * Layout a Graph-IR structure using ELK
11
+ *
12
+ * @param graph - The Graph-IR to layout
13
+ * @returns Graph-IR with positions computed for all nodes
14
+ */
15
+ export declare function layoutGraph(graph: GraphIR): Promise<GraphIR>;
16
+ /**
17
+ * Extended layout options including sizing (CORAL-REQ-011)
18
+ */
19
+ export interface LayoutFlowOptions extends LayoutOptions {
20
+ /** Node sizing mode */
21
+ sizingMode?: SizingMode;
22
+ /** Font size for text measurement */
23
+ fontSize?: number;
24
+ /** Font family for text measurement */
25
+ fontFamily?: string;
26
+ }
27
+ /**
28
+ * Layout React Flow nodes using ELK
29
+ *
30
+ * This is a convenience function for use directly with React Flow state.
31
+ *
32
+ * @param nodes - React Flow nodes
33
+ * @param edges - React Flow edges
34
+ * @param options - Layout options (including sizing mode)
35
+ * @returns Nodes with positions updated
36
+ */
37
+ export declare function layoutFlowNodes(nodes: CoralNode[], edges: CoralEdge[], options?: LayoutFlowOptions): Promise<CoralNode[]>;
38
+ /**
39
+ * Edge routing data extracted from ELK layout.
40
+ * Matches ELK's ElkEdgeSection shape for zero-adapter integration.
41
+ */
42
+ export interface ElkEdgeRouting {
43
+ id: string;
44
+ startPoint: Position;
45
+ endPoint: Position;
46
+ bendPoints: Position[];
47
+ sourceId: string;
48
+ targetId: string;
49
+ }
50
+ /**
51
+ * Result from layoutFlowNodes including edge routing data.
52
+ */
53
+ export interface LayoutFlowResult {
54
+ nodes: CoralNode[];
55
+ edgeRouting: Map<string, ElkEdgeRouting>;
56
+ }
57
+ /**
58
+ * Extract edge routing sections from ELK layout result.
59
+ *
60
+ * ELK computes edge sections with start/end points and bend points.
61
+ * Previously Coral discarded this data — now we capture it.
62
+ */
63
+ export declare function extractEdgeSections(elkEdges: ElkExtendedEdge[] | undefined): Map<string, ElkEdgeRouting>;
64
+ /**
65
+ * Layout React Flow nodes and extract edge routing from ELK.
66
+ *
67
+ * Same as layoutFlowNodes but also returns the edge routing data
68
+ * that ELK computes. Use this when you want to render edges through
69
+ * ELK's computed bend points instead of React Flow's smoothstep.
70
+ */
71
+ export declare function layoutFlowNodesWithEdges(nodes: CoralNode[], edges: CoralEdge[], options?: LayoutFlowOptions): Promise<LayoutFlowResult>;
72
+ /**
73
+ * Get ELK instance for advanced usage
74
+ */
75
+ export declare function getElk(): typeof elk;
76
+ export {};
77
+ //# sourceMappingURL=elk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"elk.d.ts","sourceRoot":"","sources":["../../src/layout/elk.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAW,eAAe,EAAqC,MAAM,OAAO,CAAC;AACzF,OAAO,KAAK,EAAE,OAAO,EAAwB,aAAa,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAI5H,QAAA,MAAM,GAAG,qBAAY,CAAC;AAqItB;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAclE;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;IACtD,uBAAuB;IACvB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,qCAAqC;IACrC,QAA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