@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
@@ -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 classNames from "classnames";
8
10
  import { Loading1 } from "@nutui/icons-react";
@@ -47,14 +49,57 @@ export var Switch = function(props) {
47
49
  (_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)
48
50
  ]);
49
51
  };
50
- var onClick = function() {
51
- if (disabled || changing) return;
52
- if (onChange) {
53
- setChanging(true);
54
- onChange(!value);
55
- }
56
- setValue(!value);
57
- };
52
+ var onClick = /*#__PURE__*/ function() {
53
+ var _ref = _async_to_generator(function() {
54
+ var e;
55
+ return _ts_generator(this, function(_state) {
56
+ switch(_state.label){
57
+ case 0:
58
+ if (disabled || changing) return [
59
+ 2
60
+ ];
61
+ if (!onChange) return [
62
+ 3,
63
+ 4
64
+ ];
65
+ setChanging(true);
66
+ _state.label = 1;
67
+ case 1:
68
+ _state.trys.push([
69
+ 1,
70
+ 3,
71
+ ,
72
+ 4
73
+ ]);
74
+ return [
75
+ 4,
76
+ onChange(!value)
77
+ ];
78
+ case 2:
79
+ _state.sent();
80
+ return [
81
+ 3,
82
+ 4
83
+ ];
84
+ case 3:
85
+ e = _state.sent();
86
+ setChanging(false);
87
+ return [
88
+ 3,
89
+ 4
90
+ ];
91
+ case 4:
92
+ setValue(!value);
93
+ return [
94
+ 2
95
+ ];
96
+ }
97
+ });
98
+ });
99
+ return function onClick() {
100
+ return _ref.apply(this, arguments);
101
+ };
102
+ }();
58
103
  var _obj, _obj1;
59
104
  return /*#__PURE__*/ React.createElement("div", _object_spread({
60
105
  className: classes(),
@@ -6,7 +6,7 @@ import React, { useEffect, useState } from "react";
6
6
  import { Close } from "@nutui/icons-react";
7
7
  import classNames from "classnames";
8
8
  import Popover from "../popover";
9
- import { getRect } from "../../hooks/use-client-rect";
9
+ import { getRect } from "../../utils/get-rect";
10
10
  import { ComponentDefaults } from "../../utils/typings";
11
11
  import { useConfig } from "../configprovider";
12
12
  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
+ };
@@ -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,28 @@
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 "./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";
@@ -0,0 +1,34 @@
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) {
@@ -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;
@@ -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;
@@ -0,0 +1 @@
1
+ export declare const getRectById: (id: string) => Promise<unknown>;
@@ -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)) : '';
@@ -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>;
@@ -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
  }();
@@ -0,0 +1 @@
1
+ export declare function pxTransform(value: number, radix?: number): any;
@@ -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
+ };