@antv/g-svg 1.1.2 → 1.1.3-alpha.0

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.
@@ -1,37 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ContextRegisterPlugin = void 0;
7
-
8
- var _manaSyringe = require("mana-syringe");
9
-
10
- var _SVGContextService = require("./SVGContextService");
11
-
12
- var containerModule = (0, _manaSyringe.Module)(function (register) {
13
- /**
14
- * implements ContextService
15
- */
16
- register(_SVGContextService.SVGContextService);
17
- });
18
-
19
- var ContextRegisterPlugin =
20
- /** @class */
21
- function () {
22
- function ContextRegisterPlugin() {
23
- this.name = 'svg-context-register';
24
- }
25
-
26
- ContextRegisterPlugin.prototype.init = function (container) {
27
- container.load(containerModule, true);
28
- };
29
-
30
- ContextRegisterPlugin.prototype.destroy = function (container) {
31
- container.unload(containerModule);
32
- };
33
-
34
- return ContextRegisterPlugin;
35
- }();
36
-
37
- exports.ContextRegisterPlugin = ContextRegisterPlugin;
@@ -1,89 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SVGContextService = void 0;
7
-
8
- var _tslib = require("tslib");
9
-
10
- var _g = require("@antv/g");
11
-
12
- var _manaSyringe = require("mana-syringe");
13
-
14
- var _gPluginSvgRenderer = require("@antv/g-plugin-svg-renderer");
15
-
16
- var SVGContextService =
17
- /** @class */
18
- function () {
19
- function SVGContextService() {}
20
-
21
- SVGContextService.prototype.init = function () {
22
- var container = this.canvasConfig.container; // create container
23
-
24
- this.$container = (0, _g.isString)(container) ? document.getElementById(container) : container;
25
-
26
- if (this.$container) {
27
- if (!this.$container.style.position) {
28
- this.$container.style.position = 'relative';
29
- }
30
-
31
- var $namespace = (0, _gPluginSvgRenderer.createSVGElement)('svg');
32
- $namespace.setAttribute('width', "".concat(this.canvasConfig.width));
33
- $namespace.setAttribute('height', "".concat(this.canvasConfig.height));
34
- this.$container.appendChild($namespace);
35
- this.$namespace = $namespace;
36
- }
37
-
38
- var dpr = window.devicePixelRatio || 1;
39
- dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
40
- this.dpr = dpr;
41
- }; // @ts-ignore
42
-
43
-
44
- SVGContextService.prototype.getDomElement = function () {
45
- return this.$namespace;
46
- };
47
-
48
- SVGContextService.prototype.getContext = function () {
49
- return this.$namespace;
50
- };
51
-
52
- SVGContextService.prototype.getDPR = function () {
53
- return this.dpr;
54
- };
55
-
56
- SVGContextService.prototype.getBoundingClientRect = function () {
57
- var _a;
58
-
59
- return (_a = this.$namespace) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
60
- };
61
-
62
- SVGContextService.prototype.destroy = function () {
63
- // destroy context
64
- if (this.$container && this.$namespace && this.$namespace.parentNode) {
65
- this.$container.removeChild(this.$namespace);
66
- }
67
- };
68
-
69
- SVGContextService.prototype.resize = function (width, height) {
70
- if (this.$namespace) {
71
- this.$namespace.setAttribute('width', "".concat(width));
72
- this.$namespace.setAttribute('height', "".concat(height));
73
- }
74
- };
75
-
76
- SVGContextService.prototype.applyCursorStyle = function (cursor) {
77
- if (this.$container) {
78
- this.$container.style.cursor = cursor;
79
- }
80
- };
81
-
82
- (0, _tslib.__decorate)([(0, _manaSyringe.inject)(_g.CanvasConfig), (0, _tslib.__metadata)("design:type", Object)], SVGContextService.prototype, "canvasConfig", void 0);
83
- SVGContextService = (0, _tslib.__decorate)([(0, _manaSyringe.singleton)({
84
- token: _g.ContextService
85
- })], SVGContextService);
86
- return SVGContextService;
87
- }();
88
-
89
- exports.SVGContextService = SVGContextService;
package/lib/index.js DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.SVGRenderer = exports.SVGPicker = exports.Renderer = exports.DomInteraction = void 0;
9
-
10
- var _tslib = require("tslib");
11
-
12
- var _g = require("@antv/g");
13
-
14
- var DomInteraction = _interopRequireWildcard(require("@antv/g-plugin-dom-interaction"));
15
-
16
- exports.DomInteraction = DomInteraction;
17
-
18
- var SVGRenderer = _interopRequireWildcard(require("@antv/g-plugin-svg-renderer"));
19
-
20
- exports.SVGRenderer = SVGRenderer;
21
-
22
- var SVGPicker = _interopRequireWildcard(require("@antv/g-plugin-svg-picker"));
23
-
24
- exports.SVGPicker = SVGPicker;
25
-
26
- var _ContextRegisterPlugin = require("./ContextRegisterPlugin");
27
-
28
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
-
30
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
-
32
- var Renderer =
33
- /** @class */
34
- function (_super) {
35
- (0, _tslib.__extends)(Renderer, _super);
36
-
37
- function Renderer(config) {
38
- var _this = _super.call(this, config) || this;
39
-
40
- _this.registerPlugin(new _ContextRegisterPlugin.ContextRegisterPlugin());
41
-
42
- _this.registerPlugin(new SVGRenderer.Plugin());
43
-
44
- _this.registerPlugin(new DomInteraction.Plugin());
45
-
46
- _this.registerPlugin(new SVGPicker.Plugin());
47
-
48
- return _this;
49
- }
50
-
51
- return Renderer;
52
- }(_g.AbstractRenderer);
53
-
54
- exports.Renderer = Renderer;