@mpxjs/webpack-plugin 2.10.14 → 2.10.15-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/lib/runtime/components/react/dist/mpx-movable-view.jsx +16 -9
- package/lib/runtime/components/react/dist/mpx-scroll-view.jsx +13 -6
- package/lib/runtime/components/react/dist/mpx-swiper.jsx +32 -34
- package/lib/runtime/components/react/mpx-movable-view.tsx +17 -11
- package/lib/runtime/components/react/mpx-scroll-view.tsx +15 -6
- package/lib/runtime/components/react/mpx-swiper.tsx +32 -32
- package/package.json +2 -2
- package/LICENSE +0 -433
|
@@ -22,7 +22,7 @@ import { StyleSheet } from 'react-native';
|
|
|
22
22
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
23
23
|
import useNodesRef from './useNodesRef';
|
|
24
24
|
import { MovableAreaContext } from './context';
|
|
25
|
-
import { useTransformStyle, splitProps, splitStyle, HIDDEN_STYLE, wrapChildren, flatGesture, extendObject, omit, useNavigation } from './utils';
|
|
25
|
+
import { useTransformStyle, splitProps, splitStyle, HIDDEN_STYLE, wrapChildren, flatGesture, extendObject, omit, useNavigation, useRunOnJSCallback } from './utils';
|
|
26
26
|
import { GestureDetector, Gesture } from 'react-native-gesture-handler';
|
|
27
27
|
import Animated, { useSharedValue, useAnimatedStyle, withDecay, runOnJS, runOnUI, withSpring } from 'react-native-reanimated';
|
|
28
28
|
import { collectDataset, noop } from '@mpxjs/utils';
|
|
@@ -106,7 +106,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
106
106
|
const now = Date.now();
|
|
107
107
|
if (now - lastChangeTime.value >= changeThrottleTime) {
|
|
108
108
|
lastChangeTime.value = now;
|
|
109
|
-
runOnJS(
|
|
109
|
+
runOnJS(runOnJSCallback)('handleTriggerChange', { x, y, type });
|
|
110
110
|
}
|
|
111
111
|
}, [changeThrottleTime]);
|
|
112
112
|
useEffect(() => {
|
|
@@ -130,7 +130,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
130
130
|
: newY;
|
|
131
131
|
}
|
|
132
132
|
if (bindchange) {
|
|
133
|
-
runOnJS(
|
|
133
|
+
runOnJS(runOnJSCallback)('handleTriggerChange', {
|
|
134
134
|
x: newX,
|
|
135
135
|
y: newY,
|
|
136
136
|
type: 'setData'
|
|
@@ -295,13 +295,20 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
295
295
|
bindtouchend && bindtouchend(e);
|
|
296
296
|
catchtouchend && catchtouchend(e);
|
|
297
297
|
};
|
|
298
|
+
const runOnJSCallbackRef = useRef({
|
|
299
|
+
handleTriggerChange,
|
|
300
|
+
triggerStartOnJS,
|
|
301
|
+
triggerMoveOnJS,
|
|
302
|
+
triggerEndOnJS
|
|
303
|
+
});
|
|
304
|
+
const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef);
|
|
298
305
|
const gesture = useMemo(() => {
|
|
299
306
|
const handleTriggerMove = (e) => {
|
|
300
307
|
'worklet';
|
|
301
308
|
const hasTouchmove = !!bindhtouchmove || !!bindvtouchmove || !!bindtouchmove;
|
|
302
309
|
const hasCatchTouchmove = !!catchhtouchmove || !!catchvtouchmove || !!catchtouchmove;
|
|
303
310
|
if (hasTouchmove || hasCatchTouchmove) {
|
|
304
|
-
runOnJS(
|
|
311
|
+
runOnJS(runOnJSCallback)('triggerMoveOnJS', {
|
|
305
312
|
e,
|
|
306
313
|
touchEvent: touchEvent.value,
|
|
307
314
|
hasTouchmove,
|
|
@@ -319,7 +326,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
319
326
|
y: changedTouches.y
|
|
320
327
|
};
|
|
321
328
|
if (bindtouchstart || catchtouchstart) {
|
|
322
|
-
runOnJS(
|
|
329
|
+
runOnJS(runOnJSCallback)('triggerStartOnJS', { e });
|
|
323
330
|
}
|
|
324
331
|
})
|
|
325
332
|
.onStart(() => {
|
|
@@ -376,7 +383,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
376
383
|
isFirstTouch.value = true;
|
|
377
384
|
isMoving.value = false;
|
|
378
385
|
if (bindtouchend || catchtouchend) {
|
|
379
|
-
runOnJS(
|
|
386
|
+
runOnJS(runOnJSCallback)('triggerEndOnJS', { e });
|
|
380
387
|
}
|
|
381
388
|
})
|
|
382
389
|
.onEnd((e) => {
|
|
@@ -405,7 +412,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
405
412
|
: y;
|
|
406
413
|
}
|
|
407
414
|
if (bindchange) {
|
|
408
|
-
runOnJS(
|
|
415
|
+
runOnJS(runOnJSCallback)('handleTriggerChange', {
|
|
409
416
|
x,
|
|
410
417
|
y
|
|
411
418
|
});
|
|
@@ -423,7 +430,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
423
430
|
}, () => {
|
|
424
431
|
xInertialMotion.value = false;
|
|
425
432
|
if (bindchange) {
|
|
426
|
-
runOnJS(
|
|
433
|
+
runOnJS(runOnJSCallback)('handleTriggerChange', {
|
|
427
434
|
x: offsetX.value,
|
|
428
435
|
y: offsetY.value
|
|
429
436
|
});
|
|
@@ -439,7 +446,7 @@ const _MovableView = forwardRef((movableViewProps, ref) => {
|
|
|
439
446
|
}, () => {
|
|
440
447
|
yInertialMotion.value = false;
|
|
441
448
|
if (bindchange) {
|
|
442
|
-
runOnJS(
|
|
449
|
+
runOnJS(runOnJSCallback)('handleTriggerChange', {
|
|
443
450
|
x: offsetX.value,
|
|
444
451
|
y: offsetY.value
|
|
445
452
|
});
|
|
@@ -38,7 +38,7 @@ import Animated, { useSharedValue, withTiming, useAnimatedStyle, runOnJS } from
|
|
|
38
38
|
import { warn, hasOwn } from '@mpxjs/utils';
|
|
39
39
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
40
40
|
import useNodesRef from './useNodesRef';
|
|
41
|
-
import { splitProps, splitStyle, useTransformStyle, useLayout, wrapChildren, extendObject, flatGesture, HIDDEN_STYLE } from './utils';
|
|
41
|
+
import { splitProps, splitStyle, useTransformStyle, useLayout, wrapChildren, extendObject, flatGesture, HIDDEN_STYLE, useRunOnJSCallback } from './utils';
|
|
42
42
|
import { IntersectionObserverContext, ScrollViewContext } from './context';
|
|
43
43
|
import Portal from './mpx-portal';
|
|
44
44
|
const AnimatedScrollView = RNAnimated.createAnimatedComponent(ScrollView);
|
|
@@ -79,6 +79,13 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
79
79
|
const { normalStyle, hasVarDec, varContextRef, hasSelfPercent, hasPositionFixed, setWidth, setHeight } = useTransformStyle(style, { enableVar, externalVarContext, parentFontSize, parentWidth, parentHeight });
|
|
80
80
|
const { textStyle, innerStyle = {} } = splitStyle(normalStyle);
|
|
81
81
|
const scrollViewRef = useRef(null);
|
|
82
|
+
const runOnJSCallbackRef = useRef({
|
|
83
|
+
setEnableScroll,
|
|
84
|
+
setScrollBounces,
|
|
85
|
+
setRefreshing,
|
|
86
|
+
onRefresh
|
|
87
|
+
});
|
|
88
|
+
const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef);
|
|
82
89
|
useNodesRef(props, ref, scrollViewRef, {
|
|
83
90
|
style: normalStyle,
|
|
84
91
|
scrollOffset: scrollOptions,
|
|
@@ -404,7 +411,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
404
411
|
'worklet';
|
|
405
412
|
if (enableScrollValue.value !== newValue) {
|
|
406
413
|
enableScrollValue.value = newValue;
|
|
407
|
-
runOnJS(
|
|
414
|
+
runOnJS(runOnJSCallback)('setEnableScroll', newValue);
|
|
408
415
|
}
|
|
409
416
|
}
|
|
410
417
|
const resetScrollState = (value) => {
|
|
@@ -415,7 +422,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
415
422
|
'worklet';
|
|
416
423
|
if (bouncesValue.value !== newValue) {
|
|
417
424
|
bouncesValue.value = newValue;
|
|
418
|
-
runOnJS(
|
|
425
|
+
runOnJS(runOnJSCallback)('setScrollBounces', newValue);
|
|
419
426
|
}
|
|
420
427
|
}
|
|
421
428
|
// 处理下拉刷新的手势
|
|
@@ -460,7 +467,7 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
460
467
|
if ((event.translationY > 0 && translateY.value < refresherThreshold) || event.translationY < 0) {
|
|
461
468
|
translateY.value = withTiming(0);
|
|
462
469
|
updateScrollState(true);
|
|
463
|
-
runOnJS(
|
|
470
|
+
runOnJS(runOnJSCallback)('setRefreshing', false);
|
|
464
471
|
}
|
|
465
472
|
else {
|
|
466
473
|
translateY.value = withTiming(refresherHeight.value);
|
|
@@ -469,13 +476,13 @@ const _ScrollView = forwardRef((scrollViewProps = {}, ref) => {
|
|
|
469
476
|
else if (event.translationY >= refresherHeight.value) {
|
|
470
477
|
// 触发刷新
|
|
471
478
|
translateY.value = withTiming(refresherHeight.value);
|
|
472
|
-
runOnJS(
|
|
479
|
+
runOnJS(runOnJSCallback)('onRefresh');
|
|
473
480
|
}
|
|
474
481
|
else {
|
|
475
482
|
// 回弹
|
|
476
483
|
translateY.value = withTiming(0);
|
|
477
484
|
updateScrollState(true);
|
|
478
|
-
runOnJS(
|
|
485
|
+
runOnJS(runOnJSCallback)('setRefreshing', false);
|
|
479
486
|
}
|
|
480
487
|
})
|
|
481
488
|
.simultaneousWithExternalGesture(scrollViewRef);
|
|
@@ -4,7 +4,7 @@ import Animated, { useAnimatedStyle, useSharedValue, withTiming, Easing, runOnJS
|
|
|
4
4
|
import React, { forwardRef, useRef, useEffect, useMemo, createElement } from 'react';
|
|
5
5
|
import useInnerProps, { getCustomEvent } from './getInnerListeners';
|
|
6
6
|
import useNodesRef from './useNodesRef'; // 引入辅助函数
|
|
7
|
-
import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject, flatGesture } from './utils';
|
|
7
|
+
import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject, flatGesture, useRunOnJSCallback } from './utils';
|
|
8
8
|
import { SwiperContext } from './context';
|
|
9
9
|
import Portal from './mpx-portal';
|
|
10
10
|
/**
|
|
@@ -71,7 +71,7 @@ const easeMap = {
|
|
|
71
71
|
easeInOutCubic: Easing.inOut(Easing.cubic)
|
|
72
72
|
};
|
|
73
73
|
const SwiperWrapper = forwardRef((props, ref) => {
|
|
74
|
-
const { 'indicator-dots': showPagination, 'indicator-color': dotColor = 'rgba(0, 0, 0, .3)', 'indicator-active-color': activeDotColor = '#000000', 'enable-var': enableVar = false, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'external-var-context': externalVarContext, 'simultaneous-handlers': originSimultaneousHandlers = [], 'wait-for': waitFor = [], style = {}, autoplay = false, circular = false, disableGesture = false, bindchange } = props;
|
|
74
|
+
const { 'indicator-dots': showPagination, 'indicator-color': dotColor = 'rgba(0, 0, 0, .3)', 'indicator-active-color': activeDotColor = '#000000', 'enable-var': enableVar = false, 'parent-font-size': parentFontSize, 'parent-width': parentWidth, 'parent-height': parentHeight, 'external-var-context': externalVarContext, 'simultaneous-handlers': originSimultaneousHandlers = [], 'wait-for': waitFor = [], style = {}, autoplay = false, circular = false, disableGesture = false, current: propCurrent = 0, bindchange } = props;
|
|
75
75
|
const easeingFunc = props['easing-function'] || 'default';
|
|
76
76
|
const easeDuration = props.duration || 500;
|
|
77
77
|
const horizontal = props.vertical !== undefined ? !props.vertical : true;
|
|
@@ -112,10 +112,10 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
112
112
|
// 每个元素的宽度 or 高度,有固定值直接初始化无则0
|
|
113
113
|
const step = useSharedValue(initStep);
|
|
114
114
|
// 记录选中元素的索引值
|
|
115
|
-
const currentIndex = useSharedValue(
|
|
115
|
+
const currentIndex = useSharedValue(propCurrent);
|
|
116
116
|
// const initOffset = getOffset(props.current || 0, initStep)
|
|
117
117
|
// 记录元素的偏移量
|
|
118
|
-
const offset = useSharedValue(getOffset(
|
|
118
|
+
const offset = useSharedValue(getOffset(propCurrent, initStep));
|
|
119
119
|
const strAbso = 'absolute' + dir.toUpperCase();
|
|
120
120
|
const strVelocity = 'velocity' + dir.toUpperCase();
|
|
121
121
|
// 标识手指触摸和抬起, 起点在onBegin
|
|
@@ -170,7 +170,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
170
170
|
const iStep = dir === 'x' ? realWidth : realHeight;
|
|
171
171
|
if (iStep !== step.value) {
|
|
172
172
|
step.value = iStep;
|
|
173
|
-
updateCurrent(
|
|
173
|
+
updateCurrent(propCurrent, iStep);
|
|
174
174
|
updateAutoplay();
|
|
175
175
|
}
|
|
176
176
|
}
|
|
@@ -272,7 +272,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
272
272
|
easing: easeMap[easeingFunc]
|
|
273
273
|
}, () => {
|
|
274
274
|
currentIndex.value = nextIndex;
|
|
275
|
-
runOnJS(
|
|
275
|
+
runOnJS(runOnJSCallback)('loop');
|
|
276
276
|
});
|
|
277
277
|
}
|
|
278
278
|
else {
|
|
@@ -288,7 +288,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
288
288
|
// 将开始位置设置为真正的位置
|
|
289
289
|
offset.value = initOffset;
|
|
290
290
|
currentIndex.value = nextIndex;
|
|
291
|
-
runOnJS(
|
|
291
|
+
runOnJS(runOnJSCallback)('loop');
|
|
292
292
|
});
|
|
293
293
|
}
|
|
294
294
|
else {
|
|
@@ -300,7 +300,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
300
300
|
easing: easeMap[easeingFunc]
|
|
301
301
|
}, () => {
|
|
302
302
|
currentIndex.value = nextIndex;
|
|
303
|
-
runOnJS(
|
|
303
|
+
runOnJS(runOnJSCallback)('loop');
|
|
304
304
|
});
|
|
305
305
|
}
|
|
306
306
|
}
|
|
@@ -325,12 +325,19 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
325
325
|
resumeLoop
|
|
326
326
|
};
|
|
327
327
|
}, []);
|
|
328
|
-
function handleSwiperChange(current) {
|
|
329
|
-
if (
|
|
328
|
+
function handleSwiperChange(current, pCurrent) {
|
|
329
|
+
if (pCurrent !== currentIndex.value) {
|
|
330
330
|
const eventData = getCustomEvent('change', {}, { detail: { current, source: 'touch' }, layoutRef: layoutRef });
|
|
331
331
|
bindchange && bindchange(eventData);
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
+
const runOnJSCallbackRef = useRef({
|
|
335
|
+
loop,
|
|
336
|
+
pauseLoop,
|
|
337
|
+
resumeLoop,
|
|
338
|
+
handleSwiperChange
|
|
339
|
+
});
|
|
340
|
+
const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef);
|
|
334
341
|
function getOffset(index, stepValue) {
|
|
335
342
|
if (!stepValue)
|
|
336
343
|
return 0;
|
|
@@ -348,12 +355,12 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
348
355
|
const targetOffset = getOffset(index || 0, stepValue);
|
|
349
356
|
if (targetOffset !== offset.value) {
|
|
350
357
|
// 内部基于props.current!==currentIndex.value决定是否使用动画及更新currentIndex.value
|
|
351
|
-
if (
|
|
358
|
+
if (propCurrent !== undefined && propCurrent !== currentIndex.value) {
|
|
352
359
|
offset.value = withTiming(targetOffset, {
|
|
353
360
|
duration: easeDuration,
|
|
354
361
|
easing: easeMap[easeingFunc]
|
|
355
362
|
}, () => {
|
|
356
|
-
currentIndex.value =
|
|
363
|
+
currentIndex.value = propCurrent;
|
|
357
364
|
});
|
|
358
365
|
}
|
|
359
366
|
else {
|
|
@@ -373,7 +380,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
373
380
|
useAnimatedReaction(() => currentIndex.value, (newIndex, preIndex) => {
|
|
374
381
|
// 这里必须传递函数名, 直接写()=> {}形式会报 访问了未sharedValue信息
|
|
375
382
|
if (newIndex !== preIndex && bindchange) {
|
|
376
|
-
runOnJS(
|
|
383
|
+
runOnJS(runOnJSCallback)('handleSwiperChange', newIndex, propCurrent);
|
|
377
384
|
}
|
|
378
385
|
});
|
|
379
386
|
useEffect(() => {
|
|
@@ -406,10 +413,10 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
406
413
|
useEffect(() => {
|
|
407
414
|
// 1. 如果用户在touch的过程中, 外部更新了current以外部为准(小程序表现)
|
|
408
415
|
// 2. 手指滑动过程中更新索引,外部会把current再传入进来,导致offset直接更新,增加判断不同才更新
|
|
409
|
-
if (
|
|
410
|
-
updateCurrent(
|
|
416
|
+
if (propCurrent !== currentIndex.value) {
|
|
417
|
+
updateCurrent(propCurrent, step.value);
|
|
411
418
|
}
|
|
412
|
-
}, [
|
|
419
|
+
}, [propCurrent]);
|
|
413
420
|
useEffect(() => {
|
|
414
421
|
autoplayShared.value = autoplay;
|
|
415
422
|
updateAutoplay();
|
|
@@ -502,7 +509,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
502
509
|
if (touchfinish.value !== false) {
|
|
503
510
|
currentIndex.value = selectedIndex;
|
|
504
511
|
offset.value = resetOffset;
|
|
505
|
-
runOnJS(
|
|
512
|
+
runOnJS(runOnJSCallback)('resumeLoop');
|
|
506
513
|
}
|
|
507
514
|
});
|
|
508
515
|
}
|
|
@@ -513,7 +520,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
513
520
|
}, () => {
|
|
514
521
|
if (touchfinish.value !== false) {
|
|
515
522
|
currentIndex.value = selectedIndex;
|
|
516
|
-
runOnJS(
|
|
523
|
+
runOnJS(runOnJSCallback)('resumeLoop');
|
|
517
524
|
}
|
|
518
525
|
});
|
|
519
526
|
}
|
|
@@ -535,7 +542,7 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
535
542
|
}, () => {
|
|
536
543
|
if (touchfinish.value !== false) {
|
|
537
544
|
currentIndex.value = moveToIndex;
|
|
538
|
-
runOnJS(
|
|
545
|
+
runOnJS(runOnJSCallback)('resumeLoop');
|
|
539
546
|
}
|
|
540
547
|
});
|
|
541
548
|
}
|
|
@@ -562,20 +569,11 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
562
569
|
'worklet';
|
|
563
570
|
const { diffOffset, half, isTriggerUpdateHalf } = computeHalf(eventData);
|
|
564
571
|
if (+diffOffset === 0) {
|
|
565
|
-
runOnJS(
|
|
572
|
+
runOnJS(runOnJSCallback)('resumeLoop');
|
|
566
573
|
}
|
|
567
574
|
else if (isTriggerUpdateHalf) {
|
|
568
|
-
// 如果触发了onUpdate
|
|
569
|
-
|
|
570
|
-
offset.value = withTiming(-targetIndex * step.value, {
|
|
571
|
-
duration: easeDuration,
|
|
572
|
-
easing: easeMap[easeingFunc]
|
|
573
|
-
}, () => {
|
|
574
|
-
if (touchfinish.value !== false) {
|
|
575
|
-
currentIndex.value = targetIndex;
|
|
576
|
-
runOnJS(resumeLoop)();
|
|
577
|
-
}
|
|
578
|
-
});
|
|
575
|
+
// 如果触发了onUpdate时的索引变更
|
|
576
|
+
handleEnd(eventData);
|
|
579
577
|
}
|
|
580
578
|
else if (half) {
|
|
581
579
|
handleEnd(eventData);
|
|
@@ -651,15 +649,15 @@ const SwiperWrapper = forwardRef((props, ref) => {
|
|
|
651
649
|
return;
|
|
652
650
|
touchfinish.value = false;
|
|
653
651
|
cancelAnimation(offset);
|
|
654
|
-
runOnJS(
|
|
652
|
+
runOnJS(runOnJSCallback)('pauseLoop');
|
|
655
653
|
preAbsolutePos.value = e[strAbso];
|
|
656
654
|
moveTranstion.value = e[strAbso];
|
|
657
655
|
})
|
|
658
656
|
.onUpdate((e) => {
|
|
659
657
|
'worklet';
|
|
660
|
-
if (touchfinish.value)
|
|
661
|
-
return;
|
|
662
658
|
const moveDistance = e[strAbso] - preAbsolutePos.value;
|
|
659
|
+
if (touchfinish.value || moveDistance === 0)
|
|
660
|
+
return;
|
|
663
661
|
const eventData = {
|
|
664
662
|
translation: moveDistance,
|
|
665
663
|
transdir: moveDistance
|
|
@@ -22,7 +22,7 @@ import { StyleSheet, View, LayoutChangeEvent } from 'react-native'
|
|
|
22
22
|
import useInnerProps, { getCustomEvent } from './getInnerListeners'
|
|
23
23
|
import useNodesRef, { HandlerRef } from './useNodesRef'
|
|
24
24
|
import { MovableAreaContext } from './context'
|
|
25
|
-
import { useTransformStyle, splitProps, splitStyle, HIDDEN_STYLE, wrapChildren, GestureHandler, flatGesture, extendObject, omit, useNavigation } from './utils'
|
|
25
|
+
import { useTransformStyle, splitProps, splitStyle, HIDDEN_STYLE, wrapChildren, GestureHandler, flatGesture, extendObject, omit, useNavigation, useRunOnJSCallback } from './utils'
|
|
26
26
|
import { GestureDetector, Gesture, GestureTouchEvent, GestureStateChangeEvent, PanGestureHandlerEventPayload, PanGesture } from 'react-native-gesture-handler'
|
|
27
27
|
import Animated, {
|
|
28
28
|
useSharedValue,
|
|
@@ -30,7 +30,6 @@ import Animated, {
|
|
|
30
30
|
withDecay,
|
|
31
31
|
runOnJS,
|
|
32
32
|
runOnUI,
|
|
33
|
-
useAnimatedReaction,
|
|
34
33
|
withSpring
|
|
35
34
|
} from 'react-native-reanimated'
|
|
36
35
|
import { collectDataset, noop } from '@mpxjs/utils'
|
|
@@ -87,7 +86,6 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
|
|
|
87
86
|
const layoutRef = useRef<any>({})
|
|
88
87
|
const changeSource = useRef<any>('')
|
|
89
88
|
const hasLayoutRef = useRef(false)
|
|
90
|
-
|
|
91
89
|
const propsRef = useRef<any>({})
|
|
92
90
|
propsRef.current = (props || {}) as MovableViewProps
|
|
93
91
|
|
|
@@ -208,7 +206,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
|
|
|
208
206
|
const now = Date.now()
|
|
209
207
|
if (now - lastChangeTime.value >= changeThrottleTime) {
|
|
210
208
|
lastChangeTime.value = now
|
|
211
|
-
runOnJS(
|
|
209
|
+
runOnJS(runOnJSCallback)('handleTriggerChange', { x, y, type })
|
|
212
210
|
}
|
|
213
211
|
}, [changeThrottleTime])
|
|
214
212
|
|
|
@@ -233,7 +231,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
|
|
|
233
231
|
: newY
|
|
234
232
|
}
|
|
235
233
|
if (bindchange) {
|
|
236
|
-
runOnJS(
|
|
234
|
+
runOnJS(runOnJSCallback)('handleTriggerChange', {
|
|
237
235
|
x: newX,
|
|
238
236
|
y: newY,
|
|
239
237
|
type: 'setData'
|
|
@@ -408,13 +406,21 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
|
|
|
408
406
|
catchtouchend && catchtouchend(e)
|
|
409
407
|
}
|
|
410
408
|
|
|
409
|
+
const runOnJSCallbackRef = useRef({
|
|
410
|
+
handleTriggerChange,
|
|
411
|
+
triggerStartOnJS,
|
|
412
|
+
triggerMoveOnJS,
|
|
413
|
+
triggerEndOnJS
|
|
414
|
+
})
|
|
415
|
+
const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef)
|
|
416
|
+
|
|
411
417
|
const gesture = useMemo(() => {
|
|
412
418
|
const handleTriggerMove = (e: GestureTouchEvent) => {
|
|
413
419
|
'worklet'
|
|
414
420
|
const hasTouchmove = !!bindhtouchmove || !!bindvtouchmove || !!bindtouchmove
|
|
415
421
|
const hasCatchTouchmove = !!catchhtouchmove || !!catchvtouchmove || !!catchtouchmove
|
|
416
422
|
if (hasTouchmove || hasCatchTouchmove) {
|
|
417
|
-
runOnJS(
|
|
423
|
+
runOnJS(runOnJSCallback)('triggerMoveOnJS', {
|
|
418
424
|
e,
|
|
419
425
|
touchEvent: touchEvent.value,
|
|
420
426
|
hasTouchmove,
|
|
@@ -433,7 +439,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
|
|
|
433
439
|
y: changedTouches.y
|
|
434
440
|
}
|
|
435
441
|
if (bindtouchstart || catchtouchstart) {
|
|
436
|
-
runOnJS(
|
|
442
|
+
runOnJS(runOnJSCallback)('triggerStartOnJS', { e })
|
|
437
443
|
}
|
|
438
444
|
})
|
|
439
445
|
.onStart(() => {
|
|
@@ -487,7 +493,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
|
|
|
487
493
|
isFirstTouch.value = true
|
|
488
494
|
isMoving.value = false
|
|
489
495
|
if (bindtouchend || catchtouchend) {
|
|
490
|
-
runOnJS(
|
|
496
|
+
runOnJS(runOnJSCallback)('triggerEndOnJS', { e })
|
|
491
497
|
}
|
|
492
498
|
})
|
|
493
499
|
.onEnd((e: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => {
|
|
@@ -515,7 +521,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
|
|
|
515
521
|
: y
|
|
516
522
|
}
|
|
517
523
|
if (bindchange) {
|
|
518
|
-
runOnJS(
|
|
524
|
+
runOnJS(runOnJSCallback)('handleTriggerChange', {
|
|
519
525
|
x,
|
|
520
526
|
y
|
|
521
527
|
})
|
|
@@ -532,7 +538,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
|
|
|
532
538
|
}, () => {
|
|
533
539
|
xInertialMotion.value = false
|
|
534
540
|
if (bindchange) {
|
|
535
|
-
runOnJS(
|
|
541
|
+
runOnJS(runOnJSCallback)('handleTriggerChange', {
|
|
536
542
|
x: offsetX.value,
|
|
537
543
|
y: offsetY.value
|
|
538
544
|
})
|
|
@@ -548,7 +554,7 @@ const _MovableView = forwardRef<HandlerRef<View, MovableViewProps>, MovableViewP
|
|
|
548
554
|
}, () => {
|
|
549
555
|
yInertialMotion.value = false
|
|
550
556
|
if (bindchange) {
|
|
551
|
-
runOnJS(
|
|
557
|
+
runOnJS(runOnJSCallback)('handleTriggerChange', {
|
|
552
558
|
x: offsetX.value,
|
|
553
559
|
y: offsetY.value
|
|
554
560
|
})
|
|
@@ -38,7 +38,7 @@ import Animated, { useSharedValue, withTiming, useAnimatedStyle, runOnJS } from
|
|
|
38
38
|
import { warn, hasOwn } from '@mpxjs/utils'
|
|
39
39
|
import useInnerProps, { getCustomEvent } from './getInnerListeners'
|
|
40
40
|
import useNodesRef, { HandlerRef } from './useNodesRef'
|
|
41
|
-
import { splitProps, splitStyle, useTransformStyle, useLayout, wrapChildren, extendObject, flatGesture, GestureHandler, HIDDEN_STYLE } from './utils'
|
|
41
|
+
import { splitProps, splitStyle, useTransformStyle, useLayout, wrapChildren, extendObject, flatGesture, GestureHandler, HIDDEN_STYLE, useRunOnJSCallback } from './utils'
|
|
42
42
|
import { IntersectionObserverContext, ScrollViewContext } from './context'
|
|
43
43
|
import Portal from './mpx-portal'
|
|
44
44
|
|
|
@@ -210,6 +210,15 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
210
210
|
const { textStyle, innerStyle = {} } = splitStyle(normalStyle)
|
|
211
211
|
|
|
212
212
|
const scrollViewRef = useRef<ScrollView>(null)
|
|
213
|
+
|
|
214
|
+
const runOnJSCallbackRef = useRef({
|
|
215
|
+
setEnableScroll,
|
|
216
|
+
setScrollBounces,
|
|
217
|
+
setRefreshing,
|
|
218
|
+
onRefresh
|
|
219
|
+
})
|
|
220
|
+
const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef)
|
|
221
|
+
|
|
213
222
|
useNodesRef(props, ref, scrollViewRef, {
|
|
214
223
|
style: normalStyle,
|
|
215
224
|
scrollOffset: scrollOptions,
|
|
@@ -587,7 +596,7 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
587
596
|
'worklet'
|
|
588
597
|
if (enableScrollValue.value !== newValue) {
|
|
589
598
|
enableScrollValue.value = newValue
|
|
590
|
-
runOnJS(
|
|
599
|
+
runOnJS(runOnJSCallback)('setEnableScroll', newValue)
|
|
591
600
|
}
|
|
592
601
|
}
|
|
593
602
|
|
|
@@ -600,7 +609,7 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
600
609
|
'worklet'
|
|
601
610
|
if (bouncesValue.value !== newValue) {
|
|
602
611
|
bouncesValue.value = newValue
|
|
603
|
-
runOnJS(
|
|
612
|
+
runOnJS(runOnJSCallback)('setScrollBounces', newValue)
|
|
604
613
|
}
|
|
605
614
|
}
|
|
606
615
|
|
|
@@ -649,19 +658,19 @@ const _ScrollView = forwardRef<HandlerRef<ScrollView & View, ScrollViewProps>, S
|
|
|
649
658
|
if ((event.translationY > 0 && translateY.value < refresherThreshold) || event.translationY < 0) {
|
|
650
659
|
translateY.value = withTiming(0)
|
|
651
660
|
updateScrollState(true)
|
|
652
|
-
runOnJS(
|
|
661
|
+
runOnJS(runOnJSCallback)('setRefreshing', false)
|
|
653
662
|
} else {
|
|
654
663
|
translateY.value = withTiming(refresherHeight.value)
|
|
655
664
|
}
|
|
656
665
|
} else if (event.translationY >= refresherHeight.value) {
|
|
657
666
|
// 触发刷新
|
|
658
667
|
translateY.value = withTiming(refresherHeight.value)
|
|
659
|
-
runOnJS(
|
|
668
|
+
runOnJS(runOnJSCallback)('onRefresh')
|
|
660
669
|
} else {
|
|
661
670
|
// 回弹
|
|
662
671
|
translateY.value = withTiming(0)
|
|
663
672
|
updateScrollState(true)
|
|
664
|
-
runOnJS(
|
|
673
|
+
runOnJS(runOnJSCallback)('setRefreshing', false)
|
|
665
674
|
}
|
|
666
675
|
})
|
|
667
676
|
.simultaneousWithExternalGesture(scrollViewRef)
|
|
@@ -5,7 +5,7 @@ import Animated, { useAnimatedStyle, useSharedValue, withTiming, Easing, runOnJS
|
|
|
5
5
|
import React, { JSX, forwardRef, useRef, useEffect, ReactNode, ReactElement, useMemo, createElement } from 'react'
|
|
6
6
|
import useInnerProps, { getCustomEvent } from './getInnerListeners'
|
|
7
7
|
import useNodesRef, { HandlerRef } from './useNodesRef' // 引入辅助函数
|
|
8
|
-
import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject, GestureHandler, flatGesture } from './utils'
|
|
8
|
+
import { useTransformStyle, splitStyle, splitProps, useLayout, wrapChildren, extendObject, GestureHandler, flatGesture, useRunOnJSCallback } from './utils'
|
|
9
9
|
import { SwiperContext } from './context'
|
|
10
10
|
import Portal from './mpx-portal'
|
|
11
11
|
/**
|
|
@@ -148,6 +148,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
148
148
|
autoplay = false,
|
|
149
149
|
circular = false,
|
|
150
150
|
disableGesture = false,
|
|
151
|
+
current: propCurrent = 0,
|
|
151
152
|
bindchange
|
|
152
153
|
} = props
|
|
153
154
|
const easeingFunc = props['easing-function'] || 'default'
|
|
@@ -198,10 +199,10 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
198
199
|
// 每个元素的宽度 or 高度,有固定值直接初始化无则0
|
|
199
200
|
const step = useSharedValue(initStep)
|
|
200
201
|
// 记录选中元素的索引值
|
|
201
|
-
const currentIndex = useSharedValue(
|
|
202
|
+
const currentIndex = useSharedValue(propCurrent)
|
|
202
203
|
// const initOffset = getOffset(props.current || 0, initStep)
|
|
203
204
|
// 记录元素的偏移量
|
|
204
|
-
const offset = useSharedValue(getOffset(
|
|
205
|
+
const offset = useSharedValue(getOffset(propCurrent, initStep))
|
|
205
206
|
const strAbso = 'absolute' + dir.toUpperCase() as StrAbsoType
|
|
206
207
|
const strVelocity = 'velocity' + dir.toUpperCase() as StrVelocityType
|
|
207
208
|
// 标识手指触摸和抬起, 起点在onBegin
|
|
@@ -270,7 +271,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
270
271
|
const iStep = dir === 'x' ? realWidth : realHeight
|
|
271
272
|
if (iStep !== step.value) {
|
|
272
273
|
step.value = iStep
|
|
273
|
-
updateCurrent(
|
|
274
|
+
updateCurrent(propCurrent, iStep)
|
|
274
275
|
updateAutoplay()
|
|
275
276
|
}
|
|
276
277
|
}
|
|
@@ -374,7 +375,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
374
375
|
easing: easeMap[easeingFunc]
|
|
375
376
|
}, () => {
|
|
376
377
|
currentIndex.value = nextIndex
|
|
377
|
-
runOnJS(
|
|
378
|
+
runOnJS(runOnJSCallback)('loop')
|
|
378
379
|
})
|
|
379
380
|
} else {
|
|
380
381
|
// 默认向右, 向下
|
|
@@ -389,7 +390,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
389
390
|
// 将开始位置设置为真正的位置
|
|
390
391
|
offset.value = initOffset
|
|
391
392
|
currentIndex.value = nextIndex
|
|
392
|
-
runOnJS(
|
|
393
|
+
runOnJS(runOnJSCallback)('loop')
|
|
393
394
|
})
|
|
394
395
|
} else {
|
|
395
396
|
nextIndex = currentIndex.value + 1
|
|
@@ -400,7 +401,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
400
401
|
easing: easeMap[easeingFunc]
|
|
401
402
|
}, () => {
|
|
402
403
|
currentIndex.value = nextIndex
|
|
403
|
-
runOnJS(
|
|
404
|
+
runOnJS(runOnJSCallback)('loop')
|
|
404
405
|
})
|
|
405
406
|
}
|
|
406
407
|
}
|
|
@@ -428,13 +429,21 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
428
429
|
}
|
|
429
430
|
}, [])
|
|
430
431
|
|
|
431
|
-
function handleSwiperChange (current: number) {
|
|
432
|
-
if (
|
|
432
|
+
function handleSwiperChange (current: number, pCurrent: number) {
|
|
433
|
+
if (pCurrent !== currentIndex.value) {
|
|
433
434
|
const eventData = getCustomEvent('change', {}, { detail: { current, source: 'touch' }, layoutRef: layoutRef })
|
|
434
435
|
bindchange && bindchange(eventData)
|
|
435
436
|
}
|
|
436
437
|
}
|
|
437
438
|
|
|
439
|
+
const runOnJSCallbackRef = useRef({
|
|
440
|
+
loop,
|
|
441
|
+
pauseLoop,
|
|
442
|
+
resumeLoop,
|
|
443
|
+
handleSwiperChange
|
|
444
|
+
})
|
|
445
|
+
const runOnJSCallback = useRunOnJSCallback(runOnJSCallbackRef)
|
|
446
|
+
|
|
438
447
|
function getOffset (index: number, stepValue: number) {
|
|
439
448
|
if (!stepValue) return 0
|
|
440
449
|
let targetOffset = 0
|
|
@@ -451,12 +460,12 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
451
460
|
const targetOffset = getOffset(index || 0, stepValue)
|
|
452
461
|
if (targetOffset !== offset.value) {
|
|
453
462
|
// 内部基于props.current!==currentIndex.value决定是否使用动画及更新currentIndex.value
|
|
454
|
-
if (
|
|
463
|
+
if (propCurrent !== undefined && propCurrent !== currentIndex.value) {
|
|
455
464
|
offset.value = withTiming(targetOffset, {
|
|
456
465
|
duration: easeDuration,
|
|
457
466
|
easing: easeMap[easeingFunc]
|
|
458
467
|
}, () => {
|
|
459
|
-
currentIndex.value =
|
|
468
|
+
currentIndex.value = propCurrent
|
|
460
469
|
})
|
|
461
470
|
} else {
|
|
462
471
|
offset.value = targetOffset
|
|
@@ -474,7 +483,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
474
483
|
useAnimatedReaction(() => currentIndex.value, (newIndex: number, preIndex: number) => {
|
|
475
484
|
// 这里必须传递函数名, 直接写()=> {}形式会报 访问了未sharedValue信息
|
|
476
485
|
if (newIndex !== preIndex && bindchange) {
|
|
477
|
-
runOnJS(
|
|
486
|
+
runOnJS(runOnJSCallback)('handleSwiperChange', newIndex, propCurrent)
|
|
478
487
|
}
|
|
479
488
|
})
|
|
480
489
|
|
|
@@ -510,10 +519,10 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
510
519
|
useEffect(() => {
|
|
511
520
|
// 1. 如果用户在touch的过程中, 外部更新了current以外部为准(小程序表现)
|
|
512
521
|
// 2. 手指滑动过程中更新索引,外部会把current再传入进来,导致offset直接更新,增加判断不同才更新
|
|
513
|
-
if (
|
|
514
|
-
updateCurrent(
|
|
522
|
+
if (propCurrent !== currentIndex.value) {
|
|
523
|
+
updateCurrent(propCurrent, step.value)
|
|
515
524
|
}
|
|
516
|
-
}, [
|
|
525
|
+
}, [propCurrent])
|
|
517
526
|
|
|
518
527
|
useEffect(() => {
|
|
519
528
|
autoplayShared.value = autoplay
|
|
@@ -603,7 +612,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
603
612
|
if (touchfinish.value !== false) {
|
|
604
613
|
currentIndex.value = selectedIndex
|
|
605
614
|
offset.value = resetOffset
|
|
606
|
-
runOnJS(
|
|
615
|
+
runOnJS(runOnJSCallback)('resumeLoop')
|
|
607
616
|
}
|
|
608
617
|
})
|
|
609
618
|
} else {
|
|
@@ -613,7 +622,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
613
622
|
}, () => {
|
|
614
623
|
if (touchfinish.value !== false) {
|
|
615
624
|
currentIndex.value = selectedIndex
|
|
616
|
-
runOnJS(
|
|
625
|
+
runOnJS(runOnJSCallback)('resumeLoop')
|
|
617
626
|
}
|
|
618
627
|
})
|
|
619
628
|
}
|
|
@@ -635,7 +644,7 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
635
644
|
}, () => {
|
|
636
645
|
if (touchfinish.value !== false) {
|
|
637
646
|
currentIndex.value = moveToIndex
|
|
638
|
-
runOnJS(
|
|
647
|
+
runOnJS(runOnJSCallback)('resumeLoop')
|
|
639
648
|
}
|
|
640
649
|
})
|
|
641
650
|
}
|
|
@@ -662,19 +671,10 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
662
671
|
'worklet'
|
|
663
672
|
const { diffOffset, half, isTriggerUpdateHalf } = computeHalf(eventData)
|
|
664
673
|
if (+diffOffset === 0) {
|
|
665
|
-
runOnJS(
|
|
674
|
+
runOnJS(runOnJSCallback)('resumeLoop')
|
|
666
675
|
} else if (isTriggerUpdateHalf) {
|
|
667
|
-
// 如果触发了onUpdate
|
|
668
|
-
|
|
669
|
-
offset.value = withTiming(-targetIndex * step.value, {
|
|
670
|
-
duration: easeDuration,
|
|
671
|
-
easing: easeMap[easeingFunc]
|
|
672
|
-
}, () => {
|
|
673
|
-
if (touchfinish.value !== false) {
|
|
674
|
-
currentIndex.value = targetIndex
|
|
675
|
-
runOnJS(resumeLoop)()
|
|
676
|
-
}
|
|
677
|
-
})
|
|
676
|
+
// 如果触发了onUpdate时的索引变更
|
|
677
|
+
handleEnd(eventData)
|
|
678
678
|
} else if (half) {
|
|
679
679
|
handleEnd(eventData)
|
|
680
680
|
} else {
|
|
@@ -745,14 +745,14 @@ const SwiperWrapper = forwardRef<HandlerRef<View, SwiperProps>, SwiperProps>((pr
|
|
|
745
745
|
if (!step.value) return
|
|
746
746
|
touchfinish.value = false
|
|
747
747
|
cancelAnimation(offset)
|
|
748
|
-
runOnJS(
|
|
748
|
+
runOnJS(runOnJSCallback)('pauseLoop')
|
|
749
749
|
preAbsolutePos.value = e[strAbso]
|
|
750
750
|
moveTranstion.value = e[strAbso]
|
|
751
751
|
})
|
|
752
752
|
.onUpdate((e: GestureStateChangeEvent<PanGestureHandlerEventPayload>) => {
|
|
753
753
|
'worklet'
|
|
754
|
-
if (touchfinish.value) return
|
|
755
754
|
const moveDistance = e[strAbso] - preAbsolutePos.value
|
|
755
|
+
if (touchfinish.value || moveDistance === 0) return
|
|
756
756
|
const eventData = {
|
|
757
757
|
translation: moveDistance,
|
|
758
758
|
transdir: moveDistance
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpxjs/webpack-plugin",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.15-1",
|
|
4
4
|
"description": "mpx compile core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mpx"
|
|
@@ -100,5 +100,5 @@
|
|
|
100
100
|
"engines": {
|
|
101
101
|
"node": ">=14.14.0"
|
|
102
102
|
},
|
|
103
|
-
"gitHead": "
|
|
103
|
+
"gitHead": "2d37697869b9bdda3efab92dda8c910b68fd05c0"
|
|
104
104
|
}
|
package/LICENSE
DELETED
|
@@ -1,433 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
|
|
3
|
-
Version 2.0, January 2004
|
|
4
|
-
|
|
5
|
-
http://www.apache.org/licenses/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
1. Definitions.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
21
|
-
|
|
22
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
28
|
-
|
|
29
|
-
the copyright owner that is granting the License.
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
35
|
-
|
|
36
|
-
other entities that control, are controlled by, or are under common
|
|
37
|
-
|
|
38
|
-
control with that entity. For the purposes of this definition,
|
|
39
|
-
|
|
40
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
41
|
-
|
|
42
|
-
direction or management of such entity, whether by contract or
|
|
43
|
-
|
|
44
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
45
|
-
|
|
46
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
52
|
-
|
|
53
|
-
exercising permissions granted by this License.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
59
|
-
|
|
60
|
-
including but not limited to software source code, documentation
|
|
61
|
-
|
|
62
|
-
source, and configuration files.
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"Object" form shall mean any form resulting from mechanical
|
|
68
|
-
|
|
69
|
-
transformation or translation of a Source form, including but
|
|
70
|
-
|
|
71
|
-
not limited to compiled object code, generated documentation,
|
|
72
|
-
|
|
73
|
-
and conversions to other media types.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
79
|
-
|
|
80
|
-
Object form, made available under the License, as indicated by a
|
|
81
|
-
|
|
82
|
-
copyright notice that is included in or attached to the work
|
|
83
|
-
|
|
84
|
-
(an example is provided in the Appendix below).
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
90
|
-
|
|
91
|
-
form, that is based on (or derived from) the Work and for which the
|
|
92
|
-
|
|
93
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
94
|
-
|
|
95
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
96
|
-
|
|
97
|
-
of this License, Derivative Works shall not include works that remain
|
|
98
|
-
|
|
99
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
100
|
-
|
|
101
|
-
the Work and Derivative Works thereof.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
"Contribution" shall mean any work of authorship, including
|
|
107
|
-
|
|
108
|
-
the original version of the Work and any modifications or additions
|
|
109
|
-
|
|
110
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
111
|
-
|
|
112
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
113
|
-
|
|
114
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
115
|
-
|
|
116
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
117
|
-
|
|
118
|
-
means any form of electronic, verbal, or written communication sent
|
|
119
|
-
|
|
120
|
-
to the Licensor or its representatives, including but not limited to
|
|
121
|
-
|
|
122
|
-
communication on electronic mailing lists, source code control systems,
|
|
123
|
-
|
|
124
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
125
|
-
|
|
126
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
127
|
-
|
|
128
|
-
excluding communication that is conspicuously marked or otherwise
|
|
129
|
-
|
|
130
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
136
|
-
|
|
137
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
138
|
-
|
|
139
|
-
subsequently incorporated within the Work.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
145
|
-
|
|
146
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
147
|
-
|
|
148
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
149
|
-
|
|
150
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
151
|
-
|
|
152
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
153
|
-
|
|
154
|
-
Work and such Derivative Works in Source or Object form.
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
160
|
-
|
|
161
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
162
|
-
|
|
163
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
164
|
-
|
|
165
|
-
(except as stated in this section) patent license to make, have made,
|
|
166
|
-
|
|
167
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
168
|
-
|
|
169
|
-
where such license applies only to those patent claims licensable
|
|
170
|
-
|
|
171
|
-
by such Contributor that are necessarily infringed by their
|
|
172
|
-
|
|
173
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
174
|
-
|
|
175
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
176
|
-
|
|
177
|
-
institute patent litigation against any entity (including a
|
|
178
|
-
|
|
179
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
180
|
-
|
|
181
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
182
|
-
|
|
183
|
-
or contributory patent infringement, then any patent licenses
|
|
184
|
-
|
|
185
|
-
granted to You under this License for that Work shall terminate
|
|
186
|
-
|
|
187
|
-
as of the date such litigation is filed.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
193
|
-
|
|
194
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
195
|
-
|
|
196
|
-
modifications, and in Source or Object form, provided that You
|
|
197
|
-
|
|
198
|
-
meet the following conditions:
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
(a) You must give any other recipients of the Work or
|
|
204
|
-
|
|
205
|
-
Derivative Works a copy of this License; and
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
(b) You must cause any modified files to carry prominent notices
|
|
211
|
-
|
|
212
|
-
stating that You changed the files; and
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
218
|
-
|
|
219
|
-
that You distribute, all copyright, patent, trademark, and
|
|
220
|
-
|
|
221
|
-
attribution notices from the Source form of the Work,
|
|
222
|
-
|
|
223
|
-
excluding those notices that do not pertain to any part of
|
|
224
|
-
|
|
225
|
-
the Derivative Works; and
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
231
|
-
|
|
232
|
-
distribution, then any Derivative Works that You distribute must
|
|
233
|
-
|
|
234
|
-
include a readable copy of the attribution notices contained
|
|
235
|
-
|
|
236
|
-
within such NOTICE file, excluding those notices that do not
|
|
237
|
-
|
|
238
|
-
pertain to any part of the Derivative Works, in at least one
|
|
239
|
-
|
|
240
|
-
of the following places: within a NOTICE text file distributed
|
|
241
|
-
|
|
242
|
-
as part of the Derivative Works; within the Source form or
|
|
243
|
-
|
|
244
|
-
documentation, if provided along with the Derivative Works; or,
|
|
245
|
-
|
|
246
|
-
within a display generated by the Derivative Works, if and
|
|
247
|
-
|
|
248
|
-
wherever such third-party notices normally appear. The contents
|
|
249
|
-
|
|
250
|
-
of the NOTICE file are for informational purposes only and
|
|
251
|
-
|
|
252
|
-
do not modify the License. You may add Your own attribution
|
|
253
|
-
|
|
254
|
-
notices within Derivative Works that You distribute, alongside
|
|
255
|
-
|
|
256
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
257
|
-
|
|
258
|
-
that such additional attribution notices cannot be construed
|
|
259
|
-
|
|
260
|
-
as modifying the License.
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
You may add Your own copyright statement to Your modifications and
|
|
266
|
-
|
|
267
|
-
may provide additional or different license terms and conditions
|
|
268
|
-
|
|
269
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
270
|
-
|
|
271
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
272
|
-
|
|
273
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
274
|
-
|
|
275
|
-
the conditions stated in this License.
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
281
|
-
|
|
282
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
283
|
-
|
|
284
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
285
|
-
|
|
286
|
-
this License, without any additional terms or conditions.
|
|
287
|
-
|
|
288
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
289
|
-
|
|
290
|
-
the terms of any separate license agreement you may have executed
|
|
291
|
-
|
|
292
|
-
with Licensor regarding such Contributions.
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
298
|
-
|
|
299
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
300
|
-
|
|
301
|
-
except as required for reasonable and customary use in describing the
|
|
302
|
-
|
|
303
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
309
|
-
|
|
310
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
311
|
-
|
|
312
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
313
|
-
|
|
314
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
315
|
-
|
|
316
|
-
implied, including, without limitation, any warranties or conditions
|
|
317
|
-
|
|
318
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
319
|
-
|
|
320
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
321
|
-
|
|
322
|
-
appropriateness of using or redistributing the Work and assume any
|
|
323
|
-
|
|
324
|
-
risks associated with Your exercise of permissions under this License.
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
330
|
-
|
|
331
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
332
|
-
|
|
333
|
-
unless required by applicable law (such as deliberate and grossly
|
|
334
|
-
|
|
335
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
336
|
-
|
|
337
|
-
liable to You for damages, including any direct, indirect, special,
|
|
338
|
-
|
|
339
|
-
incidental, or consequential damages of any character arising as a
|
|
340
|
-
|
|
341
|
-
result of this License or out of the use or inability to use the
|
|
342
|
-
|
|
343
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
344
|
-
|
|
345
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
346
|
-
|
|
347
|
-
other commercial damages or losses), even if such Contributor
|
|
348
|
-
|
|
349
|
-
has been advised of the possibility of such damages.
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
355
|
-
|
|
356
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
357
|
-
|
|
358
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
359
|
-
|
|
360
|
-
or other liability obligations and/or rights consistent with this
|
|
361
|
-
|
|
362
|
-
License. However, in accepting such obligations, You may act only
|
|
363
|
-
|
|
364
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
365
|
-
|
|
366
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
367
|
-
|
|
368
|
-
defend, and hold each Contributor harmless for any liability
|
|
369
|
-
|
|
370
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
371
|
-
|
|
372
|
-
of your accepting any such warranty or additional liability.
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
END OF TERMS AND CONDITIONS
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
To apply the Apache License to your work, attach the following
|
|
388
|
-
|
|
389
|
-
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
390
|
-
|
|
391
|
-
replaced with your own identifying information. (Don't include
|
|
392
|
-
|
|
393
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
394
|
-
|
|
395
|
-
comment syntax for the file format. We also recommend that a
|
|
396
|
-
|
|
397
|
-
file or class name and description of purpose be included on the
|
|
398
|
-
|
|
399
|
-
same "printed page" as the copyright notice for easier
|
|
400
|
-
|
|
401
|
-
identification within third-party archives.
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
Copyright (C) 2017 Beijing Didi Infinity Technology and Development Co.,Ltd. All rights reserved.
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
412
|
-
|
|
413
|
-
you may not use this file except in compliance with the License.
|
|
414
|
-
|
|
415
|
-
You may obtain a copy of the License at
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
Unless required by applicable law or agreed to in writing, software
|
|
426
|
-
|
|
427
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
428
|
-
|
|
429
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
430
|
-
|
|
431
|
-
See the License for the specific language governing permissions and
|
|
432
|
-
|
|
433
|
-
limitations under the License.
|