@doubao-dev/framework 0.9.0 → 0.10.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/components-style.css +1 -1
- package/dist/api.d.ts +383 -30
- package/dist/components.d.ts +860 -5
- package/dist/config.d.ts +24 -1
- package/dist/index.d.ts +43 -8
- package/jsx-runtime.d.ts +4 -0
- package/package.json +1 -1
package/dist/api.d.ts
CHANGED
|
@@ -212,7 +212,7 @@ export declare type AppAuthorizeStatus = 'authorized' | 'denied' | 'not determin
|
|
|
212
212
|
|
|
213
213
|
/** @public */
|
|
214
214
|
export declare interface AppBaseInfoHost {
|
|
215
|
-
/**
|
|
215
|
+
/** 豆包客户端应用标识(AID) */
|
|
216
216
|
appId: string;
|
|
217
217
|
}
|
|
218
218
|
|
|
@@ -1062,6 +1062,126 @@ export declare interface CanIUseResult {
|
|
|
1062
1062
|
result: boolean;
|
|
1063
1063
|
}
|
|
1064
1064
|
|
|
1065
|
+
/** @public */
|
|
1066
|
+
export declare interface Canvas2DContext extends CanvasRenderingContext2D {
|
|
1067
|
+
drawImage(image: DrawImageSource, dx: number, dy: number): void;
|
|
1068
|
+
drawImage(image: DrawImageSource, dx: number, dy: number, dw: number, dh: number): void;
|
|
1069
|
+
drawImage(image: DrawImageSource, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/** 可导出图片的画布实例。尺寸与裁剪坐标均以画布 buffer 像素为单位。 @public */
|
|
1073
|
+
export declare interface CanvasExportSource {
|
|
1074
|
+
/** 源画布 buffer 宽度,单位 px。 */
|
|
1075
|
+
readonly width: number;
|
|
1076
|
+
/** 源画布 buffer 高度,单位 px。 */
|
|
1077
|
+
readonly height: number;
|
|
1078
|
+
/** 将当前已完成的绘图编码为图片 data URL。 */
|
|
1079
|
+
toDataURL(type?: string, quality?: number): string | Promise<string>;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
/** @public */
|
|
1083
|
+
export declare interface CanvasImage {
|
|
1084
|
+
/**
|
|
1085
|
+
* 图片资源地址。
|
|
1086
|
+
*/
|
|
1087
|
+
src: string;
|
|
1088
|
+
/**
|
|
1089
|
+
* 图片原始宽度。
|
|
1090
|
+
*/
|
|
1091
|
+
readonly width: number;
|
|
1092
|
+
/**
|
|
1093
|
+
* 图片原始高度。
|
|
1094
|
+
*/
|
|
1095
|
+
readonly height: number;
|
|
1096
|
+
/**
|
|
1097
|
+
* 图片资源是否加载完成。
|
|
1098
|
+
*/
|
|
1099
|
+
readonly complete: boolean;
|
|
1100
|
+
/**
|
|
1101
|
+
* 图片加载完成时触发。
|
|
1102
|
+
*/
|
|
1103
|
+
onload: (() => void) | null;
|
|
1104
|
+
/**
|
|
1105
|
+
* 图片加载失败时触发。
|
|
1106
|
+
*/
|
|
1107
|
+
onerror: ((error: unknown) => void) | null;
|
|
1108
|
+
/**
|
|
1109
|
+
* 添加图片加载或失败事件监听器。
|
|
1110
|
+
*/
|
|
1111
|
+
addEventListener: (event: 'load' | 'error', listener: (event: unknown) => void, options?: AddEventListenerOptions | boolean) => void;
|
|
1112
|
+
/**
|
|
1113
|
+
* 移除图片加载或失败事件监听器。
|
|
1114
|
+
*/
|
|
1115
|
+
removeEventListener: (event: 'load' | 'error', listener: (event: unknown) => void, options?: EventListenerOptions | boolean) => void;
|
|
1116
|
+
}
|
|
1117
|
+
|
|
1118
|
+
/**
|
|
1119
|
+
* 将画布指定区域导出为 PNG/JPG 临时文件,写入完成后返回路径。
|
|
1120
|
+
*
|
|
1121
|
+
* @param options - 裁剪、输出尺寸与编码选项。
|
|
1122
|
+
* @param componentScope - 与 Canvas 的 exportScope 共用引用稳定的对象(例如 useRef 保存的对象);省略时在当前页面查找 canvasId。
|
|
1123
|
+
* @example
|
|
1124
|
+
* ```typescript
|
|
1125
|
+
* import { canvasToTempFilePath, createOffscreenCanvas } from '@doubao-dev/framework/api';
|
|
1126
|
+
* const canvas = createOffscreenCanvas({ width: 200, height: 100 });
|
|
1127
|
+
* if (canvas) {
|
|
1128
|
+
* canvas.getContext('2d')?.fillRect(0, 0, 200, 100);
|
|
1129
|
+
* const result = await canvasToTempFilePath({ canvas, destWidth: 200, destHeight: 100 });
|
|
1130
|
+
* console.log(result.tempFilePath);
|
|
1131
|
+
* }
|
|
1132
|
+
* ```
|
|
1133
|
+
* @since 0.10.0
|
|
1134
|
+
* @platformSupport Android | supported | 需要 Canvas 运行环境及原生文件系统。
|
|
1135
|
+
* @platformSupport iOS | supported | 需要 Canvas 运行环境及原生文件系统。
|
|
1136
|
+
* @platformSupport HarmonyOS | unsupported | 尚未接入 Canvas。
|
|
1137
|
+
* @platformSupport PC | unsupported | 尚未接入。
|
|
1138
|
+
* @permission none | - | none | Android,iOS | 写入当前应用插件临时目录,无需相册权限。
|
|
1139
|
+
* @precondition All | 调用前完成绘制;canvasId 需要已挂载的内置 Canvas。
|
|
1140
|
+
* @usageNote All | 输出尺寸向下取整,最多 16777216 像素;编码文件遵循原生单次 10 MiB 写入及临时目录配额。
|
|
1141
|
+
* @usageNote All | 原生 writeFile 的 errNo/errMsg 原样透传;参数错误抛出 TypeError,尺寸超限抛出 RangeError。
|
|
1142
|
+
* @errorCode errNo | 208 | quota exceeded | Android,iOS | 文件系统写入超出配额 | 缩小输出尺寸或清理不再使用的临时文件。
|
|
1143
|
+
* @errorExample
|
|
1144
|
+
* ```json
|
|
1145
|
+
* { "errNo": 208, "errMsg": "quota exceeded" }
|
|
1146
|
+
* ```
|
|
1147
|
+
* @resultExample
|
|
1148
|
+
* ```json
|
|
1149
|
+
* { "tempFilePath": "appletfile://temp/canvas-example.png" }
|
|
1150
|
+
* ```
|
|
1151
|
+
* @public
|
|
1152
|
+
*/
|
|
1153
|
+
export declare function canvasToTempFilePath(options: CanvasToTempFilePathParams, componentScope?: object): Promise<CanvasToTempFilePathResult>;
|
|
1154
|
+
|
|
1155
|
+
/** 画布图片导出参数。 @public */
|
|
1156
|
+
export declare interface CanvasToTempFilePathParams {
|
|
1157
|
+
/** 画布实例;与 canvasId 二选一。 @default - */
|
|
1158
|
+
canvas?: CanvasExportSource;
|
|
1159
|
+
/** 当前页面或指定 exportScope 中内置 Canvas 的 id。 @default - */
|
|
1160
|
+
canvasId?: string;
|
|
1161
|
+
/** 裁剪横坐标,以源画布 buffer 像素为单位。 @default 0 */
|
|
1162
|
+
x?: number;
|
|
1163
|
+
/** 裁剪纵坐标,以源画布 buffer 像素为单位。 @default 0 */
|
|
1164
|
+
y?: number;
|
|
1165
|
+
/** 裁剪宽度,单位 px。 @default 源画布宽度减去 x */
|
|
1166
|
+
width?: number;
|
|
1167
|
+
/** 裁剪高度,单位 px。 @default 源画布高度减去 y */
|
|
1168
|
+
height?: number;
|
|
1169
|
+
/** 输出像素宽度。 @default width 乘设备像素密度 */
|
|
1170
|
+
destWidth?: number;
|
|
1171
|
+
/** 输出像素高度。 @default height 乘设备像素密度 */
|
|
1172
|
+
destHeight?: number;
|
|
1173
|
+
/** 输出图片格式。 @default png */
|
|
1174
|
+
fileType?: 'png' | 'jpg';
|
|
1175
|
+
/** 仅 jpg 生效,范围 (0, 1],其他值按 1 处理。 @default 1 */
|
|
1176
|
+
quality?: number;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
/** 画布导出结果。 @public */
|
|
1180
|
+
export declare interface CanvasToTempFilePathResult {
|
|
1181
|
+
/** 已写入当前应用插件临时目录的文件路径。 */
|
|
1182
|
+
tempFilePath: string;
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1065
1185
|
/**
|
|
1066
1186
|
* 对话框高度或展示状态变化事件。
|
|
1067
1187
|
*
|
|
@@ -1368,12 +1488,44 @@ export declare interface ChooseMessageFile {
|
|
|
1368
1488
|
path: string;
|
|
1369
1489
|
/** 文件大小,单位 B。 */
|
|
1370
1490
|
size: number;
|
|
1371
|
-
/** 会话发送时间,Unix
|
|
1491
|
+
/** 会话发送时间,Unix 时间戳,单位秒。 */
|
|
1372
1492
|
time: number;
|
|
1373
1493
|
/** 文件类型。 */
|
|
1374
1494
|
type: SelectedMessageFileType;
|
|
1375
1495
|
}
|
|
1376
1496
|
|
|
1497
|
+
/**
|
|
1498
|
+
* 从当前账号的豆包会话选择图片、视频和普通文件。
|
|
1499
|
+
*
|
|
1500
|
+
* 文件下载并进入应用插件临时目录后返回;取消或任意文件交付失败时调用失败。
|
|
1501
|
+
* @example
|
|
1502
|
+
* ```typescript
|
|
1503
|
+
* import { chooseMessageFile } from '@doubao-dev/framework/api';
|
|
1504
|
+
* const { tempFiles } = await chooseMessageFile({ count: 3, type: 'all' });
|
|
1505
|
+
* console.log(tempFiles.map(file => file.path));
|
|
1506
|
+
* ```
|
|
1507
|
+
* @since 0.10.0
|
|
1508
|
+
* @platformSupport Android | supported | 使用宿主会话附件选择器。
|
|
1509
|
+
* @platformSupport iOS | supported | 使用宿主会话附件选择器。
|
|
1510
|
+
* @platformSupport HarmonyOS | unsupported | 未接入。
|
|
1511
|
+
* @platformSupport PC | unsupported | 未接入。
|
|
1512
|
+
* @permission host | conversation-attachment-picker | required | Android,iOS | 当前账号主动选择的可访问会话附件。
|
|
1513
|
+
* @authorizationBehavior Android | 用户在宿主选择面板确认后才交付选中附件,取消返回 114。
|
|
1514
|
+
* @authorizationBehavior iOS | 用户在宿主选择面板确认后才交付选中附件,取消返回 114。
|
|
1515
|
+
* @precondition All | 已登录,当前页面有效;count 为 0–100 的整数。
|
|
1516
|
+
* @resultExample
|
|
1517
|
+
* ```json
|
|
1518
|
+
* { "tempFiles": [{ "path": "appletfile://temp/example.jpg", "name": "example.jpg", "size": 1024, "type": "image", "time": 1700000000 }] }
|
|
1519
|
+
* ```
|
|
1520
|
+
* @usageNote All | count 为 0 时返回空列表;extension 仅 file 生效。
|
|
1521
|
+
* @usageNote All | 返回 time 为来源消息的 Unix 秒时间戳;临时文件遵守应用插件文件系统生命周期与配额。
|
|
1522
|
+
* @errorCode common | 103 | Android,iOS
|
|
1523
|
+
* @errorCode common | 104 | Android,iOS
|
|
1524
|
+
* @errorCode common | 114 | Android,iOS
|
|
1525
|
+
* @public
|
|
1526
|
+
*/
|
|
1527
|
+
export declare const chooseMessageFile: (params: ChooseMessageFileParams) => Promise<ChooseMessageFileResult>;
|
|
1528
|
+
|
|
1377
1529
|
/**
|
|
1378
1530
|
* 选择消息文件的请求参数。
|
|
1379
1531
|
*
|
|
@@ -1382,9 +1534,9 @@ export declare interface ChooseMessageFile {
|
|
|
1382
1534
|
export declare interface ChooseMessageFileParams {
|
|
1383
1535
|
/** 最多可选文件个数。 */
|
|
1384
1536
|
count: number;
|
|
1385
|
-
/** 基于文件扩展名的过滤条件,仅在 `type` 为 `file` 时生效。 */
|
|
1537
|
+
/** 基于文件扩展名的过滤条件,仅在 `type` 为 `file` 时生效。 @default - */
|
|
1386
1538
|
extension?: string[];
|
|
1387
|
-
/** 允许选择的文件类型。 */
|
|
1539
|
+
/** 允许选择的文件类型。 @default all */
|
|
1388
1540
|
type?: ChooseMessageFileType;
|
|
1389
1541
|
}
|
|
1390
1542
|
|
|
@@ -2142,6 +2294,40 @@ declare function createCustomEvent_2<Params extends object>(name: string, option
|
|
|
2142
2294
|
*/
|
|
2143
2295
|
export declare function createInnerAudioContext(): InnerAudioContext;
|
|
2144
2296
|
|
|
2297
|
+
/**
|
|
2298
|
+
* 同步创建离屏画布,用于 2D 绘制、像素读取和图片导出。
|
|
2299
|
+
*
|
|
2300
|
+
* @param options - 画布尺寸,建议显式传入宽高。
|
|
2301
|
+
* @returns 画布对象;创建能力不可用时返回 undefined。
|
|
2302
|
+
* @example
|
|
2303
|
+
* ```typescript
|
|
2304
|
+
* import { createOffscreenCanvas } from '@doubao-dev/framework/api';
|
|
2305
|
+
*
|
|
2306
|
+
* const canvas = createOffscreenCanvas({ width: 64, height: 64 });
|
|
2307
|
+
* const ctx = canvas?.getContext('2d');
|
|
2308
|
+
* if (ctx) {
|
|
2309
|
+
* ctx.fillStyle = '#0068c4';
|
|
2310
|
+
* ctx.fillRect(0, 0, 64, 64);
|
|
2311
|
+
* console.log(ctx.getImageData(0, 0, 64, 64).data);
|
|
2312
|
+
* }
|
|
2313
|
+
* ```
|
|
2314
|
+
* @since 0.10.0
|
|
2315
|
+
* @platformSupport Android | supported | 使用 Canvas 运行环境创建离屏画布。
|
|
2316
|
+
* @platformSupport iOS | supported | 使用 Canvas 运行环境创建离屏画布。
|
|
2317
|
+
* @platformSupport PC | unsupported | 当前未完成该平台验收。
|
|
2318
|
+
* @platformSupport HarmonyOS | unsupported | 当前未完成该平台接入。
|
|
2319
|
+
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
2320
|
+
* @precondition All | 无需挂载 canvas 节点。
|
|
2321
|
+
* @usageNote All | 检查创建结果及 getContext 返回值;图片须在 onload 后绘制。
|
|
2322
|
+
* @resultExample
|
|
2323
|
+
* ```json
|
|
2324
|
+
* { "width": 64, "height": 64 }
|
|
2325
|
+
* ```
|
|
2326
|
+
* @errorCode none | - | - | Android,iOS | 能力不可用时返回 undefined;非法尺寸抛出同步异常 | 检查返回值并传入正整数尺寸
|
|
2327
|
+
* @public
|
|
2328
|
+
*/
|
|
2329
|
+
export declare function createOffscreenCanvas(options?: OffscreenCanvasOptions): OffscreenCanvas_2 | undefined;
|
|
2330
|
+
|
|
2145
2331
|
/**
|
|
2146
2332
|
* 创建三方纯签约流程所需的签约单。
|
|
2147
2333
|
*
|
|
@@ -2802,6 +2988,8 @@ export declare interface DownloadTaskHeadersReceivedEvent {
|
|
|
2802
2988
|
header: Record<string, string>;
|
|
2803
2989
|
}
|
|
2804
2990
|
|
|
2991
|
+
export declare type DrawImageSource = CanvasImageSource | CanvasImage | OffscreenCanvas_2;
|
|
2992
|
+
|
|
2805
2993
|
/**
|
|
2806
2994
|
* 发起抖音支付流程。
|
|
2807
2995
|
*
|
|
@@ -3348,7 +3536,7 @@ export declare interface GetAppAuthorizeSettingResult {
|
|
|
3348
3536
|
/**
|
|
3349
3537
|
* 获取应用基础信息。
|
|
3350
3538
|
*
|
|
3351
|
-
* @returns
|
|
3539
|
+
* @returns 应用基础信息,见 {@link GetAppBaseInfoResult}。
|
|
3352
3540
|
* @example
|
|
3353
3541
|
* ```typescript
|
|
3354
3542
|
* import { getAppBaseInfo } from '@doubao-dev/framework/api';
|
|
@@ -3363,25 +3551,25 @@ export declare interface GetAppAuthorizeSettingResult {
|
|
|
3363
3551
|
* @containerSupport Page | supported
|
|
3364
3552
|
* @containerSupport Widget | supported
|
|
3365
3553
|
* @platformSupport Android | supported | 支持异步获取应用基础信息。
|
|
3366
|
-
* @platformSupport iOS |
|
|
3554
|
+
* @platformSupport iOS | supported | 支持异步获取应用基础信息。
|
|
3367
3555
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
3368
3556
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
3369
3557
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
3370
3558
|
* @precondition All | 无额外前置条件
|
|
3371
|
-
* @usageNote All |
|
|
3559
|
+
* @usageNote All | 同步调用请使用 getAppBaseInfoSync。
|
|
3372
3560
|
* @resultExample
|
|
3373
3561
|
* ```json
|
|
3374
3562
|
* {
|
|
3375
3563
|
* "SDKVersion": "0.0.36",
|
|
3376
3564
|
* "host": {
|
|
3377
|
-
* "appId": "
|
|
3565
|
+
* "appId": "482431"
|
|
3378
3566
|
* },
|
|
3379
3567
|
* "language": "zh_CN",
|
|
3380
3568
|
* "version": "8.0.0",
|
|
3381
3569
|
* "theme": "light"
|
|
3382
3570
|
* }
|
|
3383
3571
|
* ```
|
|
3384
|
-
* @errorCode none | - | - | Android,iOS |
|
|
3572
|
+
* @errorCode none | - | - | Android,iOS | 无 API 专属错误码 | 无需处理
|
|
3385
3573
|
*
|
|
3386
3574
|
* @public
|
|
3387
3575
|
*/
|
|
@@ -3391,22 +3579,22 @@ export declare const getAppBaseInfo: (params?: {}) => Promise<GetAppBaseInfoResu
|
|
|
3391
3579
|
export declare interface GetAppBaseInfoResult {
|
|
3392
3580
|
/** 客户端基础库版本 */
|
|
3393
3581
|
SDKVersion?: string;
|
|
3394
|
-
/**
|
|
3582
|
+
/** 豆包客户端是否为调试构建 */
|
|
3395
3583
|
enableDebug?: boolean;
|
|
3396
3584
|
/** 当前豆包客户端信息 */
|
|
3397
3585
|
host?: AppBaseInfoHost;
|
|
3398
|
-
/**
|
|
3586
|
+
/** 豆包客户端当前使用的语言 */
|
|
3399
3587
|
language: string;
|
|
3400
3588
|
/** 豆包客户端版本号 */
|
|
3401
3589
|
version?: string;
|
|
3402
|
-
/**
|
|
3590
|
+
/** 当前应用插件使用的主题 */
|
|
3403
3591
|
theme?: 'light' | 'dark';
|
|
3404
3592
|
}
|
|
3405
3593
|
|
|
3406
3594
|
/**
|
|
3407
3595
|
* 获取应用基础信息。
|
|
3408
3596
|
*
|
|
3409
|
-
* @returns
|
|
3597
|
+
* @returns 应用基础信息,见 {@link GetAppBaseInfoResult}。
|
|
3410
3598
|
* @example
|
|
3411
3599
|
* ```typescript
|
|
3412
3600
|
* import { getAppBaseInfoSync } from '@doubao-dev/framework/api';
|
|
@@ -3421,18 +3609,18 @@ export declare interface GetAppBaseInfoResult {
|
|
|
3421
3609
|
* @containerSupport Page | supported
|
|
3422
3610
|
* @containerSupport Widget | supported
|
|
3423
3611
|
* @platformSupport Android | supported | 支持同步获取应用基础信息。
|
|
3424
|
-
* @platformSupport iOS | supported |
|
|
3612
|
+
* @platformSupport iOS | supported | 需要客户端提供同步实现。
|
|
3425
3613
|
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
3426
3614
|
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
3427
3615
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
3428
3616
|
* @precondition All | 无额外前置条件
|
|
3429
|
-
* @usageNote All |
|
|
3617
|
+
* @usageNote All | 同步桥接调用失败时抛出桥接错误。
|
|
3430
3618
|
* @resultExample
|
|
3431
3619
|
* ```json
|
|
3432
3620
|
* {
|
|
3433
3621
|
* "SDKVersion": "0.0.36",
|
|
3434
3622
|
* "host": {
|
|
3435
|
-
* "appId": "
|
|
3623
|
+
* "appId": "482431"
|
|
3436
3624
|
* },
|
|
3437
3625
|
* "language": "zh_CN",
|
|
3438
3626
|
* "version": "8.0.0",
|
|
@@ -3443,7 +3631,7 @@ export declare interface GetAppBaseInfoResult {
|
|
|
3443
3631
|
*
|
|
3444
3632
|
* @public
|
|
3445
3633
|
*/
|
|
3446
|
-
export declare const getAppBaseInfoSync: (
|
|
3634
|
+
export declare const getAppBaseInfoSync: (params?: {}) => GetAppBaseInfoResult;
|
|
3447
3635
|
|
|
3448
3636
|
/**
|
|
3449
3637
|
* 获取全局唯一的背景音频管理器。
|
|
@@ -4243,9 +4431,10 @@ export declare interface GetConnectedWifiResult {
|
|
|
4243
4431
|
* @platformSupport HarmonyOS | unsupported | 暂不支持
|
|
4244
4432
|
* @permission none | - | none | Android,iOS,PC | 无需额外权限
|
|
4245
4433
|
* @precondition All | 无额外前置条件
|
|
4246
|
-
* @
|
|
4247
|
-
* @platformNote
|
|
4248
|
-
* @platformNote
|
|
4434
|
+
* @usageNote All | Web 模拟器的 `platform` 固定返回 `devtools_web`,可据此识别模拟器环境;该值不随模拟机型或运行模拟器的电脑操作系统改变
|
|
4435
|
+
* @platformNote Android | `platform` 返回 `android`;`abi`、`deviceAbi`、`cpuType` 仅 Android 返回
|
|
4436
|
+
* @platformNote iOS | `platform` 返回 `ios`(含 iPad);在 Mac 上运行时返回 `mac`。不返回 `abi`、`deviceAbi`、`cpuType`
|
|
4437
|
+
* @platformNote PC | 豆包网页版的 `platform` 始终返回 `web`,包括在 Windows、macOS 上使用浏览器访问;桌面客户端按平台返回 `windows`、`mac` 或 `linux`,无法识别时返回 `web`。不返回 Android 专属字段
|
|
4249
4438
|
* @resultExample
|
|
4250
4439
|
* ```json
|
|
4251
4440
|
* {
|
|
@@ -4281,7 +4470,14 @@ export declare interface GetDeviceInfoResult {
|
|
|
4281
4470
|
model: string;
|
|
4282
4471
|
/** 操作系统及版本。 */
|
|
4283
4472
|
system: string;
|
|
4284
|
-
/**
|
|
4473
|
+
/**
|
|
4474
|
+
* 应用插件运行平台标识,返回小写字符串。
|
|
4475
|
+
* android:Android 客户端;ios:iOS 客户端(含 iPad)。
|
|
4476
|
+
* windows:Windows 桌面客户端;mac:macOS 客户端;linux:Linux 平台。
|
|
4477
|
+
* web:豆包网页版,或桌面客户端无法识别平台时的回退值。
|
|
4478
|
+
* devtools_web:Web 模拟器,切换模拟的 iOS 或 Android 机型不会改变此值。
|
|
4479
|
+
* 豆包网页版中始终返回 web,与设备的操作系统无关;操作系统及版本请读取 system。
|
|
4480
|
+
*/
|
|
4285
4481
|
platform: string;
|
|
4286
4482
|
/** 设备 CPU 型号,仅 Android 支持。 */
|
|
4287
4483
|
cpuType?: string;
|
|
@@ -4312,6 +4508,7 @@ export declare interface GetDeviceInfoResult {
|
|
|
4312
4508
|
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
4313
4509
|
* @precondition All | 无额外前置条件
|
|
4314
4510
|
* @usageNote All | `platform` 返回小写的客户端平台标识;`benchmarkLevel` 无法获取时返回 -1
|
|
4511
|
+
* @usageNote All | Web 模拟器的 `platform` 固定返回 `devtools_web`,与 `getDeviceInfo` 一致,不随模拟机型或运行模拟器的电脑操作系统改变
|
|
4315
4512
|
* @platformNote Android | `abi`、`deviceAbi`、`cpuType` 为可选字段,豆包无法获取时不返回
|
|
4316
4513
|
* @platformNote iOS | 不返回 `abi`、`deviceAbi`、`cpuType`
|
|
4317
4514
|
* @resultExample
|
|
@@ -5526,7 +5723,7 @@ export declare interface GetSystemInfoResult {
|
|
|
5526
5723
|
windowHeight: number;
|
|
5527
5724
|
/** 状态栏高度,单位为逻辑像素 */
|
|
5528
5725
|
statusBarHeight: number;
|
|
5529
|
-
/**
|
|
5726
|
+
/** 豆包客户端当前使用的语言 */
|
|
5530
5727
|
language: string;
|
|
5531
5728
|
/** 豆包客户端版本号 */
|
|
5532
5729
|
version?: string;
|
|
@@ -5536,13 +5733,13 @@ export declare interface GetSystemInfoResult {
|
|
|
5536
5733
|
platform: string;
|
|
5537
5734
|
/** 客户端基础库版本 */
|
|
5538
5735
|
SDKVersion?: string;
|
|
5539
|
-
/**
|
|
5736
|
+
/** 当前应用插件使用的主题 */
|
|
5540
5737
|
theme?: 'light' | 'dark';
|
|
5541
5738
|
/** 设备性能等级,-1 表示未知 */
|
|
5542
5739
|
benchmarkLevel?: number;
|
|
5543
5740
|
/** 在竖屏正方向下的安全区域,单位为逻辑像素 */
|
|
5544
5741
|
safeArea?: SystemInfoSafeArea;
|
|
5545
|
-
/**
|
|
5742
|
+
/** 豆包客户端是否为调试构建 */
|
|
5546
5743
|
enableDebug?: boolean;
|
|
5547
5744
|
/** 设备方向 */
|
|
5548
5745
|
deviceOrientation?: 'portrait' | 'landscape';
|
|
@@ -5609,7 +5806,7 @@ export declare interface GetSystemInfoResult {
|
|
|
5609
5806
|
*
|
|
5610
5807
|
* @public
|
|
5611
5808
|
*/
|
|
5612
|
-
export declare const getSystemInfoSync: (
|
|
5809
|
+
export declare const getSystemInfoSync: (params?: {} | undefined) => GetSystemInfoResult;
|
|
5613
5810
|
|
|
5614
5811
|
/**
|
|
5615
5812
|
* 获取设备设置。
|
|
@@ -6907,6 +7104,49 @@ export declare interface NotifyBLECharacteristicValueChangeParams {
|
|
|
6907
7104
|
type?: BluetoothNotifyType;
|
|
6908
7105
|
}
|
|
6909
7106
|
|
|
7107
|
+
/** @public */
|
|
7108
|
+
declare interface OffscreenCanvas_2 {
|
|
7109
|
+
/**
|
|
7110
|
+
* 画布宽度(buffer 像素数)
|
|
7111
|
+
*/
|
|
7112
|
+
width: number;
|
|
7113
|
+
/**
|
|
7114
|
+
* 画布高度(buffer 像素数)
|
|
7115
|
+
*/
|
|
7116
|
+
height: number;
|
|
7117
|
+
/**
|
|
7118
|
+
* 获取绘图上下文
|
|
7119
|
+
*/
|
|
7120
|
+
getContext: {
|
|
7121
|
+
(contextType: '2d'): Canvas2DContext | null;
|
|
7122
|
+
(contextType: 'webgl', contextAttributes?: WebGLContextAttributes_2): WebGLRenderingContext | null;
|
|
7123
|
+
(contextType: 'webgl2', contextAttributes?: WebGLContextAttributes_2): WebGL2RenderingContext | null;
|
|
7124
|
+
};
|
|
7125
|
+
/**
|
|
7126
|
+
* 创建图片对象
|
|
7127
|
+
*/
|
|
7128
|
+
createImage: () => CanvasImage | undefined;
|
|
7129
|
+
/**
|
|
7130
|
+
* 导出画布内容为 data URI
|
|
7131
|
+
*/
|
|
7132
|
+
toDataURL: (type?: string, encoderOptions?: number) => string;
|
|
7133
|
+
}
|
|
7134
|
+
export { OffscreenCanvas_2 as OffscreenCanvas }
|
|
7135
|
+
|
|
7136
|
+
/** 离屏画布尺寸,单位为画布像素。@public */
|
|
7137
|
+
export declare interface OffscreenCanvasOptions {
|
|
7138
|
+
/**
|
|
7139
|
+
* 宽度。
|
|
7140
|
+
* @default -
|
|
7141
|
+
*/
|
|
7142
|
+
width?: number;
|
|
7143
|
+
/**
|
|
7144
|
+
* 高度。
|
|
7145
|
+
* @default -
|
|
7146
|
+
*/
|
|
7147
|
+
height?: number;
|
|
7148
|
+
}
|
|
7149
|
+
|
|
6910
7150
|
/**
|
|
6911
7151
|
* 监听加速度数据变化事件。
|
|
6912
7152
|
*
|
|
@@ -7641,6 +7881,47 @@ export declare const onUserScreenRecord: ClientEventRegistry<UserScreenRecordEve
|
|
|
7641
7881
|
*/
|
|
7642
7882
|
export declare const onWifiConnected: ClientEventRegistry<WifiConnectedEvent>;
|
|
7643
7883
|
|
|
7884
|
+
/**
|
|
7885
|
+
* 监听当前窗口尺寸变化。
|
|
7886
|
+
*
|
|
7887
|
+
* 使用与 {@link getWindowInfoSync} 相同的数据源,仅在窗口宽度或高度变化时触发,注册时不触发回调。
|
|
7888
|
+
*
|
|
7889
|
+
* @param callback 窗口尺寸变化时调用的监听函数。
|
|
7890
|
+
* @returns 取消当前监听的函数。
|
|
7891
|
+
* @example
|
|
7892
|
+
* ```typescript
|
|
7893
|
+
* import { onWindowResize } from '@doubao-dev/framework/api';
|
|
7894
|
+
*
|
|
7895
|
+
* const offWindowResize = onWindowResize(({ size }) => {
|
|
7896
|
+
* console.log(size.windowWidth, size.windowHeight);
|
|
7897
|
+
* });
|
|
7898
|
+
*
|
|
7899
|
+
* offWindowResize();
|
|
7900
|
+
* ```
|
|
7901
|
+
* @since 0.10.0
|
|
7902
|
+
* @containerSupport Page | supported
|
|
7903
|
+
* @containerSupport Widget | unsupported
|
|
7904
|
+
* @platformSupport Android | supported | 支持监听窗口尺寸变化。
|
|
7905
|
+
* @platformSupport iOS | supported | 支持监听窗口尺寸变化。
|
|
7906
|
+
* @platformSupport PC | unsupported | 当前未提供该平台实现。
|
|
7907
|
+
* @platformSupport HarmonyOS | unsupported | 当前未提供该平台实现。
|
|
7908
|
+
* @permission none | - | none | Android,iOS | 无需额外权限
|
|
7909
|
+
* @precondition All | 无额外前置条件
|
|
7910
|
+
* @usageNote All | 注册时不会立即触发回调;不再需要监听时,调用返回的函数取消监听。
|
|
7911
|
+
* @resultExample
|
|
7912
|
+
* ```json
|
|
7913
|
+
* {
|
|
7914
|
+
* "size": {
|
|
7915
|
+
* "windowWidth": 393,
|
|
7916
|
+
* "windowHeight": 852
|
|
7917
|
+
* }
|
|
7918
|
+
* }
|
|
7919
|
+
* ```
|
|
7920
|
+
* @errorCode none | - | - | Android,iOS | 无 API 专属错误码 | 无需处理
|
|
7921
|
+
* @public
|
|
7922
|
+
*/
|
|
7923
|
+
export declare function onWindowResize(callback: WindowResizeListener): () => void;
|
|
7924
|
+
|
|
7644
7925
|
/**
|
|
7645
7926
|
* 通过 URI 打开外部应用。
|
|
7646
7927
|
*
|
|
@@ -7919,6 +8200,9 @@ export declare interface OpenSettingResult {
|
|
|
7919
8200
|
subscriptionsSetting?: SubscriptionsSetting;
|
|
7920
8201
|
}
|
|
7921
8202
|
|
|
8203
|
+
/** @internal */
|
|
8204
|
+
export declare function patchDrawImage(ctx: CanvasRenderingContext2D): Canvas2DContext;
|
|
8205
|
+
|
|
7922
8206
|
/** @public */
|
|
7923
8207
|
declare interface Performance_2 {
|
|
7924
8208
|
/**
|
|
@@ -8166,6 +8450,28 @@ export declare interface PreviewImageParams {
|
|
|
8166
8450
|
referrerPolicy?: string;
|
|
8167
8451
|
}
|
|
8168
8452
|
|
|
8453
|
+
/**
|
|
8454
|
+
* 打开图片、视频混合预览,界面打开后完成调用。
|
|
8455
|
+
*
|
|
8456
|
+
* @example
|
|
8457
|
+
* ```typescript
|
|
8458
|
+
* import { previewMedia } from '@doubao-dev/framework/api';
|
|
8459
|
+
* await previewMedia({ sources: [{ url: 'https://example.com/video.mp4', type: 'video' }], muted: true });
|
|
8460
|
+
* ```
|
|
8461
|
+
* @since 0.10.0
|
|
8462
|
+
* @platformSupport Android | supported | 由宿主展示混合媒体预览。
|
|
8463
|
+
* @platformSupport iOS | supported | 由宿主展示混合媒体预览。
|
|
8464
|
+
* @platformSupport HarmonyOS | unsupported | 未接入。
|
|
8465
|
+
* @platformSupport PC | unsupported | 未接入。
|
|
8466
|
+
* @permission none | - | none | Android,iOS | 预览无需相册写入权限;菜单与底栏提供系统分享。
|
|
8467
|
+
* @precondition All | 当前页面有效,sources 非空,current 为有效资源序号。
|
|
8468
|
+
* @usageNote All | referrerPolicy 当前支持 no-referrer;origin 返回不支持。菜单动作由宿主提供。
|
|
8469
|
+
* @errorCode common | 103 | Android,iOS
|
|
8470
|
+
* @errorCode common | 104 | Android,iOS
|
|
8471
|
+
* @public
|
|
8472
|
+
*/
|
|
8473
|
+
export declare const previewMedia: (params: PreviewMediaParams) => Promise<object>;
|
|
8474
|
+
|
|
8169
8475
|
/**
|
|
8170
8476
|
* 预览图片和视频的请求参数。
|
|
8171
8477
|
*
|
|
@@ -8174,12 +8480,16 @@ export declare interface PreviewImageParams {
|
|
|
8174
8480
|
export declare interface PreviewMediaParams {
|
|
8175
8481
|
/** 需要预览的资源列表。 */
|
|
8176
8482
|
sources: PreviewMediaSource[];
|
|
8177
|
-
/** 当前显示资源的下标。 */
|
|
8483
|
+
/** 当前显示资源的下标。 @default 0 */
|
|
8178
8484
|
current?: number;
|
|
8179
|
-
/** 是否显示长按菜单。 */
|
|
8485
|
+
/** 是否显示长按菜单。 @default true */
|
|
8180
8486
|
showmenu?: boolean;
|
|
8181
|
-
/** 预览页使用的 Referrer 策略。 */
|
|
8487
|
+
/** 预览页使用的 Referrer 策略。 @default no-referrer */
|
|
8182
8488
|
referrerPolicy?: string;
|
|
8489
|
+
/** 视频是否默认静音。 @default false */
|
|
8490
|
+
muted?: boolean;
|
|
8491
|
+
/** 是否显示预览页底部操作栏。 @default false */
|
|
8492
|
+
showBottomActionBar?: boolean;
|
|
8183
8493
|
}
|
|
8184
8494
|
|
|
8185
8495
|
/**
|
|
@@ -8190,9 +8500,9 @@ export declare interface PreviewMediaParams {
|
|
|
8190
8500
|
export declare interface PreviewMediaSource {
|
|
8191
8501
|
/** 图片或视频的地址。 */
|
|
8192
8502
|
url: string;
|
|
8193
|
-
/** 资源类型。 */
|
|
8503
|
+
/** 资源类型。 @default image */
|
|
8194
8504
|
type?: 'image' | 'video';
|
|
8195
|
-
/** 视频封面图地址。 */
|
|
8505
|
+
/** 视频封面图地址。 @default - */
|
|
8196
8506
|
poster?: string;
|
|
8197
8507
|
}
|
|
8198
8508
|
|
|
@@ -8505,6 +8815,9 @@ export declare type RecorderSampleRate = 8000 | 11025 | 12000 | 16000 | 22050 |
|
|
|
8505
8815
|
*/
|
|
8506
8816
|
export declare const redirectTo: (params: NavigateToParams) => Promise<object>;
|
|
8507
8817
|
|
|
8818
|
+
/** 注册内置 Canvas,返回卸载清理函数。 @internal @doc internal */
|
|
8819
|
+
export declare function registerCanvasExportSource(id: string, source: CanvasExportSource, scope?: object): () => void;
|
|
8820
|
+
|
|
8508
8821
|
/**
|
|
8509
8822
|
* 关闭所有页面并跳转到应用内页面。
|
|
8510
8823
|
*
|
|
@@ -12040,6 +12353,26 @@ export declare interface VibrateShortParams {
|
|
|
12040
12353
|
*/
|
|
12041
12354
|
export declare type VibrateShortType = 'heavy' | 'medium' | 'light';
|
|
12042
12355
|
|
|
12356
|
+
/** @public */
|
|
12357
|
+
declare interface WebGLContextAttributes_2 {
|
|
12358
|
+
/**
|
|
12359
|
+
* 是否开启透明通道,开启后画布背景透明可与下层内容叠加显示
|
|
12360
|
+
* @defaultValue false
|
|
12361
|
+
*/
|
|
12362
|
+
alpha?: boolean;
|
|
12363
|
+
/**
|
|
12364
|
+
* 是否保留绘图缓冲区,开启后 toDataURL/readPixels 可在绘制后正常读取
|
|
12365
|
+
* @defaultValue false
|
|
12366
|
+
*/
|
|
12367
|
+
preserveDrawingBuffer?: boolean;
|
|
12368
|
+
/**
|
|
12369
|
+
* 是否开启抗锯齿
|
|
12370
|
+
* @defaultValue false
|
|
12371
|
+
*/
|
|
12372
|
+
antialias?: boolean;
|
|
12373
|
+
}
|
|
12374
|
+
export { WebGLContextAttributes_2 as WebGLContextAttributes }
|
|
12375
|
+
|
|
12043
12376
|
/**
|
|
12044
12377
|
* Wi-Fi 连接事件。
|
|
12045
12378
|
*
|
|
@@ -12101,6 +12434,26 @@ export declare interface WifiListItem {
|
|
|
12101
12434
|
password?: string;
|
|
12102
12435
|
}
|
|
12103
12436
|
|
|
12437
|
+
/**
|
|
12438
|
+
* 窗口尺寸变化事件。
|
|
12439
|
+
* @public
|
|
12440
|
+
*/
|
|
12441
|
+
export declare interface WindowResizeEvent {
|
|
12442
|
+
/** 变化后的窗口尺寸,单位为逻辑像素。 */
|
|
12443
|
+
size: {
|
|
12444
|
+
/** 窗口宽度。 */
|
|
12445
|
+
windowWidth: number;
|
|
12446
|
+
/** 窗口高度。 */
|
|
12447
|
+
windowHeight: number;
|
|
12448
|
+
};
|
|
12449
|
+
}
|
|
12450
|
+
|
|
12451
|
+
/**
|
|
12452
|
+
* 窗口尺寸变化监听函数。
|
|
12453
|
+
* @public
|
|
12454
|
+
*/
|
|
12455
|
+
export declare type WindowResizeListener = (event: WindowResizeEvent) => void;
|
|
12456
|
+
|
|
12104
12457
|
/** @public */
|
|
12105
12458
|
export declare interface WindowSafeArea {
|
|
12106
12459
|
/** 安全区域左上角横坐标 */
|