@tarojs/taro-h5 3.6.2 → 3.6.4
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/base/index.d.ts +1 -0
- package/dist/api/base/index.js +1 -0
- package/dist/api/base/index.js.map +1 -1
- package/dist/api/media/image/previewImage.js +4 -7
- package/dist/api/media/image/previewImage.js.map +1 -1
- package/dist/api/taro.d.ts +8 -2
- package/dist/api/taro.js +38 -7
- package/dist/api/taro.js.map +1 -1
- package/dist/index.cjs.d.ts +9 -2
- package/dist/index.cjs.js +43 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.d.ts +9 -2
- package/dist/index.esm.js +43 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/utils/handler.js +0 -3
- package/dist/utils/handler.js.map +1 -1
- package/package.json +23 -9
- package/types/component.d.ts +6 -0
- package/types/define.d.ts +0 -2
package/dist/index.esm.d.ts
CHANGED
|
@@ -3,9 +3,15 @@ import { AppConfig } from "@tarojs/api";
|
|
|
3
3
|
import { history } from "@tarojs/router";
|
|
4
4
|
declare const Behavior: any, getEnv: any, ENV_TYPE: any, Link: any, interceptors: any, Current: any, options: any, eventCenter: any, Events: any, preload: any;
|
|
5
5
|
declare const taro: typeof Taro;
|
|
6
|
-
declare const initPxTransform: any;
|
|
7
6
|
declare const requirePlugin: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
8
|
-
declare const
|
|
7
|
+
declare const initPxTransform: ({ designWidth, deviceRatio, baseFontSize, unitPrecision, targetUnit }: {
|
|
8
|
+
designWidth?: number | undefined;
|
|
9
|
+
deviceRatio?: TaroGeneral.TDeviceRatio | undefined;
|
|
10
|
+
baseFontSize?: number | undefined;
|
|
11
|
+
unitPrecision?: number | undefined;
|
|
12
|
+
targetUnit?: string | undefined;
|
|
13
|
+
}) => void;
|
|
14
|
+
declare const pxTransform: (size?: number) => any;
|
|
9
15
|
declare const canIUseWebp: () => boolean;
|
|
10
16
|
// 广告
|
|
11
17
|
declare const createRewardedVideoAd: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
@@ -23,6 +29,7 @@ declare const getOpenUserInfo: (option?: {}, ...args: any[]) => Promise<Partial<
|
|
|
23
29
|
declare const env: {
|
|
24
30
|
FRAMEWORK: string | undefined;
|
|
25
31
|
TARO_ENV: string | undefined;
|
|
32
|
+
TARO_PLATFORM: string | undefined;
|
|
26
33
|
TARO_VERSION: string | undefined;
|
|
27
34
|
};
|
|
28
35
|
declare const canIUse: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
package/dist/index.esm.js
CHANGED
|
@@ -7,8 +7,7 @@ import { hooks, Current as Current$1 } from '@tarojs/runtime';
|
|
|
7
7
|
import { fromByteArray, toByteArray } from 'base64-js';
|
|
8
8
|
import { getMobileDetect, setTitle } from '@tarojs/router/dist/utils/navigate';
|
|
9
9
|
import { parse, stringify } from 'query-string';
|
|
10
|
-
import {
|
|
11
|
-
import { defineCustomElement as defineCustomElement$1 } from '@tarojs/components/dist/components/taro-swiper-item-core';
|
|
10
|
+
import { defineCustomElementTaroSwiperCore, defineCustomElementTaroSwiperItemCore } from '@tarojs/components/dist/components';
|
|
12
11
|
import 'whatwg-fetch';
|
|
13
12
|
import jsonpRetry from 'jsonp-retry';
|
|
14
13
|
|
|
@@ -37,9 +36,6 @@ class MethodHandler {
|
|
|
37
36
|
else {
|
|
38
37
|
res.errMsg = `${this.methodName}:fail ${res.errMsg}`;
|
|
39
38
|
}
|
|
40
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
41
|
-
console.error(res.errMsg);
|
|
42
|
-
}
|
|
43
39
|
isFunction(this.__fail) && this.__fail(res);
|
|
44
40
|
isFunction(this.__complete) && this.__complete(res);
|
|
45
41
|
const { resolve = Promise.resolve.bind(Promise), reject = Promise.reject.bind(Promise) } = promise;
|
|
@@ -849,6 +845,7 @@ const getEnterOptionsSync = () => launchOptions;
|
|
|
849
845
|
const env = {
|
|
850
846
|
FRAMEWORK: process.env.FRAMEWORK,
|
|
851
847
|
TARO_ENV: process.env.TARO_ENV,
|
|
848
|
+
TARO_PLATFORM: process.env.TARO_PLATFORM,
|
|
852
849
|
TARO_VERSION: process.env.TARO_VERSION,
|
|
853
850
|
};
|
|
854
851
|
const canIUse = temporarilyNotSupport('canIUse');
|
|
@@ -2353,11 +2350,9 @@ const getImageInfo = (options) => {
|
|
|
2353
2350
|
* 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
|
|
2354
2351
|
*/
|
|
2355
2352
|
const previewImage = (options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
defineCustomElement$1();
|
|
2360
|
-
}
|
|
2353
|
+
// TODO 改为通过 window.__taroAppConfig 获取配置的 Swiper 插件创建节点
|
|
2354
|
+
defineCustomElementTaroSwiperCore();
|
|
2355
|
+
defineCustomElementTaroSwiperItemCore();
|
|
2361
2356
|
function loadImage(url, loadFail) {
|
|
2362
2357
|
return new Promise((resolve) => {
|
|
2363
2358
|
const item = document.createElement('taro-swiper-item-core');
|
|
@@ -5417,7 +5412,7 @@ const createMediaQueryObserver = () => {
|
|
|
5417
5412
|
return new MediaQueryObserver();
|
|
5418
5413
|
};
|
|
5419
5414
|
|
|
5420
|
-
const { Behavior, getEnv, ENV_TYPE, Link, interceptors,
|
|
5415
|
+
const { Behavior, getEnv, ENV_TYPE, Link, interceptors, Current, options, eventCenter, Events, preload } = Taro;
|
|
5421
5416
|
const taro = {
|
|
5422
5417
|
// @ts-ignore
|
|
5423
5418
|
Behavior,
|
|
@@ -5440,16 +5435,48 @@ const taro = {
|
|
|
5440
5435
|
getCurrentPages,
|
|
5441
5436
|
switchTab
|
|
5442
5437
|
};
|
|
5443
|
-
const initPxTransform = getInitPxTransform(taro);
|
|
5444
5438
|
const requirePlugin = permanentlyNotSupport('requirePlugin');
|
|
5445
|
-
|
|
5446
|
-
|
|
5439
|
+
function getConfig() {
|
|
5440
|
+
var _a;
|
|
5441
|
+
if (this === null || this === void 0 ? void 0 : this.pxTransformConfig)
|
|
5442
|
+
return this.pxTransformConfig;
|
|
5443
|
+
return ((_a = taro).config || (_a.config = {}));
|
|
5444
|
+
}
|
|
5445
|
+
const initPxTransform = function ({ designWidth = 750, deviceRatio = {
|
|
5446
|
+
640: 2.34 / 2,
|
|
5447
|
+
750: 1,
|
|
5448
|
+
828: 1.81 / 2
|
|
5449
|
+
}, baseFontSize = 20, unitPrecision = 5, targetUnit = 'rem' }) {
|
|
5450
|
+
const config = getConfig.call(this);
|
|
5451
|
+
config.designWidth = designWidth;
|
|
5452
|
+
config.deviceRatio = deviceRatio;
|
|
5453
|
+
config.baseFontSize = baseFontSize;
|
|
5454
|
+
config.targetUnit = targetUnit;
|
|
5455
|
+
config.unitPrecision = unitPrecision;
|
|
5456
|
+
};
|
|
5457
|
+
const pxTransform = function (size = 0) {
|
|
5458
|
+
const config = getConfig.call(this);
|
|
5447
5459
|
const baseFontSize = config.baseFontSize || 20;
|
|
5448
5460
|
const designWidth = (((input = 0) => isFunction(config.designWidth)
|
|
5449
5461
|
? config.designWidth(input)
|
|
5450
5462
|
: config.designWidth))(size);
|
|
5451
|
-
|
|
5452
|
-
|
|
5463
|
+
if (!(designWidth in config.deviceRatio)) {
|
|
5464
|
+
throw new Error(`deviceRatio 配置中不存在 ${designWidth} 的设置!`);
|
|
5465
|
+
}
|
|
5466
|
+
const formatSize = ~~size;
|
|
5467
|
+
let rootValue = 1 / config.deviceRatio[designWidth] * 2;
|
|
5468
|
+
switch (config === null || config === void 0 ? void 0 : config.targetUnit) {
|
|
5469
|
+
case 'vw':
|
|
5470
|
+
rootValue *= 0.5 * designWidth / 100;
|
|
5471
|
+
break;
|
|
5472
|
+
default:
|
|
5473
|
+
rootValue *= baseFontSize;
|
|
5474
|
+
}
|
|
5475
|
+
let val = formatSize / rootValue;
|
|
5476
|
+
if (config.unitPrecision >= 0 && config.unitPrecision <= 100) {
|
|
5477
|
+
val = val.toFixed(config.unitPrecision);
|
|
5478
|
+
}
|
|
5479
|
+
return val + (config === null || config === void 0 ? void 0 : config.targetUnit);
|
|
5453
5480
|
};
|
|
5454
5481
|
const canIUseWebp = function () {
|
|
5455
5482
|
const canvas = document.createElement('canvas');
|
|
@@ -5459,7 +5486,6 @@ taro.requirePlugin = requirePlugin;
|
|
|
5459
5486
|
taro.getApp = getApp;
|
|
5460
5487
|
taro.pxTransform = pxTransform;
|
|
5461
5488
|
taro.initPxTransform = initPxTransform;
|
|
5462
|
-
// @ts-ignore
|
|
5463
5489
|
taro.canIUseWebp = canIUseWebp;
|
|
5464
5490
|
|
|
5465
5491
|
export { Behavior, Current, ENV_TYPE, Events, Link, addCard, addFileToFavorites, addInterceptor, addPhoneCalendar, addPhoneContact, addPhoneRepeatCalendar, addVideoToFavorites, advancedGeneralIdentify, animalClassify, arrayBufferToBase64, authPrivateMessage, authorize, authorizeForMiniProgram, base64ToArrayBuffer, canIUse, canIUseWebp, canvasGetImageData, canvasPutImageData, canvasToTempFilePath, carClassify, checkIsAddedToMyMiniProgram, checkIsOpenAccessibility, checkIsSoterEnrolledInDevice, checkIsSupportFacialRecognition, checkIsSupportSoterAuthentication, checkSession, chooseAddress, chooseContact, chooseImage, chooseInvoice, chooseInvoiceTitle, chooseLicensePlate, chooseLocation, chooseMedia, chooseMessageFile, choosePoi, chooseVideo, clearStorage, clearStorageSync, closeBLEConnection, closeBluetoothAdapter, closeSocket, cloud, compressImage, compressVideo, connectSocket, connectWifi, createAnimation, createAudioContext, createBLEConnection, createBLEPeripheralServer, createBufferURL, createCameraContext, createCanvasContext, createInnerAudioContext, createIntersectionObserver, createInterstitialAd, createLivePlayerContext, createLivePusherContext, createMapContext, createMediaAudioPlayer, createMediaContainer, createMediaQueryObserver, createMediaRecorder, createOffscreenCanvas, createRewardedVideoAd, createSelectorQuery, createTCPSocket, createUDPSocket, createVKSession, createVideoContext, createVideoDecoder, createWebAudioContext, createWorker, taro as default, disableAlertBeforeUnload, dishClassify, downloadFile, enableAlertBeforeUnload, env, eventCenter, exitMiniProgram, exitVoIPChat, faceDetect, faceVerifyForPay, getAccountInfoSync, getApp, getAppAuthorizeSetting, getAppBaseInfo, getAvailableAudioSources, getBLEDeviceCharacteristics, getBLEDeviceRSSI, getBLEDeviceServices, getBLEMTU, getBackgroundAudioManager, getBackgroundAudioPlayerState, getBackgroundFetchData, getBackgroundFetchToken, getBatteryInfo, getBatteryInfoSync, getBeacons, getBluetoothAdapterState, getBluetoothDevices, getChannelsLiveInfo, getChannelsLiveNoticeInfo, getClipboardData, getConnectedBluetoothDevices, getConnectedWifi, getCurrentInstance, getDeviceInfo, getEnterOptionsSync, getEnv, getExptInfoSync, getExtConfig, getExtConfigSync, getFileInfo, getFileSystemManager, getFuzzyLocation, getGroupEnterInfo, getHCEState, getImageInfo, getLaunchOptionsSync, getLocalIPAddress, getLocation, getLogManager, getMenuButtonBoundingClientRect, getNFCAdapter, getNetworkType, getOpenUserInfo, getPerformance, getRandomValues, getRealtimeLogManager, getRecorderManager, getSavedFileInfo, getSavedFileList, getScreenBrightness, getSelectedTextRange, getSetting, getShareInfo, getStorage, getStorageInfo, getStorageInfoSync, getStorageSync, getSwanId, getSystemInfo, getSystemInfoAsync, getSystemInfoSync, getSystemSetting, getUpdateManager, getUserCryptoManager, getUserInfo, getUserProfile, getVideoInfo, getWeRunData, getWifiList, getWindowInfo, hideHomeButton, hideKeyboard, hideLoading, hideNavigationBarLoading, hideShareMenu, hideTabBar, hideTabBarRedDot, hideToast, imageAudit, initFaceDetect, initPxTransform, initTabBarApis, interceptors, isBluetoothDevicePaired, isVKSupport, joinVoIPChat, loadFontFace, login, logoClassify, makeBluetoothPair, makePhoneCall, navigateBackMiniProgram, navigateBackSmartProgram, navigateToMiniProgram, navigateToSmartGameProgram, navigateToSmartProgram, nextTick, notifyBLECharacteristicValueChange, objectDetectIdentify, ocrBankCard, ocrDrivingLicense, ocrIdCard, ocrVehicleLicense, offAccelerometerChange, offAppHide, offAppShow, offAudioInterruptionBegin, offAudioInterruptionEnd, offBLECharacteristicValueChange, offBLEConnectionStateChange, offBLEMTUChange, offBLEPeripheralConnectionStateChanged, offBeaconServiceChange, offBeaconUpdate, offBluetoothAdapterStateChange, offBluetoothDeviceFound, offCompassChange, offCopyUrl, offDeviceMotionChange, offError, offGetWifiList, offGyroscopeChange, offHCEMessage, offKeyboardHeightChange, offLocalServiceDiscoveryStop, offLocalServiceFound, offLocalServiceLost, offLocalServiceResolveFail, offLocationChange, offLocationChangeError, offMemoryWarning, offNetworkStatusChange, offNetworkWeakChange, offPageNotFound, offThemeChange, offUnhandledRejection, offUserCaptureScreen, offVoIPChatInterrupted, offVoIPChatMembersChanged, offVoIPChatStateChanged, offVoIPVideoMembersChanged, offWifiConnected, offWindowResize, onAccelerometerChange, onAppHide, onAppShow, onAudioInterruptionBegin, onAudioInterruptionEnd, onBLECharacteristicValueChange, onBLEConnectionStateChange, onBLEMTUChange, onBLEPeripheralConnectionStateChanged, onBackgroundAudioPause, onBackgroundAudioPlay, onBackgroundAudioStop, onBackgroundFetchData, onBeaconServiceChange, onBeaconUpdate, onBluetoothAdapterStateChange, onBluetoothDeviceFound, onCompassChange, onCopyUrl, onDeviceMotionChange, onError, onGetWifiList, onGyroscopeChange, onHCEMessage, onKeyboardHeightChange, onLocalServiceDiscoveryStop, onLocalServiceFound, onLocalServiceLost, onLocalServiceResolveFail, onLocationChange, onLocationChangeError, onMemoryWarning, onNetworkStatusChange, onNetworkWeakChange, onPageNotFound, onSocketClose, onSocketError, onSocketMessage, onSocketOpen, onThemeChange, onUnhandledRejection, onUserCaptureScreen, onVoIPChatInterrupted, onVoIPChatMembersChanged, onVoIPChatSpeakersChanged, onVoIPChatStateChanged, onVoIPVideoMembersChanged, onWifiConnected, onWifiConnectedWithPartialInfo, onWindowResize, openAppAuthorizeSetting, openBluetoothAdapter, openBusinessView, openCard, openChannelsActivity, openChannelsEvent, openChannelsLive, openCustomerServiceChat, openDocument, openEmbeddedMiniProgram, openLocation, openSetting, openSystemBluetoothSetting, openVideoEditor, options, pageScrollTo, pauseBackgroundAudio, pauseVoice, plantClassify, playBackgroundAudio, playVoice, pluginLogin, preload, preloadSubPackage, previewImage, previewMedia, pxTransform, readBLECharacteristicValue, removeSavedFile, removeStorage, removeStorageSync, removeTabBarBadge, reportAnalytics, reportEvent, reportMonitor, reportPerformance, request, requestOrderPayment, requestPayment, requestPolymerPayment, requestSubscribeMessage, requirePlugin, reserveChannelsLive, revokeBufferURL, saveFile, saveFileToDisk, saveImageToPhotosAlbum, saveVideoToPhotosAlbum, scanCode, seekBackgroundAudio, sendHCEMessage, sendSocketMessage, setBLEMTU, setBackgroundColor, setBackgroundFetchToken, setBackgroundTextStyle, setClipboardData, setEnable1v1Chat, setEnableDebug, setInnerAudioOption, setKeepScreenOn, setNavigationBarColor, setNavigationBarTitle, setPageInfo, setScreenBrightness, setStorage, setStorageSync, setTabBarBadge, setTabBarItem, setTabBarStyle, setTopBarText, setVisualEffectOnCapture, setWifiList, setWindowSize, shareFileMessage, shareToWeRun, shareVideoMessage, showActionSheet, showLoading, showModal, showNavigationBarLoading, showRedPackage, showShareImageMenu, showShareMenu, showTabBar, showTabBarRedDot, showToast, startAccelerometer, startBeaconDiscovery, startBluetoothDevicesDiscovery, startCompass, startDeviceMotionListening, startFacialRecognitionVerify, startFacialRecognitionVerifyAndUploadVideo, startGyroscope, startHCE, startLocalServiceDiscovery, startLocationUpdate, startLocationUpdateBackground, startPullDownRefresh, startRecord, startSoterAuthentication, startWifi, stopAccelerometer, stopBackgroundAudio, stopBeaconDiscovery, stopBluetoothDevicesDiscovery, stopCompass, stopDeviceMotionListening, stopFaceDetect, stopGyroscope, stopHCE, stopLocalServiceDiscovery, stopLocationUpdate, stopPullDownRefresh, stopRecord, stopVoice, stopWifi, subscribeVoIPVideoMembers, textReview, textToAudio, updateShareMenu, updateVoIPChatMuteConfig, updateWeChatApp, uploadFile, vibrateLong, vibrateShort, writeBLECharacteristicValue };
|