@uinstinct/svelte-wheel-picker 0.1.24 → 0.1.26

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.
@@ -209,9 +209,13 @@
209
209
  }
210
210
 
211
211
  // Pointer event handlers (Pattern 2: Pointer Capture for reliable drag tracking)
212
+ // Mouse does not use pointer capture so that pointerleave fires when cursor exits.
213
+ // Touch/pen still get pointer capture for uninterrupted cross-boundary tracking.
212
214
  function onPointerDown(e: PointerEvent) {
213
215
  const el = e.currentTarget as HTMLElement;
214
- el.setPointerCapture(e.pointerId);
216
+ if (e.pointerType !== 'mouse') {
217
+ el.setPointerCapture(e.pointerId);
218
+ }
215
219
  physics.startDrag(e.clientY);
216
220
  }
217
221
 
@@ -220,10 +224,22 @@
220
224
  }
221
225
 
222
226
  function onPointerUp(e: PointerEvent) {
223
- (e.currentTarget as HTMLElement).releasePointerCapture(e.pointerId);
227
+ const el = e.currentTarget as HTMLElement;
228
+ if (el.hasPointerCapture(e.pointerId)) {
229
+ el.releasePointerCapture(e.pointerId);
230
+ }
224
231
  physics.endDrag();
225
232
  }
226
233
 
234
+ // End mouse drag when cursor leaves the component boundary.
235
+ // endDrag() has an isDragging guard so double-calls (pointerleave + pointerup) are no-ops.
236
+ // Touch/pen already use pointer capture so pointerleave is never fired for them.
237
+ function onPointerLeave(e: PointerEvent) {
238
+ if (e.pointerType === 'mouse') {
239
+ physics.endDrag();
240
+ }
241
+ }
242
+
227
243
  // Wheel/trackpad scroll handler — one item per scroll event
228
244
  function onWheel(e: WheelEvent) {
229
245
  e.preventDefault();
@@ -246,6 +262,7 @@
246
262
  onpointermove={onPointerMove}
247
263
  onpointerup={onPointerUp}
248
264
  onpointercancel={onPointerUp}
265
+ onpointerleave={onPointerLeave}
249
266
  onwheel={onWheel}
250
267
  onkeydown={handleKeydown}
251
268
  >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uinstinct/svelte-wheel-picker",
3
- "version": "0.1.24",
3
+ "version": "0.1.26",
4
4
  "type": "module",
5
5
  "description": "iOS-style wheel picker for Svelte 5 with inertia scrolling, infinite loop, and keyboard navigation",
6
6
  "license": "MIT",
@@ -68,6 +68,7 @@
68
68
  "test:e2e": "PLAYWRIGHT_BROWSERS_PATH=.playwright npx playwright test --config=playwright.config.ts",
69
69
  "lint": "eslint .",
70
70
  "format": "prettier --write .",
71
- "registry:build": "shadcn-svelte registry build"
71
+ "registry:build": "shadcn-svelte registry build",
72
+ "agent": "safehouse --enable=playwright-chrome claude --dangerously-skip-permissions"
72
73
  }
73
74
  }