@antv/g-webgpu 1.1.6 → 1.1.8-alpha.1

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/dist/index.js CHANGED
@@ -7,7 +7,6 @@ var DomInteraction = require('@antv/g-plugin-dom-interaction');
7
7
  var DeviceRenderer = require('@antv/g-plugin-device-renderer');
8
8
  var WebGPUDevice = require('@antv/g-plugin-webgpu-device');
9
9
  var HTMLRenderer = require('@antv/g-plugin-html-renderer');
10
- var manaSyringe = require('mana-syringe');
11
10
 
12
11
  function _interopNamespace(e) {
13
12
  if (e && e.__esModule) return e;
@@ -33,113 +32,401 @@ var DomInteraction__namespace = /*#__PURE__*/_interopNamespace(DomInteraction);
33
32
  var DeviceRenderer__namespace = /*#__PURE__*/_interopNamespace(DeviceRenderer);
34
33
  var WebGPUDevice__namespace = /*#__PURE__*/_interopNamespace(WebGPUDevice);
35
34
 
36
- function _classCallCheck(instance, Constructor) {
37
- if (!(instance instanceof Constructor)) {
38
- throw new TypeError("Cannot call a class as a function");
35
+ function _regeneratorRuntime() {
36
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
37
+
38
+ _regeneratorRuntime = function () {
39
+ return exports;
40
+ };
41
+
42
+ var exports = {},
43
+ Op = Object.prototype,
44
+ hasOwn = Op.hasOwnProperty,
45
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
46
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
47
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
48
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
49
+
50
+ function define(obj, key, value) {
51
+ return Object.defineProperty(obj, key, {
52
+ value: value,
53
+ enumerable: !0,
54
+ configurable: !0,
55
+ writable: !0
56
+ }), obj[key];
39
57
  }
40
- }
41
58
 
42
- function _defineProperties(target, props) {
43
- for (var i = 0; i < props.length; i++) {
44
- var descriptor = props[i];
45
- descriptor.enumerable = descriptor.enumerable || false;
46
- descriptor.configurable = true;
47
- if ("value" in descriptor) descriptor.writable = true;
48
- Object.defineProperty(target, descriptor.key, descriptor);
59
+ try {
60
+ define({}, "");
61
+ } catch (err) {
62
+ define = function (obj, key, value) {
63
+ return obj[key] = value;
64
+ };
49
65
  }
50
- }
51
66
 
52
- function _createClass(Constructor, protoProps, staticProps) {
53
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
54
- if (staticProps) _defineProperties(Constructor, staticProps);
55
- Object.defineProperty(Constructor, "prototype", {
56
- writable: false
57
- });
58
- return Constructor;
59
- }
67
+ function wrap(innerFn, outerFn, self, tryLocsList) {
68
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
69
+ generator = Object.create(protoGenerator.prototype),
70
+ context = new Context(tryLocsList || []);
71
+ return generator._invoke = function (innerFn, self, context) {
72
+ var state = "suspendedStart";
73
+ return function (method, arg) {
74
+ if ("executing" === state) throw new Error("Generator is already running");
75
+
76
+ if ("completed" === state) {
77
+ if ("throw" === method) throw arg;
78
+ return doneResult();
79
+ }
60
80
 
61
- function _inherits(subClass, superClass) {
62
- if (typeof superClass !== "function" && superClass !== null) {
63
- throw new TypeError("Super expression must either be null or a function");
81
+ for (context.method = method, context.arg = arg;;) {
82
+ var delegate = context.delegate;
83
+
84
+ if (delegate) {
85
+ var delegateResult = maybeInvokeDelegate(delegate, context);
86
+
87
+ if (delegateResult) {
88
+ if (delegateResult === ContinueSentinel) continue;
89
+ return delegateResult;
90
+ }
91
+ }
92
+
93
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
94
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
95
+ context.dispatchException(context.arg);
96
+ } else "return" === context.method && context.abrupt("return", context.arg);
97
+ state = "executing";
98
+ var record = tryCatch(innerFn, self, context);
99
+
100
+ if ("normal" === record.type) {
101
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
102
+ return {
103
+ value: record.arg,
104
+ done: context.done
105
+ };
106
+ }
107
+
108
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
109
+ }
110
+ };
111
+ }(innerFn, self, context), generator;
64
112
  }
65
113
 
66
- subClass.prototype = Object.create(superClass && superClass.prototype, {
67
- constructor: {
68
- value: subClass,
69
- writable: true,
70
- configurable: true
114
+ function tryCatch(fn, obj, arg) {
115
+ try {
116
+ return {
117
+ type: "normal",
118
+ arg: fn.call(obj, arg)
119
+ };
120
+ } catch (err) {
121
+ return {
122
+ type: "throw",
123
+ arg: err
124
+ };
71
125
  }
126
+ }
127
+
128
+ exports.wrap = wrap;
129
+ var ContinueSentinel = {};
130
+
131
+ function Generator() {}
132
+
133
+ function GeneratorFunction() {}
134
+
135
+ function GeneratorFunctionPrototype() {}
136
+
137
+ var IteratorPrototype = {};
138
+ define(IteratorPrototype, iteratorSymbol, function () {
139
+ return this;
72
140
  });
73
- Object.defineProperty(subClass, "prototype", {
74
- writable: false
75
- });
76
- if (superClass) _setPrototypeOf(subClass, superClass);
77
- }
141
+ var getProto = Object.getPrototypeOf,
142
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
143
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
144
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
145
+
146
+ function defineIteratorMethods(prototype) {
147
+ ["next", "throw", "return"].forEach(function (method) {
148
+ define(prototype, method, function (arg) {
149
+ return this._invoke(method, arg);
150
+ });
151
+ });
152
+ }
78
153
 
79
- function _getPrototypeOf(o) {
80
- _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
81
- return o.__proto__ || Object.getPrototypeOf(o);
82
- };
83
- return _getPrototypeOf(o);
84
- }
154
+ function AsyncIterator(generator, PromiseImpl) {
155
+ function invoke(method, arg, resolve, reject) {
156
+ var record = tryCatch(generator[method], generator, arg);
157
+
158
+ if ("throw" !== record.type) {
159
+ var result = record.arg,
160
+ value = result.value;
161
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
162
+ invoke("next", value, resolve, reject);
163
+ }, function (err) {
164
+ invoke("throw", err, resolve, reject);
165
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
166
+ result.value = unwrapped, resolve(result);
167
+ }, function (error) {
168
+ return invoke("throw", error, resolve, reject);
169
+ });
170
+ }
85
171
 
86
- function _setPrototypeOf(o, p) {
87
- _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
88
- o.__proto__ = p;
89
- return o;
90
- };
172
+ reject(record.arg);
173
+ }
91
174
 
92
- return _setPrototypeOf(o, p);
93
- }
175
+ var previousPromise;
94
176
 
95
- function _isNativeReflectConstruct() {
96
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
97
- if (Reflect.construct.sham) return false;
98
- if (typeof Proxy === "function") return true;
177
+ this._invoke = function (method, arg) {
178
+ function callInvokeWithMethodAndArg() {
179
+ return new PromiseImpl(function (resolve, reject) {
180
+ invoke(method, arg, resolve, reject);
181
+ });
182
+ }
99
183
 
100
- try {
101
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
102
- return true;
103
- } catch (e) {
104
- return false;
184
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
185
+ };
105
186
  }
106
- }
107
187
 
108
- function _assertThisInitialized(self) {
109
- if (self === void 0) {
110
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
188
+ function maybeInvokeDelegate(delegate, context) {
189
+ var method = delegate.iterator[context.method];
190
+
191
+ if (undefined === method) {
192
+ if (context.delegate = null, "throw" === context.method) {
193
+ if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
194
+ context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
195
+ }
196
+
197
+ return ContinueSentinel;
198
+ }
199
+
200
+ var record = tryCatch(method, delegate.iterator, context.arg);
201
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
202
+ var info = record.arg;
203
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
111
204
  }
112
205
 
113
- return self;
206
+ function pushTryEntry(locs) {
207
+ var entry = {
208
+ tryLoc: locs[0]
209
+ };
210
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
211
+ }
212
+
213
+ function resetTryEntry(entry) {
214
+ var record = entry.completion || {};
215
+ record.type = "normal", delete record.arg, entry.completion = record;
216
+ }
217
+
218
+ function Context(tryLocsList) {
219
+ this.tryEntries = [{
220
+ tryLoc: "root"
221
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
222
+ }
223
+
224
+ function values(iterable) {
225
+ if (iterable) {
226
+ var iteratorMethod = iterable[iteratorSymbol];
227
+ if (iteratorMethod) return iteratorMethod.call(iterable);
228
+ if ("function" == typeof iterable.next) return iterable;
229
+
230
+ if (!isNaN(iterable.length)) {
231
+ var i = -1,
232
+ next = function next() {
233
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
234
+
235
+ return next.value = undefined, next.done = !0, next;
236
+ };
237
+
238
+ return next.next = next;
239
+ }
240
+ }
241
+
242
+ return {
243
+ next: doneResult
244
+ };
245
+ }
246
+
247
+ function doneResult() {
248
+ return {
249
+ value: undefined,
250
+ done: !0
251
+ };
252
+ }
253
+
254
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
255
+ var ctor = "function" == typeof genFun && genFun.constructor;
256
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
257
+ }, exports.mark = function (genFun) {
258
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
259
+ }, exports.awrap = function (arg) {
260
+ return {
261
+ __await: arg
262
+ };
263
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
264
+ return this;
265
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
266
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
267
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
268
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
269
+ return result.done ? result.value : iter.next();
270
+ });
271
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
272
+ return this;
273
+ }), define(Gp, "toString", function () {
274
+ return "[object Generator]";
275
+ }), exports.keys = function (object) {
276
+ var keys = [];
277
+
278
+ for (var key in object) keys.push(key);
279
+
280
+ return keys.reverse(), function next() {
281
+ for (; keys.length;) {
282
+ var key = keys.pop();
283
+ if (key in object) return next.value = key, next.done = !1, next;
284
+ }
285
+
286
+ return next.done = !0, next;
287
+ };
288
+ }, exports.values = values, Context.prototype = {
289
+ constructor: Context,
290
+ reset: function (skipTempReset) {
291
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
292
+ },
293
+ stop: function () {
294
+ this.done = !0;
295
+ var rootRecord = this.tryEntries[0].completion;
296
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
297
+ return this.rval;
298
+ },
299
+ dispatchException: function (exception) {
300
+ if (this.done) throw exception;
301
+ var context = this;
302
+
303
+ function handle(loc, caught) {
304
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
305
+ }
306
+
307
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
308
+ var entry = this.tryEntries[i],
309
+ record = entry.completion;
310
+ if ("root" === entry.tryLoc) return handle("end");
311
+
312
+ if (entry.tryLoc <= this.prev) {
313
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
314
+ hasFinally = hasOwn.call(entry, "finallyLoc");
315
+
316
+ if (hasCatch && hasFinally) {
317
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
318
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
319
+ } else if (hasCatch) {
320
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
321
+ } else {
322
+ if (!hasFinally) throw new Error("try statement without catch or finally");
323
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
324
+ }
325
+ }
326
+ }
327
+ },
328
+ abrupt: function (type, arg) {
329
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
330
+ var entry = this.tryEntries[i];
331
+
332
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
333
+ var finallyEntry = entry;
334
+ break;
335
+ }
336
+ }
337
+
338
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
339
+ var record = finallyEntry ? finallyEntry.completion : {};
340
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
341
+ },
342
+ complete: function (record, afterLoc) {
343
+ if ("throw" === record.type) throw record.arg;
344
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
345
+ },
346
+ finish: function (finallyLoc) {
347
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
348
+ var entry = this.tryEntries[i];
349
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
350
+ }
351
+ },
352
+ catch: function (tryLoc) {
353
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
354
+ var entry = this.tryEntries[i];
355
+
356
+ if (entry.tryLoc === tryLoc) {
357
+ var record = entry.completion;
358
+
359
+ if ("throw" === record.type) {
360
+ var thrown = record.arg;
361
+ resetTryEntry(entry);
362
+ }
363
+
364
+ return thrown;
365
+ }
366
+ }
367
+
368
+ throw new Error("illegal catch attempt");
369
+ },
370
+ delegateYield: function (iterable, resultName, nextLoc) {
371
+ return this.delegate = {
372
+ iterator: values(iterable),
373
+ resultName: resultName,
374
+ nextLoc: nextLoc
375
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
376
+ }
377
+ }, exports;
114
378
  }
115
379
 
116
- function _possibleConstructorReturn(self, call) {
117
- if (call && (typeof call === "object" || typeof call === "function")) {
118
- return call;
119
- } else if (call !== void 0) {
120
- throw new TypeError("Derived constructors may only return object or undefined");
380
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
381
+ try {
382
+ var info = gen[key](arg);
383
+ var value = info.value;
384
+ } catch (error) {
385
+ reject(error);
386
+ return;
121
387
  }
122
388
 
123
- return _assertThisInitialized(self);
389
+ if (info.done) {
390
+ resolve(value);
391
+ } else {
392
+ Promise.resolve(value).then(_next, _throw);
393
+ }
124
394
  }
125
395
 
126
- function _createSuper(Derived) {
127
- var hasNativeReflectConstruct = _isNativeReflectConstruct();
396
+ function _asyncToGenerator(fn) {
397
+ return function () {
398
+ var self = this,
399
+ args = arguments;
400
+ return new Promise(function (resolve, reject) {
401
+ var gen = fn.apply(self, args);
128
402
 
129
- return function _createSuperInternal() {
130
- var Super = _getPrototypeOf(Derived),
131
- result;
403
+ function _next(value) {
404
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
405
+ }
132
406
 
133
- if (hasNativeReflectConstruct) {
134
- var NewTarget = _getPrototypeOf(this).constructor;
407
+ function _throw(err) {
408
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
409
+ }
135
410
 
136
- result = Reflect.construct(Super, arguments, NewTarget);
137
- } else {
138
- result = Super.apply(this, arguments);
139
- }
411
+ _next(undefined);
412
+ });
413
+ };
414
+ }
415
+
416
+ function _inheritsLoose(subClass, superClass) {
417
+ subClass.prototype = Object.create(superClass.prototype);
418
+ subClass.prototype.constructor = subClass;
419
+
420
+ _setPrototypeOf(subClass, superClass);
421
+ }
140
422
 
141
- return _possibleConstructorReturn(this, result);
423
+ function _setPrototypeOf(o, p) {
424
+ _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
425
+ o.__proto__ = p;
426
+ return o;
142
427
  };
428
+
429
+ return _setPrototypeOf(o, p);
143
430
  }
144
431
 
145
432
  /******************************************************************************
@@ -170,8 +457,6 @@ function __metadata(metadataKey, metadataValue) {
170
457
 
171
458
  var WebGLContextService = /*#__PURE__*/function () {
172
459
  function WebGLContextService() {
173
- _classCallCheck(this, WebGLContextService);
174
-
175
460
  this.$container = void 0;
176
461
  this.$canvas = void 0;
177
462
  this.dpr = void 0;
@@ -179,107 +464,117 @@ var WebGLContextService = /*#__PURE__*/function () {
179
464
  this.canvasConfig = void 0;
180
465
  }
181
466
 
182
- _createClass(WebGLContextService, [{
183
- key: "init",
184
- value: function init() {
185
- var _this$canvasConfig = this.canvasConfig,
186
- container = _this$canvasConfig.container,
187
- canvas = _this$canvasConfig.canvas,
188
- devicePixelRatio = _this$canvasConfig.devicePixelRatio;
467
+ var _proto = WebGLContextService.prototype;
189
468
 
190
- if (canvas) {
191
- this.$canvas = canvas;
469
+ _proto.init = /*#__PURE__*/function () {
470
+ var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
471
+ var _this$canvasConfig, container, canvas, devicePixelRatio, $canvas, dpr;
192
472
 
193
- if (container && canvas.parentElement !== container) {
194
- container.appendChild(canvas);
195
- }
473
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
474
+ while (1) {
475
+ switch (_context.prev = _context.next) {
476
+ case 0:
477
+ _this$canvasConfig = this.canvasConfig, container = _this$canvasConfig.container, canvas = _this$canvasConfig.canvas, devicePixelRatio = _this$canvasConfig.devicePixelRatio;
196
478
 
197
- this.$container = canvas.parentElement;
198
- this.canvasConfig.container = this.$container;
199
- } else if (container) {
200
- // create container
201
- this.$container = g.isString(container) ? document.getElementById(container) : container;
479
+ if (canvas) {
480
+ this.$canvas = canvas;
202
481
 
203
- if (this.$container) {
204
- // create canvas
205
- var $canvas = document.createElement('canvas');
206
- this.$container.appendChild($canvas);
482
+ if (container && canvas.parentElement !== container) {
483
+ container.appendChild(canvas);
484
+ }
207
485
 
208
- if (!this.$container.style.position) {
209
- this.$container.style.position = 'relative';
210
- }
486
+ this.$container = canvas.parentElement;
487
+ this.canvasConfig.container = this.$container;
488
+ } else if (container) {
489
+ // create container
490
+ this.$container = g.isString(container) ? document.getElementById(container) : container;
211
491
 
212
- this.$canvas = $canvas;
213
- }
214
- } // use user-defined dpr first
492
+ if (this.$container) {
493
+ // create canvas
494
+ $canvas = document.createElement('canvas');
495
+ this.$container.appendChild($canvas);
215
496
 
497
+ if (!this.$container.style.position) {
498
+ this.$container.style.position = 'relative';
499
+ }
216
500
 
217
- var dpr = devicePixelRatio || g.isBrowser && window.devicePixelRatio || 1;
218
- dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
219
- this.dpr = dpr;
220
- }
221
- }, {
222
- key: "getDomElement",
223
- value: function getDomElement() {
224
- return this.$canvas;
225
- }
226
- }, {
227
- key: "getContext",
228
- value: function getContext() {
229
- return this.context;
501
+ this.$canvas = $canvas;
502
+ }
503
+ } // use user-defined dpr first
504
+
505
+
506
+ dpr = devicePixelRatio || g.isBrowser && window.devicePixelRatio || 1;
507
+ dpr = dpr >= 1 ? Math.ceil(dpr) : 1;
508
+ this.dpr = dpr;
509
+
510
+ case 5:
511
+ case "end":
512
+ return _context.stop();
513
+ }
514
+ }
515
+ }, _callee, this);
516
+ }));
517
+
518
+ function init() {
519
+ return _init.apply(this, arguments);
230
520
  }
231
- }, {
232
- key: "getBoundingClientRect",
233
- value: function getBoundingClientRect() {
234
- if (this.$canvas.getBoundingClientRect) {
235
- return this.$canvas.getBoundingClientRect();
236
- }
521
+
522
+ return init;
523
+ }();
524
+
525
+ _proto.getDomElement = function getDomElement() {
526
+ return this.$canvas;
527
+ };
528
+
529
+ _proto.getContext = function getContext() {
530
+ return this.context;
531
+ };
532
+
533
+ _proto.getBoundingClientRect = function getBoundingClientRect() {
534
+ if (this.$canvas.getBoundingClientRect) {
535
+ return this.$canvas.getBoundingClientRect();
237
536
  }
238
- }, {
239
- key: "destroy",
240
- value: function destroy() {
537
+ };
538
+
539
+ _proto.destroy = function destroy() {
540
+ // @ts-ignore
541
+ if (this.$container && this.$canvas && this.$canvas.parentNode) {
241
542
  // @ts-ignore
242
- if (this.$container && this.$canvas && this.$canvas.parentNode) {
243
- // @ts-ignore
244
- this.$container.removeChild(this.$canvas);
245
- }
543
+ this.$container.removeChild(this.$canvas);
246
544
  }
247
- }, {
248
- key: "resize",
249
- value: function resize(width, height) {
250
- if (this.$canvas) {
251
- var dpr = this.getDPR(); // set canvas width & height
545
+ };
252
546
 
253
- this.$canvas.width = dpr * width;
254
- this.$canvas.height = dpr * height; // set CSS style width & height
547
+ _proto.resize = function resize(width, height) {
548
+ if (this.$canvas) {
549
+ var dpr = this.getDPR(); // set canvas width & height
255
550
 
256
- g.setDOMSize(this.$canvas, width, height);
257
- }
258
- }
259
- }, {
260
- key: "getDPR",
261
- value: function getDPR() {
262
- return this.dpr;
551
+ this.$canvas.width = dpr * width;
552
+ this.$canvas.height = dpr * height; // set CSS style width & height
553
+
554
+ g.setDOMSize(this.$canvas, width, height);
263
555
  }
264
- }, {
265
- key: "applyCursorStyle",
266
- value: function applyCursorStyle(cursor) {
267
- if (this.$container && this.$container.style) {
268
- this.$container.style.cursor = cursor;
269
- }
556
+ };
557
+
558
+ _proto.getDPR = function getDPR() {
559
+ return this.dpr;
560
+ };
561
+
562
+ _proto.applyCursorStyle = function applyCursorStyle(cursor) {
563
+ if (this.$container && this.$container.style) {
564
+ this.$container.style.cursor = cursor;
270
565
  }
271
- }]);
566
+ };
272
567
 
273
568
  return WebGLContextService;
274
569
  }();
275
570
 
276
- __decorate([manaSyringe.inject(g.CanvasConfig), __metadata("design:type", Object)], WebGLContextService.prototype, "canvasConfig", void 0);
571
+ __decorate([g.inject(g.CanvasConfig), __metadata("design:type", Object)], WebGLContextService.prototype, "canvasConfig", void 0);
277
572
 
278
- WebGLContextService = __decorate([manaSyringe.singleton({
573
+ WebGLContextService = __decorate([g.singleton({
279
574
  token: g.ContextService
280
575
  })], WebGLContextService);
281
576
 
282
- var containerModule = manaSyringe.Module(function (register) {
577
+ var containerModule = g.Module(function (register) {
283
578
  /**
284
579
  * implements ContextService
285
580
  */
@@ -287,37 +582,29 @@ var containerModule = manaSyringe.Module(function (register) {
287
582
  });
288
583
  var ContextRegisterPlugin = /*#__PURE__*/function () {
289
584
  function ContextRegisterPlugin() {
290
- _classCallCheck(this, ContextRegisterPlugin);
291
-
292
585
  this.name = 'webgpu-context-register';
293
586
  }
294
587
 
295
- _createClass(ContextRegisterPlugin, [{
296
- key: "init",
297
- value: function init(container) {
298
- container.load(containerModule, true);
299
- }
300
- }, {
301
- key: "destroy",
302
- value: function destroy(container) {
303
- container.unload(containerModule);
304
- }
305
- }]);
588
+ var _proto = ContextRegisterPlugin.prototype;
589
+
590
+ _proto.init = function init(container) {
591
+ container.load(containerModule, true);
592
+ };
593
+
594
+ _proto.destroy = function destroy(container) {
595
+ container.unload(containerModule);
596
+ };
306
597
 
307
598
  return ContextRegisterPlugin;
308
599
  }();
309
600
 
310
601
  var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
311
- _inherits(Renderer, _AbstractRenderer);
312
-
313
- var _super = _createSuper(Renderer);
602
+ _inheritsLoose(Renderer, _AbstractRenderer);
314
603
 
315
604
  function Renderer(config) {
316
605
  var _this;
317
606
 
318
- _classCallCheck(this, Renderer);
319
-
320
- _this = _super.call(this, config);
607
+ _this = _AbstractRenderer.call(this, config) || this;
321
608
 
322
609
  _this.registerPlugin(new ContextRegisterPlugin());
323
610
 
@@ -332,7 +619,7 @@ var Renderer = /*#__PURE__*/function (_AbstractRenderer) {
332
619
  return _this;
333
620
  }
334
621
 
335
- return _createClass(Renderer);
622
+ return Renderer;
336
623
  }(g.AbstractRenderer);
337
624
 
338
625
  exports.DomInteraction = DomInteraction__namespace;