@antv/g-svg 1.2.1 → 1.2.2
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 +86 -197
- package/dist/index.js +86 -197
- package/dist/index.umd.js +1784 -2157
- package/dist/index.umd.min.js +5 -5
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -413,54 +413,11 @@ function _asyncToGenerator(fn) {
|
|
|
413
413
|
};
|
|
414
414
|
}
|
|
415
415
|
|
|
416
|
-
function
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
function _defineProperties(target, props) {
|
|
423
|
-
for (var i = 0; i < props.length; i++) {
|
|
424
|
-
var descriptor = props[i];
|
|
425
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
426
|
-
descriptor.configurable = true;
|
|
427
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
428
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
433
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
434
|
-
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
435
|
-
Object.defineProperty(Constructor, "prototype", {
|
|
436
|
-
writable: false
|
|
437
|
-
});
|
|
438
|
-
return Constructor;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
function _inherits(subClass, superClass) {
|
|
442
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
443
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
444
|
-
}
|
|
416
|
+
function _inheritsLoose(subClass, superClass) {
|
|
417
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
418
|
+
subClass.prototype.constructor = subClass;
|
|
445
419
|
|
|
446
|
-
subClass
|
|
447
|
-
constructor: {
|
|
448
|
-
value: subClass,
|
|
449
|
-
writable: true,
|
|
450
|
-
configurable: true
|
|
451
|
-
}
|
|
452
|
-
});
|
|
453
|
-
Object.defineProperty(subClass, "prototype", {
|
|
454
|
-
writable: false
|
|
455
|
-
});
|
|
456
|
-
if (superClass) _setPrototypeOf(subClass, superClass);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
function _getPrototypeOf(o) {
|
|
460
|
-
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
|
|
461
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
462
|
-
};
|
|
463
|
-
return _getPrototypeOf(o);
|
|
420
|
+
_setPrototypeOf(subClass, superClass);
|
|
464
421
|
}
|
|
465
422
|
|
|
466
423
|
function _setPrototypeOf(o, p) {
|
|
@@ -471,157 +428,97 @@ function _setPrototypeOf(o, p) {
|
|
|
471
428
|
return _setPrototypeOf(o, p);
|
|
472
429
|
}
|
|
473
430
|
|
|
474
|
-
function
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
481
|
-
return true;
|
|
482
|
-
} catch (e) {
|
|
483
|
-
return false;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
function _assertThisInitialized(self) {
|
|
488
|
-
if (self === void 0) {
|
|
489
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
431
|
+
var SVGContextService = /*#__PURE__*/function () {
|
|
432
|
+
function SVGContextService() {
|
|
433
|
+
this.$container = void 0;
|
|
434
|
+
this.$namespace = void 0;
|
|
435
|
+
this.dpr = void 0;
|
|
436
|
+
this.canvasConfig = void 0;
|
|
490
437
|
}
|
|
491
438
|
|
|
492
|
-
|
|
493
|
-
}
|
|
439
|
+
var _proto = SVGContextService.prototype;
|
|
494
440
|
|
|
495
|
-
function
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
} else if (call !== void 0) {
|
|
499
|
-
throw new TypeError("Derived constructors may only return object or undefined");
|
|
500
|
-
}
|
|
441
|
+
_proto.init = /*#__PURE__*/function () {
|
|
442
|
+
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
443
|
+
var _this$canvasConfig, container, doc, $namespace, dpr;
|
|
501
444
|
|
|
502
|
-
|
|
503
|
-
|
|
445
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
446
|
+
while (1) {
|
|
447
|
+
switch (_context.prev = _context.next) {
|
|
448
|
+
case 0:
|
|
449
|
+
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document; // create container
|
|
504
450
|
|
|
505
|
-
|
|
506
|
-
var hasNativeReflectConstruct = _isNativeReflectConstruct();
|
|
451
|
+
this.$container = g.isString(container) ? (doc || document).getElementById(container) : container;
|
|
507
452
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
453
|
+
if (this.$container) {
|
|
454
|
+
if (!this.$container.style.position) {
|
|
455
|
+
this.$container.style.position = 'relative';
|
|
456
|
+
}
|
|
511
457
|
|
|
512
|
-
|
|
513
|
-
|
|
458
|
+
$namespace = SVGRenderer.createSVGElement('svg', doc);
|
|
459
|
+
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
460
|
+
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
461
|
+
this.$container.appendChild($namespace);
|
|
462
|
+
this.$namespace = $namespace;
|
|
463
|
+
}
|
|
514
464
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
}
|
|
465
|
+
dpr = window.devicePixelRatio || 1;
|
|
466
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
467
|
+
this.dpr = dpr;
|
|
519
468
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
469
|
+
case 6:
|
|
470
|
+
case "end":
|
|
471
|
+
return _context.stop();
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}, _callee, this);
|
|
475
|
+
}));
|
|
523
476
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
477
|
+
function init() {
|
|
478
|
+
return _init.apply(this, arguments);
|
|
479
|
+
}
|
|
527
480
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
this.canvasConfig = void 0;
|
|
532
|
-
}
|
|
481
|
+
return init;
|
|
482
|
+
}() // @ts-ignore
|
|
483
|
+
;
|
|
533
484
|
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
538
|
-
var _this$canvasConfig, container, doc, $namespace, dpr;
|
|
539
|
-
|
|
540
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
541
|
-
while (1) {
|
|
542
|
-
switch (_context.prev = _context.next) {
|
|
543
|
-
case 0:
|
|
544
|
-
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, doc = _this$canvasConfig.document; // create container
|
|
545
|
-
|
|
546
|
-
this.$container = g.isString(container) ? (doc || document).getElementById(container) : container;
|
|
547
|
-
|
|
548
|
-
if (this.$container) {
|
|
549
|
-
if (!this.$container.style.position) {
|
|
550
|
-
this.$container.style.position = 'relative';
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
$namespace = SVGRenderer.createSVGElement('svg', doc);
|
|
554
|
-
$namespace.setAttribute('width', "".concat(this.canvasConfig.width));
|
|
555
|
-
$namespace.setAttribute('height', "".concat(this.canvasConfig.height));
|
|
556
|
-
this.$container.appendChild($namespace);
|
|
557
|
-
this.$namespace = $namespace;
|
|
558
|
-
}
|
|
485
|
+
_proto.getDomElement = function getDomElement() {
|
|
486
|
+
return this.$namespace;
|
|
487
|
+
};
|
|
559
488
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
489
|
+
_proto.getContext = function getContext() {
|
|
490
|
+
return this.$namespace;
|
|
491
|
+
};
|
|
563
492
|
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
}, _callee, this);
|
|
570
|
-
}));
|
|
493
|
+
_proto.getDPR = function getDPR() {
|
|
494
|
+
return this.dpr;
|
|
495
|
+
};
|
|
571
496
|
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
}
|
|
497
|
+
_proto.getBoundingClientRect = function getBoundingClientRect() {
|
|
498
|
+
var _this$$namespace;
|
|
575
499
|
|
|
576
|
-
|
|
577
|
-
|
|
500
|
+
return (_this$$namespace = this.$namespace) === null || _this$$namespace === void 0 ? void 0 : _this$$namespace.getBoundingClientRect();
|
|
501
|
+
};
|
|
578
502
|
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}
|
|
584
|
-
}, {
|
|
585
|
-
key: "getContext",
|
|
586
|
-
value: function getContext() {
|
|
587
|
-
return this.$namespace;
|
|
588
|
-
}
|
|
589
|
-
}, {
|
|
590
|
-
key: "getDPR",
|
|
591
|
-
value: function getDPR() {
|
|
592
|
-
return this.dpr;
|
|
503
|
+
_proto.destroy = function destroy() {
|
|
504
|
+
// destroy context
|
|
505
|
+
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
506
|
+
this.$container.removeChild(this.$namespace);
|
|
593
507
|
}
|
|
594
|
-
}
|
|
595
|
-
key: "getBoundingClientRect",
|
|
596
|
-
value: function getBoundingClientRect() {
|
|
597
|
-
var _this$$namespace;
|
|
508
|
+
};
|
|
598
509
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
value: function destroy() {
|
|
604
|
-
// destroy context
|
|
605
|
-
if (this.$container && this.$namespace && this.$namespace.parentNode) {
|
|
606
|
-
this.$container.removeChild(this.$namespace);
|
|
607
|
-
}
|
|
608
|
-
}
|
|
609
|
-
}, {
|
|
610
|
-
key: "resize",
|
|
611
|
-
value: function resize(width, height) {
|
|
612
|
-
if (this.$namespace) {
|
|
613
|
-
this.$namespace.setAttribute('width', "".concat(width));
|
|
614
|
-
this.$namespace.setAttribute('height', "".concat(height));
|
|
615
|
-
}
|
|
510
|
+
_proto.resize = function resize(width, height) {
|
|
511
|
+
if (this.$namespace) {
|
|
512
|
+
this.$namespace.setAttribute('width', "" + width);
|
|
513
|
+
this.$namespace.setAttribute('height', "" + height);
|
|
616
514
|
}
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
}
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
|
|
518
|
+
if (this.$container) {
|
|
519
|
+
this.$container.style.cursor = cursor;
|
|
623
520
|
}
|
|
624
|
-
}
|
|
521
|
+
};
|
|
625
522
|
|
|
626
523
|
return SVGContextService;
|
|
627
524
|
}();
|
|
@@ -640,37 +537,29 @@ var containerModule = g.Module(function (register) {
|
|
|
640
537
|
});
|
|
641
538
|
var ContextRegisterPlugin = /*#__PURE__*/function () {
|
|
642
539
|
function ContextRegisterPlugin() {
|
|
643
|
-
_classCallCheck(this, ContextRegisterPlugin);
|
|
644
|
-
|
|
645
540
|
this.name = 'svg-context-register';
|
|
646
541
|
}
|
|
647
542
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
}
|
|
658
|
-
}]);
|
|
543
|
+
var _proto = ContextRegisterPlugin.prototype;
|
|
544
|
+
|
|
545
|
+
_proto.init = function init(container) {
|
|
546
|
+
container.load(containerModule, true);
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
_proto.destroy = function destroy(container) {
|
|
550
|
+
container.unload(containerModule);
|
|
551
|
+
};
|
|
659
552
|
|
|
660
553
|
return ContextRegisterPlugin;
|
|
661
554
|
}();
|
|
662
555
|
|
|
663
556
|
var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
var _super = _createSuper(Renderer);
|
|
557
|
+
_inheritsLoose(Renderer, _AbstractRenderer);
|
|
667
558
|
|
|
668
559
|
function Renderer(config) {
|
|
669
560
|
var _this;
|
|
670
561
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
_this = _super.call(this, config);
|
|
562
|
+
_this = _AbstractRenderer.call(this, config) || this;
|
|
674
563
|
|
|
675
564
|
_this.registerPlugin(new ContextRegisterPlugin());
|
|
676
565
|
|
|
@@ -683,7 +572,7 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
|
|
|
683
572
|
return _this;
|
|
684
573
|
}
|
|
685
574
|
|
|
686
|
-
return
|
|
575
|
+
return Renderer;
|
|
687
576
|
}(g.AbstractRenderer);
|
|
688
577
|
|
|
689
578
|
exports.DomInteraction = DomInteraction__namespace;
|