@midscene/recorder 1.9.6 → 1.9.7

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.
@@ -1,11 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { AimOutlined, CompassOutlined, CopyOutlined, EditOutlined, KeyOutlined, VerticalAlignTopOutlined } from "@ant-design/icons";
3
- import { Button, Card, Image, Space, Timeline, Typography, message } from "antd";
3
+ import { getMidsceneRecorderEventDescription, getMidsceneRecorderSemantic } from "@midscene/shared/recorder";
4
+ import { App, Button, Card, Image, Space, Timeline, Typography } from "antd";
4
5
  import { useEffect, useRef, useState } from "react";
5
6
  import { ShinyText } from "./components/shiny-text.js";
6
7
  import "./RecordTimeline.css";
7
8
  const { Text } = Typography;
8
9
  const RecordTimeline = ({ events, onEventClick })=>{
10
+ const { message } = App.useApp();
9
11
  const [expandedEvents, setExpandedEvents] = useState(new Set());
10
12
  const timelineRootRef = useRef(null);
11
13
  useEffect(()=>{
@@ -119,7 +121,7 @@ const RecordTimeline = ({ events, onEventClick })=>{
119
121
  }
120
122
  };
121
123
  const isCoordinateValue = (value)=>Boolean(value && /^\s*\d+(?:\.\d+)?,\s*\d+(?:\.\d+)?\s*$/.test(value));
122
- const getDisplayDescription = (event)=>event.elementDescription || event.actionSummary || event.replayInstruction;
124
+ const getDisplayDescription = (event)=>getMidsceneRecorderEventDescription(event);
123
125
  const getEventTitle = (event)=>{
124
126
  switch(event.type){
125
127
  case 'click':
@@ -147,7 +149,7 @@ const RecordTimeline = ({ events, onEventClick })=>{
147
149
  switch(event.type){
148
150
  case 'click':
149
151
  case 'drag':
150
- if (true === event.descriptionLoading) return /*#__PURE__*/ jsxs("span", {
152
+ if (getMidsceneRecorderSemantic(event)?.status === 'pending') return /*#__PURE__*/ jsxs("span", {
151
153
  style: {
152
154
  display: 'flex',
153
155
  alignItems: 'center',
@@ -168,7 +170,7 @@ const RecordTimeline = ({ events, onEventClick })=>{
168
170
  })
169
171
  ]
170
172
  });
171
- if (false === event.descriptionLoading && getDisplayDescription(event)) return /*#__PURE__*/ jsxs(Text, {
173
+ if (getMidsceneRecorderSemantic(event)?.status === 'ready') return /*#__PURE__*/ jsxs(Text, {
172
174
  children: [
173
175
  eventTitle,
174
176
  " - ",
@@ -179,7 +181,7 @@ const RecordTimeline = ({ events, onEventClick })=>{
179
181
  children: eventTitle
180
182
  });
181
183
  case 'input':
182
- if (false === event.descriptionLoading && getDisplayDescription(event)) return /*#__PURE__*/ jsxs(Text, {
184
+ if (getMidsceneRecorderSemantic(event)?.status === 'ready') return /*#__PURE__*/ jsxs(Text, {
183
185
  children: [
184
186
  eventTitle,
185
187
  " - ",
@@ -224,7 +226,7 @@ const RecordTimeline = ({ events, onEventClick })=>{
224
226
  });
225
227
  case 'navigation':
226
228
  {
227
- const navigationDescription = event.actionSummary || event.replayInstruction || event.elementDescription;
229
+ const navigationDescription = getDisplayDescription(event);
228
230
  if (navigationDescription) return /*#__PURE__*/ jsxs(Text, {
229
231
  children: [
230
232
  eventTitle,
@@ -401,8 +403,10 @@ const RecordTimeline = ({ events, onEventClick })=>{
401
403
  style: {
402
404
  backgroundColor: '#f5f5f5'
403
405
  },
404
- bodyStyle: {
405
- padding: '0px'
406
+ styles: {
407
+ body: {
408
+ padding: '0px'
409
+ }
406
410
  },
407
411
  children: /*#__PURE__*/ jsxs("div", {
408
412
  style: {
package/dist/recorder.js CHANGED
@@ -311,8 +311,7 @@ function convertToChromeEvent(event) {
311
311
  pageInfo: event.pageInfo,
312
312
  screenshotBefore: event.screenshotBefore,
313
313
  screenshotAfter: event.screenshotAfter,
314
- elementDescription: event.elementDescription,
315
- descriptionLoading: event.descriptionLoading,
314
+ semantic: event.semantic,
316
315
  screenshotWithBox: event.screenshotWithBox,
317
316
  timestamp: event.timestamp,
318
317
  hashId: event.hashId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@midscene/recorder",
3
- "version": "1.9.6",
3
+ "version": "1.9.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/web-infra-dev/midscene.git",
@@ -29,7 +29,7 @@
29
29
  "antd": "^5.21.6",
30
30
  "dayjs": "^1.11.11",
31
31
  "react-dom": "18.3.1",
32
- "@midscene/shared": "1.9.6"
32
+ "@midscene/shared": "1.9.7"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "react": "18.3.1",