@antv/g-svg 1.8.54 → 1.8.56
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 +354 -218
- package/dist/index.js +354 -218
- package/dist/index.umd.js +1799 -1194
- package/dist/index.umd.min.js +1 -1
- package/package.json +5 -5
package/dist/index.esm.js
CHANGED
|
@@ -341,10 +341,49 @@ function _asyncToGenerator(fn) {
|
|
|
341
341
|
});
|
|
342
342
|
};
|
|
343
343
|
}
|
|
344
|
-
function
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
344
|
+
function _classCallCheck(instance, Constructor) {
|
|
345
|
+
if (!(instance instanceof Constructor)) {
|
|
346
|
+
throw new TypeError("Cannot call a class as a function");
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
function _defineProperties(target, props) {
|
|
350
|
+
for (var i = 0; i < props.length; i++) {
|
|
351
|
+
var descriptor = props[i];
|
|
352
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
353
|
+
descriptor.configurable = true;
|
|
354
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
355
|
+
Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
359
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
360
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
361
|
+
Object.defineProperty(Constructor, "prototype", {
|
|
362
|
+
writable: false
|
|
363
|
+
});
|
|
364
|
+
return Constructor;
|
|
365
|
+
}
|
|
366
|
+
function _inherits(subClass, superClass) {
|
|
367
|
+
if (typeof superClass !== "function" && superClass !== null) {
|
|
368
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
369
|
+
}
|
|
370
|
+
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
371
|
+
constructor: {
|
|
372
|
+
value: subClass,
|
|
373
|
+
writable: true,
|
|
374
|
+
configurable: true
|
|
375
|
+
}
|
|
376
|
+
});
|
|
377
|
+
Object.defineProperty(subClass, "prototype", {
|
|
378
|
+
writable: false
|
|
379
|
+
});
|
|
380
|
+
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
381
|
+
}
|
|
382
|
+
function _getPrototypeOf(o) {
|
|
383
|
+
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
384
|
+
return o.__proto__ || Object.getPrototypeOf(o);
|
|
385
|
+
};
|
|
386
|
+
return _getPrototypeOf(o);
|
|
348
387
|
}
|
|
349
388
|
function _setPrototypeOf(o, p) {
|
|
350
389
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
@@ -353,6 +392,17 @@ function _setPrototypeOf(o, p) {
|
|
|
353
392
|
};
|
|
354
393
|
return _setPrototypeOf(o, p);
|
|
355
394
|
}
|
|
395
|
+
function _isNativeReflectConstruct() {
|
|
396
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
397
|
+
if (Reflect.construct.sham) return false;
|
|
398
|
+
if (typeof Proxy === "function") return true;
|
|
399
|
+
try {
|
|
400
|
+
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
401
|
+
return true;
|
|
402
|
+
} catch (e) {
|
|
403
|
+
return false;
|
|
404
|
+
}
|
|
405
|
+
}
|
|
356
406
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
357
407
|
if (source == null) return {};
|
|
358
408
|
var target = {};
|
|
@@ -365,6 +415,63 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
365
415
|
}
|
|
366
416
|
return target;
|
|
367
417
|
}
|
|
418
|
+
function _objectWithoutProperties(source, excluded) {
|
|
419
|
+
if (source == null) return {};
|
|
420
|
+
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
421
|
+
var key, i;
|
|
422
|
+
if (Object.getOwnPropertySymbols) {
|
|
423
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
424
|
+
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
425
|
+
key = sourceSymbolKeys[i];
|
|
426
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
427
|
+
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
428
|
+
target[key] = source[key];
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
return target;
|
|
432
|
+
}
|
|
433
|
+
function _assertThisInitialized(self) {
|
|
434
|
+
if (self === void 0) {
|
|
435
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
436
|
+
}
|
|
437
|
+
return self;
|
|
438
|
+
}
|
|
439
|
+
function _possibleConstructorReturn(self, call) {
|
|
440
|
+
if (call && (typeof call === "object" || typeof call === "function")) {
|
|
441
|
+
return call;
|
|
442
|
+
} else if (call !== void 0) {
|
|
443
|
+
throw new TypeError("Derived constructors may only return object or undefined");
|
|
444
|
+
}
|
|
445
|
+
return _assertThisInitialized(self);
|
|
446
|
+
}
|
|
447
|
+
function _createSuper(Derived) {
|
|
448
|
+
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
449
|
+
return function _createSuperInternal() {
|
|
450
|
+
var Super = _getPrototypeOf(Derived),
|
|
451
|
+
result;
|
|
452
|
+
if (hasNativeReflectConstruct) {
|
|
453
|
+
var NewTarget = _getPrototypeOf(this).constructor;
|
|
454
|
+
result = Reflect.construct(Super, arguments, NewTarget);
|
|
455
|
+
} else {
|
|
456
|
+
result = Super.apply(this, arguments);
|
|
457
|
+
}
|
|
458
|
+
return _possibleConstructorReturn(this, result);
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
function _toPrimitive(input, hint) {
|
|
462
|
+
if (typeof input !== "object" || input === null) return input;
|
|
463
|
+
var prim = input[Symbol.toPrimitive];
|
|
464
|
+
if (prim !== undefined) {
|
|
465
|
+
var res = prim.call(input, hint || "default");
|
|
466
|
+
if (typeof res !== "object") return res;
|
|
467
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
468
|
+
}
|
|
469
|
+
return (hint === "string" ? String : Number)(input);
|
|
470
|
+
}
|
|
471
|
+
function _toPropertyKey(arg) {
|
|
472
|
+
var key = _toPrimitive(arg, "string");
|
|
473
|
+
return typeof key === "symbol" ? key : String(key);
|
|
474
|
+
}
|
|
368
475
|
|
|
369
476
|
var _excluded = ["offset", "composite", "computedOffset", "easing"],
|
|
370
477
|
_excluded2 = ["offset", "composite", "computedOffset", "easing", "transformOrigin"],
|
|
@@ -372,6 +479,7 @@ var _excluded = ["offset", "composite", "computedOffset", "easing"],
|
|
|
372
479
|
_excluded4 = ["offset", "composite", "computedOffset", "easing", "transformOrigin"];
|
|
373
480
|
var SVGContextService = /*#__PURE__*/function () {
|
|
374
481
|
function SVGContextService(context) {
|
|
482
|
+
_classCallCheck(this, SVGContextService);
|
|
375
483
|
this.context = void 0;
|
|
376
484
|
this.$container = void 0;
|
|
377
485
|
this.$namespace = void 0;
|
|
@@ -380,245 +488,273 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
380
488
|
this.context = context;
|
|
381
489
|
this.canvasConfig = context.config;
|
|
382
490
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
var
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if (
|
|
394
|
-
this.$container.style.position
|
|
491
|
+
_createClass(SVGContextService, [{
|
|
492
|
+
key: "init",
|
|
493
|
+
value: function () {
|
|
494
|
+
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
495
|
+
var _this$canvasConfig, container, doc, devicePixelRatio, $namespace, dpr;
|
|
496
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
497
|
+
while (1) switch (_context.prev = _context.next) {
|
|
498
|
+
case 0:
|
|
499
|
+
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document, devicePixelRatio = _this$canvasConfig.devicePixelRatio; // create container
|
|
500
|
+
this.$container = isString(container) ? (doc || document).getElementById(container) : container;
|
|
501
|
+
if (this.$container) {
|
|
502
|
+
if (!this.$container.style.position) {
|
|
503
|
+
this.$container.style.position = 'relative';
|
|
504
|
+
}
|
|
505
|
+
$namespace = createSVGElement('svg', doc);
|
|
506
|
+
$namespace.setAttribute('width', "".concat(this.canvasConfig.width));
|
|
507
|
+
$namespace.setAttribute('height', "".concat(this.canvasConfig.height));
|
|
508
|
+
this.$container.appendChild($namespace);
|
|
509
|
+
this.$namespace = $namespace;
|
|
395
510
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
this
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
511
|
+
// use user-defined dpr first
|
|
512
|
+
dpr = devicePixelRatio || isBrowser && window.devicePixelRatio || 1;
|
|
513
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
514
|
+
this.dpr = dpr;
|
|
515
|
+
case 6:
|
|
516
|
+
case "end":
|
|
517
|
+
return _context.stop();
|
|
518
|
+
}
|
|
519
|
+
}, _callee, this);
|
|
520
|
+
}));
|
|
521
|
+
function init() {
|
|
522
|
+
return _init.apply(this, arguments);
|
|
523
|
+
}
|
|
524
|
+
return init;
|
|
525
|
+
}() // @ts-ignore
|
|
526
|
+
}, {
|
|
527
|
+
key: "getDomElement",
|
|
528
|
+
value: function getDomElement() {
|
|
529
|
+
return this.$namespace;
|
|
414
530
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
return this.$namespace;
|
|
420
|
-
};
|
|
421
|
-
_proto.getContext = function getContext() {
|
|
422
|
-
return this.$namespace;
|
|
423
|
-
};
|
|
424
|
-
_proto.getDPR = function getDPR() {
|
|
425
|
-
return this.dpr;
|
|
426
|
-
};
|
|
427
|
-
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
428
|
-
var _this$$namespace;
|
|
429
|
-
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
430
|
-
};
|
|
431
|
-
_proto.destroy = function destroy() {
|
|
432
|
-
// destroy context
|
|
433
|
-
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
434
|
-
this.$container.removeChild(this.$namespace);
|
|
531
|
+
}, {
|
|
532
|
+
key: "getContext",
|
|
533
|
+
value: function getContext() {
|
|
534
|
+
return this.$namespace;
|
|
435
535
|
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
this.$namespace.setAttribute('width', "" + width);
|
|
441
|
-
this.$namespace.setAttribute('height', "" + height);
|
|
536
|
+
}, {
|
|
537
|
+
key: "getDPR",
|
|
538
|
+
value: function getDPR() {
|
|
539
|
+
return this.dpr;
|
|
442
540
|
}
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
541
|
+
}, {
|
|
542
|
+
key: "getBoundingClientRect",
|
|
543
|
+
value: function getBoundingClientRect() {
|
|
544
|
+
var _this$$namespace;
|
|
545
|
+
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
447
546
|
}
|
|
448
|
-
}
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
547
|
+
}, {
|
|
548
|
+
key: "destroy",
|
|
549
|
+
value: function destroy() {
|
|
550
|
+
// destroy context
|
|
551
|
+
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
552
|
+
this.$container.removeChild(this.$namespace);
|
|
553
|
+
}
|
|
452
554
|
}
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
var
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
555
|
+
}, {
|
|
556
|
+
key: "resize",
|
|
557
|
+
value: function resize(width, height) {
|
|
558
|
+
// SVG should ignore DPR
|
|
559
|
+
if (this.$namespace) {
|
|
560
|
+
this.$namespace.setAttribute('width', "".concat(width));
|
|
561
|
+
this.$namespace.setAttribute('height', "".concat(height));
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
}, {
|
|
565
|
+
key: "applyCursorStyle",
|
|
566
|
+
value: function applyCursorStyle(cursor) {
|
|
567
|
+
if (this.$container) {
|
|
568
|
+
this.$container.style.cursor = cursor;
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}, {
|
|
572
|
+
key: "generateCSSText",
|
|
573
|
+
value: function generateCSSText(animationName, selector, keyframes, timing) {
|
|
574
|
+
var prefixes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
575
|
+
var duration = timing.duration,
|
|
576
|
+
easing = timing.easing,
|
|
577
|
+
delay = timing.delay,
|
|
578
|
+
direction = timing.direction,
|
|
579
|
+
iterations = timing.iterations,
|
|
580
|
+
fill = timing.fill;
|
|
581
|
+
return "@keyframes ".concat(animationName, "{").concat(keyframes.map(function (keyframe) {
|
|
582
|
+
var offset = keyframe.offset,
|
|
583
|
+
composite = keyframe.composite,
|
|
584
|
+
computedOffset = keyframe.computedOffset,
|
|
585
|
+
easing = keyframe.easing,
|
|
586
|
+
rest = _objectWithoutProperties(keyframe, _excluded);
|
|
587
|
+
var rules = Object.keys(rest).map(function (attributeName) {
|
|
588
|
+
return "".concat(attributeName, ":").concat(prefixes[attributeName] || '').concat(rest[attributeName], ";");
|
|
589
|
+
}).join('');
|
|
590
|
+
return "".concat(computedOffset * 100, "%{").concat(rules, "}");
|
|
591
|
+
}).join(''), "}") + "".concat(selector, " {animation: ").concat(animationName, " ").concat(duration, "ms ").concat(easing, " ").concat(delay, "ms ").concat(iterations === Infinity ? 'infinite' : iterations, " ").concat(direction, " ").concat(fill, ";}");
|
|
592
|
+
}
|
|
593
|
+
}, {
|
|
594
|
+
key: "toDataURL",
|
|
595
|
+
value: function () {
|
|
596
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
597
|
+
var _this = this;
|
|
598
|
+
var cloneNode,
|
|
599
|
+
doc,
|
|
600
|
+
animationCounter,
|
|
601
|
+
$style,
|
|
602
|
+
svgDocType,
|
|
603
|
+
svgDoc;
|
|
604
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
605
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
606
|
+
case 0:
|
|
607
|
+
cloneNode = this.$namespace.cloneNode(true);
|
|
608
|
+
doc = this.canvasConfig.document;
|
|
609
|
+
animationCounter = 0;
|
|
610
|
+
$style = null;
|
|
611
|
+
this.context.renderingContext.root.forEach(function (object) {
|
|
612
|
+
var animations = object.getAnimations();
|
|
613
|
+
if (animations.length) {
|
|
614
|
+
if (!$style) {
|
|
615
|
+
// export animations to <style>, using CSS Transformation
|
|
616
|
+
$style = (doc || document).createElement('style');
|
|
617
|
+
cloneNode.appendChild($style);
|
|
618
|
+
}
|
|
619
|
+
// @ts-ignore
|
|
620
|
+
var svgElement = object.elementSVG;
|
|
621
|
+
var selfSelector = "#".concat(svgElement.$el.id);
|
|
622
|
+
var groupSelector = "#".concat(svgElement.$groupEl.id);
|
|
623
|
+
var selfCssText = '';
|
|
624
|
+
var groupCssText = '';
|
|
625
|
+
animations.forEach(function (animation) {
|
|
626
|
+
var keyframes = animation.effect.getKeyframes();
|
|
627
|
+
// split attributes into self and group
|
|
628
|
+
if (keyframes.length) {
|
|
629
|
+
var selfAttributes = [];
|
|
630
|
+
var groupAttributes = [];
|
|
631
|
+
var _keyframes$ = keyframes[0],
|
|
632
|
+
offset = _keyframes$.offset,
|
|
633
|
+
composite = _keyframes$.composite,
|
|
634
|
+
computedOffset = _keyframes$.computedOffset,
|
|
635
|
+
easing = _keyframes$.easing,
|
|
636
|
+
transformOrigin = _keyframes$.transformOrigin,
|
|
637
|
+
rest = _objectWithoutProperties(_keyframes$, _excluded2);
|
|
638
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
639
|
+
var _propertyMetadataCach;
|
|
640
|
+
if (attributeName === 'transform') {
|
|
641
|
+
groupAttributes.push(attributeName);
|
|
642
|
+
}
|
|
643
|
+
var inherited = !!((_propertyMetadataCach = propertyMetadataCache[attributeName]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.inh);
|
|
644
|
+
if (inherited) {
|
|
645
|
+
groupAttributes.push(attributeName);
|
|
646
|
+
} else if (attributeName !== 'transform') {
|
|
647
|
+
selfAttributes.push(attributeName);
|
|
648
|
+
}
|
|
544
649
|
});
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
}
|
|
650
|
+
if (groupAttributes.length) {
|
|
651
|
+
var keyframesWithGroup = keyframes.map(function (keyframe) {
|
|
652
|
+
var offset = keyframe.offset,
|
|
653
|
+
composite = keyframe.composite,
|
|
654
|
+
computedOffset = keyframe.computedOffset,
|
|
655
|
+
easing = keyframe.easing,
|
|
656
|
+
transformOrigin = keyframe.transformOrigin,
|
|
657
|
+
rest = _objectWithoutProperties(keyframe, _excluded3);
|
|
658
|
+
var ret = {
|
|
659
|
+
offset: offset,
|
|
660
|
+
composite: composite,
|
|
661
|
+
computedOffset: computedOffset,
|
|
662
|
+
easing: easing
|
|
663
|
+
};
|
|
664
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
665
|
+
if (groupAttributes.includes(attributeName)) {
|
|
666
|
+
ret[attributeName] = keyframe[attributeName];
|
|
667
|
+
}
|
|
668
|
+
});
|
|
669
|
+
return ret;
|
|
564
670
|
});
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
671
|
+
groupCssText += _this.generateCSSText("a".concat(animationCounter++), groupSelector, keyframesWithGroup, animation.effect.getComputedTiming(), {
|
|
672
|
+
transform: svgElement.$groupEl.getAttribute('transform')
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
if (selfAttributes.length) {
|
|
676
|
+
var keyframesWithSelf = keyframes.map(function (keyframe) {
|
|
677
|
+
var offset = keyframe.offset,
|
|
678
|
+
composite = keyframe.composite,
|
|
679
|
+
computedOffset = keyframe.computedOffset,
|
|
680
|
+
easing = keyframe.easing,
|
|
681
|
+
transformOrigin = keyframe.transformOrigin,
|
|
682
|
+
rest = _objectWithoutProperties(keyframe, _excluded4);
|
|
683
|
+
var ret = {
|
|
684
|
+
offset: offset,
|
|
685
|
+
composite: composite,
|
|
686
|
+
computedOffset: computedOffset,
|
|
687
|
+
easing: easing
|
|
688
|
+
};
|
|
689
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
690
|
+
if (selfAttributes.includes(attributeName)) {
|
|
691
|
+
ret[attributeName] = keyframe[attributeName];
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
return ret;
|
|
695
|
+
});
|
|
696
|
+
selfCssText += _this.generateCSSText("a".concat(animationCounter++), selfSelector, keyframesWithSelf, animation.effect.getComputedTiming());
|
|
697
|
+
}
|
|
568
698
|
}
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
}
|
|
699
|
+
});
|
|
700
|
+
$style.textContent += selfCssText + groupCssText;
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
704
|
+
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
705
|
+
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
706
|
+
return _context2.abrupt("return", "data:image/svg+xml;charset=utf8,".concat(encodeURIComponent(new XMLSerializer().serializeToString(svgDoc))));
|
|
707
|
+
case 10:
|
|
708
|
+
case "end":
|
|
709
|
+
return _context2.stop();
|
|
710
|
+
}
|
|
711
|
+
}, _callee2, this);
|
|
712
|
+
}));
|
|
713
|
+
function toDataURL() {
|
|
714
|
+
return _toDataURL.apply(this, arguments);
|
|
715
|
+
}
|
|
716
|
+
return toDataURL;
|
|
717
|
+
}()
|
|
718
|
+
}]);
|
|
589
719
|
return SVGContextService;
|
|
590
720
|
}();
|
|
591
721
|
|
|
592
722
|
var ContextRegisterPlugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
593
|
-
|
|
723
|
+
_inherits(ContextRegisterPlugin, _AbstractRendererPlug);
|
|
724
|
+
var _super = _createSuper(ContextRegisterPlugin);
|
|
594
725
|
function ContextRegisterPlugin() {
|
|
595
726
|
var _this;
|
|
727
|
+
_classCallCheck(this, ContextRegisterPlugin);
|
|
596
728
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
597
729
|
args[_key] = arguments[_key];
|
|
598
730
|
}
|
|
599
|
-
_this =
|
|
731
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
600
732
|
_this.name = 'svg-context-register';
|
|
601
733
|
return _this;
|
|
602
734
|
}
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
735
|
+
_createClass(ContextRegisterPlugin, [{
|
|
736
|
+
key: "init",
|
|
737
|
+
value: function init() {
|
|
738
|
+
// @ts-ignore
|
|
739
|
+
this.context.ContextService = SVGContextService;
|
|
740
|
+
}
|
|
741
|
+
}, {
|
|
742
|
+
key: "destroy",
|
|
743
|
+
value: function destroy() {
|
|
744
|
+
delete this.context.ContextService;
|
|
745
|
+
}
|
|
746
|
+
}]);
|
|
611
747
|
return ContextRegisterPlugin;
|
|
612
748
|
}(AbstractRendererPlugin);
|
|
613
749
|
|
|
614
750
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
615
|
-
|
|
616
|
-
|
|
751
|
+
_inherits(Renderer, _AbstractRenderer);
|
|
752
|
+
var _super = _createSuper(Renderer);
|
|
753
|
+
function Renderer() {
|
|
617
754
|
var _this;
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
_this = _AbstractRenderer.call(this, config) || this;
|
|
755
|
+
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
756
|
+
_classCallCheck(this, Renderer);
|
|
757
|
+
_this = _super.call(this, config);
|
|
622
758
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
623
759
|
_this.registerPlugin(new Plugin({
|
|
624
760
|
outputSVGElementId: config.outputSVGElementId
|
|
@@ -627,7 +763,7 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
|
627
763
|
_this.registerPlugin(new Plugin$2());
|
|
628
764
|
return _this;
|
|
629
765
|
}
|
|
630
|
-
return Renderer;
|
|
766
|
+
return _createClass(Renderer);
|
|
631
767
|
}(AbstractRenderer);
|
|
632
768
|
|
|
633
769
|
export { Renderer };
|