@tarojs/taro-h5 3.3.18 → 3.3.19
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/ad/index.js +3 -0
- package/dist/api/ai/facial.js +4 -0
- package/dist/api/ai/index.js +2 -0
- package/dist/api/ai/visual.js +2 -0
- package/dist/api/alipay/index.js +2 -0
- package/dist/api/base/crypto.js +2 -0
- package/dist/api/base/debug.js +4 -0
- package/dist/api/base/index.js +16 -0
- package/dist/api/base/performance.js +3 -0
- package/dist/api/base/system/index.js +2 -0
- package/dist/api/base/system/info.js +56 -0
- package/dist/api/base/system/network.js +52 -0
- package/dist/api/base/update.js +3 -0
- package/dist/api/base/weapp/app-event.js +17 -0
- package/dist/api/base/weapp/life-cycle.js +3 -0
- package/dist/api/canvas/CanvasContext.js +182 -0
- package/dist/api/canvas/canvasGetImageData.js +21 -0
- package/dist/api/canvas/canvasPutImageData.js +17 -0
- package/dist/api/canvas/canvasToTempFilePath.js +18 -0
- package/dist/api/canvas/createCanvasContext.js +13 -0
- package/dist/api/canvas/index.js +7 -0
- package/dist/api/cloud/index.js +14 -0
- package/dist/api/data-analysis/index.js +5 -0
- package/dist/api/device/accelerometer.js +71 -0
- package/dist/api/device/accessibility.js +2 -0
- package/dist/api/device/battery.js +3 -0
- package/dist/api/device/bluetooth-ble.js +17 -0
- package/dist/api/device/bluetooth-peripheral.js +4 -0
- package/dist/api/device/bluetooth.js +14 -0
- package/dist/api/device/calendar.js +3 -0
- package/dist/api/device/clipboard.js +48 -0
- package/dist/api/device/compass.js +52 -0
- package/dist/api/device/contact.js +3 -0
- package/dist/api/device/crypto.js +2 -0
- package/dist/api/device/gyroscope.js +5 -0
- package/dist/api/device/iBeacon.js +8 -0
- package/dist/api/device/index.js +22 -0
- package/dist/api/device/keyboard.js +5 -0
- package/dist/api/device/memory.js +3 -0
- package/dist/api/device/motion.js +69 -0
- package/dist/api/device/nfc.js +8 -0
- package/dist/api/device/phone.js +23 -0
- package/dist/api/device/scan.js +5 -0
- package/dist/api/device/screen.js +7 -0
- package/dist/api/device/vibrate.js +29 -0
- package/dist/api/device/wifi.js +11 -0
- package/dist/api/ext/index.js +3 -0
- package/dist/api/files/index.js +9 -0
- package/dist/api/framework/index.js +6 -0
- package/dist/api/index.js +24 -0
- package/dist/api/location/chooseLocation.js +88 -0
- package/dist/api/location/index.js +12 -0
- package/dist/api/location/style.css +79 -0
- package/dist/api/media/audio/index.js +81 -0
- package/dist/api/media/background-audio.js +10 -0
- package/dist/api/media/camera.js +2 -0
- package/dist/api/media/editor.js +17 -0
- package/dist/api/media/image/chooseImage.js +70 -0
- package/dist/api/media/image/getImageInfo.js +27 -0
- package/dist/api/media/image/index.js +8 -0
- package/dist/api/media/image/previewImage.js +78 -0
- package/dist/api/media/index.js +13 -0
- package/dist/api/media/live.js +3 -0
- package/dist/api/media/map.js +2 -0
- package/dist/api/media/media-recorder.js +2 -0
- package/dist/api/media/recorder.js +4 -0
- package/dist/api/media/video/index.js +65 -0
- package/dist/api/media/video-decoder.js +2 -0
- package/dist/api/media/video-processing.js +2 -0
- package/dist/api/media/voip.js +15 -0
- package/dist/api/navigate/index.js +5 -0
- package/dist/api/network/download.js +101 -0
- package/dist/api/network/index.js +7 -0
- package/dist/api/network/mdns.js +11 -0
- package/dist/api/network/request/index.js +123 -0
- package/dist/api/network/tcp.js +2 -0
- package/dist/api/network/udp.js +2 -0
- package/dist/api/network/upload.js +129 -0
- package/dist/api/network/utils.js +30 -0
- package/dist/api/network/websocket/index.js +65 -0
- package/dist/api/network/websocket/socketTask.js +61 -0
- package/dist/api/open-api/account.js +2 -0
- package/dist/api/open-api/address.js +2 -0
- package/dist/api/open-api/authorize.js +3 -0
- package/dist/api/open-api/card.js +3 -0
- package/dist/api/open-api/channels-live.js +7 -0
- package/dist/api/open-api/customer-service.js +2 -0
- package/dist/api/open-api/facial.js +5 -0
- package/dist/api/open-api/favorites.js +3 -0
- package/dist/api/open-api/group.js +2 -0
- package/dist/api/open-api/index.js +18 -0
- package/dist/api/open-api/invoice.js +3 -0
- package/dist/api/open-api/license-plate.js +2 -0
- package/dist/api/open-api/login.js +4 -0
- package/dist/api/open-api/red-package.js +2 -0
- package/dist/api/open-api/settings.js +3 -0
- package/dist/api/open-api/soter.js +4 -0
- package/dist/api/open-api/subscribe-message.js +2 -0
- package/dist/api/open-api/user-info.js +3 -0
- package/dist/api/open-api/werun.js +3 -0
- package/dist/api/payment/index.js +3 -0
- package/dist/api/route/index.js +1 -0
- package/dist/api/share/index.js +11 -0
- package/dist/api/storage/background-fetch.js +5 -0
- package/dist/api/storage/index.js +152 -0
- package/dist/api/swan/index.js +22 -0
- package/dist/api/taro.js +59 -0
- package/dist/api/ui/animation/index.js +255 -0
- package/dist/api/ui/background.js +3 -0
- package/dist/api/ui/custom-component.js +2 -0
- package/dist/api/ui/fonts.js +2 -0
- package/dist/api/ui/index.js +12 -0
- package/dist/api/ui/interaction/actionSheet.js +172 -0
- package/dist/api/ui/interaction/index.js +263 -0
- package/dist/api/ui/interaction/modal.js +185 -0
- package/dist/api/ui/interaction/toast.js +179 -0
- package/dist/api/ui/menu.js +2 -0
- package/dist/api/ui/navigation-bar/index.js +37 -0
- package/dist/api/ui/pull-down-refresh.js +20 -0
- package/dist/api/ui/scroll/index.js +80 -0
- package/dist/api/ui/sticky.js +2 -0
- package/dist/api/ui/tab-bar.js +250 -0
- package/dist/api/ui/window.js +22 -0
- package/dist/api/utils/handler.js +64 -0
- package/dist/api/utils/index.js +141 -0
- package/dist/api/worker/index.js +2 -0
- package/dist/api/wxml/index.js +6 -0
- package/dist/api/wxml/nodesRef.js +35 -0
- package/dist/api/wxml/selectorQuery.js +140 -0
- package/dist/index.cjs.js +4261 -5796
- package/dist/index.js +4 -9493
- package/dist/types/type.js +2 -0
- package/package.json +8 -11
- package/src/api/network/download.ts +5 -5
- package/src/api/network/upload.ts +5 -5
- package/src/api/network/websocket/index.ts +1 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { findDOM } from '../utils';
|
|
2
|
+
import { NodesRef } from './nodesRef';
|
|
3
|
+
function filter(fields, dom, selector) {
|
|
4
|
+
if (!dom)
|
|
5
|
+
return null;
|
|
6
|
+
const { id, dataset, rect, size, scrollOffset, properties = [], computedStyle = [] } = fields;
|
|
7
|
+
const { left, right, top, bottom, width, height } = dom.getBoundingClientRect();
|
|
8
|
+
const isViewport = selector === 'html';
|
|
9
|
+
const res = {};
|
|
10
|
+
if (id)
|
|
11
|
+
res.id = dom.id;
|
|
12
|
+
if (dataset)
|
|
13
|
+
res.dataset = Object.assign({}, dom.dataset);
|
|
14
|
+
if (rect) {
|
|
15
|
+
if (!isViewport) {
|
|
16
|
+
res.left = left;
|
|
17
|
+
res.right = right;
|
|
18
|
+
res.top = top;
|
|
19
|
+
res.bottom = bottom;
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
res.left = 0;
|
|
23
|
+
res.right = 0;
|
|
24
|
+
res.top = 0;
|
|
25
|
+
res.bottom = 0;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (size) {
|
|
29
|
+
if (!isViewport) {
|
|
30
|
+
res.width = width;
|
|
31
|
+
res.height = height;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
res.width = dom.clientWidth;
|
|
35
|
+
res.height = dom.clientHeight;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (scrollOffset) {
|
|
39
|
+
res.scrollLeft = dom.scrollLeft;
|
|
40
|
+
res.scrollTop = dom.scrollTop;
|
|
41
|
+
}
|
|
42
|
+
if (properties.length) {
|
|
43
|
+
properties.forEach(prop => {
|
|
44
|
+
const attr = dom.getAttribute(prop);
|
|
45
|
+
if (attr)
|
|
46
|
+
res[prop] = attr;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
if (computedStyle.length) {
|
|
50
|
+
const styles = window.getComputedStyle(dom);
|
|
51
|
+
computedStyle.forEach(key => {
|
|
52
|
+
const value = styles.getPropertyValue(key) || styles[key];
|
|
53
|
+
if (value)
|
|
54
|
+
res[key] = value;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return res;
|
|
58
|
+
}
|
|
59
|
+
function queryBat(queue, cb) {
|
|
60
|
+
const result = [];
|
|
61
|
+
queue.forEach(item => {
|
|
62
|
+
var _a;
|
|
63
|
+
const { selector, single, fields, component } = item;
|
|
64
|
+
const container = (component !== null ?
|
|
65
|
+
(findDOM(component) || document) :
|
|
66
|
+
document);
|
|
67
|
+
let selectSelf = false;
|
|
68
|
+
if (container !== document) {
|
|
69
|
+
const $nodeList = (_a = container.parentNode) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selector);
|
|
70
|
+
if ($nodeList) {
|
|
71
|
+
for (let i = 0, len = $nodeList.length; i < len; ++i) {
|
|
72
|
+
if (container === $nodeList[i]) {
|
|
73
|
+
selectSelf = true;
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (single) {
|
|
80
|
+
const el = selectSelf === true ? container : container.querySelector(selector);
|
|
81
|
+
result.push(filter(fields, el, selector));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
const $children = container.querySelectorAll(selector);
|
|
85
|
+
const children = [];
|
|
86
|
+
selectSelf === true && children.push(container);
|
|
87
|
+
for (let i = 0, len = $children.length; i < len; ++i) {
|
|
88
|
+
children.push($children[i]);
|
|
89
|
+
}
|
|
90
|
+
result.push(children.map(dom => filter(fields, dom)));
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
cb(result);
|
|
94
|
+
}
|
|
95
|
+
export class SelectorQuery {
|
|
96
|
+
constructor() {
|
|
97
|
+
this._defaultWebviewId = null;
|
|
98
|
+
this._webviewId = null;
|
|
99
|
+
this._queue = [];
|
|
100
|
+
this._queueCb = [];
|
|
101
|
+
this._component;
|
|
102
|
+
}
|
|
103
|
+
in(component) {
|
|
104
|
+
this._component = component;
|
|
105
|
+
return this;
|
|
106
|
+
}
|
|
107
|
+
select(selector) {
|
|
108
|
+
if (typeof selector === 'string')
|
|
109
|
+
selector = selector.replace('>>>', '>');
|
|
110
|
+
return new NodesRef(selector, this, true);
|
|
111
|
+
}
|
|
112
|
+
selectAll(selector) {
|
|
113
|
+
if (typeof selector === 'string')
|
|
114
|
+
selector = selector.replace('>>>', '>');
|
|
115
|
+
return new NodesRef(selector, this, false);
|
|
116
|
+
}
|
|
117
|
+
selectViewport() {
|
|
118
|
+
return new NodesRef('html', this, true);
|
|
119
|
+
}
|
|
120
|
+
exec(cb) {
|
|
121
|
+
queryBat(this._queue, res => {
|
|
122
|
+
const _queueCb = this._queueCb;
|
|
123
|
+
res.forEach((item, index) => {
|
|
124
|
+
const cb = _queueCb[index];
|
|
125
|
+
typeof cb === 'function' && cb.call(this, item);
|
|
126
|
+
});
|
|
127
|
+
typeof cb === 'function' && cb.call(this, res);
|
|
128
|
+
});
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
_push(selector, component, single, fields, callback = null) {
|
|
132
|
+
this._queue.push({
|
|
133
|
+
component,
|
|
134
|
+
selector,
|
|
135
|
+
single,
|
|
136
|
+
fields
|
|
137
|
+
});
|
|
138
|
+
this._queueCb.push(callback);
|
|
139
|
+
}
|
|
140
|
+
}
|