@vkzstudio/muza-ui 1.0.8 → 1.0.9
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/dist/components/Button/Button.js +19 -19
- package/dist/components/Button/ButtonLoader.d.ts +7 -0
- package/dist/components/Button/ButtonLoader.d.ts.map +1 -0
- package/dist/components/Button/ButtonLoader.js +40 -0
- package/dist/components/Icons/CustomIcons.js +1 -1
- package/dist/components/ReorderableTable/ReorderableTable.js +1 -1
- package/dist/components/SwipeButton/SwipeButton.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/animation/animate/resolve-subjects.js +4 -4
- package/dist/node_modules/framer-motion/dist/es/animation/animate/subject.js +24 -24
- package/dist/node_modules/framer-motion/dist/es/animation/sequence/create.js +61 -56
- package/dist/node_modules/framer-motion/dist/es/animation/utils/create-visual-element.js +8 -8
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PopChild.js +32 -30
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/PresenceChild.js +22 -22
- package/dist/node_modules/framer-motion/dist/es/components/AnimatePresence/index.js +34 -32
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/Group.js +34 -26
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/Item.js +30 -25
- package/dist/node_modules/framer-motion/dist/es/components/Reorder/utils/auto-scroll.js +64 -0
- package/dist/node_modules/framer-motion/dist/es/context/MotionContext/utils.js +2 -2
- package/dist/node_modules/framer-motion/dist/es/events/add-pointer-event.js +3 -3
- package/dist/node_modules/framer-motion/dist/es/gestures/drag/VisualElementDragControls.js +100 -89
- package/dist/node_modules/framer-motion/dist/es/gestures/drag/index.js +11 -7
- package/dist/node_modules/framer-motion/dist/es/gestures/drag/utils/constraints.js +4 -4
- package/dist/node_modules/framer-motion/dist/es/gestures/focus.js +2 -2
- package/dist/node_modules/framer-motion/dist/es/gestures/hover.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/gestures/pan/PanSession.js +106 -59
- package/dist/node_modules/framer-motion/dist/es/gestures/pan/index.js +6 -6
- package/dist/node_modules/framer-motion/dist/es/gestures/press.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/animation/exit.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/animation/index.js +5 -5
- package/dist/node_modules/framer-motion/dist/es/motion/features/definitions.js +18 -6
- package/dist/node_modules/framer-motion/dist/es/motion/features/drag.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/motion/features/layout/MeasureLayout.js +27 -42
- package/dist/node_modules/framer-motion/dist/es/motion/features/layout.js +4 -4
- package/dist/node_modules/framer-motion/dist/es/motion/features/load-features.js +10 -7
- package/dist/node_modules/framer-motion/dist/es/motion/features/viewport/index.js +4 -4
- package/dist/node_modules/framer-motion/dist/es/motion/index.js +49 -49
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-motion-ref.js +18 -13
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-element.js +41 -40
- package/dist/node_modules/framer-motion/dist/es/motion/utils/use-visual-state.js +13 -13
- package/dist/node_modules/framer-motion/dist/es/render/dom/create-visual-element.js +6 -6
- package/dist/node_modules/framer-motion/dist/es/render/dom/use-render.js +12 -12
- package/dist/node_modules/framer-motion/dist/es/render/html/use-html-visual-state.js +3 -3
- package/dist/node_modules/framer-motion/dist/es/render/html/use-props.js +7 -7
- package/dist/node_modules/framer-motion/dist/es/render/svg/use-props.js +5 -5
- package/dist/node_modules/framer-motion/dist/es/render/svg/use-svg-visual-state.js +1 -1
- package/dist/node_modules/framer-motion/dist/es/value/use-transform.js +26 -18
- package/dist/node_modules/motion-dom/dist/es/animation/AsyncMotionValueAnimation.js +33 -30
- package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimation.js +17 -17
- package/dist/node_modules/motion-dom/dist/es/animation/NativeAnimationExtended.js +20 -19
- package/dist/node_modules/motion-dom/dist/es/animation/animate/single-value.js +10 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/motion-value.js +13 -13
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/visual-element-target.js +11 -11
- package/dist/node_modules/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.js +24 -20
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/utils/default-transitions.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/animation/utils/is-css-variable.js +7 -3
- package/dist/node_modules/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js +1 -1
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/animation/mix-values.js +2 -2
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/delta-apply.js +4 -4
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/delta-calc.js +1 -1
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/delta-remove.js +6 -6
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/DocumentProjectionNode.js +7 -4
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/create-projection-node.js +149 -149
- package/dist/node_modules/motion-dom/dist/es/projection/shared/stack.js +60 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/styles/scale-border-radius.js +1 -1
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/styles/scale-box-shadow.js +2 -2
- package/dist/node_modules/motion-dom/dist/es/projection/styles/scale-correction.js +21 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/VisualElement.js +58 -50
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/dom/DOMVisualElement.js +7 -6
- package/dist/node_modules/motion-dom/dist/es/render/dom/utils/camel-to-dash.js +6 -0
- package/dist/node_modules/motion-dom/dist/es/render/html/HTMLVisualElement.js +38 -0
- package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-styles.js +29 -0
- package/dist/node_modules/motion-dom/dist/es/render/html/utils/build-transform.js +37 -0
- package/dist/node_modules/motion-dom/dist/es/render/html/utils/scrape-motion-values.js +14 -0
- package/dist/node_modules/motion-dom/dist/es/render/svg/SVGVisualElement.js +40 -0
- package/dist/node_modules/motion-dom/dist/es/render/svg/utils/build-attrs.js +32 -0
- package/dist/node_modules/motion-dom/dist/es/render/svg/utils/path.js +15 -0
- package/dist/node_modules/motion-dom/dist/es/render/svg/utils/scrape-motion-values.js +15 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/animation-state.js +31 -31
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/is-controlling-variants.js +1 -1
- package/dist/node_modules/motion-dom/dist/es/render/utils/is-forced-motion-value.js +9 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/motion-values.js +6 -6
- package/dist/node_modules/motion-dom/dist/es/render/utils/reduced-motion/index.js +15 -0
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/setters.js +4 -4
- package/dist/node_modules/{framer-motion → motion-dom}/dist/es/utils/delay.js +2 -2
- package/dist/node_modules/motion-dom/dist/es/utils/resolve-elements.js +8 -6
- package/dist/node_modules/motion-dom/dist/es/value/types/maps/number.js +62 -42
- package/dist/node_modules/motion-dom/dist/es/value/utils/resolve-motion-value.js +7 -0
- package/dist/node_modules/motion-dom/dist/es/value/will-change/is.js +7 -0
- package/dist/node_modules/motion-utils/dist/es/errors.js +10 -9
- package/package.json +1 -1
- package/dist/node_modules/framer-motion/dist/es/animation/animate/single-value.js +0 -10
- package/dist/node_modules/framer-motion/dist/es/motion/utils/is-forced-motion-value.js +0 -8
- package/dist/node_modules/framer-motion/dist/es/projection/shared/stack.js +0 -58
- package/dist/node_modules/framer-motion/dist/es/projection/styles/scale-correction.js +0 -10
- package/dist/node_modules/framer-motion/dist/es/render/dom/utils/camel-to-dash.js +0 -4
- package/dist/node_modules/framer-motion/dist/es/render/html/HTMLVisualElement.js +0 -38
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/build-styles.js +0 -29
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/build-transform.js +0 -31
- package/dist/node_modules/framer-motion/dist/es/render/html/utils/scrape-motion-values.js +0 -12
- package/dist/node_modules/framer-motion/dist/es/render/svg/SVGVisualElement.js +0 -40
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.js +0 -23
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/path.js +0 -18
- package/dist/node_modules/framer-motion/dist/es/render/svg/utils/scrape-motion-values.js +0 -15
- package/dist/node_modules/framer-motion/dist/es/utils/reduced-motion/index.js +0 -13
- package/dist/node_modules/framer-motion/dist/es/value/use-will-change/is.js +0 -7
- package/dist/node_modules/framer-motion/dist/es/value/utils/resolve-motion-value.js +0 -7
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/visual-element-variant.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/interfaces/visual-element.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/optimized-appear/data-id.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/optimized-appear/get-appear-id.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/utils/calc-child-stagger.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/animation/animators/waapi → motion-dom/dist/es/animation}/utils/get-final-keyframe.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/animation/utils/is-transition-defined.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/events/add-dom-event.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/conversion.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/copy.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/models.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/geometry/utils.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/HTMLProjectionNode.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/node/state.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/styles/transform.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/render → motion-dom/dist/es/projection}/utils/compare-by-depth.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/utils/each-axis.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/render → motion-dom/dist/es/projection}/utils/flat-tree.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/utils/has-transform.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/projection/utils/measure.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/motion/features → motion-dom/dist/es/render}/Feature.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/html/utils/render.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/object/ObjectVisualElement.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/store.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/svg/utils/camel-case-attrs.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/svg/utils/is-svg-tag.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/svg/utils/render.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/get-variant-context.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/animation → motion-dom/dist/es/render}/utils/is-animation-controls.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/animation → motion-dom/dist/es/render}/utils/is-keyframes-target.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/is-variant-label.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es → motion-dom/dist/es/render}/utils/reduced-motion/state.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/resolve-dynamic-variants.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/resolve-variants.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es → motion-dom/dist/es/render}/utils/shallow-compare.js +0 -0
- /package/dist/node_modules/{framer-motion → motion-dom}/dist/es/render/utils/variant-props.js +0 -0
- /package/dist/node_modules/{framer-motion/dist/es/value/use-will-change → motion-dom/dist/es/value/will-change}/add-will-change.js +0 -0
|
@@ -1,79 +1,81 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { extractEventInfo as k } from "../../events/event-info.js";
|
|
5
|
-
import { convertBoxToBoundingBox as j, convertBoundingBoxToBox as T } from "../../projection/geometry/conversion.js";
|
|
6
|
-
import { calcLength as w } from "../../projection/geometry/delta-calc.js";
|
|
7
|
-
import { createBox as b } from "../../projection/geometry/models.js";
|
|
8
|
-
import { eachAxis as h } from "../../projection/utils/each-axis.js";
|
|
9
|
-
import { measurePageBox as I } from "../../projection/utils/measure.js";
|
|
10
|
-
import { getContextWindow as R } from "../../utils/get-context-window.js";
|
|
1
|
+
import { addPointerEvent as M } from "../../events/add-pointer-event.js";
|
|
2
|
+
import { extractEventInfo as S } from "../../events/event-info.js";
|
|
3
|
+
import { getContextWindow as k } from "../../utils/get-context-window.js";
|
|
11
4
|
import { isRefObject as D } from "../../utils/is-ref-object.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
5
|
+
import { PanSession as B } from "../pan/PanSession.js";
|
|
6
|
+
import { applyConstraints as j, calcRelativeConstraints as b, resolveDragElastic as T, calcViewportConstraints as w, defaultElastic as I, rebaseAxisConstraints as R, calcOrigin as W } from "./utils/constraints.js";
|
|
7
|
+
import { createBox as O } from "../../../../../motion-dom/dist/es/projection/geometry/models.js";
|
|
8
|
+
import { eachAxis as h } from "../../../../../motion-dom/dist/es/projection/utils/each-axis.js";
|
|
15
9
|
import { frame as y } from "../../../../../motion-dom/dist/es/frameloop/frame.js";
|
|
16
|
-
import { invariant as
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
10
|
+
import { invariant as K } from "../../../../../motion-utils/dist/es/errors.js";
|
|
11
|
+
import { measurePageBox as U } from "../../../../../motion-dom/dist/es/projection/utils/measure.js";
|
|
12
|
+
import { convertBoxToBoundingBox as z, convertBoundingBoxToBox as _ } from "../../../../../motion-dom/dist/es/projection/geometry/conversion.js";
|
|
13
|
+
import { addValueToWillChange as x } from "../../../../../motion-dom/dist/es/value/will-change/add-will-change.js";
|
|
14
|
+
import { animateMotionValue as F } from "../../../../../motion-dom/dist/es/animation/interfaces/motion-value.js";
|
|
15
|
+
import { addDomEvent as N } from "../../../../../motion-dom/dist/es/events/add-dom-event.js";
|
|
16
|
+
import { setDragLock as $ } from "../../../../../motion-dom/dist/es/gestures/drag/state/set-active.js";
|
|
17
|
+
import { percent as q } from "../../../../../motion-dom/dist/es/value/types/numbers/units.js";
|
|
18
|
+
import { calcLength as G } from "../../../../../motion-dom/dist/es/projection/geometry/delta-calc.js";
|
|
19
19
|
import { mixNumber as L } from "../../../../../motion-dom/dist/es/utils/mix/number.js";
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
import { isElementKeyboardAccessible as H } from "../../../../../motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.js";
|
|
21
|
+
const J = /* @__PURE__ */ new WeakMap();
|
|
22
|
+
class Et {
|
|
22
23
|
constructor(t) {
|
|
23
|
-
this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic =
|
|
24
|
+
this.openDragLock = null, this.isDragging = !1, this.currentDirection = null, this.originPoint = { x: 0, y: 0 }, this.constraints = !1, this.hasMutatedConstraints = !1, this.elastic = O(), this.latestPointerEvent = null, this.latestPanInfo = null, this.visualElement = t;
|
|
24
25
|
}
|
|
25
26
|
start(t, { snapToCursor: s = !1, distanceThreshold: n } = {}) {
|
|
26
27
|
const { presenceContext: i } = this.visualElement;
|
|
27
28
|
if (i && i.isPresent === !1)
|
|
28
29
|
return;
|
|
29
|
-
const r = (
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
const r = (o) => {
|
|
31
|
+
s ? (this.stopAnimation(), this.snapToCursor(S(o).point)) : this.pauseAnimation();
|
|
32
|
+
}, e = (o, c) => {
|
|
33
|
+
this.stopAnimation();
|
|
33
34
|
const { drag: f, dragPropagation: d, onDragStart: v } = this.getProps();
|
|
34
|
-
if (f && !d && (this.openDragLock && this.openDragLock(), this.openDragLock =
|
|
35
|
+
if (f && !d && (this.openDragLock && this.openDragLock(), this.openDragLock = $(f), !this.openDragLock))
|
|
35
36
|
return;
|
|
36
|
-
this.latestPointerEvent =
|
|
37
|
-
let P = this.getAxisMotionValue(
|
|
38
|
-
if (
|
|
37
|
+
this.latestPointerEvent = o, this.latestPanInfo = c, this.isDragging = !0, this.currentDirection = null, this.resolveConstraints(), this.visualElement.projection && (this.visualElement.projection.isAnimationBlocked = !0, this.visualElement.projection.target = void 0), h((g) => {
|
|
38
|
+
let P = this.getAxisMotionValue(g).get() || 0;
|
|
39
|
+
if (q.test(P)) {
|
|
39
40
|
const { projection: C } = this.visualElement;
|
|
40
41
|
if (C && C.layout) {
|
|
41
|
-
const V = C.layout.layoutBox[
|
|
42
|
-
V && (P =
|
|
42
|
+
const V = C.layout.layoutBox[g];
|
|
43
|
+
V && (P = G(V) * (parseFloat(P) / 100));
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
|
-
this.originPoint[
|
|
46
|
-
}), v && y.postRender(() => v(
|
|
46
|
+
this.originPoint[g] = P;
|
|
47
|
+
}), v && y.postRender(() => v(o, c)), x(this.visualElement, "transform");
|
|
47
48
|
const { animationState: E } = this.visualElement;
|
|
48
49
|
E && E.setActive("whileDrag", !0);
|
|
49
|
-
},
|
|
50
|
-
this.latestPointerEvent =
|
|
50
|
+
}, a = (o, c) => {
|
|
51
|
+
this.latestPointerEvent = o, this.latestPanInfo = c;
|
|
51
52
|
const { dragPropagation: f, dragDirectionLock: d, onDirectionLock: v, onDrag: E } = this.getProps();
|
|
52
53
|
if (!f && !this.openDragLock)
|
|
53
54
|
return;
|
|
54
|
-
const { offset:
|
|
55
|
+
const { offset: g } = c;
|
|
55
56
|
if (d && this.currentDirection === null) {
|
|
56
|
-
this.currentDirection =
|
|
57
|
+
this.currentDirection = Q(g), this.currentDirection !== null && v && v(this.currentDirection);
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
this.updateAxis("x",
|
|
60
|
-
},
|
|
61
|
-
this.latestPointerEvent =
|
|
62
|
-
},
|
|
63
|
-
var
|
|
64
|
-
return this.getAnimationState(
|
|
60
|
+
this.updateAxis("x", c.point, g), this.updateAxis("y", c.point, g), this.visualElement.render(), E && E(o, c);
|
|
61
|
+
}, l = (o, c) => {
|
|
62
|
+
this.latestPointerEvent = o, this.latestPanInfo = c, this.stop(o, c), this.latestPointerEvent = null, this.latestPanInfo = null;
|
|
63
|
+
}, m = () => h((o) => {
|
|
64
|
+
var c;
|
|
65
|
+
return this.getAnimationState(o) === "paused" && ((c = this.getAxisMotionValue(o).animation) == null ? void 0 : c.play());
|
|
65
66
|
}), { dragSnapToOrigin: u } = this.getProps();
|
|
66
|
-
this.panSession = new
|
|
67
|
+
this.panSession = new B(t, {
|
|
67
68
|
onSessionStart: r,
|
|
68
69
|
onStart: e,
|
|
69
|
-
onMove:
|
|
70
|
-
onSessionEnd:
|
|
71
|
-
resumeAnimation:
|
|
70
|
+
onMove: a,
|
|
71
|
+
onSessionEnd: l,
|
|
72
|
+
resumeAnimation: m
|
|
72
73
|
}, {
|
|
73
74
|
transformPagePoint: this.visualElement.getTransformPagePoint(),
|
|
74
75
|
dragSnapToOrigin: u,
|
|
75
76
|
distanceThreshold: n,
|
|
76
|
-
contextWindow:
|
|
77
|
+
contextWindow: k(this.visualElement),
|
|
78
|
+
element: this.visualElement.current
|
|
77
79
|
});
|
|
78
80
|
}
|
|
79
81
|
/**
|
|
@@ -85,8 +87,8 @@ class dt {
|
|
|
85
87
|
return;
|
|
86
88
|
const { velocity: e } = i;
|
|
87
89
|
this.startAnimation(e);
|
|
88
|
-
const { onDragEnd:
|
|
89
|
-
|
|
90
|
+
const { onDragEnd: a } = this.getProps();
|
|
91
|
+
a && y.postRender(() => a(n, i));
|
|
90
92
|
}
|
|
91
93
|
/**
|
|
92
94
|
* @internal
|
|
@@ -94,23 +96,32 @@ class dt {
|
|
|
94
96
|
cancel() {
|
|
95
97
|
this.isDragging = !1;
|
|
96
98
|
const { projection: t, animationState: s } = this.visualElement;
|
|
97
|
-
t && (t.isAnimationBlocked = !1), this.
|
|
99
|
+
t && (t.isAnimationBlocked = !1), this.endPanSession();
|
|
98
100
|
const { dragPropagation: n } = this.getProps();
|
|
99
101
|
!n && this.openDragLock && (this.openDragLock(), this.openDragLock = null), s && s.setActive("whileDrag", !1);
|
|
100
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Clean up the pan session without modifying other drag state.
|
|
105
|
+
* This is used during unmount to ensure event listeners are removed
|
|
106
|
+
* without affecting projection animations or drag locks.
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
endPanSession() {
|
|
110
|
+
this.panSession && this.panSession.end(), this.panSession = void 0;
|
|
111
|
+
}
|
|
101
112
|
updateAxis(t, s, n) {
|
|
102
113
|
const { drag: i } = this.getProps();
|
|
103
114
|
if (!n || !A(t, i, this.currentDirection))
|
|
104
115
|
return;
|
|
105
116
|
const r = this.getAxisMotionValue(t);
|
|
106
117
|
let e = this.originPoint[t] + n[t];
|
|
107
|
-
this.constraints && this.constraints[t] && (e =
|
|
118
|
+
this.constraints && this.constraints[t] && (e = j(e, this.constraints[t], this.elastic[t])), r.set(e);
|
|
108
119
|
}
|
|
109
120
|
resolveConstraints() {
|
|
110
121
|
var r;
|
|
111
122
|
const { dragConstraints: t, dragElastic: s } = this.getProps(), n = this.visualElement.projection && !this.visualElement.projection.layout ? this.visualElement.projection.measure(!1) : (r = this.visualElement.projection) == null ? void 0 : r.layout, i = this.constraints;
|
|
112
|
-
t && D(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && n ? this.constraints =
|
|
113
|
-
this.constraints !== !1 && this.getAxisMotionValue(e) && (this.constraints[e] =
|
|
123
|
+
t && D(t) ? this.constraints || (this.constraints = this.resolveRefConstraints()) : t && n ? this.constraints = b(n.layoutBox, t) : this.constraints = !1, this.elastic = T(s), i !== this.constraints && n && this.constraints && !this.hasMutatedConstraints && h((e) => {
|
|
124
|
+
this.constraints !== !1 && this.getAxisMotionValue(e) && (this.constraints[e] = R(n.layoutBox[e], this.constraints[e]));
|
|
114
125
|
});
|
|
115
126
|
}
|
|
116
127
|
resolveRefConstraints() {
|
|
@@ -118,42 +129,42 @@ class dt {
|
|
|
118
129
|
if (!t || !D(t))
|
|
119
130
|
return !1;
|
|
120
131
|
const n = t.current;
|
|
121
|
-
|
|
132
|
+
K(n !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.", "drag-constraints-ref");
|
|
122
133
|
const { projection: i } = this.visualElement;
|
|
123
134
|
if (!i || !i.layout)
|
|
124
135
|
return !1;
|
|
125
|
-
const r =
|
|
126
|
-
let e =
|
|
136
|
+
const r = U(n, i.root, this.visualElement.getTransformPagePoint());
|
|
137
|
+
let e = w(i.layout.layoutBox, r);
|
|
127
138
|
if (s) {
|
|
128
|
-
const
|
|
129
|
-
this.hasMutatedConstraints = !!
|
|
139
|
+
const a = s(z(e));
|
|
140
|
+
this.hasMutatedConstraints = !!a, a && (e = _(a));
|
|
130
141
|
}
|
|
131
142
|
return e;
|
|
132
143
|
}
|
|
133
144
|
startAnimation(t) {
|
|
134
|
-
const { drag: s, dragMomentum: n, dragElastic: i, dragTransition: r, dragSnapToOrigin: e, onDragTransitionEnd:
|
|
145
|
+
const { drag: s, dragMomentum: n, dragElastic: i, dragTransition: r, dragSnapToOrigin: e, onDragTransitionEnd: a } = this.getProps(), l = this.constraints || {}, m = h((u) => {
|
|
135
146
|
if (!A(u, s, this.currentDirection))
|
|
136
147
|
return;
|
|
137
|
-
let
|
|
138
|
-
e && (
|
|
139
|
-
const
|
|
148
|
+
let o = l && l[u] || {};
|
|
149
|
+
e && (o = { min: 0, max: 0 });
|
|
150
|
+
const c = i ? 200 : 1e6, f = i ? 40 : 1e7, d = {
|
|
140
151
|
type: "inertia",
|
|
141
152
|
velocity: n ? t[u] : 0,
|
|
142
|
-
bounceStiffness:
|
|
153
|
+
bounceStiffness: c,
|
|
143
154
|
bounceDamping: f,
|
|
144
155
|
timeConstant: 750,
|
|
145
156
|
restDelta: 1,
|
|
146
157
|
restSpeed: 10,
|
|
147
158
|
...r,
|
|
148
|
-
...
|
|
159
|
+
...o
|
|
149
160
|
};
|
|
150
161
|
return this.startAxisValueAnimation(u, d);
|
|
151
162
|
});
|
|
152
|
-
return Promise.all(
|
|
163
|
+
return Promise.all(m).then(a);
|
|
153
164
|
}
|
|
154
165
|
startAxisValueAnimation(t, s) {
|
|
155
166
|
const n = this.getAxisMotionValue(t);
|
|
156
|
-
return x(this.visualElement, t), n.start(
|
|
167
|
+
return x(this.visualElement, t), n.start(F(t, n, 0, s, this.visualElement, !1));
|
|
157
168
|
}
|
|
158
169
|
stopAnimation() {
|
|
159
170
|
h((t) => this.getAxisMotionValue(t).stop());
|
|
@@ -185,8 +196,8 @@ class dt {
|
|
|
185
196
|
return;
|
|
186
197
|
const { projection: i } = this.visualElement, r = this.getAxisMotionValue(s);
|
|
187
198
|
if (i && i.layout) {
|
|
188
|
-
const { min: e, max:
|
|
189
|
-
r.set(t[s] - L(e,
|
|
199
|
+
const { min: e, max: a } = i.layout.layoutBox[s], l = r.get() || 0;
|
|
200
|
+
r.set(t[s] - L(e, a, 0.5) + l);
|
|
190
201
|
}
|
|
191
202
|
});
|
|
192
203
|
}
|
|
@@ -204,44 +215,44 @@ class dt {
|
|
|
204
215
|
this.stopAnimation();
|
|
205
216
|
const i = { x: 0, y: 0 };
|
|
206
217
|
h((e) => {
|
|
207
|
-
const
|
|
208
|
-
if (
|
|
209
|
-
const
|
|
210
|
-
i[e] =
|
|
218
|
+
const a = this.getAxisMotionValue(e);
|
|
219
|
+
if (a && this.constraints !== !1) {
|
|
220
|
+
const l = a.get();
|
|
221
|
+
i[e] = W({ min: l, max: l }, this.constraints[e]);
|
|
211
222
|
}
|
|
212
223
|
});
|
|
213
224
|
const { transformTemplate: r } = this.visualElement.getProps();
|
|
214
225
|
this.visualElement.current.style.transform = r ? r({}, "") : "none", n.root && n.root.updateScroll(), n.updateLayout(), this.resolveConstraints(), h((e) => {
|
|
215
226
|
if (!A(e, t, null))
|
|
216
227
|
return;
|
|
217
|
-
const
|
|
218
|
-
|
|
228
|
+
const a = this.getAxisMotionValue(e), { min: l, max: m } = this.constraints[e];
|
|
229
|
+
a.set(L(l, m, i[e]));
|
|
219
230
|
});
|
|
220
231
|
}
|
|
221
232
|
addListeners() {
|
|
222
233
|
if (!this.visualElement.current)
|
|
223
234
|
return;
|
|
224
|
-
|
|
225
|
-
const t = this.visualElement.current, s =
|
|
226
|
-
const { drag:
|
|
227
|
-
|
|
235
|
+
J.set(this.visualElement, this);
|
|
236
|
+
const t = this.visualElement.current, s = M(t, "pointerdown", (l) => {
|
|
237
|
+
const { drag: m, dragListener: u = !0 } = this.getProps(), o = l.target, c = o !== t && H(o);
|
|
238
|
+
m && u && !c && this.start(l);
|
|
228
239
|
}), n = () => {
|
|
229
|
-
const { dragConstraints:
|
|
230
|
-
D(
|
|
240
|
+
const { dragConstraints: l } = this.getProps();
|
|
241
|
+
D(l) && l.current && (this.constraints = this.resolveRefConstraints());
|
|
231
242
|
}, { projection: i } = this.visualElement, r = i.addEventListener("measure", n);
|
|
232
243
|
i && !i.layout && (i.root && i.root.updateScroll(), i.updateLayout()), y.read(n);
|
|
233
|
-
const e =
|
|
234
|
-
this.isDragging &&
|
|
235
|
-
const
|
|
236
|
-
|
|
244
|
+
const e = N(window, "resize", () => this.scalePositionWithinConstraints()), a = i.addEventListener("didUpdate", (({ delta: l, hasLayoutChanged: m }) => {
|
|
245
|
+
this.isDragging && m && (h((u) => {
|
|
246
|
+
const o = this.getAxisMotionValue(u);
|
|
247
|
+
o && (this.originPoint[u] += l[u].translate, o.set(o.get() + l[u].translate));
|
|
237
248
|
}), this.visualElement.render());
|
|
238
249
|
}));
|
|
239
250
|
return () => {
|
|
240
|
-
e(), s(), r(),
|
|
251
|
+
e(), s(), r(), a && a();
|
|
241
252
|
};
|
|
242
253
|
}
|
|
243
254
|
getProps() {
|
|
244
|
-
const t = this.visualElement.getProps(), { drag: s = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: r = !1, dragElastic: e =
|
|
255
|
+
const t = this.visualElement.getProps(), { drag: s = !1, dragDirectionLock: n = !1, dragPropagation: i = !1, dragConstraints: r = !1, dragElastic: e = I, dragMomentum: a = !0 } = t;
|
|
245
256
|
return {
|
|
246
257
|
...t,
|
|
247
258
|
drag: s,
|
|
@@ -249,18 +260,18 @@ class dt {
|
|
|
249
260
|
dragPropagation: i,
|
|
250
261
|
dragConstraints: r,
|
|
251
262
|
dragElastic: e,
|
|
252
|
-
dragMomentum:
|
|
263
|
+
dragMomentum: a
|
|
253
264
|
};
|
|
254
265
|
}
|
|
255
266
|
}
|
|
256
267
|
function A(p, t, s) {
|
|
257
268
|
return (t === !0 || t === p) && (s === null || s === p);
|
|
258
269
|
}
|
|
259
|
-
function
|
|
270
|
+
function Q(p, t = 10) {
|
|
260
271
|
let s = null;
|
|
261
272
|
return Math.abs(p.y) > t ? s = "y" : Math.abs(p.x) > t && (s = "x"), s;
|
|
262
273
|
}
|
|
263
274
|
export {
|
|
264
|
-
|
|
265
|
-
|
|
275
|
+
Et as VisualElementDragControls,
|
|
276
|
+
J as elementDragControls
|
|
266
277
|
};
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { Feature as s } from "../../motion/features/Feature.js";
|
|
2
1
|
import { VisualElementDragControls as t } from "./VisualElementDragControls.js";
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { Feature as e } from "../../../../../motion-dom/dist/es/render/Feature.js";
|
|
3
|
+
import { noop as s } from "../../../../../motion-utils/dist/es/noop.js";
|
|
4
|
+
class m extends e {
|
|
5
5
|
constructor(o) {
|
|
6
|
-
super(o), this.removeGroupControls =
|
|
6
|
+
super(o), this.removeGroupControls = s, this.removeListeners = s, this.controls = new t(o);
|
|
7
7
|
}
|
|
8
8
|
mount() {
|
|
9
9
|
const { dragControls: o } = this.node.getProps();
|
|
10
|
-
o && (this.removeGroupControls = o.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() ||
|
|
10
|
+
o && (this.removeGroupControls = o.subscribe(this.controls)), this.removeListeners = this.controls.addListeners() || s;
|
|
11
|
+
}
|
|
12
|
+
update() {
|
|
13
|
+
const { dragControls: o } = this.node.getProps(), { dragControls: r } = this.node.prevProps || {};
|
|
14
|
+
o !== r && (this.removeGroupControls(), o && (this.removeGroupControls = o.subscribe(this.controls)));
|
|
11
15
|
}
|
|
12
16
|
unmount() {
|
|
13
|
-
this.removeGroupControls(), this.removeListeners();
|
|
17
|
+
this.removeGroupControls(), this.removeListeners(), this.controls.isDragging || this.controls.endPanSession();
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
20
|
export {
|
|
17
|
-
|
|
21
|
+
m as DragGesture
|
|
18
22
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { mixNumber as r } from "../../../../../../motion-dom/dist/es/utils/mix/number.js";
|
|
2
|
+
import { calcLength as t } from "../../../../../../motion-dom/dist/es/projection/geometry/delta-calc.js";
|
|
3
3
|
import { progress as u } from "../../../../../../motion-utils/dist/es/progress.js";
|
|
4
4
|
import { clamp as C } from "../../../../../../motion-utils/dist/es/clamp.js";
|
|
5
5
|
function a(n, { min: e, max: m }, i) {
|
|
6
|
-
return e !== void 0 && n < e ? n = i ?
|
|
6
|
+
return e !== void 0 && n < e ? n = i ? r(e, n, i.min) : Math.max(n, e) : m !== void 0 && n > m && (n = i ? r(m, n, i.max) : Math.min(n, m)), n;
|
|
7
7
|
}
|
|
8
8
|
function o(n, e, m) {
|
|
9
9
|
return {
|
|
@@ -29,7 +29,7 @@ function w(n, e) {
|
|
|
29
29
|
}
|
|
30
30
|
function y(n, e) {
|
|
31
31
|
let m = 0.5;
|
|
32
|
-
const i =
|
|
32
|
+
const i = t(n), f = t(e);
|
|
33
33
|
return f > i ? m = u(e.min, e.max - i, n.min) : i > f && (m = u(n.min, n.max - f, e.min)), C(0, 1, m);
|
|
34
34
|
}
|
|
35
35
|
function M(n, e) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Feature as i } from "../motion/features/Feature.js";
|
|
1
|
+
import { Feature as i } from "../../../../motion-dom/dist/es/render/Feature.js";
|
|
3
2
|
import { pipe as s } from "../../../../motion-utils/dist/es/pipe.js";
|
|
3
|
+
import { addDomEvent as e } from "../../../../motion-dom/dist/es/events/add-dom-event.js";
|
|
4
4
|
class a extends i {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments), this.isActive = !1;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { extractEventInfo as m } from "../events/event-info.js";
|
|
2
|
-
import { Feature as s } from "
|
|
2
|
+
import { Feature as s } from "../../../../motion-dom/dist/es/render/Feature.js";
|
|
3
3
|
import { hover as u } from "../../../../motion-dom/dist/es/gestures/hover.js";
|
|
4
4
|
import { frame as c } from "../../../../motion-dom/dist/es/frameloop/frame.js";
|
|
5
5
|
function a(e, t, r) {
|
|
@@ -1,84 +1,131 @@
|
|
|
1
|
-
import { addPointerEvent as
|
|
2
|
-
import { extractEventInfo as
|
|
3
|
-
import { distance2D as
|
|
4
|
-
import { frameData as
|
|
5
|
-
import { isPrimaryPointer as
|
|
6
|
-
import { pipe as
|
|
7
|
-
import { secondsToMilliseconds as
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { addPointerEvent as v } from "../../events/add-pointer-event.js";
|
|
2
|
+
import { extractEventInfo as W } from "../../events/event-info.js";
|
|
3
|
+
import { distance2D as D } from "../../utils/distance.js";
|
|
4
|
+
import { frameData as P, frame as x, cancelFrame as k } from "../../../../../motion-dom/dist/es/frameloop/frame.js";
|
|
5
|
+
import { isPrimaryPointer as U } from "../../../../../motion-dom/dist/es/gestures/utils/is-primary-pointer.js";
|
|
6
|
+
import { pipe as X } from "../../../../../motion-utils/dist/es/pipe.js";
|
|
7
|
+
import { secondsToMilliseconds as Y, millisecondsToSeconds as O } from "../../../../../motion-utils/dist/es/time-conversion.js";
|
|
8
|
+
const S = /* @__PURE__ */ new Set(["auto", "scroll"]);
|
|
9
|
+
class B {
|
|
10
|
+
constructor(t, i, { transformPagePoint: s, contextWindow: r = window, dragSnapToOrigin: o = !1, distanceThreshold: l = 3, element: p } = {}) {
|
|
11
|
+
if (this.startEvent = null, this.lastMoveEvent = null, this.lastMoveEventInfo = null, this.handlers = {}, this.contextWindow = window, this.scrollPositions = /* @__PURE__ */ new Map(), this.removeScrollListeners = null, this.onElementScroll = (e) => {
|
|
12
|
+
this.handleScroll(e.target);
|
|
13
|
+
}, this.onWindowScroll = () => {
|
|
14
|
+
this.handleScroll(window);
|
|
15
|
+
}, this.updatePoint = () => {
|
|
11
16
|
if (!(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
12
17
|
return;
|
|
13
|
-
const
|
|
14
|
-
if (!
|
|
18
|
+
const e = u(this.lastMoveEventInfo, this.history), h = this.startEvent !== null, c = D(e.offset, { x: 0, y: 0 }) >= this.distanceThreshold;
|
|
19
|
+
if (!h && !c)
|
|
15
20
|
return;
|
|
16
|
-
const { point:
|
|
17
|
-
this.history.push({ ...
|
|
18
|
-
const { onStart:
|
|
19
|
-
|
|
20
|
-
}, this.handlePointerMove = (
|
|
21
|
-
this.lastMoveEvent =
|
|
22
|
-
}, this.handlePointerUp = (
|
|
21
|
+
const { point: d } = e, { timestamp: f } = P;
|
|
22
|
+
this.history.push({ ...d, timestamp: f });
|
|
23
|
+
const { onStart: a, onMove: E } = this.handlers;
|
|
24
|
+
h || (a && a(this.lastMoveEvent, e), this.startEvent = this.lastMoveEvent), E && E(this.lastMoveEvent, e);
|
|
25
|
+
}, this.handlePointerMove = (e, h) => {
|
|
26
|
+
this.lastMoveEvent = e, this.lastMoveEventInfo = m(h, this.transformPagePoint), x.update(this.updatePoint, !0);
|
|
27
|
+
}, this.handlePointerUp = (e, h) => {
|
|
23
28
|
this.end();
|
|
24
|
-
const { onEnd: c, onSessionEnd:
|
|
25
|
-
if (this.dragSnapToOrigin &&
|
|
29
|
+
const { onEnd: c, onSessionEnd: d, resumeAnimation: f } = this.handlers;
|
|
30
|
+
if ((this.dragSnapToOrigin || !this.startEvent) && f && f(), !(this.lastMoveEvent && this.lastMoveEventInfo))
|
|
26
31
|
return;
|
|
27
|
-
const
|
|
28
|
-
this.startEvent && c && c(
|
|
29
|
-
}, !
|
|
32
|
+
const a = u(e.type === "pointercancel" ? this.lastMoveEventInfo : m(h, this.transformPagePoint), this.history);
|
|
33
|
+
this.startEvent && c && c(e, a), d && d(e, a);
|
|
34
|
+
}, !U(t))
|
|
30
35
|
return;
|
|
31
|
-
this.dragSnapToOrigin =
|
|
32
|
-
const g =
|
|
33
|
-
this.history = [{ ...
|
|
34
|
-
const { onSessionStart:
|
|
35
|
-
|
|
36
|
+
this.dragSnapToOrigin = o, this.handlers = i, this.transformPagePoint = s, this.distanceThreshold = l, this.contextWindow = r || window;
|
|
37
|
+
const g = W(t), w = m(g, this.transformPagePoint), { point: L } = w, { timestamp: T } = P;
|
|
38
|
+
this.history = [{ ...L, timestamp: T }];
|
|
39
|
+
const { onSessionStart: y } = i;
|
|
40
|
+
y && y(t, u(w, this.history)), this.removeListeners = X(v(this.contextWindow, "pointermove", this.handlePointerMove), v(this.contextWindow, "pointerup", this.handlePointerUp), v(this.contextWindow, "pointercancel", this.handlePointerUp)), p && this.startScrollTracking(p);
|
|
36
41
|
}
|
|
37
|
-
|
|
38
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Start tracking scroll on ancestors and window.
|
|
44
|
+
*/
|
|
45
|
+
startScrollTracking(t) {
|
|
46
|
+
let i = t.parentElement;
|
|
47
|
+
for (; i; ) {
|
|
48
|
+
const s = getComputedStyle(i);
|
|
49
|
+
(S.has(s.overflowX) || S.has(s.overflowY)) && this.scrollPositions.set(i, {
|
|
50
|
+
x: i.scrollLeft,
|
|
51
|
+
y: i.scrollTop
|
|
52
|
+
}), i = i.parentElement;
|
|
53
|
+
}
|
|
54
|
+
this.scrollPositions.set(window, {
|
|
55
|
+
x: window.scrollX,
|
|
56
|
+
y: window.scrollY
|
|
57
|
+
}), window.addEventListener("scroll", this.onElementScroll, {
|
|
58
|
+
capture: !0,
|
|
59
|
+
passive: !0
|
|
60
|
+
}), window.addEventListener("scroll", this.onWindowScroll, {
|
|
61
|
+
passive: !0
|
|
62
|
+
}), this.removeScrollListeners = () => {
|
|
63
|
+
window.removeEventListener("scroll", this.onElementScroll, {
|
|
64
|
+
capture: !0
|
|
65
|
+
}), window.removeEventListener("scroll", this.onWindowScroll);
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Handle scroll compensation during drag.
|
|
70
|
+
*
|
|
71
|
+
* For element scroll: adjusts history origin since pageX/pageY doesn't change.
|
|
72
|
+
* For window scroll: adjusts lastMoveEventInfo since pageX/pageY would change.
|
|
73
|
+
*/
|
|
74
|
+
handleScroll(t) {
|
|
75
|
+
const i = this.scrollPositions.get(t);
|
|
76
|
+
if (!i)
|
|
77
|
+
return;
|
|
78
|
+
const s = t === window, r = s ? { x: window.scrollX, y: window.scrollY } : {
|
|
79
|
+
x: t.scrollLeft,
|
|
80
|
+
y: t.scrollTop
|
|
81
|
+
}, o = { x: r.x - i.x, y: r.y - i.y };
|
|
82
|
+
o.x === 0 && o.y === 0 || (s ? this.lastMoveEventInfo && (this.lastMoveEventInfo.point.x += o.x, this.lastMoveEventInfo.point.y += o.y) : this.history.length > 0 && (this.history[0].x -= o.x, this.history[0].y -= o.y), this.scrollPositions.set(t, r), x.update(this.updatePoint, !0));
|
|
83
|
+
}
|
|
84
|
+
updateHandlers(t) {
|
|
85
|
+
this.handlers = t;
|
|
39
86
|
}
|
|
40
87
|
end() {
|
|
41
|
-
this.removeListeners && this.removeListeners(),
|
|
88
|
+
this.removeListeners && this.removeListeners(), this.removeScrollListeners && this.removeScrollListeners(), this.scrollPositions.clear(), k(this.updatePoint);
|
|
42
89
|
}
|
|
43
90
|
}
|
|
44
|
-
function
|
|
45
|
-
return
|
|
91
|
+
function m(n, t) {
|
|
92
|
+
return t ? { point: t(n.point) } : n;
|
|
46
93
|
}
|
|
47
|
-
function
|
|
48
|
-
return { x:
|
|
94
|
+
function M(n, t) {
|
|
95
|
+
return { x: n.x - t.x, y: n.y - t.y };
|
|
49
96
|
}
|
|
50
|
-
function
|
|
97
|
+
function u({ point: n }, t) {
|
|
51
98
|
return {
|
|
52
|
-
point:
|
|
53
|
-
delta:
|
|
54
|
-
offset:
|
|
55
|
-
velocity:
|
|
99
|
+
point: n,
|
|
100
|
+
delta: M(n, I(t)),
|
|
101
|
+
offset: M(n, V(t)),
|
|
102
|
+
velocity: b(t, 0.1)
|
|
56
103
|
};
|
|
57
104
|
}
|
|
58
|
-
function
|
|
59
|
-
return
|
|
105
|
+
function V(n) {
|
|
106
|
+
return n[0];
|
|
60
107
|
}
|
|
61
|
-
function
|
|
62
|
-
return
|
|
108
|
+
function I(n) {
|
|
109
|
+
return n[n.length - 1];
|
|
63
110
|
}
|
|
64
|
-
function
|
|
65
|
-
if (
|
|
111
|
+
function b(n, t) {
|
|
112
|
+
if (n.length < 2)
|
|
66
113
|
return { x: 0, y: 0 };
|
|
67
|
-
let
|
|
68
|
-
const r =
|
|
69
|
-
for (;
|
|
70
|
-
|
|
71
|
-
if (!
|
|
114
|
+
let i = n.length - 1, s = null;
|
|
115
|
+
const r = I(n);
|
|
116
|
+
for (; i >= 0 && (s = n[i], !(r.timestamp - s.timestamp > Y(t))); )
|
|
117
|
+
i--;
|
|
118
|
+
if (!s)
|
|
72
119
|
return { x: 0, y: 0 };
|
|
73
|
-
const
|
|
74
|
-
if (
|
|
120
|
+
const o = O(r.timestamp - s.timestamp);
|
|
121
|
+
if (o === 0)
|
|
75
122
|
return { x: 0, y: 0 };
|
|
76
|
-
const
|
|
77
|
-
x: (r.x -
|
|
78
|
-
y: (r.y -
|
|
123
|
+
const l = {
|
|
124
|
+
x: (r.x - s.x) / o,
|
|
125
|
+
y: (r.y - s.y) / o
|
|
79
126
|
};
|
|
80
|
-
return
|
|
127
|
+
return l.x === 1 / 0 && (l.x = 0), l.y === 1 / 0 && (l.y = 0), l;
|
|
81
128
|
}
|
|
82
129
|
export {
|
|
83
|
-
|
|
130
|
+
B as PanSession
|
|
84
131
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { addPointerEvent as m } from "../../events/add-pointer-event.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { getContextWindow as P } from "../../utils/get-context-window.js";
|
|
3
|
+
import { PanSession as h } from "./PanSession.js";
|
|
4
|
+
import { Feature as p } from "../../../../../motion-dom/dist/es/render/Feature.js";
|
|
5
5
|
import { noop as u } from "../../../../../motion-utils/dist/es/noop.js";
|
|
6
6
|
import { frame as r } from "../../../../../motion-dom/dist/es/frameloop/frame.js";
|
|
7
7
|
const s = (e) => (n, o) => {
|
|
8
8
|
e && r.postRender(() => e(n, o));
|
|
9
9
|
};
|
|
10
|
-
class v extends
|
|
10
|
+
class v extends p {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments), this.removePointerDownListener = u;
|
|
13
13
|
}
|
|
14
14
|
onPointerDown(n) {
|
|
15
|
-
this.session = new
|
|
15
|
+
this.session = new h(n, this.createPanHandlers(), {
|
|
16
16
|
transformPagePoint: this.node.getTransformPagePoint(),
|
|
17
|
-
contextWindow:
|
|
17
|
+
contextWindow: P(this.node)
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
createPanHandlers() {
|