@ray-js/framework-shared 0.5.4 → 0.5.6-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.
- package/package.json +6 -6
- package/lib/emitter/index.android.js +0 -1
- package/lib/emitter/index.ios.js +0 -1
- package/lib/emitter/index.tuya.js +0 -57
- package/lib/emitter/index.web.js +0 -57
- package/lib/emitter/index.wechat.js +0 -57
- package/lib/filterProps/index.android.js +0 -1
- package/lib/filterProps/index.ios.js +0 -1
- package/lib/filterProps/index.tuya.js +0 -30
- package/lib/filterProps/index.web.js +0 -30
- package/lib/filterProps/index.wechat.js +0 -30
- package/lib/index.android.js +0 -1
- package/lib/index.ios.js +0 -1
- package/lib/index.tuya.js +0 -9
- package/lib/index.web.js +0 -9
- package/lib/index.wechat.js +0 -9
- package/lib/inlineStyle/CSSProperty.android.js +0 -1
- package/lib/inlineStyle/CSSProperty.ios.js +0 -1
- package/lib/inlineStyle/CSSProperty.tuya.js +0 -78
- package/lib/inlineStyle/CSSProperty.web.js +0 -78
- package/lib/inlineStyle/CSSProperty.wechat.js +0 -78
- package/lib/inlineStyle/index.android.js +0 -1
- package/lib/inlineStyle/index.ios.js +0 -1
- package/lib/inlineStyle/index.tuya.js +0 -49
- package/lib/inlineStyle/index.web.js +0 -49
- package/lib/inlineStyle/index.wechat.js +0 -49
- package/lib/plainStyle/index.android.js +0 -1
- package/lib/plainStyle/index.ios.js +0 -1
- package/lib/plainStyle/index.tuya.js +0 -52
- package/lib/plainStyle/index.web.js +0 -52
- package/lib/plainStyle/index.wechat.js +0 -52
- package/lib/useInterval/index.android.js +0 -1
- package/lib/useInterval/index.ios.js +0 -1
- package/lib/useInterval/index.tuya.js +0 -24
- package/lib/useInterval/index.web.js +0 -24
- package/lib/useInterval/index.wechat.js +0 -24
- package/lib/useStylesheet/index.android.js +0 -1
- package/lib/useStylesheet/index.ios.js +0 -1
- package/lib/useStylesheet/index.tuya.js +0 -24
- package/lib/useStylesheet/index.web.js +0 -24
- package/lib/useStylesheet/index.wechat.js +0 -24
- package/lib/useThrottle/index.android.js +0 -1
- package/lib/useThrottle/index.ios.js +0 -1
- package/lib/useThrottle/index.tuya.js +0 -36
- package/lib/useThrottle/index.web.js +0 -36
- package/lib/useThrottle/index.wechat.js +0 -36
- package/lib/useTouch/index.android.js +0 -1
- package/lib/useTouch/index.ios.js +0 -1
- package/lib/useTouch/index.tuya.js +0 -144
- package/lib/useTouch/index.web.js +0 -156
- package/lib/useTouch/index.wechat.js +0 -144
- package/lib/useTransition/index.android.js +0 -1
- package/lib/useTransition/index.ios.js +0 -1
- package/lib/useTransition/index.tuya.js +0 -53
- package/lib/useTransition/index.web.js +0 -53
- package/lib/useTransition/index.wechat.js +0 -53
@@ -1,144 +0,0 @@
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["hoverDuration", "hoverDelay"];
|
5
|
-
import "core-js/modules/es.array.filter.js";
|
6
|
-
import "core-js/modules/es.object.to-string.js";
|
7
|
-
import "core-js/modules/es.array.map.js";
|
8
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
9
|
-
import "core-js/modules/es.array.reduce.js";
|
10
|
-
import "core-js/modules/es.object.keys.js";
|
11
|
-
import * as React from 'react';
|
12
|
-
var isMiniProgram = true;
|
13
|
-
var isWechat = false;
|
14
|
-
var isWeb = false;
|
15
|
-
var LONG_TAP_DURATION = 350;
|
16
|
-
export function useTouch(_ref) {
|
17
|
-
var hoverDuration = _ref.hoverDuration,
|
18
|
-
hoverDelay = _ref.hoverDelay,
|
19
|
-
handles = _objectWithoutProperties(_ref, _excluded);
|
20
|
-
|
21
|
-
var _React$useState = React.useState(false),
|
22
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
23
|
-
touching = _React$useState2[0],
|
24
|
-
setTouching = _React$useState2[1];
|
25
|
-
|
26
|
-
var hoveringRef = React.useRef(false);
|
27
|
-
var timers = React.useRef([]);
|
28
|
-
|
29
|
-
function executeTimeout(callback, time) {
|
30
|
-
var timer = setTimeout(function () {
|
31
|
-
callback();
|
32
|
-
timers.current.filter(function (t) {
|
33
|
-
return t !== timer;
|
34
|
-
});
|
35
|
-
}, time);
|
36
|
-
timers.current.push(timer);
|
37
|
-
}
|
38
|
-
|
39
|
-
function formatTouches(touchs) {
|
40
|
-
if (Array.isArray(touchs)) {
|
41
|
-
return touchs && touchs.map(function (item) {
|
42
|
-
return {
|
43
|
-
identifier: item.identifier,
|
44
|
-
pageX: item.pageX,
|
45
|
-
pageY: item.pageY
|
46
|
-
};
|
47
|
-
});
|
48
|
-
} else {
|
49
|
-
return [_objectSpread({}, touchs)];
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
function formatRayEvent(e, touchType) {
|
54
|
-
return {
|
55
|
-
type: (e === null || e === void 0 ? void 0 : e.type) || touchType || '',
|
56
|
-
touches: formatTouches(e.touches),
|
57
|
-
changedTouches: formatTouches(e.changedTouches),
|
58
|
-
timeStamp: e.timeStamp || e.timestamp,
|
59
|
-
origin: e
|
60
|
-
};
|
61
|
-
}
|
62
|
-
|
63
|
-
function formatRayClickEvent(e, clickType) {
|
64
|
-
return {
|
65
|
-
type: (e === null || e === void 0 ? void 0 : e.type) || clickType || '',
|
66
|
-
timeStamp: e.timeStamp,
|
67
|
-
pageX: e.pageX,
|
68
|
-
pageY: e.pageY,
|
69
|
-
origin: e
|
70
|
-
};
|
71
|
-
}
|
72
|
-
|
73
|
-
React.useEffect(function () {
|
74
|
-
return function () {
|
75
|
-
timers.current.forEach(function (t) {
|
76
|
-
return clearTimeout(t);
|
77
|
-
});
|
78
|
-
};
|
79
|
-
}, []);
|
80
|
-
var processedHandles = {
|
81
|
-
onTouchStart: function (e) {
|
82
|
-
var _handles$onTouchStart;
|
83
|
-
|
84
|
-
hoveringRef.current = true;
|
85
|
-
executeTimeout(function () {
|
86
|
-
if (hoveringRef.current) {
|
87
|
-
setTouching(true);
|
88
|
-
}
|
89
|
-
}, hoverDelay);
|
90
|
-
return (_handles$onTouchStart = handles.onTouchStart) === null || _handles$onTouchStart === void 0 ? void 0 : _handles$onTouchStart.call(handles, formatRayEvent(e, 'touchstart'));
|
91
|
-
},
|
92
|
-
onTouchMove: function (e) {
|
93
|
-
var _handles$onTouchMove;
|
94
|
-
|
95
|
-
hoveringRef.current = false;
|
96
|
-
executeTimeout(function () {
|
97
|
-
if (touching) {
|
98
|
-
setTouching(false);
|
99
|
-
}
|
100
|
-
}, hoverDuration);
|
101
|
-
return (_handles$onTouchMove = handles.onTouchMove) === null || _handles$onTouchMove === void 0 ? void 0 : _handles$onTouchMove.call(handles, formatRayEvent(e, 'touchmove'));
|
102
|
-
},
|
103
|
-
onTouchEnd: function (e) {
|
104
|
-
var _handles$onTouchEnd;
|
105
|
-
|
106
|
-
hoveringRef.current = false;
|
107
|
-
executeTimeout(function () {
|
108
|
-
if (touching) {
|
109
|
-
setTouching(false);
|
110
|
-
}
|
111
|
-
}, hoverDuration);
|
112
|
-
return (_handles$onTouchEnd = handles.onTouchEnd) === null || _handles$onTouchEnd === void 0 ? void 0 : _handles$onTouchEnd.call(handles, formatRayEvent(e, 'touchend'));
|
113
|
-
},
|
114
|
-
onTouchCancel: function (e) {
|
115
|
-
var _handles$onTouchCance;
|
116
|
-
|
117
|
-
hoveringRef.current = false;
|
118
|
-
executeTimeout(function () {
|
119
|
-
if (touching) {
|
120
|
-
setTouching(false);
|
121
|
-
}
|
122
|
-
}, hoverDuration);
|
123
|
-
return (_handles$onTouchCance = handles.onTouchCancel) === null || _handles$onTouchCance === void 0 ? void 0 : _handles$onTouchCance.call(handles, formatRayEvent(e, 'touchcancel'));
|
124
|
-
},
|
125
|
-
onClick: function (e) {
|
126
|
-
var _handles$onClick;
|
127
|
-
|
128
|
-
return (_handles$onClick = handles.onClick) === null || _handles$onClick === void 0 ? void 0 : _handles$onClick.call(handles, formatRayClickEvent(e, 'click'));
|
129
|
-
},
|
130
|
-
onLongClick: function (e) {
|
131
|
-
var _handles$onLongClick;
|
132
|
-
|
133
|
-
return (_handles$onLongClick = handles.onLongClick) === null || _handles$onLongClick === void 0 ? void 0 : _handles$onLongClick.call(handles, formatRayClickEvent(e, 'longclick'));
|
134
|
-
}
|
135
|
-
};
|
136
|
-
var finalRes = Object.keys(processedHandles).reduce(function (o, k) {
|
137
|
-
if (handles[k]) {
|
138
|
-
o[k] = processedHandles[k];
|
139
|
-
}
|
140
|
-
|
141
|
-
return o;
|
142
|
-
}, {});
|
143
|
-
return [touching, finalRes];
|
144
|
-
}
|
@@ -1,156 +0,0 @@
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["hoverDuration", "hoverDelay"];
|
5
|
-
import "core-js/modules/es.array.filter.js";
|
6
|
-
import "core-js/modules/es.object.to-string.js";
|
7
|
-
import "core-js/modules/es.array.map.js";
|
8
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
9
|
-
import "core-js/modules/es.array.reduce.js";
|
10
|
-
import "core-js/modules/es.object.keys.js";
|
11
|
-
import * as React from 'react';
|
12
|
-
var isMiniProgram = false;
|
13
|
-
var isWechat = false;
|
14
|
-
var isWeb = true;
|
15
|
-
var LONG_TAP_DURATION = 350;
|
16
|
-
export function useTouch(_ref) {
|
17
|
-
var hoverDuration = _ref.hoverDuration,
|
18
|
-
hoverDelay = _ref.hoverDelay,
|
19
|
-
handles = _objectWithoutProperties(_ref, _excluded);
|
20
|
-
|
21
|
-
var _React$useState = React.useState(false),
|
22
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
23
|
-
touching = _React$useState2[0],
|
24
|
-
setTouching = _React$useState2[1];
|
25
|
-
|
26
|
-
var hoveringRef = React.useRef(false);
|
27
|
-
var timers = React.useRef([]);
|
28
|
-
|
29
|
-
function executeTimeout(callback, time) {
|
30
|
-
var timer = setTimeout(function () {
|
31
|
-
callback();
|
32
|
-
timers.current.filter(function (t) {
|
33
|
-
return t !== timer;
|
34
|
-
});
|
35
|
-
}, time);
|
36
|
-
timers.current.push(timer);
|
37
|
-
}
|
38
|
-
|
39
|
-
function formatTouches(touchs) {
|
40
|
-
if (Array.isArray(touchs)) {
|
41
|
-
return touchs && touchs.map(function (item) {
|
42
|
-
return {
|
43
|
-
identifier: item.identifier,
|
44
|
-
pageX: item.pageX,
|
45
|
-
pageY: item.pageY
|
46
|
-
};
|
47
|
-
});
|
48
|
-
} else {
|
49
|
-
return [_objectSpread({}, touchs)];
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
function formatRayEvent(e, touchType) {
|
54
|
-
return {
|
55
|
-
type: (e === null || e === void 0 ? void 0 : e.type) || touchType || '',
|
56
|
-
touches: formatTouches(e.touches),
|
57
|
-
changedTouches: formatTouches(e.changedTouches),
|
58
|
-
timeStamp: e.timeStamp || e.timestamp,
|
59
|
-
origin: e
|
60
|
-
};
|
61
|
-
}
|
62
|
-
|
63
|
-
function formatRayClickEvent(e, clickType) {
|
64
|
-
return {
|
65
|
-
type: (e === null || e === void 0 ? void 0 : e.type) || clickType || '',
|
66
|
-
timeStamp: e.timeStamp,
|
67
|
-
pageX: e.pageX,
|
68
|
-
pageY: e.pageY,
|
69
|
-
origin: e
|
70
|
-
};
|
71
|
-
}
|
72
|
-
|
73
|
-
React.useEffect(function () {
|
74
|
-
return function () {
|
75
|
-
timers.current.forEach(function (t) {
|
76
|
-
return clearTimeout(t);
|
77
|
-
});
|
78
|
-
};
|
79
|
-
}, []);
|
80
|
-
|
81
|
-
function onLongClick(e) {
|
82
|
-
var _handles$onLongClick;
|
83
|
-
|
84
|
-
return (_handles$onLongClick = handles.onLongClick) === null || _handles$onLongClick === void 0 ? void 0 : _handles$onLongClick.call(handles, formatRayClickEvent(e, 'longclick'));
|
85
|
-
}
|
86
|
-
|
87
|
-
var processedHandles = {
|
88
|
-
onTouchStart: function (e) {
|
89
|
-
var _handles$onTouchStart;
|
90
|
-
|
91
|
-
hoveringRef.current = true;
|
92
|
-
executeTimeout(function () {
|
93
|
-
if (hoveringRef.current) {
|
94
|
-
setTouching(true);
|
95
|
-
}
|
96
|
-
}, hoverDelay);
|
97
|
-
|
98
|
-
if (typeof handles.onLongClick === 'function') {
|
99
|
-
executeTimeout(function () {
|
100
|
-
if (hoveringRef.current) {
|
101
|
-
onLongClick(e);
|
102
|
-
}
|
103
|
-
}, LONG_TAP_DURATION);
|
104
|
-
}
|
105
|
-
|
106
|
-
return (_handles$onTouchStart = handles.onTouchStart) === null || _handles$onTouchStart === void 0 ? void 0 : _handles$onTouchStart.call(handles, formatRayEvent(e, 'touchstart'));
|
107
|
-
},
|
108
|
-
onTouchMove: function (e) {
|
109
|
-
var _handles$onTouchMove;
|
110
|
-
|
111
|
-
hoveringRef.current = false;
|
112
|
-
executeTimeout(function () {
|
113
|
-
if (touching) {
|
114
|
-
setTouching(false);
|
115
|
-
}
|
116
|
-
}, hoverDuration);
|
117
|
-
return (_handles$onTouchMove = handles.onTouchMove) === null || _handles$onTouchMove === void 0 ? void 0 : _handles$onTouchMove.call(handles, formatRayEvent(e, 'touchmove'));
|
118
|
-
},
|
119
|
-
onTouchEnd: function (e) {
|
120
|
-
var _handles$onTouchEnd;
|
121
|
-
|
122
|
-
hoveringRef.current = false;
|
123
|
-
executeTimeout(function () {
|
124
|
-
if (touching) {
|
125
|
-
setTouching(false);
|
126
|
-
}
|
127
|
-
}, hoverDuration);
|
128
|
-
return (_handles$onTouchEnd = handles.onTouchEnd) === null || _handles$onTouchEnd === void 0 ? void 0 : _handles$onTouchEnd.call(handles, formatRayEvent(e, 'touchend'));
|
129
|
-
},
|
130
|
-
onTouchCancel: function (e) {
|
131
|
-
var _handles$onTouchCance;
|
132
|
-
|
133
|
-
hoveringRef.current = false;
|
134
|
-
executeTimeout(function () {
|
135
|
-
if (touching) {
|
136
|
-
setTouching(false);
|
137
|
-
}
|
138
|
-
}, hoverDuration);
|
139
|
-
return (_handles$onTouchCance = handles.onTouchCancel) === null || _handles$onTouchCance === void 0 ? void 0 : _handles$onTouchCance.call(handles, formatRayEvent(e, 'touchcancel'));
|
140
|
-
},
|
141
|
-
onClick: function (e) {
|
142
|
-
var _handles$onClick;
|
143
|
-
|
144
|
-
return (_handles$onClick = handles.onClick) === null || _handles$onClick === void 0 ? void 0 : _handles$onClick.call(handles, formatRayClickEvent(e, 'click'));
|
145
|
-
},
|
146
|
-
onLongClick: onLongClick
|
147
|
-
};
|
148
|
-
var finalRes = Object.keys(processedHandles).reduce(function (o, k) {
|
149
|
-
if (handles[k]) {
|
150
|
-
o[k] = processedHandles[k];
|
151
|
-
}
|
152
|
-
|
153
|
-
return o;
|
154
|
-
}, {});
|
155
|
-
return [touching, finalRes];
|
156
|
-
}
|
@@ -1,144 +0,0 @@
|
|
1
|
-
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
3
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
4
|
-
var _excluded = ["hoverDuration", "hoverDelay"];
|
5
|
-
import "core-js/modules/es.array.filter.js";
|
6
|
-
import "core-js/modules/es.object.to-string.js";
|
7
|
-
import "core-js/modules/es.array.map.js";
|
8
|
-
import "core-js/modules/web.dom-collections.for-each.js";
|
9
|
-
import "core-js/modules/es.array.reduce.js";
|
10
|
-
import "core-js/modules/es.object.keys.js";
|
11
|
-
import * as React from 'react';
|
12
|
-
var isMiniProgram = true;
|
13
|
-
var isWechat = true;
|
14
|
-
var isWeb = false;
|
15
|
-
var LONG_TAP_DURATION = 350;
|
16
|
-
export function useTouch(_ref) {
|
17
|
-
var hoverDuration = _ref.hoverDuration,
|
18
|
-
hoverDelay = _ref.hoverDelay,
|
19
|
-
handles = _objectWithoutProperties(_ref, _excluded);
|
20
|
-
|
21
|
-
var _React$useState = React.useState(false),
|
22
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
23
|
-
touching = _React$useState2[0],
|
24
|
-
setTouching = _React$useState2[1];
|
25
|
-
|
26
|
-
var hoveringRef = React.useRef(false);
|
27
|
-
var timers = React.useRef([]);
|
28
|
-
|
29
|
-
function executeTimeout(callback, time) {
|
30
|
-
var timer = setTimeout(function () {
|
31
|
-
callback();
|
32
|
-
timers.current.filter(function (t) {
|
33
|
-
return t !== timer;
|
34
|
-
});
|
35
|
-
}, time);
|
36
|
-
timers.current.push(timer);
|
37
|
-
}
|
38
|
-
|
39
|
-
function formatTouches(touchs) {
|
40
|
-
if (Array.isArray(touchs)) {
|
41
|
-
return touchs && touchs.map(function (item) {
|
42
|
-
return {
|
43
|
-
identifier: item.identifier,
|
44
|
-
pageX: item.pageX,
|
45
|
-
pageY: item.pageY
|
46
|
-
};
|
47
|
-
});
|
48
|
-
} else {
|
49
|
-
return [_objectSpread({}, touchs)];
|
50
|
-
}
|
51
|
-
}
|
52
|
-
|
53
|
-
function formatRayEvent(e, touchType) {
|
54
|
-
return {
|
55
|
-
type: (e === null || e === void 0 ? void 0 : e.type) || touchType || '',
|
56
|
-
touches: formatTouches(e.touches),
|
57
|
-
changedTouches: formatTouches(e.changedTouches),
|
58
|
-
timeStamp: e.timeStamp || e.timestamp,
|
59
|
-
origin: e
|
60
|
-
};
|
61
|
-
}
|
62
|
-
|
63
|
-
function formatRayClickEvent(e, clickType) {
|
64
|
-
return {
|
65
|
-
type: (e === null || e === void 0 ? void 0 : e.type) || clickType || '',
|
66
|
-
timeStamp: e.timeStamp,
|
67
|
-
pageX: e.pageX,
|
68
|
-
pageY: e.pageY,
|
69
|
-
origin: e
|
70
|
-
};
|
71
|
-
}
|
72
|
-
|
73
|
-
React.useEffect(function () {
|
74
|
-
return function () {
|
75
|
-
timers.current.forEach(function (t) {
|
76
|
-
return clearTimeout(t);
|
77
|
-
});
|
78
|
-
};
|
79
|
-
}, []);
|
80
|
-
var processedHandles = {
|
81
|
-
onTouchStart: function (e) {
|
82
|
-
var _handles$onTouchStart;
|
83
|
-
|
84
|
-
hoveringRef.current = true;
|
85
|
-
executeTimeout(function () {
|
86
|
-
if (hoveringRef.current) {
|
87
|
-
setTouching(true);
|
88
|
-
}
|
89
|
-
}, hoverDelay);
|
90
|
-
return (_handles$onTouchStart = handles.onTouchStart) === null || _handles$onTouchStart === void 0 ? void 0 : _handles$onTouchStart.call(handles, formatRayEvent(e, 'touchstart'));
|
91
|
-
},
|
92
|
-
onTouchMove: function (e) {
|
93
|
-
var _handles$onTouchMove;
|
94
|
-
|
95
|
-
hoveringRef.current = false;
|
96
|
-
executeTimeout(function () {
|
97
|
-
if (touching) {
|
98
|
-
setTouching(false);
|
99
|
-
}
|
100
|
-
}, hoverDuration);
|
101
|
-
return (_handles$onTouchMove = handles.onTouchMove) === null || _handles$onTouchMove === void 0 ? void 0 : _handles$onTouchMove.call(handles, formatRayEvent(e, 'touchmove'));
|
102
|
-
},
|
103
|
-
onTouchEnd: function (e) {
|
104
|
-
var _handles$onTouchEnd;
|
105
|
-
|
106
|
-
hoveringRef.current = false;
|
107
|
-
executeTimeout(function () {
|
108
|
-
if (touching) {
|
109
|
-
setTouching(false);
|
110
|
-
}
|
111
|
-
}, hoverDuration);
|
112
|
-
return (_handles$onTouchEnd = handles.onTouchEnd) === null || _handles$onTouchEnd === void 0 ? void 0 : _handles$onTouchEnd.call(handles, formatRayEvent(e, 'touchend'));
|
113
|
-
},
|
114
|
-
onTouchCancel: function (e) {
|
115
|
-
var _handles$onTouchCance;
|
116
|
-
|
117
|
-
hoveringRef.current = false;
|
118
|
-
executeTimeout(function () {
|
119
|
-
if (touching) {
|
120
|
-
setTouching(false);
|
121
|
-
}
|
122
|
-
}, hoverDuration);
|
123
|
-
return (_handles$onTouchCance = handles.onTouchCancel) === null || _handles$onTouchCance === void 0 ? void 0 : _handles$onTouchCance.call(handles, formatRayEvent(e, 'touchcancel'));
|
124
|
-
},
|
125
|
-
onClick: function (e) {
|
126
|
-
var _handles$onClick;
|
127
|
-
|
128
|
-
return (_handles$onClick = handles.onClick) === null || _handles$onClick === void 0 ? void 0 : _handles$onClick.call(handles, formatRayClickEvent(e, 'click'));
|
129
|
-
},
|
130
|
-
onLongClick: function (e) {
|
131
|
-
var _handles$onLongClick;
|
132
|
-
|
133
|
-
return (_handles$onLongClick = handles.onLongClick) === null || _handles$onLongClick === void 0 ? void 0 : _handles$onLongClick.call(handles, formatRayClickEvent(e, 'longclick'));
|
134
|
-
}
|
135
|
-
};
|
136
|
-
var finalRes = Object.keys(processedHandles).reduce(function (o, k) {
|
137
|
-
if (handles[k]) {
|
138
|
-
o[k] = processedHandles[k];
|
139
|
-
}
|
140
|
-
|
141
|
-
return o;
|
142
|
-
}, {});
|
143
|
-
return [touching, finalRes];
|
144
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useTransition=useTransition;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var nextFrame=function(){var duration=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1000/30;return new Promise(function(resolve){return setTimeout(resolve,duration);});};function useTransition(options,deps){var _options$duration=options.duration,duration=_options$duration===void 0?200:_options$duration,onFinish=options.onFinish,onStart=options.onStart;var _deps=(0,_slicedToArray2.default)(deps,1),_deps$=_deps[0],visible=_deps$===void 0?false:_deps$;var showRef=(0,_react.useRef)(visible);var _useState=(0,_react.useState)(visible?'showComplete':'hideComplete'),_useState2=(0,_slicedToArray2.default)(_useState,2),status=_useState2[0],setStatus=_useState2[1];function updateShow(show){if(showRef.current===show)return false;showRef.current=show;onStart===null||onStart===void 0?void 0:onStart(showRef.current);setStatus(showRef.current?'showStart':'hideStart');nextFrame(duration).then(function(){setStatus(showRef.current?'showComplete':'hideComplete');onFinish===null||onFinish===void 0?void 0:onFinish(showRef.current);});}(0,_react.useEffect)(function(){updateShow(visible);},[visible]);return[status,{animationDuration:duration/1000+"s"},updateShow];}
|
@@ -1 +0,0 @@
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useTransition=useTransition;var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var nextFrame=function(){var duration=arguments.length>0&&arguments[0]!==undefined?arguments[0]:1000/30;return new Promise(function(resolve){return setTimeout(resolve,duration);});};function useTransition(options,deps){var _options$duration=options.duration,duration=_options$duration===void 0?200:_options$duration,onFinish=options.onFinish,onStart=options.onStart;var _deps=(0,_slicedToArray2.default)(deps,1),_deps$=_deps[0],visible=_deps$===void 0?false:_deps$;var showRef=(0,_react.useRef)(visible);var _useState=(0,_react.useState)(visible?'showComplete':'hideComplete'),_useState2=(0,_slicedToArray2.default)(_useState,2),status=_useState2[0],setStatus=_useState2[1];function updateShow(show){if(showRef.current===show)return false;showRef.current=show;onStart===null||onStart===void 0?void 0:onStart(showRef.current);setStatus(showRef.current?'showStart':'hideStart');nextFrame(duration).then(function(){setStatus(showRef.current?'showComplete':'hideComplete');onFinish===null||onFinish===void 0?void 0:onFinish(showRef.current);});}(0,_react.useEffect)(function(){updateShow(visible);},[visible]);return[status,{animationDuration:duration/1000+"s"},updateShow];}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
import "core-js/modules/es.object.to-string.js";
|
3
|
-
import "core-js/modules/es.promise.js";
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
5
|
-
|
6
|
-
var nextFrame = function () {
|
7
|
-
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000 / 30;
|
8
|
-
return new Promise(function (resolve) {
|
9
|
-
return setTimeout(resolve, duration);
|
10
|
-
});
|
11
|
-
};
|
12
|
-
/**
|
13
|
-
* 用于执行动画的时序管理
|
14
|
-
* @param options transition 选项
|
15
|
-
* @param visible 是否可见
|
16
|
-
*/
|
17
|
-
|
18
|
-
|
19
|
-
export function useTransition(options, deps) {
|
20
|
-
var _options$duration = options.duration,
|
21
|
-
duration = _options$duration === void 0 ? 200 : _options$duration,
|
22
|
-
onFinish = options.onFinish,
|
23
|
-
onStart = options.onStart;
|
24
|
-
|
25
|
-
var _deps = _slicedToArray(deps, 1),
|
26
|
-
_deps$ = _deps[0],
|
27
|
-
visible = _deps$ === void 0 ? false : _deps$;
|
28
|
-
|
29
|
-
var showRef = useRef(visible);
|
30
|
-
|
31
|
-
var _useState = useState(visible ? 'showComplete' : 'hideComplete'),
|
32
|
-
_useState2 = _slicedToArray(_useState, 2),
|
33
|
-
status = _useState2[0],
|
34
|
-
setStatus = _useState2[1];
|
35
|
-
|
36
|
-
function updateShow(show) {
|
37
|
-
if (showRef.current === show) return false;
|
38
|
-
showRef.current = show;
|
39
|
-
onStart === null || onStart === void 0 ? void 0 : onStart(showRef.current);
|
40
|
-
setStatus(showRef.current ? 'showStart' : 'hideStart');
|
41
|
-
nextFrame(duration).then(function () {
|
42
|
-
setStatus(showRef.current ? 'showComplete' : 'hideComplete');
|
43
|
-
onFinish === null || onFinish === void 0 ? void 0 : onFinish(showRef.current);
|
44
|
-
});
|
45
|
-
}
|
46
|
-
|
47
|
-
useEffect(function () {
|
48
|
-
updateShow(visible);
|
49
|
-
}, [visible]);
|
50
|
-
return [status, {
|
51
|
-
animationDuration: "".concat(duration / 1000, "s")
|
52
|
-
}, updateShow];
|
53
|
-
}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
import "core-js/modules/es.object.to-string.js";
|
3
|
-
import "core-js/modules/es.promise.js";
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
5
|
-
|
6
|
-
var nextFrame = function () {
|
7
|
-
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000 / 30;
|
8
|
-
return new Promise(function (resolve) {
|
9
|
-
return setTimeout(resolve, duration);
|
10
|
-
});
|
11
|
-
};
|
12
|
-
/**
|
13
|
-
* 用于执行动画的时序管理
|
14
|
-
* @param options transition 选项
|
15
|
-
* @param visible 是否可见
|
16
|
-
*/
|
17
|
-
|
18
|
-
|
19
|
-
export function useTransition(options, deps) {
|
20
|
-
var _options$duration = options.duration,
|
21
|
-
duration = _options$duration === void 0 ? 200 : _options$duration,
|
22
|
-
onFinish = options.onFinish,
|
23
|
-
onStart = options.onStart;
|
24
|
-
|
25
|
-
var _deps = _slicedToArray(deps, 1),
|
26
|
-
_deps$ = _deps[0],
|
27
|
-
visible = _deps$ === void 0 ? false : _deps$;
|
28
|
-
|
29
|
-
var showRef = useRef(visible);
|
30
|
-
|
31
|
-
var _useState = useState(visible ? 'showComplete' : 'hideComplete'),
|
32
|
-
_useState2 = _slicedToArray(_useState, 2),
|
33
|
-
status = _useState2[0],
|
34
|
-
setStatus = _useState2[1];
|
35
|
-
|
36
|
-
function updateShow(show) {
|
37
|
-
if (showRef.current === show) return false;
|
38
|
-
showRef.current = show;
|
39
|
-
onStart === null || onStart === void 0 ? void 0 : onStart(showRef.current);
|
40
|
-
setStatus(showRef.current ? 'showStart' : 'hideStart');
|
41
|
-
nextFrame(duration).then(function () {
|
42
|
-
setStatus(showRef.current ? 'showComplete' : 'hideComplete');
|
43
|
-
onFinish === null || onFinish === void 0 ? void 0 : onFinish(showRef.current);
|
44
|
-
});
|
45
|
-
}
|
46
|
-
|
47
|
-
useEffect(function () {
|
48
|
-
updateShow(visible);
|
49
|
-
}, [visible]);
|
50
|
-
return [status, {
|
51
|
-
animationDuration: "".concat(duration / 1000, "s")
|
52
|
-
}, updateShow];
|
53
|
-
}
|
@@ -1,53 +0,0 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
|
-
import "core-js/modules/es.object.to-string.js";
|
3
|
-
import "core-js/modules/es.promise.js";
|
4
|
-
import { useEffect, useRef, useState } from 'react';
|
5
|
-
|
6
|
-
var nextFrame = function () {
|
7
|
-
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1000 / 30;
|
8
|
-
return new Promise(function (resolve) {
|
9
|
-
return setTimeout(resolve, duration);
|
10
|
-
});
|
11
|
-
};
|
12
|
-
/**
|
13
|
-
* 用于执行动画的时序管理
|
14
|
-
* @param options transition 选项
|
15
|
-
* @param visible 是否可见
|
16
|
-
*/
|
17
|
-
|
18
|
-
|
19
|
-
export function useTransition(options, deps) {
|
20
|
-
var _options$duration = options.duration,
|
21
|
-
duration = _options$duration === void 0 ? 200 : _options$duration,
|
22
|
-
onFinish = options.onFinish,
|
23
|
-
onStart = options.onStart;
|
24
|
-
|
25
|
-
var _deps = _slicedToArray(deps, 1),
|
26
|
-
_deps$ = _deps[0],
|
27
|
-
visible = _deps$ === void 0 ? false : _deps$;
|
28
|
-
|
29
|
-
var showRef = useRef(visible);
|
30
|
-
|
31
|
-
var _useState = useState(visible ? 'showComplete' : 'hideComplete'),
|
32
|
-
_useState2 = _slicedToArray(_useState, 2),
|
33
|
-
status = _useState2[0],
|
34
|
-
setStatus = _useState2[1];
|
35
|
-
|
36
|
-
function updateShow(show) {
|
37
|
-
if (showRef.current === show) return false;
|
38
|
-
showRef.current = show;
|
39
|
-
onStart === null || onStart === void 0 ? void 0 : onStart(showRef.current);
|
40
|
-
setStatus(showRef.current ? 'showStart' : 'hideStart');
|
41
|
-
nextFrame(duration).then(function () {
|
42
|
-
setStatus(showRef.current ? 'showComplete' : 'hideComplete');
|
43
|
-
onFinish === null || onFinish === void 0 ? void 0 : onFinish(showRef.current);
|
44
|
-
});
|
45
|
-
}
|
46
|
-
|
47
|
-
useEffect(function () {
|
48
|
-
updateShow(visible);
|
49
|
-
}, [visible]);
|
50
|
-
return [status, {
|
51
|
-
animationDuration: "".concat(duration / 1000, "s")
|
52
|
-
}, updateShow];
|
53
|
-
}
|