@rozenite/vite-plugin 2.0.0 → 2.2.0
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/bundle-dts.d.ts.map +1 -1
- package/dist/client-plugin.d.ts.map +1 -1
- package/dist/dev-config-module.d.ts.map +1 -1
- package/dist/dev-host/assets/index-B0yO0ie2.css +1 -0
- package/dist/dev-host/assets/index-zhOD0ia6.js +13 -0
- package/dist/dev-host/index.html +2 -2
- package/dist/dev-host/manifest.json +2 -2
- package/dist/index.cjs +21 -66
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -66
- package/dist/load-config.d.ts.map +1 -1
- package/dist/package-json.d.ts.map +1 -1
- package/dist/react-native-plugin.d.ts.map +1 -1
- package/dist/require-plugin.d.ts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/package.json +25 -25
- package/src/bundle-dts.ts +3 -12
- package/src/client-plugin.ts +9 -34
- package/src/dev-config-module.ts +1 -4
- package/src/dev-host/App.tsx +20 -56
- package/src/dev-host/components/DispatchForm.tsx +11 -28
- package/src/dev-host/components/FlowList.tsx +14 -12
- package/src/dev-host/components/MessageDetailsPane.tsx +12 -20
- package/src/dev-host/components/MessageLogPane.tsx +9 -19
- package/src/dev-host/components/PanelTabs.tsx +3 -13
- package/src/dev-host/config.ts +2 -6
- package/src/dev-host/flow-runtime.ts +6 -24
- package/src/dev-host/server.ts +3 -9
- package/src/dev-host/styles.css +2 -2
- package/src/dev-host/types.ts +1 -5
- package/src/dev-host/utils.ts +3 -12
- package/src/index.ts +4 -14
- package/src/load-config.ts +9 -20
- package/src/package-json.ts +1 -3
- package/src/react-native-plugin.ts +1 -2
- package/src/require-plugin.ts +6 -18
- package/src/utils.ts +1 -4
- package/dist/dev-host/assets/index-DU3zXL2c.css +0 -1
- package/dist/dev-host/assets/index-Xsb6uYhI.js +0 -13
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,yBAAyB,GAAI,WAAW,MAAM,EAAE,UAAU,MAAM,KAAG,MAAM,GAAG,IAYxF,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,CAAC,EAAE,IAAI,MAAM,CAAC,KAAG,CAAC,MAAM,CAAC,CAU7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,35 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rozenite/vite-plugin",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Vite plugin for developing React Native DevTools plugins with hot reload and development tools",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./dist/index.cjs",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"files": [
|
|
10
|
-
"dist",
|
|
11
|
-
"src",
|
|
12
|
-
"templates"
|
|
13
|
-
],
|
|
14
5
|
"keywords": [
|
|
15
|
-
"react-native",
|
|
16
6
|
"devtools",
|
|
17
|
-
"
|
|
18
|
-
"
|
|
7
|
+
"plugin",
|
|
8
|
+
"react-native",
|
|
9
|
+
"vite"
|
|
19
10
|
],
|
|
20
11
|
"homepage": "https://github.com/callstackincubator/rozenite#readme",
|
|
21
12
|
"bugs": {
|
|
22
13
|
"url": "https://github.com/callstackincubator/rozenite/issues"
|
|
23
14
|
},
|
|
15
|
+
"license": "MIT",
|
|
16
|
+
"author": "Szymon Chmal <szymon.chmal@callstack.com>",
|
|
24
17
|
"repository": {
|
|
25
18
|
"type": "git",
|
|
26
19
|
"url": "https://github.com/callstackincubator/rozenite.git"
|
|
27
20
|
},
|
|
28
|
-
"
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
21
|
+
"files": [
|
|
22
|
+
"dist",
|
|
23
|
+
"src",
|
|
24
|
+
"templates"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "./dist/index.cjs",
|
|
28
|
+
"module": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
33
30
|
"exports": {
|
|
34
31
|
"./package.json": "./package.json",
|
|
35
32
|
".": {
|
|
@@ -39,20 +36,18 @@
|
|
|
39
36
|
"default": "./dist/index.cjs"
|
|
40
37
|
}
|
|
41
38
|
},
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@microsoft/api-extractor": "^7.50.1",
|
|
44
44
|
"@tailwindcss/vite": "4.2.2",
|
|
45
45
|
"@vitejs/plugin-react": "^4.3.4",
|
|
46
46
|
"ejs": "^3.1.9",
|
|
47
|
+
"lucide-react": "^0.263.1",
|
|
47
48
|
"vite-plugin-dts": "~4.5.0",
|
|
48
49
|
"vite-plugin-react-native-web": "^2.1.1",
|
|
49
|
-
"
|
|
50
|
-
"@rozenite/ui": "2.0.0"
|
|
51
|
-
},
|
|
52
|
-
"peerDependencies": {
|
|
53
|
-
"react": "*",
|
|
54
|
-
"react-dom": "*",
|
|
55
|
-
"vite": "^7.3.1"
|
|
50
|
+
"@rozenite/ui": "2.2.0"
|
|
56
51
|
},
|
|
57
52
|
"devDependencies": {
|
|
58
53
|
"@types/ejs": "^3.1.5",
|
|
@@ -61,6 +56,11 @@
|
|
|
61
56
|
"react": "19.2.3",
|
|
62
57
|
"react-dom": "19.2.3"
|
|
63
58
|
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"react": "*",
|
|
61
|
+
"react-dom": "*",
|
|
62
|
+
"vite": "^7.3.1"
|
|
63
|
+
},
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=20"
|
|
66
66
|
},
|
package/src/bundle-dts.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
Extractor,
|
|
5
|
-
ExtractorConfig,
|
|
6
|
-
ExtractorLogLevel,
|
|
7
|
-
} from '@microsoft/api-extractor';
|
|
3
|
+
import { Extractor, ExtractorConfig, ExtractorLogLevel } from '@microsoft/api-extractor';
|
|
8
4
|
|
|
9
5
|
type Target = 'react-native' | 'metro' | 'sdk';
|
|
10
6
|
|
|
@@ -37,16 +33,11 @@ export const normalizeRolledUpDeclarations = (content: string) => {
|
|
|
37
33
|
);
|
|
38
34
|
};
|
|
39
35
|
|
|
40
|
-
export const bundleTargetDeclarations = async (
|
|
41
|
-
projectRoot: string,
|
|
42
|
-
target: Target,
|
|
43
|
-
) => {
|
|
36
|
+
export const bundleTargetDeclarations = async (projectRoot: string, target: Target) => {
|
|
44
37
|
const targetRoot = path.join(projectRoot, 'dist', target);
|
|
45
38
|
const publicEntryPath = path.join(targetRoot, 'index.d.ts');
|
|
46
39
|
const bundleEntryPath =
|
|
47
|
-
target === 'sdk'
|
|
48
|
-
? path.join(targetRoot, `${target}.d.ts`)
|
|
49
|
-
: publicEntryPath;
|
|
40
|
+
target === 'sdk' ? path.join(targetRoot, `${target}.d.ts`) : publicEntryPath;
|
|
50
41
|
const entryPath = await fs
|
|
51
42
|
.access(bundleEntryPath)
|
|
52
43
|
.then(() => bundleEntryPath)
|
package/src/client-plugin.ts
CHANGED
|
@@ -7,10 +7,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
7
7
|
import { normalizePath } from 'vite';
|
|
8
8
|
import { loadConfig, RozeniteConfig } from './load-config.js';
|
|
9
9
|
import { getPackageJSON } from './package-json.js';
|
|
10
|
-
import {
|
|
11
|
-
DEV_HOST_CONFIG_GLOBAL_KEY,
|
|
12
|
-
DEV_HOST_STATE_ELEMENT_ID,
|
|
13
|
-
} from './dev-host/constants.js';
|
|
10
|
+
import { DEV_HOST_CONFIG_GLOBAL_KEY, DEV_HOST_STATE_ELEMENT_ID } from './dev-host/constants.js';
|
|
14
11
|
import {
|
|
15
12
|
getBuiltDevHostAssets,
|
|
16
13
|
getDevHostHtmlTemplate,
|
|
@@ -46,12 +43,7 @@ type DevHostState = {
|
|
|
46
43
|
panels: DevHostPanelEntry[];
|
|
47
44
|
};
|
|
48
45
|
|
|
49
|
-
const TEMPLATES_DIR = path.resolve(
|
|
50
|
-
fileURLToPath(import.meta.url),
|
|
51
|
-
'..',
|
|
52
|
-
'..',
|
|
53
|
-
'templates',
|
|
54
|
-
);
|
|
46
|
+
const TEMPLATES_DIR = path.resolve(fileURLToPath(import.meta.url), '..', '..', 'templates');
|
|
55
47
|
|
|
56
48
|
const PACKAGE_DIR = path.resolve(fileURLToPath(import.meta.url), '..', '..');
|
|
57
49
|
|
|
@@ -178,9 +170,7 @@ export const rozeniteClientPlugin = (): Plugin => {
|
|
|
178
170
|
|
|
179
171
|
config.server ??= {};
|
|
180
172
|
config.server.open =
|
|
181
|
-
config.server.open === true
|
|
182
|
-
? DEV_HOST_ROUTE
|
|
183
|
-
: (config.server.open ?? DEV_HOST_ROUTE);
|
|
173
|
+
config.server.open === true ? DEV_HOST_ROUTE : (config.server.open ?? DEV_HOST_ROUTE);
|
|
184
174
|
// Keep in sync with `DEV_SERVER_URL` in packages/runtime/src/dev-mode.ts
|
|
185
175
|
config.server.port = 8888;
|
|
186
176
|
|
|
@@ -192,10 +182,7 @@ export const rozeniteClientPlugin = (): Plugin => {
|
|
|
192
182
|
config.build.rollupOptions.input = {
|
|
193
183
|
...(config.build.rollupOptions.input as Record<string, string>),
|
|
194
184
|
...Object.fromEntries(
|
|
195
|
-
panels.map((panel) => [
|
|
196
|
-
panel.name,
|
|
197
|
-
`${DEVTOOLS_DIR}/${panel.htmlFile}`,
|
|
198
|
-
]),
|
|
185
|
+
panels.map((panel) => [panel.name, `${DEVTOOLS_DIR}/${panel.htmlFile}`]),
|
|
199
186
|
),
|
|
200
187
|
};
|
|
201
188
|
config.build.rollupOptions.output = {
|
|
@@ -213,9 +200,7 @@ export const rozeniteClientPlugin = (): Plugin => {
|
|
|
213
200
|
return devConfigModuleId;
|
|
214
201
|
}
|
|
215
202
|
|
|
216
|
-
const isPanel = getPanels().some(
|
|
217
|
-
(panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id,
|
|
218
|
-
);
|
|
203
|
+
const isPanel = getPanels().some((panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id);
|
|
219
204
|
|
|
220
205
|
if (isPanel) {
|
|
221
206
|
return id;
|
|
@@ -231,9 +216,7 @@ export const rozeniteClientPlugin = (): Plugin => {
|
|
|
231
216
|
return devConfigModule;
|
|
232
217
|
}
|
|
233
218
|
|
|
234
|
-
const panel = getPanels().find(
|
|
235
|
-
(panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id,
|
|
236
|
-
);
|
|
219
|
+
const panel = getPanels().find((panel) => `${DEVTOOLS_DIR}/${panel.htmlFile}` === id);
|
|
237
220
|
|
|
238
221
|
if (panel) {
|
|
239
222
|
return generatePanelHtmlContent(panel);
|
|
@@ -287,14 +270,8 @@ export const rozeniteClientPlugin = (): Plugin => {
|
|
|
287
270
|
|
|
288
271
|
server.middlewares.use((req, res, next) => {
|
|
289
272
|
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
290
|
-
res.setHeader(
|
|
291
|
-
|
|
292
|
-
'GET, POST, PUT, DELETE, OPTIONS',
|
|
293
|
-
);
|
|
294
|
-
res.setHeader(
|
|
295
|
-
'Access-Control-Allow-Headers',
|
|
296
|
-
'Content-Type, Authorization',
|
|
297
|
-
);
|
|
273
|
+
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
|
|
274
|
+
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
|
298
275
|
|
|
299
276
|
if (req.method === 'OPTIONS') {
|
|
300
277
|
res.statusCode = 200;
|
|
@@ -336,9 +313,7 @@ export const rozeniteClientPlugin = (): Plugin => {
|
|
|
336
313
|
return;
|
|
337
314
|
}
|
|
338
315
|
|
|
339
|
-
const panel = panels.find(
|
|
340
|
-
(panel) => `/${DEVTOOLS_DIR}/` + panel.htmlFile === url,
|
|
341
|
-
);
|
|
316
|
+
const panel = panels.find((panel) => `/${DEVTOOLS_DIR}/` + panel.htmlFile === url);
|
|
342
317
|
|
|
343
318
|
if (panel) {
|
|
344
319
|
const htmlContent = generatePanelHtmlContent(panel);
|
package/src/dev-config-module.ts
CHANGED
|
@@ -18,10 +18,7 @@ export const resolveRozeniteDevConfigModuleId = (id: string) => {
|
|
|
18
18
|
return null;
|
|
19
19
|
};
|
|
20
20
|
|
|
21
|
-
export const loadRozeniteDevConfigModule = (
|
|
22
|
-
id: string,
|
|
23
|
-
projectRoot: string,
|
|
24
|
-
) => {
|
|
21
|
+
export const loadRozeniteDevConfigModule = (id: string, projectRoot: string) => {
|
|
25
22
|
if (id !== RESOLVED_ROZENITE_DEV_CONFIG_MODULE_ID) {
|
|
26
23
|
return null;
|
|
27
24
|
}
|
package/src/dev-host/App.tsx
CHANGED
|
@@ -31,9 +31,7 @@ type AppProps = DevHostState & {
|
|
|
31
31
|
type MobileDevtoolsTab = 'log' | 'actions';
|
|
32
32
|
|
|
33
33
|
const useNarrowViewport = () => {
|
|
34
|
-
const [isNarrow, setIsNarrow] = useState(
|
|
35
|
-
() => window.matchMedia('(max-width: 960px)').matches,
|
|
36
|
-
);
|
|
34
|
+
const [isNarrow, setIsNarrow] = useState(() => window.matchMedia('(max-width: 960px)').matches);
|
|
37
35
|
|
|
38
36
|
useEffect(() => {
|
|
39
37
|
const mediaQuery = window.matchMedia('(max-width: 960px)');
|
|
@@ -50,50 +48,34 @@ const useNarrowViewport = () => {
|
|
|
50
48
|
return isNarrow;
|
|
51
49
|
};
|
|
52
50
|
|
|
53
|
-
export const App = ({
|
|
54
|
-
packageName,
|
|
55
|
-
packageDescription,
|
|
56
|
-
panels,
|
|
57
|
-
flows,
|
|
58
|
-
presets,
|
|
59
|
-
}: AppProps) => {
|
|
51
|
+
export const App = ({ packageName, packageDescription, panels, flows, presets }: AppProps) => {
|
|
60
52
|
const [activePanel, setActivePanel] = useState<DevHostPanelEntry | null>(() =>
|
|
61
53
|
getInitialPanel(panels),
|
|
62
54
|
);
|
|
63
55
|
const [commandType, setCommandType] = useState('');
|
|
64
56
|
const [commandPayload, setCommandPayload] = useState('');
|
|
65
57
|
const [messages, setMessages] = useState<MessageEntry[]>([]);
|
|
66
|
-
const [selectedMessageId, setSelectedMessageId] = useState<string | null>(
|
|
67
|
-
null,
|
|
68
|
-
);
|
|
58
|
+
const [selectedMessageId, setSelectedMessageId] = useState<string | null>(null);
|
|
69
59
|
const [isDetailsOpen, setIsDetailsOpen] = useState(false);
|
|
70
|
-
const [activeMobileTab, setActiveMobileTab] =
|
|
71
|
-
useState<MobileDevtoolsTab>('log');
|
|
60
|
+
const [activeMobileTab, setActiveMobileTab] = useState<MobileDevtoolsTab>('log');
|
|
72
61
|
const [iframeLoadNonce, setIframeLoadNonce] = useState(0);
|
|
73
62
|
const iframeRef = useRef<HTMLIFrameElement | null>(null);
|
|
74
63
|
const lastAutoRunLoadRef = useRef(0);
|
|
75
64
|
const isNarrowViewport = useNarrowViewport();
|
|
76
|
-
const {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{ pluginId: packageName, type, payload },
|
|
87
|
-
'*',
|
|
88
|
-
);
|
|
89
|
-
appendMessage({ direction: 'in', type, payload });
|
|
90
|
-
},
|
|
91
|
-
});
|
|
65
|
+
const { flowRuns, runFlow, stopFlow, hasRunningFlow, registerMessage, resetMessages } =
|
|
66
|
+
useFlowRunner({
|
|
67
|
+
sendMessage: (type, payload) => {
|
|
68
|
+
iframeRef.current?.contentWindow?.postMessage(
|
|
69
|
+
{ pluginId: packageName, type, payload },
|
|
70
|
+
'*',
|
|
71
|
+
);
|
|
72
|
+
appendMessage({ direction: 'in', type, payload });
|
|
73
|
+
},
|
|
74
|
+
});
|
|
92
75
|
|
|
93
76
|
const activeSource = activePanel?.source ?? '';
|
|
94
77
|
const activeLabel = activePanel?.label ?? '';
|
|
95
|
-
const selectedMessage =
|
|
96
|
-
messages.find((message) => message.id === selectedMessageId) ?? null;
|
|
78
|
+
const selectedMessage = messages.find((message) => message.id === selectedMessageId) ?? null;
|
|
97
79
|
const panelDescription = packageDescription.trim();
|
|
98
80
|
const trimmedCommandType = commandType.trim();
|
|
99
81
|
const trimmedCommandPayload = commandPayload.trim();
|
|
@@ -266,10 +248,7 @@ export const App = ({
|
|
|
266
248
|
value={activeMobileTab}
|
|
267
249
|
onValueChange={(value) => setActiveMobileTab(value as MobileDevtoolsTab)}
|
|
268
250
|
>
|
|
269
|
-
<Tabs.List
|
|
270
|
-
className="dev-host-mobile-tab-list"
|
|
271
|
-
aria-label="DevTools sections"
|
|
272
|
-
>
|
|
251
|
+
<Tabs.List className="dev-host-mobile-tab-list" aria-label="DevTools sections">
|
|
273
252
|
<Tabs.Tab value="log">Log</Tabs.Tab>
|
|
274
253
|
<Tabs.Tab value="actions">Actions</Tabs.Tab>
|
|
275
254
|
</Tabs.List>
|
|
@@ -319,34 +298,19 @@ export const App = ({
|
|
|
319
298
|
<PluginHeader className="dev-host-header">
|
|
320
299
|
<div className="dev-host-header-title">
|
|
321
300
|
<PluginHeader.Title>Rozenite Dev Host</PluginHeader.Title>
|
|
322
|
-
<PluginHeader.Subtitle
|
|
323
|
-
className="dev-host-header-subtitle"
|
|
324
|
-
title={panelDescription}
|
|
325
|
-
>
|
|
301
|
+
<PluginHeader.Subtitle className="dev-host-header-subtitle" title={panelDescription}>
|
|
326
302
|
{packageName}
|
|
327
303
|
</PluginHeader.Subtitle>
|
|
328
304
|
</div>
|
|
329
305
|
<PluginHeader.Actions>
|
|
330
306
|
<PluginHeader.ThemeSwitcher />
|
|
331
|
-
<PanelTabs
|
|
332
|
-
panels={panels}
|
|
333
|
-
activeSource={activeSource}
|
|
334
|
-
onValueChange={selectPanel}
|
|
335
|
-
/>
|
|
307
|
+
<PanelTabs panels={panels} activeSource={activeSource} onValueChange={selectPanel} />
|
|
336
308
|
</PluginHeader.Actions>
|
|
337
309
|
</PluginHeader>
|
|
338
310
|
|
|
339
311
|
<PluginShell.Body className="dev-host-body">
|
|
340
|
-
<Split
|
|
341
|
-
|
|
342
|
-
className="dev-host-main-split"
|
|
343
|
-
autoSaveId="dev-host"
|
|
344
|
-
>
|
|
345
|
-
<Split.Pane
|
|
346
|
-
defaultSize={64}
|
|
347
|
-
minSize={30}
|
|
348
|
-
className="dev-host-preview"
|
|
349
|
-
>
|
|
312
|
+
<Split direction="vertical" className="dev-host-main-split" autoSaveId="dev-host">
|
|
313
|
+
<Split.Pane defaultSize={64} minSize={30} className="dev-host-preview">
|
|
350
314
|
{panels.length === 0 ? (
|
|
351
315
|
<div className="flex h-full items-center justify-center p-8 text-center text-sm text-muted-foreground">
|
|
352
316
|
No panels were defined in rozenite.config.ts.
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconButton, Input, Select, Tabs, Textarea } from '@rozenite/ui';
|
|
2
2
|
import { RotateCcw, Send } from 'lucide-react';
|
|
3
3
|
import { useState, type FormEvent } from 'react';
|
|
4
|
-
import type {
|
|
5
|
-
DevHostFlowEntry,
|
|
6
|
-
DevHostFlowRunState,
|
|
7
|
-
DevHostPresetEntry,
|
|
8
|
-
} from '../types.js';
|
|
4
|
+
import type { DevHostFlowEntry, DevHostFlowRunState, DevHostPresetEntry } from '../types.js';
|
|
9
5
|
import { FlowList } from './FlowList.js';
|
|
10
6
|
|
|
11
7
|
type DispatchFormProps = {
|
|
@@ -72,9 +68,7 @@ export const DispatchForm = ({
|
|
|
72
68
|
>
|
|
73
69
|
<Select.Trigger
|
|
74
70
|
className="w-auto"
|
|
75
|
-
aria-label={
|
|
76
|
-
presets.length > 0 ? 'Open presets' : 'No presets available'
|
|
77
|
-
}
|
|
71
|
+
aria-label={presets.length > 0 ? 'Open presets' : 'No presets available'}
|
|
78
72
|
disabled={presets.length === 0}
|
|
79
73
|
title={presets.length > 0 ? 'Presets' : 'No presets available'}
|
|
80
74
|
>
|
|
@@ -97,9 +91,7 @@ export const DispatchForm = ({
|
|
|
97
91
|
<span className="dev-host-label">Command</span>
|
|
98
92
|
<Input
|
|
99
93
|
value={commandType}
|
|
100
|
-
onChange={(event) =>
|
|
101
|
-
onCommandTypeChange(event.currentTarget.value)
|
|
102
|
-
}
|
|
94
|
+
onChange={(event) => onCommandTypeChange(event.currentTarget.value)}
|
|
103
95
|
placeholder="get-snapshot"
|
|
104
96
|
spellCheck={false}
|
|
105
97
|
/>
|
|
@@ -109,33 +101,24 @@ export const DispatchForm = ({
|
|
|
109
101
|
<span className="dev-host-label">Payload</span>
|
|
110
102
|
<Textarea
|
|
111
103
|
value={commandPayload}
|
|
112
|
-
onChange={(event) =>
|
|
113
|
-
onCommandPayloadChange(event.currentTarget.value)
|
|
114
|
-
}
|
|
104
|
+
onChange={(event) => onCommandPayloadChange(event.currentTarget.value)}
|
|
115
105
|
placeholder='{"example": true}'
|
|
116
106
|
spellCheck={false}
|
|
117
107
|
/>
|
|
118
108
|
</label>
|
|
119
109
|
|
|
120
110
|
<div className="dev-host-actions">
|
|
121
|
-
<
|
|
111
|
+
<IconButton
|
|
112
|
+
tone="neutral"
|
|
122
113
|
variant="outline"
|
|
123
|
-
size="icon"
|
|
124
114
|
onClick={onReset}
|
|
125
|
-
|
|
126
|
-
title="Reset dispatcher"
|
|
115
|
+
label="Reset dispatcher"
|
|
127
116
|
>
|
|
128
117
|
<RotateCcw />
|
|
129
|
-
</
|
|
130
|
-
<
|
|
131
|
-
type="submit"
|
|
132
|
-
size="icon"
|
|
133
|
-
disabled={!canDispatch}
|
|
134
|
-
aria-label="Dispatch message"
|
|
135
|
-
title="Dispatch message"
|
|
136
|
-
>
|
|
118
|
+
</IconButton>
|
|
119
|
+
<IconButton type="submit" disabled={!canDispatch} label="Dispatch message">
|
|
137
120
|
<Send />
|
|
138
|
-
</
|
|
121
|
+
</IconButton>
|
|
139
122
|
</div>
|
|
140
123
|
</form>
|
|
141
124
|
</Tabs.Panel>
|
|
@@ -52,7 +52,8 @@ export const FlowList = ({
|
|
|
52
52
|
return (
|
|
53
53
|
<Button
|
|
54
54
|
key={flow.name}
|
|
55
|
-
|
|
55
|
+
tone="neutral"
|
|
56
|
+
variant={isRunning ? 'solid' : 'outline'}
|
|
56
57
|
className="dev-host-flow-button"
|
|
57
58
|
onClick={() => onRunFlow(flow)}
|
|
58
59
|
aria-label={`Run ${flow.displayName}`}
|
|
@@ -60,7 +61,11 @@ export const FlowList = ({
|
|
|
60
61
|
<span className="dev-host-flow-name">
|
|
61
62
|
<Play />
|
|
62
63
|
{flow.displayName}
|
|
63
|
-
{flow.autoRun ?
|
|
64
|
+
{flow.autoRun ? (
|
|
65
|
+
<Badge tone="neutral" variant="outline">
|
|
66
|
+
Auto
|
|
67
|
+
</Badge>
|
|
68
|
+
) : null}
|
|
64
69
|
</span>
|
|
65
70
|
<span className="text-xs text-muted-foreground">
|
|
66
71
|
{isRunning ? 'Running' : 'Run'}
|
|
@@ -76,22 +81,21 @@ export const FlowList = ({
|
|
|
76
81
|
<span className="dev-host-label">Flow runs</span>
|
|
77
82
|
<div className="dev-host-flow-runs">
|
|
78
83
|
{flowRuns.map((flowRun) => (
|
|
79
|
-
<div
|
|
80
|
-
key={flowRun.id}
|
|
81
|
-
className="dev-host-flow-state"
|
|
82
|
-
data-status={flowRun.status}
|
|
83
|
-
>
|
|
84
|
+
<div key={flowRun.id} className="dev-host-flow-state" data-status={flowRun.status}>
|
|
84
85
|
<div className="dev-host-flow-state-header">
|
|
85
86
|
<span className="dev-host-flow-title">
|
|
86
87
|
{flowRun.flowDisplayName}
|
|
87
88
|
{flowRun.autoRun ? (
|
|
88
|
-
<Badge variant="outline">
|
|
89
|
+
<Badge tone="neutral" variant="outline">
|
|
90
|
+
Auto
|
|
91
|
+
</Badge>
|
|
89
92
|
) : null}
|
|
90
93
|
</span>
|
|
91
94
|
{flowRun.status === 'running' ? (
|
|
92
95
|
<Button
|
|
96
|
+
tone="neutral"
|
|
93
97
|
variant="ghost"
|
|
94
|
-
size="
|
|
98
|
+
size="sm"
|
|
95
99
|
onClick={() => onStopFlow(flowRun.id)}
|
|
96
100
|
>
|
|
97
101
|
<Square />
|
|
@@ -103,9 +107,7 @@ export const FlowList = ({
|
|
|
103
107
|
{getStatusLabel(flowRun.status)}
|
|
104
108
|
</span>
|
|
105
109
|
{flowRun.error ? (
|
|
106
|
-
<div className="dev-host-flow-state-error">
|
|
107
|
-
{flowRun.error}
|
|
108
|
-
</div>
|
|
110
|
+
<div className="dev-host-flow-state-error">{flowRun.error}</div>
|
|
109
111
|
) : null}
|
|
110
112
|
{flowRun.result != null ? (
|
|
111
113
|
<pre className="dev-host-flow-state-result">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconButton, JsonInspector, ScrollArea } from '@rozenite/ui';
|
|
2
2
|
import { Send, X } from 'lucide-react';
|
|
3
3
|
import type { MessageEntry } from '../types.js';
|
|
4
4
|
import { formatMessageDate, formatPayloadForCommandInput } from '../utils.js';
|
|
@@ -19,24 +19,22 @@ export const MessageDetailsPane = ({
|
|
|
19
19
|
<header className="dev-host-pane-header">
|
|
20
20
|
<h2 className="dev-host-pane-title">Message Details</h2>
|
|
21
21
|
<div className="dev-host-pane-actions">
|
|
22
|
-
<
|
|
22
|
+
<IconButton
|
|
23
|
+
tone="neutral"
|
|
23
24
|
variant="ghost"
|
|
24
|
-
size="icon"
|
|
25
25
|
onClick={() => onUseMessage(selectedMessage)}
|
|
26
|
-
|
|
27
|
-
title="Use message in dispatcher"
|
|
26
|
+
label="Use message in dispatcher"
|
|
28
27
|
>
|
|
29
28
|
<Send />
|
|
30
|
-
</
|
|
31
|
-
<
|
|
29
|
+
</IconButton>
|
|
30
|
+
<IconButton
|
|
31
|
+
tone="neutral"
|
|
32
32
|
variant="ghost"
|
|
33
|
-
size="icon"
|
|
34
33
|
onClick={onClose}
|
|
35
|
-
|
|
36
|
-
title="Close message details"
|
|
34
|
+
label="Close message details"
|
|
37
35
|
>
|
|
38
36
|
<X />
|
|
39
|
-
</
|
|
37
|
+
</IconButton>
|
|
40
38
|
</div>
|
|
41
39
|
</header>
|
|
42
40
|
|
|
@@ -44,9 +42,7 @@ export const MessageDetailsPane = ({
|
|
|
44
42
|
<div className="dev-host-details">
|
|
45
43
|
<div className="dev-host-detail-section">
|
|
46
44
|
<span className="dev-host-label">Date</span>
|
|
47
|
-
<div className="dev-host-detail-value">
|
|
48
|
-
{formatMessageDate(selectedMessage.date)}
|
|
49
|
-
</div>
|
|
45
|
+
<div className="dev-host-detail-value">{formatMessageDate(selectedMessage.date)}</div>
|
|
50
46
|
</div>
|
|
51
47
|
<div className="dev-host-detail-section">
|
|
52
48
|
<span className="dev-host-label">Type</span>
|
|
@@ -55,12 +51,8 @@ export const MessageDetailsPane = ({
|
|
|
55
51
|
<div className="dev-host-detail-section">
|
|
56
52
|
<span className="dev-host-label">Payload</span>
|
|
57
53
|
<div className="dev-host-detail-payload">
|
|
58
|
-
{typeof selectedMessage.payload === 'object' &&
|
|
59
|
-
|
|
60
|
-
<JsonInspector
|
|
61
|
-
data={selectedMessage.payload}
|
|
62
|
-
defaultExpandedDepth={2}
|
|
63
|
-
/>
|
|
54
|
+
{typeof selectedMessage.payload === 'object' && selectedMessage.payload !== null ? (
|
|
55
|
+
<JsonInspector data={selectedMessage.payload} defaultExpandedDepth={2} />
|
|
64
56
|
) : (
|
|
65
57
|
<pre className="m-0 whitespace-pre-wrap break-words">
|
|
66
58
|
{formatPayloadForCommandInput(selectedMessage.payload)}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataTable, IconButton, ScrollArea } from '@rozenite/ui';
|
|
2
2
|
import { Trash2 } from 'lucide-react';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import type { DataTableColumn } from '@rozenite/ui';
|
|
@@ -27,9 +27,7 @@ export const MessageLogPane = ({
|
|
|
27
27
|
|
|
28
28
|
return (
|
|
29
29
|
<span
|
|
30
|
-
className={
|
|
31
|
-
isSent ? 'dev-host-direction-in' : 'dev-host-direction-out'
|
|
32
|
-
}
|
|
30
|
+
className={isSent ? 'dev-host-direction-in' : 'dev-host-direction-out'}
|
|
33
31
|
aria-label={isSent ? 'Sent message' : 'Received message'}
|
|
34
32
|
title={isSent ? 'Sent message' : 'Received message'}
|
|
35
33
|
>
|
|
@@ -42,17 +40,13 @@ export const MessageLogPane = ({
|
|
|
42
40
|
accessorKey: 'date',
|
|
43
41
|
header: 'Date',
|
|
44
42
|
cell: ({ row }) => (
|
|
45
|
-
<span className="text-muted-foreground">
|
|
46
|
-
{formatMessageTableDate(row.original.date)}
|
|
47
|
-
</span>
|
|
43
|
+
<span className="text-muted-foreground">{formatMessageTableDate(row.original.date)}</span>
|
|
48
44
|
),
|
|
49
45
|
},
|
|
50
46
|
{
|
|
51
47
|
accessorKey: 'type',
|
|
52
48
|
header: 'Type',
|
|
53
|
-
cell: ({ getValue }) => (
|
|
54
|
-
<span className="font-medium">{getValue<string>()}</span>
|
|
55
|
-
),
|
|
49
|
+
cell: ({ getValue }) => <span className="font-medium">{getValue<string>()}</span>,
|
|
56
50
|
},
|
|
57
51
|
{
|
|
58
52
|
id: 'payload',
|
|
@@ -72,22 +66,18 @@ export const MessageLogPane = ({
|
|
|
72
66
|
<section className="dev-host-pane">
|
|
73
67
|
<header className="dev-host-pane-header">
|
|
74
68
|
<h2 className="dev-host-pane-title">Message Log</h2>
|
|
75
|
-
<
|
|
69
|
+
<IconButton
|
|
70
|
+
tone="neutral"
|
|
76
71
|
variant="ghost"
|
|
77
|
-
size="icon"
|
|
78
72
|
onClick={onClearMessages}
|
|
79
73
|
disabled={messages.length === 0}
|
|
80
|
-
|
|
81
|
-
title="Clear message log"
|
|
74
|
+
label="Clear message log"
|
|
82
75
|
>
|
|
83
76
|
<Trash2 />
|
|
84
|
-
</
|
|
77
|
+
</IconButton>
|
|
85
78
|
</header>
|
|
86
79
|
|
|
87
|
-
<ScrollArea
|
|
88
|
-
className="dev-host-scroll"
|
|
89
|
-
viewportClassName="dev-host-scroll-viewport"
|
|
90
|
-
>
|
|
80
|
+
<ScrollArea className="dev-host-scroll" viewportClassName="dev-host-scroll-viewport">
|
|
91
81
|
<DataTable
|
|
92
82
|
className="dev-host-message-table"
|
|
93
83
|
columns={columns}
|
|
@@ -7,11 +7,7 @@ type PanelTabsProps = {
|
|
|
7
7
|
onValueChange: (value: string) => void;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export const PanelTabs = ({
|
|
11
|
-
panels,
|
|
12
|
-
activeSource,
|
|
13
|
-
onValueChange,
|
|
14
|
-
}: PanelTabsProps) => {
|
|
10
|
+
export const PanelTabs = ({ panels, activeSource, onValueChange }: PanelTabsProps) => {
|
|
15
11
|
if (panels.length === 0) {
|
|
16
12
|
return null;
|
|
17
13
|
}
|
|
@@ -19,14 +15,8 @@ export const PanelTabs = ({
|
|
|
19
15
|
const activePanel = panels.find((panel) => panel.source === activeSource);
|
|
20
16
|
|
|
21
17
|
return (
|
|
22
|
-
<Select
|
|
23
|
-
|
|
24
|
-
onValueChange={(value) => onValueChange(String(value))}
|
|
25
|
-
>
|
|
26
|
-
<Select.Trigger
|
|
27
|
-
className="dev-host-panel-select"
|
|
28
|
-
aria-label="Plugin panel"
|
|
29
|
-
>
|
|
18
|
+
<Select value={activeSource} onValueChange={(value) => onValueChange(String(value))}>
|
|
19
|
+
<Select.Trigger className="dev-host-panel-select" aria-label="Plugin panel">
|
|
30
20
|
<Select.Value>{activePanel?.label}</Select.Value>
|
|
31
21
|
</Select.Trigger>
|
|
32
22
|
<Select.Content align="end">
|