@midscene/visualizer 0.6.2 → 0.6.3-beta-20241017035917.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/es/component/blackboard.js +36 -16
- package/dist/es/component/player.css +3 -1
- package/dist/es/component/player.js +4 -2
- package/dist/es/component/replay-scripts.js +12 -2
- package/dist/es/component/store.js +8 -6
- package/dist/index.css +3 -1
- package/dist/index.js +1 -1
- package/dist/lib/component/blackboard.js +36 -16
- package/dist/lib/component/player.css +3 -1
- package/dist/lib/component/player.js +4 -2
- package/dist/lib/component/replay-scripts.js +12 -2
- package/dist/lib/component/store.js +8 -6
- package/dist/report/demo-mobile.html +4 -2
- package/dist/report/demo.html +8 -4
- package/dist/report/empty-error.html +4 -2
- package/dist/report/index.css +3 -1
- package/dist/report/index.html +4 -2
- package/dist/report/index.js +1 -1
- package/dist/report/multi.html +4 -2
- package/dist/types/component/store.d.ts +2 -2
- package/package.json +2 -2
|
@@ -63,8 +63,6 @@ var import_pixi_filters = require("pixi-filters");
|
|
|
63
63
|
var import_store = require("./store");
|
|
64
64
|
const itemFillAlpha = 0.4;
|
|
65
65
|
const highlightAlpha = 0.4;
|
|
66
|
-
const bgOnAlpha = 1;
|
|
67
|
-
const bgOffAlpha = 0.3;
|
|
68
66
|
const noop = () => {
|
|
69
67
|
};
|
|
70
68
|
const rectMarkForItem = (rect, name, ifHighlight, onPointOver, onPointerOut) => {
|
|
@@ -106,7 +104,7 @@ const BlackBoard = () => {
|
|
|
106
104
|
const highlightElements = (0, import_store.useInsightDump)((store) => store.highlightElements);
|
|
107
105
|
const highlightIds = highlightElements.map((e) => e.id);
|
|
108
106
|
const { context } = dump;
|
|
109
|
-
const { size, screenshotBase64 } = context;
|
|
107
|
+
const { size, screenshotBase64, screenshotBase64WithElementMarker } = context;
|
|
110
108
|
const screenWidth = size.width;
|
|
111
109
|
const screenHeight = size.height;
|
|
112
110
|
const domRef = (0, import_react.useRef)(null);
|
|
@@ -115,7 +113,8 @@ const BlackBoard = () => {
|
|
|
115
113
|
const highlightContainer = (0, import_react.useMemo)(() => new PIXI.Container(), []);
|
|
116
114
|
const elementMarkContainer = (0, import_react.useMemo)(() => new PIXI.Container(), []);
|
|
117
115
|
const pixiBgRef = (0, import_react.useRef)();
|
|
118
|
-
const {
|
|
116
|
+
const { markerVisible, setMarkerVisible, elementsVisible, setTextsVisible } = (0, import_store.useBlackboardPreference)();
|
|
117
|
+
const ifMarkerAvailable = !!screenshotBase64WithElementMarker;
|
|
119
118
|
(0, import_react.useEffect)(() => {
|
|
120
119
|
Promise.resolve(
|
|
121
120
|
(() => __async(void 0, null, function* () {
|
|
@@ -161,14 +160,27 @@ const BlackBoard = () => {
|
|
|
161
160
|
if (!app.stage)
|
|
162
161
|
return;
|
|
163
162
|
const screenshotTexture = PIXI.Texture.from(img);
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
app.stage.addChildAt(
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
const backgroundSprite = new PIXI.Sprite(screenshotTexture);
|
|
164
|
+
backgroundSprite.x = 0;
|
|
165
|
+
backgroundSprite.y = 0;
|
|
166
|
+
backgroundSprite.width = screenWidth;
|
|
167
|
+
backgroundSprite.height = screenHeight;
|
|
168
|
+
app.stage.addChildAt(backgroundSprite, 0);
|
|
169
|
+
if (ifMarkerAvailable) {
|
|
170
|
+
const markerImg = new Image();
|
|
171
|
+
markerImg.src = screenshotBase64WithElementMarker;
|
|
172
|
+
markerImg.onload = () => {
|
|
173
|
+
const markerTexture = PIXI.Texture.from(markerImg);
|
|
174
|
+
const markerSprite = new PIXI.Sprite(markerTexture);
|
|
175
|
+
markerSprite.x = 0;
|
|
176
|
+
markerSprite.y = 0;
|
|
177
|
+
markerSprite.width = screenWidth;
|
|
178
|
+
markerSprite.height = screenHeight;
|
|
179
|
+
app.stage.addChildAt(markerSprite, 1);
|
|
180
|
+
pixiBgRef.current = markerSprite;
|
|
181
|
+
markerSprite.visible = markerVisible;
|
|
182
|
+
};
|
|
183
|
+
}
|
|
172
184
|
};
|
|
173
185
|
}, [app.stage, appInitialed]);
|
|
174
186
|
const { highlightElementRects } = (0, import_react.useMemo)(() => {
|
|
@@ -213,10 +225,10 @@ const BlackBoard = () => {
|
|
|
213
225
|
// bgVisible,
|
|
214
226
|
// elementsVisible,
|
|
215
227
|
]);
|
|
216
|
-
const
|
|
217
|
-
|
|
228
|
+
const onSetMarkerVisible = (e) => {
|
|
229
|
+
setMarkerVisible(e.target.checked);
|
|
218
230
|
if (pixiBgRef.current) {
|
|
219
|
-
pixiBgRef.current.
|
|
231
|
+
pixiBgRef.current.visible = e.target.checked;
|
|
220
232
|
}
|
|
221
233
|
};
|
|
222
234
|
const onSetElementsVisible = (e) => {
|
|
@@ -245,7 +257,15 @@ const BlackBoard = () => {
|
|
|
245
257
|
}
|
|
246
258
|
),
|
|
247
259
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "blackboard-filter", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "overlay-control", children: [
|
|
248
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
260
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
261
|
+
import_antd.Checkbox,
|
|
262
|
+
{
|
|
263
|
+
checked: markerVisible,
|
|
264
|
+
onChange: onSetMarkerVisible,
|
|
265
|
+
disabled: !ifMarkerAvailable,
|
|
266
|
+
children: "Marker"
|
|
267
|
+
}
|
|
268
|
+
),
|
|
249
269
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_antd.Checkbox, { checked: elementsVisible, onChange: onSetElementsVisible, children: "Elements" })
|
|
250
270
|
] }) }),
|
|
251
271
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "bottom-tip", children: bottomTipA })
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
width: fit-content;
|
|
3
3
|
max-width: 100%;
|
|
4
4
|
max-height: 100%;
|
|
5
|
-
padding: 12px;
|
|
5
|
+
padding: 12px 0;
|
|
6
6
|
padding-bottom: 0;
|
|
7
7
|
background: #434443DD;
|
|
8
8
|
box-sizing: border-box;
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
align-items: center;
|
|
21
21
|
justify-content: center;
|
|
22
22
|
overflow: hidden;
|
|
23
|
+
padding: 0 12px;
|
|
23
24
|
}
|
|
24
25
|
.player-container .canvas-container canvas {
|
|
25
26
|
max-width: 100%;
|
|
@@ -54,6 +55,7 @@
|
|
|
54
55
|
display: flex;
|
|
55
56
|
flex-direction: row;
|
|
56
57
|
flex-shrink: 0;
|
|
58
|
+
padding: 0 12px;
|
|
57
59
|
}
|
|
58
60
|
.player-container .player-controls .status-icon {
|
|
59
61
|
transition: 0.2s;
|
|
@@ -476,7 +476,7 @@ const Player = () => {
|
|
|
476
476
|
const totalDuration = scripts.reduce((acc, item) => {
|
|
477
477
|
return acc + item.duration + (item.insightCameraDuration || 0);
|
|
478
478
|
}, 0);
|
|
479
|
-
const progressUpdateInterval =
|
|
479
|
+
const progressUpdateInterval = 200;
|
|
480
480
|
const startTime = performance.now();
|
|
481
481
|
setAnimationProgress(0);
|
|
482
482
|
const updateProgress = () => {
|
|
@@ -485,7 +485,9 @@ const Player = () => {
|
|
|
485
485
|
1
|
|
486
486
|
);
|
|
487
487
|
setAnimationProgress(progress);
|
|
488
|
-
|
|
488
|
+
if (progress < 1) {
|
|
489
|
+
return timeout(updateProgress, progressUpdateInterval);
|
|
490
|
+
}
|
|
489
491
|
};
|
|
490
492
|
frame(updateProgress);
|
|
491
493
|
for (const index in scripts) {
|
|
@@ -44,6 +44,7 @@ module.exports = __toCommonJS(replay_scripts_exports);
|
|
|
44
44
|
var import_player = require("./player.css");
|
|
45
45
|
var import_utils = require("../utils");
|
|
46
46
|
const stillDuration = 1200;
|
|
47
|
+
const stillAfterInsightDuration = 300;
|
|
47
48
|
const locateDuration = 800;
|
|
48
49
|
const actionDuration = 1e3;
|
|
49
50
|
const clearInsightDuration = 200;
|
|
@@ -161,9 +162,18 @@ const generateAnimationScripts = (execution, imageWidth, imageHeight) => {
|
|
|
161
162
|
throw new Error("insight dump is required");
|
|
162
163
|
}
|
|
163
164
|
const insightContentLength = insightDump.context.content.length;
|
|
165
|
+
if (insightDump.context.screenshotBase64WithElementMarker) {
|
|
166
|
+
scripts.push({
|
|
167
|
+
type: "img",
|
|
168
|
+
img: insightDump.context.screenshotBase64,
|
|
169
|
+
duration: stillAfterInsightDuration,
|
|
170
|
+
title,
|
|
171
|
+
subTitle
|
|
172
|
+
});
|
|
173
|
+
}
|
|
164
174
|
scripts.push({
|
|
165
175
|
type: "insight",
|
|
166
|
-
img: insightDump.context.screenshotBase64,
|
|
176
|
+
img: insightDump.context.screenshotBase64WithElementMarker || insightDump.context.screenshotBase64,
|
|
167
177
|
insightDump,
|
|
168
178
|
camera: currentCameraState === fullPageCameraState || !insightCameraState ? void 0 : mergeTwoCameraState(currentCameraState, insightCameraState),
|
|
169
179
|
duration: insightContentLength > 20 ? locateDuration : locateDuration * 0.5,
|
|
@@ -173,7 +183,7 @@ const generateAnimationScripts = (execution, imageWidth, imageHeight) => {
|
|
|
173
183
|
});
|
|
174
184
|
scripts.push({
|
|
175
185
|
type: "sleep",
|
|
176
|
-
duration:
|
|
186
|
+
duration: stillAfterInsightDuration,
|
|
177
187
|
title,
|
|
178
188
|
subTitle
|
|
179
189
|
});
|
|
@@ -55,10 +55,10 @@ var Z = __toESM(require("zustand"));
|
|
|
55
55
|
var import_replay_scripts = require("./replay-scripts");
|
|
56
56
|
const { create } = Z;
|
|
57
57
|
const useBlackboardPreference = create((set) => ({
|
|
58
|
-
|
|
58
|
+
markerVisible: true,
|
|
59
59
|
elementsVisible: true,
|
|
60
|
-
|
|
61
|
-
set({
|
|
60
|
+
setMarkerVisible: (visible) => {
|
|
61
|
+
set({ markerVisible: visible });
|
|
62
62
|
},
|
|
63
63
|
setTextsVisible: (visible) => {
|
|
64
64
|
set({ elementsVisible: visible });
|
|
@@ -122,11 +122,13 @@ const useExecutionDump = create((set, get) => {
|
|
|
122
122
|
let height = 0;
|
|
123
123
|
dump.executions.forEach((execution) => {
|
|
124
124
|
execution.tasks.forEach((task) => {
|
|
125
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
125
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
126
126
|
if (task.type === "Insight") {
|
|
127
127
|
const insightTask = task;
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
if ((_d = (_c = (_b = (_a = insightTask.log) == null ? void 0 : _a.dump) == null ? void 0 : _b.context) == null ? void 0 : _c.size) == null ? void 0 : _d.width) {
|
|
129
|
+
width = (_h = (_g = (_f = (_e = insightTask.log) == null ? void 0 : _e.dump) == null ? void 0 : _f.context) == null ? void 0 : _g.size) == null ? void 0 : _h.width;
|
|
130
|
+
height = (_l = (_k = (_j = (_i = insightTask.log) == null ? void 0 : _i.dump) == null ? void 0 : _j.context) == null ? void 0 : _k.size) == null ? void 0 : _l.height;
|
|
131
|
+
}
|
|
130
132
|
}
|
|
131
133
|
});
|
|
132
134
|
});
|