@motiadev/workbench 0.3.1-beta.87 → 0.3.1-beta.88-041205

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 (219) hide show
  1. package/dist/index.d.ts +3 -4
  2. package/dist/index.html +3 -2
  3. package/dist/index.js +2 -3
  4. package/dist/public/icon.png +0 -0
  5. package/dist/public/motia-dark.png +0 -0
  6. package/dist/public/motia-light.png +0 -0
  7. package/dist/src/App.d.ts +2 -0
  8. package/dist/src/App.js +19 -0
  9. package/dist/src/components/endpoints/endpoint-badge.d.ts +1 -1
  10. package/dist/src/components/endpoints/endpoint-badge.js +8 -8
  11. package/dist/src/components/endpoints/endpoint-call.d.ts +3 -3
  12. package/dist/src/components/endpoints/endpoint-call.js +28 -23
  13. package/dist/src/components/endpoints/endpoint-response-schema.d.ts +10 -0
  14. package/dist/src/components/endpoints/endpoint-response-schema.js +17 -0
  15. package/dist/src/components/endpoints/endpoint-response.d.ts +8 -0
  16. package/dist/src/components/endpoints/endpoint-response.js +39 -0
  17. package/dist/src/components/endpoints/endpoints-page.js +14 -0
  18. package/dist/src/components/endpoints/hooks/use-get-endpoints.d.ts +1 -15
  19. package/dist/src/components/endpoints/json-editor.d.ts +9 -0
  20. package/dist/src/components/endpoints/json-editor.js +31 -0
  21. package/dist/src/components/flow/flow-page.d.ts +1 -0
  22. package/dist/src/components/flow/flow-page.js +20 -0
  23. package/dist/src/components/flow/flow-tab-menu-item.d.ts +1 -0
  24. package/dist/src/components/flow/flow-tab-menu-item.js +15 -0
  25. package/dist/src/{views → components}/flow/flow-view.d.ts +1 -2
  26. package/dist/src/components/flow/flow-view.js +21 -0
  27. package/dist/src/components/flow/hooks/use-get-flow-state.d.ts +10 -0
  28. package/dist/src/{views → components}/flow/hooks/use-get-flow-state.js +17 -10
  29. package/dist/src/{views → components}/flow/hooks/use-organize-nodes.d.ts +1 -1
  30. package/dist/src/{views → components}/flow/hooks/use-save-workflow-config.d.ts +1 -1
  31. package/dist/src/components/flow/nodes/api-flow-node.d.ts +2 -0
  32. package/dist/src/{views → components}/flow/nodes/api-flow-node.js +1 -1
  33. package/dist/src/components/flow/nodes/cron-flow-node.d.ts +2 -0
  34. package/dist/src/components/flow/nodes/cron-flow-node.js +5 -0
  35. package/dist/src/{views → components}/flow/nodes/event-flow-node.d.ts +1 -1
  36. package/dist/src/components/flow/nodes/event-flow-node.js +5 -0
  37. package/dist/src/components/flow/nodes/noop-flow-node.d.ts +2 -0
  38. package/dist/src/{views → components}/flow/nodes/noop-flow-node.js +1 -1
  39. package/dist/src/components/header/header.js +3 -11
  40. package/dist/src/components/logs/log-detail.d.ts +3 -1
  41. package/dist/src/components/logs/log-detail.js +33 -11
  42. package/dist/src/components/logs/log-level-badge.js +6 -6
  43. package/dist/src/components/logs/log-level-dot.js +7 -7
  44. package/dist/src/components/logs/logs-page.js +26 -0
  45. package/dist/src/components/observability/events/code/function-call.js +1 -1
  46. package/dist/src/components/observability/events/trace-event.d.ts +1 -1
  47. package/dist/src/components/observability/events/trace-log-event.d.ts +1 -1
  48. package/dist/src/components/observability/events/trace-log-event.js +2 -2
  49. package/dist/src/components/observability/hooks/use-get-endtime.d.ts +1 -1
  50. package/dist/src/components/observability/trace-item/trace-item-detail.d.ts +1 -0
  51. package/dist/src/components/observability/trace-item/trace-item-detail.js +5 -4
  52. package/dist/src/components/observability/trace-item/trace-item.d.ts +1 -0
  53. package/dist/src/components/observability/trace-item/trace-item.js +11 -17
  54. package/dist/src/components/observability/trace-status.d.ts +6 -10
  55. package/dist/src/components/observability/trace-status.js +7 -32
  56. package/dist/src/components/observability/trace-timeline.js +16 -4
  57. package/dist/src/components/observability/traces-groups.d.ts +2 -2
  58. package/dist/src/components/observability/traces-groups.js +4 -4
  59. package/dist/src/components/observability/traces-page.js +12 -0
  60. package/dist/src/components/sidebar/sidebar.d.ts +8 -0
  61. package/dist/src/components/sidebar/sidebar.js +39 -0
  62. package/dist/src/components/states/hooks/states-hooks.d.ts +7 -3
  63. package/dist/src/components/states/hooks/states-hooks.js +5 -33
  64. package/dist/src/components/states/state-detail.d.ts +2 -1
  65. package/dist/src/components/states/state-detail.js +15 -9
  66. package/dist/src/components/states/state-value.js +7 -7
  67. package/dist/src/components/states/states-page.js +18 -0
  68. package/dist/src/components/ui/badge.d.ts +1 -1
  69. package/dist/src/components/ui/table.js +1 -1
  70. package/dist/src/components/ui/theme-toggle.js +4 -3
  71. package/dist/src/hooks/use-fetch-flows.d.ts +1 -5
  72. package/dist/src/hooks/use-fetch-flows.js +18 -13
  73. package/dist/src/hooks/use-log-listener.js +2 -2
  74. package/dist/src/hooks/use-update-handle-positions.d.ts +10 -0
  75. package/dist/src/hooks/use-update-handle-positions.js +35 -0
  76. package/dist/src/index.css +36 -176
  77. package/dist/src/lib/utils.d.ts +1 -0
  78. package/dist/src/lib/utils.js +4 -0
  79. package/dist/src/main.d.ts +1 -0
  80. package/dist/src/main.js +4 -11
  81. package/dist/src/publicComponents/api-node.js +2 -4
  82. package/dist/src/publicComponents/{base-handle.d.ts → base-node/base-handle.d.ts} +1 -0
  83. package/dist/src/publicComponents/base-node/base-handle.js +8 -0
  84. package/dist/src/publicComponents/base-node/base-node.d.ts +21 -0
  85. package/dist/src/publicComponents/base-node/base-node.js +13 -0
  86. package/dist/src/publicComponents/{emits.d.ts → base-node/emits.d.ts} +1 -1
  87. package/dist/src/publicComponents/base-node/emits.js +5 -0
  88. package/dist/src/{views/flow/nodes → publicComponents/base-node}/language-indicator.d.ts +1 -1
  89. package/dist/src/{views/flow/nodes → publicComponents/base-node}/language-indicator.js +8 -7
  90. package/dist/src/publicComponents/base-node/node-header.d.ts +12 -0
  91. package/dist/src/publicComponents/base-node/node-header.js +30 -0
  92. package/dist/src/publicComponents/base-node/node-sidebar.d.ts +18 -0
  93. package/dist/src/publicComponents/base-node/node-sidebar.js +20 -0
  94. package/dist/src/publicComponents/base-node/subscribe.js +4 -0
  95. package/dist/src/publicComponents/cron-node.d.ts +2 -1
  96. package/dist/src/publicComponents/cron-node.js +3 -4
  97. package/dist/src/publicComponents/event-node.d.ts +1 -5
  98. package/dist/src/publicComponents/event-node.js +4 -6
  99. package/dist/src/publicComponents/node-details.js +21 -12
  100. package/dist/src/publicComponents/node-props.d.ts +13 -6
  101. package/dist/src/publicComponents/noop-node.d.ts +3 -7
  102. package/dist/src/publicComponents/noop-node.js +3 -3
  103. package/dist/src/stores/use-flow-store.d.ts +18 -0
  104. package/dist/src/stores/use-flow-store.js +15 -0
  105. package/dist/src/stores/use-global-store.d.ts +24 -0
  106. package/dist/src/stores/use-global-store.js +20 -0
  107. package/dist/src/stores/{use-logs.d.ts → use-logs-store.d.ts} +1 -3
  108. package/dist/src/stores/use-logs-store.js +10 -0
  109. package/dist/src/stores/use-tabs-store.d.ts +17 -0
  110. package/dist/src/stores/use-tabs-store.js +13 -0
  111. package/dist/src/stores/use-theme-store.d.ts +17 -0
  112. package/dist/src/stores/use-theme-store.js +26 -0
  113. package/dist/src/types/endpoint.d.ts +14 -0
  114. package/dist/src/{views/flow/nodes/nodes.types.d.ts → types/flow.d.ts} +45 -0
  115. package/dist/src/types/flow.js +1 -0
  116. package/dist/tsconfig.app.tsbuildinfo +1 -1
  117. package/package.json +13 -12
  118. package/dist/public/.empty +0 -0
  119. package/dist/src/components/app-sidebar.d.ts +0 -1
  120. package/dist/src/components/app-sidebar.js +0 -12
  121. package/dist/src/components/endpoints/endpoints.d.ts +0 -1
  122. package/dist/src/components/endpoints/endpoints.js +0 -34
  123. package/dist/src/components/endpoints/selected-endpoint.d.ts +0 -7
  124. package/dist/src/components/endpoints/selected-endpoint.js +0 -7
  125. package/dist/src/components/logs/log-console.d.ts +0 -1
  126. package/dist/src/components/logs/log-console.js +0 -69
  127. package/dist/src/components/logs/log-field.d.ts +0 -7
  128. package/dist/src/components/logs/log-field.js +0 -20
  129. package/dist/src/components/logs/logs.d.ts +0 -1
  130. package/dist/src/components/logs/logs.js +0 -18
  131. package/dist/src/components/observability/observability-stats.d.ts +0 -5
  132. package/dist/src/components/observability/observability-stats.js +0 -17
  133. package/dist/src/components/states/states.d.ts +0 -1
  134. package/dist/src/components/states/states.js +0 -21
  135. package/dist/src/components/ui/BadgeCount.d.ts +0 -7
  136. package/dist/src/components/ui/BadgeCount.js +0 -13
  137. package/dist/src/components/ui/button.d.ts +0 -11
  138. package/dist/src/components/ui/button.js +0 -33
  139. package/dist/src/components/ui/card.d.ts +0 -8
  140. package/dist/src/components/ui/card.js +0 -16
  141. package/dist/src/components/ui/collapsible.d.ts +0 -5
  142. package/dist/src/components/ui/collapsible.js +0 -5
  143. package/dist/src/components/ui/dialog.d.ts +0 -19
  144. package/dist/src/components/ui/dialog.js +0 -22
  145. package/dist/src/components/ui/dropdown-menu.d.ts +0 -25
  146. package/dist/src/components/ui/dropdown-menu.js +0 -50
  147. package/dist/src/components/ui/input.d.ts +0 -3
  148. package/dist/src/components/ui/input.js +0 -8
  149. package/dist/src/components/ui/logo-icon.d.ts +0 -5
  150. package/dist/src/components/ui/logo-icon.js +0 -5
  151. package/dist/src/components/ui/navigation-menu.d.ts +0 -13
  152. package/dist/src/components/ui/navigation-menu.js +0 -30
  153. package/dist/src/components/ui/scroll-area.d.ts +0 -5
  154. package/dist/src/components/ui/scroll-area.js +0 -9
  155. package/dist/src/components/ui/select.d.ts +0 -13
  156. package/dist/src/components/ui/select.js +0 -25
  157. package/dist/src/components/ui/separator.d.ts +0 -4
  158. package/dist/src/components/ui/separator.js +0 -8
  159. package/dist/src/components/ui/sheet.d.ts +0 -25
  160. package/dist/src/components/ui/sheet.js +0 -36
  161. package/dist/src/components/ui/sidebar.d.ts +0 -12
  162. package/dist/src/components/ui/sidebar.js +0 -25
  163. package/dist/src/components/ui/skeleton.d.ts +0 -3
  164. package/dist/src/components/ui/skeleton.js +0 -6
  165. package/dist/src/components/ui/switch.d.ts +0 -4
  166. package/dist/src/components/ui/switch.js +0 -7
  167. package/dist/src/components/ui/tabs.d.ts +0 -7
  168. package/dist/src/components/ui/tabs.js +0 -12
  169. package/dist/src/components/ui/textarea.d.ts +0 -3
  170. package/dist/src/components/ui/textarea.js +0 -8
  171. package/dist/src/components/ui/tooltip.d.ts +0 -7
  172. package/dist/src/components/ui/tooltip.js +0 -11
  173. package/dist/src/hooks/use-list-flows.d.ts +0 -9
  174. package/dist/src/hooks/use-list-flows.js +0 -8
  175. package/dist/src/hooks/use-theme.d.ts +0 -6
  176. package/dist/src/hooks/use-theme.js +0 -28
  177. package/dist/src/publicComponents/base-handle.js +0 -10
  178. package/dist/src/publicComponents/base-node.d.ts +0 -16
  179. package/dist/src/publicComponents/base-node.js +0 -25
  180. package/dist/src/publicComponents/colorMap.d.ts +0 -6
  181. package/dist/src/publicComponents/colorMap.js +0 -6
  182. package/dist/src/publicComponents/components/header-bar.d.ts +0 -11
  183. package/dist/src/publicComponents/components/header-bar.js +0 -15
  184. package/dist/src/publicComponents/emits.js +0 -6
  185. package/dist/src/publicComponents/subscribe.js +0 -5
  186. package/dist/src/route-wrapper.d.ts +0 -2
  187. package/dist/src/route-wrapper.js +0 -5
  188. package/dist/src/routes/endpoints-page.js +0 -5
  189. package/dist/src/routes/flow.d.ts +0 -1
  190. package/dist/src/routes/flow.js +0 -11
  191. package/dist/src/routes/index.d.ts +0 -1
  192. package/dist/src/routes/index.js +0 -5
  193. package/dist/src/routes/logs-page.js +0 -12
  194. package/dist/src/routes/states-page.js +0 -5
  195. package/dist/src/routes/traces-page.js +0 -14
  196. package/dist/src/stores/use-logs.js +0 -52
  197. package/dist/src/views/flow/arrow-head.d.ts +0 -8
  198. package/dist/src/views/flow/arrow-head.js +0 -6
  199. package/dist/src/views/flow/flow-view.js +0 -48
  200. package/dist/src/views/flow/hooks/use-get-flow-state.d.ts +0 -52
  201. package/dist/src/views/flow/legend.d.ts +0 -4
  202. package/dist/src/views/flow/legend.js +0 -51
  203. package/dist/src/views/flow/nodes/api-flow-node.d.ts +0 -4
  204. package/dist/src/views/flow/nodes/event-flow-node.js +0 -5
  205. package/dist/src/views/flow/nodes/noop-flow-node.d.ts +0 -4
  206. /package/dist/src/{routes → components/endpoints}/endpoints-page.d.ts +0 -0
  207. /package/dist/src/{views → components}/flow/base-edge.d.ts +0 -0
  208. /package/dist/src/{views → components}/flow/base-edge.js +0 -0
  209. /package/dist/src/{views → components}/flow/flow-loader.d.ts +0 -0
  210. /package/dist/src/{views → components}/flow/flow-loader.js +0 -0
  211. /package/dist/src/{views → components}/flow/hooks/use-organize-nodes.js +0 -0
  212. /package/dist/src/{views → components}/flow/hooks/use-save-workflow-config.js +0 -0
  213. /package/dist/src/{views → components}/flow/node-organizer.d.ts +0 -0
  214. /package/dist/src/{views → components}/flow/node-organizer.js +0 -0
  215. /package/dist/src/{routes → components/logs}/logs-page.d.ts +0 -0
  216. /package/dist/src/{routes → components/observability}/traces-page.d.ts +0 -0
  217. /package/dist/src/{routes → components/states}/states-page.d.ts +0 -0
  218. /package/dist/src/publicComponents/{subscribe.d.ts → base-node/subscribe.d.ts} +0 -0
  219. /package/dist/src/{views/flow/nodes/nodes.types.js → types/endpoint.js} +0 -0
@@ -1,52 +0,0 @@
1
- import { useSyncExternalStore, useCallback } from 'react';
2
- const listeners = new Set();
3
- let currentLogs = [];
4
- let currentUnreadLogsCount = 0;
5
- let memoizedSnapshot;
6
- const updateMemoizedSnapshot = () => {
7
- memoizedSnapshot = {
8
- logs: currentLogs,
9
- unreadLogsCount: currentUnreadLogsCount,
10
- addLog: storeActions.addLog,
11
- resetLogs: storeActions.resetLogs,
12
- setUnreadLogsCount: storeActions.setUnreadLogsCount,
13
- };
14
- };
15
- const notify = () => {
16
- listeners.forEach((listener) => listener());
17
- };
18
- const storeActions = {
19
- addLog: (log) => {
20
- currentLogs = [log, ...currentLogs];
21
- currentUnreadLogsCount += 1;
22
- updateMemoizedSnapshot();
23
- notify();
24
- },
25
- resetLogs: () => {
26
- if (currentLogs.length === 0 && currentUnreadLogsCount === 0) {
27
- return;
28
- }
29
- currentLogs = [];
30
- currentUnreadLogsCount = 0;
31
- updateMemoizedSnapshot();
32
- notify();
33
- },
34
- setUnreadLogsCount: (count) => {
35
- if (currentUnreadLogsCount === count) {
36
- return;
37
- }
38
- currentUnreadLogsCount = count;
39
- updateMemoizedSnapshot();
40
- notify();
41
- },
42
- };
43
- updateMemoizedSnapshot();
44
- // Stable subscribe function so React doesn't unnecessarily tear down the subscription
45
- const subscribe = (onStoreChange) => {
46
- listeners.add(onStoreChange);
47
- return () => listeners.delete(onStoreChange);
48
- };
49
- export function useLogs(selector = (state) => state) {
50
- const getSnapshot = useCallback(() => selector(memoizedSnapshot), [selector]);
51
- return useSyncExternalStore(subscribe, getSnapshot);
52
- }
@@ -1,8 +0,0 @@
1
- import React from 'react';
2
- type Props = {
3
- color?: string;
4
- id: string;
5
- className?: string;
6
- };
7
- export declare const ArrowHead: React.FC<Props>;
8
- export {};
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- export const ArrowHead = (props) => {
3
- // Use CSS custom property for theme-aware coloring, fallback to provided color
4
- const strokeColor = props.color || 'var(--arrow-color, #B3B3B3)';
5
- return (_jsxs("marker", { id: props.id, viewBox: "-5 -5 10 10", markerUnits: "strokeWidth", markerWidth: "10", markerHeight: "10", className: props.className, children: [_jsx("line", { x1: 0, y1: 0, x2: 2, y2: -2, stroke: strokeColor, strokeWidth: "1", strokeOpacity: "1", strokeLinecap: "round" }), _jsx("line", { x1: -2, y1: -2, x2: 0, y2: 0, stroke: strokeColor, strokeWidth: "1", strokeOpacity: "1", strokeLinecap: "round" })] }));
6
- };
@@ -1,48 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { LogConsole } from '@/components/logs/log-console';
3
- import { Background, BackgroundVariant, ReactFlow, } from '@xyflow/react';
4
- import { useCallback, useMemo, useState } from 'react';
5
- import { ArrowHead } from './arrow-head';
6
- import { BaseEdge } from './base-edge';
7
- import { FlowLoader } from './flow-loader';
8
- import { useGetFlowState } from './hooks/use-get-flow-state';
9
- import { Legend } from './legend';
10
- import { NodeOrganizer } from './node-organizer';
11
- import '@xyflow/react/dist/style.css';
12
- const edgeTypes = {
13
- base: BaseEdge,
14
- };
15
- export const FlowView = ({ flow, flowConfig }) => {
16
- const { nodes, edges, onNodesChange, onEdgesChange, nodeTypes } = useGetFlowState(flow, flowConfig);
17
- const [initialized, setInitialized] = useState(false);
18
- const [hoveredType, setHoveredType] = useState(null);
19
- const onInitialized = useCallback(() => {
20
- setInitialized(true);
21
- }, []);
22
- const getClassName = useCallback((nodeType) => {
23
- if (!hoveredType)
24
- return '';
25
- if (nodeType) {
26
- return nodeType === hoveredType
27
- ? 'border border-border scale-[1.02] transition-all duration-300'
28
- : 'opacity-30 transition-all duration-300';
29
- }
30
- // If no nodeType is provided, this is an edge
31
- return 'opacity-30 transition-all duration-300';
32
- }, [hoveredType]);
33
- const nodesWithHighlights = useMemo(() => nodes.map((node) => ({
34
- ...node,
35
- className: getClassName(node.data.type),
36
- })), [nodes, getClassName]);
37
- const edgesWithHighlights = useMemo(() => edges.map((edge) => ({
38
- ...edge,
39
- className: getClassName(), // No argument means it's an edge
40
- })), [edges, getClassName]);
41
- const onNodesChangeHandler = useCallback((changes) => {
42
- onNodesChange(changes);
43
- }, [onNodesChange]);
44
- if (!nodeTypes) {
45
- return null;
46
- }
47
- return (_jsxs("div", { className: "w-full h-full relative bg-background", children: [!initialized && _jsx(FlowLoader, {}), _jsx(Legend, { onHover: setHoveredType }), _jsxs(ReactFlow, { nodes: nodesWithHighlights, edges: edgesWithHighlights, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onNodesChange: onNodesChangeHandler, onEdgesChange: onEdgesChange, children: [_jsx(Background, { variant: BackgroundVariant.Dots, gap: 50, size: 2, className: "[--xy-background-color-dots:theme(colors.muted.DEFAULT)] [--xy-background-color:theme(colors.background)]" }), _jsx(NodeOrganizer, { onInitialized: onInitialized }), _jsx("svg", { className: "[--arrow-color:theme(colors.muted.foreground)]", children: _jsx("defs", { children: _jsx(ArrowHead, { id: "arrowhead" }) }) })] }), _jsx(LogConsole, {})] }));
48
- };
@@ -1,52 +0,0 @@
1
- import { Edge, Node } from '@xyflow/react';
2
- import React from 'react';
3
- import type { EdgeData, NodeData } from '../nodes/nodes.types';
4
- type Emit = string | {
5
- topic: string;
6
- label?: string;
7
- };
8
- type FlowStep = {
9
- id: string;
10
- name: string;
11
- type: 'event' | 'api' | 'noop' | 'cron';
12
- description?: string;
13
- subscribes?: string[];
14
- emits: Emit[];
15
- virtualEmits?: Emit[];
16
- action?: 'webhook';
17
- webhookUrl?: string;
18
- language?: string;
19
- nodeComponentPath?: string;
20
- filePath?: string;
21
- };
22
- export type FlowResponse = {
23
- id: string;
24
- name: string;
25
- steps: FlowStep[];
26
- edges: FlowEdge[];
27
- error?: string;
28
- };
29
- export type FlowConfigResponse = {
30
- id: string;
31
- config: {
32
- [stepName: string]: Position;
33
- };
34
- };
35
- type FlowEdge = {
36
- id: string;
37
- source: string;
38
- target: string;
39
- data: EdgeData;
40
- };
41
- type Position = {
42
- x: number;
43
- y: number;
44
- };
45
- export declare const useGetFlowState: (flow: FlowResponse, flowConfig: FlowConfigResponse) => {
46
- nodes: Node<NodeData>[];
47
- edges: Edge<EdgeData>[];
48
- onNodesChange: import("@xyflow/react").OnNodesChange<Node<NodeData>>;
49
- onEdgesChange: import("@xyflow/react").OnEdgesChange<Edge<EdgeData>>;
50
- nodeTypes: Record<string, React.ComponentType<any>>;
51
- };
52
- export {};
@@ -1,4 +0,0 @@
1
- import { FC } from 'react';
2
- export declare const Legend: FC<{
3
- onHover: (type: string | null) => void;
4
- }>;
@@ -1,51 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { Button } from '@/components/ui/button';
3
- import { cn } from '@/lib/utils';
4
- import { LayoutList, X } from 'lucide-react';
5
- import { useState } from 'react';
6
- import { colorMap } from '@/publicComponents/colorMap';
7
- const EdgeSwatch = ({ color, dashed }) => (_jsx("svg", { className: "my-1", width: "48", height: "10", viewBox: "0 0 48 10", xmlns: "http://www.w3.org/2000/svg", children: _jsx("line", { x1: "0", y1: "5", x2: "48", y2: "5", stroke: color, strokeWidth: "2", strokeDasharray: dashed ? '4' : 'none', strokeLinecap: "round" }) }));
8
- const legendItems = [
9
- {
10
- label: 'Event (Core)',
11
- type: 'event',
12
- color: colorMap.event,
13
- description: 'Core logic components that process events.',
14
- },
15
- {
16
- label: 'API',
17
- type: 'api',
18
- color: colorMap.api,
19
- description: 'HTTP endpoints that trigger flows.',
20
- },
21
- {
22
- label: 'Noop (Non-Operation)',
23
- type: 'noop',
24
- color: colorMap.noop,
25
- description: 'Placeholder nodes for external processes.',
26
- },
27
- {
28
- label: 'Cron',
29
- type: 'cron',
30
- color: colorMap.cron,
31
- description: 'Scheduled tasks that run at specified intervals.',
32
- },
33
- ];
34
- const edgeLegendItems = [
35
- {
36
- label: 'Event Edge',
37
- color: colorMap.event,
38
- description: 'Represents an event emitted and subscribed by steps.',
39
- dashed: true,
40
- },
41
- {
42
- label: 'Virtual Edge',
43
- color: 'hsl(var(--muted-foreground))',
44
- description: 'Represents virtual connections.',
45
- dashed: true,
46
- },
47
- ];
48
- export const Legend = ({ onHover }) => {
49
- const [isExpanded, setIsExpanded] = useState(false);
50
- return (_jsx("div", { className: 'absolute right-4 top-4 z-10 max-w-[500px]', children: _jsxs("div", { className: cn('rounded-lg border border-border bg-background/90 p-4 flex flex-col', !isExpanded && 'rounded-b-lg', isExpanded && 'gap-4'), children: [_jsxs("div", { className: "flex items-center gap-2", children: [isExpanded && _jsx("div", { className: "text-sm text-muted-foreground uppercase", children: "Flow Legend" }), _jsx("div", { className: "flex-1 flex justify-end", children: _jsx(Button, { variant: "ghost", size: "sm", onClick: () => setIsExpanded(!isExpanded), className: "p-2 hover:bg-muted", children: isExpanded ? _jsx(X, { size: 16 }) : _jsx(LayoutList, { size: 16 }) }) })] }), _jsx("div", { className: cn('overflow-hidden transition-all duration-200 ease-in-out', isExpanded ? 'max-h-[600px] opacity-100' : 'max-h-0 opacity-0'), children: isExpanded && (_jsxs(_Fragment, { children: [_jsx("div", { className: "grid grid-cols-2 gap-3", children: legendItems.map((item) => (_jsx("div", { onMouseEnter: () => onHover(item.type), onMouseLeave: () => onHover(null), className: "group cursor-pointer transition-all hover:bg-muted/20 rounded-md p-2", children: _jsxs("div", { className: "flex items-start gap-3", children: [_jsx("div", { className: "w-[8px] h-[8px] mt-[4px] rounded-full", style: { backgroundColor: item.color } }), _jsxs("div", { className: "flex-1", children: [_jsx("div", { className: "text-foreground text-sm font-medium", children: item.label }), _jsx("div", { className: "text-muted-foreground text-sm mt-0.5", children: item.description })] })] }) }, item.type))) }), _jsx("div", { className: "h-px bg-border my-4" }), _jsx("div", { className: "text-sm text-muted-foreground uppercase pb-4", children: "Edge Legend" }), _jsx("div", { className: "grid grid-cols-2 gap-3", children: edgeLegendItems.map((item) => (_jsxs("div", { className: "flex items-start gap-3", children: [_jsx(EdgeSwatch, { color: item.color, dashed: item.dashed }), _jsxs("div", { className: "flex-1", children: [_jsx("div", { className: "text-foreground text-sm font-medium", children: item.label }), _jsx("div", { className: "text-muted-foreground text-sm mt-0.5", children: item.description })] })] }, item.label))) })] })) })] }) }));
51
- };
@@ -1,4 +0,0 @@
1
- import { ApiNodeData } from './nodes.types';
2
- export declare const ApiFlowNode: ({ data }: {
3
- data: ApiNodeData;
4
- }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { EventNode } from '../../../publicComponents/event-node';
3
- export const EventFlowNode = ({ data }) => {
4
- return _jsx(EventNode, { className: "relative", data: data });
5
- };
@@ -1,4 +0,0 @@
1
- import { NoopNodeData } from './nodes.types';
2
- export declare const NoopFlowNode: ({ data }: {
3
- data: NoopNodeData;
4
- }) => import("react/jsx-runtime").JSX.Element;