targetj 1.0.240 → 1.0.241
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 +27 -5
- package/build/$Dom.js +21 -25
- package/build/AnimationManager.js +39 -44
- package/build/AnimationUtil.js +41 -45
- package/build/App.js +73 -74
- package/build/BaseModel.js +86 -90
- package/build/Bracket.js +7 -11
- package/build/BracketGenerator.js +15 -19
- package/build/ColorUtil.js +3 -8
- package/build/DomInit.js +34 -38
- package/build/Easing.js +3 -8
- package/build/EventListener.js +63 -67
- package/build/LoadingManager.js +34 -38
- package/build/LocationManager.js +52 -56
- package/build/Moves.js +17 -21
- package/build/PageManager.js +64 -68
- package/build/RunScheduler.js +46 -50
- package/build/ScheduleUtil.js +20 -24
- package/build/SearchUtil.js +16 -20
- package/build/TModel.js +52 -56
- package/build/TModelManager.js +37 -41
- package/build/TModelUtil.js +47 -50
- package/build/TUtil.js +16 -20
- package/build/TargetData.js +35 -40
- package/build/TargetExecutor.js +72 -76
- package/build/TargetManager.js +49 -52
- package/build/TargetParser.js +35 -39
- package/build/TargetUtil.js +25 -29
- package/build/Viewport.js +6 -10
- package/build/VisibilityUtil.js +11 -15
- package/build/index.js +20 -225
- package/dist/targetjs.js +1 -1
- package/dist/targetjs.js.gz +0 -0
- package/package.json +1 -1
package/Export.js
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
|
-
export
|
|
1
|
+
export {
|
|
2
|
+
App,
|
|
3
|
+
tApp,
|
|
4
|
+
tRoot,
|
|
5
|
+
isRunning,
|
|
6
|
+
getEvents,
|
|
7
|
+
getPager,
|
|
8
|
+
getLoader,
|
|
9
|
+
fetch,
|
|
10
|
+
fetchImage,
|
|
11
|
+
getManager,
|
|
12
|
+
getTargetManager,
|
|
13
|
+
getAnimationManager,
|
|
14
|
+
getRunScheduler,
|
|
15
|
+
getLocationManager,
|
|
16
|
+
getScreenWidth,
|
|
17
|
+
getScreenHeight,
|
|
18
|
+
getVisibles,
|
|
19
|
+
getResizeLastUpdate,
|
|
20
|
+
getTModelById,
|
|
21
|
+
getDomTModelById
|
|
22
|
+
} from "./build/App.js";
|
|
23
|
+
|
|
2
24
|
export * from "./build/TModel.js";
|
|
3
25
|
export * from "./build/Moves.js";
|
|
4
26
|
export * from "./build/SearchUtil.js";
|
|
@@ -7,7 +29,7 @@ export * from "./build/TargetUtil.js";
|
|
|
7
29
|
export * from "./build/TargetParser.js";
|
|
8
30
|
export * from "./build/TModelUtil.js";
|
|
9
31
|
export * from "./build/TUtil.js";
|
|
10
|
-
export * from "./build/DomInit.js"
|
|
32
|
+
export * from "./build/DomInit.js";
|
|
11
33
|
export * from "./build/$Dom.js";
|
|
12
34
|
export * from "./build/Bracket.js";
|
|
13
35
|
export * from "./build/BracketGenerator.js";
|
|
@@ -19,7 +41,7 @@ export * from "./build/AnimationUtil.js";
|
|
|
19
41
|
export * from "./build/VisibilityUtil.js";
|
|
20
42
|
export * from "./build/ScheduleUtil.js";
|
|
21
43
|
|
|
22
|
-
import * as
|
|
44
|
+
import * as AppModule from './build/App.js';
|
|
23
45
|
import * as TModel from './build/TModel.js';
|
|
24
46
|
import * as Moves from './build/Moves.js';
|
|
25
47
|
import * as SearchUtil from './build/SearchUtil.js';
|
|
@@ -41,7 +63,7 @@ import * as VisibilityUtil from './build/VisibilityUtil.js';
|
|
|
41
63
|
import * as ScheduleUtil from './build/ScheduleUtil.js';
|
|
42
64
|
|
|
43
65
|
const TargetJS = {
|
|
44
|
-
...
|
|
66
|
+
...AppModule,
|
|
45
67
|
...TModel,
|
|
46
68
|
...Moves,
|
|
47
69
|
...SearchUtil,
|
|
@@ -67,4 +89,4 @@ if (typeof window !== 'undefined') {
|
|
|
67
89
|
window.TargetJS = TargetJS;
|
|
68
90
|
}
|
|
69
91
|
|
|
70
|
-
export default TargetJS;
|
|
92
|
+
export default TargetJS;
|
package/build/$Dom.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.$Dom = void 0;
|
|
7
|
-
var _TUtil = require("./TUtil.js");
|
|
8
|
-
var _App = require("./App.js");
|
|
9
1
|
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); }
|
|
10
2
|
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
11
3
|
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); } }
|
|
12
4
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
13
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
6
|
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); }
|
|
7
|
+
import { TUtil } from "./TUtil.js";
|
|
8
|
+
import { getManager } from "./App.js";
|
|
9
|
+
|
|
15
10
|
/**
|
|
16
11
|
* It serves as a wrapper for all DOM operations.
|
|
17
12
|
*/
|
|
18
|
-
var $Dom =
|
|
13
|
+
var $Dom = /*#__PURE__*/function () {
|
|
19
14
|
function $Dom(elemSelector) {
|
|
20
15
|
_classCallCheck(this, $Dom);
|
|
21
16
|
if (typeof elemSelector === 'string') {
|
|
@@ -208,7 +203,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
208
203
|
if (!this.element) {
|
|
209
204
|
return;
|
|
210
205
|
}
|
|
211
|
-
if (
|
|
206
|
+
if (TUtil.isDefined(value)) {
|
|
212
207
|
this.element.setAttribute(name, value);
|
|
213
208
|
} else {
|
|
214
209
|
return this.element.getAttribute(name);
|
|
@@ -221,7 +216,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
221
216
|
return;
|
|
222
217
|
}
|
|
223
218
|
var currentValue = this.element.value;
|
|
224
|
-
if (
|
|
219
|
+
if (TUtil.isDefined(_value)) {
|
|
225
220
|
this.element.value = _value;
|
|
226
221
|
}
|
|
227
222
|
return currentValue;
|
|
@@ -236,8 +231,8 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
236
231
|
}, {
|
|
237
232
|
key: "width",
|
|
238
233
|
value: function width(_width) {
|
|
239
|
-
if (
|
|
240
|
-
this.element.style.width =
|
|
234
|
+
if (TUtil.isDefined(_width)) {
|
|
235
|
+
this.element.style.width = TUtil.isNumber(_width) ? "".concat(_width, "px") : _width;
|
|
241
236
|
} else {
|
|
242
237
|
return this.element.offsetWidth;
|
|
243
238
|
}
|
|
@@ -245,8 +240,8 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
245
240
|
}, {
|
|
246
241
|
key: "height",
|
|
247
242
|
value: function height(_height) {
|
|
248
|
-
if (
|
|
249
|
-
this.element.style.height =
|
|
243
|
+
if (TUtil.isDefined(_height)) {
|
|
244
|
+
this.element.style.height = TUtil.isNumber(_height) ? "".concat(_height, "px") : _height;
|
|
250
245
|
} else {
|
|
251
246
|
return this.element.offsetHeight;
|
|
252
247
|
}
|
|
@@ -254,7 +249,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
254
249
|
}, {
|
|
255
250
|
key: "css",
|
|
256
251
|
value: function css(_css) {
|
|
257
|
-
if (
|
|
252
|
+
if (TUtil.isDefined(_css)) {
|
|
258
253
|
this.element.className = _css;
|
|
259
254
|
} else {
|
|
260
255
|
return this.element.className;
|
|
@@ -283,7 +278,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
283
278
|
key: "getStyleValue",
|
|
284
279
|
value: function getStyleValue(name) {
|
|
285
280
|
var styleValue = this.style(name);
|
|
286
|
-
var numericValue =
|
|
281
|
+
var numericValue = TUtil.isDefined(styleValue) ? styleValue.replace(/[^-\d.]/g, '') : 0;
|
|
287
282
|
return parseFloat(numericValue);
|
|
288
283
|
}
|
|
289
284
|
}, {
|
|
@@ -402,7 +397,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
402
397
|
}, {
|
|
403
398
|
key: "html",
|
|
404
399
|
value: function html(_html) {
|
|
405
|
-
if (
|
|
400
|
+
if (TUtil.isDefined(_html)) {
|
|
406
401
|
if (this.isNoSlotHost() || !this.hasRealChildren) {
|
|
407
402
|
this.element.innerHTML = _html;
|
|
408
403
|
} else {
|
|
@@ -416,7 +411,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
416
411
|
}, {
|
|
417
412
|
key: "text",
|
|
418
413
|
value: function text(_text) {
|
|
419
|
-
if (
|
|
414
|
+
if (TUtil.isDefined(_text)) {
|
|
420
415
|
if (this.isNoSlotHost() || !this.hasRealChildren) {
|
|
421
416
|
this.element.textContent = _text;
|
|
422
417
|
} else {
|
|
@@ -464,7 +459,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
464
459
|
}, {
|
|
465
460
|
key: "innerHTML",
|
|
466
461
|
value: function innerHTML(html) {
|
|
467
|
-
if (
|
|
462
|
+
if (TUtil.isDefined(html)) {
|
|
468
463
|
this.element.innerHTML = html;
|
|
469
464
|
} else {
|
|
470
465
|
return this.element.innerHTML;
|
|
@@ -473,7 +468,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
473
468
|
}, {
|
|
474
469
|
key: "innerText",
|
|
475
470
|
value: function innerText(text) {
|
|
476
|
-
if (
|
|
471
|
+
if (TUtil.isDefined(text)) {
|
|
477
472
|
this.element.innerText = text;
|
|
478
473
|
} else {
|
|
479
474
|
return this.element.innerText;
|
|
@@ -524,7 +519,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
524
519
|
}, {
|
|
525
520
|
key: "getContext",
|
|
526
521
|
value: function getContext(type, selector) {
|
|
527
|
-
var element =
|
|
522
|
+
var element = TUtil.isDefined(selector) ? $Dom.query(selector) : this.query('canvas');
|
|
528
523
|
return element ? element.getContext(type) : undefined;
|
|
529
524
|
}
|
|
530
525
|
}, {
|
|
@@ -616,7 +611,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
616
611
|
value: function findNearestParentWithId(element) {
|
|
617
612
|
while (element) {
|
|
618
613
|
var oid = typeof element.getAttribute === 'function' && element.getAttribute("id") ? element.getAttribute("id") : null;
|
|
619
|
-
if (oid &&
|
|
614
|
+
if (oid && getManager().visibleOidMap[oid]) {
|
|
620
615
|
return oid;
|
|
621
616
|
}
|
|
622
617
|
element = element.parentElement;
|
|
@@ -625,7 +620,7 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
625
620
|
}, {
|
|
626
621
|
key: "detach",
|
|
627
622
|
value: function detach(element) {
|
|
628
|
-
var parent =
|
|
623
|
+
var parent = TUtil.isDefined(element) ? element.parentElement : null;
|
|
629
624
|
if (parent) {
|
|
630
625
|
parent.removeChild(element);
|
|
631
626
|
}
|
|
@@ -692,4 +687,5 @@ var $Dom = exports.$Dom = /*#__PURE__*/function () {
|
|
|
692
687
|
}
|
|
693
688
|
}
|
|
694
689
|
}]);
|
|
695
|
-
}();
|
|
690
|
+
}();
|
|
691
|
+
export { $Dom };
|
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.AnimationManager = void 0;
|
|
7
|
-
var _TModelUtil = require("./TModelUtil.js");
|
|
8
|
-
var _AnimationUtil = require("./AnimationUtil.js");
|
|
9
|
-
var _TargetData = require("./TargetData.js");
|
|
10
|
-
var _App = require("./App.js");
|
|
11
|
-
var _TargetUtil = require("./TargetUtil.js");
|
|
12
|
-
var _TUtil = require("./TUtil.js");
|
|
13
|
-
var _ScheduleUtil = require("./ScheduleUtil.js");
|
|
14
1
|
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); }
|
|
15
2
|
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; }
|
|
16
3
|
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); }
|
|
@@ -34,7 +21,14 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
|
|
|
34
21
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
35
22
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
36
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); }
|
|
37
|
-
|
|
24
|
+
import { TModelUtil } from "./TModelUtil.js";
|
|
25
|
+
import { AnimationUtil } from "./AnimationUtil.js";
|
|
26
|
+
import { TargetData } from "./TargetData.js";
|
|
27
|
+
import { getRunScheduler } from "./App.js";
|
|
28
|
+
import { TargetUtil } from "./TargetUtil.js";
|
|
29
|
+
import { TUtil } from "./TUtil.js";
|
|
30
|
+
import { ScheduleUtil } from "./ScheduleUtil.js";
|
|
31
|
+
var AnimationManager = /*#__PURE__*/function () {
|
|
38
32
|
function AnimationManager() {
|
|
39
33
|
_classCallCheck(this, AnimationManager);
|
|
40
34
|
this.waapiPoller = {
|
|
@@ -48,7 +42,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
48
42
|
return _createClass(AnimationManager, [{
|
|
49
43
|
key: "animate",
|
|
50
44
|
value: function animate(tmodel) {
|
|
51
|
-
var batch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] :
|
|
45
|
+
var batch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : AnimationUtil.emptyBatch();
|
|
52
46
|
var hooks = arguments.length > 2 ? arguments[2] : undefined;
|
|
53
47
|
var pausedKeys = arguments.length > 3 ? arguments[3] : undefined;
|
|
54
48
|
if (this.isShuttingDown) {
|
|
@@ -58,17 +52,17 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
58
52
|
return a.keyTime - b.keyTime;
|
|
59
53
|
});
|
|
60
54
|
if (tmodel.lastBatch) {
|
|
61
|
-
var cutTime = Math.min(
|
|
55
|
+
var cutTime = Math.min(TUtil.now() - tmodel.lastBatch.startTime, tmodel.lastBatch.totalDuration);
|
|
62
56
|
tmodel.lastBatch = this.cutLastBatch(tmodel, tmodel.lastBatch, cutTime);
|
|
63
|
-
|
|
57
|
+
AnimationUtil.rebaseCutBatchMeta(tmodel, tmodel.lastBatch);
|
|
64
58
|
if (pausedKeys !== null && pausedKeys !== void 0 && pausedKeys.size) {
|
|
65
59
|
var pausedFrame = {
|
|
66
60
|
styleMap: _objectSpread({}, tmodel.lastBatch.frames[0].styleMap),
|
|
67
61
|
tfMap: _objectSpread({}, tmodel.lastBatch.frames[0].tfMap),
|
|
68
62
|
keyMeta: new Map(tmodel.lastBatch.frames[0].keyMeta)
|
|
69
63
|
};
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
AnimationUtil.addToUpdatingTargets(tmodel, pausedKeys);
|
|
65
|
+
AnimationUtil.removeKeysFromBatch(tmodel.lastBatch, pausedKeys);
|
|
72
66
|
this.callFireOnEndOnConflict(tmodel, tmodel.lastBatch, batch);
|
|
73
67
|
this.mergeBatches(tmodel.lastBatch, batch);
|
|
74
68
|
this.deleteAnimation(tmodel);
|
|
@@ -109,11 +103,11 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
109
103
|
tmodel.tfMap[key] = tmodel.val(key);
|
|
110
104
|
});
|
|
111
105
|
var tfMap = _objectSpread(_objectSpread({}, tmodel.tfMap), frame.tfMap);
|
|
112
|
-
out.transform =
|
|
106
|
+
out.transform = TModelUtil.getTransformString(tmodel, tfMap);
|
|
113
107
|
frame.tfMap = tfMap;
|
|
114
108
|
transformAnimation = true;
|
|
115
109
|
}
|
|
116
|
-
|
|
110
|
+
AnimationUtil.addUnitsToFrame(out);
|
|
117
111
|
return out;
|
|
118
112
|
});
|
|
119
113
|
var compactKeyframes = this.filterRedundantKeyframes(keyframes);
|
|
@@ -123,7 +117,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
123
117
|
iterations: 1,
|
|
124
118
|
easing: batch.easing || "linear"
|
|
125
119
|
};
|
|
126
|
-
batch.startTime =
|
|
120
|
+
batch.startTime = TUtil.now();
|
|
127
121
|
tmodel.lastBatch = batch;
|
|
128
122
|
tmodel.lastBatch.transformAnimation = transformAnimation;
|
|
129
123
|
tmodel.finalKeyframe = compactKeyframes[compactKeyframes.length - 1];
|
|
@@ -134,9 +128,9 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
134
128
|
try {
|
|
135
129
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
136
130
|
var _originalKey = _step2.value;
|
|
137
|
-
var cleanKey =
|
|
131
|
+
var cleanKey = TargetUtil.getTargetName(_originalKey);
|
|
138
132
|
var recId = this.getRecordId(tmodel, _originalKey);
|
|
139
|
-
var _TargetUtil$getOrigin =
|
|
133
|
+
var _TargetUtil$getOrigin = TargetUtil.getOriginalNames(tmodel, _originalKey),
|
|
140
134
|
originalTModel = _TargetUtil$getOrigin.originalTModel,
|
|
141
135
|
originalTargetName = _TargetUtil$getOrigin.originalTargetName;
|
|
142
136
|
var rec = {
|
|
@@ -181,7 +175,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
181
175
|
if (!keySet.size) {
|
|
182
176
|
return;
|
|
183
177
|
}
|
|
184
|
-
this.animate(tmodel,
|
|
178
|
+
this.animate(tmodel, AnimationUtil.emptyBatch(), AnimationUtil.getAnimationHooks(), keySet);
|
|
185
179
|
}
|
|
186
180
|
}, {
|
|
187
181
|
key: "finalizeAnimation",
|
|
@@ -208,21 +202,21 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
208
202
|
if (!tmodel.hasAnimatingTargets()) {
|
|
209
203
|
if (tmodel.finalKeyframe) {
|
|
210
204
|
if (tmodel.hasDom()) {
|
|
211
|
-
|
|
205
|
+
AnimationUtil.fixStyleByAnimation(tmodel, tmodel.finalKeyframe);
|
|
212
206
|
}
|
|
213
207
|
}
|
|
214
208
|
tmodel.lastBatch = undefined;
|
|
215
209
|
}
|
|
216
210
|
rec.status = 'complete';
|
|
217
211
|
rec.hooks.fireOnEnd(tmodel, originalKey);
|
|
218
|
-
|
|
212
|
+
getRunScheduler().scheduleOnlyIfEarlier(1, "animate-".concat(tmodel.oid, "---").concat(originalKey));
|
|
219
213
|
}
|
|
220
214
|
} catch (err) {
|
|
221
215
|
_iterator3.e(err);
|
|
222
216
|
} finally {
|
|
223
217
|
_iterator3.f();
|
|
224
218
|
}
|
|
225
|
-
|
|
219
|
+
getRunScheduler().schedule(35, "finalizeAnimation");
|
|
226
220
|
}
|
|
227
221
|
}, {
|
|
228
222
|
key: "startProgressPoller",
|
|
@@ -248,7 +242,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
248
242
|
}
|
|
249
243
|
var tmodel = record.tmodel,
|
|
250
244
|
originalKey = record.originalKey;
|
|
251
|
-
if (record.status !== 'finished' &&
|
|
245
|
+
if (record.status !== 'finished' && ScheduleUtil.shouldPauseTarget(tmodel, originalKey)) {
|
|
252
246
|
var keys = pauseMap.get(tmodel);
|
|
253
247
|
if (!keys) {
|
|
254
248
|
keys = new Set();
|
|
@@ -269,7 +263,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
269
263
|
animsToFinalize.add(record.anim);
|
|
270
264
|
}
|
|
271
265
|
if (progress > 0 && record.status !== 'finished') {
|
|
272
|
-
var result =
|
|
266
|
+
var result = AnimationUtil.updateTModelFromRecord(record);
|
|
273
267
|
if ((result === null || result === void 0 ? void 0 : result.status) === 'finished') {
|
|
274
268
|
record.status = 'finished';
|
|
275
269
|
}
|
|
@@ -318,12 +312,12 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
318
312
|
}, {
|
|
319
313
|
key: "getAt",
|
|
320
314
|
value: function getAt(frame, key) {
|
|
321
|
-
return
|
|
315
|
+
return TargetData.isTransformKey(key) ? frame.tfMap[key] : frame.styleMap[key];
|
|
322
316
|
}
|
|
323
317
|
}, {
|
|
324
318
|
key: "setAt",
|
|
325
319
|
value: function setAt(frame, key, value) {
|
|
326
|
-
if (
|
|
320
|
+
if (TargetData.isTransformKey(key)) {
|
|
327
321
|
frame.tfMap[key] = value;
|
|
328
322
|
} else {
|
|
329
323
|
frame.styleMap[key] = value;
|
|
@@ -354,7 +348,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
354
348
|
}, {
|
|
355
349
|
key: "backfillKeyAcrossFramesUsingMorph",
|
|
356
350
|
value: function backfillKeyAcrossFramesUsingMorph(tmodel, originalKey, frames) {
|
|
357
|
-
var cleanKey =
|
|
351
|
+
var cleanKey = TargetUtil.getTargetName(originalKey);
|
|
358
352
|
var idxs = [];
|
|
359
353
|
for (var i = 0; i < frames.length; i++) {
|
|
360
354
|
if (this.getAt(frames[i], cleanKey) !== undefined) {
|
|
@@ -380,17 +374,17 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
380
374
|
var t0 = leftFrame.keyTime;
|
|
381
375
|
var t1 = rightFrame.keyTime;
|
|
382
376
|
var spanTime = t1 - t0;
|
|
383
|
-
if (!
|
|
377
|
+
if (!TUtil.isDefined(spanSteps) || spanSteps <= 0 || spanTime <= 0) {
|
|
384
378
|
continue;
|
|
385
379
|
}
|
|
386
380
|
var previousLogicalStep = baseStepOffset;
|
|
387
381
|
for (var _i = i0 + 1; _i < i1; _i++) {
|
|
388
382
|
var frame = frames[_i];
|
|
389
|
-
var progress =
|
|
383
|
+
var progress = TUtil.limit((frame.keyTime - t0) / spanTime, 0, 1);
|
|
390
384
|
var localStep = Math.round(progress * spanSteps);
|
|
391
|
-
var logicalStep =
|
|
385
|
+
var logicalStep = TUtil.limit(baseStepOffset + localStep, 0, segmentSteps);
|
|
392
386
|
var stepsFromPreviousFrame = Math.max(logicalStep - previousLogicalStep, 0);
|
|
393
|
-
var v =
|
|
387
|
+
var v = TModelUtil.morph(originalKey, from, to, progress);
|
|
394
388
|
this.setAt(frame, cleanKey, v);
|
|
395
389
|
frame.keyMeta.set(cleanKey, _objectSpread(_objectSpread({}, rightMeta), {}, {
|
|
396
390
|
steps: stepsFromPreviousFrame,
|
|
@@ -438,10 +432,10 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
438
432
|
});
|
|
439
433
|
var tfMap = _objectSpread(_objectSpread({}, tmodel.tfMap), frame.tfMap);
|
|
440
434
|
frame.tfMap = tfMap;
|
|
441
|
-
out.transform =
|
|
435
|
+
out.transform = TModelUtil.getTransformString(tmodel, tfMap);
|
|
442
436
|
}
|
|
443
|
-
|
|
444
|
-
|
|
437
|
+
AnimationUtil.addUnitsToFrame(out);
|
|
438
|
+
AnimationUtil.fixStyleByAnimation(tmodel, out);
|
|
445
439
|
}
|
|
446
440
|
}, {
|
|
447
441
|
key: "freezeTModelAtCurrentTime",
|
|
@@ -449,7 +443,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
449
443
|
if (!tmodel.lastBatch) {
|
|
450
444
|
return;
|
|
451
445
|
}
|
|
452
|
-
var cutTime = Math.min(
|
|
446
|
+
var cutTime = Math.min(TUtil.now() - tmodel.lastBatch.startTime, tmodel.lastBatch.totalDuration);
|
|
453
447
|
tmodel.lastBatch = this.cutLastBatch(tmodel, tmodel.lastBatch, cutTime);
|
|
454
448
|
this.fixTModelStyleFromFrame(tmodel, tmodel.lastBatch.frames[0]);
|
|
455
449
|
}
|
|
@@ -572,7 +566,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
572
566
|
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
573
567
|
tmodel = _step10.value;
|
|
574
568
|
this.freezeTModelAtCurrentTime(tmodel);
|
|
575
|
-
|
|
569
|
+
AnimationUtil.detachAnimationsOnDeleteDom(tmodel);
|
|
576
570
|
tmodel.lastBatch = undefined;
|
|
577
571
|
tmodel.finalKeyframe = undefined;
|
|
578
572
|
tmodel.finalRawFrame = undefined;
|
|
@@ -632,7 +626,7 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
632
626
|
if (record.status === 'canceled' || record.status === 'detached') {
|
|
633
627
|
continue;
|
|
634
628
|
}
|
|
635
|
-
var result =
|
|
629
|
+
var result = AnimationUtil.getValueFromAnim(record);
|
|
636
630
|
if (!result) {
|
|
637
631
|
continue;
|
|
638
632
|
}
|
|
@@ -909,4 +903,5 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
|
|
|
909
903
|
}
|
|
910
904
|
}
|
|
911
905
|
}]);
|
|
912
|
-
}();
|
|
906
|
+
}();
|
|
907
|
+
export { AnimationManager };
|