@motiadev/workbench 0.8.2-beta.140-930160 → 0.8.2-beta.140-504654
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/src/App.js +18 -16
- package/dist/src/lib/plugins.d.ts +2 -1
- package/dist/src/lib/plugins.js +3 -3
- package/dist/src/stores/use-app-tabs-store.d.ts +0 -2
- package/dist/src/stores/use-app-tabs-store.js +0 -6
- package/dist/tsconfig.app.tsbuildinfo +1 -1
- package/dist/tsconfig.node.tsbuildinfo +1 -1
- package/package.json +4 -4
package/dist/src/App.js
CHANGED
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from 'react';
|
|
2
|
+
import { useEffect, useMemo } from 'react';
|
|
3
3
|
import { FlowPage } from './components/flow/flow-page';
|
|
4
4
|
import { FlowTabMenuItem } from './components/flow/flow-tab-menu-item';
|
|
5
5
|
import { registerPluginTabs } from './lib/plugins';
|
|
6
6
|
import { getViewModeFromURL } from './lib/utils';
|
|
7
7
|
import { ProjectViewMode } from './project-view-mode';
|
|
8
|
-
import {
|
|
8
|
+
import { TabLocation, useAppTabsStore } from './stores/use-app-tabs-store';
|
|
9
9
|
import { SystemViewMode } from './system-view-mode';
|
|
10
10
|
const TAB_IDS = {
|
|
11
11
|
FLOW: 'flow',
|
|
12
12
|
LOGS: 'logs',
|
|
13
13
|
};
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
];
|
|
22
|
-
const bottomTabs = [];
|
|
23
|
-
setAppTabs(TabLocation.TOP, topTabs);
|
|
24
|
-
setAppTabs(TabLocation.BOTTOM, bottomTabs);
|
|
25
|
-
};
|
|
26
|
-
registerDefaultTabs();
|
|
27
|
-
registerPluginTabs();
|
|
14
|
+
const topTabs = [
|
|
15
|
+
{
|
|
16
|
+
id: TAB_IDS.FLOW,
|
|
17
|
+
tabLabel: FlowTabMenuItem,
|
|
18
|
+
content: FlowPage,
|
|
19
|
+
},
|
|
20
|
+
];
|
|
28
21
|
export const App = () => {
|
|
22
|
+
const setTabs = useAppTabsStore((state) => state.setTabs);
|
|
23
|
+
const addTab = useAppTabsStore((state) => state.addTab);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const timeout = setTimeout(() => {
|
|
26
|
+
setTabs(TabLocation.TOP, topTabs);
|
|
27
|
+
registerPluginTabs(addTab);
|
|
28
|
+
}, 10);
|
|
29
|
+
return () => clearTimeout(timeout);
|
|
30
|
+
}, [setTabs, addTab]);
|
|
29
31
|
const viewMode = useMemo(getViewModeFromURL, []);
|
|
30
32
|
const ViewComponent = viewMode === 'project' ? ProjectViewMode : SystemViewMode;
|
|
31
33
|
return _jsx(ViewComponent, {});
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { type AppTab, TabLocation } from '@/stores/use-app-tabs-store';
|
|
2
|
+
export declare const registerPluginTabs: (addTab: (position: TabLocation, tab: AppTab) => void) => void;
|
package/dist/src/lib/plugins.js
CHANGED
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { plugins } from 'virtual:motia-plugins';
|
|
3
3
|
import { DynamicIcon, dynamicIconImports } from 'lucide-react/dynamic';
|
|
4
4
|
import { memo } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { TabLocation } from '@/stores/use-app-tabs-store';
|
|
6
6
|
import { isValidTabLocation } from './utils';
|
|
7
|
-
export const registerPluginTabs = () => {
|
|
7
|
+
export const registerPluginTabs = (addTab) => {
|
|
8
8
|
if (!Array.isArray(plugins)) {
|
|
9
9
|
console.warn('[Motia] Invalid plugins configuration: expected array');
|
|
10
10
|
return;
|
|
@@ -42,7 +42,7 @@ export const registerPluginTabs = () => {
|
|
|
42
42
|
return _jsx(Component, { ...props });
|
|
43
43
|
});
|
|
44
44
|
PluginContent.displayName = `${plugin.label}Content`;
|
|
45
|
-
|
|
45
|
+
addTab(tabLocation, {
|
|
46
46
|
id: plugin.label.toLowerCase(),
|
|
47
47
|
tabLabel: PluginTabLabel,
|
|
48
48
|
content: PluginContent,
|
|
@@ -14,5 +14,3 @@ export interface AppTabsState {
|
|
|
14
14
|
removeTab: (position: TabLocation, id: string) => void;
|
|
15
15
|
}
|
|
16
16
|
export declare const useAppTabsStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AppTabsState>>;
|
|
17
|
-
export declare const setAppTabs: (position: TabLocation, tabs: AppTab[]) => void;
|
|
18
|
-
export declare const addAppTab: (position: TabLocation, tab: AppTab) => void;
|
|
@@ -29,9 +29,3 @@ export const useAppTabsStore = create((set) => ({
|
|
|
29
29
|
},
|
|
30
30
|
})),
|
|
31
31
|
}));
|
|
32
|
-
export const setAppTabs = (position, tabs) => {
|
|
33
|
-
useAppTabsStore.getState().setTabs(position, tabs);
|
|
34
|
-
};
|
|
35
|
-
export const addAppTab = (position, tab) => {
|
|
36
|
-
useAppTabsStore.getState().addTab(position, tab);
|
|
37
|
-
};
|