android-midscene-automation 1.1.8 → 1.1.9

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/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
1
  # 更新记录
2
+ ## v1.1.9
3
+ - [Appium]修复横向流程中展开节点及内部折叠选项时连接点偏移的问题。
4
+ - [Appium]优化节点展开编辑性能,复用未变化节点的配置,仅测量发生变化的节点,减少重复渲染和整图重排。
5
+ - [Appium]配置页新增“基础配置”和“模型配置”分组,归并流程外观、回放及 AI 相关设置。
6
+
2
7
  ## v1.1.8
3
8
  - [Appium]流程布局新增横向显示,默认为纵向。
4
9
  - [Appium]流程外观配置新增多套预设主题,可统一调整画布背景、节点填充、节点边框和连接线颜色;支持自定义颜色、恢复默认及深色节点文字适配,主画布与流程总览同步生效。
package/README.md CHANGED
@@ -1502,6 +1502,11 @@ Linux: ~/.local/share/android-midscene-automation
1502
1502
 
1503
1503
  # 项目更新记录
1504
1504
 
1505
+ ## v1.1.9
1506
+ - [Appium]修复横向流程中展开节点及内部折叠选项时连接点偏移的问题。
1507
+ - [Appium]优化节点展开编辑性能,复用未变化节点的配置,仅测量发生变化的节点,减少重复渲染和整图重排。
1508
+ - [Appium]配置页新增“基础配置”和“模型配置”分组,归并流程外观、回放及 AI 相关设置。
1509
+
1505
1510
  ## v1.1.8
1506
1511
  - [Appium]流程布局新增横向显示,默认为纵向。
1507
1512
  - [Appium]流程外观配置新增多套预设主题,可统一调整画布背景、节点填充、节点边框和连接线颜色;支持自定义颜色、恢复默认及深色节点文字适配,主画布与流程总览同步生效。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "android-midscene-automation",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/oooooooko/android-midscene-automation.git"
@@ -92,6 +92,7 @@ const measuredNodeHeights = shallowRef<Record<string, number>>({});
92
92
  const { fitView, updateNodeInternals, findNode, setCenter, setViewport, viewport } = useVueFlow(props.id);
93
93
  const paneReady = shallowRef(false);
94
94
  let internalsFrame = 0;
95
+ const pendingInternals = new Set<string>();
95
96
  let resizeFrame = 0;
96
97
  let pendingNodeHeights: Record<string, number> = {};
97
98
  let resetViewFrame = 0;
@@ -114,28 +115,41 @@ watch(() => [props.searchFocusToken, props.searchTargetId, props.searchActive, p
114
115
  });
115
116
  });
116
117
 
117
- const graph = computed(() => buildFlowGraph(props.steps, {
118
- layoutDirection: layoutDirection.value,
119
- deleteMode: props.deleteMode,
120
- mergeDisabled: props.mergeDisabled,
121
- aiRecognitionModelConfigured: props.aiRecognitionModelConfigured,
122
- expandedStepIndex: props.expandedStepIndex,
123
- selectedCopyIndexes: props.selectedCopyIndexes,
124
- copyMode: props.copyMode,
125
- disabled: props.disabled,
126
- removeDisabled: props.removeDisabled,
127
- launchingStepId: props.launchingStepId,
128
- clipboardCount: props.clipboardCount,
129
- canOpenInsertMenu: props.canOpenInsertMenu,
130
- isStartActionDisabled: props.isStartActionDisabled,
131
- isInsertActionDisabled: props.isInsertActionDisabled,
132
- isAppExecutionDisabled: props.isAppExecutionDisabled,
133
- startActionGroups: props.startActionGroups,
134
- mainActionGroups: props.mainActionGroups,
135
- measuredNodeHeights: measuredNodeHeights.value,
136
- labelStep: props.labelStep,
137
- isCopySelected: props.isCopySelected,
138
- }));
118
+ const graph = computed<ReturnType<typeof buildFlowGraph>>((previous) => {
119
+ const next = buildFlowGraph(props.steps, {
120
+ layoutDirection: layoutDirection.value,
121
+ deleteMode: props.deleteMode,
122
+ mergeDisabled: props.mergeDisabled,
123
+ aiRecognitionModelConfigured: props.aiRecognitionModelConfigured,
124
+ // 展开先更新当前卡片,布局只响应随后测到的实际尺寸。
125
+ expandedStepIndex: null,
126
+ selectedCopyIndexes: props.selectedCopyIndexes,
127
+ copyMode: props.copyMode,
128
+ disabled: props.disabled,
129
+ removeDisabled: props.removeDisabled,
130
+ launchingStepId: props.launchingStepId,
131
+ clipboardCount: props.clipboardCount,
132
+ canOpenInsertMenu: props.canOpenInsertMenu,
133
+ isStartActionDisabled: props.isStartActionDisabled,
134
+ isInsertActionDisabled: props.isInsertActionDisabled,
135
+ isAppExecutionDisabled: props.isAppExecutionDisabled,
136
+ startActionGroups: props.startActionGroups,
137
+ mainActionGroups: props.mainActionGroups,
138
+ measuredNodeHeights: measuredNodeHeights.value,
139
+ labelStep: props.labelStep,
140
+ isCopySelected: props.isCopySelected,
141
+ });
142
+ const previousNodes = new Map(previous?.nodes.map(node => [node.id, node]));
143
+ for (const node of next.nodes) {
144
+ const old = previousNodes.get(node.id)?.data;
145
+ // 保持未修改节点的配置引用,避免一次展开让所有卡片重新渲染。
146
+ if (old && node.data && Object.keys(old).length === Object.keys(node.data).length
147
+ && Object.entries(node.data).every(([key, value]) => Reflect.get(old, key) === value)) {
148
+ node.data = old;
149
+ }
150
+ }
151
+ return next;
152
+ });
139
153
 
140
154
  function handleNodeResize(payload: { id: string; height: number }) {
141
155
  const height = Math.ceil(payload.height) + 6;
@@ -181,11 +195,14 @@ function handleNodeClick(index: number) {
181
195
  if (focusedNodeId) void nextTick(() => scheduleNodeFocus(focusedNodeId));
182
196
  }
183
197
 
184
- function scheduleNodeInternalsUpdate() {
185
- if (internalsFrame) window.cancelAnimationFrame(internalsFrame);
198
+ function scheduleNodeInternalsUpdate(ids = graph.value.nodes.map(node => node.id)) {
199
+ ids.forEach(id => pendingInternals.add(id));
200
+ if (internalsFrame) return;
186
201
  internalsFrame = window.requestAnimationFrame(() => {
187
202
  internalsFrame = 0;
188
- updateNodeInternals(graph.value.nodes.map((node) => node.id));
203
+ const changed = [...pendingInternals];
204
+ pendingInternals.clear();
205
+ if (changed.length) updateNodeInternals(changed);
189
206
  preserveInsertionPosition();
190
207
  });
191
208
  }
@@ -260,11 +277,17 @@ watch(flowStructureKey, () => {
260
277
  if (retained.length !== Object.keys(measuredNodeHeights.value).length) {
261
278
  measuredNodeHeights.value = Object.fromEntries(retained);
262
279
  }
263
- void nextTick(scheduleNodeInternalsUpdate);
264
280
  });
265
281
 
266
- watch(graph, () => {
267
- void nextTick(scheduleNodeInternalsUpdate);
282
+ watch(graph, (next, previous) => {
283
+ const previousNodes = new Map(previous.nodes.map(node => [node.id, node]));
284
+ const changed = next.nodes.filter(node => {
285
+ const old = previousNodes.get(node.id);
286
+ return !old || old.data !== node.data || old.width !== node.width || old.height !== node.height
287
+ || old.sourcePosition !== node.sourcePosition || old.targetPosition !== node.targetPosition;
288
+ }).map(node => node.id);
289
+ // 平移后的相对连接点不变,只测量新增或尺寸、内容发生变化的节点。
290
+ void nextTick(() => scheduleNodeInternalsUpdate(changed));
268
291
  });
269
292
 
270
293
  watch(layoutDirection, () => {
@@ -345,6 +368,7 @@ function handleInsert(payload: {
345
368
  :steps="steps"
346
369
  :node-id="nodeId"
347
370
  :data="data"
371
+ :expanded="data.kind === 'step' && data.index === expandedStepIndex"
348
372
  :readonly="props.readonly"
349
373
  :search-highlighted="nodeId === `step:${searchTargetId}`"
350
374
  @node-click="handleNodeClick"
@@ -17,6 +17,7 @@ const props = defineProps<{
17
17
  nodeId: string;
18
18
  data: FlowGraphNodeData;
19
19
  steps: AppiumRecordedStep[];
20
+ expanded: boolean;
20
21
  readonly?: boolean;
21
22
  searchHighlighted?: boolean;
22
23
  }>();
@@ -38,6 +39,11 @@ const layoutDirection = inject(flowLayoutDirectionKey, computed(() => normalizeF
38
39
  const horizontal = computed(() => layoutDirection.value === 'horizontal');
39
40
 
40
41
  const rootRef = shallowRef<HTMLElement | null>(null);
42
+ const cardRef = shallowRef<HTMLButtonElement | null>(null);
43
+ const cardHeight = shallowRef(0);
44
+ const handleStyle = computed(() => horizontal.value && props.data.kind === 'step'
45
+ ? { top: `${(cardHeight.value || props.data.cardMinHeight) / 2}px` }
46
+ : undefined);
41
47
  let resizeObserver: ResizeObserver | null = null;
42
48
 
43
49
  const insertTitle = computed(() => {
@@ -72,6 +78,8 @@ onMounted(() => {
72
78
  if (!rootRef.value || props.data.kind !== 'step') return;
73
79
  resizeObserver = new ResizeObserver(([entry]) => {
74
80
  if (!entry) return;
81
+ // 横向端点跟随卡片,展开的编辑区域不参与端点居中。
82
+ cardHeight.value = cardRef.value?.offsetHeight ?? 0;
75
83
  emit('resize', {
76
84
  id: props.nodeId,
77
85
  height: entry.borderBoxSize[0]?.blockSize ?? rootRef.value!.offsetHeight,
@@ -96,10 +104,11 @@ onBeforeUnmount(() => {
96
104
  @touchstart.stop
97
105
  >
98
106
  <Handle
99
- id="top"
107
+ id="input"
100
108
  type="target"
101
109
  :position="horizontal ? Position.Left : Position.Top"
102
110
  class="appium-flow-handle"
111
+ :style="handleStyle"
103
112
  />
104
113
 
105
114
  <div v-if="data.kind === 'start'" class="appium-flow-start-card nodrag nopan">
@@ -158,7 +167,7 @@ onBeforeUnmount(() => {
158
167
  :class="[
159
168
  `appium-flow-step-shell--${data.flowKind}`,
160
169
  {
161
- 'appium-flow-step-shell--expanded': data.expanded,
170
+ 'appium-flow-step-shell--expanded': expanded,
162
171
  'appium-flow-step-shell--selected': data.selected,
163
172
  'appium-flow-step-shell--delete-selected': data.selected && data.deleteMode,
164
173
  'appium-flow-step-shell--copying': data.copyMode,
@@ -167,6 +176,7 @@ onBeforeUnmount(() => {
167
176
  ]"
168
177
  >
169
178
  <button
179
+ ref="cardRef"
170
180
  type="button"
171
181
  class="appium-flow-step-card nodrag nopan"
172
182
  :style="{ minHeight: `${data.cardMinHeight}px` }"
@@ -249,7 +259,7 @@ onBeforeUnmount(() => {
249
259
  </span></el-tooltip>
250
260
  </span>
251
261
  <FlowStepEditor
252
- v-if="!props.readonly && data.expanded"
262
+ v-if="!props.readonly && expanded"
253
263
  class="appium-flow-step-editor nodrag nopan"
254
264
  :step="data.step"
255
265
  :steps="steps"
@@ -260,10 +270,11 @@ onBeforeUnmount(() => {
260
270
  </div>
261
271
 
262
272
  <Handle
263
- id="bottom"
273
+ id="output"
264
274
  type="source"
265
275
  :position="horizontal ? Position.Right : Position.Bottom"
266
276
  class="appium-flow-handle"
277
+ :style="handleStyle"
267
278
  />
268
279
  </div>
269
280
  </template>
@@ -835,8 +835,8 @@ export function buildFlowGraph(
835
835
  source: link.source,
836
836
  target: link.target,
837
837
  type: 'flow-rounded',
838
- sourceHandle: 'bottom',
839
- targetHandle: 'top',
838
+ sourceHandle: 'output',
839
+ targetHandle: 'input',
840
840
  selectable: false,
841
841
  focusable: false,
842
842
  class: 'appium-vue-flow-edge',
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { shallowRef } from 'vue';
2
3
  import ReplayReportSummarySettings from './ReplayReportSummarySettings.vue';
3
4
  import type { ConfigForm } from '../../types';
4
5
  import FlowAppearanceSettings from './FlowAppearanceSettings.vue';
@@ -16,15 +17,25 @@ defineProps<{
16
17
  }>();
17
18
  defineEmits<{
18
19
  retrySave: []; testModel: []; testPromptOptimizerModel: [] }>();
20
+
21
+ const activeSection = shallowRef<'basic' | 'models'>('basic');
19
22
  </script>
20
23
 
21
24
  <template>
22
25
  <div class="appium-config-stack">
23
- <section class="appium-config-section" aria-labelledby="appium-models-title">
24
- <header class="appium-section-heading">
25
- <div><h2 id="appium-models-title">模型服务</h2><p>不同任务使用独立模型,配置修改需测试通过后保存。</p></div>
26
+ <header class="appium-config-toolbar">
27
+ <el-radio-group v-model="activeSection" aria-label="Appium配置分类">
28
+ <el-radio-button value="basic">基础配置</el-radio-button>
29
+ <el-radio-button value="models">模型配置</el-radio-button>
30
+ </el-radio-group>
31
+ <div v-if="saveStatus || saveFailed" class="appium-config-save-state">
26
32
  <span v-if="saveStatus" class="config-save-status" role="status">{{ saveStatus }}</span>
27
33
  <el-button v-if="saveFailed" link type="primary" @click="$emit('retrySave')">重试保存</el-button>
34
+ </div>
35
+ </header>
36
+ <section v-show="activeSection === 'models'" class="appium-config-section" aria-labelledby="appium-models-title">
37
+ <header class="appium-section-heading">
38
+ <div><h2 id="appium-models-title">模型服务</h2><p>不同任务使用独立模型,配置修改需测试通过后保存。</p></div>
28
39
  </header>
29
40
  <div class="appium-model-grid">
30
41
  <AppiumModelSettings v-model="configForm.appium.model" title="AI 识别模型" badge="视觉"
@@ -37,8 +48,8 @@ defineEmits<{
37
48
  </div>
38
49
  </section>
39
50
 
40
- <section class="appium-config-section" aria-labelledby="appium-recognition-title">
41
- <header class="appium-section-heading"><div><h2 id="appium-recognition-title">AI 识别设置</h2><p>控制持续观察的截图筛选,并管理录制节点可选的常用提示词。</p></div></header>
51
+ <section v-show="activeSection === 'models'" class="appium-config-section" aria-labelledby="appium-recognition-title">
52
+ <header class="appium-section-heading"><div><h2 id="appium-recognition-title">AI 应用设置</h2><p>配置持续观察的截图筛选、常用提示词,以及回放报告总结。</p></div></header>
42
53
  <div class="appium-settings-grid">
43
54
  <el-card shadow="never" class="config-module-card config-appium-card">
44
55
  <template #header><div class="panel-header"><span>持续观察截图去重</span></div></template>
@@ -49,10 +60,11 @@ defineEmits<{
49
60
  <AiPromptPresetsSettings v-model="configForm.appium.aiPromptPresets" />
50
61
  </el-card>
51
62
  </div>
63
+ <ReplayReportSummarySettings v-if="configForm.appium.reportSummary" :config="configForm.appium.reportSummary" :testing-model-key="testingModelKey" />
52
64
  </section>
53
65
 
54
- <section class="appium-config-section" aria-labelledby="appium-replay-title">
55
- <header class="appium-section-heading"><div><h2 id="appium-replay-title">回放与报告</h2><p>配置回放证据、基础报告和 AI 总结。</p></div></header>
66
+ <section v-show="activeSection === 'basic'" class="appium-config-section" aria-labelledby="appium-replay-title">
67
+ <header class="appium-section-heading"><div><h2 id="appium-replay-title">回放与报告</h2><p>配置节点截图和 HTML 报告。</p></div></header>
56
68
  <el-card shadow="never" class="config-module-card config-appium-card">
57
69
  <template #header>
58
70
  <div class="panel-header">
@@ -64,10 +76,9 @@ defineEmits<{
64
76
  </template>
65
77
  <el-alert title="开启后会在节点执行前后截图并生成 HTML 报告。截图会增加回放耗时,实际操作间隔可能超过设置的延时时间。" type="info" :closable="false" show-icon />
66
78
  </el-card>
67
- <ReplayReportSummarySettings v-if="configForm.appium.reportSummary" :config="configForm.appium.reportSummary" :testing-model-key="testingModelKey" />
68
79
  </section>
69
80
 
70
- <section class="appium-config-section" aria-labelledby="appium-editor-title">
81
+ <section v-show="activeSection === 'basic'" class="appium-config-section" aria-labelledby="appium-editor-title">
71
82
  <header class="appium-section-heading"><div><h2 id="appium-editor-title">流程编辑器</h2><p>选择流程主题,调整画布、节点和连接线颜色,以及横纵布局。</p></div></header>
72
83
  <FlowAppearanceSettings
73
84
  v-model="configForm.appium.flowBackgroundColor"
@@ -85,6 +96,8 @@ defineEmits<{
85
96
  <style scoped>
86
97
  .config-save-status { font-size: 12px; font-weight: 400; color: var(--el-text-color-secondary); }
87
98
  .appium-config-stack { display: grid; gap: 28px; }
99
+ .appium-config-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
100
+ .appium-config-save-state { display: flex; align-items: center; gap: 8px; }
88
101
  .appium-config-section { display: grid; gap: 14px; min-width: 0; }
89
102
  .appium-section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 0 4px; }
90
103
  .appium-section-heading h2 { margin: 0; color: var(--el-text-color-primary); font-size: 16px; line-height: 1.4; }