react-dnd-html5-backend
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -1,2 +0,2 @@ | ||
import { IBackend, IDragDropManager } from 'dnd-core'; | ||
import { Backend, DragDropManager } from 'dnd-core'; | ||
declare global { | ||
@@ -7,3 +7,3 @@ interface Window { | ||
} | ||
export default class HTML5Backend implements IBackend { | ||
export default class HTML5Backend implements Backend { | ||
private actions; | ||
@@ -31,3 +31,3 @@ private monitor; | ||
private mouseMoveTimeoutId; | ||
constructor(manager: IDragDropManager<any>); | ||
constructor(manager: DragDropManager<any>); | ||
readonly window: Window | undefined; | ||
@@ -34,0 +34,0 @@ setup(): void; |
@@ -5,4 +5,4 @@ export * from './interfaces'; | ||
import * as NativeTypes from './NativeTypes'; | ||
import { IDragDropManager } from 'dnd-core'; | ||
import { DragDropManager } from 'dnd-core'; | ||
export { NativeTypes, getEmptyImage }; | ||
export default function createHTML5Backend(manager: IDragDropManager<any>): HTML5Backend; | ||
export default function createHTML5Backend(manager: DragDropManager<any>): HTML5Backend; |
@@ -1,3 +0,3 @@ | ||
export interface IHTML5BackendContext { | ||
export interface HTML5BackendContext { | ||
window: Window; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { ItemType, TargetType } from 'dnd-core'; | ||
export default function matchesType(targetType: TargetType | null, draggedItemType: ItemType | null): boolean; | ||
import { SourceType, TargetType } from 'dnd-core'; | ||
export default function matchesType(targetType: TargetType | null, draggedItemType: SourceType | null): boolean; |
@@ -1,2 +0,2 @@ | ||
import { IDragDropMonitor } from 'dnd-core'; | ||
import { DragDropMonitor } from 'dnd-core'; | ||
export declare function createNativeDragSource(type: any): { | ||
@@ -8,3 +8,3 @@ new (): { | ||
beginDrag(): any; | ||
isDragging(monitor: IDragDropMonitor, handle: string): boolean; | ||
isDragging(monitor: DragDropMonitor, handle: string): boolean; | ||
endDrag(): void; | ||
@@ -11,0 +11,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import { IXYCoord } from 'dnd-core'; | ||
import { XYCoord } from 'dnd-core'; | ||
export declare function getNodeClientOffset(node: any): { | ||
@@ -10,5 +10,5 @@ x: any; | ||
}; | ||
export declare function getDragPreviewOffset(sourceNode: any, dragPreview: any, clientOffset: IXYCoord, anchorPoint: any, offsetPoint: any): { | ||
export declare function getDragPreviewOffset(sourceNode: any, dragPreview: any, clientOffset: XYCoord, anchorPoint: any, offsetPoint: any): { | ||
x: any; | ||
y: any; | ||
}; |
{ | ||
"name": "react-dnd-html5-backend", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "HTML5 backend for React DnD", | ||
"main": "lib/index.js", | ||
"types": "lib/index.d.ts", | ||
"license": "BSD-3-Clause", | ||
@@ -12,3 +13,3 @@ "repository": { | ||
"scripts": { | ||
"clean": "rimraf lib", | ||
"clean": "rimraf lib dist", | ||
"transpile": "tsc", | ||
@@ -26,4 +27,4 @@ "bundle:unmin": "webpack --mode development --output-filename=ReactDnDHTML5Backend.js", | ||
"npm-run-all": "^4.1.2", | ||
"react-dnd": "^3.0.0", | ||
"react-dnd-test-backend": "^3.0.0", | ||
"react-dnd": "^3.0.1", | ||
"react-dnd-test-backend": "^3.0.1", | ||
"rimraf": "^2.6.2", | ||
@@ -36,3 +37,3 @@ "ts-loader": "^4.2.0", | ||
"autobind-decorator": "^2.1.0", | ||
"dnd-core": "^3.0.0", | ||
"dnd-core": "^3.0.1", | ||
"lodash": "^4.2.0", | ||
@@ -39,0 +40,0 @@ "shallowequal": "^1.0.2" |
import HTML5Backend from '../HTML5Backend' | ||
import { IDragDropManager } from 'dnd-core' | ||
import { IHTML5BackendContext } from '../interfaces' | ||
import { DragDropManager } from 'dnd-core' | ||
import { HTML5BackendContext } from '../interfaces' | ||
@@ -8,3 +8,3 @@ describe('The HTML5 Backend', () => { | ||
it('uses an undefined window when no window is available', () => { | ||
const mockManager: IDragDropManager<IHTML5BackendContext> = { | ||
const mockManager: DragDropManager<HTML5BackendContext> = { | ||
getActions: () => null, | ||
@@ -27,3 +27,3 @@ getMonitor: () => null, | ||
it('uses the ambient window global', () => { | ||
const mockManager: IDragDropManager<IHTML5BackendContext> = { | ||
const mockManager: DragDropManager<HTML5BackendContext> = { | ||
getActions: () => null, | ||
@@ -43,3 +43,3 @@ getMonitor: () => null, | ||
} | ||
const mockManager: IDragDropManager<IHTML5BackendContext> = { | ||
const mockManager: DragDropManager<HTML5BackendContext> = { | ||
getActions: () => null, | ||
@@ -46,0 +46,0 @@ getMonitor: () => null, |
/* eslint-disable no-underscore-dangle */ | ||
import defaults from 'lodash/defaults' | ||
import { | ||
IBackend, | ||
IDragDropManager, | ||
IDragDropActions, | ||
IDragDropMonitor, | ||
IHandlerRegistry, | ||
IXYCoord, | ||
Backend, | ||
DragDropManager, | ||
DragDropActions, | ||
DragDropMonitor, | ||
HandlerRegistry, | ||
XYCoord, | ||
} from 'dnd-core' | ||
@@ -24,3 +24,3 @@ import EnterLeaveCounter from './EnterLeaveCounter' | ||
import autobind from 'autobind-decorator' | ||
import { IHTML5BackendContext } from './interfaces' | ||
import { HTML5BackendContext } from './interfaces' | ||
@@ -36,7 +36,7 @@ const shallowEqual = require('shallowequal') | ||
export default class HTML5Backend implements IBackend { | ||
private actions: IDragDropActions | ||
private monitor: IDragDropMonitor | ||
private registry: IHandlerRegistry | ||
private context: IHTML5BackendContext | ||
export default class HTML5Backend implements Backend { | ||
private actions: DragDropActions | ||
private monitor: DragDropMonitor | ||
private registry: HandlerRegistry | ||
private context: HTML5BackendContext | ||
@@ -55,3 +55,3 @@ private sourcePreviewNodes: any = {} | ||
private currentDragSourceNode: any = null | ||
private currentDragSourceNodeOffset: IXYCoord | null = null | ||
private currentDragSourceNodeOffset: XYCoord | null = null | ||
private currentDragSourceNodeOffsetChanged: boolean = false | ||
@@ -64,3 +64,3 @@ private altKeyPressed: boolean = false | ||
constructor(manager: IDragDropManager<any>) { | ||
constructor(manager: DragDropManager<any>) { | ||
this.actions = manager.getActions() | ||
@@ -67,0 +67,0 @@ this.monitor = manager.getMonitor() |
@@ -6,7 +6,7 @@ export * from './interfaces' | ||
import * as NativeTypes from './NativeTypes' | ||
import { IDragDropManager } from 'dnd-core' | ||
import { DragDropManager } from 'dnd-core' | ||
export { NativeTypes, getEmptyImage } | ||
export default function createHTML5Backend(manager: IDragDropManager<any>) { | ||
export default function createHTML5Backend(manager: DragDropManager<any>) { | ||
return new HTML5Backend(manager) | ||
} |
@@ -1,3 +0,3 @@ | ||
export interface IHTML5BackendContext { | ||
export interface HTML5BackendContext { | ||
window: Window | ||
} |
@@ -5,7 +5,7 @@ // | ||
import isArray from 'lodash/isArray' | ||
import { ItemType, TargetType } from 'dnd-core' | ||
import { Identifier, SourceType, TargetType } from 'dnd-core' | ||
export default function matchesType( | ||
targetType: TargetType | null, | ||
draggedItemType: ItemType | null, | ||
draggedItemType: SourceType | null, | ||
) { | ||
@@ -16,4 +16,4 @@ if (draggedItemType === null) { | ||
return isArray(targetType) | ||
? (targetType as ItemType[]).some(t => t === draggedItemType) | ||
? (targetType as Identifier[]).some(t => t === draggedItemType) | ||
: targetType === draggedItemType | ||
} |
import * as NativeTypes from './NativeTypes' | ||
import matchesType from './matchesType' | ||
import { IDragDropMonitor } from 'dnd-core' | ||
import { DragDropMonitor } from 'dnd-core' | ||
@@ -79,3 +79,3 @@ function getDataFromDataTransfer( | ||
public isDragging(monitor: IDragDropMonitor, handle: string) { | ||
public isDragging(monitor: DragDropMonitor, handle: string) { | ||
return handle === monitor.getSourceId() | ||
@@ -82,0 +82,0 @@ } |
import { isSafari, isFirefox } from './BrowserDetector' | ||
import MonotonicInterpolant from './MonotonicInterpolant' | ||
import { DOMElement, ReactNode } from 'react' | ||
import { IXYCoord } from 'dnd-core' | ||
import { XYCoord } from 'dnd-core' | ||
@@ -53,3 +53,3 @@ const ELEMENT_NODE = 1 | ||
dragPreview: any, | ||
clientOffset: IXYCoord, | ||
clientOffset: XYCoord, | ||
anchorPoint: any, | ||
@@ -64,3 +64,3 @@ offsetPoint: any, | ||
dragPreviewNode, | ||
) as IXYCoord | ||
) as XYCoord | ||
const offsetFromDragPreview = { | ||
@@ -67,0 +67,0 @@ x: clientOffset.x - dragPreviewNodeOffsetFromClient.x, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
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
297361
0
1
Updateddnd-core@^3.0.1