@tarojs/taro-h5 3.5.0-beta.2 → 3.5.0-beta.5
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/index.cjs.js +95 -67
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +82 -55
- package/dist/index.esm.js.map +1 -1
- package/dist/{api → src/api}/ad/index.js +0 -0
- package/dist/{api → src/api}/ai/facial.js +0 -0
- package/dist/{api → src/api}/ai/index.js +0 -0
- package/dist/{api → src/api}/ai/visual.js +0 -0
- package/dist/{api → src/api}/alipay/index.js +0 -0
- package/dist/{api → src/api}/base/crypto.js +0 -0
- package/dist/{api → src/api}/base/debug.js +0 -0
- package/dist/{api → src/api}/base/index.js +0 -0
- package/dist/{api → src/api}/base/performance.js +0 -0
- package/dist/{api → src/api}/base/system.js +0 -0
- package/dist/{api → src/api}/base/update.js +0 -0
- package/dist/src/api/base/weapp/app-event.js +69 -0
- package/dist/{api → src/api}/base/weapp/life-cycle.js +0 -0
- package/dist/{api → src/api}/canvas/CanvasContext.js +0 -0
- package/dist/{api → src/api}/canvas/canvasGetImageData.js +0 -0
- package/dist/{api → src/api}/canvas/canvasPutImageData.js +0 -0
- package/dist/{api → src/api}/canvas/canvasToTempFilePath.js +0 -0
- package/dist/{api → src/api}/canvas/createCanvasContext.js +0 -0
- package/dist/{api → src/api}/canvas/index.js +0 -0
- package/dist/{api → src/api}/cloud/index.js +0 -0
- package/dist/{api → src/api}/data-analysis/index.js +0 -0
- package/dist/{api → src/api}/device/accelerometer.js +0 -0
- package/dist/{api → src/api}/device/accessibility.js +0 -0
- package/dist/{api → src/api}/device/battery.js +0 -0
- package/dist/{api → src/api}/device/bluetooth-ble.js +0 -0
- package/dist/{api → src/api}/device/bluetooth-peripheral.js +0 -0
- package/dist/{api → src/api}/device/bluetooth.js +0 -0
- package/dist/{api → src/api}/device/calendar.js +0 -0
- package/dist/{api → src/api}/device/clipboard.js +0 -0
- package/dist/{api → src/api}/device/compass.js +0 -0
- package/dist/{api → src/api}/device/contact.js +0 -0
- package/dist/{api → src/api}/device/crypto.js +0 -0
- package/dist/{api → src/api}/device/gyroscope.js +0 -0
- package/dist/{api → src/api}/device/iBeacon.js +0 -0
- package/dist/{api → src/api}/device/index.js +0 -0
- package/dist/{api → src/api}/device/keyboard.js +0 -0
- package/dist/{api → src/api}/device/memory.js +0 -0
- package/dist/{api → src/api}/device/motion.js +0 -0
- package/dist/{api → src/api}/device/network.js +0 -0
- package/dist/{api → src/api}/device/nfc.js +0 -0
- package/dist/{api → src/api}/device/phone.js +0 -0
- package/dist/{api → src/api}/device/scan.js +0 -0
- package/dist/{api → src/api}/device/screen.js +0 -0
- package/dist/{api → src/api}/device/vibrate.js +5 -7
- package/dist/{api → src/api}/device/wifi.js +0 -0
- package/dist/{api → src/api}/ext/index.js +0 -0
- package/dist/{api → src/api}/files/index.js +0 -0
- package/dist/{api → src/api}/framework/index.js +0 -0
- package/dist/{api → src/api}/index.js +0 -0
- package/dist/{api → src/api}/location/chooseLocation.js +0 -0
- package/dist/{api → src/api}/location/getLocation.js +0 -0
- package/dist/{api → src/api}/location/index.js +1 -0
- package/dist/{api → src/api}/media/EditorContext.js +0 -0
- package/dist/{api → src/api}/media/audio/InnerAudioContext.js +1 -1
- package/dist/{api → src/api}/media/audio/index.js +0 -0
- package/dist/{api → src/api}/media/background-audio/BackgroundAudioManager.js +0 -0
- package/dist/{api → src/api}/media/background-audio/index.js +0 -0
- package/dist/{api → src/api}/media/camera.js +0 -0
- package/dist/{api → src/api}/media/image/chooseImage.js +0 -0
- package/dist/{api → src/api}/media/image/getImageInfo.js +0 -0
- package/dist/{api → src/api}/media/image/index.js +0 -0
- package/dist/{api → src/api}/media/image/previewImage.js +0 -0
- package/dist/{api → src/api}/media/index.js +0 -0
- package/dist/{api → src/api}/media/live.js +0 -0
- package/dist/{api → src/api}/media/map.js +0 -0
- package/dist/{api → src/api}/media/media-recorder.js +0 -0
- package/dist/{api → src/api}/media/recorder.js +0 -0
- package/dist/{api → src/api}/media/video/index.js +0 -0
- package/dist/{api → src/api}/media/video-decoder.js +0 -0
- package/dist/{api → src/api}/media/video-processing.js +0 -0
- package/dist/{api → src/api}/media/voip.js +0 -0
- package/dist/{api → src/api}/navigate/index.js +0 -0
- package/dist/{api → src/api}/network/download.js +0 -0
- package/dist/{api → src/api}/network/index.js +0 -0
- package/dist/{api → src/api}/network/mdns.js +0 -0
- package/dist/{api → src/api}/network/request/index.js +0 -0
- package/dist/{api → src/api}/network/tcp.js +0 -0
- package/dist/{api → src/api}/network/udp.js +0 -0
- package/dist/{api → src/api}/network/upload.js +0 -0
- package/dist/{api → src/api}/network/utils.js +0 -0
- package/dist/{api → src/api}/network/websocket/index.js +0 -0
- package/dist/{api → src/api}/network/websocket/socketTask.js +0 -0
- package/dist/{api → src/api}/open-api/account.js +0 -0
- package/dist/{api → src/api}/open-api/address.js +0 -0
- package/dist/{api → src/api}/open-api/authorize.js +0 -0
- package/dist/{api → src/api}/open-api/card.js +0 -0
- package/dist/{api → src/api}/open-api/channels-live.js +0 -0
- package/dist/{api → src/api}/open-api/customer-service.js +0 -0
- package/dist/{api → src/api}/open-api/facial.js +0 -0
- package/dist/{api → src/api}/open-api/favorites.js +0 -0
- package/dist/{api → src/api}/open-api/group.js +0 -0
- package/dist/{api → src/api}/open-api/index.js +0 -0
- package/dist/{api → src/api}/open-api/invoice.js +0 -0
- package/dist/{api → src/api}/open-api/license-plate.js +0 -0
- package/dist/{api → src/api}/open-api/login.js +0 -0
- package/dist/{api → src/api}/open-api/red-package.js +0 -0
- package/dist/{api → src/api}/open-api/settings.js +0 -0
- package/dist/{api → src/api}/open-api/soter.js +0 -0
- package/dist/{api → src/api}/open-api/subscribe-message.js +0 -0
- package/dist/{api → src/api}/open-api/user-info.js +0 -0
- package/dist/{api → src/api}/open-api/werun.js +0 -0
- package/dist/{api → src/api}/payment/index.js +0 -0
- package/dist/{api → src/api}/route/index.js +0 -0
- package/dist/{api → src/api}/share/index.js +0 -0
- package/dist/{api → src/api}/storage/background-fetch.js +0 -0
- package/dist/{api → src/api}/storage/index.js +0 -0
- package/dist/{api → src/api}/swan/index.js +0 -0
- package/dist/{api → src/api}/taro.js +0 -0
- package/dist/{api → src/api}/ui/animation/index.js +0 -0
- package/dist/{api → src/api}/ui/background.js +0 -0
- package/dist/{api → src/api}/ui/custom-component.js +0 -0
- package/dist/{api → src/api}/ui/fonts.js +0 -0
- package/dist/{api → src/api}/ui/index.js +0 -0
- package/dist/{api → src/api}/ui/interaction/actionSheet.js +0 -0
- package/dist/{api → src/api}/ui/interaction/index.js +0 -0
- package/dist/{api → src/api}/ui/interaction/modal.js +1 -0
- package/dist/{api → src/api}/ui/interaction/toast.js +0 -0
- package/dist/{api → src/api}/ui/menu.js +0 -0
- package/dist/{api → src/api}/ui/navigation-bar/index.js +0 -0
- package/dist/{api → src/api}/ui/pull-down-refresh.js +0 -0
- package/dist/{api → src/api}/ui/scroll/index.js +0 -0
- package/dist/{api → src/api}/ui/sticky.js +0 -0
- package/dist/{api → src/api}/ui/tab-bar.js +0 -0
- package/dist/{api → src/api}/ui/window.js +0 -0
- package/dist/{api → src/api}/worker/index.js +0 -0
- package/dist/{api → src/api}/wxml/index.js +0 -0
- package/dist/{api → src/api}/wxml/nodesRef.js +0 -0
- package/dist/{api → src/api}/wxml/selectorQuery.js +1 -1
- package/dist/{index.js → src/index.js} +0 -0
- package/dist/{utils → src/utils}/animation.js +0 -0
- package/dist/{utils → src/utils}/handler.js +0 -0
- package/dist/{utils → src/utils}/index.js +0 -0
- package/dist/{utils → src/utils}/lodash.js +0 -0
- package/dist/{utils → src/utils}/valid.js +0 -0
- package/dist/taroApis.js +1 -1
- package/dist/types/type.js +2 -0
- package/package.json +16 -16
- package/src/api/base/weapp/app-event.ts +64 -4
- package/src/api/device/vibrate.ts +6 -8
- package/src/api/location/index.ts +1 -0
- package/src/api/media/audio/InnerAudioContext.ts +1 -1
- package/src/api/network/websocket/socketTask.ts +1 -1
- package/src/api/ui/interaction/modal.ts +1 -0
- package/src/api/wxml/selectorQuery.ts +1 -1
- package/types/api.d.ts +4 -0
- package/types/define.d.ts +2 -0
- package/types/index.d.ts +3 -0
- package/types/overlay.d.ts +9 -0
- package/types/type.ts +32 -0
- package/LICENSE +0 -21
- package/dist/api/base/weapp/app-event.js +0 -18
|
@@ -1,4 +1,39 @@
|
|
|
1
|
+
import Taro from '@tarojs/api'
|
|
2
|
+
import { parse } from 'query-string'
|
|
3
|
+
|
|
1
4
|
import { temporarilyNotSupport } from '../../../utils'
|
|
5
|
+
import { CallbackManager } from '../../../utils/handler'
|
|
6
|
+
|
|
7
|
+
const appShowCallbackManager = new CallbackManager()
|
|
8
|
+
const appHideCallbackManager = new CallbackManager()
|
|
9
|
+
|
|
10
|
+
const getApp = () => {
|
|
11
|
+
const path = Taro.Current.page?.path
|
|
12
|
+
return {
|
|
13
|
+
/** 小程序切前台的路径 */
|
|
14
|
+
path: path?.substring(0, path.indexOf('?')),
|
|
15
|
+
/** 小程序切前台的 query 参数 */
|
|
16
|
+
query: parse(location.search),
|
|
17
|
+
/** 来源信息。 */
|
|
18
|
+
referrerInfo: {},
|
|
19
|
+
/** 小程序切前台的[场景值](https://developers.weixin.qq.com/miniprogram/dev/framework/app-service/scene.html) */
|
|
20
|
+
scene: 0,
|
|
21
|
+
/** shareTicket,详见[获取更多转发信息](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/share.html) */
|
|
22
|
+
shareTicket: ''
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const appShowListener = () => {
|
|
27
|
+
if (document.visibilityState !== 'hidden') {
|
|
28
|
+
appShowCallbackManager.trigger(getApp())
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const appHideListener = () => {
|
|
33
|
+
if (document.visibilityState === 'hidden') {
|
|
34
|
+
appHideCallbackManager.trigger(getApp())
|
|
35
|
+
}
|
|
36
|
+
}
|
|
2
37
|
|
|
3
38
|
// 应用级事件
|
|
4
39
|
export const onUnhandledRejection = temporarilyNotSupport('onUnhandledRejection')
|
|
@@ -7,13 +42,38 @@ export const onPageNotFound = temporarilyNotSupport('onPageNotFound')
|
|
|
7
42
|
export const onError = temporarilyNotSupport('onError')
|
|
8
43
|
export const onAudioInterruptionEnd = temporarilyNotSupport('onAudioInterruptionEnd')
|
|
9
44
|
export const onAudioInterruptionBegin = temporarilyNotSupport('onAudioInterruptionBegin')
|
|
10
|
-
|
|
11
|
-
export const
|
|
45
|
+
|
|
46
|
+
export const onAppShow: typeof Taro.onAppShow = callback => {
|
|
47
|
+
appShowCallbackManager.add(callback)
|
|
48
|
+
if (appShowCallbackManager.count() === 1) {
|
|
49
|
+
window.addEventListener('visibilitychange', appShowListener)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export const onAppHide: typeof Taro.onAppHide = callback => {
|
|
54
|
+
appHideCallbackManager.add(callback)
|
|
55
|
+
if (appHideCallbackManager.count() === 1) {
|
|
56
|
+
window.addEventListener('visibilitychange', appHideListener)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
12
60
|
export const offUnhandledRejection = temporarilyNotSupport('offUnhandledRejection')
|
|
13
61
|
export const offThemeChange = temporarilyNotSupport('offThemeChange')
|
|
14
62
|
export const offPageNotFound = temporarilyNotSupport('offPageNotFound')
|
|
15
63
|
export const offError = temporarilyNotSupport('offError')
|
|
16
64
|
export const offAudioInterruptionEnd = temporarilyNotSupport('offAudioInterruptionEnd')
|
|
17
65
|
export const offAudioInterruptionBegin = temporarilyNotSupport('offAudioInterruptionBegin')
|
|
18
|
-
|
|
19
|
-
export const
|
|
66
|
+
|
|
67
|
+
export const offAppShow: typeof Taro.offWindowResize = callback => {
|
|
68
|
+
appShowCallbackManager.remove(callback)
|
|
69
|
+
if (appShowCallbackManager.count() === 0) {
|
|
70
|
+
window.removeEventListener('visibilitychange', appShowListener)
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const offAppHide: typeof Taro.offWindowResize = callback => {
|
|
75
|
+
appHideCallbackManager.remove(callback)
|
|
76
|
+
if (appHideCallbackManager.count() === 0) {
|
|
77
|
+
window.removeEventListener('visibilitychange', appHideListener)
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -2,11 +2,11 @@ import Taro from '@tarojs/api'
|
|
|
2
2
|
|
|
3
3
|
import { MethodHandler } from '../../utils/handler'
|
|
4
4
|
|
|
5
|
-
const vibrator = function vibrator (mm) {
|
|
5
|
+
const vibrator = function vibrator (mm: number | number[]) {
|
|
6
6
|
try {
|
|
7
7
|
return window.navigator.vibrate(mm)
|
|
8
8
|
} catch (e) {
|
|
9
|
-
console.warn('当前浏览器不支持vibrate')
|
|
9
|
+
console.warn('当前浏览器不支持 vibrate。')
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
@@ -15,11 +15,10 @@ const vibrator = function vibrator (mm) {
|
|
|
15
15
|
*/
|
|
16
16
|
export const vibrateShort: typeof Taro.vibrateShort = ({ success, fail, complete } = {}) => {
|
|
17
17
|
const handle = new MethodHandler({ name: 'vibrateShort', success, fail, complete })
|
|
18
|
-
if (vibrator) {
|
|
19
|
-
vibrator(15)
|
|
18
|
+
if (vibrator(15)) {
|
|
20
19
|
return handle.success()
|
|
21
20
|
} else {
|
|
22
|
-
return handle.fail()
|
|
21
|
+
return handle.fail({ errMsg: 'style is not support' })
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
|
|
@@ -28,10 +27,9 @@ export const vibrateShort: typeof Taro.vibrateShort = ({ success, fail, complete
|
|
|
28
27
|
*/
|
|
29
28
|
export const vibrateLong: typeof Taro.vibrateLong = ({ success, fail, complete } = {}) => {
|
|
30
29
|
const handle = new MethodHandler({ name: 'vibrateLong', success, fail, complete })
|
|
31
|
-
if (vibrator) {
|
|
32
|
-
vibrator(400)
|
|
30
|
+
if (vibrator(400)) {
|
|
33
31
|
return handle.success()
|
|
34
32
|
} else {
|
|
35
|
-
return handle.fail()
|
|
33
|
+
return handle.fail({ errMsg: 'style is not support' })
|
|
36
34
|
}
|
|
37
35
|
}
|
|
@@ -18,5 +18,6 @@ export const offLocationChange = temporarilyNotSupport('offLocationChange')
|
|
|
18
18
|
export { getLocation } from './getLocation'
|
|
19
19
|
|
|
20
20
|
export const choosePoi = temporarilyNotSupport('choosePoi')
|
|
21
|
+
export const getFuzzyLocation = temporarilyNotSupport('getFuzzyLocation')
|
|
21
22
|
|
|
22
23
|
export { chooseLocation } from './chooseLocation'
|
|
@@ -29,7 +29,7 @@ export class InnerAudioContext implements Taro.InnerAudioContext {
|
|
|
29
29
|
get duration () { return this.Instance?.duration || 0 }
|
|
30
30
|
set loop (e) { this.setProperty('loop', e) }
|
|
31
31
|
get loop () { return this.Instance?.loop || false }
|
|
32
|
-
get paused () { return this.Instance?.paused
|
|
32
|
+
get paused () { return this.Instance?.paused ?? true }
|
|
33
33
|
set src (e) { this.setProperty('src', e) }
|
|
34
34
|
get src () { return this.Instance?.src || '' }
|
|
35
35
|
set volume (e) { this.setProperty('volume', e) }
|
|
@@ -38,7 +38,7 @@ function filter (fields, dom?: HTMLElement, selector?: string) {
|
|
|
38
38
|
res.node = null
|
|
39
39
|
}
|
|
40
40
|
} else {
|
|
41
|
-
// TODO https://developers.weixin.qq.com/miniprogram/dev/
|
|
41
|
+
// TODO https://developers.weixin.qq.com/miniprogram/dev/api/ui/scroll/ScrollViewContext.html
|
|
42
42
|
// if (/^taro-scroll-view-core/i.test(tagName))
|
|
43
43
|
res.nodeCanvasType = ''
|
|
44
44
|
res.node = dom
|
package/types/api.d.ts
ADDED
package/types/index.d.ts
ADDED
package/types/type.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import Taro from '@tarojs/api'
|
|
2
|
+
|
|
3
|
+
namespace Router {
|
|
4
|
+
export interface Location {
|
|
5
|
+
path: string
|
|
6
|
+
search: string
|
|
7
|
+
hash: string
|
|
8
|
+
state: {
|
|
9
|
+
key: string
|
|
10
|
+
}
|
|
11
|
+
params: {
|
|
12
|
+
[key: string]: string
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
export interface RouterParams {
|
|
16
|
+
path: string
|
|
17
|
+
scene: number
|
|
18
|
+
params: {
|
|
19
|
+
[key: string]: string
|
|
20
|
+
}
|
|
21
|
+
shareTicket: string
|
|
22
|
+
referrerInfo: Record<string, any>
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface TaroH5 {
|
|
27
|
+
_$router: Router.Location
|
|
28
|
+
$router: Router.RouterParams
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const TaroH5: TaroH5 & typeof Taro = {} as any
|
|
32
|
+
export default TaroH5
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { temporarilyNotSupport } from '../../../utils';
|
|
2
|
-
// 应用级事件
|
|
3
|
-
export const onUnhandledRejection = temporarilyNotSupport('onUnhandledRejection');
|
|
4
|
-
export const onThemeChange = temporarilyNotSupport('onThemeChange');
|
|
5
|
-
export const onPageNotFound = temporarilyNotSupport('onPageNotFound');
|
|
6
|
-
export const onError = temporarilyNotSupport('onError');
|
|
7
|
-
export const onAudioInterruptionEnd = temporarilyNotSupport('onAudioInterruptionEnd');
|
|
8
|
-
export const onAudioInterruptionBegin = temporarilyNotSupport('onAudioInterruptionBegin');
|
|
9
|
-
export const onAppShow = temporarilyNotSupport('onAppShow');
|
|
10
|
-
export const onAppHide = temporarilyNotSupport('onAppHide');
|
|
11
|
-
export const offUnhandledRejection = temporarilyNotSupport('offUnhandledRejection');
|
|
12
|
-
export const offThemeChange = temporarilyNotSupport('offThemeChange');
|
|
13
|
-
export const offPageNotFound = temporarilyNotSupport('offPageNotFound');
|
|
14
|
-
export const offError = temporarilyNotSupport('offError');
|
|
15
|
-
export const offAudioInterruptionEnd = temporarilyNotSupport('offAudioInterruptionEnd');
|
|
16
|
-
export const offAudioInterruptionBegin = temporarilyNotSupport('offAudioInterruptionBegin');
|
|
17
|
-
export const offAppShow = temporarilyNotSupport('offAppShow');
|
|
18
|
-
export const offAppHide = temporarilyNotSupport('offAppHide');
|