@antv/g-plugin-dragndrop 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +15 -0
- package/dist/DragndropPlugin.d.ts +10 -0
- package/dist/DragndropPlugin.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +594 -0
- package/dist/index.js +598 -0
- package/dist/index.umd.js +626 -0
- package/dist/index.umd.min.js +3 -0
- package/dist/tokens.d.ts +12 -0
- package/dist/tokens.d.ts.map +1 -0
- package/package.json +43 -0
|
@@ -0,0 +1,626 @@
|
|
|
1
|
+
(function (global, factory) {
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('mana-syringe'), require('@antv/g')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'mana-syringe', '@antv/g'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.G = global.G || {}, global.G.Dragndrop = {}), global.window.G.ManaSyringe, global.window.G));
|
|
5
|
+
}(this, (function (exports, manaSyringe, g) { 'use strict';
|
|
6
|
+
|
|
7
|
+
function _regeneratorRuntime() {
|
|
8
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
9
|
+
|
|
10
|
+
_regeneratorRuntime = function () {
|
|
11
|
+
return exports;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
var exports = {},
|
|
15
|
+
Op = Object.prototype,
|
|
16
|
+
hasOwn = Op.hasOwnProperty,
|
|
17
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
18
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
19
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
20
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
21
|
+
|
|
22
|
+
function define(obj, key, value) {
|
|
23
|
+
return Object.defineProperty(obj, key, {
|
|
24
|
+
value: value,
|
|
25
|
+
enumerable: !0,
|
|
26
|
+
configurable: !0,
|
|
27
|
+
writable: !0
|
|
28
|
+
}), obj[key];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
define({}, "");
|
|
33
|
+
} catch (err) {
|
|
34
|
+
define = function (obj, key, value) {
|
|
35
|
+
return obj[key] = value;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
40
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
41
|
+
generator = Object.create(protoGenerator.prototype),
|
|
42
|
+
context = new Context(tryLocsList || []);
|
|
43
|
+
return generator._invoke = function (innerFn, self, context) {
|
|
44
|
+
var state = "suspendedStart";
|
|
45
|
+
return function (method, arg) {
|
|
46
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
47
|
+
|
|
48
|
+
if ("completed" === state) {
|
|
49
|
+
if ("throw" === method) throw arg;
|
|
50
|
+
return doneResult();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
for (context.method = method, context.arg = arg;;) {
|
|
54
|
+
var delegate = context.delegate;
|
|
55
|
+
|
|
56
|
+
if (delegate) {
|
|
57
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
58
|
+
|
|
59
|
+
if (delegateResult) {
|
|
60
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
61
|
+
return delegateResult;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
66
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
67
|
+
context.dispatchException(context.arg);
|
|
68
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
69
|
+
state = "executing";
|
|
70
|
+
var record = tryCatch(innerFn, self, context);
|
|
71
|
+
|
|
72
|
+
if ("normal" === record.type) {
|
|
73
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
74
|
+
return {
|
|
75
|
+
value: record.arg,
|
|
76
|
+
done: context.done
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}(innerFn, self, context), generator;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function tryCatch(fn, obj, arg) {
|
|
87
|
+
try {
|
|
88
|
+
return {
|
|
89
|
+
type: "normal",
|
|
90
|
+
arg: fn.call(obj, arg)
|
|
91
|
+
};
|
|
92
|
+
} catch (err) {
|
|
93
|
+
return {
|
|
94
|
+
type: "throw",
|
|
95
|
+
arg: err
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
exports.wrap = wrap;
|
|
101
|
+
var ContinueSentinel = {};
|
|
102
|
+
|
|
103
|
+
function Generator() {}
|
|
104
|
+
|
|
105
|
+
function GeneratorFunction() {}
|
|
106
|
+
|
|
107
|
+
function GeneratorFunctionPrototype() {}
|
|
108
|
+
|
|
109
|
+
var IteratorPrototype = {};
|
|
110
|
+
define(IteratorPrototype, iteratorSymbol, function () {
|
|
111
|
+
return this;
|
|
112
|
+
});
|
|
113
|
+
var getProto = Object.getPrototypeOf,
|
|
114
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
115
|
+
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
116
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
117
|
+
|
|
118
|
+
function defineIteratorMethods(prototype) {
|
|
119
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
120
|
+
define(prototype, method, function (arg) {
|
|
121
|
+
return this._invoke(method, arg);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
127
|
+
function invoke(method, arg, resolve, reject) {
|
|
128
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
129
|
+
|
|
130
|
+
if ("throw" !== record.type) {
|
|
131
|
+
var result = record.arg,
|
|
132
|
+
value = result.value;
|
|
133
|
+
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
134
|
+
invoke("next", value, resolve, reject);
|
|
135
|
+
}, function (err) {
|
|
136
|
+
invoke("throw", err, resolve, reject);
|
|
137
|
+
}) : PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
138
|
+
result.value = unwrapped, resolve(result);
|
|
139
|
+
}, function (error) {
|
|
140
|
+
return invoke("throw", error, resolve, reject);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
reject(record.arg);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
var previousPromise;
|
|
148
|
+
|
|
149
|
+
this._invoke = function (method, arg) {
|
|
150
|
+
function callInvokeWithMethodAndArg() {
|
|
151
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
152
|
+
invoke(method, arg, resolve, reject);
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
161
|
+
var method = delegate.iterator[context.method];
|
|
162
|
+
|
|
163
|
+
if (undefined === method) {
|
|
164
|
+
if (context.delegate = null, "throw" === context.method) {
|
|
165
|
+
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
166
|
+
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return ContinueSentinel;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
173
|
+
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
174
|
+
var info = record.arg;
|
|
175
|
+
return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function pushTryEntry(locs) {
|
|
179
|
+
var entry = {
|
|
180
|
+
tryLoc: locs[0]
|
|
181
|
+
};
|
|
182
|
+
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function resetTryEntry(entry) {
|
|
186
|
+
var record = entry.completion || {};
|
|
187
|
+
record.type = "normal", delete record.arg, entry.completion = record;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function Context(tryLocsList) {
|
|
191
|
+
this.tryEntries = [{
|
|
192
|
+
tryLoc: "root"
|
|
193
|
+
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function values(iterable) {
|
|
197
|
+
if (iterable) {
|
|
198
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
199
|
+
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
200
|
+
if ("function" == typeof iterable.next) return iterable;
|
|
201
|
+
|
|
202
|
+
if (!isNaN(iterable.length)) {
|
|
203
|
+
var i = -1,
|
|
204
|
+
next = function next() {
|
|
205
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
206
|
+
|
|
207
|
+
return next.value = undefined, next.done = !0, next;
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
return next.next = next;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
next: doneResult
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function doneResult() {
|
|
220
|
+
return {
|
|
221
|
+
value: undefined,
|
|
222
|
+
done: !0
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
227
|
+
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
228
|
+
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
229
|
+
}, exports.mark = function (genFun) {
|
|
230
|
+
return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
|
|
231
|
+
}, exports.awrap = function (arg) {
|
|
232
|
+
return {
|
|
233
|
+
__await: arg
|
|
234
|
+
};
|
|
235
|
+
}, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
|
|
236
|
+
return this;
|
|
237
|
+
}), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
238
|
+
void 0 === PromiseImpl && (PromiseImpl = Promise);
|
|
239
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
240
|
+
return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
|
|
241
|
+
return result.done ? result.value : iter.next();
|
|
242
|
+
});
|
|
243
|
+
}, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
|
|
244
|
+
return this;
|
|
245
|
+
}), define(Gp, "toString", function () {
|
|
246
|
+
return "[object Generator]";
|
|
247
|
+
}), exports.keys = function (object) {
|
|
248
|
+
var keys = [];
|
|
249
|
+
|
|
250
|
+
for (var key in object) keys.push(key);
|
|
251
|
+
|
|
252
|
+
return keys.reverse(), function next() {
|
|
253
|
+
for (; keys.length;) {
|
|
254
|
+
var key = keys.pop();
|
|
255
|
+
if (key in object) return next.value = key, next.done = !1, next;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return next.done = !0, next;
|
|
259
|
+
};
|
|
260
|
+
}, exports.values = values, Context.prototype = {
|
|
261
|
+
constructor: Context,
|
|
262
|
+
reset: function (skipTempReset) {
|
|
263
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
|
|
264
|
+
},
|
|
265
|
+
stop: function () {
|
|
266
|
+
this.done = !0;
|
|
267
|
+
var rootRecord = this.tryEntries[0].completion;
|
|
268
|
+
if ("throw" === rootRecord.type) throw rootRecord.arg;
|
|
269
|
+
return this.rval;
|
|
270
|
+
},
|
|
271
|
+
dispatchException: function (exception) {
|
|
272
|
+
if (this.done) throw exception;
|
|
273
|
+
var context = this;
|
|
274
|
+
|
|
275
|
+
function handle(loc, caught) {
|
|
276
|
+
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
280
|
+
var entry = this.tryEntries[i],
|
|
281
|
+
record = entry.completion;
|
|
282
|
+
if ("root" === entry.tryLoc) return handle("end");
|
|
283
|
+
|
|
284
|
+
if (entry.tryLoc <= this.prev) {
|
|
285
|
+
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
286
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
287
|
+
|
|
288
|
+
if (hasCatch && hasFinally) {
|
|
289
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
290
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
291
|
+
} else if (hasCatch) {
|
|
292
|
+
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
293
|
+
} else {
|
|
294
|
+
if (!hasFinally) throw new Error("try statement without catch or finally");
|
|
295
|
+
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
abrupt: function (type, arg) {
|
|
301
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
302
|
+
var entry = this.tryEntries[i];
|
|
303
|
+
|
|
304
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
305
|
+
var finallyEntry = entry;
|
|
306
|
+
break;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
311
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
312
|
+
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
313
|
+
},
|
|
314
|
+
complete: function (record, afterLoc) {
|
|
315
|
+
if ("throw" === record.type) throw record.arg;
|
|
316
|
+
return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
|
|
317
|
+
},
|
|
318
|
+
finish: function (finallyLoc) {
|
|
319
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
320
|
+
var entry = this.tryEntries[i];
|
|
321
|
+
if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
catch: function (tryLoc) {
|
|
325
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
326
|
+
var entry = this.tryEntries[i];
|
|
327
|
+
|
|
328
|
+
if (entry.tryLoc === tryLoc) {
|
|
329
|
+
var record = entry.completion;
|
|
330
|
+
|
|
331
|
+
if ("throw" === record.type) {
|
|
332
|
+
var thrown = record.arg;
|
|
333
|
+
resetTryEntry(entry);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return thrown;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
throw new Error("illegal catch attempt");
|
|
341
|
+
},
|
|
342
|
+
delegateYield: function (iterable, resultName, nextLoc) {
|
|
343
|
+
return this.delegate = {
|
|
344
|
+
iterator: values(iterable),
|
|
345
|
+
resultName: resultName,
|
|
346
|
+
nextLoc: nextLoc
|
|
347
|
+
}, "next" === this.method && (this.arg = undefined), ContinueSentinel;
|
|
348
|
+
}
|
|
349
|
+
}, exports;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
353
|
+
try {
|
|
354
|
+
var info = gen[key](arg);
|
|
355
|
+
var value = info.value;
|
|
356
|
+
} catch (error) {
|
|
357
|
+
reject(error);
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
if (info.done) {
|
|
362
|
+
resolve(value);
|
|
363
|
+
} else {
|
|
364
|
+
Promise.resolve(value).then(_next, _throw);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function _asyncToGenerator(fn) {
|
|
369
|
+
return function () {
|
|
370
|
+
var self = this,
|
|
371
|
+
args = arguments;
|
|
372
|
+
return new Promise(function (resolve, reject) {
|
|
373
|
+
var gen = fn.apply(self, args);
|
|
374
|
+
|
|
375
|
+
function _next(value) {
|
|
376
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
function _throw(err) {
|
|
380
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
_next(undefined);
|
|
384
|
+
});
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
function _extends() {
|
|
389
|
+
_extends = Object.assign || function (target) {
|
|
390
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
391
|
+
var source = arguments[i];
|
|
392
|
+
|
|
393
|
+
for (var key in source) {
|
|
394
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
395
|
+
target[key] = source[key];
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
return target;
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
return _extends.apply(this, arguments);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/******************************************************************************
|
|
407
|
+
Copyright (c) Microsoft Corporation.
|
|
408
|
+
|
|
409
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
410
|
+
purpose with or without fee is hereby granted.
|
|
411
|
+
|
|
412
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
413
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
414
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
415
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
416
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
417
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
418
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
419
|
+
***************************************************************************** */
|
|
420
|
+
|
|
421
|
+
function __decorate(decorators, target, key, desc) {
|
|
422
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
423
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
424
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
425
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function __metadata(metadataKey, metadataValue) {
|
|
429
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
var DragndropPluginOptions = manaSyringe.Syringe.defineToken('DragndropPluginOptions');
|
|
433
|
+
|
|
434
|
+
var _class;
|
|
435
|
+
|
|
436
|
+
var DragndropPlugin_1;
|
|
437
|
+
var DragndropPlugin = DragndropPlugin_1 = (_class = /*#__PURE__*/function () {
|
|
438
|
+
function DragndropPlugin() {
|
|
439
|
+
this.sceneGraphService = void 0;
|
|
440
|
+
this.renderingContext = void 0;
|
|
441
|
+
this.dragndropPluginOptions = void 0;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
var _proto = DragndropPlugin.prototype;
|
|
445
|
+
|
|
446
|
+
_proto.apply = function apply(renderingService) {
|
|
447
|
+
var _this = this;
|
|
448
|
+
|
|
449
|
+
var document = this.renderingContext.root.ownerDocument;
|
|
450
|
+
var overlap = this.dragndropPluginOptions.overlap;
|
|
451
|
+
|
|
452
|
+
var handlePointerdown = function handlePointerdown(event) {
|
|
453
|
+
var target = event.target;
|
|
454
|
+
|
|
455
|
+
if (target.getAttribute('draggable')) {
|
|
456
|
+
// @ts-ignore
|
|
457
|
+
var moveAt = function moveAt(canvasX, canvasY) {
|
|
458
|
+
target.setPosition(canvasX - shiftX, canvasY - shiftY);
|
|
459
|
+
};
|
|
460
|
+
|
|
461
|
+
// @ts-ignore
|
|
462
|
+
var onMouseMove = /*#__PURE__*/function () {
|
|
463
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(event) {
|
|
464
|
+
var pointerEventsOldValue, point, elemBelow, droppableBelow;
|
|
465
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
466
|
+
while (1) {
|
|
467
|
+
switch (_context.prev = _context.next) {
|
|
468
|
+
case 0:
|
|
469
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/drag_event
|
|
470
|
+
event.type = 'drag';
|
|
471
|
+
target.dispatchEvent(event);
|
|
472
|
+
moveAt(event.canvasX, event.canvasY); // prevent from picking the dragging element
|
|
473
|
+
|
|
474
|
+
pointerEventsOldValue = target.style.pointerEvents;
|
|
475
|
+
target.style.pointerEvents = 'none';
|
|
476
|
+
point = overlap === 'pointer' ? [event.canvasX, event.canvasY] : target.getBounds().center;
|
|
477
|
+
_context.next = 8;
|
|
478
|
+
return document.elementFromPoint(point[0], point[1]);
|
|
479
|
+
|
|
480
|
+
case 8:
|
|
481
|
+
elemBelow = _context.sent;
|
|
482
|
+
target.style.pointerEvents = pointerEventsOldValue;
|
|
483
|
+
|
|
484
|
+
if (elemBelow) {
|
|
485
|
+
_context.next = 12;
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return _context.abrupt("return");
|
|
490
|
+
|
|
491
|
+
case 12:
|
|
492
|
+
droppableBelow = elemBelow.closest('[droppable=true]');
|
|
493
|
+
|
|
494
|
+
if (currentDroppable !== droppableBelow) {
|
|
495
|
+
if (currentDroppable) {
|
|
496
|
+
// null when we were not over a droppable before this event
|
|
497
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragleave_event
|
|
498
|
+
event.type = 'dragleave';
|
|
499
|
+
event.target = currentDroppable;
|
|
500
|
+
currentDroppable.dispatchEvent(event);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
if (droppableBelow) {
|
|
504
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragleave_event
|
|
505
|
+
event.type = 'dragenter';
|
|
506
|
+
event.target = droppableBelow;
|
|
507
|
+
droppableBelow.dispatchEvent(event);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
currentDroppable = droppableBelow;
|
|
511
|
+
|
|
512
|
+
if (currentDroppable) {
|
|
513
|
+
// null if we're not coming over a droppable now
|
|
514
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragover_event
|
|
515
|
+
event.type = 'dragover';
|
|
516
|
+
event.target = currentDroppable;
|
|
517
|
+
currentDroppable.dispatchEvent(event);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
case 14:
|
|
522
|
+
case "end":
|
|
523
|
+
return _context.stop();
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
}, _callee);
|
|
527
|
+
}));
|
|
528
|
+
|
|
529
|
+
return function onMouseMove(_x) {
|
|
530
|
+
return _ref.apply(this, arguments);
|
|
531
|
+
};
|
|
532
|
+
}();
|
|
533
|
+
|
|
534
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragstart_event
|
|
535
|
+
event.type = 'dragstart';
|
|
536
|
+
target.dispatchEvent(event);
|
|
537
|
+
var shiftX = event.clientX - target.getBoundingClientRect().left;
|
|
538
|
+
var shiftY = event.clientY - target.getBoundingClientRect().top;
|
|
539
|
+
moveAt(event.canvasX, event.canvasY);
|
|
540
|
+
var currentDroppable = null;
|
|
541
|
+
document.addEventListener('pointermove', onMouseMove);
|
|
542
|
+
target.addEventListener('pointerup', function () {
|
|
543
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/dragend_event
|
|
544
|
+
event.type = 'dragend';
|
|
545
|
+
target.dispatchEvent(event);
|
|
546
|
+
|
|
547
|
+
if (currentDroppable) {
|
|
548
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/API/Document/drop_event
|
|
549
|
+
event.type = 'drop';
|
|
550
|
+
event.target = currentDroppable;
|
|
551
|
+
currentDroppable.dispatchEvent(event);
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
document.removeEventListener('pointermove', onMouseMove);
|
|
555
|
+
}, {
|
|
556
|
+
once: true
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
renderingService.hooks.init.tapPromise(DragndropPlugin_1.tag, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
562
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
563
|
+
while (1) {
|
|
564
|
+
switch (_context2.prev = _context2.next) {
|
|
565
|
+
case 0:
|
|
566
|
+
_this.renderingContext.root.addEventListener('pointerdown', handlePointerdown);
|
|
567
|
+
|
|
568
|
+
case 1:
|
|
569
|
+
case "end":
|
|
570
|
+
return _context2.stop();
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
}, _callee2);
|
|
574
|
+
})));
|
|
575
|
+
renderingService.hooks.destroy.tap(DragndropPlugin_1.tag, function () {
|
|
576
|
+
_this.renderingContext.root.removeEventListener('pointerdown', handlePointerdown);
|
|
577
|
+
});
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
return DragndropPlugin;
|
|
581
|
+
}(), _class.tag = 'Dragndrop', _class);
|
|
582
|
+
|
|
583
|
+
__decorate([manaSyringe.inject(g.SceneGraphService), __metadata("design:type", Object)], DragndropPlugin.prototype, "sceneGraphService", void 0);
|
|
584
|
+
|
|
585
|
+
__decorate([manaSyringe.inject(g.RenderingContext), __metadata("design:type", Object)], DragndropPlugin.prototype, "renderingContext", void 0);
|
|
586
|
+
|
|
587
|
+
__decorate([manaSyringe.inject(DragndropPluginOptions), __metadata("design:type", Object)], DragndropPlugin.prototype, "dragndropPluginOptions", void 0);
|
|
588
|
+
|
|
589
|
+
DragndropPlugin = DragndropPlugin_1 = __decorate([manaSyringe.singleton({
|
|
590
|
+
contrib: g.RenderingPluginContribution
|
|
591
|
+
})], DragndropPlugin);
|
|
592
|
+
|
|
593
|
+
var containerModule = manaSyringe.Module(function (register) {
|
|
594
|
+
register(DragndropPlugin);
|
|
595
|
+
});
|
|
596
|
+
var Plugin = /*#__PURE__*/function () {
|
|
597
|
+
function Plugin(options) {
|
|
598
|
+
this.options = void 0;
|
|
599
|
+
this.name = 'dragndrop';
|
|
600
|
+
this.options = options;
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
var _proto = Plugin.prototype;
|
|
604
|
+
|
|
605
|
+
_proto.init = function init(container) {
|
|
606
|
+
container.register(DragndropPluginOptions, {
|
|
607
|
+
useValue: _extends({
|
|
608
|
+
overlap: 'pointer'
|
|
609
|
+
}, this.options)
|
|
610
|
+
});
|
|
611
|
+
container.load(containerModule, true);
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
_proto.destroy = function destroy(container) {
|
|
615
|
+
container.remove(DragndropPluginOptions);
|
|
616
|
+
container.unload(containerModule);
|
|
617
|
+
};
|
|
618
|
+
|
|
619
|
+
return Plugin;
|
|
620
|
+
}();
|
|
621
|
+
|
|
622
|
+
exports.Plugin = Plugin;
|
|
623
|
+
|
|
624
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
625
|
+
|
|
626
|
+
})));
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
!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(){
|
|
2
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3
|
+
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})}));
|
package/dist/tokens.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Syringe } from 'mana-syringe';
|
|
2
|
+
export declare const DragndropPluginOptions: Syringe.DefinedToken;
|
|
3
|
+
export interface DragndropPluginOptions {
|
|
4
|
+
/**
|
|
5
|
+
* How drops are checked for. The allowed values are:
|
|
6
|
+
* - 'pointer' – the pointer must be over the dropzone (default)
|
|
7
|
+
* - 'center' – the draggable element’s center must be over the dropzone
|
|
8
|
+
* @see https://interactjs.io/docs/dropzone/#accept
|
|
9
|
+
*/
|
|
10
|
+
overlap: 'pointer' | 'center';
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,eAAO,MAAM,sBAAsB,sBAAgD,CAAC;AAEpF,MAAM,WAAW,sBAAsB;IACrC;;;;;OAKG;IACH,OAAO,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC/B"}
|