@midscene/visualizer 0.30.10 → 1.0.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/index.css +8 -0
- package/dist/es/component/blackboard/index.mjs +137 -68
- package/dist/es/component/config-selector/index.mjs +102 -4
- package/dist/es/component/context-preview/index.mjs +1 -2
- package/dist/es/component/env-config/index.mjs +1 -2
- package/dist/es/component/env-config-reminder/index.css +8 -0
- package/dist/es/component/env-config-reminder/index.mjs +1 -2
- package/dist/es/component/form-field/index.mjs +5 -10
- package/dist/es/component/history-selector/index.css +38 -1
- package/dist/es/component/history-selector/index.mjs +1 -2
- package/dist/es/component/logo/index.mjs +7 -3
- package/dist/es/component/misc/index.mjs +1 -4
- package/dist/es/component/nav-actions/index.mjs +1 -2
- package/dist/es/component/nav-actions/style.css +1 -1
- package/dist/es/component/player/index.css +26 -0
- package/dist/es/component/player/index.mjs +376 -364
- package/dist/es/component/playground/index.css +291 -31
- package/dist/es/component/playground-result/index.css +10 -0
- package/dist/es/component/playground-result/index.mjs +129 -10
- package/dist/es/component/prompt-input/index.css +281 -31
- package/dist/es/component/prompt-input/index.mjs +83 -25
- package/dist/es/component/screenshot-viewer/index.css +214 -0
- package/dist/es/component/screenshot-viewer/index.mjs +282 -0
- package/dist/es/component/service-mode-control/index.mjs +1 -2
- package/dist/es/component/shiny-text/index.css +35 -3
- package/dist/es/component/shiny-text/index.mjs +3 -3
- package/dist/es/component/universal-playground/index.css +61 -1
- package/dist/es/component/universal-playground/index.mjs +106 -83
- package/dist/es/component/universal-playground/providers/context-provider.mjs +56 -18
- package/dist/es/component/universal-playground/providers/indexeddb-storage-provider.mjs +213 -139
- package/dist/es/component/universal-playground/providers/storage-provider.mjs +199 -121
- package/dist/es/hooks/usePlaygroundExecution.mjs +297 -146
- package/dist/es/hooks/usePlaygroundState.mjs +141 -75
- package/dist/es/hooks/useSafeOverrideAIConfig.mjs +2 -6
- package/dist/es/hooks/useServerValid.mjs +37 -12
- package/dist/es/hooks/useTheme.mjs +25 -0
- package/dist/es/icons/avatar.mjs +46 -4
- package/dist/es/icons/close.mjs +46 -4
- package/dist/es/icons/global-perspective.mjs +47 -5
- package/dist/es/icons/history.mjs +48 -6
- package/dist/es/icons/magnifying-glass.mjs +47 -5
- package/dist/es/icons/player-setting.mjs +48 -6
- package/dist/es/icons/setting.mjs +47 -5
- package/dist/es/icons/show-marker.mjs +47 -5
- package/dist/es/index.mjs +4 -4
- package/dist/es/store/history.mjs +46 -7
- package/dist/es/store/store.mjs +68 -2
- package/dist/es/types.mjs +1 -1
- package/dist/es/utils/constants.mjs +7 -3
- package/dist/es/utils/index.mjs +4 -1
- package/dist/es/utils/pixi-loader.mjs +37 -11
- package/dist/es/utils/replay-scripts.mjs +160 -111
- package/dist/lib/component/blackboard/index.css +8 -0
- package/dist/lib/component/blackboard/index.js +139 -70
- package/dist/lib/component/config-selector/index.js +103 -5
- package/dist/lib/component/context-preview/index.js +3 -4
- package/dist/lib/component/env-config/index.js +3 -4
- package/dist/lib/component/env-config-reminder/index.css +8 -0
- package/dist/lib/component/env-config-reminder/index.js +3 -4
- package/dist/lib/component/form-field/index.js +10 -15
- package/dist/lib/component/history-selector/index.css +38 -1
- package/dist/lib/component/history-selector/index.js +3 -4
- package/dist/lib/component/index.js +6 -8
- package/dist/lib/component/logo/index.js +9 -5
- package/dist/lib/component/misc/index.js +6 -9
- package/dist/lib/component/nav-actions/index.js +3 -4
- package/dist/lib/component/nav-actions/style.css +1 -1
- package/dist/lib/component/player/index.css +26 -0
- package/dist/lib/component/player/index.js +376 -365
- package/dist/lib/component/playground/index.css +291 -31
- package/dist/lib/component/playground/index.js +31 -33
- package/dist/lib/component/playground-result/index.css +10 -0
- package/dist/lib/component/playground-result/index.js +131 -12
- package/dist/lib/component/prompt-input/index.css +281 -31
- package/dist/lib/component/prompt-input/index.js +84 -26
- package/dist/lib/component/screenshot-viewer/index.css +214 -0
- package/dist/lib/component/screenshot-viewer/index.js +316 -0
- package/dist/lib/component/service-mode-control/index.js +3 -4
- package/dist/lib/component/shiny-text/index.css +35 -3
- package/dist/lib/component/shiny-text/index.js +5 -5
- package/dist/lib/component/universal-playground/index.css +61 -1
- package/dist/lib/component/universal-playground/index.js +108 -84
- package/dist/lib/component/universal-playground/providers/context-provider.js +58 -20
- package/dist/lib/component/universal-playground/providers/indexeddb-storage-provider.js +217 -143
- package/dist/lib/component/universal-playground/providers/storage-provider.js +207 -129
- package/dist/lib/hooks/usePlaygroundExecution.js +299 -148
- package/dist/lib/hooks/usePlaygroundState.js +143 -77
- package/dist/lib/hooks/useSafeOverrideAIConfig.js +4 -8
- package/dist/lib/hooks/useServerValid.js +39 -14
- package/dist/lib/hooks/useTheme.js +59 -0
- package/dist/lib/icons/avatar.js +48 -6
- package/dist/lib/icons/close.js +48 -6
- package/dist/lib/icons/global-perspective.js +49 -7
- package/dist/lib/icons/history.js +50 -8
- package/dist/lib/icons/magnifying-glass.js +49 -7
- package/dist/lib/icons/player-setting.js +50 -8
- package/dist/lib/icons/setting.js +49 -7
- package/dist/lib/icons/show-marker.js +49 -7
- package/dist/lib/index.js +44 -34
- package/dist/lib/store/history.js +48 -9
- package/dist/lib/store/store.js +74 -8
- package/dist/lib/types.js +3 -3
- package/dist/lib/utils/color.js +2 -2
- package/dist/lib/utils/constants.js +20 -4
- package/dist/lib/utils/index.js +10 -4
- package/dist/lib/utils/pixi-loader.js +41 -15
- package/dist/lib/utils/playground-utils.js +4 -4
- package/dist/lib/utils/replay-scripts.js +164 -115
- package/dist/types/component/config-selector/index.d.ts +2 -0
- package/dist/types/component/player/index.d.ts +0 -1
- package/dist/types/component/playground-result/index.d.ts +1 -0
- package/dist/types/component/prompt-input/index.d.ts +2 -1
- package/dist/types/component/screenshot-viewer/index.d.ts +15 -0
- package/dist/types/hooks/usePlaygroundExecution.d.ts +1 -1
- package/dist/types/hooks/usePlaygroundState.d.ts +3 -3
- package/dist/types/hooks/useTheme.d.ts +7 -0
- package/dist/types/index.d.ts +3 -3
- package/dist/types/store/store.d.ts +18 -1
- package/dist/types/types.d.ts +14 -4
- package/dist/types/utils/constants.d.ts +5 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/dist/types/utils/replay-scripts.d.ts +1 -1
- package/package.json +12 -22
|
@@ -1,16 +1,42 @@
|
|
|
1
1
|
import "pixi.js/unsafe-eval";
|
|
2
2
|
import { Assets } from "pixi.js";
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4
|
+
try {
|
|
5
|
+
var info = gen[key](arg);
|
|
6
|
+
var value = info.value;
|
|
7
|
+
} catch (error) {
|
|
8
|
+
reject(error);
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
if (info.done) resolve(value);
|
|
12
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
13
|
+
}
|
|
14
|
+
function _async_to_generator(fn) {
|
|
15
|
+
return function() {
|
|
16
|
+
var self = this, args = arguments;
|
|
17
|
+
return new Promise(function(resolve, reject) {
|
|
18
|
+
var gen = fn.apply(self, args);
|
|
19
|
+
function _next(value) {
|
|
20
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
21
|
+
}
|
|
22
|
+
function _throw(err) {
|
|
23
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
24
|
+
}
|
|
25
|
+
_next(void 0);
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
}
|
|
3
29
|
const globalTextureMap = new Map();
|
|
4
|
-
const loadTexture =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
30
|
+
const loadTexture = (img)=>_async_to_generator(function*() {
|
|
31
|
+
if (globalTextureMap.has(img)) return;
|
|
32
|
+
return Assets.load(img).then((texture)=>{
|
|
33
|
+
globalTextureMap.set(img, texture);
|
|
34
|
+
});
|
|
35
|
+
})();
|
|
10
36
|
const getTextureFromCache = (name)=>globalTextureMap.get(name);
|
|
11
|
-
const getTexture =
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
37
|
+
const getTexture = (name)=>_async_to_generator(function*() {
|
|
38
|
+
if (globalTextureMap.has(name)) return globalTextureMap.get(name);
|
|
39
|
+
yield loadTexture(name);
|
|
40
|
+
return globalTextureMap.get(name);
|
|
41
|
+
})();
|
|
16
42
|
export { getTexture, getTextureFromCache, loadTexture };
|
|
@@ -1,13 +1,55 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import { mousePointer } from "./index.mjs";
|
|
3
3
|
import { paramStr, typeStr } from "@midscene/core/agent";
|
|
4
|
-
|
|
4
|
+
function _define_property(obj, key, value) {
|
|
5
|
+
if (key in obj) Object.defineProperty(obj, key, {
|
|
6
|
+
value: value,
|
|
7
|
+
enumerable: true,
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true
|
|
10
|
+
});
|
|
11
|
+
else obj[key] = value;
|
|
12
|
+
return obj;
|
|
13
|
+
}
|
|
14
|
+
function _object_spread(target) {
|
|
15
|
+
for(var i = 1; i < arguments.length; i++){
|
|
16
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
17
|
+
var ownKeys = Object.keys(source);
|
|
18
|
+
if ("function" == typeof Object.getOwnPropertySymbols) ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
19
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
20
|
+
}));
|
|
21
|
+
ownKeys.forEach(function(key) {
|
|
22
|
+
_define_property(target, key, source[key]);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return target;
|
|
26
|
+
}
|
|
27
|
+
function replay_scripts_ownKeys(object, enumerableOnly) {
|
|
28
|
+
var keys = Object.keys(object);
|
|
29
|
+
if (Object.getOwnPropertySymbols) {
|
|
30
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
31
|
+
if (enumerableOnly) symbols = symbols.filter(function(sym) {
|
|
32
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
33
|
+
});
|
|
34
|
+
keys.push.apply(keys, symbols);
|
|
35
|
+
}
|
|
36
|
+
return keys;
|
|
37
|
+
}
|
|
38
|
+
function _object_spread_props(target, source) {
|
|
39
|
+
source = null != source ? source : {};
|
|
40
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
41
|
+
else replay_scripts_ownKeys(Object(source)).forEach(function(key) {
|
|
42
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
43
|
+
});
|
|
44
|
+
return target;
|
|
45
|
+
}
|
|
5
46
|
const stillDuration = 900;
|
|
6
47
|
const actionSpinningPointerDuration = 300;
|
|
7
48
|
const stillAfterInsightDuration = 300;
|
|
8
49
|
const locateDuration = 800;
|
|
9
|
-
const actionDuration =
|
|
50
|
+
const actionDuration = 500;
|
|
10
51
|
const clearInsightDuration = 200;
|
|
52
|
+
const lastFrameDuration = 200;
|
|
11
53
|
const cameraStateForRect = (rect, imageWidth, imageHeight)=>{
|
|
12
54
|
const canvasRatio = imageWidth / imageHeight;
|
|
13
55
|
const rectRatio = rect.width / rect.height;
|
|
@@ -37,17 +79,29 @@ const mergeTwoCameraState = (cameraState1, cameraState2)=>{
|
|
|
37
79
|
width: newWidth
|
|
38
80
|
};
|
|
39
81
|
};
|
|
40
|
-
const capitalizeFirstLetter = (str)=>{
|
|
41
|
-
if ('string' != typeof str || 0 === str.length) return str;
|
|
42
|
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
43
|
-
};
|
|
44
82
|
const allScriptsFromDump = (dump)=>{
|
|
83
|
+
var _normalizedDump_executions, _normalizedDump_executions1, _normalizedDump_modelBriefs;
|
|
84
|
+
if (!dump) {
|
|
85
|
+
console.warn('[allScriptsFromDump] dump is empty');
|
|
86
|
+
return {
|
|
87
|
+
scripts: [],
|
|
88
|
+
modelBriefs: []
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
const normalizedDump = Array.isArray(dump.executions) ? dump : {
|
|
92
|
+
sdkVersion: '',
|
|
93
|
+
groupName: 'Execution',
|
|
94
|
+
modelBriefs: [],
|
|
95
|
+
executions: [
|
|
96
|
+
dump
|
|
97
|
+
]
|
|
98
|
+
};
|
|
45
99
|
const dimensionsSet = new Set();
|
|
46
100
|
let firstWidth;
|
|
47
101
|
let firstHeight;
|
|
48
|
-
const sdkVersion =
|
|
102
|
+
const sdkVersion = normalizedDump.sdkVersion;
|
|
49
103
|
const modelBriefsSet = new Set();
|
|
50
|
-
|
|
104
|
+
null == (_normalizedDump_executions = normalizedDump.executions) || _normalizedDump_executions.filter(Boolean).forEach((execution)=>{
|
|
51
105
|
execution.tasks.forEach((task)=>{
|
|
52
106
|
var _task_uiContext_size, _task_uiContext;
|
|
53
107
|
if (null == (_task_uiContext = task.uiContext) ? void 0 : null == (_task_uiContext_size = _task_uiContext.size) ? void 0 : _task_uiContext_size.width) {
|
|
@@ -70,13 +124,13 @@ const allScriptsFromDump = (dump)=>{
|
|
|
70
124
|
};
|
|
71
125
|
}
|
|
72
126
|
const allScripts = [];
|
|
73
|
-
|
|
127
|
+
null == (_normalizedDump_executions1 = normalizedDump.executions) || _normalizedDump_executions1.filter(Boolean).forEach((execution)=>{
|
|
74
128
|
const scripts = generateAnimationScripts(execution, -1, firstWidth, firstHeight);
|
|
75
129
|
if (scripts) allScripts.push(...scripts);
|
|
76
130
|
execution.tasks.forEach((task)=>{
|
|
77
131
|
if (task.usage) {
|
|
78
132
|
const { model_name, model_description, intent } = task.usage;
|
|
79
|
-
if (intent && model_name) modelBriefsSet.add(model_description ? `${
|
|
133
|
+
if (intent && model_name) modelBriefsSet.add(model_description ? `${intent}/${model_name}(${model_description})` : `${intent}/${model_name}`);
|
|
80
134
|
}
|
|
81
135
|
});
|
|
82
136
|
});
|
|
@@ -84,9 +138,10 @@ const allScriptsFromDump = (dump)=>{
|
|
|
84
138
|
if (index !== allScripts.length - 1 && 'Done' === script.title) return false;
|
|
85
139
|
return true;
|
|
86
140
|
});
|
|
141
|
+
const normalizedModelBriefs = (null == (_normalizedDump_modelBriefs = normalizedDump.modelBriefs) ? void 0 : _normalizedDump_modelBriefs.length) ? normalizedDump.modelBriefs : [];
|
|
87
142
|
const modelBriefs = (()=>{
|
|
88
143
|
var _list_;
|
|
89
|
-
const list = [
|
|
144
|
+
const list = normalizedModelBriefs.length ? normalizedModelBriefs : [
|
|
90
145
|
...modelBriefsSet
|
|
91
146
|
];
|
|
92
147
|
if (!list.length) return list;
|
|
@@ -128,7 +183,7 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight)=>{
|
|
|
128
183
|
width: imageWidth,
|
|
129
184
|
height: imageHeight
|
|
130
185
|
}, imageWidth, imageHeight);
|
|
131
|
-
const
|
|
186
|
+
const setPointerScript = (img, title, subTitle)=>({
|
|
132
187
|
type: 'pointer',
|
|
133
188
|
img,
|
|
134
189
|
duration: 0,
|
|
@@ -137,22 +192,88 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight)=>{
|
|
|
137
192
|
});
|
|
138
193
|
const scripts = [];
|
|
139
194
|
let insightCameraState;
|
|
140
|
-
let currentCameraState = fullPageCameraState;
|
|
141
195
|
let insightOnTop = false;
|
|
142
|
-
|
|
196
|
+
tasksIncluded.length;
|
|
143
197
|
let initSubTitle = '';
|
|
144
198
|
let errorStateFlag = false;
|
|
145
199
|
tasksIncluded.forEach((task, index)=>{
|
|
146
200
|
if (errorStateFlag) return;
|
|
147
201
|
if (0 === index) initSubTitle = paramStr(task);
|
|
148
202
|
if ('Planning' === task.type) {
|
|
203
|
+
var _task_output;
|
|
204
|
+
let locateElements = [];
|
|
205
|
+
if ('Plan' === task.subType) {
|
|
206
|
+
var _planTask_output;
|
|
207
|
+
const planTask = task;
|
|
208
|
+
const actions = (null == (_planTask_output = planTask.output) ? void 0 : _planTask_output.actions) || [];
|
|
209
|
+
if (actions.length > 0) {
|
|
210
|
+
const action = actions[0];
|
|
211
|
+
const knownFields = [
|
|
212
|
+
'locate',
|
|
213
|
+
'start',
|
|
214
|
+
'end'
|
|
215
|
+
];
|
|
216
|
+
if (action.param) {
|
|
217
|
+
knownFields.forEach((field)=>{
|
|
218
|
+
if (action.param[field] && 'object' == typeof action.param[field] && 'center' in (action.param[field] || {})) locateElements.push(action.param[field]);
|
|
219
|
+
});
|
|
220
|
+
for(const key in action.param)if (!knownFields.includes(key)) {
|
|
221
|
+
if ('object' == typeof action.param[key] && 'center' in (action.param[key] || {})) locateElements.push(action.param[key]);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
} else if ('Locate' === task.subType && (null == (_task_output = task.output) ? void 0 : _task_output.element)) {
|
|
226
|
+
const locateTask = task;
|
|
227
|
+
locateElements = [
|
|
228
|
+
locateTask.output.element
|
|
229
|
+
];
|
|
230
|
+
}
|
|
231
|
+
const title = typeStr(task);
|
|
232
|
+
const subTitle = paramStr(task);
|
|
233
|
+
const context = task.uiContext;
|
|
234
|
+
if (null == context ? void 0 : context.screenshotBase64) {
|
|
235
|
+
var _context_size, _context_size1;
|
|
236
|
+
const width = (null == (_context_size = context.size) ? void 0 : _context_size.width) || imageWidth;
|
|
237
|
+
const height = (null == (_context_size1 = context.size) ? void 0 : _context_size1.height) || imageHeight;
|
|
238
|
+
scripts.push({
|
|
239
|
+
type: 'img',
|
|
240
|
+
img: context.screenshotBase64,
|
|
241
|
+
duration: stillAfterInsightDuration,
|
|
242
|
+
title,
|
|
243
|
+
subTitle,
|
|
244
|
+
imageWidth: width,
|
|
245
|
+
imageHeight: height
|
|
246
|
+
});
|
|
247
|
+
locateElements.forEach((element)=>{
|
|
248
|
+
var _task_log_taskInfo, _task_log, _context_size, _context_size1;
|
|
249
|
+
insightCameraState = _object_spread_props(_object_spread({}, cameraStateForRect(element.rect, width, height)), {
|
|
250
|
+
pointerLeft: element.center[0],
|
|
251
|
+
pointerTop: element.center[1]
|
|
252
|
+
});
|
|
253
|
+
const newCameraState = insightCameraState;
|
|
254
|
+
scripts.push({
|
|
255
|
+
type: 'insight',
|
|
256
|
+
img: context.screenshotBase64,
|
|
257
|
+
context: context,
|
|
258
|
+
camera: newCameraState,
|
|
259
|
+
highlightElement: element,
|
|
260
|
+
searchArea: null == (_task_log = task.log) ? void 0 : null == (_task_log_taskInfo = _task_log.taskInfo) ? void 0 : _task_log_taskInfo.searchArea,
|
|
261
|
+
duration: 0.5 * locateDuration,
|
|
262
|
+
insightCameraDuration: locateDuration,
|
|
263
|
+
title,
|
|
264
|
+
subTitle: element.description || subTitle,
|
|
265
|
+
imageWidth: (null == (_context_size = context.size) ? void 0 : _context_size.width) || imageWidth,
|
|
266
|
+
imageHeight: (null == (_context_size1 = context.size) ? void 0 : _context_size1.height) || imageHeight
|
|
267
|
+
});
|
|
268
|
+
insightOnTop = true;
|
|
269
|
+
});
|
|
270
|
+
}
|
|
149
271
|
const planningTask = task;
|
|
150
272
|
if (planningTask.recorder && planningTask.recorder.length > 0) {
|
|
151
273
|
var _planningTask_recorder_, _planningTask_recorder, _task_uiContext_size, _task_uiContext, _task_uiContext_size1, _task_uiContext1;
|
|
152
274
|
scripts.push({
|
|
153
275
|
type: 'img',
|
|
154
276
|
img: null == (_planningTask_recorder = planningTask.recorder) ? void 0 : null == (_planningTask_recorder_ = _planningTask_recorder[0]) ? void 0 : _planningTask_recorder_.screenshot,
|
|
155
|
-
camera: 0 === index ? fullPageCameraState : void 0,
|
|
156
277
|
duration: stillDuration,
|
|
157
278
|
title: typeStr(task),
|
|
158
279
|
subTitle: paramStr(task),
|
|
@@ -160,73 +281,15 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight)=>{
|
|
|
160
281
|
imageHeight: (null == (_task_uiContext1 = task.uiContext) ? void 0 : null == (_task_uiContext_size1 = _task_uiContext1.size) ? void 0 : _task_uiContext_size1.height) || imageHeight
|
|
161
282
|
});
|
|
162
283
|
}
|
|
163
|
-
} else if ('
|
|
164
|
-
var
|
|
165
|
-
const insightTask = task;
|
|
166
|
-
const resultElement = null == (_insightTask_output = insightTask.output) ? void 0 : _insightTask_output.element;
|
|
284
|
+
} else if ('Action Space' === task.type) {
|
|
285
|
+
var _task_recorder_, _task_recorder, _task_uiContext_size2, _task_uiContext2, _task_uiContext_size3, _task_uiContext3;
|
|
167
286
|
const title = typeStr(task);
|
|
168
287
|
const subTitle = paramStr(task);
|
|
169
|
-
if (null == resultElement ? void 0 : resultElement.rect) insightCameraState = {
|
|
170
|
-
...cameraStateForRect(resultElement.rect, imageWidth, imageHeight),
|
|
171
|
-
pointerLeft: resultElement.center[0],
|
|
172
|
-
pointerTop: resultElement.center[1]
|
|
173
|
-
};
|
|
174
|
-
const context = insightTask.uiContext;
|
|
175
|
-
if (null == context ? void 0 : context.screenshotBase64) {
|
|
176
|
-
var _insightTask_output1, _insightDump_taskInfo, _context_size, _context_size1;
|
|
177
|
-
const insightDump = insightTask.log;
|
|
178
|
-
const insightContentLength = context.tree ? treeToList(context.tree).length : 0;
|
|
179
|
-
if (context.screenshotBase64) {
|
|
180
|
-
var _context_size2, _context_size3;
|
|
181
|
-
scripts.push({
|
|
182
|
-
type: 'img',
|
|
183
|
-
img: context.screenshotBase64,
|
|
184
|
-
duration: stillAfterInsightDuration,
|
|
185
|
-
title,
|
|
186
|
-
subTitle,
|
|
187
|
-
imageWidth: (null == (_context_size2 = context.size) ? void 0 : _context_size2.width) || imageWidth,
|
|
188
|
-
imageHeight: (null == (_context_size3 = context.size) ? void 0 : _context_size3.height) || imageHeight
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
let cameraState;
|
|
192
|
-
cameraState = currentCameraState === fullPageCameraState ? void 0 : insightCameraState ? mergeTwoCameraState(currentCameraState, insightCameraState) : void 0;
|
|
193
|
-
scripts.push({
|
|
194
|
-
type: 'insight',
|
|
195
|
-
img: context.screenshotBase64,
|
|
196
|
-
context: context,
|
|
197
|
-
camera: cameraState,
|
|
198
|
-
highlightElement: (null == (_insightTask_output1 = insightTask.output) ? void 0 : _insightTask_output1.element) || void 0,
|
|
199
|
-
searchArea: null == insightDump ? void 0 : null == (_insightDump_taskInfo = insightDump.taskInfo) ? void 0 : _insightDump_taskInfo.searchArea,
|
|
200
|
-
duration: insightContentLength > 20 ? locateDuration : 0.5 * locateDuration,
|
|
201
|
-
insightCameraDuration: locateDuration,
|
|
202
|
-
title,
|
|
203
|
-
subTitle,
|
|
204
|
-
imageWidth: (null == (_context_size = context.size) ? void 0 : _context_size.width) || imageWidth,
|
|
205
|
-
imageHeight: (null == (_context_size1 = context.size) ? void 0 : _context_size1.height) || imageHeight
|
|
206
|
-
});
|
|
207
|
-
scripts.push({
|
|
208
|
-
type: 'sleep',
|
|
209
|
-
duration: stillAfterInsightDuration,
|
|
210
|
-
title,
|
|
211
|
-
subTitle
|
|
212
|
-
});
|
|
213
|
-
insightOnTop = true;
|
|
214
|
-
}
|
|
215
|
-
} else if ('Action' === task.type && 'FalsyConditionStatement' !== task.subType) {
|
|
216
|
-
var _task_recorder_, _task_recorder, _task_uiContext_size2, _task_uiContext2, _task_uiContext_size3, _task_uiContext3, _task_recorder_1, _task_recorder1;
|
|
217
|
-
const title = typeStr(task);
|
|
218
|
-
const subTitle = paramStr(task);
|
|
219
|
-
scripts.push(pointerScript(mousePointer, title, subTitle));
|
|
220
|
-
currentCameraState = null != insightCameraState ? insightCameraState : fullPageCameraState;
|
|
221
288
|
scripts.push({
|
|
222
|
-
type: '
|
|
223
|
-
|
|
224
|
-
duration: actionDuration,
|
|
225
|
-
camera: 'Sleep' === task.subType ? fullPageCameraState : insightCameraState,
|
|
289
|
+
type: 'spinning-pointer',
|
|
290
|
+
duration: actionSpinningPointerDuration,
|
|
226
291
|
title,
|
|
227
|
-
subTitle
|
|
228
|
-
imageWidth: (null == (_task_uiContext2 = task.uiContext) ? void 0 : null == (_task_uiContext_size2 = _task_uiContext2.size) ? void 0 : _task_uiContext_size2.width) || imageWidth,
|
|
229
|
-
imageHeight: (null == (_task_uiContext3 = task.uiContext) ? void 0 : null == (_task_uiContext_size3 = _task_uiContext3.size) ? void 0 : _task_uiContext_size3.height) || imageHeight
|
|
292
|
+
subTitle
|
|
230
293
|
});
|
|
231
294
|
if (insightOnTop) {
|
|
232
295
|
scripts.push({
|
|
@@ -237,38 +300,24 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight)=>{
|
|
|
237
300
|
});
|
|
238
301
|
insightOnTop = false;
|
|
239
302
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
title,
|
|
247
|
-
subTitle
|
|
248
|
-
});
|
|
249
|
-
scripts.push(pointerScript(mousePointer, title, subTitle));
|
|
250
|
-
scripts.push({
|
|
251
|
-
type: 'img',
|
|
252
|
-
img: null == (_task_recorder2 = task.recorder) ? void 0 : null == (_task_recorder_2 = _task_recorder2[1]) ? void 0 : _task_recorder_2.screenshot,
|
|
253
|
-
duration: imgStillDuration,
|
|
254
|
-
title,
|
|
255
|
-
subTitle,
|
|
256
|
-
imageWidth: (null == (_task_uiContext4 = task.uiContext) ? void 0 : null == (_task_uiContext_size4 = _task_uiContext4.size) ? void 0 : _task_uiContext_size4.width) || imageWidth,
|
|
257
|
-
imageHeight: (null == (_task_uiContext5 = task.uiContext) ? void 0 : null == (_task_uiContext_size5 = _task_uiContext5.size) ? void 0 : _task_uiContext_size5.height) || imageHeight
|
|
258
|
-
});
|
|
259
|
-
} else scripts.push({
|
|
260
|
-
type: 'sleep',
|
|
261
|
-
duration: imgStillDuration,
|
|
303
|
+
scripts.push(setPointerScript(mousePointer, title, subTitle));
|
|
304
|
+
scripts.push({
|
|
305
|
+
type: 'img',
|
|
306
|
+
img: null == (_task_recorder = task.recorder) ? void 0 : null == (_task_recorder_ = _task_recorder[0]) ? void 0 : _task_recorder_.screenshot,
|
|
307
|
+
duration: actionDuration,
|
|
308
|
+
camera: 'Sleep' === task.subType ? fullPageCameraState : void 0,
|
|
262
309
|
title,
|
|
263
|
-
subTitle
|
|
310
|
+
subTitle,
|
|
311
|
+
imageWidth: (null == (_task_uiContext2 = task.uiContext) ? void 0 : null == (_task_uiContext_size2 = _task_uiContext2.size) ? void 0 : _task_uiContext_size2.width) || imageWidth,
|
|
312
|
+
imageHeight: (null == (_task_uiContext3 = task.uiContext) ? void 0 : null == (_task_uiContext_size3 = _task_uiContext3.size) ? void 0 : _task_uiContext_size3.height) || imageHeight
|
|
264
313
|
});
|
|
265
314
|
} else {
|
|
266
|
-
var
|
|
315
|
+
var _task_recorder_1, _task_recorder1;
|
|
267
316
|
const title = typeStr(task);
|
|
268
317
|
const subTitle = paramStr(task);
|
|
269
|
-
const screenshot = null == (
|
|
318
|
+
const screenshot = null == (_task_recorder1 = task.recorder) ? void 0 : null == (_task_recorder_1 = _task_recorder1[task.recorder.length - 1]) ? void 0 : _task_recorder_1.screenshot;
|
|
270
319
|
if (screenshot) {
|
|
271
|
-
var
|
|
320
|
+
var _task_uiContext_size4, _task_uiContext4, _task_uiContext_size5, _task_uiContext5;
|
|
272
321
|
scripts.push({
|
|
273
322
|
type: 'img',
|
|
274
323
|
img: screenshot,
|
|
@@ -276,13 +325,13 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight)=>{
|
|
|
276
325
|
camera: fullPageCameraState,
|
|
277
326
|
title,
|
|
278
327
|
subTitle,
|
|
279
|
-
imageWidth: (null == (
|
|
280
|
-
imageHeight: (null == (
|
|
328
|
+
imageWidth: (null == (_task_uiContext4 = task.uiContext) ? void 0 : null == (_task_uiContext_size4 = _task_uiContext4.size) ? void 0 : _task_uiContext_size4.width) || imageWidth,
|
|
329
|
+
imageHeight: (null == (_task_uiContext5 = task.uiContext) ? void 0 : null == (_task_uiContext_size5 = _task_uiContext5.size) ? void 0 : _task_uiContext_size5.height) || imageHeight
|
|
281
330
|
});
|
|
282
331
|
}
|
|
283
332
|
}
|
|
284
333
|
if ('finished' !== task.status) {
|
|
285
|
-
var
|
|
334
|
+
var _task_uiContext_size6, _task_uiContext6, _task_uiContext_size7, _task_uiContext7;
|
|
286
335
|
errorStateFlag = true;
|
|
287
336
|
const errorTitle = typeStr(task);
|
|
288
337
|
const errorMsg = task.errorMessage || 'unknown error';
|
|
@@ -294,8 +343,8 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight)=>{
|
|
|
294
343
|
duration: stillDuration,
|
|
295
344
|
title: errorTitle,
|
|
296
345
|
subTitle: errorSubTitle,
|
|
297
|
-
imageWidth: (null == (
|
|
298
|
-
imageHeight: (null == (
|
|
346
|
+
imageWidth: (null == (_task_uiContext6 = task.uiContext) ? void 0 : null == (_task_uiContext_size6 = _task_uiContext6.size) ? void 0 : _task_uiContext_size6.width) || imageWidth,
|
|
347
|
+
imageHeight: (null == (_task_uiContext7 = task.uiContext) ? void 0 : null == (_task_uiContext_size7 = _task_uiContext7.size) ? void 0 : _task_uiContext_size7.height) || imageHeight
|
|
299
348
|
});
|
|
300
349
|
return;
|
|
301
350
|
}
|
|
@@ -304,7 +353,7 @@ const generateAnimationScripts = (execution, task, imageWidth, imageHeight)=>{
|
|
|
304
353
|
title: 'Done',
|
|
305
354
|
subTitle: initSubTitle,
|
|
306
355
|
type: 'img',
|
|
307
|
-
duration:
|
|
356
|
+
duration: lastFrameDuration,
|
|
308
357
|
camera: fullPageCameraState
|
|
309
358
|
});
|
|
310
359
|
return scripts;
|
|
@@ -31,3 +31,11 @@
|
|
|
31
31
|
width: 100%;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
[data-theme="dark"] .blackboard .footer, [data-theme="dark"] .blackboard .bottom-tip-item {
|
|
35
|
+
color: rgba(255, 255, 255, .45);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[data-theme="dark"] .blackboard-main-content canvas {
|
|
39
|
+
border-color: rgba(255, 255, 255, .12);
|
|
40
|
+
}
|
|
41
|
+
|