@finos/legend-cube-builder 0.0.0-stage → 0.0.2

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 (301) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +5 -2
  3. package/lib/__lib__/LegendCubeCommand.d.ts +26 -0
  4. package/lib/__lib__/LegendCubeCommand.d.ts.map +1 -0
  5. package/lib/__lib__/LegendCubeCommand.js +40 -0
  6. package/lib/__lib__/LegendCubeCommand.js.map +1 -0
  7. package/lib/__lib__/LegendCubeHelpText.d.ts +19 -0
  8. package/lib/__lib__/LegendCubeHelpText.d.ts.map +1 -0
  9. package/lib/__lib__/LegendCubeHelpText.js +27 -0
  10. package/lib/__lib__/LegendCubeHelpText.js.map +1 -0
  11. package/lib/__lib__/LegendCubeLabels.d.ts +68 -0
  12. package/lib/__lib__/LegendCubeLabels.d.ts.map +1 -0
  13. package/lib/__lib__/LegendCubeLabels.js +109 -0
  14. package/lib/__lib__/LegendCubeLabels.js.map +1 -0
  15. package/lib/__lib__/LegendCubeTesting.d.ts +33 -0
  16. package/lib/__lib__/LegendCubeTesting.d.ts.map +1 -0
  17. package/lib/__lib__/LegendCubeTesting.js +34 -0
  18. package/lib/__lib__/LegendCubeTesting.js.map +1 -0
  19. package/lib/__test-utils__/CubeCanvasTestUtils.d.ts +24 -0
  20. package/lib/__test-utils__/CubeCanvasTestUtils.d.ts.map +1 -0
  21. package/lib/__test-utils__/CubeCanvasTestUtils.js +37 -0
  22. package/lib/__test-utils__/CubeCanvasTestUtils.js.map +1 -0
  23. package/lib/__test-utils__/CubeEngineTestSupport.d.ts +41 -0
  24. package/lib/__test-utils__/CubeEngineTestSupport.d.ts.map +1 -0
  25. package/lib/__test-utils__/CubeEngineTestSupport.js +76 -0
  26. package/lib/__test-utils__/CubeEngineTestSupport.js.map +1 -0
  27. package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts +31 -0
  28. package/lib/__test-utils__/CubeNorthwindTestQueries.d.ts.map +1 -0
  29. package/lib/__test-utils__/CubeNorthwindTestQueries.js +102 -0
  30. package/lib/__test-utils__/CubeNorthwindTestQueries.js.map +1 -0
  31. package/lib/__test-utils__/CubePageTestUtils.d.ts +33 -0
  32. package/lib/__test-utils__/CubePageTestUtils.d.ts.map +1 -0
  33. package/lib/__test-utils__/CubePageTestUtils.js +68 -0
  34. package/lib/__test-utils__/CubePageTestUtils.js.map +1 -0
  35. package/lib/__test-utils__/CubeTestApplication.d.ts +30 -0
  36. package/lib/__test-utils__/CubeTestApplication.d.ts.map +1 -0
  37. package/lib/__test-utils__/CubeTestApplication.js +57 -0
  38. package/lib/__test-utils__/CubeTestApplication.js.map +1 -0
  39. package/lib/__test-utils__/FakeCubeEngine.d.ts +41 -0
  40. package/lib/__test-utils__/FakeCubeEngine.d.ts.map +1 -0
  41. package/lib/__test-utils__/FakeCubeEngine.js +85 -0
  42. package/lib/__test-utils__/FakeCubeEngine.js.map +1 -0
  43. package/lib/components/CubeButton.d.ts +20 -0
  44. package/lib/components/CubeButton.d.ts.map +1 -0
  45. package/lib/components/CubeButton.js +24 -0
  46. package/lib/components/CubeButton.js.map +1 -0
  47. package/lib/components/CubeEditor.d.ts +31 -0
  48. package/lib/components/CubeEditor.d.ts.map +1 -0
  49. package/lib/components/CubeEditor.js +90 -0
  50. package/lib/components/CubeEditor.js.map +1 -0
  51. package/lib/components/CubeNodeIcon.d.ts +23 -0
  52. package/lib/components/CubeNodeIcon.d.ts.map +1 -0
  53. package/lib/components/CubeNodeIcon.js +32 -0
  54. package/lib/components/CubeNodeIcon.js.map +1 -0
  55. package/lib/components/canvas/CubeCanvas.d.ts +37 -0
  56. package/lib/components/canvas/CubeCanvas.d.ts.map +1 -0
  57. package/lib/components/canvas/CubeCanvas.js +135 -0
  58. package/lib/components/canvas/CubeCanvas.js.map +1 -0
  59. package/lib/components/canvas/CubeCanvasContext.d.ts +19 -0
  60. package/lib/components/canvas/CubeCanvasContext.d.ts.map +1 -0
  61. package/lib/components/canvas/CubeCanvasContext.js +22 -0
  62. package/lib/components/canvas/CubeCanvasContext.js.map +1 -0
  63. package/lib/components/canvas/CubeCanvasContextMenu.d.ts +28 -0
  64. package/lib/components/canvas/CubeCanvasContextMenu.d.ts.map +1 -0
  65. package/lib/components/canvas/CubeCanvasContextMenu.js +35 -0
  66. package/lib/components/canvas/CubeCanvasContextMenu.js.map +1 -0
  67. package/lib/components/canvas/CubeCanvasDnd.d.ts +43 -0
  68. package/lib/components/canvas/CubeCanvasDnd.d.ts.map +1 -0
  69. package/lib/components/canvas/CubeCanvasDnd.js +51 -0
  70. package/lib/components/canvas/CubeCanvasDnd.js.map +1 -0
  71. package/lib/components/canvas/CubeCanvasEdge.d.ts +24 -0
  72. package/lib/components/canvas/CubeCanvasEdge.d.ts.map +1 -0
  73. package/lib/components/canvas/CubeCanvasEdge.js +33 -0
  74. package/lib/components/canvas/CubeCanvasEdge.js.map +1 -0
  75. package/lib/components/canvas/CubeCanvasElements.d.ts +64 -0
  76. package/lib/components/canvas/CubeCanvasElements.d.ts.map +1 -0
  77. package/lib/components/canvas/CubeCanvasElements.js +96 -0
  78. package/lib/components/canvas/CubeCanvasElements.js.map +1 -0
  79. package/lib/components/canvas/CubeCanvasLayout.d.ts +32 -0
  80. package/lib/components/canvas/CubeCanvasLayout.d.ts.map +1 -0
  81. package/lib/components/canvas/CubeCanvasLayout.js +63 -0
  82. package/lib/components/canvas/CubeCanvasLayout.js.map +1 -0
  83. package/lib/components/canvas/CubeCanvasNode.d.ts +29 -0
  84. package/lib/components/canvas/CubeCanvasNode.d.ts.map +1 -0
  85. package/lib/components/canvas/CubeCanvasNode.js +72 -0
  86. package/lib/components/canvas/CubeCanvasNode.js.map +1 -0
  87. package/lib/components/editors/CubeColumnPicker.d.ts +40 -0
  88. package/lib/components/editors/CubeColumnPicker.d.ts.map +1 -0
  89. package/lib/components/editors/CubeColumnPicker.js +51 -0
  90. package/lib/components/editors/CubeColumnPicker.js.map +1 -0
  91. package/lib/components/editors/CubeFilterEditor.d.ts +26 -0
  92. package/lib/components/editors/CubeFilterEditor.d.ts.map +1 -0
  93. package/lib/components/editors/CubeFilterEditor.js +90 -0
  94. package/lib/components/editors/CubeFilterEditor.js.map +1 -0
  95. package/lib/components/editors/CubeJoinEditor.d.ts +26 -0
  96. package/lib/components/editors/CubeJoinEditor.d.ts.map +1 -0
  97. package/lib/components/editors/CubeJoinEditor.js +76 -0
  98. package/lib/components/editors/CubeJoinEditor.js.map +1 -0
  99. package/lib/components/editors/CubeNodeEditorPanel.d.ts +29 -0
  100. package/lib/components/editors/CubeNodeEditorPanel.d.ts.map +1 -0
  101. package/lib/components/editors/CubeNodeEditorPanel.js +71 -0
  102. package/lib/components/editors/CubeNodeEditorPanel.js.map +1 -0
  103. package/lib/components/editors/CubeNodeEditorRegistry.d.ts +44 -0
  104. package/lib/components/editors/CubeNodeEditorRegistry.d.ts.map +1 -0
  105. package/lib/components/editors/CubeNodeEditorRegistry.js +30 -0
  106. package/lib/components/editors/CubeNodeEditorRegistry.js.map +1 -0
  107. package/lib/components/editors/CubeSourceEditor.d.ts +25 -0
  108. package/lib/components/editors/CubeSourceEditor.d.ts.map +1 -0
  109. package/lib/components/editors/CubeSourceEditor.js +42 -0
  110. package/lib/components/editors/CubeSourceEditor.js.map +1 -0
  111. package/lib/components/editors/CubeValueEditor.d.ts +40 -0
  112. package/lib/components/editors/CubeValueEditor.d.ts.map +1 -0
  113. package/lib/components/editors/CubeValueEditor.js +177 -0
  114. package/lib/components/editors/CubeValueEditor.js.map +1 -0
  115. package/lib/components/grid/CubeGridRegion.d.ts +23 -0
  116. package/lib/components/grid/CubeGridRegion.d.ts.map +1 -0
  117. package/lib/components/grid/CubeGridRegion.js +94 -0
  118. package/lib/components/grid/CubeGridRegion.js.map +1 -0
  119. package/lib/components/grid/CubeGridValues.d.ts +25 -0
  120. package/lib/components/grid/CubeGridValues.d.ts.map +1 -0
  121. package/lib/components/grid/CubeGridValues.js +95 -0
  122. package/lib/components/grid/CubeGridValues.js.map +1 -0
  123. package/lib/components/grid/CubeResultGrid.d.ts +26 -0
  124. package/lib/components/grid/CubeResultGrid.d.ts.map +1 -0
  125. package/lib/components/grid/CubeResultGrid.js +50 -0
  126. package/lib/components/grid/CubeResultGrid.js.map +1 -0
  127. package/lib/components/palette/CubePalette.d.ts +29 -0
  128. package/lib/components/palette/CubePalette.d.ts.map +1 -0
  129. package/lib/components/palette/CubePalette.js +73 -0
  130. package/lib/components/palette/CubePalette.js.map +1 -0
  131. package/lib/components/show-pure/CubeShowPureDialog.d.ts +23 -0
  132. package/lib/components/show-pure/CubeShowPureDialog.d.ts.map +1 -0
  133. package/lib/components/show-pure/CubeShowPureDialog.js +37 -0
  134. package/lib/components/show-pure/CubeShowPureDialog.js.map +1 -0
  135. package/lib/components/source-picker/CubeSourcePicker.d.ts +22 -0
  136. package/lib/components/source-picker/CubeSourcePicker.d.ts.map +1 -0
  137. package/lib/components/source-picker/CubeSourcePicker.js +89 -0
  138. package/lib/components/source-picker/CubeSourcePicker.js.map +1 -0
  139. package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts +26 -0
  140. package/lib/components/spec-transfer/CubeSpecTransferDialog.d.ts.map +1 -0
  141. package/lib/components/spec-transfer/CubeSpecTransferDialog.js +45 -0
  142. package/lib/components/spec-transfer/CubeSpecTransferDialog.js.map +1 -0
  143. package/lib/graph-manager/CubeEngine.d.ts +115 -0
  144. package/lib/graph-manager/CubeEngine.d.ts.map +1 -0
  145. package/lib/graph-manager/CubeEngine.js +61 -0
  146. package/lib/graph-manager/CubeEngine.js.map +1 -0
  147. package/lib/graph-manager/CubeModelOutlineHelper.d.ts +25 -0
  148. package/lib/graph-manager/CubeModelOutlineHelper.d.ts.map +1 -0
  149. package/lib/graph-manager/CubeModelOutlineHelper.js +24 -0
  150. package/lib/graph-manager/CubeModelOutlineHelper.js.map +1 -0
  151. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts +26 -0
  152. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.d.ts.map +1 -0
  153. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js +22 -0
  154. package/lib/graph-manager/protocol/pure/CubeEngineBuilder.js.map +1 -0
  155. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts +27 -0
  156. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.d.ts.map +1 -0
  157. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js +76 -0
  158. package/lib/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.js.map +1 -0
  159. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts +27 -0
  160. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.d.ts.map +1 -0
  161. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js +82 -0
  162. package/lib/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.js.map +1 -0
  163. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts +32 -0
  164. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.d.ts.map +1 -0
  165. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js +195 -0
  166. package/lib/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.js.map +1 -0
  167. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts +20 -0
  168. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.d.ts.map +1 -0
  169. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js +121 -0
  170. package/lib/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.js.map +1 -0
  171. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts +24 -0
  172. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.d.ts.map +1 -0
  173. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js +43 -0
  174. package/lib/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.js.map +1 -0
  175. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts +45 -0
  176. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.d.ts.map +1 -0
  177. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js +171 -0
  178. package/lib/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.js.map +1 -0
  179. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts +22 -0
  180. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.d.ts.map +1 -0
  181. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js +79 -0
  182. package/lib/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.js.map +1 -0
  183. package/lib/index.css +17 -0
  184. package/lib/index.css.map +1 -0
  185. package/lib/index.d.ts +25 -0
  186. package/lib/index.d.ts.map +1 -0
  187. package/lib/index.js +24 -0
  188. package/lib/index.js.map +1 -0
  189. package/lib/stores/CubeEditorState.d.ts +206 -0
  190. package/lib/stores/CubeEditorState.d.ts.map +1 -0
  191. package/lib/stores/CubeEditorState.js +551 -0
  192. package/lib/stores/CubeEditorState.js.map +1 -0
  193. package/lib/stores/CubeExecutionState.d.ts +67 -0
  194. package/lib/stores/CubeExecutionState.d.ts.map +1 -0
  195. package/lib/stores/CubeExecutionState.js +196 -0
  196. package/lib/stores/CubeExecutionState.js.map +1 -0
  197. package/lib/stores/CubeHost.d.ts +31 -0
  198. package/lib/stores/CubeHost.d.ts.map +1 -0
  199. package/lib/stores/CubeHost.js +17 -0
  200. package/lib/stores/CubeHost.js.map +1 -0
  201. package/lib/stores/CubeNodeEditorState.d.ts +85 -0
  202. package/lib/stores/CubeNodeEditorState.d.ts.map +1 -0
  203. package/lib/stores/CubeNodeEditorState.js +207 -0
  204. package/lib/stores/CubeNodeEditorState.js.map +1 -0
  205. package/lib/stores/CubeShowPureState.d.ts +38 -0
  206. package/lib/stores/CubeShowPureState.d.ts.map +1 -0
  207. package/lib/stores/CubeShowPureState.js +83 -0
  208. package/lib/stores/CubeShowPureState.js.map +1 -0
  209. package/lib/stores/CubeSourcePickerState.d.ts +98 -0
  210. package/lib/stores/CubeSourcePickerState.d.ts.map +1 -0
  211. package/lib/stores/CubeSourcePickerState.js +334 -0
  212. package/lib/stores/CubeSourcePickerState.js.map +1 -0
  213. package/lib/stores/CubeSpecTransferState.d.ts +60 -0
  214. package/lib/stores/CubeSpecTransferState.d.ts.map +1 -0
  215. package/lib/stores/CubeSpecTransferState.js +167 -0
  216. package/lib/stores/CubeSpecTransferState.js.map +1 -0
  217. package/lib/stores/LocalModelCatalog.d.ts +37 -0
  218. package/lib/stores/LocalModelCatalog.d.ts.map +1 -0
  219. package/lib/stores/LocalModelCatalog.js +49 -0
  220. package/lib/stores/LocalModelCatalog.js.map +1 -0
  221. package/lib/stores/editors/CubeFilterDraft.d.ts +61 -0
  222. package/lib/stores/editors/CubeFilterDraft.d.ts.map +1 -0
  223. package/lib/stores/editors/CubeFilterDraft.js +186 -0
  224. package/lib/stores/editors/CubeFilterDraft.js.map +1 -0
  225. package/lib/stores/editors/CubeJoinDraft.d.ts +63 -0
  226. package/lib/stores/editors/CubeJoinDraft.d.ts.map +1 -0
  227. package/lib/stores/editors/CubeJoinDraft.js +136 -0
  228. package/lib/stores/editors/CubeJoinDraft.js.map +1 -0
  229. package/lib/stores/editors/CubeNodeDraft.d.ts +38 -0
  230. package/lib/stores/editors/CubeNodeDraft.d.ts.map +1 -0
  231. package/lib/stores/editors/CubeNodeDraft.js +35 -0
  232. package/lib/stores/editors/CubeNodeDraft.js.map +1 -0
  233. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts +29 -0
  234. package/lib/stores/editors/CubeNodeDraftRegistry.d.ts.map +1 -0
  235. package/lib/stores/editors/CubeNodeDraftRegistry.js +33 -0
  236. package/lib/stores/editors/CubeNodeDraftRegistry.js.map +1 -0
  237. package/lib/stores/fixtures/CubeNorthwindModel.d.ts +23 -0
  238. package/lib/stores/fixtures/CubeNorthwindModel.d.ts.map +1 -0
  239. package/lib/stores/fixtures/CubeNorthwindModel.js +338 -0
  240. package/lib/stores/fixtures/CubeNorthwindModel.js.map +1 -0
  241. package/package.json +81 -3
  242. package/src/__lib__/LegendCubeCommand.ts +44 -0
  243. package/src/__lib__/LegendCubeHelpText.ts +38 -0
  244. package/src/__lib__/LegendCubeLabels.ts +141 -0
  245. package/src/__lib__/LegendCubeTesting.ts +33 -0
  246. package/src/__test-utils__/CubeCanvasTestUtils.ts +53 -0
  247. package/src/__test-utils__/CubeEngineTestSupport.ts +137 -0
  248. package/src/__test-utils__/CubeNorthwindTestQueries.ts +165 -0
  249. package/src/__test-utils__/CubePageTestUtils.tsx +96 -0
  250. package/src/__test-utils__/CubeTestApplication.ts +82 -0
  251. package/src/__test-utils__/FakeCubeEngine.ts +139 -0
  252. package/src/components/CubeButton.tsx +35 -0
  253. package/src/components/CubeEditor.tsx +239 -0
  254. package/src/components/CubeNodeIcon.tsx +47 -0
  255. package/src/components/canvas/CubeCanvas.tsx +260 -0
  256. package/src/components/canvas/CubeCanvasContext.ts +31 -0
  257. package/src/components/canvas/CubeCanvasContextMenu.tsx +89 -0
  258. package/src/components/canvas/CubeCanvasDnd.ts +82 -0
  259. package/src/components/canvas/CubeCanvasEdge.tsx +57 -0
  260. package/src/components/canvas/CubeCanvasElements.ts +150 -0
  261. package/src/components/canvas/CubeCanvasLayout.ts +88 -0
  262. package/src/components/canvas/CubeCanvasNode.tsx +141 -0
  263. package/src/components/editors/CubeColumnPicker.tsx +114 -0
  264. package/src/components/editors/CubeFilterEditor.tsx +309 -0
  265. package/src/components/editors/CubeJoinEditor.tsx +224 -0
  266. package/src/components/editors/CubeNodeEditorPanel.tsx +204 -0
  267. package/src/components/editors/CubeNodeEditorRegistry.ts +61 -0
  268. package/src/components/editors/CubeSourceEditor.tsx +116 -0
  269. package/src/components/editors/CubeValueEditor.tsx +332 -0
  270. package/src/components/grid/CubeGridRegion.tsx +274 -0
  271. package/src/components/grid/CubeGridValues.ts +125 -0
  272. package/src/components/grid/CubeResultGrid.tsx +84 -0
  273. package/src/components/palette/CubePalette.tsx +177 -0
  274. package/src/components/show-pure/CubeShowPureDialog.tsx +101 -0
  275. package/src/components/source-picker/CubeSourcePicker.tsx +304 -0
  276. package/src/components/spec-transfer/CubeSpecTransferDialog.tsx +157 -0
  277. package/src/graph-manager/CubeEngine.ts +155 -0
  278. package/src/graph-manager/CubeModelOutlineHelper.ts +32 -0
  279. package/src/graph-manager/protocol/pure/CubeEngineBuilder.ts +34 -0
  280. package/src/graph-manager/protocol/pure/v1/V1_CubeEngineErrors.ts +109 -0
  281. package/src/graph-manager/protocol/pure/v1/V1_CubeExecutionResultReader.ts +115 -0
  282. package/src/graph-manager/protocol/pure/v1/V1_CubeLambdaSerializer.ts +257 -0
  283. package/src/graph-manager/protocol/pure/v1/V1_CubeModelOutlineBuilder.ts +157 -0
  284. package/src/graph-manager/protocol/pure/v1/V1_CubeRelationTypeAdapter.ts +58 -0
  285. package/src/graph-manager/protocol/pure/v1/V1_LegendCubeEngine.ts +278 -0
  286. package/src/graph-manager/protocol/pure/v1/__test-utils__/V1_CubeEngineTestUtils.ts +124 -0
  287. package/src/index.ts +41 -0
  288. package/src/stores/CubeEditorState.ts +702 -0
  289. package/src/stores/CubeExecutionState.ts +255 -0
  290. package/src/stores/CubeHost.ts +32 -0
  291. package/src/stores/CubeNodeEditorState.ts +255 -0
  292. package/src/stores/CubeShowPureState.ts +96 -0
  293. package/src/stores/CubeSourcePickerState.ts +426 -0
  294. package/src/stores/CubeSpecTransferState.ts +198 -0
  295. package/src/stores/LocalModelCatalog.ts +70 -0
  296. package/src/stores/editors/CubeFilterDraft.ts +241 -0
  297. package/src/stores/editors/CubeJoinDraft.ts +197 -0
  298. package/src/stores/editors/CubeNodeDraft.ts +46 -0
  299. package/src/stores/editors/CubeNodeDraftRegistry.ts +49 -0
  300. package/src/stores/fixtures/CubeNorthwindModel.ts +355 -0
  301. package/tsconfig.json +118 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasContextMenu.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasContextMenu.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAGvE;;;;;;GAMG;AACH,eAAO,MAAM,qBAAqB;iBAGf,eAAe;aAAW,MAAM,GAAG,SAAS;2GAiD9D,CAAC"}
@@ -0,0 +1,35 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) 2026-present, Goldman Sachs
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { MenuContent, MenuContentDivider, MenuContentItem, MenuContentItemIcon, MenuContentItemLabel, } from '@finos/legend-art';
18
+ import { observer } from 'mobx-react-lite';
19
+ import { forwardRef } from 'react';
20
+ import { CubeNodeIcon } from '../CubeNodeIcon.js';
21
+ /**
22
+ * The canvas's context menu (spec §17.4): the palette, then what can be done
23
+ * to the node it was opened on. On a node, a palette item is added after it;
24
+ * around the nodes, on its own. Every item shows, disabled when it can't be
25
+ * done, so Swap Inputs can be found. The node comes through props: a menu
26
+ * opened around the nodes has none.
27
+ */
28
+ export const CubeCanvasContextMenu = observer(forwardRef(function CubeCanvasContextMenu(props, ref) {
29
+ const { editorState, nodeId } = props;
30
+ const { query } = editorState.document;
31
+ const { registry } = editorState;
32
+ const paletteItem = (definition) => (_jsxs(MenuContentItem, { disabled: !editorState.canAddNode(definition.type, nodeId), onClick: () => editorState.addNode(definition.type, nodeId), children: [_jsx(MenuContentItemIcon, { children: _jsx(CubeNodeIcon, { icon: definition.icon }) }), _jsxs(MenuContentItemLabel, { children: [definition.label, definition.beta ? ' (BETA)' : ''] })] }, definition.type));
33
+ return (_jsxs(MenuContent, { ref: ref, children: [registry.sources.map(paletteItem), _jsx(MenuContentDivider, {}), registry.transforms.map(paletteItem), _jsx(MenuContentDivider, {}), _jsx(MenuContentItem, { title: "Execute runs the query up to this node", disabled: nodeId === undefined || !query.canSelect(nodeId), onClick: () => nodeId !== undefined && editorState.select(nodeId), children: "Select" }), _jsx(MenuContentItem, { disabled: nodeId === undefined || !editorState.canRemoveNode(nodeId), onClick: () => nodeId !== undefined && editorState.removeNode(nodeId), children: "Remove" }), _jsx(MenuContentItem, { title: "Swap the node's two inputs, e.g. a Join's Left and Right", disabled: nodeId === undefined || !editorState.canSwapInputs(nodeId), onClick: () => nodeId !== undefined && editorState.swapInputs(nodeId), children: "Swap Inputs" })] }));
34
+ }));
35
+ //# sourceMappingURL=CubeCanvasContextMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasContextMenu.js","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasContextMenu.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,CAAC,M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AAe,IACd,QAAQ,EAAE,MAAM,KAAK,SAAS,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,EACpE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,KAAK,SAAS,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,uBAGrD,EAClB,KAAC,eAAe,IACd,KAAK,EAAC,0DAA0D,EAChE,QAAQ,EAAE,MAAM,KAAK,SAAS,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,MAAM,CAAC,EACpE,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,KAAK,SAAS,IAAI,WAAW,CAAC,UAAU,CAAC,MAAM,CAAC,4BAGrD,IACN,CACf,CAAC;AACJ,CAAC,CAAC,CACH,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CubeEditorState } from '../../stores/CubeEditorState.js';
17
+ export declare enum CUBE_DND_TYPE {
18
+ PALETTE_ITEM = "legend-cube.palette-item",
19
+ NODE = "legend-cube.node"
20
+ }
21
+ /** A palette item carries the type of node it adds */
22
+ export interface CubePaletteDragItem {
23
+ readonly nodeType: string;
24
+ }
25
+ /** A node carries only its id */
26
+ export interface CubeNodeDragItem {
27
+ readonly nodeId: string;
28
+ }
29
+ export type CubeDragItem = CubePaletteDragItem | CubeNodeDragItem;
30
+ /**
31
+ * Whether dropping the item on the node does anything, which also decides
32
+ * whether the node lights up under it: a palette item is spliced in after
33
+ * the node, another node connects to it or else moves after it
34
+ */
35
+ export declare const canDropOnCubeNode: (editorState: CubeEditorState, item: CubeDragItem, targetId: string) => boolean;
36
+ export declare const dropOnCubeNode: (editorState: CubeEditorState, item: CubeDragItem, targetId: string) => void;
37
+ /**
38
+ * A palette item dropped on the canvas around the nodes: a transform is
39
+ * added unconnected, a source opens the picker. A drop on a node is the
40
+ * node's, taken or refused, never the canvas's.
41
+ */
42
+ export declare const dropOnCubeCanvas: (editorState: CubeEditorState, item: CubeDragItem, isOverNode: boolean) => void;
43
+ //# sourceMappingURL=CubeCanvasDnd.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasDnd.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasDnd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAMvE,oBAAY,aAAa;IACvB,YAAY,6BAA6B;IACzC,IAAI,qBAAqB;CAC1B;AAED,sDAAsD;AACtD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED,iCAAiC;AACjC,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,gBAAgB,CAAC;AAKlE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,aAAa,eAAe,EAC5B,MAAM,YAAY,EAClB,UAAU,MAAM,KACf,OAGkD,CAAC;AAEtD,eAAO,MAAM,cAAc,GACzB,aAAa,eAAe,EAC5B,MAAM,YAAY,EAClB,UAAU,MAAM,KACf,IAMF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAC3B,aAAa,eAAe,EAC5B,MAAM,YAAY,EAClB,YAAY,OAAO,KAClB,IAIF,CAAC"}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ // Drag and drop on the canvas (spec §17.3): palette items and nodes are
17
+ // dragged; nodes and the canvas take drops. The app's HTML5 backend provider
18
+ // wraps every Legend application, so Cube mounts none of its own.
19
+ export var CUBE_DND_TYPE;
20
+ (function (CUBE_DND_TYPE) {
21
+ CUBE_DND_TYPE["PALETTE_ITEM"] = "legend-cube.palette-item";
22
+ CUBE_DND_TYPE["NODE"] = "legend-cube.node";
23
+ })(CUBE_DND_TYPE || (CUBE_DND_TYPE = {}));
24
+ const isNodeDragItem = (item) => 'nodeId' in item;
25
+ /**
26
+ * Whether dropping the item on the node does anything, which also decides
27
+ * whether the node lights up under it: a palette item is spliced in after
28
+ * the node, another node connects to it or else moves after it
29
+ */
30
+ export const canDropOnCubeNode = (editorState, item, targetId) => isNodeDragItem(item)
31
+ ? editorState.canDropNode(item.nodeId, targetId)
32
+ : editorState.canAddNode(item.nodeType, targetId);
33
+ export const dropOnCubeNode = (editorState, item, targetId) => {
34
+ if (isNodeDragItem(item)) {
35
+ editorState.dropNode(item.nodeId, targetId);
36
+ }
37
+ else {
38
+ editorState.addNode(item.nodeType, targetId);
39
+ }
40
+ };
41
+ /**
42
+ * A palette item dropped on the canvas around the nodes: a transform is
43
+ * added unconnected, a source opens the picker. A drop on a node is the
44
+ * node's, taken or refused, never the canvas's.
45
+ */
46
+ export const dropOnCubeCanvas = (editorState, item, isOverNode) => {
47
+ if (!isOverNode && !isNodeDragItem(item)) {
48
+ editorState.addNode(item.nodeType);
49
+ }
50
+ };
51
+ //# sourceMappingURL=CubeCanvasDnd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasDnd.js","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasDnd.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,wEAAwE;AACxE,6EAA6E;AAC7E,kEAAkE;AAElE,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,0DAAyC,CAAA;IACzC,0CAAyB,CAAA;AAC3B,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAcD,MAAM,cAAc,GAAG,CAAC,IAAkB,EAA4B,EAAE,CACtE,QAAQ,IAAI,IAAI,CAAC;AAEnB;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,WAA4B,EAC5B,IAAkB,EAClB,QAAgB,EACP,EAAE,CACX,cAAc,CAAC,IAAI,CAAC;IAClB,CAAC,CAAC,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC;IAChD,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,WAA4B,EAC5B,IAAkB,EAClB,QAAgB,EACV,EAAE;IACR,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC9C,CAAC;SAAM,CAAC;QACN,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,WAA4B,EAC5B,IAAkB,EAClB,UAAmB,EACb,EAAE;IACR,IAAI,CAAC,UAAU,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC;QACzC,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrC,CAAC;AACH,CAAC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { type EdgeProps } from '@xyflow/react';
17
+ import type { CubeCanvasFlowEdge } from './CubeCanvasElements.js';
18
+ /**
19
+ * A connection, with its port's label (Left or Right on a Join) shown as text
20
+ * beside the input it feeds, not in a tooltip (spec §17.3). The label is HTML:
21
+ * React Flow's own edge label measures SVG text, which jsdom can't.
22
+ */
23
+ export declare const CubeCanvasEdge: React.FC<EdgeProps<CubeCanvasFlowEdge>>;
24
+ //# sourceMappingURL=CubeCanvasEdge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasEdge.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasEdge.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,SAAS,EAEf,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAKlE;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAuBlE,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) 2026-present, Goldman Sachs
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { BaseEdge, EdgeLabelRenderer, getBezierPath, } from '@xyflow/react';
18
+ import { LEGEND_CUBE_TEST_ID } from '../../__lib__/LegendCubeTesting.js';
19
+ /** The gap between an input's label and the node it feeds */
20
+ const LABEL_GAP = 6;
21
+ /**
22
+ * A connection, with its port's label (Left or Right on a Join) shown as text
23
+ * beside the input it feeds, not in a tooltip (spec §17.3). The label is HTML:
24
+ * React Flow's own edge label measures SVG text, which jsdom can't.
25
+ */
26
+ export const CubeCanvasEdge = (props) => {
27
+ const { id, targetX, targetY, markerEnd, data } = props;
28
+ const [path] = getBezierPath(props);
29
+ return (_jsxs(_Fragment, { children: [_jsx(BaseEdge, { id: id, path: path, markerEnd: markerEnd }), data?.label && (_jsx(EdgeLabelRenderer, { children: _jsx("div", { className: "absolute rounded bg-[var(--color-bg-panel)] px-1 text-sm text-[var(--color-text-secondary)]", style: {
30
+ transform: `translate(-100%, -100%) translate(${targetX - LABEL_GAP}px, ${targetY - 2}px)`,
31
+ }, "data-testid": LEGEND_CUBE_TEST_ID.CANVAS_EDGE_LABEL, children: data.label }) }))] }));
32
+ };
33
+ //# sourceMappingURL=CubeCanvasEdge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasEdge.js","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasEdge.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,QAAQ,EACR,iBAAiB,EAEjB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAGzE,6DAA6D;AAC7D,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAA4C,CACrE,KAAK,EACL,EAAE;IACF,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACxD,MAAM,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,CACL,8BACE,KAAC,QAAQ,IAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,GAAI,EACrD,IAAI,EAAE,KAAK,IAAI,CACd,KAAC,iBAAiB,cAChB,cACE,SAAS,EAAC,6FAA6F,EACvG,KAAK,EAAE;wBACL,SAAS,EAAE,qCAAqC,OAAO,GAAG,SAAS,OAAO,OAAO,GAAG,CAAC,KAAK;qBAC3F,iBACY,mBAAmB,CAAC,iBAAiB,YAEjD,IAAI,CAAC,KAAK,GACP,GACY,CACrB,IACA,CACJ,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { type Query, type QueryNode } from '@finos/legend-cube';
17
+ import { type Edge, type Node } from '@xyflow/react';
18
+ import type { CubeEditorState } from '../../stores/CubeEditorState.js';
19
+ import { type CubeCanvasPosition } from './CubeCanvasLayout.js';
20
+ export declare const CUBE_CANVAS_NODE_TYPE = "cube";
21
+ export declare const CUBE_CANVAS_EDGE_TYPE = "cube";
22
+ /** The one output of every node; its inputs are named by its ports */
23
+ export declare const CUBE_OUTPUT_HANDLE_ID = "output";
24
+ /** Shown when a node has no validity entry at all, which inference never leaves out */
25
+ export declare const MISSING_VALIDITY_TOOLTIP = "This node depends on some invalid inputs.";
26
+ export type CubeCanvasNodeData = {
27
+ readonly node: QueryNode;
28
+ };
29
+ export type CubeCanvasEdgeData = {
30
+ readonly label: string | undefined;
31
+ };
32
+ export type CubeCanvasFlowNode = Node<CubeCanvasNodeData, 'cube'>;
33
+ export type CubeCanvasFlowEdge = Edge<CubeCanvasEdgeData, 'cube'>;
34
+ type CubeCanvasHandle = NonNullable<Node['handles']>[number];
35
+ /** How far down the node's left side each input handle sits: evenly spaced, in port order */
36
+ export declare const getInputHandleOffset: (index: number, count: number) => number;
37
+ /**
38
+ * Where the node's handles are, so edges are drawn without measuring the DOM:
39
+ * its inputs down its left side in port order (a Join's Left above its
40
+ * Right), its output in the middle of its right side. New objects each time:
41
+ * React Flow writes into them.
42
+ */
43
+ export declare const getCubeCanvasHandles: (node: QueryNode) => CubeCanvasHandle[];
44
+ export declare const buildCubeCanvasNodes: (query: Query, positions: ReadonlyMap<string, CubeCanvasPosition>) => CubeCanvasFlowNode[];
45
+ /** Each connection, labelled with its port's label when the target has one, e.g. Left and Right on a Join */
46
+ export declare const buildCubeCanvasEdges: (query: Query) => CubeCanvasFlowEdge[];
47
+ /** How a node looks on the canvas (spec §17.3): each state is its own class modifier */
48
+ export interface CubeCanvasNodeStatus {
49
+ /** Execute runs the query up to this node */
50
+ readonly isCapture: boolean;
51
+ /** It has errors of its own, the query rules' included; not the engine's */
52
+ readonly isInvalid: boolean;
53
+ /** An input is missing, or an input is invalid */
54
+ readonly isIncomplete: boolean;
55
+ /** The engine is typing its table */
56
+ readonly isResolving: boolean;
57
+ /** The last run failed on it */
58
+ readonly hasEngineError: boolean;
59
+ /** Its errors, then its warnings, its description and its id, one a line */
60
+ readonly tooltip: string;
61
+ }
62
+ export declare const getCubeCanvasNodeStatus: (editorState: CubeEditorState, node: QueryNode) => CubeCanvasNodeStatus;
63
+ export {};
64
+ //# sourceMappingURL=CubeCanvasElements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasElements.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasElements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,IAAI,EAAc,KAAK,IAAI,EAAY,MAAM,eAAe,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,uBAAuB,CAAC;AAM/B,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C,sEAAsE;AACtE,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C,uFAAuF;AACvF,eAAO,MAAM,wBAAwB,8CACQ,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC;AAC9D,MAAM,MAAM,kBAAkB,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AACxE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC;AAClE,KAAK,gBAAgB,GAAG,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,6FAA6F;AAC7F,eAAO,MAAM,oBAAoB,GAAI,OAAO,MAAM,EAAE,OAAO,MAAM,KAAG,MACb,CAAC;AAExD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,SAAS,KAAG,gBAAgB,EAetE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAC/B,OAAO,KAAK,EACZ,WAAW,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,KACjD,kBAAkB,EAShB,CAAC;AAEN,6GAA6G;AAC7G,eAAO,MAAM,oBAAoB,GAAI,OAAO,KAAK,KAAG,kBAAkB,EAclE,CAAC;AAEL,wFAAwF;AACxF,MAAM,WAAW,oBAAoB;IACnC,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,4EAA4E;IAC5E,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,qCAAqC;IACrC,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,gCAAgC;IAChC,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED,eAAO,MAAM,uBAAuB,GAClC,aAAa,eAAe,EAC5B,MAAM,SAAS,KACd,oBAuBF,CAAC"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { isIncompleteError, isSchemasError, } from '@finos/legend-cube';
17
+ import { MarkerType, Position } from '@xyflow/react';
18
+ import { CUBE_CANVAS_NODE_HEIGHT, CUBE_CANVAS_NODE_WIDTH, } from './CubeCanvasLayout.js';
19
+ // The query as React Flow draws it: one node per query node, one edge per
20
+ // connection. Rebuilt from the query on every change; React Flow keeps no
21
+ // state of its own that matters (PLAN §7.2)
22
+ export const CUBE_CANVAS_NODE_TYPE = 'cube';
23
+ export const CUBE_CANVAS_EDGE_TYPE = 'cube';
24
+ /** The one output of every node; its inputs are named by its ports */
25
+ export const CUBE_OUTPUT_HANDLE_ID = 'output';
26
+ /** Shown when a node has no validity entry at all, which inference never leaves out */
27
+ export const MISSING_VALIDITY_TOOLTIP = 'This node depends on some invalid inputs.';
28
+ /** How far down the node's left side each input handle sits: evenly spaced, in port order */
29
+ export const getInputHandleOffset = (index, count) => (CUBE_CANVAS_NODE_HEIGHT * (index + 1)) / (count + 1);
30
+ /**
31
+ * Where the node's handles are, so edges are drawn without measuring the DOM:
32
+ * its inputs down its left side in port order (a Join's Left above its
33
+ * Right), its output in the middle of its right side. New objects each time:
34
+ * React Flow writes into them.
35
+ */
36
+ export const getCubeCanvasHandles = (node) => [
37
+ ...node.ports.map((port, index) => ({
38
+ id: port,
39
+ type: 'target',
40
+ position: Position.Left,
41
+ x: 0,
42
+ y: getInputHandleOffset(index, node.ports.length),
43
+ })),
44
+ {
45
+ id: CUBE_OUTPUT_HANDLE_ID,
46
+ type: 'source',
47
+ position: Position.Right,
48
+ x: CUBE_CANVAS_NODE_WIDTH,
49
+ y: CUBE_CANVAS_NODE_HEIGHT / 2,
50
+ },
51
+ ];
52
+ export const buildCubeCanvasNodes = (query, positions) => query.nodes.map((node) => ({
53
+ id: node.id,
54
+ type: CUBE_CANVAS_NODE_TYPE,
55
+ position: { ...(positions.get(node.id) ?? { x: 0, y: 0 }) },
56
+ width: CUBE_CANVAS_NODE_WIDTH,
57
+ height: CUBE_CANVAS_NODE_HEIGHT,
58
+ handles: getCubeCanvasHandles(node),
59
+ data: { node },
60
+ }));
61
+ /** Each connection, labelled with its port's label when the target has one, e.g. Left and Right on a Join */
62
+ export const buildCubeCanvasEdges = (query) => query.connections.map((connection) => {
63
+ const target = query.getNode(connection.target);
64
+ const label = target?.portLabels[target.ports.indexOf(connection.port)];
65
+ return {
66
+ id: connection.toString(),
67
+ type: CUBE_CANVAS_EDGE_TYPE,
68
+ source: connection.source,
69
+ target: connection.target,
70
+ sourceHandle: CUBE_OUTPUT_HANDLE_ID,
71
+ targetHandle: connection.port,
72
+ markerEnd: { type: MarkerType.ArrowClosed },
73
+ data: { label },
74
+ };
75
+ });
76
+ export const getCubeCanvasNodeStatus = (editorState, node) => {
77
+ const ownErrors = editorState.analysis.validity.get(node.id);
78
+ // the tooltip adds the engine's error; the states keep it apart
79
+ const errors = editorState.getNodeErrors(node.id);
80
+ const warnings = editorState.warnings.get(node.key) ?? [];
81
+ return {
82
+ isCapture: editorState.document.query.selected === node.id,
83
+ isInvalid: (ownErrors ?? []).some((error) => !isIncompleteError(error) && !isSchemasError(error)),
84
+ isIncomplete: (ownErrors ?? []).some((error) => isIncompleteError(error) || isSchemasError(error)),
85
+ isResolving: editorState.isPendingSource(node),
86
+ hasEngineError: editorState.hostIssues.has(node.id),
87
+ tooltip: [
88
+ ...(ownErrors ? [] : [MISSING_VALIDITY_TOOLTIP]),
89
+ ...errors,
90
+ ...warnings,
91
+ node.describe(),
92
+ node.id,
93
+ ].join('\n'),
94
+ };
95
+ };
96
+ //# sourceMappingURL=CubeCanvasElements.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasElements.js","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasElements.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,iBAAiB,EACjB,cAAc,GAGf,MAAM,oBAAoB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 *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { Query } from '@finos/legend-cube';
17
+ /** Every node is drawn this size, so edges need no DOM measurement (PLAN §7.2) */
18
+ export declare const CUBE_CANVAS_NODE_WIDTH = 200;
19
+ export declare const CUBE_CANVAS_NODE_HEIGHT = 72;
20
+ /** A node's top-left corner on the canvas */
21
+ export interface CubeCanvasPosition {
22
+ readonly x: number;
23
+ readonly y: number;
24
+ }
25
+ /**
26
+ * Where each node goes, laid out left to right (spec §17.3): a pure function
27
+ * of the query, recomputed on every change, so undo, import and every edit
28
+ * need no layout state. Nodes go in sorted by id and connections by port,
29
+ * source and target, so an edit that only reorders them moves nothing.
30
+ */
31
+ export declare const layoutCubeQuery: (query: Query) => Map<string, CubeCanvasPosition>;
32
+ //# sourceMappingURL=CubeCanvasLayout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasLayout.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAc,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE5D,kFAAkF;AAClF,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAC1C,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAK1C,6CAA6C;AAC7C,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB;AAWD;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,KAAK,KACX,GAAG,CAAC,MAAM,EAAE,kBAAkB,CAsChC,CAAC"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import dagre from '@dagrejs/dagre';
17
+ /** Every node is drawn this size, so edges need no DOM measurement (PLAN §7.2) */
18
+ export const CUBE_CANVAS_NODE_WIDTH = 200;
19
+ export const CUBE_CANVAS_NODE_HEIGHT = 72;
20
+ const RANK_SEPARATION = 80;
21
+ const NODE_SEPARATION = 32;
22
+ // by code unit, so the order never depends on the locale
23
+ const compareText = (a, b) => a < b ? -1 : a > b ? 1 : 0;
24
+ const compareConnections = (a, b) => compareText(a.port, b.port) ||
25
+ compareText(a.source, b.source) ||
26
+ compareText(a.target, b.target);
27
+ /**
28
+ * Where each node goes, laid out left to right (spec §17.3): a pure function
29
+ * of the query, recomputed on every change, so undo, import and every edit
30
+ * need no layout state. Nodes go in sorted by id and connections by port,
31
+ * source and target, so an edit that only reorders them moves nothing.
32
+ */
33
+ export const layoutCubeQuery = (query) => {
34
+ const graph = new dagre.graphlib.Graph({ multigraph: true });
35
+ graph.setGraph({
36
+ rankdir: 'LR',
37
+ ranksep: RANK_SEPARATION,
38
+ nodesep: NODE_SEPARATION,
39
+ });
40
+ graph.setDefaultEdgeLabel(() => ({}));
41
+ [...query.nodes]
42
+ .sort((a, b) => compareText(a.id, b.id))
43
+ .forEach((node) => graph.setNode(node.id, {
44
+ width: CUBE_CANVAS_NODE_WIDTH,
45
+ height: CUBE_CANVAS_NODE_HEIGHT,
46
+ }));
47
+ [...query.connections]
48
+ .sort(compareConnections)
49
+ .forEach((connection) => graph.setEdge(connection.source, connection.target, {}, connection.port));
50
+ dagre.layout(graph);
51
+ return new Map(query.nodes.map((node) => {
52
+ // dagre gives each node's centre
53
+ const { x, y } = graph.node(node.id);
54
+ return [
55
+ node.id,
56
+ {
57
+ x: x - CUBE_CANVAS_NODE_WIDTH / 2,
58
+ y: y - CUBE_CANVAS_NODE_HEIGHT / 2,
59
+ },
60
+ ];
61
+ }));
62
+ };
63
+ //# sourceMappingURL=CubeCanvasLayout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasLayout.js","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasLayout.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,MAAM,gBAAgB,CAAC;AAGnC,kFAAkF;AAClF,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAC1C,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,MAAM,eAAe,GAAG,EAAE,CAAC;AAQ3B,yDAAyD;AACzD,MAAM,WAAW,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CACnD,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE7B,MAAM,kBAAkB,GAAG,CAAC,CAAa,EAAE,CAAa,EAAU,EAAE,CAClE,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;IAC3B,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;IAC/B,WAAW,CAAC,CAAC,CAAC,MAAM,EAAE,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AAC,EAAE,CAAC,CAAC;QACrC,OAAO;YACL,IAAI,CAAC,EAAE;YACP;gBACE,CAAC,EAAE,CAAC,GAAG,sBAAsB,GAAG,CAAC;gBACjC,CAAC,EAAE,CAAC,GAAG,uBAAuB,GAAG,CAAC;aACnC;SACF,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) 2026-present, Goldman Sachs
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { type NodeProps } from '@xyflow/react';
17
+ import { type CubeCanvasFlowNode } from './CubeCanvasElements.js';
18
+ /**
19
+ * A node on the canvas: its type's icon and its description, never its id,
20
+ * which is in the tooltip (spec §17.3). Its look tells its state at a glance.
21
+ * It can be dragged onto another node, and takes palette items and other
22
+ * nodes, lighting up only for a drop that would do something. Its handles
23
+ * sit beside its draggable body, not in it, so dragging from a handle
24
+ * connects rather than drags the node.
25
+ */
26
+ export declare const CubeCanvasNode: ((props: NodeProps<CubeCanvasFlowNode>) => import("react/jsx-runtime").JSX.Element) & {
27
+ displayName: string;
28
+ };
29
+ //# sourceMappingURL=CubeCanvasNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasNode.d.ts","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasNode.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EAAU,KAAK,SAAS,EAAY,MAAM,eAAe,CAAC;AAMjE,OAAO,EAEL,KAAK,kBAAkB,EAGxB,MAAM,yBAAyB,CAAC;AAWjC;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,WACjB,SAAS,CAAC,kBAAkB,CAAC;;CA4FtC,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /**
3
+ * Copyright (c) 2026-present, Goldman Sachs
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { clsx, ContextMenu } from '@finos/legend-art';
18
+ import { Handle, Position } from '@xyflow/react';
19
+ import { observer } from 'mobx-react-lite';
20
+ import { useRef } from 'react';
21
+ import { useDrag, useDrop } from 'react-dnd';
22
+ import { LEGEND_CUBE_TEST_ID } from '../../__lib__/LegendCubeTesting.js';
23
+ import { CubeNodeIcon } from '../CubeNodeIcon.js';
24
+ import { CUBE_OUTPUT_HANDLE_ID, getCubeCanvasNodeStatus, getInputHandleOffset, } from './CubeCanvasElements.js';
25
+ import { useCubeCanvasEditorState } from './CubeCanvasContext.js';
26
+ import { CubeCanvasContextMenu } from './CubeCanvasContextMenu.js';
27
+ import { canDropOnCubeNode, CUBE_DND_TYPE, dropOnCubeNode, } from './CubeCanvasDnd.js';
28
+ /**
29
+ * A node on the canvas: its type's icon and its description, never its id,
30
+ * which is in the tooltip (spec §17.3). Its look tells its state at a glance.
31
+ * It can be dragged onto another node, and takes palette items and other
32
+ * nodes, lighting up only for a drop that would do something. Its handles
33
+ * sit beside its draggable body, not in it, so dragging from a handle
34
+ * connects rather than drags the node.
35
+ */
36
+ export const CubeCanvasNode = observer((props) => {
37
+ const { node } = props.data;
38
+ const editorState = useCubeCanvasEditorState();
39
+ const status = getCubeCanvasNodeStatus(editorState, node);
40
+ const connectable = !editorState.readOnly && node.acceptsNewInputs;
41
+ const ref = useRef(null);
42
+ const [, dragConnector] = useDrag(() => ({
43
+ type: CUBE_DND_TYPE.NODE,
44
+ item: { nodeId: node.id },
45
+ canDrag: () => !editorState.readOnly,
46
+ }), [editorState, node.id]);
47
+ const [{ isDropTarget }, dropConnector] = useDrop(() => ({
48
+ accept: [CUBE_DND_TYPE.NODE, CUBE_DND_TYPE.PALETTE_ITEM],
49
+ canDrop: (item) => canDropOnCubeNode(editorState, item, node.id),
50
+ drop: (item) => dropOnCubeNode(editorState, item, node.id),
51
+ collect: (monitor) => ({
52
+ isDropTarget: monitor.isOver({ shallow: true }) && monitor.canDrop(),
53
+ }),
54
+ }), [editorState, node.id]);
55
+ dragConnector(dropConnector(ref));
56
+ return (_jsxs(ContextMenu, { className: "h-full w-full", content: _jsx(CubeCanvasContextMenu, { editorState: editorState, nodeId: node.id }), menuProps: { elevation: 7 }, children: [node.ports.map((port, index) => (_jsx(Handle, { id: port, type: "target", position: Position.Left, isConnectable: connectable, style: { top: getInputHandleOffset(index, node.ports.length) } }, port))), _jsxs("div", { ref: ref, className: clsx(
57
+ // React Flow must leave the mouse to the HTML drag: 'nodrag' keeps
58
+ // it from moving the node, 'nopan' from panning the canvas
59
+ 'legend-cube__node nodrag nopan flex h-full w-full items-center gap-2 rounded border bg-[var(--color-bg-panel)] px-2 text-base text-[var(--color-text-primary)]', status.isInvalid
60
+ ? 'border-[var(--color-status-error)]'
61
+ : status.isIncomplete
62
+ ? 'border-dashed border-[var(--color-status-warn)]'
63
+ : 'border-[var(--color-border-default)]', {
64
+ 'legend-cube__node--selected ring-2 ring-[var(--color-accent)]': status.isCapture,
65
+ 'legend-cube__node--invalid': status.isInvalid,
66
+ 'legend-cube__node--incomplete': status.isIncomplete,
67
+ 'legend-cube__node--resolving animate-pulse': status.isResolving,
68
+ 'legend-cube__node--engine-error bg-[var(--color-status-error-bg)]': status.hasEngineError,
69
+ 'legend-cube__node--drop-target outline-dashed outline-2 outline-[var(--color-accent)]': isDropTarget,
70
+ }), title: status.tooltip, "aria-current": status.isCapture, "data-testid": LEGEND_CUBE_TEST_ID.CANVAS_NODE, children: [_jsx(CubeNodeIcon, { icon: editorState.registry.get(node.type)?.icon, className: "shrink-0 text-lg text-[var(--color-text-secondary)]" }), _jsx("span", { className: "line-clamp-2 min-w-0 break-words leading-tight", children: node.describe() })] }), _jsx(Handle, { id: CUBE_OUTPUT_HANDLE_ID, type: "source", position: Position.Right, isConnectable: !editorState.readOnly })] }));
71
+ });
72
+ //# sourceMappingURL=CubeCanvasNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CubeCanvasNode.js","sourceRoot":"","sources":["../../../src/components/canvas/CubeCanvasNode.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAkB,QAAQ,EAAE,MAAM,eAAe,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,qBAAqB,EAErB,uBAAuB,EACvB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EACL,iBAAiB,EACjB,aAAa,EAGb,cAAc,GACf,MAAM,oBA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