wps-multitool-mcp 1.0.1 → 1.0.3
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/bridge/cancellable.d.ts.map +1 -1
- package/dist/bridge/cancellable.js +4 -0
- package/dist/bridge/cancellable.js.map +1 -1
- package/dist/bridge/index.js +109 -18
- package/dist/bridge/index.js.map +1 -1
- package/dist/bridge/ps-child.d.ts +27 -1
- package/dist/bridge/ps-child.d.ts.map +1 -1
- package/dist/bridge/ps-child.js +137 -3
- package/dist/bridge/ps-child.js.map +1 -1
- package/dist/cli/install.d.ts +65 -0
- package/dist/cli/install.d.ts.map +1 -0
- package/dist/cli/install.js +399 -0
- package/dist/cli/install.js.map +1 -0
- package/dist/client/action-routes.generated.d.ts +3 -2
- package/dist/client/action-routes.generated.d.ts.map +1 -1
- package/dist/client/action-routes.generated.js +10 -12
- package/dist/client/action-routes.generated.js.map +1 -1
- package/dist/client/addon-channel.d.ts +104 -0
- package/dist/client/addon-channel.d.ts.map +1 -0
- package/dist/client/addon-channel.js +491 -0
- package/dist/client/addon-channel.js.map +1 -0
- package/dist/client/ps-daemon.d.ts +1 -0
- package/dist/client/ps-daemon.d.ts.map +1 -1
- package/dist/client/ps-daemon.js +8 -4
- package/dist/client/ps-daemon.js.map +1 -1
- package/dist/client/wps-client.d.ts +3 -4
- package/dist/client/wps-client.d.ts.map +1 -1
- package/dist/client/wps-client.js +139 -32
- package/dist/client/wps-client.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -4
- package/dist/index.js.map +1 -1
- package/dist/server/auto-snapshot.d.ts +58 -0
- package/dist/server/auto-snapshot.d.ts.map +1 -0
- package/dist/server/auto-snapshot.js +150 -0
- package/dist/server/auto-snapshot.js.map +1 -0
- package/dist/server/backend-selector.d.ts +51 -0
- package/dist/server/backend-selector.d.ts.map +1 -0
- package/dist/server/backend-selector.js +104 -0
- package/dist/server/backend-selector.js.map +1 -0
- package/dist/server/mcp-server.d.ts.map +1 -1
- package/dist/server/mcp-server.js +8 -141
- package/dist/server/mcp-server.js.map +1 -1
- package/dist/server/target-context.d.ts +32 -0
- package/dist/server/target-context.d.ts.map +1 -0
- package/dist/server/target-context.js +47 -0
- package/dist/server/target-context.js.map +1 -0
- package/dist/server/tool-aliases.generated.d.ts +41 -0
- package/dist/server/tool-aliases.generated.d.ts.map +1 -0
- package/dist/server/tool-aliases.generated.js +88 -0
- package/dist/server/tool-aliases.generated.js.map +1 -0
- package/dist/server/tool-annotations.d.ts +3 -0
- package/dist/server/tool-annotations.d.ts.map +1 -1
- package/dist/server/tool-annotations.generated.d.ts.map +1 -1
- package/dist/server/tool-annotations.generated.js +31 -53
- package/dist/server/tool-annotations.generated.js.map +1 -1
- package/dist/server/tool-annotations.js +95 -7
- package/dist/server/tool-annotations.js.map +1 -1
- package/dist/server/tool-metadata.d.ts +25 -0
- package/dist/server/tool-metadata.d.ts.map +1 -1
- package/dist/server/tool-metadata.js +217 -40
- package/dist/server/tool-metadata.js.map +1 -1
- package/dist/server/tool-registry.d.ts +25 -3
- package/dist/server/tool-registry.d.ts.map +1 -1
- package/dist/server/tool-registry.js +208 -42
- package/dist/server/tool-registry.js.map +1 -1
- package/dist/server/tool-tiers.d.ts +28 -8
- package/dist/server/tool-tiers.d.ts.map +1 -1
- package/dist/server/tool-tiers.js +35 -8
- package/dist/server/tool-tiers.js.map +1 -1
- package/dist/server/tool-verification.d.ts +35 -0
- package/dist/server/tool-verification.d.ts.map +1 -0
- package/dist/server/tool-verification.generated.d.ts +17 -0
- package/dist/server/tool-verification.generated.d.ts.map +1 -0
- package/dist/server/tool-verification.generated.js +293 -0
- package/dist/server/tool-verification.generated.js.map +1 -0
- package/dist/server/tool-verification.js +43 -0
- package/dist/server/tool-verification.js.map +1 -0
- package/dist/tools/common/batch.d.ts.map +1 -1
- package/dist/tools/common/batch.js +79 -1
- package/dist/tools/common/batch.js.map +1 -1
- package/dist/tools/common/general.d.ts +0 -3
- package/dist/tools/common/general.d.ts.map +1 -1
- package/dist/tools/common/general.js +28 -66
- package/dist/tools/common/general.js.map +1 -1
- package/dist/tools/common/index.d.ts +4 -2
- package/dist/tools/common/index.d.ts.map +1 -1
- package/dist/tools/common/index.js +18 -4
- package/dist/tools/common/index.js.map +1 -1
- package/dist/tools/common/snapshot.d.ts +77 -0
- package/dist/tools/common/snapshot.d.ts.map +1 -0
- package/dist/tools/common/snapshot.js +500 -0
- package/dist/tools/common/snapshot.js.map +1 -0
- package/dist/tools/common/toolgroups.d.ts.map +1 -1
- package/dist/tools/common/toolgroups.js +21 -5
- package/dist/tools/common/toolgroups.js.map +1 -1
- package/dist/tools/excel/data.d.ts +0 -5
- package/dist/tools/excel/data.d.ts.map +1 -1
- package/dist/tools/excel/data.js +43 -46
- package/dist/tools/excel/data.js.map +1 -1
- package/dist/tools/excel/format.d.ts.map +1 -1
- package/dist/tools/excel/format.js +3 -1
- package/dist/tools/excel/format.js.map +1 -1
- package/dist/tools/excel/formula.d.ts +5 -5
- package/dist/tools/excel/formula.d.ts.map +1 -1
- package/dist/tools/excel/formula.js +65 -24
- package/dist/tools/excel/formula.js.map +1 -1
- package/dist/tools/excel/index.d.ts +3 -3
- package/dist/tools/excel/index.d.ts.map +1 -1
- package/dist/tools/excel/index.js +4 -12
- package/dist/tools/excel/index.js.map +1 -1
- package/dist/tools/excel/sheet-gaps.d.ts +2 -2
- package/dist/tools/excel/sheet-gaps.js +2 -2
- package/dist/tools/excel/sheet.d.ts +0 -10
- package/dist/tools/excel/sheet.d.ts.map +1 -1
- package/dist/tools/excel/sheet.js +37 -122
- package/dist/tools/excel/sheet.js.map +1 -1
- package/dist/tools/excel/workbook.d.ts.map +1 -1
- package/dist/tools/excel/workbook.js +11 -4
- package/dist/tools/excel/workbook.js.map +1 -1
- package/dist/tools/ppt/animation.d.ts +15 -58
- package/dist/tools/ppt/animation.d.ts.map +1 -1
- package/dist/tools/ppt/animation.js +39 -568
- package/dist/tools/ppt/animation.js.map +1 -1
- package/dist/tools/ppt/background.d.ts +0 -18
- package/dist/tools/ppt/background.d.ts.map +1 -1
- package/dist/tools/ppt/background.js +43 -249
- package/dist/tools/ppt/background.js.map +1 -1
- package/dist/tools/ppt/beautify-advanced.d.ts +0 -6
- package/dist/tools/ppt/beautify-advanced.d.ts.map +1 -1
- package/dist/tools/ppt/beautify-advanced.js +101 -164
- package/dist/tools/ppt/beautify-advanced.js.map +1 -1
- package/dist/tools/ppt/chart-flow.d.ts.map +1 -1
- package/dist/tools/ppt/chart-flow.js +5 -0
- package/dist/tools/ppt/chart-flow.js.map +1 -1
- package/dist/tools/ppt/data-viz.d.ts.map +1 -1
- package/dist/tools/ppt/data-viz.js +1 -1
- package/dist/tools/ppt/data-viz.js.map +1 -1
- package/dist/tools/ppt/image.d.ts.map +1 -1
- package/dist/tools/ppt/image.js +4 -9
- package/dist/tools/ppt/image.js.map +1 -1
- package/dist/tools/ppt/index.d.ts +5 -5
- package/dist/tools/ppt/index.d.ts.map +1 -1
- package/dist/tools/ppt/index.js +5 -35
- package/dist/tools/ppt/index.js.map +1 -1
- package/dist/tools/ppt/misc.d.ts +0 -6
- package/dist/tools/ppt/misc.d.ts.map +1 -1
- package/dist/tools/ppt/misc.js +110 -147
- package/dist/tools/ppt/misc.js.map +1 -1
- package/dist/tools/ppt/presentation.d.ts.map +1 -1
- package/dist/tools/ppt/presentation.js +30 -12
- package/dist/tools/ppt/presentation.js.map +1 -1
- package/dist/tools/ppt/shape-basic.d.ts.map +1 -1
- package/dist/tools/ppt/shape-basic.js +4 -0
- package/dist/tools/ppt/shape-basic.js.map +1 -1
- package/dist/tools/ppt/slide-ops.d.ts +0 -6
- package/dist/tools/ppt/slide-ops.d.ts.map +1 -1
- package/dist/tools/ppt/slide-ops.js +531 -437
- package/dist/tools/ppt/slide-ops.js.map +1 -1
- package/dist/tools/ppt/slide.d.ts.map +1 -1
- package/dist/tools/ppt/slide.js +50 -36
- package/dist/tools/ppt/slide.js.map +1 -1
- package/dist/tools/ppt/table.d.ts.map +1 -1
- package/dist/tools/ppt/table.js +4 -2
- package/dist/tools/ppt/table.js.map +1 -1
- package/dist/tools/ppt/textbox.d.ts.map +1 -1
- package/dist/tools/ppt/textbox.js +4 -1
- package/dist/tools/ppt/textbox.js.map +1 -1
- package/dist/tools/word/academic.d.ts.map +1 -1
- package/dist/tools/word/academic.js +14 -4
- package/dist/tools/word/academic.js.map +1 -1
- package/dist/tools/word/content.d.ts.map +1 -1
- package/dist/tools/word/content.js +107 -70
- package/dist/tools/word/content.js.map +1 -1
- package/dist/tools/word/document.d.ts +0 -5
- package/dist/tools/word/document.d.ts.map +1 -1
- package/dist/tools/word/document.js +121 -116
- package/dist/tools/word/document.js.map +1 -1
- package/dist/tools/word/format.d.ts.map +1 -1
- package/dist/tools/word/format.js +41 -35
- package/dist/tools/word/format.js.map +1 -1
- package/dist/tools/word/gaps.d.ts +2 -2
- package/dist/tools/word/gaps.d.ts.map +1 -1
- package/dist/tools/word/gaps.js +13 -7
- package/dist/tools/word/gaps.js.map +1 -1
- package/dist/tools/word/index.d.ts +1 -1
- package/dist/tools/word/index.d.ts.map +1 -1
- package/dist/tools/word/index.js +1 -3
- package/dist/tools/word/index.js.map +1 -1
- package/dist/tools/word/professional.d.ts.map +1 -1
- package/dist/tools/word/professional.js +123 -111
- package/dist/tools/word/professional.js.map +1 -1
- package/dist/tools/word/proofread.d.ts.map +1 -1
- package/dist/tools/word/proofread.js +42 -38
- package/dist/tools/word/proofread.js.map +1 -1
- package/dist/tools/word/target.d.ts +74 -0
- package/dist/tools/word/target.d.ts.map +1 -0
- package/dist/tools/word/target.js +130 -0
- package/dist/tools/word/target.js.map +1 -0
- package/dist/types/tools.d.ts +12 -1
- package/dist/types/tools.d.ts.map +1 -1
- package/dist/types/tools.js.map +1 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +48 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +23 -10
- package/scripts/wps-com.ps1 +1944 -337
- package/scripts/wps-comd.ps1 +162 -123
- package/skills/wps-multitool/SKILL.md +25 -6
- package/skills/wps-multitool/references/dsh.md +88 -0
- package/skills/wps-multitool/references/recipes.md +3 -2
- package/dist/client/mac-poll-server.d.ts +0 -77
- package/dist/client/mac-poll-server.js +0 -516
|
@@ -1,113 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Input: PPT
|
|
4
|
-
* Output:
|
|
5
|
-
* Pos: PPT
|
|
6
|
-
* PPT动画Tools -
|
|
7
|
-
* 处理动画的添加、删除、排序、预设以及幻灯片切换效果
|
|
3
|
+
* Input: PPT 动画列表与动画删除操作参数
|
|
4
|
+
* Output: 动画查询/删除结果
|
|
5
|
+
* Pos: PPT 动画工具实现。一旦我被修改,请更新我的头部注释,以及所属文件夹的md。
|
|
6
|
+
* PPT动画Tools - 动画查询与删除模块
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
* -
|
|
11
|
-
* - wps_ppt_remove_animation:
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* -
|
|
15
|
-
*
|
|
16
|
-
* - wps_ppt_set_slide_transition
|
|
17
|
-
*
|
|
18
|
-
* -
|
|
8
|
+
* 只留两个不能合并的工具:
|
|
9
|
+
* - wps_ppt_get_animations: 查询动画列表(只读,没东西可并入别的工具)
|
|
10
|
+
* - wps_ppt_remove_animation: 删除单个动画(破坏性,混进"设置"工具会污染注解)
|
|
11
|
+
*
|
|
12
|
+
* 第 8 轮合并掉了本文件原先的 7 个工具,它们都是别名,能力没丢:
|
|
13
|
+
* - wps_ppt_add_animation / add_animation_preset / add_emphasis_animation / set_animation_order
|
|
14
|
+
* → wps_ppt_set_animation(op: 'add' | 'reorder')
|
|
15
|
+
* - wps_ppt_set_slide_transition / apply_transition_to_all / remove_slide_transition
|
|
16
|
+
* → wps_ppt_set_transition(target: 'slide' | 'all',effect: 'none' 即取消切换)
|
|
17
|
+
* 旧名走 scripts/manual/tool-aliases.json 的别名表调用,参数映射也在那张表里。
|
|
19
18
|
*/
|
|
20
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
-
exports.animationTools = exports.
|
|
20
|
+
exports.animationTools = exports.getAnimationsHandler = exports.getAnimationsDefinition = exports.removeAnimationHandler = exports.removeAnimationDefinition = void 0;
|
|
22
21
|
const uuid_1 = require("uuid");
|
|
23
22
|
const tools_1 = require("../../types/tools");
|
|
24
23
|
const wps_client_1 = require("../../client/wps-client");
|
|
25
24
|
const wps_1 = require("../../types/wps");
|
|
26
|
-
// ==================== 1. 添加动画效果 ====================
|
|
27
25
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* MsoAnimEffect 编号 → 中文名。表抄自 wps-com.ps1 里 addAnimation 的 $effectMap(同一份真相),
|
|
27
|
+
* 补上入口/强调里常用的几个。getAnimations 回的是编号,不是名字。
|
|
28
|
+
* 认不出的就显示"效果 (#编号)",不猜。
|
|
30
29
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
category: tools_1.ToolCategory.PRESENTATION,
|
|
40
|
-
inputSchema: {
|
|
41
|
-
type: 'object',
|
|
42
|
-
properties: {
|
|
43
|
-
slideIndex: {
|
|
44
|
-
type: 'number',
|
|
45
|
-
description: '幻灯片页码(从1开始)',
|
|
46
|
-
},
|
|
47
|
-
shapeIndex: {
|
|
48
|
-
type: 'number',
|
|
49
|
-
description: '形状索引(从1开始)',
|
|
50
|
-
},
|
|
51
|
-
effect: {
|
|
52
|
-
type: 'string',
|
|
53
|
-
description: '动画效果名称,如 "fadeIn"、"flyIn"、"wipe" 等',
|
|
54
|
-
},
|
|
55
|
-
trigger: {
|
|
56
|
-
type: 'string',
|
|
57
|
-
description: '触发方式',
|
|
58
|
-
enum: ['onClick', 'withPrevious', 'afterPrevious'],
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
required: ['slideIndex', 'shapeIndex', 'effect'],
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
const addAnimationHandler = async (args) => {
|
|
65
|
-
const { slideIndex, shapeIndex, effect, trigger } = args;
|
|
66
|
-
try {
|
|
67
|
-
const response = await wps_client_1.wpsClient.executeMethod('addAnimation', {
|
|
68
|
-
slideIndex,
|
|
69
|
-
shapeIndex,
|
|
70
|
-
effect,
|
|
71
|
-
trigger: trigger || 'onClick',
|
|
72
|
-
}, wps_1.WpsAppType.PRESENTATION);
|
|
73
|
-
if (response.success && response.data) {
|
|
74
|
-
const triggerName = {
|
|
75
|
-
onClick: '单击时',
|
|
76
|
-
withPrevious: '与上一动画同时',
|
|
77
|
-
afterPrevious: '上一动画之后',
|
|
78
|
-
};
|
|
79
|
-
return {
|
|
80
|
-
id: (0, uuid_1.v4)(),
|
|
81
|
-
success: true,
|
|
82
|
-
content: [
|
|
83
|
-
{
|
|
84
|
-
type: 'text',
|
|
85
|
-
text: `动画添加成功!\n幻灯片: 第 ${slideIndex} 页\n形状: 第 ${shapeIndex} 个\n效果: ${effect}\n触发: ${triggerName[trigger || 'onClick'] || trigger}\n动画序号: ${response.data.animationIndex}`,
|
|
86
|
-
},
|
|
87
|
-
],
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
else {
|
|
91
|
-
return {
|
|
92
|
-
id: (0, uuid_1.v4)(),
|
|
93
|
-
success: false,
|
|
94
|
-
content: [{ type: 'text', text: `添加动画失败: ${response.error}` }],
|
|
95
|
-
error: response.error,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
catch (error) {
|
|
100
|
-
const errMsg = error instanceof Error ? error.message : String(error);
|
|
101
|
-
return {
|
|
102
|
-
id: (0, uuid_1.v4)(),
|
|
103
|
-
success: false,
|
|
104
|
-
content: [{ type: 'text', text: `添加动画出错: ${errMsg}` }],
|
|
105
|
-
error: errMsg,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
exports.addAnimationHandler = addAnimationHandler;
|
|
110
|
-
// ==================== 2. 移除动画效果 ====================
|
|
30
|
+
const EFFECT_ID_NAME_MAP = {
|
|
31
|
+
1: '出现', 2: '飞入', 3: '百叶窗', 4: '框', 5: '棋盘', 6: '圆形', 7: '爬行',
|
|
32
|
+
8: '菱形', 9: '溶解', 10: '淡入', 12: '切入', 13: '加号', 14: '随机条',
|
|
33
|
+
15: '旋转', 22: '擦除', 23: '百叶窗', 26: '弹跳', 28: '摆动', 30: '上浮',
|
|
34
|
+
34: '升起', 36: '细线', 37: '展开', 38: '鞭状', 46: '收缩', 50: '伸展',
|
|
35
|
+
53: '缩放', 59: '放大', 62: '强调颜色', 63: '脉冲',
|
|
36
|
+
};
|
|
37
|
+
// ==================== 1. 移除动画效果 ====================
|
|
111
38
|
/**
|
|
112
39
|
* 移除动画效果
|
|
113
40
|
* 从指定幻灯片中移除指定的动画
|
|
@@ -118,7 +45,10 @@ exports.removeAnimationDefinition = {
|
|
|
118
45
|
|
|
119
46
|
使用场景:
|
|
120
47
|
- "删除第1页的第2个动画"
|
|
121
|
-
- "移除这个动画效果"
|
|
48
|
+
- "移除这个动画效果"
|
|
49
|
+
|
|
50
|
+
先想清楚删的是哪一个:wps_ppt_get_animations 能列出序号,确认序号再删。
|
|
51
|
+
序号是本页动画窗格里的顺序(1 开始),加完动画会变。`,
|
|
122
52
|
category: tools_1.ToolCategory.PRESENTATION,
|
|
123
53
|
inputSchema: {
|
|
124
54
|
type: 'object',
|
|
@@ -171,7 +101,7 @@ const removeAnimationHandler = async (args) => {
|
|
|
171
101
|
}
|
|
172
102
|
};
|
|
173
103
|
exports.removeAnimationHandler = removeAnimationHandler;
|
|
174
|
-
// ====================
|
|
104
|
+
// ==================== 2. 获取动画列表 ====================
|
|
175
105
|
/**
|
|
176
106
|
* 获取动画列表
|
|
177
107
|
* 查看指定幻灯片上所有动画效果
|
|
@@ -213,15 +143,16 @@ const getAnimationsHandler = async (args) => {
|
|
|
213
143
|
],
|
|
214
144
|
};
|
|
215
145
|
}
|
|
216
|
-
const triggerName = {
|
|
217
|
-
onClick: '单击时',
|
|
218
|
-
withPrevious: '与上一动画同时',
|
|
219
|
-
afterPrevious: '上一动画之后',
|
|
220
|
-
};
|
|
221
146
|
let output = `第 ${slideIndex} 页的动画效果(共 ${animations.length} 个):\n`;
|
|
222
147
|
animations.forEach((anim) => {
|
|
223
|
-
|
|
148
|
+
const rawEffect = anim.effectType ?? anim.effect;
|
|
149
|
+
const effectText = typeof rawEffect === 'number'
|
|
150
|
+
? `${EFFECT_ID_NAME_MAP[rawEffect] ?? '效果'} (#${rawEffect})`
|
|
151
|
+
: String(rawEffect ?? '未知效果');
|
|
152
|
+
const dur = anim.duration === undefined || anim.duration === null ? '' : `,时长 ${anim.duration}s`;
|
|
153
|
+
output += ` ${anim.index}. [${anim.shapeName}] ${effectText}${dur}\n`;
|
|
224
154
|
});
|
|
155
|
+
output += `要调顺序用 wps_ppt_set_animation(op='reorder'),要删某一条用 wps_ppt_remove_animation。`;
|
|
225
156
|
return {
|
|
226
157
|
id: (0, uuid_1.v4)(),
|
|
227
158
|
success: true,
|
|
@@ -248,472 +179,12 @@ const getAnimationsHandler = async (args) => {
|
|
|
248
179
|
}
|
|
249
180
|
};
|
|
250
181
|
exports.getAnimationsHandler = getAnimationsHandler;
|
|
251
|
-
// ==================== 4. 设置动画顺序 ====================
|
|
252
|
-
/**
|
|
253
|
-
* 设置动画顺序
|
|
254
|
-
* 调整动画在时间线上的播放顺序
|
|
255
|
-
*/
|
|
256
|
-
exports.setAnimationOrderDefinition = {
|
|
257
|
-
name: 'wps_ppt_set_animation_order',
|
|
258
|
-
description: `调整动画在时间线上的播放顺序。
|
|
259
|
-
|
|
260
|
-
使用场景:
|
|
261
|
-
- "把第3个动画移到第1个播放"
|
|
262
|
-
- "调整动画顺序"`,
|
|
263
|
-
category: tools_1.ToolCategory.PRESENTATION,
|
|
264
|
-
inputSchema: {
|
|
265
|
-
type: 'object',
|
|
266
|
-
properties: {
|
|
267
|
-
slideIndex: {
|
|
268
|
-
type: 'number',
|
|
269
|
-
description: '幻灯片页码(从1开始)',
|
|
270
|
-
},
|
|
271
|
-
animationIndex: {
|
|
272
|
-
type: 'number',
|
|
273
|
-
description: '当前动画索引(从1开始)',
|
|
274
|
-
},
|
|
275
|
-
newOrder: {
|
|
276
|
-
type: 'number',
|
|
277
|
-
description: '新的播放顺序位置(从1开始)',
|
|
278
|
-
},
|
|
279
|
-
},
|
|
280
|
-
required: ['slideIndex', 'animationIndex', 'newOrder'],
|
|
281
|
-
},
|
|
282
|
-
};
|
|
283
|
-
const setAnimationOrderHandler = async (args) => {
|
|
284
|
-
const { slideIndex, animationIndex, newOrder } = args;
|
|
285
|
-
try {
|
|
286
|
-
const response = await wps_client_1.wpsClient.executeMethod('setAnimationOrder', { slideIndex, animationIndex, newOrder }, wps_1.WpsAppType.PRESENTATION);
|
|
287
|
-
if (response.success) {
|
|
288
|
-
return {
|
|
289
|
-
id: (0, uuid_1.v4)(),
|
|
290
|
-
success: true,
|
|
291
|
-
content: [
|
|
292
|
-
{
|
|
293
|
-
type: 'text',
|
|
294
|
-
text: `动画顺序调整成功!\n幻灯片: 第 ${slideIndex} 页\n动画 ${animationIndex} → 新位置 ${newOrder}`,
|
|
295
|
-
},
|
|
296
|
-
],
|
|
297
|
-
};
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
return {
|
|
301
|
-
id: (0, uuid_1.v4)(),
|
|
302
|
-
success: false,
|
|
303
|
-
content: [{ type: 'text', text: `调整动画顺序失败: ${response.error}` }],
|
|
304
|
-
error: response.error,
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
catch (error) {
|
|
309
|
-
const errMsg = error instanceof Error ? error.message : String(error);
|
|
310
|
-
return {
|
|
311
|
-
id: (0, uuid_1.v4)(),
|
|
312
|
-
success: false,
|
|
313
|
-
content: [{ type: 'text', text: `调整动画顺序出错: ${errMsg}` }],
|
|
314
|
-
error: errMsg,
|
|
315
|
-
};
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
exports.setAnimationOrderHandler = setAnimationOrderHandler;
|
|
319
|
-
// ==================== 5. 添加预设入场动画 ====================
|
|
320
|
-
/**
|
|
321
|
-
* 添加预设入场动画
|
|
322
|
-
* 提供常用的入场动画预设,简化动画添加流程
|
|
323
|
-
*/
|
|
324
|
-
exports.addAnimationPresetDefinition = {
|
|
325
|
-
name: 'wps_ppt_add_animation_preset',
|
|
326
|
-
description: `为形状添加预设入场动画效果。
|
|
327
|
-
|
|
328
|
-
支持的预设:
|
|
329
|
-
- fadeIn: 淡入
|
|
330
|
-
- flyIn: 飞入
|
|
331
|
-
- wipe: 擦除
|
|
332
|
-
- zoom: 缩放
|
|
333
|
-
- bounce: 弹跳
|
|
334
|
-
- spin: 旋转
|
|
335
|
-
|
|
336
|
-
使用场景:
|
|
337
|
-
- "给标题加个淡入效果"
|
|
338
|
-
- "让这个形状飞入"
|
|
339
|
-
- "添加弹跳入场动画"`,
|
|
340
|
-
category: tools_1.ToolCategory.PRESENTATION,
|
|
341
|
-
inputSchema: {
|
|
342
|
-
type: 'object',
|
|
343
|
-
properties: {
|
|
344
|
-
slideIndex: {
|
|
345
|
-
type: 'number',
|
|
346
|
-
description: '幻灯片页码(从1开始)',
|
|
347
|
-
},
|
|
348
|
-
shapeIndex: {
|
|
349
|
-
type: 'number',
|
|
350
|
-
description: '形状索引(从1开始)',
|
|
351
|
-
},
|
|
352
|
-
preset: {
|
|
353
|
-
type: 'string',
|
|
354
|
-
description: '预设动画类型',
|
|
355
|
-
enum: ['fadeIn', 'flyIn', 'wipe', 'zoom', 'bounce', 'spin'],
|
|
356
|
-
},
|
|
357
|
-
},
|
|
358
|
-
required: ['slideIndex', 'shapeIndex', 'preset'],
|
|
359
|
-
},
|
|
360
|
-
};
|
|
361
|
-
const addAnimationPresetHandler = async (args) => {
|
|
362
|
-
const { slideIndex, shapeIndex, preset } = args;
|
|
363
|
-
try {
|
|
364
|
-
const response = await wps_client_1.wpsClient.executeMethod('addAnimationPreset', { slideIndex, shapeIndex, preset }, wps_1.WpsAppType.PRESENTATION);
|
|
365
|
-
if (response.success && response.data) {
|
|
366
|
-
const presetName = {
|
|
367
|
-
fadeIn: '淡入',
|
|
368
|
-
flyIn: '飞入',
|
|
369
|
-
wipe: '擦除',
|
|
370
|
-
zoom: '缩放',
|
|
371
|
-
bounce: '弹跳',
|
|
372
|
-
spin: '旋转',
|
|
373
|
-
};
|
|
374
|
-
return {
|
|
375
|
-
id: (0, uuid_1.v4)(),
|
|
376
|
-
success: true,
|
|
377
|
-
content: [
|
|
378
|
-
{
|
|
379
|
-
type: 'text',
|
|
380
|
-
text: `预设动画添加成功!\n幻灯片: 第 ${slideIndex} 页\n形状: 第 ${shapeIndex} 个\n预设: ${presetName[preset] || preset}\n动画序号: ${response.data.animationIndex}`,
|
|
381
|
-
},
|
|
382
|
-
],
|
|
383
|
-
};
|
|
384
|
-
}
|
|
385
|
-
else {
|
|
386
|
-
return {
|
|
387
|
-
id: (0, uuid_1.v4)(),
|
|
388
|
-
success: false,
|
|
389
|
-
content: [{ type: 'text', text: `添加预设动画失败: ${response.error}` }],
|
|
390
|
-
error: response.error,
|
|
391
|
-
};
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
catch (error) {
|
|
395
|
-
const errMsg = error instanceof Error ? error.message : String(error);
|
|
396
|
-
return {
|
|
397
|
-
id: (0, uuid_1.v4)(),
|
|
398
|
-
success: false,
|
|
399
|
-
content: [{ type: 'text', text: `添加预设动画出错: ${errMsg}` }],
|
|
400
|
-
error: errMsg,
|
|
401
|
-
};
|
|
402
|
-
}
|
|
403
|
-
};
|
|
404
|
-
exports.addAnimationPresetHandler = addAnimationPresetHandler;
|
|
405
|
-
// ==================== 6. 添加强调动画 ====================
|
|
406
|
-
/**
|
|
407
|
-
* 添加强调动画
|
|
408
|
-
* 为已有形状添加强调型动画效果,用于突出显示
|
|
409
|
-
*/
|
|
410
|
-
exports.addEmphasisAnimationDefinition = {
|
|
411
|
-
name: 'wps_ppt_add_emphasis_animation',
|
|
412
|
-
description: `为形状添加强调动画效果,用于在演示时突出显示元素。
|
|
413
|
-
|
|
414
|
-
支持的效果:
|
|
415
|
-
- pulse: 脉冲
|
|
416
|
-
- spin: 陀螺旋
|
|
417
|
-
- grow: 放大/缩小
|
|
418
|
-
- teeter: 跷跷板
|
|
419
|
-
- colorPulse: 颜色脉冲
|
|
420
|
-
|
|
421
|
-
使用场景:
|
|
422
|
-
- "让这个元素闪烁突出"
|
|
423
|
-
- "添加脉冲强调效果"
|
|
424
|
-
- "让图片旋转强调"`,
|
|
425
|
-
category: tools_1.ToolCategory.PRESENTATION,
|
|
426
|
-
inputSchema: {
|
|
427
|
-
type: 'object',
|
|
428
|
-
properties: {
|
|
429
|
-
slideIndex: {
|
|
430
|
-
type: 'number',
|
|
431
|
-
description: '幻灯片页码(从1开始)',
|
|
432
|
-
},
|
|
433
|
-
shapeIndex: {
|
|
434
|
-
type: 'number',
|
|
435
|
-
description: '形状索引(从1开始)',
|
|
436
|
-
},
|
|
437
|
-
effect: {
|
|
438
|
-
type: 'string',
|
|
439
|
-
description: '强调动画效果',
|
|
440
|
-
enum: ['pulse', 'spin', 'grow', 'teeter', 'colorPulse'],
|
|
441
|
-
},
|
|
442
|
-
},
|
|
443
|
-
required: ['slideIndex', 'shapeIndex', 'effect'],
|
|
444
|
-
},
|
|
445
|
-
};
|
|
446
|
-
const addEmphasisAnimationHandler = async (args) => {
|
|
447
|
-
const { slideIndex, shapeIndex, effect } = args;
|
|
448
|
-
try {
|
|
449
|
-
const response = await wps_client_1.wpsClient.executeMethod('addEmphasisAnimation', { slideIndex, shapeIndex, effect }, wps_1.WpsAppType.PRESENTATION);
|
|
450
|
-
if (response.success && response.data) {
|
|
451
|
-
const effectName = {
|
|
452
|
-
pulse: '脉冲',
|
|
453
|
-
spin: '陀螺旋',
|
|
454
|
-
grow: '放大/缩小',
|
|
455
|
-
teeter: '跷跷板',
|
|
456
|
-
colorPulse: '颜色脉冲',
|
|
457
|
-
};
|
|
458
|
-
return {
|
|
459
|
-
id: (0, uuid_1.v4)(),
|
|
460
|
-
success: true,
|
|
461
|
-
content: [
|
|
462
|
-
{
|
|
463
|
-
type: 'text',
|
|
464
|
-
text: `强调动画添加成功!\n幻灯片: 第 ${slideIndex} 页\n形状: 第 ${shapeIndex} 个\n效果: ${effectName[effect] || effect}\n动画序号: ${response.data.animationIndex}`,
|
|
465
|
-
},
|
|
466
|
-
],
|
|
467
|
-
};
|
|
468
|
-
}
|
|
469
|
-
else {
|
|
470
|
-
return {
|
|
471
|
-
id: (0, uuid_1.v4)(),
|
|
472
|
-
success: false,
|
|
473
|
-
content: [{ type: 'text', text: `添加强调动画失败: ${response.error}` }],
|
|
474
|
-
error: response.error,
|
|
475
|
-
};
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
catch (error) {
|
|
479
|
-
const errMsg = error instanceof Error ? error.message : String(error);
|
|
480
|
-
return {
|
|
481
|
-
id: (0, uuid_1.v4)(),
|
|
482
|
-
success: false,
|
|
483
|
-
content: [{ type: 'text', text: `添加强调动画出错: ${errMsg}` }],
|
|
484
|
-
error: errMsg,
|
|
485
|
-
};
|
|
486
|
-
}
|
|
487
|
-
};
|
|
488
|
-
exports.addEmphasisAnimationHandler = addEmphasisAnimationHandler;
|
|
489
|
-
// ==================== 7. 设置幻灯片切换效果 ====================
|
|
490
|
-
/**
|
|
491
|
-
* 设置幻灯片切换效果
|
|
492
|
-
* 为幻灯片设置页面切换动画
|
|
493
|
-
*/
|
|
494
|
-
exports.setSlideTransitionDefinition = {
|
|
495
|
-
name: 'wps_ppt_set_slide_transition',
|
|
496
|
-
description: `设置幻灯片的页面切换效果。
|
|
497
|
-
|
|
498
|
-
常用切换效果:
|
|
499
|
-
- fade: 淡出
|
|
500
|
-
- push: 推入
|
|
501
|
-
- wipe: 擦除
|
|
502
|
-
- split: 分割
|
|
503
|
-
- reveal: 显露
|
|
504
|
-
- cover: 覆盖
|
|
505
|
-
- curtains: 帷幕
|
|
506
|
-
- blinds: 百叶窗
|
|
507
|
-
|
|
508
|
-
使用场景:
|
|
509
|
-
- "给第1页加个淡出切换"
|
|
510
|
-
- "设置页面切换为推入效果"
|
|
511
|
-
- "添加切换动画"`,
|
|
512
|
-
category: tools_1.ToolCategory.PRESENTATION,
|
|
513
|
-
inputSchema: {
|
|
514
|
-
type: 'object',
|
|
515
|
-
properties: {
|
|
516
|
-
slideIndex: {
|
|
517
|
-
type: 'number',
|
|
518
|
-
description: '幻灯片页码(从1开始)',
|
|
519
|
-
},
|
|
520
|
-
effect: {
|
|
521
|
-
type: 'string',
|
|
522
|
-
description: '切换效果名称',
|
|
523
|
-
},
|
|
524
|
-
duration: {
|
|
525
|
-
type: 'number',
|
|
526
|
-
description: '切换持续时间(秒),默认1秒',
|
|
527
|
-
},
|
|
528
|
-
sound: {
|
|
529
|
-
type: 'string',
|
|
530
|
-
description: '切换时播放的声音文件路径(可选)',
|
|
531
|
-
},
|
|
532
|
-
},
|
|
533
|
-
required: ['slideIndex', 'effect'],
|
|
534
|
-
},
|
|
535
|
-
};
|
|
536
|
-
const setSlideTransitionHandler = async (args) => {
|
|
537
|
-
const { slideIndex, effect, duration, sound } = args;
|
|
538
|
-
try {
|
|
539
|
-
const response = await wps_client_1.wpsClient.executeMethod('setSlideTransition', {
|
|
540
|
-
slideIndex,
|
|
541
|
-
effect,
|
|
542
|
-
duration: duration || 1,
|
|
543
|
-
sound,
|
|
544
|
-
}, wps_1.WpsAppType.PRESENTATION);
|
|
545
|
-
if (response.success) {
|
|
546
|
-
let output = `切换效果设置成功!\n幻灯片: 第 ${slideIndex} 页\n效果: ${effect}\n持续时间: ${duration || 1} 秒`;
|
|
547
|
-
if (sound) {
|
|
548
|
-
output += `\n声音: ${sound}`;
|
|
549
|
-
}
|
|
550
|
-
return {
|
|
551
|
-
id: (0, uuid_1.v4)(),
|
|
552
|
-
success: true,
|
|
553
|
-
content: [{ type: 'text', text: output }],
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
else {
|
|
557
|
-
return {
|
|
558
|
-
id: (0, uuid_1.v4)(),
|
|
559
|
-
success: false,
|
|
560
|
-
content: [{ type: 'text', text: `设置切换效果失败: ${response.error}` }],
|
|
561
|
-
error: response.error,
|
|
562
|
-
};
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
catch (error) {
|
|
566
|
-
const errMsg = error instanceof Error ? error.message : String(error);
|
|
567
|
-
return {
|
|
568
|
-
id: (0, uuid_1.v4)(),
|
|
569
|
-
success: false,
|
|
570
|
-
content: [{ type: 'text', text: `设置切换效果出错: ${errMsg}` }],
|
|
571
|
-
error: errMsg,
|
|
572
|
-
};
|
|
573
|
-
}
|
|
574
|
-
};
|
|
575
|
-
exports.setSlideTransitionHandler = setSlideTransitionHandler;
|
|
576
|
-
// ==================== 8. 移除幻灯片切换效果 ====================
|
|
577
|
-
/**
|
|
578
|
-
* 移除幻灯片切换效果
|
|
579
|
-
* 清除指定幻灯片的切换动画
|
|
580
|
-
*/
|
|
581
|
-
exports.removeSlideTransitionDefinition = {
|
|
582
|
-
name: 'wps_ppt_remove_slide_transition',
|
|
583
|
-
description: `移除幻灯片的切换效果。
|
|
584
|
-
|
|
585
|
-
使用场景:
|
|
586
|
-
- "取消第1页的切换效果"
|
|
587
|
-
- "移除页面切换动画"`,
|
|
588
|
-
category: tools_1.ToolCategory.PRESENTATION,
|
|
589
|
-
inputSchema: {
|
|
590
|
-
type: 'object',
|
|
591
|
-
properties: {
|
|
592
|
-
slideIndex: {
|
|
593
|
-
type: 'number',
|
|
594
|
-
description: '幻灯片页码(从1开始)',
|
|
595
|
-
},
|
|
596
|
-
},
|
|
597
|
-
required: ['slideIndex'],
|
|
598
|
-
},
|
|
599
|
-
};
|
|
600
|
-
const removeSlideTransitionHandler = async (args) => {
|
|
601
|
-
const { slideIndex } = args;
|
|
602
|
-
try {
|
|
603
|
-
const response = await wps_client_1.wpsClient.executeMethod('removeSlideTransition', { slideIndex }, wps_1.WpsAppType.PRESENTATION);
|
|
604
|
-
if (response.success) {
|
|
605
|
-
return {
|
|
606
|
-
id: (0, uuid_1.v4)(),
|
|
607
|
-
success: true,
|
|
608
|
-
content: [
|
|
609
|
-
{
|
|
610
|
-
type: 'text',
|
|
611
|
-
text: `切换效果已移除!\n幻灯片: 第 ${slideIndex} 页`,
|
|
612
|
-
},
|
|
613
|
-
],
|
|
614
|
-
};
|
|
615
|
-
}
|
|
616
|
-
else {
|
|
617
|
-
return {
|
|
618
|
-
id: (0, uuid_1.v4)(),
|
|
619
|
-
success: false,
|
|
620
|
-
content: [{ type: 'text', text: `移除切换效果失败: ${response.error}` }],
|
|
621
|
-
error: response.error,
|
|
622
|
-
};
|
|
623
|
-
}
|
|
624
|
-
}
|
|
625
|
-
catch (error) {
|
|
626
|
-
const errMsg = error instanceof Error ? error.message : String(error);
|
|
627
|
-
return {
|
|
628
|
-
id: (0, uuid_1.v4)(),
|
|
629
|
-
success: false,
|
|
630
|
-
content: [{ type: 'text', text: `移除切换效果出错: ${errMsg}` }],
|
|
631
|
-
error: errMsg,
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
};
|
|
635
|
-
exports.removeSlideTransitionHandler = removeSlideTransitionHandler;
|
|
636
|
-
// ==================== 9. 应用切换效果到所有幻灯片 ====================
|
|
637
|
-
/**
|
|
638
|
-
* 应用切换效果到所有幻灯片
|
|
639
|
-
* 一次性为所有幻灯片设置统一的切换效果
|
|
640
|
-
*/
|
|
641
|
-
exports.applyTransitionToAllDefinition = {
|
|
642
|
-
name: 'wps_ppt_apply_transition_to_all',
|
|
643
|
-
description: `为所有幻灯片应用统一的切换效果。
|
|
644
|
-
|
|
645
|
-
使用场景:
|
|
646
|
-
- "给所有页面加上淡出切换"
|
|
647
|
-
- "统一设置切换效果"
|
|
648
|
-
- "所有幻灯片用推入切换"`,
|
|
649
|
-
category: tools_1.ToolCategory.PRESENTATION,
|
|
650
|
-
inputSchema: {
|
|
651
|
-
type: 'object',
|
|
652
|
-
properties: {
|
|
653
|
-
effect: {
|
|
654
|
-
type: 'string',
|
|
655
|
-
description: '切换效果名称,如 "fade"、"push"、"wipe" 等',
|
|
656
|
-
},
|
|
657
|
-
duration: {
|
|
658
|
-
type: 'number',
|
|
659
|
-
description: '切换持续时间(秒),默认1秒',
|
|
660
|
-
},
|
|
661
|
-
},
|
|
662
|
-
required: ['effect'],
|
|
663
|
-
},
|
|
664
|
-
};
|
|
665
|
-
const applyTransitionToAllHandler = async (args) => {
|
|
666
|
-
const { effect, duration } = args;
|
|
667
|
-
try {
|
|
668
|
-
const response = await wps_client_1.wpsClient.executeMethod('applyTransitionToAll', {
|
|
669
|
-
effect,
|
|
670
|
-
duration: duration || 1,
|
|
671
|
-
}, wps_1.WpsAppType.PRESENTATION);
|
|
672
|
-
if (response.success && response.data) {
|
|
673
|
-
return {
|
|
674
|
-
id: (0, uuid_1.v4)(),
|
|
675
|
-
success: true,
|
|
676
|
-
content: [
|
|
677
|
-
{
|
|
678
|
-
type: 'text',
|
|
679
|
-
text: `切换效果已应用到所有幻灯片!\n效果: ${effect}\n持续时间: ${duration || 1} 秒\n应用页数: ${response.data.slideCount} 页`,
|
|
680
|
-
},
|
|
681
|
-
],
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
else {
|
|
685
|
-
return {
|
|
686
|
-
id: (0, uuid_1.v4)(),
|
|
687
|
-
success: false,
|
|
688
|
-
content: [{ type: 'text', text: `应用切换效果失败: ${response.error}` }],
|
|
689
|
-
error: response.error,
|
|
690
|
-
};
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
catch (error) {
|
|
694
|
-
const errMsg = error instanceof Error ? error.message : String(error);
|
|
695
|
-
return {
|
|
696
|
-
id: (0, uuid_1.v4)(),
|
|
697
|
-
success: false,
|
|
698
|
-
content: [{ type: 'text', text: `应用切换效果出错: ${errMsg}` }],
|
|
699
|
-
error: errMsg,
|
|
700
|
-
};
|
|
701
|
-
}
|
|
702
|
-
};
|
|
703
|
-
exports.applyTransitionToAllHandler = applyTransitionToAllHandler;
|
|
704
182
|
/**
|
|
705
|
-
*
|
|
183
|
+
* 导出动画查询/删除相关的Tools
|
|
706
184
|
*/
|
|
707
185
|
exports.animationTools = [
|
|
708
|
-
{ definition: exports.addAnimationDefinition, handler: exports.addAnimationHandler },
|
|
709
186
|
{ definition: exports.removeAnimationDefinition, handler: exports.removeAnimationHandler },
|
|
710
187
|
{ definition: exports.getAnimationsDefinition, handler: exports.getAnimationsHandler },
|
|
711
|
-
{ definition: exports.setAnimationOrderDefinition, handler: exports.setAnimationOrderHandler },
|
|
712
|
-
{ definition: exports.addAnimationPresetDefinition, handler: exports.addAnimationPresetHandler },
|
|
713
|
-
{ definition: exports.addEmphasisAnimationDefinition, handler: exports.addEmphasisAnimationHandler },
|
|
714
|
-
{ definition: exports.setSlideTransitionDefinition, handler: exports.setSlideTransitionHandler },
|
|
715
|
-
{ definition: exports.removeSlideTransitionDefinition, handler: exports.removeSlideTransitionHandler },
|
|
716
|
-
{ definition: exports.applyTransitionToAllDefinition, handler: exports.applyTransitionToAllHandler },
|
|
717
188
|
];
|
|
718
189
|
exports.default = exports.animationTools;
|
|
719
190
|
//# sourceMappingURL=animation.js.map
|