@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
package/dist/es/index.css CHANGED
@@ -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/es/index.js CHANGED
@@ -19,17 +19,18 @@ var __spreadValues = (a, b) => {
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  import { jsx, jsxs } from "react/jsx-runtime";
21
21
  import "./index.css";
22
- import { ConfigProvider, message, Upload, Button } from "antd";
23
- import { useEffect, useRef, useState } from "react";
22
+ import DetailSide from "./component/detail-side";
23
+ import Sidebar from "./component/sidebar";
24
+ import { useExecutionDump } from "./component/store";
24
25
  import { Helmet } from "@modern-js/runtime/head";
26
+ import { Button, ConfigProvider, Upload, message } from "antd";
27
+ import { useEffect, useRef, useState } from "react";
25
28
  import { Panel, PanelGroup, PanelResizeHandle } from "react-resizable-panels";
26
- import Timeline from "./component/timeline";
27
- import DetailPanel from "./component/detail-panel";
28
29
  import Logo from "./component/assets/logo-plain.js";
30
+ import DetailPanel from "./component/detail-panel";
29
31
  import GlobalHoverPreview from "./component/global-hover-preview";
30
- import { useExecutionDump } from "./component/store";
31
- import DetailSide from "./component/detail-side";
32
- import Sidebar from "./component/sidebar";
32
+ import Timeline from "./component/timeline";
33
+ import demoDump from "./demo-dump.json";
33
34
  const { Dragger } = Upload;
34
35
  let globalRenderCount = 1;
35
36
  function Visualizer(props) {
@@ -88,9 +89,8 @@ function Visualizer(props) {
88
89
  return false;
89
90
  }
90
91
  };
91
- const loadTasksDemo = () => {
92
- };
93
- const loadInsightDemo = () => {
92
+ const loadDemoDump = () => {
93
+ setGroupedDump(demoDump);
94
94
  };
95
95
  let mainContent;
96
96
  if (!executionDump) {
@@ -107,14 +107,11 @@ function Visualizer(props) {
107
107
  /* @__PURE__ */ jsxs("p", { className: "ant-upload-text", children: [
108
108
  "The latest dump file is usually placed in",
109
109
  " ",
110
- /* @__PURE__ */ jsx("b", { children: /* @__PURE__ */ jsx("i", { children: "./midscene_run/" }) })
110
+ /* @__PURE__ */ jsx("b", { children: /* @__PURE__ */ jsx("i", { children: "./midscene_run/report" }) })
111
111
  ] }),
112
112
  /* @__PURE__ */ jsx("p", { className: "ant-upload-text", children: "All data will be processed locally by the browser. No data will be sent to the server." })
113
113
  ] })),
114
- /* @__PURE__ */ jsxs("div", { className: "demo-loader", children: [
115
- /* @__PURE__ */ jsx(Button, { type: "link", onClick: loadTasksDemo, children: "Load Tasks Demo" }),
116
- /* @__PURE__ */ jsx(Button, { type: "link", onClick: loadInsightDemo, children: "Load Insight Demo" })
117
- ] })
114
+ /* @__PURE__ */ jsx("div", { className: "demo-loader", children: /* @__PURE__ */ jsx(Button, { type: "link", onClick: loadDemoDump, children: "Load Demo" }) })
118
115
  ] });
119
116
  } else {
120
117
  mainContent = /* @__PURE__ */ jsxs(
@@ -142,11 +139,18 @@ function Visualizer(props) {
142
139
  ),
143
140
  /* @__PURE__ */ jsx(Panel, { defaultSize: 80, maxSize: 95, children: /* @__PURE__ */ jsxs("div", { className: "main-right", children: [
144
141
  /* @__PURE__ */ jsx(Timeline, {}, mainLayoutChangeFlag),
145
- /* @__PURE__ */ jsx("div", { className: "main-content", children: /* @__PURE__ */ jsxs(PanelGroup, { autoSaveId: "page-detail-layout", direction: "horizontal", children: [
146
- /* @__PURE__ */ jsx(Panel, { maxSize: 95, children: /* @__PURE__ */ jsx("div", { className: "main-side", children: /* @__PURE__ */ jsx(DetailSide, {}) }) }),
147
- /* @__PURE__ */ jsx(PanelResizeHandle, {}),
148
- /* @__PURE__ */ jsx(Panel, { defaultSize: 75, maxSize: 95, children: /* @__PURE__ */ jsx("div", { className: "main-canvas-container", children: /* @__PURE__ */ jsx(DetailPanel, {}) }) })
149
- ] }) })
142
+ /* @__PURE__ */ jsx("div", { className: "main-content", children: /* @__PURE__ */ jsxs(
143
+ PanelGroup,
144
+ {
145
+ autoSaveId: "page-detail-layout",
146
+ direction: "horizontal",
147
+ children: [
148
+ /* @__PURE__ */ jsx(Panel, { maxSize: 95, children: /* @__PURE__ */ jsx("div", { className: "main-side", children: /* @__PURE__ */ jsx(DetailSide, {}) }) }),
149
+ /* @__PURE__ */ jsx(PanelResizeHandle, {}),
150
+ /* @__PURE__ */ jsx(Panel, { defaultSize: 75, maxSize: 95, children: /* @__PURE__ */ jsx("div", { className: "main-canvas-container", children: /* @__PURE__ */ jsx(DetailPanel, {}) }) })
151
+ ]
152
+ }
153
+ ) })
150
154
  ] }) })
151
155
  ]
152
156
  }
@@ -156,14 +160,20 @@ function Visualizer(props) {
156
160
  useEffect(() => {
157
161
  const ifInRspressPage = document.querySelector(".rspress-nav");
158
162
  const navHeightKey = "--rp-nav-height";
159
- const originalNavHeight = getComputedStyle(document.documentElement).getPropertyValue(navHeightKey);
163
+ const originalNavHeight = getComputedStyle(
164
+ document.documentElement
165
+ ).getPropertyValue(navHeightKey);
160
166
  if (ifInRspressPage) {
161
- setContainerHeight("calc(100vh - 72px)");
162
- document.documentElement.style.setProperty(navHeightKey, "42px");
167
+ const newNavHeight = "42px";
168
+ setContainerHeight(`calc(100vh - ${newNavHeight})`);
169
+ document.documentElement.style.setProperty(navHeightKey, newNavHeight);
163
170
  }
164
171
  return () => {
165
172
  if (ifInRspressPage) {
166
- document.documentElement.style.setProperty(navHeightKey, originalNavHeight);
173
+ document.documentElement.style.setProperty(
174
+ navHeightKey,
175
+ originalNavHeight
176
+ );
167
177
  }
168
178
  };
169
179
  }, []);
@@ -186,8 +196,16 @@ function Visualizer(props) {
186
196
  }
187
197
  },
188
198
  children: [
189
- /* @__PURE__ */ jsx(Helmet, { children: /* @__PURE__ */ jsx("title", { children: "MidScene.js - Visualization Tool" }) }),
190
- /* @__PURE__ */ jsx("div", { className: "page-container", style: { height: containerHeight }, children: mainContent }, `render-${globalRenderCount}`),
199
+ /* @__PURE__ */ jsx(Helmet, { children: /* @__PURE__ */ jsx("title", { children: "Midscene.js - Visualization Tool" }) }),
200
+ /* @__PURE__ */ jsx(
201
+ "div",
202
+ {
203
+ className: "page-container",
204
+ style: { height: containerHeight },
205
+ children: mainContent
206
+ },
207
+ `render-${globalRenderCount}`
208
+ ),
191
209
  /* @__PURE__ */ jsx(GlobalHoverPreview, {})
192
210
  ]
193
211
  }
package/dist/es/utils.js CHANGED
@@ -42,22 +42,21 @@ function insightDumpToExecutionDump(insightDump) {
42
42
  return task;
43
43
  };
44
44
  if (!Array.isArray(insightDump)) {
45
- const result = {
45
+ const result2 = {
46
46
  sdkVersion: insightDump.sdkVersion,
47
47
  logTime: insightDump.logTime,
48
48
  name: "Insight",
49
49
  tasks: [insightToTask(insightDump)]
50
50
  };
51
- return result;
52
- } else {
53
- const result = {
54
- sdkVersion: insightDump[0].sdkVersion,
55
- logTime: insightDump[0].logTime,
56
- name: "Insight",
57
- tasks: insightDump.map(insightToTask)
58
- };
59
- return result;
51
+ return result2;
60
52
  }
53
+ const result = {
54
+ sdkVersion: insightDump[0].sdkVersion,
55
+ logTime: insightDump[0].logTime,
56
+ name: "Insight",
57
+ tasks: insightDump.map(insightToTask)
58
+ };
59
+ return result;
61
60
  }
62
61
  function timeStr(timestamp) {
63
62
  return timestamp ? dayjs(timestamp).format("YYYY-MM-DD HH:mm:ss") : "-";
@@ -53,9 +53,9 @@ __export(blackboard_exports, {
53
53
  });
54
54
  module.exports = __toCommonJS(blackboard_exports);
55
55
  var import_jsx_runtime = require("react/jsx-runtime");
56
+ var import_antd = require("antd");
56
57
  var PIXI = __toESM(require("pixi.js"));
57
58
  var import_react = require("react");
58
- var import_antd = require("antd");
59
59
  var import_color = require("./color");
60
60
  var import_blackboard = require("./blackboard.css");
61
61
  var import_store = require("./store");
@@ -66,9 +66,15 @@ const noop = () => {
66
66
  };
67
67
  const BlackBoard = () => {
68
68
  const dump = (0, import_store.useInsightDump)((store) => store.data);
69
- const setHighlightSectionNames = (0, import_store.useInsightDump)((store) => store.setHighlightSectionNames);
70
- const setHighlightElements = (0, import_store.useInsightDump)((store) => store.setHighlightElements);
71
- const highlightSectionNames = (0, import_store.useInsightDump)((store) => store.highlightSectionNames);
69
+ const setHighlightSectionNames = (0, import_store.useInsightDump)(
70
+ (store) => store.setHighlightSectionNames
71
+ );
72
+ const setHighlightElements = (0, import_store.useInsightDump)(
73
+ (store) => store.setHighlightElements
74
+ );
75
+ const highlightSectionNames = (0, import_store.useInsightDump)(
76
+ (store) => store.highlightSectionNames
77
+ );
72
78
  const highlightElements = (0, import_store.useInsightDump)((store) => store.highlightElements);
73
79
  const { context, matchedSection: sections, matchedElement: elements } = dump;
74
80
  const { size, screenshotBase64 } = context;
@@ -87,7 +93,11 @@ const BlackBoard = () => {
87
93
  if (!domRef.current || !screenWidth) {
88
94
  return;
89
95
  }
90
- yield app.init({ width: screenWidth, height: screenHeight, background: 16777215 });
96
+ yield app.init({
97
+ width: screenWidth,
98
+ height: screenHeight,
99
+ background: 16777215
100
+ });
91
101
  const canvasEl = domRef.current;
92
102
  domRef.current.appendChild(app.canvas);
93
103
  const { clientWidth } = domRef.current.parentElement;
@@ -180,7 +190,14 @@ const BlackBoard = () => {
180
190
  if (elements.includes(element)) {
181
191
  return;
182
192
  }
183
- const [graphics, texts] = rectMarkForItem(rect, "", (0, import_color.highlightColorForType)("element"), 1, noop, noop);
193
+ const [graphics, texts] = rectMarkForItem(
194
+ rect,
195
+ "",
196
+ (0, import_color.highlightColorForType)("element"),
197
+ 1,
198
+ noop,
199
+ noop
200
+ );
184
201
  itemMarkContainer.addChild(graphics);
185
202
  textContainer.addChild(texts);
186
203
  });
@@ -276,7 +293,14 @@ const BlackBoard = () => {
276
293
  ] }) });
277
294
  }
278
295
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "blackboard", children: [
279
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "blackboard-main-content", style: { width: "100%" }, ref: domRef }),
296
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
297
+ "div",
298
+ {
299
+ className: "blackboard-main-content",
300
+ style: { width: "100%" },
301
+ ref: domRef
302
+ }
303
+ ),
280
304
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "blackboard-filter", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "overlay-control", children: [
281
305
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Checkbox, { checked: bgVisible, onChange: onSetBg, children: "Screenshot" }),
282
306
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Checkbox, { checked: textsVisible, onChange: onSetTextsVisible, children: "Text Mark" })
@@ -41,16 +41,14 @@ function colorForName(type, name) {
41
41
  const hashNumber = djb2Hash(name);
42
42
  if (type === "section") {
43
43
  return sectionColor[hashNumber % sectionColor.length];
44
- } else {
45
- return elementColor[hashNumber % elementColor.length];
46
44
  }
45
+ return elementColor[hashNumber % elementColor.length];
47
46
  }
48
47
  function highlightColorForType(type) {
49
48
  if (type === "section") {
50
49
  return highlightColorForSection;
51
- } else {
52
- return highlightColorForElement;
53
50
  }
51
+ return highlightColorForElement;
54
52
  }
55
53
  // Annotate the CommonJS export names for ESM import in node:
56
54
  0 && (module.exports = {
@@ -34,16 +34,16 @@ __export(detail_panel_exports, {
34
34
  module.exports = __toCommonJS(detail_panel_exports);
35
35
  var import_jsx_runtime = require("react/jsx-runtime");
36
36
  var import_detail_panel = require("./detail-panel.css");
37
- var import_antd = require("antd");
37
+ var import_store = require("./store");
38
+ var import_utils = require("../utils");
38
39
  var import_icons = require("@ant-design/icons");
40
+ var import_antd = require("antd");
39
41
  var import_react = require("react");
40
42
  var import_blackboard = __toESM(require("./blackboard"));
41
- var import_store = require("./store");
42
- var import_utils = require("../utils");
43
43
  const ScreenshotItem = (props) => {
44
44
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "screenshot-item", children: [
45
45
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "screenshot-item-title", children: props.time }),
46
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: props.img }) })
46
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("img", { src: props.img, alt: "screenshot" }) })
47
47
  ] });
48
48
  };
49
49
  const VIEW_TYPE_BLACKBOARD = "blackboard";
@@ -51,18 +51,19 @@ const VIEW_TYPE_SCREENSHOT = "screenshot";
51
51
  const VIEW_TYPE_JSON = "json";
52
52
  const DetailPanel = () => {
53
53
  var _a;
54
+ const dumpContext = (0, import_store.useInsightDump)((store) => store.data);
54
55
  const dumpId = (0, import_store.useInsightDump)((store) => store._loadId);
55
- const blackboardViewAvailable = Boolean(dumpId);
56
+ const blackboardViewAvailable = Boolean(dumpContext);
56
57
  const activeTask = (0, import_store.useExecutionDump)((store) => store.activeTask);
57
58
  const [preferredViewType, setViewType] = (0, import_react.useState)(VIEW_TYPE_BLACKBOARD);
58
- const viewType = preferredViewType === VIEW_TYPE_BLACKBOARD && !dumpId ? VIEW_TYPE_SCREENSHOT : preferredViewType;
59
+ const viewType = preferredViewType === VIEW_TYPE_BLACKBOARD && !blackboardViewAvailable ? VIEW_TYPE_SCREENSHOT : preferredViewType;
59
60
  let content;
60
61
  if (!activeTask) {
61
62
  content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "please select a task" });
62
63
  } else if (viewType === VIEW_TYPE_JSON) {
63
64
  content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "json-content", children: (0, import_utils.filterBase64Value)(JSON.stringify(activeTask, void 0, 2)) });
64
65
  } else if (viewType === VIEW_TYPE_BLACKBOARD) {
65
- if (dumpId) {
66
+ if (blackboardViewAvailable) {
66
67
  content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_blackboard.default, {}, `${dumpId}`);
67
68
  } else {
68
69
  content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: "invalid view" });
@@ -86,7 +87,9 @@ const DetailPanel = () => {
86
87
  } else if (viewType === VIEW_TYPE_SCREENSHOT) {
87
88
  setViewType(VIEW_TYPE_JSON);
88
89
  } else {
89
- setViewType(blackboardViewAvailable ? VIEW_TYPE_BLACKBOARD : VIEW_TYPE_SCREENSHOT);
90
+ setViewType(
91
+ blackboardViewAvailable ? VIEW_TYPE_BLACKBOARD : VIEW_TYPE_SCREENSHOT
92
+ );
90
93
  }
91
94
  e.preventDefault();
92
95
  }
@@ -97,11 +100,19 @@ const DetailPanel = () => {
97
100
  };
98
101
  });
99
102
  const options = [
100
- { label: "Screenshots", value: VIEW_TYPE_SCREENSHOT, icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CameraOutlined, {}) },
103
+ {
104
+ label: "Screenshots",
105
+ value: VIEW_TYPE_SCREENSHOT,
106
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CameraOutlined, {})
107
+ },
101
108
  { label: "JSON View", value: VIEW_TYPE_JSON, icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.FileTextOutlined, {}) }
102
109
  ];
103
110
  if (blackboardViewAvailable) {
104
- options.unshift({ label: "Visualization", value: VIEW_TYPE_BLACKBOARD, icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ScheduleOutlined, {}) });
111
+ options.unshift({
112
+ label: "Visualization",
113
+ value: VIEW_TYPE_BLACKBOARD,
114
+ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ScheduleOutlined, {})
115
+ });
105
116
  }
106
117
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "detail-panel", children: [
107
118
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "view-switcher", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -110,11 +121,10 @@ const DetailPanel = () => {
110
121
  theme: {
111
122
  components: {
112
123
  Segmented: {
113
- itemSelectedBg: "#D7D7D7",
124
+ itemSelectedBg: "#bfc4da50",
114
125
  itemSelectedColor: "#000000"
115
126
  // itemHoverColor: '#ffffff',
116
- // itemHoverBg: '#A3D6D2', // @sub-blue
117
- /* 这里是你的组件 token */
127
+ // itemHoverBg: '#A3D6D2',
118
128
  }
119
129
  }
120
130
  },
@@ -18,7 +18,6 @@
18
18
  line-height: 1.5;
19
19
  }
20
20
  .detail-side .meta-kv .meta .meta-key {
21
- font-weight: bold;
22
21
  width: 100px;
23
22
  text-align: right;
24
23
  padding-right: 16px;
@@ -82,6 +81,7 @@
82
81
  font-size: 14px;
83
82
  margin-top: 10px;
84
83
  white-space: break-spaces;
84
+ word-wrap: break-word;
85
85
  margin: 0;
86
86
  }
87
87
  .detail-side .item-list .element-button:hover {
@@ -48,18 +48,34 @@ __export(detail_side_exports, {
48
48
  module.exports = __toCommonJS(detail_side_exports);
49
49
  var import_jsx_runtime = require("react/jsx-runtime");
50
50
  var import_detail_side = require("./detail-side.css");
51
+ var import_utils = require("../utils");
51
52
  var import_icons = require("@ant-design/icons");
52
53
  var import_antd = require("antd");
53
54
  var import_color = require("./color");
54
- var import_store = require("./store");
55
- var import_panel_title = __toESM(require("./panel-title"));
56
55
  var import_misc = require("./misc");
57
- var import_utils = require("../utils");
56
+ var import_panel_title = __toESM(require("./panel-title"));
57
+ var import_store = require("./store");
58
58
  const noop = () => {
59
59
  };
60
60
  const Card = (props) => {
61
- const { highlightWithColor, title, subtitle, onMouseEnter, onMouseLeave, content, characteristic } = props;
62
- const titleTag = props.characteristic ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "item-extra", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "title-tag", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Tooltip, { placement: "bottomRight", title: characteristic, mouseEnterDelay: 0, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.RadiusSettingOutlined, {}) }) }) }) }) : null;
61
+ const {
62
+ highlightWithColor,
63
+ title,
64
+ subtitle,
65
+ onMouseEnter,
66
+ onMouseLeave,
67
+ content,
68
+ characteristic
69
+ } = props;
70
+ const titleTag = props.characteristic ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "item-extra", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "title-tag", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
71
+ import_antd.Tooltip,
72
+ {
73
+ placement: "bottomRight",
74
+ title: characteristic,
75
+ mouseEnterDelay: 0,
76
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.RadiusSettingOutlined, {}) })
77
+ }
78
+ ) }) }) : null;
63
79
  const titleRightPaddingClass = props.characteristic ? "title-right-padding" : "";
64
80
  const modeClass = props.liteMode ? "item-lite" : "";
65
81
  const highlightStyle = highlightWithColor ? { backgroundColor: highlightWithColor } : {};
@@ -71,12 +87,33 @@ const Card = (props) => {
71
87
  onMouseEnter,
72
88
  onMouseLeave,
73
89
  children: [
74
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `title ${titleRightPaddingClass}`, style: { display: title ? "block" : "none" }, children: [
75
- title,
76
- titleTag
77
- ] }),
78
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `subtitle ${titleRightPaddingClass}`, style: { display: subtitle ? "block" : "none" }, children: subtitle }),
79
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "description", style: { display: content ? "block" : "none" }, children: content })
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
91
+ "div",
92
+ {
93
+ className: `title ${titleRightPaddingClass}`,
94
+ style: { display: title ? "block" : "none" },
95
+ children: [
96
+ title,
97
+ titleTag
98
+ ]
99
+ }
100
+ ),
101
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
102
+ "div",
103
+ {
104
+ className: `subtitle ${titleRightPaddingClass}`,
105
+ style: { display: subtitle ? "block" : "none" },
106
+ children: subtitle
107
+ }
108
+ ),
109
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
110
+ "div",
111
+ {
112
+ className: "description",
113
+ style: { display: content ? "block" : "none" },
114
+ children: content
115
+ }
116
+ )
80
117
  ]
81
118
  }
82
119
  );
@@ -96,27 +133,33 @@ const objectWithoutKeys = (obj, keys) => Object.keys(obj).reduce((acc, key) => {
96
133
  return acc;
97
134
  }, {});
98
135
  const DetailSide = () => {
99
- var _a, _b, _c, _d, _e, _f, _g, _h;
136
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i;
100
137
  const task = (0, import_store.useExecutionDump)((store) => store.activeTask);
101
138
  const dump = (0, import_store.useInsightDump)((store) => store.data);
102
139
  const { matchedSection: sections, matchedElement: elements } = dump || {};
103
- const highlightSectionNames = (0, import_store.useInsightDump)((store) => store.highlightSectionNames);
140
+ const highlightSectionNames = (0, import_store.useInsightDump)(
141
+ (store) => store.highlightSectionNames
142
+ );
104
143
  const highlightElements = (0, import_store.useInsightDump)((store) => store.highlightElements);
105
- const setHighlightSectionNames = (0, import_store.useInsightDump)((store) => store.setHighlightSectionNames);
106
- const setHighlightElements = (0, import_store.useInsightDump)((store) => store.setHighlightElements);
107
- const setHighlightSectionName = function(name) {
144
+ const setHighlightSectionNames = (0, import_store.useInsightDump)(
145
+ (store) => store.setHighlightSectionNames
146
+ );
147
+ const setHighlightElements = (0, import_store.useInsightDump)(
148
+ (store) => store.setHighlightElements
149
+ );
150
+ const setHighlightSectionName = (name) => {
108
151
  setHighlightSectionNames([name]);
109
152
  };
110
- const setHighlightElement = function(element) {
153
+ const setHighlightElement = (element) => {
111
154
  setHighlightElements([element]);
112
155
  };
113
- const unhighlightSection = function() {
156
+ const unhighlightSection = () => {
114
157
  setHighlightSectionNames([]);
115
158
  };
116
- const unhighlightElement = function() {
159
+ const unhighlightElement = () => {
117
160
  setHighlightElements([]);
118
161
  };
119
- const kv = function(data) {
162
+ const kv = (data) => {
120
163
  const isElementItem = (value) => Boolean(value) && typeof value === "object" && typeof value.content !== "undefined" && Boolean(value.center) && Boolean(value.rect);
121
164
  const isSectionItem = (value) => Boolean(value) && typeof (value == null ? void 0 : value.sectionCharacteristics) !== "undefined" && typeof (value == null ? void 0 : value.rect) !== "undefined";
122
165
  const elementEl = (value) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -180,6 +223,10 @@ const DetailSide = () => {
180
223
  {
181
224
  key: "time cost",
182
225
  content: (0, import_misc.timeCostStrElement)((_c = task == null ? void 0 : task.timing) == null ? void 0 : _c.cost)
226
+ },
227
+ {
228
+ key: "cache",
229
+ content: (task == null ? void 0 : task.cache) ? JSON.stringify(task == null ? void 0 : task.cache) : "false"
183
230
  }
184
231
  ]
185
232
  });
@@ -188,7 +235,10 @@ const DetailSide = () => {
188
235
  taskParam = MetaKV({
189
236
  data: [
190
237
  { key: "type", content: task && (0, import_utils.typeStr)(task) || "" },
191
- { key: "param", content: (_d = task == null ? void 0 : task.param) == null ? void 0 : _d.userPrompt }
238
+ {
239
+ key: "param",
240
+ content: (_d = task == null ? void 0 : task.param) == null ? void 0 : _d.userPrompt
241
+ }
192
242
  ]
193
243
  });
194
244
  } else if ((task == null ? void 0 : task.type) === "Insight") {
@@ -198,7 +248,7 @@ const DetailSide = () => {
198
248
  {
199
249
  key: "param",
200
250
  content: JSON.stringify(
201
- ((_e = task == null ? void 0 : task.param) == null ? void 0 : _e.prompt) || ((_f = task == null ? void 0 : task.param) == null ? void 0 : _f.dataDemand)
251
+ ((_e = task == null ? void 0 : task.param) == null ? void 0 : _e.prompt) || ((_f = task == null ? void 0 : task.param) == null ? void 0 : _f.dataDemand) || ((_g = task == null ? void 0 : task.param) == null ? void 0 : _g.assertion)
202
252
  )
203
253
  }
204
254
  ]
@@ -209,7 +259,11 @@ const DetailSide = () => {
209
259
  { key: "type", content: task && (0, import_utils.typeStr)(task) || "" },
210
260
  {
211
261
  key: "value",
212
- content: JSON.stringify((_g = task == null ? void 0 : task.param) == null ? void 0 : _g.value, void 0, 2)
262
+ content: JSON.stringify(
263
+ (_h = task == null ? void 0 : task.param) == null ? void 0 : _h.value,
264
+ void 0,
265
+ 2
266
+ )
213
267
  }
214
268
  ]
215
269
  });
@@ -268,14 +322,14 @@ const DetailSide = () => {
268
322
  idx
269
323
  );
270
324
  }) : null;
271
- const errorSection = (dump == null ? void 0 : dump.error) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
325
+ const errorSection = (task == null ? void 0 : task.error) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
272
326
  Card,
273
327
  {
274
328
  liteMode: true,
275
329
  title: "Error",
276
330
  onMouseEnter: noop,
277
331
  onMouseLeave: noop,
278
- content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "description-content", style: { color: "#F00" }, children: dump.error })
332
+ content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "description-content", style: { color: "#F00" }, children: task.error })
279
333
  }
280
334
  ) : null;
281
335
  const dataCard = (dump == null ? void 0 : dump.data) ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
@@ -287,8 +341,24 @@ const DetailSide = () => {
287
341
  content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { children: JSON.stringify(dump.data, void 0, 2) })
288
342
  }
289
343
  ) : null;
290
- console.log("dump is", dump);
291
- const plans = (_h = task == null ? void 0 : task.output) == null ? void 0 : _h.plans;
344
+ let assertionCard = null;
345
+ if ((task == null ? void 0 : task.type) === "Insight" && task.subType === "Assert") {
346
+ assertionCard = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
347
+ Card,
348
+ {
349
+ liteMode: true,
350
+ title: "Assert",
351
+ onMouseEnter: noop,
352
+ onMouseLeave: noop,
353
+ content: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("pre", { className: "description-content", children: JSON.stringify(
354
+ task.output,
355
+ void 0,
356
+ 2
357
+ ) })
358
+ }
359
+ );
360
+ }
361
+ const plans = (_i = task == null ? void 0 : task.output) == null ? void 0 : _i.plans;
292
362
  let timelineData = [];
293
363
  if (plans) {
294
364
  timelineData = timelineData.concat(
@@ -313,6 +383,7 @@ const DetailSide = () => {
313
383
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "item-list item-list-space-up", children: [
314
384
  errorSection,
315
385
  dataCard,
386
+ assertionCard,
316
387
  matchedSectionsEl,
317
388
  matchedElementsEl,
318
389
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Timeline, { items: timelineData })
@@ -6,9 +6,9 @@
6
6
  overflow: hidden;
7
7
  z-index: 10;
8
8
  text-align: center;
9
- border: 1px solid #CCCCCC;
9
+ border: 1px solid #E5E5E5;
10
10
  box-sizing: border-box;
11
- background: #f7f7f7;
11
+ background: #F8F8F8;
12
12
  box-shadow: 1px 1px 5px 0 rgba(0, 0, 0, 0.2);
13
13
  }
14
14
  .global-hover-preview img {