@doubao-dev/framework 0.0.42 → 0.1.1
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 +738 -319
- package/dist/components.d.ts +75 -17
- package/dist/config.d.ts +12 -1
- package/dist/index.d.ts +458 -2
- package/jsx-runtime.d.ts +1 -0
- package/package.json +3 -2
- package/types.d.ts +3 -0
package/dist/components.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ import { ListSnapEvent } from '@lynx-js/types';
|
|
|
29
29
|
import { ListSnapInfo } from '@lynx-js/types';
|
|
30
30
|
import type { LoadEvent } from '@lynx-js/types';
|
|
31
31
|
import type { NodesRef } from '@lynx-js/types';
|
|
32
|
+
import type { OpenAppResult } from '@byted-doubao-apps/bridge-api';
|
|
32
33
|
import type { ReactElement } from '@byted-lynx/react';
|
|
33
34
|
import type { ReactElement as ReactElement_2 } from 'react';
|
|
34
35
|
import type { ReactNode } from 'react';
|
|
@@ -88,6 +89,10 @@ export declare interface Arc {
|
|
|
88
89
|
zIndex?: number;
|
|
89
90
|
}
|
|
90
91
|
|
|
92
|
+
export declare type AudioProps = Omit<VideoEngineProps, 'as' | 'style' | 'poster' | 'objectfit' | 'fullscreenMode' | 'resolution' | 'onFirstFrame' | 'scene' | 'onAppear' | 'onDisappear'>;
|
|
93
|
+
|
|
94
|
+
export declare type AudioRef = VideoEngineRef;
|
|
95
|
+
|
|
91
96
|
declare interface BounceConfig {
|
|
92
97
|
/**
|
|
93
98
|
* 是否启用回弹效果,当 loop 为 true 时忽略此设置
|
|
@@ -206,7 +211,11 @@ export declare interface ButtonProps {
|
|
|
206
211
|
/**
|
|
207
212
|
* 开放能力类型
|
|
208
213
|
*/
|
|
209
|
-
openType?: 'getPhoneNumber' | 'agreePrivacyAuthorization' | 'agreePrivacyAuthorization|getPhoneNumber' | 'openSetting';
|
|
214
|
+
openType?: 'getPhoneNumber' | 'agreePrivacyAuthorization' | 'agreePrivacyAuthorization|getPhoneNumber' | 'openSetting' | 'launchApp';
|
|
215
|
+
/**
|
|
216
|
+
* 跳转外部应用的 deeplink URL,只在 openType="launchApp" 时有效。
|
|
217
|
+
*/
|
|
218
|
+
launchAppUrl?: string;
|
|
210
219
|
/**
|
|
211
220
|
* 点击回调函数
|
|
212
221
|
* @eventProperty
|
|
@@ -247,6 +256,16 @@ export declare interface ButtonProps {
|
|
|
247
256
|
* @eventProperty
|
|
248
257
|
*/
|
|
249
258
|
onOpenSetting?: (event: OpenSettingEvent) => void;
|
|
259
|
+
/**
|
|
260
|
+
* 跳转外部应用回调,只在 openType="launchApp" 时有效。
|
|
261
|
+
*
|
|
262
|
+
* 仅在跳转成功时返回跳转结果。
|
|
263
|
+
*/
|
|
264
|
+
onLaunchApp?: (result: LaunchAppResult) => void;
|
|
265
|
+
/**
|
|
266
|
+
* 跳转外部应用失败回调,只在 openType="launchApp" 时有效。
|
|
267
|
+
*/
|
|
268
|
+
onLaunchAppError?: (error: unknown) => void;
|
|
250
269
|
}
|
|
251
270
|
|
|
252
271
|
declare type ButtonSize = 'default' | 'medium' | 'mini';
|
|
@@ -1005,6 +1024,11 @@ export declare type LatLng = {
|
|
|
1005
1024
|
longitude: number;
|
|
1006
1025
|
};
|
|
1007
1026
|
|
|
1027
|
+
/**
|
|
1028
|
+
* Button 通过 `openType="launchApp"` 跳转外部应用后的回调结果。
|
|
1029
|
+
*/
|
|
1030
|
+
export declare type LaunchAppResult = OpenAppResult;
|
|
1031
|
+
|
|
1008
1032
|
export { ListAttachedCell }
|
|
1009
1033
|
|
|
1010
1034
|
export { ListItemInfo }
|
|
@@ -1549,7 +1573,7 @@ export declare interface MapMarkerProps {
|
|
|
1549
1573
|
|
|
1550
1574
|
export declare type MapMarkerRef = {
|
|
1551
1575
|
/**
|
|
1552
|
-
*
|
|
1576
|
+
* @deprecated 豆包 14.9.0 及以上版本已支持 marker 响应式刷新,无需手动调用。
|
|
1553
1577
|
*/
|
|
1554
1578
|
refreshMarker: () => void;
|
|
1555
1579
|
};
|
|
@@ -1630,6 +1654,8 @@ export declare interface MapProps {
|
|
|
1630
1654
|
showScale?: boolean;
|
|
1631
1655
|
/**
|
|
1632
1656
|
* 是否显示当前位置标记。开启后会调用定位 API 获取并监听当前位置变化,使用内置 marker 图标展示。
|
|
1657
|
+
* 使用前需在 Manifest 中声明 `scope.userLocation`,并将该权限配置为 JSB 类型。
|
|
1658
|
+
* 未正确声明时不会触发授权弹窗,也不会展示当前位置标记。
|
|
1633
1659
|
* @defaultValue false
|
|
1634
1660
|
*/
|
|
1635
1661
|
showLocation?: boolean;
|
|
@@ -4290,8 +4316,8 @@ declare enum VideoEngineOption {
|
|
|
4290
4316
|
|
|
4291
4317
|
declare type VideoEnginePlaybackCallback = (success: boolean, errCode?: number, errMsg?: string) => void;
|
|
4292
4318
|
|
|
4293
|
-
|
|
4294
|
-
ref?: ForwardedRef<
|
|
4319
|
+
declare interface VideoEngineProps {
|
|
4320
|
+
ref?: ForwardedRef<VideoEngineRef>;
|
|
4295
4321
|
/**
|
|
4296
4322
|
* Style for wrapper, especially for border-radius
|
|
4297
4323
|
* @zh 包装器的样式,特别用于设置圆角
|
|
@@ -4681,7 +4707,7 @@ export declare interface VideoProps {
|
|
|
4681
4707
|
onDisappear?: () => void;
|
|
4682
4708
|
}
|
|
4683
4709
|
|
|
4684
|
-
|
|
4710
|
+
declare interface VideoEngineRef {
|
|
4685
4711
|
/**
|
|
4686
4712
|
* Start playing. You should start play after resource redirect (after `onRedirected`)
|
|
4687
4713
|
* @zh 开始播放。你应该在资源重定向后(`onRedirected`)开始播放
|
|
@@ -4851,6 +4877,10 @@ export declare interface VideoRef {
|
|
|
4851
4877
|
operatePoster: (display: boolean) => void;
|
|
4852
4878
|
}
|
|
4853
4879
|
|
|
4880
|
+
export declare type VideoProps = VideoEngineProps;
|
|
4881
|
+
|
|
4882
|
+
export declare type VideoRef = VideoEngineRef;
|
|
4883
|
+
|
|
4854
4884
|
/**
|
|
4855
4885
|
* 基础布局容器,用于组织和嵌套其他组件,支持 Flexbox 布局。
|
|
4856
4886
|
*/
|
|
@@ -5005,7 +5035,42 @@ declare interface WebGLContextAttributes_2 {
|
|
|
5005
5035
|
* // 或按需导入:import { postMessage, onMessage } from '@doubao-dev/webview-jssdk';
|
|
5006
5036
|
* ```
|
|
5007
5037
|
*
|
|
5008
|
-
*
|
|
5038
|
+
* ## H5 可用 API
|
|
5039
|
+
*
|
|
5040
|
+
* WebView JSSDK 当前提供以下 API:
|
|
5041
|
+
*
|
|
5042
|
+
* | API | 返回值 | 说明 |
|
|
5043
|
+
* | --- | --- | --- |
|
|
5044
|
+
* | `doubao.navigateTo({ url })` | `Promise<unknown>` | 保留当前页面,跳转到智能服务内页面 |
|
|
5045
|
+
* | `doubao.navigateBack({ delta? })` | `Promise<unknown>` | 返回智能服务内的上一页或多级页面,`delta` 默认为 `1` |
|
|
5046
|
+
* | `doubao.redirectTo({ url })` | `Promise<unknown>` | 关闭当前页面,跳转到智能服务内页面 |
|
|
5047
|
+
* | `doubao.reLaunch({ url })` | `Promise<unknown>` | 关闭所有页面,跳转到智能服务内页面 |
|
|
5048
|
+
* | `doubao.postMessage({ data })` | `Promise<unknown>` | 向应用侧的 `<web-view onMessage>` 发送消息 |
|
|
5049
|
+
* | `doubao.setTitle({ title })` | `Promise<unknown>` | 设置应用侧 WebView 头部标题 |
|
|
5050
|
+
* | `doubao.onMessage(handler)` | `() => void` | 监听应用侧消息,返回注销函数 |
|
|
5051
|
+
*
|
|
5052
|
+
* 路由 API 的 `url` 是智能服务内页面路径,不是 H5 页面地址。
|
|
5053
|
+
*
|
|
5054
|
+
* ## 安全限制
|
|
5055
|
+
*
|
|
5056
|
+
* 1. **URL 协议限制**:`src` 仅支持 `https://` 协议,不支持 `http://`、`file://` 等其他协议。
|
|
5057
|
+
* 2. **JSB 白名单**:白名单外的 JSB 调用会被拦截并返回错误;其他 API 调用需要通过消息通道
|
|
5058
|
+
* 交给智能服务页面中转。
|
|
5059
|
+
* 3. **域名校验**:需要在豆包智能服务开放平台配置域名白名单,非白名单域名的 URL 将被拒绝加载。
|
|
5060
|
+
*
|
|
5061
|
+
* ## 判断是否在豆包智能服务中打开
|
|
5062
|
+
*
|
|
5063
|
+
* H5 可通过 User-Agent 中是否包含 `DoubaoApps` 判断:
|
|
5064
|
+
*
|
|
5065
|
+
* ```js
|
|
5066
|
+
* const isInDoubaoApps = navigator.userAgent.includes('DoubaoApps');
|
|
5067
|
+
* ```
|
|
5068
|
+
*
|
|
5069
|
+
* ## 双向通信示例
|
|
5070
|
+
*
|
|
5071
|
+
* ### 应用侧
|
|
5072
|
+
*
|
|
5073
|
+
* `src` 指向 H5 地址,`ref` 用于拿到 `postMessage`,`onMessage` 接收 H5 消息。
|
|
5009
5074
|
*
|
|
5010
5075
|
* ```tsx
|
|
5011
5076
|
* import { useRef } from '@doubao-dev/framework';
|
|
@@ -5033,7 +5098,9 @@ declare interface WebGLContextAttributes_2 {
|
|
|
5033
5098
|
* }
|
|
5034
5099
|
* ```
|
|
5035
5100
|
*
|
|
5036
|
-
* H5
|
|
5101
|
+
* ### H5 侧
|
|
5102
|
+
*
|
|
5103
|
+
* `doubao.onMessage` 接收应用消息并返回注销函数,`doubao.postMessage` 发送消息给应用。
|
|
5037
5104
|
*
|
|
5038
5105
|
* ```js
|
|
5039
5106
|
* const off = doubao.onMessage((raw) => {
|
|
@@ -5050,15 +5117,6 @@ declare interface WebGLContextAttributes_2 {
|
|
|
5050
5117
|
* // off();
|
|
5051
5118
|
* ```
|
|
5052
5119
|
*
|
|
5053
|
-
* 三个容易踩的点:
|
|
5054
|
-
*
|
|
5055
|
-
* - 首条消息放在 `onLoad` 之后发,H5 尚未加载完成时发送的消息会丢失。
|
|
5056
|
-
* - 两个方向的数据形态不同:应用 → H5 时非字符串会被 `JSON.stringify`,H5 收到的是 JSON 字符串,
|
|
5057
|
-
* 需要自行 `JSON.parse`;H5 → 应用时 `onMessage` 的 `event.data` 保持 H5 传入的原始值。
|
|
5058
|
-
* - 如果两侧都写成“收到就回”,务必按消息 `type` 区分,否则会无限互相回声。
|
|
5059
|
-
*
|
|
5060
|
-
* 除消息通道外,H5 还可以调用 `doubao.setTitle({ title })` 同步应用侧 WebView 头部标题。
|
|
5061
|
-
*
|
|
5062
5120
|
* ## Web 模拟器差异
|
|
5063
5121
|
*
|
|
5064
5122
|
* Web 模拟器中的 `<web-view>` 通过本地代理承载 H5 页面,页面脚本读取到的
|
|
@@ -5072,7 +5130,7 @@ export declare interface WebViewProps {
|
|
|
5072
5130
|
*/
|
|
5073
5131
|
ref?: Ref<WebViewRef>;
|
|
5074
5132
|
/**
|
|
5075
|
-
*
|
|
5133
|
+
* 网页资源地址,仅支持 `https://` 协议;需要在豆包智能服务开放平台配置白名单,并通过校验
|
|
5076
5134
|
*/
|
|
5077
5135
|
src?: string;
|
|
5078
5136
|
/**
|
package/dist/config.d.ts
CHANGED
|
@@ -253,7 +253,18 @@ export declare interface DoubaoAppsPlugin {
|
|
|
253
253
|
setup: (api: any) => void | Promise<void>;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
export declare type DoubaoAppsToolConfig =
|
|
256
|
+
export declare type DoubaoAppsToolConfig = DoubaoAppsToolEntryConfig[];
|
|
257
|
+
|
|
258
|
+
export declare type DoubaoAppsToolEntryConfig = string | ({
|
|
259
|
+
entry: string;
|
|
260
|
+
} & DoubaoAppsToolMetaConfig);
|
|
261
|
+
|
|
262
|
+
export declare type DoubaoAppsToolMetaConfig = {
|
|
263
|
+
/**
|
|
264
|
+
* Tool name. Defaults to the entry directory name.
|
|
265
|
+
*/
|
|
266
|
+
name?: string;
|
|
267
|
+
};
|
|
257
268
|
|
|
258
269
|
export declare type DoubaoAppsWidgetConfig = DoubaoAppsWidgetEntryConfig[] | DoubaoAppsLegacyEntryConfig<DoubaoAppsWidgetMetaConfig>;
|
|
259
270
|
|