// npm package
@antv/g-mobile-canvas-element
Create a CanvasLike element from existed context in mobile environment
versions
162
maintainers
51
license
MIT
first publish
2022-05-27
publisher
alex_zjt
tarball
51,037 B
AUTO-PUBLISHED·1 version indexed·latest published 2025-12-15
// publisher campaignby alex_zjt
9 caught packages from this accountThis is not an isolated catch. The same publisher has shipped 8 other packages that our pipeline flagged — the shape of a coordinated campaign, not a one-off. Each link below opens that sibling's analysis.
// offending code· @1.0.39-beta.0· 1 file flagged
llm: benign · 0.85→ No suspicious destination, no remote-exec shape — 2 known-vendor host(s), 1 other host(s).
- @1.0.39-beta.0··AUTO-PUBLISHED·publisher: alex_zjtheuristic 75/100static flags 1llm benign (0.85) via ollamamature-packageosv-flagged:MAL-2026-3926public-github-push
→ No suspicious destination, no remote-exec shape — 2 known-vendor host(s), 1 other host(s).
// offending code· 1 file flaggedpatterns: 1
--- package/package.json (excerpt) --- { "name": "@antv/g-mobile-canvas-element", "version": "1.0.39-beta.0", "description": "Create a CanvasLike element from existed context in mobile environment", "keywords": [ "antv", "g" ], "homepage": "https://github.com/antvis/g#readme", "bugs": { "url": "https://github.com/antvis/g/issues" }, "repository": { "type": "git", "url": "git+https://github.com/antvis/g.git" }, "license": "MIT", "author": "https://github.com/orgs/antvis/people", "exports": { "types": "./types/index.d.ts", "import": "./dist/index.esm.js", "default": "./dist/index.js" }, "main": "dist/index.js", "unpkg": "dist/index.umd.min.js", "module": "dist/index.esm.js", "types": "types/index.d.ts", "files": [ "package.json", "dist", "types", "LICENSE", "README.md" ], "dependencies": { "@babel/runtime": "^7.25.6", "eventemitter3": "^5.0.1", "tslib": "^2.5.3", "@antv/g-lite": "2.3.3-beta.2" }, "publishConfig": { "access": "public" }, "gitHead": "89a517f161e783e64278a4f0d800850db6b5b420", "scripts": { "build:types": "tsc --emitDeclarationOnly --noCheck", "build": "npm run clean && npm run build:types && rollup -c", "clean": "rimraf dist", "sync": "tnpm sync", "watch": "rollup -c -w" } } --- package.json (entry) --- { "name": "@antv/g-mobile-canvas-element", "version": "1.0.39-beta.0", "description": "Create a CanvasLike element from existed context in mobile environment", "keywords": [ "antv", "g" ], "homepage": "https://github.com/antvis/g#readme", "bugs": { "url": "https://github.com/antvis/g/issues" }, "repository": { "type": "git", "url": "git+https://github.com/antvis/g.git" }, "license": "MIT", "author": "https://github.com/orgs/antvis/people", "exports": { "types": "./types/index.d.ts", "import": "./dist/index.esm.js", "default": "./dist/index.js" }, "main": "dist/index.js", "unpkg": "dist/index.umd.min.js", "module": "dist/index.esm.js", "types": "types/index.d.ts", "files": [ "package.json", "dist", "types", "LICENSE", "README.md" ], "dependencies": { "@babel/runtime": "^7.25.6", "eventemitter3": "^5.0.1", "tslib": "^2.5.3", "@antv/g-lite": "2.3.3-beta.2" }, "publishConfig": { "access": "public" }, "gitHead": "89a517f161e783e64278a4f0d800850db6b5b420", "scripts": { "build:types": "tsc --emitDeclarationOnly --noCheck", "build": "npm run clean && npm run b --- index.js (entry) --- /*! * @antv/g-mobile-canvas-element * @description Create a CanvasLike element from existed context in mobile environment * @version 1.0.39-beta.0 * @date 12/12/2025, 2:49:19 PM * @author AntVis * @docs https://g.antv.antgroup.com/ */ 'use strict'; var _classCallCheck = require('@babel/runtime/helpers/classCallCheck'); var _createClass = require('@babel/runtime/helpers/createClass'); var EventEmitter = require('eventemitter3'); var CanvasElement = /*#__PURE__*/function () { function CanvasElement(ctx) { _classCallCheck(this, CanvasElement); this.isCanvasElement = true; this.emitter = new EventEmitter(); this.context = ctx; // 有可能是 node canvas 创建的 context 对象 var canvas = ctx.canvas || {}; this.width = canvas.width || 0; this.height = canvas.height || 0; } return _createClass(CanvasElement, [{ key: "getContext", value: function getContext(contextId, contextAttributes) { return this.context; } }, { key: "getBoundingClientRect", value: function getBoundingClientRect() { var width = this.width; var height = this.height; // 默认都处理成可视窗口的顶部位置 return { top: 0, right: width, --- bundled output (OSV-MAL flagged — LLM scope expansion) --- --- dist/index.esm.js (bundled) --- /*! * @antv/g-mobile-canvas-element * @description Create a CanvasLike element from existed context in mobile environment * @version 1.0.39-beta.0 * @date 12/12/2025, 2:49:19 PM * @author AntVis * @docs https://g.antv.antgroup.com/ */ import _classCallCheck from '@babel/runtime/helpers/classCallCheck'; import _createClass from '@babel/runtime/helpers/createClass'; import EventEmitter from 'eventemitter3'; var CanvasElement = /*#__PURE__*/function () { function CanvasElement(ctx) { _classCallCheck(this, CanvasElement); this.isCanvasElement = true; this.emitter = new EventEmitter(); this.context = ctx; // 有可能是 node canvas 创建的 context 对象 var canvas = ctx.canvas || {}; this.width = canvas.width || 0; this.height = canvas.height || 0; } return _createClass(CanvasElement, [{ key: "getContext", value: function getContext(contextId, contextAttributes) { return this.context; } }, { key: "getBoundingClientRect", value: function getBoundingClientRect() { var width = this.width; var height = this.height; // 默认都处理成可视窗口的顶部位置 return { top: 0, right: width, bottom: height, left: 0, width: width, height: height, x: 0, y: 0 }; } }, { key: "addEventListener", value: function addEventListener(type, listener, options) { // TODO: implement options this.emitter.on(type, listener); } }, { key: "removeEventListener", value: function removeEventListener(type, listener, options) { this.emitter.off(type, listener); } /** * @see https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget-dispatchEvent */ }, { key: "dispatchEvent", value: function dispatchEvent(e) { this.emitter.emit(e.type, e); return true; } }]); }(); function supportEventListener(canvas) { if (!canvas) { return false; } // 非 HTMLCanvasElement if --- dist/index.js (bundled) --- /*! * @antv/g-mobile-canvas-element * @description Create a CanvasLike element from existed context in mobile environment * @version 1.0.39-beta.0 * @date 12/12/2025, 2:49:19 PM * @author AntVis * @docs https://g.antv.antgroup.com/ */ 'use strict'; var _classCallCheck = require('@babel/runtime/helpers/classCallCheck'); var _createClass = require('@babel/runtime/helpers/createClass'); var EventEmitter = require('eventemitter3'); var CanvasElement = /*#__PURE__*/function () { function CanvasElement(ctx) { _classCallCheck(this, CanvasElement); this.isCanvasElement = true; this.emitter = new EventEmitter(); this.context = ctx; // 有可能是 node canvas 创建的 context 对象 var canvas = ctx.canvas || {}; this.width = canvas.width || 0; this.height = canvas.height || 0; } return _createClass(CanvasElement, [{ key: "getContext", value: function getContext(contextId, contextAttributes) { return this.context; } }, { key: "getBoundingClientRect", value: function getBoundingClientRect() { var width = this.width; var height = this.height; // 默认都处理成可视窗口的顶部位置 return { top: 0, right: width, bottom: height, left: 0, width: width, height: height, x: 0, y: 0 }; } }, { key: "addEventListener", value: function addEventListener(type, listener, options) { // TODO: implement options this.emitter.on(type, listener); } }, { key: "removeEventListener", value: function removeEventListener(type, listener, options) { this.emitter.off(type, listener); } /** * @see https://www.w3.org/TR/DOM-Level-2-Events/events.html#Events-EventTarget-dispatchEvent */ }, { key: "dispatchEvent", value: function dispatchEvent(e) { this.emitter.emit(e.type, e); return true; } }]); }(); function supportEventListener(canvas) { if (!canvas) { return false; } // --- dist/index.umd.min.js (bundled) --- /*! * @antv/g-mobile-canvas-element * @description Create a CanvasLike element from existed context in mobile environment * @version 1.0.39-beta.0 * @date 12/12/2025, 2:49:19 PM * @author AntVis * @docs https://g.antv.antgroup.com/ */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(((t="undefined"!=typeof globalThis?globalThis:t||self).G=t.G||{},t.G.MobileCanvasElement={}))}(this,function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t){var n=function(t,n){if("object"!=e(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,n||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(t)}(t,"string");return"symbol"==e(n)?n:n+""}function r(t,e){for(var r=0;e.length>r;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}function o(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function i(t,e,r,i,s){if("function"!=typeof r)throw new TypeError("The listener must be a function");var c=new o(r,i||t,s),f=n?n+e:e;return t._events[f]?t._events[f].fn?t._events[f]=[t._events[f],c]:t._events[f].push(c):(t._events[f]=c,t._eventsCount++),t}function s(t,e){0===--t._eventsCount?t._events=new r:delete t._events[e]}function c(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),c.prototype.eventNames=function(){var t,r,o=[];if(0===this._eventsCount)return o;for(r in t=this._events)e.call(t,r)&&o.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?
