@antv/g-svg 1.0.0-alpha.24 → 1.0.0-alpha.28

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/lib/index.js CHANGED
@@ -1,22 +1,34 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
- exports.Renderer = void 0;
8
+ exports.SVGPicker = exports.SVGRenderer = exports.DomInteraction = exports.Renderer = void 0;
7
9
 
8
10
  var _tslib = require("tslib");
9
11
 
10
12
  var _g = require("@antv/g");
11
13
 
12
- var _gPluginDomInteraction = require("@antv/g-plugin-dom-interaction");
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"));
13
19
 
14
- var _gPluginSvgRenderer = require("@antv/g-plugin-svg-renderer");
20
+ exports.SVGRenderer = SVGRenderer;
15
21
 
16
- var _gPluginSvgPicker = require("@antv/g-plugin-svg-picker");
22
+ var SVGPicker = _interopRequireWildcard(require("@antv/g-plugin-svg-picker"));
23
+
24
+ exports.SVGPicker = SVGPicker;
17
25
 
18
26
  var _ContextRegisterPlugin = require("./ContextRegisterPlugin");
19
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
+
20
32
  var Renderer = function (_super) {
21
33
  (0, _tslib.__extends)(Renderer, _super);
22
34
 
@@ -25,11 +37,11 @@ var Renderer = function (_super) {
25
37
 
26
38
  _this.registerPlugin(new _ContextRegisterPlugin.ContextRegisterPlugin());
27
39
 
28
- _this.registerPlugin(new _gPluginSvgRenderer.Plugin());
40
+ _this.registerPlugin(new SVGRenderer.Plugin());
29
41
 
30
- _this.registerPlugin(new _gPluginDomInteraction.Plugin());
42
+ _this.registerPlugin(new DomInteraction.Plugin());
31
43
 
32
- _this.registerPlugin(new _gPluginSvgPicker.Plugin());
44
+ _this.registerPlugin(new SVGPicker.Plugin());
33
45
 
34
46
  return _this;
35
47
  }
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "@antv/g-svg",
3
- "version": "1.0.0-alpha.24",
3
+ "version": "1.0.0-alpha.28",
4
4
  "description": "A renderer implemented by SVG",
5
5
  "main": "lib/index.js",
6
- "module": "es/index.js",
7
- "types": "lib/index.d.ts",
6
+ "module": "es/index.esm.js",
7
+ "types": "es/index.d.ts",
8
8
  "files": [
9
9
  "package.json",
10
- "es",
11
- "lib",
12
10
  "dist",
13
11
  "LICENSE",
14
12
  "README.md"
@@ -39,11 +37,19 @@
39
37
  },
40
38
  "homepage": "https://github.com/antvis/g#readme",
41
39
  "dependencies": {
42
- "@antv/g": "^1.0.0-alpha.24",
43
- "@antv/g-plugin-dom-interaction": "^1.0.0-alpha.23",
44
- "@antv/g-plugin-svg-picker": "^1.0.0-alpha.23",
45
- "@antv/g-plugin-svg-renderer": "^1.0.0-alpha.24",
46
- "@antv/util": "^2.0.13"
40
+ "@antv/g": "^1.0.0-alpha.28",
41
+ "@antv/g-plugin-dom-interaction": "^1.0.0-alpha.27",
42
+ "@antv/g-plugin-svg-picker": "^1.0.0-alpha.27",
43
+ "@antv/g-plugin-svg-renderer": "^1.0.0-alpha.28",
44
+ "@antv/util": "^2.0.13",
45
+ "mana-syringe": "^0.2.1"
47
46
  },
48
- "gitHead": "fb9ebf362059d1f55a855856f05d42514a72c922"
47
+ "peerDependencies": {
48
+ "@antv/g": "^1.0.0-alpha.27",
49
+ "mana-syringe": "^0.2.1"
50
+ },
51
+ "scripts": {
52
+ "umd": "webpack"
53
+ },
54
+ "gitHead": "b8af919853fa578b4aa6c5e84715948085ac0170"
49
55
  }
@@ -1,6 +0,0 @@
1
- import { Container } from 'inversify';
2
- import { RendererPlugin } from '@antv/g';
3
- export declare class ContextRegisterPlugin implements RendererPlugin {
4
- init(container: Container): void;
5
- destroy(container: Container): void;
6
- }
@@ -1,26 +0,0 @@
1
- import { ContainerModule } from 'inversify';
2
- import { ContextService } from '@antv/g';
3
- import { SVGContextService } from './SVGContextService';
4
- var containerModule = new ContainerModule(function (bind, unbind, isBound, rebind) {
5
- /**
6
- * implements ContextService
7
- */
8
- bind(SVGContextService).toSelf().inSingletonScope();
9
- bind(ContextService).toService(SVGContextService);
10
- });
11
-
12
- var ContextRegisterPlugin = function () {
13
- function ContextRegisterPlugin() {}
14
-
15
- ContextRegisterPlugin.prototype.init = function (container) {
16
- container.load(containerModule);
17
- };
18
-
19
- ContextRegisterPlugin.prototype.destroy = function (container) {
20
- container.unload(containerModule);
21
- };
22
-
23
- return ContextRegisterPlugin;
24
- }();
25
-
26
- export { ContextRegisterPlugin };
@@ -1,15 +0,0 @@
1
- import { ContextService } from '@antv/g';
2
- export declare class SVGContextService implements ContextService<SVGElement> {
3
- private $container;
4
- private $namespace;
5
- private dpr;
6
- private canvasConfig;
7
- init(): void;
8
- getDomElement(): SVGElement;
9
- getContext(): SVGElement;
10
- getDPR(): number;
11
- getBoundingClientRect(): DOMRect;
12
- destroy(): void;
13
- resize(width: number, height: number): void;
14
- applyCursorStyle(cursor: string): void;
15
- }
@@ -1,77 +0,0 @@
1
- import { __decorate, __metadata } from "tslib";
2
- import { CanvasConfig } from '@antv/g';
3
- import { inject, injectable } from 'inversify';
4
- import { isString } from '@antv/util';
5
- import { createSVGElement } from '@antv/g-plugin-svg-renderer';
6
-
7
- var SVGContextService = function () {
8
- function SVGContextService() {}
9
-
10
- SVGContextService.prototype.init = function () {
11
- var container = this.canvasConfig.container; // create container
12
-
13
- this.$container = isString(container) ? document.getElementById(container) : container;
14
-
15
- if (this.$container) {
16
- if (!this.$container.style.position) {
17
- this.$container.style.position = 'relative';
18
- }
19
-
20
- var $namespace = createSVGElement('svg');
21
- $namespace.setAttribute('width', "" + this.canvasConfig.width);
22
- $namespace.setAttribute('height', "" + this.canvasConfig.height);
23
- this.$container.appendChild($namespace);
24
- this.$namespace = $namespace;
25
- }
26
-
27
- var dpr = window.devicePixelRatio || 1;
28
- dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
29
- this.dpr = dpr;
30
- }; // @ts-ignore
31
-
32
-
33
- SVGContextService.prototype.getDomElement = function () {
34
- return this.$namespace;
35
- };
36
-
37
- SVGContextService.prototype.getContext = function () {
38
- return this.$namespace;
39
- };
40
-
41
- SVGContextService.prototype.getDPR = function () {
42
- return this.dpr;
43
- };
44
-
45
- SVGContextService.prototype.getBoundingClientRect = function () {
46
- var _a;
47
-
48
- return (_a = this.$namespace) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
49
- };
50
-
51
- SVGContextService.prototype.destroy = function () {
52
- // destroy context
53
- if (this.$container && this.$namespace && this.$namespace.parentNode) {
54
- this.$container.removeChild(this.$namespace);
55
- }
56
- };
57
-
58
- SVGContextService.prototype.resize = function (width, height) {
59
- if (this.$namespace) {
60
- this.$namespace.setAttribute('width', "" + width);
61
- this.$namespace.setAttribute('height', "" + height);
62
- }
63
- };
64
-
65
- SVGContextService.prototype.applyCursorStyle = function (cursor) {
66
- if (this.$container) {
67
- this.$container.style.cursor = cursor;
68
- }
69
- };
70
-
71
- __decorate([inject(CanvasConfig), __metadata("design:type", Object)], SVGContextService.prototype, "canvasConfig", void 0);
72
-
73
- SVGContextService = __decorate([injectable()], SVGContextService);
74
- return SVGContextService;
75
- }();
76
-
77
- export { SVGContextService };
package/es/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { AbstractRenderer, RendererConfig } from '@antv/g';
2
- export declare class Renderer extends AbstractRenderer {
3
- constructor(config?: Partial<RendererConfig>);
4
- }
package/es/index.js DELETED
@@ -1,28 +0,0 @@
1
- import { __extends } from "tslib";
2
- import { AbstractRenderer } from '@antv/g';
3
- import { Plugin as DomInteractionPlugin } from '@antv/g-plugin-dom-interaction';
4
- import { Plugin as SvgRendererPlugin } from '@antv/g-plugin-svg-renderer';
5
- import { Plugin as SvgPickerPlugin } from '@antv/g-plugin-svg-picker';
6
- import { ContextRegisterPlugin } from './ContextRegisterPlugin';
7
-
8
- var Renderer = function (_super) {
9
- __extends(Renderer, _super);
10
-
11
- function Renderer(config) {
12
- var _this = _super.call(this, config) || this;
13
-
14
- _this.registerPlugin(new ContextRegisterPlugin());
15
-
16
- _this.registerPlugin(new SvgRendererPlugin());
17
-
18
- _this.registerPlugin(new DomInteractionPlugin());
19
-
20
- _this.registerPlugin(new SvgPickerPlugin());
21
-
22
- return _this;
23
- }
24
-
25
- return Renderer;
26
- }(AbstractRenderer);
27
-
28
- export { Renderer };
@@ -1,6 +0,0 @@
1
- export declare function parseRadius(radius: number[]): {
2
- r1: number;
3
- r2: number;
4
- r3: number;
5
- r4: number;
6
- };
@@ -1,34 +0,0 @@
1
- import { isArray } from '@antv/util';
2
- export function parseRadius(radius) {
3
- var r1 = 0;
4
- var r2 = 0;
5
- var r3 = 0;
6
- var r4 = 0;
7
-
8
- if (isArray(radius)) {
9
- if (radius.length === 1) {
10
- r1 = r2 = r3 = r4 = radius[0];
11
- } else if (radius.length === 2) {
12
- r1 = r3 = radius[0];
13
- r2 = r4 = radius[1];
14
- } else if (radius.length === 3) {
15
- r1 = radius[0];
16
- r2 = r4 = radius[1];
17
- r3 = radius[2];
18
- } else {
19
- r1 = radius[0];
20
- r2 = radius[1];
21
- r3 = radius[2];
22
- r4 = radius[3];
23
- }
24
- } else {
25
- r1 = r2 = r3 = r4 = radius;
26
- }
27
-
28
- return {
29
- r1: r1,
30
- r2: r2,
31
- r3: r3,
32
- r4: r4
33
- };
34
- }
@@ -1,6 +0,0 @@
1
- import { Container } from 'inversify';
2
- import { RendererPlugin } from '@antv/g';
3
- export declare class ContextRegisterPlugin implements RendererPlugin {
4
- init(container: Container): void;
5
- destroy(container: Container): void;
6
- }
@@ -1,36 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.ContextRegisterPlugin = void 0;
7
-
8
- var _inversify = require("inversify");
9
-
10
- var _g = require("@antv/g");
11
-
12
- var _SVGContextService = require("./SVGContextService");
13
-
14
- var containerModule = new _inversify.ContainerModule(function (bind, unbind, isBound, rebind) {
15
- /**
16
- * implements ContextService
17
- */
18
- bind(_SVGContextService.SVGContextService).toSelf().inSingletonScope();
19
- bind(_g.ContextService).toService(_SVGContextService.SVGContextService);
20
- });
21
-
22
- var ContextRegisterPlugin = function () {
23
- function ContextRegisterPlugin() {}
24
-
25
- ContextRegisterPlugin.prototype.init = function (container) {
26
- container.load(containerModule);
27
- };
28
-
29
- ContextRegisterPlugin.prototype.destroy = function (container) {
30
- container.unload(containerModule);
31
- };
32
-
33
- return ContextRegisterPlugin;
34
- }();
35
-
36
- exports.ContextRegisterPlugin = ContextRegisterPlugin;
@@ -1,15 +0,0 @@
1
- import { ContextService } from '@antv/g';
2
- export declare class SVGContextService implements ContextService<SVGElement> {
3
- private $container;
4
- private $namespace;
5
- private dpr;
6
- private canvasConfig;
7
- init(): void;
8
- getDomElement(): SVGElement;
9
- getContext(): SVGElement;
10
- getDPR(): number;
11
- getBoundingClientRect(): DOMRect;
12
- destroy(): void;
13
- resize(width: number, height: number): void;
14
- applyCursorStyle(cursor: string): void;
15
- }
@@ -1,87 +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 _inversify = require("inversify");
13
-
14
- var _util = require("@antv/util");
15
-
16
- var _gPluginSvgRenderer = require("@antv/g-plugin-svg-renderer");
17
-
18
- var SVGContextService = function () {
19
- function SVGContextService() {}
20
-
21
- SVGContextService.prototype.init = function () {
22
- var container = this.canvasConfig.container; // create container
23
-
24
- this.$container = (0, _util.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', "" + this.canvasConfig.width);
33
- $namespace.setAttribute('height', "" + 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', "" + width);
72
- this.$namespace.setAttribute('height', "" + 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, _inversify.inject)(_g.CanvasConfig), (0, _tslib.__metadata)("design:type", Object)], SVGContextService.prototype, "canvasConfig", void 0);
83
- SVGContextService = (0, _tslib.__decorate)([(0, _inversify.injectable)()], SVGContextService);
84
- return SVGContextService;
85
- }();
86
-
87
- exports.SVGContextService = SVGContextService;
package/lib/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import { AbstractRenderer, RendererConfig } from '@antv/g';
2
- export declare class Renderer extends AbstractRenderer {
3
- constructor(config?: Partial<RendererConfig>);
4
- }
@@ -1,6 +0,0 @@
1
- export declare function parseRadius(radius: number[]): {
2
- r1: number;
3
- r2: number;
4
- r3: number;
5
- r4: number;
6
- };
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.parseRadius = parseRadius;
7
-
8
- var _util = require("@antv/util");
9
-
10
- function parseRadius(radius) {
11
- var r1 = 0;
12
- var r2 = 0;
13
- var r3 = 0;
14
- var r4 = 0;
15
-
16
- if ((0, _util.isArray)(radius)) {
17
- if (radius.length === 1) {
18
- r1 = r2 = r3 = r4 = radius[0];
19
- } else if (radius.length === 2) {
20
- r1 = r3 = radius[0];
21
- r2 = r4 = radius[1];
22
- } else if (radius.length === 3) {
23
- r1 = radius[0];
24
- r2 = r4 = radius[1];
25
- r3 = radius[2];
26
- } else {
27
- r1 = radius[0];
28
- r2 = radius[1];
29
- r3 = radius[2];
30
- r4 = radius[3];
31
- }
32
- } else {
33
- r1 = r2 = r3 = r4 = radius;
34
- }
35
-
36
- return {
37
- r1: r1,
38
- r2: r2,
39
- r3: r3,
40
- r4: r4
41
- };
42
- }