targetj 1.0.227 → 1.0.229

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.
@@ -85,6 +85,7 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
85
85
  var _this = this;
86
86
  var lastVisibleMap = _objectSpread({}, this.visibleOidMap);
87
87
  this.clearFrameLists();
88
+ var activated = [];
88
89
  var _iterator = _createForOfIteratorHelper((0, _App.getLocationManager)().hasLocationList),
89
90
  _step;
90
91
  try {
@@ -105,16 +106,31 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
105
106
  } else {
106
107
  delete this.visibleOidMap[tmodel.oid];
107
108
  }
109
+ var keepDom = this.shouldPreserveDom(tmodel);
110
+ if (keepDom) {
111
+ this.visibleOidMap[tmodel.oid] = tmodel;
112
+ }
108
113
  if (tmodel.hasDom()) {
109
- if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible) {
114
+ if (!tmodel.canHaveDom() || !tmodel.isIncluded() || tmodel.canDeleteDom() && !visible && !keepDom) {
110
115
  this.addToInvisibleDom(tmodel);
111
116
  tmodel.getChildren().forEach(function (tmodel) {
112
117
  _this.addToRecursiveInvisibleDom(tmodel);
113
118
  });
114
119
  }
115
120
  }
116
- if (visible || tmodel.isActivated()) {
121
+ if (visible || tmodel.isActivated() || keepDom) {
117
122
  var _state$updatingTarget, _state$activeTargetLi;
123
+ var state = tmodel.state();
124
+ if (((_state$updatingTarget = state.updatingTargetList) === null || _state$updatingTarget === void 0 ? void 0 : _state$updatingTarget.length) > 0 || tmodel.hasAnimatingTargets()) {
125
+ this.lists.updatingTModels.push(tmodel);
126
+ this.lists.updatingTargets = [].concat(_toConsumableArray(this.lists.updatingTargets), _toConsumableArray(state.updatingTargetList));
127
+ }
128
+ if (((_state$activeTargetLi = state.activeTargetList) === null || _state$activeTargetLi === void 0 ? void 0 : _state$activeTargetLi.length) > 0) {
129
+ this.lists.activeTModels.push(tmodel);
130
+ this.lists.activeTargets = [].concat(_toConsumableArray(this.lists.activeTargets), _toConsumableArray(state.activeTargetList));
131
+ }
132
+ }
133
+ if (visible || tmodel.isActivated() || keepDom) {
118
134
  if (this.needsRerender(tmodel)) {
119
135
  this.lists.rerender.push(tmodel);
120
136
  }
@@ -130,22 +146,16 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
130
146
  if (this.needsRelocation(tmodel)) {
131
147
  this.lists.relocation.push(tmodel);
132
148
  }
133
- var state = tmodel.state();
134
- if (((_state$updatingTarget = state.updatingTargetList) === null || _state$updatingTarget === void 0 ? void 0 : _state$updatingTarget.length) > 0 || tmodel.hasAnimatingTargets()) {
135
- this.lists.updatingTModels.push(tmodel);
136
- this.lists.updatingTargets = [].concat(_toConsumableArray(this.lists.updatingTargets), _toConsumableArray(state.updatingTargetList));
149
+ var _state = tmodel.state();
150
+ if (_state.targetMethodMap && Object.keys(_state.targetMethodMap).length > 0) {
151
+ this.targetMethodMap[tmodel.oid] = _objectSpread({}, _state.targetMethodMap);
152
+ _state.targetMethodMap = {};
137
153
  }
138
- if (((_state$activeTargetLi = state.activeTargetList) === null || _state$activeTargetLi === void 0 ? void 0 : _state$activeTargetLi.length) > 0) {
139
- this.lists.activeTModels.push(tmodel);
140
- this.lists.activeTargets = [].concat(_toConsumableArray(this.lists.activeTargets), _toConsumableArray(state.activeTargetList));
141
- }
142
- if (state.targetMethodMap && Object.keys(state.targetMethodMap).length > 0) {
143
- this.targetMethodMap[tmodel.oid] = _objectSpread({}, state.targetMethodMap);
144
- state.targetMethodMap = {};
154
+ if (tmodel.isActivated()) {
155
+ activated.push(tmodel);
145
156
  }
146
- tmodel.deactivate();
147
157
  }
148
- if (visible || tmodel.requiresDom()) {
158
+ if (visible || tmodel.requiresDom() || keepDom) {
149
159
  if (tmodel.canHaveDom() && !tmodel.hasDom() && tmodel.isIncluded() && !this.noDomMap[tmodel.oid]) {
150
160
  var _tmodel$getDomHolder, _tmodel$getDomParent;
151
161
  if ((_tmodel$getDomHolder = tmodel.getDomHolder()) !== null && _tmodel$getDomHolder !== void 0 && _tmodel$getDomHolder.exists() || this.noDomMap[(_tmodel$getDomParent = tmodel.getDomParent()) === null || _tmodel$getDomParent === void 0 ? void 0 : _tmodel$getDomParent.oid]) {
@@ -162,6 +172,9 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
162
172
  } finally {
163
173
  _iterator.f();
164
174
  }
175
+ activated.forEach(function (t) {
176
+ return t.deactivate();
177
+ });
165
178
  Object.values(lastVisibleMap).filter(function (v) {
166
179
  return v !== undefined;
167
180
  }).forEach(function (tmodel) {
@@ -173,6 +186,24 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
173
186
  });
174
187
  return this.lists.noDom.length > 0 ? 0 : this.lists.reattach.length > 0 ? 1 : this.lists.relocation.length > 0 ? 2 : this.lists.rerender.length > 0 ? 3 : this.lists.reasyncStyle.length > 0 ? 4 : this.lists.invisibleDom.length > 0 ? 5 : this.lists.restyle.length > 0 ? 10 : -1;
175
188
  }
189
+ }, {
190
+ key: "shouldPreserveDom",
191
+ value: function shouldPreserveDom(tmodel) {
192
+ var parent = tmodel.parent;
193
+ if (!tmodel.isIncluded()) {
194
+ return false;
195
+ }
196
+ while (parent && parent !== (0, _App.tRoot)()) {
197
+ if (_TUtil.TUtil.isDefined(parent.targets.canDeleteDom) && parent.val('canDeleteDom') === false) {
198
+ return true;
199
+ }
200
+ if (_TUtil.TUtil.isDefined(parent.targets.isVisible) && parent.val('isVisible') === true) {
201
+ return true;
202
+ }
203
+ parent = parent.parent;
204
+ }
205
+ return false;
206
+ }
176
207
  }, {
177
208
  key: "isBracketVisible",
178
209
  value: function isBracketVisible(tmodel) {
@@ -368,6 +399,12 @@ var TModelManager = exports.TModelManager = /*#__PURE__*/function () {
368
399
  if (tmodel.hasAnimatingTargets()) {
369
400
  (0, _App.getAnimationManager)().pauseTModel(tmodel);
370
401
  }
402
+ Object.keys(tmodel.targetValues).forEach(function (key) {
403
+ var targetValue = tmodel.targetValues[key];
404
+ if (targetValue.status === 'updating' && tmodel.updatingTargetList.indexOf(key) === -1) {
405
+ tmodel.setTargetStatus('active');
406
+ }
407
+ });
371
408
  var domParent = tmodel.getDomParent();
372
409
  if (domParent && domParent.$dom) {
373
410
  domParent.$dom.removeElement(tmodel.$dom.element);
package/build/TUtil.js CHANGED
@@ -32,53 +32,112 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
32
32
  key: "calcVisibility",
33
33
  value: function calcVisibility(child) {
34
34
  var _parent$targets$onVis;
35
- // keep the "x updating" fast-path
36
-
37
35
  var parent = child.getRealParent();
38
36
  var onVisibleChildrenChange = (_parent$targets$onVis = parent === null || parent === void 0 ? void 0 : parent.targets['onVisibleChildrenChange']) !== null && _parent$targets$onVis !== void 0 ? _parent$targets$onVis : false;
39
37
  if (!onVisibleChildrenChange && child.isVisible() && (child.isTargetUpdating(child.allTargetMap['x']) || child.isTargetUpdating(child.allTargetMap['y']))) {
40
38
  return true;
41
39
  }
42
- var x = child.absX;
43
- var y = child.absY;
44
40
  var domParent = child.getDomParent();
45
41
  var scale = (domParent.getMeasuringScale() || 1) * child.getMeasuringScale();
46
- var maxWidth = TUtil.isDefined(child.getWidth()) ? scale * child.getWidth() : 0;
47
- var maxHeight = TUtil.isDefined(child.getHeight()) ? scale * child.getHeight() : 0;
42
+ var x = child.absX;
43
+ var y = child.absY;
44
+ var width = TUtil.isDefined(child.getWidth()) ? scale * child.getWidth() : 0;
45
+ var height = TUtil.isDefined(child.getHeight()) ? scale * child.getHeight() : 0;
46
+ var visibilityMargin = 20;
48
47
  if (!child.visibilityStatus) {
49
48
  child.visibilityStatus = {};
50
49
  }
51
50
  var status = child.visibilityStatus;
52
- var validateInParent = child.validateVisibilityInParent() && parent !== (0, _App.tRoot)();
53
- var parentX = validateInParent ? Math.max(domParent.absX, parent.absX) : 0;
54
- var parentY = validateInParent ? Math.max(domParent.absY, parent.absY) : 0;
55
- var parentW = validateInParent ? Math.min(domParent.getWidth(), parent.getWidth()) : (0, _App.getScreenWidth)();
56
- var parentH = validateInParent ? Math.min(domParent.getHeight(), parent.getHeight()) : (0, _App.getScreenHeight)();
57
- var screenX = 0;
58
- var screenY = 0;
59
- var screenW = (0, _App.getScreenWidth)();
60
- var screenH = (0, _App.getScreenHeight)();
61
- var clipX = Math.max(parentX, screenX);
62
- var clipY = Math.max(parentY, screenY);
63
- var clipR = Math.min(parentX + parentW, screenX + screenW);
64
- var clipB = Math.min(parentY + parentH, screenY + screenH);
65
- status.right = x <= clipR;
66
- status.left = x + maxWidth >= clipX;
67
- status.bottom = y - child.getTopMargin() <= clipB;
68
- status.top = y + maxHeight >= clipY;
69
- status.clipX = clipX;
70
- status.clipY = clipY;
71
- status.clipR = clipR;
72
- status.clipB = clipB;
51
+ var clip = this.getVisibilityClipRect(child.getParent());
52
+ if (clip) {
53
+ status.right = x - visibilityMargin <= clip.r;
54
+ status.left = x + width + visibilityMargin >= clip.x;
55
+ status.bottom = y - child.getTopMargin() - visibilityMargin <= clip.b;
56
+ status.top = y + height + visibilityMargin >= clip.y;
57
+ status.clipX = clip.x;
58
+ status.clipY = clip.y;
59
+ status.clipR = clip.r;
60
+ status.clipB = clip.b;
61
+ status.parent = clip.source;
62
+ status.isVisible = status.left && status.right && status.top && status.bottom;
63
+ } else {
64
+ status.right = true;
65
+ status.left = true;
66
+ status.bottom = true;
67
+ status.top = true;
68
+ status.clipX = undefined;
69
+ status.clipY = undefined;
70
+ status.clipR = undefined;
71
+ status.clipB = undefined;
72
+ status.parent = "none";
73
+ status.isVisible = true;
74
+ }
73
75
  status.x = x;
74
76
  status.y = y;
75
- status.width = maxWidth;
76
- status.height = maxHeight;
77
- status.parent = validateInParent ? parent : "screen";
78
- status.isVisible = status.left && status.right && status.top && status.bottom;
77
+ status.width = width;
78
+ status.height = height;
79
79
  child.actualValues.isVisible = status.isVisible;
80
80
  return status.isVisible;
81
81
  }
82
+ }, {
83
+ key: "getVisibilityClipRect",
84
+ value: function getVisibilityClipRect(container) {
85
+ var rect = null;
86
+ while (container && container !== (0, _App.tRoot)()) {
87
+ if (this.shouldClipByAncestor(container)) {
88
+ var ancestorRect = this.getAncestorViewportRect(container);
89
+ rect = rect ? this.intersectVisibilityRects(rect, ancestorRect) : ancestorRect;
90
+ if (rect.r <= rect.x || rect.b <= rect.y) {
91
+ break;
92
+ }
93
+ }
94
+ container = container.getParent();
95
+ }
96
+ return rect;
97
+ }
98
+ }, {
99
+ key: "shouldClipByAncestor",
100
+ value: function shouldClipByAncestor(ancestor) {
101
+ return ancestor.managesOwnScroll();
102
+ }
103
+ }, {
104
+ key: "getAncestorViewportRect",
105
+ value: function getAncestorViewportRect(ancestor) {
106
+ var _ancestor$$dom, _ancestor$$dom2;
107
+ var domScrollLeft = ((_ancestor$$dom = ancestor.$dom) === null || _ancestor$$dom === void 0 ? void 0 : _ancestor$$dom.getScrollLeft()) || 0;
108
+ var domScrollTop = ((_ancestor$$dom2 = ancestor.$dom) === null || _ancestor$$dom2 === void 0 ? void 0 : _ancestor$$dom2.getScrollTop()) || 0;
109
+ return {
110
+ x: ancestor.absX + domScrollLeft,
111
+ y: ancestor.absY + domScrollTop,
112
+ r: ancestor.absX + domScrollLeft + ancestor.getWidth(),
113
+ b: ancestor.absY + domScrollTop + ancestor.getHeight(),
114
+ source: ancestor
115
+ };
116
+ }
117
+ }, {
118
+ key: "intersectVisibilityRects",
119
+ value: function intersectVisibilityRects(a, b) {
120
+ return {
121
+ x: Math.max(a.x, b.x),
122
+ y: Math.max(a.y, b.y),
123
+ r: Math.min(a.r, b.r),
124
+ b: Math.min(a.b, b.b),
125
+ source: b.source
126
+ };
127
+ }
128
+ }, {
129
+ key: "updateClipRect",
130
+ value: function updateClipRect(tmodel) {
131
+ var parent = tmodel.getParent();
132
+ var inheritedClip = (parent === null || parent === void 0 ? void 0 : parent.visibilityClipRect) || null;
133
+ if (this.shouldClipByAncestor(tmodel)) {
134
+ var localRect = this.getLocalViewportRect(tmodel);
135
+ tmodel.visibilityClipRect = inheritedClip ? this.intersectVisibilityRects(inheritedClip, localRect) : localRect;
136
+ } else {
137
+ tmodel.visibilityClipRect = inheritedClip;
138
+ }
139
+ return tmodel.visibilityClipRect;
140
+ }
82
141
  }, {
83
142
  key: "contains",
84
143
  value: function contains(container, tmodel) {
@@ -266,7 +266,9 @@ _defineProperty(TargetData, "mustExecuteTargets", {
266
266
  heightFromDom: true,
267
267
  widthFromDom: true,
268
268
  fetch: true,
269
- fetchImage: true
269
+ fetchImage: true,
270
+ isVisible: true,
271
+ canDeleteDom: true
270
272
  });
271
273
  _defineProperty(TargetData, "ignoreRerun", {
272
274
  isVisible: true
@@ -899,5 +901,5 @@ _defineProperty(TargetData, "lifecyclePatterns", {
899
901
  });
900
902
  _defineProperty(TargetData, "eventSet", new Set([].concat(_toConsumableArray(Object.keys(_TargetData.allEventMap)), _toConsumableArray(Object.keys(_TargetData.internalEventMap)))));
901
903
  _defineProperty(TargetData, "styleSet", new Set([].concat(_toConsumableArray(Object.keys(_TargetData.styleTargetMap)), _toConsumableArray(Object.keys(_TargetData.asyncStyleTargetMap)), _toConsumableArray(Object.keys(_TargetData.attributeTargetMap)))));
902
- _defineProperty(TargetData, "reservedKeywordSet", new Set([].concat(_toConsumableArray(_TargetData.styleSet), _toConsumableArray(Object.keys(_TargetData.defaultActualValues())), _toConsumableArray(Object.keys(_TargetData.allEventMap)), _toConsumableArray(Object.keys(_TargetData.internalEventMap)), ['html', 'isInFlow', 'domHolder', 'domParent', 'gap', 'widthFromDom', 'heightFromDom', 'requiresDom', 'preventDefault', 'canDeleteDom', 'textOnly', 'styling', '$dom', 'defaultStyling', 'reuseDomDefinition', 'canHaveDom', 'excludeXYCalc', 'excludeX', 'excludeY', 'containerOverflowMode', 'itemOverflowMode', 'baseElement', 'element', 'otype', 'calculateChildren', 'domIsland', 'bracketThreshold', 'bracketSize', 'sourceDom'])));
904
+ _defineProperty(TargetData, "reservedKeywordSet", new Set([].concat(_toConsumableArray(_TargetData.styleSet), _toConsumableArray(Object.keys(_TargetData.defaultActualValues())), _toConsumableArray(Object.keys(_TargetData.allEventMap)), _toConsumableArray(Object.keys(_TargetData.internalEventMap)), _toConsumableArray(Object.keys(_TargetData.mustExecuteTargets)), ['html', 'isInFlow', 'domHolder', 'domParent', 'gap', 'widthFromDom', 'heightFromDom', 'requiresDom', 'preventDefault', 'canDeleteDom', 'textOnly', 'styling', '$dom', 'defaultStyling', 'reuseDomDefinition', 'canHaveDom', 'excludeXYCalc', 'excludeX', 'excludeY', 'containerOverflowMode', 'itemOverflowMode', 'baseElement', 'element', 'otype', 'calculateChildren', 'domIsland', 'bracketThreshold', 'bracketSize', 'shouldBeBracketed', 'sourceDom'])));
903
905
  _defineProperty(TargetData, "activationKeywordSet", new Set(['originalTModel', 'originalTargetName', 'activateNextTarget']));
@@ -90,7 +90,7 @@ var TargetExecutor = exports.TargetExecutor = /*#__PURE__*/function () {
90
90
  targetValue = TargetExecutor.assignImperativeTargetValue(tmodel, key, originalTargetName, originalTModel);
91
91
  TargetExecutor.assignListTarget(tmodel, key, targetValue, value.list, value.list[0], vSteps, vInterval, vEasing, vCycles);
92
92
  } else if (_TargetParser.TargetParser.isTargetSpecObject(value)) {
93
- var valueArray = _TargetParser.TargetParser.getValueStepsCycles(tmodel, value, key);
93
+ var valueArray = _TargetParser.TargetParser.getValueStepsCycles(tmodel, key, value);
94
94
  var newValue = valueArray[0];
95
95
  var newSteps = valueArray[1];
96
96
  var newInterval = valueArray[2];
@@ -111,7 +111,7 @@ var TargetExecutor = exports.TargetExecutor = /*#__PURE__*/function () {
111
111
  var newEasing = easing;
112
112
  var newCycles = cycles;
113
113
  if (_typeof(newValue) === 'object' && !_TargetParser.TargetParser.isListTarget(newValue)) {
114
- var _valueArray = _TargetParser.TargetParser.getValueStepsCycles(tmodel, completeValue[objectKey], objectKey);
114
+ var _valueArray = _TargetParser.TargetParser.getValueStepsCycles(tmodel, objectKey, completeValue[objectKey]);
115
115
  newValue = _valueArray[0];
116
116
  newSteps = _TUtil.TUtil.isDefined(_valueArray[1]) ? _valueArray[1] : steps;
117
117
  newInterval = _TUtil.TUtil.isDefined(_valueArray[2]) ? _valueArray[2] : interval;
@@ -122,7 +122,7 @@ var TargetExecutor = exports.TargetExecutor = /*#__PURE__*/function () {
122
122
  });
123
123
  } else {
124
124
  if (_typeof(value) === 'object' && !_TargetParser.TargetParser.isListTarget(value)) {
125
- var _valueArray2 = _TargetParser.TargetParser.getValueStepsCycles(tmodel, value, key);
125
+ var _valueArray2 = _TargetParser.TargetParser.getValueStepsCycles(tmodel, key, value);
126
126
  if (value !== _valueArray2[0]) {
127
127
  value = _valueArray2[0];
128
128
  steps = _TUtil.TUtil.isDefined(_valueArray2[1]) ? _valueArray2[1] : steps;
@@ -248,8 +248,11 @@ var TargetExecutor = exports.TargetExecutor = /*#__PURE__*/function () {
248
248
  key: "resolveTargetValue",
249
249
  value: function resolveTargetValue(tmodel, key) {
250
250
  var cycle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : tmodel.getTargetCycle(key);
251
+ if (_TargetParser.TargetParser.isIntervalTarget(tmodel.targets[key]) && cycle === 1) {
252
+ return;
253
+ }
251
254
  var targetInitial = !tmodel.targetValues[key] && _TUtil.TUtil.isDefined(tmodel.targets[key].initialValue) ? tmodel.targets[key].initialValue : undefined;
252
- var valueArray = _TargetParser.TargetParser.getValueStepsCycles(tmodel, tmodel.targets[key], key, cycle);
255
+ var valueArray = _TargetParser.TargetParser.getValueStepsCycles(tmodel, key, tmodel.targets[key], cycle);
253
256
  var newValue = valueArray[0];
254
257
  var newSteps = valueArray[1] || 0;
255
258
  var newInterval = valueArray[2] || 0;
@@ -259,7 +262,7 @@ var TargetExecutor = exports.TargetExecutor = /*#__PURE__*/function () {
259
262
  tmodel.targetValues[key] = targetValue;
260
263
  var easing = _TUtil.TUtil.isDefined(newEasing) ? newEasing : _TUtil.TUtil.isDefined(tmodel.targets[key].easing) ? tmodel.targets[key].easing : undefined;
261
264
  if (_TargetParser.TargetParser.isIntervalTarget(newValue)) {
262
- TargetExecutor.assignSingleTarget(targetValue, undefined, undefined, 0, 2, newValue.interval, easing);
265
+ TargetExecutor.assignSingleTarget(targetValue, undefined, targetInitial, 0, 2, newValue.interval, easing);
263
266
  } else if (_TargetParser.TargetParser.isChildTarget(key, newValue)) {
264
267
  tmodel.addChild(newValue);
265
268
  TargetExecutor.assignSingleTarget(targetValue, newValue, undefined, 0, newCycles, newInterval, easing);
@@ -243,7 +243,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
243
243
  });
244
244
  var isTransform = _TargetData.TargetData.isTransformKey(cleanKey);
245
245
  var getFrameAtTime = function getFrameAtTime(t) {
246
- var shifted = t + timeShift;
246
+ var shifted = Math.max(0, t + timeShift);
247
247
  for (var i = 0; i < batch.frames.length; i++) {
248
248
  var _frame = batch.frames[i];
249
249
  if (Math.abs(_frame.keyTime - shifted) < 0.0001) {
@@ -318,7 +318,7 @@ var TargetManager = exports.TargetManager = /*#__PURE__*/function () {
318
318
  if (tmodel.getTargetEasing(key)) {
319
319
  batch.easing = tmodel.getTargetEasing(key);
320
320
  }
321
- batch.totalDuration = Math.max(batch.totalDuration, timeShift + keyDuration);
321
+ batch.totalDuration = Math.max(0, batch.totalDuration, timeShift + keyDuration);
322
322
  ((_batch$keyMap = batch.keyMap)[cleanKey] || (_batch$keyMap[cleanKey] = new Set())).add(key);
323
323
  tmodel.removeFromUpdatingTargets(key);
324
324
  return keyDuration;
@@ -161,7 +161,7 @@ var TargetParser = exports.TargetParser = /*#__PURE__*/function () {
161
161
  if (target.isInterval && _TUtil.TUtil.isDefined(target.interval)) {
162
162
  return true;
163
163
  }
164
- return _TUtil.TUtil.isDefined(target.interval) && !_TUtil.TUtil.isDefined(target.steps) && !_TUtil.TUtil.isDefined(target.cycles) && !_TUtil.TUtil.isDefined(target.value);
164
+ return _TUtil.TUtil.isDefined(target.interval) && !_TUtil.TUtil.isDefined(target.steps) && !_TUtil.TUtil.isDefined(target.cycles);
165
165
  }
166
166
  }, {
167
167
  key: "isPrimitiveArray",
@@ -217,7 +217,8 @@ var TargetParser = exports.TargetParser = /*#__PURE__*/function () {
217
217
  }
218
218
  }, {
219
219
  key: "getValueStepsCycles",
220
- value: function getValueStepsCycles(tmodel, _target, key) {
220
+ value: function getValueStepsCycles(tmodel, key) {
221
+ var _target = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : tmodel.targets[key];
221
222
  var cycle = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : tmodel.getTargetCycle(key);
222
223
  var valueOnly = _target && _target.valueOnly;
223
224
  var lastValue = tmodel.val(key);
@@ -182,8 +182,8 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
182
182
  if (nextTarget) {
183
183
  if (isEndTrigger) {
184
184
  var _tmodel$targetValues$2, _tmodel$targetValues$3;
185
- var nextCompleteCount = (_tmodel$targetValues$2 = (_tmodel$targetValues$3 = tmodel.targetValues[nextTarget]) === null || _tmodel$targetValues$3 === void 0 ? void 0 : _tmodel$targetValues$3.completeCount) !== null && _tmodel$targetValues$2 !== void 0 ? _tmodel$targetValues$2 : 0;
186
- if (targetValue.completeCount > nextCompleteCount) {
185
+ var triggeredByCompleteCount = (_tmodel$targetValues$2 = (_tmodel$targetValues$3 = tmodel.targetValues[nextTarget]) === null || _tmodel$targetValues$3 === void 0 ? void 0 : _tmodel$targetValues$3.triggeredByCompleteCount) !== null && _tmodel$targetValues$2 !== void 0 ? _tmodel$targetValues$2 : 0;
186
+ if (targetValue.completeCount > triggeredByCompleteCount) {
187
187
  canActivate = true;
188
188
  }
189
189
  } else {
@@ -199,6 +199,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
199
199
  TargetUtil.activateTargetOnce(tmodel, nextTarget);
200
200
  nextTargetActivated = true;
201
201
  TargetUtil.clearPendingTargets(tmodel, key);
202
+ tmodel.targetValues[nextTarget].triggeredByCompleteCount = targetValue.completeCount;
202
203
  } else {
203
204
  TargetUtil.markPendingTargets(tmodel, key);
204
205
  }
@@ -219,6 +220,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
219
220
  TargetUtil.activateTarget(tmodel, nextTarget);
220
221
  nextTargetActivated = true;
221
222
  TargetUtil.clearPendingTargets(tmodel, key);
223
+ tmodel.targetValues[nextTarget].triggeredByCompleteCount = targetValue.completeCount;
222
224
  } else {
223
225
  TargetUtil.markPendingTargets(tmodel, key);
224
226
  }
@@ -642,5 +644,91 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
642
644
  originalTargetName: originalTargetName
643
645
  };
644
646
  }
647
+ }, {
648
+ key: "resetTargetPipelineState",
649
+ value: function resetTargetPipelineState(tmodel, targetName) {
650
+ var _target$childAction4, _target$addChildActio;
651
+ var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
652
+ if (!tmodel || !targetName) {
653
+ return;
654
+ }
655
+ var target = tmodel.targets[targetName];
656
+ TargetUtil.resetSingleTargetState(tmodel, targetName);
657
+ if ((_target$childAction4 = target.childAction) !== null && _target$childAction4 !== void 0 && _target$childAction4.length) {
658
+ target.childAction.forEach(function (child) {
659
+ if (child) {
660
+ TargetUtil.resetTargetChildState(child, visited);
661
+ }
662
+ });
663
+ target.childAction = [];
664
+ }
665
+ if ((_target$addChildActio = target.addChildAction) !== null && _target$addChildActio !== void 0 && _target$addChildActio.length) {
666
+ target.addChildAction.forEach(function (child) {
667
+ if (child) {
668
+ TargetUtil.resetTargetChildState(child, visited);
669
+ }
670
+ });
671
+ target.addChildAction = [];
672
+ }
673
+ var nextTarget = target === null || target === void 0 ? void 0 : target.activateNextTarget;
674
+ if (!nextTarget) {
675
+ return;
676
+ }
677
+ var nextTargetDef = tmodel.targets[nextTarget];
678
+ if (!nextTargetDef || !nextTarget.endsWith('$') && nextTargetDef.active === false) {
679
+ return;
680
+ }
681
+ TargetUtil.resetTargetPipelineState(tmodel, nextTarget, visited);
682
+ }
683
+ }, {
684
+ key: "resetTargetChildState",
685
+ value: function resetTargetChildState(tmodel, visited) {
686
+ var sig = "".concat(tmodel.oid);
687
+ if (visited.has(sig)) {
688
+ return;
689
+ }
690
+ visited.add(sig);
691
+ var names = Object.keys(tmodel.targetValues);
692
+ for (var i = 0; i < names.length; i++) {
693
+ var _target$childAction5, _target$addChildActio2;
694
+ var key = names[i];
695
+ var target = tmodel.targets[key];
696
+ TargetUtil.resetSingleTargetState(tmodel, key);
697
+ if (target !== null && target !== void 0 && (_target$childAction5 = target.childAction) !== null && _target$childAction5 !== void 0 && _target$childAction5.length) {
698
+ target.childAction.forEach(function (child) {
699
+ if (child) {
700
+ TargetUtil.resetTargetChildState(child, visited);
701
+ }
702
+ });
703
+ target.childAction = [];
704
+ }
705
+ if (target !== null && target !== void 0 && (_target$addChildActio2 = target.addChildAction) !== null && _target$addChildActio2 !== void 0 && _target$addChildActio2.length) {
706
+ target.addChildAction.forEach(function (child) {
707
+ if (child) {
708
+ TargetUtil.resetTargetChildState(child, visited);
709
+ }
710
+ });
711
+ target.addChildAction = [];
712
+ }
713
+ }
714
+ }
715
+ }, {
716
+ key: "resetSingleTargetState",
717
+ value: function resetSingleTargetState(tmodel, key) {
718
+ var targetValue = tmodel.targetValues[key];
719
+ if (targetValue) {
720
+ targetValue.completeCount = 0;
721
+ targetValue.triggeredByCompleteCount = 0;
722
+ targetValue.resetFlag = true;
723
+ targetValue.nextTargetUpdateCount = 0;
724
+ targetValue.status = 'complete';
725
+ }
726
+ tmodel.cancelAnimation();
727
+ tmodel.activatedTargets.length = 0;
728
+ tmodel.removeFromActiveTargets(key);
729
+ tmodel.removeFromAnimatingMap(key);
730
+ tmodel.removeFromUpdatingTargets(key);
731
+ TargetUtil.clearPendingTargets(tmodel, key);
732
+ }
645
733
  }]);
646
734
  }();