Comparing version 2.4.5 to 2.4.6
@@ -1,3 +0,3 @@ | ||
import { useEffect } from 'react'; | ||
declare const useIsomorphicLayoutEffect: typeof useEffect; | ||
import { useLayoutEffect } from 'react'; | ||
declare const useIsomorphicLayoutEffect: typeof useLayoutEffect; | ||
export default useIsomorphicLayoutEffect; |
import * as React from 'react'; | ||
import { MotionStatus, StepStatus } from '../interface'; | ||
import { CSSMotionProps } from '../CSSMotion'; | ||
import type { MotionStatus, StepStatus } from '../interface'; | ||
import type { CSSMotionProps } from '../CSSMotion'; | ||
export default function useStatus(supportMotion: boolean, visible: boolean, getElement: () => HTMLElement, { motionEnter, motionAppear, motionLeave, motionDeadline, motionLeaveImmediately, onAppearPrepare, onEnterPrepare, onLeavePrepare, onAppearStart, onEnterStart, onLeaveStart, onAppearActive, onEnterActive, onLeaveActive, onAppearEnd, onEnterEnd, onLeaveEnd, onVisibleChanged, }: CSSMotionProps): [MotionStatus, StepStatus, React.CSSProperties, boolean]; |
@@ -6,4 +6,4 @@ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2"; | ||
import { useRef, useEffect } from 'react'; | ||
import useState from "rc-util/es/hooks/useState"; | ||
import { STATUS_APPEAR, STATUS_NONE, STATUS_LEAVE, STATUS_ENTER, STEP_PREPARE, STEP_START, STEP_ACTIVE } from '../interface'; | ||
import useState from './useState'; | ||
import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect'; | ||
@@ -52,4 +52,3 @@ import useStepQueue, { DoStep, SkipStep, isActive } from './useStepQueue'; | ||
var mountedRef = useRef(false); | ||
var deadlineRef = useRef(null); | ||
var destroyedRef = useRef(false); // =========================== Dom Node =========================== | ||
var deadlineRef = useRef(null); // =========================== Dom Node =========================== | ||
@@ -87,5 +86,5 @@ var cacheElementRef = useRef(null); | ||
if (canEnd !== false && !destroyedRef.current) { | ||
setStatus(STATUS_NONE); | ||
setStyle(null); | ||
if (canEnd !== false) { | ||
setStatus(STATUS_NONE, true); | ||
setStyle(null, true); | ||
} | ||
@@ -205,3 +204,2 @@ } | ||
clearTimeout(deadlineRef.current); | ||
destroyedRef.current = true; | ||
}; | ||
@@ -208,0 +206,0 @@ }, []); // Trigger `onVisibleChanged` |
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray"; | ||
import * as React from 'react'; | ||
import useState from "rc-util/es/hooks/useState"; | ||
import { STEP_PREPARE, STEP_ACTIVE, STEP_START, STEP_ACTIVATED, STEP_NONE } from '../interface'; | ||
import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect'; | ||
import useNextFrame from './useNextFrame'; | ||
import useState from './useState'; | ||
var STEP_QUEUE = [STEP_PREPARE, STEP_START, STEP_ACTIVE, STEP_ACTIVATED]; | ||
@@ -29,3 +29,3 @@ /** Skip current step */ | ||
function startQueue() { | ||
setStep(STEP_PREPARE); | ||
setStep(STEP_PREPARE, true); | ||
} | ||
@@ -41,3 +41,3 @@ | ||
// Skip when no needed | ||
setStep(nextStep); | ||
setStep(nextStep, true); | ||
} else { | ||
@@ -49,3 +49,3 @@ // Do as frame for step update | ||
if (info.isCanceled()) return; | ||
setStep(nextStep); | ||
setStep(nextStep, true); | ||
} | ||
@@ -52,0 +52,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { useEffect } from 'react'; | ||
declare const useIsomorphicLayoutEffect: typeof useEffect; | ||
import { useLayoutEffect } from 'react'; | ||
declare const useIsomorphicLayoutEffect: typeof useLayoutEffect; | ||
export default useIsomorphicLayoutEffect; |
import * as React from 'react'; | ||
import { MotionStatus, StepStatus } from '../interface'; | ||
import { CSSMotionProps } from '../CSSMotion'; | ||
import type { MotionStatus, StepStatus } from '../interface'; | ||
import type { CSSMotionProps } from '../CSSMotion'; | ||
export default function useStatus(supportMotion: boolean, visible: boolean, getElement: () => HTMLElement, { motionEnter, motionAppear, motionLeave, motionDeadline, motionLeaveImmediately, onAppearPrepare, onEnterPrepare, onLeavePrepare, onAppearStart, onEnterStart, onLeaveStart, onAppearActive, onEnterActive, onLeaveActive, onAppearEnd, onEnterEnd, onLeaveEnd, onVisibleChanged, }: CSSMotionProps): [MotionStatus, StepStatus, React.CSSProperties, boolean]; |
@@ -20,6 +20,6 @@ "use strict"; | ||
var _useState7 = _interopRequireDefault(require("rc-util/lib/hooks/useState")); | ||
var _interface = require("../interface"); | ||
var _useState7 = _interopRequireDefault(require("./useState")); | ||
var _useIsomorphicLayoutEffect = _interopRequireDefault(require("./useIsomorphicLayoutEffect")); | ||
@@ -71,4 +71,3 @@ | ||
var mountedRef = (0, React.useRef)(false); | ||
var deadlineRef = (0, React.useRef)(null); | ||
var destroyedRef = (0, React.useRef)(false); // =========================== Dom Node =========================== | ||
var deadlineRef = (0, React.useRef)(null); // =========================== Dom Node =========================== | ||
@@ -106,5 +105,5 @@ var cacheElementRef = (0, React.useRef)(null); | ||
if (canEnd !== false && !destroyedRef.current) { | ||
setStatus(_interface.STATUS_NONE); | ||
setStyle(null); | ||
if (canEnd !== false) { | ||
setStatus(_interface.STATUS_NONE, true); | ||
setStyle(null, true); | ||
} | ||
@@ -224,3 +223,2 @@ } | ||
clearTimeout(deadlineRef.current); | ||
destroyedRef.current = true; | ||
}; | ||
@@ -227,0 +225,0 @@ }, []); // Trigger `onVisibleChanged` |
@@ -17,2 +17,4 @@ "use strict"; | ||
var _useState3 = _interopRequireDefault(require("rc-util/lib/hooks/useState")); | ||
var _interface = require("../interface"); | ||
@@ -24,4 +26,2 @@ | ||
var _useState3 = _interopRequireDefault(require("./useState")); | ||
var STEP_QUEUE = [_interface.STEP_PREPARE, _interface.STEP_START, _interface.STEP_ACTIVE, _interface.STEP_ACTIVATED]; | ||
@@ -53,3 +53,3 @@ /** Skip current step */ | ||
function startQueue() { | ||
setStep(_interface.STEP_PREPARE); | ||
setStep(_interface.STEP_PREPARE, true); | ||
} | ||
@@ -65,3 +65,3 @@ | ||
// Skip when no needed | ||
setStep(nextStep); | ||
setStep(nextStep, true); | ||
} else { | ||
@@ -73,3 +73,3 @@ // Do as frame for step update | ||
if (info.isCanceled()) return; | ||
setStep(nextStep); | ||
setStep(nextStep, true); | ||
} | ||
@@ -76,0 +76,0 @@ |
{ | ||
"name": "rc-motion", | ||
"version": "2.4.5", | ||
"version": "2.4.6", | ||
"description": "React lifecycle controlled motion library", | ||
@@ -46,3 +46,3 @@ "keywords": [ | ||
"classnames": "^2.2.1", | ||
"rc-util": "^5.18.1" | ||
"rc-util": "^5.19.2" | ||
}, | ||
@@ -49,0 +49,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89852
54
1914
Updatedrc-util@^5.19.2