@midscene/visualizer 0.0.1

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 (92) hide show
  1. package/.eslintrc.js +9 -0
  2. package/README.md +24 -0
  3. package/dist/es/assets/logo-plain.16842bbc.svg +70 -0
  4. package/dist/es/assets/logo-plain2.16842bbc.svg +70 -0
  5. package/dist/es/component/blackboard.css +25 -0
  6. package/dist/es/component/blackboard.js +256 -0
  7. package/dist/es/component/color.js +34 -0
  8. package/dist/es/component/common.css +0 -0
  9. package/dist/es/component/detail-panel.css +34 -0
  10. package/dist/es/component/detail-panel.js +106 -0
  11. package/dist/es/component/detail-side.css +99 -0
  12. package/dist/es/component/detail-side.js +285 -0
  13. package/dist/es/component/global-hover-preview.css +19 -0
  14. package/dist/es/component/global-hover-preview.js +44 -0
  15. package/dist/es/component/misc.js +24 -0
  16. package/dist/es/component/panel-title.css +8 -0
  17. package/dist/es/component/panel-title.js +9 -0
  18. package/dist/es/component/side-item.js +0 -0
  19. package/dist/es/component/sidebar.css +87 -0
  20. package/dist/es/component/sidebar.js +175 -0
  21. package/dist/es/component/store.js +128 -0
  22. package/dist/es/component/timeline.css +18 -0
  23. package/dist/es/component/timeline.js +438 -0
  24. package/dist/es/index.css +89 -0
  25. package/dist/es/index.js +174 -0
  26. package/dist/es/utils.js +76 -0
  27. package/dist/lib/assets/logo-plain.16842bbc.svg +70 -0
  28. package/dist/lib/assets/logo-plain2.16842bbc.svg +70 -0
  29. package/dist/lib/component/blackboard.css +25 -0
  30. package/dist/lib/component/blackboard.js +286 -0
  31. package/dist/lib/component/color.js +59 -0
  32. package/dist/lib/component/common.css +0 -0
  33. package/dist/lib/component/detail-panel.css +34 -0
  34. package/dist/lib/component/detail-panel.js +136 -0
  35. package/dist/lib/component/detail-side.css +99 -0
  36. package/dist/lib/component/detail-side.js +313 -0
  37. package/dist/lib/component/global-hover-preview.css +19 -0
  38. package/dist/lib/component/global-hover-preview.js +64 -0
  39. package/dist/lib/component/misc.js +48 -0
  40. package/dist/lib/component/panel-title.css +8 -0
  41. package/dist/lib/component/panel-title.js +29 -0
  42. package/dist/lib/component/side-item.js +1 -0
  43. package/dist/lib/component/sidebar.css +87 -0
  44. package/dist/lib/component/sidebar.js +198 -0
  45. package/dist/lib/component/store.js +153 -0
  46. package/dist/lib/component/timeline.css +18 -0
  47. package/dist/lib/component/timeline.js +466 -0
  48. package/dist/lib/index.css +89 -0
  49. package/dist/lib/index.js +202 -0
  50. package/dist/lib/utils.js +111 -0
  51. package/dist/types/component/blackboard.d.ts +4 -0
  52. package/dist/types/component/color.d.ts +2 -0
  53. package/dist/types/component/detail-panel.d.ts +4 -0
  54. package/dist/types/component/detail-side.d.ts +4 -0
  55. package/dist/types/component/global-hover-preview.d.ts +4 -0
  56. package/dist/types/component/misc.d.ts +2 -0
  57. package/dist/types/component/panel-title.d.ts +6 -0
  58. package/dist/types/component/side-item.d.ts +0 -0
  59. package/dist/types/component/sidebar.d.ts +4 -0
  60. package/dist/types/component/store.d.ts +35 -0
  61. package/dist/types/component/timeline.d.ts +4 -0
  62. package/dist/types/index.d.ts +4 -0
  63. package/dist/types/utils.d.ts +5 -0
  64. package/docs/index.tsx +6 -0
  65. package/modern.config.ts +15 -0
  66. package/package.json +46 -0
  67. package/src/component/assets/logo-plain.svg +70 -0
  68. package/src/component/assets/logo-plain2.svg +70 -0
  69. package/src/component/blackboard.less +37 -0
  70. package/src/component/blackboard.tsx +293 -0
  71. package/src/component/color.tsx +34 -0
  72. package/src/component/common.less +21 -0
  73. package/src/component/detail-panel.less +47 -0
  74. package/src/component/detail-panel.tsx +124 -0
  75. package/src/component/detail-side.less +131 -0
  76. package/src/component/detail-side.tsx +361 -0
  77. package/src/component/global-hover-preview.less +23 -0
  78. package/src/component/global-hover-preview.tsx +50 -0
  79. package/src/component/misc.tsx +20 -0
  80. package/src/component/panel-title.less +11 -0
  81. package/src/component/panel-title.tsx +11 -0
  82. package/src/component/side-item.tsx +0 -0
  83. package/src/component/sidebar.less +122 -0
  84. package/src/component/sidebar.tsx +205 -0
  85. package/src/component/store.tsx +151 -0
  86. package/src/component/timeline.less +25 -0
  87. package/src/component/timeline.tsx +486 -0
  88. package/src/global.d.ts +11 -0
  89. package/src/index.less +113 -0
  90. package/src/index.tsx +210 -0
  91. package/src/utils.ts +58 -0
  92. package/tsconfig.json +24 -0
@@ -0,0 +1,8 @@
1
+ .task-list-name {
2
+ padding: 2px 10px;
3
+ font-weight: bold;
4
+ background: #DDDDDD;
5
+ border-top: 1px solid #CCCCCC;
6
+ border-bottom: 1px solid #CCCCCC;
7
+ margin-top: -1px;
8
+ }
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var panel_title_exports = {};
20
+ __export(panel_title_exports, {
21
+ default: () => panel_title_default
22
+ });
23
+ module.exports = __toCommonJS(panel_title_exports);
24
+ var import_jsx_runtime = require("react/jsx-runtime");
25
+ var import_panel_title = require("./panel-title.css");
26
+ const PanelTitle = (props) => {
27
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "task-list-name", children: props.title }) });
28
+ };
29
+ var panel_title_default = PanelTitle;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,87 @@
1
+ .side-bar {
2
+ display: flex;
3
+ flex-direction: column;
4
+ justify-content: space-between;
5
+ width: 100%;
6
+ height: 100%;
7
+ border-right: 1px solid #CCCCCC;
8
+ overflow: auto;
9
+ background: #ECECEC;
10
+ }
11
+ .side-bar .brand {
12
+ padding: 10px 5px;
13
+ cursor: pointer;
14
+ }
15
+ .side-bar .task-meta-section {
16
+ margin-top: 6px;
17
+ }
18
+ .side-bar .task-meta {
19
+ color: #777;
20
+ font-weight: normal;
21
+ padding-left: 10px;
22
+ }
23
+ .side-bar .side-seperator {
24
+ border-top: 1px solid none;
25
+ }
26
+ .side-bar .side-seperator.side-seperator-line {
27
+ border-top: 1px solid #CCCCCC;
28
+ }
29
+ .side-bar .side-seperator.side-seperator-space-up {
30
+ margin-top: 10px;
31
+ }
32
+ .side-bar .side-seperator.side-seperator-space-down {
33
+ margin-bottom: 10px;
34
+ }
35
+ .side-bar .side-sub-title {
36
+ padding: 0 10px;
37
+ font-weight: bold;
38
+ }
39
+ .side-bar .side-item {
40
+ cursor: pointer;
41
+ transition: 0.1s;
42
+ padding: 2px 0;
43
+ }
44
+ .side-bar .side-item:hover {
45
+ background: #A3D6D2;
46
+ color: #333;
47
+ }
48
+ .side-bar .side-item.selected {
49
+ background: #06B1AB;
50
+ color: #ffffff;
51
+ }
52
+ .side-bar .side-item.selected .status-text {
53
+ color: #ffffff;
54
+ }
55
+ .side-bar .side-item .side-item-content {
56
+ padding: 0 10px 0 calc(10px + 16px);
57
+ }
58
+ .side-bar .side-item-name {
59
+ padding: 0 10px 0 calc(10px + 16px);
60
+ position: relative;
61
+ display: flex;
62
+ justify-content: space-between;
63
+ }
64
+ .side-bar .side-item-name .status-icon {
65
+ position: absolute;
66
+ left: 10px;
67
+ display: inline-block;
68
+ color: #AAA;
69
+ font-size: 10px;
70
+ line-height: 10px;
71
+ top: 50%;
72
+ margin-top: -5px;
73
+ }
74
+ .side-bar .side-item-name .status-icon-success {
75
+ color: #3a773a;
76
+ }
77
+ .side-bar .side-item-name .status-icon-fail {
78
+ color: #ff0a0a;
79
+ }
80
+ .side-bar .side-item-name .status-text {
81
+ color: #777;
82
+ }
83
+ .side-bar .bottom-controls {
84
+ padding: 10px 10px;
85
+ text-align: left;
86
+ text-align: center;
87
+ }
@@ -0,0 +1,198 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var sidebar_exports = {};
30
+ __export(sidebar_exports, {
31
+ default: () => sidebar_default
32
+ });
33
+ module.exports = __toCommonJS(sidebar_exports);
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ var import_sidebar = require("./sidebar.css");
36
+ var import_react = require("react");
37
+ var import_icons = require("@ant-design/icons");
38
+ var import_antd = require("antd");
39
+ var import_panel_title = __toESM(require("./panel-title"));
40
+ var import_misc = require("./misc");
41
+ var import_logo_plain2_16842bbc = __toESM(require("../assets/logo-plain2.16842bbc.svg"));
42
+ var import_store = require("./store");
43
+ var import_utils = require("../utils");
44
+ const SideItem = (props) => {
45
+ var _a, _b;
46
+ const { task, onClick, selected } = props;
47
+ const selectedClass = selected ? "selected" : "";
48
+ let statusIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.MinusOutlined, {});
49
+ if (task.status === "success") {
50
+ statusIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CheckOutlined, {});
51
+ } else if (task.status === "fail") {
52
+ statusIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.CloseOutlined, {});
53
+ } else if (task.status === "pending") {
54
+ statusIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ClockCircleOutlined, {});
55
+ } else if (task.status === "cancelled") {
56
+ statusIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.LogoutOutlined, {});
57
+ } else if (task.status === "running") {
58
+ statusIcon = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icons.ArrowRightOutlined, {});
59
+ }
60
+ let statusText = task.status;
61
+ if ((_a = task.timing) == null ? void 0 : _a.cost) {
62
+ statusText = (0, import_misc.timeCostStrElement)(task.timing.cost);
63
+ }
64
+ const contentRow = task.type === "Planning" ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "side-item-content", children: [
65
+ (_b = task.param) == null ? void 0 : _b.userPrompt,
66
+ " "
67
+ ] }) : null;
68
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
69
+ "div",
70
+ {
71
+ className: `side-item ${selectedClass}`,
72
+ onClick,
73
+ onMouseEnter: (event) => {
74
+ var _a2;
75
+ const rect = event.currentTarget.getBoundingClientRect();
76
+ const x = rect.left + rect.width;
77
+ const y = rect.top;
78
+ (_a2 = props.onItemHover) == null ? void 0 : _a2.call(props, task, x, y);
79
+ },
80
+ onMouseLeave: () => {
81
+ var _a2;
82
+ (_a2 = props.onItemHover) == null ? void 0 : _a2.call(props, null);
83
+ },
84
+ children: [
85
+ " ",
86
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: `side-item-name`, children: [
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `status-icon status-icon-${task.status}`, children: statusIcon }),
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "title", children: (0, import_utils.typeStr)(task) }),
89
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "status-text", children: statusText })
90
+ ] }),
91
+ contentRow
92
+ ]
93
+ }
94
+ );
95
+ };
96
+ const Sidebar = () => {
97
+ const groupedDumps = (0, import_store.useExecutionDump)((store) => store.dump);
98
+ const setActiveTask = (0, import_store.useExecutionDump)((store) => store.setActiveTask);
99
+ const activeTask = (0, import_store.useExecutionDump)((store) => store.activeTask);
100
+ const setHoverTask = (0, import_store.useExecutionDump)((store) => store.setHoverTask);
101
+ const setHoverPreviewConfig = (0, import_store.useExecutionDump)((store) => store.setHoverPreviewConfig);
102
+ const reset = (0, import_store.useExecutionDump)((store) => store.reset);
103
+ const allTasks = (0, import_store.useAllCurrentTasks)();
104
+ const currentSelectedIndex = allTasks == null ? void 0 : allTasks.findIndex((task) => task === activeTask);
105
+ (0, import_react.useEffect)(() => {
106
+ const handleKeyDown = (e) => {
107
+ if (!(allTasks == null ? void 0 : allTasks.length) || (allTasks == null ? void 0 : allTasks.length) <= 1) {
108
+ return;
109
+ }
110
+ if (e.key === "ArrowUp" && (e.metaKey || e.ctrlKey)) {
111
+ e.preventDefault();
112
+ const nextIndex = currentSelectedIndex - 1;
113
+ if (nextIndex < 0) {
114
+ return;
115
+ }
116
+ const nextTask = allTasks[nextIndex];
117
+ setActiveTask(nextTask);
118
+ } else if (e.key === "ArrowDown" && (e.metaKey || e.ctrlKey)) {
119
+ e.preventDefault();
120
+ const nextIndex = currentSelectedIndex + 1;
121
+ if (nextIndex >= allTasks.length) {
122
+ return;
123
+ }
124
+ const nextTask = allTasks[nextIndex];
125
+ setActiveTask(nextTask);
126
+ }
127
+ };
128
+ document.addEventListener("keydown", handleKeyDown);
129
+ return () => {
130
+ document.removeEventListener("keydown", handleKeyDown);
131
+ };
132
+ }, [currentSelectedIndex, allTasks, setActiveTask]);
133
+ const sideList = (groupedDumps == null ? void 0 : groupedDumps.length) ? groupedDumps.map((group, groupIndex) => {
134
+ const executions = group.executions.map((execution, indexOfExecution) => {
135
+ const { tasks } = execution;
136
+ const taskList = tasks.map((task, index) => {
137
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
+ SideItem,
139
+ {
140
+ task,
141
+ selected: task === activeTask,
142
+ onClick: () => {
143
+ setActiveTask(task);
144
+ },
145
+ onItemHover: (hoverTask, x, y) => {
146
+ if (hoverTask && x && y) {
147
+ setHoverPreviewConfig({ x, y });
148
+ setHoverTask(hoverTask);
149
+ } else {
150
+ setHoverPreviewConfig(null);
151
+ setHoverTask(null);
152
+ }
153
+ }
154
+ },
155
+ index
156
+ );
157
+ });
158
+ let seperator;
159
+ switch (indexOfExecution) {
160
+ case 0:
161
+ seperator = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "side-seperator side-seperator-space-up" });
162
+ break;
163
+ default:
164
+ seperator = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "side-seperator side-seperator-line side-seperator-space-up side-seperator-space-down" });
165
+ break;
166
+ }
167
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
168
+ seperator,
169
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "side-sub-title", children: execution.name }),
170
+ taskList
171
+ ] }, indexOfExecution);
172
+ });
173
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
174
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_panel_title.default, { title: group.groupName }),
175
+ executions
176
+ ] }, groupIndex);
177
+ }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "no tasks" });
178
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "side-bar", children: [
179
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "top-controls", children: [
180
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "brand", onClick: reset, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
181
+ "img",
182
+ {
183
+ src: import_logo_plain2_16842bbc.default,
184
+ alt: "Logo",
185
+ style: { width: 70, height: 70, margin: "auto" },
186
+ onClick: () => {
187
+ location.reload();
188
+ }
189
+ }
190
+ ) }),
191
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "task-list", children: sideList }),
192
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "side-seperator side-seperator-line side-seperator-space-up" }),
193
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "task-meta-section", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "task-meta", children: "use Command + ⬆︎ / ⬇︎ to switch" }) })
194
+ ] }),
195
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bottom-controls", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Button, { onClick: reset, type: "text", className: "unload_btn", children: "Unload" }) })
196
+ ] });
197
+ };
198
+ var sidebar_default = Sidebar;
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
+ var __spreadValues = (a, b) => {
12
+ for (var prop in b || (b = {}))
13
+ if (__hasOwnProp.call(b, prop))
14
+ __defNormalProp(a, prop, b[prop]);
15
+ if (__getOwnPropSymbols)
16
+ for (var prop of __getOwnPropSymbols(b)) {
17
+ if (__propIsEnum.call(b, prop))
18
+ __defNormalProp(a, prop, b[prop]);
19
+ }
20
+ return a;
21
+ };
22
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __export = (target, all) => {
24
+ for (var name in all)
25
+ __defProp(target, name, { get: all[name], enumerable: true });
26
+ };
27
+ var __copyProps = (to, from, except, desc) => {
28
+ if (from && typeof from === "object" || typeof from === "function") {
29
+ for (let key of __getOwnPropNames(from))
30
+ if (!__hasOwnProp.call(to, key) && key !== except)
31
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
32
+ }
33
+ return to;
34
+ };
35
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
36
+ var store_exports = {};
37
+ __export(store_exports, {
38
+ useAllCurrentTasks: () => useAllCurrentTasks,
39
+ useBlackboardPreference: () => useBlackboardPreference,
40
+ useExecutionDump: () => useExecutionDump,
41
+ useInsightDump: () => useInsightDump
42
+ });
43
+ module.exports = __toCommonJS(store_exports);
44
+ var import_zustand = require("zustand");
45
+ const useBlackboardPreference = (0, import_zustand.create)((set) => ({
46
+ bgVisible: false,
47
+ textsVisible: true,
48
+ setBgVisible: (visible) => {
49
+ set({ bgVisible: visible });
50
+ },
51
+ setTextsVisible: (visible) => {
52
+ set({ textsVisible: visible });
53
+ }
54
+ }));
55
+ const useExecutionDump = (0, import_zustand.create)((set) => {
56
+ const initData = {
57
+ dump: null,
58
+ activeTask: null,
59
+ hoverTask: null,
60
+ hoverPreviewConfig: null
61
+ };
62
+ const syncToInsightDump = (dump) => {
63
+ const { loadData } = useInsightDump.getState();
64
+ loadData(dump);
65
+ };
66
+ const resetInsightDump = () => {
67
+ const { reset } = useInsightDump.getState();
68
+ reset();
69
+ };
70
+ return __spreadProps(__spreadValues({}, initData), {
71
+ setGroupedDump: (dump) => {
72
+ console.log("will set ExecutionDump", dump);
73
+ set({
74
+ dump
75
+ });
76
+ for (const item of dump) {
77
+ if (item.executions.length > 0 && item.executions[0].tasks.length > 0) {
78
+ set({ activeTask: item.executions[0].tasks[0] });
79
+ break;
80
+ }
81
+ }
82
+ },
83
+ setActiveTask(task) {
84
+ var _a, _b;
85
+ set({ activeTask: task });
86
+ if ((_b = (_a = task.log) == null ? void 0 : _a.dump) == null ? void 0 : _b.matchedElement) {
87
+ syncToInsightDump(task.log.dump);
88
+ } else {
89
+ resetInsightDump();
90
+ }
91
+ },
92
+ setHoverTask(task) {
93
+ set({ hoverTask: task });
94
+ },
95
+ setHoverPreviewConfig(config) {
96
+ if (config) {
97
+ set({
98
+ hoverPreviewConfig: {
99
+ x: Math.floor(config.x),
100
+ y: Math.floor(config.y)
101
+ }
102
+ });
103
+ } else {
104
+ set({ hoverPreviewConfig: null });
105
+ }
106
+ },
107
+ reset: () => {
108
+ set(initData);
109
+ resetInsightDump();
110
+ }
111
+ });
112
+ });
113
+ const useAllCurrentTasks = () => {
114
+ const groupedDumps = useExecutionDump((store) => store.dump);
115
+ const allTasks = (groupedDumps == null ? void 0 : groupedDumps.reduce((acc, group) => {
116
+ const tasksInside = group.executions.reduce(
117
+ (acc2, execution) => acc2.concat(execution.tasks),
118
+ []
119
+ );
120
+ return acc.concat(tasksInside);
121
+ }, [])) || [];
122
+ return allTasks;
123
+ };
124
+ const useInsightDump = (0, import_zustand.create)((set) => {
125
+ let loadId = 0;
126
+ const initData = { _loadId: 0, highlightSectionNames: [], highlightElements: [], data: null };
127
+ return __spreadProps(__spreadValues({}, initData), {
128
+ loadData: (data) => {
129
+ set({
130
+ _loadId: ++loadId,
131
+ data,
132
+ highlightSectionNames: [],
133
+ highlightElements: []
134
+ });
135
+ },
136
+ setHighlightSectionNames: (sections) => {
137
+ set({ highlightSectionNames: sections });
138
+ },
139
+ setHighlightElements: (elements) => {
140
+ set({ highlightElements: elements });
141
+ },
142
+ reset: () => {
143
+ set(initData);
144
+ }
145
+ });
146
+ });
147
+ // Annotate the CommonJS export names for ESM import in node:
148
+ 0 && (module.exports = {
149
+ useAllCurrentTasks,
150
+ useBlackboardPreference,
151
+ useExecutionDump,
152
+ useInsightDump
153
+ });
@@ -0,0 +1,18 @@
1
+ .timeline-wrapper {
2
+ flex-basis: 110px;
3
+ flex-grow: 0;
4
+ flex-shrink: 0;
5
+ width: 100%;
6
+ height: 100%;
7
+ border-bottom: 1px solid #CCCCCC;
8
+ position: relative;
9
+ box-sizing: border-box;
10
+ }
11
+ .timeline-wrapper .timeline-canvas-wrapper {
12
+ width: 100%;
13
+ height: 100%;
14
+ }
15
+ .timeline-wrapper canvas {
16
+ width: 100%;
17
+ height: 100%;
18
+ }