targetj 1.0.236 → 1.0.238

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Export.js CHANGED
@@ -35,6 +35,7 @@ import * as Easing from './build/Easing.js';
35
35
  import * as TargetExecutor from './build/TargetExecutor.js';
36
36
  import * as AnimationManager from './build/AnimationManager.js';
37
37
  import * as AnimationUtil from './build/AnimationUtil.js';
38
+ import * as VisibilityUtil from './build/VisibilityUtil.js';
38
39
 
39
40
  const TargetJS = {
40
41
  ...App,
@@ -53,7 +54,8 @@ const TargetJS = {
53
54
  ...Easing,
54
55
  ...TargetExecutor,
55
56
  ...AnimationManager,
56
- ...AnimationUtil
57
+ ...AnimationUtil,
58
+ ...VisibilityUtil
57
59
  };
58
60
 
59
61
  if (typeof window !== 'undefined') {
@@ -1175,9 +1175,9 @@ var BaseModel = exports.BaseModel = /*#__PURE__*/function () {
1175
1175
  actualOptions = value;
1176
1176
  }
1177
1177
  if (this.canTargetBeActivated(key)) {
1178
- var _actualOptions;
1179
- if ((_actualOptions = actualOptions) !== null && _actualOptions !== void 0 && _actualOptions.reset) {
1180
- _TargetUtil.TargetUtil.resetTargetState(this, key);
1178
+ var resetOptions = _TargetUtil.TargetUtil.getResetOptions(actualOptions);
1179
+ if (resetOptions.shouldReset) {
1180
+ _TargetUtil.TargetUtil.resetTargetState(this, key, resetOptions);
1181
1181
  }
1182
1182
  if (_TUtil.TUtil.isDefined(actualValue)) {
1183
1183
  this.val("___".concat(key), actualValue);
package/build/Bracket.js CHANGED
@@ -159,6 +159,10 @@ var Bracket = exports.Bracket = /*#__PURE__*/function (_TModel) {
159
159
  key: "shouldCalculateChildren",
160
160
  value: function shouldCalculateChildren() {
161
161
  var nowVisible = this.isVisible();
162
+ var hasEventDirty = this.hasEventDirty();
163
+ if (hasEventDirty) {
164
+ return true;
165
+ }
162
166
  if (this.currentBrakcetStatus >= 1 || this.isNowVisible || this.isNowInvisible) {
163
167
  this.currentBrakcetStatus = Math.max(0, this.currentBrakcetStatus - 1);
164
168
  return true;
@@ -174,7 +178,8 @@ var Bracket = exports.Bracket = /*#__PURE__*/function (_TModel) {
174
178
  }, {
175
179
  key: "getDirtyLayout",
176
180
  value: function getDirtyLayout() {
177
- return this.getRealParent().managesOwnScroll() ? this.getRealParent().backupDirtyLayout : this.dirtyLayout;
181
+ var parentDirty = this.getRealParent().managesOwnScroll() ? this.getRealParent().backupDirtyLayout : false;
182
+ return this.dirtyLayout || parentDirty || false;
178
183
  }
179
184
  }, {
180
185
  key: "validateVisibilityInParent",
@@ -486,6 +486,8 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
486
486
  var clickHandler = _SearchUtil.SearchUtil.findFirstClickHandler(tmodel);
487
487
  var canAcceptClick = !this.start0 || clickHandler === this.currentHandlers.click && (clickHandler !== this.currentHandlers.swipe || this.getSwipeDistance() < 5);
488
488
  if (clickHandler && canAcceptClick) {
489
+ clickHandler.markEventDirty();
490
+ clickHandler.markLayoutDirty('event');
489
491
  this.eventQueue.length = 0;
490
492
  this.eventQueue.push({
491
493
  eventName: eventName,
@@ -498,6 +500,7 @@ var EventListener = exports.EventListener = /*#__PURE__*/function () {
498
500
  });
499
501
  }
500
502
  this.clearEnd();
503
+ this.clearStart();
501
504
  this.touchCount = 0;
502
505
  event.stopPropagation();
503
506
  break;
package/build/Moves.js CHANGED
@@ -131,25 +131,30 @@ var Moves = exports.Moves = /*#__PURE__*/function () {
131
131
  }, {
132
132
  key: "shake",
133
133
  value: function shake(tmodel) {
134
- var width = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : tmodel.getWidth();
135
- var height = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : tmodel.getHeight();
136
- var _ref3 = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {},
134
+ var _ref3 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
135
+ _ref3$xStart = _ref3.xStart,
136
+ xStart = _ref3$xStart === void 0 ? undefined : _ref3$xStart,
137
+ _ref3$width = _ref3.width,
138
+ width = _ref3$width === void 0 ? undefined : _ref3$width,
139
+ _ref3$height = _ref3.height,
140
+ height = _ref3$height === void 0 ? undefined : _ref3$height,
137
141
  _ref3$bFactor = _ref3.bFactor,
138
142
  bFactor = _ref3$bFactor === void 0 ? 0.6 : _ref3$bFactor,
139
143
  _ref3$cFactor = _ref3.cFactor,
140
144
  cFactor = _ref3$cFactor === void 0 ? 0.3 : _ref3$cFactor,
141
145
  _ref3$strength = _ref3.strength,
142
146
  strength = _ref3$strength === void 0 ? 20 : _ref3$strength;
143
- var xStart = (tmodel.getParentValue('width') - width) / 2;
147
+ var widthStart = _TUtil.TUtil.isDefined(width) ? width : tmodel.getWidth();
148
+ var heightStart = _TUtil.TUtil.isDefined(height) ? height : tmodel.getHeight();
149
+ var resolvedXStart = _TUtil.TUtil.isDefined(xStart) ? xStart : tmodel.getX();
144
150
  var yStart = tmodel.getY();
145
- var widthStart = width;
146
- var heightStart = height;
147
151
  var bounce = Moves.bounce(yStart - strength, yStart, {
148
- xStart: xStart,
152
+ xStart: resolvedXStart,
149
153
  widthStart: widthStart,
150
154
  heightStart: heightStart,
151
155
  bFactor: bFactor,
152
- cFactor: cFactor
156
+ cFactor: cFactor,
157
+ rIncrement: 0
153
158
  });
154
159
  return {
155
160
  x: bounce.x,
package/build/TModel.js CHANGED
@@ -8,6 +8,7 @@ var _BaseModel2 = require("./BaseModel.js");
8
8
  var _App = require("./App.js");
9
9
  var _Viewport = require("./Viewport.js");
10
10
  var _TUtil = require("./TUtil.js");
11
+ var _VisibilityUtil = require("./VisibilityUtil.js");
11
12
  var _TargetData = require("./TargetData.js");
12
13
  var _SearchUtil = require("./SearchUtil.js");
13
14
  var _TargetUtil = require("./TargetUtil.js");
@@ -166,10 +167,11 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
166
167
  var foundKey = Object.keys(this.actualValues).find(function (key) {
167
168
  return _this2.actualValues[key] === child;
168
169
  });
170
+ var childDefinition = _TUtil.TUtil.cloneTargetDefinition(child);
169
171
  if (foundKey) {
170
- child = new TModel(child.id || foundKey, child);
172
+ child = new TModel(childDefinition.id || foundKey, childDefinition);
171
173
  } else {
172
- child = new TModel("".concat(this.oid, "_"), child);
174
+ child = new TModel("".concat(this.oid, "_"), childDefinition);
173
175
  }
174
176
  }
175
177
  if (!child.toDiscard) {
@@ -347,6 +349,9 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
347
349
  key: "markEventDirty",
348
350
  value: function markEventDirty() {
349
351
  this.eventDirtyEpoch = (0, _App.getEvents)().eventEpoch;
352
+ if (this.bracket) {
353
+ this.bracket.markEventDirty();
354
+ }
350
355
  if (this.parent) {
351
356
  this.parent.markEventDirty();
352
357
  }
@@ -644,7 +649,7 @@ var TModel = exports.TModel = /*#__PURE__*/function (_BaseModel) {
644
649
  }, {
645
650
  key: "calcVisibility",
646
651
  value: function calcVisibility() {
647
- return _TUtil.TUtil.calcVisibility(this);
652
+ return _VisibilityUtil.VisibilityUtil.calcVisibility(this);
648
653
  }
649
654
  }, {
650
655
  key: "validateVisibilityInParent",
package/build/TUtil.js CHANGED
@@ -7,6 +7,7 @@ exports.TUtil = void 0;
7
7
  var _App = require("./App.js");
8
8
  var _TargetUtil = require("./TargetUtil.js");
9
9
  var _TargetData = require("./TargetData.js");
10
+ var _TModel = require("./TModel.js");
10
11
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
11
12
  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); }
12
13
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
@@ -22,134 +23,13 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
22
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); }
23
24
  /**
24
25
  *
25
- * It provide a variety of helping functions that are used by the framework.
26
+ * It provides a variety of helping functions that are used by the framework.
26
27
  */
27
28
  var TUtil = exports.TUtil = /*#__PURE__*/function () {
28
29
  function TUtil() {
29
30
  _classCallCheck(this, TUtil);
30
31
  }
31
32
  return _createClass(TUtil, null, [{
32
- key: "calcVisibility",
33
- value: function calcVisibility(child) {
34
- var _parent$targets$onVis;
35
- var parent = child.getRealParent();
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;
37
- if (!onVisibleChildrenChange && child.isVisible() && (child.isTargetUpdating(child.allTargetMap['x']) || child.isTargetUpdating(child.allTargetMap['y']))) {
38
- return true;
39
- }
40
- var domParent = child.getDomParent();
41
- var scale = (domParent.getMeasuringScale() || 1) * child.getMeasuringScale();
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;
47
- if (!child.visibilityStatus) {
48
- child.visibilityStatus = {};
49
- }
50
- var status = child.visibilityStatus;
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
- }
75
- status.x = x;
76
- status.y = y;
77
- status.width = width;
78
- status.height = height;
79
- child.actualValues.isVisible = status.isVisible;
80
- return status.isVisible;
81
- }
82
- }, {
83
- key: "getVisibilityClipRect",
84
- value: function getVisibilityClipRect(container) {
85
- var rect = TUtil.getScreenViewportRect();
86
- while (container && container !== (0, _App.tRoot)()) {
87
- if (this.shouldClipByAncestor(container)) {
88
- var ancestorRect = this.getAncestorViewportRect(container);
89
- rect = rect && !container.allTargetMap['onWindowScroll'] ? this.intersectVisibilityRects(rect, ancestorRect) : ancestorRect;
90
- if (rect.r <= rect.x || rect.b <= rect.y) {
91
- break;
92
- }
93
- }
94
- container = container.getRealParent();
95
- }
96
- return rect;
97
- }
98
- }, {
99
- key: "getScreenViewportRect",
100
- value: function getScreenViewportRect() {
101
- return {
102
- x: 0,
103
- y: 0,
104
- r: (0, _App.getScreenWidth)(),
105
- b: (0, _App.getScreenHeight)(),
106
- source: "screen"
107
- };
108
- }
109
- }, {
110
- key: "shouldClipByAncestor",
111
- value: function shouldClipByAncestor(ancestor) {
112
- return ancestor.managesOwnScroll();
113
- }
114
- }, {
115
- key: "getAncestorViewportRect",
116
- value: function getAncestorViewportRect(ancestor) {
117
- var _ancestor$$dom, _ancestor$$dom2;
118
- var domScrollLeft = ((_ancestor$$dom = ancestor.$dom) === null || _ancestor$$dom === void 0 ? void 0 : _ancestor$$dom.getScrollLeft()) || 0;
119
- var domScrollTop = ((_ancestor$$dom2 = ancestor.$dom) === null || _ancestor$$dom2 === void 0 ? void 0 : _ancestor$$dom2.getScrollTop()) || 0;
120
- return {
121
- x: ancestor.absX + domScrollLeft,
122
- y: ancestor.absY + domScrollTop,
123
- r: ancestor.absX + domScrollLeft + ancestor.getWidth(),
124
- b: ancestor.absY + domScrollTop + ancestor.getHeight(),
125
- source: ancestor
126
- };
127
- }
128
- }, {
129
- key: "intersectVisibilityRects",
130
- value: function intersectVisibilityRects(a, b) {
131
- return {
132
- x: Math.max(a.x, b.x),
133
- y: Math.max(a.y, b.y),
134
- r: Math.min(a.r, b.r),
135
- b: Math.min(a.b, b.b),
136
- source: b.source
137
- };
138
- }
139
- }, {
140
- key: "updateClipRect",
141
- value: function updateClipRect(tmodel) {
142
- var parent = tmodel.getParent();
143
- var inheritedClip = (parent === null || parent === void 0 ? void 0 : parent.visibilityClipRect) || null;
144
- if (this.shouldClipByAncestor(tmodel)) {
145
- var localRect = this.getLocalViewportRect(tmodel);
146
- tmodel.visibilityClipRect = inheritedClip ? this.intersectVisibilityRects(inheritedClip, localRect) : localRect;
147
- } else {
148
- tmodel.visibilityClipRect = inheritedClip;
149
- }
150
- return tmodel.visibilityClipRect;
151
- }
152
- }, {
153
33
  key: "contains",
154
34
  value: function contains(container, tmodel) {
155
35
  var _tmodel$getDomParent;
@@ -437,5 +317,56 @@ var TUtil = exports.TUtil = /*#__PURE__*/function () {
437
317
  tmodel1.processNewTarget(key, keyIndex);
438
318
  });
439
319
  }
320
+ }, {
321
+ key: "cloneTargetDefinition",
322
+ value: function cloneTargetDefinition(value) {
323
+ var seen = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new WeakMap();
324
+ if (!TUtil.isDefined(value) || _typeof(value) !== 'object') {
325
+ return value;
326
+ }
327
+
328
+ // Keep functions shared. They are behavior, not per-instance state.
329
+ if (typeof value === 'function') {
330
+ return value;
331
+ }
332
+
333
+ // Avoid cloning DOM wrappers, real DOM nodes, TModels, etc.
334
+ if (value instanceof _TModel.TModel || value instanceof Element || value instanceof Node || value instanceof Date || value instanceof RegExp) {
335
+ return value;
336
+ }
337
+ if (seen.has(value)) {
338
+ return seen.get(value);
339
+ }
340
+ if (Array.isArray(value)) {
341
+ var arr = [];
342
+ seen.set(value, arr);
343
+ var _iterator2 = _createForOfIteratorHelper(value),
344
+ _step2;
345
+ try {
346
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
347
+ var item = _step2.value;
348
+ arr.push(TUtil.cloneTargetDefinition(item, seen));
349
+ }
350
+ } catch (err) {
351
+ _iterator2.e(err);
352
+ } finally {
353
+ _iterator2.f();
354
+ }
355
+ return arr;
356
+ }
357
+ var proto = Object.getPrototypeOf(value);
358
+
359
+ // Only deep-clone plain objects.
360
+ if (proto !== Object.prototype && proto !== null) {
361
+ return value;
362
+ }
363
+ var cloned = {};
364
+ seen.set(value, cloned);
365
+ for (var _i = 0, _Object$keys = Object.keys(value); _i < _Object$keys.length; _i++) {
366
+ var key = _Object$keys[_i];
367
+ cloned[key] = TUtil.cloneTargetDefinition(value[key], seen);
368
+ }
369
+ return cloned;
370
+ }
440
371
  }]);
441
372
  }();
@@ -439,7 +439,7 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
439
439
  }
440
440
  if (tmodel.isTargetTreeComplete(targetName) !== true) {
441
441
  //const activeChildrenList = [ ...TargetUtil.getActiveChildren(tmodel, tmodel.targets[targetName].completionScope).values() ];
442
- //return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + tmodel.isTargetTreeComplete(targetName) + ":: " + activeChildrenList.map(t => t.oid + ':' + t.hasAnyUpdates()) + ", " + [ ...TargetUtil.getUpdatingChildren(tmodel, targetName).keys() ];
442
+ //return tmodel.oid + "." + targetName + " ==> " + tmodel.getTargetStatus(targetName) + ", " + tmodel.isTargetTreeComplete(targetName) + ":: " + activeChildrenList.map(t => t.oid + ':' + t.hasAnyUpdates()) + ", " + [ ...TargetUtil.getUpdatingChildren(tmodel, targetName, tmodel.targets[targetName].completionScope).keys() ];
443
443
  return false;
444
444
  }
445
445
  }
@@ -579,6 +579,9 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
579
579
  }, {
580
580
  key: "shouldIgnoreChildForCompletion",
581
581
  value: function shouldIgnoreChildForCompletion(child, completionScope) {
582
+ if (!child.exists()) {
583
+ return true;
584
+ }
582
585
  if (completionScope === "none") {
583
586
  return true;
584
587
  }
@@ -686,44 +689,33 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
686
689
  }, {
687
690
  key: "resetTargetState",
688
691
  value: function resetTargetState(tmodel, targetName) {
689
- var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
692
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
693
+ var visited = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Set();
690
694
  if (!tmodel || !targetName) {
691
695
  return;
692
696
  }
693
697
  TargetUtil.resetSingleTargetState(tmodel, targetName);
698
+ TargetUtil.resetTargetChildActions(tmodel, targetName, options, visited);
694
699
  var target = tmodel.targets[targetName];
695
700
  var nextTarget = target === null || target === void 0 ? void 0 : target.activateNextTarget;
696
701
  var nextTargetDef = tmodel.targets[nextTarget];
697
702
  if (!nextTargetDef || !nextTarget.endsWith('$') && nextTargetDef.active === false) {
698
703
  return;
699
704
  }
700
- TargetUtil.resetTargetsBetween(tmodel, targetName, nextTarget, visited);
701
- TargetUtil.resetTargetPipelineState(tmodel, nextTarget, visited);
705
+ TargetUtil.resetTargetsBetween(tmodel, targetName, nextTarget, options, visited);
706
+ TargetUtil.resetTargetPipelineState(tmodel, nextTarget, options, visited);
702
707
  }
703
708
  }, {
704
709
  key: "resetTargetPipelineState",
705
710
  value: function resetTargetPipelineState(tmodel, targetName) {
706
- var _target$childAction4, _target$addChildActio;
707
- var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
711
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
712
+ var visited = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Set();
708
713
  if (!tmodel || !targetName) {
709
714
  return;
710
715
  }
711
- var target = tmodel.targets[targetName];
712
716
  TargetUtil.resetSingleTargetState(tmodel, targetName);
713
- if ((_target$childAction4 = target.childAction) !== null && _target$childAction4 !== void 0 && _target$childAction4.length) {
714
- target.childAction.forEach(function (child) {
715
- if (child) {
716
- TargetUtil.resetTargetChildState(child, visited);
717
- }
718
- });
719
- }
720
- if ((_target$addChildActio = target.addChildAction) !== null && _target$addChildActio !== void 0 && _target$addChildActio.length) {
721
- target.addChildAction.forEach(function (child) {
722
- if (child) {
723
- TargetUtil.resetTargetChildState(child, visited);
724
- }
725
- });
726
- }
717
+ TargetUtil.resetTargetChildActions(tmodel, targetName, options, visited);
718
+ var target = tmodel.targets[targetName];
727
719
  var nextTarget = target === null || target === void 0 ? void 0 : target.activateNextTarget;
728
720
  if (!nextTarget) {
729
721
  return;
@@ -732,12 +724,14 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
732
724
  if (!nextTargetDef || !nextTarget.endsWith('$') && nextTargetDef.active === false) {
733
725
  return;
734
726
  }
735
- TargetUtil.resetTargetsBetween(tmodel, targetName, nextTarget, visited);
736
- TargetUtil.resetTargetPipelineState(tmodel, nextTarget, visited);
727
+ TargetUtil.resetTargetsBetween(tmodel, targetName, nextTarget, options, visited);
728
+ TargetUtil.resetTargetPipelineState(tmodel, nextTarget, options, visited);
737
729
  }
738
730
  }, {
739
731
  key: "resetTargetsBetween",
740
- value: function resetTargetsBetween(tmodel, fromTarget, toTarget, visited) {
732
+ value: function resetTargetsBetween(tmodel, fromTarget, toTarget) {
733
+ var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
734
+ var visited = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : new Set();
741
735
  var names = tmodel.functionTargetNames;
742
736
  var fromIndex = names.indexOf(fromTarget);
743
737
  var toIndex = names.indexOf(toTarget);
@@ -745,29 +739,16 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
745
739
  return;
746
740
  }
747
741
  for (var i = fromIndex + 1; i < toIndex; i++) {
748
- var _target$childAction5, _target$addChildActio2;
749
742
  var key = names[i];
750
743
  TargetUtil.resetSingleTargetState(tmodel, key);
751
- var target = tmodel.targets[key];
752
- if (target !== null && target !== void 0 && (_target$childAction5 = target.childAction) !== null && _target$childAction5 !== void 0 && _target$childAction5.length) {
753
- target.childAction.forEach(function (child) {
754
- if (child) {
755
- TargetUtil.resetTargetChildState(child, visited);
756
- }
757
- });
758
- }
759
- if (target !== null && target !== void 0 && (_target$addChildActio2 = target.addChildAction) !== null && _target$addChildActio2 !== void 0 && _target$addChildActio2.length) {
760
- target.addChildAction.forEach(function (child) {
761
- if (child) {
762
- TargetUtil.resetTargetChildState(child, visited);
763
- }
764
- });
765
- }
744
+ TargetUtil.resetTargetChildActions(tmodel, key, options, visited);
766
745
  }
767
746
  }
768
747
  }, {
769
748
  key: "resetTargetChildState",
770
- value: function resetTargetChildState(tmodel, visited) {
749
+ value: function resetTargetChildState(tmodel) {
750
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
751
+ var visited = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new Set();
771
752
  var sig = "".concat(tmodel.oid);
772
753
  if (visited.has(sig)) {
773
754
  return;
@@ -775,25 +756,38 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
775
756
  visited.add(sig);
776
757
  var names = Object.keys(tmodel.targetValues);
777
758
  for (var i = 0; i < names.length; i++) {
778
- var _target$childAction6, _target$addChildActio3;
779
759
  var key = names[i];
780
- var target = tmodel.targets[key];
781
760
  TargetUtil.resetSingleTargetState(tmodel, key);
782
- if (target !== null && target !== void 0 && (_target$childAction6 = target.childAction) !== null && _target$childAction6 !== void 0 && _target$childAction6.length) {
783
- target.childAction.forEach(function (child) {
784
- if (child) {
785
- TargetUtil.resetTargetChildState(child, visited);
786
- }
787
- });
788
- target.childAction = [];
761
+ TargetUtil.resetTargetChildActions(tmodel, key, options, visited);
762
+ }
763
+ }
764
+ }, {
765
+ key: "resetTargetChildActions",
766
+ value: function resetTargetChildActions(tmodel, key) {
767
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
768
+ var visited = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : new Set();
769
+ var target = tmodel.targets[key];
770
+ if (!target) {
771
+ return;
772
+ }
773
+ var childActions = target.childAction ? _toConsumableArray(target.childAction) : [];
774
+ var addChildActions = target.addChildAction ? _toConsumableArray(target.addChildAction) : [];
775
+ childActions.forEach(function (child) {
776
+ if (child) {
777
+ TargetUtil.resetTargetChildState(child, options, visited);
789
778
  }
790
- if (target !== null && target !== void 0 && (_target$addChildActio3 = target.addChildAction) !== null && _target$addChildActio3 !== void 0 && _target$addChildActio3.length) {
791
- target.addChildAction.forEach(function (child) {
792
- if (child) {
793
- TargetUtil.resetTargetChildState(child, visited);
794
- }
795
- });
796
- target.addChildAction = [];
779
+ });
780
+ addChildActions.forEach(function (child) {
781
+ if (child) {
782
+ TargetUtil.resetTargetChildState(child, options, visited);
783
+ }
784
+ });
785
+ if (options.clearChildActions) {
786
+ if (Array.isArray(target.childAction)) {
787
+ target.childAction.length = 0;
788
+ }
789
+ if (Array.isArray(target.addChildAction)) {
790
+ target.addChildAction.length = 0;
797
791
  }
798
792
  }
799
793
  }
@@ -816,25 +810,13 @@ var TargetUtil = exports.TargetUtil = /*#__PURE__*/function () {
816
810
  TargetUtil.clearPendingTarget(tmodel, key);
817
811
  }
818
812
  }, {
819
- key: "removeChildFromTargetActions",
820
- value: function removeChildFromTargetActions(parent, child) {
821
- if (!parent || !child) {
822
- return;
823
- }
824
- for (var _i2 = 0, _Object$values = Object.values(parent.targets); _i2 < _Object$values.length; _i2++) {
825
- var _target$childAction7, _target$addChildActio4;
826
- var target = _Object$values[_i2];
827
- if ((_target$childAction7 = target.childAction) !== null && _target$childAction7 !== void 0 && _target$childAction7.length) {
828
- target.childAction = target.childAction.filter(function (c) {
829
- return c !== child;
830
- });
831
- }
832
- if ((_target$addChildActio4 = target.addChildAction) !== null && _target$addChildActio4 !== void 0 && _target$addChildActio4.length) {
833
- target.addChildAction = target.addChildAction.filter(function (c) {
834
- return c !== child;
835
- });
836
- }
837
- }
813
+ key: "getResetOptions",
814
+ value: function getResetOptions(options) {
815
+ var reset = options === null || options === void 0 ? void 0 : options.reset;
816
+ return {
817
+ shouldReset: reset === true || reset === 'pipeline' || reset === 'tree' || reset === 'all',
818
+ clearChildActions: reset === 'tree' || reset === 'all'
819
+ };
838
820
  }
839
821
  }]);
840
822
  }();