@doubao-apps/create 0.0.26 → 0.0.27

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.
Files changed (99) hide show
  1. package/dist/36.js +4 -4
  2. package/dist/template-empty/.ai/examples/common-patterns.md +53 -43
  3. package/dist/template-empty/.ai/examples/component-basics.md +0 -17
  4. package/dist/template-empty/.ai/guides/component-development.md +96 -214
  5. package/dist/template-empty/.ai/guides/system-prompt.md +14 -14
  6. package/dist/template-empty/.ai/reference/framework-api-quick-ref.md +46 -85
  7. package/dist/template-empty/.ai/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +13 -13
  8. package/dist/template-empty/.ai/reference/open-api/{02-storage.md → 02-/345/255/230/345/202/250.md} +13 -21
  9. package/dist/template-empty/.ai/reference/open-api/{03-router.md → 03-/350/267/257/347/224/261.md} +9 -9
  10. package/dist/{template-starter/.ai/reference/open-api/04-ui- → template-empty/.ai/reference/open-api/04-/347/225/214/351/235/242-}/344/272/244/344/272/222.md +12 -12
  11. package/dist/template-empty/.ai/reference/open-api/05-/347/225/214/351/235/242-/350/276/223/345/205/245.md +42 -0
  12. package/dist/template-empty/.ai/reference/open-api/06-/347/275/221/347/273/234.md +148 -0
  13. package/dist/template-empty/.ai/reference/open-api/{07-media.md → 07-/345/252/222/344/275/223.md} +8 -8
  14. package/dist/template-empty/.ai/reference/open-api/{08-open- → 08-/345/274/200/346/224/276/350/203/275/345/212/233-}/344/270/232/345/212/241/350/203/275/345/212/233.md +83 -14
  15. package/dist/{template-starter/.ai/reference/open-api/09-device-bluetooth.md → template-empty/.ai/reference/open-api/09-/350/256/276/345/244/207-/350/223/235/347/211/231.md} +22 -46
  16. package/dist/{template-starter/.ai/reference/open-api/10-device-wi-fi.md → template-empty/.ai/reference/open-api/10-/350/256/276/345/244/207-wi-fi.md} +9 -9
  17. package/dist/template-empty/.ai/reference/open-api/11-/350/256/276/345/244/207-/345/212/240/351/200/237/345/272/246/350/256/241.md +104 -0
  18. package/dist/template-empty/.ai/reference/open-api/12-/350/256/276/345/244/207-ibeacon.md +148 -0
  19. package/dist/template-empty/.ai/reference/open-api/13-/350/256/276/345/244/207-/347/275/227/347/233/230.md +82 -0
  20. package/dist/template-empty/.ai/reference/open-api/14-/350/256/276/345/244/207-/350/256/276/345/244/207/346/226/271/345/220/221.md +70 -0
  21. package/dist/template-empty/.ai/reference/open-api/15-/350/256/276/345/244/207-/351/231/200/350/236/272/344/273/252.md +104 -0
  22. package/dist/template-empty/.ai/reference/open-api/16-ui-/350/276/223/345/205/245.md +65 -0
  23. package/dist/template-empty/.ai/reference/open-api/17-/350/256/276/345/244/207-/347/275/221/347/273/234.md +164 -0
  24. package/dist/template-empty/.ai/reference/open-api/18-/350/256/276/345/244/207-/347/237/255/344/277/241.md +62 -0
  25. package/dist/template-empty/.ai/reference/open-api/19-/350/256/276/345/244/207-/346/227/240/351/232/234/347/242/215.md +43 -0
  26. package/dist/template-empty/.ai/reference/open-api/20-/350/256/276/345/244/207-/347/224/265/346/261/240.md +83 -0
  27. package/dist/template-empty/.ai/reference/open-api/21-/350/256/276/345/244/207-/346/227/245/345/216/206.md +215 -0
  28. package/dist/template-empty/.ai/reference/open-api/22-/350/256/276/345/244/207-/345/211/252/350/264/264/346/235/277.md +70 -0
  29. package/dist/template-empty/.ai/reference/open-api/23-/350/256/276/345/244/207-/350/201/224/347/263/273/344/272/272.md +270 -0
  30. package/dist/template-empty/.ai/reference/open-api/24-/350/256/276/345/244/207-/345/212/240/345/257/206.md +56 -0
  31. package/dist/template-empty/.ai/reference/open-api/25-/350/256/276/345/244/207-/347/224/265/350/257/235.md +41 -0
  32. package/dist/template-empty/.ai/reference/open-api/26-/350/256/276/345/244/207-/346/211/253/347/240/201.md +100 -0
  33. package/dist/template-empty/.ai/reference/open-api/27-/350/256/276/345/244/207-/345/261/217/345/271/225.md +173 -0
  34. package/dist/template-empty/.ai/reference/open-api/28-/350/256/276/345/244/207-/351/234/207/345/212/250.md +66 -0
  35. package/dist/template-empty/.ai/reference/open-api/README.md +27 -11
  36. package/dist/template-empty/.ai/reference/open-api.md +275 -8
  37. package/dist/template-empty/.ai/rules/dos-and-donts.md +50 -37
  38. package/dist/template-empty/AGENTS.md +54 -31
  39. package/dist/template-empty/README.md +57 -10
  40. package/dist/template-empty/package.json +2 -2
  41. package/dist/template-empty/src/app.config.ts +6 -0
  42. package/dist/template-empty/src/app.ts +0 -6
  43. package/dist/template-empty/tsconfig.json +2 -0
  44. package/dist/template-starter/.ai/examples/common-patterns.md +53 -43
  45. package/dist/template-starter/.ai/examples/component-basics.md +0 -17
  46. package/dist/template-starter/.ai/guides/component-development.md +96 -214
  47. package/dist/template-starter/.ai/guides/system-prompt.md +14 -14
  48. package/dist/template-starter/.ai/reference/framework-api-quick-ref.md +46 -85
  49. package/dist/template-starter/.ai/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +13 -13
  50. package/dist/template-starter/.ai/reference/open-api/{02-storage.md → 02-/345/255/230/345/202/250.md} +13 -21
  51. package/dist/template-starter/.ai/reference/open-api/{03-router.md → 03-/350/267/257/347/224/261.md} +9 -9
  52. package/dist/{template-empty/.ai/reference/open-api/04-ui- → template-starter/.ai/reference/open-api/04-/347/225/214/351/235/242-}/344/272/244/344/272/222.md +12 -12
  53. package/dist/template-starter/.ai/reference/open-api/05-/347/225/214/351/235/242-/350/276/223/345/205/245.md +42 -0
  54. package/dist/template-starter/.ai/reference/open-api/06-/347/275/221/347/273/234.md +148 -0
  55. package/dist/template-starter/.ai/reference/open-api/{07-media.md → 07-/345/252/222/344/275/223.md} +8 -8
  56. package/dist/template-starter/.ai/reference/open-api/{08-open- → 08-/345/274/200/346/224/276/350/203/275/345/212/233-}/344/270/232/345/212/241/350/203/275/345/212/233.md +83 -14
  57. package/dist/{template-empty/.ai/reference/open-api/09-device-bluetooth.md → template-starter/.ai/reference/open-api/09-/350/256/276/345/244/207-/350/223/235/347/211/231.md} +22 -46
  58. package/dist/{template-empty/.ai/reference/open-api/10-device-wi-fi.md → template-starter/.ai/reference/open-api/10-/350/256/276/345/244/207-wi-fi.md} +9 -9
  59. package/dist/template-starter/.ai/reference/open-api/11-/350/256/276/345/244/207-/345/212/240/351/200/237/345/272/246/350/256/241.md +104 -0
  60. package/dist/template-starter/.ai/reference/open-api/12-/350/256/276/345/244/207-ibeacon.md +148 -0
  61. package/dist/template-starter/.ai/reference/open-api/13-/350/256/276/345/244/207-/347/275/227/347/233/230.md +82 -0
  62. package/dist/template-starter/.ai/reference/open-api/14-/350/256/276/345/244/207-/350/256/276/345/244/207/346/226/271/345/220/221.md +70 -0
  63. package/dist/template-starter/.ai/reference/open-api/15-/350/256/276/345/244/207-/351/231/200/350/236/272/344/273/252.md +104 -0
  64. package/dist/template-starter/.ai/reference/open-api/16-ui-/350/276/223/345/205/245.md +65 -0
  65. package/dist/template-starter/.ai/reference/open-api/17-/350/256/276/345/244/207-/347/275/221/347/273/234.md +164 -0
  66. package/dist/template-starter/.ai/reference/open-api/18-/350/256/276/345/244/207-/347/237/255/344/277/241.md +62 -0
  67. package/dist/template-starter/.ai/reference/open-api/19-/350/256/276/345/244/207-/346/227/240/351/232/234/347/242/215.md +43 -0
  68. package/dist/template-starter/.ai/reference/open-api/20-/350/256/276/345/244/207-/347/224/265/346/261/240.md +83 -0
  69. package/dist/template-starter/.ai/reference/open-api/21-/350/256/276/345/244/207-/346/227/245/345/216/206.md +215 -0
  70. package/dist/template-starter/.ai/reference/open-api/22-/350/256/276/345/244/207-/345/211/252/350/264/264/346/235/277.md +70 -0
  71. package/dist/template-starter/.ai/reference/open-api/23-/350/256/276/345/244/207-/350/201/224/347/263/273/344/272/272.md +270 -0
  72. package/dist/template-starter/.ai/reference/open-api/24-/350/256/276/345/244/207-/345/212/240/345/257/206.md +56 -0
  73. package/dist/template-starter/.ai/reference/open-api/25-/350/256/276/345/244/207-/347/224/265/350/257/235.md +41 -0
  74. package/dist/template-starter/.ai/reference/open-api/26-/350/256/276/345/244/207-/346/211/253/347/240/201.md +100 -0
  75. package/dist/template-starter/.ai/reference/open-api/27-/350/256/276/345/244/207-/345/261/217/345/271/225.md +173 -0
  76. package/dist/template-starter/.ai/reference/open-api/28-/350/256/276/345/244/207-/351/234/207/345/212/250.md +66 -0
  77. package/dist/template-starter/.ai/reference/open-api/README.md +27 -11
  78. package/dist/template-starter/.ai/reference/open-api.md +275 -8
  79. package/dist/template-starter/.ai/rules/dos-and-donts.md +50 -37
  80. package/dist/template-starter/AGENTS.md +54 -31
  81. package/dist/template-starter/README.md +6 -1
  82. package/dist/template-starter/package.json +2 -2
  83. package/dist/template-starter/src/app.config.ts +35 -0
  84. package/dist/template-starter/src/app.ts +0 -6
  85. package/dist/template-starter/src/pages/applet/index.tsx +0 -5
  86. package/dist/template-starter/src/pages/home/index.tsx +0 -5
  87. package/dist/template-starter/src/pages/lynx/index.tsx +0 -4
  88. package/dist/template-starter/src/pages/react-lynx/index.tsx +0 -5
  89. package/dist/template-starter/src/widgets/weather-card/index.tsx +0 -4
  90. package/dist/template-starter/tsconfig.json +2 -0
  91. package/package.json +1 -1
  92. package/dist/template-empty/.ai/reference/open-api/05-ui-/350/276/223/345/205/245.md +0 -95
  93. package/dist/template-empty/.ai/reference/open-api/06-network.md +0 -298
  94. package/dist/template-empty/.ai/reference/open-api/11-device-/344/274/240/346/204/237/345/231/250.md +0 -372
  95. package/dist/template-empty/.ai/reference/open-api/12-device-/346/234/254/345/234/260/350/203/275/345/212/233.md +0 -1005
  96. package/dist/template-starter/.ai/reference/open-api/05-ui-/350/276/223/345/205/245.md +0 -95
  97. package/dist/template-starter/.ai/reference/open-api/06-network.md +0 -298
  98. package/dist/template-starter/.ai/reference/open-api/11-device-/344/274/240/346/204/237/345/231/250.md +0 -372
  99. package/dist/template-starter/.ai/reference/open-api/12-device-/346/234/254/345/234/260/350/203/275/345/212/233.md +0 -1005
@@ -1,4 +1,4 @@
1
- # Open API: Media
1
+ # Open API: 媒体
2
2
 
3
3
  图片选择、预览、保存、压缩和信息读取。
4
4
 
@@ -6,13 +6,13 @@
6
6
 
7
7
  ## 速查
8
8
 
9
- | API | 签名 | 用途 | 参数类型 | 结果类型 | 注意点 |
10
- | --- | --- | --- | --- | --- | --- |
11
- | [`saveImageToPhotosAlbum`](#saveimagetophotosalbum) | `saveImageToPhotosAlbum(params): Promise<object>` | 保存图片到系统相册 | `params: SaveImageToPhotosAlbumParams` | `Promise<object>` | - |
12
- | [`previewImage`](#previewimage) | `previewImage(params): Promise<object>` | 预览图片 | `params: PreviewImageParams` | `Promise<object>` | - |
13
- | [`getImageInfo`](#getimageinfo) | `getImageInfo(params): Promise<GetImageInfoResult>` | 获取图片信息 | `params: GetImageInfoParams` | `Promise<GetImageInfoResult>` | - |
14
- | [`chooseImage`](#chooseimage) | `chooseImage(params?): Promise<ChooseImageResult>` | 选择图片 | `params?: ChooseImageParams` | `Promise<ChooseImageResult>` | - |
15
- | [`compressImage`](#compressimage) | `compressImage(params): Promise<CompressImageResult>` | 压缩图片 | `params: CompressImageParams` | `Promise<CompressImageResult>` | - |
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [saveImageToPhotosAlbum](#saveimagetophotosalbum) | 保存图片到系统相册。 |
12
+ | [previewImage](#previewimage) | 预览图片。 |
13
+ | [getImageInfo](#getimageinfo) | 获取图片信息。 |
14
+ | [chooseImage](#chooseimage) | 选择图片。 |
15
+ | [compressImage](#compressimage) | 压缩图片。 |
16
16
 
17
17
  ## API 详情
18
18
 
@@ -1,4 +1,4 @@
1
- # Open API: Open / 业务能力
1
+ # Open API: 开放能力 / 业务能力
2
2
 
3
3
  开放业务能力、支付、隐私设置、上下文和外部应用打开。
4
4
 
@@ -6,19 +6,20 @@
6
6
 
7
7
  ## 速查
8
8
 
9
- | API | 签名 | 用途 | 参数类型 | 结果类型 | 注意点 |
10
- | --- | --- | --- | --- | --- | --- |
11
- | [`getOrderPayment`](#getorderpayment) | `getOrderPayment(params): Promise<GetOrderPaymentResult>` | 查询订单支付结果 | `params: GetOrderPaymentParams` | `Promise<GetOrderPaymentResult>` | - |
12
- | [`postLoginResult`](#postloginresult) | `postLoginResult(params): Promise<object>` | 回传 MCP 授权登录凭证 | `params: PostLoginResultRequest` | `Promise<object>` | - |
13
- | [`getPrivacySetting`](#getprivacysetting) | `getPrivacySetting(params?): Promise<PrivacySettingResult>` | 获取隐私设置状态 | `params?` | `Promise<PrivacySettingResult>` | - |
14
- | [`requestOrder`](#requestorder) | `requestOrder(params): Promise<RequestOrderResult>` | 发起订单支付流程 | `params: RequestOrderParams` | `Promise<RequestOrderResult>` | - |
15
- | [`loginWithDoubaoWidget`](#loginwithdoubaowidget) | `loginWithDoubaoWidget(params): Promise<LoginWithWidgetResult>` | 发起豆包 Widget 登录 | `params: LoginWithWidgetRequest` | `Promise<LoginWithWidgetResult>` | - |
16
- | [`sendQueryMessage`](#sendquerymessage) | `sendQueryMessage(params): void` | 以用户身份发送一条消息 | `params: SendQueryMessageParams` | `void` | 返回 void,不是 Promise |
17
- | [`updateModelContext`](#updatemodelcontext) | `updateModelContext(params?): Promise<object>` | 向 Agent 捐赠上下文 | `params?: UpdateModelContextParams` | `Promise<object>` | - |
18
- | [`setAdditionalContext`](#setadditionalcontext) | `setAdditionalContext(params): Promise<object>` | 设置全局上下文供大模型理解 | `params: SetAdditionalContextParams` | `Promise<object>` | 设置全局上下文 |
19
- | [`dispatchActionDirective`](#dispatchactiondirective) | `dispatchActionDirective(params): Promise<object>` | 描述用户行为,约束模型行为及指定执行路径 | `params: DispatchActionDirectiveParams` | `Promise<object>` | - |
20
- | [`updateWidget`](#updatewidget) | `updateWidget(params): Promise<object>` | 更新指定卡片 | `params: UpdateWidgetParams` | `Promise<object>` | - |
21
- | [`openApp`](#openapp) | `openApp(params): Promise<OpenAppResult>` | 通过 deep link 等方式打开外部应用 | `params: OpenAppRequest` | `Promise<OpenAppResult>` | - |
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [getOrderPayment](#getorderpayment) | 查询订单支付结果。 |
12
+ | [postLoginResult](#postloginresult) | 回传 MCP 授权登录凭证。 |
13
+ | [getPrivacySetting](#getprivacysetting) | 获取隐私设置状态。 |
14
+ | [requestOrder](#requestorder) | 发起订单支付流程。 |
15
+ | [loginWithDoubaoWidget](#loginwithdoubaowidget) | 发起豆包 Widget 登录。 |
16
+ | [sendQueryMessage](#sendquerymessage) | 以用户身份发送一条消息。<br><br>返回 void,不是 Promise |
17
+ | [updateModelContext](#updatemodelcontext) | 向 Agent 捐赠上下文。 |
18
+ | [setAdditionalContext](#setadditionalcontext) | 设置全局上下文供大模型理解。<br><br>设置全局上下文。 |
19
+ | [dispatchActionDirective](#dispatchactiondirective) | 描述用户行为,约束模型行为及指定执行路径。 |
20
+ | [updateWidget](#updatewidget) | 更新指定卡片。 |
21
+ | [expiredWidget](#expiredwidget) | 更新过期的 widget 为固定卡片。 |
22
+ | [openApp](#openapp) | 通过 deep link 等方式打开外部应用。 |
22
23
 
23
24
  ## API 详情
24
25
 
@@ -202,6 +203,34 @@ await sendQueryMessage({ content: '订阅消息', type: 'text' })
202
203
 
203
204
  `Promise`\<`object`\>
204
205
 
206
+ <a id="expiredwidget"></a>
207
+ ### expiredWidget()
208
+
209
+ > **expiredWidget**(`__namedParameters`): `Promise`\<`object`\>
210
+
211
+ 更新过期的 widget 为固定卡片
212
+
213
+ #### Parameters
214
+
215
+ • **\_\_namedParameters**: [`ExpiredWidgetParams`](#expiredwidgetparams)
216
+
217
+ #### Returns
218
+
219
+ `Promise`\<`object`\>
220
+
221
+ #### Description
222
+
223
+ 用于将状态已经过期的 widget 实例转换为固定的卡片
224
+
225
+ #### Example
226
+
227
+ ```ts
228
+ expiredWidget({
229
+ widgetInstanceId: 'instance_123',
230
+ schema: '${pageId}?key=value'
231
+ });
232
+ ```
233
+
205
234
  <a id="openapp"></a>
206
235
  ### openApp()
207
236
 
@@ -414,6 +443,29 @@ Widget 登录类型。
414
443
 
415
444
  会话消息关联的卡片ID
416
445
 
446
+ <a id="actiondirectivetype"></a>
447
+ ### ActionDirectiveType
448
+
449
+ #### Enumeration Members
450
+
451
+ ##### BUTTON\_CLICK
452
+
453
+ > **BUTTON\_CLICK**: `"button_click"`
454
+
455
+ 按钮点击
456
+
457
+ ##### FORM\_SUBMIT
458
+
459
+ > **FORM\_SUBMIT**: `"form_submit"`
460
+
461
+ 表单提交(复杂的信息提交场景)
462
+
463
+ ##### OPTION\_SELECT
464
+
465
+ > **OPTION\_SELECT**: `"option_select"`
466
+
467
+ 选择(下拉列表场景)
468
+
417
469
  <a id="updatewidgetparams"></a>
418
470
  ### UpdateWidgetParams
419
471
 
@@ -437,6 +489,23 @@ Widget 登录类型。
437
489
 
438
490
  需要更新的widget 实例 ID
439
491
 
492
+ <a id="expiredwidgetparams"></a>
493
+ ### ExpiredWidgetParams
494
+
495
+ #### Properties
496
+
497
+ ##### schema?
498
+
499
+ > `optional` **schema**: `string`
500
+
501
+ 点击失效卡要跳转的页面 schema,格式与 navigateTo 的 url 相同
502
+
503
+ ##### widgetInstanceId
504
+
505
+ > **widgetInstanceId**: `string`
506
+
507
+ 卡片实例 ID,在卡片环境通过getWidgetInstanceId来获取,其他环境(比如页面)需要通过传参或通信的方式传递过去
508
+
440
509
  <a id="openapprequest"></a>
441
510
  ### OpenAppRequest
442
511
 
@@ -1,4 +1,4 @@
1
- # Open API: Device / Bluetooth
1
+ # Open API: 设备 / 蓝牙
2
2
 
3
3
  蓝牙和 BLE 能力;通常先打开适配器,再扫描、连接和读写。
4
4
 
@@ -6,27 +6,27 @@
6
6
 
7
7
  ## 速查
8
8
 
9
- | API | 签名 | 用途 | 参数类型 | 结果类型 | 注意点 |
10
- | --- | --- | --- | --- | --- | --- |
11
- | [`openBluetoothAdapter`](#openbluetoothadapter) | `openBluetoothAdapter(params?): Promise<object>` | 打开蓝牙适配器 | `params?: OpenBluetoothAdapterParams` | `Promise<object>` | 蓝牙流程入口 |
12
- | [`startBluetoothDevicesDiscovery`](#startbluetoothdevicesdiscovery) | `startBluetoothDevicesDiscovery(params?): Promise<object>` | 开始搜索附近的蓝牙设备 | `params?: StartBluetoothDevicesDiscoveryParams` | `Promise<object>` | 通常先调用 openBluetoothAdapter |
13
- | [`stopBluetoothDevicesDiscovery`](#stopbluetoothdevicesdiscovery) | `stopBluetoothDevicesDiscovery(params?): Promise<object>` | 停止搜索附近的蓝牙设备 | `params?` | `Promise<object>` | - |
14
- | [`getBluetoothAdapterState`](#getbluetoothadapterstate) | `getBluetoothAdapterState(params?): Promise<GetBluetoothAdapterStateResult>` | 获取蓝牙适配器状态 | `params?` | `Promise<GetBluetoothAdapterStateResult>` | - |
15
- | [`getBluetoothDevices`](#getbluetoothdevices) | `getBluetoothDevices(params?): Promise<GetBluetoothDevicesResult>` | 获取当前蓝牙模块发现的设备列表 | `params?` | `Promise<GetBluetoothDevicesResult>` | 通常先调用 startBluetoothDevicesDiscovery |
16
- | [`getConnectedBluetoothDevices`](#getconnectedbluetoothdevices) | `getConnectedBluetoothDevices(params): Promise<GetConnectedBluetoothDevicesResult>` | 获取已连接的蓝牙设备列表 | `params: GetConnectedBluetoothDevicesParams` | `Promise<GetConnectedBluetoothDevicesResult>` | - |
17
- | [`makeBluetoothPair`](#makebluetoothpair) | `makeBluetoothPair(params): Promise<object>` | 发起蓝牙配对 | `params: MakeBluetoothPairParams` | `Promise<object>` | - |
18
- | [`isBluetoothDevicePaired`](#isbluetoothdevicepaired) | `isBluetoothDevicePaired(params): Promise<object>` | 查询蓝牙设备是否已经配对 | `params: IsBluetoothDevicePairedParams` | `Promise<object>` | - |
19
- | [`closeBluetoothAdapter`](#closebluetoothadapter) | `closeBluetoothAdapter(params?): Promise<object>` | 关闭蓝牙适配器 | `params?` | `Promise<object>` | 会关闭蓝牙模块 |
20
- | [`createBLEConnection`](#createbleconnection) | `createBLEConnection(params): Promise<object>` | 创建 BLE 连接 | `params: CreateBLEConnectionParams` | `Promise<object>` | 需要传入 deviceId |
21
- | [`closeBLEConnection`](#closebleconnection) | `closeBLEConnection(params): Promise<object>` | 关闭 BLE 连接 | `params: CloseBLEConnectionParams` | `Promise<object>` | - |
22
- | [`getBLEDeviceServices`](#getbledeviceservices) | `getBLEDeviceServices(params): Promise<GetBLEDeviceServicesResult>` | 获取 BLE 服务列表 | `params: GetBLEDeviceServicesParams` | `Promise<GetBLEDeviceServicesResult>` | 通常先调用 createBLEConnection |
23
- | [`getBLEDeviceCharacteristics`](#getbledevicecharacteristics) | `getBLEDeviceCharacteristics(params): Promise<GetBLEDeviceCharacteristicsResult>` | 获取 BLE 特征值列表 | `params: GetBLEDeviceCharacteristicsParams` | `Promise<GetBLEDeviceCharacteristicsResult>` | 通常先获取 BLE 服务列表 |
24
- | [`getBLEDeviceRSSI`](#getbledevicerssi) | `getBLEDeviceRSSI(params): Promise<GetBLEDeviceRSSIResult>` | 获取 BLE 设备 RSSI | `params: GetBLEDeviceRSSIParams` | `Promise<GetBLEDeviceRSSIResult>` | - |
25
- | [`getBLEMTU`](#getblemtu) | `getBLEMTU(params): Promise<GetBLEMTUResult>` | 获取 BLE MTU | `params: GetBLEMTUParams` | `Promise<GetBLEMTUResult>` | - |
26
- | [`notifyBLECharacteristicValueChange`](#notifyblecharacteristicvaluechange) | `notifyBLECharacteristicValueChange(params): Promise<object>` | 订阅 BLE 特征值变化 | `params: NotifyBLECharacteristicValueChangeParams` | `Promise<object>` | 订阅指定特征值变化 |
27
- | [`readBLECharacteristicValue`](#readblecharacteristicvalue) | `readBLECharacteristicValue(params): Promise<object>` | 读取 BLE 特征值 | `params: ReadBLECharacteristicValueParams` | `Promise<object>` | 需要传入 serviceId 和 characteristicId |
28
- | [`setBLEMTU`](#setblemtu) | `setBLEMTU(params): Promise<SetBLEMTUResult>` | 设置 BLE MTU | `params: SetBLEMTUParams` | `Promise<SetBLEMTUResult>` | - |
29
- | [`writeBLECharacteristicValue`](#writeblecharacteristicvalue) | `writeBLECharacteristicValue(params): Promise<object>` | 写入 BLE 特征值 | `params: WriteBLECharacteristicValueParams` | `Promise<object>` | value 需要是 ArrayBuffer。 ## Enumerations ### ActionDirectiveType |
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [openBluetoothAdapter](#openbluetoothadapter) | 打开蓝牙适配器。<br><br>蓝牙流程入口。 |
12
+ | [startBluetoothDevicesDiscovery](#startbluetoothdevicesdiscovery) | 开始搜索附近的蓝牙设备。<br><br>通常先调用 openBluetoothAdapter |
13
+ | [stopBluetoothDevicesDiscovery](#stopbluetoothdevicesdiscovery) | 停止搜索附近的蓝牙设备。 |
14
+ | [getBluetoothAdapterState](#getbluetoothadapterstate) | 获取蓝牙适配器状态。 |
15
+ | [getBluetoothDevices](#getbluetoothdevices) | 获取当前蓝牙模块发现的设备列表。<br><br>通常先调用 startBluetoothDevicesDiscovery |
16
+ | [getConnectedBluetoothDevices](#getconnectedbluetoothdevices) | 获取已连接的蓝牙设备列表。 |
17
+ | [makeBluetoothPair](#makebluetoothpair) | 发起蓝牙配对。 |
18
+ | [isBluetoothDevicePaired](#isbluetoothdevicepaired) | 查询蓝牙设备是否已经配对。 |
19
+ | [closeBluetoothAdapter](#closebluetoothadapter) | 关闭蓝牙适配器。<br><br>会关闭蓝牙模块。 |
20
+ | [createBLEConnection](#createbleconnection) | 创建 BLE 连接。<br><br>需要传入 deviceId |
21
+ | [closeBLEConnection](#closebleconnection) | 关闭 BLE 连接。 |
22
+ | [getBLEDeviceServices](#getbledeviceservices) | 获取 BLE 服务列表。<br><br>通常先调用 createBLEConnection |
23
+ | [getBLEDeviceCharacteristics](#getbledevicecharacteristics) | 获取 BLE 特征值列表。<br><br>通常先获取 BLE 服务列表。 |
24
+ | [getBLEDeviceRSSI](#getbledevicerssi) | 获取 BLE 设备 RSSI |
25
+ | [getBLEMTU](#getblemtu) | 获取 BLE MTU |
26
+ | [notifyBLECharacteristicValueChange](#notifyblecharacteristicvaluechange) | 订阅 BLE 特征值变化。<br><br>订阅指定特征值变化。 |
27
+ | [readBLECharacteristicValue](#readblecharacteristicvalue) | 读取 BLE 特征值。<br><br>需要传入 serviceId 和 characteristicId |
28
+ | [setBLEMTU](#setblemtu) | 设置 BLE MTU |
29
+ | [writeBLECharacteristicValue](#writeblecharacteristicvalue) | 写入 BLE 特征值。<br><br>value 需要是 ArrayBuffer。 |
30
30
 
31
31
  ## API 详情
32
32
 
@@ -355,30 +355,6 @@
355
355
 
356
356
  value 需要是 ArrayBuffer。
357
357
 
358
- ## Enumerations
359
-
360
- ### ActionDirectiveType
361
-
362
- #### Enumeration Members
363
-
364
- ##### BUTTON\_CLICK
365
-
366
- > **BUTTON\_CLICK**: `"button_click"`
367
-
368
- 按钮点击
369
-
370
- ##### FORM\_SUBMIT
371
-
372
- > **FORM\_SUBMIT**: `"form_submit"`
373
-
374
- 表单提交(复杂的信息提交场景)
375
-
376
- ##### OPTION\_SELECT
377
-
378
- > **OPTION\_SELECT**: `"option_select"`
379
-
380
- 选择(下拉列表场景)
381
-
382
358
  ## 相关类型
383
359
 
384
360
  <a id="openbluetoothadapterparams"></a>
@@ -1,4 +1,4 @@
1
- # Open API: Device / Wi-Fi
1
+ # Open API: 设备 / Wi-Fi
2
2
 
3
3
  Wi-Fi 模块能力;通常先 startWifi,再获取列表或连接。
4
4
 
@@ -6,14 +6,14 @@ Wi-Fi 模块能力;通常先 startWifi,再获取列表或连接。
6
6
 
7
7
  ## 速查
8
8
 
9
- | API | 签名 | 用途 | 参数类型 | 结果类型 | 注意点 |
10
- | --- | --- | --- | --- | --- | --- |
11
- | [`startWifi`](#startwifi) | `startWifi(params?): Promise<object>` | 初始化 Wi-Fi 模块 | `params?` | `Promise<object>` | Wi-Fi 流程入口 |
12
- | [`stopWifi`](#stopwifi) | `stopWifi(params?): Promise<object>` | 关闭 Wi-Fi 模块 | `params?` | `Promise<object>` | - |
13
- | [`setWifiList`](#setwifilist) | `setWifiList(params): Promise<object>` | 设置 Wi-Fi 预设列表 | `params: SetWifiListParams` | `Promise<object>` | 用于预设 Wi-Fi 列表 |
14
- | [`connectWifi`](#connectwifi) | `connectWifi(params): Promise<object>` | 连接指定 Wi-Fi | `params: ConnectWifiParams` | `Promise<object>` | 通常先调用 startWifi |
15
- | [`getConnectedWifi`](#getconnectedwifi) | `getConnectedWifi(params?): Promise<GetConnectedWifiResult>` | 获取当前已连接 Wi-Fi 信息 | `params?: GetConnectedWifiParams` | `Promise<GetConnectedWifiResult>` | - |
16
- | [`getWifiList`](#getwifilist) | `getWifiList(params?): Promise<GetWifiListResult>` | 获取 Wi-Fi 列表 | `params?` | `Promise<GetWifiListResult>` | 通常先调用 startWifi |
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [startWifi](#startwifi) | 初始化 Wi-Fi 模块。<br><br>Wi-Fi 流程入口。 |
12
+ | [stopWifi](#stopwifi) | 关闭 Wi-Fi 模块。 |
13
+ | [setWifiList](#setwifilist) | 设置 Wi-Fi 预设列表。<br><br>用于预设 Wi-Fi 列表。 |
14
+ | [connectWifi](#connectwifi) | 连接指定 Wi-Fi。<br><br>通常先调用 startWifi |
15
+ | [getConnectedWifi](#getconnectedwifi) | 获取当前已连接 Wi-Fi 信息。 |
16
+ | [getWifiList](#getwifilist) | 获取 Wi-Fi 列表。<br><br>通常先调用 startWifi |
17
17
 
18
18
  ## API 详情
19
19
 
@@ -0,0 +1,104 @@
1
+ # Open API: 设备 / 加速度计
2
+
3
+ 加速度计监听能力。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [startAccelerometer](#startaccelerometer) | 开始监听加速度。<br><br>需配对调用 stopAccelerometer。 |
12
+ | [stopAccelerometer](#stopaccelerometer) | 停止监听加速度。 |
13
+ | [onAccelerometerChange](#onaccelerometerchange) | 监听加速度数据变化事件。<br><br>返回取消监听函数。 |
14
+
15
+ ## API 详情
16
+
17
+ <a id="startaccelerometer"></a>
18
+ ### startAccelerometer()
19
+
20
+ > **startAccelerometer**(`params`?): `Promise`\<`object`\>
21
+
22
+ 开始监听加速度。
23
+
24
+ #### Parameters
25
+
26
+ • **params?**: [`StartAccelerometerParams`](#startaccelerometerparams)
27
+
28
+ #### Returns
29
+
30
+ `Promise`\<`object`\>
31
+
32
+ #### Remarks
33
+
34
+ 需配对调用 stopAccelerometer。
35
+
36
+ <a id="stopaccelerometer"></a>
37
+ ### stopAccelerometer()
38
+
39
+ > **stopAccelerometer**(`params`?): `Promise`\<`object`\>
40
+
41
+ 停止监听加速度。
42
+
43
+ #### Parameters
44
+
45
+ • **params?**
46
+
47
+ #### Returns
48
+
49
+ `Promise`\<`object`\>
50
+
51
+ <a id="onaccelerometerchange"></a>
52
+ ### onAccelerometerChange()
53
+
54
+ > **onAccelerometerChange**(`handler`): () => `void`
55
+
56
+ 监听加速度数据变化事件。
57
+
58
+ #### Parameters
59
+
60
+ • **handler**
61
+
62
+ #### Returns
63
+
64
+ `Function`
65
+
66
+ 返回取消当前监听函数的函数。
67
+
68
+ ##### Returns
69
+
70
+ `void`
71
+
72
+ #### Example
73
+
74
+ ```ts
75
+ import { onAccelerometerChange } from '@doubao-apps/framework/api';
76
+
77
+ const off = onAccelerometerChange(({ x, y, z, timestamp }) => {
78
+ console.log(x, y, z, timestamp);
79
+ });
80
+
81
+ off();
82
+ ```
83
+
84
+ ## 相关类型
85
+
86
+ <a id="startaccelerometerparams"></a>
87
+ ### StartAccelerometerParams
88
+
89
+ 开始监听加速度的请求参数。
90
+
91
+ #### Properties
92
+
93
+ ##### interval?
94
+
95
+ > `optional` **interval**: [`SensorInterval`](#sensorinterval)
96
+
97
+ 监听频率。
98
+
99
+ <a id="sensorinterval"></a>
100
+ ### SensorInterval
101
+
102
+ > **SensorInterval**: `"game"` \| `"ui"` \| `"normal"`
103
+
104
+ 传感器监听频率。
@@ -0,0 +1,148 @@
1
+ # Open API: 设备 / iBeacon
2
+
3
+ iBeacon 搜索和结果读取能力。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [startBeaconDiscovery](#startbeacondiscovery) | 开始搜索附近的 iBeacon。<br><br>需配对调用 stopBeaconDiscovery。 |
12
+ | [stopBeaconDiscovery](#stopbeacondiscovery) | 停止搜索附近的 iBeacon。 |
13
+ | [getBeacons](#getbeacons) | 获取已搜索到的 iBeacon 列表。 |
14
+
15
+ ## API 详情
16
+
17
+ <a id="startbeacondiscovery"></a>
18
+ ### startBeaconDiscovery()
19
+
20
+ > **startBeaconDiscovery**(`params`): `Promise`\<`object`\>
21
+
22
+ 开始搜索附近的 iBeacon。
23
+
24
+ #### Parameters
25
+
26
+ • **params**: [`StartBeaconDiscoveryParams`](#startbeacondiscoveryparams)
27
+
28
+ #### Returns
29
+
30
+ `Promise`\<`object`\>
31
+
32
+ #### Remarks
33
+
34
+ 需配对调用 stopBeaconDiscovery。
35
+
36
+ <a id="stopbeacondiscovery"></a>
37
+ ### stopBeaconDiscovery()
38
+
39
+ > **stopBeaconDiscovery**(`params`?): `Promise`\<`object`\>
40
+
41
+ 停止搜索附近的 iBeacon。
42
+
43
+ #### Parameters
44
+
45
+ • **params?**
46
+
47
+ #### Returns
48
+
49
+ `Promise`\<`object`\>
50
+
51
+ <a id="getbeacons"></a>
52
+ ### getBeacons()
53
+
54
+ > **getBeacons**(`params`?): `Promise`\<[`GetBeaconsResult`](#getbeaconsresult)\>
55
+
56
+ 获取已搜索到的 iBeacon 列表。
57
+
58
+ #### Parameters
59
+
60
+ • **params?**
61
+
62
+ #### Returns
63
+
64
+ `Promise`\<[`GetBeaconsResult`](#getbeaconsresult)\>
65
+
66
+ ## 相关类型
67
+
68
+ <a id="startbeacondiscoveryparams"></a>
69
+ ### StartBeaconDiscoveryParams
70
+
71
+ 开始搜索 iBeacon 的请求参数。
72
+
73
+ #### Properties
74
+
75
+ ##### ignoreBluetoothAvailable?
76
+
77
+ > `optional` **ignoreBluetoothAvailable**: `boolean`
78
+
79
+ iOS 下是否忽略蓝牙可用性校验。
80
+
81
+ ##### uuids
82
+
83
+ > **uuids**: `string`[]
84
+
85
+ 要搜索的 iBeacon UUID 列表。
86
+
87
+ <a id="getbeaconsresult"></a>
88
+ ### GetBeaconsResult
89
+
90
+ 获取 iBeacon 列表的返回结果。
91
+
92
+ #### Properties
93
+
94
+ ##### beacons
95
+
96
+ > **beacons**: [`BeaconInfo`](#beaconinfo)[]
97
+
98
+ 当前搜到的 iBeacon 列表。
99
+
100
+ <a id="beaconinfo"></a>
101
+ ### BeaconInfo
102
+
103
+ iBeacon 设备信息。
104
+
105
+ #### Properties
106
+
107
+ ##### accuracy
108
+
109
+ > **accuracy**: `number`
110
+
111
+ 距离,单位米。
112
+
113
+ ##### major
114
+
115
+ > **major**: `string`
116
+
117
+ 主 ID。
118
+
119
+ ##### minor
120
+
121
+ > **minor**: `string`
122
+
123
+ 次 ID。
124
+
125
+ ##### proximity
126
+
127
+ > **proximity**: [`BeaconProximity`](#beaconproximity)
128
+
129
+ 距离等级。
130
+
131
+ ##### rssi
132
+
133
+ > **rssi**: `number`
134
+
135
+ RSSI 信号强度,单位 dBm。
136
+
137
+ ##### uuid
138
+
139
+ > **uuid**: `string`
140
+
141
+ Beacon UUID。
142
+
143
+ <a id="beaconproximity"></a>
144
+ ### BeaconProximity
145
+
146
+ > **BeaconProximity**: `0` \| `1` \| `2` \| `3`
147
+
148
+ iBeacon 距离等级。
@@ -0,0 +1,82 @@
1
+ # Open API: 设备 / 罗盘
2
+
3
+ 罗盘监听能力。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [startCompass](#startcompass) | 开始监听罗盘。<br><br>需配对调用 stopCompass。 |
12
+ | [stopCompass](#stopcompass) | 停止监听罗盘。 |
13
+ | [onCompassChange](#oncompasschange) | 监听罗盘数据变化事件。<br><br>返回取消监听函数。 |
14
+
15
+ ## API 详情
16
+
17
+ <a id="startcompass"></a>
18
+ ### startCompass()
19
+
20
+ > **startCompass**(`params`?): `Promise`\<`object`\>
21
+
22
+ 开始监听罗盘。
23
+
24
+ #### Parameters
25
+
26
+ • **params?**
27
+
28
+ #### Returns
29
+
30
+ `Promise`\<`object`\>
31
+
32
+ #### Remarks
33
+
34
+ 需配对调用 stopCompass。
35
+
36
+ <a id="stopcompass"></a>
37
+ ### stopCompass()
38
+
39
+ > **stopCompass**(`params`?): `Promise`\<`object`\>
40
+
41
+ 停止监听罗盘。
42
+
43
+ #### Parameters
44
+
45
+ • **params?**
46
+
47
+ #### Returns
48
+
49
+ `Promise`\<`object`\>
50
+
51
+ <a id="oncompasschange"></a>
52
+ ### onCompassChange()
53
+
54
+ > **onCompassChange**(`handler`): () => `void`
55
+
56
+ 监听罗盘数据变化事件。
57
+
58
+ #### Parameters
59
+
60
+ • **handler**
61
+
62
+ #### Returns
63
+
64
+ `Function`
65
+
66
+ 返回取消当前监听函数的函数。
67
+
68
+ ##### Returns
69
+
70
+ `void`
71
+
72
+ #### Example
73
+
74
+ ```ts
75
+ import { onCompassChange } from '@doubao-apps/framework/api';
76
+
77
+ const off = onCompassChange(({ direction }) => {
78
+ console.log(direction);
79
+ });
80
+
81
+ off();
82
+ ```
@@ -0,0 +1,70 @@
1
+ # Open API: 设备 / 设备方向
2
+
3
+ 设备方向监听能力。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 说明 |
10
+ | --- | --- |
11
+ | [startDeviceMotionListening](#startdevicemotionlistening) | 开始监听设备方向变化。<br><br>需配对调用 stopDeviceMotionListening。 |
12
+ | [stopDeviceMotionListening](#stopdevicemotionlistening) | 停止监听设备方向变化。 |
13
+
14
+ ## API 详情
15
+
16
+ <a id="startdevicemotionlistening"></a>
17
+ ### startDeviceMotionListening()
18
+
19
+ > **startDeviceMotionListening**(`params`?): `Promise`\<`object`\>
20
+
21
+ 开始监听设备方向变化。
22
+
23
+ #### Parameters
24
+
25
+ • **params?**: [`StartDeviceMotionListeningParams`](#startdevicemotionlisteningparams)
26
+
27
+ #### Returns
28
+
29
+ `Promise`\<`object`\>
30
+
31
+ #### Remarks
32
+
33
+ 需配对调用 stopDeviceMotionListening。
34
+
35
+ <a id="stopdevicemotionlistening"></a>
36
+ ### stopDeviceMotionListening()
37
+
38
+ > **stopDeviceMotionListening**(`params`?): `Promise`\<`object`\>
39
+
40
+ 停止监听设备方向变化。
41
+
42
+ #### Parameters
43
+
44
+ • **params?**
45
+
46
+ #### Returns
47
+
48
+ `Promise`\<`object`\>
49
+
50
+ ## 相关类型
51
+
52
+ <a id="startdevicemotionlisteningparams"></a>
53
+ ### StartDeviceMotionListeningParams
54
+
55
+ 开始监听设备方向变化的请求参数。
56
+
57
+ #### Properties
58
+
59
+ ##### interval?
60
+
61
+ > `optional` **interval**: [`SensorInterval`](#sensorinterval)
62
+
63
+ 监听频率。
64
+
65
+ <a id="sensorinterval"></a>
66
+ ### SensorInterval
67
+
68
+ > **SensorInterval**: `"game"` \| `"ui"` \| `"normal"`
69
+
70
+ 传感器监听频率。