@nutui/nutui-react 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 (167) 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 +17 -0
  4. package/dist/cjs/hooks/index.taro.js +19 -0
  5. package/dist/cjs/hooks/{use-custom-event.js → taro/use-custom-event.js} +1 -1
  6. package/dist/cjs/hooks/{use-lock-scoll-taro.js → taro/use-lock-scoll.js} +1 -1
  7. package/dist/cjs/hooks/use-memo.d.ts +1 -1
  8. package/dist/cjs/hooks/use-memo.js +1 -1
  9. package/dist/cjs/hooks/use-refs.d.ts +1 -1
  10. package/dist/cjs/hooks/use-refs.js +1 -1
  11. package/dist/cjs/hooks/use-uuid.d.ts +1 -1
  12. package/dist/cjs/hooks/use-uuid.js +1 -1
  13. package/dist/cjs/hooks/use-watch.d.ts +2 -2
  14. package/dist/cjs/hooks/use-watch.js +2 -3
  15. package/dist/cjs/packages/avatar/style/style.css +4 -0
  16. package/dist/cjs/packages/avatarcropper/avatarcropper.js +2 -2
  17. package/dist/cjs/packages/cascader/cascader.js +2 -1
  18. package/dist/cjs/packages/configprovider/configprovider.js +4 -4
  19. package/dist/cjs/packages/configprovider/types.d.ts +1 -1
  20. package/dist/cjs/packages/dialog/style/dialog.scss +1 -0
  21. package/dist/cjs/packages/dialog/style/style.css +1 -0
  22. package/dist/cjs/packages/image/style/image.scss +4 -1
  23. package/dist/cjs/packages/image/style/style.css +4 -0
  24. package/dist/cjs/packages/imagepreview/style/style.css +4 -0
  25. package/dist/cjs/packages/noticebar/noticebar.js +4 -4
  26. package/dist/cjs/packages/nutui.react.build.d.ts +2 -0
  27. package/dist/cjs/packages/nutui.react.build.js +2 -0
  28. package/dist/cjs/packages/nutui.react.d.ts +2 -0
  29. package/dist/cjs/packages/nutui.react.js +2 -0
  30. package/dist/cjs/packages/picker/picker.js +2 -2
  31. package/dist/cjs/packages/popover/popover.js +2 -2
  32. package/dist/cjs/packages/range/range.js +3 -3
  33. package/dist/cjs/packages/rate/rate.js +4 -4
  34. package/dist/cjs/packages/skeleton/skeleton.js +1 -2
  35. package/dist/cjs/packages/sticky/sticky.js +9 -9
  36. package/dist/cjs/packages/swipe/swipe.js +2 -2
  37. package/dist/cjs/packages/switch/switch.js +53 -8
  38. package/dist/cjs/packages/tour/tour.js +2 -2
  39. package/dist/cjs/utils/clamp.d.ts +1 -0
  40. package/dist/cjs/utils/clamp.js +13 -0
  41. package/dist/cjs/utils/index.d.ts +28 -6
  42. package/dist/cjs/utils/index.js +29 -54
  43. package/dist/cjs/utils/index.taro.js +39 -0
  44. package/dist/cjs/utils/interceptor.js +2 -2
  45. package/dist/cjs/utils/is-function.d.ts +1 -0
  46. package/dist/cjs/utils/is-function.js +14 -0
  47. package/dist/cjs/utils/is-object.d.ts +1 -0
  48. package/dist/cjs/utils/is-object.js +14 -0
  49. package/dist/cjs/utils/is-promise.d.ts +1 -0
  50. package/dist/cjs/utils/is-promise.js +15 -0
  51. package/dist/cjs/utils/lru.d.ts +1 -1
  52. package/dist/cjs/utils/lru.js +1 -1
  53. package/dist/cjs/utils/merge.d.ts +0 -1
  54. package/dist/cjs/utils/merge.js +0 -4
  55. package/dist/cjs/utils/prevent-default.d.ts +1 -0
  56. package/dist/cjs/utils/prevent-default.js +18 -0
  57. package/dist/cjs/utils/raf.d.ts +0 -1
  58. package/dist/cjs/utils/raf.js +3 -6
  59. package/dist/{es/utils → cjs/utils/taro}/add-color-for-harmony.d.ts +1 -2
  60. package/dist/cjs/utils/{add-color-for-harmony.js → taro/add-color-for-harmony.js} +5 -11
  61. package/dist/cjs/utils/taro/get-rect-by-id.d.ts +1 -0
  62. package/dist/cjs/{hooks/use-taro-rect.js → utils/taro/get-rect-by-id.js} +3 -3
  63. package/dist/cjs/utils/{get-rect-by-taro.d.ts → taro/get-rect.d.ts} +1 -1
  64. package/dist/cjs/utils/{get-rect-by-taro.js → taro/get-rect.js} +9 -10
  65. package/dist/cjs/utils/taro/px-transform.d.ts +1 -0
  66. package/dist/cjs/utils/{px-transform.js → taro/px-transform.js} +3 -3
  67. package/dist/cjs/utils/upper-case-first.d.ts +1 -0
  68. package/dist/cjs/utils/upper-case-first.js +17 -0
  69. package/dist/es/hooks/index.d.ts +12 -0
  70. package/dist/es/hooks/index.js +12 -0
  71. package/dist/es/hooks/index.taro.js +14 -0
  72. package/dist/es/hooks/{use-custom-event.js → taro/use-custom-event.js} +1 -1
  73. package/dist/es/hooks/{use-lock-scoll-taro.js → taro/use-lock-scoll.js} +1 -1
  74. package/dist/es/hooks/use-memo.d.ts +1 -1
  75. package/dist/es/hooks/use-memo.js +1 -1
  76. package/dist/es/hooks/use-refs.d.ts +1 -1
  77. package/dist/es/hooks/use-refs.js +1 -1
  78. package/dist/es/hooks/use-uuid.d.ts +1 -1
  79. package/dist/es/hooks/use-uuid.js +1 -1
  80. package/dist/es/hooks/use-watch.d.ts +2 -2
  81. package/dist/es/hooks/use-watch.js +1 -2
  82. package/dist/es/packages/avatar/style/style.css +4 -0
  83. package/dist/es/packages/avatarcropper/avatarcropper.js +1 -1
  84. package/dist/es/packages/cascader/cascader.js +2 -1
  85. package/dist/es/packages/configprovider/configprovider.js +2 -2
  86. package/dist/es/packages/configprovider/types.d.ts +1 -1
  87. package/dist/es/packages/dialog/style/dialog.scss +1 -0
  88. package/dist/es/packages/dialog/style/style.css +1 -0
  89. package/dist/es/packages/image/style/image.scss +4 -1
  90. package/dist/es/packages/image/style/style.css +4 -0
  91. package/dist/es/packages/imagepreview/style/style.css +4 -0
  92. package/dist/es/packages/noticebar/noticebar.js +1 -1
  93. package/dist/es/packages/nutui.react.build.d.ts +2 -0
  94. package/dist/es/packages/nutui.react.build.js +2 -0
  95. package/dist/es/packages/picker/picker.js +1 -1
  96. package/dist/es/packages/popover/popover.js +1 -1
  97. package/dist/es/packages/range/range.js +1 -1
  98. package/dist/es/packages/rate/rate.js +2 -2
  99. package/dist/es/packages/skeleton/skeleton.js +1 -2
  100. package/dist/es/packages/sticky/sticky.js +2 -2
  101. package/dist/es/packages/swipe/swipe.js +1 -1
  102. package/dist/es/packages/switch/switch.js +53 -8
  103. package/dist/es/packages/tour/tour.js +1 -1
  104. package/dist/es/utils/clamp.d.ts +1 -0
  105. package/dist/es/utils/clamp.js +3 -0
  106. package/dist/es/utils/index.d.ts +28 -6
  107. package/dist/es/utils/index.js +28 -29
  108. package/dist/es/utils/index.taro.js +34 -0
  109. package/dist/es/utils/interceptor.js +1 -1
  110. package/dist/es/utils/is-function.d.ts +1 -0
  111. package/dist/es/utils/is-function.js +4 -0
  112. package/dist/es/utils/is-object.d.ts +1 -0
  113. package/dist/es/utils/is-object.js +4 -0
  114. package/dist/es/utils/is-promise.d.ts +1 -0
  115. package/dist/es/utils/is-promise.js +5 -0
  116. package/dist/es/utils/lru.d.ts +1 -1
  117. package/dist/es/utils/lru.js +1 -2
  118. package/dist/es/utils/merge.d.ts +0 -1
  119. package/dist/es/utils/merge.js +0 -1
  120. package/dist/es/utils/prevent-default.d.ts +1 -0
  121. package/dist/es/utils/prevent-default.js +8 -0
  122. package/dist/es/utils/raf.d.ts +0 -1
  123. package/dist/es/utils/raf.js +1 -1
  124. package/dist/{cjs/utils → es/utils/taro}/add-color-for-harmony.d.ts +1 -2
  125. package/dist/es/utils/{add-color-for-harmony.js → taro/add-color-for-harmony.js} +2 -3
  126. package/dist/es/utils/taro/get-rect-by-id.d.ts +1 -0
  127. package/dist/es/{hooks/use-taro-rect.js → utils/taro/get-rect-by-id.js} +1 -1
  128. package/dist/es/utils/{get-rect-by-taro.d.ts → taro/get-rect.d.ts} +1 -1
  129. package/dist/es/utils/{get-rect-by-taro.js → taro/get-rect.js} +4 -4
  130. package/dist/es/utils/taro/px-transform.d.ts +1 -0
  131. package/dist/es/utils/{px-transform.js → taro/px-transform.js} +2 -2
  132. package/dist/es/utils/upper-case-first.d.ts +1 -0
  133. package/dist/es/utils/upper-case-first.js +7 -0
  134. package/dist/nutui.react.umd.js +1014 -735
  135. package/dist/style.css +1 -1
  136. package/dist/style.scss +39 -39
  137. package/dist/styles/themes/dark.css +1 -1
  138. package/dist/styles/themes/default.css +1 -1
  139. package/dist/styles/themes/jmapp.css +1 -1
  140. package/dist/styles/themes/jrkf.css +1 -1
  141. package/dist/styles/variables-jmapp.scss +1 -0
  142. package/dist/styles/variables.scss +4 -0
  143. package/package.json +1 -1
  144. package/dist/cjs/hooks/use-taro-rect.d.ts +0 -1
  145. package/dist/cjs/utils/px-transform.d.ts +0 -1
  146. package/dist/es/hooks/use-taro-rect.d.ts +0 -1
  147. package/dist/es/utils/px-transform.d.ts +0 -1
  148. /package/dist/cjs/hooks/{use-custom-event.d.ts → taro/use-custom-event.d.ts} +0 -0
  149. /package/dist/cjs/hooks/{use-lock-scoll-taro.d.ts → taro/use-lock-scoll.d.ts} +0 -0
  150. /package/dist/cjs/utils/{test/event.d.ts → event-mocker.d.ts} +0 -0
  151. /package/dist/cjs/utils/{test/event.js → event-mocker.js} +0 -0
  152. /package/dist/cjs/{hooks/use-client-rect.d.ts → utils/get-rect.d.ts} +0 -0
  153. /package/dist/cjs/{hooks/use-client-rect.js → utils/get-rect.js} +0 -0
  154. /package/dist/cjs/utils/{get-system-info.d.ts → taro/get-system-info.d.ts} +0 -0
  155. /package/dist/cjs/utils/{get-system-info.js → taro/get-system-info.js} +0 -0
  156. /package/dist/cjs/utils/{platform-taro.d.ts → taro/platform.d.ts} +0 -0
  157. /package/dist/cjs/utils/{platform-taro.js → taro/platform.js} +0 -0
  158. /package/dist/es/hooks/{use-custom-event.d.ts → taro/use-custom-event.d.ts} +0 -0
  159. /package/dist/es/hooks/{use-lock-scoll-taro.d.ts → taro/use-lock-scoll.d.ts} +0 -0
  160. /package/dist/es/utils/{test/event.d.ts → event-mocker.d.ts} +0 -0
  161. /package/dist/es/utils/{test/event.js → event-mocker.js} +0 -0
  162. /package/dist/es/{hooks/use-client-rect.d.ts → utils/get-rect.d.ts} +0 -0
  163. /package/dist/es/{hooks/use-client-rect.js → utils/get-rect.js} +0 -0
  164. /package/dist/es/utils/{get-system-info.d.ts → taro/get-system-info.d.ts} +0 -0
  165. /package/dist/es/utils/{get-system-info.js → taro/get-system-info.js} +0 -0
  166. /package/dist/es/utils/{platform-taro.d.ts → taro/platform.d.ts} +0 -0
  167. /package/dist/es/utils/{platform-taro.js → taro/platform.js} +0 -0
@@ -19,8 +19,8 @@ var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames")
19
19
  var _iconsreact = require("@nutui/icons-react");
20
20
  var _typings = require("../../utils/typings");
21
21
  var _usepropsvalue = require("../../hooks/use-props-value");
22
- var _useclientrect = require("../../hooks/use-client-rect");
23
- var _userefs = /*#__PURE__*/ _interop_require_default._(require("../../hooks/use-refs"));
22
+ var _getrect = require("../../utils/get-rect");
23
+ var _userefs = require("../../hooks/use-refs");
24
24
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
25
25
  size: 'normal',
26
26
  showScore: false,
@@ -43,7 +43,7 @@ var Rate = function Rate(props) {
43
43
  4,
44
44
  5
45
45
  ]), 2), countArray = _useState[0], setCountArray = _useState[1];
46
- var _useRefs = (0, _sliced_to_array._)((0, _userefs.default)(), 2), refs = _useRefs[0], setRefs = _useRefs[1];
46
+ var _useRefs = (0, _sliced_to_array._)((0, _userefs.useRefs)(), 2), refs = _useRefs[0], setRefs = _useRefs[1];
47
47
  var rateRects = (0, _react.useRef)([]);
48
48
  var _usePropsValue = (0, _sliced_to_array._)((0, _usepropsvalue.usePropsValue)({
49
49
  value: value,
@@ -98,7 +98,7 @@ var Rate = function Rate(props) {
98
98
  for(var index = 0; index < refs.length; index++){
99
99
  var item = refs[index];
100
100
  if (item) {
101
- rateRects.current[index] = (0, _useclientrect.getRect)(item);
101
+ rateRects.current[index] = (0, _getrect.getRect)(item);
102
102
  }
103
103
  }
104
104
  };
@@ -23,8 +23,7 @@ var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typing
23
23
  visible: false,
24
24
  size: 'normal',
25
25
  shape: 'round',
26
- duration: 0.6,
27
- inline: false
26
+ duration: 0.6
28
27
  });
29
28
  var Skeleton = function Skeleton(props) {
30
29
  var shapeStyle = function shapeStyle() {
@@ -18,8 +18,8 @@ var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
18
18
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
19
19
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
20
20
  var _getscrollparent = require("../../utils/get-scroll-parent");
21
- var _useclientrect = require("../../hooks/use-client-rect");
22
- var _usewatch = /*#__PURE__*/ _interop_require_default._(require("../../hooks/use-watch"));
21
+ var _getrect = require("../../utils/get-rect");
22
+ var _usewatch = require("../../hooks/use-watch");
23
23
  var _typings = require("../../utils/typings");
24
24
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
25
25
  position: 'top',
@@ -61,10 +61,10 @@ var Sticky = function Sticky(props) {
61
61
  var rootEle = rootRef.current;
62
62
  var stickyEle = stickyRef.current;
63
63
  if (!rootEle && !containerEle) return;
64
- var rootRect = (0, _useclientrect.getRect)(rootEle);
65
- var containerRect = (0, _useclientrect.getRect)(containerEle);
64
+ var rootRect = (0, _getrect.getRect)(rootEle);
65
+ var containerRect = (0, _getrect.getRect)(containerEle);
66
66
  var clientHeight = document.documentElement.clientHeight;
67
- var stickyRect = (0, _useclientrect.getRect)(stickyEle);
67
+ var stickyRect = (0, _getrect.getRect)(stickyEle);
68
68
  var fixed = clientHeight - threshold < rootRect.bottom;
69
69
  if (containerEle) {
70
70
  fixed = containerRect.bottom > clientHeight - threshold - stickyRect.height && clientHeight - threshold - stickyRect.height > containerRect.top;
@@ -86,9 +86,9 @@ var Sticky = function Sticky(props) {
86
86
  var rootEle = rootRef.current;
87
87
  var stickyEle = stickyRef.current;
88
88
  if (!rootEle && !containerEle) return;
89
- var rootRect = (0, _useclientrect.getRect)(rootEle);
90
- var stickyRect = (0, _useclientrect.getRect)(stickyEle);
91
- var containerRect = (0, _useclientrect.getRect)(containerEle);
89
+ var rootRect = (0, _getrect.getRect)(rootEle);
90
+ var stickyRect = (0, _getrect.getRect)(stickyEle);
91
+ var containerRect = (0, _getrect.getRect)(containerEle);
92
92
  if (rootRect.height) {
93
93
  setRootStyle(function(prev) {
94
94
  return (0, _object_spread_props._)((0, _object_spread._)({}, prev), {
@@ -139,7 +139,7 @@ var Sticky = function Sticky(props) {
139
139
  threshold,
140
140
  container
141
141
  ]);
142
- (0, _usewatch.default)(isFixed, function() {
142
+ (0, _usewatch.useWatch)(isFixed, function() {
143
143
  onChange && onChange(isFixed);
144
144
  });
145
145
  (0, _react.useEffect)(function() {
@@ -16,7 +16,7 @@ var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
16
16
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
17
17
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
18
18
  var _usetouch = require("../../hooks/use-touch");
19
- var _useclientrect = require("../../hooks/use-client-rect");
19
+ var _getrect = require("../../utils/get-rect");
20
20
  function preventDefault(event, isStopPropagation) {
21
21
  if (typeof event.cancelable !== 'boolean' || event.cancelable) {
22
22
  event.preventDefault();
@@ -139,7 +139,7 @@ var Swipe = /*#__PURE__*/ (0, _react.forwardRef)(function(props, instanceRef) {
139
139
  };
140
140
  var getNodeWidth = function getNodeWidth(node) {
141
141
  if (node) {
142
- var ele = (0, _useclientrect.getRect)(node);
142
+ var ele = (0, _getrect.getRect)(node);
143
143
  return ele.width;
144
144
  }
145
145
  return 0;
@@ -10,11 +10,13 @@ Object.defineProperty(exports, "Switch", {
10
10
  });
11
11
  var _interop_require_default = require("@swc/helpers/_/_interop_require_default");
12
12
  var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
13
+ var _async_to_generator = require("@swc/helpers/_/_async_to_generator");
13
14
  var _define_property = require("@swc/helpers/_/_define_property");
14
15
  var _object_spread = require("@swc/helpers/_/_object_spread");
15
16
  var _object_spread_props = require("@swc/helpers/_/_object_spread_props");
16
17
  var _object_without_properties = require("@swc/helpers/_/_object_without_properties");
17
18
  var _sliced_to_array = require("@swc/helpers/_/_sliced_to_array");
19
+ var _ts_generator = require("@swc/helpers/_/_ts_generator");
18
20
  var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
19
21
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
20
22
  var _iconsreact = require("@nutui/icons-react");
@@ -59,14 +61,57 @@ var Switch = function Switch(props) {
59
61
  (_obj = {}, (0, _define_property._)(_obj, "".concat(classPrefix, "-close"), !value), (0, _define_property._)(_obj, "".concat(classPrefix, "-disabled"), disabled), (0, _define_property._)(_obj, "".concat(classPrefix, "-disabled-close"), disabled && !value), _obj)
60
62
  ]);
61
63
  };
62
- var onClick = function onClick() {
63
- if (disabled || changing) return;
64
- if (onChange) {
65
- setChanging(true);
66
- onChange(!value);
67
- }
68
- setValue(!value);
69
- };
64
+ var onClick = /*#__PURE__*/ function() {
65
+ var _ref = (0, _async_to_generator._)(function() {
66
+ var e;
67
+ return (0, _ts_generator._)(this, function(_state) {
68
+ switch(_state.label){
69
+ case 0:
70
+ if (disabled || changing) return [
71
+ 2
72
+ ];
73
+ if (!onChange) return [
74
+ 3,
75
+ 4
76
+ ];
77
+ setChanging(true);
78
+ _state.label = 1;
79
+ case 1:
80
+ _state.trys.push([
81
+ 1,
82
+ 3,
83
+ ,
84
+ 4
85
+ ]);
86
+ return [
87
+ 4,
88
+ onChange(!value)
89
+ ];
90
+ case 2:
91
+ _state.sent();
92
+ return [
93
+ 3,
94
+ 4
95
+ ];
96
+ case 3:
97
+ e = _state.sent();
98
+ setChanging(false);
99
+ return [
100
+ 3,
101
+ 4
102
+ ];
103
+ case 4:
104
+ setValue(!value);
105
+ return [
106
+ 2
107
+ ];
108
+ }
109
+ });
110
+ });
111
+ return function onClick() {
112
+ return _ref.apply(this, arguments);
113
+ };
114
+ }();
70
115
  var _obj, _obj1;
71
116
  return /*#__PURE__*/ _react.default.createElement("div", (0, _object_spread._)({
72
117
  className: classes(),
@@ -18,7 +18,7 @@ var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
18
18
  var _iconsreact = require("@nutui/icons-react");
19
19
  var _classnames = /*#__PURE__*/ _interop_require_default._(require("classnames"));
20
20
  var _popover = /*#__PURE__*/ _interop_require_default._(require("../popover"));
21
- var _useclientrect = require("../../hooks/use-client-rect");
21
+ var _getrect = require("../../utils/get-rect");
22
22
  var _typings = require("../../utils/typings");
23
23
  var _configprovider = require("../configprovider");
24
24
  var defaultProps = (0, _object_spread_props._)((0, _object_spread._)({}, _typings.ComponentDefaults), {
@@ -94,7 +94,7 @@ var Tour = function Tour(props) {
94
94
  ]);
95
95
  var getRootPosition = function getRootPosition() {
96
96
  var el = document.querySelector("#".concat(list[active].target));
97
- var rect = (0, _useclientrect.getRect)(el);
97
+ var rect = (0, _getrect.getRect)(el);
98
98
  setMaskRect(rect);
99
99
  };
100
100
  var maskStyle = function maskStyle() {
@@ -0,0 +1 @@
1
+ export declare const clamp: (num: number, min: number, max: number) => number;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "clamp", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return clamp;
9
+ }
10
+ });
11
+ var clamp = function clamp(num, min, max) {
12
+ return Math.min(Math.max(num, min), max);
13
+ };
@@ -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';
@@ -2,57 +2,32 @@
2
2
  Object.defineProperty(exports, "__esModule", {
3
3
  value: true
4
4
  });
5
- function _export(target, all) {
6
- for(var name in all)Object.defineProperty(target, name, {
7
- enumerable: true,
8
- get: all[name]
9
- });
10
- }
11
- _export(exports, {
12
- clamp: function() {
13
- return clamp;
14
- },
15
- isFunction: function() {
16
- return isFunction;
17
- },
18
- isObject: function() {
19
- return isObject;
20
- },
21
- isPromise: function() {
22
- return isPromise;
23
- },
24
- preventDefault: function() {
25
- return preventDefault;
26
- },
27
- upperCaseFirst: function() {
28
- return upperCaseFirst;
29
- }
30
- });
31
- var _type_of = require("@swc/helpers/_/_type_of");
32
- var isObject = function isObject(val) {
33
- return val !== null && (typeof val === "undefined" ? "undefined" : (0, _type_of._)(val)) === 'object';
34
- };
35
- var isFunction = function isFunction(val) {
36
- return typeof val === 'function';
37
- };
38
- var isPromise = function isPromise(val) {
39
- return isObject(val) && isFunction(val.then) && isFunction(val.catch);
40
- };
41
- var upperCaseFirst = function upperCaseFirst(str) {
42
- str = str.toLowerCase();
43
- str = str.replace(/\b\w+\b/g, function(word) {
44
- return word.substring(0, 1).toUpperCase() + word.substring(1);
45
- });
46
- return str;
47
- };
48
- var clamp = function clamp(num, min, max) {
49
- return Math.min(Math.max(num, min), max);
50
- };
51
- function preventDefault(event, isStopPropagation) {
52
- if (typeof event.cancelable !== 'boolean' || event.cancelable) {
53
- event.preventDefault();
54
- }
55
- if (isStopPropagation) {
56
- event.stopPropagation();
57
- }
58
- }
5
+ var _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./bound"), exports);
7
+ _export_star._(require("./camel-case"), exports);
8
+ _export_star._(require("./can-use-dom"), exports);
9
+ _export_star._(require("./clamp"), exports);
10
+ _export_star._(require("./date"), exports);
11
+ _export_star._(require("./get-rect"), exports);
12
+ _export_star._(require("./get-scroll-parent"), exports);
13
+ _export_star._(require("./interceptor"), exports);
14
+ _export_star._(require("./is-date"), exports);
15
+ _export_star._(require("./is-empty"), exports);
16
+ _export_star._(require("./is-forward-ref-component"), exports);
17
+ _export_star._(require("./is-function"), exports);
18
+ _export_star._(require("./is-object"), exports);
19
+ _export_star._(require("./is-promise"), exports);
20
+ _export_star._(require("./lru"), exports);
21
+ _export_star._(require("./merge"), exports);
22
+ _export_star._(require("./merge-props"), exports);
23
+ _export_star._(require("./pad-zero"), exports);
24
+ _export_star._(require("./prevent-default"), exports);
25
+ _export_star._(require("./px-check"), exports);
26
+ _export_star._(require("./raf"), exports);
27
+ _export_star._(require("./render"), exports);
28
+ _export_star._(require("./rubberband"), exports);
29
+ _export_star._(require("./sleep"), exports);
30
+ _export_star._(require("./supports-passive"), exports);
31
+ _export_star._(require("./to-array"), exports);
32
+ _export_star._(require("./typings"), exports);
33
+ _export_star._(require("./upper-case-first"), exports);
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ var _export_star = require("@swc/helpers/_/_export_star");
6
+ _export_star._(require("./taro/add-color-for-harmony"), exports);
7
+ _export_star._(require("./bound"), exports);
8
+ _export_star._(require("./camel-case"), exports);
9
+ _export_star._(require("./can-use-dom"), exports);
10
+ _export_star._(require("./clamp"), exports);
11
+ _export_star._(require("./date"), exports);
12
+ _export_star._(require("./taro/get-rect"), exports);
13
+ _export_star._(require("./taro/get-rect-by-id"), exports);
14
+ _export_star._(require("./get-rect"), exports);
15
+ _export_star._(require("./get-scroll-parent"), exports);
16
+ _export_star._(require("./taro/get-system-info"), exports);
17
+ _export_star._(require("./interceptor"), exports);
18
+ _export_star._(require("./is-date"), exports);
19
+ _export_star._(require("./is-empty"), exports);
20
+ _export_star._(require("./is-forward-ref-component"), exports);
21
+ _export_star._(require("./is-function"), exports);
22
+ _export_star._(require("./is-object"), exports);
23
+ _export_star._(require("./is-promise"), exports);
24
+ _export_star._(require("./lru"), exports);
25
+ _export_star._(require("./merge"), exports);
26
+ _export_star._(require("./merge-props"), exports);
27
+ _export_star._(require("./pad-zero"), exports);
28
+ _export_star._(require("./taro/platform"), exports);
29
+ _export_star._(require("./prevent-default"), exports);
30
+ _export_star._(require("./px-check"), exports);
31
+ _export_star._(require("./taro/px-transform"), exports);
32
+ _export_star._(require("./raf"), exports);
33
+ _export_star._(require("./render"), exports);
34
+ _export_star._(require("./rubberband"), exports);
35
+ _export_star._(require("./sleep"), exports);
36
+ _export_star._(require("./supports-passive"), exports);
37
+ _export_star._(require("./to-array"), exports);
38
+ _export_star._(require("./typings"), exports);
39
+ _export_star._(require("./upper-case-first"), exports);
@@ -8,13 +8,13 @@ Object.defineProperty(exports, "funcInterceptor", {
8
8
  return funcInterceptor;
9
9
  }
10
10
  });
11
- var _index = require("./index");
11
+ var _ispromise = require("./is-promise");
12
12
  var funcInterceptor = function funcInterceptor(interceptor, param) {
13
13
  var _param_args = param.args, args = _param_args === void 0 ? [] : _param_args, done = param.done, canceled = param.canceled;
14
14
  if (interceptor) {
15
15
  // eslint-disable-next-line prefer-spread
16
16
  var returnVal = interceptor.apply(null, args);
17
- if ((0, _index.isPromise)(returnVal)) {
17
+ if ((0, _ispromise.isPromise)(returnVal)) {
18
18
  returnVal.then(function(value) {
19
19
  if (value) {
20
20
  done(value);
@@ -0,0 +1 @@
1
+ export declare const isFunction: (val: unknown) => val is Function;
@@ -0,0 +1,14 @@
1
+ // eslint-disable-next-line @typescript-eslint/ban-types
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "isFunction", {
7
+ enumerable: true,
8
+ get: function() {
9
+ return isFunction;
10
+ }
11
+ });
12
+ var isFunction = function isFunction(val) {
13
+ return typeof val === 'function';
14
+ };
@@ -0,0 +1 @@
1
+ export declare const isObject: (val: unknown) => val is Record<any, any>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", {
3
+ value: true
4
+ });
5
+ Object.defineProperty(exports, "isObject", {
6
+ enumerable: true,
7
+ get: function() {
8
+ return isObject;
9
+ }
10
+ });
11
+ var _type_of = require("@swc/helpers/_/_type_of");
12
+ var isObject = function isObject(val) {
13
+ return val !== null && (typeof val === "undefined" ? "undefined" : (0, _type_of._)(val)) === 'object';
14
+ };
@@ -0,0 +1 @@
1
+ export declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
@@ -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>;