@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,417 @@
1
+ # Open API: Storage
2
+
3
+ 本地缓存;带 Sync 后缀的是同步 API。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 签名 | 用途 | 参数类型 | 结果类型 | 注意点 |
10
+ | --- | --- | --- | --- | --- | --- |
11
+ | [`setStorage`](#setstorage) | `setStorage<TData>(params): Promise<object>` | 将数据写入本地缓存 | `params: SetStorageParams<TData>` | `Promise<object>` | data 会 JSON 序列化 |
12
+ | [`setStorageSync`](#setstoragesync) | `setStorageSync<TData>(params): object` | 将数据写入本地缓存 | `params: SetStorageParams<TData>` | `object` | data 会 JSON 序列化;同步 API |
13
+ | [`getStorage`](#getstorage) | `getStorage<TData>(params): Promise<GetStorageResult<TData>>` | 从本地缓存读取数据 | `params: GetStorageParams` | `Promise<GetStorageResult<TData>>` | data 会 JSON 反序列化 |
14
+ | [`getStorageSync`](#getstoragesync) | `getStorageSync<TData>(params): GetStorageResult<TData>` | 从本地缓存同步读取数据 | `params: GetStorageParams` | `GetStorageResult<TData>` | data 会 JSON 反序列化;同步 API |
15
+ | [`removeStorage`](#removestorage) | `removeStorage(params): Promise<object>` | 删除本地缓存中指定 key 的数据 | `params: RemoveStorageParams` | `Promise<object>` | - |
16
+ | [`removeStorageSync`](#removestoragesync) | `removeStorageSync(params?): object` | 删除本地缓存中指定 key 的数据 | `params?: RemoveStorageParams` | `object` | 同步 API |
17
+ | [`clearStorage`](#clearstorage) | `clearStorage(params?): Promise<object>` | 清空本地缓存 | `params?: object` | `Promise<object>` | - |
18
+ | [`clearStorageSync`](#clearstoragesync) | `clearStorageSync(params?): object` | 清空本地缓存 | `params?: object` | `object` | 同步 API |
19
+ | [`getStorageInfo`](#getstorageinfo) | `getStorageInfo(params?): Promise<GetStorageInfoResult>` | 获取本地缓存信息 | `params?` | `Promise<GetStorageInfoResult>` | - |
20
+ | [`getStorageInfoSync`](#getstorageinfosync) | `getStorageInfoSync(params?): GetStorageInfoResult` | 同步获取本地缓存信息 | `params?` | `GetStorageInfoResult` | 同步 API |
21
+
22
+ ## API 详情
23
+
24
+ <a id="setstorage"></a>
25
+ ### setStorage()
26
+
27
+ > **setStorage**\<`TData`\>(`params`): `Promise`\<`object`\>
28
+
29
+ 将数据写入本地缓存。
30
+
31
+ #### Type parameters
32
+
33
+ • **TData** = `unknown`
34
+
35
+ #### Parameters
36
+
37
+ • **params**: [`SetStorageParams`](#setstorageparamstdata)\<`TData`\>
38
+
39
+ 存储参数,字段见 [SetStorageParams](#setstorageparamstdata)。
40
+
41
+ #### Returns
42
+
43
+ `Promise`\<`object`\>
44
+
45
+ 返回一个 Promise,写入完成后 resolve。
46
+
47
+ #### Remarks
48
+
49
+ data 会 JSON 序列化。
50
+
51
+ #### Example
52
+
53
+ ```typescript
54
+ import { setStorage } from '@doubao-apps/framework/api';
55
+
56
+ await setStorage({
57
+ key: 'profile',
58
+ data: { name: 'Tom', age: 18 },
59
+ });
60
+ ```
61
+
62
+ <a id="setstoragesync"></a>
63
+ ### setStorageSync()
64
+
65
+ > **setStorageSync**\<`TData`\>(`params`): `object`
66
+
67
+ 将数据写入本地缓存。
68
+
69
+ #### Type parameters
70
+
71
+ • **TData** = `unknown`
72
+
73
+ #### Parameters
74
+
75
+ • **params**: [`SetStorageParams`](#setstorageparamstdata)\<`TData`\>
76
+
77
+ 存储参数,字段见 [SetStorageParams](#setstorageparamstdata)。
78
+
79
+ #### Returns
80
+
81
+ `object`
82
+
83
+ 同步写入完成后返回。
84
+
85
+ #### Remarks
86
+
87
+ data 会 JSON 序列化。
88
+
89
+ #### Example
90
+
91
+ ```typescript
92
+ import { setStorageSync } from '@doubao-apps/framework/api';
93
+
94
+ setStorageSync({
95
+ key: 'profile',
96
+ data: { name: 'Tom', age: 18 },
97
+ });
98
+ ```
99
+
100
+ <a id="getstorage"></a>
101
+ ### getStorage()
102
+
103
+ > **getStorage**\<`TData`\>(`params`): `Promise`\<[`GetStorageResult`](#getstorageresulttdata)\<`TData`\>\>
104
+
105
+ 从本地缓存读取数据。
106
+
107
+ #### Type parameters
108
+
109
+ • **TData** = `unknown`
110
+
111
+ #### Parameters
112
+
113
+ • **params**: [`GetStorageParams`](#getstorageparams)
114
+
115
+ 查询参数,字段见 [GetStorageParams](#getstorageparams)。
116
+
117
+ #### Returns
118
+
119
+ `Promise`\<[`GetStorageResult`](#getstorageresulttdata)\<`TData`\>\>
120
+
121
+ 返回一个 Promise,解析为 [GetStorageResult](#getstorageresulttdata)。
122
+
123
+ #### Remarks
124
+
125
+ data 会 JSON 反序列化。
126
+
127
+ #### Example
128
+
129
+ ```typescript
130
+ import { getStorage } from '@doubao-apps/framework/api';
131
+
132
+ const result = await getStorage<{ name: string; age: number }>({
133
+ key: 'profile',
134
+ });
135
+
136
+ console.log(result.data.name, result.data.age);
137
+ ```
138
+
139
+ <a id="getstoragesync"></a>
140
+ ### getStorageSync()
141
+
142
+ > **getStorageSync**\<`TData`\>(`params`): [`GetStorageResult`](#getstorageresulttdata)\<`TData`\>
143
+
144
+ 从本地缓存同步读取数据。
145
+
146
+ #### Type parameters
147
+
148
+ • **TData** = `unknown`
149
+
150
+ #### Parameters
151
+
152
+ • **params**: [`GetStorageParams`](#getstorageparams)
153
+
154
+ 查询参数,字段见 [GetStorageParams](#getstorageparams)。
155
+
156
+ #### Returns
157
+
158
+ [`GetStorageResult`](#getstorageresulttdata)\<`TData`\>
159
+
160
+ 返回 [GetStorageResult](#getstorageresulttdata)。
161
+
162
+ #### Remarks
163
+
164
+ data 会 JSON 反序列化。
165
+
166
+ #### Example
167
+
168
+ ```typescript
169
+ import { getStorageSync } from '@doubao-apps/framework/api';
170
+
171
+ const result = getStorageSync<{ name: string; age: number }>({
172
+ key: 'profile',
173
+ });
174
+
175
+ console.log(result.data.name, result.data.age);
176
+ ```
177
+
178
+ <a id="removestorage"></a>
179
+ ### removeStorage()
180
+
181
+ > **removeStorage**(`params`): `Promise`\<`object`\>
182
+
183
+ 删除本地缓存中指定 key 的数据。
184
+
185
+ #### Parameters
186
+
187
+ • **params**: [`RemoveStorageParams`](#removestorageparams)
188
+
189
+ 删除参数,字段见 [RemoveStorageParams](#removestorageparams)。
190
+
191
+ #### Returns
192
+
193
+ `Promise`\<`object`\>
194
+
195
+ 返回一个 Promise,删除完成后 resolve。
196
+
197
+ #### Example
198
+
199
+ ```typescript
200
+ import { removeStorage } from '@doubao-apps/framework/api';
201
+
202
+ await removeStorage({ key: 'profile' });
203
+ ```
204
+
205
+ <a id="removestoragesync"></a>
206
+ ### removeStorageSync()
207
+
208
+ > **removeStorageSync**(`params`?): `object`
209
+
210
+ 删除本地缓存中指定 key 的数据。
211
+
212
+ #### Parameters
213
+
214
+ • **params?**: [`RemoveStorageParams`](#removestorageparams)
215
+
216
+ 删除参数,字段见 [RemoveStorageParams](#removestorageparams)。
217
+
218
+ #### Returns
219
+
220
+ `object`
221
+
222
+ 同步删除完成后返回。
223
+
224
+ #### Example
225
+
226
+ ```typescript
227
+ import { removeStorageSync } from '@doubao-apps/framework/api';
228
+
229
+ removeStorageSync({ key: 'profile' });
230
+ ```
231
+
232
+ <a id="clearstorage"></a>
233
+ ### clearStorage()
234
+
235
+ > **clearStorage**(`params`?): `Promise`\<`object`\>
236
+
237
+ 清空本地缓存。
238
+
239
+ #### Parameters
240
+
241
+ • **params?**: `object`
242
+
243
+ #### Returns
244
+
245
+ `Promise`\<`object`\>
246
+
247
+ 返回一个 Promise,清空完成后 resolve。
248
+
249
+ #### Example
250
+
251
+ ```typescript
252
+ import { clearStorage } from '@doubao-apps/framework/api';
253
+
254
+ await clearStorage();
255
+ ```
256
+
257
+ <a id="clearstoragesync"></a>
258
+ ### clearStorageSync()
259
+
260
+ > **clearStorageSync**(`params`?): `object`
261
+
262
+ 清空本地缓存。
263
+
264
+ #### Parameters
265
+
266
+ • **params?**: `object`
267
+
268
+ #### Returns
269
+
270
+ `object`
271
+
272
+ 同步清空完成后返回。
273
+
274
+ #### Example
275
+
276
+ ```typescript
277
+ import { clearStorageSync } from '@doubao-apps/framework/api';
278
+
279
+ clearStorageSync();
280
+ ```
281
+
282
+ <a id="getstorageinfo"></a>
283
+ ### getStorageInfo()
284
+
285
+ > **getStorageInfo**(`params`?): `Promise`\<[`GetStorageInfoResult`](#getstorageinforesult)\>
286
+
287
+ 获取本地缓存信息。
288
+
289
+ #### Parameters
290
+
291
+ • **params?**
292
+
293
+ #### Returns
294
+
295
+ `Promise`\<[`GetStorageInfoResult`](#getstorageinforesult)\>
296
+
297
+ 返回一个 Promise,解析为 [GetStorageInfoResult](#getstorageinforesult)。
298
+
299
+ #### Example
300
+
301
+ ```typescript
302
+ import { getStorageInfo } from '@doubao-apps/framework/api';
303
+
304
+ const result = await getStorageInfo();
305
+
306
+ console.log(result.keys, result.currentSize, result.limitSize);
307
+ ```
308
+
309
+ <a id="getstorageinfosync"></a>
310
+ ### getStorageInfoSync()
311
+
312
+ > **getStorageInfoSync**(`params`?): [`GetStorageInfoResult`](#getstorageinforesult)
313
+
314
+ 同步获取本地缓存信息。
315
+
316
+ #### Parameters
317
+
318
+ • **params?**
319
+
320
+ #### Returns
321
+
322
+ [`GetStorageInfoResult`](#getstorageinforesult)
323
+
324
+ 返回 [GetStorageInfoResult](#getstorageinforesult)。
325
+
326
+ #### Example
327
+
328
+ ```typescript
329
+ import { getStorageInfoSync } from '@doubao-apps/framework/api';
330
+
331
+ const result = getStorageInfoSync();
332
+
333
+ console.log(result.keys, result.currentSize, result.limitSize);
334
+ ```
335
+
336
+ ## 相关类型
337
+
338
+ <a id="setstorageparamstdata"></a>
339
+ ### SetStorageParams<TData>
340
+
341
+ #### Type parameters
342
+
343
+ • **TData** = `unknown`
344
+
345
+ #### Properties
346
+
347
+ ##### data
348
+
349
+ > **data**: `TData`
350
+
351
+ 待存储的数据
352
+
353
+ ##### key
354
+
355
+ > **key**: `string`
356
+
357
+ 本地缓存键名
358
+
359
+ <a id="getstorageparams"></a>
360
+ ### GetStorageParams
361
+
362
+ #### Properties
363
+
364
+ ##### key
365
+
366
+ > **key**: `string`
367
+
368
+ 本地缓存键名
369
+
370
+ <a id="getstorageresulttdata"></a>
371
+ ### GetStorageResult<TData>
372
+
373
+ #### Type parameters
374
+
375
+ • **TData** = `unknown`
376
+
377
+ #### Properties
378
+
379
+ ##### data
380
+
381
+ > **data**: `TData`
382
+
383
+ key 对应的数据
384
+
385
+ <a id="removestorageparams"></a>
386
+ ### RemoveStorageParams
387
+
388
+ #### Properties
389
+
390
+ ##### key
391
+
392
+ > **key**: `string`
393
+
394
+ 本地缓存键名
395
+
396
+ <a id="getstorageinforesult"></a>
397
+ ### GetStorageInfoResult
398
+
399
+ #### Properties
400
+
401
+ ##### currentSize
402
+
403
+ > **currentSize**: `number`
404
+
405
+ 当前占用的空间大小,单位 KB
406
+
407
+ ##### keys
408
+
409
+ > **keys**: `string`[]
410
+
411
+ 当前 storage 中所有的 key
412
+
413
+ ##### limitSize
414
+
415
+ > **limitSize**: `number`
416
+
417
+ 限制的空间大小,单位 KB
@@ -0,0 +1,165 @@
1
+ # Open API: Router
2
+
3
+ 应用内页面跳转和关闭。
4
+
5
+ [返回目录](./README.md) | [返回速查](../open-api.md)
6
+
7
+ ## 速查
8
+
9
+ | API | 签名 | 用途 | 参数类型 | 结果类型 | 注意点 |
10
+ | --- | --- | --- | --- | --- | --- |
11
+ | [`close`](#close) | `close(params?): Promise<object>` | 关闭栈顶页面 | `params?: CloseParams` | `Promise<object>` | 已废弃,使用 navigateBack |
12
+ | [`navigateTo`](#navigateto) | `navigateTo(params): Promise<object>` | 保留当前页面,跳转到应用内的某个页面 | `params: NavigateToParams` | `Promise<object>` | - |
13
+ | [`redirectTo`](#redirectto) | `redirectTo(params): Promise<object>` | 关闭当前页面,跳转到应用内的某个页面 | `params: NavigateToParams` | `Promise<object>` | - |
14
+ | [`reLaunch`](#relaunch) | `reLaunch(params): Promise<object>` | 关闭所有页面并跳转到应用内页面 | `params: NavigateToParams` | `Promise<object>` | - |
15
+ | [`navigateBack`](#navigateback) | `navigateBack(params?): Promise<object>` | 关闭当前页面,返回上一页面或多级页面 | `params?: NavigateBackParams` | `Promise<object>` | - |
16
+ | [`exitApp`](#exitapp) | `exitApp(): Promise<object>` | 退出当前所有页面 | `-` | `Promise<object>` | 会退出当前所有页面 |
17
+
18
+ ## API 详情
19
+
20
+ <a id="close"></a>
21
+ ### close()
22
+
23
+ > **close**(`params`?): `Promise`\<`object`\>
24
+
25
+ 关闭栈顶页面。
26
+
27
+ #### Parameters
28
+
29
+ • **params?**: [`CloseParams`](#closeparams)
30
+
31
+ #### Returns
32
+
33
+ `Promise`\<`object`\>
34
+
35
+ 返回一个 Promise,在关闭操作成功发起时解析
36
+
37
+ #### Deprecated
38
+
39
+ 使用 [navigateBack](#navigateback)
40
+
41
+ #### Example
42
+
43
+ ```typescript
44
+ import { close } from '@doubao-apps/framework/api';
45
+
46
+ async function closeTopPage() {
47
+ try {
48
+ await close();
49
+ } catch (e) {
50
+ console.error('关闭页面失败', e);
51
+ }
52
+ }
53
+
54
+ closePage();
55
+ ```
56
+
57
+ <a id="navigateto"></a>
58
+ ### navigateTo()
59
+
60
+ > **navigateTo**(`params`): `Promise`\<`object`\>
61
+
62
+ 保留当前页面,跳转到应用内的某个页面。
63
+
64
+ #### Parameters
65
+
66
+ • **params**: [`NavigateToParams`](#navigatetoparams)
67
+
68
+ #### Returns
69
+
70
+ `Promise`\<`object`\>
71
+
72
+ <a id="redirectto"></a>
73
+ ### redirectTo()
74
+
75
+ > **redirectTo**(`params`): `Promise`\<`object`\>
76
+
77
+ 关闭当前页面,跳转到应用内的某个页面。
78
+
79
+ #### Parameters
80
+
81
+ • **params**: [`NavigateToParams`](#navigatetoparams)
82
+
83
+ #### Returns
84
+
85
+ `Promise`\<`object`\>
86
+
87
+ <a id="relaunch"></a>
88
+ ### reLaunch()
89
+
90
+ > **reLaunch**(`params`): `Promise`\<`object`\>
91
+
92
+ 关闭所有页面并跳转到应用内页面。
93
+
94
+ #### Parameters
95
+
96
+ • **params**: [`NavigateToParams`](#navigatetoparams)
97
+
98
+ #### Returns
99
+
100
+ `Promise`\<`object`\>
101
+
102
+ <a id="navigateback"></a>
103
+ ### navigateBack()
104
+
105
+ > **navigateBack**(`params`?): `Promise`\<`object`\>
106
+
107
+ 关闭当前页面,返回上一页面或多级页面。
108
+
109
+ #### Parameters
110
+
111
+ • **params?**: [`NavigateBackParams`](#navigatebackparams)
112
+
113
+ #### Returns
114
+
115
+ `Promise`\<`object`\>
116
+
117
+ <a id="exitapp"></a>
118
+ ### exitApp()
119
+
120
+ > **exitApp**(): `Promise`\<`object`\>
121
+
122
+ 退出当前所有页面。
123
+
124
+ #### Returns
125
+
126
+ `Promise`\<`object`\>
127
+
128
+ #### Remarks
129
+
130
+ 会退出当前所有页面。
131
+
132
+ ## 相关类型
133
+
134
+ <a id="closeparams"></a>
135
+ ### CloseParams
136
+
137
+ #### Properties
138
+
139
+ ##### containerID?
140
+
141
+ > `optional` **containerID**: `string`
142
+
143
+ 指定一个要关闭的页面
144
+
145
+ <a id="navigatetoparams"></a>
146
+ ### NavigateToParams
147
+
148
+ #### Properties
149
+
150
+ ##### url
151
+
152
+ > **url**: `string`
153
+
154
+ 跳转的页面的路径,如 'path?key=value&key2=value2'
155
+
156
+ <a id="navigatebackparams"></a>
157
+ ### NavigateBackParams
158
+
159
+ #### Properties
160
+
161
+ ##### delta?
162
+
163
+ > `optional` **delta**: `number`
164
+
165
+ 返回的页面数,如果 delta 大于现有页面数,则返回到页面栈中只剩一个页面为止。