@midscene/visualizer 0.29.2-beta-20250925081422.0 → 0.29.3-beta-20250925084104.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.
@@ -126,6 +126,12 @@ function Player(props) {
126
126
  null == props ? void 0 : props.autoZoom,
127
127
  setAutoZoom
128
128
  ]);
129
+ useEffect(()=>{
130
+ if ((null == props ? void 0 : props.elementsVisible) !== void 0) setElementsVisible(props.elementsVisible);
131
+ }, [
132
+ null == props ? void 0 : props.elementsVisible,
133
+ setElementsVisible
134
+ ]);
129
135
  const scripts = null == props ? void 0 : props.replayScripts;
130
136
  const imageWidth = (null == props ? void 0 : props.imageWidth) || 1920;
131
137
  const imageHeight = (null == props ? void 0 : props.imageHeight) || 1080;
@@ -745,7 +751,7 @@ function Player(props) {
745
751
  fontSize: '12px',
746
752
  marginRight: '16px'
747
753
  },
748
- children: "Focus on Cursor"
754
+ children: "Focus on cursor"
749
755
  })
750
756
  ]
751
757
  }),
@@ -798,7 +804,7 @@ function Player(props) {
798
804
  fontSize: '12px',
799
805
  marginRight: '16px'
800
806
  },
801
- children: "Show Element Markers"
807
+ children: "Show element markers"
802
808
  })
803
809
  ]
804
810
  }),
@@ -1,11 +1,8 @@
1
1
  import { useCallback } from "react";
2
2
  import { useEnvConfig } from "../store/store.mjs";
3
+ import { noReplayAPIs } from "@midscene/playground";
3
4
  import { BLANK_RESULT } from "../utils/constants.mjs";
4
5
  import { allScriptsFromDump } from "../utils/replay-scripts.mjs";
5
- const noReplayAPIs = [
6
- 'aiQuery',
7
- 'aiAssert'
8
- ];
9
6
  function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, setLoading, infoList, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef) {
10
7
  const { deepThink, screenshotIncluded, domIncluded } = useEnvConfig();
11
8
  const handleRun = useCallback(async (value)=>{
@@ -30,14 +30,37 @@ const { create: store_create } = external_zustand_namespaceObject;
30
30
  const AUTO_ZOOM_KEY = 'midscene-auto-zoom';
31
31
  const BACKGROUND_VISIBLE_KEY = 'midscene-background-visible';
32
32
  const ELEMENTS_VISIBLE_KEY = 'midscene-elements-visible';
33
+ const parseBooleanParam = (value)=>{
34
+ if (null === value) return;
35
+ const normalized = value.trim().toLowerCase();
36
+ if ([
37
+ '1',
38
+ 'true',
39
+ 'yes',
40
+ 'on'
41
+ ].includes(normalized)) return true;
42
+ if ([
43
+ '0',
44
+ 'false',
45
+ 'no',
46
+ 'off'
47
+ ].includes(normalized)) return false;
48
+ };
49
+ const getQueryPreference = (paramName)=>{
50
+ if ('undefined' == typeof window) return;
51
+ const searchParams = new URLSearchParams(window.location.search);
52
+ return parseBooleanParam(searchParams.get(paramName));
53
+ };
33
54
  const useBlackboardPreference = store_create((set)=>{
34
55
  const savedAutoZoom = 'false' !== localStorage.getItem(AUTO_ZOOM_KEY);
35
56
  const savedBackgroundVisible = 'false' !== localStorage.getItem(BACKGROUND_VISIBLE_KEY);
36
57
  const savedElementsVisible = 'false' !== localStorage.getItem(ELEMENTS_VISIBLE_KEY);
58
+ const autoZoomFromQuery = getQueryPreference('focusOnCursor');
59
+ const elementsVisibleFromQuery = getQueryPreference('showElementMarkers');
37
60
  return {
38
61
  backgroundVisible: savedBackgroundVisible,
39
- elementsVisible: savedElementsVisible,
40
- autoZoom: savedAutoZoom,
62
+ elementsVisible: void 0 === elementsVisibleFromQuery ? savedElementsVisible : elementsVisibleFromQuery,
63
+ autoZoom: void 0 === autoZoomFromQuery ? savedAutoZoom : autoZoomFromQuery,
41
64
  setBackgroundVisible: (visible)=>{
42
65
  set({
43
66
  backgroundVisible: visible
@@ -2,6 +2,7 @@ import { StaticPage, StaticPageAgent } from "@midscene/web/static";
2
2
  import { isZodObjectSchema, unwrapZodType } from "../types.mjs";
3
3
  const actionNameForType = (type)=>{
4
4
  const typeWithoutAi = type.startsWith('ai') ? type.slice(2) : type;
5
+ if (typeWithoutAi.startsWith('IOS')) return typeWithoutAi.substring(3).replace(/([A-Z])/g, ' $1').replace(/^/, 'IOS').trim();
5
6
  const fullName = typeWithoutAi.replace(/([A-Z])/g, ' $1').trim();
6
7
  const words = fullName.split(' ');
7
8
  if (words.length > 3) return words.slice(-3).join(' ');
@@ -166,6 +166,12 @@ function Player(props) {
166
166
  null == props ? void 0 : props.autoZoom,
167
167
  setAutoZoom
168
168
  ]);
169
+ (0, external_react_namespaceObject.useEffect)(()=>{
170
+ if ((null == props ? void 0 : props.elementsVisible) !== void 0) setElementsVisible(props.elementsVisible);
171
+ }, [
172
+ null == props ? void 0 : props.elementsVisible,
173
+ setElementsVisible
174
+ ]);
169
175
  const scripts = null == props ? void 0 : props.replayScripts;
170
176
  const imageWidth = (null == props ? void 0 : props.imageWidth) || 1920;
171
177
  const imageHeight = (null == props ? void 0 : props.imageHeight) || 1080;
@@ -785,7 +791,7 @@ function Player(props) {
785
791
  fontSize: '12px',
786
792
  marginRight: '16px'
787
793
  },
788
- children: "Focus on Cursor"
794
+ children: "Focus on cursor"
789
795
  })
790
796
  ]
791
797
  }),
@@ -838,7 +844,7 @@ function Player(props) {
838
844
  fontSize: '12px',
839
845
  marginRight: '16px'
840
846
  },
841
- children: "Show Element Markers"
847
+ children: "Show element markers"
842
848
  })
843
849
  ]
844
850
  }),
@@ -28,12 +28,9 @@ __webpack_require__.d(__webpack_exports__, {
28
28
  });
29
29
  const external_react_namespaceObject = require("react");
30
30
  const store_js_namespaceObject = require("../store/store.js");
31
+ const playground_namespaceObject = require("@midscene/playground");
31
32
  const constants_js_namespaceObject = require("../utils/constants.js");
32
33
  const replay_scripts_js_namespaceObject = require("../utils/replay-scripts.js");
33
- const noReplayAPIs = [
34
- 'aiQuery',
35
- 'aiAssert'
36
- ];
37
34
  function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, setLoading, infoList, setInfoList, replayCounter, setReplayCounter, verticalMode, currentRunningIdRef, interruptedFlagRef) {
38
35
  const { deepThink, screenshotIncluded, domIncluded } = (0, store_js_namespaceObject.useEnvConfig)();
39
36
  const handleRun = (0, external_react_namespaceObject.useCallback)(async (value)=>{
@@ -110,7 +107,7 @@ function usePlaygroundExecution(playgroundSDK, storage, actionSpace, loading, se
110
107
  currentRunningIdRef.current = null;
111
108
  let replayInfo = null;
112
109
  let counter = replayCounter;
113
- if ((null == result ? void 0 : result.dump) && !noReplayAPIs.includes(actionType)) {
110
+ if ((null == result ? void 0 : result.dump) && !playground_namespaceObject.noReplayAPIs.includes(actionType)) {
114
111
  const info = (0, replay_scripts_js_namespaceObject.allScriptsFromDump)(result.dump);
115
112
  setReplayCounter((c)=>c + 1);
116
113
  replayInfo = info;
@@ -32,14 +32,37 @@ const { create } = external_zustand_namespaceObject;
32
32
  const AUTO_ZOOM_KEY = 'midscene-auto-zoom';
33
33
  const BACKGROUND_VISIBLE_KEY = 'midscene-background-visible';
34
34
  const ELEMENTS_VISIBLE_KEY = 'midscene-elements-visible';
35
+ const parseBooleanParam = (value)=>{
36
+ if (null === value) return;
37
+ const normalized = value.trim().toLowerCase();
38
+ if ([
39
+ '1',
40
+ 'true',
41
+ 'yes',
42
+ 'on'
43
+ ].includes(normalized)) return true;
44
+ if ([
45
+ '0',
46
+ 'false',
47
+ 'no',
48
+ 'off'
49
+ ].includes(normalized)) return false;
50
+ };
51
+ const getQueryPreference = (paramName)=>{
52
+ if ('undefined' == typeof window) return;
53
+ const searchParams = new URLSearchParams(window.location.search);
54
+ return parseBooleanParam(searchParams.get(paramName));
55
+ };
35
56
  const useBlackboardPreference = create((set)=>{
36
57
  const savedAutoZoom = 'false' !== localStorage.getItem(AUTO_ZOOM_KEY);
37
58
  const savedBackgroundVisible = 'false' !== localStorage.getItem(BACKGROUND_VISIBLE_KEY);
38
59
  const savedElementsVisible = 'false' !== localStorage.getItem(ELEMENTS_VISIBLE_KEY);
60
+ const autoZoomFromQuery = getQueryPreference('focusOnCursor');
61
+ const elementsVisibleFromQuery = getQueryPreference('showElementMarkers');
39
62
  return {
40
63
  backgroundVisible: savedBackgroundVisible,
41
- elementsVisible: savedElementsVisible,
42
- autoZoom: savedAutoZoom,
64
+ elementsVisible: void 0 === elementsVisibleFromQuery ? savedElementsVisible : elementsVisibleFromQuery,
65
+ autoZoom: void 0 === autoZoomFromQuery ? savedAutoZoom : autoZoomFromQuery,
43
66
  setBackgroundVisible: (visible)=>{
44
67
  set({
45
68
  backgroundVisible: visible
@@ -33,6 +33,7 @@ const static_namespaceObject = require("@midscene/web/static");
33
33
  const external_types_js_namespaceObject = require("../types.js");
34
34
  const actionNameForType = (type)=>{
35
35
  const typeWithoutAi = type.startsWith('ai') ? type.slice(2) : type;
36
+ if (typeWithoutAi.startsWith('IOS')) return typeWithoutAi.substring(3).replace(/([A-Z])/g, ' $1').replace(/^/, 'IOS').trim();
36
37
  const fullName = typeWithoutAi.replace(/([A-Z])/g, ' $1').trim();
37
38
  const words = fullName.split(' ');
38
39
  if (words.length > 3) return words.slice(-3).join(' ');
@@ -9,4 +9,5 @@ export declare function Player(props?: {
9
9
  key?: string | number;
10
10
  fitMode?: 'width' | 'height';
11
11
  autoZoom?: boolean;
12
+ elementsVisible?: boolean;
12
13
  }): import("react").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/visualizer",
3
- "version": "0.29.2-beta-20250925081422.0",
3
+ "version": "0.29.3-beta-20250925084104.0",
4
4
  "repository": "https://github.com/web-infra-dev/midscene",
5
5
  "homepage": "https://midscenejs.com/",
6
6
  "types": "./dist/types/index.d.ts",
@@ -70,10 +70,10 @@
70
70
  "antd": "^5.21.6",
71
71
  "buffer": "6.0.3",
72
72
  "dayjs": "^1.11.11",
73
- "@midscene/core": "0.29.2-beta-20250925081422.0",
74
- "@midscene/playground": "0.29.2-beta-20250925081422.0",
75
- "@midscene/shared": "0.29.2-beta-20250925081422.0",
76
- "@midscene/web": "0.29.2-beta-20250925081422.0"
73
+ "@midscene/core": "0.29.3-beta-20250925084104.0",
74
+ "@midscene/playground": "0.29.3-beta-20250925084104.0",
75
+ "@midscene/web": "0.29.3-beta-20250925084104.0",
76
+ "@midscene/shared": "0.29.3-beta-20250925084104.0"
77
77
  },
78
78
  "license": "MIT",
79
79
  "scripts": {