@antv/g-svg 1.1.7 → 1.1.8-alpha.2
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/dist/ContextRegisterPlugin.d.ts +1 -2
- package/dist/ContextRegisterPlugin.d.ts.map +1 -1
- package/dist/SVGContextService.d.ts +1 -1
- package/dist/SVGContextService.d.ts.map +1 -1
- package/dist/index.esm.js +422 -23
- package/dist/index.js +423 -24
- package/dist/index.umd.js +622 -172
- package/dist/index.umd.min.js +6 -4
- package/package.json +7 -7
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,389 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@antv/g')
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '@antv/g'
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.G = global.G || {}, global.G.SVG = {}), global.window.G
|
|
5
|
-
}(this, (function (exports, g
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@antv/g')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', '@antv/g'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.G = global.G || {}, global.G.SVG = {}), global.window.G));
|
|
5
|
+
}(this, (function (exports, 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
|
+
}
|
|
6
387
|
|
|
7
388
|
function _inheritsLoose(subClass, superClass) {
|
|
8
389
|
subClass.prototype = Object.create(superClass.prototype);
|
|
@@ -46,9 +427,9 @@
|
|
|
46
427
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
47
428
|
}
|
|
48
429
|
|
|
49
|
-
function _regeneratorRuntime() {
|
|
430
|
+
function _regeneratorRuntime$1() {
|
|
50
431
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
51
|
-
_regeneratorRuntime = function _regeneratorRuntime() {
|
|
432
|
+
_regeneratorRuntime$1 = function _regeneratorRuntime() {
|
|
52
433
|
return exports;
|
|
53
434
|
};
|
|
54
435
|
|
|
@@ -396,7 +777,7 @@
|
|
|
396
777
|
}, exports;
|
|
397
778
|
}
|
|
398
779
|
|
|
399
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
780
|
+
function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
|
|
400
781
|
try {
|
|
401
782
|
var info = gen[key](arg);
|
|
402
783
|
var value = info.value;
|
|
@@ -412,7 +793,7 @@
|
|
|
412
793
|
}
|
|
413
794
|
}
|
|
414
795
|
|
|
415
|
-
function _asyncToGenerator(fn) {
|
|
796
|
+
function _asyncToGenerator$1(fn) {
|
|
416
797
|
return function () {
|
|
417
798
|
var self = this,
|
|
418
799
|
args = arguments;
|
|
@@ -420,11 +801,11 @@
|
|
|
420
801
|
var gen = fn.apply(self, args);
|
|
421
802
|
|
|
422
803
|
function _next(value) {
|
|
423
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
804
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
|
|
424
805
|
}
|
|
425
806
|
|
|
426
807
|
function _throw(err) {
|
|
427
|
-
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
808
|
+
asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
|
|
428
809
|
}
|
|
429
810
|
|
|
430
811
|
_next(undefined);
|
|
@@ -525,9 +906,9 @@
|
|
|
525
906
|
globalThis.removeEventListener('mouseup', onPointerUp, true);
|
|
526
907
|
};
|
|
527
908
|
|
|
528
|
-
renderingService.hooks.init.tapPromise(DOMInteractionPlugin_1.tag, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
909
|
+
renderingService.hooks.init.tapPromise(DOMInteractionPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
|
|
529
910
|
var $el;
|
|
530
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
911
|
+
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
531
912
|
while (1) {
|
|
532
913
|
switch (_context.prev = _context.next) {
|
|
533
914
|
case 0:
|
|
@@ -586,14 +967,14 @@
|
|
|
586
967
|
return DOMInteractionPlugin;
|
|
587
968
|
}(), _class.tag = 'DOMInteraction', _class);
|
|
588
969
|
|
|
589
|
-
__decorate([
|
|
970
|
+
__decorate([g.inject(g.ContextService), __metadata("design:type", Object)], DOMInteractionPlugin.prototype, "contextService", void 0);
|
|
590
971
|
|
|
591
|
-
__decorate([
|
|
972
|
+
__decorate([g.inject(g.RenderingContext), __metadata("design:type", Object)], DOMInteractionPlugin.prototype, "renderingContext", void 0);
|
|
592
973
|
|
|
593
|
-
DOMInteractionPlugin = DOMInteractionPlugin_1 = __decorate([
|
|
974
|
+
DOMInteractionPlugin = DOMInteractionPlugin_1 = __decorate([g.singleton({
|
|
594
975
|
contrib: g.RenderingPluginContribution
|
|
595
976
|
})], DOMInteractionPlugin);
|
|
596
|
-
var containerModule =
|
|
977
|
+
var containerModule = g.Module(function (register) {
|
|
597
978
|
register(DOMInteractionPlugin);
|
|
598
979
|
});
|
|
599
980
|
|
|
@@ -889,21 +1270,12 @@
|
|
|
889
1270
|
y1 = parsedStyle.y1,
|
|
890
1271
|
x2 = parsedStyle.x2,
|
|
891
1272
|
y2 = parsedStyle.y2,
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
$el.setAttribute('
|
|
898
|
-
$el.setAttribute('y1', "" + (y1.value - y));
|
|
899
|
-
$el.setAttribute('x2', "" + (x2.value - x)); // fix horizontal line stroke url bug in Chrome
|
|
900
|
-
// @see https://stackoverflow.com/questions/14680240/did-chrome-break-svg-stroke-url
|
|
901
|
-
|
|
902
|
-
if (y1.value === y2.value && stroke && !(stroke instanceof g.CSSRGB)) {
|
|
903
|
-
$el.setAttribute('y2', "" + (y2.value - y + 0.00001));
|
|
904
|
-
} else {
|
|
905
|
-
$el.setAttribute('y2', "" + (y2.value - y));
|
|
906
|
-
}
|
|
1273
|
+
defX = parsedStyle.defX,
|
|
1274
|
+
defY = parsedStyle.defY;
|
|
1275
|
+
$el.setAttribute('x1', "" + (x1.value - defX));
|
|
1276
|
+
$el.setAttribute('y1', "" + (y1.value - defY));
|
|
1277
|
+
$el.setAttribute('x2', "" + (x2.value - defX));
|
|
1278
|
+
$el.setAttribute('y2', "" + (y2.value - defY));
|
|
907
1279
|
}
|
|
908
1280
|
|
|
909
1281
|
function updatePathElementAttribute($el, parsedStyle) {
|
|
@@ -1076,7 +1448,7 @@
|
|
|
1076
1448
|
}
|
|
1077
1449
|
}
|
|
1078
1450
|
|
|
1079
|
-
var CreateElementContribution =
|
|
1451
|
+
var CreateElementContribution = g.Syringe.defineToken('CreateElementContribution', {
|
|
1080
1452
|
multiple: false
|
|
1081
1453
|
});
|
|
1082
1454
|
|
|
@@ -1156,15 +1528,15 @@
|
|
|
1156
1528
|
return DefaultCreateElementContribution;
|
|
1157
1529
|
}();
|
|
1158
1530
|
|
|
1159
|
-
__decorate([
|
|
1531
|
+
__decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], DefaultCreateElementContribution.prototype, "canvasConfig", void 0);
|
|
1160
1532
|
|
|
1161
|
-
DefaultCreateElementContribution = __decorate([
|
|
1533
|
+
DefaultCreateElementContribution = __decorate([g.singleton({
|
|
1162
1534
|
token: CreateElementContribution
|
|
1163
1535
|
})], DefaultCreateElementContribution);
|
|
1164
1536
|
|
|
1165
|
-
function _regeneratorRuntime$
|
|
1537
|
+
function _regeneratorRuntime$2() {
|
|
1166
1538
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
1167
|
-
_regeneratorRuntime$
|
|
1539
|
+
_regeneratorRuntime$2 = function _regeneratorRuntime() {
|
|
1168
1540
|
return exports;
|
|
1169
1541
|
};
|
|
1170
1542
|
|
|
@@ -1512,7 +1884,7 @@
|
|
|
1512
1884
|
}, exports;
|
|
1513
1885
|
}
|
|
1514
1886
|
|
|
1515
|
-
function asyncGeneratorStep$
|
|
1887
|
+
function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
|
|
1516
1888
|
try {
|
|
1517
1889
|
var info = gen[key](arg);
|
|
1518
1890
|
var value = info.value;
|
|
@@ -1528,7 +1900,7 @@
|
|
|
1528
1900
|
}
|
|
1529
1901
|
}
|
|
1530
1902
|
|
|
1531
|
-
function _asyncToGenerator$
|
|
1903
|
+
function _asyncToGenerator$2(fn) {
|
|
1532
1904
|
return function () {
|
|
1533
1905
|
var self = this,
|
|
1534
1906
|
args = arguments;
|
|
@@ -1536,11 +1908,11 @@
|
|
|
1536
1908
|
var gen = fn.apply(self, args);
|
|
1537
1909
|
|
|
1538
1910
|
function _next(value) {
|
|
1539
|
-
asyncGeneratorStep$
|
|
1911
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
|
|
1540
1912
|
}
|
|
1541
1913
|
|
|
1542
1914
|
function _throw(err) {
|
|
1543
|
-
asyncGeneratorStep$
|
|
1915
|
+
asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
|
|
1544
1916
|
}
|
|
1545
1917
|
|
|
1546
1918
|
_next(undefined);
|
|
@@ -2230,7 +2602,9 @@
|
|
|
2230
2602
|
var filterIds = filters.map(function (_ref, i) {
|
|
2231
2603
|
var name = _ref.name,
|
|
2232
2604
|
params = _ref.params;
|
|
2233
|
-
var $filter = createSVGElement('filter', document);
|
|
2605
|
+
var $filter = createSVGElement('filter', document); // @see https://github.com/antvis/g/issues/1025
|
|
2606
|
+
|
|
2607
|
+
$filter.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
2234
2608
|
|
|
2235
2609
|
if (name === 'blur') {
|
|
2236
2610
|
createBlur(document, $filter, params);
|
|
@@ -2405,9 +2779,6 @@
|
|
|
2405
2779
|
return;
|
|
2406
2780
|
}
|
|
2407
2781
|
|
|
2408
|
-
var gradientId = generateCacheKey(parsedColor);
|
|
2409
|
-
var existed = $def.querySelector("#" + gradientId);
|
|
2410
|
-
|
|
2411
2782
|
if (parsedColor instanceof g.CSSRGB) {
|
|
2412
2783
|
// keep using currentColor @see https://github.com/d3/d3-axis/issues/49
|
|
2413
2784
|
if (object.style[name] === 'currentColor') {
|
|
@@ -2418,17 +2789,9 @@
|
|
|
2418
2789
|
}
|
|
2419
2790
|
} else {
|
|
2420
2791
|
if (parsedColor.type === g.GradientPatternType.Pattern) {
|
|
2421
|
-
|
|
2422
|
-
createPattern(document, $def, parsedColor, gradientId);
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, "url(#" + gradientId + ")");
|
|
2792
|
+
createOrUpdatePattern(document, $def, $el, name, parsedColor);
|
|
2426
2793
|
} else {
|
|
2427
|
-
|
|
2428
|
-
createGradient(document, $def, parsedColor, gradientId);
|
|
2429
|
-
}
|
|
2430
|
-
|
|
2431
|
-
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, "url(#" + gradientId + ")");
|
|
2794
|
+
createOrUpdateGradient(document, object, $def, $el, name, parsedColor);
|
|
2432
2795
|
}
|
|
2433
2796
|
}
|
|
2434
2797
|
}
|
|
@@ -2466,43 +2829,71 @@
|
|
|
2466
2829
|
return cacheKey2IDMap[cacheKey];
|
|
2467
2830
|
}
|
|
2468
2831
|
|
|
2469
|
-
function
|
|
2470
|
-
var
|
|
2832
|
+
function createOrUpdatePattern(document, $def, $el, name, parsedColor) {
|
|
2833
|
+
var patternId = generateCacheKey(parsedColor);
|
|
2834
|
+
var $existed = $def.querySelector("#" + patternId);
|
|
2835
|
+
|
|
2836
|
+
if (!$existed) {
|
|
2837
|
+
var src = parsedColor.value.src; // @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/pattern
|
|
2838
|
+
|
|
2839
|
+
var $pattern = createSVGElement('pattern', document);
|
|
2840
|
+
$pattern.setAttribute('patternUnits', 'userSpaceOnUse');
|
|
2841
|
+
var $image = createSVGElement('image', document);
|
|
2842
|
+
$pattern.appendChild($image);
|
|
2843
|
+
$pattern.id = patternId;
|
|
2844
|
+
$def.appendChild($pattern);
|
|
2845
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, "url(#" + patternId + ")");
|
|
2846
|
+
$image.setAttribute('href', src);
|
|
2847
|
+
var img = new window.Image();
|
|
2848
|
+
|
|
2849
|
+
if (!src.match(/^data:/i)) {
|
|
2850
|
+
img.crossOrigin = 'Anonymous';
|
|
2851
|
+
}
|
|
2471
2852
|
|
|
2472
|
-
|
|
2473
|
-
$pattern.setAttribute('patternUnits', 'userSpaceOnUse');
|
|
2474
|
-
var $image = createSVGElement('image', document);
|
|
2475
|
-
$pattern.appendChild($image);
|
|
2476
|
-
$pattern.id = patternId;
|
|
2477
|
-
$def.appendChild($pattern);
|
|
2478
|
-
$image.setAttribute('href', src);
|
|
2479
|
-
var img = new window.Image();
|
|
2853
|
+
img.src = src;
|
|
2480
2854
|
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2855
|
+
var onload = function onload() {
|
|
2856
|
+
$pattern.setAttribute('width', "" + img.width);
|
|
2857
|
+
$pattern.setAttribute('height', "" + img.height);
|
|
2858
|
+
};
|
|
2484
2859
|
|
|
2485
|
-
|
|
2860
|
+
if (img.complete) {
|
|
2861
|
+
onload();
|
|
2862
|
+
} else {
|
|
2863
|
+
img.onload = onload; // Fix onload() bug in IE9
|
|
2486
2864
|
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
$pattern.setAttribute('height', "" + img.height);
|
|
2865
|
+
img.src = img.src;
|
|
2866
|
+
}
|
|
2490
2867
|
}
|
|
2868
|
+
}
|
|
2491
2869
|
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2870
|
+
function createOrUpdateGradient(document, object, $def, $el, name, parsedColor) {
|
|
2871
|
+
var gradientId = generateCacheKey(parsedColor);
|
|
2872
|
+
var $existed = $def.querySelector("#" + gradientId);
|
|
2873
|
+
|
|
2874
|
+
if (!$existed) {
|
|
2875
|
+
// <linearGradient> <radialGradient>
|
|
2876
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/linearGradient
|
|
2877
|
+
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/radialGradient
|
|
2878
|
+
$existed = createSVGElement(parsedColor.type === g.GradientPatternType.LinearGradient ? 'linearGradient' : 'radialGradient', document); // @see https://github.com/antvis/g/issues/1025
|
|
2496
2879
|
|
|
2497
|
-
|
|
2880
|
+
$existed.setAttribute('gradientUnits', 'userSpaceOnUse'); // add stops
|
|
2881
|
+
|
|
2882
|
+
var innerHTML = '';
|
|
2883
|
+
parsedColor.value.steps.forEach(function (_ref) {
|
|
2884
|
+
var offset = _ref[0],
|
|
2885
|
+
color = _ref[1];
|
|
2886
|
+
innerHTML += "<stop offset=\"" + offset + "\" stop-color=\"" + color + "\"></stop>";
|
|
2887
|
+
});
|
|
2888
|
+
$existed.innerHTML = innerHTML;
|
|
2889
|
+
$existed.id = gradientId;
|
|
2890
|
+
$def.appendChild($existed);
|
|
2891
|
+
$el === null || $el === void 0 ? void 0 : $el.setAttribute(name, "url(#" + gradientId + ")");
|
|
2498
2892
|
}
|
|
2499
|
-
}
|
|
2500
2893
|
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
// @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Element/radialGradient
|
|
2505
|
-
var $gradient = createSVGElement(parsedColor.type === g.GradientPatternType.LinearGradient ? 'linearGradient' : 'radialGradient', document);
|
|
2894
|
+
var bounds = object.getGeometryBounds();
|
|
2895
|
+
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
2896
|
+
var height = bounds && bounds.halfExtents[1] * 2 || 0;
|
|
2506
2897
|
|
|
2507
2898
|
if (parsedColor.type === g.GradientPatternType.LinearGradient) {
|
|
2508
2899
|
var _parsedColor$value = parsedColor.value,
|
|
@@ -2510,30 +2901,20 @@
|
|
|
2510
2901
|
y0 = _parsedColor$value.y0,
|
|
2511
2902
|
x1 = _parsedColor$value.x1,
|
|
2512
2903
|
y1 = _parsedColor$value.y1;
|
|
2513
|
-
$
|
|
2514
|
-
$
|
|
2515
|
-
$
|
|
2516
|
-
$
|
|
2904
|
+
$existed.setAttribute('x1', "" + x0 * width);
|
|
2905
|
+
$existed.setAttribute('y1', "" + y0 * height);
|
|
2906
|
+
$existed.setAttribute('x2', "" + x1 * width);
|
|
2907
|
+
$existed.setAttribute('y2', "" + y1 * height);
|
|
2517
2908
|
} else {
|
|
2909
|
+
var r = Math.sqrt(width * width + height * height) / 2;
|
|
2518
2910
|
var _parsedColor$value2 = parsedColor.value,
|
|
2519
2911
|
_x = _parsedColor$value2.x0,
|
|
2520
2912
|
_y = _parsedColor$value2.y0,
|
|
2521
2913
|
r1 = _parsedColor$value2.r1;
|
|
2522
|
-
$
|
|
2523
|
-
$
|
|
2524
|
-
$
|
|
2525
|
-
}
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
var innerHTML = '';
|
|
2529
|
-
parsedColor.value.steps.forEach(function (_ref) {
|
|
2530
|
-
var offset = _ref[0],
|
|
2531
|
-
color = _ref[1];
|
|
2532
|
-
innerHTML += "<stop offset=\"" + offset + "\" stop-color=\"" + color + "\"></stop>";
|
|
2533
|
-
});
|
|
2534
|
-
$gradient.innerHTML = innerHTML;
|
|
2535
|
-
$gradient.id = gradientId;
|
|
2536
|
-
$def.appendChild($gradient);
|
|
2914
|
+
$existed.setAttribute('cx', "" + _x * width);
|
|
2915
|
+
$existed.setAttribute('cy', "" + _y * height);
|
|
2916
|
+
$existed.setAttribute('r', "" + r1 * r);
|
|
2917
|
+
}
|
|
2537
2918
|
}
|
|
2538
2919
|
|
|
2539
2920
|
var FILTER_DROPSHADOW_PREFIX = 'filter-dropshadow-';
|
|
@@ -2556,7 +2937,9 @@
|
|
|
2556
2937
|
_$feDropShadow.setAttribute('dy', '0');
|
|
2557
2938
|
|
|
2558
2939
|
$existedFilter.appendChild(_$feDropShadow);
|
|
2559
|
-
$existedFilter.id = shadowId;
|
|
2940
|
+
$existedFilter.id = shadowId; // @see https://github.com/antvis/g/issues/1025
|
|
2941
|
+
|
|
2942
|
+
$existedFilter.setAttribute('filterUnits', 'userSpaceOnUse');
|
|
2560
2943
|
$def.appendChild($existedFilter);
|
|
2561
2944
|
}
|
|
2562
2945
|
|
|
@@ -2570,17 +2953,17 @@
|
|
|
2570
2953
|
// @see https://drafts.csswg.org/css-backgrounds/#shadow-blur
|
|
2571
2954
|
// @see https://css-tricks.com/breaking-css-box-shadow-vs-drop-shadow/
|
|
2572
2955
|
|
|
2573
|
-
$feDropShadow.setAttribute('stdDeviation', "" + (shadowBlur
|
|
2956
|
+
$feDropShadow.setAttribute('stdDeviation', "" + ((shadowBlur === null || shadowBlur === void 0 ? void 0 : shadowBlur.value) || 0) / 4);
|
|
2574
2957
|
} else if (name === 'shadowOffsetX') {
|
|
2575
2958
|
var shadowOffsetX = object.parsedStyle[name];
|
|
2576
|
-
$feDropShadow.setAttribute('dx', "" + (shadowOffsetX
|
|
2959
|
+
$feDropShadow.setAttribute('dx', "" + ((shadowOffsetX === null || shadowOffsetX === void 0 ? void 0 : shadowOffsetX.value) || 0) / 2);
|
|
2577
2960
|
} else if (name === 'shadowOffsetY') {
|
|
2578
2961
|
var shadowOffsetY = object.parsedStyle[name];
|
|
2579
|
-
$feDropShadow.setAttribute('dy', "" + (shadowOffsetY
|
|
2962
|
+
$feDropShadow.setAttribute('dy', "" + ((shadowOffsetY === null || shadowOffsetY === void 0 ? void 0 : shadowOffsetY.value) || 0) / 2);
|
|
2580
2963
|
} // only apply shadow when blur > 0
|
|
2581
2964
|
|
|
2582
2965
|
|
|
2583
|
-
if (
|
|
2966
|
+
if (!g.isNil(object.parsedStyle.shadowColor)) {
|
|
2584
2967
|
// use filter <feDropShadow>
|
|
2585
2968
|
// @see https://developer.mozilla.org/en-US/docs/Web/SVG/Element/feDropShadow
|
|
2586
2969
|
$el === null || $el === void 0 ? void 0 : $el.setAttribute('filter', "url(#" + shadowId + ")");
|
|
@@ -2681,6 +3064,7 @@
|
|
|
2681
3064
|
this.$def = void 0;
|
|
2682
3065
|
this.$camera = void 0;
|
|
2683
3066
|
this.renderQueue = [];
|
|
3067
|
+
this.pendingReorderQueue = new Set();
|
|
2684
3068
|
}
|
|
2685
3069
|
|
|
2686
3070
|
var _proto = SVGRendererPlugin.prototype;
|
|
@@ -2733,10 +3117,30 @@
|
|
|
2733
3117
|
_this.updateAttribute(object, [attrName]);
|
|
2734
3118
|
};
|
|
2735
3119
|
|
|
2736
|
-
|
|
3120
|
+
var handleGeometryBoundsChanged = function handleGeometryBoundsChanged(e) {
|
|
3121
|
+
var _object$elementSVG;
|
|
3122
|
+
|
|
3123
|
+
var doc = _this.canvasConfig.document;
|
|
3124
|
+
var object = e.target; // @ts-ignore
|
|
3125
|
+
|
|
3126
|
+
var $el = (_object$elementSVG = object.elementSVG) === null || _object$elementSVG === void 0 ? void 0 : _object$elementSVG.$el;
|
|
3127
|
+
var _object$parsedStyle = object.parsedStyle,
|
|
3128
|
+
fill = _object$parsedStyle.fill,
|
|
3129
|
+
stroke = _object$parsedStyle.stroke;
|
|
3130
|
+
|
|
3131
|
+
if (fill && !(fill instanceof g.CSSRGB)) {
|
|
3132
|
+
createOrUpdateGradientAndPattern(doc || document, _this.$def, object, $el, fill, 'fill');
|
|
3133
|
+
}
|
|
3134
|
+
|
|
3135
|
+
if (stroke && !(stroke instanceof g.CSSRGB)) {
|
|
3136
|
+
createOrUpdateGradientAndPattern(doc || document, _this.$def, object, $el, stroke, 'stroke');
|
|
3137
|
+
}
|
|
3138
|
+
};
|
|
3139
|
+
|
|
3140
|
+
renderingService.hooks.init.tapPromise(SVGRendererPlugin_1.tag, /*#__PURE__*/_asyncToGenerator$2( /*#__PURE__*/_regeneratorRuntime$2().mark(function _callee() {
|
|
2737
3141
|
var _this$canvasConfig, background, document, $svg;
|
|
2738
3142
|
|
|
2739
|
-
return _regeneratorRuntime$
|
|
3143
|
+
return _regeneratorRuntime$2().wrap(function _callee$(_context) {
|
|
2740
3144
|
while (1) {
|
|
2741
3145
|
switch (_context.prev = _context.next) {
|
|
2742
3146
|
case 0:
|
|
@@ -2764,7 +3168,9 @@
|
|
|
2764
3168
|
|
|
2765
3169
|
_this.renderingContext.root.addEventListener(g.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
2766
3170
|
|
|
2767
|
-
|
|
3171
|
+
_this.renderingContext.root.addEventListener(g.ElementEvent.GEOMETRY_BOUNDS_CHANGED, handleGeometryBoundsChanged);
|
|
3172
|
+
|
|
3173
|
+
case 14:
|
|
2768
3174
|
case "end":
|
|
2769
3175
|
return _context.stop();
|
|
2770
3176
|
}
|
|
@@ -2777,24 +3183,45 @@
|
|
|
2777
3183
|
_this.renderingContext.root.removeEventListener(g.ElementEvent.UNMOUNTED, handleUnmounted);
|
|
2778
3184
|
|
|
2779
3185
|
_this.renderingContext.root.removeEventListener(g.ElementEvent.ATTR_MODIFIED, handleAttributeChanged);
|
|
3186
|
+
|
|
3187
|
+
_this.renderingContext.root.removeEventListener(g.ElementEvent.GEOMETRY_BOUNDS_CHANGED, handleGeometryBoundsChanged);
|
|
2780
3188
|
});
|
|
2781
3189
|
renderingService.hooks.render.tap(SVGRendererPlugin_1.tag, function (object) {
|
|
2782
3190
|
// if (!object.isCulled()) {
|
|
2783
3191
|
_this.renderQueue.push(object); // }
|
|
2784
3192
|
|
|
2785
3193
|
});
|
|
3194
|
+
renderingService.hooks.beginFrame.tap(SVGRendererPlugin_1.tag, function () {
|
|
3195
|
+
var doc = _this.canvasConfig.document;
|
|
3196
|
+
|
|
3197
|
+
if (_this.pendingReorderQueue.size) {
|
|
3198
|
+
_this.pendingReorderQueue.forEach(function (object) {
|
|
3199
|
+
var _object$elementSVG2;
|
|
3200
|
+
|
|
3201
|
+
var children = ((object === null || object === void 0 ? void 0 : object.children) || []).slice();
|
|
3202
|
+
var $parentGroupEl = // @ts-ignore
|
|
3203
|
+
object === null || object === void 0 ? void 0 : (_object$elementSVG2 = object.elementSVG) === null || _object$elementSVG2 === void 0 ? void 0 : _object$elementSVG2.$groupEl;
|
|
3204
|
+
|
|
3205
|
+
if ($parentGroupEl) {
|
|
3206
|
+
_this.reorderChildren(doc || document, $parentGroupEl, children || []);
|
|
3207
|
+
}
|
|
3208
|
+
});
|
|
3209
|
+
|
|
3210
|
+
_this.pendingReorderQueue.clear();
|
|
3211
|
+
}
|
|
3212
|
+
});
|
|
2786
3213
|
renderingService.hooks.endFrame.tap(SVGRendererPlugin_1.tag, function () {
|
|
2787
3214
|
if (_this.renderingContext.renderReasons.has(g.RenderReason.CAMERA_CHANGED)) {
|
|
2788
3215
|
_this.applyTransform(_this.$camera, _this.camera.getOrthoMatrix());
|
|
2789
3216
|
}
|
|
2790
3217
|
|
|
2791
3218
|
_this.renderQueue.forEach(function (object) {
|
|
2792
|
-
var _object$
|
|
3219
|
+
var _object$elementSVG3, _object$elementSVG4; // @ts-ignore
|
|
2793
3220
|
|
|
2794
3221
|
|
|
2795
|
-
var $el = (_object$
|
|
3222
|
+
var $el = (_object$elementSVG3 = object.elementSVG) === null || _object$elementSVG3 === void 0 ? void 0 : _object$elementSVG3.$el; // @ts-ignore
|
|
2796
3223
|
|
|
2797
|
-
var $groupEl = (_object$
|
|
3224
|
+
var $groupEl = (_object$elementSVG4 = object.elementSVG) === null || _object$elementSVG4 === void 0 ? void 0 : _object$elementSVG4.$groupEl;
|
|
2798
3225
|
|
|
2799
3226
|
if ($el && $groupEl) {
|
|
2800
3227
|
// apply local RTS transformation to <group> wrapper
|
|
@@ -2879,10 +3306,10 @@
|
|
|
2879
3306
|
|
|
2880
3307
|
var document = this.canvasConfig.document; // @ts-ignore
|
|
2881
3308
|
|
|
2882
|
-
var _object$
|
|
2883
|
-
$el = _object$
|
|
2884
|
-
$groupEl = _object$
|
|
2885
|
-
$hitTestingEl = _object$
|
|
3309
|
+
var _object$elementSVG5 = object.elementSVG,
|
|
3310
|
+
$el = _object$elementSVG5.$el,
|
|
3311
|
+
$groupEl = _object$elementSVG5.$groupEl,
|
|
3312
|
+
$hitTestingEl = _object$elementSVG5.$hitTestingEl;
|
|
2886
3313
|
var parsedStyle = object.parsedStyle,
|
|
2887
3314
|
computedStyle = object.computedStyle;
|
|
2888
3315
|
var shouldUpdateElementAttribute = attributes.some(function (name) {
|
|
@@ -2908,20 +3335,26 @@
|
|
|
2908
3335
|
var usedValue = parsedStyle[name]; // <foreignObject>
|
|
2909
3336
|
|
|
2910
3337
|
if (object.nodeName === g.Shape.HTML) {
|
|
2911
|
-
if (name === '
|
|
2912
|
-
$el.style.background = usedValue.toString();
|
|
2913
|
-
} else if (name === 'stroke') {
|
|
2914
|
-
$el.style['border-color'] = usedValue.toString();
|
|
2915
|
-
$el.style['border-style'] = 'solid';
|
|
2916
|
-
} else if (name === 'lineWidth') {
|
|
3338
|
+
if (name === 'lineWidth') {
|
|
2917
3339
|
$el.style['border-width'] = (usedValue.value || 0) + "px";
|
|
2918
3340
|
} else if (name === 'lineDash') {
|
|
2919
3341
|
$el.style['border-style'] = 'dashed';
|
|
2920
3342
|
}
|
|
2921
3343
|
}
|
|
2922
3344
|
|
|
2923
|
-
if (name === 'fill'
|
|
2924
|
-
|
|
3345
|
+
if (name === 'fill') {
|
|
3346
|
+
if (object.nodeName === g.Shape.HTML) {
|
|
3347
|
+
$el.style.background = usedValue.toString();
|
|
3348
|
+
} else {
|
|
3349
|
+
createOrUpdateGradientAndPattern(document, _this2.$def, object, $el, usedValue, usedName);
|
|
3350
|
+
}
|
|
3351
|
+
} else if (name === 'stroke') {
|
|
3352
|
+
if (object.nodeName === g.Shape.HTML) {
|
|
3353
|
+
$el.style['border-color'] = usedValue.toString();
|
|
3354
|
+
$el.style['border-style'] = 'solid';
|
|
3355
|
+
} else {
|
|
3356
|
+
createOrUpdateGradientAndPattern(document, _this2.$def, object, $el, usedValue, usedName);
|
|
3357
|
+
}
|
|
2925
3358
|
} else if (name === 'visibility' && computedValue.value !== 'unset') {
|
|
2926
3359
|
// use computed value
|
|
2927
3360
|
// update `visibility` on <group>
|
|
@@ -3002,20 +3435,18 @@
|
|
|
3002
3435
|
object.parentNode && ((_object$parentNode$el2 = object.parentNode.elementSVG) === null || _object$parentNode$el2 === void 0 ? void 0 : _object$parentNode$el2.$groupEl) || root;
|
|
3003
3436
|
|
|
3004
3437
|
if ($parentGroupEl) {
|
|
3005
|
-
|
|
3438
|
+
$parentGroupEl.appendChild($groupEl); // need reorder children later
|
|
3006
3439
|
|
|
3007
|
-
|
|
3008
|
-
var children = (((_object$parentNode2 = object.parentNode) === null || _object$parentNode2 === void 0 ? void 0 : _object$parentNode2.children) || []).slice();
|
|
3009
|
-
this.reorderChildren(document, $parentGroupEl, children || []);
|
|
3440
|
+
this.pendingReorderQueue.add(object.parentNode);
|
|
3010
3441
|
}
|
|
3011
3442
|
}
|
|
3012
3443
|
};
|
|
3013
3444
|
|
|
3014
3445
|
_proto.removeSVGDom = function removeSVGDom(object) {
|
|
3015
|
-
var _object$
|
|
3446
|
+
var _object$elementSVG6; // @ts-ignore
|
|
3016
3447
|
|
|
3017
3448
|
|
|
3018
|
-
var $groupEl = (_object$
|
|
3449
|
+
var $groupEl = (_object$elementSVG6 = object.elementSVG) === null || _object$elementSVG6 === void 0 ? void 0 : _object$elementSVG6.$groupEl;
|
|
3019
3450
|
|
|
3020
3451
|
if ($groupEl && $groupEl.parentNode) {
|
|
3021
3452
|
$groupEl.parentNode.removeChild($groupEl); // object.entity.removeComponent(ElementSVG, true);
|
|
@@ -3114,7 +3545,7 @@
|
|
|
3114
3545
|
;
|
|
3115
3546
|
|
|
3116
3547
|
_proto.updateAnchorWithTransform = function updateAnchorWithTransform(object) {
|
|
3117
|
-
var _object$
|
|
3548
|
+
var _object$elementSVG7, _object$elementSVG8;
|
|
3118
3549
|
|
|
3119
3550
|
var bounds = object.getGeometryBounds();
|
|
3120
3551
|
var width = bounds && bounds.halfExtents[0] * 2 || 0;
|
|
@@ -3124,7 +3555,7 @@
|
|
|
3124
3555
|
anchor = _ref2.anchor; // @ts-ignore
|
|
3125
3556
|
|
|
3126
3557
|
|
|
3127
|
-
[(_object$
|
|
3558
|
+
[(_object$elementSVG7 = object.elementSVG) === null || _object$elementSVG7 === void 0 ? void 0 : _object$elementSVG7.$el, (_object$elementSVG8 = object.elementSVG) === null || _object$elementSVG8 === void 0 ? void 0 : _object$elementSVG8.$hitTestingEl].forEach(function ($el) {
|
|
3128
3559
|
if ($el) {
|
|
3129
3560
|
// apply anchor to element's `transform` property
|
|
3130
3561
|
$el.setAttribute('transform', // can't use percent unit like translate(-50%, -50%)
|
|
@@ -3142,20 +3573,20 @@
|
|
|
3142
3573
|
return SVGRendererPlugin;
|
|
3143
3574
|
}(), _class$1.tag = 'SVGRenderer', _class$1);
|
|
3144
3575
|
|
|
3145
|
-
__decorate([
|
|
3576
|
+
__decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], SVGRendererPlugin.prototype, "canvasConfig", void 0);
|
|
3146
3577
|
|
|
3147
|
-
__decorate([
|
|
3578
|
+
__decorate([g.inject(g.DefaultCamera), __metadata("design:type", g.Camera)], SVGRendererPlugin.prototype, "camera", void 0);
|
|
3148
3579
|
|
|
3149
|
-
__decorate([
|
|
3580
|
+
__decorate([g.inject(g.ContextService), __metadata("design:type", Object)], SVGRendererPlugin.prototype, "contextService", void 0);
|
|
3150
3581
|
|
|
3151
|
-
__decorate([
|
|
3582
|
+
__decorate([g.inject(g.RenderingContext), __metadata("design:type", Object)], SVGRendererPlugin.prototype, "renderingContext", void 0);
|
|
3152
3583
|
|
|
3153
|
-
__decorate([
|
|
3584
|
+
__decorate([g.inject(CreateElementContribution), __metadata("design:type", Object)], SVGRendererPlugin.prototype, "createElementContribution", void 0);
|
|
3154
3585
|
|
|
3155
|
-
SVGRendererPlugin = SVGRendererPlugin_1 = __decorate([
|
|
3586
|
+
SVGRendererPlugin = SVGRendererPlugin_1 = __decorate([g.singleton({
|
|
3156
3587
|
contrib: g.RenderingPluginContribution
|
|
3157
3588
|
})], SVGRendererPlugin);
|
|
3158
|
-
var containerModule$1 =
|
|
3589
|
+
var containerModule$1 = g.Module(function (register) {
|
|
3159
3590
|
register(DefaultCreateElementContribution);
|
|
3160
3591
|
register(SVGRendererPlugin);
|
|
3161
3592
|
});
|
|
@@ -3200,9 +3631,9 @@
|
|
|
3200
3631
|
updateTextElementAttribute: updateTextElementAttribute
|
|
3201
3632
|
});
|
|
3202
3633
|
|
|
3203
|
-
function _regeneratorRuntime$
|
|
3634
|
+
function _regeneratorRuntime$3() {
|
|
3204
3635
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3205
|
-
_regeneratorRuntime$
|
|
3636
|
+
_regeneratorRuntime$3 = function _regeneratorRuntime() {
|
|
3206
3637
|
return exports;
|
|
3207
3638
|
};
|
|
3208
3639
|
|
|
@@ -3550,7 +3981,7 @@
|
|
|
3550
3981
|
}, exports;
|
|
3551
3982
|
}
|
|
3552
3983
|
|
|
3553
|
-
function asyncGeneratorStep$
|
|
3984
|
+
function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
|
|
3554
3985
|
try {
|
|
3555
3986
|
var info = gen[key](arg);
|
|
3556
3987
|
var value = info.value;
|
|
@@ -3566,7 +3997,7 @@
|
|
|
3566
3997
|
}
|
|
3567
3998
|
}
|
|
3568
3999
|
|
|
3569
|
-
function _asyncToGenerator$
|
|
4000
|
+
function _asyncToGenerator$3(fn) {
|
|
3570
4001
|
return function () {
|
|
3571
4002
|
var self = this,
|
|
3572
4003
|
args = arguments;
|
|
@@ -3574,11 +4005,11 @@
|
|
|
3574
4005
|
var gen = fn.apply(self, args);
|
|
3575
4006
|
|
|
3576
4007
|
function _next(value) {
|
|
3577
|
-
asyncGeneratorStep$
|
|
4008
|
+
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
|
|
3578
4009
|
}
|
|
3579
4010
|
|
|
3580
4011
|
function _throw(err) {
|
|
3581
|
-
asyncGeneratorStep$
|
|
4012
|
+
asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
|
|
3582
4013
|
}
|
|
3583
4014
|
|
|
3584
4015
|
_next(undefined);
|
|
@@ -3649,10 +4080,10 @@
|
|
|
3649
4080
|
|
|
3650
4081
|
var doc = this.canvasConfig.document;
|
|
3651
4082
|
renderingService.hooks.pick.tapPromise(SVGPickerPlugin_1.tag, /*#__PURE__*/function () {
|
|
3652
|
-
var _ref = _asyncToGenerator$
|
|
4083
|
+
var _ref = _asyncToGenerator$3( /*#__PURE__*/_regeneratorRuntime$3().mark(function _callee(result) {
|
|
3653
4084
|
var topmost, _result$position, clientX, clientY, targets, _iterator, _step, element, id, index, target;
|
|
3654
4085
|
|
|
3655
|
-
return _regeneratorRuntime$
|
|
4086
|
+
return _regeneratorRuntime$3().wrap(function _callee$(_context) {
|
|
3656
4087
|
while (1) {
|
|
3657
4088
|
switch (_context.prev = _context.next) {
|
|
3658
4089
|
case 0:
|
|
@@ -3729,14 +4160,14 @@
|
|
|
3729
4160
|
return SVGPickerPlugin;
|
|
3730
4161
|
}(), _class$2.tag = 'SVGPicker', _class$2);
|
|
3731
4162
|
|
|
3732
|
-
__decorate([
|
|
4163
|
+
__decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], SVGPickerPlugin.prototype, "canvasConfig", void 0);
|
|
3733
4164
|
|
|
3734
|
-
__decorate([
|
|
4165
|
+
__decorate([g.inject(g.DisplayObjectPool), __metadata("design:type", g.DisplayObjectPool)], SVGPickerPlugin.prototype, "displayObjectPool", void 0);
|
|
3735
4166
|
|
|
3736
|
-
SVGPickerPlugin = SVGPickerPlugin_1 = __decorate([
|
|
4167
|
+
SVGPickerPlugin = SVGPickerPlugin_1 = __decorate([g.singleton({
|
|
3737
4168
|
contrib: g.RenderingPluginContribution
|
|
3738
4169
|
})], SVGPickerPlugin);
|
|
3739
|
-
var containerModule$2 =
|
|
4170
|
+
var containerModule$2 = g.Module(function (register) {
|
|
3740
4171
|
register(SVGPickerPlugin);
|
|
3741
4172
|
});
|
|
3742
4173
|
|
|
@@ -3773,29 +4204,48 @@
|
|
|
3773
4204
|
|
|
3774
4205
|
var _proto = SVGContextService.prototype;
|
|
3775
4206
|
|
|
3776
|
-
_proto.init = function
|
|
3777
|
-
var
|
|
3778
|
-
|
|
3779
|
-
doc = _this$canvasConfig.document; // create container
|
|
4207
|
+
_proto.init = /*#__PURE__*/function () {
|
|
4208
|
+
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
4209
|
+
var _this$canvasConfig, container, doc, $namespace, dpr;
|
|
3780
4210
|
|
|
3781
|
-
|
|
4211
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4212
|
+
while (1) {
|
|
4213
|
+
switch (_context.prev = _context.next) {
|
|
4214
|
+
case 0:
|
|
4215
|
+
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document; // create container
|
|
3782
4216
|
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
4217
|
+
this.$container = g.isString(container) ? (doc || document).getElementById(container) : container;
|
|
4218
|
+
|
|
4219
|
+
if (this.$container) {
|
|
4220
|
+
if (!this.$container.style.position) {
|
|
4221
|
+
this.$container.style.position = 'relative';
|
|
4222
|
+
}
|
|
4223
|
+
|
|
4224
|
+
$namespace = createSVGElement('svg', doc);
|
|
4225
|
+
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
4226
|
+
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
4227
|
+
this.$container.appendChild($namespace);
|
|
4228
|
+
this.$namespace = $namespace;
|
|
4229
|
+
}
|
|
4230
|
+
|
|
4231
|
+
dpr = window.devicePixelRatio || 1;
|
|
4232
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
4233
|
+
this.dpr = dpr;
|
|
4234
|
+
|
|
4235
|
+
case 6:
|
|
4236
|
+
case "end":
|
|
4237
|
+
return _context.stop();
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
}, _callee, this);
|
|
4241
|
+
}));
|
|
3787
4242
|
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
3791
|
-
this.$container.appendChild($namespace);
|
|
3792
|
-
this.$namespace = $namespace;
|
|
4243
|
+
function init() {
|
|
4244
|
+
return _init.apply(this, arguments);
|
|
3793
4245
|
}
|
|
3794
4246
|
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
this.dpr = dpr;
|
|
3798
|
-
} // @ts-ignore
|
|
4247
|
+
return init;
|
|
4248
|
+
}() // @ts-ignore
|
|
3799
4249
|
;
|
|
3800
4250
|
|
|
3801
4251
|
_proto.getDomElement = function getDomElement() {
|
|
@@ -3839,13 +4289,13 @@
|
|
|
3839
4289
|
return SVGContextService;
|
|
3840
4290
|
}();
|
|
3841
4291
|
|
|
3842
|
-
__decorate([
|
|
4292
|
+
__decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], SVGContextService.prototype, "canvasConfig", void 0);
|
|
3843
4293
|
|
|
3844
|
-
SVGContextService = __decorate([
|
|
4294
|
+
SVGContextService = __decorate([g.singleton({
|
|
3845
4295
|
token: g.ContextService
|
|
3846
4296
|
})], SVGContextService);
|
|
3847
4297
|
|
|
3848
|
-
var containerModule$3 =
|
|
4298
|
+
var containerModule$3 = g.Module(function (register) {
|
|
3849
4299
|
/**
|
|
3850
4300
|
* implements ContextService
|
|
3851
4301
|
*/
|