@bifrostui/utils 1.1.11-beta.0 → 1.1.11-beta.4
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.
- package/README.md +3 -0
- package/dist/debounce.js +4 -4
- package/dist/domTarget.js +0 -2
- package/dist/getBoundingClientRect/index.js +0 -2
- package/dist/getBoundingClientRect/index.miniapp.js +0 -2
- package/dist/hex2rgba.js +1 -3
- package/dist/hooks/index.js +0 -2
- package/dist/hooks/useDidMountEffect.js +5 -5
- package/dist/hooks/useDomCss/index.js +0 -2
- package/dist/hooks/useDomCss/index.miniapp.js +0 -2
- package/dist/hooks/useDomReady/index.js +0 -2
- package/dist/hooks/useDomReady/index.miniapp.js +0 -2
- package/dist/hooks/useEventCallback.js +0 -2
- package/dist/hooks/useForkRef.js +0 -2
- package/dist/hooks/useMemoizedFn.js +0 -2
- package/dist/hooks/useSize.js +0 -2
- package/dist/hooks/useTouch.js +4 -5
- package/dist/hooks/useTouchEmulator.js +3 -5
- package/dist/hooks/useValue.js +0 -2
- package/dist/index.js +0 -2
- package/dist/isDev.js +1 -3
- package/dist/isMini.js +4 -6
- package/dist/isType.js +1 -3
- package/dist/setRef.js +0 -2
- package/dist/throttle.js +2 -3
- package/dist/toArray.js +0 -2
- package/dist/touchBlocker.js +6 -5
- package/dist/transitions.js +29 -19
- package/es/debounce.js +12 -11
- package/es/domTarget.js +8 -5
- package/es/getBoundingClientRect/index.js +5 -2
- package/es/getBoundingClientRect/index.miniapp.js +9 -14
- package/es/hex2rgba.js +12 -19
- package/es/hooks/index.js +11 -1
- package/es/hooks/useDidMountEffect.js +12 -9
- package/es/hooks/useDomCss/index.js +11 -8
- package/es/hooks/useDomCss/index.miniapp.js +12 -9
- package/es/hooks/useDomReady/index.js +7 -4
- package/es/hooks/useDomReady/index.miniapp.js +8 -5
- package/es/hooks/useEventCallback.js +9 -16
- package/es/hooks/useForkRef.js +10 -18
- package/es/hooks/useMemoizedFn.js +13 -14
- package/es/hooks/useSize.js +10 -19
- package/es/hooks/useTouch.js +47 -47
- package/es/hooks/useTouchEmulator.js +34 -90
- package/es/hooks/useValue.js +24 -32
- package/es/index.js +54 -12
- package/es/isDev.js +5 -2
- package/es/isMini.js +11 -6
- package/es/isType.js +6 -4
- package/es/setRef.js +6 -3
- package/es/throttle.js +16 -34
- package/es/toArray.js +10 -8
- package/es/touchBlocker.js +59 -62
- package/es/transitions.js +57 -45
- package/package.json +13 -7
- package/src/index.ts +27 -0
package/es/index.js
CHANGED
@@ -1,12 +1,54 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
import { default as default2 } from "./debounce";
|
2
|
+
import { default as default3 } from "./hex2rgba";
|
3
|
+
import {
|
4
|
+
useDidMountEffect,
|
5
|
+
useEventCallback,
|
6
|
+
useForkRef,
|
7
|
+
useTouchEmulator,
|
8
|
+
useValue,
|
9
|
+
useDomReady,
|
10
|
+
useSize,
|
11
|
+
useDomCss,
|
12
|
+
useTouch
|
13
|
+
} from "./hooks";
|
14
|
+
import { default as default4 } from "./isDev";
|
15
|
+
import { isMini, isWeapp, isAlipay, isMiniapp } from "./isMini";
|
16
|
+
import { default as default5 } from "./setRef";
|
17
|
+
import { default as default6 } from "./throttle";
|
18
|
+
import { default as default7 } from "./toArray";
|
19
|
+
import { default as default8 } from "./touchBlocker";
|
20
|
+
import {
|
21
|
+
easing,
|
22
|
+
duration,
|
23
|
+
getTransitionProps,
|
24
|
+
createTransitions
|
25
|
+
} from "./transitions";
|
26
|
+
import { default as default9 } from "./getBoundingClientRect";
|
27
|
+
export * from "./isType";
|
28
|
+
export {
|
29
|
+
default8 as blockTouch,
|
30
|
+
default3 as convertHexToRGBA,
|
31
|
+
createTransitions,
|
32
|
+
default2 as debounce,
|
33
|
+
duration,
|
34
|
+
easing,
|
35
|
+
default9 as getBoundingClientRect,
|
36
|
+
getTransitionProps,
|
37
|
+
isAlipay,
|
38
|
+
default4 as isDev,
|
39
|
+
isMini,
|
40
|
+
isMiniapp,
|
41
|
+
isWeapp,
|
42
|
+
default5 as setRef,
|
43
|
+
default6 as throttle,
|
44
|
+
default7 as toArray,
|
45
|
+
useDidMountEffect,
|
46
|
+
useDomCss,
|
47
|
+
useDomReady,
|
48
|
+
useEventCallback,
|
49
|
+
useForkRef,
|
50
|
+
useSize,
|
51
|
+
useTouch,
|
52
|
+
useTouchEmulator,
|
53
|
+
useValue
|
54
|
+
};
|
package/es/isDev.js
CHANGED
@@ -1,2 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
const isDev = process.env.NODE_ENV === "development" || process.env.NODE_ENV === "test";
|
2
|
+
var isDev_default = isDev;
|
3
|
+
export {
|
4
|
+
isDev_default as default
|
5
|
+
};
|
package/es/isMini.js
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
export var isMiniapp = function isMiniapp() {
|
1
|
+
const isMini = typeof process.env.TARO_ENV === "string";
|
2
|
+
const isWeapp = process.env.TARO_ENV === "weapp";
|
3
|
+
const isAlipay = process.env.TARO_ENV === "alipay";
|
4
|
+
const isMiniapp = () => {
|
6
5
|
return isMini;
|
7
|
-
};
|
6
|
+
};
|
7
|
+
export {
|
8
|
+
isAlipay,
|
9
|
+
isMini,
|
10
|
+
isMiniapp,
|
11
|
+
isWeapp
|
12
|
+
};
|
package/es/isType.js
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
const isFunction = (fn) => {
|
2
|
+
return fn && {}.toString.call(fn) === "[object Function]";
|
3
|
+
};
|
4
|
+
export {
|
5
|
+
isFunction
|
6
|
+
};
|
package/es/setRef.js
CHANGED
package/es/throttle.js
CHANGED
@@ -1,49 +1,31 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
_options$trailing = options.trailing,
|
11
|
-
trailing = _options$trailing === void 0 ? false : _options$trailing;
|
12
|
-
var lastTime = 0;
|
13
|
-
var timer = null;
|
14
|
-
|
15
|
-
// 2.事件触发时, 真正执行的函数
|
16
|
-
/* eslint no-underscore-dangle: 0 */
|
17
|
-
var _throttle = function _throttle() {
|
18
|
-
var _this = this;
|
19
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
20
|
-
args[_key] = arguments[_key];
|
21
|
-
}
|
22
|
-
// 2.1.获取当前事件触发时的时间
|
23
|
-
var nowTime = new Date().getTime();
|
24
|
-
if (!lastTime && !leading) lastTime = nowTime;
|
25
|
-
|
26
|
-
// 2.2.使用当前触发的时间和之前的时间间隔以及上一次开始的时间, 计算出还剩余多长事件需要去触发函数
|
27
|
-
var remainTime = interval - (nowTime - lastTime);
|
1
|
+
function throttle(fn, interval = 200, options = { leading: true, trailing: false }) {
|
2
|
+
const { leading = true, trailing = false } = options;
|
3
|
+
let lastTime = 0;
|
4
|
+
let timer = null;
|
5
|
+
const _throttle = function(...args) {
|
6
|
+
const nowTime = (/* @__PURE__ */ new Date()).getTime();
|
7
|
+
if (!lastTime && !leading)
|
8
|
+
lastTime = nowTime;
|
9
|
+
const remainTime = interval - (nowTime - lastTime);
|
28
10
|
if (remainTime <= 0) {
|
29
11
|
if (timer) {
|
30
12
|
clearTimeout(timer);
|
31
13
|
timer = null;
|
32
14
|
}
|
33
|
-
|
34
|
-
// 2.3.真正触发函数
|
35
15
|
fn.apply(this, args);
|
36
|
-
// 2.4.保留上次触发的时间
|
37
16
|
lastTime = nowTime;
|
38
17
|
return;
|
39
18
|
}
|
40
19
|
if (trailing && !timer) {
|
41
|
-
timer = setTimeout(
|
20
|
+
timer = setTimeout(() => {
|
42
21
|
timer = null;
|
43
|
-
lastTime = !leading ? 0 : new Date().getTime();
|
44
|
-
fn.apply(
|
22
|
+
lastTime = !leading ? 0 : (/* @__PURE__ */ new Date()).getTime();
|
23
|
+
fn.apply(this, args);
|
45
24
|
}, remainTime);
|
46
25
|
}
|
47
26
|
};
|
48
27
|
return _throttle;
|
49
|
-
}
|
28
|
+
}
|
29
|
+
export {
|
30
|
+
throttle as default
|
31
|
+
};
|
package/es/toArray.js
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
import React from
|
2
|
-
import { isFragment } from
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
if ((child === undefined || child === null) && !option.keepEmpty) {
|
1
|
+
import React from "react";
|
2
|
+
import { isFragment } from "react-is";
|
3
|
+
function toArray(children, option = {}) {
|
4
|
+
let ret = [];
|
5
|
+
React.Children.forEach(children, (child) => {
|
6
|
+
if ((child === void 0 || child === null) && !option.keepEmpty) {
|
8
7
|
return;
|
9
8
|
}
|
10
9
|
if (Array.isArray(child)) {
|
@@ -16,4 +15,7 @@ export default function toArray(children) {
|
|
16
15
|
}
|
17
16
|
});
|
18
17
|
return ret;
|
19
|
-
}
|
18
|
+
}
|
19
|
+
export {
|
20
|
+
toArray as default
|
21
|
+
};
|
package/es/touchBlocker.js
CHANGED
@@ -1,90 +1,87 @@
|
|
1
|
-
function
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
/**
|
8
|
-
* author: 辉宇
|
9
|
-
* 为一个DOM元素添加滑动穿透防护
|
10
|
-
* 返回一个函数,调用可解除滑动穿透防护
|
11
|
-
*
|
12
|
-
* **这里滑动穿透防护的定义为不允许root外部的元素被touch类事件滑动(overflow)**
|
13
|
-
*
|
14
|
-
* @param root: HTMLElement
|
15
|
-
* @returns {(function(): void)|*}
|
16
|
-
*/
|
17
|
-
export default function blockTouch(root) {
|
18
|
-
var lastTouch;
|
19
|
-
var moveDirection;
|
20
|
-
var moveAxis;
|
21
|
-
var onTouchStart = function onTouchStart(e) {
|
22
|
-
var _e$touches = _slicedToArray(e.touches, 1);
|
23
|
-
lastTouch = _e$touches[0];
|
1
|
+
function blockTouch(root) {
|
2
|
+
let lastTouch;
|
3
|
+
let moveDirection;
|
4
|
+
let moveAxis;
|
5
|
+
const onTouchStart = (e) => {
|
6
|
+
[lastTouch] = e.touches;
|
24
7
|
};
|
25
|
-
|
26
|
-
|
27
|
-
|
8
|
+
const shouldPrevent = (targetElement, axis, delta) => {
|
9
|
+
let el = targetElement;
|
10
|
+
let needPrevent = true;
|
28
11
|
while (el) {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
if (moveDirection === undefined) moveDirection = dir;
|
12
|
+
const { overflowY, overflowX } = window.getComputedStyle(el);
|
13
|
+
if (axis === "y" && (overflowY === "scroll" || overflowY === "auto")) {
|
14
|
+
const dir = moveDirection || delta;
|
15
|
+
if (moveDirection === void 0)
|
16
|
+
moveDirection = dir;
|
35
17
|
if (el.scrollTop !== 0 && dir < 0) {
|
36
18
|
needPrevent = false;
|
37
19
|
break;
|
38
20
|
}
|
39
|
-
// 当内部滚动元素高度有小数时,可能会出现小于号左右差1的情况导致算法失效
|
40
21
|
if (el.scrollTop + el.offsetHeight + 1 < el.scrollHeight && dir > 0) {
|
41
22
|
needPrevent = false;
|
42
23
|
break;
|
43
24
|
}
|
44
25
|
}
|
45
|
-
if (axis ===
|
46
|
-
|
47
|
-
if (moveDirection ===
|
48
|
-
|
26
|
+
if (axis === "x" && (overflowX === "scroll" || overflowX === "auto")) {
|
27
|
+
const dir = moveDirection || delta;
|
28
|
+
if (moveDirection === void 0)
|
29
|
+
moveDirection = dir;
|
30
|
+
if (el.scrollLeft !== 0 && dir < 0) {
|
49
31
|
needPrevent = false;
|
50
32
|
break;
|
51
33
|
}
|
52
|
-
if (el.scrollLeft + el.offsetWidth < el.scrollWidth &&
|
34
|
+
if (el.scrollLeft + el.offsetWidth < el.scrollWidth && dir > 0) {
|
53
35
|
needPrevent = false;
|
54
36
|
break;
|
55
37
|
}
|
56
38
|
}
|
57
|
-
if (el === root)
|
39
|
+
if (el === root)
|
40
|
+
break;
|
58
41
|
el = el.parentNode;
|
59
42
|
}
|
60
43
|
return needPrevent;
|
61
44
|
};
|
62
|
-
|
63
|
-
|
45
|
+
const onTouchMove = (e) => {
|
46
|
+
const currentTouch = e.touches[0];
|
64
47
|
if (!moveAxis) {
|
65
|
-
if (Math.abs(lastTouch.screenY - currentTouch.screenY) > Math.abs(lastTouch.screenX - currentTouch.screenX))
|
66
|
-
|
48
|
+
if (Math.abs(lastTouch.screenY - currentTouch.screenY) > Math.abs(lastTouch.screenX - currentTouch.screenX))
|
49
|
+
moveAxis = "y";
|
50
|
+
if (Math.abs(lastTouch.screenY - currentTouch.screenY) < Math.abs(lastTouch.screenX - currentTouch.screenX))
|
51
|
+
moveAxis = "x";
|
67
52
|
}
|
68
|
-
if (shouldPrevent(
|
69
|
-
|
53
|
+
if (shouldPrevent(
|
54
|
+
e.target,
|
55
|
+
moveAxis,
|
56
|
+
moveAxis === "x" ? lastTouch.screenX - currentTouch.screenX : lastTouch.screenY - currentTouch.screenY
|
57
|
+
) && !e.cancelable === false)
|
58
|
+
e.preventDefault();
|
70
59
|
};
|
71
|
-
|
72
|
-
lastTouch =
|
73
|
-
moveDirection =
|
74
|
-
moveAxis =
|
60
|
+
const onTouchEnd = () => {
|
61
|
+
lastTouch = void 0;
|
62
|
+
moveDirection = void 0;
|
63
|
+
moveAxis = void 0;
|
75
64
|
};
|
76
|
-
|
77
|
-
if (shouldPrevent(
|
78
|
-
|
65
|
+
const onScroll = (e) => {
|
66
|
+
if (shouldPrevent(
|
67
|
+
e.target,
|
68
|
+
Math.abs(e.deltaX) > Math.abs(e.deltaY) ? "x" : "y",
|
69
|
+
Math.abs(e.deltaX) > Math.abs(e.deltaY) ? e.deltaX : e.deltaY
|
70
|
+
) && !e.cancelable === false)
|
71
|
+
e.preventDefault();
|
72
|
+
moveDirection = void 0;
|
79
73
|
};
|
80
|
-
root.addEventListener(
|
81
|
-
root.addEventListener(
|
82
|
-
root.addEventListener(
|
83
|
-
root.addEventListener(
|
84
|
-
return
|
85
|
-
root.removeEventListener(
|
86
|
-
root.removeEventListener(
|
87
|
-
root.removeEventListener(
|
88
|
-
root.removeEventListener(
|
74
|
+
root.addEventListener("touchstart", onTouchStart);
|
75
|
+
root.addEventListener("touchmove", onTouchMove);
|
76
|
+
root.addEventListener("touchend", onTouchEnd);
|
77
|
+
root.addEventListener("wheel", onScroll);
|
78
|
+
return () => {
|
79
|
+
root.removeEventListener("touchstart", onTouchStart);
|
80
|
+
root.removeEventListener("touchmove", onTouchMove);
|
81
|
+
root.removeEventListener("touchend", onTouchEnd);
|
82
|
+
root.removeEventListener("wheel", onScroll);
|
89
83
|
};
|
90
|
-
}
|
84
|
+
}
|
85
|
+
export {
|
86
|
+
blockTouch as default
|
87
|
+
};
|
package/es/transitions.js
CHANGED
@@ -1,16 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
1
|
+
var __defProp = Object.defineProperty;
|
2
|
+
var __defProps = Object.defineProperties;
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
8
|
+
var __spreadValues = (a, b) => {
|
9
|
+
for (var prop in b || (b = {}))
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
12
|
+
if (__getOwnPropSymbols)
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
14
|
+
if (__propIsEnum.call(b, prop))
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
16
|
+
}
|
17
|
+
return a;
|
12
18
|
};
|
13
|
-
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
20
|
+
const easing = {
|
21
|
+
easeInOut: "cubic-bezier(0.4, 0, 0.2, 1)",
|
22
|
+
easeOut: "cubic-bezier(0.0, 0, 0.2, 1)",
|
23
|
+
easeIn: "cubic-bezier(0.4, 0, 1, 1)",
|
24
|
+
sharp: "cubic-bezier(0.4, 0, 0.6, 1)"
|
25
|
+
};
|
26
|
+
const duration = {
|
14
27
|
shortest: 150,
|
15
28
|
shorter: 200,
|
16
29
|
short: 250,
|
@@ -21,45 +34,44 @@ export var duration = {
|
|
21
34
|
enteringScreen: 225,
|
22
35
|
leavingScreen: 195
|
23
36
|
};
|
24
|
-
|
25
|
-
var
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
delay = props.delay;
|
31
|
-
var mode = options.mode;
|
32
|
-
if (mode !== 'enter' && mode !== 'exit') mode = mode === 'entering' || mode === 'entered' ? 'enter' : 'exit';
|
37
|
+
function getTransitionProps(props, options) {
|
38
|
+
var _a, _b, _c;
|
39
|
+
const { timeout, easing: easingProps, style = {}, delay } = props;
|
40
|
+
let { mode } = options;
|
41
|
+
if (mode !== "enter" && mode !== "exit")
|
42
|
+
mode = mode === "entering" || mode === "entered" ? "enter" : "exit";
|
33
43
|
return {
|
34
|
-
duration: (
|
35
|
-
easing: (
|
36
|
-
delay: (
|
44
|
+
duration: (_a = style.transitionDuration) != null ? _a : typeof timeout === "number" ? timeout : timeout[mode] || 0,
|
45
|
+
easing: (_b = style.transitionTimingFunction) != null ? _b : typeof easingProps === "object" ? easingProps[mode] : easingProps,
|
46
|
+
delay: (_c = style.transitionDelay) != null ? _c : typeof delay === "number" ? delay : delay[mode] || 0
|
37
47
|
};
|
38
48
|
}
|
39
49
|
function formatMs(milliseconds) {
|
40
|
-
return
|
50
|
+
return `${Math.round(milliseconds)}ms`;
|
41
51
|
}
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
delay = _options$delay === void 0 ? 0 : _options$delay;
|
55
|
-
return (Array.isArray(props) ? props : [props]).map(function (animatedProp) {
|
56
|
-
return "".concat(animatedProp, " ").concat(typeof durationOption === 'string' ? durationOption : formatMs(durationOption), " ").concat(easingOption, " ").concat(typeof delay === 'string' ? delay : formatMs(delay));
|
57
|
-
}).join(',');
|
52
|
+
function createTransitions(inputTransitions = {}) {
|
53
|
+
const mergedEasing = __spreadValues(__spreadValues({}, easing), inputTransitions.easing);
|
54
|
+
const mergedDuration = __spreadValues(__spreadValues({}, duration), inputTransitions.duration);
|
55
|
+
const create = (props = ["all"], options) => {
|
56
|
+
const {
|
57
|
+
duration: durationOption = mergedDuration.standard,
|
58
|
+
easing: easingOption = mergedEasing.easeInOut,
|
59
|
+
delay = 0
|
60
|
+
} = options;
|
61
|
+
return (Array.isArray(props) ? props : [props]).map(
|
62
|
+
(animatedProp) => `${animatedProp} ${typeof durationOption === "string" ? durationOption : formatMs(durationOption)} ${easingOption} ${typeof delay === "string" ? delay : formatMs(delay)}`
|
63
|
+
).join(",");
|
58
64
|
};
|
59
|
-
return
|
60
|
-
create
|
61
|
-
}, inputTransitions), {
|
65
|
+
return __spreadProps(__spreadValues({
|
66
|
+
create
|
67
|
+
}, inputTransitions), {
|
62
68
|
easing: mergedEasing,
|
63
69
|
duration: mergedDuration
|
64
70
|
});
|
65
|
-
}
|
71
|
+
}
|
72
|
+
export {
|
73
|
+
createTransitions,
|
74
|
+
duration,
|
75
|
+
easing,
|
76
|
+
getTransitionProps
|
77
|
+
};
|
package/package.json
CHANGED
@@ -1,32 +1,38 @@
|
|
1
1
|
{
|
2
2
|
"name": "@bifrostui/utils",
|
3
|
-
"version": "1.1.11-beta.
|
3
|
+
"version": "1.1.11-beta.4",
|
4
4
|
"description": "BUI React utilities for building components.",
|
5
|
-
"main": "
|
6
|
-
"module": "
|
5
|
+
"main": "src/index.ts",
|
6
|
+
"module": "src/index.ts",
|
7
7
|
"sideEffects": false,
|
8
8
|
"files": [
|
9
9
|
"es",
|
10
10
|
"dist"
|
11
11
|
],
|
12
12
|
"scripts": {
|
13
|
-
"build": "
|
13
|
+
"build": "node esbuild.config.js",
|
14
14
|
"test": "echo \"Error: run tests from root\" && exit 1"
|
15
15
|
},
|
16
16
|
"devDependencies": {
|
17
|
-
"
|
17
|
+
"esbuild": "^0.19.7",
|
18
|
+
"esbuild-plugin-less": "1.3.10",
|
19
|
+
"fs-extra": "^11.2.0",
|
20
|
+
"glob": "11.0.0"
|
18
21
|
},
|
19
22
|
"dependencies": {
|
20
23
|
"react-is": "^18.0.0"
|
21
24
|
},
|
22
25
|
"peerDependencies": {
|
23
|
-
"@tarojs/
|
26
|
+
"@tarojs/runtime": "^3.0.0",
|
27
|
+
"@tarojs/taro": "^3.0.0",
|
24
28
|
"react": "^17.0.0 || ^18.0.0"
|
25
29
|
},
|
26
30
|
"license": "MIT",
|
27
31
|
"publishConfig": {
|
32
|
+
"main": "dist/index.js",
|
33
|
+
"module": "es/index.js",
|
28
34
|
"access": "public",
|
29
35
|
"registry": "https://registry.npmjs.org/"
|
30
36
|
},
|
31
|
-
"gitHead": "
|
37
|
+
"gitHead": "efd0ef8c98be4e4e566b2518777b884a4eb75aa6"
|
32
38
|
}
|
package/src/index.ts
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
export { default as debounce } from './debounce';
|
2
|
+
export { default as convertHexToRGBA } from './hex2rgba';
|
3
|
+
export {
|
4
|
+
useDidMountEffect,
|
5
|
+
useEventCallback,
|
6
|
+
useForkRef,
|
7
|
+
useTouchEmulator,
|
8
|
+
useValue,
|
9
|
+
useDomReady,
|
10
|
+
useSize,
|
11
|
+
useDomCss,
|
12
|
+
useTouch,
|
13
|
+
} from './hooks';
|
14
|
+
export { default as isDev } from './isDev';
|
15
|
+
export { isMini, isWeapp, isAlipay, isMiniapp } from './isMini';
|
16
|
+
export { default as setRef } from './setRef';
|
17
|
+
export { default as throttle } from './throttle';
|
18
|
+
export { default as toArray } from './toArray';
|
19
|
+
export { default as blockTouch } from './touchBlocker';
|
20
|
+
export {
|
21
|
+
easing,
|
22
|
+
duration,
|
23
|
+
getTransitionProps,
|
24
|
+
createTransitions,
|
25
|
+
} from './transitions';
|
26
|
+
export { default as getBoundingClientRect } from './getBoundingClientRect';
|
27
|
+
export * from './isType';
|