@doubao-apps/create 0.0.25 → 0.0.26

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 (33) hide show
  1. 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 +699 -0
  2. package/dist/template-empty/.ai/reference/open-api/02-storage.md +417 -0
  3. package/dist/template-empty/.ai/reference/open-api/03-router.md +165 -0
  4. package/dist/template-empty/.ai/reference/open-api/04-ui-/344/272/244/344/272/222.md +432 -0
  5. package/dist/template-empty/.ai/reference/open-api/05-ui-/350/276/223/345/205/245.md +95 -0
  6. package/dist/template-empty/.ai/reference/open-api/06-network.md +298 -0
  7. package/dist/template-empty/.ai/reference/open-api/07-media.md +346 -0
  8. package/dist/template-empty/.ai/reference/open-api/08-open-/344/270/232/345/212/241/350/203/275/345/212/233.md +477 -0
  9. package/dist/template-empty/.ai/reference/open-api/09-device-bluetooth.md +985 -0
  10. package/dist/template-empty/.ai/reference/open-api/10-device-wi-fi.md +277 -0
  11. package/dist/template-empty/.ai/reference/open-api/11-device-/344/274/240/346/204/237/345/231/250.md +372 -0
  12. package/dist/template-empty/.ai/reference/open-api/12-device-/346/234/254/345/234/260/350/203/275/345/212/233.md +1005 -0
  13. package/dist/template-empty/.ai/reference/open-api/README.md +20 -0
  14. package/dist/template-empty/.ai/reference/open-api.md +1532 -307
  15. package/dist/template-empty/AGENTS.md +2 -2
  16. package/dist/template-empty/package.json +2 -2
  17. 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 +699 -0
  18. package/dist/template-starter/.ai/reference/open-api/02-storage.md +417 -0
  19. package/dist/template-starter/.ai/reference/open-api/03-router.md +165 -0
  20. package/dist/template-starter/.ai/reference/open-api/04-ui-/344/272/244/344/272/222.md +432 -0
  21. package/dist/template-starter/.ai/reference/open-api/05-ui-/350/276/223/345/205/245.md +95 -0
  22. package/dist/template-starter/.ai/reference/open-api/06-network.md +298 -0
  23. package/dist/template-starter/.ai/reference/open-api/07-media.md +346 -0
  24. package/dist/template-starter/.ai/reference/open-api/08-open-/344/270/232/345/212/241/350/203/275/345/212/233.md +477 -0
  25. package/dist/template-starter/.ai/reference/open-api/09-device-bluetooth.md +985 -0
  26. package/dist/template-starter/.ai/reference/open-api/10-device-wi-fi.md +277 -0
  27. package/dist/template-starter/.ai/reference/open-api/11-device-/344/274/240/346/204/237/345/231/250.md +372 -0
  28. package/dist/template-starter/.ai/reference/open-api/12-device-/346/234/254/345/234/260/350/203/275/345/212/233.md +1005 -0
  29. package/dist/template-starter/.ai/reference/open-api/README.md +20 -0
  30. package/dist/template-starter/.ai/reference/open-api.md +1532 -307
  31. package/dist/template-starter/AGENTS.md +2 -2
  32. package/dist/template-starter/package.json +2 -2
  33. package/package.json +1 -1
@@ -0,0 +1,432 @@
1
+ # Open API: UI / 交互
2
+
3
+ Toast、Loading、Modal、ActionSheet 和返回前提醒。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 签名 | 用途 | 参数类型 | 结果类型 | 注意点 |
10
+ | --- | --- | --- | --- | --- | --- |
11
+ | [`showModal`](#showmodal) | `showModal(params): Promise<ShowModalResult>` | 显示模态对话框 | `params: ShowModalParams` | `Promise<ShowModalResult>` | - |
12
+ | [`showLoading`](#showloading) | `showLoading(params?): Promise<object>` | 显示 loading 提示框 | `params?: ShowLoadingParams` | `Promise<object>` | 需调用 hideLoading 关闭 |
13
+ | [`hideToast`](#hidetoast) | `hideToast(params?): Promise<object>` | 隐藏当前 Toast | `params?: HideInteractionParams` | `Promise<object>` | - |
14
+ | [`hideLoading`](#hideloading) | `hideLoading(params?): Promise<object>` | 隐藏当前 loading | `params?: HideInteractionParams` | `Promise<object>` | - |
15
+ | [`showActionSheet`](#showactionsheet) | `showActionSheet(params): Promise<ShowActionSheetResult>` | 显示操作菜单 | `params: ShowActionSheetParams` | `Promise<ShowActionSheetResult>` | - |
16
+ | [`getMenuButtonBoundingClientRect`](#getmenubuttonboundingclientrect) | `getMenuButtonBoundingClientRect(params?): MenuButtonBoundingClientRect` | 获取菜单按钮的布局位置信息 | `params?` | `MenuButtonBoundingClientRect` | - |
17
+ | [`enableAlertBeforeUnload`](#enablealertbeforeunload) | `enableAlertBeforeUnload(params): Promise<object>` | 开启页面返回前提醒 | `params: EnableAlertBeforeUnloadParams` | `Promise<object>` | 配合 disableAlertBeforeUnload 使用 |
18
+ | [`disableAlertBeforeUnload`](#disablealertbeforeunload) | `disableAlertBeforeUnload(params?): Promise<object>` | 关闭页面返回前提醒 | `params?: Record<string, never>` | `Promise<object>` | - |
19
+ | [`showToast`](#showtoast) | `showToast(params): Promise<object>` | 显示 Toast 提示 | `params: ShowToastParams` | `Promise<object>` | duration 和 icon 可控制提示表现 |
20
+
21
+ ## API 详情
22
+
23
+ <a id="showmodal"></a>
24
+ ### showModal()
25
+
26
+ > **showModal**(`params`): `Promise`\<[`ShowModalResult`](#showmodalresult)\>
27
+
28
+ 显示模态对话框。
29
+
30
+ #### Parameters
31
+
32
+ • **params**: [`ShowModalParams`](#showmodalparams)
33
+
34
+ #### Returns
35
+
36
+ `Promise`\<[`ShowModalResult`](#showmodalresult)\>
37
+
38
+ #### Example
39
+
40
+ ```ts
41
+ import { showModal } from '@doubao-apps/framework/api';
42
+
43
+ const result = await showModal({
44
+ title: '提示',
45
+ content: '确认删除这条记录吗?',
46
+ confirmText: '删除',
47
+ cancelText: '取消'
48
+ });
49
+
50
+ if (result.action === 'confirm') {
51
+ console.log('用户确认删除');
52
+ }
53
+ ```
54
+
55
+ <a id="showloading"></a>
56
+ ### showLoading()
57
+
58
+ > **showLoading**(`params`?): `Promise`\<`object`\>
59
+
60
+ 显示 loading 提示框。
61
+
62
+ #### Parameters
63
+
64
+ • **params?**: [`ShowLoadingParams`](#showloadingparams)
65
+
66
+ #### Returns
67
+
68
+ `Promise`\<`object`\>
69
+
70
+ #### Remarks
71
+
72
+ 需调用 hideLoading 关闭。
73
+
74
+ <a id="hidetoast"></a>
75
+ ### hideToast()
76
+
77
+ > **hideToast**(`params`?): `Promise`\<`object`\>
78
+
79
+ 隐藏当前 Toast。
80
+
81
+ #### Parameters
82
+
83
+ • **params?**: [`HideInteractionParams`](#hideinteractionparams)
84
+
85
+ #### Returns
86
+
87
+ `Promise`\<`object`\>
88
+
89
+ <a id="hideloading"></a>
90
+ ### hideLoading()
91
+
92
+ > **hideLoading**(`params`?): `Promise`\<`object`\>
93
+
94
+ 隐藏当前 loading。
95
+
96
+ #### Parameters
97
+
98
+ • **params?**: [`HideInteractionParams`](#hideinteractionparams)
99
+
100
+ #### Returns
101
+
102
+ `Promise`\<`object`\>
103
+
104
+ <a id="showactionsheet"></a>
105
+ ### showActionSheet()
106
+
107
+ > **showActionSheet**(`params`): `Promise`\<[`ShowActionSheetResult`](#showactionsheetresult)\>
108
+
109
+ 显示操作菜单。
110
+
111
+ #### Parameters
112
+
113
+ • **params**: [`ShowActionSheetParams`](#showactionsheetparams)
114
+
115
+ #### Returns
116
+
117
+ `Promise`\<[`ShowActionSheetResult`](#showactionsheetresult)\>
118
+
119
+ #### Example
120
+
121
+ ```ts
122
+ import { showActionSheet } from '@doubao-apps/framework/api';
123
+
124
+ const result = await showActionSheet({
125
+ itemList: ['编辑', '删除']
126
+ });
127
+
128
+ console.log(result.tapIndex);
129
+ ```
130
+
131
+ <a id="getmenubuttonboundingclientrect"></a>
132
+ ### getMenuButtonBoundingClientRect()
133
+
134
+ > **getMenuButtonBoundingClientRect**(`params`?): [`MenuButtonBoundingClientRect`](#menubuttonboundingclientrect)
135
+
136
+ 获取菜单按钮的布局位置信息。
137
+
138
+ #### Parameters
139
+
140
+ • **params?**
141
+
142
+ #### Returns
143
+
144
+ [`MenuButtonBoundingClientRect`](#menubuttonboundingclientrect)
145
+
146
+ 返回菜单按钮相对屏幕左上角的坐标和尺寸,字段见 [MenuButtonBoundingClientRect](#menubuttonboundingclientrect)。
147
+
148
+ #### Example
149
+
150
+ ```ts
151
+ import { getMenuButtonBoundingClientRect } from '@doubao-apps/framework/api';
152
+
153
+ const rect = getMenuButtonBoundingClientRect();
154
+
155
+ console.log(rect.width, rect.height);
156
+ console.log(rect.top, rect.right, rect.bottom, rect.left);
157
+ ```
158
+
159
+ <a id="enablealertbeforeunload"></a>
160
+ ### enableAlertBeforeUnload()
161
+
162
+ > **enableAlertBeforeUnload**(`params`): `Promise`\<`object`\>
163
+
164
+ 开启页面返回前提醒。
165
+ 当用户在小程序非最底层页面点击左上角返回按钮、左上角首页按钮或 Android 系统 back 键时,弹起询问弹窗
166
+
167
+ 返回询问对话框只会对调用的当前页面生效,通过手势滑动返回时不会弹起询问对话框
168
+
169
+ #### Parameters
170
+
171
+ • **params**: [`EnableAlertBeforeUnloadParams`](#enablealertbeforeunloadparams)
172
+
173
+ #### Returns
174
+
175
+ `Promise`\<`object`\>
176
+
177
+ #### Remarks
178
+
179
+ 配合 disableAlertBeforeUnload 使用。
180
+
181
+ <a id="disablealertbeforeunload"></a>
182
+ ### disableAlertBeforeUnload()
183
+
184
+ > **disableAlertBeforeUnload**(`params`?): `Promise`\<`object`\>
185
+
186
+ 关闭页面返回前提醒。
187
+
188
+ #### Parameters
189
+
190
+ • **params?**: `Record`\<`string`, `never`\>
191
+
192
+ #### Returns
193
+
194
+ `Promise`\<`object`\>
195
+
196
+ <a id="showtoast"></a>
197
+ ### showToast()
198
+
199
+ > **showToast**(`params`): `Promise`\<`object`\>
200
+
201
+ 显示 Toast 提示。
202
+
203
+ 参数 `options` 包含以下字段:
204
+ - `message`: 提示的内容。
205
+ - `type`: Toast 的类型,可选值为 'success' 或 'error'。
206
+ - `duration`: 提示的延迟时间,单位毫秒,默认为 2000。
207
+ - `icon`: 图标,可选值为 'success', 'error', 'warn'。
208
+ - `customIcon`: 自定义图标的 URL 或 base64 字符串。
209
+
210
+ #### Parameters
211
+
212
+ • **params**: [`ShowToastParams`](#showtoastparams)
213
+
214
+ #### Returns
215
+
216
+ `Promise`\<`object`\>
217
+
218
+ 返回一个 Promise,在 Toast 显示结束时 resolve。
219
+
220
+ #### Remarks
221
+
222
+ duration 和 icon 可控制提示表现。
223
+
224
+ #### Example
225
+
226
+ ```typescript
227
+ import { showToast } from '@doubao-apps/framework';
228
+
229
+ // 显示一个成功的 Toast
230
+ showToast({
231
+ message: '操作成功',
232
+ type: 'success',
233
+ icon: 'success',
234
+ duration: 1500
235
+ }).then(() => {
236
+ console.log('Toast 显示完毕');
237
+ });
238
+
239
+ // 显示一个错误的 Toast
240
+ showToast({
241
+ message: '网络错误',
242
+ type: 'error',
243
+ icon: 'error'
244
+ });
245
+ ```
246
+
247
+ ## 相关类型
248
+
249
+ <a id="showmodalparams"></a>
250
+ ### ShowModalParams
251
+
252
+ 显示模态对话框的参数。
253
+
254
+ #### Properties
255
+
256
+ ##### cancelText?
257
+
258
+ > `optional` **cancelText**: `string`
259
+
260
+ 取消按钮的文字。
261
+
262
+ ##### confirmText?
263
+
264
+ > `optional` **confirmText**: `string`
265
+
266
+ 确认按钮的文字。
267
+
268
+ ##### content
269
+
270
+ > **content**: `string`
271
+
272
+ 模态对话框的内容。
273
+
274
+ ##### showCancel?
275
+
276
+ > `optional` **showCancel**: `boolean`
277
+
278
+ 是否显示取消按钮,默认 `true`。
279
+
280
+ ##### tapMaskToDismiss?
281
+
282
+ > `optional` **tapMaskToDismiss**: `boolean`
283
+
284
+ 是否允许点击蒙层关闭对话框,默认 `false`。
285
+
286
+ ##### title?
287
+
288
+ > `optional` **title**: `string`
289
+
290
+ 模态对话框的标题。
291
+
292
+ <a id="showmodalresult"></a>
293
+ ### ShowModalResult
294
+
295
+ 显示模态对话框的返回结果。
296
+
297
+ #### Properties
298
+
299
+ ##### action
300
+
301
+ > **action**: `"confirm"` \| `"cancel"` \| `"mask"`
302
+
303
+ 用户点击的动作。
304
+
305
+ <a id="showloadingparams"></a>
306
+ ### ShowLoadingParams
307
+
308
+ 显示 loading 提示框的参数。
309
+
310
+ <a id="hideinteractionparams"></a>
311
+ ### HideInteractionParams
312
+
313
+ 隐藏交互提示框的公共参数。
314
+
315
+ <a id="showactionsheetparams"></a>
316
+ ### ShowActionSheetParams
317
+
318
+ 显示操作菜单的参数。
319
+
320
+ #### Properties
321
+
322
+ ##### itemColor?
323
+
324
+ > `optional` **itemColor**: `string`
325
+
326
+ 按钮文字颜色。
327
+
328
+ ##### itemList
329
+
330
+ > **itemList**: `string`[]
331
+
332
+ 按钮文字数组。
333
+
334
+ ##### title?
335
+
336
+ > `optional` **title**: `string`
337
+
338
+ 标题
339
+
340
+ <a id="showactionsheetresult"></a>
341
+ ### ShowActionSheetResult
342
+
343
+ 显示操作菜单的返回结果。
344
+
345
+ #### Properties
346
+
347
+ ##### tapIndex
348
+
349
+ > **tapIndex**: `number`
350
+
351
+ 用户点击的按钮序号,从 0 开始。
352
+
353
+ <a id="menubuttonboundingclientrect"></a>
354
+ ### MenuButtonBoundingClientRect
355
+
356
+ 菜单按钮的布局位置信息。
357
+
358
+ #### Properties
359
+
360
+ ##### bottom
361
+
362
+ > **bottom**: `number`
363
+
364
+ 下边界坐标,单位 px。
365
+
366
+ ##### height
367
+
368
+ > **height**: `number`
369
+
370
+ 高度,单位 px。
371
+
372
+ ##### left
373
+
374
+ > **left**: `number`
375
+
376
+ 左边界坐标,单位 px。
377
+
378
+ ##### right
379
+
380
+ > **right**: `number`
381
+
382
+ 右边界坐标,单位 px。
383
+
384
+ ##### top
385
+
386
+ > **top**: `number`
387
+
388
+ 上边界坐标,单位 px。
389
+
390
+ ##### width
391
+
392
+ > **width**: `number`
393
+
394
+ 宽度,单位 px。
395
+
396
+ <a id="enablealertbeforeunloadparams"></a>
397
+ ### EnableAlertBeforeUnloadParams
398
+
399
+ 开启返回前提醒的参数。
400
+
401
+ #### Properties
402
+
403
+ ##### message
404
+
405
+ > **message**: `string`
406
+
407
+ 返回前确认弹窗的文案。
408
+
409
+ <a id="showtoastparams"></a>
410
+ ### ShowToastParams
411
+
412
+ #### Properties
413
+
414
+ ##### customIcon?
415
+
416
+ > `optional` **customIcon**: `string`
417
+
418
+ ##### duration?
419
+
420
+ > `optional` **duration**: `number`
421
+
422
+ ##### icon?
423
+
424
+ > `optional` **icon**: `"success"` \| `"error"` \| `"warn"`
425
+
426
+ ##### message
427
+
428
+ > **message**: `string`
429
+
430
+ ##### type?
431
+
432
+ > `optional` **type**: `"default"` \| `"success"` \| `"error"` \| `"warning"`
@@ -0,0 +1,95 @@
1
+ # Open API: UI / 输入
2
+
3
+ 键盘和输入框选区能力。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 签名 | 用途 | 参数类型 | 结果类型 | 注意点 |
10
+ | --- | --- | --- | --- | --- | --- |
11
+ | [`onKeyboardHeightChange`](#onkeyboardheightchange) | `onKeyboardHeightChange(handler): () => void` | 监听键盘高度变化事件 | `handler` | `() => void` | 返回取消监听函数 |
12
+ | [`hideKeyboard`](#hidekeyboard) | `hideKeyboard(params?): Promise<object>` | 收起键盘 | `params?` | `Promise<object>` | - |
13
+ | [`getSelectedTextRange`](#getselectedtextrange) | `getSelectedTextRange(params?): Promise<GetSelectedTextRangeResult>` | 获取当前输入框的选区范围 | `params?` | `Promise<GetSelectedTextRangeResult>` | - |
14
+
15
+ ## API 详情
16
+
17
+ <a id="onkeyboardheightchange"></a>
18
+ ### onKeyboardHeightChange()
19
+
20
+ > **onKeyboardHeightChange**(`handler`): () => `void`
21
+
22
+ 监听键盘高度变化事件。
23
+
24
+ #### Parameters
25
+
26
+ • **handler**
27
+
28
+ #### Returns
29
+
30
+ `Function`
31
+
32
+ ##### Returns
33
+
34
+ `void`
35
+
36
+ #### Example
37
+
38
+ ```typescript
39
+ import { onKeyboardHeightChange } from '@doubao-apps/framework/api';
40
+
41
+ const unsubscribe = onKeyboardHeightChange(({ height }) => {
42
+ console.log('Keyboard height change event:', { height });
43
+ });
44
+ ```
45
+
46
+ <a id="hidekeyboard"></a>
47
+ ### hideKeyboard()
48
+
49
+ > **hideKeyboard**(`params`?): `Promise`\<`object`\>
50
+
51
+ 收起键盘。
52
+
53
+ #### Parameters
54
+
55
+ • **params?**
56
+
57
+ #### Returns
58
+
59
+ `Promise`\<`object`\>
60
+
61
+ <a id="getselectedtextrange"></a>
62
+ ### getSelectedTextRange()
63
+
64
+ > **getSelectedTextRange**(`params`?): `Promise`\<[`GetSelectedTextRangeResult`](#getselectedtextrangeresult)\>
65
+
66
+ 获取当前输入框的选区范围。
67
+
68
+ #### Parameters
69
+
70
+ • **params?**
71
+
72
+ #### Returns
73
+
74
+ `Promise`\<[`GetSelectedTextRangeResult`](#getselectedtextrangeresult)\>
75
+
76
+ ## 相关类型
77
+
78
+ <a id="getselectedtextrangeresult"></a>
79
+ ### GetSelectedTextRangeResult
80
+
81
+ 获取输入框选区范围的返回结果。
82
+
83
+ #### Properties
84
+
85
+ ##### end
86
+
87
+ > **end**: `number`
88
+
89
+ 选区结束位置。
90
+
91
+ ##### start
92
+
93
+ > **start**: `number`
94
+
95
+ 选区起始位置。