targetj 1.0.255 → 1.0.257

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.
@@ -97,6 +97,7 @@ var AnimationUtil = /*#__PURE__*/function () {
97
97
  var batch = {
98
98
  frames: frames,
99
99
  keyMap: keyMap,
100
+ snap: true,
100
101
  totalDuration: 1
101
102
  };
102
103
  getAnimationManager().animate(tmodel, batch, AnimationUtil.getAnimationHooks());
@@ -320,12 +321,36 @@ var AnimationUtil = /*#__PURE__*/function () {
320
321
  step = result.step,
321
322
  steps = result.steps,
322
323
  cycle = result.cycle,
323
- valuePointer = result.valuePointer;
324
+ valuePointer = result.valuePointer,
325
+ from = result.from,
326
+ to = result.to,
327
+ interval = result.interval,
328
+ easing = result.easing;
324
329
  getAnimationManager().setAt(tmodel, cleanKey, value);
325
330
  tmodel.val(originalKey, value);
326
331
  var targetValue = tmodel.targetValues[originalKey];
327
332
  if (targetValue) {
328
- if (TUtil.isDefined(step) && TUtil.isDefined(steps) && steps > 0) {
333
+ var _targetValue$valueLis;
334
+ if ((_targetValue$valueLis = targetValue.valueList) !== null && _targetValue$valueLis !== void 0 && _targetValue$valueLis.length) {
335
+ AnimationUtil.syncListTargetSegment(targetValue, result);
336
+ } else {
337
+ if (TUtil.isDefined(from)) {
338
+ targetValue.initialValue = from;
339
+ }
340
+ if (TUtil.isDefined(to)) {
341
+ targetValue.value = to;
342
+ }
343
+ if (TUtil.isDefined(steps)) {
344
+ targetValue.steps = steps;
345
+ }
346
+ if (TUtil.isDefined(interval)) {
347
+ targetValue.interval = interval;
348
+ }
349
+ if (TUtil.isDefined(easing)) {
350
+ targetValue.easing = easing;
351
+ }
352
+ }
353
+ if (TUtil.isDefined(step)) {
329
354
  targetValue.step = step;
330
355
  }
331
356
  if (TUtil.isDefined(valuePointer)) {
@@ -334,6 +359,7 @@ var AnimationUtil = /*#__PURE__*/function () {
334
359
  if (TUtil.isDefined(cycle)) {
335
360
  targetValue.cycle = cycle;
336
361
  }
362
+ targetValue.lastUpdate = TUtil.now();
337
363
  tmodel.setActual(originalKey, value);
338
364
  var fireKey = "".concat(cycle, ":").concat(valuePointer, ":").concat(step);
339
365
  if (record.needsFireOnStep && step > 0 && steps > 0 && record.lastFireOnStepKey !== fireKey) {
@@ -403,6 +429,8 @@ var AnimationUtil = /*#__PURE__*/function () {
403
429
  steps: right.segmentSteps,
404
430
  from: from,
405
431
  to: to,
432
+ interval: right.interval,
433
+ easing: right.easing,
406
434
  valuePointer: (_ref = (_right$valuePointer = right.valuePointer) !== null && _right$valuePointer !== void 0 ? _right$valuePointer : left.valuePointer) !== null && _ref !== void 0 ? _ref : 0,
407
435
  cycle: (_ref2 = (_right$cycle = right.cycle) !== null && _right$cycle !== void 0 ? _right$cycle : left.cycle) !== null && _ref2 !== void 0 ? _ref2 : 0,
408
436
  status: right.done ? "finished" : "playing"
@@ -417,10 +445,12 @@ var AnimationUtil = /*#__PURE__*/function () {
417
445
  value: value,
418
446
  step: step,
419
447
  steps: segmentSteps,
420
- valuePointer: (_ref3 = (_right$valuePointer2 = right.valuePointer) !== null && _right$valuePointer2 !== void 0 ? _right$valuePointer2 : left.valuePointer) !== null && _ref3 !== void 0 ? _ref3 : 0,
421
- cycle: (_ref4 = (_right$cycle2 = right.cycle) !== null && _right$cycle2 !== void 0 ? _right$cycle2 : left.cycle) !== null && _ref4 !== void 0 ? _ref4 : 0,
422
448
  from: from,
423
449
  to: to,
450
+ interval: right.interval,
451
+ easing: right.easing,
452
+ valuePointer: (_ref3 = (_right$valuePointer2 = right.valuePointer) !== null && _right$valuePointer2 !== void 0 ? _right$valuePointer2 : left.valuePointer) !== null && _ref3 !== void 0 ? _ref3 : 0,
453
+ cycle: (_ref4 = (_right$cycle2 = right.cycle) !== null && _right$cycle2 !== void 0 ? _right$cycle2 : left.cycle) !== null && _ref4 !== void 0 ? _ref4 : 0,
424
454
  status: right.done ? "finished" : "playing"
425
455
  };
426
456
  }
@@ -577,6 +607,29 @@ var AnimationUtil = /*#__PURE__*/function () {
577
607
  })))) : 0;
578
608
  return removed;
579
609
  }
610
+ }, {
611
+ key: "syncListTargetSegment",
612
+ value: function syncListTargetSegment(targetValue, result) {
613
+ var _targetValue$valueLis2, _ref5, _result$valuePointer, _targetValue$stepList, _targetValue$interval, _targetValue$easingLi;
614
+ if (!(targetValue !== null && targetValue !== void 0 && (_targetValue$valueLis2 = targetValue.valueList) !== null && _targetValue$valueLis2 !== void 0 && _targetValue$valueLis2.length)) {
615
+ return;
616
+ }
617
+ var maxPointer = targetValue.valueList.length - 1;
618
+ var pointer = TUtil.limit((_ref5 = (_result$valuePointer = result.valuePointer) !== null && _result$valuePointer !== void 0 ? _result$valuePointer : targetValue.valuePointer) !== null && _ref5 !== void 0 ? _ref5 : 1, 1, maxPointer);
619
+ var segmentIndex = pointer - 1;
620
+ targetValue.valuePointer = pointer;
621
+ targetValue.initialValue = targetValue.valueList[segmentIndex];
622
+ targetValue.value = targetValue.valueList[pointer];
623
+ if ((_targetValue$stepList = targetValue.stepList) !== null && _targetValue$stepList !== void 0 && _targetValue$stepList.length) {
624
+ targetValue.steps = targetValue.stepList[segmentIndex % targetValue.stepList.length];
625
+ }
626
+ if ((_targetValue$interval = targetValue.intervalList) !== null && _targetValue$interval !== void 0 && _targetValue$interval.length) {
627
+ targetValue.interval = targetValue.intervalList[segmentIndex % targetValue.intervalList.length];
628
+ }
629
+ if ((_targetValue$easingLi = targetValue.easingList) !== null && _targetValue$easingLi !== void 0 && _targetValue$easingLi.length) {
630
+ targetValue.easing = targetValue.easingList[segmentIndex % targetValue.easingList.length];
631
+ }
632
+ }
580
633
  }, {
581
634
  key: "handleWebAnimationAPI",
582
635
  value: function handleWebAnimationAPI(tmodel, cleanKey, key, targetValue, from, to, valuePointer, step, steps, interval, timeShift) {
@@ -631,7 +684,7 @@ var AnimationUtil = /*#__PURE__*/function () {
631
684
  var cycle = (_targetValue$cycle = targetValue.cycle) !== null && _targetValue$cycle !== void 0 ? _targetValue$cycle : 0;
632
685
  var pointer = valuePointer;
633
686
  if (!skipStartFrame) {
634
- var _ref5, _targetValue$cycle2;
687
+ var _ref6, _targetValue$cycle2;
635
688
  var frame0 = getFrameAtTime(0);
636
689
  setFrameValue(frame0, from);
637
690
  frame0.keyMeta.set(cleanKey, {
@@ -639,7 +692,7 @@ var AnimationUtil = /*#__PURE__*/function () {
639
692
  segmentSteps: steps || targetValue.steps || 0,
640
693
  interval: interval || targetValue.interval || 8,
641
694
  stepOffset: step || 0,
642
- valuePointer: (_ref5 = valuePointer !== null && valuePointer !== void 0 ? valuePointer : targetValue.valuePointer) !== null && _ref5 !== void 0 ? _ref5 : 1,
695
+ valuePointer: (_ref6 = valuePointer !== null && valuePointer !== void 0 ? valuePointer : targetValue.valuePointer) !== null && _ref6 !== void 0 ? _ref6 : 1,
643
696
  cycle: (_targetValue$cycle2 = targetValue.cycle) !== null && _targetValue$cycle2 !== void 0 ? _targetValue$cycle2 : 0
644
697
  });
645
698
  }
package/build/App.js CHANGED
@@ -15,6 +15,7 @@ import { EventListener } from "./EventListener.js";
15
15
  import { LoadingManager } from "./LoadingManager.js";
16
16
  import { LocationManager } from "./LocationManager.js";
17
17
  import { PageManager } from "./PageManager.js";
18
+ import { StateManager } from "./StateManager.js";
18
19
  import { TModelManager } from "./TModelManager.js";
19
20
  import { RunScheduler } from "./RunScheduler.js";
20
21
  import { TargetManager } from "./TargetManager.js";
@@ -23,6 +24,7 @@ import { AnimationManager } from "./AnimationManager.js";
23
24
  import { TUtil } from "./TUtil.js";
24
25
  import { DomInit } from "./DomInit.js";
25
26
  import { SearchUtil } from "./SearchUtil.js";
27
+ import { TModelUtil } from "./TModelUtil.js";
26
28
  var tApp;
27
29
  var queuedAppCalls = [];
28
30
  var AppFn = function AppFn() {
@@ -35,6 +37,7 @@ var AppFn = function AppFn() {
35
37
  my.$window = new $Dom(window);
36
38
  my.loader = new LoadingManager();
37
39
  my.pager = new PageManager();
40
+ my.stateManager = new StateManager();
38
41
  my.events = new EventListener();
39
42
  my.locationManager = new LocationManager();
40
43
  my.targetManager = new TargetManager();
@@ -71,9 +74,9 @@ var AppFn = function AppFn() {
71
74
  }
72
75
  }
73
76
  });
74
- tmodel.$dom = $Dom.query('#tgjs-root') ? new $Dom('#tgjs-root') : new $Dom('body');
77
+ tmodel.$dom = TModelUtil.getRootDom();
75
78
  if (tmodel.$dom.getTagName() !== 'body') {
76
- tmodel.$dom.attr('data-tjno-slot', 'true');
79
+ tmodel.$dom.attr('data-tj-no-slot', 'true');
77
80
  }
78
81
  tmodel.val('screenWidth', $Dom.getScreenWidth());
79
82
  tmodel.val('screenHeight', $Dom.getScreenHeight());
@@ -282,53 +285,57 @@ var getPager = function getPager() {
282
285
  var _tApp5;
283
286
  return (_tApp5 = tApp) === null || _tApp5 === void 0 ? void 0 : _tApp5.pager;
284
287
  };
285
- var getLoader = function getLoader() {
288
+ var state = function state() {
286
289
  var _tApp6;
287
- return (_tApp6 = tApp) === null || _tApp6 === void 0 ? void 0 : _tApp6.loader;
290
+ return (_tApp6 = tApp) === null || _tApp6 === void 0 ? void 0 : _tApp6.stateManager;
288
291
  };
289
- var fetch = function fetch(tmodel, url, query, cacheId) {
292
+ var getLoader = function getLoader() {
290
293
  var _tApp7;
291
- return (_tApp7 = tApp) === null || _tApp7 === void 0 || (_tApp7 = _tApp7.loader) === null || _tApp7 === void 0 ? void 0 : _tApp7.fetch(tmodel, url, query, cacheId);
294
+ return (_tApp7 = tApp) === null || _tApp7 === void 0 ? void 0 : _tApp7.loader;
292
295
  };
293
- var fetchImage = function fetchImage(tmodel, src, cacheId) {
296
+ var fetch = function fetch(tmodel, url, query, cacheId) {
294
297
  var _tApp8;
295
- return (_tApp8 = tApp) === null || _tApp8 === void 0 || (_tApp8 = _tApp8.loader) === null || _tApp8 === void 0 ? void 0 : _tApp8.fetchImage(tmodel, src, cacheId);
298
+ return (_tApp8 = tApp) === null || _tApp8 === void 0 || (_tApp8 = _tApp8.loader) === null || _tApp8 === void 0 ? void 0 : _tApp8.fetch(tmodel, url, query, cacheId);
296
299
  };
297
- var getManager = function getManager() {
300
+ var fetchImage = function fetchImage(tmodel, src, cacheId) {
298
301
  var _tApp9;
299
- return (_tApp9 = tApp) === null || _tApp9 === void 0 ? void 0 : _tApp9.manager;
302
+ return (_tApp9 = tApp) === null || _tApp9 === void 0 || (_tApp9 = _tApp9.loader) === null || _tApp9 === void 0 ? void 0 : _tApp9.fetchImage(tmodel, src, cacheId);
300
303
  };
301
- var getTargetManager = function getTargetManager() {
304
+ var getManager = function getManager() {
302
305
  var _tApp10;
303
- return (_tApp10 = tApp) === null || _tApp10 === void 0 ? void 0 : _tApp10.targetManager;
306
+ return (_tApp10 = tApp) === null || _tApp10 === void 0 ? void 0 : _tApp10.manager;
304
307
  };
305
- var getAnimationManager = function getAnimationManager() {
308
+ var getTargetManager = function getTargetManager() {
306
309
  var _tApp11;
307
- return (_tApp11 = tApp) === null || _tApp11 === void 0 ? void 0 : _tApp11.animationManager;
310
+ return (_tApp11 = tApp) === null || _tApp11 === void 0 ? void 0 : _tApp11.targetManager;
308
311
  };
309
- var getRunScheduler = function getRunScheduler() {
312
+ var getAnimationManager = function getAnimationManager() {
310
313
  var _tApp12;
311
- return (_tApp12 = tApp) === null || _tApp12 === void 0 ? void 0 : _tApp12.runScheduler;
314
+ return (_tApp12 = tApp) === null || _tApp12 === void 0 ? void 0 : _tApp12.animationManager;
312
315
  };
313
- var getLocationManager = function getLocationManager() {
316
+ var getRunScheduler = function getRunScheduler() {
314
317
  var _tApp13;
315
- return (_tApp13 = tApp) === null || _tApp13 === void 0 ? void 0 : _tApp13.locationManager;
318
+ return (_tApp13 = tApp) === null || _tApp13 === void 0 ? void 0 : _tApp13.runScheduler;
319
+ };
320
+ var getLocationManager = function getLocationManager() {
321
+ var _tApp14;
322
+ return (_tApp14 = tApp) === null || _tApp14 === void 0 ? void 0 : _tApp14.locationManager;
316
323
  };
317
324
  var getScreenWidth = function getScreenWidth() {
318
- var _tApp$tRoot$val, _tApp14;
319
- return (_tApp$tRoot$val = (_tApp14 = tApp) === null || _tApp14 === void 0 || (_tApp14 = _tApp14.tRoot) === null || _tApp14 === void 0 ? void 0 : _tApp14.val('screenWidth')) !== null && _tApp$tRoot$val !== void 0 ? _tApp$tRoot$val : 0;
325
+ var _tApp$tRoot$val, _tApp15;
326
+ return (_tApp$tRoot$val = (_tApp15 = tApp) === null || _tApp15 === void 0 || (_tApp15 = _tApp15.tRoot) === null || _tApp15 === void 0 ? void 0 : _tApp15.val('screenWidth')) !== null && _tApp$tRoot$val !== void 0 ? _tApp$tRoot$val : 0;
320
327
  };
321
328
  var getScreenHeight = function getScreenHeight() {
322
- var _tApp$tRoot$val2, _tApp15;
323
- return (_tApp$tRoot$val2 = (_tApp15 = tApp) === null || _tApp15 === void 0 || (_tApp15 = _tApp15.tRoot) === null || _tApp15 === void 0 ? void 0 : _tApp15.val('screenHeight')) !== null && _tApp$tRoot$val2 !== void 0 ? _tApp$tRoot$val2 : 0;
329
+ var _tApp$tRoot$val2, _tApp16;
330
+ return (_tApp$tRoot$val2 = (_tApp16 = tApp) === null || _tApp16 === void 0 || (_tApp16 = _tApp16.tRoot) === null || _tApp16 === void 0 ? void 0 : _tApp16.val('screenHeight')) !== null && _tApp$tRoot$val2 !== void 0 ? _tApp$tRoot$val2 : 0;
324
331
  };
325
332
  var getVisibles = function getVisibles() {
326
- var _tApp16;
327
- return (_tApp16 = tApp) === null || _tApp16 === void 0 || (_tApp16 = _tApp16.manager) === null || _tApp16 === void 0 ? void 0 : _tApp16.getVisibles();
333
+ var _tApp17;
334
+ return (_tApp17 = tApp) === null || _tApp17 === void 0 || (_tApp17 = _tApp17.manager) === null || _tApp17 === void 0 ? void 0 : _tApp17.getVisibles();
328
335
  };
329
336
  var getResizeLastUpdate = function getResizeLastUpdate() {
330
- var _tApp17;
331
- return (_tApp17 = tApp) === null || _tApp17 === void 0 ? void 0 : _tApp17.resizeLastUpdate;
337
+ var _tApp18;
338
+ return (_tApp18 = tApp) === null || _tApp18 === void 0 ? void 0 : _tApp18.resizeLastUpdate;
332
339
  };
333
340
  var getTModelById = function getTModelById(id) {
334
341
  return App.tmodelIdMap[id];
@@ -354,4 +361,4 @@ if (typeof document !== "undefined") {
354
361
  runApp();
355
362
  }
356
363
  }
357
- export { tApp, App, tRoot, isRunning, getEvents, getPager, getLoader, fetch, fetchImage, getManager, getTargetManager, getAnimationManager, getRunScheduler, getLocationManager, getScreenWidth, getScreenHeight, getVisibles, getResizeLastUpdate, getTModelById, getDomTModelById };
364
+ export { tApp, App, tRoot, isRunning, getEvents, getPager, state, getLoader, fetch, fetchImage, getManager, getTargetManager, getAnimationManager, getRunScheduler, getLocationManager, getScreenWidth, getScreenHeight, getVisibles, getResizeLastUpdate, getTModelById, getDomTModelById };
@@ -30,11 +30,15 @@ import { $Dom } from "./$Dom.js";
30
30
  var BaseModel = /*#__PURE__*/function () {
31
31
  function BaseModel(type, targets, oid) {
32
32
  var _targets;
33
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
33
34
  _classCallCheck(this, BaseModel);
34
35
  if (_typeof(type) === 'object' && typeof targets === 'undefined') {
35
36
  targets = type;
36
37
  type = "";
37
38
  }
39
+ this.restoringRuntime = options.restoringRuntime === true;
40
+ this.restoredUsesExistingDom = options.usesExistingDom === true;
41
+ this.targetDefinitions = TUtil.cloneTargetDefinition(targets);
38
42
  this.targets = Object.assign({}, targets);
39
43
  oid = oid || this.targets.id;
40
44
  if (!TUtil.isDefined(oid)) {
@@ -211,7 +215,7 @@ var BaseModel = /*#__PURE__*/function () {
211
215
  });
212
216
  this.functionTargetNames = [];
213
217
  this.allTargetMap = {};
214
- if (TUtil.isDefined(this.originalId) && getDomTModelById(this.originalId)) {
218
+ if (!this.restoringRuntime && TUtil.isDefined(this.originalId) && getDomTModelById(this.originalId)) {
215
219
  TUtil.mergeTargets(getDomTModelById(this.originalId), this);
216
220
  this.toDiscard = true;
217
221
  return;
@@ -225,7 +229,8 @@ var BaseModel = /*#__PURE__*/function () {
225
229
  }).map(function (key) {
226
230
  return key.startsWith('_') ? key.slice(1) : key;
227
231
  });
228
- var domExists = $Dom.query("#".concat(this.oid)) || this.originalTargetNames.indexOf('$dom') >= 0;
232
+ var hasDomTarget = this.originalTargetNames.includes('$dom');
233
+ var domExists = this.restoringRuntime ? this.restoredUsesExistingDom || hasDomTarget : Boolean($Dom.query("#".concat(this.oid)) || hasDomTarget);
229
234
  if (!domExists && !this.excludeDefaultStyling()) {
230
235
  Object.entries(TargetData.defaultTargetStyles).forEach(function (_ref) {
231
236
  var _ref2 = _slicedToArray(_ref, 2),
@@ -235,25 +240,25 @@ var BaseModel = /*#__PURE__*/function () {
235
240
  _this.targets[key] = value;
236
241
  }
237
242
  });
238
- if (this.targets['canHaveDom'] !== false && !TUtil.isDefined(this.targets['domHolder'])) {
239
- this.targets['domHolder'] = true;
243
+ if (this.targets.canHaveDom !== false && !TUtil.isDefined(this.targets.domHolder)) {
244
+ this.targets.domHolder = true;
240
245
  }
241
246
  } else if (domExists) {
242
- this.targets['domIsland'] = true;
243
- if (!TUtil.isDefined(this.targets['reuseDomDefinition'])) {
244
- this.targets['reuseDomDefinition'] = true;
245
- this.targets['domHolder'] = true;
246
- if (!TUtil.isDefined(this.targets['excludeXYCalc'])) {
247
- this.targets['excludeXYCalc'] = true;
247
+ this.targets.domIsland = true;
248
+ if (!TUtil.isDefined(this.targets.reuseDomDefinition)) {
249
+ this.targets.reuseDomDefinition = true;
250
+ this.targets.domHolder = true;
251
+ if (!TUtil.isDefined(this.targets.excludeXYCalc)) {
252
+ this.targets.excludeXYCalc = true;
248
253
  }
249
- if (!TUtil.isDefined(this.targets['x'])) {
250
- this.targets['excludeX'] = true;
254
+ if (!TUtil.isDefined(this.targets.x)) {
255
+ this.targets.excludeX = true;
251
256
  }
252
- if (!TUtil.isDefined(this.targets['y'])) {
253
- this.targets['excludeY'] = true;
257
+ if (!TUtil.isDefined(this.targets.y)) {
258
+ this.targets.excludeY = true;
254
259
  }
255
- if (!TUtil.isDefined(this.targets['position'])) {
256
- this.targets['position'] = 'relative';
260
+ if (!TUtil.isDefined(this.targets.position)) {
261
+ this.targets.position = 'relative';
257
262
  }
258
263
  }
259
264
  }
@@ -434,6 +439,7 @@ var BaseModel = /*#__PURE__*/function () {
434
439
  }, {
435
440
  key: "removeTarget",
436
441
  value: function removeTarget(key) {
442
+ delete this.targetDefinitions[key];
437
443
  delete this.targets[key];
438
444
  this.removeFromActiveTargets(key);
439
445
  this.removeFromUpdatingTargets(key);
@@ -449,6 +455,11 @@ var BaseModel = /*#__PURE__*/function () {
449
455
  value: function addTargets(targets) {
450
456
  var _this2 = this,
451
457
  _getRunScheduler;
458
+ var definitions = TUtil.cloneTargetDefinition(targets);
459
+ for (var _i = 0, _Object$keys = Object.keys(definitions); _i < _Object$keys.length; _i++) {
460
+ var key = _Object$keys[_i];
461
+ this.targetDefinitions[key] = definitions[key];
462
+ }
452
463
  Object.keys(targets).forEach(function (key) {
453
464
  _this2.targets[key] = targets[key];
454
465
  _this2.removeFromUpdatingTargets(key);
@@ -461,7 +472,7 @@ var BaseModel = /*#__PURE__*/function () {
461
472
  if (this.hasDom()) {
462
473
  getEvents().attachEvents([this]);
463
474
  }
464
- (_getRunScheduler = getRunScheduler()) === null || _getRunScheduler === void 0 || _getRunScheduler.schedule(1, 'addTargets-' + this.oid);
475
+ (_getRunScheduler = getRunScheduler()) === null || _getRunScheduler === void 0 || _getRunScheduler.schedule(1, "addTargets-".concat(this.oid));
465
476
  }
466
477
  }, {
467
478
  key: "getTargetStepPercent",
@@ -963,25 +974,15 @@ var BaseModel = /*#__PURE__*/function () {
963
974
  }, {
964
975
  key: "cancelAnimation",
965
976
  value: function cancelAnimation() {
966
- if (!this.hasAnimatingTargets()) {
967
- return;
968
- }
969
- var _iterator2 = _createForOfIteratorHelper(this.animatingMap),
970
- _step2;
971
- try {
972
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
973
- var _step2$value = _slicedToArray(_step2.value, 1),
974
- key = _step2$value[0];
975
- if (this.targetValues[key]) {
976
- this.addTargetToStatusList(key);
977
- }
978
- }
979
- } catch (err) {
980
- _iterator2.e(err);
981
- } finally {
982
- _iterator2.f();
983
- }
984
- getAnimationManager().deleteAnimation(this);
977
+ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
978
+ var _options$mode = options.mode,
979
+ mode = _options$mode === void 0 ? "hold" : _options$mode,
980
+ _options$commitStyle = options.commitStyle,
981
+ commitStyle = _options$commitStyle === void 0 ? true : _options$commitStyle;
982
+ return getAnimationManager().cancelTModelAnimation(this, {
983
+ mode: mode,
984
+ commitStyle: commitStyle
985
+ });
985
986
  }
986
987
  }, {
987
988
  key: "hasTargetUpdates",
@@ -1046,39 +1047,49 @@ var BaseModel = /*#__PURE__*/function () {
1046
1047
  value: function hasUpdatingImperativeTargets(originalTargetName) {
1047
1048
  var _this$updatingTargetL;
1048
1049
  var updatingList = [].concat(_toConsumableArray((_this$updatingTargetL = this.updatingTargetList) !== null && _this$updatingTargetL !== void 0 ? _this$updatingTargetL : []), _toConsumableArray(this.hasAnimatingTargets() ? _toConsumableArray(this.animatingMap.keys()) : []));
1049
- var _iterator3 = _createForOfIteratorHelper(updatingList),
1050
- _step3;
1050
+ var _iterator2 = _createForOfIteratorHelper(updatingList),
1051
+ _step2;
1051
1052
  try {
1052
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1053
- var target = _step3.value;
1054
- if (this.isTargetImperative(target) && (this.targetValues[target].originalTargetName === originalTargetName || TargetUtil.getTargetName(target) === originalTargetName)) {
1053
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
1054
+ var _this$targetValues$ta;
1055
+ var target = _step2.value;
1056
+ if (!this.isTargetImperative(target)) {
1057
+ continue;
1058
+ }
1059
+ if (((_this$targetValues$ta = this.targetValues[target]) === null || _this$targetValues$ta === void 0 ? void 0 : _this$targetValues$ta.originalTargetName) === originalTargetName) {
1055
1060
  return true;
1056
1061
  }
1057
1062
  }
1058
1063
  } catch (err) {
1059
- _iterator3.e(err);
1064
+ _iterator2.e(err);
1060
1065
  } finally {
1061
- _iterator3.f();
1066
+ _iterator2.f();
1062
1067
  }
1063
1068
  return false;
1064
1069
  }
1065
1070
  }, {
1066
1071
  key: "getUpdatingImperativeTargets",
1067
1072
  value: function getUpdatingImperativeTargets(originalTargetName) {
1073
+ var _this$updatingTargetL2;
1074
+ var updatingList = [].concat(_toConsumableArray((_this$updatingTargetL2 = this.updatingTargetList) !== null && _this$updatingTargetL2 !== void 0 ? _this$updatingTargetL2 : []), _toConsumableArray(this.hasAnimatingTargets() ? _toConsumableArray(this.animatingMap.keys()) : []));
1068
1075
  var targets = [];
1069
- var _iterator4 = _createForOfIteratorHelper(this.updatingTargetList),
1070
- _step4;
1076
+ var _iterator3 = _createForOfIteratorHelper(updatingList),
1077
+ _step3;
1071
1078
  try {
1072
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
1073
- var target = _step4.value;
1074
- if (this.isTargetImperative(target) && this.targetValues[target].originalTargetName === originalTargetName) {
1079
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
1080
+ var _this$targetValues$ta2;
1081
+ var target = _step3.value;
1082
+ if (!this.isTargetImperative(target)) {
1083
+ continue;
1084
+ }
1085
+ if (((_this$targetValues$ta2 = this.targetValues[target]) === null || _this$targetValues$ta2 === void 0 ? void 0 : _this$targetValues$ta2.originalTargetName) === originalTargetName) {
1075
1086
  targets.push(target);
1076
1087
  }
1077
1088
  }
1078
1089
  } catch (err) {
1079
- _iterator4.e(err);
1090
+ _iterator3.e(err);
1080
1091
  } finally {
1081
- _iterator4.f();
1092
+ _iterator3.f();
1082
1093
  }
1083
1094
  return targets;
1084
1095
  }
@@ -59,6 +59,7 @@ var EventListener = /*#__PURE__*/function () {
59
59
  this.currentOriginalEvent = undefined;
60
60
  this.currentKey = '';
61
61
  this.currentHandlers = {
62
+ gestureTarget: null,
62
63
  touch: null,
63
64
  click: null,
64
65
  scrollLeft: null,
@@ -71,6 +72,7 @@ var EventListener = /*#__PURE__*/function () {
71
72
  leave: null,
72
73
  enter: null,
73
74
  start: null,
75
+ endCandidate: null,
74
76
  end: null,
75
77
  hover: null
76
78
  };
@@ -267,10 +269,21 @@ var EventListener = /*#__PURE__*/function () {
267
269
  value: function findEventHandlers(_ref) {
268
270
  var tmodel = _ref.tmodel,
269
271
  eventType = _ref.eventType;
270
- var clickHandler, swipeHandler, scrollLeftHandler, scrollTopHandler, pinchHandler, focusHandler, enterHandler, leaveHandler;
272
+ var clickHandler;
273
+ var swipeHandler;
274
+ var scrollLeftHandler;
275
+ var scrollTopHandler;
276
+ var pinchHandler;
277
+ var focusHandler;
278
+ var enterHandler;
279
+ var leaveHandler;
280
+ var startHandler;
281
+ var endHandler;
271
282
  if (tmodel) {
272
283
  clickHandler = SearchUtil.findFirstClickHandler(tmodel);
273
284
  swipeHandler = SearchUtil.findFirstSwipeHandler(tmodel);
285
+ startHandler = SearchUtil.findFirstStartHandler(tmodel);
286
+ endHandler = SearchUtil.findFirstEndHandler(tmodel);
274
287
  enterHandler = SearchUtil.findFirstEnterHandler(tmodel);
275
288
  leaveHandler = SearchUtil.findFirstLeaveHandler(tmodel);
276
289
  scrollLeftHandler = SearchUtil.findFirstScrollLeftHandler(tmodel, eventType);
@@ -288,6 +301,8 @@ var EventListener = /*#__PURE__*/function () {
288
301
  this.currentHandlers.hover = tmodel !== null && tmodel !== void 0 && tmodel.canHandleEvent('onHover') ? tmodel : undefined;
289
302
  this.currentHandlers.click = clickHandler;
290
303
  this.currentHandlers.swipe = swipeHandler;
304
+ this.currentHandlers.start = startHandler;
305
+ this.currentHandlers.endCandidate = endHandler;
291
306
  this.currentHandlers.scrollLeft = scrollLeftHandler;
292
307
  this.currentHandlers.scrollTop = scrollTopHandler;
293
308
  this.currentHandlers.pinch = pinchHandler;
@@ -319,8 +334,10 @@ var EventListener = /*#__PURE__*/function () {
319
334
  this.findEventHandlers(lastEvent);
320
335
  }
321
336
  if (lastEvent.eventType === 'end') {
322
- this.currentHandlers.end = this.currentHandlers.start;
337
+ this.currentHandlers.end = this.currentHandlers.endCandidate;
323
338
  this.currentHandlers.start = undefined;
339
+ this.currentHandlers.endCandidate = undefined;
340
+ this.currentHandlers.gestureTarget = undefined;
324
341
  }
325
342
  this.currentEventName = lastEvent.eventName;
326
343
  this.currentEventType = lastEvent.eventType;
@@ -331,6 +348,7 @@ var EventListener = /*#__PURE__*/function () {
331
348
  if (lastEvent.eventType === 'end' || lastEvent.eventType === 'click') {
332
349
  this.canFindHandlers = true;
333
350
  }
351
+ return lastEvent;
334
352
  }
335
353
  }, {
336
354
  key: "markCapturedEventDirty",
@@ -401,8 +419,8 @@ var EventListener = /*#__PURE__*/function () {
401
419
  rateLimit = eventItem.rateLimit;
402
420
  var now = TUtil.now();
403
421
  var tmodel;
404
- if (eventType === 'move' && this.touchCount > 0 && this.currentHandlers.start) {
405
- tmodel = this.currentHandlers.start;
422
+ if (eventType === 'move' && this.touchCount > 0 && this.currentHandlers.gestureTarget) {
423
+ tmodel = this.currentHandlers.gestureTarget;
406
424
  } else {
407
425
  tmodel = this.getTModelFromEvent(event);
408
426
  }
@@ -468,7 +486,7 @@ var EventListener = /*#__PURE__*/function () {
468
486
  this.start1 = this.getTouch(event, 1);
469
487
  this.cursor.x = this.start0.x;
470
488
  this.cursor.y = this.start0.y;
471
- this.currentHandlers.start = tmodel;
489
+ this.currentHandlers.gestureTarget = tmodel;
472
490
  this.findEventHandlers(newEvent);
473
491
  this.canFindHandlers = false;
474
492
  this.swipeStartX = this.start0.x - ((_this$currentHandlers = (_this$currentHandlers2 = this.currentHandlers.swipe) === null || _this$currentHandlers2 === void 0 ? void 0 : _this$currentHandlers2.getX()) !== null && _this$currentHandlers !== void 0 ? _this$currentHandlers : 0);
@@ -851,7 +869,7 @@ var EventListener = /*#__PURE__*/function () {
851
869
  }, {
852
870
  key: "isSwipeEvent",
853
871
  value: function isSwipeEvent() {
854
- return this.hasDelta() && this.touchCount === 1;
872
+ return this.isMoveEvent() && this.hasDelta() && this.touchCount === 1;
855
873
  }
856
874
  }, {
857
875
  key: "isScrollEvent",