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