@motiadev/workbench 0.14.0-beta.165-285707 → 0.15.0-beta.165
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 +189 -10
- package/dist/index.html +1 -1
- package/dist/index.js +1065 -7
- package/dist/middleware.d.ts +66 -8
- package/dist/middleware.js +694 -86
- package/dist/motia-plugin/__tests__/generator.test.ts +129 -0
- package/dist/motia-plugin/__tests__/resolver.test.ts +82 -0
- package/dist/motia-plugin/__tests__/validator.test.ts +71 -0
- package/dist/motia-plugin/{generator.js → generator.ts} +37 -35
- package/dist/motia-plugin/hmr.ts +123 -0
- package/dist/motia-plugin/index.ts +183 -0
- package/dist/motia-plugin/{resolver.d.ts → resolver.ts} +38 -5
- package/dist/motia-plugin/types.ts +198 -0
- package/dist/motia-plugin/{utils.d.ts → utils.ts} +17 -4
- package/dist/motia-plugin/validator.ts +197 -0
- package/dist/src/App.tsx +41 -0
- package/dist/src/components/NotFoundPage.tsx +11 -0
- package/dist/src/components/bottom-panel.tsx +39 -0
- package/dist/src/components/flow/base-edge.tsx +61 -0
- package/dist/src/components/flow/flow-loader.tsx +3 -0
- package/dist/src/components/flow/flow-page.tsx +75 -0
- package/dist/src/components/flow/flow-tab-menu-item.tsx +52 -0
- package/dist/src/components/flow/flow-view.tsx +66 -0
- package/dist/src/components/flow/hooks/use-get-flow-state.tsx +171 -0
- package/dist/src/components/flow/hooks/use-save-workflow-config.ts +25 -0
- package/dist/src/components/flow/node-organizer.tsx +103 -0
- package/dist/src/components/flow/nodes/api-flow-node.tsx +6 -0
- package/dist/src/components/flow/nodes/cron-flow-node.tsx +6 -0
- package/dist/src/components/flow/nodes/event-flow-node.tsx +6 -0
- package/dist/src/components/flow/nodes/noop-flow-node.tsx +6 -0
- package/dist/src/components/header/deploy-button.tsx +110 -0
- package/dist/src/components/header/header.tsx +39 -0
- package/dist/src/components/root-motia.tsx +10 -0
- package/dist/src/components/top-panel.tsx +40 -0
- package/dist/src/components/tutorial/engine/tutorial-engine.ts +26 -0
- package/dist/src/components/tutorial/engine/tutorial-types.ts +26 -0
- package/dist/src/components/tutorial/engine/workbench-xpath.ts +53 -0
- package/dist/src/components/tutorial/hooks/tutorial-utils.ts +26 -0
- package/dist/src/components/tutorial/hooks/use-tutorial-engine.ts +213 -0
- package/dist/src/components/tutorial/hooks/use-tutorial.ts +14 -0
- package/dist/src/components/tutorial/tutorial-button.tsx +46 -0
- package/dist/src/components/tutorial/tutorial-step.tsx +82 -0
- package/dist/src/components/tutorial/tutorial.tsx +59 -0
- package/dist/src/components/ui/json-editor.tsx +68 -0
- package/dist/src/components/ui/table.tsx +75 -0
- package/dist/src/components/ui/theme-toggle.tsx +54 -0
- package/dist/src/components/ui/tooltip.tsx +26 -0
- package/dist/src/hooks/use-debounced.ts +22 -0
- package/dist/src/hooks/use-fetch-flows.ts +33 -0
- package/dist/src/hooks/use-mobile.ts +19 -0
- package/dist/src/hooks/use-update-handle-positions.ts +42 -0
- package/dist/src/index.css +5 -5
- package/dist/src/lib/__tests__/utils.test.ts +110 -0
- package/dist/src/lib/motia-analytics.ts +140 -0
- package/dist/src/lib/plugins.tsx +132 -0
- package/dist/src/lib/utils.ts +37 -0
- package/dist/src/main.tsx +30 -0
- package/dist/src/project-view-mode.tsx +32 -0
- package/dist/src/publicComponents/api-node.tsx +26 -0
- package/dist/src/publicComponents/base-node/base-handle.tsx +50 -0
- package/dist/src/publicComponents/base-node/base-node.tsx +114 -0
- package/dist/src/publicComponents/base-node/code-display.tsx +119 -0
- package/dist/src/publicComponents/base-node/emits.tsx +17 -0
- package/dist/src/publicComponents/base-node/feature-card.tsx +32 -0
- package/dist/src/publicComponents/base-node/language-indicator.tsx +131 -0
- package/dist/src/publicComponents/base-node/node-header.tsx +49 -0
- package/dist/src/publicComponents/base-node/node-sidebar.tsx +41 -0
- package/dist/src/publicComponents/base-node/subscribe.tsx +13 -0
- package/dist/src/publicComponents/cron-node.tsx +24 -0
- package/dist/src/publicComponents/event-node.tsx +20 -0
- package/dist/src/publicComponents/node-props.tsx +15 -0
- package/dist/src/publicComponents/noop-node.tsx +19 -0
- package/dist/src/setupTests.ts +1 -0
- package/dist/src/stores/use-app-tabs-store.ts +49 -0
- package/dist/src/stores/use-flow-store.ts +31 -0
- package/dist/src/stores/use-global-store.ts +24 -0
- package/dist/src/stores/use-motia-config-store.ts +36 -0
- package/dist/src/stores/use-tabs-store.ts +34 -0
- package/dist/src/system-view-mode.tsx +28 -0
- package/dist/src/types/endpoint.ts +12 -0
- package/dist/src/types/file.ts +7 -0
- package/dist/src/types/flow.ts +103 -0
- package/eslint.config.cjs +22 -0
- package/jest.config.cjs +68 -0
- package/package.json +53 -51
- package/dist/motia-plugin/__tests__/generator.test.d.ts +0 -1
- package/dist/motia-plugin/__tests__/generator.test.js +0 -97
- package/dist/motia-plugin/__tests__/resolver.test.d.ts +0 -1
- package/dist/motia-plugin/__tests__/resolver.test.js +0 -64
- package/dist/motia-plugin/__tests__/validator.test.d.ts +0 -1
- package/dist/motia-plugin/__tests__/validator.test.js +0 -59
- package/dist/motia-plugin/generator.d.ts +0 -78
- package/dist/motia-plugin/hmr.d.ts +0 -22
- package/dist/motia-plugin/hmr.js +0 -100
- package/dist/motia-plugin/index.d.ts +0 -3
- package/dist/motia-plugin/index.js +0 -153
- package/dist/motia-plugin/resolver.js +0 -92
- package/dist/motia-plugin/types.d.ts +0 -169
- package/dist/motia-plugin/types.js +0 -36
- package/dist/motia-plugin/utils.js +0 -75
- package/dist/motia-plugin/validator.d.ts +0 -19
- package/dist/motia-plugin/validator.js +0 -163
- package/dist/src/App.d.ts +0 -2
- package/dist/src/App.js +0 -35
- package/dist/src/components/NotFoundPage.d.ts +0 -1
- package/dist/src/components/NotFoundPage.js +0 -3
- package/dist/src/components/bottom-panel.d.ts +0 -1
- package/dist/src/components/bottom-panel.js +0 -15
- package/dist/src/components/flow/base-edge.d.ts +0 -3
- package/dist/src/components/flow/base-edge.js +0 -39
- package/dist/src/components/flow/flow-loader.d.ts +0 -1
- package/dist/src/components/flow/flow-loader.js +0 -4
- package/dist/src/components/flow/flow-page.d.ts +0 -1
- package/dist/src/components/flow/flow-page.js +0 -25
- package/dist/src/components/flow/flow-tab-menu-item.d.ts +0 -1
- package/dist/src/components/flow/flow-tab-menu-item.js +0 -18
- package/dist/src/components/flow/flow-view.d.ts +0 -12
- package/dist/src/components/flow/flow-view.js +0 -22
- package/dist/src/components/flow/hooks/use-get-flow-state.d.ts +0 -10
- package/dist/src/components/flow/hooks/use-get-flow-state.js +0 -133
- package/dist/src/components/flow/hooks/use-save-workflow-config.d.ts +0 -2
- package/dist/src/components/flow/hooks/use-save-workflow-config.js +0 -22
- package/dist/src/components/flow/node-organizer.d.ts +0 -10
- package/dist/src/components/flow/node-organizer.js +0 -82
- package/dist/src/components/flow/nodes/api-flow-node.d.ts +0 -2
- package/dist/src/components/flow/nodes/api-flow-node.js +0 -5
- package/dist/src/components/flow/nodes/cron-flow-node.d.ts +0 -2
- package/dist/src/components/flow/nodes/cron-flow-node.js +0 -5
- package/dist/src/components/flow/nodes/event-flow-node.d.ts +0 -2
- package/dist/src/components/flow/nodes/event-flow-node.js +0 -5
- package/dist/src/components/flow/nodes/noop-flow-node.d.ts +0 -2
- package/dist/src/components/flow/nodes/noop-flow-node.js +0 -5
- package/dist/src/components/header/deploy-button.d.ts +0 -1
- package/dist/src/components/header/deploy-button.js +0 -28
- package/dist/src/components/header/header.d.ts +0 -2
- package/dist/src/components/header/header.js +0 -23
- package/dist/src/components/root-motia.d.ts +0 -2
- package/dist/src/components/root-motia.js +0 -7
- package/dist/src/components/top-panel.d.ts +0 -1
- package/dist/src/components/top-panel.js +0 -15
- package/dist/src/components/tutorial/engine/tutorial-engine.d.ts +0 -12
- package/dist/src/components/tutorial/engine/tutorial-engine.js +0 -36
- package/dist/src/components/tutorial/engine/tutorial-types.d.ts +0 -22
- package/dist/src/components/tutorial/engine/tutorial-types.js +0 -1
- package/dist/src/components/tutorial/engine/workbench-xpath.d.ts +0 -45
- package/dist/src/components/tutorial/engine/workbench-xpath.js +0 -45
- package/dist/src/components/tutorial/hooks/tutorial-utils.d.ts +0 -1
- package/dist/src/components/tutorial/hooks/tutorial-utils.js +0 -17
- package/dist/src/components/tutorial/hooks/use-tutorial-engine.d.ts +0 -15
- package/dist/src/components/tutorial/hooks/use-tutorial-engine.js +0 -183
- package/dist/src/components/tutorial/hooks/use-tutorial.d.ts +0 -5
- package/dist/src/components/tutorial/hooks/use-tutorial.js +0 -10
- package/dist/src/components/tutorial/tutorial-button.d.ts +0 -2
- package/dist/src/components/tutorial/tutorial-button.js +0 -21
- package/dist/src/components/tutorial/tutorial-step.d.ts +0 -14
- package/dist/src/components/tutorial/tutorial-step.js +0 -19
- package/dist/src/components/tutorial/tutorial.d.ts +0 -2
- package/dist/src/components/tutorial/tutorial.js +0 -32
- package/dist/src/components/ui/json-editor.d.ts +0 -12
- package/dist/src/components/ui/json-editor.js +0 -35
- package/dist/src/components/ui/table.d.ts +0 -10
- package/dist/src/components/ui/table.js +0 -20
- package/dist/src/components/ui/theme-toggle.d.ts +0 -2
- package/dist/src/components/ui/theme-toggle.js +0 -19
- package/dist/src/components/ui/tooltip.d.ts +0 -6
- package/dist/src/components/ui/tooltip.js +0 -3
- package/dist/src/hooks/use-debounced.d.ts +0 -1
- package/dist/src/hooks/use-debounced.js +0 -18
- package/dist/src/hooks/use-fetch-flows.d.ts +0 -1
- package/dist/src/hooks/use-fetch-flows.js +0 -26
- package/dist/src/hooks/use-mobile.d.ts +0 -1
- package/dist/src/hooks/use-mobile.js +0 -15
- package/dist/src/hooks/use-update-handle-positions.d.ts +0 -10
- package/dist/src/hooks/use-update-handle-positions.js +0 -35
- package/dist/src/lib/__tests__/utils.test.d.ts +0 -1
- package/dist/src/lib/__tests__/utils.test.js +0 -94
- package/dist/src/lib/motia-analytics.d.ts +0 -38
- package/dist/src/lib/motia-analytics.js +0 -132
- package/dist/src/lib/plugins.d.ts +0 -2
- package/dist/src/lib/plugins.js +0 -105
- package/dist/src/lib/utils.d.ts +0 -7
- package/dist/src/lib/utils.js +0 -34
- package/dist/src/main.d.ts +0 -2
- package/dist/src/main.js +0 -17
- package/dist/src/project-view-mode.d.ts +0 -1
- package/dist/src/project-view-mode.js +0 -20
- package/dist/src/publicComponents/api-node.d.ts +0 -5
- package/dist/src/publicComponents/api-node.js +0 -5
- package/dist/src/publicComponents/base-node/base-handle.d.ts +0 -9
- package/dist/src/publicComponents/base-node/base-handle.js +0 -8
- package/dist/src/publicComponents/base-node/base-node.d.ts +0 -15
- package/dist/src/publicComponents/base-node/base-node.js +0 -30
- package/dist/src/publicComponents/base-node/code-display.d.ts +0 -9
- package/dist/src/publicComponents/base-node/code-display.js +0 -64
- package/dist/src/publicComponents/base-node/emits.d.ts +0 -5
- package/dist/src/publicComponents/base-node/emits.js +0 -5
- package/dist/src/publicComponents/base-node/feature-card.d.ts +0 -10
- package/dist/src/publicComponents/base-node/feature-card.js +0 -5
- package/dist/src/publicComponents/base-node/language-indicator.d.ts +0 -10
- package/dist/src/publicComponents/base-node/language-indicator.js +0 -29
- package/dist/src/publicComponents/base-node/node-header.d.ts +0 -13
- package/dist/src/publicComponents/base-node/node-header.js +0 -30
- package/dist/src/publicComponents/base-node/node-sidebar.d.ts +0 -14
- package/dist/src/publicComponents/base-node/node-sidebar.js +0 -9
- package/dist/src/publicComponents/base-node/subscribe.d.ts +0 -4
- package/dist/src/publicComponents/base-node/subscribe.js +0 -4
- package/dist/src/publicComponents/cron-node.d.ts +0 -4
- package/dist/src/publicComponents/cron-node.js +0 -6
- package/dist/src/publicComponents/event-node.d.ts +0 -4
- package/dist/src/publicComponents/event-node.js +0 -5
- package/dist/src/publicComponents/node-props.d.ts +0 -21
- package/dist/src/publicComponents/node-props.js +0 -1
- package/dist/src/publicComponents/noop-node.d.ts +0 -4
- package/dist/src/publicComponents/noop-node.js +0 -5
- package/dist/src/setupTests.d.ts +0 -1
- package/dist/src/setupTests.js +0 -1
- package/dist/src/stores/use-app-tabs-store.d.ts +0 -16
- package/dist/src/stores/use-app-tabs-store.js +0 -31
- package/dist/src/stores/use-flow-store.d.ts +0 -21
- package/dist/src/stores/use-flow-store.js +0 -16
- package/dist/src/stores/use-global-store.d.ts +0 -18
- package/dist/src/stores/use-global-store.js +0 -12
- package/dist/src/stores/use-motia-config-store.d.ts +0 -12
- package/dist/src/stores/use-motia-config-store.js +0 -24
- package/dist/src/stores/use-tabs-store.d.ts +0 -19
- package/dist/src/stores/use-tabs-store.js +0 -22
- package/dist/src/system-view-mode.d.ts +0 -1
- package/dist/src/system-view-mode.js +0 -10
- package/dist/src/types/endpoint.d.ts +0 -14
- package/dist/src/types/endpoint.js +0 -1
- package/dist/src/types/file.d.ts +0 -7
- package/dist/src/types/file.js +0 -1
- package/dist/src/types/flow.d.ts +0 -115
- package/dist/src/types/flow.js +0 -1
- package/dist/tsconfig.app.tsbuildinfo +0 -1
- package/dist/tsconfig.node.tsbuildinfo +0 -1
package/dist/src/lib/utils.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { TabLocation } from '@/stores/use-app-tabs-store';
|
|
2
|
-
export const formatDuration = (duration) => {
|
|
3
|
-
if (duration === undefined || duration === null)
|
|
4
|
-
return 'N/A';
|
|
5
|
-
if (duration < 1000)
|
|
6
|
-
return `${duration}ms`;
|
|
7
|
-
if (duration < 60000)
|
|
8
|
-
return `${(duration / 1000).toFixed(1)}s`;
|
|
9
|
-
if (duration < 3600000)
|
|
10
|
-
return `${(duration / 60000).toFixed(1)}min`;
|
|
11
|
-
return `${(duration / 3600000).toFixed(1)}h`;
|
|
12
|
-
};
|
|
13
|
-
export const formatTimestamp = (time) => {
|
|
14
|
-
const date = new Date(Number(time));
|
|
15
|
-
return `${date.toLocaleDateString('en-US', { year: undefined, month: 'short', day: '2-digit' })}, ${date.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit', second: '2-digit', hourCycle: 'h24' })}.${date.getMilliseconds().toString().padStart(3, '0')}`;
|
|
16
|
-
};
|
|
17
|
-
export const DEFAULT_VIEW_MODE = 'system';
|
|
18
|
-
export const getViewModeFromURL = () => {
|
|
19
|
-
try {
|
|
20
|
-
const url = new URL(window.location.href);
|
|
21
|
-
const viewMode = url.searchParams.get('view-mode');
|
|
22
|
-
if (viewMode === 'project' || viewMode === 'system') {
|
|
23
|
-
return viewMode;
|
|
24
|
-
}
|
|
25
|
-
return DEFAULT_VIEW_MODE;
|
|
26
|
-
}
|
|
27
|
-
catch (error) {
|
|
28
|
-
console.error('[Motia] Error parsing URL:', error);
|
|
29
|
-
return DEFAULT_VIEW_MODE;
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
export const isValidTabLocation = (position) => {
|
|
33
|
-
return Object.values(TabLocation).includes(position);
|
|
34
|
-
};
|
package/dist/src/main.d.ts
DELETED
package/dist/src/main.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { MotiaStreamProvider } from '@motiadev/stream-client-react';
|
|
3
|
-
import { StrictMode } from 'react';
|
|
4
|
-
import { createRoot } from 'react-dom/client';
|
|
5
|
-
import { BrowserRouter, Route, Routes } from 'react-router-dom';
|
|
6
|
-
import { App } from './App';
|
|
7
|
-
import { NotFoundPage } from './components/NotFoundPage';
|
|
8
|
-
import { RootMotia } from './components/root-motia';
|
|
9
|
-
import '@motiadev/ui/globals.css';
|
|
10
|
-
import './index.css';
|
|
11
|
-
const rootElement = document.getElementById('root');
|
|
12
|
-
if (!rootElement.innerHTML) {
|
|
13
|
-
const basePath = workbenchBase;
|
|
14
|
-
const root = createRoot(rootElement);
|
|
15
|
-
const address = window.location.origin.replace('http', 'ws');
|
|
16
|
-
root.render(_jsx(StrictMode, { children: _jsx(MotiaStreamProvider, { address: address, children: _jsx(RootMotia, { children: _jsx(BrowserRouter, { children: _jsxs(Routes, { children: [_jsx(Route, { path: basePath, element: _jsx(App, {}) }), _jsx(Route, { path: "*", element: _jsx(NotFoundPage, {}) })] }) }) }) }) }));
|
|
17
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const ProjectViewMode: import("react").MemoExoticComponent<() => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { APP_SIDEBAR_CONTAINER_ID, Panel } from '@motiadev/ui';
|
|
3
|
-
import { memo } from 'react';
|
|
4
|
-
import { useShallow } from 'zustand/react/shallow';
|
|
5
|
-
import { TabLocation, useAppTabsStore } from './stores/use-app-tabs-store';
|
|
6
|
-
const topTabs = (state) => state.tabs[TabLocation.TOP];
|
|
7
|
-
export const ProjectViewMode = memo(() => {
|
|
8
|
-
const tabs = useAppTabsStore(useShallow(topTabs));
|
|
9
|
-
return (_jsxs("div", { className: "grid grid-rows-1 grid-cols-[1fr_auto] bg-background text-foreground h-screen ", children: [_jsx("main", { className: "m-2 overflow-hidden", children: _jsx(Panel, { contentClassName: 'p-0', tabs: tabs.map((tab) => {
|
|
10
|
-
const Element = tab.content;
|
|
11
|
-
const LabelComponent = tab.tabLabel;
|
|
12
|
-
return {
|
|
13
|
-
label: tab.id,
|
|
14
|
-
labelComponent: _jsx(LabelComponent, {}),
|
|
15
|
-
content: _jsx(Element, {}),
|
|
16
|
-
'data-testid': tab.id,
|
|
17
|
-
};
|
|
18
|
-
}) }) }), _jsx("div", { id: APP_SIDEBAR_CONTAINER_ID })] }));
|
|
19
|
-
});
|
|
20
|
-
ProjectViewMode.displayName = 'ProjectViewMode';
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { BaseNode } from './base-node/base-node';
|
|
3
|
-
export const ApiNode = ({ data, children }) => {
|
|
4
|
-
return (_jsxs(BaseNode, { data: data, variant: "api", title: data.name, language: data.language, subtitle: data.description, disableSourceHandle: !data.emits?.length && !data.virtualEmits?.length, disableTargetHandle: !data.subscribes?.length && !data.virtualSubscribes?.length, children: [data.webhookUrl && (_jsx("div", { className: "flex gap-1 items-center text-muted-foreground", children: _jsx("div", { className: "font-mono", children: data.webhookUrl }) })), children] }));
|
|
5
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type HandleProps } from '@xyflow/react';
|
|
2
|
-
import type React from 'react';
|
|
3
|
-
import type { HTMLAttributes } from 'react';
|
|
4
|
-
type Props = HandleProps & Omit<HTMLAttributes<HTMLDivElement>, 'id'> & {
|
|
5
|
-
isHidden?: boolean;
|
|
6
|
-
onTogglePosition?: () => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const BaseHandle: React.FC<Props>;
|
|
9
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Position, Handle as RFHandle } from '@xyflow/react';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
export const BaseHandle = (props) => {
|
|
5
|
-
const { isHidden, position, onTogglePosition, ...rest } = props;
|
|
6
|
-
const isHorizontal = position === Position.Left || position === Position.Right;
|
|
7
|
-
return (_jsx("div", { className: clsx('absolute w-[6px] h-[6px]', position === Position.Top && '-top-[4px]', position === Position.Bottom && '-bottom-[4px]', position === Position.Left && '-left-[4px]', position === Position.Right && '-right-[4px]', isHorizontal ? 'top-1/2 -mt-[2px]' : 'left-1/2 -ml-[2px]', isHidden && 'hidden'), onClick: onTogglePosition, children: _jsx(RFHandle, { ...rest, position: position, style: { background: 'rgb(30,118,231)' }, className: "\n bg-white/50\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 " }) }));
|
|
8
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { type PropsWithChildren } from 'react';
|
|
3
|
-
import type { BaseNodeProps } from '../node-props';
|
|
4
|
-
type Props = PropsWithChildren<{
|
|
5
|
-
title: string;
|
|
6
|
-
subtitle?: string;
|
|
7
|
-
variant: 'event' | 'api' | 'noop' | 'cron';
|
|
8
|
-
language?: string;
|
|
9
|
-
className?: string;
|
|
10
|
-
disableSourceHandle?: boolean;
|
|
11
|
-
disableTargetHandle?: boolean;
|
|
12
|
-
data: BaseNodeProps;
|
|
13
|
-
}>;
|
|
14
|
-
export declare const BaseNode: React.FC<Props>;
|
|
15
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button, cn } from '@motiadev/ui';
|
|
3
|
-
import { ScanSearch } from 'lucide-react';
|
|
4
|
-
import { useCallback, useEffect, useState } from 'react';
|
|
5
|
-
import { useHandlePositions } from '@/hooks/use-update-handle-positions';
|
|
6
|
-
import { BaseHandle } from './base-handle';
|
|
7
|
-
import { NodeHeader } from './node-header';
|
|
8
|
-
import { NodeSidebar } from './node-sidebar';
|
|
9
|
-
export const BaseNode = ({ title, variant, children, disableSourceHandle, disableTargetHandle, language, subtitle, data, }) => {
|
|
10
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
11
|
-
const { sourcePosition, targetPosition, toggleTargetPosition, toggleSourcePosition } = useHandlePositions(data);
|
|
12
|
-
const [content, setContent] = useState(null);
|
|
13
|
-
const [features, setFeatures] = useState([]);
|
|
14
|
-
const fetchContent = useCallback(async () => {
|
|
15
|
-
const response = await fetch(`/__motia/step/${data.id}`);
|
|
16
|
-
const responseData = await response.json();
|
|
17
|
-
setContent(responseData.content);
|
|
18
|
-
setFeatures(responseData.features);
|
|
19
|
-
}, [data.id]);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (data.id && isOpen) {
|
|
22
|
-
fetchContent();
|
|
23
|
-
}
|
|
24
|
-
}, [data.id, isOpen, fetchContent]);
|
|
25
|
-
return (_jsxs("div", { className: cn('p-1 rounded-lg max-w-[350px]', {
|
|
26
|
-
'bg-muted-foreground/20': isOpen,
|
|
27
|
-
}), children: [_jsx("div", { className: "rounded-lg dark:bg-[#101010] bg-background border-1 border-muted-foreground/30 border-solid", "data-testid": `node-${title?.toLowerCase().replace(/ /g, '-')}`, children: _jsxs("div", { className: "group relative", children: [_jsx(NodeHeader, { text: title, variant: variant, className: "border-b-2 border-muted-foreground/10", children: _jsx("div", { className: "flex justify-end", children: _jsx(Button, { "data-testid": `open-code-preview-button-${title?.toLowerCase()}`, variant: "ghost", className: "h-5 p-0.5", onClick: () => setIsOpen(true), children: _jsx(ScanSearch, { className: "w-4 h-4" }) }) }) }), subtitle && _jsx("div", { className: "py-4 px-6 text-sm text-muted-foreground", children: subtitle }), children && (_jsx("div", { className: "p-2", children: _jsx("div", { className: cn('space-y-3 p-4 text-sm text-muted-foreground', {
|
|
28
|
-
'bg-card': variant !== 'noop',
|
|
29
|
-
}), children: children }) })), !disableTargetHandle && (_jsx(BaseHandle, { type: "target", position: targetPosition, onTogglePosition: toggleTargetPosition })), !disableSourceHandle && (_jsx(BaseHandle, { type: "source", position: sourcePosition, onTogglePosition: toggleSourcePosition }))] }) }), content && (_jsx(NodeSidebar, { features: features, content: content, title: title, subtitle: subtitle, variant: variant, language: language, isOpen: isOpen, onClose: () => setIsOpen(false) }))] }));
|
|
30
|
-
};
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useThemeStore } from '@motiadev/ui';
|
|
3
|
-
import { useRef, useState } from 'react';
|
|
4
|
-
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter';
|
|
5
|
-
import { oneDark, oneLight } from 'react-syntax-highlighter/dist/esm/styles/prism';
|
|
6
|
-
import { FeatureCard } from './feature-card';
|
|
7
|
-
import { LanguageIndicator } from './language-indicator';
|
|
8
|
-
const codeTagProps = {
|
|
9
|
-
style: {
|
|
10
|
-
fontFamily: 'DM Mono, monospace',
|
|
11
|
-
fontSize: '16px',
|
|
12
|
-
},
|
|
13
|
-
};
|
|
14
|
-
const customStyle = {
|
|
15
|
-
margin: 0,
|
|
16
|
-
borderRadius: 0,
|
|
17
|
-
padding: 0,
|
|
18
|
-
};
|
|
19
|
-
const isHighlighted = (lines, lineNumber) => {
|
|
20
|
-
return lines.some((line) => {
|
|
21
|
-
const [start, end] = line.split('-').map((num) => parseInt(num, 10));
|
|
22
|
-
if (end !== undefined) {
|
|
23
|
-
return lineNumber >= start && lineNumber <= end;
|
|
24
|
-
}
|
|
25
|
-
return lineNumber == start;
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
const getFirstLineNumber = (line) => {
|
|
29
|
-
const [start] = line.split('-').map((num) => parseInt(num, 10));
|
|
30
|
-
return start;
|
|
31
|
-
};
|
|
32
|
-
export const CodeDisplay = ({ code, language, features }) => {
|
|
33
|
-
const theme = useThemeStore((state) => state.theme);
|
|
34
|
-
const themeStyle = theme === 'dark' ? oneDark : oneLight;
|
|
35
|
-
const [highlightedLines, setHighlightedLines] = useState([]);
|
|
36
|
-
const [selectedFeature, setSelectedFeature] = useState(null);
|
|
37
|
-
const ref = useRef(null);
|
|
38
|
-
const handleFeatureClick = (feature) => {
|
|
39
|
-
setSelectedFeature(feature);
|
|
40
|
-
setHighlightedLines(feature.lines);
|
|
41
|
-
const lineNumber = getFirstLineNumber(feature.lines[0]);
|
|
42
|
-
const line = ref.current?.querySelector(`[data-line-number="${lineNumber}"]`);
|
|
43
|
-
if (line) {
|
|
44
|
-
line.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
return (_jsxs("div", { className: "flex flex-col h-full overflow-hidden", children: [_jsxs("div", { className: "flex items-center py-2 px-5 dark:bg-[#1e1e1e] gap-2 justify-center", children: [_jsx("div", { className: "text-sm text-muted-foreground", children: "Read only" }), _jsx("div", { className: "flex-1" }), _jsx(LanguageIndicator, { language: language, className: "w-4 h-4", size: 16, showLabel: true })] }), _jsxs("div", { className: "flex flex-row h-[calc(100%-36px)]", children: [features && features.length > 0 && (_jsx("div", { className: "flex flex-col gap-2 p-2 bg-card overflow-y-auto min-w-[200px] w-[300px]", children: features.map((feature, index) => (_jsx(FeatureCard, { feature: feature, highlighted: selectedFeature === feature, onClick: () => handleFeatureClick(feature), onHover: () => handleFeatureClick(feature) }, index))) })), _jsx("div", { className: "overflow-y-auto", ref: ref, children: _jsx(SyntaxHighlighter, { showLineNumbers: true, language: language, style: themeStyle, codeTagProps: codeTagProps, customStyle: customStyle, wrapLines: true, lineProps: (lineNumber) => {
|
|
48
|
-
if (isHighlighted(highlightedLines, lineNumber)) {
|
|
49
|
-
return {
|
|
50
|
-
'data-line-number': lineNumber,
|
|
51
|
-
style: {
|
|
52
|
-
borderLeft: '2px solid var(--accent-1000)',
|
|
53
|
-
backgroundColor: 'rgb(from var(--accent-1000) r g b / 0.2)',
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
return {
|
|
58
|
-
'data-line-number': lineNumber,
|
|
59
|
-
style: {
|
|
60
|
-
borderLeft: '2px solid transparent',
|
|
61
|
-
},
|
|
62
|
-
};
|
|
63
|
-
}, children: code }) })] })] }));
|
|
64
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
const toTopic = (emit) => typeof emit === 'string' ? emit : emit.topic;
|
|
3
|
-
export const Emits = ({ emits }) => {
|
|
4
|
-
return (_jsx("div", { className: "flex flex-col gap-2", children: emits.map((emit) => (_jsx("div", { "data-testid": `emits__${toTopic(emit)}`, children: toTopic(emit) }, toTopic(emit)))) }));
|
|
5
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '@motiadev/ui';
|
|
3
|
-
export const FeatureCard = ({ feature, highlighted, onClick, onHover }) => {
|
|
4
|
-
return (_jsxs("div", { "data-feature-id": feature.id, className: cn('p-4 rounded-lg bg-card shadow-sm cursor-pointer hover:bg-card/50 border-2 border-transparent', highlighted && 'border-2 border-accent-1000 bg-accent-100'), onClick: onClick, onMouseEnter: onHover, children: [_jsx("div", { className: "text-md font-semibold text-foreground leading-tight whitespace-nowrap mb-2", children: feature.title }), _jsx("div", { className: "text-sm font-medium text-muted-foreground leading-tight", children: feature.description }), feature.link && (_jsx("div", { className: "text-sm font-medium text-muted-foreground leading-tight", children: _jsx("a", { href: feature.link, children: "Learn more" }) }))] }));
|
|
5
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
|
-
import type { EventNodeData } from '@/types/flow';
|
|
3
|
-
type Props = {
|
|
4
|
-
language: EventNodeData['language'];
|
|
5
|
-
className?: string;
|
|
6
|
-
size?: number;
|
|
7
|
-
showLabel?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare const LanguageIndicator: FC<Props>;
|
|
10
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '@motiadev/ui';
|
|
3
|
-
export const LanguageIndicator = ({ language, className, size = 18, showLabel = false }) => {
|
|
4
|
-
const renderIcon = (language) => {
|
|
5
|
-
if (language === 'typescript') {
|
|
6
|
-
return (_jsxs(_Fragment, { children: [showLabel ? _jsx(_Fragment, { children: "TypeScript" }) : null, _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M3 3V21H21V3H3ZM9 12H13.5V13.5H12V19.5H10.5V13.5H9V12ZM16.5 12H19.5V13.5H16.5V15H18C18.3975 15.0012 18.7783 15.1596 19.0593 15.4407C19.3404 15.7217 19.4988 16.1025 19.5 16.5V18C19.4988 18.3975 19.3404 18.7783 19.0593 19.0593C18.7783 19.3404 18.3975 19.4988 18 19.5H15V18H18V16.5H16.5C16.1025 16.4988 15.7217 16.3404 15.4407 16.0593C15.1596 15.7783 15.0012 15.3975 15 15V13.5C15.0012 13.1025 15.1596 12.7217 15.4407 12.4407C15.7217 12.1596 16.1025 12.0012 16.5 12Z", fill: "#0288D1" }) })] }));
|
|
7
|
-
}
|
|
8
|
-
if (language === 'javascript') {
|
|
9
|
-
return (_jsxs(_Fragment, { children: [showLabel ? _jsx(_Fragment, { children: "JavaScript" }) : null, _jsxs("svg", { width: size, height: size, viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [_jsx("g", { clipPath: "url(#clip0_42_2938)", children: _jsx("path", { d: "M0 0H20V20H0V0ZM18.3617 15.23C18.2158 14.3175 17.6217 13.5508 15.8592 12.8358C15.2458 12.5483 14.5642 12.3483 14.3617 11.8858C14.2858 11.6108 14.2742 11.4608 14.3233 11.2983C14.4483 10.76 15.0858 10.5983 15.5858 10.7483C15.9108 10.8483 16.2108 11.0983 16.3992 11.4983C17.2608 10.935 17.2608 10.935 17.8617 10.5608C17.6367 10.2108 17.525 10.06 17.3733 9.91083C16.8483 9.32333 16.1492 9.02333 15.0117 9.04917L14.4242 9.12333C13.8608 9.26083 13.3242 9.56083 12.9992 9.96083C12.0492 11.0367 12.3233 12.9117 13.4733 13.6867C14.6108 14.5367 16.2742 14.7233 16.4867 15.5242C16.6867 16.4992 15.7617 16.8117 14.8483 16.6992C14.1725 16.5492 13.7983 16.2108 13.3858 15.5858L11.8608 16.4617C12.0358 16.8617 12.2358 17.0358 12.5358 17.3858C13.9858 18.8492 17.6108 18.7742 18.2617 16.5492C18.2858 16.4742 18.4617 15.9617 18.3233 15.1742L18.3617 15.23ZM10.8758 9.1925H9.0025C9.0025 10.8075 8.995 12.4125 8.995 14.03C8.995 15.0567 9.0475 15.9992 8.88 16.2892C8.605 16.8633 7.89667 16.79 7.575 16.6892C7.245 16.5258 7.0775 16.3008 6.88333 15.9767C6.83083 15.8892 6.79167 15.8133 6.7775 15.8133L5.25667 16.7508C5.51083 17.2758 5.88167 17.7275 6.36 18.015C7.0725 18.44 8.03 18.5775 9.0325 18.3525C9.685 18.1642 10.2475 17.7767 10.5417 17.1767C10.9667 16.4017 10.8767 15.4517 10.8725 14.3883C10.8825 12.6767 10.8725 10.9642 10.8725 9.23917L10.8758 9.1925Z", fill: "white" }) }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_42_2938", children: _jsx("rect", { width: "20", height: "20", fill: "white" }) }) })] })] }));
|
|
10
|
-
}
|
|
11
|
-
if (language === 'python') {
|
|
12
|
-
return (_jsxs(_Fragment, { children: [showLabel ? _jsx(_Fragment, { children: "Python" }) : null, _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 24 24", fill: "none", children: [_jsx("path", { d: "M9.86 2C9.10148 2 8.37403 2.30132 7.83767 2.83767C7.30132 3.37403 7 4.10148 7 4.86V6.54H11.29C11.68 6.54 12 7.11 12 7.5H4.86C4.10148 7.5 3.37403 7.80132 2.83767 8.33767C2.30132 8.87403 2 9.60148 2 10.36V14.141C2 14.8995 2.30132 15.627 2.83767 16.1633C3.37403 16.6997 4.10148 17.001 4.86 17.001H6.04V14.321C6.03868 13.9459 6.11143 13.5742 6.25407 13.2273C6.3967 12.8803 6.60642 12.565 6.8712 12.2993C7.13598 12.0336 7.45061 11.8227 7.79704 11.6789C8.14347 11.535 8.51489 11.461 8.89 11.461H14.14C15.72 11.461 17 10.19 17 8.61V4.86C17 4.10148 16.6987 3.37403 16.1623 2.83767C15.626 2.30132 14.8985 2 14.14 2H9.86ZM9.14 3.61C9.54 3.61 9.86 3.73 9.86 4.32C9.86 4.91 9.54 5.211 9.14 5.211C8.75 5.211 8.43 4.911 8.43 4.321C8.43 3.731 8.75 3.61 9.14 3.61Z", fill: "#0288D1" }), _jsx("path", { d: "M17.959 7V9.68C17.9602 10.055 17.8873 10.4266 17.7446 10.7734C17.602 11.1202 17.3922 11.4355 17.1274 11.7011C16.8627 11.9667 16.5481 12.1774 16.2017 12.3212C15.8554 12.465 15.484 12.539 15.109 12.539H9.86C9.48489 12.5377 9.11321 12.6104 8.76628 12.7531C8.41935 12.8957 8.10399 13.1054 7.83828 13.3702C7.57257 13.635 7.36175 13.9496 7.2179 14.296C7.07405 14.6425 7 15.0139 7 15.389V19.139C7 19.8975 7.30132 20.625 7.83767 21.1613C8.37403 21.6977 9.10148 21.999 9.86 21.999H14.14C14.8983 21.999 15.6256 21.6978 16.162 21.1617C16.6983 20.6255 16.9997 19.8983 17 19.14V17.46H12.709C12.319 17.46 12 16.89 12 16.5H19.14C19.8985 16.5 20.626 16.1987 21.1623 15.6623C21.6987 15.126 22 14.3985 22 13.64V9.86C22 9.10148 21.6987 8.37403 21.1623 7.83767C20.626 7.30132 19.8985 7 19.14 7H17.959ZM8.32 11.513L8.316 11.517L8.354 11.513H8.32ZM14.86 18.789C15.25 18.789 15.57 19.089 15.57 19.679C15.57 19.7722 15.5516 19.8646 15.516 19.9507C15.4803 20.0368 15.428 20.1151 15.362 20.181C15.2961 20.247 15.2178 20.2993 15.1317 20.335C15.0456 20.3706 14.9532 20.389 14.86 20.389C14.46 20.389 14.14 20.269 14.14 19.679C14.14 19.089 14.46 18.789 14.86 18.789Z", fill: "#FDD835" })] })] }));
|
|
13
|
-
}
|
|
14
|
-
if (language === 'go') {
|
|
15
|
-
return (_jsxs(_Fragment, { children: [showLabel ? _jsx(_Fragment, { children: "Go" }) : null, _jsx("svg", { viewBox: "0 0 128 128", width: size, height: size, className: className, children: _jsx("path", { d: "M108.7 64.4c-1.6-1.2-3.8-1.9-6-1.9-.1-3.6-.2-7.2-.2-10.7-.1-9.5-.1-19.3-2.6-28.6 6.5-2.5 6.2-7.6 5.9-9.2-.7-3.8-4-7.9-9-7.9-1.9 0-3.9.6-5.8 1.9C83.4 1.6 73 .5 62.5.5 53 1.3 46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0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", className: className, children: [_jsx("g", { clipPath: "url(#clip0_42_2969)", children: _jsx("path", { d: "M16.7967 0.0691243C19.3242 0.506624 20.0408 2.23412 19.9875 4.04412L20 4.01829L18.8625 18.925L4.075 19.9383H4.08833C2.86083 19.8866 0.125 19.7741 0 15.9491L1.37083 13.4491L3.72 18.9375L4.13917 19.9141L6.47667 12.2941L6.45167 12.3L6.465 12.275L14.1775 14.7383L13.0142 10.2125L12.1892 6.96246L19.5392 6.48829L19.0267 6.06329L13.75 1.76162L16.7992 0.060791L16.7967 0.0691243ZM4.275 4.22746C7.2425 1.28329 11.0725 -0.456709 12.5433 1.02746C14.0117 2.50829 12.4558 6.11496 9.4825 9.05746C6.51333 12.0008 2.73 13.8358 1.2625 12.355C-0.209167 10.8741 1.3 7.17412 4.2725 4.22996L4.275 4.22746Z", fill: "white" }) }), _jsx("defs", { children: _jsx("clipPath", { id: "clip0_42_2969", children: _jsx("rect", { width: "20", height: "20", fill: "white" }) }) })] })] }));
|
|
19
|
-
}
|
|
20
|
-
if (language === 'php') {
|
|
21
|
-
return (_jsxs(_Fragment, { children: [showLabel ? _jsx(_Fragment, { children: "PHP" }) : null, _jsx("svg", { viewBox: "0 0 128 128", width: size, height: size, className: className, children: _jsx("path", { d: "M64 30.332C28.654 30.332 0 45.407 0 64s28.654 33.668 64 33.668c35.345 0 64-15.075 64-33.668S99.346 30.332 64 30.332zm-5.982 9.81h7.293v.003l-1.745 8.968h6.496c4.087 0 6.908.714 8.458 2.139 1.553 1.427 2.017 2.017 3.737 3.737 5.946 1.719 2.209-2.209 2.209-5.928 0-8.137zm-51.051 51.372c0-3.757-1.072-5.686-3.214-5.791a6.03 6.03 0 00-2.495.409c-.646.231-1.082.461-1.311.692v8.968c1.371.86 2.588 1.26 3.649 1.197 2.247-.148 3.371-1.971 3.371-5.475zm2.643.157c0 1.909-.447 3.493-1.348 4.753-1.003 1.427-2.394 2.16-4.172 2.201-1.34.043-2.721-.378-4.142-1.258v8.151l-2.298-.82V107.14c.377-.462.862-.859 1.451-1.196 1.368-.798 3.031-1.207 4.987-1.228l.033.032c1.788-.022 3.166.712 4.134 2.201.902 1.366 1.355 3.117 1.355 5.257zm14.049 5.349c0 2.56-.257 4.333-.77 5.318-.516.986-1.497 1.773-2.945 2.359-1.174.463-2.444.714-3.808.757l-.38-1.448c1.386-.188 2.362-.378 2.928-.566 1.114-.377 1.878-.955 2.298-1.73.337-.631.503-1.835.503-3.618v-.599a11.809 11.809 0 01-4.941 1.068c-1.132 0-2.13-.354-2.99-1.068-.966-.777-1.449-1.764-1.449-2.958v-9.566l2.299-.787v9.63c0 1.028.332 1.82.996 2.376s1.524.822 2.578.803c1.054-.022 2.183-.431 3.382-1.228v-11.234h2.299v12.491zm8.973 1.479a9.457 9.457 0 01-.757.032c-1.3 0-2.314-.309-3.038-.93-.722-.622-1.084-1.479-1.084-2.573v-9.054h-1.574v-1.446h1.574v-3.84l2.296-.817v4.657h2.583v1.446h-2.583v8.991c0 .862.231 1.474.694 1.83.397.295 1.029.463 1.889.506v1.198zm13.917-.189h-2.298v-8.873c0-.902-.211-1.68-.631-2.329-.485-.734-1.159-1.102-2.024-1.102-1.054 0-2.372.556-3.954 1.668v10.636h-2.298V97.637l2.298-.725v9.659c1.469-1.068 3.073-1.604 4.816-1.604 1.218 0 2.203.41 2.958 1.228.757.817 1.134 1.836 1.134 3.053v9.597h-.001zm12.218-7.157c0-1.444-.274-2.636-.82-3.579-.649-1.149-1.657-1.756-3.021-1.818-2.52.146-3.778 1.951-3.778 5.412 0 1.587.262 2.912.79 3.976.674 1.356 1.685 2.024 3.033 2.002 2.531-.02 3.796-2.017 3.796-5.993zm2.518.015c0 2.055-.526 3.765-1.575 5.131-1.154 1.528-2.749 2.296-4.783 2.296-2.017 0-3.589-.768-4.723-2.296-1.028-1.366-1.542-3.076-1.542-5.131 0-1.932.556-3.556 1.668-4.879 1.174-1.403 2.718-2.107 4.627-2.107 1.909 0 3.463.704 4.66 2.107 1.111 1.323 1.668 2.947 1.668 4.879zm13.178 7.142h-2.299v-9.376c0-1.028-.31-1.831-.928-2.409-.619-.576-1.443-.855-2.472-.833-1.091.021-2.13.378-3.116 1.069v11.549h-2.299v-11.833c1.323-.963 2.54-1.592 3.652-1.886 1.049-.274 1.974-.41 2.771-.41.545 0 1.059.053 1.542.158.903.209 1.637.596 2.203 1.164.631.629.946 1.384.946 2.267v10.54z" }) })] }));
|
|
22
|
-
}
|
|
23
|
-
return;
|
|
24
|
-
};
|
|
25
|
-
return (_jsx("div", { className: cn('text-muted-foreground', {
|
|
26
|
-
'text-sm flex items-center justify-center flex-row gap-2': showLabel,
|
|
27
|
-
'font-mono text-xs': !showLabel,
|
|
28
|
-
}), children: renderIcon(language) }));
|
|
29
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
-
import type React from 'react';
|
|
3
|
-
import type { PropsWithChildren } from 'react';
|
|
4
|
-
declare const baseIcon: (props?: ({
|
|
5
|
-
variant?: "event" | "api" | "noop" | "cron" | null | undefined;
|
|
6
|
-
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
-
type Props = PropsWithChildren<{
|
|
8
|
-
text: string;
|
|
9
|
-
variant: VariantProps<typeof baseIcon>['variant'];
|
|
10
|
-
className?: string;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const NodeHeader: React.FC<Props>;
|
|
13
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '@motiadev/ui';
|
|
3
|
-
import { cva } from 'class-variance-authority';
|
|
4
|
-
import { CalendarClock, CircleOff, Link2, Waypoints } from 'lucide-react';
|
|
5
|
-
const baseIcon = cva('rounded-md p-2', {
|
|
6
|
-
variants: {
|
|
7
|
-
variant: {
|
|
8
|
-
event: 'bg-[rgba(30,118,231,0.2)] text-[rgb(30,118,231)]',
|
|
9
|
-
api: 'dark:bg-[rgba(192,255,17,0.2)] dark:text-[rgb(192,255,17)] bg-[rgb(231,255,166)] text-[rgb(94,125,11)]',
|
|
10
|
-
noop: 'bg-[rgba(239,18,229,0.2)] text-[rgb(239,18,229)]',
|
|
11
|
-
cron: 'bg-[rgba(241,105,15,0.2)] text-[rgb(241,105,15)]',
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
const NodeIcon = ({ variant }) => {
|
|
16
|
-
if (variant === 'cron') {
|
|
17
|
-
return _jsx(CalendarClock, { className: "w-5 h-5" });
|
|
18
|
-
}
|
|
19
|
-
else if (variant === 'api') {
|
|
20
|
-
return _jsx(Link2, { className: "w-5 h-5" });
|
|
21
|
-
}
|
|
22
|
-
else if (variant === 'noop') {
|
|
23
|
-
return _jsx(CircleOff, { className: "w-5 h-5" });
|
|
24
|
-
}
|
|
25
|
-
else if (variant === 'event') {
|
|
26
|
-
return _jsx(Waypoints, { className: "w-5 h-5" });
|
|
27
|
-
}
|
|
28
|
-
return _jsx("div", { className: cn(baseIcon({ variant })), children: "Icon" });
|
|
29
|
-
};
|
|
30
|
-
export const NodeHeader = ({ text, variant, children, className }) => (_jsxs("div", { className: cn('flex items-center gap-2 p-2', className), children: [_jsx("div", { className: baseIcon({ variant }), children: _jsx(NodeIcon, { variant: variant }) }), _jsxs("div", { className: "flex flex-1 justify-between items-start gap-4", children: [_jsx("div", { className: "flex flex-col", children: _jsx("div", { className: "text-sm font-semibold leading-[1.25] tracking-[-0.25px]", children: text }) }), children] })] }));
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import type { Feature } from '@/types/file';
|
|
3
|
-
type NodeSidebarProps = {
|
|
4
|
-
content: string;
|
|
5
|
-
features: Feature[];
|
|
6
|
-
title: string;
|
|
7
|
-
subtitle?: string;
|
|
8
|
-
variant: 'event' | 'api' | 'noop' | 'cron';
|
|
9
|
-
language?: string;
|
|
10
|
-
isOpen: boolean;
|
|
11
|
-
onClose: () => void;
|
|
12
|
-
};
|
|
13
|
-
export declare const NodeSidebar: React.FC<NodeSidebarProps>;
|
|
14
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Sidebar } from '@motiadev/ui';
|
|
3
|
-
import { X } from 'lucide-react';
|
|
4
|
-
import { CodeDisplay } from './code-display';
|
|
5
|
-
export const NodeSidebar = ({ content, title, subtitle, language, isOpen, onClose, features, }) => {
|
|
6
|
-
if (!isOpen)
|
|
7
|
-
return null;
|
|
8
|
-
return (_jsx(Sidebar, { title: title, subtitle: subtitle, initialWidth: 900, contentClassName: "p-0 h-full gap-0", onClose: onClose, actions: [{ icon: _jsx(X, {}), onClick: onClose, label: 'Close' }], children: _jsx(CodeDisplay, { code: content, language: language, features: features }) }));
|
|
9
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
export const Subscribe = ({ subscribes }) => {
|
|
3
|
-
return (_jsx("div", { className: "flex flex-col gap-2", children: subscribes.map((subscribe) => (_jsx("div", { "data-testid": `subscribes__${subscribe}`, children: subscribe }, subscribe))) }));
|
|
4
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Clock } from 'lucide-react';
|
|
3
|
-
import { BaseNode } from './base-node/base-node';
|
|
4
|
-
export const CronNode = ({ data, children }) => {
|
|
5
|
-
return (_jsxs(BaseNode, { data: data, variant: "cron", title: data.name, subtitle: data.description, language: data.language, disableTargetHandle: !data.virtualSubscribes?.length, disableSourceHandle: !data.virtualEmits?.length && !data.emits?.length, children: [_jsxs("div", { className: "text-xs text-muted-foreground flex items-center gap-2", children: [_jsx(Clock, { className: "w-3 h-3" }), " ", data.cronExpression] }), children] }));
|
|
6
|
-
};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BaseNode } from './base-node/base-node';
|
|
3
|
-
export const EventNode = ({ data, children }) => {
|
|
4
|
-
return (_jsx(BaseNode, { data: data, variant: "event", title: data.name, subtitle: data.description, language: data.language, disableSourceHandle: !data.emits?.length && !data.virtualEmits?.length, disableTargetHandle: !data.subscribes?.length && !data.virtualSubscribes?.length, children: children }));
|
|
5
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { ApiNodeData, CronNodeData, EventNodeData, NoopNodeData } from '../types/flow';
|
|
2
|
-
export type NodeProps = EventNodeProps | NoopNodeProps | ApiNodeProps | CronNodeProps;
|
|
3
|
-
export type BaseNodeProps = {
|
|
4
|
-
id: string;
|
|
5
|
-
nodeConfig?: {
|
|
6
|
-
sourceHandlePosition?: 'bottom' | 'right';
|
|
7
|
-
targetHandlePosition?: 'top' | 'left';
|
|
8
|
-
};
|
|
9
|
-
};
|
|
10
|
-
export type EventNodeProps = {
|
|
11
|
-
data: BaseNodeProps & EventNodeData;
|
|
12
|
-
};
|
|
13
|
-
export type NoopNodeProps = {
|
|
14
|
-
data: BaseNodeProps & NoopNodeData;
|
|
15
|
-
};
|
|
16
|
-
export type ApiNodeProps = {
|
|
17
|
-
data: BaseNodeProps & ApiNodeData;
|
|
18
|
-
};
|
|
19
|
-
export type CronNodeProps = {
|
|
20
|
-
data: BaseNodeProps & CronNodeData;
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { BaseNode } from './base-node/base-node';
|
|
3
|
-
export const NoopNode = ({ data, children }) => {
|
|
4
|
-
return (_jsx(BaseNode, { data: data, variant: "noop", title: data.name, subtitle: data.description, disableSourceHandle: !data.virtualEmits.length, disableTargetHandle: !data.subscribes?.length, children: children }));
|
|
5
|
-
};
|
package/dist/src/setupTests.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
package/dist/src/setupTests.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import '@testing-library/jest-dom';
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export declare enum TabLocation {
|
|
2
|
-
TOP = "top",
|
|
3
|
-
BOTTOM = "bottom"
|
|
4
|
-
}
|
|
5
|
-
export type AppTab = {
|
|
6
|
-
id: string;
|
|
7
|
-
tabLabel: React.ElementType;
|
|
8
|
-
content: React.ElementType;
|
|
9
|
-
};
|
|
10
|
-
export interface AppTabsState {
|
|
11
|
-
tabs: Record<TabLocation, AppTab[]>;
|
|
12
|
-
addTab: (position: TabLocation, tab: AppTab) => void;
|
|
13
|
-
setTabs: (position: TabLocation, tabs: AppTab[]) => void;
|
|
14
|
-
removeTab: (position: TabLocation, id: string) => void;
|
|
15
|
-
}
|
|
16
|
-
export declare const useAppTabsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AppTabsState>>;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand';
|
|
2
|
-
export var TabLocation;
|
|
3
|
-
(function (TabLocation) {
|
|
4
|
-
TabLocation["TOP"] = "top";
|
|
5
|
-
TabLocation["BOTTOM"] = "bottom";
|
|
6
|
-
})(TabLocation || (TabLocation = {}));
|
|
7
|
-
const defaultTabs = {
|
|
8
|
-
[TabLocation.TOP]: [],
|
|
9
|
-
[TabLocation.BOTTOM]: [],
|
|
10
|
-
};
|
|
11
|
-
export const useAppTabsStore = create((set) => ({
|
|
12
|
-
tabs: defaultTabs,
|
|
13
|
-
addTab: (position, tab) => set((state) => ({
|
|
14
|
-
tabs: {
|
|
15
|
-
...state.tabs,
|
|
16
|
-
[position]: [...state.tabs[position], tab],
|
|
17
|
-
},
|
|
18
|
-
})),
|
|
19
|
-
setTabs: (position, tabs) => set((state) => ({
|
|
20
|
-
tabs: {
|
|
21
|
-
...state.tabs,
|
|
22
|
-
[position]: tabs,
|
|
23
|
-
},
|
|
24
|
-
})),
|
|
25
|
-
removeTab: (position, id) => set((state) => ({
|
|
26
|
-
tabs: {
|
|
27
|
-
...state.tabs,
|
|
28
|
-
[position]: state.tabs[position].filter((tab) => tab.id !== id),
|
|
29
|
-
},
|
|
30
|
-
})),
|
|
31
|
-
}));
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
type UseFlowStore = {
|
|
2
|
-
selectedFlowId?: string;
|
|
3
|
-
selectFlowId: (flowId: string) => void;
|
|
4
|
-
clearSelectedFlowId: () => void;
|
|
5
|
-
flows: string[];
|
|
6
|
-
setFlows: (flows: string[]) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare const useFlowStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<UseFlowStore>, "setState" | "persist"> & {
|
|
9
|
-
setState(partial: UseFlowStore | Partial<UseFlowStore> | ((state: UseFlowStore) => UseFlowStore | Partial<UseFlowStore>), replace?: false | undefined): unknown;
|
|
10
|
-
setState(state: UseFlowStore | ((state: UseFlowStore) => UseFlowStore), replace: true): unknown;
|
|
11
|
-
persist: {
|
|
12
|
-
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<UseFlowStore, UseFlowStore, unknown>>) => void;
|
|
13
|
-
clearStorage: () => void;
|
|
14
|
-
rehydrate: () => Promise<void> | void;
|
|
15
|
-
hasHydrated: () => boolean;
|
|
16
|
-
onHydrate: (fn: (state: UseFlowStore) => void) => () => void;
|
|
17
|
-
onFinishHydration: (fn: (state: UseFlowStore) => void) => () => void;
|
|
18
|
-
getOptions: () => Partial<import("zustand/middleware").PersistOptions<UseFlowStore, UseFlowStore, unknown>>;
|
|
19
|
-
};
|
|
20
|
-
}>;
|
|
21
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand';
|
|
2
|
-
import { createJSONStorage, persist } from 'zustand/middleware';
|
|
3
|
-
export const useFlowStore = create(persist((set) => ({
|
|
4
|
-
flows: [],
|
|
5
|
-
setFlows: (flows) => set({ flows }),
|
|
6
|
-
selectFlowId: (flowId) => set((state) => {
|
|
7
|
-
if (state.selectedFlowId === flowId) {
|
|
8
|
-
return state;
|
|
9
|
-
}
|
|
10
|
-
return { selectedFlowId: flowId };
|
|
11
|
-
}),
|
|
12
|
-
clearSelectedFlowId: () => set({ selectedFlowId: undefined }),
|
|
13
|
-
}), {
|
|
14
|
-
name: 'motia-flow-storage',
|
|
15
|
-
storage: createJSONStorage(() => localStorage),
|
|
16
|
-
}));
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
type UseGlobalStore = {
|
|
2
|
-
selectedEndpointId?: string;
|
|
3
|
-
selectEndpointId: (endpointId?: string) => void;
|
|
4
|
-
};
|
|
5
|
-
export declare const useGlobalStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<UseGlobalStore>, "setState" | "persist"> & {
|
|
6
|
-
setState(partial: UseGlobalStore | Partial<UseGlobalStore> | ((state: UseGlobalStore) => UseGlobalStore | Partial<UseGlobalStore>), replace?: false | undefined): unknown;
|
|
7
|
-
setState(state: UseGlobalStore | ((state: UseGlobalStore) => UseGlobalStore), replace: true): unknown;
|
|
8
|
-
persist: {
|
|
9
|
-
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<UseGlobalStore, UseGlobalStore, unknown>>) => void;
|
|
10
|
-
clearStorage: () => void;
|
|
11
|
-
rehydrate: () => Promise<void> | void;
|
|
12
|
-
hasHydrated: () => boolean;
|
|
13
|
-
onHydrate: (fn: (state: UseGlobalStore) => void) => () => void;
|
|
14
|
-
onFinishHydration: (fn: (state: UseGlobalStore) => void) => () => void;
|
|
15
|
-
getOptions: () => Partial<import("zustand/middleware").PersistOptions<UseGlobalStore, UseGlobalStore, unknown>>;
|
|
16
|
-
};
|
|
17
|
-
}>;
|
|
18
|
-
export {};
|