@mindlogic-ai/logician-ui 3.1.0-alpha.9 → 3.2.0-alpha.0

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 (396) hide show
  1. package/dist/components/Icon/_constants/iconList.d.ts +1 -1
  2. package/dist/components/Icon/_constants/iconList.d.ts.map +1 -1
  3. package/dist/components/Icon/_constants/iconList.js +18 -0
  4. package/dist/components/Icon/_constants/iconList.js.map +1 -1
  5. package/dist/components/Icon/_constants/iconList.mjs +20 -2
  6. package/dist/components/Icon/_constants/iconList.mjs.map +1 -1
  7. package/dist/components/Icon/index.d.ts +2 -1
  8. package/dist/components/Icon/index.d.ts.map +1 -1
  9. package/dist/components/Icon/index.js +20 -1
  10. package/dist/components/Icon/index.js.map +1 -1
  11. package/dist/components/Icon/index.mjs +4 -2
  12. package/dist/components/Icon/index.mjs.map +1 -1
  13. package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
  14. package/dist/components/SegmentedControl/SegmentedControl.js +20 -4
  15. package/dist/components/SegmentedControl/SegmentedControl.js.map +1 -1
  16. package/dist/components/SegmentedControl/SegmentedControl.mjs +20 -4
  17. package/dist/components/SegmentedControl/SegmentedControl.mjs.map +1 -1
  18. package/dist/components/Workflow/Workflow.d.ts +3 -0
  19. package/dist/components/Workflow/Workflow.d.ts.map +1 -0
  20. package/dist/components/Workflow/Workflow.js +109 -0
  21. package/dist/components/Workflow/Workflow.js.map +1 -0
  22. package/dist/components/Workflow/Workflow.mjs +107 -0
  23. package/dist/components/Workflow/Workflow.mjs.map +1 -0
  24. package/dist/components/Workflow/Workflow.translations.json.js +164 -0
  25. package/dist/components/Workflow/Workflow.translations.json.js.map +1 -0
  26. package/dist/components/Workflow/Workflow.translations.json.mjs +138 -0
  27. package/dist/components/Workflow/Workflow.translations.json.mjs.map +1 -0
  28. package/dist/components/Workflow/Workflow.types.d.ts +435 -0
  29. package/dist/components/Workflow/Workflow.types.d.ts.map +1 -0
  30. package/dist/components/Workflow/Workflow.types.js +19 -0
  31. package/dist/components/Workflow/Workflow.types.js.map +1 -0
  32. package/dist/components/Workflow/Workflow.types.mjs +16 -0
  33. package/dist/components/Workflow/Workflow.types.mjs.map +1 -0
  34. package/dist/components/Workflow/WorkflowContext/WorkflowContext.d.ts +10 -0
  35. package/dist/components/Workflow/WorkflowContext/WorkflowContext.d.ts.map +1 -0
  36. package/dist/components/Workflow/WorkflowContext/WorkflowContext.js +163 -0
  37. package/dist/components/Workflow/WorkflowContext/WorkflowContext.js.map +1 -0
  38. package/dist/components/Workflow/WorkflowContext/WorkflowContext.mjs +159 -0
  39. package/dist/components/Workflow/WorkflowContext/WorkflowContext.mjs.map +1 -0
  40. package/dist/components/Workflow/WorkflowContext/WorkflowContext.types.d.ts +117 -0
  41. package/dist/components/Workflow/WorkflowContext/WorkflowContext.types.d.ts.map +1 -0
  42. package/dist/components/Workflow/WorkflowContext/index.d.ts +3 -0
  43. package/dist/components/Workflow/WorkflowContext/index.d.ts.map +1 -0
  44. package/dist/components/Workflow/canvas/Canvas/BranchLabelBadge.d.ts +19 -0
  45. package/dist/components/Workflow/canvas/Canvas/BranchLabelBadge.d.ts.map +1 -0
  46. package/dist/components/Workflow/canvas/Canvas/BranchLabelBadge.js +44 -0
  47. package/dist/components/Workflow/canvas/Canvas/BranchLabelBadge.js.map +1 -0
  48. package/dist/components/Workflow/canvas/Canvas/BranchLabelBadge.mjs +42 -0
  49. package/dist/components/Workflow/canvas/Canvas/BranchLabelBadge.mjs.map +1 -0
  50. package/dist/components/Workflow/canvas/Canvas/Canvas.d.ts +10 -0
  51. package/dist/components/Workflow/canvas/Canvas/Canvas.d.ts.map +1 -0
  52. package/dist/components/Workflow/canvas/Canvas/Canvas.js +531 -0
  53. package/dist/components/Workflow/canvas/Canvas/Canvas.js.map +1 -0
  54. package/dist/components/Workflow/canvas/Canvas/Canvas.mjs +529 -0
  55. package/dist/components/Workflow/canvas/Canvas/Canvas.mjs.map +1 -0
  56. package/dist/components/Workflow/canvas/Canvas/Canvas.styles.d.ts +53 -0
  57. package/dist/components/Workflow/canvas/Canvas/Canvas.styles.d.ts.map +1 -0
  58. package/dist/components/Workflow/canvas/Canvas/Canvas.styles.js +96 -0
  59. package/dist/components/Workflow/canvas/Canvas/Canvas.styles.js.map +1 -0
  60. package/dist/components/Workflow/canvas/Canvas/Canvas.styles.mjs +93 -0
  61. package/dist/components/Workflow/canvas/Canvas/Canvas.styles.mjs.map +1 -0
  62. package/dist/components/Workflow/canvas/Canvas/CanvasControls.d.ts +27 -0
  63. package/dist/components/Workflow/canvas/Canvas/CanvasControls.d.ts.map +1 -0
  64. package/dist/components/Workflow/canvas/Canvas/CanvasControls.js +70 -0
  65. package/dist/components/Workflow/canvas/Canvas/CanvasControls.js.map +1 -0
  66. package/dist/components/Workflow/canvas/Canvas/CanvasControls.mjs +68 -0
  67. package/dist/components/Workflow/canvas/Canvas/CanvasControls.mjs.map +1 -0
  68. package/dist/components/Workflow/canvas/Canvas/LabeledEdge.d.ts +10 -0
  69. package/dist/components/Workflow/canvas/Canvas/LabeledEdge.d.ts.map +1 -0
  70. package/dist/components/Workflow/canvas/Canvas/LabeledEdge.js +106 -0
  71. package/dist/components/Workflow/canvas/Canvas/LabeledEdge.js.map +1 -0
  72. package/dist/components/Workflow/canvas/Canvas/LabeledEdge.mjs +104 -0
  73. package/dist/components/Workflow/canvas/Canvas/LabeledEdge.mjs.map +1 -0
  74. package/dist/components/Workflow/canvas/Canvas/edgeLabelVariant.d.ts +13 -0
  75. package/dist/components/Workflow/canvas/Canvas/edgeLabelVariant.d.ts.map +1 -0
  76. package/dist/components/Workflow/canvas/Canvas/edgeLabelVariant.js +18 -0
  77. package/dist/components/Workflow/canvas/Canvas/edgeLabelVariant.js.map +1 -0
  78. package/dist/components/Workflow/canvas/Canvas/edgeLabelVariant.mjs +16 -0
  79. package/dist/components/Workflow/canvas/Canvas/edgeLabelVariant.mjs.map +1 -0
  80. package/dist/components/Workflow/canvas/Canvas/index.d.ts +2 -0
  81. package/dist/components/Workflow/canvas/Canvas/index.d.ts.map +1 -0
  82. package/dist/components/Workflow/canvas/CollapsibleSection/CollapsibleSection.d.ts +30 -0
  83. package/dist/components/Workflow/canvas/CollapsibleSection/CollapsibleSection.d.ts.map +1 -0
  84. package/dist/components/Workflow/canvas/CollapsibleSection/CollapsibleSection.js +34 -0
  85. package/dist/components/Workflow/canvas/CollapsibleSection/CollapsibleSection.js.map +1 -0
  86. package/dist/components/Workflow/canvas/CollapsibleSection/CollapsibleSection.mjs +32 -0
  87. package/dist/components/Workflow/canvas/CollapsibleSection/CollapsibleSection.mjs.map +1 -0
  88. package/dist/components/Workflow/canvas/CollapsibleSection/index.d.ts +2 -0
  89. package/dist/components/Workflow/canvas/CollapsibleSection/index.d.ts.map +1 -0
  90. package/dist/components/Workflow/canvas/DrawerShell/DrawerHeader.d.ts +37 -0
  91. package/dist/components/Workflow/canvas/DrawerShell/DrawerHeader.d.ts.map +1 -0
  92. package/dist/components/Workflow/canvas/DrawerShell/DrawerHeader.js +33 -0
  93. package/dist/components/Workflow/canvas/DrawerShell/DrawerHeader.js.map +1 -0
  94. package/dist/components/Workflow/canvas/DrawerShell/DrawerHeader.mjs +31 -0
  95. package/dist/components/Workflow/canvas/DrawerShell/DrawerHeader.mjs.map +1 -0
  96. package/dist/components/Workflow/canvas/DrawerShell/DrawerIssues.d.ts +16 -0
  97. package/dist/components/Workflow/canvas/DrawerShell/DrawerIssues.d.ts.map +1 -0
  98. package/dist/components/Workflow/canvas/DrawerShell/DrawerIssues.js +54 -0
  99. package/dist/components/Workflow/canvas/DrawerShell/DrawerIssues.js.map +1 -0
  100. package/dist/components/Workflow/canvas/DrawerShell/DrawerIssues.mjs +52 -0
  101. package/dist/components/Workflow/canvas/DrawerShell/DrawerIssues.mjs.map +1 -0
  102. package/dist/components/Workflow/canvas/DrawerShell/DrawerShell.d.ts +27 -0
  103. package/dist/components/Workflow/canvas/DrawerShell/DrawerShell.d.ts.map +1 -0
  104. package/dist/components/Workflow/canvas/DrawerShell/DrawerShell.js +178 -0
  105. package/dist/components/Workflow/canvas/DrawerShell/DrawerShell.js.map +1 -0
  106. package/dist/components/Workflow/canvas/DrawerShell/DrawerShell.mjs +176 -0
  107. package/dist/components/Workflow/canvas/DrawerShell/DrawerShell.mjs.map +1 -0
  108. package/dist/components/Workflow/canvas/DrawerShell/index.d.ts +3 -0
  109. package/dist/components/Workflow/canvas/DrawerShell/index.d.ts.map +1 -0
  110. package/dist/components/Workflow/canvas/EdgeInspector/BuiltInEdgeInspector.d.ts +12 -0
  111. package/dist/components/Workflow/canvas/EdgeInspector/BuiltInEdgeInspector.d.ts.map +1 -0
  112. package/dist/components/Workflow/canvas/EdgeInspector/BuiltInEdgeInspector.js +68 -0
  113. package/dist/components/Workflow/canvas/EdgeInspector/BuiltInEdgeInspector.js.map +1 -0
  114. package/dist/components/Workflow/canvas/EdgeInspector/BuiltInEdgeInspector.mjs +66 -0
  115. package/dist/components/Workflow/canvas/EdgeInspector/BuiltInEdgeInspector.mjs.map +1 -0
  116. package/dist/components/Workflow/canvas/EdgeInspector/endpointTitle.d.ts +19 -0
  117. package/dist/components/Workflow/canvas/EdgeInspector/endpointTitle.d.ts.map +1 -0
  118. package/dist/components/Workflow/canvas/EdgeInspector/endpointTitle.js +35 -0
  119. package/dist/components/Workflow/canvas/EdgeInspector/endpointTitle.js.map +1 -0
  120. package/dist/components/Workflow/canvas/EdgeInspector/endpointTitle.mjs +32 -0
  121. package/dist/components/Workflow/canvas/EdgeInspector/endpointTitle.mjs.map +1 -0
  122. package/dist/components/Workflow/canvas/EdgeInspector/index.d.ts +3 -0
  123. package/dist/components/Workflow/canvas/EdgeInspector/index.d.ts.map +1 -0
  124. package/dist/components/Workflow/canvas/FieldWrapper/FieldWrapper.d.ts +54 -0
  125. package/dist/components/Workflow/canvas/FieldWrapper/FieldWrapper.d.ts.map +1 -0
  126. package/dist/components/Workflow/canvas/FieldWrapper/FieldWrapper.js +56 -0
  127. package/dist/components/Workflow/canvas/FieldWrapper/FieldWrapper.js.map +1 -0
  128. package/dist/components/Workflow/canvas/FieldWrapper/FieldWrapper.mjs +54 -0
  129. package/dist/components/Workflow/canvas/FieldWrapper/FieldWrapper.mjs.map +1 -0
  130. package/dist/components/Workflow/canvas/FieldWrapper/index.d.ts +3 -0
  131. package/dist/components/Workflow/canvas/FieldWrapper/index.d.ts.map +1 -0
  132. package/dist/components/Workflow/canvas/FloatingCard/FloatingCard.d.ts +16 -0
  133. package/dist/components/Workflow/canvas/FloatingCard/FloatingCard.d.ts.map +1 -0
  134. package/dist/components/Workflow/canvas/FloatingCard/FloatingCard.js +25 -0
  135. package/dist/components/Workflow/canvas/FloatingCard/FloatingCard.js.map +1 -0
  136. package/dist/components/Workflow/canvas/FloatingCard/FloatingCard.mjs +22 -0
  137. package/dist/components/Workflow/canvas/FloatingCard/FloatingCard.mjs.map +1 -0
  138. package/dist/components/Workflow/canvas/FloatingCard/index.d.ts +2 -0
  139. package/dist/components/Workflow/canvas/FloatingCard/index.d.ts.map +1 -0
  140. package/dist/components/Workflow/canvas/GenericNode/GenericNode.d.ts +14 -0
  141. package/dist/components/Workflow/canvas/GenericNode/GenericNode.d.ts.map +1 -0
  142. package/dist/components/Workflow/canvas/GenericNode/GenericNode.js +61 -0
  143. package/dist/components/Workflow/canvas/GenericNode/GenericNode.js.map +1 -0
  144. package/dist/components/Workflow/canvas/GenericNode/GenericNode.mjs +59 -0
  145. package/dist/components/Workflow/canvas/GenericNode/GenericNode.mjs.map +1 -0
  146. package/dist/components/Workflow/canvas/GenericNode/GenericNode.types.d.ts +11 -0
  147. package/dist/components/Workflow/canvas/GenericNode/GenericNode.types.d.ts.map +1 -0
  148. package/dist/components/Workflow/canvas/GenericNode/index.d.ts +3 -0
  149. package/dist/components/Workflow/canvas/GenericNode/index.d.ts.map +1 -0
  150. package/dist/components/Workflow/canvas/GraphErrorBanner/GraphErrorBanner.d.ts +15 -0
  151. package/dist/components/Workflow/canvas/GraphErrorBanner/GraphErrorBanner.d.ts.map +1 -0
  152. package/dist/components/Workflow/canvas/GraphErrorBanner/GraphErrorBanner.js +145 -0
  153. package/dist/components/Workflow/canvas/GraphErrorBanner/GraphErrorBanner.js.map +1 -0
  154. package/dist/components/Workflow/canvas/GraphErrorBanner/GraphErrorBanner.mjs +143 -0
  155. package/dist/components/Workflow/canvas/GraphErrorBanner/GraphErrorBanner.mjs.map +1 -0
  156. package/dist/components/Workflow/canvas/GraphErrorBanner/index.d.ts +2 -0
  157. package/dist/components/Workflow/canvas/GraphErrorBanner/index.d.ts.map +1 -0
  158. package/dist/components/Workflow/canvas/IconTile/IconTile.d.ts +10 -0
  159. package/dist/components/Workflow/canvas/IconTile/IconTile.d.ts.map +1 -0
  160. package/dist/components/Workflow/canvas/IconTile/IconTile.js +21 -0
  161. package/dist/components/Workflow/canvas/IconTile/IconTile.js.map +1 -0
  162. package/dist/components/Workflow/canvas/IconTile/IconTile.mjs +19 -0
  163. package/dist/components/Workflow/canvas/IconTile/IconTile.mjs.map +1 -0
  164. package/dist/components/Workflow/canvas/IconTile/IconTile.styles.d.ts +18 -0
  165. package/dist/components/Workflow/canvas/IconTile/IconTile.styles.d.ts.map +1 -0
  166. package/dist/components/Workflow/canvas/IconTile/IconTile.styles.js +40 -0
  167. package/dist/components/Workflow/canvas/IconTile/IconTile.styles.js.map +1 -0
  168. package/dist/components/Workflow/canvas/IconTile/IconTile.styles.mjs +37 -0
  169. package/dist/components/Workflow/canvas/IconTile/IconTile.styles.mjs.map +1 -0
  170. package/dist/components/Workflow/canvas/IconTile/IconTile.types.d.ts +15 -0
  171. package/dist/components/Workflow/canvas/IconTile/IconTile.types.d.ts.map +1 -0
  172. package/dist/components/Workflow/canvas/IconTile/index.d.ts +4 -0
  173. package/dist/components/Workflow/canvas/IconTile/index.d.ts.map +1 -0
  174. package/dist/components/Workflow/canvas/IssueList/IssueList.d.ts +24 -0
  175. package/dist/components/Workflow/canvas/IssueList/IssueList.d.ts.map +1 -0
  176. package/dist/components/Workflow/canvas/IssueList/IssueList.js +34 -0
  177. package/dist/components/Workflow/canvas/IssueList/IssueList.js.map +1 -0
  178. package/dist/components/Workflow/canvas/IssueList/IssueList.mjs +32 -0
  179. package/dist/components/Workflow/canvas/IssueList/IssueList.mjs.map +1 -0
  180. package/dist/components/Workflow/canvas/IssueList/index.d.ts +2 -0
  181. package/dist/components/Workflow/canvas/IssueList/index.d.ts.map +1 -0
  182. package/dist/components/Workflow/canvas/NodePalette/NodePalette.d.ts +9 -0
  183. package/dist/components/Workflow/canvas/NodePalette/NodePalette.d.ts.map +1 -0
  184. package/dist/components/Workflow/canvas/NodePalette/NodePalette.js +94 -0
  185. package/dist/components/Workflow/canvas/NodePalette/NodePalette.js.map +1 -0
  186. package/dist/components/Workflow/canvas/NodePalette/NodePalette.mjs +92 -0
  187. package/dist/components/Workflow/canvas/NodePalette/NodePalette.mjs.map +1 -0
  188. package/dist/components/Workflow/canvas/NodePalette/NodePalette.styles.d.ts +7 -0
  189. package/dist/components/Workflow/canvas/NodePalette/NodePalette.styles.d.ts.map +1 -0
  190. package/dist/components/Workflow/canvas/NodePalette/NodePalette.styles.js +13 -0
  191. package/dist/components/Workflow/canvas/NodePalette/NodePalette.styles.js.map +1 -0
  192. package/dist/components/Workflow/canvas/NodePalette/NodePalette.styles.mjs +10 -0
  193. package/dist/components/Workflow/canvas/NodePalette/NodePalette.styles.mjs.map +1 -0
  194. package/dist/components/Workflow/canvas/NodePalette/NodePaletteToggle.d.ts +10 -0
  195. package/dist/components/Workflow/canvas/NodePalette/NodePaletteToggle.d.ts.map +1 -0
  196. package/dist/components/Workflow/canvas/NodePalette/NodePaletteToggle.js +28 -0
  197. package/dist/components/Workflow/canvas/NodePalette/NodePaletteToggle.js.map +1 -0
  198. package/dist/components/Workflow/canvas/NodePalette/NodePaletteToggle.mjs +26 -0
  199. package/dist/components/Workflow/canvas/NodePalette/NodePaletteToggle.mjs.map +1 -0
  200. package/dist/components/Workflow/canvas/NodePalette/index.d.ts +4 -0
  201. package/dist/components/Workflow/canvas/NodePalette/index.d.ts.map +1 -0
  202. package/dist/components/Workflow/canvas/NodeShell/NodeShell.d.ts +3 -0
  203. package/dist/components/Workflow/canvas/NodeShell/NodeShell.d.ts.map +1 -0
  204. package/dist/components/Workflow/canvas/NodeShell/NodeShell.js +137 -0
  205. package/dist/components/Workflow/canvas/NodeShell/NodeShell.js.map +1 -0
  206. package/dist/components/Workflow/canvas/NodeShell/NodeShell.mjs +135 -0
  207. package/dist/components/Workflow/canvas/NodeShell/NodeShell.mjs.map +1 -0
  208. package/dist/components/Workflow/canvas/NodeShell/NodeShell.styles.d.ts +66 -0
  209. package/dist/components/Workflow/canvas/NodeShell/NodeShell.styles.d.ts.map +1 -0
  210. package/dist/components/Workflow/canvas/NodeShell/NodeShell.styles.js +87 -0
  211. package/dist/components/Workflow/canvas/NodeShell/NodeShell.styles.js.map +1 -0
  212. package/dist/components/Workflow/canvas/NodeShell/NodeShell.styles.mjs +77 -0
  213. package/dist/components/Workflow/canvas/NodeShell/NodeShell.styles.mjs.map +1 -0
  214. package/dist/components/Workflow/canvas/NodeShell/NodeShell.types.d.ts +35 -0
  215. package/dist/components/Workflow/canvas/NodeShell/NodeShell.types.d.ts.map +1 -0
  216. package/dist/components/Workflow/canvas/NodeShell/index.d.ts +4 -0
  217. package/dist/components/Workflow/canvas/NodeShell/index.d.ts.map +1 -0
  218. package/dist/components/Workflow/canvas/SeverityDot/SeverityDot.d.ts +15 -0
  219. package/dist/components/Workflow/canvas/SeverityDot/SeverityDot.d.ts.map +1 -0
  220. package/dist/components/Workflow/canvas/SeverityDot/SeverityDot.js +14 -0
  221. package/dist/components/Workflow/canvas/SeverityDot/SeverityDot.js.map +1 -0
  222. package/dist/components/Workflow/canvas/SeverityDot/SeverityDot.mjs +12 -0
  223. package/dist/components/Workflow/canvas/SeverityDot/SeverityDot.mjs.map +1 -0
  224. package/dist/components/Workflow/canvas/SeverityDot/index.d.ts +2 -0
  225. package/dist/components/Workflow/canvas/SeverityDot/index.d.ts.map +1 -0
  226. package/dist/components/Workflow/canvas/issueSeverity.d.ts +23 -0
  227. package/dist/components/Workflow/canvas/issueSeverity.d.ts.map +1 -0
  228. package/dist/components/Workflow/canvas/issueSeverity.js +51 -0
  229. package/dist/components/Workflow/canvas/issueSeverity.js.map +1 -0
  230. package/dist/components/Workflow/canvas/issueSeverity.mjs +47 -0
  231. package/dist/components/Workflow/canvas/issueSeverity.mjs.map +1 -0
  232. package/dist/components/Workflow/canvas/useFieldFocusRequest.d.ts +14 -0
  233. package/dist/components/Workflow/canvas/useFieldFocusRequest.d.ts.map +1 -0
  234. package/dist/components/Workflow/canvas/useFieldFocusRequest.js +48 -0
  235. package/dist/components/Workflow/canvas/useFieldFocusRequest.js.map +1 -0
  236. package/dist/components/Workflow/canvas/useFieldFocusRequest.mjs +46 -0
  237. package/dist/components/Workflow/canvas/useFieldFocusRequest.mjs.map +1 -0
  238. package/dist/components/Workflow/canvas/workflowLabelProps.d.ts +12 -0
  239. package/dist/components/Workflow/canvas/workflowLabelProps.d.ts.map +1 -0
  240. package/dist/components/Workflow/canvas/workflowLabelProps.js +17 -0
  241. package/dist/components/Workflow/canvas/workflowLabelProps.js.map +1 -0
  242. package/dist/components/Workflow/canvas/workflowLabelProps.mjs +15 -0
  243. package/dist/components/Workflow/canvas/workflowLabelProps.mjs.map +1 -0
  244. package/dist/components/Workflow/connectionRules.d.ts +59 -0
  245. package/dist/components/Workflow/connectionRules.d.ts.map +1 -0
  246. package/dist/components/Workflow/connectionRules.js +150 -0
  247. package/dist/components/Workflow/connectionRules.js.map +1 -0
  248. package/dist/components/Workflow/connectionRules.mjs +145 -0
  249. package/dist/components/Workflow/connectionRules.mjs.map +1 -0
  250. package/dist/components/Workflow/createNode.d.ts +27 -0
  251. package/dist/components/Workflow/createNode.d.ts.map +1 -0
  252. package/dist/components/Workflow/createNode.js +66 -0
  253. package/dist/components/Workflow/createNode.js.map +1 -0
  254. package/dist/components/Workflow/createNode.mjs +62 -0
  255. package/dist/components/Workflow/createNode.mjs.map +1 -0
  256. package/dist/components/Workflow/graphHistory.d.ts +23 -0
  257. package/dist/components/Workflow/graphHistory.d.ts.map +1 -0
  258. package/dist/components/Workflow/graphHistory.js +73 -0
  259. package/dist/components/Workflow/graphHistory.js.map +1 -0
  260. package/dist/components/Workflow/graphHistory.mjs +70 -0
  261. package/dist/components/Workflow/graphHistory.mjs.map +1 -0
  262. package/dist/components/Workflow/graphObserver.d.ts +13 -0
  263. package/dist/components/Workflow/graphObserver.d.ts.map +1 -0
  264. package/dist/components/Workflow/graphObserver.js +11 -0
  265. package/dist/components/Workflow/graphObserver.js.map +1 -0
  266. package/dist/components/Workflow/graphObserver.mjs +8 -0
  267. package/dist/components/Workflow/graphObserver.mjs.map +1 -0
  268. package/dist/components/Workflow/graphReducer.d.ts +75 -0
  269. package/dist/components/Workflow/graphReducer.d.ts.map +1 -0
  270. package/dist/components/Workflow/graphReducer.js +122 -0
  271. package/dist/components/Workflow/graphReducer.js.map +1 -0
  272. package/dist/components/Workflow/graphReducer.mjs +119 -0
  273. package/dist/components/Workflow/graphReducer.mjs.map +1 -0
  274. package/dist/components/Workflow/index.d.ts +22 -0
  275. package/dist/components/Workflow/index.d.ts.map +1 -0
  276. package/dist/components/Workflow/layout/autoLayout.d.ts +49 -0
  277. package/dist/components/Workflow/layout/autoLayout.d.ts.map +1 -0
  278. package/dist/components/Workflow/layout/autoLayout.js +149 -0
  279. package/dist/components/Workflow/layout/autoLayout.js.map +1 -0
  280. package/dist/components/Workflow/layout/autoLayout.mjs +146 -0
  281. package/dist/components/Workflow/layout/autoLayout.mjs.map +1 -0
  282. package/dist/components/Workflow/stories/toyNodeTypes.d.ts +40 -0
  283. package/dist/components/Workflow/stories/toyNodeTypes.d.ts.map +1 -0
  284. package/dist/components/Workflow/useWorkflowIssueMessage.d.ts +15 -0
  285. package/dist/components/Workflow/useWorkflowIssueMessage.d.ts.map +1 -0
  286. package/dist/components/Workflow/useWorkflowIssueMessage.js +45 -0
  287. package/dist/components/Workflow/useWorkflowIssueMessage.js.map +1 -0
  288. package/dist/components/Workflow/useWorkflowIssueMessage.mjs +43 -0
  289. package/dist/components/Workflow/useWorkflowIssueMessage.mjs.map +1 -0
  290. package/dist/components/Workflow/useWorkflowKeyboard.d.ts +10 -0
  291. package/dist/components/Workflow/useWorkflowKeyboard.d.ts.map +1 -0
  292. package/dist/components/Workflow/useWorkflowKeyboard.js +116 -0
  293. package/dist/components/Workflow/useWorkflowKeyboard.js.map +1 -0
  294. package/dist/components/Workflow/useWorkflowKeyboard.mjs +114 -0
  295. package/dist/components/Workflow/useWorkflowKeyboard.mjs.map +1 -0
  296. package/dist/icons.js +17 -0
  297. package/dist/icons.js.map +1 -1
  298. package/dist/icons.mjs +1 -1
  299. package/dist/index.d.ts +1 -0
  300. package/dist/index.d.ts.map +1 -1
  301. package/dist/index.js +38 -0
  302. package/dist/index.js.map +1 -1
  303. package/dist/index.mjs +14 -0
  304. package/dist/index.mjs.map +1 -1
  305. package/dist/test-support/setup.d.ts +5 -0
  306. package/dist/test-support/setup.d.ts.map +1 -0
  307. package/dist/theme/colors.d.ts +196 -44
  308. package/dist/theme/colors.d.ts.map +1 -1
  309. package/dist/theme/colors.js +184 -22
  310. package/dist/theme/colors.js.map +1 -1
  311. package/dist/theme/colors.mjs +184 -22
  312. package/dist/theme/colors.mjs.map +1 -1
  313. package/dist/theme/global.d.ts.map +1 -1
  314. package/dist/theme/global.js +30 -2
  315. package/dist/theme/global.js.map +1 -1
  316. package/dist/theme/global.mjs +30 -2
  317. package/dist/theme/global.mjs.map +1 -1
  318. package/package.json +10 -2
  319. package/src/components/Icon/_constants/iconList.ts +35 -0
  320. package/src/components/Icon/index.tsx +20 -0
  321. package/src/components/SegmentedControl/SegmentedControl.tsx +21 -4
  322. package/src/components/Workflow/README.md +362 -0
  323. package/src/components/Workflow/Workflow.translations.json +112 -0
  324. package/src/components/Workflow/Workflow.tsx +189 -0
  325. package/src/components/Workflow/Workflow.types.ts +496 -0
  326. package/src/components/Workflow/WorkflowContext/WorkflowContext.tsx +215 -0
  327. package/src/components/Workflow/WorkflowContext/WorkflowContext.types.ts +122 -0
  328. package/src/components/Workflow/WorkflowContext/index.ts +10 -0
  329. package/src/components/Workflow/WorkflowContext/workflowSelection.test.tsx +93 -0
  330. package/src/components/Workflow/canvas/Canvas/BranchLabelBadge.tsx +69 -0
  331. package/src/components/Workflow/canvas/Canvas/Canvas.styles.ts +91 -0
  332. package/src/components/Workflow/canvas/Canvas/Canvas.tsx +773 -0
  333. package/src/components/Workflow/canvas/Canvas/CanvasControls.tsx +178 -0
  334. package/src/components/Workflow/canvas/Canvas/LabeledEdge.tsx +198 -0
  335. package/src/components/Workflow/canvas/Canvas/edgeLabelVariant.test.ts +26 -0
  336. package/src/components/Workflow/canvas/Canvas/edgeLabelVariant.ts +23 -0
  337. package/src/components/Workflow/canvas/Canvas/index.ts +1 -0
  338. package/src/components/Workflow/canvas/CollapsibleSection/CollapsibleSection.tsx +96 -0
  339. package/src/components/Workflow/canvas/CollapsibleSection/index.ts +4 -0
  340. package/src/components/Workflow/canvas/DrawerShell/DrawerHeader.tsx +104 -0
  341. package/src/components/Workflow/canvas/DrawerShell/DrawerIssues.tsx +115 -0
  342. package/src/components/Workflow/canvas/DrawerShell/DrawerShell.tsx +408 -0
  343. package/src/components/Workflow/canvas/DrawerShell/index.ts +2 -0
  344. package/src/components/Workflow/canvas/EdgeInspector/BuiltInEdgeInspector.tsx +135 -0
  345. package/src/components/Workflow/canvas/EdgeInspector/endpointTitle.ts +38 -0
  346. package/src/components/Workflow/canvas/EdgeInspector/index.ts +2 -0
  347. package/src/components/Workflow/canvas/FieldWrapper/FieldWrapper.tsx +118 -0
  348. package/src/components/Workflow/canvas/FieldWrapper/index.ts +6 -0
  349. package/src/components/Workflow/canvas/FloatingCard/FloatingCard.tsx +37 -0
  350. package/src/components/Workflow/canvas/FloatingCard/index.ts +1 -0
  351. package/src/components/Workflow/canvas/GenericNode/GenericNode.tsx +114 -0
  352. package/src/components/Workflow/canvas/GenericNode/GenericNode.types.ts +10 -0
  353. package/src/components/Workflow/canvas/GenericNode/index.ts +5 -0
  354. package/src/components/Workflow/canvas/GraphErrorBanner/GraphErrorBanner.tsx +284 -0
  355. package/src/components/Workflow/canvas/GraphErrorBanner/index.ts +1 -0
  356. package/src/components/Workflow/canvas/IconTile/IconTile.styles.ts +40 -0
  357. package/src/components/Workflow/canvas/IconTile/IconTile.tsx +36 -0
  358. package/src/components/Workflow/canvas/IconTile/IconTile.types.ts +13 -0
  359. package/src/components/Workflow/canvas/IconTile/index.ts +7 -0
  360. package/src/components/Workflow/canvas/IssueList/IssueList.tsx +84 -0
  361. package/src/components/Workflow/canvas/IssueList/index.ts +1 -0
  362. package/src/components/Workflow/canvas/NodePalette/NodePalette.styles.ts +7 -0
  363. package/src/components/Workflow/canvas/NodePalette/NodePalette.tsx +180 -0
  364. package/src/components/Workflow/canvas/NodePalette/NodePaletteToggle.tsx +39 -0
  365. package/src/components/Workflow/canvas/NodePalette/index.ts +3 -0
  366. package/src/components/Workflow/canvas/NodeShell/NodeShell.styles.ts +84 -0
  367. package/src/components/Workflow/canvas/NodeShell/NodeShell.tsx +321 -0
  368. package/src/components/Workflow/canvas/NodeShell/NodeShell.types.ts +45 -0
  369. package/src/components/Workflow/canvas/NodeShell/index.ts +8 -0
  370. package/src/components/Workflow/canvas/SeverityDot/SeverityDot.tsx +33 -0
  371. package/src/components/Workflow/canvas/SeverityDot/index.ts +1 -0
  372. package/src/components/Workflow/canvas/issueSeverity.ts +48 -0
  373. package/src/components/Workflow/canvas/useFieldFocusRequest.ts +54 -0
  374. package/src/components/Workflow/canvas/workflowLabelProps.ts +11 -0
  375. package/src/components/Workflow/connectionRules.test.ts +326 -0
  376. package/src/components/Workflow/connectionRules.ts +190 -0
  377. package/src/components/Workflow/createNode.test.ts +61 -0
  378. package/src/components/Workflow/createNode.ts +67 -0
  379. package/src/components/Workflow/graphHistory.test.ts +178 -0
  380. package/src/components/Workflow/graphHistory.ts +91 -0
  381. package/src/components/Workflow/graphObserver.ts +21 -0
  382. package/src/components/Workflow/graphReducer.test.ts +314 -0
  383. package/src/components/Workflow/graphReducer.ts +196 -0
  384. package/src/components/Workflow/index.ts +74 -0
  385. package/src/components/Workflow/layout/autoLayout.test.ts +170 -0
  386. package/src/components/Workflow/layout/autoLayout.ts +200 -0
  387. package/src/components/Workflow/stories/Workflow.stories.tsx +111 -0
  388. package/src/components/Workflow/stories/toyNodeTypes.tsx +146 -0
  389. package/src/components/Workflow/useWorkflowIssueMessage.test.ts +101 -0
  390. package/src/components/Workflow/useWorkflowIssueMessage.ts +49 -0
  391. package/src/components/Workflow/useWorkflowKeyboard.ts +126 -0
  392. package/src/index.ts +1 -0
  393. package/src/test-support/setup.ts +11 -0
  394. package/src/theme/SemanticTokens.mdx +61 -7
  395. package/src/theme/colors.ts +216 -26
  396. package/src/theme/global.ts +31 -2
@@ -0,0 +1,189 @@
1
+ 'use client';
2
+
3
+ import { useCallback, useEffect, useMemo, useReducer, useRef } from 'react';
4
+ import { Box } from '@chakra-ui/react';
5
+
6
+ import { useTranslate } from '@/hooks/useTranslate';
7
+
8
+ import { Canvas } from './canvas/Canvas';
9
+ import { historyReducer, initHistory } from './graphHistory';
10
+ import { useWorkflowGraphObserver } from './graphObserver';
11
+ import { emptyGraph } from './graphReducer';
12
+ import WorkflowTranslations from './Workflow.translations.json';
13
+ import type {
14
+ Graph,
15
+ Issue,
16
+ NodeTypeRegistry,
17
+ WorkflowProps,
18
+ WorkflowTranslate,
19
+ } from './Workflow.types';
20
+ import { WorkflowProvider } from './WorkflowContext';
21
+
22
+ const EMPTY_ISSUES: Issue[] = [];
23
+
24
+ export function Workflow({
25
+ nodeTypes: nodeTypeList,
26
+ graph: controlledGraph,
27
+ onGraphChange,
28
+ onArrange,
29
+ onHistoryNavigate,
30
+ defaultGraph,
31
+ issues: providedIssues,
32
+ readOnly = false,
33
+ validating = false,
34
+ showPalette = true,
35
+ onNodeClick,
36
+ onEdgeClick,
37
+ onSelectionChange,
38
+ onIssuesChange,
39
+ footer,
40
+ children,
41
+ categoryTokens,
42
+ hostBridge,
43
+ translate: providedTranslate,
44
+ minHeight = '500px',
45
+ }: WorkflowProps) {
46
+ const isControlled = controlledGraph !== undefined;
47
+
48
+ // Chrome copy is host-injected so the core carries no app i18n dependency.
49
+ // The host translator also resolves the node-type `descriptionKey`s it
50
+ // registers. Without one, fall back to the bundled defaults.
51
+ const fallbackTranslate = useTranslate(
52
+ WorkflowTranslations
53
+ ) as WorkflowTranslate;
54
+ const translate = providedTranslate ?? fallbackTranslate;
55
+
56
+ // Internal reducer is always the source of truth — even in controlled mode.
57
+ // This avoids race conditions when multiple actions fire in the same React
58
+ // batch: with a stale-closure dispatch wrapper around the host's setState,
59
+ // the second action would compute from the original graph. By always
60
+ // reducing locally and notifying the host via effect, both actions see the
61
+ // updated state in sequence.
62
+ const [history, dispatch] = useReducer(
63
+ historyReducer,
64
+ controlledGraph ?? defaultGraph ?? emptyGraph,
65
+ initHistory
66
+ );
67
+ const graph = history.present;
68
+
69
+ const canUndo = history.past.length > 0;
70
+ const canRedo = history.future.length > 0;
71
+
72
+ // An undo/redo can revert to a graph that differs from the saved baseline
73
+ // ONLY in node positions (e.g. undoing an auto-arrange). The host's autosave
74
+ // ignores position-only diffs, so we flag the navigation and hand the host the
75
+ // result via `onHistoryNavigate` to force-persist it. We gate out no-op
76
+ // presses: they never change `graph`, so the flag would otherwise strand and
77
+ // mis-fire on the next edit.
78
+ const pendingHistoryNavRef = useRef(false);
79
+ const undo = useCallback(() => {
80
+ if (!canUndo) return;
81
+ pendingHistoryNavRef.current = true;
82
+ dispatch({ type: 'undo' });
83
+ }, [canUndo]);
84
+ const redo = useCallback(() => {
85
+ if (!canRedo) return;
86
+ pendingHistoryNavRef.current = true;
87
+ dispatch({ type: 'redo' });
88
+ }, [canRedo]);
89
+
90
+ // Sync controlled prop INTO internal state when the host updates externally
91
+ // (e.g. undo from outside, server-pushed change). Identity-based skip avoids
92
+ // loops with our own onGraphChange.
93
+ const lastControlledRef = useRef<Graph | undefined>(controlledGraph);
94
+ useEffect(() => {
95
+ if (!isControlled || controlledGraph === undefined) return;
96
+ if (controlledGraph === graph) return;
97
+ if (controlledGraph === lastControlledRef.current) return;
98
+ lastControlledRef.current = controlledGraph;
99
+ dispatch({ type: 'replace', graph: controlledGraph });
100
+ }, [controlledGraph, isControlled, graph]);
101
+
102
+ // Notify host OUT when internal graph changes (controlled mode only).
103
+ const firstNotifyRef = useRef(true);
104
+ useEffect(() => {
105
+ if (!isControlled) return;
106
+ if (firstNotifyRef.current) {
107
+ firstNotifyRef.current = false;
108
+ return;
109
+ }
110
+ if (graph === lastControlledRef.current) return;
111
+ lastControlledRef.current = graph;
112
+ onGraphChange?.(graph);
113
+ // A position-only undo/redo settles to 'saved' via onGraphChange above and
114
+ // would otherwise not persist; let the host force-save the result.
115
+ if (pendingHistoryNavRef.current) {
116
+ pendingHistoryNavRef.current = false;
117
+ onHistoryNavigate?.(graph);
118
+ }
119
+ }, [graph, isControlled, onGraphChange, onHistoryNavigate]);
120
+
121
+ const registry: NodeTypeRegistry = useMemo(() => {
122
+ const map: NodeTypeRegistry = {};
123
+ for (const def of nodeTypeList) map[def.kind] = def;
124
+ return map;
125
+ }, [nodeTypeList]);
126
+
127
+ // Validation lives on the backend — the editor just renders whatever the
128
+ // most recent save response returned. `providedIssues` is the only source.
129
+ const issues = providedIssues ?? EMPTY_ISSUES;
130
+
131
+ useEffect(() => {
132
+ onIssuesChange?.(issues);
133
+ }, [issues, onIssuesChange]);
134
+
135
+ // Optional ancestor-provided observer — lets a parent watch the graph
136
+ // without taking control of it. Used by the Storybook JSON-preview
137
+ // decorator; no provider exists in production, so this is a no-op there.
138
+ const observeGraph = useWorkflowGraphObserver();
139
+ useEffect(() => {
140
+ observeGraph?.(graph);
141
+ }, [graph, observeGraph]);
142
+
143
+ return (
144
+ <WorkflowProvider
145
+ graph={graph}
146
+ dispatch={dispatch}
147
+ undo={undo}
148
+ redo={redo}
149
+ canUndo={canUndo}
150
+ canRedo={canRedo}
151
+ nodeTypes={registry}
152
+ translate={translate}
153
+ issues={issues}
154
+ onArrange={onArrange}
155
+ readOnly={readOnly}
156
+ onSelectionChange={onSelectionChange}
157
+ validating={validating}
158
+ categoryTokens={categoryTokens}
159
+ hostBridge={hostBridge}
160
+ >
161
+ <Box
162
+ display="flex"
163
+ flexDirection="column"
164
+ height="100%"
165
+ width="100%"
166
+ minHeight={minHeight}
167
+ >
168
+ <Canvas
169
+ showPalette={showPalette && !readOnly}
170
+ onNodeClick={onNodeClick}
171
+ onEdgeClick={onEdgeClick}
172
+ >
173
+ {children}
174
+ </Canvas>
175
+ {footer ? (
176
+ <Box
177
+ borderTop="1px solid"
178
+ borderColor="slate.200"
179
+ bg="bg.surface"
180
+ px={4}
181
+ py={2}
182
+ >
183
+ {footer}
184
+ </Box>
185
+ ) : null}
186
+ </Box>
187
+ </WorkflowProvider>
188
+ );
189
+ }
@@ -0,0 +1,496 @@
1
+ import type { ComponentType, ReactNode } from 'react';
2
+
3
+ import { type CreatedIcon } from '@/components/Icon';
4
+
5
+ import type { CategoryTokenMap } from './canvas/IconTile';
6
+
7
+ /**
8
+ * Generic, domain-free types for the Workflow editor framework.
9
+ *
10
+ * Host apps register NodeTypeDef entries and pass them via props. The framework
11
+ * itself knows nothing about "agent" or "classify" — host registries (under
12
+ * adapters/) provide that.
13
+ */
14
+
15
+ export type Position = { x: number; y: number };
16
+
17
+ /** Which side a canvas surface (inspector drawer, etc.) docks on. */
18
+ export type DockSide = 'left' | 'right';
19
+
20
+ /**
21
+ * Translator the editor uses for all of its chrome copy (palette, controls,
22
+ * inspector, issue messages). Injected by the host so the core stays domain-
23
+ * and i18n-framework-agnostic: the host passes a function bound to its own
24
+ * locale + translation catalog (which also resolves the node-type
25
+ * `descriptionKey`s the host registers). When omitted, the component falls back
26
+ * to its bundled defaults.
27
+ *
28
+ * Mirrors the common `(key, vars) => text` shape; returns `ReactNode` because
29
+ * some translators interpolate React elements. Call sites that need a string
30
+ * (aria labels, placeholders) cast the result.
31
+ */
32
+ export type WorkflowTranslate = (
33
+ key: string,
34
+ vars?: Record<string, string | number>
35
+ ) => ReactNode;
36
+
37
+ export type HandleDef = {
38
+ id: string;
39
+ label?: string;
40
+ };
41
+
42
+ export type GraphNode<TConfig = unknown> = {
43
+ id: string;
44
+ kind: string;
45
+ position: Position;
46
+ config: TConfig;
47
+ };
48
+
49
+ export type GraphEdge = {
50
+ id: string;
51
+ source: string;
52
+ target: string;
53
+ sourceHandle?: string;
54
+ targetHandle?: string;
55
+ label?: string;
56
+ };
57
+
58
+ export type Graph = {
59
+ nodes: GraphNode[];
60
+ edges: GraphEdge[];
61
+ };
62
+
63
+ export type IssueSeverity = 'error' | 'warning';
64
+
65
+ export type Issue = {
66
+ nodeId?: string;
67
+ edgeId?: string;
68
+ handleId?: string;
69
+ /**
70
+ * Identifies the specific input the issue belongs to (e.g. `'name'`,
71
+ * `'model'`). Lets the drawer render the issue inline beneath the matching
72
+ * field instead of as a separate list. Optional — graph-wide and
73
+ * node-without-a-field issues leave it undefined.
74
+ */
75
+ fieldKey?: string;
76
+ severity: IssueSeverity;
77
+ code: string;
78
+ /**
79
+ * English fallback message. Used by tests, logs, and any surface that
80
+ * doesn't run the `useWorkflowIssueMessage` hook (which maps `code` +
81
+ * `messageVars` to a localized string).
82
+ */
83
+ message: string;
84
+ /**
85
+ * Interpolation values consumed by `useWorkflowIssueMessage`. Mirror the
86
+ * `{var}` placeholders in the matching translation key.
87
+ */
88
+ messageVars?: Record<string, string | number>;
89
+ };
90
+
91
+ export type RunState = 'idle' | 'running' | 'done' | 'error';
92
+
93
+ export type MetaChipTone = 'default' | 'danger' | 'warning';
94
+
95
+ export type MetaChipSpec =
96
+ | string
97
+ | { readonly text: string; readonly tone?: MetaChipTone };
98
+
99
+ export type NodeRenderProps<TConfig = unknown> = {
100
+ id: string;
101
+ config: TConfig;
102
+ selected: boolean;
103
+ runState: RunState;
104
+ issues: Issue[];
105
+ };
106
+
107
+ export type DrawerRenderProps<TConfig = unknown> = {
108
+ id: string;
109
+ config: TConfig;
110
+ onChange: (next: TConfig) => void;
111
+ issues: Issue[];
112
+ /**
113
+ * Editor is read-only (published view / no edit permission) — inspectors
114
+ * should disable mutating controls.
115
+ */
116
+ readOnly: boolean;
117
+ /**
118
+ * Opaque host bridge from the editor (see `WorkflowProps.hostBridge`).
119
+ * FactChat node-types narrow it (e.g. to `WorkflowHostBridge`) to reach
120
+ * chatbot-scoped data; the core stays decoupled.
121
+ */
122
+ hostBridge?: unknown;
123
+ };
124
+
125
+ /**
126
+ * Props passed to a host-supplied edge inspector (`WorkflowProps.renderEdgeDrawer`).
127
+ *
128
+ * Mirrors `DrawerRenderProps` for nodes so the framework core stays domain-free:
129
+ * the host owns edge-specific UI (e.g. future edge conditions / CEL) while the
130
+ * core only knows how to mount it. When no host renderer is provided the editor
131
+ * falls back to a built-in inspector (editable label + read-only endpoints).
132
+ */
133
+ export type EdgeDrawerRenderProps = {
134
+ edge: GraphEdge;
135
+ /** Persist an edited edge — dispatches `updateEdge` so changes are undoable. */
136
+ onChange: (next: GraphEdge) => void;
137
+ /** Editor is read-only — disable mutating controls. */
138
+ readOnly: boolean;
139
+ /** Issues whose `edgeId` matches this edge. */
140
+ issues: Issue[];
141
+ /** Opaque host bridge (see `WorkflowProps.hostBridge`). */
142
+ hostBridge?: unknown;
143
+ };
144
+
145
+ export type ConnectionCtx = {
146
+ source: GraphNode;
147
+ sourceHandle?: string;
148
+ target: GraphNode;
149
+ targetHandle?: string;
150
+ graph: Graph;
151
+ };
152
+
153
+ /**
154
+ * Minimal JSON Schema 7-ish subset. Kept local to avoid pulling a 200kB schema
155
+ * lib for a half-dozen field types. Host adapters can produce anything
156
+ * compatible with the strict subset OpenAI / Gemini / Pydantic agree on.
157
+ */
158
+ export type JSONSchema =
159
+ | {
160
+ type: 'string';
161
+ description?: string;
162
+ enum?: string[];
163
+ nullable?: boolean;
164
+ }
165
+ | {
166
+ type: 'number' | 'integer';
167
+ description?: string;
168
+ minimum?: number;
169
+ maximum?: number;
170
+ nullable?: boolean;
171
+ }
172
+ | { type: 'boolean'; description?: string; nullable?: boolean }
173
+ | {
174
+ type: 'array';
175
+ items: JSONSchema;
176
+ description?: string;
177
+ nullable?: boolean;
178
+ }
179
+ | {
180
+ type: 'object';
181
+ properties: Record<string, JSONSchema>;
182
+ required?: string[];
183
+ additionalProperties?: boolean;
184
+ description?: string;
185
+ nullable?: boolean;
186
+ };
187
+
188
+ /**
189
+ * Optional declarative placement constraints. Validation itself is owned by
190
+ * the backend now; these stay on the node-type contract because the palette
191
+ * and canvas read them (e.g. `pinned` wires React Flow's `deletable`).
192
+ *
193
+ * - `role: 'start' | 'end'` marks entry/terminal kinds.
194
+ * - `mustFollowDirectly` is OR semantics: a node passes if at least one of
195
+ * its direct parents matches the whitelist.
196
+ */
197
+ export type PlacementRule = {
198
+ minCount?: number;
199
+ maxCount?: number;
200
+ mustFollowDirectly?: string[];
201
+ mustFollow?: string[];
202
+ /** Cannot be deleted by the user. React Flow's `deletable` is wired to !pinned. */
203
+ pinned?: boolean;
204
+ /** Semantic role used by the validator to infer entry/terminal kinds. */
205
+ role?: 'start' | 'end';
206
+ };
207
+
208
+ /**
209
+ * The six visual categories. Color attaches to category, not to kind — adding
210
+ * a new kind never grows the palette. Every node type picks exactly one.
211
+ *
212
+ * The framework leaves the visual mapping (token names, icon tile colors) to
213
+ * the host's NodeShell renderer; this enum just defines the slots.
214
+ */
215
+ export type NodeCategory =
216
+ | 'trigger'
217
+ | 'ai'
218
+ | 'logic'
219
+ | 'safety'
220
+ | 'output'
221
+ | 'note';
222
+
223
+ /**
224
+ * Public contract for registering a node kind.
225
+ *
226
+ * `defaultConfig` may be a value or a factory. Prefer the factory form for
227
+ * configs that contain nested mutable objects, dates, or anything that should
228
+ * be a fresh instance per node.
229
+ *
230
+ * Use `defineNodeType<TConfig>(...)` to keep TypeScript happy when collecting
231
+ * heterogeneous defs into a single registry array.
232
+ */
233
+ export type NodeTypeDef<TConfig = unknown> = {
234
+ kind: string;
235
+ /**
236
+ * Short, operational noun. Shown as the bold line on the canvas card.
237
+ * Intentionally not translated — these are technical primitives that
238
+ * stay English in localized UIs (matches n8n/Make/Dify convention) and
239
+ * the `node.kind` token (e.g. `start`, `agent`) used in template refs
240
+ * like `{{start.input}}` mirrors the English label.
241
+ */
242
+ label: string;
243
+ /**
244
+ * One-line description. Shown under the label in the palette. English
245
+ * fallback — prefer setting `descriptionKey` so the palette picks up
246
+ * the localized copy.
247
+ */
248
+ description?: string;
249
+ /** Translation key for `description`. Resolved by NodePalette. */
250
+ descriptionKey?: string;
251
+ /**
252
+ * Icon component for the node — wrap the source icon via the logician-ui
253
+ * `createIcon` helper (see `src/components/Icon/`) so all icons expose the
254
+ * same Chakra-shaped API (`boxSize`, `color`, `currentColor` tinting) and
255
+ * the host can't mix icon families.
256
+ */
257
+ icon: CreatedIcon;
258
+ /**
259
+ * One of six visual categories. Drives the icon-tile color and (for Note)
260
+ * the body color. Has no effect on validation or runtime.
261
+ */
262
+ category: NodeCategory;
263
+
264
+ defaultConfig: TConfig | (() => TConfig);
265
+
266
+ /**
267
+ * Optional overlay applied to `defaultConfig()` at node-creation time
268
+ * with the current `useTranslate` translator in scope. Use for
269
+ * user-facing string defaults that should land in the locale's
270
+ * language — e.g. the canvas display name. The framework can't run
271
+ * hooks inside `defaultConfig`, so localized defaults live here.
272
+ * Shallow-merges over the static defaults; unset fields fall through.
273
+ */
274
+ localizeDefaults?: (
275
+ translate: (key: string, params?: Record<string, string>) => string
276
+ ) => Partial<TConfig>;
277
+
278
+ /**
279
+ * Optional overlay applied to `defaultConfig()` at node-creation time with the
280
+ * opaque host bridge in scope — the host-data analogue of `localizeDefaults`.
281
+ * Use for defaults that depend on live host data the static `defaultConfig`
282
+ * can't see, e.g. picking a starting LLM from the tenant's live model list so
283
+ * a fresh node never persists a hardcoded model that's absent from the picker.
284
+ * Shallow-merges over the static + localized defaults; omit a key (or return
285
+ * `{}`) to leave the static default in place. `hostBridge` is opaque — the
286
+ * node type narrows it (see `getWorkflowHostBridge`).
287
+ */
288
+ hostDefaults?: (hostBridge: unknown) => Partial<TConfig>;
289
+
290
+ /**
291
+ * The snake_case identifier line under the kind label.
292
+ * Defaults to the node id when omitted.
293
+ */
294
+ getInstanceTitle?: (config: TConfig) => string;
295
+
296
+ /**
297
+ * Optional meta-row chips. Short nouns/phrases ("Sonnet 4.6", "mask · halt").
298
+ * Return an empty array to omit the meta row.
299
+ *
300
+ * Chips can be plain strings, or `{ text, tone }` objects to surface a
301
+ * danger/warning tint on a specific sub-value (e.g. an unknown model).
302
+ */
303
+ getMetaChips?: (config: TConfig) => ReadonlyArray<MetaChipSpec>;
304
+
305
+ /**
306
+ * Escape hatch for nodes whose body doesn't fit the standard
307
+ * header + meta-chips shape (e.g. Note). Most node types should leave this
308
+ * undefined and use `getInstanceTitle` + `getMetaChips` instead.
309
+ */
310
+ renderNode?: ComponentType<NodeRenderProps<TConfig>>;
311
+ /** Optional. If absent, clicking the node is a no-op for editing. */
312
+ renderDrawer?: ComponentType<DrawerRenderProps<TConfig>>;
313
+
314
+ /** Handles can depend on config (Classify creates N outputs from categories). */
315
+ handles: (config: TConfig) => { inputs: HandleDef[]; outputs: HandleDef[] };
316
+
317
+ /**
318
+ * Optional FE-computed, graph-aware advisories for this node, merged into the
319
+ * node's canvas warning/error chrome alongside the backend `issues`. Use for
320
+ * guidance the backend can't give before a save — an unconnected required
321
+ * exit, an empty or duplicated fan-out label. Pure and synchronous; it runs
322
+ * on every node render, so keep it cheap.
323
+ */
324
+ getGraphIssues?: (ctx: { node: GraphNode<TConfig>; graph: Graph }) => Issue[];
325
+
326
+ /** Output shape for variable resolution; undefined = no referenceable output. */
327
+ outputSchema?: (config: TConfig) => JSONSchema | undefined;
328
+
329
+ placement?: PlacementRule;
330
+
331
+ /**
332
+ * Reject an attempted connection. Return `true` to allow, `false` or a
333
+ * reason string to reject. Called for either the source or target side —
334
+ * the framework runs both and rejects if either says no.
335
+ */
336
+ canConnect?: (ctx: ConnectionCtx) => boolean | string;
337
+ };
338
+
339
+ export type NodeTypeRegistry = Record<string, NodeTypeDef>;
340
+
341
+ /**
342
+ * A selected canvas element, surfaced to the host via `onSelectionChange`. The
343
+ * `node`/`edge` snapshot is included for convenience (e.g. to drive a custom
344
+ * inspector that lives elsewhere in the host's layout); `id`/`type` are the
345
+ * stable identity.
346
+ */
347
+ export type WorkflowSelection =
348
+ | { type: 'node'; id: string; node: GraphNode }
349
+ | { type: 'edge'; id: string; edge: GraphEdge };
350
+
351
+ /**
352
+ * Public props for the `<Workflow>` component.
353
+ */
354
+ export type WorkflowProps = {
355
+ nodeTypes: NodeTypeDef[];
356
+
357
+ /**
358
+ * Translator for the editor's chrome copy. The host passes a function bound
359
+ * to its own locale + catalog so the editor localizes with the rest of the
360
+ * app and can resolve the `descriptionKey`s the host registers on its node
361
+ * types. When omitted, the component uses its bundled default copy.
362
+ */
363
+ translate?: WorkflowTranslate;
364
+
365
+ /** Controlled graph. If provided, `onGraphChange` should also be provided. */
366
+ graph?: Graph;
367
+ onGraphChange?: (next: Graph) => void;
368
+
369
+ /**
370
+ * Fired when the user runs the one-click auto-arrange, with the freshly
371
+ * laid-out graph. A pure reposition normally rides along on the next real
372
+ * edit's save (see the host's `differsBeyondPosition`), so a deliberate
373
+ * arrange would otherwise not persist on its own — hosts wire this to a
374
+ * forced save so the tidied layout sticks across reloads. Domain-free: the
375
+ * core just reports "the user arranged the graph"; the host decides what to
376
+ * do with it.
377
+ */
378
+ onArrange?: (graph: Graph) => void;
379
+
380
+ /**
381
+ * Fired with the resulting graph after the user undoes/redoes. Lets the host
382
+ * persist a revert that the autosave would otherwise drop: undoing an
383
+ * auto-arrange is a position-only change, which `differsBeyondPosition`
384
+ * ignores, so without this a reverted layout wouldn't survive a reload.
385
+ */
386
+ onHistoryNavigate?: (graph: Graph) => void;
387
+
388
+ /** Uncontrolled initial graph. Ignored when `graph` is provided. */
389
+ defaultGraph?: Graph;
390
+
391
+ /**
392
+ * Validation issues to render — sourced from the backend.
393
+ *
394
+ * Pass a stable reference (e.g. via `useMemo`) — a fresh array on every
395
+ * render will cause `onIssuesChange` to fire every render.
396
+ */
397
+ issues?: Issue[];
398
+
399
+ /** Hide palette + disable connect/drag/delete. */
400
+ readOnly?: boolean;
401
+
402
+ /**
403
+ * Issues are being recomputed (a save/validation is in flight) — render a
404
+ * loading affordance instead of treating an empty `issues` list as "no
405
+ * issues". Lets the host keep the prior issues visible (passed in via
406
+ * `issues`) while signalling that fresh validation is underway, avoiding a
407
+ * blank→repopulate flicker. Generic on purpose: the framework stays
408
+ * domain-free and the host decides what "validating" means.
409
+ */
410
+ validating?: boolean;
411
+
412
+ showPalette?: boolean;
413
+
414
+ /**
415
+ * Fired when the user clicks a node, with the clicked node. A click also
416
+ * updates the editor's selection (readable via `useWorkflow`/`onSelectionChange`
417
+ * and rendered by `<NodeInspector>` if mounted), so this is a convenience for
418
+ * hosts that drive UI *outside* the canvas off a raw click — e.g. opening a
419
+ * detail panel elsewhere, or flipping back from a test surface into edit mode.
420
+ */
421
+ onNodeClick?: (node: GraphNode) => void;
422
+
423
+ /** Fired when the user clicks an edge, with the clicked edge. See `onNodeClick`. */
424
+ onEdgeClick?: (edge: GraphEdge) => void;
425
+
426
+ /**
427
+ * Fired whenever the selected element changes — on node/edge click, on
428
+ * deselect (pane click), and when a selected element is deleted (`null`).
429
+ *
430
+ * This is the seam for "clicking a node controls a different part of the UI":
431
+ * the editor owns selection + canvas interaction, and the host renders its own
432
+ * inspector anywhere in its layout from this signal. The built-in
433
+ * `<NodeInspector>` is one such consumer — mount it as a child for the default
434
+ * floating drawer, omit it to own the inspector entirely.
435
+ */
436
+ onSelectionChange?: (selection: WorkflowSelection | null) => void;
437
+
438
+ /**
439
+ * Overlay children rendered inside the canvas frame (same pattern as React
440
+ * Flow's `<Controls>`/`<MiniMap>`/`<Panel>`). Mount `<NodeInspector>` here for
441
+ * the built-in node/edge drawer, or your own canvas-anchored surfaces.
442
+ * Children render inside the Workflow context, so they can call `useWorkflow`.
443
+ */
444
+ children?: ReactNode;
445
+
446
+ /**
447
+ * Notified whenever the issues array identity changes. Mostly a Storybook
448
+ * convenience now that validation is owned entirely by the backend — prod
449
+ * surfaces read `backendIssues` directly off their save response.
450
+ */
451
+ onIssuesChange?: (issues: Issue[]) => void;
452
+
453
+ /** Render-prop slot below the canvas (toolbar, run controls, etc.). */
454
+ footer?: ReactNode;
455
+
456
+ /**
457
+ * Minimum height of the editor frame. Defaults to `'500px'` for the full
458
+ * editor; lower it (e.g. for a read-only preview embedded in a card) so the
459
+ * canvas can shrink to its container.
460
+ */
461
+ minHeight?: string | number;
462
+
463
+ /**
464
+ * Optional override for the category → token map. Use to retheme the
465
+ * icon-tile colors and the Note body without forking NodeShell.
466
+ * Defaults to DEFAULT_CATEGORY_TOKENS.
467
+ */
468
+ categoryTokens?: CategoryTokenMap;
469
+
470
+ /**
471
+ * Opaque slot for host-specific data that node-type render functions need
472
+ * from the host app (e.g. a live LLM list, a chatbot id, API clients). The
473
+ * framework passes this through verbatim — node types cast it to their
474
+ * expected shape via a small accessor (see `adapters/factchatBridge.ts`).
475
+ * Kept as `unknown` so the framework itself stays domain-free.
476
+ */
477
+ hostBridge?: unknown;
478
+ };
479
+
480
+ /**
481
+ * Identity helper that preserves the TConfig generic so registry entries
482
+ * don't need `as NodeTypeDef` casts at the call site.
483
+ */
484
+ export function defineNodeType<TConfig>(
485
+ def: NodeTypeDef<TConfig>
486
+ ): NodeTypeDef {
487
+ return def as NodeTypeDef;
488
+ }
489
+
490
+ /** Resolve `defaultConfig` whether it's a value or a factory. */
491
+ export function resolveDefaultConfig<TConfig>(
492
+ def: Pick<NodeTypeDef<TConfig>, 'defaultConfig'>
493
+ ): TConfig {
494
+ const d = def.defaultConfig;
495
+ return typeof d === 'function' ? (d as () => TConfig)() : d;
496
+ }