Socket
Socket
Sign inDemoInstall

@antv/g-plugin-dragndrop

Package Overview
Dependencies
Maintainers
58
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-plugin-dragndrop - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

2

dist/index.d.ts

@@ -7,3 +7,3 @@ import type { RendererPlugin } from '@antv/g';

name: string;
constructor(options: Partial<DragndropPluginOptions>);
constructor(options?: Partial<DragndropPluginOptions>);
init(container: Syringe.Container): void;

@@ -10,0 +10,0 @@ destroy(container: Syringe.Container): void;

@@ -429,7 +429,2 @@ import { Syringe, inject, singleton, Module } from 'mana-syringe';

// @ts-ignore
var moveAt = function moveAt(canvasX, canvasY) {
target.setPosition(canvasX - shiftX, canvasY - shiftY);
};
// @ts-ignore
var onMouseMove = /*#__PURE__*/function () {

@@ -444,4 +439,3 @@ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {

event.type = 'drag';
target.dispatchEvent(event);
moveAt(event.canvasX, event.canvasY); // prevent from picking the dragging element
target.dispatchEvent(event); // prevent from picking the dragging element

@@ -451,6 +445,6 @@ pointerEventsOldValue = target.style.pointerEvents;

point = overlap === 'pointer' ? [event.canvasX, event.canvasY] : target.getBounds().center;
_context.next = 8;
_context.next = 7;
return document.elementFromPoint(point[0], point[1]);
case 8:
case 7:
elemBelow = _context.sent;

@@ -460,3 +454,3 @@ target.style.pointerEvents = pointerEventsOldValue;

if (elemBelow) {
_context.next = 12;
_context.next = 11;
break;

@@ -467,4 +461,4 @@ }

case 12:
droppableBelow = elemBelow.closest('[droppable=true]');
case 11:
droppableBelow = (elemBelow === null || elemBelow === void 0 ? void 0 : elemBelow.closest('[droppable=true]')) || null;

@@ -498,3 +492,3 @@ if (currentDroppable !== droppableBelow) {

case 14:
case 13:
case "end":

@@ -515,5 +509,2 @@ return _context.stop();

target.dispatchEvent(event);
var shiftX = event.clientX - target.getBoundingClientRect().left;
var shiftY = event.clientY - target.getBoundingClientRect().top;
moveAt(event.canvasX, event.canvasY);
var currentDroppable = null;

@@ -577,2 +568,6 @@ document.addEventListener('pointermove', onMouseMove);

function Plugin(options) {
if (options === void 0) {
options = {};
}
this.options = void 0;

@@ -579,0 +574,0 @@ this.name = 'dragndrop';

@@ -433,7 +433,2 @@ 'use strict';

// @ts-ignore
var moveAt = function moveAt(canvasX, canvasY) {
target.setPosition(canvasX - shiftX, canvasY - shiftY);
};
// @ts-ignore
var onMouseMove = /*#__PURE__*/function () {

@@ -448,4 +443,3 @@ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {

event.type = 'drag';
target.dispatchEvent(event);
moveAt(event.canvasX, event.canvasY); // prevent from picking the dragging element
target.dispatchEvent(event); // prevent from picking the dragging element

@@ -455,6 +449,6 @@ pointerEventsOldValue = target.style.pointerEvents;

point = overlap === 'pointer' ? [event.canvasX, event.canvasY] : target.getBounds().center;
_context.next = 8;
_context.next = 7;
return document.elementFromPoint(point[0], point[1]);
case 8:
case 7:
elemBelow = _context.sent;

@@ -464,3 +458,3 @@ target.style.pointerEvents = pointerEventsOldValue;

if (elemBelow) {
_context.next = 12;
_context.next = 11;
break;

@@ -471,4 +465,4 @@ }

case 12:
droppableBelow = elemBelow.closest('[droppable=true]');
case 11:
droppableBelow = (elemBelow === null || elemBelow === void 0 ? void 0 : elemBelow.closest('[droppable=true]')) || null;

@@ -502,3 +496,3 @@ if (currentDroppable !== droppableBelow) {

case 14:
case 13:
case "end":

@@ -519,5 +513,2 @@ return _context.stop();

target.dispatchEvent(event);
var shiftX = event.clientX - target.getBoundingClientRect().left;
var shiftY = event.clientY - target.getBoundingClientRect().top;
moveAt(event.canvasX, event.canvasY);
var currentDroppable = null;

@@ -581,2 +572,6 @@ document.addEventListener('pointermove', onMouseMove);

function Plugin(options) {
if (options === void 0) {
options = {};
}
this.options = void 0;

@@ -583,0 +578,0 @@ this.name = 'dragndrop';

@@ -457,7 +457,2 @@ (function (global, factory) {

// @ts-ignore
var moveAt = function moveAt(canvasX, canvasY) {
target.setPosition(canvasX - shiftX, canvasY - shiftY);
};
// @ts-ignore
var onMouseMove = /*#__PURE__*/function () {

@@ -472,4 +467,3 @@ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {

event.type = 'drag';
target.dispatchEvent(event);
moveAt(event.canvasX, event.canvasY); // prevent from picking the dragging element
target.dispatchEvent(event); // prevent from picking the dragging element

@@ -479,6 +473,6 @@ pointerEventsOldValue = target.style.pointerEvents;

point = overlap === 'pointer' ? [event.canvasX, event.canvasY] : target.getBounds().center;
_context.next = 8;
_context.next = 7;
return document.elementFromPoint(point[0], point[1]);
case 8:
case 7:
elemBelow = _context.sent;

@@ -488,3 +482,3 @@ target.style.pointerEvents = pointerEventsOldValue;

if (elemBelow) {
_context.next = 12;
_context.next = 11;
break;

@@ -495,4 +489,4 @@ }

case 12:
droppableBelow = elemBelow.closest('[droppable=true]');
case 11:
droppableBelow = (elemBelow === null || elemBelow === void 0 ? void 0 : elemBelow.closest('[droppable=true]')) || null;

@@ -526,3 +520,3 @@ if (currentDroppable !== droppableBelow) {

case 14:
case 13:
case "end":

@@ -543,5 +537,2 @@ return _context.stop();

target.dispatchEvent(event);
var shiftX = event.clientX - target.getBoundingClientRect().left;
var shiftY = event.clientY - target.getBoundingClientRect().top;
moveAt(event.canvasX, event.canvasY);
var currentDroppable = null;

@@ -605,2 +596,6 @@ document.addEventListener('pointermove', onMouseMove);

function Plugin(options) {
if (options === void 0) {
options = {};
}
this.options = void 0;

@@ -607,0 +602,0 @@ this.name = 'dragndrop';

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("mana-syringe"),require("@antv/g")):"function"==typeof define&&define.amd?define(["exports","mana-syringe","@antv/g"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.Dragndrop={}),t.window.G.ManaSyringe,t.window.G)}(this,(function(t,e,r){"use strict";function n(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
n=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=Object.create((e&&e.prototype instanceof l?e:l).prototype),i=new O(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===p)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p={};function l(){}function h(){}function d(){}var v={};u(v,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(j([])));g&&g!==e&&r.call(g,i)&&(v=g);var m=d.prototype=l.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,p=s.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(p).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return p;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,p;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=d,u(m,"constructor",d),u(d,"constructor",h),h.displayName=u(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(b.prototype),u(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=j,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function o(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}function a(){return a=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},a.apply(this,arguments)}function c(t,e,r,n){var o,i=arguments.length,a=3>i?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(3>i?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function u(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var s,f,p=e.Syringe.defineToken("DragndropPluginOptions"),l=(s=function(){function t(){this.sceneGraphService=void 0,this.renderingContext=void 0,this.dragndropPluginOptions=void 0}return t.prototype.apply=function(t){var e=this,r=this.renderingContext.root.ownerDocument,o=this.dragndropPluginOptions.overlap,a=function(t){var e=t.target;if(e.getAttribute("draggable")){var a=function(t,r){e.setPosition(t-u,r-s)},c=function(){var t=i(n().mark((function t(i){var c,u,s,p;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i.type="drag",e.dispatchEvent(i),a(i.canvasX,i.canvasY),c=e.style.pointerEvents,e.style.pointerEvents="none",u="pointer"===o?[i.canvasX,i.canvasY]:e.getBounds().center,t.next=8,r.elementFromPoint(u[0],u[1]);case 8:if(s=t.sent,e.style.pointerEvents=c,s){t.next=12;break}return t.abrupt("return");case 12:p=s.closest("[droppable=true]"),f!==p&&(f&&(i.type="dragleave",i.target=f,f.dispatchEvent(i)),p&&(i.type="dragenter",i.target=p,p.dispatchEvent(i)),(f=p)&&(i.type="dragover",i.target=f,f.dispatchEvent(i)));case 14:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();t.type="dragstart",e.dispatchEvent(t);var u=t.clientX-e.getBoundingClientRect().left,s=t.clientY-e.getBoundingClientRect().top;a(t.canvasX,t.canvasY);var f=null;r.addEventListener("pointermove",c),e.addEventListener("pointerup",(function(){t.type="dragend",e.dispatchEvent(t),f&&(t.type="drop",t.target=f,f.dispatchEvent(t)),r.removeEventListener("pointermove",c)}),{once:!0})}};t.hooks.init.tapPromise(f.tag,i(n().mark((function t(){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.renderingContext.root.addEventListener("pointerdown",a);case 1:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(f.tag,(function(){e.renderingContext.root.removeEventListener("pointerdown",a)}))},t}(),s.tag="Dragndrop",f=s);c([e.inject(r.SceneGraphService),u("design:type",Object)],l.prototype,"sceneGraphService",void 0),c([e.inject(r.RenderingContext),u("design:type",Object)],l.prototype,"renderingContext",void 0),c([e.inject(p),u("design:type",Object)],l.prototype,"dragndropPluginOptions",void 0),l=f=c([e.singleton({contrib:r.RenderingPluginContribution})],l);var h=e.Module((function(t){t(l)}));t.Plugin=function(){function t(t){this.options=void 0,this.name="dragndrop",this.options=t}var e=t.prototype;return e.init=function(t){t.register(p,{useValue:a({overlap:"pointer"},this.options)}),t.load(h,!0)},e.destroy=function(t){t.remove(p),t.unload(h)},t}(),Object.defineProperty(t,"__esModule",{value:!0})}));
n=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{u({},"")}catch(t){u=function(t,e,r){return t[e]=r}}function s(t,e,r,n){var o=Object.create((e&&e.prototype instanceof l?e:l).prototype),i=new O(n||[]);return o._invoke=function(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return P()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=x(a,r);if(c){if(c===p)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,i),o}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=s;var p={};function l(){}function h(){}function d(){}var v={};u(v,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(j([])));g&&g!==e&&r.call(g,i)&&(v=g);var m=d.prototype=l.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){u(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function n(o,i,a,c){var u=f(t[o],t,i);if("throw"!==u.type){var s=u.arg,p=s.value;return p&&"object"==typeof p&&r.call(p,"__await")?e.resolve(p.__await).then((function(t){n("next",t,a,c)}),(function(t){n("throw",t,a,c)})):e.resolve(p).then((function(t){s.value=t,a(s)}),(function(t){return n("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,r){function i(){return new e((function(e,o){n(t,r,e,o)}))}return o=o?o.then(i,i):i()}}function x(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,x(t,e),"throw"===e.method))return p;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,p;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function E(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function j(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n<t.length;)if(r.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=void 0,e.done=!0,e};return o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=d,u(m,"constructor",d),u(d,"constructor",h),h.displayName=u(d,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===h||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(b.prototype),u(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new b(s(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},t.values=j,O.prototype={constructor:O,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(this.prev>=i.tryLoc){var c=r.call(i,"catchLoc"),u=r.call(i,"finallyLoc");if(c&&u){if(i.catchLoc>this.prev)return n(i.catchLoc,!0);if(i.finallyLoc>this.prev)return n(i.finallyLoc)}else if(c){if(i.catchLoc>this.prev)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(i.finallyLoc>this.prev)return n(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(this.prev>=o.tryLoc&&r.call(o,"finallyLoc")&&o.finallyLoc>this.prev){var i=o;break}}i&&("break"===t||"continue"===t)&&e>=i.tryLoc&&i.finallyLoc>=e&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:j(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},t}function o(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}function a(){return a=Object.assign||function(t){for(var e=1;arguments.length>e;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},a.apply(this,arguments)}function c(t,e,r,n){var o,i=arguments.length,a=3>i?e:null===n?n=Object.getOwnPropertyDescriptor(e,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,r,n);else for(var c=t.length-1;c>=0;c--)(o=t[c])&&(a=(3>i?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a}function u(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}var s,f,p=e.Syringe.defineToken("DragndropPluginOptions"),l=(s=function(){function t(){this.sceneGraphService=void 0,this.renderingContext=void 0,this.dragndropPluginOptions=void 0}return t.prototype.apply=function(t){var e=this,r=this.renderingContext.root.ownerDocument,o=this.dragndropPluginOptions.overlap,a=function(t){var e=t.target;if(e.getAttribute("draggable")){var a=function(){var t=i(n().mark((function t(i){var a,u,s,f;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i.type="drag",e.dispatchEvent(i),a=e.style.pointerEvents,e.style.pointerEvents="none",u="pointer"===o?[i.canvasX,i.canvasY]:e.getBounds().center,t.next=7,r.elementFromPoint(u[0],u[1]);case 7:if(s=t.sent,e.style.pointerEvents=a,s){t.next=11;break}return t.abrupt("return");case 11:f=(null==s?void 0:s.closest("[droppable=true]"))||null,c!==f&&(c&&(i.type="dragleave",i.target=c,c.dispatchEvent(i)),f&&(i.type="dragenter",i.target=f,f.dispatchEvent(i)),(c=f)&&(i.type="dragover",i.target=c,c.dispatchEvent(i)));case 13:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();t.type="dragstart",e.dispatchEvent(t);var c=null;r.addEventListener("pointermove",a),e.addEventListener("pointerup",(function(){t.type="dragend",e.dispatchEvent(t),c&&(t.type="drop",t.target=c,c.dispatchEvent(t)),r.removeEventListener("pointermove",a)}),{once:!0})}};t.hooks.init.tapPromise(f.tag,i(n().mark((function t(){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.renderingContext.root.addEventListener("pointerdown",a);case 1:case"end":return t.stop()}}),t)})))),t.hooks.destroy.tap(f.tag,(function(){e.renderingContext.root.removeEventListener("pointerdown",a)}))},t}(),s.tag="Dragndrop",f=s);c([e.inject(r.SceneGraphService),u("design:type",Object)],l.prototype,"sceneGraphService",void 0),c([e.inject(r.RenderingContext),u("design:type",Object)],l.prototype,"renderingContext",void 0),c([e.inject(p),u("design:type",Object)],l.prototype,"dragndropPluginOptions",void 0),l=f=c([e.singleton({contrib:r.RenderingPluginContribution})],l);var h=e.Module((function(t){t(l)}));t.Plugin=function(){function t(t){void 0===t&&(t={}),this.options=void 0,this.name="dragndrop",this.options=t}var e=t.prototype;return e.init=function(t){t.register(p,{useValue:a({overlap:"pointer"},this.options)}),t.load(h,!0)},e.destroy=function(t){t.remove(p),t.unload(h)},t}(),Object.defineProperty(t,"__esModule",{value:!0})}));
{
"name": "@antv/g-plugin-dragndrop",
"version": "1.0.1",
"version": "1.0.2",
"description": "A G plugin for Drag n Drop implemented with PointerEvents",

@@ -42,3 +42,3 @@ "keywords": [

},
"gitHead": "8c7cefec629c4a036903a55e9b435ef4ddbcf9c3"
"gitHead": "f5f33290d3601bd78f0312324dec992798c6de7b"
}

Sorry, the diff of this file is not supported yet

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