@midscene/visualizer 0.1.4 → 0.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.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -21
  3. package/dist/es/component/blackboard.js +32 -8
  4. package/dist/es/component/color.js +2 -4
  5. package/dist/es/component/detail-panel.js +28 -14
  6. package/dist/es/component/detail-side.css +1 -1
  7. package/dist/es/component/detail-side.js +99 -28
  8. package/dist/es/component/global-hover-preview.css +2 -2
  9. package/dist/es/component/global-hover-preview.js +25 -12
  10. package/dist/es/component/panel-title.css +3 -3
  11. package/dist/es/component/sidebar.css +7 -12
  12. package/dist/es/component/sidebar.js +31 -19
  13. package/dist/es/component/store.js +8 -2
  14. package/dist/es/component/timeline.css +1 -1
  15. package/dist/es/component/timeline.js +52 -19
  16. package/dist/es/demo-dump.json +1 -0
  17. package/dist/es/index.css +13 -9
  18. package/dist/es/index.js +44 -26
  19. package/dist/es/utils.js +9 -10
  20. package/dist/lib/component/blackboard.js +31 -7
  21. package/dist/lib/component/color.js +2 -4
  22. package/dist/lib/component/detail-panel.js +23 -13
  23. package/dist/lib/component/detail-side.css +1 -1
  24. package/dist/lib/component/detail-side.js +98 -27
  25. package/dist/lib/component/global-hover-preview.css +2 -2
  26. package/dist/lib/component/global-hover-preview.js +26 -13
  27. package/dist/lib/component/panel-title.css +3 -3
  28. package/dist/lib/component/sidebar.css +7 -12
  29. package/dist/lib/component/sidebar.js +31 -19
  30. package/dist/lib/component/store.js +8 -2
  31. package/dist/lib/component/timeline.css +1 -1
  32. package/dist/lib/component/timeline.js +52 -19
  33. package/dist/lib/demo-dump.json +1 -0
  34. package/dist/lib/index.css +13 -9
  35. package/dist/lib/index.js +43 -25
  36. package/dist/lib/utils.js +9 -10
  37. package/dist/types/component/store.d.ts +1 -1
  38. package/dist/types/index.d.ts +1 -1
  39. package/dist/types/utils.d.ts +1 -1
  40. package/package.json +9 -9
@@ -32,16 +32,20 @@ footer.mt-8 {
32
32
  display: flex;
33
33
  flex-direction: column;
34
34
  height: 100%;
35
- color: #000;
35
+ color: #3b3b3b;
36
36
  font-family:
37
- PingFang SC,
38
- Hiragino Sans GB,
39
- Microsoft YaHei,
37
+ -apple-system,
38
+ BlinkMacSystemFont,
39
+ "Segoe UI",
40
+ "Noto Sans",
41
+ Helvetica,
40
42
  Arial,
41
- sans-serif;
43
+ sans-serif,
44
+ "Apple Color Emoji",
45
+ "Segoe UI Emoji";
42
46
  font-size: 14px;
43
- border-top: 1px solid #CCCCCC;
44
- border-bottom: 1px solid #CCCCCC;
47
+ border-top: 1px solid #E5E5E5;
48
+ border-bottom: 1px solid #E5E5E5;
45
49
  }
46
50
  .ant-layout {
47
51
  flex-grow: 1;
@@ -59,7 +63,7 @@ footer.mt-8 {
59
63
  flex-direction: row;
60
64
  flex-grow: 1;
61
65
  overflow: hidden;
62
- background: #f7f7f7;
66
+ background: #FFF;
63
67
  }
64
68
  .main-right.uploader-wrapper {
65
69
  box-sizing: border-box;
@@ -82,7 +86,7 @@ footer.mt-8 {
82
86
  background: #ffffff;
83
87
  overflow-x: hidden;
84
88
  overflow-y: scroll;
85
- border-left: 1px solid #CCCCCC;
89
+ border-left: 1px solid #E5E5E5;
86
90
  }
87
91
  .main-right .main-side {
88
92
  box-sizing: border-box;
package/dist/lib/index.js CHANGED
@@ -51,17 +51,18 @@ __export(src_exports, {
51
51
  module.exports = __toCommonJS(src_exports);
52
52
  var import_jsx_runtime = require("react/jsx-runtime");
53
53
  var import_index = require("./index.css");
54
+ var import_detail_side = __toESM(require("./component/detail-side"));
55
+ var import_sidebar = __toESM(require("./component/sidebar"));
56
+ var import_store = require("./component/store");
57
+ var import_head = require("@modern-js/runtime/head");
54
58
  var import_antd = require("antd");
55
59
  var import_react = require("react");
56
- var import_head = require("@modern-js/runtime/head");
57
60
  var import_react_resizable_panels = require("react-resizable-panels");
58
- var import_timeline = __toESM(require("./component/timeline"));
59
- var import_detail_panel = __toESM(require("./component/detail-panel"));
60
61
  var import_logo_plain = __toESM(require("./component/assets/logo-plain.js"));
62
+ var import_detail_panel = __toESM(require("./component/detail-panel"));
61
63
  var import_global_hover_preview = __toESM(require("./component/global-hover-preview"));
62
- var import_store = require("./component/store");
63
- var import_detail_side = __toESM(require("./component/detail-side"));
64
- var import_sidebar = __toESM(require("./component/sidebar"));
64
+ var import_timeline = __toESM(require("./component/timeline"));
65
+ var import_demo_dump = __toESM(require("./demo-dump.json"));
65
66
  const { Dragger } = import_antd.Upload;
66
67
  let globalRenderCount = 1;
67
68
  function Visualizer(props) {
@@ -120,9 +121,8 @@ function Visualizer(props) {
120
121
  return false;
121
122
  }
122
123
  };
123
- const loadTasksDemo = () => {
124
- };
125
- const loadInsightDemo = () => {
124
+ const loadDemoDump = () => {
125
+ setGroupedDump(import_demo_dump.default);
126
126
  };
127
127
  let mainContent;
128
128
  if (!executionDump) {
@@ -139,14 +139,11 @@ function Visualizer(props) {
139
139
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "ant-upload-text", children: [
140
140
  "The latest dump file is usually placed in",
141
141
  " ",
142
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { children: "./midscene_run/" }) })
142
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("b", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("i", { children: "./midscene_run/report" }) })
143
143
  ] }),
144
144
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "ant-upload-text", children: "All data will be processed locally by the browser. No data will be sent to the server." })
145
145
  ] })),
146
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "demo-loader", children: [
147
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { type: "link", onClick: loadTasksDemo, children: "Load Tasks Demo" }),
148
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { type: "link", onClick: loadInsightDemo, children: "Load Insight Demo" })
149
- ] })
146
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "demo-loader", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { type: "link", onClick: loadDemoDump, children: "Load Demo" }) })
150
147
  ] });
151
148
  } else {
152
149
  mainContent = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
@@ -174,11 +171,18 @@ function Visualizer(props) {
174
171
  ),
175
172
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_resizable_panels.Panel, { defaultSize: 80, maxSize: 95, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "main-right", children: [
176
173
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_timeline.default, {}, mainLayoutChangeFlag),
177
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "main-content", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react_resizable_panels.PanelGroup, { autoSaveId: "page-detail-layout", direction: "horizontal", children: [
178
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_resizable_panels.Panel, { maxSize: 95, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "main-side", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_detail_side.default, {}) }) }),
179
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_resizable_panels.PanelResizeHandle, {}),
180
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_resizable_panels.Panel, { defaultSize: 75, maxSize: 95, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "main-canvas-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_detail_panel.default, {}) }) })
181
- ] }) })
174
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "main-content", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
175
+ import_react_resizable_panels.PanelGroup,
176
+ {
177
+ autoSaveId: "page-detail-layout",
178
+ direction: "horizontal",
179
+ children: [
180
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_resizable_panels.Panel, { maxSize: 95, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "main-side", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_detail_side.default, {}) }) }),
181
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_resizable_panels.PanelResizeHandle, {}),
182
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react_resizable_panels.Panel, { defaultSize: 75, maxSize: 95, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "main-canvas-container", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_detail_panel.default, {}) }) })
183
+ ]
184
+ }
185
+ ) })
182
186
  ] }) })
183
187
  ]
184
188
  }
@@ -188,14 +192,20 @@ function Visualizer(props) {
188
192
  (0, import_react.useEffect)(() => {
189
193
  const ifInRspressPage = document.querySelector(".rspress-nav");
190
194
  const navHeightKey = "--rp-nav-height";
191
- const originalNavHeight = getComputedStyle(document.documentElement).getPropertyValue(navHeightKey);
195
+ const originalNavHeight = getComputedStyle(
196
+ document.documentElement
197
+ ).getPropertyValue(navHeightKey);
192
198
  if (ifInRspressPage) {
193
- setContainerHeight("calc(100vh - 72px)");
194
- document.documentElement.style.setProperty(navHeightKey, "42px");
199
+ const newNavHeight = "42px";
200
+ setContainerHeight(`calc(100vh - ${newNavHeight})`);
201
+ document.documentElement.style.setProperty(navHeightKey, newNavHeight);
195
202
  }
196
203
  return () => {
197
204
  if (ifInRspressPage) {
198
- document.documentElement.style.setProperty(navHeightKey, originalNavHeight);
205
+ document.documentElement.style.setProperty(
206
+ navHeightKey,
207
+ originalNavHeight
208
+ );
199
209
  }
200
210
  };
201
211
  }, []);
@@ -218,8 +228,16 @@ function Visualizer(props) {
218
228
  }
219
229
  },
220
230
  children: [
221
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_head.Helmet, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", { children: "MidScene.js - Visualization Tool" }) }),
222
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "page-container", style: { height: containerHeight }, children: mainContent }, `render-${globalRenderCount}`),
231
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_head.Helmet, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("title", { children: "Midscene.js - Visualization Tool" }) }),
232
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
233
+ "div",
234
+ {
235
+ className: "page-container",
236
+ style: { height: containerHeight },
237
+ children: mainContent
238
+ },
239
+ `render-${globalRenderCount}`
240
+ ),
223
241
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_global_hover_preview.default, {})
224
242
  ]
225
243
  }
package/dist/lib/utils.js CHANGED
@@ -76,22 +76,21 @@ function insightDumpToExecutionDump(insightDump) {
76
76
  return task;
77
77
  };
78
78
  if (!Array.isArray(insightDump)) {
79
- const result = {
79
+ const result2 = {
80
80
  sdkVersion: insightDump.sdkVersion,
81
81
  logTime: insightDump.logTime,
82
82
  name: "Insight",
83
83
  tasks: [insightToTask(insightDump)]
84
84
  };
85
- return result;
86
- } else {
87
- const result = {
88
- sdkVersion: insightDump[0].sdkVersion,
89
- logTime: insightDump[0].logTime,
90
- name: "Insight",
91
- tasks: insightDump.map(insightToTask)
92
- };
93
- return result;
85
+ return result2;
94
86
  }
87
+ const result = {
88
+ sdkVersion: insightDump[0].sdkVersion,
89
+ logTime: insightDump[0].logTime,
90
+ name: "Insight",
91
+ tasks: insightDump.map(insightToTask)
92
+ };
93
+ return result;
95
94
  }
96
95
  function timeStr(timestamp) {
97
96
  return timestamp ? (0, import_dayjs.default)(timestamp).format("YYYY-MM-DD HH:mm:ss") : "-";
@@ -1,4 +1,4 @@
1
- import { InsightDump, BaseElement, ExecutionTask, GroupedActionDump } from '../../../midscene/dist/types';
1
+ import type { BaseElement, ExecutionTask, GroupedActionDump, InsightDump } from '../../../midscene/dist/types';
2
2
  export declare const useBlackboardPreference: import("zustand").UseBoundStore<import("zustand").StoreApi<{
3
3
  bgVisible: boolean;
4
4
  textsVisible: boolean;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import './index.less';
3
- import { GroupedActionDump } from '@midscene/core';
3
+ import type { GroupedActionDump } from '@midscene/core';
4
4
  export declare function Visualizer(props: {
5
5
  hideLogo?: boolean;
6
6
  logoAction?: () => void;
@@ -1,4 +1,4 @@
1
- import type { ExecutionDump, InsightDump, ExecutionTask } from '@midscene/core';
1
+ import type { ExecutionDump, ExecutionTask, InsightDump } from '@midscene/core';
2
2
  export declare function insightDumpToExecutionDump(insightDump: InsightDump | InsightDump[]): ExecutionDump;
3
3
  export declare function timeStr(timestamp?: number): string;
4
4
  export declare function typeStr(task: ExecutionTask): any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/visualizer",
3
- "version": "0.1.4",
3
+ "version": "0.2.0",
4
4
  "types": "./dist/types/index.d.ts",
5
5
  "jsnext:source": "./src/index.ts",
6
6
  "main": "./dist/lib/index.js",
@@ -11,24 +11,24 @@
11
11
  ],
12
12
  "dependencies": {
13
13
  "@ant-design/icons": "5.3.7",
14
- "@modern-js/runtime": "^2.54.2",
15
- "antd": "5.17.3",
14
+ "@modern-js/runtime": "^2.56.2",
15
+ "antd": "5.19.3",
16
16
  "dayjs": "1.11.11",
17
17
  "pixi.js": "8.1.1",
18
- "react": "~18.2.0",
19
- "react-dom": "~18.2.0",
18
+ "react": "^18.2.0",
19
+ "react-dom": "^18.2.0",
20
20
  "react-resizable-panels": "2.0.22",
21
21
  "zustand": "4.5.2",
22
- "@midscene/core": "0.1.4"
22
+ "@midscene/core": "0.2.0"
23
23
  },
24
24
  "devDependencies": {
25
- "@modern-js/module-tools": "^2.54.2",
25
+ "@modern-js/module-tools": "^2.56.1",
26
26
  "@modern-js/plugin-module-doc": "^2.33.1",
27
27
  "@types/react": "18.3.3",
28
28
  "@types/react-dom": "18.3.0",
29
29
  "@types/node": "^18.0.0",
30
- "react": "~18.2.0",
31
- "react-dom": "~18.2.0",
30
+ "react": "^18.2.0",
31
+ "react-dom": "^18.2.0",
32
32
  "rimraf": "~3.0.2",
33
33
  "typescript": "~5.0.4"
34
34
  },