@motiadev/workbench 0.2.1-beta.55 → 0.2.1-beta.57

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 (38) hide show
  1. package/dist/src/components/app-sidebar.js +9 -3
  2. package/dist/src/components/endpoints/endpoint-call.js +1 -1
  3. package/dist/src/components/endpoints/response-body.js +1 -1
  4. package/dist/src/components/endpoints/selected-endpoint.js +1 -1
  5. package/dist/src/components/logs/log-console.js +24 -4
  6. package/dist/src/components/logs/log-field.js +2 -2
  7. package/dist/src/components/logs/logs.js +1 -1
  8. package/dist/src/components/states/state-value.js +5 -5
  9. package/dist/src/components/ui/button.js +1 -1
  10. package/dist/src/components/ui/dropdown-menu.d.ts +25 -0
  11. package/dist/src/components/ui/dropdown-menu.js +50 -0
  12. package/dist/src/components/ui/sidebar.js +3 -2
  13. package/dist/src/components/ui/theme-toggle.d.ts +2 -0
  14. package/dist/src/components/ui/theme-toggle.js +11 -0
  15. package/dist/src/hooks/use-theme.d.ts +6 -0
  16. package/dist/src/hooks/use-theme.js +28 -0
  17. package/dist/src/publicComponents/api-node.js +1 -1
  18. package/dist/src/publicComponents/base-node.js +1 -1
  19. package/dist/src/publicComponents/components/header-bar.js +1 -1
  20. package/dist/src/publicComponents/cron-node.js +1 -1
  21. package/dist/src/publicComponents/emits.js +1 -1
  22. package/dist/src/publicComponents/node-details.js +2 -2
  23. package/dist/src/publicComponents/noop-node.js +1 -1
  24. package/dist/src/publicComponents/subscribe.js +1 -1
  25. package/dist/src/route-wrapper.js +1 -1
  26. package/dist/src/routes/flow.js +1 -1
  27. package/dist/src/routes/index.js +1 -1
  28. package/dist/src/routes/logs-page.js +2 -2
  29. package/dist/src/routes/states-page.js +1 -1
  30. package/dist/src/stores/use-logs.d.ts +1 -1
  31. package/dist/src/stores/use-logs.js +52 -8
  32. package/dist/src/views/flow/arrow-head.d.ts +2 -1
  33. package/dist/src/views/flow/arrow-head.js +5 -1
  34. package/dist/src/views/flow/flow-loader.js +1 -1
  35. package/dist/src/views/flow/flow-view.js +9 -10
  36. package/dist/src/views/flow/legend.js +4 -5
  37. package/dist/tsconfig.app.tsbuildinfo +1 -1
  38. package/package.json +3 -4
@@ -1,4 +1,4 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  export const FlowLoader = () => {
3
- return _jsx("div", { className: "absolute z-10 inset-0 w-full h-full bg-[#060911]" });
3
+ return _jsx("div", { className: "absolute z-10 inset-0 w-full h-full bg-background" });
4
4
  };
@@ -1,8 +1,7 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // packages/workbench/src/views/flow/flow-view.tsx
3
2
  import { LogConsole } from '@/components/logs/log-console';
4
3
  import { Background, BackgroundVariant, ReactFlow, useReactFlow } from '@xyflow/react';
5
- import { useCallback, useEffect, useState } from 'react';
4
+ import { useCallback, useEffect, useMemo, useState } from 'react';
6
5
  import { ArrowHead } from './arrow-head';
7
6
  import { BaseEdge } from './base-edge';
8
7
  import { FlowLoader } from './flow-loader';
@@ -25,25 +24,25 @@ export const FlowView = ({ flow, flowConfig }) => {
25
24
  const onInitialized = useCallback(() => {
26
25
  setTimeout(() => setInitialized(true), 10);
27
26
  }, []);
28
- const getClassName = (nodeType) => {
27
+ const getClassName = useCallback((nodeType) => {
29
28
  if (!hoveredType)
30
29
  return '';
31
30
  if (nodeType) {
32
31
  return nodeType === hoveredType
33
- ? 'border border-white/30 scale-[1.02] transition-all duration-300'
32
+ ? 'border border-border scale-[1.02] transition-all duration-300'
34
33
  : 'opacity-30 transition-all duration-300';
35
34
  }
36
35
  // If no nodeType is provided, this is an edge
37
36
  return 'opacity-30 transition-all duration-300';
38
- };
39
- const nodesWithHighlights = nodes.map((node) => ({
37
+ }, [hoveredType]);
38
+ const nodesWithHighlights = useMemo(() => nodes.map((node) => ({
40
39
  ...node,
41
40
  className: getClassName(node.data.type),
42
- }));
43
- const edgesWithHighlights = edges.map((edge) => ({
41
+ })), [nodes, getClassName]);
42
+ const edgesWithHighlights = useMemo(() => edges.map((edge) => ({
44
43
  ...edge,
45
44
  className: getClassName(), // No argument means it's an edge
46
- }));
45
+ })), [edges, getClassName]);
47
46
  const saveFlowConfig = useCallback(() => {
48
47
  const steps = getNodes().reduce((acc, node) => {
49
48
  if (node.data.filePath) {
@@ -61,5 +60,5 @@ export const FlowView = ({ flow, flowConfig }) => {
61
60
  if (!nodeTypes) {
62
61
  return null;
63
62
  }
64
- return (_jsxs("div", { className: "w-full h-full relative bg-black", 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, color: "#222", bgColor: "#000" }), _jsx(NodeOrganizer, { onInitialized: onInitialized }), _jsx("svg", { children: _jsx("defs", { children: _jsx(ArrowHead, { color: "#B3B3B3", id: "arrowhead" }) }) })] }), _jsx(LogConsole, {})] }));
63
+ 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, {})] }));
65
64
  };
@@ -1,10 +1,9 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { Button } from '@/components/ui/button';
3
3
  import { cn } from '@/lib/utils';
4
- import { AnimatePresence, motion } from 'framer-motion';
5
4
  import { LayoutList, X } from 'lucide-react';
6
5
  import { useState } from 'react';
7
- import { colorMap } from '../../publicComponents/colorMap';
6
+ import { colorMap } from '@/publicComponents/colorMap';
8
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" }) }));
9
8
  const legendItems = [
10
9
  {
@@ -41,12 +40,12 @@ const edgeLegendItems = [
41
40
  },
42
41
  {
43
42
  label: 'Virtual Edge',
44
- color: 'rgb(111, 111, 111)',
43
+ color: 'hsl(var(--muted-foreground))',
45
44
  description: 'Represents virtual connections.',
46
45
  dashed: true,
47
46
  },
48
47
  ];
49
48
  export const Legend = ({ onHover }) => {
50
49
  const [isExpanded, setIsExpanded] = useState(false);
51
- return (_jsx("div", { className: 'absolute right-4 top-4 z-10 max-w-[500px]', children: _jsxs("div", { className: cn('rounded-lg border border-zinc-700 bg-zinc-900/90 p-4 flex flex-col gap-4', !isExpanded && 'rounded-b-lg'), children: [_jsxs("div", { className: "flex items-center gap-2", children: [isExpanded && _jsx("div", { className: "text-sm text-gray-400 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-white/10", children: isExpanded ? _jsx(X, { size: 16 }) : _jsx(LayoutList, { size: 16 }) }) })] }), _jsx(AnimatePresence, { children: isExpanded && (_jsxs(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: 'auto', opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.2 }, className: "overflow-hidden", 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-white/5 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-white text-sm font-medium", children: item.label }), _jsx("div", { className: "text-white/60 text-sm mt-0.5", children: item.description })] })] }) }, item.type))) }), _jsx("div", { className: "h-px bg-zinc-700 my-4" }), _jsx("div", { className: "text-sm text-gray-400 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-white text-sm font-medium", children: item.label }), _jsx("div", { className: "text-white/60 text-sm mt-0.5", children: item.description })] })] }, item.label))) })] })) })] }) }));
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))) })] })) })] }) }));
52
51
  };