@doubao-dev/framework 0.2.2 → 0.3.0-canary-5aeb29861-20260915084944

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/dist/api.d.ts CHANGED
@@ -2361,7 +2361,7 @@ export declare type DeviceOrientation = 'portrait' | 'landscape';
2361
2361
  * 关闭页面返回前提醒。
2362
2362
  *
2363
2363
  * @returns 返回一个 Promise,在当前页面的返回提醒关闭后 resolve。
2364
- * @since 0.0.43
2364
+ * @since 0.2.0
2365
2365
  * @platformSupport Android | supported | 支持关闭当前页面已开启的返回提醒。
2366
2366
  * @platformSupport iOS | supported | 支持关闭当前页面已开启的返回提醒。
2367
2367
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
@@ -2748,7 +2748,7 @@ export declare interface DypayParams {
2748
2748
  * 配合 disableAlertBeforeUnload 使用。
2749
2749
  * @param params 返回提醒参数,字段见 {@link EnableAlertBeforeUnloadParams}。
2750
2750
  * @returns 返回一个 Promise,在当前页面的返回提醒开启或更新后 resolve。
2751
- * @since 0.0.43
2751
+ * @since 0.2.0
2752
2752
  * @platformSupport Android | supported | 支持为当前页面开启返回提醒并更新提示文案。
2753
2753
  * @platformSupport iOS | supported | 支持为当前页面开启返回提醒并更新提示文案。
2754
2754
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
@@ -4130,12 +4130,13 @@ export declare interface GetConnectedWifiResult {
4130
4130
  * @containerSupport Widget | supported
4131
4131
  * @platformSupport Android | supported | 支持获取设备信息
4132
4132
  * @platformSupport iOS | supported | 支持获取设备信息
4133
- * @platformSupport PC | unsupported | 暂不支持
4133
+ * @platformSupport PC | supported | Flow Web 支持获取设备信息
4134
4134
  * @platformSupport HarmonyOS | unsupported | 暂不支持
4135
- * @permission none | - | none | Android,iOS | 无需额外权限
4135
+ * @permission none | - | none | Android,iOS,PC | 无需额外权限
4136
4136
  * @precondition All | 无额外前置条件
4137
4137
  * @platformNote Android | `abi`、`deviceAbi`、`cpuType` 仅 Android 返回
4138
4138
  * @platformNote iOS | 不返回 `abi`、`deviceAbi`、`cpuType`
4139
+ * @platformNote PC | Flow Web 浏览器的 `platform` 返回 `web`;Windows、macOS 桌面客户端分别返回 `windows`、`mac`,不返回 Android 专属字段
4139
4140
  * @resultExample
4140
4141
  * ```json
4141
4142
  * {
@@ -4147,7 +4148,7 @@ export declare interface GetConnectedWifiResult {
4147
4148
  * "memorySize": "8192"
4148
4149
  * }
4149
4150
  * ```
4150
- * @errorCode none | - | - | Android,iOS | 当前实现未稳定返回顶层 errNo/errMsg | 根据异常信息重试
4151
+ * @errorCode none | - | - | Android,iOS,PC | 当前实现未稳定返回顶层 errNo/errMsg | 根据异常信息重试
4151
4152
  *
4152
4153
  * @public
4153
4154
  */
@@ -7555,7 +7556,7 @@ export declare interface OpenLocationParams {
7555
7556
  * });
7556
7557
  * ```
7557
7558
  *
7558
- * @since 0.0.43
7559
+ * @since 0.2.0
7559
7560
  * @platformSupport Android | supported | 支持 push、replace、navigate 和 pop_to 页面栈操作。
7560
7561
  * @platformSupport iOS | supported | 支持 push、replace、navigate 和 pop_to 页面栈操作。
7561
7562
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
@@ -7585,7 +7586,7 @@ export declare const openPage: (params: OpenPageParams) => Promise<object>;
7585
7586
  * });
7586
7587
  * ```
7587
7588
  *
7588
- * @since 0.0.43
7589
+ * @since 0.2.0
7589
7590
  * @containerSupport Page | supported
7590
7591
  * @containerSupport Widget | supported
7591
7592
  * @platformSupport Android | supported | 支持在当前关联的主对话流中以半屏形式打开应用内页面。
@@ -648,7 +648,7 @@ export { ContentSizeChangedEvent }
648
648
  * 自定义地图样式 ID。
649
649
  * @since 0.2.1
650
650
  */
651
- export declare type CustomMapStyleId = string;
651
+ export declare type CustomMapStyleId = string & Record<never, never>;
652
652
 
653
653
  export declare const DoubaoPaymentButton: typeof DoubaoPaymentButton_2;
654
654
 
@@ -1453,7 +1453,7 @@ export declare interface LongImageProps {
1453
1453
  */
1454
1454
  scrollEventThrottle?: number;
1455
1455
  /**
1456
- * 非激活分段占位背景色。
1456
+ * 非激活分段或分段图片加载失败时的占位背景色。
1457
1457
  * @defaultValue 'transparent'
1458
1458
  */
1459
1459
  placeholderColor?: string;
@@ -1540,7 +1540,7 @@ export declare interface LongImageSegmentProps {
1540
1540
  */
1541
1541
  active?: boolean;
1542
1542
  /**
1543
- * 非激活分段占位背景色。
1543
+ * 非激活分段或分段图片加载失败时的占位背景色。
1544
1544
  * @defaultValue 'transparent'
1545
1545
  */
1546
1546
  placeholderColor?: string;
@@ -1875,6 +1875,10 @@ export declare interface MapProps {
1875
1875
  * 地图加载完成时触发。
1876
1876
  */
1877
1877
  onMapLoaded?: () => void;
1878
+ /**
1879
+ * 地图首个瓦片加载完成时触发。
1880
+ */
1881
+ onMapTileLoaded?: () => void;
1878
1882
  /**
1879
1883
  * 视野开始或结束变化时触发。回调参数包含变化阶段 `type`,以及可选的缩放级别、中心点和可视区域等信息。
1880
1884
  */
@@ -3030,6 +3034,11 @@ export declare interface Polyline {
3030
3034
  * 路线唯一标识。
3031
3035
  */
3032
3036
  id: string;
3037
+ /**
3038
+ * 是否参与 POI 碰撞避让。
3039
+ * @defaultValue false
3040
+ */
3041
+ collideDetection?: boolean;
3033
3042
  /**
3034
3043
  * 路线点数组。
3035
3044
  */
@@ -3511,7 +3520,7 @@ export declare interface RenderLongImageSegmentsOptions {
3511
3520
  */
3512
3521
  mode?: 'view' | 'list';
3513
3522
  /**
3514
- * 非激活分段占位背景色。
3523
+ * 非激活分段或分段图片加载失败时的占位背景色。
3515
3524
  * @defaultValue 'transparent'
3516
3525
  */
3517
3526
  placeholderColor?: string;
package/dist/config.d.ts CHANGED
@@ -53,9 +53,9 @@ declare type AIWidgetMetadata = {
53
53
  */
54
54
  description?: string;
55
55
  /**
56
- * Widget box type in Chat UI
56
+ * Widget box type in Chat UI. custom_box leaves background, radius and border to the business UI.
57
57
  */
58
- boxType?: 'inbox' | 'full_box';
58
+ boxType?: 'inbox' | 'full_box' | 'custom_box';
59
59
  /**
60
60
  * Whether add widget border
61
61
  */
@@ -86,6 +86,14 @@ declare interface AppletChatConfig {
86
86
  * App-level chat feature overrides.
87
87
  */
88
88
  features?: AppletChatFeaturesConfig;
89
+ /**
90
+ * Placeholder text for the chat input in text input mode.
91
+ */
92
+ inputHint?: string;
93
+ /**
94
+ * Hint text for the chat input in voice input mode.
95
+ */
96
+ speakHint?: string;
89
97
  }
90
98
 
91
99
  declare interface AppletChatFeatureConfig {
@@ -279,7 +287,7 @@ export declare type DoubaoAppsWidgetMetaConfig = Omit<AIWidgetMetadata, 'id'> &
279
287
  id?: string;
280
288
  name?: string;
281
289
  description?: string;
282
- boxType?: 'inbox' | 'full_box';
290
+ boxType?: AIWidgetMetadata['boxType'];
283
291
  border?: boolean;
284
292
  keywords?: string[];
285
293
  icons?: Icons;
package/dist/index.d.ts CHANGED
@@ -200,6 +200,48 @@ export declare type AIViewContext = MessageMeta & {
200
200
  };
201
201
  };
202
202
 
203
+ declare type AIWidgetMetadata = {
204
+ /**
205
+ * The widget unique identifier
206
+ */
207
+ id: string;
208
+ /**
209
+ * widget name
210
+ */
211
+ name?: string;
212
+ /**
213
+ * Describe the characteristics of widget
214
+ */
215
+ description?: string;
216
+ /**
217
+ * Widget box type in Chat UI. custom_box leaves background, radius and border to the business UI.
218
+ */
219
+ boxType?: 'inbox' | 'full_box' | 'custom_box';
220
+ /**
221
+ * Whether add widget border
222
+ */
223
+ border?: boolean;
224
+ /**
225
+ * Keywords of things
226
+ */
227
+ keywords?: string[];
228
+ /**
229
+ * Icons
230
+ */
231
+ icons?: Icons;
232
+ /**
233
+ * Set extra widget properties
234
+ */
235
+ prop?: string;
236
+ /**
237
+ * Widget title type
238
+ * - none: 默认,无标题
239
+ * - normal: 常规标题
240
+ * - float: 浮动标题
241
+ */
242
+ titleType?: 'none' | 'normal' | 'float';
243
+ };
244
+
203
245
  export declare type AnyObject = Record<string, any>;
204
246
 
205
247
  export declare type App<T extends DefineAppOptions = DefineAppOptions> = T & {
@@ -218,6 +260,14 @@ declare interface AppletChatConfig {
218
260
  * App-level chat feature overrides.
219
261
  */
220
262
  features?: AppletChatFeaturesConfig;
263
+ /**
264
+ * Placeholder text for the chat input in text input mode.
265
+ */
266
+ inputHint?: string;
267
+ /**
268
+ * Hint text for the chat input in voice input mode.
269
+ */
270
+ speakHint?: string;
221
271
  }
222
272
 
223
273
  declare interface AppletChatFeatureConfig {
@@ -682,17 +732,6 @@ export declare interface Page<Data extends AnyObject = AnyObject> extends Define
682
732
 
683
733
  declare type PageInstanceMethods<Data extends AnyObject> = UIInstanceMethods<Data, PageToolExtraMetadata>;
684
734
 
685
- /**
686
- * 宿主提供的页面运行时元数据。
687
- *
688
- * @since 0.1.2
689
- * @public
690
- */
691
- export declare interface PageMeta {
692
- /** 是否由 openPageInChat 打开;表示打开来源,不随半屏尺寸变化而改变。 */
693
- readonly isInChat: boolean;
694
- }
695
-
696
735
  declare type PageToolExtraMetadata = {
697
736
  /**
698
737
  * The page navbar title
@@ -755,6 +794,7 @@ export { RefObject }
755
794
  export declare interface SetPageContextParams {
756
795
  taskId: string;
757
796
  pageInfo: Record<string, unknown>;
797
+ pageName?: string;
758
798
  }
759
799
 
760
800
  declare const setPageModelContext: (params: SetPageContextParams) => Promise<object>;
@@ -871,41 +911,59 @@ export declare function useModelContext(): ModelContext;
871
911
 
872
912
  export declare function useMounted(callback: LifecycleCallback): void;
873
913
 
914
+ export { useReducer }
915
+
916
+ export { useRef }
917
+
918
+ export declare function useShow(callback: LifecycleCallback): void;
919
+
920
+ export { useState }
921
+
922
+ export { useSyncExternalStore }
923
+
924
+ export declare function useViewData<T extends Record<string, any> = Record<string, any>>(): T;
925
+
874
926
  /**
875
- * 读取当前页面的运行时元数据。
927
+ * 读取当前视图的运行时元数据。
876
928
  *
877
- * 在 Page / Widget 函数组件顶层调用。宿主未接入或未提供标记时,isInChat 为 false。
929
+ * 在 Page / Widget(卡片)函数组件顶层调用。宿主未接入或未提供标记时,isOpenedInChat 为 false。
878
930
  * 每次调用读取当前值,不订阅宿主更新,也不会主动触发组件渲染。
879
931
  *
880
- * @returns 页面运行时元数据,字段见 {@link PageMeta}。
932
+ * @returns 视图运行时元数据,字段见 {@link ViewMeta}。
881
933
  * @example
882
934
  * ```tsx
883
- * import { usePageMeta } from '@doubao-dev/framework';
935
+ * import { useViewMeta } from '@doubao-dev/framework';
884
936
  *
885
937
  * function Page() {
886
- * const { isInChat } = usePageMeta();
887
- * return <text>{isInChat ? '对话内页面' : '普通页面'}</text>;
938
+ * const { isOpenedInChat } = useViewMeta();
939
+ * return <text>{isOpenedInChat ? '对话内页面' : '普通页面'}</text>;
888
940
  * }
889
941
  * ```
890
- * @since 0.1.2
942
+ * @since 0.3.0
891
943
  * @public
892
944
  */
893
- export declare function usePageMeta(): PageMeta;
894
-
895
- export { useReducer }
896
-
897
- export { useRef }
898
-
899
- export declare function useShow(callback: LifecycleCallback): void;
900
-
901
- export { useState }
902
-
903
- export { useSyncExternalStore }
904
-
905
- export declare function useViewData<T extends Record<string, any> = Record<string, any>>(): T;
945
+ export declare function useViewMeta(): ViewMeta;
906
946
 
907
947
  export { VFC }
908
948
 
949
+ /**
950
+ * 宿主提供的视图运行时元数据。
951
+ *
952
+ * @since 0.3.0
953
+ * @public
954
+ */
955
+ export declare interface ViewMeta {
956
+ /** 当前视图是否为 Page;入口类型标记缺失时为 false。 */
957
+ readonly isPage: boolean;
958
+ /** 当前视图是否为 Widget(卡片);入口类型标记缺失时为 false。 */
959
+ readonly isWidget: boolean;
960
+ /**
961
+ * 页面是否由 openPageInChat 打开;Widget(卡片)为 false,不表示是否展示在聊天中。
962
+ * 表示打开来源,不随半屏尺寸变化而改变。
963
+ */
964
+ readonly isOpenedInChat: boolean;
965
+ }
966
+
909
967
  export { VoidFunctionComponent }
910
968
 
911
969
  export declare interface Widget<Data extends AnyObject = AnyObject> extends DefineWidgetToolOptions<Data> {
@@ -920,7 +978,7 @@ declare type WidgetToolExtraMetadata = {
920
978
  /**
921
979
  * Widget box type in Chat UI
922
980
  */
923
- boxType?: 'inbox' | 'full_box';
981
+ boxType?: AIWidgetMetadata['boxType'];
924
982
  /**
925
983
  * Whether add widget border
926
984
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doubao-dev/framework",
3
- "version": "0.2.2",
3
+ "version": "0.3.0-canary-5aeb29861-20260915084944",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -68,7 +68,7 @@
68
68
  "types.d.ts"
69
69
  ],
70
70
  "dependencies": {
71
- "@lynx-js/types": "4.1.0",
71
+ "@lynx-js/types": "4.2.1",
72
72
  "@types/react": "18.3.27"
73
73
  },
74
74
  "publishConfig": {