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

svelte-dnd-action

Package Overview
Dependencies
Maintainers
1
Versions
129
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svelte-dnd-action - npm Package Compare versions

Comparing version 0.6.12 to 0.6.13

12

package.json

@@ -8,3 +8,4 @@ {

"test": "cypress run",
"build": "rollup -c",
"lint": "eslint 'src/**'",
"build": "npm run lint && rollup -c",
"prepublishOnly": "npm run build"

@@ -16,7 +17,8 @@ },

"@babel/preset-env": "^7.9.6",
"@rollup/plugin-node-resolve": "^6.0.0",
"babel-jest": "^26.0.1",
"cypress": "^4.5.0",
"@rollup/plugin-node-resolve": "^6.0.0",
"rollup-plugin-babel": "^4.3.2",
"rollup": "^1.20.0"
"eslint": "^7.11.0",
"rollup": "^1.20.0",
"rollup-plugin-babel": "^4.3.2"
},

@@ -37,3 +39,3 @@ "keywords": [

"description": "*An awesome drag and drop library for Svelte 3 (not using the browser's built-in dnd, thanks god): Rich animations, nested containers, touch support and more *",
"version": "0.6.12",
"version": "0.6.13",
"repository": {

@@ -40,0 +42,0 @@ "type": "git",

@@ -18,3 +18,3 @@ import {dndzone as pointerDndZone} from "./pointerAction";

* @property {boolean} [dropFromOthersDisabled]
* @property {Object} [dragTargetStyle]
* @property {Object} [dropTargetStyle]
* @property {Function} [transformDraggedElement]

@@ -45,9 +45,2 @@ * @param {HTMLElement} node - the element to enhance

items,
flipDurationMs,
type,
dragDisabled,
dropFromOthersDisabled,
dropTargetStyle,
transformDraggedElement,
autoAriaDisabled,
...rest

@@ -61,3 +54,3 @@ } = options;

}
const itemWithMissingId = items.find(item => !item.hasOwnProperty(ITEM_ID_KEY));
const itemWithMissingId = items.find(item => !{}.hasOwnProperty.call(item, ITEM_ID_KEY));
if (itemWithMissingId) {

@@ -64,0 +57,0 @@ throw new Error(`missing '${ITEM_ID_KEY}' property for item ${toString(itemWithMissingId)}`);

@@ -38,3 +38,3 @@ /**

for (const keyA in objA) {
if(!objB.hasOwnProperty(keyA) || objB[keyA] !== objA[keyA]) {
if(!{}.hasOwnProperty.call(objB, keyA) || objB[keyA] !== objA[keyA]) {
return false;

@@ -41,0 +41,0 @@ }

@@ -94,3 +94,3 @@ import {

window.removeEventListener(DRAGGED_LEFT_DOCUMENT_EVENT_NAME, handleDrop);
unobserve(draggedEl, dropZones);
unobserve();
}

@@ -122,3 +122,3 @@

}
const shadowElIdx = items.findIndex(item => item.hasOwnProperty(SHADOW_ITEM_MARKER_PROPERTY_NAME));
const shadowElIdx = items.findIndex(item => !!item[SHADOW_ITEM_MARKER_PROPERTY_NAME]);
items.splice(shadowElIdx, 1);

@@ -136,3 +136,3 @@ shadowElDropZone = undefined;

const {index} = e.detail.indexObj;
const shadowElIdx = items.findIndex(item => item.hasOwnProperty(SHADOW_ITEM_MARKER_PROPERTY_NAME));
const shadowElIdx = items.findIndex(item => !!item[SHADOW_ITEM_MARKER_PROPERTY_NAME]);
items.splice(shadowElIdx, 1);

@@ -143,3 +143,3 @@ items.splice( index, 0, shadowElData);

/* global mouse/touch-events handlers */
// Global mouse/touch-events handlers
function handleMouseMove(e) {

@@ -162,11 +162,12 @@ e.preventDefault();

moveDraggedElementToWasDroppedState(draggedEl);
if (!!shadowElDropZone) { // it was dropped in a drop-zone
let finalizeFunction;
if (shadowElDropZone) { // it was dropped in a drop-zone
console.debug('dropped in dz', shadowElDropZone);
let {items, type} = dzToConfig.get(shadowElDropZone);
styleInactiveDropZones(typeToDropZones.get(type), dz => dzToConfig.get(dz).dropTargetStyle);
let shadowElIdx = items.findIndex(item => item.hasOwnProperty(SHADOW_ITEM_MARKER_PROPERTY_NAME));
let shadowElIdx = items.findIndex(item => !!item[SHADOW_ITEM_MARKER_PROPERTY_NAME]);
// the handler might remove the shadow element, ex: dragula like copy on drag
if (shadowElIdx === -1) shadowElIdx = originIndex;
items = items.map(item => item.hasOwnProperty(SHADOW_ITEM_MARKER_PROPERTY_NAME)? draggedElData : item);
function finalizeWithinZone() {
items = items.map(item => item[SHADOW_ITEM_MARKER_PROPERTY_NAME]? draggedElData : item);
finalizeFunction = function finalizeWithinZone() {
dispatchFinalizeEvent(shadowElDropZone, items, {trigger: TRIGGERS.DROPPED_INTO_ZONE, id: draggedElData[ITEM_ID_KEY], source: SOURCES.POINTER});

@@ -180,3 +181,3 @@ if (shadowElDropZone !== originDropZone) {

}
animateDraggedToFinalPosition(shadowElIdx, finalizeWithinZone);
animateDraggedToFinalPosition(shadowElIdx, finalizeFunction);
}

@@ -190,3 +191,3 @@ else { // it needs to return to its place

dispatchConsiderEvent(originDropZone, items, {trigger: TRIGGERS.DROPPED_OUTSIDE_OF_ANY, id: draggedElData[ITEM_ID_KEY], source: SOURCES.POINTER});
function finalizeBackToOrigin() {
finalizeFunction = function finalizeBackToOrigin() {
const finalItems = [...items];

@@ -198,3 +199,3 @@ finalItems.splice(originIndex, 1, draggedElData);

}
window.setTimeout(() => animateDraggedToFinalPosition(originIndex, finalizeBackToOrigin), 0);
window.setTimeout(() => animateDraggedToFinalPosition(originIndex, finalizeFunction), 0);
}

@@ -273,3 +274,3 @@ }

removeMaybeListeners();
handleDragStart(originalDragTarget);
handleDragStart();
}

@@ -384,3 +385,3 @@ }

styleDraggable(draggableEl, dragDisabled);
if (config.items[idx].hasOwnProperty(SHADOW_ITEM_MARKER_PROPERTY_NAME)) {
if (config.items[idx][SHADOW_ITEM_MARKER_PROPERTY_NAME]) {
morphDraggedElementToBeLike(draggedEl, draggableEl, currentMousePosition.x, currentMousePosition.y, () => config.transformDraggedElement(draggedEl, draggedElData, idx));

@@ -387,0 +388,0 @@ styleShadowEl(draggableEl);

Sorry, the diff of this file is too big to display

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