@motiadev/workbench 0.0.1 → 0.0.3
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/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/middleware.d.ts +3 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/middleware.js +47 -0
- package/dist/src/components/app-sidebar.d.ts +2 -0
- package/dist/src/components/app-sidebar.d.ts.map +1 -0
- package/dist/src/components/app-sidebar.js +13 -0
- package/dist/src/components/log-console.d.ts +2 -0
- package/dist/src/components/log-console.d.ts.map +1 -0
- package/dist/src/components/log-console.js +20 -0
- package/dist/src/components/log-level-badge.d.ts +4 -0
- package/dist/src/components/log-level-badge.d.ts.map +1 -0
- package/dist/src/components/log-level-badge.js +11 -0
- package/dist/src/components/ui/badge.d.ts +10 -0
- package/dist/src/components/ui/badge.d.ts.map +1 -0
- package/dist/src/components/ui/badge.js +23 -0
- package/dist/src/components/ui/button.d.ts +12 -0
- package/dist/src/components/ui/button.d.ts.map +1 -0
- package/dist/src/components/ui/button.js +34 -0
- package/dist/src/components/ui/collapsible.d.ts +6 -0
- package/dist/src/components/ui/collapsible.d.ts.map +1 -0
- package/dist/src/components/ui/collapsible.js +5 -0
- package/dist/src/components/ui/dialog.d.ts +20 -0
- package/dist/src/components/ui/dialog.d.ts.map +1 -0
- package/dist/src/components/ui/dialog.js +22 -0
- package/dist/src/components/ui/input.d.ts +4 -0
- package/dist/src/components/ui/input.d.ts.map +1 -0
- package/dist/src/components/ui/input.js +8 -0
- package/dist/src/components/ui/label.d.ts +6 -0
- package/dist/src/components/ui/label.d.ts.map +1 -0
- package/dist/src/components/ui/label.js +10 -0
- package/dist/src/components/ui/select.d.ts +14 -0
- package/dist/src/components/ui/select.d.ts.map +1 -0
- package/dist/src/components/ui/select.js +26 -0
- package/dist/src/components/ui/separator.d.ts +5 -0
- package/dist/src/components/ui/separator.d.ts.map +1 -0
- package/dist/src/components/ui/separator.js +8 -0
- package/dist/src/components/ui/sheet.d.ts +26 -0
- package/dist/src/components/ui/sheet.d.ts.map +1 -0
- package/dist/src/components/ui/sheet.js +36 -0
- package/dist/src/components/ui/sidebar.d.ts +67 -0
- package/dist/src/components/ui/sidebar.d.ts.map +1 -0
- package/dist/src/components/ui/sidebar.js +221 -0
- package/dist/src/components/ui/skeleton.d.ts +3 -0
- package/dist/src/components/ui/skeleton.d.ts.map +1 -0
- package/dist/src/components/ui/skeleton.js +6 -0
- package/dist/src/components/ui/switch.d.ts +5 -0
- package/dist/src/components/ui/switch.d.ts.map +1 -0
- package/dist/src/components/ui/switch.js +7 -0
- package/dist/src/components/ui/table.d.ts +11 -0
- package/dist/src/components/ui/table.d.ts.map +1 -0
- package/dist/src/components/ui/table.js +20 -0
- package/dist/src/components/ui/textarea.d.ts +4 -0
- package/dist/src/components/ui/textarea.d.ts.map +1 -0
- package/dist/src/components/ui/textarea.js +8 -0
- package/dist/src/components/ui/tooltip.d.ts +8 -0
- package/dist/src/components/ui/tooltip.d.ts.map +1 -0
- package/dist/src/components/ui/tooltip.js +11 -0
- package/dist/src/hooks/use-list-flows.d.ts +10 -0
- package/dist/src/hooks/use-list-flows.d.ts.map +1 -0
- package/dist/src/hooks/use-list-flows.js +12 -0
- package/dist/src/hooks/use-log-listener.d.ts +6 -0
- package/dist/src/hooks/use-log-listener.d.ts.map +1 -0
- package/dist/src/hooks/use-log-listener.js +22 -0
- package/dist/src/hooks/use-mobile.d.ts +2 -0
- package/dist/src/hooks/use-mobile.d.ts.map +1 -0
- package/dist/src/hooks/use-mobile.js +15 -0
- package/dist/src/lib/utils.d.ts +3 -0
- package/dist/src/lib/utils.d.ts.map +1 -0
- package/dist/src/lib/utils.js +5 -0
- package/dist/src/main.d.ts +9 -0
- package/dist/src/main.d.ts.map +1 -0
- package/dist/src/main.js +15 -0
- package/dist/src/publicComponents/api-node.d.ts +8 -0
- package/dist/src/publicComponents/api-node.d.ts.map +1 -0
- package/dist/src/publicComponents/api-node.js +7 -0
- package/dist/src/publicComponents/base-handle.d.ts +8 -0
- package/dist/src/publicComponents/base-handle.d.ts.map +1 -0
- package/dist/src/publicComponents/base-handle.js +7 -0
- package/dist/src/publicComponents/base-node.d.ts +16 -0
- package/dist/src/publicComponents/base-node.d.ts.map +1 -0
- package/dist/src/publicComponents/base-node.js +20 -0
- package/dist/src/publicComponents/emits.d.ts +5 -0
- package/dist/src/publicComponents/emits.d.ts.map +1 -0
- package/dist/src/publicComponents/emits.js +6 -0
- package/dist/src/publicComponents/event-node.d.ts +9 -0
- package/dist/src/publicComponents/event-node.d.ts.map +1 -0
- package/dist/src/publicComponents/event-node.js +9 -0
- package/dist/src/publicComponents/node-props.d.ts +12 -0
- package/dist/src/publicComponents/node-props.d.ts.map +1 -0
- package/dist/src/publicComponents/node-props.js +1 -0
- package/dist/src/publicComponents/noop-node.d.ts +8 -0
- package/dist/src/publicComponents/noop-node.d.ts.map +1 -0
- package/dist/src/publicComponents/noop-node.js +5 -0
- package/dist/src/publicComponents/subscribe.d.ts +5 -0
- package/dist/src/publicComponents/subscribe.d.ts.map +1 -0
- package/dist/src/publicComponents/subscribe.js +5 -0
- package/dist/src/route-wrapper.d.ts +4 -0
- package/dist/src/route-wrapper.d.ts.map +1 -0
- package/dist/src/route-wrapper.js +4 -0
- package/dist/src/routeTree.gen.d.ts +53 -0
- package/dist/src/routeTree.gen.d.ts.map +1 -0
- package/dist/src/routeTree.gen.js +45 -0
- package/dist/src/routes/__root.d.ts +2 -0
- package/dist/src/routes/__root.d.ts.map +1 -0
- package/dist/src/routes/__root.js +15 -0
- package/dist/src/routes/flow/$id.d.ts +4 -0
- package/dist/src/routes/flow/$id.d.ts.map +1 -0
- package/dist/src/routes/flow/$id.js +15 -0
- package/dist/src/routes/index.d.ts +2 -0
- package/dist/src/routes/index.d.ts.map +1 -0
- package/dist/src/routes/index.js +8 -0
- package/dist/src/stores/use-logs.d.ts +15 -0
- package/dist/src/stores/use-logs.d.ts.map +1 -0
- package/dist/src/stores/use-logs.js +6 -0
- package/dist/src/views/flow/arrow-head.d.ts +8 -0
- package/dist/src/views/flow/arrow-head.d.ts.map +1 -0
- package/dist/src/views/flow/arrow-head.js +2 -0
- package/dist/src/views/flow/base-edge.d.ts +4 -0
- package/dist/src/views/flow/base-edge.d.ts.map +1 -0
- package/dist/src/views/flow/base-edge.js +22 -0
- package/dist/src/views/flow/flow-loader.d.ts +2 -0
- package/dist/src/views/flow/flow-loader.d.ts.map +1 -0
- package/dist/src/views/flow/flow-loader.js +4 -0
- package/dist/src/views/flow/flow-view.d.ts +8 -0
- package/dist/src/views/flow/flow-view.d.ts.map +1 -0
- package/dist/src/views/flow/flow-view.js +40 -0
- package/dist/src/views/flow/hooks/use-get-flow-state.d.ts +40 -0
- package/dist/src/views/flow/hooks/use-get-flow-state.d.ts.map +1 -0
- package/dist/src/views/flow/hooks/use-get-flow-state.js +48 -0
- package/dist/src/views/flow/hooks/use-organize-nodes.d.ts +4 -0
- package/dist/src/views/flow/hooks/use-organize-nodes.d.ts.map +1 -0
- package/dist/src/views/flow/hooks/use-organize-nodes.js +43 -0
- package/dist/src/views/flow/legend.d.ts +4 -0
- package/dist/src/views/flow/legend.d.ts.map +1 -0
- package/dist/src/views/flow/legend.js +41 -0
- package/dist/src/views/flow/node-organizer.d.ts +6 -0
- package/dist/src/views/flow/node-organizer.d.ts.map +1 -0
- package/dist/src/views/flow/node-organizer.js +51 -0
- package/dist/src/views/flow/nodes/api-flow-node.d.ts +5 -0
- package/dist/src/views/flow/nodes/api-flow-node.d.ts.map +1 -0
- package/dist/src/views/flow/nodes/api-flow-node.js +5 -0
- package/dist/src/views/flow/nodes/event-flow-node.d.ts +3 -0
- package/dist/src/views/flow/nodes/event-flow-node.d.ts.map +1 -0
- package/dist/src/views/flow/nodes/event-flow-node.js +5 -0
- package/dist/src/views/flow/nodes/json-schema-form.d.ts +9 -0
- package/dist/src/views/flow/nodes/json-schema-form.d.ts.map +1 -0
- package/dist/src/views/flow/nodes/json-schema-form.js +35 -0
- package/dist/src/views/flow/nodes/language-indicator.d.ts +8 -0
- package/dist/src/views/flow/nodes/language-indicator.d.ts.map +1 -0
- package/dist/src/views/flow/nodes/language-indicator.js +25 -0
- package/dist/src/views/flow/nodes/nodes.types.d.ts +37 -0
- package/dist/src/views/flow/nodes/nodes.types.d.ts.map +1 -0
- package/dist/src/views/flow/nodes/nodes.types.js +1 -0
- package/dist/src/views/flow/nodes/noop-flow-node.d.ts +5 -0
- package/dist/src/views/flow/nodes/noop-flow-node.d.ts.map +1 -0
- package/dist/src/views/flow/nodes/noop-flow-node.js +5 -0
- package/dist/tailwind.config.d.ts +4 -0
- package/dist/tailwind.config.d.ts.map +1 -0
- package/dist/tailwind.config.js +77 -0
- package/dist/tsconfig.app.tsbuildinfo +1 -0
- package/dist/tsconfig.node.tsbuildinfo +1 -0
- package/dist/vite.config.d.ts +11 -0
- package/dist/vite.config.d.ts.map +1 -0
- package/dist/vite.config.js +18 -0
- package/middleware.ts +3 -2
- package/package.json +5 -3
- package/postcss.config.js +1 -1
- package/src/views/flow/base-edge.tsx +7 -20
- package/src/views/flow/flow-view.tsx +1 -1
- package/src/views/flow/hooks/use-get-flow-state.tsx +18 -34
- package/src/views/flow/legend.tsx +45 -8
- package/src/views/flow/nodes/nodes.types.ts +4 -4
- package/tsconfig.app.json +7 -5
- package/tsconfig.json +1 -0
- package/tsconfig.node.json +15 -5
- package/vite.config.ts +3 -3
- package/dist/.empty +0 -0
- package/dist/assets/index-DGmArPOa.css +0 -1
- package/dist/assets/index-hQsWtfVb.js +0 -182
- package/dist/index.html +0 -20
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { EventNodeProps } from './node-props';
|
|
3
|
+
type Props = PropsWithChildren<EventNodeProps & {
|
|
4
|
+
excludePubsub?: boolean;
|
|
5
|
+
className?: string;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const EventNode: (props: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=event-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-node.d.ts","sourceRoot":"","sources":["../../../src/publicComponents/event-node.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAIzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAG7C,KAAK,KAAK,GAAG,iBAAiB,CAC5B,cAAc,GAAG;IACf,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CACF,CAAA;AAED,eAAO,MAAM,SAAS,UAAW,KAAK,4CAqBrC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { LanguageIndicator } from '../views/flow/nodes/language-indicator';
|
|
3
|
+
import { BaseNode } from './base-node';
|
|
4
|
+
import { Emits } from './emits';
|
|
5
|
+
import { Subscribe } from './subscribe';
|
|
6
|
+
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 })] }));
|
|
9
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { EventNodeData, ApiNodeData, NoopNodeData } from '../views/flow/nodes/nodes.types';
|
|
2
|
+
export type BaseNodeProps = EventNodeProps | NoopNodeProps | ApiNodeProps;
|
|
3
|
+
export type EventNodeProps = {
|
|
4
|
+
data: EventNodeData;
|
|
5
|
+
};
|
|
6
|
+
export type NoopNodeProps = {
|
|
7
|
+
data: NoopNodeData;
|
|
8
|
+
};
|
|
9
|
+
export type ApiNodeProps = {
|
|
10
|
+
data: ApiNodeData;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=node-props.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-props.d.ts","sourceRoot":"","sources":["../../../src/publicComponents/node-props.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAE1F,MAAM,MAAM,aAAa,GAAG,cAAc,GAAG,aAAa,GAAG,YAAY,CAAA;AAEzE,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,aAAa,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,YAAY,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,WAAW,CAAA;CAClB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
import { NoopNodeData } from '../views/flow/nodes/nodes.types';
|
|
3
|
+
type Props = PropsWithChildren<{
|
|
4
|
+
data: NoopNodeData;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const NoopNode: ({ data, children }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=noop-node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop-node.d.ts","sourceRoot":"","sources":["../../../src/publicComponents/noop-node.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAA;AAG9D,KAAK,KAAK,GAAG,iBAAiB,CAAC;IAC7B,IAAI,EAAE,YAAY,CAAA;CACnB,CAAC,CAAA;AAEF,eAAO,MAAM,QAAQ,uBAAwB,KAAK,4CAYjD,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { BaseNode } from './base-node';
|
|
3
|
+
export const NoopNode = ({ data, children }) => {
|
|
4
|
+
return (_jsxs(BaseNode, { variant: "noop", 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] }));
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../../../src/publicComponents/subscribe.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAE/D,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAevD,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Eye } from 'lucide-react';
|
|
3
|
+
export const Subscribe = ({ data }) => {
|
|
4
|
+
return (_jsx(_Fragment, { children: data.subscribes.map((subscribe) => (_jsxs("div", { className: "flex gap-2 items-center text-xs text-white/60", "data-testid": `subscribes__${subscribe}`, children: [_jsx(Eye, { className: "w-3 h-3 text-white/40" }), _jsx("div", { className: "font-mono tracking-wider", children: subscribe })] }, subscribe))) }));
|
|
5
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-wrapper.d.ts","sourceRoot":"","sources":["../../src/route-wrapper.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,iBAAkB;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,4CAKvE,CAAA"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { AppSidebar } from './components/app-sidebar';
|
|
3
|
+
import { SidebarProvider } from './components/ui/sidebar';
|
|
4
|
+
export const RouteWrapper = ({ children }) => (_jsxs(SidebarProvider, { children: [_jsx(AppSidebar, {}), children] }));
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Route as rootRoute } from './routes/__root';
|
|
2
|
+
import { Route as IndexImport } from './routes/index';
|
|
3
|
+
import { Route as FlowIdImport } from './routes/flow/$id';
|
|
4
|
+
declare const IndexRoute: import("@tanstack/react-router").Route<import("@tanstack/react-router").RootRoute<undefined, {}, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown, unknown>, "/", "/", "/", "/", undefined, Record<never, string>, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown>;
|
|
5
|
+
declare const FlowIdRoute: import("@tanstack/react-router").Route<import("@tanstack/react-router").RootRoute<undefined, {}, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown, unknown>, "/flow/$id", "/flow/$id", "/flow/$id", "/flow/$id", undefined, Record<"id", string>, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, ({ params }: import("@tanstack/react-router").LoaderFnContext<import("@tanstack/react-router").RootRoute<undefined, {}, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown, unknown>, "/flow/$id", Record<"id", string>, {}, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext>) => Promise<{
|
|
6
|
+
flow: any;
|
|
7
|
+
}>, unknown>;
|
|
8
|
+
declare module '@tanstack/react-router' {
|
|
9
|
+
interface FileRoutesByPath {
|
|
10
|
+
'/': {
|
|
11
|
+
id: '/';
|
|
12
|
+
path: '/';
|
|
13
|
+
fullPath: '/';
|
|
14
|
+
preLoaderRoute: typeof IndexImport;
|
|
15
|
+
parentRoute: typeof rootRoute;
|
|
16
|
+
};
|
|
17
|
+
'/flow/$id': {
|
|
18
|
+
id: '/flow/$id';
|
|
19
|
+
path: '/flow/$id';
|
|
20
|
+
fullPath: '/flow/$id';
|
|
21
|
+
preLoaderRoute: typeof FlowIdImport;
|
|
22
|
+
parentRoute: typeof rootRoute;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export interface FileRoutesByFullPath {
|
|
27
|
+
'/': typeof IndexRoute;
|
|
28
|
+
'/flow/$id': typeof FlowIdRoute;
|
|
29
|
+
}
|
|
30
|
+
export interface FileRoutesByTo {
|
|
31
|
+
'/': typeof IndexRoute;
|
|
32
|
+
'/flow/$id': typeof FlowIdRoute;
|
|
33
|
+
}
|
|
34
|
+
export interface FileRoutesById {
|
|
35
|
+
__root__: typeof rootRoute;
|
|
36
|
+
'/': typeof IndexRoute;
|
|
37
|
+
'/flow/$id': typeof FlowIdRoute;
|
|
38
|
+
}
|
|
39
|
+
export interface FileRouteTypes {
|
|
40
|
+
fileRoutesByFullPath: FileRoutesByFullPath;
|
|
41
|
+
fullPaths: '/' | '/flow/$id';
|
|
42
|
+
fileRoutesByTo: FileRoutesByTo;
|
|
43
|
+
to: '/' | '/flow/$id';
|
|
44
|
+
id: '__root__' | '/' | '/flow/$id';
|
|
45
|
+
fileRoutesById: FileRoutesById;
|
|
46
|
+
}
|
|
47
|
+
export interface RootRouteChildren {
|
|
48
|
+
IndexRoute: typeof IndexRoute;
|
|
49
|
+
FlowIdRoute: typeof FlowIdRoute;
|
|
50
|
+
}
|
|
51
|
+
export declare const routeTree: import("@tanstack/react-router").RootRoute<undefined, {}, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, RootRouteChildren, FileRouteTypes>;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=routeTree.gen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routeTree.gen.d.ts","sourceRoot":"","sources":["../../src/routeTree.gen.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,iBAAiB,CAAA;AACpD,OAAO,EAAE,KAAK,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACrD,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIzD,QAAA,MAAM,UAAU,mbAIP,CAAA;AAET,QAAA,MAAM,WAAW;;YAIR,CAAA;AAIT,OAAO,QAAQ,wBAAwB,CAAC;IACtC,UAAU,gBAAgB;QACxB,GAAG,EAAE;YACH,EAAE,EAAE,GAAG,CAAA;YACP,IAAI,EAAE,GAAG,CAAA;YACT,QAAQ,EAAE,GAAG,CAAA;YACb,cAAc,EAAE,OAAO,WAAW,CAAA;YAClC,WAAW,EAAE,OAAO,SAAS,CAAA;SAC9B,CAAA;QACD,WAAW,EAAE;YACX,EAAE,EAAE,WAAW,CAAA;YACf,IAAI,EAAE,WAAW,CAAA;YACjB,QAAQ,EAAE,WAAW,CAAA;YACrB,cAAc,EAAE,OAAO,YAAY,CAAA;YACnC,WAAW,EAAE,OAAO,SAAS,CAAA;SAC9B,CAAA;KACF;CACF;AAID,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,OAAO,UAAU,CAAA;IACtB,WAAW,EAAE,OAAO,WAAW,CAAA;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,OAAO,UAAU,CAAA;IACtB,WAAW,EAAE,OAAO,WAAW,CAAA;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,OAAO,SAAS,CAAA;IAC1B,GAAG,EAAE,OAAO,UAAU,CAAA;IACtB,WAAW,EAAE,OAAO,WAAW,CAAA;CAChC;AAED,MAAM,WAAW,cAAc;IAC7B,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,SAAS,EAAE,GAAG,GAAG,WAAW,CAAA;IAC5B,cAAc,EAAE,cAAc,CAAA;IAC9B,EAAE,EAAE,GAAG,GAAG,WAAW,CAAA;IACrB,EAAE,EAAE,UAAU,GAAG,GAAG,GAAG,WAAW,CAAA;IAClC,cAAc,EAAE,cAAc,CAAA;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,OAAO,UAAU,CAAA;IAC7B,WAAW,EAAE,OAAO,WAAW,CAAA;CAChC;AAOD,eAAO,MAAM,SAAS,uMAAgF,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// @ts-nocheck
|
|
3
|
+
// noinspection JSUnusedGlobalSymbols
|
|
4
|
+
// This file was automatically generated by TanStack Router.
|
|
5
|
+
// You should NOT make any changes in this file as it will be overwritten.
|
|
6
|
+
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
|
|
7
|
+
// Import Routes
|
|
8
|
+
import { Route as rootRoute } from './routes/__root';
|
|
9
|
+
import { Route as IndexImport } from './routes/index';
|
|
10
|
+
import { Route as FlowIdImport } from './routes/flow/$id';
|
|
11
|
+
// Create/Update Routes
|
|
12
|
+
const IndexRoute = IndexImport.update({
|
|
13
|
+
id: '/',
|
|
14
|
+
path: '/',
|
|
15
|
+
getParentRoute: () => rootRoute,
|
|
16
|
+
});
|
|
17
|
+
const FlowIdRoute = FlowIdImport.update({
|
|
18
|
+
id: '/flow/$id',
|
|
19
|
+
path: '/flow/$id',
|
|
20
|
+
getParentRoute: () => rootRoute,
|
|
21
|
+
});
|
|
22
|
+
const rootRouteChildren = {
|
|
23
|
+
IndexRoute: IndexRoute,
|
|
24
|
+
FlowIdRoute: FlowIdRoute,
|
|
25
|
+
};
|
|
26
|
+
export const routeTree = rootRoute._addFileChildren(rootRouteChildren)._addFileTypes();
|
|
27
|
+
/* ROUTE_MANIFEST_START
|
|
28
|
+
{
|
|
29
|
+
"routes": {
|
|
30
|
+
"__root__": {
|
|
31
|
+
"filePath": "__root.tsx",
|
|
32
|
+
"children": [
|
|
33
|
+
"/",
|
|
34
|
+
"/flow/$id"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"/": {
|
|
38
|
+
"filePath": "index.tsx"
|
|
39
|
+
},
|
|
40
|
+
"/flow/$id": {
|
|
41
|
+
"filePath": "flow/$id.tsx"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
ROUTE_MANIFEST_END */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"__root.d.ts","sourceRoot":"","sources":["../../../src/routes/__root.tsx"],"names":[],"mappings":"AAyBA,eAAO,MAAM,KAAK,sLAAiD,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { RouteWrapper } from '@/route-wrapper';
|
|
3
|
+
import { createRootRoute, Outlet } from '@tanstack/react-router';
|
|
4
|
+
import React, { Suspense } from 'react';
|
|
5
|
+
const TanStackRouterDevtools = process.env.NODE_ENV === 'production'
|
|
6
|
+
? () => null // Render nothing in production
|
|
7
|
+
: React.lazy(() =>
|
|
8
|
+
// Lazy load in development
|
|
9
|
+
import('@tanstack/router-devtools').then((res) => ({
|
|
10
|
+
default: res.TanStackRouterDevtools,
|
|
11
|
+
// For Embedded Mode
|
|
12
|
+
// default: res.TanStackRouterDevtoolsPanel
|
|
13
|
+
})));
|
|
14
|
+
const RouteComponent = () => (_jsxs(RouteWrapper, { children: [_jsx(Outlet, {}), _jsx(Suspense, { children: _jsx(TanStackRouterDevtools, {}) })] }));
|
|
15
|
+
export const Route = createRootRoute({ component: RouteComponent });
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const Route: import("@tanstack/react-router").Route<import("@tanstack/react-router").RootRoute<undefined, {}, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown, unknown>, "/flow/$id", "/flow/$id", "/flow/$id", "/flow/$id", undefined, Record<"id", string>, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, ({ params }: import("@tanstack/react-router").LoaderFnContext<import("@tanstack/react-router").RootRoute<undefined, {}, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown, unknown>, "/flow/$id", Record<"id", string>, {}, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext>) => Promise<{
|
|
2
|
+
flow: any;
|
|
3
|
+
}>, unknown>;
|
|
4
|
+
//# sourceMappingURL=$id.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"$id.d.ts","sourceRoot":"","sources":["../../../../src/routes/flow/$id.tsx"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK;;YAOhB,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { FlowView } from '@/views/flow/flow-view';
|
|
3
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
4
|
+
export const Route = createFileRoute('/flow/$id')({
|
|
5
|
+
component: Flow,
|
|
6
|
+
loader: async ({ params }) => {
|
|
7
|
+
return fetch(`/flows/${params.id}`)
|
|
8
|
+
.then((res) => res.json())
|
|
9
|
+
.then((flow) => ({ flow }));
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
function Flow() {
|
|
13
|
+
const { flow } = Route.useLoaderData();
|
|
14
|
+
return (_jsx("div", { className: "w-screen h-screen", children: _jsx(FlowView, { flow: flow }) }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const Route: import("@tanstack/react-router").Route<import("@tanstack/react-router").RootRoute<undefined, {}, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown, unknown>, "/", "/", "/", "/", undefined, Record<never, string>, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, import("@tanstack/react-router").AnyContext, {}, undefined, unknown>;
|
|
2
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/routes/index.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,KAAK,mbAEhB,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createFileRoute } from '@tanstack/react-router';
|
|
3
|
+
export const Route = createFileRoute('/')({
|
|
4
|
+
component: Index,
|
|
5
|
+
});
|
|
6
|
+
function Index() {
|
|
7
|
+
return (_jsx("div", { className: "flex items-center justify-center w-full h-screen", children: _jsx("p", { className: "text-gray-500", children: "Select a flow" }) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type Log = {
|
|
2
|
+
level: string;
|
|
3
|
+
time: number;
|
|
4
|
+
msg: string;
|
|
5
|
+
traceId: string;
|
|
6
|
+
flows: string[];
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
};
|
|
9
|
+
export type LogsState = {
|
|
10
|
+
logs: Log[];
|
|
11
|
+
addLog: (log: Log) => void;
|
|
12
|
+
resetLogs: () => void;
|
|
13
|
+
};
|
|
14
|
+
export declare const useLogs: import("zustand").UseBoundStore<import("zustand").StoreApi<LogsState>>;
|
|
15
|
+
//# sourceMappingURL=use-logs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-logs.d.ts","sourceRoot":"","sources":["../../../src/stores/use-logs.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAG,GAAG;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,EAAE,MAAM,CAAA;IACf,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,MAAM,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,IAAI,CAAA;IAC1B,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,CAAA;AAED,eAAO,MAAM,OAAO,wEAIjB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrow-head.d.ts","sourceRoot":"","sources":["../../../../src/views/flow/arrow-head.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,MAAM,CAAA;CACX,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAKrC,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export const ArrowHead = (props) => (_jsxs("marker", { id: props.id, viewBox: "-5 -5 10 10", markerUnits: "strokeWidth", markerWidth: "10", markerHeight: "10", children: [_jsx("line", { x1: 0, y1: 0, x2: 2, y2: -2, stroke: props.color, strokeWidth: "1", strokeOpacity: "1", strokeLinecap: "round" }), _jsx("line", { x1: -2, y1: -2, x2: 0, y2: 0, stroke: props.color, strokeWidth: "1", strokeOpacity: "1", strokeLinecap: "round" })] }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-edge.d.ts","sourceRoot":"","sources":["../../../../src/views/flow/base-edge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,SAAS,EAAqB,MAAM,eAAe,CAAA;AAC3F,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,SAAS,CA2BxC,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { BaseEdge as BaseReactFlowEdge, getSmoothStepPath } from '@xyflow/react';
|
|
3
|
+
export const BaseEdge = (props) => {
|
|
4
|
+
const { sourceX, sourceY, targetX, targetY, sourcePosition, targetPosition, data } = props;
|
|
5
|
+
const [edgePath] = getSmoothStepPath({
|
|
6
|
+
sourceX,
|
|
7
|
+
sourceY,
|
|
8
|
+
targetX,
|
|
9
|
+
targetY,
|
|
10
|
+
sourcePosition,
|
|
11
|
+
targetPosition,
|
|
12
|
+
borderRadius: 20,
|
|
13
|
+
offset: 10,
|
|
14
|
+
});
|
|
15
|
+
return (_jsx(BaseReactFlowEdge, { path: edgePath, style: {
|
|
16
|
+
stroke: data?.variant === 'virtual' ? 'rgb(147, 169, 197)' : 'rgb(133, 176, 132)',
|
|
17
|
+
strokeWidth: 0.5,
|
|
18
|
+
shapeRendering: 'geometricPrecision',
|
|
19
|
+
fill: 'none',
|
|
20
|
+
mixBlendMode: 'screen',
|
|
21
|
+
}, className: "edge-animated" }));
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-loader.d.ts","sourceRoot":"","sources":["../../../../src/views/flow/flow-loader.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,+CAEtB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flow-view.d.ts","sourceRoot":"","sources":["../../../../src/views/flow/flow-view.tsx"],"names":[],"mappings":"AACA,OAAO,8BAA8B,CAAA;AAGrC,OAAO,EAAmB,YAAY,EAAE,MAAM,4BAA4B,CAAA;AAY1E,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,YAAY,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,KAAK,CAmDpC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Background, BackgroundVariant, ReactFlow } from '@xyflow/react';
|
|
3
|
+
import '@xyflow/react/dist/style.css';
|
|
4
|
+
import { BaseEdge } from './base-edge';
|
|
5
|
+
import { ArrowHead } from './arrow-head';
|
|
6
|
+
import { useGetFlowState } from './hooks/use-get-flow-state';
|
|
7
|
+
import { useCallback, useEffect, useState } from 'react';
|
|
8
|
+
import { NodeOrganizer } from './node-organizer';
|
|
9
|
+
import { FlowLoader } from './flow-loader';
|
|
10
|
+
import { useLogListener } from '@/hooks/use-log-listener';
|
|
11
|
+
import { LogConsole } from '@/components/log-console';
|
|
12
|
+
import { Legend } from './legend';
|
|
13
|
+
const edgeTypes = {
|
|
14
|
+
base: BaseEdge,
|
|
15
|
+
};
|
|
16
|
+
export const FlowView = ({ flow }) => {
|
|
17
|
+
const { nodes, edges, onNodesChange, onEdgesChange, nodeTypes } = useGetFlowState(flow);
|
|
18
|
+
const [initialized, setInitialized] = useState(false);
|
|
19
|
+
const [hoveredType, setHoveredType] = useState(null);
|
|
20
|
+
useLogListener();
|
|
21
|
+
useEffect(() => setInitialized(false), [flow]);
|
|
22
|
+
const onInitialized = useCallback(() => {
|
|
23
|
+
setTimeout(() => setInitialized(true), 10);
|
|
24
|
+
}, []);
|
|
25
|
+
const highlightClass = (nodeType) => {
|
|
26
|
+
if (!hoveredType)
|
|
27
|
+
return '';
|
|
28
|
+
return nodeType === hoveredType
|
|
29
|
+
? 'shadow-[0_0_15px_rgba(255,255,255,0.15)] border border-white/30 scale-[1.02] transition-all duration-300'
|
|
30
|
+
: 'opacity-30 transition-all duration-300';
|
|
31
|
+
};
|
|
32
|
+
const nodesWithHighlights = nodes.map((node) => ({
|
|
33
|
+
...node,
|
|
34
|
+
className: highlightClass(node.data.type), // Access type from `data.type`
|
|
35
|
+
}));
|
|
36
|
+
if (!nodeTypes) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
return (_jsxs("div", { className: "w-full h-full relative bg-black", children: [!initialized && _jsx(FlowLoader, {}), _jsx(Legend, { onHover: setHoveredType }), _jsxs(ReactFlow, { nodes: nodesWithHighlights, edges: edges, nodeTypes: nodeTypes, edgeTypes: edgeTypes, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, children: [_jsx(Background, { variant: BackgroundVariant.Dots, gap: 20, size: 1, color: "#444" }), _jsx(NodeOrganizer, { onInitialized: onInitialized }), _jsx("svg", { children: _jsx("defs", { children: _jsx(ArrowHead, { color: "#B3B3B3", id: "arrowhead" }) }) })] }), _jsx(LogConsole, {})] }));
|
|
40
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Edge, Node } from '@xyflow/react';
|
|
2
|
+
import type { EdgeData, NodeData } from '../nodes/nodes.types';
|
|
3
|
+
type Emit = string | {
|
|
4
|
+
type: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
};
|
|
7
|
+
type FlowStep = {
|
|
8
|
+
id: string;
|
|
9
|
+
name: string;
|
|
10
|
+
type: 'event' | 'api' | 'noop';
|
|
11
|
+
description?: string;
|
|
12
|
+
subscribes?: string[];
|
|
13
|
+
emits: Emit[];
|
|
14
|
+
virtualEmits?: Emit[];
|
|
15
|
+
action?: 'webhook';
|
|
16
|
+
webhookUrl?: string;
|
|
17
|
+
language?: string;
|
|
18
|
+
nodeComponentPath?: string;
|
|
19
|
+
};
|
|
20
|
+
export type FlowResponse = {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
steps: FlowStep[];
|
|
24
|
+
edges: FlowEdge[];
|
|
25
|
+
};
|
|
26
|
+
type FlowEdge = {
|
|
27
|
+
id: string;
|
|
28
|
+
source: string;
|
|
29
|
+
target: string;
|
|
30
|
+
data: EdgeData;
|
|
31
|
+
};
|
|
32
|
+
export declare const useGetFlowState: (flow: FlowResponse) => {
|
|
33
|
+
nodes: Node<NodeData>[];
|
|
34
|
+
edges: Edge<EdgeData>[];
|
|
35
|
+
onNodesChange: import("@xyflow/react").OnNodesChange<Node<NodeData>>;
|
|
36
|
+
onEdgesChange: import("@xyflow/react").OnEdgesChange<Edge<EdgeData>>;
|
|
37
|
+
nodeTypes: Record<string, import("react").ComponentType<any>> | undefined;
|
|
38
|
+
};
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=use-get-flow-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-get-flow-state.d.ts","sourceRoot":"","sources":["../../../../../src/views/flow/hooks/use-get-flow-state.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAgC,MAAM,eAAe,CAAA;AAExE,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAA;AAK9D,KAAK,IAAI,GAAG,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAErD,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,CAAA;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,YAAY,CAAC,EAAE,IAAI,EAAE,CAAA;IACrB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,QAAQ,EAAE,CAAA;IACjB,KAAK,EAAE,QAAQ,EAAE,CAAA;CAClB,CAAA;AAED,KAAK,QAAQ,GAAG;IACd,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,QAAQ,CAAA;CACf,CAAA;AAyCD,eAAO,MAAM,eAAe,SAAU,YAAY;;;;;;CAgBjD,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useEdgesState, useNodesState } from '@xyflow/react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { ApiFlowNode } from '../nodes/api-flow-node';
|
|
4
|
+
import { NoopFlowNode } from '../nodes/noop-flow-node';
|
|
5
|
+
import { EventFlowNode } from '../nodes/event-flow-node';
|
|
6
|
+
async function importFlow(flow) {
|
|
7
|
+
const nodeTypes = {
|
|
8
|
+
event: EventFlowNode,
|
|
9
|
+
api: ApiFlowNode,
|
|
10
|
+
noop: NoopFlowNode,
|
|
11
|
+
};
|
|
12
|
+
// Load custom node components if they exist
|
|
13
|
+
for (const step of flow.steps) {
|
|
14
|
+
if (step.nodeComponentPath) {
|
|
15
|
+
const module = await import(/* @vite-ignore */ step.nodeComponentPath);
|
|
16
|
+
nodeTypes[step.nodeComponentPath] = module.default;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Create nodes from steps
|
|
20
|
+
const nodes = flow.steps.map((step) => ({
|
|
21
|
+
id: step.id,
|
|
22
|
+
type: step.nodeComponentPath ? step.nodeComponentPath : step.type,
|
|
23
|
+
position: { x: 0, y: 0 },
|
|
24
|
+
data: step,
|
|
25
|
+
language: step.language,
|
|
26
|
+
}));
|
|
27
|
+
// Use the edges provided by the API, adding required ReactFlow properties
|
|
28
|
+
const edges = flow.edges.map((edge) => ({
|
|
29
|
+
...edge,
|
|
30
|
+
type: 'base',
|
|
31
|
+
}));
|
|
32
|
+
return { nodes, edges, nodeTypes };
|
|
33
|
+
}
|
|
34
|
+
export const useGetFlowState = (flow) => {
|
|
35
|
+
const [nodeTypes, setNodeTypes] = useState();
|
|
36
|
+
const [nodes, setNodes, onNodesChange] = useNodesState([]);
|
|
37
|
+
const [edges, setEdges, onEdgesChange] = useEdgesState([]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!flow)
|
|
40
|
+
return;
|
|
41
|
+
importFlow(flow).then(({ nodes, edges, nodeTypes }) => {
|
|
42
|
+
setNodes(nodes);
|
|
43
|
+
setEdges(edges);
|
|
44
|
+
setNodeTypes(nodeTypes);
|
|
45
|
+
});
|
|
46
|
+
}, [flow]);
|
|
47
|
+
return { nodes, edges, onNodesChange, onEdgesChange, nodeTypes };
|
|
48
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Edge, Node } from '@xyflow/react';
|
|
2
|
+
import { EventNodeData, EdgeData, ApiNodeData } from '../nodes/nodes.types';
|
|
3
|
+
export declare const useOrganizeNodes: (nodes: Node<EventNodeData | ApiNodeData>[], edges: Edge<EdgeData>[], setNodes: (nodes: Node<EventNodeData | ApiNodeData>[]) => void) => void;
|
|
4
|
+
//# sourceMappingURL=use-organize-nodes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-organize-nodes.d.ts","sourceRoot":"","sources":["../../../../../src/views/flow/hooks/use-organize-nodes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAG1C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AA0C3E,eAAO,MAAM,gBAAgB,UACpB,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,EAAE,SACnC,IAAI,CAAC,QAAQ,CAAC,EAAE,YACb,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,EAAE,KAAK,IAAI,SAW/D,CAAA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import dagre from 'dagre';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
3
|
+
const organizeNodes = (nodes, edges) => {
|
|
4
|
+
const dagreGraph = new dagre.graphlib.Graph({ compound: true });
|
|
5
|
+
dagreGraph.setDefaultEdgeLabel(() => ({}));
|
|
6
|
+
// Top-to-bottom layout
|
|
7
|
+
dagreGraph.setGraph({ rankdir: 'TB', ranksep: 80, nodesep: 60, edgesep: 20, ranker: 'tight-tree' });
|
|
8
|
+
nodes.forEach((node) => {
|
|
9
|
+
dagreGraph.setNode(node.id, { width: node.measured?.width, height: node.measured?.height });
|
|
10
|
+
});
|
|
11
|
+
edges.forEach((edge) => {
|
|
12
|
+
if (typeof edge.label === 'string') {
|
|
13
|
+
dagreGraph.setEdge(edge.source, edge.target, {
|
|
14
|
+
label: edge.label ?? '',
|
|
15
|
+
width: edge.label.length * 40, // Add width for the label
|
|
16
|
+
height: 30, // Add height for the label
|
|
17
|
+
labelpos: 'c', // Position label in center
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
dagreGraph.setEdge(edge.source, edge.target);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
dagre.layout(dagreGraph);
|
|
25
|
+
return nodes.map((node) => {
|
|
26
|
+
const { x, y } = dagreGraph.node(node.id);
|
|
27
|
+
const position = {
|
|
28
|
+
x: x - (node.measured?.width ?? 0) / 2,
|
|
29
|
+
y: y - (node.measured?.height ?? 0) / 2,
|
|
30
|
+
};
|
|
31
|
+
return { ...node, position };
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
export const useOrganizeNodes = (nodes, edges, setNodes) => {
|
|
35
|
+
const organizedRef = useRef(false);
|
|
36
|
+
useEffect(() => {
|
|
37
|
+
if (!nodes.length || !edges.length || !nodes[0].measured || organizedRef.current)
|
|
38
|
+
return;
|
|
39
|
+
const layoutedNodes = organizeNodes(nodes, edges);
|
|
40
|
+
setNodes(layoutedNodes);
|
|
41
|
+
organizedRef.current = true;
|
|
42
|
+
}, [nodes, edges, setNodes]);
|
|
43
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../../../src/views/flow/legend.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM,gBAAiB;IAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAA;CAAE,4CA+F7E,CAAA"}
|