@doubao-dev/plugin-app-dev 0.0.44-rc.1 → 1.0.0-canary-0592ecb56-20261119113423

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.
@@ -8,6 +8,9 @@
8
8
 
9
9
  | API | 说明 |
10
10
  | --- | --- |
11
+ | [getContainerInfoSync](#getcontainerinfosync) | 同步获取当前渲染容器的尺寸信息。 同时支持 Page(含全屏、半屏)和 Widget(卡片)容器。<br><br>同步 API。 |
12
+ | [getContainerInfo](#getcontainerinfo) | 异步获取当前渲染容器的尺寸信息。 同时支持 Page(含全屏、半屏)和 Widget(卡片)容器。 |
13
+ | [onContainerResize](#oncontainerresize) | 监听当前渲染容器尺寸变化。 使用与 getContainerInfoSync 相同的数据源,仅在容器宽度或高度变化时触发,注册时不触发回调。<br><br>返回取消监听函数。 |
11
14
  | [getWindowInfoSync](#getwindowinfosync) | 获取窗口信息。<br><br>同步 API。 |
12
15
  | [getSystemSetting](#getsystemsetting) | 获取设备设置。 |
13
16
  | [getAppAuthorizeSetting](#getappauthorizesetting) | 获取豆包客户端的系统授权设置。 调用只读取当前系统授权状态,不会申请权限或触发系统授权弹窗。原有状态字段固定返回 authorized、denied 或 not determined,精细授权字段用于区分部分、只读、只写、前后台等能力。 |
@@ -21,6 +24,288 @@
21
24
 
22
25
  ## API 详情
23
26
 
27
+ <a id="getcontainerinfosync"></a>
28
+ ### getContainerInfoSync()
29
+
30
+ ---
31
+ internal: true
32
+ ---
33
+
34
+ # getContainerInfoSync
35
+
36
+ 同步获取当前渲染容器的尺寸信息。
37
+
38
+ 同时支持 Page(含全屏、半屏)和 Widget(卡片)容器。
39
+
40
+ ## 支持版本
41
+
42
+ 前端库版本不低于 `0.11.0`。
43
+
44
+ ## 支持平台
45
+
46
+ <table>
47
+ <thead>
48
+ <tr><th>平台</th><th>支持情况</th></tr>
49
+ </thead>
50
+ <tbody>
51
+ <tr><td>Android</td><td>支持</td></tr>
52
+ <tr><td>iOS</td><td>支持</td></tr>
53
+ <tr><td>PC</td><td>不支持</td></tr>
54
+ <tr><td>HarmonyOS</td><td>不支持</td></tr>
55
+ </tbody>
56
+ </table>
57
+
58
+ ## 支持场景
59
+
60
+ <table>
61
+ <thead>
62
+ <tr><th>场景</th><th>支持情况</th></tr>
63
+ </thead>
64
+ <tbody>
65
+ <tr><td>页面</td><td>支持</td></tr>
66
+ <tr><td>卡片</td><td>支持</td></tr>
67
+ </tbody>
68
+ </table>
69
+
70
+ ## 使用说明
71
+
72
+ - Widget 首屏渲染前测量完成时 height 可能为 0,需结合 onContainerResize 或 useContainerInfo 感知变化。
73
+
74
+ ## 调用方式
75
+
76
+ ### 同步 API
77
+
78
+ ```typescript
79
+ getContainerInfoSync(_params?: object): GetContainerInfoResult
80
+ ```
81
+
82
+ ## 入参
83
+
84
+ 无。
85
+
86
+ ## 调用示例
87
+
88
+ ```typescript
89
+ import { getContainerInfoSync } from '@doubao-dev/framework/api';
90
+
91
+ const info = getContainerInfoSync();
92
+ console.log(info.containerType, info.width, info.height);
93
+ ```
94
+
95
+ ## 返回值
96
+
97
+ <table>
98
+ <thead>
99
+ <tr><th>名称</th><th>类型</th><th>必返</th><th>说明</th></tr>
100
+ </thead>
101
+ <tbody>
102
+ <tr><td><code>containerType</code></td><td><code>ContainerType</code></td><td>是</td><td>当前容器类型</td></tr>
103
+ <tr><td><code>height</code></td><td><code>number</code></td><td>是</td><td>当前容器高度,单位为逻辑像素;Widget 首屏渲染前未测量完成时可能为 0</td></tr>
104
+ <tr><td><code>pixelRatio</code></td><td><code>number</code></td><td>是</td><td>设备像素比,物理像素 = 逻辑像素 × pixelRatio</td></tr>
105
+ <tr><td><code>width</code></td><td><code>number</code></td><td>是</td><td>当前容器可用宽度,单位为逻辑像素;Page 为窗口或半屏宽度,Widget 为卡片容器宽度</td></tr>
106
+ </tbody>
107
+ </table>
108
+
109
+ ### 返回示例
110
+
111
+ ```json
112
+ {
113
+ "containerType": "widget",
114
+ "width": 328,
115
+ "height": 200,
116
+ "pixelRatio": 3
117
+ }
118
+ ```
119
+
120
+ <a id="getcontainerinfo"></a>
121
+ ### getContainerInfo()
122
+
123
+ ---
124
+ internal: true
125
+ ---
126
+
127
+ # getContainerInfo
128
+
129
+ 异步获取当前渲染容器的尺寸信息。
130
+
131
+ 同时支持 Page(含全屏、半屏)和 Widget(卡片)容器。
132
+
133
+ ## 支持版本
134
+
135
+ 前端库版本不低于 `0.11.0`。
136
+
137
+ ## 支持平台
138
+
139
+ <table>
140
+ <thead>
141
+ <tr><th>平台</th><th>支持情况</th></tr>
142
+ </thead>
143
+ <tbody>
144
+ <tr><td>Android</td><td>支持</td></tr>
145
+ <tr><td>iOS</td><td>支持</td></tr>
146
+ <tr><td>PC</td><td>不支持</td></tr>
147
+ <tr><td>HarmonyOS</td><td>不支持</td></tr>
148
+ </tbody>
149
+ </table>
150
+
151
+ ## 支持场景
152
+
153
+ <table>
154
+ <thead>
155
+ <tr><th>场景</th><th>支持情况</th></tr>
156
+ </thead>
157
+ <tbody>
158
+ <tr><td>页面</td><td>支持</td></tr>
159
+ <tr><td>卡片</td><td>支持</td></tr>
160
+ </tbody>
161
+ </table>
162
+
163
+ ## 使用说明
164
+
165
+ - 该接口封装 getContainerInfoSync 的结果;无需 Promise 形式时可直接使用 getContainerInfoSync。
166
+
167
+ ## 调用方式
168
+
169
+ ### 异步 API
170
+
171
+ ```typescript
172
+ getContainerInfo(_params?: object): Promise<GetContainerInfoResult>
173
+ ```
174
+
175
+ ## 入参
176
+
177
+ 无。
178
+
179
+ ## 调用示例
180
+
181
+ ```typescript
182
+ import { getContainerInfo } from '@doubao-dev/framework/api';
183
+
184
+ const info = await getContainerInfo();
185
+ console.log(info.containerType, info.width, info.height);
186
+ ```
187
+
188
+ ## 成功返回
189
+
190
+ <table>
191
+ <thead>
192
+ <tr><th>名称</th><th>类型</th><th>必返</th><th>说明</th></tr>
193
+ </thead>
194
+ <tbody>
195
+ <tr><td><code>containerType</code></td><td><code>ContainerType</code></td><td>是</td><td>当前容器类型</td></tr>
196
+ <tr><td><code>height</code></td><td><code>number</code></td><td>是</td><td>当前容器高度,单位为逻辑像素;Widget 首屏渲染前未测量完成时可能为 0</td></tr>
197
+ <tr><td><code>pixelRatio</code></td><td><code>number</code></td><td>是</td><td>设备像素比,物理像素 = 逻辑像素 × pixelRatio</td></tr>
198
+ <tr><td><code>width</code></td><td><code>number</code></td><td>是</td><td>当前容器可用宽度,单位为逻辑像素;Page 为窗口或半屏宽度,Widget 为卡片容器宽度</td></tr>
199
+ </tbody>
200
+ </table>
201
+
202
+ ### 返回示例
203
+
204
+ ```json
205
+ {
206
+ "containerType": "widget",
207
+ "width": 328,
208
+ "height": 200,
209
+ "pixelRatio": 3
210
+ }
211
+ ```
212
+
213
+ <a id="oncontainerresize"></a>
214
+ ### onContainerResize()
215
+
216
+ ---
217
+ internal: true
218
+ ---
219
+
220
+ # onContainerResize
221
+
222
+ 监听当前渲染容器尺寸变化。
223
+
224
+ 使用与 getContainerInfoSync 相同的数据源,仅在容器宽度或高度变化时触发,注册时不触发回调。
225
+
226
+ ## 支持版本
227
+
228
+ 前端库版本不低于 `0.11.0`。
229
+
230
+ ## 支持平台
231
+
232
+ <table>
233
+ <thead>
234
+ <tr><th>平台</th><th>支持情况</th></tr>
235
+ </thead>
236
+ <tbody>
237
+ <tr><td>Android</td><td>支持</td></tr>
238
+ <tr><td>iOS</td><td>支持</td></tr>
239
+ <tr><td>PC</td><td>不支持</td></tr>
240
+ <tr><td>HarmonyOS</td><td>不支持</td></tr>
241
+ </tbody>
242
+ </table>
243
+
244
+ ## 支持场景
245
+
246
+ <table>
247
+ <thead>
248
+ <tr><th>场景</th><th>支持情况</th></tr>
249
+ </thead>
250
+ <tbody>
251
+ <tr><td>页面</td><td>支持</td></tr>
252
+ <tr><td>卡片</td><td>支持</td></tr>
253
+ </tbody>
254
+ </table>
255
+
256
+ ## 使用说明
257
+
258
+ - 注册时不会立即触发回调;若需在首屏异步测量场景同步初始尺寸,请配合 getContainerInfoSync 或直接改用 useContainerInfo;不再需要监听时调用返回的函数取消监听。
259
+
260
+ ## 调用方式
261
+
262
+ ### 事件监听 API
263
+
264
+ ```typescript
265
+ onContainerResize(callback: ContainerResizeListener): () => void
266
+ ```
267
+
268
+ ## 入参
269
+
270
+ 无。
271
+
272
+ ## 调用示例
273
+
274
+ ```typescript
275
+ import { onContainerResize } from '@doubao-dev/framework/api';
276
+
277
+ const offContainerResize = onContainerResize(({ width, height }) => {
278
+ console.log(width, height);
279
+ });
280
+
281
+ offContainerResize();
282
+ ```
283
+
284
+ ## 回调参数
285
+
286
+ <table>
287
+ <thead>
288
+ <tr><th>名称</th><th>类型</th><th>必返</th><th>说明</th></tr>
289
+ </thead>
290
+ <tbody>
291
+ <tr><td><code>event.height</code></td><td><code>number</code></td><td>是</td><td>变化后的容器高度,单位为逻辑像素。</td></tr>
292
+ <tr><td><code>event.width</code></td><td><code>number</code></td><td>是</td><td>变化后的容器宽度,单位为逻辑像素。</td></tr>
293
+ </tbody>
294
+ </table>
295
+
296
+ ## 返回值
297
+
298
+ 取消当前监听的函数。
299
+
300
+ ### 回调示例
301
+
302
+ ```json
303
+ {
304
+ "width": 328,
305
+ "height": 200
306
+ }
307
+ ```
308
+
24
309
  <a id="getwindowinfosync"></a>
25
310
  ### getWindowInfoSync()
26
311
 
@@ -1194,6 +1479,44 @@ offWindowResize();
1194
1479
 
1195
1480
  ## 相关类型
1196
1481
 
1482
+ <a id="containertype"></a>
1483
+ ### ContainerType
1484
+
1485
+ 容器类型。
1486
+
1487
+ #### Type
1488
+
1489
+ `'page' | 'widget'`
1490
+
1491
+ <a id="getcontainerinforesult"></a>
1492
+ ### GetContainerInfoResult
1493
+
1494
+ #### Properties
1495
+
1496
+ • **containerType**: `ContainerType` - 当前容器类型
1497
+ • **width**: `number` - 当前容器可用宽度,单位为逻辑像素;Page 为窗口或半屏宽度,Widget 为卡片容器宽度
1498
+ • **height**: `number` - 当前容器高度,单位为逻辑像素;Widget 首屏渲染前未测量完成时可能为 0
1499
+ • **pixelRatio**: `number` - 设备像素比,物理像素 = 逻辑像素 × pixelRatio
1500
+
1501
+ <a id="containerresizelistener"></a>
1502
+ ### ContainerResizeListener
1503
+
1504
+ 容器尺寸变化监听函数。
1505
+
1506
+ #### Type
1507
+
1508
+ `(event: ContainerResizeEvent) => void`
1509
+
1510
+ <a id="containerresizeevent"></a>
1511
+ ### ContainerResizeEvent
1512
+
1513
+ 容器尺寸变化事件。
1514
+
1515
+ #### Properties
1516
+
1517
+ • **width**: `number` - 变化后的容器宽度,单位为逻辑像素
1518
+ • **height**: `number` - 变化后的容器高度,单位为逻辑像素
1519
+
1197
1520
  <a id="windowsafearea"></a>
1198
1521
  ### WindowSafeArea
1199
1522
 
@@ -7,7 +7,7 @@
7
7
  | 分组 | 说明 | API 数量 | 详细文档 |
8
8
  | --- | --- | ---: | --- |
9
9
  | 基础 | 账号、授权、豆包客户端信息、窗口信息和能力可用性。 | 10 | [查看](./01-基础.md) |
10
- | 系统 | 豆包客户端信息、窗口信息和系统设置。 | 10 | [查看](./02-系统.md) |
10
+ | 系统 | 豆包客户端信息、窗口信息和系统设置。 | 13 | [查看](./02-系统.md) |
11
11
  | 自定义通信 | 在应用插件的页面或卡片实例之间发送和接收自定义事件。 | 1 | [查看](./03-自定义通信.md) |
12
12
  | 定位 | 获取设备当前的地理位置信息。 | 5 | [查看](./04-定位.md) |
13
13
  | 存储 | 本地缓存;带 Sync 后缀的是同步 API。 | 10 | [查看](./05-存储.md) |
@@ -2,7 +2,7 @@
2
2
 
3
3
  > 这是豆包应用插件运行时 API,也称 Open API。默认从 `@doubao-dev/framework/api` 导入;本文件根据 `packages/open-api/src` 的导出结构自动生成,按模块列出 API 名称和说明。
4
4
 
5
- 覆盖 162 个函数。详细参数、返回值、示例和相关类型请查看 [豆包应用插件的端能力 API 分组目录](groups.md),精确字段也可按参数/结果类型名查看 IDE 类型提示或 `@doubao-dev/framework/api` 类型定义。
5
+ 覆盖 165 个函数。详细参数、返回值、示例和相关类型请查看 [豆包应用插件的端能力 API 分组目录](groups.md),精确字段也可按参数/结果类型名查看 IDE 类型提示或 `@doubao-dev/framework/api` 类型定义。
6
6
 
7
7
  ## 使用方式
8
8
 
@@ -55,6 +55,9 @@ import { showToast, request, getStorage } from '@doubao-dev/framework/api';
55
55
 
56
56
  | API | 说明 |
57
57
  | --- | --- |
58
+ | [getContainerInfoSync](02-系统.md#getcontainerinfosync) | 同步获取当前渲染容器的尺寸信息。 同时支持 Page(含全屏、半屏)和 Widget(卡片)容器。<br><br>同步 API。 |
59
+ | [getContainerInfo](02-系统.md#getcontainerinfo) | 异步获取当前渲染容器的尺寸信息。 同时支持 Page(含全屏、半屏)和 Widget(卡片)容器。 |
60
+ | [onContainerResize](02-系统.md#oncontainerresize) | 监听当前渲染容器尺寸变化。 使用与 getContainerInfoSync 相同的数据源,仅在容器宽度或高度变化时触发,注册时不触发回调。<br><br>返回取消监听函数。 |
58
61
  | [getWindowInfoSync](02-系统.md#getwindowinfosync) | 获取窗口信息。<br><br>同步 API。 |
59
62
  | [getSystemSetting](02-系统.md#getsystemsetting) | 获取设备设置。 |
60
63
  | [getAppAuthorizeSetting](02-系统.md#getappauthorizesetting) | 获取豆包客户端的系统授权设置。 调用只读取当前系统授权状态,不会申请权限或触发系统授权弹窗。原有状态字段固定返回 authorized、denied 或 not determined,精细授权字段用于区分部分、只读、只写、前后台等能力。 |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doubao-dev/plugin-app-dev",
3
- "version": "0.0.44-rc.1",
3
+ "version": "1.0.0-canary-0592ecb56-20261119113423",
4
4
  "description": "App development tools for Doubao Plugin CLI",
5
5
  "type": "module",
6
6
  "exports": {
@@ -27,7 +27,7 @@
27
27
  "zod": "4.2.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@byted-doubao-apps/plugin-app-dev": "0.0.44-rc.1",
30
+ "@byted-doubao-apps/plugin-app-dev": "1.0.0-canary-0592ecb56-20261119113423",
31
31
  "@rslib/core": "1.0.0-beta.1",
32
32
  "@types/node": "22.20.4",
33
33
  "rimraf": "3.0.2",