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