@antv/g-plugin-dom-interaction
Advanced tools
Comparing version 1.0.0-alpha.24 to 1.0.0-alpha.25
import { RendererPlugin } from '@antv/g'; | ||
import { Container } from 'inversify'; | ||
import { Syringe } from 'mana-syringe'; | ||
export declare class Plugin implements RendererPlugin { | ||
init(container: Container): void; | ||
destroy(container: Container): void; | ||
init(container: Syringe.Container): void; | ||
destroy(container: Syringe.Container): void; | ||
} |
@@ -0,1 +1,2 @@ | ||
import { inject, singleton, Module } from 'mana-syringe'; | ||
import { ContextService, RenderingPluginContribution } from '@antv/g'; | ||
@@ -25,163 +26,2 @@ | ||
var NAMED_TAG = "named"; | ||
var INJECT_TAG = "inject"; | ||
var TAGGED = "inversify:tagged"; | ||
var TAGGED_PROP = "inversify:tagged_props"; | ||
var PARAM_TYPES = "inversify:paramtypes"; | ||
var DESIGN_PARAM_TYPES = "design:paramtypes"; | ||
var idCounter = 0; | ||
function id() { | ||
return idCounter++; | ||
} | ||
var DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times."; | ||
var DUPLICATED_METADATA = "Metadata key was used more than once in a parameter:"; | ||
var UNDEFINED_INJECT_ANNOTATION = function (name) { | ||
return "@inject called with undefined this could mean that the class " + name + " has " + | ||
"a circular dependency problem. You can use a LazyServiceIdentifer to " + | ||
"overcome this limitation."; | ||
}; | ||
var INVALID_DECORATOR_OPERATION = "The @inject @multiInject @tagged and @named decorators " + | ||
"must be applied to the parameters of a class constructor or a class property."; | ||
var Metadata = (function () { | ||
function Metadata(key, value) { | ||
this.key = key; | ||
this.value = value; | ||
} | ||
Metadata.prototype.toString = function () { | ||
if (this.key === NAMED_TAG) { | ||
return "named: " + this.value.toString() + " "; | ||
} | ||
else { | ||
return "tagged: { key:" + this.key.toString() + ", value: " + this.value + " }"; | ||
} | ||
}; | ||
return Metadata; | ||
}()); | ||
function tagParameter(annotationTarget, propertyName, parameterIndex, metadata) { | ||
var metadataKey = TAGGED; | ||
_tagParameterOrProperty(metadataKey, annotationTarget, propertyName, metadata, parameterIndex); | ||
} | ||
function tagProperty(annotationTarget, propertyName, metadata) { | ||
var metadataKey = TAGGED_PROP; | ||
_tagParameterOrProperty(metadataKey, annotationTarget.constructor, propertyName, metadata); | ||
} | ||
function _tagParameterOrProperty(metadataKey, annotationTarget, propertyName, metadata, parameterIndex) { | ||
var paramsOrPropertiesMetadata = {}; | ||
var isParameterDecorator = (typeof parameterIndex === "number"); | ||
var key = (parameterIndex !== undefined && isParameterDecorator) ? parameterIndex.toString() : propertyName; | ||
if (isParameterDecorator && propertyName !== undefined) { | ||
throw new Error(INVALID_DECORATOR_OPERATION); | ||
} | ||
if (Reflect.hasOwnMetadata(metadataKey, annotationTarget)) { | ||
paramsOrPropertiesMetadata = Reflect.getMetadata(metadataKey, annotationTarget); | ||
} | ||
var paramOrPropertyMetadata = paramsOrPropertiesMetadata[key]; | ||
if (!Array.isArray(paramOrPropertyMetadata)) { | ||
paramOrPropertyMetadata = []; | ||
} | ||
else { | ||
for (var _i = 0, paramOrPropertyMetadata_1 = paramOrPropertyMetadata; _i < paramOrPropertyMetadata_1.length; _i++) { | ||
var m = paramOrPropertyMetadata_1[_i]; | ||
if (m.key === metadata.key) { | ||
throw new Error(DUPLICATED_METADATA + " " + m.key.toString()); | ||
} | ||
} | ||
} | ||
paramOrPropertyMetadata.push(metadata); | ||
paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata; | ||
Reflect.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget); | ||
} | ||
function inject(serviceIdentifier) { | ||
return function (target, targetKey, index) { | ||
if (serviceIdentifier === undefined) { | ||
throw new Error(UNDEFINED_INJECT_ANNOTATION(target.name)); | ||
} | ||
var metadata = new Metadata(INJECT_TAG, serviceIdentifier); | ||
if (typeof index === "number") { | ||
tagParameter(target, targetKey, index, metadata); | ||
} | ||
else { | ||
tagProperty(target, targetKey, metadata); | ||
} | ||
}; | ||
} | ||
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (undefined && undefined.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
var ContainerModule = (function () { | ||
function ContainerModule(registry) { | ||
this.id = id(); | ||
this.registry = registry; | ||
} | ||
return ContainerModule; | ||
}()); | ||
function injectable() { | ||
return function (target) { | ||
if (Reflect.hasOwnMetadata(PARAM_TYPES, target)) { | ||
throw new Error(DUPLICATED_INJECTABLE_DECORATOR); | ||
} | ||
var types = Reflect.getMetadata(DESIGN_PARAM_TYPES, target) || []; | ||
Reflect.defineMetadata(PARAM_TYPES, types, target); | ||
return target; | ||
}; | ||
} | ||
/*! ***************************************************************************** | ||
@@ -327,7 +167,8 @@ Copyright (c) Microsoft Corporation. | ||
DOMInteractionPlugin = DOMInteractionPlugin_1 = __decorate([injectable()], DOMInteractionPlugin); | ||
DOMInteractionPlugin = DOMInteractionPlugin_1 = __decorate([singleton({ | ||
contrib: RenderingPluginContribution | ||
})], DOMInteractionPlugin); | ||
var containerModule = new ContainerModule(function (bind, unbind, isBound, rebind) { | ||
bind(DOMInteractionPlugin).toSelf().inSingletonScope(); | ||
bind(RenderingPluginContribution).toService(DOMInteractionPlugin); | ||
var containerModule = Module(function (register) { | ||
register(DOMInteractionPlugin); | ||
}); | ||
@@ -346,4 +187,6 @@ var Plugin = /*#__PURE__*/function () { | ||
key: "destroy", | ||
value: function destroy(container) { | ||
container.unload(containerModule); | ||
value: function destroy(container) {// @ts-ignore | ||
// container.container.unload(containerModule); | ||
// // container.unload(containerModule); | ||
// container.remove(DOMInteractionPlugin); | ||
} | ||
@@ -350,0 +193,0 @@ }]); |
@@ -5,2 +5,3 @@ 'use strict'; | ||
var manaSyringe = require('mana-syringe'); | ||
var g = require('@antv/g'); | ||
@@ -30,163 +31,2 @@ | ||
var NAMED_TAG = "named"; | ||
var INJECT_TAG = "inject"; | ||
var TAGGED = "inversify:tagged"; | ||
var TAGGED_PROP = "inversify:tagged_props"; | ||
var PARAM_TYPES = "inversify:paramtypes"; | ||
var DESIGN_PARAM_TYPES = "design:paramtypes"; | ||
var idCounter = 0; | ||
function id() { | ||
return idCounter++; | ||
} | ||
var DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times."; | ||
var DUPLICATED_METADATA = "Metadata key was used more than once in a parameter:"; | ||
var UNDEFINED_INJECT_ANNOTATION = function (name) { | ||
return "@inject called with undefined this could mean that the class " + name + " has " + | ||
"a circular dependency problem. You can use a LazyServiceIdentifer to " + | ||
"overcome this limitation."; | ||
}; | ||
var INVALID_DECORATOR_OPERATION = "The @inject @multiInject @tagged and @named decorators " + | ||
"must be applied to the parameters of a class constructor or a class property."; | ||
var Metadata = (function () { | ||
function Metadata(key, value) { | ||
this.key = key; | ||
this.value = value; | ||
} | ||
Metadata.prototype.toString = function () { | ||
if (this.key === NAMED_TAG) { | ||
return "named: " + this.value.toString() + " "; | ||
} | ||
else { | ||
return "tagged: { key:" + this.key.toString() + ", value: " + this.value + " }"; | ||
} | ||
}; | ||
return Metadata; | ||
}()); | ||
function tagParameter(annotationTarget, propertyName, parameterIndex, metadata) { | ||
var metadataKey = TAGGED; | ||
_tagParameterOrProperty(metadataKey, annotationTarget, propertyName, metadata, parameterIndex); | ||
} | ||
function tagProperty(annotationTarget, propertyName, metadata) { | ||
var metadataKey = TAGGED_PROP; | ||
_tagParameterOrProperty(metadataKey, annotationTarget.constructor, propertyName, metadata); | ||
} | ||
function _tagParameterOrProperty(metadataKey, annotationTarget, propertyName, metadata, parameterIndex) { | ||
var paramsOrPropertiesMetadata = {}; | ||
var isParameterDecorator = (typeof parameterIndex === "number"); | ||
var key = (parameterIndex !== undefined && isParameterDecorator) ? parameterIndex.toString() : propertyName; | ||
if (isParameterDecorator && propertyName !== undefined) { | ||
throw new Error(INVALID_DECORATOR_OPERATION); | ||
} | ||
if (Reflect.hasOwnMetadata(metadataKey, annotationTarget)) { | ||
paramsOrPropertiesMetadata = Reflect.getMetadata(metadataKey, annotationTarget); | ||
} | ||
var paramOrPropertyMetadata = paramsOrPropertiesMetadata[key]; | ||
if (!Array.isArray(paramOrPropertyMetadata)) { | ||
paramOrPropertyMetadata = []; | ||
} | ||
else { | ||
for (var _i = 0, paramOrPropertyMetadata_1 = paramOrPropertyMetadata; _i < paramOrPropertyMetadata_1.length; _i++) { | ||
var m = paramOrPropertyMetadata_1[_i]; | ||
if (m.key === metadata.key) { | ||
throw new Error(DUPLICATED_METADATA + " " + m.key.toString()); | ||
} | ||
} | ||
} | ||
paramOrPropertyMetadata.push(metadata); | ||
paramsOrPropertiesMetadata[key] = paramOrPropertyMetadata; | ||
Reflect.defineMetadata(metadataKey, paramsOrPropertiesMetadata, annotationTarget); | ||
} | ||
function inject(serviceIdentifier) { | ||
return function (target, targetKey, index) { | ||
if (serviceIdentifier === undefined) { | ||
throw new Error(UNDEFINED_INJECT_ANNOTATION(target.name)); | ||
} | ||
var metadata = new Metadata(INJECT_TAG, serviceIdentifier); | ||
if (typeof index === "number") { | ||
tagParameter(target, targetKey, index, metadata); | ||
} | ||
else { | ||
tagProperty(target, targetKey, metadata); | ||
} | ||
}; | ||
} | ||
var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
var __spreadArray$1 = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (undefined && undefined.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (_) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var __spreadArray$2 = (undefined && undefined.__spreadArray) || function (to, from) { | ||
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) | ||
to[j] = from[i]; | ||
return to; | ||
}; | ||
var ContainerModule = (function () { | ||
function ContainerModule(registry) { | ||
this.id = id(); | ||
this.registry = registry; | ||
} | ||
return ContainerModule; | ||
}()); | ||
function injectable() { | ||
return function (target) { | ||
if (Reflect.hasOwnMetadata(PARAM_TYPES, target)) { | ||
throw new Error(DUPLICATED_INJECTABLE_DECORATOR); | ||
} | ||
var types = Reflect.getMetadata(DESIGN_PARAM_TYPES, target) || []; | ||
Reflect.defineMetadata(PARAM_TYPES, types, target); | ||
return target; | ||
}; | ||
} | ||
/*! ***************************************************************************** | ||
@@ -330,9 +170,10 @@ Copyright (c) Microsoft Corporation. | ||
__decorate([inject(g.ContextService), __metadata("design:type", Object)], DOMInteractionPlugin.prototype, "contextService", void 0); | ||
__decorate([manaSyringe.inject(g.ContextService), __metadata("design:type", Object)], DOMInteractionPlugin.prototype, "contextService", void 0); | ||
DOMInteractionPlugin = DOMInteractionPlugin_1 = __decorate([injectable()], DOMInteractionPlugin); | ||
DOMInteractionPlugin = DOMInteractionPlugin_1 = __decorate([manaSyringe.singleton({ | ||
contrib: g.RenderingPluginContribution | ||
})], DOMInteractionPlugin); | ||
var containerModule = new ContainerModule(function (bind, unbind, isBound, rebind) { | ||
bind(DOMInteractionPlugin).toSelf().inSingletonScope(); | ||
bind(g.RenderingPluginContribution).toService(DOMInteractionPlugin); | ||
var containerModule = manaSyringe.Module(function (register) { | ||
register(DOMInteractionPlugin); | ||
}); | ||
@@ -351,4 +192,6 @@ var Plugin = /*#__PURE__*/function () { | ||
key: "destroy", | ||
value: function destroy(container) { | ||
container.unload(containerModule); | ||
value: function destroy(container) {// @ts-ignore | ||
// container.container.unload(containerModule); | ||
// // container.unload(containerModule); | ||
// container.remove(DOMInteractionPlugin); | ||
} | ||
@@ -355,0 +198,0 @@ }]); |
{ | ||
"name": "@antv/g-plugin-dom-interaction", | ||
"version": "1.0.0-alpha.24", | ||
"version": "1.0.0-alpha.25", | ||
"description": "A G plugin", | ||
@@ -32,3 +32,4 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@antv/g": "^1.0.0-alpha.25" | ||
"@antv/g": "^1.0.0-alpha.26", | ||
"mana-syringe": "^0.1.0" | ||
}, | ||
@@ -42,3 +43,3 @@ "devDependencies": { | ||
"homepage": "https://github.com/antvis/g#readme", | ||
"gitHead": "e2b8bc287c7faa181013d9e5df071ff97d702c94" | ||
"gitHead": "04974923388e3c1e3c47d591c251380058372376" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
1
0
1
17212
2
7
340
+ Addedmana-syringe@^0.1.0
+ Addeddebug@4.3.7(transitive)
+ Addedmana-syringe@0.1.0(transitive)
+ Addedms@2.1.3(transitive)
Updated@antv/g@^1.0.0-alpha.26