@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 CHANGED
@@ -341,10 +341,49 @@ function _asyncToGenerator(fn) {
341
341
  });
342
342
  };
343
343
  }
344
- function _inheritsLoose(subClass, superClass) {
345
- subClass.prototype = Object.create(superClass.prototype);
346
- subClass.prototype.constructor = subClass;
347
- _setPrototypeOf(subClass, superClass);
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
- var _proto = SVGContextService.prototype;
384
- _proto.init = /*#__PURE__*/function () {
385
- var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
386
- var _this$canvasConfig, container, doc, devicePixelRatio, $namespace, dpr;
387
- return _regeneratorRuntime().wrap(function _callee$(_context) {
388
- while (1) switch (_context.prev = _context.next) {
389
- case 0:
390
- _this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document, devicePixelRatio = _this$canvasConfig.devicePixelRatio; // create container
391
- this.$container = isString(container) ? (doc || document).getElementById(container) : container;
392
- if (this.$container) {
393
- if (!this.$container.style.position) {
394
- this.$container.style.position = 'relative';
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
- $namespace = createSVGElement('svg', doc);
397
- $namespace.setAttribute('width', "" + this.canvasConfig.width);
398
- $namespace.setAttribute('height', "" + this.canvasConfig.height);
399
- this.$container.appendChild($namespace);
400
- this.$namespace = $namespace;
401
- }
402
- // use user-defined dpr first
403
- dpr = devicePixelRatio || isBrowser && window.devicePixelRatio || 1;
404
- dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
405
- this.dpr = dpr;
406
- case 6:
407
- case "end":
408
- return _context.stop();
409
- }
410
- }, _callee, this);
411
- }));
412
- function init() {
413
- return _init.apply(this, arguments);
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
- return init;
416
- }() // @ts-ignore
417
- ;
418
- _proto.getDomElement = function getDomElement() {
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
- _proto.resize = function resize(width, height) {
438
- // SVG should ignore DPR
439
- if (this.$namespace) {
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
- _proto.applyCursorStyle = function applyCursorStyle(cursor) {
445
- if (this.$container) {
446
- this.$container.style.cursor = cursor;
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
- _proto.generateCSSText = function generateCSSText(animationName, selector, keyframes, timing, prefixes) {
450
- if (prefixes === void 0) {
451
- prefixes = {};
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
- var duration = timing.duration,
454
- easing = timing.easing,
455
- delay = timing.delay,
456
- direction = timing.direction,
457
- iterations = timing.iterations,
458
- fill = timing.fill;
459
- return "@keyframes " + animationName + "{" + keyframes.map(function (keyframe) {
460
- var offset = keyframe.offset,
461
- composite = keyframe.composite,
462
- computedOffset = keyframe.computedOffset,
463
- easing = keyframe.easing,
464
- rest = _objectWithoutPropertiesLoose(keyframe, _excluded);
465
- var rules = Object.keys(rest).map(function (attributeName) {
466
- return attributeName + ":" + (prefixes[attributeName] || '') + rest[attributeName] + ";";
467
- }).join('');
468
- return computedOffset * 100 + "%{" + rules + "}";
469
- }).join('') + "}" + (selector + " {animation: " + animationName + " " + duration + "ms " + easing + " " + delay + "ms " + (iterations === Infinity ? 'infinite' : iterations) + " " + direction + " " + fill + ";}");
470
- };
471
- _proto.toDataURL = /*#__PURE__*/function () {
472
- var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(options) {
473
- var _this = this;
474
- var cloneNode, doc, animationCounter, $style, svgDocType, svgDoc;
475
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
476
- while (1) switch (_context2.prev = _context2.next) {
477
- case 0:
478
- cloneNode = this.$namespace.cloneNode(true);
479
- doc = this.canvasConfig.document;
480
- animationCounter = 0;
481
- $style = null;
482
- this.context.renderingContext.root.forEach(function (object) {
483
- var animations = object.getAnimations();
484
- if (animations.length) {
485
- if (!$style) {
486
- // export animations to <style>, using CSS Transformation
487
- $style = (doc || document).createElement('style');
488
- cloneNode.appendChild($style);
489
- }
490
- // @ts-ignore
491
- var svgElement = object.elementSVG;
492
- var selfSelector = "#" + svgElement.$el.id;
493
- var groupSelector = "#" + svgElement.$groupEl.id;
494
- var selfCssText = '';
495
- var groupCssText = '';
496
- animations.forEach(function (animation) {
497
- var keyframes = animation.effect.getKeyframes();
498
- // split attributes into self and group
499
- if (keyframes.length) {
500
- var selfAttributes = [];
501
- var groupAttributes = [];
502
- var _keyframes$ = keyframes[0],
503
- offset = _keyframes$.offset,
504
- composite = _keyframes$.composite,
505
- computedOffset = _keyframes$.computedOffset,
506
- easing = _keyframes$.easing,
507
- transformOrigin = _keyframes$.transformOrigin,
508
- rest = _objectWithoutPropertiesLoose(_keyframes$, _excluded2);
509
- Object.keys(rest).forEach(function (attributeName) {
510
- var _propertyMetadataCach;
511
- if (attributeName === 'transform') {
512
- groupAttributes.push(attributeName);
513
- }
514
- var inherited = !!((_propertyMetadataCach = propertyMetadataCache[attributeName]) === null || _propertyMetadataCach === void 0 ? void 0 : _propertyMetadataCach.inh);
515
- if (inherited) {
516
- groupAttributes.push(attributeName);
517
- } else if (attributeName !== 'transform') {
518
- selfAttributes.push(attributeName);
519
- }
520
- });
521
- if (groupAttributes.length) {
522
- var keyframesWithGroup = keyframes.map(function (keyframe) {
523
- var offset = keyframe.offset,
524
- composite = keyframe.composite,
525
- computedOffset = keyframe.computedOffset,
526
- easing = keyframe.easing,
527
- transformOrigin = keyframe.transformOrigin,
528
- rest = _objectWithoutPropertiesLoose(keyframe, _excluded3);
529
- var ret = {
530
- offset: offset,
531
- composite: composite,
532
- computedOffset: computedOffset,
533
- easing: easing
534
- };
535
- Object.keys(rest).forEach(function (attributeName) {
536
- if (groupAttributes.includes(attributeName)) {
537
- ret[attributeName] = keyframe[attributeName];
538
- }
539
- });
540
- return ret;
541
- });
542
- groupCssText += _this.generateCSSText("a" + animationCounter++, groupSelector, keyframesWithGroup, animation.effect.getComputedTiming(), {
543
- transform: svgElement.$groupEl.getAttribute('transform')
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
- if (selfAttributes.length) {
547
- var keyframesWithSelf = keyframes.map(function (keyframe) {
548
- var offset = keyframe.offset,
549
- composite = keyframe.composite,
550
- computedOffset = keyframe.computedOffset,
551
- easing = keyframe.easing,
552
- transformOrigin = keyframe.transformOrigin,
553
- rest = _objectWithoutPropertiesLoose(keyframe, _excluded4);
554
- var ret = {
555
- offset: offset,
556
- composite: composite,
557
- computedOffset: computedOffset,
558
- easing: easing
559
- };
560
- Object.keys(rest).forEach(function (attributeName) {
561
- if (selfAttributes.includes(attributeName)) {
562
- ret[attributeName] = keyframe[attributeName];
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
- return ret;
566
- });
567
- selfCssText += _this.generateCSSText("a" + animationCounter++, selfSelector, keyframesWithSelf, animation.effect.getComputedTiming());
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
- $style.textContent += selfCssText + groupCssText;
572
- }
573
- });
574
- svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
575
- svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
576
- svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
577
- return _context2.abrupt("return", "data:image/svg+xml;charset=utf8," + encodeURIComponent(new XMLSerializer().serializeToString(svgDoc)));
578
- case 10:
579
- case "end":
580
- return _context2.stop();
581
- }
582
- }, _callee2, this);
583
- }));
584
- function toDataURL(_x) {
585
- return _toDataURL.apply(this, arguments);
586
- }
587
- return toDataURL;
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
- _inheritsLoose(ContextRegisterPlugin, _AbstractRendererPlug);
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 = _AbstractRendererPlug.call.apply(_AbstractRendererPlug, [this].concat(args)) || this;
731
+ _this = _super.call.apply(_super, [this].concat(args));
600
732
  _this.name = 'svg-context-register';
601
733
  return _this;
602
734
  }
603
- var _proto = ContextRegisterPlugin.prototype;
604
- _proto.init = function init() {
605
- // @ts-ignore
606
- this.context.ContextService = SVGContextService;
607
- };
608
- _proto.destroy = function destroy() {
609
- delete this.context.ContextService;
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
- _inheritsLoose(Renderer, _AbstractRenderer);
616
- function Renderer(config) {
751
+ _inherits(Renderer, _AbstractRenderer);
752
+ var _super = _createSuper(Renderer);
753
+ function Renderer() {
617
754
  var _this;
618
- if (config === void 0) {
619
- config = {};
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 };