@kiberon-labs/behave-graph-flow 1.0.0 → 3.0.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 (378) hide show
  1. package/.fallowrc.json +16 -0
  2. package/.storybook/main.ts +32 -0
  3. package/.storybook/manager.ts +6 -0
  4. package/.storybook/preview.ts +64 -0
  5. package/.storybook/styles.css +16 -0
  6. package/.turbo/turbo-build.log +7 -0
  7. package/CHANGELOG.md +368 -0
  8. package/LICENSE +6 -0
  9. package/README.md +2 -2
  10. package/data/Polynomial.json +510 -0
  11. package/data/sequence.json +337 -0
  12. package/data/trigger-event.json +241 -0
  13. package/data/variable-change.json +210 -0
  14. package/dist/AnyControlImpl-Ds-CShIB.js +20 -0
  15. package/dist/AnyControlImpl-Ds-CShIB.js.map +1 -0
  16. package/dist/DocumentationBrowserPanelImpl-deZNzFX8.js +166 -0
  17. package/dist/DocumentationBrowserPanelImpl-deZNzFX8.js.map +1 -0
  18. package/dist/entry.css +4 -0
  19. package/dist/index.css +42 -0
  20. package/dist/index.css.map +1 -0
  21. package/dist/index.d.ts +3597 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +18009 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/noteImpl-KkrrWgJd.js +242 -0
  26. package/dist/noteImpl-KkrrWgJd.js.map +1 -0
  27. package/dist/styles.module-CvmpDkZj.css +3 -0
  28. package/dist/styles.module-CvmpDkZj.css.map +1 -0
  29. package/dist/styles.module-DZxg8aW9.js +271 -0
  30. package/dist/styles.module-DZxg8aW9.js.map +1 -0
  31. package/dist/useChangeNodeData-ChQGK7AI.js +23 -0
  32. package/dist/useChangeNodeData-ChQGK7AI.js.map +1 -0
  33. package/docs/notifications.md +246 -0
  34. package/docs/protocol.md +702 -0
  35. package/docs/specifics.md +191 -0
  36. package/package.json +82 -22
  37. package/postcss.config.ts +3 -4
  38. package/src/annotations/index.ts +32 -0
  39. package/src/components/FloatingToolbar/index.module.css +37 -0
  40. package/src/components/FloatingToolbar/index.tsx +256 -0
  41. package/src/components/Flow.tsx +287 -75
  42. package/src/components/contextMenus/DynamicContextMenu.tsx +85 -0
  43. package/src/components/contextMenus/NodePicker.module.css +274 -0
  44. package/src/components/contextMenus/NodePicker.tsx +481 -0
  45. package/src/components/contextMenus/edge.tsx +22 -0
  46. package/src/components/contextMenus/node.tsx +15 -0
  47. package/src/components/contextMenus/selection.tsx +11 -0
  48. package/src/components/controls/any/AnyControlImpl.tsx +14 -0
  49. package/src/components/controls/any/index.tsx +19 -0
  50. package/src/components/controls/boolean/index.tsx +13 -0
  51. package/src/components/controls/colorPicker/InputPopover.module.css +100 -0
  52. package/src/components/controls/colorPicker/InputPopover.tsx +31 -0
  53. package/src/components/controls/colorPicker/index.module.css +18 -0
  54. package/src/components/controls/colorPicker/index.tsx +61 -0
  55. package/src/components/controls/number/index.tsx +35 -0
  56. package/src/components/controls/string/index.tsx +16 -0
  57. package/src/components/edges/index.tsx +475 -0
  58. package/src/components/edges/offsetBezier.ts +134 -0
  59. package/src/components/hotKeys.tsx +20 -0
  60. package/src/components/layoutController/index.module.css +13 -0
  61. package/src/components/layoutController/index.tsx +140 -0
  62. package/src/components/layoutController/utils.ts +248 -0
  63. package/src/components/menubar/defaults.tsx +516 -0
  64. package/src/components/menubar/index.tsx +49 -0
  65. package/src/components/menubar/menuItem.module.css +31 -0
  66. package/src/components/menubar/menuItem.tsx +65 -0
  67. package/src/components/nodes/behave/Node.module.css +23 -0
  68. package/src/components/nodes/behave/Node.tsx +176 -0
  69. package/src/components/nodes/behave/NodeContainer.module.css +88 -0
  70. package/src/components/nodes/behave/NodeContainer.tsx +46 -0
  71. package/src/components/nodes/behave/index.tsx +14 -0
  72. package/src/components/nodes/group/index.tsx +109 -0
  73. package/src/components/nodes/wrapper/index.tsx +73 -0
  74. package/src/components/nodes/wrapper/styles.module.css +87 -0
  75. package/src/components/notifications/NotificationProvider.tsx +81 -0
  76. package/src/components/notifications/index.ts +2 -0
  77. package/src/components/notifications/utils.ts +71 -0
  78. package/src/components/panels/alignment/index.module.css +10 -0
  79. package/src/components/panels/alignment/index.tsx +244 -0
  80. package/src/components/panels/base/index.tsx +5 -0
  81. package/src/components/panels/base/styles.module.css +12 -0
  82. package/src/components/panels/common/PanelHeader.module.css +24 -0
  83. package/src/components/panels/common/PanelHeader.tsx +22 -0
  84. package/src/components/panels/common/SectionTitle.module.css +13 -0
  85. package/src/components/panels/common/SectionTitle.tsx +10 -0
  86. package/src/components/panels/events/EditEventPanel.tsx +324 -0
  87. package/src/components/panels/events/ManageEventsPanel.tsx +101 -0
  88. package/src/components/panels/events/index.tsx +23 -0
  89. package/src/components/panels/events/styles.module.css +178 -0
  90. package/src/components/panels/graphProperties/index.tsx +125 -0
  91. package/src/components/panels/history/index.tsx +92 -0
  92. package/src/components/panels/history/styles.module.css +97 -0
  93. package/src/components/panels/keymaps/index.module.css +68 -0
  94. package/src/components/panels/keymaps/index.tsx +166 -0
  95. package/src/components/panels/layers/index.tsx +245 -0
  96. package/src/components/panels/layers/styles.module.css +107 -0
  97. package/src/components/panels/legend/index.module.css +6 -0
  98. package/src/components/panels/legend/index.tsx +76 -0
  99. package/src/components/panels/logs/index.module.css +218 -0
  100. package/src/components/panels/logs/index.tsx +288 -0
  101. package/src/components/panels/nodeInputs/InputControl.tsx +63 -0
  102. package/src/components/panels/nodeInputs/InputsGroup.tsx +65 -0
  103. package/src/components/panels/nodeInputs/MultipleNodesView.tsx +37 -0
  104. package/src/components/panels/nodeInputs/NodeSettings.tsx +92 -0
  105. package/src/components/panels/nodeInputs/NodeTitleEditor.tsx +125 -0
  106. package/src/components/panels/nodeInputs/OutputsGroup.tsx +55 -0
  107. package/src/components/panels/nodeInputs/SocketGenerators.tsx +32 -0
  108. package/src/components/panels/nodeInputs/index.module.css +308 -0
  109. package/src/components/panels/nodeInputs/index.tsx +349 -0
  110. package/src/components/panels/nodeInputs/useNodeHandlers.ts +76 -0
  111. package/src/components/panels/nodeInputs/useNodeInputsData.ts +153 -0
  112. package/src/components/panels/nodePicker/index.tsx +115 -0
  113. package/src/components/panels/panel/index.module.css +66 -0
  114. package/src/components/panels/panel/index.tsx +88 -0
  115. package/src/components/panels/search/index.module.css +16 -0
  116. package/src/components/panels/search/index.tsx +215 -0
  117. package/src/components/panels/systemSettings/ConversionsSettings.tsx +203 -0
  118. package/src/components/panels/systemSettings/index.tsx +251 -0
  119. package/src/components/panels/systemSettings/styles.module.css +138 -0
  120. package/src/components/panels/traces/GridLines.tsx +38 -0
  121. package/src/components/panels/traces/TimeGrid.tsx +48 -0
  122. package/src/components/panels/traces/TraceLane.tsx +62 -0
  123. package/src/components/panels/traces/TraceTooltip.tsx +22 -0
  124. package/src/components/panels/traces/TracesHeader.tsx +56 -0
  125. package/src/components/panels/traces/index.module.css +159 -0
  126. package/src/components/panels/traces/index.tsx +298 -0
  127. package/src/components/panels/traces/types.ts +48 -0
  128. package/src/components/panels/traces/useDerivedSpans.ts +307 -0
  129. package/src/components/panels/traces/utils.ts +33 -0
  130. package/src/components/panels/variables/CreateVariableScreen.tsx +162 -0
  131. package/src/components/panels/variables/ManageVariablesScreen.tsx +147 -0
  132. package/src/components/panels/variables/index.tsx +125 -0
  133. package/src/components/panels/variables/styles.module.css +149 -0
  134. package/src/components/primitives/icon.module.css +45 -0
  135. package/src/components/primitives/icon.tsx +38 -0
  136. package/src/components/sockets/input/index.tsx +83 -0
  137. package/src/components/sockets/input/styles.module.css +26 -0
  138. package/src/components/sockets/output/index.tsx +68 -0
  139. package/src/components/sockets/output/styles.module.css +22 -0
  140. package/src/css/notes.css +135 -0
  141. package/src/css/prosemirror.css +57 -0
  142. package/src/css/rc-dock.css +212 -0
  143. package/src/css/rc-menu.css +101 -0
  144. package/src/css/themes/kiberon.css +127 -0
  145. package/src/css/vars.css +198 -0
  146. package/src/css/vscode-elements.css +124 -0
  147. package/src/entry.css +4 -0
  148. package/src/generators/CallSubgraphGenerator.tsx +136 -0
  149. package/src/generators/CustomEventOnTriggeredGenerator.tsx +85 -0
  150. package/src/generators/GraphBoundaryGenerator.module.css +32 -0
  151. package/src/generators/GraphBoundaryGenerator.tsx +193 -0
  152. package/src/generators/SequenceGenerator.tsx +104 -0
  153. package/src/generators/SwitchOnIntegerGenerator.tsx +256 -0
  154. package/src/generators/SwitchOnStringGenerator.tsx +263 -0
  155. package/src/generators/callSubgraphSync.ts +126 -0
  156. package/src/generators/registerDefaultGenerators.ts +55 -0
  157. package/src/generators/registerDefaults.ts +26 -0
  158. package/src/hooks/useBehaveGraphFlow.ts +17 -16
  159. package/src/hooks/useFlowHandlers.ts +154 -30
  160. package/src/hooks/useWasdPan.ts +210 -0
  161. package/src/index.css +134 -0
  162. package/src/index.ts +53 -18
  163. package/src/manifest/contributionRegistry.ts +93 -0
  164. package/src/manifest/index.ts +4 -0
  165. package/src/manifest/loadManifest.ts +82 -0
  166. package/src/manifest/manifestPlugin.ts +29 -0
  167. package/src/manifest/passthroughValueType.ts +40 -0
  168. package/src/plugin/alignment/index.ts +91 -0
  169. package/src/plugin/autosave/controller.ts +366 -0
  170. package/src/plugin/autosave/index.tsx +114 -0
  171. package/src/plugin/autosave/panel/BackupPanel.tsx +141 -0
  172. package/src/plugin/autosave/panel/index.tsx +1 -0
  173. package/src/plugin/autosave/panel/styles.module.css +56 -0
  174. package/src/plugin/autosave/settings.ts +65 -0
  175. package/src/plugin/autosave/storage.ts +147 -0
  176. package/src/plugin/docs/index.tsx +297 -0
  177. package/src/plugin/docs/panel/DocumentationBrowserPanelImpl.tsx +200 -0
  178. package/src/plugin/docs/panel/index.tsx +21 -0
  179. package/src/plugin/docs/panel/styles.module.css +174 -0
  180. package/src/plugin/graphrunner/actions.ts +326 -0
  181. package/src/plugin/graphrunner/buttons.tsx +95 -0
  182. package/src/plugin/graphrunner/client.ts +707 -0
  183. package/src/plugin/graphrunner/index.tsx +184 -0
  184. package/src/plugin/graphrunner/panel.tsx +386 -0
  185. package/src/plugin/graphrunner/runController.ts +283 -0
  186. package/src/plugin/graphrunner/runner.ts +187 -0
  187. package/src/plugin/graphrunner/session.ts +243 -0
  188. package/src/plugin/graphrunner/store.ts +196 -0
  189. package/src/plugin/graphrunner/styles.module.css +171 -0
  190. package/src/plugin/graphrunner/transport.ts +250 -0
  191. package/src/plugin/graphrunner/types.ts +693 -0
  192. package/src/plugin/graphrunner-local/execution-utils.ts +637 -0
  193. package/src/plugin/graphrunner-local/index.tsx +172 -0
  194. package/src/plugin/graphrunner-local/panel.tsx +187 -0
  195. package/src/plugin/graphrunner-local/store.ts +41 -0
  196. package/src/plugin/graphrunner-local/styles.module.css +82 -0
  197. package/src/plugin/graphrunner-local/transport.ts +1339 -0
  198. package/src/plugin/graphrunner-local/types.ts +10 -0
  199. package/src/plugin/graphrunner-webworker/graph-executor.worker.ts +635 -0
  200. package/src/plugin/graphrunner-webworker/index.tsx +140 -0
  201. package/src/plugin/graphrunner-webworker/panel.tsx +173 -0
  202. package/src/plugin/graphrunner-webworker/store.ts +98 -0
  203. package/src/plugin/graphrunner-webworker/worker-transport.ts +123 -0
  204. package/src/plugin/kitchen-sink/index.ts +38 -0
  205. package/src/plugin/layout/dagre.ts +131 -0
  206. package/src/plugin/layout/elk.ts +216 -0
  207. package/src/plugin/layout/index.ts +80 -0
  208. package/src/plugin/notes/FormatToolbar.tsx +200 -0
  209. package/src/plugin/notes/index.tsx +191 -0
  210. package/src/plugin/notes/nodeActions.ts +100 -0
  211. package/src/plugin/notes/note.tsx +20 -0
  212. package/src/plugin/notes/noteImpl.tsx +89 -0
  213. package/src/plugin/realtime/realtimeRunner.ts +624 -0
  214. package/src/specifics/CustomEventOnTriggeredSpecific.tsx +92 -0
  215. package/src/specifics/CustomEventTriggerSpecific.tsx +141 -0
  216. package/src/specifics/VariableGetSpecific.tsx +110 -0
  217. package/src/specifics/VariableSetSpecific.tsx +110 -0
  218. package/src/store/actions.tsx +698 -0
  219. package/src/store/commands.ts +278 -0
  220. package/src/store/contextMenu.ts +192 -0
  221. package/src/store/controls.tsx +62 -0
  222. package/src/store/conversions.ts +47 -0
  223. package/src/store/documentation.tsx +69 -0
  224. package/src/store/events.tsx +116 -0
  225. package/src/store/flow.tsx +230 -0
  226. package/src/store/graphMeta.ts +39 -0
  227. package/src/store/hotKeys.tsx +364 -0
  228. package/src/store/layers.ts +259 -0
  229. package/src/store/legend.tsx +76 -0
  230. package/src/store/logs.ts +28 -0
  231. package/src/store/menubar.ts +41 -0
  232. package/src/store/refs.ts +84 -0
  233. package/src/store/registry.ts +51 -0
  234. package/src/store/selection.ts +22 -0
  235. package/src/store/settings.ts +99 -0
  236. package/src/store/settingsSchema.ts +210 -0
  237. package/src/store/socketGenerator.tsx +54 -0
  238. package/src/store/specific.tsx +75 -0
  239. package/src/store/specs.tsx +35 -0
  240. package/src/store/tabs.ts +282 -0
  241. package/src/store/toolbar.tsx +45 -0
  242. package/src/store/traces.ts +240 -0
  243. package/src/store/variables.ts +37 -0
  244. package/src/system/graph.ts +131 -0
  245. package/src/system/graphSession.ts +172 -0
  246. package/src/system/index.ts +6 -0
  247. package/src/system/notifications.ts +111 -0
  248. package/src/system/persistence.ts +82 -0
  249. package/src/system/plugin.ts +55 -0
  250. package/src/system/provider.tsx +86 -0
  251. package/src/system/pubsub.ts +323 -0
  252. package/src/system/system.ts +653 -0
  253. package/src/system/tabLoader.tsx +303 -0
  254. package/src/system/undoRedo.ts +103 -0
  255. package/src/transformers/Uigraph.ts +61 -0
  256. package/src/transformers/behaveToFlow.ts +16 -4
  257. package/src/transformers/contract.ts +87 -0
  258. package/src/transformers/flowToBehave.ts +40 -12
  259. package/src/types/NodeMetadata.ts +27 -0
  260. package/src/types/graph.ts +49 -0
  261. package/src/types/nodes.ts +50 -0
  262. package/src/types.ts +18 -0
  263. package/src/util/autoConvert.ts +200 -0
  264. package/src/util/colors.ts +1 -29
  265. package/src/util/downloadJson.ts +18 -0
  266. package/src/util/extractNodeMetadata.ts +16 -0
  267. package/src/util/getPickerFilters.ts +1 -1
  268. package/src/util/isBehaveNode.ts +6 -0
  269. package/src/util/isValidConnection.ts +51 -17
  270. package/src/util/mergeSockets.ts +29 -0
  271. package/src/util/serializeVariables.ts +66 -0
  272. package/src/util/sockets.ts +43 -0
  273. package/stories/apex/layoutController/example-graph.worker.ts +39 -0
  274. package/stories/apex/layoutController/index.stories.tsx +48 -0
  275. package/stories/apex/layoutController/webworker.stories.tsx +103 -0
  276. package/stories/apex/menubar/menubar.stories.tsx +19 -0
  277. package/stories/components/colorpicker/index.stories.tsx +20 -0
  278. package/stories/components/contextMenus/edge.stories.tsx +32 -0
  279. package/stories/components/contextMenus/node.stories.tsx +26 -0
  280. package/stories/components/contextMenus/nodePicker.stories.tsx +115 -0
  281. package/stories/components/controls/any/index.stories.tsx +19 -0
  282. package/stories/components/controls/boolean/index.stories.tsx +19 -0
  283. package/stories/components/controls/colorPicker/index.stories.tsx +49 -0
  284. package/stories/components/controls/number/index.stories.tsx +19 -0
  285. package/stories/components/controls/string/index.stories.tsx +19 -0
  286. package/stories/components/nodes/behaveNode.stories.tsx +108 -0
  287. package/stories/components/panels/alignment.stories.tsx +24 -0
  288. package/stories/components/panels/events.stories.tsx +38 -0
  289. package/stories/components/panels/graphRunner.stories.tsx +317 -0
  290. package/stories/components/panels/history.stories.tsx +37 -0
  291. package/stories/components/panels/keymaps.stories.tsx +21 -0
  292. package/stories/components/panels/legend.stories.tsx +37 -0
  293. package/stories/components/panels/logs.stories.tsx +24 -0
  294. package/stories/components/panels/nodeInputs.stories.tsx +21 -0
  295. package/stories/components/panels/nodePicker.stories.tsx +37 -0
  296. package/stories/components/panels/panel.stories.tsx +39 -0
  297. package/stories/components/panels/search.stories.tsx +24 -0
  298. package/stories/components/panels/systemSettings.stories.tsx +26 -0
  299. package/stories/components/panels/traces.stories.tsx +225 -0
  300. package/stories/components/panels/variables.stories.tsx +24 -0
  301. package/stories/defaults/defaultStoryProvider.tsx +170 -0
  302. package/stories/defaults/systemGenerator.ts +43 -0
  303. package/stories/plugins/notes.stories.tsx +100 -0
  304. package/tests/autoConvert.test.ts +329 -0
  305. package/tests/autosavePlugin.test.ts +204 -0
  306. package/tests/callSubgraphSync.test.ts +148 -0
  307. package/tests/commandRegistry.test.ts +137 -0
  308. package/tests/components/edges/offsetBezier.test.ts +51 -0
  309. package/tests/components/layoutController/utils.test.ts +68 -0
  310. package/tests/components/panels/traces/utils.test.ts +52 -0
  311. package/tests/contract.test.ts +51 -0
  312. package/tests/contractSerialize.test.ts +62 -0
  313. package/tests/deriveSpans.test.ts +71 -0
  314. package/tests/flowToBehave.test.ts +27 -4
  315. package/tests/hotkeys.test.ts +79 -0
  316. package/tests/keepAliveLifecycle.test.ts +167 -0
  317. package/tests/loadManifest.test.ts +113 -0
  318. package/tests/noteMarkdown.test.ts +65 -0
  319. package/tests/notesPlugin.test.ts +162 -0
  320. package/tests/notifications.test.ts +87 -0
  321. package/tests/persistence.test.ts +51 -0
  322. package/tests/saveLoad.test.ts +373 -0
  323. package/tests/settings.test.ts +178 -0
  324. package/tests/traceStore.test.ts +46 -0
  325. package/tests/util/calculateNewEdge.test.ts +98 -0
  326. package/tests/util/getSocketsByNodeTypeAndHandleType.test.ts +31 -0
  327. package/tests/util/hasPositionMetaData.test.ts +33 -0
  328. package/tests/util/isBehaveNode.test.ts +22 -0
  329. package/tests/util/isHandleConnected.test.ts +37 -0
  330. package/tests/util/mergeSockets.test.ts +43 -0
  331. package/tests/visual/README.md +64 -0
  332. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-alignment-chromium-win32.png +0 -0
  333. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-conversation-chromium-win32.png +0 -0
  334. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-events-chromium-win32.png +0 -0
  335. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-history-chromium-win32.png +0 -0
  336. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-keymaps-chromium-win32.png +0 -0
  337. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-layers-chromium-win32.png +0 -0
  338. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-legend-chromium-win32.png +0 -0
  339. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-localGraphRunner-chromium-win32.png +0 -0
  340. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-logs-chromium-win32.png +0 -0
  341. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-nodeInputs-chromium-win32.png +0 -0
  342. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-nodePicker-chromium-win32.png +0 -0
  343. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-panel-chromium-win32.png +0 -0
  344. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-search-chromium-win32.png +0 -0
  345. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-systemSettings-chromium-win32.png +0 -0
  346. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-traces-chromium-win32.png +0 -0
  347. package/tests/visual/__screenshots__/panels.visual.test.tsx/panel-variables-chromium-win32.png +0 -0
  348. package/tests/visual/panels.visual.test.tsx +76 -0
  349. package/tests/wasdPan.test.ts +71 -0
  350. package/tsconfig.base.json +39 -0
  351. package/tsconfig.json +18 -59
  352. package/tsconfig.prod.json +23 -0
  353. package/tsdown.config.ts +15 -3
  354. package/typedoc.json +7 -7
  355. package/vite.config.js +7 -0
  356. package/vitest.config.ts +5 -2
  357. package/vitest.visual.config.ts +55 -0
  358. package/src/components/AutoSizeInput.tsx +0 -65
  359. package/src/components/Controls.tsx +0 -87
  360. package/src/components/InputSocket.tsx +0 -142
  361. package/src/components/Node.tsx +0 -68
  362. package/src/components/NodeContainer.tsx +0 -46
  363. package/src/components/NodePicker.tsx +0 -77
  364. package/src/components/OutputSocket.tsx +0 -58
  365. package/src/components/modals/ClearModal.tsx +0 -40
  366. package/src/components/modals/HelpModal.tsx +0 -36
  367. package/src/components/modals/LoadModal.tsx +0 -96
  368. package/src/components/modals/Modal.tsx +0 -64
  369. package/src/components/modals/SaveModal.tsx +0 -60
  370. package/src/hooks/useCustomNodeTypes.tsx +0 -31
  371. package/src/hooks/useGraphRunner.ts +0 -104
  372. package/src/hooks/useMergeMap.ts +0 -14
  373. package/src/hooks/useNodeSpecJson.ts +0 -20
  374. package/src/hooks/useQueriableDefinitions.ts +0 -22
  375. package/src/styles.css +0 -8
  376. package/tailwind.config.ts +0 -19
  377. package/tests/tsconfig.json +0 -10
  378. /package/src/{types.d.ts → types-declarations.d.ts} +0 -0
@@ -0,0 +1,125 @@
1
+ import React, { useState, useCallback } from 'react';
2
+ import { useActiveGraph } from '@/system/provider';
3
+ import { useStore } from 'zustand';
4
+ import { CreateVariableScreen } from './CreateVariableScreen';
5
+ import { ManageVariablesScreen } from './ManageVariablesScreen';
6
+ import { BasePanel } from '../base';
7
+
8
+ type VariablesPanelScreen = 'manage' | 'create';
9
+
10
+ export function VariablesPanel() {
11
+ const system = useActiveGraph()!;
12
+ const variables = useStore(system.variableStore, (x) => x.variables);
13
+ const setVariable = useStore(system.variableStore, (x) => x.setVariable);
14
+ const removeVariable = useStore(
15
+ system.variableStore,
16
+ (x) => x.removeVariable
17
+ );
18
+ const controls = useStore(system.controlStore, (x) => x.controls);
19
+ const defaultControl = useStore(system.controlStore, (x) => x.defaultControl);
20
+
21
+ // Get the appropriate control component for a value type
22
+ const getControlComponent = useCallback(
23
+ (valueType: string) => {
24
+ return controls[valueType] || defaultControl;
25
+ },
26
+ [controls, defaultControl]
27
+ );
28
+
29
+ const [screen, setScreen] = useState<VariablesPanelScreen>('manage');
30
+
31
+ // Section 2 & 3: Select and edit existing variable
32
+ const [selectedVarId, setSelectedVarId] = useState<string>('');
33
+ const [editValue, setEditValue] = useState<any>('');
34
+
35
+ // Handle selecting a variable
36
+ const handleSelectVariable = useCallback(
37
+ (varKey: string) => {
38
+ setSelectedVarId(varKey);
39
+ const variable = variables[varKey];
40
+
41
+ if (variable) {
42
+ setEditValue(variable.initialValue);
43
+ }
44
+ },
45
+ [variables]
46
+ );
47
+
48
+ // Handle updating selected variable
49
+ const handleUpdateVariable = useCallback(() => {
50
+ if (!selectedVarId || !variables[selectedVarId]) {
51
+ return;
52
+ }
53
+
54
+ const variable = variables[selectedVarId];
55
+ // Force re-render by updating the store
56
+ setVariable(selectedVarId, {
57
+ ...variable,
58
+ initialValue: editValue
59
+ });
60
+ }, [selectedVarId, editValue, variables, setVariable]);
61
+
62
+ // Handle deleting a variable
63
+ const handleDeleteVariable = useCallback(
64
+ (varName: string) => {
65
+ removeVariable(varName);
66
+ if (varName === selectedVarId) {
67
+ setSelectedVarId('');
68
+ setEditValue('');
69
+ }
70
+ },
71
+ [removeVariable, selectedVarId, variables]
72
+ );
73
+
74
+ const selectedVariable = selectedVarId
75
+ ? (variables[selectedVarId] ?? null)
76
+ : null;
77
+ const SelectedVarControlComponent = selectedVariable
78
+ ? getControlComponent(selectedVariable.valueTypeName)
79
+ : defaultControl;
80
+
81
+ const goToCreate = useCallback(() => {
82
+ setScreen('create');
83
+ }, []);
84
+
85
+ const goToManage = useCallback(() => {
86
+ setScreen('manage');
87
+ }, []);
88
+
89
+ const handleCreatedVariable = useCallback(
90
+ (variableKey: string) => {
91
+ setSelectedVarId(variableKey);
92
+ const created = system.variableStore.getState().variables[variableKey];
93
+ if (created) {
94
+ setEditValue(created.initialValue);
95
+ }
96
+ },
97
+ [system.variableStore]
98
+ );
99
+
100
+ return (
101
+ <BasePanel>
102
+ {screen === 'create' && (
103
+ <CreateVariableScreen
104
+ onBack={goToManage}
105
+ onCancel={goToManage}
106
+ onCreated={handleCreatedVariable}
107
+ />
108
+ )}
109
+ {screen === 'manage' && (
110
+ <ManageVariablesScreen
111
+ variables={variables}
112
+ selectedVarKey={selectedVarId}
113
+ onSelectVariable={handleSelectVariable}
114
+ onDeleteVariable={handleDeleteVariable}
115
+ onNewVariable={goToCreate}
116
+ selectedVariable={selectedVariable}
117
+ editValue={editValue}
118
+ onChangeEditValue={setEditValue}
119
+ SelectedVarControlComponent={SelectedVarControlComponent}
120
+ onUpdateVariable={handleUpdateVariable}
121
+ />
122
+ )}
123
+ </BasePanel>
124
+ );
125
+ }
@@ -0,0 +1,149 @@
1
+ .root {
2
+ display: flex;
3
+ flex-direction: column;
4
+ flex: 1;
5
+ height: 100%;
6
+ gap: 0;
7
+ overflow: hidden;
8
+ }
9
+
10
+ .headerRow {
11
+ display: flex;
12
+ align-items: center;
13
+ justify-content: space-between;
14
+ }
15
+
16
+ .section {
17
+ display: flex;
18
+ flex-direction: column;
19
+ gap: 0.25em;
20
+ }
21
+
22
+ .sectionPadded {
23
+ padding: 0.25em;
24
+ }
25
+
26
+ .variableList {
27
+ flex: 1;
28
+ overflow-y: auto;
29
+ padding: 8px;
30
+ min-height: 0;
31
+ }
32
+
33
+ .emptyState {
34
+ display: flex;
35
+ flex-direction: column;
36
+ align-items: center;
37
+ justify-content: center;
38
+ padding: 32px 16px;
39
+ text-align: center;
40
+ gap: 8px;
41
+ }
42
+
43
+ .emptyStateText {
44
+ font-size: 13px;
45
+ opacity: 0.7;
46
+ }
47
+
48
+ .emptyStateHint {
49
+ font-size: 12px;
50
+ opacity: 0.5;
51
+ }
52
+
53
+ .field {
54
+ display: flex;
55
+ flex-direction: column;
56
+ gap: 0.25em;
57
+ }
58
+
59
+ .actionsRow {
60
+ display: flex;
61
+ gap: 0.25em;
62
+ }
63
+
64
+ .tree {
65
+ display: block;
66
+ }
67
+
68
+ .tree vscode-tree-item {
69
+ --vscode-tree-item-padding: 0;
70
+ }
71
+
72
+ .treeItemContent {
73
+ display: flex;
74
+ align-items: center;
75
+ gap: 12px;
76
+ padding: 0.25em 0.5em;
77
+ width: 100%;
78
+ }
79
+
80
+ .treeItemIcon {
81
+ display: flex;
82
+ align-items: center;
83
+ justify-content: center;
84
+ width: 24px;
85
+ height: 24px;
86
+ flex-shrink: 0;
87
+ font-size: 18px;
88
+ opacity: 0.85;
89
+ }
90
+
91
+ .treeItemInfo {
92
+ flex: 1;
93
+ }
94
+
95
+ .selectedEditor {
96
+ display: flex;
97
+ flex-direction: column;
98
+ gap: 0;
99
+ border-top: 1px solid var(--ds-panel-border, rgba(255, 255, 255, 0.1));
100
+ background: var(--ds-sidebar-bg, var(--colors-bgPanel));
101
+ flex-shrink: 0;
102
+ }
103
+
104
+ .editorHeader {
105
+ padding: 12px 16px;
106
+ border-bottom: 1px solid var(--ds-panel-border, rgba(255, 255, 255, 0.08));
107
+ }
108
+
109
+ .editorTitle {
110
+ font-size: 11px;
111
+ font-weight: 600;
112
+ opacity: 0.6;
113
+ text-transform: uppercase;
114
+ letter-spacing: 0.5px;
115
+ margin-bottom: 4px;
116
+ }
117
+
118
+ .editorVariableName {
119
+ font-size: 13px;
120
+ font-weight: 500;
121
+ }
122
+
123
+ .editorFields {
124
+ display: flex;
125
+ flex-direction: column;
126
+ gap: 8px;
127
+ padding: 16px;
128
+ }
129
+
130
+ .fieldLabel {
131
+ font-size: 12px;
132
+ font-weight: 500;
133
+ opacity: 0.8;
134
+ margin-bottom: 4px;
135
+ }
136
+
137
+ .fieldControl {
138
+ display: flex;
139
+ flex-direction: column;
140
+ }
141
+
142
+ .editorActions {
143
+ display: flex;
144
+ flex-direction: row;
145
+ justify-content: end;
146
+ gap: 0.5em;
147
+ padding: 12px 16px;
148
+ border-top: 1px solid var(--ds-panel-border, rgba(255, 255, 255, 0.08));
149
+ }
@@ -0,0 +1,45 @@
1
+ .icon {
2
+ display: inline-flex;
3
+ align-items: center;
4
+ justify-content: center;
5
+ background: transparent;
6
+ border: none;
7
+ cursor: pointer;
8
+ color: var(--ds-icon-fg, #cccccc);
9
+ padding: 0;
10
+ border-radius: 5px;
11
+ transition: background-color 0.1s ease;
12
+ }
13
+
14
+ .icon:hover:not(.disabled) {
15
+ background-color: var(--ds-toolbar-hover-bg);
16
+ }
17
+
18
+ .icon:active:not(.disabled) {
19
+ background-color: var(--ds-toolbar-active-bg);
20
+ }
21
+
22
+ .icon:focus-visible {
23
+ outline: 1px solid var(--ds-focus-border);
24
+ outline-offset: -1px;
25
+ }
26
+
27
+ .icon.disabled {
28
+ cursor: default;
29
+ opacity: 0.4;
30
+ }
31
+
32
+ .icon.small {
33
+ width: 20px;
34
+ height: 20px;
35
+ }
36
+
37
+ .icon.medium {
38
+ width: 24px;
39
+ height: 24px;
40
+ }
41
+
42
+ .icon.large {
43
+ width: 28px;
44
+ height: 28px;
45
+ }
@@ -0,0 +1,38 @@
1
+ import React from 'react';
2
+ import styles from './icon.module.css';
3
+ import classNames from 'classnames';
4
+
5
+ interface IconProps extends React.HTMLAttributes<HTMLButtonElement> {
6
+ children: React.ReactNode;
7
+ onClick?: (e: React.MouseEvent<HTMLButtonElement>) => void;
8
+ title?: string;
9
+ disabled?: boolean;
10
+ className?: string;
11
+ size?: 'small' | 'medium' | 'large';
12
+ }
13
+
14
+ export const Icon: React.FC<IconProps> = ({
15
+ children,
16
+ onClick,
17
+ title,
18
+ disabled = false,
19
+ className,
20
+ size = 'small'
21
+ }) => {
22
+ return (
23
+ <button
24
+ className={classNames(
25
+ styles.icon,
26
+ styles[size],
27
+ disabled && styles.disabled,
28
+ className
29
+ )}
30
+ onClick={onClick}
31
+ disabled={disabled}
32
+ title={title}
33
+ type="button"
34
+ >
35
+ {children}
36
+ </button>
37
+ );
38
+ };
@@ -0,0 +1,83 @@
1
+ import type {
2
+ InputSocketSpecJSON,
3
+ NodeSpecJSON
4
+ } from '@kiberon-labs/behave-graph';
5
+
6
+ import cx from 'classnames';
7
+ import React from 'react';
8
+ import { type Connection, Handle, Position, useReactFlow } from 'reactflow';
9
+
10
+ import { isValidConnection } from '../../../util/isValidConnection.js';
11
+ import { NavArrowRightSolid } from 'iconoir-react';
12
+ import { useSystem } from '@/system/provider.js';
13
+ import { useStore } from 'zustand';
14
+
15
+ import styles from './styles.module.css';
16
+
17
+ export type InputSocketProps = {
18
+ hide: boolean;
19
+ hideName?: boolean;
20
+ connected: boolean;
21
+ value: any | undefined;
22
+ label?: string;
23
+ onChange: (key: string, value: any) => void;
24
+ specJSON: NodeSpecJSON[];
25
+ } & InputSocketSpecJSON;
26
+
27
+ const InputSocket: React.FC<InputSocketProps> = ({
28
+ connected,
29
+ specJSON,
30
+ hideName,
31
+ hide,
32
+ label,
33
+ ...rest
34
+ }) => {
35
+ const { name, valueType } = rest;
36
+ const instance = useReactFlow();
37
+ const sys = useSystem();
38
+ const { valueTypeColors, icons, defaultIcon } = useStore(sys.legendStore);
39
+ const autoConvert = useStore(sys.systemSettings, (s) => s.autoConvert);
40
+ const conversions = useStore(sys.conversionStore, (s) => s.conversions);
41
+ const Icon = icons[valueType] ?? defaultIcon;
42
+
43
+ const isFlowSocket = valueType === 'flow';
44
+
45
+ let colorName = valueTypeColors[valueType];
46
+ if (colorName === undefined) {
47
+ colorName = '#c2410c';
48
+ }
49
+ const showName =
50
+ hideName !== true && (isFlowSocket === false || name !== 'flow');
51
+
52
+ return (
53
+ <div className={cx(styles.row, hide ? styles.hidden : undefined)}>
54
+ {isFlowSocket && <NavArrowRightSolid />}
55
+ {showName && <div className={styles.name}>{label ?? name}</div>}
56
+
57
+ <Handle
58
+ id={name}
59
+ type="target"
60
+ title={valueType}
61
+ position={Position.Left}
62
+ style={{
63
+ borderColor: colorName,
64
+ background: colorName
65
+ }}
66
+ className={cx(
67
+ styles.socket,
68
+ connected ? undefined : styles.disconnected
69
+ )}
70
+ isValidConnection={(connection: Connection) =>
71
+ isValidConnection(connection, instance, specJSON, {
72
+ autoConvert,
73
+ conversions
74
+ })
75
+ }
76
+ >
77
+ <Icon />
78
+ </Handle>
79
+ </div>
80
+ );
81
+ };
82
+
83
+ export default InputSocket;
@@ -0,0 +1,26 @@
1
+ .row {
2
+ display: flex;
3
+ flex-grow: 1;
4
+ align-items: center;
5
+ justify-content: flex-start;
6
+ height: 1.375rem;
7
+ }
8
+
9
+ .hidden {
10
+ display: none;
11
+ }
12
+
13
+ .name {
14
+ text-transform: capitalize;
15
+ margin-right: 0.5rem;
16
+ }
17
+
18
+ .socket {}
19
+
20
+ .socket svg {
21
+ stroke: currentColor;
22
+ }
23
+
24
+ .disconnected {
25
+ background: var(--ds-widget-bg, #333) !important;
26
+ }
@@ -0,0 +1,68 @@
1
+ import type {
2
+ NodeSpecJSON,
3
+ OutputSocketSpecJSON
4
+ } from '@kiberon-labs/behave-graph';
5
+ import cx from 'classnames';
6
+ import { type Connection, Handle, Position, useReactFlow } from 'reactflow';
7
+ import { isValidConnection } from '../../../util/isValidConnection.js';
8
+ import { NavArrowRightSolid } from 'iconoir-react';
9
+ import { useSystem } from '@/system/provider.js';
10
+ import { useStore } from 'zustand';
11
+ import styles from './styles.module.css';
12
+
13
+ export type OutputSocketProps = {
14
+ connected: boolean;
15
+ hide?: boolean;
16
+ label?: string;
17
+ specJSON: NodeSpecJSON[];
18
+ } & OutputSocketSpecJSON;
19
+
20
+ export default function OutputSocket({
21
+ specJSON,
22
+ connected,
23
+ hide,
24
+ valueType,
25
+ name,
26
+ label
27
+ }: OutputSocketProps) {
28
+ const instance = useReactFlow();
29
+ const sys = useSystem();
30
+ const { valueTypeColors, icons, defaultIcon } = useStore(sys.legendStore);
31
+ const autoConvert = useStore(sys.systemSettings, (s) => s.autoConvert);
32
+ const conversions = useStore(sys.conversionStore, (s) => s.conversions);
33
+ const Icon = icons[valueType] ?? defaultIcon;
34
+
35
+ const isFlowSocket = valueType === 'flow';
36
+ let colorName = valueTypeColors[valueType];
37
+ if (colorName === undefined) {
38
+ colorName = 'red';
39
+ }
40
+ const [backgroundColor, borderColor] = [colorName, colorName];
41
+ const showName = isFlowSocket === false || name !== 'flow';
42
+
43
+ return (
44
+ <div className={cx(styles.row, hide ? styles.hidden : undefined)}>
45
+ {showName && <div className={styles.name}>{label ?? name}</div>}
46
+ {isFlowSocket && <NavArrowRightSolid />}
47
+
48
+ <Handle
49
+ id={name}
50
+ type="source"
51
+ position={Position.Right}
52
+ style={{
53
+ borderColor: borderColor,
54
+ background: connected ? backgroundColor : undefined
55
+ }}
56
+ className={cx(styles.socket)}
57
+ isValidConnection={(connection: Connection) =>
58
+ isValidConnection(connection, instance, specJSON, {
59
+ autoConvert,
60
+ conversions
61
+ })
62
+ }
63
+ >
64
+ <Icon />
65
+ </Handle>
66
+ </div>
67
+ );
68
+ }
@@ -0,0 +1,22 @@
1
+ .row {
2
+ display: flex;
3
+ flex-grow: 1;
4
+ align-items: center;
5
+ justify-content: flex-end;
6
+ height: 1.375rem;
7
+ }
8
+
9
+ .hidden {
10
+ display: none;
11
+ }
12
+
13
+ .name {
14
+ text-transform: capitalize;
15
+ margin-right: 0.5rem;
16
+ }
17
+
18
+ .socket {}
19
+
20
+ .socket svg {
21
+ stroke: currentColor;
22
+ }
@@ -0,0 +1,135 @@
1
+ /*
2
+ * Markdown note nodes (notes plugin). Global classes rather than a CSS module:
3
+ * the note component is lazy-loaded, and the bundler emits a lazy chunk's CSS
4
+ * module into a separate dist asset that hosts never load — only the entry CSS
5
+ * (dist/index.css) ships. Rich-text content styling comes from the shared
6
+ * .ProseMirror rules in prosemirror.css.
7
+ */
8
+
9
+ .notes-node-root {
10
+ position: relative;
11
+ width: 100%;
12
+ height: 100%;
13
+ min-width: 160px;
14
+ min-height: 80px;
15
+ }
16
+
17
+ .notes-node {
18
+ display: flex;
19
+ flex-direction: column;
20
+ background: var(--ds-editor-bg);
21
+ color: var(--ds-editor-fg);
22
+ border: 1px solid var(--ds-blockquote-border);
23
+ border-radius: 2px;
24
+ width: 100%;
25
+ height: 100%;
26
+ overflow: hidden;
27
+ }
28
+
29
+ .notes-node__header {
30
+ display: flex;
31
+ align-items: center;
32
+ gap: 6px;
33
+ padding: 2px 8px;
34
+ background: var(--colors-bgSurface);
35
+ border-bottom: 1px solid var(--ds-border-subtle);
36
+ color: var(--ds-fg);
37
+ cursor: grab;
38
+ user-select: none;
39
+ font-size: 10px;
40
+ letter-spacing: 0.08em;
41
+ text-transform: uppercase;
42
+ }
43
+
44
+ .notes-node__grip {
45
+ opacity: 0.6;
46
+ }
47
+
48
+ .notes-node__editor {
49
+ flex: 1;
50
+ padding: 4px 10px;
51
+ cursor: text;
52
+ overflow: auto;
53
+ color: var(--ds-editor-fg);
54
+ }
55
+
56
+ .notes-node__editor .ProseMirror {
57
+ outline: none;
58
+ min-height: 100%;
59
+ caret-color: var(--ds-editor-fg);
60
+ }
61
+
62
+ .notes-node__editor .ProseMirror blockquote {
63
+ border-left: 3px solid var(--ds-blockquote-border);
64
+ padding-left: 1em;
65
+ margin: 0.5em 0;
66
+ font-style: italic;
67
+ }
68
+
69
+ /* Embedded videos (tiptap youtube extension) scale to the note width. */
70
+ .notes-node__editor .ProseMirror div[data-youtube-video] {
71
+ margin: 0.5em 0;
72
+ }
73
+
74
+ .notes-node__editor .ProseMirror div[data-youtube-video] iframe {
75
+ display: block;
76
+ width: 100%;
77
+ height: auto;
78
+ aspect-ratio: 16 / 9;
79
+ border: 0;
80
+ border-radius: 3px;
81
+ }
82
+
83
+ .notes-toolbar {
84
+ position: absolute;
85
+ bottom: calc(100% + 8px);
86
+ left: 50%;
87
+ transform: translateX(-50%);
88
+ display: flex;
89
+ flex-direction: column;
90
+ gap: 4px;
91
+ background: var(--ds-widget-bg);
92
+ border: 1px solid var(--ds-border-subtle);
93
+ border-radius: 4px;
94
+ box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
95
+ padding: 4px;
96
+ z-index: 1000;
97
+ animation: notes-toolbar-fade-in 0.15s ease;
98
+ pointer-events: auto;
99
+ }
100
+
101
+ .notes-toolbar__row {
102
+ display: flex;
103
+ gap: 2px;
104
+ align-items: center;
105
+ }
106
+
107
+ .notes-toolbar__embed {
108
+ display: flex;
109
+ gap: 4px;
110
+ align-items: center;
111
+ }
112
+
113
+ .notes-toolbar__embed vscode-textfield {
114
+ flex: 1;
115
+ min-width: 220px;
116
+ }
117
+
118
+ @keyframes notes-toolbar-fade-in {
119
+ from {
120
+ opacity: 0;
121
+ transform: translateX(-50%) translateY(-5px);
122
+ }
123
+
124
+ to {
125
+ opacity: 1;
126
+ transform: translateX(-50%) translateY(0);
127
+ }
128
+ }
129
+
130
+ .notes-toolbar__separator {
131
+ width: 1px;
132
+ height: 20px;
133
+ background: var(--ds-border-subtle);
134
+ margin: 0 4px;
135
+ }