solidjs-motion 0.1.2 → 0.1.4
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 +41 -0
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/src/motion-proxy.d.ts +1 -1
- package/dist/src/types.d.ts +14 -0
- package/package.json +1 -1
- package/src/motion-proxy.tsx +2 -0
- package/src/primitives/createDrag.ts +33 -10
- package/src/types.ts +14 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,47 @@ 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.4] — 2026-05-21
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **`dragListener` option** on `useMotion` / `<motion.X>` / `motion.create`.
|
|
13
|
+
Mirrors motion-react's prop. Defaults to `true`. When set to `false`,
|
|
14
|
+
drag skips attaching its own pointerdown listener to the element —
|
|
15
|
+
drag becomes external-only, triggered through `dragControls.start(e)`
|
|
16
|
+
from a handle elsewhere. The canonical case is a scrollable drawer
|
|
17
|
+
body where direct pointer interaction must stay scroll-only, and a
|
|
18
|
+
dedicated edge handle is the single drag affordance.
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
const controls = createDragControls()
|
|
22
|
+
return (
|
|
23
|
+
<motion.aside drag="x" dragControls={controls} dragListener={false}>
|
|
24
|
+
{/* body stays scrollable — no drag from direct touch */}
|
|
25
|
+
<span onPointerDown={(e) => controls.start(e)}>handle</span>
|
|
26
|
+
</motion.aside>
|
|
27
|
+
)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## [0.1.3] — 2026-05-21
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
|
|
34
|
+
- **`onDragEnd` now fires at the very end of pan-end** (after motion's
|
|
35
|
+
`whileDrag` flip, body-style restore, pointer-capture release, momentum
|
|
36
|
+
/ snap-back dispatch, AND MV-ref cleanup) instead of mid-handler. A
|
|
37
|
+
synchronous state flip from a user `onDragEnd` callback — e.g. closing
|
|
38
|
+
a Kobalte / Radix-style Dialog whose contents are the draggable — used
|
|
39
|
+
to race motion's later DOM-touching work and could wedge surrounding
|
|
40
|
+
libraries that observe the same DOM (scroll lock, pointer-event
|
|
41
|
+
layer-stack). The new ordering closes the race: by the time the
|
|
42
|
+
callback runs, the drag session is fully torn down and any reactive
|
|
43
|
+
cascade triggered from it is unambiguous about ownership.
|
|
44
|
+
|
|
45
|
+
Observationally compatible with the previous behavior for callbacks
|
|
46
|
+
that don't flip global state; users can keep their callbacks as plain
|
|
47
|
+
synchronous functions and drop `queueMicrotask` workarounds.
|
|
48
|
+
|
|
8
49
|
## [0.1.2] — 2026-05-20
|
|
9
50
|
|
|
10
51
|
### Fixed
|
package/dist/index.js
CHANGED
|
@@ -1149,7 +1149,6 @@ function createDrag(el, getOpts, setActive) {
|
|
|
1149
1149
|
setActive("whileDrag", false);
|
|
1150
1150
|
restoreBodyAndElementStyles();
|
|
1151
1151
|
releasePointerCaptureSafely();
|
|
1152
|
-
getOpts().onDragEnd?.(event, info);
|
|
1153
1152
|
const xRef = xMV;
|
|
1154
1153
|
const yRef = yMV;
|
|
1155
1154
|
const boundsRef = sessionBounds;
|
|
@@ -1245,8 +1244,9 @@ function createDrag(el, getOpts, setActive) {
|
|
|
1245
1244
|
xMV = null;
|
|
1246
1245
|
yMV = null;
|
|
1247
1246
|
sessionBounds = null;
|
|
1247
|
+
getOpts().onDragEnd?.(event, info);
|
|
1248
1248
|
};
|
|
1249
|
-
createPan(() => el, () => ({
|
|
1249
|
+
if (getOpts().dragListener !== false) createPan(() => el, () => ({
|
|
1250
1250
|
threshold: getOpts().panThreshold,
|
|
1251
1251
|
onPanStart: handlePanStart,
|
|
1252
1252
|
onPan: handlePan,
|
|
@@ -2380,6 +2380,7 @@ var MOTION_OPT_KEYS = [
|
|
|
2380
2380
|
"dragTransition",
|
|
2381
2381
|
"dragSnapToOrigin",
|
|
2382
2382
|
"dragControls",
|
|
2383
|
+
"dragListener",
|
|
2383
2384
|
"whileDrag",
|
|
2384
2385
|
"panThreshold",
|
|
2385
2386
|
"variants",
|