solidjs-motion 0.1.2 → 0.1.3
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 +19 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/primitives/createDrag.ts +13 -1
package/package.json
CHANGED
|
@@ -474,7 +474,16 @@ export function createDrag(
|
|
|
474
474
|
restoreBodyAndElementStyles()
|
|
475
475
|
releasePointerCaptureSafely()
|
|
476
476
|
|
|
477
|
-
|
|
477
|
+
// The user's `onDragEnd` callback fires at the END of this function
|
|
478
|
+
// (just before the early-out), not here. Rationale: a synchronous
|
|
479
|
+
// state flip from the callback (e.g. closing a Dialog whose contents
|
|
480
|
+
// are this draggable) used to race motion's own post-callback work
|
|
481
|
+
// — momentum dispatch, MV-ref cleanup — and could wedge surrounding
|
|
482
|
+
// libraries that observe the same DOM (scroll lock, pointer-event
|
|
483
|
+
// layers). Firing AFTER all motion DOM-touching work guarantees a
|
|
484
|
+
// clean handoff: by the time the callback runs, the drag session is
|
|
485
|
+
// fully torn down and any subsequent reactive cascade is unambiguous
|
|
486
|
+
// about ownership.
|
|
478
487
|
|
|
479
488
|
// Capture refs locally — the closure clears xMV/yMV below before the
|
|
480
489
|
// momentum promise can resolve, but the inertia animation needs stable
|
|
@@ -630,6 +639,9 @@ export function createDrag(
|
|
|
630
639
|
xMV = null
|
|
631
640
|
yMV = null
|
|
632
641
|
sessionBounds = null
|
|
642
|
+
|
|
643
|
+
// Callback fires last — see the note at the top of handlePanEnd.
|
|
644
|
+
getOpts().onDragEnd?.(event, info)
|
|
633
645
|
}
|
|
634
646
|
|
|
635
647
|
// Function-form options so createPan reads `panThreshold` reactively.
|