@tarojs/taro-h5 3.6.4 → 3.6.5-alpha.1
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/ai/index.d.ts +2 -2
- package/dist/api/base/index.d.ts +7 -7
- package/dist/api/canvas/index.d.ts +4 -4
- package/dist/api/device/index.d.ts +23 -23
- package/dist/api/framework/index.js.map +1 -1
- package/dist/api/index.d.ts +24 -24
- package/dist/api/location/index.d.ts +2 -2
- package/dist/api/location/style.scss.js +2 -2
- package/dist/api/media/audio/InnerAudioContext.d.ts +1 -1
- package/dist/api/media/background-audio/BackgroundAudioManager.d.ts +1 -1
- package/dist/api/media/background-audio/index.d.ts +1 -1
- package/dist/api/media/image/index.d.ts +3 -3
- package/dist/api/media/index.d.ts +12 -12
- package/dist/api/network/index.d.ts +7 -7
- package/dist/api/open-api/index.d.ts +18 -18
- package/dist/api/storage/index.d.ts +1 -1
- package/dist/api/ui/index.d.ts +12 -12
- package/dist/api/wxml/IntersectionObserver.js +7 -7
- package/dist/api/wxml/IntersectionObserver.js.map +1 -1
- package/dist/api/wxml/MediaQueryObserver.js +2 -0
- package/dist/api/wxml/MediaQueryObserver.js.map +1 -1
- package/dist/api/wxml/nodesRef.d.ts +1 -1
- package/dist/api/wxml/selectorQuery.d.ts +1 -1
- package/dist/index.cjs.js +11 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.esm.js +11 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/utils/index.d.ts +3 -3
- package/package.json +8 -6
package/dist/api/ai/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./facial";
|
|
2
|
-
export * from "./visual";
|
|
1
|
+
export * from "./facial.js";
|
|
2
|
+
export * from "./visual.js";
|
package/dist/api/base/index.d.ts
CHANGED
|
@@ -8,10 +8,10 @@ declare const canIUse: (option?: {}, ...args: any[]) => Promise<Partial<TaroGene
|
|
|
8
8
|
declare function arrayBufferToBase64(arrayBuffer: ArrayBuffer): string;
|
|
9
9
|
declare function base64ToArrayBuffer(base64: string): Uint8Array;
|
|
10
10
|
export { env, canIUse, arrayBufferToBase64, base64ToArrayBuffer };
|
|
11
|
-
export * from "./crypto";
|
|
12
|
-
export * from "./debug";
|
|
13
|
-
export * from "./performance";
|
|
14
|
-
export * from "./system";
|
|
15
|
-
export * from "./update";
|
|
16
|
-
export * from "./weapp/app-event";
|
|
17
|
-
export * from "./weapp/life-cycle";
|
|
11
|
+
export * from "./crypto.js";
|
|
12
|
+
export * from "./debug.js";
|
|
13
|
+
export * from "./performance.js";
|
|
14
|
+
export * from "./system.js";
|
|
15
|
+
export * from "./update.js";
|
|
16
|
+
export * from "./weapp/app-event.js";
|
|
17
|
+
export * from "./weapp/life-cycle.js";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
declare const createOffscreenCanvas: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
3
3
|
export { createOffscreenCanvas };
|
|
4
4
|
/** 创建 canvas 的绘图上下文 CanvasContext 对象 */
|
|
5
|
-
export * from "./createCanvasContext";
|
|
5
|
+
export * from "./createCanvasContext.js";
|
|
6
6
|
/** 把当前画布指定区域的内容导出生成指定大小的图片 */
|
|
7
|
-
export * from "./canvasToTempFilePath";
|
|
7
|
+
export * from "./canvasToTempFilePath.js";
|
|
8
8
|
/** 将像素数据绘制到画布 */
|
|
9
|
-
export * from "./canvasPutImageData";
|
|
9
|
+
export * from "./canvasPutImageData.js";
|
|
10
10
|
/** 获取 canvas 区域隐含的像素数据 */
|
|
11
|
-
export * from "./canvasGetImageData";
|
|
11
|
+
export * from "./canvasGetImageData.js";
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export * from "./accelerometer";
|
|
2
|
-
export * from "./accessibility";
|
|
3
|
-
export * from "./battery";
|
|
4
|
-
export * from "./bluetooth";
|
|
5
|
-
export * from "./bluetooth-ble";
|
|
6
|
-
export * from "./bluetooth-peripheral";
|
|
7
|
-
export * from "./calendar";
|
|
8
|
-
export * from "./clipboard";
|
|
9
|
-
export * from "./compass";
|
|
10
|
-
export * from "./contact";
|
|
11
|
-
export * from "./crypto";
|
|
12
|
-
export * from "./gyroscope";
|
|
13
|
-
export * from "./iBeacon";
|
|
14
|
-
export * from "./keyboard";
|
|
15
|
-
export * from "./memory";
|
|
16
|
-
export * from "./motion";
|
|
17
|
-
export * from "./network";
|
|
18
|
-
export * from "./nfc";
|
|
19
|
-
export * from "./phone";
|
|
20
|
-
export * from "./scan";
|
|
21
|
-
export * from "./screen";
|
|
22
|
-
export * from "./vibrate";
|
|
23
|
-
export * from "./wifi";
|
|
1
|
+
export * from "./accelerometer.js";
|
|
2
|
+
export * from "./accessibility.js";
|
|
3
|
+
export * from "./battery.js";
|
|
4
|
+
export * from "./bluetooth.js";
|
|
5
|
+
export * from "./bluetooth-ble.js";
|
|
6
|
+
export * from "./bluetooth-peripheral.js";
|
|
7
|
+
export * from "./calendar.js";
|
|
8
|
+
export * from "./clipboard.js";
|
|
9
|
+
export * from "./compass.js";
|
|
10
|
+
export * from "./contact.js";
|
|
11
|
+
export * from "./crypto.js";
|
|
12
|
+
export * from "./gyroscope.js";
|
|
13
|
+
export * from "./iBeacon.js";
|
|
14
|
+
export * from "./keyboard.js";
|
|
15
|
+
export * from "./memory.js";
|
|
16
|
+
export * from "./motion.js";
|
|
17
|
+
export * from "./network.js";
|
|
18
|
+
export * from "./nfc.js";
|
|
19
|
+
export * from "./phone.js";
|
|
20
|
+
export * from "./scan.js";
|
|
21
|
+
export * from "./screen.js";
|
|
22
|
+
export * from "./vibrate.js";
|
|
23
|
+
export * from "./wifi.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/api/framework/index.ts"],"sourcesContent":["import Taro from '@tarojs/api'\n\nexport const getApp: typeof Taro.getApp = function <T = TaroGeneral.IAnyObject> () {\n return Taro.getCurrentInstance().app as unknown as
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/api/framework/index.ts"],"sourcesContent":["import Taro from '@tarojs/api'\n\nexport const getApp: typeof Taro.getApp = function <T extends Taro.App = TaroGeneral.IAnyObject> () {\n return Taro.getCurrentInstance().app as unknown as T\n}\n\nexport { getCurrentPages } from '@tarojs/router'\n\n// 自定义组件\nexport const getCurrentInstance = Taro.getCurrentInstance\n"],"names":[],"mappings":";;;AAEa,MAAA,MAAM,GAAuB,YAAA;AACxC,IAAA,OAAO,IAAI,CAAC,kBAAkB,EAAE,CAAC,GAAmB,CAAA;AACtD,EAAC;AAID;AACa,MAAA,kBAAkB,GAAG,IAAI,CAAC;;;;"}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
export * from "./ad/index";
|
|
2
|
-
export * from "./ai/index";
|
|
3
|
-
export * from "./alipay/index";
|
|
4
|
-
export * from "./base/index";
|
|
5
|
-
export * from "./canvas/index";
|
|
6
|
-
export * from "./cloud/index";
|
|
7
|
-
export * from "./data-analysis/index";
|
|
8
|
-
export * from "./device/index";
|
|
9
|
-
export * from "./ext/index";
|
|
10
|
-
export * from "./files/index";
|
|
11
|
-
export * from "./framework/index";
|
|
12
|
-
export * from "./location/index";
|
|
13
|
-
export * from "./media/index";
|
|
14
|
-
export * from "./navigate/index";
|
|
15
|
-
export * from "./network/index";
|
|
16
|
-
export * from "./open-api/index";
|
|
17
|
-
export * from "./payment/index";
|
|
18
|
-
export * from "./route/index";
|
|
19
|
-
export * from "./share/index";
|
|
20
|
-
export * from "./storage/index";
|
|
21
|
-
export * from "./swan/index";
|
|
22
|
-
export * from "./ui/index";
|
|
23
|
-
export * from "./worker/index";
|
|
24
|
-
export * from "./wxml/index";
|
|
1
|
+
export * from "./ad/index.js";
|
|
2
|
+
export * from "./ai/index.js";
|
|
3
|
+
export * from "./alipay/index.js";
|
|
4
|
+
export * from "./base/index.js";
|
|
5
|
+
export * from "./canvas/index.js";
|
|
6
|
+
export * from "./cloud/index.js";
|
|
7
|
+
export * from "./data-analysis/index.js";
|
|
8
|
+
export * from "./device/index.js";
|
|
9
|
+
export * from "./ext/index.js";
|
|
10
|
+
export * from "./files/index.js";
|
|
11
|
+
export * from "./framework/index.js";
|
|
12
|
+
export * from "./location/index.js";
|
|
13
|
+
export * from "./media/index.js";
|
|
14
|
+
export * from "./navigate/index.js";
|
|
15
|
+
export * from "./network/index.js";
|
|
16
|
+
export * from "./open-api/index.js";
|
|
17
|
+
export * from "./payment/index.js";
|
|
18
|
+
export * from "./route/index.js";
|
|
19
|
+
export * from "./share/index.js";
|
|
20
|
+
export * from "./storage/index.js";
|
|
21
|
+
export * from "./swan/index.js";
|
|
22
|
+
export * from "./ui/index.js";
|
|
23
|
+
export * from "./worker/index.js";
|
|
24
|
+
export * from "./wxml/index.js";
|
|
@@ -11,5 +11,5 @@ declare const offLocationChange: (option?: {}, ...args: any[]) => Promise<Partia
|
|
|
11
11
|
declare const choosePoi: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
12
12
|
declare const getFuzzyLocation: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
13
13
|
export { stopLocationUpdate, startLocationUpdateBackground, startLocationUpdate, openLocation, onLocationChangeError, onLocationChange, offLocationChangeError, offLocationChange, choosePoi, getFuzzyLocation };
|
|
14
|
-
export { getLocation } from "./getLocation";
|
|
15
|
-
export { chooseLocation } from "./chooseLocation";
|
|
14
|
+
export { getLocation } from "./getLocation.js";
|
|
15
|
+
export { chooseLocation } from "./chooseLocation.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import styleInject from '../../node_modules/.pnpm/registry.npmjs.org_style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js';
|
|
2
2
|
|
|
3
|
-
var css_248z = ".taro_choose_location {\n display: flex;\n position: fixed;\n top: 100%;\n z-index: 1;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background-color: #fff;\n transition: ease top 0.3s
|
|
4
|
-
var stylesheet=".taro_choose_location {\n display: flex;\n position: fixed;\n top: 100%;\n z-index: 1;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background-color: #fff;\n transition: ease top 0.3s
|
|
3
|
+
var css_248z = ".taro_choose_location {\n display: flex;\n position: fixed;\n top: 100%;\n z-index: 1;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background-color: #fff;\n transition: ease top 0.3s;\n}\n.taro_choose_location_bar {\n display: flex;\n flex: 0 95px;\n height: 95px;\n background-color: #ededed;\n color: #090909;\n}\n.taro_choose_location_back {\n position: relative;\n flex: 0 45px;\n margin-top: 30px;\n width: 33px;\n height: 30px;\n}\n.taro_choose_location_back::before {\n display: block;\n position: absolute;\n left: 0;\n top: 0;\n border: solid 15px;\n border-color: transparent #090909 transparent transparent;\n width: 0;\n height: 0;\n content: \"\";\n}\n.taro_choose_location_back::after {\n display: block;\n position: absolute;\n left: 3px;\n top: 0;\n border: solid 15px;\n border-color: transparent #ededed transparent transparent;\n width: 0;\n height: 0;\n content: \"\";\n}\n.taro_choose_location_title {\n flex: 1;\n padding-left: 30px;\n line-height: 95px;\n}\n.taro_choose_location_submit {\n margin: 18px 30px 0 0;\n padding: 0;\n border: none;\n width: 110px;\n height: 60px;\n background-color: #08bf62;\n line-height: 60px;\n font-size: 28px;\n color: #fff;\n}\n.taro_choose_location_frame {\n flex: 1;\n}";
|
|
4
|
+
var stylesheet=".taro_choose_location {\n display: flex;\n position: fixed;\n top: 100%;\n z-index: 1;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background-color: #fff;\n transition: ease top 0.3s;\n}\n.taro_choose_location_bar {\n display: flex;\n flex: 0 95px;\n height: 95px;\n background-color: #ededed;\n color: #090909;\n}\n.taro_choose_location_back {\n position: relative;\n flex: 0 45px;\n margin-top: 30px;\n width: 33px;\n height: 30px;\n}\n.taro_choose_location_back::before {\n display: block;\n position: absolute;\n left: 0;\n top: 0;\n border: solid 15px;\n border-color: transparent #090909 transparent transparent;\n width: 0;\n height: 0;\n content: \"\";\n}\n.taro_choose_location_back::after {\n display: block;\n position: absolute;\n left: 3px;\n top: 0;\n border: solid 15px;\n border-color: transparent #ededed transparent transparent;\n width: 0;\n height: 0;\n content: \"\";\n}\n.taro_choose_location_title {\n flex: 1;\n padding-left: 30px;\n line-height: 95px;\n}\n.taro_choose_location_submit {\n margin: 18px 30px 0 0;\n padding: 0;\n border: none;\n width: 110px;\n height: 60px;\n background-color: #08bf62;\n line-height: 60px;\n font-size: 28px;\n color: #fff;\n}\n.taro_choose_location_frame {\n flex: 1;\n}";
|
|
5
5
|
styleInject(css_248z,{"insertAt":"top"});
|
|
6
6
|
|
|
7
7
|
export { css_248z as default, stylesheet };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Taro from '@tarojs/api';
|
|
2
|
-
import { CallbackManager } from "../../../utils/handler";
|
|
2
|
+
import { CallbackManager } from "../../../utils/handler.js";
|
|
3
3
|
declare class InnerAudioContext implements Taro.InnerAudioContext {
|
|
4
4
|
Instance?: HTMLAudioElement;
|
|
5
5
|
errorStack: CallbackManager;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Taro from '@tarojs/api';
|
|
2
|
-
import { CallbackManager } from "../../../utils/handler";
|
|
2
|
+
import { CallbackManager } from "../../../utils/handler.js";
|
|
3
3
|
declare class BackgroundAudioManager implements Taro.BackgroundAudioManager {
|
|
4
4
|
Instance?: HTMLAudioElement;
|
|
5
5
|
errorStack: CallbackManager;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BackgroundAudioManager } from "./BackgroundAudioManager";
|
|
1
|
+
import { BackgroundAudioManager } from "./BackgroundAudioManager.js";
|
|
2
2
|
declare const stopBackgroundAudio: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
3
3
|
declare const seekBackgroundAudio: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
4
4
|
declare const playBackgroundAudio: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
@@ -3,6 +3,6 @@ declare const previewMedia: (option?: {}, ...args: any[]) => Promise<Partial<Tar
|
|
|
3
3
|
declare const compressImage: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
4
4
|
declare const chooseMessageFile: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
|
|
5
5
|
export { saveImageToPhotosAlbum, previewMedia, compressImage, chooseMessageFile };
|
|
6
|
-
export * from "./getImageInfo";
|
|
7
|
-
export * from "./previewImage";
|
|
8
|
-
export * from "./chooseImage";
|
|
6
|
+
export * from "./getImageInfo.js";
|
|
7
|
+
export * from "./previewImage.js";
|
|
8
|
+
export * from "./chooseImage.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from "./audio/index";
|
|
2
|
-
export * from "./background-audio/index";
|
|
3
|
-
export * from "./camera";
|
|
4
|
-
export * from "./image/index";
|
|
5
|
-
export * from "./live";
|
|
6
|
-
export * from "./map";
|
|
7
|
-
export * from "./media-recorder";
|
|
8
|
-
export * from "./recorder";
|
|
9
|
-
export * from "./video/index";
|
|
10
|
-
export * from "./video-decoder";
|
|
11
|
-
export * from "./video-processing";
|
|
12
|
-
export * from "./voip";
|
|
1
|
+
export * from "./audio/index.js";
|
|
2
|
+
export * from "./background-audio/index.js";
|
|
3
|
+
export * from "./camera.js";
|
|
4
|
+
export * from "./image/index.js";
|
|
5
|
+
export * from "./live.js";
|
|
6
|
+
export * from "./map.js";
|
|
7
|
+
export * from "./media-recorder.js";
|
|
8
|
+
export * from "./recorder.js";
|
|
9
|
+
export * from "./video/index.js";
|
|
10
|
+
export * from "./video-decoder.js";
|
|
11
|
+
export * from "./video-processing.js";
|
|
12
|
+
export * from "./voip.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./download";
|
|
2
|
-
export * from "./mdns";
|
|
3
|
-
export * from "./request/index";
|
|
4
|
-
export * from "./tcp";
|
|
5
|
-
export * from "./udp";
|
|
6
|
-
export * from "./upload";
|
|
7
|
-
export * from "./websocket/index";
|
|
1
|
+
export * from "./download.js";
|
|
2
|
+
export * from "./mdns.js";
|
|
3
|
+
export * from "./request/index.js";
|
|
4
|
+
export * from "./tcp.js";
|
|
5
|
+
export * from "./udp.js";
|
|
6
|
+
export * from "./upload.js";
|
|
7
|
+
export * from "./websocket/index.js";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export * from "./account";
|
|
2
|
-
export * from "./address";
|
|
3
|
-
export * from "./authorize";
|
|
4
|
-
export * from "./card";
|
|
5
|
-
export * from "./channels-live";
|
|
6
|
-
export * from "./customer-service";
|
|
7
|
-
export * from "./facial";
|
|
8
|
-
export * from "./favorites";
|
|
9
|
-
export * from "./group";
|
|
10
|
-
export * from "./invoice";
|
|
11
|
-
export * from "./license-plate";
|
|
12
|
-
export * from "./login";
|
|
13
|
-
export * from "./red-package";
|
|
14
|
-
export * from "./settings";
|
|
15
|
-
export * from "./soter";
|
|
16
|
-
export * from "./subscribe-message";
|
|
17
|
-
export * from "./user-info";
|
|
18
|
-
export * from "./werun";
|
|
1
|
+
export * from "./account.js";
|
|
2
|
+
export * from "./address.js";
|
|
3
|
+
export * from "./authorize.js";
|
|
4
|
+
export * from "./card.js";
|
|
5
|
+
export * from "./channels-live.js";
|
|
6
|
+
export * from "./customer-service.js";
|
|
7
|
+
export * from "./facial.js";
|
|
8
|
+
export * from "./favorites.js";
|
|
9
|
+
export * from "./group.js";
|
|
10
|
+
export * from "./invoice.js";
|
|
11
|
+
export * from "./license-plate.js";
|
|
12
|
+
export * from "./login.js";
|
|
13
|
+
export * from "./red-package.js";
|
|
14
|
+
export * from "./settings.js";
|
|
15
|
+
export * from "./soter.js";
|
|
16
|
+
export * from "./subscribe-message.js";
|
|
17
|
+
export * from "./user-info.js";
|
|
18
|
+
export * from "./werun.js";
|
|
@@ -12,4 +12,4 @@ declare const createBufferURL: (option?: {}, ...args: any[]) => Promise<Partial<
|
|
|
12
12
|
declare const clearStorageSync: typeof Taro.clearStorageSync;
|
|
13
13
|
declare const clearStorage: typeof Taro.clearStorage;
|
|
14
14
|
export { setStorageSync, setStorage, revokeBufferURL, removeStorageSync, removeStorage, getStorageSync, getStorageInfoSync, getStorageInfo, getStorage, createBufferURL, clearStorageSync, clearStorage };
|
|
15
|
-
export * from "./background-fetch";
|
|
15
|
+
export * from "./background-fetch.js";
|
package/dist/api/ui/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from "./animation/index";
|
|
2
|
-
export * from "./background";
|
|
3
|
-
export * from "./custom-component";
|
|
4
|
-
export * from "./fonts";
|
|
5
|
-
export * from "./interaction/index";
|
|
6
|
-
export * from "./menu";
|
|
7
|
-
export * from "./navigation-bar/index";
|
|
8
|
-
export * from "./pull-down-refresh";
|
|
9
|
-
export * from "./scroll/index";
|
|
10
|
-
export * from "./sticky";
|
|
11
|
-
export * from "./tab-bar";
|
|
12
|
-
export * from "./window";
|
|
1
|
+
export * from "./animation/index.js";
|
|
2
|
+
export * from "./background.js";
|
|
3
|
+
export * from "./custom-component.js";
|
|
4
|
+
export * from "./fonts.js";
|
|
5
|
+
export * from "./interaction/index.js";
|
|
6
|
+
export * from "./menu.js";
|
|
7
|
+
export * from "./navigation-bar/index.js";
|
|
8
|
+
export * from "./pull-down-refresh.js";
|
|
9
|
+
export * from "./scroll/index.js";
|
|
10
|
+
export * from "./sticky.js";
|
|
11
|
+
export * from "./tab-bar.js";
|
|
12
|
+
export * from "./window.js";
|
|
@@ -3,6 +3,13 @@ import { findDOM } from '../../utils/index.js';
|
|
|
3
3
|
// pollify
|
|
4
4
|
import('intersection-observer');
|
|
5
5
|
class TaroH5IntersectionObserver {
|
|
6
|
+
// selector 的容器节点
|
|
7
|
+
get container() {
|
|
8
|
+
const container = (this._component !== null
|
|
9
|
+
? (findDOM(this._component) || document)
|
|
10
|
+
: document);
|
|
11
|
+
return container;
|
|
12
|
+
}
|
|
6
13
|
constructor(component, options = {}) {
|
|
7
14
|
// 选项
|
|
8
15
|
this._options = {
|
|
@@ -19,13 +26,6 @@ class TaroH5IntersectionObserver {
|
|
|
19
26
|
this._component = component;
|
|
20
27
|
Object.assign(this._options, options);
|
|
21
28
|
}
|
|
22
|
-
// selector 的容器节点
|
|
23
|
-
get container() {
|
|
24
|
-
const container = (this._component !== null
|
|
25
|
-
? (findDOM(this._component) || document)
|
|
26
|
-
: document);
|
|
27
|
-
return container;
|
|
28
|
-
}
|
|
29
29
|
createInst() {
|
|
30
30
|
// 去除原本的实例
|
|
31
31
|
this.disconnect();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntersectionObserver.js","sources":["../../../src/api/wxml/IntersectionObserver.ts"],"sourcesContent":["import Taro from '@tarojs/taro'\n\nimport { findDOM } from '../../utils'\n// pollify\nimport('intersection-observer')\n\ntype TElement = Document | HTMLElement | Element\n\ntype TListener = {\n element: Element\n callback: Taro.IntersectionObserver.ObserveCallback\n}\n\nexport class TaroH5IntersectionObserver implements Taro.IntersectionObserver {\n\n // 自定义组件实例\n private _component: TaroGeneral.IAnyObject\n // 选项\n private _options = {\n thresholds: [0],\n initialRatio: 0,\n observeAll: false\n }\n\n // Observer实例\n private _observerInst: IntersectionObserver\n // 监控中的选择器\n private _listeners: TListener[] = []\n // 参照区域\n private _root: Element | null\n // 用来扩展(或收缩)参照节点布局区域的边界\n private _rootMargin: Taro.IntersectionObserver.RelativeToViewportMargins = {}\n // 是否已初始化\n private _isInited = false\n\n // selector 的容器节点\n protected get container () {\n const container: TElement = (\n this._component !== null \n ? (findDOM(this._component) as HTMLElement || document) \n : document\n )\n return container\n }\n\n constructor (component: TaroGeneral.IAnyObject, options: Taro.createIntersectionObserver.Option = {}) {\n this._component = component\n Object.assign(this._options, options)\n }\n\n private createInst () {\n // 去除原本的实例\n this.disconnect()\n\n const { left = 0, top = 0, bottom = 0, right = 0 } = this._rootMargin\n return new IntersectionObserver(entries => {\n entries.forEach(entry => {\n const _callback = this._getCallbackByElement(entry.target)\n const result = {\n boundingClientRect: entry.boundingClientRect,\n intersectionRatio: entry.intersectionRatio,\n intersectionRect: entry.intersectionRect,\n relativeRect: entry.rootBounds || { left: 0, right: 0, top: 0, bottom: 0 },\n time: entry.time\n }\n // web端会默认首次触发\n if (!this._isInited && this._options.initialRatio <= Math.min.apply(Math, this._options.thresholds)) {\n // 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。\n return\n }\n _callback && _callback.call(this, result)\n })\n this._isInited = true\n }, {\n root: this._root,\n rootMargin: [`${top}px`, `${right}px`, `${bottom}px`, `${left}px`].join(' '),\n threshold: this._options.thresholds\n })\n }\n\n public disconnect (): void {\n if (this._observerInst) {\n let listener\n while ((listener = this._listeners.pop())) {\n this._observerInst.unobserve(listener.element)\n }\n this._observerInst.disconnect()\n }\n }\n\n public observe (targetSelector: string, callback: Taro.IntersectionObserver.ObserveCallback): void {\n // 同wx小程序效果一致,每个实例监听一个Selector\n if (this._listeners.length) return\n // 监听前没有设置关联的节点\n if (!this._observerInst) {\n console.warn('Intersection observer will be ignored because no relative nodes are found.')\n return\n }\n \n const nodeList = this._options.observeAll \n ? this.container.querySelectorAll(targetSelector) \n : [this.container.querySelector(targetSelector)]\n \n nodeList.forEach(element => {\n if (!element) return\n this._observerInst.observe(element)\n this._listeners.push({ element, callback })\n })\n }\n\n public relativeTo (selector: string, margins?: Taro.IntersectionObserver.RelativeToMargins | undefined): Taro.IntersectionObserver {\n // 已设置observe监听后,重新关联节点\n if (this._listeners.length) {\n console.error('Relative nodes cannot be added after \"observe\" call in IntersectionObserver')\n return this\n }\n this._root = this.container.querySelector(selector) || null\n if (margins) {\n this._rootMargin = margins\n }\n this._observerInst = this.createInst()\n return this\n }\n\n public relativeToViewport (margins?: Taro.IntersectionObserver.RelativeToViewportMargins | undefined): Taro.IntersectionObserver {\n return this.relativeTo('.taro_page', margins)\n }\n\n private _getCallbackByElement (element: Element) {\n const listener = this._listeners.find(listener => listener.element === element)\n return listener ? listener.callback : null\n }\n\n}\n"],"names":[],"mappings":";;AAGA;AACA,OAAO,uBAAuB,CAAC,CAAA;MASlB,0BAA0B,CAAA;
|
|
1
|
+
{"version":3,"file":"IntersectionObserver.js","sources":["../../../src/api/wxml/IntersectionObserver.ts"],"sourcesContent":["import Taro from '@tarojs/taro'\n\nimport { findDOM } from '../../utils'\n// pollify\nimport('intersection-observer')\n\ntype TElement = Document | HTMLElement | Element\n\ntype TListener = {\n element: Element\n callback: Taro.IntersectionObserver.ObserveCallback\n}\n\nexport class TaroH5IntersectionObserver implements Taro.IntersectionObserver {\n\n // 自定义组件实例\n private _component: TaroGeneral.IAnyObject\n // 选项\n private _options = {\n thresholds: [0],\n initialRatio: 0,\n observeAll: false\n }\n\n // Observer实例\n private _observerInst: IntersectionObserver\n // 监控中的选择器\n private _listeners: TListener[] = []\n // 参照区域\n private _root: Element | null\n // 用来扩展(或收缩)参照节点布局区域的边界\n private _rootMargin: Taro.IntersectionObserver.RelativeToViewportMargins = {}\n // 是否已初始化\n private _isInited = false\n\n // selector 的容器节点\n protected get container () {\n const container: TElement = (\n this._component !== null \n ? (findDOM(this._component) as HTMLElement || document) \n : document\n )\n return container\n }\n\n constructor (component: TaroGeneral.IAnyObject, options: Taro.createIntersectionObserver.Option = {}) {\n this._component = component\n Object.assign(this._options, options)\n }\n\n private createInst () {\n // 去除原本的实例\n this.disconnect()\n\n const { left = 0, top = 0, bottom = 0, right = 0 } = this._rootMargin\n return new IntersectionObserver(entries => {\n entries.forEach(entry => {\n const _callback = this._getCallbackByElement(entry.target)\n const result = {\n boundingClientRect: entry.boundingClientRect,\n intersectionRatio: entry.intersectionRatio,\n intersectionRect: entry.intersectionRect,\n relativeRect: entry.rootBounds || { left: 0, right: 0, top: 0, bottom: 0 },\n time: entry.time\n }\n // web端会默认首次触发\n if (!this._isInited && this._options.initialRatio <= Math.min.apply(Math, this._options.thresholds)) {\n // 初始的相交比例,如果调用时检测到的相交比例与这个值不相等且达到阈值,则会触发一次监听器的回调函数。\n return\n }\n _callback && _callback.call(this, result)\n })\n this._isInited = true\n }, {\n root: this._root,\n rootMargin: [`${top}px`, `${right}px`, `${bottom}px`, `${left}px`].join(' '),\n threshold: this._options.thresholds\n })\n }\n\n public disconnect (): void {\n if (this._observerInst) {\n let listener\n while ((listener = this._listeners.pop())) {\n this._observerInst.unobserve(listener.element)\n }\n this._observerInst.disconnect()\n }\n }\n\n public observe (targetSelector: string, callback: Taro.IntersectionObserver.ObserveCallback): void {\n // 同wx小程序效果一致,每个实例监听一个Selector\n if (this._listeners.length) return\n // 监听前没有设置关联的节点\n if (!this._observerInst) {\n console.warn('Intersection observer will be ignored because no relative nodes are found.')\n return\n }\n \n const nodeList = this._options.observeAll \n ? this.container.querySelectorAll(targetSelector) \n : [this.container.querySelector(targetSelector)]\n \n nodeList.forEach(element => {\n if (!element) return\n this._observerInst.observe(element)\n this._listeners.push({ element, callback })\n })\n }\n\n public relativeTo (selector: string, margins?: Taro.IntersectionObserver.RelativeToMargins | undefined): Taro.IntersectionObserver {\n // 已设置observe监听后,重新关联节点\n if (this._listeners.length) {\n console.error('Relative nodes cannot be added after \"observe\" call in IntersectionObserver')\n return this\n }\n this._root = this.container.querySelector(selector) || null\n if (margins) {\n this._rootMargin = margins\n }\n this._observerInst = this.createInst()\n return this\n }\n\n public relativeToViewport (margins?: Taro.IntersectionObserver.RelativeToViewportMargins | undefined): Taro.IntersectionObserver {\n return this.relativeTo('.taro_page', margins)\n }\n\n private _getCallbackByElement (element: Element) {\n const listener = this._listeners.find(listener => listener.element === element)\n return listener ? listener.callback : null\n }\n\n}\n"],"names":[],"mappings":";;AAGA;AACA,OAAO,uBAAuB,CAAC,CAAA;MASlB,0BAA0B,CAAA;;AAuBrC,IAAA,IAAc,SAAS,GAAA;AACrB,QAAA,MAAM,SAAS,IACb,IAAI,CAAC,UAAU,KAAK,IAAI;eACnB,OAAO,CAAC,IAAI,CAAC,UAAU,CAAgB,IAAI,QAAQ;cACpD,QAAQ,CACb,CAAA;AACD,QAAA,OAAO,SAAS,CAAA;KACjB;IAED,WAAa,CAAA,SAAiC,EAAE,OAAA,GAAkD,EAAE,EAAA;;AA3B5F,QAAA,IAAA,CAAA,QAAQ,GAAG;YACjB,UAAU,EAAE,CAAC,CAAC,CAAC;AACf,YAAA,YAAY,EAAE,CAAC;AACf,YAAA,UAAU,EAAE,KAAK;SAClB,CAAA;;QAKO,IAAU,CAAA,UAAA,GAAgB,EAAE,CAAA;;QAI5B,IAAW,CAAA,WAAA,GAAwD,EAAE,CAAA;;QAErE,IAAS,CAAA,SAAA,GAAG,KAAK,CAAA;AAavB,QAAA,IAAI,CAAC,UAAU,GAAG,SAAS,CAAA;QAC3B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;KACtC;IAEO,UAAU,GAAA;;QAEhB,IAAI,CAAC,UAAU,EAAE,CAAA;QAEjB,MAAM,EAAE,IAAI,GAAG,CAAC,EAAE,GAAG,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,WAAW,CAAA;AACrE,QAAA,OAAO,IAAI,oBAAoB,CAAC,OAAO,IAAG;AACxC,YAAA,OAAO,CAAC,OAAO,CAAC,KAAK,IAAG;gBACtB,MAAM,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;AAC1D,gBAAA,MAAM,MAAM,GA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,CAAC,UAAU,EAAE,CAAA;AACtC,QAAA,OAAO,IAAI,CAAA;KACZ;AAEM,IAAA,kBAAkB,CAAE,OAAyE,EAAA;QAClG,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;KAC9C;AAEO,IAAA,qBAAqB,CAAE,OAAgB,EAAA;AAC7C,QAAA,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,OAAO,KAAK,OAAO,CAAC,CAAA;QAC/E,OAAO,QAAQ,GAAG,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAA;KAC3C;AAEF;;;;"}
|
|
@@ -32,6 +32,7 @@ class MediaQueryObserver {
|
|
|
32
32
|
this._mediaQueryObserver.addEventListener('change', this._listener);
|
|
33
33
|
}
|
|
34
34
|
else {
|
|
35
|
+
// @ts-ignore
|
|
35
36
|
this._mediaQueryObserver.addListener(this._listener);
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -44,6 +45,7 @@ class MediaQueryObserver {
|
|
|
44
45
|
this._mediaQueryObserver.removeEventListener('change', this._listener);
|
|
45
46
|
}
|
|
46
47
|
else {
|
|
48
|
+
// @ts-ignore
|
|
47
49
|
this._mediaQueryObserver.removeListener(this._listener);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MediaQueryObserver.js","sources":["../../../src/api/wxml/MediaQueryObserver.ts"],"sourcesContent":["\nimport { isFunction } from '@tarojs/shared'\nimport Taro from '@tarojs/taro'\n\nimport { toKebabCase } from '../../utils'\n\nfunction generateMediaQueryStr (descriptor: Taro.MediaQueryObserver.descriptor) {\n const mediaQueryArr: string[] = []\n const descriptorMenu = ['width', 'minWidth', 'maxWidth', 'height', 'minHeight', 'maxHeight', 'orientation']\n for (const item of descriptorMenu) {\n if (\n item !== 'orientation' &&\n descriptor[item] &&\n Number(descriptor[item]) >= 0\n ) {\n mediaQueryArr.push(`(${(toKebabCase(item))}: ${Number(descriptor[item])}px)`)\n }\n if (item === 'orientation' && descriptor[item]) {\n mediaQueryArr.push(`(${toKebabCase(item)}: ${descriptor[item]})`)\n }\n }\n return mediaQueryArr.join(' and ')\n}\n\n\nexport class MediaQueryObserver implements Taro.MediaQueryObserver {\n private _mediaQueryObserver: MediaQueryList\n private _listener: (ev: MediaQueryListEvent) => void\n\n // 监听页面媒体查询变化情况\n public observe (descriptor: Taro.MediaQueryObserver.descriptor, callback: Taro.MediaQueryObserver.observeCallback): void {\n if (isFunction(callback)) {\n // 创建媒体查询对象\n this._mediaQueryObserver = window.matchMedia(generateMediaQueryStr(descriptor))\n // 监听器\n this._listener = (ev: MediaQueryListEvent) => {\n callback({ matches: ev.matches })\n }\n callback({ matches: this._mediaQueryObserver.matches })\n // 兼容旧浏览器中 MediaQueryList 尚未继承于 EventTarget 导致不存在 'addEventListener'\n if ('addEventListener' in this._mediaQueryObserver) {\n this._mediaQueryObserver.addEventListener('change', this._listener)\n } else {\n this._mediaQueryObserver.addListener(this._listener)\n }\n }\n }\n\n // 停止监听,销毁媒体查询对象\n public disconnect (): void {\n if (this._mediaQueryObserver && this._listener) {\n // 兼容旧浏览器中 MediaQueryList 尚未继承于 EventTarget 导致不存在 'removeEventListener'\n if ('removeEventListener' in this._mediaQueryObserver) {\n this._mediaQueryObserver.removeEventListener('change', this._listener)\n } else {\n this._mediaQueryObserver.removeListener(this._listener)\n }\n }\n }\n\n}\n"],"names":[],"mappings":";;;AAMA,SAAS,qBAAqB,CAAE,UAA8C,EAAA;IAC5E,MAAM,aAAa,GAAa,EAAE,CAAA;AAClC,IAAA,MAAM,cAAc,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,CAAC,CAAA;AAC3G,IAAA,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE;QACjC,IACE,IAAI,KAAK,aAAa;YACtB,U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server.js","sources":["../../../src/api/wxml/MediaQueryObserver.ts"],"sourcesContent":["\nimport { isFunction } from '@tarojs/shared'\nimport Taro from '@tarojs/taro'\n\nimport { toKebabCase } from '../../utils'\n\nfunction generateMediaQueryStr (descriptor: Taro.MediaQueryObserver.descriptor) {\n const mediaQueryArr: string[] = []\n const descriptorMenu = ['width', 'minWidth', 'maxWidth', 'height', 'minHeight', 'maxHeight', 'orientation']\n for (const item of descriptorMenu) {\n if (\n item !== 'orientation' &&\n descriptor[item] &&\n Number(descriptor[item]) >= 0\n ) {\n mediaQueryArr.push(`(${(toKebabCase(item))}: ${Number(descriptor[item])}px)`)\n }\n if (item === 'orientation' && descriptor[item]) {\n mediaQueryArr.push(`(${toKebabCase(item)}: ${descriptor[item]})`)\n }\n }\n return mediaQueryArr.join(' and ')\n}\n\n\nexport class MediaQueryObserver implements Taro.MediaQueryObserver {\n private _mediaQueryObserver: MediaQueryList\n private _listener: (ev: MediaQueryListEvent) => void\n\n // 监听页面媒体查询变化情况\n public observe (descriptor: Taro.MediaQueryObserver.descriptor, callback: Taro.MediaQueryObserver.observeCallback): void {\n if (isFunction(callback)) {\n // 创建媒体查询对象\n this._mediaQueryObserver = window.matchMedia(generateMediaQueryStr(descriptor))\n // 监听器\n this._listener = (ev: MediaQueryListEvent) => {\n callback({ matches: ev.matches })\n }\n callback({ matches: this._mediaQueryObserver.matches })\n // 兼容旧浏览器中 MediaQueryList 尚未继承于 EventTarget 导致不存在 'addEventListener'\n if ('addEventListener' in this._mediaQueryObserver) {\n this._mediaQueryObserver.addEventListener('change', this._listener)\n } else {\n // @ts-ignore\n this._mediaQueryObserver.addListener(this._listener)\n }\n }\n }\n\n // 停止监听,销毁媒体查询对象\n public disconnect (): void {\n if (this._mediaQueryObserver && this._listener) {\n // 兼容旧浏览器中 MediaQueryList 尚未继承于 EventTarget 导致不存在 'removeEventListener'\n if ('removeEventListener' in this._mediaQueryObserver) {\n this._mediaQueryObserver.removeEventListener('change', this._listener)\n } else {\n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E,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,CAAA;AACnC,aAAC,CAAA;YACD,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,mBAAmB,CAAC,OAAO,EAAE,CAAC,CAAA;;AAEvD,YAAA,IAAI,kBAAkB,IAAI,IAAI,CAAC,mBAAmB,EAAE;gBAClD,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;AACpE,aAAA;AAAM,iBAAA;;gBAEL,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AACrD,aAAA;AACF,SAAA;KACF;;IAGM,UAAU,GAAA;AACf,QAAA,IAAI,IAAI,CAAC,mBAAmB,IAAI,IAAI,CAAC,SAAS,EAAE;;AAE9C,YAAA,IAAI,qBAAqB,IAAI,IAAI,CAAC,mBAAmB,EAAE;gBACrD,IAAI,CAAC,mBAAmB,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,CAAA;AACvE,aAAA;AAAM,iBAAA;;gBAEL,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AACxD,aAAA;AACF,SAAA;KACF;AAEF;;;;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -2013,8 +2013,8 @@ function styleInject(css, ref) {
|
|
|
2013
2013
|
}
|
|
2014
2014
|
}
|
|
2015
2015
|
|
|
2016
|
-
var css_248z = ".taro_choose_location {\n display: flex;\n position: fixed;\n top: 100%;\n z-index: 1;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background-color: #fff;\n transition: ease top 0.3s
|
|
2017
|
-
var stylesheet=".taro_choose_location {\n display: flex;\n position: fixed;\n top: 100%;\n z-index: 1;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background-color: #fff;\n transition: ease top 0.3s
|
|
2016
|
+
var css_248z = ".taro_choose_location {\n display: flex;\n position: fixed;\n top: 100%;\n z-index: 1;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background-color: #fff;\n transition: ease top 0.3s;\n}\n.taro_choose_location_bar {\n display: flex;\n flex: 0 95px;\n height: 95px;\n background-color: #ededed;\n color: #090909;\n}\n.taro_choose_location_back {\n position: relative;\n flex: 0 45px;\n margin-top: 30px;\n width: 33px;\n height: 30px;\n}\n.taro_choose_location_back::before {\n display: block;\n position: absolute;\n left: 0;\n top: 0;\n border: solid 15px;\n border-color: transparent #090909 transparent transparent;\n width: 0;\n height: 0;\n content: \"\";\n}\n.taro_choose_location_back::after {\n display: block;\n position: absolute;\n left: 3px;\n top: 0;\n border: solid 15px;\n border-color: transparent #ededed transparent transparent;\n width: 0;\n height: 0;\n content: \"\";\n}\n.taro_choose_location_title {\n flex: 1;\n padding-left: 30px;\n line-height: 95px;\n}\n.taro_choose_location_submit {\n margin: 18px 30px 0 0;\n padding: 0;\n border: none;\n width: 110px;\n height: 60px;\n background-color: #08bf62;\n line-height: 60px;\n font-size: 28px;\n color: #fff;\n}\n.taro_choose_location_frame {\n flex: 1;\n}";
|
|
2017
|
+
var stylesheet=".taro_choose_location {\n display: flex;\n position: fixed;\n top: 100%;\n z-index: 1;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background-color: #fff;\n transition: ease top 0.3s;\n}\n.taro_choose_location_bar {\n display: flex;\n flex: 0 95px;\n height: 95px;\n background-color: #ededed;\n color: #090909;\n}\n.taro_choose_location_back {\n position: relative;\n flex: 0 45px;\n margin-top: 30px;\n width: 33px;\n height: 30px;\n}\n.taro_choose_location_back::before {\n display: block;\n position: absolute;\n left: 0;\n top: 0;\n border: solid 15px;\n border-color: transparent #090909 transparent transparent;\n width: 0;\n height: 0;\n content: \"\";\n}\n.taro_choose_location_back::after {\n display: block;\n position: absolute;\n left: 3px;\n top: 0;\n border: solid 15px;\n border-color: transparent #ededed transparent transparent;\n width: 0;\n height: 0;\n content: \"\";\n}\n.taro_choose_location_title {\n flex: 1;\n padding-left: 30px;\n line-height: 95px;\n}\n.taro_choose_location_submit {\n margin: 18px 30px 0 0;\n padding: 0;\n border: none;\n width: 110px;\n height: 60px;\n background-color: #08bf62;\n line-height: 60px;\n font-size: 28px;\n color: #fff;\n}\n.taro_choose_location_frame {\n flex: 1;\n}";
|
|
2018
2018
|
styleInject(css_248z,{"insertAt":"top"});
|
|
2019
2019
|
|
|
2020
2020
|
function createLocationChooser(handler, key = LOCATION_APIKEY, mapOpt = {}) {
|
|
@@ -5031,6 +5031,13 @@ const createWorker = temporarilyNotSupport('createWorker');
|
|
|
5031
5031
|
// pollify
|
|
5032
5032
|
Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('intersection-observer')); });
|
|
5033
5033
|
class TaroH5IntersectionObserver {
|
|
5034
|
+
// selector 的容器节点
|
|
5035
|
+
get container() {
|
|
5036
|
+
const container = (this._component !== null
|
|
5037
|
+
? (findDOM(this._component) || document)
|
|
5038
|
+
: document);
|
|
5039
|
+
return container;
|
|
5040
|
+
}
|
|
5034
5041
|
constructor(component, options = {}) {
|
|
5035
5042
|
// 选项
|
|
5036
5043
|
this._options = {
|
|
@@ -5047,13 +5054,6 @@ class TaroH5IntersectionObserver {
|
|
|
5047
5054
|
this._component = component;
|
|
5048
5055
|
Object.assign(this._options, options);
|
|
5049
5056
|
}
|
|
5050
|
-
// selector 的容器节点
|
|
5051
|
-
get container() {
|
|
5052
|
-
const container = (this._component !== null
|
|
5053
|
-
? (findDOM(this._component) || document)
|
|
5054
|
-
: document);
|
|
5055
|
-
return container;
|
|
5056
|
-
}
|
|
5057
5057
|
createInst() {
|
|
5058
5058
|
// 去除原本的实例
|
|
5059
5059
|
this.disconnect();
|
|
@@ -5163,6 +5163,7 @@ class MediaQueryObserver {
|
|
|
5163
5163
|
this._mediaQueryObserver.addEventListener('change', this._listener);
|
|
5164
5164
|
}
|
|
5165
5165
|
else {
|
|
5166
|
+
// @ts-ignore
|
|
5166
5167
|
this._mediaQueryObserver.addListener(this._listener);
|
|
5167
5168
|
}
|
|
5168
5169
|
}
|
|
@@ -5175,6 +5176,7 @@ class MediaQueryObserver {
|
|
|
5175
5176
|
this._mediaQueryObserver.removeEventListener('change', this._listener);
|
|
5176
5177
|
}
|
|
5177
5178
|
else {
|
|
5179
|
+
// @ts-ignore
|
|
5178
5180
|
this._mediaQueryObserver.removeListener(this._listener);
|
|
5179
5181
|
}
|
|
5180
5182
|
}
|