Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@antv/g-webgpu

Package Overview
Dependencies
Maintainers
58
Versions
234
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@antv/g-webgpu - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

304

dist/index.esm.js

@@ -397,18 +397,110 @@ import { inject, CanvasConfig, singleton, ContextService, setDOMSize, isString, isBrowser, Module, AbstractRenderer } from '@antv/g';

function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
_setPrototypeOf(subClass, superClass);
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
/******************************************************************************

@@ -442,2 +534,4 @@ Copyright (c) Microsoft Corporation.

function WebGLContextService() {
_classCallCheck(this, WebGLContextService);
this.$container = void 0;

@@ -450,102 +544,110 @@ this.$canvas = void 0;

var _proto = WebGLContextService.prototype;
_createClass(WebGLContextService, [{
key: "init",
value: function () {
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
var _this$canvasConfig, container, canvas, devicePixelRatio, $canvas, dpr;
_proto.init = /*#__PURE__*/function () {
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
var _this$canvasConfig, container, canvas, devicePixelRatio, $canvas, dpr;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas, devicePixelRatio = _this$canvasConfig.devicePixelRatio;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas, devicePixelRatio = _this$canvasConfig.devicePixelRatio;
if (canvas) {
this.$canvas = canvas;
if (canvas) {
this.$canvas = canvas;
if (container && canvas.parentElement !== container) {
container.appendChild(canvas);
}
if (container && canvas.parentElement !== container) {
container.appendChild(canvas);
}
this.$container = canvas.parentElement;
this.canvasConfig.container = this.$container;
} else if (container) {
// create container
this.$container = isString(container) ? document.getElementById(container) : container;
this.$container = canvas.parentElement;
this.canvasConfig.container = this.$container;
} else if (container) {
// create container
this.$container = isString(container) ? document.getElementById(container) : container;
if (this.$container) {
// create canvas
$canvas = document.createElement('canvas');
this.$container.appendChild($canvas);
if (this.$container) {
// create canvas
$canvas = document.createElement('canvas');
this.$container.appendChild($canvas);
if (!this.$container.style.position) {
this.$container.style.position = 'relative';
}
if (!this.$container.style.position) {
this.$container.style.position = 'relative';
this.$canvas = $canvas;
}
} // use user-defined dpr first
this.$canvas = $canvas;
}
} // use user-defined dpr first
dpr = devicePixelRatio || isBrowser && window.devicePixelRatio || 1;
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
this.dpr = dpr;
dpr = devicePixelRatio || isBrowser && window.devicePixelRatio || 1;
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
this.dpr = dpr;
case 5:
case "end":
return _context.stop();
case 5:
case "end":
return _context.stop();
}
}
}
}, _callee, this);
}));
}, _callee, this);
}));
function init() {
return _init.apply(this, arguments);
}
function init() {
return _init.apply(this, arguments);
}
return init;
}();
_proto.getDomElement = function getDomElement() {
return this.$canvas;
};
_proto.getContext = function getContext() {
return this.context;
};
_proto.getBoundingClientRect = function getBoundingClientRect() {
if (this.$canvas.getBoundingClientRect) {
return this.$canvas.getBoundingClientRect();
return init;
}()
}, {
key: "getDomElement",
value: function getDomElement() {
return this.$canvas;
}
};
_proto.destroy = function destroy() {
// @ts-ignore
if (this.$container && this.$canvas && this.$canvas.parentNode) {
}, {
key: "getContext",
value: function getContext() {
return this.context;
}
}, {
key: "getBoundingClientRect",
value: function getBoundingClientRect() {
if (this.$canvas.getBoundingClientRect) {
return this.$canvas.getBoundingClientRect();
}
}
}, {
key: "destroy",
value: function destroy() {
// @ts-ignore
this.$container.removeChild(this.$canvas);
if (this.$container && this.$canvas && this.$canvas.parentNode) {
// @ts-ignore
this.$container.removeChild(this.$canvas);
}
}
};
}, {
key: "resize",
value: function resize(width, height) {
if (this.$canvas) {
var dpr = this.getDPR(); // set canvas width & height
_proto.resize = function resize(width, height) {
if (this.$canvas) {
var dpr = this.getDPR(); // set canvas width & height
this.$canvas.width = dpr * width;
this.$canvas.height = dpr * height; // set CSS style width & height
this.$canvas.width = dpr * width;
this.$canvas.height = dpr * height; // set CSS style width & height
setDOMSize(this.$canvas, width, height);
setDOMSize(this.$canvas, width, height);
}
}
};
_proto.getDPR = function getDPR() {
return this.dpr;
};
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
if (this.$container && this.$container.style) {
this.$container.style.cursor = cursor;
}, {
key: "getDPR",
value: function getDPR() {
return this.dpr;
}
};
}, {
key: "applyCursorStyle",
value: function applyCursorStyle(cursor) {
if (this.$container && this.$container.style) {
this.$container.style.cursor = cursor;
}
}
}]);

@@ -569,15 +671,19 @@ return WebGLContextService;

function ContextRegisterPlugin() {
_classCallCheck(this, ContextRegisterPlugin);
this.name = 'webgpu-context-register';
}
var _proto = ContextRegisterPlugin.prototype;
_createClass(ContextRegisterPlugin, [{
key: "init",
value: function init(container) {
container.load(containerModule, true);
}
}, {
key: "destroy",
value: function destroy(container) {
container.unload(containerModule);
}
}]);
_proto.init = function init(container) {
container.load(containerModule, true);
};
_proto.destroy = function destroy(container) {
container.unload(containerModule);
};
return ContextRegisterPlugin;

@@ -587,9 +693,13 @@ }();

var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
_inheritsLoose(Renderer, _AbstractRenderer);
_inherits(Renderer, _AbstractRenderer);
var _super = _createSuper(Renderer);
function Renderer(config) {
var _this;
_this = _AbstractRenderer.call(this, config) || this;
_classCallCheck(this, Renderer);
_this = _super.call(this, config);
_this.registerPlugin(new ContextRegisterPlugin());

@@ -610,5 +720,5 @@

return Renderer;
return _createClass(Renderer);
}(AbstractRenderer);
export { Renderer };

@@ -418,18 +418,110 @@ 'use strict';

function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
_setPrototypeOf(subClass, superClass);
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
Object.defineProperty(Constructor, "prototype", {
writable: false
});
return Constructor;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
Object.defineProperty(subClass, "prototype", {
writable: false
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _isNativeReflectConstruct() {
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
if (Reflect.construct.sham) return false;
if (typeof Proxy === "function") return true;
try {
Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
return true;
} catch (e) {
return false;
}
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
} else if (call !== void 0) {
throw new TypeError("Derived constructors may only return object or undefined");
}
return _assertThisInitialized(self);
}
function _createSuper(Derived) {
var hasNativeReflectConstruct = _isNativeReflectConstruct();
return function _createSuperInternal() {
var Super = _getPrototypeOf(Derived),
result;
if (hasNativeReflectConstruct) {
var NewTarget = _getPrototypeOf(this).constructor;
result = Reflect.construct(Super, arguments, NewTarget);
} else {
result = Super.apply(this, arguments);
}
return _possibleConstructorReturn(this, result);
};
}
/******************************************************************************

@@ -463,2 +555,4 @@ Copyright (c) Microsoft Corporation.

function WebGLContextService() {
_classCallCheck(this, WebGLContextService);
this.$container = void 0;

@@ -471,102 +565,110 @@ this.$canvas = void 0;

var _proto = WebGLContextService.prototype;
_createClass(WebGLContextService, [{
key: "init",
value: function () {
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
var _this$canvasConfig, container, canvas, devicePixelRatio, $canvas, dpr;
_proto.init = /*#__PURE__*/function () {
var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
var _this$canvasConfig, container, canvas, devicePixelRatio, $canvas, dpr;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas, devicePixelRatio = _this$canvasConfig.devicePixelRatio;
return _regeneratorRuntime().wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas, devicePixelRatio = _this$canvasConfig.devicePixelRatio;
if (canvas) {
this.$canvas = canvas;
if (canvas) {
this.$canvas = canvas;
if (container && canvas.parentElement !== container) {
container.appendChild(canvas);
}
if (container && canvas.parentElement !== container) {
container.appendChild(canvas);
}
this.$container = canvas.parentElement;
this.canvasConfig.container = this.$container;
} else if (container) {
// create container
this.$container = g.isString(container) ? document.getElementById(container) : container;
this.$container = canvas.parentElement;
this.canvasConfig.container = this.$container;
} else if (container) {
// create container
this.$container = g.isString(container) ? document.getElementById(container) : container;
if (this.$container) {
// create canvas
$canvas = document.createElement('canvas');
this.$container.appendChild($canvas);
if (this.$container) {
// create canvas
$canvas = document.createElement('canvas');
this.$container.appendChild($canvas);
if (!this.$container.style.position) {
this.$container.style.position = 'relative';
}
if (!this.$container.style.position) {
this.$container.style.position = 'relative';
this.$canvas = $canvas;
}
} // use user-defined dpr first
this.$canvas = $canvas;
}
} // use user-defined dpr first
dpr = devicePixelRatio || g.isBrowser && window.devicePixelRatio || 1;
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
this.dpr = dpr;
dpr = devicePixelRatio || g.isBrowser && window.devicePixelRatio || 1;
dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
this.dpr = dpr;
case 5:
case "end":
return _context.stop();
case 5:
case "end":
return _context.stop();
}
}
}
}, _callee, this);
}));
}, _callee, this);
}));
function init() {
return _init.apply(this, arguments);
}
function init() {
return _init.apply(this, arguments);
}
return init;
}();
_proto.getDomElement = function getDomElement() {
return this.$canvas;
};
_proto.getContext = function getContext() {
return this.context;
};
_proto.getBoundingClientRect = function getBoundingClientRect() {
if (this.$canvas.getBoundingClientRect) {
return this.$canvas.getBoundingClientRect();
return init;
}()
}, {
key: "getDomElement",
value: function getDomElement() {
return this.$canvas;
}
};
_proto.destroy = function destroy() {
// @ts-ignore
if (this.$container && this.$canvas && this.$canvas.parentNode) {
}, {
key: "getContext",
value: function getContext() {
return this.context;
}
}, {
key: "getBoundingClientRect",
value: function getBoundingClientRect() {
if (this.$canvas.getBoundingClientRect) {
return this.$canvas.getBoundingClientRect();
}
}
}, {
key: "destroy",
value: function destroy() {
// @ts-ignore
this.$container.removeChild(this.$canvas);
if (this.$container && this.$canvas && this.$canvas.parentNode) {
// @ts-ignore
this.$container.removeChild(this.$canvas);
}
}
};
}, {
key: "resize",
value: function resize(width, height) {
if (this.$canvas) {
var dpr = this.getDPR(); // set canvas width & height
_proto.resize = function resize(width, height) {
if (this.$canvas) {
var dpr = this.getDPR(); // set canvas width & height
this.$canvas.width = dpr * width;
this.$canvas.height = dpr * height; // set CSS style width & height
this.$canvas.width = dpr * width;
this.$canvas.height = dpr * height; // set CSS style width & height
g.setDOMSize(this.$canvas, width, height);
g.setDOMSize(this.$canvas, width, height);
}
}
};
_proto.getDPR = function getDPR() {
return this.dpr;
};
_proto.applyCursorStyle = function applyCursorStyle(cursor) {
if (this.$container && this.$container.style) {
this.$container.style.cursor = cursor;
}, {
key: "getDPR",
value: function getDPR() {
return this.dpr;
}
};
}, {
key: "applyCursorStyle",
value: function applyCursorStyle(cursor) {
if (this.$container && this.$container.style) {
this.$container.style.cursor = cursor;
}
}
}]);

@@ -590,15 +692,19 @@ return WebGLContextService;

function ContextRegisterPlugin() {
_classCallCheck(this, ContextRegisterPlugin);
this.name = 'webgpu-context-register';
}
var _proto = ContextRegisterPlugin.prototype;
_createClass(ContextRegisterPlugin, [{
key: "init",
value: function init(container) {
container.load(containerModule, true);
}
}, {
key: "destroy",
value: function destroy(container) {
container.unload(containerModule);
}
}]);
_proto.init = function init(container) {
container.load(containerModule, true);
};
_proto.destroy = function destroy(container) {
container.unload(containerModule);
};
return ContextRegisterPlugin;

@@ -608,9 +714,13 @@ }();

var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
_inheritsLoose(Renderer, _AbstractRenderer);
_inherits(Renderer, _AbstractRenderer);
var _super = _createSuper(Renderer);
function Renderer(config) {
var _this;
_this = _AbstractRenderer.call(this, config) || this;
_classCallCheck(this, Renderer);
_this = _super.call(this, config);
_this.registerPlugin(new ContextRegisterPlugin());

@@ -631,3 +741,3 @@

return Renderer;
return _createClass(Renderer);
}(g.AbstractRenderer);

@@ -634,0 +744,0 @@

{
"name": "@antv/g-webgpu",
"version": "1.2.0",
"version": "1.2.1",
"description": "A renderer implemented by WebGPU",

@@ -31,7 +31,7 @@ "keywords": [

"dependencies": {
"@antv/g-plugin-device-renderer": "^1.2.0",
"@antv/g-plugin-dom-interaction": "^1.2.0",
"@antv/g-plugin-html-renderer": "^1.2.0",
"@antv/g-plugin-image-loader": "^0.1.0",
"@antv/g-plugin-webgpu-device": "^1.2.0"
"@antv/g-plugin-device-renderer": "^1.2.1",
"@antv/g-plugin-dom-interaction": "^1.2.1",
"@antv/g-plugin-html-renderer": "^1.2.1",
"@antv/g-plugin-image-loader": "^0.1.1",
"@antv/g-plugin-webgpu-device": "^1.2.1"
},

@@ -49,3 +49,3 @@ "devDependencies": {

},
"gitHead": "bf0d57ef10d56f48d6258906281b9edb34bffb48"
"gitHead": "90eceace1d9a96e36b20926e853b958c03cf3a67"
}

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc