targetj 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/AnimationManager.js +220 -152
- package/build/AnimationUtil.js +0 -1
- package/build/App.js +79 -39
- package/build/BaseModel.js +43 -11
- package/build/Easing.js +5 -0
- package/build/EventListener.js +29 -9
- package/build/HtmlToCanvas.js +411 -0
- package/build/LocationManager.js +44 -14
- package/build/PageManager.js +84 -33
- package/build/ParticleChild.js +12 -11
- package/build/ParticleExplode.js +360 -0
- package/build/ParticleRenderer.js +669 -188
- package/build/ParticleRuntime.js +844 -311
- package/build/ParticleTModel.js +362 -174
- package/build/ParticleUtil.js +2 -2
- package/build/RunScheduler.js +13 -8
- package/build/StateManager.js +125 -33
- package/build/StateUtil.js +141 -82
- package/build/TModel.js +171 -72
- package/build/TModelManager.js +51 -43
- package/build/TModelUtil.js +230 -143
- package/build/TUtil.js +4 -4
- package/build/TargetData.js +20 -12
- package/build/TargetExecutor.js +37 -14
- package/build/TargetManager.js +13 -18
- package/build/TargetParser.js +36 -2
- package/build/TargetUtil.js +189 -128
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/build/TModel.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
function
|
|
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); }); }; }
|
|
2
4
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
3
5
|
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."); }
|
|
4
|
-
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; } }
|
|
5
6
|
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
6
7
|
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
7
|
-
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; }
|
|
8
8
|
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); }
|
|
9
|
+
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; } } }; }
|
|
10
|
+
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; } }
|
|
11
|
+
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; }
|
|
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; }
|
|
@@ -30,6 +33,8 @@ import { TModelUtil } from "./TModelUtil.js";
|
|
|
30
33
|
import { DomInit } from "./DomInit.js";
|
|
31
34
|
import { StateUtil } from "./StateUtil.js";
|
|
32
35
|
import { TModelFactory } from "./TModelFactory.js";
|
|
36
|
+
import { ParticleExplode } from "./ParticleExplode.js";
|
|
37
|
+
import { HtmlToCanvas } from "./htmlToCanvas.js";
|
|
33
38
|
|
|
34
39
|
/**
|
|
35
40
|
* It provides the base class for all objects in an app where targets are defined.
|
|
@@ -121,9 +126,30 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
121
126
|
}, {
|
|
122
127
|
key: "removeChild",
|
|
123
128
|
value: function removeChild(child) {
|
|
129
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
130
|
+
_ref$reset = _ref.reset,
|
|
131
|
+
reset = _ref$reset === void 0 ? false : _ref$reset;
|
|
124
132
|
if (!child || !this.allChildrenMap[child.oid]) {
|
|
125
133
|
return;
|
|
126
134
|
}
|
|
135
|
+
if (reset) {
|
|
136
|
+
var _iterator = _createForOfIteratorHelper(this.functionTargetNames),
|
|
137
|
+
_step;
|
|
138
|
+
try {
|
|
139
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
140
|
+
var _targetValue$childAct, _targetValue$addChild;
|
|
141
|
+
var key = _step.value;
|
|
142
|
+
var targetValue = this.targetValues[key];
|
|
143
|
+
if (targetValue !== null && targetValue !== void 0 && (_targetValue$childAct = targetValue.childAction) !== null && _targetValue$childAct !== void 0 && _targetValue$childAct.includes(child) || targetValue !== null && targetValue !== void 0 && (_targetValue$addChild = targetValue.addChildAction) !== null && _targetValue$addChild !== void 0 && _targetValue$addChild.includes(child)) {
|
|
144
|
+
TargetUtil.resetRemovedChildTarget(this, key, child);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
} catch (err) {
|
|
148
|
+
_iterator.e(err);
|
|
149
|
+
} finally {
|
|
150
|
+
_iterator.f();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
127
153
|
TargetUtil.resetBeforeDeletion(child);
|
|
128
154
|
getManager().markTModelDeleted(child);
|
|
129
155
|
this.deletedChildren.push(child);
|
|
@@ -165,7 +191,7 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
165
191
|
var foundKey = Object.keys(this.actualValues).find(function (key) {
|
|
166
192
|
return _this2.actualValues[key] === child;
|
|
167
193
|
});
|
|
168
|
-
var type =
|
|
194
|
+
var type = childDefinition.id || foundKey || "".concat(this.oid, "_");
|
|
169
195
|
child = TModelFactory.create(type, childDefinition, function (type, targets) {
|
|
170
196
|
return new TModel(type, targets);
|
|
171
197
|
});
|
|
@@ -228,15 +254,12 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
228
254
|
this.addedChildren.sort(function (a, b) {
|
|
229
255
|
return a.index - b.index;
|
|
230
256
|
});
|
|
231
|
-
this.addedChildren.forEach(function (
|
|
232
|
-
var index =
|
|
233
|
-
child =
|
|
257
|
+
this.addedChildren.forEach(function (_ref2) {
|
|
258
|
+
var index = _ref2.index,
|
|
259
|
+
child = _ref2.child;
|
|
234
260
|
if (_this4.allChildrenMap[child.oid]) {
|
|
235
261
|
return;
|
|
236
262
|
}
|
|
237
|
-
if (!TUtil.isDefined(child.val('canDeleteDom')) && _this4.val('canDeleteDom') === false) {
|
|
238
|
-
child.val('canDeleteDom', false);
|
|
239
|
-
}
|
|
240
263
|
if (index >= _this4.allChildrenList.length) {
|
|
241
264
|
_this4.allChildrenList.push(child);
|
|
242
265
|
} else {
|
|
@@ -256,9 +279,9 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
256
279
|
});
|
|
257
280
|
var deletionMap = {};
|
|
258
281
|
var additionMap = {};
|
|
259
|
-
this.movedChildren.forEach(function (
|
|
260
|
-
var index =
|
|
261
|
-
child =
|
|
282
|
+
this.movedChildren.forEach(function (_ref3) {
|
|
283
|
+
var index = _ref3.index,
|
|
284
|
+
child = _ref3.child;
|
|
262
285
|
_this4.lastChildrenUpdate.deletions.push(child);
|
|
263
286
|
_this4.lastChildrenUpdate.additions.push({
|
|
264
287
|
index: index,
|
|
@@ -288,14 +311,14 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
288
311
|
delete deletionMap[index];
|
|
289
312
|
}
|
|
290
313
|
});
|
|
291
|
-
Object.values(additionMap).forEach(function (
|
|
292
|
-
var index =
|
|
293
|
-
child =
|
|
314
|
+
Object.values(additionMap).forEach(function (_ref4) {
|
|
315
|
+
var index = _ref4.index,
|
|
316
|
+
child = _ref4.child;
|
|
294
317
|
_this4.allChildrenList.splice(index, 0, child);
|
|
295
318
|
});
|
|
296
|
-
Object.values(deletionMap).forEach(function (
|
|
297
|
-
var fromIndex =
|
|
298
|
-
child =
|
|
319
|
+
Object.values(deletionMap).forEach(function (_ref5) {
|
|
320
|
+
var fromIndex = _ref5.fromIndex,
|
|
321
|
+
child = _ref5.child;
|
|
299
322
|
var deleteIndex = _this4.allChildrenList.indexOf(child, fromIndex);
|
|
300
323
|
_this4.allChildrenList.splice(deleteIndex, 1);
|
|
301
324
|
});
|
|
@@ -312,11 +335,11 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
312
335
|
}
|
|
313
336
|
this.markLayoutDirty("removeChildren");
|
|
314
337
|
var manager = getManager();
|
|
315
|
-
var
|
|
316
|
-
|
|
338
|
+
var _iterator2 = _createForOfIteratorHelper(children),
|
|
339
|
+
_step2;
|
|
317
340
|
try {
|
|
318
|
-
for (
|
|
319
|
-
var child =
|
|
341
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
342
|
+
var child = _step2.value;
|
|
320
343
|
TargetUtil.resetBeforeDeletion(child);
|
|
321
344
|
child.cancelAnimation();
|
|
322
345
|
delete manager.visibleOidMap[child.oid];
|
|
@@ -325,24 +348,24 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
325
348
|
manager.deletedTModelRoots.delete(child);
|
|
326
349
|
}
|
|
327
350
|
} catch (err) {
|
|
328
|
-
|
|
351
|
+
_iterator2.e(err);
|
|
329
352
|
} finally {
|
|
330
|
-
|
|
353
|
+
_iterator2.f();
|
|
331
354
|
}
|
|
332
355
|
if (this.hasDom()) {
|
|
333
356
|
this.$dom.deleteAll();
|
|
334
357
|
}
|
|
335
|
-
var
|
|
336
|
-
|
|
358
|
+
var _iterator3 = _createForOfIteratorHelper(children),
|
|
359
|
+
_step3;
|
|
337
360
|
try {
|
|
338
|
-
for (
|
|
339
|
-
var _child =
|
|
361
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
362
|
+
var _child = _step3.value;
|
|
340
363
|
manager.resetTModelDom(_child);
|
|
341
364
|
}
|
|
342
365
|
} catch (err) {
|
|
343
|
-
|
|
366
|
+
_iterator3.e(err);
|
|
344
367
|
} finally {
|
|
345
|
-
|
|
368
|
+
_iterator3.f();
|
|
346
369
|
}
|
|
347
370
|
this.allChildrenList = [];
|
|
348
371
|
this.allChildrenMap = {};
|
|
@@ -351,6 +374,75 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
351
374
|
this.clearAnimatingChildren();
|
|
352
375
|
return this;
|
|
353
376
|
}
|
|
377
|
+
}, {
|
|
378
|
+
key: "createExplodeChildren",
|
|
379
|
+
value: function createExplodeChildren(key) {
|
|
380
|
+
var definition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
381
|
+
return ParticleExplode.createExplodeChildren(this, key, definition);
|
|
382
|
+
}
|
|
383
|
+
}, {
|
|
384
|
+
key: "captureExplodeSource",
|
|
385
|
+
value: function captureExplodeSource() {
|
|
386
|
+
var _this5 = this;
|
|
387
|
+
var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getWidth();
|
|
388
|
+
var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getHeight();
|
|
389
|
+
var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this;
|
|
390
|
+
var element = ParticleExplode.resolveDomElement(source);
|
|
391
|
+
return HtmlToCanvas.captureSource(element, width, height, function () {
|
|
392
|
+
var _this5$particleRender;
|
|
393
|
+
return (_this5$particleRender = _this5.particleRenderer) === null || _this5$particleRender === void 0 ? void 0 : _this5$particleRender.canvasLayer;
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
}, {
|
|
397
|
+
key: "restoreExplodeSource",
|
|
398
|
+
value: function () {
|
|
399
|
+
var _restoreExplodeSource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
400
|
+
var _this$targets$state$k;
|
|
401
|
+
var state, target, source, sourceElement, capture;
|
|
402
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
403
|
+
while (1) switch (_context.prev = _context.next) {
|
|
404
|
+
case 0:
|
|
405
|
+
state = this.explodeChildrenState;
|
|
406
|
+
if (!(!state || !this.hasDom())) {
|
|
407
|
+
_context.next = 3;
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
return _context.abrupt("return", true);
|
|
411
|
+
case 3:
|
|
412
|
+
target = (_this$targets$state$k = this.targets[state.key]) !== null && _this$targets$state$k !== void 0 ? _this$targets$state$k : {};
|
|
413
|
+
source = ParticleExplode.resolveSource(this, target.dom);
|
|
414
|
+
sourceElement = ParticleExplode.resolveDomElement(source);
|
|
415
|
+
if (sourceElement) {
|
|
416
|
+
_context.next = 8;
|
|
417
|
+
break;
|
|
418
|
+
}
|
|
419
|
+
return _context.abrupt("return", false);
|
|
420
|
+
case 8:
|
|
421
|
+
_context.next = 10;
|
|
422
|
+
return this.captureExplodeSource(state.width, state.height, source);
|
|
423
|
+
case 10:
|
|
424
|
+
capture = _context.sent;
|
|
425
|
+
return _context.abrupt("return", this.particleRenderer.setExplodeSource(capture));
|
|
426
|
+
case 12:
|
|
427
|
+
case "end":
|
|
428
|
+
return _context.stop();
|
|
429
|
+
}
|
|
430
|
+
}, _callee, this);
|
|
431
|
+
}));
|
|
432
|
+
function restoreExplodeSource() {
|
|
433
|
+
return _restoreExplodeSource.apply(this, arguments);
|
|
434
|
+
}
|
|
435
|
+
return restoreExplodeSource;
|
|
436
|
+
}()
|
|
437
|
+
}, {
|
|
438
|
+
key: "getExplodeFragment",
|
|
439
|
+
value: function getExplodeFragment(childIndex) {
|
|
440
|
+
var state = this.explodeChildrenState;
|
|
441
|
+
if (!state) {
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
return ParticleExplode.getExplodeFragment(state, childIndex);
|
|
445
|
+
}
|
|
354
446
|
}, {
|
|
355
447
|
key: "exists",
|
|
356
448
|
value: function exists() {
|
|
@@ -406,13 +498,13 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
406
498
|
}, {
|
|
407
499
|
key: "removeLayoutDirty",
|
|
408
500
|
value: function removeLayoutDirty(tmodel, oids) {
|
|
409
|
-
var
|
|
501
|
+
var _this6 = this;
|
|
410
502
|
if (this.dirtyLayout) {
|
|
411
503
|
if (oids) {
|
|
412
504
|
oids.forEach(function (oid) {
|
|
413
|
-
if (
|
|
414
|
-
|
|
415
|
-
delete
|
|
505
|
+
if (_this6.dirtyLayout.oids[oid]) {
|
|
506
|
+
_this6.dirtyLayout.count--;
|
|
507
|
+
delete _this6.dirtyLayout.oids[oid];
|
|
416
508
|
}
|
|
417
509
|
});
|
|
418
510
|
} else if (this.dirtyLayout.oids[tmodel.oid]) {
|
|
@@ -602,13 +694,15 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
602
694
|
}, {
|
|
603
695
|
key: "debug",
|
|
604
696
|
value: function debug() {
|
|
605
|
-
var
|
|
697
|
+
var _this7 = this;
|
|
606
698
|
return [{
|
|
607
699
|
oid: this.oid
|
|
608
700
|
}, {
|
|
609
701
|
visible: this.isVisible()
|
|
610
702
|
}, {
|
|
611
703
|
visibilityStatus: this.visibilityStatus
|
|
704
|
+
}, {
|
|
705
|
+
complete: TargetUtil.isTModelComplete(this)
|
|
612
706
|
}, {
|
|
613
707
|
hasDom: this.hasDom()
|
|
614
708
|
}, {
|
|
@@ -623,10 +717,13 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
623
717
|
width: this.getWidth()
|
|
624
718
|
}, {
|
|
625
719
|
height: this.getHeight()
|
|
626
|
-
}, {
|
|
627
|
-
tmodelComplete: TargetUtil.isTModelComplete(this)
|
|
628
720
|
}, {
|
|
629
721
|
targets: this.originalTargetNames
|
|
722
|
+
}, {
|
|
723
|
+
completedTargets: Object.keys(this.targetValues).filter(function (key) {
|
|
724
|
+
var _this7$targetValues$k;
|
|
725
|
+
return ((_this7$targetValues$k = _this7.targetValues[key]) === null || _this7$targetValues$k === void 0 ? void 0 : _this7$targetValues$k.status) === 'complete';
|
|
726
|
+
}).length
|
|
630
727
|
}, {
|
|
631
728
|
activeTargetList: this.activeTargetList
|
|
632
729
|
}, {
|
|
@@ -641,15 +738,17 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
641
738
|
pendingTargets: _toConsumableArray(this.pendingTargets ? _toConsumableArray(this.pendingTargets) : [])
|
|
642
739
|
}, {
|
|
643
740
|
styleTargetMap: _toConsumableArray(this.styleTargetMap ? _toConsumableArray(this.styleTargetMap.keys()) : [])
|
|
741
|
+
}, {
|
|
742
|
+
asyncStyleTargetMap: _toConsumableArray(this.asyncStyleTargetMap ? _toConsumableArray(this.asyncStyleTargetMap.keys()) : [])
|
|
644
743
|
}, {
|
|
645
744
|
passiveTargetList: this.passiveTargetList
|
|
646
745
|
}, {
|
|
647
746
|
incompleteTargets: Object.keys(this.targetValues).filter(function (key) {
|
|
648
|
-
var
|
|
649
|
-
return ((
|
|
747
|
+
var _this7$targetValues$k2;
|
|
748
|
+
return ((_this7$targetValues$k2 = _this7.targetValues[key]) === null || _this7$targetValues$k2 === void 0 ? void 0 : _this7$targetValues$k2.status) !== 'complete';
|
|
650
749
|
}).map(function (key) {
|
|
651
|
-
var
|
|
652
|
-
return "".concat(key, ":").concat((
|
|
750
|
+
var _this7$targetValues$k3;
|
|
751
|
+
return "".concat(key, ":").concat((_this7$targetValues$k3 = _this7.targetValues[key]) === null || _this7$targetValues$k3 === void 0 ? void 0 : _this7$targetValues$k3.status);
|
|
653
752
|
})
|
|
654
753
|
}, {
|
|
655
754
|
updatingChildren: this.updatingChildrenMap ? _toConsumableArray(this.updatingChildrenMap.keys()) : []
|
|
@@ -657,6 +756,16 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
657
756
|
activeChildren: this.activeChildrenMap ? _toConsumableArray(this.activeChildrenMap.keys()) : []
|
|
658
757
|
}, {
|
|
659
758
|
children: this.getChildren()
|
|
759
|
+
}, {
|
|
760
|
+
visibleChildren: this.visibleChildren
|
|
761
|
+
}, {
|
|
762
|
+
allVisibleChildren: this.getChildren().filter(function (child) {
|
|
763
|
+
return child.isVisible();
|
|
764
|
+
})
|
|
765
|
+
}, {
|
|
766
|
+
allInvisibleChilden: this.getChildren().filter(function (child) {
|
|
767
|
+
return !child.isVisible();
|
|
768
|
+
})
|
|
660
769
|
}, {
|
|
661
770
|
targetValues: this.targetValues
|
|
662
771
|
}, {
|
|
@@ -814,8 +923,8 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
814
923
|
}, {
|
|
815
924
|
key: "getBoxSizing",
|
|
816
925
|
value: function getBoxSizing() {
|
|
817
|
-
var
|
|
818
|
-
return (
|
|
926
|
+
var _ref6, _ref7, _this$val6;
|
|
927
|
+
return (_ref6 = (_ref7 = (_this$val6 = this.val("boxSizing")) !== null && _this$val6 !== void 0 ? _this$val6 : this.val("box-sizing")) !== null && _ref7 !== void 0 ? _ref7 : this.getParentValue("boxSizing")) !== null && _ref6 !== void 0 ? _ref6 : "content-box";
|
|
819
928
|
}
|
|
820
929
|
}, {
|
|
821
930
|
key: "getContainerOverflowMode",
|
|
@@ -874,16 +983,6 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
874
983
|
value: function preventDefault() {
|
|
875
984
|
return TUtil.isDefined(this.val('preventDefault')) ? this.val('preventDefault') : this.getParentValue('preventDefault') || false;
|
|
876
985
|
}
|
|
877
|
-
}, {
|
|
878
|
-
key: "canDeleteDom",
|
|
879
|
-
value: function canDeleteDom() {
|
|
880
|
-
return TUtil.isDefined(this.val('canDeleteDom')) ? this.val('canDeleteDom') : !this.reuseDomDefinition();
|
|
881
|
-
}
|
|
882
|
-
}, {
|
|
883
|
-
key: "requiresDom",
|
|
884
|
-
value: function requiresDom() {
|
|
885
|
-
return TUtil.isDefined(this.val('requiresDom')) ? this.val('requiresDom') : this.reuseDomDefinition();
|
|
886
|
-
}
|
|
887
986
|
}, {
|
|
888
987
|
key: "excludeStyling",
|
|
889
988
|
value: function excludeStyling() {
|
|
@@ -1035,52 +1134,52 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
1035
1134
|
}, {
|
|
1036
1135
|
key: "getMarginTop",
|
|
1037
1136
|
value: function getMarginTop() {
|
|
1038
|
-
var
|
|
1039
|
-
return (
|
|
1137
|
+
var _ref8, _this$val9;
|
|
1138
|
+
return (_ref8 = (_this$val9 = this.val("marginTop")) !== null && _this$val9 !== void 0 ? _this$val9 : this.val("topMargin")) !== null && _ref8 !== void 0 ? _ref8 : TModelUtil.getMarginValue(this, "top");
|
|
1040
1139
|
}
|
|
1041
1140
|
}, {
|
|
1042
1141
|
key: "getMarginLeft",
|
|
1043
1142
|
value: function getMarginLeft() {
|
|
1044
|
-
var
|
|
1045
|
-
return (
|
|
1143
|
+
var _ref9, _this$val10;
|
|
1144
|
+
return (_ref9 = (_this$val10 = this.val("marginLeft")) !== null && _this$val10 !== void 0 ? _this$val10 : this.val("leftMargin")) !== null && _ref9 !== void 0 ? _ref9 : TModelUtil.getMarginValue(this, "left");
|
|
1046
1145
|
}
|
|
1047
1146
|
}, {
|
|
1048
1147
|
key: "getMarginRight",
|
|
1049
1148
|
value: function getMarginRight() {
|
|
1050
|
-
var
|
|
1051
|
-
var margin = (
|
|
1149
|
+
var _ref10, _this$val11, _this$getParentValue;
|
|
1150
|
+
var margin = (_ref10 = (_this$val11 = this.val("marginRight")) !== null && _this$val11 !== void 0 ? _this$val11 : this.val("rightMargin")) !== null && _ref10 !== void 0 ? _ref10 : TModelUtil.getMarginValue(this, "right");
|
|
1052
1151
|
return margin + ((_this$getParentValue = this.getParentValue("gap")) !== null && _this$getParentValue !== void 0 ? _this$getParentValue : 0);
|
|
1053
1152
|
}
|
|
1054
1153
|
}, {
|
|
1055
1154
|
key: "getMarginBottom",
|
|
1056
1155
|
value: function getMarginBottom() {
|
|
1057
|
-
var
|
|
1058
|
-
var margin = (
|
|
1156
|
+
var _ref11, _this$val12, _this$getParentValue2;
|
|
1157
|
+
var margin = (_ref11 = (_this$val12 = this.val("marginBottom")) !== null && _this$val12 !== void 0 ? _this$val12 : this.val("bottomMargin")) !== null && _ref11 !== void 0 ? _ref11 : TModelUtil.getMarginValue(this, "bottom");
|
|
1059
1158
|
return margin + ((_this$getParentValue2 = this.getParentValue("gap")) !== null && _this$getParentValue2 !== void 0 ? _this$getParentValue2 : 0);
|
|
1060
1159
|
}
|
|
1061
1160
|
}, {
|
|
1062
1161
|
key: "getPaddingTop",
|
|
1063
1162
|
value: function getPaddingTop() {
|
|
1064
|
-
var
|
|
1065
|
-
return (
|
|
1163
|
+
var _ref12, _this$val13;
|
|
1164
|
+
return (_ref12 = (_this$val13 = this.val("paddingTop")) !== null && _this$val13 !== void 0 ? _this$val13 : this.val("topPadding")) !== null && _ref12 !== void 0 ? _ref12 : TModelUtil.getPaddingValue(this, "top");
|
|
1066
1165
|
}
|
|
1067
1166
|
}, {
|
|
1068
1167
|
key: "getPaddingLeft",
|
|
1069
1168
|
value: function getPaddingLeft() {
|
|
1070
|
-
var
|
|
1071
|
-
return (
|
|
1169
|
+
var _ref13, _this$val14;
|
|
1170
|
+
return (_ref13 = (_this$val14 = this.val("paddingLeft")) !== null && _this$val14 !== void 0 ? _this$val14 : this.val("leftPadding")) !== null && _ref13 !== void 0 ? _ref13 : TModelUtil.getPaddingValue(this, "left");
|
|
1072
1171
|
}
|
|
1073
1172
|
}, {
|
|
1074
1173
|
key: "getPaddingRight",
|
|
1075
1174
|
value: function getPaddingRight() {
|
|
1076
|
-
var
|
|
1077
|
-
return (
|
|
1175
|
+
var _ref14, _this$val15;
|
|
1176
|
+
return (_ref14 = (_this$val15 = this.val("paddingRight")) !== null && _this$val15 !== void 0 ? _this$val15 : this.val("rightPadding")) !== null && _ref14 !== void 0 ? _ref14 : TModelUtil.getPaddingValue(this, "right");
|
|
1078
1177
|
}
|
|
1079
1178
|
}, {
|
|
1080
1179
|
key: "getPaddingBottom",
|
|
1081
1180
|
value: function getPaddingBottom() {
|
|
1082
|
-
var
|
|
1083
|
-
return (
|
|
1181
|
+
var _ref15, _this$val16;
|
|
1182
|
+
return (_ref15 = (_this$val16 = this.val("paddingBottom")) !== null && _this$val16 !== void 0 ? _this$val16 : this.val("bottomPadding")) !== null && _ref15 !== void 0 ? _ref15 : TModelUtil.getPaddingValue(this, "bottom");
|
|
1084
1183
|
}
|
|
1085
1184
|
}, {
|
|
1086
1185
|
key: "setLayoutX",
|
|
@@ -1197,8 +1296,8 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
1197
1296
|
return false;
|
|
1198
1297
|
}
|
|
1199
1298
|
}, {
|
|
1200
|
-
key: "
|
|
1201
|
-
value: function
|
|
1299
|
+
key: "onDomAvailable",
|
|
1300
|
+
value: function onDomAvailable() {}
|
|
1202
1301
|
}]);
|
|
1203
1302
|
}(BaseModel);
|
|
1204
1303
|
export { TModel };
|