@tarojs/plugin-platform-harmony-ets 3.7.0-alpha.27 → 4.0.0-alpha.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.
Files changed (176) hide show
  1. package/dist/apis/apis.ts +6 -2
  2. package/dist/apis/base/crypto.ts +4 -0
  3. package/dist/apis/base/debug.ts +5 -0
  4. package/dist/apis/base/index.ts +9 -1
  5. package/dist/apis/base/performance.ts +8 -0
  6. package/dist/apis/base/system.ts +1 -1
  7. package/dist/apis/base/update.ts +5 -0
  8. package/dist/apis/base/weapp/app-event.ts +75 -0
  9. package/dist/apis/base/weapp/life-cycle.ts +21 -0
  10. package/dist/apis/canvas/index.ts +18 -0
  11. package/dist/apis/data-analysis/index.ts +6 -0
  12. package/dist/apis/device/accelerometer.ts +2 -1
  13. package/dist/apis/device/accessibility.ts +4 -0
  14. package/dist/apis/device/battery.ts +2 -2
  15. package/dist/apis/device/bluetooth-ble.ts +19 -0
  16. package/dist/apis/device/bluetooth-peripheral.ts +6 -0
  17. package/dist/apis/device/bluetooth.ts +16 -0
  18. package/dist/apis/device/calendar.ts +5 -0
  19. package/dist/apis/device/clipboard.ts +1 -1
  20. package/dist/apis/device/compass.ts +21 -0
  21. package/dist/apis/device/contact.ts +5 -0
  22. package/dist/apis/device/crypto.ts +4 -0
  23. package/dist/apis/device/gyroscope.ts +7 -0
  24. package/dist/apis/device/iBeacon.ts +10 -0
  25. package/dist/apis/device/index.ts +15 -0
  26. package/dist/apis/device/keyboard.ts +2 -1
  27. package/dist/apis/device/motion.ts +6 -0
  28. package/dist/apis/device/network.ts +26 -9
  29. package/dist/apis/device/nfc.ts +10 -0
  30. package/dist/apis/device/phone.ts +2 -1
  31. package/dist/apis/device/scan.ts +4 -0
  32. package/dist/apis/device/screen.ts +2 -1
  33. package/dist/apis/device/sms.ts +4 -0
  34. package/dist/apis/device/vibrate.ts +19 -11
  35. package/dist/apis/device/wifi.ts +15 -0
  36. package/dist/apis/ext/index.ts +5 -0
  37. package/dist/apis/files/index.ts +2 -1
  38. package/dist/apis/files/manager.ts +2 -1
  39. package/dist/apis/framework/index.ts +5 -6
  40. package/dist/apis/location/index.ts +61 -68
  41. package/dist/apis/media/EditorContext.ts +32 -0
  42. package/dist/apis/media/audio/index.ts +18 -0
  43. package/dist/apis/media/background-audio/index.ts +16 -0
  44. package/dist/apis/media/camera.ts +16 -0
  45. package/dist/apis/media/common.ts +2 -1
  46. package/dist/apis/media/{image.ts → image/index.ts} +3 -2
  47. package/dist/apis/media/index.ts +10 -0
  48. package/dist/apis/media/live.ts +5 -0
  49. package/dist/apis/media/map.ts +4 -0
  50. package/dist/apis/media/media-recorder.ts +4 -0
  51. package/dist/apis/media/recorder.ts +6 -0
  52. package/dist/apis/media/video/VideoContext.ts +19 -0
  53. package/dist/apis/media/{video.ts → video/index.ts} +12 -2
  54. package/dist/apis/media/video-decoder.ts +4 -0
  55. package/dist/apis/media/video-processing.ts +4 -0
  56. package/dist/apis/media/voip.ts +19 -0
  57. package/dist/apis/network/index.ts +3 -0
  58. package/dist/apis/network/mdns.ts +13 -0
  59. package/dist/apis/network/request.ts +2 -1
  60. package/dist/apis/network/tcp.ts +4 -0
  61. package/dist/apis/network/udp.ts +4 -0
  62. package/dist/apis/network/webSocket.ts +2 -6
  63. package/dist/apis/open-api/account.ts +4 -0
  64. package/dist/apis/open-api/address.ts +4 -0
  65. package/dist/apis/open-api/authorize.ts +5 -0
  66. package/dist/apis/open-api/card.ts +5 -0
  67. package/dist/apis/open-api/channels-live.ts +11 -0
  68. package/dist/apis/open-api/customer-service.ts +4 -0
  69. package/dist/apis/open-api/device-voip.ts +5 -0
  70. package/dist/apis/open-api/facial.ts +7 -0
  71. package/dist/apis/open-api/favorites.ts +5 -0
  72. package/dist/apis/open-api/group.ts +4 -0
  73. package/dist/apis/open-api/index.ts +20 -6
  74. package/dist/apis/open-api/invoice.ts +5 -0
  75. package/dist/apis/open-api/license-plate.ts +4 -0
  76. package/dist/apis/open-api/login.ts +6 -0
  77. package/dist/apis/open-api/my-miniprogram.ts +4 -0
  78. package/dist/apis/open-api/privacy.ts +7 -0
  79. package/dist/apis/open-api/red-package.ts +4 -0
  80. package/dist/apis/open-api/settings.ts +5 -0
  81. package/dist/apis/open-api/soter.ts +6 -0
  82. package/dist/apis/open-api/subscribe-message.ts +6 -0
  83. package/dist/apis/open-api/{user-info/index.ts → user-info.ts} +1 -16
  84. package/dist/apis/open-api/werun.ts +5 -0
  85. package/dist/apis/payment/index.ts +6 -0
  86. package/dist/apis/route/index.ts +4 -28
  87. package/dist/apis/share/index.ts +33 -0
  88. package/dist/apis/storage/background-fetch.ts +7 -0
  89. package/dist/apis/storage/cache-manager.ts +4 -0
  90. package/dist/apis/storage/index.ts +20 -18
  91. package/dist/apis/ui/{animation.ts → animation/animation.ts} +2 -2
  92. package/dist/apis/ui/animation/index.ts +7 -0
  93. package/dist/apis/ui/background.ts +2 -18
  94. package/dist/apis/ui/custom-component.ts +8 -0
  95. package/dist/apis/ui/fonts.ts +4 -0
  96. package/dist/apis/ui/index.ts +8 -10
  97. package/dist/apis/ui/interaction/index.ts +3 -0
  98. package/dist/apis/ui/menu.ts +4 -0
  99. package/dist/apis/ui/navigation-bar/index.ts +60 -21
  100. package/dist/apis/ui/pull-down-refresh.ts +1 -1
  101. package/dist/apis/{page → ui/scroll}/index.ts +27 -22
  102. package/dist/apis/ui/sticky.ts +4 -0
  103. package/dist/apis/{tabbar/index.ts → ui/tab-bar.ts} +3 -5
  104. package/dist/apis/ui/window.ts +20 -0
  105. package/dist/apis/utils/handler.ts +4 -4
  106. package/dist/apis/worker/index.ts +4 -0
  107. package/dist/apis/wxml/IntersectionObserver.ts +12 -21
  108. package/dist/apis/wxml/index.ts +5 -2
  109. package/dist/apis/wxml/nodesRef.ts +2 -2
  110. package/dist/apis/wxml/selectorQuery.ts +3 -4
  111. package/dist/components-harmony-ets/button.ets +90 -64
  112. package/dist/components-harmony-ets/checkbox.ets +53 -98
  113. package/dist/components-harmony-ets/form.ets +16 -112
  114. package/dist/components-harmony-ets/icon.ets +59 -46
  115. package/dist/components-harmony-ets/image.ets +15 -40
  116. package/dist/components-harmony-ets/innerHtml.ets +6 -74
  117. package/dist/components-harmony-ets/input.ets +58 -128
  118. package/dist/components-harmony-ets/label.ets +43 -69
  119. package/dist/components-harmony-ets/picker.ets +114 -137
  120. package/dist/components-harmony-ets/radio.ets +55 -103
  121. package/dist/components-harmony-ets/richText.ets +17 -41
  122. package/dist/components-harmony-ets/scrollView.ets +69 -101
  123. package/dist/components-harmony-ets/slider.ets +35 -58
  124. package/dist/components-harmony-ets/swiper.ets +24 -135
  125. package/dist/components-harmony-ets/switch.ets +25 -55
  126. package/dist/components-harmony-ets/text.ets +42 -46
  127. package/dist/components-harmony-ets/textArea.ets +39 -107
  128. package/dist/components-harmony-ets/utils/constant/style.ets +9 -6
  129. package/dist/components-harmony-ets/utils/flexManager.ets +3 -88
  130. package/dist/components-harmony-ets/utils/helper.ets +2 -62
  131. package/dist/components-harmony-ets/utils/index.ts +1 -1
  132. package/dist/components-harmony-ets/utils/styles.ets +6 -9
  133. package/dist/components-harmony-ets/video.ets +63 -92
  134. package/dist/components-harmony-ets/view.ets +65 -40
  135. package/dist/index.js +33 -4
  136. package/dist/index.js.map +1 -1
  137. package/dist/runtime-ets/bom/getComputedStyle.ts +1 -1
  138. package/dist/runtime-ets/dom/bind.ts +80 -0
  139. package/dist/runtime-ets/dom/class-list.ts +2 -4
  140. package/dist/runtime-ets/dom/comment.ts +1 -2
  141. package/dist/runtime-ets/dom/cssStyleDeclaration.ts +1 -1
  142. package/dist/runtime-ets/dom/dataSource.ts +64 -0
  143. package/dist/runtime-ets/dom/document.ts +14 -43
  144. package/dist/runtime-ets/dom/element/element.ts +162 -0
  145. package/dist/runtime-ets/dom/element/form.ts +397 -0
  146. package/dist/runtime-ets/dom/element/index.ts +89 -0
  147. package/dist/runtime-ets/dom/element/normal.ts +75 -0
  148. package/dist/runtime-ets/dom/element/scrollView.ts +14 -0
  149. package/dist/runtime-ets/dom/element/text.ts +17 -0
  150. package/dist/runtime-ets/dom/element/video.ts +49 -0
  151. package/dist/runtime-ets/dom/event.ts +24 -1
  152. package/dist/runtime-ets/dom/eventTarget.ts +2 -1
  153. package/dist/runtime-ets/dom/node.ts +74 -44
  154. package/dist/runtime-ets/dom/stylesheet/index.ts +136 -23
  155. package/dist/runtime-ets/dom/stylesheet/type.ts +4 -3
  156. package/dist/runtime-ets/dom/stylesheet/util.ts +71 -1
  157. package/dist/runtime-ets/index.ts +0 -1
  158. package/dist/runtime-ets/utils/bind.ts +3 -14
  159. package/dist/runtime-ets/utils/index.ts +12 -7
  160. package/dist/runtime-ets/utils/info.ts +22 -50
  161. package/dist/runtime-framework/react/app.ts +3 -6
  162. package/dist/runtime-framework/react/page.ts +2 -9
  163. package/dist/runtime-framework/solid/page.ts +0 -6
  164. package/dist/runtime-utils.js +1150 -339
  165. package/dist/runtime-utils.js.map +1 -1
  166. package/dist/runtime.js +1150 -339
  167. package/dist/runtime.js.map +1 -1
  168. package/package.json +8 -8
  169. package/types/runtime.d.ts +4 -0
  170. package/LICENSE +0 -160
  171. package/dist/components-harmony-ets/base.ets +0 -63
  172. package/dist/components-harmony-ets/element.ets +0 -223
  173. package/dist/components-harmony-ets/utils/constant/icon.ts +0 -19
  174. package/dist/runtime-ets/dom/element.ts +0 -457
  175. package/dist/runtime-ets/dom/text.ts +0 -19
  176. package/types/api.d.ts +0 -4
@@ -0,0 +1,4 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 我的小程序
4
+ export const checkIsAddedToMyMiniProgram = /* @__PURE__ */ temporarilyNotSupport('checkIsAddedToMyMiniProgram')
@@ -0,0 +1,7 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 隐私信息授权
4
+ export const requirePrivacyAuthorize = /* @__PURE__ */ temporarilyNotSupport('requirePrivacyAuthorize')
5
+ export const openPrivacyContract = /* @__PURE__ */ temporarilyNotSupport('openPrivacyContract')
6
+ export const onNeedPrivacyAuthorization = /* @__PURE__ */ temporarilyNotSupport('onNeedPrivacyAuthorization')
7
+ export const getPrivacySetting = /* @__PURE__ */ temporarilyNotSupport('getPrivacySetting')
@@ -0,0 +1,4 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 微信红包
4
+ export const showRedPackage = /* @__PURE__ */ temporarilyNotSupport('showRedPackage')
@@ -0,0 +1,5 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 设置
4
+ export const openSetting = /* @__PURE__ */ temporarilyNotSupport('openSetting')
5
+ export const getSetting = /* @__PURE__ */ temporarilyNotSupport('getSetting')
@@ -0,0 +1,6 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 生物认证
4
+ export const startSoterAuthentication = /* @__PURE__ */ temporarilyNotSupport('startSoterAuthentication')
5
+ export const checkIsSupportSoterAuthentication = /* @__PURE__ */ temporarilyNotSupport('checkIsSupportSoterAuthentication')
6
+ export const checkIsSoterEnrolledInDevice = /* @__PURE__ */ temporarilyNotSupport('checkIsSoterEnrolledInDevice')
@@ -0,0 +1,6 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 订阅消息
4
+ export const requestSubscribeMessage = /* @__PURE__ */ temporarilyNotSupport('requestSubscribeMessage')
5
+ // 订阅设备消息
6
+ export const requestSubscribeDeviceMessage = /* @__PURE__ */ temporarilyNotSupport('requestSubscribeDeviceMessage')
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  // import hmsJSAccount from '@hmscore/hms-jsb-account'
9
- import { temporarilyNotSupport } from '../../utils'
9
+ import { temporarilyNotSupport } from '../utils'
10
10
 
11
11
  /**
12
12
  * 通过Scope数组获取已登录的对应帐号信息(依赖login行为)
@@ -53,21 +53,6 @@ export const getUserProfile = temporarilyNotSupport('getUserProfile')
53
53
  // })
54
54
  // }
55
55
 
56
- /**
57
- * 提前向用户发起授权请求
58
- */
59
- export const authorize = temporarilyNotSupport('authorize')
60
-
61
- /**
62
- * 获取用户的当前设置
63
- */
64
- export const getSetting = temporarilyNotSupport('getSetting')
65
-
66
- /**
67
- * 调起客户端小程序设置界面
68
- */
69
- export const openSetting = temporarilyNotSupport('openSetting')
70
-
71
56
  // function generateUserInfo (hmsAuthInfo) {
72
57
  // const userInfo = {
73
58
  // nickName: String,
@@ -0,0 +1,5 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 微信运动
4
+ export const shareToWeRun = /* @__PURE__ */ temporarilyNotSupport('shareToWeRun')
5
+ export const getWeRunData = /* @__PURE__ */ temporarilyNotSupport('getWeRunData')
@@ -0,0 +1,6 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 支付
4
+ export const requestPayment = /* @__PURE__ */ temporarilyNotSupport('requestPayment')
5
+ export const requestPluginPayment = /* @__PURE__ */ temporarilyNotSupport('requestPluginPayment')
6
+ export const requestOrderPayment = /* @__PURE__ */ temporarilyNotSupport('requestOrderPayment')
@@ -1,28 +1,11 @@
1
1
  import router from '@ohos.router'
2
- // eslint-disable-next-line import/no-duplicates
3
- import { window } from '@tarojs/runtime'
4
- // eslint-disable-next-line import/no-duplicates
5
- import { eventCenter } from '@tarojs/runtime/dist/runtime.esm'
2
+ import { window } from '@tarojs/runtime' // eslint-disable-line import/no-duplicates
3
+ import { eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
6
4
  import { queryToJson } from '@tarojs/shared'
7
5
 
8
6
  import { callAsyncFail, callAsyncSuccess } from '../utils'
9
- import { IAsyncParams } from '../utils/types'
10
7
 
11
- import type Taro from '@tarojs/api'
12
-
13
- const launchOptions: Taro.getLaunchOptionsSync.LaunchOptions = {
14
- path: '',
15
- query: {},
16
- scene: 0,
17
- shareTicket: '',
18
- referrerInfo: {}
19
- }
20
-
21
- function initLaunchOptions (options = {}) {
22
- Object.assign(launchOptions, options)
23
- }
24
-
25
- eventCenter.once('__taroRouterLaunch', initLaunchOptions)
8
+ import type Taro from '@tarojs/taro/types'
26
9
 
27
10
  const TARO_TABBAR_PAGE_PATH = 'taro_tabbar'
28
11
  function isTabPage (url: string): boolean {
@@ -40,10 +23,6 @@ function parseURL (raw = ''): [string, Record<string, unknown>] {
40
23
  return [url, query]
41
24
  }
42
25
 
43
- // 生命周期
44
- export const getLaunchOptionsSync = () => launchOptions
45
- export const getEnterOptionsSync = () => launchOptions
46
-
47
26
  const getRouterFunc = (method): typeof Taro.navigateTo => {
48
27
  const methodName = method === 'navigateTo' ? 'pushUrl' : 'replaceUrl'
49
28
 
@@ -74,10 +53,7 @@ const getRouterFunc = (method): typeof Taro.navigateTo => {
74
53
  export const navigateTo = getRouterFunc('navigateTo')
75
54
  export const redirectTo = getRouterFunc('redirectTo')
76
55
 
77
- interface INavigateBackParams extends IAsyncParams {
78
- url?: string
79
- }
80
- export function navigateBack (options: INavigateBackParams): Promise<any> {
56
+ export function navigateBack (options: Taro.navigateBack.Option & { url?: string }): Promise<any> {
81
57
  return new Promise(resolve => {
82
58
  if (!options?.url) {
83
59
  router.back()
@@ -0,0 +1,33 @@
1
+ import { permanentlyNotSupport, temporarilyNotSupport } from '../utils'
2
+
3
+ // 转发
4
+
5
+ /** 更新转发属性 */
6
+ export const updateShareMenu = /* @__PURE__ */ temporarilyNotSupport('updateShareMenu')
7
+
8
+ /** 显示当前页面的转发按钮 */
9
+ export const showShareMenu = /* @__PURE__ */ temporarilyNotSupport('showShareMenu')
10
+
11
+ /** 打开分享图片弹窗,可以将图片发送给朋友、收藏或下载 */
12
+ export const showShareImageMenu = /* @__PURE__ */ temporarilyNotSupport('showShareImageMenu')
13
+
14
+ /** 转发视频到聊天 */
15
+ export const shareVideoMessage = /* @__PURE__ */ temporarilyNotSupport('shareVideoMessage')
16
+
17
+ /** 转发文件到聊天 */
18
+ export const shareFileMessage = /* @__PURE__ */ temporarilyNotSupport('shareFileMessage')
19
+
20
+ /** 监听用户点击右上角菜单的「复制链接」按钮时触发的事件 */
21
+ export const onCopyUrl = /* @__PURE__ */ temporarilyNotSupport('onCopyUrl')
22
+
23
+ /** 移除用户点击右上角菜单的「复制链接」按钮时触发的事件的监听函数 */
24
+ export const offCopyUrl = /* @__PURE__ */ temporarilyNotSupport('offCopyUrl')
25
+
26
+ /** 隐藏当前页面的转发按钮 */
27
+ export const hideShareMenu = /* @__PURE__ */ temporarilyNotSupport('hideShareMenu')
28
+
29
+ /** 获取转发详细信息 */
30
+ export const getShareInfo = /* @__PURE__ */ temporarilyNotSupport('getShareInfo')
31
+
32
+ /** 验证私密消息。 */
33
+ export const authPrivateMessage = /* @__PURE__ */ permanentlyNotSupport('authPrivateMessage')
@@ -0,0 +1,7 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 周期性更新
4
+ export const setBackgroundFetchToken = /* @__PURE__ */ temporarilyNotSupport('setBackgroundFetchToken')
5
+ export const onBackgroundFetchData = /* @__PURE__ */ temporarilyNotSupport('onBackgroundFetchData')
6
+ export const getBackgroundFetchToken = /* @__PURE__ */ temporarilyNotSupport('getBackgroundFetchToken')
7
+ export const getBackgroundFetchData = /* @__PURE__ */ temporarilyNotSupport('getBackgroundFetchData')
@@ -0,0 +1,4 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 周期性更新
4
+ export const createCacheManager = /* @__PURE__ */ temporarilyNotSupport('createCacheManager')
@@ -9,19 +9,7 @@ import { Current } from '@tarojs/runtime'
9
9
 
10
10
  import { callAsyncFail, callAsyncSuccess, temporarilyNotSupport, validateParams } from '../utils'
11
11
 
12
- import type { IAsyncParams } from '../utils/types'
13
-
14
- interface IGetStorageParams extends IAsyncParams {
15
- key: string
16
- }
17
- interface ISetStorageParams extends IAsyncParams {
18
- key: string
19
- data: number | string | boolean
20
- }
21
-
22
- interface IRemoveStorageParams extends IAsyncParams {
23
- key: string
24
- }
12
+ import type Taro from '@tarojs/taro/types'
25
13
 
26
14
  const preferencesPromise = (Current as any).contextPromise
27
15
  .then((context) => {
@@ -51,7 +39,7 @@ const storageSchema = {
51
39
  key: 'String'
52
40
  }
53
41
 
54
- export function getStorage (options: IGetStorageParams) {
42
+ export function getStorage<T = any> (options: Taro.getStorage.Option<T>) {
55
43
  return new Promise((resolve, reject) => {
56
44
  try {
57
45
  validateParams('getStorage', options, storageSchema)
@@ -61,7 +49,7 @@ export function getStorage (options: IGetStorageParams) {
61
49
  }
62
50
  getItem(options.key).then(({ result, data }) => {
63
51
  const res: Record<string, any> = { errMsg: 'getStorage:ok' }
64
-
52
+
65
53
  if (result) {
66
54
  res.data = data
67
55
  callAsyncSuccess(resolve, res, options)
@@ -73,7 +61,7 @@ export function getStorage (options: IGetStorageParams) {
73
61
  })
74
62
  }
75
63
 
76
- export function setStorage (options: ISetStorageParams) {
64
+ export function setStorage (options: Taro.setStorage.Option) {
77
65
  return new Promise((resolve, reject) => {
78
66
  try {
79
67
  validateParams('setStorage', options, storageSchema)
@@ -94,7 +82,7 @@ export function setStorage (options: ISetStorageParams) {
94
82
  })
95
83
  }
96
84
 
97
- export function removeStorage (options: IRemoveStorageParams) {
85
+ export function removeStorage (options: Taro.removeStorage.Option) {
98
86
  return new Promise((resolve, reject) => {
99
87
  try {
100
88
  validateParams('removeStorage', options, storageSchema)
@@ -115,7 +103,7 @@ export function removeStorage (options: IRemoveStorageParams) {
115
103
  })
116
104
  }
117
105
 
118
- export function clearStorage (options: IAsyncParams) {
106
+ export function clearStorage (options: Taro.clearStorage.Option) {
119
107
  return new Promise(resolve => {
120
108
  preferencesPromise.then(async (preferences) => {
121
109
  await preferences.clear()
@@ -127,7 +115,21 @@ export function clearStorage (options: IAsyncParams) {
127
115
  })
128
116
  }
129
117
 
118
+ export const getStorageInfoSync = temporarilyNotSupport('getStorageInfoSync')
119
+ export const getStorageInfo = temporarilyNotSupport('getStorageInfo')
120
+
130
121
  export const getStorageSync = temporarilyNotSupport('getStorageSync', 'getStorage')
131
122
  export const setStorageSync = temporarilyNotSupport('setStorageSync', 'setStorage')
132
123
  export const clearStorageSync = temporarilyNotSupport('clearStorageSync', 'clearStorage')
133
124
  export const removeStorageSync = temporarilyNotSupport('removeStorageSync', 'removeStorage')
125
+
126
+ export const createBufferURL = /* @__PURE__ */ temporarilyNotSupport('createBufferURL')
127
+ export const revokeBufferURL = /* @__PURE__ */ temporarilyNotSupport('revokeBufferURL')
128
+
129
+ export const batchSetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchSetStorageSync')
130
+ export const batchSetStorage = /* @__PURE__ */ temporarilyNotSupport('batchSetStorage')
131
+ export const batchGetStorageSync = /* @__PURE__ */ temporarilyNotSupport('batchGetStorageSync')
132
+ export const batchGetStorage = /* @__PURE__ */ temporarilyNotSupport('batchGetStorage')
133
+
134
+ export * from './background-fetch'
135
+ export * from './cache-manager'
@@ -1,8 +1,8 @@
1
1
  import matrix4 from '@ohos.matrix4'
2
2
 
3
- import { temporarilyNotSupport } from '../utils'
3
+ import { temporarilyNotSupport } from '../../utils'
4
4
 
5
- import type Taro from '@tarojs/api'
5
+ import type Taro from '@tarojs/taro/types'
6
6
 
7
7
  interface IAnimationAttr {
8
8
  duration: number
@@ -0,0 +1,7 @@
1
+ import { Animation } from './animation'
2
+
3
+ import type Taro from '@tarojs/taro/types'
4
+
5
+ export const createAnimation = (option: Taro.createAnimation.Option) => {
6
+ return new Animation(option)
7
+ }
@@ -1,16 +1,9 @@
1
- // import window from '@ohos.window'
2
- // import { Current } from '@tarojs/runtime'
3
1
  import { eventCenter } from '@tarojs/runtime/dist/runtime.esm'
4
2
 
3
+ import { temporarilyNotSupport } from '../utils'
5
4
  import { MethodHandler } from '../utils/handler'
6
5
 
7
- // import { callAsyncFail, callAsyncSuccess } from '../utils'
8
-
9
-
10
- // const windowClassPromise = (Current as any).contextPromise
11
- // .then(context => {
12
- // return window.getTopWindow(context)
13
- // })
6
+ export const setBackgroundTextStyle = /* @__PURE__ */ temporarilyNotSupport('setBackgroundTextStyle')
14
7
 
15
8
  export function setBackgroundColor(options: Taro.setBackgroundColor.Option) {
16
9
  const { success, fail, complete } = options || {}
@@ -22,14 +15,5 @@ export function setBackgroundColor(options: Taro.setBackgroundColor.Option) {
22
15
  })
23
16
 
24
17
  return handle.success({}, { resolve, reject })
25
- // windowClassPromise.then(windowClass => {
26
- // windowClass.setBackgroundColor(color).then(() => {
27
- // const res = { errMsg: 'setBackgroundColor:ok' }
28
- // callAsyncSuccess(resolve, res, options)
29
- // }, (error) => {
30
- // const res = { errMsg: 'setBackgroundColor:fail' + error }
31
- // callAsyncFail(reject, res, options)
32
- // })
33
- // })
34
18
  })
35
19
  }
@@ -0,0 +1,8 @@
1
+ import type Taro from '@tarojs/taro/types'
2
+
3
+ // 自定义组件
4
+ export const nextTick: typeof Taro.nextTick = (cb: (...args: any[]) => any, ctx?: Record<string, any>) => {
5
+ setTimeout(function () {
6
+ ctx ? cb.call(ctx) : cb()
7
+ }, 1)
8
+ }
@@ -0,0 +1,4 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 字体
4
+ export const loadFontFace = /* @__PURE__ */ temporarilyNotSupport('getMenuButtonBoundingClientRect')
@@ -1,14 +1,12 @@
1
- import { temporarilyNotSupport } from '../utils'
2
- import { Animation } from './animation'
3
-
4
- import type Taro from '@tarojs/api'
5
-
6
- export const createAnimation = (option: Taro.createAnimation.Option) => {
7
- return new Animation(option)
8
- }
9
- export const getMenuButtonBoundingClientRect = temporarilyNotSupport('getMenuButtonBoundingClientRect')
10
-
1
+ export * from './animation'
11
2
  export * from './background'
3
+ export * from './custom-component'
4
+ export * from './fonts'
12
5
  export * from './interaction'
6
+ export * from './menu'
13
7
  export * from './navigation-bar'
14
8
  export * from './pull-down-refresh'
9
+ export * from './scroll'
10
+ export * from './sticky'
11
+ export * from './tab-bar'
12
+ export * from './window'
@@ -193,3 +193,6 @@ export function hideToast (options) {
193
193
 
194
194
  export const showLoading = temporarilyNotSupport('showLoading')
195
195
  export const hideLoading = temporarilyNotSupport('hideLoading')
196
+
197
+ export const enableAlertBeforeUnload = /* @__PURE__ */ temporarilyNotSupport('enableAlertBeforeUnload')
198
+ export const disableAlertBeforeUnload = /* @__PURE__ */ temporarilyNotSupport('disableAlertBeforeUnload')
@@ -0,0 +1,4 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 菜单
4
+ export const getMenuButtonBoundingClientRect = /* @__PURE__ */ temporarilyNotSupport('getMenuButtonBoundingClientRect')
@@ -1,33 +1,72 @@
1
- import { Current } from '@tarojs/runtime'
1
+ import { eventCenter } from '@tarojs/runtime/dist/runtime.esm'
2
2
 
3
- import { callAsyncSuccess, temporarilyNotSupport } from '../../utils'
3
+ import { MethodHandler } from '../../utils/handler'
4
4
 
5
- import type Taro from '@tarojs/api'
5
+ import type Taro from '@tarojs/taro/types'
6
6
 
7
7
  export const setNavigationBarTitle: typeof Taro.setNavigationBarTitle = function (options) {
8
- return new Promise(resolve => {
9
- const taro = (Current as any).taro
10
- const page = taro.getCurrentInstance().page
11
- const res = { errMsg: 'setNavigationBarTitle:ok' }
8
+ const { success, fail, complete } = options || {}
9
+ const handle = new MethodHandler({ name: 'setNavigationBarTitle', success, fail, complete })
12
10
 
13
- page.$set?.('taroNavBar.title', options.title)
14
- callAsyncSuccess(resolve, res, options)
11
+ return new Promise((resolve, reject) => {
12
+ eventCenter.trigger('__taroNavigationStyle', {
13
+ title: options.title,
14
+ })
15
+
16
+ return handle.success({}, { resolve, reject })
15
17
  })
16
18
  }
17
19
 
18
20
  export const setNavigationBarColor: typeof Taro.setNavigationBarColor = function (options) {
19
- return new Promise(resolve => {
20
- const taro = (Current as any).taro
21
- const page = taro.getCurrentInstance().page
22
- const { frontColor, backgroundColor } = options
23
- const res = { errMsg: 'setNavigationBarColor:ok' }
24
-
25
- page.$set?.('taroNavBar.textStyle', frontColor)
26
- page.$set?.('taroNavBar.background', backgroundColor)
27
- callAsyncSuccess(resolve, res, options)
21
+ const { success, fail, complete } = options || {}
22
+ const handle = new MethodHandler({ name: 'setNavigationBarTitle', success, fail, complete })
23
+
24
+ return new Promise((resolve, reject) => {
25
+ eventCenter.trigger('__taroNavigationStyle', {
26
+ animation: options.animation,
27
+ backgroundColor: options.backgroundColor,
28
+ frontColor: options.frontColor,
29
+ })
30
+
31
+ return handle.success({}, { resolve, reject })
28
32
  })
29
33
  }
30
34
 
31
- export const showNavigationBarLoading = temporarilyNotSupport('showNavigationBarLoading')
32
- export const hideNavigationBarLoading = temporarilyNotSupport('hideNavigationBarLoading')
33
- export const hideHomeButton = temporarilyNotSupport('hideHomeButton')
35
+ export const showNavigationBarLoading: typeof Taro.setNavigationBarColor = function (options) {
36
+ const { success, fail, complete } = options || {}
37
+ const handle = new MethodHandler({ name: 'showNavigationBarLoading', success, fail, complete })
38
+
39
+ return new Promise((resolve, reject) => {
40
+ eventCenter.trigger('__taroNavigationStyle', {
41
+ loading: true,
42
+ })
43
+
44
+ return handle.success({}, { resolve, reject })
45
+ })
46
+ }
47
+
48
+ export const hideNavigationBarLoading: typeof Taro.hideNavigationBarLoading = function (options) {
49
+ const { success, fail, complete } = options || {}
50
+ const handle = new MethodHandler({ name: 'hideNavigationBarLoading', success, fail, complete })
51
+
52
+ return new Promise((resolve, reject) => {
53
+ eventCenter.trigger('__taroNavigationStyle', {
54
+ loading: false,
55
+ })
56
+
57
+ return handle.success({}, { resolve, reject })
58
+ })
59
+ }
60
+
61
+ export const hideHomeButton: typeof Taro.hideHomeButton = function (options) {
62
+ const { success, fail, complete } = options || {}
63
+ const handle = new MethodHandler({ name: 'hideHomeButton', success, fail, complete })
64
+
65
+ return new Promise((resolve, reject) => {
66
+ eventCenter.trigger('__taroNavigationStyle', {
67
+ home: false,
68
+ })
69
+
70
+ return handle.success({}, { resolve, reject })
71
+ })
72
+ }
@@ -2,7 +2,7 @@ import { Current } from '@tarojs/runtime'
2
2
 
3
3
  import { callAsyncSuccess } from '../utils'
4
4
 
5
- import type Taro from '@tarojs/api'
5
+ import type Taro from '@tarojs/taro/types'
6
6
 
7
7
  export const startPullDownRefresh: typeof Taro.startPullDownRefresh = function (options) {
8
8
  return new Promise(resolve => {
@@ -1,4 +1,3 @@
1
- // @ts-nocheck
2
1
  /**
3
2
  * 鸿蒙SDK API Version 6
4
3
  * 将页面滚动到目标位置
@@ -9,26 +8,31 @@
9
8
  import { AREA_CHANGE_EVENT_NAME, Current, findChildNodeWithDFS, getPageScrollerOrNode, setNodeEventCallbackAndTriggerComponentUpdate } from '@tarojs/runtime'
10
9
  import { pxTransformHelper } from '@tarojs/taro'
11
10
 
12
- import { callAsyncFail, callAsyncSuccess } from '../utils'
11
+ import { MethodHandler } from '../../utils/handler'
13
12
 
14
- import type Taro from '@tarojs/api'
15
-
16
- // TODO
17
- export const getCurrentPages = () => []
13
+ import type Taro from '@tarojs/taro/types'
18
14
 
15
+ /**
16
+ * 将页面滚动到目标位置
17
+ */
19
18
  export const pageScrollTo: typeof Taro.pageScrollTo = (options) => {
19
+ const { scrollTop, selector = '', duration = 300, offsetTop = 0, success, fail, complete } = options || {}
20
+ const handle = new MethodHandler({ name: 'pageScrollTo', success, fail, complete })
20
21
  // eslint-disable-next-line no-async-promise-executor
21
22
  return new Promise(async (resolve, reject) => {
22
- const taro = (Current as any).taro
23
- const page = taro.getCurrentInstance().page
24
- const res = { errMsg: 'pageScrollTo:ok' }
25
- const error = { errMsg: 'pageScrollTo:fail' }
26
- const { scrollTop, selector = '', duration = 300, offsetTop = 0 } = options
23
+ if (scrollTop === undefined && !selector) {
24
+ return handle.fail({
25
+ errMsg: 'scrollTop" "selector" 需要其之一'
26
+ }, { resolve, reject })
27
+ }
27
28
 
28
29
  if (scrollTop && selector) {
29
30
  console.warn('"scrollTop" 或 "selector" 建议只设一个值,全部设置会忽略selector')
30
31
  }
31
32
 
33
+ const taro = (Current as any).taro
34
+ const page = taro.getCurrentInstance().page
35
+
32
36
  let scrollValue = -1
33
37
  let scroller = page.scroller
34
38
  const currentPageNode = getPageScrollerOrNode(page.node, page)
@@ -38,20 +42,17 @@ export const pageScrollTo: typeof Taro.pageScrollTo = (options) => {
38
42
  } else if (selector) {
39
43
  const node = findChildNodeWithDFS(currentPageNode, selector)
40
44
 
41
- if (!node || !node._instance) return
42
-
43
- const instance = node._instance
44
- const id = node?._nid
45
+ if (!node) return
45
46
 
46
47
  // 获取 areaInfo,需要先调用 setNodeEventCallbackAndTriggerComponentUpdate 更新一次组件并获取组件信息
47
48
  await setNodeEventCallbackAndTriggerComponentUpdate(node, AREA_CHANGE_EVENT_NAME, null, true)
48
49
 
49
- const { areaInfo } = instance?.nodeInfoMap?.[id] || {}
50
+ const { areaInfo } = node._nodeInfo || {}
50
51
 
51
52
  let parent = node?.parentNode
52
53
  while (!!parent && parent !== currentPageNode) {
53
- if (parent?._instance?.scroller) {
54
- scroller = parent._instance.scroller
54
+ if (parent?.scroller) {
55
+ scroller = parent.scroller
55
56
  break
56
57
  }
57
58
  parent = parent?.parentNode
@@ -68,7 +69,9 @@ export const pageScrollTo: typeof Taro.pageScrollTo = (options) => {
68
69
  const { xOffset } = scroller.currentOffset()
69
70
 
70
71
  if (scrollValue === -1) {
71
- return callAsyncFail(reject, { errMsg: 'pageScrollTo:fail, 请检查传入的 scrollTop 或 selector 是否合法' }, options)
72
+ return handle.fail({
73
+ errMsg: '请检查传入的 scrollTop 或 selector 是否合法'
74
+ }, { resolve, reject })
72
75
  }
73
76
 
74
77
  try {
@@ -83,10 +86,12 @@ export const pageScrollTo: typeof Taro.pageScrollTo = (options) => {
83
86
  })
84
87
 
85
88
  setTimeout(() => {
86
- callAsyncSuccess(resolve, res, options)
89
+ handle.success({}, { resolve, reject })
87
90
  }, duration)
88
- } catch (_) {
89
- callAsyncFail(reject, error, options)
91
+ } catch (err) {
92
+ return handle.fail({
93
+ errMsg: err.message
94
+ }, { resolve, reject })
90
95
  }
91
96
  })
92
97
  }
@@ -0,0 +1,4 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ // 置顶
4
+ export const setTopBarText = /* @__PURE__ */ temporarilyNotSupport('setTopBarText')
@@ -1,11 +1,9 @@
1
- // eslint-disable-next-line import/no-duplicates
2
- import { Current } from '@tarojs/runtime'
3
- // eslint-disable-next-line import/no-duplicates
4
- import { eventCenter } from '@tarojs/runtime/dist/runtime.esm'
1
+ import { Current } from '@tarojs/runtime' // eslint-disable-line import/no-duplicates
2
+ import { eventCenter } from '@tarojs/runtime/dist/runtime.esm' // eslint-disable-line import/no-duplicates
5
3
 
6
4
  import { callAsyncFail, callAsyncSuccess } from '../utils'
7
5
 
8
- import type Taro from '@tarojs/api'
6
+ import type Taro from '@tarojs/taro/types'
9
7
 
10
8
  interface ShowTabBar {
11
9
  type: 'show'
@@ -0,0 +1,20 @@
1
+ import { temporarilyNotSupport } from '../utils'
2
+
3
+ import type Taro from '@tarojs/taro/types'
4
+
5
+ /**
6
+ * 设置窗口大小,该接口仅适用于 PC 平台,使用细则请参见指南
7
+ */
8
+ export const setWindowSize = /* @__PURE__ */ temporarilyNotSupport('setWindowSize')
9
+
10
+ /**
11
+ * 监听窗口尺寸变化事件
12
+ */
13
+ export const onWindowResize: typeof Taro.onWindowResize = /* @__PURE__ */ temporarilyNotSupport('onWindowResize')
14
+
15
+ /**
16
+ * 取消监听窗口尺寸变化事件
17
+ */
18
+ export const offWindowResize: typeof Taro.offWindowResize = /* @__PURE__ */ temporarilyNotSupport('offWindowResize')
19
+
20
+ export const checkIsPictureInPictureActive = /* @__PURE__ */ temporarilyNotSupport('checkIsPictureInPictureActive')