@antv/g-svg 1.8.57 → 1.8.59
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/SVGContextService.d.ts +1 -1
- package/dist/SVGContextService.d.ts.map +1 -1
- package/dist/index.esm.js +29 -39
- package/dist/index.js +28 -38
- package/dist/index.umd.js +483 -1169
- package/dist/index.umd.min.js +1 -1
- package/package.json +5 -5
|
@@ -6,7 +6,7 @@ export declare class SVGContextService implements ContextService<SVGElement> {
|
|
|
6
6
|
private dpr;
|
|
7
7
|
private canvasConfig;
|
|
8
8
|
constructor(context: GlobalRuntime & CanvasContext);
|
|
9
|
-
init():
|
|
9
|
+
init(): void;
|
|
10
10
|
getDomElement(): SVGElement;
|
|
11
11
|
getContext(): SVGElement;
|
|
12
12
|
getDPR(): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SVGContextService.d.ts","sourceRoot":"","sources":["../src/SVGContextService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EAEb,cAAc,EAEf,MAAM,cAAc,CAAC;AAKtB,qBAAa,iBAAkB,YAAW,cAAc,CAAC,UAAU,CAAC;IAO/C,OAAO,EAAE,aAAa,GAAG,aAAa;IANzD,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,GAAG,CAAS;IAEpB,OAAO,CAAC,YAAY,CAAwB;gBAEzB,OAAO,EAAE,aAAa,GAAG,aAAa;
|
|
1
|
+
{"version":3,"file":"SVGContextService.d.ts","sourceRoot":"","sources":["../src/SVGContextService.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,aAAa,EAEb,cAAc,EAEf,MAAM,cAAc,CAAC;AAKtB,qBAAa,iBAAkB,YAAW,cAAc,CAAC,UAAU,CAAC;IAO/C,OAAO,EAAE,aAAa,GAAG,aAAa;IANzD,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,UAAU,CAAoB;IACtC,OAAO,CAAC,GAAG,CAAS;IAEpB,OAAO,CAAC,YAAY,CAAwB;gBAEzB,OAAO,EAAE,aAAa,GAAG,aAAa;IAIzD,IAAI;IA2BJ,aAAa;IAIb,UAAU;IAIV,MAAM;IAIN,qBAAqB;IAIrB,OAAO;IAOP,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAQpC,gBAAgB,CAAC,MAAM,EAAE,MAAM;IAM/B,OAAO,CAAC,eAAe;IA8BjB,SAAS,CAAC,OAAO,GAAE,OAAO,CAAC,cAAc,CAAM;CAgItD"}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isBrowser, propertyMetadataCache, AbstractRendererPlugin, AbstractRenderer } from '@antv/g-lite';
|
|
2
2
|
import { Plugin as Plugin$1 } from '@antv/g-plugin-dom-interaction';
|
|
3
3
|
import * as DomInteraction from '@antv/g-plugin-dom-interaction';
|
|
4
4
|
export { DomInteraction };
|
|
@@ -381,39 +381,29 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
381
381
|
this.canvasConfig = context.config;
|
|
382
382
|
}
|
|
383
383
|
var _proto = SVGContextService.prototype;
|
|
384
|
-
_proto.init =
|
|
385
|
-
var
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
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);
|
|
384
|
+
_proto.init = function init() {
|
|
385
|
+
var _this$canvasConfig = this.canvasConfig,
|
|
386
|
+
container = _this$canvasConfig.container,
|
|
387
|
+
doc = _this$canvasConfig.document,
|
|
388
|
+
devicePixelRatio = _this$canvasConfig.devicePixelRatio;
|
|
389
|
+
// create container
|
|
390
|
+
this.$container = isString(container) ? (doc || document).getElementById(container) : container;
|
|
391
|
+
if (this.$container) {
|
|
392
|
+
if (!this.$container.style.position) {
|
|
393
|
+
this.$container.style.position = 'relative';
|
|
394
|
+
}
|
|
395
|
+
var $namespace = createSVGElement('svg', doc);
|
|
396
|
+
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
397
|
+
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
398
|
+
this.$container.appendChild($namespace);
|
|
399
|
+
this.$namespace = $namespace;
|
|
414
400
|
}
|
|
415
|
-
|
|
416
|
-
|
|
401
|
+
// use user-defined dpr first
|
|
402
|
+
var dpr = devicePixelRatio || isBrowser && window.devicePixelRatio || 1;
|
|
403
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
404
|
+
this.dpr = dpr;
|
|
405
|
+
}
|
|
406
|
+
// @ts-ignore
|
|
417
407
|
;
|
|
418
408
|
_proto.getDomElement = function getDomElement() {
|
|
419
409
|
return this.$namespace;
|
|
@@ -469,11 +459,11 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
469
459
|
}).join('') + "}" + (selector + " {animation: " + animationName + " " + duration + "ms " + easing + " " + delay + "ms " + (iterations === Infinity ? 'infinite' : iterations) + " " + direction + " " + fill + ";}");
|
|
470
460
|
};
|
|
471
461
|
_proto.toDataURL = /*#__PURE__*/function () {
|
|
472
|
-
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
462
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
473
463
|
var _this = this;
|
|
474
464
|
var cloneNode, doc, animationCounter, $style, svgDocType, svgDoc;
|
|
475
|
-
return _regeneratorRuntime().wrap(function
|
|
476
|
-
while (1) switch (
|
|
465
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
466
|
+
while (1) switch (_context.prev = _context.next) {
|
|
477
467
|
case 0:
|
|
478
468
|
cloneNode = this.$namespace.cloneNode(true);
|
|
479
469
|
doc = this.canvasConfig.document;
|
|
@@ -574,12 +564,12 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
574
564
|
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
575
565
|
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
576
566
|
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
577
|
-
return
|
|
567
|
+
return _context.abrupt("return", "data:image/svg+xml;charset=utf8," + encodeURIComponent(new XMLSerializer().serializeToString(svgDoc)));
|
|
578
568
|
case 10:
|
|
579
569
|
case "end":
|
|
580
|
-
return
|
|
570
|
+
return _context.stop();
|
|
581
571
|
}
|
|
582
|
-
},
|
|
572
|
+
}, _callee, this);
|
|
583
573
|
}));
|
|
584
574
|
function toDataURL(_x) {
|
|
585
575
|
return _toDataURL.apply(this, arguments);
|
package/dist/index.js
CHANGED
|
@@ -403,39 +403,29 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
403
403
|
this.canvasConfig = context.config;
|
|
404
404
|
}
|
|
405
405
|
var _proto = SVGContextService.prototype;
|
|
406
|
-
_proto.init =
|
|
407
|
-
var
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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);
|
|
406
|
+
_proto.init = function init() {
|
|
407
|
+
var _this$canvasConfig = this.canvasConfig,
|
|
408
|
+
container = _this$canvasConfig.container,
|
|
409
|
+
doc = _this$canvasConfig.document,
|
|
410
|
+
devicePixelRatio = _this$canvasConfig.devicePixelRatio;
|
|
411
|
+
// create container
|
|
412
|
+
this.$container = util.isString(container) ? (doc || document).getElementById(container) : container;
|
|
413
|
+
if (this.$container) {
|
|
414
|
+
if (!this.$container.style.position) {
|
|
415
|
+
this.$container.style.position = 'relative';
|
|
416
|
+
}
|
|
417
|
+
var $namespace = SVGRenderer.createSVGElement('svg', doc);
|
|
418
|
+
$namespace.setAttribute('width', "" + this.canvasConfig.width);
|
|
419
|
+
$namespace.setAttribute('height', "" + this.canvasConfig.height);
|
|
420
|
+
this.$container.appendChild($namespace);
|
|
421
|
+
this.$namespace = $namespace;
|
|
436
422
|
}
|
|
437
|
-
|
|
438
|
-
|
|
423
|
+
// use user-defined dpr first
|
|
424
|
+
var dpr = devicePixelRatio || gLite.isBrowser && window.devicePixelRatio || 1;
|
|
425
|
+
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
|
|
426
|
+
this.dpr = dpr;
|
|
427
|
+
}
|
|
428
|
+
// @ts-ignore
|
|
439
429
|
;
|
|
440
430
|
_proto.getDomElement = function getDomElement() {
|
|
441
431
|
return this.$namespace;
|
|
@@ -491,11 +481,11 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
491
481
|
}).join('') + "}" + (selector + " {animation: " + animationName + " " + duration + "ms " + easing + " " + delay + "ms " + (iterations === Infinity ? 'infinite' : iterations) + " " + direction + " " + fill + ";}");
|
|
492
482
|
};
|
|
493
483
|
_proto.toDataURL = /*#__PURE__*/function () {
|
|
494
|
-
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
484
|
+
var _toDataURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(options) {
|
|
495
485
|
var _this = this;
|
|
496
486
|
var cloneNode, doc, animationCounter, $style, svgDocType, svgDoc;
|
|
497
|
-
return _regeneratorRuntime().wrap(function
|
|
498
|
-
while (1) switch (
|
|
487
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
488
|
+
while (1) switch (_context.prev = _context.next) {
|
|
499
489
|
case 0:
|
|
500
490
|
cloneNode = this.$namespace.cloneNode(true);
|
|
501
491
|
doc = this.canvasConfig.document;
|
|
@@ -596,12 +586,12 @@ var SVGContextService = /*#__PURE__*/function () {
|
|
|
596
586
|
svgDocType = document.implementation.createDocumentType('svg', '-//W3C//DTD SVG 1.1//EN', 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd');
|
|
597
587
|
svgDoc = document.implementation.createDocument('http://www.w3.org/2000/svg', 'svg', svgDocType);
|
|
598
588
|
svgDoc.replaceChild(cloneNode, svgDoc.documentElement);
|
|
599
|
-
return
|
|
589
|
+
return _context.abrupt("return", "data:image/svg+xml;charset=utf8," + encodeURIComponent(new XMLSerializer().serializeToString(svgDoc)));
|
|
600
590
|
case 10:
|
|
601
591
|
case "end":
|
|
602
|
-
return
|
|
592
|
+
return _context.stop();
|
|
603
593
|
}
|
|
604
|
-
},
|
|
594
|
+
}, _callee, this);
|
|
605
595
|
}));
|
|
606
596
|
function toDataURL(_x) {
|
|
607
597
|
return _toDataURL.apply(this, arguments);
|