@tarojs/taro-h5 3.6.5-alpha → 3.6.5-alpha.2

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 (36) hide show
  1. package/dist/api/ai/index.d.ts +2 -2
  2. package/dist/api/base/index.d.ts +7 -7
  3. package/dist/api/canvas/index.d.ts +4 -4
  4. package/dist/api/device/battery.js +3 -2
  5. package/dist/api/device/battery.js.map +1 -1
  6. package/dist/api/device/index.d.ts +23 -23
  7. package/dist/api/framework/index.js.map +1 -1
  8. package/dist/api/index.d.ts +24 -24
  9. package/dist/api/location/index.d.ts +2 -2
  10. package/dist/api/location/style.scss.js +2 -2
  11. package/dist/api/media/audio/InnerAudioContext.d.ts +1 -1
  12. package/dist/api/media/background-audio/BackgroundAudioManager.d.ts +1 -1
  13. package/dist/api/media/background-audio/index.d.ts +1 -1
  14. package/dist/api/media/image/index.d.ts +3 -3
  15. package/dist/api/media/index.d.ts +12 -12
  16. package/dist/api/network/index.d.ts +7 -7
  17. package/dist/api/network/request/index.js +17 -0
  18. package/dist/api/network/request/index.js.map +1 -1
  19. package/dist/api/open-api/index.d.ts +18 -18
  20. package/dist/api/storage/index.d.ts +1 -1
  21. package/dist/api/ui/index.d.ts +12 -12
  22. package/dist/api/wxml/IntersectionObserver.js +7 -7
  23. package/dist/api/wxml/IntersectionObserver.js.map +1 -1
  24. package/dist/api/wxml/MediaQueryObserver.js +2 -0
  25. package/dist/api/wxml/MediaQueryObserver.js.map +1 -1
  26. package/dist/api/wxml/nodesRef.d.ts +1 -1
  27. package/dist/api/wxml/selectorQuery.d.ts +1 -1
  28. package/dist/index.cjs.d.ts +1 -0
  29. package/dist/index.cjs.js +30 -10
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.d.ts +3 -3
  32. package/dist/index.esm.d.ts +1 -0
  33. package/dist/index.esm.js +30 -10
  34. package/dist/index.esm.js.map +1 -1
  35. package/dist/utils/index.d.ts +3 -3
  36. package/package.json +10 -7
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import taro from "./api/taro";
2
- export * from "./api/index";
3
- export * from "./api/taro";
1
+ import taro from "./api/taro.js";
2
+ export * from "./api/index.js";
3
+ export * from "./api/taro.js";
4
4
  export { taro as default };
@@ -149,6 +149,7 @@ declare const offAccelerometerChange: typeof Taro.offAccelerometerChange;
149
149
  // 无障碍
150
150
  declare const checkIsOpenAccessibility: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
151
151
  // 电量
152
+ // Note: 浏览器标准下不支持,其他实现方案不准确,不建议开发者使用
152
153
  declare const getBatteryInfoSync: (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
153
154
  declare const getBatteryInfo: typeof Taro.getBatteryInfo;
154
155
  // 蓝牙-通用
package/dist/index.esm.js CHANGED
@@ -9,6 +9,7 @@ import { getMobileDetect, setTitle } from '@tarojs/router/dist/utils/navigate';
9
9
  import { parse, stringify } from 'query-string';
10
10
  import { defineCustomElementTaroSwiperCore, defineCustomElementTaroSwiperItemCore } from '@tarojs/components/dist/components';
11
11
  import 'whatwg-fetch';
12
+ import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only';
12
13
  import jsonpRetry from 'jsonp-retry';
13
14
 
14
15
  class MethodHandler {
@@ -1239,7 +1240,8 @@ const offAccelerometerChange = callback => {
1239
1240
  const checkIsOpenAccessibility = temporarilyNotSupport('checkIsOpenAccessibility');
1240
1241
 
1241
1242
  // 电量
1242
- const getBatteryInfoSync = temporarilyNotSupport('getBatteryInfoSync');
1243
+ // Note: 浏览器标准下不支持,其他实现方案不准确,不建议开发者使用
1244
+ const getBatteryInfoSync = permanentlyNotSupport('getBatteryInfoSync');
1243
1245
  const getBatteryInfo = ({ success, fail, complete } = {}) => __awaiter(void 0, void 0, void 0, function* () {
1244
1246
  var _a;
1245
1247
  const handle = new MethodHandler({ name: 'getBatteryInfo', success, fail, complete });
@@ -1987,8 +1989,8 @@ function styleInject(css, ref) {
1987
1989
  }
1988
1990
  }
1989
1991
 
1990
- 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 .taro_choose_location_bar {\n display: flex;\n flex: 0 95px;\n height: 95px;\n background-color: #ededed;\n color: #090909; }\n .taro_choose_location_back {\n position: relative;\n flex: 0 45px;\n margin-top: 30px;\n width: 33px;\n height: 30px; }\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 .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 .taro_choose_location_title {\n flex: 1;\n padding-left: 30px;\n line-height: 95px; }\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 .taro_choose_location_frame {\n flex: 1; }\n";
1991
- 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 .taro_choose_location_bar {\n display: flex;\n flex: 0 95px;\n height: 95px;\n background-color: #ededed;\n color: #090909; }\n .taro_choose_location_back {\n position: relative;\n flex: 0 45px;\n margin-top: 30px;\n width: 33px;\n height: 30px; }\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 .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 .taro_choose_location_title {\n flex: 1;\n padding-left: 30px;\n line-height: 95px; }\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 .taro_choose_location_frame {\n flex: 1; }\n";
1992
+ 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}";
1993
+ 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}";
1992
1994
  styleInject(css_248z,{"insertAt":"top"});
1993
1995
 
1994
1996
  function createLocationChooser(handler, key = LOCATION_APIKEY, mapOpt = {}) {
@@ -2908,12 +2910,24 @@ function _request(options) {
2908
2910
  if (options.mode) {
2909
2911
  params.mode = options.mode;
2910
2912
  }
2913
+ let timeoutTimer = null;
2911
2914
  if (options.signal) {
2912
2915
  params.signal = options.signal;
2913
2916
  }
2917
+ else if (typeof options.timeout === 'number') {
2918
+ const controller = new window.AbortController();
2919
+ params.signal = controller.signal;
2920
+ timeoutTimer = setTimeout(function () {
2921
+ controller.abort();
2922
+ }, options.timeout);
2923
+ }
2914
2924
  params.credentials = options.credentials;
2915
2925
  return fetch(url, params)
2916
2926
  .then(response => {
2927
+ if (timeoutTimer) {
2928
+ clearTimeout(timeoutTimer);
2929
+ timeoutTimer = null;
2930
+ }
2917
2931
  if (!response) {
2918
2932
  const errorResponse = { ok: false };
2919
2933
  throw errorResponse;
@@ -2945,6 +2959,10 @@ function _request(options) {
2945
2959
  return res;
2946
2960
  })
2947
2961
  .catch(err => {
2962
+ if (timeoutTimer) {
2963
+ clearTimeout(timeoutTimer);
2964
+ timeoutTimer = null;
2965
+ }
2948
2966
  isFunction(fail) && fail(err);
2949
2967
  isFunction(complete) && complete(res);
2950
2968
  err.statusCode = res.statusCode;
@@ -5005,6 +5023,13 @@ const createWorker = temporarilyNotSupport('createWorker');
5005
5023
  // pollify
5006
5024
  import('intersection-observer');
5007
5025
  class TaroH5IntersectionObserver {
5026
+ // selector 的容器节点
5027
+ get container() {
5028
+ const container = (this._component !== null
5029
+ ? (findDOM(this._component) || document)
5030
+ : document);
5031
+ return container;
5032
+ }
5008
5033
  constructor(component, options = {}) {
5009
5034
  // 选项
5010
5035
  this._options = {
@@ -5021,13 +5046,6 @@ class TaroH5IntersectionObserver {
5021
5046
  this._component = component;
5022
5047
  Object.assign(this._options, options);
5023
5048
  }
5024
- // selector 的容器节点
5025
- get container() {
5026
- const container = (this._component !== null
5027
- ? (findDOM(this._component) || document)
5028
- : document);
5029
- return container;
5030
- }
5031
5049
  createInst() {
5032
5050
  // 去除原本的实例
5033
5051
  this.disconnect();
@@ -5137,6 +5155,7 @@ class MediaQueryObserver {
5137
5155
  this._mediaQueryObserver.addEventListener('change', this._listener);
5138
5156
  }
5139
5157
  else {
5158
+ // @ts-ignore
5140
5159
  this._mediaQueryObserver.addListener(this._listener);
5141
5160
  }
5142
5161
  }
@@ -5149,6 +5168,7 @@ class MediaQueryObserver {
5149
5168
  this._mediaQueryObserver.removeEventListener('change', this._listener);
5150
5169
  }
5151
5170
  else {
5171
+ // @ts-ignore
5152
5172
  this._mediaQueryObserver.removeListener(this._listener);
5153
5173
  }
5154
5174
  }