solidjs-motion 0.1.4 → 0.1.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/CHANGELOG.md +26 -0
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/use-motion.tsx +30 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,32 @@ All notable changes to `solidjs-motion` / `@solidjs-motion/motion` are documente
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.1.5] — 2026-05-21
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **Drag now sets `touch-action` upfront on the element** when `drag` is
|
|
13
|
+
configured, not just inside `handlePanStart` after threshold cross.
|
|
14
|
+
Previously, on mobile, the browser would arbitrate the gesture as
|
|
15
|
+
native scroll/zoom and fire `pointercancel` before motion's own
|
|
16
|
+
touch-action write could take effect — manifesting as missed drags
|
|
17
|
+
or, when the user's `onDragEnd` made a threshold-based decision off
|
|
18
|
+
stale `info.offset`, an immediate dismiss-on-touch (visible in the
|
|
19
|
+
swipe-stack demo: every press fired a left-swipe).
|
|
20
|
+
|
|
21
|
+
Axis mapping mirrors motion-react:
|
|
22
|
+
- `drag="x"` → `touch-action: pan-y` (browser keeps vertical scroll)
|
|
23
|
+
- `drag="y"` → `touch-action: pan-x`
|
|
24
|
+
- `drag={true}` → `touch-action: none`
|
|
25
|
+
|
|
26
|
+
User-supplied `style.touch-action` still overrides via natural
|
|
27
|
+
spread precedence — e.g., `style={{ touchAction: "auto" }}` opts back
|
|
28
|
+
into the browser's default arbitration. Three regression tests added.
|
|
29
|
+
|
|
30
|
+
Removes the need for users to remember to set `touch-action: none` on
|
|
31
|
+
every draggable element — `<motion.div drag="x">` now Just Works on
|
|
32
|
+
touch devices.
|
|
33
|
+
|
|
8
34
|
## [0.1.4] — 2026-05-21
|
|
9
35
|
|
|
10
36
|
### Added
|
package/dist/index.js
CHANGED
|
@@ -2308,12 +2308,18 @@ function useMotion(opts) {
|
|
|
2308
2308
|
return mergeProps$1(userProps ?? {}, {
|
|
2309
2309
|
get style() {
|
|
2310
2310
|
const cleaned = stripStyleEntriesOwnedByRegistry(userProps?.style);
|
|
2311
|
-
|
|
2311
|
+
const dragOpts = getOpts().drag;
|
|
2312
|
+
const dragTouchAction = dragOpts ? dragOpts === "x" ? "pan-y" : dragOpts === "y" ? "pan-x" : "none" : void 0;
|
|
2313
|
+
const baseWithDefaults = dragTouchAction ? {
|
|
2314
|
+
"touch-action": dragTouchAction,
|
|
2315
|
+
...cleaned
|
|
2316
|
+
} : cleaned;
|
|
2317
|
+
if (renderedOnce) return baseWithDefaults;
|
|
2312
2318
|
const composed = composeFirstPaintStyle(userProps?.style);
|
|
2313
2319
|
return composed ? {
|
|
2314
|
-
...
|
|
2320
|
+
...baseWithDefaults,
|
|
2315
2321
|
...composed
|
|
2316
|
-
} :
|
|
2322
|
+
} : baseWithDefaults;
|
|
2317
2323
|
},
|
|
2318
2324
|
ref: mergeRefs(userProps?.ref, motionRef),
|
|
2319
2325
|
...wroteFirstPaintStyle ? { "data-motion-hydrated": "" } : {}
|