@motiadev/workbench 0.0.6 → 0.0.7-build.20250529215343

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 (295) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +95 -40
  3. package/dist/README.md +105 -0
  4. package/dist/index.d.ts +1 -2
  5. package/dist/index.html +31 -0
  6. package/dist/index.js +0 -1
  7. package/dist/middleware.d.ts +2 -2
  8. package/dist/middleware.js +10 -17
  9. package/dist/postcss.config.mjs +9 -0
  10. package/dist/src/components/app-sidebar.d.ts +0 -1
  11. package/dist/src/components/app-sidebar.js +15 -8
  12. package/dist/src/components/endpoints/endpoint-badge.d.ts +10 -0
  13. package/dist/src/components/endpoints/endpoint-badge.js +22 -0
  14. package/dist/src/components/endpoints/endpoint-call.d.ts +8 -0
  15. package/dist/src/components/endpoints/endpoint-call.js +57 -0
  16. package/dist/src/components/endpoints/endpoints.d.ts +1 -0
  17. package/dist/src/components/endpoints/endpoints.js +34 -0
  18. package/dist/src/components/endpoints/hooks/use-get-endpoints.d.ts +15 -0
  19. package/dist/src/components/endpoints/hooks/use-get-endpoints.js +8 -0
  20. package/dist/src/components/endpoints/hooks/use-json-schema-to-json.d.ts +4 -0
  21. package/dist/src/components/endpoints/hooks/use-json-schema-to-json.js +11 -0
  22. package/dist/src/components/endpoints/hooks/use-path-params.d.ts +1 -0
  23. package/dist/src/components/endpoints/hooks/use-path-params.js +4 -0
  24. package/dist/src/components/endpoints/hooks/use-state-stream.d.ts +4 -0
  25. package/dist/src/components/endpoints/hooks/use-state-stream.js +8 -0
  26. package/dist/src/components/endpoints/hooks/utils.d.ts +1 -0
  27. package/dist/src/components/endpoints/hooks/utils.js +29 -0
  28. package/dist/src/components/endpoints/response-body.d.ts +7 -0
  29. package/dist/src/components/endpoints/response-body.js +6 -0
  30. package/dist/src/components/endpoints/selected-endpoint.d.ts +7 -0
  31. package/dist/src/components/endpoints/selected-endpoint.js +7 -0
  32. package/dist/src/components/{log-console.d.ts → logs/log-console.d.ts} +0 -1
  33. package/dist/src/components/logs/log-console.js +69 -0
  34. package/dist/src/components/logs/log-detail.d.ts +8 -0
  35. package/dist/src/components/logs/log-detail.js +15 -0
  36. package/dist/src/components/logs/log-field.d.ts +8 -0
  37. package/dist/src/components/logs/log-field.js +20 -0
  38. package/dist/src/components/{log-level-badge.d.ts → logs/log-level-badge.d.ts} +2 -1
  39. package/dist/src/components/{log-level-badge.js → logs/log-level-badge.js} +2 -2
  40. package/dist/src/components/logs/log-level-dot.d.ts +4 -0
  41. package/dist/src/components/logs/log-level-dot.js +17 -0
  42. package/dist/src/components/logs/logs.d.ts +1 -0
  43. package/dist/src/components/logs/logs.js +18 -0
  44. package/dist/src/components/root-motia.d.ts +2 -0
  45. package/dist/src/components/root-motia.js +5 -0
  46. package/dist/src/components/states/hooks/states-hooks.d.ts +3 -0
  47. package/dist/src/components/states/hooks/states-hooks.js +36 -0
  48. package/dist/src/components/states/state-detail.d.ts +7 -0
  49. package/dist/src/components/states/state-detail.js +12 -0
  50. package/dist/src/components/states/state-value.d.ts +8 -0
  51. package/dist/src/components/states/state-value.js +51 -0
  52. package/dist/src/components/states/states.d.ts +1 -0
  53. package/dist/src/components/states/states.js +21 -0
  54. package/dist/src/components/ui/badge.d.ts +3 -4
  55. package/dist/src/components/ui/badge.js +4 -4
  56. package/dist/src/components/ui/button.d.ts +2 -3
  57. package/dist/src/components/ui/button.js +2 -3
  58. package/dist/src/components/ui/collapsible.d.ts +1 -2
  59. package/dist/src/components/ui/collapsible.js +1 -1
  60. package/dist/src/components/ui/dialog.d.ts +2 -3
  61. package/dist/src/components/ui/dialog.js +12 -12
  62. package/dist/src/components/ui/dropdown-menu.d.ts +25 -0
  63. package/dist/src/components/ui/dropdown-menu.js +50 -0
  64. package/dist/src/components/ui/input.d.ts +0 -1
  65. package/dist/src/components/ui/label.d.ts +3 -4
  66. package/dist/src/components/ui/label.js +6 -6
  67. package/dist/src/components/ui/select.d.ts +2 -3
  68. package/dist/src/components/ui/select.js +14 -15
  69. package/dist/src/components/ui/separator.d.ts +0 -1
  70. package/dist/src/components/ui/sheet.d.ts +1 -2
  71. package/dist/src/components/ui/sheet.js +2 -2
  72. package/dist/src/components/ui/sidebar.d.ts +12 -67
  73. package/dist/src/components/ui/sidebar.js +14 -219
  74. package/dist/src/components/ui/skeleton.d.ts +1 -1
  75. package/dist/src/components/ui/switch.d.ts +2 -3
  76. package/dist/src/components/ui/switch.js +4 -4
  77. package/dist/src/components/ui/table.d.ts +0 -1
  78. package/dist/src/components/ui/table.js +1 -1
  79. package/dist/src/components/ui/textarea.d.ts +1 -2
  80. package/dist/src/components/ui/textarea.js +4 -4
  81. package/dist/src/components/ui/theme-toggle.d.ts +2 -0
  82. package/dist/src/components/ui/theme-toggle.js +11 -0
  83. package/dist/src/components/ui/tooltip.d.ts +0 -1
  84. package/dist/src/hooks/use-debounced.d.ts +1 -0
  85. package/dist/src/hooks/use-debounced.js +18 -0
  86. package/dist/src/hooks/use-list-flows.d.ts +0 -2
  87. package/dist/src/hooks/use-list-flows.js +6 -10
  88. package/dist/src/hooks/use-log-listener.d.ts +1 -6
  89. package/dist/src/hooks/use-log-listener.js +3 -18
  90. package/dist/src/hooks/use-mobile.d.ts +0 -1
  91. package/dist/src/hooks/use-theme.d.ts +6 -0
  92. package/dist/src/hooks/use-theme.js +28 -0
  93. package/dist/src/index.css +169 -0
  94. package/dist/src/lib/utils.d.ts +0 -1
  95. package/dist/src/main.d.ts +0 -8
  96. package/dist/src/main.js +11 -7
  97. package/dist/src/publicComponents/api-node.d.ts +2 -5
  98. package/dist/src/publicComponents/api-node.js +3 -3
  99. package/dist/src/publicComponents/base-handle.d.ts +1 -1
  100. package/dist/src/publicComponents/base-handle.js +5 -2
  101. package/dist/src/publicComponents/base-node.d.ts +5 -5
  102. package/dist/src/publicComponents/base-node.js +13 -8
  103. package/dist/src/publicComponents/colorMap.d.ts +6 -0
  104. package/dist/src/publicComponents/colorMap.js +6 -0
  105. package/dist/src/publicComponents/components/header-bar.d.ts +11 -0
  106. package/dist/src/publicComponents/components/header-bar.js +15 -0
  107. package/dist/src/publicComponents/cron-node.d.ts +2 -0
  108. package/dist/src/publicComponents/cron-node.js +7 -0
  109. package/dist/src/publicComponents/emits.d.ts +1 -1
  110. package/dist/src/publicComponents/emits.js +2 -2
  111. package/dist/src/publicComponents/event-node.d.ts +0 -2
  112. package/dist/src/publicComponents/event-node.js +3 -5
  113. package/dist/src/publicComponents/node-details.d.ts +17 -0
  114. package/dist/src/publicComponents/node-details.js +19 -0
  115. package/dist/src/publicComponents/node-props.d.ts +5 -3
  116. package/dist/src/publicComponents/noop-node.d.ts +0 -1
  117. package/dist/src/publicComponents/noop-node.js +1 -1
  118. package/dist/src/publicComponents/subscribe.d.ts +2 -3
  119. package/dist/src/publicComponents/subscribe.js +2 -2
  120. package/dist/src/route-wrapper.d.ts +2 -4
  121. package/dist/src/route-wrapper.js +2 -2
  122. package/dist/src/routes/endpoints-page.d.ts +1 -0
  123. package/dist/src/routes/endpoints-page.js +5 -0
  124. package/dist/src/routes/flow.d.ts +1 -0
  125. package/dist/src/routes/flow.js +22 -0
  126. package/dist/src/routes/index.d.ts +1 -2
  127. package/dist/src/routes/index.js +5 -8
  128. package/dist/src/routes/logs-page.d.ts +1 -0
  129. package/dist/src/routes/logs-page.js +12 -0
  130. package/dist/src/routes/states-page.d.ts +1 -0
  131. package/dist/src/routes/states-page.js +5 -0
  132. package/dist/src/stores/use-logs.d.ts +3 -2
  133. package/dist/src/stores/use-logs.js +52 -6
  134. package/dist/src/views/flow/arrow-head.d.ts +2 -2
  135. package/dist/src/views/flow/arrow-head.js +5 -1
  136. package/dist/src/views/flow/base-edge.d.ts +0 -1
  137. package/dist/src/views/flow/base-edge.js +25 -10
  138. package/dist/src/views/flow/flow-loader.d.ts +0 -1
  139. package/dist/src/views/flow/flow-loader.js +1 -1
  140. package/dist/src/views/flow/flow-view.d.ts +7 -2
  141. package/dist/src/views/flow/flow-view.js +44 -20
  142. package/dist/src/views/flow/hooks/use-get-flow-state.d.ts +14 -5
  143. package/dist/src/views/flow/hooks/use-get-flow-state.js +17 -8
  144. package/dist/src/views/flow/hooks/use-organize-nodes.d.ts +0 -1
  145. package/dist/src/views/flow/hooks/use-save-workflow-config.d.ts +9 -0
  146. package/dist/src/views/flow/hooks/use-save-workflow-config.js +23 -0
  147. package/dist/src/views/flow/legend.d.ts +3 -3
  148. package/dist/src/views/flow/legend.js +49 -39
  149. package/dist/src/views/flow/node-organizer.d.ts +1 -1
  150. package/dist/src/views/flow/node-organizer.js +4 -2
  151. package/dist/src/views/flow/nodes/api-flow-node.d.ts +0 -1
  152. package/dist/src/views/flow/nodes/event-flow-node.d.ts +0 -1
  153. package/dist/src/views/flow/nodes/language-indicator.d.ts +0 -1
  154. package/dist/src/views/flow/nodes/language-indicator.js +7 -7
  155. package/dist/src/views/flow/nodes/nodes.types.d.ts +39 -6
  156. package/dist/src/views/flow/nodes/noop-flow-node.d.ts +0 -1
  157. package/dist/tailwind.config.js +9 -77
  158. package/dist/tsconfig.app.tsbuildinfo +1 -1
  159. package/dist/tsconfig.node.tsbuildinfo +1 -1
  160. package/package.json +36 -42
  161. package/postcss.config.mjs +9 -0
  162. package/dist/index.d.ts.map +0 -1
  163. package/dist/middleware.d.ts.map +0 -1
  164. package/dist/src/components/app-sidebar.d.ts.map +0 -1
  165. package/dist/src/components/log-console.d.ts.map +0 -1
  166. package/dist/src/components/log-console.js +0 -20
  167. package/dist/src/components/log-level-badge.d.ts.map +0 -1
  168. package/dist/src/components/ui/badge.d.ts.map +0 -1
  169. package/dist/src/components/ui/button.d.ts.map +0 -1
  170. package/dist/src/components/ui/collapsible.d.ts.map +0 -1
  171. package/dist/src/components/ui/dialog.d.ts.map +0 -1
  172. package/dist/src/components/ui/input.d.ts.map +0 -1
  173. package/dist/src/components/ui/label.d.ts.map +0 -1
  174. package/dist/src/components/ui/select.d.ts.map +0 -1
  175. package/dist/src/components/ui/separator.d.ts.map +0 -1
  176. package/dist/src/components/ui/sheet.d.ts.map +0 -1
  177. package/dist/src/components/ui/sidebar.d.ts.map +0 -1
  178. package/dist/src/components/ui/skeleton.d.ts.map +0 -1
  179. package/dist/src/components/ui/switch.d.ts.map +0 -1
  180. package/dist/src/components/ui/table.d.ts.map +0 -1
  181. package/dist/src/components/ui/textarea.d.ts.map +0 -1
  182. package/dist/src/components/ui/tooltip.d.ts.map +0 -1
  183. package/dist/src/hooks/use-list-flows.d.ts.map +0 -1
  184. package/dist/src/hooks/use-log-listener.d.ts.map +0 -1
  185. package/dist/src/hooks/use-mobile.d.ts.map +0 -1
  186. package/dist/src/lib/utils.d.ts.map +0 -1
  187. package/dist/src/main.d.ts.map +0 -1
  188. package/dist/src/publicComponents/api-node.d.ts.map +0 -1
  189. package/dist/src/publicComponents/base-handle.d.ts.map +0 -1
  190. package/dist/src/publicComponents/base-node.d.ts.map +0 -1
  191. package/dist/src/publicComponents/emits.d.ts.map +0 -1
  192. package/dist/src/publicComponents/event-node.d.ts.map +0 -1
  193. package/dist/src/publicComponents/node-props.d.ts.map +0 -1
  194. package/dist/src/publicComponents/noop-node.d.ts.map +0 -1
  195. package/dist/src/publicComponents/subscribe.d.ts.map +0 -1
  196. package/dist/src/route-wrapper.d.ts.map +0 -1
  197. package/dist/src/routeTree.gen.d.ts +0 -53
  198. package/dist/src/routeTree.gen.d.ts.map +0 -1
  199. package/dist/src/routeTree.gen.js +0 -45
  200. package/dist/src/routes/__root.d.ts +0 -2
  201. package/dist/src/routes/__root.d.ts.map +0 -1
  202. package/dist/src/routes/__root.js +0 -15
  203. package/dist/src/routes/flow/$id.d.ts +0 -4
  204. package/dist/src/routes/flow/$id.d.ts.map +0 -1
  205. package/dist/src/routes/flow/$id.js +0 -15
  206. package/dist/src/routes/index.d.ts.map +0 -1
  207. package/dist/src/stores/use-logs.d.ts.map +0 -1
  208. package/dist/src/views/flow/arrow-head.d.ts.map +0 -1
  209. package/dist/src/views/flow/base-edge.d.ts.map +0 -1
  210. package/dist/src/views/flow/flow-loader.d.ts.map +0 -1
  211. package/dist/src/views/flow/flow-view.d.ts.map +0 -1
  212. package/dist/src/views/flow/hooks/use-get-flow-state.d.ts.map +0 -1
  213. package/dist/src/views/flow/hooks/use-organize-nodes.d.ts.map +0 -1
  214. package/dist/src/views/flow/legend.d.ts.map +0 -1
  215. package/dist/src/views/flow/node-organizer.d.ts.map +0 -1
  216. package/dist/src/views/flow/nodes/api-flow-node.d.ts.map +0 -1
  217. package/dist/src/views/flow/nodes/event-flow-node.d.ts.map +0 -1
  218. package/dist/src/views/flow/nodes/json-schema-form.d.ts +0 -9
  219. package/dist/src/views/flow/nodes/json-schema-form.d.ts.map +0 -1
  220. package/dist/src/views/flow/nodes/json-schema-form.js +0 -35
  221. package/dist/src/views/flow/nodes/language-indicator.d.ts.map +0 -1
  222. package/dist/src/views/flow/nodes/nodes.types.d.ts.map +0 -1
  223. package/dist/src/views/flow/nodes/noop-flow-node.d.ts.map +0 -1
  224. package/dist/tailwind.config.d.ts +0 -4
  225. package/dist/tailwind.config.d.ts.map +0 -1
  226. package/dist/vite.config.d.ts +0 -11
  227. package/dist/vite.config.d.ts.map +0 -1
  228. package/dist/vite.config.js +0 -18
  229. package/eslint.config.js +0 -28
  230. package/index.html +0 -19
  231. package/index.tsx +0 -10
  232. package/middleware.ts +0 -48
  233. package/postcss.config.js +0 -6
  234. package/src/assets/.empty +0 -0
  235. package/src/components/app-sidebar.tsx +0 -55
  236. package/src/components/log-console.tsx +0 -76
  237. package/src/components/log-level-badge.tsx +0 -12
  238. package/src/components/ui/badge.tsx +0 -31
  239. package/src/components/ui/button.tsx +0 -47
  240. package/src/components/ui/collapsible.tsx +0 -9
  241. package/src/components/ui/dialog.tsx +0 -120
  242. package/src/components/ui/input.tsx +0 -21
  243. package/src/components/ui/label.tsx +0 -26
  244. package/src/components/ui/select.tsx +0 -157
  245. package/src/components/ui/separator.tsx +0 -22
  246. package/src/components/ui/sheet.tsx +0 -106
  247. package/src/components/ui/sidebar.tsx +0 -637
  248. package/src/components/ui/skeleton.tsx +0 -7
  249. package/src/components/ui/switch.tsx +0 -27
  250. package/src/components/ui/table.tsx +0 -76
  251. package/src/components/ui/textarea.tsx +0 -22
  252. package/src/components/ui/tooltip.tsx +0 -32
  253. package/src/hooks/use-list-flows.tsx +0 -20
  254. package/src/hooks/use-log-listener.tsx +0 -32
  255. package/src/hooks/use-mobile.tsx +0 -19
  256. package/src/index.css +0 -190
  257. package/src/lib/utils.ts +0 -6
  258. package/src/main.tsx +0 -28
  259. package/src/publicComponents/api-node.tsx +0 -28
  260. package/src/publicComponents/base-handle.tsx +0 -43
  261. package/src/publicComponents/base-node.tsx +0 -57
  262. package/src/publicComponents/emits.tsx +0 -22
  263. package/src/publicComponents/event-node.tsx +0 -36
  264. package/src/publicComponents/node-props.tsx +0 -15
  265. package/src/publicComponents/noop-node.tsx +0 -21
  266. package/src/publicComponents/subscribe.tsx +0 -19
  267. package/src/route-wrapper.tsx +0 -9
  268. package/src/routeTree.gen.ts +0 -109
  269. package/src/routes/__root.tsx +0 -26
  270. package/src/routes/flow/$id.tsx +0 -21
  271. package/src/routes/index.tsx +0 -13
  272. package/src/stores/use-logs.ts +0 -22
  273. package/src/views/flow/arrow-head.tsx +0 -13
  274. package/src/views/flow/base-edge.tsx +0 -31
  275. package/src/views/flow/flow-loader.tsx +0 -3
  276. package/src/views/flow/flow-view.tsx +0 -72
  277. package/src/views/flow/hooks/use-get-flow-state.tsx +0 -93
  278. package/src/views/flow/hooks/use-organize-nodes.ts +0 -60
  279. package/src/views/flow/legend.tsx +0 -96
  280. package/src/views/flow/node-organizer.tsx +0 -70
  281. package/src/views/flow/nodes/api-flow-node.tsx +0 -6
  282. package/src/views/flow/nodes/event-flow-node.tsx +0 -6
  283. package/src/views/flow/nodes/json-schema-form.tsx +0 -110
  284. package/src/views/flow/nodes/language-indicator.tsx +0 -74
  285. package/src/views/flow/nodes/nodes.types.ts +0 -36
  286. package/src/views/flow/nodes/noop-flow-node.tsx +0 -6
  287. package/src/vite-env.d.ts +0 -1
  288. package/tailwind.config.ts +0 -75
  289. package/tsconfig.app.json +0 -32
  290. package/tsconfig.json +0 -14
  291. package/tsconfig.node.json +0 -32
  292. package/tsconfig.node.tsbuildinfo +0 -1
  293. package/vite.config.ts +0 -14
  294. /package/{components.json → dist/components.json} +0 -0
  295. /package/{public → dist/public}/.empty +0 -0
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const ThemeToggle: React.FC;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Moon, Sun } from 'lucide-react';
3
+ import { useTheme } from '@/hooks/use-theme';
4
+ import { cn } from '@/lib/utils';
5
+ export const ThemeToggle = () => {
6
+ const { theme, setTheme } = useTheme();
7
+ const toggleTheme = () => {
8
+ setTheme(theme === 'light' ? 'dark' : 'light');
9
+ };
10
+ return (_jsxs("button", { onClick: toggleTheme, className: "relative flex items-center cursor-pointer w-16 h-8 bg-muted rounded-full p-1 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2", "aria-label": `Switch to ${theme === 'light' ? 'dark' : 'light'} theme`, children: [_jsx("div", { className: cn('absolute w-6 h-6 bg-background border border-border rounded-full shadow-sm transition-transform duration-200 ease-in-out', theme === 'dark' ? 'translate-x-8' : 'translate-x-0') }), _jsx("div", { className: "flex items-center justify-center w-6 h-6 z-10", children: _jsx(Sun, { className: cn('h-3.5 w-3.5 transition-colors duration-200', theme === 'light' ? 'text-foreground' : 'text-muted-foreground') }) }), _jsx("div", { className: "flex items-center justify-center w-6 h-6 z-10 ml-2", children: _jsx(Moon, { className: cn('h-3.5 w-3.5 transition-colors duration-200', theme === 'dark' ? 'text-foreground' : 'text-muted-foreground') }) })] }));
11
+ };
@@ -5,4 +5,3 @@ declare const Tooltip: React.FC<TooltipPrimitive.TooltipProps>;
5
5
  declare const TooltipTrigger: React.ForwardRefExoticComponent<TooltipPrimitive.TooltipTriggerProps & React.RefAttributes<HTMLButtonElement>>;
6
6
  declare const TooltipContent: React.ForwardRefExoticComponent<Omit<TooltipPrimitive.TooltipContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
7
7
  export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
8
- //# sourceMappingURL=tooltip.d.ts.map
@@ -0,0 +1 @@
1
+ export declare const useDebounced: (fn: () => void, delay?: number) => () => void;
@@ -0,0 +1,18 @@
1
+ import { useCallback, useEffect, useRef } from 'react';
2
+ export const useDebounced = (fn, delay = 500) => {
3
+ const saveTimeoutRef = useRef(null);
4
+ const debouncedFn = useCallback(() => {
5
+ if (saveTimeoutRef.current) {
6
+ clearTimeout(saveTimeoutRef.current);
7
+ }
8
+ saveTimeoutRef.current = setTimeout(fn, delay);
9
+ }, [fn, delay]);
10
+ useEffect(() => {
11
+ return () => {
12
+ if (saveTimeoutRef.current) {
13
+ clearTimeout(saveTimeoutRef.current);
14
+ }
15
+ };
16
+ }, []);
17
+ return debouncedFn;
18
+ };
@@ -4,7 +4,5 @@ type Flow = {
4
4
  };
5
5
  export declare const useListFlows: () => {
6
6
  flows: Flow[];
7
- isLoading: boolean;
8
7
  };
9
8
  export {};
10
- //# sourceMappingURL=use-list-flows.d.ts.map
@@ -1,12 +1,8 @@
1
- import { useEffect, useState } from 'react';
1
+ import { useStreamGroup } from '@motiadev/stream-client-react';
2
2
  export const useListFlows = () => {
3
- const [isLoading, setIsLoading] = useState(true);
4
- const [flows, setFlows] = useState([]);
5
- useEffect(() => {
6
- fetch('/flows')
7
- .then((res) => res.json())
8
- .then(setFlows)
9
- .finally(() => setIsLoading(false));
10
- }, []);
11
- return { flows, isLoading };
3
+ const { data: flows } = useStreamGroup({
4
+ streamName: '__motia.flows',
5
+ groupId: 'default',
6
+ });
7
+ return { flows };
12
8
  };
@@ -1,6 +1 @@
1
- type UseWebSocketReturn = {
2
- isConnected: boolean;
3
- };
4
- export declare const useLogListener: () => UseWebSocketReturn;
5
- export {};
6
- //# sourceMappingURL=use-log-listener.d.ts.map
1
+ export declare const useLogListener: () => void;
@@ -1,22 +1,7 @@
1
1
  import { useLogs } from '@/stores/use-logs';
2
- import { useState, useEffect } from 'react';
3
- import { io } from 'socket.io-client';
4
- const socket = io('/');
2
+ import { useStreamEventHandler, useStreamGroup } from '@motiadev/stream-client-react';
5
3
  export const useLogListener = () => {
6
- const [isConnected, setIsConnected] = useState(socket.connected);
7
4
  const addLog = useLogs((state) => state.addLog);
8
- useEffect(() => {
9
- const onConnect = () => setIsConnected(true);
10
- const onDisconnect = () => setIsConnected(false);
11
- const onLog = (log) => addLog(log);
12
- socket.on('connect', onConnect);
13
- socket.on('disconnect', onDisconnect);
14
- socket.on('log', onLog);
15
- return () => {
16
- socket.off('connect', onConnect);
17
- socket.off('disconnect', onDisconnect);
18
- socket.off('log', onLog);
19
- };
20
- }, [addLog]);
21
- return { isConnected };
5
+ const { event } = useStreamGroup({ streamName: '__motia.logs', groupId: 'default' });
6
+ useStreamEventHandler({ event, type: 'log', listener: addLog }, [addLog]);
22
7
  };
@@ -1,2 +1 @@
1
1
  export declare function useIsMobile(): boolean;
2
- //# sourceMappingURL=use-mobile.d.ts.map
@@ -0,0 +1,6 @@
1
+ type Theme = 'dark' | 'light' | 'system';
2
+ export declare const useTheme: () => {
3
+ theme: Theme;
4
+ setTheme: (newTheme: Theme) => void;
5
+ };
6
+ export {};
@@ -0,0 +1,28 @@
1
+ import { useCallback, useEffect, useState } from 'react';
2
+ const storageKey = 'motia-workbench-theme';
3
+ const defaultTheme = localStorage.getItem(storageKey) || 'system';
4
+ const updateTheme = (theme) => {
5
+ const root = window.document.body;
6
+ root.classList.remove('light', 'dark');
7
+ if (theme === 'system') {
8
+ const systemTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
9
+ root.classList.add(systemTheme);
10
+ return;
11
+ }
12
+ root.classList.add(theme);
13
+ };
14
+ export const useTheme = () => {
15
+ const [theme, _setTheme] = useState(defaultTheme);
16
+ useEffect(() => {
17
+ updateTheme(defaultTheme);
18
+ }, []);
19
+ const setTheme = useCallback((newTheme) => {
20
+ localStorage.setItem(storageKey, newTheme);
21
+ _setTheme(newTheme);
22
+ updateTheme(newTheme);
23
+ }, []);
24
+ return {
25
+ theme,
26
+ setTheme,
27
+ };
28
+ };
@@ -0,0 +1,169 @@
1
+ @import 'tailwindcss';
2
+ @import 'tw-animate-css';
3
+ @config "../tailwind.config.js";
4
+
5
+ @custom-variant dark (&:is(.dark *));
6
+
7
+ :root {
8
+ line-height: 1.5;
9
+ font-size: 16px;
10
+
11
+ color-scheme: light dark;
12
+ font-family: var(--default-font-family, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"), serif;
13
+ font-synthesis: none;
14
+ text-rendering: optimizeLegibility;
15
+ -webkit-font-smoothing: antialiased;
16
+ -moz-osx-font-smoothing: grayscale;
17
+ width: 100%;
18
+ font-optical-sizing: auto;
19
+
20
+ --radius: 0.625rem;
21
+ --background: oklch(1 0 0);
22
+ --foreground: oklch(0.145 0 0);
23
+ --card: oklch(0.98 0 0);
24
+ --card-foreground: oklch(0.145 0 0);
25
+ --popover: oklch(1 0 0);
26
+ --popover-foreground: oklch(0.145 0 0);
27
+ --primary: oklch(0.205 0 0);
28
+ --primary-foreground: oklch(0.985 0 0);
29
+ --secondary: oklch(0.97 0 0);
30
+ --secondary-foreground: oklch(0.205 0 0);
31
+ --muted: oklch(0.97 0 0);
32
+ --muted-foreground: oklch(0.556 0 0);
33
+ --accent: oklch(0.97 0 0);
34
+ --accent-foreground: oklch(0.205 0 0);
35
+ --destructive: oklch(0.577 0.245 27.325);
36
+ --border: oklch(0.922 0 0);
37
+ --input: oklch(0.922 0 0);
38
+ --ring: oklch(0.708 0 0);
39
+ --chart-1: oklch(0.646 0.222 41.116);
40
+ --chart-2: oklch(0.6 0.118 184.704);
41
+ --chart-3: oklch(0.398 0.07 227.392);
42
+ --chart-4: oklch(0.828 0.189 84.429);
43
+ --chart-5: oklch(0.769 0.188 70.08);
44
+ --sidebar: oklch(0.985 0 0);
45
+ --sidebar-foreground: oklch(0.145 0 0);
46
+ --sidebar-primary: oklch(0.205 0 0);
47
+ --sidebar-primary-foreground: oklch(0.985 0 0);
48
+ --sidebar-accent: oklch(0.97 0 0);
49
+ --sidebar-accent-foreground: oklch(0.205 0 0);
50
+ --sidebar-border: oklch(0.922 0 0);
51
+ --sidebar-ring: oklch(0.708 0 0);
52
+ }
53
+
54
+ .dark {
55
+ --background: oklch(0.145 0 0);
56
+ --foreground: oklch(0.985 0 0);
57
+ --card: oklch(0.205 0 0);
58
+ --card-foreground: oklch(0.985 0 0);
59
+ --popover: oklch(0.205 0 0);
60
+ --popover-foreground: oklch(0.985 0 0);
61
+ --primary: oklch(0.922 0 0);
62
+ --primary-foreground: oklch(0.205 0 0);
63
+ --secondary: oklch(0.269 0 0);
64
+ --secondary-foreground: oklch(0.985 0 0);
65
+ --muted: oklch(0.269 0 0);
66
+ --muted-foreground: oklch(0.708 0 0);
67
+ --accent: oklch(0.269 0 0);
68
+ --accent-foreground: oklch(0.985 0 0);
69
+ --destructive: oklch(0.704 0.191 22.216);
70
+ --border: oklch(1 0 0 / 10%);
71
+ --input: oklch(1 0 0 / 15%);
72
+ --ring: oklch(0.556 0 0);
73
+ --chart-1: oklch(0.488 0.243 264.376);
74
+ --chart-2: oklch(0.696 0.17 162.48);
75
+ --chart-3: oklch(0.769 0.188 70.08);
76
+ --chart-4: oklch(0.627 0.265 303.9);
77
+ --chart-5: oklch(0.645 0.246 16.439);
78
+ --sidebar: oklch(0.205 0 0);
79
+ --sidebar-foreground: oklch(0.985 0 0);
80
+ --sidebar-primary: oklch(0.488 0.243 264.376);
81
+ --sidebar-primary-foreground: oklch(0.985 0 0);
82
+ --sidebar-accent: oklch(0.269 0 0);
83
+ --sidebar-accent-foreground: oklch(0.985 0 0);
84
+ --sidebar-border: oklch(1 0 0 / 10%);
85
+ --sidebar-ring: oklch(0.556 0 0);
86
+ }
87
+
88
+ @theme inline {
89
+ --radius-sm: calc(var(--radius) - 4px);
90
+ --radius-md: calc(var(--radius) - 2px);
91
+ --radius-lg: var(--radius);
92
+ --radius-xl: calc(var(--radius) + 4px);
93
+ --color-background: var(--background);
94
+ --color-foreground: var(--foreground);
95
+ --color-card: var(--card);
96
+ --color-card-foreground: var(--card-foreground);
97
+ --color-popover: var(--popover);
98
+ --color-popover-foreground: var(--popover-foreground);
99
+ --color-primary: var(--primary);
100
+ --color-primary-foreground: var(--primary-foreground);
101
+ --color-secondary: var(--secondary);
102
+ --color-secondary-foreground: var(--secondary-foreground);
103
+ --color-muted: var(--muted);
104
+ --color-muted-foreground: var(--muted-foreground);
105
+ --color-accent: var(--accent);
106
+ --color-accent-foreground: var(--accent-foreground);
107
+ --color-destructive: var(--destructive);
108
+ --color-border: var(--border);
109
+ --color-input: var(--input);
110
+ --color-ring: var(--ring);
111
+ --color-chart-1: var(--chart-1);
112
+ --color-chart-2: var(--chart-2);
113
+ --color-chart-3: var(--chart-3);
114
+ --color-chart-4: var(--chart-4);
115
+ --color-chart-5: var(--chart-5);
116
+ --color-sidebar: var(--sidebar);
117
+ --color-sidebar-foreground: var(--sidebar-foreground);
118
+ --color-sidebar-primary: var(--sidebar-primary);
119
+ --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
120
+ --color-sidebar-accent: var(--sidebar-accent);
121
+ --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
122
+ --color-sidebar-border: var(--sidebar-border);
123
+ --color-sidebar-ring: var(--sidebar-ring);
124
+ }
125
+
126
+ body {
127
+ margin: 0;
128
+ place-items: center;
129
+ min-height: 100dvh;
130
+ width: 100%;
131
+ }
132
+
133
+ body,
134
+ #root {
135
+ width: 100dvw;
136
+ height: 100dvh;
137
+ }
138
+
139
+ strong {
140
+ font-weight: 800;
141
+ }
142
+
143
+ .react-flow__attribution {
144
+ display: none;
145
+ }
146
+
147
+ @layer base {
148
+ * {
149
+ @apply border-border;
150
+ }
151
+ body {
152
+ @apply bg-background text-foreground;
153
+ }
154
+ }
155
+
156
+ @keyframes flowDash {
157
+ 0% {
158
+ stroke-dashoffset: 0;
159
+ }
160
+ 100% {
161
+ stroke-dashoffset: -20;
162
+ }
163
+ }
164
+
165
+ .edge-animated {
166
+ stroke-dasharray: 5; /* length of dash pattern */
167
+ stroke-linecap: round; /* round the dash ends */
168
+ animation: flowDash 1s linear infinite;
169
+ }
@@ -1,3 +1,2 @@
1
1
  import { type ClassValue } from 'clsx';
2
2
  export declare function cn(...inputs: ClassValue[]): string;
3
- //# sourceMappingURL=utils.d.ts.map
@@ -1,9 +1 @@
1
1
  import './index.css';
2
- declare const router: import("@tanstack/react-router").Router<import("@tanstack/react-router").RootRoute<undefined, {}, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, import("./routeTree.gen").RootRouteChildren, import("./routeTree.gen").FileRouteTypes>, import("@tanstack/react-router").TrailingSlashOption, boolean, import("@tanstack/history").RouterHistory, Record<string, any>, Record<string, any>>;
3
- declare module '@tanstack/react-router' {
4
- interface Register {
5
- router: typeof router;
6
- }
7
- }
8
- export {};
9
- //# sourceMappingURL=main.d.ts.map
package/dist/src/main.js CHANGED
@@ -1,15 +1,19 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { MotiaStreamProvider } from '@motiadev/stream-client-react';
2
3
  import { StrictMode } from 'react';
3
4
  import { createRoot } from 'react-dom/client';
5
+ import { BrowserRouter, Route, Routes } from 'react-router';
6
+ import { RootMotia } from './components/root-motia';
4
7
  import './index.css';
5
- import { RouterProvider, createRouter } from '@tanstack/react-router';
6
- // Import the generated route tree
7
- import { routeTree } from './routeTree.gen';
8
- // Create a new router instance
9
- const router = createRouter({ routeTree });
8
+ import { RouteWrapper } from './route-wrapper';
9
+ import { Index } from './routes';
10
+ import { EndpointsPage } from './routes/endpoints-page';
11
+ import { Flow } from './routes/flow';
12
+ import { LogsPage } from './routes/logs-page';
13
+ import { StatesPage } from './routes/states-page';
10
14
  // Render the app
11
15
  const rootElement = document.getElementById('root');
12
16
  if (!rootElement.innerHTML) {
13
17
  const root = createRoot(rootElement);
14
- root.render(_jsx(StrictMode, { children: _jsx(RouterProvider, { router: router }) }));
18
+ root.render(_jsx(StrictMode, { children: _jsx(MotiaStreamProvider, { address: "ws://localhost:3000", children: _jsx(BrowserRouter, { children: _jsx(RootMotia, { children: _jsx(RouteWrapper, { children: _jsxs(Routes, { children: [_jsx(Route, { path: "/", element: _jsx(Index, {}) }), _jsx(Route, { path: "/flow/:id", element: _jsx(Flow, {}) }), _jsx(Route, { path: "/logs", element: _jsx(LogsPage, {}) }), _jsx(Route, { path: "/states", element: _jsx(StatesPage, {}) }), _jsx(Route, { path: "/endpoints", element: _jsx(EndpointsPage, {}) })] }) }) }) }) }) }));
15
19
  }
@@ -1,8 +1,5 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { ApiNodeProps } from './node-props';
3
- type Props = PropsWithChildren<ApiNodeProps & {
4
- excludePubsub?: boolean;
5
- }>;
6
- export declare const ApiNode: ({ data, children, excludePubsub }: Props) => import("react/jsx-runtime").JSX.Element;
3
+ type Props = PropsWithChildren<ApiNodeProps>;
4
+ export declare const ApiNode: ({ data, children }: Props) => import("react/jsx-runtime").JSX.Element;
7
5
  export {};
8
- //# sourceMappingURL=api-node.d.ts.map
@@ -1,7 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Webhook } from 'lucide-react';
3
3
  import { BaseNode } from './base-node';
4
- import { Emits } from './emits';
5
- export const ApiNode = ({ data, children, excludePubsub }) => {
6
- return (_jsxs(BaseNode, { variant: "api", title: data.name, disableSourceHandle: !data.emits?.length, disableTargetHandle: !data.subscribes?.length, children: [data.description && _jsx("div", { className: "text-sm max-w-[300px] text-white/60", children: data.description }), children, data.webhookUrl && (_jsxs("div", { className: "flex gap-1 items-center text-xs text-white/60", children: [_jsx(Webhook, { className: "w-3 h-3 text-white/40" }), _jsx("div", { className: "font-mono", children: data.webhookUrl })] })), !excludePubsub && _jsx(Emits, { emits: data.emits })] }));
4
+ import { DetailItem, NodeDetails } from './node-details';
5
+ export const ApiNode = ({ data, children }) => {
6
+ return (_jsxs(BaseNode, { variant: "api", title: data.name, language: data.language, disableSourceHandle: !data.emits?.length && !data.virtualEmits?.length, disableTargetHandle: !data.subscribes?.length && !data.virtualSubscribes?.length, children: [data.description && _jsx("div", { className: "text-sm text-muted-foreground", children: data.description }), children, data.webhookUrl && (_jsxs("div", { className: "flex gap-1 items-center text-xs text-muted-foreground", children: [_jsx(Webhook, { className: "w-3 h-3 text-muted-foreground/40" }), _jsx("div", { className: "font-mono", children: data.webhookUrl })] })), _jsx(NodeDetails, { type: "api", name: data.name, subscribes: data.subscribes, emits: data.emits, description: data.description, language: data.language, children: _jsx(DetailItem, { label: "Webhook URL", children: _jsxs("div", { className: "flex gap-1 items-center text-xs text-muted-foreground", children: [_jsx(Webhook, { className: "w-3 h-3 text-muted-foreground/40" }), _jsx("div", { className: "font-mono", children: data.webhookUrl })] }) }) })] }));
7
7
  };
@@ -2,7 +2,7 @@ import React, { HTMLAttributes } from 'react';
2
2
  import { HandleProps } from '@xyflow/react';
3
3
  type Props = HandleProps & Omit<HTMLAttributes<HTMLDivElement>, 'id'> & {
4
4
  isHidden?: boolean;
5
+ variant?: string | null;
5
6
  };
6
7
  export declare const BaseHandle: React.FC<Props>;
7
8
  export {};
8
- //# sourceMappingURL=base-handle.d.ts.map
@@ -1,7 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Position, Handle as RFHandle } from '@xyflow/react';
3
3
  import clsx from 'clsx';
4
+ import { colorMap } from './colorMap';
4
5
  export const BaseHandle = (props) => {
5
- const { isHidden, position, ...rest } = props;
6
- return (_jsx("div", { className: clsx('absolute w-1 h-1', position === Position.Top && '-top-[10px]', position === Position.Bottom && '-bottom-[10px]', 'left-1/2 -ml-[2px]', isHidden && 'hidden'), children: _jsx(RFHandle, { ...rest, position: position, className: "\n !static\n !w-1\n !h-1\n !min-w-[6px]\n !min-h-[6px]\n !p-0\n !border-none\n !bg-[#666666]\n !transform-none\n !rounded-full\n !outline-none\n !shadow-none\n " }) }));
6
+ const { isHidden, position, variant, ...rest } = props;
7
+ return (_jsx("div", { className: clsx('absolute w-[6px] h-[6px]', position === Position.Top && '-top-[20px]', position === Position.Bottom && '-bottom-[20px]', 'left-1/2 -ml-[2px]', isHidden && 'hidden'), children: _jsx(RFHandle, { ...rest, position: position, style: {
8
+ background: colorMap[variant],
9
+ }, className: "\n !static\n !w-[6px]\n !h-[6px]\n !min-w-[6px]\n !min-h-[6px]\n !p-0\n !border-none\n !transform-none\n !rounded-full\n !outline-none\n !shadow-none\n " }) }));
7
10
  };
@@ -1,11 +1,12 @@
1
1
  import { type VariantProps } from 'class-variance-authority';
2
- import { PropsWithChildren } from 'react';
3
- declare const baseBackgroundVariants: (props?: ({
4
- variant?: "event" | "api" | "noop" | null | undefined;
2
+ import React, { PropsWithChildren } from 'react';
3
+ declare const baseDot: (props?: ({
4
+ variant?: "event" | "api" | "noop" | "cron" | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
6
  type Props = PropsWithChildren<{
7
- variant?: VariantProps<typeof baseBackgroundVariants>['variant'];
8
7
  title: string;
8
+ variant: VariantProps<typeof baseDot>['variant'];
9
+ language?: string;
9
10
  headerChildren?: React.ReactNode;
10
11
  className?: string;
11
12
  disableSourceHandle?: boolean;
@@ -13,4 +14,3 @@ type Props = PropsWithChildren<{
13
14
  }>;
14
15
  export declare const BaseNode: (props: Props) => import("react/jsx-runtime").JSX.Element;
15
16
  export {};
16
- //# sourceMappingURL=base-node.d.ts.map
@@ -3,18 +3,23 @@ import { cn } from '@/lib/utils';
3
3
  import { Position } from '@xyflow/react';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import { BaseHandle } from './base-handle';
6
- const baseNodeVariants = cva('relative flex flex-col min-w-[300px] rounded-md overflow-hidden font-mono');
7
- const baseBackgroundVariants = cva('absolute -inset-[1px] rounded-md bg-gradient-to-r', {
6
+ import { LanguageIndicator } from '../views/flow/nodes/language-indicator';
7
+ import { colorMap } from './colorMap';
8
+ const baseDot = cva('w-[6px] h-[6px] rounded-full', {
8
9
  variants: {
9
10
  variant: {
10
- event: 'from-teal-500/20 to-teal-400/10',
11
- api: 'from-blue-500/20 to-blue-400/10',
12
- noop: 'from-white/20 to-white/10',
11
+ event: 'bg-[rgba(0,117,255,1)]',
12
+ api: 'bg-[rgba(189,255,0,1)]',
13
+ noop: 'bg-[rgba(255,49,234,1)]',
14
+ cron: 'bg-[rgba(255,113,11,1)]',
13
15
  },
14
16
  },
15
17
  });
16
- const HeaderBar = ({ text, children }) => (_jsxs("div", { className: "px-3 py-1 border-b border-white/20 bg-black/30 text-xs text-white/70 flex justify-between items-center", children: [_jsx("span", { children: text }), children] }));
18
+ const Dot = ({ variant }) => (_jsx("div", { className: cn(baseDot({ variant })) }));
19
+ const HeaderBar = ({ text, variant, children, }) => (_jsxs("div", { className: "text-sm text-foreground flex justify-between items-center gap-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Dot, { variant: variant }), _jsx("span", { children: text })] }), children] }));
17
20
  export const BaseNode = (props) => {
18
- const { title, variant, className, children, disableSourceHandle, disableTargetHandle, headerChildren } = props;
19
- return (_jsxs("div", { className: "group relative", children: [_jsx("div", { className: cn(baseBackgroundVariants({ variant })) }), _jsxs("div", { className: cn(baseNodeVariants(), className), children: [_jsx(HeaderBar, { text: title, children: headerChildren }), _jsx("div", { className: "p-4 space-y-3", children: children })] }), !disableTargetHandle && _jsx(BaseHandle, { type: "target", position: Position.Top }), !disableSourceHandle && _jsx(BaseHandle, { type: "source", position: Position.Bottom }), _jsx("div", { className: "absolute inset-0 -z-10 translate-y-1 translate-x-1 bg-black/20 rounded-md border border-white/5" })] }));
21
+ const { title, variant, children, disableSourceHandle, disableTargetHandle, language } = props;
22
+ return (_jsx("div", { className: "p-[1px] rounded-lg max-w-[350px] ", children: _jsx("div", { className: "rounded-lg bg-background p-4 border border-muted border-solid", "data-testid": `node-${title?.toLowerCase().replace(/ /g, '-')}`, style: {
23
+ borderColor: colorMap[variant],
24
+ }, children: _jsxs("div", { className: "group relative", children: [_jsx(HeaderBar, { text: title, variant: variant, children: _jsx(LanguageIndicator, { language: language }) }), _jsx("div", { className: "pt-4 space-y-3", children: children }), !disableTargetHandle && _jsx(BaseHandle, { type: "target", position: Position.Top, variant: variant }), !disableSourceHandle && _jsx(BaseHandle, { type: "source", position: Position.Bottom, variant: variant }), _jsx("div", { className: "absolute inset-0 -z-10 translate-y-1 translate-x-1 bg-background rounded-md border border-white/5" })] }) }) }));
20
25
  };
@@ -0,0 +1,6 @@
1
+ export declare const colorMap: {
2
+ event: string;
3
+ api: string;
4
+ noop: string;
5
+ cron: string;
6
+ };
@@ -0,0 +1,6 @@
1
+ export const colorMap = {
2
+ event: 'rgb(0,117,255)',
3
+ api: 'rgb(189,255,0)',
4
+ noop: 'rgb(255,49,234)',
5
+ cron: 'rgb(255,113,11)',
6
+ };
@@ -0,0 +1,11 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import React from 'react';
3
+ declare const baseDot: (props?: ({
4
+ variant?: "event" | "api" | "noop" | "cron" | null | undefined;
5
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
6
+ export declare const HeaderBar: ({ text, variant, children, }: {
7
+ text: string;
8
+ variant: VariantProps<typeof baseDot>["variant"];
9
+ children?: React.ReactNode;
10
+ }) => import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { cn } from '@/lib/utils';
3
+ import { cva } from 'class-variance-authority';
4
+ const baseDot = cva('w-[6px] h-[6px] rounded-full', {
5
+ variants: {
6
+ variant: {
7
+ event: 'bg-[rgba(0,117,255,1)]',
8
+ api: 'bg-[rgba(189,255,0,1)]',
9
+ noop: 'bg-[rgba(255,49,234,1)]',
10
+ cron: 'bg-[rgba(255,113,11,1)]',
11
+ },
12
+ },
13
+ });
14
+ const Dot = ({ variant }) => (_jsx("div", { className: cn(baseDot({ variant })) }));
15
+ export const HeaderBar = ({ text, variant, children, }) => (_jsxs("div", { className: "text-sm text-foreground flex justify-between items-center gap-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Dot, { variant: variant }), _jsx("span", { children: text })] }), children] }));
@@ -0,0 +1,2 @@
1
+ import { CronNodeProps } from './node-props';
2
+ export declare const CronNode: ({ data }: CronNodeProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BaseNode } from './base-node';
3
+ import { Clock } from 'lucide-react';
4
+ import { NodeDetails, DetailItem } from './node-details';
5
+ export const CronNode = ({ data }) => {
6
+ return (_jsxs(BaseNode, { variant: "cron", title: data.name, language: data.language, headerChildren: _jsx(Clock, { className: "w-4 h-4 text-purple-400" }), disableTargetHandle: !data.virtualSubscribes?.length, disableSourceHandle: !data.virtualEmits?.length && !data.emits?.length, children: [_jsx("div", { className: "text-sm text-muted-foreground", children: data.description }), _jsxs("div", { className: "text-xs text-muted-foreground flex items-center gap-2", children: [_jsx(Clock, { className: "w-3 h-3" }), " ", data.cronExpression] }), _jsx(NodeDetails, { type: "cron", name: data.name, description: data.description, language: data.language, children: _jsx(DetailItem, { label: "Cron Expression", children: _jsx("div", { className: "flex gap-1 items-center text-xs text-muted-foreground", children: _jsxs("div", { className: "text-xs text-muted-foreground flex items-center gap-2", children: [_jsx(Clock, { className: "w-3 h-3" }), " ", data.cronExpression] }) }) }) })] }));
7
+ };
@@ -1,5 +1,5 @@
1
1
  import { EventNodeData } from '../views/flow/nodes/nodes.types';
2
+ import React from 'react';
2
3
  export declare const Emits: React.FC<{
3
4
  emits: EventNodeData['emits'];
4
5
  }>;
5
- //# sourceMappingURL=emits.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Send } from 'lucide-react';
3
- const toType = (emit) => typeof emit === 'string' ? emit : emit.type;
3
+ const toTopic = (emit) => typeof emit === 'string' ? emit : emit.topic;
4
4
  export const Emits = ({ emits }) => {
5
- return (_jsx(_Fragment, { children: emits.map((emit) => (_jsxs("div", { className: "flex gap-2 items-center text-xs text-white/60", "data-testid": `emits__${toType(emit)}`, children: [_jsx(Send, { className: "w-3 h-3 text-white/40" }), _jsx("div", { className: "font-mono tracking-wider", children: toType(emit) })] }, toType(emit)))) }));
5
+ return (_jsx(_Fragment, { children: emits.map((emit) => (_jsxs("div", { className: "flex gap-2 items-center text-xs text-muted-foreground", "data-testid": `emits__${toTopic(emit)}`, children: [_jsx(Send, { className: "w-4 h-4 text-muted-foreground/60" }), _jsx("div", { className: "font-mono tracking-wider", children: toTopic(emit) })] }, toTopic(emit)))) }));
6
6
  };
@@ -1,9 +1,7 @@
1
1
  import { PropsWithChildren } from 'react';
2
2
  import { EventNodeProps } from './node-props';
3
3
  type Props = PropsWithChildren<EventNodeProps & {
4
- excludePubsub?: boolean;
5
4
  className?: string;
6
5
  }>;
7
6
  export declare const EventNode: (props: Props) => import("react/jsx-runtime").JSX.Element;
8
7
  export {};
9
- //# sourceMappingURL=event-node.d.ts.map
@@ -1,9 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { LanguageIndicator } from '../views/flow/nodes/language-indicator';
3
2
  import { BaseNode } from './base-node';
4
- import { Emits } from './emits';
5
- import { Subscribe } from './subscribe';
3
+ import { NodeDetails } from './node-details';
6
4
  export const EventNode = (props) => {
7
- const { data, excludePubsub, children } = props;
8
- return (_jsxs(BaseNode, { variant: "event", title: data.name, disableSourceHandle: !data.emits.length, disableTargetHandle: !data.subscribes.length, headerChildren: _jsx(LanguageIndicator, { language: data.language }), children: [data.description && _jsx("div", { className: "text-sm max-w-[300px] text-white/60", children: data.description }), children, !excludePubsub && (_jsx("div", { className: "space-y-2 pt-2 border-t border-white/10", children: _jsx(Subscribe, { data: data }) })), _jsx(Emits, { emits: data.emits })] }));
5
+ const { data, children } = props;
6
+ return (_jsxs(BaseNode, { variant: "event", title: data.name, language: data.language, disableSourceHandle: !data.emits?.length && !data.virtualEmits?.length, disableTargetHandle: !data.subscribes?.length && !data.virtualSubscribes?.length, children: [_jsx("div", { className: "text-sm text-muted-foreground", children: data.description }), children, _jsx(NodeDetails, { type: "event", name: data.name, subscribes: data.subscribes, emits: data.emits, description: data.description, language: data.language })] }));
9
7
  };
@@ -0,0 +1,17 @@
1
+ import React, { PropsWithChildren } from 'react';
2
+ type Props = PropsWithChildren<{
3
+ name: string;
4
+ type: 'event' | 'api' | 'noop' | 'cron';
5
+ subscribes?: string[];
6
+ emits?: Array<string | {
7
+ topic: string;
8
+ label?: string;
9
+ }>;
10
+ description?: string;
11
+ language?: string;
12
+ }>;
13
+ export declare const DetailItem: React.FC<PropsWithChildren<{
14
+ label: string;
15
+ }>>;
16
+ export declare const NodeDetails: React.FC<Props>;
17
+ export {};
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ChevronRight } from 'lucide-react';
3
+ import { DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from '../components/ui/dialog';
4
+ import { DialogContent } from '../components/ui/dialog';
5
+ import { Dialog } from '../components/ui/dialog';
6
+ import { Label } from '../components/ui/label';
7
+ import { LanguageIndicator } from '../views/flow/nodes/language-indicator';
8
+ import { Emits } from './emits';
9
+ import { Subscribe } from './subscribe';
10
+ import { colorMap } from './colorMap';
11
+ import { HeaderBar } from './components/header-bar';
12
+ export const DetailItem = (props) => {
13
+ const { label, children } = props;
14
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsx(Label, { className: "text-foreground", children: label }), children] }));
15
+ };
16
+ export const NodeDetails = (props) => {
17
+ const { name, type, subscribes, emits, description, language, children } = props;
18
+ return (_jsxs(Dialog, { children: [_jsx(DialogTrigger, { asChild: true, children: _jsx("div", { className: "flex justify-end gap-2", children: _jsx("div", { className: "border border-solid border-border/50 p-1 rounded-md cursor-pointer", children: _jsx(ChevronRight, { className: "w-4 h-4" }) }) }) }), _jsxs(DialogContent, { className: "border border-solid", style: { borderColor: colorMap[type] }, children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: _jsx(HeaderBar, { variant: type, text: name }) }) }), _jsx(DialogDescription, { children: _jsxs("div", { className: "flex flex-col gap-6", children: [description && (_jsx(DetailItem, { label: "Description", children: _jsx("span", { className: "text-sm text-muted-foreground", children: description }) })), _jsx(DetailItem, { label: "Language", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(LanguageIndicator, { language: language }), _jsx("span", { className: "capitalize", children: language })] }) }), subscribes && (_jsx(DetailItem, { label: "Subscribes", children: _jsx(Subscribe, { subscribes: subscribes }) })), emits && (_jsx(DetailItem, { label: "Emits", children: _jsx(Emits, { emits: emits }) })), children] }) })] })] }));
19
+ };