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