@midscene/visualizer 0.29.2-beta-20250925081422.0 → 0.29.2

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
  }),
@@ -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
@@ -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
  }),
@@ -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
@@ -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.2",
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/playground": "0.29.2",
74
+ "@midscene/shared": "0.29.2",
75
+ "@midscene/core": "0.29.2",
76
+ "@midscene/web": "0.29.2"
77
77
  },
78
78
  "license": "MIT",
79
79
  "scripts": {