targetj 1.0.259 → 1.0.260
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/Export.js +13 -1
- package/README.md +18 -25
- package/build/AnimationUtil.js +1 -8
- package/build/App.js +3 -2
- package/build/BaseModel.js +31 -10
- package/build/Child.js +504 -0
- package/build/LocationManager.js +30 -0
- package/build/ParticleRenderer.js +637 -0
- package/build/ParticleRuntime.js +898 -0
- package/build/ParticleTModel.js +1040 -0
- package/build/ParticleUtil.js +317 -0
- package/build/ScheduleUtil.js +2 -2
- package/build/StateManager.js +173 -26
- package/build/StateUtil.js +13 -14
- package/build/TModel.js +61 -27
- package/build/TModelFactory.js +48 -0
- package/build/TModelManager.js +55 -22
- package/build/TUtil.js +8 -3
- package/build/TargetData.js +1 -1
- package/build/TargetExecutor.js +52 -6
- package/build/TargetManager.js +5 -2
- package/build/TargetParser.js +19 -2
- package/build/TargetUtil.js +2 -2
- package/build/Viewport.js +2 -2
- package/build/index.js +5 -1
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1040 @@
|
|
|
1
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
2
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
3
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
4
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
5
|
+
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; } } }; }
|
|
6
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
8
|
+
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; }
|
|
9
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
15
|
+
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); }
|
|
16
|
+
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; }
|
|
17
|
+
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); }
|
|
18
|
+
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); }); }; }
|
|
19
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
20
|
+
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); } }
|
|
21
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
22
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
23
|
+
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); }
|
|
24
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
25
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
26
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
27
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
28
|
+
function _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }
|
|
29
|
+
function _get() { return _get = "undefined" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }
|
|
30
|
+
function _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }
|
|
31
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
32
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
33
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
34
|
+
import { TModel } from "./TModel.js";
|
|
35
|
+
import { TModelFactory } from "./TModelFactory.js";
|
|
36
|
+
import { ParticleRenderer } from "./ParticleRenderer.js";
|
|
37
|
+
import { ParticleRuntime } from "./ParticleRuntime.js";
|
|
38
|
+
import { ParticleUtil } from "./ParticleUtil.js";
|
|
39
|
+
import { TargetParser } from "./TargetParser.js";
|
|
40
|
+
import { TargetUtil } from "./TargetUtil.js";
|
|
41
|
+
import { TUtil } from "./TUtil.js";
|
|
42
|
+
import { Child } from "./Child.js";
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* It provides a TModel that can render instanced addChildren values on the GPU.
|
|
46
|
+
*/
|
|
47
|
+
var ParticleTModel = /*#__PURE__*/function (_TModel) {
|
|
48
|
+
function ParticleTModel(type, targets, oid) {
|
|
49
|
+
var _this;
|
|
50
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
51
|
+
_classCallCheck(this, ParticleTModel);
|
|
52
|
+
_this = _callSuper(this, ParticleTModel, [type, targets, oid, options]);
|
|
53
|
+
_this.particleValues = [];
|
|
54
|
+
_this.particleValuesDirty = false;
|
|
55
|
+
_this.particleRenderRequested = false;
|
|
56
|
+
_this.childHandles = [];
|
|
57
|
+
_this.childTargetValues = {};
|
|
58
|
+
_this.childTransitions = {};
|
|
59
|
+
_this.pendingGpuChildren = {};
|
|
60
|
+
|
|
61
|
+
/*
|
|
62
|
+
* Logical lightweight-child runtime state remains directly on the TModel
|
|
63
|
+
* so it can participate in runtime checkpointing.
|
|
64
|
+
*/
|
|
65
|
+
_this.childRuntimePrograms = [];
|
|
66
|
+
_this.childRuntimeStates = [];
|
|
67
|
+
_this.pendingGpuChildRuntimeCounts = {};
|
|
68
|
+
_this.activeChildTransitionKey = undefined;
|
|
69
|
+
_this.gpuChildrenEnabled = false;
|
|
70
|
+
_this.layoutEpoch = 0;
|
|
71
|
+
_this.completeLayoutEpoch = -1;
|
|
72
|
+
_this.layoutCompleteWaiters = [];
|
|
73
|
+
_this.particleSyncPromise = undefined;
|
|
74
|
+
_this.restoringParticleRuntime = false;
|
|
75
|
+
_this.particleRuntime = new ParticleRuntime(_this);
|
|
76
|
+
_this.particleRenderer = new ParticleRenderer(_this);
|
|
77
|
+
return _this;
|
|
78
|
+
}
|
|
79
|
+
_inherits(ParticleTModel, _TModel);
|
|
80
|
+
return _createClass(ParticleTModel, [{
|
|
81
|
+
key: "onDomReady",
|
|
82
|
+
value: function () {
|
|
83
|
+
var _onDomReady = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
84
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
85
|
+
while (1) switch (_context.prev = _context.next) {
|
|
86
|
+
case 0:
|
|
87
|
+
if (!this.restoringParticleRuntime) {
|
|
88
|
+
_context.next = 2;
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
return _context.abrupt("return");
|
|
92
|
+
case 2:
|
|
93
|
+
_context.next = 4;
|
|
94
|
+
return this.syncParticleRenderer();
|
|
95
|
+
case 4:
|
|
96
|
+
this.particleRuntime.markPendingRenderReady();
|
|
97
|
+
case 5:
|
|
98
|
+
case "end":
|
|
99
|
+
return _context.stop();
|
|
100
|
+
}
|
|
101
|
+
}, _callee, this);
|
|
102
|
+
}));
|
|
103
|
+
function onDomReady() {
|
|
104
|
+
return _onDomReady.apply(this, arguments);
|
|
105
|
+
}
|
|
106
|
+
return onDomReady;
|
|
107
|
+
}()
|
|
108
|
+
}, {
|
|
109
|
+
key: "restoreRuntimeDomDerivedState",
|
|
110
|
+
value: function () {
|
|
111
|
+
var _restoreRuntimeDomDerivedState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
112
|
+
var restored;
|
|
113
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
114
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
115
|
+
case 0:
|
|
116
|
+
if (!(!this.gpuChildrenEnabled || !this.hasDom())) {
|
|
117
|
+
_context2.next = 3;
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
this.restoringParticleRuntime = false;
|
|
121
|
+
return _context2.abrupt("return", false);
|
|
122
|
+
case 3:
|
|
123
|
+
restored = false;
|
|
124
|
+
_context2.prev = 4;
|
|
125
|
+
_context2.next = 7;
|
|
126
|
+
return this.waitForLayoutComplete();
|
|
127
|
+
case 7:
|
|
128
|
+
_context2.next = 9;
|
|
129
|
+
return this.syncParticleRenderer();
|
|
130
|
+
case 9:
|
|
131
|
+
restored = _context2.sent;
|
|
132
|
+
if (restored) {
|
|
133
|
+
_context2.next = 12;
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
return _context2.abrupt("return", false);
|
|
137
|
+
case 12:
|
|
138
|
+
_context2.next = 14;
|
|
139
|
+
return this.particleRenderer.waitForPresentedFrame();
|
|
140
|
+
case 14:
|
|
141
|
+
_context2.prev = 14;
|
|
142
|
+
this.restoringParticleRuntime = false;
|
|
143
|
+
return _context2.finish(14);
|
|
144
|
+
case 17:
|
|
145
|
+
if (restored) {
|
|
146
|
+
this.particleRuntime.resumeRestored();
|
|
147
|
+
}
|
|
148
|
+
return _context2.abrupt("return", restored);
|
|
149
|
+
case 19:
|
|
150
|
+
case "end":
|
|
151
|
+
return _context2.stop();
|
|
152
|
+
}
|
|
153
|
+
}, _callee2, this, [[4,, 14, 17]]);
|
|
154
|
+
}));
|
|
155
|
+
function restoreRuntimeDomDerivedState() {
|
|
156
|
+
return _restoreRuntimeDomDerivedState.apply(this, arguments);
|
|
157
|
+
}
|
|
158
|
+
return restoreRuntimeDomDerivedState;
|
|
159
|
+
}()
|
|
160
|
+
}, {
|
|
161
|
+
key: "syncParticleRenderer",
|
|
162
|
+
value: function syncParticleRenderer() {
|
|
163
|
+
var _this2 = this;
|
|
164
|
+
if (this.particleSyncPromise) {
|
|
165
|
+
return this.particleSyncPromise;
|
|
166
|
+
}
|
|
167
|
+
this.particleSyncPromise = this.syncParticleRendererNow().finally(function () {
|
|
168
|
+
_this2.particleSyncPromise = undefined;
|
|
169
|
+
});
|
|
170
|
+
return this.particleSyncPromise;
|
|
171
|
+
}
|
|
172
|
+
}, {
|
|
173
|
+
key: "syncParticleRendererNow",
|
|
174
|
+
value: function () {
|
|
175
|
+
var _syncParticleRendererNow = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
176
|
+
var key, targetName, transition;
|
|
177
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
178
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
179
|
+
case 0:
|
|
180
|
+
if (!(!this.gpuChildrenEnabled || !this.hasDom())) {
|
|
181
|
+
_context3.next = 2;
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
return _context3.abrupt("return", false);
|
|
185
|
+
case 2:
|
|
186
|
+
if (!this.particleValues.length) {
|
|
187
|
+
_context3.next = 7;
|
|
188
|
+
break;
|
|
189
|
+
}
|
|
190
|
+
_context3.next = 5;
|
|
191
|
+
return this.particleRenderer.setParticles(this.particleValues);
|
|
192
|
+
case 5:
|
|
193
|
+
_context3.next = 9;
|
|
194
|
+
break;
|
|
195
|
+
case 7:
|
|
196
|
+
_context3.next = 9;
|
|
197
|
+
return this.particleRenderer.init();
|
|
198
|
+
case 9:
|
|
199
|
+
key = this.activeChildTransitionKey;
|
|
200
|
+
if (key) {
|
|
201
|
+
_context3.next = 12;
|
|
202
|
+
break;
|
|
203
|
+
}
|
|
204
|
+
return _context3.abrupt("return", true);
|
|
205
|
+
case 12:
|
|
206
|
+
targetName = TargetUtil.getTargetName(key);
|
|
207
|
+
transition = this.childTransitions[targetName];
|
|
208
|
+
if (transition) {
|
|
209
|
+
_context3.next = 16;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
return _context3.abrupt("return", true);
|
|
213
|
+
case 16:
|
|
214
|
+
_context3.next = 18;
|
|
215
|
+
return this.particleRenderer.setTargetParticles(transition.values, transition.steps);
|
|
216
|
+
case 18:
|
|
217
|
+
this.handleSpecialTargetStep(key);
|
|
218
|
+
return _context3.abrupt("return", true);
|
|
219
|
+
case 20:
|
|
220
|
+
case "end":
|
|
221
|
+
return _context3.stop();
|
|
222
|
+
}
|
|
223
|
+
}, _callee3, this);
|
|
224
|
+
}));
|
|
225
|
+
function syncParticleRendererNow() {
|
|
226
|
+
return _syncParticleRendererNow.apply(this, arguments);
|
|
227
|
+
}
|
|
228
|
+
return syncParticleRendererNow;
|
|
229
|
+
}()
|
|
230
|
+
}, {
|
|
231
|
+
key: "requestParticleRender",
|
|
232
|
+
value: function requestParticleRender() {
|
|
233
|
+
var _this3 = this;
|
|
234
|
+
if (this.restoringParticleRuntime || !this.gpuChildrenEnabled || !this.hasDom() || this.particleRenderRequested) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
this.particleRenderRequested = true;
|
|
238
|
+
requestAnimationFrame(function () {
|
|
239
|
+
_this3.particleRenderRequested = false;
|
|
240
|
+
if (_this3.particleValuesDirty) {
|
|
241
|
+
_this3.particleValuesDirty = false;
|
|
242
|
+
_this3.particleRenderer.updateParticles(_this3.particleValues);
|
|
243
|
+
} else {
|
|
244
|
+
_this3.particleRenderer.render();
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
}, {
|
|
249
|
+
key: "getChildrenRenderer",
|
|
250
|
+
value: function getChildrenRenderer() {
|
|
251
|
+
var target = this.targets[TargetUtil.currentTargetName];
|
|
252
|
+
return (target === null || target === void 0 ? void 0 : target.renderer) || "auto";
|
|
253
|
+
}
|
|
254
|
+
}, {
|
|
255
|
+
key: "canRenderChildren",
|
|
256
|
+
value: function canRenderChildren(values) {
|
|
257
|
+
var _this4 = this;
|
|
258
|
+
values = Array.isArray(values) ? values : [values];
|
|
259
|
+
return values.length > 0 && values.every(function (value) {
|
|
260
|
+
if (!value || _typeof(value) !== "object" || Array.isArray(value)) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
return Object.entries(value).every(function (_ref) {
|
|
264
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
265
|
+
key = _ref2[0],
|
|
266
|
+
propertyValue = _ref2[1];
|
|
267
|
+
var cleanKey = TargetUtil.getTargetName(key);
|
|
268
|
+
return key === cleanKey && _this4.supportsChildTarget(cleanKey) && _this4.canRenderChildValue(propertyValue);
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}, {
|
|
273
|
+
key: "canRenderChildValue",
|
|
274
|
+
value: function canRenderChildValue(value) {
|
|
275
|
+
if (typeof value === "function") {
|
|
276
|
+
return false;
|
|
277
|
+
}
|
|
278
|
+
if (!TargetParser.isTargetSpecObject(value)) {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
if (typeof value.value === "function") {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
if (Array.isArray(value.value)) {
|
|
285
|
+
return value.value.length >= 2;
|
|
286
|
+
}
|
|
287
|
+
return true;
|
|
288
|
+
}
|
|
289
|
+
}, {
|
|
290
|
+
key: "supportsChildTarget",
|
|
291
|
+
value: function supportsChildTarget(key) {
|
|
292
|
+
return ParticleUtil.isGpuRenderTarget(key);
|
|
293
|
+
}
|
|
294
|
+
}, {
|
|
295
|
+
key: "affectsChildLayout",
|
|
296
|
+
value: function affectsChildLayout(key) {
|
|
297
|
+
return ParticleUtil.affectsChildLayout(key);
|
|
298
|
+
}
|
|
299
|
+
}, {
|
|
300
|
+
key: "getChild",
|
|
301
|
+
value: function getChild(index) {
|
|
302
|
+
if (!this.gpuChildrenEnabled || typeof index !== "number") {
|
|
303
|
+
return _superPropGet(ParticleTModel, "getChild", this, 3)([index]);
|
|
304
|
+
}
|
|
305
|
+
return this.childHandles[index];
|
|
306
|
+
}
|
|
307
|
+
}, {
|
|
308
|
+
key: "getChildren",
|
|
309
|
+
value: function getChildren() {
|
|
310
|
+
if (!this.gpuChildrenEnabled) {
|
|
311
|
+
return _superPropGet(ParticleTModel, "getChildren", this, 3)([]);
|
|
312
|
+
}
|
|
313
|
+
return this.childHandles;
|
|
314
|
+
}
|
|
315
|
+
}, {
|
|
316
|
+
key: "getChildValue",
|
|
317
|
+
value: function getChildValue(index, key) {
|
|
318
|
+
var _this$particleValues$;
|
|
319
|
+
return (_this$particleValues$ = this.particleValues[index]) === null || _this$particleValues$ === void 0 ? void 0 : _this$particleValues$[TargetUtil.getTargetName(key)];
|
|
320
|
+
}
|
|
321
|
+
}, {
|
|
322
|
+
key: "setChildTarget",
|
|
323
|
+
value: function setChildTarget(index, key, target) {
|
|
324
|
+
var _this$childTargetValu, _this$childTargetValu2, _targetValues$index;
|
|
325
|
+
var targetName = TargetUtil.getTargetName(TargetUtil.currentTargetName);
|
|
326
|
+
var cleanKey = TargetUtil.getTargetName(key);
|
|
327
|
+
if (!targetName) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
if (key !== cleanKey || !this.supportsChildTarget(cleanKey)) {
|
|
331
|
+
throw new Error("GPU child target \"".concat(key, "\" is not supported yet."));
|
|
332
|
+
}
|
|
333
|
+
var targetValues = (_this$childTargetValu2 = (_this$childTargetValu = this.childTargetValues)[targetName]) !== null && _this$childTargetValu2 !== void 0 ? _this$childTargetValu2 : _this$childTargetValu[targetName] = [];
|
|
334
|
+
var childValues = (_targetValues$index = targetValues[index]) !== null && _targetValues$index !== void 0 ? _targetValues$index : targetValues[index] = {};
|
|
335
|
+
childValues[cleanKey] = TargetParser.isTargetSpecObject(target) ? _objectSpread({}, target) : {
|
|
336
|
+
value: target
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}, {
|
|
340
|
+
key: "setChildValue",
|
|
341
|
+
value: function setChildValue(index, key, value) {
|
|
342
|
+
var cleanKey = TargetUtil.getTargetName(key);
|
|
343
|
+
var childValues = this.particleValues[index];
|
|
344
|
+
if (!childValues || childValues[cleanKey] === value) {
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
childValues[cleanKey] = value;
|
|
348
|
+
this.particleValuesDirty = true;
|
|
349
|
+
if (this.affectsChildLayout(cleanKey)) {
|
|
350
|
+
this.invalidateChildrenLayout();
|
|
351
|
+
}
|
|
352
|
+
var child = this.childHandles[index];
|
|
353
|
+
if (child) {
|
|
354
|
+
child.actualValues[cleanKey] = value;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}, {
|
|
358
|
+
key: "setChildLayoutValue",
|
|
359
|
+
value: function setChildLayoutValue(index, key, value) {
|
|
360
|
+
var _this$getScrollLeft, _this$getScrollTop;
|
|
361
|
+
var childValues = this.particleValues[index];
|
|
362
|
+
if (!childValues) {
|
|
363
|
+
return;
|
|
364
|
+
}
|
|
365
|
+
if (this.particleRuntime.isControlled(index, key)) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
var scrollOffset = key === "x" ? (_this$getScrollLeft = this.getScrollLeft()) !== null && _this$getScrollLeft !== void 0 ? _this$getScrollLeft : 0 : key === "y" ? (_this$getScrollTop = this.getScrollTop()) !== null && _this$getScrollTop !== void 0 ? _this$getScrollTop : 0 : 0;
|
|
369
|
+
var layoutValue = value + scrollOffset;
|
|
370
|
+
if (childValues[key] === layoutValue) {
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
childValues[key] = layoutValue;
|
|
374
|
+
this.particleValuesDirty = true;
|
|
375
|
+
}
|
|
376
|
+
}, {
|
|
377
|
+
key: "getChildTargetValues",
|
|
378
|
+
value: function getChildTargetValues(key) {
|
|
379
|
+
return this.childTargetValues[TargetUtil.getTargetName(key)];
|
|
380
|
+
}
|
|
381
|
+
}, {
|
|
382
|
+
key: "handleChildTargets",
|
|
383
|
+
value: function handleChildTargets(key, targetValues) {
|
|
384
|
+
var _this5 = this;
|
|
385
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
386
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
387
|
+
var values = new Array(this.particleValues.length);
|
|
388
|
+
var steps = new Array(this.particleValues.length);
|
|
389
|
+
var defaultSteps = Math.max(0, Number(options.steps) || 0);
|
|
390
|
+
var maxSteps = defaultSteps;
|
|
391
|
+
for (var index = 0; index < this.particleValues.length; index++) {
|
|
392
|
+
var particle = this.particleValues[index];
|
|
393
|
+
var targets = targetValues[index];
|
|
394
|
+
var nextParticle = _objectSpread({}, particle);
|
|
395
|
+
var childSteps = {};
|
|
396
|
+
if (targets) {
|
|
397
|
+
for (var _i = 0, _Object$entries = Object.entries(targets); _i < _Object$entries.length; _i++) {
|
|
398
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
|
399
|
+
property = _Object$entries$_i[0],
|
|
400
|
+
rawTarget = _Object$entries$_i[1];
|
|
401
|
+
var target = TargetParser.isTargetSpecObject(rawTarget) ? rawTarget : {
|
|
402
|
+
value: rawTarget
|
|
403
|
+
};
|
|
404
|
+
nextParticle[property] = target.value;
|
|
405
|
+
var propertySteps = target.steps !== undefined ? Math.max(0, Number(target.steps) || 0) : defaultSteps;
|
|
406
|
+
childSteps[property] = propertySteps;
|
|
407
|
+
maxSteps = Math.max(maxSteps, propertySteps);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
values[index] = nextParticle;
|
|
411
|
+
steps[index] = childSteps;
|
|
412
|
+
}
|
|
413
|
+
this.childTransitions[targetName] = {
|
|
414
|
+
values: values,
|
|
415
|
+
steps: steps
|
|
416
|
+
};
|
|
417
|
+
this.activeChildTransitionKey = key;
|
|
418
|
+
if (this.hasDom()) {
|
|
419
|
+
this.particleRenderer.setTargetParticles(values, steps).then(function () {
|
|
420
|
+
var _this5$childTransitio;
|
|
421
|
+
if (((_this5$childTransitio = _this5.childTransitions[targetName]) === null || _this5$childTransitio === void 0 ? void 0 : _this5$childTransitio.values) === values) {
|
|
422
|
+
_this5.handleSpecialTargetStep(key);
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
return {
|
|
427
|
+
handled: true,
|
|
428
|
+
steps: maxSteps
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
}, {
|
|
432
|
+
key: "handleSpecialTarget",
|
|
433
|
+
value: function handleSpecialTarget(key, value) {
|
|
434
|
+
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
435
|
+
if (!this.gpuChildrenEnabled) {
|
|
436
|
+
return false;
|
|
437
|
+
}
|
|
438
|
+
var targetValues = this.getChildTargetValues(key);
|
|
439
|
+
if (targetValues) {
|
|
440
|
+
return this.handleChildTargets(key, targetValues, options);
|
|
441
|
+
}
|
|
442
|
+
return false;
|
|
443
|
+
}
|
|
444
|
+
}, {
|
|
445
|
+
key: "getRenderScrollLeft",
|
|
446
|
+
value: function getRenderScrollLeft() {
|
|
447
|
+
var _this$getParent$$dom;
|
|
448
|
+
return this.getScrollLeft() || ((_this$getParent$$dom = this.getParent().$dom) === null || _this$getParent$$dom === void 0 ? void 0 : _this$getParent$$dom.getScrollLeft()) || 0;
|
|
449
|
+
}
|
|
450
|
+
}, {
|
|
451
|
+
key: "getRenderScrollTop",
|
|
452
|
+
value: function getRenderScrollTop() {
|
|
453
|
+
var _this$getParent$$dom2;
|
|
454
|
+
return this.getScrollTop() || ((_this$getParent$$dom2 = this.getParent().$dom) === null || _this$getParent$$dom2 === void 0 ? void 0 : _this$getParent$$dom2.getScrollTop()) || 0;
|
|
455
|
+
}
|
|
456
|
+
}, {
|
|
457
|
+
key: "addChild",
|
|
458
|
+
value: function addChild(child) {
|
|
459
|
+
var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.addedChildren.length + this.allChildrenList.length;
|
|
460
|
+
if (child && _typeof(child) === "object" && !(child instanceof TModel) && ParticleUtil.isGpuChildrenTarget(TargetUtil.currentTargetName)) {
|
|
461
|
+
var renderer = this.getChildrenRenderer();
|
|
462
|
+
if (renderer !== "dom") {
|
|
463
|
+
var childDefinition = TUtil.cloneTargetDefinition(child);
|
|
464
|
+
if (renderer === "gpu" || this.canRenderChildren(childDefinition)) {
|
|
465
|
+
this.addGpuChild(childDefinition);
|
|
466
|
+
return this;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
return _superPropGet(ParticleTModel, "addChild", this, 3)([child, index]);
|
|
471
|
+
}
|
|
472
|
+
}, {
|
|
473
|
+
key: "addGpuChild",
|
|
474
|
+
value: function addGpuChild(definition) {
|
|
475
|
+
var key = TargetUtil.currentTargetName;
|
|
476
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
477
|
+
var index = this.particleValues.length;
|
|
478
|
+
this.gpuChildrenEnabled = true;
|
|
479
|
+
|
|
480
|
+
/*
|
|
481
|
+
* A placeholder and Child must exist before function-valued properties
|
|
482
|
+
* are resolved because functions can call Child getters.
|
|
483
|
+
*/
|
|
484
|
+
this.particleValues[index] = {};
|
|
485
|
+
var handle = new Child(this, index);
|
|
486
|
+
this.childHandles[index] = handle;
|
|
487
|
+
try {
|
|
488
|
+
var _this$pendingGpuChild, _this$pendingGpuChild2;
|
|
489
|
+
var compiled = ParticleUtil.compileGpuChildDefinition(handle, definition);
|
|
490
|
+
var child = this.createGpuChild(compiled.renderDefinition);
|
|
491
|
+
if (!child) {
|
|
492
|
+
this.particleValues.pop();
|
|
493
|
+
this.childHandles.pop();
|
|
494
|
+
return false;
|
|
495
|
+
}
|
|
496
|
+
this.particleValues[index] = child.initial;
|
|
497
|
+
Object.assign(handle.actualValues, child.initial);
|
|
498
|
+
this.particleRuntime.registerChild(index, targetName, compiled);
|
|
499
|
+
var pending = (_this$pendingGpuChild2 = (_this$pendingGpuChild = this.pendingGpuChildren)[targetName]) !== null && _this$pendingGpuChild2 !== void 0 ? _this$pendingGpuChild2 : _this$pendingGpuChild[targetName] = {
|
|
500
|
+
key: key,
|
|
501
|
+
children: []
|
|
502
|
+
};
|
|
503
|
+
pending.children.push(_objectSpread({
|
|
504
|
+
index: index
|
|
505
|
+
}, child));
|
|
506
|
+
this.childrenUpdateFlag = true;
|
|
507
|
+
this.markLayoutDirty("addGpuChild");
|
|
508
|
+
return true;
|
|
509
|
+
} catch (error) {
|
|
510
|
+
this.particleValues.pop();
|
|
511
|
+
this.childHandles.pop();
|
|
512
|
+
this.childRuntimePrograms.pop();
|
|
513
|
+
this.childRuntimeStates.pop();
|
|
514
|
+
throw error;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}, {
|
|
518
|
+
key: "isTargetEnabled",
|
|
519
|
+
value: function isTargetEnabled(key) {
|
|
520
|
+
if (ParticleUtil.isGpuChildrenTarget(key) && this.isExecuted(key) && this.particleRuntime.hasPending(key)) {
|
|
521
|
+
return false;
|
|
522
|
+
}
|
|
523
|
+
return _superPropGet(ParticleTModel, "isTargetEnabled", this, 3)([key]);
|
|
524
|
+
}
|
|
525
|
+
}, {
|
|
526
|
+
key: "activateGpuChildTarget",
|
|
527
|
+
value: function activateGpuChildTarget(index, key) {
|
|
528
|
+
return this.particleRuntime.activateTarget(index, key);
|
|
529
|
+
}
|
|
530
|
+
}, {
|
|
531
|
+
key: "createGpuChild",
|
|
532
|
+
value: function createGpuChild(definition) {
|
|
533
|
+
var initial = {};
|
|
534
|
+
var target = {};
|
|
535
|
+
var steps = {};
|
|
536
|
+
var loops = {};
|
|
537
|
+
var valueLists = {};
|
|
538
|
+
var hasTransition = false;
|
|
539
|
+
for (var _i2 = 0, _Object$entries2 = Object.entries(definition); _i2 < _Object$entries2.length; _i2++) {
|
|
540
|
+
var _resolved$valueList;
|
|
541
|
+
var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),
|
|
542
|
+
property = _Object$entries2$_i[0],
|
|
543
|
+
value = _Object$entries2$_i[1];
|
|
544
|
+
var resolved = this.resolveInitialChildProperty(value);
|
|
545
|
+
if (!resolved) {
|
|
546
|
+
return;
|
|
547
|
+
}
|
|
548
|
+
initial[property] = resolved.initialValue;
|
|
549
|
+
target[property] = resolved.targetValue;
|
|
550
|
+
if (resolved.steps !== undefined) {
|
|
551
|
+
steps[property] = resolved.steps;
|
|
552
|
+
}
|
|
553
|
+
if (resolved.valueList) {
|
|
554
|
+
valueLists[property] = resolved.valueList;
|
|
555
|
+
}
|
|
556
|
+
if (resolved.loop) {
|
|
557
|
+
loops[property] = true;
|
|
558
|
+
}
|
|
559
|
+
if (((_resolved$valueList = resolved.valueList) === null || _resolved$valueList === void 0 ? void 0 : _resolved$valueList.length) > 1 || resolved.initialValue !== resolved.targetValue) {
|
|
560
|
+
hasTransition = true;
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return {
|
|
564
|
+
initial: initial,
|
|
565
|
+
target: target,
|
|
566
|
+
steps: steps,
|
|
567
|
+
loops: loops,
|
|
568
|
+
valueLists: valueLists,
|
|
569
|
+
hasTransition: hasTransition
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
}, {
|
|
573
|
+
key: "finalizeChildrenTarget",
|
|
574
|
+
value: function finalizeChildrenTarget(key) {
|
|
575
|
+
var _this6 = this;
|
|
576
|
+
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
577
|
+
if (!ParticleUtil.isGpuChildrenTarget(key)) {
|
|
578
|
+
return false;
|
|
579
|
+
}
|
|
580
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
581
|
+
var pending = this.pendingGpuChildren[targetName];
|
|
582
|
+
if (!(pending !== null && pending !== void 0 && pending.children.length)) {
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
585
|
+
this.invalidateChildrenLayout();
|
|
586
|
+
var defaultSteps = Math.max(0, Number(options.steps) || 0);
|
|
587
|
+
var currentValues = this.particleValues;
|
|
588
|
+
var segmentCount = this.getChildrenSegmentCount(pending.children);
|
|
589
|
+
var segment = this.buildChildTransitionSegment(pending.children, 0, currentValues, defaultSteps);
|
|
590
|
+
delete this.pendingGpuChildren[targetName];
|
|
591
|
+
if (!segment.hasSegment || segment.maxSteps === 0) {
|
|
592
|
+
this.particleValues = segment.values;
|
|
593
|
+
var runtimeIndexes = pending.children.map(function (child) {
|
|
594
|
+
return child.index;
|
|
595
|
+
}).filter(function (index) {
|
|
596
|
+
var _this6$childRuntimePr;
|
|
597
|
+
return (_this6$childRuntimePr = _this6.childRuntimePrograms[index]) === null || _this6$childRuntimePr === void 0 ? void 0 : _this6$childRuntimePr.length;
|
|
598
|
+
});
|
|
599
|
+
var _iterator = _createForOfIteratorHelper(runtimeIndexes),
|
|
600
|
+
_step;
|
|
601
|
+
try {
|
|
602
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
603
|
+
var index = _step.value;
|
|
604
|
+
this.particleRuntime.queueStart(index);
|
|
605
|
+
}
|
|
606
|
+
} catch (err) {
|
|
607
|
+
_iterator.e(err);
|
|
608
|
+
} finally {
|
|
609
|
+
_iterator.f();
|
|
610
|
+
}
|
|
611
|
+
if (this.hasDom()) {
|
|
612
|
+
this.particleRenderer.setParticles(segment.values).then(function () {
|
|
613
|
+
_this6.particleRuntime.markRenderReady(runtimeIndexes);
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
return {
|
|
617
|
+
handled: true,
|
|
618
|
+
steps: 0
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
this.childTransitions[targetName] = {
|
|
622
|
+
children: pending.children,
|
|
623
|
+
segmentIndex: 0,
|
|
624
|
+
segmentCount: segmentCount,
|
|
625
|
+
defaultSteps: defaultSteps,
|
|
626
|
+
values: segment.values,
|
|
627
|
+
steps: segment.steps,
|
|
628
|
+
loops: segment.loops,
|
|
629
|
+
hasLoop: segment.hasLoop
|
|
630
|
+
};
|
|
631
|
+
this.activeChildTransitionKey = key;
|
|
632
|
+
return {
|
|
633
|
+
handled: true,
|
|
634
|
+
steps: segment.maxSteps
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
}, {
|
|
638
|
+
key: "advanceChildTransitionSegment",
|
|
639
|
+
value: function advanceChildTransitionSegment(key, transition) {
|
|
640
|
+
var _this7 = this;
|
|
641
|
+
if (!transition || !Array.isArray(transition.children) || !Number.isInteger(transition.segmentIndex) || !Number.isInteger(transition.segmentCount)) {
|
|
642
|
+
return false;
|
|
643
|
+
}
|
|
644
|
+
var nextSegmentIndex = transition.segmentIndex + 1;
|
|
645
|
+
if (nextSegmentIndex >= transition.segmentCount) {
|
|
646
|
+
return false;
|
|
647
|
+
}
|
|
648
|
+
this.particleValues = transition.values;
|
|
649
|
+
this.particleRenderer.completeTransition();
|
|
650
|
+
var segment = this.buildChildTransitionSegment(transition.children, nextSegmentIndex, this.particleValues, transition.defaultSteps);
|
|
651
|
+
transition.segmentIndex = nextSegmentIndex;
|
|
652
|
+
transition.values = segment.values;
|
|
653
|
+
transition.steps = segment.steps;
|
|
654
|
+
transition.loops = segment.loops;
|
|
655
|
+
var targetValue = this.targetValues[key];
|
|
656
|
+
if (targetValue) {
|
|
657
|
+
targetValue.steps = segment.maxSteps;
|
|
658
|
+
}
|
|
659
|
+
this.resetTargetStep(key);
|
|
660
|
+
this.resetTargetInitialValue(key);
|
|
661
|
+
this.setTargetStatus(key, "updating");
|
|
662
|
+
if (this.hasDom()) {
|
|
663
|
+
this.particleRenderer.setTargetParticles(segment.values, segment.steps).then(function () {
|
|
664
|
+
if (_this7.childTransitions[TargetUtil.getTargetName(key)] === transition) {
|
|
665
|
+
_this7.handleSpecialTargetStep(key);
|
|
666
|
+
}
|
|
667
|
+
});
|
|
668
|
+
}
|
|
669
|
+
return true;
|
|
670
|
+
}
|
|
671
|
+
}, {
|
|
672
|
+
key: "buildChildTransitionSegment",
|
|
673
|
+
value: function buildChildTransitionSegment(children, segmentIndex, currentValues, defaultSteps) {
|
|
674
|
+
var values = currentValues.map(function (value) {
|
|
675
|
+
return _objectSpread({}, value);
|
|
676
|
+
});
|
|
677
|
+
var steps = Array.from({
|
|
678
|
+
length: currentValues.length
|
|
679
|
+
}, function () {
|
|
680
|
+
return {};
|
|
681
|
+
});
|
|
682
|
+
var loops = Array.from({
|
|
683
|
+
length: currentValues.length
|
|
684
|
+
}, function () {
|
|
685
|
+
return {};
|
|
686
|
+
});
|
|
687
|
+
var maxSteps = 0;
|
|
688
|
+
var hasSegment = false;
|
|
689
|
+
var hasLoop = false;
|
|
690
|
+
var _iterator2 = _createForOfIteratorHelper(children),
|
|
691
|
+
_step2;
|
|
692
|
+
try {
|
|
693
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
694
|
+
var child = _step2.value;
|
|
695
|
+
var current = currentValues[child.index];
|
|
696
|
+
var target = _objectSpread({}, current);
|
|
697
|
+
for (var _i3 = 0, _Object$keys = Object.keys(child.target); _i3 < _Object$keys.length; _i3++) {
|
|
698
|
+
var property = _Object$keys[_i3];
|
|
699
|
+
var valueList = child.valueLists[property];
|
|
700
|
+
if (valueList) {
|
|
701
|
+
if (segmentIndex >= valueList.length - 1) {
|
|
702
|
+
continue;
|
|
703
|
+
}
|
|
704
|
+
target[property] = valueList[segmentIndex + 1];
|
|
705
|
+
var _propertySteps = this.getChildPropertySteps(child, property, segmentIndex, defaultSteps);
|
|
706
|
+
steps[child.index][property] = _propertySteps;
|
|
707
|
+
loops[child.index][property] = child.loops[property] === true;
|
|
708
|
+
maxSteps = Math.max(maxSteps, _propertySteps);
|
|
709
|
+
hasSegment = true;
|
|
710
|
+
if (child.loops[property]) {
|
|
711
|
+
hasLoop = true;
|
|
712
|
+
}
|
|
713
|
+
continue;
|
|
714
|
+
}
|
|
715
|
+
if (segmentIndex !== 0 || current[property] === child.target[property]) {
|
|
716
|
+
continue;
|
|
717
|
+
}
|
|
718
|
+
target[property] = child.target[property];
|
|
719
|
+
var propertySteps = this.getChildPropertySteps(child, property, segmentIndex, defaultSteps);
|
|
720
|
+
steps[child.index][property] = propertySteps;
|
|
721
|
+
loops[child.index][property] = child.loops[property] === true;
|
|
722
|
+
maxSteps = Math.max(maxSteps, propertySteps);
|
|
723
|
+
hasSegment = true;
|
|
724
|
+
if (child.loops[property]) {
|
|
725
|
+
hasLoop = true;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
values[child.index] = target;
|
|
729
|
+
}
|
|
730
|
+
} catch (err) {
|
|
731
|
+
_iterator2.e(err);
|
|
732
|
+
} finally {
|
|
733
|
+
_iterator2.f();
|
|
734
|
+
}
|
|
735
|
+
return {
|
|
736
|
+
values: values,
|
|
737
|
+
steps: steps,
|
|
738
|
+
loops: loops,
|
|
739
|
+
maxSteps: maxSteps,
|
|
740
|
+
hasSegment: hasSegment,
|
|
741
|
+
hasLoop: hasLoop
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
}, {
|
|
745
|
+
key: "getChildPropertySteps",
|
|
746
|
+
value: function getChildPropertySteps(child, property, segmentIndex, defaultSteps) {
|
|
747
|
+
var steps = child.steps[property];
|
|
748
|
+
if (Array.isArray(steps)) {
|
|
749
|
+
if (!steps.length) {
|
|
750
|
+
return defaultSteps;
|
|
751
|
+
}
|
|
752
|
+
return Math.max(0, Number(steps[segmentIndex % steps.length]) || 0);
|
|
753
|
+
}
|
|
754
|
+
return steps !== undefined ? Math.max(0, Number(steps) || 0) : defaultSteps;
|
|
755
|
+
}
|
|
756
|
+
}, {
|
|
757
|
+
key: "getChildSegmentCount",
|
|
758
|
+
value: function getChildSegmentCount(child) {
|
|
759
|
+
var count = 0;
|
|
760
|
+
for (var _i4 = 0, _Object$values = Object.values(child.valueLists); _i4 < _Object$values.length; _i4++) {
|
|
761
|
+
var valueList = _Object$values[_i4];
|
|
762
|
+
count = Math.max(count, valueList.length - 1);
|
|
763
|
+
}
|
|
764
|
+
return count;
|
|
765
|
+
}
|
|
766
|
+
}, {
|
|
767
|
+
key: "getChildrenSegmentCount",
|
|
768
|
+
value: function getChildrenSegmentCount(children) {
|
|
769
|
+
var count = 0;
|
|
770
|
+
var _iterator3 = _createForOfIteratorHelper(children),
|
|
771
|
+
_step3;
|
|
772
|
+
try {
|
|
773
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
774
|
+
var child = _step3.value;
|
|
775
|
+
count = Math.max(count, this.getChildSegmentCount(child));
|
|
776
|
+
}
|
|
777
|
+
} catch (err) {
|
|
778
|
+
_iterator3.e(err);
|
|
779
|
+
} finally {
|
|
780
|
+
_iterator3.f();
|
|
781
|
+
}
|
|
782
|
+
return count;
|
|
783
|
+
}
|
|
784
|
+
}, {
|
|
785
|
+
key: "getActiveChildTransition",
|
|
786
|
+
value: function getActiveChildTransition() {
|
|
787
|
+
if (!this.activeChildTransitionKey) {
|
|
788
|
+
return;
|
|
789
|
+
}
|
|
790
|
+
var targetName = TargetUtil.getTargetName(this.activeChildTransitionKey);
|
|
791
|
+
return this.childTransitions[targetName];
|
|
792
|
+
}
|
|
793
|
+
}, {
|
|
794
|
+
key: "handleSpecialTargetStep",
|
|
795
|
+
value: function handleSpecialTargetStep(key) {
|
|
796
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
797
|
+
if (!this.childTransitions[targetName]) {
|
|
798
|
+
return false;
|
|
799
|
+
}
|
|
800
|
+
this.particleRenderer.setTransitionStep(this.getTargetStep(key));
|
|
801
|
+
return true;
|
|
802
|
+
}
|
|
803
|
+
}, {
|
|
804
|
+
key: "handleSpecialTargetEnd",
|
|
805
|
+
value: function handleSpecialTargetEnd(key) {
|
|
806
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
807
|
+
var transition = this.childTransitions[targetName];
|
|
808
|
+
if (!transition) {
|
|
809
|
+
return false;
|
|
810
|
+
}
|
|
811
|
+
if (this.advanceChildTransitionSegment(key, transition)) {
|
|
812
|
+
return true;
|
|
813
|
+
}
|
|
814
|
+
if (transition.hasLoop) {
|
|
815
|
+
this.restartChildTransition(key, transition);
|
|
816
|
+
return true;
|
|
817
|
+
}
|
|
818
|
+
this.particleValues = transition.values;
|
|
819
|
+
this.particleRenderer.completeTransition();
|
|
820
|
+
delete this.childTransitions[targetName];
|
|
821
|
+
delete this.childTargetValues[targetName];
|
|
822
|
+
if (this.activeChildTransitionKey === key) {
|
|
823
|
+
this.activeChildTransitionKey = undefined;
|
|
824
|
+
}
|
|
825
|
+
return true;
|
|
826
|
+
}
|
|
827
|
+
}, {
|
|
828
|
+
key: "resolveInitialChildProperty",
|
|
829
|
+
value: function resolveInitialChildProperty(value) {
|
|
830
|
+
if (!TargetParser.isTargetSpecObject(value)) {
|
|
831
|
+
return {
|
|
832
|
+
initialValue: value,
|
|
833
|
+
targetValue: value,
|
|
834
|
+
valueList: undefined,
|
|
835
|
+
steps: undefined,
|
|
836
|
+
loop: false
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
var targetValue = value.value;
|
|
840
|
+
var steps = Array.isArray(value.steps) ? value.steps.map(function (step) {
|
|
841
|
+
return Math.max(0, Number(step) || 0);
|
|
842
|
+
}) : value.steps !== undefined ? Math.max(0, Number(value.steps) || 0) : undefined;
|
|
843
|
+
var loop = value.loop === true;
|
|
844
|
+
if (Array.isArray(targetValue)) {
|
|
845
|
+
if (targetValue.length < 2) {
|
|
846
|
+
return;
|
|
847
|
+
}
|
|
848
|
+
return {
|
|
849
|
+
initialValue: targetValue[0],
|
|
850
|
+
targetValue: targetValue[1],
|
|
851
|
+
valueList: _toConsumableArray(targetValue),
|
|
852
|
+
steps: steps,
|
|
853
|
+
loop: loop
|
|
854
|
+
};
|
|
855
|
+
}
|
|
856
|
+
return {
|
|
857
|
+
initialValue: targetValue,
|
|
858
|
+
targetValue: targetValue,
|
|
859
|
+
valueList: undefined,
|
|
860
|
+
steps: 0,
|
|
861
|
+
loop: loop
|
|
862
|
+
};
|
|
863
|
+
}
|
|
864
|
+
}, {
|
|
865
|
+
key: "restartChildTransition",
|
|
866
|
+
value: function restartChildTransition(key, transition) {
|
|
867
|
+
if (!(transition !== null && transition !== void 0 && transition.hasLoop)) {
|
|
868
|
+
return false;
|
|
869
|
+
}
|
|
870
|
+
this.resetTargetStep(key);
|
|
871
|
+
this.resetTargetInitialValue(key);
|
|
872
|
+
this.setTargetStatus(key, "updating");
|
|
873
|
+
this.handleSpecialTargetStep(key);
|
|
874
|
+
return true;
|
|
875
|
+
}
|
|
876
|
+
}, {
|
|
877
|
+
key: "shouldCalculateChildren",
|
|
878
|
+
value: function shouldCalculateChildren() {
|
|
879
|
+
if (!this.gpuChildrenEnabled) {
|
|
880
|
+
return _superPropGet(ParticleTModel, "shouldCalculateChildren", this, 3)([]);
|
|
881
|
+
}
|
|
882
|
+
if (this.completeLayoutEpoch === this.layoutEpoch && !this.hasChildrenLayoutStateChanged()) {
|
|
883
|
+
this.currentStatus = undefined;
|
|
884
|
+
this.requestParticleRender();
|
|
885
|
+
return false;
|
|
886
|
+
}
|
|
887
|
+
return _superPropGet(ParticleTModel, "shouldCalculateChildren", this, 3)([]);
|
|
888
|
+
}
|
|
889
|
+
}, {
|
|
890
|
+
key: "getChildrenLayoutState",
|
|
891
|
+
value: function getChildrenLayoutState() {
|
|
892
|
+
return [this.getWidth(), this.getHeight(), this.val("gap"), this.getPaddingTop(), this.getPaddingRight(), this.getPaddingBottom(), this.getPaddingLeft(), this.getContainerOverflowMode()];
|
|
893
|
+
}
|
|
894
|
+
}, {
|
|
895
|
+
key: "markLayoutComplete",
|
|
896
|
+
value: function markLayoutComplete(epoch) {
|
|
897
|
+
var _this8 = this;
|
|
898
|
+
if (epoch !== this.layoutEpoch) {
|
|
899
|
+
return;
|
|
900
|
+
}
|
|
901
|
+
this.completeLayoutEpoch = epoch;
|
|
902
|
+
this.completeChildrenLayoutState = this.getChildrenLayoutState();
|
|
903
|
+
if (this.particleRuntime.resolveLayoutFunctions()) {
|
|
904
|
+
this.requestParticleRender();
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
this.resolveLayoutCompleteWaiters();
|
|
908
|
+
this.particleRuntime.startReady();
|
|
909
|
+
var key = this.activeChildTransitionKey;
|
|
910
|
+
if (!key) {
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
var targetName = TargetUtil.getTargetName(key);
|
|
914
|
+
var transition = this.childTransitions[targetName];
|
|
915
|
+
if (!transition) {
|
|
916
|
+
return;
|
|
917
|
+
}
|
|
918
|
+
transition.values = transition.values.map(function (target, index) {
|
|
919
|
+
return _objectSpread(_objectSpread({}, _this8.particleValues[index]), target);
|
|
920
|
+
});
|
|
921
|
+
if (this.restoringParticleRuntime || !this.hasDom()) {
|
|
922
|
+
return;
|
|
923
|
+
}
|
|
924
|
+
this.particleRenderer.setParticles(this.particleValues).then(function () {
|
|
925
|
+
return _this8.particleRenderer.setTargetParticles(transition.values, transition.steps);
|
|
926
|
+
}).then(function () {
|
|
927
|
+
if (_this8.childTransitions[targetName] === transition) {
|
|
928
|
+
_this8.handleSpecialTargetStep(key);
|
|
929
|
+
}
|
|
930
|
+
});
|
|
931
|
+
}
|
|
932
|
+
}, {
|
|
933
|
+
key: "hasChildrenLayoutStateChanged",
|
|
934
|
+
value: function hasChildrenLayoutStateChanged() {
|
|
935
|
+
var current = this.getChildrenLayoutState();
|
|
936
|
+
var previous = this.completeChildrenLayoutState;
|
|
937
|
+
if (!previous || current.length !== previous.length) {
|
|
938
|
+
return true;
|
|
939
|
+
}
|
|
940
|
+
return current.some(function (value, index) {
|
|
941
|
+
return value !== previous[index];
|
|
942
|
+
});
|
|
943
|
+
}
|
|
944
|
+
}, {
|
|
945
|
+
key: "invalidateChildrenLayout",
|
|
946
|
+
value: function invalidateChildrenLayout() {
|
|
947
|
+
this.layoutEpoch++;
|
|
948
|
+
}
|
|
949
|
+
}, {
|
|
950
|
+
key: "getParticleCount",
|
|
951
|
+
value: function getParticleCount() {
|
|
952
|
+
return this.particleValues.length;
|
|
953
|
+
}
|
|
954
|
+
}, {
|
|
955
|
+
key: "excludeRuntimeSnapshotField",
|
|
956
|
+
value: function excludeRuntimeSnapshotField(key) {
|
|
957
|
+
return ParticleUtil.isTransientRuntimeField(key);
|
|
958
|
+
}
|
|
959
|
+
}, {
|
|
960
|
+
key: "restoreRuntimeDerivedState",
|
|
961
|
+
value: function restoreRuntimeDerivedState() {
|
|
962
|
+
var _this9 = this;
|
|
963
|
+
this.childHandles = this.particleValues.map(function (value, index) {
|
|
964
|
+
return new Child(_this9, index);
|
|
965
|
+
});
|
|
966
|
+
this.particleValuesDirty = false;
|
|
967
|
+
this.particleRenderRequested = false;
|
|
968
|
+
this.pendingGpuChildren = {};
|
|
969
|
+
this.layoutEpoch = 0;
|
|
970
|
+
this.completeLayoutEpoch = 0;
|
|
971
|
+
this.completeChildrenLayoutState = this.getChildrenLayoutState();
|
|
972
|
+
this.layoutCompleteWaiters = [];
|
|
973
|
+
this.particleSyncPromise = undefined;
|
|
974
|
+
this.restoringParticleRuntime = true;
|
|
975
|
+
this.particleRuntime = new ParticleRuntime(this);
|
|
976
|
+
this.particleRuntime.prepareRestore();
|
|
977
|
+
this.particleRenderer = new ParticleRenderer(this);
|
|
978
|
+
}
|
|
979
|
+
}, {
|
|
980
|
+
key: "waitForLayoutComplete",
|
|
981
|
+
value: function waitForLayoutComplete() {
|
|
982
|
+
var _this10 = this;
|
|
983
|
+
if (this.completeLayoutEpoch === this.layoutEpoch) {
|
|
984
|
+
return Promise.resolve();
|
|
985
|
+
}
|
|
986
|
+
return new Promise(function (resolve) {
|
|
987
|
+
_this10.layoutCompleteWaiters.push(resolve);
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
}, {
|
|
991
|
+
key: "resolveLayoutCompleteWaiters",
|
|
992
|
+
value: function resolveLayoutCompleteWaiters() {
|
|
993
|
+
var waiters = this.layoutCompleteWaiters.splice(0);
|
|
994
|
+
var _iterator4 = _createForOfIteratorHelper(waiters),
|
|
995
|
+
_step4;
|
|
996
|
+
try {
|
|
997
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
998
|
+
var resolve = _step4.value;
|
|
999
|
+
resolve();
|
|
1000
|
+
}
|
|
1001
|
+
} catch (err) {
|
|
1002
|
+
_iterator4.e(err);
|
|
1003
|
+
} finally {
|
|
1004
|
+
_iterator4.f();
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
}]);
|
|
1008
|
+
}(TModel);
|
|
1009
|
+
function isParticleTModel(targets) {
|
|
1010
|
+
if (!targets) {
|
|
1011
|
+
return false;
|
|
1012
|
+
}
|
|
1013
|
+
for (var _i5 = 0, _Object$entries3 = Object.entries(targets); _i5 < _Object$entries3.length; _i5++) {
|
|
1014
|
+
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i5], 2),
|
|
1015
|
+
key = _Object$entries3$_i[0],
|
|
1016
|
+
target = _Object$entries3$_i[1];
|
|
1017
|
+
if (!ParticleUtil.isGpuChildrenTarget(key)) {
|
|
1018
|
+
continue;
|
|
1019
|
+
}
|
|
1020
|
+
if (!target || _typeof(target) !== "object") {
|
|
1021
|
+
continue;
|
|
1022
|
+
}
|
|
1023
|
+
if (target.renderer === "gpu") {
|
|
1024
|
+
return true;
|
|
1025
|
+
}
|
|
1026
|
+
if (target.renderer === "dom") {
|
|
1027
|
+
continue;
|
|
1028
|
+
}
|
|
1029
|
+
if (TUtil.isDefined(target.instances)) {
|
|
1030
|
+
return true;
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
return false;
|
|
1034
|
+
}
|
|
1035
|
+
function createParticleTModel(type, targets, oid) {
|
|
1036
|
+
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
1037
|
+
return new ParticleTModel(type, targets, oid, options);
|
|
1038
|
+
}
|
|
1039
|
+
TModelFactory.register(isParticleTModel, createParticleTModel);
|
|
1040
|
+
export { ParticleTModel };
|