@motiadev/workbench 0.0.5 → 0.0.7-build.20250529212805
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.
- package/LICENSE +21 -0
- package/README.md +95 -40
- package/dist/README.md +105 -0
- package/dist/index.d.ts +1 -2
- package/dist/index.html +31 -0
- package/dist/index.js +0 -1
- package/dist/middleware.d.ts +2 -2
- package/dist/middleware.js +5 -12
- package/dist/postcss.config.mjs +9 -0
- package/dist/src/components/app-sidebar.d.ts +0 -1
- package/dist/src/components/app-sidebar.js +15 -8
- package/dist/src/components/endpoints/endpoint-badge.d.ts +10 -0
- package/dist/src/components/endpoints/endpoint-badge.js +22 -0
- package/dist/src/components/endpoints/endpoint-call.d.ts +8 -0
- package/dist/src/components/endpoints/endpoint-call.js +57 -0
- package/dist/src/components/endpoints/endpoints.d.ts +1 -0
- package/dist/src/components/endpoints/endpoints.js +34 -0
- package/dist/src/components/endpoints/hooks/use-get-endpoints.d.ts +15 -0
- package/dist/src/components/endpoints/hooks/use-get-endpoints.js +8 -0
- package/dist/src/components/endpoints/hooks/use-json-schema-to-json.d.ts +4 -0
- package/dist/src/components/endpoints/hooks/use-json-schema-to-json.js +11 -0
- package/dist/src/components/endpoints/hooks/use-path-params.d.ts +1 -0
- package/dist/src/components/endpoints/hooks/use-path-params.js +4 -0
- package/dist/src/components/endpoints/hooks/use-state-stream.d.ts +4 -0
- package/dist/src/components/endpoints/hooks/use-state-stream.js +8 -0
- package/dist/src/components/endpoints/hooks/utils.d.ts +1 -0
- package/dist/src/components/endpoints/hooks/utils.js +29 -0
- package/dist/src/components/endpoints/response-body.d.ts +7 -0
- package/dist/src/components/endpoints/response-body.js +6 -0
- package/dist/src/components/endpoints/selected-endpoint.d.ts +7 -0
- package/dist/src/components/endpoints/selected-endpoint.js +7 -0
- package/dist/src/components/{log-console.d.ts → logs/log-console.d.ts} +0 -1
- package/dist/src/components/logs/log-console.js +69 -0
- package/dist/src/components/logs/log-detail.d.ts +8 -0
- package/dist/src/components/logs/log-detail.js +15 -0
- package/dist/src/components/logs/log-field.d.ts +8 -0
- package/dist/src/components/logs/log-field.js +20 -0
- package/dist/src/components/{log-level-badge.d.ts → logs/log-level-badge.d.ts} +2 -1
- package/dist/src/components/{log-level-badge.js → logs/log-level-badge.js} +2 -2
- package/dist/src/components/logs/log-level-dot.d.ts +4 -0
- package/dist/src/components/logs/log-level-dot.js +17 -0
- package/dist/src/components/logs/logs.d.ts +1 -0
- package/dist/src/components/logs/logs.js +18 -0
- package/dist/src/components/root-motia.d.ts +2 -0
- package/dist/src/components/root-motia.js +5 -0
- package/dist/src/components/states/hooks/states-hooks.d.ts +3 -0
- package/dist/src/components/states/hooks/states-hooks.js +36 -0
- package/dist/src/components/states/state-detail.d.ts +7 -0
- package/dist/src/components/states/state-detail.js +12 -0
- package/dist/src/components/states/state-value.d.ts +8 -0
- package/dist/src/components/states/state-value.js +51 -0
- package/dist/src/components/states/states.d.ts +1 -0
- package/dist/src/components/states/states.js +21 -0
- package/dist/src/components/ui/badge.d.ts +3 -4
- package/dist/src/components/ui/badge.js +4 -4
- package/dist/src/components/ui/button.d.ts +2 -3
- package/dist/src/components/ui/button.js +2 -3
- package/dist/src/components/ui/collapsible.d.ts +1 -2
- package/dist/src/components/ui/collapsible.js +1 -1
- package/dist/src/components/ui/dialog.d.ts +2 -3
- package/dist/src/components/ui/dialog.js +12 -12
- package/dist/src/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/src/components/ui/dropdown-menu.js +50 -0
- package/dist/src/components/ui/input.d.ts +0 -1
- package/dist/src/components/ui/label.d.ts +3 -4
- package/dist/src/components/ui/label.js +6 -6
- package/dist/src/components/ui/select.d.ts +2 -3
- package/dist/src/components/ui/select.js +14 -15
- package/dist/src/components/ui/separator.d.ts +0 -1
- package/dist/src/components/ui/sheet.d.ts +1 -2
- package/dist/src/components/ui/sheet.js +2 -2
- package/dist/src/components/ui/sidebar.d.ts +12 -67
- package/dist/src/components/ui/sidebar.js +14 -219
- package/dist/src/components/ui/skeleton.d.ts +1 -1
- package/dist/src/components/ui/switch.d.ts +2 -3
- package/dist/src/components/ui/switch.js +4 -4
- package/dist/src/components/ui/table.d.ts +0 -1
- package/dist/src/components/ui/table.js +1 -1
- package/dist/src/components/ui/textarea.d.ts +1 -2
- package/dist/src/components/ui/textarea.js +4 -4
- package/dist/src/components/ui/theme-toggle.d.ts +2 -0
- package/dist/src/components/ui/theme-toggle.js +11 -0
- package/dist/src/components/ui/tooltip.d.ts +0 -1
- package/dist/src/hooks/use-debounced.d.ts +1 -0
- package/dist/src/hooks/use-debounced.js +18 -0
- package/dist/src/hooks/use-list-flows.d.ts +0 -2
- package/dist/src/hooks/use-list-flows.js +6 -10
- package/dist/src/hooks/use-log-listener.d.ts +1 -6
- package/dist/src/hooks/use-log-listener.js +3 -18
- package/dist/src/hooks/use-mobile.d.ts +0 -1
- package/dist/src/hooks/use-theme.d.ts +6 -0
- package/dist/src/hooks/use-theme.js +28 -0
- package/dist/src/index.css +169 -0
- package/dist/src/lib/utils.d.ts +0 -1
- package/dist/src/main.d.ts +0 -8
- package/dist/src/main.js +11 -7
- package/dist/src/publicComponents/api-node.d.ts +2 -5
- package/dist/src/publicComponents/api-node.js +3 -3
- package/dist/src/publicComponents/base-handle.d.ts +1 -1
- package/dist/src/publicComponents/base-handle.js +5 -2
- package/dist/src/publicComponents/base-node.d.ts +5 -5
- package/dist/src/publicComponents/base-node.js +13 -8
- package/dist/src/publicComponents/colorMap.d.ts +6 -0
- package/dist/src/publicComponents/colorMap.js +6 -0
- package/dist/src/publicComponents/components/header-bar.d.ts +11 -0
- package/dist/src/publicComponents/components/header-bar.js +15 -0
- package/dist/src/publicComponents/cron-node.d.ts +2 -0
- package/dist/src/publicComponents/cron-node.js +7 -0
- package/dist/src/publicComponents/emits.d.ts +1 -1
- package/dist/src/publicComponents/emits.js +2 -2
- package/dist/src/publicComponents/event-node.d.ts +0 -2
- package/dist/src/publicComponents/event-node.js +3 -5
- package/dist/src/publicComponents/node-details.d.ts +17 -0
- package/dist/src/publicComponents/node-details.js +19 -0
- package/dist/src/publicComponents/node-props.d.ts +5 -3
- package/dist/src/publicComponents/noop-node.d.ts +0 -1
- package/dist/src/publicComponents/noop-node.js +1 -1
- package/dist/src/publicComponents/subscribe.d.ts +2 -3
- package/dist/src/publicComponents/subscribe.js +2 -2
- package/dist/src/route-wrapper.d.ts +2 -4
- package/dist/src/route-wrapper.js +2 -2
- package/dist/src/routes/endpoints-page.d.ts +1 -0
- package/dist/src/routes/endpoints-page.js +5 -0
- package/dist/src/routes/flow.d.ts +1 -0
- package/dist/src/routes/flow.js +22 -0
- package/dist/src/routes/index.d.ts +1 -2
- package/dist/src/routes/index.js +5 -8
- package/dist/src/routes/logs-page.d.ts +1 -0
- package/dist/src/routes/logs-page.js +12 -0
- package/dist/src/routes/states-page.d.ts +1 -0
- package/dist/src/routes/states-page.js +5 -0
- package/dist/src/stores/use-logs.d.ts +3 -2
- package/dist/src/stores/use-logs.js +52 -6
- package/dist/src/views/flow/arrow-head.d.ts +2 -2
- package/dist/src/views/flow/arrow-head.js +5 -1
- package/dist/src/views/flow/base-edge.d.ts +0 -1
- package/dist/src/views/flow/base-edge.js +25 -10
- package/dist/src/views/flow/flow-loader.d.ts +0 -1
- package/dist/src/views/flow/flow-loader.js +1 -1
- package/dist/src/views/flow/flow-view.d.ts +7 -2
- package/dist/src/views/flow/flow-view.js +44 -20
- package/dist/src/views/flow/hooks/use-get-flow-state.d.ts +14 -5
- package/dist/src/views/flow/hooks/use-get-flow-state.js +17 -8
- package/dist/src/views/flow/hooks/use-organize-nodes.d.ts +0 -1
- package/dist/src/views/flow/hooks/use-save-workflow-config.d.ts +9 -0
- package/dist/src/views/flow/hooks/use-save-workflow-config.js +23 -0
- package/dist/src/views/flow/legend.d.ts +3 -3
- package/dist/src/views/flow/legend.js +49 -39
- package/dist/src/views/flow/node-organizer.d.ts +1 -1
- package/dist/src/views/flow/node-organizer.js +4 -2
- package/dist/src/views/flow/nodes/api-flow-node.d.ts +0 -1
- package/dist/src/views/flow/nodes/event-flow-node.d.ts +0 -1
- package/dist/src/views/flow/nodes/language-indicator.d.ts +0 -1
- package/dist/src/views/flow/nodes/language-indicator.js +7 -7
- package/dist/src/views/flow/nodes/nodes.types.d.ts +39 -6
- package/dist/src/views/flow/nodes/noop-flow-node.d.ts +0 -1
- package/dist/tailwind.config.js +9 -77
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/tsconfig.node.tsbuildinfo +1 -1
- package/package.json +36 -42
- package/postcss.config.mjs +9 -0
- package/dist/index.d.ts.map +0 -1
- package/dist/middleware.d.ts.map +0 -1
- package/dist/src/components/app-sidebar.d.ts.map +0 -1
- package/dist/src/components/log-console.d.ts.map +0 -1
- package/dist/src/components/log-console.js +0 -20
- package/dist/src/components/log-level-badge.d.ts.map +0 -1
- package/dist/src/components/ui/badge.d.ts.map +0 -1
- package/dist/src/components/ui/button.d.ts.map +0 -1
- package/dist/src/components/ui/collapsible.d.ts.map +0 -1
- package/dist/src/components/ui/dialog.d.ts.map +0 -1
- package/dist/src/components/ui/input.d.ts.map +0 -1
- package/dist/src/components/ui/label.d.ts.map +0 -1
- package/dist/src/components/ui/select.d.ts.map +0 -1
- package/dist/src/components/ui/separator.d.ts.map +0 -1
- package/dist/src/components/ui/sheet.d.ts.map +0 -1
- package/dist/src/components/ui/sidebar.d.ts.map +0 -1
- package/dist/src/components/ui/skeleton.d.ts.map +0 -1
- package/dist/src/components/ui/switch.d.ts.map +0 -1
- package/dist/src/components/ui/table.d.ts.map +0 -1
- package/dist/src/components/ui/textarea.d.ts.map +0 -1
- package/dist/src/components/ui/tooltip.d.ts.map +0 -1
- package/dist/src/hooks/use-list-flows.d.ts.map +0 -1
- package/dist/src/hooks/use-log-listener.d.ts.map +0 -1
- package/dist/src/hooks/use-mobile.d.ts.map +0 -1
- package/dist/src/lib/utils.d.ts.map +0 -1
- package/dist/src/main.d.ts.map +0 -1
- package/dist/src/publicComponents/api-node.d.ts.map +0 -1
- package/dist/src/publicComponents/base-handle.d.ts.map +0 -1
- package/dist/src/publicComponents/base-node.d.ts.map +0 -1
- package/dist/src/publicComponents/emits.d.ts.map +0 -1
- package/dist/src/publicComponents/event-node.d.ts.map +0 -1
- package/dist/src/publicComponents/node-props.d.ts.map +0 -1
- package/dist/src/publicComponents/noop-node.d.ts.map +0 -1
- package/dist/src/publicComponents/subscribe.d.ts.map +0 -1
- package/dist/src/route-wrapper.d.ts.map +0 -1
- package/dist/src/routeTree.gen.d.ts +0 -53
- package/dist/src/routeTree.gen.d.ts.map +0 -1
- package/dist/src/routeTree.gen.js +0 -45
- package/dist/src/routes/__root.d.ts +0 -2
- package/dist/src/routes/__root.d.ts.map +0 -1
- package/dist/src/routes/__root.js +0 -15
- package/dist/src/routes/flow/$id.d.ts +0 -4
- package/dist/src/routes/flow/$id.d.ts.map +0 -1
- package/dist/src/routes/flow/$id.js +0 -15
- package/dist/src/routes/index.d.ts.map +0 -1
- package/dist/src/stores/use-logs.d.ts.map +0 -1
- package/dist/src/views/flow/arrow-head.d.ts.map +0 -1
- package/dist/src/views/flow/base-edge.d.ts.map +0 -1
- package/dist/src/views/flow/flow-loader.d.ts.map +0 -1
- package/dist/src/views/flow/flow-view.d.ts.map +0 -1
- package/dist/src/views/flow/hooks/use-get-flow-state.d.ts.map +0 -1
- package/dist/src/views/flow/hooks/use-organize-nodes.d.ts.map +0 -1
- package/dist/src/views/flow/legend.d.ts.map +0 -1
- package/dist/src/views/flow/node-organizer.d.ts.map +0 -1
- package/dist/src/views/flow/nodes/api-flow-node.d.ts.map +0 -1
- package/dist/src/views/flow/nodes/event-flow-node.d.ts.map +0 -1
- package/dist/src/views/flow/nodes/json-schema-form.d.ts +0 -9
- package/dist/src/views/flow/nodes/json-schema-form.d.ts.map +0 -1
- package/dist/src/views/flow/nodes/json-schema-form.js +0 -35
- package/dist/src/views/flow/nodes/language-indicator.d.ts.map +0 -1
- package/dist/src/views/flow/nodes/nodes.types.d.ts.map +0 -1
- package/dist/src/views/flow/nodes/noop-flow-node.d.ts.map +0 -1
- package/dist/tailwind.config.d.ts +0 -4
- package/dist/tailwind.config.d.ts.map +0 -1
- package/dist/vite.config.d.ts +0 -11
- package/dist/vite.config.d.ts.map +0 -1
- package/dist/vite.config.js +0 -18
- package/eslint.config.js +0 -28
- package/index.html +0 -19
- package/index.tsx +0 -10
- package/middleware.ts +0 -48
- package/postcss.config.js +0 -6
- package/src/assets/.empty +0 -0
- package/src/components/app-sidebar.tsx +0 -55
- package/src/components/log-console.tsx +0 -76
- package/src/components/log-level-badge.tsx +0 -12
- package/src/components/ui/badge.tsx +0 -31
- package/src/components/ui/button.tsx +0 -47
- package/src/components/ui/collapsible.tsx +0 -9
- package/src/components/ui/dialog.tsx +0 -120
- package/src/components/ui/input.tsx +0 -21
- package/src/components/ui/label.tsx +0 -26
- package/src/components/ui/select.tsx +0 -157
- package/src/components/ui/separator.tsx +0 -22
- package/src/components/ui/sheet.tsx +0 -106
- package/src/components/ui/sidebar.tsx +0 -637
- package/src/components/ui/skeleton.tsx +0 -7
- package/src/components/ui/switch.tsx +0 -27
- package/src/components/ui/table.tsx +0 -76
- package/src/components/ui/textarea.tsx +0 -22
- package/src/components/ui/tooltip.tsx +0 -32
- package/src/hooks/use-list-flows.tsx +0 -20
- package/src/hooks/use-log-listener.tsx +0 -32
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/index.css +0 -190
- package/src/lib/utils.ts +0 -6
- package/src/main.tsx +0 -28
- package/src/publicComponents/api-node.tsx +0 -28
- package/src/publicComponents/base-handle.tsx +0 -43
- package/src/publicComponents/base-node.tsx +0 -57
- package/src/publicComponents/emits.tsx +0 -22
- package/src/publicComponents/event-node.tsx +0 -36
- package/src/publicComponents/node-props.tsx +0 -15
- package/src/publicComponents/noop-node.tsx +0 -21
- package/src/publicComponents/subscribe.tsx +0 -19
- package/src/route-wrapper.tsx +0 -9
- package/src/routeTree.gen.ts +0 -109
- package/src/routes/__root.tsx +0 -26
- package/src/routes/flow/$id.tsx +0 -21
- package/src/routes/index.tsx +0 -13
- package/src/stores/use-logs.ts +0 -22
- package/src/views/flow/arrow-head.tsx +0 -13
- package/src/views/flow/base-edge.tsx +0 -31
- package/src/views/flow/flow-loader.tsx +0 -3
- package/src/views/flow/flow-view.tsx +0 -72
- package/src/views/flow/hooks/use-get-flow-state.tsx +0 -93
- package/src/views/flow/hooks/use-organize-nodes.ts +0 -60
- package/src/views/flow/legend.tsx +0 -96
- package/src/views/flow/node-organizer.tsx +0 -70
- package/src/views/flow/nodes/api-flow-node.tsx +0 -6
- package/src/views/flow/nodes/event-flow-node.tsx +0 -6
- package/src/views/flow/nodes/json-schema-form.tsx +0 -110
- package/src/views/flow/nodes/language-indicator.tsx +0 -74
- package/src/views/flow/nodes/nodes.types.ts +0 -36
- package/src/views/flow/nodes/noop-flow-node.tsx +0 -6
- package/src/vite-env.d.ts +0 -1
- package/tailwind.config.ts +0 -75
- package/tsconfig.app.json +0 -32
- package/tsconfig.json +0 -14
- package/tsconfig.node.json +0 -32
- package/tsconfig.node.tsbuildinfo +0 -1
- package/vite.config.ts +0 -14
- /package/{components.json → dist/components.json} +0 -0
- /package/{public → dist/public}/.empty +0 -0
|
@@ -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
|
+
};
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useStreamGroup } from '@motiadev/stream-client-react';
|
|
2
2
|
export const useListFlows = () => {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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,22 +1,7 @@
|
|
|
1
1
|
import { useLogs } from '@/stores/use-logs';
|
|
2
|
-
import {
|
|
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
|
-
|
|
9
|
-
|
|
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
|
};
|
|
@@ -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
|
+
}
|
package/dist/src/lib/utils.d.ts
CHANGED
package/dist/src/main.d.ts
CHANGED
|
@@ -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 {
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
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(
|
|
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
|
-
|
|
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 {
|
|
5
|
-
export const ApiNode = ({ data, children
|
|
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
|
|
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-
|
|
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
|
|
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
|
-
|
|
7
|
-
|
|
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: '
|
|
11
|
-
api: '
|
|
12
|
-
noop: '
|
|
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
|
|
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,
|
|
19
|
-
return (
|
|
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,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,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,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
|
|
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-
|
|
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 {
|
|
5
|
-
import { Subscribe } from './subscribe';
|
|
3
|
+
import { NodeDetails } from './node-details';
|
|
6
4
|
export const EventNode = (props) => {
|
|
7
|
-
const { data,
|
|
8
|
-
return (_jsxs(BaseNode, { variant: "event", title: data.name, disableSourceHandle: !data.emits.length, disableTargetHandle: !data.subscribes
|
|
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
|
+
};
|