@doubao-dev/taro-runtime 0.0.38 → 0.0.39

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/README.md CHANGED
@@ -1,15 +1,11 @@
1
1
  # @doubao-dev/taro-runtime
2
2
 
3
- `@doubao-dev/taro-runtime` 提供 Doubao Apps 场景下的 Taro 运行时适配层。
4
- 通常由内部的 `@byted-doubao-apps/taro-plugin` 在构建时自动接入,你也可以在需要时手动引用对应导出。
3
+ `@doubao-dev/taro-runtime` 提供豆包智能服务场景下的 Taro 运行时适配层。
4
+
5
+ > **实验性特性**:本包当前处于实验阶段
5
6
 
6
7
  ## 安装
7
8
 
8
9
  ```bash
9
10
  pnpm add @doubao-dev/taro-runtime
10
11
  ```
11
-
12
- ## 与 taro-plugin 的关系
13
-
14
- - `@byted-doubao-apps/taro-plugin` 会自动把 `@tarojs/taro` 解析到本包导出。
15
- - 如果你已使用 `@byted-doubao-apps/taro-plugin`,一般不需要手动配置别名。
@@ -1,15 +1,12 @@
1
1
  export * from './accessibility.js';
2
2
  export * from './accelerometer.js';
3
3
  export * from './battery.js';
4
- export * from './calendar.js';
5
4
  export * from './clipboard.js';
6
5
  export * from './compass.js';
7
- export * from './contact.js';
8
6
  export * from './crypto.js';
9
7
  export * from './device-motion.js';
10
8
  export * from './gyroscope.js';
11
9
  export * from './keyboard.js';
12
- export * from './network.js';
13
10
  export * from './scan.js';
14
11
  export * from './screen.js';
15
12
  export * from './vibration.js';
@@ -1,15 +1,12 @@
1
1
  export * from './accessibility.js';
2
2
  export * from './accelerometer.js';
3
3
  export * from './battery.js';
4
- export * from './calendar.js';
5
4
  export * from './clipboard.js';
6
5
  export * from './compass.js';
7
- export * from './contact.js';
8
6
  export * from './crypto.js';
9
7
  export * from './device-motion.js';
10
8
  export * from './gyroscope.js';
11
9
  export * from './keyboard.js';
12
- export * from './network.js';
13
10
  export * from './scan.js';
14
11
  export * from './screen.js';
15
12
  export * from './vibration.js';
@@ -4,15 +4,12 @@ export * from './accelerometer.js';
4
4
  export * from './battery.js';
5
5
  export * from './beacon.js';
6
6
  export * from './bluetooth.js';
7
- export * from './calendar.js';
8
7
  export * from './clipboard.js';
9
8
  export * from './compass.js';
10
- export * from './contact.js';
11
9
  export * from './crypto.js';
12
10
  export * from './device-motion.js';
13
11
  export * from './gyroscope.js';
14
12
  export * from './keyboard.js';
15
- export * from './network.js';
16
13
  export * from './scan.js';
17
14
  export * from './screen.js';
18
15
  export * from './vibration.js';
@@ -4,15 +4,12 @@ export * from './accelerometer.js';
4
4
  export * from './battery.js';
5
5
  export * from './beacon.js';
6
6
  export * from './bluetooth.js';
7
- export * from './calendar.js';
8
7
  export * from './clipboard.js';
9
8
  export * from './compass.js';
10
- export * from './contact.js';
11
9
  export * from './crypto.js';
12
10
  export * from './device-motion.js';
13
11
  export * from './gyroscope.js';
14
12
  export * from './keyboard.js';
15
- export * from './network.js';
16
13
  export * from './scan.js';
17
14
  export * from './screen.js';
18
15
  export * from './vibration.js';
@@ -1,9 +1,6 @@
1
1
  import type Taro from '@tarojs/taro';
2
2
  type TaroHideKeyboardOption = Parameters<typeof Taro.hideKeyboard>[0];
3
3
  type TaroHideKeyboardResult = Awaited<ReturnType<typeof Taro.hideKeyboard>>;
4
- type TaroGetSelectedTextRangeOption = Parameters<typeof Taro.getSelectedTextRange>[0];
5
- type TaroGetSelectedTextRangeResult = Awaited<ReturnType<typeof Taro.getSelectedTextRange>>;
6
4
  export declare function hideKeyboard(option?: TaroHideKeyboardOption): Promise<TaroHideKeyboardResult>;
7
- export declare function getSelectedTextRange(option?: TaroGetSelectedTextRangeOption): Promise<TaroGetSelectedTextRangeResult>;
8
5
  export {};
9
6
  //# sourceMappingURL=keyboard.d.ts.map
@@ -1,16 +1,6 @@
1
1
  import * as appFrameworkApi from '@byted-doubao-apps/framework/api';
2
- import { buildOkCallbackResult, runCallbackApi, runTaroApi } from '../utils.js';
3
- function buildGetSelectedTextRangeResult(result) {
4
- return {
5
- start: typeof result.start === 'number' ? result.start : 0,
6
- end: typeof result.end === 'number' ? result.end : 0,
7
- ...buildOkCallbackResult('getSelectedTextRange')
8
- };
9
- }
2
+ import { runCallbackApi } from '../utils.js';
10
3
  export async function hideKeyboard(option) {
11
4
  return runCallbackApi('hideKeyboard', option, () => appFrameworkApi.hideKeyboard({}));
12
5
  }
13
- export async function getSelectedTextRange(option) {
14
- return runTaroApi('getSelectedTextRange', option, async () => buildGetSelectedTextRangeResult(await appFrameworkApi.getSelectedTextRange({})));
15
- }
16
6
  //# sourceMappingURL=keyboard.js.map
@@ -1,13 +1,7 @@
1
1
  import type Taro from '@tarojs/taro';
2
- type TaroSetVisualEffectOnCaptureOption = Parameters<typeof Taro.setVisualEffectOnCapture>[0];
3
- type TaroSetVisualEffectOnCaptureResult = Awaited<ReturnType<typeof Taro.setVisualEffectOnCapture>>;
4
- type TaroSetScreenBrightnessOption = Parameters<typeof Taro.setScreenBrightness>[0];
5
- type TaroSetScreenBrightnessResult = Awaited<ReturnType<typeof Taro.setScreenBrightness>>;
6
2
  type TaroSetKeepScreenOnOption = Parameters<typeof Taro.setKeepScreenOn>[0];
7
3
  type TaroSetKeepScreenOnResult = Awaited<ReturnType<typeof Taro.setKeepScreenOn>>;
8
4
  type UserCaptureScreenCallback = (result: TaroGeneral.CallbackResult) => void;
9
- export declare function setVisualEffectOnCapture(option: TaroSetVisualEffectOnCaptureOption): Promise<TaroSetVisualEffectOnCaptureResult>;
10
- export declare function setScreenBrightness(option: TaroSetScreenBrightnessOption): Promise<TaroSetScreenBrightnessResult>;
11
5
  export declare function setKeepScreenOn(option: TaroSetKeepScreenOnOption): Promise<TaroSetKeepScreenOnResult>;
12
6
  export declare function onUserCaptureScreen(callback: UserCaptureScreenCallback): void;
13
7
  export declare function offUserCaptureScreen(callback?: UserCaptureScreenCallback): void;
@@ -1,16 +1,6 @@
1
1
  import * as appFrameworkApi from '@byted-doubao-apps/framework/api';
2
2
  import { buildOkCallbackResult, runCallbackApi } from '../utils.js';
3
3
  const userCaptureScreenCallbacks = new Map();
4
- export async function setVisualEffectOnCapture(option) {
5
- return runCallbackApi('setVisualEffectOnCapture', option, () => appFrameworkApi.setVisualEffectOnCapture({
6
- visualEffect: option.visualEffect
7
- }));
8
- }
9
- export async function setScreenBrightness(option) {
10
- return runCallbackApi('setScreenBrightness', option, () => appFrameworkApi.setScreenBrightness({
11
- value: option.value
12
- }));
13
- }
14
4
  export async function setKeepScreenOn(option) {
15
5
  return runCallbackApi('setKeepScreenOn', option, () => appFrameworkApi.setKeepScreenOn({
16
6
  keepScreenOn: option.keepScreenOn
@@ -8,7 +8,7 @@ export { exitMiniProgram, navigateBack, navigateTo, getCurrentPages, reLaunch, r
8
8
  export { setStorage, setStorageSync, getStorage, getStorageSync, removeStorage, removeStorageSync, clearStorage, clearStorageSync, getStorageInfo, getStorageInfoSync } from './storage/index.js';
9
9
  export * from './system/index.js';
10
10
  export * from './location/index.js';
11
- export { disableAlertBeforeUnload, enableAlertBeforeUnload, hideLoading, hideToast, showActionSheet, showLoading, showModal } from './interaction/index.js';
11
+ export { hideLoading, hideToast, showActionSheet, showLoading, showModal } from './interaction/index.js';
12
12
  export { showToast } from './show-toast/index.js';
13
13
  export { createMapContext } from './map/index.js';
14
14
  export { createSelectorQuery } from './create-selector-query/index.js';
package/dist/api/index.js CHANGED
@@ -8,7 +8,7 @@ export { exitMiniProgram, navigateBack, navigateTo, getCurrentPages, reLaunch, r
8
8
  export { setStorage, setStorageSync, getStorage, getStorageSync, removeStorage, removeStorageSync, clearStorage, clearStorageSync, getStorageInfo, getStorageInfoSync } from './storage/index.js';
9
9
  export * from './system/index.js';
10
10
  export * from './location/index.js';
11
- export { disableAlertBeforeUnload, enableAlertBeforeUnload, hideLoading, hideToast, showActionSheet, showLoading, showModal } from './interaction/index.js';
11
+ export { hideLoading, hideToast, showActionSheet, showLoading, showModal } from './interaction/index.js';
12
12
  export { showToast } from './show-toast/index.js';
13
13
  export { createMapContext } from './map/index.js';
14
14
  export { createSelectorQuery } from './create-selector-query/index.js';
@@ -9,16 +9,10 @@ type TaroHideLoadingOption = Parameters<typeof Taro.hideLoading>[0];
9
9
  type TaroHideLoadingResult = ReturnType<typeof Taro.hideLoading>;
10
10
  type TaroShowActionSheetOption = Parameters<typeof Taro.showActionSheet>[0];
11
11
  type TaroShowActionSheetResult = Awaited<ReturnType<typeof Taro.showActionSheet>>;
12
- type TaroEnableAlertBeforeUnloadOption = Parameters<typeof Taro.enableAlertBeforeUnload>[0];
13
- type TaroEnableAlertBeforeUnloadResult = ReturnType<typeof Taro.enableAlertBeforeUnload>;
14
- type TaroDisableAlertBeforeUnloadOption = Parameters<typeof Taro.disableAlertBeforeUnload>[0];
15
- type TaroDisableAlertBeforeUnloadResult = ReturnType<typeof Taro.disableAlertBeforeUnload>;
16
12
  export declare function showModal(option?: TaroShowModalOption): Promise<TaroShowModalResult>;
17
13
  export declare function showLoading(option?: TaroShowLoadingOption): Promise<TaroShowLoadingResult>;
18
14
  export declare function hideToast(option?: TaroHideToastOption): TaroHideToastResult;
19
15
  export declare function hideLoading(option?: TaroHideLoadingOption): TaroHideLoadingResult;
20
16
  export declare function showActionSheet(option: TaroShowActionSheetOption): Promise<TaroShowActionSheetResult>;
21
- export declare function enableAlertBeforeUnload(option: TaroEnableAlertBeforeUnloadOption): TaroEnableAlertBeforeUnloadResult;
22
- export declare function disableAlertBeforeUnload(option?: TaroDisableAlertBeforeUnloadOption): TaroDisableAlertBeforeUnloadResult;
23
17
  export {};
24
18
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { disableAlertBeforeUnload as appDisableAlertBeforeUnload, enableAlertBeforeUnload as appEnableAlertBeforeUnload, hideLoading as appHideLoading, hideToast as appHideToast, showActionSheet as appShowActionSheet, showLoading as appShowLoading, showModal as appShowModal } from '@byted-doubao-apps/framework/api';
1
+ import { hideLoading as appHideLoading, hideToast as appHideToast, showActionSheet as appShowActionSheet, showLoading as appShowLoading, showModal as appShowModal } from '@byted-doubao-apps/framework/api';
2
2
  import { buildOkCallbackResult, runCallbackApi, runTaroApi } from '../utils.js';
3
3
  function runVoidCallbackApi(apiName, callbacks, run) {
4
4
  const task = runCallbackApi(apiName, callbacks, run);
@@ -45,11 +45,6 @@ function buildShowActionSheetResult(result) {
45
45
  ...buildOkCallbackResult('showActionSheet')
46
46
  };
47
47
  }
48
- function buildEnableAlertBeforeUnloadParams(option) {
49
- return {
50
- message: typeof option.message === 'string' ? option.message : ''
51
- };
52
- }
53
48
  export async function showModal(option) {
54
49
  return runTaroApi('showModal', option, async () => buildShowModalResult(await appShowModal(buildShowModalParams(option))));
55
50
  }
@@ -65,10 +60,4 @@ export function hideLoading(option) {
65
60
  export async function showActionSheet(option) {
66
61
  return runTaroApi('showActionSheet', option, async () => buildShowActionSheetResult(await appShowActionSheet(buildShowActionSheetParams(option))));
67
62
  }
68
- export function enableAlertBeforeUnload(option) {
69
- return runVoidCallbackApi('enableAlertBeforeUnload', option, () => appEnableAlertBeforeUnload(buildEnableAlertBeforeUnloadParams(option)));
70
- }
71
- export function disableAlertBeforeUnload(option) {
72
- return runVoidCallbackApi('disableAlertBeforeUnload', option, () => appDisableAlertBeforeUnload({}));
73
- }
74
63
  //# sourceMappingURL=index.js.map
@@ -106,7 +106,7 @@ export async function startLocationUpdate(option) {
106
106
  }));
107
107
  }
108
108
  export async function stopLocationUpdate(option) {
109
- return runCallbackApi('stopLocationUpdate', option, () => appFrameworkApi.stopLocationUpdate({}));
109
+ return runCallbackApi('stopLocationUpdate', option, () => appFrameworkApi.stopLocationUpdate());
110
110
  }
111
111
  export function onLocationChange(callback) {
112
112
  if (typeof callback !== 'function' || locationChangeCallbacks.has(callback)) {
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  "access": "public",
38
38
  "registry": "https://registry.npmjs.org/"
39
39
  },
40
- "version": "0.0.38",
40
+ "version": "0.0.39",
41
41
  "scripts": {
42
42
  "dev": "npm run build -- -w",
43
43
  "build": "rimraf dist bundle && tsc -p tsconfig.build.json",
@@ -1,9 +0,0 @@
1
- import type Taro from '@tarojs/taro';
2
- type TaroAddPhoneCalendarOption = Parameters<typeof Taro.addPhoneCalendar>[0];
3
- type TaroAddPhoneCalendarResult = Awaited<ReturnType<typeof Taro.addPhoneCalendar>>;
4
- type TaroAddPhoneRepeatCalendarOption = Parameters<typeof Taro.addPhoneRepeatCalendar>[0];
5
- type TaroAddPhoneRepeatCalendarResult = Awaited<ReturnType<typeof Taro.addPhoneRepeatCalendar>>;
6
- export declare function addPhoneCalendar(option: TaroAddPhoneCalendarOption): Promise<TaroAddPhoneCalendarResult>;
7
- export declare function addPhoneRepeatCalendar(option: TaroAddPhoneRepeatCalendarOption): Promise<TaroAddPhoneRepeatCalendarResult>;
8
- export {};
9
- //# sourceMappingURL=calendar.d.ts.map
@@ -1,45 +0,0 @@
1
- import * as appFrameworkApi from '@byted-doubao-apps/framework/api';
2
- import { runCallbackApi } from '../utils.js';
3
- function toNumber(value) {
4
- if (typeof value === 'number' && Number.isFinite(value)) {
5
- return value;
6
- }
7
- if (typeof value === 'string' && value.length > 0) {
8
- const parsed = Number(value);
9
- if (Number.isFinite(parsed)) {
10
- return parsed;
11
- }
12
- }
13
- return undefined;
14
- }
15
- export async function addPhoneCalendar(option) {
16
- const endTime = toNumber(option.endTime);
17
- const params = {
18
- title: option.title,
19
- startTime: option.startTime,
20
- ...(option.allDay !== undefined ? { allDay: option.allDay } : {}),
21
- ...(option.description !== undefined ? { description: option.description } : {}),
22
- ...(option.location !== undefined ? { location: option.location } : {}),
23
- ...(endTime !== undefined ? { endTime } : {}),
24
- ...(option.alarm !== undefined ? { alarm: option.alarm } : {}),
25
- ...(option.alarmOffset !== undefined ? { alarmOffset: option.alarmOffset } : {})
26
- };
27
- return runCallbackApi('addPhoneCalendar', option, () => appFrameworkApi.addPhoneCalendar(params));
28
- }
29
- export async function addPhoneRepeatCalendar(option) {
30
- const endTime = toNumber(option.endTime);
31
- const params = {
32
- title: option.title,
33
- startTime: option.startTime,
34
- ...(option.allDay !== undefined ? { allDay: option.allDay } : {}),
35
- ...(option.description !== undefined ? { description: option.description } : {}),
36
- ...(option.location !== undefined ? { location: option.location } : {}),
37
- ...(endTime !== undefined ? { endTime } : {}),
38
- ...(option.alarm !== undefined ? { alarm: option.alarm } : {}),
39
- ...(option.alarmOffset !== undefined ? { alarmOffset: option.alarmOffset } : {}),
40
- ...(option.repeatInterval !== undefined ? { repeatInterval: option.repeatInterval } : {}),
41
- ...(option.repeatEndTime !== undefined ? { repeatEndTime: option.repeatEndTime } : {})
42
- };
43
- return runCallbackApi('addPhoneRepeatCalendar', option, () => appFrameworkApi.addPhoneRepeatCalendar(params));
44
- }
45
- //# sourceMappingURL=calendar.js.map
@@ -1,11 +0,0 @@
1
- import type Taro from '@tarojs/taro';
2
- type TaroChooseContactOption = Parameters<typeof Taro.chooseContact>[0];
3
- type TaroChooseContactResult = Omit<Taro.chooseContact.SuccessCallbackResult, 'phoneNumberList'> & {
4
- phoneNumberList: string[];
5
- };
6
- type TaroAddPhoneContactOption = Parameters<typeof Taro.addPhoneContact>[0];
7
- type TaroAddPhoneContactResult = Awaited<ReturnType<typeof Taro.addPhoneContact>>;
8
- export declare function chooseContact(option: TaroChooseContactOption): Promise<TaroChooseContactResult>;
9
- export declare function addPhoneContact(option: TaroAddPhoneContactOption): Promise<TaroAddPhoneContactResult>;
10
- export {};
11
- //# sourceMappingURL=contact.d.ts.map
@@ -1,18 +0,0 @@
1
- import * as appFrameworkApi from '@byted-doubao-apps/framework/api';
2
- import { buildOkCallbackResult, runCallbackApi, runTaroApi } from '../utils.js';
3
- function buildChooseContactResult(result) {
4
- return {
5
- phoneNumber: result.phoneNumber ?? '',
6
- displayName: result.displayName ?? '',
7
- phoneNumberList: Array.isArray(result.phoneNumberList) ? result.phoneNumberList : [],
8
- ...buildOkCallbackResult('chooseContact')
9
- };
10
- }
11
- export async function chooseContact(option) {
12
- return runTaroApi('chooseContact', option, async () => buildChooseContactResult(await appFrameworkApi.chooseContact({})));
13
- }
14
- export async function addPhoneContact(option) {
15
- const { success: _success, fail: _fail, complete: _complete, ...params } = option;
16
- return runCallbackApi('addPhoneContact', option, () => appFrameworkApi.addPhoneContact(params));
17
- }
18
- //# sourceMappingURL=contact.js.map
@@ -1,6 +0,0 @@
1
- import type Taro from '@tarojs/taro';
2
- type TaroGetLocalIPAddressOption = Parameters<typeof Taro.getLocalIPAddress>[0];
3
- type TaroGetLocalIPAddressResult = Awaited<ReturnType<typeof Taro.getLocalIPAddress>>;
4
- export declare function getLocalIPAddress(option?: TaroGetLocalIPAddressOption): Promise<TaroGetLocalIPAddressResult>;
5
- export {};
6
- //# sourceMappingURL=network.d.ts.map
@@ -1,13 +0,0 @@
1
- import * as appFrameworkApi from '@byted-doubao-apps/framework/api';
2
- import { buildOkCallbackResult, runTaroApi } from '../utils.js';
3
- function buildGetLocalIPAddressResult(result) {
4
- return {
5
- localip: result.localIp ?? '',
6
- netmask: result.netmask,
7
- ...buildOkCallbackResult('getLocalIPAddress')
8
- };
9
- }
10
- export async function getLocalIPAddress(option) {
11
- return runTaroApi('getLocalIPAddress', option, async () => buildGetLocalIPAddressResult(await appFrameworkApi.getLocalIPAddress({})));
12
- }
13
- //# sourceMappingURL=network.js.map