motion-dom 12.4.4 → 12.4.5
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/cjs/index.js
CHANGED
|
@@ -373,6 +373,18 @@ function hover(elementOrSelector, onHoverStart, options = {}) {
|
|
|
373
373
|
return cancel;
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
+
function capturePointer(event, action) {
|
|
377
|
+
const actionName = `${action}PointerCapture`;
|
|
378
|
+
if (event.target instanceof Element &&
|
|
379
|
+
actionName in event.target &&
|
|
380
|
+
event.pointerId !== undefined) {
|
|
381
|
+
try {
|
|
382
|
+
event.target[actionName](event.pointerId);
|
|
383
|
+
}
|
|
384
|
+
catch (e) { }
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
|
|
376
388
|
/**
|
|
377
389
|
* Recursively traverse up the tree to check whether the provided child node
|
|
378
390
|
* is the parent or a descendant of it.
|
|
@@ -491,23 +503,12 @@ function press(targetOrSelector, onPressStart, options = {}) {
|
|
|
491
503
|
if (!target || !isValidPressEvent(startEvent) || isPressing.has(target))
|
|
492
504
|
return;
|
|
493
505
|
isPressing.add(target);
|
|
494
|
-
|
|
495
|
-
try {
|
|
496
|
-
target.setPointerCapture(startEvent.pointerId);
|
|
497
|
-
}
|
|
498
|
-
catch (e) { }
|
|
499
|
-
}
|
|
506
|
+
capturePointer(startEvent, "set");
|
|
500
507
|
const onPressEnd = onPressStart(target, startEvent);
|
|
501
508
|
const onPointerEnd = (endEvent, success) => {
|
|
502
509
|
target.removeEventListener("pointerup", onPointerUp);
|
|
503
510
|
target.removeEventListener("pointercancel", onPointerCancel);
|
|
504
|
-
|
|
505
|
-
endEvent.pointerId !== undefined) {
|
|
506
|
-
try {
|
|
507
|
-
target.releasePointerCapture(endEvent.pointerId);
|
|
508
|
-
}
|
|
509
|
-
catch (e) { }
|
|
510
|
-
}
|
|
511
|
+
capturePointer(endEvent, "release");
|
|
511
512
|
if (!isValidPressEvent(endEvent) || !isPressing.has(target)) {
|
|
512
513
|
return;
|
|
513
514
|
}
|
|
@@ -914,6 +915,7 @@ exports.NativeAnimationControls = NativeAnimationControls;
|
|
|
914
915
|
exports.ViewTransitionBuilder = ViewTransitionBuilder;
|
|
915
916
|
exports.attachTimeline = attachTimeline;
|
|
916
917
|
exports.calcGeneratorDuration = calcGeneratorDuration;
|
|
918
|
+
exports.capturePointer = capturePointer;
|
|
917
919
|
exports.createGeneratorEasing = createGeneratorEasing;
|
|
918
920
|
exports.cubicBezierAsString = cubicBezierAsString;
|
|
919
921
|
exports.generateLinearEasing = generateLinearEasing;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isDragActive } from '../drag/state/is-active.mjs';
|
|
2
|
+
import { capturePointer } from '../utils/capture-pointer.mjs';
|
|
2
3
|
import { isNodeOrChild } from '../utils/is-node-or-child.mjs';
|
|
3
4
|
import { isPrimaryPointer } from '../utils/is-primary-pointer.mjs';
|
|
4
5
|
import { setupGesture } from '../utils/setup.mjs';
|
|
@@ -39,23 +40,12 @@ function press(targetOrSelector, onPressStart, options = {}) {
|
|
|
39
40
|
if (!target || !isValidPressEvent(startEvent) || isPressing.has(target))
|
|
40
41
|
return;
|
|
41
42
|
isPressing.add(target);
|
|
42
|
-
|
|
43
|
-
try {
|
|
44
|
-
target.setPointerCapture(startEvent.pointerId);
|
|
45
|
-
}
|
|
46
|
-
catch (e) { }
|
|
47
|
-
}
|
|
43
|
+
capturePointer(startEvent, "set");
|
|
48
44
|
const onPressEnd = onPressStart(target, startEvent);
|
|
49
45
|
const onPointerEnd = (endEvent, success) => {
|
|
50
46
|
target.removeEventListener("pointerup", onPointerUp);
|
|
51
47
|
target.removeEventListener("pointercancel", onPointerCancel);
|
|
52
|
-
|
|
53
|
-
endEvent.pointerId !== undefined) {
|
|
54
|
-
try {
|
|
55
|
-
target.releasePointerCapture(endEvent.pointerId);
|
|
56
|
-
}
|
|
57
|
-
catch (e) { }
|
|
58
|
-
}
|
|
48
|
+
capturePointer(endEvent, "release");
|
|
59
49
|
if (!isValidPressEvent(endEvent) || !isPressing.has(target)) {
|
|
60
50
|
return;
|
|
61
51
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function capturePointer(event, action) {
|
|
2
|
+
const actionName = `${action}PointerCapture`;
|
|
3
|
+
if (event.target instanceof Element &&
|
|
4
|
+
actionName in event.target &&
|
|
5
|
+
event.pointerId !== undefined) {
|
|
6
|
+
try {
|
|
7
|
+
event.target[actionName](event.pointerId);
|
|
8
|
+
}
|
|
9
|
+
catch (e) { }
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { capturePointer };
|
package/dist/es/index.mjs
CHANGED
|
@@ -9,6 +9,7 @@ export { cubicBezierAsString, isWaapiSupportedEasing, mapEasingToNativeEasing, s
|
|
|
9
9
|
export { generateLinearEasing } from './animation/waapi/utils/linear.mjs';
|
|
10
10
|
export { hover } from './gestures/hover.mjs';
|
|
11
11
|
export { press } from './gestures/press/index.mjs';
|
|
12
|
+
export { capturePointer } from './gestures/utils/capture-pointer.mjs';
|
|
12
13
|
export { isBezierDefinition } from './utils/is-bezier-definition.mjs';
|
|
13
14
|
export { resolveElements } from './utils/resolve-elements.mjs';
|
|
14
15
|
export { supportsFlags } from './utils/supports/flags.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -668,6 +668,8 @@ interface PointerEventOptions extends EventOptions {
|
|
|
668
668
|
*/
|
|
669
669
|
declare function press(targetOrSelector: ElementOrSelector, onPressStart: OnPressStartEvent, options?: PointerEventOptions): VoidFunction;
|
|
670
670
|
|
|
671
|
+
declare function capturePointer(event: PointerEvent, action: "set" | "release"): void;
|
|
672
|
+
|
|
671
673
|
declare const isBezierDefinition: (easing: Easing | Easing[]) => easing is BezierDefinition;
|
|
672
674
|
|
|
673
675
|
/**
|
|
@@ -750,4 +752,4 @@ declare const isNodeOrChild: (parent: Element | null, child?: Element | null) =>
|
|
|
750
752
|
|
|
751
753
|
declare const isPrimaryPointer: (event: PointerEvent) => boolean;
|
|
752
754
|
|
|
753
|
-
export { type AnimationGeneratorType, type AnimationOptions, type AnimationOptionsWithValueOverrides, type AnimationPlaybackControls, type AnimationPlaybackControlsWithFinished, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState, type BezierDefinition, type CSSStyleDeclarationWithTransform, type DOMKeyframesDefinition, type DecayOptions, type Driver, type DriverControls, type DurationSpringOptions, type DynamicOption, type Easing, type EasingDefinition, type EasingFunction, type EasingModifier, type ElementOrSelector, type EventOptions, type GeneratorFactory, GroupPlaybackControls, type InertiaOptions, type KeyframeGenerator, type KeyframeOptions, NativeAnimationControls, type OnHoverEndEvent, type OnHoverStartEvent, type OnPressEndEvent, type OnPressStartEvent, type PointerEventOptions, type PressGestureInfo, type ProgressTimeline, type RepeatType, type ResolvedValueKeyframe, type SVGAttributes, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGTransitions, type SelectorCache, type SpringOptions, type StyleKeyframesDefinition, type StyleTransitions, type Target, type TransformProperties, type Transition, type UnresolvedValueKeyframe, type ValueAnimationOptions, type ValueAnimationTransition, type ValueKeyframe, type ValueKeyframesDefinition, type VariableKeyframesDefinition, type VariableTransitions, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type WithQuerySelectorAll, attachTimeline, calcGeneratorDuration, createGeneratorEasing, cubicBezierAsString, generateLinearEasing, getValueTransition, hover, isBezierDefinition, isDragActive, isDragging, isGenerator, isNodeOrChild, isPrimaryPointer, isWaapiSupportedEasing, mapEasingToNativeEasing, maxGeneratorDuration, press, resolveElements, setDragLock, supportedWaapiEasing, supportsFlags, supportsLinearEasing, supportsScrollTimeline, view };
|
|
755
|
+
export { type AnimationGeneratorType, type AnimationOptions, type AnimationOptionsWithValueOverrides, type AnimationPlaybackControls, type AnimationPlaybackControlsWithFinished, type AnimationPlaybackLifecycles, type AnimationPlaybackOptions, type AnimationScope, type AnimationState, type BezierDefinition, type CSSStyleDeclarationWithTransform, type DOMKeyframesDefinition, type DecayOptions, type Driver, type DriverControls, type DurationSpringOptions, type DynamicOption, type Easing, type EasingDefinition, type EasingFunction, type EasingModifier, type ElementOrSelector, type EventOptions, type GeneratorFactory, GroupPlaybackControls, type InertiaOptions, type KeyframeGenerator, type KeyframeOptions, NativeAnimationControls, type OnHoverEndEvent, type OnHoverStartEvent, type OnPressEndEvent, type OnPressStartEvent, type PointerEventOptions, type PressGestureInfo, type ProgressTimeline, type RepeatType, type ResolvedValueKeyframe, type SVGAttributes, type SVGKeyframesDefinition, type SVGPathKeyframesDefinition, type SVGPathProperties, type SVGPathTransitions, type SVGTransitions, type SelectorCache, type SpringOptions, type StyleKeyframesDefinition, type StyleTransitions, type Target, type TransformProperties, type Transition, type UnresolvedValueKeyframe, type ValueAnimationOptions, type ValueAnimationTransition, type ValueKeyframe, type ValueKeyframesDefinition, type VariableKeyframesDefinition, type VariableTransitions, type VelocityOptions, type ViewTransitionAnimationDefinition, ViewTransitionBuilder, type ViewTransitionOptions, type ViewTransitionTarget, type WithQuerySelectorAll, attachTimeline, calcGeneratorDuration, capturePointer, createGeneratorEasing, cubicBezierAsString, generateLinearEasing, getValueTransition, hover, isBezierDefinition, isDragActive, isDragging, isGenerator, isNodeOrChild, isPrimaryPointer, isWaapiSupportedEasing, mapEasingToNativeEasing, maxGeneratorDuration, press, resolveElements, setDragLock, supportedWaapiEasing, supportsFlags, supportsLinearEasing, supportsScrollTimeline, view };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "motion-dom",
|
|
3
|
-
"version": "12.4.
|
|
3
|
+
"version": "12.4.5",
|
|
4
4
|
"author": "Matt Perry",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": "https://github.com/motiondivision/motion",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"build": "yarn clean && tsc -p . && rollup -c",
|
|
24
24
|
"dev": "concurrently -c blue,red -n tsc,rollup --kill-others \"tsc --watch -p . --preserveWatchOutput\" \"rollup --config --watch --no-watch.clearScreen\""
|
|
25
25
|
},
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "495f627674c9fda48353973d90da047db8f52451"
|
|
27
27
|
}
|