@showlotus/open-scriptable 0.1.0
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/README.md +1 -0
- package/dist/hello-world.js +1 -0
- package/globalconfig.d.ts +5 -0
- package/package.json +37 -0
- package/scriptable.d.ts +1724 -0
package/scriptable.d.ts
ADDED
|
@@ -0,0 +1,1724 @@
|
|
|
1
|
+
export {};
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
// ==================== 基础类型和几何类 ====================
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 字体类
|
|
8
|
+
*/
|
|
9
|
+
class Font {
|
|
10
|
+
/** 粗体系统字体 */
|
|
11
|
+
static boldSystemFont(size: number): Font;
|
|
12
|
+
/** 斜体系统字体 */
|
|
13
|
+
static italicSystemFont(size: number): Font;
|
|
14
|
+
/** 细体系统字体 */
|
|
15
|
+
static lightSystemFont(size: number): Font;
|
|
16
|
+
/** 中等系统字体 */
|
|
17
|
+
static mediumSystemFont(size: number): Font;
|
|
18
|
+
/** 常规系统字体 */
|
|
19
|
+
static regularSystemFont(size: number): Font;
|
|
20
|
+
/** 半粗体系统字体 */
|
|
21
|
+
static semiboldSystemFont(size: number): Font;
|
|
22
|
+
/** 系统字体 */
|
|
23
|
+
static systemFont(size: number): Font;
|
|
24
|
+
/** 超细系统字体 */
|
|
25
|
+
static ultraLightSystemFont(size: number): Font;
|
|
26
|
+
/** 极细系统字体 */
|
|
27
|
+
static thinSystemFont(size: number): Font;
|
|
28
|
+
/** 重磅系统字体 */
|
|
29
|
+
static heavySystemFont(size: number): Font;
|
|
30
|
+
/** 黑色系统字体 */
|
|
31
|
+
static blackSystemFont(size: number): Font;
|
|
32
|
+
/** 等宽系统字体 */
|
|
33
|
+
static monospacedSystemFont(size: number, weight: number): Font;
|
|
34
|
+
/** 等宽数字系统字体 */
|
|
35
|
+
static monospacedDigitSystemFont(size: number, weight: number): Font;
|
|
36
|
+
/** 圆角系统字体 */
|
|
37
|
+
static roundedSystemFont(size: number, weight: number): Font;
|
|
38
|
+
/** 自定义字体 */
|
|
39
|
+
static custom(name: string, size: number): Font;
|
|
40
|
+
/** 大标题字体 */
|
|
41
|
+
static largeTitle(): Font;
|
|
42
|
+
/** 标题 1 字体 */
|
|
43
|
+
static title1(): Font;
|
|
44
|
+
/** 标题 2 字体 */
|
|
45
|
+
static title2(): Font;
|
|
46
|
+
/** 标题 3 字体 */
|
|
47
|
+
static title3(): Font;
|
|
48
|
+
/** 标题字体 */
|
|
49
|
+
static headline(): Font;
|
|
50
|
+
/** 副标题字体 */
|
|
51
|
+
static subheadline(): Font;
|
|
52
|
+
/** 正文字体 */
|
|
53
|
+
static body(): Font;
|
|
54
|
+
/** 标注字体 */
|
|
55
|
+
static callout(): Font;
|
|
56
|
+
/** 脚注字体 */
|
|
57
|
+
static footnote(): Font;
|
|
58
|
+
/** 说明字体 */
|
|
59
|
+
static caption1(): Font;
|
|
60
|
+
/** 说明 2 字体 */
|
|
61
|
+
static caption2(): Font;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* 尺寸类
|
|
66
|
+
*/
|
|
67
|
+
class Size {
|
|
68
|
+
/** 宽度 */
|
|
69
|
+
width: number;
|
|
70
|
+
/** 高度 */
|
|
71
|
+
height: number;
|
|
72
|
+
|
|
73
|
+
constructor(width: number, height: number);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 点类
|
|
78
|
+
*/
|
|
79
|
+
class Point {
|
|
80
|
+
/** x 坐标 */
|
|
81
|
+
x: number;
|
|
82
|
+
/** y 坐标 */
|
|
83
|
+
y: number;
|
|
84
|
+
|
|
85
|
+
constructor(x: number, y: number);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* 矩形类
|
|
90
|
+
*/
|
|
91
|
+
class Rect {
|
|
92
|
+
/** x 坐标 */
|
|
93
|
+
x: number;
|
|
94
|
+
/** y 坐标 */
|
|
95
|
+
y: number;
|
|
96
|
+
/** 宽度 */
|
|
97
|
+
width: number;
|
|
98
|
+
/** 高度 */
|
|
99
|
+
height: number;
|
|
100
|
+
/** 最小 x 坐标 */
|
|
101
|
+
readonly minX: number;
|
|
102
|
+
/** 最小 y 坐标 */
|
|
103
|
+
readonly minY: number;
|
|
104
|
+
/** 最大 x 坐标 */
|
|
105
|
+
readonly maxX: number;
|
|
106
|
+
/** 最大 y 坐标 */
|
|
107
|
+
readonly maxY: number;
|
|
108
|
+
/** 原点 */
|
|
109
|
+
readonly origin: Point;
|
|
110
|
+
/** 尺寸 */
|
|
111
|
+
readonly size: Size;
|
|
112
|
+
|
|
113
|
+
constructor(x: number, y: number, width: number, height: number);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* 路径类
|
|
118
|
+
*/
|
|
119
|
+
class Path {
|
|
120
|
+
/** 移动到点 */
|
|
121
|
+
move(point: Point): void;
|
|
122
|
+
/** 添加线条到点 */
|
|
123
|
+
addLine(point: Point): void;
|
|
124
|
+
/** 添加矩形 */
|
|
125
|
+
addRect(rect: Rect): void;
|
|
126
|
+
/** 添加椭圆 */
|
|
127
|
+
addEllipse(rect: Rect): void;
|
|
128
|
+
/** 添加圆角矩形 */
|
|
129
|
+
addRoundedRect(rect: Rect, cornerWidth: number, cornerHeight: number): void;
|
|
130
|
+
/** 添加曲线 */
|
|
131
|
+
addCurve(point: Point, control1: Point, control2: Point): void;
|
|
132
|
+
/** 添加二次曲线 */
|
|
133
|
+
addQuadCurve(point: Point, control: Point): void;
|
|
134
|
+
/** 添加多条线 */
|
|
135
|
+
addLines(points: Point[]): void;
|
|
136
|
+
/** 添加多个矩形 */
|
|
137
|
+
addRects(rects: Rect[]): void;
|
|
138
|
+
/** 关闭子路径 */
|
|
139
|
+
closeSubpath(): void;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* 数据类
|
|
144
|
+
*/
|
|
145
|
+
class Data {
|
|
146
|
+
/** 从字符串创建数据 */
|
|
147
|
+
static fromString(string: string): Data;
|
|
148
|
+
/** 从文件创建数据 */
|
|
149
|
+
static fromFile(filePath: string): Data;
|
|
150
|
+
/** 从 Base64 字符串创建数据 */
|
|
151
|
+
static fromBase64String(base64String: string): Data;
|
|
152
|
+
/** 从 JPEG 图像创建数据 */
|
|
153
|
+
static fromJPEG(image: Image): Data;
|
|
154
|
+
/** 从 PNG 图像创建数据 */
|
|
155
|
+
static fromPNG(image: Image): Data;
|
|
156
|
+
/** 从字节数组创建数据 */
|
|
157
|
+
static fromBytes(bytes: number[]): Data;
|
|
158
|
+
/** 转换为原始字符串 */
|
|
159
|
+
toRawString(): string;
|
|
160
|
+
/** 转换为 Base64 字符串 */
|
|
161
|
+
toBase64String(): string;
|
|
162
|
+
/** 获取字节数组 */
|
|
163
|
+
getBytes(): number[];
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// ==================== 小组件相关类 ====================
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* 小组件文本类
|
|
170
|
+
*/
|
|
171
|
+
class WidgetText {
|
|
172
|
+
/** 文本内容 */
|
|
173
|
+
text: string;
|
|
174
|
+
/** 文本颜色 */
|
|
175
|
+
textColor: Color;
|
|
176
|
+
/** 字体 */
|
|
177
|
+
font: Font;
|
|
178
|
+
/** 文本透明度 */
|
|
179
|
+
textOpacity: number;
|
|
180
|
+
/** 行数限制 */
|
|
181
|
+
lineLimit: number;
|
|
182
|
+
/** 最小缩放因子 */
|
|
183
|
+
minimumScaleFactor: number;
|
|
184
|
+
/** 阴影颜色 */
|
|
185
|
+
shadowColor: Color;
|
|
186
|
+
/** 阴影半径 */
|
|
187
|
+
shadowRadius: number;
|
|
188
|
+
/** 阴影偏移 */
|
|
189
|
+
shadowOffset: Point;
|
|
190
|
+
/** 点击 URL */
|
|
191
|
+
url: string;
|
|
192
|
+
|
|
193
|
+
/** 文本居中对齐 */
|
|
194
|
+
centerAlignText(): void;
|
|
195
|
+
/** 文本左对齐 */
|
|
196
|
+
leftAlignText(): void;
|
|
197
|
+
/** 文本右对齐 */
|
|
198
|
+
rightAlignText(): void;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* 小组件图像类
|
|
203
|
+
*/
|
|
204
|
+
class WidgetImage {
|
|
205
|
+
/** 图像 */
|
|
206
|
+
image: Image;
|
|
207
|
+
/** 图像尺寸 */
|
|
208
|
+
imageSize: Size;
|
|
209
|
+
/** 图像透明度 */
|
|
210
|
+
imageOpacity: number;
|
|
211
|
+
/** 圆角半径 */
|
|
212
|
+
cornerRadius: number;
|
|
213
|
+
/** 边框宽度 */
|
|
214
|
+
borderWidth: number;
|
|
215
|
+
/** 边框颜色 */
|
|
216
|
+
borderColor: Color;
|
|
217
|
+
/** 容器相对形状 */
|
|
218
|
+
containerRelativeShape: boolean;
|
|
219
|
+
/** 色调 */
|
|
220
|
+
tintColor: Color;
|
|
221
|
+
/** 点击 URL */
|
|
222
|
+
url: string;
|
|
223
|
+
/** 可调整大小 */
|
|
224
|
+
resizable: boolean;
|
|
225
|
+
/** 图像对齐方式 */
|
|
226
|
+
imageAlignment: number;
|
|
227
|
+
|
|
228
|
+
/** 左对齐图像 */
|
|
229
|
+
leftAlignImage(): void;
|
|
230
|
+
/** 居中对齐图像 */
|
|
231
|
+
centerAlignImage(): void;
|
|
232
|
+
/** 右对齐图像 */
|
|
233
|
+
rightAlignImage(): void;
|
|
234
|
+
/** 应用过滤色 */
|
|
235
|
+
applyFillingContentMode(): void;
|
|
236
|
+
/** 应用适配内容模式 */
|
|
237
|
+
applyFittingContentMode(): void;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* 小组件日期类
|
|
242
|
+
*/
|
|
243
|
+
class WidgetDate {
|
|
244
|
+
/** 日期 */
|
|
245
|
+
date: Date;
|
|
246
|
+
/** 文本颜色 */
|
|
247
|
+
textColor: Color;
|
|
248
|
+
/** 字体 */
|
|
249
|
+
font: Font;
|
|
250
|
+
/** 文本透明度 */
|
|
251
|
+
textOpacity: number;
|
|
252
|
+
/** 行数限制 */
|
|
253
|
+
lineLimit: number;
|
|
254
|
+
/** 最小缩放因子 */
|
|
255
|
+
minimumScaleFactor: number;
|
|
256
|
+
/** 阴影颜色 */
|
|
257
|
+
shadowColor: Color;
|
|
258
|
+
/** 阴影半径 */
|
|
259
|
+
shadowRadius: number;
|
|
260
|
+
/** 阴影偏移 */
|
|
261
|
+
shadowOffset: Point;
|
|
262
|
+
/** 点击 URL */
|
|
263
|
+
url: string;
|
|
264
|
+
|
|
265
|
+
/** 左对齐文本 */
|
|
266
|
+
leftAlignText(): void;
|
|
267
|
+
/** 居中对齐文本 */
|
|
268
|
+
centerAlignText(): void;
|
|
269
|
+
/** 右对齐文本 */
|
|
270
|
+
rightAlignText(): void;
|
|
271
|
+
/** 应用时间样式 */
|
|
272
|
+
applyTimeStyle(): void;
|
|
273
|
+
/** 应用日期样式 */
|
|
274
|
+
applyDateStyle(): void;
|
|
275
|
+
/** 应用相对样式 */
|
|
276
|
+
applyRelativeStyle(): void;
|
|
277
|
+
/** 应用偏移样式 */
|
|
278
|
+
applyOffsetStyle(): void;
|
|
279
|
+
/** 应用计时器样式 */
|
|
280
|
+
applyTimerStyle(): void;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* 小组件间隔类
|
|
285
|
+
*/
|
|
286
|
+
class WidgetSpacer {
|
|
287
|
+
/** 间隔长度 */
|
|
288
|
+
length: number;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* 小组件堆栈类
|
|
293
|
+
*/
|
|
294
|
+
class WidgetStack {
|
|
295
|
+
/** 背景颜色 */
|
|
296
|
+
backgroundColor: Color;
|
|
297
|
+
/** 背景图像 */
|
|
298
|
+
backgroundImage: Image;
|
|
299
|
+
/** 背景渐变 */
|
|
300
|
+
backgroundGradient: LinearGradient;
|
|
301
|
+
/** 间距 */
|
|
302
|
+
spacing: number;
|
|
303
|
+
/** 尺寸 */
|
|
304
|
+
size: Size;
|
|
305
|
+
/** 圆角半径 */
|
|
306
|
+
cornerRadius: number;
|
|
307
|
+
/** 边框宽度 */
|
|
308
|
+
borderWidth: number;
|
|
309
|
+
/** 边框颜色 */
|
|
310
|
+
borderColor: Color;
|
|
311
|
+
/** 点击 URL */
|
|
312
|
+
url: string;
|
|
313
|
+
|
|
314
|
+
/** 添加文本 */
|
|
315
|
+
addText(text: string): WidgetText;
|
|
316
|
+
/** 添加日期 */
|
|
317
|
+
addDate(date: Date): WidgetDate;
|
|
318
|
+
/** 添加图像 */
|
|
319
|
+
addImage(image: Image): WidgetImage;
|
|
320
|
+
/** 添加间隔 */
|
|
321
|
+
addSpacer(length?: number | null): WidgetSpacer;
|
|
322
|
+
/** 添加堆栈 */
|
|
323
|
+
addStack(): WidgetStack;
|
|
324
|
+
/** 设置内边距 */
|
|
325
|
+
setPadding(top: number, leading: number, bottom: number, trailing: number): void;
|
|
326
|
+
/** 使用默认内边距 */
|
|
327
|
+
useDefaultPadding(): void;
|
|
328
|
+
/** 顶部对齐内容 */
|
|
329
|
+
topAlignContent(): void;
|
|
330
|
+
/** 居中对齐内容 */
|
|
331
|
+
centerAlignContent(): void;
|
|
332
|
+
/** 底部对齐内容 */
|
|
333
|
+
bottomAlignContent(): void;
|
|
334
|
+
/** 水平布局 */
|
|
335
|
+
layoutHorizontally(): void;
|
|
336
|
+
/** 垂直布局 */
|
|
337
|
+
layoutVertically(): void;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* 线性渐变类
|
|
342
|
+
*/
|
|
343
|
+
class LinearGradient {
|
|
344
|
+
/** 渐变颜色 */
|
|
345
|
+
colors: Color[];
|
|
346
|
+
/** 渐变位置 */
|
|
347
|
+
locations: number[];
|
|
348
|
+
/** 起始点 */
|
|
349
|
+
startPoint: Point;
|
|
350
|
+
/** 结束点 */
|
|
351
|
+
endPoint: Point;
|
|
352
|
+
|
|
353
|
+
constructor();
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* 颜色类
|
|
358
|
+
*/
|
|
359
|
+
class Color {
|
|
360
|
+
constructor(hex: string, alpha?: number);
|
|
361
|
+
/** 创建动态颜色(支持亮色和暗色模式) */
|
|
362
|
+
static dynamic(lightColor: Color, darkColor: Color): Color;
|
|
363
|
+
static black(): Color;
|
|
364
|
+
static white(): Color;
|
|
365
|
+
static red(): Color;
|
|
366
|
+
static green(): Color;
|
|
367
|
+
static blue(): Color;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* 列表小组件类
|
|
372
|
+
*/
|
|
373
|
+
class ListWidget {
|
|
374
|
+
/** 背景颜色 */
|
|
375
|
+
backgroundColor: Color;
|
|
376
|
+
/** 背景图像 */
|
|
377
|
+
backgroundImage: Image;
|
|
378
|
+
/** 背景渐变 */
|
|
379
|
+
backgroundGradient: LinearGradient;
|
|
380
|
+
/** 间距 */
|
|
381
|
+
spacing: number;
|
|
382
|
+
/** 点击 URL */
|
|
383
|
+
url: string;
|
|
384
|
+
/** 刷新时间 */
|
|
385
|
+
refreshAfterDate: Date;
|
|
386
|
+
/** 添加辅助小组件背景 */
|
|
387
|
+
addAccessoryWidgetBackground: boolean;
|
|
388
|
+
|
|
389
|
+
/** 添加文本 */
|
|
390
|
+
addText(text: string): WidgetText;
|
|
391
|
+
/** 添加日期 */
|
|
392
|
+
addDate(date: Date): WidgetDate;
|
|
393
|
+
/** 添加图像 */
|
|
394
|
+
addImage(image: Image): WidgetImage;
|
|
395
|
+
/** 添加间隔 */
|
|
396
|
+
addSpacer(length?: number | null): WidgetSpacer;
|
|
397
|
+
/** 添加堆栈 */
|
|
398
|
+
addStack(): WidgetStack;
|
|
399
|
+
/** 设置内边距 */
|
|
400
|
+
setPadding(top: number, leading: number, bottom: number, trailing: number): void;
|
|
401
|
+
/** 使用默认内边距 */
|
|
402
|
+
useDefaultPadding(): void;
|
|
403
|
+
/** 以小尺寸展示小组件 */
|
|
404
|
+
presentSmall(): Promise<void>;
|
|
405
|
+
/** 以中尺寸展示小组件 */
|
|
406
|
+
presentMedium(): Promise<void>;
|
|
407
|
+
/** 以大尺寸展示小组件 */
|
|
408
|
+
presentLarge(): Promise<void>;
|
|
409
|
+
/** 以超大尺寸展示小组件 */
|
|
410
|
+
presentExtraLarge(): Promise<void>;
|
|
411
|
+
/** 展示辅助内联小组件 */
|
|
412
|
+
presentAccessoryInline(): Promise<void>;
|
|
413
|
+
/** 展示辅助圆形小组件 */
|
|
414
|
+
presentAccessoryCircular(): Promise<void>;
|
|
415
|
+
/** 展示辅助矩形小组件 */
|
|
416
|
+
presentAccessoryRectangular(): Promise<void>;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* 脚本类
|
|
421
|
+
*/
|
|
422
|
+
class Script {
|
|
423
|
+
/** 脚本名称 */
|
|
424
|
+
static name(): string;
|
|
425
|
+
/** 设置小组件 */
|
|
426
|
+
static setWidget(widget: ListWidget): void;
|
|
427
|
+
/** 设置快捷指令输出 */
|
|
428
|
+
static setShortcutOutput(value: any): void;
|
|
429
|
+
/** 完成脚本执行 */
|
|
430
|
+
static complete(): void;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// ==================== UI 交互类 ====================
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* 警告弹窗类
|
|
437
|
+
*/
|
|
438
|
+
class Alert {
|
|
439
|
+
/** 标题 */
|
|
440
|
+
title: string;
|
|
441
|
+
/** 消息内容 */
|
|
442
|
+
message: string;
|
|
443
|
+
|
|
444
|
+
constructor();
|
|
445
|
+
|
|
446
|
+
/** 添加操作按钮 */
|
|
447
|
+
addAction(title: string): void;
|
|
448
|
+
/** 添加取消按钮 */
|
|
449
|
+
addCancelAction(title: string): void;
|
|
450
|
+
/** 添加破坏性操作按钮 */
|
|
451
|
+
addDestructiveAction(title: string): void;
|
|
452
|
+
/** 添加文本输入框 */
|
|
453
|
+
addTextField(placeholder?: string, text?: string): TextField;
|
|
454
|
+
/** 添加安全文本输入框 */
|
|
455
|
+
addSecureTextField(placeholder?: string, text?: string): TextField;
|
|
456
|
+
/** 获取文本输入框 */
|
|
457
|
+
textFieldValue(index: number): string;
|
|
458
|
+
/** 展示为弹窗 */
|
|
459
|
+
present(): Promise<number>;
|
|
460
|
+
/** 展示为操作表单 */
|
|
461
|
+
presentSheet(): Promise<number>;
|
|
462
|
+
/** 展示为警告 */
|
|
463
|
+
presentAlert(): Promise<number>;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* 文本输入框类
|
|
468
|
+
*/
|
|
469
|
+
class TextField {
|
|
470
|
+
/** 文本内容 */
|
|
471
|
+
text: string;
|
|
472
|
+
/** 占位符 */
|
|
473
|
+
placeholder: string;
|
|
474
|
+
/** 是否安全输入 */
|
|
475
|
+
isSecure: boolean;
|
|
476
|
+
/** 文本颜色 */
|
|
477
|
+
textColor: Color;
|
|
478
|
+
/** 字体 */
|
|
479
|
+
font: Font;
|
|
480
|
+
/** 左对齐文本 */
|
|
481
|
+
leftAlignText(): void;
|
|
482
|
+
/** 居中对齐文本 */
|
|
483
|
+
centerAlignText(): void;
|
|
484
|
+
/** 右对齐文本 */
|
|
485
|
+
rightAlignText(): void;
|
|
486
|
+
/** 设置小数键盘 */
|
|
487
|
+
setDecimalPadKeyboard(): void;
|
|
488
|
+
/** 设置默认键盘 */
|
|
489
|
+
setDefaultKeyboard(): void;
|
|
490
|
+
/** 设置邮箱键盘 */
|
|
491
|
+
setEmailAddressKeyboard(): void;
|
|
492
|
+
/** 设置数字键盘 */
|
|
493
|
+
setNumberPadKeyboard(): void;
|
|
494
|
+
/** 设置数字和标点键盘 */
|
|
495
|
+
setNumbersAndPunctuationKeyboard(): void;
|
|
496
|
+
/** 设置电话键盘 */
|
|
497
|
+
setPhonePadKeyboard(): void;
|
|
498
|
+
/** 设置 Twitter 键盘 */
|
|
499
|
+
setTwitterKeyboard(): void;
|
|
500
|
+
/** 设置 URL 键盘 */
|
|
501
|
+
setURLKeyboard(): void;
|
|
502
|
+
/** 设置 Web 搜索键盘 */
|
|
503
|
+
setWebSearchKeyboard(): void;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* UI 表格类
|
|
508
|
+
*/
|
|
509
|
+
class UITable {
|
|
510
|
+
/** 是否显示分隔符 */
|
|
511
|
+
showSeparators: boolean;
|
|
512
|
+
|
|
513
|
+
constructor();
|
|
514
|
+
|
|
515
|
+
/** 添加行 */
|
|
516
|
+
addRow(row: UITableRow): void;
|
|
517
|
+
/** 移除行 */
|
|
518
|
+
removeRow(row: UITableRow): void;
|
|
519
|
+
/** 移除所有行 */
|
|
520
|
+
removeAllRows(): void;
|
|
521
|
+
/** 重新加载 */
|
|
522
|
+
reload(): void;
|
|
523
|
+
/** 展示表格 */
|
|
524
|
+
present(fullscreen?: boolean): Promise<number>;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* UI 表格行类
|
|
529
|
+
*/
|
|
530
|
+
class UITableRow {
|
|
531
|
+
/** 是否可取消选中 */
|
|
532
|
+
isHeader: boolean;
|
|
533
|
+
/** 是否可取消 */
|
|
534
|
+
dismissOnSelect: boolean;
|
|
535
|
+
/** 行高度 */
|
|
536
|
+
height: number;
|
|
537
|
+
/** 背景颜色 */
|
|
538
|
+
backgroundColor: Color;
|
|
539
|
+
/** 点击回调 */
|
|
540
|
+
onSelect: () => void;
|
|
541
|
+
|
|
542
|
+
constructor();
|
|
543
|
+
|
|
544
|
+
/** 添加单元格 */
|
|
545
|
+
addCell(cell: UITableCell): void;
|
|
546
|
+
/** 添加文本 */
|
|
547
|
+
addText(title: string, subtitle?: string): UITableCell;
|
|
548
|
+
/** 添加图像 */
|
|
549
|
+
addImage(image: Image): UITableCell;
|
|
550
|
+
/** 添加图像并附带文本 */
|
|
551
|
+
addImageAtURL(url: string): UITableCell;
|
|
552
|
+
/** 添加按钮 */
|
|
553
|
+
addButton(title: string): UITableCell;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* UI 表格单元格类
|
|
558
|
+
*/
|
|
559
|
+
class UITableCell {
|
|
560
|
+
/** 标题文本 */
|
|
561
|
+
title: string;
|
|
562
|
+
/** 副标题文本 */
|
|
563
|
+
subtitle: string;
|
|
564
|
+
/** 标题颜色 */
|
|
565
|
+
titleColor: Color;
|
|
566
|
+
/** 副标题颜色 */
|
|
567
|
+
subtitleColor: Color;
|
|
568
|
+
/** 标题字体 */
|
|
569
|
+
titleFont: Font;
|
|
570
|
+
/** 副标题字体 */
|
|
571
|
+
subtitleFont: Font;
|
|
572
|
+
/** 左对齐 */
|
|
573
|
+
leftAligned(): void;
|
|
574
|
+
/** 居中对齐 */
|
|
575
|
+
centerAligned(): void;
|
|
576
|
+
/** 右对齐 */
|
|
577
|
+
rightAligned(): void;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* WebView 网页视图类
|
|
582
|
+
*/
|
|
583
|
+
class WebView {
|
|
584
|
+
constructor();
|
|
585
|
+
|
|
586
|
+
/** 加载 HTML */
|
|
587
|
+
loadHTML(html: string, baseURL?: string): Promise<void>;
|
|
588
|
+
/** 加载 URL */
|
|
589
|
+
loadURL(url: string): Promise<void>;
|
|
590
|
+
/** 加载请求 */
|
|
591
|
+
loadRequest(request: Request): Promise<void>;
|
|
592
|
+
/** 执行 JavaScript */
|
|
593
|
+
evaluateJavaScript(script: string, useCallback?: boolean): Promise<any>;
|
|
594
|
+
/** 获取 HTML */
|
|
595
|
+
getHTML(): Promise<string>;
|
|
596
|
+
/** 展示 */
|
|
597
|
+
present(fullscreen?: boolean): Promise<void>;
|
|
598
|
+
/** 等待加载完成 */
|
|
599
|
+
waitForLoad(): Promise<void>;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* QuickLook 快速查看类
|
|
604
|
+
*/
|
|
605
|
+
class QuickLook {
|
|
606
|
+
/** 预览文件 */
|
|
607
|
+
static present(item: any, fullscreen?: boolean): Promise<void>;
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Safari 浏览器类
|
|
612
|
+
*/
|
|
613
|
+
class Safari {
|
|
614
|
+
/** 打开 URL */
|
|
615
|
+
static open(url: string): void;
|
|
616
|
+
/** 打开并等待完成 */
|
|
617
|
+
static openInApp(url: string, fullscreen?: boolean): Promise<void>;
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
// ==================== 文件和媒体类 ====================
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* 文件管理器类
|
|
624
|
+
*/
|
|
625
|
+
class FileManager {
|
|
626
|
+
/** 获取本地文件管理器 */
|
|
627
|
+
static local(): FileManager;
|
|
628
|
+
/** 获取 iCloud 文件管理器 */
|
|
629
|
+
static iCloud(): FileManager;
|
|
630
|
+
|
|
631
|
+
/** 读取文件 */
|
|
632
|
+
read(filePath: string): Data;
|
|
633
|
+
/** 读取文本文件为字符串 */
|
|
634
|
+
readString(filePath: string): string;
|
|
635
|
+
/** 读取图像文件 */
|
|
636
|
+
readImage(filePath: string): Image;
|
|
637
|
+
/** 写入文件 */
|
|
638
|
+
write(filePath: string, content: Data): void;
|
|
639
|
+
/** 写入字符串到文件 */
|
|
640
|
+
writeString(filePath: string, content: string): void;
|
|
641
|
+
/** 写入图像到文件 */
|
|
642
|
+
writeImage(filePath: string, image: Image): void;
|
|
643
|
+
/** 删除文件 */
|
|
644
|
+
remove(filePath: string): void;
|
|
645
|
+
/** 移动文件 */
|
|
646
|
+
move(sourceFilePath: string, destinationFilePath: string): void;
|
|
647
|
+
/** 复制文件 */
|
|
648
|
+
copy(sourceFilePath: string, destinationFilePath: string): void;
|
|
649
|
+
/** 文件是否存在 */
|
|
650
|
+
fileExists(filePath: string): boolean;
|
|
651
|
+
/** 是否为目录 */
|
|
652
|
+
isDirectory(path: string): boolean;
|
|
653
|
+
/** 创建目录 */
|
|
654
|
+
createDirectory(path: string, intermediateDirectories?: boolean): void;
|
|
655
|
+
/** 临时目录路径 */
|
|
656
|
+
temporaryDirectory(): string;
|
|
657
|
+
/** 缓存目录路径 */
|
|
658
|
+
cacheDirectory(): string;
|
|
659
|
+
/** 文档目录路径 */
|
|
660
|
+
documentsDirectory(): string;
|
|
661
|
+
/** 库目录路径 */
|
|
662
|
+
libraryDirectory(): string;
|
|
663
|
+
/** 列出目录内容 */
|
|
664
|
+
listContents(directoryPath: string): string[];
|
|
665
|
+
/** 获取文件名 */
|
|
666
|
+
fileName(filePath: string, includeFileExtension?: boolean): string;
|
|
667
|
+
/** 获取文件扩展名 */
|
|
668
|
+
fileExtension(filePath: string): string;
|
|
669
|
+
/** 获取所有文件标签 */
|
|
670
|
+
allTags(filePath: string): string[];
|
|
671
|
+
/** 添加文件标签 */
|
|
672
|
+
addTag(filePath: string, tag: string): void;
|
|
673
|
+
/** 移除文件标签 */
|
|
674
|
+
removeTag(filePath: string, tag: string): void;
|
|
675
|
+
/** 读取扩展属性 */
|
|
676
|
+
readExtendedAttribute(filePath: string, name: string): string;
|
|
677
|
+
/** 写入扩展属性 */
|
|
678
|
+
writeExtendedAttribute(filePath: string, value: string, name: string): void;
|
|
679
|
+
/** 移除扩展属性 */
|
|
680
|
+
removeExtendedAttribute(filePath: string, name: string): void;
|
|
681
|
+
/** 获取所有扩展属性 */
|
|
682
|
+
allExtendedAttributes(filePath: string): string[];
|
|
683
|
+
/** 获取 UTI */
|
|
684
|
+
getUTI(filePath: string): string;
|
|
685
|
+
/** 获取文件大小 */
|
|
686
|
+
fileSize(filePath: string): number;
|
|
687
|
+
/** 获取创建时间 */
|
|
688
|
+
creationDate(filePath: string): Date;
|
|
689
|
+
/** 获取修改时间 */
|
|
690
|
+
modificationDate(filePath: string): Date;
|
|
691
|
+
/** 设置修改时间 */
|
|
692
|
+
setModificationDate(filePath: string, date: Date): void;
|
|
693
|
+
/** 获取所有文件书签 */
|
|
694
|
+
allFileBookmarks(): string[];
|
|
695
|
+
/** 是否已下载 */
|
|
696
|
+
isFileDownloaded(filePath: string): boolean;
|
|
697
|
+
/** 下载文件 */
|
|
698
|
+
downloadFileFromiCloud(filePath: string): Promise<void>;
|
|
699
|
+
/** 是否已存储在 iCloud */
|
|
700
|
+
isFileStoredIniCloud(filePath: string): boolean;
|
|
701
|
+
/** 连接文件路径 */
|
|
702
|
+
joinPath(lhsPath: string, rhsPath: string): string;
|
|
703
|
+
/** 获取书签路径 */
|
|
704
|
+
bookmarkedPath(name: string): string;
|
|
705
|
+
/** 添加书签 */
|
|
706
|
+
bookmarkPath(path: string, name: string): void;
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* 图像类
|
|
711
|
+
*/
|
|
712
|
+
class Image {
|
|
713
|
+
/** 从文件加载图像 */
|
|
714
|
+
static fromFile(filePath: string): Image;
|
|
715
|
+
/** 从数据加载图像 */
|
|
716
|
+
static fromData(data: Data): Image;
|
|
717
|
+
|
|
718
|
+
/** 图像尺寸 */
|
|
719
|
+
size: Size;
|
|
720
|
+
|
|
721
|
+
/** 获取像素颜色 */
|
|
722
|
+
getPixelColor(point: Point): Color;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
/**
|
|
726
|
+
* 照片类
|
|
727
|
+
*/
|
|
728
|
+
class Photos {
|
|
729
|
+
/** 从相册中选择照片 */
|
|
730
|
+
static fromLibrary(): Promise<Image>;
|
|
731
|
+
/** 从相机拍摄照片 */
|
|
732
|
+
static fromCamera(): Promise<Image>;
|
|
733
|
+
/** 移除最近的屏幕截图 */
|
|
734
|
+
static removeLatestScreenshots(count?: number): Promise<void>;
|
|
735
|
+
/** 获取最近的照片 */
|
|
736
|
+
static latestPhoto(): Promise<Image>;
|
|
737
|
+
/** 获取最近的照片列表 */
|
|
738
|
+
static latestPhotos(count: number): Promise<Image[]>;
|
|
739
|
+
/** 获取最近的屏幕截图 */
|
|
740
|
+
static latestScreenshot(): Promise<Image>;
|
|
741
|
+
/** 获取最近的屏幕截图列表 */
|
|
742
|
+
static latestScreenshots(count: number): Promise<Image[]>;
|
|
743
|
+
/** 保存到相册 */
|
|
744
|
+
static save(image: Image): Promise<void>;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* 文档选择器类
|
|
749
|
+
*/
|
|
750
|
+
class DocumentPicker {
|
|
751
|
+
/** 打开文件 */
|
|
752
|
+
static open(types?: string[]): Promise<string[]>;
|
|
753
|
+
/** 打开单个文件 */
|
|
754
|
+
static openFile(): Promise<string>;
|
|
755
|
+
/** 打开多个文件 */
|
|
756
|
+
static openMultiple(types?: string[]): Promise<string[]>;
|
|
757
|
+
/** 导出文件 */
|
|
758
|
+
static export(filePath: string): Promise<string[]>;
|
|
759
|
+
/** 导出字符串 */
|
|
760
|
+
static exportString(content: string, name?: string): Promise<string[]>;
|
|
761
|
+
/** 导出图像 */
|
|
762
|
+
static exportImage(image: Image, name?: string): Promise<string[]>;
|
|
763
|
+
/** 导出数据 */
|
|
764
|
+
static exportData(data: Data, name?: string): Promise<string[]>;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* 剪贴板类
|
|
769
|
+
*/
|
|
770
|
+
class Pasteboard {
|
|
771
|
+
/** 复制文本 */
|
|
772
|
+
static copy(text: string): void;
|
|
773
|
+
/** 复制图像 */
|
|
774
|
+
static copyImage(image: Image): void;
|
|
775
|
+
/** 粘贴文本 */
|
|
776
|
+
static paste(): string;
|
|
777
|
+
/** 粘贴图像 */
|
|
778
|
+
static pasteImage(): Image;
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
* 钥匙串类
|
|
783
|
+
*/
|
|
784
|
+
class Keychain {
|
|
785
|
+
/** 设置值 */
|
|
786
|
+
static set(key: string, value: string): void;
|
|
787
|
+
/** 获取值 */
|
|
788
|
+
static get(key: string): string;
|
|
789
|
+
/** 是否包含键 */
|
|
790
|
+
static contains(key: string): boolean;
|
|
791
|
+
/** 删除键 */
|
|
792
|
+
static remove(key: string): void;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
/**
|
|
796
|
+
* 绘图上下文类
|
|
797
|
+
*/
|
|
798
|
+
class DrawContext {
|
|
799
|
+
/** 尺寸 */
|
|
800
|
+
size: Size;
|
|
801
|
+
/** 是否不透明 */
|
|
802
|
+
opaque: boolean;
|
|
803
|
+
/** 缩放因子 */
|
|
804
|
+
respectScreenScale: boolean;
|
|
805
|
+
|
|
806
|
+
constructor(size: Size);
|
|
807
|
+
|
|
808
|
+
/** 获取图像 */
|
|
809
|
+
getImage(): Image;
|
|
810
|
+
/** 绘制图像 */
|
|
811
|
+
drawImageInRect(image: Image, rect: Rect): void;
|
|
812
|
+
/** 绘制图像并指定点 */
|
|
813
|
+
drawImageAtPoint(image: Image, point: Point): void;
|
|
814
|
+
/** 设置填充颜色 */
|
|
815
|
+
setFillColor(color: Color): void;
|
|
816
|
+
/** 设置描边颜色 */
|
|
817
|
+
setStrokeColor(color: Color): void;
|
|
818
|
+
/** 设置线宽 */
|
|
819
|
+
setLineWidth(width: number): void;
|
|
820
|
+
/** 填充矩形 */
|
|
821
|
+
fill(rect: Rect): void;
|
|
822
|
+
/** 填充椭圆 */
|
|
823
|
+
fillEllipse(rect: Rect): void;
|
|
824
|
+
/** 描边矩形 */
|
|
825
|
+
stroke(rect: Rect): void;
|
|
826
|
+
/** 描边椭圆 */
|
|
827
|
+
strokeEllipse(rect: Rect): void;
|
|
828
|
+
/** 添加路径 */
|
|
829
|
+
addPath(path: Path): void;
|
|
830
|
+
/** 绘制路径 */
|
|
831
|
+
strokePath(): void;
|
|
832
|
+
/** 填充路径 */
|
|
833
|
+
fillPath(): void;
|
|
834
|
+
/** 绘制文本 */
|
|
835
|
+
drawText(text: string, pos: Point): void;
|
|
836
|
+
/** 绘制文本到矩形 */
|
|
837
|
+
drawTextInRect(text: string, rect: Rect): void;
|
|
838
|
+
/** 设置文本颜色 */
|
|
839
|
+
setTextColor(color: Color): void;
|
|
840
|
+
/** 设置字体 */
|
|
841
|
+
setFont(font: Font): void;
|
|
842
|
+
/** 设置文本对齐方式 */
|
|
843
|
+
setTextAlignedLeft(): void;
|
|
844
|
+
/** 设置文本居中对齐 */
|
|
845
|
+
setTextAlignedCenter(): void;
|
|
846
|
+
/** 设置文本右对齐 */
|
|
847
|
+
setTextAlignedRight(): void;
|
|
848
|
+
}
|
|
849
|
+
|
|
850
|
+
// ==================== 网络和请求类 ====================
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* HTTP 请求类
|
|
854
|
+
*/
|
|
855
|
+
class Request {
|
|
856
|
+
/** 请求 URL */
|
|
857
|
+
url: string;
|
|
858
|
+
/** 请求方法 */
|
|
859
|
+
method: string;
|
|
860
|
+
/** 请求头 */
|
|
861
|
+
headers: Record<string, string>;
|
|
862
|
+
/** 请求体 */
|
|
863
|
+
body: Data | string;
|
|
864
|
+
/** 超时时间 */
|
|
865
|
+
timeoutInterval: number;
|
|
866
|
+
/** 重定向回调 */
|
|
867
|
+
onRedirect: (request: Request) => Request | null;
|
|
868
|
+
/** 响应 */
|
|
869
|
+
response: {
|
|
870
|
+
/** 响应 URL */
|
|
871
|
+
url: string;
|
|
872
|
+
/** 状态码 */
|
|
873
|
+
statusCode: number;
|
|
874
|
+
/** MIME 类型 */
|
|
875
|
+
mimeType: string;
|
|
876
|
+
/** 文本编码 */
|
|
877
|
+
textEncodingName: string;
|
|
878
|
+
/** 响应头 */
|
|
879
|
+
headers: Record<string, string>;
|
|
880
|
+
/** Cookie 列表 */
|
|
881
|
+
cookies: Array<{
|
|
882
|
+
domain: string;
|
|
883
|
+
path: string;
|
|
884
|
+
name: string;
|
|
885
|
+
value: string;
|
|
886
|
+
sessionOnly: boolean;
|
|
887
|
+
httpOnly: boolean;
|
|
888
|
+
}>;
|
|
889
|
+
};
|
|
890
|
+
/** 是否允许不安全的请求 */
|
|
891
|
+
allowInsecureRequest: boolean;
|
|
892
|
+
|
|
893
|
+
constructor(url: string);
|
|
894
|
+
|
|
895
|
+
/** 加载数据 */
|
|
896
|
+
load(): Promise<Data>;
|
|
897
|
+
/** 加载字符串 */
|
|
898
|
+
loadString(encoding?: string): Promise<string>;
|
|
899
|
+
/** 加载 JSON */
|
|
900
|
+
loadJSON(): Promise<any>;
|
|
901
|
+
/** 加载图像 */
|
|
902
|
+
loadImage(): Promise<Image>;
|
|
903
|
+
/** 添加参数到多部分表单 */
|
|
904
|
+
addParameterToMultipart(name: string, value: string): void;
|
|
905
|
+
/** 添加文件数据到多部分表单 */
|
|
906
|
+
addFileDataToMultipart(data: Data, mimeType: string, name: string, filename: string): void;
|
|
907
|
+
/** 添加图像到多部分表单 */
|
|
908
|
+
addImageToMultipart(image: Image, name: string, filename: string): void;
|
|
909
|
+
/** 添加文件到多部分表单 */
|
|
910
|
+
addFileToMultipart(filePath: string, name: string, filename: string): void;
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* 回调 URL 类
|
|
915
|
+
*/
|
|
916
|
+
class CallbackURL {
|
|
917
|
+
/** URL */
|
|
918
|
+
url: string;
|
|
919
|
+
|
|
920
|
+
constructor(baseURL: string);
|
|
921
|
+
|
|
922
|
+
/** 添加参数 */
|
|
923
|
+
addParameter(name: string, value: string): void;
|
|
924
|
+
/** 获取 URL */
|
|
925
|
+
getURL(): string;
|
|
926
|
+
/** 打开 URL */
|
|
927
|
+
open(): Promise<void>;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* URL Scheme 类
|
|
932
|
+
*/
|
|
933
|
+
class URLScheme {
|
|
934
|
+
/** 获取所有参数 */
|
|
935
|
+
static allParameters(): Record<string, string>;
|
|
936
|
+
/** 获取参数 */
|
|
937
|
+
static parameter(name: string): string;
|
|
938
|
+
/** 强制完成 */
|
|
939
|
+
static forceComplete(): void;
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// ==================== 日历和提醒类 ====================
|
|
943
|
+
|
|
944
|
+
/**
|
|
945
|
+
* 日历类
|
|
946
|
+
*/
|
|
947
|
+
class Calendar {
|
|
948
|
+
/** 默认日历 */
|
|
949
|
+
static defaultForEvents(): Calendar;
|
|
950
|
+
/** 默认提醒日历 */
|
|
951
|
+
static defaultForReminders(): Calendar;
|
|
952
|
+
/** 获取所有事件日历 */
|
|
953
|
+
static forEvents(): Promise<Calendar[]>;
|
|
954
|
+
/** 获取所有提醒日历 */
|
|
955
|
+
static forReminders(): Promise<Calendar[]>;
|
|
956
|
+
/** 查找或创建日历 */
|
|
957
|
+
static findOrCreateCalendar(title: string): Calendar;
|
|
958
|
+
/** 通过标题查找日历 */
|
|
959
|
+
static findCalendar(title: string): Calendar;
|
|
960
|
+
/** 创建事件日历 */
|
|
961
|
+
static createForEvents(title: string): Calendar;
|
|
962
|
+
/** 创建提醒日历 */
|
|
963
|
+
static createForReminders(title: string): Calendar;
|
|
964
|
+
/** 通过标识符查找日历 */
|
|
965
|
+
static forEventByIdentifier(identifier: string): Promise<Calendar>;
|
|
966
|
+
/** 通过标识符查找提醒日历 */
|
|
967
|
+
static forReminderByIdentifier(identifier: string): Promise<Calendar>;
|
|
968
|
+
|
|
969
|
+
/** 日历标识符 */
|
|
970
|
+
identifier: string;
|
|
971
|
+
/** 日历标题 */
|
|
972
|
+
title: string;
|
|
973
|
+
/** 是否为订阅日历 */
|
|
974
|
+
isSubscribed: boolean;
|
|
975
|
+
/** 是否允许内容修改 */
|
|
976
|
+
allowsContentModifications: boolean;
|
|
977
|
+
/** 日历颜色 */
|
|
978
|
+
color: Color;
|
|
979
|
+
|
|
980
|
+
/** 保存日历 */
|
|
981
|
+
save(): void;
|
|
982
|
+
/** 删除日历 */
|
|
983
|
+
remove(): void;
|
|
984
|
+
/** 获取所有事件 */
|
|
985
|
+
presentPicker(): Promise<Calendar>;
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
/**
|
|
989
|
+
* 日历事件类
|
|
990
|
+
*/
|
|
991
|
+
class CalendarEvent {
|
|
992
|
+
/** 获取今天的事件 */
|
|
993
|
+
static today(calendars?: Calendar[]): Promise<CalendarEvent[]>;
|
|
994
|
+
/** 获取明天的事件 */
|
|
995
|
+
static tomorrow(calendars?: Calendar[]): Promise<CalendarEvent[]>;
|
|
996
|
+
/** 获取昨天的事件 */
|
|
997
|
+
static yesterday(calendars?: Calendar[]): Promise<CalendarEvent[]>;
|
|
998
|
+
/** 获取本周的事件 */
|
|
999
|
+
static thisWeek(calendars?: Calendar[]): Promise<CalendarEvent[]>;
|
|
1000
|
+
/** 获取下周的事件 */
|
|
1001
|
+
static nextWeek(calendars?: Calendar[]): Promise<CalendarEvent[]>;
|
|
1002
|
+
/** 获取上周的事件 */
|
|
1003
|
+
static lastWeek(calendars?: Calendar[]): Promise<CalendarEvent[]>;
|
|
1004
|
+
/** 获取指定日期范围的事件 */
|
|
1005
|
+
static between(startDate: Date, endDate: Date, calendars?: Calendar[]): Promise<CalendarEvent[]>;
|
|
1006
|
+
/** 通过标识符查找事件 */
|
|
1007
|
+
static presentCreate(): Promise<CalendarEvent>;
|
|
1008
|
+
|
|
1009
|
+
/** 事件标识符 */
|
|
1010
|
+
identifier: string;
|
|
1011
|
+
/** 事件标题 */
|
|
1012
|
+
title: string;
|
|
1013
|
+
/** 事件位置 */
|
|
1014
|
+
location: string;
|
|
1015
|
+
/** 备注 */
|
|
1016
|
+
notes: string;
|
|
1017
|
+
/** 开始日期 */
|
|
1018
|
+
startDate: Date;
|
|
1019
|
+
/** 结束日期 */
|
|
1020
|
+
endDate: Date;
|
|
1021
|
+
/** 是否全天事件 */
|
|
1022
|
+
isAllDay: boolean;
|
|
1023
|
+
/** 所属日历 */
|
|
1024
|
+
calendar: Calendar;
|
|
1025
|
+
/** URL */
|
|
1026
|
+
url: string;
|
|
1027
|
+
/** 参与者 */
|
|
1028
|
+
attendees: Array<{ name: string; emailAddress: string; isCurrentUser: boolean }>;
|
|
1029
|
+
/** 可用性 */
|
|
1030
|
+
availability: string;
|
|
1031
|
+
/** 事件时区 */
|
|
1032
|
+
timeZone: string;
|
|
1033
|
+
|
|
1034
|
+
/** 保存事件 */
|
|
1035
|
+
save(): void;
|
|
1036
|
+
/** 删除事件 */
|
|
1037
|
+
remove(): void;
|
|
1038
|
+
/** 添加提醒 */
|
|
1039
|
+
addRecurrenceRule(recurrenceRule: RecurrenceRule): void;
|
|
1040
|
+
/** 移除所有重复规则 */
|
|
1041
|
+
removeAllRecurrenceRules(): void;
|
|
1042
|
+
/** 展示创建事件 */
|
|
1043
|
+
presentCreate(): Promise<CalendarEvent>;
|
|
1044
|
+
/** 展示编辑事件 */
|
|
1045
|
+
presentEdit(): Promise<CalendarEvent>;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* 提醒类
|
|
1050
|
+
*/
|
|
1051
|
+
class Reminder {
|
|
1052
|
+
/** 获取所有未完成的提醒 */
|
|
1053
|
+
static all(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1054
|
+
/** 获取所有已完成的提醒 */
|
|
1055
|
+
static allCompleted(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1056
|
+
/** 获取所有未完成的提醒(今天到期) */
|
|
1057
|
+
static allDueToday(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1058
|
+
/** 获取所有已完成的提醒(今天完成) */
|
|
1059
|
+
static completedToday(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1060
|
+
/** 获取所有未完成的提醒(明天到期) */
|
|
1061
|
+
static allDueTomorrow(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1062
|
+
/** 获取所有已完成的提醒(明天完成) */
|
|
1063
|
+
static completedTomorrow(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1064
|
+
/** 获取所有未完成的提醒(昨天到期) */
|
|
1065
|
+
static allDueYesterday(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1066
|
+
/** 获取所有已完成的提醒(昨天完成) */
|
|
1067
|
+
static completedYesterday(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1068
|
+
/** 获取所有未完成的提醒(本周到期) */
|
|
1069
|
+
static allDueThisWeek(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1070
|
+
/** 获取所有已完成的提醒(本周完成) */
|
|
1071
|
+
static completedThisWeek(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1072
|
+
/** 获取所有未完成的提醒(下周到期) */
|
|
1073
|
+
static allDueNextWeek(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1074
|
+
/** 获取所有未完成的提醒(上周到期) */
|
|
1075
|
+
static allDueLastWeek(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1076
|
+
/** 获取所有已完成的提醒(上周完成) */
|
|
1077
|
+
static completedLastWeek(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1078
|
+
/** 获取所有未完成的提醒(指定日期范围) */
|
|
1079
|
+
static allDueBetween(startDate: Date, endDate: Date, calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1080
|
+
/** 获取所有已完成的提醒(指定日期范围) */
|
|
1081
|
+
static completedBetween(startDate: Date, endDate: Date, calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1082
|
+
/** 计划提醒 */
|
|
1083
|
+
static scheduled(calendars?: Calendar[]): Promise<Reminder[]>;
|
|
1084
|
+
|
|
1085
|
+
/** 提醒标识符 */
|
|
1086
|
+
identifier: string;
|
|
1087
|
+
/** 提醒标题 */
|
|
1088
|
+
title: string;
|
|
1089
|
+
/** 备注 */
|
|
1090
|
+
notes: string;
|
|
1091
|
+
/** 是否已完成 */
|
|
1092
|
+
isCompleted: boolean;
|
|
1093
|
+
/** 完成日期 */
|
|
1094
|
+
completionDate: Date;
|
|
1095
|
+
/** 创建日期 */
|
|
1096
|
+
creationDate: Date;
|
|
1097
|
+
/** 截止日期 */
|
|
1098
|
+
dueDate: Date;
|
|
1099
|
+
/** 是否有截止日期 */
|
|
1100
|
+
dueDateIncludesTime: boolean;
|
|
1101
|
+
/** 优先级 */
|
|
1102
|
+
priority: number;
|
|
1103
|
+
/** 所属日历 */
|
|
1104
|
+
calendar: Calendar;
|
|
1105
|
+
|
|
1106
|
+
/** 保存提醒 */
|
|
1107
|
+
save(): void;
|
|
1108
|
+
/** 删除提醒 */
|
|
1109
|
+
remove(): void;
|
|
1110
|
+
/** 添加重复规则 */
|
|
1111
|
+
addRecurrenceRule(recurrenceRule: RecurrenceRule): void;
|
|
1112
|
+
/** 移除所有重复规则 */
|
|
1113
|
+
removeAllRecurrenceRules(): void;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/**
|
|
1117
|
+
* 重复规则类
|
|
1118
|
+
*/
|
|
1119
|
+
class RecurrenceRule {
|
|
1120
|
+
/** 创建每日重复规则 */
|
|
1121
|
+
static daily(interval?: number): RecurrenceRule;
|
|
1122
|
+
/** 创建每周重复规则 */
|
|
1123
|
+
static weekly(interval?: number): RecurrenceRule;
|
|
1124
|
+
/** 创建每月重复规则 */
|
|
1125
|
+
static monthly(interval?: number): RecurrenceRule;
|
|
1126
|
+
/** 创建每年重复规则 */
|
|
1127
|
+
static yearly(interval?: number): RecurrenceRule;
|
|
1128
|
+
/** 创建每周的特定天重复规则 */
|
|
1129
|
+
static weeklyOnDays(daysOfTheWeek: number[], interval?: number): RecurrenceRule;
|
|
1130
|
+
/** 创建复杂重复规则 */
|
|
1131
|
+
static complexWeekly(interval: number, daysOfTheWeek: number[], setPositions: number[]): RecurrenceRule;
|
|
1132
|
+
/** 创建复杂每月重复规则 */
|
|
1133
|
+
static complexMonthly(
|
|
1134
|
+
interval: number,
|
|
1135
|
+
daysOfTheWeek: number[],
|
|
1136
|
+
daysOfTheMonth: number[],
|
|
1137
|
+
setPositions: number[],
|
|
1138
|
+
): RecurrenceRule;
|
|
1139
|
+
/** 创建复杂每年重复规则 */
|
|
1140
|
+
static complexYearly(
|
|
1141
|
+
interval: number,
|
|
1142
|
+
daysOfTheWeek: number[],
|
|
1143
|
+
daysOfTheMonth: number[],
|
|
1144
|
+
monthsOfTheYear: number[],
|
|
1145
|
+
weeksOfTheYear: number[],
|
|
1146
|
+
daysOfTheYear: number[],
|
|
1147
|
+
setPositions: number[],
|
|
1148
|
+
): RecurrenceRule;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
// ==================== 系统和设备类 ====================
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* 设备类
|
|
1155
|
+
*/
|
|
1156
|
+
class Device {
|
|
1157
|
+
/** 设备名称 */
|
|
1158
|
+
static name(): string;
|
|
1159
|
+
/** 系统名称 */
|
|
1160
|
+
static systemName(): string;
|
|
1161
|
+
/** 系统版本 */
|
|
1162
|
+
static systemVersion(): string;
|
|
1163
|
+
/** 设备型号 */
|
|
1164
|
+
static model(): string;
|
|
1165
|
+
/** 是否为 iPhone */
|
|
1166
|
+
static isPhone(): boolean;
|
|
1167
|
+
/** 是否为 iPad */
|
|
1168
|
+
static isPad(): boolean;
|
|
1169
|
+
/** 是否为 Mac */
|
|
1170
|
+
static isMac(): boolean;
|
|
1171
|
+
/** 屏幕尺寸 */
|
|
1172
|
+
static screenSize(): Size;
|
|
1173
|
+
/** 屏幕分辨率 */
|
|
1174
|
+
static screenResolution(): Size;
|
|
1175
|
+
/** 屏幕缩放比例 */
|
|
1176
|
+
static screenScale(): number;
|
|
1177
|
+
/** 屏幕亮度 */
|
|
1178
|
+
static screenBrightness(): number;
|
|
1179
|
+
/** 是否竖屏 */
|
|
1180
|
+
static isInPortrait(): boolean;
|
|
1181
|
+
/** 是否倒置竖屏 */
|
|
1182
|
+
static isInPortraitUpsideDown(): boolean;
|
|
1183
|
+
/** 是否横屏向左 */
|
|
1184
|
+
static isInLandscapeLeft(): boolean;
|
|
1185
|
+
/** 是否横屏向右 */
|
|
1186
|
+
static isInLandscapeRight(): boolean;
|
|
1187
|
+
/** 是否正面朝上 */
|
|
1188
|
+
static isFaceUp(): boolean;
|
|
1189
|
+
/** 是否正面朝下 */
|
|
1190
|
+
static isFaceDown(): boolean;
|
|
1191
|
+
/** 电池电量 */
|
|
1192
|
+
static batteryLevel(): number;
|
|
1193
|
+
/** 是否正在放电 */
|
|
1194
|
+
static isDischarging(): boolean;
|
|
1195
|
+
/** 是否正在充电 */
|
|
1196
|
+
static isCharging(): boolean;
|
|
1197
|
+
/** 是否充满电 */
|
|
1198
|
+
static isFullyCharged(): boolean;
|
|
1199
|
+
/** 首选语言列表 */
|
|
1200
|
+
static preferredLanguages(): string[];
|
|
1201
|
+
/** 区域设置 */
|
|
1202
|
+
static locale(): string;
|
|
1203
|
+
/** 语言 */
|
|
1204
|
+
static language(): string;
|
|
1205
|
+
/** 是否使用深色外观 */
|
|
1206
|
+
static isUsingDarkAppearance(): boolean;
|
|
1207
|
+
/** 音量 */
|
|
1208
|
+
static volume(): number;
|
|
1209
|
+
/** 设置屏幕亮度 */
|
|
1210
|
+
static setScreenBrightness(percentage: number): void;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
/**
|
|
1214
|
+
* 通知类
|
|
1215
|
+
*/
|
|
1216
|
+
class Notification {
|
|
1217
|
+
/** 获取所有待处理通知 */
|
|
1218
|
+
static allPending(): Promise<Notification[]>;
|
|
1219
|
+
/** 获取所有已发送通知 */
|
|
1220
|
+
static allDelivered(): Promise<Notification[]>;
|
|
1221
|
+
/** 移除所有待处理通知 */
|
|
1222
|
+
static removeAllPending(): Promise<void>;
|
|
1223
|
+
/** 移除所有已发送通知 */
|
|
1224
|
+
static removeAllDelivered(): Promise<void>;
|
|
1225
|
+
/** 移除待处理通知 */
|
|
1226
|
+
static removePending(identifiers: string[]): Promise<void>;
|
|
1227
|
+
/** 移除已发送通知 */
|
|
1228
|
+
static removeDelivered(identifiers: string[]): Promise<void>;
|
|
1229
|
+
/** 重置应用图标角标数字 */
|
|
1230
|
+
static resetCurrent(): void;
|
|
1231
|
+
|
|
1232
|
+
/** 通知标识符 */
|
|
1233
|
+
identifier: string;
|
|
1234
|
+
/** 通知标题 */
|
|
1235
|
+
title: string;
|
|
1236
|
+
/** 副标题 */
|
|
1237
|
+
subtitle: string;
|
|
1238
|
+
/** 通知正文 */
|
|
1239
|
+
body: string;
|
|
1240
|
+
/** 角标数字 */
|
|
1241
|
+
badge: number;
|
|
1242
|
+
/** 声音 */
|
|
1243
|
+
sound: string;
|
|
1244
|
+
/** 启动 URL */
|
|
1245
|
+
launchURL: string;
|
|
1246
|
+
/** 用户信息 */
|
|
1247
|
+
userInfo: Record<string, any>;
|
|
1248
|
+
/** 附件 */
|
|
1249
|
+
attachments: Array<{ identifier: string; url: string; type: string }>;
|
|
1250
|
+
/** 首选内容高度 */
|
|
1251
|
+
preferredContentHeight: number;
|
|
1252
|
+
/** 线程标识符 */
|
|
1253
|
+
threadIdentifier: string;
|
|
1254
|
+
/** 目标内容标识符 */
|
|
1255
|
+
targetContentIdentifier: string;
|
|
1256
|
+
/** 触发日期 */
|
|
1257
|
+
nextTriggerDate: Date;
|
|
1258
|
+
/** 发送日期 */
|
|
1259
|
+
deliveryDate: Date;
|
|
1260
|
+
/** 脚本名称 */
|
|
1261
|
+
scriptName: string;
|
|
1262
|
+
|
|
1263
|
+
constructor();
|
|
1264
|
+
|
|
1265
|
+
/** 设置每日触发器 */
|
|
1266
|
+
setDailyTrigger(hour: number, minute: number, repeats?: boolean): void;
|
|
1267
|
+
/** 设置每周触发器 */
|
|
1268
|
+
setWeeklyTrigger(weekday: number, hour: number, minute: number, repeats?: boolean): void;
|
|
1269
|
+
/** 设置日期触发器 */
|
|
1270
|
+
setTriggerDate(date: Date): void;
|
|
1271
|
+
/** 添加动作 */
|
|
1272
|
+
addAction(title: string, url: string, destructive?: boolean): void;
|
|
1273
|
+
/** 计划通知 */
|
|
1274
|
+
schedule(): Promise<void>;
|
|
1275
|
+
/** 移除通知 */
|
|
1276
|
+
remove(): Promise<void>;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
/**
|
|
1280
|
+
* 控制台对象
|
|
1281
|
+
*/
|
|
1282
|
+
const console: {
|
|
1283
|
+
/** 输出日志 */
|
|
1284
|
+
log(message: any): void;
|
|
1285
|
+
/** 输出警告 */
|
|
1286
|
+
warn(message: any): void;
|
|
1287
|
+
/** 输出错误 */
|
|
1288
|
+
error(message: any): void;
|
|
1289
|
+
};
|
|
1290
|
+
|
|
1291
|
+
/**
|
|
1292
|
+
* 模块对象
|
|
1293
|
+
*/
|
|
1294
|
+
const module: {
|
|
1295
|
+
/** 模块文件名 */
|
|
1296
|
+
filename: string;
|
|
1297
|
+
/** 导出对象 */
|
|
1298
|
+
exports: any;
|
|
1299
|
+
};
|
|
1300
|
+
|
|
1301
|
+
/**
|
|
1302
|
+
* 导入模块函数
|
|
1303
|
+
* 从文件系统导入 JavaScript 模块
|
|
1304
|
+
*/
|
|
1305
|
+
function importModule(name: string): any;
|
|
1306
|
+
|
|
1307
|
+
// ==================== 联系人和通讯类 ====================
|
|
1308
|
+
|
|
1309
|
+
/**
|
|
1310
|
+
* 联系人类
|
|
1311
|
+
*/
|
|
1312
|
+
class Contact {
|
|
1313
|
+
/** 获取所有联系人 */
|
|
1314
|
+
static all(): Promise<Contact[]>;
|
|
1315
|
+
/** 在所有容器中查找联系人 */
|
|
1316
|
+
static inGroups(groups: ContactsGroup[]): Promise<Contact[]>;
|
|
1317
|
+
|
|
1318
|
+
/** 联系人标识符 */
|
|
1319
|
+
identifier: string;
|
|
1320
|
+
/** 姓名前缀 */
|
|
1321
|
+
namePrefix: string;
|
|
1322
|
+
/** 名字 */
|
|
1323
|
+
givenName: string;
|
|
1324
|
+
/** 中间名 */
|
|
1325
|
+
middleName: string;
|
|
1326
|
+
/** 姓氏 */
|
|
1327
|
+
familyName: string;
|
|
1328
|
+
/** 昵称 */
|
|
1329
|
+
nickname: string;
|
|
1330
|
+
/** 姓名后缀 */
|
|
1331
|
+
nameSuffix: string;
|
|
1332
|
+
/** 组织名称 */
|
|
1333
|
+
organizationName: string;
|
|
1334
|
+
/** 部门名称 */
|
|
1335
|
+
departmentName: string;
|
|
1336
|
+
/** 职位 */
|
|
1337
|
+
jobTitle: string;
|
|
1338
|
+
/** 生日 */
|
|
1339
|
+
birthday: Date;
|
|
1340
|
+
/** 备注 */
|
|
1341
|
+
note: string;
|
|
1342
|
+
/** 头像 */
|
|
1343
|
+
image: Image;
|
|
1344
|
+
/** 电话号码 */
|
|
1345
|
+
phoneNumbers: Array<{ label: string; value: string; identifier: string; localizedLabel: string }>;
|
|
1346
|
+
/** 邮箱地址 */
|
|
1347
|
+
emailAddresses: Array<{ label: string; value: string; identifier: string; localizedLabel: string }>;
|
|
1348
|
+
/** 邮政地址 */
|
|
1349
|
+
postalAddresses: Array<{
|
|
1350
|
+
label: string;
|
|
1351
|
+
street: string;
|
|
1352
|
+
city: string;
|
|
1353
|
+
state: string;
|
|
1354
|
+
postalCode: string;
|
|
1355
|
+
country: string;
|
|
1356
|
+
identifier: string;
|
|
1357
|
+
localizedLabel: string;
|
|
1358
|
+
}>;
|
|
1359
|
+
/** 社交资料 */
|
|
1360
|
+
socialProfiles: Array<{
|
|
1361
|
+
service: string;
|
|
1362
|
+
username: string;
|
|
1363
|
+
url: string;
|
|
1364
|
+
userIdentifier: string;
|
|
1365
|
+
localizedLabel: string;
|
|
1366
|
+
}>;
|
|
1367
|
+
/** URL 地址 */
|
|
1368
|
+
urlAddresses: Array<{ label: string; value: string; identifier: string }>;
|
|
1369
|
+
/** 是否可用 */
|
|
1370
|
+
isAvailable: boolean;
|
|
1371
|
+
}
|
|
1372
|
+
|
|
1373
|
+
/**
|
|
1374
|
+
* 联系人容器类
|
|
1375
|
+
*/
|
|
1376
|
+
class ContactsContainer {
|
|
1377
|
+
/** 获取默认容器 */
|
|
1378
|
+
static default(): ContactsContainer;
|
|
1379
|
+
/** 获取所有容器 */
|
|
1380
|
+
static all(): Promise<ContactsContainer[]>;
|
|
1381
|
+
/** 通过标识符查找容器 */
|
|
1382
|
+
static withIdentifier(identifier: string): ContactsContainer;
|
|
1383
|
+
|
|
1384
|
+
/** 容器标识符 */
|
|
1385
|
+
identifier: string;
|
|
1386
|
+
/** 容器名称 */
|
|
1387
|
+
name: string;
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* 联系人分组类
|
|
1392
|
+
*/
|
|
1393
|
+
class ContactsGroup {
|
|
1394
|
+
/** 获取所有分组 */
|
|
1395
|
+
static all(containers?: ContactsContainer[]): Promise<ContactsGroup[]>;
|
|
1396
|
+
|
|
1397
|
+
/** 分组标识符 */
|
|
1398
|
+
identifier: string;
|
|
1399
|
+
/** 分组名称 */
|
|
1400
|
+
name: string;
|
|
1401
|
+
}
|
|
1402
|
+
|
|
1403
|
+
/**
|
|
1404
|
+
* 邮件类
|
|
1405
|
+
*/
|
|
1406
|
+
class Mail {
|
|
1407
|
+
/** 发送邮件 */
|
|
1408
|
+
static send(): Promise<void>;
|
|
1409
|
+
/** 撰写邮件 */
|
|
1410
|
+
static compose(): Promise<void>;
|
|
1411
|
+
|
|
1412
|
+
/** 收件人 */
|
|
1413
|
+
toRecipients: string[];
|
|
1414
|
+
/** 抄送 */
|
|
1415
|
+
ccRecipients: string[];
|
|
1416
|
+
/** 密送 */
|
|
1417
|
+
bccRecipients: string[];
|
|
1418
|
+
/** 主题 */
|
|
1419
|
+
subject: string;
|
|
1420
|
+
/** 邮件正文 */
|
|
1421
|
+
body: string;
|
|
1422
|
+
/** 是否为 HTML 格式 */
|
|
1423
|
+
isBodyHTML: boolean;
|
|
1424
|
+
/** 首选发件账户 */
|
|
1425
|
+
preferredSendingEmailAddress: string;
|
|
1426
|
+
|
|
1427
|
+
constructor();
|
|
1428
|
+
|
|
1429
|
+
/** 添加图像附件 */
|
|
1430
|
+
addImageAttachment(image: Image): void;
|
|
1431
|
+
/** 添加文件附件 */
|
|
1432
|
+
addFileAttachment(filePath: string): void;
|
|
1433
|
+
/** 添加数据附件 */
|
|
1434
|
+
addDataAttachment(data: Data, mimeType: string, filename: string): void;
|
|
1435
|
+
/** 发送邮件 */
|
|
1436
|
+
send(): Promise<void>;
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
/**
|
|
1440
|
+
* 短信类
|
|
1441
|
+
*/
|
|
1442
|
+
class Message {
|
|
1443
|
+
/** 发送短信 */
|
|
1444
|
+
static send(): Promise<void>;
|
|
1445
|
+
|
|
1446
|
+
/** 收件人 */
|
|
1447
|
+
recipients: string[];
|
|
1448
|
+
/** 短信正文 */
|
|
1449
|
+
body: string;
|
|
1450
|
+
|
|
1451
|
+
constructor();
|
|
1452
|
+
|
|
1453
|
+
/** 添加图像附件 */
|
|
1454
|
+
addImageAttachment(image: Image): void;
|
|
1455
|
+
/** 添加文件附件 */
|
|
1456
|
+
addFileAttachment(filePath: string): void;
|
|
1457
|
+
/** 添加数据附件 */
|
|
1458
|
+
addDataAttachment(data: Data, uti: string, filename: string): void;
|
|
1459
|
+
/** 发送短信 */
|
|
1460
|
+
send(): Promise<void>;
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
/**
|
|
1464
|
+
* 语音合成类
|
|
1465
|
+
*/
|
|
1466
|
+
class Speech {
|
|
1467
|
+
/** 朗读文本 */
|
|
1468
|
+
static speak(text: string, language?: string): void;
|
|
1469
|
+
/** 停止朗读 */
|
|
1470
|
+
static stop(): void;
|
|
1471
|
+
/** 是否正在朗读 */
|
|
1472
|
+
static isSpeaking(): boolean;
|
|
1473
|
+
/** 获取支持的语言 */
|
|
1474
|
+
static supportedLanguages(): string[];
|
|
1475
|
+
/** 设置语速 */
|
|
1476
|
+
static setRate(rate: number): void;
|
|
1477
|
+
/** 设置音调 */
|
|
1478
|
+
static setPitch(pitch: number): void;
|
|
1479
|
+
/** 设置音量 */
|
|
1480
|
+
static setVolume(volume: number): void;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
/**
|
|
1484
|
+
* 听写类
|
|
1485
|
+
*/
|
|
1486
|
+
class Dictation {
|
|
1487
|
+
/** 开始听写 */
|
|
1488
|
+
static start(locale?: string): Promise<string>;
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
// ==================== 其他工具类 ====================
|
|
1492
|
+
|
|
1493
|
+
/**
|
|
1494
|
+
* 日期格式化类
|
|
1495
|
+
*/
|
|
1496
|
+
class DateFormatter {
|
|
1497
|
+
/** 日期格式 */
|
|
1498
|
+
dateFormat: string;
|
|
1499
|
+
/** 区域设置 */
|
|
1500
|
+
locale: string;
|
|
1501
|
+
/** 时区 */
|
|
1502
|
+
timeZone: string;
|
|
1503
|
+
/** 是否使用相对日期格式 */
|
|
1504
|
+
useRelativeDateFormatting: boolean;
|
|
1505
|
+
/** 是否使用零填充 */
|
|
1506
|
+
usesShortStandaloneWeekdaySymbols: boolean;
|
|
1507
|
+
|
|
1508
|
+
constructor();
|
|
1509
|
+
|
|
1510
|
+
/** 将日期转换为字符串 */
|
|
1511
|
+
string(date: Date): string;
|
|
1512
|
+
/** 将字符串转换为日期 */
|
|
1513
|
+
date(string: string): Date;
|
|
1514
|
+
}
|
|
1515
|
+
|
|
1516
|
+
/**
|
|
1517
|
+
* 日期选择器类
|
|
1518
|
+
*/
|
|
1519
|
+
class DatePicker {
|
|
1520
|
+
/** 初始日期 */
|
|
1521
|
+
initialDate: Date;
|
|
1522
|
+
/** 最小日期 */
|
|
1523
|
+
minimumDate: Date;
|
|
1524
|
+
/** 最大日期 */
|
|
1525
|
+
maximumDate: Date;
|
|
1526
|
+
/** 倒计时时长 */
|
|
1527
|
+
countdownDuration: number;
|
|
1528
|
+
/** 分钟间隔 */
|
|
1529
|
+
minuteInterval: number;
|
|
1530
|
+
|
|
1531
|
+
constructor();
|
|
1532
|
+
|
|
1533
|
+
/** 选择日期 */
|
|
1534
|
+
pickDate(): Promise<Date>;
|
|
1535
|
+
/** 选择时间 */
|
|
1536
|
+
pickTime(): Promise<Date>;
|
|
1537
|
+
/** 选择日期和时间 */
|
|
1538
|
+
pickDateAndTime(): Promise<Date>;
|
|
1539
|
+
/** 选择倒计时时长 */
|
|
1540
|
+
pickCountdownDuration(): Promise<number>;
|
|
1541
|
+
}
|
|
1542
|
+
|
|
1543
|
+
/**
|
|
1544
|
+
* 相对日期时间格式化类
|
|
1545
|
+
*/
|
|
1546
|
+
class RelativeDateTimeFormatter {
|
|
1547
|
+
/** 使用命名日期时间样式 */
|
|
1548
|
+
useNamedDateTimeStyle(): void;
|
|
1549
|
+
/** 使用数字日期时间样式 */
|
|
1550
|
+
useNumericDateTimeStyle(): void;
|
|
1551
|
+
|
|
1552
|
+
constructor();
|
|
1553
|
+
|
|
1554
|
+
/** 格式化日期 */
|
|
1555
|
+
string(date: Date, referenceDate: Date): string;
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
/**
|
|
1559
|
+
* 定时器类
|
|
1560
|
+
*/
|
|
1561
|
+
class Timer {
|
|
1562
|
+
/** 创建定时器 */
|
|
1563
|
+
static schedule(timeInterval: number, repeats: boolean, callback: () => void): Timer;
|
|
1564
|
+
|
|
1565
|
+
/** 时间间隔 */
|
|
1566
|
+
timeInterval: number;
|
|
1567
|
+
/** 是否重复 */
|
|
1568
|
+
repeats: boolean;
|
|
1569
|
+
|
|
1570
|
+
/** 取消定时器 */
|
|
1571
|
+
invalidate(): void;
|
|
1572
|
+
}
|
|
1573
|
+
|
|
1574
|
+
/**
|
|
1575
|
+
* SF Symbol 符号类
|
|
1576
|
+
*/
|
|
1577
|
+
class SFSymbol {
|
|
1578
|
+
/** 创建 SF Symbol */
|
|
1579
|
+
static named(name: string): SFSymbol;
|
|
1580
|
+
|
|
1581
|
+
/** 符号图像 */
|
|
1582
|
+
image: Image;
|
|
1583
|
+
|
|
1584
|
+
/** 应用字体 */
|
|
1585
|
+
applyFont(font: Font): void;
|
|
1586
|
+
/** 应用超轻字重 */
|
|
1587
|
+
applyUltraLightWeight(): void;
|
|
1588
|
+
/** 应用极细字重 */
|
|
1589
|
+
applyThinWeight(): void;
|
|
1590
|
+
/** 应用细字重 */
|
|
1591
|
+
applyLightWeight(): void;
|
|
1592
|
+
/** 应用常规字重 */
|
|
1593
|
+
applyRegularWeight(): void;
|
|
1594
|
+
/** 应用中等字重 */
|
|
1595
|
+
applyMediumWeight(): void;
|
|
1596
|
+
/** 应用半粗字重 */
|
|
1597
|
+
applySemiboldWeight(): void;
|
|
1598
|
+
/** 应用粗字重 */
|
|
1599
|
+
applyBoldWeight(): void;
|
|
1600
|
+
/** 应用重磅字重 */
|
|
1601
|
+
applyHeavyWeight(): void;
|
|
1602
|
+
/** 应用黑色字重 */
|
|
1603
|
+
applyBlackWeight(): void;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
/**
|
|
1607
|
+
* 分享表单类
|
|
1608
|
+
*/
|
|
1609
|
+
class ShareSheet {
|
|
1610
|
+
/** 展示分享表单 */
|
|
1611
|
+
static present(activityItems: any[]): Promise<{ completed: boolean; activityType: string }>;
|
|
1612
|
+
}
|
|
1613
|
+
|
|
1614
|
+
/**
|
|
1615
|
+
* UUID 生成类
|
|
1616
|
+
*/
|
|
1617
|
+
class UUID {
|
|
1618
|
+
/** 生成 UUID */
|
|
1619
|
+
static string(): string;
|
|
1620
|
+
}
|
|
1621
|
+
|
|
1622
|
+
/**
|
|
1623
|
+
* XML 解析器类
|
|
1624
|
+
*/
|
|
1625
|
+
class XMLParser {
|
|
1626
|
+
/** XML 字符串 */
|
|
1627
|
+
string: string;
|
|
1628
|
+
/** 解析完成回调 */
|
|
1629
|
+
didStartElement: (elementName: string, attributes: Record<string, string>) => void;
|
|
1630
|
+
/** 元素结束回调 */
|
|
1631
|
+
didEndElement: (elementName: string) => void;
|
|
1632
|
+
/** 找到字符回调 */
|
|
1633
|
+
foundCharacters: (characters: string) => void;
|
|
1634
|
+
/** 解析错误回调 */
|
|
1635
|
+
parseErrorOccurred: (error: string) => void;
|
|
1636
|
+
|
|
1637
|
+
constructor(string: string);
|
|
1638
|
+
|
|
1639
|
+
/** 开始解析 */
|
|
1640
|
+
parse(): boolean;
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
/**
|
|
1644
|
+
* 位置类
|
|
1645
|
+
*/
|
|
1646
|
+
class Location {
|
|
1647
|
+
/** 获取当前位置 */
|
|
1648
|
+
static current(): Promise<{
|
|
1649
|
+
latitude: number;
|
|
1650
|
+
longitude: number;
|
|
1651
|
+
altitude: number;
|
|
1652
|
+
horizontalAccuracy: number;
|
|
1653
|
+
verticalAccuracy: number;
|
|
1654
|
+
}>;
|
|
1655
|
+
/** 设置允许后台位置更新 */
|
|
1656
|
+
static setAllowsBackgroundLocationUpdates(allows: boolean): void;
|
|
1657
|
+
/** 反向地理编码 */
|
|
1658
|
+
static reverseGeocode(
|
|
1659
|
+
latitude: number,
|
|
1660
|
+
longitude: number,
|
|
1661
|
+
locale?: string,
|
|
1662
|
+
): Promise<{
|
|
1663
|
+
street: string;
|
|
1664
|
+
city: string;
|
|
1665
|
+
state: string;
|
|
1666
|
+
postalCode: string;
|
|
1667
|
+
country: string;
|
|
1668
|
+
countryCode: string;
|
|
1669
|
+
timeZone: string;
|
|
1670
|
+
}>;
|
|
1671
|
+
}
|
|
1672
|
+
|
|
1673
|
+
// ==================== 全局对象 ====================
|
|
1674
|
+
|
|
1675
|
+
/**
|
|
1676
|
+
* 配置对象
|
|
1677
|
+
* 提供有关脚本运行环境的信息
|
|
1678
|
+
*/
|
|
1679
|
+
const config: {
|
|
1680
|
+
/** 是否在应用内运行 */
|
|
1681
|
+
runsInApp: boolean;
|
|
1682
|
+
/** 是否在小组件中运行 */
|
|
1683
|
+
runsInWidget: boolean;
|
|
1684
|
+
/** 是否在通知中运行 */
|
|
1685
|
+
runsInNotification: boolean;
|
|
1686
|
+
/** 是否使用 Siri 运行 */
|
|
1687
|
+
runsWithSiri: boolean;
|
|
1688
|
+
/** 是否在 Siri 中运行 */
|
|
1689
|
+
runsInSiri: boolean;
|
|
1690
|
+
/** 是否在快捷指令中运行 */
|
|
1691
|
+
runsInShortcuts: boolean;
|
|
1692
|
+
/** 是否在操作扩展中运行 */
|
|
1693
|
+
runsInActionExtension: boolean;
|
|
1694
|
+
/** 是否从主屏幕运行 */
|
|
1695
|
+
runsFromHomeScreen: boolean;
|
|
1696
|
+
/** 是否在 App Clip 中运行 */
|
|
1697
|
+
runsInAppClip: boolean;
|
|
1698
|
+
/** 小组件类型(small, medium, large, extraLarge) */
|
|
1699
|
+
widgetFamily: string | null;
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1702
|
+
/**
|
|
1703
|
+
* 参数对象
|
|
1704
|
+
* 提供传递给脚本的参数
|
|
1705
|
+
*/
|
|
1706
|
+
const args: {
|
|
1707
|
+
/** 小组件参数 */
|
|
1708
|
+
widgetParameter: string | null;
|
|
1709
|
+
/** 查询参数 */
|
|
1710
|
+
queryParameters: Record<string, string>;
|
|
1711
|
+
/** URL 列表 */
|
|
1712
|
+
urls: string[];
|
|
1713
|
+
/** 纯文本列表 */
|
|
1714
|
+
plainTexts: string[];
|
|
1715
|
+
/** 图像列表 */
|
|
1716
|
+
images: Image[];
|
|
1717
|
+
/** 文件路径列表 */
|
|
1718
|
+
fileURLs: string[];
|
|
1719
|
+
/** 快捷指令参数 */
|
|
1720
|
+
shortcutParameter: any;
|
|
1721
|
+
/** 通知 */
|
|
1722
|
+
notification: Notification | null;
|
|
1723
|
+
};
|
|
1724
|
+
}
|