targetj 1.1.3 → 1.1.4
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/build/App.js +37 -12
- package/build/ParticleExplode.js +10 -7
- package/build/ParticleRenderer.js +20 -27
- package/build/ParticleTModel.js +28 -15
- package/build/ScheduleUtil.js +161 -0
- package/build/TUtil.js +71 -155
- package/build/TargetManager.js +1 -1
- package/build/TargetParser.js +12 -3
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/TUtil.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
2
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
3
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
1
4
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
5
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
3
6
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
@@ -9,6 +12,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
9
12
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
10
13
|
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
11
14
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
15
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
12
16
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
13
17
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
14
18
|
import { getLocationManager, tRoot } from "./App.js";
|
|
@@ -310,165 +314,77 @@ var TUtil = /*#__PURE__*/function () {
|
|
|
310
314
|
return cloned;
|
|
311
315
|
}
|
|
312
316
|
}, {
|
|
313
|
-
key: "
|
|
314
|
-
value: function
|
|
315
|
-
var
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
done: true,
|
|
374
|
-
remainingMs: remainingMs
|
|
375
|
-
};
|
|
317
|
+
key: "initWebGpu",
|
|
318
|
+
value: function initWebGpu() {
|
|
319
|
+
var _this$webGpuInitPromi,
|
|
320
|
+
_this = this;
|
|
321
|
+
return (_this$webGpuInitPromi = this.webGpuInitPromise) !== null && _this$webGpuInitPromi !== void 0 ? _this$webGpuInitPromi : this.webGpuInitPromise = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
322
|
+
var device, adapter, canvas, context, _device;
|
|
323
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
324
|
+
while (1) switch (_context.prev = _context.next) {
|
|
325
|
+
case 0:
|
|
326
|
+
_this.webGpuAvailable = false;
|
|
327
|
+
if (_this.hasWebGpu()) {
|
|
328
|
+
_context.next = 3;
|
|
329
|
+
break;
|
|
330
|
+
}
|
|
331
|
+
return _context.abrupt("return", false);
|
|
332
|
+
case 3:
|
|
333
|
+
_context.prev = 3;
|
|
334
|
+
_context.next = 6;
|
|
335
|
+
return navigator.gpu.requestAdapter();
|
|
336
|
+
case 6:
|
|
337
|
+
adapter = _context.sent;
|
|
338
|
+
if (adapter) {
|
|
339
|
+
_context.next = 9;
|
|
340
|
+
break;
|
|
341
|
+
}
|
|
342
|
+
return _context.abrupt("return", false);
|
|
343
|
+
case 9:
|
|
344
|
+
_context.next = 11;
|
|
345
|
+
return adapter.requestDevice();
|
|
346
|
+
case 11:
|
|
347
|
+
device = _context.sent;
|
|
348
|
+
canvas = document.createElement("canvas");
|
|
349
|
+
context = canvas.getContext("webgpu");
|
|
350
|
+
if (context) {
|
|
351
|
+
_context.next = 16;
|
|
352
|
+
break;
|
|
353
|
+
}
|
|
354
|
+
return _context.abrupt("return", false);
|
|
355
|
+
case 16:
|
|
356
|
+
context.configure({
|
|
357
|
+
device: device,
|
|
358
|
+
format: navigator.gpu.getPreferredCanvasFormat(),
|
|
359
|
+
alphaMode: "premultiplied",
|
|
360
|
+
usage: globalThis.GPUTextureUsage.RENDER_ATTACHMENT | globalThis.GPUTextureUsage.COPY_SRC
|
|
361
|
+
});
|
|
362
|
+
context.unconfigure();
|
|
363
|
+
_this.webGpuAvailable = true;
|
|
364
|
+
return _context.abrupt("return", true);
|
|
365
|
+
case 22:
|
|
366
|
+
_context.prev = 22;
|
|
367
|
+
_context.t0 = _context["catch"](3);
|
|
368
|
+
console.warn("TargetJS: WebGPU unavailable. Using DOM.", _context.t0);
|
|
369
|
+
return _context.abrupt("return", false);
|
|
370
|
+
case 26:
|
|
371
|
+
_context.prev = 26;
|
|
372
|
+
(_device = device) === null || _device === void 0 || _device.destroy();
|
|
373
|
+
return _context.finish(26);
|
|
374
|
+
case 29:
|
|
375
|
+
case "end":
|
|
376
|
+
return _context.stop();
|
|
376
377
|
}
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
}
|
|
380
|
-
var advancedSteps = TUtil.limit(Math.floor(remainingMs / interval), 0, remainingSteps);
|
|
381
|
-
step += advancedSteps;
|
|
382
|
-
remainingMs -= advancedSteps * interval;
|
|
383
|
-
return {
|
|
384
|
-
step: step,
|
|
385
|
-
steps: steps,
|
|
386
|
-
valuePointer: 0,
|
|
387
|
-
cycle: cycle,
|
|
388
|
-
done: false,
|
|
389
|
-
remainingMs: remainingMs
|
|
390
|
-
};
|
|
391
|
-
}
|
|
392
|
-
return {
|
|
393
|
-
step: step,
|
|
394
|
-
steps: steps,
|
|
395
|
-
valuePointer: 0,
|
|
396
|
-
cycle: cycle,
|
|
397
|
-
done: cycle >= cycles,
|
|
398
|
-
remainingMs: remainingMs
|
|
399
|
-
};
|
|
378
|
+
}, _callee, null, [[3, 22, 26, 29]]);
|
|
379
|
+
}))();
|
|
400
380
|
}
|
|
401
381
|
}, {
|
|
402
|
-
key: "
|
|
403
|
-
value: function
|
|
404
|
-
|
|
405
|
-
var valueList = targetValue.valueList;
|
|
406
|
-
var stepList = targetValue.stepList || [1];
|
|
407
|
-
var intervalList = targetValue.intervalList || [targetValue.interval || 8];
|
|
408
|
-
var cycles = tmodel.getTargetCycles(key);
|
|
409
|
-
var cycle = tmodel.getTargetCycle(key);
|
|
410
|
-
var valuePointer = tmodel.getValueListPointer(key);
|
|
411
|
-
var step = tmodel.getTargetStep(key);
|
|
412
|
-
var remainingMs = elapsedMs;
|
|
413
|
-
while (cycle < cycles) {
|
|
414
|
-
while (remainingMs > 0 && valuePointer < valueList.length) {
|
|
415
|
-
var segmentSteps = stepList[(valuePointer - 1) % stepList.length];
|
|
416
|
-
var interval = intervalList[(valuePointer - 1) % intervalList.length] || 8;
|
|
417
|
-
step = TUtil.limit(step, 0, segmentSteps);
|
|
418
|
-
var remainingSteps = Math.max(segmentSteps - step, 0);
|
|
419
|
-
var remainingSegmentMs = remainingSteps * interval;
|
|
420
|
-
if (remainingMs >= remainingSegmentMs) {
|
|
421
|
-
remainingMs -= remainingSegmentMs;
|
|
422
|
-
valuePointer++;
|
|
423
|
-
step = 0;
|
|
424
|
-
continue;
|
|
425
|
-
}
|
|
426
|
-
var advancedSteps = TUtil.limit(Math.floor(remainingMs / interval), 0, remainingSteps);
|
|
427
|
-
step += advancedSteps;
|
|
428
|
-
remainingMs -= advancedSteps * interval;
|
|
429
|
-
return {
|
|
430
|
-
step: step,
|
|
431
|
-
steps: segmentSteps,
|
|
432
|
-
valuePointer: valuePointer,
|
|
433
|
-
cycle: cycle,
|
|
434
|
-
done: false,
|
|
435
|
-
remainingMs: remainingMs
|
|
436
|
-
};
|
|
437
|
-
}
|
|
438
|
-
if (valuePointer >= valueList.length) {
|
|
439
|
-
cycle++;
|
|
440
|
-
if (cycle >= cycles) {
|
|
441
|
-
var finalPointer = valueList.length;
|
|
442
|
-
var finalStepIndex = Math.max(0, valueList.length - 2);
|
|
443
|
-
var finalSteps = stepList[finalStepIndex % stepList.length];
|
|
444
|
-
return {
|
|
445
|
-
step: finalSteps,
|
|
446
|
-
steps: finalSteps,
|
|
447
|
-
valuePointer: finalPointer,
|
|
448
|
-
cycle: cycles,
|
|
449
|
-
done: true,
|
|
450
|
-
remainingMs: remainingMs
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
valuePointer = 1;
|
|
454
|
-
step = 0;
|
|
455
|
-
if (remainingMs <= 0) {
|
|
456
|
-
break;
|
|
457
|
-
}
|
|
458
|
-
continue;
|
|
459
|
-
}
|
|
460
|
-
break;
|
|
461
|
-
}
|
|
462
|
-
var currentSteps = stepList[(valuePointer - 1) % stepList.length];
|
|
463
|
-
return {
|
|
464
|
-
step: step,
|
|
465
|
-
steps: currentSteps,
|
|
466
|
-
valuePointer: valuePointer,
|
|
467
|
-
cycle: cycle,
|
|
468
|
-
remainingMs: remainingMs,
|
|
469
|
-
done: cycle >= cycles
|
|
470
|
-
};
|
|
382
|
+
key: "hasWebGpu",
|
|
383
|
+
value: function hasWebGpu() {
|
|
384
|
+
return typeof navigator !== "undefined" && !!navigator.gpu && !!globalThis.GPUBufferUsage && !!globalThis.GPUTextureUsage && globalThis.isSecureContext === true;
|
|
471
385
|
}
|
|
472
386
|
}]);
|
|
473
387
|
}();
|
|
388
|
+
_defineProperty(TUtil, "webGpuAvailable", false);
|
|
389
|
+
_defineProperty(TUtil, "webGpuInitPromise", void 0);
|
|
474
390
|
export { TUtil };
|
package/build/TargetManager.js
CHANGED
|
@@ -248,7 +248,7 @@ var TargetManager = /*#__PURE__*/function () {
|
|
|
248
248
|
done: false
|
|
249
249
|
};
|
|
250
250
|
}
|
|
251
|
-
var progress =
|
|
251
|
+
var progress = ScheduleUtil.advanceTargetByElapsed(tmodel, key);
|
|
252
252
|
var step = progress.step;
|
|
253
253
|
var valuePointer = progress.valuePointer;
|
|
254
254
|
var cycle = progress.cycle;
|
package/build/TargetParser.js
CHANGED
|
@@ -115,11 +115,20 @@ var TargetParser = /*#__PURE__*/function () {
|
|
|
115
115
|
value: function getTargetInstances(tmodel, key) {
|
|
116
116
|
var target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : tmodel.targets[key];
|
|
117
117
|
var cycle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : tmodel.getTargetCycle(key);
|
|
118
|
-
if (!target || _typeof(target) !==
|
|
118
|
+
if (!target || _typeof(target) !== "object" || !TUtil.isDefined(target.instances)) {
|
|
119
119
|
return 1;
|
|
120
120
|
}
|
|
121
|
-
var instances = typeof target.instances ===
|
|
122
|
-
|
|
121
|
+
var instances = typeof target.instances === "function" ? target.instances.call(tmodel, cycle) : target.instances;
|
|
122
|
+
var requested = Math.max(1, Math.floor(Number(instances) || 1));
|
|
123
|
+
if (!TUtil.webGpuAvailable && target.renderer !== "dom") {
|
|
124
|
+
var maxDomInstances = Math.max(1, Math.floor(Number(target.maxDomInstances) || 100));
|
|
125
|
+
var count = Math.min(requested, maxDomInstances);
|
|
126
|
+
if (count < requested) {
|
|
127
|
+
console.warn("TargetJS: ".concat(key, " reduced from ").concat(requested, " to ").concat(count, " children for DOM fallback."));
|
|
128
|
+
}
|
|
129
|
+
return count;
|
|
130
|
+
}
|
|
131
|
+
return requested;
|
|
123
132
|
}
|
|
124
133
|
}, {
|
|
125
134
|
key: "getInstanceTargetValue",
|