@tarojs/taro-h5 3.5.6 → 3.5.7-alpha.0

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 (100) hide show
  1. package/dist/api/ad/index.d.ts +2 -6
  2. package/dist/api/ai/facial.d.ts +3 -9
  3. package/dist/api/ai/visual.d.ts +2 -6
  4. package/dist/api/alipay/index.d.ts +1 -3
  5. package/dist/api/base/crypto.d.ts +1 -3
  6. package/dist/api/base/debug.d.ts +3 -9
  7. package/dist/api/base/index.d.ts +1 -3
  8. package/dist/api/base/performance.d.ts +2 -6
  9. package/dist/api/base/system.d.ts +2 -8
  10. package/dist/api/base/system.js +1 -1
  11. package/dist/api/base/update.d.ts +2 -6
  12. package/dist/api/base/weapp/app-event.d.ts +12 -36
  13. package/dist/api/base/weapp/life-cycle.d.ts +3 -6
  14. package/dist/api/base/weapp/life-cycle.js +14 -3
  15. package/dist/api/canvas/CanvasContext.js +1 -1
  16. package/dist/api/canvas/index.d.ts +1 -3
  17. package/dist/api/cloud/index.d.ts +9 -27
  18. package/dist/api/data-analysis/index.d.ts +4 -12
  19. package/dist/api/device/accessibility.d.ts +1 -3
  20. package/dist/api/device/battery.d.ts +1 -3
  21. package/dist/api/device/bluetooth-ble.d.ts +16 -48
  22. package/dist/api/device/bluetooth-peripheral.d.ts +3 -9
  23. package/dist/api/device/bluetooth.d.ts +13 -39
  24. package/dist/api/device/calendar.d.ts +2 -6
  25. package/dist/api/device/contact.d.ts +2 -6
  26. package/dist/api/device/crypto.d.ts +1 -3
  27. package/dist/api/device/gyroscope.d.ts +4 -12
  28. package/dist/api/device/iBeacon.d.ts +7 -21
  29. package/dist/api/device/keyboard.d.ts +4 -12
  30. package/dist/api/device/memory.d.ts +2 -6
  31. package/dist/api/device/network.d.ts +3 -9
  32. package/dist/api/device/nfc.d.ts +7 -21
  33. package/dist/api/device/screen.d.ts +6 -18
  34. package/dist/api/device/wifi.d.ts +11 -33
  35. package/dist/api/ext/index.d.ts +2 -6
  36. package/dist/api/files/index.d.ts +8 -24
  37. package/dist/api/location/index.d.ts +9 -27
  38. package/dist/api/media/EditorContext.d.ts +13 -39
  39. package/dist/api/media/audio/index.d.ts +8 -24
  40. package/dist/api/media/background-audio/BackgroundAudioManager.d.ts +4 -12
  41. package/dist/api/media/background-audio/index.d.ts +8 -24
  42. package/dist/api/media/camera.d.ts +1 -3
  43. package/dist/api/media/image/index.d.ts +4 -12
  44. package/dist/api/media/live.d.ts +2 -6
  45. package/dist/api/media/map.d.ts +1 -3
  46. package/dist/api/media/media-recorder.d.ts +1 -3
  47. package/dist/api/media/recorder.d.ts +3 -9
  48. package/dist/api/media/video/index.d.ts +5 -15
  49. package/dist/api/media/video-decoder.d.ts +1 -3
  50. package/dist/api/media/video-processing.d.ts +1 -3
  51. package/dist/api/media/voip.d.ts +14 -42
  52. package/dist/api/navigate/index.d.ts +5 -15
  53. package/dist/api/network/download.js +4 -3
  54. package/dist/api/network/mdns.d.ts +10 -30
  55. package/dist/api/network/request/index.js +5 -4
  56. package/dist/api/network/tcp.d.ts +1 -3
  57. package/dist/api/network/udp.d.ts +1 -3
  58. package/dist/api/network/upload.js +4 -3
  59. package/dist/api/open-api/account.d.ts +1 -3
  60. package/dist/api/open-api/address.d.ts +1 -3
  61. package/dist/api/open-api/authorize.d.ts +2 -6
  62. package/dist/api/open-api/card.d.ts +2 -6
  63. package/dist/api/open-api/channels-live.d.ts +6 -18
  64. package/dist/api/open-api/customer-service.d.ts +1 -3
  65. package/dist/api/open-api/facial.d.ts +4 -12
  66. package/dist/api/open-api/favorites.d.ts +2 -6
  67. package/dist/api/open-api/group.d.ts +1 -3
  68. package/dist/api/open-api/invoice.d.ts +2 -6
  69. package/dist/api/open-api/license-plate.d.ts +1 -3
  70. package/dist/api/open-api/login.d.ts +3 -9
  71. package/dist/api/open-api/red-package.d.ts +1 -3
  72. package/dist/api/open-api/settings.d.ts +2 -6
  73. package/dist/api/open-api/soter.d.ts +3 -9
  74. package/dist/api/open-api/subscribe-message.d.ts +1 -3
  75. package/dist/api/open-api/user-info.d.ts +2 -6
  76. package/dist/api/open-api/werun.d.ts +2 -6
  77. package/dist/api/payment/index.d.ts +2 -6
  78. package/dist/api/share/index.d.ts +10 -30
  79. package/dist/api/storage/background-fetch.d.ts +4 -12
  80. package/dist/api/storage/index.d.ts +2 -6
  81. package/dist/api/swan/index.d.ts +21 -63
  82. package/dist/api/taro.d.ts +1 -3
  83. package/dist/api/ui/background.d.ts +2 -6
  84. package/dist/api/ui/interaction/index.d.ts +2 -6
  85. package/dist/api/ui/menu.d.ts +1 -3
  86. package/dist/api/ui/navigation-bar/index.d.ts +3 -9
  87. package/dist/api/ui/sticky.d.ts +1 -3
  88. package/dist/api/ui/window.d.ts +1 -3
  89. package/dist/api/worker/index.d.ts +1 -3
  90. package/dist/api/wxml/index.d.ts +1 -3
  91. package/dist/index.cjs.d.ts +308 -924
  92. package/dist/index.cjs.js +155 -131
  93. package/dist/index.cjs.js.map +1 -1
  94. package/dist/index.esm.d.ts +308 -924
  95. package/dist/index.esm.js +155 -131
  96. package/dist/index.esm.js.map +1 -1
  97. package/dist/taroApis.d.ts +307 -921
  98. package/dist/utils/index.d.ts +4 -9
  99. package/dist/utils/index.js +48 -36
  100. package/package.json +8 -4
@@ -1,4 +1,5 @@
1
1
  import { TaroElement } from '@tarojs/runtime';
2
+ export declare const isProd: boolean;
2
3
  export declare function shouldBeObject(target: unknown): {
3
4
  flag: boolean;
4
5
  msg?: undefined;
@@ -17,15 +18,9 @@ export declare function getParameterError({ name, para, correct, wrong }: IParam
17
18
  export declare function inlineStyle(style: any): string;
18
19
  export declare function setTransform(el: any, val: any): void;
19
20
  export declare function serializeParams(params: any): string;
20
- export declare function temporarilyNotSupport(apiName: any): () => Promise<{
21
- errMsg: string;
22
- }>;
23
- export declare function weixinCorpSupport(apiName: any): () => Promise<{
24
- errMsg: string;
25
- }>;
26
- export declare function permanentlyNotSupport(apiName: any): () => Promise<{
27
- errMsg: string;
28
- }>;
21
+ export declare function temporarilyNotSupport(name?: string): (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
22
+ export declare function weixinCorpSupport(name: any): (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
23
+ export declare function permanentlyNotSupport(name?: string): (option?: {}, ...args: any[]) => Promise<Partial<TaroGeneral.CallbackResult> & Record<string, unknown> & TaroGeneral.CallbackResult>;
29
24
  interface IProcessOpenApi<TOptions = Record<string, unknown>, TResult extends TaroGeneral.CallbackResult = any> {
30
25
  name: string;
31
26
  defaultOptions?: TOptions;
@@ -1,5 +1,8 @@
1
1
  /* eslint-disable prefer-promise-reject-errors */
2
+ import Taro from '@tarojs/api';
2
3
  import { Current, hooks } from '@tarojs/runtime';
4
+ import { MethodHandler } from './handler';
5
+ export const isProd = process.env.NODE_ENV === 'production';
3
6
  export function shouldBeObject(target) {
4
7
  if (target && typeof target === 'object')
5
8
  return { flag: true };
@@ -67,54 +70,63 @@ export function serializeParams(params) {
67
70
  : encodeURIComponent(params[key])}`))
68
71
  .join('&');
69
72
  }
70
- export function temporarilyNotSupport(apiName) {
71
- return () => {
72
- const errMsg = `暂时不支持 API ${apiName}`;
73
- if (process.env.NODE_ENV !== 'production') {
74
- console.error(errMsg);
75
- return Promise.reject({
76
- errMsg
77
- });
73
+ export function temporarilyNotSupport(name = '') {
74
+ return (option = {}, ...args) => {
75
+ const { success, fail, complete } = option;
76
+ const handle = new MethodHandler({ name, success, fail, complete });
77
+ const errMsg = '暂时不支持 API';
78
+ Taro.eventCenter.trigger('__taroNotSupport', {
79
+ name,
80
+ args: [option, ...args],
81
+ type: 'method',
82
+ category: 'temporarily',
83
+ });
84
+ if (isProd) {
85
+ console.warn(errMsg);
86
+ return handle.success({ errMsg });
78
87
  }
79
88
  else {
80
- console.warn(errMsg);
81
- return Promise.resolve({
82
- errMsg
83
- });
89
+ return handle.fail({ errMsg });
84
90
  }
85
91
  };
86
92
  }
87
- export function weixinCorpSupport(apiName) {
88
- return () => {
89
- const errMsg = `h5端当前仅在微信公众号JS-SDK环境下支持此 API ${apiName}`;
90
- if (process.env.NODE_ENV !== 'production') {
91
- console.error(errMsg);
92
- return Promise.reject({
93
- errMsg
94
- });
93
+ export function weixinCorpSupport(name) {
94
+ return (option = {}, ...args) => {
95
+ const { success, fail, complete } = option;
96
+ const handle = new MethodHandler({ name, success, fail, complete });
97
+ const errMsg = 'h5 端当前仅在微信公众号 JS-SDK 环境下支持此 API';
98
+ Taro.eventCenter.trigger('__taroNotSupport', {
99
+ name,
100
+ args: [option, ...args],
101
+ type: 'method',
102
+ category: 'weixin_corp',
103
+ });
104
+ if (isProd) {
105
+ console.warn(errMsg);
106
+ return handle.success({ errMsg });
95
107
  }
96
108
  else {
97
- console.warn(errMsg);
98
- return Promise.resolve({
99
- errMsg
100
- });
109
+ return handle.fail({ errMsg });
101
110
  }
102
111
  };
103
112
  }
104
- export function permanentlyNotSupport(apiName) {
105
- return () => {
106
- const errMsg = `不支持 API ${apiName}`;
107
- if (process.env.NODE_ENV !== 'production') {
108
- console.error(errMsg);
109
- return Promise.reject({
110
- errMsg
111
- });
113
+ export function permanentlyNotSupport(name = '') {
114
+ return (option = {}, ...args) => {
115
+ const { success, fail, complete } = option;
116
+ const handle = new MethodHandler({ name, success, fail, complete });
117
+ const errMsg = '不支持 API';
118
+ Taro.eventCenter.trigger('__taroNotSupport', {
119
+ name,
120
+ args: [option, ...args],
121
+ type: 'method',
122
+ category: 'permanently',
123
+ });
124
+ if (isProd) {
125
+ console.warn(errMsg);
126
+ return handle.success({ errMsg });
112
127
  }
113
128
  else {
114
- console.warn(errMsg);
115
- return Promise.resolve({
116
- errMsg
117
- });
129
+ return handle.fail({ errMsg });
118
130
  }
119
131
  };
120
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro-h5",
3
- "version": "3.5.6",
3
+ "version": "3.5.7-alpha.0",
4
4
  "description": "Taro h5 framework",
5
5
  "browser": "dist/index.esm.js",
6
6
  "main:h5": "dist/index.js",
@@ -23,14 +23,18 @@
23
23
  "author": "O2Team",
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
- "@tarojs/api": "3.5.6",
27
- "@tarojs/router": "3.5.6",
28
- "@tarojs/runtime": "3.5.6",
26
+ "@tarojs/api": "3.5.7-alpha.0",
27
+ "@tarojs/router": "3.5.7-alpha.0",
28
+ "@tarojs/runtime": "3.5.7-alpha.0",
29
29
  "base64-js": "^1.3.0",
30
30
  "jsonp-retry": "^1.0.3",
31
31
  "query-string": "^7.1.1",
32
32
  "whatwg-fetch": "^3.4.0"
33
33
  },
34
+ "devDependencies": {
35
+ "react": "^18.2.0",
36
+ "react-test-renderer": "^18.2.0"
37
+ },
34
38
  "scripts": {
35
39
  "assets": "cpy 'src/**/*.css' dist",
36
40
  "build": "rimraf ./dist && tsc && pnpm run assets && rollup -c",