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