motion-start 0.0.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/LICENSE.md +21 -0
- package/README.md +39 -0
- package/package.json +64 -0
- package/src/animation/UseAnimatedState.svelte +86 -0
- package/src/animation/UseAnimation.svelte +61 -0
- package/src/animation/animate.ts +78 -0
- package/src/animation/animation-controls.ts +101 -0
- package/src/animation/types.ts +83 -0
- package/src/animation/use-animated-state.ts +1 -0
- package/src/animation/use-animation.ts +74 -0
- package/src/animation/utils/default-transitions.ts +70 -0
- package/src/animation/utils/easing.ts +55 -0
- package/src/animation/utils/is-animatable.ts +42 -0
- package/src/animation/utils/is-animation-controls.ts +17 -0
- package/src/animation/utils/is-keyframes-target.ts +17 -0
- package/src/animation/utils/transitions.ts +218 -0
- package/src/animation/utils/variant-resolvers.ts +15 -0
- package/src/components/AnimatePresence/AnimatePresence.svelte +180 -0
- package/src/components/AnimatePresence/PresenceChild/PresenceChild.svelte +78 -0
- package/src/components/AnimatePresence/PresenceChild/index.ts +7 -0
- package/src/components/AnimatePresence/PresenceChild/types.ts +10 -0
- package/src/components/AnimatePresence/index.ts +46 -0
- package/src/components/AnimatePresence/types.ts +79 -0
- package/src/components/AnimatePresence/use-presence.ts +90 -0
- package/src/components/AnimateSharedLayout/AnimateSharedLayout.svelte +239 -0
- package/src/components/AnimateSharedLayout/index.ts +11 -0
- package/src/components/AnimateSharedLayout/types.ts +111 -0
- package/src/components/AnimateSharedLayout/utils/batcher.ts +96 -0
- package/src/components/AnimateSharedLayout/utils/crossfader.ts +260 -0
- package/src/components/AnimateSharedLayout/utils/rotate.ts +48 -0
- package/src/components/AnimateSharedLayout/utils/stack.ts +160 -0
- package/src/components/LazyMotion/LazyMotion.svelte +82 -0
- package/src/components/LazyMotion/index.ts +42 -0
- package/src/components/LazyMotion/types.ts +58 -0
- package/src/components/MotionConfig/MotionConfig.svelte +56 -0
- package/src/components/MotionConfig/MotionConfigScaleCorrection.ts +47 -0
- package/src/components/MotionConfig/index.ts +20 -0
- package/src/components/MotionDiv.svelte +8 -0
- package/src/context/DOMcontext.ts +21 -0
- package/src/context/LayoutGroupContext.ts +13 -0
- package/src/context/LazyContext.ts +18 -0
- package/src/context/MotionConfigContext.ts +48 -0
- package/src/context/MotionContext/MotionContext.svelte +27 -0
- package/src/context/MotionContext/MotionContextProvider.svelte +22 -0
- package/src/context/MotionContext/UseCreateMotionContext.svelte +34 -0
- package/src/context/MotionContext/create.ts +1 -0
- package/src/context/MotionContext/index.ts +14 -0
- package/src/context/MotionContext/utils.ts +29 -0
- package/src/context/PresenceContext.ts +26 -0
- package/src/context/ScaleCorrectionProvider.svelte +27 -0
- package/src/context/SharedLayoutContext.ts +29 -0
- package/src/events/UseDomEvent.svelte +67 -0
- package/src/events/UsePointerEvent.svelte +76 -0
- package/src/events/event-info.ts +69 -0
- package/src/events/types.ts +15 -0
- package/src/events/use-dom-event.ts +48 -0
- package/src/events/use-pointer-event.ts +29 -0
- package/src/events/utils.ts +25 -0
- package/src/gestures/PanSession.ts +298 -0
- package/src/gestures/UseFocusGesture.svelte +31 -0
- package/src/gestures/UseGestures.svelte +17 -0
- package/src/gestures/UseHoverGesture.svelte +40 -0
- package/src/gestures/UsePanGesture.svelte +58 -0
- package/src/gestures/UseTapGesture.svelte +77 -0
- package/src/gestures/drag/UseDrag.svelte +55 -0
- package/src/gestures/drag/UseDragControls.svelte +145 -0
- package/src/gestures/drag/VisualElementDragControls.ts +632 -0
- package/src/gestures/drag/types.ts +307 -0
- package/src/gestures/drag/use-drag-controls.ts +148 -0
- package/src/gestures/drag/use-drag.ts +15 -0
- package/src/gestures/drag/utils/constraints.ts +157 -0
- package/src/gestures/drag/utils/lock.ts +69 -0
- package/src/gestures/types.ts +257 -0
- package/src/gestures/use-focus-gesture.ts +16 -0
- package/src/gestures/use-gestures.ts +2 -0
- package/src/gestures/use-hover-gesture.ts +10 -0
- package/src/gestures/use-pan-gesture.ts +22 -0
- package/src/gestures/use-tap-gesture.ts +14 -0
- package/src/gestures/utils/event-type.ts +24 -0
- package/src/gestures/utils/is-node-or-child.ts +31 -0
- package/src/index.ts +104 -0
- package/src/motion/Motion.svelte +246 -0
- package/src/motion/MotionSSR.svelte +244 -0
- package/src/motion/features/AnimationState.svelte +29 -0
- package/src/motion/features/Exit.svelte +32 -0
- package/src/motion/features/UseFeatures.svelte +39 -0
- package/src/motion/features/animations.ts +22 -0
- package/src/motion/features/definitions.ts +49 -0
- package/src/motion/features/drag.ts +24 -0
- package/src/motion/features/gestures.ts +24 -0
- package/src/motion/features/layout/Animate.svelte +314 -0
- package/src/motion/features/layout/Animate.ts +9 -0
- package/src/motion/features/layout/AnimateLayoutContextProvider.svelte +14 -0
- package/src/motion/features/layout/Measure.svelte +98 -0
- package/src/motion/features/layout/Measure.ts +9 -0
- package/src/motion/features/layout/MeasureContextProvider.svelte +32 -0
- package/src/motion/features/layout/index.ts +20 -0
- package/src/motion/features/layout/types.ts +71 -0
- package/src/motion/features/layout/utils.ts +40 -0
- package/src/motion/features/types.ts +53 -0
- package/src/motion/features/use-features.ts +16 -0
- package/src/motion/index.ts +64 -0
- package/src/motion/types.ts +278 -0
- package/src/motion/utils/UseLayoutId.svelte +18 -0
- package/src/motion/utils/UseVisualElement.svelte +104 -0
- package/src/motion/utils/UseVisualState.svelte +137 -0
- package/src/motion/utils/is-forced-motion-value.ts +23 -0
- package/src/motion/utils/make-renderless-component.ts +17 -0
- package/src/motion/utils/should-inhert-variant.ts +6 -0
- package/src/motion/utils/use-motion-ref.ts +41 -0
- package/src/motion/utils/use-visual-element.ts +13 -0
- package/src/motion/utils/use-visual-state.ts +24 -0
- package/src/motion/utils/valid-prop.ts +80 -0
- package/src/render/dom/M.svelte +16 -0
- package/src/render/dom/UseRender.svelte +37 -0
- package/src/render/dom/create-motion-class.ts +12 -0
- package/src/render/dom/create-visual-element.ts +22 -0
- package/src/render/dom/featureBundle.ts +22 -0
- package/src/render/dom/motion-minimal.ts +22 -0
- package/src/render/dom/motion-proxy.ts +107 -0
- package/src/render/dom/motion.ts +62 -0
- package/src/render/dom/projection/convert-to-relative.ts +40 -0
- package/src/render/dom/projection/default-scale-correctors.ts +138 -0
- package/src/render/dom/projection/measure.ts +28 -0
- package/src/render/dom/projection/relative-set.ts +27 -0
- package/src/render/dom/projection/scale-correction.ts +22 -0
- package/src/render/dom/projection/types.ts +13 -0
- package/src/render/dom/projection/utils.ts +69 -0
- package/src/render/dom/svg-visual-element.ts +114 -0
- package/src/render/dom/types.ts +32 -0
- package/src/render/dom/use-render.ts +11 -0
- package/src/render/dom/utils/UseInitialMotionProps.svelte +26 -0
- package/src/render/dom/utils/batch-layout.ts +77 -0
- package/src/render/dom/utils/camel-to-dash.ts +20 -0
- package/src/render/dom/utils/create-config.ts +33 -0
- package/src/render/dom/utils/css-variables-conversion.ts +121 -0
- package/src/render/dom/utils/filter-props.ts +55 -0
- package/src/render/dom/utils/is-css-variable.ts +18 -0
- package/src/render/dom/utils/is-svg-component.ts +41 -0
- package/src/render/dom/utils/parse-dom-variant.ts +26 -0
- package/src/render/dom/utils/unit-conversion.ts +258 -0
- package/src/render/dom/utils/use-html-props.ts +2 -0
- package/src/render/dom/utils/use-svg-props.ts +1 -0
- package/src/render/dom/value-types/animatable-none.ts +24 -0
- package/src/render/dom/value-types/defaults.ts +30 -0
- package/src/render/dom/value-types/dimensions.ts +27 -0
- package/src/render/dom/value-types/find.ts +31 -0
- package/src/render/dom/value-types/get-as-type.ts +21 -0
- package/src/render/dom/value-types/number.ts +83 -0
- package/src/render/dom/value-types/test.ts +17 -0
- package/src/render/dom/value-types/type-auto.ts +21 -0
- package/src/render/dom/value-types/type-int.ts +23 -0
- package/src/render/dom/value-types/types.ts +8 -0
- package/src/render/html/UseHTMLProps.svelte +33 -0
- package/src/render/html/UseInitialMotionValues.svelte +27 -0
- package/src/render/html/UseStyle.svelte +47 -0
- package/src/render/html/config-motion.ts +23 -0
- package/src/render/html/supported-elements.ts +10 -0
- package/src/render/html/types.ts +64 -0
- package/src/render/html/use-props.ts +14 -0
- package/src/render/html/utils/build-projection-transform.ts +53 -0
- package/src/render/html/utils/build-styles.ts +121 -0
- package/src/render/html/utils/build-transform.ts +79 -0
- package/src/render/html/utils/create-render-state.ts +18 -0
- package/src/render/html/utils/render.ts +22 -0
- package/src/render/html/utils/scrape-motion-values.ts +26 -0
- package/src/render/html/utils/transform.ts +51 -0
- package/src/render/html/visual-element.ts +129 -0
- package/src/render/index.ts +703 -0
- package/src/render/svg/UseSVGProps.svelte +34 -0
- package/src/render/svg/config-motion.ts +51 -0
- package/src/render/svg/lowercase-elements.ts +35 -0
- package/src/render/svg/supported-elements.ts +10 -0
- package/src/render/svg/types.ts +51 -0
- package/src/render/svg/use-props.ts +14 -0
- package/src/render/svg/utils/build-attrs.ts +58 -0
- package/src/render/svg/utils/camel-case-attrs.ts +27 -0
- package/src/render/svg/utils/create-render-state.ts +17 -0
- package/src/render/svg/utils/path.ts +49 -0
- package/src/render/svg/utils/render.ts +22 -0
- package/src/render/svg/utils/scrape-motion-values.ts +26 -0
- package/src/render/svg/utils/transform-origin.ts +30 -0
- package/src/render/svg/visual-element.ts +44 -0
- package/src/render/types.ts +148 -0
- package/src/render/utils/animation-state.ts +375 -0
- package/src/render/utils/animation.ts +167 -0
- package/src/render/utils/compare-by-depth.ts +18 -0
- package/src/render/utils/flat-tree.ts +35 -0
- package/src/render/utils/is-draggable.ts +17 -0
- package/src/render/utils/lifecycles.ts +172 -0
- package/src/render/utils/motion-values.ts +59 -0
- package/src/render/utils/projection.ts +38 -0
- package/src/render/utils/setters.ts +910 -0
- package/src/render/utils/state.ts +113 -0
- package/src/render/utils/types.ts +12 -0
- package/src/render/utils/variants.ts +76 -0
- package/src/types/geometry.ts +91 -0
- package/src/types.ts +1088 -0
- package/src/utils/UseUnmountEffect.svelte +11 -0
- package/src/utils/array.ts +18 -0
- package/src/utils/each-axis.ts +15 -0
- package/src/utils/errors.ts +22 -0
- package/src/utils/fix-process-env.ts +22 -0
- package/src/utils/geometry/delta-apply.ts +162 -0
- package/src/utils/geometry/delta-calc.ts +89 -0
- package/src/utils/geometry/index.ts +83 -0
- package/src/utils/is-browser.ts +12 -0
- package/src/utils/is-numerical-string.ts +15 -0
- package/src/utils/is-ref-object.ts +16 -0
- package/src/utils/noop.ts +15 -0
- package/src/utils/resolve-value.ts +23 -0
- package/src/utils/shallow-compare.ts +23 -0
- package/src/utils/subscription-manager.ts +49 -0
- package/src/utils/time-conversion.ts +18 -0
- package/src/utils/transform.ts +120 -0
- package/src/utils/use-constant.ts +23 -0
- package/src/utils/use-cycle.ts +78 -0
- package/src/utils/use-force-update.ts +7 -0
- package/src/utils/use-isomorphic-effect.ts +8 -0
- package/src/utils/use-reduced-motion.ts +70 -0
- package/src/utils/use-unmount-effect.ts +8 -0
- package/src/value/index.ts +409 -0
- package/src/value/scroll/use-element-scroll.ts +73 -0
- package/src/value/scroll/use-viewport-scroll.ts +81 -0
- package/src/value/scroll/utils.ts +76 -0
- package/src/value/use-combine-values.ts +53 -0
- package/src/value/use-motion-template.ts +57 -0
- package/src/value/use-motion-value.ts +27 -0
- package/src/value/use-spring.ts +84 -0
- package/src/value/use-transform.ts +216 -0
- package/src/value/use-velocity.ts +44 -0
- package/src/value/utils/is-motion-value.ts +15 -0
- package/src/value/utils/resolve-motion-value.ts +29 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
based on framer-motion@4.1.17,
|
|
3
|
+
Copyright (c) 2018 Framer B.V.
|
|
4
|
+
*/
|
|
5
|
+
import type { AxisBox2D, BoxDelta, Point2D } from "../../types/geometry.js";
|
|
6
|
+
/**
|
|
7
|
+
* Represents the size and position we want to project a given visual
|
|
8
|
+
* element into.
|
|
9
|
+
*/
|
|
10
|
+
export interface TargetProjection {
|
|
11
|
+
/**
|
|
12
|
+
* Whether we should attempt to project into this target box.
|
|
13
|
+
*/
|
|
14
|
+
isEnabled: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Whether we should attempt to project into this target box.
|
|
17
|
+
*/
|
|
18
|
+
isHydrated: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether this target box is locked. We might want to lock the box, for
|
|
21
|
+
* instance if the user is dragging or animating it. Otherwise
|
|
22
|
+
* we want to rebase the target box ontop of the measured layout.
|
|
23
|
+
*/
|
|
24
|
+
isTargetLocked: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The parent-relative box we want to derive the viewport box from, if defined.
|
|
27
|
+
* This is currently all relative to the top/left of the parent box,
|
|
28
|
+
* but could be expanded in the future.
|
|
29
|
+
*/
|
|
30
|
+
relativeTarget?: AxisBox2D;
|
|
31
|
+
/**
|
|
32
|
+
* The viewport-relative box we want to project the element into.
|
|
33
|
+
*/
|
|
34
|
+
target: AxisBox2D;
|
|
35
|
+
/**
|
|
36
|
+
* The viewport-relative box we want to project the element into after
|
|
37
|
+
* it's had x/y/scale transforms applied.
|
|
38
|
+
*/
|
|
39
|
+
targetFinal: AxisBox2D;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Data about the element's current layout. Contains the latest measurements
|
|
43
|
+
* as well as the latest calculations of how to project from this layout
|
|
44
|
+
* into a given TargetProjection.
|
|
45
|
+
*/
|
|
46
|
+
export interface LayoutState {
|
|
47
|
+
/**
|
|
48
|
+
* Whether we've hydrated this state with the latest measurements.
|
|
49
|
+
*/
|
|
50
|
+
isHydrated: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The latest viewport-box measurements of the element without transforms.
|
|
53
|
+
*/
|
|
54
|
+
layout: AxisBox2D;
|
|
55
|
+
/**
|
|
56
|
+
* The measured viewport box as corrected by parent transforms up the
|
|
57
|
+
* visual element tree.
|
|
58
|
+
*/
|
|
59
|
+
layoutCorrected: AxisBox2D;
|
|
60
|
+
/**
|
|
61
|
+
* The cumulative tree scale for this element. This starts at 1 per axis.
|
|
62
|
+
* When a transform is applied to an element we also apply it to the tree scale.
|
|
63
|
+
* The final value is used for scale-correcting values like border-radius,
|
|
64
|
+
* as well as ensuring calculated CSS translations are applied to compensate
|
|
65
|
+
* for this scale.
|
|
66
|
+
*/
|
|
67
|
+
treeScale: Point2D;
|
|
68
|
+
/**
|
|
69
|
+
* A mutable piece of data that we write into the latest projection calculations
|
|
70
|
+
* that, when applied to an element, will project it from its layoutCorrected
|
|
71
|
+
* box into the provided TargetProjection.target
|
|
72
|
+
*/
|
|
73
|
+
delta: BoxDelta;
|
|
74
|
+
/**
|
|
75
|
+
* A mutable piece of data that will project an element from layoutCorrected
|
|
76
|
+
* into TargetProjection.targetFinal.
|
|
77
|
+
*/
|
|
78
|
+
deltaFinal: BoxDelta;
|
|
79
|
+
/**
|
|
80
|
+
* The latest generated delta transform. This is used to compare against
|
|
81
|
+
* the previously-generated transform to determine whether we need to trigger
|
|
82
|
+
* a render.
|
|
83
|
+
*/
|
|
84
|
+
deltaTransform: string;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
based on framer-motion@4.0.3,
|
|
90
|
+
Copyright (c) 2018 Framer B.V.
|
|
91
|
+
*/
|
|
92
|
+
import { axisBox, delta } from '../../utils/geometry/index.js';
|
|
93
|
+
|
|
94
|
+
var createProjectionState = function () { return ({
|
|
95
|
+
isEnabled: false,
|
|
96
|
+
isTargetLocked: false,
|
|
97
|
+
target: axisBox(),
|
|
98
|
+
targetFinal: axisBox(),
|
|
99
|
+
} as TargetProjection); };
|
|
100
|
+
function createLayoutState() {
|
|
101
|
+
return {
|
|
102
|
+
isHydrated: false,
|
|
103
|
+
layout: axisBox(),
|
|
104
|
+
layoutCorrected: axisBox(),
|
|
105
|
+
treeScale: { x: 1, y: 1 },
|
|
106
|
+
delta: delta(),
|
|
107
|
+
deltaFinal: delta(),
|
|
108
|
+
deltaTransform: "",
|
|
109
|
+
} as LayoutState;
|
|
110
|
+
}
|
|
111
|
+
var zeroLayout = createLayoutState();
|
|
112
|
+
|
|
113
|
+
export { createLayoutState, createProjectionState, zeroLayout };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
based on framer-motion@4.1.17,
|
|
3
|
+
Copyright (c) 2018 Framer B.V.
|
|
4
|
+
*/
|
|
5
|
+
import type { MotionProps } from "../../motion/types";
|
|
6
|
+
import type { TargetAndTransition, TargetResolver } from "../../types";
|
|
7
|
+
import type { ResolvedValues, VisualElement } from "../types";
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
based on framer-motion@4.0.3,
|
|
12
|
+
Copyright (c) 2018 Framer B.V.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Decides if the supplied variable is an array of variant labels
|
|
16
|
+
*/
|
|
17
|
+
function isVariantLabels(v: unknown): v is string[] {
|
|
18
|
+
return Array.isArray(v);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Decides if the supplied variable is variant label
|
|
22
|
+
*/
|
|
23
|
+
function isVariantLabel(v: unknown): v is string | string[] {
|
|
24
|
+
return typeof v === "string" || isVariantLabels(v);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates an object containing the latest state of every MotionValue on a VisualElement
|
|
28
|
+
*/
|
|
29
|
+
function getCurrent(visualElement) {
|
|
30
|
+
var current = {};
|
|
31
|
+
visualElement.forEachValue(function (value, key) { return (current[key] = value.get()); });
|
|
32
|
+
return current;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Creates an object containing the latest velocity of every MotionValue on a VisualElement
|
|
36
|
+
*/
|
|
37
|
+
function getVelocity(visualElement) {
|
|
38
|
+
var velocity = {};
|
|
39
|
+
visualElement.forEachValue(function (value, key) { return (velocity[key] = value.getVelocity()); });
|
|
40
|
+
return velocity;
|
|
41
|
+
}
|
|
42
|
+
function resolveVariantFromProps(props: MotionProps, definition: TargetAndTransition | TargetResolver, custom?: any, currentValues?: ResolvedValues, currentVelocity?: ResolvedValues): TargetAndTransition;
|
|
43
|
+
function resolveVariantFromProps(props: MotionProps, definition?: string | TargetAndTransition | TargetResolver, custom?: any, currentValues?: ResolvedValues, currentVelocity?: ResolvedValues): undefined | TargetAndTransition;
|
|
44
|
+
function resolveVariantFromProps(props: MotionProps, definition?: string | TargetAndTransition | TargetResolver, custom?: any, currentValues?: ResolvedValues, currentVelocity?: ResolvedValues) {
|
|
45
|
+
var _a;
|
|
46
|
+
if (currentValues === void 0) { currentValues = {}; }
|
|
47
|
+
if (currentVelocity === void 0) { currentVelocity = {}; }
|
|
48
|
+
if (typeof definition === "string") {
|
|
49
|
+
definition = (_a = props.variants) === null || _a === void 0 ? void 0 : _a[definition];
|
|
50
|
+
}
|
|
51
|
+
return typeof definition === "function"
|
|
52
|
+
? definition(custom !== null && custom !== void 0 ? custom : props.custom, currentValues, currentVelocity)
|
|
53
|
+
: definition;
|
|
54
|
+
}
|
|
55
|
+
function resolveVariant(visualElement: VisualElement, definition: TargetAndTransition | TargetResolver, custom?: any): TargetAndTransition;
|
|
56
|
+
function resolveVariant(visualElement: VisualElement, definition?: string | TargetAndTransition | TargetResolver, custom?: any): TargetAndTransition | undefined;
|
|
57
|
+
function resolveVariant(visualElement: VisualElement, definition?: string | TargetAndTransition | TargetResolver, custom?: any) {
|
|
58
|
+
var props = visualElement.getProps();
|
|
59
|
+
return resolveVariantFromProps(props, definition, custom !== null && custom !== void 0 ? custom : props.custom, getCurrent(visualElement), getVelocity(visualElement));
|
|
60
|
+
}
|
|
61
|
+
function checkIfControllingVariants(props: MotionProps) {
|
|
62
|
+
var _a;
|
|
63
|
+
return (typeof ((_a = props.animate) === null || _a === void 0 ? void 0 : _a.start) === "function" ||
|
|
64
|
+
isVariantLabel(props.initial) ||
|
|
65
|
+
isVariantLabel(props.animate) ||
|
|
66
|
+
isVariantLabel(props.whileHover) ||
|
|
67
|
+
isVariantLabel(props.whileDrag) ||
|
|
68
|
+
isVariantLabel(props.whileTap) ||
|
|
69
|
+
isVariantLabel(props.whileFocus) ||
|
|
70
|
+
isVariantLabel(props.exit));
|
|
71
|
+
}
|
|
72
|
+
function checkIfVariantNode(props: MotionProps) {
|
|
73
|
+
return Boolean(checkIfControllingVariants(props) || props.variants);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { checkIfControllingVariants, checkIfVariantNode, isVariantLabel, isVariantLabels, resolveVariant, resolveVariantFromProps };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
based on framer-motion@4.1.17,
|
|
3
|
+
Copyright (c) 2018 Framer B.V.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* A typically user-facing description of a bounding box using traditional t/l/r/b
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
10
|
+
export interface BoundingBox2D {
|
|
11
|
+
top: number;
|
|
12
|
+
left: number;
|
|
13
|
+
bottom: number;
|
|
14
|
+
right: number;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A 3D bounding box
|
|
18
|
+
*
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export interface BoundingBox3D extends BoundingBox2D {
|
|
22
|
+
front: number;
|
|
23
|
+
back: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A description of a single axis using non-axis specific terms to denote the min and max
|
|
27
|
+
* value of any axis.
|
|
28
|
+
*
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export interface Axis {
|
|
32
|
+
min: number;
|
|
33
|
+
max: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A description of a bounding box describing each axis individually. This allows us
|
|
37
|
+
* to treate each axis generically.
|
|
38
|
+
*
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export interface AxisBox2D {
|
|
42
|
+
x: Axis;
|
|
43
|
+
y: Axis;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* @public
|
|
47
|
+
*/
|
|
48
|
+
export interface AxisBox3D extends AxisBox2D {
|
|
49
|
+
z: Axis;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* A description of a two-dimensional point
|
|
53
|
+
*
|
|
54
|
+
* @public
|
|
55
|
+
*/
|
|
56
|
+
export interface Point2D {
|
|
57
|
+
x: number;
|
|
58
|
+
y: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* A description of a three-dimensional point
|
|
62
|
+
*
|
|
63
|
+
* @public
|
|
64
|
+
*/
|
|
65
|
+
export interface Point3D extends Point2D {
|
|
66
|
+
z: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* A function that accepts a two-dimensional point and returns a new one.
|
|
70
|
+
*
|
|
71
|
+
* @public
|
|
72
|
+
*/
|
|
73
|
+
export type TransformPoint2D = (point: Point2D) => Point2D;
|
|
74
|
+
/**
|
|
75
|
+
* The transform delta that, when applied to Axis a will visually transform it to Axis b
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export interface AxisDelta {
|
|
79
|
+
translate: number;
|
|
80
|
+
scale: number;
|
|
81
|
+
origin: number;
|
|
82
|
+
originPoint: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The transform delta that, when applied to Box a will visually transform it to Box b.
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
export interface BoxDelta {
|
|
89
|
+
x: AxisDelta;
|
|
90
|
+
y: AxisDelta;
|
|
91
|
+
}
|