@tarojs/taro-h5 3.4.3 → 3.4.6

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 (144) hide show
  1. package/dist/api/location/chooseLocation.js +16 -7
  2. package/dist/api/media/image/chooseImage.js +12 -1
  3. package/dist/api/media/image/getImageInfo.js +16 -1
  4. package/dist/api/network/request/index.js +4 -0
  5. package/dist/dist/api/ad/index.d.ts +6 -0
  6. package/dist/dist/api/ai/facial.d.ts +9 -0
  7. package/dist/dist/api/ai/index.d.ts +2 -0
  8. package/dist/dist/api/ai/visual.d.ts +6 -0
  9. package/dist/dist/api/alipay/index.d.ts +3 -0
  10. package/dist/dist/api/base/crypto.d.ts +3 -0
  11. package/dist/dist/api/base/debug.d.ts +9 -0
  12. package/dist/dist/api/base/index.d.ts +12 -0
  13. package/dist/dist/api/base/performance.d.ts +6 -0
  14. package/dist/dist/api/base/system.d.ts +25 -0
  15. package/dist/dist/api/base/update.d.ts +6 -0
  16. package/dist/dist/api/base/weapp/app-event.d.ts +48 -0
  17. package/dist/dist/api/base/weapp/life-cycle.d.ts +6 -0
  18. package/dist/dist/api/canvas/CanvasContext.d.ts +104 -0
  19. package/dist/dist/api/canvas/canvasGetImageData.d.ts +5 -0
  20. package/dist/dist/api/canvas/canvasPutImageData.d.ts +6 -0
  21. package/dist/dist/api/canvas/canvasToTempFilePath.d.ts +6 -0
  22. package/dist/dist/api/canvas/createCanvasContext.d.ts +5 -0
  23. package/dist/dist/api/canvas/index.d.ts +12 -0
  24. package/dist/dist/api/cloud/index.d.ts +31 -0
  25. package/dist/dist/api/data-analysis/index.d.ts +12 -0
  26. package/dist/dist/api/device/accelerometer.d.ts +17 -0
  27. package/dist/dist/api/device/accessibility.d.ts +3 -0
  28. package/dist/dist/api/device/battery.d.ts +5 -0
  29. package/dist/dist/api/device/bluetooth-ble.d.ts +48 -0
  30. package/dist/dist/api/device/bluetooth-peripheral.d.ts +9 -0
  31. package/dist/dist/api/device/bluetooth.d.ts +39 -0
  32. package/dist/dist/api/device/calendar.d.ts +6 -0
  33. package/dist/dist/api/device/clipboard.d.ts +15 -0
  34. package/dist/dist/api/device/compass.d.ts +17 -0
  35. package/dist/dist/api/device/contact.d.ts +6 -0
  36. package/dist/dist/api/device/crypto.d.ts +3 -0
  37. package/dist/dist/api/device/gyroscope.d.ts +12 -0
  38. package/dist/dist/api/device/iBeacon.d.ts +21 -0
  39. package/dist/dist/api/device/index.d.ts +23 -0
  40. package/dist/dist/api/device/keyboard.d.ts +12 -0
  41. package/dist/dist/api/device/memory.d.ts +6 -0
  42. package/dist/dist/api/device/motion.d.ts +17 -0
  43. package/dist/dist/api/device/network.d.ts +20 -0
  44. package/dist/dist/api/device/nfc.d.ts +21 -0
  45. package/dist/dist/api/device/phone.d.ts +2 -0
  46. package/dist/dist/api/device/scan.d.ts +1 -0
  47. package/dist/dist/api/device/screen.d.ts +18 -0
  48. package/dist/dist/api/device/vibrate.d.ts +9 -0
  49. package/dist/dist/api/device/wifi.d.ts +33 -0
  50. package/dist/dist/api/ext/index.d.ts +6 -0
  51. package/dist/dist/api/files/index.d.ts +24 -0
  52. package/dist/dist/api/framework/index.d.ts +4 -0
  53. package/dist/dist/api/index.d.ts +24 -0
  54. package/dist/dist/api/location/chooseLocation.d.ts +6 -0
  55. package/dist/dist/api/location/index.d.ts +27 -0
  56. package/dist/dist/api/media/EditorContext.d.ts +42 -0
  57. package/dist/dist/api/media/audio/InnerAudioContext.d.ts +58 -0
  58. package/dist/dist/api/media/audio/index.d.ts +29 -0
  59. package/dist/dist/api/media/background-audio/BackgroundAudioManager.d.ts +71 -0
  60. package/dist/dist/api/media/background-audio/index.d.ts +29 -0
  61. package/dist/dist/api/media/camera.d.ts +3 -0
  62. package/dist/dist/api/media/image/chooseImage.d.ts +5 -0
  63. package/dist/dist/api/media/image/getImageInfo.d.ts +5 -0
  64. package/dist/dist/api/media/image/index.d.ts +15 -0
  65. package/dist/dist/api/media/image/previewImage.d.ts +8 -0
  66. package/dist/dist/api/media/index.d.ts +12 -0
  67. package/dist/dist/api/media/live.d.ts +6 -0
  68. package/dist/dist/api/media/map.d.ts +3 -0
  69. package/dist/dist/api/media/media-recorder.d.ts +3 -0
  70. package/dist/dist/api/media/recorder.d.ts +9 -0
  71. package/dist/dist/api/media/video/index.d.ts +24 -0
  72. package/dist/dist/api/media/video-decoder.d.ts +3 -0
  73. package/dist/dist/api/media/video-processing.d.ts +3 -0
  74. package/dist/dist/api/media/voip.d.ts +42 -0
  75. package/dist/dist/api/navigate/index.d.ts +12 -0
  76. package/dist/dist/api/network/download.d.ts +6 -0
  77. package/dist/dist/api/network/index.d.ts +7 -0
  78. package/dist/dist/api/network/mdns.d.ts +30 -0
  79. package/dist/dist/api/network/request/index.d.ts +4 -0
  80. package/dist/dist/api/network/tcp.d.ts +3 -0
  81. package/dist/dist/api/network/udp.d.ts +3 -0
  82. package/dist/dist/api/network/upload.d.ts +5 -0
  83. package/dist/dist/api/network/utils.d.ts +44 -0
  84. package/dist/dist/api/network/websocket/index.d.ts +7 -0
  85. package/dist/dist/api/network/websocket/socketTask.d.ts +25 -0
  86. package/dist/dist/api/open-api/account.d.ts +3 -0
  87. package/dist/dist/api/open-api/address.d.ts +3 -0
  88. package/dist/dist/api/open-api/authorize.d.ts +6 -0
  89. package/dist/dist/api/open-api/card.d.ts +6 -0
  90. package/dist/dist/api/open-api/channels-live.d.ts +18 -0
  91. package/dist/dist/api/open-api/customer-service.d.ts +3 -0
  92. package/dist/dist/api/open-api/facial.d.ts +12 -0
  93. package/dist/dist/api/open-api/favorites.d.ts +6 -0
  94. package/dist/dist/api/open-api/group.d.ts +3 -0
  95. package/dist/dist/api/open-api/index.d.ts +18 -0
  96. package/dist/dist/api/open-api/invoice.d.ts +6 -0
  97. package/dist/dist/api/open-api/license-plate.d.ts +3 -0
  98. package/dist/dist/api/open-api/login.d.ts +9 -0
  99. package/dist/dist/api/open-api/red-package.d.ts +3 -0
  100. package/dist/dist/api/open-api/settings.d.ts +6 -0
  101. package/dist/dist/api/open-api/soter.d.ts +9 -0
  102. package/dist/dist/api/open-api/subscribe-message.d.ts +3 -0
  103. package/dist/dist/api/open-api/user-info.d.ts +6 -0
  104. package/dist/dist/api/open-api/werun.d.ts +6 -0
  105. package/dist/dist/api/payment/index.d.ts +6 -0
  106. package/dist/dist/api/route/index.d.ts +1 -0
  107. package/dist/dist/api/share/index.d.ts +30 -0
  108. package/dist/dist/api/storage/background-fetch.d.ts +12 -0
  109. package/dist/dist/api/storage/index.d.ts +18 -0
  110. package/dist/dist/api/swan/index.d.ts +63 -0
  111. package/dist/dist/api/taro.d.ts +12 -0
  112. package/dist/dist/api/ui/animation/index.d.ts +2 -0
  113. package/dist/dist/api/ui/background.d.ts +6 -0
  114. package/dist/dist/api/ui/custom-component.d.ts +1 -0
  115. package/dist/dist/api/ui/fonts.d.ts +2 -0
  116. package/dist/dist/api/ui/index.d.ts +12 -0
  117. package/dist/dist/api/ui/interaction/actionSheet.d.ts +61 -0
  118. package/dist/dist/api/ui/interaction/index.d.ts +14 -0
  119. package/dist/dist/api/ui/interaction/modal.d.ts +69 -0
  120. package/dist/dist/api/ui/interaction/toast.d.ts +85 -0
  121. package/dist/dist/api/ui/menu.d.ts +3 -0
  122. package/dist/dist/api/ui/navigation-bar/index.d.ts +15 -0
  123. package/dist/dist/api/ui/pull-down-refresh.d.ts +9 -0
  124. package/dist/dist/api/ui/scroll/index.d.ts +5 -0
  125. package/dist/dist/api/ui/sticky.d.ts +3 -0
  126. package/dist/dist/api/ui/tab-bar.d.ts +34 -0
  127. package/dist/dist/api/ui/window.d.ts +15 -0
  128. package/dist/dist/api/utils/handler.d.ts +48 -0
  129. package/dist/dist/api/utils/index.d.ts +38 -0
  130. package/dist/dist/api/worker/index.d.ts +3 -0
  131. package/dist/dist/api/wxml/index.d.ts +5 -0
  132. package/dist/dist/api/wxml/nodesRef.d.ts +13 -0
  133. package/dist/dist/api/wxml/selectorQuery.d.ts +24 -0
  134. package/dist/dist/index.d.ts +4 -0
  135. package/dist/dist/types/type.d.ts +29 -0
  136. package/dist/index.cjs.js +4599 -8469
  137. package/dist/index.cjs.js.map +1 -0
  138. package/dist/taroApis.js +1 -0
  139. package/dist/taroApis.js.map +1 -0
  140. package/package.json +11 -8
  141. package/src/api/location/chooseLocation.ts +14 -4
  142. package/src/api/media/image/chooseImage.ts +18 -1
  143. package/src/api/media/image/getImageInfo.ts +16 -1
  144. package/src/api/network/request/index.ts +4 -0
@@ -1,7 +1,16 @@
1
+ import { stringify } from 'query-string';
1
2
  import { MethodHandler } from '../utils/handler';
2
3
  import './style.css';
3
- function createLocationChooser(handler, key = LOCATION_APIKEY) {
4
- var _a, _b;
4
+ function createLocationChooser(handler, key = LOCATION_APIKEY, mapOpt = {}) {
5
+ var _a, _b, _c;
6
+ const { latitude, longitude, ...opts } = mapOpt;
7
+ const query = {
8
+ key,
9
+ type: 1,
10
+ coord: ((_a = mapOpt.coord) !== null && _a !== void 0 ? _a : [latitude, longitude].every(e => Number(e) >= 0)) ? `${latitude},${longitude}` : undefined,
11
+ referer: 'myapp',
12
+ ...opts
13
+ };
5
14
  const html = `
6
15
  <div class='taro_choose_location'>
7
16
  <div class='taro_choose_location_bar'>
@@ -9,7 +18,7 @@ function createLocationChooser(handler, key = LOCATION_APIKEY) {
9
18
  <p class='taro_choose_location_title'>位置</p>
10
19
  <button class='taro_choose_location_submit'>完成</button>
11
20
  </div>
12
- <iframe class='taro_choose_location_frame' frameborder='0' src='https://apis.map.qq.com/tools/locpicker?search=1&type=1&key=${key}&referer=myapp'></iframe>
21
+ <iframe class='taro_choose_location_frame' frameborder='0' src="https://apis.map.qq.com/tools/locpicker?${stringify(query, { arrayFormat: 'comma', skipNull: true })}" />
13
22
  </div>
14
23
  `;
15
24
  const container = document.createElement('div');
@@ -35,8 +44,8 @@ function createLocationChooser(handler, key = LOCATION_APIKEY) {
35
44
  container.remove();
36
45
  window.removeEventListener('popstate', back);
37
46
  }
38
- (_a = container.querySelector('.taro_choose_location_back')) === null || _a === void 0 ? void 0 : _a.addEventListener('click', back);
39
- (_b = container.querySelector('.taro_choose_location_submit')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', submit);
47
+ (_b = container.querySelector('.taro_choose_location_back')) === null || _b === void 0 ? void 0 : _b.addEventListener('click', back);
48
+ (_c = container.querySelector('.taro_choose_location_submit')) === null || _c === void 0 ? void 0 : _c.addEventListener('click', submit);
40
49
  window.addEventListener('popstate', back);
41
50
  return {
42
51
  show,
@@ -47,7 +56,7 @@ function createLocationChooser(handler, key = LOCATION_APIKEY) {
47
56
  /**
48
57
  * 打开地图选择位置。
49
58
  */
50
- export const chooseLocation = ({ success, fail, complete } = {}) => {
59
+ export const chooseLocation = ({ success, fail, complete, mapOpts } = {}) => {
51
60
  const key = LOCATION_APIKEY;
52
61
  const handle = new MethodHandler({ name: 'chooseLocation', success, fail, complete });
53
62
  return new Promise((resolve, reject) => {
@@ -85,7 +94,7 @@ export const chooseLocation = ({ success, fail, complete } = {}) => {
85
94
  return handle.fail({}, reject);
86
95
  }
87
96
  }
88
- }, key);
97
+ }, key, mapOpts);
89
98
  document.body.appendChild(chooser.container);
90
99
  window.addEventListener('message', onMessage, false);
91
100
  chooser.show();
@@ -11,12 +11,14 @@ export const chooseImage = function (options) {
11
11
  console.error(res.errMsg);
12
12
  return Promise.reject(res);
13
13
  }
14
- const { count = 1, success, fail, complete, imageId = 'taroChooseImage' } = options;
14
+ const { count = 1, success, fail, complete, imageId = 'taroChooseImage', sourceType = ['album', 'camera'] } = options;
15
15
  const handle = new MethodHandler({ name: 'chooseImage', success, fail, complete });
16
16
  const res = {
17
17
  tempFilePaths: [],
18
18
  tempFiles: []
19
19
  };
20
+ const sourceTypeString = sourceType && sourceType.toString();
21
+ const acceptableSourceType = ['user', 'environment', 'camera'];
20
22
  if (count && typeof count !== 'number') {
21
23
  res.errMsg = getParameterError({
22
24
  para: 'count',
@@ -33,6 +35,9 @@ export const chooseImage = function (options) {
33
35
  if (count > 1) {
34
36
  obj.setAttribute('multiple', 'multiple');
35
37
  }
38
+ if (acceptableSourceType.indexOf(sourceTypeString) > -1) {
39
+ obj.setAttribute('capture', sourceTypeString);
40
+ }
36
41
  obj.setAttribute('accept', 'image/*');
37
42
  obj.setAttribute('style', 'position: fixed; top: -4000px; left: -3000px; z-index: -300;');
38
43
  document.body.appendChild(obj);
@@ -45,6 +50,12 @@ export const chooseImage = function (options) {
45
50
  else {
46
51
  el.removeAttribute('multiple');
47
52
  }
53
+ if (acceptableSourceType.indexOf(sourceTypeString) > -1) {
54
+ el.setAttribute('capture', sourceTypeString);
55
+ }
56
+ else {
57
+ el.removeAttribute('capture');
58
+ }
48
59
  }
49
60
  return new Promise(resolve => {
50
61
  const TaroMouseEvents = document.createEvent('MouseEvents');
@@ -11,14 +11,29 @@ export const getImageInfo = (options) => {
11
11
  console.error(res.errMsg);
12
12
  return Promise.reject(res);
13
13
  }
14
+ const getBase64Image = (image) => {
15
+ try {
16
+ const canvas = document.createElement('canvas');
17
+ canvas.width = image.width;
18
+ canvas.height = image.height;
19
+ const ctx = canvas.getContext('2d');
20
+ ctx === null || ctx === void 0 ? void 0 : ctx.drawImage(image, 0, 0, image.width, image.height);
21
+ return canvas.toDataURL('image/png');
22
+ }
23
+ catch (e) {
24
+ console.error('getImageInfo:get base64 fail', e);
25
+ }
26
+ };
14
27
  const { src, success, fail, complete } = options;
15
28
  const handle = new MethodHandler({ name: 'getImageInfo', success, fail, complete });
16
29
  return new Promise((resolve, reject) => {
17
30
  const image = new Image();
31
+ image.crossOrigin = '';
18
32
  image.onload = () => {
19
33
  handle.success({
20
34
  width: image.naturalWidth,
21
- height: image.naturalHeight
35
+ height: image.naturalHeight,
36
+ path: getBase64Image(image) || src
22
37
  }, resolve);
23
38
  };
24
39
  image.onerror = (e) => {
@@ -84,6 +84,10 @@ function _request(options) {
84
84
  params.credentials = options.credentials;
85
85
  return fetch(url, params)
86
86
  .then(response => {
87
+ if (!response) {
88
+ const errorResponse = { ok: false };
89
+ throw errorResponse;
90
+ }
87
91
  res.statusCode = response.status;
88
92
  res.header = {};
89
93
  for (const key of response.headers.keys()) {
@@ -0,0 +1,6 @@
1
+ export declare const createRewardedVideoAd: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const createInterstitialAd: () => Promise<{
5
+ errMsg: string;
6
+ }>;
@@ -0,0 +1,9 @@
1
+ export declare const stopFaceDetect: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const initFaceDetect: () => Promise<{
5
+ errMsg: string;
6
+ }>;
7
+ export declare const faceDetect: () => Promise<{
8
+ errMsg: string;
9
+ }>;
@@ -0,0 +1,2 @@
1
+ export * from './facial';
2
+ export * from './visual';
@@ -0,0 +1,6 @@
1
+ export declare const isVKSupport: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const createVKSession: () => Promise<{
5
+ errMsg: string;
6
+ }>;
@@ -0,0 +1,3 @@
1
+ export declare const getOpenUserInfo: () => Promise<{
2
+ errMsg: string;
3
+ }>;
@@ -0,0 +1,3 @@
1
+ export declare const getUserCryptoManager: () => Promise<{
2
+ errMsg: string;
3
+ }>;
@@ -0,0 +1,9 @@
1
+ export declare const setEnableDebug: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const getRealtimeLogManager: () => Promise<{
5
+ errMsg: string;
6
+ }>;
7
+ export declare const getLogManager: () => Promise<{
8
+ errMsg: string;
9
+ }>;
@@ -0,0 +1,12 @@
1
+ export declare const canIUse: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare function arrayBufferToBase64(arrayBuffer: any): string;
5
+ export declare function base64ToArrayBuffer(base64: any): Uint8Array;
6
+ export * from './system';
7
+ export * from './update';
8
+ export * from './weapp/life-cycle';
9
+ export * from './weapp/app-event';
10
+ export * from './debug';
11
+ export * from './performance';
12
+ export * from './crypto';
@@ -0,0 +1,6 @@
1
+ export declare const reportPerformance: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const getPerformance: () => Promise<{
5
+ errMsg: string;
6
+ }>;
@@ -0,0 +1,25 @@
1
+ import Taro from '@tarojs/api';
2
+ /** 跳转系统蓝牙设置页 */
3
+ export declare const openSystemBluetoothSetting: () => Promise<{
4
+ errMsg: string;
5
+ }>;
6
+ /** 跳转系统微信授权管理页 */
7
+ export declare const openAppAuthorizeSetting: () => Promise<{
8
+ errMsg: string;
9
+ }>;
10
+ /** 获取窗口信息 */
11
+ export declare const getWindowInfo: typeof Taro.getWindowInfo;
12
+ /** 获取设备设置 */
13
+ export declare const getSystemSetting: typeof Taro.getSystemSetting;
14
+ /** 获取设备设置 */
15
+ export declare const getDeviceInfo: typeof Taro.getDeviceInfo;
16
+ /** 获取微信APP基础信息 */
17
+ export declare const getAppBaseInfo: typeof Taro.getAppBaseInfo;
18
+ /** 获取微信APP授权设置 */
19
+ export declare const getAppAuthorizeSetting: typeof Taro.getAppAuthorizeSetting;
20
+ /** 获取设备设置 */
21
+ export declare const getSystemInfoSync: typeof Taro.getSystemInfoSync;
22
+ /** 获取系统信息 */
23
+ export declare const getSystemInfoAsync: typeof Taro.getSystemInfoAsync;
24
+ /** 获取系统信息 */
25
+ export declare const getSystemInfo: typeof Taro.getSystemInfo;
@@ -0,0 +1,6 @@
1
+ export declare const updateWeChatApp: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const getUpdateManager: () => Promise<{
5
+ errMsg: string;
6
+ }>;
@@ -0,0 +1,48 @@
1
+ export declare const onUnhandledRejection: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const onThemeChange: () => Promise<{
5
+ errMsg: string;
6
+ }>;
7
+ export declare const onPageNotFound: () => Promise<{
8
+ errMsg: string;
9
+ }>;
10
+ export declare const onError: () => Promise<{
11
+ errMsg: string;
12
+ }>;
13
+ export declare const onAudioInterruptionEnd: () => Promise<{
14
+ errMsg: string;
15
+ }>;
16
+ export declare const onAudioInterruptionBegin: () => Promise<{
17
+ errMsg: string;
18
+ }>;
19
+ export declare const onAppShow: () => Promise<{
20
+ errMsg: string;
21
+ }>;
22
+ export declare const onAppHide: () => Promise<{
23
+ errMsg: string;
24
+ }>;
25
+ export declare const offUnhandledRejection: () => Promise<{
26
+ errMsg: string;
27
+ }>;
28
+ export declare const offThemeChange: () => Promise<{
29
+ errMsg: string;
30
+ }>;
31
+ export declare const offPageNotFound: () => Promise<{
32
+ errMsg: string;
33
+ }>;
34
+ export declare const offError: () => Promise<{
35
+ errMsg: string;
36
+ }>;
37
+ export declare const offAudioInterruptionEnd: () => Promise<{
38
+ errMsg: string;
39
+ }>;
40
+ export declare const offAudioInterruptionBegin: () => Promise<{
41
+ errMsg: string;
42
+ }>;
43
+ export declare const offAppShow: () => Promise<{
44
+ errMsg: string;
45
+ }>;
46
+ export declare const offAppHide: () => Promise<{
47
+ errMsg: string;
48
+ }>;
@@ -0,0 +1,6 @@
1
+ export declare const getLaunchOptionsSync: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const getEnterOptionsSync: () => Promise<{
5
+ errMsg: string;
6
+ }>;
@@ -0,0 +1,104 @@
1
+ import { CanvasGradient } from '@tarojs/api';
2
+ interface IAction {
3
+ func: (...arr: any[]) => void;
4
+ args: any[];
5
+ }
6
+ export declare class CanvasContext implements Taro.CanvasContext {
7
+ __raw__: CanvasRenderingContext2D;
8
+ actions: IAction[];
9
+ constructor(canvas: any, ctx: any);
10
+ set ctx(e: CanvasRenderingContext2D);
11
+ get ctx(): CanvasRenderingContext2D;
12
+ canvas: HTMLCanvasElement;
13
+ protected emptyActions(): void;
14
+ protected enqueueActions(func: IAction['func'], ...args: any[]): void;
15
+ set fillStyle(e: string);
16
+ get fillStyle(): string;
17
+ set font(e: string);
18
+ get font(): string;
19
+ set globalAlpha(e: number);
20
+ get globalAlpha(): number;
21
+ set globalCompositeOperation(e: string);
22
+ get globalCompositeOperation(): string;
23
+ set lineCap(e: CanvasLineCap);
24
+ get lineCap(): CanvasLineCap;
25
+ set lineDashOffset(e: number);
26
+ get lineDashOffset(): number;
27
+ set lineJoin(e: CanvasLineJoin);
28
+ get lineJoin(): CanvasLineJoin;
29
+ set lineWidth(e: number);
30
+ get lineWidth(): number;
31
+ set miterLimit(e: number);
32
+ get miterLimit(): number;
33
+ set shadowBlur(e: number);
34
+ get shadowBlur(): number;
35
+ set shadowColor(e: string);
36
+ get shadowColor(): string;
37
+ set shadowOffsetX(e: number);
38
+ get shadowOffsetX(): number;
39
+ set shadowOffsetY(e: number);
40
+ get shadowOffsetY(): number;
41
+ set strokeStyle(e: string);
42
+ get strokeStyle(): string;
43
+ /** 小程序文档中不包括 ↓↓↓ */
44
+ set textAlign(e: CanvasTextAlign);
45
+ get textAlign(): CanvasTextAlign;
46
+ set textBaseline(e: CanvasTextBaseline);
47
+ get textBaseline(): CanvasTextBaseline;
48
+ set direction(e: CanvasDirection);
49
+ get direction(): CanvasDirection;
50
+ set imageSmoothingEnabled(e: boolean);
51
+ get imageSmoothingEnabled(): boolean;
52
+ set imageSmoothingQuality(e: ImageSmoothingQuality);
53
+ get imageSmoothingQuality(): ImageSmoothingQuality;
54
+ set filter(e: string);
55
+ get filter(): string;
56
+ /** 小程序文档中不包括 ↑↑↑ */
57
+ arc(...args: any[]): void;
58
+ arcTo(...args: any[]): void;
59
+ beginPath(...args: any[]): void;
60
+ bezierCurveTo(...args: any[]): void;
61
+ clearRect(...args: any[]): void;
62
+ clip(...args: any[]): void;
63
+ closePath(...args: any[]): void;
64
+ createPattern(image: string, repetition: keyof Taro.CanvasContext.Repetition): void;
65
+ /**
66
+ * 将之前在绘图上下文中的描述(路径、变形、样式)画到 canvas 中。
67
+ * @todo 每次 draw 都会读取 width 和 height
68
+ */
69
+ draw(reserve?: boolean, callback?: (...args: any[]) => any): Promise<void>;
70
+ drawImage(imageResource: string, ...extra: any[]): void;
71
+ fill(...args: any[]): void;
72
+ fillRect(...args: any[]): void;
73
+ fillText(...args: any[]): void;
74
+ lineTo(...args: any[]): void;
75
+ moveTo(...args: any[]): void;
76
+ quadraticCurveTo(...args: any[]): void;
77
+ rect(...args: any[]): void;
78
+ restore(...args: any[]): void;
79
+ rotate(...args: any[]): void;
80
+ save(...args: any[]): void;
81
+ scale(...args: any[]): void;
82
+ setFillStyle(color: string | CanvasGradient): void;
83
+ setFontSize(fontSize: number): void;
84
+ setGlobalAlpha(alpha: number): void;
85
+ setLineCap(lineCap: keyof Taro.CanvasContext.LineCap): void;
86
+ setLineDash(pattern: number[], offset: number): void;
87
+ setLineJoin(lineJoin: keyof Taro.CanvasContext.LineJoin): void;
88
+ setLineWidth(lineWidth: number): void;
89
+ setMiterLimit(miterLimit: number): void;
90
+ setShadow(offsetX: number, offsetY: number, blur: number, color: string): void;
91
+ setStrokeStyle(color: string | CanvasGradient): void;
92
+ setTextAlign(align: keyof Taro.CanvasContext.Align): void;
93
+ setTextBaseline(textBaseline: keyof Taro.CanvasContext.TextBaseline): void;
94
+ setTransform(...args: any[]): void;
95
+ stroke(...args: any[]): void;
96
+ strokeRect(...args: any[]): void;
97
+ strokeText(...args: any[]): void;
98
+ transform(...args: any[]): void;
99
+ translate(...args: any[]): void;
100
+ measureText(text: string): TextMetrics;
101
+ createCircularGradient(x: number, y: number, r: number): CanvasGradient;
102
+ createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
103
+ }
104
+ export {};
@@ -0,0 +1,5 @@
1
+ import Taro from '@tarojs/api';
2
+ /**
3
+ * 获取 canvas 区域隐含的像素数据。
4
+ */
5
+ export declare const canvasGetImageData: typeof Taro.canvasGetImageData;
@@ -0,0 +1,6 @@
1
+ import Taro from '@tarojs/api';
2
+ /**
3
+ * 将像素数据绘制到画布。在自定义组件下,第二个参数传入自定义组件实例 this,以操作组件内 <canvas> 组件
4
+ * @todo 暂未支持尺寸相关功能
5
+ */
6
+ export declare const canvasPutImageData: typeof Taro.canvasPutImageData;
@@ -0,0 +1,6 @@
1
+ import Taro from '@tarojs/api';
2
+ /**
3
+ * 把当前画布指定区域的内容导出生成指定大小的图片。在 draw() 回调里调用该方法才能保证图片导出成功。
4
+ * @todo 暂未支持尺寸相关功能
5
+ */
6
+ export declare const canvasToTempFilePath: typeof Taro.canvasToTempFilePath;
@@ -0,0 +1,5 @@
1
+ import Taro from '@tarojs/api';
2
+ /**
3
+ * 创建 canvas 的绘图上下文 CanvasContext 对象
4
+ */
5
+ export declare const createCanvasContext: typeof Taro.createCanvasContext;
@@ -0,0 +1,12 @@
1
+ /** 创建离屏 canvas 实例 */
2
+ export declare const createOffscreenCanvas: () => Promise<{
3
+ errMsg: string;
4
+ }>;
5
+ /** 创建 canvas 的绘图上下文 CanvasContext 对象 */
6
+ export * from './createCanvasContext';
7
+ /** 把当前画布指定区域的内容导出生成指定大小的图片 */
8
+ export * from './canvasToTempFilePath';
9
+ /** 将像素数据绘制到画布 */
10
+ export * from './canvasPutImageData';
11
+ /** 获取 canvas 区域隐含的像素数据 */
12
+ export * from './canvasGetImageData';
@@ -0,0 +1,31 @@
1
+ import Taro from '@tarojs/api';
2
+ export declare class cloud implements Taro.cloud {
3
+ Cloud: new (options: Taro.cloud.IOptions) => Taro.Cloud;
4
+ init: () => Promise<{
5
+ errMsg: string;
6
+ }>;
7
+ CloudID: () => Promise<{
8
+ errMsg: string;
9
+ }>;
10
+ callFunction: () => Promise<{
11
+ errMsg: string;
12
+ }>;
13
+ uploadFile: () => Promise<{
14
+ errMsg: string;
15
+ }>;
16
+ downloadFile: () => Promise<{
17
+ errMsg: string;
18
+ }>;
19
+ getTempFileURL: () => Promise<{
20
+ errMsg: string;
21
+ }>;
22
+ deleteFile: () => Promise<{
23
+ errMsg: string;
24
+ }>;
25
+ database: () => Promise<{
26
+ errMsg: string;
27
+ }>;
28
+ callContainer: () => Promise<{
29
+ errMsg: string;
30
+ }>;
31
+ }
@@ -0,0 +1,12 @@
1
+ export declare const reportMonitor: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const reportAnalytics: () => Promise<{
5
+ errMsg: string;
6
+ }>;
7
+ export declare const reportEvent: () => Promise<{
8
+ errMsg: string;
9
+ }>;
10
+ export declare const getExptInfoSync: () => Promise<{
11
+ errMsg: string;
12
+ }>;
@@ -0,0 +1,17 @@
1
+ import Taro from '@tarojs/api';
2
+ /**
3
+ * 停止监听加速度数据。
4
+ */
5
+ export declare const stopAccelerometer: typeof Taro.stopAccelerometer;
6
+ /**
7
+ * 开始监听加速度数据。
8
+ */
9
+ export declare const startAccelerometer: typeof Taro.startAccelerometer;
10
+ /**
11
+ * 监听加速度数据事件。频率根据 Taro.startAccelerometer() 的 interval 参数。可使用 Taro.stopAccelerometer() 停止监听。
12
+ */
13
+ export declare const onAccelerometerChange: typeof Taro.onAccelerometerChange;
14
+ /**
15
+ * 取消监听加速度数据事件,参数为空,则取消所有的事件监听
16
+ */
17
+ export declare const offAccelerometerChange: typeof Taro.offAccelerometerChange;
@@ -0,0 +1,3 @@
1
+ export declare const checkIsOpenAccessibility: () => Promise<{
2
+ errMsg: string;
3
+ }>;
@@ -0,0 +1,5 @@
1
+ import Taro from '@tarojs/api';
2
+ export declare const getBatteryInfoSync: () => Promise<{
3
+ errMsg: string;
4
+ }>;
5
+ export declare const getBatteryInfo: typeof Taro.getBatteryInfo;
@@ -0,0 +1,48 @@
1
+ export declare const writeBLECharacteristicValue: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const setBLEMTU: () => Promise<{
5
+ errMsg: string;
6
+ }>;
7
+ export declare const readBLECharacteristicValue: () => Promise<{
8
+ errMsg: string;
9
+ }>;
10
+ export declare const onBLEMTUChange: () => Promise<{
11
+ errMsg: string;
12
+ }>;
13
+ export declare const onBLEConnectionStateChange: () => Promise<{
14
+ errMsg: string;
15
+ }>;
16
+ export declare const onBLECharacteristicValueChange: () => Promise<{
17
+ errMsg: string;
18
+ }>;
19
+ export declare const offBLEMTUChange: () => Promise<{
20
+ errMsg: string;
21
+ }>;
22
+ export declare const offBLEConnectionStateChange: () => Promise<{
23
+ errMsg: string;
24
+ }>;
25
+ export declare const offBLECharacteristicValueChange: () => Promise<{
26
+ errMsg: string;
27
+ }>;
28
+ export declare const notifyBLECharacteristicValueChange: () => Promise<{
29
+ errMsg: string;
30
+ }>;
31
+ export declare const getBLEMTU: () => Promise<{
32
+ errMsg: string;
33
+ }>;
34
+ export declare const getBLEDeviceServices: () => Promise<{
35
+ errMsg: string;
36
+ }>;
37
+ export declare const getBLEDeviceRSSI: () => Promise<{
38
+ errMsg: string;
39
+ }>;
40
+ export declare const getBLEDeviceCharacteristics: () => Promise<{
41
+ errMsg: string;
42
+ }>;
43
+ export declare const createBLEConnection: () => Promise<{
44
+ errMsg: string;
45
+ }>;
46
+ export declare const closeBLEConnection: () => Promise<{
47
+ errMsg: string;
48
+ }>;
@@ -0,0 +1,9 @@
1
+ export declare const onBLEPeripheralConnectionStateChanged: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const offBLEPeripheralConnectionStateChanged: () => Promise<{
5
+ errMsg: string;
6
+ }>;
7
+ export declare const createBLEPeripheralServer: () => Promise<{
8
+ errMsg: string;
9
+ }>;
@@ -0,0 +1,39 @@
1
+ export declare const stopBluetoothDevicesDiscovery: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const startBluetoothDevicesDiscovery: () => Promise<{
5
+ errMsg: string;
6
+ }>;
7
+ export declare const openBluetoothAdapter: () => Promise<{
8
+ errMsg: string;
9
+ }>;
10
+ export declare const onBluetoothDeviceFound: () => Promise<{
11
+ errMsg: string;
12
+ }>;
13
+ export declare const onBluetoothAdapterStateChange: () => Promise<{
14
+ errMsg: string;
15
+ }>;
16
+ export declare const offBluetoothDeviceFound: () => Promise<{
17
+ errMsg: string;
18
+ }>;
19
+ export declare const offBluetoothAdapterStateChange: () => Promise<{
20
+ errMsg: string;
21
+ }>;
22
+ export declare const makeBluetoothPair: () => Promise<{
23
+ errMsg: string;
24
+ }>;
25
+ export declare const isBluetoothDevicePaired: () => Promise<{
26
+ errMsg: string;
27
+ }>;
28
+ export declare const getConnectedBluetoothDevices: () => Promise<{
29
+ errMsg: string;
30
+ }>;
31
+ export declare const getBluetoothDevices: () => Promise<{
32
+ errMsg: string;
33
+ }>;
34
+ export declare const getBluetoothAdapterState: () => Promise<{
35
+ errMsg: string;
36
+ }>;
37
+ export declare const closeBluetoothAdapter: () => Promise<{
38
+ errMsg: string;
39
+ }>;
@@ -0,0 +1,6 @@
1
+ export declare const addPhoneRepeatCalendar: () => Promise<{
2
+ errMsg: string;
3
+ }>;
4
+ export declare const addPhoneCalendar: () => Promise<{
5
+ errMsg: string;
6
+ }>;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 剪贴板部分的api参考了Chameleon项目的实现:
3
+ *
4
+ * setClipboardData: https://github.com/chameleon-team/chameleon-api/tree/master/src/interfaces/setClipBoardData
5
+ * getClipboardData: https://github.com/chameleon-team/chameleon-api/tree/master/src/interfaces/getClipBoardData
6
+ */
7
+ import Taro from '@tarojs/api';
8
+ /**
9
+ * 设置系统剪贴板的内容
10
+ */
11
+ export declare const setClipboardData: typeof Taro.setClipboardData;
12
+ /**
13
+ * 获取系统剪贴板的内容
14
+ */
15
+ export declare const getClipboardData: typeof Taro.getClipboardData;