eli-video-interview 1.2.39 → 1.2.40-alpha.10
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/esm/components/react-photo-view/Photo.css +14 -0
- package/esm/components/react-photo-view/Photo.d.ts +18 -0
- package/esm/components/react-photo-view/Photo.js +54 -0
- package/esm/components/react-photo-view/PhotoBox.css +18 -0
- package/esm/components/react-photo-view/PhotoBox.d.ts +22 -0
- package/esm/components/react-photo-view/PhotoBox.js +302 -0
- package/esm/components/react-photo-view/PhotoPage.d.ts +9 -0
- package/esm/components/react-photo-view/PhotoPage.js +77 -0
- package/esm/components/react-photo-view/PhotoProvider.d.ts +14 -0
- package/esm/components/react-photo-view/PhotoProvider.js +98 -0
- package/esm/components/react-photo-view/PhotoSlider.css +125 -0
- package/esm/components/react-photo-view/PhotoSlider.d.ts +12 -0
- package/esm/components/react-photo-view/PhotoSlider.js +262 -0
- package/esm/components/react-photo-view/PhotoView.d.ts +30 -0
- package/esm/components/react-photo-view/PhotoView.js +48 -0
- package/esm/components/react-photo-view/components/ArrowLeft.d.ts +3 -0
- package/esm/components/react-photo-view/components/ArrowLeft.js +18 -0
- package/esm/components/react-photo-view/components/ArrowRight.d.ts +3 -0
- package/esm/components/react-photo-view/components/ArrowRight.js +18 -0
- package/esm/components/react-photo-view/components/CloseIcon.d.ts +3 -0
- package/esm/components/react-photo-view/components/CloseIcon.js +16 -0
- package/esm/components/react-photo-view/components/PreventScroll.d.ts +1 -0
- package/esm/components/react-photo-view/components/PreventScroll.js +12 -0
- package/esm/components/react-photo-view/components/SlidePortal.css +10 -0
- package/esm/components/react-photo-view/components/SlidePortal.d.ts +7 -0
- package/esm/components/react-photo-view/components/SlidePortal.js +30 -0
- package/esm/components/react-photo-view/components/Spinner.css +23 -0
- package/esm/components/react-photo-view/components/Spinner.d.ts +4 -0
- package/esm/components/react-photo-view/components/Spinner.js +29 -0
- package/esm/components/react-photo-view/hooks/useAdjacentImages.d.ts +5 -0
- package/esm/components/react-photo-view/hooks/useAdjacentImages.js +14 -0
- package/esm/components/react-photo-view/hooks/useAnimationOrigin.d.ts +6 -0
- package/esm/components/react-photo-view/hooks/useAnimationOrigin.js +72 -0
- package/esm/components/react-photo-view/hooks/useAnimationPosition.d.ts +2 -0
- package/esm/components/react-photo-view/hooks/useAnimationPosition.js +28 -0
- package/esm/components/react-photo-view/hooks/useAnimationVisible.d.ts +6 -0
- package/esm/components/react-photo-view/hooks/useAnimationVisible.js +49 -0
- package/esm/components/react-photo-view/hooks/useContinuousTap.d.ts +8 -0
- package/esm/components/react-photo-view/hooks/useContinuousTap.js +36 -0
- package/esm/components/react-photo-view/hooks/useDebounceCallback.d.ts +10 -0
- package/esm/components/react-photo-view/hooks/useDebounceCallback.js +48 -0
- package/esm/components/react-photo-view/hooks/useEventListener.d.ts +1 -0
- package/esm/components/react-photo-view/hooks/useEventListener.js +18 -0
- package/esm/components/react-photo-view/hooks/useForkedVariable.d.ts +5 -0
- package/esm/components/react-photo-view/hooks/useForkedVariable.js +17 -0
- package/esm/components/react-photo-view/hooks/useInitial.d.ts +1 -0
- package/esm/components/react-photo-view/hooks/useInitial.js +9 -0
- package/esm/components/react-photo-view/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/esm/components/react-photo-view/hooks/useIsomorphicLayoutEffect.js +3 -0
- package/esm/components/react-photo-view/hooks/useMethods.d.ts +4 -0
- package/esm/components/react-photo-view/hooks/useMethods.js +35 -0
- package/esm/components/react-photo-view/hooks/useMountedRef.d.ts +3 -0
- package/esm/components/react-photo-view/hooks/useMountedRef.js +12 -0
- package/esm/components/react-photo-view/hooks/useScrollPosition.d.ts +4 -0
- package/esm/components/react-photo-view/hooks/useScrollPosition.js +157 -0
- package/esm/components/react-photo-view/hooks/useSetState.d.ts +2 -0
- package/esm/components/react-photo-view/hooks/useSetState.js +15 -0
- package/esm/components/react-photo-view/hooks/useTargetScale.d.ts +4 -0
- package/esm/components/react-photo-view/hooks/useTargetScale.js +70 -0
- package/esm/components/react-photo-view/index.d.ts +4 -0
- package/esm/components/react-photo-view/index.js +4 -0
- package/esm/components/react-photo-view/photo-context.d.ts +11 -0
- package/esm/components/react-photo-view/photo-context.js +2 -0
- package/esm/components/react-photo-view/types.d.ts +196 -0
- package/esm/components/react-photo-view/types.js +1 -0
- package/esm/components/react-photo-view/utils/edgeHandle.d.ts +15 -0
- package/esm/components/react-photo-view/utils/edgeHandle.js +40 -0
- package/esm/components/react-photo-view/utils/getMultipleTouchPosition.d.ts +5 -0
- package/esm/components/react-photo-view/utils/getMultipleTouchPosition.js +11 -0
- package/esm/components/react-photo-view/utils/getPositionOnMoveOrScale.d.ts +9 -0
- package/esm/components/react-photo-view/utils/getPositionOnMoveOrScale.js +31 -0
- package/esm/components/react-photo-view/utils/getRotateSize.d.ts +4 -0
- package/esm/components/react-photo-view/utils/getRotateSize.js +11 -0
- package/esm/components/react-photo-view/utils/getSuitableImageSize.d.ts +10 -0
- package/esm/components/react-photo-view/utils/getSuitableImageSize.js +42 -0
- package/esm/components/react-photo-view/utils/isTouchDevice.d.ts +5 -0
- package/esm/components/react-photo-view/utils/isTouchDevice.js +5 -0
- package/esm/components/react-photo-view/utils/limitTarget.d.ts +5 -0
- package/esm/components/react-photo-view/utils/limitTarget.js +12 -0
- package/esm/components/react-photo-view/variables.d.ts +48 -0
- package/esm/components/react-photo-view/variables.js +48 -0
- package/esm/constants/ai-question.d.ts +9 -0
- package/esm/constants/ai-question.js +33 -4
- package/esm/enum/ai-question.d.ts +5 -2
- package/esm/enum/ai-question.js +3 -0
- package/esm/modules/ai-ability/Root.js +15 -4
- package/esm/modules/ai-ability-select/Root.js +2 -2
- package/esm/modules/ai-ability-select/interface.d.ts +1 -0
- package/esm/modules/ai-question/components/AiAnalysis/index.js +4 -1
- package/esm/modules/ai-question/components/BootVideo/index.js +1 -1
- package/esm/modules/ai-question/components/QuestionModel/Item.js +14 -9
- package/esm/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +17 -6
- package/esm/modules/ai-question/components/QuestionUpdate/Chioce.d.ts +17 -0
- package/esm/modules/ai-question/components/QuestionUpdate/Chioce.js +97 -0
- package/esm/modules/ai-question/components/QuestionUpdate/Form.js +37 -12
- package/esm/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +14 -4
- package/esm/modules/ai-question/components/QuestionUpdate/Score.d.ts +15 -0
- package/esm/modules/ai-question/components/QuestionUpdate/Score.js +53 -0
- package/esm/modules/ai-question/components/QuestionUpdate/const.js +4 -0
- package/esm/modules/ai-question/components/QuestionUpdate/index.js +35 -17
- package/esm/modules/ai-question/components/QuestionUpdate/interface.d.ts +10 -0
- package/esm/modules/ai-question/components/QuestionUpdate/styled.d.ts +15 -0
- package/esm/modules/ai-question/components/QuestionUpdate/styled.js +56 -1
- package/esm/modules/ai-report/Root.js +1 -1
- package/esm/modules/ai-report/components/ScoreReport/Score.js +4 -1
- package/esm/modules/ai-report/components/VideoQuestion/Abilities.js +5 -3
- package/esm/modules/ai-report/components/VideoQuestion/BodyImages.d.ts +7 -0
- package/esm/modules/ai-report/components/VideoQuestion/BodyImages.js +40 -0
- package/esm/modules/ai-report/components/VideoQuestion/QuestionItem.js +9 -4
- package/esm/modules/ai-report/components/VideoQuestion/ScoreSlider.js +4 -4
- package/esm/modules/ai-report/components/VideoQuestion/SingleChoice.d.ts +8 -0
- package/esm/modules/ai-report/components/VideoQuestion/SingleChoice.js +31 -0
- package/esm/modules/ai-report/components/VideoQuestion/index.js +1 -1
- package/esm/modules/ai-report/components/VideoQuestion/interface.d.ts +2 -0
- package/esm/modules/ai-report/components/VideoQuestion/styled.d.ts +1 -0
- package/esm/modules/ai-report/components/VideoQuestion/styled.js +7 -1
- package/esm/modules/ai-report/interface.d.ts +19 -0
- package/esm/services/ai-ability.d.ts +1 -1
- package/esm/services/ai-ability.js +1 -1
- package/esm/store/ai-question/ai-analysis-store.js +0 -1
- package/lib/components/react-photo-view/Photo.css +14 -0
- package/lib/components/react-photo-view/Photo.d.ts +18 -0
- package/lib/components/react-photo-view/Photo.js +60 -0
- package/lib/components/react-photo-view/PhotoBox.css +18 -0
- package/lib/components/react-photo-view/PhotoBox.d.ts +22 -0
- package/lib/components/react-photo-view/PhotoBox.js +308 -0
- package/lib/components/react-photo-view/PhotoPage.d.ts +9 -0
- package/lib/components/react-photo-view/PhotoPage.js +79 -0
- package/lib/components/react-photo-view/PhotoProvider.d.ts +14 -0
- package/lib/components/react-photo-view/PhotoProvider.js +104 -0
- package/lib/components/react-photo-view/PhotoSlider.css +125 -0
- package/lib/components/react-photo-view/PhotoSlider.d.ts +12 -0
- package/lib/components/react-photo-view/PhotoSlider.js +268 -0
- package/lib/components/react-photo-view/PhotoView.d.ts +30 -0
- package/lib/components/react-photo-view/PhotoView.js +53 -0
- package/lib/components/react-photo-view/components/ArrowLeft.d.ts +3 -0
- package/lib/components/react-photo-view/components/ArrowLeft.js +20 -0
- package/lib/components/react-photo-view/components/ArrowRight.d.ts +3 -0
- package/lib/components/react-photo-view/components/ArrowRight.js +20 -0
- package/lib/components/react-photo-view/components/CloseIcon.d.ts +3 -0
- package/lib/components/react-photo-view/components/CloseIcon.js +18 -0
- package/lib/components/react-photo-view/components/PreventScroll.d.ts +1 -0
- package/lib/components/react-photo-view/components/PreventScroll.js +15 -0
- package/lib/components/react-photo-view/components/SlidePortal.css +10 -0
- package/lib/components/react-photo-view/components/SlidePortal.d.ts +7 -0
- package/lib/components/react-photo-view/components/SlidePortal.js +32 -0
- package/lib/components/react-photo-view/components/Spinner.css +23 -0
- package/lib/components/react-photo-view/components/Spinner.d.ts +4 -0
- package/lib/components/react-photo-view/components/Spinner.js +31 -0
- package/lib/components/react-photo-view/hooks/useAdjacentImages.d.ts +5 -0
- package/lib/components/react-photo-view/hooks/useAdjacentImages.js +17 -0
- package/lib/components/react-photo-view/hooks/useAnimationOrigin.d.ts +6 -0
- package/lib/components/react-photo-view/hooks/useAnimationOrigin.js +78 -0
- package/lib/components/react-photo-view/hooks/useAnimationPosition.d.ts +2 -0
- package/lib/components/react-photo-view/hooks/useAnimationPosition.js +34 -0
- package/lib/components/react-photo-view/hooks/useAnimationVisible.d.ts +6 -0
- package/lib/components/react-photo-view/hooks/useAnimationVisible.js +55 -0
- package/lib/components/react-photo-view/hooks/useContinuousTap.d.ts +8 -0
- package/lib/components/react-photo-view/hooks/useContinuousTap.js +42 -0
- package/lib/components/react-photo-view/hooks/useDebounceCallback.d.ts +10 -0
- package/lib/components/react-photo-view/hooks/useDebounceCallback.js +51 -0
- package/lib/components/react-photo-view/hooks/useEventListener.d.ts +1 -0
- package/lib/components/react-photo-view/hooks/useEventListener.js +21 -0
- package/lib/components/react-photo-view/hooks/useForkedVariable.d.ts +5 -0
- package/lib/components/react-photo-view/hooks/useForkedVariable.js +20 -0
- package/lib/components/react-photo-view/hooks/useInitial.d.ts +1 -0
- package/lib/components/react-photo-view/hooks/useInitial.js +12 -0
- package/lib/components/react-photo-view/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/lib/components/react-photo-view/hooks/useIsomorphicLayoutEffect.js +5 -0
- package/lib/components/react-photo-view/hooks/useMethods.d.ts +4 -0
- package/lib/components/react-photo-view/hooks/useMethods.js +38 -0
- package/lib/components/react-photo-view/hooks/useMountedRef.d.ts +3 -0
- package/lib/components/react-photo-view/hooks/useMountedRef.js +14 -0
- package/lib/components/react-photo-view/hooks/useScrollPosition.d.ts +4 -0
- package/lib/components/react-photo-view/hooks/useScrollPosition.js +163 -0
- package/lib/components/react-photo-view/hooks/useSetState.d.ts +2 -0
- package/lib/components/react-photo-view/hooks/useSetState.js +18 -0
- package/lib/components/react-photo-view/hooks/useTargetScale.d.ts +4 -0
- package/lib/components/react-photo-view/hooks/useTargetScale.js +76 -0
- package/lib/components/react-photo-view/index.d.ts +4 -0
- package/lib/components/react-photo-view/index.js +12 -0
- package/lib/components/react-photo-view/photo-context.d.ts +11 -0
- package/lib/components/react-photo-view/photo-context.js +4 -0
- package/lib/components/react-photo-view/types.d.ts +196 -0
- package/lib/components/react-photo-view/types.js +2 -0
- package/lib/components/react-photo-view/utils/edgeHandle.d.ts +15 -0
- package/lib/components/react-photo-view/utils/edgeHandle.js +45 -0
- package/lib/components/react-photo-view/utils/getMultipleTouchPosition.d.ts +5 -0
- package/lib/components/react-photo-view/utils/getMultipleTouchPosition.js +14 -0
- package/lib/components/react-photo-view/utils/getPositionOnMoveOrScale.d.ts +9 -0
- package/lib/components/react-photo-view/utils/getPositionOnMoveOrScale.js +34 -0
- package/lib/components/react-photo-view/utils/getRotateSize.d.ts +4 -0
- package/lib/components/react-photo-view/utils/getRotateSize.js +14 -0
- package/lib/components/react-photo-view/utils/getSuitableImageSize.d.ts +10 -0
- package/lib/components/react-photo-view/utils/getSuitableImageSize.js +48 -0
- package/lib/components/react-photo-view/utils/isTouchDevice.d.ts +5 -0
- package/lib/components/react-photo-view/utils/isTouchDevice.js +7 -0
- package/lib/components/react-photo-view/utils/limitTarget.d.ts +5 -0
- package/lib/components/react-photo-view/utils/limitTarget.js +17 -0
- package/lib/components/react-photo-view/variables.d.ts +48 -0
- package/lib/components/react-photo-view/variables.js +51 -0
- package/lib/constants/ai-question.d.ts +9 -0
- package/lib/constants/ai-question.js +34 -5
- package/lib/enum/ai-question.d.ts +5 -2
- package/lib/enum/ai-question.js +3 -0
- package/lib/modules/ai-ability/Root.js +15 -4
- package/lib/modules/ai-ability-select/Root.js +2 -2
- package/lib/modules/ai-ability-select/interface.d.ts +1 -0
- package/lib/modules/ai-question/components/AiAnalysis/index.js +4 -1
- package/lib/modules/ai-question/components/BootVideo/index.js +1 -1
- package/lib/modules/ai-question/components/QuestionModel/Item.js +11 -6
- package/lib/modules/ai-question/components/QuestionTemplate/AiEvaluation.js +15 -4
- package/lib/modules/ai-question/components/QuestionUpdate/Chioce.d.ts +17 -0
- package/lib/modules/ai-question/components/QuestionUpdate/Chioce.js +104 -0
- package/lib/modules/ai-question/components/QuestionUpdate/Form.js +35 -10
- package/lib/modules/ai-question/components/QuestionUpdate/RandomQuestion.js +12 -2
- package/lib/modules/ai-question/components/QuestionUpdate/Score.d.ts +15 -0
- package/lib/modules/ai-question/components/QuestionUpdate/Score.js +57 -0
- package/lib/modules/ai-question/components/QuestionUpdate/const.js +4 -0
- package/lib/modules/ai-question/components/QuestionUpdate/index.js +34 -16
- package/lib/modules/ai-question/components/QuestionUpdate/interface.d.ts +10 -0
- package/lib/modules/ai-question/components/QuestionUpdate/styled.d.ts +15 -0
- package/lib/modules/ai-question/components/QuestionUpdate/styled.js +56 -1
- package/lib/modules/ai-report/Root.js +1 -1
- package/lib/modules/ai-report/components/ScoreReport/Score.js +4 -1
- package/lib/modules/ai-report/components/VideoQuestion/Abilities.js +5 -3
- package/lib/modules/ai-report/components/VideoQuestion/BodyImages.d.ts +7 -0
- package/lib/modules/ai-report/components/VideoQuestion/BodyImages.js +45 -0
- package/lib/modules/ai-report/components/VideoQuestion/QuestionItem.js +8 -3
- package/lib/modules/ai-report/components/VideoQuestion/ScoreSlider.js +4 -4
- package/lib/modules/ai-report/components/VideoQuestion/SingleChoice.d.ts +8 -0
- package/lib/modules/ai-report/components/VideoQuestion/SingleChoice.js +33 -0
- package/lib/modules/ai-report/components/VideoQuestion/index.js +1 -1
- package/lib/modules/ai-report/components/VideoQuestion/interface.d.ts +2 -0
- package/lib/modules/ai-report/components/VideoQuestion/styled.d.ts +1 -0
- package/lib/modules/ai-report/components/VideoQuestion/styled.js +8 -2
- package/lib/modules/ai-report/interface.d.ts +19 -0
- package/lib/services/ai-ability.d.ts +1 -1
- package/lib/services/ai-ability.js +1 -1
- package/lib/store/ai-question/ai-analysis-store.js +0 -1
- package/package.json +2 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
function PreventScroll() {
|
|
5
|
+
(0, react_1.useEffect)(function () {
|
|
6
|
+
var style = document.body.style;
|
|
7
|
+
var lastOverflow = style.overflow;
|
|
8
|
+
style.overflow = 'hidden';
|
|
9
|
+
return function () {
|
|
10
|
+
style.overflow = lastOverflow;
|
|
11
|
+
};
|
|
12
|
+
}, []);
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
exports.default = PreventScroll;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './SlidePortal.css';
|
|
3
|
+
export interface ISliderPortalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
container?: HTMLElement;
|
|
5
|
+
}
|
|
6
|
+
declare function SlidePortal({ container, ...rest }: ISliderPortalProps): React.ReactPortal;
|
|
7
|
+
export default SlidePortal;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
26
|
+
var react_dom_1 = require("react-dom");
|
|
27
|
+
require("./SlidePortal.css");
|
|
28
|
+
function SlidePortal(_a) {
|
|
29
|
+
var _b = _a.container, container = _b === void 0 ? document.body : _b, rest = __rest(_a, ["container"]);
|
|
30
|
+
return (0, react_dom_1.createPortal)((0, jsx_runtime_1.jsx)("div", __assign({}, rest)), container);
|
|
31
|
+
}
|
|
32
|
+
exports.default = SlidePortal;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
@keyframes PhotoView__rotate {
|
|
2
|
+
from {
|
|
3
|
+
transform: rotate(0deg);
|
|
4
|
+
}
|
|
5
|
+
to {
|
|
6
|
+
transform: rotate(360deg);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
@keyframes PhotoView__delayIn {
|
|
10
|
+
0%,
|
|
11
|
+
50% {
|
|
12
|
+
opacity: 0;
|
|
13
|
+
}
|
|
14
|
+
100% {
|
|
15
|
+
opacity: 1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
.PhotoView__Spinner {
|
|
19
|
+
animation: PhotoView__delayIn 0.4s linear both;
|
|
20
|
+
}
|
|
21
|
+
.PhotoView__Spinner svg {
|
|
22
|
+
animation: PhotoView__rotate 0.6s linear infinite;
|
|
23
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
26
|
+
require("./Spinner.css");
|
|
27
|
+
function Spinner(_a) {
|
|
28
|
+
var className = _a.className, props = __rest(_a, ["className"]);
|
|
29
|
+
return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "PhotoView__Spinner ".concat(className) }, props, { children: (0, jsx_runtime_1.jsxs)("svg", __assign({ viewBox: "0 0 32 32", width: "36", height: "36", fill: "white" }, { children: [(0, jsx_runtime_1.jsx)("path", { opacity: ".25", d: "M16 0 A16 16 0 0 0 16 32 A16 16 0 0 0 16 0 M16 4 A12 12 0 0 1 16 28 A12 12 0 0 1 16 4" }), (0, jsx_runtime_1.jsx)("path", { d: "M16 0 A16 16 0 0 1 32 16 L28 16 A12 12 0 0 0 16 4z" })] })) })));
|
|
30
|
+
}
|
|
31
|
+
exports.default = Spinner;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
/**
|
|
5
|
+
* 截取相邻三张图片
|
|
6
|
+
*/
|
|
7
|
+
function useAdjacentImages(images, index, loop) {
|
|
8
|
+
return (0, react_1.useMemo)(function () {
|
|
9
|
+
var imageLength = images.length;
|
|
10
|
+
if (loop) {
|
|
11
|
+
var connected = images.concat(images).concat(images);
|
|
12
|
+
return connected.slice(imageLength + index - 1, imageLength + index + 2);
|
|
13
|
+
}
|
|
14
|
+
return images.slice(Math.max(index - 1, 0), Math.min(index + 2, imageLength + 1));
|
|
15
|
+
}, [images, index, loop]);
|
|
16
|
+
}
|
|
17
|
+
exports.default = useAdjacentImages;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
import type { EasingMode, OriginRectType } from '../types';
|
|
3
|
+
export default function useAnimationOrigin(visible: boolean | undefined, originRef: MutableRefObject<HTMLElement | null> | undefined, loaded: boolean, speed: number, updateEasing: (pause: boolean) => void): [
|
|
4
|
+
easingMode: EasingMode,
|
|
5
|
+
originRect: OriginRectType
|
|
6
|
+
];
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var variables_1 = require("../variables");
|
|
8
|
+
var useMethods_1 = __importDefault(require("./useMethods"));
|
|
9
|
+
var initialRect = {
|
|
10
|
+
T: 0,
|
|
11
|
+
L: 0,
|
|
12
|
+
W: 0,
|
|
13
|
+
H: 0,
|
|
14
|
+
// 图像填充方式
|
|
15
|
+
FIT: undefined,
|
|
16
|
+
};
|
|
17
|
+
function useAnimationOrigin(visible, originRef, loaded, speed, updateEasing) {
|
|
18
|
+
var _a = (0, react_1.useState)(initialRect), originRect = _a[0], updateOriginRect = _a[1];
|
|
19
|
+
// 动画状态
|
|
20
|
+
var _b = (0, react_1.useState)(0), easingMode = _b[0], updateEasingMode = _b[1];
|
|
21
|
+
var initialTime = (0, react_1.useRef)();
|
|
22
|
+
var fn = (0, useMethods_1.default)({
|
|
23
|
+
OK: function () { return visible && updateEasingMode(4); },
|
|
24
|
+
});
|
|
25
|
+
(0, react_1.useEffect)(function () {
|
|
26
|
+
// 记录初始打开的时间
|
|
27
|
+
if (!initialTime.current) {
|
|
28
|
+
initialTime.current = Date.now();
|
|
29
|
+
}
|
|
30
|
+
if (!loaded) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
handleUpdateOrigin(originRef, updateOriginRect);
|
|
34
|
+
// 打开动画处理
|
|
35
|
+
if (visible) {
|
|
36
|
+
// 小于最大允许动画时间,则执行缩放动画
|
|
37
|
+
if (Date.now() - initialTime.current < variables_1.maxWaitAnimationTime) {
|
|
38
|
+
updateEasingMode(1);
|
|
39
|
+
// 延时执行动画,保持 transition 生效
|
|
40
|
+
requestAnimationFrame(function () {
|
|
41
|
+
updateEasingMode(2);
|
|
42
|
+
requestAnimationFrame(function () { return handleToShape(3); });
|
|
43
|
+
});
|
|
44
|
+
setTimeout(fn.OK, speed);
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
// 超出则不执行
|
|
48
|
+
updateEasingMode(4);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
// 关闭动画处理
|
|
52
|
+
handleToShape(5);
|
|
53
|
+
}, [visible, loaded]);
|
|
54
|
+
function handleToShape(currentShape) {
|
|
55
|
+
updateEasing(false);
|
|
56
|
+
updateEasingMode(currentShape);
|
|
57
|
+
}
|
|
58
|
+
return [easingMode, originRect];
|
|
59
|
+
}
|
|
60
|
+
exports.default = useAnimationOrigin;
|
|
61
|
+
/**
|
|
62
|
+
* 更新缩略图位置信息
|
|
63
|
+
*/
|
|
64
|
+
function handleUpdateOrigin(originRef, updateOriginRect) {
|
|
65
|
+
var element = originRef && originRef.current;
|
|
66
|
+
if (element && element.nodeType === 1) {
|
|
67
|
+
// 获取触发时节点位置
|
|
68
|
+
var _a = element.getBoundingClientRect(), top_1 = _a.top, left = _a.left, width = _a.width, height = _a.height;
|
|
69
|
+
var isImage = element.tagName === 'IMG';
|
|
70
|
+
updateOriginRect({
|
|
71
|
+
T: top_1,
|
|
72
|
+
L: left,
|
|
73
|
+
W: width,
|
|
74
|
+
H: height,
|
|
75
|
+
FIT: isImage ? getComputedStyle(element).objectFit : undefined,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { MutableRefObject } from 'react';
|
|
2
|
+
export default function useAnimationPosition(visible: boolean | undefined, originRef: MutableRefObject<HTMLElement | null> | undefined, loaded: boolean, x: number, y: number, width: number, height: number, scale: number, speed: number, updateEasing: (pause: boolean) => void): readonly [number, number, number, number, number, 0 | 1, import("../types").EasingMode, "fill" | "contain" | "cover" | undefined];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var useAnimationOrigin_1 = __importDefault(require("./useAnimationOrigin"));
|
|
7
|
+
var useTargetScale_1 = __importDefault(require("./useTargetScale"));
|
|
8
|
+
function useAnimationPosition(visible, originRef, loaded, x, y, width, height, scale, speed, updateEasing) {
|
|
9
|
+
// 延迟更新 width/height
|
|
10
|
+
var _a = (0, useTargetScale_1.default)(width, height, scale, speed, updateEasing), autoWidth = _a[0], autoHeight = _a[1], autoScale = _a[2];
|
|
11
|
+
// 动画源处理
|
|
12
|
+
var _b = (0, useAnimationOrigin_1.default)(visible, originRef, loaded, speed, updateEasing), easingMode = _b[0], originRect = _b[1];
|
|
13
|
+
// 计算动画位置
|
|
14
|
+
var T = originRect.T, L = originRect.L, W = originRect.W, H = originRect.H, FIT = originRect.FIT;
|
|
15
|
+
// 偏移量,x: 0, y: 0 居中为初始
|
|
16
|
+
var centerWidth = window.innerWidth / 2;
|
|
17
|
+
var centerHeight = window.innerHeight / 2;
|
|
18
|
+
var offsetX = centerWidth - (width * scale) / 2;
|
|
19
|
+
var offsetY = centerHeight - (height * scale) / 2;
|
|
20
|
+
// 缩略图状态
|
|
21
|
+
var miniMode = easingMode < 3 || easingMode > 4;
|
|
22
|
+
// 有缩略图时,则为缩略图的位置,否则居中
|
|
23
|
+
var translateX = miniMode ? (W ? L : centerWidth) : x + offsetX;
|
|
24
|
+
var translateY = miniMode ? (W ? T : centerHeight) : y + offsetY;
|
|
25
|
+
// 最小值缩放
|
|
26
|
+
var minScale = W / (width * scale) || 0.01;
|
|
27
|
+
// 适应 objectFit 保持缩略图宽高比
|
|
28
|
+
var currentHeight = miniMode && FIT ? autoWidth * (H / W) : autoHeight;
|
|
29
|
+
// 初始加载情况无缩放
|
|
30
|
+
var currentScale = easingMode === 0 ? autoScale : miniMode ? minScale : autoScale;
|
|
31
|
+
var opacity = miniMode ? (FIT ? 1 : 0) : 1;
|
|
32
|
+
return [translateX, translateY, autoWidth, currentHeight, currentScale, opacity, easingMode, FIT];
|
|
33
|
+
}
|
|
34
|
+
exports.default = useAnimationPosition;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ActiveAnimationType } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* 动画关闭处理真实关闭状态
|
|
4
|
+
* 通过 onAnimationEnd 回调实现 leaveCallback
|
|
5
|
+
*/
|
|
6
|
+
export default function useAnimationVisible(visible: boolean | undefined, afterClose?: () => void): [realVisible: boolean | undefined, activeAnimation: ActiveAnimationType, onAnimationEnd: () => void];
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var useForkedVariable_1 = __importDefault(require("./useForkedVariable"));
|
|
8
|
+
/**
|
|
9
|
+
* 动画关闭处理真实关闭状态
|
|
10
|
+
* 通过 onAnimationEnd 回调实现 leaveCallback
|
|
11
|
+
*/
|
|
12
|
+
function useAnimationVisible(visible, afterClose) {
|
|
13
|
+
var _a = (0, react_1.useReducer)(function (c) { return !c; }, false), handleRender = _a[1];
|
|
14
|
+
var activeAnimation = (0, react_1.useRef)(0);
|
|
15
|
+
// 可见状态分支
|
|
16
|
+
var _b = (0, useForkedVariable_1.default)(visible, function (modify) {
|
|
17
|
+
// 可见状态:设置进入动画
|
|
18
|
+
if (visible) {
|
|
19
|
+
modify(visible);
|
|
20
|
+
activeAnimation.current = 1;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
activeAnimation.current = 2;
|
|
24
|
+
}
|
|
25
|
+
}), realVisible = _b[0], modifyRealVisible = _b[1];
|
|
26
|
+
function onAnimationEnd() {
|
|
27
|
+
// 动画结束后触发渲染
|
|
28
|
+
handleRender();
|
|
29
|
+
// 结束动画:设置隐藏状态
|
|
30
|
+
if (activeAnimation.current === 2) {
|
|
31
|
+
modifyRealVisible(false);
|
|
32
|
+
// 触发隐藏回调
|
|
33
|
+
if (afterClose) {
|
|
34
|
+
afterClose();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// 重置状态
|
|
38
|
+
activeAnimation.current = 0;
|
|
39
|
+
}
|
|
40
|
+
return [
|
|
41
|
+
/**
|
|
42
|
+
* 真实可见状态
|
|
43
|
+
*/
|
|
44
|
+
realVisible,
|
|
45
|
+
/**
|
|
46
|
+
* 正在进行的动画
|
|
47
|
+
*/
|
|
48
|
+
activeAnimation.current,
|
|
49
|
+
/**
|
|
50
|
+
* 动画结束后回调
|
|
51
|
+
*/
|
|
52
|
+
onAnimationEnd,
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
exports.default = useAnimationVisible;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare type TapFuncType<T> = (...args: T[]) => void;
|
|
2
|
+
/**
|
|
3
|
+
* 单击和双击事件处理
|
|
4
|
+
* @param singleTap - 单击事件
|
|
5
|
+
* @param doubleTap - 双击事件
|
|
6
|
+
* @return invokeTap
|
|
7
|
+
*/
|
|
8
|
+
export default function useContinuousTap<T>(singleTap: TapFuncType<T>, doubleTap: TapFuncType<T>): TapFuncType<T>;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var react_1 = require("react");
|
|
7
|
+
var useDebounceCallback_1 = __importDefault(require("./useDebounceCallback"));
|
|
8
|
+
/**
|
|
9
|
+
* 单击和双击事件处理
|
|
10
|
+
* @param singleTap - 单击事件
|
|
11
|
+
* @param doubleTap - 双击事件
|
|
12
|
+
* @return invokeTap
|
|
13
|
+
*/
|
|
14
|
+
function useContinuousTap(singleTap, doubleTap) {
|
|
15
|
+
// 当前连续点击次数
|
|
16
|
+
var continuousClick = (0, react_1.useRef)(0);
|
|
17
|
+
var debounceTap = (0, useDebounceCallback_1.default)(function () {
|
|
18
|
+
var args = [];
|
|
19
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
20
|
+
args[_i] = arguments[_i];
|
|
21
|
+
}
|
|
22
|
+
continuousClick.current = 0;
|
|
23
|
+
singleTap.apply(void 0, args);
|
|
24
|
+
}, {
|
|
25
|
+
wait: 300,
|
|
26
|
+
});
|
|
27
|
+
return function invokeTap() {
|
|
28
|
+
var args = [];
|
|
29
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
30
|
+
args[_i] = arguments[_i];
|
|
31
|
+
}
|
|
32
|
+
continuousClick.current += 1;
|
|
33
|
+
debounceTap.apply(void 0, args);
|
|
34
|
+
// 双击
|
|
35
|
+
if (continuousClick.current >= 2) {
|
|
36
|
+
debounceTap.cancel();
|
|
37
|
+
continuousClick.current = 0;
|
|
38
|
+
doubleTap.apply(void 0, args);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
exports.default = useContinuousTap;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface DebounceCallback<CallbackArguments extends any[]> {
|
|
2
|
+
(...args: CallbackArguments): void;
|
|
3
|
+
cancel: () => void;
|
|
4
|
+
}
|
|
5
|
+
export default function useDebounceCallback<CallbackArguments extends any[]>(callback: (...args: CallbackArguments) => void, { leading, maxWait, wait, }: {
|
|
6
|
+
leading?: boolean;
|
|
7
|
+
maxWait?: number;
|
|
8
|
+
wait?: number;
|
|
9
|
+
}): DebounceCallback<CallbackArguments>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
function useDebounceCallback(callback, _a) {
|
|
5
|
+
var _b = _a.leading, leading = _b === void 0 ? false : _b, maxWait = _a.maxWait, _c = _a.wait, wait = _c === void 0 ? maxWait || 0 : _c;
|
|
6
|
+
var callbackRef = (0, react_1.useRef)(callback);
|
|
7
|
+
callbackRef.current = callback;
|
|
8
|
+
var prev = (0, react_1.useRef)(0);
|
|
9
|
+
var trailingTimeout = (0, react_1.useRef)();
|
|
10
|
+
var clearTrailing = function () { return trailingTimeout.current && clearTimeout(trailingTimeout.current); };
|
|
11
|
+
var fn = (0, react_1.useCallback)(function () {
|
|
12
|
+
var args = [];
|
|
13
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
14
|
+
args[_i] = arguments[_i];
|
|
15
|
+
}
|
|
16
|
+
var now = Date.now();
|
|
17
|
+
function call() {
|
|
18
|
+
prev.current = now;
|
|
19
|
+
clearTrailing();
|
|
20
|
+
callbackRef.current.apply(null, args);
|
|
21
|
+
}
|
|
22
|
+
var last = prev.current;
|
|
23
|
+
var offset = now - last;
|
|
24
|
+
// leading
|
|
25
|
+
if (last === 0) {
|
|
26
|
+
if (leading) {
|
|
27
|
+
call();
|
|
28
|
+
}
|
|
29
|
+
prev.current = now;
|
|
30
|
+
}
|
|
31
|
+
// body
|
|
32
|
+
if (maxWait !== undefined) {
|
|
33
|
+
if (offset > maxWait) {
|
|
34
|
+
call();
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else if (offset < wait) {
|
|
39
|
+
prev.current = now;
|
|
40
|
+
}
|
|
41
|
+
// trailing
|
|
42
|
+
clearTrailing();
|
|
43
|
+
trailingTimeout.current = setTimeout(function () {
|
|
44
|
+
call();
|
|
45
|
+
prev.current = 0;
|
|
46
|
+
}, wait);
|
|
47
|
+
}, [wait, maxWait, leading]);
|
|
48
|
+
fn.cancel = clearTrailing;
|
|
49
|
+
return fn;
|
|
50
|
+
}
|
|
51
|
+
exports.default = useDebounceCallback;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useEventListener<K extends keyof WindowEventMap>(type: K | undefined, fn: (evt: WindowEventMap[K]) => void, options?: AddEventListenerOptions): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
function useEventListener(type, fn, options) {
|
|
5
|
+
var latest = (0, react_1.useRef)(fn);
|
|
6
|
+
latest.current = fn;
|
|
7
|
+
(0, react_1.useEffect)(function () {
|
|
8
|
+
function wrapper(evt) {
|
|
9
|
+
latest.current(evt);
|
|
10
|
+
}
|
|
11
|
+
if (type) {
|
|
12
|
+
window.addEventListener(type, wrapper, options);
|
|
13
|
+
}
|
|
14
|
+
return function () {
|
|
15
|
+
if (type) {
|
|
16
|
+
window.removeEventListener(type, wrapper);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}, [type]);
|
|
20
|
+
}
|
|
21
|
+
exports.default = useEventListener;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
/**
|
|
5
|
+
* 逻辑分叉变量处理
|
|
6
|
+
* 此 hook 不触发额外渲染
|
|
7
|
+
*/
|
|
8
|
+
function useForkedVariable(initial, updater) {
|
|
9
|
+
// 初始分叉变量
|
|
10
|
+
var forkedRef = (0, react_1.useRef)(initial);
|
|
11
|
+
function modify(next) {
|
|
12
|
+
forkedRef.current = next;
|
|
13
|
+
}
|
|
14
|
+
(0, react_1.useMemo)(function () {
|
|
15
|
+
// 参数变化之后同步内部分叉变量
|
|
16
|
+
updater(modify);
|
|
17
|
+
}, [initial]);
|
|
18
|
+
return [forkedRef.current, modify];
|
|
19
|
+
}
|
|
20
|
+
exports.default = useForkedVariable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function useInitial<T extends (...args: any) => any>(callback: T): ReturnType<T>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
function useInitial(callback) {
|
|
5
|
+
var current = (0, react_1.useRef)({ sign: false, fn: undefined }).current;
|
|
6
|
+
if (!current.sign) {
|
|
7
|
+
current.sign = true;
|
|
8
|
+
current.fn = callback();
|
|
9
|
+
}
|
|
10
|
+
return current.fn;
|
|
11
|
+
}
|
|
12
|
+
exports.default = useInitial;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
var isSSR = typeof window === 'undefined' || /ServerSideRendering/.test(navigator && navigator.userAgent);
|
|
5
|
+
exports.default = isSSR ? react_1.useEffect : react_1.useLayoutEffect;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
+
if (ar || !(i in from)) {
|
|
5
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
+
ar[i] = from[i];
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
var react_1 = require("react");
|
|
13
|
+
/**
|
|
14
|
+
* Hook of persistent methods
|
|
15
|
+
*/
|
|
16
|
+
function useMethods(fn) {
|
|
17
|
+
var current = (0, react_1.useRef)({
|
|
18
|
+
fn: fn,
|
|
19
|
+
curr: undefined,
|
|
20
|
+
}).current;
|
|
21
|
+
current.fn = fn;
|
|
22
|
+
if (!current.curr) {
|
|
23
|
+
var curr_1 = Object.create(null);
|
|
24
|
+
Object.keys(fn).forEach(function (key) {
|
|
25
|
+
curr_1[key] = function () {
|
|
26
|
+
var _a;
|
|
27
|
+
var args = [];
|
|
28
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
29
|
+
args[_i] = arguments[_i];
|
|
30
|
+
}
|
|
31
|
+
return (_a = current.fn[key]).call.apply(_a, __spreadArray([current.fn], args, false));
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
current.curr = curr_1;
|
|
35
|
+
}
|
|
36
|
+
return current.curr;
|
|
37
|
+
}
|
|
38
|
+
exports.default = useMethods;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var react_1 = require("react");
|
|
4
|
+
var useMountedRef = function () {
|
|
5
|
+
var mountedRef = (0, react_1.useRef)(false);
|
|
6
|
+
(0, react_1.useEffect)(function () {
|
|
7
|
+
mountedRef.current = true;
|
|
8
|
+
return function () {
|
|
9
|
+
mountedRef.current = false;
|
|
10
|
+
};
|
|
11
|
+
}, []);
|
|
12
|
+
return mountedRef;
|
|
13
|
+
};
|
|
14
|
+
exports.default = useMountedRef;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 物理滚动到具体位置
|
|
3
|
+
*/
|
|
4
|
+
export default function useScrollPosition<C extends (spatial: number) => boolean>(callbackX: C, callbackY: C, callbackS: C): (x: number, y: number, lastX: number, lastY: number, width: number, height: number, scale: number, safeScale: number, lastScale: number, rotate: number, touchedTime: number) => void;
|