@nutui/nutui-react-taro 3.0.8 → 3.0.9-beta.1

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 (207) hide show
  1. package/CHANGELOG.md +13 -14
  2. package/dist/cjs/hooks/index.d.ts +14 -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/avatarcropper/avatarcropper.js +1 -1
  17. package/dist/cjs/packages/badge/badge.js +5 -5
  18. package/dist/cjs/packages/barrage/barrage.js +3 -3
  19. package/dist/cjs/packages/button/button.js +3 -3
  20. package/dist/cjs/packages/cell/cell.js +2 -2
  21. package/dist/cjs/packages/col/col.js +3 -3
  22. package/dist/cjs/packages/collapseitem/collapseitem.js +4 -4
  23. package/dist/cjs/packages/configprovider/configprovider.js +2 -2
  24. package/dist/cjs/packages/countdown/countdown.js +2 -2
  25. package/dist/cjs/packages/dialog/dialog.js +5 -5
  26. package/dist/cjs/packages/drag/drag.js +5 -5
  27. package/dist/cjs/packages/elevator/elevator.js +4 -4
  28. package/dist/cjs/packages/ellipsis/ellipsis.js +4 -4
  29. package/dist/cjs/packages/griditem/griditem.js +4 -4
  30. package/dist/cjs/packages/hoverbutton/hoverbutton.js +2 -2
  31. package/dist/cjs/packages/hoverbuttonitem/hoverbuttonitem.js +2 -2
  32. package/dist/cjs/packages/image/image.js +2 -2
  33. package/dist/cjs/packages/indicator/indicator.js +2 -2
  34. package/dist/cjs/packages/infiniteloading/infiniteloading.js +2 -2
  35. package/dist/cjs/packages/lottie/lottiemp.js +3 -3
  36. package/dist/cjs/packages/menuitem/menuitem.js +4 -4
  37. package/dist/cjs/packages/noticebar/noticebar.js +4 -4
  38. package/dist/cjs/packages/notify/notify.js +5 -5
  39. package/dist/cjs/packages/nutui.react.build.d.ts +2 -0
  40. package/dist/cjs/packages/nutui.react.build.js +2 -0
  41. package/dist/cjs/packages/nutui.react.d.ts +2 -0
  42. package/dist/cjs/packages/nutui.react.js +2 -0
  43. package/dist/cjs/packages/overlay/overlay.js +2 -2
  44. package/dist/cjs/packages/pagination/pagination.js +3 -3
  45. package/dist/cjs/packages/picker/picker.js +2 -2
  46. package/dist/cjs/packages/pickerview/pickerroller.js +7 -7
  47. package/dist/cjs/packages/popover/popover.js +15 -15
  48. package/dist/cjs/packages/popup/popup.js +4 -4
  49. package/dist/cjs/packages/price/price.js +2 -2
  50. package/dist/cjs/packages/progress/progress.js +13 -13
  51. package/dist/cjs/packages/pulltorefresh/pulltorefresh.js +4 -4
  52. package/dist/cjs/packages/range/range.js +13 -13
  53. package/dist/cjs/packages/rate/rate.js +4 -4
  54. package/dist/cjs/packages/sidebar/sidebar.js +2 -2
  55. package/dist/cjs/packages/sticky/sticky.js +7 -7
  56. package/dist/cjs/packages/swipe/swipe.js +10 -10
  57. package/dist/cjs/packages/swiper/swiper.js +4 -4
  58. package/dist/cjs/packages/tabs/tabs.js +2 -2
  59. package/dist/cjs/packages/toast/toast.js +3 -3
  60. package/dist/cjs/packages/tour/tour.js +2 -2
  61. package/dist/cjs/packages/trendarrow/trendarrow.js +3 -3
  62. package/dist/cjs/packages/virtuallist/virtuallist.js +1 -1
  63. package/dist/cjs/utils/clamp.d.ts +1 -0
  64. package/dist/cjs/utils/clamp.js +13 -0
  65. package/dist/cjs/utils/event-mocker.d.ts +21 -0
  66. package/dist/cjs/utils/index.d.ts +34 -6
  67. package/dist/cjs/utils/index.js +35 -54
  68. package/dist/cjs/utils/interceptor.js +2 -2
  69. package/dist/cjs/utils/is-function.d.ts +1 -0
  70. package/dist/cjs/utils/is-function.js +14 -0
  71. package/dist/cjs/utils/is-object.d.ts +1 -0
  72. package/dist/cjs/utils/is-object.js +14 -0
  73. package/dist/cjs/utils/is-promise.d.ts +1 -0
  74. package/dist/cjs/utils/is-promise.js +15 -0
  75. package/dist/cjs/utils/lru.d.ts +1 -1
  76. package/dist/cjs/utils/lru.js +1 -1
  77. package/dist/cjs/utils/merge.d.ts +0 -1
  78. package/dist/cjs/utils/merge.js +0 -4
  79. package/dist/cjs/utils/prevent-default.d.ts +1 -0
  80. package/dist/cjs/utils/prevent-default.js +18 -0
  81. package/dist/cjs/utils/raf.d.ts +0 -1
  82. package/dist/cjs/utils/raf.js +3 -6
  83. package/dist/{es/utils → cjs/utils/taro}/add-color-for-harmony.d.ts +1 -2
  84. package/dist/cjs/utils/{add-color-for-harmony.js → taro/add-color-for-harmony.js} +5 -11
  85. package/dist/cjs/utils/taro/get-rect-by-id.d.ts +1 -0
  86. package/dist/cjs/{hooks/use-taro-rect.js → utils/taro/get-rect-by-id.js} +3 -3
  87. package/dist/cjs/utils/{get-rect-by-taro.d.ts → taro/get-rect.d.ts} +1 -1
  88. package/dist/cjs/utils/{get-rect-by-taro.js → taro/get-rect.js} +9 -10
  89. package/dist/cjs/utils/taro/px-transform.d.ts +1 -0
  90. package/dist/cjs/utils/{px-transform.js → taro/px-transform.js} +3 -3
  91. package/dist/cjs/utils/upper-case-first.d.ts +1 -0
  92. package/dist/cjs/utils/upper-case-first.js +17 -0
  93. package/dist/es/hooks/index.d.ts +14 -0
  94. package/dist/es/hooks/index.js +14 -0
  95. package/dist/es/hooks/{use-custom-event.js → taro/use-custom-event.js} +1 -1
  96. package/dist/es/hooks/{use-lock-scoll-taro.js → taro/use-lock-scoll.js} +1 -1
  97. package/dist/es/hooks/use-memo.d.ts +1 -1
  98. package/dist/es/hooks/use-memo.js +1 -1
  99. package/dist/es/hooks/use-refs.d.ts +1 -1
  100. package/dist/es/hooks/use-refs.js +1 -1
  101. package/dist/es/hooks/use-uuid.d.ts +1 -1
  102. package/dist/es/hooks/use-uuid.js +1 -1
  103. package/dist/es/hooks/use-watch.d.ts +2 -2
  104. package/dist/es/hooks/use-watch.js +1 -2
  105. package/dist/es/packages/address/address.d.ts +1 -1
  106. package/dist/es/packages/avatar/avatar.js +2 -2
  107. package/dist/es/packages/avatarcropper/avatarcropper.js +1 -1
  108. package/dist/es/packages/badge/badge.js +2 -2
  109. package/dist/es/packages/barrage/barrage.js +3 -3
  110. package/dist/es/packages/button/button.js +1 -1
  111. package/dist/es/packages/cell/cell.js +1 -1
  112. package/dist/es/packages/col/col.js +1 -1
  113. package/dist/es/packages/collapseitem/collapseitem.js +3 -3
  114. package/dist/es/packages/configprovider/configprovider.js +1 -1
  115. package/dist/es/packages/countdown/countdown.js +1 -1
  116. package/dist/es/packages/dialog/dialog.js +3 -3
  117. package/dist/es/packages/drag/drag.js +4 -4
  118. package/dist/es/packages/elevator/elevator.js +2 -2
  119. package/dist/es/packages/ellipsis/ellipsis.js +4 -4
  120. package/dist/es/packages/griditem/griditem.js +1 -1
  121. package/dist/es/packages/hoverbutton/hoverbutton.js +1 -1
  122. package/dist/es/packages/hoverbuttonitem/hoverbuttonitem.js +1 -1
  123. package/dist/es/packages/image/image.js +1 -1
  124. package/dist/es/packages/indicator/indicator.js +1 -1
  125. package/dist/es/packages/infiniteloading/infiniteloading.js +1 -1
  126. package/dist/es/packages/lottie/lottiemp.js +2 -2
  127. package/dist/es/packages/menuitem/menuitem.js +4 -4
  128. package/dist/es/packages/noticebar/noticebar.js +4 -4
  129. package/dist/es/packages/notify/notify.js +3 -3
  130. package/dist/es/packages/nutui.react.build.d.ts +2 -0
  131. package/dist/es/packages/nutui.react.build.js +2 -0
  132. package/dist/es/packages/overlay/overlay.js +1 -1
  133. package/dist/es/packages/pagination/pagination.js +1 -1
  134. package/dist/es/packages/picker/picker.js +1 -1
  135. package/dist/es/packages/pickerview/pickerroller.js +4 -4
  136. package/dist/es/packages/popover/popover.js +6 -6
  137. package/dist/es/packages/popup/popup.js +2 -2
  138. package/dist/es/packages/price/price.js +1 -1
  139. package/dist/es/packages/progress/progress.js +3 -3
  140. package/dist/es/packages/pulltorefresh/pulltorefresh.js +2 -2
  141. package/dist/es/packages/range/range.js +5 -5
  142. package/dist/es/packages/rate/rate.js +3 -3
  143. package/dist/es/packages/sidebar/sidebar.js +1 -1
  144. package/dist/es/packages/sticky/sticky.js +6 -6
  145. package/dist/es/packages/swipe/swipe.js +7 -7
  146. package/dist/es/packages/swiper/swiper.js +1 -1
  147. package/dist/es/packages/tabs/tabs.js +1 -1
  148. package/dist/es/packages/toast/toast.js +2 -2
  149. package/dist/es/packages/tour/tour.js +2 -2
  150. package/dist/es/packages/trendarrow/trendarrow.js +1 -1
  151. package/dist/es/packages/virtuallist/virtuallist.js +1 -1
  152. package/dist/es/utils/clamp.d.ts +1 -0
  153. package/dist/es/utils/clamp.js +3 -0
  154. package/dist/es/utils/event-mocker.d.ts +21 -0
  155. package/dist/es/utils/index.d.ts +34 -6
  156. package/dist/es/utils/index.js +34 -29
  157. package/dist/es/utils/interceptor.js +1 -1
  158. package/dist/es/utils/is-function.d.ts +1 -0
  159. package/dist/es/utils/is-function.js +4 -0
  160. package/dist/es/utils/is-object.d.ts +1 -0
  161. package/dist/es/utils/is-object.js +4 -0
  162. package/dist/es/utils/is-promise.d.ts +1 -0
  163. package/dist/es/utils/is-promise.js +5 -0
  164. package/dist/es/utils/lru.d.ts +1 -1
  165. package/dist/es/utils/lru.js +1 -2
  166. package/dist/es/utils/merge.d.ts +0 -1
  167. package/dist/es/utils/merge.js +0 -1
  168. package/dist/es/utils/prevent-default.d.ts +1 -0
  169. package/dist/es/utils/prevent-default.js +8 -0
  170. package/dist/es/utils/raf.d.ts +0 -1
  171. package/dist/es/utils/raf.js +1 -1
  172. package/dist/{cjs/utils → es/utils/taro}/add-color-for-harmony.d.ts +1 -2
  173. package/dist/es/utils/{add-color-for-harmony.js → taro/add-color-for-harmony.js} +2 -3
  174. package/dist/es/utils/taro/get-rect-by-id.d.ts +1 -0
  175. package/dist/es/{hooks/use-taro-rect.js → utils/taro/get-rect-by-id.js} +1 -1
  176. package/dist/es/utils/{get-rect-by-taro.d.ts → taro/get-rect.d.ts} +1 -1
  177. package/dist/es/utils/{get-rect-by-taro.js → taro/get-rect.js} +4 -4
  178. package/dist/es/utils/taro/px-transform.d.ts +1 -0
  179. package/dist/es/utils/{px-transform.js → taro/px-transform.js} +2 -2
  180. package/dist/es/utils/upper-case-first.d.ts +1 -0
  181. package/dist/es/utils/upper-case-first.js +7 -0
  182. package/dist/nutui.react.umd.js +506 -217
  183. package/dist/style.css +1 -1
  184. package/dist/style.scss +48 -48
  185. package/package.json +1 -1
  186. package/dist/cjs/hooks/use-taro-rect.d.ts +0 -1
  187. package/dist/cjs/utils/px-transform.d.ts +0 -1
  188. package/dist/es/hooks/use-taro-rect.d.ts +0 -1
  189. package/dist/es/utils/px-transform.d.ts +0 -1
  190. /package/dist/cjs/hooks/{use-custom-event.d.ts → taro/use-custom-event.d.ts} +0 -0
  191. /package/dist/cjs/hooks/{use-lock-scoll-taro.d.ts → taro/use-lock-scoll.d.ts} +0 -0
  192. /package/dist/cjs/utils/{test/event.js → event-mocker.js} +0 -0
  193. /package/dist/cjs/{hooks/use-client-rect.d.ts → utils/get-rect.d.ts} +0 -0
  194. /package/dist/cjs/{hooks/use-client-rect.js → utils/get-rect.js} +0 -0
  195. /package/dist/cjs/utils/{get-system-info.d.ts → taro/get-system-info.d.ts} +0 -0
  196. /package/dist/cjs/utils/{get-system-info.js → taro/get-system-info.js} +0 -0
  197. /package/dist/cjs/utils/{platform-taro.d.ts → taro/platform.d.ts} +0 -0
  198. /package/dist/cjs/utils/{platform-taro.js → taro/platform.js} +0 -0
  199. /package/dist/es/hooks/{use-custom-event.d.ts → taro/use-custom-event.d.ts} +0 -0
  200. /package/dist/es/hooks/{use-lock-scoll-taro.d.ts → taro/use-lock-scoll.d.ts} +0 -0
  201. /package/dist/es/utils/{test/event.js → event-mocker.js} +0 -0
  202. /package/dist/es/{hooks/use-client-rect.d.ts → utils/get-rect.d.ts} +0 -0
  203. /package/dist/es/{hooks/use-client-rect.js → utils/get-rect.js} +0 -0
  204. /package/dist/es/utils/{get-system-info.d.ts → taro/get-system-info.d.ts} +0 -0
  205. /package/dist/es/utils/{get-system-info.js → taro/get-system-info.js} +0 -0
  206. /package/dist/es/utils/{platform-taro.d.ts → taro/platform.d.ts} +0 -0
  207. /package/dist/es/utils/{platform-taro.js → taro/platform.js} +0 -0
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "isPromise", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return isPromise;
9
+ }
10
+ });
11
+ var _isobject = require("./is-object");
12
+ var _isfunction = require("./is-function");
13
+ var isPromise = function isPromise(val) {
14
+ return (0, _isobject.isObject)(val) && (0, _isfunction.isFunction)(val.then) && (0, _isfunction.isFunction)(val.catch);
15
+ };
@@ -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);
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "default", {
5
+ Object.defineProperty(exports, "MiniLru", {
6
6
  enumerable: true,
7
7
  get: function() {
8
8
  return MiniLru;
@@ -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 {
@@ -12,9 +12,6 @@ _export(exports, {
12
12
  clone: function() {
13
13
  return clone;
14
14
  },
15
- default: function() {
16
- return _default;
17
- },
18
15
  isPlainObject: function() {
19
16
  return isPlainObject;
20
17
  },
@@ -30,7 +27,6 @@ _export(exports, {
30
27
  });
31
28
  var _to_consumable_array = require("@swc/helpers/_/_to_consumable_array");
32
29
  var _type_of = require("@swc/helpers/_/_type_of");
33
- var _default = main;
34
30
  function main() {
35
31
  for(var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++){
36
32
  items[_key] = arguments[_key];
@@ -0,0 +1 @@
1
+ export declare function preventDefault(event: React.TouchEvent<HTMLElement> | TouchEvent, isStopPropagation?: boolean): void;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "preventDefault", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return preventDefault;
9
+ }
10
+ });
11
+ function preventDefault(event, isStopPropagation) {
12
+ if (typeof event.cancelable !== 'boolean' || event.cancelable) {
13
+ event.preventDefault();
14
+ }
15
+ if (isStopPropagation) {
16
+ event.stopPropagation();
17
+ }
18
+ }
@@ -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;
@@ -14,15 +14,12 @@ _export(exports, {
14
14
  },
15
15
  default: function() {
16
16
  return _default;
17
- },
18
- inBrowser: function() {
19
- return inBrowser;
20
17
  }
21
18
  });
22
- var inBrowser = typeof window !== 'undefined';
19
+ var _getrect = require("./get-rect");
23
20
  // 防频
24
21
  function requestAniFrame() {
25
- if (inBrowser) {
22
+ if (_getrect.inBrowser) {
26
23
  var _window = window;
27
24
  return _window.requestAnimationFrame || _window.webkitRequestAnimationFrame || function(callback) {
28
25
  _window.setTimeout(callback, 1000 / 60);
@@ -33,7 +30,7 @@ function requestAniFrame() {
33
30
  };
34
31
  }
35
32
  function cancelRaf(id) {
36
- if (inBrowser) {
33
+ if (_getrect.inBrowser) {
37
34
  var _window = window;
38
35
  (_window.cancelAnimationFrame || _window.webkitCancelAnimationFrame)(id);
39
36
  } else {
@@ -5,5 +5,4 @@ import React, { ReactNode } from 'react';
5
5
  * @param color - 要添加的颜色值(如:'#ff0000')
6
6
  * @returns 处理后的 React 节点
7
7
  */
8
- declare function addColorForHarmony(maybeElement: ReactNode, color?: string): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined;
9
- export default addColorForHarmony;
8
+ export declare function addColorForHarmony(maybeElement: ReactNode, color?: string): string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined;
@@ -2,26 +2,20 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "default", {
5
+ Object.defineProperty(exports, "addColorForHarmony", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return _default;
8
+ return addColorForHarmony;
9
9
  }
10
10
  });
11
11
  var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
12
  var _react = /*#__PURE__*/ _interop_require_default._(require("react"));
13
- var _platformtaro = require("./platform-taro");
14
- /**
15
- * 为支持 Harmony React 元素添加颜色属性
16
- * @param maybeElement - 要处理的 React 节点
17
- * @param color - 要添加的颜色值(如:'#ff0000')
18
- * @returns 处理后的 React 节点
19
- */ function addColorForHarmony(maybeElement, color) {
20
- if (/*#__PURE__*/ _react.default.isValidElement(maybeElement) && (0, _platformtaro.harmony)()) {
13
+ var _platform = require("./platform");
14
+ function addColorForHarmony(maybeElement, color) {
15
+ if (/*#__PURE__*/ _react.default.isValidElement(maybeElement) && (0, _platform.harmony)()) {
21
16
  return /*#__PURE__*/ _react.default.cloneElement(maybeElement, {
22
17
  color: color
23
18
  });
24
19
  }
25
20
  return maybeElement;
26
21
  }
27
- var _default = addColorForHarmony;
@@ -0,0 +1 @@
1
+ export declare const getRectById: (id: string) => Promise<unknown>;
@@ -2,15 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "getTaroRectById", {
5
+ Object.defineProperty(exports, "getRectById", {
6
6
  enumerable: true,
7
7
  get: function() {
8
- return getTaroRectById;
8
+ return getRectById;
9
9
  }
10
10
  });
11
11
  var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
12
12
  var _taro = /*#__PURE__*/ _interop_require_wildcard._(require("@tarojs/taro"));
13
- var getTaroRectById = function getTaroRectById(id) {
13
+ var getRectById = function getRectById(id) {
14
14
  return new Promise(function(resolve, reject) {
15
15
  if (_taro.default.getEnv() === _taro.default.ENV_TYPE.WEB) {
16
16
  var t = document ? document.querySelector("#".concat(id)) : '';
@@ -9,4 +9,4 @@ export interface Rect {
9
9
  height: number;
10
10
  }
11
11
  export declare function makeRect(width: number, height: number): Rect;
12
- export declare const getRectByTaro: (element: any, harmonyId?: string) => Promise<Rect>;
12
+ export declare const getRectInMultiPlatform: (element: any, harmonyId?: string) => Promise<Rect>;
@@ -9,21 +9,20 @@ function _export(target, all) {
9
9
  });
10
10
  }
11
11
  _export(exports, {
12
- getRectByTaro: function() {
13
- return getRectByTaro;
12
+ getRectInMultiPlatform: function() {
13
+ return getRectInMultiPlatform;
14
14
  },
15
15
  makeRect: function() {
16
16
  return makeRect;
17
17
  }
18
18
  });
19
- var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
20
19
  var _async_to_generator = require("@swc/helpers/_/_async_to_generator");
21
20
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
22
21
  var _ts_generator = require("@swc/helpers/_/_ts_generator");
23
22
  var _taro = require("@tarojs/taro");
24
- var _lru = /*#__PURE__*/ _interop_require_default._(require("./lru"));
25
- var _useclientrect = require("../hooks/use-client-rect");
26
- var lru = new _lru.default(10);
23
+ var _lru = require("../lru");
24
+ var _getrect = require("../get-rect");
25
+ var lru = new _lru.MiniLru(10);
27
26
  function makeRect(width, height) {
28
27
  return {
29
28
  top: 0,
@@ -34,17 +33,17 @@ function makeRect(width, height) {
34
33
  height: height
35
34
  };
36
35
  }
37
- var getRectByTaro = /*#__PURE__*/ function() {
36
+ var getRectInMultiPlatform = /*#__PURE__*/ function() {
38
37
  var _ref = (0, _async_to_generator._)(function(element) {
39
38
  var harmonyId;
40
39
  var _arguments = arguments;
41
40
  return (0, _ts_generator._)(this, function(_state) {
42
41
  harmonyId = _arguments.length > 1 && _arguments[1] !== void 0 ? _arguments[1] : '';
43
42
  if (element) {
44
- if (_useclientrect.inBrowser) {
43
+ if (_getrect.inBrowser) {
45
44
  return [
46
45
  2,
47
- Promise.resolve((0, _useclientrect.getRect)(element))
46
+ Promise.resolve((0, _getrect.getRect)(element))
48
47
  ];
49
48
  }
50
49
  // 小程序下的逻辑
@@ -71,7 +70,7 @@ var getRectByTaro = /*#__PURE__*/ function() {
71
70
  ];
72
71
  });
73
72
  });
74
- return function getRectByTaro(element) {
73
+ return function getRectInMultiPlatform(element) {
75
74
  return _ref.apply(this, arguments);
76
75
  };
77
76
  }();
@@ -0,0 +1 @@
1
+ export declare function pxTransform(value: number, radix?: number): any;
@@ -2,16 +2,16 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- Object.defineProperty(exports, "default", {
5
+ Object.defineProperty(exports, "pxTransform", {
6
6
  enumerable: true,
7
7
  get: function() {
8
8
  return pxTransform;
9
9
  }
10
10
  });
11
11
  var _taro = require("@tarojs/taro");
12
- var _platformtaro = require("./platform-taro");
12
+ var _platform = require("./platform");
13
13
  function pxTransform(value, radix) {
14
14
  // @ts-ignore
15
- if ((0, _platformtaro.harmony)()) return (0, _taro.pxTransform)(value, radix || 375);
15
+ if ((0, _platform.harmony)()) return (0, _taro.pxTransform)(value, radix || 375);
16
16
  return "".concat(value, "px");
17
17
  }
@@ -0,0 +1 @@
1
+ export declare const upperCaseFirst: (str: string) => string;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "upperCaseFirst", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return upperCaseFirst;
9
+ }
10
+ });
11
+ var upperCaseFirst = function upperCaseFirst(str) {
12
+ str = str.toLowerCase();
13
+ str = str.replace(/\b\w+\b/g, function(word) {
14
+ return word.substring(0, 1).toUpperCase() + word.substring(1);
15
+ });
16
+ return str;
17
+ };
@@ -0,0 +1,14 @@
1
+ export * from './use-click-away';
2
+ export * from './taro/use-custom-event';
3
+ export * from './use-force-update';
4
+ export * from './use-isomprphic-layout-effect';
5
+ export * from './taro/use-lock-scoll';
6
+ export * from './use-lock-scroll';
7
+ export * from './use-memo';
8
+ export * from './use-pagination';
9
+ export * from './use-props-value';
10
+ export * from './use-ref-state';
11
+ export * from './use-refs';
12
+ export * from './use-touch';
13
+ export * from './use-uuid';
14
+ export * from './use-watch';
@@ -0,0 +1,14 @@
1
+ export * from "./use-click-away";
2
+ export * from "./taro/use-custom-event";
3
+ export * from "./use-force-update";
4
+ export * from "./use-isomprphic-layout-effect";
5
+ export * from "./taro/use-lock-scoll";
6
+ export * from "./use-lock-scroll";
7
+ export * from "./use-memo";
8
+ export * from "./use-pagination";
9
+ export * from "./use-props-value";
10
+ export * from "./use-ref-state";
11
+ export * from "./use-refs";
12
+ export * from "./use-touch";
13
+ export * from "./use-uuid";
14
+ export * from "./use-watch";
@@ -2,7 +2,7 @@ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
2
2
  import { useEffect, useRef } from "react";
3
3
  import isEqual from "react-fast-compare";
4
4
  import { Events, getCurrentInstance } from "@tarojs/taro";
5
- import { useForceUpdate } from "./use-force-update";
5
+ import { useForceUpdate } from "../use-force-update";
6
6
  export var customEvents = new Events();
7
7
  export function useCustomEventsPath(selector) {
8
8
  var _getCurrentInstance_router;
@@ -1,6 +1,6 @@
1
1
  import { useRef } from "react";
2
2
  import { getEnv } from "@tarojs/taro";
3
- import { useLockScroll } from "./use-lock-scroll";
3
+ import { useLockScroll } from "../use-lock-scroll";
4
4
  export var useLockScrollTaro = function(shouldLock) {
5
5
  var refObject = useRef(null);
6
6
  if (getEnv() === 'WEB') {
@@ -1 +1 @@
1
- export default function useMemo<Value, Condition = any[]>(getValue: () => Value, condition: Condition, shouldUpdate: (prev: Condition, next: Condition) => boolean): Value | undefined;
1
+ export declare function useMemo<Value, Condition = any[]>(getValue: () => Value, condition: Condition, shouldUpdate: (prev: Condition, next: Condition) => boolean): Value | undefined;
@@ -1,5 +1,5 @@
1
1
  import * as React from "react";
2
- export default function useMemo(getValue, condition, shouldUpdate) {
2
+ export function useMemo(getValue, condition, shouldUpdate) {
3
3
  var cacheRef = React.useRef({});
4
4
  if (!('value' in cacheRef.current) || shouldUpdate(cacheRef.current.condition, condition)) {
5
5
  cacheRef.current.value = getValue();
@@ -1 +1 @@
1
- export default function useRefs(): any[];
1
+ export declare function useRefs(): any[];
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- export default function useRefs() {
2
+ export function useRefs() {
3
3
  var refs = React.useRef([]);
4
4
  var setRefs = React.useCallback(function(index) {
5
5
  return function(el) {
@@ -1 +1 @@
1
- export default function useUuid(): string;
1
+ export declare function useUuid(): string;
@@ -11,7 +11,7 @@ function uniqueId() {
11
11
  }
12
12
  return "".concat(prefix).concat(id);
13
13
  }
14
- export default function useUuid() {
14
+ export function useUuid() {
15
15
  var idRef = useRef(uniqueId());
16
16
  return idRef.current;
17
17
  }
@@ -2,5 +2,5 @@ type Callback<T> = (prev: T | undefined) => void;
2
2
  type Config = {
3
3
  immediate: boolean;
4
4
  };
5
- declare function useWatch<T>(dep: T, callback: Callback<T>, config?: Config): () => void;
6
- export default useWatch;
5
+ export declare function useWatch<T>(dep: T, callback: Callback<T>, config?: Config): () => void;
6
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { useEffect, useRef } from "react";
2
- function useWatch(dep, callback) {
2
+ export function useWatch(dep, callback) {
3
3
  var config = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {
4
4
  immediate: false
5
5
  };
@@ -29,4 +29,3 @@ function useWatch(dep, callback) {
29
29
  stop.current = true;
30
30
  };
31
31
  }
32
- export default useWatch;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
2
  import { AddressRef, TaroAddressProps } from "../../types";
3
- export declare const Address: React.ForwardRefExoticComponent<Partial<TaroAddressProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange" | "title" | "onClick" | "onLoad"> & React.RefAttributes<AddressRef>>;
3
+ export declare const Address: React.ForwardRefExoticComponent<Partial<TaroAddressProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange" | "onClick" | "title" | "onLoad"> & React.RefAttributes<AddressRef>>;
@@ -8,9 +8,9 @@ import classNames from "classnames";
8
8
  import { User } from "@nutui/icons-react-taro";
9
9
  import { AvatarContext } from "../avatargroup/context";
10
10
  import { ComponentDefaults } from "../../utils/typings";
11
- import { harmony } from "../../utils/platform-taro";
11
+ import { harmony } from "../../utils/taro/platform";
12
12
  import AvatarGroup from "../avatargroup/index";
13
- import pxTransform from "../../utils/px-transform";
13
+ import { pxTransform } from "../../utils/taro/px-transform";
14
14
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
15
15
  size: harmony() ? '40' : '',
16
16
  shape: 'round',
@@ -8,7 +8,7 @@ import React, { useState, useEffect, useMemo, useCallback } from "react";
8
8
  import Taro, { useReady, createSelectorQuery } from "@tarojs/taro";
9
9
  import classNames from "classnames";
10
10
  import { Canvas, View } from "@tarojs/components";
11
- import { getWindowInfo } from "../../utils/get-system-info";
11
+ import { getWindowInfo } from "../../utils/taro/get-system-info";
12
12
  import { Button } from "../button/button";
13
13
  import { useConfig } from "../configprovider/index";
14
14
  import { ComponentDefaults } from "../../utils/typings";
@@ -10,8 +10,8 @@ import classNames from "classnames";
10
10
  import { View } from "@tarojs/components";
11
11
  import { ComponentDefaults } from "../../utils/typings";
12
12
  import { useRtl } from "../configprovider/index";
13
- import pxTransform from "../../utils/px-transform";
14
- import { harmony } from "../../utils/platform-taro";
13
+ import { pxTransform } from "../../utils/taro/px-transform";
14
+ import { harmony } from "../../utils/taro/platform";
15
15
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
16
16
  value: '',
17
17
  dot: false,
@@ -7,7 +7,7 @@ import React, { useEffect, useRef, useImperativeHandle } from "react";
7
7
  import classNames from "classnames";
8
8
  import { View } from "@tarojs/components";
9
9
  import { ComponentDefaults } from "../../utils/typings";
10
- import { getRectByTaro } from "../../utils/get-rect-by-taro";
10
+ import { getRectInMultiPlatform } from "../../utils/taro/get-rect";
11
11
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
12
12
  list: [],
13
13
  interval: 500,
@@ -62,7 +62,7 @@ var InternalBarrage = function(props, ref) {
62
62
  ];
63
63
  return [
64
64
  4,
65
- getRectByTaro(node)
65
+ getRectInMultiPlatform(node)
66
66
  ];
67
67
  case 1:
68
68
  refe = _state.sent();
@@ -159,7 +159,7 @@ var InternalBarrage = function(props, ref) {
159
159
  ];
160
160
  return [
161
161
  4,
162
- getRectByTaro(el)
162
+ getRectInMultiPlatform(el)
163
163
  ];
164
164
  case 1:
165
165
  refe = _state.sent();
@@ -8,7 +8,7 @@ import { View, Button as TaroButton } from "@tarojs/components";
8
8
  import { Loading } from "@nutui/icons-react-taro";
9
9
  import { getEnv } from "@tarojs/taro";
10
10
  import { ComponentDefaults } from "../../utils/typings";
11
- import { harmony } from "../../utils/platform-taro";
11
+ import { harmony } from "../../utils/taro/platform";
12
12
  var prefixCls = 'nut-button';
13
13
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
14
14
  color: '',
@@ -8,7 +8,7 @@ import { ComponentDefaults } from "../../utils/typings";
8
8
  import { CellGroup } from "../cellgroup/cellgroup";
9
9
  import CellGroupContext from "../cellgroup/context";
10
10
  import { useRtl } from "../configprovider/index";
11
- import pxTransform from "../../utils/px-transform";
11
+ import { pxTransform } from "../../utils/taro/px-transform";
12
12
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
13
13
  title: null,
14
14
  description: null,
@@ -4,7 +4,7 @@ import { _ as _sliced_to_array } from "@swc/helpers/_/_sliced_to_array";
4
4
  import React, { useContext, useEffect, useState } from "react";
5
5
  import classNames from "classnames";
6
6
  import { View } from "@tarojs/components";
7
- import pxTransform from "../../utils/px-transform";
7
+ import { pxTransform } from "../../utils/taro/px-transform";
8
8
  import { DataContext } from "../row/context";
9
9
  import { ComponentDefaults } from "../../utils/typings";
10
10
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
@@ -11,8 +11,8 @@ import classNames from "classnames";
11
11
  import { nextTick } from "@tarojs/taro";
12
12
  import { ComponentDefaults } from "../../utils/typings";
13
13
  import CollapseContext from "../collapse/context";
14
- import { getRectByTaro } from "../../utils/get-rect-by-taro";
15
- import useUuid from "../../hooks/use-uuid";
14
+ import { getRectInMultiPlatform } from "../../utils/taro/get-rect";
15
+ import { useUuid } from "../../hooks/use-uuid";
16
16
  import { useRefState } from "../../hooks/use-ref-state";
17
17
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
18
18
  title: null,
@@ -69,7 +69,7 @@ export var CollapseItem = function(props) {
69
69
  case 0:
70
70
  return [
71
71
  4,
72
- getRectByTaro(contentRef.current, target)
72
+ getRectInMultiPlatform(contentRef.current, target)
73
73
  ];
74
74
  case 1:
75
75
  res = _state.sent();
@@ -6,7 +6,7 @@ import classNames from "classnames";
6
6
  import kebabCase from "lodash.kebabcase";
7
7
  import isEqual from "react-fast-compare";
8
8
  import { View } from "@tarojs/components";
9
- import useMemo from "../../hooks/use-memo";
9
+ import { useMemo } from "../../hooks/use-memo";
10
10
  import zhCN from "../../locales/zh-CN";
11
11
  var classPrefix = 'nut-configprovider';
12
12
  export var defaultConfigRef = {
@@ -8,7 +8,7 @@ import classNames from "classnames";
8
8
  import { View } from "@tarojs/components";
9
9
  import { ComponentDefaults } from "../../utils/typings";
10
10
  import { padZero } from "../../utils/pad-zero";
11
- import { web } from "../../utils/platform-taro";
11
+ import { web } from "../../utils/taro/platform";
12
12
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
13
13
  type: 'default',
14
14
  paused: false,
@@ -14,10 +14,10 @@ import { Content, defaultContentProps } from "./content";
14
14
  import { useConfig } from "../configprovider/configprovider";
15
15
  import Overlay from "../overlay/index";
16
16
  import { defaultOverlayProps } from "../overlay/overlay";
17
- import { customEvents, useCustomEvent, useCustomEventsPath, useParams } from "../../hooks/use-custom-event";
18
- import { useLockScrollTaro } from "../../hooks/use-lock-scoll-taro";
17
+ import { customEvents, useCustomEvent, useCustomEventsPath, useParams } from "../../hooks/taro/use-custom-event";
18
+ import { useLockScrollTaro } from "../../hooks/taro/use-lock-scoll";
19
19
  import { mergeProps } from "../../utils/merge-props";
20
- import { harmony } from "../../utils/platform-taro";
20
+ import { harmony } from "../../utils/taro/platform";
21
21
  var defaultProps = _object_spread_props(_object_spread({}, defaultOverlayProps, defaultContentProps), {
22
22
  title: '',
23
23
  content: '',
@@ -6,9 +6,9 @@ import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
6
6
  import React, { useState, useEffect, useRef } from "react";
7
7
  import { View } from "@tarojs/components";
8
8
  import { ComponentDefaults } from "../../utils/typings";
9
- import { getRectByTaro } from "../../utils/get-rect-by-taro";
10
- import { getWindowInfo } from "../../utils/get-system-info";
11
- import { web } from "../../utils/platform-taro";
9
+ import { getRectInMultiPlatform } from "../../utils/taro/get-rect";
10
+ import { getWindowInfo } from "../../utils/taro/get-system-info";
11
+ import { web } from "../../utils/taro/platform";
12
12
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
13
13
  attract: false,
14
14
  direction: undefined,
@@ -54,7 +54,7 @@ export var Drag = function(props) {
54
54
  _getWindowInfo = getWindowInfo(), screenWidth = _getWindowInfo.screenWidth, windowHeight = _getWindowInfo.windowHeight;
55
55
  return [
56
56
  4,
57
- getRectByTaro(dragRef.current)
57
+ getRectInMultiPlatform(dragRef.current)
58
58
  ];
59
59
  case 1:
60
60
  _ref = _state.sent(), width = _ref.width, height = _ref.height, dragTop = _ref.top, dragLeft = _ref.left;
@@ -9,8 +9,8 @@ import Taro, { nextTick, createSelectorQuery } from "@tarojs/taro";
9
9
  import { ScrollView, View, Text } from "@tarojs/components";
10
10
  import classNames from "classnames";
11
11
  import { ComponentDefaults } from "../../utils/typings";
12
- import { harmony } from "../../utils/platform-taro";
13
- import useUuid from "../../hooks/use-uuid";
12
+ import { harmony } from "../../utils/taro/platform";
13
+ import { useUuid } from "../../hooks/use-uuid";
14
14
  export var elevatorContext = /*#__PURE__*/ createContext({});
15
15
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
16
16
  height: '200px',
@@ -9,7 +9,7 @@ import React, { useState, useRef, useEffect } from "react";
9
9
  import { nextTick, createSelectorQuery } from "@tarojs/taro";
10
10
  import classNames from "classnames";
11
11
  import { View } from "@tarojs/components";
12
- import { getRectByTaro } from "../../utils/get-rect-by-taro";
12
+ import { getRectInMultiPlatform } from "../../utils/taro/get-rect";
13
13
  import { ComponentDefaults } from "../../utils/typings";
14
14
  import { useRtl } from "../configprovider/index";
15
15
  var defaultProps = _object_spread_props(_object_spread({}, ComponentDefaults), {
@@ -98,7 +98,7 @@ export var Ellipsis = function(props) {
98
98
  case 0:
99
99
  return [
100
100
  4,
101
- getRectByTaro(symbolContain === null || symbolContain === void 0 ? void 0 : symbolContain.current)
101
+ getRectInMultiPlatform(symbolContain === null || symbolContain === void 0 ? void 0 : symbolContain.current)
102
102
  ];
103
103
  case 1:
104
104
  refe = _state.sent();
@@ -171,7 +171,7 @@ export var Ellipsis = function(props) {
171
171
  case 0:
172
172
  return [
173
173
  4,
174
- getRectByTaro(rootContain.current)
174
+ getRectInMultiPlatform(rootContain.current)
175
175
  ];
176
176
  case 1:
177
177
  refe = _state.sent();
@@ -217,7 +217,7 @@ export var Ellipsis = function(props) {
217
217
  case 0:
218
218
  return [
219
219
  4,
220
- getRectByTaro(rootContain.current)
220
+ getRectInMultiPlatform(rootContain.current)
221
221
  ];
222
222
  case 1:
223
223
  refe = _state.sent();