@antv/g-svg 1.8.23 → 1.8.25
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/index.esm.js +77 -164
- package/dist/index.js +77 -164
- package/dist/index.umd.js +767 -1304
- package/dist/index.umd.min.js +1 -9
- package/package.json +6 -6
package/dist/index.esm.js
CHANGED
|
@@ -11,20 +11,19 @@ export { SVGRenderer };
|
|
|
11
11
|
import { isString } from '@antv/util';
|
|
12
12
|
|
|
13
13
|
function _regeneratorRuntime() {
|
|
14
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
15
|
-
|
|
16
14
|
_regeneratorRuntime = function () {
|
|
17
15
|
return exports;
|
|
18
16
|
};
|
|
19
|
-
|
|
20
17
|
var exports = {},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
Op = Object.prototype,
|
|
19
|
+
hasOwn = Op.hasOwnProperty,
|
|
20
|
+
defineProperty = Object.defineProperty || function (obj, key, desc) {
|
|
21
|
+
obj[key] = desc.value;
|
|
22
|
+
},
|
|
23
|
+
$Symbol = "function" == typeof Symbol ? Symbol : {},
|
|
24
|
+
iteratorSymbol = $Symbol.iterator || "@@iterator",
|
|
25
|
+
asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
|
|
26
|
+
toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
28
27
|
function define(obj, key, value) {
|
|
29
28
|
return Object.defineProperty(obj, key, {
|
|
30
29
|
value: value,
|
|
@@ -33,7 +32,6 @@ function _regeneratorRuntime() {
|
|
|
33
32
|
writable: !0
|
|
34
33
|
}), obj[key];
|
|
35
34
|
}
|
|
36
|
-
|
|
37
35
|
try {
|
|
38
36
|
define({}, "");
|
|
39
37
|
} catch (err) {
|
|
@@ -41,54 +39,14 @@ function _regeneratorRuntime() {
|
|
|
41
39
|
return obj[key] = value;
|
|
42
40
|
};
|
|
43
41
|
}
|
|
44
|
-
|
|
45
42
|
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
46
43
|
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return generator
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
if ("executing" === state) throw new Error("Generator is already running");
|
|
53
|
-
|
|
54
|
-
if ("completed" === state) {
|
|
55
|
-
if ("throw" === method) throw arg;
|
|
56
|
-
return doneResult();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
for (context.method = method, context.arg = arg;;) {
|
|
60
|
-
var delegate = context.delegate;
|
|
61
|
-
|
|
62
|
-
if (delegate) {
|
|
63
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
64
|
-
|
|
65
|
-
if (delegateResult) {
|
|
66
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
67
|
-
return delegateResult;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
72
|
-
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
73
|
-
context.dispatchException(context.arg);
|
|
74
|
-
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
75
|
-
state = "executing";
|
|
76
|
-
var record = tryCatch(innerFn, self, context);
|
|
77
|
-
|
|
78
|
-
if ("normal" === record.type) {
|
|
79
|
-
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
80
|
-
return {
|
|
81
|
-
value: record.arg,
|
|
82
|
-
done: context.done
|
|
83
|
-
};
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}(innerFn, self, context), generator;
|
|
44
|
+
generator = Object.create(protoGenerator.prototype),
|
|
45
|
+
context = new Context(tryLocsList || []);
|
|
46
|
+
return defineProperty(generator, "_invoke", {
|
|
47
|
+
value: makeInvokeMethod(innerFn, self, context)
|
|
48
|
+
}), generator;
|
|
90
49
|
}
|
|
91
|
-
|
|
92
50
|
function tryCatch(fn, obj, arg) {
|
|
93
51
|
try {
|
|
94
52
|
return {
|
|
@@ -102,25 +60,19 @@ function _regeneratorRuntime() {
|
|
|
102
60
|
};
|
|
103
61
|
}
|
|
104
62
|
}
|
|
105
|
-
|
|
106
63
|
exports.wrap = wrap;
|
|
107
64
|
var ContinueSentinel = {};
|
|
108
|
-
|
|
109
65
|
function Generator() {}
|
|
110
|
-
|
|
111
66
|
function GeneratorFunction() {}
|
|
112
|
-
|
|
113
67
|
function GeneratorFunctionPrototype() {}
|
|
114
|
-
|
|
115
68
|
var IteratorPrototype = {};
|
|
116
69
|
define(IteratorPrototype, iteratorSymbol, function () {
|
|
117
70
|
return this;
|
|
118
71
|
});
|
|
119
72
|
var getProto = Object.getPrototypeOf,
|
|
120
|
-
|
|
73
|
+
NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
121
74
|
NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
|
|
122
75
|
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
123
|
-
|
|
124
76
|
function defineIteratorMethods(prototype) {
|
|
125
77
|
["next", "throw", "return"].forEach(function (method) {
|
|
126
78
|
define(prototype, method, function (arg) {
|
|
@@ -128,14 +80,12 @@ function _regeneratorRuntime() {
|
|
|
128
80
|
});
|
|
129
81
|
});
|
|
130
82
|
}
|
|
131
|
-
|
|
132
83
|
function AsyncIterator(generator, PromiseImpl) {
|
|
133
84
|
function invoke(method, arg, resolve, reject) {
|
|
134
85
|
var record = tryCatch(generator[method], generator, arg);
|
|
135
|
-
|
|
136
86
|
if ("throw" !== record.type) {
|
|
137
87
|
var result = record.arg,
|
|
138
|
-
|
|
88
|
+
value = result.value;
|
|
139
89
|
return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
|
|
140
90
|
invoke("next", value, resolve, reject);
|
|
141
91
|
}, function (err) {
|
|
@@ -146,90 +96,114 @@ function _regeneratorRuntime() {
|
|
|
146
96
|
return invoke("throw", error, resolve, reject);
|
|
147
97
|
});
|
|
148
98
|
}
|
|
149
|
-
|
|
150
99
|
reject(record.arg);
|
|
151
100
|
}
|
|
152
|
-
|
|
153
101
|
var previousPromise;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
102
|
+
defineProperty(this, "_invoke", {
|
|
103
|
+
value: function (method, arg) {
|
|
104
|
+
function callInvokeWithMethodAndArg() {
|
|
105
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
106
|
+
invoke(method, arg, resolve, reject);
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
114
|
+
var state = "suspendedStart";
|
|
115
|
+
return function (method, arg) {
|
|
116
|
+
if ("executing" === state) throw new Error("Generator is already running");
|
|
117
|
+
if ("completed" === state) {
|
|
118
|
+
if ("throw" === method) throw arg;
|
|
119
|
+
return doneResult();
|
|
120
|
+
}
|
|
121
|
+
for (context.method = method, context.arg = arg;;) {
|
|
122
|
+
var delegate = context.delegate;
|
|
123
|
+
if (delegate) {
|
|
124
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
125
|
+
if (delegateResult) {
|
|
126
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
127
|
+
return delegateResult;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
|
|
131
|
+
if ("suspendedStart" === state) throw state = "completed", context.arg;
|
|
132
|
+
context.dispatchException(context.arg);
|
|
133
|
+
} else "return" === context.method && context.abrupt("return", context.arg);
|
|
134
|
+
state = "executing";
|
|
135
|
+
var record = tryCatch(innerFn, self, context);
|
|
136
|
+
if ("normal" === record.type) {
|
|
137
|
+
if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
|
|
138
|
+
return {
|
|
139
|
+
value: record.arg,
|
|
140
|
+
done: context.done
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
"throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
|
|
160
144
|
}
|
|
161
|
-
|
|
162
|
-
return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
163
145
|
};
|
|
164
146
|
}
|
|
165
|
-
|
|
166
147
|
function maybeInvokeDelegate(delegate, context) {
|
|
167
148
|
var method = delegate.iterator[context.method];
|
|
168
|
-
|
|
169
149
|
if (undefined === method) {
|
|
170
150
|
if (context.delegate = null, "throw" === context.method) {
|
|
171
151
|
if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
|
|
172
152
|
context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
173
153
|
}
|
|
174
|
-
|
|
175
154
|
return ContinueSentinel;
|
|
176
155
|
}
|
|
177
|
-
|
|
178
156
|
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
179
157
|
if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
|
|
180
158
|
var info = record.arg;
|
|
181
159
|
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);
|
|
182
160
|
}
|
|
183
|
-
|
|
184
161
|
function pushTryEntry(locs) {
|
|
185
162
|
var entry = {
|
|
186
163
|
tryLoc: locs[0]
|
|
187
164
|
};
|
|
188
165
|
1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
|
|
189
166
|
}
|
|
190
|
-
|
|
191
167
|
function resetTryEntry(entry) {
|
|
192
168
|
var record = entry.completion || {};
|
|
193
169
|
record.type = "normal", delete record.arg, entry.completion = record;
|
|
194
170
|
}
|
|
195
|
-
|
|
196
171
|
function Context(tryLocsList) {
|
|
197
172
|
this.tryEntries = [{
|
|
198
173
|
tryLoc: "root"
|
|
199
174
|
}], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
|
|
200
175
|
}
|
|
201
|
-
|
|
202
176
|
function values(iterable) {
|
|
203
177
|
if (iterable) {
|
|
204
178
|
var iteratorMethod = iterable[iteratorSymbol];
|
|
205
179
|
if (iteratorMethod) return iteratorMethod.call(iterable);
|
|
206
180
|
if ("function" == typeof iterable.next) return iterable;
|
|
207
|
-
|
|
208
181
|
if (!isNaN(iterable.length)) {
|
|
209
182
|
var i = -1,
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
};
|
|
215
|
-
|
|
183
|
+
next = function next() {
|
|
184
|
+
for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
|
|
185
|
+
return next.value = undefined, next.done = !0, next;
|
|
186
|
+
};
|
|
216
187
|
return next.next = next;
|
|
217
188
|
}
|
|
218
189
|
}
|
|
219
|
-
|
|
220
190
|
return {
|
|
221
191
|
next: doneResult
|
|
222
192
|
};
|
|
223
193
|
}
|
|
224
|
-
|
|
225
194
|
function doneResult() {
|
|
226
195
|
return {
|
|
227
196
|
value: undefined,
|
|
228
197
|
done: !0
|
|
229
198
|
};
|
|
230
199
|
}
|
|
231
|
-
|
|
232
|
-
|
|
200
|
+
return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
|
|
201
|
+
value: GeneratorFunctionPrototype,
|
|
202
|
+
configurable: !0
|
|
203
|
+
}), defineProperty(GeneratorFunctionPrototype, "constructor", {
|
|
204
|
+
value: GeneratorFunction,
|
|
205
|
+
configurable: !0
|
|
206
|
+
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
|
|
233
207
|
var ctor = "function" == typeof genFun && genFun.constructor;
|
|
234
208
|
return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
|
|
235
209
|
}, exports.mark = function (genFun) {
|
|
@@ -250,17 +224,15 @@ function _regeneratorRuntime() {
|
|
|
250
224
|
return this;
|
|
251
225
|
}), define(Gp, "toString", function () {
|
|
252
226
|
return "[object Generator]";
|
|
253
|
-
}), exports.keys = function (
|
|
254
|
-
var
|
|
255
|
-
|
|
227
|
+
}), exports.keys = function (val) {
|
|
228
|
+
var object = Object(val),
|
|
229
|
+
keys = [];
|
|
256
230
|
for (var key in object) keys.push(key);
|
|
257
|
-
|
|
258
231
|
return keys.reverse(), function next() {
|
|
259
232
|
for (; keys.length;) {
|
|
260
233
|
var key = keys.pop();
|
|
261
234
|
if (key in object) return next.value = key, next.done = !1, next;
|
|
262
235
|
}
|
|
263
|
-
|
|
264
236
|
return next.done = !0, next;
|
|
265
237
|
};
|
|
266
238
|
}, exports.values = values, Context.prototype = {
|
|
@@ -277,20 +249,16 @@ function _regeneratorRuntime() {
|
|
|
277
249
|
dispatchException: function (exception) {
|
|
278
250
|
if (this.done) throw exception;
|
|
279
251
|
var context = this;
|
|
280
|
-
|
|
281
252
|
function handle(loc, caught) {
|
|
282
253
|
return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
|
|
283
254
|
}
|
|
284
|
-
|
|
285
255
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
286
256
|
var entry = this.tryEntries[i],
|
|
287
|
-
|
|
257
|
+
record = entry.completion;
|
|
288
258
|
if ("root" === entry.tryLoc) return handle("end");
|
|
289
|
-
|
|
290
259
|
if (entry.tryLoc <= this.prev) {
|
|
291
260
|
var hasCatch = hasOwn.call(entry, "catchLoc"),
|
|
292
|
-
|
|
293
|
-
|
|
261
|
+
hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
294
262
|
if (hasCatch && hasFinally) {
|
|
295
263
|
if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
|
|
296
264
|
if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
|
|
@@ -306,13 +274,11 @@ function _regeneratorRuntime() {
|
|
|
306
274
|
abrupt: function (type, arg) {
|
|
307
275
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
308
276
|
var entry = this.tryEntries[i];
|
|
309
|
-
|
|
310
277
|
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
311
278
|
var finallyEntry = entry;
|
|
312
279
|
break;
|
|
313
280
|
}
|
|
314
281
|
}
|
|
315
|
-
|
|
316
282
|
finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
|
|
317
283
|
var record = finallyEntry ? finallyEntry.completion : {};
|
|
318
284
|
return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
|
|
@@ -330,19 +296,15 @@ function _regeneratorRuntime() {
|
|
|
330
296
|
catch: function (tryLoc) {
|
|
331
297
|
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
332
298
|
var entry = this.tryEntries[i];
|
|
333
|
-
|
|
334
299
|
if (entry.tryLoc === tryLoc) {
|
|
335
300
|
var record = entry.completion;
|
|
336
|
-
|
|
337
301
|
if ("throw" === record.type) {
|
|
338
302
|
var thrown = record.arg;
|
|
339
303
|
resetTryEntry(entry);
|
|
340
304
|
}
|
|
341
|
-
|
|
342
305
|
return thrown;
|
|
343
306
|
}
|
|
344
307
|
}
|
|
345
|
-
|
|
346
308
|
throw new Error("illegal catch attempt");
|
|
347
309
|
},
|
|
348
310
|
delegateYield: function (iterable, resultName, nextLoc) {
|
|
@@ -354,7 +316,6 @@ function _regeneratorRuntime() {
|
|
|
354
316
|
}
|
|
355
317
|
}, exports;
|
|
356
318
|
}
|
|
357
|
-
|
|
358
319
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
359
320
|
try {
|
|
360
321
|
var info = gen[key](arg);
|
|
@@ -363,41 +324,33 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
363
324
|
reject(error);
|
|
364
325
|
return;
|
|
365
326
|
}
|
|
366
|
-
|
|
367
327
|
if (info.done) {
|
|
368
328
|
resolve(value);
|
|
369
329
|
} else {
|
|
370
330
|
Promise.resolve(value).then(_next, _throw);
|
|
371
331
|
}
|
|
372
332
|
}
|
|
373
|
-
|
|
374
333
|
function _asyncToGenerator(fn) {
|
|
375
334
|
return function () {
|
|
376
335
|
var self = this,
|
|
377
|
-
|
|
336
|
+
args = arguments;
|
|
378
337
|
return new Promise(function (resolve, reject) {
|
|
379
338
|
var gen = fn.apply(self, args);
|
|
380
|
-
|
|
381
339
|
function _next(value) {
|
|
382
340
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
383
341
|
}
|
|
384
|
-
|
|
385
342
|
function _throw(err) {
|
|
386
343
|
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
387
344
|
}
|
|
388
|
-
|
|
389
345
|
_next(undefined);
|
|
390
346
|
});
|
|
391
347
|
};
|
|
392
348
|
}
|
|
393
|
-
|
|
394
349
|
function _inheritsLoose(subClass, superClass) {
|
|
395
350
|
subClass.prototype = Object.create(superClass.prototype);
|
|
396
351
|
subClass.prototype.constructor = subClass;
|
|
397
|
-
|
|
398
352
|
_setPrototypeOf(subClass, superClass);
|
|
399
353
|
}
|
|
400
|
-
|
|
401
354
|
function _setPrototypeOf(o, p) {
|
|
402
355
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
403
356
|
o.__proto__ = p;
|
|
@@ -414,38 +367,30 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
414
367
|
this.canvasConfig = void 0;
|
|
415
368
|
this.canvasConfig = context.config;
|
|
416
369
|
}
|
|
417
|
-
|
|
418
370
|
var _proto = SVGContextService.prototype;
|
|
419
|
-
|
|
420
371
|
_proto.init = /*#__PURE__*/function () {
|
|
421
372
|
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
422
373
|
var _this$canvasConfig, container, doc, devicePixelRatio, $namespace, dpr;
|
|
423
|
-
|
|
424
374
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
425
375
|
while (1) {
|
|
426
376
|
switch (_context.prev = _context.next) {
|
|
427
377
|
case 0:
|
|
428
378
|
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document, devicePixelRatio = _this$canvasConfig.devicePixelRatio; // create container
|
|
429
|
-
|
|
430
379
|
this.$container = isString(container) ? (doc || document).getElementById(container) : container;
|
|
431
|
-
|
|
432
380
|
if (this.$container) {
|
|
433
381
|
if (!this.$container.style.position) {
|
|
434
382
|
this.$container.style.position = 'relative';
|
|
435
383
|
}
|
|
436
|
-
|
|
437
384
|
$namespace = createSVGElement('svg', doc);
|
|
438
385
|
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
439
386
|
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
440
387
|
this.$container.appendChild($namespace);
|
|
441
388
|
this.$namespace = $namespace;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
389
|
+
}
|
|
390
|
+
// use user-defined dpr first
|
|
445
391
|
dpr = devicePixelRatio || isBrowser && window.devicePixelRatio || 1;
|
|
446
392
|
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
447
393
|
this.dpr = dpr;
|
|
448
|
-
|
|
449
394
|
case 6:
|
|
450
395
|
case "end":
|
|
451
396
|
return _context.stop();
|
|
@@ -453,40 +398,31 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
453
398
|
}
|
|
454
399
|
}, _callee, this);
|
|
455
400
|
}));
|
|
456
|
-
|
|
457
401
|
function init() {
|
|
458
402
|
return _init.apply(this, arguments);
|
|
459
403
|
}
|
|
460
|
-
|
|
461
404
|
return init;
|
|
462
405
|
}() // @ts-ignore
|
|
463
406
|
;
|
|
464
|
-
|
|
465
407
|
_proto.getDomElement = function getDomElement() {
|
|
466
408
|
return this.$namespace;
|
|
467
409
|
};
|
|
468
|
-
|
|
469
410
|
_proto.getContext = function getContext() {
|
|
470
411
|
return this.$namespace;
|
|
471
412
|
};
|
|
472
|
-
|
|
473
413
|
_proto.getDPR = function getDPR() {
|
|
474
414
|
return this.dpr;
|
|
475
415
|
};
|
|
476
|
-
|
|
477
416
|
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
478
417
|
var _this$$namespace;
|
|
479
|
-
|
|
480
418
|
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
481
419
|
};
|
|
482
|
-
|
|
483
420
|
_proto.destroy = function destroy() {
|
|
484
421
|
// destroy context
|
|
485
422
|
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
486
423
|
this.$container.removeChild(this.$namespace);
|
|
487
424
|
}
|
|
488
425
|
};
|
|
489
|
-
|
|
490
426
|
_proto.resize = function resize(width, height) {
|
|
491
427
|
// SVG should ignore DPR
|
|
492
428
|
if (this.$namespace) {
|
|
@@ -494,13 +430,11 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
494
430
|
this.$namespace.setAttribute('height', "" + height);
|
|
495
431
|
}
|
|
496
432
|
};
|
|
497
|
-
|
|
498
433
|
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
|
|
499
434
|
if (this.$container) {
|
|
500
435
|
this.$container.style.cursor = cursor;
|
|
501
436
|
}
|
|
502
437
|
};
|
|
503
|
-
|
|
504
438
|
_proto.toDataURL = /*#__PURE__*/function () {
|
|
505
439
|
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
506
440
|
var cloneNode, svgDocType, svgDoc;
|
|
@@ -508,13 +442,11 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
508
442
|
while (1) {
|
|
509
443
|
switch (_context2.prev = _context2.next) {
|
|
510
444
|
case 0:
|
|
511
|
-
|
|
512
445
|
cloneNode = this.$namespace.cloneNode(true);
|
|
513
446
|
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
514
447
|
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
515
448
|
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
516
449
|
return _context2.abrupt("return", "data:image/svg+xml;charset=utf8," + encodeURIComponent(new XMLSerializer().serializeToString(svgDoc)));
|
|
517
|
-
|
|
518
450
|
case 6:
|
|
519
451
|
case "end":
|
|
520
452
|
return _context2.stop();
|
|
@@ -522,71 +454,52 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
522
454
|
}
|
|
523
455
|
}, _callee2, this);
|
|
524
456
|
}));
|
|
525
|
-
|
|
526
457
|
function toDataURL(_x) {
|
|
527
458
|
return _toDataURL.apply(this, arguments);
|
|
528
459
|
}
|
|
529
|
-
|
|
530
460
|
return toDataURL;
|
|
531
461
|
}();
|
|
532
|
-
|
|
533
462
|
return SVGContextService;
|
|
534
463
|
}();
|
|
535
464
|
|
|
536
465
|
var ContextRegisterPlugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
537
466
|
_inheritsLoose(ContextRegisterPlugin, _AbstractRendererPlug);
|
|
538
|
-
|
|
539
467
|
function ContextRegisterPlugin() {
|
|
540
468
|
var _this;
|
|
541
|
-
|
|
542
469
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
543
470
|
args[_key] = arguments[_key];
|
|
544
471
|
}
|
|
545
|
-
|
|
546
472
|
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
547
473
|
_this.name = 'svg-context-register';
|
|
548
474
|
return _this;
|
|
549
475
|
}
|
|
550
|
-
|
|
551
476
|
var _proto = ContextRegisterPlugin.prototype;
|
|
552
|
-
|
|
553
477
|
_proto.init = function init() {
|
|
554
478
|
// @ts-ignore
|
|
555
479
|
this.context.ContextService = SVGContextService;
|
|
556
480
|
};
|
|
557
|
-
|
|
558
481
|
_proto.destroy = function destroy() {
|
|
559
482
|
delete this.context.ContextService;
|
|
560
483
|
};
|
|
561
|
-
|
|
562
484
|
return ContextRegisterPlugin;
|
|
563
485
|
}(AbstractRendererPlugin);
|
|
564
486
|
|
|
565
487
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
566
488
|
_inheritsLoose(Renderer, _AbstractRenderer);
|
|
567
|
-
|
|
568
489
|
function Renderer(config) {
|
|
569
490
|
var _this;
|
|
570
|
-
|
|
571
491
|
if (config === void 0) {
|
|
572
492
|
config = {};
|
|
573
493
|
}
|
|
574
|
-
|
|
575
494
|
_this = _AbstractRenderer.call(this, config) || this;
|
|
576
|
-
|
|
577
495
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
578
|
-
|
|
579
496
|
_this.registerPlugin(new Plugin({
|
|
580
497
|
outputSVGElementId: config.outputSVGElementId
|
|
581
498
|
}));
|
|
582
|
-
|
|
583
499
|
_this.registerPlugin(new Plugin$1());
|
|
584
|
-
|
|
585
500
|
_this.registerPlugin(new Plugin$2());
|
|
586
|
-
|
|
587
501
|
return _this;
|
|
588
502
|
}
|
|
589
|
-
|
|
590
503
|
return Renderer;
|
|
591
504
|
}(AbstractRenderer);
|
|
592
505
|
|