react-dnd-touch-backend
Advanced tools
Comparing version 15.0.0 to 15.0.1
{ | ||
"name": "react-dnd-touch-backend", | ||
"version": "15.0.0", | ||
"version": "15.0.1", | ||
"description": "Touch backend for react-dnd", | ||
"type": "module", | ||
"exports": "./lib/index.js", | ||
"types": "./lib/index.d.ts", | ||
"main": "dist/cjs/index.js", | ||
"module": "dist/esm/index.js", | ||
"types": "dist/types/index.d.ts", | ||
"sideEffects": false, | ||
@@ -16,12 +16,10 @@ "license": "MIT", | ||
"scripts": { | ||
"clean": "shx rm -rf lib/", | ||
"build": "tsc -b . && swc src -d lib" | ||
"clean": "shx rm -rf dist/", | ||
"build": "tsc -b tsconfig.cjs.json && tsc -b tsconfig.esm.json && tsc -b tsconfig.types.json" | ||
}, | ||
"dependencies": { | ||
"@react-dnd/invariant": "^2.0.0", | ||
"dnd-core": "15.0.0" | ||
"dnd-core": "15.0.1" | ||
}, | ||
"devDependencies": { | ||
"@swc/cli": "^0.1.55", | ||
"@swc/core": "^1.2.135", | ||
"shx": "^0.3.4", | ||
@@ -28,0 +26,0 @@ "typescript": "^4.5.5" |
@@ -1,3 +0,3 @@ | ||
import { DragDropManager, BackendFactory } from 'dnd-core' | ||
import { TouchBackendOptions, TouchBackendContext } from './interfaces' | ||
import type { DragDropManager, BackendFactory } from 'dnd-core' | ||
import type { TouchBackendOptions, TouchBackendContext } from './interfaces' | ||
import { TouchBackendImpl } from './TouchBackendImpl' | ||
@@ -4,0 +4,0 @@ |
@@ -19,10 +19,8 @@ export interface EventName { | ||
touchSlop: number | ||
scrollAngleRanges?: AngleRange[] | ||
scrollAngleRanges?: AngleRange[] | undefined | ||
rootElement: Node | undefined | ||
getDropTargetElementsAtPoint?: ( | ||
x: number, | ||
y: number, | ||
dropTargets: HTMLElement[], | ||
) => HTMLElement[] | ||
getDropTargetElementsAtPoint?: | ||
| undefined | ||
| ((x: number, y: number, dropTargets: HTMLElement[]) => HTMLElement[]) | ||
} | ||
@@ -29,0 +27,0 @@ |
@@ -1,2 +0,2 @@ | ||
import { | ||
import type { | ||
TouchBackendOptions, | ||
@@ -3,0 +3,0 @@ AngleRange, |
import { invariant } from '@react-dnd/invariant' | ||
import { | ||
import type { | ||
DragDropActions, | ||
@@ -213,3 +213,3 @@ DragDropMonitor, | ||
handler: (e: any) => void, | ||
capture?: boolean, | ||
capture = false, | ||
) { | ||
@@ -231,3 +231,3 @@ const options = supportsPassive ? { capture, passive: false } : capture | ||
handler: (e: any) => void, | ||
capture?: boolean, | ||
capture = false, | ||
) { | ||
@@ -299,4 +299,4 @@ const options = supportsPassive ? { capture, passive: false } : capture | ||
coords = { | ||
x: (e as TouchEvent).touches[0].clientX, | ||
y: (e as TouchEvent).touches[0].clientY, | ||
x: (e as TouchEvent).touches[0]?.clientX || 0, | ||
y: (e as TouchEvent).touches[0]?.clientY || 0, | ||
} | ||
@@ -499,4 +499,6 @@ break | ||
} | ||
let currentNode: Element | null = elementsAtPoint[nodeId] | ||
elementsAtPointExtended.push(currentNode) | ||
let currentNode: Element | undefined | null = elementsAtPoint[nodeId] | ||
if (currentNode != null) { | ||
elementsAtPointExtended.push(currentNode) | ||
} | ||
while (currentNode) { | ||
@@ -503,0 +505,0 @@ currentNode = currentNode.parentElement |
@@ -1,2 +0,2 @@ | ||
import { AngleRange } from '../interfaces' | ||
import type { AngleRange } from '../interfaces' | ||
@@ -19,3 +19,3 @@ export function distance( | ||
y2: number, | ||
angleRanges?: AngleRange[], | ||
angleRanges: AngleRange[] | undefined, | ||
): boolean { | ||
@@ -29,5 +29,7 @@ if (!angleRanges) { | ||
for (let i = 0; i < angleRanges.length; ++i) { | ||
const ar = angleRanges[i] | ||
if ( | ||
(angleRanges[i].start == null || angle >= angleRanges[i].start) && | ||
(angleRanges[i].end == null || angle <= angleRanges[i].end) | ||
ar && | ||
(ar.start == null || angle >= ar.start) && | ||
(ar.end == null || angle <= ar.end) | ||
) { | ||
@@ -34,0 +36,0 @@ return true |
@@ -1,2 +0,2 @@ | ||
import { XYCoord } from 'dnd-core' | ||
import type { XYCoord } from 'dnd-core' | ||
import { isTouchEvent } from './predicates' | ||
@@ -20,8 +20,9 @@ | ||
if (e.targetTouches.length === 1) { | ||
return getEventClientOffset(e.targetTouches[0]) | ||
return getEventClientOffset(e.targetTouches[0] as Touch) | ||
} else if (lastTargetTouchFallback && e.touches.length === 1) { | ||
if (e.touches[0].target === lastTargetTouchFallback.target) { | ||
return getEventClientOffset(e.touches[0]) | ||
if ((e.touches[0] as Touch).target === lastTargetTouchFallback.target) { | ||
return getEventClientOffset(e.touches[0] as Touch) | ||
} | ||
} | ||
return | ||
} | ||
@@ -28,0 +29,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2
37
2210
0
80469
No
+ Addeddnd-core@15.0.1(transitive)
- Removeddnd-core@15.0.0(transitive)
Updateddnd-core@15.0.1