targetj 1.0.240 → 1.0.242

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.
@@ -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
- var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
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] : _AnimationUtil.AnimationUtil.emptyBatch();
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(_TUtil.TUtil.now() - tmodel.lastBatch.startTime, tmodel.lastBatch.totalDuration);
55
+ var cutTime = Math.min(TUtil.now() - tmodel.lastBatch.startTime, tmodel.lastBatch.totalDuration);
62
56
  tmodel.lastBatch = this.cutLastBatch(tmodel, tmodel.lastBatch, cutTime);
63
- _AnimationUtil.AnimationUtil.rebaseCutBatchMeta(tmodel, tmodel.lastBatch);
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
- _AnimationUtil.AnimationUtil.addToUpdatingTargets(tmodel, pausedKeys);
71
- _AnimationUtil.AnimationUtil.removeKeysFromBatch(tmodel.lastBatch, pausedKeys);
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 = _TModelUtil.TModelUtil.getTransformString(tmodel, tfMap);
106
+ out.transform = TModelUtil.getTransformString(tmodel, tfMap);
113
107
  frame.tfMap = tfMap;
114
108
  transformAnimation = true;
115
109
  }
116
- _AnimationUtil.AnimationUtil.addUnitsToFrame(out);
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 = _TUtil.TUtil.now();
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 = _TargetUtil.TargetUtil.getTargetName(_originalKey);
131
+ var cleanKey = TargetUtil.getTargetName(_originalKey);
138
132
  var recId = this.getRecordId(tmodel, _originalKey);
139
- var _TargetUtil$getOrigin = _TargetUtil.TargetUtil.getOriginalNames(tmodel, _originalKey),
133
+ var _TargetUtil$getOrigin = TargetUtil.getOriginalNames(tmodel, _originalKey),
140
134
  originalTModel = _TargetUtil$getOrigin.originalTModel,
141
135
  originalTargetName = _TargetUtil$getOrigin.originalTargetName;
142
136
  var rec = {
@@ -152,9 +146,9 @@ var AnimationManager = exports.AnimationManager = /*#__PURE__*/function () {
152
146
  needsFireOnStep: true,
153
147
  hooks: hooks
154
148
  };
155
- tmodel.addToAnimatingMap(_originalKey);
156
149
  var targetValue = tmodel.targetValues[_originalKey];
157
150
  if (targetValue) {
151
+ tmodel.addToAnimatingMap(_originalKey);
158
152
  targetValue.status = !targetValue.snapAnimation ? 'updating' : targetValue.status;
159
153
  }
160
154
  this.recordMap.set(recId, 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, _AnimationUtil.AnimationUtil.emptyBatch(), _AnimationUtil.AnimationUtil.getAnimationHooks(), keySet);
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
- _AnimationUtil.AnimationUtil.fixStyleByAnimation(tmodel, tmodel.finalKeyframe);
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
- (0, _App.getRunScheduler)().scheduleOnlyIfEarlier(1, "animate-".concat(tmodel.oid, "---").concat(originalKey));
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
- (0, _App.getRunScheduler)().schedule(35, "finalizeAnimation");
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' && _ScheduleUtil.ScheduleUtil.shouldPauseTarget(tmodel, originalKey)) {
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 = _AnimationUtil.AnimationUtil.updateTModelFromRecord(record);
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 _TargetData.TargetData.isTransformKey(key) ? frame.tfMap[key] : frame.styleMap[key];
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 (_TargetData.TargetData.isTransformKey(key)) {
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 = _TargetUtil.TargetUtil.getTargetName(originalKey);
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 (!_TUtil.TUtil.isDefined(spanSteps) || spanSteps <= 0 || spanTime <= 0) {
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 = _TUtil.TUtil.limit((frame.keyTime - t0) / spanTime, 0, 1);
383
+ var progress = TUtil.limit((frame.keyTime - t0) / spanTime, 0, 1);
390
384
  var localStep = Math.round(progress * spanSteps);
391
- var logicalStep = _TUtil.TUtil.limit(baseStepOffset + localStep, 0, segmentSteps);
385
+ var logicalStep = TUtil.limit(baseStepOffset + localStep, 0, segmentSteps);
392
386
  var stepsFromPreviousFrame = Math.max(logicalStep - previousLogicalStep, 0);
393
- var v = _TModelUtil.TModelUtil.morph(originalKey, from, to, progress);
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 = _TModelUtil.TModelUtil.getTransformString(tmodel, tfMap);
435
+ out.transform = TModelUtil.getTransformString(tmodel, tfMap);
442
436
  }
443
- _AnimationUtil.AnimationUtil.addUnitsToFrame(out);
444
- _AnimationUtil.AnimationUtil.fixStyleByAnimation(tmodel, out);
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(_TUtil.TUtil.now() - tmodel.lastBatch.startTime, tmodel.lastBatch.totalDuration);
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
- _AnimationUtil.AnimationUtil.detachAnimationsOnDeleteDom(tmodel);
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 = _AnimationUtil.AnimationUtil.getValueFromAnim(record);
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 };
@@ -1,15 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.AnimationUtil = void 0;
7
- var _TargetUtil = require("./TargetUtil.js");
8
- var _TargetData = require("./TargetData.js");
9
- var _TModelUtil = require("./TModelUtil.js");
10
- var _App = require("./App.js");
11
- var _ScheduleUtil = require("./ScheduleUtil.js");
12
- var _TUtil = require("./TUtil.js");
13
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); }
14
2
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
15
3
  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."); }
@@ -26,11 +14,18 @@ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Can
26
14
  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); } }
27
15
  function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
28
16
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
29
- 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); } // AnimationUtil.js
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ // AnimationUtil.js
19
+ import { TargetUtil } from "./TargetUtil.js";
20
+ import { TargetData } from "./TargetData.js";
21
+ import { TModelUtil } from "./TModelUtil.js";
22
+ import { getAnimationManager, getTargetManager } from "./App.js";
23
+ import { ScheduleUtil } from "./ScheduleUtil.js";
24
+ import { TUtil } from "./TUtil.js";
30
25
  /**
31
26
  * It provides helper functions for Animation.
32
27
  */
33
- var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
28
+ var AnimationUtil = /*#__PURE__*/function () {
34
29
  function AnimationUtil() {
35
30
  _classCallCheck(this, AnimationUtil);
36
31
  }
@@ -60,9 +55,9 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
60
55
  var key = keyList[i];
61
56
  needsAnimation = true;
62
57
  var value = valueList[i];
63
- var targetValue = tmodel.targetValues[key] || _TargetUtil.TargetUtil.emptyValue();
64
- var cleanKey = _TargetUtil.TargetUtil.getTargetName(key);
65
- if (_TargetData.TargetData.isTransformKey(cleanKey)) {
58
+ var targetValue = tmodel.targetValues[key] || TargetUtil.emptyValue();
59
+ var cleanKey = TargetUtil.getTargetName(key);
60
+ if (TargetData.isTransformKey(cleanKey)) {
66
61
  tfMap0[cleanKey] = value;
67
62
  tfMap1[cleanKey] = value;
68
63
  } else {
@@ -104,7 +99,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
104
99
  keyMap: keyMap,
105
100
  totalDuration: 1
106
101
  };
107
- (0, _App.getAnimationManager)().animate(tmodel, batch, AnimationUtil.getAnimationHooks());
102
+ getAnimationManager().animate(tmodel, batch, AnimationUtil.getAnimationHooks());
108
103
  }
109
104
  }, {
110
105
  key: "fixStyleByAnimation",
@@ -137,7 +132,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
137
132
  tmodel.$dom.height(value);
138
133
  } else if (key === 'transform') {
139
134
  tmodel.$dom.transform(value, tmodel.val('transformOrder'));
140
- } else if (!_TargetData.TargetData.transformMap[key]) {
135
+ } else if (!TargetData.transformMap[key]) {
141
136
  tmodel.$dom.style(key, value);
142
137
  tmodel.styleMap[key] = num;
143
138
  }
@@ -156,7 +151,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
156
151
  delete out[k];
157
152
  continue;
158
153
  }
159
- if (typeof v === 'number' && _TargetData.TargetData.styleWithUnitMap[k]) {
154
+ if (typeof v === 'number' && TargetData.styleWithUnitMap[k]) {
160
155
  if ((k === 'width' || k === 'height') && v < 0) {
161
156
  v = 0;
162
157
  }
@@ -169,20 +164,20 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
169
164
  value: function getAnimationHooks() {
170
165
  return {
171
166
  morph: function morph(tm, key, from, to, step, steps) {
172
- return _TModelUtil.TModelUtil.easingMorph(tm, key, from, to, step, steps);
167
+ return TModelUtil.easingMorph(tm, key, from, to, step, steps);
173
168
  },
174
169
  fireOnStep: function fireOnStep(tm, key, step) {
175
- return (0, _App.getTargetManager)().fireOnStep(tm, key, step);
170
+ return getTargetManager().fireOnStep(tm, key, step);
176
171
  },
177
172
  fireOnEnd: function fireOnEnd(tm, key) {
178
- return (0, _App.getTargetManager)().fireOnEnd(tm, key);
173
+ return getTargetManager().fireOnEnd(tm, key);
179
174
  }
180
175
  };
181
176
  }
182
177
  }, {
183
178
  key: "addToUpdatingTargets",
184
179
  value: function addToUpdatingTargets(tmodel, originalKeys) {
185
- var recordMap = (0, _App.getAnimationManager)().recordMap;
180
+ var recordMap = getAnimationManager().recordMap;
186
181
  var records = [];
187
182
  var _iterator = _createForOfIteratorHelper(recordMap),
188
183
  _step;
@@ -222,7 +217,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
222
217
  }, {
223
218
  key: "addToNODomUpdatingTargets",
224
219
  value: function addToNODomUpdatingTargets(tmodel, originalKeys) {
225
- var recordMap = (0, _App.getAnimationManager)().recordMap;
220
+ var recordMap = getAnimationManager().recordMap;
226
221
  var records = [];
227
222
  var _iterator2 = _createForOfIteratorHelper(recordMap),
228
223
  _step2;
@@ -243,7 +238,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
243
238
  } finally {
244
239
  _iterator2.f();
245
240
  }
246
- var now = _TUtil.TUtil.now();
241
+ var now = TUtil.now();
247
242
  for (var _i4 = 0, _records2 = records; _i4 < _records2.length; _i4++) {
248
243
  var record = _records2[_i4];
249
244
  var originalKey = record.originalKey;
@@ -272,7 +267,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
272
267
  try {
273
268
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
274
269
  var originalKey = _step5.value;
275
- var cleanKey = _TargetUtil.TargetUtil.getTargetName(originalKey);
270
+ var cleanKey = TargetUtil.getTargetName(originalKey);
276
271
  delete frame.styleMap[cleanKey];
277
272
  delete frame.tfMap[cleanKey];
278
273
  if (frame.keyMeta) {
@@ -295,7 +290,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
295
290
  try {
296
291
  for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
297
292
  var _originalKey = _step4.value;
298
- var _cleanKey = _TargetUtil.TargetUtil.getTargetName(_originalKey);
293
+ var _cleanKey = TargetUtil.getTargetName(_originalKey);
299
294
  delete batch.keyMap[_cleanKey];
300
295
  }
301
296
  } catch (err) {
@@ -326,17 +321,17 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
326
321
  steps = result.steps,
327
322
  cycle = result.cycle,
328
323
  valuePointer = result.valuePointer;
329
- (0, _App.getAnimationManager)().setAt(tmodel, cleanKey, value);
324
+ getAnimationManager().setAt(tmodel, cleanKey, value);
330
325
  tmodel.val(originalKey, value);
331
326
  var targetValue = tmodel.targetValues[originalKey];
332
327
  if (targetValue) {
333
- if (_TUtil.TUtil.isDefined(step) && _TUtil.TUtil.isDefined(steps) && steps > 0) {
328
+ if (TUtil.isDefined(step) && TUtil.isDefined(steps) && steps > 0) {
334
329
  targetValue.step = step;
335
330
  }
336
- if (_TUtil.TUtil.isDefined(valuePointer)) {
331
+ if (TUtil.isDefined(valuePointer)) {
337
332
  targetValue.valuePointer = valuePointer;
338
333
  }
339
- if (_TUtil.TUtil.isDefined(cycle)) {
334
+ if (TUtil.isDefined(cycle)) {
340
335
  targetValue.cycle = cycle;
341
336
  }
342
337
  tmodel.setActual(originalKey, value);
@@ -365,7 +360,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
365
360
  if (!ct) {
366
361
  return;
367
362
  }
368
- var p = _TUtil.TUtil.isDefined(ct.progress) ? _TUtil.TUtil.limit(ct.progress, 0, 1) : 1;
363
+ var p = TUtil.isDefined(ct.progress) ? TUtil.limit(ct.progress, 0, 1) : 1;
369
364
  var last = frames.length - 1;
370
365
  var framePointer = 0;
371
366
  if (p <= frames[0].offset) {
@@ -390,10 +385,10 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
390
385
  if (segSpan <= 0) {
391
386
  return;
392
387
  }
393
- var u = _TUtil.TUtil.limit((p - segStart) / segSpan, 0, 1);
394
- var value = _TModelUtil.TModelUtil.morph(originalKey, from, to, u);
388
+ var u = TUtil.limit((p - segStart) / segSpan, 0, 1);
389
+ var value = TModelUtil.morph(originalKey, from, to, u);
395
390
  var remainingSteps = right.steps;
396
- if (!_TUtil.TUtil.isDefined(remainingSteps) || remainingSteps <= 0) {
391
+ if (!TUtil.isDefined(remainingSteps) || remainingSteps <= 0) {
397
392
  var _ref, _right$valuePointer, _ref2, _right$cycle;
398
393
  return {
399
394
  value: value,
@@ -408,10 +403,10 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
408
403
  };
409
404
  }
410
405
  var localStep = Math.round(u * remainingSteps);
411
- localStep = _TUtil.TUtil.limit(localStep, 0, remainingSteps);
406
+ localStep = TUtil.limit(localStep, 0, remainingSteps);
412
407
  var stepOffset = right.stepOffset || 0;
413
408
  var segmentSteps = (_right$segmentSteps = right.segmentSteps) !== null && _right$segmentSteps !== void 0 ? _right$segmentSteps : stepOffset + remainingSteps;
414
- var step = _TUtil.TUtil.limit(stepOffset + localStep, 0, segmentSteps);
409
+ var step = TUtil.limit(stepOffset + localStep, 0, segmentSteps);
415
410
  var status = right.done ? "finished" : "playing";
416
411
  return {
417
412
  value: value,
@@ -427,7 +422,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
427
422
  }, {
428
423
  key: "detachAnimationsOnDeleteDom",
429
424
  value: function detachAnimationsOnDeleteDom(tmodel) {
430
- var recordMap = (0, _App.getAnimationManager)().recordMap;
425
+ var recordMap = getAnimationManager().recordMap;
431
426
  var pauseKeys = new Set();
432
427
  var catchupKeys = new Set();
433
428
  var _iterator6 = _createForOfIteratorHelper(recordMap),
@@ -439,7 +434,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
439
434
  if (record.tmodel !== tmodel) {
440
435
  continue;
441
436
  }
442
- if (_ScheduleUtil.ScheduleUtil.shouldPauseTarget(tmodel, record.originalKey)) {
437
+ if (ScheduleUtil.shouldPauseTarget(tmodel, record.originalKey)) {
443
438
  pauseKeys.add(record.originalKey);
444
439
  } else {
445
440
  catchupKeys.add(record.originalKey);
@@ -461,7 +456,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
461
456
  }, {
462
457
  key: "deleteDetachedRecords",
463
458
  value: function deleteDetachedRecords(tmodel, keys) {
464
- var recordMap = (0, _App.getAnimationManager)().recordMap;
459
+ var recordMap = getAnimationManager().recordMap;
465
460
  var _iterator7 = _createForOfIteratorHelper(recordMap),
466
461
  _step7;
467
462
  try {
@@ -516,11 +511,11 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
516
511
  for (var i = 1; i < batch.frames.length; i++) {
517
512
  var _frame$keyMeta;
518
513
  var frame = batch.frames[i];
519
- if ((0, _App.getAnimationManager)().getAt(frame, cleanKey) === undefined) {
514
+ if (getAnimationManager().getAt(frame, cleanKey) === undefined) {
520
515
  continue;
521
516
  }
522
517
  var meta = (_frame$keyMeta = frame.keyMeta) === null || _frame$keyMeta === void 0 ? void 0 : _frame$keyMeta.get(cleanKey);
523
- if (!meta || !_TUtil.TUtil.isDefined(meta.steps)) {
518
+ if (!meta || !TUtil.isDefined(meta.steps)) {
524
519
  continue;
525
520
  }
526
521
  var oldOffset = meta.stepOffset || 0;
@@ -596,7 +591,7 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
596
591
  timeShift = 0;
597
592
  }
598
593
  }
599
- var isTransform = _TargetData.TargetData.isTransformKey(cleanKey);
594
+ var isTransform = TargetData.isTransformKey(cleanKey);
600
595
  var getFrameAtTime = function getFrameAtTime(t) {
601
596
  var shifted = Math.max(0, t + timeShift);
602
597
  for (var i = 0; i < batch.frames.length; i++) {
@@ -708,4 +703,5 @@ var AnimationUtil = exports.AnimationUtil = /*#__PURE__*/function () {
708
703
  return keyDuration;
709
704
  }
710
705
  }]);
711
- }();
706
+ }();
707
+ export { AnimationUtil };