targetj 1.1.0 → 1.1.2
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 +672 -192
- package/build/ParticleRuntime.js +844 -311
- package/build/ParticleTModel.js +370 -175
- package/build/ParticleUtil.js +9 -3
- package/build/RunScheduler.js +13 -8
- package/build/StateManager.js +125 -33
- package/build/StateUtil.js +142 -83
- package/build/TModel.js +179 -74
- package/build/TModelManager.js +127 -108
- 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/build/VisibilityUtil.js +25 -14
- 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.
|
|
@@ -69,11 +74,17 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
69
74
|
}
|
|
70
75
|
_inherits(TModel, _BaseModel);
|
|
71
76
|
return _createClass(TModel, [{
|
|
77
|
+
key: "getUnappliedScroll",
|
|
78
|
+
value: function getUnappliedScroll() {
|
|
79
|
+
return VisibilityUtil.getUnappliedScroll(this);
|
|
80
|
+
}
|
|
81
|
+
}, {
|
|
72
82
|
key: "createViewport",
|
|
73
83
|
value: function createViewport() {
|
|
74
84
|
this.viewport = this.viewport || new Viewport();
|
|
75
|
-
var
|
|
76
|
-
var
|
|
85
|
+
var scroll = this.getUnappliedScroll();
|
|
86
|
+
var scrollTop = scroll.y;
|
|
87
|
+
var scrollLeft = scroll.x;
|
|
77
88
|
var x = -scrollLeft,
|
|
78
89
|
y = -scrollTop;
|
|
79
90
|
this.viewport.xNext = x;
|
|
@@ -121,9 +132,30 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
121
132
|
}, {
|
|
122
133
|
key: "removeChild",
|
|
123
134
|
value: function removeChild(child) {
|
|
135
|
+
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
136
|
+
_ref$reset = _ref.reset,
|
|
137
|
+
reset = _ref$reset === void 0 ? false : _ref$reset;
|
|
124
138
|
if (!child || !this.allChildrenMap[child.oid]) {
|
|
125
139
|
return;
|
|
126
140
|
}
|
|
141
|
+
if (reset) {
|
|
142
|
+
var _iterator = _createForOfIteratorHelper(this.functionTargetNames),
|
|
143
|
+
_step;
|
|
144
|
+
try {
|
|
145
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
146
|
+
var _targetValue$childAct, _targetValue$addChild;
|
|
147
|
+
var key = _step.value;
|
|
148
|
+
var targetValue = this.targetValues[key];
|
|
149
|
+
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)) {
|
|
150
|
+
TargetUtil.resetRemovedChildTarget(this, key, child);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
} catch (err) {
|
|
154
|
+
_iterator.e(err);
|
|
155
|
+
} finally {
|
|
156
|
+
_iterator.f();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
127
159
|
TargetUtil.resetBeforeDeletion(child);
|
|
128
160
|
getManager().markTModelDeleted(child);
|
|
129
161
|
this.deletedChildren.push(child);
|
|
@@ -165,7 +197,7 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
165
197
|
var foundKey = Object.keys(this.actualValues).find(function (key) {
|
|
166
198
|
return _this2.actualValues[key] === child;
|
|
167
199
|
});
|
|
168
|
-
var type =
|
|
200
|
+
var type = childDefinition.id || foundKey || "".concat(this.oid, "_");
|
|
169
201
|
child = TModelFactory.create(type, childDefinition, function (type, targets) {
|
|
170
202
|
return new TModel(type, targets);
|
|
171
203
|
});
|
|
@@ -228,15 +260,12 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
228
260
|
this.addedChildren.sort(function (a, b) {
|
|
229
261
|
return a.index - b.index;
|
|
230
262
|
});
|
|
231
|
-
this.addedChildren.forEach(function (
|
|
232
|
-
var index =
|
|
233
|
-
child =
|
|
263
|
+
this.addedChildren.forEach(function (_ref2) {
|
|
264
|
+
var index = _ref2.index,
|
|
265
|
+
child = _ref2.child;
|
|
234
266
|
if (_this4.allChildrenMap[child.oid]) {
|
|
235
267
|
return;
|
|
236
268
|
}
|
|
237
|
-
if (!TUtil.isDefined(child.val('canDeleteDom')) && _this4.val('canDeleteDom') === false) {
|
|
238
|
-
child.val('canDeleteDom', false);
|
|
239
|
-
}
|
|
240
269
|
if (index >= _this4.allChildrenList.length) {
|
|
241
270
|
_this4.allChildrenList.push(child);
|
|
242
271
|
} else {
|
|
@@ -256,9 +285,9 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
256
285
|
});
|
|
257
286
|
var deletionMap = {};
|
|
258
287
|
var additionMap = {};
|
|
259
|
-
this.movedChildren.forEach(function (
|
|
260
|
-
var index =
|
|
261
|
-
child =
|
|
288
|
+
this.movedChildren.forEach(function (_ref3) {
|
|
289
|
+
var index = _ref3.index,
|
|
290
|
+
child = _ref3.child;
|
|
262
291
|
_this4.lastChildrenUpdate.deletions.push(child);
|
|
263
292
|
_this4.lastChildrenUpdate.additions.push({
|
|
264
293
|
index: index,
|
|
@@ -288,14 +317,14 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
288
317
|
delete deletionMap[index];
|
|
289
318
|
}
|
|
290
319
|
});
|
|
291
|
-
Object.values(additionMap).forEach(function (
|
|
292
|
-
var index =
|
|
293
|
-
child =
|
|
320
|
+
Object.values(additionMap).forEach(function (_ref4) {
|
|
321
|
+
var index = _ref4.index,
|
|
322
|
+
child = _ref4.child;
|
|
294
323
|
_this4.allChildrenList.splice(index, 0, child);
|
|
295
324
|
});
|
|
296
|
-
Object.values(deletionMap).forEach(function (
|
|
297
|
-
var fromIndex =
|
|
298
|
-
child =
|
|
325
|
+
Object.values(deletionMap).forEach(function (_ref5) {
|
|
326
|
+
var fromIndex = _ref5.fromIndex,
|
|
327
|
+
child = _ref5.child;
|
|
299
328
|
var deleteIndex = _this4.allChildrenList.indexOf(child, fromIndex);
|
|
300
329
|
_this4.allChildrenList.splice(deleteIndex, 1);
|
|
301
330
|
});
|
|
@@ -312,11 +341,11 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
312
341
|
}
|
|
313
342
|
this.markLayoutDirty("removeChildren");
|
|
314
343
|
var manager = getManager();
|
|
315
|
-
var
|
|
316
|
-
|
|
344
|
+
var _iterator2 = _createForOfIteratorHelper(children),
|
|
345
|
+
_step2;
|
|
317
346
|
try {
|
|
318
|
-
for (
|
|
319
|
-
var child =
|
|
347
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
348
|
+
var child = _step2.value;
|
|
320
349
|
TargetUtil.resetBeforeDeletion(child);
|
|
321
350
|
child.cancelAnimation();
|
|
322
351
|
delete manager.visibleOidMap[child.oid];
|
|
@@ -325,24 +354,24 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
325
354
|
manager.deletedTModelRoots.delete(child);
|
|
326
355
|
}
|
|
327
356
|
} catch (err) {
|
|
328
|
-
|
|
357
|
+
_iterator2.e(err);
|
|
329
358
|
} finally {
|
|
330
|
-
|
|
359
|
+
_iterator2.f();
|
|
331
360
|
}
|
|
332
361
|
if (this.hasDom()) {
|
|
333
362
|
this.$dom.deleteAll();
|
|
334
363
|
}
|
|
335
|
-
var
|
|
336
|
-
|
|
364
|
+
var _iterator3 = _createForOfIteratorHelper(children),
|
|
365
|
+
_step3;
|
|
337
366
|
try {
|
|
338
|
-
for (
|
|
339
|
-
var _child =
|
|
367
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
368
|
+
var _child = _step3.value;
|
|
340
369
|
manager.resetTModelDom(_child);
|
|
341
370
|
}
|
|
342
371
|
} catch (err) {
|
|
343
|
-
|
|
372
|
+
_iterator3.e(err);
|
|
344
373
|
} finally {
|
|
345
|
-
|
|
374
|
+
_iterator3.f();
|
|
346
375
|
}
|
|
347
376
|
this.allChildrenList = [];
|
|
348
377
|
this.allChildrenMap = {};
|
|
@@ -351,6 +380,75 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
351
380
|
this.clearAnimatingChildren();
|
|
352
381
|
return this;
|
|
353
382
|
}
|
|
383
|
+
}, {
|
|
384
|
+
key: "createExplodeChildren",
|
|
385
|
+
value: function createExplodeChildren(key) {
|
|
386
|
+
var definition = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
387
|
+
return ParticleExplode.createExplodeChildren(this, key, definition);
|
|
388
|
+
}
|
|
389
|
+
}, {
|
|
390
|
+
key: "captureExplodeSource",
|
|
391
|
+
value: function captureExplodeSource() {
|
|
392
|
+
var _this5 = this;
|
|
393
|
+
var width = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getWidth();
|
|
394
|
+
var height = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getHeight();
|
|
395
|
+
var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this;
|
|
396
|
+
var element = ParticleExplode.resolveDomElement(source);
|
|
397
|
+
return HtmlToCanvas.captureSource(element, width, height, function () {
|
|
398
|
+
var _this5$particleRender;
|
|
399
|
+
return (_this5$particleRender = _this5.particleRenderer) === null || _this5$particleRender === void 0 ? void 0 : _this5$particleRender.canvasLayer;
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}, {
|
|
403
|
+
key: "restoreExplodeSource",
|
|
404
|
+
value: function () {
|
|
405
|
+
var _restoreExplodeSource = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
406
|
+
var _this$targets$state$k;
|
|
407
|
+
var state, target, source, sourceElement, capture;
|
|
408
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
409
|
+
while (1) switch (_context.prev = _context.next) {
|
|
410
|
+
case 0:
|
|
411
|
+
state = this.explodeChildrenState;
|
|
412
|
+
if (!(!state || !this.hasDom())) {
|
|
413
|
+
_context.next = 3;
|
|
414
|
+
break;
|
|
415
|
+
}
|
|
416
|
+
return _context.abrupt("return", true);
|
|
417
|
+
case 3:
|
|
418
|
+
target = (_this$targets$state$k = this.targets[state.key]) !== null && _this$targets$state$k !== void 0 ? _this$targets$state$k : {};
|
|
419
|
+
source = ParticleExplode.resolveSource(this, target.dom);
|
|
420
|
+
sourceElement = ParticleExplode.resolveDomElement(source);
|
|
421
|
+
if (sourceElement) {
|
|
422
|
+
_context.next = 8;
|
|
423
|
+
break;
|
|
424
|
+
}
|
|
425
|
+
return _context.abrupt("return", false);
|
|
426
|
+
case 8:
|
|
427
|
+
_context.next = 10;
|
|
428
|
+
return this.captureExplodeSource(state.width, state.height, source);
|
|
429
|
+
case 10:
|
|
430
|
+
capture = _context.sent;
|
|
431
|
+
return _context.abrupt("return", this.particleRenderer.setExplodeSource(capture));
|
|
432
|
+
case 12:
|
|
433
|
+
case "end":
|
|
434
|
+
return _context.stop();
|
|
435
|
+
}
|
|
436
|
+
}, _callee, this);
|
|
437
|
+
}));
|
|
438
|
+
function restoreExplodeSource() {
|
|
439
|
+
return _restoreExplodeSource.apply(this, arguments);
|
|
440
|
+
}
|
|
441
|
+
return restoreExplodeSource;
|
|
442
|
+
}()
|
|
443
|
+
}, {
|
|
444
|
+
key: "getExplodeFragment",
|
|
445
|
+
value: function getExplodeFragment(childIndex) {
|
|
446
|
+
var state = this.explodeChildrenState;
|
|
447
|
+
if (!state) {
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
return ParticleExplode.getExplodeFragment(state, childIndex);
|
|
451
|
+
}
|
|
354
452
|
}, {
|
|
355
453
|
key: "exists",
|
|
356
454
|
value: function exists() {
|
|
@@ -406,13 +504,13 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
406
504
|
}, {
|
|
407
505
|
key: "removeLayoutDirty",
|
|
408
506
|
value: function removeLayoutDirty(tmodel, oids) {
|
|
409
|
-
var
|
|
507
|
+
var _this6 = this;
|
|
410
508
|
if (this.dirtyLayout) {
|
|
411
509
|
if (oids) {
|
|
412
510
|
oids.forEach(function (oid) {
|
|
413
|
-
if (
|
|
414
|
-
|
|
415
|
-
delete
|
|
511
|
+
if (_this6.dirtyLayout.oids[oid]) {
|
|
512
|
+
_this6.dirtyLayout.count--;
|
|
513
|
+
delete _this6.dirtyLayout.oids[oid];
|
|
416
514
|
}
|
|
417
515
|
});
|
|
418
516
|
} else if (this.dirtyLayout.oids[tmodel.oid]) {
|
|
@@ -602,13 +700,15 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
602
700
|
}, {
|
|
603
701
|
key: "debug",
|
|
604
702
|
value: function debug() {
|
|
605
|
-
var
|
|
703
|
+
var _this7 = this;
|
|
606
704
|
return [{
|
|
607
705
|
oid: this.oid
|
|
608
706
|
}, {
|
|
609
707
|
visible: this.isVisible()
|
|
610
708
|
}, {
|
|
611
709
|
visibilityStatus: this.visibilityStatus
|
|
710
|
+
}, {
|
|
711
|
+
complete: TargetUtil.isTModelComplete(this)
|
|
612
712
|
}, {
|
|
613
713
|
hasDom: this.hasDom()
|
|
614
714
|
}, {
|
|
@@ -623,10 +723,13 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
623
723
|
width: this.getWidth()
|
|
624
724
|
}, {
|
|
625
725
|
height: this.getHeight()
|
|
626
|
-
}, {
|
|
627
|
-
tmodelComplete: TargetUtil.isTModelComplete(this)
|
|
628
726
|
}, {
|
|
629
727
|
targets: this.originalTargetNames
|
|
728
|
+
}, {
|
|
729
|
+
completedTargets: Object.keys(this.targetValues).filter(function (key) {
|
|
730
|
+
var _this7$targetValues$k;
|
|
731
|
+
return ((_this7$targetValues$k = _this7.targetValues[key]) === null || _this7$targetValues$k === void 0 ? void 0 : _this7$targetValues$k.status) === 'complete';
|
|
732
|
+
}).length
|
|
630
733
|
}, {
|
|
631
734
|
activeTargetList: this.activeTargetList
|
|
632
735
|
}, {
|
|
@@ -641,15 +744,17 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
641
744
|
pendingTargets: _toConsumableArray(this.pendingTargets ? _toConsumableArray(this.pendingTargets) : [])
|
|
642
745
|
}, {
|
|
643
746
|
styleTargetMap: _toConsumableArray(this.styleTargetMap ? _toConsumableArray(this.styleTargetMap.keys()) : [])
|
|
747
|
+
}, {
|
|
748
|
+
asyncStyleTargetMap: _toConsumableArray(this.asyncStyleTargetMap ? _toConsumableArray(this.asyncStyleTargetMap.keys()) : [])
|
|
644
749
|
}, {
|
|
645
750
|
passiveTargetList: this.passiveTargetList
|
|
646
751
|
}, {
|
|
647
752
|
incompleteTargets: Object.keys(this.targetValues).filter(function (key) {
|
|
648
|
-
var
|
|
649
|
-
return ((
|
|
753
|
+
var _this7$targetValues$k2;
|
|
754
|
+
return ((_this7$targetValues$k2 = _this7.targetValues[key]) === null || _this7$targetValues$k2 === void 0 ? void 0 : _this7$targetValues$k2.status) !== 'complete';
|
|
650
755
|
}).map(function (key) {
|
|
651
|
-
var
|
|
652
|
-
return "".concat(key, ":").concat((
|
|
756
|
+
var _this7$targetValues$k3;
|
|
757
|
+
return "".concat(key, ":").concat((_this7$targetValues$k3 = _this7.targetValues[key]) === null || _this7$targetValues$k3 === void 0 ? void 0 : _this7$targetValues$k3.status);
|
|
653
758
|
})
|
|
654
759
|
}, {
|
|
655
760
|
updatingChildren: this.updatingChildrenMap ? _toConsumableArray(this.updatingChildrenMap.keys()) : []
|
|
@@ -657,6 +762,16 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
657
762
|
activeChildren: this.activeChildrenMap ? _toConsumableArray(this.activeChildrenMap.keys()) : []
|
|
658
763
|
}, {
|
|
659
764
|
children: this.getChildren()
|
|
765
|
+
}, {
|
|
766
|
+
visibleChildren: this.visibleChildren
|
|
767
|
+
}, {
|
|
768
|
+
allVisibleChildren: this.getChildren().filter(function (child) {
|
|
769
|
+
return child.isVisible();
|
|
770
|
+
})
|
|
771
|
+
}, {
|
|
772
|
+
allInvisibleChilden: this.getChildren().filter(function (child) {
|
|
773
|
+
return !child.isVisible();
|
|
774
|
+
})
|
|
660
775
|
}, {
|
|
661
776
|
targetValues: this.targetValues
|
|
662
777
|
}, {
|
|
@@ -814,8 +929,8 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
814
929
|
}, {
|
|
815
930
|
key: "getBoxSizing",
|
|
816
931
|
value: function getBoxSizing() {
|
|
817
|
-
var
|
|
818
|
-
return (
|
|
932
|
+
var _ref6, _ref7, _this$val6;
|
|
933
|
+
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
934
|
}
|
|
820
935
|
}, {
|
|
821
936
|
key: "getContainerOverflowMode",
|
|
@@ -874,16 +989,6 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
874
989
|
value: function preventDefault() {
|
|
875
990
|
return TUtil.isDefined(this.val('preventDefault')) ? this.val('preventDefault') : this.getParentValue('preventDefault') || false;
|
|
876
991
|
}
|
|
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
992
|
}, {
|
|
888
993
|
key: "excludeStyling",
|
|
889
994
|
value: function excludeStyling() {
|
|
@@ -1035,52 +1140,52 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
1035
1140
|
}, {
|
|
1036
1141
|
key: "getMarginTop",
|
|
1037
1142
|
value: function getMarginTop() {
|
|
1038
|
-
var
|
|
1039
|
-
return (
|
|
1143
|
+
var _ref8, _this$val9;
|
|
1144
|
+
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
1145
|
}
|
|
1041
1146
|
}, {
|
|
1042
1147
|
key: "getMarginLeft",
|
|
1043
1148
|
value: function getMarginLeft() {
|
|
1044
|
-
var
|
|
1045
|
-
return (
|
|
1149
|
+
var _ref9, _this$val10;
|
|
1150
|
+
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
1151
|
}
|
|
1047
1152
|
}, {
|
|
1048
1153
|
key: "getMarginRight",
|
|
1049
1154
|
value: function getMarginRight() {
|
|
1050
|
-
var
|
|
1051
|
-
var margin = (
|
|
1155
|
+
var _ref10, _this$val11, _this$getParentValue;
|
|
1156
|
+
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
1157
|
return margin + ((_this$getParentValue = this.getParentValue("gap")) !== null && _this$getParentValue !== void 0 ? _this$getParentValue : 0);
|
|
1053
1158
|
}
|
|
1054
1159
|
}, {
|
|
1055
1160
|
key: "getMarginBottom",
|
|
1056
1161
|
value: function getMarginBottom() {
|
|
1057
|
-
var
|
|
1058
|
-
var margin = (
|
|
1162
|
+
var _ref11, _this$val12, _this$getParentValue2;
|
|
1163
|
+
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
1164
|
return margin + ((_this$getParentValue2 = this.getParentValue("gap")) !== null && _this$getParentValue2 !== void 0 ? _this$getParentValue2 : 0);
|
|
1060
1165
|
}
|
|
1061
1166
|
}, {
|
|
1062
1167
|
key: "getPaddingTop",
|
|
1063
1168
|
value: function getPaddingTop() {
|
|
1064
|
-
var
|
|
1065
|
-
return (
|
|
1169
|
+
var _ref12, _this$val13;
|
|
1170
|
+
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
1171
|
}
|
|
1067
1172
|
}, {
|
|
1068
1173
|
key: "getPaddingLeft",
|
|
1069
1174
|
value: function getPaddingLeft() {
|
|
1070
|
-
var
|
|
1071
|
-
return (
|
|
1175
|
+
var _ref13, _this$val14;
|
|
1176
|
+
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
1177
|
}
|
|
1073
1178
|
}, {
|
|
1074
1179
|
key: "getPaddingRight",
|
|
1075
1180
|
value: function getPaddingRight() {
|
|
1076
|
-
var
|
|
1077
|
-
return (
|
|
1181
|
+
var _ref14, _this$val15;
|
|
1182
|
+
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
1183
|
}
|
|
1079
1184
|
}, {
|
|
1080
1185
|
key: "getPaddingBottom",
|
|
1081
1186
|
value: function getPaddingBottom() {
|
|
1082
|
-
var
|
|
1083
|
-
return (
|
|
1187
|
+
var _ref15, _this$val16;
|
|
1188
|
+
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
1189
|
}
|
|
1085
1190
|
}, {
|
|
1086
1191
|
key: "setLayoutX",
|
|
@@ -1197,8 +1302,8 @@ var TModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
1197
1302
|
return false;
|
|
1198
1303
|
}
|
|
1199
1304
|
}, {
|
|
1200
|
-
key: "
|
|
1201
|
-
value: function
|
|
1305
|
+
key: "onDomAvailable",
|
|
1306
|
+
value: function onDomAvailable() {}
|
|
1202
1307
|
}]);
|
|
1203
1308
|
}(BaseModel);
|
|
1204
1309
|
export { TModel };
|