@antv/g-svg 1.8.56 → 1.8.57
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 +218 -354
- package/dist/index.js +218 -354
- package/dist/index.umd.js +1196 -1800
- package/dist/index.umd.min.js +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -363,49 +363,10 @@ function _asyncToGenerator(fn) {
|
|
|
363
363
|
});
|
|
364
364
|
};
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
|
|
368
|
-
|
|
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);
|
|
366
|
+
function _inheritsLoose(subClass, superClass) {
|
|
367
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
368
|
+
subClass.prototype.constructor = subClass;
|
|
369
|
+
_setPrototypeOf(subClass, superClass);
|
|
409
370
|
}
|
|
410
371
|
function _setPrototypeOf(o, p) {
|
|
411
372
|
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
@@ -414,17 +375,6 @@ function _setPrototypeOf(o, p) {
|
|
|
414
375
|
};
|
|
415
376
|
return _setPrototypeOf(o, p);
|
|
416
377
|
}
|
|
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
|
-
}
|
|
428
378
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
429
379
|
if (source == null) return {};
|
|
430
380
|
var target = {};
|
|
@@ -437,63 +387,6 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
437
387
|
}
|
|
438
388
|
return target;
|
|
439
389
|
}
|
|
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
|
-
}
|
|
497
390
|
|
|
498
391
|
var _excluded = ["offset", "composite", "computedOffset", "easing"],
|
|
499
392
|
_excluded2 = ["offset", "composite", "computedOffset", "easing", "transformOrigin"],
|
|
@@ -501,7 +394,6 @@ var _excluded = ["offset", "composite", "computedOffset", "easing"],
|
|
|
501
394
|
_excluded4 = ["offset", "composite", "computedOffset", "easing", "transformOrigin"];
|
|
502
395
|
var SVGContextService = /*#__PURE__*/function () {
|
|
503
396
|
function SVGContextService(context) {
|
|
504
|
-
_classCallCheck(this, SVGContextService);
|
|
505
397
|
this.context = void 0;
|
|
506
398
|
this.$container = void 0;
|
|
507
399
|
this.$namespace = void 0;
|
|
@@ -510,273 +402,245 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
510
402
|
this.context = context;
|
|
511
403
|
this.canvasConfig = context.config;
|
|
512
404
|
}
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
var
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
if (this.$container) {
|
|
524
|
-
|
|
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;
|
|
405
|
+
var _proto = SVGContextService.prototype;
|
|
406
|
+
_proto.init = /*#__PURE__*/function () {
|
|
407
|
+
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
408
|
+
var _this$canvasConfig, container, doc, devicePixelRatio, $namespace, dpr;
|
|
409
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
410
|
+
while (1) switch (_context.prev = _context.next) {
|
|
411
|
+
case 0:
|
|
412
|
+
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document, devicePixelRatio = _this$canvasConfig.devicePixelRatio; // create container
|
|
413
|
+
this.$container = util.isString(container) ? (doc || document).getElementById(container) : container;
|
|
414
|
+
if (this.$container) {
|
|
415
|
+
if (!this.$container.style.position) {
|
|
416
|
+
this.$container.style.position = 'relative';
|
|
532
417
|
}
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
this.
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
return this.$namespace;
|
|
552
|
-
}
|
|
553
|
-
}, {
|
|
554
|
-
key: "getContext",
|
|
555
|
-
value: function getContext() {
|
|
556
|
-
return this.$namespace;
|
|
557
|
-
}
|
|
558
|
-
}, {
|
|
559
|
-
key: "getDPR",
|
|
560
|
-
value: function getDPR() {
|
|
561
|
-
return this.dpr;
|
|
562
|
-
}
|
|
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();
|
|
418
|
+
$namespace = SVGRenderer.createSVGElement('svg', doc);
|
|
419
|
+
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
420
|
+
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
421
|
+
this.$container.appendChild($namespace);
|
|
422
|
+
this.$namespace = $namespace;
|
|
423
|
+
}
|
|
424
|
+
// use user-defined dpr first
|
|
425
|
+
dpr = devicePixelRatio || gLite.isBrowser && window.devicePixelRatio || 1;
|
|
426
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
427
|
+
this.dpr = dpr;
|
|
428
|
+
case 6:
|
|
429
|
+
case "end":
|
|
430
|
+
return _context.stop();
|
|
431
|
+
}
|
|
432
|
+
}, _callee, this);
|
|
433
|
+
}));
|
|
434
|
+
function init() {
|
|
435
|
+
return _init.apply(this, arguments);
|
|
568
436
|
}
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
437
|
+
return init;
|
|
438
|
+
}() // @ts-ignore
|
|
439
|
+
;
|
|
440
|
+
_proto.getDomElement = function getDomElement() {
|
|
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);
|
|
576
457
|
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
this.$namespace.setAttribute('height', "".concat(height));
|
|
584
|
-
}
|
|
458
|
+
};
|
|
459
|
+
_proto.resize = function resize(width, height) {
|
|
460
|
+
// SVG should ignore DPR
|
|
461
|
+
if (this.$namespace) {
|
|
462
|
+
this.$namespace.setAttribute('width', "" + width);
|
|
463
|
+
this.$namespace.setAttribute('height', "" + height);
|
|
585
464
|
}
|
|
586
|
-
}
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
this.$container.style.cursor = cursor;
|
|
591
|
-
}
|
|
465
|
+
};
|
|
466
|
+
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
|
|
467
|
+
if (this.$container) {
|
|
468
|
+
this.$container.style.cursor = cursor;
|
|
592
469
|
}
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
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, ";}");
|
|
470
|
+
};
|
|
471
|
+
_proto.generateCSSText = function generateCSSText(animationName, selector, keyframes, timing, prefixes) {
|
|
472
|
+
if (prefixes === void 0) {
|
|
473
|
+
prefixes = {};
|
|
614
474
|
}
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
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;
|
|
692
|
-
});
|
|
693
|
-
groupCssText += _this.generateCSSText("a".concat(animationCounter++), groupSelector, keyframesWithGroup, animation.effect.getComputedTiming(), {
|
|
694
|
-
transform: svgElement.$groupEl.getAttribute('transform')
|
|
695
|
-
});
|
|
475
|
+
var duration = timing.duration,
|
|
476
|
+
easing = timing.easing,
|
|
477
|
+
delay = timing.delay,
|
|
478
|
+
direction = timing.direction,
|
|
479
|
+
iterations = timing.iterations,
|
|
480
|
+
fill = timing.fill;
|
|
481
|
+
return "@keyframes " + animationName + "{" + keyframes.map(function (keyframe) {
|
|
482
|
+
var offset = keyframe.offset,
|
|
483
|
+
composite = keyframe.composite,
|
|
484
|
+
computedOffset = keyframe.computedOffset,
|
|
485
|
+
easing = keyframe.easing,
|
|
486
|
+
rest = _objectWithoutPropertiesLoose(keyframe, _excluded);
|
|
487
|
+
var rules = Object.keys(rest).map(function (attributeName) {
|
|
488
|
+
return attributeName + ":" + (prefixes[attributeName] || '') + rest[attributeName] + ";";
|
|
489
|
+
}).join('');
|
|
490
|
+
return computedOffset * 100 + "%{" + rules + "}";
|
|
491
|
+
}).join('') + "}" + (selector + " {animation: " + animationName + " " + duration + "ms " + easing + " " + delay + "ms " + (iterations === Infinity ? 'infinite' : iterations) + " " + direction + " " + fill + ";}");
|
|
492
|
+
};
|
|
493
|
+
_proto.toDataURL = /*#__PURE__*/function () {
|
|
494
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
|
|
495
|
+
var _this = this;
|
|
496
|
+
var cloneNode, doc, animationCounter, $style, svgDocType, svgDoc;
|
|
497
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
498
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
499
|
+
case 0:
|
|
500
|
+
cloneNode = this.$namespace.cloneNode(true);
|
|
501
|
+
doc = this.canvasConfig.document;
|
|
502
|
+
animationCounter = 0;
|
|
503
|
+
$style = null;
|
|
504
|
+
this.context.renderingContext.root.forEach(function (object) {
|
|
505
|
+
var animations = object.getAnimations();
|
|
506
|
+
if (animations.length) {
|
|
507
|
+
if (!$style) {
|
|
508
|
+
// export animations to <style>, using CSS Transformation
|
|
509
|
+
$style = (doc || document).createElement('style');
|
|
510
|
+
cloneNode.appendChild($style);
|
|
511
|
+
}
|
|
512
|
+
// @ts-ignore
|
|
513
|
+
var svgElement = object.elementSVG;
|
|
514
|
+
var selfSelector = "#" + svgElement.$el.id;
|
|
515
|
+
var groupSelector = "#" + svgElement.$groupEl.id;
|
|
516
|
+
var selfCssText = '';
|
|
517
|
+
var groupCssText = '';
|
|
518
|
+
animations.forEach(function (animation) {
|
|
519
|
+
var keyframes = animation.effect.getKeyframes();
|
|
520
|
+
// split attributes into self and group
|
|
521
|
+
if (keyframes.length) {
|
|
522
|
+
var selfAttributes = [];
|
|
523
|
+
var groupAttributes = [];
|
|
524
|
+
var _keyframes$ = keyframes[0],
|
|
525
|
+
offset = _keyframes$.offset,
|
|
526
|
+
composite = _keyframes$.composite,
|
|
527
|
+
computedOffset = _keyframes$.computedOffset,
|
|
528
|
+
easing = _keyframes$.easing,
|
|
529
|
+
transformOrigin = _keyframes$.transformOrigin,
|
|
530
|
+
rest = _objectWithoutPropertiesLoose(_keyframes$, _excluded2);
|
|
531
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
532
|
+
var _propertyMetadataCach;
|
|
533
|
+
if (attributeName === 'transform') {
|
|
534
|
+
groupAttributes.push(attributeName);
|
|
696
535
|
}
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
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());
|
|
536
|
+
var inherited = !!((_propertyMetadataCach = gLite.propertyMetadataCache[attributeName]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.inh);
|
|
537
|
+
if (inherited) {
|
|
538
|
+
groupAttributes.push(attributeName);
|
|
539
|
+
} else if (attributeName !== 'transform') {
|
|
540
|
+
selfAttributes.push(attributeName);
|
|
719
541
|
}
|
|
542
|
+
});
|
|
543
|
+
if (groupAttributes.length) {
|
|
544
|
+
var keyframesWithGroup = keyframes.map(function (keyframe) {
|
|
545
|
+
var offset = keyframe.offset,
|
|
546
|
+
composite = keyframe.composite,
|
|
547
|
+
computedOffset = keyframe.computedOffset,
|
|
548
|
+
easing = keyframe.easing,
|
|
549
|
+
transformOrigin = keyframe.transformOrigin,
|
|
550
|
+
rest = _objectWithoutPropertiesLoose(keyframe, _excluded3);
|
|
551
|
+
var ret = {
|
|
552
|
+
offset: offset,
|
|
553
|
+
composite: composite,
|
|
554
|
+
computedOffset: computedOffset,
|
|
555
|
+
easing: easing
|
|
556
|
+
};
|
|
557
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
558
|
+
if (groupAttributes.includes(attributeName)) {
|
|
559
|
+
ret[attributeName] = keyframe[attributeName];
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
return ret;
|
|
563
|
+
});
|
|
564
|
+
groupCssText += _this.generateCSSText("a" + animationCounter++, groupSelector, keyframesWithGroup, animation.effect.getComputedTiming(), {
|
|
565
|
+
transform: svgElement.$groupEl.getAttribute('transform')
|
|
566
|
+
});
|
|
720
567
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
568
|
+
if (selfAttributes.length) {
|
|
569
|
+
var keyframesWithSelf = keyframes.map(function (keyframe) {
|
|
570
|
+
var offset = keyframe.offset,
|
|
571
|
+
composite = keyframe.composite,
|
|
572
|
+
computedOffset = keyframe.computedOffset,
|
|
573
|
+
easing = keyframe.easing,
|
|
574
|
+
transformOrigin = keyframe.transformOrigin,
|
|
575
|
+
rest = _objectWithoutPropertiesLoose(keyframe, _excluded4);
|
|
576
|
+
var ret = {
|
|
577
|
+
offset: offset,
|
|
578
|
+
composite: composite,
|
|
579
|
+
computedOffset: computedOffset,
|
|
580
|
+
easing: easing
|
|
581
|
+
};
|
|
582
|
+
Object.keys(rest).forEach(function (attributeName) {
|
|
583
|
+
if (selfAttributes.includes(attributeName)) {
|
|
584
|
+
ret[attributeName] = keyframe[attributeName];
|
|
585
|
+
}
|
|
586
|
+
});
|
|
587
|
+
return ret;
|
|
588
|
+
});
|
|
589
|
+
selfCssText += _this.generateCSSText("a" + animationCounter++, selfSelector, keyframesWithSelf, animation.effect.getComputedTiming());
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
$style.textContent += selfCssText + groupCssText;
|
|
594
|
+
}
|
|
595
|
+
});
|
|
596
|
+
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
597
|
+
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
598
|
+
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
599
|
+
return _context2.abrupt("return", "data:image/svg+xml;charset=utf8," + encodeURIComponent(new XMLSerializer().serializeToString(svgDoc)));
|
|
600
|
+
case 10:
|
|
601
|
+
case "end":
|
|
602
|
+
return _context2.stop();
|
|
603
|
+
}
|
|
604
|
+
}, _callee2, this);
|
|
605
|
+
}));
|
|
606
|
+
function toDataURL(_x) {
|
|
607
|
+
return _toDataURL.apply(this, arguments);
|
|
608
|
+
}
|
|
609
|
+
return toDataURL;
|
|
610
|
+
}();
|
|
741
611
|
return SVGContextService;
|
|
742
612
|
}();
|
|
743
613
|
|
|
744
614
|
var ContextRegisterPlugin = /*#__PURE__*/function (_AbstractRendererPlug) {
|
|
745
|
-
|
|
746
|
-
var _super = _createSuper(ContextRegisterPlugin);
|
|
615
|
+
_inheritsLoose(ContextRegisterPlugin, _AbstractRendererPlug);
|
|
747
616
|
function ContextRegisterPlugin() {
|
|
748
617
|
var _this;
|
|
749
|
-
_classCallCheck(this, ContextRegisterPlugin);
|
|
750
618
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
751
619
|
args[_key] = arguments[_key];
|
|
752
620
|
}
|
|
753
|
-
_this =
|
|
621
|
+
_this = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
|
|
754
622
|
_this.name = 'svg-context-register';
|
|
755
623
|
return _this;
|
|
756
624
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
value: function destroy() {
|
|
766
|
-
delete this.context.ContextService;
|
|
767
|
-
}
|
|
768
|
-
}]);
|
|
625
|
+
var _proto = ContextRegisterPlugin.prototype;
|
|
626
|
+
_proto.init = function init() {
|
|
627
|
+
// @ts-ignore
|
|
628
|
+
this.context.ContextService = SVGContextService;
|
|
629
|
+
};
|
|
630
|
+
_proto.destroy = function destroy() {
|
|
631
|
+
delete this.context.ContextService;
|
|
632
|
+
};
|
|
769
633
|
return ContextRegisterPlugin;
|
|
770
634
|
}(gLite.AbstractRendererPlugin);
|
|
771
635
|
|
|
772
636
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
function Renderer() {
|
|
637
|
+
_inheritsLoose(Renderer, _AbstractRenderer);
|
|
638
|
+
function Renderer(config) {
|
|
776
639
|
var _this;
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
640
|
+
if (config === void 0) {
|
|
641
|
+
config = {};
|
|
642
|
+
}
|
|
643
|
+
_this = _AbstractRenderer.call(this, config) || this;
|
|
780
644
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
781
645
|
_this.registerPlugin(new SVGRenderer.Plugin({
|
|
782
646
|
outputSVGElementId: config.outputSVGElementId
|
|
@@ -785,7 +649,7 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
|
785
649
|
_this.registerPlugin(new SVGPicker.Plugin());
|
|
786
650
|
return _this;
|
|
787
651
|
}
|
|
788
|
-
return
|
|
652
|
+
return Renderer;
|
|
789
653
|
}(gLite.AbstractRenderer);
|
|
790
654
|
|
|
791
655
|
exports.DomInteraction = DomInteraction__namespace;
|