Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dnd-core

Package Overview
Dependencies
Maintainers
1
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dnd-core - npm Package Compare versions

Comparing version 0.6.0 to 0.6.1

dist-modules/utils/matchesType.js

5

dist-modules/__tests__/DragDropManager-test.js

@@ -660,8 +660,11 @@ "use strict";

var targetCHandle = registry.addTarget(Types.FOO, targetC);
var targetD = new NormalTarget();
var targetDHandle = registry.addTarget([Types.BAZ, Types.FOO], targetD);
backend.simulateBeginDrag(sourceHandle);
backend.simulateHover([targetAHandle, targetBHandle, targetCHandle]);
backend.simulateHover([targetAHandle, targetBHandle, targetCHandle, targetDHandle]);
expect(targetA.didCallHover).to.equal(true);
expect(targetB.didCallHover).to.equal(false);
expect(targetC.didCallHover).to.equal(true);
expect(targetD.didCallHover).to.equal(true);
});

@@ -668,0 +671,0 @@

@@ -595,2 +595,28 @@ "use strict";

it("correctly handles isOver() for multi-type targets", function () {
var sourceA = new NormalSource();
var sourceAHandle = registry.addSource(Types.FOO, sourceA);
var sourceB = new NormalSource();
var sourceBHandle = registry.addSource(Types.BAR, sourceB);
var sourceC = new NormalSource();
var sourceCHandle = registry.addSource(Types.BAZ, sourceC);
var target = new NormalTarget();
var targetHandle = registry.addTarget([Types.FOO, Types.BAR], target);
backend.simulateBeginDrag(sourceAHandle);
backend.simulateHover([targetHandle]);
expect(monitor.isOver(targetHandle)).to.equal(true);
expect(monitor.isOver(targetHandle, true)).to.equal(true);
backend.simulateEndDrag();
backend.simulateBeginDrag(sourceBHandle);
expect(monitor.isOver(targetHandle)).to.equal(true);
expect(monitor.isOver(targetHandle, true)).to.equal(true);
backend.simulateEndDrag();
backend.simulateBeginDrag(sourceCHandle);
expect(monitor.isOver(targetHandle)).to.equal(false);
expect(monitor.isOver(targetHandle, true)).to.equal(false);
});
it("does not reset target handles on drop() and endDrag()", function () {

@@ -597,0 +623,0 @@ var source = new NormalSource();

4

dist-modules/actions/DragDropActions.js

@@ -11,2 +11,4 @@ "use strict";

var matchesType = _interopRequire(require("../utils/matchesType"));
var invariant = _interopRequire(require("invariant"));

@@ -80,3 +82,3 @@

var targetType = registry.getTargetType(targetHandle);
if (targetType === draggedItemType) {
if (matchesType(targetType, draggedItemType)) {
target.hover(monitor, targetHandle);

@@ -83,0 +85,0 @@ }

@@ -9,14 +9,4 @@ "use strict";

var isArray = _interopRequire(require("lodash/lang/isArray"));
var matchesType = _interopRequire(require("./utils/matchesType"));
function matchesType(targetType, draggedItemType) {
if (isArray(targetType)) {
return targetType.some(function (t) {
return t === draggedItemType;
});
} else {
return targetType === draggedItemType;
}
}
var DragDropMonitor = (function () {

@@ -95,3 +85,3 @@ function DragDropMonitor(flux, registry) {

var draggedItemType = this.getItemType();
if (draggedItemType !== targetType) {
if (!matchesType(targetType, draggedItemType)) {
return false;

@@ -98,0 +88,0 @@ }

{
"name": "dnd-core",
"version": "0.6.0",
"version": "0.6.1",
"description": "Drag and drop sans the GUI",

@@ -5,0 +5,0 @@ "main": "dist-modules/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc