@nutui/nutui-react-taro 3.0.7 → 3.0.9-beta.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 (233) hide show
  1. package/CHANGELOG.md +30 -14
  2. package/dist/cjs/hooks/index.d.ts +12 -0
  3. package/dist/cjs/hooks/index.js +19 -0
  4. package/dist/cjs/hooks/{use-custom-event.js → taro/use-custom-event.js} +1 -1
  5. package/dist/cjs/hooks/{use-lock-scoll-taro.js → taro/use-lock-scoll.js} +1 -1
  6. package/dist/cjs/hooks/use-memo.d.ts +1 -1
  7. package/dist/cjs/hooks/use-memo.js +1 -1
  8. package/dist/cjs/hooks/use-refs.d.ts +1 -1
  9. package/dist/cjs/hooks/use-refs.js +1 -1
  10. package/dist/cjs/hooks/use-uuid.d.ts +1 -1
  11. package/dist/cjs/hooks/use-uuid.js +1 -1
  12. package/dist/cjs/hooks/use-watch.d.ts +2 -2
  13. package/dist/cjs/hooks/use-watch.js +2 -3
  14. package/dist/cjs/packages/address/address.d.ts +1 -1
  15. package/dist/cjs/packages/avatar/avatar.js +6 -6
  16. package/dist/cjs/packages/avatar/style/style.css +4 -0
  17. package/dist/cjs/packages/avatarcropper/avatarcropper.js +1 -1
  18. package/dist/cjs/packages/badge/badge.js +5 -5
  19. package/dist/cjs/packages/barrage/barrage.js +3 -3
  20. package/dist/cjs/packages/button/button.js +3 -3
  21. package/dist/cjs/packages/cascader/cascader.js +2 -1
  22. package/dist/cjs/packages/cell/cell.js +2 -2
  23. package/dist/cjs/packages/col/col.js +3 -3
  24. package/dist/cjs/packages/collapseitem/collapseitem.js +4 -4
  25. package/dist/cjs/packages/configprovider/configprovider.js +2 -2
  26. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  27. package/dist/cjs/packages/countdown/countdown.js +2 -2
  28. package/dist/cjs/packages/dialog/dialog.js +5 -5
  29. package/dist/cjs/packages/dialog/style/dialog.scss +1 -0
  30. package/dist/cjs/packages/dialog/style/style.css +1 -0
  31. package/dist/cjs/packages/dialog/style/style.harmony.css +1 -0
  32. package/dist/cjs/packages/drag/drag.js +5 -5
  33. package/dist/cjs/packages/elevator/elevator.js +4 -4
  34. package/dist/cjs/packages/ellipsis/ellipsis.js +4 -4
  35. package/dist/cjs/packages/griditem/griditem.js +4 -4
  36. package/dist/cjs/packages/hoverbutton/hoverbutton.js +2 -2
  37. package/dist/cjs/packages/hoverbuttonitem/hoverbuttonitem.js +2 -2
  38. package/dist/cjs/packages/image/image.js +12 -11
  39. package/dist/cjs/packages/image/style/image.scss +4 -1
  40. package/dist/cjs/packages/image/style/style.css +4 -0
  41. package/dist/cjs/packages/image/style/style.harmony.css +4 -0
  42. package/dist/cjs/packages/imagepreview/style/style.css +4 -0
  43. package/dist/cjs/packages/indicator/indicator.js +2 -2
  44. package/dist/cjs/packages/infiniteloading/infiniteloading.js +2 -2
  45. package/dist/cjs/packages/lottie/lottiemp.js +3 -3
  46. package/dist/cjs/packages/menuitem/menuitem.js +4 -4
  47. package/dist/cjs/packages/noticebar/noticebar.js +4 -4
  48. package/dist/cjs/packages/notify/notify.js +5 -5
  49. package/dist/cjs/packages/nutui.react.build.d.ts +2 -0
  50. package/dist/cjs/packages/nutui.react.build.js +2 -0
  51. package/dist/cjs/packages/nutui.react.d.ts +2 -0
  52. package/dist/cjs/packages/nutui.react.js +2 -0
  53. package/dist/cjs/packages/overlay/overlay.js +2 -2
  54. package/dist/cjs/packages/pagination/pagination.js +3 -3
  55. package/dist/cjs/packages/picker/picker.js +2 -2
  56. package/dist/cjs/packages/pickerview/pickerroller.js +7 -7
  57. package/dist/cjs/packages/popover/popover.js +15 -15
  58. package/dist/cjs/packages/popup/popup.js +4 -4
  59. package/dist/cjs/packages/price/price.js +2 -2
  60. package/dist/cjs/packages/progress/progress.js +13 -13
  61. package/dist/cjs/packages/pulltorefresh/pulltorefresh.js +4 -4
  62. package/dist/cjs/packages/range/range.js +13 -13
  63. package/dist/cjs/packages/rate/rate.js +4 -4
  64. package/dist/cjs/packages/sidebar/sidebar.js +13 -5
  65. package/dist/cjs/packages/skeleton/skeleton.js +1 -2
  66. package/dist/cjs/packages/sticky/sticky.js +7 -7
  67. package/dist/cjs/packages/swipe/swipe.js +11 -11
  68. package/dist/cjs/packages/swiper/swiper.js +4 -4
  69. package/dist/cjs/packages/switch/switch.js +53 -8
  70. package/dist/cjs/packages/tabs/tabs.js +2 -2
  71. package/dist/cjs/packages/toast/toast.js +3 -3
  72. package/dist/cjs/packages/tour/tour.js +2 -2
  73. package/dist/cjs/packages/trendarrow/trendarrow.js +3 -3
  74. package/dist/cjs/packages/virtuallist/virtuallist.js +1 -1
  75. package/dist/cjs/utils/clamp.d.ts +1 -0
  76. package/dist/cjs/utils/clamp.js +13 -0
  77. package/dist/cjs/utils/event-mocker.d.ts +21 -0
  78. package/dist/cjs/utils/index.d.ts +28 -6
  79. package/dist/cjs/utils/index.js +35 -54
  80. package/dist/cjs/utils/interceptor.js +2 -2
  81. package/dist/cjs/utils/is-function.d.ts +1 -0
  82. package/dist/cjs/utils/is-function.js +14 -0
  83. package/dist/cjs/utils/is-object.d.ts +1 -0
  84. package/dist/cjs/utils/is-object.js +14 -0
  85. package/dist/cjs/utils/is-promise.d.ts +1 -0
  86. package/dist/cjs/utils/is-promise.js +15 -0
  87. package/dist/cjs/utils/lru.d.ts +1 -1
  88. package/dist/cjs/utils/lru.js +1 -1
  89. package/dist/cjs/utils/merge.d.ts +0 -1
  90. package/dist/cjs/utils/merge.js +0 -4
  91. package/dist/cjs/utils/prevent-default.d.ts +1 -0
  92. package/dist/cjs/utils/prevent-default.js +18 -0
  93. package/dist/cjs/utils/raf.d.ts +0 -1
  94. package/dist/cjs/utils/raf.js +3 -6
  95. package/dist/cjs/utils/{add-color-for-harmony.js → taro/add-color-for-harmony.js} +5 -11
  96. package/dist/cjs/{hooks/use-taro-rect.js → utils/taro/get-rect-by-id.js} +3 -3
  97. package/dist/cjs/utils/{get-rect-by-taro.js → taro/get-rect.js} +9 -10
  98. package/dist/cjs/utils/{px-transform.js → taro/px-transform.js} +3 -3
  99. package/dist/cjs/utils/upper-case-first.d.ts +1 -0
  100. package/dist/cjs/utils/upper-case-first.js +17 -0
  101. package/dist/es/hooks/index.d.ts +12 -0
  102. package/dist/es/hooks/index.js +14 -0
  103. package/dist/es/hooks/{use-custom-event.js → taro/use-custom-event.js} +1 -1
  104. package/dist/es/hooks/{use-lock-scoll-taro.js → taro/use-lock-scoll.js} +1 -1
  105. package/dist/es/hooks/use-memo.d.ts +1 -1
  106. package/dist/es/hooks/use-memo.js +1 -1
  107. package/dist/es/hooks/use-refs.d.ts +1 -1
  108. package/dist/es/hooks/use-refs.js +1 -1
  109. package/dist/es/hooks/use-uuid.d.ts +1 -1
  110. package/dist/es/hooks/use-uuid.js +1 -1
  111. package/dist/es/hooks/use-watch.d.ts +2 -2
  112. package/dist/es/hooks/use-watch.js +1 -2
  113. package/dist/es/packages/address/address.d.ts +1 -1
  114. package/dist/es/packages/avatar/avatar.js +2 -2
  115. package/dist/es/packages/avatar/style/style.css +4 -0
  116. package/dist/es/packages/avatarcropper/avatarcropper.js +1 -1
  117. package/dist/es/packages/badge/badge.js +2 -2
  118. package/dist/es/packages/barrage/barrage.js +3 -3
  119. package/dist/es/packages/button/button.js +1 -1
  120. package/dist/es/packages/cascader/cascader.js +2 -1
  121. package/dist/es/packages/cell/cell.js +1 -1
  122. package/dist/es/packages/col/col.js +1 -1
  123. package/dist/es/packages/collapseitem/collapseitem.js +3 -3
  124. package/dist/es/packages/configprovider/configprovider.js +1 -1
  125. package/dist/es/packages/configprovider/types.d.ts +1 -1
  126. package/dist/es/packages/countdown/countdown.js +1 -1
  127. package/dist/es/packages/dialog/dialog.js +3 -3
  128. package/dist/es/packages/dialog/style/dialog.scss +1 -0
  129. package/dist/es/packages/dialog/style/style.css +1 -0
  130. package/dist/es/packages/dialog/style/style.harmony.css +1 -0
  131. package/dist/es/packages/drag/drag.js +4 -4
  132. package/dist/es/packages/elevator/elevator.js +2 -2
  133. package/dist/es/packages/ellipsis/ellipsis.js +4 -4
  134. package/dist/es/packages/griditem/griditem.js +1 -1
  135. package/dist/es/packages/hoverbutton/hoverbutton.js +1 -1
  136. package/dist/es/packages/hoverbuttonitem/hoverbuttonitem.js +1 -1
  137. package/dist/es/packages/image/image.js +11 -11
  138. package/dist/es/packages/image/style/image.scss +4 -1
  139. package/dist/es/packages/image/style/style.css +4 -0
  140. package/dist/es/packages/image/style/style.harmony.css +4 -0
  141. package/dist/es/packages/imagepreview/style/style.css +4 -0
  142. package/dist/es/packages/indicator/indicator.js +1 -1
  143. package/dist/es/packages/infiniteloading/infiniteloading.js +1 -1
  144. package/dist/es/packages/lottie/lottiemp.js +2 -2
  145. package/dist/es/packages/menuitem/menuitem.js +4 -4
  146. package/dist/es/packages/noticebar/noticebar.js +4 -4
  147. package/dist/es/packages/notify/notify.js +3 -3
  148. package/dist/es/packages/nutui.react.build.d.ts +2 -0
  149. package/dist/es/packages/nutui.react.build.js +2 -0
  150. package/dist/es/packages/overlay/overlay.js +1 -1
  151. package/dist/es/packages/pagination/pagination.js +1 -1
  152. package/dist/es/packages/picker/picker.js +1 -1
  153. package/dist/es/packages/pickerview/pickerroller.js +4 -4
  154. package/dist/es/packages/popover/popover.js +6 -6
  155. package/dist/es/packages/popup/popup.js +2 -2
  156. package/dist/es/packages/price/price.js +1 -1
  157. package/dist/es/packages/progress/progress.js +3 -3
  158. package/dist/es/packages/pulltorefresh/pulltorefresh.js +2 -2
  159. package/dist/es/packages/range/range.js +5 -5
  160. package/dist/es/packages/rate/rate.js +3 -3
  161. package/dist/es/packages/sidebar/sidebar.js +12 -4
  162. package/dist/es/packages/skeleton/skeleton.js +1 -2
  163. package/dist/es/packages/sticky/sticky.js +6 -6
  164. package/dist/es/packages/swipe/swipe.js +9 -9
  165. package/dist/es/packages/swiper/swiper.js +1 -1
  166. package/dist/es/packages/switch/switch.js +53 -8
  167. package/dist/es/packages/tabs/tabs.js +1 -1
  168. package/dist/es/packages/toast/toast.js +2 -2
  169. package/dist/es/packages/tour/tour.js +2 -2
  170. package/dist/es/packages/trendarrow/trendarrow.js +1 -1
  171. package/dist/es/packages/virtuallist/virtuallist.js +1 -1
  172. package/dist/es/utils/clamp.d.ts +1 -0
  173. package/dist/es/utils/clamp.js +3 -0
  174. package/dist/es/utils/event-mocker.d.ts +21 -0
  175. package/dist/es/utils/index.d.ts +28 -6
  176. package/dist/es/utils/index.js +34 -29
  177. package/dist/es/utils/interceptor.js +1 -1
  178. package/dist/es/utils/is-function.d.ts +1 -0
  179. package/dist/es/utils/is-function.js +4 -0
  180. package/dist/es/utils/is-object.d.ts +1 -0
  181. package/dist/es/utils/is-object.js +4 -0
  182. package/dist/es/utils/is-promise.d.ts +1 -0
  183. package/dist/es/utils/is-promise.js +5 -0
  184. package/dist/es/utils/lru.d.ts +1 -1
  185. package/dist/es/utils/lru.js +1 -2
  186. package/dist/es/utils/merge.d.ts +0 -1
  187. package/dist/es/utils/merge.js +0 -1
  188. package/dist/es/utils/prevent-default.d.ts +1 -0
  189. package/dist/es/utils/prevent-default.js +8 -0
  190. package/dist/es/utils/raf.d.ts +0 -1
  191. package/dist/es/utils/raf.js +1 -1
  192. package/dist/es/utils/{add-color-for-harmony.js → taro/add-color-for-harmony.js} +2 -3
  193. package/dist/es/{hooks/use-taro-rect.js → utils/taro/get-rect-by-id.js} +1 -1
  194. package/dist/es/utils/{get-rect-by-taro.js → taro/get-rect.js} +4 -4
  195. package/dist/es/utils/{px-transform.js → taro/px-transform.js} +2 -2
  196. package/dist/es/utils/upper-case-first.d.ts +1 -0
  197. package/dist/es/utils/upper-case-first.js +7 -0
  198. package/dist/nutui.react.umd.js +578 -242
  199. package/dist/style.css +1 -1
  200. package/dist/style.scss +45 -45
  201. package/dist/styles/themes/dark.css +1 -1
  202. package/dist/styles/themes/default.css +1 -1
  203. package/dist/styles/themes/jmapp.css +1 -1
  204. package/dist/styles/themes/jrkf.css +1 -1
  205. package/dist/styles/variables-jmapp.scss +1 -0
  206. package/dist/styles/variables.scss +4 -0
  207. package/package.json +1 -1
  208. package/dist/cjs/hooks/use-custom-event.d.ts +0 -7
  209. package/dist/cjs/hooks/use-lock-scoll-taro.d.ts +0 -1
  210. package/dist/cjs/hooks/use-taro-rect.d.ts +0 -1
  211. package/dist/cjs/utils/add-color-for-harmony.d.ts +0 -9
  212. package/dist/cjs/utils/get-rect-by-taro.d.ts +0 -12
  213. package/dist/cjs/utils/get-system-info.d.ts +0 -19
  214. package/dist/cjs/utils/platform-taro.d.ts +0 -3
  215. package/dist/cjs/utils/px-transform.d.ts +0 -1
  216. package/dist/es/hooks/use-custom-event.d.ts +0 -7
  217. package/dist/es/hooks/use-lock-scoll-taro.d.ts +0 -1
  218. package/dist/es/hooks/use-taro-rect.d.ts +0 -1
  219. package/dist/es/utils/add-color-for-harmony.d.ts +0 -9
  220. package/dist/es/utils/get-rect-by-taro.d.ts +0 -12
  221. package/dist/es/utils/get-system-info.d.ts +0 -19
  222. package/dist/es/utils/platform-taro.d.ts +0 -3
  223. package/dist/es/utils/px-transform.d.ts +0 -1
  224. /package/dist/cjs/utils/{test/event.js → event-mocker.js} +0 -0
  225. /package/dist/cjs/{hooks/use-client-rect.d.ts → utils/get-rect.d.ts} +0 -0
  226. /package/dist/cjs/{hooks/use-client-rect.js → utils/get-rect.js} +0 -0
  227. /package/dist/cjs/utils/{get-system-info.js → taro/get-system-info.js} +0 -0
  228. /package/dist/cjs/utils/{platform-taro.js → taro/platform.js} +0 -0
  229. /package/dist/es/utils/{test/event.js → event-mocker.js} +0 -0
  230. /package/dist/es/{hooks/use-client-rect.d.ts → utils/get-rect.d.ts} +0 -0
  231. /package/dist/es/{hooks/use-client-rect.js → utils/get-rect.js} +0 -0
  232. /package/dist/es/utils/{get-system-info.js → taro/get-system-info.js} +0 -0
  233. /package/dist/es/utils/{platform-taro.js → taro/platform.js} +0 -0
@@ -1,8 +1,10 @@
1
+ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
1
2
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
2
3
  import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
4
  import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
4
5
  import { _ as _object_without_properties } from "@swc/helpers/_/_object_without_properties";
5
6
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
7
+ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
6
8
  import React, { useEffect, useState } from "react";
7
9
  import { View } from "@tarojs/components";
8
10
  import classNames from "classnames";
@@ -48,14 +50,57 @@ export var Switch = function(props) {
48
50
  (_obj = {}, _define_property(_obj, "".concat(classPrefix, "-close"), !value), _define_property(_obj, "".concat(classPrefix, "-disabled"), disabled), _define_property(_obj, "".concat(classPrefix, "-disabled-close"), disabled && !value), _obj)
49
51
  ]);
50
52
  };
51
- var onClick = function() {
52
- if (disabled || changing) return;
53
- if (onChange) {
54
- setChanging(true);
55
- onChange(!value);
56
- }
57
- setValue(!value);
58
- };
53
+ var onClick = /*#__PURE__*/ function() {
54
+ var _ref = _async_to_generator(function() {
55
+ var e;
56
+ return _ts_generator(this, function(_state) {
57
+ switch(_state.label){
58
+ case 0:
59
+ if (disabled || changing) return [
60
+ 2
61
+ ];
62
+ if (!onChange) return [
63
+ 3,
64
+ 4
65
+ ];
66
+ setChanging(true);
67
+ _state.label = 1;
68
+ case 1:
69
+ _state.trys.push([
70
+ 1,
71
+ 3,
72
+ ,
73
+ 4
74
+ ]);
75
+ return [
76
+ 4,
77
+ onChange(!value)
78
+ ];
79
+ case 2:
80
+ _state.sent();
81
+ return [
82
+ 3,
83
+ 4
84
+ ];
85
+ case 3:
86
+ e = _state.sent();
87
+ setChanging(false);
88
+ return [
89
+ 3,
90
+ 4
91
+ ];
92
+ case 4:
93
+ setValue(!value);
94
+ return [
95
+ 2
96
+ ];
97
+ }
98
+ });
99
+ });
100
+ return function onClick() {
101
+ return _ref.apply(this, arguments);
102
+ };
103
+ }();
59
104
  var _obj, _obj1;
60
105
  return /*#__PURE__*/ React.createElement(View, _object_spread({
61
106
  className: classes(),
@@ -13,7 +13,7 @@ import TabPane from "../tabpane/index";
13
13
  import { usePropsValue } from "../../hooks/use-props-value";
14
14
  import { useForceUpdate } from "../../hooks/use-force-update";
15
15
  import raf from "../../utils/raf";
16
- import useUuid from "../../hooks/use-uuid";
16
+ import { useUuid } from "../../hooks/use-uuid";
17
17
  import { useRtl } from "../configprovider/configprovider";
18
18
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
19
19
  tabStyle: {},
@@ -8,10 +8,10 @@ import { Text, View } from "@tarojs/components";
8
8
  import { Failure, Loading, Success, Tips } from "@nutui/icons-react-taro";
9
9
  import Overlay from "../overlay/index";
10
10
  import { defaultOverlayProps } from "../overlay/overlay";
11
- import { customEvents, useCustomEvent, useCustomEventsPath, useParams } from "../../hooks/use-custom-event";
11
+ import { customEvents, useCustomEvent, useCustomEventsPath, useParams } from "../../hooks/taro/use-custom-event";
12
12
  import { usePropsValue } from "../../hooks/use-props-value";
13
13
  import { useRtl } from "../configprovider/index";
14
- import { harmony } from "../../utils/platform-taro";
14
+ import { harmony } from "../../utils/taro/platform";
15
15
  import { mergeProps } from "../../utils/merge-props";
16
16
  var defaultProps = _object_spread_props(_object_spread({}, defaultOverlayProps), {
17
17
  id: '',
@@ -6,7 +6,7 @@ import { Close } from "@nutui/icons-react-taro";
6
6
  import classNames from "classnames";
7
7
  import { View } from "@tarojs/components";
8
8
  import Popover from "../popover/index";
9
- import { getTaroRectById } from "../../hooks/use-taro-rect";
9
+ import { getRectById } from "../../utils/taro/get-rect-by-id";
10
10
  import { ComponentDefaults } from "../../utils/typings";
11
11
  import { useConfig } from "../configprovider/index";
12
12
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
@@ -62,7 +62,7 @@ export var Tour = function(props) {
62
62
  active
63
63
  ]);
64
64
  var getRootPosition = function() {
65
- getTaroRectById(list[active].target).then(function(rect) {
65
+ getRectById(list[active].target).then(function(rect) {
66
66
  setMaskRect({
67
67
  top: rect.top,
68
68
  left: rect.left,
@@ -5,7 +5,7 @@ import React, { useRef } from "react";
5
5
  import { TriangleDown, TriangleUp } from "@nutui/icons-react-taro";
6
6
  import { Text, View } from "@tarojs/components";
7
7
  import { ComponentDefaults } from "../../utils/typings";
8
- import { harmony } from "../../utils/platform-taro";
8
+ import { harmony } from "../../utils/taro/platform";
9
9
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
10
10
  value: 0,
11
11
  digits: 2,
@@ -5,7 +5,7 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
5
5
  import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";
6
6
  import { ScrollView, View } from "@tarojs/components";
7
7
  import classNames from "classnames";
8
- import { getWindowInfo } from "../../utils/get-system-info";
8
+ import { getWindowInfo } from "../../utils/taro/get-system-info";
9
9
  import { initPositinoCache, updateItemSize } from "./utils";
10
10
  import { ComponentDefaults } from "../../utils/typings";
11
11
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
@@ -0,0 +1 @@
1
+ export declare const clamp: (num: number, min: number, max: number) => number;
@@ -0,0 +1,3 @@
1
+ export var clamp = function(num, min, max) {
2
+ return Math.min(Math.max(num, min), max);
3
+ };
@@ -0,0 +1,21 @@
1
+ export declare function trigger(wrapper: any, eventName: string, x?: number, y?: number, options?: any): void;
2
+ export declare function sleep(delay?: number): Promise<void>;
3
+ export declare function triggerDrag(el: any, relativeX?: number, relativeY?: number): void;
4
+ /**
5
+ * 模拟触摸移动方法
6
+ * @param {HTMLElement} element 要进行触摸移动的 HTML 元素
7
+ * @param {number} startX 起始触摸点的 X 坐标
8
+ * @param {number} startY 起始触摸点的 Y 坐标
9
+ * @param {number} endX 结束触摸点的 X 坐标
10
+ * @param {number} endY 结束触摸点的 Y 坐标
11
+ * @param {number} duration 移动持续时间(毫秒)
12
+ */
13
+ export declare function simulateTouchMove(element: HTMLElement, startX: number, startY: number, endX: number, endY: number, duration: number): Promise<void>;
14
+ /**
15
+ * 模拟触摸缩放方法
16
+ * @param {HTMLElement} element 要进行缩放操作的 HTML 元素
17
+ * @param {number} startDistance 起始触摸点的距离
18
+ * @param {number} endDistance 结束触摸点的距离
19
+ * @param {number} duration 缩放持续时间(毫秒)
20
+ */
21
+ export declare function simulateTouchZoom(element: HTMLElement, startDistance: number, endDistance: number, duration: number): Promise<void>;
@@ -1,6 +1,28 @@
1
- export declare const isObject: (val: unknown) => val is Record<any, any>;
2
- export declare const isFunction: (val: unknown) => val is Function;
3
- export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
4
- export declare const upperCaseFirst: (str: string) => string;
5
- export declare const clamp: (num: number, min: number, max: number) => number;
6
- export declare function preventDefault(event: React.TouchEvent<HTMLElement> | TouchEvent, isStopPropagation?: boolean): void;
1
+ export * from './bound';
2
+ export * from './camel-case';
3
+ export * from './can-use-dom';
4
+ export * from './clamp';
5
+ export * from './date';
6
+ export * from './get-rect';
7
+ export * from './get-scroll-parent';
8
+ export * from './interceptor';
9
+ export * from './is-date';
10
+ export * from './is-empty';
11
+ export * from './is-forward-ref-component';
12
+ export * from './is-function';
13
+ export * from './is-object';
14
+ export * from './is-promise';
15
+ export * from './lru';
16
+ export * from './merge';
17
+ export * from './merge-props';
18
+ export * from './pad-zero';
19
+ export * from './prevent-default';
20
+ export * from './px-check';
21
+ export * from './raf';
22
+ export * from './render';
23
+ export * from './rubberband';
24
+ export * from './sleep';
25
+ export * from './supports-passive';
26
+ export * from './to-array';
27
+ export * from './typings';
28
+ export * from './upper-case-first';
@@ -1,29 +1,34 @@
1
- import { _ as _type_of } from "@swc/helpers/_/_type_of";
2
- export var isObject = function(val) {
3
- return val !== null && (typeof val === "undefined" ? "undefined" : _type_of(val)) === 'object';
4
- };
5
- // eslint-disable-next-line @typescript-eslint/ban-types
6
- export var isFunction = function(val) {
7
- return typeof val === 'function';
8
- };
9
- export var isPromise = function(val) {
10
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
11
- };
12
- export var upperCaseFirst = function(str) {
13
- str = str.toLowerCase();
14
- str = str.replace(/\b\w+\b/g, function(word) {
15
- return word.substring(0, 1).toUpperCase() + word.substring(1);
16
- });
17
- return str;
18
- };
19
- export var clamp = function(num, min, max) {
20
- return Math.min(Math.max(num, min), max);
21
- };
22
- export function preventDefault(event, isStopPropagation) {
23
- if (typeof event.cancelable !== 'boolean' || event.cancelable) {
24
- event.preventDefault();
25
- }
26
- if (isStopPropagation) {
27
- event.stopPropagation();
28
- }
29
- }
1
+ export * from "./taro/add-color-for-harmony";
2
+ export * from "./bound";
3
+ export * from "./camel-case";
4
+ export * from "./can-use-dom";
5
+ export * from "./clamp";
6
+ export * from "./date";
7
+ export * from "./taro/get-rect";
8
+ export * from "./taro/get-rect-by-id";
9
+ export * from "./get-rect";
10
+ export * from "./get-scroll-parent";
11
+ export * from "./taro/get-system-info";
12
+ export * from "./interceptor";
13
+ export * from "./is-date";
14
+ export * from "./is-empty";
15
+ export * from "./is-forward-ref-component";
16
+ export * from "./is-function";
17
+ export * from "./is-object";
18
+ export * from "./is-promise";
19
+ export * from "./lru";
20
+ export * from "./merge";
21
+ export * from "./merge-props";
22
+ export * from "./pad-zero";
23
+ export * from "./taro/platform";
24
+ export * from "./prevent-default";
25
+ export * from "./px-check";
26
+ export * from "./taro/px-transform";
27
+ export * from "./raf";
28
+ export * from "./render";
29
+ export * from "./rubberband";
30
+ export * from "./sleep";
31
+ export * from "./supports-passive";
32
+ export * from "./to-array";
33
+ export * from "./typings";
34
+ export * from "./upper-case-first";
@@ -1,4 +1,4 @@
1
- import { isPromise } from "./index";
1
+ import { isPromise } from "./is-promise";
2
2
  export var funcInterceptor = function(interceptor, param) {
3
3
  var _param_args = param.args, args = _param_args === void 0 ? [] : _param_args, done = param.done, canceled = param.canceled;
4
4
  if (interceptor) {
@@ -0,0 +1 @@
1
+ export declare const isFunction: (val: unknown) => val is Function;
@@ -0,0 +1,4 @@
1
+ // eslint-disable-next-line @typescript-eslint/ban-types
2
+ export var isFunction = function(val) {
3
+ return typeof val === 'function';
4
+ };
@@ -0,0 +1 @@
1
+ export declare const isObject: (val: unknown) => val is Record<any, any>;
@@ -0,0 +1,4 @@
1
+ import { _ as _type_of } from "@swc/helpers/_/_type_of";
2
+ export var isObject = function(val) {
3
+ return val !== null && (typeof val === "undefined" ? "undefined" : _type_of(val)) === 'object';
4
+ };
@@ -0,0 +1 @@
1
+ export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
@@ -0,0 +1,5 @@
1
+ import { isObject } from "./is-object";
2
+ import { isFunction } from "./is-function";
3
+ export var isPromise = function(val) {
4
+ return isObject(val) && isFunction(val.then) && isFunction(val.catch);
5
+ };
@@ -1,4 +1,4 @@
1
- export default class MiniLru {
1
+ export declare class MiniLru {
2
2
  private cache;
3
3
  private capacity;
4
4
  constructor(capacity: number);
@@ -1,7 +1,7 @@
1
1
  import { _ as _class_call_check } from "@swc/helpers/_/_class_call_check";
2
2
  import { _ as _create_class } from "@swc/helpers/_/_create_class";
3
3
  import { _ as _define_property } from "@swc/helpers/_/_define_property";
4
- var MiniLru = /*#__PURE__*/ function() {
4
+ export var MiniLru = /*#__PURE__*/ function() {
5
5
  "use strict";
6
6
  function MiniLru(capacity) {
7
7
  _class_call_check(this, MiniLru);
@@ -46,4 +46,3 @@ var MiniLru = /*#__PURE__*/ function() {
46
46
  ]);
47
47
  return MiniLru;
48
48
  }();
49
- export { MiniLru as default };
@@ -1,4 +1,3 @@
1
- export default main;
2
1
  export declare function main(clone: boolean, ...items: any[]): any;
3
2
  export declare function main(...items: any[]): any;
4
3
  export declare namespace main {
@@ -1,6 +1,5 @@
1
1
  import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
2
2
  import { _ as _type_of } from "@swc/helpers/_/_type_of";
3
- export default main;
4
3
  export function main() {
5
4
  for(var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++){
6
5
  items[_key] = arguments[_key];
@@ -0,0 +1 @@
1
+ export declare function preventDefault(event: React.TouchEvent<HTMLElement> | TouchEvent, isStopPropagation?: boolean): void;
@@ -0,0 +1,8 @@
1
+ export function preventDefault(event, isStopPropagation) {
2
+ if (typeof event.cancelable !== 'boolean' || event.cancelable) {
3
+ event.preventDefault();
4
+ }
5
+ if (isStopPropagation) {
6
+ event.stopPropagation();
7
+ }
8
+ }
@@ -1,4 +1,3 @@
1
- export declare const inBrowser: boolean;
2
1
  export declare function cancelRaf(id: number): void;
3
2
  declare const _default: any;
4
3
  export default _default;
@@ -1,4 +1,4 @@
1
- export var inBrowser = typeof window !== 'undefined';
1
+ import { inBrowser } from "./get-rect";
2
2
  // 防频
3
3
  function requestAniFrame() {
4
4
  if (inBrowser) {
@@ -1,11 +1,11 @@
1
1
  import React from "react";
2
- import { harmony } from "./platform-taro";
2
+ import { harmony } from "./platform";
3
3
  /**
4
4
  * 为支持 Harmony 的 React 元素添加颜色属性
5
5
  * @param maybeElement - 要处理的 React 节点
6
6
  * @param color - 要添加的颜色值(如:'#ff0000')
7
7
  * @returns 处理后的 React 节点
8
- */ function addColorForHarmony(maybeElement, color) {
8
+ */ export function addColorForHarmony(maybeElement, color) {
9
9
  if (React.isValidElement(maybeElement) && harmony()) {
10
10
  return React.cloneElement(maybeElement, {
11
11
  color: color
@@ -13,4 +13,3 @@ import { harmony } from "./platform-taro";
13
13
  }
14
14
  return maybeElement;
15
15
  }
16
- export default addColorForHarmony;
@@ -1,5 +1,5 @@
1
1
  import Taro, { createSelectorQuery } from "@tarojs/taro";
2
- export var getTaroRectById = function(id) {
2
+ export var getRectById = function(id) {
3
3
  return new Promise(function(resolve, reject) {
4
4
  if (Taro.getEnv() === Taro.ENV_TYPE.WEB) {
5
5
  var t = document ? document.querySelector("#".concat(id)) : '';
@@ -2,8 +2,8 @@ import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
2
  import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
3
3
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
4
4
  import { createSelectorQuery } from "@tarojs/taro";
5
- import MiniLru from "./lru";
6
- import { getRect, inBrowser } from "../hooks/use-client-rect";
5
+ import { MiniLru } from "../lru";
6
+ import { getRect, inBrowser } from "../get-rect";
7
7
  var lru = new MiniLru(10);
8
8
  export function makeRect(width, height) {
9
9
  return {
@@ -15,7 +15,7 @@ export function makeRect(width, height) {
15
15
  height: height
16
16
  };
17
17
  }
18
- export var getRectByTaro = /*#__PURE__*/ function() {
18
+ export var getRectInMultiPlatform = /*#__PURE__*/ function() {
19
19
  var _ref = _async_to_generator(function(element) {
20
20
  var harmonyId;
21
21
  var _arguments = arguments;
@@ -52,7 +52,7 @@ export var getRectByTaro = /*#__PURE__*/ function() {
52
52
  ];
53
53
  });
54
54
  });
55
- return function getRectByTaro(element) {
55
+ return function getRectInMultiPlatform(element) {
56
56
  return _ref.apply(this, arguments);
57
57
  };
58
58
  }();
@@ -1,6 +1,6 @@
1
1
  import { pxTransform as transform } from "@tarojs/taro";
2
- import { harmony } from "./platform-taro";
3
- export default function pxTransform(value, radix) {
2
+ import { harmony } from "./platform";
3
+ export function pxTransform(value, radix) {
4
4
  // @ts-ignore
5
5
  if (harmony()) return transform(value, radix || 375);
6
6
  return "".concat(value, "px");
@@ -0,0 +1 @@
1
+ export declare const upperCaseFirst: (str: string) => string;
@@ -0,0 +1,7 @@
1
+ export var upperCaseFirst = function(str) {
2
+ str = str.toLowerCase();
3
+ str = str.replace(/\b\w+\b/g, function(word) {
4
+ return word.substring(0, 1).toUpperCase() + word.substring(1);
5
+ });
6
+ return str;
7
+ };