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.3.1 to 0.4.0

coverage/coverage.json

8

dist-modules/__tests__/sources.js

@@ -24,4 +24,4 @@ "use strict";

NormalSource.prototype.endDrag = function endDrag(context) {
this.recordedDropResult = context.getDropResult();
NormalSource.prototype.endDrag = function endDrag(monitor) {
this.recordedDropResult = monitor.getDropResult();
};

@@ -85,4 +85,4 @@

NumberSource.prototype.isDragging = function isDragging(context) {
var item = context.getItem();
NumberSource.prototype.isDragging = function isDragging(monitor) {
var item = monitor.getItem();
return item.number === this.number;

@@ -89,0 +89,0 @@ };

@@ -91,5 +91,5 @@ "use strict";

TransformResultTarget.prototype.drop = function drop(context) {
TransformResultTarget.prototype.drop = function drop(monitor) {
this.didCallDrop = true;
var dropResult = context.getDropResult();
var dropResult = monitor.getDropResult();
return this.transform(dropResult);

@@ -96,0 +96,0 @@ };

@@ -26,8 +26,7 @@ "use strict";

DragDropActions.prototype.beginDrag = function beginDrag(sourceHandle) {
var _manager = this.manager;
var context = _manager.context;
var registry = _manager.registry;
var monitor = this.manager.getMonitor();
var registry = this.manager.getRegistry();
invariant(!context.isDragging(), "Cannot call beginDrag while dragging.");
if (!context.canDrag(sourceHandle)) {
invariant(!monitor.isDragging(), "Cannot call beginDrag while dragging.");
if (!monitor.canDrag(sourceHandle)) {
return;

@@ -37,3 +36,3 @@ }

var source = registry.getSource(sourceHandle);
var item = source.beginDrag(context, sourceHandle);
var item = source.beginDrag(monitor, sourceHandle);
invariant(isObject(item), "Item must be an object.");

@@ -49,7 +48,6 @@

DragDropActions.prototype.enter = function enter(targetHandle) {
var context = this.manager.context;
var monitor = this.manager.getMonitor();
invariant(monitor.isDragging(), "Cannot call enter while not dragging.");
invariant(context.isDragging(), "Cannot call enter while not dragging.");
var targetHandles = context.getTargetHandles();
var targetHandles = monitor.getTargetHandles();
invariant(targetHandles.indexOf(targetHandle) === -1, "Cannot enter the same target twice.");

@@ -61,7 +59,6 @@

DragDropActions.prototype.leave = function leave(targetHandle) {
var context = this.manager.context;
var monitor = this.manager.getMonitor();
invariant(monitor.isDragging(), "Cannot call leave while not dragging.");
invariant(context.isDragging(), "Cannot call leave while not dragging.");
var targetHandles = context.getTargetHandles();
var targetHandles = monitor.getTargetHandles();
invariant(targetHandles.indexOf(targetHandle) !== -1, "Cannot leave a target that was not entered.");

@@ -75,8 +72,6 @@

var _manager = this.manager;
var context = _manager.context;
var registry = _manager.registry;
var monitor = this.manager.getMonitor();
var registry = this.manager.getRegistry();
invariant(monitor.isDragging(), "Cannot call drop while not dragging.");
invariant(context.isDragging(), "Cannot call drop while not dragging.");
var _getActionIds = this.getActionIds();

@@ -86,3 +81,3 @@

var targetHandles = context.getTargetHandles().filter(context.canDrop, context);
var targetHandles = monitor.getTargetHandles().filter(monitor.canDrop, monitor);

@@ -93,6 +88,6 @@ targetHandles.reverse();

var dropResult = target.drop(context, targetHandle);
var dropResult = target.drop(monitor, targetHandle);
invariant(typeof dropResult === "undefined" || isObject(dropResult), "Drop result must either be an object or undefined.");
if (typeof dropResult === "undefined") {
dropResult = index === 0 ? true : context.getDropResult();
dropResult = index === 0 ? true : monitor.getDropResult();
}

@@ -105,11 +100,9 @@

DragDropActions.prototype.endDrag = function endDrag() {
var _manager = this.manager;
var context = _manager.context;
var registry = _manager.registry;
var monitor = this.manager.getMonitor();
var registry = this.manager.getRegistry();
invariant(monitor.isDragging(), "Cannot call endDrag while not dragging.");
invariant(context.isDragging(), "Cannot call endDrag while not dragging.");
var sourceHandle = context.getSourceHandle();
var sourceHandle = monitor.getSourceHandle();
var source = registry.getSource(sourceHandle, true);
source.endDrag(context, sourceHandle);
source.endDrag(monitor, sourceHandle);

@@ -116,0 +109,0 @@ registry.unpinSource();

@@ -9,3 +9,3 @@ "use strict";

var DragDropContext = _interopRequire(require("./DragDropContext"));
var DragDropMonitor = _interopRequire(require("./DragDropMonitor"));

@@ -22,8 +22,8 @@ var HandlerRegistry = _interopRequire(require("./utils/HandlerRegistry"));

this.registry = new HandlerRegistry(flux.registryActions);
this.context = new DragDropContext(flux, this.registry);
this.monitor = new DragDropMonitor(flux, this.registry);
this.backend = new Backend(flux.dragDropActions);
}
DragDropManager.prototype.getContext = function getContext() {
return this.context;
DragDropManager.prototype.getMonitor = function getMonitor() {
return this.monitor;
};

@@ -30,0 +30,0 @@

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

DragSource.prototype.isDragging = function isDragging(context, handle) {
return handle === context.getSourceHandle();
DragSource.prototype.isDragging = function isDragging(monitor, handle) {
return handle === monitor.getSourceHandle();
};

@@ -18,0 +18,0 @@

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

@@ -8,3 +8,4 @@ "main": "dist-modules/index.js",

"build": "./scripts/build",
"test": "./scripts/test"
"test": "./scripts/test",
"prepublish": "npm run build"
},

@@ -24,2 +25,3 @@ "repository": {

"expect.js": "^0.3.1",
"istanbul": "~0.3.7",
"mocha": "^2.0.1"

@@ -26,0 +28,0 @@ },

Sorry, the diff of this file is not supported yet

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