@doubao-dev/framework 0.2.1 → 0.3.0

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
@@ -1,4 +1,5 @@
1
1
  import type { HealthDataType as HealthDataType_2 } from '@byted-doubao-apps/bridge-api';
2
+ import type { OpenAppResult } from '@byted-doubao-apps/bridge-api';
2
3
 
3
4
  /**
4
5
  * 加速度数据变化事件。
@@ -2360,7 +2361,7 @@ export declare type DeviceOrientation = 'portrait' | 'landscape';
2360
2361
  * 关闭页面返回前提醒。
2361
2362
  *
2362
2363
  * @returns 返回一个 Promise,在当前页面的返回提醒关闭后 resolve。
2363
- * @since 0.0.43
2364
+ * @since 0.2.0
2364
2365
  * @platformSupport Android | supported | 支持关闭当前页面已开启的返回提醒。
2365
2366
  * @platformSupport iOS | supported | 支持关闭当前页面已开启的返回提醒。
2366
2367
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
@@ -2747,7 +2748,7 @@ export declare interface DypayParams {
2747
2748
  * 配合 disableAlertBeforeUnload 使用。
2748
2749
  * @param params 返回提醒参数,字段见 {@link EnableAlertBeforeUnloadParams}。
2749
2750
  * @returns 返回一个 Promise,在当前页面的返回提醒开启或更新后 resolve。
2750
- * @since 0.0.43
2751
+ * @since 0.2.0
2751
2752
  * @platformSupport Android | supported | 支持为当前页面开启返回提醒并更新提示文案。
2752
2753
  * @platformSupport iOS | supported | 支持为当前页面开启返回提醒并更新提示文案。
2753
2754
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
@@ -7418,6 +7419,15 @@ export declare const onUserScreenRecord: ClientEventRegistry<UserScreenRecordEve
7418
7419
  */
7419
7420
  export declare const onWifiConnected: ClientEventRegistry<WifiConnectedEvent>;
7420
7421
 
7422
+ /**
7423
+ * 通过 URI 打开外部应用。
7424
+ *
7425
+ * @internal
7426
+ */
7427
+ export declare const openApp: (params: {
7428
+ uri: string;
7429
+ }) => Promise<OpenAppResult>;
7430
+
7421
7431
  /**
7422
7432
  * 打开蓝牙适配器。
7423
7433
  *
@@ -7545,7 +7555,7 @@ export declare interface OpenLocationParams {
7545
7555
  * });
7546
7556
  * ```
7547
7557
  *
7548
- * @since 0.0.43
7558
+ * @since 0.2.0
7549
7559
  * @platformSupport Android | supported | 支持 push、replace、navigate 和 pop_to 页面栈操作。
7550
7560
  * @platformSupport iOS | supported | 支持 push、replace、navigate 和 pop_to 页面栈操作。
7551
7561
  * @platformSupport PC | unsupported | 当前未提供该平台实现。
@@ -7575,7 +7585,7 @@ export declare const openPage: (params: OpenPageParams) => Promise<object>;
7575
7585
  * });
7576
7586
  * ```
7577
7587
  *
7578
- * @since 0.0.43
7588
+ * @since 0.2.0
7579
7589
  * @containerSupport Page | supported
7580
7590
  * @containerSupport Widget | supported
7581
7591
  * @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
@@ -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 {
package/dist/index.d.ts CHANGED
@@ -218,6 +218,14 @@ declare interface AppletChatConfig {
218
218
  * App-level chat feature overrides.
219
219
  */
220
220
  features?: AppletChatFeaturesConfig;
221
+ /**
222
+ * Placeholder text for the chat input in text input mode.
223
+ */
224
+ inputHint?: string;
225
+ /**
226
+ * Hint text for the chat input in voice input mode.
227
+ */
228
+ speakHint?: string;
221
229
  }
222
230
 
223
231
  declare interface AppletChatFeatureConfig {
@@ -682,17 +690,6 @@ export declare interface Page<Data extends AnyObject = AnyObject> extends Define
682
690
 
683
691
  declare type PageInstanceMethods<Data extends AnyObject> = UIInstanceMethods<Data, PageToolExtraMetadata>;
684
692
 
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
693
  declare type PageToolExtraMetadata = {
697
694
  /**
698
695
  * The page navbar title
@@ -755,6 +752,7 @@ export { RefObject }
755
752
  export declare interface SetPageContextParams {
756
753
  taskId: string;
757
754
  pageInfo: Record<string, unknown>;
755
+ pageName?: string;
758
756
  }
759
757
 
760
758
  declare const setPageModelContext: (params: SetPageContextParams) => Promise<object>;
@@ -871,41 +869,59 @@ export declare function useModelContext(): ModelContext;
871
869
 
872
870
  export declare function useMounted(callback: LifecycleCallback): void;
873
871
 
872
+ export { useReducer }
873
+
874
+ export { useRef }
875
+
876
+ export declare function useShow(callback: LifecycleCallback): void;
877
+
878
+ export { useState }
879
+
880
+ export { useSyncExternalStore }
881
+
882
+ export declare function useViewData<T extends Record<string, any> = Record<string, any>>(): T;
883
+
874
884
  /**
875
- * 读取当前页面的运行时元数据。
885
+ * 读取当前视图的运行时元数据。
876
886
  *
877
- * 在 Page / Widget 函数组件顶层调用。宿主未接入或未提供标记时,isInChat 为 false。
887
+ * 在 Page / Widget(卡片)函数组件顶层调用。宿主未接入或未提供标记时,isOpenedInChat 为 false。
878
888
  * 每次调用读取当前值,不订阅宿主更新,也不会主动触发组件渲染。
879
889
  *
880
- * @returns 页面运行时元数据,字段见 {@link PageMeta}。
890
+ * @returns 视图运行时元数据,字段见 {@link ViewMeta}。
881
891
  * @example
882
892
  * ```tsx
883
- * import { usePageMeta } from '@doubao-dev/framework';
893
+ * import { useViewMeta } from '@doubao-dev/framework';
884
894
  *
885
895
  * function Page() {
886
- * const { isInChat } = usePageMeta();
887
- * return <text>{isInChat ? '对话内页面' : '普通页面'}</text>;
896
+ * const { isOpenedInChat } = useViewMeta();
897
+ * return <text>{isOpenedInChat ? '对话内页面' : '普通页面'}</text>;
888
898
  * }
889
899
  * ```
890
- * @since 0.1.2
900
+ * @since 0.3.0
891
901
  * @public
892
902
  */
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;
903
+ export declare function useViewMeta(): ViewMeta;
906
904
 
907
905
  export { VFC }
908
906
 
907
+ /**
908
+ * 宿主提供的视图运行时元数据。
909
+ *
910
+ * @since 0.3.0
911
+ * @public
912
+ */
913
+ export declare interface ViewMeta {
914
+ /** 当前视图是否为 Page;入口类型标记缺失时为 false。 */
915
+ readonly isPage: boolean;
916
+ /** 当前视图是否为 Widget(卡片);入口类型标记缺失时为 false。 */
917
+ readonly isWidget: boolean;
918
+ /**
919
+ * 页面是否由 openPageInChat 打开;Widget(卡片)为 false,不表示是否展示在聊天中。
920
+ * 表示打开来源,不随半屏尺寸变化而改变。
921
+ */
922
+ readonly isOpenedInChat: boolean;
923
+ }
924
+
909
925
  export { VoidFunctionComponent }
910
926
 
911
927
  export declare interface Widget<Data extends AnyObject = AnyObject> extends DefineWidgetToolOptions<Data> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doubao-dev/framework",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {