ms-types 0.11.2 → 0.11.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-types",
3
- "version": "0.11.2",
3
+ "version": "0.11.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "types": "./types/index.d.ts",
@@ -24,6 +24,6 @@
24
24
  "devDependencies": {
25
25
  "vitepress": "^1.6.4",
26
26
  "vitepress-theme-teek": "^1.6.2",
27
- "wrangler": "^4.131.2"
27
+ "wrangler": "^4.142.0"
28
28
  }
29
29
  }
package/types/image.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  */
4
4
  declare namespace image {
5
5
  /**
6
- * 截图屏幕
6
+ * 截图屏幕。按 `setCaptureImageId` 设置的 imageId 截取,未设置时为 `"screen"`。越狱版固定 `"screen"`。
7
7
  * @param x 截图区域左上角x坐标
8
8
  * @param y 截图区域左上角y坐标
9
9
  * @param ex 截图区域右下角x坐标
@@ -21,6 +21,16 @@ declare namespace image {
21
21
  ex?: number,
22
22
  ey?: number,
23
23
  ): string | undefined;
24
+ /**
25
+ * 设置 `captureScreen` 使用的 imageId。
26
+ * 可传入 `"screen"`、`"shortcut"`、`"actionScreenshot"`、`"vpnScreenshot"`、图片路径或已有图片 ID。
27
+ * 未传入或空字符串不修改当前来源。越狱版调用后不生效。
28
+ * @param imageId 之后 `captureScreen` 读取的来源
29
+ * @example
30
+ * image.setCaptureImageId("shortcut")
31
+ * const imageId = image.captureScreen()
32
+ */
33
+ function setCaptureImageId(imageId: string): void;
24
34
  /**
25
35
  * 保存图片
26
36
  * @param imageId 图片id 路径 http地址或者 screen 实时截屏
@@ -30,7 +30,7 @@ local _Image = {}
30
30
  ---@field scaleFactors number[]|nil 仅 method=99:模板缩放比例列表
31
31
  ---@field orz integer|nil 查找方向 1-8,与 findColor 相同
32
32
 
33
- --- 截取屏幕;坐标缺省 0 表示全屏
33
+ --- 截取屏幕;坐标缺省 0 表示全屏。按 setCaptureImageId 设置的 imageId 截取,未设置时为 screen。越狱版固定 screen。
34
34
  ---@param x integer|nil 截图区域左上角x坐标
35
35
  ---@param y integer|nil 截图区域左上角y坐标
36
36
  ---@param ex integer|nil 截图区域右下角x坐标
@@ -42,6 +42,14 @@ local _Image = {}
42
42
  --- end
43
43
  function _Image.captureScreen(x, y, ex, ey) return '' end
44
44
 
45
+ --- 设置 captureScreen 使用的 imageId。
46
+ --- 可传入 screen、shortcut、actionScreenshot、vpnScreenshot、图片路径或已有图片 ID。
47
+ --- 越狱版调用后不生效。
48
+ ---@param imageId string 之后 captureScreen 读取的来源
49
+ ---@example image.setCaptureImageId("shortcut")
50
+ --- local imageId = image.captureScreen()
51
+ function _Image.setCaptureImageId(imageId) end
52
+
45
53
  --- 读取图片
46
54
  ---@param path string 图片路径
47
55
  ---@return string 图片id ,如果读取失败则返回null
@@ -15,7 +15,7 @@ local _System = {}
15
15
  ---@field usagePercentage integer 使用率(0-100)
16
16
 
17
17
  --- 启动应用
18
- ---@param bundleId string 应用bundleId
18
+ ---@param bundleId string Bundle ID,或已安装应用的显示名 appName。同名多个应用时失败
19
19
  ---@return boolean 是否启动成功
20
20
  ---@example local started = system.startApp("cn.magicnode.script")
21
21
  --- if started then
@@ -24,7 +24,7 @@ local _System = {}
24
24
  function _System.startApp(bundleId) return true end
25
25
 
26
26
  --- 停止应用
27
- ---@param bundleId string 应用bundleId
27
+ ---@param bundleId string Bundle ID,或已安装应用的显示名 appName。同名多个应用时失败
28
28
  ---@return boolean 是否关闭成功
29
29
  ---@example local stopped = system.stopApp("cn.magicnode.script")
30
30
  --- if stopped then
@@ -33,7 +33,7 @@ function _System.startApp(bundleId) return true end
33
33
  function _System.stopApp(bundleId) return true end
34
34
 
35
35
  --- 激活应用到前台(未启动则启动)
36
- ---@param bundleId string 应用bundleId
36
+ ---@param bundleId string Bundle ID,或已安装应用的显示名 appName。同名多个应用时失败
37
37
  ---@return boolean 是否激活成功
38
38
  ---@example local activated = system.activateApp("cn.magicnode.script")
39
39
  --- if activated then
package/types/system.d.ts CHANGED
@@ -16,7 +16,7 @@ declare namespace system {
16
16
 
17
17
  /**
18
18
  * 启动应用
19
- * @param bundleId 应用bundleId
19
+ * @param bundleId Bundle ID,或已安装应用的显示名 appName。同名多个应用时失败
20
20
  * @returns 是否启动成功
21
21
  * @example
22
22
  * const started = system.startApp("cn.magicnode.script")
@@ -27,7 +27,7 @@ declare namespace system {
27
27
  function startApp(bundleId: string): boolean;
28
28
  /**
29
29
  * 关闭应用
30
- * @param bundleId 应用bundleId
30
+ * @param bundleId Bundle ID,或已安装应用的显示名 appName。同名多个应用时失败
31
31
  * @returns 是否关闭成功
32
32
  * @example
33
33
  * const stopped = system.stopApp("cn.magicnode.script")
@@ -38,7 +38,7 @@ declare namespace system {
38
38
  function stopApp(bundleId: string): boolean;
39
39
  /**
40
40
  * 激活应用 没启动就会启动 启动了就会进入前台
41
- * @param bundleId 应用bundleId
41
+ * @param bundleId Bundle ID,或已安装应用的显示名 appName。同名多个应用时失败
42
42
  * @returns 是否激活成功
43
43
  * @example
44
44
  * const activated = system.activateApp("cn.magicnode.script")
@@ -5,7 +5,7 @@
5
5
  */
6
6
  declare namespace $图片 {
7
7
  /**
8
- * 截取屏幕
8
+ * 截取屏幕。按 `设置默认截图` 设置的图片 ID 截取,未设置时为 `"screen"`。越狱版固定 `"screen"`。
9
9
  * @param 区域左上角X坐标
10
10
  * @param 区域左上角Y坐标
11
11
  * @param 区域右下角X坐标
@@ -23,6 +23,16 @@ declare namespace $图片 {
23
23
  区域右下角X坐标?: 数字,
24
24
  区域右下角Y坐标?: 数字,
25
25
  ): 字符串 | undefined;
26
+ /**
27
+ * 设置 `截取屏幕` 使用的图片 ID。
28
+ * 可传入 `"screen"`、`"shortcut"`、`"actionScreenshot"`、`"vpnScreenshot"`、图片路径或已有图片 ID。
29
+ * 未传入或空字符串不修改当前来源。越狱版调用后不生效。
30
+ * @param 图片ID 之后 `截取屏幕` 读取的来源
31
+ * @example
32
+ * $图片.设置默认截图("shortcut")
33
+ * const 图片ID = $图片.截取屏幕()
34
+ */
35
+ function 设置默认截图(图片ID: 字符串): 无返回值;
26
36
  /**
27
37
  * 保存图片
28
38
  * @param imageId 图片id 路径 http地址或者 screen 实时截屏
@@ -18,7 +18,7 @@ declare namespace $系统 {
18
18
 
19
19
  /**
20
20
  * 启动应用
21
- * @param bundleId 应用bundleId
21
+ * @param bundleId Bundle ID,或已安装应用的显示名 appName。同名多个应用时失败
22
22
  * @returns 是否启动成功
23
23
  * @example
24
24
  * const 是否启动成功 = $系统.启动应用("cn.magicnode.script")
@@ -29,7 +29,7 @@ declare namespace $系统 {
29
29
  function 启动应用(bundleId: 字符串): 布尔值;
30
30
  /**
31
31
  * 停止应用
32
- * @param bundleId 应用bundleId
32
+ * @param bundleId Bundle ID,或已安装应用的显示名 appName。同名多个应用时失败
33
33
  * @returns 是否关闭成功
34
34
  * @example
35
35
  * const 是否关闭成功 = $系统.停止应用("cn.magicnode.script")
@@ -40,7 +40,7 @@ declare namespace $系统 {
40
40
  function 停止应用(bundleId: 字符串): 布尔值;
41
41
  /**
42
42
  * 激活应用 没启动就会启动 启动了就会进入前台
43
- * @param bundleId 应用bundleId
43
+ * @param bundleId Bundle ID,或已安装应用的显示名 appName。同名多个应用时失败
44
44
  * @returns 是否激活成功
45
45
  * @example
46
46
  * const 是否激活成功 = $系统.把应用切入前台("cn.magicnode.script")